summaryrefslogtreecommitdiff
path: root/binfilter/bf_sw/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'binfilter/bf_sw/source/core')
-rw-r--r--binfilter/bf_sw/source/core/attr/makefile.mk66
-rw-r--r--binfilter/bf_sw/source/core/attr/sw_calbck.cxx616
-rw-r--r--binfilter/bf_sw/source/core/attr/sw_cellatr.cxx170
-rw-r--r--binfilter/bf_sw/source/core/attr/sw_format.cxx631
-rw-r--r--binfilter/bf_sw/source/core/attr/sw_hints.cxx301
-rw-r--r--binfilter/bf_sw/source/core/attr/sw_swatrset.cxx292
-rw-r--r--binfilter/bf_sw/source/core/bastyp/makefile.mk75
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_bparr.cxx586
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_breakit.cxx107
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_calc.cxx1675
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_checkit.cxx55
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_index.cxx600
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_init.cxx860
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_ring.cxx107
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_swcache.cxx655
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_swrect.cxx320
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_swregion.cxx181
-rw-r--r--binfilter/bf_sw/source/core/bastyp/sw_swtypes.cxx152
-rw-r--r--binfilter/bf_sw/source/core/crsr/callnk.hxx58
-rw-r--r--binfilter/bf_sw/source/core/crsr/makefile.mk68
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_bookmrk.cxx107
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_callnk.cxx260
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_crbm.cxx43
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_crsrsh.cxx960
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_findattr.cxx182
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_findcoll.cxx66
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_findtxt.cxx72
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_pam.cxx655
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_paminit.cxx139
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_splcstk.cxx162
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_swcrsr.cxx471
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_trvlreg.cxx69
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx202
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_unocrsr.cxx222
-rw-r--r--binfilter/bf_sw/source/core/crsr/sw_viscrs.cxx334
-rw-r--r--binfilter/bf_sw/source/core/doc/makefile.mk91
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_SwStyleNameMapper.cxx1137
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_doc.cxx559
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docbm.cxx818
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docchart.cxx355
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_doccorr.cxx505
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docdde.cxx244
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docdesc.cxx928
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docdraw.cxx439
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docedt.cxx645
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docfld.cxx1808
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docfly.cxx842
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docfmt.cxx1288
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docftn.cxx447
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_doclay.cxx1133
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docnew.cxx746
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docnum.cxx943
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docredln.cxx591
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docruby.cxx57
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docsort.cxx193
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_docstat.cxx73
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_doctxm.cxx511
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_extinput.cxx90
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx328
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_ftnidx.cxx403
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_gctable.cxx478
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_htmltbl.cxx92
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_lineinfo.cxx140
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_notxtfrm.cxx436
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_number.cxx631
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_numpara.cxx291
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_poolfmt.cxx2240
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_sortopt.cxx101
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_swserv.cxx202
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_swtable.cxx1076
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_tblafmt.cxx83
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_tblrwcl.cxx1270
-rw-r--r--binfilter/bf_sw/source/core/doc/sw_visiturl.cxx151
-rw-r--r--binfilter/bf_sw/source/core/docnode/makefile.mk84
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndarr.cxx73
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndcopy.cxx563
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndindex.cxx156
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndnotxt.cxx203
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndnum.cxx371
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndsect.cxx940
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndtbl.cxx920
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_ndtbl1.cxx407
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_node.cxx1351
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_node2lay.cxx360
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_nodes.cxx1421
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_section.cxx1150
-rw-r--r--binfilter/bf_sw/source/core/docnode/sw_swbaslnk.cxx478
-rw-r--r--binfilter/bf_sw/source/core/draw/makefile.mk56
-rw-r--r--binfilter/bf_sw/source/core/draw/sw_dcontact.cxx1570
-rw-r--r--binfilter/bf_sw/source/core/draw/sw_dflyobj.cxx261
-rw-r--r--binfilter/bf_sw/source/core/draw/sw_dobjfac.cxx58
-rw-r--r--binfilter/bf_sw/source/core/draw/sw_dpage.cxx146
-rw-r--r--binfilter/bf_sw/source/core/draw/sw_drawdoc.cxx308
-rw-r--r--binfilter/bf_sw/source/core/draw/sw_dview.cxx238
-rw-r--r--binfilter/bf_sw/source/core/edit/makefile.mk60
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_autofmt.cxx71
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_edatmisc.cxx71
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_edfld.cxx105
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_ednumber.cxx49
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_edredln.cxx46
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_edsect.cxx45
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_edtab.cxx51
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_edundo.cxx42
-rw-r--r--binfilter/bf_sw/source/core/edit/sw_edws.cxx112
-rw-r--r--binfilter/bf_sw/source/core/except/makefile.mk67
-rw-r--r--binfilter/bf_sw/source/core/except/sw_dbgloop.cxx119
-rw-r--r--binfilter/bf_sw/source/core/except/sw_errhdl.cxx155
-rw-r--r--binfilter/bf_sw/source/core/fields/makefile.mk68
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_authfld.cxx854
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_cellfml.cxx586
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_chpfld.cxx265
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_dbfld.cxx996
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_ddefld.cxx271
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_ddetbl.cxx62
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_docufld.cxx2274
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_expfld.cxx1122
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_fldbas.cxx647
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_flddat.cxx320
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_flddropdown.cxx225
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_inetfld.cxx241
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_macrofld.cxx213
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_reffld.cxx815
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_scrptfld.cxx152
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_tblcalc.cxx273
-rw-r--r--binfilter/bf_sw/source/core/fields/sw_usrfld.cxx377
-rw-r--r--binfilter/bf_sw/source/core/frmedt/makefile.mk61
-rw-r--r--binfilter/bf_sw/source/core/frmedt/sw_fefly1.cxx287
-rw-r--r--binfilter/bf_sw/source/core/frmedt/sw_feshview.cxx139
-rw-r--r--binfilter/bf_sw/source/core/frmedt/sw_fetab.cxx78
-rw-r--r--binfilter/bf_sw/source/core/frmedt/sw_fews.cxx63
-rw-r--r--binfilter/bf_sw/source/core/frmedt/sw_tblsel.cxx1571
-rw-r--r--binfilter/bf_sw/source/core/graphic/makefile.mk58
-rw-r--r--binfilter/bf_sw/source/core/graphic/sw_grfatr.cxx362
-rw-r--r--binfilter/bf_sw/source/core/graphic/sw_ndgrf.cxx924
-rw-r--r--binfilter/bf_sw/source/core/inc/GetMetricVal.hxx57
-rw-r--r--binfilter/bf_sw/source/core/inc/SwPortionHandler.hxx107
-rw-r--r--binfilter/bf_sw/source/core/inc/SwXTextDefaults.hxx90
-rw-r--r--binfilter/bf_sw/source/core/inc/atrhndl.hxx173
-rw-r--r--binfilter/bf_sw/source/core/inc/blink.hxx69
-rw-r--r--binfilter/bf_sw/source/core/inc/bodyfrm.hxx55
-rw-r--r--binfilter/bf_sw/source/core/inc/cellfrm.hxx60
-rw-r--r--binfilter/bf_sw/source/core/inc/cntfrm.hxx119
-rw-r--r--binfilter/bf_sw/source/core/inc/colfrm.hxx49
-rw-r--r--binfilter/bf_sw/source/core/inc/dbg_lay.hxx122
-rw-r--r--binfilter/bf_sw/source/core/inc/dflyobj.hxx105
-rw-r--r--binfilter/bf_sw/source/core/inc/docfld.hxx171
-rw-r--r--binfilter/bf_sw/source/core/inc/docfunc.hxx72
-rw-r--r--binfilter/bf_sw/source/core/inc/doctxm.hxx127
-rw-r--r--binfilter/bf_sw/source/core/inc/drawdev.hxx143
-rw-r--r--binfilter/bf_sw/source/core/inc/drawfont.hxx767
-rw-r--r--binfilter/bf_sw/source/core/inc/dview.hxx69
-rw-r--r--binfilter/bf_sw/source/core/inc/flowfrm.hxx194
-rw-r--r--binfilter/bf_sw/source/core/inc/flyfrm.hxx227
-rw-r--r--binfilter/bf_sw/source/core/inc/flyfrms.hxx169
-rw-r--r--binfilter/bf_sw/source/core/inc/fntcache.hxx157
-rw-r--r--binfilter/bf_sw/source/core/inc/frame.hxx1093
-rw-r--r--binfilter/bf_sw/source/core/inc/frmsh.hxx56
-rw-r--r--binfilter/bf_sw/source/core/inc/frmtool.hxx460
-rw-r--r--binfilter/bf_sw/source/core/inc/ftnboss.hxx128
-rw-r--r--binfilter/bf_sw/source/core/inc/ftnfrm.hxx126
-rw-r--r--binfilter/bf_sw/source/core/inc/hffrm.hxx71
-rw-r--r--binfilter/bf_sw/source/core/inc/layact.hxx245
-rw-r--r--binfilter/bf_sw/source/core/inc/laycache.hxx79
-rw-r--r--binfilter/bf_sw/source/core/inc/layfrm.hxx184
-rw-r--r--binfilter/bf_sw/source/core/inc/layouter.hxx60
-rw-r--r--binfilter/bf_sw/source/core/inc/mvsave.hxx212
-rw-r--r--binfilter/bf_sw/source/core/inc/node2lay.hxx81
-rw-r--r--binfilter/bf_sw/source/core/inc/noteurl.hxx78
-rw-r--r--binfilter/bf_sw/source/core/inc/notxtfrm.hxx86
-rw-r--r--binfilter/bf_sw/source/core/inc/numpara.hxx72
-rw-r--r--binfilter/bf_sw/source/core/inc/pagefrm.hxx435
-rw-r--r--binfilter/bf_sw/source/core/inc/pamtyp.hxx105
-rw-r--r--binfilter/bf_sw/source/core/inc/prevwpage.hxx41
-rw-r--r--binfilter/bf_sw/source/core/inc/ptqueue.hxx65
-rw-r--r--binfilter/bf_sw/source/core/inc/rootfrm.hxx325
-rw-r--r--binfilter/bf_sw/source/core/inc/rowfrm.hxx76
-rw-r--r--binfilter/bf_sw/source/core/inc/scrrect.hxx142
-rw-r--r--binfilter/bf_sw/source/core/inc/sectfrm.hxx154
-rw-r--r--binfilter/bf_sw/source/core/inc/setmapvirtdev.hxx76
-rw-r--r--binfilter/bf_sw/source/core/inc/splargs.hxx163
-rw-r--r--binfilter/bf_sw/source/core/inc/splcstk.hxx71
-rw-r--r--binfilter/bf_sw/source/core/inc/swblocks.hxx80
-rw-r--r--binfilter/bf_sw/source/core/inc/swcache.hxx304
-rw-r--r--binfilter/bf_sw/source/core/inc/swfntcch.hxx105
-rw-r--r--binfilter/bf_sw/source/core/inc/swfont.hxx859
-rw-r--r--binfilter/bf_sw/source/core/inc/tabfrm.hxx159
-rw-r--r--binfilter/bf_sw/source/core/inc/tblrwcl.hxx219
-rw-r--r--binfilter/bf_sw/source/core/inc/toxhlp.hxx75
-rw-r--r--binfilter/bf_sw/source/core/inc/txmsrt.hxx195
-rw-r--r--binfilter/bf_sw/source/core/inc/txtfrm.hxx707
-rw-r--r--binfilter/bf_sw/source/core/inc/txttypes.hxx104
-rw-r--r--binfilter/bf_sw/source/core/inc/unoclbck.hxx56
-rw-r--r--binfilter/bf_sw/source/core/inc/unofldmid.h65
-rw-r--r--binfilter/bf_sw/source/core/inc/viewimp.hxx327
-rw-r--r--binfilter/bf_sw/source/core/inc/visiturl.hxx53
-rw-r--r--binfilter/bf_sw/source/core/inc/wrong.hxx87
-rw-r--r--binfilter/bf_sw/source/core/layout/layhelp.hxx239
-rw-r--r--binfilter/bf_sw/source/core/layout/makefile.mk135
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_atrfrm.cxx2716
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_calcmove.cxx1643
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_colfrm.cxx484
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_dbg_lay.cxx279
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_findfrm.cxx1136
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_flowfrm.cxx1896
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_fly.cxx2073
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_flycnt.cxx2194
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_flyincnt.cxx362
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_flylay.cxx1143
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_flypos.cxx116
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_frmtool.cxx3164
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_ftnfrm.cxx2244
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_hffrm.cxx778
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_layact.cxx2610
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_laycache.cxx1166
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_layouter.cxx175
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_newfrm.cxx608
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_pagechg.cxx1973
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_pagedesc.cxx353
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_pageiter.cxx111
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_paintfrm.cxx39
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_sectfrm.cxx2159
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_ssfrm.cxx621
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_tabfrm.cxx2812
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_trvlfrm.cxx912
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_unusedf.cxx65
-rw-r--r--binfilter/bf_sw/source/core/layout/sw_wsfrm.cxx3451
-rw-r--r--binfilter/bf_sw/source/core/layout/virtoutp.hxx74
-rw-r--r--binfilter/bf_sw/source/core/makefile.mk98
-rw-r--r--binfilter/bf_sw/source/core/ole/makefile.mk57
-rw-r--r--binfilter/bf_sw/source/core/ole/sw_ndole.cxx536
-rw-r--r--binfilter/bf_sw/source/core/para/makefile.mk57
-rw-r--r--binfilter/bf_sw/source/core/para/sw_paratr.cxx305
-rw-r--r--binfilter/bf_sw/source/core/sw3io/crypter.hxx54
-rw-r--r--binfilter/bf_sw/source/core/sw3io/makefile.mk92
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw3ids.hxx229
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw3imp.hxx847
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw3marks.hxx73
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx100
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3attr.cxx1125
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3block.cxx109
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3doc.cxx770
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx2964
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3fmts.cxx1189
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3gsect.cxx36
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx2681
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3io.cxx385
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3misc.cxx2810
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx2794
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx1129
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3num.cxx1498
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3page.cxx600
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3redln.cxx786
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3sectn.cxx931
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3style.cxx1257
-rw-r--r--binfilter/bf_sw/source/core/sw3io/sw_sw3table.cxx698
-rw-r--r--binfilter/bf_sw/source/core/swg/frmids.hxx81
-rw-r--r--binfilter/bf_sw/source/core/swg/makefile.mk73
-rw-r--r--binfilter/bf_sw/source/core/swg/oldhntid.hxx201
-rw-r--r--binfilter/bf_sw/source/core/swg/rdswg.hxx332
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_SwXMLSectionList.cxx66
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdcont.cxx662
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdflds.cxx775
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdfmts.cxx1096
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdhnt.cxx1351
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdmisc.cxx509
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdnds.cxx771
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdnum.cxx322
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdpage.cxx388
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdswg.cxx606
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_rdtox.cxx249
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_swgpar.cxx80
-rw-r--r--binfilter/bf_sw/source/core/swg/sw_swgstr.cxx256
-rw-r--r--binfilter/bf_sw/source/core/swg/swgids.hxx255
-rw-r--r--binfilter/bf_sw/source/core/text/guess.hxx85
-rw-r--r--binfilter/bf_sw/source/core/text/inftxt.hxx859
-rw-r--r--binfilter/bf_sw/source/core/text/itratr.hxx142
-rw-r--r--binfilter/bf_sw/source/core/text/itrform2.hxx214
-rw-r--r--binfilter/bf_sw/source/core/text/itrpaint.hxx66
-rw-r--r--binfilter/bf_sw/source/core/text/itrtxt.hxx358
-rw-r--r--binfilter/bf_sw/source/core/text/makefile.mk111
-rw-r--r--binfilter/bf_sw/source/core/text/pordrop.hxx109
-rw-r--r--binfilter/bf_sw/source/core/text/porexp.hxx98
-rw-r--r--binfilter/bf_sw/source/core/text/porfld.hxx183
-rw-r--r--binfilter/bf_sw/source/core/text/porfly.hxx114
-rw-r--r--binfilter/bf_sw/source/core/text/porftn.hxx109
-rw-r--r--binfilter/bf_sw/source/core/text/porglue.hxx135
-rw-r--r--binfilter/bf_sw/source/core/text/porhyph.hxx102
-rw-r--r--binfilter/bf_sw/source/core/text/porlay.hxx373
-rw-r--r--binfilter/bf_sw/source/core/text/porlin.hxx248
-rw-r--r--binfilter/bf_sw/source/core/text/pormulti.hxx157
-rw-r--r--binfilter/bf_sw/source/core/text/porref.hxx78
-rw-r--r--binfilter/bf_sw/source/core/text/porrst.hxx160
-rw-r--r--binfilter/bf_sw/source/core/text/portab.hxx123
-rw-r--r--binfilter/bf_sw/source/core/text/portox.hxx76
-rw-r--r--binfilter/bf_sw/source/core/text/portxt.hxx100
-rw-r--r--binfilter/bf_sw/source/core/text/possiz.hxx95
-rw-r--r--binfilter/bf_sw/source/core/text/redlnitr.hxx88
-rw-r--r--binfilter/bf_sw/source/core/text/sw_atrstck.cxx729
-rw-r--r--binfilter/bf_sw/source/core/text/sw_blink.cxx40
-rw-r--r--binfilter/bf_sw/source/core/text/sw_frmcrsr.cxx634
-rw-r--r--binfilter/bf_sw/source/core/text/sw_frmform.cxx2088
-rw-r--r--binfilter/bf_sw/source/core/text/sw_frmpaint.cxx120
-rw-r--r--binfilter/bf_sw/source/core/text/sw_guess.cxx578
-rw-r--r--binfilter/bf_sw/source/core/text/sw_inftxt.cxx1029
-rw-r--r--binfilter/bf_sw/source/core/text/sw_itradj.cxx493
-rw-r--r--binfilter/bf_sw/source/core/text/sw_itratr.cxx359
-rw-r--r--binfilter/bf_sw/source/core/text/sw_itrcrsr.cxx1124
-rw-r--r--binfilter/bf_sw/source/core/text/sw_itrform2.cxx1871
-rw-r--r--binfilter/bf_sw/source/core/text/sw_itrpaint.cxx103
-rw-r--r--binfilter/bf_sw/source/core/text/sw_itrtxt.cxx514
-rw-r--r--binfilter/bf_sw/source/core/text/sw_noteurl.cxx58
-rw-r--r--binfilter/bf_sw/source/core/text/sw_porexp.cxx215
-rw-r--r--binfilter/bf_sw/source/core/text/sw_porfld.cxx526
-rw-r--r--binfilter/bf_sw/source/core/text/sw_porfly.cxx639
-rw-r--r--binfilter/bf_sw/source/core/text/sw_porglue.cxx253
-rw-r--r--binfilter/bf_sw/source/core/text/sw_porlay.cxx1186
-rw-r--r--binfilter/bf_sw/source/core/text/sw_porlin.cxx349
-rw-r--r--binfilter/bf_sw/source/core/text/sw_pormulti.cxx840
-rw-r--r--binfilter/bf_sw/source/core/text/sw_porrst.cxx381
-rw-r--r--binfilter/bf_sw/source/core/text/sw_portox.cxx82
-rw-r--r--binfilter/bf_sw/source/core/text/sw_portxt.cxx633
-rw-r--r--binfilter/bf_sw/source/core/text/sw_redlnitr.cxx207
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtcache.cxx244
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtdrop.cxx346
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtfld.cxx440
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtfly.cxx1900
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtfrm.cxx2064
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtftn.cxx1414
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txthyph.cxx355
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtinit.cxx107
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txtio.cxx1077
-rw-r--r--binfilter/bf_sw/source/core/text/sw_txttab.cxx418
-rw-r--r--binfilter/bf_sw/source/core/text/sw_widorp.cxx537
-rw-r--r--binfilter/bf_sw/source/core/text/sw_wrong.cxx118
-rw-r--r--binfilter/bf_sw/source/core/text/txtcache.hxx82
-rw-r--r--binfilter/bf_sw/source/core/text/txtcfg.hxx59
-rw-r--r--binfilter/bf_sw/source/core/text/txtfly.hxx231
-rw-r--r--binfilter/bf_sw/source/core/text/txtpaint.hxx226
-rw-r--r--binfilter/bf_sw/source/core/text/widorp.hxx112
-rw-r--r--binfilter/bf_sw/source/core/tox/makefile.mk73
-rw-r--r--binfilter/bf_sw/source/core/tox/sw_tox.cxx1102
-rw-r--r--binfilter/bf_sw/source/core/tox/sw_toxhlp.cxx136
-rw-r--r--binfilter/bf_sw/source/core/tox/sw_txmsrt.cxx500
-rw-r--r--binfilter/bf_sw/source/core/txtnode/makefile.mk84
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_atrfld.cxx278
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_atrflyin.cxx276
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_atrftn.cxx443
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_atrref.cxx103
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_atrtox.cxx99
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_fmtatr1.cxx81
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_fmtatr2.cxx507
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_fntcache.cxx785
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_fntcap.cxx550
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_ndhints.cxx405
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_ndtxt.cxx2355
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_swfntcch.cxx99
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_swfont.cxx856
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_thints.cxx2006
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_txatbase.cxx76
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_txtatr2.cxx218
-rw-r--r--binfilter/bf_sw/source/core/txtnode/sw_txtedt.cxx396
-rw-r--r--binfilter/bf_sw/source/core/unocore/makefile.mk125
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_SwXTextDefaults.cxx301
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_TextCursorHelper.cxx60
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_swunohelper.cxx104
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unobkm.cxx321
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoclbck.cxx105
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unocoll.cxx1575
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unocrsrhelper.cxx758
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unodraw.cxx1668
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoevent.cxx468
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoevtlstnr.cxx125
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unofield.cxx2718
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoframe.cxx2836
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoftn.cxx589
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoidx.cxx2726
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unomap.cxx2339
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoobj.cxx2193
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoobj2.cxx2465
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoparagraph.cxx838
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoport.cxx900
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoportenum.cxx923
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoprnms.cxx721
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoredline.cxx694
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unoredlines.cxx254
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unorefmk.cxx381
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unosect.cxx1433
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unosett.cxx2414
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unosrch.cxx778
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unostyle.cxx3333
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unotbl.cxx4464
-rw-r--r--binfilter/bf_sw/source/core/unocore/sw_unotext.cxx1768
-rw-r--r--binfilter/bf_sw/source/core/view/makefile.mk72
-rw-r--r--binfilter/bf_sw/source/core/view/sw_scrrect.cxx253
-rw-r--r--binfilter/bf_sw/source/core/view/sw_vdraw.cxx252
-rw-r--r--binfilter/bf_sw/source/core/view/sw_viewimp.cxx283
-rw-r--r--binfilter/bf_sw/source/core/view/sw_viewsh.cxx624
-rw-r--r--binfilter/bf_sw/source/core/view/sw_vnew.cxx224
-rw-r--r--binfilter/bf_sw/source/core/view/sw_vprint.cxx114
399 files changed, 223081 insertions, 0 deletions
diff --git a/binfilter/bf_sw/source/core/attr/makefile.mk b/binfilter/bf_sw/source/core/attr/makefile.mk
new file mode 100644
index 000000000000..ee8500fbd59b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/attr/makefile.mk
@@ -0,0 +1,66 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_attr
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_calbck.cxx \
+ sw_cellatr.cxx \
+ sw_format.cxx \
+ sw_hints.cxx \
+ sw_swatrset.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/sw_calbck.obj \
+ $(SLO)$/sw_cellatr.obj \
+ $(SLO)$/sw_format.obj \
+ $(SLO)$/sw_hints.obj \
+ $(SLO)$/sw_swatrset.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/attr/sw_calbck.cxx b/binfilter/bf_sw/source/core/attr/sw_calbck.cxx
new file mode 100644
index 000000000000..3c0377ce3079
--- /dev/null
+++ b/binfilter/bf_sw/source/core/attr/sw_calbck.cxx
@@ -0,0 +1,616 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx> // fuer RES_..
+#include <frame.hxx>
+#include <hints.hxx>
+#include <swfntcch.hxx>
+namespace binfilter {
+
+static SwClientIter* pClientIters = 0;
+
+/*N*/ TYPEINIT0(SwClient); //rtti
+
+/*************************************************************************
+|* SwClient::SwClient(SwModify *)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung MA 20. Mar. 95
+*************************************************************************/
+
+
+/*N*/ SwClient::SwClient(SwModify *pToRegisterIn)
+/*N*/ : pLeft( 0 ), pRight( 0 ), pRegisteredIn( 0 )
+/*N*/ {
+/*N*/ bModifyLocked =
+/*N*/ bInModify =
+/*N*/ bInDocDTOR =
+/*N*/ bInCache = FALSE;
+/*N*/ bInSwFntCache = FALSE;
+/*N*/
+/*N*/ if(pToRegisterIn)
+/*N*/ pToRegisterIn->Add(this);
+/*N*/ }
+
+/*************************************************************************
+|* SwClient::Modify()
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+/*N*/ void SwClient::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ if( (!pOld || pOld->Which() != RES_OBJECTDYING) )
+/*N*/ return;
+/*N*/
+/*N*/ SwPtrMsgPoolItem *pDead = (SwPtrMsgPoolItem *)pOld;
+/*N*/ if(pDead->pObject == pRegisteredIn)
+/*N*/ {
+/*N*/ SwModify *pAbove = (SwModify*)pRegisteredIn->GetRegisteredIn();
+/*N*/ if(pAbove)
+/*N*/ {
+/*?*/ pAbove->Add(this);
+/*?*/ return;
+/*N*/ }
+/*N*/ pRegisteredIn->Remove(this);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|* SwClient::~SwClient()
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung MA 25. Jan. 94
+*************************************************************************/
+
+
+/*N*/ SwClient::~SwClient()
+/*N*/ {
+/*N*/ if( pRegisteredIn && pRegisteredIn->GetDepends() )
+/*N*/ pRegisteredIn->Remove( this );
+/*N*/
+/*N*/ ASSERT( !IsModifyLocked(), "Modify destroyed but locked." );
+/*N*/ }
+
+
+ // erfrage vom Client Informationen
+/*N*/ BOOL SwClient::GetInfo( SfxPoolItem& ) const
+/*N*/ {
+/*N*/ return TRUE; // und weiter
+/*N*/ }
+
+/*************************************************************************
+|* SwModify::SwModify( SwModify * )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+/*N*/ SwModify::SwModify( SwModify *pToRegisterIn )
+/*N*/ : SwClient(pToRegisterIn), pRoot( 0 )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|* SwModify::~SwModify()
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 15.04.94
+*************************************************************************/
+
+
+
+/*N*/ SwModify::~SwModify()
+/*N*/ {
+/*N*/ if ( IsInCache() )
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/
+/*N*/ if ( IsInSwFntCache() )
+/*N*/ pSwFontCache->Delete( this );
+/*N*/
+/*N*/ if( pRoot )
+/*N*/ {
+/*N*/ if( IsInDocDTOR() )
+/*N*/ {
+/*N*/ // alle Clients "logisch" austragen
+/*N*/ SwClientIter aIter( *this );
+/*N*/ SwClient* p;
+/*N*/ while( 0 != ( p = aIter++ ) )
+/*N*/ p->pRegisteredIn = 0;
+/*N*/
+/*N*/ p = aIter.GoRoot(); // wieder ab Root (==Start) anfangen
+/*N*/ do {
+/*N*/ p->pRegisteredIn = 0;
+/*N*/ } while( 0 != ( p = aIter-- ) );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // verschicke die Nachricht an die abgeleiteten Objekte.
+/*N*/ SwPtrMsgPoolItem aDyObject( RES_OBJECTDYING, this );
+/*N*/ Modify( &aDyObject, &aDyObject );
+/*N*/
+/*N*/ // Zwangsummeldung aller derjenigen, die sich nicht ausgetragen
+/*N*/ // haben, durch Aufruf von SwClient::Modify()
+/*N*/ while( pRoot )
+/*N*/ pRoot->SwClient::Modify(&aDyObject, &aDyObject);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|* SwModify::Modify( SwHint * pOldValue, SwHint * pNewValue )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung MA 20. Mar. 95
+*************************************************************************/
+
+
+
+/*N*/ void SwModify::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+/*N*/ {
+/*N*/ if (IsInCache() || IsInSwFntCache())
+/*N*/ {
+/*N*/ const USHORT nWhich = pOldValue ? pOldValue->Which() :
+/*N*/ pNewValue ? pNewValue->Which() : 0;
+/*N*/ CheckCaching( nWhich );
+/*N*/ }
+/*N*/
+/*N*/ if (!pRoot || IsModifyLocked())
+/*N*/ return;
+/*N*/
+/*N*/ LockModify();
+/*N*/
+/*N*/ #ifndef DBG_UTIL
+/*N*/ bInModify = TRUE;
+/*N*/ #else
+/*N*/ if( !pOldValue )
+/*N*/ bInModify = TRUE;
+/*N*/ else
+/*N*/ // following Modifies don't calls an ASSRT
+/*N*/ switch( pOldValue->Which() )
+/*N*/ {
+/*N*/ case RES_OBJECTDYING:
+/*N*/ case RES_REMOVE_UNO_OBJECT:
+/*N*/ bInModify = ((SwPtrMsgPoolItem *)pOldValue)->pObject != this;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FOOTNOTE_DELETED:
+/*N*/ case RES_REFMARK_DELETED:
+/*N*/ case RES_TOXMARK_DELETED:
+/*N*/ case RES_FIELD_DELETED:
+/*N*/ bInModify = FALSE;
+/*N*/ break;
+/*N*/ default:
+/*N*/ bInModify = TRUE;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ SwClientIter aIter( *this );
+/*N*/ SwClient * pLast = aIter.GoStart();
+/*N*/ if( pLast ) // konnte zum Anfang gesprungen werden ??
+/*N*/ do {
+/*N*/ pLast->Modify( pOldValue, pNewValue );
+/*N*/ if( !pRoot ) // Baum schon Weg ??
+/*N*/ break;
+/*N*/ } while( 0 != ( pLast = aIter++ ));
+/*N*/
+/*N*/ bInModify = FALSE;
+/*N*/ UnlockModify();
+/*N*/ }
+
+// erfrage vom Modify Informationen
+
+/*N*/ BOOL SwModify::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ BOOL bRet = TRUE; // bedeutet weiter zum naechsten
+/*N*/
+/*N*/ if( pRoot )
+/*N*/ {
+/*N*/ SwClientIter aIter( *(SwModify*)this );
+/*N*/
+/*N*/ SwClient* pLast = aIter.GoStart();
+/*N*/ if( pLast )
+/*N*/ while( 0 != ( bRet = pLast->GetInfo( rInfo )) &&
+/*N*/ 0 != ( pLast = aIter++ ) )
+/*N*/ ;
+/*N*/ }
+/*N*/
+/*N*/ return bRet; // und weiter
+/*N*/ }
+
+/*************************************************************************
+|* SwModify::Add( SwClient *pDepend )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 14.09.94
+*************************************************************************/
+
+
+
+/*N*/ void SwModify::Add(SwClient *pDepend)
+/*N*/ {
+/*N*/ ASSERT( !bInModify, "Client innerhalb des eigenen Modifies einfuegen?" );
+/*N*/
+/*N*/ // nur wenn das hier noch nicht eingetragen ist einfuegen
+/*N*/ if(pDepend->pRegisteredIn != this )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ SwClientIter* pTmp = pClientIters;
+/*N*/ while( pTmp )
+/*N*/ {
+/*N*/ ASSERT( &pTmp->rRoot != pRoot,
+/*N*/ "Client beim angemeldeten ClientIter einfuegen?" );
+/*N*/ pTmp = pTmp->pNxtIter;
+/*N*/ }
+/*N*/ #endif
+/*N*/ // wenn schon wanders angemeldet, dann dort abmelden
+/*N*/ if( pDepend->pRegisteredIn != 0 )
+/*N*/ pDepend->pRegisteredIn->Remove( pDepend );
+/*N*/
+/*N*/ if( !pRoot )
+/*N*/ {
+/*N*/ pRoot = pDepend;
+/*N*/ pRoot->pLeft = 0;
+/*N*/ pRoot->pRight = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // immer hinter die Root haengen
+/*N*/ pDepend->pRight = pRoot->pRight;
+/*N*/ pRoot->pRight = pDepend;
+/*N*/ pDepend->pLeft = pRoot;
+/*N*/ if( pDepend->pRight )
+/*N*/ pDepend->pRight->pLeft = pDepend;
+/*N*/ }
+/*N*/
+/*N*/ pDepend->pRegisteredIn = this;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|* SwModify::_Remove( SwClient *pDepend )
+|*
+|* Beschreibung Dokument 1.7
+|* Ersterstellung JP 20.11.90
+|* Letzte Aenderung JP 14.09.94
+*************************************************************************/
+
+
+
+/*N*/ SwClient *SwModify::_Remove(SwClient * pDepend)
+/*N*/ {
+/*N*/ ASSERT( !bInModify, "Client innerhalb des eigenen Modifies loeschen?" );
+/*N*/
+/*N*/ // loesche das Object aus der Liste und setze den
+/*N*/ // Registrierungs-Pointer zurueck
+/*N*/ if( pDepend->pRegisteredIn == this )
+/*N*/ {
+/*N*/ register SwClient* pR = pDepend->pRight;
+/*N*/ register SwClient* pL = pDepend->pLeft;
+/*N*/ if( pRoot == pDepend )
+/*N*/ pRoot = pL ? pL : pR;
+/*N*/
+/*N*/ if( pL )
+/*N*/ pL->pRight = pR;
+/*N*/ if( pR )
+/*N*/ pR->pLeft = pL;
+/*N*/
+/*N*/ // alle Client-Iters updaten
+/*N*/ SwClientIter* pTmp = pClientIters;
+/*N*/ while( pTmp )
+/*N*/ {
+/*N*/ if( pTmp->pAkt == pDepend || pTmp->pDelNext == pDepend )
+/*N*/ pTmp->pDelNext = pR;
+/*N*/ pTmp = pTmp->pNxtIter;
+/*N*/ }
+/*N*/
+/*N*/ pDepend->pLeft = 0;
+/*N*/ pDepend->pRight = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ ASSERT( FALSE, "SwModify::Remove(): pDepend nicht gefunden");
+/*N*/ pDepend->pRegisteredIn = 0;
+/*N*/ return pDepend;
+/*N*/ }
+
+
+/*************************************************************************
+|* SwModify::CheckCaching( const USHORT nWhich )
+|*
+|* Ersterstellung JP 25.06.95
+|* Letzte Aenderung JP 25.06.95
+*************************************************************************/
+
+
+
+/*N*/ void SwModify::CheckCaching( const USHORT nWhich )
+/*N*/ {
+/*N*/ if( RES_CHRATR_BEGIN <= nWhich && RES_CHRATR_END > nWhich )
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/ else
+/*N*/ switch ( nWhich )
+/*N*/ {
+/*N*/ case RES_OBJECTDYING:
+/*N*/ case RES_FMT_CHG:
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/
+/*N*/ case RES_UL_SPACE:
+/*N*/ case RES_LR_SPACE:
+/*N*/ case RES_BOX:
+/*N*/ case RES_SHADOW:
+/*N*/ case RES_FRM_SIZE:
+/*N*/ case RES_KEEP:
+/*N*/ case RES_BREAK:
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+
+
+// ----------
+// SwDepend
+// ----------
+
+/*************************************************************************
+|* SwDepend::SwDepend(SwClient *pTellHim,SwModify *pDepend)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+*************************************************************************/
+
+
+/*N*/ SwDepend::SwDepend(SwClient *pTellHim, SwModify *pDepend)
+/*N*/ : SwClient(pDepend)
+/*N*/ {
+/*N*/ pToTell = pTellHim;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDepend::Modify(SwHint *, SwHint *)
+|*
+|* Beschreibung callback.doc V1.14
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung VB 20.03.91
+|*
+*************************************************************************/
+
+
+/*N*/ void SwDepend::Modify( SfxPoolItem *pOldValue, SfxPoolItem *pNewValue )
+/*N*/ {
+/*N*/ if(pNewValue && pNewValue->Which() == RES_OBJECTDYING)
+/*N*/ SwClient::Modify(pOldValue,pNewValue);
+/*N*/ else if(pToTell)
+/*N*/ pToTell->Modify(pOldValue, pNewValue);
+/*N*/ }
+
+
+ // erfrage vom Modify Informationen
+/*N*/ BOOL SwDepend::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ return pToTell ? pToTell->GetInfo( rInfo ) : TRUE;
+/*N*/ }
+
+/********************************************************************/
+
+
+/*N*/ SwClientIter::SwClientIter( SwModify& rModify )
+/*N*/ : rRoot( rModify )
+/*N*/ {
+/*N*/ // hinten einketten!
+/*N*/ pNxtIter = 0;
+/*N*/ if( pClientIters )
+/*N*/ {
+/*N*/ SwClientIter* pTmp = pClientIters;
+/*N*/ while( pTmp->pNxtIter )
+/*N*/ pTmp = pTmp->pNxtIter;
+/*N*/ pTmp->pNxtIter = this;
+/*N*/ }
+/*N*/ else
+/*N*/ pClientIters = this;
+/*N*/
+/*N*/ pAkt = rRoot.pRoot;
+/*N*/ pDelNext = pAkt;
+/*N*/ }
+
+
+
+/*N*/ SwClientIter::~SwClientIter()
+/*N*/ {
+/*N*/ if( pClientIters )
+/*N*/ {
+/*N*/ if( pClientIters == this )
+/*N*/ pClientIters = pNxtIter;
+/*N*/ else
+/*N*/ {
+/*N*/ SwClientIter* pTmp = pClientIters;
+/*N*/ while( pTmp->pNxtIter != this )
+/*N*/ if( 0 == ( pTmp = pTmp->pNxtIter ) )
+/*N*/ {
+/*N*/ ASSERT( this, "wo ist mein Pointer" );
+/*N*/ return ;
+/*N*/ }
+/*N*/ pTmp->pNxtIter = pNxtIter;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ #ifndef CFRONT
+/*N*/ // Postfix Operator
+/*N*/ SwClient* SwClientIter::operator++(int)
+/*N*/ {
+/*N*/ // solange der CFRONT Prefix und PostFix nicht unterscheiden kann, immer
+/*N*/ // als Prefix-Operator arbeiten. Wenn der CFRONT es kann, muss auch der
+/*N*/ // Code entsprechen umgestellt werden !!!
+/*N*/ if( pDelNext == pAkt )
+/*N*/ {
+/*N*/ pAkt = pAkt->pRight;
+/*N*/ pDelNext = pAkt;
+/*N*/ }
+/*N*/ else
+/*N*/ pAkt = pDelNext;
+/*N*/ return pAkt;
+/*N*/ }
+/*N*/ #endif
+
+
+ // Prefix Operator
+/*N*/ SwClient* SwClientIter::operator++()
+/*N*/ {
+/*N*/ if( pDelNext == pAkt )
+/*N*/ {
+/*N*/ pAkt = pAkt->pRight;
+/*N*/ pDelNext = pAkt;
+/*N*/ }
+/*N*/ else
+/*?*/ pAkt = pDelNext;
+/*N*/ return pAkt;
+/*N*/ }
+
+
+/*N*/ #ifndef CFRONT
+ // Postfix Operator
+/*N*/ SwClient* SwClientIter::operator--(int)
+/*N*/ {
+// 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 !!!
+/*N*/ if( pDelNext == pAkt )
+/*?*/ pAkt = pAkt->pLeft;
+/*N*/ else
+/*N*/ pAkt = pDelNext->pLeft;
+/*N*/ pDelNext = pAkt;
+/*N*/ return pAkt;
+/*N*/ }
+/*N*/ #endif
+
+
+ // Prefix Operator
+/*N*/ SwClient* SwClientIter::operator--()
+/*N*/ {
+/*N*/ if( pDelNext == pAkt )
+/*N*/ pAkt = pAkt->pLeft;
+/*N*/ else
+/*N*/ pAkt = pDelNext->pLeft;
+/*N*/ pDelNext = pAkt;
+/*N*/ return pAkt;
+/*N*/ }
+
+
+/*N*/ SwClient* SwClientIter::GoStart() // zum Anfang des Baums
+/*N*/ {
+/*N*/ pAkt = rRoot.pRoot;
+/*N*/ if( pAkt )
+/*N*/ while( pAkt->pLeft )
+/*N*/ pAkt = pAkt->pLeft;
+/*N*/ pDelNext = pAkt;
+/*N*/ return pAkt;
+/*N*/ }
+
+
+/*N*/ SwClient* SwClientIter::GoEnd() // zum End des Baums
+/*N*/ {
+/*N*/ pAkt = pDelNext;
+/*N*/ if( !pAkt )
+/*N*/ pAkt = rRoot.pRoot;
+/*N*/ if( pAkt )
+/*N*/ while( pAkt->pRight )
+/*N*/ pAkt = pAkt->pRight;
+/*N*/ pDelNext = pAkt;
+/*N*/ return pAkt;
+/*N*/ }
+
+
+
+/*N*/ SwClient* SwClientIter::First( TypeId nType )
+/*N*/ {
+/*N*/ aSrchId = nType;
+/*N*/ GoStart();
+/*N*/ if( pAkt )
+/*N*/ do {
+/*N*/ if( pAkt->IsA( aSrchId ) )
+/*N*/ break;
+/*N*/
+/*N*/ if( pDelNext == pAkt )
+/*N*/ {
+/*N*/ pAkt = pAkt->pRight;
+/*N*/ pDelNext = pAkt;
+/*N*/ }
+/*N*/ else
+/*N*/ pAkt = pDelNext;
+/*N*/
+/*N*/ } while( pAkt );
+/*N*/ return pAkt;
+/*N*/ }
+
+
+/*N*/ SwClient* SwClientIter::Next()
+/*N*/ {
+/*N*/ do {
+/*N*/ // erstmal zum naechsten
+/*N*/ if( pDelNext == pAkt )
+/*N*/ {
+/*N*/ pAkt = pAkt->pRight;
+/*N*/ pDelNext = pAkt;
+/*N*/ }
+/*N*/ else
+/*N*/ pAkt = pDelNext;
+/*N*/
+/*N*/ if( pAkt && pAkt->IsA( aSrchId ) )
+/*N*/ break;
+/*N*/ } while( pAkt );
+/*N*/ return pAkt;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/attr/sw_cellatr.cxx b/binfilter/bf_sw/source/core/attr/sw_cellatr.cxx
new file mode 100644
index 000000000000..4ddff805549c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/attr/sw_cellatr.cxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <float.h>
+
+#include <cellatr.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <swtable.hxx>
+
+#include <errhdl.hxx>
+
+#include <node.hxx>
+#include <hints.hxx>
+namespace binfilter {
+
+
+
+//TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+/*N*/ SwTblBoxNumFormat::SwTblBoxNumFormat( UINT32 nFormat, BOOL bFlag )
+/*N*/ : SfxUInt32Item( RES_BOXATR_FORMAT, nFormat ), bAuto( bFlag )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ int SwTblBoxNumFormat::operator==( const SfxPoolItem& rAttr ) const
+/*N*/ {
+/*N*/ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+/*N*/ return GetValue() == ((SwTblBoxNumFormat&)rAttr).GetValue() &&
+/*N*/ bAuto == ((SwTblBoxNumFormat&)rAttr).bAuto;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwTblBoxNumFormat::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwTblBoxNumFormat( GetValue(), bAuto );
+/*N*/ }
+
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+
+/*N*/ SwTblBoxFormula::SwTblBoxFormula( const String& rFormula )
+/*N*/ : SfxPoolItem( RES_BOXATR_FORMULA ),
+/*N*/ SwTableFormula( rFormula ),
+/*N*/ pDefinedIn( 0 )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ int SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const
+/*N*/ {
+/*?*/ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ /*?*/ return GetFormula() == ((SwTblBoxFormula&)rAttr).GetFormula() &&
+ /*?*/ pDefinedIn == ((SwTblBoxFormula&)rAttr).pDefinedIn;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwTblBoxFormula::Clone( SfxItemPool* ) const
+/*N*/ {
+/*?*/ // auf externe Darstellung umschalten!!
+ SwTblBoxFormula* pNew = new SwTblBoxFormula( GetFormula() );
+ pNew->SwTableFormula::operator=( *this );
+ return pNew;
+/*N*/ }
+
+
+
+ // suche den Node, in dem die Formel steht:
+ // TextFeld -> TextNode,
+ // BoxAttribut -> BoxStartNode
+ // !!! MUSS VON JEDER ABLEITUNG UEBERLADEN WERDEN !!!
+/*N*/ const SwNode* SwTblBoxFormula::GetNodeOfFormula() const
+/*N*/ {
+/*?*/ const SwNode* pRet = 0;
+ if( pDefinedIn )
+ {
+ SwClient* pBox = SwClientIter( *pDefinedIn ).First( TYPE( SwTableBox ));
+ if( pBox )
+ pRet = ((SwTableBox*)pBox)->GetSttNd();
+ }
+ return pRet;
+/*N*/ }
+
+
+SwTableBox* SwTblBoxFormula::GetTableBox()
+{
+ SwTableBox* pBox = 0;
+ if( pDefinedIn )
+ pBox = (SwTableBox*)SwClientIter( *pDefinedIn ).
+ First( TYPE( SwTableBox ));
+ return pBox;
+}
+
+/*************************************************************************
+|*
+*************************************************************************/
+
+
+/*N*/ SwTblBoxValue::SwTblBoxValue()
+/*N*/ : SfxPoolItem( RES_BOXATR_VALUE ), nValue( 0 )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwTblBoxValue::SwTblBoxValue( const double nVal )
+/*N*/ : SfxPoolItem( RES_BOXATR_VALUE ), nValue( nVal )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ int SwTblBoxValue::operator==( const SfxPoolItem& rAttr ) const
+/*N*/ {
+/*N*/ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+/*N*/ return nValue == ((SwTblBoxValue&)rAttr).nValue;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwTblBoxValue::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwTblBoxValue( nValue );
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/attr/sw_format.cxx b/binfilter/bf_sw/source/core/attr/sw_format.cxx
new file mode 100644
index 000000000000..fdc874a08574
--- /dev/null
+++ b/binfilter/bf_sw/source/core/attr/sw_format.cxx
@@ -0,0 +1,631 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <frame.hxx> // fuer AttrCache
+
+#include <hints.hxx> // fuer SwFmtChg
+#include <paratr.hxx> // fuer SwParaFmt - SwHyphenBug
+#include <swcache.hxx>
+namespace binfilter {
+
+
+/*N*/ TYPEINIT1( SwFmt, SwClient ); //rtti fuer SwFmt
+
+/*************************************************************************
+|* SwFmt::SwFmt
+*************************************************************************/
+
+
+/*N*/ SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
+/*N*/ const USHORT* pWhichRanges, SwFmt *pDrvdFrm, USHORT nFmtWhich )
+/*N*/ : SwModify( pDrvdFrm ),
+/*N*/ aSet( rPool, pWhichRanges ),
+/*N*/ nPoolFmtId( USHRT_MAX ),
+/*N*/ nPoolHelpId( USHRT_MAX ),
+/*N*/ nPoolHlpFileId( UCHAR_MAX ),
+/*N*/ nFmtId( 0 ),
+/*N*/ nWhichId( nFmtWhich )
+/*N*/ {
+/*N*/ aFmtName.AssignAscii( pFmtNm );
+/*N*/ bWritten = bFmtInDTOR = bAutoUpdateFmt = bLayerFmt = FALSE; // LAYER_IMPL
+/*N*/ bAutoFmt = TRUE;
+/*N*/
+/*N*/ if( pDrvdFrm )
+/*N*/ aSet.SetParent( &pDrvdFrm->aSet );
+/*N*/ }
+
+
+/*N*/ SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
+/*N*/ const USHORT* pWhichRanges, SwFmt *pDrvdFrm, USHORT nFmtWhich )
+/*N*/ : SwModify( pDrvdFrm ),
+/*N*/ aFmtName( rFmtNm ),
+/*N*/ aSet( rPool, pWhichRanges ),
+/*N*/ nPoolFmtId( USHRT_MAX ),
+/*N*/ nPoolHelpId( USHRT_MAX ),
+/*N*/ nPoolHlpFileId( UCHAR_MAX ),
+/*N*/ nFmtId( 0 ),
+/*N*/ nWhichId( nFmtWhich )
+/*N*/ {
+/*N*/ bWritten = bFmtInDTOR = bAutoUpdateFmt = bLayerFmt = FALSE; // LAYER_IMPL
+/*N*/ bAutoFmt = TRUE;
+/*N*/
+/*N*/ if( pDrvdFrm )
+/*N*/ aSet.SetParent( &pDrvdFrm->aSet );
+/*N*/ }
+
+
+/*?*/ 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 );
+/*?*/ }
+
+
+/*N*/ SwFmt::SwFmt( const SwFmt& rFmt )
+/*N*/ : SwModify( rFmt.DerivedFrom() ),
+/*N*/ aFmtName( rFmt.aFmtName ),
+/*N*/ aSet( rFmt.aSet ),
+/*N*/ nPoolFmtId( rFmt.GetPoolFmtId() ),
+/*N*/ nPoolHelpId( rFmt.GetPoolHelpId() ),
+/*N*/ nPoolHlpFileId( rFmt.GetPoolHlpFileId() ),
+/*N*/ nFmtId( 0 ),
+/*N*/ nWhichId( rFmt.nWhichId )
+/*N*/ {
+/*N*/ bWritten = bFmtInDTOR = bLayerFmt = FALSE; // LAYER_IMPL
+/*N*/ bAutoFmt = rFmt.bAutoFmt;
+/*N*/ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+/*N*/
+/*N*/ if( rFmt.DerivedFrom() )
+/*N*/ aSet.SetParent( &rFmt.DerivedFrom()->aSet );
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ aSet.SetModifyAtAttr( this );
+/*N*/ }
+
+/*************************************************************************
+|* SwFmt &SwFmt::operator=(const SwFmt& aFmt)
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+/*N*/ SwFmt &SwFmt::operator=(const SwFmt& rFmt)
+/*N*/ {
+/*N*/ nWhichId = rFmt.nWhichId;
+/*N*/ nPoolFmtId = rFmt.GetPoolFmtId();
+/*N*/ nPoolHelpId = rFmt.GetPoolHelpId();
+/*N*/ nPoolHlpFileId = rFmt.GetPoolHlpFileId();
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*?*/ SwFrm::GetCache().Delete( this );
+/*?*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/
+/*N*/ // kopiere nur das Attribut-Delta Array
+/*N*/ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+/*N*/ aNew( *aSet.GetPool(), aSet.GetRanges() );
+/*N*/ aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
+/*N*/ aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
+/*N*/
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ aSet.SetModifyAtAttr( this );
+/*N*/
+/*N*/ // PoolItem-Attr erzeugen fuers Modify !!!
+/*N*/ if( aOld.Count() )
+/*N*/ {
+/*N*/ SwAttrSetChg aChgOld( aSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( aSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/
+/*N*/ if( pRegisteredIn != rFmt.pRegisteredIn )
+/*N*/ {
+/*?*/ if( pRegisteredIn )
+/*?*/ pRegisteredIn->Remove(this);
+/*?*/ if(rFmt.pRegisteredIn)
+/*?*/ {
+/*?*/ rFmt.pRegisteredIn->Add(this);
+/*?*/ aSet.SetParent( &rFmt.aSet );
+/*?*/ }
+/*?*/ else
+/*?*/ aSet.SetParent( 0 );
+/*N*/ }
+/*N*/ bAutoFmt = rFmt.bAutoFmt;
+/*N*/ bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
+/*N*/ return *this;
+/*N*/ }
+
+/*N*/ void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
+/*N*/ {
+/*N*/ ASSERT(!IsDefault(), "SetName: Defaultformat" );
+/*N*/ if( bBroadcast )
+/*N*/ {
+/*N*/ SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
+/*N*/ SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
+/*N*/ aFmtName = rNewName;
+/*N*/ Modify( &aOld, &aNew );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFmtName = rNewName;
+/*N*/ }
+/*N*/ }
+
+/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ * 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 !!
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+
+
+/*N*/ void SwFmt::CopyAttrs( const SwFmt& rFmt, BOOL bReplace )
+/*N*/ {
+/*N*/ // kopiere nur das Attribut-Delta Array
+/*N*/ register SwCharFmt* pDropCharFmt = 0;
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*?*/ SwFrm::GetCache().Delete( this );
+/*?*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/
+/*N*/ // Sonderbehandlung fuer einige Attribute
+/*N*/ SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
+/*N*/
+/*N*/ if( !bReplace ) // nur die neu, die nicht gesetzt sind ??
+/*N*/ {
+/*?*/ if( pChgSet == (SwAttrSet*)&rFmt.aSet ) // Set hier kopieren
+/*?*/ pChgSet = new SwAttrSet( rFmt.aSet );
+/*?*/ pChgSet->Differentiate( aSet );
+/*N*/ }
+/*N*/
+/*N*/ // kopiere nur das Attribut-Delta Array
+/*N*/ if( pChgSet->GetPool() != aSet.GetPool() )
+/*N*/ pChgSet->CopyToModify( *this );
+/*N*/ else
+/*N*/ {
+/*N*/ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+/*N*/ aNew( *aSet.GetPool(), aSet.GetRanges() );
+/*N*/
+/*N*/ if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
+/*N*/ {
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ aSet.SetModifyAtAttr( this );
+/*N*/
+/*N*/ SwAttrSetChg aChgOld( aSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( aSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // Set hier angelegt ?
+/*?*/ delete pChgSet;
+/*N*/ }
+
+/*************************************************************************
+|* SwFmt::~SwFmt()
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 14.02.91
+*************************************************************************/
+
+
+/*N*/ SwFmt::~SwFmt()
+/*N*/ {
+/*N*/ /* das passiert bei der ObjectDying Message */
+/*N*/ /* alle Abhaengigen auf DerivedFrom umhaengen */
+/*N*/ if( GetDepends() )
+/*N*/ {
+/*N*/ ASSERT(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" );
+/*N*/
+/*N*/ bFmtInDTOR = TRUE;
+/*N*/
+/*N*/ SwFmt *pParentFmt = DerivedFrom();
+/*N*/ while( GetDepends() )
+/*N*/ {
+/*N*/ SwFmtChg aOldFmt(this);
+/*N*/ SwFmtChg aNewFmt(pParentFmt);
+/*N*/ SwClient * pDepend = (SwClient*)GetDepends();
+/*N*/ pParentFmt->Add(pDepend);
+/*N*/ pDepend->Modify(&aOldFmt, &aNewFmt);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*************************************************************************
+|* void SwFmt::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+|*
+|* Beschreibung Dokument 1.14
+|* Ersterstellung JP 22.11.90
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+
+/*N*/ void SwFmt::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+/*N*/ {
+/*N*/ BOOL bWeiter = TRUE; // TRUE = Propagierung an die Abhaengigen
+/*N*/
+/*N*/ USHORT nWhich = pOldValue ? pOldValue->Which() :
+/*N*/ pNewValue ? pNewValue->Which() : 0 ;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*?*/ 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;
+/*?*/
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
+/*N*/ {
+/*N*/ //nur die weiter geben, die hier nicht gesetzt sind !!
+/*N*/ SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
+/*N*/ SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
+/*N*/
+/*N*/ aOld.GetChgSet()->Differentiate( aSet );
+/*N*/ aNew.GetChgSet()->Differentiate( aSet );
+/*N*/
+/*N*/ if( aNew.Count() )
+/*N*/ // keine mehr gesetzt, dann Ende !!
+/*N*/ SwModify::Modify( &aOld, &aNew );
+/*N*/ bWeiter = FALSE;
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_FMT_CHG:
+/*N*/ // falls mein Format Parent umgesetzt wird, dann melde ich
+/*N*/ // meinen Attrset beim Neuen an.
+/*N*/
+/*N*/ // sein eigenes Modify ueberspringen !!
+/*N*/ if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
+/*N*/ ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
+/*N*/ {
+/*N*/ // den Set an den neuen Parent haengen
+/*N*/ aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_RESET_FMTWRITTEN:
+/*N*/ {
+/*N*/ // IsWritten-Flag zuruecksetzen. Hint nur an abhanegige
+/*N*/ // Formate (und keine Frames) propagieren.
+/*N*/ ResetWritten();
+/*N*/ SwClientIter aIter( *this );
+/*N*/ for( SwClient *pClient = aIter.First( TYPE(SwFmt) ); pClient;
+/*N*/ pClient = aIter.Next() )
+/*N*/ pClient->Modify( pOldValue, pNewValue );
+/*N*/
+/*N*/ bWeiter = FALSE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ {
+/*N*/ // Ist das Attribut in diesem Format definiert, dann auf
+/*N*/ // NICHT weiter propagieren !!
+/*N*/ if( SFX_ITEM_SET == aSet.GetItemState( nWhich, FALSE ))
+/*N*/ {
+// 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
+/*N*/ ASSERT( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" );
+/*N*/ bWeiter = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ } // default
+/*N*/ } // switch
+/*N*/
+/*N*/ if( bWeiter )
+/*N*/ {
+/*N*/ // laufe durch alle abhaengigen Formate
+/*N*/ SwModify::Modify( pOldValue, pNewValue );
+/*N*/ }
+/*N*/
+/*N*/ }
+
+
+/*N*/ BOOL SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
+/*N*/ {
+/*N*/ if ( pDerFrom )
+/*N*/ {
+/*N*/ // Zyklus?
+/*N*/ const SwFmt* pFmt = pDerFrom;
+/*N*/ while ( pFmt != 0 )
+/*N*/ {
+/*N*/ if ( pFmt == this )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ pFmt=pFmt->DerivedFrom();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ // Nichts angegeben, Dflt-Format suchen
+/*?*/ pDerFrom = this;
+/*?*/ while ( pDerFrom->DerivedFrom() )
+/*?*/ pDerFrom = pDerFrom->DerivedFrom();
+/*N*/ }
+/*N*/ if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ ASSERT( Which()==pDerFrom->Which()
+/*N*/ || ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
+/*N*/ || ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
+/*N*/ || ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
+/*N*/ "SetDerivedFrom: Aepfel von Birnen ableiten?");
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/
+/*N*/ pDerFrom->Add(this);
+/*N*/ aSet.SetParent( &pDerFrom->aSet );
+/*N*/
+/*N*/ SwFmtChg aOldFmt(this);
+/*N*/ SwFmtChg aNewFmt(this);
+/*N*/ Modify( &aOldFmt, &aNewFmt );
+/*N*/
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ BOOL SwFmt::SetAttr(const SfxPoolItem& rAttr )
+/*N*/ {
+/*N*/ if ( IsInCache() || IsInSwFntCache() )
+/*N*/ {
+/*N*/ const USHORT nWhich = rAttr.Which();
+/*N*/ CheckCaching( nWhich );
+/*N*/ }
+/*N*/
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+/*N*/ // fuer FrmFmt's immer das Modify verschicken!
+/*N*/ BOOL bRet = FALSE;
+/*N*/ USHORT nFmtWhich;
+/*N*/ if( IsModifyLocked() || (!GetDepends() &&
+/*N*/ (RES_GRFFMTCOLL == (nFmtWhich = Which()) ||
+/*N*/ RES_TXTFMTCOLL == nFmtWhich ) ) )
+/*N*/ {
+/*N*/ if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
+/*N*/ aSet.SetModifyAtAttr( this );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // kopiere nur das Attribut-Delta Array
+/*N*/ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+/*N*/ aNew( *aSet.GetPool(), aSet.GetRanges() );
+/*N*/
+/*N*/ if( 0 != (bRet = aSet.Put_BC( rAttr, &aOld, &aNew )))
+/*N*/ {
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ aSet.SetModifyAtAttr( this );
+/*N*/
+/*N*/ SwAttrSetChg aChgOld( aSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( aSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ BOOL SwFmt::SetAttr( const SfxItemSet& rSet )
+/*N*/ {
+/*N*/ if( !rSet.Count() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt;
+/*N*/ // fuer FrmFmt's immer das Modify verschicken!
+/*N*/ BOOL bRet = FALSE;
+/*N*/ USHORT nFmtWhich;
+/*N*/ if( IsModifyLocked() || (!GetDepends() &&
+/*N*/ (RES_GRFFMTCOLL == (nFmtWhich = Which()) ||
+/*N*/ RES_TXTFMTCOLL == nFmtWhich ) ) )
+/*N*/ {
+/*N*/ if( 0 != ( bRet = (0 != aSet.Put( rSet ))) )
+/*N*/ aSet.SetModifyAtAttr( this );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+/*N*/ aNew( *aSet.GetPool(), aSet.GetRanges() );
+/*N*/ if( 0 != ( bRet = aSet.Put_BC( rSet, &aOld, &aNew ) ) )
+/*N*/ {
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ aSet.SetModifyAtAttr( this );
+/*N*/ SwAttrSetChg aChgOld( aSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( aSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+// Nimmt den Hint mit nWhich aus dem Delta-Array
+
+
+/*N*/ BOOL SwFmt::ResetAttr( USHORT nWhich1, USHORT nWhich2 )
+/*N*/ {
+/*N*/ if( !aSet.Count() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ if( !nWhich2 || nWhich2 < nWhich1 )
+/*N*/ nWhich2 = nWhich1; // dann setze auf 1. Id, nur dieses Item
+/*N*/
+/*N*/ if ( IsInCache() || IsInSwFntCache() )
+/*N*/ {
+/*N*/ for( USHORT n = nWhich1; n < nWhich2; ++n )
+/*?*/ CheckCaching( n );
+/*N*/ }
+/*N*/
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt
+/*N*/ if( IsModifyLocked() )
+/*N*/ return 0 != (( nWhich2 == nWhich1 )
+/*N*/ ? aSet.ClearItem( nWhich1 )
+/*N*/ : aSet.ClearItem_BC( nWhich1, nWhich2 ));
+/*N*/
+/*N*/ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+/*N*/ aNew( *aSet.GetPool(), aSet.GetRanges() );
+/*N*/ BOOL bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
+/*N*/
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ SwAttrSetChg aChgOld( aSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( aSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+/*N*/ USHORT SwFmt::ResetAllAttr()
+/*N*/ {
+/*N*/ if( !aSet.Count() )
+/*N*/ return 0;
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt
+/*N*/ if( IsModifyLocked() )
+/*?*/ return aSet.ClearItem( 0 );
+/*N*/
+/*N*/ SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
+/*N*/ aNew( *aSet.GetPool(), aSet.GetRanges() );
+/*N*/ BOOL bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
+/*N*/
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ SwAttrSetChg aChgOld( aSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( aSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/ return aNew.Count();
+/*N*/ }
+
+
+/*************************************************************************
+|* void SwFmt::GetInfo( const SfxPoolItem& ) const
+|*
+|* Beschreibung
+|* Ersterstellung JP 18.04.94
+|* Letzte Aenderung JP 05.08.94
+*************************************************************************/
+
+/*N*/
+/*N*/ BOOL SwFmt::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ BOOL bRet = SwModify::GetInfo( rInfo );
+/*N*/ return bRet;
+/*N*/ }
+
+
+/** SwFmt::IsBackgroundTransparent - for feature #99657#
+
+ OD 22.08.2002
+ Virtual method to determine, if background of format is transparent.
+ Default implementation returns false. Thus, subclasses have to overload
+ method, if the specific subclass can have a transparent background.
+
+ @author OD
+
+ @return false, default implementation
+*/
+/*M*/ sal_Bool SwFmt::IsBackgroundTransparent() const
+/*M*/ {
+/*M*/ return sal_False;
+/*M*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/attr/sw_hints.cxx b/binfilter/bf_sw/source/core/attr/sw_hints.cxx
new file mode 100644
index 000000000000..292b5848eca3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/attr/sw_hints.cxx
@@ -0,0 +1,301 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <bf_svx/scripttypeitem.hxx>
+
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx>
+#include <errhdl.hxx>
+#include <hints.hxx>
+#include <error.h>
+namespace binfilter {
+
+
+
+/*N*/ SwFmtChg::SwFmtChg( SwFmt *pFmt )
+/*N*/ : SwMsgPoolItem( RES_FMT_CHG ),
+/*N*/ pChangedFmt( pFmt )
+/*N*/ {}
+
+
+/*N*/ SwInsChr::SwInsChr( xub_StrLen nP )
+/*N*/ : SwMsgPoolItem( RES_INS_CHR ),
+/*N*/ nPos( nP )
+/*N*/ {}
+
+
+
+/*N*/ SwInsTxt::SwInsTxt( xub_StrLen nP, xub_StrLen nL )
+/*N*/ : SwMsgPoolItem( RES_INS_TXT ),
+/*N*/ nPos( nP ),
+/*N*/ nLen( nL )
+/*N*/ {}
+
+
+
+/*N*/ SwDelChr::SwDelChr( xub_StrLen nP )
+/*N*/ : SwMsgPoolItem( RES_DEL_CHR ),
+/*N*/ nPos( nP )
+/*N*/ {}
+
+
+
+/*N*/ SwDelTxt::SwDelTxt( xub_StrLen nS, xub_StrLen nL )
+/*N*/ : SwMsgPoolItem( RES_DEL_TXT ),
+/*N*/ nStart( nS ),
+/*N*/ nLen( nL )
+/*N*/ {}
+
+
+
+/*N*/ SwUpdateAttr::SwUpdateAttr( xub_StrLen nS, xub_StrLen nE, USHORT nW )
+/*N*/ : SwMsgPoolItem( RES_UPDATE_ATTR ),
+/*N*/ nStart( nS ),
+/*N*/ nEnd( nE ),
+/*N*/ nWhichAttr( nW )
+/*N*/ {}
+
+
+// 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.
+
+
+
+
+/*N*/ SwDocPosUpdate::SwDocPosUpdate( const SwTwips nDocPos )
+/*N*/ : SwMsgPoolItem( RES_DOCPOS_UPDATE ),
+/*N*/ nDocPos(nDocPos)
+/*N*/ {}
+
+
+
+// SwTableFmlUpdate wird verschickt, wenn sich die Tabelle neu berechnen soll
+/*N*/ SwTableFmlUpdate::SwTableFmlUpdate( const SwTable* pNewTbl )
+/*N*/ : SwMsgPoolItem( RES_TABLEFML_UPDATE ),
+/*N*/ pTbl( pNewTbl ), pHistory( 0 ), eFlags( TBL_CALC ),
+/*N*/ nSplitLine( USHRT_MAX )
+/*N*/ {
+/*N*/ DATA.pDelTbl = 0;
+/*N*/ bModified = bBehindSplitLine = FALSE;
+/*N*/ ASSERT( pTbl, "es muss ein Table-Pointer gesetzt werden!" );
+/*N*/ }
+
+
+/*N*/ SwAutoFmtGetDocNode::SwAutoFmtGetDocNode( const SwNodes* pNds )
+/*N*/ : SwMsgPoolItem( RES_AUTOFMT_DOCNODE ),
+/*N*/ pCntntNode( 0 ), pNodes( pNds )
+/*N*/ {}
+
+
+/*N*/ SwAttrSetChg::SwAttrSetChg( const SwAttrSet& rTheSet, SwAttrSet& rSet )
+/*N*/ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+/*N*/ pTheChgdSet( &rTheSet ),
+/*N*/ pChgSet( &rSet ),
+/*N*/ bDelSet( FALSE )
+/*N*/ {}
+
+
+/*N*/ SwAttrSetChg::SwAttrSetChg( const SwAttrSetChg& rChgSet )
+/*N*/ : SwMsgPoolItem( RES_ATTRSET_CHG ),
+/*N*/ pTheChgdSet( rChgSet.pTheChgdSet ),
+/*N*/ bDelSet( TRUE )
+/*N*/ {
+/*N*/ pChgSet = new SwAttrSet( *rChgSet.pChgSet );
+/*N*/ }
+
+
+/*N*/ SwAttrSetChg::~SwAttrSetChg()
+/*N*/ {
+/*N*/ if( bDelSet )
+/*N*/ delete pChgSet;
+/*N*/ }
+
+
+#ifdef DBG_UTIL
+
+/*N*/ void SwAttrSetChg::ClearItem( USHORT nWhich )
+/*N*/ {
+/*N*/ ASSERT( bDelSet, "der Set darf nicht veraendert werden!" );
+/*N*/ pChgSet->ClearItem( nWhich );
+/*N*/ }
+
+#endif
+
+
+/*N*/ SwMsgPoolItem::SwMsgPoolItem( USHORT nWhich )
+/*N*/ : SfxPoolItem( nWhich )
+/*N*/ {}
+
+
+// "Overhead" vom SfxPoolItem
+/*N*/ int SwMsgPoolItem::operator==( const SfxPoolItem& ) const
+/*N*/ {
+/*N*/ ASSERT( FALSE, "SwMsgPoolItem kennt kein ==" );
+/*N*/ return 0;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwMsgPoolItem::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ ASSERT( FALSE, "SwMsgPoolItem kennt kein Clone" );
+/*N*/ return 0;
+/*N*/ }
+
+/******************************************************************************
+ * 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.
+ ******************************************************************************/
+#ifdef DBG_UTIL
+
+
+/*N*/ const SfxPoolItem* GetDfltAttr( USHORT nWhich )
+/*N*/ {
+/*N*/ ASSERT_ID( nWhich < POOLATTR_END && nWhich >= POOLATTR_BEGIN,
+/*N*/ ERR_OUTOFSCOPE );
+/*N*/
+/*N*/ SfxPoolItem *pHt = aAttrTab[ nWhich - POOLATTR_BEGIN ];
+/*N*/ ASSERT( pHt, "GetDfltFmtAttr(): Dflt == 0" );
+/*N*/ return pHt;
+/*N*/ }
+
+#endif
+
+
+
+/*N*/ SwCondCollCondChg::SwCondCollCondChg( SwFmt *pFmt )
+/*N*/ : SwMsgPoolItem( RES_CONDCOLL_CONDCHG ), pChangedFmt( pFmt )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwVirtPageNumInfo::SwVirtPageNumInfo( const SwPageFrm *pPg ) :
+/*N*/ SwMsgPoolItem( RES_VIRTPAGENUM_INFO ),
+/*N*/ pPage( 0 ),
+/*N*/ pOrigPage( pPg ),
+/*N*/ pFrm( 0 )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwNumRuleInfo::SwNumRuleInfo( const String& rRuleName )
+/*N*/ : SwMsgPoolItem( RES_GETNUMNODES ), rName( rRuleName )
+/*N*/ {
+/*N*/ }
+
+/*N*/ void SwNumRuleInfo::AddNode( SwTxtNode& rNd )
+/*N*/ {
+/*N*/ aList.Insert( rNd.GetIndex(), &rNd );
+/*N*/ }
+
+
+
+
+
+
+
+/*N*/ USHORT GetWhichOfScript( USHORT nWhich, USHORT nScript )
+/*N*/ {
+/*N*/ static const USHORT aLangMap[3] =
+/*N*/ { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE };
+/*N*/ static const USHORT aFontMap[3] =
+/*N*/ { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT};
+/*N*/ static const USHORT aFontSizeMap[3] =
+/*N*/ { RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE };
+/*N*/ static const USHORT aWeightMap[3] =
+/*N*/ { RES_CHRATR_WEIGHT, RES_CHRATR_CJK_WEIGHT, RES_CHRATR_CTL_WEIGHT};
+/*N*/ static const USHORT aPostureMap[3] =
+/*N*/ { RES_CHRATR_POSTURE, RES_CHRATR_CJK_POSTURE, RES_CHRATR_CTL_POSTURE};
+/*N*/
+/*N*/ const USHORT* pM;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_CHRATR_LANGUAGE:
+/*N*/ case RES_CHRATR_CJK_LANGUAGE:
+/*N*/ case RES_CHRATR_CTL_LANGUAGE:
+/*N*/ pM = aLangMap;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_CHRATR_FONT:
+/*N*/ case RES_CHRATR_CJK_FONT:
+/*N*/ case RES_CHRATR_CTL_FONT:
+/*N*/ pM = aFontMap;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_CHRATR_FONTSIZE:
+/*N*/ case RES_CHRATR_CJK_FONTSIZE:
+/*N*/ case RES_CHRATR_CTL_FONTSIZE:
+/*N*/ pM = aFontSizeMap;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_CHRATR_WEIGHT:
+/*N*/ case RES_CHRATR_CJK_WEIGHT:
+/*N*/ case RES_CHRATR_CTL_WEIGHT:
+/*N*/ pM = aWeightMap;
+/*N*/ break;
+/*N*/ case RES_CHRATR_POSTURE:
+/*N*/ case RES_CHRATR_CJK_POSTURE:
+/*N*/ case RES_CHRATR_CTL_POSTURE:
+/*N*/ pM = aPostureMap;
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ pM = 0;
+/*N*/ }
+/*N*/
+/*N*/ USHORT nRet;
+/*N*/ if( pM )
+/*N*/ {
+/*N*/ using namespace ::com::sun::star::i18n;
+/*N*/ {
+/*N*/ if( ScriptType::WEAK == nScript )
+/*N*/ nScript = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
+/*N*/ switch( nScript)
+/*N*/ {
+/*N*/ case ScriptType::COMPLEX: ++pM; // no break;
+/*N*/ case ScriptType::ASIAN: ++pM; // no break;
+/*N*/ default: nRet = *pM;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nRet = nWhich;
+/*N*/ return nRet;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/attr/sw_swatrset.cxx b/binfilter/bf_sw/source/core/attr/sw_swatrset.cxx
new file mode 100644
index 000000000000..7581321d6a93
--- /dev/null
+++ b/binfilter/bf_sw/source/core/attr/sw_swatrset.cxx
@@ -0,0 +1,292 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/brshitem.hxx>
+#define ITEMID_LINE SID_ATTR_LINE_STYLE
+
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <node.hxx>
+#include <paratr.hxx> // fuer SetModifyAtAttr
+#include <cellatr.hxx> // fuer SetModifyAtAttr
+#include <cmdid.h>
+namespace binfilter {
+
+
+/*N*/ SwAttrPool::SwAttrPool( SwDoc* pD )
+/*N*/ : SfxItemPool( String::CreateFromAscii(
+/*N*/ RTL_CONSTASCII_STRINGPARAM( "SWG" )),
+/*N*/ POOLATTR_BEGIN, POOLATTR_END-1,
+/*N*/ aSlotTab, aAttrTab ),
+/*N*/ pDoc( pD )
+/*N*/ {
+/*N*/ SetVersionMap( 1, 1, 60, pVersionMap1 );
+/*N*/ SetVersionMap( 2, 1, 75, pVersionMap2 );
+/*N*/ SetVersionMap( 3, 1, 86, pVersionMap3 );
+/*N*/ SetVersionMap( 4, 1,121, pVersionMap4 );
+/*N*/ }
+
+
+/*?*/ SwAttrSet::SwAttrSet( SwAttrPool& rPool, USHORT nWh1, USHORT nWh2 )
+/*?*/ : SfxItemSet( rPool, nWh1, nWh2 ), pOldSet( 0 ), pNewSet( 0 )
+/*?*/ {
+/*?*/ }
+
+
+/*N*/ SwAttrSet::SwAttrSet( SwAttrPool& rPool, const USHORT* nWhichPairTable )
+/*N*/ : SfxItemSet( rPool, nWhichPairTable ), pOldSet( 0 ), pNewSet( 0 )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwAttrSet::SwAttrSet( const SwAttrSet& rSet )
+/*N*/ : SfxItemSet( rSet ), pOldSet( 0 ), pNewSet( 0 )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
+/*N*/ SwAttrSet* pOld, SwAttrSet* pNew )
+/*N*/ {
+/*N*/ pNewSet = pNew;
+/*N*/ pOldSet = pOld;
+/*N*/ int nRet = 0 != SfxItemSet::Put( rAttr );
+/*N*/ pOldSet = pNewSet = 0;
+/*N*/ return nRet;
+/*N*/ }
+
+
+/*N*/ int SwAttrSet::Put_BC( const SfxItemSet& rSet,
+/*N*/ SwAttrSet* pOld, SwAttrSet* pNew )
+/*N*/ {
+/*N*/ pNewSet = pNew;
+/*N*/ pOldSet = pOld;
+/*N*/ int nRet = 0 != SfxItemSet::Put( rSet );
+/*N*/ pOldSet = pNewSet = 0;
+/*N*/ return nRet;
+/*N*/ }
+
+
+
+/*N*/ USHORT SwAttrSet::ClearItem_BC( USHORT nWhich,
+/*N*/ SwAttrSet* pOld, SwAttrSet* pNew )
+/*N*/ {
+/*N*/ pNewSet = pNew;
+/*N*/ pOldSet = pOld;
+/*N*/ USHORT nRet = SfxItemSet::ClearItem( nWhich );
+/*N*/ pOldSet = pNewSet = 0;
+/*N*/ return nRet;
+/*N*/ }
+
+
+/*N*/ USHORT SwAttrSet::ClearItem_BC( USHORT nWhich1, USHORT nWhich2,
+/*N*/ SwAttrSet* pOld, SwAttrSet* pNew )
+/*N*/ {
+/*N*/ ASSERT( nWhich1 <= nWhich2, "kein gueltiger Bereich" );
+/*N*/ pNewSet = pNew;
+/*N*/ pOldSet = pOld;
+/*N*/ USHORT nRet = 0;
+/*N*/ for( ; nWhich1 <= nWhich2; ++nWhich1 )
+/*N*/ nRet += SfxItemSet::ClearItem( nWhich1 );
+/*N*/ pOldSet = pNewSet = 0;
+/*N*/ return nRet;
+/*N*/ }
+
+
+
+/*N*/ int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
+/*N*/ SwAttrSet* pOld, SwAttrSet* pNew )
+/*N*/ {
+/*N*/ pNewSet = pNew;
+/*N*/ pOldSet = pOld;
+/*N*/ SfxItemSet::Intersect( rSet );
+/*N*/ pOldSet = pNewSet = 0;
+/*N*/ return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
+/*N*/ }
+
+ // Notification-Callback
+/*N*/ void SwAttrSet::Changed( const SfxPoolItem& rOld,
+/*N*/ const SfxPoolItem& rNew )
+/*N*/ {
+/*N*/ if( pOldSet )
+/*N*/ pOldSet->PutChgd( rOld );
+/*N*/
+/*N*/ if( pNewSet )
+/*N*/ pNewSet->PutChgd( rNew );
+/*N*/ }
+
+
+// ----------------------------------------------------------------
+// Sonderbehandlung fuer einige Attribute
+// Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
+// - SwFmtDropCaps
+// - SwFmtPageDesc
+// (Wird beim Einfuegen in Formate/Nodes gerufen)
+// ----------------------------------------------------------------
+/*N*/ void SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == GetItemState( RES_PAGEDESC, FALSE, &pItem ) &&
+/*N*/ ((SwFmtPageDesc*)pItem)->GetDefinedIn() != pModify )
+/*N*/ {
+/*N*/ ((SwFmtPageDesc*)pItem)->ChgDefinedIn( pModify );
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET == GetItemState( RES_PARATR_NUMRULE, FALSE, &pItem ) &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetDefinedIn() != pModify )
+/*N*/ {
+/*N*/ ((SwNumRuleItem*)pItem)->ChgDefinedIn( pModify );
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET == GetItemState( RES_PARATR_DROP, FALSE, &pItem ) &&
+/*N*/ ((SwFmtDrop*)pItem)->GetDefinedIn() != pModify )
+/*N*/ {
+/*N*/ // CharFormat gesetzt und dann noch in unterschiedlichen
+/*N*/ // Attribut Pools, dann muss das CharFormat kopiert werden!
+/*N*/ SwCharFmt* pCharFmt;
+/*N*/ if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() )
+/*N*/ && GetPool() != pCharFmt->GetAttrSet().GetPool() )
+/*N*/ {
+/*?*/ pCharFmt = GetDoc()->CopyCharFmt( *pCharFmt );
+/*?*/ ((SwFmtDrop*)pItem)->SetCharFmt( pCharFmt );
+/*N*/ }
+/*N*/ ((SwFmtDrop*)pItem)->ChgDefinedIn( pModify );
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, FALSE, &pItem ) &&
+/*N*/ ((SwTblBoxFormula*)pItem)->GetDefinedIn() != pModify )
+/*N*/ {
+/*?*/ ((SwTblBoxFormula*)pItem)->ChgDefinedIn( pModify );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwAttrSet::CopyToModify( SwModify& rMod ) const
+/*N*/ {
+/*N*/ // kopiere die Attribute ggfs. ueber Dokumentgrenzen
+/*N*/ SwCntntNode* pCNd = PTR_CAST( SwCntntNode, &rMod );
+/*N*/ SwFmt* pFmt = PTR_CAST( SwFmt, &rMod );
+/*N*/
+/*N*/ if( pCNd || pFmt )
+/*N*/ {
+/*N*/ if( Count() )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ const SwDoc *pSrcDoc = GetDoc();
+/*N*/ SwDoc *pDstDoc = pCNd ? pCNd->GetDoc() : pFmt->GetDoc();
+/*N*/
+/*N*/ // muss die NumRule kopiert werden?
+/*N*/ if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
+/*N*/ RES_PARATR_NUMRULE, FALSE, &pItem ) )
+/*N*/ {
+/*N*/ const String& rNm = ((SwNumRuleItem*)pItem)->GetValue();
+/*N*/ if( rNm.Len() )
+/*N*/ {
+/*N*/ SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm );
+/*N*/ if( pDestRule )
+/*N*/ pDestRule->SetInvalidRule( TRUE );
+/*N*/ else
+/*N*/ pDstDoc->MakeNumRule( rNm,
+/*N*/ pSrcDoc->FindNumRulePtr( rNm ) );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // JP 04.02.99: Task #61467# Seitenvorlagenwechsel mit kopieren
+/*N*/ // Gegenueber dem alten Verhalten, sie zu entfernen
+/*N*/ const SwPageDesc* pPgDesc;
+/*N*/ if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
+/*N*/ RES_PAGEDESC, FALSE, &pItem ) &&
+/*N*/ 0 != ( pPgDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc()) )
+/*N*/ {
+/*N*/ SfxItemSet aTmpSet( *this );
+/*N*/
+/*N*/ // JP 09.02.99: und jetzt doch wieder nur entfernen
+/*N*/ aTmpSet.ClearItem( RES_PAGEDESC );
+/*N*/
+/*************************************************************************
+ 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 );
+************************************************************************/
+/*N*/
+/*N*/ if( pCNd )
+/*N*/ pCNd->SetAttr( aTmpSet );
+/*N*/ else
+/*?*/ pFmt->SetAttr( aTmpSet );
+/*N*/ }
+/*N*/ else if( pCNd )
+/*N*/ pCNd->SetAttr( *this );
+/*N*/ else
+/*N*/ pFmt->SetAttr( *this );
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else
+/*N*/ ASSERT( !this, "weder Format noch ContentNode - keine Attribute kopiert");
+/*N*/ #endif
+/*N*/ }
+
+// check if ID is InRange of AttrSet-Ids
+/*N*/ BOOL IsInRange( const USHORT* pRange, const USHORT nId )
+/*N*/ {
+/*N*/ while( *pRange )
+/*N*/ {
+/*N*/ if( *pRange <= nId && nId <= *(pRange+1) )
+/*N*/ return TRUE;
+/*N*/ pRange += 2;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/makefile.mk b/binfilter/bf_sw/source/core/bastyp/makefile.mk
new file mode 100644
index 000000000000..f9ce9d872f02
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/makefile.mk
@@ -0,0 +1,75 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_bastyp
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_bparr.cxx \
+ sw_breakit.cxx \
+ sw_calc.cxx \
+ sw_checkit.cxx \
+ sw_index.cxx \
+ sw_init.cxx \
+ sw_ring.cxx \
+ sw_swcache.cxx \
+ sw_swrect.cxx \
+ sw_swregion.cxx \
+ sw_swtypes.cxx
+
+SLOFILES = \
+ $(SLO)$/sw_bparr.obj \
+ $(SLO)$/sw_breakit.obj \
+ $(SLO)$/sw_calc.obj \
+ $(SLO)$/sw_checkit.obj \
+ $(SLO)$/sw_index.obj \
+ $(SLO)$/sw_init.obj \
+ $(SLO)$/sw_ring.obj \
+ $(SLO)$/sw_swcache.obj \
+ $(SLO)$/sw_swrect.obj \
+ $(SLO)$/sw_swregion.obj \
+ $(SLO)$/sw_swtypes.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_bparr.cxx b/binfilter/bf_sw/source/core/bastyp/sw_bparr.cxx
new file mode 100644
index 000000000000..ee680a7532c6
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_bparr.cxx
@@ -0,0 +1,586 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <string.h>
+#include <limits.h>
+#include "bparr.hxx"
+namespace binfilter {
+
+// die Blockverwaltung waechst/schrumpft immer um 20 Bloecke, das sind dann
+// immer ~ 20 * MAXENTRY == 20000 Eintraege
+const USHORT nBlockGrowSize = 20;
+
+#ifndef DBG_UTIL
+
+#define CHECKIDX( p, n, i, c )
+
+#else
+
+#define CHECKIDX( p, n, i, c ) CheckIdx( p, n, i, c );
+
+/*N*/ void CheckIdx( BlockInfo** ppInf, USHORT nBlock, ULONG nSize, USHORT nCur )
+/*N*/ {
+/*N*/ DBG_ASSERT( !nSize || nCur < nBlock, "BigPtrArray: CurIndex steht falsch" );
+/*N*/
+/*N*/ ULONG nIdx = 0;
+/*N*/ for( USHORT nCnt = 0; nCnt < nBlock; ++nCnt, ++ppInf )
+/*N*/ {
+/*N*/ nIdx += (*ppInf)->nElem;
+/*N*/ // Array mit Luecken darf es nicht geben
+/*N*/ DBG_ASSERT( !nCnt || (*(ppInf-1))->nEnd + 1 == (*ppInf)->nStart,
+/*N*/ "BigPtrArray: Luecke in der Verwaltung!" );
+/*N*/ }
+/*N*/
+/*N*/ DBG_ASSERT( nIdx == nSize, "BigPtrArray: Anzahl ungueltig" );
+/*N*/ }
+
+#endif
+
+
+/*N*/ BigPtrArray::BigPtrArray()
+/*N*/ {
+/*N*/ nBlock = nCur = 0;
+/*N*/ nSize = 0;
+/*N*/ nMaxBlock = nBlockGrowSize; // == 20 * 1000 Eintraege
+/*N*/ ppInf = new BlockInfo* [ nMaxBlock ];
+/*N*/ }
+
+
+
+/*N*/ BigPtrArray::~BigPtrArray()
+/*N*/ {
+/*N*/ if( nBlock )
+/*N*/ {
+/*N*/ BlockInfo** pp = ppInf;
+/*N*/ for( USHORT n = 0; n < nBlock; ++n, ++pp )
+/*N*/ {
+/*N*/ delete[] (*pp)->pData;
+/*N*/ delete *pp;
+/*N*/ }
+/*N*/ }
+/*N*/ delete[] ppInf;
+/*N*/ }
+
+// Einfachst-Implementation, evtl. spaeter mal komplexer
+#if 0
+#endif
+
+// Auch der Move ist schlicht. Optimieren ist hier wg. der
+// Stueckelung des Feldes zwecklos!
+
+
+// das Ende ist EXCLUSIV
+
+
+/*N*/ void BigPtrArray::ForEach( ULONG nStart, ULONG nEnd,
+/*N*/ FnForEach fn, void* pArgs )
+/*N*/ {
+/*N*/ if( nEnd > nSize )
+/*N*/ nEnd = nSize;
+/*N*/
+/*N*/ if( nStart < nEnd )
+/*N*/ {
+/*N*/ USHORT cur = Index2Block( nStart );
+/*N*/ BlockInfo** pp = ppInf + cur;
+/*N*/ BlockInfo* p = *pp;
+/*N*/ USHORT nElem = USHORT( nStart - p->nStart );
+/*N*/ ElementPtr* pElem = p->pData + nElem;
+/*N*/ nElem = p->nElem - nElem;
+/*N*/ for(;;)
+/*N*/ {
+/*N*/ if( !(*fn)( *pElem++, pArgs ) || ++nStart >= nEnd )
+/*N*/ break;
+/*N*/
+/*N*/ // naechstes Element
+/*N*/ if( !--nElem )
+/*N*/ {
+/*N*/ // neuer Block
+/*N*/ p = *++pp;
+/*N*/ pElem = p->pData;
+/*N*/ nElem = p->nElem;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ ElementPtr BigPtrArray::operator[]( ULONG idx ) const
+/*N*/ {
+/*N*/ // weil die Funktion eben doch nicht const ist:
+/*N*/ DBG_ASSERT( idx < nSize, "operator[]: Index aussserhalb" );
+/*N*/ BigPtrArray* pThis = (BigPtrArray*) this;
+/*N*/ USHORT cur = Index2Block( idx );
+/*N*/ BlockInfo* p = ppInf[ cur ];
+/*N*/ pThis->nCur = cur;
+/*N*/ return p->pData[ idx - p->nStart ];
+/*N*/ }
+
+///////////////////////////////////////////////////////////////////////////
+
+// 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
+
+
+
+/*N*/ USHORT BigPtrArray::Index2Block( ULONG pos ) const
+/*N*/ {
+/*N*/ // zuletzt verwendeter Block?
+/*N*/ BlockInfo* p = ppInf[ nCur ];
+/*N*/ if( p->nStart <= pos && p->nEnd >= pos )
+/*N*/ return nCur;
+/*N*/ // Index = 0?
+/*N*/ if( !pos )
+/*N*/ return 0;
+/*N*/ // Folgeblock?
+/*N*/ if( nCur < ( nBlock - 1 ) )
+/*N*/ {
+/*N*/ p = ppInf[ nCur+1 ];
+/*N*/ if( p->nStart <= pos && p->nEnd >= pos )
+/*N*/ return nCur+1;
+/*N*/ }
+/*N*/ // vorangehender Block?
+/*N*/ else if( pos < p->nStart && nCur > 0 )
+/*N*/ {
+/*N*/ p = ppInf[ nCur-1 ];
+/*N*/ if( p->nStart <= pos && p->nEnd >= pos )
+/*N*/ return nCur-1;
+/*N*/ }
+/*N*/ // Binaere Suche:
+/*N*/ // Diese fuehrt immer zum Erfolg
+/*N*/ USHORT lower = 0, upper = nBlock - 1;
+/*N*/ USHORT cur = 0;
+/*N*/ for(;;)
+/*N*/ {
+/*N*/ USHORT n = lower + ( upper - lower ) / 2;
+/*N*/ cur = ( n == cur ) ? n+1 : n;
+/*N*/ p = ppInf[ cur ];
+/*N*/ if( p->nStart <= pos && p->nEnd >= pos )
+/*N*/ return cur;
+/*N*/ if( p->nStart > pos )
+/*N*/ upper = cur;
+/*N*/ else
+/*N*/ lower = cur;
+/*N*/ }
+/*N*/ }
+
+
+// Update aller Indexbereiche ab einer bestimmten Position
+
+// pos bezeichnet den letzten korrekten Block
+
+/*N*/ void BigPtrArray::UpdIndex( USHORT pos )
+/*N*/ {
+/*N*/ BlockInfo** pp = ppInf + pos;
+/*N*/ ULONG idx = (*pp)->nEnd + 1;
+/*N*/ BlockInfo* p;
+/*N*/ while( ++pos < nBlock )
+/*N*/ {
+/*N*/ p = *++pp;
+/*N*/ p->nStart = idx;
+/*N*/ idx += p->nElem;
+/*N*/ p->nEnd = idx - 1;
+/*N*/ }
+/*N*/ }
+
+// Einrichten eines neuen Blocks an einer bestimmten Position
+
+// Vorhandene Blocks werden nach hinten verschoben
+
+
+
+/*N*/ BlockInfo* BigPtrArray::InsBlock( USHORT pos )
+/*N*/ {
+/*N*/ if( nBlock == nMaxBlock )
+/*N*/ {
+/*N*/ // dann sollte wir mal das Array erweitern
+/*N*/ BlockInfo** ppNew = new BlockInfo* [ nMaxBlock + nBlockGrowSize ];
+/*N*/ memcpy( ppNew, ppInf, nMaxBlock * sizeof( BlockInfo* ));
+/*N*/ delete[] ppInf;
+/*N*/ nMaxBlock += nBlockGrowSize;
+/*N*/ ppInf = ppNew;
+/*N*/ }
+/*N*/ if( pos != nBlock )
+/*N*/ memmove( ppInf + pos+1, ppInf + pos ,
+/*N*/ ( nBlock - pos ) * sizeof (BlockInfo*) );
+/*N*/ ++nBlock;
+/*N*/ BlockInfo* p = new BlockInfo;
+/*N*/ ppInf[ pos ] = p;
+/*N*/
+/*N*/ if( pos )
+/*N*/ p->nStart = p->nEnd = ppInf[ pos-1 ]->nEnd + 1;
+/*N*/ else
+/*N*/ p->nStart = p->nEnd = 0;
+/*N*/ p->nEnd--; // keine Elemente
+/*N*/ p->nElem = 0;
+/*N*/ p->pData = new ElementPtr [ MAXENTRY ];
+/*N*/ p->pBigArr = this;
+/*N*/ return p;
+/*N*/ }
+
+/*N*/ void BigPtrArray::BlockDel( USHORT nDel )
+/*N*/ {
+/*N*/ nBlock -= nDel;
+/*N*/ if( nMaxBlock - nBlock > nBlockGrowSize )
+/*N*/ {
+/*N*/ // dann koennen wir wieder schrumpfen
+/*N*/ nDel = (( nBlock / nBlockGrowSize ) + 1 ) * nBlockGrowSize;
+/*N*/ BlockInfo** ppNew = new BlockInfo* [ nDel ];
+/*N*/ memcpy( ppNew, ppInf, nBlock * sizeof( BlockInfo* ));
+/*N*/ delete[] ppInf;
+/*N*/ ppInf = ppNew;
+/*N*/ nMaxBlock = nDel;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void BigPtrArray::Insert( const ElementPtr& rElem, ULONG pos )
+/*N*/ {
+/*N*/ CHECKIDX( ppInf, nBlock, nSize, nCur );
+/*N*/
+/*N*/ BlockInfo* p;
+/*N*/ USHORT cur;
+/*N*/ if( !nSize )
+/*N*/ // Sonderfall: erstes Element einfuegen
+/*N*/ p = InsBlock( cur = 0 );
+/*N*/ else if( pos == nSize )
+/*N*/ {
+/*N*/ // Sonderfall: Einfuegen am Ende
+/*N*/ cur = nBlock - 1;
+/*N*/ p = ppInf[ cur ];
+/*N*/ if( p->nElem == MAXENTRY )
+/*N*/ // Der letzte Block ist voll, neuen anlegen
+/*?*/ p = InsBlock( ++cur );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Standardfall:
+/*N*/ cur = Index2Block( pos );
+/*N*/ p = ppInf[ cur ];
+/*N*/ }
+/*N*/ if( p->nElem == MAXENTRY )
+/*N*/ {
+/*N*/ // passt der letzte Eintrag in den naechsten Block?
+/*N*/ BlockInfo* q;
+/*N*/ if( cur < ( nBlock - 1 ) && ppInf[ cur+1 ]->nElem < MAXENTRY )
+/*N*/ {
+/*N*/ q = ppInf[ cur+1 ];
+/*N*/ if( q->nElem )
+/*N*/ {
+/*N*/ register int nCount = q->nElem;
+/*N*/ register ElementPtr *pFrom = q->pData + nCount,
+/*N*/ *pTo = pFrom+1;
+/*N*/ while( nCount-- )
+/*N*/ ++( *--pTo = *--pFrom )->nOffset;
+/*N*/ }
+/*N*/ q->nStart--;
+/*N*/ q->nEnd--;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Wenn er auch nicht in den Folgeblock passt, muss ein
+/*N*/ // neuer Block eingefuegt werden
+/*N*/ // erst mal bei Bedarf komprimieren
+/*N*/
+/*N*/ // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
+/*N*/ // Compress aufrufen
+/*N*/ if( /*nBlock == nMaxBlock &&*/
+/*N*/ nBlock > ( nSize / ( MAXENTRY / 2 ) ) &&
+/*N*/ cur >= Compress() )
+/*N*/ {
+/*N*/ // es wurde vor der akt. Pos etwas verschoben und alle
+/*N*/ // Pointer koennen ungueltig sein. Also das Insert
+/*N*/ // nochmals aufsetzen
+/*?*/ Insert( rElem, pos );
+/*N*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ q = InsBlock( cur+1 );
+/*N*/ }
+/*N*/
+/*N*/ // Eintrag passt nicht mehr. Dann muss Platz gemacht werden
+/*N*/ ElementPtr pLast = p->pData[ MAXENTRY-1 ];
+/*N*/ pLast->nOffset = 0;
+/*N*/ pLast->pBlock = q;
+/*N*/
+/*N*/ q->pData[ 0 ] = pLast;
+/*N*/ q->nElem++;
+/*N*/ q->nEnd++;
+/*N*/
+/*N*/ p->nEnd--;
+/*N*/ p->nElem--;
+/*N*/ }
+/*N*/ // Nun haben wir einen freien Block am Wickel: eintragen
+/*N*/ pos -= p->nStart;
+/*N*/ DBG_ASSERT( pos < MAXENTRY, "falsche Pos" );
+/*N*/ if( pos != p->nElem )
+/*N*/ {
+/*N*/ register int nCount = p->nElem - USHORT(pos);
+/*N*/ register ElementPtr *pFrom = p->pData + p->nElem,
+/*N*/ *pTo = pFrom + 1;
+/*N*/ while( nCount-- )
+/*N*/ ++( *--pTo = *--pFrom )->nOffset;
+/*N*/ }
+/*N*/ // Element eintragen und Indexe updaten
+/*N*/ ((ElementPtr&)rElem)->nOffset = USHORT(pos);
+/*N*/ ((ElementPtr&)rElem)->pBlock = p;
+/*N*/ p->pData[ pos ] = rElem;
+/*N*/ p->nEnd++;
+/*N*/ p->nElem++;
+/*N*/ nSize++;
+/*N*/ if( cur != ( nBlock - 1 ) ) UpdIndex( cur );
+/*N*/ nCur = cur;
+/*N*/
+/*N*/ CHECKIDX( ppInf, nBlock, nSize, nCur );
+/*N*/ }
+
+/*N*/ void BigPtrArray::Remove( ULONG pos, ULONG n )
+/*N*/ {
+/*N*/ CHECKIDX( ppInf, nBlock, nSize, nCur );
+/*N*/
+/*N*/ USHORT nBlkdel = 0; // entfernte Bloecke
+/*N*/ USHORT cur = Index2Block( pos ); // aktuelle Blocknr
+/*N*/ USHORT nBlk1 = cur; // 1. behandelter Block
+/*N*/ USHORT nBlk1del = USHRT_MAX; // 1. entfernter Block
+/*N*/ BlockInfo* p = ppInf[ cur ];
+/*N*/ pos -= p->nStart;
+/*N*/ ULONG nElem = n;
+/*N*/ while( nElem )
+/*N*/ {
+/*N*/ USHORT nel = p->nElem - USHORT(pos);
+/*N*/ if( ULONG(nel) > nElem )
+/*N*/ nel = USHORT(nElem);
+/*N*/ // Eventuell Elemente verschieben
+/*N*/ if( ( pos + nel ) < ULONG(p->nElem) )
+/*N*/ {
+/*N*/ register ElementPtr *pTo = p->pData + pos,
+/*N*/ *pFrom = pTo + nel;
+/*N*/ register int nCount = p->nElem - nel - USHORT(pos);
+/*N*/ while( nCount-- )
+/*N*/ {
+/*N*/ (*pTo++ = *pFrom++)->nOffset -= nel;
+/*N*/ // (*pTo++)->nOffset -= nel;
+/*N*/ }
+/*N*/ }
+/*N*/ p->nEnd -= nel;
+/*N*/ p->nElem -= nel;
+/*N*/ if( !p->nElem )
+/*N*/ {
+/*N*/ // eventuell Block ganz entfernen
+/*N*/ delete[] p->pData;
+/*N*/ nBlkdel++;
+/*N*/ if( USHRT_MAX == nBlk1del )
+/*N*/ nBlk1del = cur;
+/*N*/ }
+/*N*/ nElem -= nel;
+/*N*/ if( !nElem )
+/*N*/ break;
+/*N*/ p = ppInf[ ++cur ];
+/*N*/ pos = 0;
+/*N*/ }
+/*N*/ // Am Ende die Tabelle updaten, falls Bloecke geloescht waren
+/*N*/ if( nBlkdel )
+/*N*/ {
+/*N*/ // loeschen sollte man immer !!
+/*N*/ for( USHORT i = nBlk1del; i < ( nBlk1del + nBlkdel ); i++ )
+/*N*/ delete ppInf[ i ];
+/*N*/
+/*N*/ if( ( nBlk1del + nBlkdel ) < nBlock )
+/*N*/ {
+/*N*/ memmove( ppInf + nBlk1del, ppInf + nBlk1del + nBlkdel,
+/*N*/ ( nBlock - nBlkdel - nBlk1del ) * sizeof( BlockInfo* ) );
+/*N*/
+/*N*/ // JP 19.07.95: nicht den ersten behandelten, sondern den davor!!
+/*N*/ // UpdateIdx updatet nur alle Nachfolgende!!
+/*N*/ if( !nBlk1 )
+/*N*/ {
+/*N*/ p = ppInf[ 0 ];
+/*N*/ p->nStart = 0;
+/*N*/ p->nEnd = p->nElem-1;
+/*N*/ }
+/*N*/ else
+/*N*/ --nBlk1;
+/*N*/ }
+/*N*/ BlockDel( nBlkdel ); // es wurden Bloecke geloescht
+/*N*/ }
+/*N*/
+/*N*/ nSize -= n;
+/*N*/ if( nBlk1 != ( nBlock - 1 ) && nSize )
+/*N*/ UpdIndex( nBlk1 );
+/*N*/ nCur = nBlk1;
+/*N*/
+/*N*/ // wenn mehr als 50% "Luft" im Array ist, dann sollte man mal das
+/*N*/ // Compress aufrufen
+/*N*/ if( nBlock > ( nSize / ( MAXENTRY / 2 ) ) )
+/*N*/ Compress();
+/*N*/
+/*N*/ CHECKIDX( ppInf, nBlock, nSize, nCur );
+/*N*/ }
+
+
+/*N*/ void BigPtrArray::Replace( ULONG idx, const ElementPtr& rElem)
+/*N*/ {
+/*N*/ // weil die Funktion eben doch nicht const ist:
+/*N*/ DBG_ASSERT( idx < nSize, "Set: Index aussserhalb" );
+/*N*/ BigPtrArray* pThis = (BigPtrArray*) this;
+/*N*/ USHORT cur = Index2Block( idx );
+/*N*/ BlockInfo* p = ppInf[ cur ];
+/*N*/ pThis->nCur = cur;
+/*N*/ ((ElementPtr&)rElem)->nOffset = USHORT(idx - p->nStart);
+/*N*/ ((ElementPtr&)rElem)->pBlock = p;
+/*N*/ p->pData[ idx - p->nStart ] = rElem;
+/*N*/ }
+
+
+// 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.
+
+
+
+// Array komprimieren
+
+/*N*/ USHORT BigPtrArray::Compress( short nMax )
+/*N*/ {
+/*N*/ CHECKIDX( ppInf, nBlock, nSize, nCur );
+/*N*/
+/*N*/ // Es wird von vorne nach hinten ueber das InfoBlock Array iteriert.
+/*N*/ // Wenn zwischen durch Block gel”scht werden, dann mussen alle
+/*N*/ // nachfolgenden verschoben werden. Dazu werden die Pointer pp und qq
+/*N*/ // benutzt; wobei pp das "alte" Array, qq das "neue" Array ist.
+/*N*/ BlockInfo** pp = ppInf, **qq = pp;
+/*N*/ BlockInfo* p;
+/*N*/ BlockInfo* pLast; // letzter nicht voller Block
+/*N*/ USHORT nLast = 0; // fehlende Elemente
+/*N*/ USHORT nBlkdel = 0; // Anzahl der geloeschte Bloecke
+/*N*/ USHORT nFirstChgPos = USHRT_MAX; // ab welcher Pos gab es die 1. Aenderung?
+/*N*/
+/*N*/ // von Fuell-Prozenten auf uebrige Eintrage umrechnen
+/*N*/ nMax = MAXENTRY - (long) MAXENTRY * nMax / 100;
+/*N*/
+/*N*/ for( USHORT cur = 0; cur < nBlock; ++cur )
+/*N*/ {
+/*N*/ p = *pp++;
+/*N*/ USHORT n = p->nElem;
+/*N*/ // Testen, ob der noch nicht volle Block so gelassen wird
+/*N*/ // dies ist der Fall, wenn der aktuelle Block gesplittet
+/*N*/ // werden muesste, der noch nicht volle Block aber bereits
+/*N*/ // ueber dem uebergebenen Break-Wert voll ist. In diesem
+/*N*/ // Fall wird von einer weiteren Fuellung (die ja wegen dem
+/*N*/ // zweifachen memmove() zeitaufwendig ist) abgesehen.
+/*N*/ if( nLast && ( n > nLast ) && ( nLast < nMax ) )
+/*N*/ nLast = 0;
+/*N*/ if( nLast )
+/*N*/ {
+/*N*/ if( USHRT_MAX == nFirstChgPos )
+/*N*/ nFirstChgPos = cur;
+/*N*/
+/*N*/ // ein nicht voller Block vorhanden: auffuellen
+/*N*/ if( n > nLast )
+/*N*/ n = nLast;
+/*N*/
+/*N*/ // Elemente uebertragen, vom akt. in den letzten
+/*N*/ register ElementPtr* pElem = pLast->pData + pLast->nElem;
+/*N*/ register ElementPtr* pFrom = p->pData;
+/*N*/ for( register int nCount = n, nOff = pLast->nElem;
+/*N*/ nCount; --nCount, ++pElem )
+/*N*/ *pElem = *pFrom++,
+/*N*/ (*pElem)->pBlock = pLast,
+/*N*/ (*pElem)->nOffset = nOff++;
+/*N*/
+/*N*/ // korrigieren
+/*N*/ pLast->nElem += n;
+/*N*/ nLast -= n;
+/*N*/ p->nElem -= n;
+/*N*/
+/*N*/ // Ist der aktuelle Block dadurch leer geworden?
+/*N*/ if( !p->nElem )
+/*N*/ {
+/*N*/ // dann kann der entfernt werden
+/*N*/ delete[] p->pData;
+/*N*/ delete p, p = 0;
+/*N*/ ++nBlkdel;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pElem = p->pData, pFrom = pElem + n;
+/*N*/ register int nCount = p->nElem;
+/*N*/ while( nCount-- )
+/*N*/ {
+/*N*/ (*pElem++ = *pFrom++)->nOffset -= n;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( p ) // die Blockinfo wurde nicht geloescht
+/*N*/ {
+/*N*/ *qq++ = p; // dann setze sie an die richtige neue Position
+/*N*/
+/*N*/ // eventuell den letzten halbvollen Block festhalten
+/*N*/ if( !nLast && p->nElem < MAXENTRY )
+/*N*/ {
+/*N*/ pLast = p;
+/*N*/ nLast = MAXENTRY - p->nElem;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Bloecke geloescht wurden, ggfs. das BlockInfo Array verkuerzen
+/*N*/ if( nBlkdel )
+/*N*/ BlockDel( nBlkdel );
+/*N*/
+/*N*/ // Und neu durchindizieren
+/*N*/ p = ppInf[ 0 ];
+/*N*/ p->nEnd = p->nElem - 1;
+/*N*/ UpdIndex( 0 );
+/*N*/
+/*N*/ if( nCur >= nFirstChgPos )
+/*N*/ nCur = 0;
+/*N*/
+/*N*/ CHECKIDX( ppInf, nBlock, nSize, nCur );
+/*N*/
+/*N*/ return nFirstChgPos;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_breakit.cxx b/binfilter/bf_sw/source/core/bastyp/sw_breakit.cxx
new file mode 100644
index 000000000000..1a91287a5204
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_breakit.cxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <unotools/localedatawrapper.hxx>
+#include <bf_svx/unolingu.hxx>
+#include <bf_svx/scripttypeitem.hxx>
+
+#include <breakit.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+
+#include "swtypes.hxx"
+
+namespace binfilter {
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+
+
+/*N*/ SwBreakIt::SwBreakIt()
+/*N*/ : pLocale( NULL ), pForbidden( NULL )
+/*N*/ {
+/*N*/ _GetLocale( (LanguageType)GetAppLanguage() );
+/*N*/ Reference< XMultiServiceFactory > xMSF = ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*N*/ Reference < XInterface > xI = xMSF->createInstance(
+/*N*/ ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) );
+/*N*/ if ( xI.is() )
+/*N*/ {
+/*N*/ Any x = xI->queryInterface( ::getCppuType((const Reference< XBreakIterator >*)0) );
+/*N*/ x >>= xBreak;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwBreakIt::_GetLocale( const LanguageType aLang )
+/*N*/ {
+/*N*/ aLast = aLang;
+/*N*/ delete pLocale;
+/*N*/ pLocale = new Locale( SvxCreateLocale( aLast ) );
+/*N*/ }
+
+/*N*/ void SwBreakIt::_GetForbidden( const LanguageType aLang )
+/*N*/ {
+/*N*/ aForbiddenLang = aLang;
+/*N*/ Reference< XMultiServiceFactory > xMSF = ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*N*/ LocaleDataWrapper aWrap( xMSF, GetLocale( aLang ) );
+/*N*/ delete pForbidden;
+/*N*/ pForbidden = new ForbiddenCharacters( aWrap.getForbiddenCharacters() );
+/*N*/ }
+
+/*N*/ USHORT SwBreakIt::GetRealScriptOfText( const String& rTxt,
+/*N*/ xub_StrLen nPos ) const
+/*N*/ {
+/*N*/ USHORT nScript = ScriptType::WEAK;
+/*N*/ if( xBreak.is() && rTxt.Len() )
+/*N*/ {
+/*N*/ if( nPos && nPos == rTxt.Len() )
+/*N*/ --nPos;
+/*N*/ nScript = xBreak->getScriptType( rTxt, nPos );
+/*N*/ sal_Int32 nChgPos;
+/*N*/ if( ScriptType::WEAK == nScript && nPos &&
+/*N*/ 0 < (nChgPos = xBreak->beginOfScript( rTxt, nPos, nScript )) )
+/*N*/ nScript = xBreak->getScriptType( rTxt, nChgPos-1 );
+/*N*/
+/*N*/ if( ScriptType::WEAK == nScript && rTxt.Len() >
+/*N*/ ( nChgPos = xBreak->endOfScript( rTxt, nPos, nScript ) ) &&
+/*N*/ 0 <= nChgPos )
+/*N*/ nScript = xBreak->getScriptType( rTxt, nChgPos );
+/*N*/ }
+/*N*/ if( ScriptType::WEAK == nScript )
+/*N*/ nScript = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
+/*N*/ return nScript;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_calc.cxx b/binfilter/bf_sw/source/core/bastyp/sw_calc.cxx
new file mode 100644
index 000000000000..4a0ee25a59fe
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_calc.cxx
@@ -0,0 +1,1675 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <ctype.h>
+#if defined(MAC) || defined(MACOSX)
+#include <stdlib.h>
+#else
+#include <search.h>
+#endif
+#include <limits.h>
+#include <float.h>
+
+#include <hintids.hxx>
+
+#ifdef WNT
+#include <tools/svwin.h>
+#endif
+
+#include <rtl/math.hxx>
+#include <bf_svx/adritem.hxx>
+#include <bf_svx/langitem.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/charclass.hxx>
+#include <bf_svx/unolingu.hxx>
+#include <bf_svx/scripttypeitem.hxx>
+
+#include <horiornt.hxx>
+
+#include <viewsh.hxx>
+#include <docstat.hxx>
+#include <shellres.hxx>
+#include <expfld.hxx>
+#include <usrfld.hxx>
+#include <dbmgr.hxx>
+#include <docfld.hxx>
+#include <swunodef.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx>
+
+namespace binfilter {
+// 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_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
+/* 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
+};
+
+ // First character may be any alphabetic or underscore.
+const sal_Int32 coStartFlags =
+ ::com::sun::star::i18n::KParseTokens::ANY_LETTER_OR_NUMBER |
+ ::com::sun::star::i18n::KParseTokens::ASC_UNDERSCORE |
+ ::com::sun::star::i18n::KParseTokens::IGNORE_LEADING_WS;
+
+ // Continuing characters may be any alphanumeric or underscore or dot.
+const sal_Int32 coContFlags =
+ ( coStartFlags | ::com::sun::star::i18n::KParseTokens::ASC_DOT )
+ & ~::com::sun::star::i18n::KParseTokens::IGNORE_LEADING_WS;
+
+
+extern "C" {
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC )
+ _Optlink
+#endif
+/*N*/ OperatorCompare( const void *pFirst, const void *pSecond)
+/*N*/ {
+/*N*/ int nRet = 0;
+/*N*/ if( CALC_NAME == ((_CalcOp*)pFirst)->eOp )
+/*N*/ {
+/*N*/ if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
+/*?*/ nRet = ((_CalcOp*)pFirst)->pUName->CompareTo(
+/*?*/ *((_CalcOp*)pSecond)->pUName );
+/*N*/ else
+/*N*/ nRet = ((_CalcOp*)pFirst)->pUName->CompareToAscii(
+/*N*/ ((_CalcOp*)pSecond)->pName );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ if( CALC_NAME == ((_CalcOp*)pSecond)->eOp )
+/*?*/ nRet = -1 * ((_CalcOp*)pSecond)->pUName->CompareToAscii(
+/*?*/ ((_CalcOp*)pFirst)->pName );
+/*?*/ else
+/*?*/ nRet = strcmp( ((_CalcOp*)pFirst)->pName,
+/*?*/ ((_CalcOp*)pSecond)->pName );
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+}// extern "C"
+
+/*N*/ _CalcOp* FindOperator( const String& rSrch )
+/*N*/ {
+/*N*/ _CalcOp aSrch;
+/*N*/ aSrch.pUName = &rSrch;
+/*N*/ aSrch.eOp = CALC_NAME;
+/*N*/
+/*N*/ return (_CalcOp*)bsearch( (void*) &aSrch,
+/*N*/ (void*) aOpTable,
+/*N*/ sizeof( aOpTable ) / sizeof( _CalcOp ),
+/*N*/ sizeof( _CalcOp ),
+/*N*/ OperatorCompare );
+/*N*/ }
+/*N*/
+
+//-----------------------------------------------------------------------------
+
+/*N*/ SwHash* Find( const String& rStr, SwHash** ppTable, USHORT nTblSize,
+/*N*/ USHORT* pPos )
+/*N*/ {
+/*N*/ ULONG ii = 0, n;
+/*N*/ for( n = 0; n < rStr.Len(); ++n )
+/*N*/ ii = ii << 1 ^ rStr.GetChar( n );
+/*N*/ ii %= nTblSize;
+/*N*/
+/*N*/ if( pPos )
+/*N*/ *pPos = (USHORT)ii;
+/*N*/
+/*N*/ for( SwHash* pEntry = *(ppTable+ii); pEntry; pEntry = pEntry->pNext )
+/*N*/ if( rStr == pEntry->aStr )
+/*N*/ return pEntry;
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ inline LanguageType GetDocAppScriptLang( SwDoc& rDoc )
+/*N*/ {
+/*N*/ return ((SvxLanguageItem&)rDoc.GetDefault(
+/*N*/ GetWhichOfScript( RES_CHRATR_LANGUAGE,
+/*N*/ GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ))
+/*N*/ )).GetLanguage();
+/*N*/ }
+
+//-----------------------------------------------------------------------------
+
+/******************************************************************************
+|*
+|* SwCalc::SwCalc( SwDoc* pD ) :
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+/*N*/
+/*N*/ SwCalc::SwCalc( SwDoc& rD )
+/*N*/ : rDoc( rD ),
+/*N*/ eError( CALC_NOERR ),
+/*N*/ nListPor( 0 ),
+/*N*/ aErrExpr( aEmptyStr, SwSbxValue(), 0 ),
+/*N*/ pLclData( &GetAppLocaleData() ),
+/*N*/ pCharClass( &GetAppCharClass() )
+/*N*/ {
+/*N*/ aErrExpr.aStr.AssignAscii( "~C_ERR~" );
+/*N*/ memset( VarTable, 0, sizeof(VarTable) );
+/*N*/ LanguageType eLang = GetDocAppScriptLang( rDoc );
+/*N*/
+/*N*/ if( eLang != SvxLocaleToLanguage( pLclData->getLocale() ) ||
+/*N*/ eLang != SvxLocaleToLanguage( pCharClass->getLocale() ) )
+/*N*/ {
+/*N*/ STAR_NMSPC::lang::Locale aLocale( SvxCreateLocale( eLang ));
+/*N*/ STAR_REFERENCE( lang::XMultiServiceFactory ) xMSF(
+/*N*/ ::legacy_binfilters::getLegacyProcessServiceFactory() ); //STRIP002 ::comphelper::getProcessServiceFactory());
+/*N*/ pCharClass = new CharClass( xMSF, aLocale );
+/*N*/ pLclData = new LocaleDataWrapper( xMSF, aLocale );
+/*N*/ }
+/*N*/
+/*N*/ sCurrSym = pLclData->getCurrSymbol();
+/*N*/ sCurrSym.EraseLeadingChars().EraseTrailingChars();
+/*N*/ pCharClass->toLower( sCurrSym );
+/*N*/
+/*N*/ static sal_Char __READONLY_DATA
+/*N*/ sNType0[] = "false",
+/*N*/ sNType1[] = "true",
+/*N*/ sNType2[] = "pi",
+/*N*/ sNType3[] = "e",
+/*N*/ sNType4[] = "tables",
+/*N*/ sNType5[] = "graf",
+/*N*/ sNType6[] = "ole",
+/*N*/ sNType7[] = "page",
+/*N*/ sNType8[] = "para",
+/*N*/ sNType9[] = "word",
+/*N*/ sNType10[]= "char",
+/*N*/
+/*N*/ sNType11[] = "user_firstname" ,
+/*N*/ sNType12[] = "user_lastname" ,
+/*N*/ sNType13[] = "user_initials" ,
+/*N*/ sNType14[] = "user_company" ,
+/*N*/ sNType15[] = "user_street" ,
+/*N*/ sNType16[] = "user_country" ,
+/*N*/ sNType17[] = "user_zipcode" ,
+/*N*/ sNType18[] = "user_city" ,
+/*N*/ sNType19[] = "user_title" ,
+/*N*/ sNType20[] = "user_position" ,
+/*N*/ sNType21[] = "user_tel_work" ,
+/*N*/ sNType22[] = "user_tel_home" ,
+/*N*/ sNType23[] = "user_fax" ,
+/*N*/ sNType24[] = "user_email" ,
+/*N*/ sNType25[] = "user_state" ,
+/*N*/ sNType26[] = "graph"
+/*N*/ ;
+/*N*/
+/*N*/ static const sal_Char* __READONLY_DATA sNTypeTab[ 27 ] =
+/*N*/ {
+/*N*/ sNType0, sNType1, sNType2, sNType3, sNType4, sNType5,
+/*N*/ sNType6, sNType7, sNType8, sNType9, sNType10, sNType11,
+/*N*/ sNType12, sNType13, sNType14, sNType15, sNType16, sNType17,
+/*N*/ sNType18, sNType19, sNType20, sNType21, sNType22, sNType23,
+/*N*/ sNType24,
+/*N*/
+/*N*/ // diese sind mit doppelten HashIds
+/*N*/ sNType25, sNType26
+/*N*/ };
+/*N*/ static USHORT __READONLY_DATA aHashValue[ 27 ] =
+/*N*/ {
+/*N*/ 34, 38, 43, 7, 18, 32, 22, 29, 30, 33, 3,
+/*N*/ 28, 24, 40, 9, 11, 26, 45, 4, 23, 36, 44, 19, 5, 1,
+/*N*/ // diese sind mit doppelten HashIds
+/*N*/ 11, 38
+/*N*/ };
+/*N*/ static USHORT __READONLY_DATA aAdrToken[ 12 ] =
+/*N*/ {
+/*N*/ POS_COMPANY, POS_STREET, POS_COUNTRY, POS_PLZ,
+/*N*/ POS_CITY, POS_TITLE, POS_POSITION, POS_TEL_COMPANY,
+/*N*/ POS_TEL_PRIVATE, POS_FAX, POS_EMAIL, POS_STATE
+/*N*/ };
+/*N*/
+/*N*/ static USHORT SwDocStat::* __READONLY_DATA aDocStat1[ 3 ] =
+/*N*/ {
+/*N*/ &SwDocStat::nTbl, &SwDocStat::nGrf, &SwDocStat::nOLE
+/*N*/ };
+/*N*/ static ULONG SwDocStat::* __READONLY_DATA aDocStat2[ 4 ] =
+/*N*/ {
+/*N*/ &SwDocStat::nPage, &SwDocStat::nPara,
+/*N*/ &SwDocStat::nWord, &SwDocStat::nChar
+/*N*/ };
+/*N*/
+/*N*/ #if TBLSZ != 47
+/*N*/ #error Alle Hashwerte angepasst?
+/*N*/ #endif
+/*N*/
+/*N*/ const SwDocStat& rDocStat = rDoc.GetDocStat();
+/*N*/
+/*N*/ SwSbxValue nVal;
+/*N*/ String sTmpStr;
+ USHORT n=0;
+/*N*/ for( n = 0; n < 25; ++n )
+/*N*/ {
+/*N*/ sTmpStr.AssignAscii( sNTypeTab[ n ] );
+/*N*/ VarTable[ aHashValue[ n ] ] = new SwCalcExp( sTmpStr, nVal, 0 );
+/*N*/ }
+/*N*/
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ 0 ] ])->nValue.PutBool( FALSE );
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ 1 ] ])->nValue.PutBool( TRUE );
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ 2 ] ])->nValue.PutDouble( F_PI );
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ 3 ] ])->nValue.PutDouble( 2.7182818284590452354 );
+/*N*/
+/*N*/ for( n = 0; n < 3; ++n )
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ n + 4 ] ])->nValue.PutLong( rDocStat.*aDocStat1[ n ] );
+/*N*/ for( n = 0; n < 4; ++n )
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ n + 7 ] ])->nValue.PutLong( rDocStat.*aDocStat2[ n ] );
+/*N*/
+/*N*/ SvxAddressItem aAdr;
+/*N*/
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ 11 ] ])->nValue.PutString( aAdr.GetFirstName() );
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ 12 ] ])->nValue.PutString( aAdr.GetName() );
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ 13 ] ])->nValue.PutString( aAdr.GetShortName() );
+/*N*/
+/*N*/ for( n = 0; n < 11; ++n )
+/*N*/ ((SwCalcExp*)VarTable[ aHashValue[ n + 14 ] ])->nValue.PutString(
+/*N*/ aAdr.GetToken( aAdrToken[ n ] ));
+/*N*/
+/*N*/ nVal.PutString( aAdr.GetToken( aAdrToken[ 11 ] ));
+/*N*/ sTmpStr.AssignAscii( sNTypeTab[ 25 ] );
+/*N*/ VarTable[ aHashValue[ 25 ] ]->pNext = new SwCalcExp( sTmpStr, nVal, 0 );
+/*N*/
+/*N*/ // at time its better not to use "graph", because then the im-/export have
+/*N*/ // to change in all formulas this name.
+/*N*/ // nVal.PutLong( rDocStat.*aDocStat1[ 1 ] );
+/*N*/ // VarTable[ aHashValue[ 26 ] ]->pNext = new SwCalcExp(
+/*N*/ // sNTypeTab[ 26 ], nVal, 0 );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwCalc::~SwCalc()
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+/*N*/ SwCalc::~SwCalc()
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < TBLSZ; ++n )
+/*N*/ delete VarTable[n];
+/*N*/ if( pLclData != &GetAppLocaleData() )
+/*N*/ delete pLclData;
+/*N*/ if( pCharClass != &GetAppCharClass() )
+/*N*/ delete pCharClass;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Calculate( const String& rStr )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung OK 12-02-93 11:04am
+|*
+|******************************************************************************/
+
+/*N*/ SwSbxValue SwCalc::Calculate( const String& rStr )
+/*N*/ {
+/*N*/ eError = CALC_NOERR;
+/*N*/ SwSbxValue nResult;
+/*N*/
+/*N*/ if( !rStr.Len() )
+/*N*/ return nResult;
+/*N*/
+/*N*/ nListPor = 0;
+/*N*/ eCurrListOper = CALC_PLUS; // defaulten auf Summe
+/*N*/
+/*N*/ sCommand = rStr;
+/*N*/ nCommandPos = 0;
+/*N*/
+/*N*/ while( (eCurrOper = GetToken()) != CALC_ENDCALC && eError == CALC_NOERR )
+/*N*/ nResult = Expr();
+/*N*/
+/*N*/ if( eError )
+/*?*/ nResult.PutDouble( DBL_MAX );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ SbxDataType eResDType = nResult.GetType();
+/*N*/ const String& rResStr = nResult.GetString();
+/*N*/ #endif
+/*N*/ return nResult;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* 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
+|*
+|******************************************************************************/
+
+
+
+/*N*/ String SwCalc::GetStrResult( double nValue, BOOL bRound )
+/*N*/ {
+/*N*/ if( nValue >= DBL_MAX )
+/*N*/ switch( eError )
+/*N*/ {
+/*?*/ 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;
+/*N*/ }
+/*N*/
+/*N*/ USHORT nDec = 15; //pLclData->getNumDigits();
+/*N*/ String aRetStr( ::rtl::math::doubleToUString( nValue,
+/*N*/ rtl_math_StringFormat_Automatic,
+/*N*/ nDec,
+/*N*/ pLclData->getNumDecimalSep().GetChar(0),
+/*N*/ true ));
+/*N*/
+/*N*/ return aRetStr;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwCalcExp* SwCalc::VarLook( const String& )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 15.11.99
+|*
+|******************************************************************************/
+
+/*N*/ SwCalcExp* SwCalc::VarInsert( const String &rStr )
+/*N*/ {
+/*N*/ String aStr( rStr );
+/*N*/ pCharClass->toLower( aStr );
+/*N*/ return VarLook( aStr, 1 );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwCalcExp* SwCalc::VarLook( const String& , USHORT ins )
+|*
+|* Erstellung OK 12-02-93 11:04am
+|* Letzte Aenderung JP 15.11.99
+|*
+|******************************************************************************/
+/*N*/ SwCalcExp* SwCalc::VarLook( const String& rStr, USHORT ins )
+/*N*/ {
+/*N*/ USHORT ii = 0;
+/*N*/ String aStr( rStr );
+/*N*/ pCharClass->toLower( aStr );
+/*N*/
+/*N*/ SwHash* pFnd = Find( aStr, VarTable, TBLSZ, &ii );
+/*N*/
+/*N*/ if( !pFnd )
+/*N*/ {
+/*N*/ // dann sehen wir mal im Doc nach:
+/*N*/ SwHash** ppDocTbl = rDoc.GetUpdtFlds().GetFldTypeTable();
+/*N*/ for( SwHash* pEntry = *(ppDocTbl+ii); pEntry; pEntry = pEntry->pNext )
+/*N*/ if( aStr == pEntry->aStr )
+/*N*/ {
+/*N*/ // dann hier zufuegen
+/*N*/ pFnd = new SwCalcExp( aStr, SwSbxValue(),
+/*N*/ ((SwCalcFldType*)pEntry)->pFldType );
+/*N*/ pFnd->pNext = *(VarTable+ii);
+/*N*/ *(VarTable+ii) = pFnd;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pFnd )
+/*N*/ {
+/*N*/ SwCalcExp* pFndExp = (SwCalcExp*)pFnd;
+/*N*/
+/*N*/ if( pFndExp->pFldType && pFndExp->pFldType->Which() == RES_USERFLD )
+/*N*/ {
+/*N*/ SwUserFieldType* pUFld = (SwUserFieldType*)pFndExp->pFldType;
+/*N*/ if( GSE_STRING & pUFld->GetType() )
+/*N*/ pFndExp->nValue.PutString( pUFld->GetContent() );
+/*N*/ else if( !pUFld->IsValid() )
+/*N*/ {
+/*N*/ // Die aktuellen Werte sichern . . .
+/*N*/ USHORT nOld_ListPor = nListPor;
+/*N*/ SwSbxValue nOld_LastLeft = nLastLeft;
+/*N*/ SwSbxValue nOld_NumberValue = nNumberValue;
+/*N*/ xub_StrLen nOld_CommandPos = nCommandPos;
+/*N*/ SwCalcOper eOld_CurrOper = eCurrOper;
+/*N*/ SwCalcOper eOld_CurrListOper = eCurrListOper;
+/*N*/
+/*N*/ pFndExp->nValue.PutDouble( pUFld->GetValue( *this ) );
+/*N*/
+/*N*/ // . . . und zurueck damit.
+/*N*/ nListPor = nOld_ListPor;
+/*N*/ nLastLeft = nOld_LastLeft;
+/*N*/ nNumberValue = nOld_NumberValue;
+/*N*/ nCommandPos = nOld_CommandPos;
+/*N*/ eCurrOper = eOld_CurrOper;
+/*N*/ eCurrListOper = eOld_CurrListOper;
+/*N*/ }
+/*N*/ else
+/*N*/ pFndExp->nValue.PutDouble( pUFld->GetValue() );
+/*N*/ }
+/*N*/ return pFndExp;
+/*N*/ }
+/*N*/
+/*N*/ // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
+/*N*/ // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
+/*N*/ // #101436#: At this point the "real" case variable has to be used
+/*N*/ String sTmpName( rStr );
+/*N*/ ::binfilter::ReplacePoint( sTmpName );
+/*N*/
+/*N*/ if( !ins )
+/*N*/ {
+/*N*/ SwNewDBMgr *pMgr = rDoc.GetNewDBMgr();
+/*N*/
+/*N*/ // Name(p)=Adress.PLZ oder Adress.DATENSATZNUMMER
+/*N*/ // DBSETNUMBERFLD = DatenSATZ-nummernfeld (NICHT "setze Datensatznummer!!!")
+/*N*/ String sDBName(GetDBName( sTmpName ));
+/*N*/ String sSourceName(sDBName.GetToken(0, DB_DELIM));
+/*N*/ String sTableName(sDBName.GetToken(0).GetToken(1, DB_DELIM));
+/*N*/ if( pMgr && sSourceName.Len() && sTableName.Len() &&
+/*N*/ pMgr->OpenDataSource(sSourceName, sTableName))
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ // auf keinen fall eintragen!!
+/*N*/ return &aErrExpr;
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ SwCalcExp* pNewExp = new SwCalcExp( aStr, SwSbxValue(), 0 );
+/*N*/ pNewExp->pNext = VarTable[ ii ];
+/*N*/ VarTable[ ii ] = pNewExp;
+/*N*/
+/*N*/ String sColumnName( GetColumnName( sTmpName ));
+/*N*/ ASSERT( sColumnName.Len(), "DB-Spaltenname fehlt!" );
+/*N*/ if( sColumnName.EqualsIgnoreCaseAscii(
+/*N*/ SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) ))
+/*N*/ {
+/*?*/ SwNewDBMgr *pMgr = rDoc.GetNewDBMgr();
+/*?*/ 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));
+/*N*/ }
+/*N*/
+/*N*/ return pNewExp;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* 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
+|*
+|******************************************************************************/
+
+/*N*/ BOOL SwCalc::Push( const VoidPtr pPtr )
+/*N*/ {
+/*N*/ if( USHRT_MAX != aRekurStk.GetPos( pPtr ) )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ aRekurStk.Insert( pPtr, aRekurStk.Count() );
+/*N*/ return TRUE;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* void SwCalc::Pop( const void* pPtr )
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung OK 12-02-93 11:05am
+|*
+|******************************************************************************/
+
+/*N*/ void SwCalc::Pop( const VoidPtr pPtr )
+/*N*/ {
+/*N*/ ASSERT( aRekurStk.Count() && aRekurStk.GetPos( pPtr ) ==
+/*N*/ (aRekurStk.Count() - 1 ), "SwCalc: Pop auf ungueltigen Ptr" );
+/*N*/
+/*N*/ aRekurStk.Remove( aRekurStk.Count() - 1 );
+/*N*/ }
+
+
+/******************************************************************************
+|*
+|* SwCalcOper SwCalc::GetToken()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+/*M*/ SwCalcOper SwCalc::GetToken()
+/*M*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ //JP 25.01.2001: static for switch back to the "old" implementation of the
+/*M*/ // calculator, which don't use the I18N routines.
+/*M*/ static int nUseOld = 0;
+/*M*/ if( !nUseOld )
+/*M*/ {
+/*M*/ #endif
+/*M*/
+/*M*/ if( nCommandPos >= sCommand.Len() )
+/*M*/ return eCurrOper = CALC_ENDCALC;
+/*M*/
+/*M*/ using namespace ::com::sun::star::i18n;
+/*M*/ {
+/*M*/ // Parse any token.
+/*M*/ ParseResult aRes = pCharClass->parseAnyToken( sCommand, nCommandPos,
+/*M*/ coStartFlags, aEmptyStr,
+/*M*/ coContFlags, aEmptyStr );
+/*M*/
+/*M*/ BOOL bSetError = TRUE;
+/*M*/ xub_StrLen nRealStt = nCommandPos + (xub_StrLen)aRes.LeadingWhiteSpace;
+/*M*/ if( aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER) )
+/*M*/ {
+/*M*/ nNumberValue.PutDouble( aRes.Value );
+/*M*/ eCurrOper = CALC_NUMBER;
+/*M*/ bSetError = FALSE;
+/*M*/ }
+/*M*/ else if( aRes.TokenType & KParseType::IDENTNAME )
+/*M*/ {
+/*M*/ String aName( sCommand.Copy( nRealStt, aRes.EndPos - nRealStt ));
+/*M*/ //#101436#: the variable may contain a database name it must not be converted to lower case
+/*M*/ // instead all further comparisons must be done case-insensitive
+/*M*/ //pCharClass->toLower( aName );
+/*M*/ String sLowerCaseName(aName);
+/*M*/ pCharClass->toLower( sLowerCaseName );
+/*M*/ // Currency-Symbol abfangen
+/*M*/ if( sLowerCaseName == sCurrSym )
+/*M*/ {
+/*M*/ nCommandPos = (xub_StrLen)aRes.EndPos;
+/*M*/ return GetToken(); // also nochmal aufrufen
+/*M*/ }
+/*M*/
+/*M*/ // Operations abfangen
+/*M*/ _CalcOp* pFnd = ::binfilter::FindOperator( sLowerCaseName );
+/*M*/ if( pFnd )
+/*M*/ {
+/*M*/ switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
+/*M*/ {
+/*M*/ case CALC_SUM :
+/*M*/ case CALC_MEAN : eCurrListOper = CALC_PLUS; break;
+/*M*/ case CALC_MIN : eCurrListOper = CALC_MIN_IN; break;
+/*M*/ case CALC_MAX : eCurrListOper = CALC_MAX_IN; break;
+/*M*/ }
+/*M*/ nCommandPos = (xub_StrLen)aRes.EndPos;
+/*M*/ return eCurrOper;
+/*M*/ }
+/*M*/ aVarName = aName;
+/*M*/ eCurrOper = CALC_NAME;
+/*M*/ bSetError = FALSE;
+/*M*/ }
+/*M*/ else if ( aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING )
+/*M*/ {
+/*M*/ nNumberValue.PutString( String( aRes.DequotedNameOrString ));
+/*M*/ eCurrOper = CALC_NUMBER;
+/*M*/ bSetError = FALSE;
+/*M*/ }
+/*M*/ else if( aRes.TokenType & KParseType::ONE_SINGLE_CHAR )
+/*M*/ {
+/*M*/ String aName( sCommand.Copy( nRealStt, aRes.EndPos - nRealStt ));
+/*M*/ if( 1 == aName.Len() )
+/*M*/ {
+/*M*/ bSetError = FALSE;
+/*M*/ sal_Unicode ch = aName.GetChar( 0 );
+/*M*/ switch( ch )
+/*M*/ {
+/*M*/ case ';':
+/*M*/ case '\n':
+/*M*/ eCurrOper = CALC_PRINT;
+/*M*/ break;
+/*M*/ case '%':
+/*M*/ case '^':
+/*M*/ case '*':
+/*M*/ case '/':
+/*M*/ case '+':
+/*M*/ case '-':
+/*M*/ case '(':
+/*M*/ case ')': eCurrOper = SwCalcOper(ch);
+/*M*/ break;
+/*M*/
+/*M*/ case '=':
+/*M*/ case '!':
+/*M*/ {
+/*M*/ SwCalcOper eTmp2;
+/*M*/ if( '=' == ch )
+/*M*/ eCurrOper = SwCalcOper('='), eTmp2 = CALC_EQ;
+/*M*/ else
+/*M*/ eCurrOper = CALC_NOT, eTmp2 = CALC_NEQ;
+/*M*/
+/*M*/ if( aRes.EndPos < sCommand.Len() &&
+/*M*/ '=' == sCommand.GetChar( (xub_StrLen)aRes.EndPos ) )
+/*M*/ {
+/*M*/ eCurrOper = eTmp2;
+/*M*/ ++aRes.EndPos;
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case cListDelim :
+/*M*/ eCurrOper = eCurrListOper;
+/*M*/ break;
+/*M*/
+/*M*/ case '[':
+/*M*/ if( aRes.EndPos < sCommand.Len() )
+/*M*/ {
+/*M*/ aVarName.Erase();
+/*M*/ xub_StrLen nFndPos = (xub_StrLen)aRes.EndPos,
+/*M*/ nSttPos = nFndPos;
+/*M*/
+/*M*/ do{
+/*M*/ if( STRING_NOTFOUND != ( nFndPos =
+/*M*/ sCommand.Search( ']', nFndPos )) )
+/*M*/ {
+/*M*/ // ignore the ]
+/*M*/ if( '\\' == sCommand.GetChar(nFndPos-1))
+/*M*/ {
+/*M*/ aVarName += sCommand.Copy( nSttPos,
+/*M*/ nFndPos - nSttPos - 1 );
+/*M*/ nSttPos = ++nFndPos;
+/*M*/ }
+/*M*/ else
+/*M*/ break;
+/*M*/ }
+/*M*/ } while( STRING_NOTFOUND != nFndPos );
+/*M*/
+/*M*/ if( STRING_NOTFOUND != nFndPos )
+/*M*/ {
+/*M*/ if( nSttPos != nFndPos )
+/*M*/ aVarName += sCommand.Copy( nSttPos,
+/*M*/ nFndPos - nSttPos );
+/*M*/ aRes.EndPos = nFndPos + 1;
+/*M*/ eCurrOper = CALC_NAME;
+/*M*/ }
+/*M*/ else
+/*M*/ bSetError = TRUE;
+/*M*/ }
+/*M*/ else
+/*M*/ bSetError = TRUE;
+/*M*/ break;
+/*M*/
+/*M*/ default:
+/*M*/ bSetError = TRUE;
+/*M*/ break;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ else if( aRes.TokenType & KParseType::BOOLEAN )
+/*M*/ {
+/*M*/ String aName( sCommand.Copy( nRealStt, aRes.EndPos - nRealStt ));
+/*M*/ if( aName.Len() )
+/*M*/ {
+/*M*/ bSetError = FALSE;
+/*M*/ sal_Unicode ch = aName.GetChar(0);
+/*M*/ SwCalcOper eTmp2;
+/*M*/ if( '<' == ch )
+/*M*/ eCurrOper = CALC_LES, eTmp2 = CALC_LEQ;
+/*M*/ else if( '>' == ch )
+/*M*/ eCurrOper = CALC_GRE, eTmp2 = CALC_GEQ;
+/*M*/ else
+/*M*/ bSetError = TRUE;
+/*M*/
+/*M*/ if( !bSetError )
+/*M*/ {
+/*M*/ if( 2 == aName.Len() && '=' == aName.GetChar(1) )
+/*M*/ eCurrOper = eTmp2;
+/*M*/ else if( 1 != aName.Len() )
+/*M*/ bSetError = TRUE;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ else if( nRealStt == sCommand.Len() )
+/*M*/ {
+/*M*/ eCurrOper = CALC_ENDCALC;
+/*M*/ bSetError = FALSE;
+/*M*/ }
+/*M*/
+/*M*/ if( bSetError )
+/*M*/ {
+/*M*/ eError = CALC_SYNTAX;
+/*M*/ eCurrOper = CALC_PRINT;
+/*M*/ }
+/*M*/ nCommandPos = (xub_StrLen)aRes.EndPos;
+/*M*/ };
+/*M*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/
+/*M*/ #define NextCh( s, n ) (nCommandPos < sCommand.Len() ? sCommand.GetChar( nCommandPos++ ) : 0)
+/*M*/
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ sal_Unicode ch;
+/*M*/ sal_Unicode cTSep = pLclData->getNumThousandSep().GetChar(0),
+/*M*/ cDSep = pLclData->getNumDecimalSep().GetChar(0);
+/*M*/
+/*M*/ do {
+/*M*/ if( 0 == ( ch = NextCh( sCommand, nCommandPos ) ) )
+/*M*/ return eCurrOper = CALC_ENDCALC;
+/*M*/ } while ( ch == '\t' || ch == ' ' || ch == cTSep );
+/*M*/
+/*M*/ if( ch == cDSep )
+/*M*/ ch = '.';
+/*M*/
+/*M*/ switch( ch )
+/*M*/ {
+/*M*/ case ';':
+/*M*/ case '\n':
+/*M*/ {
+/*M*/ sal_Unicode c;
+/*M*/ while( nCommandPos < sCommand.Len() && ( ( c =
+/*M*/ sCommand.GetChar( nCommandPos ) ) == ' ' ||
+/*M*/ c == '\t' || c == '\x0a' || c == '\x0d' ))
+/*M*/ ++nCommandPos;
+/*M*/ eCurrOper = CALC_PRINT;
+/*M*/ }
+/*M*/ break;
+/*M*/ case '%':
+/*M*/ case '^':
+/*M*/ case '*':
+/*M*/ case '/':
+/*M*/ case '+':
+/*M*/ case '-':
+/*M*/ case '(':
+/*M*/ case ')': eCurrOper = SwCalcOper(ch);
+/*M*/ break;
+/*M*/
+/*M*/ case '=': if( '=' == sCommand.GetChar( nCommandPos ) )
+/*M*/ {
+/*M*/ ++nCommandPos;
+/*M*/ eCurrOper = CALC_EQ;
+/*M*/ }
+/*M*/ else
+/*M*/ eCurrOper = SwCalcOper(ch);
+/*M*/ break;
+/*M*/
+/*M*/ case '!': if( '=' == sCommand.GetChar( nCommandPos ) )
+/*M*/ {
+/*M*/ ++nCommandPos;
+/*M*/ eCurrOper = CALC_NEQ;
+/*M*/ }
+/*M*/ else
+/*M*/ eCurrOper = CALC_NOT;
+/*M*/ break;
+/*M*/
+/*M*/ case '>':
+/*M*/ case '<': eCurrOper = '>' == ch ? CALC_GRE : CALC_LES;
+/*M*/ if( '=' == (ch = sCommand.GetChar( nCommandPos ) ) )
+/*M*/ {
+/*M*/ ++nCommandPos;
+/*M*/ eCurrOper = CALC_GRE == eCurrOper ? CALC_GEQ : CALC_LEQ;
+/*M*/ }
+/*M*/ else if( ' ' != ch )
+/*M*/ {
+/*M*/ eError = CALC_SYNTAX;
+/*M*/ eCurrOper = CALC_PRINT;
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case cListDelim :
+/*M*/ eCurrOper = eCurrListOper;
+/*M*/ break;
+/*M*/
+/*M*/ case '0': case '1': case '2': case '3': case '4':
+/*M*/ case '5': case '6': case '7': case '8': case '9':
+/*M*/ case ',':
+/*M*/ case '.': {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case '[': {
+/*M*/ String aStr;
+/*M*/ BOOL bIgnore = FALSE;
+/*M*/ do {
+/*M*/ while( ( ch = NextCh( sCommand, nCommandPos ))
+/*M*/ && ch != ']' )
+/*M*/ {
+/*M*/ if( !bIgnore && '\\' == ch )
+/*M*/ bIgnore = TRUE;
+/*M*/ else if( bIgnore )
+/*M*/ bIgnore = FALSE;
+/*M*/ aStr += ch;
+/*M*/ }
+/*M*/
+/*M*/ if( !bIgnore )
+/*M*/ break;
+/*M*/
+/*M*/ aStr.SetChar( aStr.Len() - 1, ch );
+/*M*/ } while( ch );
+/*M*/
+/*M*/ aVarName = aStr;
+/*M*/ eCurrOper = CALC_NAME;
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case '"': {
+/*M*/ xub_StrLen nStt = nCommandPos;
+/*M*/ while( ( ch = NextCh( sCommand, nCommandPos ))
+/*M*/ && '"' != ch )
+/*M*/ ;
+/*M*/
+/*M*/ xub_StrLen nLen = nCommandPos - nStt;
+/*M*/ if( '"' == ch )
+/*M*/ --nLen;
+/*M*/ nNumberValue.PutString( sCommand.Copy( nStt, nLen ));
+/*M*/ eCurrOper = CALC_NUMBER;
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ default: if( ch && pCharClass->isLetter( sCommand, nCommandPos - 1)
+/*M*/ || '_' == ch )
+/*M*/ {
+/*M*/ xub_StrLen nStt = nCommandPos-1;
+/*M*/ while( 0 != (ch = NextCh( sCommand, nCommandPos )) &&
+/*M*/ (pCharClass->isLetterNumeric(
+/*M*/ sCommand, nCommandPos - 1) ||
+/*M*/ ch == '_' || ch == '.' ) )
+/*M*/ ;
+/*M*/
+/*M*/ if( ch )
+/*M*/ --nCommandPos;
+/*M*/
+/*M*/ String aStr( sCommand.Copy( nStt, nCommandPos-nStt ));
+/*M*/ pCharClass->toLower( aStr );
+/*M*/
+/*M*/
+/*M*/ // Currency-Symbol abfangen
+/*M*/ if( aStr == sCurrSym )
+/*M*/ return GetToken(); // also nochmal aufrufen
+/*M*/
+/*M*/ // Operations abfangen
+/*M*/ _CalcOp* pFnd = ::binfilter::FindOperator( aStr );
+/*M*/ if( pFnd )
+/*M*/ {
+/*M*/ switch( ( eCurrOper = ((_CalcOp*)pFnd)->eOp ) )
+/*M*/ {
+/*M*/ case CALC_SUM :
+/*M*/ case CALC_MEAN : eCurrListOper = CALC_PLUS;
+/*M*/ break;
+/*M*/ case CALC_MIN : eCurrListOper = CALC_MIN_IN;
+/*M*/ break;
+/*M*/ case CALC_MAX : eCurrListOper = CALC_MAX_IN;
+/*M*/ break;
+/*M*/ }
+/*M*/ return eCurrOper;
+/*M*/ }
+/*M*/ aVarName = aStr;
+/*M*/ eCurrOper = CALC_NAME;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ eError = CALC_SYNTAX;
+/*M*/ eCurrOper = CALC_PRINT;
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ }
+/*M*/ #endif
+/*M*/ return eCurrOper;
+/*M*/ }
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Term()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 16.01.96
+|*
+|******************************************************************************/
+
+/*N*/ SwSbxValue SwCalc::Term()
+/*N*/ {
+/*N*/ SwSbxValue left( Prim() );
+/*N*/ nLastLeft = left;
+/*N*/ for(;;)
+/*N*/ {
+/*N*/ SbxOperator eSbxOper = (SbxOperator)USHRT_MAX;
+/*N*/
+/*N*/ switch( eCurrOper )
+/*N*/ {
+/*N*/ // wir haben kein Bitweises verodern, oder ?
+/*N*/ // case CALC_AND: eSbxOper = SbxAND; break;
+/*N*/ // case CALC_OR: eSbxOper = SbxOR; break;
+/*N*/ // 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;
+/*N*/
+/*N*/ 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;
+/*N*/
+/*
+// removed here because of #77448# (=2*3^2 != 18)
+ 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;
+ */
+/*N*/ default: return left;
+/*N*/ }
+/*N*/
+/*N*/ if( USHRT_MAX != (USHORT)eSbxOper )
+/*N*/ {
+/*N*/ GetToken();
+/*N*/ if( SbxEQ <= eSbxOper && eSbxOper <= SbxGE )
+/*?*/ left.PutBool( left.Compare( eSbxOper, Prim() ));
+/*N*/ else
+/*N*/ {
+/*N*/ SwSbxValue aRight( Prim() );
+/*N*/ aRight.MakeDouble();
+/*N*/ left.MakeDouble();
+/*N*/
+/*N*/ if( SbxDIV == eSbxOper && !aRight.GetDouble() )
+/*N*/ eError = CALC_ZERODIV;
+/*N*/ else
+/*N*/ left.Compute( eSbxOper, aRight );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ left.Clear();
+/*N*/ return left;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Prim()
+|*
+|* Erstellung OK 12-02-93 11:05am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+/*N*/ SwSbxValue SwCalc::Prim()
+/*N*/ {
+/*N*/ SwSbxValue nErg;
+/*N*/
+/*N*/ double (
+/*N*/ #ifdef WNT
+/*N*/ __cdecl
+/*N*/ #endif
+/*N*/
+/*N*/ *pFnc)( double ) = 0;
+/*N*/
+/*N*/ BOOL bChkTrig = FALSE, bChkPow = FALSE;
+/*N*/
+/*N*/ switch( eCurrOper )
+/*N*/ {
+/*?*/ 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;
+/*N*/
+/*N*/ case CALC_NUMBER: if( GetToken() == CALC_PHD )
+/*N*/ {
+/*?*/ double aTmp = nNumberValue.GetDouble();
+/*?*/ aTmp *= 0.01;
+/*?*/ nErg.PutDouble( aTmp );
+/*?*/ GetToken();
+/*N*/ }
+/*N*/ else if( eCurrOper == CALC_NAME )
+/*N*/ eError = CALC_SYNTAX;
+/*N*/ else
+/*N*/ {
+/*N*/ nErg = nNumberValue;
+/*N*/ bChkPow = TRUE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case CALC_NAME: if( GetToken() == CALC_ASSIGN )
+/*N*/ {
+/*N*/ SwCalcExp* n = VarInsert( aVarName );
+/*N*/ GetToken();
+/*N*/ nErg = n->nValue = Expr();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nErg = VarLook( aVarName )->nValue;
+/*N*/ bChkPow = TRUE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*?*/ case CALC_MINUS: GetToken();
+/*?*/ nErg.PutDouble( -(Prim().GetDouble()) );
+/*?*/ break;
+/*N*/
+/*N*/ case CALC_LP: {
+/*N*/ GetToken();
+/*N*/ nErg = Expr();
+/*N*/ if( eCurrOper != CALC_RP )
+/*?*/ eError = CALC_BRACK;
+/*N*/ else
+/*N*/ {
+/*N*/ GetToken();
+/*N*/ bChkPow = TRUE; // in order for =(7)^2 to work
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case CALC_MEAN: {
+/*?*/ nListPor = 1;
+/*?*/ GetToken();
+/*?*/ nErg = Expr();
+/*?*/ double aTmp = nErg.GetDouble();
+/*?*/ aTmp /= nListPor;
+/*?*/ nErg.PutDouble( aTmp );
+/*?*/ }
+/*?*/ break;
+/*N*/
+/*?*/ case CALC_SQRT: {
+/*?*/ GetToken();
+/*?*/ nErg = Prim();
+/*?*/ if( nErg.GetDouble() < 0 )
+/*?*/ eError = CALC_OVERFLOW;
+/*?*/ else
+/*?*/ nErg.PutDouble( sqrt( nErg.GetDouble() ));
+/*?*/ }
+/*?*/ break;
+/*N*/
+/*N*/ case CALC_SUM:
+/*N*/ case CALC_MIN:
+/*N*/ case CALC_MAX: GetToken();
+/*N*/ nErg = Expr();
+/*N*/ break;
+/*N*/
+/*?*/ case CALC_ENDCALC: nErg.Clear();
+/*?*/ break;
+/*N*/
+/*N*/ default: eError = CALC_SYNTAX;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pFnc )
+/*N*/ {
+/*?*/ GetToken();
+/*?*/ double nVal = Prim().GetDouble();
+/*?*/ if( !bChkTrig || ( nVal > -1 && nVal < 1 ) )
+/*?*/ nErg.PutDouble( (*pFnc)( nVal ) );
+/*?*/ else
+/*?*/ eError = CALC_OVERFLOW;
+/*N*/ }
+
+ // added here because of #77448# (=2*3^2 should be 18)
+/*N*/ if( bChkPow && eCurrOper == CALC_POW )
+/*N*/ {
+/*?*/ 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();
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ return nErg;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwSbxValue SwCalc::Expr()
+|*
+|* Erstellung OK 12-02-93 11:06am
+|* Letzte Aenderung JP 03.11.95
+|*
+|******************************************************************************/
+
+/*N*/ SwSbxValue SwCalc::Expr()
+/*N*/ {
+/*N*/ SwSbxValue left = Term(), right;
+/*N*/ nLastLeft = left;
+/*N*/ for(;;)
+/*N*/ switch(eCurrOper)
+/*N*/ {
+/*N*/ case CALC_PLUS: GetToken();
+/*N*/ // erzeuge zum addieren auf jedenfall einen
+/*N*/ // Double-Wert
+/*N*/ left.MakeDouble();
+/*N*/ ( right = Term() ).MakeDouble();
+/*N*/ left.Compute( SbxPLUS, right );
+/*N*/ nListPor++;
+/*N*/ break;
+/*N*/
+/*?*/ case CALC_MINUS: GetToken();
+/*?*/ // erzeuge zum addieren auf jedenfall einen
+/*?*/ // Double-Wert
+/*?*/ left.MakeDouble();
+/*?*/ ( right = Term() ).MakeDouble();
+/*?*/ left.Compute( SbxMINUS, right );
+/*?*/ break;
+/*N*/
+/*N*/ default: return left;
+/*N*/ }
+/*N*/ left.Clear();
+/*N*/ return left;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwCalc::GetColumnName(const String& rName)
+/*N*/ {
+/*N*/ xub_StrLen nPos = rName.Search(DB_DELIM);
+/*N*/ if( STRING_NOTFOUND != nPos )
+/*N*/ {
+/*?*/ nPos = rName.Search(DB_DELIM, nPos + 1);
+/*?*/
+/*?*/ if( STRING_NOTFOUND != nPos )
+/*?*/ return rName.Copy(nPos + 1);
+/*N*/ }
+/*N*/ return rName;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwCalc::GetDBName(const String& rName)
+/*N*/ {
+/*N*/ xub_StrLen nPos = rName.Search(DB_DELIM);
+/*N*/ if( STRING_NOTFOUND != nPos )
+/*N*/ {
+/*?*/ nPos = rName.Search(DB_DELIM, nPos + 1);
+/*?*/
+/*?*/ if( STRING_NOTFOUND != nPos )
+/*?*/ return rName.Copy( 0, nPos );
+/*N*/ }
+/*N*/ SwDBData aData = rDoc.GetDBData();
+/*N*/ String sRet = aData.sDataSource;
+/*N*/ sRet += DB_DELIM;
+/*N*/ sRet += String(aData.sCommand);
+/*N*/ return sRet;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/******************************************************************************
+ * Methode : FASTBOOL SwCalc::Str2Double( double& )
+ * Beschreibung:
+ * Erstellt : OK 07.06.94 12:56
+ * Aenderung : JP 27.10.98
+ ******************************************************************************/
+/*N*/ FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+/*N*/ double& rVal, const LocaleDataWrapper* pLclData )
+/*N*/ {
+/*N*/ const LocaleDataWrapper* pLclD = pLclData;
+/*N*/ if( !pLclD )
+/*N*/ pLclD = &GetAppLocaleData();
+/*N*/
+/*N*/ const xub_Unicode nCurrCmdPos = rCommandPos;
+/*N*/ rtl_math_ConversionStatus eStatus;
+/*N*/ const sal_Unicode* pEnd;
+/*N*/ rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
+/*N*/ rCommand.GetBuffer() + rCommand.Len(),
+/*N*/ pLclD->getNumDecimalSep().GetChar(0),
+/*N*/ pLclD->getNumThousandSep().GetChar(0),
+/*N*/ &eStatus, &pEnd );
+/*N*/ rCommandPos = pEnd - rCommand.GetBuffer();
+/*N*/
+/*N*/ if( !pLclData && pLclD != &GetAppLocaleData() )
+/*N*/ delete (LocaleDataWrapper*)pLclD;
+/*N*/
+/*N*/ return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
+/*N*/ }
+
+/*N*/ FASTBOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+/*N*/ double& rVal, SwDoc* pDoc )
+/*N*/ {
+/*N*/ const LocaleDataWrapper* pLclD = &GetAppLocaleData();
+/*N*/ if( pDoc )
+/*N*/ {
+/*N*/
+/*N*/ LanguageType eLang = GetDocAppScriptLang( *pDoc );
+/*N*/ if( eLang != SvxLocaleToLanguage( pLclD->getLocale() ) )
+/*N*/ pLclD = new LocaleDataWrapper(
+/*N*/ ::legacy_binfilters::getLegacyProcessServiceFactory(), //STRIP002 ::comphelper::getProcessServiceFactory(),
+/*N*/ SvxCreateLocale( eLang ) );
+/*N*/ }
+/*N*/
+/*N*/ const xub_Unicode nCurrCmdPos = rCommandPos;
+/*N*/ rtl_math_ConversionStatus eStatus;
+/*N*/ const sal_Unicode* pEnd;
+/*N*/ rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
+/*N*/ rCommand.GetBuffer() + rCommand.Len(),
+/*N*/ pLclD->getNumDecimalSep().GetChar(0),
+/*N*/ pLclD->getNumThousandSep().GetChar(0),
+/*N*/ &eStatus, &pEnd );
+/*N*/ rCommandPos = pEnd - rCommand.GetBuffer();
+/*N*/
+/*N*/ if( pLclD != &GetAppLocaleData() )
+/*N*/ delete (LocaleDataWrapper*)pLclD;
+/*N*/
+/*N*/ return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+/******************************************************************************
+|*
+|* CTOR DTOR der SwHash classes
+|*
+|* Ersterstellung OK 25.06.93 12:20
+|* Letzte Aenderung OK 25.06.93 12:20
+|*
+******************************************************************************/
+
+/*N*/ SwHash::SwHash( const String& rStr ) :
+/*N*/ aStr( rStr ),
+/*N*/ pNext( 0 )
+/*N*/ {}
+
+/*N*/ SwHash::~SwHash()
+/*N*/ {
+/*N*/ if( pNext )
+/*N*/ delete pNext;
+/*N*/ }
+
+/*N*/ void DeleteHashTable( SwHash **ppHashTable, USHORT nCount )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < nCount; ++i )
+/*N*/ delete *(ppHashTable+i);
+/*N*/ delete [] ppHashTable;
+/*N*/ }
+
+/*N*/ SwCalcExp::SwCalcExp( const String& rStr, const SwSbxValue& rVal,
+/*N*/ const SwFieldType* pType )
+/*N*/ : SwHash( rStr ),
+/*N*/ nValue( rVal ),
+/*N*/ pFldType( pType )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwSbxValue::~SwSbxValue()
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ double SwSbxValue::GetDouble() const
+/*N*/ {
+/*N*/ double nRet;
+/*N*/ if( SbxSTRING == GetType() )
+/*N*/ {
+/*?*/ xub_StrLen nStt = 0;
+/*?*/ SwCalc::Str2Double( GetString(), nStt, nRet );
+/*N*/ }
+/*N*/ else if (IsBool())
+/*N*/ {
+/*N*/ nRet = 0 != GetBool() ? 1.0 : 0.0;
+/*N*/ }
+/*N*/ else
+/*N*/ nRet = SbxValue::GetDouble();
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ SwSbxValue& SwSbxValue::MakeDouble()
+/*N*/ {
+/*N*/ if( SbxSTRING == GetType() )
+/*?*/ PutDouble( GetDouble() );
+/*N*/ return *this;
+/*N*/ }
+
+#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
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_checkit.cxx b/binfilter/bf_sw/source/core/bastyp/sw_checkit.cxx
new file mode 100644
index 000000000000..17ea10057011
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_checkit.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <checkit.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+namespace binfilter {
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+
+SwCheckIt::SwCheckIt()
+{
+ Reference< XMultiServiceFactory > xMSF = ::legacy_binfilters::getLegacyProcessServiceFactory();
+ Reference < XInterface > xI = xMSF->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.i18n.InputSequenceChecker" ) );
+ if ( xI.is() )
+ {
+ Any x = xI->queryInterface( ::getCppuType((const Reference< XInputSequenceChecker >*)0) );
+ x >>= xCheck;
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_index.cxx b/binfilter/bf_sw/source/core/bastyp/sw_index.cxx
new file mode 100644
index 000000000000..81d1276ded76
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_index.cxx
@@ -0,0 +1,600 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdlib.h> // fuer qsort
+
+#include <tools/solar.h>
+
+#include "errhdl.hxx" // fuers ASSERT
+#include "index.hxx"
+#include "error.h" // fuers ASSERT
+
+#include <tools/string.hxx>
+
+namespace binfilter {
+
+#ifdef DBG_UTIL
+int SwIndex::nSerial = 0;
+#endif
+
+
+/*N*/ TYPEINIT0(SwIndexReg); // rtti
+
+
+#ifdef CHK
+
+#define IDX_CHK_ARRAY pArray->ChhkArr();
+#define ARR_CHK_ARRAY ChhkArr();
+
+
+
+#else // CHK
+
+#define IDX_CHK_ARRAY
+#define ARR_CHK_ARRAY
+
+#endif // CHK
+
+
+
+/*N*/ SwIndex::SwIndex( SwIndexReg* pArr, xub_StrLen nIdx )
+/*N*/ : pArray( pArr ), nIndex( nIdx ), pNext( 0 ), pPrev( 0 )
+/*N*/ {
+/*N*/ if( !pArray )
+/*N*/ {
+/*N*/ pArray = SwIndexReg::pEmptyIndexArray;
+/*N*/ nIndex = 0; // steht immer auf 0 !!!
+/*N*/ }
+/*N*/
+/*N*/ if( !pArray->pFirst ) // 1. Index ??
+/*N*/ pArray->pFirst = pArray->pLast = this;
+/*N*/ else if( pArray->pMiddle )
+/*N*/ {
+/*N*/ if( pArray->pMiddle->nIndex <= nIdx )
+/*N*/ {
+/*N*/ if( nIdx > ((pArray->pLast->nIndex - pArray->pMiddle->nIndex) / 2) )
+/*N*/ ChgValue( *pArray->pLast, nIdx );
+/*N*/ else
+/*N*/ ChgValue( *pArray->pMiddle, nIdx );
+/*N*/ }
+/*N*/ else if( nIdx > ((pArray->pMiddle->nIndex - pArray->pFirst->nIndex) / 2) )
+/*N*/ ChgValue( *pArray->pMiddle, nIdx );
+/*N*/ else
+/*N*/ ChgValue( *pArray->pFirst, nIdx );
+/*N*/ }
+/*N*/ else if( nIdx > ((pArray->pLast->nIndex - pArray->pFirst->nIndex) / 2) )
+/*N*/ ChgValue( *pArray->pLast, nIdx );
+/*N*/ else
+/*N*/ ChgValue( *pArray->pFirst, nIdx );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+/*N*/ #endif
+/*N*/ IDX_CHK_ARRAY
+/*N*/ }
+
+
+
+
+/*N*/ SwIndex::SwIndex( const SwIndex& rIdx )
+/*N*/ : pArray( rIdx.pArray ), nIndex( rIdx.nIndex ), pNext( 0 ), pPrev( 0 )
+/*N*/ {
+/*N*/ ChgValue( rIdx, rIdx.nIndex );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+/*N*/ #endif
+/*N*/ IDX_CHK_ARRAY
+/*N*/ }
+
+
+/*N*/ SwIndex& SwIndex::ChgValue( const SwIndex& rIdx, xub_StrLen nNewValue )
+/*N*/ {
+/*N*/ register SwIndex* pFnd = (SwIndex*)&rIdx;
+/*N*/ if( rIdx.nIndex > nNewValue ) // nach vorne versuchen
+/*N*/ {
+/*N*/ register SwIndex* pPrv;
+/*N*/ while( 0 != ( pPrv = pFnd->pPrev ) && pPrv->nIndex > nNewValue )
+/*N*/ pFnd = pPrv;
+/*N*/
+/*N*/ if( pFnd != this )
+/*N*/ {
+/*N*/ // an alter Position ausketten
+/*N*/ // erstmal an alter Position ausketten
+/*N*/ if( pPrev )
+/*N*/ pPrev->pNext = pNext;
+/*N*/ else if( pArray->pFirst == this )
+/*?*/ pArray->pFirst = pNext;
+/*N*/
+/*N*/ if( pNext )
+/*N*/ pNext->pPrev = pPrev;
+/*N*/ else if( pArray->pLast == this )
+/*N*/ pArray->pLast = pPrev;
+/*N*/
+/*N*/ pNext = pFnd;
+/*N*/ pPrev = pFnd->pPrev;
+/*N*/ if( pPrev )
+/*N*/ pPrev->pNext = this;
+/*N*/ else
+/*N*/ pArray->pFirst = this;
+/*N*/ pFnd->pPrev = this;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( rIdx.nIndex < nNewValue )
+/*N*/ {
+/*N*/ register SwIndex* pNxt;
+/*N*/ while( 0 != ( pNxt = pFnd->pNext ) && pNxt->nIndex < nNewValue )
+/*N*/ pFnd = pNxt;
+/*N*/
+/*N*/ if( pFnd != this )
+/*N*/ {
+/*N*/ // erstmal an alter Position ausketten
+/*N*/ if( pPrev )
+/*N*/ pPrev->pNext = pNext;
+/*N*/ else if( pArray->pFirst == this )
+/*N*/ pArray->pFirst = pNext;
+/*N*/
+/*N*/ if( pNext )
+/*N*/ pNext->pPrev = pPrev;
+/*N*/ else if( pArray->pLast == this )
+/*?*/ pArray->pLast = pPrev;
+/*N*/
+/*N*/ pPrev = pFnd;
+/*N*/ pNext = pFnd->pNext;
+/*N*/ if( pNext )
+/*N*/ pNext->pPrev = this;
+/*N*/ else
+/*N*/ pArray->pLast = this;
+/*N*/ pFnd->pNext = this;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pFnd != this )
+/*N*/ {
+/*N*/ // erstmal an alter Position ausketten
+/*N*/ if( pPrev )
+/*N*/ pPrev->pNext = pNext;
+/*N*/ else if( pArray->pFirst == this )
+/*N*/ pArray->pFirst = pNext;
+/*N*/
+/*N*/ if( pNext )
+/*N*/ pNext->pPrev = pPrev;
+/*N*/ else if( pArray->pLast == this )
+/*N*/ pArray->pLast = pPrev;
+/*N*/
+/*N*/ pPrev = (SwIndex*)&rIdx;
+/*N*/ pNext = rIdx.pNext;
+/*N*/ pPrev->pNext = this;
+/*N*/
+/*N*/ if( !pNext ) // im IndexArray als letzes
+/*N*/ pArray->pLast = this;
+/*N*/ else
+/*N*/ pNext->pPrev = this;
+/*N*/ }
+/*N*/ pArray = rIdx.pArray;
+/*N*/
+/*N*/ if( pArray->pFirst == pNext )
+/*?*/ pArray->pFirst = this;
+/*N*/ if( pArray->pLast == pPrev )
+/*?*/ pArray->pLast = this;
+/*N*/
+/*N*/ nIndex = nNewValue;
+/*N*/
+/*N*/ IDX_CHK_ARRAY
+/*N*/
+/*N*/ return *this; }
+
+
+/*N*/ void SwIndex::Remove()
+/*N*/ {
+/*N*/ if( !pPrev )
+/*N*/ pArray->pFirst = pNext;
+/*N*/ else
+/*N*/ pPrev->pNext = pNext;
+/*N*/
+/*N*/ if( !pNext )
+/*N*/ pArray->pLast = pPrev;
+/*N*/ else
+/*N*/ pNext->pPrev = pPrev;
+/*N*/
+/*N*/ if( this == pArray->pMiddle ) pArray->pMiddle = pPrev;
+/*N*/ IDX_CHK_ARRAY
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwIndex & SwIndex::operator=( const SwIndex & aSwIndex )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+/*N*/ SwIndex& SwIndex::operator=( const SwIndex& rIdx )
+/*N*/ {
+/*N*/ int bEqual;
+/*N*/ if( rIdx.pArray != pArray ) // im alten abmelden !!
+/*N*/ {
+/*N*/ Remove();
+/*N*/ pArray = rIdx.pArray;
+/*N*/ pNext = pPrev = 0;
+/*N*/ bEqual = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ bEqual = rIdx.nIndex == nIndex;
+/*N*/
+/*N*/ if( !bEqual )
+/*N*/ ChgValue( rIdx, rIdx.nIndex );
+/*N*/ return *this;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwIndex &SwIndex::Assign
+|*
+|* Beschreibung
+|* Ersterstellung VB 25.03.91
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+/*N*/ SwIndex& SwIndex::Assign( SwIndexReg* pArr, xub_StrLen nIdx )
+/*N*/ {
+/*N*/ if( !pArr )
+/*N*/ {
+/*N*/ pArr = SwIndexReg::pEmptyIndexArray;
+/*N*/ nIdx = 0; // steht immer auf 0 !!!
+/*N*/ }
+/*N*/
+/*N*/ if( pArr != pArray ) // im alten abmelden !!
+/*N*/ {
+/*N*/ Remove();
+/*N*/ pArray = pArr;
+/*N*/ pNext = pPrev = 0;
+/*N*/ if( !pArr->pFirst ) // 1. Index ??
+/*N*/ {
+/*N*/ pArr->pFirst = pArr->pLast = this;
+/*N*/ nIndex = nIdx;
+/*N*/ }
+/*N*/ else if( pArray->pMiddle )
+/*N*/ {
+/*?*/ 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 );
+/*N*/ }
+/*N*/ else if( nIdx > ((pArr->pLast->nIndex - pArr->pFirst->nIndex) / 2) )
+/*N*/ ChgValue( *pArr->pLast, nIdx );
+/*N*/ else
+/*N*/ ChgValue( *pArr->pFirst, nIdx );
+/*N*/ }
+/*N*/ else if( nIndex != nIdx )
+/*N*/ ChgValue( *this, nIdx );
+/*N*/ IDX_CHK_ARRAY
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ SwIndexReg::SwIndexReg()
+/*N*/ : pFirst( 0 ), pLast( 0 ), pMiddle( 0 )
+/*N*/ {
+/*N*/ }
+
+#ifdef DBG_UTIL
+
+
+/*N*/ SwIndexReg::~SwIndexReg()
+/*N*/ {
+/*N*/ ASSERT( !pFirst || !pLast, "Es sind noch Indizies angemeldet" );
+/*N*/ }
+
+#endif
+
+
+/*N*/ void SwIndexReg::Update( const SwIndex& rIdx, xub_StrLen nDiff, BOOL bNeg )
+/*N*/ {
+/*N*/ register SwIndex* pStt = (SwIndex*)&rIdx;
+/*N*/ register xub_StrLen nNewVal = rIdx.nIndex;
+/*N*/ if( bNeg )
+/*N*/ {
+/*N*/ register xub_StrLen nLast = rIdx.GetIndex() + nDiff;
+/*N*/ while( pStt && pStt->nIndex == nNewVal )
+/*N*/ {
+/*N*/ pStt->nIndex = nNewVal;
+/*N*/ pStt = pStt->pPrev;
+/*N*/ }
+/*N*/ pStt = rIdx.pNext;
+/*N*/ while( pStt && pStt->nIndex >= nNewVal &&
+/*N*/ pStt->nIndex <= nLast )
+/*N*/ {
+/*N*/ pStt->nIndex = nNewVal;
+/*N*/ pStt = pStt->pNext;
+/*N*/ }
+/*N*/ while( pStt )
+/*N*/ {
+/*?*/ pStt->nIndex -= nDiff;
+/*?*/ pStt = pStt->pNext;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ while( pStt && pStt->nIndex == nNewVal )
+/*N*/ {
+/*N*/ pStt->nIndex += nDiff;
+/*N*/ pStt = pStt->pPrev;
+/*N*/ }
+/*N*/ pStt = rIdx.pNext;
+/*N*/ while( pStt )
+/*N*/ {
+/*N*/ pStt->nIndex += nDiff;
+/*N*/ pStt = pStt->pNext;
+/*N*/ }
+/*N*/ }
+/*N*/ ARR_CHK_ARRAY
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator++()
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+#ifdef DBG_UTIL
+
+#ifndef CFRONT
+
+
+xub_StrLen SwIndex::operator++(int) {DBG_BF_ASSERT(0, "STRIP"); return 0;} //STRIP001 INLINE xub_StrLen operator++(int);
+
+#endif
+
+
+xub_StrLen SwIndex::operator++() {DBG_BF_ASSERT(0, "STRIP"); return 0;} //STRIP001 INLINE xub_StrLen operator++(int);
+
+/*************************************************************************
+|*
+|* SwIndex::operator--()
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+#ifndef CFRONT
+
+
+/*N*/ xub_StrLen SwIndex::operator--(int)
+/*N*/ {
+/*N*/ ASSERT_ID( nIndex, ERR_OUTOFSCOPE );
+/*N*/
+/*N*/ xub_StrLen nOldIndex = nIndex;
+/*N*/ ChgValue( *this, nIndex-1 );
+/*N*/ return nOldIndex;
+/*N*/ }
+
+#endif
+
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator+=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+/*N*/ xub_StrLen SwIndex::operator+=( xub_StrLen nWert )
+/*N*/ {
+/*N*/ ASSERT_ID( nIndex < INVALID_INDEX - nWert, ERR_OUTOFSCOPE);
+/*N*/ return ChgValue( *this, nIndex + nWert ).nIndex;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwIndex::operator-=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator+=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+/*N*/ xub_StrLen SwIndex::operator+=( const SwIndex & rIndex )
+/*N*/ {
+/*N*/ ASSERT_ID( nIndex < INVALID_INDEX - rIndex.nIndex, ERR_OUTOFSCOPE );
+/*N*/ return ChgValue( *this, nIndex + rIndex.nIndex ).nIndex;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator-=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+
+
+/*************************************************************************
+|*
+|* SwIndex::operator<( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+
+/*N*/ BOOL SwIndex::operator<( const SwIndex & rIndex ) const
+/*N*/ {
+/*N*/ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+/*N*/ return nIndex < rIndex.nIndex;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwIndex::operator<=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+
+/*N*/ BOOL SwIndex::operator<=( const SwIndex & rIndex ) const
+/*N*/ {
+/*N*/ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+/*N*/ return nIndex <= rIndex.nIndex;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwIndex::operator>( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+
+/*N*/ BOOL SwIndex::operator>( const SwIndex & rIndex ) const
+/*N*/ {
+/*N*/ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+/*N*/ return nIndex > rIndex.nIndex;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwIndex::operator>=( const SwIndex & )
+|*
+|* Beschreibung
+|* Ersterstellung JP 07.11.90
+|* Letzte Aenderung JP 04.06.92
+|*
+*************************************************************************/
+
+
+/*N*/ BOOL SwIndex::operator>=( const SwIndex & rIndex ) const
+/*N*/ {
+/*N*/ ASSERT( pArray == rIndex.pArray, "Attempt to compare indices into different arrays.");
+/*N*/ return nIndex >= rIndex.nIndex;
+/*N*/ }
+
+#endif
+
+/*************************************************************************
+|*
+|* SwIndex & SwIndex::operator=( xub_StrLen )
+|*
+|* Beschreibung
+|* Ersterstellung JP 10.12.90
+|* Letzte Aenderung JP 07.03.94
+|*
+*************************************************************************/
+
+#ifdef DBG_UTIL
+
+
+/*N*/ SwIndex& SwIndex::operator=( xub_StrLen nWert )
+/*N*/ {
+/*N*/ // Werte kopieren und im neuen Array anmelden
+/*N*/ if( nIndex != nWert )
+/*N*/ ChgValue( *this, nWert );
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+#endif
+
+
+
+
+/*N*/ void SwIndexReg::MoveTo( SwIndexReg& rArr )
+/*N*/ {
+/*N*/ if( this != &rArr && pFirst )
+/*N*/ {
+/*N*/ SwIndex* pIdx = (SwIndex*)pFirst, *pNext;
+/*N*/ while( pIdx )
+/*N*/ {
+/*N*/ pNext = pIdx->pNext;
+/*N*/ pIdx->Assign( &rArr, pIdx->GetIndex() );
+/*N*/ pIdx = pNext;
+/*N*/ }
+/*N*/ pFirst = 0, pLast = 0, pMiddle = 0;
+/*N*/ }
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_init.cxx b/binfilter/bf_sw/source/core/bastyp/sw_init.cxx
new file mode 100644
index 000000000000..1efd15ba1dac
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_init.cxx
@@ -0,0 +1,860 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+
+#include <hintids.hxx>
+
+#include <tools/globname.hxx>
+#include <vcl/mapmod.hxx>
+
+#include <bf_svx/xmlcnitm.hxx>
+
+#include <bf_svtools/macitem.hxx>
+#include <bf_svx/pbinitem.hxx>
+#include <bf_svx/keepitem.hxx>
+#include <bf_svx/nlbkitem.hxx>
+#include <bf_svx/hyznitem.hxx>
+#include <bf_svx/protitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/prszitem.hxx>
+#include <bf_svx/opaqitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <bf_svx/prntitem.hxx>
+#include <bf_svx/brkitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/wrlmitem.hxx>
+#include <bf_svx/kernitem.hxx>
+#include <bf_svx/escpitem.hxx>
+#include <bf_svx/cscoitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/orphitem.hxx>
+#include <bf_svx/widwitem.hxx>
+#include <bf_svx/nhypitem.hxx>
+#include <bf_svx/spltitem.hxx>
+#include <bf_svx/lspcitem.hxx>
+#include <bf_svx/blnkitem.hxx>
+#include <bf_svx/akrnitem.hxx>
+#include <bf_svx/emphitem.hxx>
+#include <bf_svx/twolinesitem.hxx>
+#include <bf_svx/scriptspaceitem.hxx>
+#include <bf_svx/hngpnctitem.hxx>
+#include <bf_svx/cmapitem.hxx>
+#include <bf_svx/charscaleitem.hxx>
+#include <bf_svx/charrotateitem.hxx>
+#include <bf_svx/charreliefitem.hxx>
+#include <bf_svx/frmdiritem.hxx>
+#include <bf_svx/dialogs.hrc>
+#include <bf_offmgr/app.hxx>
+#include <bf_svx/forbiddenruleitem.hxx>
+#include <bf_svx/paravertalignitem.hxx>
+#include <bf_svx/pgrditem.hxx>
+
+
+#include <fmthbsh.hxx>
+#include <fmtanchr.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfld.hxx>
+#include <fmtrfmrk.hxx>
+#include <fmtlsplt.hxx>
+#include <fmteiro.hxx>
+#include <fmtclds.hxx>
+#include <fmturl.hxx>
+#include <fmtcntnt.hxx>
+#include <fmthdft.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtftn.hxx>
+#include <fmtfordr.hxx>
+#include <fmtflcnt.hxx>
+#include <fchrfmt.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtcnct.hxx>
+#include <fmtline.hxx>
+#include <fmtftntx.hxx>
+#include <fmtruby.hxx>
+#include <tgrditem.hxx>
+#include <hfspacingitem.hxx>
+#include <editsh.hxx>
+#include <init.hxx>
+#include <paratr.hxx>
+#include <grfatr.hxx>
+#include <tox.hxx>
+#include <cellatr.hxx>
+#include <tblafmt.hxx>
+#include <viscrs.hxx>
+#include <fntcache.hxx>
+#include <doc.hxx>
+#include <acmplwrd.hxx>
+#include <fmtclbl.hxx>
+#include <cmdid.h>
+#include <breakit.hxx>
+#include <checkit.hxx>
+
+#include <swcalwrp.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+namespace binfilter {
+
+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_FRAMEDIR, RES_FRAMEDIR,
+ 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
+ { SID_ATTR_CHAR_CJK_FONT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_FONT
+ { SID_ATTR_CHAR_CJK_FONTHEIGHT, SFX_ITEM_POOLABLE },// RES_CHRATR_CJK_FONTSIZE
+ { SID_ATTR_CHAR_CJK_LANGUAGE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_LANGUAGE
+ { SID_ATTR_CHAR_CJK_POSTURE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_POSTURE
+ { SID_ATTR_CHAR_CJK_WEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CJK_WEIGHT
+ { SID_ATTR_CHAR_CTL_FONT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_FONT
+ { SID_ATTR_CHAR_CTL_FONTHEIGHT, SFX_ITEM_POOLABLE },// RES_CHRATR_CTL_FONTSIZE
+ { SID_ATTR_CHAR_CTL_LANGUAGE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_LANGUAGE
+ { SID_ATTR_CHAR_CTL_POSTURE, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_POSTURE
+ { SID_ATTR_CHAR_CTL_WEIGHT, SFX_ITEM_POOLABLE }, // RES_CHRATR_CTL_WEIGHT
+ { SID_ATTR_CHAR_ROTATED, SFX_ITEM_POOLABLE }, // RES_CHRATR_ROTATE
+ { SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEM_POOLABLE }, // RES_CHRATR_EMPHASIS_MARK
+ { SID_ATTR_CHAR_TWO_LINES, SFX_ITEM_POOLABLE }, // RES_CHRATR_TWO_LINES
+ { SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEM_POOLABLE }, // RES_CHRATR_SCALEW
+ { SID_ATTR_CHAR_RELIEF, SFX_ITEM_POOLABLE }, // RES_CHRATR_RELIEF
+ { 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_DUMMY5,
+ { SID_ATTR_CHAR_CJK_RUBY, 0 }, // RES_TXTATR_CJK_RUBY,
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_UNKNOWN_CONTAINER,
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY6,
+ { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY7,
+
+ { 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
+ { SID_ATTR_PARA_SCRIPTSPACE, SFX_ITEM_POOLABLE }, // RES_PARATR_SCRIPTSPACE
+ { SID_ATTR_PARA_HANGPUNCTUATION, SFX_ITEM_POOLABLE },// RES_PARATR_HANGINGPUNCTUATION
+
+ { SID_ATTR_PARA_FORBIDDEN_RULES, SFX_ITEM_POOLABLE },// RES_PARATR_FORBIDDEN_RULES
+ { SID_PARA_VERTALIGN, SFX_ITEM_POOLABLE }, // RES_PARATR_VERTALIGN
+ { SID_ATTR_PARA_SNAPTOGRID, SFX_ITEM_POOLABLE }, // RES_PARATR_SNAPTOGRID
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_CONNECT_BORDER
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_DUMMY5
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_DUMMY6
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_DUMMY7
+ { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_DUMMY8
+
+ { 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_TEXTGRID
+ { FN_FORMAT_LINENUMBER, 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
+
+#ifdef VERTICAL_LAYOUT
+ { SID_ATTR_FRAMEDIRECTION, SFX_ITEM_POOLABLE }, // RES_FRAMEDIR
+#else
+ { 0, SFX_ITEM_POOLABLE }, // RES_FRAMEDIR
+#endif
+
+ { SID_ATTR_HDFT_DYNAMIC_SPACING, SFX_ITEM_POOLABLE }, // RES_HEADER_FOOTER_EAT_SPACING
+ { 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;
+USHORT* SwAttrPool::pVersionMap4 = 0;
+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;
+
+SwBreakIt* pBreakIt = 0;
+SwCheckIt* pCheckIt = 0;
+CharClass* pAppCharClass = 0;
+SwCalendarWrapper* pCalendarWrapper = 0;
+CollatorWrapper* pCollator = 0, *pCaseCollator = 0;
+::utl::TransliterationWrapper* pTransWrp = 0;
+
+/******************************************************************************
+ * void _InitCore()
+ ******************************************************************************/
+class SwDontWrite : public SfxBoolItem
+{
+public:
+ SwDontWrite( USHORT nId ) : SfxBoolItem( nId ) {}
+
+};
+
+
+
+
+
+/*N*/ void _InitCore()
+/*N*/ {
+/*N*/ SfxPoolItem* pItem;
+/*N*/
+/*N*/ // erstmal alle Attribut-Pointer auf 0 setzen
+/*N*/ memset( aAttrTab, 0, (POOLATTR_END - POOLATTR_BEGIN) *
+/*N*/ sizeof( SfxPoolItem* ) );
+/*N*/
+/*N*/ aAttrTab[ RES_CHRATR_CASEMAP- POOLATTR_BEGIN ] = new SvxCaseMapItem;
+/*N*/ aAttrTab[ RES_CHRATR_CHARSETCOLOR- POOLATTR_BEGIN ] = new SvxCharSetColorItem;
+/*N*/ aAttrTab[ RES_CHRATR_COLOR- POOLATTR_BEGIN ] = new SvxColorItem;
+/*N*/ aAttrTab[ RES_CHRATR_CONTOUR- POOLATTR_BEGIN ] = new SvxContourItem;
+/*N*/ aAttrTab[ RES_CHRATR_CROSSEDOUT- POOLATTR_BEGIN ] = new SvxCrossedOutItem;
+/*N*/ aAttrTab[ RES_CHRATR_ESCAPEMENT- POOLATTR_BEGIN ] = new SvxEscapementItem;
+/*N*/ aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ] =
+/*N*/ new SvxFontItem( RES_CHRATR_FONT );
+/*N*/
+/*N*/ aAttrTab[ RES_CHRATR_FONTSIZE- POOLATTR_BEGIN ] = new SvxFontHeightItem;
+/*N*/ aAttrTab[ RES_CHRATR_KERNING- POOLATTR_BEGIN ] = new SvxKerningItem;
+/*N*/ aAttrTab[ RES_CHRATR_LANGUAGE- POOLATTR_BEGIN ] = new SvxLanguageItem(LANGUAGE_DONTKNOW);
+/*N*/ aAttrTab[ RES_CHRATR_POSTURE- POOLATTR_BEGIN ] = new SvxPostureItem;
+/*N*/ aAttrTab[ RES_CHRATR_PROPORTIONALFONTSIZE- POOLATTR_BEGIN ] = new SvxPropSizeItem;
+/*N*/ aAttrTab[ RES_CHRATR_SHADOWED- POOLATTR_BEGIN ] = new SvxShadowedItem;
+/*N*/ aAttrTab[ RES_CHRATR_UNDERLINE- POOLATTR_BEGIN ] = new SvxUnderlineItem;
+/*N*/ aAttrTab[ RES_CHRATR_WEIGHT- POOLATTR_BEGIN ] = new SvxWeightItem;
+/*N*/ aAttrTab[ RES_CHRATR_WORDLINEMODE- POOLATTR_BEGIN ] = new SvxWordLineModeItem;
+/*N*/ aAttrTab[ RES_CHRATR_AUTOKERN- POOLATTR_BEGIN ] = new SvxAutoKernItem;
+/*N*/ aAttrTab[ RES_CHRATR_BLINK - POOLATTR_BEGIN ]
+/*N*/ = new SvxBlinkItem( FALSE, RES_CHRATR_BLINK );
+/*N*/ aAttrTab[ RES_CHRATR_NOHYPHEN - POOLATTR_BEGIN ]
+/*N*/ = new SvxNoHyphenItem( TRUE, RES_CHRATR_NOHYPHEN );
+/*N*/ aAttrTab[ RES_CHRATR_NOLINEBREAK- POOLATTR_BEGIN ]
+/*N*/ = new SvxNoLinebreakItem( TRUE, RES_CHRATR_NOLINEBREAK );
+/*N*/ aAttrTab[ RES_CHRATR_BACKGROUND - POOLATTR_BEGIN ]
+/*N*/ = new SvxBrushItem( RES_CHRATR_BACKGROUND );
+/*N*/
+/*N*/ // CJK-Attributes
+/*N*/ aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ] =
+/*N*/ new SvxFontItem( RES_CHRATR_CJK_FONT );
+/*N*/
+/*N*/ pItem = new SvxFontHeightItem;
+/*N*/ pItem->SetWhich( RES_CHRATR_CJK_FONTSIZE );
+/*N*/ aAttrTab[ RES_CHRATR_CJK_FONTSIZE - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ pItem = new SvxLanguageItem(LANGUAGE_DONTKNOW);
+/*N*/ pItem->SetWhich( RES_CHRATR_CJK_LANGUAGE );
+/*N*/ aAttrTab[ RES_CHRATR_CJK_LANGUAGE - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ pItem = new SvxPostureItem;
+/*N*/ pItem->SetWhich( RES_CHRATR_CJK_POSTURE );
+/*N*/ aAttrTab[ RES_CHRATR_CJK_POSTURE - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ pItem = new SvxWeightItem;
+/*N*/ pItem->SetWhich( RES_CHRATR_CJK_WEIGHT );
+/*N*/ aAttrTab[ RES_CHRATR_CJK_WEIGHT - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ // CTL-Attributes
+/*N*/ aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] =
+/*N*/ new SvxFontItem( RES_CHRATR_CTL_FONT );
+/*N*/
+/*N*/ pItem = new SvxFontHeightItem;
+/*N*/ pItem->SetWhich( RES_CHRATR_CTL_FONTSIZE );
+/*N*/ aAttrTab[ RES_CHRATR_CTL_FONTSIZE - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ pItem = new SvxLanguageItem(LANGUAGE_DONTKNOW);
+/*N*/ pItem->SetWhich( RES_CHRATR_CTL_LANGUAGE );
+/*N*/ aAttrTab[ RES_CHRATR_CTL_LANGUAGE - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ pItem = new SvxPostureItem;
+/*N*/ pItem->SetWhich( RES_CHRATR_CTL_POSTURE );
+/*N*/ aAttrTab[ RES_CHRATR_CTL_POSTURE - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ pItem = new SvxWeightItem;
+/*N*/ pItem->SetWhich( RES_CHRATR_CTL_WEIGHT );
+/*N*/ aAttrTab[ RES_CHRATR_CTL_WEIGHT - POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ aAttrTab[ RES_CHRATR_ROTATE - POOLATTR_BEGIN ] = new SvxCharRotateItem;
+/*N*/ aAttrTab[ RES_CHRATR_EMPHASIS_MARK - POOLATTR_BEGIN ] =
+/*N*/ new SvxEmphasisMarkItem;
+/*N*/ aAttrTab[ RES_CHRATR_TWO_LINES - POOLATTR_BEGIN ] = new SvxTwoLinesItem( FALSE );
+/*N*/ aAttrTab[ RES_CHRATR_SCALEW - POOLATTR_BEGIN ] = new SvxCharScaleWidthItem;
+/*N*/ aAttrTab[ RES_CHRATR_RELIEF - POOLATTR_BEGIN ] = new SvxCharReliefItem;
+/*N*/
+/*N*/ // CharakterAttr - Dummies
+/*N*/ aAttrTab[ RES_CHRATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_CHRATR_DUMMY1 );
+/*N*/ // CharakterAttr - Dummies
+/*N*/
+/*N*/ // TextAttr Ende - Dummies
+/*N*/ aAttrTab[ RES_TXTATR_DUMMY4 - POOLATTR_BEGIN ]
+/*N*/ = new SfxBoolItem( RES_TXTATR_DUMMY4 );
+/*N*/ // TextAttr Ende - Dummies
+/*N*/
+/*N*/ aAttrTab[ RES_TXTATR_INETFMT - POOLATTR_BEGIN ]
+/*N*/ = new SwFmtINetFmt( aEmptyStr, aEmptyStr );
+/*N*/ aAttrTab[ RES_TXTATR_REFMARK - POOLATTR_BEGIN ] = new SwFmtRefMark( aEmptyStr );
+/*N*/ aAttrTab[ RES_TXTATR_TOXMARK - POOLATTR_BEGIN ] = new SwTOXMark;
+/*N*/ aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 );
+/*N*/
+/*N*/ aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyStr );
+/*N*/ aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] =
+/*N*/ new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER );
+/*N*/
+/*N*/ aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld;
+/*N*/ aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 );
+/*N*/ aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn;
+/*N*/ aAttrTab[ RES_TXTATR_SOFTHYPH- POOLATTR_BEGIN ] = new SwFmtSoftHyph;
+/*N*/ aAttrTab[ RES_TXTATR_HARDBLANK- POOLATTR_BEGIN ] = new SwFmtHardBlank( ' ', FALSE );
+/*N*/
+/*N*/ // TextAttr ohne Ende - Dummies
+/*N*/ aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 );
+/*N*/ aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 );
+/*N*/ aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 );
+/*N*/ aAttrTab[ RES_TXTATR_DUMMY6 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY6 );
+/*N*/ aAttrTab[ RES_TXTATR_DUMMY7 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY7 );
+/*N*/ // TextAttr ohne Ende - Dummies
+/*N*/
+/*N*/ aAttrTab[ RES_PARATR_LINESPACING- POOLATTR_BEGIN ] = new SvxLineSpacingItem;
+/*N*/ aAttrTab[ RES_PARATR_ADJUST- POOLATTR_BEGIN ] = new SvxAdjustItem;
+/*N*/ aAttrTab[ RES_PARATR_SPLIT- POOLATTR_BEGIN ] = new SvxFmtSplitItem;
+/*N*/ aAttrTab[ RES_PARATR_WIDOWS- POOLATTR_BEGIN ] = new SvxWidowsItem;
+/*N*/ aAttrTab[ RES_PARATR_ORPHANS- POOLATTR_BEGIN ] = new SvxOrphansItem;
+/*N*/ aAttrTab[ RES_PARATR_TABSTOP- POOLATTR_BEGIN ] = new
+/*N*/ SvxTabStopItem( 1, SVX_TAB_DEFDIST );
+/*N*/
+/*N*/ pItem = new SvxHyphenZoneItem;
+/*N*/ ((SvxHyphenZoneItem*)pItem)->GetMaxHyphens() = 0; // Default z.Z. auf 0
+/*N*/ aAttrTab[ RES_PARATR_HYPHENZONE- POOLATTR_BEGIN ] = pItem;
+/*N*/
+/*N*/ aAttrTab[ RES_PARATR_DROP- POOLATTR_BEGIN ] = new SwFmtDrop;
+/*N*/ aAttrTab[ RES_PARATR_REGISTER - POOLATTR_BEGIN ] = new SwRegisterItem( FALSE );
+/*N*/ aAttrTab[ RES_PARATR_NUMRULE - POOLATTR_BEGIN ] = new SwNumRuleItem( aEmptyStr );
+/*N*/
+/*N*/ aAttrTab[ RES_PARATR_SCRIPTSPACE - POOLATTR_BEGIN ] =
+/*N*/ new SvxScriptSpaceItem( TRUE );
+/*N*/ aAttrTab[ RES_PARATR_HANGINGPUNCTUATION - POOLATTR_BEGIN ] =
+/*N*/ new SvxHangingPunctuationItem( TRUE );
+/*N*/ aAttrTab[ RES_PARATR_FORBIDDEN_RULES - POOLATTR_BEGIN ] =
+/*N*/ new SvxForbiddenRuleItem( TRUE );
+/*N*/ aAttrTab[ RES_PARATR_VERTALIGN - POOLATTR_BEGIN ] =
+/*N*/ new SvxParaVertAlignItem( 0 );
+/*N*/ aAttrTab[ RES_PARATR_SNAPTOGRID - POOLATTR_BEGIN ] = new SvxParaGridItem;
+/*N*/ aAttrTab[ RES_PARATR_CONNECT_BORDER - POOLATTR_BEGIN ] = new SwParaConnectBorderItem;
+/*N*/ // ParaAttr - Dummies
+/*N*/ aAttrTab[ RES_PARATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_DUMMY5 );
+/*N*/ aAttrTab[ RES_PARATR_DUMMY6 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_DUMMY6 );
+/*N*/ aAttrTab[ RES_PARATR_DUMMY7 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_DUMMY7 );
+/*N*/ aAttrTab[ RES_PARATR_DUMMY8 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_PARATR_DUMMY8 );
+/*N*/ // ParatAttr - Dummies
+/*N*/
+/*N*/ aAttrTab[ RES_FILL_ORDER- POOLATTR_BEGIN ] = new SwFmtFillOrder;
+/*N*/ aAttrTab[ RES_FRM_SIZE- POOLATTR_BEGIN ] = new SwFmtFrmSize;
+/*N*/ aAttrTab[ RES_PAPER_BIN- POOLATTR_BEGIN ] = new SvxPaperBinItem;
+/*N*/ aAttrTab[ RES_LR_SPACE- POOLATTR_BEGIN ] = new SvxLRSpaceItem;
+/*N*/ aAttrTab[ RES_UL_SPACE- POOLATTR_BEGIN ] = new SvxULSpaceItem;
+/*N*/ aAttrTab[ RES_PAGEDESC- POOLATTR_BEGIN ] = new SwFmtPageDesc;
+/*N*/ aAttrTab[ RES_BREAK- POOLATTR_BEGIN ] = new SvxFmtBreakItem;
+/*N*/ aAttrTab[ RES_CNTNT- POOLATTR_BEGIN ] = new SwFmtCntnt;
+/*N*/ aAttrTab[ RES_HEADER- POOLATTR_BEGIN ] = new SwFmtHeader;
+/*N*/ aAttrTab[ RES_FOOTER- POOLATTR_BEGIN ] = new SwFmtFooter;
+/*N*/ aAttrTab[ RES_PRINT- POOLATTR_BEGIN ] = new SvxPrintItem;
+/*N*/ aAttrTab[ RES_OPAQUE- POOLATTR_BEGIN ] = new SvxOpaqueItem;
+/*N*/ aAttrTab[ RES_PROTECT- POOLATTR_BEGIN ] = new SvxProtectItem;
+/*N*/ aAttrTab[ RES_SURROUND- POOLATTR_BEGIN ] = new SwFmtSurround;
+/*N*/ aAttrTab[ RES_VERT_ORIENT- POOLATTR_BEGIN ] = new SwFmtVertOrient;
+/*N*/ aAttrTab[ RES_HORI_ORIENT- POOLATTR_BEGIN ] = new SwFmtHoriOrient;
+/*N*/ aAttrTab[ RES_ANCHOR- POOLATTR_BEGIN ] = new SwFmtAnchor;
+/*N*/ aAttrTab[ RES_BACKGROUND- POOLATTR_BEGIN ] = new SvxBrushItem;
+/*N*/ aAttrTab[ RES_BOX- POOLATTR_BEGIN ] = new SvxBoxItem;
+/*N*/ aAttrTab[ RES_SHADOW- POOLATTR_BEGIN ] = new SvxShadowItem;
+/*N*/ aAttrTab[ RES_FRMMACRO- POOLATTR_BEGIN ] = new SvxMacroItem(RES_FRMMACRO);
+/*N*/ aAttrTab[ RES_COL- POOLATTR_BEGIN ] = new SwFmtCol;
+/*N*/ aAttrTab[ RES_KEEP - POOLATTR_BEGIN ] = new SvxFmtKeepItem( FALSE );
+/*N*/ aAttrTab[ RES_URL - POOLATTR_BEGIN ] = new SwFmtURL();
+/*N*/ aAttrTab[ RES_EDIT_IN_READONLY - POOLATTR_BEGIN ] = new SwFmtEditInReadonly;
+/*N*/ aAttrTab[ RES_LAYOUT_SPLIT - POOLATTR_BEGIN ] = new SwFmtLayoutSplit;
+/*N*/ aAttrTab[ RES_CHAIN - POOLATTR_BEGIN ] = new SwFmtChain;
+/*N*/ aAttrTab[ RES_TEXTGRID - POOLATTR_BEGIN ] = new SwTextGridItem;
+/*M*/ aAttrTab[ RES_HEADER_FOOTER_EAT_SPACING - POOLATTR_BEGIN ] = new SwHeaderAndFooterEatSpacingItem;
+/*N*/ aAttrTab[ RES_LINENUMBER - POOLATTR_BEGIN ] = new SwFmtLineNumber;
+/*N*/ aAttrTab[ RES_FTN_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtFtnAtTxtEnd;
+/*N*/ aAttrTab[ RES_END_AT_TXTEND - POOLATTR_BEGIN ] = new SwFmtEndAtTxtEnd;
+/*N*/ aAttrTab[ RES_COLUMNBALANCE - POOLATTR_BEGIN ] = new SwFmtNoBalancedColumns;
+/*N*/ aAttrTab[ RES_FRAMEDIR - POOLATTR_BEGIN ] = new SvxFrameDirectionItem(FRMDIR_ENVIRONMENT);
+/*N*/
+/*N*/ // FrameAttr - Dummies
+/*N*/ aAttrTab[ RES_FRMATR_DUMMY9 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_FRMATR_DUMMY9 );
+/*N*/ // FrameAttr - Dummies
+/*N*/
+/*N*/ aAttrTab[ RES_GRFATR_MIRRORGRF- POOLATTR_BEGIN ] = new SwMirrorGrf;
+/*N*/ aAttrTab[ RES_GRFATR_CROPGRF- POOLATTR_BEGIN ] = new SwCropGrf;
+/*N*/
+/*N*/ aAttrTab[ RES_GRFATR_ROTATION - POOLATTR_BEGIN ] = new SwRotationGrf;
+/*N*/ aAttrTab[ RES_GRFATR_LUMINANCE - POOLATTR_BEGIN ] = new SwLuminanceGrf;
+/*N*/ aAttrTab[ RES_GRFATR_CONTRAST - POOLATTR_BEGIN ] = new SwContrastGrf;
+/*N*/ aAttrTab[ RES_GRFATR_CHANNELR - POOLATTR_BEGIN ] = new SwChannelRGrf;
+/*N*/ aAttrTab[ RES_GRFATR_CHANNELG - POOLATTR_BEGIN ] = new SwChannelGGrf;
+/*N*/ aAttrTab[ RES_GRFATR_CHANNELB - POOLATTR_BEGIN ] = new SwChannelBGrf;
+/*N*/ aAttrTab[ RES_GRFATR_GAMMA - POOLATTR_BEGIN ] = new SwGammaGrf;
+/*N*/ aAttrTab[ RES_GRFATR_INVERT - POOLATTR_BEGIN ] = new SwInvertGrf;
+/*N*/ aAttrTab[ RES_GRFATR_TRANSPARENCY - POOLATTR_BEGIN ] = new SwTransparencyGrf;
+/*N*/ aAttrTab[ RES_GRFATR_DRAWMODE - POOLATTR_BEGIN ] = new SwDrawModeGrf;
+/*N*/
+/*N*/ // GraphicAttr - Dummies
+/*N*/ aAttrTab[ RES_GRFATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY1 );
+/*N*/ aAttrTab[ RES_GRFATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY2 );
+/*N*/ aAttrTab[ RES_GRFATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY3 );
+/*N*/ aAttrTab[ RES_GRFATR_DUMMY4 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY4 );
+/*N*/ aAttrTab[ RES_GRFATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_GRFATR_DUMMY5 );
+/*N*/ // GraphicAttr - Dummies
+/*N*/
+/*N*/ aAttrTab[ RES_BOXATR_FORMAT- POOLATTR_BEGIN ] = new SwTblBoxNumFormat;
+/*N*/ aAttrTab[ RES_BOXATR_FORMULA- POOLATTR_BEGIN ] = new SwTblBoxFormula( aEmptyStr );
+/*N*/ aAttrTab[ RES_BOXATR_VALUE- POOLATTR_BEGIN ] = new SwTblBoxValue;
+/*N*/
+/*N*/ aAttrTab[ RES_UNKNOWNATR_CONTAINER- POOLATTR_BEGIN ] =
+/*N*/ new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER );
+/*N*/
+/*N*/ // get the correct fonts:
+/*N*/ ::binfilter::GetDefaultFonts( *(SvxFontItem*)aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ],
+/*N*/ *(SvxFontItem*)aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ],
+/*N*/ *(SvxFontItem*)aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] );
+/*N*/
+/*N*/ // 1. Version - neue Attribute:
+/*N*/ // - RES_CHRATR_BLINK
+/*N*/ // - RES_CHRATR_NOHYPHEN
+/*N*/ // - RES_CHRATR_NOLINEBREAK
+/*N*/ // - RES_PARATR_REGISTER
+/*N*/ // + 2 Dummies fuer die einzelnen "Bereiche"
+/*N*/ SwAttrPool::pVersionMap1 = new USHORT[ 60 ];
+ USHORT i;
+/*N*/ for( i = 1; i <= 17; i++ )
+/*N*/ SwAttrPool::pVersionMap1[ i-1 ] = i;
+/*N*/ for ( i = 18; i <= 27; ++i )
+/*N*/ SwAttrPool::pVersionMap1[ i-1 ] = i + 5;
+/*N*/ for ( i = 28; i <= 35; ++i )
+/*N*/ SwAttrPool::pVersionMap1[ i-1 ] = i + 7;
+/*N*/ for ( i = 36; i <= 58; ++i )
+/*N*/ SwAttrPool::pVersionMap1[ i-1 ] = i + 10;
+/*N*/ for ( i = 59; i <= 60; ++i )
+/*N*/ SwAttrPool::pVersionMap1[ i-1 ] = i + 12;
+/*N*/
+/*N*/ // 2. Version - neue Attribute:
+/*N*/ // 10 Dummies fuer den Frame "Bereich"
+/*N*/ SwAttrPool::pVersionMap2 = new USHORT[ 75 ];
+/*N*/ for( i = 1; i <= 70; i++ )
+/*N*/ SwAttrPool::pVersionMap2[ i-1 ] = i;
+/*N*/ for ( i = 71; i <= 75; ++i )
+/*N*/ SwAttrPool::pVersionMap2[ i-1 ] = i + 10;
+/*N*/
+/*N*/ // 3. Version - neue Attribute:
+/*N*/ // neue Attribute und Dummies fuer die CJK-Version
+/*N*/ // und neue Grafik-Attribute
+/*N*/ SwAttrPool::pVersionMap3 = new USHORT[ 86 ];
+/*N*/ for( i = 1; i <= 21; i++ )
+/*N*/ SwAttrPool::pVersionMap3[ i-1 ] = i;
+/*N*/ for ( i = 22; i <= 27; ++i )
+/*N*/ SwAttrPool::pVersionMap3[ i-1 ] = i + 15;
+/*N*/ for ( i = 28; i <= 82; ++i )
+/*N*/ SwAttrPool::pVersionMap3[ i-1 ] = i + 20;
+/*N*/ for ( i = 83; i <= 86; ++i )
+/*N*/ SwAttrPool::pVersionMap3[ i-1 ] = i + 35;
+/*N*/
+/*N*/ // 4. Version - neue Paragraph Attribute fuer die CJK-Version
+/*N*/ SwAttrPool::pVersionMap4 = new USHORT[ 121 ];
+/*N*/ for( i = 1; i <= 65; i++ )
+/*N*/ SwAttrPool::pVersionMap4[ i-1 ] = i;
+/*N*/ for ( i = 66; i <= 121; ++i )
+/*N*/ SwAttrPool::pVersionMap4[ i-1 ] = i + 9;
+/*N*/
+/*N*/ pBreakIt = new SwBreakIt;
+/*N*/ const ::com::sun::star::lang::Locale& rLcl = pBreakIt->GetLocale(
+/*N*/ (LanguageType)GetAppLanguage() );
+/*M*/ pCheckIt = NULL;
+/*N*/ ::com::sun::star::uno::Reference<
+/*N*/ ::com::sun::star::lang::XMultiServiceFactory > xMSF =
+/*N*/ ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*N*/ pAppCharClass = new CharClass( xMSF, rLcl );
+/*N*/ pCalendarWrapper = new SwCalendarWrapper( xMSF );
+/*N*/
+/*N*/ _FrmInit();
+/*N*/ _TextInit();
+/*N*/
+/*N*/ SwSelPaintRects::pMapMode = new MapMode;
+/*N*/ SwFntObj::pPixMap = new MapMode;
+/*N*/
+/*N*/ SwIndexReg::pEmptyIndexArray = new SwIndexReg;
+/*N*/
+/*N*/ pGlobalOLEExcludeList = new SvPtrarr;
+/*N*/
+/*N*/ }
+
+/******************************************************************************
+ * void _FinitCore()
+ ******************************************************************************/
+
+
+
+/*N*/ void _FinitCore()
+/*N*/ {
+/*N*/ _FrmFinit();
+/*N*/ _TextFinit();
+/*N*/
+/*N*/ delete pBreakIt;
+/*M*/ delete pCheckIt;
+/*N*/ delete pAppCharClass;
+/*N*/ delete pCalendarWrapper;
+/*N*/ delete pCollator;
+/*N*/ delete pCaseCollator;
+/*N*/
+/*N*/ delete SwSelPaintRects::pMapMode;
+/*N*/ delete SwFntObj::pPixMap;
+/*N*/
+/*N*/ delete SwEditShell::pAutoFmtFlags;
+/*N*/ delete SwNumRule::pDefBulletFont;
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ //Defaultattribut freigeben lassen um asserts zu vermeiden.
+/*N*/ if ( aAttrTab[0]->GetRefCount() )
+/*N*/ SfxItemPool::ReleaseDefaults( aAttrTab, POOLATTR_END-POOLATTR_BEGIN, FALSE);
+/*N*/ #endif
+/*N*/
+/*N*/ delete SwStyleNameMapper::pTextUINameArray;
+/*N*/ delete SwStyleNameMapper::pListsUINameArray;
+/*N*/ delete SwStyleNameMapper::pExtraUINameArray;
+/*N*/ delete SwStyleNameMapper::pRegisterUINameArray;
+/*N*/ delete SwStyleNameMapper::pDocUINameArray;
+/*N*/ delete SwStyleNameMapper::pHTMLUINameArray;
+/*N*/ delete SwStyleNameMapper::pFrmFmtUINameArray;
+/*N*/ delete SwStyleNameMapper::pChrFmtUINameArray;
+/*N*/ delete SwStyleNameMapper::pHTMLChrFmtUINameArray;
+/*N*/ delete SwStyleNameMapper::pPageDescUINameArray;
+/*N*/ delete SwStyleNameMapper::pNumRuleUINameArray;
+/*N*/
+/*N*/ // Delete programmatic name arrays also
+/*N*/ delete SwStyleNameMapper::pTextProgNameArray;
+/*N*/ delete SwStyleNameMapper::pListsProgNameArray;
+/*N*/ delete SwStyleNameMapper::pExtraProgNameArray;
+/*N*/ delete SwStyleNameMapper::pRegisterProgNameArray;
+/*N*/ delete SwStyleNameMapper::pDocProgNameArray;
+/*N*/ delete SwStyleNameMapper::pHTMLProgNameArray;
+/*N*/ delete SwStyleNameMapper::pFrmFmtProgNameArray;
+/*N*/ delete SwStyleNameMapper::pChrFmtProgNameArray;
+/*N*/ delete SwStyleNameMapper::pHTMLChrFmtProgNameArray;
+/*N*/ delete SwStyleNameMapper::pPageDescProgNameArray;
+/*N*/ delete SwStyleNameMapper::pNumRuleProgNameArray;
+/*N*/
+/*N*/ // And finally, any hash tables that we used
+/*N*/ delete SwStyleNameMapper::pParaUIMap;
+/*N*/ delete SwStyleNameMapper::pCharUIMap;
+/*N*/ delete SwStyleNameMapper::pPageUIMap;
+/*N*/ delete SwStyleNameMapper::pFrameUIMap;
+/*N*/ delete SwStyleNameMapper::pNumRuleUIMap;
+/*N*/
+/*N*/ delete SwStyleNameMapper::pParaProgMap;
+/*N*/ delete SwStyleNameMapper::pCharProgMap;
+/*N*/ delete SwStyleNameMapper::pPageProgMap;
+/*N*/ delete SwStyleNameMapper::pFrameProgMap;
+/*N*/ delete SwStyleNameMapper::pNumRuleProgMap;
+/*N*/
+/*N*/
+/*N*/ // loesche alle default-Attribute
+/*N*/ SfxPoolItem* pHt;
+/*N*/ for( USHORT n = 0; n < POOLATTR_END - POOLATTR_BEGIN; n++ )
+/*N*/ if( 0 != ( pHt = aAttrTab[n] ))
+/*N*/ delete pHt;
+/*N*/
+/*N*/ ::binfilter::ClearFEShellTabCols();
+/*N*/
+/*N*/ delete SwIndexReg::pEmptyIndexArray;
+/*N*/ delete[] SwAttrPool::pVersionMap1;
+/*N*/ delete[] SwAttrPool::pVersionMap2;
+/*N*/ delete[] SwAttrPool::pVersionMap3;
+/*N*/ delete[] SwAttrPool::pVersionMap4;
+/*N*/
+/*N*/ for ( USHORT i = 0; i < pGlobalOLEExcludeList->Count(); ++i )
+/*N*/ delete (SvGlobalName*)(*pGlobalOLEExcludeList)[i];
+/*N*/ delete pGlobalOLEExcludeList;
+/*N*/ }
+
+// returns the APP - CharClass instance - used for all ToUpper/ToLower/...
+/*N*/ CharClass& GetAppCharClass()
+/*N*/ {
+/*N*/ return *pAppCharClass;
+/*N*/ }
+
+/*N*/ LocaleDataWrapper& GetAppLocaleData()
+/*N*/ {
+/*N*/ SvtSysLocale aSysLocale;
+/*N*/ return (LocaleDataWrapper&)aSysLocale.GetLocaleData();
+/*N*/ }
+
+
+
+
+/*N*/ ULONG GetAppLanguage()
+/*N*/ {
+/*N*/ return Application::GetSettings().GetLanguage();
+/*N*/ }
+
+/*N*/ CollatorWrapper& GetAppCollator()
+/*N*/ {
+/*?*/ if( !pCollator )
+/*?*/ {
+/*?*/ const ::com::sun::star::lang::Locale& rLcl = pBreakIt->GetLocale(
+/*?*/ (LanguageType)GetAppLanguage() );
+/*?*/ ::com::sun::star::uno::Reference<
+/*?*/ ::com::sun::star::lang::XMultiServiceFactory > xMSF =
+/*?*/ ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*?*/
+/*?*/ pCollator = new ::CollatorWrapper( xMSF );
+/*?*/ pCollator->loadDefaultCollator( rLcl, SW_COLLATOR_IGNORES );
+/*?*/ }
+/*?*/ return *pCollator;
+/*N*/ }
+
+/*N*/ const ::utl::TransliterationWrapper& GetAppCmpStrIgnore()
+/*N*/ {
+/*N*/ if( !pTransWrp )
+/*N*/ {
+/*N*/ ::com::sun::star::uno::Reference<
+/*N*/ ::com::sun::star::lang::XMultiServiceFactory > xMSF =
+/*N*/ ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*N*/
+/*N*/ pTransWrp = new ::utl::TransliterationWrapper( xMSF,
+/*N*/ ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE |
+/*N*/ ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA |
+/*N*/ ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH );
+/*N*/ pTransWrp->loadModuleIfNeeded( GetAppLanguage() );
+/*N*/ }
+/*N*/ return *pTransWrp;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_ring.cxx b/binfilter/bf_sw/source/core/bastyp/sw_ring.cxx
new file mode 100644
index 000000000000..b8d393e1292e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_ring.cxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "ring.hxx"
+namespace binfilter {
+
+
+/*************************************************************************
+|*
+|* Ring::Ring()
+|*
+|* Ersterstellung VB 02.07.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+/*N*/ Ring::Ring( Ring *pObj )
+/*N*/ {
+/*N*/ if( !pObj )
+/*N*/ pNext = this, pPrev = this;
+/*N*/ else
+/*N*/ {
+/*?*/ pNext = pObj;
+/*?*/ pPrev = pObj->pPrev;
+/*?*/ pObj->pPrev = this;
+/*?*/ pPrev->pNext = this;
+/*N*/ }
+}
+
+/*************************************************************************
+|*
+|* Ring::~Ring()
+|*
+|* Ersterstellung VB 02.07.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+/*N*/ Ring::~Ring()
+/*N*/ {
+/*N*/ pNext->pPrev = pPrev;
+/*N*/ pPrev->pNext = pNext;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Ring::MoveTo
+|*
+|* Ersterstellung VB 4.3.91
+|* Letzte Aenderung JP 10.10.97
+|*
+*************************************************************************/
+
+/*N*/ void Ring::MoveTo(Ring *pDestRing)
+/*N*/ {
+/*N*/ // loeschen aus dem alten
+/*N*/ pNext->pPrev = pPrev;
+/*N*/ pPrev->pNext = pNext;
+/*N*/
+/*N*/ // im neuen einfuegen
+/*N*/ if( pDestRing )
+/*N*/ {
+/*N*/ pNext = pDestRing;
+/*N*/ pPrev = pDestRing->pPrev;
+/*N*/ pDestRing->pPrev = this;
+/*N*/ pPrev->pNext = this;
+/*N*/ }
+/*N*/ else
+/*N*/ pNext = pPrev = this;
+/*N*/
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_swcache.cxx b/binfilter/bf_sw/source/core/bastyp/sw_swcache.cxx
new file mode 100644
index 000000000000..0e32d05f29fc
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_swcache.cxx
@@ -0,0 +1,655 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <tools/debug.hxx>
+#include <errhdl.hxx>
+#include <swcache.hxx>
+namespace binfilter {
+
+/*N*/ SV_IMPL_PTRARR(SwCacheObjArr,SwCacheObj*);
+
+#ifndef DBG_UTIL
+#define INCREMENT( nVar )
+#else
+#define INCREMENT( nVar ) ++nVar
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::Check()
+|*
+|* Ersterstellung MA 23. Mar. 94
+|* Letzte Aenderung MA 23. Mar. 94
+|*
+|*************************************************************************/
+
+#ifdef DBG_UTIL
+
+/*N*/ void SwCache::Check()
+/*N*/ {
+/*N*/ if ( !pRealFirst )
+/*N*/ return;
+/*N*/
+/*N*/ //Konsistenspruefung.
+/*N*/ ASSERT( !pLast->GetNext(), "Last but not last." );
+/*N*/ ASSERT( !pRealFirst->GetPrev(), "First but not first." );
+/*N*/ USHORT nCnt = 0;
+/*N*/ BOOL bFirstFound = FALSE;
+/*N*/ SwCacheObj *pObj = pRealFirst;
+/*N*/ SwCacheObj *pRekursive = pObj;
+/*N*/ while ( pObj )
+/*N*/ {
+/*N*/ //Das Objekt muss auch auf dem Rueckwaertsweg gefunden werden.
+/*N*/ SwCacheObj *pTmp = pLast;
+/*N*/ while ( pTmp && pTmp != pObj )
+/*N*/ pTmp = pTmp->GetPrev();
+/*N*/ ASSERT( pTmp, "Objekt not found." );
+/*N*/
+/*N*/ ++nCnt;
+/*N*/ if ( pObj == pFirst )
+/*N*/ bFirstFound = TRUE;
+/*N*/ if ( !pObj->GetNext() )
+/*N*/ ASSERT( pObj == pLast, "Last not Found." );
+/*N*/ pObj = pObj->GetNext();
+/*N*/ ASSERT( pObj != pRekursive, "Recursion in SwCache." );
+/*N*/ }
+/*N*/ ASSERT( bFirstFound, "First not Found." );
+/*N*/ ASSERT( (nCnt + aFreePositions.Count()) == Count(), "Lost Chain." );
+/*N*/ if ( Count() == nCurMax )
+/*N*/ ASSERT( (nCurMax - nCnt) == aFreePositions.Count(), "Lost FreePositions." );
+/*N*/ }
+#endif
+
+#if defined(DBG_UTIL) && defined(MADEBUG)
+#define CHECK Check();
+#else
+#define CHECK
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::SwCache(), ~SwCache()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ SwCache::SwCache( const USHORT nInitSize, const USHORT nGrowSize
+/*N*/ #ifdef DBG_UTIL
+/*N*/ , const ByteString &rNm
+/*N*/ #endif
+/*N*/ ) :
+/*N*/ SwCacheObjArr( (BYTE)nInitSize, (BYTE)nGrowSize ),
+/*N*/ aFreePositions( 5, 5 ),
+/*N*/ nMax( nInitSize ),
+/*N*/ nCurMax( nInitSize ),
+/*N*/ pRealFirst( 0 ),
+/*N*/ pFirst( 0 ),
+/*N*/ pLast( 0 )
+/*N*/ #ifdef DBG_UTIL
+/*N*/ , aName( rNm ),
+/*N*/ nAppend( 0 ),
+/*N*/ nInsertFree( 0 ),
+/*N*/ nReplace( 0 ),
+/*N*/ nGetSuccess( 0 ),
+/*N*/ nGetFail( 0 ),
+/*N*/ nToTop( 0 ),
+/*N*/ nDelete( 0 ),
+/*N*/ nGetSeek( 0 ),
+/*N*/ nAverageSeekCnt( 0 ),
+/*N*/ nFlushCnt( 0 ),
+/*N*/ nFlushedObjects( 0 ),
+/*N*/ nIncreaseMax( 0 ),
+/*N*/ nDecreaseMax( 0 )
+/*N*/ #endif
+/*N*/ {
+/*N*/ }
+
+#ifdef DBG_UTIL
+
+
+/*N*/ SwCache::~SwCache()
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ #ifndef MAC
+/*N*/ {
+/*N*/ ByteString sOut( aName ); sOut += '\n';
+/*N*/ (( sOut += "Anzahl neuer Eintraege: " )
+/*N*/ += ByteString::CreateFromInt32( nAppend ))+= '\n';
+/*N*/ (( sOut += "Anzahl Insert auf freie Plaetze: " )
+/*N*/ += ByteString::CreateFromInt32( nInsertFree ))+= '\n';
+/*N*/ (( sOut += "Anzahl Ersetzungen: " )
+/*N*/ += ByteString::CreateFromInt32( nReplace ))+= '\n';
+/*N*/ (( sOut += "Anzahl Erfolgreicher Get's: " )
+/*N*/ += ByteString::CreateFromInt32( nGetSuccess ))+= '\n';
+/*N*/ (( sOut += "Anzahl Fehlgeschlagener Get's: " )
+/*N*/ += ByteString::CreateFromInt32( nGetFail ))+= '\n';
+/*N*/ (( sOut += "Anzahl Umsortierungen (LRU): " )
+/*N*/ += ByteString::CreateFromInt32( nToTop ))+= '\n';
+/*N*/ (( sOut += "Anzahl Loeschungen: " )
+/*N*/ += ByteString::CreateFromInt32( nDelete ))+= '\n';
+/*N*/ (( sOut += "Anzahl Get's ohne Index: " )
+/*N*/ += ByteString::CreateFromInt32( nGetSeek ))+= '\n';
+/*N*/ (( sOut += "Anzahl Seek fuer Get ohne Index: " )
+/*N*/ += ByteString::CreateFromInt32( nAverageSeekCnt ))+= '\n';
+/*N*/ (( sOut += "Anzahl Flush-Aufrufe: " )
+/*N*/ += ByteString::CreateFromInt32( nFlushCnt ))+= '\n';
+/*N*/ (( sOut += "Anzahl geflush'ter Objekte: " )
+/*N*/ += ByteString::CreateFromInt32( nFlushedObjects ))+= '\n';
+/*N*/ (( sOut += "Anzahl Cache-Erweiterungen: " )
+/*N*/ += ByteString::CreateFromInt32( nIncreaseMax ))+= '\n';
+/*N*/ (( sOut += "Anzahl Cache-Verkleinerungen: " )
+/*N*/ += ByteString::CreateFromInt32( nDecreaseMax ))+= '\n';
+/*N*/
+/*N*/ DBG_ERROR( sOut.GetBuffer() );
+/*N*/ }
+/*N*/ Check();
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ }
+#endif
+
+/*************************************************************************
+|*
+|* SwCache::Flush()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwCache::Flush( const BYTE nPercent )
+/*N*/ {
+/*N*/ ASSERT( nPercent == 100, "SwCache::Flush() arbeitet nur 100%'ig" );
+/*N*/
+/*N*/ INCREMENT( nFlushCnt );
+/*N*/ SwCacheObj *pObj = pRealFirst;
+/*N*/ pRealFirst = pFirst = pLast = 0;
+/*N*/ SwCacheObj *pTmp;
+/*N*/ while ( pObj )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( pObj->IsLocked() )
+/*N*/ {
+/*?*/ 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;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ #endif
+/*N*/ {
+/*N*/ pTmp = (SwCacheObj*)pObj;
+/*N*/ pObj = pTmp->GetNext();
+/*N*/ aFreePositions.Insert( pTmp->GetCachePos(), aFreePositions.Count() );
+/*N*/ *(pData + pTmp->GetCachePos()) = (void*)0;
+/*N*/ delete pTmp;
+/*N*/ INCREMENT( nFlushedObjects );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCache::ToTop()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 24. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwCache::ToTop( SwCacheObj *pObj )
+/*N*/ {
+/*N*/ INCREMENT( nToTop );
+/*N*/
+/*N*/ //Objekt aus der LRU-Kette ausschneiden und am Anfang einfuegen.
+/*N*/ if ( pRealFirst == pObj ) //pFirst wurde vom Aufrufer geprueft!
+/*N*/ { CHECK;
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ if ( !pRealFirst )
+/*N*/ { //Der erste wird eingetragen.
+/*?*/ ASSERT( !pFirst && !pLast, "First not first." );
+/*?*/ pRealFirst = pFirst = pLast = pObj;
+/*?*/ CHECK;
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ //Ausschneiden.
+/*N*/ if ( pObj == pLast )
+/*N*/ {
+/*N*/ ASSERT( pObj->GetPrev(), "Last but no Prev." );
+/*N*/ pLast = pObj->GetPrev();
+/*N*/ pLast->SetNext( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( pObj->GetNext() )
+/*N*/ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+/*N*/ if ( pObj->GetPrev() )
+/*N*/ pObj->GetPrev()->SetNext( pObj->GetNext() );
+/*N*/ }
+/*N*/
+/*N*/ //Am (virtuellen) Anfang einfuegen.
+/*N*/ if ( pRealFirst == pFirst )
+/*N*/ {
+/*N*/ pRealFirst->SetPrev( pObj );
+/*N*/ pObj->SetNext( pRealFirst );
+/*N*/ pObj->SetPrev( 0 );
+/*N*/ pRealFirst = pFirst = pObj;
+/*N*/ CHECK;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( pFirst, "ToTop, First ist not RealFirst an Empty." );
+/*N*/
+/*N*/ if ( pFirst->GetPrev() )
+/*N*/ {
+/*N*/ pFirst->GetPrev()->SetNext( pObj );
+/*N*/ pObj->SetPrev( pFirst->GetPrev() );
+/*N*/ }
+/*N*/ else
+/*?*/ pObj->SetPrev( 0 );
+/*N*/ pFirst->SetPrev( pObj );
+/*N*/ pObj->SetNext( pFirst );
+/*N*/ pFirst = pObj;
+/*N*/ CHECK;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCache::Get()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 22. Aug. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ SwCacheObj *SwCache::Get( const void *pOwner, const USHORT nIndex,
+/*N*/ const BOOL bToTop )
+/*N*/ {
+/*N*/ SwCacheObj *pRet;
+/*N*/ if ( 0 != (pRet = nIndex < Count() ? operator[]( nIndex ) : 0) )
+/*N*/ {
+/*N*/ if ( !pRet->IsOwner( pOwner ) )
+/*N*/ pRet = 0;
+/*N*/ else if ( bToTop && pRet != pFirst )
+/*N*/ ToTop( pRet );
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( pRet )
+/*N*/ ++nGetSuccess;
+/*N*/ else
+/*N*/ ++nGetFail;
+/*N*/ #endif
+/*N*/
+/*N*/ return pRet;
+/*N*/ }
+
+
+
+/*N*/ SwCacheObj *SwCache::Get( const void *pOwner, const BOOL bToTop )
+/*N*/ {
+/*N*/ SwCacheObj *pRet = pRealFirst;
+/*N*/ while ( pRet && !pRet->IsOwner( pOwner ) )
+/*N*/ {
+/*N*/ INCREMENT( nAverageSeekCnt );
+/*N*/ pRet = pRet->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if ( bToTop && pRet && pRet != pFirst )
+/*N*/ ToTop( pRet );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( pRet )
+/*N*/ ++nGetSuccess;
+/*N*/ else
+/*N*/ ++nGetFail;
+/*N*/ ++nGetSeek;
+/*N*/ #endif
+/*N*/ return pRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCache::Delete()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwCache::DeleteObj( SwCacheObj *pObj )
+/*N*/ {
+/*N*/ CHECK;
+/*N*/ ASSERT( !pObj->IsLocked(), "SwCache::Delete: Object ist Locked." );
+/*N*/ if ( pObj->IsLocked() )
+/*N*/ return;
+/*N*/
+/*N*/ if ( pFirst == pObj )
+/*N*/ {
+/*N*/ if ( pFirst->GetNext() )
+/*N*/ pFirst = pFirst->GetNext();
+/*N*/ else
+/*N*/ pFirst = pFirst->GetPrev();
+/*N*/ }
+/*N*/ if ( pRealFirst == pObj )
+/*N*/ pRealFirst = pRealFirst->GetNext();
+/*N*/ if ( pLast == pObj )
+/*N*/ pLast = pLast->GetPrev();
+/*N*/ if ( pObj->GetPrev() )
+/*N*/ pObj->GetPrev()->SetNext( pObj->GetNext() );
+/*N*/ if ( pObj->GetNext() )
+/*N*/ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+/*N*/
+/*N*/ aFreePositions.Insert( pObj->GetCachePos(), aFreePositions.Count() );
+/*N*/ *(pData + pObj->GetCachePos()) = (void*)0;
+/*N*/ delete pObj;
+/*N*/
+/*N*/ CHECK;
+/*N*/ if ( Count() > nCurMax &&
+/*N*/ (nCurMax <= (Count() - aFreePositions.Count())) )
+/*N*/ {
+/*N*/ //Falls moeglich wieder verkleinern, dazu muessen allerdings ausreichend
+/*N*/ //Freie Positionen bereitstehen.
+/*N*/ //Unangenehmer Nebeneffekt ist, das die Positionen verschoben werden
+/*N*/ //muessen, und die Eigentuemer der Objekte diese wahrscheinlich nicht
+/*N*/ //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() );
+/*N*/ }
+/*N*/ CHECK;
+/*N*/ }
+
+/*
+
+
+void SwCache::Delete( const void *pOwner, const USHORT nIndex )
+{
+ INCREMENT( nDelete );
+ SwCacheObj *pObj;
+ if ( 0 != (pObj = Get( pOwner, nIndex, FALSE )) )
+ DeleteObj( pObj );
+}
+*/
+
+
+
+/*N*/ void SwCache::Delete( const void *pOwner )
+/*N*/ {
+/*N*/ INCREMENT( nDelete );
+/*N*/ SwCacheObj *pObj;
+/*N*/ if ( 0 != (pObj = Get( pOwner, BOOL(FALSE) )) )
+/*N*/ DeleteObj( pObj );
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwCache::Insert()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 20. Sep. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwCache::Insert( SwCacheObj *pNew )
+/*N*/ {
+/*N*/ CHECK;
+/*N*/ ASSERT( !pNew->GetPrev() && !pNew->GetNext(), "New but not new." );
+/*N*/
+/*N*/ USHORT nPos;//Wird hinter den if's zum setzen am Obj benutzt.
+/*N*/ if ( Count() < nCurMax )
+/*N*/ {
+/*N*/ //Es ist noch Platz frei, also einfach einfuegen.
+/*N*/ INCREMENT( nAppend );
+/*N*/ nPos = Count();
+/*N*/ SwCacheObjArr::C40_INSERT( SwCacheObj, pNew, nPos );
+/*N*/ }
+/*N*/ else if ( aFreePositions.Count() )
+/*N*/ {
+/*N*/ //Es exitieren Platzhalter, also den letzten benutzen.
+/*N*/ INCREMENT( nInsertFree );
+/*N*/ const USHORT nFreePos = aFreePositions.Count() - 1;
+/*N*/ nPos = aFreePositions[ nFreePos ];
+/*N*/ *(pData + nPos) = pNew;
+/*N*/ aFreePositions.Remove( nFreePos );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ INCREMENT( nReplace );
+/*N*/ //Der letzte des LRU fliegt raus.
+/*N*/ SwCacheObj *pObj = pLast;
+/*N*/
+/*N*/ while ( pObj && pObj->IsLocked() )
+/*N*/ pObj = pObj->GetPrev();
+/*N*/ if ( !pObj )
+/*N*/ {
+/*N*/ ASSERT( FALSE, "Cache overflow." );
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/ nPos = pObj->GetCachePos();
+/*N*/ if ( pObj == pLast )
+/*N*/ { ASSERT( pObj->GetPrev(), "Last but no Prev" );
+/*N*/ pLast = pObj->GetPrev();
+/*N*/ pLast->SetNext( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( pObj->GetPrev() )
+/*N*/ pObj->GetPrev()->SetNext( pObj->GetNext() );
+/*N*/ if ( pObj->GetNext() )
+/*N*/ pObj->GetNext()->SetPrev( pObj->GetPrev() );
+/*N*/ }
+/*N*/ delete pObj;
+/*N*/ *(pData + nPos) = pNew;
+/*N*/ }
+/*N*/ pNew->SetCachePos( nPos );
+/*N*/
+/*N*/ //Anstelle von ToTop, einfach als pFirst einfuegen.
+/*N*/ // ToTop( nPos );
+/*N*/ if ( pFirst )
+/*N*/ {
+/*N*/ if ( pFirst->GetPrev() )
+/*N*/ { pFirst->GetPrev()->SetNext( pNew );
+/*N*/ pNew->SetPrev( pFirst->GetPrev() );
+/*N*/ }
+/*N*/ pFirst->SetPrev( pNew );
+/*N*/ pNew->SetNext( pFirst );
+/*N*/ }
+/*N*/ else
+/*N*/ { ASSERT( !pLast, "Last but no First." );
+/*N*/ pLast = pNew;
+/*N*/ }
+/*N*/ if ( pFirst == pRealFirst )
+/*N*/ pRealFirst = pNew;
+/*N*/ pFirst = pNew;
+/*N*/
+/*N*/ CHECK;
+/*N*/ return TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCache::SetLRUOfst()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwCache::SetLRUOfst( const USHORT nOfst )
+/*N*/ {
+/*N*/ if ( !pRealFirst || ((Count() - aFreePositions.Count()) < nOfst) )
+/*N*/ return;
+/*N*/
+/*N*/ CHECK;
+/*N*/ pFirst = pRealFirst;
+/*N*/ for ( USHORT i = 0; i < Count() && i < nOfst; ++i )
+/*N*/ {
+/*N*/ if ( pFirst->GetNext() && pFirst->GetNext()->GetNext() )
+/*N*/ pFirst = pFirst->GetNext();
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ CHECK;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCacheObj::SwCacheObj()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 24. Nov. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ SwCacheObj::SwCacheObj( const void *pOwn ) :
+/*N*/ nLock( 0 ),
+/*N*/ nCachePos( USHRT_MAX ),
+/*N*/ pNext( 0 ),
+/*N*/ pPrev( 0 ),
+/*N*/ pOwner( pOwn )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwCacheObj::~SwCacheObj()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCacheObj::SetLock(), Unlock()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 15. Mar. 94
+|*
+|*************************************************************************/
+
+#ifdef DBG_UTIL
+
+
+
+/*N*/ void SwCacheObj::Lock()
+/*N*/ {
+/*N*/ ASSERT( nLock < UCHAR_MAX, "To many Locks for CacheObject." );
+/*N*/ ++nLock;
+/*N*/ }
+
+
+
+/*N*/ void SwCacheObj::Unlock()
+/*N*/ {
+/*N*/ ASSERT( nLock, "No more Locks available." );
+/*N*/ --nLock;
+/*N*/ }
+#endif
+
+/*************************************************************************
+|*
+|* SwCacheAccess::Get()
+|*
+|* Ersterstellung MA 15. Mar. 94
+|* Letzte Aenderung MA 04. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwCacheAccess::_Get()
+/*N*/ {
+/*N*/ ASSERT( !pObj, "SwCacheAcces Obj already available." );
+/*N*/
+/*N*/ pObj = NewObj();
+/*N*/ if ( !rCache.Insert( pObj ) )
+/*N*/ {
+/*?*/ delete pObj;
+/*?*/ pObj = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ pObj->Lock();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCacheAccess::IsAvailable()
+|*
+|* Ersterstellung MA 23. Mar. 94
+|* Letzte Aenderung MA 23. Mar. 94
+|*
+|*************************************************************************/
+
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_swrect.cxx b/binfilter/bf_sw/source/core/bastyp/sw_swrect.cxx
new file mode 100644
index 000000000000..872138491824
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_swrect.cxx
@@ -0,0 +1,320 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#ifdef DBG_UTIL
+#endif
+#include <stdlib.h>
+#include "swrect.hxx"
+
+
+/*************************************************************************
+|*
+|* SwRect::SwRect()
+|*
+|* Ersterstellung MA 02. Feb. 93
+|* Letzte Aenderung MA 05. Sep. 93
+|*
+|*************************************************************************/
+#include <tools/debug.hxx>
+namespace binfilter {
+/*N*/ SwRect::SwRect( const Rectangle &rRect ) :
+/*N*/ nX( rRect.Left() ),
+/*N*/ nY( rRect.Top() )
+/*N*/ {
+/*N*/ nWidth = rRect.Right() == RECT_EMPTY ? 0 :
+/*N*/ rRect.Right() - rRect.Left() +1;
+/*N*/ nHeight = rRect.Bottom() == RECT_EMPTY ? 0 :
+/*N*/ rRect.Bottom() - rRect.Top() + 1;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRect::Center()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+/*N*/ Point SwRect::Center() const
+/*N*/ {
+/*N*/ return Point( Left() + Width() / 2,
+/*N*/ 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)));
+*/
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRect::Union()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+
+
+
+/*N*/ SwRect& SwRect::Union( const SwRect& rRect )
+/*N*/ {
+/*N*/ if ( Top() > rRect.Top() )
+/*N*/ Top( rRect.Top() );
+/*N*/ if ( Left() > rRect.Left() )
+/*N*/ Left( rRect.Left() );
+/*N*/ register long n = rRect.Right();
+/*N*/ if ( Right() < n )
+/*N*/ Right( n );
+/*N*/ n = rRect.Bottom();
+/*N*/ if ( Bottom() < n )
+/*N*/ Bottom( n );
+/*N*/ return *this;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwRect::Intersection(), _Intersection()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 05. Sep. 93
+|*
+|*************************************************************************/
+
+
+
+/*N*/ SwRect& SwRect::Intersection( const SwRect& rRect )
+/*N*/ {
+/*N*/ //Hat das Teil ueberhaupt Gemeinsamkeiten mit mir?
+/*N*/ if ( IsOver( rRect ) )
+/*N*/ {
+/*N*/ //Bestimmung der kleineren rechten sowie unteren und
+/*N*/ // der groesseren linken sowie oberen Kante.
+/*N*/ if ( Left() < rRect.Left() )
+/*N*/ Left( rRect.Left() );
+/*N*/ if ( Top() < rRect.Top() )
+/*?*/ Top( rRect.Top() );
+/*N*/ register long n = rRect.Right();
+/*N*/ if ( Right() > n )
+/*N*/ Right( n );
+/*N*/ n = rRect.Bottom();
+/*N*/ if ( Bottom() > n )
+/*?*/ Bottom( n );
+/*N*/ }
+/*N*/ else
+/*N*/ //Def.: Bei einer leeren Intersection wird nur die SSize genullt.
+/*N*/ nHeight = nWidth = 0;
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+
+/*N*/ SwRect& SwRect::_Intersection( const SwRect& rRect )
+/*N*/ {
+/*N*/ //Bestimmung der kleineren rechten sowie unteren und
+/*N*/ // der groesseren linken sowie oberen Kante.
+/*N*/ if ( Left() < rRect.Left() )
+/*N*/ Left( rRect.Left() );
+/*N*/ if ( Top() < rRect.Top() )
+/*N*/ Top( rRect.Top() );
+/*N*/ register long n = rRect.Right();
+/*N*/ if ( Right() > n )
+/*N*/ Right( n );
+/*N*/ n = rRect.Bottom();
+/*N*/ if ( Bottom() > n )
+/*N*/ Bottom( n );
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwRect::IsInside()
+|*
+|* Ersterstellung MA 27. Jan. 93
+|* Letzte Aenderung MA 27. Jan. 93
+|*
+|*************************************************************************/
+
+
+
+/*N*/ BOOL SwRect::IsInside( const SwRect& rRect ) const
+/*N*/ {
+/*N*/ const long nRight = Right();
+/*N*/ const long nBottom = Bottom();
+/*N*/ const long nrRight = rRect.Right();
+/*N*/ const long nrBottom= rRect.Bottom();
+/*N*/ return (Left() <= rRect.Left()) && (rRect.Left()<= nRight) &&
+/*N*/ (Left() <= nrRight) && (nrRight <= nRight) &&
+/*N*/ (Top() <= rRect.Top()) && (rRect.Top() <= nBottom) &&
+/*N*/ (Top() <= nrBottom) && (nrBottom <= nBottom);
+/*N*/ }
+
+
+
+/*N*/ BOOL SwRect::IsInside( const Point& rPoint ) const
+/*N*/ {
+/*N*/ return (Left() <= rPoint.X())
+/*N*/ && (Top() <= rPoint.Y())
+/*N*/ && (Right() >= rPoint.X())
+/*N*/ && (Bottom()>= rPoint.Y());
+/*N*/ }
+/* -----------------------------11.04.00 15:46--------------------------------
+ mouse moving of table borders
+ ---------------------------------------------------------------------------*/
+
+/*************************************************************************
+|*
+|* SwRect::IsOver()
+|*
+|* Ersterstellung MA 25. Feb. 94
+|* Letzte Aenderung MA 27. Jun. 96
+|*
+|*************************************************************************/
+
+
+
+/*N*/ BOOL SwRect::IsOver( const SwRect& rRect ) const
+/*N*/ {
+/*N*/ return (Top() <= rRect.Bottom())
+/*N*/ && (Left() <= rRect.Right())
+/*N*/ && (Right() >= rRect.Left())
+/*N*/ && (Bottom()>= rRect.Top()) ? TRUE : FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRect::Justify()
+|*
+|* Ersterstellung MA 10. Oct. 94
+|* Letzte Aenderung MA 23. Oct. 96
+|*
+|*************************************************************************/
+
+
+
+/*N*/ void SwRect::Justify()
+/*N*/ {
+/*N*/ if ( nHeight < 0 )
+/*N*/ {
+/*N*/ nY = nY + nHeight + 1;
+/*N*/ nHeight = -nHeight;
+/*N*/ }
+/*N*/ if ( nWidth < 0 )
+/*N*/ {
+/*N*/ nX = nX + nWidth + 1;
+/*N*/ nWidth = -nWidth;
+/*N*/ }
+/*N*/ }
+
+
+#ifdef VERTICAL_LAYOUT
+
+// Similiar to the inline methods, but we need the function pointers
+
+/*N*/ void SwRect::_Width( const long nNew ) { nWidth = nNew; }
+/*N*/ void SwRect::_Height( const long nNew ) { nHeight = nNew; }
+/*N*/ void SwRect::_Left( const long nLeft ){ nWidth += nX - nLeft; nX = nLeft; }
+/*N*/ void SwRect::_Right( const long nRight ){ nWidth = nRight - nX; }
+/*N*/ void SwRect::_Top( const long nTop ){ nHeight += nY - nTop; nY = nTop; }
+/*N*/ void SwRect::_Bottom( const long nBottom ){ nHeight = nBottom - nY; }
+/*N*/
+/*N*/ long SwRect::_Width() const{ return nWidth; }
+/*N*/ long SwRect::_Height() const{ return nHeight; }
+/*N*/ long SwRect::_Left() const{ return nX; }
+/*N*/ long SwRect::_Right() const{ return nX + nWidth; }
+/*N*/ long SwRect::_Top() const{ return nY; }
+/*N*/ long SwRect::_Bottom() const{ return nY + nHeight; }
+
+/*N*/ void SwRect::AddWidth( const long nAdd ) { nWidth += nAdd; }
+/*N*/ void SwRect::AddHeight( const long nAdd ) { nHeight += nAdd; }
+/*N*/ void SwRect::SubLeft( const long nSub ){ nWidth += nSub; nX -= nSub; }
+/*N*/ void SwRect::AddRight( const long nAdd ){ nWidth += nAdd; }
+/*N*/ void SwRect::SubTop( const long nSub ){ nHeight += nSub; nY -= nSub; }
+/*N*/ void SwRect::AddBottom( const long nAdd ){ nHeight += nAdd; }
+/*N*/ void SwRect::SetPosX( const long nNew ){ nX = nNew; }
+/*N*/ void SwRect::SetPosY( const long nNew ){ nY = nNew; }
+/*N*/ const Size SwRect::_Size() const { return SSize(); }
+/*N*/ const Size SwRect::SwappedSize() const { return Size( nHeight, nWidth ); }
+/*N*/ const Point SwRect::TopLeft() const { return Pos(); }
+/*N*/ const Point SwRect::TopRight() const { return Point( nX + nWidth, nY ); }
+/*N*/ const Point SwRect::BottomLeft() const { return Point( nX, nY + nHeight ); }
+/*N*/ const Point SwRect::BottomRight() const
+/*N*/ { return Point( nX + nWidth, nY + nHeight ); }
+/*N*/ long SwRect::GetLeftDistance( long nLimit ) const { return nX - nLimit; }
+/*N*/ long SwRect::GetBottomDistance( long nLim ) const { return nLim - nY - nHeight;}
+/*N*/ long SwRect::GetTopDistance( long nLimit ) const { return nY - nLimit; }
+/*N*/ long SwRect::GetRightDistance( long nLim ) const { return nLim - nX - nWidth; }
+/*N*/ BOOL SwRect::OverStepLeft( long nLimit ) const
+/*N*/ { return nLimit > nX && nX + nWidth > nLimit; }
+/*N*/ BOOL SwRect::OverStepBottom( long nLimit ) const
+/*N*/ { return nLimit > nY && nY + nHeight > nLimit; }
+/*N*/ BOOL SwRect::OverStepTop( long nLimit ) const
+/*N*/ { return nLimit > nY && nY + nHeight > nLimit; }
+/*N*/ BOOL SwRect::OverStepRight( long nLimit ) const
+/*N*/ { return nLimit > nX && nX + nWidth > nLimit; }
+/*N*/ void SwRect::SetLeftAndWidth( long nLeft, long nNew )
+/*N*/ { nX = nLeft; nWidth = nNew; }
+/*N*/ void SwRect::SetTopAndHeight( long nTop, long nNew )
+/*N*/ { nY = nTop; nHeight = nNew; }
+/*N*/ void SwRect::SetRightAndWidth( long nRight, long nNew )
+/*N*/ { nX = nRight - nNew; nWidth = nNew; }
+/*N*/ void SwRect::SetBottomAndHeight( long nBottom, long nNew )
+/*N*/ { nY = nBottom - nNew; nHeight = nNew; }
+/*N*/ void SwRect::SetUpperLeftCorner( const Point& rNew )
+/*N*/ { nX = rNew.nA; nY = rNew.nB; }
+/*N*/ void SwRect::SetUpperRightCorner( const Point& rNew )
+/*N*/ { nX = rNew.nA - nWidth; nY = rNew.nB; }
+/*N*/ void SwRect::SetLowerLeftCorner( const Point& rNew )
+/*N*/ { nX = rNew.nA; nY = rNew.nB - nHeight; }
+#endif
+
+#ifdef DBG_UTIL
+/*************************************************************************
+ * operator<<( ostream&, SwRect&)
+ *************************************************************************/
+
+
+
+/*N*/ SvStream &operator<<( SvStream &rStream, const SwRect &rRect )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 rStream << '[' << rRect.Top() << '/' << rRect.Left()
+/*N*/ return rStream;
+/*N*/ }
+#endif
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_swregion.cxx b/binfilter/bf_sw/source/core/bastyp/sw_swregion.cxx
new file mode 100644
index 000000000000..6cbdd6c49f7f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_swregion.cxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <tools/debug.hxx>
+#include "swregion.hxx"
+namespace binfilter {
+
+
+/*N*/ SV_IMPL_VARARR( SwRects, SwRect );
+
+/*************************************************************************
+|*
+|* SwRegionRects::SwRegionRects()
+|*
+|* Ersterstellung MA 28. Oct. 92
+|* Letzte Aenderung MA 01. Feb. 93
+|*
+|*************************************************************************/
+
+/*N*/ SwRegionRects::SwRegionRects( const SwRect &rStartRect, USHORT nInit,
+/*N*/ USHORT nGrow ) :
+/*N*/ SwRects( (BYTE)nInit, (BYTE)nGrow ),
+/*N*/ aOrigin( rStartRect )
+/*N*/ {
+/*N*/ Insert( aOrigin, 0 );
+/*N*/ }
+
+/*************************************************************************
+ * 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.
+ *************************************************************************/
+
+/*N*/ inline void SwRegionRects::InsertRect( const SwRect &rRect, const USHORT nPos,
+/*N*/ FASTBOOL &rDel )
+/*N*/ {
+/*N*/ if( rDel )
+/*N*/ {
+/*N*/ *(pData+nPos) = rRect;
+/*N*/ rDel = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ Insert( rRect, Count() );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* 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
+|*
+|*************************************************************************/
+
+/*N*/ void SwRegionRects::operator-=( const SwRect &rRect )
+/*N*/ {
+/*N*/ USHORT nMax = Count();
+/*N*/ for ( USHORT i = 0; i < nMax; ++i )
+/*N*/ {
+/*N*/ if ( rRect.IsOver( *(pData+i) ) )
+/*N*/ {
+/*N*/ SwRect aTmp( *(pData+i) );
+/*N*/ SwRect aInter( aTmp );
+/*N*/ aInter._Intersection( rRect );
+/*N*/
+/*N*/ // Das erste Rect, das wir inserten wollen, nimmt die
+/*N*/ // Stelle von i ein. So ersparen wir uns das Delete().
+/*N*/ FASTBOOL bDel = TRUE;
+/*N*/
+/*N*/ //Jetzt aufteilen das Teil: Es sollen diejenigen Rechtecke
+/*N*/ //zurueckbleiben, die im alten aber nicht im neuen liegen.
+/*N*/ //Sprich alle Rechtecke die im alten aber nicht in der Intersection
+/*N*/ //liegen.
+/*N*/ long nTmp;
+/*N*/ if ( 0 < (nTmp = aInter.Top() - aTmp.Top()) )
+/*N*/ {
+/*N*/ const long nOldVal = aTmp.Height();
+/*N*/ aTmp.SSize().Height() = nTmp;
+/*N*/ InsertRect( aTmp, i, bDel );
+/*N*/ aTmp.Height( nOldVal );
+/*N*/ }
+/*N*/
+/*N*/ aTmp.Top( aInter.Top() + aInter.Height() );
+/*N*/ if ( aTmp.Height() > 0 )
+/*N*/ InsertRect( aTmp, i, bDel );
+/*N*/
+/*N*/ aTmp.Top( aInter.Top() );
+/*N*/ aTmp.Bottom( aInter.Bottom() );
+/*N*/ if ( 0 < (nTmp = aInter.Left() - aTmp.Left()) )
+/*N*/ {
+/*N*/ const long nOldVal = aTmp.Width();
+/*N*/ aTmp.Width( nTmp );
+/*N*/ InsertRect( aTmp, i, bDel );
+/*N*/ aTmp.Width( nOldVal );
+/*N*/ }
+/*N*/
+/*N*/ aTmp.Left( aInter.Left() + aInter.Width() ); //+1?
+/*N*/ if ( aTmp.Width() > 0 )
+/*N*/ InsertRect( aTmp, i, bDel );
+/*N*/
+/*N*/ if( bDel )
+/*N*/ {
+/*N*/ Remove( i );
+/*N*/ --i; //Damit wir keinen uebergehen.
+/*N*/ --nMax; //Damit wir keinen zuviel verarbeiten.
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ }
+
+/*************************************************************************
+ * 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.
+ *************************************************************************/
+
+/*************************************************************************
+|*
+|* SwRegionRects::Compress()
+|*
+|* Beschreibung Zusammenfassen von benachbarten Rechtecken.
+|* Ersterstellung MA 16. Apr. 93
+|* Letzte Aenderung MA 21. Apr. 93
+|*
+|*************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma optimize("e",off)
+#endif
+#ifdef _MSC_VER
+#pragma optimize("",on)
+#endif
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/bastyp/sw_swtypes.cxx b/binfilter/bf_sw/source/core/bastyp/sw_swtypes.cxx
new file mode 100644
index 000000000000..198f2a8b05bf
--- /dev/null
+++ b/binfilter/bf_sw/source/core/bastyp/sw_swtypes.cxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <vcl/window.hxx>
+#include <vcl/graph.hxx>
+#include <bf_offmgr/app.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <bf_svx/unolingu.hxx>
+
+#include <pagefrm.hxx>
+#include <frmtool.hxx>
+#include <ndtxt.hxx>
+#include <viscrs.hxx>
+#include <fntcache.hxx>
+#include <swfntcch.hxx>
+#include <hffrm.hxx>
+#include <colfrm.hxx>
+#include <bodyfrm.hxx>
+#include <tabfrm.hxx>
+#include <txtfrm.hxx>
+#include <swtblfmt.hxx>
+#include <rowfrm.hxx>
+#include <cellfrm.hxx>
+#include <sectfrm.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::comphelper;
+
+#ifndef PROFILE
+// Code zum Initialisieren von Statics im eigenen Code-Segment
+#ifdef _MSC_VER
+#pragma code_seg( "SWSTATICS" )
+#endif
+#endif
+
+//STRIP001 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( 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 )
+IMPL_FIXEDMEMPOOL_NEWDEL( _SwCursor_SavePos, 20, 20 )
+
+
+#ifndef PROFILE
+#ifdef _MSC_VER
+#pragma code_seg()
+#endif
+#endif
+
+/*N*/ Size GetGraphicSizeTwip( const Graphic& rGraphic, OutputDevice* pOutDev )
+/*N*/ {
+/*N*/ const MapMode aMapTwip( MAP_TWIP );
+/*N*/ Size aSize( rGraphic.GetPrefSize() );
+/*N*/ if( MAP_PIXEL == rGraphic.GetPrefMapMode().GetMapUnit() )
+/*N*/ {
+/*N*/ if( !pOutDev )
+/*N*/ pOutDev = Application::GetDefaultDevice();
+/*N*/ aSize = pOutDev->PixelToLogic( aSize, aMapTwip );
+/*N*/ }
+/*N*/ else
+/*N*/ aSize = OutputDevice::LogicToLogic( aSize,
+/*N*/ rGraphic.GetPrefMapMode(), aMapTwip );
+/*N*/ return aSize;
+/*N*/ }
+
+
+/*N*/ Locale CreateLocale( LanguageType eLanguage )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); Locale temp; return temp;//STRIP001 String aLangStr, aCtryStr;
+/*N*/ }
+
+
+/*N*/ Reference< XHyphenator > GetHyphenator()
+/*N*/ {
+/*N*/ return LinguMgr::GetHyphenator();
+/*N*/ }
+
+
+/*N*/ Reference< XDictionaryList > GetDictionaryList()
+/*N*/ {
+/*N*/ return LinguMgr::GetDictionaryList();
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/callnk.hxx b/binfilter/bf_sw/source/core/crsr/callnk.hxx
new file mode 100644
index 000000000000..5b6133ad4e43
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/callnk.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CALLNK_HXX
+#define _CALLNK_HXX
+
+#include <tools/solar.h>
+namespace binfilter {
+
+class SwCrsrShell;
+class SwTxtNode;
+
+class SwCallLink
+{
+public:
+ SwCrsrShell & rShell;
+ ULONG nNode;
+ xub_StrLen nCntnt;
+ BYTE nNdTyp;
+ long nLeftFrmPos;
+ bool bHasSelection;
+
+ SwCallLink( SwCrsrShell & rSh );
+ ~SwCallLink();
+
+ static long GetFrm( SwTxtNode& rNd, xub_StrLen nCntPos, BOOL bCalcFrm );
+};
+
+
+
+} //namespace binfilter
+#endif // _CALLNK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/makefile.mk b/binfilter/bf_sw/source/core/crsr/makefile.mk
new file mode 100644
index 000000000000..836dff749045
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_crsr
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+.IF "$(mydebug)" != ""
+CDEFS+=-Dmydebug
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_bookmrk.obj \
+ $(SLO)$/sw_callnk.obj \
+ $(SLO)$/sw_crbm.obj \
+ $(SLO)$/sw_crsrsh.obj \
+ $(SLO)$/sw_findattr.obj \
+ $(SLO)$/sw_findcoll.obj \
+ $(SLO)$/sw_findtxt.obj \
+ $(SLO)$/sw_pam.obj \
+ $(SLO)$/sw_paminit.obj \
+ $(SLO)$/sw_swcrsr.obj \
+ $(SLO)$/sw_trvlreg.obj \
+ $(SLO)$/sw_trvltbl.obj \
+ $(SLO)$/sw_unocrsr.obj \
+ $(SLO)$/sw_viscrs.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/binfilter/bf_sw/source/core/crsr/sw_bookmrk.cxx b/binfilter/bf_sw/source/core/crsr/sw_bookmrk.cxx
new file mode 100644
index 000000000000..2a590ea6b1e4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_bookmrk.cxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+
+#include <errhdl.hxx>
+
+#include <pam.hxx>
+#include <bookmrk.hxx>
+#include <swserv.hxx>
+
+#include <errhdl.hxx>
+namespace binfilter {
+
+/*N*/ SV_IMPL_REF( SwServerObject )
+
+/*N*/ SwBookmark::SwBookmark(const SwPosition& aPos, const KeyCode& rCode,
+/*N*/ const String& rName, const String& rShortName )
+/*N*/ : SwModify( 0 ),
+/*N*/ aStartMacro( aEmptyStr, aEmptyStr ),
+/*N*/ aEndMacro ( aEmptyStr, aEmptyStr ),
+/*N*/ aCode(rCode),
+/*N*/ aName(rName),
+/*N*/ aShortName(rShortName),
+/*N*/ pPos2( 0 ),
+/*N*/ eMarkType( BOOKMARK )
+/*N*/ {
+/*N*/ pPos1 = new SwPosition(aPos);
+/*N*/ }
+
+// Beim Loeschen von Text werden Bookmarks mitgeloescht!
+
+
+/*N*/ SwBookmark::~SwBookmark()
+/*N*/ {
+/*N*/ // falls wir noch der DDE-Bookmark sind, dann muss der aus dem
+/*N*/ // Clipboard ausgetragen werden. Wird automatisch ueber DataChanged
+/*N*/ // ausgeloest.
+/*N*/ if( refObj.Is() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ delete pPos1;
+/*N*/ if( pPos2 )
+/*N*/ delete pPos2;
+/*N*/ }
+
+// Vergleiche auf Basis der Dokumentposition
+
+/*N*/ BOOL SwBookmark::operator<(const SwBookmark &rBM) const
+/*N*/ {
+/*N*/ const SwPosition* pThisPos = ( !pPos2 || *pPos1 <= *pPos2 ) ? pPos1 : pPos2;
+/*N*/ const SwPosition* pBMPos = ( !rBM.pPos2 || *rBM.pPos1 <= *rBM.pPos2 )
+/*N*/ ? rBM.pPos1 : rBM.pPos2;
+/*N*/
+/*N*/ return *pThisPos < *pBMPos;
+/*N*/ }
+
+/*N*/ BOOL SwBookmark::operator==(const SwBookmark &rBM) const
+/*N*/ {
+/*N*/ return (this == &rBM);
+/*N*/ }
+
+/*N*/ SwUNOMark::SwUNOMark( const SwPosition& aPos,
+/*N*/ const KeyCode& rCode,
+/*N*/ const String& rName,
+/*N*/ const String& rShortName )
+/*N*/ : SwBookmark( aPos, rCode, rName, rShortName )
+/*N*/ {
+/*N*/ eMarkType = UNO_BOOKMARK;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_callnk.cxx b/binfilter/bf_sw/source/core/crsr/sw_callnk.cxx
new file mode 100644
index 000000000000..3f533a0946cf
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_callnk.cxx
@@ -0,0 +1,260 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <fmtcntnt.hxx>
+#include <txatbase.hxx>
+#include <viscrs.hxx>
+#include <callnk.hxx>
+
+#include <horiornt.hxx>
+
+#include <crsrsh.hxx>
+#include <frmfmt.hxx>
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <flyfrm.hxx>
+#include <breakit.hxx>
+namespace binfilter {
+
+
+/*N*/ SwCallLink::SwCallLink( SwCrsrShell & rSh )
+/*N*/ : rShell( rSh )
+/*N*/ {
+ // SPoint-Werte vom aktuellen Cursor merken
+/*N*/ SwPaM* pCrsr = rShell.IsTableMode() ? rShell.GetTblCrs() : rShell.GetCrsr();
+/*N*/ SwNode& rNd = pCrsr->GetPoint()->nNode.GetNode();
+/*N*/ nNode = rNd.GetIndex();
+/*N*/ nCntnt = pCrsr->GetPoint()->nContent.GetIndex();
+/*N*/ nNdTyp = rNd.GetNodeType();
+/*N*/ bHasSelection = ( *pCrsr->GetPoint() != *pCrsr->GetMark() );
+/*N*/
+/*N*/ if( ND_TEXTNODE & nNdTyp )
+/*N*/ nLeftFrmPos = SwCallLink::GetFrm( (SwTxtNode&)rNd, nCntnt,
+/*N*/ !rShell.ActionPend() );
+/*N*/ else
+/*N*/ {
+/*?*/ 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;
+/*N*/ }
+/*N*/ }
+
+
+/*M*/ SwCallLink::~SwCallLink()
+/*M*/ {
+/*M*/ if( !nNdTyp || !rShell.bCallChgLnk ) // siehe ctor
+/*M*/ return ;
+/*M*/
+/*M*/ // wird ueber Nodes getravellt, Formate ueberpruefen und im neuen
+/*M*/ // Node wieder anmelden
+/*M*/ SwPaM* pCurCrsr = rShell.IsTableMode() ? rShell.GetTblCrs() : rShell.GetCrsr();
+/*M*/ SwCntntNode * pCNd = pCurCrsr->GetCntntNode();
+/*M*/ if( !pCNd )
+/*M*/ return;
+/*M*/
+/*M*/ xub_StrLen nCmp, nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
+/*M*/ USHORT nNdWhich = pCNd->GetNodeType();
+/*M*/ ULONG nAktNode = pCurCrsr->GetPoint()->nNode.GetIndex();
+/*M*/
+/*M*/ // melde die Shell beim akt. Node als abhaengig an, dadurch koennen
+/*M*/ // alle Attribut-Aenderungen ueber den Link weiter gemeldet werden.
+/*M*/ pCNd->Add( &rShell );
+/*M*/
+/*M*/ if( nNdTyp != nNdWhich || nNode != nAktNode )
+/*M*/ {
+ /* 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
+ */
+/*M*/ rShell.CallChgLnk();
+/*M*/ }
+/*N*/ else if( bHasSelection != (*pCurCrsr->GetPoint() != *pCurCrsr->GetMark()) )
+/*N*/ {
+/*N*/ // always call change link when selection changes
+/*N*/ rShell.CallChgLnk();
+/*N*/ }
+/*M*/ else if( rShell.aChgLnk.IsSet() && ND_TEXTNODE == nNdWhich &&
+/*M*/ nCntnt != nAktCntnt )
+/*M*/ {
+/*M*/ // nur wenn mit Left/right getravellt, dann Text-Hints pruefen
+/*M*/ // und sich nicht der Frame geaendert hat (Spalten!)
+/*M*/ if( nLeftFrmPos == SwCallLink::GetFrm( (SwTxtNode&)*pCNd, nAktCntnt,
+/*M*/ !rShell.ActionPend() ) &&
+/*M*/ (( nCmp = nCntnt ) + 1 == nAktCntnt || // Right
+/*M*/ nCntnt -1 == ( nCmp = nAktCntnt )) ) // Left
+/*M*/ {
+/*M*/ if( nCmp == nAktCntnt && pCurCrsr->HasMark() ) // left & Sele
+/*M*/ ++nCmp;
+/*M*/ if ( ((SwTxtNode*)pCNd)->HasHints() )
+/*M*/ {
+/*M*/
+/*M*/ const SwpHints &rHts = ((SwTxtNode*)pCNd)->GetSwpHints();
+/*M*/ USHORT n;
+/*M*/ xub_StrLen nStart;
+/*M*/ const xub_StrLen *pEnd;
+/*M*/
+/*M*/ for( n = 0; n < rHts.Count(); n++ )
+/*M*/ {
+/*M*/ const SwTxtAttr* pHt = rHts[ n ];
+/*M*/ pEnd = pHt->GetEnd();
+/*M*/ nStart = *pHt->GetStart();
+/*M*/
+/*M*/ // nur Start oder Start und Ende gleich, dann immer
+/*M*/ // beim Ueberlaufen von Start callen
+/*M*/ if( ( !pEnd || ( nStart == *pEnd ) ) &&
+/*M*/ ( nStart == nCntnt || nStart == nAktCntnt) )
+/*M*/ {
+/*M*/ rShell.CallChgLnk();
+/*M*/ return;
+/*M*/ }
+/*M*/
+/*M*/ // hat das Attribut einen Bereich und dieser nicht leer
+/*M*/ else if( pEnd && nStart < *pEnd &&
+/*M*/ // dann teste, ob ueber Start/Ende getravellt wurde
+/*M*/ ( nStart == nCmp ||
+/*M*/ ( pHt->DontExpand() ? nCmp == *pEnd-1
+/*M*/ : nCmp == *pEnd ) ))
+/*M*/ {
+/*M*/ rShell.CallChgLnk();
+/*M*/ return;
+/*M*/ }
+/*M*/ nStart = 0;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if( pBreakIt->xBreak.is() )
+/*M*/ {
+/*M*/ const String& rTxt = ((SwTxtNode*)pCNd)->GetTxt();
+/*M*/ if( !nCmp ||
+/*M*/ pBreakIt->xBreak->getScriptType( rTxt, nCmp )
+/*M*/ != pBreakIt->xBreak->getScriptType( rTxt, nCmp - 1 ))
+/*M*/ {
+/*M*/ rShell.CallChgLnk();
+/*M*/ return;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ 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.
+ */
+/*M*/ rShell.CallChgLnk();
+/*M*/ }
+/*M*/
+/*M*/ const SwFrm* pFrm;
+/*M*/ const SwFlyFrm *pFlyFrm;
+/*M*/ if( !rShell.ActionPend() && 0 != ( pFrm = pCNd->GetFrm(0,0,FALSE) ) &&
+/*M*/ 0 != ( pFlyFrm = pFrm->FindFlyFrm() ) && !rShell.IsTableMode() )
+/*M*/ {
+/*M*/ const SwNodeIndex* pIndex = pFlyFrm->GetFmt()->GetCntnt().GetCntntIdx();
+/*M*/ ASSERT( pIndex, "Fly ohne Cntnt" );
+/*M*/ const SwNode& rStNd = pIndex->GetNode();
+/*M*/
+/*M*/ if( rStNd.EndOfSectionNode()->StartOfSectionIndex() > nNode ||
+/*M*/ nNode > rStNd.EndOfSectionIndex() )
+/*M*/ rShell.GetFlyMacroLnk().Call( (void*)pFlyFrm->GetFmt() );
+/*M*/ }
+/*M*/ }
+
+/*N*/ long SwCallLink::GetFrm( SwTxtNode& rNd, xub_StrLen nCntPos, BOOL bCalcFrm )
+/*N*/ {
+/*N*/ SwTxtFrm* pFrm = (SwTxtFrm*)rNd.GetFrm(0,0,bCalcFrm), *pNext = pFrm;
+/*N*/ if ( pFrm && !pFrm->IsHiddenNow() )
+/*N*/ {
+/*N*/ if( pFrm->HasFollow() )
+/*N*/ while( 0 != ( pNext = (SwTxtFrm*)pFrm->GetFollow() ) &&
+/*N*/ nCntPos >= pNext->GetOfst() )
+/*N*/ pFrm = pNext;
+/*N*/
+/*N*/ return pFrm->Frm().Left();
+/*N*/ }
+/*?*/ return 0;
+/*N*/ }
+
+/*---------------------------------------------------------------------*/
+
+
+//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
+// }
+// }
+//}
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_crbm.cxx b/binfilter/bf_sw/source/core/crsr/sw_crbm.cxx
new file mode 100644
index 000000000000..d0e9a5f74142
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_crbm.cxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "crsrsh.hxx"
+
+namespace binfilter {
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_crsrsh.cxx b/binfilter/bf_sw/source/core/crsr/sw_crsrsh.cxx
new file mode 100644
index 000000000000..fd12f53b377e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_crsrsh.cxx
@@ -0,0 +1,960 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+#ifdef BIDI
+#include <bf_svx/frmdiritem.hxx>
+#endif
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <viewimp.hxx>
+#include <flyfrm.hxx>
+#include <dview.hxx>
+#include <viewopt.hxx>
+#include <crsrsh.hxx>
+#include <txtfrm.hxx>
+#include <callnk.hxx>
+#include <viscrs.hxx>
+#include <section.hxx>
+#include <globdoc.hxx>
+#include <fmteiro.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::util;
+
+/*N*/ TYPEINIT2(SwCrsrShell,ViewShell,SwModify);
+
+
+// Funktion loescht, alle ueberlappenden Cursor aus einem Cursor-Ring
+/*N*/ void CheckRange( SwCursor* );
+
+//-----------------------------------------------------------------------
+
+/*
+ * Ueberpruefe ob der pCurCrsr in einen schon bestehenden Bereich zeigt.
+ * Wenn ja, dann hebe den alten Bereich auf.
+ */
+
+
+/*N*/ void CheckRange( SwCursor* pCurCrsr )
+/*N*/ {
+/*N*/ const SwPosition *pStt = pCurCrsr->Start(),
+/*N*/ *pEnd = pCurCrsr->GetPoint() == pStt ? pCurCrsr->GetMark() : pCurCrsr->GetPoint();
+/*N*/
+/*N*/ SwPaM *pTmpDel = 0,
+/*N*/ *pTmp = (SwPaM*)pCurCrsr->GetNext();
+/*N*/
+/*N*/ // durchsuche den gesamten Ring
+/*N*/ while( pTmp != pCurCrsr )
+/*N*/ {
+/*?*/ 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;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+// -------------- Methoden von der SwCrsrShell -------------
+
+
+// gebe den aktuellen zurueck
+
+/*N*/ SwPaM* SwCrsrShell::GetCrsr( FASTBOOL bMakeTblCrsr ) const
+/*N*/ {
+/*N*/ if( pTblCrsr )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ if( bMakeTblCrsr && pTblCrsr->IsCrsrMovedUpdt() )
+/*N*/ }
+/*N*/ return pCurCrsr;
+/*N*/ }
+
+
+/*N*/ void SwCrsrShell::StartAction()
+/*N*/ {
+/*N*/ if( !ActionPend() )
+/*N*/ {
+/*N*/ // fuer das Update des Ribbon-Bars merken
+/*N*/ const SwNode& rNd = pCurCrsr->GetPoint()->nNode.GetNode();
+/*N*/ nAktNode = rNd.GetIndex();
+/*N*/ nAktCntnt = pCurCrsr->GetPoint()->nContent.GetIndex();
+/*N*/ nAktNdTyp = rNd.GetNodeType();
+/*N*/ bAktSelection = *pCurCrsr->GetPoint() != *pCurCrsr->GetMark();
+/*N*/ if( ND_TEXTNODE & nAktNdTyp )
+/*N*/ nLeftFrmPos = SwCallLink::GetFrm( (SwTxtNode&)rNd, nAktCntnt, TRUE );
+/*N*/ else
+/*?*/ nLeftFrmPos = 0;
+/*N*/ }
+/*N*/ ViewShell::StartAction(); // zur ViewShell
+/*N*/ }
+
+
+/*N*/ void SwCrsrShell::EndAction( const BOOL bIdleEnd )
+/*N*/ {
+/*
+//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;
+ }
+*/
+
+/*N*/ FASTBOOL bVis = bSVCrsrVis;
+
+ // Idle-Formatierung ?
+/*N*/ if( bIdleEnd && Imp()->GetRegion() )
+/*N*/ {
+/*?*/ 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
+
+/*N*/ }
+
+ // vor der letzten Action alle invaliden Numerierungen updaten
+/*N*/ if( 1 == nStartAction )
+/*N*/ GetDoc()->UpdateNumRule();
+/*N*/
+/*N*/ // Task: 76923: dont show the cursor in the ViewShell::EndAction() - call.
+/*N*/ // Only the UpdateCrsr shows the cursor.
+/*N*/ BOOL bSavSVCrsrVis = bSVCrsrVis;
+/*N*/ bSVCrsrVis = FALSE;
+/*N*/
+/*N*/ ViewShell::EndAction( bIdleEnd ); //der ViewShell den Vortritt lassen
+/*N*/
+/*N*/ bSVCrsrVis = bSavSVCrsrVis;
+/*N*/
+/*N*/ if( ActionPend() )
+/*N*/ {
+/*N*/ if( bVis ) // auch SV-Cursor wieder anzeigen
+/*N*/ pVisCrsr->Show();
+/*N*/
+/*N*/ // falls noch ein ChgCall vorhanden ist und nur noch die Basic
+/*N*/ // Klammerung vorhanden ist, dann rufe ihn. Dadurch wird die interne
+/*N*/ // mit der Basic-Klammerung entkoppelt; die Shells werden umgeschaltet
+/*N*/ if( !BasicActionPend() )
+/*N*/ {
+/*?*/ //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!
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ UpdateCrsr( SwCrsrShell::CHKRANGE, bIdleEnd );
+/*N*/ }
+/*N*/ return;
+/*N*/ }
+
+/*N*/ USHORT nParm = SwCrsrShell::CHKRANGE;
+/*N*/ if ( !bIdleEnd )
+/*N*/ nParm |= SwCrsrShell::SCROLLWIN;
+/*N*/ UpdateCrsr( nParm, bIdleEnd ); // Cursor-Aenderungen anzeigen
+/*N*/
+/*N*/ {
+/*N*/ SwCallLink aLk( *this ); // Crsr-Moves ueberwachen,
+/*N*/ aLk.nNode = nAktNode; // evt. Link callen
+/*N*/ aLk.nNdTyp = (BYTE)nAktNdTyp;
+/*N*/ aLk.nCntnt = nAktCntnt;
+/*N*/ aLk.nLeftFrmPos = nLeftFrmPos;
+/*N*/
+/*N*/ if( !nCrsrMove ||
+/*N*/ ( 1 == nCrsrMove && bInCMvVisportChgd ) )
+/*N*/ ShowCrsrs( bSVCrsrVis ? TRUE : FALSE ); // Cursor & Selektionen wieder anzeigen
+/*N*/ }
+/*N*/ // falls noch ein ChgCall vorhanden ist, dann rufe ihn
+/*N*/ if( bCallChgLnk && bChgCallFlag && aChgLnk.IsSet() )
+/*N*/ {
+/*N*/ aChgLnk.Call( this );
+/*N*/ bChgCallFlag = FALSE; // Flag zuruecksetzen
+/*N*/ }
+/*N*/ }
+
+
+/*?*/ #if defined(DBG_UTIL)
+/*?*/
+/*?*/ 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
+
+
+/*N*/ void SwCrsrShell::UpdateCrsrPos()
+/*N*/ {
+/*N*/ SET_CURR_SHELL( this );
+/*N*/ ++nStartAction;
+/*N*/ Size aOldSz( GetLayout()->Frm().SSize() );
+/*N*/ SwCntntNode *pCNode = pCurCrsr->GetCntntNode();
+/*N*/ SwCntntFrm *pFrm = pCNode ?
+/*N*/ pCNode->GetFrm( &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() ) :0;
+/*N*/ if( !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()) )
+/*N*/ {
+/*?*/ SwCrsrMoveState aTmpState( MV_NONE );
+/*?*/ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+/*?*/ GetLayout()->GetCrsrOfst( pCurCrsr->GetPoint(), pCurCrsr->GetPtPos(),
+/*?*/ &aTmpState );
+/*?*/ if( pCurCrsr->HasMark())
+/*?*/ pCurCrsr->DeleteMark();
+/*N*/ }
+/*N*/ --nStartAction;
+/*N*/ if( aOldSz != GetLayout()->Frm().SSize() )
+/*N*/ SizeChgNotify( GetLayout()->Frm().SSize() );
+/*N*/ }
+
+
+
+// JP 30.04.99: Bug 65475 - falls Point/Mark in versteckten Bereichen
+// stehen, so mussen diese daraus verschoben werden
+
+/*M*/ void SwCrsrShell::UpdateCrsr( USHORT eFlags, BOOL bIdleEnd )
+/*M*/ {
+/*M*/ SET_CURR_SHELL( this );
+/*M*/
+/*N*/ ClearUpCrsrs();
+/*M*/
+/*M*/ // erfrage den Count fuer die Start-/End-Actions und ob die Shell
+/*M*/ // ueberhaupt den Focus hat
+/*M*/ // if( ActionPend() /*|| !bHasFocus*/ )
+/*M*/ //JP 12.01.98: Bug #46496# - es muss innerhalb einer BasicAction der
+/*M*/ // Cursor geupdatet werden; um z.B. den TabellenCursor zu
+/*M*/ // erzeugen. Im EndAction wird jetzt das UpdateCrsr gerufen!
+/*M*/ if( ActionPend() && BasicActionPend() )
+/*M*/ {
+/*M*/ if ( eFlags & SwCrsrShell::READONLY )
+/*M*/ bIgnoreReadonly = TRUE;
+/*M*/ return; // wenn nicht, dann kein Update !!
+/*M*/ }
+/*M*/
+/*M*/ if ( bIgnoreReadonly )
+/*M*/ {
+/*M*/ bIgnoreReadonly = FALSE;
+/*M*/ eFlags |= SwCrsrShell::READONLY;
+/*M*/ }
+/*M*/
+/*M*/ if( eFlags & SwCrsrShell::CHKRANGE ) // alle Cursor-Bewegungen auf
+/*M*/ CheckRange( pCurCrsr ); // ueberlappende Bereiche testen
+/*M*/
+/*M*/ if( !bIdleEnd )
+/*M*/ CheckTblBoxCntnt();
+/*M*/
+/*M*/ // steht der akt. Crsr in einer Tabelle und in unterschiedlichen Boxen
+/*M*/ // (oder ist noch TabellenMode), dann gilt der Tabellen Mode
+/*M*/ SwPaM* pTstCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+/*M*/ if( ( pTstCrsr->HasMark() &&
+/*M*/ pDoc->IsIdxInTbl( pTstCrsr->GetPoint()->nNode ) &&
+/*M*/ ( pTblCrsr ||
+/*M*/ pTstCrsr->GetNode( TRUE )->FindStartNode() !=
+/*M*/ pTstCrsr->GetNode( FALSE )->FindStartNode() ))
+/*M*/ /*|| ( !pTblCrsr && lcl_IsInValueBox( *pTstCrsr, *this ) )*/ )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/
+/*M*/ if( pTblCrsr )
+/*M*/ {
+/*M*/ // Cursor Ring loeschen
+/*M*/ while( pCurCrsr->GetNext() != pCurCrsr )
+/*M*/ delete pCurCrsr->GetNext();
+/*M*/ pCurCrsr->DeleteMark();
+/*M*/ *pCurCrsr->GetPoint() = *pTblCrsr->GetPoint();
+/*M*/ pCurCrsr->GetPtPos() = pTblCrsr->GetPtPos();
+/*M*/ delete pTblCrsr, pTblCrsr = 0;
+/*M*/ }
+/*M*/
+/*M*/ pVisCrsr->Hide(); // sichtbaren Cursor immer verstecken
+/*M*/
+/*M*/ // sind wir vielleicht in einer geschuetzten/versteckten Section ?
+/*M*/ {
+/*M*/ BOOL bChgState = TRUE;
+/*M*/ const SwSectionNode* pSectNd = pCurCrsr->GetNode()->FindSectionNode();
+/*M*/ if( pSectNd && ( pSectNd->GetSection().IsHiddenFlag() ||
+/*M*/ ( !IsReadOnlyAvailable() &&
+/*M*/ pSectNd->GetSection().IsProtectFlag() &&
+/*M*/ ( !pDoc->GetDocShell() ||
+/*M*/ !pDoc->GetDocShell()->IsReadOnly() || bAllProtect )) ) )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ if( bChgState )
+/*M*/ {
+/*M*/ BOOL bWasAllProtect = bAllProtect;
+/*M*/ bAllProtect = FALSE;
+/*M*/ if( bWasAllProtect && GetDoc()->GetDocShell() &&
+/*M*/ GetDoc()->GetDocShell()->IsReadOnlyUI() )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ UpdateCrsrPos();
+/*M*/
+/*M*/
+/*M*/ // #100722# The cursor must always point into content; there's some code
+/*M*/ // that relies on this. (E.g. in SwEditShell::GetScriptType, which always
+/*M*/ // loops _behind_ the last node in the selection, which always works if you
+/*M*/ // are in content.) To achieve this, we'll force cursor(s) to point into
+/*M*/ // content, if UpdateCrsrPos() hasn't already done so.
+/*M*/ SwPaM* pCmp = pCurCrsr;
+/*M*/ do
+/*M*/ {
+/*M*/ // start will move forwards, end will move backwards
+/*M*/ bool bPointIsStart = ( pCmp->Start() == pCmp->GetPoint() );
+/*M*/
+/*M*/ // move point; forward if it's the start, backwards if it's the end
+/*M*/ if( ! pCmp->GetPoint()->nNode.GetNode().IsCntntNode() )
+/*M*/ pCmp->Move( bPointIsStart ? fnMoveForward : fnMoveBackward,
+/*M*/ fnGoCntnt );
+/*M*/
+/*M*/ // move mark (if exists); forward if it's the start, else backwards
+/*M*/ if( pCmp->HasMark() )
+/*M*/ {
+/*M*/ if( ! pCmp->GetMark()->nNode.GetNode().IsCntntNode() )
+/*M*/ {
+/*M*/ pCmp->Exchange();
+/*M*/ pCmp->Move( !bPointIsStart ? fnMoveForward : fnMoveBackward,
+/*M*/ fnGoCntnt );
+/*M*/ pCmp->Exchange();
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // iterate to next PaM in ring
+/*M*/ pCmp = static_cast<SwPaM*>( pCmp->GetNext() );
+/*M*/ }
+/*M*/ while( pCmp != pCurCrsr );
+/*M*/
+/*M*/
+/*M*/ SwRect aOld( aCharRect );
+/*M*/ FASTBOOL bFirst = TRUE;
+/*M*/ SwCntntFrm *pFrm;
+/*M*/ int nLoopCnt = 100;
+/*M*/
+/*M*/ do {
+/*M*/ BOOL bAgainst;
+/*M*/ do {
+/*M*/ bAgainst = FALSE;
+/*M*/ pFrm = pCurCrsr->GetCntntNode()->GetFrm(
+/*M*/ &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+/*M*/ // ist der Frm nicht mehr vorhanden, dann muss das gesamte Layout
+/*M*/ // erzeugt werden, weil ja mal hier einer vorhanden war !!
+/*M*/ if ( !pFrm )
+/*M*/ {
+/*M*/ do
+/*M*/ {
+/*M*/ CalcLayout();
+/*M*/ pFrm = pCurCrsr->GetCntntNode()->GetFrm(
+/*M*/ &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+/*M*/ } while( !pFrm );
+/*M*/ }
+/*M*/ else if ( Imp()->IsIdleAction() )
+/*M*/ //Wir stellen sicher, dass anstaendig Formatiert wurde #42224#
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pFrm->PrepareCrsr();
+/*M*/
+/*M*/ // im geschuetzten Fly? aber bei Rahmenselektion ignorieren
+/*M*/ if( !IsReadOnlyAvailable() && pFrm->IsProtected() &&
+/*M*/ ( !Imp()->GetDrawView() ||
+/*M*/ !Imp()->GetDrawView()->GetMarkList().GetMarkCount() ) &&
+/*M*/ (!pDoc->GetDocShell() ||
+/*M*/ !pDoc->GetDocShell()->IsReadOnly() || bAllProtect ) )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ } while( bAgainst );
+/*M*/
+/*M*/ if( !( eFlags & SwCrsrShell::NOCALRECT ))
+/*M*/ {
+/*M*/ SwCrsrMoveState aTmpState( eMvState );
+/*M*/ aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+/*M*/ aTmpState.bRealHeight = TRUE;
+/*M*/ aTmpState.bRealWidth = IsOverwriteCrsr();
+/*N*/ aTmpState.nCursorBidiLevel = pCurCrsr->GetCrsrBidiLevel();
+/*M*/ if( !pFrm->GetCharRect( aCharRect, *pCurCrsr->GetPoint(), &aTmpState ) )
+/*M*/ {
+/*N*/ Point& rPt = pCurCrsr->GetPtPos();
+/*N*/ rPt = aCharRect.Center();
+/*N*/ pFrm->GetCrsrOfst( pCurCrsr->GetPoint(), rPt, &aTmpState );
+/*N*/ #ifndef VERTICAL_LAYOUT
+/*N*/ if ( !pFrm->GetCharRect(aCharRect, *pCurCrsr->GetPoint(), &aTmpState) )
+/*N*/ ASSERT( !this, "GetCharRect failed." );
+/*N*/ #endif
+/*M*/ }
+/*M*/ // ALIGNRECT( aCharRect );
+/*M*/
+/*M*/ if( !pCurCrsr->HasMark() )
+/*M*/ aCrsrHeight = aTmpState.aRealHeight;
+/*M*/ else
+/*M*/ {
+/*M*/ aCrsrHeight.X() = 0;
+/*M*/ aCrsrHeight.Y() = aTmpState.aRealHeight.Y() < 0 ?
+/*M*/ -aCharRect.Width() : aCharRect.Height();
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ aCrsrHeight.X() = 0;
+/*M*/ aCrsrHeight.Y() = aCharRect.Height();
+/*M*/ }
+/*M*/
+/*M*/ if( !bFirst && aOld == aCharRect )
+/*M*/ break;
+/*M*/
+/*M*/ // falls das Layout meint, nach dem 100 durchlauf ist man immer noch
+/*M*/ // im Fluss, sollte man die akt. Pos. als gegeben hinnehmen!
+/*M*/ // siehe Bug: 29658
+/*M*/ if( !--nLoopCnt )
+/*M*/ {
+/*M*/ ASSERT( !this, "Endlosschleife? CharRect != OldCharRect ");
+/*M*/ break;
+/*M*/ }
+/*M*/ aOld = aCharRect;
+/*M*/ bFirst = FALSE;
+/*M*/
+/*M*/ // Cursor-Points auf die neuen Positionen setzen
+/*M*/ pCurCrsr->GetPtPos().X() = aCharRect.Left();
+/*M*/ pCurCrsr->GetPtPos().Y() = aCharRect.Top();
+/*M*/
+/*M*/ if( !(eFlags & SwCrsrShell::UPDOWN )) // alte Pos. von Up/Down loeschen
+/*M*/ {
+/*M*/ pFrm->Calc();
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ nUpDownX = pFrm->IsVertical() ?
+/*M*/ aCharRect.Top() - pFrm->Frm().Top() :
+/*M*/ aCharRect.Left() - pFrm->Frm().Left();
+/*M*/ #else
+/*M*/ nUpDownX = aCharRect.Left() - pFrm->Frm().Left();
+/*M*/ #endif
+/*M*/ }
+/*M*/
+/*M*/ // Curosr in den sichtbaren Bereich scrollen
+/*M*/ if( bHasFocus && eFlags & SwCrsrShell::SCROLLWIN &&
+/*M*/ (HasSelection() || eFlags & SwCrsrShell::READONLY ||
+/*M*/ !IsCrsrReadonly() || GetViewOptions()->IsSelectionInReadonly()) )
+/*M*/ {
+/*M*/ //JP 30.04.99: damit das EndAction, beim evtuellen Scrollen, den
+/*M*/ // SV-Crsr nicht wieder sichtbar macht, wird hier das Flag
+/*M*/ // gesichert und zurueckgesetzt.
+/*M*/ BOOL bSav = bSVCrsrVis; bSVCrsrVis = FALSE;
+/*M*/ MakeSelVisible();
+/*M*/ bSVCrsrVis = bSav;
+/*M*/ }
+/*M*/
+/*M*/ } while( eFlags & SwCrsrShell::SCROLLWIN );
+/*M*/
+/*M*/ if( !bIdleEnd && bHasFocus && !bBasicHideCrsr )
+/*M*/ pCurCrsr->SwSelPaintRects::Show();
+/*M*/
+/*M*/ //Ggf. gescrollten Bereicht korrigieren (Alignment).
+/*M*/ //Nur wenn gescrollt wurde, und wenn keine Selektion existiert.
+/*M*/ if( pFrm && Imp()->IsScrolled() &&
+/*M*/ pCurCrsr->GetNext() == pCurCrsr && !pCurCrsr->HasMark() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 Imp()->RefreshScrolledArea( aCharRect );
+/*M*/
+/*M*/
+/*M*/ eMvState = MV_NONE; // Status fuers Crsr-Travelling - GetCrsrOfst
+/*M*/
+/*M*/ #ifdef ACCESSIBLE_LAYOUT
+/*M*/ #endif
+/*M*/
+/*M*/ #ifndef REMOTE_APPSERVER
+/*M*/
+/*M*/ // switch from blinking cursor to read-only-text-selection cursor
+/*M*/ long nBlinkTime = GetOut()->GetSettings().GetStyleSettings().
+/*M*/ GetCursorBlinkTime();
+/*M*/
+/*M*/ if ( (IsCrsrReadonly() && GetViewOptions()->IsSelectionInReadonly()) ==
+/*M*/ ( nBlinkTime != STYLE_CURSOR_NOBLINKTIME ) )
+/*M*/ {
+/*M*/ // non blinking cursor in read only - text selection mode
+/*M*/ AllSettings aSettings = GetOut()->GetSettings();
+/*M*/ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+/*M*/ long nNewBlinkTime = nBlinkTime == STYLE_CURSOR_NOBLINKTIME ?
+/*M*/ 500 :
+/*M*/ STYLE_CURSOR_NOBLINKTIME;
+/*M*/ aStyleSettings.SetCursorBlinkTime( nNewBlinkTime );
+/*M*/ aSettings.SetStyleSettings( aStyleSettings );
+/*M*/ GetOut()->SetSettings( aSettings );
+/*M*/ }
+/*M*/
+/*M*/ #endif
+/*M*/
+/*M*/ if( bSVCrsrVis )
+/*M*/ pVisCrsr->Show(); // wieder anzeigen
+/*M*/ }
+
+
+
+// erzeuge eine Kopie vom Cursor und speicher diese im Stack
+
+
+
+/*
+ * 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
+ */
+
+
+
+/*
+ * Verbinde zwei Cursor miteinander.
+ * Loesche vom Stack den obersten und setzen dessen GetMark im Aktuellen.
+ */
+
+
+
+
+
+
+
+/*N*/ void SwCrsrShell::ShowCrsrs( BOOL bCrsrVis )
+/*N*/ {
+/*N*/ if( !bHasFocus || bAllProtect || bBasicHideCrsr )
+/*?*/ return;
+
+/*N*/ SET_CURR_SHELL( this );
+/*N*/ SwShellCrsr* pAktCrsr = pTblCrsr ? pTblCrsr : pCurCrsr;
+/*N*/ pAktCrsr->Show();
+/*N*/
+/*N*/ if( bSVCrsrVis && bCrsrVis ) // auch SV-Cursor wieder anzeigen
+/*N*/ pVisCrsr->Show();
+/*N*/ }
+
+
+/*N*/ SwCntntFrm *SwCrsrShell::GetCurrFrm( const BOOL bCalcFrm ) const
+/*N*/ {
+/*N*/ SET_CURR_SHELL( (ViewShell*)this );
+/*N*/ SwCntntFrm *pRet = 0;
+/*N*/ SwCntntNode *pNd = pCurCrsr->GetCntntNode();
+/*N*/ if ( pNd )
+/*N*/ {
+/*N*/ if ( bCalcFrm )
+/*N*/ {
+/*N*/ const USHORT* pST = &nStartAction;
+/*N*/ ++(*((USHORT*)pST));
+/*N*/ const Size aOldSz( GetLayout()->Frm().SSize() );
+/*N*/ pRet = pNd->GetFrm( &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint() );
+/*N*/ --(*((USHORT*)pST));
+/*N*/ if( aOldSz != GetLayout()->Frm().SSize() )
+/*N*/ ((SwCrsrShell*)this)->SizeChgNotify( GetLayout()->Frm().SSize() );
+/*N*/ }
+/*N*/ else
+/*N*/ pRet = pNd->GetFrm( &pCurCrsr->GetPtPos(), pCurCrsr->GetPoint(), FALSE);
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+
+// alle Attribut/Format-Aenderungen am akt. Node werden an den
+// Link weitergeleitet.
+
+
+/*N*/ void SwCrsrShell::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ USHORT nWhich = pOld ? pOld->Which()
+/*N*/ : pNew ? pNew->Which()
+/*N*/ : RES_MSG_BEGIN;
+/*N*/ if( bCallChgLnk &&
+/*N*/ ( nWhich < RES_MSG_BEGIN || nWhich >= RES_MSG_END ||
+/*N*/ nWhich == RES_FMT_CHG || nWhich == RES_UPDATE_ATTR ||
+/*N*/ nWhich == RES_ATTRSET_CHG ))
+/*N*/ // die Messages werden nicht weitergemeldet
+/*N*/ //MA 07. Apr. 94 fix(6681): RES_UPDATE_ATTR wird implizit vom
+/*N*/ //SwTxtNode::Insert(SwTxtHint*, USHORT) abgesetzt; hier wird reagiert und
+/*N*/ //vom Insert brauch nicht mehr die Keule RES_FMT_CHG versandt werden.
+/*N*/ CallChgLnk();
+/*N*/
+/*N*/ if( aGrfArrivedLnk.IsSet() &&
+/*N*/ ( RES_GRAPHIC_ARRIVED == nWhich || RES_GRAPHIC_SWAPIN == nWhich ))
+/*?*/ aGrfArrivedLnk.Call( this );
+/*N*/ }
+
+
+// Abfrage, ob der aktuelle Cursor eine Selektion aufspannt,
+// also, ob GetMark gesetzt und SPoint und GetMark unterschiedlich sind.
+
+
+/*N*/ FASTBOOL SwCrsrShell::HasSelection() const
+/*N*/ {
+/*N*/ SwPaM* pCrsr = IsTableMode() ? pTblCrsr : pCurCrsr;
+/*N*/ return( IsTableMode() || ( pCurCrsr->HasMark() &&
+/*N*/ *pCurCrsr->GetPoint() != *pCrsr->GetMark())
+/*N*/ ? TRUE : FALSE );
+/*N*/ }
+
+
+/*N*/ void SwCrsrShell::CallChgLnk()
+/*N*/ {
+/*N*/ // innerhalb von Start-/End-Action kein Call, sondern nur merken,
+/*N*/ // das sich etwas geaendert hat. Wird bei EndAction beachtet.
+/*N*/ if( BasicActionPend() )
+/*N*/ bChgCallFlag = TRUE; // das Change merken
+/*N*/ else if( aChgLnk.IsSet() )
+/*N*/ {
+/*N*/ if( bCallChgLnk )
+/*N*/ aChgLnk.Call( this );
+/*N*/ bChgCallFlag = FALSE; // Flag zuruecksetzen
+/*N*/ }
+/*N*/ }
+
+// 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.
+
+/*N*/ SwCrsrShell::~SwCrsrShell()
+/*N*/ {
+/*N*/ // wenn es nicht die letzte View so sollte zu mindest das
+/*N*/ // Feld noch geupdatet werden.
+/*N*/ if( GetNext() != this )
+/*?*/ CheckTblBoxCntnt( pCurCrsr->GetPoint() );
+/*N*/ else
+/*N*/ ClearTblBoxCntnt();
+/*N*/
+/*N*/ delete pVisCrsr;
+/*N*/ delete pTblCrsr;
+/*N*/
+ /*
+ * Freigabe der Cursor
+ */
+/*N*/ while(pCurCrsr->GetNext() != pCurCrsr)
+/*?*/ delete pCurCrsr->GetNext();
+/*N*/ delete pCurCrsr;
+/*N*/
+/*N*/ // Stack freigeben
+/*N*/ if( pCrsrStk )
+/*N*/ {
+/*?*/ while( pCrsrStk->GetNext() != pCrsrStk )
+/*?*/ delete pCrsrStk->GetNext();
+/*?*/ delete pCrsrStk;
+/*N*/ }
+
+ // 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.
+/*N*/ if( GetRegisteredIn() )
+/*N*/ pRegisteredIn->Remove( this );
+/*N*/ }
+
+
+
+//Sollte fuer das Clipboard der WaitPtr geschaltet werden?
+//Warten bei TableMode, Mehrfachselektion und mehr als x Selektieren Absaetzen.
+
+
+
+
+
+// steht der Curor auf einem "Symbol"-Zeichen
+
+
+// zeige das akt. selektierte "Object" an
+/*N*/ void SwCrsrShell::MakeSelVisible()
+/*N*/ {
+/*N*/ ASSERT( bHasFocus, "kein Focus aber Cursor sichtbar machen?" );
+/*N*/ if( aCrsrHeight.Y() < aCharRect.Height() && aCharRect.Height() > VisArea().Height() )
+/*N*/ {
+/*N*/ SwRect aTmp( aCharRect );
+/*N*/ long nDiff = aCharRect.Height() - VisArea().Height();
+/*N*/ if( nDiff < aCrsrHeight.X() )
+/*?*/ aTmp.Top( nDiff + aCharRect.Top() );
+/*N*/ else
+/*N*/ {
+/*N*/ aTmp.Top( aCrsrHeight.X() + aCharRect.Top() );
+/*N*/ aTmp.Height( aCrsrHeight.Y() );
+/*N*/ }
+/*N*/ if( !aTmp.HasArea() )
+/*N*/ {
+/*?*/ aTmp.SSize().Height() += 1;
+/*?*/ aTmp.SSize().Width() += 1;
+/*N*/ }
+/*N*/ MakeVisible( aTmp );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( aCharRect.HasArea() )
+/*N*/ MakeVisible( aCharRect );
+/*N*/ else
+/*N*/ {
+/*?*/ SwRect aTmp( aCharRect );
+/*?*/ aTmp.SSize().Height() += 1; aTmp.SSize().Width() += 1;
+/*?*/ MakeVisible( aTmp );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+// suche eine gueltige ContentPosition (nicht geschuetzt/nicht versteckt)
+
+
+
+
+/*N*/ FASTBOOL SwCrsrShell::IsCrsrReadonly() const
+/*N*/ {
+/*N*/ if ( GetViewOptions()->IsReadonly() )
+/*N*/ {
+/*N*/ SwFrm *pFrm = GetCurrFrm( FALSE );
+/*N*/ SwFlyFrm *pFly;
+/*N*/ if( pFrm && pFrm->IsInFly() &&
+/*N*/ (pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() &&
+/*N*/ pFly->Lower() &&
+/*N*/ !pFly->Lower()->IsNoTxtFrm() &&
+/*N*/ !GetDrawView()->GetMarkList().GetMarkCount() )
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+// SwCursor - Methode !!!!
+/*N*/ FASTBOOL SwCursor::IsReadOnlyAvailable() const
+/*N*/ {
+/*N*/ const SwShellCrsr* pShCrsr = *this;
+/*N*/ const SwUnoCrsr* pUnoCrsr = *this;
+/*N*/ return pShCrsr ? pShCrsr->GetShell()->IsReadOnlyAvailable() :
+/*N*/ pUnoCrsr ? TRUE : FALSE;
+/*N*/ }
+
+
+#if defined(DBG_UTIL) || defined(WIN)
+
+
+
+/*N*/ SwCursor* SwCrsrShell::GetSwCrsr( FASTBOOL bMakeTblCrsr ) const
+/*N*/ {
+/*N*/ return (SwCursor*)GetCrsr( bMakeTblCrsr );
+/*N*/ }
+
+// gebe den Stack Cursor zurueck
+/*N*/ SwPaM * SwCrsrShell::GetStkCrsr() const { return pCrsrStk; }
+
+// gebe den TabellenCrsr zurueck
+/*N*/ const SwPaM* SwCrsrShell::GetTblCrs() const { return pTblCrsr; }
+/*N*/ SwPaM* SwCrsrShell::GetTblCrs() { return pTblCrsr; }
+
+// Abfrage, ob ueberhaupt eine Selektion existiert, sprich der akt. Cursor
+// aufgespannt oder nicht der einzigste ist.
+
+/*N*/ FASTBOOL SwCrsrShell::IsSelection() const
+/*N*/ {
+/*N*/ return IsTableMode() || pCurCrsr->HasMark() ||
+/*N*/ pCurCrsr->GetNext() != pCurCrsr;
+/*N*/ }
+// returns if multiple cursors are available
+/*N*/ FASTBOOL SwCrsrShell::IsMultiSelection() const
+/*N*/ {
+/*N*/ return pCurCrsr->GetNext() != pCurCrsr;
+/*N*/ }
+
+// pruefe ob vom aktuellen Crsr der SPoint/Mark in einer Tabelle stehen
+/*N*/ const SwTableNode* SwCrsrShell::IsCrsrInTbl( BOOL bIsPtInTbl ) const
+/*N*/ {
+/*N*/ return pCurCrsr->GetNode( bIsPtInTbl )->FindTableNode();
+/*N*/ }
+
+
+/*?*/ 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
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 return pCurCrsr->MakeFindRange( (SwDocPositions)nStt,
+/*?*/ }
+#endif
+
+/**
+ Checks if a position is valid. To be valid the position's node must
+ be a content node and the content must not be unregistered.
+
+ @param aPos the position to check.
+*/
+/*N*/ static bool lcl_PosOk(SwPosition & aPos)
+/*N*/ {
+/*N*/ bool bResult = true;
+/*N*/ SwPosition aTmpPos(aPos);
+/*N*/ aTmpPos.nContent.Assign(0, 0);
+/*N*/
+/*N*/ if (aPos.nNode.GetNode().GetCntntNode() == NULL ||
+/*N*/ aPos.nContent.GetIdxReg() == aTmpPos.nContent.GetIdxReg())
+/*N*/ bResult = false;
+/*N*/
+/*N*/ return bResult;
+/*N*/ }
+
+/**
+ Checks if a PaM is valid. For a PaM to be valid its point must be
+ valid. Additionaly if the PaM has a mark this has to be valid, too.
+
+ @param aPam the PaM to check
+*/
+/*N*/ static bool lcl_CrsrOk(SwPaM & aPam)
+/*N*/ {
+/*N*/ return lcl_PosOk(*aPam.GetPoint()) && (! aPam.HasMark()
+/*N*/ || lcl_PosOk(*aPam.GetMark()));
+/*N*/ }
+
+/*N*/ void SwCrsrShell::ClearUpCrsrs()
+/*N*/ {
+/*N*/ // start of the ring
+/*N*/ SwPaM * pStartCrsr = GetCrsr();
+/*N*/ // start loop with second entry of the ring
+/*N*/ SwPaM * pCrsr = (SwPaM *) pStartCrsr->GetNext();
+/*N*/ SwPaM * pTmpCrsr;
+/*N*/ bool bChanged = false;
+/*N*/
+ /*
+ For all entries in the ring except the start entry delete the
+ entry if it is invalid.
+ */
+/*N*/ while (pCrsr != pStartCrsr)
+/*N*/ {
+/*?*/ pTmpCrsr = (SwPaM *) pCrsr->GetNext();
+/*?*/
+/*?*/ if ( ! lcl_CrsrOk(*pCrsr))
+/*?*/ {
+/*?*/ delete pCrsr;
+/*?*/
+/*?*/ bChanged = true;
+/*N*/ }
+/*N*/
+/*N*/ pCrsr = pTmpCrsr;
+/*N*/ }
+/*N*/
+ /*
+ If the start entry of the ring is invalid replace it with a
+ cursor pointing to the beginning of the first content node in
+ the document.
+ */
+/*N*/ if (! lcl_CrsrOk(*pStartCrsr))
+/*N*/ {
+/*?*/ SwNodes & aNodes = GetDoc()->GetNodes();
+/*?*/ SwNodeIndex aIdx(*(aNodes.GetEndOfContent().StartOfSectionNode()));
+/*?*/
+/*?*/ SwNode * pNode = aNodes.GoNext(&aIdx);
+/*?*/ bool bFound = (pNode != NULL);
+/*?*/
+/*?*/ ASSERT(bFound, "no content node found");
+/*?*/
+/*?*/ if (bFound)
+/*?*/ {
+/*?*/ SwPaM aTmpPam(*pNode);
+/*?*/ *pStartCrsr = aTmpPam;
+/*?*/ }
+/*?*/
+/*?*/ bChanged = true;
+/*N*/ }
+
+ /*
+ If at least one of the cursors in the ring have been deleted or
+ replaced, remove the table cursor.
+ */
+/*N*/ if (pTblCrsr != NULL && bChanged)
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 TblCrsrToCursor();
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_findattr.cxx b/binfilter/bf_sw/source/core/crsr/sw_findattr.cxx
new file mode 100644
index 000000000000..a9975e66565e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_findattr.cxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+
+#include <hintids.hxx>
+
+
+#include <txatbase.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <swcrsr.hxx>
+#include <pamtyp.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+
+ // Sonderbehandlung fuer SvxFontItem, nur den Namen vergleichen:
+
+
+/*N*/ const SwTxtAttr* GetFrwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos,
+/*N*/ xub_StrLen nCntntPos )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return 0; // kein gueltiges TextAttribut
+/*N*/ }
+
+
+/*N*/ const SwTxtAttr* GetBkwrdTxtHint( const SwpHints& rHtsArr, USHORT& rPos,
+/*N*/ xub_StrLen nCntntPos )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return 0; // kein gueltiges TextAttribut
+/*N*/ }
+
+
+
+//------------------ 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
+
+
+
+
+//------------------ Suche nach mehren Text Attributen -------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//------------------ Methoden vom SwCursor ---------------------------
+
+// Parameter fuer das Suchen vom Attributen
+struct SwFindParaAttr : public SwFindParas
+{
+ BOOL bValue;
+ const SfxItemSet *pSet, *pReplSet;
+ const SearchOptions *pSearchOpt;
+ SwCursor& rCursor;
+ ::utl::TextSearch* pSTxt;
+
+ SwFindParaAttr( const SfxItemSet& rSet, BOOL bNoCollection,
+ const SearchOptions* pOpt, const SfxItemSet* pRSet,
+ SwCursor& rCrsr )
+ : pSet( &rSet ), pReplSet( pRSet ), rCursor( rCrsr ),
+ bValue( bNoCollection ), pSearchOpt( pOpt ), pSTxt( 0 )
+ {}
+ ~SwFindParaAttr() { delete pSTxt; }
+
+ virtual int Find( SwPaM* , SwMoveFn , const SwPaM*, FASTBOOL bInReadOnly );
+ virtual int IsReplaceMode() const;
+};
+
+
+/*N*/int SwFindParaAttr::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/{
+DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 // String ersetzen ?? (nur wenn Text angegeben oder nicht attributiert
+/*N*/ }
+
+
+/*N*/int SwFindParaAttr::IsReplaceMode() const
+/*N*/{
+DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 return ( pSearchOpt && pSearchOpt->replaceString.getLength() ) ||
+/*N*/ }
+
+// Suchen nach Attributen
+
+
+/*M*/ ULONG SwCursor::Find( const SfxItemSet& rSet, FASTBOOL bNoCollections,
+/*M*/ SwDocPositions nStart, SwDocPositions nEnde, BOOL& bCancel,
+/*M*/ FindRanges eFndRngs,
+/*M*/ const SearchOptions* pSearchOpt, const SfxItemSet* pReplSet )
+/*M*/ {
+/*M*/ // OLE-Benachrichtigung abschalten !!
+/*M*/ SwDoc* pDoc = GetDoc();
+/*M*/ Link aLnk( pDoc->GetOle2Link() );
+/*M*/ pDoc->SetOle2Link( Link() );
+/*M*/
+/*M*/ BOOL bReplace = ( pSearchOpt && ( pSearchOpt->replaceString.getLength() ||
+/*M*/ !rSet.Count() ) ) ||
+/*M*/ (pReplSet && pReplSet->Count());
+/*M*/
+/*M*/ SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt,
+/*M*/ pReplSet, *this );
+/*M*/
+/*M*/ ULONG nRet = FindAll(aSwFindParaAttr, nStart, nEnde, eFndRngs, bCancel );
+/*M*/ pDoc->SetOle2Link( aLnk );
+/*M*/ if( nRet && bReplace )
+/*M*/ pDoc->SetModified();
+/*M*/
+/*M*/ return nRet;
+/*M*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_findcoll.cxx b/binfilter/bf_sw/source/core/crsr/sw_findcoll.cxx
new file mode 100644
index 000000000000..c9eeb708b8a0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_findcoll.cxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+#include <swcrsr.hxx>
+
+#include <horiornt.hxx>
+
+namespace binfilter {
+
+
+//------------------ Methoden der CrsrShell ---------------------------
+
+// Parameter fuer das Suchen vom FormatCollections
+
+
+
+
+
+
+// Suchen nach Format-Collections
+
+
+/*M*/ ULONG SwCursor::Find( const SwTxtFmtColl& rFmtColl,
+/*M*/ SwDocPositions nStart, SwDocPositions nEnde, BOOL& bCancel,
+/*M*/ FindRanges eFndRngs, const SwTxtFmtColl* pReplFmtColl )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP");return 0;//STRIP001
+/*M*/ // OLE-Benachrichtigung abschalten !!
+/*M*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_findtxt.cxx b/binfilter/bf_sw/source/core/crsr/sw_findtxt.cxx
new file mode 100644
index 000000000000..6807521d1b1c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_findtxt.cxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVSTDARR_ULONGS
+
+
+#include <txtfld.hxx>
+#include <swcrsr.hxx>
+
+#include <horiornt.hxx>
+
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::util;
+
+
+
+
+
+
+
+// Parameter fuers Suchen und Ersetzen von Text
+
+
+
+
+
+
+/*M*/ ULONG SwCursor::Find( const SearchOptions& rSearchOpt,
+/*M*/ SwDocPositions nStart, SwDocPositions nEnde,
+/*M*/ BOOL& bCancel,
+/*M*/ FindRanges eFndRngs, int bReplace )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001
+/*M*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_pam.cxx b/binfilter/bf_sw/source/core/crsr/sw_pam.cxx
new file mode 100644
index 000000000000..518621bc6339
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_pam.cxx
@@ -0,0 +1,655 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/protitem.hxx>
+
+#include <pagefrm.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <pamtyp.hxx>
+#include <txtfrm.hxx>
+#include <section.hxx>
+#include <fmtcntnt.hxx>
+#include <frmatr.hxx>
+#include <crsskip.hxx>
+namespace binfilter {
+
+
+// fuer den dummen ?MSC-? Compiler
+/*N*/inline xub_StrLen GetSttOrEnd( BOOL bCondition, const SwCntntNode& rNd )
+/*N*/{
+/*N*/ return bCondition ? 0 : rNd.Len();
+/*N*/}
+
+/*************************************************************************
+|*
+|* SwPosition
+|*
+|* Beschreibung PAM.DOC
+|* Ersterstellung VB 4.3.91
+|* Letzte Aenderung VB 4.3.91
+|*
+*************************************************************************/
+
+
+/*N*/ SwPosition::SwPosition(const SwPosition &rPos)
+/*N*/ : nNode(rPos.nNode),nContent(rPos.nContent)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwPosition::SwPosition( const SwNodeIndex &rNode, const SwIndex &rCntnt )
+/*N*/ : nNode( rNode ),nContent( rCntnt )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwPosition::SwPosition( const SwNodeIndex &rNode )
+/*N*/ : nNode( rNode ), nContent( 0 )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwPosition::SwPosition( const SwNode& rNode )
+/*N*/ : nNode( rNode ), nContent( 0 )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwPosition &SwPosition::operator=(const SwPosition &rPos)
+/*N*/ {
+/*N*/ nNode = rPos.nNode;
+/*N*/ nContent = rPos.nContent;
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwPosition::operator<(const SwPosition &rPos) const
+/*N*/ {
+/*N*/ if( nNode < rPos.nNode )
+/*N*/ return TRUE;
+/*N*/ if( nNode == rPos.nNode )
+/*N*/ return ( nContent < rPos.nContent );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwPosition::operator>(const SwPosition &rPos) const
+/*N*/ {
+/*N*/ if(nNode > rPos.nNode )
+/*N*/ return TRUE;
+/*N*/ if( nNode == rPos.nNode )
+/*N*/ return ( nContent > rPos.nContent );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwPosition::operator<=(const SwPosition &rPos) const
+/*N*/ {
+/*N*/ if(nNode < rPos.nNode )
+/*N*/ return TRUE;
+/*N*/ if( nNode == rPos.nNode )
+/*N*/ return ( nContent <= rPos.nContent );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwPosition::operator>=(const SwPosition &rPos) const
+/*N*/ {
+/*N*/ if(nNode > rPos.nNode )
+/*N*/ return TRUE;
+/*N*/ if( nNode == rPos.nNode )
+/*N*/ return ( nContent >= rPos.nContent );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwPosition::operator==(const SwPosition &rPos) const
+/*N*/ {
+/*N*/ return
+/*N*/ ( ( nNode == rPos.nNode ) && ( nContent == rPos.nContent ) ?
+/*N*/ TRUE: FALSE);
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwPosition::operator!=(const SwPosition &rPos) const
+/*N*/ {
+/*N*/ if( nNode != rPos.nNode )
+/*N*/ return TRUE;
+/*N*/ return ( nContent != rPos.nContent );
+/*N*/ }
+
+SwComparePosition ComparePosition(
+ const SwPosition& rStt1, const SwPosition& rEnd1,
+ const SwPosition& rStt2, const SwPosition& rEnd2 )
+{
+ SwComparePosition nRet;
+ if( rStt1 < rStt2 )
+ {
+ if( rEnd1 > rStt2 )
+ {
+ if( rEnd1 >= rEnd2 )
+ nRet = POS_OUTSIDE;
+ else
+ nRet = POS_OVERLAP_BEFORE;
+
+ }
+ else if( rEnd1 == rStt2 )
+ nRet = POS_COLLIDE_END;
+ else
+ nRet = POS_BEFORE;
+ }
+ else if( rEnd2 > rStt1 )
+ {
+ if( rEnd2 >= rEnd1 )
+ {
+ if( rEnd2 == rEnd1 && rStt2 == rStt1 )
+ nRet = POS_EQUAL;
+ else
+ nRet = POS_INSIDE;
+ }
+ else
+ nRet = POS_OVERLAP_BEHIND;
+ }
+ else if( rEnd2 == rStt1 )
+ nRet = POS_COLLIDE_START;
+ else
+ nRet = POS_BEHIND;
+ return nRet;
+}
+
+
+/* */
+
+enum CHKSECTION { Chk_Both, Chk_One, Chk_None };
+
+
+/*N*/ CHKSECTION lcl_TstIdx( ULONG nSttIdx, ULONG nEndIdx, const SwNode& rEndNd )
+/*N*/ {
+/*N*/ ULONG nStt = rEndNd.StartOfSectionIndex(), nEnd = rEndNd.GetIndex();
+/*N*/ CHKSECTION eSec = nStt < nSttIdx && nEnd >= nSttIdx ? Chk_One : Chk_None;
+/*N*/ if( nStt < nEndIdx && nEnd >= nEndIdx )
+/*N*/ return( eSec == Chk_One ? Chk_Both : Chk_One );
+/*N*/ return eSec;
+/*N*/ }
+
+
+/*N*/ FASTBOOL lcl_ChkOneRange( CHKSECTION eSec, BOOL bChkSections,
+/*N*/ const SwNode& rBaseEnd, ULONG nStt, ULONG nEnd )
+/*N*/ {
+/*N*/ if( eSec != Chk_Both )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ if( !bChkSections )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ // suche die umspannende Section
+/*N*/ const SwNodes& rNds = rBaseEnd.GetNodes();
+/*N*/ const SwNode *pTmp, *pNd = rNds[ nStt ];
+/*N*/ if( !pNd->IsStartNode() )
+/*N*/ pNd = pNd->StartOfSectionNode();
+/*N*/
+/*N*/ if( pNd == rNds[ nEnd ]->StartOfSectionNode() )
+/*N*/ return TRUE; // der gleiche StartNode, die selbe Section
+/*N*/
+/*N*/ // steht schon auf einem GrundSection Node ? Fehler !!!
+/*N*/ if( !pNd->StartOfSectionIndex() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ while( ( pTmp = pNd->StartOfSectionNode())->EndOfSectionNode() !=
+/*N*/ &rBaseEnd )
+/*N*/ pNd = pTmp;
+/*N*/
+/*N*/ ULONG nSttIdx = pNd->GetIndex(), nEndIdx = pNd->EndOfSectionIndex();
+/*N*/ return nSttIdx <= nStt && nStt <= nEndIdx &&
+/*N*/ nSttIdx <= nEnd && nEnd <= nEndIdx ? TRUE : FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL CheckNodesRange( const SwNodeIndex& rStt,
+/*N*/ const SwNodeIndex& rEnd, FASTBOOL bChkSection )
+/*N*/ {
+/*N*/ const SwNodes& rNds = rStt.GetNodes();
+/*N*/ ULONG nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex();
+/*N*/ CHKSECTION eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfContent() );
+/*N*/ if( Chk_None != eSec ) return eSec == Chk_Both ? TRUE : FALSE;
+/*N*/
+/*N*/ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfAutotext() );
+/*N*/ if( Chk_None != eSec )
+/*N*/ return lcl_ChkOneRange( eSec, bChkSection,
+/*N*/ rNds.GetEndOfAutotext(), nStt, nEnd );
+/*N*/
+/*N*/ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfPostIts() );
+/*N*/ if( Chk_None != eSec )
+/*N*/ return lcl_ChkOneRange( eSec, bChkSection,
+/*N*/ rNds.GetEndOfPostIts(), nStt, nEnd );
+/*N*/
+/*?*/ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfInserts() );
+/*?*/ if( Chk_None != eSec )
+/*?*/ return lcl_ChkOneRange( eSec, bChkSection,
+/*?*/ rNds.GetEndOfInserts(), nStt, nEnd );
+/*?*/
+/*?*/ eSec = lcl_TstIdx( nStt, nEnd, rNds.GetEndOfRedlines() );
+/*?*/ if( Chk_None != eSec )
+/*?*/ return lcl_ChkOneRange( eSec, bChkSection,
+/*?*/ rNds.GetEndOfRedlines(), nStt, nEnd );
+/*?*/
+/*?*/ return FALSE; // liegt irgendwo dazwischen, FEHLER
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoNext(SwNode* pNd, SwIndex * pIdx, USHORT nMode )
+/*N*/ {
+/*N*/ if( pNd->IsCntntNode() )
+/*N*/ return ((SwCntntNode*)pNd)->GoNext( pIdx, nMode );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoPrevious( SwNode* pNd, SwIndex * pIdx, USHORT nMode )
+/*N*/ {
+/*N*/ if( pNd->IsCntntNode() )
+/*N*/ return ((SwCntntNode*)pNd)->GoPrevious( pIdx, nMode );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ SwCntntNode* GoNextNds( SwNodeIndex* pIdx, FASTBOOL bChk )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *pIdx );
+/*N*/ SwCntntNode* pNd = aIdx.GetNodes().GoNext( &aIdx );
+/*N*/ if( pNd )
+/*N*/ {
+/*N*/ if( bChk && 1 != aIdx.GetIndex() - pIdx->GetIndex() &&
+/*N*/ !CheckNodesRange( *pIdx, aIdx, TRUE ) )
+/*N*/ pNd = 0;
+/*N*/ else
+/*N*/ *pIdx = aIdx;
+/*N*/ }
+/*N*/ return pNd;
+/*N*/ }
+
+
+/*N*/ SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, FASTBOOL bChk )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *pIdx );
+/*N*/ SwCntntNode* pNd = aIdx.GetNodes().GoPrevious( &aIdx );
+/*N*/ if( pNd )
+/*N*/ {
+/*N*/ if( bChk && 1 != pIdx->GetIndex() - aIdx.GetIndex() &&
+/*N*/ !CheckNodesRange( *pIdx, aIdx, TRUE ) )
+/*N*/ pNd = 0;
+/*N*/ else
+/*N*/ *pIdx = aIdx;
+/*N*/ }
+/*N*/ return pNd;
+/*N*/ }
+
+// ----------------------------------------------------------------------
+
+/*************************************************************************
+|*
+|* SwPointAndMark
+|*
+|* Beschreibung PAM.DOC
+|* Ersterstellung VB 4.3.91
+|* Letzte Aenderung JP 6.5.91
+|*
+*************************************************************************/
+
+/*N*/ SwPaM::SwPaM( const SwPosition& rPos, SwPaM* pRing )
+/*N*/ : aBound1( rPos ), aBound2( rPos ), Ring( pRing )
+/*N*/ {
+/*N*/ pPoint = pMark = &aBound1;
+/*N*/ }
+
+/*N*/ SwPaM::SwPaM( const SwPosition& rMk, const SwPosition& rPt, SwPaM* pRing )
+/*N*/ : aBound1( rMk ), aBound2( rPt ), Ring( pRing )
+/*N*/ {
+/*N*/ pMark = &aBound1;
+/*N*/ pPoint = &aBound2;
+/*N*/ }
+
+
+/*N*/ SwPaM::SwPaM( const SwNode& rMk, const SwNode& rPt,
+/*N*/ long nMkOffset, long nPtOffset, SwPaM* pRing )
+/*N*/ : aBound1( rMk ), aBound2( rPt ), Ring( pRing )
+/*N*/ {
+/*N*/ if( nMkOffset )
+/*N*/ aBound1.nNode += nMkOffset;
+/*N*/ if( nPtOffset )
+/*N*/ aBound2.nNode += nPtOffset;
+/*N*/
+/*N*/ aBound1.nContent.Assign( aBound1.nNode.GetNode().GetCntntNode(), 0 );
+/*N*/ aBound2.nContent.Assign( aBound2.nNode.GetNode().GetCntntNode(), 0 );
+/*N*/ pMark = &aBound1;
+/*N*/ pPoint = &aBound2;
+/*N*/ }
+
+
+/*N*/ SwPaM::SwPaM( const SwNode& rMk, xub_StrLen nMkCntnt,
+/*N*/ const SwNode& rPt, xub_StrLen nPtCntnt, SwPaM* pRing )
+/*N*/ : aBound1( rMk ), aBound2( rPt ), Ring( pRing )
+/*N*/ {
+/*N*/ aBound1.nContent.Assign( aBound1.nNode.GetNode().GetCntntNode(), nMkCntnt );
+/*N*/ aBound2.nContent.Assign( aBound2.nNode.GetNode().GetCntntNode(), nPtCntnt );
+/*N*/ pMark = &aBound1;
+/*N*/ pPoint = &aBound2;
+/*N*/ }
+
+/*N*/ SwPaM::SwPaM( SwPaM &rPam )
+/*N*/ : aBound1( *(rPam.pPoint) ), aBound2( *(rPam.pMark) ), Ring( &rPam )
+/*N*/ {
+/*N*/ pPoint = &aBound1;
+/*N*/ pMark = rPam.HasMark() ? &aBound2 : pPoint;
+/*N*/ }
+
+/*N*/ SwPaM::SwPaM( const SwNode& rNd, xub_StrLen nCntnt, SwPaM* pRing )
+/*N*/ : aBound1( rNd ), aBound2( rNd ), Ring( pRing )
+/*N*/ {
+/*N*/ aBound1.nContent.Assign( aBound1.nNode.GetNode().GetCntntNode(), nCntnt );
+/*N*/ aBound2.nContent = aBound1.nContent;
+/*N*/ pPoint = pMark = &aBound1;
+/*N*/ }
+
+/*N*/ SwPaM::SwPaM( const SwNodeIndex& rNd, xub_StrLen nCntnt, SwPaM* pRing )
+/*N*/ : aBound1( rNd ), aBound2( rNd ), Ring( pRing )
+/*N*/ {
+/*N*/ aBound1.nContent.Assign( rNd.GetNode().GetCntntNode(), nCntnt );
+/*N*/ aBound2.nContent = aBound1.nContent;
+/*N*/ pPoint = pMark = &aBound1;
+/*N*/ }
+
+/*N*/ SwPaM::~SwPaM() {}
+
+/*N*/ void SwPaM::SetMark()
+/*N*/ {
+/*N*/ if(pPoint == &aBound1)
+/*N*/ pMark = &aBound2;
+/*N*/ else
+/*N*/ pMark = &aBound1;
+/*N*/ (*pMark) = (*pPoint);
+/*N*/ }
+
+/*N*/ #ifdef DBG_UTIL
+
+/*N*/ void SwPaM::Exchange()
+/*N*/ {
+/*N*/ if(pPoint != pMark)
+/*N*/ {
+/*N*/ SwPosition *pTmp = pPoint;
+/*N*/ pPoint = pMark;
+/*N*/ pMark = pTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+
+
+/*?*/SwPaM &SwPaM::operator=( SwPaM &rPam )
+/*?*/{
+/*?*/ *pPoint = *( rPam.pPoint );
+/*?*/ if( rPam.HasMark() )
+/*?*/ {
+/*?*/ SetMark();
+/*?*/ *pMark = *( rPam.pMark );
+/*?*/ }
+/*?*/ else
+/*?*/ DeleteMark();
+/*?*/ return *this;
+/*?*/}
+
+// Bewegen des Cursors
+
+
+/*N*/ FASTBOOL SwPaM::Move( SwMoveFn fnMove, SwGoInDoc fnGo )
+/*N*/ {
+/*N*/ return (*fnGo)( *this, fnMove );
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* void SwPaM::MakeRegion( SwMoveFn, SwPaM*, const SwPaM* )
+|*
+|* Beschreibung Setzt den 1. SwPaM auf den uebergebenen SwPaM
+|* oder setzt auf den Anfang oder Ende vom Document.
+|* SPoint bleibt auf der Position stehen, GetMark aendert
+|* sich entsprechend !
+|*
+|* Parameter SwDirection gibt an, ob an Anfang / Ende
+|* SwPaM * der zu setzende Bereich
+|* const SwPaM& der enventuell vorgegeben Bereich
+|* Return-Werte SwPaM* der entsprehend neu gesetzte Bereich
+|*
+|* Ersterstellung JP 26.04.91
+|* Letzte Aenderung JP 26.04.91
+|*
+*************************************************************************/
+
+
+
+
+/*N*/ USHORT SwPaM::GetPageNum( BOOL bAtPoint, const Point* pLayPos )
+/*N*/ {
+/*N*/ // return die Seitennummer am Cursor
+/*N*/ // (fuer Reader + Seitengebundene Rahmen)
+/*N*/ const SwCntntFrm* pCFrm;
+/*N*/ const SwPageFrm *pPg;
+/*N*/ const SwCntntNode *pNd ;
+/*N*/ const SwPosition* pPos = bAtPoint ? pPoint : pMark;
+/*N*/
+/*N*/ if( 0 != ( pNd = pPos->nNode.GetNode().GetCntntNode() ) &&
+/*N*/ 0 != ( pCFrm = pNd->GetFrm( pLayPos, pPos, FALSE )) &&
+/*N*/ 0 != ( pPg = pCFrm->FindPageFrm() ))
+/*N*/ return pPg->GetPhyPageNum();
+/*N*/ return 0;
+/*N*/ }
+
+//-------------------- Suche nach Formaten( FormatNamen ) -----------------
+
+// die Funktion gibt in Suchrichtung den folgenden Node zurueck.
+// Ist in der Richtung keiner mehr vorhanden oder ist dieser ausserhalb
+// des Bereiches, wird ein 0 Pointer returnt.
+// Das rbFirst gibt an, ob es man zu erstenmal einen Node holt. Ist das der
+// Fall, darf die Position vom Pam nicht veraendert werden!
+
+
+
+// ----------------------------------------------------------------------
+
+// hier folgen die Move-Methoden ( Foward, Backward; Content, Node, Doc )
+
+
+/*N*/ void GoStartDoc( SwPosition * pPos )
+/*N*/ {
+/*N*/ SwNodes& rNodes = pPos->nNode.GetNodes();
+/*N*/ pPos->nNode = *rNodes.GetEndOfContent().StartOfSectionNode();
+/*N*/ // es muss immer ein ContentNode gefunden werden !!
+/*N*/ SwCntntNode* pCNd = rNodes.GoNext( &pPos->nNode );
+/*N*/ if( pCNd )
+/*N*/ pCNd->MakeStartIndex( &pPos->nContent );
+/*N*/ }
+
+
+/*N*/ void GoEndDoc( SwPosition * pPos )
+/*N*/ {
+/*N*/ SwNodes& rNodes = pPos->nNode.GetNodes();
+/*N*/ pPos->nNode = rNodes.GetEndOfContent();
+/*N*/ SwCntntNode* pCNd = GoPreviousNds( &pPos->nNode, TRUE );
+/*N*/ if( pCNd )
+/*N*/ pCNd->MakeEndIndex( &pPos->nContent );
+/*N*/ }
+
+
+/*N*/ void GoStartSection( SwPosition * pPos )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+// gehe an das Ende der akt. Grund-Section
+
+
+/*N*/ void GoEndSection( SwPosition * pPos )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+
+
+/*N*/ FASTBOOL GoInDoc( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {
+/*N*/ (*fnMove->fnDoc)( rPam.GetPoint() );
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoInSection( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoInNode( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {
+/*N*/ SwCntntNode *pNd = (*fnMove->fnNds)( &rPam.GetPoint()->nNode, TRUE );
+/*N*/ if( pNd )
+/*N*/ rPam.GetPoint()->nContent.Assign( pNd,
+/*N*/ ::binfilter::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) );
+/*N*/ return 0 != pNd;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoInCntnt( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {
+/*N*/ if( (*fnMove->fnNd)( &rPam.GetPoint()->nNode.GetNode(),
+/*N*/ &rPam.GetPoint()->nContent, CRSR_SKIP_CHARS ))
+/*N*/ return TRUE;
+/*N*/ return GoInNode( rPam, fnMove );
+/*N*/ }
+
+/*N*/ FASTBOOL GoInCntntCells( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+// --------- Funktionsdefinitionen fuer die SwCrsrShell --------------
+
+
+/*N*/ FASTBOOL GoPrevPara( SwPaM & rPam, SwPosPara aPosPara )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoCurrPara( SwPaM & rPam, SwPosPara aPosPara )
+/*N*/ {
+/*N*/ SwPosition& rPos = *rPam.GetPoint();
+/*N*/ SwCntntNode * pNd = rPos.nNode.GetNode().GetCntntNode();
+/*N*/ if( pNd )
+/*N*/ {
+/*N*/ xub_StrLen nOld = rPos.nContent.GetIndex(),
+/*N*/ nNew = aPosPara == fnMoveForward ? 0 : pNd->Len();
+/*N*/ // stand er schon auf dem Anfang/Ende dann zum naechsten/vorherigen
+/*N*/ if( nOld != nNew )
+/*N*/ {
+/*N*/ rPos.nContent.Assign( pNd, nNew );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ // den Node noch etwas bewegen ( auf den naechsten/vorh. CntntNode)
+/*N*/ if( ( aPosPara==fnParaStart && 0 != ( pNd =
+/*N*/ GoPreviousNds( &rPos.nNode, TRUE ))) ||
+/*N*/ ( aPosPara==fnParaEnd && 0 != ( pNd =
+/*N*/ GoNextNds( &rPos.nNode, TRUE ))) )
+/*N*/ {
+/*N*/ rPos.nContent.Assign( pNd,
+/*N*/ ::binfilter::GetSttOrEnd( aPosPara == fnMoveForward, *pNd ));
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoNextPara( SwPaM & rPam, SwPosPara aPosPara )
+/*N*/ {
+/*N*/ if( rPam.Move( fnMoveForward, fnGoNode ) )
+/*N*/ {
+/*N*/ // steht immer auf einem ContentNode !
+/*N*/ SwPosition& rPos = *rPam.GetPoint();
+/*N*/ SwCntntNode * pNd = rPos.nNode.GetNode().GetCntntNode();
+/*N*/ rPos.nContent.Assign( pNd,
+/*N*/ ::binfilter::GetSttOrEnd( aPosPara == fnMoveForward, *pNd ) );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+
+/*N*/ FASTBOOL GoCurrSection( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {
+/*N*/ SwPosition& rPos = *rPam.GetPoint();
+/*N*/ SwPosition aSavePos( rPos ); // eine Vergleichsposition
+/*N*/ SwNodes& rNds = aSavePos.nNode.GetNodes();
+/*N*/ (rNds.*fnMove->fnSection)( &rPos.nNode );
+/*N*/ SwCntntNode *pNd;
+/*N*/ if( 0 == ( pNd = rPos.nNode.GetNode().GetCntntNode()) &&
+/*N*/ 0 == ( pNd = (*fnMove->fnNds)( &rPos.nNode, TRUE )) )
+/*N*/ {
+/*?*/ rPos = aSavePos; // Cusror nicht veraendern
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/ rPos.nContent.Assign( pNd,
+/*N*/ ::binfilter::GetSttOrEnd( fnMove == fnMoveForward, *pNd ) );
+/*N*/ return aSavePos != rPos;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoNextSection( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GoPrevSection( SwPaM & rPam, SwMoveFn fnMove )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return TRUE;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_paminit.cxx b/binfilter/bf_sw/source/core/crsr/sw_paminit.cxx
new file mode 100644
index 000000000000..1fb2e0319f15
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_paminit.cxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+#include <pamtyp.hxx>
+namespace binfilter {
+
+
+/*N*/ static SwMoveFnCollection aFwrd = {
+/*N*/ /* fnNd */ &GoNext,
+/*N*/ /* fnNds */ &GoNextNds,
+/*N*/ /* fnDoc */ &GoEndDoc,
+/*N*/ /* fnSections */ &GoEndSection,
+/*N*/ /* fnCmpOp */ &SwPosition::operator<,
+/*N*/ /* fnGetHint */ &GetFrwrdTxtHint,
+/*N*/ /* fnSearch */ &::utl::TextSearch::SearchFrwrd,
+/*N*/ /* fnSection */ &SwNodes::GoStartOfSection
+/*N*/ };
+
+/*N*/ static SwMoveFnCollection aBwrd = {
+/*N*/ /* fnNd */ &GoPrevious,
+/*N*/ /* fnNds */ &GoPreviousNds,
+/*N*/ /* fnDoc */ &GoStartDoc,
+/*N*/ /* fnSections */ &GoStartSection,
+/*N*/ /* fnCmpOp */ &SwPosition::operator>,
+/*N*/ /* fnGetHint */ &GetBkwrdTxtHint,
+/*N*/ /* fnSearch */ &::utl::TextSearch::SearchBkwrd,
+/*N*/ /* fnSection */ &SwNodes::GoEndOfSection
+/*N*/ };
+
+/*N*/ SwGoInDoc fnGoDoc = &GoInDoc;
+/*N*/ SwGoInDoc fnGoSection = &GoInSection;
+/*N*/ SwGoInDoc fnGoNode = &GoInNode;
+/*N*/ SwGoInDoc fnGoCntnt = &GoInCntnt;
+/*N*/ SwGoInDoc fnGoCntntCells= &GoInCntntCells;
+
+/*N*/ SwWhichPara fnParaPrev = &GoPrevPara;
+/*N*/ SwWhichPara fnParaCurr = &GoCurrPara;
+/*N*/ SwWhichPara fnParaNext = &GoNextPara;
+/*N*/ SwPosPara fnParaStart = &aFwrd;
+/*N*/ SwPosPara fnParaEnd = &aBwrd;
+
+/*N*/ SwWhichSection fnSectionPrev = &GoPrevSection;
+/*N*/ SwWhichSection fnSectionCurr = &GoCurrSection;
+/*N*/ SwWhichSection fnSectionNext = &GoNextSection;
+/*N*/ SwPosSection fnSectionStart = &aFwrd;
+/*N*/ SwPosSection fnSectionEnd = &aBwrd;
+
+// Travelling in Tabellen
+/*N*/ FASTBOOL GotoPrevTable( SwPaM&, SwPosTable, FASTBOOL bInReadOnly );
+/*N*/ FASTBOOL GotoCurrTable( SwPaM&, SwPosTable, FASTBOOL bInReadOnly );
+/*N*/ FASTBOOL GotoNextTable( SwPaM&, SwPosTable, FASTBOOL bInReadOnly );
+
+/*N*/ SwWhichTable fnTablePrev = &GotoPrevTable;
+/*N*/ SwWhichTable fnTableCurr = &GotoCurrTable;
+/*N*/ SwWhichTable fnTableNext = &GotoNextTable;
+/*N*/ SwPosTable fnTableStart = &aFwrd;
+/*N*/ SwPosTable fnTableEnd = &aBwrd;
+
+// Travelling in Bereichen
+/*N*/ FASTBOOL GotoPrevRegion( SwPaM&, SwPosRegion, FASTBOOL bInReadOnly );
+/*N*/ FASTBOOL GotoCurrRegion( SwPaM&, SwPosRegion, FASTBOOL bInReadOnly );
+/*N*/ FASTBOOL GotoCurrRegionAndSkip( SwPaM&, SwPosRegion, FASTBOOL bInReadOnly );
+/*N*/ FASTBOOL GotoNextRegion( SwPaM&, SwPosRegion, FASTBOOL bInReadOnly );
+
+/*N*/ SwWhichRegion fnRegionPrev = &GotoPrevRegion;
+/*N*/ SwWhichRegion fnRegionCurr = &GotoCurrRegion;
+/*N*/ SwWhichRegion fnRegionCurrAndSkip = &GotoCurrRegionAndSkip;
+/*N*/ SwWhichRegion fnRegionNext = &GotoNextRegion;
+/*N*/ SwPosRegion fnRegionStart = &aFwrd;
+/*N*/ SwPosRegion fnRegionEnd = &aBwrd;
+/*N*/
+/*N*/ SwMoveFn fnMoveBackward = &aBwrd;
+/*N*/ SwMoveFn fnMoveForward = &aFwrd;
+
+
+#ifdef USED
+
+// JP 30.11.95:
+// war fuer die CFRONT-Compiler noetig, jetzt sollte das nicht mehr
+// benoetigt werden.
+
+/*N*/ void _InitPam()
+/*N*/ {
+/*N*/ aBwrd.fnNd = &GoPrevious;
+/*N*/ aBwrd.fnNds = &GoPreviousNds;
+/*N*/ aBwrd.fnDoc = &GoStartDoc;
+/*N*/ aBwrd.fnSections= &GoStartSection;
+/*N*/ aBwrd.fnCmpOp = &SwPosition::operator>;
+/*N*/ aBwrd.fnGetHint = &GetBkwrdTxtHint;
+/*N*/ aBwrd.fnSearch = &SearchText::SearchBkwrd;
+/*N*/ aBwrd.fnSection = &SwNodes::GoEndOfSection;
+/*N*/
+/*N*/ aFwrd.fnNd = &GoNext;
+/*N*/ aFwrd.fnNds = &GoNextNds;
+/*N*/ aFwrd.fnDoc = &GoEndDoc;
+/*N*/ aFwrd.fnSections= &GoEndSection;
+/*N*/ aFwrd.fnCmpOp = &SwPosition::operator<;
+/*N*/ aFwrd.fnGetHint = &GetFrwrdTxtHint;
+/*N*/ aFwrd.fnSearch = &SearchText::SearchFrwrd;
+/*N*/ aFwrd.fnSection = &SwNodes::GoStartOfSection;
+/*N*/ }
+#endif
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_splcstk.cxx b/binfilter/bf_sw/source/core/crsr/sw_splcstk.cxx
new file mode 100644
index 000000000000..51a2c3141b72
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_splcstk.cxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "crsrsh.hxx"
+
+#include "splcstk.hxx"
+#include "viscrs.hxx"
+namespace binfilter {
+
+
+
+SwSpellCrsrStk::SwSpellCrsrStk( SwCrsrShell& rShell )
+ : rCrsrShell( rShell ), pErrorPos( 0 )
+{
+ pCurCrsr =
+ pCrsrStk = new SwIntrnlCrsr( rCrsrShell,
+ *rCrsrShell.GetCrsr()->GetPoint() );
+ if( rCrsrShell.GetCrsr()->HasMark() )
+ {
+ pCurCrsr->SetMark();
+ *pCurCrsr->GetMark() = *rCrsrShell.GetCrsr()->GetMark();
+ }
+ // gibt es mehr als einen Cursor ??
+ if( rCrsrShell.GetCrsr()->GetNext() != rCrsrShell.GetCrsr() )
+ {
+ rCrsrShell.HideCrsr(); // alle Cursor erstmal verstecken
+
+ // dann verschiebe den gesamten Ring hierher, in dem aus der Shell
+ // alle ausgekettet und hier eingekettet werden. Bis auf den akt. !
+ Ring* pCrsr = rCrsrShell.GetCrsr();
+ pCrsr->MoveRingTo( pCurCrsr );
+ pCrsr->MoveTo( pCrsr );
+ }
+}
+
+
+SwSpellCrsrStk::~SwSpellCrsrStk()
+{
+ register Ring* p = pCrsrStk;
+ while( p->GetNext() != pCrsrStk )
+ delete p->GetNext();
+
+ delete pCrsrStk;
+ delete pErrorPos;
+}
+
+
+ // akt. Cursor in der CrsrShell mit akt. setzen
+void SwSpellCrsrStk::SetCurCrsr()
+{
+ *rCrsrShell.GetCrsr()->GetPoint() = *pCurCrsr->Start();
+ if( pCurCrsr->HasMark() )
+ {
+ rCrsrShell.GetCrsr()->SetMark();
+ *rCrsrShell.GetCrsr()->GetMark() = *pCurCrsr->End();
+ }
+ else
+ rCrsrShell.GetCrsr()->DeleteMark();
+}
+
+ // gehe zum naechsten Cursor im Ring (falls am Ende returne FALSE;
+
+
+BOOL SwSpellCrsrStk::SetNextCrsr()
+{
+ if( pCurCrsr->GetNext() == pCrsrStk )
+ return FALSE;
+
+ pCurCrsr = (SwIntrnlCrsr*)pCurCrsr->GetNext();
+ SetCurCrsr();
+ return TRUE;
+}
+
+
+ // alle Cursor aus dem CursorStack wieder in der Shell setzen
+void SwSpellCrsrStk::RestoreCrsrs()
+{
+ // verschiebe den gesamten Ring in die Shell, in dem hier
+ // alle ausgekettet und dort eingekettet werden. Bis auf den Stack !
+ if( pCrsrStk->GetNext() != pCrsrStk )
+ {
+ // sich selbst "ausketten"
+ pCrsrStk->MoveRingTo( rCrsrShell.GetCrsr() );
+ pCrsrStk->MoveTo( pCrsrStk );
+ }
+
+ pCurCrsr = pCrsrStk;
+
+ SetCurCrsr();
+
+ rCrsrShell.ShowCrsr(); // Cursor wieder anzeigen
+}
+
+
+ // speicher die akt. Start-Position als Error. An dieser wird spaeter
+ // wieder aufgesetzt
+void SwSpellCrsrStk::StoreErrPos()
+{
+ if( !pErrorPos )
+ pErrorPos = new SwPosition( *rCrsrShell.GetCrsr()->Start() );
+ else
+ *pErrorPos = *rCrsrShell.GetCrsr()->Start();
+}
+
+
+ // akt. Cursor auf die Error-Position setzen
+void SwSpellCrsrStk::SetErrPos()
+{
+ if( !pErrorPos )
+ return;
+
+ *rCrsrShell.GetCrsr()->GetPoint() = *pErrorPos;
+ if( pCurCrsr->HasMark() )
+ {
+ rCrsrShell.GetCrsr()->SetMark();
+ *rCrsrShell.GetCrsr()->GetMark() = *pCurCrsr->End();
+ }
+ else
+ rCrsrShell.GetCrsr()->DeleteMark();
+}
+
+
+#if 0
+
+SwPaM* SwSpellCrsrStk::GetCurCrsr() const { return pCurCrsr; }
+#endif
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_swcrsr.cxx b/binfilter/bf_sw/source/core/crsr/sw_swcrsr.cxx
new file mode 100644
index 000000000000..5fd3581e5974
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_swcrsr.cxx
@@ -0,0 +1,471 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+#include <com/sun/star/i18n/WordType.hdl>
+#include <com/sun/star/i18n/CharType.hdl>
+
+
+
+#include <errhdl.hxx>
+
+#include <unocrsr.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <section.hxx>
+#include <docsh.hxx>
+#include <crsskip.hxx>
+#include <mdiexp.hxx> // ...Percent()
+#include <statstr.hrc> // ResId fuer Statusleiste
+namespace binfilter {
+
+using namespace ::com::sun::star::i18n;
+
+static const USHORT coSrchRplcThreshold = 60000;
+
+struct _PercentHdl
+{
+ SwDocShell* pDSh;
+ ULONG nActPos;
+ BOOL bBack, bNodeIdx;
+
+ _PercentHdl( ULONG nStt, ULONG nEnd, SwDocShell* pSh )
+ : pDSh( pSh )
+ {
+ nActPos = nStt;
+ if( 0 != ( bBack = (nStt > nEnd )) )
+ {
+ ULONG n = nStt; nStt = nEnd; nEnd = n;
+ }
+ ::binfilter::StartProgress( STR_STATSTR_SEARCH, nStt, nEnd, 0 );
+ }
+
+ _PercentHdl( const SwPaM& rPam )
+ : pDSh( (SwDocShell*)rPam.GetDoc()->GetDocShell() )
+ {
+ ULONG nStt, nEnd;
+ if( rPam.GetPoint()->nNode == rPam.GetMark()->nNode )
+ {
+ bNodeIdx = FALSE;
+ nStt = rPam.GetMark()->nContent.GetIndex();
+ nEnd = rPam.GetPoint()->nContent.GetIndex();
+ }
+ else
+ {
+ nStt = rPam.GetMark()->nNode.GetIndex();
+ nEnd = rPam.GetPoint()->nNode.GetIndex();
+ }
+ nActPos = nStt;
+ if( 0 != ( bBack = (nStt > nEnd )) )
+ {
+ ULONG n = nStt; nStt = nEnd; nEnd = n;
+ }
+ ::binfilter::StartProgress( STR_STATSTR_SEARCH, nStt, nEnd, pDSh );
+ }
+
+ ~_PercentHdl() { ::binfilter::EndProgress( pDSh ); }
+
+ void NextPos( ULONG nPos ) const
+ { ::binfilter::SetProgressState( bBack ? nActPos - nPos : nPos, pDSh ); }
+
+ void NextPos( SwPosition& rPos ) const
+ {
+ ULONG nPos;
+ if( bNodeIdx )
+ nPos = rPos.nNode.GetIndex();
+ else
+ nPos = rPos.nContent.GetIndex();
+ ::binfilter::SetProgressState( bBack ? nActPos - nPos : nPos, pDSh );
+ }
+};
+
+/*N*/ SwCursor::SwCursor( const SwPosition &rPos, SwPaM* pRing )
+/*N*/ : SwPaM( rPos, pRing ), pSavePos( 0 ), nCursorBidiLevel( 0 )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwCursor::~SwCursor()
+/*N*/ {
+/*N*/ while( pSavePos )
+/*N*/ {
+/*?*/ _SwCursor_SavePos* pNext = pSavePos->pNext;
+/*?*/ delete pSavePos;
+/*?*/ pSavePos = pNext;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwCursor::operator SwTableCursor* () { return 0; }
+/*N*/ SwCursor::operator SwShellCrsr* () { return 0; }
+/*N*/ SwCursor::operator SwShellTableCrsr* () { return 0; }
+/*N*/ SwCursor::operator SwUnoCrsr* () { return 0; }
+/*N*/ SwCursor::operator SwUnoTableCrsr* () { return 0; }
+
+
+// Sicher die aktuelle Position, damit ggfs. auf diese zurueck
+// gefallen werden kann. Die SavePos Objekte werden als Stack verwaltet,
+// damit das auch alles bei verschachtelten Aufrufen funktioniert.
+// Das CreateNewSavePos ist virtual, damit abgeleitete Klassen vom Cursor
+// gegebenenfalls eigene SaveObjecte anlegen und in den virtuellen
+// Check-Routinen verwenden koennen.
+
+/*N*/ void SwCursor::SaveState()
+/*N*/ {
+/*N*/ _SwCursor_SavePos* pNew = CreateNewSavePos();
+/*N*/ pNew->pNext = pSavePos;
+/*N*/ pSavePos = pNew;
+/*N*/ }
+
+/*N*/ void SwCursor::RestoreState()
+/*N*/ {
+/*N*/ _SwCursor_SavePos* pDel = pSavePos;
+/*N*/ pSavePos = pSavePos->pNext;
+/*N*/ delete pDel;
+/*N*/ }
+
+/*N*/ _SwCursor_SavePos* SwCursor::CreateNewSavePos() const
+/*N*/ {
+/*N*/ return new _SwCursor_SavePos( *this );
+/*N*/ }
+
+// stelle fest, ob sich der Point ausserhalb des Content-Bereichs
+// vom Nodes-Array befindet
+
+
+/*N*/ FASTBOOL SwCursor::IsSelOvr( int eFlags )
+/*N*/ {
+/*N*/ SwTableCursor* pTblCrsr = *this;
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ SwNodes& rNds = pDoc->GetNodes();
+/*N*/
+/*N*/ BOOL bSkipOverHiddenSections, bSkipOverProtectSections;
+/*N*/ SwUnoCrsr* pUnoCrsr = *this;
+/*N*/ if( pUnoCrsr )
+/*N*/ {
+/*N*/ bSkipOverHiddenSections = pUnoCrsr->IsSkipOverHiddenSections();
+/*N*/ bSkipOverProtectSections = pUnoCrsr->IsSkipOverProtectSections();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ bSkipOverHiddenSections = TRUE;
+/*?*/ bSkipOverProtectSections = !IsReadOnlyAvailable();
+/*N*/ }
+
+ // Bereiche vom Nodes-Array ueberpruefen
+/*N*/ if( (SELOVER_CHECKNODESSECTION & eFlags) && pTblCrsr && HasMark() )
+/*N*/ {
+/*?*/ SwNodeIndex aOldPos( rNds, pSavePos->nNode );
+/*?*/ if( !CheckNodesRange( aOldPos, GetPoint()->nNode, TRUE ))
+/*?*/ {
+/*?*/ GetPoint()->nNode = aOldPos;
+/*?*/ GetPoint()->nContent.Assign( GetCntntNode(), pSavePos->nCntnt );
+/*?*/ return TRUE;
+/*?*/ }
+/*N*/ }
+
+// neu: Bereiche ueberpruefen
+// Anfang
+/*N*/ if( pSavePos->nNode != GetPoint()->nNode.GetIndex() &&
+/*N*/ //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
+/*N*/ ( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() ))
+/*N*/ {
+/*N*/ // teste doch mal die neuen Sections:
+/*N*/ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+/*N*/ const SwSectionNode* pSectNd = rPtIdx.GetNode().FindSectionNode();
+/*N*/ if( pSectNd &&
+/*N*/ ((bSkipOverHiddenSections && pSectNd->GetSection().IsHiddenFlag() ) ||
+/*N*/ (bSkipOverProtectSections && pSectNd->GetSection().IsProtectFlag() )))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( 0 == ( SELOVER_CHANGEPOS & eFlags ) )
+/*N*/ }
+
+ // oder sollte eine geschuetzte Section innerhalb der Selektion liegen?
+/*N*/ if( HasMark() && bSkipOverProtectSections)
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ULONG nSttIdx = GetMark()->nNode.GetIndex(),
+/*N*/ }
+/*?*/
+/*N*/ }
+// Ende
+// neu: Bereiche ueberpruefen
+
+/*N*/ const SwNode* pNd = &GetPoint()->nNode.GetNode();
+/*N*/ if( pNd->IsCntntNode() && 0 == (SwUnoCrsr*)*this )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->GetFrm();
+/*N*/ }
+
+ // darf der Cursor in geschuetzen "Nodes" stehen?
+/*N*/ if( 0 == ( SELOVER_CHANGEPOS & eFlags ) && !IsAtValidPos() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 DeleteMark();
+/*N*/ }
+
+/*N*/ if( !HasMark() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ //JP 19.08.98: teste mal auf ungueltige Selektion - sprich ueber
+/*N*/ // GrundSections:
+/*N*/ if( !::binfilter::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, TRUE ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 DeleteMark();
+/*N*/ }
+
+/*N*/ const SwTableNode* pPtNd = pNd->FindTableNode();
+
+/*N*/ if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode() &&
+/*N*/ !((SwCntntNode*)pNd)->GetFrm() && 0 == (SwUnoCrsr*)*this )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 DeleteMark();
+/*N*/ }
+
+/*N*/ const SwTableNode* pMrkNd = pNd->FindTableNode();
+/*N*/
+/*N*/ // beide in keinem oder beide im gleichen TableNode
+/*N*/ if( ( !pMrkNd && !pPtNd ) || pPtNd == pMrkNd )
+/*N*/ return FALSE;
+
+ // in unterschiedlichen Tabellen oder nur Mark in der Tabelle
+/*?*/ if( ( pPtNd && pMrkNd ) || pMrkNd )
+/*?*/ { // dann lasse das nicht zu, alte Pos zurueck
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 RestoreSavePos();
+/*?*/ }
+
+ // ACHTUNG: dieses kann nicht im TableMode geschehen !!
+/*?*/ if( pPtNd ) // nur Point in Tabelle, dann gehe hinter/vor diese
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( SELOVER_CHANGEPOS & eFlags )
+/*?*/ }
+/*?*/ return FALSE; // was bleibt noch ??
+/*N*/ }
+
+#if defined( UNX ) || defined( MAC )
+#define IDX (*pCellStt)
+#else
+#define IDX aCellStt
+#endif
+
+
+/*N*/ FASTBOOL SwCursor::IsInProtectTable( FASTBOOL bMove, FASTBOOL bChgCrsr )
+/*N*/ {
+/*N*/ // stehe ich in einer Tabelle ??
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ SwCntntNode* pCNd = GetCntntNode();
+/*N*/ if( !pCNd || pSavePos->nNode == GetPoint()->nNode.GetIndex() ||
+/*N*/ !pCNd->FindTableNode() ||
+/*N*/ !pCNd->IsProtect() ||
+/*N*/ IsReadOnlyAvailable() )
+/*N*/ return FALSE;
+
+/*?*/ if( !bMove )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( bChgCrsr )
+/*?*/ }
+/*?*/
+/*?*/ // wir stehen in einer geschuetzten TabellenZelle
+/*?*/ // von Oben nach Unten Traveln ?
+/*?*/ if( pSavePos->nNode < GetPoint()->nNode.GetIndex() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // suche die naechste "gueltige" Box
+/*?*/
+/*?*/ }
+/*?*/
+/*?*/ // suche die vorherige "gueltige" Box
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // liegt vor dem StartNode der Zelle ein weiterer EndNode, dann
+/*?*/ // gibt es auch eine vorherige Zelle
+/*?*/ }
+/*?*/
+/*?*/ ASSERT( FALSE, "sollte nie erreicht werden oder??" );
+/*?*/ return FALSE;
+/*N*/ }
+
+// TRUE: an die Position kann der Cursor gesetzt werden
+/*N*/ FASTBOOL SwCursor::IsAtValidPos( BOOL bPoint ) const
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); return FALSE; //STRIP001 const SwDoc* pDoc = GetDoc();
+/*N*/ }
+
+/*N*/ void SwCursor::SaveTblBoxCntnt( const SwPosition* ) {}
+
+// setze den SRange fuer das Suchen im Dokument
+
+
+
+
+
+
+
+
+// diese Methode "sucht" fuer alle Anwendungsfaelle, denn in SwFindParas
+// steht immer die richtigen Parameter und die entsprechende Find-Methode
+
+/*M*/ ULONG SwCursor::FindAll( SwFindParas& rParas,
+/*M*/ SwDocPositions nStart, SwDocPositions nEnde,
+/*M*/ FindRanges eFndRngs, BOOL& bCancel )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001
+/*M*/ }
+
+
+
+
+/*N*/ FASTBOOL SwCursor::IsStartWord() const
+/*N*/ {
+/*N*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ FASTBOOL SwCursor::IsEndWord() const
+/*N*/ {
+ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwCursor::GoStartWord()
+/*N*/ {
+/*N*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ FASTBOOL SwCursor::GoEndWord()
+/*N*/ {
+/*N*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ FASTBOOL SwCursor::GoNextWord()
+/*N*/ {
+/*?*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ FASTBOOL SwCursor::GoPrevWord()
+/*N*/ {
+/*?*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+
+//-----------------------------------------------------------------------------
+/*N*/ FASTBOOL SwCursor::GoSentence( SentenceMoveType eMoveType )
+/*N*/ {
+/*?*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwCursor::LeftRight( BOOL bLeft, USHORT nCnt, USHORT nMode,
+/*N*/ BOOL bVisualAllowed, BOOL bInsertCrsr )
+/*N*/ {
+/*N*/ SwTableCursor* pTblCrsr = (SwTableCursor*)*this;
+/*N*/ if( pTblCrsr )
+/*N*/ return bLeft ? pTblCrsr->GoPrevCell( nCnt )
+/*N*/ : pTblCrsr->GoNextCell( nCnt );
+/*N*/
+/*N*/ // calculate cursor bidi level
+/*N*/ const SwCntntFrm* pSttFrm = NULL;
+/*N*/ SwNode& rNode = GetPoint()->nNode.GetNode();
+/*N*/ const BOOL bDoNotSetBidiLevel = 0 != (SwUnoCrsr*)*this;
+/*N*/
+/*N*/ if ( ! bDoNotSetBidiLevel )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ // kann der Cursor n-mal weiterverschoben werden ?
+/*N*/ SwCrsrSaveState aSave( *this );
+/*N*/ SwMoveFn fnMove = bLeft ? fnMoveBackward : fnMoveForward;
+/*N*/ SwGoInDoc fnGo = CRSR_SKIP_CELLS == nMode ? fnGoCntntCells : fnGoCntnt;
+/*N*/ while( nCnt && Move( fnMove, fnGo ) )
+/*N*/ --nCnt;
+/*N*/
+/*N*/ // here come some special rules for visual cursor travelling
+/*N*/ if ( pSttFrm )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ return 0 == nCnt && !IsInProtectTable( TRUE ) &&
+/*N*/ !IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS );
+/*N*/ }
+
+/*N*/ FASTBOOL SwCursor::UpDown( BOOL bUp, USHORT nCnt,
+/*N*/ Point* pPt, long nUpDownX )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 SwTableCursor* pTblCrsr = (SwTableCursor*)*this;
+/*N*/ }
+
+/*N*/ FASTBOOL SwCursor::GotoTblBox( const String& rName )
+/*N*/ {
+/*N*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+/*N*/ FASTBOOL SwCursor::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara )
+/*N*/ {
+/*N*/ //JP 28.8.2001: for optimization test something before
+/*N*/ const SwNode* pNd;
+/*N*/ if( fnWhichPara == fnParaCurr ||
+/*N*/ (( pNd = &GetPoint()->nNode.GetNode())->IsTxtNode() &&
+/*N*/ pNd->GetNodes()[ pNd->GetIndex() +
+/*N*/ (fnWhichPara == fnParaNext ? 1 : -1 ) ]->IsTxtNode() ) )
+/*N*/ {
+/*N*/ return (*fnWhichPara)( *this, fnPosPara );
+/*N*/ }
+/*N*/ // else we must use the SaveStructure, because the next/prev is not
+/*N*/ // a same node type.
+/*N*/ SwCrsrSaveState aSave( *this );
+/*N*/ return (*fnWhichPara)( *this, fnPosPara ) &&
+/*N*/ !IsInProtectTable( TRUE ) &&
+/*N*/ !IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS );
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwCursor::MoveSection( SwWhichSection fnWhichSect,
+/*N*/ SwPosSection fnPosSect)
+/*N*/ {
+/*N*/ SwCrsrSaveState aSave( *this );
+/*N*/ return (*fnWhichSect)( *this, fnPosSect ) &&
+/*N*/ !IsInProtectTable( TRUE ) &&
+/*N*/ !IsSelOvr( SELOVER_TOGGLE | SELOVER_CHANGEPOS );
+/*N*/ }
+
+/*N*/ SwTableCursor::~SwTableCursor() {}
+
+/*N*/ SwTableCursor::operator SwTableCursor* () { return this; }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_trvlreg.cxx b/binfilter/bf_sw/source/core/crsr/sw_trvlreg.cxx
new file mode 100644
index 000000000000..c520ebe5869b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_trvlreg.cxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include <crsrsh.hxx>
+#include <viscrs.hxx>
+namespace binfilter {
+
+
+
+/*N*/ FASTBOOL GotoPrevRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GotoNextRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GotoCurrRegion( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE; //STRIP001
+/*N*/ }
+
+
+/*N*/ FASTBOOL GotoCurrRegionAndSkip( SwPaM& rCurCrsr, SwPosRegion fnPosRegion,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return FALSE;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx b/binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx
new file mode 100644
index 000000000000..2ea0e3ef04d9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_trvltbl.cxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <cntfrm.hxx>
+#include <editsh.hxx> //EndAllAction gibts nur an der EditShell
+#include <frmfmt.hxx>
+#include <viscrs.hxx>
+#include <ndtxt.hxx>
+#include <shellres.hxx>
+#include <cellfrm.hxx>
+namespace binfilter {
+
+// setze Crsr in die naechsten/vorherigen Celle
+
+
+
+
+
+
+
+
+
+
+
+
+// suche die naechste nicht geschuetzte Zelle innerhalb der Tabelle
+// Parameter:
+// rIdx - steht auf dem TabellenNode
+// SwDoc -
+// return:
+// 0 - Idx steht auf/in einer nicht geschuetzten Zelle
+// !0 - Node hinter der Tabelle
+
+
+
+// suche die vorherige nicht geschuetzte Zelle innerhalb der Tabelle
+// Parameter:
+// rIdx - steht auf dem EndNode der Tabelle
+// SwDoc -
+// return:
+// 0 - Idx steht auf/in einer nicht geschuetzten Zelle
+// !0 - Node hinter der Tabelle
+
+
+
+
+
+/*N*/ FASTBOOL GotoPrevTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GotoNextTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL GotoCurrTable( SwPaM& rCurCrsr, SwPosTable fnPosTbl,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwCursor::MoveTable( SwWhichTable fnWhichTbl, SwPosTable fnPosTbl )
+/*N*/ {
+/*N*/ FASTBOOL bRet = FALSE;DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ FASTBOOL SwCrsrShell::CheckTblBoxCntnt( const SwPosition* pPos )
+/*N*/ {
+/*N*/ if( !pBoxIdx || !pBoxPtr || IsSelTblCells() || !IsAutoUpdateCells() )
+/*N*/ return FALSE;
+
+ // ueberpruefe, ob der Box Inhalt mit dem angegebenen Format der Box
+ // ueber einstimmt. Wenn nicht, setze neu
+/*?*/ SwTableBox* pChkBox = 0;
+/*?*/ SwStartNode* pSttNd;
+/*?*/ if( !pPos )
+/*?*/ {
+/*?*/ // gesicherte Position heraus holen.
+/*?*/ if( pBoxIdx && pBoxPtr &&
+/*?*/ 0 != ( pSttNd = pBoxIdx->GetNode().GetStartNode() ) &&
+/*?*/ SwTableBoxStartNode == pSttNd->GetStartNodeType() &&
+/*?*/ pBoxPtr == pSttNd->FindTableNode()->GetTable().
+/*?*/ GetTblBox( pBoxIdx->GetIndex() ) )
+/*?*/ pChkBox = pBoxPtr;
+/*?*/ }
+/*?*/ else if( 0 != ( pSttNd = pPos->nNode.GetNode().
+/*?*/ FindSttNodeByType( SwTableBoxStartNode )) )
+/*?*/ {
+/*?*/ pChkBox = pSttNd->FindTableNode()->GetTable().GetTblBox( pSttNd->GetIndex() );
+/*?*/ }
+/*?*/
+/*?*/
+/*?*/ // Box mehr als 1 Absatz?
+/*?*/ if( pChkBox && pSttNd->GetIndex() + 2 != pSttNd->EndOfSectionIndex() )
+/*?*/ pChkBox = 0;
+/*?*/
+/*?*/ // jetzt sollten wir mal die Pointer zerstoeren, bevor eine erneute
+/*?*/ // Actionklammerung kommt.
+/*?*/ if( !pPos && !pChkBox )
+/*?*/ ClearTblBoxCntnt();
+/*?*/
+/*?*/ // liegt der Cursor nicht mehr in dem Bereich ?
+/*?*/ if( pChkBox && !pPos &&
+/*?*/ ( pCurCrsr->HasMark() || pCurCrsr->GetNext() != pCurCrsr ||
+/*?*/ pSttNd->GetIndex() + 1 == pCurCrsr->GetPoint()->nNode.GetIndex() ))
+/*?*/ pChkBox = 0;
+/*?*/
+/*?*/ //JP 12.01.99: hat sich der Inhalt der Box ueberhaupt veraendert?
+/*?*/ // Ist wichtig, wenn z.B. Undo nicht den richtigen Inhalt wieder
+/*?*/ // herstellen konnte.
+/*?*/ if( pChkBox )
+/*?*/ {
+/*?*/ const SwTxtNode* pNd = GetDoc()->GetNodes()[
+/*?*/ pSttNd->GetIndex() + 1 ]->GetTxtNode();
+/*?*/ if( !pNd ||
+/*?*/ ( pNd->GetTxt() == ViewShell::GetShellRes()->aCalc_Error &&
+/*?*/ SFX_ITEM_SET == pChkBox->GetFrmFmt()->
+/*?*/ GetItemState( RES_BOXATR_FORMULA )) )
+/*?*/ pChkBox = 0;
+/*?*/ }
+/*?*/
+/*?*/ if( pChkBox )
+/*?*/ {
+/*?*/ // jetzt sollten wir mal die Pointer zerstoeren, bevor ein weiterer
+/*?*/ // aufruf kommt.
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ClearTblBoxCntnt();
+/*?*/ }
+/*?*/
+/*?*/ return 0 != pChkBox;
+/*N*/ }
+
+
+/*N*/ void SwCrsrShell::ClearTblBoxCntnt()
+/*N*/ {
+/*N*/ delete pBoxIdx, pBoxIdx = 0;
+/*N*/ pBoxPtr = 0;
+/*N*/ }
+
+/*N*/ FASTBOOL SwCrsrShell::EndAllTblBoxEdit()
+/*N*/ {
+/*N*/ FASTBOOL bRet = FALSE;
+/*N*/ ViewShell *pSh = this;
+/*N*/ do {
+/*N*/ if( pSh->IsA( TYPE( SwCrsrShell ) ) )
+/*N*/ bRet |= ((SwCrsrShell*)pSh)->CheckTblBoxCntnt(
+/*N*/ ((SwCrsrShell*)pSh)->pCurCrsr->GetPoint() );
+/*N*/
+/*N*/ } while( this != (pSh = (ViewShell *)pSh->GetNext()) );
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_unocrsr.cxx b/binfilter/bf_sw/source/core/crsr/sw_unocrsr.cxx
new file mode 100644
index 000000000000..b7804fe6e0fb
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_unocrsr.cxx
@@ -0,0 +1,222 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+#include <unocrsr.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+namespace binfilter {
+
+/*N*/ SV_IMPL_PTRARR( SwUnoCrsrTbl, SwUnoCrsrPtr )
+
+/*N*/ IMPL_FIXEDMEMPOOL_NEWDEL( SwUnoCrsr, 10, 10 )
+
+/*N*/ SwUnoCrsr::SwUnoCrsr( const SwPosition &rPos, SwPaM* pRing )
+/*N*/ : SwCursor( rPos, pRing ), SwModify( 0 ),
+/*N*/ bRemainInSection( TRUE ),
+/*N*/ bSkipOverHiddenSections( FALSE ),
+/*N*/ bSkipOverProtectSections( FALSE )
+/*N*/
+/*N*/ {}
+
+/*N*/ SwUnoCrsr::~SwUnoCrsr()
+/*N*/ {
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ if( !pDoc->IsInDtor() )
+/*N*/ {
+/*N*/ // dann muss der Cursor aus dem Array ausgetragen werden
+/*N*/ SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
+/*N*/ USHORT nDelPos = rTbl.GetPos( this );
+/*N*/
+/*N*/ if( USHRT_MAX != nDelPos )
+/*N*/ rTbl.Remove( nDelPos );
+/*N*/ else
+/*N*/ ASSERT( !this, "UNO Cursor nicht mehr im Array" );
+/*N*/ }
+/*N*/
+/*N*/ // den gesamten Ring loeschen!
+/*N*/ while( GetNext() != this )
+/*N*/ {
+/*N*/ Ring* pNxt = GetNext();
+/*N*/ pNxt->MoveTo( 0 ); // ausketten
+/*N*/ delete pNxt; // und loeschen
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwUnoCrsr::operator SwUnoCrsr* () { return this; }
+
+/*
+
+SwCursor* SwUnoCrsr::Create( SwPaM* pRing ) const
+{
+ return new SwUnoCrsr( *GetPoint(), pRing );
+}
+
+*/
+
+/*N*/ FASTBOOL SwUnoCrsr::IsSelOvr( int eFlags )
+/*N*/ {
+/*N*/ if( bRemainInSection )
+/*N*/ {
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ SwNodeIndex aOldIdx( *pDoc->GetNodes()[ GetSavePos()->nNode ] );
+/*N*/ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+/*N*/ SwStartNode *pOldSttNd = aOldIdx.GetNode().FindStartNode(),
+/*N*/ *pNewSttNd = rPtIdx.GetNode().FindStartNode();
+/*N*/ if( pOldSttNd != pNewSttNd )
+/*N*/ {
+/*N*/ BOOL bMoveDown = GetSavePos()->nNode < rPtIdx.GetIndex();
+/*N*/ BOOL bValidPos = FALSE;
+/*N*/
+/*N*/ // search the correct surrounded start node - which the index
+/*N*/ // can't leave.
+/*N*/ while( pOldSttNd->IsSectionNode() )
+/*N*/ pOldSttNd = pOldSttNd->StartOfSectionNode();
+/*N*/
+/*N*/ // is the new index inside this surrounded section?
+/*N*/ if( rPtIdx > *pOldSttNd &&
+/*N*/ rPtIdx < pOldSttNd->EndOfSectionIndex() )
+/*N*/ {
+/*N*/ // check if it a valid move inside this section
+/*N*/ // (only over SwSection's !)
+/*N*/ const SwStartNode* pInvalidNode;
+/*N*/ do {
+/*N*/ pInvalidNode = 0;
+/*N*/ pNewSttNd = rPtIdx.GetNode().FindStartNode();
+/*N*/
+/*N*/ const SwStartNode *pSttNd = pNewSttNd, *pEndNd = pOldSttNd;
+/*N*/ if( pSttNd->EndOfSectionIndex() >
+/*N*/ pEndNd->EndOfSectionIndex() )
+/*N*/ {
+/*?*/ pEndNd = pNewSttNd;
+/*?*/ pSttNd = pOldSttNd;
+/*N*/ }
+/*N*/
+/*N*/ while( pSttNd->GetIndex() > pEndNd->GetIndex() )
+/*N*/ {
+/*N*/ if( !pSttNd->IsSectionNode() )
+/*?*/ pInvalidNode = pSttNd;
+/*N*/ pSttNd = pSttNd->StartOfSectionNode();
+/*N*/ }
+/*N*/ if( pInvalidNode )
+/*N*/ {
+/*?*/ if( bMoveDown )
+/*?*/ {
+/*?*/ rPtIdx.Assign( *pInvalidNode->EndOfSectionNode(), 1 );
+/*?*/
+/*?*/ if( !rPtIdx.GetNode().IsCntntNode() &&
+/*?*/ !pDoc->GetNodes().GoNextSection( &rPtIdx ))
+/*?*/ break;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ rPtIdx.Assign( *pInvalidNode, -1 );
+/*?*/
+/*?*/ if( !rPtIdx.GetNode().IsCntntNode() &&
+/*?*/ !pDoc->GetNodes().GoPrevSection( &rPtIdx ))
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bValidPos = TRUE;
+/*N*/ } while ( pInvalidNode );
+/*N*/ }
+/*N*/
+/*N*/ if( bValidPos )
+/*N*/ {
+/*N*/ SwCntntNode* pCNd = GetCntntNode();
+/*N*/ USHORT nCnt = 0;
+/*N*/ if( pCNd && !bMoveDown )
+/*N*/ nCnt = pCNd->Len();
+/*N*/ GetPoint()->nContent.Assign( pCNd, nCnt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rPtIdx = GetSavePos()->nNode;
+/*N*/ GetPoint()->nContent.Assign( GetCntntNode(), GetSavePos()->nCntnt );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return SwCursor::IsSelOvr( eFlags );
+/*N*/ }
+
+
+/* */
+
+/*N*/ SwUnoTableCrsr::~SwUnoTableCrsr()
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 while( aTblSel.GetNext() != &aTblSel )
+/*N*/ }
+
+/*N*/ SwUnoTableCrsr::operator SwUnoCrsr* () { return this; }
+/*N*/ SwUnoTableCrsr::operator SwTableCursor* () { return this; }
+/*N*/ SwUnoTableCrsr::operator SwUnoTableCrsr* () { return this; }
+
+/*
+SwCursor* SwUnoTableCrsr::Create( SwPaM* pRing ) const
+{
+ return SwUnoCrsr::Create( pRing );
+}
+*/
+
+/*N*/ FASTBOOL SwUnoTableCrsr::IsSelOvr( int eFlags )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 FASTBOOL bRet = SwUnoCrsr::IsSelOvr( eFlags );
+/*N*/ }
+
+/*N*/ void SwUnoTableCrsr::MakeBoxSels()
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/* */
+
+/*N*/ SwUnoCrsr* SwDoc::CreateUnoCrsr( const SwPosition& rPos, BOOL bTblCrsr )
+/*N*/ {
+/*N*/ SwUnoCrsr* pNew;
+/*N*/ if( bTblCrsr )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pNew = new SwUnoTableCrsr( rPos );
+/*N*/ else
+/*N*/ pNew = new SwUnoCrsr( rPos );
+/*N*/
+/*N*/ pUnoCrsrTbl->Insert( pNew, pUnoCrsrTbl->Count() );
+/*N*/ return pNew;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/crsr/sw_viscrs.cxx b/binfilter/bf_sw/source/core/crsr/sw_viscrs.cxx
new file mode 100644
index 000000000000..36c6e7cd34aa
--- /dev/null
+++ b/binfilter/bf_sw/source/core/crsr/sw_viscrs.cxx
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#endif
+
+
+#include <viewopt.hxx>
+#include <frmtool.hxx>
+#include <viscrs.hxx>
+
+#include <horiornt.hxx>
+
+#include <crsrsh.hxx>
+#include <dview.hxx>
+#include <txtfrm.hxx> // SwTxtFrm
+#include <ndtxt.hxx>
+#include <drawfont.hxx>
+
+#include <comcore.hrc> // ResId fuer Abfrage wenn zu Search & Replaces
+namespace binfilter {
+
+
+// OD 24.01.2003 #106593# - no longer needed, included in <frmtool.hxx>
+//extern void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh );
+extern void SwCalcPixStatics( OutputDevice *pOut );
+
+
+//Damit beim ShowCrsr nicht immer wieder die gleiche Size teuer ermittelt
+//werden muss, hier statische Member, die beim Wechsel des MapModes
+// angepasst werden
+
+long SwSelPaintRects::nPixPtX = 0;
+long SwSelPaintRects::nPixPtY = 0;
+MapMode* SwSelPaintRects::pMapMode = 0;
+
+
+
+//#define SHOW_BOOKMARKS
+//#define SHOW_REDLINES
+
+#ifdef SHOW_BOOKMARKS
+
+
+
+
+
+
+#define SHOWBOOKMARKS1( nAct ) ShowBookmarks( GetShell(),nAct );
+
+#else
+
+#define SHOWBOOKMARKS1( nAct )
+#endif
+#ifdef SHOW_REDLINES
+
+
+
+
+
+
+#define SHOWREDLINES1( nAct ) ShowRedlines( GetShell(),nAct );
+#else
+#define SHOWREDLINES1( nAct )
+#endif
+
+/*N*/ SwVisCrsr::~SwVisCrsr()
+/*N*/ {
+/*N*/ #ifdef SW_CRSR_TIMER
+/*N*/ if( bTimerOn )
+/*N*/ Stop(); // Timer stoppen
+/*N*/ #endif
+/*N*/
+/*N*/ if( bIsVisible && aTxtCrsr.IsVisible() )
+/*?*/ aTxtCrsr.Hide();
+/*N*/
+/*N*/ pCrsrShell->GetWin()->SetCursor( 0 );
+/*N*/ }
+
+
+
+
+/*N*/ void SwVisCrsr::Show()
+/*N*/ {
+/*N*/ if( !bIsVisible )
+/*N*/ {
+/*N*/ bIsVisible = TRUE;
+/*N*/
+/*N*/ // muss ueberhaupt angezeigt werden ?
+/*N*/ if( pCrsrShell->VisArea().IsOver( pCrsrShell->aCharRect ) )
+/*N*/ #ifdef SW_CRSR_TIMER
+/*N*/ {
+/*N*/ if( bTimerOn )
+/*N*/ Start(); // Timer aufsetzen
+/*N*/ else
+/*N*/ {
+/*N*/ if( IsActive() )
+/*N*/ Stop(); // Timer Stoppen
+/*N*/
+/*N*/ _SetPosAndShow();
+/*N*/ }
+/*N*/ }
+/*N*/ #else
+/*N*/ _SetPosAndShow();
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void SwVisCrsr::Hide()
+/*N*/ {
+/*N*/ if( bIsVisible )
+/*N*/ {
+/*N*/ bIsVisible = FALSE;
+/*N*/
+/*N*/ #ifdef SW_CRSR_TIMER
+/*N*/ if( IsActive() )
+/*N*/ Stop(); // Timer Stoppen
+/*N*/ #endif
+/*N*/
+/*N*/ if( aTxtCrsr.IsVisible() ) // sollten die Flags nicht gueltig sein?
+/*?*/ aTxtCrsr.Hide();
+/*N*/ }
+/*N*/ }
+
+#ifdef SW_CRSR_TIMER
+
+
+
+
+#endif
+
+
+/*N*/ void SwVisCrsr::_SetPosAndShow()
+/*N*/ {
+/*N*/ SwRect aRect;
+/*N*/ long nTmpY = pCrsrShell->aCrsrHeight.Y();
+/*N*/ if( 0 > nTmpY )
+/*N*/ {
+/*?*/ nTmpY = -nTmpY;
+/*?*/ aTxtCrsr.SetOrientation( 900 );
+/*?*/ aRect = SwRect( pCrsrShell->aCharRect.Pos(),
+/*?*/ Size( pCrsrShell->aCharRect.Height(), nTmpY ) );
+/*?*/ aRect.Pos().X() += pCrsrShell->aCrsrHeight.X();
+/*?*/ if( pCrsrShell->IsOverwriteCrsr() )
+/*?*/ aRect.Pos().Y() += aRect.Width();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aTxtCrsr.SetOrientation( 0 );
+/*N*/ aRect = SwRect( pCrsrShell->aCharRect.Pos(),
+/*N*/ Size( pCrsrShell->aCharRect.Width(), nTmpY ) );
+/*N*/ aRect.Pos().Y() += pCrsrShell->aCrsrHeight.X();
+/*N*/ }
+/*N*/
+/*N*/ // check if cursor should show the current cursor bidi level
+/*N*/ aTxtCrsr.SetDirection( CURSOR_DIRECTION_NONE );
+/*N*/ const SwCursor* pTmpCrsr = pCrsrShell->_GetCrsr();
+/*N*/
+/*N*/ if ( pTmpCrsr && !pCrsrShell->IsOverwriteCrsr() )
+/*N*/ {
+/*N*/ SwNode& rNode = pTmpCrsr->GetPoint()->nNode.GetNode();
+/*N*/ if( rNode.IsTxtNode() )
+/*N*/ {
+/*N*/ const SwTxtNode& rTNd = *rNode.GetTxtNode();
+/*N*/ Point aPt( aRect.Pos() );
+/*N*/ SwFrm* pFrm = rTNd.GetFrm( &aPt );
+/*N*/ if ( pFrm )
+/*N*/ {
+/*N*/ const SwScriptInfo* pSI = ((SwTxtFrm*)pFrm)->GetScriptInfo();
+/*N*/ // cursor level has to be shown
+/*N*/ if ( pSI && pSI->CountDirChg() > 1 )
+/*N*/ {
+/*N*/ aTxtCrsr.SetDirection(
+/*N*/ ( pTmpCrsr->GetCrsrBidiLevel() % 2 ) ?
+/*N*/ CURSOR_DIRECTION_RTL :
+/*N*/ CURSOR_DIRECTION_LTR );
+/*N*/ }
+/*N*/
+/*N*/ if ( pFrm->IsRightToLeft() )
+/*N*/ {
+/*N*/ const OutputDevice *pOut = pCrsrShell->GetOut();
+/*N*/ if ( pOut )
+/*N*/ {
+/*N*/ USHORT nSize = pOut->GetSettings().GetStyleSettings().GetCursorSize();
+/*N*/ Size aSize( nSize, nSize );
+/*N*/ aSize = pOut->PixelToLogic( aSize );
+/*N*/ aRect.Left( aRect.Left() - aSize.Width() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( aRect.Height() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ if( !pCrsrShell->IsOverwriteCrsr() || bIsDragCrsr ||
+/*N*/ pCrsrShell->IsSelection() )
+/*N*/ aRect.Width( 0 );
+/*N*/
+/*N*/ aTxtCrsr.SetSize( aRect.SSize() );
+/*N*/
+/*N*/ aTxtCrsr.SetPos( aRect.Pos() );
+/*N*/ if ( !pCrsrShell->IsCrsrReadonly() || pCrsrShell->GetViewOptions()->IsSelectionInReadonly() )
+/*N*/ {
+/*N*/ if ( pCrsrShell->GetDrawView() )
+/*N*/ ((SwDrawView*)pCrsrShell->GetDrawView())->SetAnimationEnabled(
+/*N*/ !pCrsrShell->IsSelection() );
+/*N*/
+/*N*/ USHORT nStyle = bIsDragCrsr ? CURSOR_SHADOW : 0;
+/*N*/ if( nStyle != aTxtCrsr.GetStyle() )
+/*N*/ {
+/*?*/ aTxtCrsr.SetStyle( nStyle );
+/*?*/ aTxtCrsr.SetWindow( bIsDragCrsr ? pCrsrShell->GetWin() : 0 );
+/*N*/ }
+/*N*/
+/*N*/ aTxtCrsr.Show();
+/*N*/ }
+/*N*/ }
+
+
+/* */
+// ------ Ab hier Klassen / Methoden fuer die Selectionen -------
+
+/*N*/ SwSelPaintRects::~SwSelPaintRects()
+/*N*/ {
+/*N*/ Hide();
+/*N*/ }
+
+/*N*/ void SwSelPaintRects::Hide()
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < Count(); ++n )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 Paint( (*this)[n] );
+/*N*/ SwRects::Remove( 0, Count() );
+/*N*/ }
+
+/*N*/ void SwSelPaintRects::Show()
+/*N*/ {
+/*N*/ if( pCShell->GetDrawView() )
+/*N*/ {
+/*N*/ SdrView* pView = (SdrView*)pCShell->GetDrawView();
+/*N*/ pView->SetAnimationEnabled( !pCShell->IsSelection() );
+/*N*/ }
+/*N*/
+/*N*/ SwRects aTmp;
+/*N*/ aTmp.Insert( this, 0 ); // Kopie vom Array
+/*N*/
+/*N*/ SwRects::Remove( 0, SwRects::Count() );
+/*N*/ FillRects();
+/*N*/
+/*N*/ if( Count() || aTmp.Count() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwRegionRects aReg( pCShell->VisArea() );
+/*N*/ }
+/*N*/ }
+
+/* */
+
+/*N*/ SwShellCrsr::~SwShellCrsr() {}
+
+/*N*/ SwShellCrsr::operator SwShellCrsr* () { return this; }
+
+
+/*N*/ void SwShellCrsr::FillRects()
+/*N*/ {
+/*N*/ // die neuen Rechtecke berechnen
+/*N*/ if( HasMark() &&
+/*N*/ GetPoint()->nNode.GetNode().IsCntntNode() &&
+/*N*/ GetPoint()->nNode.GetNode().GetCntntNode()->GetFrm() &&
+/*N*/ (GetMark()->nNode == GetPoint()->nNode ||
+/*N*/ (GetMark()->nNode.GetNode().IsCntntNode() &&
+/*N*/ GetMark()->nNode.GetNode().GetCntntNode()->GetFrm() ) ))
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 GetDoc()->GetRootFrm()->CalcFrmRects( *this, GetShell()->IsTableMode() );
+/*N*/ }
+
+
+/*N*/ void SwShellCrsr::Show()
+/*N*/ {
+/*N*/ SwShellCrsr * pTmp = this;
+/*N*/ do {
+/*N*/ pTmp->SwSelPaintRects::Show();
+/*N*/ } while( this != ( pTmp = (SwShellCrsr*)*(SwCursor*)(pTmp->GetNext() )));
+/*N*/
+/*N*/ SHOWBOOKMARKS1( 1 )
+/*N*/ SHOWREDLINES1( 1 )
+/*N*/ }
+
+// TRUE: an die Position kann der Cursor gesetzt werden
+
+/* */
+
+/*N*/ SwShellTableCrsr::~SwShellTableCrsr() {}
+
+/*N*/ void SwShellTableCrsr::SetMark() { SwShellCrsr::SetMark(); }
+/*N*/ SwShellTableCrsr::operator SwShellCrsr* () { return this; }
+/*N*/ SwShellTableCrsr::operator SwTableCursor* () { return this; }
+/*N*/ SwShellTableCrsr::operator SwShellTableCrsr* () { return this; }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/makefile.mk b/binfilter/bf_sw/source/core/doc/makefile.mk
new file mode 100644
index 000000000000..98375bcc7368
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/makefile.mk
@@ -0,0 +1,91 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_doc
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_SwStyleNameMapper.obj \
+ $(SLO)$/sw_doc.obj \
+ $(SLO)$/sw_docbm.obj \
+ $(SLO)$/sw_docchart.obj \
+ $(SLO)$/sw_doccorr.obj \
+ $(SLO)$/sw_docdde.obj \
+ $(SLO)$/sw_docdesc.obj \
+ $(SLO)$/sw_docdraw.obj \
+ $(SLO)$/sw_docedt.obj \
+ $(SLO)$/sw_docfld.obj \
+ $(SLO)$/sw_docfly.obj \
+ $(SLO)$/sw_docfmt.obj \
+ $(SLO)$/sw_docftn.obj \
+ $(SLO)$/sw_doclay.obj \
+ $(SLO)$/sw_docnew.obj \
+ $(SLO)$/sw_docnum.obj \
+ $(SLO)$/sw_docredln.obj \
+ $(SLO)$/sw_docruby.obj \
+ $(SLO)$/sw_docsort.obj \
+ $(SLO)$/sw_docstat.obj \
+ $(SLO)$/sw_doctxm.obj \
+ $(SLO)$/sw_extinput.obj \
+ $(SLO)$/sw_fmtcol.obj \
+ $(SLO)$/sw_ftnidx.obj \
+ $(SLO)$/sw_gctable.obj \
+ $(SLO)$/sw_lineinfo.obj \
+ $(SLO)$/sw_notxtfrm.obj \
+ $(SLO)$/sw_number.obj \
+ $(SLO)$/sw_poolfmt.obj \
+ $(SLO)$/sw_sortopt.obj \
+ $(SLO)$/sw_swserv.obj \
+ $(SLO)$/sw_swtable.obj \
+ $(SLO)$/sw_tblafmt.obj \
+ $(SLO)$/sw_tblrwcl.obj \
+ $(SLO)$/sw_visiturl.obj \
+ $(SLO)$/sw_htmltbl.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/doc/sw_SwStyleNameMapper.cxx b/binfilter/bf_sw/source/core/doc/sw_SwStyleNameMapper.cxx
new file mode 100644
index 000000000000..80b4f4c78903
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_SwStyleNameMapper.cxx
@@ -0,0 +1,1137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <SwStyleNameMapper.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#include <bf_svtools/svstdarr.hxx>
+#include <tools/resmgr.hxx>
+#include <poolfmt.hxx>
+#include <rcid.hrc>
+#include <tools/debug.hxx>
+namespace binfilter {
+extern ResMgr* pSwResMgr;
+// Initialise UI names to 0
+SvStringsDtor *SwStyleNameMapper::pTextUINameArray = 0,
+ *SwStyleNameMapper::pListsUINameArray = 0,
+ *SwStyleNameMapper::pExtraUINameArray = 0,
+ *SwStyleNameMapper::pRegisterUINameArray = 0,
+ *SwStyleNameMapper::pDocUINameArray = 0,
+ *SwStyleNameMapper::pHTMLUINameArray = 0,
+ *SwStyleNameMapper::pFrmFmtUINameArray = 0,
+ *SwStyleNameMapper::pChrFmtUINameArray = 0,
+ *SwStyleNameMapper::pHTMLChrFmtUINameArray = 0,
+ *SwStyleNameMapper::pPageDescUINameArray = 0,
+ *SwStyleNameMapper::pNumRuleUINameArray = 0,
+
+// Initialise programmatic names to 0
+ *SwStyleNameMapper::pTextProgNameArray = 0,
+ *SwStyleNameMapper::pListsProgNameArray = 0,
+ *SwStyleNameMapper::pExtraProgNameArray = 0,
+ *SwStyleNameMapper::pRegisterProgNameArray = 0,
+ *SwStyleNameMapper::pDocProgNameArray = 0,
+ *SwStyleNameMapper::pHTMLProgNameArray = 0,
+ *SwStyleNameMapper::pFrmFmtProgNameArray = 0,
+ *SwStyleNameMapper::pChrFmtProgNameArray = 0,
+ *SwStyleNameMapper::pHTMLChrFmtProgNameArray = 0,
+ *SwStyleNameMapper::pPageDescProgNameArray = 0,
+ *SwStyleNameMapper::pNumRuleProgNameArray = 0;
+
+NameToIdHash *SwStyleNameMapper::pParaUIMap = 0,
+ *SwStyleNameMapper::pCharUIMap = 0,
+ *SwStyleNameMapper::pPageUIMap = 0,
+ *SwStyleNameMapper::pFrameUIMap = 0,
+ *SwStyleNameMapper::pNumRuleUIMap = 0,
+
+ *SwStyleNameMapper::pParaProgMap = 0,
+ *SwStyleNameMapper::pCharProgMap = 0,
+ *SwStyleNameMapper::pPageProgMap = 0,
+ *SwStyleNameMapper::pFrameProgMap = 0,
+ *SwStyleNameMapper::pNumRuleProgMap = 0;
+
+// SwTableEntry so we can pass the length to the String CTOR
+struct SwTableEntry
+{
+ sal_uInt8 nLength;
+ const sal_Char *pChar;
+};
+
+#define ENTRY( s ) { sizeof (s)-1, s }
+
+// Hard coded Programmatic Name tables
+const struct SwTableEntry TextProgNameTable [] =
+{
+ ENTRY( "Standard" ), // RES_POOLCOLL_STANDARD
+ ENTRY( "Text body" ),
+ ENTRY( "First line indent" ),
+ ENTRY( "Hanging indent" ),
+ ENTRY( "Text body indent" ),
+ ENTRY( "Salutation" ),
+ ENTRY( "Signature" ),
+ ENTRY( "List Indent" ), // RES_POOLCOLL_CONFRONTATION
+ ENTRY( "Marginalia" ),
+ ENTRY( "Heading" ),
+ ENTRY( "Heading 1" ),
+ ENTRY( "Heading 2" ),
+ ENTRY( "Heading 3" ),
+ ENTRY( "Heading 4" ),
+ ENTRY( "Heading 5" ),
+ ENTRY( "Heading 6" ),
+ ENTRY( "Heading 7" ),
+ ENTRY( "Heading 8" ),
+ ENTRY( "Heading 9" ),
+ ENTRY( "Heading 10" ), // RES_POOLCOLL_TEXT_END
+ { 0, NULL }
+};
+
+const struct SwTableEntry ListsProgNameTable [] =
+{
+ ENTRY( "List" ), // STR_POCO_PRGM_NUMBUL_BASE
+ ENTRY( "Numbering 1 Start" ), // STR_POCO_PRGM_NUM_LEVEL1S
+ ENTRY( "Numbering 1" ),
+ ENTRY( "Numbering 1 End" ),
+ ENTRY( "Numbering 1 Cont." ),
+ ENTRY( "Numbering 2 Start" ),
+ ENTRY( "Numbering 2" ),
+ ENTRY( "Numbering 2 End" ),
+ ENTRY( "Numbering 2 Cont." ),
+ ENTRY( "Numbering 3 Start" ),
+ ENTRY( "Numbering 3" ),
+ ENTRY( "Numbering 3 End" ),
+ ENTRY( "Numbering 3 Cont." ),
+ ENTRY( "Numbering 4 Start" ),
+ ENTRY( "Numbering 4" ),
+ ENTRY( "Numbering 4 End" ),
+ ENTRY( "Numbering 4 Cont." ),
+ ENTRY( "Numbering 5 Start" ),
+ ENTRY( "Numbering 5" ),
+ ENTRY( "Numbering 5 End" ),
+ ENTRY( "Numbering 5 Cont." ),
+ ENTRY( "List 1 Start" ),
+ ENTRY( "List 1" ),
+ ENTRY( "List 1 End" ),
+ ENTRY( "List 1 Cont." ),
+ ENTRY( "List 2 Start" ),
+ ENTRY( "List 2" ),
+ ENTRY( "List 2 End" ),
+ ENTRY( "List 2 Cont." ),
+ ENTRY( "List 3 Start" ),
+ ENTRY( "List 3" ),
+ ENTRY( "List 3 End" ),
+ ENTRY( "List 3 Cont." ),
+ ENTRY( "List 4 Start" ),
+ ENTRY( "List 4" ),
+ ENTRY( "List 4 End" ),
+ ENTRY( "List 4 Cont." ),
+ ENTRY( "List 5 Start" ),
+ ENTRY( "List 5" ),
+ ENTRY( "List 5 End" ),
+ ENTRY( "List 5 Cont." ), // STR_POCO_PRGM_BUL_NONUM5
+ { 0, NULL }
+};
+
+const struct SwTableEntry ExtraProgNameTable [] =
+{
+ ENTRY( "Header" ), // RES_POOLCOLL_EXTRA_BEGIN
+ ENTRY( "Header left" ),
+ ENTRY( "Header right" ),
+ ENTRY( "Footer" ),
+ ENTRY( "Footer left" ),
+ ENTRY( "Footer right" ),
+ ENTRY( "Table Contents" ),
+ ENTRY( "Table Heading" ),
+ ENTRY( "Caption" ),
+ ENTRY( "Illustration" ),
+ ENTRY( "Table" ),
+ ENTRY( "Text" ),
+ ENTRY( "Frame contents" ),
+ ENTRY( "Footnote" ),
+ ENTRY( "Addressee" ),
+ ENTRY( "Sender" ),
+ ENTRY( "Endnote" ),
+ ENTRY( "Drawing" ), // RES_POOLCOLL_LABEL_DRAWING
+ { 0, NULL }
+};
+
+const struct SwTableEntry RegisterProgNameTable [] =
+{
+ ENTRY( "Index" ), // STR_POCO_PRGM_REGISTER_BASE
+ ENTRY( "Index Heading" ), // STR_POCO_PRGM_TOX_IDXH
+ ENTRY( "Index 1" ),
+ ENTRY( "Index 2" ),
+ ENTRY( "Index 3" ),
+ ENTRY( "Index Separator" ),
+ ENTRY( "Contents Heading" ),
+ ENTRY( "Contents 1" ),
+ ENTRY( "Contents 2" ),
+ ENTRY( "Contents 3" ),
+ ENTRY( "Contents 4" ),
+ ENTRY( "Contents 5" ),
+ ENTRY( "User Index Heading" ),
+ ENTRY( "User Index 1" ),
+ ENTRY( "User Index 2" ),
+ ENTRY( "User Index 3" ),
+ ENTRY( "User Index 4" ),
+ ENTRY( "User Index 5" ),
+ ENTRY( "Contents 6" ),
+ ENTRY( "Contents 7" ),
+ ENTRY( "Contents 8" ),
+ ENTRY( "Contents 9" ),
+ ENTRY( "Contents 10" ),
+ ENTRY( "Illustration Index Heading" ),
+ ENTRY( "Illustration Index 1" ),
+ ENTRY( "Object index heading" ),
+ ENTRY( "Object index 1" ),
+ ENTRY( "Table index heading" ),
+ ENTRY( "Table index 1" ),
+ ENTRY( "Bibliography Heading" ),
+ ENTRY( "Bibliography 1" ),
+ ENTRY( "User Index 6" ),
+ ENTRY( "User Index 7" ),
+ ENTRY( "User Index 8" ),
+ ENTRY( "User Index 9" ),
+ ENTRY( "User Index 10" ), // STR_POCO_PRGM_TOX_USER10
+ { 0, NULL }
+};
+
+const struct SwTableEntry DocProgNameTable [] =
+{
+ ENTRY( "Title" ), // STR_POCO_PRGM_DOC_TITEL
+ ENTRY( "Subtitle" ),
+ { 0, NULL }
+};
+
+const struct SwTableEntry HTMLProgNameTable [] =
+{
+ ENTRY( "Quotations" ),
+ ENTRY( "Preformatted Text" ),
+ ENTRY( "Horizontal Line" ),
+ ENTRY( "List Contents" ),
+ ENTRY( "List Heading" ), // STR_POCO_PRGM_HTML_DT
+ { 0, NULL }
+};
+
+const struct SwTableEntry FrmFmtProgNameTable [] =
+{
+ ENTRY( "Frame" ), // RES_POOLFRM_FRAME
+ ENTRY( "Graphics" ),
+ ENTRY( "OLE" ),
+ ENTRY( "Formula" ),
+ ENTRY( "Marginalia" ),
+ ENTRY( "Watermark" ),
+ ENTRY( "Labels" ), // RES_POOLFRM_LABEL
+ { 0, NULL }
+};
+
+const struct SwTableEntry ChrFmtProgNameTable [] =
+{
+ ENTRY( "Footnote Symbol" ), // RES_POOLCHR_FOOTNOTE
+ ENTRY( "Page Number" ),
+ ENTRY( "Caption characters" ),
+ ENTRY( "Drop Caps" ),
+ ENTRY( "Numbering Symbols" ),
+ ENTRY( "Bullet Symbols" ),
+ ENTRY( "Internet link" ),
+ ENTRY( "Visited Internet Link" ),
+ ENTRY( "Placeholder" ),
+ ENTRY( "Index Link" ),
+ ENTRY( "Endnote Symbol" ),
+ ENTRY( "Line numbering" ),
+ ENTRY( "Main index entry" ),
+ ENTRY( "Footnote anchor" ),
+ ENTRY( "Endnote anchor" ),
+ ENTRY( "Rubies" ), // RES_POOLCHR_RUBYTEXT
+ ENTRY( "Vertical Numbering Symbols" ), // RES_POOLCHR_VERT_NUMBER
+ { 0, NULL }
+};
+
+const struct SwTableEntry HTMLChrFmtProgNameTable [] =
+{
+ ENTRY( "Emphasis" ), // RES_POOLCHR_HTML_EMPHASIS
+ ENTRY( "Citation" ),
+ ENTRY( "Strong Emphasis" ),
+ ENTRY( "Source Text" ),
+ ENTRY( "Example" ),
+ ENTRY( "User Entry" ),
+ ENTRY( "Variable" ),
+ ENTRY( "Definition" ),
+ ENTRY( "Teletype" ), // RES_POOLCHR_HTML_TELETYPE
+ { 0, NULL }
+};
+
+const struct SwTableEntry PageDescProgNameTable [] =
+{
+ ENTRY( "Standard" ), // STR_POOLPAGE_PRGM_STANDARD
+ ENTRY( "First Page" ),
+ ENTRY( "Left Page" ),
+ ENTRY( "Right Page" ),
+ ENTRY( "Envelope" ),
+ ENTRY( "Index" ),
+ ENTRY( "HTML" ),
+ ENTRY( "Footnote" ),
+ ENTRY( "Endnote" ), // STR_POOLPAGE_PRGM_ENDNOTE
+ { 0, NULL }
+};
+
+const struct SwTableEntry NumRuleProgNameTable [] =
+{
+ ENTRY( "Numbering 1" ), // STR_POOLNUMRULE_PRGM_NUM1
+ ENTRY( "Numbering 2" ),
+ ENTRY( "Numbering 3" ),
+ ENTRY( "Numbering 4" ),
+ ENTRY( "Numbering 5" ),
+ ENTRY( "List 1" ),
+ ENTRY( "List 2" ),
+ ENTRY( "List 3" ),
+ ENTRY( "List 4" ),
+ ENTRY( "List 5" ), // STR_POOLNUMRULE_PRGM_BUL5
+ { 0, NULL }
+};
+#undef ENTRY
+
+/*N*/ sal_Bool SwStyleNameMapper::SuffixIsUser ( const String & rString )
+/*N*/ {
+/*N*/ const sal_Unicode *pChar = rString.GetBuffer();
+/*N*/ sal_Int32 nLen = rString.Len();
+/*N*/ return nLen <= 8 ? sal_False :
+/*N*/ pChar[nLen-7] == ' ' &&
+/*N*/ pChar[nLen-6] == '(' &&
+/*N*/ pChar[nLen-5] == 'u' &&
+/*N*/ pChar[nLen-4] == 's' &&
+/*N*/ pChar[nLen-3] == 'e' &&
+/*N*/ pChar[nLen-2] == 'r' &&
+/*N*/ pChar[nLen-1] == ')';
+/*N*/ }
+/*N*/ void SwStyleNameMapper::CheckSuffixAndDelete ( String & rString )
+/*N*/ {
+/*N*/ const sal_Unicode *pChar = rString.GetBuffer();
+/*N*/ sal_Int32 nLen = rString.Len();
+/*N*/ if (nLen > 8 &&
+/*N*/ pChar[nLen-7] == ' ' &&
+/*N*/ pChar[nLen-6] == '(' &&
+/*N*/ pChar[nLen-5] == 'u' &&
+/*N*/ pChar[nLen-4] == 's' &&
+/*N*/ pChar[nLen-3] == 'e' &&
+/*N*/ pChar[nLen-2] == 'r' &&
+/*N*/ pChar[nLen-1] == ')')
+/*N*/ {
+/*?*/ rString.Erase ( nLen - 7, 7 );
+/*N*/ }
+/*N*/ }
+/*N*/ const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlags, sal_Bool bProgName )
+/*N*/ {
+/*N*/ NameToIdHash *pHash;
+/*N*/ const SvStringsDtor *pStrings;
+/*N*/
+/*N*/ switch ( eFlags )
+/*N*/ {
+/*N*/ case GET_POOLID_TXTCOLL:
+/*N*/ {
+/*N*/ pHash = bProgName ? pParaProgMap : pParaUIMap;
+/*N*/ if ( !pHash )
+/*N*/ {
+/*N*/ pHash = new NameToIdHash ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN +
+/*N*/ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+/*N*/ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+/*N*/ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+/*N*/ RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+/*N*/ RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN );
+/*N*/ pStrings = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
+ sal_uInt16 nIndex=0;
+ sal_uInt16 nId;
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_TEXT_BEGIN ; nId < RES_POOLCOLL_TEXT_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ pStrings = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_LISTS_BEGIN ; nId < RES_POOLCOLL_LISTS_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ pStrings = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_EXTRA_BEGIN ; nId < RES_POOLCOLL_EXTRA_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ pStrings = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_REGISTER_BEGIN ; nId < RES_POOLCOLL_REGISTER_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ pStrings = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_DOC_BEGIN ; nId < RES_POOLCOLL_DOC_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ pStrings = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_HTML_BEGIN ; nId < RES_POOLCOLL_HTML_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/
+/*N*/ if ( bProgName )
+/*N*/ pParaProgMap = pHash;
+/*N*/ else
+/*N*/ pParaUIMap = pHash;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case GET_POOLID_CHRFMT:
+/*N*/ {
+/*N*/ pHash = bProgName ? pCharProgMap : pCharUIMap;
+/*N*/ if ( !pHash )
+/*N*/ {
+/*N*/ pHash = new NameToIdHash ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN +
+/*N*/ RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN );
+/*N*/ pStrings = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
+ sal_uInt16 nIndex = 0;
+ sal_uInt16 nId;
+/*N*/ for ( nIndex = 0, nId = RES_POOLCHR_NORMAL_BEGIN ; nId < RES_POOLCHR_NORMAL_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ pStrings = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
+/*N*/ for ( nIndex = 0, nId = RES_POOLCHR_HTML_BEGIN ; nId < RES_POOLCHR_HTML_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ if (bProgName )
+/*N*/ pCharProgMap = pHash;
+/*N*/ else
+/*N*/ pCharUIMap = pHash;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case GET_POOLID_FRMFMT:
+/*N*/ {
+/*N*/ pHash = bProgName ? pFrameProgMap : pFrameUIMap;
+/*N*/ if ( !pHash )
+/*N*/ {
+/*N*/ pHash = new NameToIdHash ( RES_POOLFRM_END - RES_POOLFRM_BEGIN );
+/*N*/ pStrings = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
+/*N*/ for ( sal_uInt16 nIndex=0,nId = RES_POOLFRM_BEGIN ; nId < RES_POOLFRM_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ if ( bProgName )
+/*N*/ pFrameProgMap = pHash;
+/*N*/ else
+/*N*/ pFrameUIMap = pHash;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case GET_POOLID_PAGEDESC:
+/*N*/ {
+/*N*/ pHash = bProgName ? pPageProgMap : pPageUIMap;
+/*N*/ if ( !pHash )
+/*N*/ {
+/*N*/ pHash = new NameToIdHash ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN );
+/*N*/ pStrings = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
+/*N*/ for ( sal_uInt16 nIndex=0,nId = RES_POOLPAGE_BEGIN ; nId < RES_POOLPAGE_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ if ( bProgName )
+/*N*/ pPageProgMap = pHash;
+/*N*/ else
+/*N*/ pPageUIMap = pHash;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case GET_POOLID_NUMRULE:
+/*N*/ {
+/*N*/ pHash = bProgName ? pNumRuleProgMap : pNumRuleUIMap;
+/*N*/ if ( !pHash )
+/*N*/ {
+/*N*/ pHash = new NameToIdHash ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN );
+/*N*/ pStrings = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
+/*N*/ for ( sal_uInt16 nIndex=0,nId = RES_POOLNUMRULE_BEGIN ; nId < RES_POOLNUMRULE_END ; nId++,nIndex++ )
+/*N*/ (*pHash)[(*pStrings)[nIndex]] = nId;
+/*N*/ if ( bProgName )
+/*N*/ pNumRuleProgMap = pHash;
+/*N*/ else
+/*N*/ pNumRuleUIMap = pHash;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ #ifdef _NEED_TO_DEBUG_MAPPING
+/*N*/ static sal_Bool bTested = sal_False;
+/*N*/ if ( !bTested )
+/*N*/ {
+/*N*/ bTested = sal_True;
+/*N*/ {
+/*N*/ for ( sal_uInt16 nIndex = 0, nId = RES_POOLCOLL_TEXT_BEGIN ; nId < RES_POOLCOLL_TEXT_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_LISTS_BEGIN ; nId < RES_POOLCOLL_LISTS_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_EXTRA_BEGIN ; nId < RES_POOLCOLL_EXTRA_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_REGISTER_BEGIN ; nId < RES_POOLCOLL_REGISTER_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_DOC_BEGIN ; nId < RES_POOLCOLL_DOC_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ for ( nIndex = 0, nId = RES_POOLCOLL_HTML_BEGIN ; nId < RES_POOLCOLL_HTML_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ }
+/*N*/ {
+/*N*/ for ( sal_uInt16 nIndex = 0, nId = RES_POOLCHR_NORMAL_BEGIN ; nId < RES_POOLCHR_NORMAL_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ for ( nIndex = 0, nId = RES_POOLCHR_HTML_BEGIN ; nId < RES_POOLCHR_HTML_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ }
+/*N*/ {
+/*N*/ for ( sal_uInt16 nIndex=0,nId = RES_POOLFRM_BEGIN ; nId < RES_POOLFRM_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ }
+/*N*/ {
+/*N*/ for ( sal_uInt16 nIndex=0,nId = RES_POOLPAGE_BEGIN ; nId < RES_POOLPAGE_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ }
+/*N*/ {
+/*N*/ for ( sal_uInt16 nIndex=0,nId = RES_POOLNUMRULE_BEGIN ; nId < RES_POOLNUMRULE_END ; nId++,nIndex++ )
+/*N*/ {
+/*N*/ String aString, bString;
+/*N*/ FillUIName ( nId, aString );
+/*N*/ bString = GetProgName ( GET_POOLID_TXTCOLL, aString );
+/*N*/ sal_uInt16 nNewId = GetPoolIdFromProgName ( bString, GET_POOLID_TXTCOLL );
+/*N*/ FillProgName ( nNewId, aString );
+/*N*/ bString = GetUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ nNewId = GetPoolIdFromUIName ( aString, GET_POOLID_TXTCOLL );
+/*N*/ if ( nNewId != nId )
+/*N*/ *((sal_Int32*)0) = 42;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ return *pHash;
+/*N*/ }
+// This gets the UI Name from the programmatic name
+/*N*/ const String& SwStyleNameMapper::GetUIName ( const String& rName, SwGetPoolIdFromName eFlags )
+/*N*/ {
+/*N*/ sal_uInt16 nId = GetPoolIdFromProgName ( rName, eFlags );
+/*N*/ return nId != USHRT_MAX ? GetUIName( nId, rName ) : rName;
+/*N*/ }
+
+
+// Get the programmatic Name from the UI name
+/*N*/ const String& SwStyleNameMapper::GetProgName( const String& rName, SwGetPoolIdFromName eFlags )
+/*N*/ {
+/*N*/ sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
+/*N*/ return nId != USHRT_MAX ? GetProgName( nId, rName ) : rName;
+/*N*/ }
+
+// Get the programmatic name from the UI name in rName and put it into rFillName
+/*N*/ void SwStyleNameMapper::FillProgName ( const String& rName, String& rFillName, SwGetPoolIdFromName eFlags, sal_Bool bDisambiguate )
+/*N*/ {
+/*N*/ sal_uInt16 nId = GetPoolIdFromUIName ( rName, eFlags );
+/*N*/ if ( bDisambiguate && nId == USHRT_MAX )
+/*N*/ {
+/*N*/ // rName isn't in our UI name table...check if it's in the programmatic one
+/*N*/ nId = GetPoolIdFromProgName ( rName, eFlags );
+/*N*/
+/*N*/ rFillName = rName;
+/*N*/ if (nId == USHRT_MAX )
+/*N*/ {
+/*N*/ // It isn't ...make sure the suffix isn't already " (user)"...if it is,
+/*N*/ // we need to add another one
+/*N*/ if ( SuffixIsUser ( rFillName ) )
+/*?*/ rFillName.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // It's in the programmatic name table...append suffix
+/*N*/ rFillName.AppendAscii ( RTL_CONSTASCII_STRINGPARAM ( " (user)" ) );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // If we aren't trying to disambiguate, then just do a normal fill
+/*?*/ fillNameFromId ( nId, rFillName, sal_True);
+/*N*/ }
+/*N*/ }
+// Get the UI name from the programmatic name in rName and put it into rFillName
+/*N*/ void SwStyleNameMapper::FillUIName ( const String& rName, String& rFillName, SwGetPoolIdFromName eFlags, sal_Bool bDisambiguate )
+/*N*/ {
+/*N*/ sal_uInt16 nId = GetPoolIdFromProgName ( rName, eFlags );
+/*N*/ if ( bDisambiguate && nId == USHRT_MAX )
+/*N*/ {
+/*N*/ rFillName = rName;
+/*N*/ // rName isn't in our Prog name table...check if it has a " (user)" suffix, if so remove it
+/*N*/ CheckSuffixAndDelete ( rFillName );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // If we aren't trying to disambiguate, then just do a normal fill
+/*N*/ fillNameFromId ( nId, rFillName, sal_False);
+/*N*/ }
+/*N*/ }
+
+/*N*/ const String& SwStyleNameMapper::getNameFromId( sal_uInt16 nId, const String& rFillName, sal_Bool bProgName )
+/*N*/ {
+/*N*/ sal_uInt16 nStt = 0;
+/*N*/ const SvStringsDtor* pStrArr = 0;
+/*N*/
+/*N*/ switch( (USER_FMT | COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID) & nId )
+/*N*/ {
+/*N*/ case COLL_TEXT_BITS:
+/*?*/ if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
+/*?*/ nStt = RES_POOLCOLL_TEXT_BEGIN;
+/*?*/ }
+/*N*/ break;
+/*N*/ case COLL_LISTS_BITS:
+/*?*/ if( RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
+/*?*/ nStt = RES_POOLCOLL_LISTS_BEGIN;
+/*?*/ }
+/*N*/ break;
+/*N*/ case COLL_EXTRA_BITS:
+/*N*/ if( RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
+/*N*/ nStt = RES_POOLCOLL_EXTRA_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case COLL_REGISTER_BITS:
+/*?*/ if( RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
+/*?*/ nStt = RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ }
+/*N*/ break;
+/*N*/ case COLL_DOC_BITS:
+/*?*/ if( RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
+/*?*/ nStt = RES_POOLCOLL_DOC_BEGIN;
+/*?*/ }
+/*?*/ break;
+/*N*/ case COLL_HTML_BITS:
+/*?*/ if( RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
+/*?*/ nStt = RES_POOLCOLL_HTML_BEGIN;
+/*?*/ }
+/*?*/ break;
+/*N*/ case POOLGRP_CHARFMT:
+/*?*/ if( RES_POOLCHR_NORMAL_BEGIN <= nId && nId < RES_POOLCHR_NORMAL_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
+/*?*/ nStt = RES_POOLCHR_NORMAL_BEGIN;
+/*?*/ }
+/*?*/ else if( RES_POOLCHR_HTML_BEGIN <= nId && nId < RES_POOLCHR_HTML_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
+/*?*/ nStt = RES_POOLCHR_HTML_BEGIN;
+/*?*/ }
+/*?*/ break;
+/*N*/ case POOLGRP_FRAMEFMT:
+/*N*/ if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
+/*N*/ nStt = RES_POOLFRM_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case POOLGRP_PAGEDESC:
+/*?*/ if( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
+/*?*/ nStt = RES_POOLPAGE_BEGIN;
+/*?*/ }
+/*?*/ break;
+/*N*/ case POOLGRP_NUMRULE:
+/*?*/ if( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END )
+/*?*/ {
+/*?*/ pStrArr = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
+/*?*/ nStt = RES_POOLNUMRULE_BEGIN;
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*N*/ return pStrArr ? *(pStrArr->operator[] ( nId - nStt ) ) : rFillName;
+/*N*/ }
+/*N*/ void SwStyleNameMapper::fillNameFromId( sal_uInt16 nId, String& rFillName, sal_Bool bProgName )
+/*N*/ {
+/*N*/ sal_uInt16 nStt = 0;
+/*N*/ const SvStringsDtor* pStrArr = 0;
+/*N*/
+/*N*/ switch( (USER_FMT | COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID) & nId )
+/*N*/ {
+/*N*/ case COLL_TEXT_BITS:
+/*N*/ if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetTextProgNameArray() : &GetTextUINameArray();
+/*N*/ nStt = RES_POOLCOLL_TEXT_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case COLL_LISTS_BITS:
+/*N*/ if( RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetListsProgNameArray() : &GetListsUINameArray();
+/*N*/ nStt = RES_POOLCOLL_LISTS_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case COLL_EXTRA_BITS:
+/*N*/ if( RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetExtraProgNameArray() : &GetExtraUINameArray();
+/*N*/ nStt = RES_POOLCOLL_EXTRA_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case COLL_REGISTER_BITS:
+/*N*/ if( RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetRegisterProgNameArray() : &GetRegisterUINameArray();
+/*N*/ nStt = RES_POOLCOLL_REGISTER_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case COLL_DOC_BITS:
+/*N*/ if( RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetDocProgNameArray() : &GetDocUINameArray();
+/*N*/ nStt = RES_POOLCOLL_DOC_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case COLL_HTML_BITS:
+/*N*/ if( RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetHTMLProgNameArray() : &GetHTMLUINameArray();
+/*N*/ nStt = RES_POOLCOLL_HTML_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case POOLGRP_CHARFMT:
+/*N*/ if( RES_POOLCHR_NORMAL_BEGIN <= nId && nId < RES_POOLCHR_NORMAL_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetChrFmtProgNameArray() : &GetChrFmtUINameArray();
+/*N*/ nStt = RES_POOLCHR_NORMAL_BEGIN;
+/*N*/ }
+/*N*/ else if( RES_POOLCHR_HTML_BEGIN <= nId && nId < RES_POOLCHR_HTML_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetHTMLChrFmtProgNameArray() : &GetHTMLChrFmtUINameArray();
+/*N*/ nStt = RES_POOLCHR_HTML_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case POOLGRP_FRAMEFMT:
+/*N*/ if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetFrmFmtProgNameArray() : &GetFrmFmtUINameArray();
+/*N*/ nStt = RES_POOLFRM_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case POOLGRP_PAGEDESC:
+/*N*/ if( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetPageDescProgNameArray() : &GetPageDescUINameArray();
+/*N*/ nStt = RES_POOLPAGE_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ case POOLGRP_NUMRULE:
+/*N*/ if( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END )
+/*N*/ {
+/*N*/ pStrArr = bProgName ? &GetNumRuleProgNameArray() : &GetNumRuleUINameArray();
+/*N*/ nStt = RES_POOLNUMRULE_BEGIN;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ if (pStrArr)
+/*N*/ rFillName = *(pStrArr->operator[] ( nId - nStt ) );
+/*N*/ }
+// Get the UI Name from the pool ID
+/*N*/ void SwStyleNameMapper::FillUIName ( sal_uInt16 nId, String& rFillName )
+/*N*/ {
+/*N*/ fillNameFromId ( nId, rFillName, sal_False );
+/*N*/ }
+// Get the UI Name from the pool ID
+/*N*/ const String& SwStyleNameMapper::GetUIName ( sal_uInt16 nId, const String& rName )
+/*N*/ {
+/*N*/ return getNameFromId ( nId, rName, sal_False );
+/*N*/ }
+
+// Get the programmatic Name from the pool ID
+/*N*/ void SwStyleNameMapper::FillProgName ( sal_uInt16 nId, String& rFillName )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+// Get the programmatic Name from the pool ID
+/*N*/ const String& SwStyleNameMapper::GetProgName ( sal_uInt16 nId, const String& rName )
+/*N*/ {
+/*N*/ return getNameFromId ( nId, rName, sal_True );
+/*N*/ }
+// This gets the PoolId from the UI Name
+/*N*/ sal_uInt16 SwStyleNameMapper::GetPoolIdFromUIName( const String& rName, SwGetPoolIdFromName eFlags )
+/*N*/ {
+/*N*/ const NameToIdHash & rHashMap = getHashTable ( eFlags, sal_False );
+/*N*/ NameToIdHash::const_iterator aIter = rHashMap.find ( &rName );
+/*N*/ return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
+/*N*/ }
+// Get the Pool ID from the programmatic name
+/*N*/ sal_uInt16 SwStyleNameMapper::GetPoolIdFromProgName( const String& rName, SwGetPoolIdFromName eFlags )
+/*N*/ {
+/*N*/ const NameToIdHash & rHashMap = getHashTable ( eFlags, sal_True );
+/*N*/ NameToIdHash::const_iterator aIter = rHashMap.find ( &rName );
+/*N*/ return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
+/*N*/ }
+
+/*N*/ SvStringsDtor* SwStyleNameMapper::NewUINameArray( SvStringsDtor*& pNameArray, sal_uInt16 nStt, sal_uInt16 nEnd )
+/*N*/ {
+/*N*/ if( !pNameArray )
+/*N*/ {
+/*N*/ pNameArray = new SvStringsDtor( static_cast < sal_Int8 > (nEnd - nStt), 1 );
+/*N*/ while( nStt < nEnd )
+/*N*/ {
+/*N*/ const ResId rRId( nStt, *pSwResMgr );
+/*N*/ String* pStr = new String( rRId );
+/*N*/ pNameArray->Insert( pStr, pNameArray->Count() );
+/*N*/ ++nStt;
+/*N*/ }
+/*N*/ }
+/*N*/ return pNameArray;
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetTextUINameArray()
+/*N*/ {
+/*N*/ return pTextUINameArray ? *pTextUINameArray :
+/*N*/ *NewUINameArray( pTextUINameArray, RC_POOLCOLL_TEXT_BEGIN,
+/*N*/ ( RC_POOLCOLL_TEXT_BEGIN +
+/*N*/ (RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetListsUINameArray()
+/*N*/ {
+/*N*/ return pListsUINameArray ? *pListsUINameArray :
+/*N*/ *NewUINameArray( pListsUINameArray, RC_POOLCOLL_LISTS_BEGIN,
+/*N*/ ( RC_POOLCOLL_LISTS_BEGIN +
+/*N*/ (RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetExtraUINameArray()
+/*N*/ {
+/*N*/ return pExtraUINameArray ? *pExtraUINameArray :
+/*N*/ *NewUINameArray( pExtraUINameArray, RC_POOLCOLL_EXTRA_BEGIN,
+/*N*/ ( RC_POOLCOLL_EXTRA_BEGIN +
+/*N*/ (RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetRegisterUINameArray()
+/*N*/ {
+/*N*/ return pRegisterUINameArray ? *pRegisterUINameArray :
+/*N*/ *NewUINameArray( pRegisterUINameArray, RC_POOLCOLL_REGISTER_BEGIN,
+/*N*/ ( RC_POOLCOLL_REGISTER_BEGIN +
+/*N*/ (RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetDocUINameArray()
+/*N*/ {
+/*N*/ return pDocUINameArray ? *pDocUINameArray :
+/*N*/ *NewUINameArray( pDocUINameArray, RC_POOLCOLL_DOC_BEGIN,
+/*N*/ ( RC_POOLCOLL_DOC_BEGIN +
+/*N*/ (RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetHTMLUINameArray()
+/*N*/ {
+/*N*/ return pHTMLUINameArray ? *pHTMLUINameArray :
+/*N*/ *NewUINameArray( pHTMLUINameArray, RC_POOLCOLL_HTML_BEGIN,
+/*N*/ ( RC_POOLCOLL_HTML_BEGIN +
+/*N*/ (RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetFrmFmtUINameArray()
+/*N*/ {
+/*N*/ return pFrmFmtUINameArray ? *pFrmFmtUINameArray :
+/*N*/ *NewUINameArray( pFrmFmtUINameArray, RC_POOLFRMFMT_BEGIN,
+/*N*/ ( RC_POOLFRMFMT_BEGIN +
+/*N*/ (RES_POOLFRM_END - RES_POOLFRM_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetChrFmtUINameArray()
+/*N*/ {
+/*N*/ return pChrFmtUINameArray ? *pChrFmtUINameArray :
+/*N*/ *NewUINameArray( pChrFmtUINameArray, RC_POOLCHRFMT_BEGIN,
+/*N*/ ( RC_POOLCHRFMT_BEGIN +
+/*N*/ (RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetHTMLChrFmtUINameArray()
+/*N*/ {
+/*N*/ return pHTMLChrFmtUINameArray ? *pHTMLChrFmtUINameArray :
+/*N*/ *NewUINameArray( pHTMLChrFmtUINameArray, RC_POOLCHRFMT_HTML_BEGIN,
+/*N*/ ( RC_POOLCHRFMT_HTML_BEGIN +
+/*N*/ (RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetPageDescUINameArray()
+/*N*/ {
+/*N*/ return pPageDescUINameArray ? *pPageDescUINameArray :
+/*N*/ *NewUINameArray( pPageDescUINameArray, RC_POOLPAGEDESC_BEGIN,
+/*N*/ ( RC_POOLPAGEDESC_BEGIN +
+/*N*/ (RES_POOLPAGE_END - RES_POOLPAGE_BEGIN )) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetNumRuleUINameArray()
+/*N*/ {
+/*N*/ return pNumRuleUINameArray ? *pNumRuleUINameArray :
+/*N*/ *NewUINameArray( pNumRuleUINameArray, RC_POOLNUMRULE_BEGIN,
+/*N*/ ( RC_POOLNUMRULE_BEGIN +
+/*N*/ (RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN )) );
+/*N*/ }
+
+/*N*/ SvStringsDtor* SwStyleNameMapper::NewProgNameArray( SvStringsDtor*& pProgNameArray, const SwTableEntry *pTable, sal_uInt8 nCount )
+/*N*/ {
+/*N*/ if( !pProgNameArray )
+/*N*/ {
+/*N*/ pProgNameArray = new SvStringsDtor( nCount, 1 );
+/*N*/ while (pTable->nLength)
+/*N*/ {
+/*N*/ String* pStr = new String( pTable->pChar, pTable->nLength, RTL_TEXTENCODING_ASCII_US );
+/*N*/ pProgNameArray->Insert( pStr, pProgNameArray->Count() );
+/*N*/ pTable++;
+/*N*/ }
+/*N*/ }
+/*N*/ return pProgNameArray;
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetTextProgNameArray()
+/*N*/ {
+/*N*/ return pTextProgNameArray ? *pTextProgNameArray :
+/*N*/ *NewProgNameArray( pTextProgNameArray, TextProgNameTable,
+/*N*/ sizeof ( TextProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetListsProgNameArray()
+/*N*/ {
+/*N*/ return pListsProgNameArray ? *pListsProgNameArray :
+/*N*/ *NewProgNameArray( pListsProgNameArray, ListsProgNameTable,
+/*N*/ sizeof ( ListsProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetExtraProgNameArray()
+/*N*/ {
+/*N*/ return pExtraProgNameArray ? *pExtraProgNameArray :
+/*N*/ *NewProgNameArray( pExtraProgNameArray, ExtraProgNameTable,
+/*N*/ sizeof ( ExtraProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetRegisterProgNameArray()
+/*N*/ {
+/*N*/ return pRegisterProgNameArray ? *pRegisterProgNameArray :
+/*N*/ *NewProgNameArray( pRegisterProgNameArray, RegisterProgNameTable,
+/*N*/ sizeof ( RegisterProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetDocProgNameArray()
+/*N*/ {
+/*N*/ return pDocProgNameArray ? *pDocProgNameArray :
+/*N*/ *NewProgNameArray( pDocProgNameArray, DocProgNameTable,
+/*N*/ sizeof ( DocProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetHTMLProgNameArray()
+/*N*/ {
+/*N*/ return pHTMLProgNameArray ? *pHTMLProgNameArray :
+/*N*/ *NewProgNameArray( pHTMLProgNameArray, HTMLProgNameTable,
+/*N*/ sizeof ( HTMLProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetFrmFmtProgNameArray()
+/*N*/ {
+/*N*/ return pFrmFmtProgNameArray ? *pFrmFmtProgNameArray :
+/*N*/ *NewProgNameArray( pFrmFmtProgNameArray, FrmFmtProgNameTable,
+/*N*/ sizeof ( FrmFmtProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetChrFmtProgNameArray()
+/*N*/ {
+/*N*/ return pChrFmtProgNameArray ? *pChrFmtProgNameArray :
+/*N*/ *NewProgNameArray( pChrFmtProgNameArray, ChrFmtProgNameTable,
+/*N*/ sizeof ( ChrFmtProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetHTMLChrFmtProgNameArray()
+/*N*/ {
+/*N*/ return pHTMLChrFmtProgNameArray ? *pHTMLChrFmtProgNameArray :
+/*N*/ *NewProgNameArray( pHTMLChrFmtProgNameArray, HTMLChrFmtProgNameTable,
+/*N*/ sizeof ( HTMLChrFmtProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetPageDescProgNameArray()
+/*N*/ {
+/*N*/ return pPageDescProgNameArray ? *pPageDescProgNameArray :
+/*N*/ *NewProgNameArray( pPageDescProgNameArray, PageDescProgNameTable,
+/*N*/ sizeof ( PageDescProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+/*N*/ const SvStringsDtor& SwStyleNameMapper::GetNumRuleProgNameArray()
+/*N*/ {
+/*N*/ return pNumRuleProgNameArray ? *pNumRuleProgNameArray :
+/*N*/ *NewProgNameArray( pNumRuleProgNameArray, NumRuleProgNameTable,
+/*N*/ sizeof ( NumRuleProgNameTable ) / sizeof ( SwTableEntry ) );
+/*N*/ }
+
+
+/*N*/ const String SwStyleNameMapper::GetSpecialExtraProgName( const String& rExtraUIName )
+/*N*/ {
+/*N*/ String aRes = rExtraUIName;
+/*N*/ BOOL bChgName = FALSE;
+/*N*/ const SvStringsDtor& rExtraArr = GetExtraUINameArray();
+/*N*/ static sal_uInt16 nIds[] =
+/*N*/ {
+/*N*/ RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
+/*N*/ RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
+/*N*/ RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
+/*N*/ RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
+/*N*/ 0
+/*N*/ };
+ const sal_uInt16 *pIds;
+/*N*/ for ( pIds = nIds; *pIds; ++pIds)
+/*N*/ {
+/*N*/ if (aRes == *rExtraArr[ *pIds ])
+/*N*/ {
+/*N*/ bChgName = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ if (bChgName)
+/*N*/ aRes = *GetExtraProgNameArray()[*pIds];
+/*N*/ return aRes;
+/*N*/ }
+
+/*N*/ const String SwStyleNameMapper::GetSpecialExtraUIName( const String& rExtraProgName )
+/*N*/ {
+/*?*/ String aRes = rExtraProgName;
+/*?*/ BOOL bChgName = FALSE;
+/*?*/ const SvStringsDtor& rExtraArr = GetExtraProgNameArray();
+/*?*/ static sal_uInt16 nIds[] =
+/*?*/ {
+/*?*/ RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
+/*?*/ RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
+/*?*/ RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
+/*?*/ RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
+/*?*/ 0
+/*?*/ };
+ const sal_uInt16 *pIds;
+/*?*/ for ( pIds = nIds; *pIds; ++pIds)
+/*?*/ {
+/*?*/ if (aRes == *rExtraArr[ *pIds ])
+/*?*/ {
+/*?*/ bChgName = TRUE;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ if (bChgName)
+/*?*/ aRes = *GetExtraUINameArray()[*pIds];
+/*?*/ return aRes;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_doc.cxx b/binfilter/bf_sw/source/core/doc/sw_doc.cxx
new file mode 100644
index 000000000000..8820ac18f023
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_doc.cxx
@@ -0,0 +1,559 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <com/sun/star/i18n/WordType.hdl>
+#include <bf_so3/ipobj.hxx>
+#include <bf_sfx2/docinf.hxx>
+#include <bf_starmath/smdll0.hxx>
+#include <unotools/charclass.hxx>
+
+#include <swmodule.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <linkenum.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx>
+#include <pagedesc.hxx> //DTor
+#include <breakit.hxx>
+#include <ndole.hxx>
+#include <ndgrf.hxx>
+#include <bookmrk.hxx> // fuer die Bookmarks
+#include <doctxm.hxx> // fuer die Verzeichnisse
+#include <poolfmt.hxx> // PoolVorlagen-Id's
+#include <mvsave.hxx> // fuer Server-Funktionalitaet
+#include <wrong.hxx> // fuer OnlineSpell-Invalidierung
+#include <drawfont.hxx>
+#include <docstat.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <fldupde.hxx>
+
+#include <statstr.hrc> // StatLine-String
+namespace binfilter {
+
+// Seiten-Deskriptoren
+/*N*/ SV_IMPL_PTRARR(SwPageDescs,SwPageDescPtr);
+// Autoren
+// IMPL_PTRREGARR_NOTL(Authors,Author) USED?
+// Verzeichnisse
+/*N*/ SV_IMPL_PTRARR( SwTOXTypes, SwTOXTypePtr )
+// FeldTypen
+/*N*/ SV_IMPL_PTRARR( SwFldTypes, SwFldTypePtr)
+
+
+/*
+ * Dokumenteditieren (Doc-SS) zum Fuellen des Dokuments
+ * durch den RTF Parser und fuer die EditShell.
+ */
+/*N*/ void SwDoc::ChgDBData(const SwDBData& rNewData)
+/*N*/ {
+/*N*/ if( rNewData != aDBData )
+/*N*/ {
+/*N*/ aDBData = rNewData;
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ GetSysFldType(RES_DBNAMEFLD)->UpdateFlds();
+/*N*/ }
+
+/*N*/ BOOL SwDoc::SplitNode( const SwPosition &rPos, BOOL bChkTableStart )
+/*N*/ {
+/*N*/ SwCntntNode *pNode = rPos.nNode.GetNode().GetCntntNode();
+/*N*/ if(0 == pNode)
+/*N*/ return FALSE;
+/*N*/
+/*N*/ {
+/*N*/ // Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt
+/*N*/ // man noch mit, welche Objecte sich im Bereich befinden.
+/*N*/ // Danach koennen sie vor/hinter der Position befinden.
+/*N*/ SwDataChanged aTmp( this, rPos, 0 );
+/*N*/ }
+/*N*/
+/*N*/ //JP 28.01.97: Sonderfall fuer SplitNode am Tabellenanfang:
+/*N*/ // steht die am Doc/Fly/Footer/..-Anfang oder direkt
+/*N*/ // hinter einer Tabelle, dann fuege davor
+/*N*/ // einen Absatz ein
+/*N*/ if( bChkTableStart && !rPos.nContent.GetIndex() && pNode->IsTxtNode() )
+/*N*/ {
+/*?*/ ULONG nPrevPos = rPos.nNode.GetIndex() - 1;
+/*?*/ const SwTableNode* pTblNd;
+/*?*/ const SwNode* pNd = GetNodes()[ nPrevPos ];
+/*?*/ if( pNd->IsStartNode() &&
+/*?*/ SwTableBoxStartNode == ((SwStartNode*)pNd)->GetStartNodeType() &&
+/*?*/ 0 != ( pTblNd = GetNodes()[ --nPrevPos ]->GetTableNode() ) &&
+/*?*/ ((( pNd = GetNodes()[ --nPrevPos ])->IsStartNode() &&
+/*?*/ SwTableBoxStartNode != ((SwStartNode*)pNd)->GetStartNodeType() )
+/*?*/ || ( pNd->IsEndNode() && pNd->FindStartNode()->IsTableNode() )
+/*?*/ || pNd->IsCntntNode() ))
+/*?*/ {
+/*?*/ if( pNd->IsCntntNode() )
+/*?*/ {
+/*?*/ //JP 30.04.99 Bug 65660:
+/*?*/ // ausserhalb des normalen BodyBereiches gibt es keine
+/*?*/ // Seitenumbrueche, also ist das hier kein gueltige
+/*?*/ // Bedingung fuers einfuegen eines Absatzes
+/*?*/ if( nPrevPos < GetNodes().GetEndOfExtras().GetIndex() )
+/*?*/ pNd = 0;
+/*?*/ else
+/*?*/ {
+/*?*/ // Dann nur, wenn die Tabelle Umbrueche traegt!
+/*?*/ const SwFrmFmt* pFrmFmt = pTblNd->GetTable().GetFrmFmt();
+/*?*/ if( SFX_ITEM_SET != pFrmFmt->GetItemState(RES_PAGEDESC, FALSE) &&
+/*?*/ SFX_ITEM_SET != pFrmFmt->GetItemState( RES_BREAK, FALSE ) )
+/*?*/ pNd = 0;
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ if( pNd )
+/*?*/ {
+/*?*/ SwTxtNode* pTxtNd = GetNodes().MakeTxtNode(
+/*?*/ SwNodeIndex( *pTblNd ),
+/*?*/ GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
+/*?*/ if( pTxtNd )
+/*?*/ {
+/*?*/ ((SwPosition&)rPos).nNode = pTblNd->GetIndex()-1;
+/*?*/ ((SwPosition&)rPos).nContent.Assign( pTxtNd, 0 );
+/*?*/
+/*?*/ // nur im BodyBereich den SeitenUmbruch/-Vorlage umhaengem
+/*?*/ if( nPrevPos > GetNodes().GetEndOfExtras().GetIndex() )
+/*?*/ {
+/*?*/ SwFrmFmt* pFrmFmt = pTblNd->GetTable().GetFrmFmt();
+/*?*/ const SfxPoolItem *pItem;
+/*?*/ if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_PAGEDESC,
+/*?*/ FALSE, &pItem ) )
+/*?*/ {
+/*?*/ pTxtNd->SwCntntNode::SetAttr( *pItem );
+/*?*/ pFrmFmt->ResetAttr( RES_PAGEDESC );
+/*?*/ }
+/*?*/ if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_BREAK,
+/*?*/ FALSE, &pItem ) )
+/*?*/ {
+/*?*/ pTxtNd->SwCntntNode::SetAttr( *pItem );
+/*?*/ pFrmFmt->ResetAttr( RES_BREAK );
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ SetModified();
+/*?*/ return TRUE;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ SvULongs aBkmkArr( 15, 15 );
+/*N*/ _SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
+/*N*/ aBkmkArr, SAVEFLY_SPLIT );
+/*N*/ if( 0 != ( pNode = pNode->SplitNode( rPos ) ))
+/*N*/ {
+/*N*/ // verschiebe noch alle Bookmarks/TOXMarks/FlyAtCnt
+/*N*/ if( aBkmkArr.Count() )
+/*?*/ { _RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, TRUE );}
+/*N*/
+/*N*/ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aPam( rPos );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SetModified();
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL SwDoc::AppendTxtNode( SwPosition& rPos )
+/*N*/ {
+ /*
+ * Neuen Node vor EndOfContent erzeugen.
+ */
+/*N*/ SwTxtNode *pCurNode = GetNodes()[ rPos.nNode ]->GetTxtNode();
+/*N*/ if( !pCurNode )
+/*N*/ {
+/*?*/ // dann kann ja einer angelegt werden!
+/*?*/ SwNodeIndex aIdx( rPos.nNode, 1 );
+/*?*/ pCurNode = GetNodes().MakeTxtNode( aIdx,
+/*?*/ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
+/*N*/ }
+/*N*/ else
+/*N*/ pCurNode = (SwTxtNode*)pCurNode->AppendNode( rPos );
+/*N*/
+/*N*/ rPos.nNode++;
+/*N*/ rPos.nContent.Assign( pCurNode, 0 );
+/*N*/
+/*N*/ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aPam( rPos );
+/*N*/ }
+/*N*/
+/*N*/ SetModified();
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL SwDoc::Insert( const SwPaM &rRg, const String &rStr, BOOL bHintExpand )
+/*N*/ {
+/*N*/ const SwPosition* pPos = rRg.GetPoint();
+/*N*/
+/*N*/ SwTxtNode *pNode = pPos->nNode.GetNode().GetTxtNode();
+/*N*/ if(!pNode)
+/*N*/ return FALSE;
+
+/*N*/ const USHORT nInsMode = bHintExpand ? INS_EMPTYEXPAND
+/*N*/ : INS_NOHINTEXPAND;
+/*N*/ SwDataChanged aTmp( rRg, 0 );
+/*N*/
+/*N*/ pNode->Insert( rStr, pPos->nContent, nInsMode );
+/*N*/
+/*N*/ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aPam( pPos->nNode, aTmp.GetCntnt(),
+/*N*/ }
+/*N*/
+/*N*/ SetModified();
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ SwFlyFrmFmt* SwDoc::_InsNoTxtNode( const SwPosition& rPos, SwNoTxtNode* pNode,
+/*N*/ const SfxItemSet* pFlyAttrSet,
+/*N*/ const SfxItemSet* pGrfAttrSet,
+/*N*/ SwFrmFmt* pFrmFmt)
+/*N*/ {
+/*N*/ SwFlyFrmFmt *pFmt = 0;
+/*N*/ if( pNode )
+/*N*/ {
+/*N*/ pFmt = _MakeFlySection( rPos, *pNode, FLY_AT_CNTNT,
+/*N*/ pFlyAttrSet, pFrmFmt );
+/*N*/ if( pGrfAttrSet )
+/*N*/ pNode->SetAttr( *pGrfAttrSet );
+/*N*/ }
+/*N*/ return pFmt;
+/*N*/ }
+
+/*N*/ SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg,
+/*N*/ const String& rGrfName,
+/*N*/ const String& rFltName,
+/*N*/ const Graphic* pGraphic,
+/*N*/ const SfxItemSet* pFlyAttrSet,
+/*N*/ const SfxItemSet* pGrfAttrSet,
+/*N*/ SwFrmFmt* pFrmFmt )
+/*N*/ {
+/*N*/ if( !pFrmFmt )
+/*?*/ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC );
+/*N*/ return _InsNoTxtNode( *rRg.GetPoint(), GetNodes().MakeGrfNode(
+/*N*/ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+/*N*/ rGrfName, rFltName, pGraphic,
+/*N*/ pDfltGrfFmtColl ),
+/*N*/ pFlyAttrSet, pGrfAttrSet, pFrmFmt );
+/*N*/ }
+/*N*/ SwFlyFrmFmt* SwDoc::Insert( const SwPaM &rRg, const BfGraphicObject& rGrfObj,
+/*N*/ const SfxItemSet* pFlyAttrSet,
+/*N*/ const SfxItemSet* pGrfAttrSet,
+/*N*/ SwFrmFmt* pFrmFmt )
+/*N*/ {
+/*N*/ if( !pFrmFmt )
+/*?*/ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC );
+/*N*/ return _InsNoTxtNode( *rRg.GetPoint(), GetNodes().MakeGrfNode(
+/*N*/ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+/*N*/ rGrfObj, pDfltGrfFmtColl ),
+/*N*/ pFlyAttrSet, pGrfAttrSet, pFrmFmt );
+/*N*/ }
+
+/*N*/ SwFlyFrmFmt* SwDoc::Insert(const SwPaM &rRg, SvInPlaceObject *pObj,
+/*N*/ const SfxItemSet* pFlyAttrSet,
+/*N*/ const SfxItemSet* pGrfAttrSet,
+/*N*/ SwFrmFmt* pFrmFmt )
+/*N*/ {
+/*N*/ if( !pFrmFmt )
+/*N*/ {
+/*N*/ USHORT nId = RES_POOLFRM_OLE;
+/*N*/
+/*N*/ FASTBOOL bMath = SmModuleDummy::HasID( *pObj->GetSvFactory() );
+/*N*/ if ( bMath )
+/*?*/ nId = RES_POOLFRM_FORMEL;
+/*N*/
+/*N*/ pFrmFmt = GetFrmFmtFromPool( nId );
+/*N*/ }
+/*N*/ return _InsNoTxtNode( *rRg.GetPoint(), GetNodes().MakeOLENode(
+/*N*/ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+/*N*/ pObj,
+/*N*/ pDfltGrfFmtColl ),
+/*N*/ pFlyAttrSet, pGrfAttrSet,
+/*N*/ pFrmFmt );
+/*N*/ }
+
+/*N*/ SwFlyFrmFmt* SwDoc::InsertOLE(const SwPaM &rRg, String& rObjName,
+/*N*/ const SfxItemSet* pFlyAttrSet,
+/*N*/ const SfxItemSet* pGrfAttrSet,
+/*N*/ SwFrmFmt* pFrmFmt )
+/*N*/ {
+/*N*/ if( !pFrmFmt )
+/*N*/ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_OLE );
+/*N*/
+/*N*/ return _InsNoTxtNode( *rRg.GetPoint(), GetNodes().MakeOLENode(
+/*N*/ SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+/*N*/ rObjName,
+/*N*/ pDfltGrfFmtColl ),
+/*N*/ pFlyAttrSet, pGrfAttrSet,
+/*N*/ pFrmFmt );
+/*N*/ }
+
+
+
+
+/*************************************************************************
+|* SwDoc::GetFldType()
+|* Beschreibung: liefert den am Doc eingerichteten Feldtypen zurueck
+*************************************************************************/
+
+/*N*/ SwFieldType *SwDoc::GetSysFldType( const USHORT eWhich ) const
+/*N*/ {
+/*N*/ for( register int i = 0; i < INIT_FLDTYPES; i++ )
+/*N*/ if( eWhich == (*pFldTypes)[i]->Which() )
+/*N*/ return (*pFldTypes)[i];
+/*N*/ return 0;
+/*N*/ }
+
+//----- Macro ---------------------------------------------------------
+
+
+
+void SwDoc::SetGlobalMacro( USHORT nEvent, const SvxMacro& rMacro )
+{
+ SvxMacro *pMacro;
+ SetModified();
+ if ( 0 != (pMacro=pMacroTable->Get(nEvent)) )
+ {
+ delete pMacro;
+ pMacroTable->Replace(nEvent, new SvxMacro(rMacro));
+ return;
+ }
+ pMacroTable->Insert(nEvent, new SvxMacro(rMacro));
+}
+
+
+/*************************************************************************
+ * void SetDocStat( const SwDocStat& rStat );
+ *************************************************************************/
+
+/*N*/ void SwDoc::SetDocStat( const SwDocStat& rStat )
+/*N*/ {
+/*N*/ *pDocStat = rStat;
+/*N*/ }
+
+
+/*M*/ sal_uInt16 SwDoc::GetPageCount() const
+/*M*/ {
+/*M*/ return GetRootFrm() ? GetRootFrm()->GetPageNum() : 0;
+/*M*/ }
+
+/*M*/ const Size SwDoc::GetPageSize( sal_uInt16 nPageNum ) const
+/*M*/ {
+/*M*/ Size aSize;
+/*M*/ if( GetRootFrm() && nPageNum )
+/*M*/ {
+/*M*/ const SwPageFrm* pPage = static_cast<const SwPageFrm*>
+/*M*/ (GetRootFrm()->Lower());
+/*M*/ while( --nPageNum && pPage->GetNext() )
+/*M*/ pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
+/*M*/ if( pPage->IsEmptyPage() && pPage->GetNext() )
+/*M*/ pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
+/*M*/ aSize = pPage->Frm().SSize();
+/*M*/ }
+/*M*/ return aSize;
+/*M*/ }
+
+
+/*************************************************************************
+ * void UpdateDocStat( const SwDocStat& rStat );
+ *************************************************************************/
+
+/*M*/ void SwDoc::UpdateDocStat( SwDocStat& rStat )
+/*M*/ {
+/*M*/ if( rStat.bModified )
+/*M*/ {
+/*M*/ rStat.Reset();
+/*M*/ rStat.nPara = 0; // Default ist auf 1 !!
+/*M*/ SwNode* pNd;
+/*M*/
+/*M*/ for( ULONG n = GetNodes().Count(); n; )
+/*M*/ switch( ( pNd = GetNodes()[ --n ])->GetNodeType() )
+/*M*/ {
+/*M*/ case ND_TEXTNODE:
+/*M*/ {
+/*M*/ const String& rStr = ((SwTxtNode*)pNd)->GetTxt();
+/*M*/
+/*M*/ if( rStr.Len() && pBreakIt->xBreak.is() )
+/*M*/ {
+/*M*/ SwScanner aScanner( *((SwTxtNode*)pNd), NULL,
+/*M*/ ::com::sun::star::i18n::WordType::WORD_COUNT,
+/*M*/ 0, rStr.Len(), sal_False, sal_False );
+/*M*/
+/*M*/ while ( aScanner.NextWord() )
+/*M*/ {
+/*M*/ if ( aScanner.GetLen() > 1 ||
+/*M*/ CH_TXTATR_BREAKWORD != rStr.GetChar( aScanner.GetBegin() ) )
+/*M*/ ++rStat.nWord;
+/*M*/ }
+/*M*/ }
+/*M*/ rStat.nChar += rStr.Len();
+/*M*/ ++rStat.nPara;
+/*M*/ }
+/*M*/ break;
+/*M*/ case ND_TABLENODE: ++rStat.nTbl; break;
+/*M*/ case ND_GRFNODE: ++rStat.nGrf; break;
+/*M*/ case ND_OLENODE: ++rStat.nOLE; break;
+/*M*/ case ND_SECTIONNODE: break;
+/*M*/ }
+/*M*/
+/*M*/ rStat.nPage = GetRootFrm() ? GetRootFrm()->GetPageNum() : 0;
+/*M*/ rStat.bModified = FALSE;
+/*M*/ SetDocStat( rStat );
+/*M*/ // event. Stat. Felder Updaten
+/*M*/ SwFieldType *pType = GetSysFldType(RES_DOCSTATFLD);
+/*M*/ pType->UpdateFlds();
+/*M*/ }
+/*M*/ }
+
+
+// Dokument - Info
+
+/*N*/ void SwDoc::DocInfoChgd( const SfxDocumentInfo& rInfo )
+/*N*/ {
+/*N*/ delete pSwgInfo;
+/*N*/ pSwgInfo = new SfxDocumentInfo(rInfo);
+/*N*/
+/*N*/ GetSysFldType( RES_DOCINFOFLD )->UpdateFlds();
+/*N*/ GetSysFldType( RES_TEMPLNAMEFLD )->UpdateFlds();
+/*N*/ SetModified();
+/*N*/ }
+
+ // returne zum Namen die im Doc gesetzte Referenz
+/*N*/ const SwFmtRefMark* SwDoc::GetRefMark( const String& rName ) const
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_REFMARK );
+/*N*/ for( USHORT n = 0; n < nMaxItems; ++n )
+/*N*/ {
+/*N*/ if( 0 == (pItem = GetAttrPool().GetItem( RES_TXTATR_REFMARK, n ) ))
+/*N*/ continue;
+/*N*/
+/*N*/ const SwFmtRefMark* pFmtRef = (SwFmtRefMark*)pItem;
+/*N*/ const SwTxtRefMark* pTxtRef = pFmtRef->GetTxtRefMark();
+/*N*/ if( pTxtRef && &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() &&
+/*N*/ rName.Equals( pFmtRef->GetRefName() ) )
+/*N*/ return pFmtRef;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+ // returne die RefMark per Index - fuer Uno
+
+ // returne die Namen aller im Doc gesetzten Referenzen
+ //JP 24.06.96: Ist der ArrayPointer 0 dann returne nur, ob im Doc. eine
+ // RefMark gesetzt ist
+ // OS 25.06.96: ab jetzt wird immer die Anzahl der Referenzen returnt
+/*N*/ USHORT SwDoc::GetRefMarks( SvStringsDtor* pNames ) const
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 const SfxPoolItem* pItem;
+/*N*/ }
+
+/*N*/ void SwDoc::SetModified()
+/*N*/ {
+/*N*/ // dem Link wird der Status returnt, wie die Flags waren und werden
+/*N*/ // Bit 0: -> alter Zustand
+/*N*/ // Bit 1: -> neuer Zustand
+/*N*/ long nCall = bModified ? 3 : 2;
+/*N*/ bModified = TRUE;
+/*N*/ pDocStat->bModified = TRUE;
+/*N*/ if( aOle2Link.IsSet() )
+/*N*/ {
+/*N*/ bInCallModified = TRUE;
+/*N*/ aOle2Link.Call( (void*)nCall );
+/*N*/ bInCallModified = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::ResetModified()
+/*N*/ {
+/*N*/ // dem Link wird der Status returnt, wie die Flags waren und werden
+/*N*/ // Bit 0: -> alter Zustand
+/*N*/ // Bit 1: -> neuer Zustand
+/*N*/ long nCall = bModified ? 1 : 0;
+/*N*/ bModified = FALSE;
+/*N*/ if( nCall && aOle2Link.IsSet() )
+/*N*/ {
+/*N*/ bInCallModified = TRUE;
+/*N*/ aOle2Link.Call( (void*)nCall );
+/*N*/ bInCallModified = FALSE;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName,
+/*N*/ const String& rFltName, const Graphic* pGraphic,
+/*N*/ const BfGraphicObject* pGrafObj )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwGrfNode *pGrfNd;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ USHORT SwDoc::GetLinkUpdMode() const
+/*N*/ {
+/*N*/ USHORT nRet = nLinkUpdMode;
+/*N*/ if( GLOBALSETTING == nRet )
+/*N*/ nRet = SW_MOD()->GetLinkUpdMode(IsHTMLMode());
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ USHORT SwDoc::GetFldUpdateFlags() const
+/*N*/ {
+/*N*/ USHORT nRet = nFldUpdMode;
+/*N*/ if( AUTOUPD_GLOBALSETTING == nRet )
+/*N*/ nRet = SW_MOD()->GetFldUpdateFlags(IsHTMLMode());
+/*N*/ return nRet;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docbm.cxx b/binfilter/bf_sw/source/core/doc/sw_docbm.cxx
new file mode 100644
index 000000000000..ca32fb53c48d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docbm.cxx
@@ -0,0 +1,818 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <fmtanchr.hxx>
+#include <frmfmt.hxx>
+
+#include <errhdl.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <errhdl.hxx>
+#include <cntfrm.hxx>
+#include <dcontact.hxx>
+#include <bookmrk.hxx>
+#include <mvsave.hxx>
+#include <redline.hxx>
+#include <docary.hxx>
+#include <viscrs.hxx>
+#include <editsh.hxx>
+#include <unocrsr.hxx>
+namespace binfilter {
+
+
+/*N*/ SV_IMPL_OP_PTRARR_SORT(SwBookmarks, SwBookmarkPtr)
+
+#define PCURCRSR (_pCurrCrsr)
+#define FOREACHPAM_START(pSttCrsr) \
+ {\
+ SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \
+ do {
+
+#define FOREACHPAM_END() \
+ } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \
+ }
+#define PCURSH ((SwCrsrShell*)_pStartShell)
+#define FOREACHSHELL_START( pEShell ) \
+ {\
+ register ViewShell *_pStartShell = pEShell; \
+ do { \
+ if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \
+ {
+
+#define FOREACHSHELL_END( pEShell ) \
+ } \
+ } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \
+ }
+
+
+/*N*/ SwBookmark* SwDoc::MakeBookmark( const SwPaM& rPaM, const KeyCode& rCode,
+/*N*/ const String& rName, const String& rShortName,
+/*N*/ BOOKMARK_TYPE eMark )
+/*N*/ {
+/*N*/ SwBookmark *pBM;
+/*N*/ if( MARK == eMark )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pBM = new SwMark( *rPaM.GetPoint(), rCode, rName, rShortName );
+/*N*/ else if( BOOKMARK == eMark )
+/*N*/ {
+/*N*/ pBM = new SwBookmark(*rPaM.GetPoint(), rCode, rName, rShortName);
+/*N*/ if( rPaM.HasMark() )
+/*?*/ pBM->pPos2 = new SwPosition( *rPaM.GetMark() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pBM = new SwUNOMark(*rPaM.GetPoint(), rCode, rName, rShortName);
+/*N*/ if( rPaM.HasMark() )
+/*N*/ pBM->pPos2 = new SwPosition( *rPaM.GetMark() );
+/*N*/ }
+/*N*/
+/*N*/ if( !pBookmarkTbl->Insert( pBM ) )
+/*?*/ delete pBM, pBM = 0;
+/*N*/ else
+/*N*/ {
+/*N*/ if(UNO_BOOKMARK != eMark)
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ return pBM;
+/*N*/ }
+
+/*N*/ void SwDoc::DelBookmark(USHORT nPos)
+/*N*/ {
+/*N*/ SwBookmark *pBM = (*pBookmarkTbl)[nPos];
+/*N*/
+/*N*/ // #108964# UNO bookmark don't contribute to the document state,
+/*N*/ // and hence changing them shouldn't set the document modified
+/*N*/ if( !pBM->IsUNOMark() )
+/*N*/ SetModified();
+/*N*/
+/*N*/ pBookmarkTbl->Remove(nPos);
+/*N*/
+/*N*/ SwServerObject* pServObj = pBM->GetObject();
+/*N*/ if( pServObj ) // dann aus der Liste entfernen
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 GetLinkManager().RemoveServer( pServObj );
+/*N*/
+/*N*/ delete pBM;
+/*N*/ }
+
+/*N*/ void SwDoc::DelBookmark( const String& rName )
+/*N*/ {
+/*N*/ USHORT nFnd = FindBookmark( rName );
+/*N*/ if( USHRT_MAX != nFnd )
+/*N*/ DelBookmark( nFnd );
+/*N*/ }
+
+/*N*/ USHORT SwDoc::FindBookmark( const String& rName )
+/*N*/ {
+/*N*/ ASSERT( rName.Len(), "wo ist der Name?" );
+/*N*/ for( USHORT n = pBookmarkTbl->Count(); n ; )
+/*N*/ if( rName.Equals( (*pBookmarkTbl)[ --n ]->GetName() ) )
+/*N*/ return n;
+/*N*/ return USHRT_MAX;
+/*N*/ }
+
+// Zur Vereinfachung gibt es auch den direkten Zugriff
+// auf die "echten" Bookmarks
+
+/*N*/USHORT SwDoc::GetBookmarkCnt(BOOL bBkmrk) const
+/*N*/{
+/*?*/ USHORT nRet = pBookmarkTbl->Count();
+/*?*/ if(bBkmrk)
+/*?*/ {
+/*?*/ for( USHORT i = nRet; i; --i )
+/*?*/ {
+/*?*/ if(!(*pBookmarkTbl)[i - 1]->IsBookMark())
+/*?*/ nRet--;
+/*?*/ }
+/*?*/ }
+/*?*/ return nRet;
+/*N*/}
+
+
+/*N*/SwBookmark& SwDoc::GetBookmark(USHORT nPos, BOOL bBkmrk)
+/*N*/{
+/*?*/ if( bBkmrk )
+/*?*/ {
+/*?*/ USHORT nCount = pBookmarkTbl->Count();
+/*?*/ USHORT i = 0;
+/*?*/ do {
+/*?*/ if(!(*pBookmarkTbl)[i]->IsBookMark())
+/*?*/ nPos++;
+/*?*/
+/*?*/ i++;
+/*?*/ }
+/*?*/ while( i < nPos || !(*pBookmarkTbl)[nPos]->IsBookMark() );
+/*?*/ }
+/*?*/ return *(*pBookmarkTbl)[nPos];
+/*N*/}
+
+
+ // erzeugt einen eindeutigen Namen. Der Name selbst muss vorgegeben
+ // werden, es wird dann bei gleichen Namen nur durchnumeriert.
+/*N*/ void SwDoc::MakeUniqueBookmarkName( String& rNm )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ASSERT( rNm.Len(), "es sollte ein Name vorgegeben werden!" );
+/*N*/ }
+
+/* */
+
+/*N*/ SaveBookmark::SaveBookmark( int eType, const SwBookmark& rBkmk,
+/*N*/ const SwNodeIndex & rMvPos,
+/*N*/ const SwIndex* pIdx )
+/*N*/ : aName( rBkmk.GetName() ), aShortName( rBkmk.GetShortName() ),
+/*N*/ aCode( rBkmk.GetKeyCode() ), eBkmkType( (SaveBookmarkType)eType ),
+/*N*/ eOrigBkmType(rBkmk.GetType())
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 nNode1 = rBkmk.GetPos().nNode.GetIndex();
+/*N*/ }
+
+
+
+/*N*/ inline int GreaterThan( const SwPosition& rPos, const SwNodeIndex& rNdIdx,
+/*N*/ const SwIndex* pIdx )
+/*N*/ {
+/*N*/ return pIdx ? ( rPos.nNode > rNdIdx || ( rPos.nNode == rNdIdx &&
+/*N*/ rPos.nContent >= pIdx->GetIndex() ))
+/*N*/ : rPos.nNode >= rNdIdx;
+/*N*/ }
+/*N*/ inline int Lower( const SwPosition& rPos, const SwNodeIndex& rNdIdx,
+/*N*/ const SwIndex* pIdx )
+/*N*/ {
+/*N*/ return rPos.nNode < rNdIdx || ( pIdx && rPos.nNode == rNdIdx &&
+/*N*/ rPos.nContent < pIdx->GetIndex() );
+/*N*/ }
+/*N*/ inline int Greater( const SwPosition& rPos, const SwNodeIndex& rNdIdx,
+/*N*/ const SwIndex* pIdx )
+/*N*/ {
+/*N*/ return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx &&
+/*N*/ rPos.nContent > pIdx->GetIndex() );
+/*N*/ }
+
+/*N*/ void _DelBookmarks( const SwNodeIndex& rStt, const SwNodeIndex& rEnd,
+/*N*/ SaveBookmarks* pSaveBkmk,
+/*N*/ const SwIndex* pSttIdx, const SwIndex* pEndIdx )
+/*N*/ {
+/*N*/ // kein gueltiger Bereich ??
+/*N*/ if( rStt.GetIndex() > rEnd.GetIndex() || ( rStt == rEnd &&
+/*N*/ (!pSttIdx || pSttIdx->GetIndex() >= pEndIdx->GetIndex())) )
+/*N*/ return;
+/*N*/
+/*N*/ // kopiere alle Bookmarks, die im Move Bereich stehen in ein
+/*N*/ // Array, das alle Angaben auf die Position als Offset speichert.
+/*N*/ // Die neue Zuordung erfolgt nach dem Moven.
+/*N*/ SwDoc* pDoc = rStt.GetNode().GetDoc();
+/*N*/ const SwBookmarks& rBkmks = pDoc->GetBookmarks();
+ USHORT nCnt=0;
+/*N*/ for( nCnt = 0; nCnt < rBkmks.Count(); ++nCnt )
+/*N*/ {
+/*N*/ // liegt auf der Position ??
+/*N*/ int eType = BKMK_POS_NONE;
+/*N*/ SwBookmark* pBkmk = rBkmks[ nCnt ];
+/*N*/ //simple marks should not be moved
+/*N*/ if(pBkmk->IsMark())
+/*N*/ continue;
+/*N*/ if( GreaterThan( pBkmk->GetPos(), rStt, pSttIdx ) &&
+/*N*/ Lower( pBkmk->GetPos(), rEnd, pEndIdx ))
+/*N*/ eType = BKMK_POS;
+/*N*/ if( pBkmk->GetOtherPos() &&
+/*N*/ GreaterThan( *pBkmk->GetOtherPos(), rStt, pSttIdx ) &&
+/*N*/ Lower( *pBkmk->GetOtherPos(), rEnd, pEndIdx ))
+/*N*/ eType |= BKMK_POS_OTHER;
+/*N*/
+/*N*/ if( BKMK_POS_NONE == eType ) // auf zum naechsten
+/*N*/ continue;
+/*N*/
+/*N*/ if( pSaveBkmk )
+/*N*/ {
+/*N*/ // Besonderheit: komplett eingeschlossen? dann mitnehmen
+/*N*/ if( pEndIdx && (BKMK_POS_OTHER | BKMK_POS) != eType &&
+/*N*/ ( ( BKMK_POS_OTHER & eType &&
+/*N*/ pBkmk->GetPos().nNode == rEnd &&
+/*N*/ pBkmk->GetPos().nContent == *pEndIdx ) ||
+/*N*/ ( BKMK_POS & eType && pBkmk->GetOtherPos() &&
+/*N*/ pBkmk->GetOtherPos()->nNode == rEnd &&
+/*N*/ pBkmk->GetOtherPos()->nContent == *pEndIdx ) ) )
+/*N*/ eType = BKMK_POS_OTHER | BKMK_POS;
+/*N*/
+/*N*/ SaveBookmark * pSBkmk = new SaveBookmark( eType, *pBkmk, rStt, pSttIdx );
+/*N*/ pSaveBkmk->C40_INSERT( SaveBookmark, pSBkmk, pSaveBkmk->Count() );
+/*N*/ pDoc->DelBookmark( nCnt-- );
+/*N*/ }
+/*N*/ else if( (BKMK_POS_OTHER | BKMK_POS ) == eType ||
+/*N*/ ( BKMK_POS == eType && !pBkmk->GetOtherPos() ) )
+/*N*/ pDoc->DelBookmark( nCnt-- );
+/*N*/ else
+/*N*/ {
+/*N*/ SwPosition* pPos = (SwPosition*)(BKMK_POS & eType
+/*N*/ ? &pBkmk->GetPos()
+/*N*/ : pBkmk->GetOtherPos());
+/*N*/ pPos->nNode = rEnd;
+/*N*/ if( pEndIdx )
+/*N*/ pPos->nContent = *pEndIdx;
+/*N*/ else
+/*N*/ {
+/*N*/ SwCntntNode* pCNd = pPos->nNode.GetNode().GetCntntNode();
+/*N*/ BOOL bStt = TRUE;
+/*N*/ if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoNext( &pPos->nNode )) )
+/*N*/ {
+/*N*/ bStt = FALSE;
+/*N*/ pPos->nNode = rStt;
+/*N*/ if( 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &pPos->nNode )) )
+/*N*/ {
+/*N*/ pPos->nNode = BKMK_POS == eType
+/*N*/ ? pBkmk->GetOtherPos()->nNode
+/*N*/ : pBkmk->GetPos().nNode;
+/*N*/ pCNd = pPos->nNode.GetNode().GetCntntNode();
+/*N*/ }
+/*N*/ }
+/*N*/ xub_StrLen nTmp = bStt ? 0 : pCNd->Len();
+/*N*/ pPos->nContent.Assign( pCNd, nTmp );
+/*N*/ }
+/*N*/
+/*N*/ // keine ungueltigen Selektionen zulassen!
+/*N*/ if( pBkmk->GetOtherPos() &&
+/*N*/ pBkmk->GetOtherPos()->nNode.GetNode().FindTableBoxStartNode() !=
+/*N*/ pBkmk->GetPos().nNode.GetNode().FindTableBoxStartNode() )
+/*N*/ {
+/*N*/ SwPaM aPam( pPos == pBkmk->GetOtherPos()
+/*N*/ ? pBkmk->GetPos() : *pBkmk->GetOtherPos() );
+/*N*/ String sNm( pBkmk->GetName() ), sShortNm( pBkmk->GetShortName() );
+/*N*/ KeyCode aKCode( pBkmk->GetKeyCode() );
+/*N*/
+/*N*/ pDoc->DelBookmark( nCnt-- );
+/*N*/ pDoc->MakeBookmark( aPam, aKCode, sNm, sShortNm, BOOKMARK );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // kopiere alle Redlines, die im Move Bereich stehen in ein
+/*N*/ // Array, das alle Angaben auf die Position als Offset speichert.
+/*N*/ // Die neue Zuordung erfolgt nach dem Moven.
+/*N*/ SwRedlineTbl& rTbl = (SwRedlineTbl&)pDoc->GetRedlineTbl();
+/*N*/ for( nCnt = 0; nCnt < rTbl.Count(); ++nCnt )
+/*N*/ {
+/*N*/ // liegt auf der Position ??
+/*N*/ int eType = BKMK_POS_NONE;
+/*N*/ SwRedline* pRedl = rTbl[ nCnt ];
+/*N*/
+/*N*/ SwPosition *pRStt = &pRedl->GetBound(TRUE),
+/*N*/ *pREnd = &pRedl->GetBound(FALSE);
+/*N*/ if( *pRStt > *pREnd )
+/*N*/ {
+/*N*/ SwPosition *pTmp = pRStt; pRStt = pREnd, pREnd = pTmp;
+/*N*/ }
+/*N*/
+/*N*/ if( Greater( *pRStt, rStt, pSttIdx ) && Lower( *pRStt, rEnd, pEndIdx ))
+/*N*/ {
+/*N*/ pRStt->nNode = rEnd;
+/*N*/ if( pEndIdx )
+/*N*/ pRStt->nContent = *pEndIdx;
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bStt = TRUE;
+/*N*/ SwCntntNode* pCNd = pRStt->nNode.GetNode().GetCntntNode();
+/*N*/ if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoNext( &pRStt->nNode )) )
+/*N*/ {
+/*N*/ bStt = FALSE;
+/*N*/ pRStt->nNode = rStt;
+/*N*/ if( 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &pRStt->nNode )) )
+/*N*/ {
+/*N*/ pRStt->nNode = pREnd->nNode;
+/*N*/ pCNd = pRStt->nNode.GetNode().GetCntntNode();
+/*N*/ }
+/*N*/ }
+/*N*/ xub_StrLen nTmp = bStt ? 0 : pCNd->Len();
+/*N*/ pRStt->nContent.Assign( pCNd, nTmp );
+/*N*/ }
+/*N*/ }
+/*N*/ if( Greater( *pREnd, rStt, pSttIdx ) && Lower( *pREnd, rEnd, pEndIdx ))
+/*N*/ {
+/*N*/ pREnd->nNode = rStt;
+/*N*/ if( pSttIdx )
+/*N*/ pREnd->nContent = *pSttIdx;
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bStt = FALSE;
+/*N*/ SwCntntNode* pCNd = pREnd->nNode.GetNode().GetCntntNode();
+/*N*/ if( !pCNd && 0 == ( pCNd = pDoc->GetNodes().GoPrevious( &pREnd->nNode )) )
+/*N*/ {
+/*N*/ bStt = TRUE;
+/*N*/ pREnd->nNode = rEnd;
+/*N*/ if( 0 == ( pCNd = pDoc->GetNodes().GoNext( &pREnd->nNode )) )
+/*N*/ {
+/*N*/ pREnd->nNode = pRStt->nNode;
+/*N*/ pCNd = pREnd->nNode.GetNode().GetCntntNode();
+/*N*/ }
+/*N*/ }
+/*N*/ xub_StrLen nTmp = bStt ? 0 : pCNd->Len();
+/*N*/ pREnd->nContent.Assign( pCNd, nTmp );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/* */
+
+
+// Aufbau vom Array: 2 longs,
+// 1. Long enthaelt Type und Position im DocArray,
+// 2. die ContentPosition
+//
+// CntntType --
+// 0x8000 = Bookmark Pos1
+// 0x8001 = Bookmark Pos2
+// 0x2000 = Absatzgebundener Rahmen
+// 0x2001 = Auto-Absatzgebundener Rahmen, der umgehaengt werden soll
+// 0x1000 = Redline Mark
+// 0x1001 = Redline Point
+// 0x0800 = Crsr aus der CrsrShell Mark
+// 0x0801 = Crsr aus der CrsrShell Point
+// 0x0400 = UnoCrsr Mark
+// 0x0401 = UnoCrsr Point
+//
+
+/*N*/ class _SwSaveTypeCountContent
+/*N*/ {
+/*N*/ union {
+/*N*/ struct { USHORT nType, nCount; } TC;
+/*N*/ ULONG nTypeCount;
+/*N*/ } TYPECOUNT;
+/*N*/ xub_StrLen nContent;
+/*N*/
+/*N*/ public:
+/*N*/ _SwSaveTypeCountContent() { TYPECOUNT.nTypeCount = 0; nContent = 0; }
+/*N*/ _SwSaveTypeCountContent( USHORT nType )
+/*N*/ {
+/*N*/ SetTypeAndCount( nType, 0 );
+/*N*/ nContent = 0;
+/*N*/ }
+/*N*/ _SwSaveTypeCountContent( const SvULongs& rArr, USHORT& rPos )
+/*N*/ {
+/*N*/ TYPECOUNT.nTypeCount = rArr[ rPos++ ];
+/*N*/ nContent = rArr[ rPos++ ];
+/*N*/ }
+/*N*/ void Add( SvULongs& rArr )
+/*N*/ {
+/*N*/ rArr.Insert( TYPECOUNT.nTypeCount, rArr.Count() );
+/*N*/ rArr.Insert( nContent, rArr.Count() );
+/*N*/ }
+/*N*/
+/*N*/ void SetType( USHORT n ) { TYPECOUNT.TC.nType = n; }
+/*N*/ USHORT GetType() const { return TYPECOUNT.TC.nType; }
+/*N*/ void IncType() { ++TYPECOUNT.TC.nType; }
+/*N*/ void DecType() { --TYPECOUNT.TC.nType; }
+/*N*/
+/*N*/ void SetCount( USHORT n ) { TYPECOUNT.TC.nCount = n; }
+/*N*/ USHORT GetCount() const { return TYPECOUNT.TC.nCount; }
+/*N*/ USHORT IncCount() { return ++TYPECOUNT.TC.nCount; }
+/*N*/ USHORT DecCount() { return --TYPECOUNT.TC.nCount; }
+/*N*/
+/*N*/ void SetTypeAndCount( USHORT nT, USHORT nC )
+/*N*/ { TYPECOUNT.TC.nCount = nC; TYPECOUNT.TC.nType = nT; }
+/*N*/
+/*N*/ void SetContent( xub_StrLen n ) { nContent = n; }
+/*N*/ xub_StrLen GetContent() const { return nContent; }
+/*N*/ };
+
+
+/*N*/ void _ChkPaM( SvULongs& rSaveArr, ULONG nNode, xub_StrLen nCntnt,
+/*N*/ const SwPaM& rPam, _SwSaveTypeCountContent& rSave,
+/*N*/ BOOL bChkSelDirection )
+/*N*/ {
+/*N*/ // SelektionsRichtung beachten
+/*N*/ BOOL bBound1IsStart = !bChkSelDirection ? TRUE :
+/*N*/ ( *rPam.GetPoint() < *rPam.GetMark()
+/*N*/ ? rPam.GetPoint() == &rPam.GetBound()
+/*N*/ : rPam.GetMark() == &rPam.GetBound());
+/*N*/
+/*N*/ const SwPosition* pPos = &rPam.GetBound( TRUE );
+/*N*/ if( pPos->nNode.GetIndex() == nNode &&
+/*N*/ ( bBound1IsStart ? pPos->nContent.GetIndex() < nCntnt
+/*N*/ : pPos->nContent.GetIndex() <= nCntnt ))
+/*N*/ {
+/*N*/ rSave.SetContent( pPos->nContent.GetIndex() );
+/*N*/ rSave.Add( rSaveArr );
+/*N*/ }
+/*N*/
+/*N*/ pPos = &rPam.GetBound( FALSE );
+/*N*/ if( pPos->nNode.GetIndex() == nNode &&
+/*N*/ ( (bBound1IsStart && bChkSelDirection)
+/*N*/ ? pPos->nContent.GetIndex() <= nCntnt
+/*N*/ : pPos->nContent.GetIndex() < nCntnt ))
+/*N*/ {
+/*N*/ rSave.SetContent( pPos->nContent.GetIndex() );
+/*N*/ rSave.IncType();
+/*N*/ rSave.Add( rSaveArr );
+/*N*/ rSave.DecType();
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt,
+/*N*/ SvULongs& rSaveArr, BYTE nSaveFly )
+/*N*/ {
+/*N*/ // 1. Bookmarks
+/*N*/ _SwSaveTypeCountContent aSave;
+/*N*/ aSave.SetTypeAndCount( 0x8000, 0 );
+/*N*/
+/*N*/ const SwBookmarks& rBkmks = pDoc->GetBookmarks();
+/*N*/ for( ; aSave.GetCount() < rBkmks.Count(); aSave.IncCount() )
+/*N*/ {
+/*N*/ const SwBookmark* pBkmk = rBkmks[ aSave.GetCount() ];
+/*N*/ if( pBkmk->GetPos().nNode.GetIndex() == nNode &&
+/*N*/ pBkmk->GetPos().nContent.GetIndex() < nCntnt )
+/*N*/ {
+/*N*/ aSave.SetContent( pBkmk->GetPos().nContent.GetIndex() );
+/*N*/ aSave.Add( rSaveArr );
+/*N*/ }
+/*N*/
+/*N*/ if( pBkmk->GetOtherPos() && pBkmk->GetOtherPos()->nNode.GetIndex() ==
+/*N*/ nNode && pBkmk->GetOtherPos()->nContent.GetIndex() < nCntnt )
+/*N*/ {
+/*N*/ aSave.SetContent( pBkmk->GetOtherPos()->nContent.GetIndex() );
+/*N*/ aSave.IncType();
+/*N*/ aSave.Add( rSaveArr );
+/*N*/ aSave.DecType();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // 2. Redlines
+/*N*/ aSave.SetTypeAndCount( 0x1000, 0 );
+/*N*/ const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
+/*N*/ for( ; aSave.GetCount() < rRedlTbl.Count(); aSave.IncCount() )
+/*N*/ {
+/*N*/ const SwRedline* pRdl = rRedlTbl[ aSave.GetCount() ];
+/*N*/ if( pRdl->GetPoint()->nNode.GetIndex() == nNode &&
+/*N*/ pRdl->GetPoint()->nContent.GetIndex() < nCntnt )
+/*N*/ {
+/*N*/ aSave.SetContent( pRdl->GetPoint()->nContent.GetIndex() );
+/*N*/ aSave.IncType();
+/*N*/ aSave.Add( rSaveArr );
+/*N*/ aSave.DecType();
+/*N*/ }
+/*N*/
+/*N*/ if( pRdl->HasMark() &&
+/*N*/ pRdl->GetMark()->nNode.GetIndex() == nNode &&
+/*N*/ pRdl->GetMark()->nContent.GetIndex() < nCntnt )
+/*N*/ {
+/*N*/ aSave.SetContent( pRdl->GetMark()->nContent.GetIndex() );
+/*N*/ aSave.Add( rSaveArr );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // 4. Absatzgebundene Objekte
+/*N*/ {
+/*N*/ SwCntntNode *pNode = pDoc->GetNodes()[nNode]->GetCntntNode();
+/*N*/ if( pNode )
+/*N*/ {
+/*N*/ const SwPosition* pAPos;
+/*N*/
+/*N*/ SwFrm* pFrm = pNode->GetFrm();
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static BOOL bViaDoc = FALSE;
+/*N*/ if( bViaDoc )
+/*N*/ pFrm = NULL;
+/*N*/ #endif
+/*N*/ if( pFrm ) // gibt es ein Layout? Dann ist etwas billiger...
+/*N*/ {
+/*N*/ if( pFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs& rDObj = *pFrm->GetDrawObjs();
+/*N*/ for( USHORT n = rDObj.Count(); n; )
+/*N*/ {
+/*N*/ SdrObject *pObj = rDObj[ --n ];
+/*N*/ SwFrmFmt* pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
+/*N*/ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+/*N*/ if( ( ( nSaveFly && FLY_AT_CNTNT == rAnchor.GetAnchorId() ) ||
+/*N*/ FLY_AUTO_CNTNT == rAnchor.GetAnchorId() ) &&
+/*N*/ ( 0 != ( pAPos = rAnchor.GetCntntAnchor() ) ) )
+/*N*/ {
+/*N*/ aSave.SetType( 0x2000 );
+/*N*/ aSave.SetContent( pAPos->nContent.GetIndex() );
+/*N*/
+/*N*/ ASSERT( nNode == pAPos->nNode.GetIndex(),
+/*N*/ "_SaveCntntIdx: Wrong Node-Index" );
+/*N*/ if( FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
+/*N*/ {
+/*N*/ if( nCntnt <= aSave.GetContent() )
+/*N*/ {
+/*N*/ if( SAVEFLY_SPLIT == nSaveFly )
+/*N*/ aSave.IncType(); // = 0x2001;
+/*N*/ else
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ aSave.SetCount( pDoc->GetSpzFrmFmts()->Count() );
+/*N*/ while( aSave.GetCount() &&
+/*N*/ pFmt != (*pDoc->GetSpzFrmFmts())[
+/*N*/ aSave.DecCount() ] )
+/*N*/ ; // nothing
+/*N*/ ASSERT( pFmt == (*pDoc->GetSpzFrmFmts())[
+/*N*/ aSave.GetCount() ],
+/*N*/ "_SaveCntntIdx: Lost FrameFormat" );
+/*N*/ aSave.Add( rSaveArr );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else // Schade, kein Layout, dann ist es eben etwas teurer...
+/*N*/ {
+/*N*/ for( aSave.SetCount( pDoc->GetSpzFrmFmts()->Count() );
+/*N*/ aSave.GetCount() ; )
+/*N*/ {
+/*N*/ SwFrmFmt* pFrmFmt = (*pDoc->GetSpzFrmFmts())[
+/*N*/ aSave.DecCount() ];
+/*N*/ if ( RES_FLYFRMFMT != pFrmFmt->Which() &&
+/*N*/ RES_DRAWFRMFMT != pFrmFmt->Which() )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+/*N*/ if( ( FLY_AT_CNTNT == rAnchor.GetAnchorId() ||
+/*N*/ FLY_AUTO_CNTNT == rAnchor.GetAnchorId() ) &&
+/*N*/ 0 != ( pAPos = rAnchor.GetCntntAnchor()) &&
+/*N*/ nNode == pAPos->nNode.GetIndex() )
+/*N*/ {
+/*N*/ aSave.SetType( 0x2000 );
+/*N*/ aSave.SetContent( pAPos->nContent.GetIndex() );
+/*N*/ if( FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
+/*N*/ {
+/*N*/ if( nCntnt <= aSave.GetContent() )
+/*N*/ {
+/*N*/ if( SAVEFLY_SPLIT == nSaveFly )
+/*N*/ aSave.IncType(); // = 0x2001;
+/*N*/ else
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ aSave.Add( rSaveArr );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // 5. CrsrShell
+/*N*/ {
+/*N*/ SwCrsrShell* pShell = pDoc->GetEditShell();
+/*N*/ if( pShell )
+/*N*/ {
+/*N*/ aSave.SetTypeAndCount( 0x800, 0 );
+/*N*/ FOREACHSHELL_START( pShell )
+/*N*/ register SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+/*N*/ if( _pStkCrsr )
+/*N*/ do {
+/*N*/ ::binfilter::_ChkPaM( rSaveArr, nNode, nCntnt, *_pStkCrsr,
+/*N*/ aSave, FALSE );
+/*N*/ aSave.IncCount();
+/*N*/ } while ( (_pStkCrsr != 0 ) &&
+/*N*/ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+/*N*/
+/*N*/ FOREACHPAM_START( PCURSH->_GetCrsr() )
+/*N*/ ::binfilter::_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR,
+/*N*/ aSave, FALSE );
+/*N*/ aSave.IncCount();
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ FOREACHSHELL_END( pShell )
+/*N*/ }
+/*N*/ }
+/*N*/ // 6. UnoCrsr
+/*N*/ {
+/*N*/ aSave.SetTypeAndCount( 0x400, 0 );
+/*N*/ register const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
+/*N*/ for( USHORT n = 0; n < rTbl.Count(); ++n )
+/*N*/ {
+/*N*/ FOREACHPAM_START( rTbl[ n ] )
+/*N*/ ::binfilter::_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE );
+/*N*/ aSave.IncCount();
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+/*N*/ if( pUnoTblCrsr )
+/*N*/ {
+/*N*/ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+/*N*/ ::binfilter::_ChkPaM( rSaveArr, nNode, nCntnt, *PCURCRSR, aSave, FALSE );
+/*N*/ aSave.IncCount();
+/*N*/ FOREACHPAM_END()
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr,
+/*N*/ ULONG nNode, xub_StrLen nOffset, BOOL bAuto )
+/*N*/ {
+/*N*/ SwCntntNode* pCNd = pDoc->GetNodes()[ nNode ]->GetCntntNode();
+/*N*/ const SwBookmarks& rBkmks = pDoc->GetBookmarks();
+/*N*/ const SwRedlineTbl& rRedlTbl = pDoc->GetRedlineTbl();
+/*N*/ SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
+/*N*/ USHORT n = 0;
+/*N*/ while( n < rSaveArr.Count() )
+/*N*/ {
+/*N*/ _SwSaveTypeCountContent aSave( rSaveArr, n );
+/*N*/ SwPosition* pPos = 0;
+/*N*/ switch( aSave.GetType() )
+/*N*/ {
+/*N*/ case 0x8000:
+/*N*/ pPos = (SwPosition*)&rBkmks[ aSave.GetCount() ]->GetPos();
+/*N*/ break;
+/*N*/ case 0x8001:
+/*N*/ pPos = (SwPosition*)rBkmks[ aSave.GetCount() ]->GetOtherPos();
+/*N*/ break;
+/*N*/ case 0x1001:
+/*N*/ pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetPoint();
+/*N*/ break;
+/*N*/ case 0x1000:
+/*N*/ pPos = (SwPosition*)rRedlTbl[ aSave.GetCount() ]->GetMark();
+/*N*/ break;
+/*N*/ case 0x2000:
+/*N*/ {
+/*N*/ SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ];
+/*N*/ const SwFmtAnchor& rFlyAnchor = pFrmFmt->GetAnchor();
+/*N*/ if( rFlyAnchor.GetCntntAnchor() )
+/*N*/ {
+/*N*/ SwFmtAnchor aNew( rFlyAnchor );
+/*N*/ SwPosition aNewPos( *rFlyAnchor.GetCntntAnchor() );
+/*N*/ aNewPos.nNode = *pCNd;
+/*N*/ if( FLY_AUTO_CNTNT == rFlyAnchor.GetAnchorId() )
+/*N*/ aNewPos.nContent.Assign( pCNd,
+/*N*/ aSave.GetContent() + nOffset );
+/*N*/ else
+/*N*/ aNewPos.nContent.Assign( 0, 0 );
+/*N*/ aNew.SetAnchor( &aNewPos );
+/*N*/ pFrmFmt->SetAttr( aNew );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case 0x2001:
+/*N*/ if( bAuto )
+/*N*/ {
+/*N*/ SwFrmFmt *pFrmFmt = (*pSpz)[ aSave.GetCount() ];
+/*N*/ SfxPoolItem *pAnchor = (SfxPoolItem*)&pFrmFmt->GetAnchor();
+/*N*/ pFrmFmt->SwModify::Modify( pAnchor, pAnchor );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case 0x0800:
+/*N*/ case 0x0801:
+/*N*/ {
+/*N*/ USHORT nCnt = 0;
+/*N*/ SwCrsrShell* pShell = pDoc->GetEditShell();
+/*N*/ if( pShell )
+/*N*/ {
+/*N*/ FOREACHSHELL_START( pShell )
+/*N*/ register SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+/*N*/ if( _pStkCrsr )
+/*N*/ do {
+/*N*/ if( aSave.GetCount() == nCnt )
+/*N*/ {
+/*N*/ pPos = &_pStkCrsr->GetBound( 0x0800 ==
+/*N*/ aSave.GetType() );
+/*N*/ break;
+/*N*/ }
+/*N*/ ++nCnt;
+/*N*/ } while ( (_pStkCrsr != 0 ) &&
+/*N*/ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+/*N*/
+/*N*/ if( pPos )
+/*N*/ break;
+/*N*/
+/*N*/ FOREACHPAM_START( PCURSH->_GetCrsr() )
+/*N*/ if( aSave.GetCount() == nCnt )
+/*N*/ {
+/*N*/ pPos = &PCURCRSR->GetBound( 0x0800 ==
+/*N*/ aSave.GetType() );
+/*N*/ break;
+/*N*/ }
+/*N*/ ++nCnt;
+/*N*/ FOREACHPAM_END()
+/*N*/ if( pPos )
+/*N*/ break;
+/*N*/
+/*N*/ FOREACHSHELL_END( pShell )
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case 0x0400:
+/*N*/ case 0x0401:
+/*N*/ {
+/*N*/ USHORT nCnt = 0;
+/*N*/ register const SwUnoCrsrTbl& rTbl = pDoc->GetUnoCrsrTbl();
+/*N*/ for( USHORT i = 0; i < rTbl.Count(); ++i )
+/*N*/ {
+/*N*/ FOREACHPAM_START( rTbl[ i ] )
+/*N*/ if( aSave.GetCount() == nCnt )
+/*N*/ {
+/*N*/ pPos = &PCURCRSR->GetBound( 0x0400 ==
+/*N*/ aSave.GetType() );
+/*N*/ break;
+/*N*/ }
+/*N*/ ++nCnt;
+/*N*/ FOREACHPAM_END()
+/*N*/ if( pPos )
+/*N*/ break;
+/*N*/
+/*N*/ SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ i ];
+/*N*/ if( pUnoTblCrsr )
+/*N*/ {
+/*N*/ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+/*N*/ if( aSave.GetCount() == nCnt )
+/*N*/ {
+/*N*/ pPos = &PCURCRSR->GetBound( 0x0400 ==
+/*N*/ aSave.GetType() );
+/*N*/ break;
+/*N*/ }
+/*N*/ ++nCnt;
+/*N*/ FOREACHPAM_END()
+/*N*/ }
+/*N*/ if( pPos )
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pPos )
+/*N*/ {
+/*N*/ pPos->nNode = *pCNd;
+/*N*/ pPos->nContent.Assign( pCNd, aSave.GetContent() + nOffset );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docchart.cxx b/binfilter/bf_sw/source/core/doc/sw_docchart.cxx
new file mode 100644
index 000000000000..c8ce01da5a0f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docchart.cxx
@@ -0,0 +1,355 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <float.h>
+
+
+#include <bf_sch/schdll.hxx>
+#include <bf_sch/memchrt.hxx>
+#include <vcl/window.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndindex.hxx>
+#include <ndtxt.hxx>
+#include <calc.hxx>
+#include <viewsh.hxx>
+#include <ndole.hxx>
+#include <cntfrm.hxx>
+#include <swtblfmt.hxx>
+#include <tblsel.hxx>
+#include <cellatr.hxx>
+namespace binfilter {
+
+
+/*N*/ SchMemChart *SwTable::UpdateData( SchMemChart* pData,
+/*N*/ const String* pSelection ) const
+/*N*/ {
+/*N*/ SwCalc aCalc( *GetFrmFmt()->GetDoc() );
+/*N*/ SwTblCalcPara aCalcPara( aCalc, *this );
+/*N*/ String sSelection, sRowColInfo;
+/*N*/ BOOL bSetChartRange = TRUE;
+/*N*/
+/*N*/ // worauf bezieht sich das Chart?
+/*N*/ if( pData && pData->SomeData1().Len() )
+/*N*/ {
+/*?*/ sSelection = pData->SomeData1();
+/*?*/ sRowColInfo = pData->SomeData2();
+/*N*/ }
+/*N*/ else if( pData && pData->GetChartRange().maRanges.size() )
+/*N*/ {
+/*?*/ SchDLL::ConvertChartRangeForWriter( *pData, FALSE );
+/*?*/ sSelection = pData->SomeData1();
+/*?*/ sRowColInfo = pData->SomeData2();
+/*?*/ bSetChartRange = FALSE;
+/*N*/ }
+/*N*/ else if( pSelection )
+/*N*/ {
+/*?*/ sSelection = *pSelection;
+/*?*/ sRowColInfo.AssignAscii( RTL_CONSTASCII_STRINGPARAM("11") );
+/*N*/ }
+/*N*/
+/*N*/ SwChartLines aLines;
+/*N*/ if( !IsTblComplexForChart( sSelection, &aLines ))
+/*N*/ {
+/*N*/ USHORT nLines = aLines.Count(), nBoxes = aLines[0]->Count();
+/*N*/
+/*N*/ if( !pData )
+/*N*/ {
+/*N*/ //JP 08.02.99: als default wird mit Spalten/Zeilenueberschrift
+/*N*/ // eingefuegt, deshalb das -1
+/*?*/ pData = SchDLL::NewMemChart( nBoxes-1, nLines-1 );
+/*?*/ pData->SetSubTitle( aEmptyStr );
+/*?*/ pData->SetXAxisTitle( aEmptyStr );
+/*?*/ pData->SetYAxisTitle( aEmptyStr );
+/*?*/ pData->SetZAxisTitle( aEmptyStr );
+/*N*/ }
+/*N*/
+/*N*/ USHORT nRowStt = 0, nColStt = 0;
+/*N*/ if( sRowColInfo.Len() )
+/*N*/ {
+/*?*/ if( '1' == sRowColInfo.GetChar( 0 ))
+/*?*/ ++nRowStt;
+/*?*/ if( '1' == sRowColInfo.GetChar( 1 ))
+/*?*/ ++nColStt;
+/*N*/ }
+/*N*/
+/*N*/ if( (nBoxes - nColStt) > pData->GetColCount() )
+/*N*/ SchDLL::MemChartInsertCols( *pData, 0, (nBoxes - nColStt) - pData->GetColCount() );
+/*N*/ else if( (nBoxes - nColStt) < pData->GetColCount() )
+/*?*/ SchDLL::MemChartRemoveCols( *pData, 0, pData->GetColCount() - (nBoxes - nColStt) );
+/*N*/
+/*N*/ if( (nLines - nRowStt) > pData->GetRowCount() )
+/*N*/ SchDLL::MemChartInsertRows( *pData, 0, (nLines - nRowStt) - pData->GetRowCount() );
+/*N*/ else if( (nLines - nRowStt) < pData->GetRowCount() )
+/*?*/ SchDLL::MemChartRemoveRows( *pData, 0, pData->GetRowCount() - (nLines - nRowStt) );
+/*N*/
+/*N*/
+/*N*/ ASSERT( pData->GetRowCount() >= (nLines - nRowStt ) &&
+/*N*/ pData->GetColCount() >= (nBoxes - nColStt ),
+/*N*/ "Die Struktur fuers Chart ist zu klein,\n"
+/*N*/ "es wird irgendwo in den Speicher geschrieben!" );
+/*N*/
+/*N*/ // Row-Texte setzen
+/*N*/ USHORT n;
+/*N*/ if( nRowStt )
+/*?*/ for( n = nColStt; n < nBoxes; ++n )
+/*?*/ {
+/*?*/ const SwTableBox *pBox = (*aLines[ 0 ])[ n ];
+/*?*/ ASSERT( pBox->GetSttNd(), "Box without SttIdx" );
+/*?*/ SwNodeIndex aIdx( *pBox->GetSttNd(), 1 );
+/*?*/ const SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode();
+/*?*/ if( !pTNd )
+/*?*/ pTNd = aIdx.GetNodes().GoNextSection( &aIdx, TRUE, FALSE )
+/*?*/ ->GetTxtNode();
+/*?*/
+/*?*/ pData->SetColText( n - nColStt, pTNd->GetExpandTxt() );
+/*?*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ String aText;
+/*N*/ for( n = nColStt; n < nBoxes; ++n )
+/*N*/ {
+/*N*/ SchDLL::GetDefaultForColumnText( *pData, n - nColStt, aText );
+/*N*/ pData->SetColText( n - nColStt, aText );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Col-Texte setzen
+/*N*/ if( nColStt )
+/*N*/ for( n = nRowStt; n < nLines; ++n )
+/*N*/ {
+/*N*/ const SwTableBox *pBox = (*aLines[ n ])[ 0 ];
+/*N*/ ASSERT( pBox->GetSttNd(), "Box without SttIdx" );
+/*N*/ SwNodeIndex aIdx( *pBox->GetSttNd(), 1 );
+/*N*/ const SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode();
+/*N*/ if( !pTNd )
+/*N*/ pTNd = aIdx.GetNodes().GoNextSection( &aIdx, TRUE, FALSE )
+/*N*/ ->GetTxtNode();
+/*N*/
+/*N*/ pData->SetRowText( n - nRowStt, pTNd->GetExpandTxt() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ String aText;
+/*N*/ for( n = nRowStt; n < nLines; ++n )
+/*N*/ {
+/*N*/ SchDLL::GetDefaultForRowText( *pData, n - nRowStt, aText );
+/*N*/ pData->SetRowText( n - nRowStt, aText );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // und dann fehlen nur noch die Daten
+/*N*/ const SwTblBoxNumFormat& rDfltNumFmt = *(SwTblBoxNumFormat*)
+/*N*/ GetDfltAttr( RES_BOXATR_FORMAT );
+/*N*/ pData->SetNumberFormatter( GetFrmFmt()->GetDoc()->GetNumberFormatter());
+/*N*/
+/*N*/ int bFirstRow = TRUE;
+/*N*/ for( n = nRowStt; n < nLines; ++n )
+/*N*/ {
+/*N*/ for( USHORT i = nColStt; i < nBoxes; ++i )
+/*N*/ {
+/*N*/ const SwTableBox* pBox = (*aLines[ n ])[ i ];
+/*N*/ ASSERT( pBox->GetSttNd(), "Box without SttIdx" );
+/*N*/ SwNodeIndex aIdx( *pBox->GetSttNd(), 1 );
+/*N*/ const SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode();
+/*N*/ if( !pTNd )
+/*?*/ pTNd = aIdx.GetNodes().GoNextSection( &aIdx, TRUE, FALSE )
+/*?*/ ->GetTxtNode();
+/*N*/
+/*N*/ pData->SetData( short( i - nColStt ),
+/*N*/ short( n - nRowStt ),
+/*N*/ pTNd->GetTxt().Len()
+/*N*/ ? pBox->GetValue( aCalcPara )
+/*N*/ : DBL_MIN );
+/*N*/
+/*N*/ if( i == nColStt || bFirstRow )
+/*N*/ {
+/*N*/ // first box of row set the numberformat
+/*N*/ const SwTblBoxNumFormat& rNumFmt = pBox->GetFrmFmt()->
+/*N*/ GetTblBoxNumFmt();
+/*N*/ if( rNumFmt != rDfltNumFmt )
+/*N*/ {
+/*?*/ pData->SetNumFormatIdCol( i, rNumFmt.GetValue() );
+/*?*/ if( bFirstRow )
+/*?*/ pData->SetNumFormatIdRow( n, rNumFmt.GetValue() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ bFirstRow = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pData )
+/*N*/ {
+/*?*/ if( pData->GetColCount() )
+/*?*/ SchDLL::MemChartRemoveCols( *pData, 0, pData->GetColCount() );
+/*?*/ if( pData->GetRowCount() )
+/*?*/ SchDLL::MemChartRemoveRows( *pData, 0, pData->GetRowCount() );
+/*N*/ }
+/*N*/ else
+/*?*/ bSetChartRange = FALSE;
+/*N*/
+/*N*/ if( bSetChartRange )
+/*N*/ {
+/*N*/ // convert the selection string to the SchartRanges
+/*N*/ pData->SomeData1() = sSelection;
+/*N*/ pData->SomeData2() = sRowColInfo;
+/*N*/ SchDLL::ConvertChartRangeForWriter( *pData, TRUE );
+/*N*/ }
+/*N*/
+/*N*/ return pData;
+/*N*/ }
+
+/*N*/ BOOL SwTable::IsTblComplexForChart( const String& rSelection,
+/*N*/ SwChartLines* pGetCLines ) const
+/*N*/ {
+/*N*/ const SwTableBox* pSttBox, *pEndBox;
+/*N*/ if( 2 < rSelection.Len() )
+/*N*/ {
+/*N*/ // spitze Klammern am Anfang & Ende enfernen
+/*?*/ String sBox( rSelection );
+/*?*/ if( '<' == sBox.GetChar( 0 ) ) sBox.Erase( 0, 1 );
+/*?*/ if( '>' == sBox.GetChar( sBox.Len()-1 ) ) sBox.Erase( sBox.Len()-1 );
+/*?*/
+/*?*/ xub_StrLen nTrenner = sBox.Search( ':' );
+/*?*/ ASSERT( STRING_NOTFOUND != nTrenner, "keine gueltige Selektion" );
+/*?*/
+/*?*/ pSttBox = GetTblBox( sBox.Copy( 0, nTrenner ));
+/*?*/ pEndBox = GetTblBox( sBox.Copy( nTrenner+1 ));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwTableLines* pLns = &GetTabLines();
+/*N*/ pSttBox = (*pLns)[ 0 ]->GetTabBoxes()[ 0 ];
+/*N*/ while( !pSttBox->GetSttNd() )
+/*N*/ // bis zur Content Box!
+/*?*/ pSttBox = pSttBox->GetTabLines()[ 0 ]->GetTabBoxes()[ 0 ];
+/*N*/
+/*N*/ const SwTableBoxes* pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes();
+/*N*/ pEndBox = (*pBoxes)[ pBoxes->Count()-1 ];
+/*N*/ while( !pEndBox->GetSttNd() )
+/*N*/ {
+/*N*/ // bis zur Content Box!
+/*?*/ pLns = &pEndBox->GetTabLines();
+/*?*/ pBoxes = &(*pLns)[ pLns->Count()-1 ]->GetTabBoxes();
+/*?*/ pEndBox = (*pBoxes)[ pBoxes->Count()-1 ];
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return !pSttBox || !pEndBox || !::binfilter::ChkChartSel( *pSttBox->GetSttNd(),
+/*N*/ *pEndBox->GetSttNd(), pGetCLines );
+/*N*/ }
+
+
+
+/*N*/ IMPL_LINK( SwDoc, DoUpdateAllCharts, Timer *, pTimer )
+/*N*/ {
+/*N*/ ViewShell* pVSh;
+/*N*/ GetEditShell( &pVSh );
+/*N*/ if( pVSh )
+/*N*/ {
+/*N*/ const SwFrmFmts& rTblFmts = *GetTblFrmFmts();
+/*N*/ for( USHORT n = 0; n < rTblFmts.Count(); ++n )
+/*N*/ {
+/*N*/ SwTable* pTmpTbl;
+/*N*/ const SwTableNode* pTblNd;
+/*N*/ SwFrmFmt* pFmt = rTblFmts[ n ];
+/*N*/
+/*N*/ if( 0 != ( pTmpTbl = SwTable::FindTable( pFmt ) ) &&
+/*N*/ 0 != ( pTblNd = pTmpTbl->GetTableNode() ) &&
+/*N*/ pTblNd->GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ _UpdateCharts( *pTmpTbl, *pVSh );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ void SwDoc::_UpdateCharts( const SwTable& rTbl, ViewShell& rVSh ) const
+/*N*/ {
+/*N*/ String aName( rTbl.GetFrmFmt()->GetName() );
+/*N*/ SwOLENode *pONd;
+/*N*/ SwStartNode *pStNd;
+/*N*/ SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+/*N*/ while( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+/*N*/ {
+/*N*/ aIdx++;
+/*N*/ SwFrm* pFrm;
+/*N*/ if( 0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
+/*N*/ aName.Equals( pONd->GetChartTblName() ) &&
+/*N*/ 0 != ( pFrm = pONd->GetFrm() ) )
+/*N*/ {
+/*N*/ SwOLEObj& rOObj = pONd->GetOLEObj();
+/*N*/
+/*N*/ SchMemChart *pData = SchDLL::GetChartData( rOObj.GetOleRef() );
+/*N*/ FASTBOOL bDelData = 0 == pData;
+/*N*/
+/*N*/ ASSERT( pData, "UpdateChart ohne irgendwelche Daten?" );
+/*N*/ pData = rTbl.UpdateData( pData );
+/*N*/
+/*N*/ if( pData->GetColCount() && pData->GetRowCount() )
+/*N*/ {
+/*N*/ SchDLL::Update( rOObj.GetOleRef(), pData, rVSh.GetWin() );
+/*N*/
+/*N*/ SwClientIter aIter( *pONd );
+/*N*/ for( pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) ); pFrm;
+/*N*/ pFrm = (SwFrm*)aIter.Next() )
+/*N*/ {
+/*N*/ if( pFrm->Frm().HasArea() )
+/*N*/ rVSh.InvalidateWindows( pFrm->Frm() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bDelData )
+/*?*/ delete pData;
+/*N*/ }
+/*N*/ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const String &rNewName )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const String aOldName( rTblFmt.GetName() );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_doccorr.cxx b/binfilter/bf_sw/source/core/doc/sw_doccorr.cxx
new file mode 100644
index 000000000000..ff0e123afb75
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_doccorr.cxx
@@ -0,0 +1,505 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <viscrs.hxx>
+#include <editsh.hxx>
+#include <bookmrk.hxx>
+#include <mvsave.hxx>
+#include <docary.hxx>
+#include <unocrsr.hxx>
+
+
+
+
+#include <hints.hxx>
+namespace binfilter {
+
+/* */
+
+/*
+ * MACROS um ueber alle CrsrShells zu iterieren
+ */
+#define PCURSH ((SwCrsrShell*)_pStartShell)
+#define FOREACHSHELL_START( pEShell ) \
+ {\
+ register ViewShell *_pStartShell = pEShell; \
+ do { \
+ if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) \
+ {
+
+#define FOREACHSHELL_END( pEShell ) \
+ } \
+ } while((_pStartShell=(ViewShell*)_pStartShell->GetNext())!= pEShell ); \
+ }
+
+#define PCURCRSR (_pCurrCrsr)
+#define FOREACHPAM_START(pSttCrsr) \
+ {\
+ SwPaM *_pStartCrsr = pSttCrsr, *_pCurrCrsr = pSttCrsr; \
+ do {
+
+#define FOREACHPAM_END() \
+ } while( (_pCurrCrsr=(SwPaM *)_pCurrCrsr->GetNext()) != _pStartCrsr ); \
+ }
+
+/* */
+
+#define _PaMCorrAbs1( pPam ) \
+ for( int nb = 0; nb < 2; ++nb ) \
+ if( &((pPam)->GetBound( BOOL(nb) ).nNode.GetNode()) == pOldNode ) \
+ { \
+ (pPam)->GetBound( BOOL(nb) ) = aNewPos; \
+ (pPam)->GetBound( BOOL(nb) ).nContent += nOffset; \
+ }
+
+
+
+/*N*/ void PaMCorrAbs( const SwNodeIndex &rOldNode,
+/*N*/ const SwPosition &rNewPos,
+/*N*/ const xub_StrLen nOffset)
+/*N*/ {
+/*N*/ const SwNode* pOldNode = &rOldNode.GetNode();
+/*N*/ const SwPosition aNewPos( rNewPos );
+/*N*/ const SwDoc* pDoc = pOldNode->GetDoc();
+/*N*/ SwCrsrShell* pShell = pDoc->GetEditShell();
+/*N*/
+/*N*/ if( pShell )
+/*N*/ {
+/*N*/ FOREACHSHELL_START( pShell )
+/*N*/ register SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+/*N*/ // Alle ueberfluessigen Crsr sind vom Stack, oder ??
+/*N*/ // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" );
+/*N*/ if( _pStkCrsr )
+/*?*/ do {
+/*?*/ _PaMCorrAbs1( _pStkCrsr )
+/*?*/ } while ( (_pStkCrsr != 0 ) &&
+/*?*/ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+/*?*/
+/*N*/ FOREACHPAM_START( PCURSH->_GetCrsr() )
+/*N*/ _PaMCorrAbs1( PCURCRSR )
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ if( PCURSH->IsTableMode() )
+/*N*/ _PaMCorrAbs1( PCURSH->GetTblCrs() )
+/*N*/
+/*N*/ FOREACHSHELL_END( pShell )
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ register SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
+/*N*/ for( USHORT n = 0; n < rTbl.Count(); ++n )
+/*N*/ {
+/*N*/ FOREACHPAM_START( rTbl[ n ] )
+/*N*/ _PaMCorrAbs1( PCURCRSR )
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+/*N*/ if( pUnoTblCrsr )
+/*N*/ {
+/*?*/ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+/*?*/ _PaMCorrAbs1( PCURCRSR )
+/*?*/ FOREACHPAM_END()
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void SwDoc::CorrAbs( const SwNodeIndex& rOldNode,
+/*N*/ const SwPosition& rNewPos,
+/*N*/ const xub_StrLen nOffset,
+/*N*/ BOOL bMoveCrsr )
+/*N*/ {
+/*N*/ const SwNode* pOldNode = &rOldNode.GetNode();
+/*N*/ SwPosition aNewPos( rNewPos );
+/*N*/
+/*N*/ { // erstmal die Bookmark korrigieren
+/*N*/ register SwBookmarks& rBkmks = *pBookmarkTbl;
+/*N*/ register SwBookmark* pBkmk;
+/*N*/ for( USHORT n = 0; n < rBkmks.Count(); ++n )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // liegt auf der Position ??
+/*N*/ }
+/*N*/ }
+/*N*/ { // dann die Redlines korrigieren
+/*N*/ register SwRedlineTbl& rTbl = *pRedlineTbl;
+/*N*/ for( USHORT n = 0; n < rTbl.Count(); ++n )
+/*N*/ {
+/*?*/ // liegt auf der Position ??
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 _PaMCorrAbs1( rTbl[ n ] )
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bMoveCrsr )
+/*N*/ ::binfilter::PaMCorrAbs( rOldNode, rNewPos, nOffset );
+/*N*/ }
+
+/* */
+
+/*N*/ bool _PaMCorrAbs2( SwPaM* pPam,
+/*N*/ const SwPosition& rNewPos,
+/*N*/ ULONG nSttNode, ULONG nEndNode )
+/*N*/ {
+/*N*/ bool bRet = false;
+/*N*/
+/*N*/ for( int nb = 0; nb < 2; ++nb ) \
+/*N*/ if( (pPam)->GetBound( BOOL(nb) ).nNode >= nSttNode &&
+/*N*/ (pPam)->GetBound( BOOL(nb) ).nNode <= nEndNode )
+/*N*/ {
+/*N*/ (pPam)->GetBound( BOOL(nb) ) = rNewPos;
+/*N*/ bRet = true;
+/*N*/ }
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+// find the relevant section in which the SwUnoCrsr may wander. returns NULL if
+// no restrictions apply
+/*N*/ const SwStartNode* lcl_FindUnoCrsrSection( const SwNode& rNode )
+/*N*/ {
+/*N*/ const SwStartNode* pStartNode = rNode.StartOfSectionNode();
+/*N*/ while( ( pStartNode != NULL ) &&
+/*N*/ ( pStartNode->StartOfSectionNode() != pStartNode ) &&
+/*N*/ ( pStartNode->GetStartNodeType() == SwNormalStartNode ) )
+/*N*/ pStartNode = pStartNode->StartOfSectionNode();
+/*N*/
+/*N*/ return pStartNode;
+/*N*/ }
+
+/*N*/ void PaMCorrAbs( const SwNodeIndex &rStartNode,
+/*N*/ const SwNodeIndex &rEndNode,
+/*N*/ const SwPosition &rNewPos )
+/*N*/ {
+/*N*/ const ULONG nSttNode = rStartNode.GetIndex();
+/*N*/ const ULONG nEndNode = rEndNode.GetIndex();
+/*N*/ const SwPosition aNewPos( rNewPos );
+/*N*/ SwDoc* pDoc = rStartNode.GetNode().GetDoc();
+/*N*/
+/*N*/ SwCrsrShell* pShell = pDoc->GetEditShell();
+/*N*/ if( pShell )
+/*N*/ {
+/*N*/ FOREACHSHELL_START( pShell )
+/*N*/ register SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+/*N*/ // Alle ueberfluessigen Crsr sind vom Stack, oder ??
+/*N*/ // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" );
+/*N*/ if( _pStkCrsr )
+/*N*/ do {
+/*N*/ _PaMCorrAbs2( _pStkCrsr, aNewPos, nSttNode, nEndNode );
+/*N*/ } while ( (_pStkCrsr != 0 ) &&
+/*N*/ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+/*N*/
+/*N*/ FOREACHPAM_START( PCURSH->_GetCrsr() )
+/*N*/ _PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode );
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ if( PCURSH->IsTableMode() )
+/*N*/ _PaMCorrAbs2( PCURSH->GetTblCrs(), aNewPos, nSttNode, nEndNode );
+/*N*/
+/*N*/ FOREACHSHELL_END( pShell )
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ register SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
+/*N*/ for( USHORT n = 0; n < rTbl.Count(); ++n )
+/*N*/ {
+/*N*/ bool bChange = false;
+/*N*/
+/*N*/ SwUnoCrsr* pUnoCursor = rTbl[ n ];
+/*N*/
+/*N*/ // determine whether the UNO cursor will leave it's designated
+/*N*/ // section
+/*N*/ bool bLeaveSection =
+/*N*/ pUnoCursor->IsRemainInSection() &&
+/*N*/ ( lcl_FindUnoCrsrSection( aNewPos.nNode.GetNode() ) !=
+/*N*/ lcl_FindUnoCrsrSection(
+/*N*/ pUnoCursor->GetPoint()->nNode.GetNode() ) );
+/*N*/
+/*N*/ FOREACHPAM_START( pUnoCursor )
+/*N*/ bChange |= _PaMCorrAbs2(PCURCRSR, aNewPos, nSttNode, nEndNode);
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*pUnoCursor;
+/*N*/ if( pUnoTblCrsr )
+/*N*/ {
+/*?*/ FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+/*?*/ bChange |=
+/*?*/ _PaMCorrAbs2( PCURCRSR, aNewPos, nSttNode, nEndNode );
+/*?*/ FOREACHPAM_END()
+/*N*/ }
+/*N*/
+/*N*/ // if a UNO cursor leaves its designated section, we must inform
+/*N*/ // (and invalidate) said cursor
+/*N*/ if( bChange && bLeaveSection )
+/*N*/ {
+/*N*/ // the UNO cursor has left its section. We need to notify it!
+/*?*/ SwMsgPoolItem aHint( RES_UNOCURSOR_LEAVES_SECTION );
+/*?*/ pUnoCursor->Modify( &aHint, NULL );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void SwDoc::CorrAbs( const SwNodeIndex& rStartNode,
+/*N*/ const SwNodeIndex& rEndNode,
+/*N*/ const SwPosition& rNewPos,
+/*N*/ BOOL bMoveCrsr )
+/*N*/ {
+/*N*/ const ULONG nSttNode = rStartNode.GetIndex();
+/*N*/ const ULONG nEndNode = rEndNode.GetIndex();
+/*N*/ SwPosition aNewPos( rNewPos );
+/*N*/
+/*N*/ // if( !DoesUndo() )
+/*N*/ // erstmal die Bookmarks/Redlines korrigieren
+/*N*/ _DelBookmarks( rStartNode, rEndNode );
+/*N*/
+/*N*/ if( bMoveCrsr )
+/*N*/ ::binfilter::PaMCorrAbs( rStartNode, rEndNode, rNewPos );
+/*N*/ }
+
+
+/* */
+
+#define _PaMCorrAbs3( pPam ) \
+ for( int nb = 0; nb < 2; ++nb ) \
+ if( aStart <= (pPam)->GetBound( BOOL(nb) ) && \
+ (pPam)->GetBound( BOOL(nb) ) <= aEnd ) \
+ (pPam)->GetBound( BOOL(nb) ) = aNewPos;
+
+/*N*/ void PaMCorrAbs( const SwPaM& rRange,
+/*N*/ const SwPosition& rNewPos )
+/*N*/ {
+/*N*/ SwPosition aStart( *rRange.Start() );
+/*N*/ SwPosition aEnd( *rRange.End() );
+/*N*/ SwPosition aNewPos( rNewPos );
+/*N*/ SwDoc* pDoc = aStart.nNode.GetNode().GetDoc();
+/*N*/ SwCrsrShell* pShell = pDoc->GetEditShell();
+/*N*/
+/*N*/ if( pShell )
+/*N*/ {
+/*N*/ FOREACHSHELL_START( pShell )
+/*N*/ register SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+/*N*/ // Alle ueberfluessigen Crsr sind vom Stack, oder ??
+/*N*/ // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" );
+/*N*/ if( _pStkCrsr )
+/*N*/ do {
+/*?*/ _PaMCorrAbs3( _pStkCrsr )
+/*?*/ } while ( (_pStkCrsr != 0 ) &&
+/*?*/ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+/*N*/
+/*N*/ FOREACHPAM_START( PCURSH->_GetCrsr() )
+/*N*/ _PaMCorrAbs3( PCURCRSR )
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ if( PCURSH->IsTableMode() )
+/*?*/ _PaMCorrAbs3( PCURSH->GetTblCrs() )
+/*N*/
+/*N*/ FOREACHSHELL_END( pShell )
+/*N*/ }
+/*N*/ {
+/*N*/ register SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
+/*N*/ for( USHORT n = 0; n < rTbl.Count(); ++n )
+/*N*/ {
+/*N*/ FOREACHPAM_START( rTbl[ n ] )
+/*N*/ _PaMCorrAbs3( PCURCRSR )
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+/*N*/ if( pUnoTblCrsr )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+
+/* */
+
+#define _PaMCorrRel1( pPam ) \
+ for( int nb = 0; nb < 2; ++nb ) \
+ if( &((pPam)->GetBound( BOOL(nb) ).nNode.GetNode()) == pOldNode ) \
+ { \
+ (pPam)->GetBound( BOOL(nb) ).nNode = aNewPos.nNode; \
+ (pPam)->GetBound( BOOL(nb) ).nContent.Assign( (SwIndexReg*) \
+ aNewPos.nContent.GetIdxReg(), \
+ nCntIdx + (pPam)->GetBound( BOOL(nb) ).nContent. \
+ GetIndex() ); \
+ }
+
+
+
+/*N*/ void PaMCorrRel( const SwNodeIndex &rOldNode,
+/*N*/ const SwPosition &rNewPos,
+/*N*/ const xub_StrLen nOffset )
+/*N*/ {
+/*N*/ const SwNode* pOldNode = &rOldNode.GetNode();
+/*N*/ SwPosition aNewPos( rNewPos );
+/*N*/ const SwDoc* pDoc = pOldNode->GetDoc();
+/*N*/
+/*N*/ xub_StrLen nCntIdx = rNewPos.nContent.GetIndex() + nOffset;
+/*N*/
+/*N*/ SwCrsrShell* pShell = pDoc->GetEditShell();
+/*N*/ if( pShell )
+/*N*/ {
+/*N*/ FOREACHSHELL_START( pShell )
+/*N*/ register SwPaM *_pStkCrsr = PCURSH->GetStkCrsr();
+/*N*/ // Alle ueberfluessigen Crsr sind vom Stack, oder ??
+/*N*/ // ASSERT( !_pStkCrsr, "Es stehen noch Crsr auf dem CrsrStack" );
+/*N*/ if( _pStkCrsr )
+/*N*/ do {
+/*?*/ _PaMCorrRel1( _pStkCrsr )
+/*?*/ } while ( (_pStkCrsr != 0 ) &&
+/*?*/ ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) );
+/*N*/
+/*N*/ FOREACHPAM_START( PCURSH->_GetCrsr() )
+/*N*/ _PaMCorrRel1( PCURCRSR )
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ if( PCURSH->IsTableMode() )
+/*?*/ _PaMCorrRel1( PCURSH->GetTblCrs() )
+/*N*/
+/*N*/ FOREACHSHELL_END( pShell )
+/*N*/ }
+/*N*/ {
+/*N*/ register SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
+/*N*/ for( USHORT n = 0; n < rTbl.Count(); ++n )
+/*N*/ {
+/*N*/ FOREACHPAM_START( rTbl[ n ] )
+/*N*/ _PaMCorrRel1( PCURCRSR )
+/*N*/ FOREACHPAM_END()
+/*N*/
+/*N*/ SwUnoTableCrsr* pUnoTblCrsr = (SwUnoTableCrsr*)*rTbl[ n ];
+/*N*/ if( pUnoTblCrsr )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::CorrRel( const SwNodeIndex& rOldNode,
+/*N*/ const SwPosition& rNewPos,
+/*N*/ const xub_StrLen nOffset,
+/*N*/ BOOL bMoveCrsr )
+/*N*/ {
+/*N*/ const SwNode* pOldNode = &rOldNode.GetNode();
+/*N*/ SwPosition aNewPos( rNewPos );
+/*N*/ xub_StrLen nCntIdx = aNewPos.nContent.GetIndex() + nOffset;
+/*N*/
+/*N*/ { // erstmal die Bookmark korrigieren
+/*N*/ register SwBookmarks& rBkmks = *pBookmarkTbl;
+/*N*/ register SwBookmark* pBkmk;
+/*N*/ for( USHORT n = 0; n < rBkmks.Count(); ++n )
+/*N*/ {
+/*N*/ // liegt auf der Position ??
+/*N*/ int bChgd = FALSE;
+/*N*/ if( &( pBkmk = (SwBookmark*)rBkmks[ n ])->pPos1->nNode.GetNode()
+/*N*/ == pOldNode )
+/*N*/ {
+/*?*/ pBkmk->pPos1->nNode = aNewPos.nNode;
+/*?*/ pBkmk->pPos1->nContent.Assign( (SwIndexReg*)
+/*?*/ aNewPos.nContent.GetIdxReg(),
+/*?*/ nCntIdx + pBkmk->pPos1->nContent.GetIndex() );
+/*?*/ bChgd = 1;
+/*N*/ }
+/*N*/ if( pBkmk->pPos2 && &pBkmk->pPos2->nNode.GetNode() == pOldNode )
+/*N*/ {
+/*?*/ pBkmk->pPos2->nNode = aNewPos.nNode;
+/*?*/ pBkmk->pPos2->nContent.Assign( (SwIndexReg*)
+/*?*/ aNewPos.nContent.GetIdxReg(),
+/*?*/ nCntIdx + pBkmk->pPos2->nContent.GetIndex() );
+/*?*/ bChgd = 2;
+/*N*/ }
+/*N*/ // ungueltige Selektion? Dann die Klammerung aufheben
+/*N*/ if( bChgd && pBkmk->pPos2 &&
+/*N*/ pBkmk->pPos2->nNode.GetNode().FindTableBoxStartNode() !=
+/*N*/ pBkmk->pPos1->nNode.GetNode().FindTableBoxStartNode() )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( 1 == bChgd )
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ { // dann die Redlines korrigieren
+/*N*/ register SwRedlineTbl& rTbl = *pRedlineTbl;
+/*N*/ for( USHORT n = 0; n < rTbl.Count(); ++n )
+/*N*/ {
+/*N*/ // liegt auf der Position ??
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 _PaMCorrRel1( rTbl[ n ] )
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bMoveCrsr )
+/*N*/ ::binfilter::PaMCorrRel( rOldNode, rNewPos, nOffset );
+/*N*/ }
+
+
+/* */
+
+/*N*/ SwEditShell* SwDoc::GetEditShell( ViewShell** ppSh ) const
+/*N*/ {
+/*N*/ // Layout und OLE-Shells sollten vorhanden sein!
+/*N*/ if( pLayout && pLayout->GetCurrShell() )
+/*N*/ {
+/*N*/ register ViewShell *pSh = pLayout->GetCurrShell(), *pVSh = pSh;
+/*N*/ if( ppSh )
+/*N*/ *ppSh = pSh;
+/*N*/
+/*N*/ // wir suchen uns eine EditShell, falls diese existiert
+/*N*/ do {
+/*N*/ if( pSh->IsA( TYPE( SwEditShell ) ) )
+/*N*/ return (SwEditShell*)pSh;
+/*N*/
+/*?*/ } while( pVSh != ( pSh = (ViewShell*)pSh->GetNext() ));
+/*N*/ }
+/*N*/ else if( ppSh )
+/*N*/ *ppSh = 0;
+/*N*/
+/*N*/ return 0;
+/*N*/ }
+
+// #102505# ->
+
+// <- #102505#
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docdde.cxx b/binfilter/bf_sw/source/core/doc/sw_docdde.cxx
new file mode 100644
index 000000000000..383b0121d946
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docdde.cxx
@@ -0,0 +1,244 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdlib.h>
+
+#include <tools/urlobj.hxx>
+
+#define _SVSTDARR_STRINGS
+
+#include <bf_svx/linkmgr.hxx> // LinkManager
+#include <unotools/charclass.hxx>
+
+#include <fmtcntnt.hxx>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <doc.hxx>
+#include <swserv.hxx> // fuer Server-Funktionalitaet
+#include <bookmrk.hxx> // fuer die Bookmarks
+#include <section.hxx> // fuer SwSectionFmt
+#include <swtable.hxx> // fuer SwTable
+#include <pam.hxx>
+#include <docary.hxx>
+namespace binfilter {
+
+
+struct _FindItem
+{
+ const String& rItem;
+ SwBookmark* pBkmk;
+ SwTableNode* pTblNd;
+ SwSectionNode* pSectNd;
+
+ _FindItem( const String& rS )
+ : rItem( rS ), pBkmk( 0 ), pTblNd( 0 ), pSectNd( 0 )
+ {}
+};
+
+
+/*N*/ BOOL lcl_FindBookmark( const SwBookmarkPtr& rpBkmk, void* pArgs )
+/*N*/ {
+/*N*/ BOOL bRet = TRUE; DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+/*N*/ BOOL lcl_FindSection( const SwSectionFmtPtr& rpSectFmt, void* pArgs )
+/*N*/ {
+/*N*/ SwSection* pSect = rpSectFmt->GetSection();
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ String sNm( GetAppCharClass().lower( pSect->GetName() ));
+/*N*/ if( sNm.Equals( ((_FindItem*)pArgs)->rItem ))
+/*N*/ {
+/*N*/ // gefunden, als erfrage die Daten
+/*N*/ const SwNodeIndex* pIdx;
+/*N*/ if( 0 != (pIdx = rpSectFmt->GetCntnt().GetCntntIdx() ) &&
+/*N*/ &rpSectFmt->GetDoc()->GetNodes() == &pIdx->GetNodes() )
+/*N*/ {
+/*N*/ // eine Tabelle im normalen NodesArr
+/*N*/ ((_FindItem*)pArgs)->pSectNd = pIdx->GetNode().GetSectionNode();
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ //nein!! // sollte der Namen schon passen, der Rest aber nicht, dann haben wir
+/*N*/ // sie nicht. Die Namen sind immer eindeutig.
+/*N*/ }
+/*N*/ }
+/*N*/ return TRUE; // dann weiter
+/*N*/ }
+
+
+
+/*N*/ BOOL lcl_FindTable( const SwFrmFmtPtr& rpTableFmt, void* pArgs )
+/*N*/ {
+/*N*/ String sNm( GetAppCharClass().lower( rpTableFmt->GetName() ));
+/*N*/ if( sNm.Equals( ((_FindItem*)pArgs)->rItem ))
+/*N*/ {
+/*?*/ SwTable* pTmpTbl;
+/*?*/ SwTableBox* pFBox;
+/*?*/ if( 0 != ( pTmpTbl = SwTable::FindTable( rpTableFmt ) ) &&
+/*?*/ 0 != ( pFBox = pTmpTbl->GetTabSortBoxes()[0] ) &&
+/*?*/ pFBox->GetSttNd() &&
+/*?*/ &rpTableFmt->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes() )
+/*?*/ {
+/*?*/ // eine Tabelle im normalen NodesArr
+/*?*/ ((_FindItem*)pArgs)->pTblNd = (SwTableNode*)
+/*?*/ pFBox->GetSttNd()->FindTableNode();
+/*?*/ return FALSE;
+/*?*/ }
+/*?*/ //nein! // sollte der Namen schon passen, der Rest aber nicht, dann haben wir
+/*?*/ // sie nicht. Die Namen sind immer eindeutig.
+/*?*/ }
+/*N*/ return TRUE; // dann weiter
+/*N*/ }
+
+
+
+
+
+
+
+
+
+/*N*/ ::binfilter::SvLinkSource* SwDoc::CreateLinkSource( const String& rItem )
+/*N*/ {
+/*N*/ // haben wir ueberhaupt das Item vorraetig?
+/*N*/ String sItem( GetAppCharClass().lower( rItem ));
+/*N*/ _FindItem aPara( sItem );
+/*N*/
+/*N*/ SwServerObject* pObj;
+/*N*/
+/*N*/ do { // middle check Loop
+/*N*/ ((SwBookmarks&)*pBookmarkTbl).ForEach( 0, pBookmarkTbl->Count(),
+/*N*/ lcl_FindBookmark, &aPara );
+/*N*/ if( aPara.pBkmk && aPara.pBkmk->GetOtherPos() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // gefunden, also Hotlink einrichten
+/*?*/ // sollten wir schon einer sein?
+/*N*/ }
+/*N*/
+/*N*/ ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
+/*N*/ lcl_FindSection, &aPara );
+/*N*/ if( aPara.pSectNd )
+/*N*/ {
+/*N*/ // gefunden, also Hotlink einrichten
+/*N*/ // sollten wir schon einer sein?
+/*N*/ if( 0 == (pObj = aPara.pSectNd->GetSection().GetObject()) )
+/*N*/ {
+/*N*/ pObj = new SwServerObject( *aPara.pSectNd );
+/*N*/ aPara.pSectNd->GetSection().SetRefObject( pObj );
+/*N*/ }
+/*N*/ else if( pObj->HasDataLinks() )
+/*?*/ return pObj;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ ((SwFrmFmts*)pTblFrmFmtTbl)->ForEach( 0, pTblFrmFmtTbl->Count(),
+/*N*/ lcl_FindTable, &aPara );
+/*N*/ if( aPara.pTblNd )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // gefunden, also Hotlink einrichten
+/*?*/ // sollten wir schon einer sein?
+/*?*/ }
+/*?*/ // bis hierhin, also nicht vorhanden
+/*?*/ return 0;
+/*N*/ } while( FALSE );
+/*N*/
+/*N*/ // neu angelegt also ab in die Verwaltung
+/*N*/ GetLinkManager().InsertServer( pObj );
+/*N*/ return pObj;
+/*N*/ }
+
+
+
+/*N*/ BOOL SwDoc::SelectServerObj( const String& rStr, SwPaM*& rpPam,
+/*N*/ SwNodeRange*& rpRange ) const
+/*N*/ {
+/*N*/ // haben wir ueberhaupt das Item vorraetig?
+/*N*/ rpPam = 0;
+/*N*/ rpRange = 0;
+/*N*/
+/*N*/ String sItem( INetURLObject::decode( rStr, INET_HEX_ESCAPE,
+/*N*/ INetURLObject::DECODE_WITH_CHARSET,
+/*N*/ RTL_TEXTENCODING_UTF8 ));
+/*N*/
+/*N*/ xub_StrLen nPos = sItem.Search( cMarkSeperator );
+/*N*/
+/*N*/ const CharClass& rCC = GetAppCharClass();
+/*N*/
+/*N*/ // Erweiterung fuer die Bereiche, nicht nur Bookmarks/Bereiche linken,
+/*N*/ // sondern auch Rahmen(Text!), Tabellen, Gliederungen:
+/*N*/ if( STRING_NOTFOUND != nPos )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 BOOL bWeiter = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ // alte "Mechanik"
+/*N*/ rCC.toLower( sItem );
+/*N*/ _FindItem aPara( sItem );
+/*N*/ if( pBookmarkTbl->Count() )
+/*N*/ {
+/*N*/ ((SwBookmarks&)*pBookmarkTbl).ForEach( 0, pBookmarkTbl->Count(),
+/*N*/ lcl_FindBookmark, &aPara );
+/*N*/ if( aPara.pBkmk )
+/*N*/ {
+/*?*/ // gefunden, also erzeuge einen Bereich
+/*?*/ if( aPara.pBkmk->GetOtherPos() )
+/*?*/ // ein aufgespannter Bereich
+/*?*/ rpPam = new SwPaM( aPara.pBkmk->GetPos(),
+/*?*/ *aPara.pBkmk->GetOtherPos() );
+/*?*/ return 0 != rpPam;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pSectionFmtTbl->Count() )
+/*N*/ {
+/*N*/ ((SwSectionFmts&)*pSectionFmtTbl).ForEach( 0, pSectionFmtTbl->Count(),
+/*N*/ lcl_FindSection, &aPara );
+/*N*/ if( aPara.pSectNd )
+/*N*/ {
+/*N*/ rpRange = new SwNodeRange( *aPara.pSectNd, 1,
+/*N*/ *aPara.pSectNd->EndOfSectionNode() );
+/*N*/ return TRUE;
+/*N*/
+/*N*/ }
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docdesc.cxx b/binfilter/bf_sw/source/core/doc/sw_docdesc.cxx
new file mode 100644
index 000000000000..52cf21b082a7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docdesc.cxx
@@ -0,0 +1,928 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+#include <vcl/virdev.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <bf_svx/svdmodel.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/paperinf.hxx>
+#include "bf_svx/frmdiritem.hxx"
+#include <tools/urlobj.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+#include <fmtfsize.hxx>
+#include <fmthdft.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtpdsc.hxx>
+#include <ftninfo.hxx>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+#include <viscrs.hxx>
+#include <fesh.hxx>
+#include <ndole.hxx>
+#include <mdiexp.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <pagefrm.hxx> //Fuer DelPageDesc
+#include <rootfrm.hxx> //Fuer DelPageDesc
+#include <hints.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <docsh.hxx>
+#include <ndindex.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <fntcache.hxx>
+#include <viewopt.hxx>
+#include <fldbas.hxx>
+#include <GetMetricVal.hxx>
+
+#include <statstr.hrc>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+/*N*/ void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId, SwFrmFmt &rFmt1,
+/*N*/ SwFrmFmt &rFmt2, SfxPrinter *pPrt, BOOL bCheck )
+/*N*/ {
+/*N*/ //Einstellung von Seitengroesse und Seitenraendern. Dazu wird
+/*N*/ //der Default-Printer benutzt.
+/*N*/ //Die Physikalische Seitengroesse ist die des Printers
+/*N*/ //oder DIN-A4 wenn der Printer eine Groesse von 0 liefert.
+/*N*/ //Der Seitenrand ergibt sich aus der Seitengroesse, der Output-
+/*N*/ //SSize des Printers und einem Offset der die linke obere Ecke
+/*N*/ //der Output-SSize relativ zur Physikalischen Pagesize angibt.
+/*N*/ //Wenn der Offset 0 ist, werden eingestellt.
+/*N*/ //!!!Die Seitengroesse wird hier im Attribut eingestellt,
+/*N*/ //dies wird im Ctor des SwPageFrm beachtet.
+/*N*/
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ SvxULSpaceItem aUL;
+/*N*/ SwFmtFrmSize aFrmSize( ATT_FIX_SIZE );
+/*N*/ BOOL bSetFmt1 = TRUE,
+/*N*/ bSetFmt2 = TRUE;
+/*N*/ if ( pPrt )
+/*N*/ {
+/*N*/ if ( bCheck )
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rFrmSize = rFmt1.GetFrmSize();
+/*N*/ const SwFmtFrmSize &rFrmSize2 = rFmt2.GetFrmSize();
+/*N*/ bSetFmt1 = LONG_MAX == rFrmSize.GetWidth() ||
+/*N*/ LONG_MAX == rFrmSize.GetHeight();
+/*N*/ bSetFmt2 = LONG_MAX == rFrmSize2.GetWidth() ||
+/*N*/ LONG_MAX == rFrmSize2.GetHeight();
+/*N*/ if ( !bSetFmt1 && !bSetFmt2 )
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ //Seitengrosse
+/*N*/ //fuer das Erfragen von SV, ob ein Drucker angeschlossen ist,
+/*N*/ //werden die SV'ler noch eine Methode anbieten.
+/*N*/ const Size aPhysSize( SvxPaperInfo::GetPaperSize( (Printer*)pPrt ));
+/*N*/
+/*N*/ //if ( aPhysSize.Width() <= 0 )
+/*N*/ // aPhysSize.Width() = lA4Width;
+/*N*/ //if ( aPhysSize.Height() <= 0 )
+/*N*/ // aPhysSize.Height() = lA4Height;
+/*N*/ aFrmSize.SetSize( aPhysSize );
+/*N*/
+/*N*/ //Raender
+/*N*/ Point aOffst( pPrt->GetPageOffset() );
+/*N*/ aOffst += pPrt->GetMapMode().GetOrigin();
+/*N*/
+/*N*/ //Auf Default-Raender vorbereiten.
+/*N*/ //Raender haben eine defaultmaessige Mindestgroesse.
+/*N*/ //wenn der Drucker einen groesseren Rand vorgibt, so
+/*N*/ //ist mir dass auch recht.
+/*N*/ // MIB 06/25/2002, #99397#: The HTML page desc had A4 as page size
+/*N*/ // always. This has been changed to take the page size from the printer.
+/*N*/ // Unfortunately, the margins of the HTML page desc are smaller than
+/*N*/ // the margins used here in general, so one extra case is required.
+/*N*/ // In the long term, this needs to be changed to always keep the
+/*N*/ // margins from the page desc.
+/*N*/ sal_Int32 nMinTop, nMinBottom, nMinLeft, nMinRight;
+/*N*/ if( RES_POOLPAGE_HTML == nPoolFmtId )
+/*N*/ {
+/*N*/ nMinRight = nMinTop = nMinBottom = GetMetricVal( CM_1 );
+/*N*/ nMinLeft = nMinRight * 2;
+/*N*/ }
+/*N*/ else if( MEASURE_METRIC == GetAppLocaleData().getMeasurementSystemEnum() )
+/*N*/ {
+/*N*/ nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; //2 Zentimeter
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nMinTop = nMinBottom = 1440; //al la WW: 1Inch
+/*N*/ nMinLeft = nMinRight = 1800; // 1,25 Inch
+/*N*/ }
+/*N*/
+/*N*/ //Raender einstellen.
+/*N*/ aUL.SetUpper( static_cast< sal_uInt16 >(
+/*N*/ nMinTop > aOffst.Y() ? nMinTop : aOffst.Y() ) );
+/*N*/ aUL.SetLower( static_cast< sal_uInt16 >(
+/*N*/ nMinBottom > aOffst.Y() ? nMinBottom : aOffst.Y() ));
+/*N*/ aLR.SetRight( nMinRight > aOffst.X() ? nMinRight : aOffst.X() );
+/*N*/ aLR.SetLeft( nMinLeft > aOffst.X() ? nMinLeft : aOffst.X());
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrmSize.SetWidth( LONG_MAX );
+/*N*/ aFrmSize.SetHeight( LONG_MAX );
+/*N*/ aUL.SetUpper( 0 );
+/*N*/ aUL.SetLower( 0 );
+/*N*/ aLR.SetRight( 0 );
+/*N*/ aLR.SetLeft( 0 );
+/*N*/ }
+/*N*/
+/*N*/ if ( bSetFmt1 )
+/*N*/ {
+/*N*/ rFmt1.SetAttr( aFrmSize );
+/*N*/ rFmt1.SetAttr( aLR );
+/*N*/ rFmt1.SetAttr( aUL );
+/*N*/ }
+/*N*/ if ( bSetFmt2 )
+/*N*/ {
+/*N*/ rFmt2.SetAttr( aFrmSize );
+/*N*/ rFmt2.SetAttr( aLR );
+/*N*/ rFmt2.SetAttr( aUL );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDoc::ChgPageDesc()
+|*
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung MA 01. Mar. 95
+|*
+|*************************************************************************/
+
+/*N*/ void lcl_DescSetAttr( const SwFrmFmt &rSource, SwFrmFmt &rDest,
+/*N*/ const BOOL bPage = TRUE )
+/*N*/ {
+/*N*/ /////////////// !!!!!!!!!!!!!!!!
+/*N*/ //JP 03.03.99:
+/*N*/ // eigentlich sollte hier das Intersect von ItemSet benutzt werden, aber das
+/*N*/ // funktioniert nicht richtig, wenn man unterschiedliche WhichRanges hat.
+/*N*/ /////////////// !!!!!!!!!!!!!!!!
+/*N*/ //Die interressanten Attribute uebernehmen.
+/*N*/ USHORT __READONLY_DATA aIdArr[] = { RES_FRM_SIZE, RES_UL_SPACE,
+/*N*/ RES_BACKGROUND, RES_SHADOW,
+/*N*/ RES_COL, RES_COL,
+/*N*/ RES_FRAMEDIR, RES_FRAMEDIR,
+/*N*/ RES_TEXTGRID, RES_TEXTGRID,
+/*N*/ RES_UNKNOWNATR_CONTAINER,
+/*N*/ RES_UNKNOWNATR_CONTAINER,
+/*N*/ 0 };
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ for( USHORT n = 0; aIdArr[ n ]; n += 2 )
+/*N*/ {
+/*N*/ for( USHORT nId = aIdArr[ n ]; nId <= aIdArr[ n+1]; ++nId )
+/*N*/ {
+/*N*/ if( bPage || ( RES_COL != nId && RES_PAPER_BIN != nId ))
+/*N*/ {
+/*N*/ if( SFX_ITEM_SET == rSource.GetItemState( nId, FALSE, &pItem ))
+/*N*/ rDest.SetAttr( *pItem );
+/*N*/ else
+/*N*/ rDest.ResetAttr( nId );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // auch Pool-, Hilfe-Id's uebertragen
+/*N*/ rDest.SetPoolFmtId( rSource.GetPoolFmtId() );
+/*N*/ rDest.SetPoolHelpId( rSource.GetPoolHelpId() );
+/*N*/ rDest.SetPoolHlpFileId( rSource.GetPoolHlpFileId() );
+/*N*/ }
+
+
+/*N*/ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged )
+/*N*/ {
+/*N*/ ASSERT( i < aPageDescs.Count(), "PageDescs ueberindiziert." );
+/*N*/
+/*N*/ SwPageDesc *pDesc = aPageDescs[i];
+/*N*/
+/*N*/ //Als erstes wird ggf. gespiegelt.
+/*N*/ if ( rChged.GetUseOn() == PD_MIRROR )
+/*N*/ ((SwPageDesc&)rChged).Mirror();
+/*N*/ else
+/*N*/ //sonst Werte aus Master nach Left uebertragen.
+/*N*/ ::binfilter::lcl_DescSetAttr( ((SwPageDesc&)rChged).GetMaster(),
+/*N*/ ((SwPageDesc&)rChged).GetLeft() );
+/*N*/
+/*N*/ //NumType uebernehmen.
+/*N*/ if( rChged.GetNumType().GetNumberingType() != pDesc->GetNumType().GetNumberingType() )
+/*N*/ {
+/*?*/ pDesc->SetNumType( rChged.GetNumType() );
+/*?*/ // JP 30.03.99: Bug 64121 - den Seitennummernfeldern bescheid sagen,
+/*?*/ // das sich das Num-Format geaendert hat
+/*?*/ GetSysFldType( RES_PAGENUMBERFLD )->UpdateFlds();
+/*?*/ GetSysFldType( RES_REFPAGEGETFLD )->UpdateFlds();
+/*?*/
+/*?*/ // Wenn sich die Numerierungsart geaendert hat, koennte es QuoVadis/
+/*?*/ // ErgoSum-Texte geben, die sich auf eine geaenderte Seite beziehen,
+/*?*/ // deshalb werden die Fussnoten invalidiert
+/*?*/ SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
+/*?*/ for( USHORT nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+/*?*/ {
+/*?*/ SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
+/*?*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*?*/ pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Orientierung uebernehmen
+/*N*/ pDesc->SetLandscape( rChged.GetLandscape() );
+/*N*/
+/*N*/ //Header abgleichen.
+/*N*/ const SwFmtHeader &rHead = rChged.GetMaster().GetHeader();
+/*N*/ pDesc->GetMaster().SetAttr( rHead );
+/*N*/ if ( rChged.IsHeaderShared() || !rHead.IsActive() )
+/*N*/ {
+/*N*/ //Left teilt sich den Header mit dem Master.
+/*N*/ pDesc->GetLeft().SetAttr( pDesc->GetMaster().GetHeader() );
+/*N*/ }
+/*N*/ else if ( rHead.IsActive() )
+/*N*/ { //Left bekommt einen eigenen Header verpasst wenn das Format nicht
+/*N*/ //bereits einen hat.
+/*N*/ //Wenn er bereits einen hat und dieser auf die gleiche Section
+/*N*/ //wie der Rechte zeigt, so muss er einen eigenen bekommen. Der
+/*N*/ //Inhalt wird sinnigerweise kopiert.
+/*N*/ const SwFmtHeader &rLeftHead = pDesc->GetLeft().GetHeader();
+/*N*/ if ( !rLeftHead.IsActive() )
+/*N*/ {
+/*?*/ SwFmtHeader aHead( MakeLayoutFmt( RND_STD_HEADERL ) );
+/*?*/ pDesc->GetLeft().SetAttr( aHead );
+/*?*/ //Weitere Attribute (Raender, Umrandung...) uebernehmen.
+/*?*/ ::binfilter::lcl_DescSetAttr( *rHead.GetHeaderFmt(), *aHead.GetHeaderFmt(), FALSE);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwFrmFmt *pRight = rHead.GetHeaderFmt();
+/*N*/ const SwFmtCntnt &aRCnt = pRight->GetCntnt();
+/*N*/ const SwFmtCntnt &aLCnt = rLeftHead.GetHeaderFmt()->GetCntnt();
+/*N*/ if ( (*aRCnt.GetCntntIdx()) == (*aLCnt.GetCntntIdx()) )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), "Header",
+/*N*/ GetDfltFrmFmt() );
+/*N*/ ::binfilter::lcl_DescSetAttr( *pRight, *pFmt, FALSE );
+/*N*/ //Der Bereich auf den das rechte Kopfattribut zeigt wird
+/*N*/ //kopiert und der Index auf den StartNode in das linke
+/*N*/ //Kopfattribut gehaengt.
+/*N*/ SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
+/*N*/ SwStartNode* pSttNd = GetNodes().MakeEmptySection( aTmp, SwHeaderStartNode );
+/*N*/ SwNodeRange aRange( aRCnt.GetCntntIdx()->GetNode(), 0,
+/*N*/ *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() );
+/*N*/ aTmp = *pSttNd->EndOfSectionNode();
+/*N*/ GetNodes()._Copy( aRange, aTmp, FALSE );
+/*N*/
+/*N*/ pFmt->SetAttr( SwFmtCntnt( pSttNd ) );
+/*N*/ pDesc->GetLeft().SetAttr( SwFmtHeader( pFmt ) );
+/*N*/ }
+/*N*/ else
+/*N*/ ::binfilter::lcl_DescSetAttr( *pRight,
+/*N*/ *(SwFrmFmt*)rLeftHead.GetHeaderFmt(), FALSE );
+/*N*/
+/*N*/ }
+/*N*/ }
+/*N*/ pDesc->ChgHeaderShare( rChged.IsHeaderShared() );
+/*N*/
+/*N*/ //Footer abgleichen.
+/*N*/ const SwFmtFooter &rFoot = rChged.GetMaster().GetFooter();
+/*N*/ pDesc->GetMaster().SetAttr( rFoot );
+/*N*/ if ( rChged.IsFooterShared() || !rFoot.IsActive() )
+/*N*/ //Left teilt sich den Header mit dem Master.
+/*N*/ pDesc->GetLeft().SetAttr( pDesc->GetMaster().GetFooter() );
+/*N*/ else if ( rFoot.IsActive() )
+/*N*/ { //Left bekommt einen eigenen Footer verpasst wenn das Format nicht
+/*?*/ //bereits einen hat.
+/*?*/ //Wenn er bereits einen hat und dieser auf die gleiche Section
+/*?*/ //wie der Rechte zeigt, so muss er einen eigenen bekommen. Der
+/*?*/ //Inhalt wird sinnigerweise kopiert.
+/*?*/ const SwFmtFooter &rLeftFoot = pDesc->GetLeft().GetFooter();
+/*?*/ if ( !rLeftFoot.IsActive() )
+/*?*/ {
+/*?*/ SwFmtFooter aFoot( MakeLayoutFmt( RND_STD_FOOTER ) );
+/*?*/ pDesc->GetLeft().SetAttr( aFoot );
+/*?*/ //Weitere Attribute (Raender, Umrandung...) uebernehmen.
+/*?*/ ::binfilter::lcl_DescSetAttr( *rFoot.GetFooterFmt(), *aFoot.GetFooterFmt(), FALSE);
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ const SwFrmFmt *pRight = rFoot.GetFooterFmt();
+/*?*/ const SwFmtCntnt &aRCnt = pRight->GetCntnt();
+/*?*/ const SwFmtCntnt &aLCnt = rLeftFoot.GetFooterFmt()->GetCntnt();
+/*?*/ if ( (*aRCnt.GetCntntIdx()) == (*aLCnt.GetCntntIdx()) )
+/*?*/ {
+/*?*/ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), "Footer",
+/*?*/ GetDfltFrmFmt() );
+/*?*/ ::binfilter::lcl_DescSetAttr( *pRight, *pFmt, FALSE );
+/*?*/ //Der Bereich auf den das rechte Kopfattribut zeigt wird
+/*?*/ //kopiert und der Index auf den StartNode in das linke
+/*?*/ //Kopfattribut gehaengt.
+/*?*/ SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
+/*?*/ SwStartNode* pSttNd = GetNodes().MakeEmptySection( aTmp, SwFooterStartNode );
+/*?*/ SwNodeRange aRange( aRCnt.GetCntntIdx()->GetNode(), 0,
+/*?*/ *aRCnt.GetCntntIdx()->GetNode().EndOfSectionNode() );
+/*?*/ aTmp = *pSttNd->EndOfSectionNode();
+/*?*/ GetNodes()._Copy( aRange, aTmp, FALSE );
+/*?*/
+/*?*/ pFmt->SetAttr( SwFmtCntnt( pSttNd ) );
+/*?*/ pDesc->GetLeft().SetAttr( SwFmtFooter( pFmt ) );
+/*?*/ }
+/*?*/ else
+/*?*/ ::binfilter::lcl_DescSetAttr( *pRight,
+/*?*/ *(SwFrmFmt*)rLeftFoot.GetFooterFmt(), FALSE );
+/*?*/ }
+/*N*/ }
+/*N*/ pDesc->ChgFooterShare( rChged.IsFooterShared() );
+/*N*/
+/*N*/ if ( pDesc->GetName() != rChged.GetName() )
+/*?*/ pDesc->SetName( rChged.GetName() );
+/*N*/
+/*N*/ // Dadurch wird ein RegisterChange ausgeloest, wenn notwendig
+/*N*/ pDesc->SetRegisterFmtColl( rChged.GetRegisterFmtColl() );
+/*N*/
+/*N*/ //Wenn sich das UseOn oder der Follow aendern muessen die
+/*N*/ //Absaetze das erfahren.
+/*N*/ BOOL bUseOn = FALSE;
+/*N*/ BOOL bFollow = FALSE;
+/*N*/ if ( pDesc->GetUseOn() != rChged.GetUseOn() )
+/*N*/ { pDesc->SetUseOn( rChged.GetUseOn() );
+/*N*/ bUseOn = TRUE;
+/*N*/ }
+/*N*/ if ( pDesc->GetFollow() != rChged.GetFollow() )
+/*N*/ { if ( rChged.GetFollow() == &rChged )
+/*N*/ { if ( pDesc->GetFollow() != pDesc )
+/*?*/ { pDesc->SetFollow( pDesc );
+/*?*/ bFollow = TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ { pDesc->SetFollow( rChged.pFollow );
+/*N*/ bFollow = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( (bUseOn || bFollow) && GetRootFrm() )
+/*N*/ //Layot benachrichtigen!
+/*N*/ GetRootFrm()->CheckPageDescs( (SwPageFrm*)GetRootFrm()->Lower() );
+/*N*/
+/*N*/ //Jetzt noch die Seiten-Attribute uebernehmen.
+/*N*/ ::binfilter::lcl_DescSetAttr( rChged.GetMaster(), pDesc->GetMaster() );
+/*N*/ ::binfilter::lcl_DescSetAttr( rChged.GetLeft(), pDesc->GetLeft() );
+/*N*/
+/*N*/ //Wenn sich FussnotenInfo veraendert, so werden die Seiten
+/*N*/ //angetriggert.
+/*N*/ if( !(pDesc->GetFtnInfo() == rChged.GetFtnInfo()) )
+/*N*/ {
+/*?*/ pDesc->SetFtnInfo( rChged.GetFtnInfo() );
+/*?*/ SwMsgPoolItem aInfo( RES_PAGEDESC_FTNINFO );
+/*?*/ {
+/*?*/ SwClientIter aIter( pDesc->GetMaster() );
+/*?*/ for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast;
+/*?*/ pLast = aIter.Next() )
+/*?*/ pLast->Modify( &aInfo, 0 );
+/*?*/ }
+/*?*/ {
+/*?*/ SwClientIter aIter( pDesc->GetLeft() );
+/*?*/ for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast;
+/*?*/ pLast = aIter.Next() )
+/*?*/ pLast->Modify( &aInfo, 0 );
+/*?*/ }
+/*N*/ }
+/*N*/ SetModified();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDoc::DelPageDesc()
+|*
+|* Beschreibung Alle Descriptoren, deren Follow auf den zu loeschenden
+|* zeigen muessen angepasst werden.
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung JP 04.09.95
+|*
+|*************************************************************************/
+
+void lcl_RemoveFrms( SwFrmFmt& rFmt, FASTBOOL& rbFtnsRemoved )
+{
+ SwClientIter aIter( rFmt );
+ SwFrm *pFrm;
+ for( pFrm = (SwFrm*)aIter.First(TYPE(SwFrm)); pFrm;
+ pFrm = (SwFrm*)aIter.Next() )
+ if ( !rbFtnsRemoved && pFrm->IsPageFrm() &&
+ ((SwPageFrm*)pFrm)->IsFtnPage() )
+ {
+ rFmt.GetDoc()->GetRootFrm()->RemoveFtns( 0, FALSE, TRUE );
+ rbFtnsRemoved = TRUE;
+ }
+ else
+ {
+ pFrm->Cut();
+ delete pFrm;
+ }
+}
+
+
+void SwDoc::DelPageDesc( USHORT i )
+{
+ ASSERT( i < aPageDescs.Count(), "PageDescs ueberindiziert." );
+ ASSERT( i != 0, "Default Pagedesc loeschen is nicht." );
+ if ( i == 0 )
+ return;
+
+ SwPageDesc *pDel = aPageDescs[i];
+
+ SwFmtPageDesc aDfltDesc( aPageDescs[0] );
+ SwClientIter aIter( *pDel );
+ SwClient* pLast;
+ while( 0 != ( pLast = aIter.GoRoot() ))
+ {
+ if( pLast->ISA( SwFmtPageDesc ) )
+ {
+ const SwModify* pMod = ((SwFmtPageDesc*)pLast)->GetDefinedIn();
+ if ( pMod )
+ {
+ if( pMod->ISA( SwCntntNode ) )
+ ((SwCntntNode*)pMod)->SetAttr( aDfltDesc );
+ else if( pMod->ISA( SwFmt ))
+ ((SwFmt*)pMod)->SetAttr( aDfltDesc );
+ else
+ {
+ ASSERT( !this, "was ist das fuer ein Mofify-Obj?" );
+ aPageDescs[0]->Add( pLast );
+ }
+ }
+ else //Es kann noch eine Undo-Kopie existieren
+ aPageDescs[0]->Add( pLast );
+ }
+
+ BOOL bFtnInf = FALSE;
+ if ( TRUE == (bFtnInf = pLast == pFtnInfo->GetPageDescDep()) ||
+ pLast == pEndNoteInfo->GetPageDescDep() )
+ {
+ aPageDescs[0]->Add( pLast );
+ if ( GetRootFrm() )
+ GetRootFrm()->CheckFtnPageDescs( !bFtnInf );
+ }
+ }
+
+ for ( USHORT j = 0; j < aPageDescs.Count(); ++j )
+ {
+ if ( aPageDescs[j]->GetFollow() == pDel )
+ {
+ aPageDescs[j]->SetFollow( 0 );
+ //Clients des PageDesc sind die Attribute, denen sagen wir bescheid.
+ //die Attribute wiederum reichen die Meldung an die Absaetze weiter.
+
+ //Layot benachrichtigen!
+ if( GetRootFrm() ) // ist nicht immer vorhanden!! (Orginizer)
+ GetRootFrm()->CheckPageDescs( (SwPageFrm*)GetRootFrm()->Lower() );
+ }
+ }
+
+ if( GetRootFrm() ) // ist nicht immer vorhanden!! (Orginizer)
+ {
+ //Wenn jetzt noch irgendwelche Seiten auf die FrmFmt'e (Master und Left)
+ //Zeigen (z.B. irgendwelche Fussnotenseiten), so muessen die Seiten
+ //vernichtet werden.
+
+ // Wenn wir auf Endnotenseiten stossen, schmeissen wir alle Fussnoten weg,
+ // anders kann die Reihenfolge der Seiten (FollowsPageDescs usw.)
+ // nicht garantiert werden.
+ FASTBOOL bFtnsRemoved = FALSE;
+
+ ::binfilter::lcl_RemoveFrms( pDel->GetMaster(), bFtnsRemoved );
+ ::binfilter::lcl_RemoveFrms( pDel->GetLeft(), bFtnsRemoved );
+ }
+
+ aPageDescs.Remove( i );
+ delete pDel;
+ SetModified();
+}
+
+
+
+/*************************************************************************
+|*
+|* SwDoc::MakePageDesc()
+|*
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung MA 20. Aug. 93
+|*
+|*************************************************************************/
+
+/*N*/ USHORT SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
+/*N*/ BOOL bRegardLanguage)
+/*N*/ {
+/*N*/ SwPageDesc *pNew;
+/*N*/ if( pCpy )
+/*N*/ {
+/*?*/ pNew = new SwPageDesc( *pCpy );
+/*?*/ pNew->SetName( rName );
+/*?*/ if( rName != pCpy->GetName() )
+/*?*/ {
+/*?*/ pNew->SetPoolFmtId( USHRT_MAX );
+/*?*/ pNew->SetPoolHelpId( USHRT_MAX );
+/*?*/ pNew->SetPoolHlpFileId( UCHAR_MAX );
+/*?*/ }
+/*?*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pNew = new SwPageDesc( rName, GetDfltFrmFmt(), this );
+/*N*/ //Default-Seitenformat einstellen.
+/*N*/ ::binfilter::lcl_DefaultPageFmt( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(),
+/*N*/ GetPrt(), FALSE );
+/*N*/
+/*N*/ SvxFrameDirection aFrameDirection = bRegardLanguage ?
+/*N*/ GetDefaultFrameDirection(GetAppLanguage())
+/*N*/ : FRMDIR_HORI_LEFT_TOP;
+/*N*/
+/*N*/ pNew->GetMaster().SetAttr( SvxFrameDirectionItem(aFrameDirection) );
+/*N*/ pNew->GetLeft().SetAttr( SvxFrameDirectionItem(aFrameDirection) );
+/*N*/
+/*N*/ if( GetPrt() )
+/*N*/ pNew->SetLandscape( ORIENTATION_LANDSCAPE ==
+/*N*/ GetPrt()->GetOrientation() );
+/*N*/ }
+/*N*/ aPageDescs.Insert( pNew, aPageDescs.Count() );
+/*N*/ SetModified();
+/*N*/ return (aPageDescs.Count()-1);
+/*N*/ }
+
+/*N*/ SwPageDesc* SwDoc::FindPageDescByName( const String& rName, USHORT* pPos ) const
+/*N*/ {
+/*N*/ SwPageDesc* pRet = 0;
+/*N*/ if( pPos ) *pPos = USHRT_MAX;
+/*N*/
+/*N*/ for( USHORT n = 0, nEnd = aPageDescs.Count(); n < nEnd; ++n )
+/*N*/ if( aPageDescs[ n ]->GetName() == rName )
+/*N*/ {
+/*N*/ pRet = aPageDescs[ n ];
+/*N*/ if( pPos )
+/*N*/ *pPos = n;
+/*N*/ break;
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+/******************************************************************************
+ * Methode : void SwDoc::SetPrt( SfxPrinter *pP )
+ * Beschreibung:
+ * Erstellt : OK 27.10.94 10:20
+ * Aenderung : MA 26. Mar. 98
+ ******************************************************************************/
+
+/*N*/ void SwDoc::PrtDataChanged()
+/*N*/ {
+/*N*/ //!!!!!!!! Bei Aenderungen hier bitte ggf. InJobSetup im Sw3io mitpflegen
+/*N*/
+/*N*/ BOOL bEndAction = FALSE;
+/*N*/
+/*N*/ if( GetDocShell() )
+/*N*/ GetDocShell()->UpdateFontList();
+/*N*/
+/*N*/ BOOL bDraw = TRUE;
+/*N*/ if ( GetRootFrm() )
+/*N*/ {
+/*?*/ ViewShell *pSh = GetRootFrm()->GetCurrShell();
+/*?*/ if( !IsBrowseMode() || ( pSh && pSh->GetViewOptions()->IsPrtFormat() ) )
+/*?*/ {
+/*?*/ GetRootFrm()->StartAllAction();
+/*?*/ bEndAction = TRUE;
+/*?*/
+/*?*/ bDraw = FALSE;
+/*?*/ if( pDrawModel )
+/*?*/ pDrawModel->SetRefDevice( _GetRefDev() );
+/*?*/
+/*?*/ pFntCache->Flush();
+/*?*/ GetRootFrm()->InvalidateAllCntnt();
+/*?*/
+/*?*/ if ( pSh )
+/*?*/ {
+/*?*/ do
+/*?*/ {
+/*?*/ pSh->InitPrt( pPrt );
+/*?*/ pSh = (ViewShell*)pSh->GetNext();
+/*?*/ }
+/*?*/ while ( pSh != GetRootFrm()->GetCurrShell() );
+/*?*/ }
+/*?*/
+/*?*/ }
+/*N*/ }
+/*N*/ if ( bDraw && pDrawModel && _GetRefDev() != pDrawModel->GetRefDevice() )
+/*N*/ pDrawModel->SetRefDevice( _GetRefDev() );
+/*N*/
+/*N*/ PrtOLENotify( TRUE );
+/*N*/
+/*N*/ if ( bEndAction )
+/*?*/ GetRootFrm()->EndAllAction();
+/*N*/ }
+
+//Zur Laufzeit sammeln wir die GlobalNames der Server, die keine
+//Benachrichtigung zu Druckerwechseln wuenschen. Dadurch sparen wir
+//das Laden vieler Objekte (gluecklicherweise werden obendrein alle
+//Fremdobjekte unter einer ID abgebuildet). Init und DeInit vom Array
+//ist in init.cxx zu finden.
+extern SvPtrarr *pGlobalOLEExcludeList;
+
+/*N*/ void SwDoc::PrtOLENotify( BOOL bAll )
+/*N*/ {
+/*N*/ SwFEShell *pShell = 0;
+/*N*/ if ( GetRootFrm() && GetRootFrm()->GetCurrShell() )
+/*N*/ {
+/*N*/ ViewShell *pSh = GetRootFrm()->GetCurrShell();
+/*N*/ if ( !pSh->ISA(SwFEShell) )
+/*N*/ do
+/*?*/ { pSh = (ViewShell*)pSh->GetNext();
+/*?*/ } while ( !pSh->ISA(SwFEShell) &&
+/*?*/ pSh != GetRootFrm()->GetCurrShell() );
+/*N*/
+/*N*/ if ( pSh->ISA(SwFEShell) )
+/*N*/ pShell = (SwFEShell*)pSh;
+/*N*/ }
+/*N*/ if ( !pShell )
+/*N*/ {
+/*N*/ //Das hat ohne Shell und damit ohne Client keinen Sinn, weil nur darueber
+/*N*/ //die Kommunikation bezueglich der Groessenaenderung implementiert ist.
+/*N*/ //Da wir keine Shell haben, merken wir uns diesen unguenstigen
+/*N*/ //Zustand am Dokument, dies wird dann beim Erzeugen der ersten Shell
+/*N*/ //nachgeholt.
+/*N*/ bOLEPrtNotifyPending = TRUE;
+/*N*/ if ( bAll )
+/*N*/ bAllOLENotify = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( bAllOLENotify )
+/*N*/ bAll = TRUE;
+/*N*/
+/*N*/ bOLEPrtNotifyPending = bAllOLENotify = FALSE;
+/*N*/
+/*N*/
+/*N*/ SwOLENodes *pNodes = 0;
+/*N*/ SwClientIter aIter( *(SwModify*)GetDfltGrfFmtColl() );
+/*N*/ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+/*N*/ pNd;
+/*N*/ pNd = (SwCntntNode*)aIter.Next() )
+/*N*/ {
+/*N*/ SwOLENode *pONd;
+/*N*/ if ( 0 != (pONd = pNd->GetOLENode()) &&
+/*N*/ (bAll || pONd->IsOLESizeInvalid()) )
+/*N*/ {
+/*N*/ if ( !pNodes )
+/*N*/ pNodes = new SwOLENodes;
+/*N*/ pNodes->Insert( pONd, pNodes->Count() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( pNodes )
+/*N*/ {
+/*N*/ ::binfilter::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
+/*N*/ 0, pNodes->Count(), GetDocShell());
+/*N*/ GetRootFrm()->StartAllAction();
+/*N*/
+/*N*/ for( USHORT i = 0; i < pNodes->Count(); ++i )
+/*N*/ {
+/*N*/ ::binfilter::SetProgressState( i, GetDocShell() );
+/*N*/
+/*N*/ SwOLENode* pOLENd = (*pNodes)[i];
+/*N*/ pOLENd->SetOLESizeInvalid( FALSE );
+/*N*/
+/*N*/ //Ersteinmal die Infos laden und festellen ob das Teil nicht
+/*N*/ //schon in der Exclude-Liste steht
+/*N*/ SvGlobalName aName;
+/*N*/
+/*N*/ if ( !pOLENd->GetOLEObj().IsOleRef() ) //Noch nicht geladen
+/*N*/ {
+/*N*/ String sBaseURL( ::binfilter::StaticBaseUrl::GetBaseURL() );
+/*N*/ const SfxMedium *pMedium;
+/*N*/ if( 0 != (pMedium = GetDocShell()->GetMedium()) &&
+/*N*/ pMedium->GetName() != sBaseURL )
+/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( pMedium->GetName() );
+/*N*/ SvInfoObjectRef xInfo = GetPersist()->Find( pOLENd->GetOLEObj().GetName() );
+/*N*/ if ( xInfo.Is() ) //Muss normalerweise gefunden werden
+/*N*/ aName = xInfo->GetClassName();
+/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( sBaseURL );
+/*N*/ }
+/*N*/ else
+/*?*/ aName = pOLENd->GetOLEObj().GetOleRef()->GetClassName();
+/*N*/
+/*N*/ BOOL bFound = FALSE;
+/*N*/ for ( USHORT i = 0;
+/*N*/ i < pGlobalOLEExcludeList->Count() && !bFound;
+/*N*/ ++i )
+/*N*/ {
+/*N*/ bFound = *(SvGlobalName*)(*pGlobalOLEExcludeList)[i] ==
+/*N*/ aName;
+/*N*/ }
+/*N*/ if ( bFound )
+/*N*/ continue;
+/*N*/
+/*N*/ //Kennen wir nicht, also muss das Objekt geladen werden.
+/*N*/ //Wenn es keine Benachrichtigung wuenscht
+/*N*/ SvEmbeddedObjectRef xRef( (SvInPlaceObject*) pOLENd->GetOLEObj().GetOleRef() );
+/*N*/ if ( xRef ) //Kaputt?
+/*N*/ {
+/*N*/ if ( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xRef->GetMiscStatus())
+/*N*/ {
+/*N*/ if ( pOLENd->GetFrm() )
+/*N*/ {
+/*N*/ xRef->OnDocumentPrinterChanged( pPrt );
+/*N*/ pShell->CalcAndSetScale( xRef );//Client erzeugen lassen.
+/*N*/ }
+/*N*/ else
+/*N*/ pOLENd->SetOLESizeInvalid( TRUE );
+/*N*/ }
+/*N*/ else
+/*N*/ pGlobalOLEExcludeList->Insert(
+/*N*/ new SvGlobalName( xRef->GetClassName()),
+/*N*/ pGlobalOLEExcludeList->Count() );
+/*N*/ }
+/*N*/ }
+/*N*/ delete pNodes;
+/*N*/ GetRootFrm()->EndAllAction();
+/*N*/ ::binfilter::EndProgress( GetDocShell() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::SetVirDev( VirtualDevice* pVd, sal_Bool bCallVirDevDataChanged )
+/*N*/ {
+/*N*/ if ( (ULONG)pVirDev != (ULONG)pVd )
+/*N*/ {
+/*N*/ delete pVirDev;
+/*N*/ pVirDev = pVd;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::SetPrt( SfxPrinter *pP, sal_Bool bCallPrtDataChanged )
+/*N*/ {
+/*N*/ ASSERT( pP, "Kein Drucker!" );
+/*N*/
+/*N*/ const BOOL bInitPageDesc = pPrt == 0;
+/*N*/
+/*N*/ if ( (ULONG) pP != (ULONG) pPrt)
+/*N*/ {
+/*N*/ delete pPrt;
+/*N*/ pPrt = pP;
+/*N*/ }
+/*N*/ // OD 05.03.2003 #107870# - first adjust page description, before trigger formatting.
+/*N*/ if( bInitPageDesc )
+/*N*/ {
+/*N*/ // JP 17.04.97: Bug 38924 - falls noch kein Drucker gesetzt war
+/*N*/ // und der PageDesc nicht eingelesen wurde
+/*N*/ // -> passe an den Drucker an
+/*N*/ if( pPrt && LONG_MAX == _GetPageDesc( 0 ).GetMaster().GetFrmSize().GetWidth() )
+/*N*/ _GetPageDesc( 0 ).SetLandscape( ORIENTATION_LANDSCAPE ==
+/*N*/ pPrt->GetOrientation() );
+/*N*/
+/*N*/ //MA 11. Mar. 97: Das sollten wir fuer alle Formate tun, weil die
+/*N*/ //Werte auf LONG_MAX initalisiert sind (spaetes anlegen des Druckers)
+/*N*/ //und die Reader u.U. "unfertige" Formate stehenlassen.
+/*N*/ for ( USHORT i = 0; i < GetPageDescCnt(); ++i )
+/*N*/ {
+/*N*/ SwPageDesc& rDesc = _GetPageDesc( i );
+/*N*/ ::binfilter::lcl_DefaultPageFmt( rDesc.GetPoolFmtId(), rDesc.GetMaster(),
+/*N*/ rDesc.GetLeft(), pPrt, TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bCallPrtDataChanged )
+/*N*/ PrtDataChanged();
+/*N*/ }
+
+/*N*/ void SwDoc::SetUseVirtualDevice( sal_Bool bFlag )
+/*N*/ {
+/*N*/ if ( !IsUseVirtualDevice() != !bFlag )
+/*N*/ {
+/*N*/ _SetUseVirtualDevice( bFlag );
+/*N*/ PrtDataChanged();
+/*N*/ SetModified();
+/*N*/ }
+/*N*/
+/*N*/ }
+
+/*
+ * Kleiner Hack;
+ *
+const SwPageDesc& SwDoc::GetPageDesc( USHORT i ) const
+{
+ if( !i && !aPageDescs.Count() ) // noch keiner vorhanden?
+ ((SwDoc*)this)->InitPageDescs(); //Default PageDescriptor
+ return *aPageDescs[i];
+}
+
+SwPageDesc& SwDoc::_GetPageDesc( USHORT i ) const
+{
+ if( !i && !aPageDescs.Count() ) // noch keiner vorhanden?
+ ((SwDoc*)this)->InitPageDescs(); //Default PageDescriptor
+ return *aPageDescs[i];
+}
+*/
+
+
+
+/*N*/ IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, pTimer )
+/*N*/ {
+/*N*/ SwFEShell* pSh = (SwFEShell*)GetEditShell();
+/*N*/ if( pSh )
+/*N*/ {
+/*N*/ bOLEPrtNotifyPending = bAllOLENotify = FALSE;
+/*N*/
+/*N*/ SwOLENodes aOLENodes;
+/*N*/ SwClientIter aIter( *(SwModify*)GetDfltGrfFmtColl() );
+/*N*/ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+/*N*/ pNd;
+/*N*/ pNd = (SwCntntNode*)aIter.Next() )
+/*N*/ {
+/*N*/ SwOLENode *pONd = pNd->GetOLENode();
+/*N*/ if( pONd && pONd->IsOLESizeInvalid() )
+/*N*/ {
+/*N*/ aOLENodes.Insert( pONd, aOLENodes.Count() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( aOLENodes.Count() )
+/*N*/ {
+/*N*/ ::binfilter::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
+/*N*/ 0, aOLENodes.Count(), GetDocShell());
+/*N*/ GetRootFrm()->StartAllAction();
+/*N*/ SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR );
+/*N*/
+/*N*/ for( USHORT i = 0; i < aOLENodes.Count(); ++i )
+/*N*/ {
+/*N*/ ::binfilter::SetProgressState( i, GetDocShell() );
+/*N*/
+/*N*/ SwOLENode* pOLENd = aOLENodes[i];
+/*N*/ pOLENd->SetOLESizeInvalid( FALSE );
+/*N*/
+/*N*/ //Kennen wir nicht, also muss das Objekt geladen werden.
+/*N*/ //Wenn es keine Benachrichtigung wuenscht
+/*N*/ SvEmbeddedObjectRef xRef( (SvInPlaceObject*)
+/*N*/ pOLENd->GetOLEObj().GetOleRef() );
+/*N*/ if( xRef ) //Kaputt?
+/*N*/ {
+/*N*/ if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE &
+/*N*/ xRef->GetMiscStatus() )
+/*N*/ {
+/*N*/ if( pOLENd->GetFrm() )
+/*N*/ {
+/*N*/ xRef->OnDocumentPrinterChanged( pPrt );
+/*N*/ pSh->CalcAndSetScale( xRef );//Client erzeugen lassen.
+/*N*/ }
+/*N*/ else
+/*?*/ pOLENd->SetOLESizeInvalid( TRUE );
+/*N*/ }
+/*N*/ // repaint it
+/*N*/ pOLENd->Modify( &aMsgHint, &aMsgHint );
+/*N*/ }
+/*N*/ }
+/*N*/ GetRootFrm()->EndAllAction();
+/*N*/ ::binfilter::EndProgress( GetDocShell() );
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docdraw.cxx b/binfilter/bf_sw/source/core/doc/sw_docdraw.cxx
new file mode 100644
index 000000000000..0f95b6d3abf9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docdraw.cxx
@@ -0,0 +1,439 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <rtl/logfile.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <bf_svx/eeitem.hxx>
+
+#include <bf_svx/itemdata.hxx>
+#include <bf_svtools/poolitem.hxx>
+
+#ifndef _SVX_FLDITEM_HXX //autogen
+#define ITEMID_FIELD EE_FEATURE_FIELD
+#endif
+#include <bf_svx/editeng.hxx>
+#include <bf_svx/svdoutl.hxx>
+#include <bf_svx/svdpage.hxx>
+
+
+#include <bf_svx/svdpool.hxx>
+
+#include <frmfmt.hxx>
+#include <swhints.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <rootfrm.hxx> //Damit der RootDtor gerufen wird.
+#include <viewsh.hxx> // fuer MakeDrawView
+#include <drawdoc.hxx>
+#include <dcontact.hxx>
+#include <dview.hxx>
+#include <mvsave.hxx>
+#include <flyfrm.hxx>
+#include <dflyobj.hxx>
+
+#include <bf_svx/fhgtitem.hxx>
+
+// OD 26.06.2003 #108784#
+#include <bf_svx/svdpagv.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::linguistic2;
+
+
+/*N*/ SV_IMPL_VARARR_SORT( _ZSortFlys, _ZSortFly )
+
+/*************************************************************************
+|*
+|* SwDoc::GroupSelection / SwDoc::UnGroupSelection
+|*
+|* Ersterstellung JP 21.08.95
+|* Letzte Aenderung JP 21.08.95
+|*
+|*************************************************************************/
+
+/*N*/ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
+/*N*/ {
+ // OD 30.06.2003 #108784# - replace marked 'virtual' drawing objects by
+ // the corresponding 'master' drawing objects.
+DBG_BF_ASSERT(0, "STRIP"); return NULL; //STRIP001 SwDrawView::ReplaceMarkedDrawVirtObjs( rDrawView );
+/*N*/ }
+
+
+/*N*/ void SwDoc::UnGroupSelection( SdrView& rDrawView )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 int bUndo = DoesUndo();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDoc::DeleteSelection()
+|*
+|* Ersterstellung MA 14. Nov. 95
+|* Letzte Aenderung MA 14. Nov. 95
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwDoc::DeleteSelection()
+|*
+|* Ersterstellung JP 11.01.96
+|* Letzte Aenderung JP 11.01.96
+|*
+|*************************************************************************/
+
+/*N*/ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
+/*N*/ UINT32 nArrOrdNum )
+/*N*/ : pFmt( pFrmFmt ), pAnchor( pFlyAn ), nOrdNum( nArrOrdNum )
+/*N*/ {
+/*N*/ // #i11176#
+/*N*/ // This also needs to work when no layout exists. Thus, for
+/*N*/ // FlyFrames an alternative method is used now in that case.
+/*N*/ SwClientIter aIter( (SwFmt&)*pFmt );
+/*N*/
+/*N*/ if( RES_FLYFRMFMT == pFmt->Which() )
+/*N*/ {
+/*N*/ if( pFmt->GetDoc()->GetRootFrm() )
+/*N*/ {
+/*N*/ // Schauen, ob es ein SdrObject dafuer gibt
+/*N*/ if( aIter.First( TYPE( SwFlyFrm) ) )
+/*N*/ nOrdNum = ((SwFlyFrm*)aIter())->GetVirtDrawObj()->GetOrdNum();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Schauen, ob es ein SdrObject dafuer gibt
+/*N*/ if( aIter.First( TYPE(SwFlyDrawContact) ) )
+/*N*/ nOrdNum = ((SwFlyDrawContact*)aIter())->GetMaster()->GetOrdNum();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( RES_DRAWFRMFMT == pFmt->Which() )
+/*N*/ {
+/*N*/ // Schauen, ob es ein SdrObject dafuer gibt
+/*N*/ if( aIter.First( TYPE(SwDrawContact) ) )
+/*N*/ nOrdNum = ((SwDrawContact*)aIter())->GetMaster()->GetOrdNum();
+/*N*/ }
+/*N*/ else
+/*N*/ ASSERT( !this, "was ist das fuer ein Format?" );
+/*N*/ }
+} //namespace binfilter
+/*************************************************************************/
+// Wird auch vom Sw3-Reader gerufen, wenn ein Fehler beim Einlesen
+// des Drawing Layers auftrat. In diesem Fall wird der Layer komplett
+// neu aufgebaut.
+
+// #75371#
+#include <bf_svx/sxenditm.hxx>
+
+namespace binfilter {//STRIP009
+/*N*/ void SwDoc::InitDrawModel()
+/*N*/ {
+/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::InitDrawModel" );
+/*N*/
+/*N*/ //!!Achtung im sw3-Reader (sw3imp.cxx) gibt es aehnlichen Code, der
+/*N*/ //mitgepfelgt werden muss.
+/*N*/ if ( pDrawModel )
+/*?*/ ReleaseDrawModel();
+/*N*/
+/*N*/ //DrawPool und EditEnginePool anlegen, diese gehoeren uns und werden
+/*N*/ //dem Drawing nur mitgegeben. Im ReleaseDrawModel werden die Pools wieder
+/*N*/ //zerstoert.
+/*N*/ // 17.2.99: for Bug 73110 - for loading the drawing items. This must
+/*N*/ // be loaded without RefCounts!
+/*N*/ SfxItemPool *pSdrPool = new SdrItemPool( &aAttrPool, SDRATTR_START,
+/*N*/ SDRATTR_END, FALSE );
+/*N*/ // #75371# change DefaultItems for the SdrEdgeObj distance items
+/*N*/ // to TWIPS.
+/*N*/ if(pSdrPool)
+/*N*/ {
+/*N*/ const long nDefEdgeDist = ((500 * 72) / 127); // 1/100th mm in twips
+/*N*/ pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist));
+/*N*/ pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist));
+/*N*/ pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist));
+/*N*/ pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist));
+/*N*/ }
+/*N*/ SfxItemPool *pEEgPool = EditEngine::CreatePool( FALSE );
+/*N*/ pSdrPool->SetSecondaryPool( pEEgPool );
+/*N*/ if ( !aAttrPool.GetFrozenIdRanges () )
+/*N*/ aAttrPool.FreezeIdRanges();
+/*N*/ else
+/*?*/ pSdrPool->FreezeIdRanges();
+/*N*/
+/*N*/ // SJ: #95129# set FontHeight pool defaults without changing static SdrEngineDefaults
+/*N*/ aAttrPool.SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));
+/*N*/
+/*N*/ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create DrawDocument" );
+/*N*/ //Das SdrModel gehoert dem Dokument, wir haben immer zwei Layer und eine
+/*N*/ //Seite.
+/*N*/ pDrawModel = new SwDrawDocument( this );
+/*N*/
+/*N*/ String sLayerNm;
+/*N*/ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" ));
+/*N*/ nHell = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+/*N*/
+/*N*/ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Heaven" ));
+/*N*/ nHeaven = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+/*N*/
+/*N*/ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Controls" ));
+/*N*/ nControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+/*N*/
+/*N*/ // OD 25.06.2003 #108784# - add invisible layers corresponding to the
+/*N*/ // visible ones.
+/*N*/ {
+/*N*/ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" ));
+/*N*/ nInvisibleHell = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+/*N*/
+/*N*/ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" ));
+/*N*/ nInvisibleHeaven = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+/*N*/
+/*N*/ sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" ));
+/*N*/ nInvisibleControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+/*N*/ }
+/*N*/
+/*N*/ pDrawModel->InsertPage( pDrawModel->AllocPage( FALSE ) );
+/*N*/ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create DrawDocument" );
+/*N*/
+/*N*/ SdrOutliner& rOutliner = pDrawModel->GetDrawOutliner();
+/*N*/ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create Spellchecker/Hyphenator" );
+/*N*/
+/*N*/ SetCalcFieldValueHdl(&rOutliner);
+/*N*/ SetCalcFieldValueHdl(&pDrawModel->GetHitTestOutliner());
+/*N*/
+/*N*/ //JP 16.07.98: Bug 50193 - Linkmanager am Model setzen, damit
+/*N*/ // dort ggfs. verlinkte Grafiken eingefuegt werden koennen
+/*N*/ //JP 28.01.99: der WinWord Import benoetigt ihn auch
+/*N*/ pDrawModel->SetLinkManager( &GetLinkManager() );
+/*N*/
+/*N*/ OutputDevice* pRefDev = _GetRefDev();
+/*N*/ if ( pRefDev )
+/*N*/ pDrawModel->SetRefDevice( pRefDev );
+/*N*/ if ( pLayout )
+/*N*/ {
+/*N*/ pLayout->SetDrawPage( pDrawModel->GetPage( 0 ) );
+/*N*/ pLayout->GetDrawPage()->SetSize( pLayout->Frm().SSize() );
+/*N*/ }
+/*N*/ }
+
+/** method to determine, if a layer ID belongs to the visible ones.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is unknown, method asserts and returns <false>.
+
+ @author OD
+*/
+bool SwDoc::IsVisibleLayerId( const SdrLayerID& _nLayerId )
+{
+ bool bRetVal;
+
+ if ( _nLayerId == GetHeavenId() ||
+ _nLayerId == GetHellId() ||
+ _nLayerId == GetControlsId() )
+ {
+ bRetVal = true;
+ }
+ else if ( _nLayerId == GetInvisibleHeavenId() ||
+ _nLayerId == GetInvisibleHellId() ||
+ _nLayerId == GetInvisibleControlsId() )
+ {
+ bRetVal = false;
+ }
+ else
+ {
+ ASSERT( false, "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." );
+ bRetVal = false;
+ }
+
+ return bRetVal;
+}
+
+/** method to determine, if the corresponding visible layer ID for a invisible one.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is a visible one, method returns given layer ID.
+ Note: If given layer ID is unknown, method returns given layer ID.
+
+ @author OD
+*/
+SdrLayerID SwDoc::GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId )
+{
+ SdrLayerID nVisibleLayerId;
+
+ if ( _nInvisibleLayerId == GetInvisibleHeavenId() )
+ {
+ nVisibleLayerId = GetHeavenId();
+ }
+ else if ( _nInvisibleLayerId == GetInvisibleHellId() )
+ {
+ nVisibleLayerId = GetHellId();
+ }
+ else if ( _nInvisibleLayerId == GetInvisibleControlsId() )
+ {
+ nVisibleLayerId = GetControlsId();
+ }
+ else if ( _nInvisibleLayerId == GetHeavenId() ||
+ _nInvisibleLayerId == GetHellId() ||
+ _nInvisibleLayerId == GetControlsId() )
+ {
+ ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." );
+ nVisibleLayerId = _nInvisibleLayerId;
+ }
+ else
+ {
+ ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." );
+ nVisibleLayerId = _nInvisibleLayerId;
+ }
+
+ return nVisibleLayerId;
+}
+
+/** method to determine, if the corresponding invisible layer ID for a visible one.
+
+ OD 25.06.2003 #108784#
+ Note: If given layer ID is a invisible one, method returns given layer ID.
+ Note: If given layer ID is unknown, method returns given layer ID.
+
+ @author OD
+*/
+SdrLayerID SwDoc::GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId )
+{
+ SdrLayerID nInvisibleLayerId;
+
+ if ( _nVisibleLayerId == GetHeavenId() )
+ {
+ nInvisibleLayerId = GetInvisibleHeavenId();
+ }
+ else if ( _nVisibleLayerId == GetHellId() )
+ {
+ nInvisibleLayerId = GetInvisibleHellId();
+ }
+ else if ( _nVisibleLayerId == GetControlsId() )
+ {
+ nInvisibleLayerId = GetInvisibleControlsId();
+ }
+ else if ( _nVisibleLayerId == GetInvisibleHeavenId() ||
+ _nVisibleLayerId == GetInvisibleHellId() ||
+ _nVisibleLayerId == GetInvisibleControlsId() )
+ {
+ ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." );
+ nInvisibleLayerId = _nVisibleLayerId;
+ }
+ else
+ {
+ ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." );
+ nInvisibleLayerId = _nVisibleLayerId;
+ }
+
+ return nInvisibleLayerId;
+}
+
+/*************************************************************************/
+
+
+/*N*/ void SwDoc::ReleaseDrawModel()
+/*N*/ {
+/*N*/ if ( pDrawModel )
+/*N*/ {
+/*N*/ //!!Den code im sw3io fuer Einfuegen Dokument mitpflegen!!
+/*N*/
+/*N*/ delete pDrawModel; pDrawModel = 0;
+/*N*/ SfxItemPool *pSdrPool = aAttrPool.GetSecondaryPool();
+/*N*/
+/*N*/ ASSERT( pSdrPool, "missing Pool" );
+/*N*/ SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
+/*N*/ ASSERT( !pEEgPool->GetSecondaryPool(), "i don't accept additional pools");
+/*N*/ pSdrPool->Delete(); //Erst die Items vernichten lassen,
+/*N*/ //dann erst die Verkettung loesen
+/*N*/ aAttrPool.SetSecondaryPool( 0 ); //Der ist ein muss!
+/*N*/ pSdrPool->SetSecondaryPool( 0 ); //Der ist sicherer
+/*N*/ delete pSdrPool;
+/*N*/ delete pEEgPool;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************/
+
+
+/*N*/ SdrModel* SwDoc::_MakeDrawModel()
+/*N*/ {
+/*N*/ ASSERT( !pDrawModel, "_MakeDrawModel: Why?" );
+/*N*/ InitDrawModel();
+/*N*/ if ( pLayout && pLayout->GetCurrShell() )
+/*N*/ {
+/*N*/ ViewShell* pTmp = pLayout->GetCurrShell();
+/*N*/ do
+/*N*/ {
+/*N*/ pTmp->MakeDrawView();
+/*N*/ pTmp = (ViewShell*) pTmp->GetNext();
+/*N*/ } while ( pTmp != pLayout->GetCurrShell() );
+/*N*/
+/*N*/ //Broadcast, damit die FormShell mit der DrawView verbunden werden kann
+/*N*/ if( GetDocShell() )
+/*N*/ {
+/*N*/ SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED );
+/*N*/ GetDocShell()->Broadcast( aHnt );
+/*N*/ }
+/*N*/ }
+/*N*/ return pDrawModel;
+/*N*/ }
+
+
+/*************************************************************************/
+/*
+/* Am Outliner Link auf Methode fuer Felddarstellung in Editobjekten setzen
+/*
+/*************************************************************************/
+
+/*N*/ void SwDoc::SetCalcFieldValueHdl(Outliner* pOutliner)
+/*N*/ {
+/*N*/ pOutliner->SetCalcFieldValueHdl(LINK(this, SwDoc, CalcFieldValueHdl));
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Felder bzw URLs im Outliner erkennen und Darstellung festlegen
+|*
+\************************************************************************/
+
+/*N*/ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return(0);
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docedt.cxx b/binfilter/bf_sw/source/core/doc/sw_docedt.cxx
new file mode 100644
index 000000000000..0edfc0137cf6
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docedt.cxx
@@ -0,0 +1,645 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <string.h> // fuer strchr()
+
+#include <hintids.hxx>
+
+#include <com/sun/star/i18n/WordType.hdl>
+#include <unotools/charclass.hxx>
+
+#include <fmtanchr.hxx>
+#include <fmtcntnt.hxx>
+#include <txtftn.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete
+#include <ndtxt.hxx>
+#include <redline.hxx>
+#include <section.hxx>
+#include "comcore.hrc"
+#include <viscrs.hxx>
+#include "editsh.hxx"
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::rtl;
+using namespace ::com::sun::star::i18n;
+//using namespace ::utl;
+
+#define S2U(rString) OUString::createFromAscii(rString)
+
+
+
+SV_IMPL_PTRARR( SaveBookmarks, SaveBookmark* )
+
+
+
+// -----------------------------------------------------------------
+
+
+
+
+// -----------------------------------------------------------------
+
+// loesche und verschiebe alle "Fly's am Absatz", die in der SSelection
+// liegen. Steht am SPoint ein Fly, wird dieser auf den Mark verschoben.
+
+/*N*/ void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
+/*N*/ const SwNodeIndex& rPtNdIdx )
+/*N*/ {
+/*N*/ const sal_Bool bDelFwrd = rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex();
+/*N*/
+/*N*/ SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
+/*N*/ SwSpzFrmFmts& rTbl = *pDoc->GetSpzFrmFmts();
+/*N*/ const SwPosition* pAPos;
+/*N*/ for ( sal_uInt16 i = rTbl.Count(); i; )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = rTbl[--i];
+/*N*/ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+/*N*/ if( ( rAnch.GetAnchorId() == FLY_AT_CNTNT ||
+/*N*/ rAnch.GetAnchorId() == FLY_AUTO_CNTNT ) &&
+/*N*/ 0 != ( pAPos = rAnch.GetCntntAnchor() ) &&
+/*N*/ ( bDelFwrd
+/*N*/ ? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx
+/*N*/ : rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx ))
+/*N*/ {
+/*N*/ ASSERT( rAnch.GetAnchorId() != FLY_AUTO_CNTNT, "FLY-AUTO-Baustelle!" );
+/*N*/ // nur den Anker verchieben ??
+/*N*/ if( rPtNdIdx == pAPos->nNode )
+/*N*/ {
+/*?*/ SwFmtAnchor aAnch( pFmt->GetAnchor() );
+/*?*/ SwPosition aPos( rMkNdIdx );
+/*?*/ aAnch.SetAnchor( &aPos );
+/*?*/ pFmt->SetAttr( aAnch );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // wird der Fly geloescht muss auch im seinem Inhalt alle
+/*N*/ // Flys geloescht werden !!
+/*N*/ const SwFmtCntnt &rCntnt = pFmt->GetCntnt();
+/*N*/ if( rCntnt.GetCntntIdx() )
+/*N*/ {
+/*N*/ DelFlyInRange( *rCntnt.GetCntntIdx(),
+/*N*/ SwNodeIndex( *rCntnt.GetCntntIdx()->
+/*N*/ GetNode().EndOfSectionNode() ));
+/*N*/ // Position kann sich verschoben haben !
+/*N*/ if( i > rTbl.Count() )
+/*?*/ i = rTbl.Count();
+/*N*/ else if( pFmt != rTbl[i] )
+/*?*/ i = rTbl.GetPos( pFmt );
+/*N*/ }
+/*N*/
+/*N*/ pDoc->DelLayoutFmt( pFmt );
+/*N*/ // i++; // keinen auslassen
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+
+
+// ------------------------------------------------------------------------
+
+/*N*/ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx )
+/*N*/ : pSavArr( 0 ), pSavIdx( 0 )
+/*N*/ {
+/*N*/ SwNode& rNd = rInsIdx.GetNode();
+/*N*/ SwDoc* pDest = rNd.GetDoc();
+/*N*/ if( pDest->GetRedlineTbl().Count() )
+/*N*/ {
+/*N*/ sal_uInt16 nFndPos;
+/*N*/ const SwPosition* pEnd;
+/*N*/ SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetCntntNode(), 0 ));
+/*N*/ const SwRedline* pRedl = pDest->GetRedline( aSrcPos, &nFndPos );
+/*N*/ while( nFndPos-- && *( pEnd = ( pRedl =
+/*N*/ pDest->GetRedlineTbl()[ nFndPos ] )->End() ) == aSrcPos &&
+/*N*/ *pRedl->Start() != aSrcPos )
+/*N*/ {
+/*N*/ if( !pSavArr )
+/*N*/ {
+/*N*/ pSavArr = new SvPtrarr( 2, 2 );
+/*N*/ pSavIdx = new SwNodeIndex( rInsIdx, -1 );
+/*N*/ }
+/*N*/ void* p = (void*)pEnd;
+/*N*/ pSavArr->Insert( p, pSavArr->Count() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ _SaveRedlEndPosForRestore::~_SaveRedlEndPosForRestore()
+/*N*/ {
+/*N*/ if( pSavArr )
+/*N*/ {
+/*N*/ delete pSavArr;
+/*N*/ delete pSavIdx;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void _SaveRedlEndPosForRestore::_Restore()
+/*N*/ {
+/*N*/ (*pSavIdx)++;
+/*N*/ SwPosition aPos( *pSavIdx, SwIndex( pSavIdx->GetNode().GetCntntNode(), 0 ));
+/*N*/ for( sal_uInt16 n = pSavArr->Count(); n; )
+/*N*/ *((SwPosition*)pSavArr->GetObject( --n )) = aPos;
+/*N*/ }
+
+
+// ------------------------------------------------------------------------
+
+// Loeschen einer vollstaendigen Section des NodesArray.
+// Der uebergebene Node steht irgendwo in der gewuenschten Section
+/*N*/ void SwDoc::DeleteSection( SwNode *pNode )
+/*N*/ {
+/*N*/ ASSERT( pNode, "Kein Node uebergeben." );
+/*N*/ SwStartNode* pSttNd = pNode->IsStartNode() ? (SwStartNode*)pNode
+/*N*/ : pNode->StartOfSectionNode();
+/*N*/ SwNodeIndex aSttIdx( *pSttNd ), aEndIdx( *pNode->EndOfSectionNode() );
+/*N*/
+/*N*/ // dann loesche mal alle Fly's, text::Bookmarks, ...
+/*N*/ DelFlyInRange( aSttIdx, aEndIdx );
+/*N*/ DeleteRedline( *pSttNd );
+/*N*/ _DelBookmarks( aSttIdx, aEndIdx );
+/*N*/
+/*N*/ {
+/*N*/ // alle Crsr/StkCrsr/UnoCrsr aus dem Loeschbereich verschieben
+/*N*/ SwNodeIndex aMvStt( aSttIdx, 1 );
+/*N*/ CorrAbs( aMvStt, aEndIdx, SwPosition( aSttIdx ), sal_True );
+/*N*/ }
+/*N*/
+/*N*/ GetNodes().DelNodes( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() + 1 );
+/*N*/ }
+
+
+
+/*************************************************************************
+|* SwDoc::Insert(char)
+|* Beschreibung Zeichen einfuegen
+*************************************************************************/
+
+/*N*/ sal_Bool SwDoc::Insert( const SwPaM &rRg, sal_Unicode c )
+/*N*/ {
+/*N*/ const SwPosition & rPos = *rRg.GetPoint();
+/*N*/
+/*N*/ if( pACEWord ) // Aufnahme in die Autokorrektur
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( pACEWord->IsDeleted() )
+/*N*/ }
+/*N*/ SwTxtNode *pNode = rPos.nNode.GetNode().GetTxtNode();
+/*N*/ if(!pNode)
+/*?*/ return sal_False;
+/*N*/ sal_Bool bInsOneChar = sal_True;
+/*N*/
+/*N*/ SwDataChanged aTmp( rRg, 0 );
+/*N*/
+/*N*/ pNode->Insert( c, rPos.nContent );
+/*N*/
+/*N*/
+/*N*/ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aPam( rPos.nNode, rPos.nContent.GetIndex() - 1,
+/*N*/ }
+/*N*/
+/*N*/ SetModified();
+/*N*/ return sal_True;
+/*N*/ }
+
+
+/*************************************************************************
+|* SwDoc::Overwrite(char)
+|* Beschreibung Zeichen ueberschreiben
+*************************************************************************/
+
+
+
+
+
+
+
+/* #107318# Convert list of ranges of whichIds to a corresponding list
+ of whichIds*/
+
+/*N*/ void lcl_GetJoinFlags( SwPaM& rPam, sal_Bool& rJoinTxt, sal_Bool& rJoinPrev )
+/*N*/ {
+/*N*/ if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
+/*N*/ {
+/*N*/ const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+/*N*/ SwTxtNode* pTxtNd = pStt->nNode.GetNode().GetTxtNode();
+/*N*/ rJoinTxt = (0 != pTxtNd) && pEnd->nNode.GetNode().IsTxtNode();
+/*N*/
+/*N*/ if( rJoinTxt && pStt == rPam.GetPoint() &&
+/*N*/ 0 != ( pTxtNd = pEnd->nNode.GetNode().GetTxtNode() ) &&
+/*N*/ pTxtNd->GetTxt().Len() == pEnd->nContent.GetIndex() )
+/*N*/ {
+/*?*/ rPam.Exchange();
+/*?*/ rJoinPrev = sal_False;
+/*N*/ }
+/*N*/ else
+/*N*/ rJoinPrev = rJoinTxt && rPam.GetPoint() == pStt;
+/*N*/ }
+/*N*/ else
+/*N*/ rJoinTxt = sal_False, rJoinPrev = sal_False;
+/*N*/ }
+
+/*N*/ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( rPam.GetPoint()->nNode );
+/*N*/ SwTxtNode *pTxtNd = aIdx.GetNode().GetTxtNode();
+/*N*/ SwNodeIndex aOldIdx( aIdx );
+/*N*/ SwTxtNode *pOldTxtNd = pTxtNd;
+/*N*/
+/*N*/ if( pTxtNd && pTxtNd->CanJoinNext( &aIdx ) )
+/*N*/ {
+/*N*/ SwDoc* pDoc = rPam.GetDoc();
+/*N*/ if( bJoinPrev )
+/*N*/ {
+/*N*/ {
+/*N*/
+/*N*/ /* PageBreaks, PageDesc, ColumnBreaks */
+/*N*/ // Sollte an der Logik zum Kopieren der PageBreak's ...
+/*N*/ // etwas geaendert werden, muss es auch im SwUndoDelete
+/*N*/ // geandert werden. Dort wird sich das AUTO-PageBreak
+/*N*/ // aus dem GetMarkNode kopiert.!!!
+/*N*/
+/*N*/ /* Der GetMarkNode */
+/*N*/ if( ( pTxtNd = aIdx.GetNode().GetTxtNode())->GetpSwAttrSet() )
+/*N*/ {
+/*?*/ const SfxPoolItem* pItem;
+/*?*/ if( SFX_ITEM_SET == pTxtNd->GetpSwAttrSet()->GetItemState(
+/*?*/ RES_BREAK, sal_False, &pItem ) )
+/*?*/ pTxtNd->ResetAttr( RES_BREAK );
+/*?*/ if( pTxtNd->GetpSwAttrSet() &&
+/*?*/ SFX_ITEM_SET == pTxtNd->GetpSwAttrSet()->GetItemState(
+/*?*/ RES_PAGEDESC, sal_False, &pItem ) )
+/*?*/ pTxtNd->ResetAttr( RES_PAGEDESC );
+/*N*/ }
+/*N*/
+/*N*/ /* Der PointNode */
+/*N*/ if( pOldTxtNd->GetpSwAttrSet() )
+/*N*/ {
+/*?*/ const SfxPoolItem* pItem;
+/*?*/ SfxItemSet aSet( pDoc->GetAttrPool(), aBreakSetRange );
+/*?*/ SfxItemSet* pSet = pOldTxtNd->GetpSwAttrSet();
+/*?*/ if( SFX_ITEM_SET == pSet->GetItemState( RES_BREAK,
+/*?*/ sal_False, &pItem ) )
+/*?*/ aSet.Put( *pItem );
+/*?*/ if( SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC,
+/*?*/ sal_False, &pItem ) )
+/*?*/ aSet.Put( *pItem );
+/*?*/ if( aSet.Count() )
+/*?*/ pTxtNd->SwCntntNode::SetAttr( aSet );
+/*N*/ }
+/*N*/ pOldTxtNd->FmtToTxtAttr( pTxtNd );
+/*N*/
+/*N*/ SvULongs aBkmkArr( 15, 15 );
+/*N*/ ::binfilter::_SaveCntntIdx( pDoc, aOldIdx.GetIndex(),
+/*N*/ pOldTxtNd->Len(), aBkmkArr );
+/*N*/
+/*N*/ SwIndex aAlphaIdx(pTxtNd);
+/*N*/ pOldTxtNd->Cut( pTxtNd, aAlphaIdx, SwIndex(pOldTxtNd),
+/*N*/ pOldTxtNd->Len() );
+/*N*/ SwPosition aAlphaPos( aIdx, aAlphaIdx );
+/*N*/ pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, sal_True );
+/*N*/
+/*N*/ // verschiebe noch alle Bookmarks/TOXMarks
+/*N*/ if( aBkmkArr.Count() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 ::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() );
+/*N*/
+/*N*/ // falls der uebergebene PaM nicht im Crsr-Ring steht,
+/*N*/ // gesondert behandeln (z.B. Aufruf aus dem Auto-Format)
+/*N*/ if( pOldTxtNd == rPam.GetBound( sal_True ).nContent.GetIdxReg() )
+/*?*/ rPam.GetBound( sal_True ) = aAlphaPos;
+/*N*/ if( pOldTxtNd == rPam.GetBound( sal_False ).nContent.GetIdxReg() )
+/*?*/ rPam.GetBound( sal_False ) = aAlphaPos;
+/*N*/ }
+/*N*/ // jetzt nur noch den Node loeschen
+/*N*/ pDoc->GetNodes().Delete( aOldIdx, 1 );
+/*N*/ }
+/*N*/ else
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ sal_Bool SwDoc::DeleteAndJoin( SwPaM & rPam )
+/*N*/ {
+/*N*/ if( IsRedlineOn() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 sal_uInt16 nUndoSize = 0;
+/*N*/ }
+/*N*/
+/*N*/ sal_Bool bJoinTxt, bJoinPrev;
+/*N*/ lcl_GetJoinFlags( rPam, bJoinTxt, bJoinPrev );
+/*N*/
+/*N*/ {
+/*N*/ // dann eine Kopie vom Cursor erzeugen um alle Pams aus den
+/*N*/ // anderen Sichten aus dem Loeschbereich zu verschieben
+/*N*/ // ABER NICHT SICH SELBST !!
+/*N*/ SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
+/*N*/ ::binfilter::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
+/*N*/
+/*N*/ if( !Delete( aDelPam ) )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ *rPam.GetPoint() = *aDelPam.GetPoint();
+/*N*/ }
+/*N*/
+/*N*/ if( bJoinTxt )
+/*N*/ lcl_JoinText( rPam, bJoinPrev );
+/*N*/
+/*N*/ return sal_True;
+/*N*/ }
+
+/*N*/ sal_Bool SwDoc::Delete( SwPaM & rPam )
+/*N*/ {
+/*N*/ SwPosition *pStt = (SwPosition*)rPam.Start(), *pEnd = (SwPosition*)rPam.End();
+/*N*/
+/*N*/ if( !rPam.HasMark() || *pStt >= *pEnd )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ if( pACEWord )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // ggfs. das gesicherte Word fuer die Ausnahme
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ // loesche alle leeren TextHints an der Mark-Position
+/*N*/ SwTxtNode* pTxtNd = rPam.GetMark()->nNode.GetNode().GetTxtNode();
+/*N*/ SwpHints* pHts;
+/*N*/ if( pTxtNd && 0 != ( pHts = pTxtNd->GetpSwpHints()) && pHts->Count() )
+/*N*/ {
+/*N*/ const xub_StrLen *pEndIdx;
+/*N*/ xub_StrLen nMkCntPos = rPam.GetMark()->nContent.GetIndex();
+/*N*/ for( sal_uInt16 n = pHts->Count(); n; )
+/*N*/ {
+/*N*/ const SwTxtAttr* pAttr = (*pHts)[ --n ];
+/*N*/ if( nMkCntPos > *pAttr->GetStart() )
+/*N*/ break;
+/*N*/
+/*N*/ if( nMkCntPos == *pAttr->GetStart() &&
+/*N*/ 0 != (pEndIdx = pAttr->GetEnd()) &&
+/*N*/ *pEndIdx == *pAttr->GetStart() )
+/*?*/ pTxtNd->DestroyAttr( pHts->Cut( n ) );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ // Bug 26675: DataChanged vorm loeschen verschicken, dann bekommt
+/*N*/ // man noch mit, welche Objecte sich im Bereich befinden.
+/*N*/ // Danach koennen sie vor/hinter der Position befinden.
+/*N*/ SwDataChanged aTmp( rPam, 0 );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/
+/*?*/ if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+/*?*/ DeleteRedline( rPam );
+/*?*/
+/*?*/ // loesche und verschiebe erstmal alle "Fly's am Absatz", die in der
+/*?*/ // SSelection liegen
+/*?*/ DelFlyInRange( rPam.GetMark()->nNode, rPam.GetPoint()->nNode );
+/*?*/ _DelBookmarks( pStt->nNode, pEnd->nNode, 0,
+/*?*/ &pStt->nContent, &pEnd->nContent );
+/*?*/
+/*?*/ SwNodeIndex aSttIdx( pStt->nNode );
+/*?*/ SwCntntNode * pCNd = aSttIdx.GetNode().GetCntntNode();
+/*?*/
+/*?*/ do { // middle checked loop!
+/*?*/ if( pCNd )
+/*?*/ {
+/*?*/ if( pCNd->GetTxtNode() )
+/*?*/ {
+/*?*/ // verschiebe jetzt noch den Inhalt in den neuen Node
+/*?*/ sal_Bool bOneNd = pStt->nNode == pEnd->nNode;
+/*?*/ xub_StrLen nLen = ( bOneNd ? pEnd->nContent.GetIndex()
+/*?*/ : pCNd->Len() )
+/*?*/ - pStt->nContent.GetIndex();
+/*?*/
+/*?*/ // falls schon leer, dann nicht noch aufrufen
+/*?*/ if( nLen )
+/*?*/ ((SwTxtNode*)pCNd)->Erase( pStt->nContent, nLen );
+/*?*/
+/*?*/ if( bOneNd ) // das wars schon
+/*?*/ break;
+/*?*/
+/*?*/ aSttIdx++;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // damit beim loeschen keine Indizies mehr angemeldet sind,
+/*?*/ // wird hier der SwPaM aus dem Content entfernt !!
+/*?*/ pStt->nContent.Assign( 0, 0 );
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ sal_uInt32 nEnde = pEnd->nNode.GetIndex();
+/*?*/ pCNd = pEnd->nNode.GetNode().GetCntntNode();
+/*?*/ if( pCNd )
+/*?*/ {
+/*?*/ if( pCNd->GetTxtNode() )
+/*?*/ {
+/*?*/ // falls schon leer, dann nicht noch aufrufen
+/*?*/ if( pEnd->nContent.GetIndex() )
+/*?*/ {
+/*?*/ SwIndex aIdx( pCNd, 0 );
+/*?*/ ((SwTxtNode*)pCNd)->Erase( aIdx, pEnd->nContent.GetIndex() );
+/*?*/ }
+/*?*/ nEnde--;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // damit beim Loeschen keine Indizies mehr angemeldet sind,
+/*?*/ // wird hier der SwPaM aus dem Content entfernt !!
+/*?*/ pEnd->nContent.Assign( 0, 0 );
+/*?*/ nEnde--;
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ nEnde++;
+/*?*/ if( aSttIdx != nEnde )
+/*?*/ {
+/*?*/ // loesche jetzt die Nodes in das NodesArary
+/*?*/ GetNodes().Delete( aSttIdx, nEnde - aSttIdx.GetIndex() );
+/*?*/ }
+/*?*/
+/*?*/ // falls der Node geloescht wurde, in dem der Cursor stand, so
+/*?*/ // muss der Content im akt. Content angemeldet werden !!!
+/*?*/ pStt->nContent.Assign( pStt->nNode.GetNode().GetCntntNode(),
+/*?*/ pStt->nContent.GetIndex() );
+/*?*/
+/*?*/ // der PaM wird korrigiert, denn falls ueber Nodegrenzen geloescht
+/*?*/ // wurde, so stehen sie in unterschieden Nodes. Auch die Selektion
+/*?*/ // wird aufgehoben !
+/*?*/ *pEnd = *pStt;
+/*?*/ rPam.DeleteMark();
+/*?*/
+/*?*/ } while( sal_False );
+/*?*/
+/*?*/ if( !IsIgnoreRedline() && GetRedlineTbl().Count() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 ::com::pressRedlines();
+/*?*/ SetModified();
+/*?*/
+/*?*/ return sal_True;
+/*N*/ }
+
+
+
+
+
+
+
+// liefert sal_True zurueck, wenn es weitergehen soll.
+
+
+
+
+/*N*/ sal_Bool SwDoc::Replace( SwPaM& rPam, const String& rStr, sal_Bool bRegExpRplc )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark() )
+/*N*/ return sal_True;
+/*N*/ }
+
+ // speicher die akt. Werte fuer die automatische Aufnahme von Ausnahmen
+ // in die Autokorrektur
+
+/*N*/ sal_Bool SwDoc::DelFullPara( SwPaM& rPam )
+/*N*/ {
+/*N*/ const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
+/*N*/ const SwNode* pNd = &rStt.nNode.GetNode();
+/*N*/ sal_uInt32 nSectDiff = pNd->FindStartNode()->EndOfSectionIndex() -
+/*N*/ pNd->StartOfSectionIndex();
+/*N*/ sal_uInt32 nNodeDiff = rEnd.nNode.GetIndex() - rStt.nNode.GetIndex();
+/*N*/
+/*N*/ if ( nSectDiff-2 <= nNodeDiff || IsRedlineOn() ||
+/*N*/ /* #i9185# Prevent getting the node after the end node (see below) */
+/*N*/ rEnd.nNode.GetIndex() + 1 == aNodes.Count() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // harte SeitenUmbrueche am nachfolgenden Node verschieben
+/*N*/ sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False;
+/*N*/
+ /* #i9185# This whould lead to a segmentation fault if not catched
+ above. */
+/*N*/ ULONG nNextNd = rEnd.nNode.GetIndex() + 1;
+/*N*/ SwTableNode* pTblNd = aNodes[ nNextNd ]->GetTableNode();
+/*N*/
+/*N*/ if( pTblNd && pNd->IsCntntNode() )
+/*N*/ {
+/*?*/ SwFrmFmt* pTableFmt = pTblNd->GetTable().GetFrmFmt();
+/*?*/ //JP 24.08.98: will man wirklich den PageDesc/Break vom
+/*?*/ // nachfolgen Absatz ueberbuegeln?
+/*?*/ // const SwAttrSet& rAttrSet = pTableFmt->GetAttrSet();
+/*?*/ // if( SFX_ITEM_SET != rAttrSet.GetItemState( RES_PAGEDESC ) &&
+/*?*/ // SFX_ITEM_SET != rAttrSet.GetItemState( RES_BREAK ))
+/*?*/ {
+/*?*/ const SfxPoolItem *pItem;
+/*?*/ const SfxItemSet* pSet = ((SwCntntNode*)pNd)->GetpSwAttrSet();
+/*?*/ if( pSet && SFX_ITEM_SET == pSet->GetItemState( RES_PAGEDESC,
+/*?*/ sal_False, &pItem ) )
+/*?*/ {
+/*?*/ pTableFmt->SetAttr( *pItem );
+/*?*/ bSavePageDesc = sal_True;
+/*?*/ }
+/*?*/
+/*?*/ if( pSet && SFX_ITEM_SET == pSet->GetItemState( RES_BREAK,
+/*?*/ sal_False, &pItem ) )
+/*?*/ {
+/*?*/ pTableFmt->SetAttr( *pItem );
+/*?*/ bSavePageBreak = sal_True;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ SwNodeRange aRg( rStt.nNode, rEnd.nNode );
+/*N*/ if( rPam.GetPoint() != &rEnd )
+/*?*/ rPam.Exchange();
+/*N*/
+/*N*/ // versuche hinters Ende zu verschieben
+/*N*/ if( !rPam.Move( fnMoveForward, fnGoNode ) )
+/*N*/ {
+/*N*/ // na gut, dann an den Anfang
+/*N*/ rPam.Exchange();
+/*N*/ if( !rPam.Move( fnMoveBackward, fnGoNode ))
+/*N*/ {
+/*N*/ ASSERT( sal_False, "kein Node mehr vorhanden" );
+/*N*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/ // text::Bookmarks usw. verschieben
+/*N*/ CorrAbs( aRg.aStart, aRg.aEnd, *rPam.GetPoint(), sal_True );
+/*N*/
+/*N*/ // was ist mit Fly's ??
+/*N*/ {
+/*N*/ // stehen noch FlyFrames rum, loesche auch diese
+/*N*/ const SwPosition* pAPos;
+/*N*/ for( sal_uInt16 n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+/*N*/ {
+/*N*/ SwFrmFmt* pFly = (*GetSpzFrmFmts())[n];
+/*N*/ const SwFmtAnchor* pAnchor = &pFly->GetAnchor();
+/*N*/ if( ( FLY_AT_CNTNT == pAnchor->GetAnchorId() ||
+/*N*/ FLY_AUTO_CNTNT == pAnchor->GetAnchorId() ) &&
+/*N*/ 0 != ( pAPos = pAnchor->GetCntntAnchor() ) &&
+/*N*/ aRg.aStart <= pAPos->nNode && pAPos->nNode <= aRg.aEnd )
+/*N*/ {
+/*?*/ DelLayoutFmt( pFly );
+/*?*/ --n;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ rPam.GetBound( TRUE ).nContent.Assign( 0, 0 );
+/*N*/ rPam.GetBound( FALSE ).nContent.Assign( 0, 0 );
+/*N*/ GetNodes().Delete( aRg.aStart, nNodeDiff+1 );
+/*N*/ }
+/*N*/ rPam.DeleteMark();
+/*N*/ SetModified();
+/*N*/
+/*N*/ return sal_True;
+/*N*/ }
+
+
+#define MAX_REDLINE_COUNT 250
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docfld.cxx b/binfilter/bf_sw/source/core/doc/sw_docfld.cxx
new file mode 100644
index 000000000000..9c23f3ba639d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docfld.cxx
@@ -0,0 +1,1808 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <string.h>
+#include <float.h>
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_ULONGS
+#endif
+#include <vcl/svapp.hxx>
+#include <bf_so3/so2ref.hxx>
+
+#include <horiornt.hxx>
+
+#include <cntfrm.hxx>
+#include <ndtxt.hxx>
+#include <hints.hxx>
+#include <swtable.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <txttxmrk.hxx>
+#include <docfld.hxx> // fuer Expression-Felder
+#include <docufld.hxx>
+#include <ddefld.hxx>
+#include <usrfld.hxx>
+#include <expfld.hxx>
+#include <dbfld.hxx>
+#include <flddat.hxx>
+#include <chpfld.hxx>
+#include <reffld.hxx>
+#include <flddropdown.hxx>
+#include <dbmgr.hxx>
+#include <section.hxx>
+#include <cellatr.hxx>
+#include <docary.hxx>
+#include <authfld.hxx>
+#include <txtinet.hxx>
+
+#include <poolfmt.hrc> // fuer InitFldTypes
+namespace binfilter {
+
+
+#ifndef SO2_DECL_SVLINKNAME_DEFINED
+#define SO2_DECL_SVLINKNAME_DEFINED
+SO2_DECL_REF(SvLinkName)
+#endif
+
+extern BOOL IsFrameBehind( const SwTxtNode& rMyNd, USHORT nMySttPos,
+ const SwTxtNode& rBehindNd, USHORT nSttPos );
+
+/*N*/ SV_IMPL_OP_PTRARR_SORT( _SetGetExpFlds, _SetGetExpFldPtr )
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen einfuegen
+ --------------------------------------------------------------------*/
+/*
+ * Implementierung der Feldfunktionen am Doc
+ * Return immer einen gueltigen Pointer auf den Typ. Wenn er also neu
+ * zugefuegt oder schon vorhanden ist.
+ */
+
+/*N*/ SwFieldType* SwDoc::InsertFldType(const SwFieldType &rFldTyp)
+/*N*/ {
+/*N*/ USHORT nSize = pFldTypes->Count(),
+/*N*/ nFldWhich = rFldTyp.Which();
+/*N*/
+/*N*/ USHORT i = INIT_FLDTYPES;
+/*N*/
+/*N*/ switch( nFldWhich )
+/*N*/ {
+/*N*/ case RES_SETEXPFLD:
+/*N*/ //JP 29.01.96: SequenceFelder beginnen aber bei INIT_FLDTYPES - 3!!
+/*N*/ // Sonst gibt es doppelte Nummernkreise!!
+/*N*/ //MIB 14.03.95: Ab sofort verlaesst sich auch der SW3-Reader
+/*N*/ //beim Aufbau der String-Pools und beim Einlesen von SetExp-Feldern
+/*N*/ //hierauf
+/*N*/ if( GSE_SEQ & ((SwSetExpFieldType&)rFldTyp).GetType() )
+/*N*/ i -= INIT_SEQ_FLDTYPES;
+/*N*/ // kein break;
+/*N*/ case RES_DBFLD:
+/*N*/ case RES_USERFLD:
+/*N*/ case RES_DDEFLD:
+/*N*/ {
+/*N*/ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+/*N*/ String sFldNm( rFldTyp.GetName() );
+/*N*/ for( ; i < nSize; ++i )
+/*N*/ if( nFldWhich == (*pFldTypes)[i]->Which() &&
+/*N*/ rSCmp.isEqual( sFldNm, (*pFldTypes)[i]->GetName() ))
+/*N*/ return (*pFldTypes)[i];
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_AUTHORITY:
+/*?*/ for( ; i < nSize; ++i )
+/*?*/ if( nFldWhich == (*pFldTypes)[i]->Which() )
+/*?*/ return (*pFldTypes)[i];
+/*?*/ break;
+/*?*/
+/*?*/ default:
+/*?*/ for( i = 0; i < nSize; ++i )
+/*?*/ if( nFldWhich == (*pFldTypes)[i]->Which() )
+/*?*/ return (*pFldTypes)[i];
+/*N*/ }
+/*N*/
+/*N*/ SwFieldType* pNew = rFldTyp.Copy();
+/*N*/ switch( nFldWhich )
+/*N*/ {
+/*N*/ case RES_DDEFLD:
+/*N*/ ((SwDDEFieldType*)pNew)->SetDoc( this );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DBFLD:
+/*N*/ case RES_TABLEFLD:
+/*N*/ case RES_DATETIMEFLD:
+/*N*/ case RES_GETEXPFLD:
+/*N*/ ((SwValueFieldType*)pNew)->SetDoc( this );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_USERFLD:
+/*N*/ case RES_SETEXPFLD:
+/*N*/ ((SwValueFieldType*)pNew)->SetDoc( this );
+/*N*/ // JP 29.07.96: opt. FeldListe fuer den Calculator vorbereiten:
+/*N*/ pUpdtFlds->InsertFldType( *pNew );
+/*N*/ break;
+/*N*/ case RES_AUTHORITY :
+/*?*/ ((SwAuthorityFieldType*)pNew)->SetDoc( this );
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ pFldTypes->Insert( pNew, nSize );
+/*N*/ SetModified();
+/*N*/
+/*N*/ return (*pFldTypes)[ nSize ];
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen loeschen
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::RemoveFldType(USHORT nFld)
+/*N*/ {
+/*N*/ ASSERT( INIT_FLDTYPES <= nFld, "keine InitFields loeschen" );
+ /*
+ * Abheangige Felder vorhanden -> ErrRaise
+ */
+/*N*/ USHORT nSize = pFldTypes->Count();
+/*N*/ if(nFld < nSize)
+/*N*/ {
+/*N*/ SwFieldType* pTmp = (*pFldTypes)[nFld];
+/*N*/
+/*N*/ // JP 29.07.96: opt. FeldListe fuer den Calculator vorbereiten:
+/*N*/ USHORT nWhich = pTmp->Which();
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_SETEXPFLD:
+/*N*/ case RES_USERFLD:
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pUpdtFlds->RemoveFldType( *pTmp );
+/*?*/ // kein break;
+/*N*/ case RES_DDEFLD:
+/*?*/ if( pTmp->GetDepends() && !IsUsed( *pTmp ) )
+/*?*/ {
+/*?*/ if( RES_SETEXPFLD == nWhich )
+/*?*/ ((SwSetExpFieldType*)pTmp)->SetDeleted( TRUE );
+/*?*/ else if( RES_USERFLD == nWhich )
+/*?*/ ((SwUserFieldType*)pTmp)->SetDeleted( TRUE );
+/*?*/ else
+/*?*/ ((SwDDEFieldType*)pTmp)->SetDeleted( TRUE );
+/*?*/ nWhich = 0;
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*N*/ if( nWhich )
+/*N*/ {
+/*?*/ ASSERT( !pTmp->GetDepends(), "Abhaengige vorh.!" );
+/*?*/ // Feldtype loschen
+/*?*/ delete pTmp;
+/*N*/ }
+/*N*/ pFldTypes->Remove( nFld );
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Den ersten Typen mit ResId und Namen finden
+ --------------------------------------------------------------------*/
+
+/*N*/ SwFieldType* SwDoc::GetFldType( USHORT nResId, const String& rName ) const
+/*N*/ {
+/*N*/ USHORT nSize = pFldTypes->Count(), i = 0;
+/*N*/ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+/*N*/
+/*N*/ switch( nResId )
+/*N*/ {
+/*N*/ case RES_SETEXPFLD:
+/*N*/ //JP 29.01.96: SequenceFelder beginnen aber bei INIT_FLDTYPES - 3!!
+/*N*/ // Sonst gibt es doppelte Nummernkreise!!
+/*N*/ //MIB 14.03.95: Ab sofort verlaesst sich auch der SW3-Reader
+/*N*/ //beim Aufbau der String-Pools und beim Einlesen von SetExp-Feldern
+/*N*/ //hierauf
+/*N*/ i = INIT_FLDTYPES - INIT_SEQ_FLDTYPES;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DBFLD:
+/*N*/ case RES_USERFLD:
+/*N*/ case RES_DDEFLD:
+/*N*/ case RES_AUTHORITY:
+/*N*/ i = INIT_FLDTYPES;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ SwFieldType* pRet = 0;
+/*N*/ for( ; i < nSize; ++i )
+/*N*/ {
+/*N*/ SwFieldType* pFldType = (*pFldTypes)[i];
+/*N*/ if( nResId == pFldType->Which() &&
+/*N*/ rSCmp.isEqual( rName, pFldType->GetName() ))
+/*N*/ {
+/*N*/ pRet = pFldType;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+
+/*************************************************************************
+|* SwDoc::UpdateFlds()
+|* Beschreibung Felder updaten
+*************************************************************************/
+/*
+ * Alle sollen neu evaluiert werden.
+ */
+
+/*N*/ void SwDoc::UpdateFlds( SfxPoolItem *pNewHt, BOOL bCloseDB )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // Modify() fuer jeden Feldtypen rufen,
+/*N*/ }
+
+/******************************************************************************
+ * void SwDoc::UpdateUsrFlds()
+ ******************************************************************************/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Referenzfelder und TableFelder erneuern
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::UpdateRefFlds( SfxPoolItem* pHt )
+/*N*/ {
+/*N*/ SwFieldType* pFldType;
+/*N*/ for( USHORT i = 0; i < pFldTypes->Count(); ++i )
+/*N*/ if( RES_GETREFFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
+/*N*/ pFldType->Modify( 0, pHt );
+/*N*/ }
+
+/*N*/ void SwDoc::UpdateTblFlds( SfxPoolItem* pHt )
+/*N*/ {
+/*N*/ ASSERT( !pHt || RES_TABLEFML_UPDATE == pHt->Which(),
+/*N*/ "Was ist das fuer ein MessageItem?" );
+/*N*/
+/*N*/ SwFieldType* pFldType;
+ USHORT i=0;
+/*N*/ for( i = 0; i < pFldTypes->Count(); ++i )
+/*N*/ {
+/*N*/ if( RES_TABLEFLD == ( pFldType = (*pFldTypes)[i] )->Which() )
+/*N*/ {
+/*N*/ SwTableFmlUpdate* pUpdtFld = 0;
+/*N*/ if( pHt && RES_TABLEFML_UPDATE == pHt->Which() )
+/*N*/ pUpdtFld = (SwTableFmlUpdate*)pHt;
+/*N*/
+/*N*/ SwClientIter aIter( *pFldType );
+/*N*/ for( SwFmtFld* pFmtFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+/*N*/ pFmtFld; pFmtFld = (SwFmtFld*)aIter.Next() )
+/*N*/ if( pFmtFld->GetTxtFld() )
+/*N*/ {
+/*N*/ SwTblField* pFld = (SwTblField*)pFmtFld->GetFld();
+/*N*/
+/*N*/ if( pUpdtFld )
+/*N*/ {
+/*?*/ // bestimme Tabelle, in der das Feld steht
+/*?*/ const SwTableNode* pTblNd;
+/*?*/ const SwTxtNode& rTxtNd = pFmtFld->GetTxtFld()->GetTxtNode();
+/*?*/ if( !rTxtNd.GetNodes().IsDocNodes() ||
+/*?*/ 0 == ( pTblNd = rTxtNd.FindTableNode() ) )
+/*?*/ continue;
+/*?*/
+/*?*/ 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( SUB_CMD & pFld->GetSubType() )
+/*?*/ pFld->PtrToBoxNm( pUpdtFld->pTbl );
+/*?*/ else
+/*?*/ pFld->ChgValid( FALSE );
+/*?*/ break;
+/*?*/ case TBL_BOXNAME:
+/*?*/ // ist es die gesuchte Tabelle ??
+/*?*/ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+/*?*/ // zur externen Darstellung
+/*?*/ pFld->PtrToBoxNm( pUpdtFld->pTbl );
+/*?*/ break;
+/*?*/ case TBL_BOXPTR:
+/*?*/ // zur internen Darstellung
+/*?*/ // JP 17.06.96: interne Darstellung auf alle Formeln
+/*?*/ // (Referenzen auf andere Tabellen!!!)
+/*?*/ pFld->BoxNmToPtr( pUpdtFld->pTbl );
+/*?*/ break;
+/*?*/ case TBL_RELBOXNAME:
+/*?*/ // ist es die gesuchte Tabelle ??
+/*?*/ if( &pTblNd->GetTable() == pUpdtFld->pTbl )
+/*?*/ // zur relativen Darstellung
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pFld->ToRelBoxNm( pUpdtFld->pTbl );
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ // setze bei allen das Value-Flag zurueck
+/*?*/ pFld->ChgValid( FALSE );
+/*N*/ }
+/*N*/
+/*N*/ break;
+/*N*/ }
+/*N*/ pFldType = 0;
+/*N*/ }
+
+ // und dann noch alle Tabellen Box Formeln abklappern
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT nMaxItems = GetAttrPool().GetItemCount( RES_BOXATR_FORMULA );
+/*N*/ for( i = 0; i < nMaxItems; ++i )
+/*N*/ if( 0 != (pItem = GetAttrPool().GetItem( RES_BOXATR_FORMULA, i ) ) &&
+/*N*/ ((SwTblBoxFormula*)pItem)->GetDefinedIn() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*?*/ }
+/*?*/
+/*?*/
+/*?*/ // alle Felder/Boxen sind jetzt invalide, also kann das Rechnen anfangen
+/*?*/ if( pHt && ( RES_TABLEFML_UPDATE != pHt->Which() ||
+/*?*/ TBL_CALC != ((SwTableFmlUpdate*)pHt)->eFlags ))
+/*?*/ return ;
+/*N*/
+/*N*/ SwCalc* pCalc = 0;
+/*N*/
+/*N*/ if( pFldType )
+/*N*/ {
+/*N*/ SwClient* pLast;
+/*N*/ SwClientIter aIter( *pFldType );
+/*N*/ // dann rechne mal schoen
+/*N*/ // JP 27.03.97: Beim Berechnen am Ende anfangen - weil neue
+/*N*/ // Felder immer am Anfang der Modifykette eingefuegt
+/*N*/ // werden. Beim Import haben wir damit eine bessere/
+/*N*/ // schnellere Berechnung bei "Kettenformeln"
+/*N*/ if( 0 != ( pLast = aIter.GoEnd() ))
+/*N*/ do {
+/*N*/ SwFmtFld* pFmtFld = (SwFmtFld*)pLast;
+/*N*/ SwTblField* pFld;
+/*N*/ if( !pFmtFld->GetTxtFld() || (SUB_CMD &
+/*N*/ (pFld = (SwTblField*)pFmtFld->GetFld())->GetSubType() ))
+/*N*/ continue;
+/*N*/
+/*N*/ // muss neu berechnet werden (und ist keine textuelle Anzeige)
+/*N*/ if( !pFld->IsValid() )
+/*N*/ {
+/*N*/ // bestimme Tabelle, in der das Feld steht
+/*N*/ const SwTxtNode& rTxtNd = pFmtFld->GetTxtFld()->GetTxtNode();
+/*N*/ if( !rTxtNd.GetNodes().IsDocNodes() )
+/*N*/ continue;
+/*N*/ const SwTableNode* pTblNd = rTxtNd.FindTableNode();
+/*N*/ if( !pTblNd )
+/*N*/ continue;
+/*N*/
+/*N*/ // falls dieses Feld nicht in der zu updatenden
+/*N*/ // Tabelle steht, ueberspringen !!
+/*N*/ if( pHt && &pTblNd->GetTable() !=
+/*N*/ ((SwTableFmlUpdate*)pHt)->pTbl )
+/*N*/ continue;
+/*N*/
+/*N*/ if( !pCalc )
+/*N*/ pCalc = new SwCalc( *this );
+/*N*/
+/*N*/ // bestimme die Werte aller SetExpresion Felder, die
+/*N*/ // bis zur Tabelle gueltig sind
+/*N*/ SwFrm* pFrm = 0;
+/*N*/ if( pTblNd->GetIndex() < GetNodes().GetEndOfExtras().GetIndex() )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // steht im Sonderbereich, wird teuer !!
+/*N*/ }
+/*N*/ if( !pFrm )
+/*N*/ {
+/*N*/ // einen Index fuers bestimmen vom TextNode anlegen
+/*N*/ SwNodeIndex aIdx( rTxtNd );
+/*N*/ FldsToCalc( *pCalc,
+/*N*/ _SetGetExpFld( aIdx, pFmtFld->GetTxtFld() ));
+/*N*/ }
+/*N*/
+/*N*/ SwTblCalcPara aPara( *pCalc, pTblNd->GetTable() );
+/*N*/ pFld->CalcField( aPara );
+/*N*/ if( aPara.IsStackOverFlow() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( aPara.CalcWithStackOverflow() )
+/*N*/ }
+/*N*/ pCalc->SetCalcError( CALC_NOERR );
+/*N*/ }
+/*N*/ pFmtFld->Modify( 0, pHt );
+/*N*/ } while( 0 != ( pLast = aIter-- ));
+/*N*/ }
+/*N*/
+/*N*/ // dann berechene noch die Formeln an den Boxen
+/*N*/ for( i = 0; i < nMaxItems; ++i )
+/*N*/ if( 0 != (pItem = GetAttrPool().GetItem( RES_BOXATR_FORMULA, i ) ) &&
+/*N*/ ((SwTblBoxFormula*)pItem)->GetDefinedIn() &&
+/*N*/ !((SwTblBoxFormula*)pItem)->IsValid() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*?*/ }
+/*?*/
+/*N*/ if( pCalc )
+/*N*/ delete pCalc;
+/*N*/ }
+
+/*N*/ void SwDoc::UpdatePageFlds( SfxPoolItem* pMsgHnt )
+/*N*/ {
+/*N*/ SwFieldType* pFldType;
+/*N*/ for( USHORT i = 0; i < INIT_FLDTYPES; ++i )
+/*N*/ switch( ( pFldType = (*pFldTypes)[ i ] )->Which() )
+/*N*/ {
+/*N*/ case RES_PAGENUMBERFLD:
+/*N*/ case RES_CHAPTERFLD:
+/*N*/ case RES_GETEXPFLD:
+/*N*/ case RES_REFPAGEGETFLD:
+/*N*/ pFldType->Modify( 0, pMsgHnt );
+/*N*/ break;
+/*N*/ case RES_DOCSTATFLD:
+/*N*/ pFldType->Modify( 0, 0 );
+/*N*/ break;
+/*N*/ }
+/*N*/ SetNewFldLst();
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+// ---- Loesche alle nicht referenzierten FeldTypen eines Dokumentes --
+
+
+//----------------------------------------------------------------------
+
+// der StartIndex kann optional mit angegeben werden (z.B. wenn dieser
+// zuvor schon mal erfragt wurde - ist sonst eine virtuelle Methode !!)
+
+/*N*/ _SetGetExpFld::_SetGetExpFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld,
+/*N*/ const SwIndex* pIdx )
+/*N*/ {
+/*N*/ eSetGetExpFldType = TEXTFIELD;
+/*N*/ CNTNT.pTxtFld = pFld;
+/*N*/ nNode = rNdIdx.GetIndex();
+/*N*/ if( pIdx )
+/*N*/ nCntnt = pIdx->GetIndex();
+/*N*/ else if( pFld )
+/*N*/ nCntnt = *pFld->GetStart();
+/*N*/ else
+/*N*/ nCntnt = 0;
+/*N*/ }
+
+ //Erweiterung fuer Sections:
+ // diese haben immer als Content-Position 0xffff !!
+ // Auf dieser steht nie ein Feld, maximal bis STRING_MAXLEN moeglich
+/*N*/ _SetGetExpFld::_SetGetExpFld( const SwSectionNode& rSectNd,
+/*N*/ const SwPosition* pPos )
+/*N*/ {
+/*N*/ eSetGetExpFldType = SECTIONNODE;
+/*N*/ CNTNT.pSection = &rSectNd.GetSection();
+/*N*/
+/*N*/ if( pPos )
+/*N*/ {
+/*N*/ nNode = pPos->nNode.GetIndex();
+/*N*/ nCntnt = pPos->nContent.GetIndex();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nNode = rSectNd.GetIndex();
+/*N*/ nCntnt = 0;
+/*N*/ }
+/*N*/ }
+
+/*N*/ BOOL _SetGetExpFld::operator<( const _SetGetExpFld& rFld ) const
+/*N*/ {
+/*N*/ if( nNode < rFld.nNode || ( nNode == rFld.nNode && nCntnt < rFld.nCntnt ))
+/*N*/ return TRUE;
+/*N*/ else if( nNode != rFld.nNode || nCntnt != rFld.nCntnt )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ const SwNode *pFirst = GetNodeFromCntnt(),
+/*N*/ *pNext = rFld.GetNodeFromCntnt();
+/*N*/
+/*N*/ // Position gleich: nur weiter wenn beide FeldPointer besetzt sind !!
+/*N*/ if( !pFirst || !pNext )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ // gleiche Section ??
+/*N*/ if( pFirst->StartOfSectionNode() != pNext->StartOfSectionNode() )
+/*N*/ {
+/*N*/ // sollte einer in der Tabelle stehen ?
+/*N*/ const SwNode *pFirstStt, *pNextStt;
+/*N*/ const SwTableNode* pTblNd = pFirst->FindTableNode();
+/*N*/ if( pTblNd )
+/*N*/ pFirstStt = pTblNd->StartOfSectionNode();
+/*N*/ else
+/*N*/ pFirstStt = pFirst->StartOfSectionNode();
+/*N*/
+/*N*/ if( 0 != ( pTblNd = pNext->FindTableNode() ) )
+/*N*/ pNextStt = pTblNd->StartOfSectionNode();
+/*N*/ else
+/*N*/ pNextStt = pNext->StartOfSectionNode();
+/*N*/
+/*N*/ if( pFirstStt != pNextStt )
+/*N*/ {
+/*N*/ if( pFirst->IsTxtNode() && pNext->IsTxtNode() &&
+/*N*/ ( pFirst->FindFlyStartNode() || pNext->FindFlyStartNode() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 return ::IsFrameBehind( *(SwTxtNode*)pNext, nCntnt,
+/*N*/ }
+/*N*/ return pFirstStt->GetIndex() < pNextStt->GetIndex();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // ist gleiche Section, dann Feld im gleichen Node ?
+/*N*/ if( pFirst != pNext )
+/*N*/ return pFirst->GetIndex() < pNext->GetIndex();
+/*N*/
+/*N*/ // gleicher Node in der Section, dann Position im Node
+/*N*/ return GetCntPosFromCntnt() < rFld.GetCntPosFromCntnt();
+/*N*/ }
+
+/*N*/ const SwNode* _SetGetExpFld::GetNodeFromCntnt() const
+/*N*/ {
+/*N*/ const SwNode* pRet = 0;
+/*N*/ if( CNTNT.pTxtFld )
+/*N*/ switch( eSetGetExpFldType )
+/*N*/ {
+/*N*/ case TEXTFIELD:
+/*N*/ pRet = &CNTNT.pTxtFld->GetTxtNode();
+/*N*/ break;
+/*N*/
+/*N*/ case TEXTINET:
+/*N*/ pRet = &CNTNT.pTxtINet->GetTxtNode();
+/*N*/ break;
+/*N*/
+/*N*/ case SECTIONNODE:
+/*N*/ pRet = CNTNT.pSection->GetFmt()->GetSectionNode();
+/*N*/ break;
+/*N*/
+/*N*/ case CRSRPOS:
+/*N*/ pRet = &CNTNT.pPos->nNode.GetNode();
+/*N*/ break;
+/*N*/
+/*N*/ case TEXTTOXMARK:
+/*N*/ pRet = &CNTNT.pTxtTOX->GetTxtNode();
+/*N*/ break;
+/*N*/
+/*N*/ case TABLEBOX:
+/*N*/ if( CNTNT.pTBox->GetSttNd() )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *CNTNT.pTBox->GetSttNd() );
+/*N*/ pRet = aIdx.GetNode().GetNodes().GoNext( &aIdx );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case FLYFRAME:
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *CNTNT.pFlyFmt->GetCntnt().GetCntntIdx() );
+/*N*/ pRet = aIdx.GetNode().GetNodes().GoNext( &aIdx );
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ xub_StrLen _SetGetExpFld::GetCntPosFromCntnt() const
+/*N*/ {
+/*N*/ USHORT nRet = 0;
+/*N*/ if( CNTNT.pTxtFld )
+/*N*/ switch( eSetGetExpFldType )
+/*N*/ {
+/*N*/ case TEXTFIELD:
+/*N*/ case TEXTINET:
+/*N*/ case TEXTTOXMARK:
+/*N*/ nRet = *CNTNT.pTxtFld->GetStart();
+/*N*/ break;
+/*N*/ case CRSRPOS:
+/*N*/ nRet = CNTNT.pPos->nContent.GetIndex();
+/*N*/ break;
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ _HashStr::_HashStr( const String& rName, const String& rText,
+/*N*/ _HashStr* pNxt )
+/*N*/ : SwHash( rName ), aSetStr( rText )
+/*N*/ {
+/*N*/ pNext = pNxt;
+/*N*/ }
+
+// suche nach dem Namen, ist er vorhanden, returne seinen String, sonst
+// einen LeerString
+/*N*/ void LookString( SwHash** ppTbl, USHORT nSize, const String& rName,
+/*N*/ String& rRet, USHORT* pPos )
+/*N*/ {
+/*N*/ rRet = rName;
+/*N*/ rRet.EraseLeadingChars().EraseTrailingChars();
+/*N*/ SwHash* pFnd = Find( rRet, ppTbl, nSize, pPos );
+/*N*/ if( pFnd )
+/*N*/ rRet = ((_HashStr*)pFnd)->aSetStr;
+/*N*/ else
+/*N*/ rRet.Erase();
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*?*/ String lcl_GetDBVarName( SwDoc& rDoc, SwDBNameInfField& rDBFld )
+/*?*/ {
+/*?*/ SwDBData aDBData( rDBFld.GetDBData( &rDoc ));
+/*?*/ String sDBNumNm;
+/*?*/ SwDBData aDocData = rDoc.GetDBData();
+/*?*/
+/*?*/ if( aDBData != aDocData )
+/*?*/ {
+/*?*/ sDBNumNm = aDBData.sDataSource;
+/*?*/ sDBNumNm += DB_DELIM;
+/*?*/ sDBNumNm += String(aDBData.sCommand);
+/*?*/ sDBNumNm += DB_DELIM;
+/*?*/ }
+/*?*/ sDBNumNm += SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD);
+/*?*/
+/*?*/ return sDBNumNm;
+/*?*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void lcl_CalcFld( SwDoc& rDoc, SwCalc& rCalc, const _SetGetExpFld& rSGEFld,
+/*N*/ SwNewDBMgr* pMgr )
+/*N*/ {
+/*N*/ const SwTxtFld* pTxtFld = rSGEFld.GetFld();
+/*N*/ if( !pTxtFld )
+/*N*/ return ;
+/*N*/
+/*N*/ const SwField* pFld = pTxtFld->GetFld().GetFld();
+/*N*/ const USHORT nFldWhich = pFld->GetTyp()->Which();
+/*N*/
+/*N*/ if( RES_SETEXPFLD == nFldWhich )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwSbxValue aValue;
+/*?*/ }
+/*?*/ else if( pMgr )
+/*?*/ {
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::FldsToCalc( SwCalc& rCalc, const _SetGetExpFld& rToThisFld )
+/*N*/ {
+/*N*/ // erzeuge die Sortierteliste aller SetFelder
+/*N*/ pUpdtFlds->MakeFldList( *this, bNewFldLst, GETFLD_CALC );
+/*N*/ bNewFldLst = FALSE;
+/*N*/
+/*N*/ SwNewDBMgr* pMgr = GetNewDBMgr();
+/*N*/ pMgr->CloseAll(FALSE);
+/*N*/
+/*N*/ if( pUpdtFlds->GetSortLst()->Count() )
+/*N*/ {
+/*N*/ USHORT nLast;
+/*N*/ _SetGetExpFld* pFld = (_SetGetExpFld*)&rToThisFld;
+/*N*/ if( pUpdtFlds->GetSortLst()->Seek_Entry( pFld, &nLast ) )
+/*N*/ ++nLast;
+/*N*/
+/*N*/ const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData();
+/*N*/ for( USHORT n = 0; n < nLast; ++n, ++ppSortLst )
+/*N*/ lcl_CalcFld( *this, rCalc, **ppSortLst, pMgr );
+/*N*/ }
+/*N*/
+/*N*/ pMgr->CloseAll(FALSE);
+/*N*/ }
+
+
+
+
+/*N*/ void SwDoc::UpdateExpFlds( SwTxtFld* pUpdtFld, BOOL bUpdRefFlds )
+/*N*/ {
+/*N*/ if( IsExpFldsLocked() || IsInReading() )
+/*N*/ return;
+/*N*/
+/*N*/ BOOL bOldInUpdateFlds = pUpdtFlds->IsInUpdateFlds();
+/*N*/ pUpdtFlds->SetInUpdateFlds( TRUE );
+/*N*/
+/*N*/ pUpdtFlds->MakeFldList( *this, TRUE, GETFLD_ALL );
+/*N*/ bNewFldLst = FALSE;
+/*N*/
+/*N*/ if( !pUpdtFlds->GetSortLst()->Count() )
+/*N*/ {
+/*N*/ if( bUpdRefFlds )
+/*N*/ UpdateRefFlds();
+/*N*/
+/*N*/ pUpdtFlds->SetInUpdateFlds( bOldInUpdateFlds );
+/*N*/ pUpdtFlds->SetFieldsDirty( FALSE );
+/*N*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ USHORT nWhich, n;
+/*N*/
+/*N*/ // HashTabelle fuer alle String Ersetzungen, wird "one the fly" gefuellt
+/*N*/ // (versuche eine "ungerade"-Zahl zu erzeugen)
+/*N*/ USHORT nStrFmtCnt = (( pFldTypes->Count() / 7 ) + 1 ) * 7;
+/*N*/ SwHash** pHashStrTbl = new SwHash*[ nStrFmtCnt ];
+/*N*/ memset( pHashStrTbl, 0, sizeof( _HashStr* ) * nStrFmtCnt );
+/*N*/
+/*N*/ {
+/*N*/ const SwFieldType* pFldType;
+/*N*/ // gesondert behandeln:
+/*N*/ for( n = pFldTypes->Count(); n; )
+/*N*/ switch( ( pFldType = (*pFldTypes)[ --n ] )->Which() )
+/*N*/ {
+/*N*/ case RES_USERFLD:
+/*N*/ {
+/*N*/ // Eintrag vorhanden ?
+/*N*/ USHORT nPos;
+/*N*/ const String& rNm = pFldType->GetName();
+/*N*/ String sExpand(((SwUserFieldType*)pFldType)->Expand(GSE_STRING, 0, 0));
+/*N*/ SwHash* pFnd = Find( rNm, pHashStrTbl, nStrFmtCnt, &nPos );
+/*N*/ if( pFnd )
+/*N*/ // Eintrag in der HashTabelle aendern ??
+/*?*/ ((_HashStr*)pFnd)->aSetStr = sExpand;
+/*N*/ else
+/*N*/ // neuen Eintrag einfuegen
+/*N*/ *(pHashStrTbl + nPos ) = new _HashStr( rNm, sExpand,
+/*N*/ (_HashStr*)*(pHashStrTbl + nPos) );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_SETEXPFLD:
+/*N*/ ((SwSetExpFieldType*)pFldType)->SetOutlineChgNd( 0 );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Ok, das Array ist soweit mit allen Feldern gefuellt, dann rechne mal
+/*N*/ SwCalc aCalc( *this );
+/*N*/
+/*N*/ String sDBNumNm( SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) );
+/*N*/
+/*N*/ // aktuelle Datensatznummer schon vorher einstellen
+/*N*/ SwNewDBMgr* pMgr = GetNewDBMgr();
+/*N*/ pMgr->CloseAll(FALSE);
+/*
+ if(pMgr && pMgr->OpenDB(DBMGR_STD, GetDBDesc(), FALSE))
+ {
+ if(!pMgr->IsInMerge() )
+ pMgr->ToFirstSelectedRecord(DBMGR_STD);
+
+ aCalc.VarChange( sDBNumNm, pMgr->GetCurSelectedRecordId(DBMGR_STD));
+ }
+ */
+/*N*/
+/*N*/ String aNew;
+/*N*/ const _SetGetExpFldPtr* ppSortLst = pUpdtFlds->GetSortLst()->GetData();
+/*N*/ for( n = pUpdtFlds->GetSortLst()->Count(); n; --n, ++ppSortLst )
+/*N*/ {
+/*N*/ SwSection* pSect = (SwSection*)(*ppSortLst)->GetSection();
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ //!SECTION
+/*N*/
+/*N*/ // if( pGFld->IsInBodyTxt() )
+/*N*/ pSect->SetCondHidden( aCalc.Calculate(
+/*N*/ pSect->GetCondition() ).GetBool() );
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ SwTxtFld* pTxtFld = (SwTxtFld*)(*ppSortLst)->GetFld();
+/*N*/ if( !pTxtFld )
+/*N*/ {
+/*N*/ ASSERT( !this, "was ist es denn nun" );
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ SwFmtFld* pFmtFld = (SwFmtFld*)&pTxtFld->GetFld();
+/*N*/ SwField* pFld = pFmtFld->GetFld();
+/*N*/
+/*N*/ switch( nWhich = pFld->GetTyp()->Which() )
+/*N*/ {
+/*N*/ case RES_HIDDENTXTFLD:
+/*N*/ {
+/*?*/ SwHiddenTxtField* pHFld = (SwHiddenTxtField*)pFld;
+/*?*/ pHFld->SetValue( !aCalc.Calculate( pHFld->GetPar1() ).GetBool());
+/*?*/ // Feld Evaluieren
+/*?*/ pHFld->Evaluate(this);
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_HIDDENPARAFLD:
+/*N*/ {
+/*?*/ SwHiddenParaField* pHPFld = (SwHiddenParaField*)pFld;
+/*?*/ pHPFld->SetHidden( aCalc.Calculate( pHPFld->GetPar1() ).GetBool());
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_DBSETNUMBERFLD:
+/*N*/ {
+/*?*/ ((SwDBSetNumberField*)pFld)->Evaluate(this);
+/*?*/ aCalc.VarChange( sDBNumNm, ((SwDBSetNumberField*)pFld)->GetSetNumber());
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_DBNEXTSETFLD:
+/*N*/ case RES_DBNUMSETFLD:
+/*N*/ UpdateDBNumFlds( *(SwDBNameInfField*)pFld, aCalc );
+/*N*/ break;
+/*N*/ case RES_DBFLD:
+/*N*/ {
+/*N*/ // Feld Evaluieren
+/*N*/ ((SwDBField*)pFld)->Evaluate();
+/*N*/
+/*N*/ SwDBData aDBData(((SwDBField*)pFld)->GetDBData());
+/*N*/
+/*N*/ if( pMgr->IsDataSourceOpen(aDBData.sDataSource, aDBData.sCommand, sal_False))
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 aCalc.VarChange( sDBNumNm, pMgr->GetSelectedRecordId(aDBData.sDataSource, aDBData.sCommand, aDBData.nCommandType));
+/*N*/
+/*N*/ const String& rName = pFld->GetTyp()->GetName();
+/*N*/
+/*N*/ // Wert fuer den Calculator setzen
+/*N*/ //JP 10.02.96: GetValue macht hier doch keinen Sinn
+/*N*/ // ((SwDBField*)pFld)->GetValue();
+/*N*/
+/*N*/ //!OK aCalc.VarChange(aName, ((SwDBField*)pFld)->GetValue(aCalc));
+/*N*/
+/*N*/ // Eintrag in den HashTable eintragen
+/*N*/ // Eintrag vorhanden ?
+/*N*/ USHORT nPos;
+/*N*/ SwHash* pFnd = Find( rName, pHashStrTbl, nStrFmtCnt, &nPos );
+/*N*/ if( pFnd )
+/*N*/ // Eintrag in der HashTabelle aendern
+/*?*/ ((_HashStr*)pFnd)->aSetStr = pFld->Expand();
+/*N*/ else
+/*N*/ // neuen Eintrag einfuegen
+/*N*/ *(pHashStrTbl + nPos ) = new _HashStr( rName,
+/*N*/ pFld->Expand(), (_HashStr*)*(pHashStrTbl + nPos));
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_GETEXPFLD:
+/*N*/ case RES_SETEXPFLD:
+/*N*/ {
+/*N*/ if( GSE_STRING & pFld->GetSubType() ) // String Ersetzung
+/*?*/ {
+/*?*/ if( RES_GETEXPFLD == nWhich )
+/*?*/ {
+/*?*/ SwGetExpField* pGFld = (SwGetExpField*)pFld;
+/*?*/
+/*?*/ if( (!pUpdtFld || pUpdtFld == pTxtFld )
+/*?*/ && pGFld->IsInBodyTxt() )
+/*?*/ {
+/*?*/ LookString( pHashStrTbl, nStrFmtCnt,
+/*?*/ pGFld->GetFormula(), aNew );
+/*?*/ pGFld->ChgExpStr( aNew );
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ SwSetExpField* pSFld = (SwSetExpField*)pFld;
+/*?*/ // ist die "Formel" ein Feld ??
+/*?*/ LookString( pHashStrTbl, nStrFmtCnt,
+/*?*/ pSFld->GetFormula(), aNew );
+/*?*/
+/*?*/ if( !aNew.Len() ) // nichts gefunden, dann ist die
+/*?*/ aNew = pSFld->GetFormula(); // Formel der neue Wert
+/*?*/
+/*?*/ // nur ein spezielles FeldUpdaten ?
+/*?*/ if( !pUpdtFld || pUpdtFld == pTxtFld )
+/*?*/ pSFld->ChgExpStr( aNew );
+/*?*/
+/*?*/ // suche den Namen vom Feld
+/*?*/ aNew = ((SwSetExpFieldType*)pSFld->GetTyp())->GetSetRefName();
+/*?*/ // Eintrag vorhanden ?
+/*?*/ USHORT nPos;
+/*?*/ SwHash* pFnd = Find( aNew, pHashStrTbl, nStrFmtCnt, &nPos );
+/*?*/ if( pFnd )
+/*?*/ // Eintrag in der HashTabelle aendern
+/*?*/ ((_HashStr*)pFnd)->aSetStr = pSFld->GetExpStr();
+/*?*/ else
+/*?*/ // neuen Eintrag einfuegen
+/*?*/ *(pHashStrTbl + nPos ) = pFnd = new _HashStr( aNew,
+/*?*/ pSFld->GetExpStr(),
+/*?*/ (_HashStr*)*(pHashStrTbl + nPos) );
+/*?*/
+/*?*/ // Erweiterung fuers Rechnen mit Strings
+/*?*/ SwSbxValue aValue;
+/*?*/ aValue.PutString( ((_HashStr*)pFnd)->aSetStr );
+/*?*/ aCalc.VarChange( aNew, aValue );
+/*?*/ }
+/*?*/ }
+/*N*/ else // Formel neu berechnen
+/*N*/ {
+/*N*/ if( RES_GETEXPFLD == nWhich )
+/*N*/ {
+/*?*/ SwGetExpField* pGFld = (SwGetExpField*)pFld;
+/*?*/
+/*?*/ if( (!pUpdtFld || pUpdtFld == pTxtFld )
+/*?*/ && pGFld->IsInBodyTxt() )
+/*?*/ {
+/*?*/ pGFld->SetValue(aCalc.Calculate(
+/*?*/ pGFld->GetFormula() ).GetDouble() );
+/*?*/ }
+/*?*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwSetExpField* pSFld = (SwSetExpField*)pFld;
+/*N*/ SwSetExpFieldType* pSFldTyp = (SwSetExpFieldType*)pFld->GetTyp();
+/*N*/ aNew = pSFldTyp->GetName();
+/*N*/
+/*N*/ SwNode* pSeqNd = 0;
+/*N*/
+/*N*/ if( pSFld->IsSequenceFld() )
+/*N*/ {
+/*N*/ BYTE nLvl = pSFldTyp->GetOutlineLvl();
+/*N*/ if( MAXLEVEL > nLvl )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // dann teste, ob die Nummer neu aufsetzen muss
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ aNew += '=';
+/*N*/ aNew += pSFld->GetFormula();
+/*N*/
+/*N*/ double nErg = aCalc.Calculate( aNew ).GetDouble();
+/*N*/ // nur ein spezielles Feld updaten ?
+/*N*/ if( !pUpdtFld || pUpdtFld == pTxtFld )
+/*N*/ {
+/*N*/ pSFld->SetValue( nErg );
+/*N*/
+/*N*/ if( pSeqNd )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pSFldTyp->SetChapter( *pSFld, *pSeqNd );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ } // switch
+/*N*/
+/*N*/ pFmtFld->Modify( 0, 0 ); // Formatierung anstossen
+/*N*/
+/*N*/ if( pUpdtFld == pTxtFld ) // sollte nur dieses geupdatet werden
+/*N*/ {
+/*?*/ if( RES_GETEXPFLD == nWhich || // nur GetFeld oder
+/*?*/ RES_HIDDENTXTFLD == nWhich || // HiddenTxt?
+/*?*/ RES_HIDDENPARAFLD == nWhich) // HiddenParaFld?
+/*?*/ break; // beenden
+/*?*/ pUpdtFld = 0; // ab jetzt alle Updaten
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pMgr->CloseAll(FALSE);
+/*N*/ // HashTabelle wieder loeschen
+/*N*/ ::binfilter::DeleteHashTable( pHashStrTbl, nStrFmtCnt );
+/*N*/
+/*N*/ // Referenzfelder updaten
+/*N*/ if( bUpdRefFlds )
+/*?*/ UpdateRefFlds();
+/*N*/
+/*N*/ pUpdtFlds->SetInUpdateFlds( bOldInUpdateFlds );
+/*N*/ pUpdtFlds->SetFieldsDirty( FALSE );
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& rCalc )
+/*N*/ {
+/*N*/ SwNewDBMgr* pMgr = GetNewDBMgr();
+/*?*/
+/*?*/ USHORT nFldType = rDBFld.Which();
+/*?*/
+/*?*/ BOOL bPar1 = rCalc.Calculate( rDBFld.GetPar1() ).GetBool();
+/*?*/
+/*?*/ if( RES_DBNEXTSETFLD == nFldType )
+/*?*/ ((SwDBNextSetField&)rDBFld).SetCondValid( bPar1 );
+/*?*/ else
+/*?*/ ((SwDBNumSetField&)rDBFld).SetCondValid( bPar1 );
+/*?*/
+/*?*/ if( rDBFld.GetRealDBData().sDataSource.getLength() )
+/*?*/ {
+/*?*/ // Eine bestimmte Datenbank bearbeiten
+/*?*/ if( RES_DBNEXTSETFLD == nFldType )
+/*?*/ ((SwDBNextSetField&)rDBFld).Evaluate(this);
+/*?*/ else
+/*?*/ ((SwDBNumSetField&)rDBFld).Evaluate(this);
+/*?*/
+/*?*/ SwDBData aDBData( rDBFld.GetDBData(this) );
+/*?*/
+/*?*/ if( pMgr->OpenDataSource( aDBData.sDataSource, aDBData.sCommand ))
+/*?*/ rCalc.VarChange( lcl_GetDBVarName( *this, rDBFld),
+/*?*/ pMgr->GetSelectedRecordId(aDBData.sDataSource, aDBData.sCommand, aDBData.nCommandType) );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ DBG_ERROR("TODO: what should happen with unnamed DBFields?");
+/*?*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::_InitFieldTypes() // wird vom CTOR gerufen!!
+/*N*/ {
+/*N*/ // Feldtypen
+/*N*/ USHORT nFldType = 0;
+/*N*/ pFldTypes->Insert( new SwDateTimeFieldType(this), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwChapterFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwPageNumberFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwAuthorFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwFileNameFieldType(this), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwDBNameFieldType(this), nFldType++);
+/*N*/ pFldTypes->Insert( new SwGetExpFieldType(this), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwGetRefFieldType( this ), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwHiddenTxtFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwPostItFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwDocStatFieldType(this), nFldType++);
+/*N*/ pFldTypes->Insert( new SwDocInfoFieldType(this), nFldType++);
+/*N*/ pFldTypes->Insert( new SwInputFieldType( this ), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwTblFieldType( this ), nFldType++);
+/*N*/ pFldTypes->Insert( new SwMacroFieldType(this), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwHiddenParaFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwDBNextSetFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwDBNumSetFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwDBSetNumberFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwTemplNameFieldType(this), nFldType++);
+/*N*/ pFldTypes->Insert( new SwTemplNameFieldType(this),nFldType++);
+/*N*/ pFldTypes->Insert( new SwExtUserFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwRefPageSetFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwRefPageGetFieldType( this ), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwJumpEditFieldType( this ), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwScriptFieldType( this ), nFldType++ );
+/*N*/ pFldTypes->Insert( new SwCombinedCharFieldType, nFldType++ );
+/*N*/ pFldTypes->Insert( new SwDropDownFieldType, nFldType++ );
+/*N*/
+/*N*/ // Types muessen am Ende stehen !!
+/*N*/ // Im InsertFldType wird davon ausgegangen !!!!
+/*N*/ // MIB 14.04.95: Im Sw3StringPool::Setup (sw3imp.cxx) und
+/*N*/ // lcl_sw3io_InSetExpField (sw3field.cxx) jetzt auch
+/*N*/ pFldTypes->Insert( new SwSetExpFieldType(this,
+/*N*/ SW_RESSTR(STR_POOLCOLL_LABEL_ABB), GSE_SEQ), nFldType++);
+/*N*/ pFldTypes->Insert( new SwSetExpFieldType(this,
+/*N*/ SW_RESSTR(STR_POOLCOLL_LABEL_TABLE), GSE_SEQ),nFldType++);
+/*N*/ pFldTypes->Insert( new SwSetExpFieldType(this,
+/*N*/ SW_RESSTR(STR_POOLCOLL_LABEL_FRAME), GSE_SEQ),nFldType++);
+/*N*/ pFldTypes->Insert( new SwSetExpFieldType(this,
+/*N*/ SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING), GSE_SEQ),nFldType++);
+/*N*/
+/*N*/ ASSERT( nFldType == INIT_FLDTYPES, "Bad initsize: SwFldTypes" );
+/*N*/ }
+
+/*N*/ void SwDoc::InsDelFldInFldLst( BOOL bIns, const SwTxtFld& rFld )
+/*N*/ {
+/*N*/ if( !bNewFldLst || !IsInDtor() )
+/*N*/ pUpdtFlds->InsDelFldInFldLst( bIns, rFld );
+/*N*/ }
+
+/*N*/ SwDBData SwDoc::GetDBData()
+/*N*/ {
+/*N*/ return GetDBDesc();
+/*N*/ }
+
+/*N*/ const SwDBData& SwDoc::GetDBDesc()
+/*N*/ {
+/*N*/ if(!aDBData.sDataSource.getLength())
+/*N*/ {
+/*N*/ const USHORT nSize = pFldTypes->Count();
+/*N*/ for(USHORT i = 0; i < nSize && !aDBData.sDataSource.getLength(); ++i)
+/*N*/ {
+/*N*/ SwFieldType& rFldType = *((*pFldTypes)[i]);
+/*N*/ USHORT nWhich = rFldType.Which();
+/*N*/ if(IsUsed(rFldType))
+/*N*/ {
+/*N*/ switch(nWhich)
+/*N*/ {
+/*N*/ case RES_DBFLD:
+/*N*/ case RES_DBNEXTSETFLD:
+/*N*/ case RES_DBNUMSETFLD:
+/*N*/ case RES_DBSETNUMBERFLD:
+/*N*/ {
+/*N*/ SwClientIter aIter( rFldType );
+/*N*/ SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+/*N*/ while(pFld)
+/*N*/ {
+/*N*/ if(pFld->IsFldInDoc())
+/*N*/ {
+/*N*/ if(RES_DBFLD == nWhich)
+/*N*/ aDBData =
+/*N*/ (static_cast < SwDBFieldType * > (pFld->GetFld()->GetTyp()))
+/*N*/ ->GetDBData();
+/*N*/ else
+/*N*/ aDBData = (static_cast < SwDBNameInfField* > (pFld->GetFld()))->GetRealDBData();
+/*N*/ break;
+/*N*/ }
+/*N*/ pFld = (SwFmtFld*)aIter.Next();
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if(!aDBData.sDataSource.getLength())
+/*N*/ aDBData = GetNewDBMgr()->GetAddressDBName();
+/*N*/ return aDBData;
+/*N*/ }
+
+/*N*/ void SwDoc::SetInitDBFields( BOOL b )
+/*N*/ {
+/*N*/ GetNewDBMgr()->SetInitDBFields( b );
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Alle von Feldern verwendete Datenbanken herausfinden
+ --------------------------------------------------------------------*/
+/*N*/ String lcl_DBDataToString(const SwDBData& rData)
+/*N*/ {
+/*N*/ String sRet = rData.sDataSource;
+/*N*/ sRet += DB_DELIM;
+/*N*/ sRet += (String)rData.sCommand;
+/*N*/ sRet += DB_DELIM;
+/*N*/ sRet += String::CreateFromInt32(rData.nCommandType);
+/*N*/ return sRet;
+/*N*/ }
+/*N*/ void SwDoc::GetAllUsedDB( SvStringsDtor& rDBNameList,
+/*N*/ const SvStringsDtor* pAllDBNames )
+/*N*/ {
+/*N*/ USHORT n;
+/*N*/ SvStringsDtor aUsedDBNames;
+/*N*/ SvStringsDtor aAllDBNames;
+/*N*/
+/*N*/ if( !pAllDBNames )
+/*N*/ {
+/*N*/ GetAllDBNames( aAllDBNames );
+/*N*/ pAllDBNames = &aAllDBNames;
+/*N*/ }
+/*N*/
+/*N*/ SwSectionFmts& rArr = GetSections();
+/*N*/ for( n = rArr.Count(); n; )
+/*N*/ {
+/*N*/ SwSection* pSect = rArr[ --n ]->GetSection();
+/*N*/
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ String aCond( pSect->GetCondition() );
+/*N*/ AddUsedDBToList( rDBNameList, FindUsedDBs( *pAllDBNames,
+/*N*/ aCond, aUsedDBNames ) );
+/*N*/ aUsedDBNames.DeleteAndDestroy( 0, aUsedDBNames.Count() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT nMaxItems = GetAttrPool().GetItemCount( RES_TXTATR_FIELD );
+/*N*/ for( n = 0; n < nMaxItems; ++n )
+/*N*/ {
+/*N*/ if( 0 == (pItem = GetAttrPool().GetItem( RES_TXTATR_FIELD, n ) ))
+/*N*/ continue;
+/*N*/
+/*N*/ const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
+/*N*/ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+/*N*/ if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwField* pFld = pFmtFld->GetFld();
+/*N*/ switch( pFld->GetTyp()->Which() )
+/*N*/ {
+/*N*/ case RES_DBFLD:
+/*N*/ AddUsedDBToList( rDBNameList,
+/*N*/ lcl_DBDataToString(((SwDBField*)pFld)->GetDBData() ));
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DBSETNUMBERFLD:
+/*N*/ case RES_DBNAMEFLD:
+/*N*/ AddUsedDBToList( rDBNameList,
+/*N*/ lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData() ));
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DBNUMSETFLD:
+/*N*/ case RES_DBNEXTSETFLD:
+/*N*/ AddUsedDBToList( rDBNameList,
+/*N*/ lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData() ));
+/*N*/ // kein break // JP: ist das so richtig ??
+/*N*/
+/*N*/ case RES_HIDDENTXTFLD:
+/*N*/ case RES_HIDDENPARAFLD:
+/*N*/ AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
+/*N*/ pFld->GetPar1(), aUsedDBNames ));
+/*N*/ aUsedDBNames.DeleteAndDestroy( 0, aUsedDBNames.Count() );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_SETEXPFLD:
+/*N*/ case RES_GETEXPFLD:
+/*N*/ case RES_TABLEFLD:
+/*N*/ AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames,
+/*N*/ pFld->GetFormula(), aUsedDBNames ));
+/*N*/ aUsedDBNames.DeleteAndDestroy( 0, aUsedDBNames.Count() );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::GetAllDBNames( SvStringsDtor& rAllDBNames )
+/*N*/ {
+/*N*/ SwNewDBMgr* pMgr = GetNewDBMgr();
+/*N*/
+/*N*/ const SwDSParamArr& rArr = pMgr->GetDSParamArray();
+/*N*/ for(USHORT i = 0; i < rArr.Count(); i++)
+/*N*/ {
+/*N*/ SwDSParam* pParam = rArr[i];
+/*N*/ String* pStr = new String( pParam->sDataSource );
+/*N*/ (*pStr) += DB_DELIM;
+/*N*/ (*pStr) += (String)pParam->sCommand;
+/*N*/ rAllDBNames.Insert( pStr, rAllDBNames.Count() );
+/*N*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ SvStringsDtor& SwDoc::FindUsedDBs( const SvStringsDtor& rAllDBNames,
+/*N*/ const String& rFormel,
+/*N*/ SvStringsDtor& rUsedDBNames )
+/*N*/ {
+/*N*/ const CharClass& rCC = GetAppCharClass();
+/*N*/ String sFormel( rFormel);
+/*N*/ #ifndef UNX
+/*N*/ rCC.toUpper( sFormel );
+/*N*/ #endif
+/*N*/
+/*N*/ xub_StrLen nPos;
+/*N*/ for (USHORT i = 0; i < rAllDBNames.Count(); ++i )
+/*N*/ {
+/*N*/ const String* pStr = rAllDBNames.GetObject(i);
+/*N*/
+/*N*/ if( STRING_NOTFOUND != (nPos = sFormel.Search( *pStr )) &&
+/*N*/ sFormel.GetChar( nPos + pStr->Len() ) == '.' &&
+/*N*/ (!nPos || !rCC.isLetterNumeric( sFormel, nPos - 1 )))
+/*N*/ {
+/*N*/ // Tabellenname suchen
+/*?*/ xub_StrLen nEndPos;
+/*?*/ nPos += pStr->Len() + 1;
+/*?*/ if( STRING_NOTFOUND != (nEndPos = sFormel.Search('.', nPos)) )
+/*?*/ {
+/*?*/ String* pDBNm = new String( *pStr );
+/*?*/ pDBNm->Append( DB_DELIM );
+/*?*/ pDBNm->Append( sFormel.Copy( nPos, nEndPos - nPos ));
+/*?*/ rUsedDBNames.Insert( pDBNm, rUsedDBNames.Count() );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ return rUsedDBNames;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::AddUsedDBToList( SvStringsDtor& rDBNameList,
+/*N*/ const SvStringsDtor& rUsedDBNames )
+/*N*/ {
+/*N*/ for (USHORT i = 0; i < rUsedDBNames.Count(); i++)
+/*?*/ AddUsedDBToList( rDBNameList, *rUsedDBNames.GetObject(i) );
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::AddUsedDBToList( SvStringsDtor& rDBNameList, const String& rDBName)
+/*N*/ {
+/*N*/ if( !rDBName.Len() )
+/*N*/ return;
+/*N*/
+/*N*/ #ifdef UNX
+/*N*/ for( USHORT i = 0; i < rDBNameList.Count(); ++i )
+/*N*/ if( rDBName == rDBNameList.GetObject(i)->GetToken(0) )
+/*N*/ return;
+/*N*/ #else
+/*N*/ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+/*N*/ for( USHORT i = 0; i < rDBNameList.Count(); ++i )
+/*N*/ if( rSCmp.isEqual( rDBName, rDBNameList.GetObject(i)->GetToken(0) ) )
+/*N*/ return;
+/*N*/ #endif
+/*N*/
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = rDBName.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = rDBName.GetToken(1, DB_DELIM);
+/*N*/ aData.nCommandType = -1;
+/*N*/ const SwDSParam* pParam = GetNewDBMgr()->CreateDSData(aData);
+/*N*/ String* pNew = new String( rDBName );
+/*N*/ rDBNameList.Insert( pNew, rDBNameList.Count() );
+/*N*/ }
+
+/*N*/ BOOL SwDoc::SetFieldsDirty( BOOL b, const SwNode* pChk, ULONG nLen )
+/*N*/ {
+/*N*/ // teste ggfs. mal, ob die angegbenen Nodes ueberhaupt Felder beinhalten.
+/*N*/ // wenn nicht, braucht das Flag nicht veraendert werden.
+/*N*/ BOOL bFldsFnd = FALSE;
+/*N*/ if( b && pChk && !GetUpdtFlds().IsFieldsDirty() && !IsInDtor()
+/*N*/ // ?? was ist mit Undo, da will man es doch auch haben !!
+/*N*/ /*&& &pChk->GetNodes() == &GetNodes()*/ )
+/*N*/ {
+/*N*/ b = FALSE;
+/*N*/ if( !nLen )
+/*N*/ ++nLen;
+/*N*/ ULONG nStt = pChk->GetIndex();
+/*N*/ const SwNodes& rNds = pChk->GetNodes();
+/*N*/ while( nLen-- )
+/*N*/ {
+/*N*/ const SwTxtNode* pTNd = rNds[ nStt++ ]->GetTxtNode();
+/*N*/ if( pTNd )
+/*N*/ {
+/*N*/ if( pTNd->GetFmtColl() &&
+/*N*/ MAXLEVEL > pTNd->GetTxtColl()->GetOutlineLevel() )
+/*N*/ // Kapitelfelder aktualisieren
+/*N*/ b = TRUE;
+/*N*/ else if( pTNd->GetpSwpHints() && pTNd->GetSwpHints().Count() )
+/*N*/ for( USHORT n = 0, nEnd = pTNd->GetSwpHints().Count();
+/*N*/ n < nEnd; ++n )
+/*N*/ {
+/*N*/ const SwTxtAttr* pAttr = pTNd->GetSwpHints()[ n ];
+/*N*/ if( RES_TXTATR_FIELD == pAttr->Which() )
+/*N*/ {
+/*N*/ b = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( b )
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ bFldsFnd = b;
+/*N*/ }
+/*N*/ GetUpdtFlds().SetFieldsDirty( b );
+/*N*/ return bFldsFnd;
+/*N*/ }
+/* -----------------------------21.12.99 12:55--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDocUpdtFld::InsDelFldInFldLst( BOOL bIns, const SwTxtFld& rFld )
+/*N*/ {
+/*N*/ USHORT nWhich = rFld.GetFld().GetFld()->GetTyp()->Which();
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_DBFLD:
+/*N*/ case RES_SETEXPFLD:
+/*N*/ case RES_HIDDENPARAFLD:
+/*N*/ case RES_HIDDENTXTFLD:
+/*N*/ case RES_DBNUMSETFLD:
+/*N*/ case RES_DBNEXTSETFLD:
+/*N*/ case RES_DBSETNUMBERFLD:
+/*N*/ case RES_GETEXPFLD:
+/*N*/ break; // diese muessen ein-/ausgetragen werden!
+/*N*/
+/*N*/ default:
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ SetFieldsDirty( TRUE );
+/*N*/ if( !pFldSortLst )
+/*N*/ {
+/*?*/ if( !bIns ) // keine Liste vorhanden und loeschen
+/*?*/ return; // dann nichts tun
+/*?*/ pFldSortLst = new _SetGetExpFlds( 64, 16 );
+/*N*/ }
+/*N*/
+/*N*/ if( bIns ) // neu einfuegen:
+/*N*/ GetBodyNode( rFld, nWhich );
+/*N*/ else
+/*N*/ {
+/*?*/ // ueber den pTxtFld Pointer suchen. Ist zwar eine Sortierte
+/*?*/ // Liste, aber nach Node-Positionen sortiert. Bis dieser
+/*?*/ // bestimmt ist, ist das Suchen nach dem Pointer schon fertig
+/*?*/ for( USHORT n = 0; n < pFldSortLst->Count(); ++n )
+/*?*/ if( &rFld == (*pFldSortLst)[ n ]->GetPointer() )
+/*?*/ pFldSortLst->DeleteAndDestroy( n--, 1 );
+/*?*/ // ein Feld kann mehrfach vorhanden sein!
+/*N*/ }
+/*N*/ }
+
+/*M*/ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode )
+/*M*/ {
+/*M*/ // neue Version: gehe ueber alle Felder vom Attribut-Pool
+/*M*/ if( pFldSortLst )
+/*M*/ delete pFldSortLst;
+/*M*/ pFldSortLst = new _SetGetExpFlds( 64, 16 );
+/*M*/
+/*M*/ /// OD 09.08.2002 [#101207#,#101216#,#101778#] - consider and unhide sections
+/*M*/ /// with hide condition, only in mode GETFLD_ALL (<eGetMode == GETFLD_ALL>)
+/*M*/ /// notes by OD:
+/*M*/ /// eGetMode == GETFLD_CALC in call from methods SwDoc::FldsToCalc
+/*M*/ /// eGetMode == GETFLD_EXPAND in call from method SwDoc::FldsToExpand
+/*M*/ /// eGetMode == GETFLD_ALL in call from method SwDoc::UpdateExpFlds
+/*M*/ /// I figured out that hidden section only have to be shown,
+/*M*/ /// if fields have updated (call by SwDoc::UpdateExpFlds) and thus
+/*M*/ /// the hide conditions of section have to be updated.
+/*M*/ /// For correct updating the hide condition of a section, its position
+/*M*/ /// have to be known in order to insert the hide condition as a new
+/*M*/ /// expression field into the sorted field list (<pFldSortLst>).
+/*M*/ if ( eGetMode == GETFLD_ALL )
+/*M*/ // zuerst die Bereiche einsammeln. Alle die ueber Bedingung
+/*M*/ // gehiddet sind, wieder mit Frames versorgen, damit die darin
+/*M*/ // enthaltenen Felder richtig einsortiert werden!!!
+/*M*/ {
+/*M*/ // damit die Frames richtig angelegt werden, muessen sie in der
+/*M*/ // Reihenfolgen von oben nach unten expandiert werden
+/*M*/ SvULongs aTmpArr;
+/*M*/ SwSectionFmts& rArr = rDoc.GetSections();
+/*M*/ SwSectionNode* pSectNd;
+/*M*/ USHORT nArrStt = 0;
+/*M*/ ULONG nSttCntnt = rDoc.GetNodes().GetEndOfExtras().GetIndex();
+ USHORT n=0;
+/*M*/ for( n = rArr.Count(); n; )
+/*M*/ {
+/*M*/ SwSection* pSect = rArr[ --n ]->GetSection();
+/*M*/ if( pSect->IsHidden() && pSect->GetCondition().Len() &&
+/*M*/ 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ))
+/*M*/ {
+/*M*/ ULONG nIdx = pSectNd->GetIndex();
+ USHORT i=0;
+/*M*/ for( i = 0;
+/*M*/ i < aTmpArr.Count() && aTmpArr[ i ] < nIdx;
+/*M*/ ++i )
+/*M*/ ;
+/*M*/ aTmpArr.Insert( nIdx, i );
+/*M*/ if( nIdx < nSttCntnt )
+/*M*/ ++nArrStt;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // erst alle anzeigen, damit die Frames vorhanden sind. Mit deren
+/*M*/ // Position wird das BodyAnchor ermittelt.
+/*M*/ // Dafuer erst den ContentBereich, dann die Sonderbereiche!!!
+/*M*/ for( n = nArrStt; n < aTmpArr.Count(); ++n )
+/*M*/ {
+/*M*/ pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
+/*M*/ ASSERT( pSectNd, "Wo ist mein SectionNode" );
+/*M*/ pSectNd->GetSection().SetCondHidden( FALSE );
+/*M*/ }
+/*M*/ for( n = 0; n < nArrStt; ++n )
+/*M*/ {
+/*M*/ pSectNd = rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode();
+/*M*/ ASSERT( pSectNd, "Wo ist mein SectionNode" );
+/*M*/ pSectNd->GetSection().SetCondHidden( FALSE );
+/*M*/ }
+/*M*/
+/*M*/ // so, erst jetzt alle sortiert in die Liste eintragen
+/*M*/ for( n = 0; n < aTmpArr.Count(); ++n )
+/*?*/ GetBodyNode( *rDoc.GetNodes()[ aTmpArr[ n ] ]->GetSectionNode() );
+/*M*/ }
+/*M*/
+/*M*/ String sTrue( String::CreateFromAscii(
+/*M*/ RTL_CONSTASCII_STRINGPARAM( "TRUE" ))),
+/*M*/ sFalse( String::CreateFromAscii(
+/*M*/ RTL_CONSTASCII_STRINGPARAM( "FALSE" )));
+/*M*/
+/*M*/ BOOL bIsDBMgr = 0 != rDoc.GetNewDBMgr();
+/*M*/ USHORT nWhich, n;
+/*M*/ const String* pFormel = 0;
+/*M*/ const SfxPoolItem* pItem;
+/*M*/ USHORT nMaxItems = rDoc.GetAttrPool().GetItemCount( RES_TXTATR_FIELD );
+/*M*/ for( n = 0; n < nMaxItems; ++n )
+/*M*/ {
+/*M*/ if( 0 == (pItem = rDoc.GetAttrPool().GetItem( RES_TXTATR_FIELD, n )) )
+/*M*/ continue;
+/*M*/
+/*M*/ const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
+/*M*/ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+/*M*/ if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+/*M*/ continue;
+/*M*/
+/*M*/ const SwField* pFld = pFmtFld->GetFld();
+/*M*/ switch( nWhich = pFld->GetTyp()->Which() )
+/*M*/ {
+/*M*/ case RES_DBSETNUMBERFLD:
+/*M*/ case RES_GETEXPFLD:
+/*M*/ if( GETFLD_ALL == eGetMode )
+/*M*/ pFormel = &sTrue;
+/*M*/ break;
+/*M*/
+/*M*/ case RES_DBFLD:
+/*M*/ if( GETFLD_EXPAND & eGetMode )
+/*M*/ pFormel = &sTrue;
+/*M*/ break;
+/*M*/
+/*M*/ case RES_SETEXPFLD:
+/*M*/ /// OD 04.10.2002 #102894#
+/*N*/ /// fields of subtype <string> have also been add
+/*N*/ /// for calculation (eGetMode == GETFLD_CALC).
+/*N*/ /// Thus, add fields of subtype <string> in all modes
+/*N*/ /// (eGetMode == GETFLD_EXPAND||GETFLD_CALC||GETFLD_ALL)
+/*N*/ /// and fields of other subtypes only in the modes
+/*N*/ /// (eGetMode == GETFLD_CALC||GETFLD_ALL)
+ /* "old" if construct - not deleted for history and code review
+ if( ( GSE_STRING & pFld->GetSubType()
+ ? GETFLD_EXPAND : GETFLD_CALC )
+ & eGetMode )
+ */
+/*N*/ if ( !(eGetMode == GETFLD_EXPAND) ||
+/*N*/ (GSE_STRING & pFld->GetSubType()) )
+/*N*/ {
+/*N*/ pFormel = &sTrue;
+/*N*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_HIDDENPARAFLD:
+/*M*/ if( GETFLD_ALL == eGetMode )
+/*M*/ {
+/*M*/ pFormel = &pFld->GetPar1();
+/*M*/ if( !pFormel->Len() || pFormel->Equals( sFalse ))
+/*M*/ ((SwHiddenParaField*)pFld)->SetHidden( FALSE );
+/*M*/ else if( pFormel->Equals( sTrue ))
+/*M*/ ((SwHiddenParaField*)pFld)->SetHidden( TRUE );
+/*M*/ else
+/*M*/ break;
+/*M*/
+/*M*/ pFormel = 0;
+/*M*/ // Formatierung anstossen
+/*M*/ ((SwFmtFld*)pFmtFld)->Modify( 0, 0 );
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_HIDDENTXTFLD:
+/*M*/ if( GETFLD_ALL == eGetMode )
+/*M*/ {
+/*M*/ pFormel = &pFld->GetPar1();
+/*M*/ if( !pFormel->Len() || pFormel->Equals( sFalse ))
+/*M*/ ((SwHiddenTxtField*)pFld)->SetValue( TRUE );
+/*M*/ else if( pFormel->Equals( sTrue ))
+/*M*/ ((SwHiddenTxtField*)pFld)->SetValue( FALSE );
+/*M*/ else
+/*M*/ break;
+/*M*/
+/*M*/ pFormel = 0;
+/*M*/
+/*M*/ // Feld Evaluieren
+/*M*/ ((SwHiddenTxtField*)pFld)->Evaluate(&rDoc);
+/*M*/ // Formatierung anstossen
+/*M*/ ((SwFmtFld*)pFmtFld)->Modify( 0, 0 );
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_DBNUMSETFLD:
+/*M*/ {
+/*N*/ SwDBData aDBData(((SwDBNumSetField*)pFld)->GetDBData(&rDoc));
+/*N*/
+/*N*/ if( bIsDBMgr &&
+/*N*/ rDoc.GetNewDBMgr()->OpenDataSource( aDBData.sDataSource, aDBData.sCommand )&&
+/*N*/ GETFLD_ALL == eGetMode ||
+/*N*/ ( GETFLD_CALC & eGetMode &&
+/*N*/ ((SwDBNumSetField*)pFld)->IsCondValid()))
+/*N*/ pFormel = &pFld->GetPar1();
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_DBNEXTSETFLD:
+/*M*/ {
+/*N*/ SwDBData aDBData(((SwDBNextSetField*)pFld)->GetDBData(&rDoc));
+/*N*/
+/*N*/ if( bIsDBMgr &&
+/*N*/ rDoc.GetNewDBMgr()->OpenDataSource( aDBData.sDataSource, aDBData.sCommand )&&
+/*N*/ GETFLD_ALL == eGetMode ||
+/*N*/ ( GETFLD_CALC & eGetMode &&
+/*N*/ ((SwDBNextSetField*)pFld)->IsCondValid() ))
+/*N*/ pFormel = &pFld->GetPar1();
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ if( pFormel && pFormel->Len() )
+/*M*/ {
+/*M*/ GetBodyNode( *pTxtFld, nWhich );
+/*M*/ pFormel = 0;
+/*M*/ }
+/*M*/ }
+/*M*/ nFldLstGetMode = eGetMode;
+/*M*/ nNodes = rDoc.GetNodes().Count();
+/*M*/
+/*M*/ #ifdef JP_DEBUG
+/*M*/ {
+/*M*/ SvFileStream sOut( "f:\\x.x", STREAM_STD_WRITE );
+/*M*/ sOut.Seek( STREAM_SEEK_TO_END );
+/*M*/ sOut << "------------------" << endl;
+/*M*/ const _SetGetExpFldPtr* pSortLst = pFldSortLst->GetData();
+/*M*/ for( USHORT n = pFldSortLst->Count(); n; --n, ++pSortLst )
+/*M*/ {
+/*M*/ String sStr( (*pSortLst)->GetNode() );
+/*M*/ sStr += "\t, ";
+/*M*/ sStr += (*pSortLst)->GetCntnt();
+/*M*/ sStr += "\tNode: ";
+/*M*/ sStr += (*pSortLst)->GetFld()->GetTxtNode().StartOfSectionIndex();
+/*M*/ sStr += "\tPos: ";
+/*M*/ sStr += *(*pSortLst)->GetFld()->GetStart();
+/*M*/ sStr += "\tType: ";
+/*M*/ sStr += (*pSortLst)->GetFld()->GetFld().GetFld()->GetTyp()->Which();
+/*M*/
+/*M*/ sOut << sStr.GetStr() << endl;
+/*M*/ }
+/*M*/ }
+/*M*/ #endif
+/*M*/ // JP_DEBUG
+/*M*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, USHORT nFldWhich )
+/*N*/ {
+/*N*/ const SwTxtNode& rTxtNd = rTFld.GetTxtNode();
+/*N*/ const SwDoc& rDoc = *rTxtNd.GetDoc();
+/*N*/
+/*N*/ // immer den ersten !! (in Tab-Headline, Kopf-/Fuss )
+/*N*/ Point aPt;
+/*N*/ const SwCntntFrm* pFrm = rTxtNd.GetFrm( &aPt, 0, FALSE );
+/*N*/
+/*N*/ _SetGetExpFld* pNew = NULL;
+/*N*/ BOOL bIsInBody = FALSE;
+/*N*/
+/*N*/ if( !pFrm || pFrm->IsInDocBody() )
+/*N*/ {
+/*N*/ // einen Index fuers bestimmen vom TextNode anlegen
+/*N*/ SwNodeIndex aIdx( rTxtNd );
+/*N*/ bIsInBody = rDoc.GetNodes().GetEndOfExtras().GetIndex() < aIdx.GetIndex();
+/*N*/
+/*N*/ // #104291# dvo: We don't want to update fields in redlines, or those
+/*N*/ // in frames whose anchor is in redline. However, we do want to update
+/*N*/ // fields in hidden sections. So: In order to be updated, a field 1)
+/*N*/ // must have a frame, or 2) it must be in the document body.
+/*N*/ if( (pFrm != NULL) || bIsInBody )
+/*N*/ pNew = new _SetGetExpFld( aIdx, &rTFld );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // einen Index fuers bestimmen vom TextNode anlegen
+/*N*/ SwPosition aPos( rDoc.GetNodes().GetEndOfPostIts() );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" );
+/*N*/ #else
+/*N*/ GetBodyTxtNode( rDoc, aPos, *pFrm );
+/*N*/ #endif
+/*N*/ pNew = new _SetGetExpFld( aPos.nNode, &rTFld, &aPos.nContent );
+/*N*/ }
+/*N*/
+/*N*/ // bei GetExp.-/DB.-Felder immer das BodyTxtFlag setzen
+/*N*/ if( RES_GETEXPFLD == nFldWhich )
+/*N*/ {
+/*?*/ SwGetExpField* pGetFld = (SwGetExpField*)rTFld.GetFld().GetFld();
+/*?*/ pGetFld->ChgBodyTxtFlag( bIsInBody );
+/*N*/ }
+/*N*/ else if( RES_DBFLD == nFldWhich )
+/*N*/ {
+/*N*/ SwDBField* pDBFld = (SwDBField*)rTFld.GetFld().GetFld();
+/*N*/ pDBFld->ChgBodyTxtFlag( bIsInBody );
+/*N*/ }
+/*N*/
+/*N*/ if( pNew != NULL )
+/*N*/ if( !pFldSortLst->Insert( pNew ))
+/*?*/ delete pNew;
+/*N*/ }
+
+void SwDocUpdtFld::GetBodyNode( const SwSectionNode& rSectNd )
+{
+ const SwDoc& rDoc = *rSectNd.GetDoc();
+ _SetGetExpFld* pNew = 0;
+
+ if( rSectNd.GetIndex() < rDoc.GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ do { // middle check loop
+
+ // dann muessen wir uns mal den Anker besorgen!
+ // einen Index fuers bestimmen vom TextNode anlegen
+ SwPosition aPos( rSectNd );
+ SwCntntNode* pCNd = rDoc.GetNodes().GoNext( &aPos.nNode ); // zum naechsten ContentNode
+
+ if( !pCNd || !pCNd->IsTxtNode() )
+ break;
+
+ // immer den ersten !! (in Tab-Headline, Kopf-/Fuss )
+ Point aPt;
+ const SwCntntFrm* pFrm = pCNd->GetFrm( &aPt, 0, FALSE );
+ if( !pFrm )
+ break;
+
+#ifdef DBG_UTIL
+ ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ), "wo steht das Feld" );
+#else
+ GetBodyTxtNode( rDoc, aPos, *pFrm );
+#endif
+ pNew = new _SetGetExpFld( rSectNd, &aPos );
+
+ } while( FALSE );
+ }
+
+ if( !pNew )
+ pNew = new _SetGetExpFld( rSectNd );
+
+ if( !pFldSortLst->Insert( pNew ))
+ delete pNew;
+}
+
+/*N*/ void SwDocUpdtFld::InsertFldType( const SwFieldType& rType )
+/*N*/ {
+/*N*/ String sFldName;
+/*N*/ switch( rType.Which() )
+/*N*/ {
+/*N*/ case RES_USERFLD :
+/*N*/ sFldName = ((SwUserFieldType&)rType).GetName();
+/*N*/ break;
+/*N*/ case RES_SETEXPFLD:
+/*N*/ sFldName = ((SwSetExpFieldType&)rType).GetName();
+/*N*/ break;
+/*N*/ default:
+/*N*/ ASSERT( !this, "kein gueltiger FeldTyp" );
+/*N*/ }
+/*N*/
+/*N*/ if( sFldName.Len() )
+/*N*/ {
+/*N*/ SetFieldsDirty( TRUE );
+/*N*/ // suchen und aus der HashTabelle entfernen
+/*N*/ GetAppCharClass().toLower( sFldName );
+/*N*/ USHORT n;
+/*N*/
+/*N*/ SwHash* pFnd = Find( sFldName, GetFldTypeTable(), TBLSZ, &n );
+/*N*/
+/*N*/ if( !pFnd )
+/*N*/ {
+/*N*/ SwCalcFldType* pNew = new SwCalcFldType( sFldName, &rType );
+/*N*/ pNew->pNext = aFldTypeTable[ n ];
+/*N*/ aFldTypeTable[ n ] = pNew;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwDocUpdtFld::SwDocUpdtFld()
+/*N*/ : pFldSortLst( 0 ), nFldLstGetMode( 0 ), nFldUpdtPos( LONG_MAX )
+/*N*/ {
+/*N*/ bInUpdateFlds = bFldsDirty = FALSE;
+/*N*/ memset( aFldTypeTable, 0, sizeof( aFldTypeTable ) );
+/*N*/ }
+
+/*N*/ SwDocUpdtFld::~SwDocUpdtFld()
+/*N*/ {
+/*N*/ delete pFldSortLst;
+/*N*/
+/*N*/ for( USHORT n = 0; n < TBLSZ; ++n )
+/*N*/ delete aFldTypeTable[n];
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docfly.cxx b/binfilter/bf_sw/source/core/doc/sw_docfly.cxx
new file mode 100644
index 000000000000..48b5849db009
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docfly.cxx
@@ -0,0 +1,842 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <bf_svtools/itemiter.hxx>
+#include <bf_svx/svdmark.hxx>
+
+#include <fmtfsize.hxx>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <dcontact.hxx>
+
+#include <ndgrf.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <txtflcnt.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtornt.hxx>
+#include <txtfrm.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <flyfrms.hxx>
+#include <frmfmt.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <crstate.hxx>
+namespace binfilter {
+
+extern USHORT GetHtmlMode( const SwDocShell* );
+
+/*-----------------17.02.98 08:35-------------------
+
+--------------------------------------------------*/
+/*N*/ USHORT SwDoc::GetFlyCount(FlyCntType eType ) const
+/*N*/ {
+/*N*/ const SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
+/*N*/ USHORT nSize = rFmts.Count();
+/*N*/ USHORT nCount = 0;
+/*N*/ const SwNodeIndex* pIdx;
+/*N*/ for ( USHORT i = 0; i < nSize; i++)
+/*N*/ {
+/*N*/ const SwFrmFmt* pFlyFmt = rFmts[ i ];
+/*N*/ if( RES_FLYFRMFMT == pFlyFmt->Which()
+/*N*/ && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
+/*N*/ && pIdx->GetNodes().IsDocNodes()
+/*N*/ )
+/*N*/ {
+/*N*/ const SwNode* pNd = GetNodes()[ pIdx->GetIndex() + 1 ];
+/*N*/
+/*N*/ switch( eType )
+/*N*/ {
+/*N*/ case FLYCNTTYPE_FRM:
+/*N*/ if(!pNd->IsNoTxtNode())
+/*N*/ nCount++;
+/*N*/ break;
+/*N*/
+/*N*/ case FLYCNTTYPE_GRF:
+/*N*/ if( pNd->IsGrfNode() )
+/*N*/ nCount++;
+/*N*/ break;
+/*N*/
+/*N*/ case FLYCNTTYPE_OLE:
+/*N*/ if(pNd->IsOLENode())
+/*N*/ nCount++;
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ nCount++;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nCount;
+/*N*/ }
+
+/*-----------------17.02.98 08:35-------------------
+
+--------------------------------------------------*/
+/*N*/ SwFrmFmt* SwDoc::GetFlyNum( USHORT nIdx, FlyCntType eType )
+/*N*/ {
+/*N*/ SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
+/*N*/ SwFrmFmt* pRetFmt = 0;
+/*N*/ USHORT nSize = rFmts.Count();
+/*N*/ const SwNodeIndex* pIdx;
+/*N*/ USHORT nCount = 0;
+/*N*/ for( USHORT i = 0; !pRetFmt && i < nSize; ++i )
+/*N*/ {
+/*N*/ SwFrmFmt* pFlyFmt = rFmts[ i ];
+/*N*/ if( RES_FLYFRMFMT == pFlyFmt->Which()
+/*N*/ && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
+/*N*/ && pIdx->GetNodes().IsDocNodes()
+/*N*/ )
+/*N*/ {
+/*N*/ const SwNode* pNd = GetNodes()[ pIdx->GetIndex() + 1 ];
+/*N*/ switch( eType )
+/*N*/ {
+/*N*/ case FLYCNTTYPE_FRM:
+/*N*/ if( !pNd->IsNoTxtNode() && nIdx == nCount++)
+/*N*/ pRetFmt = pFlyFmt;
+/*N*/ break;
+/*N*/ case FLYCNTTYPE_GRF:
+/*N*/ if(pNd->IsGrfNode() && nIdx == nCount++ )
+/*N*/ pRetFmt = pFlyFmt;
+/*N*/ break;
+/*N*/ case FLYCNTTYPE_OLE:
+/*N*/ if(pNd->IsOLENode() && nIdx == nCount++)
+/*N*/ pRetFmt = pFlyFmt;
+/*N*/ break;
+/*N*/ default:
+/*?*/ if(nIdx == nCount++)
+/*?*/ pRetFmt = pFlyFmt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pRetFmt;
+/*N*/ }
+
+/* */
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methode : SetFlyFrmAnchor
+#* Beschreibung: Das Ankerattribut des FlyFrms aendert sich.
+#* Datum : MA 01. Feb. 94
+#* Update : JP 09.03.98
+#***********************************************************************/
+
+/*N*/ Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch,
+/*N*/ const SwFrmFmt* pFlyFmt )
+/*N*/ {
+/*N*/ Point aRet;
+/*N*/ if( rDoc.GetRootFrm() )
+/*N*/ switch( rAnch.GetAnchorId() )
+/*N*/ {
+/*N*/ case FLY_IN_CNTNT:
+/*N*/ if( pFlyFmt && rAnch.GetCntntAnchor() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwFrm* pOld = ((SwFlyFrmFmt*)pFlyFmt)->GetFrm( &aRet, FALSE );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case FLY_AT_CNTNT:
+/*N*/ case FLY_AUTO_CNTNT: // LAYER_IMPL
+/*N*/ if( rAnch.GetCntntAnchor() )
+/*N*/ {
+/*N*/ const SwPosition *pPos = rAnch.GetCntntAnchor();
+/*N*/ const SwCntntNode* pNd = pPos->nNode.GetNode().GetCntntNode();
+/*N*/ const SwFrm* pOld = pNd ? pNd->GetFrm( &aRet, 0, FALSE ) : 0;
+/*N*/ if( pOld )
+/*N*/ aRet = pOld->Frm().Pos();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case FLY_AT_FLY: // LAYER_IMPL
+/*?*/ if( rAnch.GetCntntAnchor() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)rAnch.GetCntntAnchor()->
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*N*/ case FLY_PAGE:
+/*?*/ {
+/*?*/ USHORT nPgNum = rAnch.GetPageNum();
+/*?*/ const SwPageFrm *pPage = (SwPageFrm*)rDoc.GetRootFrm()->Lower();
+/*?*/ for( USHORT i = 1; (i <= nPgNum) && pPage; ++i,
+/*?*/ pPage = (const SwPageFrm*)pPage->GetNext() )
+/*?*/ if( i == nPgNum )
+/*?*/ {
+/*?*/ aRet = pPage->Frm().Pos();
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*N*/ return aRet;
+/*N*/ }
+
+#define MAKEFRMS 0
+#define IGNOREANCHOR 1
+#define DONTMAKEFRMS 2
+
+/*M*/ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, BOOL bNewFrms )
+/*M*/ {
+/*M*/ //Ankerwechsel sind fast immer in alle 'Richtungen' erlaubt.
+/*M*/ //Ausnahme: Absatz- bzw. Zeichengebundene Rahmen duerfen wenn sie in
+/*M*/ //Kopf-/Fusszeilen stehen nicht Seitengebunden werden.
+/*M*/ const SwFmtAnchor &rOldAnch = rFmt.GetAnchor();
+/*M*/ const RndStdIds nOld = rOldAnch.GetAnchorId();
+/*M*/
+/*M*/ SwFmtAnchor aNewAnch( (SwFmtAnchor&)rSet.Get( RES_ANCHOR ) );
+/*M*/ RndStdIds nNew = aNewAnch.GetAnchorId();
+/*M*/
+/*M*/ // ist der neue ein gueltiger Anker?
+/*M*/ if( !aNewAnch.GetCntntAnchor() && (FLY_AT_FLY == nNew ||
+/*M*/ FLY_AT_CNTNT == nNew || FLY_IN_CNTNT == nNew ||
+/*M*/ FLY_AUTO_CNTNT == nNew ))
+/*M*/ return IGNOREANCHOR;
+/*M*/
+/*M*/ if( nOld == nNew )
+/*M*/ return DONTMAKEFRMS;
+/*M*/
+/*M*/
+/*M*/ Point aOldAnchorPos( ::binfilter::lcl_FindAnchorLayPos( *this, rOldAnch, &rFmt ));
+/*M*/ Point aNewAnchorPos( ::binfilter::lcl_FindAnchorLayPos( *this, aNewAnch, 0 ));
+/*M*/
+/*M*/ //Die alten Frms vernichten. Dabei werden die Views implizit gehidet und
+/*M*/ //doppeltes hiden waere so eine art Show!
+/*M*/ rFmt.DelFrms();
+/*M*/
+/*M*/ if( FLY_IN_CNTNT == nOld )
+/*M*/ {
+/*M*/ //Bei InCntnt's wird es spannend: Das TxtAttribut muss vernichtet
+/*M*/ //werden. Leider reisst dies neben den Frms auch noch das Format mit
+/*M*/ //in sein Grab. Um dass zu unterbinden loesen wir vorher die
+/*M*/ //Verbindung zwischen Attribut und Format.
+/*M*/ const SwPosition *pPos = rOldAnch.GetCntntAnchor();
+/*M*/ SwTxtNode *pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+/*M*/ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+/*M*/ const xub_StrLen nIdx = pPos->nContent.GetIndex();
+/*M*/ SwTxtAttr * pHnt = pTxtNode->GetTxtAttr( nIdx, RES_TXTATR_FLYCNT );
+/*M*/ #ifdef DBG_UTIL
+/*M*/ ASSERT( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
+/*M*/ "Missing FlyInCnt-Hint." );
+/*M*/ ASSERT( pHnt && pHnt->GetFlyCnt().GetFrmFmt() == &rFmt,
+/*M*/ "Wrong TxtFlyCnt-Hint." );
+/*M*/ #endif
+/*M*/ ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+/*M*/
+/*M*/ //Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
+/*M*/ //werden.
+/*M*/ pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+/*M*/ }
+/*M*/
+/*M*/ //Endlich kann das Attribut gesetzt werden. Es muss das erste Attribut
+/*M*/ //sein; Undo depends on it!
+/*M*/ rFmt.SetAttr( aNewAnch );
+/*M*/
+/*M*/ //Positionskorrekturen
+/*M*/ const SfxPoolItem* pItem;
+/*M*/ switch( nNew )
+/*M*/ {
+/*M*/ case FLY_IN_CNTNT:
+/*M*/ //Wenn keine Positionsattribute hereinkommen, dann muss dafuer
+/*M*/ //gesorgt werden, das keine unerlaubte automatische Ausrichtung
+/*M*/ //bleibt.
+/*M*/ {
+/*M*/ const SwPosition *pPos = aNewAnch.GetCntntAnchor();
+/*M*/ SwTxtNode *pNd = pPos->nNode.GetNode().GetTxtNode();
+/*M*/ ASSERT( pNd, "Crsr steht nicht auf TxtNode." );
+/*M*/
+/*M*/ pNd->Insert( SwFmtFlyCnt( (SwFlyFrmFmt*)&rFmt ),
+/*M*/ pPos->nContent.GetIndex(), 0 );
+/*M*/ }
+/*M*/
+/*M*/ if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, FALSE, &pItem ))
+/*M*/ {
+/*M*/ SwFmtVertOrient aOldV( rFmt.GetVertOrient() );
+/*M*/ BOOL bSet = TRUE;
+/*M*/ switch( aOldV.GetVertOrient() )
+/*M*/ {
+/*M*/ case VERT_LINE_TOP: aOldV.SetVertOrient( VERT_TOP ); break;
+/*M*/ case VERT_LINE_CENTER: aOldV.SetVertOrient( VERT_CENTER); break;
+/*M*/ case VERT_LINE_BOTTOM: aOldV.SetVertOrient( VERT_BOTTOM); break;
+/*M*/ case VERT_NONE: aOldV.SetVertOrient( VERT_CENTER); break;
+/*M*/ default:
+/*M*/ bSet = FALSE;
+/*M*/ }
+/*M*/ if( bSet )
+/*M*/ rSet.Put( aOldV );
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case FLY_AT_CNTNT:
+/*M*/ case FLY_AUTO_CNTNT: // LAYER_IMPL
+/*M*/ case FLY_AT_FLY: // LAYER_IMPL
+/*M*/ case FLY_PAGE:
+/*M*/ {
+/*M*/ //Wenn keine Positionsattribute hereinschneien korrigieren wir
+/*M*/ //die Position so, dass die Dokumentkoordinaten des Flys erhalten
+/*M*/ //bleiben.
+/*M*/ //Chg: Wenn sich in den Positionsattributen lediglich die
+/*M*/ //Ausrichtung veraendert (FRAME vs. PRTAREA), dann wird die
+/*M*/ //Position ebenfalls korrigiert.
+/*M*/ if( SFX_ITEM_SET != rSet.GetItemState( RES_HORI_ORIENT, FALSE, &pItem ))
+/*M*/ pItem = 0;
+/*M*/
+/*M*/ SwFmtHoriOrient aOldH( rFmt.GetHoriOrient() );
+/*M*/
+/*M*/ if( HORI_NONE == aOldH.GetHoriOrient() && ( !pItem ||
+/*M*/ aOldH.GetPos() == ((SwFmtHoriOrient*)pItem)->GetPos() ))
+/*M*/ {
+/*M*/ SwTwips nPos = FLY_IN_CNTNT == nOld ? 0 : aOldH.GetPos();
+/*M*/ nPos += aOldAnchorPos.X() - aNewAnchorPos.X();
+/*M*/
+/*M*/ if( pItem )
+/*M*/ {
+/*M*/ SwFmtHoriOrient* pH = (SwFmtHoriOrient*)pItem;
+/*M*/ aOldH.SetHoriOrient( pH->GetHoriOrient() );
+/*M*/ aOldH.SetRelationOrient( pH->GetRelationOrient() );
+/*M*/ }
+/*M*/ aOldH.SetPos( nPos );
+/*M*/ rSet.Put( aOldH );
+/*M*/ }
+/*M*/
+/*M*/ if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, FALSE, &pItem ))
+/*M*/ pItem = 0;
+/*M*/ SwFmtVertOrient aOldV( rFmt.GetVertOrient() );
+/*M*/
+/*M*/ if( HORI_NONE == aOldV.GetVertOrient() && (!pItem ||
+/*M*/ aOldV.GetPos() == ((SwFmtVertOrient*)pItem)->GetPos() ) )
+/*M*/ {
+/*M*/ SwTwips nPos = FLY_IN_CNTNT == nOld ? 0 : aOldV.GetPos();
+/*M*/ nPos += aOldAnchorPos.Y() - aNewAnchorPos.Y();
+/*M*/ if( pItem )
+/*M*/ {
+/*M*/ SwFmtVertOrient* pV = (SwFmtVertOrient*)pItem;
+/*M*/ aOldV.SetVertOrient( pV->GetVertOrient() );
+/*M*/ aOldV.SetRelationOrient( pV->GetRelationOrient() );
+/*M*/ }
+/*M*/ aOldV.SetPos( nPos );
+/*M*/ rSet.Put( aOldV );
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ if( bNewFrms )
+/*M*/ rFmt.MakeFrms();
+/*M*/
+/*M*/ return MAKEFRMS;
+/*M*/ }
+
+/*N*/ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
+/*N*/ {
+/*N*/ if( !rSet.Count() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ //Ist das Ankerattribut dabei? Falls ja ueberlassen wir die Verarbeitung
+/*N*/ //desselben einer Spezialmethode. Sie Returnt TRUE wenn der Fly neu
+/*N*/ //erzeugt werden muss (z.B. weil ein Wechsel des FlyTyps vorliegt).
+/*N*/ sal_Int8 nMakeFrms = SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, FALSE )?
+/*N*/ SetFlyFrmAnchor( rFlyFmt, rSet, FALSE ) : DONTMAKEFRMS;
+/*N*/
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ SfxItemIter aIter( rSet );
+/*N*/ SfxItemSet aTmpSet( GetAttrPool(), aFrmFmtSetRange );
+/*N*/ USHORT nWhich = aIter.GetCurItem()->Which();
+/*N*/ do {
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_FILL_ORDER:
+/*N*/ case RES_BREAK:
+/*N*/ case RES_PAGEDESC:
+/*N*/ case RES_CNTNT:
+/*N*/ case RES_FOOTER:
+/*N*/ ASSERT( !this, ":-) Unbekanntes Attribut fuer Fly." );
+/*N*/ // kein break;
+/*N*/ case RES_CHAIN:
+/*?*/ rSet.ClearItem( nWhich );
+/*?*/ break;
+/*N*/ case RES_ANCHOR:
+/*N*/ if( DONTMAKEFRMS != nMakeFrms )
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ if( !IsInvalidItem( aIter.GetCurItem() ) && ( SFX_ITEM_SET !=
+/*N*/ rFlyFmt.GetAttrSet().GetItemState( nWhich, TRUE, &pItem ) ||
+/*N*/ *pItem != *aIter.GetCurItem() ))
+/*N*/ aTmpSet.Put( *aIter.GetCurItem() );
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( aIter.IsAtEnd() )
+/*N*/ break;
+/*N*/
+/*?*/ } while( 0 != ( nWhich = aIter.NextItem()->Which() ) );
+/*N*/
+/*N*/ if( aTmpSet.Count() )
+/*?*/ rFlyFmt.SetAttr( aTmpSet );
+/*N*/
+/*N*/ if( MAKEFRMS == nMakeFrms )
+/*N*/ rFlyFmt.MakeFrms();
+/*N*/
+/*N*/
+/*N*/ SetModified();
+/*N*/
+/*N*/ return aTmpSet.Count() || MAKEFRMS == nMakeFrms;
+/*N*/ }
+
+
+/***************************************************************************
+ * Methode : BOOL SwDoc::SetFrmFmtToFly( SwFlyFrm&, SwFrmFmt& )
+ * Beschreibung:
+ * Erstellt : OK 14.04.94 15:40
+ * Aenderung : JP 23.04.98
+ ***************************************************************************/
+
+/*M*/ BOOL SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt,
+/*M*/ SfxItemSet* pSet, BOOL bKeepOrient )
+/*M*/ {
+/*M*/ BOOL bChgAnchor = FALSE, bFrmSz = FALSE;
+/*M*/
+/*M*/ const SwFmtFrmSize aFrmSz( rFmt.GetFrmSize() );
+/*M*/ const SwFmtVertOrient aVert( rFmt.GetVertOrient() );
+/*M*/ const SwFmtHoriOrient aHori( rFmt.GetHoriOrient() );
+/*M*/
+/*M*/
+/*M*/ //Erstmal die Spalten setzen, sonst gibts nix als Aerger mit dem
+/*M*/ //Set/Reset/Abgleich usw.
+/*M*/ const SfxPoolItem* pItem;
+/*M*/ if( SFX_ITEM_SET != rNewFmt.GetAttrSet().GetItemState( RES_COL ))
+/*M*/ rFmt.ResetAttr( RES_COL );
+/*M*/
+/*M*/ if( rFmt.DerivedFrom() != &rNewFmt )
+/*M*/ {
+/*M*/ rFmt.SetDerivedFrom( &rNewFmt );
+/*M*/
+/*M*/ // 1. wenn nicht automatisch -> ignorieren, sonst -> wech
+/*M*/ // 2. wech damit, MB!
+/*M*/ if( SFX_ITEM_SET == rNewFmt.GetAttrSet().GetItemState( RES_FRM_SIZE, FALSE ))
+/*M*/ {
+/*M*/ rFmt.ResetAttr( RES_FRM_SIZE );
+/*M*/ bFrmSz = TRUE;
+/*M*/ }
+/*M*/
+/*M*/ const SfxItemSet* pAsk = pSet;
+/*M*/ if( !pAsk ) pAsk = &rNewFmt.GetAttrSet();
+/*M*/ if( SFX_ITEM_SET == pAsk->GetItemState( RES_ANCHOR, FALSE, &pItem )
+/*M*/ && ((SwFmtAnchor*)pItem)->GetAnchorId() !=
+/*M*/ rFmt.GetAnchor().GetAnchorId() )
+/*M*/ {
+/*M*/
+/*M*/ if( pSet )
+/*M*/ bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, *pSet, FALSE );
+/*M*/ else
+/*M*/ {
+/*M*/ //JP 23.04.98: muss den FlyFmt-Range haben, denn im SetFlyFrmAnchor
+/*M*/ // werden Attribute in diesen gesetzt!
+/*M*/ SfxItemSet aFlySet( *rNewFmt.GetAttrSet().GetPool(),
+/*M*/ rNewFmt.GetAttrSet().GetRanges() );
+/*M*/ aFlySet.Put( *pItem );
+/*M*/ bChgAnchor = MAKEFRMS == SetFlyFrmAnchor( rFmt, aFlySet, FALSE);
+/*M*/ }
+/*M*/
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ //Hori und Vert nur dann resetten, wenn in der Vorlage eine
+/*M*/ //automatische Ausrichtung eingestellt ist, anderfalls den alten Wert
+/*M*/ //wieder hineinstopfen.
+/*M*/ //JP 09.06.98: beim Update der RahmenVorlage sollte der Fly NICHT
+/*M*/ // seine Orientierng verlieren (diese wird nicht geupdatet!)
+/*M*/ //OS: #96584# HORI_NONE and VERT_NONE are allowed now
+/*M*/ if( !bKeepOrient )
+/*M*/ {
+/*M*/ const SwFmtVertOrient &rVert = rNewFmt.GetVertOrient();
+/*M*/ rFmt.ResetAttr( RES_VERT_ORIENT );
+/*M*/
+/*M*/ const SwFmtHoriOrient &rHori = rNewFmt.GetHoriOrient();
+/*M*/ rFmt.ResetAttr( RES_HORI_ORIENT );
+/*M*/ }
+/*M*/
+/*M*/ rFmt.ResetAttr( RES_PRINT, RES_SURROUND );
+/*M*/ rFmt.ResetAttr( RES_LR_SPACE, RES_UL_SPACE );
+/*M*/ rFmt.ResetAttr( RES_BACKGROUND, RES_COL );
+/*M*/ rFmt.ResetAttr( RES_URL, RES_EDIT_IN_READONLY );
+/*M*/
+/*M*/ if( !bFrmSz )
+/*M*/ rFmt.SetAttr( aFrmSz );
+/*M*/
+/*M*/ if( bChgAnchor )
+/*M*/ rFmt.MakeFrms();
+/*M*/
+/*M*/
+/*M*/ SetModified();
+/*M*/ return bChgAnchor;
+/*M*/ }
+
+/*N*/ void SwDoc::GetGrfNms( const SwFlyFrmFmt& rFmt, String* pGrfName,
+/*N*/ String* pFltName ) const
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *rFmt.GetCntnt().GetCntntIdx(), 1 );
+/*N*/ const SwGrfNode* pGrfNd = aIdx.GetNode().GetGrfNode();
+/*N*/ if( pGrfNd && pGrfNd->IsLinkedFile() )
+/*N*/ pGrfNd->GetFileFilterNms( pGrfName, pFltName );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDoc::ChgAnchor()
+|*
+|* Ersterstellung MA 10. Jan. 95
+|* Letzte Aenderung JP 08.07.98
+|*
+*************************************************************************/
+
+/*?*/ BOOL SwDoc::ChgAnchor( const SdrMarkList& rMrkList, int eAnchorId,
+/*?*/ BOOL bSameOnly, BOOL bPosCorr )
+/*?*/ {
+/*?*/ ASSERT( GetRootFrm(), "Ohne Layout geht gar nichts" );
+/*?*/
+/*?*/ if( !rMrkList.GetMarkCount() ||
+/*?*/ rMrkList.GetMark( 0 )->GetObj()->GetUpGroup() )
+/*?*/ return FALSE; // Kein Ankerwechsel innerhalb von Gruppen
+/*?*/
+/*?*/ BOOL bUnmark = FALSE;
+/*?*/ for ( USHORT i = 0; i < rMrkList.GetMarkCount(); ++i )
+/*?*/ {
+/*?*/ SdrObject *pObj = rMrkList.GetMark( i )->GetObj();
+/*?*/ if ( !pObj->IsWriterFlyFrame() )
+/*?*/ {
+/*?*/ SwDrawContact* pContact = (SwDrawContact*)GetUserCall(pObj);
+/*?*/
+/*?*/ // OD 27.06.2003 #108784# - consider, that drawing object has
+/*?*/ // no user call. E.g.: a 'virtual' drawing object is disconnected by
+/*?*/ // the anchor type change of the 'master' drawing object.
+/*?*/ // Continue with next selected object and assert, if this isn't excepted.
+/*?*/ if ( !pContact )
+/*?*/ {
+/*?*/ #ifdef DBG_UTIL
+/*?*/ bool bNoUserCallExcepted =
+/*?*/ pObj->ISA(SwDrawVirtObj) &&
+/*?*/ !static_cast<SwDrawVirtObj*>(pObj)->IsConnected();
+/*?*/ ASSERT( bNoUserCallExcepted, "SwDoc::ChgAnchor(..) - no contact at selected drawing object" );
+/*?*/ #endif
+/*?*/ continue;
+/*?*/ }
+/*?*/
+/*?*/ // OD 17.06.2003 #108784# - determine correct 'old' anchor frame,
+/*?*/ // considering 'virtual' drawing objects.
+/*?*/ const SwFrm* pOldAnch = 0L;
+/*?*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*?*/ {
+/*?*/ pOldAnch = static_cast<SwDrawVirtObj*>(pObj)->GetAnchorFrm();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pOldAnch = pContact->GetAnchor();
+/*?*/ }
+/*?*/ const SwFrm *pNewAnch = pOldAnch;
+/*?*/
+/*?*/ BOOL bChanges = TRUE;
+/*?*/ xub_StrLen nIndx = STRING_NOTFOUND;
+/*?*/ SwTxtNode *pTxtNode;
+/*?*/ int nOld = pContact->GetFmt()->GetAnchor().GetAnchorId();
+/*?*/ if( !bSameOnly && FLY_IN_CNTNT == nOld )
+/*?*/ {
+/*?*/ const SwPosition *pPos =
+/*?*/ pContact->GetFmt()->GetAnchor().GetCntntAnchor();
+/*?*/ pTxtNode = pPos->nNode.GetNode().GetTxtNode();
+/*?*/ ASSERT( pTxtNode->HasHints(), "Missing FlyInCnt-Hint." );
+/*?*/ nIndx = pPos->nContent.GetIndex();
+/*?*/ if( !pOldAnch )
+/*?*/ {
+/*?*/ pContact->ConnectToLayout();
+/*?*/ pOldAnch = pContact->GetAnchor();
+/*?*/ }
+/*?*/ pOldAnch->Calc();
+/*?*/ pObj->ImpSetAnchorPos( pOldAnch->GetFrmAnchorPos( ::binfilter::HasWrap( pObj ) ) );
+/*?*/ }
+/*?*/
+/*?*/ if ( bSameOnly )
+/*?*/ eAnchorId = nOld;
+/*?*/
+/*?*/ bChanges = FLY_IN_CNTNT != eAnchorId;
+/*?*/ SwFmtAnchor aNewAnch( (RndStdIds)eAnchorId );
+/*?*/ const Point aPt( pObj->GetAnchorPos() + pObj->GetRelativePos() );
+/*?*/
+/*?*/ switch ( eAnchorId )
+/*?*/ {
+/*?*/ case FLY_AT_CNTNT:
+/*?*/ case FLY_AUTO_CNTNT:
+/*?*/ {
+/*?*/ const Point aNewPoint = pOldAnch &&
+/*?*/ ( pOldAnch->IsVertical() ||
+/*?*/ pOldAnch->IsRightToLeft() ) ?
+/*?*/ pObj->GetBoundRect().TopRight() :
+/*?*/ aPt;
+/*?*/
+/*?*/ // OD 18.06.2003 #108784# - allow drawing objects in header/footer
+/*?*/ pNewAnch = ::binfilter::FindAnchor( pOldAnch, aNewPoint, false );
+/*?*/ if( pNewAnch->IsTxtFrm() && ((SwTxtFrm*)pNewAnch)->IsFollow() )
+/*?*/ pNewAnch = ((SwTxtFrm*)pNewAnch)->FindMaster();
+/*?*/ if( pNewAnch->IsProtected() )
+/*?*/ pNewAnch = 0;
+/*?*/ else
+/*?*/ {
+/*?*/ SwPosition aPos( *((SwCntntFrm*)pNewAnch)->GetNode() );
+/*?*/ aNewAnch.SetType( (RndStdIds)eAnchorId );
+/*?*/ aNewAnch.SetAnchor( &aPos );
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case FLY_AT_FLY: // LAYER_IMPL
+/*?*/ {
+/*?*/ //Ausgehend von der linken oberen Ecke des Fly den
+/*?*/ //dichtesten SwFlyFrm suchen.
+/*?*/ SwFrm *pTxtFrm;
+/*?*/ {
+/*?*/ SwCrsrMoveState aState( MV_SETONLYTEXT );
+/*?*/ SwPosition aPos( GetNodes() );
+/*?*/ Point aPoint( aPt );
+/*?*/ aPoint.X() -= 1;
+/*?*/ GetRootFrm()->GetCrsrOfst( &aPos, aPoint, &aState );
+/*?*/ // OD 20.06.2003 #108784# - consider that drawing objects
+/*?*/ // can be in header/footer. Thus, <GetFrm()> by left-top-corner
+/*?*/ pTxtFrm = aPos.nNode.GetNode().
+/*?*/ GetCntntNode()->GetFrm( &aPt, 0, FALSE );
+/*?*/ }
+/*?*/ const SwFrm *pTmp = ::binfilter::FindAnchor( pTxtFrm, aPt );
+/*?*/ pNewAnch = pTmp->FindFlyFrm();
+/*?*/ if( pNewAnch && !pNewAnch->IsProtected() )
+/*?*/ {
+/*?*/ const SwFrmFmt *pTmpFmt = ((SwFlyFrm*)pNewAnch)->GetFmt();
+/*?*/ const SwFmtCntnt& rCntnt = pTmpFmt->GetCntnt();
+/*?*/ SwPosition aPos( *rCntnt.GetCntntIdx() );
+/*?*/ aNewAnch.SetAnchor( &aPos );
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*?*/ aNewAnch.SetType( FLY_PAGE );
+/*?*/ // no break
+/*?*/ }
+/*?*/ case FLY_PAGE:
+/*?*/ {
+/*?*/ pNewAnch = GetRootFrm()->Lower();
+/*?*/ while ( pNewAnch && !pNewAnch->Frm().IsInside( aPt ) )
+/*?*/ pNewAnch = pNewAnch->GetNext();
+/*?*/ if ( !pNewAnch )
+/*?*/ continue;
+/*?*/
+/*?*/ aNewAnch.SetPageNum( ((SwPageFrm*)pNewAnch)->GetPhyPageNum());
+/*?*/ }
+/*?*/ break;
+/*?*/ case FLY_IN_CNTNT:
+/*?*/ if( bSameOnly ) // Positions/Groessenaenderung
+/*?*/ {
+/*?*/ SwDrawFrmFmt *pFmt = (SwDrawFrmFmt*)pContact->GetFmt();
+/*?*/ const SwFmtVertOrient &rVert = pFmt->GetVertOrient();
+/*?*/ SwTwips nRelPos = pObj->GetRelativePos().Y();
+/*?*/ const SwFrm *pTmp = pContact->GetAnchor();
+/*?*/ if( pTmp && pTmp->IsVertical() )
+/*?*/ {
+/*?*/ nRelPos = pObj->GetRelativePos().X();
+/*?*/ if( !pTmp->IsReverse() )
+/*?*/ nRelPos = -nRelPos -pObj->GetSnapRect().GetWidth();
+/*?*/ }
+/*?*/ if ( rVert.GetPos() != nRelPos ||
+/*?*/ VERT_NONE != rVert.GetVertOrient() )
+/*?*/ {
+/*?*/ SwFmtVertOrient aVert( rVert );
+/*?*/ aVert.SetVertOrient( VERT_NONE );
+/*?*/ aVert.SetPos( nRelPos );
+/*?*/ SetAttr( aVert, *pFmt );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ if( !pOldAnch )
+/*?*/ {
+/*?*/ pContact->ConnectToLayout();
+/*?*/ pOldAnch = pContact->GetAnchor();
+/*?*/ }
+/*?*/ ((SwTxtFrm*)pOldAnch)->Prepare();
+/*?*/ }
+/*?*/ }
+/*?*/ else // Ankerwechsel
+/*?*/ {
+/*?*/ // OD 18.06.2003 #108784# - allow drawing objects in header/footer
+/*?*/ pNewAnch = ::binfilter::FindAnchor( pOldAnch, aPt, false );
+/*?*/ if( pNewAnch->IsProtected() )
+/*?*/ {
+/*?*/ pNewAnch = 0;
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*?*/ bUnmark = ( 0 != i );
+/*?*/ Point aPoint( aPt );
+/*?*/ aPoint.X() -= 1; // nicht im DrawObj landen!!
+/*?*/ aNewAnch.SetType( FLY_IN_CNTNT );
+/*?*/ SwPosition aPos( *((SwCntntFrm*)pNewAnch)->GetNode() );
+/*?*/ if ( pNewAnch->Frm().IsInside( aPoint ) )
+/*?*/ {
+/*?*/ // es muss ein TextNode gefunden werden, denn nur dort
+/*?*/ // ist ein inhaltsgebundenes DrawObjekt zu verankern
+/*?*/ SwCrsrMoveState aState( MV_SETONLYTEXT );
+/*?*/ GetRootFrm()->GetCrsrOfst( &aPos, aPoint, &aState );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ SwCntntNode &rCNd = (SwCntntNode&)
+/*?*/ *((SwCntntFrm*)pNewAnch)->GetNode();
+/*?*/ if ( pNewAnch->Frm().Bottom() < aPt.Y() )
+/*?*/ rCNd.MakeStartIndex( &aPos.nContent );
+/*?*/ else
+/*?*/ rCNd.MakeEndIndex( &aPos.nContent );
+/*?*/ }
+/*?*/ aNewAnch.SetAnchor( &aPos );
+/*?*/ SetAttr( aNewAnch, *pContact->GetFmt() );
+/*?*/ SwTxtNode *pNd = aPos.nNode.GetNode().GetTxtNode();
+/*?*/ ASSERT( pNd, "Crsr steht nicht auf TxtNode." );
+/*?*/
+/*?*/ pNd->Insert( SwFmtFlyCnt( pContact->GetFmt() ),
+/*?*/ aPos.nContent.GetIndex(), 0 );
+/*?*/ }
+/*?*/ break;
+/*?*/ default:
+/*?*/ ASSERT( !this, "unexpected AnchorId." );
+/*?*/ }
+/*?*/
+/*?*/ if( bChanges && pNewAnch )
+/*?*/ {
+/*?*/ // OD 20.06.2003 #108784# - consider that a 'virtual' drawing
+/*?*/ // object is disconnected from layout, e.g. caused by an anchor
+/*?*/ // type change.
+/*?*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*?*/ {
+/*?*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
+/*?*/ if ( !pDrawVirtObj->IsConnected() )
+/*?*/ {
+/*?*/ // 'virtual' drawing object disconnected from layout.
+/*?*/ // Thus, change to 'master' drawing object
+/*?*/ pObj = &(pDrawVirtObj->ReferencedObj());
+/*?*/ }
+/*?*/ }
+/*?*/ #ifdef DBG_UTIL
+/*?*/ // SetAttr() removes the ParaPortion of pNewAnch, which is required by
+/*?*/ // GetFrmAnchorPos. Therefore aTmpPoint has to be calculated before
+/*?*/ // the call of SetAttr().
+/*?*/ // OD 20.06.2003 #108784# - refine for assertion:
+/*?*/ // consider anchor change from page to something in header/footer
+/*?*/ Point aProposedAnchorPos;
+/*?*/ if ( nOld == FLY_PAGE &&
+/*?*/ pContact->GetAnchor()->FindFooterOrHeader() )
+/*?*/ {
+/*?*/ aProposedAnchorPos = pContact->GetAnchor()->GetFrmAnchorPos( ::binfilter::HasWrap( pObj ) );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // SetAttr() removes the ParaPortion of pNewAnch, which is required by
+/*?*/ // GetFrmAnchorPos. Therefore aTmpPoint has to be calculated before
+/*?*/ // the call of SetAttr().
+/*?*/ aProposedAnchorPos = pNewAnch->GetFrmAnchorPos( ::binfilter::HasWrap( pObj ) );
+/*?*/ }
+/*?*/ #endif
+/*?*/ SetAttr( aNewAnch, *pContact->GetFmt() );
+/*?*/ if( bPosCorr )
+/*?*/ {
+/*?*/ const Point aTmpRel( aPt - pObj->GetAnchorPos() );
+/*?*/
+/*?*/ // #102344# Use SetRelativePos here so that eventually
+/*?*/ // connectors cobnnected to this object get the necessary refresh.
+/*?*/ pObj->SetRelativePos( aTmpRel );
+/*?*/ }
+/*?*/
+/*?*/ #ifdef DBG_UTIL
+/*?*/ {
+/*?*/ const Point aIstA( pObj->GetAnchorPos() );
+/*?*/ ASSERT( pOldAnch == pNewAnch || aIstA == aProposedAnchorPos,
+/*?*/ "SwDoc::ChgAnchor(..): Wrong Anchor-Pos." );
+/*?*/ }
+/*?*/ #endif
+/*?*/ }
+/*?*/
+/*?*/ if ( pNewAnch && STRING_NOTFOUND != nIndx )
+/*?*/ {
+/*?*/ //Bei InCntnt's wird es spannend: Das TxtAttribut muss vernichtet
+/*?*/ //werden. Leider reisst dies neben den Frms auch noch das Format mit
+/*?*/ //in sein Grab. Um dass zu unterbinden loesen wir vorher die
+/*?*/ //Verbindung zwischen Attribut und Format.
+/*?*/ SwTxtAttr *pHnt = pTxtNode->GetTxtAttr( nIndx, RES_TXTATR_FLYCNT );
+/*?*/ ((SwFmtFlyCnt&)pHnt->GetFlyCnt()).SetFlyFmt();
+/*?*/
+/*?*/ //Die Verbindung ist geloest, jetzt muss noch das Attribut vernichtet
+/*?*/ //werden.
+/*?*/ pTxtNode->Delete( RES_TXTATR_FLYCNT, nIndx, nIndx );
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ SetModified();
+/*?*/
+/*?*/ return bUnmark;
+/*?*/ }
+
+
+/* -----------------23.07.98 13:56-------------------
+ *
+ * --------------------------------------------------*/
+/* -----------------23.07.98 13:56-------------------
+ *
+ * --------------------------------------------------*/
+/*N*/ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return 0; //STRIP001 int nErr = Chainable( rSource, rDest );
+/*N*/ }
+/* -----------------23.07.98 13:56-------------------
+ *
+ * --------------------------------------------------*/
+/*N*/ void SwDoc::Unchain( SwFrmFmt &rFmt )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFmtChain aChain( rFmt.GetChain() );
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docfmt.cxx b/binfilter/bf_sw/source/core/doc/sw_docfmt.cxx
new file mode 100644
index 000000000000..5fc567e040d9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docfmt.cxx
@@ -0,0 +1,1288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _ZFORLIST_DECLARE_TABLE
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_USHORTS
+
+#include <hintids.hxx>
+
+#include <rtl/logfile.hxx>
+#include <bf_svtools/itemiter.hxx>
+#include <bf_so3/so2ref.hxx>
+#include <bf_sfx2/app.hxx>
+#include <bf_sfx2/misccfg.hxx>
+#include <bf_svx/tstpitem.hxx>
+#include <bf_svx/brkitem.hxx>
+#ifndef _ZFORLIST_HXX //autogen
+#define _ZFORLIST_DECLARE_TABLE
+#include <bf_svtools/zforlist.hxx>
+#endif
+
+#include <com/sun/star/i18n/WordType.hdl>
+
+
+#include <fmtpdsc.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pagefrm.hxx>
+#include <hints.hxx> // fuer SwHyphenBug (in SetDefault)
+#include <ndtxt.hxx>
+#include <mvsave.hxx> // servieren: Veraenderungen erkennen
+#include <swtable.hxx>
+#include <swtblfmt.hxx>
+#include <charfmt.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <redline.hxx>
+#include <reffld.hxx>
+#include <txtinet.hxx>
+#include <fmtinfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+namespace binfilter {
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+#ifndef SO2_DECL_SVLINKNAME_DEFINED
+#define SO2_DECL_SVLINKNAME_DEFINED
+SO2_DECL_REF(SvLinkName)
+#endif
+
+/*N*/ SV_IMPL_PTRARR(SwFrmFmts,SwFrmFmtPtr)
+/*N*/ SV_IMPL_PTRARR(SwCharFmts,SwCharFmtPtr)
+
+//Spezifische Frameformate (Rahmen)
+/*N*/ SV_IMPL_PTRARR(SwSpzFrmFmts,SwFrmFmtPtr)
+
+/*
+ * interne Funktionen
+ */
+
+
+/*
+ * Zuruecksetzen der harten Formatierung fuer Text
+ */
+
+// Uebergabeparameter fuer _Rst und lcl_SetTxtFmtColl
+struct ParaRstFmt
+{
+ SwFmtColl* pFmtColl;
+ const SwPosition *pSttNd, *pEndNd;
+ const SfxItemSet* pDelSet;
+ USHORT nWhich;
+ BOOL bReset, bResetAll, bInclRefToxMark;
+
+ ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd,
+ USHORT nWhch = 0, const SfxItemSet* pSet = 0 )
+ : pSttNd( pStt ), pEndNd( pEnd ), nWhich( nWhch ),
+ pDelSet( pSet ), bResetAll( TRUE ), pFmtColl( 0 ),
+ bInclRefToxMark( FALSE )
+ {}
+
+ ParaRstFmt( )
+ : pSttNd( 0 ), pEndNd( 0 ), nWhich( 0 ),
+ pDelSet( 0 ), bResetAll( TRUE ), pFmtColl( 0 ),
+ bInclRefToxMark( FALSE )
+ {}
+};
+
+/* in pArgs steht die ChrFmtTablle vom Dokument
+ * (wird bei Selectionen am Start/Ende und bei keiner SSelection benoetigt)
+ */
+
+/*N*/ BOOL lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs )
+/*N*/ {
+/*N*/ ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+/*N*/ SwTxtNode * pTxtNode = (SwTxtNode*)rpNd->GetTxtNode();
+/*N*/ if( pTxtNode && pTxtNode->GetpSwpHints() )
+/*N*/ {
+/*N*/ SwIndex aSt( pTxtNode, 0 );
+/*N*/ USHORT nEnd = pTxtNode->Len();
+/*N*/
+/*N*/ if( &pPara->pSttNd->nNode.GetNode() == pTxtNode &&
+/*N*/ pPara->pSttNd->nContent.GetIndex() )
+/*?*/ aSt = pPara->pSttNd->nContent.GetIndex();
+/*N*/
+/*N*/ if( &pPara->pEndNd->nNode.GetNode() == rpNd )
+/*N*/ nEnd = pPara->pEndNd->nContent.GetIndex();
+/*N*/
+/*?*/ pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
+/*?*/ pPara->pDelSet, pPara->bInclRefToxMark );
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
+/*N*/ {
+/*N*/ ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+/*N*/ SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode();
+/*N*/ if( pNode && pNode->GetpSwAttrSet() )
+/*N*/ {
+/*N*/ // das erhalten der Break-Attribute und der NumRule kommt nicht ins Undo
+/*N*/ BOOL bLocked = pNode->IsModifyLocked();
+/*N*/ pNode->LockModify();
+/*N*/ SwDoc* pDoc = pNode->GetDoc();
+/*N*/
+/*N*/ SfxItemSet aSet( pDoc->GetAttrPool(),
+/*N*/ RES_PAGEDESC, RES_BREAK,
+/*N*/ RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
+/*N*/ RES_LR_SPACE, RES_LR_SPACE,
+/*N*/ 0 );
+/*N*/ SwAttrSet* pSet = pNode->GetpSwAttrSet();
+/*N*/
+/*N*/ USHORT __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK,
+/*N*/ RES_PARATR_NUMRULE };
+/*N*/
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ for( USHORT n = 0; n < 3; ++n )
+/*N*/ if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], FALSE, &pItem ))
+/*N*/ {
+/*?*/ BOOL bSave = FALSE;
+/*?*/ switch( aSavIds[ n ] )
+/*?*/ {
+/*?*/ case RES_PAGEDESC:
+/*?*/ bSave = 0 != ((SwFmtPageDesc*)pItem)->GetPageDesc();
+/*?*/ break;
+/*?*/ case RES_BREAK:
+/*?*/ bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak();
+/*?*/ break;
+/*?*/ case RES_PARATR_NUMRULE:
+/*?*/ bSave = 0 != ((SwNumRuleItem*)pItem)->GetValue().Len();
+/*?*/ break;
+/*?*/ }
+/*?*/ if( bSave )
+/*?*/ {
+/*?*/ aSet.Put( *pItem );
+/*?*/ pSet->ClearItem( aSavIds[n] );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !bLocked )
+/*N*/ pNode->UnlockModify();
+/*N*/
+/*N*/ if( pPara )
+/*N*/ {
+/*N*/ if( pPara->pDelSet && pPara->pDelSet->Count() )
+/*N*/ {
+/*?*/ SfxItemIter aIter( *pPara->pDelSet );
+/*?*/ pItem = aIter.FirstItem();
+/*?*/ while( TRUE )
+/*?*/ {
+/*?*/ pNode->ResetAttr( pItem->Which() );
+/*?*/ if( aIter.IsAtEnd() )
+/*?*/ break;
+/*?*/ pItem = aIter.NextItem();
+/*?*/ }
+/*N*/ }
+/*N*/ else if( pPara->bResetAll )
+/*N*/ pNode->ResetAllAttr();
+/*N*/ else
+/*?*/ pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 );
+/*N*/ }
+/*N*/ else
+/*?*/ pNode->ResetAllAttr();
+/*N*/
+/*N*/ if( aSet.Count() )
+/*N*/ {
+/*?*/ pNode->LockModify();
+/*?*/ pNode->SetAttr( aSet );
+/*?*/
+/*?*/ if( !bLocked )
+/*?*/ pNode->UnlockModify();
+/*N*/ }
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*M*/ void SwDoc::ResetAttr( const SwPaM &rRg, BOOL bTxtAttr,
+/*M*/ const SvUShortsSort* pAttrs )
+/*M*/ {
+/*M*/ SwPaM* pPam = (SwPaM*)&rRg;
+/*M*/ BOOL bStopAttr = FALSE;
+/*M*/ if( !bTxtAttr && pAttrs && pAttrs->Count() &&
+/*M*/ RES_TXTATR_END > (*pAttrs)[ 0 ] )
+/*M*/ bTxtAttr = TRUE;
+/*M*/
+/*M*/ if( !rRg.HasMark() )
+/*M*/ {
+/*M*/ SwTxtNode* pTxtNd = rRg.GetPoint()->nNode.GetNode().GetTxtNode();
+/*M*/ if( !pTxtNd )
+/*M*/ return ;
+/*M*/
+/*M*/ pPam = new SwPaM( *rRg.GetPoint() );
+/*M*/
+/*M*/ SwIndex& rSt = pPam->GetPoint()->nContent;
+/*M*/ USHORT nMkPos = 0, nPtPos = rSt.GetIndex();
+/*M*/ const String& rStr = pTxtNd->GetTxt();
+/*M*/
+/*M*/ // JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut
+/*M*/ // dann wird dessen Bereich genommen
+/*M*/ const SwTxtAttr* pURLAttr;
+/*M*/ if( pTxtNd->HasHints() &&
+/*M*/ 0 != ( pURLAttr = pTxtNd->GetTxtAttr( rSt, RES_TXTATR_INETFMT ))
+/*M*/ && pURLAttr->GetINetFmt().GetValue().Len() )
+/*M*/ {
+/*M*/ nMkPos = *pURLAttr->GetStart();
+/*M*/ nPtPos = *pURLAttr->GetEnd();
+/*M*/ }
+/*M*/ else
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/
+/*M*/ rSt = nMkPos;
+/*M*/ pPam->SetMark();
+/*M*/ pPam->GetPoint()->nContent = nPtPos;
+/*M*/ }
+/*M*/
+/*M*/ SwDataChanged aTmp( *pPam, 0 );
+/*M*/
+/*M*/ const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
+/*M*/ ParaRstFmt aPara( pStt, pEnd );
+/*M*/
+/*N*/ USHORT __FAR_DATA aResetableSetRange[] = {
+/*N*/ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+/*N*/ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+/*N*/ RES_PARATR_BEGIN, RES_PARATR_END-1,
+/*N*/ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+/*N*/ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+/*N*/ RES_TXTATR_CJK_RUBY, RES_TXTATR_UNKNOWN_CONTAINER,
+/*N*/ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+/*N*/ 0
+/*N*/ };
+/*N*/
+/*N*/ SfxItemSet aDelSet( GetAttrPool(), aResetableSetRange );
+/*M*/ if( pAttrs && pAttrs->Count() )
+/*M*/ {
+/*M*/ for( USHORT n = pAttrs->Count(); n; )
+/*M*/ if( POOLATTR_END > (*pAttrs)[ --n ] )
+/*M*/ aDelSet.Put( *GetDfltAttr( (*pAttrs)[ n ] ));
+/*M*/
+/*M*/ if( aDelSet.Count() )
+/*M*/ aPara.pDelSet = &aDelSet;
+/*M*/ }
+/*M*/
+/*M*/ BOOL bAdd = TRUE;
+/*M*/ SwNodeIndex aTmpStt( pStt->nNode );
+/*M*/ SwNodeIndex aTmpEnd( pEnd->nNode );
+/*M*/ if( pStt->nContent.GetIndex() ) // nur ein Teil
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() )
+/*M*/ // dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr
+/*M*/ aTmpEnd++, bAdd = FALSE;
+/*M*/ else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() )
+/*M*/ {
+/*M*/ SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode();
+/*M*/ if( pTNd && pTNd->GetpSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
+/*M*/ {
+/*M*/ SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
+/*M*/ const SfxPoolItem* pItem = aIter.GetCurItem();
+/*M*/ while( TRUE )
+/*M*/ {
+/*M*/ if( IsInRange( aCharFmtSetRange, pItem->Which() ))
+/*M*/ {
+/*M*/ SwTxtAttr* pTAttr = pTNd->MakeTxtAttr( *pItem, 0,
+/*M*/ pTNd->GetTxt().Len() );
+/*M*/ if( !pTNd->pSwpHints )
+/*M*/ pTNd->pSwpHints = new SwpHints;
+/*M*/ pTNd->pSwpHints->SwpHintsArr::Insert( pTAttr );
+/*M*/ pTNd->ResetAttr( pItem->Which() );
+/*M*/ }
+/*M*/ if( aIter.IsAtEnd() )
+/*M*/ break;
+/*M*/ pItem = aIter.NextItem();
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if( aTmpStt < aTmpEnd )
+/*M*/ GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstAttr, &aPara );
+/*M*/ else if( !rRg.HasMark() )
+/*M*/ {
+/*M*/ aPara.bResetAll = FALSE;
+/*M*/ ::binfilter::lcl_RstAttr( &pStt->nNode.GetNode(), &aPara );
+/*M*/ aPara.bResetAll = TRUE;
+/*M*/ }
+/*M*/
+/*M*/ if( bTxtAttr )
+/*M*/ {
+/*M*/ if( bAdd )
+/*M*/ aTmpEnd++;
+/*M*/ GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstTxtAttr, &aPara );
+/*M*/ }
+/*M*/
+/*M*/ if( pPam != &rRg )
+/*M*/ delete pPam;
+/*M*/
+/*M*/ SetModified();
+/*M*/ }
+
+
+
+// Einfuegen der Hints nach Inhaltsformen;
+// wird in SwDoc::Insert(..., SwFmtHint &rHt) benutzt
+
+/*N*/ BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
+/*N*/ USHORT nFlags )
+/*N*/ {
+/*N*/ // teil die Sets auf (fuer Selektion in Nodes)
+/*N*/ SfxItemSet aCharSet( pDoc->GetAttrPool(),
+/*N*/ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+/*N*/ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+/*N*/ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+/*N*/
+/*N*/ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+/*N*/ 0 );
+/*N*/ SfxItemSet aOtherSet( pDoc->GetAttrPool(),
+/*N*/ RES_PARATR_BEGIN, RES_PARATR_END-1,
+/*N*/ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+/*N*/ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+/*N*/ 0 );
+/*N*/
+/*N*/ aCharSet.Put( rChgSet );
+/*N*/ aOtherSet.Put( rChgSet );
+/*N*/
+/*N*/ BOOL bRet = FALSE;
+/*N*/ const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
+/*N*/ SwCntntNode* pNode = pStt->nNode.GetNode().GetCntntNode();
+/*N*/
+/*N*/ if( pNode && pNode->IsTxtNode() )
+/*N*/ {
+/*N*/ const SwIndex& rSt = pStt->nContent;
+/*N*/
+/*N*/ // Attribute ohne Ende haben keinen Bereich
+/*N*/ {
+/*N*/ SfxItemSet aTxtSet( pDoc->GetAttrPool(),
+/*N*/ RES_TXTATR_NOEND_BEGIN, RES_TXTATR_NOEND_END-1 );
+/*N*/ aTxtSet.Put( rChgSet );
+/*N*/ if( aTxtSet.Count() )
+/*N*/ {
+ ((SwTxtNode*)pNode)->SetAttr( aTxtSet, rSt.GetIndex(), rSt.GetIndex(), nFlags );
+/*N*/ bRet = TRUE;
+/*N*/
+/*N*/ if( pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline() &&
+/*N*/ pDoc->GetRedlineTbl().Count() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aPam( pStt->nNode, pStt->nContent.GetIndex()-1,
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // TextAttribute mit Ende expandieren nie ihren Bereich
+/*N*/ {
+/*N*/ // CharFmt wird gesondert behandelt !!!
+/*N*/ // JP 22.08.96: URL-Attribute auch!!
+/*N*/ SfxItemSet aTxtSet( pDoc->GetAttrPool(),
+/*N*/ RES_TXTATR_DUMMY4, RES_TXTATR_TOXMARK,
+/*N*/ RES_TXTATR_DUMMY5, RES_TXTATR_WITHEND_END-1,
+/*N*/ 0 );
+/*N*/
+/*N*/ aTxtSet.Put( rChgSet );
+/*N*/ if( aTxtSet.Count() )
+/*N*/ {
+/*N*/ USHORT nInsCnt = rSt.GetIndex();
+/*N*/ USHORT nEnd = pStt->nNode == pEnd->nNode
+/*N*/ ? pEnd->nContent.GetIndex()
+/*N*/ : pNode->Len();
+ ((SwTxtNode*)pNode)->SetAttr( aTxtSet, nInsCnt, nEnd, nFlags );
+/*N*/ bRet = TRUE;
+/*N*/
+/*N*/ if( pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline() &&
+/*N*/ pDoc->GetRedlineTbl().Count() ) )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // wurde Text-Inhalt eingefuegt? (RefMark/TOXMarks ohne Ende)
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // bei PageDesc's, die am Node gesetzt werden, muss immer das
+/*N*/ // Auto-Flag gesetzt werden!!
+/*N*/ const SvxLRSpaceItem* pLRSpace = 0;
+/*N*/ if( aOtherSet.Count() )
+/*N*/ {
+/*N*/ SwTableNode* pTblNd;
+/*N*/ const SwFmtPageDesc* pDesc;
+/*N*/ if( SFX_ITEM_SET == aOtherSet.GetItemState( RES_PAGEDESC,
+/*N*/ FALSE, (const SfxPoolItem**)&pDesc ))
+/*N*/ {
+/*N*/ if( pNode )
+/*N*/ {
+/*N*/ // Auto-Flag setzen, nur in Vorlagen ist ohne Auto !
+/*N*/ SwFmtPageDesc aNew( *pDesc );
+/*N*/ // Bug 38479: AutoFlag wird jetzt in der WrtShell gesetzt
+/*N*/ // aNew.SetAuto();
+/*N*/
+/*N*/ // Tabellen kennen jetzt auch Umbrueche
+/*N*/ if( 0 == (nFlags & SETATTR_APICALL) &&
+/*N*/ 0 != ( pTblNd = pNode->FindTableNode() ) )
+/*N*/ {
+/*N*/ // dann am Tabellen Format setzen
+/*?*/ SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
+/*?*/ pFmt->SetAttr( aNew );
+/*?*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pNode->SetAttr( aNew );
+/*N*/ }
+/*N*/ }
+/*N*/ aOtherSet.ClearItem( RES_PAGEDESC );
+/*N*/ if( !aOtherSet.Count() )
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // Tabellen kennen jetzt auch Umbrueche
+/*N*/ const SvxFmtBreakItem* pBreak;
+/*N*/ if( pNode && 0 == (nFlags & SETATTR_APICALL) &&
+/*N*/ 0 != (pTblNd = pNode->FindTableNode() ) &&
+/*N*/ SFX_ITEM_SET == aOtherSet.GetItemState( RES_BREAK,
+/*N*/ FALSE, (const SfxPoolItem**)&pBreak ) )
+/*N*/ {
+/*?*/ // dann am Tabellen Format setzen
+/*?*/ SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
+/*?*/ pFmt->SetAttr( *pBreak );
+/*?*/
+/*?*/ aOtherSet.ClearItem( RES_BREAK );
+/*?*/ if( !aOtherSet.Count() )
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // fuer Sonderbehandlung von LR-Space innerhalb einer Numerierung !!!
+/*N*/ aOtherSet.GetItemState( RES_LR_SPACE, FALSE,
+/*N*/ (const SfxPoolItem**)&pLRSpace );
+/*N*/
+/*N*/ {
+/*N*/ // wenns eine PoolNumRule ist, diese ggfs. anlegen
+/*N*/ const SwNumRuleItem* pRule;
+/*N*/ USHORT nPoolId;
+/*N*/ if( SFX_ITEM_SET == aOtherSet.GetItemState( RES_PARATR_NUMRULE,
+/*N*/ FALSE, (const SfxPoolItem**)&pRule ) &&
+/*N*/ !pDoc->FindNumRulePtr( pRule->GetValue() ) &&
+/*N*/ USHRT_MAX != (nPoolId = SwStyleNameMapper::GetPoolIdFromUIName ( pRule->GetValue(),
+/*N*/ GET_POOLID_NUMRULE )) )
+/*?*/ pDoc->GetNumRuleFromPool( nPoolId );
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ if( !rRg.HasMark() ) // kein Bereich
+/*N*/ {
+/*N*/ if( !pNode )
+/*N*/ return bRet;
+/*N*/
+/*N*/ if( pNode->IsTxtNode() && aCharSet.Count() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwTxtNode* pTxtNd = (SwTxtNode*)pNode;
+/*N*/ }
+/*N*/ if( aOtherSet.Count() )
+/*N*/ {
+/*?*/ pNode->SetAttr( aOtherSet );
+/*?*/ bRet = TRUE;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*N*/
+/*N*/ if( pDoc->IsRedlineOn() && aCharSet.Count() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( pUndo )
+/*N*/ }
+
+ /* jetzt wenn Bereich */
+/*N*/ ULONG nNodes = 0;
+/*N*/
+/*N*/ SwNodeIndex aSt( pDoc->GetNodes() );
+/*N*/ SwNodeIndex aEnd( pDoc->GetNodes() );
+/*N*/ SwIndex aCntEnd( pEnd->nContent );
+/*N*/
+/*N*/ if( pNode )
+/*N*/ {
+/*N*/ USHORT nLen = pNode->Len();
+/*N*/ if( pStt->nNode != pEnd->nNode )
+/*N*/ aCntEnd.Assign( pNode, nLen );
+/*N*/
+/*N*/ if( pStt->nContent.GetIndex() != 0 || aCntEnd.GetIndex() != nLen )
+/*N*/ {
+ ((SwTxtNode*)pNode)->SetAttr( aCharSet, pStt->nContent.GetIndex(), aCntEnd.GetIndex(), nFlags );
+/*N*/ if( aOtherSet.Count() )
+/*N*/ {
+/*N*/ pNode->SetAttr( aOtherSet );
+/*N*/ }
+/*N*/
+/*N*/ // lediglich Selektion in einem Node.
+/*N*/ if( pStt->nNode == pEnd->nNode )
+/*N*/ return TRUE;
+/*N*/ ++nNodes;
+/*?*/ aSt.Assign( pStt->nNode.GetNode(), +1 );
+/*N*/ }
+/*N*/ else
+/*N*/ aSt = pStt->nNode;
+/*N*/ aCntEnd = pEnd->nContent; // aEnd wurde veraendert !!
+/*N*/ }
+/*N*/ else
+/*N*/ aSt.Assign( pStt->nNode.GetNode(), +1 );
+/*N*/
+/*N*/ // aSt zeigt jetzt auf den ersten vollen Node
+/*N*/
+ /*
+ * die Selektion umfasst mehr als einen Node
+ */
+/*N*/ if( pStt->nNode < pEnd->nNode )
+/*N*/ {
+/*N*/ pNode = pEnd->nNode.GetNode().GetCntntNode();
+/*N*/ if(pNode)
+/*N*/ {
+/*N*/ USHORT nLen = pNode->Len();
+/*N*/ if( aCntEnd.GetIndex() != nLen )
+/*N*/ {
+ ((SwTxtNode*)pNode)->SetAttr( aCharSet, 0, aCntEnd.GetIndex(), nFlags );
+/*N*/ if( aOtherSet.Count() )
+/*N*/ {
+/*N*/ pNode->SetAttr( aOtherSet );
+/*N*/ }
+/*N*/
+/*N*/ ++nNodes;
+/*N*/ aEnd = pEnd->nNode;
+/*N*/ }
+/*N*/ else
+/*?*/ aEnd.Assign( pEnd->nNode.GetNode(), +1 );
+/*N*/ }
+/*N*/ else
+/*?*/ aEnd = pEnd->nNode;
+/*N*/ }
+/*N*/ else
+/*N*/ aEnd.Assign( pEnd->nNode.GetNode(), +1 );
+/*N*/
+/*N*/ // aEnd zeigt jetzt HINTER den letzten voll Node
+/*N*/
+/*N*/ /* Bearbeitung der vollstaendig selektierten Nodes. */
+/*N*/ // alle Attribute aus dem Set zuruecksetzen !!
+/*N*/ if( aCharSet.Count() && !( SETATTR_DONTREPLACE & nFlags ) )
+/*N*/ {
+/*N*/
+/*N*/ ParaRstFmt aPara( pStt, pEnd, 0, &aCharSet );
+/*N*/ pDoc->GetNodes().ForEach( aSt, aEnd, lcl_RstTxtAttr, &aPara );
+/*N*/ }
+/*N*/
+/*N*/ #ifdef USED
+/*N*/ //JP 30.10.96: siehe unten
+/*N*/ // sollte ueber mehrere Nodes das SwFmtChrFmt gesetzt werden ??
+/*N*/ const SfxPoolItem* pChrFmtItem = 0;
+/*N*/ aCharSet.GetItemState( RES_TXTATR_CHARFMT, FALSE, &pChrFmtItem );
+/*N*/ #endif
+/*N*/ BOOL bCreateSwpHints =
+/*N*/ SFX_ITEM_SET == aCharSet.GetItemState( RES_TXTATR_CHARFMT, FALSE ) ||
+/*N*/ SFX_ITEM_SET == aCharSet.GetItemState( RES_TXTATR_INETFMT, FALSE );
+/*N*/
+/*N*/ for(; aSt < aEnd; aSt++ )
+/*N*/ {
+/*N*/ pNode = aSt.GetNode().GetCntntNode();
+/*N*/ if( !pNode )
+/*N*/ continue;
+/*N*/
+/*N*/ SwTxtNode* pTNd = pNode->GetTxtNode();
+/*N*/ {
+/*N*/ if( pTNd && aCharSet.Count() )
+/*?*/ pTNd->SetAttr( aCharSet, 0, pTNd->GetTxt().Len(), nFlags );
+/*N*/ if( aOtherSet.Count() )
+/*N*/ pNode->SetAttr( aOtherSet );
+/*N*/ }
+/*N*/ ++nNodes;
+/*N*/ }
+/*N*/
+/*N*/ return nNodes != 0;
+/*N*/ }
+
+
+/*N*/ BOOL SwDoc::Insert( const SwPaM &rRg, const SfxPoolItem &rHt, USHORT nFlags )
+/*N*/ {
+/*N*/ SwDataChanged aTmp( rRg, 0 );
+/*N*/ BOOL bRet;
+/*N*/
+/*N*/ SfxItemSet aSet( GetAttrPool(), rHt.Which(), rHt.Which() );
+/*N*/ aSet.Put( rHt );
+/*N*/ bRet = InsAttr( this, rRg, aSet, nFlags );
+
+/* if( INSATTR_DONTEXPAND & nFlags )
+ {
+ USHORT nWhich = rHt.Which();
+ const SwPosition* pPos = rRg.End();
+ SwTxtNode* pTxtNd = GetNodes()[ pPos->nNode ]->GetTxtNode();
+ SwpHints* pHts;
+ if( pTxtNd && 0 != ( pHts = pTxtNd->GetpSwpHints()) )
+ {
+ USHORT nPos = pHts->GetEndCount();
+ while( nPos )
+ {
+ SwTxtAttr *pTmp = pHts->GetEnd( --nPos );
+ USHORT *pEnd = pTmp->GetEnd();
+ if( !pEnd || *pEnd > nEnd )
+ continue;
+ if( nEnd != *pEnd )
+ nPos = 0;
+ else if( nWhich == pTmp->Which() )
+ pTmp->SetDontExpand( TRUE );
+ }
+ }
+ }
+*/
+/*N*/ if( bRet )
+/*N*/ SetModified();
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ BOOL SwDoc::Insert( const SwPaM &rRg, const SfxItemSet &rSet, USHORT nFlags )
+/*N*/ {
+/*N*/ SwDataChanged aTmp( rRg, 0 );
+/*N*/ BOOL bRet = InsAttr( this, rRg, rSet, nFlags );
+/*N*/
+/*N*/ if( bRet )
+/*N*/ SetModified();
+/*N*/ return bRet;
+/*N*/ }
+
+
+ // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
+ // das alte in die Undo-History aufgenommen
+/*N*/ void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt )
+/*N*/ {
+/*N*/ SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
+/*N*/ aSet.Put( rAttr );
+/*N*/ SetAttr( aSet, rFmt );
+/*N*/ }
+
+
+ // Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
+ // das alte in die Undo-History aufgenommen
+/*N*/ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt )
+/*N*/ {
+/*?*/ rFmt.SetAttr( rSet );
+/*N*/ SetModified();
+/*N*/ }
+
+/*N*/ int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
+/*N*/ SvxTabStopItem& rChgTabStop )
+/*N*/ {
+/*N*/ // dann aender bei allen TabStop die default's auf den neuen Wert
+/*N*/ // !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet,
+/*N*/ // damit nicht in allen Sets die gleiche Berechnung
+/*N*/ // auf dem gleichen TabStop (gepoolt!) vorgenommen
+/*N*/ // wird. Als Modify wird ein FmtChg verschickt.
+/*N*/
+/*N*/ USHORT nOldCnt = rChgTabStop.Count();
+/*N*/ if( !nOldCnt || nOldWidth == nNewWidth )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ // suche den Anfang der Defaults
+/*N*/ SvxTabStop* pTabs = ((SvxTabStop*)rChgTabStop.GetStart())
+/*N*/ + (nOldCnt-1);
+ USHORT n;
+/*N*/ for( n = nOldCnt; n ; --n, --pTabs )
+/*N*/ if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() )
+/*N*/ break;
+/*N*/ ++n;
+/*N*/ if( n < nOldCnt ) // die DefTabStops loeschen
+/*?*/ rChgTabStop.Remove( n, nOldCnt - n );
+/*N*/ return TRUE;
+/*N*/ }
+
+ // Setze das Attribut als neues default Attribut in diesem Dokument.
+ // Ist Undo aktiv, wird das alte in die Undo-History aufgenommen
+/*N*/ void SwDoc::SetDefault( const SfxPoolItem& rAttr )
+/*N*/ {
+/*N*/ SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
+/*N*/ aSet.Put( rAttr );
+/*N*/ SetDefault( aSet );
+/*N*/ }
+
+/*N*/ void SwDoc::SetDefault( const SfxItemSet& rSet )
+/*N*/ {
+/*N*/ if( !rSet.Count() )
+/*N*/ return;
+/*N*/
+/*N*/ SwModify aCallMod( 0 );
+/*N*/ SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ),
+/*N*/ aNew( GetAttrPool(), rSet.GetRanges() );
+/*N*/ SfxItemIter aIter( rSet );
+/*N*/ register USHORT nWhich;
+/*N*/ const SfxPoolItem* pItem = aIter.GetCurItem();
+/*N*/ SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool();
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ BOOL bCheckSdrDflt = FALSE;
+/*N*/ nWhich = pItem->Which();
+/*N*/ aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) );
+/*N*/ GetAttrPool().SetPoolDefaultItem( *pItem );
+/*N*/ aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
+/*N*/
+/*N*/ if( RES_CHRATR_BEGIN <= nWhich && RES_TXTATR_END > nWhich )
+/*N*/ {
+/*N*/ aCallMod.Add( pDfltTxtFmtColl );
+/*N*/ aCallMod.Add( pDfltCharFmt );
+/*N*/ bCheckSdrDflt = 0 != pSdrPool;
+/*N*/ }
+/*N*/ else if( RES_PARATR_BEGIN <= nWhich && RES_PARATR_END > nWhich )
+/*N*/ {
+/*N*/ aCallMod.Add( pDfltTxtFmtColl );
+/*N*/ bCheckSdrDflt = 0 != pSdrPool;
+/*N*/ }
+/*N*/ else if( RES_GRFATR_BEGIN <= nWhich && RES_GRFATR_END > nWhich )
+/*?*/ aCallMod.Add( pDfltGrfFmtColl );
+/*?*/ else if( RES_FRMATR_BEGIN <= nWhich && RES_FRMATR_END > nWhich )
+/*?*/ {
+/*?*/ aCallMod.Add( pDfltGrfFmtColl );
+/*?*/ aCallMod.Add( pDfltTxtFmtColl );
+/*?*/ aCallMod.Add( pDfltFrmFmt );
+/*?*/ }
+/*?*/ else if( RES_BOXATR_BEGIN <= nWhich && RES_BOXATR_END > nWhich )
+/*?*/ aCallMod.Add( pDfltFrmFmt );
+
+ // copy also the defaults
+/*N*/ if( bCheckSdrDflt )
+/*N*/ {
+/*N*/ USHORT nEdtWhich, nSlotId;
+/*N*/ if( 0 != (nSlotId = GetAttrPool().GetSlotId( nWhich ) ) &&
+/*N*/ nSlotId != nWhich &&
+/*N*/ 0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) &&
+/*N*/ nSlotId != nEdtWhich )
+/*N*/ {
+/*N*/ SfxPoolItem* pCpy = pItem->Clone();
+/*N*/ pCpy->SetWhich( nEdtWhich );
+/*N*/ pSdrPool->SetPoolDefaultItem( *pCpy );
+/*N*/ delete pCpy;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( aIter.IsAtEnd() )
+/*N*/ break;
+/*N*/ pItem = aIter.NextItem();
+/*N*/ }
+/*N*/
+/*N*/ if( aNew.Count() && aCallMod.GetDepends() )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( ( SFX_ITEM_SET ==
+/*N*/ aNew.GetItemState( RES_PARATR_TABSTOP, FALSE, &pItem ) ) &&
+/*N*/ ((SvxTabStopItem*)pItem)->Count() )
+/*N*/ {
+/*N*/ // TabStop-Aenderungen behandeln wir erstmal anders:
+/*N*/ // dann aender bei allen TabStop die dafault's auf den neuen Wert
+/*N*/ // !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet,
+/*N*/ // damit nicht in allen Sets die gleiche Berechnung
+/*N*/ // auf dem gleichen TabStop (gepoolt!) vorgenommen
+/*N*/ // wird. Als Modify wird ein FmtChg verschickt.
+/*N*/ SwTwips nNewWidth = (*(SvxTabStopItem*)pItem)[ 0 ].GetTabPos(),
+/*N*/ nOldWidth = ((SvxTabStopItem&)aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos();
+/*N*/
+/*N*/ int bChg = FALSE;
+/*N*/ USHORT nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_TABSTOP );
+/*N*/ for( USHORT n = 0; n < nMaxItems; ++n )
+/*N*/ if( 0 != (pItem = GetAttrPool().GetItem( RES_PARATR_TABSTOP, n ) ))
+/*N*/ bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth,
+/*N*/ *(SvxTabStopItem*)pItem );
+/*N*/
+/*N*/ aNew.ClearItem( RES_PARATR_TABSTOP );
+/*N*/ aOld.ClearItem( RES_PARATR_TABSTOP );
+/*N*/ if( bChg )
+/*N*/ {
+/*N*/ SwFmtChg aChgFmt( pDfltCharFmt );
+/*N*/ // dann sage mal den Frames bescheid
+/*N*/ aCallMod.Modify( &aChgFmt, &aChgFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( aNew.Count() && aCallMod.GetDepends() )
+/*N*/ {
+/*N*/ SwAttrSetChg aChgOld( aOld, aOld );
+/*N*/ SwAttrSetChg aChgNew( aNew, aNew );
+/*N*/ aCallMod.Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/
+/*N*/ // und die default-Formate wieder beim Object austragen
+/*N*/ SwClient* pDep;
+/*N*/ while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) )
+/*N*/ aCallMod.Remove( pDep );
+/*N*/
+/*N*/ SetModified();
+/*N*/ }
+
+ // Erfrage das Default Attribut in diesem Dokument.
+/*N*/ const SfxPoolItem& SwDoc::GetDefault( USHORT nFmtHint ) const
+/*N*/ {
+/*N*/ return GetAttrPool().GetDefaultItem( nFmtHint );
+/*N*/ }
+
+/*
+ * Loeschen der Formate
+ */
+void SwDoc::DelCharFmt(USHORT nFmt)
+{
+ pCharFmtTbl->DeleteAndDestroy(nFmt);
+ SetModified();
+}
+
+void SwDoc::DelCharFmt( SwCharFmt *pFmt )
+{
+ USHORT nFmt = pCharFmtTbl->GetPos( pFmt );
+ ASSERT( USHRT_MAX != nFmt, "Fmt not found," );
+ DelCharFmt( nFmt );
+}
+
+/*N*/ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt )
+/*N*/ {
+/*N*/ if( pFmt->ISA( SwTableBoxFmt ) || pFmt->ISA( SwTableLineFmt ))
+/*N*/ {
+/*?*/ ASSERT( !this, "Format steht nicht mehr im DocArray, "
+/*?*/ "kann per delete geloescht werden" );
+/*?*/ delete pFmt;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Das Format muss in einem der beiden Arrays stehen, in welchem
+/*N*/ //werden wir schon merken.
+/*N*/ USHORT nPos;
+/*N*/ if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) )
+/*N*/ pFrmFmtTbl->DeleteAndDestroy( nPos );
+/*N*/ else
+/*N*/ {
+/*N*/ nPos = GetSpzFrmFmts()->GetPos( pFmt );
+/*N*/ ASSERT( nPos != USHRT_MAX, "FrmFmt not found." );
+/*N*/ if( USHRT_MAX != nPos )
+/*N*/ GetSpzFrmFmts()->DeleteAndDestroy( nPos );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt )
+/*N*/ {
+/*N*/ USHORT nPos = pTblFrmFmtTbl->GetPos( pFmt );
+/*N*/ ASSERT( USHRT_MAX != nPos, "Fmt not found," );
+/*N*/ pTblFrmFmtTbl->DeleteAndDestroy( nPos );
+/*N*/ }
+
+/*
+ * Erzeugen der Formate
+ */
+/*N*/ SwFlyFrmFmt *SwDoc::MakeFlyFrmFmt( const String &rFmtName,
+/*N*/ SwFrmFmt *pDerivedFrom )
+/*N*/ {
+/*N*/ SwFlyFrmFmt *pFmt = new SwFlyFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+/*N*/ GetSpzFrmFmts()->Insert(pFmt, GetSpzFrmFmts()->Count());
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+/*N*/ SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const String &rFmtName,
+/*N*/ SwFrmFmt *pDerivedFrom )
+/*N*/ {
+/*N*/ SwDrawFrmFmt *pFmt = new SwDrawFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom);
+/*N*/ GetSpzFrmFmts()->Insert(pFmt,GetSpzFrmFmts()->Count());
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+
+/*N*/ USHORT SwDoc::GetTblFrmFmtCount(BOOL bUsed) const
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 USHORT nCount = pTblFrmFmtTbl->Count();
+/*N*/ }
+
+
+/*N*/ SwFrmFmt& SwDoc::GetTblFrmFmt(USHORT nFmt, BOOL bUsed ) const
+/*N*/ {
+/*?*/ USHORT nRemoved = 0;
+/*?*/ if(bUsed)
+/*?*/ {
+/*?*/ SwAutoFmtGetDocNode aGetHt( &aNodes );
+/*?*/ for ( USHORT i = 0; i <= nFmt; i++ )
+/*?*/ {
+/*?*/ while ( (*pTblFrmFmtTbl)[ i + nRemoved]->GetInfo( aGetHt ))
+/*?*/ {
+/*?*/ nRemoved++;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ return *((*pTblFrmFmtTbl)[nRemoved + nFmt]);
+/*N*/}
+
+/*N*/ SwTableFmt* SwDoc::MakeTblFrmFmt( const String &rFmtName,
+/*N*/ SwFrmFmt *pDerivedFrom )
+/*N*/ {
+/*N*/ SwTableFmt* pFmt = new SwTableFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+/*N*/ pTblFrmFmtTbl->Insert( pFmt, pTblFrmFmtTbl->Count() );
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+/*N*/ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName,
+/*N*/ SwFrmFmt *pDerivedFrom)
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+/*N*/ pFrmFmtTbl->Insert( pFmt, pFrmFmtTbl->Count());
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+/*N*/ SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName,
+/*N*/ SwCharFmt *pDerivedFrom)
+/*N*/ {
+/*N*/ SwCharFmt *pFmt = new SwCharFmt( GetAttrPool(), rFmtName, pDerivedFrom );
+/*N*/ pCharFmtTbl->Insert( pFmt, pCharFmtTbl->Count() );
+/*N*/ pFmt->SetAuto( FALSE );
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+
+/*
+ * Erzeugen der FormatCollections
+ */
+// TXT
+
+/*N*/ SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName,
+/*N*/ SwTxtFmtColl *pDerivedFrom)
+/*N*/ {
+/*N*/ SwTxtFmtColl *pFmtColl = new SwTxtFmtColl( GetAttrPool(), rFmtName,
+/*N*/ pDerivedFrom );
+/*N*/ pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
+/*N*/ pFmtColl->SetAuto( FALSE );
+/*N*/ SetModified();
+/*N*/ return pFmtColl;
+/*N*/ }
+
+//FEATURE::CONDCOLL
+/*NBFF*/SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const String &rFmtName,
+/*NBFF*/ SwTxtFmtColl *pDerivedFrom )
+/*NBFF*/{
+/*NBFF*/ SwConditionTxtFmtColl*pFmtColl = new SwConditionTxtFmtColl( GetAttrPool(),
+/*NBFF*/ rFmtName, pDerivedFrom );
+/*NBFF*/ pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
+/*NBFF*/ pFmtColl->SetAuto( FALSE );
+/*NBFF*/ SetModified();
+/*NBFF*/ return pFmtColl;
+/*NBFF*/}
+//FEATURE::CONDCOLL
+
+// GRF
+
+
+
+
+
+
+/*N*/ BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
+/*N*/ {
+/*N*/ // ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs;
+/*N*/ SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode();
+/*N*/ if( pCNd )
+/*N*/ {
+/*N*/ ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
+/*N*/ if ( pPara->bReset )
+/*N*/ lcl_RstAttr( pCNd, pPara );
+/*N*/
+/*N*/ // erst in die History aufnehmen, damit ggfs. alte Daten
+/*N*/ // gesichert werden koennen
+/*N*/ pCNd->ChgFmtColl( pPara->pFmtColl );
+/*N*/ pPara->nWhich++;
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL SwDoc::SetTxtFmtColl(const SwPaM &rRg, SwTxtFmtColl *pFmt, BOOL bReset)
+/*N*/ {
+/*N*/ SwDataChanged aTmp( rRg, 0 );
+/*N*/ const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
+/*N*/ BOOL bRet = TRUE;
+/*N*/
+/*N*/ if( rRg.HasMark() )
+/*N*/ {
+/*N*/ ParaRstFmt aPara( pStt, pEnd );
+/*N*/ aPara.pFmtColl = pFmt;
+/*N*/ aPara.bReset = bReset;
+/*N*/ GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
+/*N*/ lcl_SetTxtFmtColl, &aPara );
+/*N*/ if( !aPara.nWhich )
+/*N*/ bRet = FALSE; // keinen gueltigen Node gefunden
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // ein enzelner Node:
+/*N*/ SwCntntNode* pCNd = rRg.GetPoint()->nNode.GetNode().GetCntntNode();
+/*N*/ if( pCNd )
+/*N*/ {
+/*N*/ if( bReset && pCNd->GetpSwAttrSet() )
+/*N*/ {
+/*?*/ ParaRstFmt aPara;
+/*?*/ aPara.pFmtColl = pFmt;
+/*?*/ lcl_RstAttr( pCNd, &aPara );
+/*N*/ }
+/*N*/
+/*N*/ pCNd->ChgFmtColl( pFmt );
+/*N*/ }
+/*N*/ else
+/*N*/ bRet = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if( bRet )
+/*N*/ SetModified();
+/*N*/ return bRet;
+/*N*/ }
+
+
+// ---- Kopiere die Formate in sich selbst (SwDoc) ----------------------
+
+/*N*/ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt,
+/*N*/ const SvPtrarr& rFmtArr,
+/*N*/ FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt )
+/*N*/ {
+/*N*/ // kein-Autoformat || default Format || Collection-Format
+/*N*/ // dann suche danach.
+/*N*/ if( !rFmt.IsAuto() || !rFmt.GetRegisteredIn() )
+/*N*/ for( USHORT n = 0; n < rFmtArr.Count(); n++ )
+/*N*/ {
+/*N*/ // ist die Vorlage schon im Doc vorhanden ??
+/*N*/ if( ((SwFmt*)rFmtArr[n])->GetName().Equals( rFmt.GetName() ))
+/*N*/ return (SwFmt*)rFmtArr[n];
+/*N*/ }
+/*N*/
+/*N*/ // suche erstmal nach dem "Parent"
+/*N*/ SwFmt* pParent = (SwFmt*)&rDfltFmt;
+/*N*/ if( rFmt.DerivedFrom() && pParent != rFmt.DerivedFrom() )
+/*N*/ pParent = CopyFmt( *rFmt.DerivedFrom(), rFmtArr,
+/*N*/ fnCopyFmt, rDfltFmt );
+/*N*/
+/*N*/ // erzeuge das Format und kopiere die Attribute
+/*?*/ SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent );
+/*?*/ pNewFmt->SetAuto( rFmt.IsAuto() );
+/*?*/ pNewFmt->CopyAttrs( rFmt, TRUE ); // kopiere Attribute
+/*?*/
+/*?*/ pNewFmt->SetPoolFmtId( rFmt.GetPoolFmtId() );
+/*?*/ pNewFmt->SetPoolHelpId( rFmt.GetPoolHelpId() );
+/*?*/
+/*?*/ // HelpFile-Id immer auf dflt setzen !!
+/*?*/ pNewFmt->SetPoolHlpFileId( UCHAR_MAX );
+/*?*/
+/*?*/ return pNewFmt;
+/*N*/ }
+
+// ---- kopiere das Frame-Format --------
+/*N*/ SwFrmFmt* SwDoc::CopyFrmFmt( const SwFrmFmt& rFmt )
+/*N*/ {
+/*N*/ return (SwFrmFmt*)CopyFmt( rFmt, *GetFrmFmts(),
+/*N*/ (FNCopyFmt)&SwDoc::MakeFrmFmt,
+/*N*/ *GetDfltFrmFmt() );
+/*N*/ }
+
+// ---- kopiere das Char-Format --------
+/*N*/ SwCharFmt* SwDoc::CopyCharFmt( const SwCharFmt& rFmt )
+/*N*/ {
+/*N*/ return (SwCharFmt*)CopyFmt( rFmt, *GetCharFmts(),
+/*N*/ (FNCopyFmt)&SwDoc::MakeCharFmt,
+/*N*/ *GetDfltCharFmt() );
+/*N*/ }
+
+
+// --- Kopiere TextNodes ----
+
+/*N*/ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl )
+/*N*/ {
+/*N*/ SwTxtFmtColl* pNewColl = FindTxtFmtCollByName( rColl.GetName() );
+/*N*/ if( pNewColl )
+/*N*/ return pNewColl;
+
+ // suche erstmal nach dem "Parent"
+/*?*/ SwTxtFmtColl* pParent = pDfltTxtFmtColl;
+/*?*/ if( pParent != rColl.DerivedFrom() )
+/*?*/ pParent = CopyTxtColl( *(SwTxtFmtColl*)rColl.DerivedFrom() );
+/*?*/
+
+//FEATURE::CONDCOLL
+/*?*/ if( RES_CONDTXTFMTCOLL == rColl.Which() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), rColl.GetName(),
+/*?*/ }
+/*?*/ else
+/*?*/ //FEATURE::CONDCOLL
+/*?*/ pNewColl = MakeTxtFmtColl( rColl.GetName(), pParent );
+/*?*/
+/*?*/ // kopiere jetzt noch die Auto-Formate oder kopiere die Attribute
+/*?*/ pNewColl->CopyAttrs( rColl, TRUE );
+/*?*/
+/*?*/ // setze noch den Outline-Level
+/*?*/ if( NO_NUMBERING != rColl.GetOutlineLevel() )
+/*?*/ pNewColl->SetOutlineLevel( rColl.GetOutlineLevel() );
+/*?*/
+/*?*/ pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() );
+/*?*/ pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
+/*?*/
+/*?*/ // HelpFile-Id immer auf dflt setzen !!
+/*?*/ pNewColl->SetPoolHlpFileId( UCHAR_MAX );
+/*?*/
+/*?*/ if( &rColl.GetNextTxtFmtColl() != &rColl )
+/*?*/ pNewColl->SetNextTxtFmtColl( *CopyTxtColl( rColl.GetNextTxtFmtColl() ));
+/*?*/
+/*?*/ // ggfs. die NumRule erzeugen
+/*?*/ if( this != rColl.GetDoc() )
+/*?*/ {
+/*?*/ const SfxPoolItem* pItem;
+/*?*/ if( SFX_ITEM_SET == pNewColl->GetItemState( RES_PARATR_NUMRULE,
+/*?*/ FALSE, &pItem ))
+/*?*/ {
+/*?*/ const SwNumRule* pRule;
+/*?*/ const String& rName = ((SwNumRuleItem*)pItem)->GetValue();
+/*?*/ if( rName.Len() &&
+/*?*/ 0 != ( pRule = rColl.GetDoc()->FindNumRulePtr( rName )) &&
+/*?*/ !pRule->IsAutoRule() )
+/*?*/ {
+/*?*/ SwNumRule* pDestRule = FindNumRulePtr( rName );
+/*?*/ if( pDestRule )
+/*?*/ pDestRule->SetInvalidRule( TRUE );
+/*?*/ else
+/*?*/ MakeNumRule( rName, pRule );
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ return pNewColl;
+/*N*/ }
+
+// --- Kopiere GrafikNodes ----
+
+/*N*/ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl )
+/*N*/ {
+/*N*/ SwGrfFmtColl* pNewColl = FindGrfFmtCollByName( rColl.GetName() );
+/*N*/ if( pNewColl )
+/*N*/ return pNewColl;
+
+ // suche erstmal nach dem "Parent"
+/*?*/ SwGrfFmtColl* pParent = pDfltGrfFmtColl;
+/*?*/ if( pParent != rColl.DerivedFrom() )
+/*?*/ pParent = CopyGrfColl( *(SwGrfFmtColl*)rColl.DerivedFrom() );
+/*?*/
+/*?*/ // falls nicht, so kopiere sie
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pNewColl = MakeGrfFmtColl( rColl.GetName(), pParent );
+/*?*/
+/*?*/ // noch die Attribute kopieren
+/*?*/ pNewColl->CopyAttrs( rColl );
+/*?*/
+/*?*/ pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() );
+/*?*/ pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
+/*?*/
+/*?*/ // HelpFile-Id immer auf dflt setzen !!
+/*?*/ pNewColl->SetPoolHlpFileId( UCHAR_MAX );
+/*?*/
+/*?*/ return pNewColl;
+/*N*/ }
+
+
+/*N*/ SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr,
+/*N*/ const String& rName ) const
+/*N*/ {
+/*N*/ SwFmt* pFnd = 0;
+/*N*/ for( USHORT n = 0; n < rFmtArr.Count(); n++ )
+/*N*/ {
+/*N*/ // ist die Vorlage schon im Doc vorhanden ??
+/*N*/ if( ((SwFmt*)rFmtArr[n])->GetName() == rName )
+/*N*/ {
+/*N*/ pFnd = (SwFmt*)rFmtArr[n];
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return pFnd;
+/*N*/ }
+
+
+
+/*N*/ SwTableBoxFmt* SwDoc::MakeTableBoxFmt()
+/*N*/ {
+/*N*/ SwTableBoxFmt* pFmt = new SwTableBoxFmt( GetAttrPool(), aEmptyStr,
+/*N*/ pDfltFrmFmt );
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+/*N*/ SwTableLineFmt* SwDoc::MakeTableLineFmt()
+/*N*/ {
+/*N*/ SwTableLineFmt* pFmt = new SwTableLineFmt( GetAttrPool(), aEmptyStr,
+/*N*/ pDfltFrmFmt );
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+/*N*/ void SwDoc::_CreateNumberFormatter()
+/*N*/ {
+/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::_CreateNumberFormatter" );
+/*N*/
+/*N*/ ASSERT( !pNumberFormatter, "ist doch schon vorhanden" );
+/*N*/
+/*N*/
+/*N*/ LanguageType eLang = LANGUAGE_SYSTEM; //System::GetLanguage();
+/* ((const SvxLanguageItem&)GetAttrPool().
+ GetDefaultItem( RES_CHRATR_LANGUAGE )).GetLanguage();
+*/
+/*N*/ Reference< XMultiServiceFactory > xMSF = ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*N*/ pNumberFormatter = new SvNumberFormatter( xMSF, eLang );
+/*N*/ pNumberFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL );
+/*N*/ pNumberFormatter->SetYear2000(SFX_APP()->GetMiscConfig()->GetYear2000());
+/*N*/
+/*N*/ }
+
+/*N*/ SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest )
+/*N*/ : pNFmt( 0 )
+/*N*/ {
+/*N*/ // ein anderes Doc -> Numberformatter muessen gemergt werden
+/*N*/ SvNumberFormatter* pN;
+/*N*/ if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( FALSE ) ))
+/*N*/ ( pNFmt = rDest.GetNumberFormatter( TRUE ))->MergeFormatter( *pN );
+/*N*/
+/*N*/ if( &rSrc != &rDest )
+/*N*/ ((SwGetRefFieldType*)rSrc.GetSysFldType( RES_GETREFFLD ))->
+/*N*/ MergeWithOtherDoc( rDest );
+/*N*/ }
+
+/*N*/ SwTblNumFmtMerge::~SwTblNumFmtMerge()
+/*N*/ {
+/*N*/ if( pNFmt )
+/*N*/ pNFmt->ClearMergeTable();
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docftn.cxx b/binfilter/bf_sw/source/core/doc/sw_docftn.cxx
new file mode 100644
index 000000000000..93d8faac33a9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docftn.cxx
@@ -0,0 +1,447 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <ftnidx.hxx>
+#include <rootfrm.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <pam.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <poolfmt.hxx>
+#include <ftninfo.hxx>
+#include <hints.hxx>
+namespace binfilter {
+
+
+/*********************** SwFtnInfo ***************************/
+
+/*N*/ SwEndNoteInfo& SwEndNoteInfo::operator=(const SwEndNoteInfo& rInfo)
+/*N*/ {
+/*N*/ if( rInfo.GetFtnTxtColl() )
+/*?*/ rInfo.GetFtnTxtColl()->Add(this);
+/*N*/ else if ( pRegisteredIn)
+/*?*/ pRegisteredIn->Remove(this);
+
+/*N*/ if ( rInfo.aPageDescDep.GetRegisteredIn() )
+/*N*/ ((SwModify*)rInfo.aPageDescDep.GetRegisteredIn())->Add( &aPageDescDep );
+/*N*/ else if ( aPageDescDep.GetRegisteredIn() )
+/*?*/ ((SwModify*)aPageDescDep.GetRegisteredIn())->Remove( &aPageDescDep );
+
+/*N*/ if ( rInfo.aCharFmtDep.GetRegisteredIn() )
+/*N*/ ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
+/*N*/ else if ( aCharFmtDep.GetRegisteredIn() )
+/*?*/ ((SwModify*)aCharFmtDep.GetRegisteredIn())->Remove( &aCharFmtDep );
+
+/*N*/ if ( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
+/*N*/ ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
+/*N*/ &aAnchorCharFmtDep );
+/*N*/ else if( aAnchorCharFmtDep.GetRegisteredIn() )
+/*N*/ ((SwModify*)aAnchorCharFmtDep.GetRegisteredIn())->Remove(
+/*N*/ &aAnchorCharFmtDep );
+/*N*/
+/*N*/ aFmt = rInfo.aFmt;
+/*N*/ nFtnOffset = rInfo.nFtnOffset;
+/*N*/ bEndNote = rInfo.bEndNote;
+/*N*/ sPrefix = rInfo.sPrefix;
+/*N*/ sSuffix = rInfo.sSuffix;
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ BOOL SwEndNoteInfo::operator==( const SwEndNoteInfo& rInfo ) const
+/*N*/ {
+/*N*/ return aPageDescDep.GetRegisteredIn() ==
+/*N*/ rInfo.aPageDescDep.GetRegisteredIn() &&
+/*N*/ aCharFmtDep.GetRegisteredIn() ==
+/*N*/ rInfo.aCharFmtDep.GetRegisteredIn() &&
+/*N*/ aAnchorCharFmtDep.GetRegisteredIn() ==
+/*N*/ rInfo.aAnchorCharFmtDep.GetRegisteredIn() &&
+/*N*/ GetFtnTxtColl() == rInfo.GetFtnTxtColl() &&
+/*N*/ aFmt.GetNumberingType() == rInfo.aFmt.GetNumberingType() &&
+/*N*/ nFtnOffset == rInfo.nFtnOffset &&
+/*N*/ bEndNote == rInfo.bEndNote &&
+/*N*/ sPrefix == rInfo.sPrefix &&
+/*N*/ sSuffix == rInfo.sSuffix;
+/*N*/ }
+
+
+/*N*/ SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) :
+/*N*/ SwClient( rInfo.GetFtnTxtColl() ),
+/*N*/ aPageDescDep( this, 0 ),
+/*N*/ aCharFmtDep( this, 0 ),
+/*N*/ aAnchorCharFmtDep( this, 0 ),
+/*N*/ aFmt( rInfo.aFmt ),
+/*N*/ nFtnOffset( rInfo.nFtnOffset ),
+/*N*/ sPrefix( rInfo.sPrefix ),
+/*N*/ sSuffix( rInfo.sSuffix ),
+/*N*/ bEndNote( TRUE )
+/*N*/ {
+/*N*/ if( rInfo.GetPageDescDep()->GetRegisteredIn() )
+/*N*/ ((SwModify*)rInfo.GetPageDescDep()->GetRegisteredIn())->Add( &aPageDescDep );
+/*N*/
+/*N*/ if( rInfo.aCharFmtDep.GetRegisteredIn() )
+/*N*/ ((SwModify*)rInfo.aCharFmtDep.GetRegisteredIn())->Add( &aCharFmtDep );
+/*N*/
+/*N*/ if( rInfo.aAnchorCharFmtDep.GetRegisteredIn() )
+/*N*/ ((SwModify*)rInfo.aAnchorCharFmtDep.GetRegisteredIn())->Add(
+/*?*/ &aAnchorCharFmtDep );
+/*N*/ }
+
+/*N*/ SwEndNoteInfo::SwEndNoteInfo(SwTxtFmtColl *pFmt) :
+/*N*/ SwClient(pFmt),
+/*N*/ aPageDescDep( this, 0 ),
+/*N*/ aCharFmtDep( this, 0 ),
+/*N*/ aAnchorCharFmtDep( this, 0 ),
+/*N*/ nFtnOffset( 0 ),
+/*N*/ bEndNote( TRUE )
+/*N*/ {
+/*N*/ aFmt.SetNumberingType(SVX_NUM_ROMAN_LOWER);
+/*N*/ }
+
+/*N*/ SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const
+/*N*/ {
+/*N*/ if ( !aPageDescDep.GetRegisteredIn() )
+/*N*/ {
+/*N*/ SwPageDesc *pDesc = rDoc.GetPageDescFromPool( bEndNote
+/*N*/ ? RES_POOLPAGE_ENDNOTE
+/*N*/ : RES_POOLPAGE_FOOTNOTE );
+/*N*/ pDesc->Add( &((SwClient&)aPageDescDep) );
+/*N*/ }
+/*N*/ return (SwPageDesc*)aPageDescDep.GetRegisteredIn();
+/*N*/ }
+
+/*N*/ void SwEndNoteInfo::ChgPageDesc( SwPageDesc *pDesc )
+/*N*/ {
+/*N*/ pDesc->Add( &((SwClient&)aPageDescDep) );
+/*N*/ }
+
+/*N*/ void SwEndNoteInfo::SetFtnTxtColl(SwTxtFmtColl& rFmt)
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 rFmt.Add(this);
+/*N*/ }
+
+/*N*/ SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const
+/*N*/ {
+/*N*/ if ( !aCharFmtDep.GetRegisteredIn() )
+/*N*/ {
+/*N*/ SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( bEndNote
+/*N*/ ? RES_POOLCHR_ENDNOTE
+/*N*/ : RES_POOLCHR_FOOTNOTE );
+/*N*/ pFmt->Add( &((SwClient&)aCharFmtDep) );
+/*N*/ }
+/*N*/ return (SwCharFmt*)aCharFmtDep.GetRegisteredIn();
+/*N*/ }
+
+/*N*/ void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt )
+/*N*/ {
+/*N*/ DBG_ASSERT(pChFmt, "kein CharFmt?");
+/*N*/ pChFmt->Add( &((SwClient&)aCharFmtDep) );
+/*N*/ }
+
+/*N*/ SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const
+/*N*/ {
+/*N*/ if( !aAnchorCharFmtDep.GetRegisteredIn() )
+/*N*/ {
+/*N*/ SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( bEndNote
+/*N*/ ? RES_POOLCHR_ENDNOTE_ANCHOR
+/*N*/ : RES_POOLCHR_FOOTNOTE_ANCHOR );
+/*N*/ pFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
+/*N*/ }
+/*N*/ return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn();
+/*N*/ }
+
+/*N*/ void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt )
+/*N*/ {
+/*N*/ DBG_ASSERT(pChFmt, "kein CharFmt?");
+/*N*/ pChFmt->Add( &((SwClient&)aAnchorCharFmtDep) );
+/*N*/ }
+
+/*N*/ void SwEndNoteInfo::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+/*N*/
+/*N*/ if( RES_ATTRSET_CHG == nWhich ||
+/*N*/ RES_FMT_CHG == nWhich )
+/*N*/ {
+/*N*/ SwDoc* pDoc;
+/*N*/ if( aCharFmtDep.GetRegisteredIn() )
+/*N*/ pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc();
+/*N*/ else
+/*?*/ pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc();
+/*N*/ SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs();
+/*N*/ for( USHORT nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+/*N*/ {
+/*?*/ SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
+/*?*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*?*/ if ( rFtn.IsEndNote() == bEndNote)
+/*?*/ pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ SwClient::Modify( pOld, pNew );
+/*N*/ }
+
+/*N*/ SwFtnInfo& SwFtnInfo::operator=(const SwFtnInfo& rInfo)
+/*N*/ {
+/*N*/ SwEndNoteInfo::operator=(rInfo);
+/*N*/ aQuoVadis = rInfo.aQuoVadis;
+/*N*/ aErgoSum = rInfo.aErgoSum;
+/*N*/ ePos = rInfo.ePos;
+/*N*/ eNum = rInfo.eNum;
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ BOOL SwFtnInfo::operator==( const SwFtnInfo& rInfo ) const
+/*N*/ {
+/*N*/ return ePos == rInfo.ePos &&
+/*N*/ eNum == rInfo.eNum &&
+/*N*/ SwEndNoteInfo::operator==(rInfo) &&
+/*N*/ aQuoVadis == rInfo.aQuoVadis &&
+/*N*/ aErgoSum == rInfo.aErgoSum;
+/*N*/ }
+
+
+/*N*/ SwFtnInfo::SwFtnInfo(const SwFtnInfo& rInfo) :
+/*N*/ SwEndNoteInfo( rInfo ),
+/*N*/ aQuoVadis( rInfo.aQuoVadis ),
+/*N*/ aErgoSum( rInfo.aErgoSum ),
+/*N*/ ePos( rInfo.ePos ),
+/*N*/ eNum( rInfo.eNum )
+/*N*/ {
+/*N*/ bEndNote = FALSE;
+/*N*/ }
+
+/*N*/ SwFtnInfo::SwFtnInfo(SwTxtFmtColl *pFmt) :
+/*N*/ SwEndNoteInfo( pFmt ),
+/*N*/ eNum( FTNNUM_DOC ),
+/*N*/ ePos( FTNPOS_PAGE )
+/*N*/ {
+/*N*/ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+/*N*/ bEndNote = FALSE;
+/*N*/ }
+
+/*********************** SwDoc ***************************/
+
+
+/*N*/ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
+/*N*/ {
+/*N*/ if( !(GetFtnInfo() == rInfo) )
+/*N*/ {
+/*N*/ const SwFtnInfo &rOld = GetFtnInfo();
+/*N*/
+/*N*/
+/*N*/ FASTBOOL bPageNum = rInfo.eNum == FTNNUM_PAGE &&
+/*N*/ rOld.eNum != FTNNUM_PAGE;
+/*N*/ FASTBOOL bFtnPos = rInfo.ePos != rOld.ePos;
+/*N*/ FASTBOOL bFtnDesc = rOld.ePos == FTNPOS_CHAPTER &&
+/*N*/ rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
+/*N*/ FASTBOOL bExtra = rInfo.aQuoVadis != rOld.aQuoVadis ||
+/*N*/ rInfo.aErgoSum != rOld.aErgoSum ||
+/*N*/ rInfo.aFmt.GetNumberingType() != rOld.aFmt.GetNumberingType() ||
+/*N*/ rInfo.GetPrefix() != rOld.GetPrefix() ||
+/*N*/ rInfo.GetSuffix() != rOld.GetSuffix();
+/*N*/ SwCharFmt *pOldChrFmt = rOld.GetCharFmt( *this ),
+/*N*/ *pNewChrFmt = rInfo.GetCharFmt( *this );
+/*N*/ FASTBOOL bFtnChrFmts = pOldChrFmt != pNewChrFmt;
+/*N*/
+/*N*/ *pFtnInfo = rInfo;
+/*N*/
+/*N*/ if ( GetRootFrm() )
+/*N*/ {
+/*?*/ if ( bFtnPos )
+/*?*/ GetRootFrm()->RemoveFtns();
+/*?*/ else
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 GetRootFrm()->UpdateFtnNums();
+/*?*/ }
+/*N*/ }
+/*N*/ if( FTNNUM_PAGE != rInfo.eNum )
+/*N*/ GetFtnIdxs().UpdateAllFtn();
+/*N*/ else if( bFtnChrFmts )
+/*N*/ {
+/*?*/ SwFmtChg aOld( pOldChrFmt );
+/*?*/ SwFmtChg aNew( pNewChrFmt );
+/*?*/ pFtnInfo->Modify( &aOld, &aNew );
+/*?*/ }
+/*N*/
+/*N*/ UpdateRefFlds();
+/*N*/
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
+/*N*/ {
+/*N*/ if( !(GetEndNoteInfo() == rInfo) )
+/*N*/ {
+/*N*/ FASTBOOL bNumChg = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset;
+/*N*/ FASTBOOL bExtra = !bNumChg &&
+/*N*/ rInfo.aFmt.GetNumberingType() != GetEndNoteInfo().aFmt.GetNumberingType()||
+/*N*/ rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix() ||
+/*N*/ rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix();
+/*N*/ FASTBOOL bFtnDesc = rInfo.GetPageDesc( *this ) !=
+/*N*/ GetEndNoteInfo().GetPageDesc( *this );
+/*N*/ SwCharFmt *pOldChrFmt = GetEndNoteInfo().GetCharFmt( *this ),
+/*N*/ *pNewChrFmt = rInfo.GetCharFmt( *this );
+/*N*/ FASTBOOL bFtnChrFmts = pOldChrFmt != pNewChrFmt;
+/*N*/
+/*N*/ *pEndNoteInfo = rInfo;
+/*N*/
+/*N*/ if ( GetRootFrm() )
+/*N*/ {
+/*?*/ if ( bFtnDesc )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 GetRootFrm()->CheckFtnPageDescs( TRUE );
+/*?*/ if ( bExtra )
+/*?*/ {
+/*?*/ //Fuer die Benachrichtung bezueglich ErgoSum usw. sparen wir uns
+/*?*/ //extra-Code und nutzen die vorhandenen Wege.
+/*?*/ SwFtnIdxs& rFtnIdxs = GetFtnIdxs();
+/*?*/ for( USHORT nPos = 0; nPos < rFtnIdxs.Count(); ++nPos )
+/*?*/ {
+/*?*/ SwTxtFtn *pTxtFtn = rFtnIdxs[ nPos ];
+/*?*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*?*/ if ( rFtn.IsEndNote() )
+/*?*/ pTxtFtn->SetNumber( rFtn.GetNumber(), &rFtn.GetNumStr());
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( bNumChg )
+/*?*/ GetFtnIdxs().UpdateAllFtn();
+/*N*/ else if( bFtnChrFmts )
+/*N*/ {
+/*?*/ SwFmtChg aOld( pOldChrFmt );
+/*?*/ SwFmtChg aNew( pNewChrFmt );
+/*?*/ pEndNoteInfo->Modify( &aOld, &aNew );
+/*N*/ }
+/*N*/
+/*N*/ UpdateRefFlds();
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ BOOL SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
+/*N*/ USHORT nNumber, BOOL bIsEndNote )
+/*N*/ {
+/*N*/ SwFtnIdxs& rFtnArr = GetFtnIdxs();
+/*N*/
+/*N*/ const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+/*N*/ const ULONG nSttNd = pStt->nNode.GetIndex();
+/*N*/ const xub_StrLen nSttCnt = pStt->nContent.GetIndex();
+/*N*/ const ULONG nEndNd = pEnd->nNode.GetIndex();
+/*N*/ const xub_StrLen nEndCnt = pEnd->nContent.GetIndex();
+/*N*/
+/*N*/ USHORT nPos;
+/*N*/ rFtnArr.SeekEntry( pStt->nNode, &nPos );
+/*N*/
+/*N*/ SwTxtFtn* pTxtFtn;
+/*N*/ ULONG nIdx;
+/*N*/ BOOL bChg = FALSE;
+/*N*/ BOOL bTypeChgd = FALSE;
+/*N*/ USHORT n = nPos; // sichern
+/*N*/ while( nPos < rFtnArr.Count() &&
+/*N*/ (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ nPos++ ] )))
+/*N*/ < nEndNd || ( nIdx == nEndNd &&
+/*N*/ nEndCnt >= *pTxtFtn->GetStart() )) )
+/*N*/ if( nIdx > nSttNd || ( nIdx == nSttNd &&
+/*N*/ nSttCnt <= *pTxtFtn->GetStart() ) )
+/*N*/ {
+/*N*/ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+/*N*/ if( /*rFtn.GetNumber() != nNumber ||*/
+/*N*/ rFtn.GetNumStr() != rNumStr ||
+/*N*/ rFtn.IsEndNote() != bIsEndNote )
+/*N*/ {
+/*N*/ bChg = TRUE;
+/*N*/
+/*N*/ pTxtFtn->SetNumber( nNumber, &rNumStr );
+/*N*/ if( rFtn.IsEndNote() != bIsEndNote )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ nPos = n; // nach vorne gibt es auch noch welche !
+/*N*/ while( nPos &&
+/*N*/ (( nIdx = _SwTxtFtn_GetIndex((pTxtFtn = rFtnArr[ --nPos ] )))
+/*N*/ > nSttNd || ( nIdx == nSttNd &&
+/*N*/ nSttCnt <= *pTxtFtn->GetStart() )) )
+/*N*/ if( nIdx < nEndNd || ( nIdx == nEndNd &&
+/*N*/ nEndCnt >= *pTxtFtn->GetStart() ) )
+/*N*/ {
+/*?*/ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+/*?*/ if( /*rFtn.GetNumber() != nNumber ||*/
+/*?*/ rFtn.GetNumStr() != rNumStr ||
+/*?*/ rFtn.IsEndNote() != bIsEndNote )
+/*?*/ {
+/*?*/ bChg = TRUE;
+/*?*/
+/*?*/ pTxtFtn->SetNumber( nNumber, &rNumStr );
+/*?*/ if( rFtn.IsEndNote() != bIsEndNote )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ((SwFmtFtn&)rFtn).SetEndNote( bIsEndNote );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // wer muss angestossen werden ??
+/*N*/ if( bChg )
+/*N*/ {
+/*N*/
+/*N*/ if ( bTypeChgd )
+/*?*/ rFtnArr.UpdateAllFtn();
+/*N*/ if( FTNNUM_PAGE != GetFtnInfo().eNum )
+/*N*/ {
+/*N*/ if ( !bTypeChgd )
+/*N*/ rFtnArr.UpdateAllFtn();
+/*N*/ }
+/*N*/ else if( GetRootFrm() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 GetRootFrm()->UpdateFtnNums();
+/*N*/ }
+/*N*/ return bChg;
+/*N*/ }
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_doclay.cxx b/binfilter/bf_sw/source/core/doc/sw_doclay.cxx
new file mode 100644
index 000000000000..e1780d315f45
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_doclay.cxx
@@ -0,0 +1,1133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hintids.hxx>
+
+#include <bf_sfx2/progress.hxx>
+#include <bf_svx/svdmodel.hxx>
+#include <bf_svx/fmglob.hxx>
+#include <bf_svx/svdouno.hxx>
+#include <bf_svx/fmpage.hxx>
+#include <bf_svx/frmdiritem.hxx>
+#include <rtl/logfile.hxx>
+
+#include <frmatr.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtcnct.hxx>
+#include <txtflcnt.hxx>
+#include <viscrs.hxx>
+#include <docfld.hxx> // fuer Expression-Felder
+#include <ndtxt.hxx>
+#include <ndole.hxx>
+#include <rootfrm.hxx>
+#include <cntfrm.hxx>
+#include <flyfrm.hxx>
+#include <fesh.hxx>
+#include <docsh.hxx>
+#include <dflyobj.hxx>
+#include <dcontact.hxx>
+#include <poolfmt.hxx> // PoolVorlagen-Id's
+#include <docary.hxx>
+#include <fldupde.hxx>
+#include <txtftn.hxx>
+#include <ftnidx.hxx>
+
+#include <comcore.hrc> // STR-ResId's
+
+// #i11176#
+#include <unoframe.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+#define DEF_FLY_WIDTH 2268 //Defaultbreite fuer FlyFrms (2268 == 4cm)
+
+/* #109161# */
+static bool lcl_IsItemSet(const SwCntntNode & rNode, USHORT which)
+{
+ bool bResult = false;
+
+ if (SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState(which))
+ bResult = true;
+
+ return bResult;
+}
+
+/*************************************************************************
+|*
+|* SwDoc::MakeLayoutFmt()
+|*
+|* Beschreibung Erzeugt ein neues Format das in seinen Einstellungen
+|* Defaultmaessig zu dem Request passt. Das Format wird in das
+|* entsprechende Formate-Array gestellt.
+|* Wenn bereits ein passendes Format existiert, so wird dies
+|* zurueckgeliefert.
+|* Ersterstellung MA 22. Sep. 92
+|* Letzte Aenderung JP 08.05.98
+|*
+|*************************************************************************/
+
+/*N*/ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, SwFrmFmt* pFrmFmt,
+/*N*/ const SfxItemSet* pSet )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = 0;
+/*N*/ const sal_Bool bMod = IsModified();
+/*N*/ sal_Bool bHeader = sal_False;
+/*N*/
+/*N*/ switch ( eRequest )
+/*N*/ {
+/*N*/ case RND_STD_HEADER:
+/*N*/ case RND_STD_HEADERL:
+/*N*/ case RND_STD_HEADERR:
+/*N*/ {
+/*N*/ bHeader = sal_True;
+/*N*/ // kein break, es geht unten weiter
+/*N*/ }
+/*N*/ case RND_STD_FOOTER:
+/*N*/ case RND_STD_FOOTERL:
+/*N*/ case RND_STD_FOOTERR:
+/*N*/ {
+/*N*/
+/*N*/
+/*N*/ pFmt = new SwFrmFmt( GetAttrPool(),
+/*N*/ (bHeader ? "Header" : "Footer"),
+/*N*/ GetDfltFrmFmt() );
+/*N*/
+/*N*/ SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
+/*N*/ SwStartNode* pSttNd = GetNodes().MakeTextSection( aTmpIdx,
+/*N*/ bHeader ? SwHeaderStartNode : SwFooterStartNode,
+/*N*/ GetTxtCollFromPool(
+/*N*/ bHeader
+/*N*/ ? ( eRequest == RND_STD_HEADERL
+/*N*/ ? RES_POOLCOLL_HEADERL
+/*N*/ : eRequest == RND_STD_HEADERR
+/*N*/ ? RES_POOLCOLL_HEADERR
+/*N*/ : RES_POOLCOLL_HEADER )
+/*N*/ : ( eRequest == RND_STD_FOOTERL
+/*N*/ ? RES_POOLCOLL_FOOTERL
+/*N*/ : eRequest == RND_STD_FOOTERR
+/*N*/ ? RES_POOLCOLL_FOOTERR
+/*N*/ : RES_POOLCOLL_FOOTER )
+/*N*/ ) );
+/*N*/ pFmt->SetAttr( SwFmtCntnt( pSttNd ));
+/*N*/
+/*N*/ if( pSet ) // noch ein paar Attribute setzen ?
+/*N*/ pFmt->SetAttr( *pSet );
+/*N*/
+/*N*/ // JP: warum zuruecksetzen ??? Doc. ist doch veraendert ???
+/*N*/ // bei den Fly auf jedenfall verkehrt !!
+/*N*/ if ( !bMod )
+/*?*/ ResetModified();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RND_DRAW_OBJECT:
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pFmt = MakeDrawFrmFmt( aEmptyStr, GetDfltFrmFmt() );
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ #ifdef DBG_UTIL
+/*?*/ case FLY_PAGE:
+/*?*/ case FLY_AUTO_CNTNT:
+/*?*/ case FLY_AT_FLY:
+/*?*/ case FLY_AT_CNTNT:
+/*?*/ case FLY_IN_CNTNT:
+/*?*/ ASSERT( !this,
+/*?*/ "neue Schnittstelle benutzen: SwDoc::MakeFlySection!" );
+/*?*/ break;
+/*?*/ #endif
+/*?*/
+/*?*/ default:
+/*?*/ ASSERT( !this,
+/*?*/ "Layoutformat mit ungueltigem Request angefordert." );
+/*?*/
+/*N*/ }
+/*N*/ return pFmt;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwDoc::DelLayoutFmt()
+|*
+|* Beschreibung Loescht das angegebene Format, der Inhalt wird mit
+|* geloescht.
+|* Ersterstellung MA 23. Sep. 92
+|* Letzte Aenderung MA 05. Feb. 93
+|*
+|*************************************************************************/
+
+/*N*/ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt )
+/*N*/ {
+/*N*/ //Verkettung von Rahmen muss ggf. zusammengefuehrt werden.
+/*N*/ //Bevor die Frames vernichtet werden, damit die Inhalte der Rahmen
+/*N*/ //ggf. entsprechend gerichtet werden.
+/*N*/ const SwFmtChain &rChain = pFmt->GetChain();
+/*N*/ if ( rChain.GetPrev() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFmtChain aChain( rChain.GetPrev()->GetChain() );
+/*N*/ }
+/*N*/ if ( rChain.GetNext() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFmtChain aChain( rChain.GetNext()->GetChain() );
+/*N*/ }
+
+/*N*/ const SwNodeIndex* pCntIdx = pFmt->GetCntnt().GetCntntIdx();
+/*N*/ if( pCntIdx )
+/*N*/ {
+/*N*/ //Verbindung abbauen, falls es sich um ein OLE-Objekt handelt.
+/*N*/ SwOLENode* pOLENd = GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode();
+/*N*/ if( pOLENd && pOLENd->GetOLEObj().IsOleRef() )
+/*N*/ {
+/*N*/ SwDoc* pDoc = (SwDoc*)pFmt->GetDoc();
+/*N*/ if( pDoc )
+/*N*/ {
+/*N*/ SvPersist* p = pDoc->GetPersist();
+/*N*/ if( p ) // muss da sein
+/*N*/ {
+/*N*/ SvInfoObjectRef aRef( p->Find( pOLENd->GetOLEObj().GetName() ) );
+/*N*/ if( aRef.Is() )
+/*N*/ aRef->SetObj(0);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pOLENd->GetOLEObj().GetOleRef()->DoClose();
+/*N*/ pOLENd->GetOLEObj().GetOleRef().Clear();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Frms vernichten.
+/*N*/ pFmt->DelFrms();
+
+/*N*/ const sal_uInt16 nWh = pFmt->Which();
+/*N*/ {
+/*N*/ //Inhalt Loeschen.
+/*N*/ if( pCntIdx )
+/*N*/ {
+/*N*/
+/*N*/
+/*N*/ SwNode *pNode = &pCntIdx->GetNode();
+/*N*/ ((SwFmtCntnt&)pFmt->GetAttr( RES_CNTNT )).SetNewCntntIdx( 0 );
+/*N*/ DeleteSection( pNode );
+/*N*/ }
+/*N*/
+/*N*/ // ggfs. bei Zeichengebundenen Flys das Zeichen loeschen
+/*N*/ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+/*N*/ if( FLY_IN_CNTNT == rAnchor.GetAnchorId() && rAnchor.GetCntntAnchor())
+/*N*/ {
+/*N*/ const SwPosition* pPos = rAnchor.GetCntntAnchor();
+/*N*/ SwTxtNode *pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+/*N*/ SwTxtFlyCnt* pAttr;
+/*N*/
+/*N*/ // Attribut steht noch im TextNode, loeschen
+/*N*/ if( pTxtNd && 0 != ( pAttr = ((SwTxtFlyCnt*)pTxtNd->GetTxtAttr(
+/*N*/ pPos->nContent.GetIndex() ))) &&
+/*N*/ pAttr->GetFlyCnt().GetFrmFmt() == pFmt )
+/*N*/ {
+/*?*/ // Pointer auf 0, nicht loeschen
+/*?*/ ((SwFmtFlyCnt&)pAttr->GetFlyCnt()).SetFlyFmt();
+/*?*/ SwIndex aIdx( pPos->nContent );
+/*?*/ pTxtNd->Erase( aIdx, 1 );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ DelFrmFmt( pFmt );
+/*N*/ }
+/*N*/ SetModified();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDoc::CopyLayoutFmt()
+|*
+|* Beschreibung Kopiert das angegebene Format pSrc in pDest und
+|* returnt pDest. Wenn es noch kein pDest gibt, wird
+|* eins angelegt.
+|* JP: steht das Source Format in einem anderen
+|* Dokument, so kopiere auch dann noch richtig !!
+|* Vom chaos::Anchor-Attribut wird die Position immer
+|* auf 0 gesetzt !!!
+|*
+|* Ersterstellung BP 18.12.92
+|* Letzte Aenderung MA 17. Jul. 96
+|*
+|*************************************************************************/
+
+/*N*/ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
+/*N*/ const SwFmtAnchor& rNewAnchor,
+/*N*/ sal_Bool bSetTxtFlyAtt, sal_Bool bMakeFrms )
+/*N*/ {
+/*N*/ const bool bFly = RES_FLYFRMFMT == rSource.Which();
+/*N*/ const bool bDraw = RES_DRAWFRMFMT == rSource.Which();
+/*N*/ ASSERT( bFly || bDraw, "this method only works for fly or draw" );
+/*N*/
+/*N*/ SwDoc* pSrcDoc = (SwDoc*)rSource.GetDoc();
+/*N*/
+/*N*/ // #108784# may we copy this object?
+/*N*/ // We may, unless it's 1) it's a control (and therfore a draw)
+/*N*/ // 2) anchored in a header/footer
+/*N*/ // 3) anchored (to paragraph?)
+/*N*/ bool bMayNotCopy = false;
+/*N*/ if( bDraw )
+/*N*/ {
+/*N*/ const SwDrawContact* pDrawContact =
+/*N*/ static_cast<const SwDrawContact*>( rSource.FindContactObj() );
+/*N*/
+/*N*/ bMayNotCopy =
+/*N*/ ( FLY_AT_CNTNT == rNewAnchor.GetAnchorId() ||
+/*N*/ FLY_AT_FLY == rNewAnchor.GetAnchorId() ||
+/*N*/ FLY_AUTO_CNTNT == rNewAnchor.GetAnchorId() ) &&
+/*N*/ rNewAnchor.GetCntntAnchor() &&
+/*N*/ IsInHeaderFooter( rNewAnchor.GetCntntAnchor()->nNode ) &&
+/*N*/ pDrawContact != NULL &&
+/*N*/ pDrawContact->GetMaster() != NULL &&
+/*N*/ CheckControlLayer( pDrawContact->GetMaster() );
+/*N*/ }
+/*N*/
+/*N*/ // just return if we can't copy this
+/*N*/ if( bMayNotCopy )
+/*N*/ return NULL;
+/*N*/
+/*N*/ SwFrmFmt* pDest = GetDfltFrmFmt();
+/*N*/ if( rSource.GetRegisteredIn() != pSrcDoc->GetDfltFrmFmt() )
+/*N*/ pDest = CopyFrmFmt( *(SwFrmFmt*)rSource.GetRegisteredIn() );
+/*N*/ if( bFly )
+/*N*/ {
+/*N*/ // #i11176#
+/*N*/ // To do a correct cloning concerning the ZOrder for all objects
+/*N*/ // it is necessary to actually create a draw object for fly frames, too.
+/*N*/ // These are then added to the DrawingLayer (which needs to exist).
+/*N*/ // Together with correct sorting of all drawinglayer based objects
+/*N*/ // before cloning ZOrder transfer works correctly then.
+/*N*/ SwFlyFrmFmt *pFormat = MakeFlyFrmFmt( rSource.GetName(), pDest );
+/*N*/ pDest = pFormat;
+/*N*/
+/*N*/ SwXFrame::GetOrCreateSdrObject(pFormat);
+/*N*/ }
+/*N*/ else
+/*N*/ pDest = MakeDrawFrmFmt( aEmptyStr, pDest );
+/*N*/
+/*N*/ // alle anderen/neue Attribute kopieren.
+/*N*/ pDest->CopyAttrs( rSource );
+/*N*/
+/*N*/ //Chains werden nicht kopiert.
+/*N*/ pDest->ResetAttr( RES_CHAIN );
+/*N*/
+/*N*/ if( bFly )
+/*N*/ {
+/*N*/ //Der Inhalt wird dupliziert.
+/*N*/ const SwNode& rCSttNd = rSource.GetCntnt().GetCntntIdx()->GetNode();
+/*N*/ SwNodeRange aRg( rCSttNd, 1, *rCSttNd.EndOfSectionNode() );
+/*N*/
+/*N*/ SwNodeIndex aIdx( GetNodes().GetEndOfAutotext() );
+/*N*/ SwStartNode* pSttNd = GetNodes().MakeEmptySection( aIdx, SwFlyStartNode );
+/*N*/
+/*N*/ // erst den chaos::Anchor/CntntIndex setzen, innerhalb des Kopierens
+/*N*/ // auf die Werte zugegriffen werden kann (DrawFmt in Kopf-/Fusszeilen)
+/*N*/ aIdx = *pSttNd;
+/*N*/ SwFmtCntnt aAttr( rSource.GetCntnt() );
+/*N*/ aAttr.SetNewCntntIdx( &aIdx );
+/*N*/ pDest->SetAttr( aAttr );
+/*N*/ pDest->SetAttr( rNewAnchor );
+/*N*/
+/*N*/ if( !bCopyIsMove || this != pSrcDoc )
+/*N*/ {
+/*N*/ if( bInReading )
+/*N*/ pDest->SetName( aEmptyStr );
+/*N*/ else
+/*N*/ {
+/*N*/ // Teste erstmal ob der Name schon vergeben ist.
+/*N*/ // Wenn ja -> neuen generieren
+/*N*/ sal_Int8 nNdTyp = aRg.aStart.GetNode().GetNodeType();
+/*N*/
+/*N*/ String sOld( pDest->GetName() );
+/*N*/ pDest->SetName( aEmptyStr );
+/*N*/ if( FindFlyByName( sOld, nNdTyp ) ) // einen gefunden
+/*N*/ switch( nNdTyp )
+/*N*/ {
+/*N*/ case ND_GRFNODE: sOld = GetUniqueGrfName(); break;
+/*N*/ case ND_OLENODE: sOld = GetUniqueOLEName(); break;
+/*N*/ default: sOld = GetUniqueFrameName(); break;
+/*N*/ }
+/*N*/
+/*N*/ pDest->SetName( sOld );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ // sorge dafuer das auch Fly's in Fly's kopiert werden
+/*N*/ aIdx = *pSttNd->EndOfSectionNode();
+/*N*/ pSrcDoc->CopyWithFlyInFly( aRg, aIdx, sal_False, sal_True, sal_True );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( RES_DRAWFRMFMT == rSource.Which(), "Weder Fly noch Draw." );
+/*N*/ SwDrawContact *pContact = (SwDrawContact *)rSource.FindContactObj();
+/*N*/
+/*N*/ pContact = new SwDrawContact( (SwDrawFrmFmt*)pDest,
+/*N*/ CloneSdrObj( *pContact->GetMaster(),
+/*N*/ bCopyIsMove && this == pSrcDoc ) );
+/*N*/
+/*N*/ if( pDest->GetAnchor() == rNewAnchor )
+/*N*/ {
+/*N*/ // OD 03.07.2003 #108784# - do *not* connect to layout, if
+/*N*/ // a <MakeFrms> will not be called.
+/*N*/ if ( bMakeFrms )
+/*N*/ {
+/*N*/ pContact->ConnectToLayout( &rNewAnchor );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pDest->SetAttr( rNewAnchor );
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ if( bSetTxtFlyAtt && FLY_IN_CNTNT == rNewAnchor.GetAnchorId() )
+/*N*/ {
+/*N*/ SwPosition* pPos = (SwPosition*)rNewAnchor.GetCntntAnchor();
+/*N*/ pPos->nNode.GetNode().GetTxtNode()->Insert(SwFmtFlyCnt( pDest ),
+/*N*/ pPos->nContent.GetIndex(), 0 );
+/*N*/ }
+/*N*/
+/*N*/ if( bMakeFrms )
+/*N*/ pDest->MakeFrms();
+/*N*/
+/*N*/ return pDest;
+/*N*/ }
+
+/*N*/ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, sal_Bool bMoveWithinDoc,
+/*N*/ sal_Bool bInsInPage )
+/*N*/ {
+/*N*/ SdrPage *pPg = MakeDrawModel()->GetPage( 0 );
+/*N*/ if( !pPg )
+/*N*/ {
+/*?*/ pPg = GetDrawModel()->AllocPage( sal_False );
+/*?*/ GetDrawModel()->InsertPage( pPg );
+/*N*/ }
+/*N*/
+/*N*/ SdrObject *pObj = rObj.Clone();
+/*N*/ if( bMoveWithinDoc && FmFormInventor == pObj->GetObjInventor() )
+/*N*/ {
+/*?*/ // bei Controls muss der Name erhalten bleiben
+/*?*/ uno::Reference< awt::XControlModel > xModel = ((SdrUnoObj*)pObj)->GetUnoControlModel();
+/*?*/ sal_Bool bModel = xModel.is();
+/*?*/ uno::Any aVal;
+/*?*/ uno::Reference< beans::XPropertySet > xSet(xModel, uno::UNO_QUERY);
+/*?*/ OUString sName( ::rtl::OUString::createFromAscii("Name") );
+/*?*/ if( xSet.is() )
+/*?*/ aVal = xSet->getPropertyValue( sName );
+/*?*/ if( bInsInPage )
+/*?*/ pPg->InsertObject( pObj );
+/*?*/ if( xSet.is() )
+/*?*/ xSet->setPropertyValue( sName, aVal );
+/*N*/ }
+/*N*/ else if( bInsInPage )
+/*N*/ pPg->InsertObject( pObj );
+/*N*/
+/*N*/ // OD 02.07.2003 #108784# - for drawing objects: set layer of cloned object
+/*N*/ // to invisible layer
+/*N*/ SdrLayerID nLayerIdForClone = rObj.GetLayer();
+/*N*/ if ( !pObj->ISA(SwFlyDrawObj) &&
+/*N*/ !pObj->ISA(SwVirtFlyDrawObj) &&
+/*N*/ !IS_TYPE(SdrObject,pObj) )
+/*N*/ {
+/*N*/ if ( IsVisibleLayerId( nLayerIdForClone ) )
+/*N*/ {
+/*N*/ nLayerIdForClone = GetInvisibleLayerIdByVisibleOne( nLayerIdForClone );
+/*N*/ }
+/*N*/ }
+/*N*/ pObj->SetLayer( nLayerIdForClone );
+/*N*/
+/*N*/
+/*N*/ return pObj;
+/*N*/ }
+
+/*N*/ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos,
+/*N*/ const SwCntntNode& rNode,
+/*N*/ RndStdIds eRequestId,
+/*N*/ const SfxItemSet* pFlySet,
+/*N*/ SwFrmFmt* pFrmFmt )
+/*N*/ {
+/*N*/ if( !pFrmFmt )
+/*?*/ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_FRAME );
+/*N*/
+/*N*/ String sName;
+/*N*/ if( !bInReading )
+/*N*/ switch( rNode.GetNodeType() )
+/*N*/ {
+/*N*/ case ND_GRFNODE: sName = GetUniqueGrfName(); break;
+/*N*/ case ND_OLENODE: sName = GetUniqueOLEName(); break;
+/*N*/ default: sName = GetUniqueFrameName(); break;
+/*N*/ }
+/*N*/ SwFlyFrmFmt* pFmt = MakeFlyFrmFmt( sName, pFrmFmt );
+/*N*/
+/*N*/ //Inhalt erzeugen und mit dem Format verbinden.
+/*N*/ //CntntNode erzeugen und in die Autotextsection stellen
+/*N*/ SwNodeRange aRange( GetNodes().GetEndOfAutotext(), -1,
+/*N*/ GetNodes().GetEndOfAutotext() );
+/*N*/ GetNodes().SectionDown( &aRange, SwFlyStartNode );
+/*N*/
+/*N*/ pFmt->SetAttr( SwFmtCntnt( rNode.StartOfSectionNode() ));
+/*N*/
+/*N*/
+/*N*/ const SwFmtAnchor* pAnchor = 0;
+/*N*/ if( pFlySet )
+/*N*/ {
+/*N*/ pFlySet->GetItemState( RES_ANCHOR, sal_False,
+/*N*/ (const SfxPoolItem**)&pAnchor );
+/*N*/ if( SFX_ITEM_SET == pFlySet->GetItemState( RES_CNTNT, sal_False ))
+/*N*/ {
+/*?*/ SfxItemSet aTmpSet( *pFlySet );
+/*?*/ aTmpSet.ClearItem( RES_CNTNT );
+/*?*/ pFmt->SetAttr( aTmpSet );
+/*N*/ }
+/*N*/ else
+/*N*/ pFmt->SetAttr( *pFlySet );
+/*N*/ }
+
+ // Anker noch nicht gesetzt ?
+/*N*/ RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId()
+/*N*/ : pFmt->GetAnchor().GetAnchorId();
+/*N*/ if( !pAnchor ||
+/*N*/ (FLY_PAGE != pAnchor->GetAnchorId() &&
+/*N*/ //Nur Page und nicht:
+/*N*/ // FLY_AT_CNTNT == pAnchor->GetAnchorId() ||
+/*N*/ // FLY_IN_CNTNT == pAnchor->GetAnchorId() ||
+/*N*/ // FLY_AT_FLY == pAnchor->GetAnchorId() ||
+/*N*/ // FLY_AUTO_CNTNT == pAnchor->GetAnchorId() ) &&
+/*N*/ !pAnchor->GetCntntAnchor() ))
+/*N*/ {
+/*N*/ // dann setze ihn, wird im Undo gebraucht
+/*N*/ SwFmtAnchor aAnch( pFmt->GetAnchor() );
+/*N*/ if( pAnchor && FLY_AT_FLY == pAnchor->GetAnchorId() )
+/*N*/ {
+/*?*/ SwPosition aPos( *rAnchPos.nNode.GetNode().FindFlyStartNode() );
+/*?*/ aAnch.SetAnchor( &aPos );
+/*?*/ eAnchorId = FLY_AT_FLY;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( eRequestId != aAnch.GetAnchorId() &&
+/*N*/ SFX_ITEM_SET != pFmt->GetItemState( RES_ANCHOR, sal_True ) )
+/*?*/ aAnch.SetType( eRequestId );
+/*N*/
+/*N*/ eAnchorId = aAnch.GetAnchorId();
+/*N*/ if ( FLY_PAGE != eAnchorId )
+/*N*/ //Nur Page und nicht:
+/*N*/ // if( FLY_AT_CNTNT == eAnchorId || FLY_IN_CNTNT == eAnchorId ||
+/*N*/ // FLY_AT_FLY == eAnchorId || FLY_AUTO_CNTNT == eAnchorId )
+/*N*/ aAnch.SetAnchor( &rAnchPos );
+/*N*/ }
+/*N*/ pFmt->SetAttr( aAnch );
+/*N*/ }
+/*N*/ else
+/*N*/ eAnchorId = pFmt->GetAnchor().GetAnchorId();
+/*N*/
+/*N*/ if( FLY_IN_CNTNT == eAnchorId )
+/*N*/ {
+/*N*/ xub_StrLen nStt = rAnchPos.nContent.GetIndex();
+/*N*/ rAnchPos.nNode.GetNode().GetTxtNode()->Insert(
+/*N*/ SwFmtFlyCnt( pFmt ), nStt, nStt );
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET != pFmt->GetAttrSet().GetItemState( RES_FRM_SIZE ))
+/*N*/ {
+/*?*/ SwFmtFrmSize aFmtSize( ATT_VAR_SIZE, 0, DEF_FLY_WIDTH );
+/*?*/ const SwNoTxtNode* pNoTxtNode = rNode.GetNoTxtNode();
+/*?*/ if( pNoTxtNode )
+/*?*/ {
+/*?*/ //Groesse einstellen.
+/*?*/ Size aSize( pNoTxtNode->GetTwipSize() );
+/*?*/ if( MINFLY > aSize.Width() )
+/*?*/ aSize.Width() = DEF_FLY_WIDTH;
+/*?*/ aFmtSize.SetWidth( aSize.Width() );
+/*?*/ if( aSize.Height() )
+/*?*/ {
+/*?*/ aFmtSize.SetHeight( aSize.Height() );
+/*?*/ aFmtSize.SetSizeType( ATT_FIX_SIZE );
+/*?*/ }
+/*?*/ }
+/*?*/ pFmt->SetAttr( aFmtSize );
+/*N*/ }
+
+ // Frames anlegen
+/*N*/ if( GetRootFrm() )
+/*N*/ pFmt->MakeFrms(); // ???
+/*N*/
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+/*N*/ SwFlyFrmFmt* SwDoc::MakeFlySection( RndStdIds eAnchorType,
+/*N*/ const SwPosition* pAnchorPos,
+/*N*/ const SfxItemSet* pFlySet,
+/*N*/ SwFrmFmt* pFrmFmt, BOOL bCalledFromShell )
+/*N*/ {
+/*N*/ SwFlyFrmFmt* pFmt = 0;
+/*N*/ sal_Bool bCallMake = sal_True;
+/*N*/ if( !pAnchorPos && FLY_PAGE != eAnchorType )
+/*N*/ {
+/*N*/ const SwFmtAnchor* pAnch;
+/*N*/ if( (pFlySet && SFX_ITEM_SET == pFlySet->GetItemState(
+/*N*/ RES_ANCHOR, sal_False, (const SfxPoolItem**)&pAnch )) ||
+/*N*/ ( pFrmFmt && SFX_ITEM_SET == pFrmFmt->GetItemState(
+/*N*/ RES_ANCHOR, sal_True, (const SfxPoolItem**)&pAnch )) )
+/*N*/ {
+/*?*/ if( FLY_PAGE != pAnch->GetAnchorId() &&
+/*?*/ 0 == ( pAnchorPos = pAnch->GetCntntAnchor() ) )
+/*?*/ bCallMake = sal_False;
+/*N*/ }
+/*N*/ }
+
+/*N*/ if( bCallMake )
+/*N*/ {
+/*N*/ if( !pFrmFmt )
+/*?*/ pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_FRAME );
+/*N*/
+/*N*/ sal_uInt16 nCollId = IsHTMLMode() ? RES_POOLCOLL_TEXT : RES_POOLCOLL_FRAME;
+/*N*/
+ /* #109161# If there exists no adjust item in the paragraph
+ style for the content node of the new fly section
+ propagate an existing adjust item at the anchor to the new
+ content node. */
+/*N*/ SwCntntNode * pNewTxtNd = GetNodes().MakeTxtNode
+/*N*/ (SwNodeIndex( GetNodes().GetEndOfAutotext()),
+/*N*/ GetTxtCollFromPool( nCollId ));
+/*N*/ SwCntntNode * pAnchorNode = pAnchorPos->nNode.GetNode().GetCntntNode();
+/*N*/
+/*N*/ const SfxPoolItem * pItem = NULL;
+/*N*/
+/*N*/ if (bCalledFromShell && !lcl_IsItemSet(*pNewTxtNd, RES_PARATR_ADJUST) &&
+/*N*/ SFX_ITEM_SET == pAnchorNode->GetSwAttrSet().
+/*N*/ GetItemState(RES_PARATR_ADJUST, TRUE, &pItem))
+/*N*/ static_cast<SwCntntNode *>(pNewTxtNd)->SetAttr(*pItem);
+/*N*/
+/*N*/ pFmt = _MakeFlySection( *pAnchorPos, *pNewTxtNd,
+/*N*/ eAnchorType, pFlySet, pFrmFmt );
+/*N*/ }
+/*N*/ return pFmt;
+/*N*/ }
+
+
+
+ //Einfuegen eines DrawObjectes. Das Object muss bereits im DrawModel
+ // angemeldet sein.
+/*N*/ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
+/*N*/ SdrObject& rDrawObj,
+/*N*/ const SfxItemSet* pFlyAttrSet,
+/*N*/ SwFrmFmt* pDefFmt )
+/*N*/ {
+/*N*/ SwDrawFrmFmt *pFmt = MakeDrawFrmFmt( aEmptyStr,
+/*N*/ pDefFmt ? pDefFmt : GetDfltFrmFmt() );
+/*N*/
+/*N*/ const SwFmtAnchor* pAnchor = 0;
+/*N*/ if( pFlyAttrSet )
+/*N*/ {
+/*N*/ pFlyAttrSet->GetItemState( RES_ANCHOR, sal_False,
+/*N*/ (const SfxPoolItem**)&pAnchor );
+/*N*/ pFmt->SetAttr( *pFlyAttrSet );
+/*N*/ }
+/*N*/
+/*N*/ RndStdIds eAnchorId = pAnchor ? pAnchor->GetAnchorId()
+/*N*/ : pFmt->GetAnchor().GetAnchorId();
+/*N*/
+/*N*/ // Anker noch nicht gesetzt ?
+/*N*/ // DrawObjecte duerfen niemals in Kopf-/Fusszeilen landen.
+/*N*/ sal_Bool bIsAtCntnt = FLY_PAGE != eAnchorId;
+/*N*/ // FLY_AT_CNTNT == eAnchorId || FLY_IN_CNTNT == eAnchorId ||
+/*N*/ // FLY_AT_FLY == eAnchorId || FLY_AUTO_CNTNT == eAnchorId;
+/*N*/
+/*N*/ const SwNodeIndex* pChkIdx = 0;
+/*N*/ if( !pAnchor )
+/*N*/ {
+/*N*/ pChkIdx = &rRg.GetPoint()->nNode;
+/*N*/ }
+/*N*/ else if( bIsAtCntnt )
+/*N*/ {
+/*N*/ pChkIdx = pAnchor->GetCntntAnchor()
+/*N*/ ? &pAnchor->GetCntntAnchor()->nNode
+/*N*/ : &rRg.GetPoint()->nNode;
+/*N*/ }
+/*N*/
+/*N*/ // OD 24.06.2003 #108784# - allow drawing objects in header/footer, but
+/*N*/ // control objects aren't allowed in header/footer.
+/*N*/ if( pChkIdx &&
+/*N*/ ::binfilter::CheckControlLayer( &rDrawObj ) &&
+/*N*/ IsInHeaderFooter( *pChkIdx ) )
+/*N*/ {
+/*N*/ pFmt->SetAttr( SwFmtAnchor( eAnchorId = FLY_PAGE ) );
+/*N*/ }
+/*N*/ else if( !pAnchor || (bIsAtCntnt && !pAnchor->GetCntntAnchor() ))
+/*N*/ {
+/*N*/ // dann setze ihn, wird im Undo gebraucht
+/*N*/ SwFmtAnchor aAnch( pAnchor ? *pAnchor : pFmt->GetAnchor() );
+/*N*/ eAnchorId = aAnch.GetAnchorId();
+/*N*/ if( FLY_AT_FLY == eAnchorId )
+/*N*/ {
+/*?*/ SwPosition aPos( *rRg.GetNode()->FindFlyStartNode() );
+/*?*/ aAnch.SetAnchor( &aPos );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aAnch.SetAnchor( rRg.GetPoint() );
+/*N*/ if( FLY_PAGE == eAnchorId )
+/*N*/ {
+/*?*/ eAnchorId = rDrawObj.ISA( SdrUnoObj )
+/*?*/ ? FLY_IN_CNTNT : FLY_AT_CNTNT;
+/*?*/ aAnch.SetType( eAnchorId );
+/*?*/ }
+/*N*/ }
+/*N*/ pFmt->SetAttr( aAnch );
+/*N*/ }
+/*N*/
+/*N*/ // bei als Zeichen gebundenen Draws das Attribut im Absatz setzen
+/*N*/ if( FLY_IN_CNTNT == eAnchorId )
+/*N*/ {
+/*N*/ xub_StrLen nStt = rRg.GetPoint()->nContent.GetIndex();
+/*N*/ rRg.GetPoint()->nNode.GetNode().GetTxtNode()->Insert(
+/*N*/ SwFmtFlyCnt( pFmt ), nStt, nStt );
+/*N*/ }
+/*N*/
+/*N*/ new SwDrawContact( pFmt, &rDrawObj );
+/*N*/
+/*N*/ // ggfs. Frames anlegen
+/*N*/ if( GetRootFrm() )
+/*N*/ pFmt->MakeFrms();
+/*N*/
+/*N*/ SetModified();
+/*N*/ return pFmt;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDoc::GetAllFlyFmts
+|*
+|* Ersterstellung MA 14. Jul. 93
+|* Letzte Aenderung MD 23. Feb. 95
+|*
+|*************************************************************************/
+
+/*sal_Bool TstFlyRange( const SwPaM* pPam, sal_uInt32 nFlyPos )
+{
+ sal_Bool bOk = sal_False;
+ const SwPaM* pTmp = pPam;
+ do {
+ bOk = pTmp->Start()->nNode.GetIndex() < nFlyPos &&
+ pTmp->End()->nNode.GetIndex() > nFlyPos;
+ } while( !bOk && pPam != ( pTmp = (const SwPaM*)pTmp->GetNext() ));
+ return bOk;
+}
+*/
+/* -----------------------------04.04.00 10:55--------------------------------
+ paragraph frames - o.k. if the PaM includes the paragraph from the beginning
+ to the beginning of the next paragraph at least
+ frames at character - o.k. if the pam start at least at the same position
+ as the frame
+ ---------------------------------------------------------------------------*/
+
+
+/*N*/ void SwDoc::GetAllFlyFmts( SwPosFlyFrms& rPosFlyFmts,
+/*N*/ const SwPaM* pCmpRange, sal_Bool bDrawAlso ) const
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPosFlyFrm *pFPos = 0;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDoc::InsertLabel()
+|*
+|* Ersterstellung MA 11. Feb. 94
+|* Letzte Aenderung MA 12. Nov. 97
+|*
+|*************************************************************************/
+
+/* #i6447# changed behaviour if lcl_CpyAttr:
+
+ If the old item set contains the item to set (no inheritance) copy the item
+ into the new set.
+
+ If the old item set contains the item by inheritance and the new set
+ contains the item, too:
+ If the two items differ copy the item from the old set to the new set.
+
+ Otherwise the new set will not be changed.
+*/
+
+
+
+
+/*************************************************************************
+|*
+|* SwDoc::InsertDrawLabel()
+|*
+|* Ersterstellung MIB 7. Dez. 98
+|* Letzte Aenderung MIB 7. Dez. 98
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwDoc::DoIdleJobs()
+|*
+|* Ersterstellung OK 30.03.94
+|* Letzte Aenderung MA 09. Jun. 95
+|*
+|*************************************************************************/
+
+/*N*/ IMPL_LINK( SwDoc, DoIdleJobs, Timer *, pTimer )
+/*N*/ {
+/*N*/ #ifdef TIMELOG
+/*N*/ static ::rtl::Logfile* pModLogFile = 0;
+/*N*/ if( !pModLogFile )
+/*N*/ pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" );
+/*N*/ #endif
+/*N*/
+/*N*/ if( !SfxProgress::GetActiveProgress( pDocShell ) &&
+/*N*/ GetRootFrm() && GetRootFrm()->GetCurrShell() )
+/*N*/ {
+/*N*/ ViewShell *pSh, *pStartSh;
+/*N*/ pSh = pStartSh = GetRootFrm()->GetCurrShell();
+/*N*/ do {
+/*N*/ if( pSh->ActionPend() )
+/*N*/ return 0;
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/ } while( pSh != pStartSh );
+/*N*/
+/*N*/ sal_uInt16 nFldUpdFlag;
+/*N*/ if( GetRootFrm()->IsIdleFormat() )
+/*N*/ GetRootFrm()->GetCurrShell()->LayoutIdle();
+/*N*/ else if( ( AUTOUPD_FIELD_ONLY == ( nFldUpdFlag = GetFldUpdateFlags() )
+/*N*/ || AUTOUPD_FIELD_AND_CHARTS == nFldUpdFlag ) &&
+/*N*/ GetUpdtFlds().IsFieldsDirty() &&
+/*N*/ !GetUpdtFlds().IsInUpdateFlds() &&
+/*N*/ !IsExpFldsLocked()
+/*N*/ // das umschalten der Feldname fuehrt zu keinem Update der
+/*N*/ // Felder, also der "Hintergrund-Update" immer erfolgen
+/*N*/ /* && !pStartSh->GetViewOptions()->IsFldName()*/ )
+/*N*/ {
+/*N*/ // chaos::Action-Klammerung!
+/*N*/ GetUpdtFlds().SetInUpdateFlds( sal_True );
+/*N*/
+/*N*/ GetRootFrm()->StartAllAction();
+/*N*/
+/*N*/ GetSysFldType( RES_CHAPTERFLD )->Modify( 0, 0 ); // KapitelFld
+/*N*/ UpdateExpFlds( 0, sal_False ); // Expression-Felder Updaten
+/*N*/ UpdateTblFlds(); // Tabellen
+/*N*/ UpdateRefFlds(); // Referenzen
+/*N*/
+/*N*/ if( AUTOUPD_FIELD_AND_CHARTS == nFldUpdFlag )
+/*N*/ aChartTimer.Start();
+/*N*/
+/*N*/ GetRootFrm()->EndAllAction();
+/*N*/
+/*N*/ GetUpdtFlds().SetInUpdateFlds( sal_False );
+/*N*/ GetUpdtFlds().SetFieldsDirty( sal_False );
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef TIMELOG
+/*N*/ if( pModLogFile && 1 != (long)pModLogFile )
+/*N*/ delete pModLogFile, ((long&)pModLogFile) = 1;
+/*N*/ #endif
+/*N*/ return 0;
+/*N*/ }
+
+
+/*N*/ String lcl_GetUniqueFlyName( const SwDoc* pDoc, sal_uInt16 nDefStrId )
+/*N*/ {
+/*N*/ ResId aId( nDefStrId, *pSwResMgr );
+/*N*/ String aName( aId );
+/*N*/ xub_StrLen nNmLen = aName.Len();
+/*N*/
+/*N*/ const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+/*N*/
+/*N*/ sal_uInt16 nNum, nTmp, nFlagSize = ( rFmts.Count() / 8 ) +2;
+/*N*/ sal_uInt8* pSetFlags = new sal_uInt8[ nFlagSize ];
+/*N*/ memset( pSetFlags, 0, nFlagSize );
+/*N*/
+ sal_uInt16 n=0;
+/*N*/ for( n = 0; n < rFmts.Count(); ++n )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFlyFmt = rFmts[ n ];
+/*N*/ if( RES_FLYFRMFMT == pFlyFmt->Which() &&
+/*N*/ pFlyFmt->GetName().Match( aName ) == nNmLen )
+/*N*/ {
+/*N*/ // Nummer bestimmen und das Flag setzen
+/*N*/ nNum = pFlyFmt->GetName().Copy( nNmLen ).ToInt32();
+/*N*/ if( nNum-- && nNum < rFmts.Count() )
+/*N*/ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+/*N*/ nNum = rFmts.Count();
+/*N*/ for( n = 0; n < nFlagSize; ++n )
+/*N*/ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+/*N*/ {
+/*N*/ // also die Nummer bestimmen
+/*N*/ nNum = n * 8;
+/*N*/ while( nTmp & 1 )
+/*N*/ ++nNum, nTmp >>= 1;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ delete [] pSetFlags;
+/*N*/ return aName += String::CreateFromInt32( ++nNum );
+/*N*/ }
+
+/*N*/ String SwDoc::GetUniqueGrfName() const
+/*N*/ {
+/*N*/ return ::binfilter::lcl_GetUniqueFlyName( this, STR_GRAPHIC_DEFNAME );
+/*N*/ }
+
+/*N*/ String SwDoc::GetUniqueOLEName() const
+/*N*/ {
+/*N*/ return ::binfilter::lcl_GetUniqueFlyName( this, STR_OBJECT_DEFNAME );
+/*N*/ }
+
+/*N*/ String SwDoc::GetUniqueFrameName() const
+/*N*/ {
+/*N*/ return ::binfilter::lcl_GetUniqueFlyName( this, STR_FRAME_DEFNAME );
+/*N*/ }
+
+/*N*/ const SwFlyFrmFmt* SwDoc::FindFlyByName( const String& rName, sal_Int8 nNdTyp ) const
+/*N*/ {
+/*N*/ const SwSpzFrmFmts& rFmts = *GetSpzFrmFmts();
+/*N*/ for( sal_uInt16 n = rFmts.Count(); n; )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFlyFmt = rFmts[ --n ];
+/*N*/ const SwNodeIndex* pIdx;
+/*N*/ if( RES_FLYFRMFMT == pFlyFmt->Which() && pFlyFmt->GetName() == rName &&
+/*N*/ 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() ) &&
+/*N*/ pIdx->GetNode().GetNodes().IsDocNodes() )
+/*N*/ {
+/*?*/ if( nNdTyp )
+/*?*/ {
+/*?*/ // dann noch auf den richtigen Node-Typ abfragen
+/*?*/ const SwNode* pNd = GetNodes()[ pIdx->GetIndex()+1 ];
+/*?*/ if( nNdTyp == ND_TEXTNODE
+/*?*/ ? !pNd->IsNoTxtNode()
+/*?*/ : nNdTyp == pNd->GetNodeType() )
+/*?*/ return (SwFlyFrmFmt*)pFlyFmt;
+/*?*/ }
+/*?*/ else
+/*?*/ return (SwFlyFrmFmt*)pFlyFmt;
+/*?*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ void SwDoc::SetFlyName( SwFlyFrmFmt& rFmt, const String& rName )
+/*N*/ {
+/*N*/ String sName( rName );
+/*N*/ if( !rName.Len() || FindFlyByName( rName ) )
+/*N*/ {
+/*?*/ sal_uInt16 nTyp = STR_FRAME_DEFNAME;
+/*?*/ const SwNodeIndex* pIdx = rFmt.GetCntnt().GetCntntIdx();
+/*?*/ if( pIdx && pIdx->GetNode().GetNodes().IsDocNodes() )
+/*?*/ switch( GetNodes()[ pIdx->GetIndex() + 1 ]->GetNodeType() )
+/*?*/ {
+/*?*/ case ND_GRFNODE: nTyp = STR_GRAPHIC_DEFNAME; break;
+/*?*/ case ND_OLENODE: nTyp = STR_OBJECT_DEFNAME; break;
+/*?*/ }
+/*?*/ sName = ::binfilter::lcl_GetUniqueFlyName( this, nTyp );
+/*N*/ }
+/*N*/ rFmt.SetName( sName, sal_True );
+/*N*/ }
+
+/*N*/ void SwDoc::SetAllUniqueFlyNames()
+/*N*/ {
+/*N*/ sal_uInt16 n, nFlyNum = 0, nGrfNum = 0, nOLENum = 0;
+/*N*/
+/*N*/ ResId nFrmId( STR_FRAME_DEFNAME, *pSwResMgr ),
+/*N*/ nGrfId( STR_GRAPHIC_DEFNAME, *pSwResMgr ),
+/*N*/ nOLEId( STR_OBJECT_DEFNAME, *pSwResMgr );
+/*N*/ String sFlyNm( nFrmId );
+/*N*/ String sGrfNm( nGrfId );
+/*N*/ String sOLENm( nOLEId );
+/*N*/
+/*N*/ if( 255 < ( n = GetSpzFrmFmts()->Count() ))
+/*N*/ n = 255;
+/*N*/ SwSpzFrmFmts aArr( (sal_Int8)n, 10 );
+/*N*/ SwFrmFmtPtr pFlyFmt;
+/*N*/ sal_Bool bLoadedFlag = sal_True; // noch etwas fuers Layout
+/*N*/
+/*N*/ for( n = GetSpzFrmFmts()->Count(); n; )
+/*N*/ {
+/*N*/ if( RES_FLYFRMFMT == (pFlyFmt = (*GetSpzFrmFmts())[ --n ])->Which() )
+/*N*/ {
+/*N*/ sal_uInt16 *pNum = 0;
+/*N*/ xub_StrLen nLen;
+/*N*/ const String& rNm = pFlyFmt->GetName();
+/*N*/ if( rNm.Len() )
+/*N*/ {
+/*N*/ if( rNm.Match( sGrfNm ) == ( nLen = sGrfNm.Len() ))
+/*?*/ pNum = &nGrfNum;
+/*N*/ else if( rNm.Match( sFlyNm ) == ( nLen = sFlyNm.Len() ))
+/*N*/ pNum = &nFlyNum;
+/*N*/ else if( rNm.Match( sOLENm ) == ( nLen = sOLENm.Len() ))
+/*?*/ pNum = &nOLENum;
+/*N*/
+/*N*/ if( pNum && *pNum < ( nLen = rNm.Copy( nLen ).ToInt32() ))
+/*N*/ *pNum = nLen;
+/*N*/ }
+/*N*/ else
+/*N*/ // das wollen wir nachher setzen
+/*?*/ aArr.Insert( pFlyFmt, aArr.Count() );
+/*N*/
+/*N*/ }
+/*N*/ if( bLoadedFlag )
+/*N*/ {
+/*N*/ const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor();
+/*N*/ if( ( FLY_PAGE == rAnchor.GetAnchorId() &&
+/*N*/ rAnchor.GetCntntAnchor() ) ||
+/*N*/ // oder werden DrawObjecte rel. zu irgendetwas ausgerichtet?
+/*N*/ ( RES_DRAWFRMFMT == pFlyFmt->Which() && (
+/*N*/ SFX_ITEM_SET == pFlyFmt->GetItemState(
+/*N*/ RES_VERT_ORIENT )||
+/*N*/ SFX_ITEM_SET == pFlyFmt->GetItemState(
+/*N*/ RES_HORI_ORIENT ))) )
+/*N*/ bLoadedFlag = sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SwNodeIndex* pIdx;
+/*N*/
+/*N*/ for( n = aArr.Count(); n; )
+/*?*/ if( 0 != ( pIdx = ( pFlyFmt = aArr[ --n ])->GetCntnt().GetCntntIdx() )
+/*?*/ && pIdx->GetNode().GetNodes().IsDocNodes() )
+/*?*/ {
+/*?*/ sal_uInt16 nNum;
+/*?*/ String sNm;
+/*?*/ switch( GetNodes()[ pIdx->GetIndex() + 1 ]->GetNodeType() )
+/*?*/ {
+/*?*/ case ND_GRFNODE:
+/*?*/ sNm = sGrfNm;
+/*?*/ nNum = ++nGrfNum;
+/*?*/ break;
+/*?*/ case ND_OLENODE:
+/*?*/ sNm = sOLENm;
+/*?*/ nNum = ++nOLENum;
+/*?*/ break;
+/*?*/ default:
+/*?*/ sNm = sFlyNm;
+/*?*/ nNum = ++nFlyNum;
+/*?*/ break;
+/*?*/ }
+/*?*/ pFlyFmt->SetName( sNm += String::CreateFromInt32( nNum ));
+/*?*/ }
+/*N*/ aArr.Remove( 0, aArr.Count() );
+/*N*/
+/*N*/ if( GetFtnIdxs().Count() )
+/*N*/ {
+/*N*/ SwTxtFtn::SetUniqueSeqRefNo( *this );
+/*N*/ SwNodeIndex aTmp( GetNodes() );
+/*N*/ GetFtnIdxs().UpdateFtn( aTmp );
+/*N*/ }
+/*N*/
+/*N*/ // neues Document und keine seitengebundenen Rahmen/DrawObjecte gefunden,
+/*N*/ // die an einem Node verankert sind.
+/*N*/ if( bLoadedFlag )
+/*N*/ SetLoaded( sal_True );
+/*N*/ }
+
+/*N*/ sal_Bool SwDoc::IsInHeaderFooter( const SwNodeIndex& rIdx ) const
+/*N*/ {
+/*N*/ // gibt es ein Layout, dann ueber das laufen!!
+/*N*/ // (Das kann dann auch Fly in Fly in Kopfzeile !)
+/*N*/ // MIB 9.2.98: Wird auch vom sw3io benutzt, um festzustellen, ob sich
+/*N*/ // ein Redline-Objekt in einer Kopf- oder Fusszeile befindet. Da
+/*N*/ // Redlines auch an Start- und Endnodes haengen, muss der Index nicht
+/*N*/ // unbedingt der eines Content-Nodes sein.
+/*N*/ SwNode* pNd = &rIdx.GetNode();
+/*N*/ if( pNd->IsCntntNode() && pLayout )
+/*N*/ {
+/*N*/ SwFrm *pFrm = pNd->GetCntntNode()->GetFrm();
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ SwFrm *pUp = pFrm->GetUpper();
+/*N*/ while ( pUp && !pUp->IsHeaderFrm() && !pUp->IsFooterFrm() )
+/*N*/ {
+/*N*/ if ( pUp->IsFlyFrm() )
+/*N*/ pUp = ((SwFlyFrm*)pUp)->GetAnchor();
+/*N*/ pUp = pUp->GetUpper();
+/*N*/ }
+/*N*/ if ( pUp )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ const SwNode* pFlyNd = pNd->FindFlyStartNode();
+/*N*/ while( pFlyNd )
+/*N*/ {
+/*N*/ // dann ueber den Anker nach oben "hangeln"
+ sal_uInt16 n=0;
+/*N*/ for( n = 0; n < GetSpzFrmFmts()->Count(); ++n )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[ n ];
+/*N*/ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+/*N*/ if( pIdx && pFlyNd == &pIdx->GetNode() )
+/*N*/ {
+/*N*/ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+/*N*/ if( FLY_PAGE == rAnchor.GetAnchorId() ||
+/*N*/ !rAnchor.GetCntntAnchor() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ pNd = &rAnchor.GetCntntAnchor()->nNode.GetNode();
+/*N*/ pFlyNd = pNd->FindFlyStartNode();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ if( n >= GetSpzFrmFmts()->Count() )
+/*N*/ {
+/*N*/ ASSERT( bInReading, "Fly-Section aber kein Format gefunden" );
+/*N*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return 0 != pNd->FindHeaderStartNode() ||
+/*N*/ 0 != pNd->FindFooterStartNode();
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docnew.cxx b/binfilter/bf_sw/source/core/doc/sw_docnew.cxx
new file mode 100644
index 000000000000..d8123242c09d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docnew.cxx
@@ -0,0 +1,746 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#define ROLBCK_HISTORY_ONLY // Der Kampf gegen die CLOOK's
+
+#include <com/sun/star/i18n/ForbiddenCharacters.hdl>
+
+#include <vcl/virdev.hxx>
+#include <rtl/logfile.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <bf_sfx2/docinf.hxx>
+#include <bf_svtools/macitem.hxx>
+#include <bf_svx/svxids.hrc>
+#include <bf_svx/linkmgr.hxx>
+#include <bf_svtools/zforlist.hxx>
+#include <bf_svx/forbiddencharacterstable.hxx>
+
+#include <paratr.hxx>
+#include <fchrfmt.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfordr.hxx>
+#include <pvprtdat.hxx>
+
+#include <horiornt.hxx>
+
+#include <rootfrm.hxx> //Damit der RootDtor gerufen wird.
+#include <layouter.hxx>
+#include <ndtxt.hxx>
+#include <printdata.hxx>
+#include <docfld.hxx>
+#include <ftninfo.hxx>
+#include <ftnidx.hxx>
+#include <docstat.hxx>
+#include <charfmt.hxx>
+#include <poolfmt.hxx> // fuer die Pool-Vorlage
+#include <dbmgr.hxx>
+#include <docsh.hxx>
+#include <visiturl.hxx> // fuer die URL-Change Benachrichtigung
+#include <docary.hxx>
+#include <lineinfo.hxx>
+#include <drawdoc.hxx>
+#include <linkenum.hxx>
+#include <fldupde.hxx>
+#include <extinput.hxx>
+#include <viewsh.hxx>
+#include <doctxm.hxx>
+#include <shellres.hxx>
+#include <unoclbck.hxx>
+#include <breakit.hxx>
+#include <laycache.hxx>
+
+#include <cmdid.h> // fuer den dflt - Printer in SetJob
+
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+
+namespace binfilter {
+const sal_Char __FAR_DATA sFrmFmtStr[] = "Frameformat";
+const sal_Char __FAR_DATA sEmptyPageStr[] = "Empty Page";
+const sal_Char __FAR_DATA sColumnCntStr[] = "Columncontainer";
+const sal_Char __FAR_DATA sCharFmtStr[] = "Zeichenformat";
+const sal_Char __FAR_DATA sTxtCollStr[] = "Textformatvorlage";
+const sal_Char __FAR_DATA sGrfCollStr[] = "Graphikformatvorlage";
+
+/*N*/ SV_IMPL_PTRARR( SwNumRuleTbl, SwNumRulePtr)
+/*N*/ SV_IMPL_PTRARR( SwTxtFmtColls, SwTxtFmtCollPtr)
+/*N*/ SV_IMPL_PTRARR( SwGrfFmtColls, SwGrfFmtCollPtr)
+
+
+/*
+ * interne Funktionen
+ */
+
+/*N*/ BOOL lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* )
+/*N*/ {
+/*N*/ SwFmtCntnt &rFmtCntnt = (SwFmtCntnt&)rpFmt->GetCntnt();
+/*N*/ if ( rFmtCntnt.GetCntntIdx() )
+/*N*/ rFmtCntnt.SetNewCntntIdx( 0 );
+/*N*/ SwFmtAnchor &rFmtAnchor = (SwFmtAnchor&)rpFmt->GetAnchor();
+/*N*/ if ( rFmtAnchor.GetCntntAnchor() )
+/*N*/ rFmtAnchor.SetAnchor( 0 );
+/*N*/ return TRUE;
+/*N*/ }
+
+/*
+ * exportierte Methoden
+ */
+
+/*N*/ SwDoc::SwDoc() :
+/*N*/ aAttrPool( this ),
+/*N*/ aNodes( this ),
+/*N*/ pFrmFmtTbl( new SwFrmFmts() ),
+/*N*/ pCharFmtTbl( new SwCharFmts() ),
+/*N*/ pSpzFrmFmtTbl( new SwSpzFrmFmts() ),
+/*N*/ pTblFrmFmtTbl( new SwFrmFmts() ),
+/*N*/ pDfltFrmFmt( new SwFrmFmt( aAttrPool, sFrmFmtStr, 0 ) ),
+/*N*/ pEmptyPageFmt( new SwFrmFmt( aAttrPool, sEmptyPageStr, pDfltFrmFmt ) ),
+/*N*/ pColumnContFmt( new SwFrmFmt( aAttrPool, sColumnCntStr, pDfltFrmFmt ) ),
+/*N*/ pDfltCharFmt( new SwCharFmt( aAttrPool, sCharFmtStr, 0 ) ),
+/*N*/ pDfltTxtFmtColl( new SwTxtFmtColl( aAttrPool, sTxtCollStr ) ),
+/*N*/ pTxtFmtCollTbl( new SwTxtFmtColls() ),
+/*N*/ pDfltGrfFmtColl( new SwGrfFmtColl( aAttrPool, sGrfCollStr ) ),
+/*N*/ pGrfFmtCollTbl( new SwGrfFmtColls() ),
+/*N*/ pSectionFmtTbl( new SwSectionFmts() ),
+/*N*/ pFldTypes( new SwFldTypes() ),
+/*N*/ pBookmarkTbl( new SwBookmarks( 0, 16 ) ),
+/*N*/ pTOXTypes( new SwTOXTypes() ),
+/*N*/ pDefTOXBases( new SwDefTOXBase_Impl() ),
+/*N*/ nLinkCt( 0 ),
+/*N*/ pGlossaryDoc( 0 ),
+/*N*/ pOutlineRule( 0 ),
+/*N*/ pLayout( 0 ), // Rootframe des spezifischen Layouts.
+/*N*/ pPrt( 0 ),
+/*N*/ pPrtData( 0 ),
+/*N*/ pExtInputRing( 0 ),
+/*N*/ pLayouter( 0 ),
+/*N*/ pLayoutCache( 0 ),
+/*N*/ nLockExpFld( 0 ),
+/*N*/ pDocShell( 0 ),
+/*N*/ pDrawModel( 0 ),
+/*N*/ pUpdtFlds( new SwDocUpdtFld() ),
+/*N*/ pLinkMgr( new SvxLinkManager( 0 ) ),
+/*N*/ pSwgInfo( 0 ),
+/*N*/ pDocShRef( 0 ),
+/*N*/ pACEWord( 0 ),
+/*N*/ pURLStateChgd( 0 ),
+/*N*/ pNumberFormatter( 0 ),
+/*N*/ pFtnInfo( new SwFtnInfo ),
+/*N*/ pEndNoteInfo( new SwEndNoteInfo ),
+/*N*/ pLineNumberInfo( new SwLineNumberInfo ),
+/*N*/ pFtnIdxs( new SwFtnIdxs ),
+/*N*/ pDocStat( new SwDocStat ),
+/*N*/ pNumRuleTbl( new SwNumRuleTbl ),
+/*N*/ eRedlineMode( SwRedlineMode(REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE) ),
+/*N*/ pRedlineTbl( new SwRedlineTbl ),
+/*N*/ pUnoCrsrTbl( new SwUnoCrsrTbl( 0, 16 ) ),
+/*N*/ pPgPViewPrtData( 0 ),
+/*N*/ pAutoFmtRedlnComment( 0 ),
+/*N*/ pUnoCallBack(new SwUnoCallBack(0)),
+/*N*/ nAutoFmtRedlnCommentNo( 0 ),
+/*N*/ eChrCmprType( CHARCOMPRESS_NONE ),
+/*N*/ n32Dummy1( 0 ), n32Dummy2( 0 ), n8Dummy1( 0x80 ), n8Dummy2( 0 ),
+/*N*/ nLinkUpdMode( GLOBALSETTING ),
+/*N*/ nFldUpdMode( AUTOUPD_GLOBALSETTING ),
+/*N*/ bReadlineChecked(sal_False)
+/*N*/ {
+/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" );
+/*N*/
+/*N*/ bGlossDoc =
+/*N*/ bModified =
+/*N*/ bDtor =
+/*N*/ bPageNums =
+/*N*/ bLoaded =
+/*N*/ bUpdateExpFld =
+/*N*/ bNewDoc =
+/*N*/ bCopyIsMove =
+/*N*/ bBrowseMode =
+/*N*/ bInReading =
+/*N*/ bUpdateTOX =
+/*N*/ bInLoadAsynchron =
+/*N*/ bHTMLMode =
+/*N*/ bHeadInBrowse =
+/*N*/ bFootInBrowse =
+/*N*/ bInCallModified =
+/*N*/ bIsGlobalDoc =
+/*N*/ bGlblDocSaveLinks =
+/*N*/ bIsLabelDoc =
+/*N*/ bIsAutoFmtRedline =
+/*N*/ bOLEPrtNotifyPending =
+/*N*/ bAllOLENotify =
+/*N*/ bIsRedlineMove =
+/*N*/ bInsOnlyTxtGlssry =
+/*N*/ bContains_MSVBasic =
+/*N*/ bKernAsianPunctuation =
+/*N*/ #ifdef DBG_UTIL
+/*N*/ bXMLExport =
+/*N*/ #endif
+/*N*/ FALSE;
+/*N*/
+/*N*/ bNewFldLst =
+/*N*/ bVisibleLinks =
+/*N*/ bFrmBeepEnabled =
+/*N*/ bPurgeOLE =
+/*N*/ TRUE;
+/*N*/
+/*N*/ pMacroTable = new SvxMacroTableDtor;
+/*N*/
+ /*
+ * Builds and sets the virtual device
+ */
+/*N*/ pVirDev = new VirtualDevice( 1 );
+/*N*/ pVirDev->SetReferenceDevice(VirtualDevice::REFDEV_MODE_MSO1);
+/*N*/ MapMode aMapMode( pVirDev->GetMapMode() );
+/*N*/ aMapMode.SetMapUnit( MAP_TWIP );
+/*N*/ pVirDev->SetMapMode( aMapMode );
+
+ /*
+ * Defaultformate und DefaultFormatsammlungen (FmtColl)
+ * werden an der Position 0 in das jeweilige Array eingetragen.
+ * Die Formate der FmtColls sind von den Defaultformaten
+ * abgeleitet und stehen auch in der Liste.
+ */
+/*N*/ /* Formate */
+/*N*/ pFrmFmtTbl->Insert(pDfltFrmFmt, 0 );
+/*N*/ pCharFmtTbl->Insert(pDfltCharFmt, 0 );
+/*N*/
+/*N*/ /* FmtColls */
+/*N*/ // TXT
+/*N*/ pTxtFmtCollTbl->Insert(pDfltTxtFmtColl, 0 );
+/*N*/ // aFtnInfo.SetFtnTxtColl(aDfltTxtFmtColl); // jetzt oben in der Liste
+/*N*/ // GRF
+/*N*/ pGrfFmtCollTbl->Insert(pDfltGrfFmtColl, 0 );
+/*N*/
+/*N*/ // PageDesc, EmptyPageFmt und ColumnFmt anlegen
+/*N*/ if ( !aPageDescs.Count() )
+/*N*/ GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+/*N*/
+/*N*/ //Leere Seite Einstellen.
+/*N*/ pEmptyPageFmt->SetAttr( SwFmtFrmSize( ATT_FIX_SIZE ) );
+/*N*/ //BodyFmt fuer Spalten Einstellen.
+/*N*/ pColumnContFmt->SetAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
+/*N*/
+/*N*/ _InitFieldTypes();
+/*N*/
+/*N*/ // lege (fuer die Filter) eine Default-OullineNumRule an
+/*N*/ pOutlineRule = new SwNumRule( String::CreateFromAscii(
+/*N*/ SwNumRule::GetOutlineRuleName() ),
+/*N*/ OUTLINE_RULE );
+/*N*/
+/*N*/ // new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl );
+/*N*/ new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ),
+/*N*/ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
+/*N*/
+/*N*/ // den eigenen IdleTimer setzen
+/*N*/ aIdleTimer.SetTimeout( 600 );
+/*N*/ aIdleTimer.SetTimeoutHdl( LINK(this, SwDoc, DoIdleJobs) );
+/*N*/ aIdleTimer.Start();
+/*N*/
+/*N*/ // den CharTimer setzen
+/*N*/ aChartTimer.SetTimeout( 2000 );
+/*N*/ aChartTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateAllCharts ));
+/*N*/
+/*N*/ aOLEModifiedTimer.SetTimeout( 1000 );
+/*N*/ aOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE ));
+/*N*/
+/*N*/ // DBMgr anlegen
+/*N*/ pNewDBMgr = new SwNewDBMgr;
+/*N*/
+/*N*/ // create TOXTypes
+/*N*/ ShellResource* pShellRes = ViewShell::GetShellRes();
+/*N*/
+/*N*/ SwTOXType * pNew = new SwTOXType(TOX_CONTENT, pShellRes->aTOXContentName );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/ pNew = new SwTOXType(TOX_INDEX, pShellRes->aTOXIndexName );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/ pNew = new SwTOXType(TOX_USER, pShellRes->aTOXUserName );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/ pNew = new SwTOXType(TOX_ILLUSTRATIONS, pShellRes->aTOXIllustrationsName );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/ pNew = new SwTOXType(TOX_OBJECTS, pShellRes->aTOXObjectsName );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/ pNew = new SwTOXType(TOX_TABLES, pShellRes->aTOXTablesName );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/ pNew = new SwTOXType(TOX_AUTHORITIES, pShellRes->aTOXAuthoritiesName );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/
+/*N*/ ResetModified();
+/*N*/ }
+
+/*
+ * Besonderheiten: an der Position 0 des Arrays der Formate und
+ * der GDI-Objekte befindet sich ein Member der Klasse SwDoc.
+ * Dieser darf also keinesfalls durch delete geloescht
+ * werden!!!!!!!!!!
+ */
+
+
+/*N*/ SwDoc::~SwDoc()
+/*N*/ {
+/*N*/ //!! needs to be done to destroy a possible SwFmtDrop format that may
+/*N*/ //!! be connected to a char format which may not otherwise be removed
+/*N*/ //!! and thus would leave a unremoved SwFmt object. (TL)
+/*N*/ //!! (this is case is not possible via UI but via API...)
+/*N*/ SwFmtDrop aDrop;
+/*N*/ SetDefault(aDrop);
+/*N*/ //!! same for SwFmtCharFmt
+/*N*/ SwFmtCharFmt aCharFmt(NULL);
+/*N*/ SetDefault(aCharFmt);
+/*N*/
+/*N*/ aIdleTimer.Stop(); // den Idltimer abschalten
+/*N*/
+/*N*/ delete pUnoCallBack, pUnoCallBack = 0;
+/*N*/ delete pURLStateChgd;
+/*N*/
+/*N*/ delete pLayouter;
+/*N*/
+/*N*/ // Undo-Benachrichtigung vom Draw abschalten
+/*N*/ if( pDrawModel )
+/*N*/ {
+/*N*/ ClrContourCache();
+/*N*/ }
+/*N*/
+/*N*/ delete pPgPViewPrtData;
+/*N*/
+/*N*/ // damit die Fussnotenattribute die Fussnotennodes in Frieden lassen.
+/*N*/ bDtor = TRUE;
+/*N*/
+/*N*/ DELETEZ( pLayout );
+/*N*/ DELETEZ( pOutlineRule );
+/*N*/
+/*N*/ delete pRedlineTbl;
+/*N*/ delete pUnoCrsrTbl;
+/*N*/ delete pAutoFmtRedlnComment;
+/*N*/
+/*N*/ if( pUpdtFlds )
+/*N*/ delete pUpdtFlds;
+/*N*/
+/*N*/ // die BaseLinks freigeben.
+/*N*/ {
+/*N*/ for( USHORT n = pLinkMgr->GetServers().Count(); n; )
+/*N*/ pLinkMgr->GetServers()[ --n ]->Closed();
+/*N*/
+/*N*/ if( pLinkMgr->GetLinks().Count() )
+/*N*/ pLinkMgr->Remove( 0, pLinkMgr->GetLinks().Count() );
+/*N*/ }
+/*N*/
+/*N*/ // die KapitelNummern / Nummern muessen vor den Vorlage geloescht werden
+/*N*/ // ansonsten wird noch staendig geupdatet !!!
+/*N*/ aNodes.pOutlineNds->Remove( USHORT(0), aNodes.pOutlineNds->Count() );
+/*N*/ // aUndoNodes.pOutlineNds->Remove( USHORT(0), aUndoNodes.pOutlineNds->Count() );
+/*N*/
+/*N*/ pFtnIdxs->Remove( USHORT(0), pFtnIdxs->Count() );
+/*N*/
+/*N*/ // in den BookMarks sind Indizies auf den Content. Diese muessen vorm
+/*N*/ // loesche der Nodes geloescht werden.
+/*N*/ pBookmarkTbl->DeleteAndDestroy( 0, pBookmarkTbl->Count() );
+/*N*/ DELETEZ( pMacroTable );
+/*N*/
+/*N*/ if( pExtInputRing )
+/*N*/ {
+/*?*/ Ring* pTmp = pExtInputRing;
+/*?*/ pExtInputRing = 0;
+/*?*/ while( pTmp->GetNext() != pTmp )
+/*?*/ delete pTmp->GetNext();
+/*?*/ delete pTmp;
+/*N*/ }
+
+//JP: alt - loeschen ohne Flag ist teuer; Modify wird verschickt!
+// aTOXTypes.DeleteAndDestroy( 0, aTOXTypes.Count() );
+ {
+/*N*/ for( USHORT n = pTOXTypes->Count(); n; )
+/*N*/ {
+/*N*/ (*pTOXTypes)[ --n ]->SetInDocDTOR();
+/*N*/ delete (*pTOXTypes)[ n ];
+/*N*/ }
+/*N*/ pTOXTypes->Remove( 0, pTOXTypes->Count() );
+/*N*/ }
+/*N*/ delete pDefTOXBases;
+
+ //Im einen oder anderen FrmFormat koennen noch Indizes angemeldet sein,
+ //Diese muessen spaetestens jetzt zerstoert werden.
+/*N*/ pFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
+/*N*/ pSpzFrmFmtTbl->ForEach( &lcl_DelFmtIndizes, this );
+/*N*/ ((SwFrmFmts&)*pSectionFmtTbl).ForEach( &lcl_DelFmtIndizes, this );
+/*N*/
+/*N*/ //Die Formate, die hier hinter stehen sind von den DefaultFormaten
+/*N*/ //abhaengig. Erst nach dem Loeschen der FmtIndizes weil der Inhalt von
+/*N*/ //Kopf-/Fussbereichen geloescht wird. Wenn dort noch Indizes von Flys
+/*N*/ //angemeldet sind gibts was an die Ohren.
+/*N*/ aPageDescs.DeleteAndDestroy( 0, aPageDescs.Count() );
+/*N*/
+/*N*/ // Inhaltssections loeschen
+/*N*/ // nicht erst durch den SwNodes-DTOR, damit Formate
+/*N*/ // keine Abhaengigen mehr haben.
+/*N*/ aNodes.DelNodes( SwNodeIndex( aNodes ), aNodes.Count() );
+/*N*/ // aUndoNodes.DelNodes( SwNodeIndex( aUndoNodes ), aUndoNodes.Count() );
+/*N*/
+/*N*/ // Formate loeschen, spaeter mal permanent machen.
+/*N*/
+/*N*/ // Delete fuer Collections
+/*N*/ // damit die Abhaengigen wech sind
+/*N*/ SwTxtFmtColl *pFtnColl = pFtnInfo->GetFtnTxtColl();
+/*N*/ if ( pFtnColl ) pFtnColl->Remove(pFtnInfo);
+/*N*/ pFtnColl = pEndNoteInfo->GetFtnTxtColl();
+/*N*/ if ( pFtnColl ) pFtnColl->Remove(pEndNoteInfo);
+/*N*/
+/*N*/ ASSERT( pDfltTxtFmtColl == (*pTxtFmtCollTbl)[0],
+/*N*/ "Default-Text-Collection muss immer am Anfang stehen" );
+/*N*/
+/*N*/ // JP 27.01.98: opt.: ausgehend davon, das Standard als 2. im Array
+/*N*/ // steht, sollte das als letztes geloescht werden, damit
+/*N*/ // die ganze Umhaengerei der Formate vermieden wird!
+/*N*/ if( 2 < pTxtFmtCollTbl->Count() )
+/*N*/ pTxtFmtCollTbl->DeleteAndDestroy( 2, pTxtFmtCollTbl->Count()-2 );
+/*N*/ pTxtFmtCollTbl->DeleteAndDestroy( 1, pTxtFmtCollTbl->Count()-1 );
+/*N*/ delete pTxtFmtCollTbl;
+/*N*/
+/*N*/ ASSERT( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0],
+/*N*/ "Default-Grf-Collection muss immer am Anfang stehen" );
+/*N*/
+/*N*/ pGrfFmtCollTbl->DeleteAndDestroy( 1, pGrfFmtCollTbl->Count()-1 );
+/*N*/ // ergibt sich automatisch - kein _DEL Array!
+/*N*/ // pGrfFmtCollTbl->Remove( 0, n );
+/*N*/ delete pGrfFmtCollTbl;
+/*N*/
+ /*
+ * Defaultformate und DefaultFormatsammlungen (FmtColl)
+ * sind an der Position 0 der jeweiligen Arrays eingetragen.
+ * Damit sie nicht vom DTOR der Array's zum 2.mal geloescht werden,
+ * nehme sie aus dem Array.
+ */
+/*N*/ pFrmFmtTbl->Remove( 0 );
+/*N*/ pCharFmtTbl->Remove( 0 );
+/*N*/
+/*N*/ // Delete fuer pPrt
+/*N*/ DELETEZ( pPrt );
+/*N*/ DELETEZ( pSwgInfo );
+/*N*/ DELETEZ( pNewDBMgr );
+/*N*/
+/*N*/ // Alle Flys muessen vor dem Drawing Model zerstoert werden,
+/*N*/ // da Flys noch DrawContacts enthalten koennen, wenn wegen
+/*N*/ // eines Lesefehlers kein Layout aufgebaut wurde.
+/*N*/ pSpzFrmFmtTbl->DeleteAndDestroy( 0, pSpzFrmFmtTbl->Count() );
+/*N*/
+/*N*/ //Erst jetzt das Model zerstoeren, die Zeichenobjekte - die ja auch
+/*N*/ //im Undo herumlungern - wollen noch ihre Attribute beim Model entfernen.
+/*N*/ //Ausserdem koennen vorher noch DrawContacts existieren.
+/*N*/ ReleaseDrawModel();
+/*N*/ //JP 28.01.99: DrawModel vorm LinkManager zerstoeren, da am DrawModel
+/*N*/ // dieser immer gesetzt ist.
+/*N*/ DELETEZ( pLinkMgr );
+/*N*/
+/*N*/ //Tables vor dem loeschen der Defaults leeren, sonst GPF wegen Def-Abhaengigen.
+/*N*/ //Die Arrays sollten (wegen includes) bei Gelegenheit auch zu Pointern werden.
+/*N*/ delete pFrmFmtTbl;
+/*N*/ delete pSpzFrmFmtTbl;
+/*N*/ delete pCharFmtTbl;
+/*N*/ delete pSectionFmtTbl;
+/*N*/ delete pTblFrmFmtTbl;
+/*N*/ delete pDfltTxtFmtColl;
+/*N*/ delete pDfltGrfFmtColl;
+/*N*/ delete pNumRuleTbl;
+/*N*/
+/*N*/ delete pPrtData;
+/*N*/ delete pBookmarkTbl;
+/*N*/ delete pNumberFormatter;
+/*N*/ delete pFtnInfo;
+/*N*/ delete pEndNoteInfo;
+/*N*/ delete pLineNumberInfo;
+/*N*/ delete pFtnIdxs;
+/*N*/ delete pFldTypes;
+/*N*/ delete pTOXTypes;
+/*N*/ delete pDocStat;
+/*N*/ delete pEmptyPageFmt;
+/*N*/ delete pColumnContFmt;
+/*N*/ delete pDfltCharFmt;
+/*N*/ delete pDfltFrmFmt;
+/*N*/ delete pLayoutCache;
+/*N*/ delete pVirDev;
+/*N*/ }
+
+
+//---------------------------------------------------
+
+
+/*N*/ void SwDoc::SetJobsetup( const JobSetup &rJobSetup )
+/*N*/ {
+/*N*/ BOOL bCheckPageDescs = 0 == pPrt;
+/*N*/ BOOL bDataChanged = FALSE;
+/*N*/
+/*N*/ if ( pPrt )
+/*N*/ {
+/*N*/ if ( pPrt->GetName() == rJobSetup.GetPrinterName() )
+/*N*/ {
+/*N*/ if ( pPrt->GetJobSetup() != rJobSetup )
+/*N*/ {
+/*?*/ pPrt->SetJobSetup( rJobSetup );
+/*?*/ bDataChanged = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ delete pPrt, pPrt = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( !pPrt )
+/*N*/ {
+/*N*/ //Das ItemSet wird vom Sfx geloescht!
+/*?*/ SfxItemSet *pSet = new SfxItemSet( aAttrPool,
+/*?*/ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+/*?*/ SID_HTML_MODE, SID_HTML_MODE,
+/*?*/ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+/*?*/ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+/*?*/ 0 );
+/*?*/ SfxPrinter *p = new SfxPrinter( pSet, rJobSetup );
+/*?*/ if ( bCheckPageDescs )
+/*?*/ SetPrt( p );
+/*?*/ else
+/*?*/ {
+/*?*/ pPrt = p;
+/*?*/ bDataChanged = TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ if ( !IsUseVirtualDevice() && bDataChanged )
+/*?*/ PrtDataChanged();
+/*N*/ }
+
+//---------------------------------------------------
+
+/*N*/ OutputDevice& SwDoc::GetRefDev() const
+/*N*/ {
+/*N*/ if ( ! IsUseVirtualDevice() )
+/*N*/ {
+/*N*/ SfxPrinter& rPrt = *GetPrt( sal_True );
+/*N*/ if ( rPrt.IsValid() )
+/*N*/ return rPrt;
+/*N*/ }
+/*N*/
+/*N*/ return *GetVirDev( sal_True );
+/*N*/ }
+
+//---------------------------------------------------
+
+/*N*/ OutputDevice* SwDoc::_GetRefDev() const
+/*N*/ {
+/*N*/ if ( IsUseVirtualDevice() )
+/*N*/ return pVirDev;
+/*N*/ return pPrt;
+/*N*/ }
+
+//---------------------------------------------------
+
+/*N*/ VirtualDevice& SwDoc::_GetVirDev() const
+/*N*/ {
+/*?*/ VirtualDevice* pNewVir = new VirtualDevice( 1 );
+/*?*/ pNewVir->SetReferenceDevice(VirtualDevice::REFDEV_MODE_MSO1);
+/*?*/ MapMode aMapMode( pNewVir->GetMapMode() );
+/*?*/ aMapMode.SetMapUnit( MAP_TWIP );
+/*?*/ pNewVir->SetMapMode( aMapMode );
+/*?*/
+/*?*/ ((SwDoc*)this)->SetVirDev( pNewVir, sal_True );
+/*?*/ return *pVirDev;
+/*N*/ }
+
+//---------------------------------------------------
+
+/*N*/ SfxPrinter& SwDoc::_GetPrt() const
+/*N*/ {
+/*N*/ ASSERT( ! pPrt, "Do not call _GetPrt(), call GetPrt() instead" )
+/*N*/
+/*N*/ // wir erzeugen einen default SfxPrinter.
+/*N*/ // Das ItemSet wird vom Sfx geloescht!
+/*N*/ SfxItemSet *pSet = new SfxItemSet( ((SwDoc*)this)->GetAttrPool(),
+/*N*/ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+/*N*/ SID_HTML_MODE, SID_HTML_MODE,
+/*N*/ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+/*N*/ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+/*N*/ 0 );
+/*N*/ SfxPrinter* pNewPrt = new SfxPrinter( pSet );
+/*N*/ ((SwDoc*)this)->SetPrt( pNewPrt, sal_True );
+/*N*/ return *pPrt;
+/*N*/ }
+//---------------------------------------------------
+
+/*N*/ SwPrintData* SwDoc::GetPrintData() const
+/*N*/ {
+/*N*/ return pPrtData;
+/*N*/ }
+//---------------------------------------------------
+/*N*/ void SwDoc::SetPrintData(SwPrintData& rPrtData)
+/*N*/ {
+/*N*/ if(!pPrtData)
+/*N*/ pPrtData = new SwPrintData;
+/*N*/ *pPrtData = rPrtData;
+/*N*/ }
+//---------------------------------------------------
+
+
+/*N*/ void SwDoc::SetDocShell( SwDocShell* pDSh )
+/*N*/ {
+/*N*/ if( pDocShell != pDSh )
+/*N*/ {
+/*N*/ pDocShell = pDSh;
+/*N*/ pLinkMgr->SetPersist( pDocShell );
+/*N*/ //JP 27.08.98: Bug 55570 - DocShell Pointer auch am DrawModel setzen
+/*N*/ if( pDrawModel )
+/*N*/ {
+/*N*/ ((SwDrawDocument*)pDrawModel)->SetObjectShell( pDocShell );
+/*N*/ pDrawModel->SetPersist( pDocShell );
+/*N*/ ASSERT( pDrawModel->GetPersist() == GetPersist(),
+/*N*/ "draw model's persist is out of sync" );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+// Convenience-Methode, um uebermaessige Includes von docsh.hxx
+// zu vermeiden
+
+
+/*N*/ SvStorage* SwDoc::GetDocStorage()
+/*N*/ {
+/*N*/ if( pDocShell )
+/*N*/ return pDocShell->GetStorage();
+/*?*/ if( pLinkMgr->GetPersist() )
+/*?*/ return pLinkMgr->GetPersist()->GetStorage();
+/*?*/ return NULL;
+/*N*/ }
+
+
+
+/*N*/ SvPersist* SwDoc::GetPersist() const
+/*N*/ {
+/*N*/ return pDocShell ? pDocShell : pLinkMgr->GetPersist();
+/*N*/ }
+
+
+/*N*/ const SfxDocumentInfo* SwDoc::GetInfo()
+/*N*/ {
+/*N*/ if( !pSwgInfo )
+/*N*/ // Pointer-Members initialisieren
+/*N*/ pSwgInfo = new SfxDocumentInfo;
+/*N*/ return pSwgInfo;
+/*N*/ }
+
+
+/*N*/ void SwDoc::SetPreViewPrtData( const SwPagePreViewPrtData* pNew )
+/*N*/ {
+/*N*/ if( pNew )
+/*N*/ {
+/*N*/ if( pPgPViewPrtData )
+/*N*/ *pPgPViewPrtData = *pNew;
+/*N*/ else
+/*N*/ pPgPViewPrtData = new SwPagePreViewPrtData( *pNew );
+/*N*/ }
+/*N*/ else if( pPgPViewPrtData )
+/*N*/ DELETEZ( pPgPViewPrtData );
+/*N*/ SetModified();
+/*N*/ }
+/* -----------------------------06.01.00 14:03--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwModify* SwDoc::GetUnoCallBack() const
+/*N*/ {
+/*N*/ return pUnoCallBack;
+/*N*/ }
+
+/*N*/ rtl::Reference < SvxForbiddenCharactersTable > & SwDoc::GetForbiddenCharacterTbl()
+/*N*/ {
+/*N*/ if( !xForbiddenCharsTable.is() )
+/*N*/ {
+/*N*/ ::com::sun::star::uno::Reference<
+/*N*/ ::com::sun::star::lang::XMultiServiceFactory > xMSF =
+/*N*/ ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*N*/ xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
+/*N*/ }
+/*N*/ return xForbiddenCharsTable;
+/*N*/ }
+/* ------------------------------------------------------------------------*/
+
+/*N*/ const ::com::sun::star::i18n::
+/*N*/ ForbiddenCharacters* SwDoc::GetForbiddenCharacters( USHORT nLang,
+/*N*/ BOOL bLocaleData ) const
+/*N*/ {
+/*N*/ const ::com::sun::star::i18n::ForbiddenCharacters* pRet = 0;
+/*N*/ if( xForbiddenCharsTable.is() )
+/*N*/ pRet = xForbiddenCharsTable->GetForbiddenCharacters( nLang, FALSE );
+/*N*/ if( bLocaleData && !pRet && pBreakIt )
+/*N*/ pRet = &pBreakIt->GetForbidden( (LanguageType)nLang );
+/*N*/ return pRet;
+/*N*/ }
+
+
+
+/*N*/ void SwDoc::SetCharCompressType( SwCharCompressType n )
+/*N*/ {
+/*N*/ if( eChrCmprType != n )
+/*N*/ {
+/*N*/ eChrCmprType = n;
+/*N*/ if( pDrawModel )
+/*N*/ {
+/*N*/ pDrawModel->SetCharCompressType( n );
+/*N*/ if( !bInReading )
+/*N*/ pDrawModel->ReformatAllTextObjects();
+/*N*/ }
+/*N*/
+/*N*/ if( pLayout && !bInReading )
+/*N*/ {
+/*N*/ pLayout->StartAllAction();
+/*N*/ pLayout->InvalidateAllCntnt();
+/*N*/ pLayout->EndAllAction();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*-----------------28.5.2001 10:06------------------
+ * SwDoc:
+ * Reading and writing of the layout cache.
+ *--------------------------------------------------*/
+
+/*N*/ void SwDoc::ReadLayoutCache( SvStream& rStream )
+/*N*/ {
+/*N*/ if( !pLayoutCache )
+/*N*/ pLayoutCache = new SwLayoutCache();
+/*N*/ if( !pLayoutCache->IsLocked() )
+/*N*/ {
+/*N*/ pLayoutCache->GetLockCount() |= 0x8000;
+/*N*/ pLayoutCache->Read( rStream );
+/*N*/ pLayoutCache->GetLockCount() &= 0x7fff;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::WriteLayoutCache( SvStream& rStream )
+/*N*/ {
+/*N*/ pLayoutCache->Write( rStream, *this );
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docnum.cxx b/binfilter/bf_sw/source/core/doc/sw_docnum.cxx
new file mode 100644
index 000000000000..ec98c2794da4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docnum.cxx
@@ -0,0 +1,943 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+#include <ftninfo.hxx>
+#include <ftnidx.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <paratr.hxx>
+#include <docary.hxx>
+#include <mvsave.hxx>
+#include <txtfrm.hxx>
+#include <hints.hxx>
+#include <redline.hxx>
+#include <comcore.hrc>
+#include <bf_svx/adjitem.hxx>
+namespace binfilter {
+
+/*N*/ inline BYTE GetUpperLvlChg( BYTE nCurLvl, BYTE nLevel, USHORT nMask )
+/*N*/ {
+/*N*/ if( 1 < nLevel )
+/*N*/ {
+/*N*/ if( nCurLvl + 1 >= nLevel )
+/*N*/ nCurLvl -= nLevel - 1;
+/*N*/ else
+/*N*/ nCurLvl = 0;
+/*N*/ }
+/*N*/ return (nMask - 1) & ~(( 1 << nCurLvl ) - 1);
+/*N*/ }
+
+/*N*/ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule )
+/*N*/ {
+/*N*/ USHORT nChkLevel = 0, nChgFmtLevel = 0;
+/*N*/ if( pOutlineRule )
+/*N*/ {
+/*N*/ USHORT nMask = 1;
+/*N*/ for( BYTE n = 0; n < MAXLEVEL; ++n, nMask <<= 1 )
+/*N*/ {
+/*N*/ const SwNumFmt& rOld = pOutlineRule->Get( n ),
+/*N*/ & rNew = rRule.Get( n );
+/*N*/ if( rOld != rNew )
+/*N*/ {
+/*N*/ nChgFmtLevel |= nMask;
+/*N*/ if( rOld.GetAbsLSpace() != rNew.GetAbsLSpace() ||
+/*N*/ rOld.GetFirstLineOffset() != rNew.GetFirstLineOffset() )
+/*N*/ nChkLevel |= nMask;
+/*N*/ }
+/*N*/ else if( SVX_NUM_NUMBER_NONE > rNew.GetNumberingType() && 1 < rNew.GetIncludeUpperLevels() &&
+/*N*/ 0 != (nChgFmtLevel & GetUpperLvlChg( n,
+/*N*/ rNew.GetIncludeUpperLevels(), nMask )) )
+/*?*/ nChgFmtLevel |= nMask;
+/*N*/ }
+/*N*/ (*pOutlineRule) = rRule;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ nChgFmtLevel = nChkLevel = 0xffff;
+/*?*/ pOutlineRule = new SwNumRule( rRule );
+/*N*/ }
+/*N*/ pOutlineRule->SetRuleType( OUTLINE_RULE );
+/*N*/ pOutlineRule->SetName( String::CreateFromAscii(
+/*N*/ SwNumRule::GetOutlineRuleName() ));
+
+ // teste ob die evt. gesetzen CharFormate in diesem Document
+ // definiert sind
+/*N*/ pOutlineRule->CheckCharFmts( this );
+
+ // losche aus dem Array alle Nodes, die ohne Outline Nummerierung sind
+/*N*/ SwOutlineNodes& rArr = (SwOutlineNodes&)GetNodes().GetOutLineNds();
+/*N*/ {
+/*N*/ SwNodeNum aNoNum( NO_NUMBERING );
+/*N*/ for( USHORT n = 0; n < rArr.Count(); ++n )
+/*N*/ {
+/*N*/ SwTxtNode* pTxtNd = rArr[n]->GetTxtNode();
+/*N*/ if( pTxtNd && NO_NUMBERING == pTxtNd->GetTxtColl()->GetOutlineLevel() )
+/*N*/ {
+/*?*/ pTxtNd->UpdateOutlineNum( aNoNum );
+/*?*/ rArr.Remove( n-- );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+ // suche alle Nodes, die neu aufgenommen werden muessen !!
+ // (eigentlich koennte das auch per Modify am die Nodes propagiert
+ // werden !! )
+/*N*/ ULONG nStt = GetNodes().GetEndOfContent().StartOfSectionIndex();
+ USHORT n=0;
+/*N*/ for( n = 0; n < pTxtFmtCollTbl->Count(); ++n )
+/*N*/ {
+/*N*/ SwTxtFmtColl* pColl = (*pTxtFmtCollTbl)[ n ];
+/*N*/ BYTE nLevel = pColl->GetOutlineLevel();
+/*N*/ if( NO_NUMBERING != nLevel )
+/*N*/ {
+/*N*/ #ifndef NUM_RELSPACE
+/*N*/ // JP 08.07.98: Einzuege aus der Outline uebernehmen.
+/*N*/ // ??Aber nur wenn sie veraendert wurden??
+/*N*/ if( ( nLevel = GetRealLevel( nLevel )) < MAXLEVEL
+/*N*/ /*&& 0 != (nChkLevel & (1 << nLevel ))*/ )
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetAttr( RES_LR_SPACE ) );
+/*N*/ const SwNumFmt& rNFmt = pOutlineRule->Get( nLevel );
+/*N*/
+/*N*/ // ohne Nummer immer ohne FirstLineOffset!!!!
+/*N*/ short nFOfst;
+/*N*/ if( pColl->GetOutlineLevel() & NO_NUMLEVEL )
+/*N*/ nFOfst = 0;
+/*N*/ else
+/*N*/ nFOfst = rNFmt.GetFirstLineOffset();
+/*N*/
+/*N*/ if( aLR.GetTxtLeft() != rNFmt.GetAbsLSpace() ||
+/*N*/ aLR.GetTxtFirstLineOfst() != nFOfst )
+/*N*/ {
+/*N*/ aLR.SetTxtFirstLineOfstValue( nFOfst );
+/*N*/ aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
+/*N*/
+/*N*/ pColl->SetAttr( aLR );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ SwClientIter aIter( *pColl );
+/*N*/ for( SwTxtNode* pNd = (SwTxtNode*)aIter.First( TYPE( SwTxtNode ));
+/*N*/ pNd; pNd = (SwTxtNode*)aIter.Next() )
+/*N*/ if( pNd->GetNodes().IsDocNodes() && nStt < pNd->GetIndex() )
+/*N*/ rArr.Insert( pNd );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ for( n = 0; n < rArr.Count(); ++n )
+/*N*/ {
+/*N*/ SwTxtNode* pNd = rArr[ n ]->GetTxtNode();
+/*N*/ ASSERT( pNd, "was ist das fuer ein Node?" );
+/*N*/ if( ( 1 << (pNd->GetTxtColl()->GetOutlineLevel() & ~NO_NUMLEVEL )
+/*N*/ & nChgFmtLevel ))
+/*?*/ pNd->NumRuleChgd();
+/*N*/ }
+/*N*/ GetNodes().UpdateOutlineNodes(); // update der Nummern
+/*N*/
+/*N*/ // gibt es Fussnoten && gilt Kapitelweises Nummerieren, dann updaten
+/*N*/ if( GetFtnIdxs().Count() && FTNNUM_CHAPTER == GetFtnInfo().eNum )
+/*?*/ GetFtnIdxs().UpdateAllFtn();
+/*N*/
+/*N*/ UpdateExpFlds();
+/*N*/
+/*N*/ SetModified();
+/*N*/ }
+
+
+
+ // Hoch-/Runterstufen
+
+
+
+ // Hoch-/Runter - Verschieben !
+
+
+
+
+
+
+ // zu diesem Gliederungspunkt
+
+
+ // JP 13.06.96:
+ // im Namen kann eine Nummer oder/und der Text stehen.
+ // zuerst wird ueber die Nummer versucht den richtigen Eintrag zu finden.
+ // Gibt es diesen, dann wird ueber den Text verglichen, od es der
+ // gewuenschte ist. Ist das nicht der Fall, wird noch mal nur ueber den
+ // Text gesucht. Wird dieser gefunden ist es der Eintrag. Ansonsten der,
+ // der ueber die Nummer gefunden wurde.
+ // Ist keine Nummer angegeben, dann nur den Text suchen.
+
+
+/*N*/ void SwDoc::SetOutlineLSpace( BYTE nLevel, short nFirstLnOfst, USHORT nLSpace )
+/*N*/ {
+/*N*/ if( MAXLEVEL >= nLevel )
+/*N*/ {
+/*N*/ const SwNumFmt& rNFmt = pOutlineRule->Get( nLevel );
+/*N*/ if( nLSpace != rNFmt.GetAbsLSpace() ||
+/*N*/ nFirstLnOfst != rNFmt.GetFirstLineOffset() )
+/*N*/ {
+/*N*/ SwNumFmt aFmt( rNFmt );
+/*N*/ aFmt.SetAbsLSpace( nLSpace );
+/*N*/ aFmt.SetFirstLineOffset( nFirstLnOfst );
+/*N*/ pOutlineRule->Set( nLevel, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/* */
+
+// --- Nummerierung -----------------------------------------
+
+/*N*/ void SwNumRuleInfo::MakeList( SwDoc& rDoc )
+/*N*/ {
+/*N*/ SwModify* pMod;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT i, nMaxItems = rDoc.GetAttrPool().GetItemCount( RES_PARATR_NUMRULE);
+/*N*/ for( i = 0; i < nMaxItems; ++i )
+/*N*/ if( 0 != (pItem = rDoc.GetAttrPool().GetItem( RES_PARATR_NUMRULE, i ) ) &&
+/*N*/ 0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->GetDefinedIn()) &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue().Len() &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue() == rName )
+/*N*/ {
+/*N*/ if( pMod->IsA( TYPE( SwFmt )) )
+/*?*/ pMod->GetInfo( *this );
+/*N*/ else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
+/*N*/ AddNode( *(SwTxtNode*)pMod );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule, SwHistory* pHist,
+/*N*/ SwNumRuleInfo* pRuleInfo = 0 )
+/*N*/ {
+/*N*/ SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() );
+/*N*/ ASSERT( pOld, "ohne die alte NumRule geht gar nichts" );
+/*N*/
+/*N*/ USHORT nChkLevel = 0, nChgFmtLevel = 0, nMask = 1;
+/*N*/
+ BYTE n=0;
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, nMask <<= 1 )
+/*N*/ {
+/*N*/ const SwNumFmt& rOldFmt = pOld->Get( n ),
+/*N*/ & rNewFmt = rRule.Get( n );
+/*N*/
+/*N*/ if( rOldFmt != rNewFmt )
+/*N*/ {
+/*N*/ nChgFmtLevel |= nMask;
+/*N*/ if( rOldFmt.GetAbsLSpace() != rNewFmt.GetAbsLSpace() ||
+/*N*/ rOldFmt.GetFirstLineOffset() != rNewFmt.GetFirstLineOffset() )
+/*N*/ nChkLevel |= nMask;
+/*N*/ }
+/*N*/ else if( SVX_NUM_NUMBER_NONE > rNewFmt.GetNumberingType() && 1 < rNewFmt.GetIncludeUpperLevels() &&
+/*N*/ 0 != (nChgFmtLevel & GetUpperLvlChg( n, rNewFmt.GetIncludeUpperLevels(),nMask )) )
+/*?*/ nChgFmtLevel |= nMask;
+/*N*/ }
+/*N*/
+/*N*/ if( !nChgFmtLevel ) // es wurde nichts veraendert?
+/*N*/ {
+/*N*/ pOld->CheckCharFmts( &rDoc );
+/*N*/ pOld->SetContinusNum( rRule.IsContinusNum() );
+/*N*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ SwNumRuleInfo* pUpd;
+/*N*/ if( !pRuleInfo )
+/*N*/ {
+/*N*/ pUpd = new SwNumRuleInfo( rRule.GetName() );
+/*N*/ pUpd->MakeList( rDoc );
+/*N*/ }
+/*N*/ else
+/*?*/ pUpd = pRuleInfo;
+/*N*/
+/*N*/ BYTE nLvl;
+/*N*/ for( ULONG nFirst = 0, nLast = pUpd->GetList().Count();
+/*N*/ nFirst < nLast; ++nFirst )
+/*N*/ {
+/*?*/ SwTxtNode* pTxtNd = pUpd->GetList().GetObject( nFirst );
+/*?*/ if( pTxtNd->GetNum() && ( nLvl = (~NO_NUMLEVEL &
+/*?*/ pTxtNd->GetNum()->GetLevel() ) ) < MAXLEVEL )
+/*?*/ {
+/*?*/ if( nChgFmtLevel & ( 1 << nLvl ))
+/*?*/ {
+/*?*/ pTxtNd->NumRuleChgd();
+/*?*/
+/*?*/ #ifndef NUM_RELSPACE
+/*?*/ if( nChkLevel && (nChkLevel & ( 1 << nLvl )) &&
+/*?*/ pOld->IsRuleLSpace( *pTxtNd ) )
+/*?*/ pTxtNd->SetNumLSpace( TRUE );
+/*?*/
+/*?*/ if( pHist )
+/*?*/ {
+/*?*/ const SfxPoolItem& rItem =
+/*?*/ pTxtNd->SwCntntNode::GetAttr( RES_LR_SPACE );
+/*?*/ pHist->Add( &rItem, &rItem, pTxtNd->GetIndex() );
+/*?*/ }
+/*?*/ #endif
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ for( n = 0; n < MAXLEVEL; ++n )
+/*N*/ if( nChgFmtLevel & ( 1 << n ))
+/*N*/ pOld->Set( n, rRule.GetNumFmt( n ));
+/*N*/
+/*N*/ pOld->CheckCharFmts( &rDoc );
+/*N*/ pOld->SetInvalidRule( TRUE );
+/*N*/ pOld->SetContinusNum( rRule.IsContinusNum() );
+/*N*/
+/*N*/ if( !pRuleInfo )
+/*N*/ delete pUpd;
+/*N*/ }
+
+/*N*/ void SwDoc::SetNumRule( const SwPaM& rPam, const SwNumRule& rRule,
+/*N*/ sal_Bool bSetAbsLSpace, sal_Bool bCalledFromShell )
+/*N*/ {
+/*N*/ ULONG nPamPos = rPam.Start()->nNode.GetIndex();
+/*N*/ BOOL bSetItem = TRUE;
+/*N*/ SwNumRule* pNew = FindNumRulePtr( rRule.GetName() );
+/*N*/
+/*N*/ if( !pNew )
+/*N*/ {
+/*N*/ pNew = (*pNumRuleTbl)[ MakeNumRule( rRule.GetName(), &rRule ) ];
+/*N*/
+ /* #109308# If called from a shell propagate an existing
+ adjust item at the beginning am rPam into the new
+ numbering rule. */
+/*N*/ if (bCalledFromShell)
+/*N*/ {
+/*N*/ SwCntntNode * pCntntNode = rPam.GetCntntNode();
+/*N*/
+/*N*/ if (pCntntNode)
+/*N*/ {
+/*N*/ SwAttrSet & rAttrSet = pCntntNode->GetSwAttrSet();
+/*N*/ const SfxPoolItem * pItem = NULL;
+/*N*/
+/*N*/ if (SFX_ITEM_SET == rAttrSet.GetItemState(RES_PARATR_ADJUST,
+/*N*/ TRUE,
+/*N*/ &pItem))
+/*N*/ pNew->SetNumAdjust(((SvxAdjustItem *) pItem)->GetAdjust());
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ else if( rRule.IsAutoRule() && !(*pNew == rRule) )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ if( bSetItem )
+/*N*/ {
+/*N*/ Insert( rPam, SwNumRuleItem( pNew->GetName() ) );
+/*N*/ }
+/*N*/ UpdateNumRule( pNew->GetName(), nPamPos );
+/*N*/
+/*N*/ SetModified();
+/*N*/ }
+
+/*N*/ void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+/*N*/ }
+
+/*N*/ void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt )
+/*N*/ {
+/*N*/ SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+/*N*/ const SwNumRule* pRule;
+/*N*/ if( pTxtNd && pTxtNd->GetNum() && 0 != ( pRule = pTxtNd->GetNumRule() )
+/*N*/ && nStt != pTxtNd->GetNum()->GetSetValue() )
+/*N*/ {
+/*N*/ SwNodeNum aNum( *pTxtNd->GetNum() );
+/*N*/ aNum.SetSetValue( nStt );
+/*N*/ pTxtNd->UpdateNum( aNum );
+/*N*/ UpdateNumRule( pRule->GetName(), USHRT_MAX != nStt
+/*N*/ ? rPos.nNode.GetIndex() : ULONG_MAX );
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ }
+
+ // loeschen geht nur, wenn die Rule niemand benutzt!
+/*N*/ BOOL SwDoc::DelNumRule( const String& rName )
+/*N*/ {
+/*N*/ USHORT nPos = FindNumRule( rName );
+/*N*/ if( USHRT_MAX != nPos && !IsUsed( *(*pNumRuleTbl)[ nPos ] ))
+/*N*/ {
+/*N*/ pNumRuleTbl->DeleteAndDestroy( nPos );
+/*N*/ SetModified();
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule )
+/*N*/ {
+/*N*/ SwNumRule* pRule = FindNumRulePtr( rRule.GetName() );
+/*N*/ if( pRule )
+/*N*/ {
+/*N*/ SwHistory* pHistory = 0;
+/*N*/ ::binfilter::lcl_ChgNumRule( *this, rRule, pHistory );
+/*N*/
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDoc::StopNumRuleAnimations( OutputDevice* pOut )
+/*N*/ {
+/*N*/ for( USHORT n = GetNumRuleTbl().Count(); n; )
+/*N*/ {
+/*N*/ SwNumRuleInfo aUpd( GetNumRuleTbl()[ --n ]->GetName() );
+/*N*/ aUpd.MakeList( *this );
+/*N*/
+/*N*/ for( ULONG nFirst = 0, nLast = aUpd.GetList().Count();
+/*N*/ nFirst < nLast; ++nFirst )
+/*N*/ {
+/*N*/ SwTxtNode* pTNd = aUpd.GetList().GetObject( nFirst );
+/*N*/
+/*N*/ SwClientIter aIter( *pTNd );
+/*N*/ for( SwFrm* pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) );
+/*N*/ pFrm; pFrm = (SwFrm*)aIter.Next() )
+/*N*/ if( ((SwTxtFrm*)pFrm)->HasAnimation() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 ((SwTxtFrm*)pFrm)->StopAnimation( pOut );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ BOOL SwDoc::DelNumRules( const SwPaM& rPam )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 ULONG nStt = rPam.GetPoint()->nNode.GetIndex(),
+/*N*/ }
+
+
+ // zum naechsten/vorhergehenden Punkt auf gleicher Ebene
+
+
+
+
+
+
+
+
+/*N*/ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown )
+/*N*/ {
+/*N*/ ULONG nStt = rPam.GetPoint()->nNode.GetIndex(),
+/*N*/ nEnd = rPam.GetMark()->nNode.GetIndex();
+/*N*/ if( nStt > nEnd )
+/*N*/ {
+/*?*/ ULONG nTmp = nStt; nStt = nEnd; nEnd = nTmp;
+/*N*/ }
+/*N*/
+/*N*/ signed char nDiff = bDown ? 1 : -1;
+/*N*/
+/*N*/ BOOL bRet = FALSE;
+/*N*/ String sNumRule;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ const String* pName;
+/*N*/ for( ; nStt <= nEnd; ++nStt )
+/*N*/ {
+/*N*/ SwTxtNode* pTNd = GetNodes()[ nStt ]->GetTxtNode();
+/*N*/ if( pTNd && 0 != ( pItem = pTNd->GetNoCondAttr(
+/*N*/ RES_PARATR_NUMRULE, TRUE ) ) &&
+/*N*/ ( pName = &((SwNumRuleItem*)pItem)->GetValue())->Len() )
+/*N*/ {
+/*N*/ BYTE nLevel = pTNd->GetNum()->GetLevel();
+/*N*/ if( ( -1 == nDiff && 0 < ( nLevel & ~NO_NUMLEVEL )) ||
+/*N*/ ( 1 == nDiff && MAXLEVEL - 1 > ( nLevel & ~NO_NUMLEVEL ) ) )
+/*N*/ {
+/*N*/ nLevel += nDiff;
+/*N*/ SwNodeNum aNum( *pTNd->GetNum() );
+/*N*/ aNum.SetLevel( nLevel );
+/*N*/
+/*N*/ pTNd->UpdateNum( aNum );
+/*N*/ #ifndef NUM_RELSPACE
+/*N*/ pTNd->SetNumLSpace( TRUE );
+/*N*/ #endif
+/*N*/ if( *pName != sNumRule )
+/*N*/ {
+/*N*/ sNumRule = *pName;
+/*N*/ SwNumRule* pRule = FindNumRulePtr( *pName );
+/*N*/ pRule->SetInvalidRule( TRUE );
+/*N*/ }
+/*N*/ bRet = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ UpdateNumRule();
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+/*N*/ SwNumRule* SwDoc::GetCurrNumRule( const SwPosition& rPos ) const
+/*N*/ {
+/*N*/ SwNumRule* pRet = 0;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
+/*N*/
+/*N*/ if( pTNd && 0 != ( pItem = pTNd->GetNoCondAttr( RES_PARATR_NUMRULE, TRUE ) ) &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue().Len() )
+/*N*/ pRet = FindNumRulePtr( ((SwNumRuleItem*)pItem)->GetValue() );
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ USHORT SwDoc::FindNumRule( const String& rName ) const
+/*N*/ {
+/*N*/ for( USHORT n = pNumRuleTbl->Count(); n; )
+/*N*/ if( (*pNumRuleTbl)[ --n ]->GetName() == rName )
+/*N*/ return n;
+/*
+//JP 20.11.97: sollte man im Find neue Rule anlegen??
+ erstmal nicht
+ USHORT nPoolId = GetPoolId( rName, GET_POOLID_NUMRULE );
+ if( USHRT_MAX != nPoolId )
+ {
+ SwDoc* pThis = (SwDoc*)this;
+ SwNumRule* pR = pThis->GetNumRuleFromPool( nPoolId );
+ for( n = pNumRuleTbl->Count(); n; )
+ if( (*pNumRuleTbl)[ --n ] == pR )
+ return n;
+ }
+*/
+/*N*/ return USHRT_MAX;
+/*N*/ }
+
+/*N*/ SwNumRule* SwDoc::FindNumRulePtr( const String& rName ) const
+/*N*/ {
+/*N*/ for( USHORT n = pNumRuleTbl->Count(); n; )
+/*N*/ if( (*pNumRuleTbl)[ --n ]->GetName() == rName )
+/*N*/ return (*pNumRuleTbl)[ n ];
+/*N*/
+/*
+//JP 20.11.97: sollte man im Find neue Rule anlegen??
+ erstmal nicht
+ USHORT nPoolId = GetPoolId( rName, GET_POOLID_NUMRULE );
+ if( USHRT_MAX != nPoolId )
+ {
+ SwDoc* pThis = (SwDoc*)this;
+ return pThis->GetNumRuleFromPool( nPoolId );
+ }
+*/
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ USHORT SwDoc::MakeNumRule( const String &rName, const SwNumRule* pCpy )
+/*N*/ {
+/*N*/ SwNumRule* pNew;
+/*N*/ if( pCpy )
+/*N*/ {
+/*N*/ pNew = new SwNumRule( *pCpy );
+/*N*/ pNew->SetName( GetUniqueNumRuleName( &rName ));
+/*N*/ if( pNew->GetName() != rName )
+/*N*/ {
+/*?*/ pNew->SetPoolFmtId( USHRT_MAX );
+/*?*/ pNew->SetPoolHelpId( USHRT_MAX );
+/*?*/ pNew->SetPoolHlpFileId( UCHAR_MAX );
+/*N*/ }
+/*N*/ pNew->CheckCharFmts( this );
+/*N*/ }
+/*N*/ else
+/*N*/ pNew = new SwNumRule( GetUniqueNumRuleName( &rName ) );
+/*N*/ USHORT nRet = pNumRuleTbl->Count();
+/*N*/ pNumRuleTbl->Insert( pNew, nRet );
+/*N*/ return nRet;
+/*N*/ }
+/*N*/
+/*N*/ String SwDoc::GetUniqueNumRuleName( const String* pChkStr, BOOL bAutoNum ) const
+/*N*/ {
+/*N*/ String aName;
+/*N*/ if( bAutoNum )
+/*N*/ {
+/*N*/ long n = Time().GetTime();
+/*N*/ n += Date().GetDate();
+/*N*/ aName = String::CreateFromInt32( n );
+/*N*/ if( pChkStr && !pChkStr->Len() )
+/*N*/ pChkStr = 0;
+/*N*/ }
+/*N*/ else if( pChkStr && pChkStr->Len() )
+/*N*/ aName = *pChkStr;
+/*N*/ else
+/*N*/ {
+/*?*/ pChkStr = 0;
+/*?*/ aName = SW_RESSTR( STR_NUMRULE_DEFNAME );
+/*N*/ }
+/*N*/
+/*N*/ USHORT nNum, nTmp, nFlagSize = ( pNumRuleTbl->Count() / 8 ) +2;
+/*N*/ BYTE* pSetFlags = new BYTE[ nFlagSize ];
+/*N*/ memset( pSetFlags, 0, nFlagSize );
+/*N*/
+/*N*/ xub_StrLen nNmLen = aName.Len();
+/*N*/ if( !bAutoNum && pChkStr )
+/*N*/ {
+/*?*/ while( nNmLen-- && '0' <= aName.GetChar( nNmLen ) &&
+/*?*/ '9' >= aName.GetChar( nNmLen ) )
+/*?*/ ; //nop
+/*?*/
+/*?*/ if( ++nNmLen < aName.Len() )
+/*?*/ {
+/*?*/ aName.Erase( nNmLen );
+/*?*/ pChkStr = 0;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SwNumRule* pNumRule;
+ USHORT n=0;
+/*N*/ for( n = 0; n < pNumRuleTbl->Count(); ++n )
+/*N*/ if( 0 != ( pNumRule = (*pNumRuleTbl)[ n ] ) )
+/*N*/ {
+/*N*/ const String& rNm = pNumRule->GetName();
+/*N*/ if( rNm.Match( aName ) == nNmLen )
+/*N*/ {
+/*N*/ // Nummer bestimmen und das Flag setzen
+/*N*/ nNum = rNm.Copy( nNmLen ).ToInt32();
+/*N*/ if( nNum-- && nNum < pNumRuleTbl->Count() )
+/*N*/ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+/*N*/ }
+/*N*/ if( pChkStr && pChkStr->Equals( rNm ) )
+/*N*/ pChkStr = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( !pChkStr )
+/*N*/ {
+/*N*/ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+/*N*/ nNum = pNumRuleTbl->Count();
+/*N*/ for( n = 0; n < nFlagSize; ++n )
+/*N*/ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+/*N*/ {
+/*N*/ // also die Nummer bestimmen
+/*N*/ nNum = n * 8;
+/*N*/ while( nTmp & 1 )
+/*N*/ ++nNum, nTmp >>= 1;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ delete [] pSetFlags;
+/*N*/ if( pChkStr && pChkStr->Len() )
+/*N*/ return *pChkStr;
+/*N*/ return aName += String::CreateFromInt32( ++nNum );
+/*N*/ }
+
+/*N*/ const SwNode* lcl_FindBaseNode( const SwNode& rNd )
+/*N*/ {
+/*N*/ const SwNodes& rNds = rNd.GetNodes();
+/*N*/ ULONG nNdIdx = rNd.GetIndex();
+/*N*/ if( nNdIdx > rNds.GetEndOfExtras().GetIndex() )
+/*N*/ return rNds.GetEndOfContent().FindStartNode();
+/*N*/
+/*N*/ const SwNode* pSttNd = rNds[ ULONG(0) ]->FindStartNode();
+/*N*/ const SwNode* pNd = rNd.FindStartNode();
+/*N*/ while( pSttNd != pNd->FindStartNode()->FindStartNode() )
+/*?*/ pNd = pNd->FindStartNode();
+/*N*/ return pNd;
+/*N*/ }
+
+
+/*N*/ void SwDoc::UpdateNumRule()
+/*N*/ {
+/*N*/ SwNumRuleTbl& rNmTbl = GetNumRuleTbl();
+/*N*/ for( USHORT n = 0; n < rNmTbl.Count(); ++n )
+/*N*/ if( rNmTbl[ n ]->IsInvalidRule() )
+/*N*/ UpdateNumRule( rNmTbl[ n ]->GetName(), ULONG_MAX );
+/*N*/ }
+/*N*/
+/*N*/ void SwDoc::UpdateNumRule( const String& rName, ULONG nUpdPos )
+/*N*/ {
+/*N*/ SwNumRuleInfo aUpd( rName );
+/*N*/ aUpd.MakeList( *this );
+/*N*/
+/*N*/ if( ULONG_MAX == nUpdPos )
+/*N*/ nUpdPos = 0;
+/*N*/ else
+/*N*/ aUpd.GetList().SearchKey( nUpdPos, &nUpdPos );
+/*N*/
+/*N*/ SwNumRule* pRule = FindNumRulePtr( rName );
+/*N*/ if( nUpdPos < aUpd.GetList().Count() )
+/*N*/ {
+/*N*/ USHORT nInitLevels = USHRT_MAX; // Bitfeld fuer die Levels!
+/*N*/ // TRUE: starte mit NumFmt Start
+/*N*/ USHORT nNumVal = 0;
+/*N*/ SwNodeNum aNum( 0 );
+/*N*/
+/*N*/ if( pRule->IsContinusNum() )
+/*?*/ nNumVal = pRule->Get( 0 ).GetStart();
+/*N*/
+/*N*/ SwTxtNode* pStt = aUpd.GetList().GetObject( nUpdPos );
+/*N*/ SwTxtNode* pPrev = nUpdPos ? aUpd.GetList().GetObject( nUpdPos-1 ) : 0;
+/*N*/ const SwNode* pBaseNd = lcl_FindBaseNode( *pStt );
+/*N*/ if( pPrev && lcl_FindBaseNode( *pPrev ) == pBaseNd )
+/*N*/ {
+/*N*/ if( pPrev->GetNum() )
+/*N*/ {
+/*N*/ const SwNodeNum* pPrevNdNum = pPrev->GetNum();
+/*N*/ if( pPrevNdNum->GetLevel() & NO_NUMLEVEL )
+/*N*/ {
+/*N*/ // OD 10.12.2002 #106111# - use correct search level
+/*N*/ BYTE nSrchLvl = GetRealLevel( pStt->GetNum()->GetLevel() );
+/*N*/ pPrevNdNum = 0;
+/*N*/ ULONG nArrPos = nUpdPos-1;
+/*N*/ while( nArrPos-- )
+/*N*/ {
+/*N*/ pPrev = aUpd.GetList().GetObject( nArrPos );
+/*N*/ if( lcl_FindBaseNode( *pPrev ) != pBaseNd )
+/*N*/ break;
+/*N*/
+/*N*/ if( 0 != ( pPrevNdNum = pPrev->GetNum() ))
+/*N*/ {
+/*N*/ // uebergeordnete Ebene
+/*N*/ if( nSrchLvl > (pPrevNdNum->GetLevel() &~ NO_NUMLEVEL))
+/*N*/ {
+/*N*/ pPrevNdNum = 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ // gleiche Ebene und kein NO_NUMLEVEL
+/*N*/ if( nSrchLvl == (pPrevNdNum->GetLevel() &~ NO_NUMLEVEL)
+/*N*/ && !( pPrevNdNum->GetLevel() & NO_NUMLEVEL ))
+/*N*/ break;
+/*N*/
+/*N*/ pPrevNdNum = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pPrevNdNum )
+/*N*/ {
+/*N*/ aNum = *pPrevNdNum;
+/*N*/ aNum.SetStart( FALSE );
+/*N*/ aNum.SetSetValue( USHRT_MAX );
+/*N*/ }
+/*N*/ }
+/*N*/ nInitLevels = 0;
+/*N*/ // OD 10.12.2002 #106111# - sublevels have to be restarted.
+/*N*/ for ( int nSubLvl = GetRealLevel( aNum.GetLevel() ) + 1; nSubLvl < MAXLEVEL; ++nSubLvl)
+/*N*/ nInitLevels |= ( 1 << nSubLvl );
+/*N*/ nNumVal = aNum.GetLevelVal()[ GetRealLevel( aNum.GetLevel() ) ];
+/*N*/ }
+/*N*/
+/*N*/ const SwNode* pOutlNd = 0;
+/*N*/ for( ; nUpdPos < aUpd.GetList().Count(); ++nUpdPos )
+/*N*/ {
+/*N*/ pStt = aUpd.GetList().GetObject( nUpdPos );
+/*N*/
+/*N*/ const SwNode* pTmpBaseNd = lcl_FindBaseNode( *pStt );
+/*N*/ if( pTmpBaseNd != pBaseNd )
+/*N*/ {
+/*?*/ aNum.SetLevel( 0 );
+/*?*/ memset( aNum.GetLevelVal(), 0,
+/*?*/ (MAXLEVEL) * sizeof( aNum.GetLevelVal()[0]) );
+/*?*/ pBaseNd = pTmpBaseNd;
+/*N*/ }
+/*N*/
+/*N*/ BYTE nLevel = aNum.GetLevel();
+/*N*/ BYTE nNdOldLvl = MAXLEVEL;
+/*N*/ if( pStt->GetNum() )
+/*N*/ {
+/*N*/ if( NO_NUMBERING != pStt->GetNum()->GetLevel() )
+/*N*/ nNdOldLvl = nLevel = pStt->GetNum()->GetLevel();
+/*N*/ if( pStt->GetNum()->IsStart() )
+/*N*/ {
+/*?*/ aNum.SetStart( TRUE );
+/*?*/ // OD 10.12.2002 #106111# - correct reset of level numbers
+/*?*/ for ( int nSubLvl = nLevel; nSubLvl < MAXLEVEL; ++nSubLvl)
+/*?*/ aNum.GetLevelVal()[ nSubLvl ] = 0;
+/*?*/ if( pRule->IsContinusNum() )
+/*?*/ {
+/*?*/ nNumVal = pRule->Get( 0 ).GetStart();
+/*?*/ nInitLevels |= 1;
+/*?*/ }
+/*?*/ else
+/*?*/ nInitLevels |= ( 1 << GetRealLevel( nLevel ));
+/*N*/ }
+/*N*/ else if( USHRT_MAX != pStt->GetNum()->GetSetValue() )
+/*N*/ {
+/*N*/ aNum.SetSetValue( nNumVal = pStt->GetNum()->GetSetValue() );
+/*N*/ // OD 10.12.2002 #106111# - init <nInitLevels> for continues
+/*N*/ // numbering.
+/*N*/ if( pRule->IsContinusNum() )
+/*N*/ nInitLevels |= 1;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( NO_NUMLEVEL & nLevel ) // NoNum mit Ebene
+/*N*/ {
+/*N*/ BYTE nPrevLvl = GetRealLevel( aNum.GetLevel() ),
+/*N*/ nCurrLvl = GetRealLevel( nLevel );
+/*N*/
+/*N*/ if( nPrevLvl < nCurrLvl )
+/*N*/ {
+/*N*/ if( !(nInitLevels & ( 1 << nPrevLvl )) )
+/*N*/ ++nPrevLvl;
+/*N*/ for( ; nPrevLvl < nCurrLvl; ++nPrevLvl )
+/*?*/ nInitLevels |= ( 1 << nPrevLvl );
+/*N*/ }
+/*N*/
+/*N*/ aNum.SetLevel( nLevel );
+/*N*/ pStt->UpdateNum( aNum );
+/*N*/ }
+/*N*/ else if( NO_NUM != nLevel )
+/*N*/ {
+/*N*/ // beim Format mit Bitmap die Graphicen schon mal anfordern
+/*N*/ const SwNumFmt* pNumFmt = pRule->GetNumFmt( GetRealLevel( nLevel ));
+/*N*/ if( pNumFmt && SVX_NUM_BITMAP == pNumFmt->GetNumberingType() )
+/*?*/ pNumFmt->GetGraphic();
+/*N*/
+/*N*/ if( pRule->IsContinusNum() )
+/*N*/ {
+/*N*/ if( !(nInitLevels & 1) &&
+/*N*/ !( pNumFmt && (SVX_NUM_CHAR_SPECIAL == pNumFmt->GetNumberingType() ||
+/*N*/ SVX_NUM_BITMAP == pNumFmt->GetNumberingType() ||
+/*N*/ SVX_NUM_NUMBER_NONE == pNumFmt->GetNumberingType() )))
+/*?*/ ++nNumVal;
+/*?*/ aNum.GetLevelVal()[ nLevel ] = nNumVal;
+/*?*/ // OD 10.12.2002 #106111# - reset <nInitLevels>
+/*?*/ nInitLevels &= ~1;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BYTE nPrevLvl = GetRealLevel( aNum.GetLevel() );
+/*N*/ if( nPrevLvl < nLevel )
+/*N*/ {
+/*N*/ // Erfrage wie geloescht werden soll:
+/*N*/ // z.B von Stufe 0 -> 1: 1 -> 0.1 ; wenn nStart = 1
+/*N*/ // aber Stufe 1 -> 2: 1.1 -> 1.1.1 !!, nur 0.1 -> 0.0.1
+/*N*/ if( !(nInitLevels & ( 1 << nPrevLvl )) )
+/*N*/ ++nPrevLvl;
+/*N*/
+/*N*/ for( int ii = nPrevLvl; ii < nLevel; ++ii )
+/*N*/ {
+/*N*/ nInitLevels &= ~( 1 << ii );
+/*N*/ aNum.GetLevelVal()[ ii ] =
+/*N*/ pRule->Get( ii ).GetStart();
+/*N*/ }
+/*N*/ aNum.GetLevelVal()[ nLevel ] =
+/*N*/ USHRT_MAX == aNum.GetSetValue()
+/*N*/ ? pRule->Get( nLevel ).GetStart()
+/*N*/ : aNum.GetSetValue();
+/*N*/ }
+/*N*/ else if( USHRT_MAX != aNum.GetSetValue() )
+/*N*/ aNum.GetLevelVal()[ nLevel ] = aNum.GetSetValue();
+/*N*/ else if( nInitLevels & ( 1 << nLevel ))
+/*N*/ aNum.GetLevelVal()[ nLevel ] =
+/*N*/ pRule->Get( nLevel ).GetStart();
+/*N*/ else
+/*N*/ aNum.GetLevelVal()[ nLevel ]++;
+/*N*/ }
+/*N*/ nInitLevels &= ~( 1 << nLevel );
+/*N*/ aNum.SetLevel( nLevel );
+/*N*/
+/*N*/ // OD 10.12.2002 #106111# - reset numbers of all sublevels and
+/*N*/ // note in <nInitLevels> that numbering of all sublevels have
+/*N*/ // to be restarted.
+/*N*/ for ( int nSubLvl = nLevel+1; nSubLvl < MAXLEVEL; ++nSubLvl)
+/*N*/ {
+/*N*/ aNum.GetLevelVal()[ nSubLvl ] = 0;
+/*N*/ nInitLevels |= ( 1 << nSubLvl );
+/*N*/ }
+/*N*/
+/*N*/ pStt->UpdateNum( aNum );
+/*N*/ }
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ BOOL bCheck = TRUE;
+/*N*/ if( RES_CONDTXTFMTCOLL == pStt->GetFmtColl()->Which() )
+/*N*/ {
+/*N*/ // SwFmtColl* pChgColl = pStt->GetCondFmtColl();
+/*N*/ pStt->ChkCondColl();
+/*
+//JP 19.11.97:
+// setzen der bedingten Vorlage aendert nichts an den Einzuegen, die bleiben
+// als harte vorhanden
+ if( pStt->GetCondFmtColl() )
+ {
+ // es gab eine Aenderung -> harte Einzuege entfernen
+ if( pChgColl != pStt->GetCondFmtColl() )
+ pStt->ResetAttr( RES_LR_SPACE );
+ bCheck = FALSE;
+ }
+*/
+ }
+/*N*/ else if( !pOutlNd && NO_NUMBERING !=
+/*N*/ ((SwTxtFmtColl*)pStt->GetFmtColl())->GetOutlineLevel() )
+/*N*/ pOutlNd = pStt;
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ #ifndef NUM_RELSPACE
+/*N*/ // hat sich eine Level - Aenderung ergeben, so setze jetzt die
+/*N*/ // gueltigen Einzuege
+/*N*/ if( bCheck && ( nLevel != nNdOldLvl || pStt->IsSetNumLSpace())
+/*N*/ && GetRealLevel( nLevel ) < MAXLEVEL )
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR( ((SvxLRSpaceItem&)pStt->SwCntntNode::GetAttr(
+/*N*/ RES_LR_SPACE )) );
+/*N*/
+/*N*/ const SwNumFmt& rNFmt = pRule->Get( GetRealLevel( nLevel ));
+/*N*/
+/*N*/ // ohne Nummer immer ohne FirstLineOffset!!!!
+/*N*/ short nFOfst = rNFmt.GetFirstLineOffset();
+/*N*/ if( nLevel & NO_NUMLEVEL ) nFOfst = 0;
+/*N*/ aLR.SetTxtFirstLineOfstValue( nFOfst );
+/*N*/ aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
+/*N*/
+/*N*/ pStt->SwCntntNode::SetAttr( aLR );
+/*N*/ }
+/*N*/ // Flag immer loeschen!
+/*N*/ pStt->SetNumLSpace( FALSE );
+/*N*/ #endif
+/*N*/ aNum.SetStart( FALSE );
+/*N*/ aNum.SetSetValue( USHRT_MAX );
+/*N*/ }
+/*N*/ if( pOutlNd )
+/*?*/ GetNodes().UpdtOutlineIdx( *pOutlNd );
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( pRule, "die NumRule sollte schon vorhanden sein!" );
+/*N*/ if( pRule )
+/*N*/ pRule->SetInvalidRule( FALSE );
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docredln.cxx b/binfilter/bf_sw/source/core/doc/sw_docredln.cxx
new file mode 100644
index 000000000000..87164523c548
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docredln.cxx
@@ -0,0 +1,591 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <tools/shl.hxx>
+#include <swmodule.hxx>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <pamtyp.hxx>
+#include <viewsh.hxx>
+#include <rootfrm.hxx>
+namespace binfilter {
+
+#ifndef DBG_UTIL
+
+ #define _CHECK_REDLINE( pDoc )
+
+#else
+
+ // helper function for lcl_CheckRedline
+ // make sure that pPos->nContent points into pPos->nNode
+ // (or into the 'special' no-content-node-IndexReg)
+
+
+ // check validity of the redline table. Checks redline bounds, and make
+ // sure the redlines are sorted and non-overlapping.
+/*N*/ void lcl_CheckRedline( const SwDoc* pDoc )
+/*N*/ {
+/*N*/ const SwRedlineTbl& rTbl = pDoc->GetRedlineTbl();
+/*N*/
+/*N*/ // verify valid redline positions
+/*N*/ for( USHORT i = 0; i < rTbl.Count(); ++i )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 lcl_CheckPam( rTbl[ i ] );
+/*N*/
+/*N*/ for( USHORT j = 0; j < rTbl.Count(); ++j )
+/*N*/ {
+/*N*/ // check for empty redlines
+/*N*/ ASSERT( ( *(rTbl[j]->GetPoint()) != *(rTbl[j]->GetMark()) ) ||
+/*N*/ ( rTbl[j]->GetContentIdx() != NULL ),
+/*N*/ "redline table corrupted: empty redline" );
+/*N*/ }
+/*N*/
+/*N*/ // verify proper redline sorting
+/*N*/ for( USHORT n = 1; n < rTbl.Count(); ++n )
+/*N*/ {
+/*?*/ const SwRedline* pPrev = rTbl[ n-1 ];
+/*?*/ const SwRedline* pCurrent = rTbl[ n ];
+/*?*/
+/*?*/ // check redline sorting
+/*?*/ ASSERT( *pPrev->Start() <= *pCurrent->Start(),
+/*?*/ "redline table corrupted: not sorted correctly" );
+/*?*/
+/*?*/ // check for overlapping redlines
+/*?*/ ASSERT( *pPrev->End() <= *pCurrent->Start(),
+/*?*/ "redline table corrupted: overlapping redlines" );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ #define _CHECK_REDLINE( pDoc ) lcl_CheckRedline( pDoc );
+/*N*/
+/*N*/ #endif
+
+/*N*/ SV_IMPL_OP_PTRARR_SORT( _SwRedlineTbl, SwRedlinePtr )
+
+/*N*/ void SwDoc::SetRedlineMode( USHORT eMode )
+/*N*/ {
+/*N*/ if( eRedlineMode != eMode )
+/*N*/ {
+/*N*/ if( (REDLINE_SHOW_MASK & eRedlineMode) != (REDLINE_SHOW_MASK & eMode)
+/*N*/ || 0 == (REDLINE_SHOW_MASK & eMode) )
+/*N*/ {
+/*N*/ // und dann alles verstecken, anzeigen
+/*N*/ void (SwRedline::*pFnc)( USHORT ) = 0;
+/*N*/
+/*N*/ switch( REDLINE_SHOW_MASK & eMode )
+/*N*/ {
+/*N*/ case REDLINE_SHOW_INSERT | REDLINE_SHOW_DELETE:
+/*N*/ pFnc = &SwRedline::Show;
+/*N*/ break;
+/*N*/ case REDLINE_SHOW_INSERT:
+/*N*/ pFnc = &SwRedline::Hide;
+/*N*/ break;
+/*N*/ case REDLINE_SHOW_DELETE:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pFnc = &SwRedline::ShowOriginal;
+/*?*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ pFnc = &SwRedline::Hide;
+/*N*/ eMode |= REDLINE_SHOW_INSERT;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ _CHECK_REDLINE( this )
+/*N*/
+/*N*/ if( pFnc )
+/*N*/ for( USHORT nLoop = 1; nLoop <= 2; ++nLoop )
+/*N*/ for( USHORT i = 0; i < pRedlineTbl->Count(); ++i )
+/*N*/ ((*pRedlineTbl)[ i ]->*pFnc)( nLoop );
+/*N*/ _CHECK_REDLINE( this )
+/*N*/ }
+/*N*/ eRedlineMode = (SwRedlineMode)eMode;
+/*N*/ }
+/*N*/ }
+
+
+/*
+
+Text heisst, nicht von Redline "verseuchter" Text.
+
+Verhalten von Insert-Redline:
+ - im Text - Redline Object einfuegen
+ - im InsertRedline (eigenes) - ignorieren, bestehendes wird
+ aufgespannt
+ - im InsertRedline (andere) - Insert Redline aufsplitten
+ Redline Object einfuegen
+ - in DeleteRedline - Delete Redline aufsplitten oder
+ am Ende/Anfang verschieben
+
+Verhalten von Delete-Redline:
+ - im Text - Redline Object einfuegen
+ - im DeleteRedline (eigenes/andere) - ignorieren
+ - im InsertRedline (eigenes) - ignorieren, Zeichen aber loeschen
+ - im InsertRedline (andere) - Insert Redline aufsplitten
+ Redline Object einfuegen
+ - Ueberlappung von Text und - Text in eigenen Insert loeschen,
+ eigenem Insert im andereren Text aufspannen (bis
+ zum Insert!
+ - Ueberlappung von Text und - Redline Object einfuegen, der
+ anderem Insert andere Insert wird vom Delete
+ ueberlappt
+*/
+
+/*N*/ BOOL SwDoc::AppendRedline( SwRedline* pNewRedl, BOOL bCallDelete )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 //STRIP001 _CHECK_REDLINE( this )
+/*N*/ }
+
+
+
+
+/*N*/ BOOL SwDoc::DeleteRedline( const SwPaM& rRange, BOOL bSaveInUndo,
+/*N*/ USHORT nDelType )
+/*N*/ {
+/*N*/ if( REDLINE_IGNOREDELETE_REDLINES & eRedlineMode ||
+/*N*/ !rRange.HasMark() || *rRange.GetMark() == *rRange.GetPoint() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ BOOL bChg = FALSE;
+/*N*/
+/*N*/ const SwPosition* pStt = rRange.Start(),
+/*N*/ * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark()
+/*N*/ : rRange.GetPoint();
+/*N*/ USHORT n = 0;
+/*N*/ GetRedline( *pStt, &n );
+/*N*/ for( ; n < pRedlineTbl->Count() ; ++n )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwRedline* pRedl = (*pRedlineTbl)[ n ];
+/*N*/ }
+/*N*/
+/*N*/ if( bChg )
+/*N*/ SetModified();
+/*N*/
+/*N*/ return bChg;
+/*N*/ }
+
+/*N*/ BOOL SwDoc::DeleteRedline( const SwStartNode& rNode, BOOL bSaveInUndo,
+/*N*/ USHORT nDelType )
+/*N*/ {
+/*N*/ SwPaM aTemp( *rNode.EndOfSectionNode(), rNode );
+/*N*/ return DeleteRedline( aTemp, bSaveInUndo, nDelType );
+/*N*/ }
+
+
+/*N*/ USHORT SwDoc::GetRedlinePos( const SwNode& rNd, USHORT nType ) const
+/*N*/ {
+/*N*/ const ULONG nNdIdx = rNd.GetIndex();
+/*N*/ for( USHORT n = 0; n < pRedlineTbl->Count() ; ++n )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwRedline* pTmp = (*pRedlineTbl)[ n ];
+/*N*/ }
+/*N*/ return USHRT_MAX;
+/*N*/ }
+
+/*N*/ const SwRedline* SwDoc::GetRedline( const SwPosition& rPos,
+/*N*/ USHORT* pFndPos ) const
+/*N*/ {
+/*N*/ register USHORT nO = pRedlineTbl->Count(), nM, nU = 0;
+/*N*/ if( nO > 0 )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 nO--;
+/*N*/ }
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nU;
+/*N*/ return 0;
+/*N*/ }
+
+typedef BOOL (*Fn_AcceptReject)( SwRedlineTbl& rArr, USHORT& rPos,
+ BOOL bCallDelete,
+ const SwPosition* pSttRng,
+ const SwPosition* pEndRng);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// Kommentar am Redline setzen
+
+// legt gebenenfalls einen neuen Author an
+/*N*/ USHORT SwDoc::GetRedlineAuthor()
+/*N*/ {
+/*N*/ return SW_MOD()->GetRedlineAuthor(); //SW50.SDW
+/*N*/ }
+
+ // fuer die Reader usw. - neuen Author in die Tabelle eintragen
+/*N*/ USHORT SwDoc::InsertRedlineAuthor( const String& rNew )
+/*N*/ {
+/*N*/ return SW_MOD()->InsertRedlineAuthor(rNew); //SW50.SDW
+/*N*/ }
+
+
+ // setze Kommentar-Text fuers Redline, das dann per AppendRedline
+ // hereinkommt. Wird vom Autoformat benutzt. 0-Pointer setzt den Modus
+ // wieder zurueck. Pointer wird nicht kopiert, muss also gueltig bleiben!
+
+/*N*/ void SwDoc::SetRedlinePasswd(
+/*N*/ const ::com::sun::star::uno::Sequence <sal_Int8>& rNew )
+/*N*/ {
+/*N*/ aRedlinePasswd = rNew;
+/*N*/ SetModified();
+/*N*/ }
+
+/* */
+
+/*N*/ BOOL SwRedlineTbl::Insert( SwRedlinePtr& p, BOOL bIns ) //SW50.SDW
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if( p->HasValidRange() )
+/*N*/ {
+/*N*/ bRet = _SwRedlineTbl::Insert( p );
+/*N*/ }
+/*N*/ else if( bIns )
+/*N*/ bRet = InsertWithValidRanges( p );
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( !this, "Redline: falscher Bereich" );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ BOOL SwRedlineTbl::InsertWithValidRanges( SwRedlinePtr& p, USHORT* pInsPos ) //SW50.SDW
+/*N*/ {
+/*N*/ // erzeuge aus den Selektion gueltige "Teilbereiche".
+/*N*/ BOOL bAnyIns = FALSE;
+/*N*/ SwPosition* pStt = p->Start(),
+/*N*/ * pEnd = pStt == p->GetPoint() ? p->GetMark() : p->GetPoint();
+/*N*/ SwPosition aNewStt( *pStt );
+/*N*/ SwNodes& rNds = aNewStt.nNode.GetNodes();
+/*N*/ SwCntntNode* pC;
+/*N*/
+/*N*/ if( !aNewStt.nNode.GetNode().IsCntntNode() )
+/*N*/ {
+/*N*/ pC = rNds.GoNext( &aNewStt.nNode );
+/*N*/ if( pC )
+/*N*/ aNewStt.nContent.Assign( pC, 0 );
+/*N*/ else
+/*N*/ aNewStt.nNode = rNds.GetEndOfContent();
+/*N*/ }
+/*N*/
+/*N*/ SwRedline* pNew = 0;
+/*N*/ USHORT nInsPos;
+/*N*/
+/*N*/ if( aNewStt < *pEnd )
+/*N*/ do {
+/*N*/ if( !pNew )
+/*N*/ pNew = new SwRedline( p->GetRedlineData(), aNewStt );
+/*N*/ else
+/*N*/ {
+/*N*/ pNew->DeleteMark();
+/*N*/ *pNew->GetPoint() = aNewStt;
+/*N*/ }
+/*N*/
+/*N*/ pNew->SetMark();
+/*N*/ GoEndSection( pNew->GetPoint() );
+/*N*/ if( *pNew->GetPoint() > *pEnd )
+/*N*/ {
+/*N*/ BOOL bWeiter = TRUE;
+/*N*/ pC = 0;
+/*N*/ if( aNewStt.nNode != pEnd->nNode )
+/*N*/ do {
+/*N*/ SwNode& rCurNd = aNewStt.nNode.GetNode();
+/*N*/ if( rCurNd.IsStartNode() )
+/*N*/ {
+/*N*/ if( rCurNd.EndOfSectionIndex() < pEnd->nNode.GetIndex() )
+/*N*/ aNewStt.nNode = *rCurNd.EndOfSectionNode();
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ else if( rCurNd.IsCntntNode() )
+/*N*/ pC = rCurNd.GetCntntNode();
+/*N*/ aNewStt.nNode++;
+/*N*/ } while( aNewStt.nNode.GetIndex() < pEnd->nNode.GetIndex() );
+/*N*/
+/*N*/ if( aNewStt.nNode == pEnd->nNode )
+/*N*/ aNewStt.nContent = pEnd->nContent;
+/*N*/ else if( pC )
+/*N*/ {
+/*N*/ aNewStt.nNode = *pC;
+/*N*/ aNewStt.nContent.Assign( pC, pC->Len() );
+/*N*/ }
+/*N*/
+/*N*/ if( aNewStt <= *pEnd )
+/*N*/ *pNew->GetPoint() = aNewStt;
+/*N*/ }
+/*N*/ else
+/*N*/ aNewStt = *pNew->GetPoint();
+/*N*/
+/*N*/ if( *pNew->GetPoint() != *pNew->GetMark() &&
+/*N*/ _SwRedlineTbl::Insert( pNew, nInsPos ) )
+/*N*/ {
+/*N*/ bAnyIns = TRUE;
+/*N*/ pNew = 0;
+/*N*/ if( pInsPos && *pInsPos < nInsPos )
+/*N*/ *pInsPos = nInsPos;
+/*N*/ }
+/*N*/
+/*N*/ if( aNewStt >= *pEnd ||
+/*N*/ 0 == (pC = rNds.GoNext( &aNewStt.nNode )) )
+/*N*/ break;
+/*N*/
+/*N*/ aNewStt.nContent.Assign( pC, 0 );
+/*N*/
+/*N*/ } while( aNewStt < *pEnd );
+/*N*/
+/*N*/ delete pNew;
+/*N*/ delete p, p = 0;
+/*N*/ return bAnyIns;
+/*N*/ }
+
+/*N*/ void SwRedlineTbl::Remove( USHORT nP, USHORT nL ) //SW50.SDW
+/*N*/ {
+/*N*/ SwDoc* pDoc = 0;
+/*N*/ if( !nP && nL && nL == _SwRedlineTbl::Count() )
+/*N*/ pDoc = _SwRedlineTbl::GetObject( 0 )->GetDoc();
+/*N*/
+/*N*/ _SwRedlineTbl::Remove( nP, nL );
+/*N*/
+/*N*/ ViewShell* pSh;
+/*N*/ if( pDoc && !pDoc->IsInDtor() && pDoc->GetRootFrm() &&
+/*N*/ 0 != ( pSh = pDoc->GetRootFrm()->GetCurrShell()) )
+/*N*/ pSh->InvalidateWindows( SwRect( 0, 0, LONG_MAX, LONG_MAX ) );
+/*N*/ }
+
+
+// suche den naechsten oder vorherigen Redline mit dergleichen Seq.No
+// Mit dem Lookahead kann die Suche eingeschraenkt werden. 0 oder
+// USHRT_MAX suchen im gesamten Array.
+
+
+
+
+/* */
+
+/*?*/SwRedlineExtraData::~SwRedlineExtraData()
+/*?*/{
+/*?*/}
+
+
+
+/*?*/int SwRedlineExtraData::operator == ( const SwRedlineExtraData& ) const
+/*?*/{
+/*?*/ return FALSE;
+/*?*/}
+
+/* */
+
+/*?*/SwRedlineData::SwRedlineData( const SwRedlineData& rCpy, BOOL bCpyNext )
+/*?*/ : nAuthor( rCpy.nAuthor ), eType( rCpy.eType ), aStamp( rCpy.aStamp ),
+/*?*/ sComment( rCpy.sComment ), nSeqNo( rCpy.nSeqNo ),
+/*?*/ pExtraData( rCpy.pExtraData ? rCpy.pExtraData->CreateNew() : 0 ),
+/*?*/ pNext( (bCpyNext && rCpy.pNext) ? new SwRedlineData( *rCpy.pNext ) : 0 )
+/*?*/{
+/*?*/}
+
+ // fuer sw3io: pNext geht in eigenen Besitz ueber!
+/*?*/SwRedlineData::SwRedlineData( SwRedlineType eT, USHORT nAut, const DateTime& rDT,
+/*?*/ const String& rCmnt, SwRedlineData *pNxt,
+/*?*/ SwRedlineExtraData* pData )
+/*?*/ : eType( eT ), pNext( pNxt ), nAuthor( nAut ), aStamp( rDT ),
+/*?*/ sComment( rCmnt ), pExtraData( pData ), nSeqNo( 0 )
+/*?*/{
+/*?*/}
+
+/*?*/SwRedlineData::~SwRedlineData()
+/*?*/{
+/*?*/ delete pExtraData;
+/*?*/ delete pNext;
+/*?*/}
+
+/* */
+
+/*?*/SwRedline::SwRedline( const SwRedlineData& rData, const SwPosition& rPos )
+/*?*/ : SwPaM( rPos ),
+/*?*/ pCntntSect( 0 ),
+/*?*/ pRedlineData( new SwRedlineData( rData ))
+/*?*/{
+/*?*/ bDelLastPara = bIsLastParaDelete = FALSE;
+/*?*/ bIsVisible = TRUE;
+/*?*/}
+
+/*?*/SwRedline::SwRedline( const SwRedline& rCpy )
+/*?*/ : SwPaM( *rCpy.GetMark(), *rCpy.GetPoint() ),
+/*?*/ pCntntSect( 0 ),
+/*?*/ pRedlineData( new SwRedlineData( *rCpy.pRedlineData ))
+/*?*/{
+/*?*/ bDelLastPara = bIsLastParaDelete = FALSE;
+/*?*/ bIsVisible = TRUE;
+/*?*/ if( !rCpy.HasMark() )
+/*?*/ DeleteMark();
+/*?*/}
+
+/*?*/SwRedline::~SwRedline()
+/*?*/{
+/*?*/ if( pCntntSect )
+/*?*/ {
+/*?*/ // dann den Content Bereich loeschen
+/*?*/ if( !GetDoc()->IsInDtor() )
+/*?*/ GetDoc()->DeleteSection( &pCntntSect->GetNode() );
+/*?*/ delete pCntntSect;
+/*?*/ }
+/*?*/ delete pRedlineData;
+/*?*/}
+
+// liegt eine gueltige Selektion vor?
+/*N*/ BOOL SwRedline::HasValidRange() const //SW50.SDW
+/*N*/ {
+/*N*/ const SwNode* pPtNd = &GetPoint()->nNode.GetNode(),
+/*N*/ * pMkNd = &GetMark()->nNode.GetNode();
+/*N*/ if( pPtNd->FindStartNode() == pMkNd->FindStartNode() &&
+/*N*/ !pPtNd->FindStartNode()->IsTableNode() &&
+/*N*/ // JP 18.5.2001: Bug 87222 - invalid if points on the end of content
+/*N*/ // DVO 25.03.2002: #96530# end-of-content only invalid if no content
+/*N*/ // index exists
+/*N*/ ( pPtNd != pMkNd || GetContentIdx() != NULL ||
+/*N*/ pPtNd != &pPtNd->GetNodes().GetEndOfContent() )
+/*N*/ )
+/*N*/ return TRUE;
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ void SwRedline::Show( USHORT nLoop )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*N*/ void SwRedline::Hide( USHORT nLoop )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+
+
+
+/*************************************************************************
+ * SwRedline::CalcStartEnd()
+ * Calculates the start and end position of the intersection rTmp and
+ * text node nNdIdx
+ *************************************************************************/
+
+
+
+
+
+
+
+// fuers Undo
+/*N*/ void SwRedline::SetContentIdx( const SwNodeIndex* pIdx )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 if( pIdx && !pCntntSect )
+/*N*/ }
+
+
+
+
+USHORT SwRedline::GetStackCount() const
+{
+ USHORT nRet = 1;
+ for( SwRedlineData* pCur = pRedlineData; pCur->pNext; ++nRet )
+ pCur = pCur->pNext;
+ return nRet;
+}
+
+
+/*?*/const String& SwRedline::GetAuthorString( USHORT nPos ) const
+/*?*/{
+ SwRedlineData* pCur;
+/*?*/ for( pCur = pRedlineData; nPos && pCur->pNext; --nPos )
+/*?*/ pCur = pCur->pNext;
+/*?*/ ASSERT( !nPos, "Pos angabe ist zu gross" );
+/*?*/ return SW_MOD()->GetRedlineAuthor(pCur->nAuthor);
+/*?*/}
+
+const DateTime& SwRedline::GetTimeStamp( USHORT nPos ) const
+{
+ SwRedlineData* pCur; for( pCur = pRedlineData; nPos && pCur->pNext; --nPos )
+ pCur = pCur->pNext;
+ ASSERT( !nPos, "Pos angabe ist zu gross" );
+ return pCur->aStamp;
+}
+
+SwRedlineType SwRedline::GetRealType( USHORT nPos ) const
+{
+ SwRedlineData* pCur; for( pCur = pRedlineData; nPos && pCur->pNext; --nPos )
+ pCur = pCur->pNext;
+ ASSERT( !nPos, "Pos angabe ist zu gross" );
+ return pCur->eType;
+}
+
+const String& SwRedline::GetComment( USHORT nPos ) const
+{
+ SwRedlineData* pCur; for( pCur = pRedlineData; nPos && pCur->pNext; --nPos )
+ pCur = pCur->pNext;
+ ASSERT( !nPos, "Pos angabe ist zu gross" );
+ return pCur->sComment;
+}
+
+/*N*/ int SwRedline::operator==( const SwRedline& rCmp ) const
+/*N*/ {
+/*N*/ return this == &rCmp;
+/*N*/ }
+
+/*N*/ int SwRedline::operator<( const SwRedline& rCmp ) const
+/*N*/ {
+/*N*/ BOOL nResult = FALSE;
+/*N*/
+/*N*/ if (*Start() < *rCmp.Start())
+/*N*/ nResult = TRUE;
+/*N*/ else if (*Start() == *rCmp.Start())
+/*N*/ if (*End() < *rCmp.End())
+/*N*/ nResult = TRUE;
+/*N*/
+/*N*/ return nResult;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docruby.cxx b/binfilter/bf_sw/source/core/doc/sw_docruby.cxx
new file mode 100644
index 000000000000..d2d7d9a149b5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docruby.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <string.h> // fuer strchr()
+
+
+#include <com/sun/star/i18n/UnicodeType.hdl>
+#include <com/sun/star/i18n/WordType.hdl>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <doc.hxx>
+#include <rubylist.hxx>
+#include <pam.hxx>
+namespace binfilter {
+
+/*N*/ SV_IMPL_PTRARR( SwRubyList, SwRubyListEntryPtr )
+
+using namespace ::com::sun::star::i18n;
+
+/*N*/SwRubyListEntry::~SwRubyListEntry()
+/*N*/{
+/*N*/}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docsort.cxx b/binfilter/bf_sw/source/core/doc/sw_docsort.cxx
new file mode 100644
index 000000000000..5044e3581915
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docsort.cxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <doc.hxx>
+#if OSL_DEBUG_LEVEL > 1
+//nur zum debugen
+#endif
+namespace binfilter {
+
+using namespace ::com::sun::star::lang;
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ein Sortierelement fuers Sort konstruieren
+ --------------------------------------------------------------------*/
+
+
+
+
+
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Operatoren zum Vergleichen
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Kleiner-Operator fuers sortieren
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: SortierElemente fuer Text
+ --------------------------------------------------------------------*/
+
+
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Key ermitteln
+ --------------------------------------------------------------------*/
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortier-Elemente fuer Tabellen
+ --------------------------------------------------------------------*/
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schluessel zu einer Zelle ermitteln
+ --------------------------------------------------------------------*/
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Text sortieren im Document
+ --------------------------------------------------------------------*/
+
+
+/*N*/ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // pruefen ob Rahmen im Text
+/*N*/ return TRUE;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabelle sortieren im Document
+ --------------------------------------------------------------------*/
+
+/*N*/ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // uebers SwDoc fuer Undo !!
+/*N*/ return TRUE;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zeilenweise verschieben
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Spaltenweise verschieben
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eine einzelne Zelle verschieben
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zweidimensionales Array aus FndBoxes generieren
+ --------------------------------------------------------------------*/
+
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Alle Lines einer Box muessen gleichviel Boxen haben
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Box auf Symmetrie pruefen
+ Alle Boxen einer Line muessen gleichviele Lines haben
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: max Anzahl der Spalten (Boxes)
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: max Anzahl der Zeilen (Lines)
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: lineares Array aus atomaren FndBoxes erzeugen
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zugriff auf eine bestimmte Zelle
+ --------------------------------------------------------------------*/
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_docstat.cxx b/binfilter/bf_sw/source/core/doc/sw_docstat.cxx
new file mode 100644
index 000000000000..6cab64c11b6e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_docstat.cxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <docstat.hxx>
+namespace binfilter {
+
+
+/************************************************************************
+ * SwDocStat::SwDocStat()
+ ************************************************************************/
+
+/*N*/ SwDocStat::SwDocStat() :
+/*N*/ nTbl(0),
+/*N*/ nGrf(0),
+/*N*/ nOLE(0),
+/*N*/ nPage(1),
+/*N*/ nPara(1),
+/*N*/ nWord(0),
+/*N*/ nChar(0),
+/*N*/ bModified(TRUE),
+/*N*/ pInternStat(0)
+/*N*/ {}
+
+/************************************************************************
+ * void SwDocStat::Reset()
+ ************************************************************************/
+
+/*N*/ void SwDocStat::Reset()
+/*N*/ {
+/*N*/ nTbl = 0;
+/*N*/ nGrf = 0;
+/*N*/ nOLE = 0;
+/*N*/ nPage = 1;
+/*N*/ nPara = 1;
+/*N*/ nWord = 0;
+/*N*/ nChar = 0;
+/*N*/ bModified = TRUE;
+/*N*/ pInternStat = 0;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_doctxm.cxx b/binfilter/bf_sw/source/core/doc/sw_doctxm.cxx
new file mode 100644
index 000000000000..f7d72632716e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_doctxm.cxx
@@ -0,0 +1,511 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <limits.h>
+
+#include <hintids.hxx>
+
+#define _SVSTDARR_STRINGSSORT
+
+#include <docsh.hxx>
+
+#include <errhdl.hxx>
+
+#include <fmtinfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <doctxm.hxx>
+#include <txmsrt.hxx>
+#include <poolfmt.hxx>
+#include <rootfrm.hxx>
+#include <docary.hxx>
+#include <txtfld.hxx>
+#include <chpfld.hxx>
+namespace binfilter {
+
+const sal_Unicode cNumRepl = '@';
+const sal_Unicode cEndPageNum = '~';
+const sal_Char __FAR_DATA sPageDeli[] = ", ";
+
+/*N*/ SV_IMPL_PTRARR(SwTOXSortTabBases, SwTOXSortTabBasePtr)
+
+/*N*/ TYPEINIT2( SwTOXBaseSection, SwTOXBase, SwSection ); // fuers RTTI
+
+struct LinkStruct
+{
+ SwFmtINetFmt aINetFmt;
+ xub_StrLen nStartTextPos, nEndTextPos;
+
+ LinkStruct( const String& rURL, xub_StrLen nStart, xub_StrLen nEnd )
+ : aINetFmt( rURL, aEmptyStr),
+ nStartTextPos( nStart),
+ nEndTextPos(nEnd) {}
+};
+
+typedef LinkStruct* LinkStructPtr;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Marke loeschen
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDoc::Delete( SwTOXMark* pTOXMark )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // hole den TextNode und
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveln zwischen TOXMarks
+ --------------------------------------------------------------------*/
+
+
+
+/* */
+
+/*N*/ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
+/*N*/ const SwTOXBase& rTOX,
+/*N*/ const SfxItemSet* pSet,
+/*N*/ BOOL bExpand )
+/*N*/ {
+/*N*/
+/*N*/ SwTOXBaseSection* pNew = new SwTOXBaseSection( rTOX );
+/*N*/ String sSectNm( rTOX.GetTOXName() );
+/*N*/ sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), &sSectNm );
+/*N*/ pNew->SetTOXName(sSectNm);
+/*N*/ pNew->SwSection::SetName(sSectNm);
+/*N*/ SwPaM aPam( rPos );
+/*N*/ SwSection* pSect = Insert( aPam, *pNew, pSet, FALSE );
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ SwSectionNode* pSectNd = pSect->GetFmt()->GetSectionNode();
+/*N*/ SwSection* pCl = pNew;
+/*N*/ pSect->GetFmt()->Add( pCl );
+/*N*/ pSectNd->SetNewSection( pNew );
+/*N*/
+/*N*/ if( bExpand )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ else if( 1 == rTOX.GetTitle().Len() && IsInReading() )
+/*N*/ // insert title of TOX
+/*N*/ {
+/*?*/ // then insert the headline section
+/*?*/ SwNodeIndex aIdx( *pSectNd, +1 );
+/*?*/
+/*?*/ SwTxtNode* pHeadNd = GetNodes().MakeTxtNode( aIdx,
+/*?*/ GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+/*?*/
+/*?*/ String sNm( pNew->GetTOXName() );
+/*?*/ // ??Resource
+/*?*/ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
+/*?*/
+/*?*/ SwSection aSect( TOX_HEADER_SECTION, sNm );
+/*?*/
+/*?*/ SwNodeIndex aStt( *pHeadNd ); aIdx--;
+/*?*/ SwSectionFmt* pSectFmt = MakeSectionFmt( 0 );
+/*?*/ GetNodes().InsertSection( aStt, *pSectFmt, aSect, &aIdx,
+/*?*/ TRUE, FALSE );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ delete pNew, pNew = 0;
+
+/*N*/
+/*N*/ return pNew;
+/*N*/ }
+
+
+
+/*N*/ const SwTOXBaseSection* SwDoc::InsertTableOf( ULONG nSttNd, ULONG nEndNd,
+/*N*/ const SwTOXBase& rTOX,
+/*N*/ const SfxItemSet* pSet )
+/*N*/ {
+/*N*/ // check for recursiv TOX
+/*N*/ SwNode* pNd = GetNodes()[ nSttNd ];
+/*N*/ SwSectionNode* pSectNd = pNd->FindSectionNode();
+/*N*/ while( pSectNd )
+/*N*/ {
+/*?*/ SectionType eT = pSectNd->GetSection().GetType();
+/*?*/ if( TOX_HEADER_SECTION == eT || TOX_CONTENT_SECTION == eT )
+/*?*/ return 0;
+/*?*/ pSectNd = pSectNd->FindStartNode()->FindSectionNode();
+/*N*/ }
+/*N*/
+/*N*/ // create SectionNode around the Nodes
+/*N*/ SwTOXBaseSection* pNew = new SwTOXBaseSection( rTOX );
+/*N*/
+/*N*/ String sSectNm( rTOX.GetTOXName() );
+/*N*/ sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), &sSectNm);
+/*N*/ pNew->SetTOXName(sSectNm);
+/*N*/ pNew->SwSection::SetName(sSectNm);
+/*N*/
+/*N*/ SwNodeIndex aStt( GetNodes(), nSttNd ), aEnd( GetNodes(), nEndNd );
+/*N*/ SwSectionFmt* pFmt = MakeSectionFmt( 0 );
+/*N*/ if(pSet)
+/*?*/ pFmt->SetAttr(*pSet);
+/*N*/
+/*N*/ // --aEnd; // im InsertSection ist Ende inclusive
+/*N*/
+/*N*/ pSectNd = GetNodes().InsertSection( aStt, *pFmt, *pNew, &aEnd );
+/*N*/ if( pSectNd )
+/*N*/ {
+/*N*/ SwSection* pCl = pNew;
+/*N*/ pFmt->Add( pCl );
+/*N*/ pSectNd->SetNewSection( pNew );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ delete pNew, pNew = 0;
+/*?*/ DelSectionFmt( pFmt );
+/*N*/ }
+/*N*/
+/*N*/ return pNew;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelles Verzeichnis ermitteln
+ --------------------------------------------------------------------*/
+
+/*N*/ const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const
+/*N*/ {
+/*N*/ const SwNode& rNd = rPos.nNode.GetNode();
+/*N*/ const SwSectionNode* pSectNd = rNd.FindSectionNode();
+/*N*/ while( pSectNd )
+/*N*/ {
+/*N*/ SectionType eT = pSectNd->GetSection().GetType();
+/*N*/ if( TOX_CONTENT_SECTION == eT )
+/*N*/ {
+/*N*/ ASSERT( pSectNd->GetSection().ISA( SwTOXBaseSection ),
+/*N*/ "keine TOXBaseSection!" );
+/*N*/ SwTOXBaseSection& rTOXSect = (SwTOXBaseSection&)
+/*N*/ pSectNd->GetSection();
+/*N*/ return &rTOXSect;
+/*N*/ }
+/*?*/ pSectNd = pSectNd->FindStartNode()->FindSectionNode();
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+/* -----------------01.09.99 16:01-------------------
+
+ --------------------------------------------------*/
+/*N*/ const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& rTOXBase) const
+/*N*/ {
+/*N*/ ASSERT( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" );
+/*N*/ const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase;
+/*N*/ SwSectionFmt* pFmt = rTOXSect.GetFmt();
+/*N*/ ASSERT( pFmt, "invalid TOXBaseSection!" );
+/*N*/ return pFmt->GetAttrSet();
+/*N*/ }
+/* -----------------02.09.99 07:48-------------------
+
+ --------------------------------------------------*/
+/* -----------------02.09.99 08:06-------------------
+
+ --------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis loeschen
+ --------------------------------------------------------------------*/
+
+
+/*N*/ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); return TRUE;//STRIP001 // its only delete the TOX, not the nodes
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnistypen verwalten
+ --------------------------------------------------------------------*/
+
+/*N*/ USHORT SwDoc::GetTOXTypeCount(TOXTypes eTyp) const
+/*N*/ {
+/*N*/ const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData();
+/*N*/ USHORT nCnt = 0;
+/*N*/ for( USHORT n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes )
+/*N*/ if( eTyp == (*ppTTypes)->GetType() )
+/*N*/ ++nCnt;
+/*N*/ return nCnt;
+/*N*/ }
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+/*N*/ const SwTOXType* SwDoc::GetTOXType( TOXTypes eTyp, USHORT nId ) const
+/*N*/ {
+/*N*/ const SwTOXTypePtr * ppTTypes = pTOXTypes->GetData();
+/*N*/ USHORT nCnt = 0;
+/*N*/ for( USHORT n = 0; n < pTOXTypes->Count(); ++n, ++ppTTypes )
+/*N*/ if( eTyp == (*ppTTypes)->GetType() && nCnt++ == nId )
+/*N*/ return (*ppTTypes);
+/*N*/ return 0;
+/*N*/ }
+
+#ifdef USED
+
+
+
+#endif
+
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+/*N*/ const SwTOXType* SwDoc::InsertTOXType( const SwTOXType& rTyp )
+/*N*/ {
+/*N*/ SwTOXType * pNew = new SwTOXType( rTyp );
+/*N*/ pTOXTypes->Insert( pNew, pTOXTypes->Count() );
+/*N*/ return pNew;
+/*N*/ }
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+/*N*/ String SwDoc::GetUniqueTOXBaseName( const SwTOXType& rType,
+/*N*/ const String* pChkStr ) const
+/*N*/ {
+/*N*/ if(pChkStr && !pChkStr->Len())
+/*N*/ pChkStr = 0;
+/*N*/ String aName( rType.GetTypeName() );
+/*N*/ xub_StrLen nNmLen = aName.Len();
+/*N*/
+/*N*/ USHORT nNum, nTmp, nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2;
+/*N*/ BYTE* pSetFlags = new BYTE[ nFlagSize ];
+/*N*/ memset( pSetFlags, 0, nFlagSize );
+/*N*/
+/*N*/ const SwSectionNode* pSectNd;
+/*N*/ const SwSection* pSect;
+ USHORT n=0;
+/*N*/ for( n = 0; n < pSectionFmtTbl->Count(); ++n )
+/*N*/ if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( FALSE ) )&&
+/*N*/ TOX_CONTENT_SECTION == (pSect = &pSectNd->GetSection())->GetType())
+/*N*/ {
+/*N*/ const String& rNm = pSect->GetName();
+/*N*/ if( rNm.Match( aName ) == nNmLen )
+/*N*/ {
+/*N*/ // Nummer bestimmen und das Flag setzen
+/*N*/ nNum = (USHORT)rNm.Copy( nNmLen ).ToInt32();
+/*N*/ if( nNum-- && nNum < pSectionFmtTbl->Count() )
+/*N*/ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+/*N*/ }
+/*N*/ if( pChkStr && pChkStr->Equals( rNm ) )
+/*N*/ pChkStr = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( !pChkStr )
+/*N*/ {
+/*N*/ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+/*N*/ nNum = pSectionFmtTbl->Count();
+/*N*/ for( n = 0; n < nFlagSize; ++n )
+/*N*/ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+/*N*/ {
+/*N*/ // also die Nummer bestimmen
+/*N*/ nNum = n * 8;
+/*N*/ while( nTmp & 1 )
+/*N*/ ++nNum, nTmp >>= 1;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ delete [] pSetFlags;
+/*N*/ if( pChkStr )
+/*N*/ return *pChkStr;
+/*N*/ return aName += String::CreateFromInt32( ++nNum );
+/*N*/ }
+
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+/*N*/ BOOL SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const String& rName)
+/*N*/ {
+/*N*/ ASSERT( rTOXBase.ISA( SwTOXBaseSection ),
+/*N*/ "keine TOXBaseSection!" );
+/*N*/ SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOXBase;
+/*N*/
+/*N*/ String sTmp = GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), &rName);
+/*N*/ BOOL bRet = sTmp == rName;
+/*N*/ if(bRet)
+/*N*/ {
+/*?*/ pTOX->SetTOXName(rName);
+/*?*/ pTOX->SwTOXBaseSection::SetName(rName);
+/*?*/ SetModified();
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+
+
+/* */
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis-Klasse
+ --------------------------------------------------------------------*/
+
+/*N*/ SwTOXBaseSection::SwTOXBaseSection( const SwTOXBase& rBase )
+/*N*/ : SwTOXBase( rBase ), SwSection( TOX_CONTENT_SECTION, aEmptyStr )
+/*N*/ {
+/*N*/ SetProtect( rBase.IsProtected() );
+/*N*/ SwSection::SetName( GetTOXName() );
+/*N*/ }
+
+
+/*N*/ SwTOXBaseSection::~SwTOXBaseSection()
+/*N*/ {
+/*N*/ }
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt zusammensammeln
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
+/*N*/ const bool _bNewTOX )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: AlphaDelimitter einfuegen
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Template auswerten
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aus Markierungen erzeugen
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt aus Gliederungsebene generieren
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt aus Vorlagenbereichen generieren
+ --------------------------------------------------------------------*/
+
+
+/* -----------------14.07.99 09:59-------------------
+ Description: generate content from sequence fields
+ --------------------------------------------------*/
+/* -----------------15.09.99 14:18-------------------
+
+ --------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisinhalt aus Inhaltsformen generieren
+ OLE, Grafik, Frame
+ Achtung: Spezielle Section !
+ --------------------------------------------------------------------*/
+/*
+ nPos = pNd->GetIndex();
+ if( nPos < pNd->GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ // dann die "Anker" (Body) Position holen.
+ Point aPt;
+ const SwCntntFrm* pFrm = pNd->GetFrm( &aPt, 0, FALSE );
+ if( pFrm )
+ {
+ SwPosition aPos( *pNd );
+ SwDoc* pDoc = (SwDoc*)pNd->GetDoc();
+#ifdef DBG_UTIL
+ ASSERT( GetBodyTxtNode( pDoc, aPos, pFrm ),
+ "wo steht der Absatz" );
+#else
+ GetBodyTxtNode( pDoc, aPos, pFrm );
+#endif
+ nPos = aPos.nNode.GetIndex();
+ nCntPos = aPos.nContent.GetIndex();
+ }
+ }
+
+
+
+ */
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabelleneintraege zusammensuchen
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: String generieren anhand der Form
+ SonderZeichen 0-31 und 255 entfernen
+ --------------------------------------------------------------------*/
+
+
+// OD 18.03.2003 #106329# - add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc>
+// in order to control, which page description is used, no appropriate one is found.
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitennummer errechnen und nach dem Formatieren
+ eintragen
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwTOXBaseSection::UpdatePageNum()
+/*N*/ {
+/*N*/ if( !aSortArr.Count() )
+/*N*/ return ;
+
+ // die aktuellen Seitennummern ins Verzeichnis eintragen
+/*?*/ SwPageFrm* pAktPage = 0;
+/*?*/ USHORT nPage = 0;
+/*?*/ SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
+/*?*/
+/*?*/ SwTOXInternational aIntl( GetLanguage(),
+/*?*/ TOX_INDEX == GetTOXType()->GetType() ?
+/*?*/ GetOptions() : 0,
+/*?*/ GetSortAlgorithm() );
+/*?*/
+/*?*/ for( USHORT nCnt = 0; nCnt < aSortArr.Count(); ++nCnt )
+/*?*/ {
+/*?*/ }
+/*?*/ // nach dem Setzen der richtigen Seitennummer, das Mapping-Array
+/*?*/ // wieder loeschen !!
+/*?*/ aSortArr.DeleteAndDestroy( 0, aSortArr.Count() );
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_extinput.cxx b/binfilter/bf_sw/source/core/doc/sw_extinput.cxx
new file mode 100644
index 000000000000..e25c3337eede
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_extinput.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+
+#include <errhdl.hxx>
+#include <horiornt.hxx>
+
+#include <extinput.hxx>
+#include <doc.hxx>
+namespace binfilter {
+
+
+
+
+
+
+
+
+// die Doc Schnittstellen:
+
+
+
+/*N*/ SwExtTextInput* SwDoc::GetExtTextInput( const SwNode& rNd,
+/*N*/ xub_StrLen nCntntPos ) const
+/*N*/ {
+/*N*/ SwExtTextInput* pRet = 0;
+/*N*/ if( pExtInputRing )
+/*N*/ {
+/*?*/ ULONG nNdIdx = rNd.GetIndex();
+/*?*/ SwExtTextInput* pTmp = (SwExtTextInput*)pExtInputRing;
+/*?*/ do {
+/*?*/ ULONG nPt = pTmp->GetPoint()->nNode.GetIndex(),
+/*?*/ nMk = pTmp->GetMark()->nNode.GetIndex();
+/*?*/ xub_StrLen nPtCnt = pTmp->GetPoint()->nContent.GetIndex(),
+/*?*/ nMkCnt = pTmp->GetMark()->nContent.GetIndex();
+/*?*/
+/*?*/ if( nPt < nMk || ( nPt == nMk && nPtCnt < nMkCnt ))
+/*?*/ {
+/*?*/ ULONG nTmp = nMk; nMk = nPt; nPt = nTmp;
+/*?*/ nTmp = nMkCnt; nMkCnt = nPtCnt; nPtCnt = (xub_StrLen)nTmp;
+/*?*/ }
+/*?*/
+/*?*/ if( nMk <= nNdIdx && nNdIdx <= nPt &&
+/*?*/ ( STRING_NOTFOUND == nCntntPos ||
+/*?*/ ( nMkCnt <= nCntntPos && nCntntPos <= nPtCnt )))
+/*?*/ {
+/*?*/ pRet = pTmp;
+/*?*/ break;
+/*?*/ }
+/*?*/ } while( pExtInputRing != (pTmp = (SwExtTextInput*)pExtInputRing ) );
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx b/binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx
new file mode 100644
index 000000000000..5161dd3d5113
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_fmtcol.cxx
@@ -0,0 +1,328 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/fhgtitem.hxx>
+#include <sal/macros.h>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx> // fuer GetAttrPool
+#include <errhdl.hxx>
+#include <hints.hxx>
+#include <node.hxx>
+namespace binfilter {
+
+
+/*N*/ TYPEINIT1( SwTxtFmtColl, SwFmtColl );
+/*N*/ TYPEINIT1( SwGrfFmtColl, SwFmtColl );
+/*N*/ TYPEINIT1( SwConditionTxtFmtColl, SwTxtFmtColl );
+/*N*/ TYPEINIT1( SwCollCondition, SwClient );
+
+/*N*/ SV_IMPL_PTRARR( SwFmtCollConditions, SwCollConditionPtr );
+
+
+/*
+ * SwTxtFmtColl TXT
+ */
+
+/*N*/ void SwTxtFmtColl::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ if( GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ SwFmtColl::Modify( pOld, pNew );
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ int bNewParent = FALSE;
+/*N*/ SvxULSpaceItem *pNewULSpace = 0, *pOldULSpace = 0;
+/*N*/ SvxLRSpaceItem *pNewLRSpace = 0, *pOldLRSpace = 0;
+/*N*/ SvxFontHeightItem* aFontSizeArr[3] = {0,0,0};
+/*N*/
+/*N*/ SwAttrSetChg *pNewChgSet = 0, *pOldChgSet = 0;
+/*N*/
+/*N*/ switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
+/*N*/ {
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ // nur neu berechnen, wenn nicht wir der "Versender" sind !!!
+/*N*/ pNewChgSet = (SwAttrSetChg*)pNew;
+/*N*/ pOldChgSet = (SwAttrSetChg*)pOld;
+/*N*/ pNewChgSet->GetChgSet()->GetItemState(
+/*N*/ RES_LR_SPACE, FALSE, (const SfxPoolItem**)&pNewLRSpace );
+/*N*/ pNewChgSet->GetChgSet()->GetItemState(
+/*N*/ RES_UL_SPACE, FALSE, (const SfxPoolItem**)&pNewULSpace );
+/*N*/ pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_FONTSIZE,
+/*N*/ FALSE, (const SfxPoolItem**)&(aFontSizeArr[0]) );
+/*N*/ pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CJK_FONTSIZE,
+/*N*/ FALSE, (const SfxPoolItem**)&(aFontSizeArr[1]) );
+/*N*/ pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CTL_FONTSIZE,
+/*N*/ FALSE, (const SfxPoolItem**)&(aFontSizeArr[2]) );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FMT_CHG:
+/*N*/ if( GetAttrSet().GetParent() )
+/*N*/ {
+/*N*/ const SfxItemSet* pParent = GetAttrSet().GetParent();
+/*N*/ pNewLRSpace = (SvxLRSpaceItem*)&pParent->Get( RES_LR_SPACE );
+/*N*/ pNewULSpace = (SvxULSpaceItem*)&pParent->Get( RES_UL_SPACE );
+/*N*/ aFontSizeArr[0] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_FONTSIZE );
+/*N*/ aFontSizeArr[1] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CJK_FONTSIZE );
+/*N*/ aFontSizeArr[2] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CTL_FONTSIZE );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*?*/ case RES_LR_SPACE:
+/*?*/ pNewLRSpace = (SvxLRSpaceItem*)pNew;
+/*?*/ break;
+/*?*/ case RES_UL_SPACE:
+/*?*/ pNewULSpace = (SvxULSpaceItem*)pNew;
+/*?*/ break;
+/*?*/ case RES_CHRATR_FONTSIZE:
+/*?*/ aFontSizeArr[0] = (SvxFontHeightItem*)pNew;
+/*?*/ break;
+/*?*/ case RES_CHRATR_CJK_FONTSIZE:
+/*?*/ aFontSizeArr[1] = (SvxFontHeightItem*)pNew;
+/*?*/ break;
+/*?*/ case RES_CHRATR_CTL_FONTSIZE:
+/*?*/ aFontSizeArr[2] = (SvxFontHeightItem*)pNew;
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*N*/ int bWeiter = TRUE;
+/*N*/
+/*N*/ // dann pruefe doch mal gegen die eigenen Attribute
+/*N*/ if( pNewLRSpace && SFX_ITEM_SET == GetItemState( RES_LR_SPACE, FALSE,
+/*N*/ (const SfxPoolItem**)&pOldLRSpace ))
+/*N*/ {
+/*N*/ int bChg = FALSE;
+/*N*/ if( pOldLRSpace != pNewLRSpace ) // verhinder Rekursion (SetAttr!!)
+/*N*/ {
+/*N*/ SvxLRSpaceItem aNew( *pOldLRSpace );
+/*N*/ // wir hatten eine relative Angabe -> neu berechnen
+/*N*/ if( 100 != aNew.GetPropLeft() )
+/*N*/ {
+/*N*/ long nTmp = aNew.GetLeft(); // alten zum Vergleichen
+/*N*/ aNew.SetLeft( pNewLRSpace->GetLeft(), aNew.GetPropLeft() );
+/*N*/ bChg |= nTmp != aNew.GetLeft();
+/*N*/ }
+/*N*/ // wir hatten eine relative Angabe -> neu berechnen
+/*N*/ if( 100 != aNew.GetPropRight() )
+/*N*/ {
+/*N*/ long nTmp = aNew.GetRight(); // alten zum Vergleichen
+/*N*/ aNew.SetRight( pNewLRSpace->GetRight(), aNew.GetPropRight() );
+/*N*/ bChg |= nTmp != aNew.GetRight();
+/*N*/ }
+/*N*/ // wir hatten eine relative Angabe -> neu berechnen
+/*N*/ if( 100 != aNew.GetPropTxtFirstLineOfst() )
+/*N*/ {
+/*N*/ short nTmp = aNew.GetTxtFirstLineOfst(); // alten zum Vergleichen
+/*N*/ aNew.SetTxtFirstLineOfst( pNewLRSpace->GetTxtFirstLineOfst(),
+/*N*/ aNew.GetPropTxtFirstLineOfst() );
+/*N*/ bChg |= nTmp != aNew.GetTxtFirstLineOfst();
+/*N*/ }
+/*N*/ if( bChg )
+/*N*/ {
+/*N*/ SetAttr( aNew );
+/*N*/ bWeiter = 0 != pOldChgSet || bNewParent;
+/*N*/ }
+/*N*/ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+/*N*/ // denn es wird bei uns gesetzt!
+/*N*/ else if( pNewChgSet )
+/*?*/ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+/*N*/ }
+/*N*/
+/*N*/ #ifndef NUM_RELSPACE
+/*N*/ if( !bChg && pOldLRSpace == pNewLRSpace &&
+/*N*/ // pNewChgSet->GetTheChgdSet() == &aSet &&
+/*N*/ GetOutlineLevel() < MAXLEVEL )
+/*N*/ {
+/*N*/ // dann muss der Wert in die OutlineRule uebertragen werden
+/*N*/ GetDoc()->SetOutlineLSpace( GetOutlineLevel(),
+/*N*/ pOldLRSpace->GetTxtFirstLineOfst(),
+/*N*/ pOldLRSpace->GetTxtLeft() );
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/
+/*N*/ if( pNewULSpace && SFX_ITEM_SET == GetItemState(
+/*N*/ RES_UL_SPACE, FALSE, (const SfxPoolItem**)&pOldULSpace ) &&
+/*N*/ pOldULSpace != pNewULSpace ) // verhinder Rekursion (SetAttr!!)
+/*N*/ {
+/*N*/ SvxULSpaceItem aNew( *pOldULSpace );
+/*N*/ int bChg = FALSE;
+/*N*/ // wir hatten eine relative Angabe -> neu berechnen
+/*N*/ if( 100 != aNew.GetPropUpper() )
+/*N*/ {
+/*?*/ USHORT nTmp = aNew.GetUpper(); // alten zum Vergleichen
+/*?*/ aNew.SetUpper( pNewULSpace->GetUpper(), aNew.GetPropUpper() );
+/*?*/ bChg |= nTmp != aNew.GetUpper();
+/*N*/ }
+/*N*/ // wir hatten eine relative Angabe -> neu berechnen
+/*N*/ if( 100 != aNew.GetPropLower() )
+/*N*/ {
+/*?*/ USHORT nTmp = aNew.GetLower(); // alten zum Vergleichen
+/*?*/ aNew.SetLower( pNewULSpace->GetLower(), aNew.GetPropLower() );
+/*?*/ bChg |= nTmp != aNew.GetLower();
+/*N*/ }
+/*N*/ if( bChg )
+/*N*/ {
+/*?*/ SetAttr( aNew );
+/*?*/ bWeiter = 0 != pOldChgSet || bNewParent;
+/*N*/ }
+ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+ // denn es wird bei uns gesetzt!
+/*N*/ else if( pNewChgSet )
+/*?*/ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ for( int nC = 0, nArrLen = SAL_N_ELEMENTS(aFontSizeArr);
+/*N*/ nC < nArrLen; ++nC )
+/*N*/ {
+/*N*/ SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize;
+/*N*/ if( pFSize && SFX_ITEM_SET == GetItemState(
+/*N*/ pFSize->Which(), FALSE, (const SfxPoolItem**)&pOldFSize ) &&
+/*N*/ // verhinder Rekursion (SetAttr!!)
+/*N*/ pFSize != pOldFSize )
+/*N*/ {
+/*N*/ if( 100 == pOldFSize->GetProp() &&
+/*N*/ SFX_MAPUNIT_RELATIVE == pOldFSize->GetPropUnit() )
+/*N*/ {
+/*N*/ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+/*N*/ // denn es wird bei uns gesetzt!
+/*N*/ if( pNewChgSet )
+/*?*/ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // wir hatten eine relative Angabe -> neu berechnen
+/*N*/ UINT32 nTmp = pOldFSize->GetHeight(); // alten zum Vergleichen
+/*N*/ SvxFontHeightItem aNew;
+/*N*/ aNew.SetWhich( pFSize->Which() );
+/*N*/ aNew.SetHeight( pFSize->GetHeight(), pOldFSize->GetProp(),
+/*N*/ pOldFSize->GetPropUnit() );
+/*N*/ if( nTmp != aNew.GetHeight() )
+/*N*/ {
+/*?*/ SetAttr( aNew );
+/*?*/ bWeiter = 0 != pOldChgSet || bNewParent;
+/*N*/ }
+/*N*/ // bei uns absolut gesetzt -> nicht weiter propagieren, es sei
+/*N*/ // denn es wird bei uns gesetzt!
+/*N*/ else if( pNewChgSet )
+/*?*/ bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bWeiter )
+/*N*/ SwFmtColl::Modify( pOld, pNew );
+/*N*/ }
+
+
+//FEATURE::CONDCOLL
+
+/*N*/ SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, ULONG nMasterCond,
+/*N*/ ULONG nSubCond )
+/*N*/ : SwClient( pColl ), nCondition( nMasterCond )
+/*N*/ {
+/*N*/ aSubCondition.nSubCondition = nSubCond;
+/*N*/ }
+
+
+
+
+
+
+/*N*/ SwCollCondition::~SwCollCondition()
+/*N*/ {
+/*N*/ if( USRFLD_EXPRESSION & nCondition )
+/*?*/ delete aSubCondition.pFldExpression;
+/*N*/ }
+
+
+/*N*/ int SwCollCondition::operator==( const SwCollCondition& rCmp ) const
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001 int nRet = 0;
+/*N*/ }
+
+
+/*N*/ void SwCollCondition::SetCondition( ULONG nCond, ULONG nSubCond )
+/*N*/ {
+/*N*/ if( USRFLD_EXPRESSION & nCondition )
+/*?*/ delete aSubCondition.pFldExpression;
+/*N*/ nCondition = nCond;
+/*N*/ aSubCondition.nSubCondition = nSubCond;
+/*N*/ }
+
+
+/*N*/ SwConditionTxtFmtColl::~SwConditionTxtFmtColl()
+/*N*/ {
+/*N*/ }
+
+#ifdef USED
+ // zum "abfischen" von Aenderungen
+#endif
+
+
+/*N*/ const SwCollCondition* SwConditionTxtFmtColl::HasCondition(
+/*N*/ const SwCollCondition& rCond ) const
+/*N*/ {
+/*N*/ const SwCollCondition* pFnd = 0;
+ USHORT n=0;
+/*N*/ for( n = 0; n < aCondColls.Count(); ++n )
+/*?*/ if( *( pFnd = aCondColls[ n ]) == rCond )
+/*?*/ break;
+/*N*/
+/*N*/ return n < aCondColls.Count() ? pFnd : 0;
+/*N*/ }
+
+
+/*N*/ void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 for( USHORT n = 0; n < aCondColls.Count(); ++n )
+/*N*/ }
+
+
+
+
+//FEATURE::CONDCOLL
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_ftnidx.cxx b/binfilter/bf_sw/source/core/doc/sw_ftnidx.cxx
new file mode 100644
index 000000000000..1ae47d48b403
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_ftnidx.cxx
@@ -0,0 +1,403 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <ftninfo.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ftnidx.hxx>
+#include <ndtxt.hxx>
+#include <ndindex.hxx>
+#include <section.hxx>
+#include <fmtftntx.hxx>
+namespace binfilter {
+
+
+/*?*/ _SV_IMPL_SORTAR_ALG( _SwFtnIdxs, SwTxtFtnPtr )
+/*?*/ BOOL _SwFtnIdxs::Seek_Entry( const SwTxtFtnPtr rSrch, USHORT* pFndPos ) const
+/*?*/ {
+/*?*/ ULONG nIdx = _SwTxtFtn_GetIndex( rSrch );
+/*?*/ xub_StrLen nCntIdx = *rSrch->GetStart();
+/*?*/
+/*?*/ register USHORT nO = Count(), nM, nU = 0;
+/*?*/ if( nO > 0 )
+/*?*/ {
+/*?*/ nO--;
+/*?*/ while( nU <= nO )
+/*?*/ {
+/*?*/ nM = nU + ( nO - nU ) / 2;
+/*?*/ ULONG nFndIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] );
+/*?*/ if( nFndIdx == nIdx && *(*this)[ nM ]->GetStart() == nCntIdx )
+/*?*/ {
+/*?*/ if( pFndPos )
+/*?*/ *pFndPos = nM;
+/*?*/ return TRUE;
+/*?*/ }
+/*?*/ else if( nFndIdx < nIdx ||
+/*?*/ (nFndIdx == nIdx && *(*this)[ nM ]->GetStart() < nCntIdx ))
+/*?*/ nU = nM + 1;
+/*?*/ else if( nM == 0 )
+/*?*/ {
+/*?*/ if( pFndPos )
+/*?*/ *pFndPos = nU;
+/*?*/ return FALSE;
+/*?*/ }
+/*?*/ else
+/*?*/ nO = nM - 1;
+/*?*/ }
+/*?*/ }
+/*?*/ if( pFndPos )
+/*?*/ *pFndPos = nU;
+/*?*/ return FALSE;
+/*?*/ }
+
+
+/*N*/ void SwFtnIdxs::UpdateFtn( const SwNodeIndex& rStt )
+/*N*/ {
+/*N*/ if( !Count() )
+/*N*/ return;
+/*N*/
+/*N*/ // besorge erstmal das Nodes-Array ueber den StartIndex der ersten Fussnote
+/*N*/ SwDoc* pDoc = rStt.GetNode().GetDoc();
+/*N*/ if( pDoc->IsInReading() )
+/*N*/ return ;
+/*N*/ SwTxtFtn* pTxtFtn;
+/*N*/
+/*N*/ const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
+/*N*/ const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
+/*N*/
+/*N*/ //Fuer normale Fussnoten werden Chapter- und Dokumentweise Nummerierung
+/*N*/ //getrennt behandelt. Fuer Endnoten gibt es nur die Dokumentweise
+/*N*/ //Nummerierung.
+/*N*/ if( FTNNUM_CHAPTER == rFtnInfo.eNum )
+/*N*/ {
+/*?*/ const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+/*?*/ const SwNode* pCapStt = &pDoc->GetNodes().GetEndOfExtras();
+/*?*/ ULONG nCapEnd = pDoc->GetNodes().GetEndOfContent().GetIndex();
+/*?*/ if( rOutlNds.Count() )
+/*?*/ {
+/*?*/ // suche den Start des Kapitels, in den rStt steht.
+ USHORT n=0;
+/*?*/ for( n = 0; n < rOutlNds.Count(); ++n )
+/*?*/ if( rOutlNds[ n ]->GetIndex() > rStt.GetIndex() )
+/*?*/ break; // gefunden
+/*?*/ else if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )
+/*?*/ pCapStt = rOutlNds[ n ]; // Start eines neuen Kapitels
+/*?*/ // dann suche jetzt noch das Ende vom Bereich
+/*?*/ for( ; n < rOutlNds.Count(); ++n )
+/*?*/ if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )
+/*?*/ {
+/*?*/ nCapEnd = rOutlNds[ n ]->GetIndex(); // Ende des gefundenen Kapitels
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ USHORT nPos, nFtnNo = 1;
+/*?*/ if( SeekEntry( *pCapStt, &nPos ) && nPos )
+/*?*/ {
+/*?*/ // gehe nach vorne bis der Index nicht mehr gleich ist
+/*?*/ const SwNode* pCmpNd = &rStt.GetNode();
+/*?*/ while( nPos && pCmpNd == &((*this)[ --nPos ]->GetTxtNode()) )
+/*?*/ ;
+/*?*/ ++nPos;
+/*?*/ }
+/*?*/
+/*?*/ if( nPos == Count() ) // nichts gefunden
+/*?*/ return;
+/*?*/
+/*?*/ if( !rOutlNds.Count() )
+/*?*/ nFtnNo = nPos+1;
+/*?*/
+/*?*/ for( ; nPos < Count(); ++nPos )
+/*?*/ {
+/*?*/ pTxtFtn = (*this)[ nPos ];
+/*?*/ if( pTxtFtn->GetTxtNode().GetIndex() >= nCapEnd )
+/*?*/ break;
+/*?*/
+/*?*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*?*/ if( !rFtn.GetNumStr().Len() && !rFtn.IsEndNote() &&
+/*?*/ !SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( *pTxtFtn ))
+/*?*/ pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nFtnNo++,
+/*?*/ &rFtn.GetNumStr() );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwUpdFtnEndNtAtEnd aNumArr;
+/*N*/
+/*N*/ // BOOL, damit hier auch bei Chapter-Einstellung die Endnoten
+/*N*/ // durchlaufen.
+/*N*/ const FASTBOOL bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum;
+/*N*/
+/*N*/ USHORT nPos, nFtnNo = 1, nEndNo = 1;
+/*N*/ ULONG nUpdNdIdx = rStt.GetIndex();
+/*N*/ for( nPos = 0; nPos < Count(); ++nPos )
+/*N*/ {
+/*N*/ pTxtFtn = (*this)[ nPos ];
+/*N*/ if( nUpdNdIdx <= pTxtFtn->GetTxtNode().GetIndex() )
+/*N*/ break;
+/*N*/
+/*?*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*?*/ if( !rFtn.GetNumStr().Len() )
+/*?*/ {
+/*?*/ if( !aNumArr.ChkNumber( *pTxtFtn ) )
+/*?*/ {
+/*?*/ if( pTxtFtn->GetFtn().IsEndNote() )
+/*?*/ nEndNo++;
+/*?*/ else
+/*?*/ nFtnNo++;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // ab nPos bei allen FootNotes die Array-Nummer setzen
+/*N*/ for( ; nPos < Count(); ++nPos )
+/*N*/ {
+/*N*/ pTxtFtn = (*this)[ nPos ];
+/*N*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*N*/ if( !rFtn.GetNumStr().Len() )
+/*N*/ {
+/*N*/ USHORT nSectNo = aNumArr.ChkNumber( *pTxtFtn );
+/*N*/ if( !nSectNo && ( rFtn.IsEndNote() || !bEndNoteOnly ))
+/*N*/ nSectNo = rFtn.IsEndNote()
+/*N*/ ? rEndInfo.nFtnOffset + nEndNo++
+/*N*/ : rFtnInfo.nFtnOffset + nFtnNo++;
+/*N*/
+/*N*/ if( nSectNo )
+/*N*/ {
+/*N*/ if( rFtn.IsEndNote() )
+/*?*/ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+/*N*/ else
+/*N*/ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Pageweise wird vom MA erfuellt !!
+/*N*/ }
+
+
+/*N*/ void SwFtnIdxs::UpdateAllFtn()
+/*N*/ {
+/*N*/ if( !Count() )
+/*N*/ return;
+/*N*/
+/*N*/ // besorge erstmal das Nodes-Array ueber den StartIndex der
+/*N*/ // ersten Fussnote
+/*N*/ SwDoc* pDoc = (SwDoc*) (*this)[ 0 ]->GetTxtNode().GetDoc();
+/*N*/ SwTxtFtn* pTxtFtn;
+/*N*/ const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
+/*N*/ const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
+/*N*/
+/*N*/ SwUpdFtnEndNtAtEnd aNumArr;
+/*N*/
+/*N*/ //Fuer normale Fussnoten werden Chapter- und Dokumentweise Nummerierung
+/*N*/ //getrennt behandelt. Fuer Endnoten gibt es nur die Dokumentweise
+/*N*/ //Nummerierung.
+/*N*/ if( FTNNUM_CHAPTER == rFtnInfo.eNum )
+/*N*/ {
+/*?*/ const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+/*?*/ USHORT nNo = 1, // Nummer fuer die Fussnoten
+/*?*/ nFtnIdx = 0; // Index in das FtnIdx-Array
+/*?*/ for( USHORT n = 0; n < rOutlNds.Count(); ++n )
+/*?*/ {
+/*?*/ if( !rOutlNds[ n ]->GetTxtNode()->GetTxtColl()->GetOutlineLevel() )
+/*?*/ {
+/*?*/ ULONG nCapStt = rOutlNds[ n ]->GetIndex(); // Start eines neuen Kapitels
+/*?*/ for( ; nFtnIdx < Count(); ++nFtnIdx )
+/*?*/ {
+/*?*/ pTxtFtn = (*this)[ nFtnIdx ];
+/*?*/ if( pTxtFtn->GetTxtNode().GetIndex() >= nCapStt )
+/*?*/ break;
+/*?*/
+/*?*/ // Endnoten nur Dokumentweise
+/*?*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*?*/ if( !rFtn.IsEndNote() && !rFtn.GetNumStr().Len() &&
+/*?*/ !SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( *pTxtFtn ))
+/*?*/ pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nNo++,
+/*?*/ &rFtn.GetNumStr() );
+/*?*/ }
+/*?*/ if( nFtnIdx >= Count() )
+/*?*/ break; // ok alles geupdatet
+/*?*/ nNo = 1;
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ for( nNo = 1; nFtnIdx < Count(); ++nFtnIdx )
+/*?*/ {
+/*?*/ //Endnoten nur Dokumentweise
+/*?*/ pTxtFtn = (*this)[ nFtnIdx ];
+/*?*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*?*/ if( !rFtn.IsEndNote() && !rFtn.GetNumStr().Len() &&
+/*?*/ !SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( *pTxtFtn ))
+/*?*/ pTxtFtn->SetNumber( rFtnInfo.nFtnOffset + nNo++,
+/*?*/ &rFtn.GetNumStr() );
+/*?*/ }
+/*?*/
+/*N*/ }
+
+ // BOOL, damit hier auch bei Chapter-Einstellung die Endnoten
+ // durchlaufen.
+/*N*/ const FASTBOOL bEndNoteOnly = FTNNUM_DOC != rFtnInfo.eNum;
+/*N*/ USHORT nFtnNo = 0, nEndNo = 0;
+/*N*/ for( USHORT nPos = 0; nPos < Count(); ++nPos )
+/*N*/ {
+/*N*/ pTxtFtn = (*this)[ nPos ];
+/*N*/ const SwFmtFtn &rFtn = pTxtFtn->GetFtn();
+/*N*/ if( !rFtn.GetNumStr().Len() )
+/*N*/ {
+/*?*/ USHORT nSectNo = aNumArr.ChkNumber( *pTxtFtn );
+/*?*/ if( !nSectNo && ( rFtn.IsEndNote() || !bEndNoteOnly ))
+/*?*/ nSectNo = rFtn.IsEndNote()
+/*?*/ ? rEndInfo.nFtnOffset + (++nEndNo)
+/*?*/ : rFtnInfo.nFtnOffset + (++nFtnNo);
+/*?*/
+/*?*/ if( nSectNo )
+/*?*/ {
+/*?*/ if( rFtn.IsEndNote() )
+/*?*/ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+/*?*/ else
+/*?*/ pTxtFtn->SetNumber( nSectNo, &rFtn.GetNumStr() );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pDoc->GetRootFrm() && FTNNUM_PAGE == rFtnInfo.eNum )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pDoc->GetRootFrm()->UpdateFtnNums();
+/*N*/ }
+
+
+/*N*/ SwTxtFtn* SwFtnIdxs::SeekEntry( const SwNodeIndex& rPos, USHORT* pFndPos ) const
+/*N*/ {
+/*N*/ ULONG nIdx = rPos.GetIndex();
+/*N*/
+/*N*/ register USHORT nO = Count(), nM, nU = 0;
+/*N*/ if( nO > 0 )
+/*N*/ {
+/*N*/ nO--;
+/*N*/ while( nU <= nO )
+/*N*/ {
+/*N*/ nM = nU + ( nO - nU ) / 2;
+/*N*/ ULONG nNdIdx = _SwTxtFtn_GetIndex( (*this)[ nM ] );
+/*N*/ if( nNdIdx == nIdx )
+/*N*/ {
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nM;
+/*N*/ return (*this)[ nM ];
+/*N*/ }
+/*N*/ else if( nNdIdx < nIdx )
+/*N*/ nU = nM + 1;
+/*N*/ else if( nM == 0 )
+/*N*/ {
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nU;
+/*N*/ return 0;
+/*N*/ }
+/*N*/ else
+/*N*/ nO = nM - 1;
+/*N*/ }
+/*N*/ }
+/*?*/ if( pFndPos )
+/*?*/ *pFndPos = nU;
+/*?*/ return 0;
+/*N*/ }
+
+/* */
+
+/*N*/ const SwSectionNode* SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr(
+/*N*/ const SwTxtFtn& rTxtFtn )
+/*N*/ {
+/*N*/ USHORT nWh = rTxtFtn.GetFtn().IsEndNote() ? RES_END_AT_TXTEND
+/*N*/ : RES_FTN_AT_TXTEND;
+/*N*/ USHORT nVal;
+/*N*/ const SwSectionNode* pNd = rTxtFtn.GetTxtNode().FindSectionNode();
+/*N*/ while( pNd && FTNEND_ATTXTEND_OWNNUMSEQ != ( nVal =
+/*N*/ ((const SwFmtFtnAtTxtEnd&)pNd->GetSection().GetFmt()->
+/*N*/ GetAttr( nWh, TRUE )).GetValue() ) &&
+/*N*/ FTNEND_ATTXTEND_OWNNUMANDFMT != nVal )
+/*?*/ pNd = pNd->FindStartNode()->FindSectionNode();
+/*N*/
+/*N*/ return pNd;
+/*N*/ }
+
+/*N*/ USHORT SwUpdFtnEndNtAtEnd::GetNumber( const SwTxtFtn& rTxtFtn,
+/*N*/ const SwSectionNode& rNd )
+/*N*/ {
+ USHORT nRet = 0, nWh;
+ SvPtrarr* pArr;
+ SvUShorts* pNum;
+ if( rTxtFtn.GetFtn().IsEndNote() )
+ {
+ pArr = &aEndSects;
+ pNum = &aEndNums;
+ nWh = RES_END_AT_TXTEND;
+ }
+ else
+ {
+ pArr = &aFtnSects;
+ pNum = &aFtnNums;
+ nWh = RES_FTN_AT_TXTEND;
+ }
+ void* pNd = (void*)&rNd;
+
+ for( USHORT n = pArr->Count(); n; )
+ if( pArr->GetObject( --n ) == pNd )
+ {
+ nRet = ++pNum->GetObject( n );
+ break;
+ }
+
+ if( !nRet )
+ {
+ pArr->Insert( pNd, pArr->Count() );
+ nRet = ((SwFmtFtnEndAtTxtEnd&)rNd.GetSection().GetFmt()->
+ GetAttr( nWh )).GetOffset();
+ ++nRet;
+ pNum->Insert( nRet, pNum->Count() );
+ }
+ return nRet;
+/*N*/ }
+
+/*N*/ USHORT SwUpdFtnEndNtAtEnd::ChkNumber( const SwTxtFtn& rTxtFtn )
+/*N*/ {
+/*N*/ const SwSectionNode* pSectNd = FindSectNdWithEndAttr( rTxtFtn );
+/*N*/ return pSectNd ? GetNumber( rTxtFtn, *pSectNd ) : 0;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_gctable.cxx b/binfilter/bf_sw/source/core/doc/sw_gctable.cxx
new file mode 100644
index 000000000000..b9a1b3c57519
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_gctable.cxx
@@ -0,0 +1,478 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/boxitem.hxx>
+
+#include <errhdl.hxx>
+#include <tblrwcl.hxx>
+#include <swtblfmt.hxx>
+namespace binfilter {
+
+
+ inline const SvxBorderLine* GetLineTB( const SvxBoxItem* pBox, BOOL bTop )
+ {
+ return bTop ? pBox->GetTop() : pBox->GetBottom();
+ }
+
+
+BOOL _SwGCBorder_BoxBrd::CheckLeftBorderOfFormat( const SwFrmFmt& rFmt )
+{
+ const SvxBorderLine* pBrd;
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rFmt.GetItemState( RES_BOX, TRUE, &pItem ) &&
+ 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetLeft() ) )
+ {
+ if( *pBrdLn == *pBrd )
+ bAnyBorderFnd = TRUE;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+
+BOOL lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& rpLine, void* pPara )
+{
+ const SwTableBox* pBox = rpLine->GetTabBoxes()[ 0 ];
+ return lcl_GCBorder_ChkBoxBrd_B( pBox, pPara );
+}
+
+BOOL lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& rpBox, void* pPara )
+{
+ BOOL bRet = TRUE;
+ if( rpBox->GetTabLines().Count() )
+ {
+ for( USHORT n = 0, nLines = rpBox->GetTabLines().Count();
+ n < nLines && bRet; ++n )
+ {
+ const SwTableLine* pLine = rpBox->GetTabLines()[ n ];
+ bRet = lcl_GCBorder_ChkBoxBrd_L( pLine, pPara );
+ }
+ }
+ else
+ {
+ _SwGCBorder_BoxBrd* pBPara = (_SwGCBorder_BoxBrd*)pPara;
+ bRet = pBPara->CheckLeftBorderOfFormat( *rpBox->GetFrmFmt() );
+ }
+ return bRet;
+}
+
+BOOL lcl_GCBorder_GetLastBox_L( const SwTableLine*& rpLine, void* pPara )
+{
+ const SwTableBoxes& rBoxes = rpLine->GetTabBoxes();
+ const SwTableBox* pBox = rBoxes[ rBoxes.Count()-1 ];
+ lcl_GCBorder_GetLastBox_B( pBox, pPara );
+ return TRUE;
+}
+
+BOOL lcl_GCBorder_GetLastBox_B( const SwTableBox*& rpBox, void* pPara )
+{
+ SwTableLines& rLines = (SwTableLines&)rpBox->GetTabLines();
+ if( rLines.Count() )
+ rLines.ForEach( &lcl_GCBorder_GetLastBox_L, pPara );
+ else
+ ((SwTableBoxes*)pPara)->Insert( rpBox, ((SwTableBoxes*)pPara)->Count() );
+ return TRUE;
+}
+
+// suche das "Ende" der vorgegebene BorderLine. Returnt wird die "Layout"Pos!
+USHORT lcl_FindEndPosOfBorder( const SwCollectTblLineBoxes& rCollTLB,
+ const SvxBorderLine& rBrdLn, USHORT& rStt, BOOL bTop )
+{
+ USHORT nPos, nLastPos = 0;
+ for( USHORT nEnd = rCollTLB.Count(); rStt < nEnd; ++rStt )
+ {
+ const SfxPoolItem* pItem;
+ const SvxBorderLine* pBrd;
+ const SwTableBox& rBox = rCollTLB.GetBox( rStt, &nPos );
+
+ if( SFX_ITEM_SET != rBox.GetFrmFmt()->GetItemState(RES_BOX,TRUE, &pItem )
+ || 0 == ( pBrd = ::binfilter::GetLineTB( (SvxBoxItem*)pItem, bTop ))
+ || !( *pBrd == rBrdLn ))
+ break;
+ nLastPos = nPos;
+ }
+ return nLastPos;
+}
+
+ inline const SvxBorderLine* lcl_GCBorder_GetBorder( const SwTableBox& rBox,
+ BOOL bTop,
+ const SfxPoolItem** ppItem )
+ {
+ return SFX_ITEM_SET == rBox.GetFrmFmt()->GetItemState( RES_BOX, TRUE, ppItem )
+ ? ::binfilter::GetLineTB( (SvxBoxItem*)*ppItem, bTop )
+ : 0;
+ }
+
+void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB,
+ USHORT& rStt, BOOL bTop,
+ const SvxBorderLine& rLine,
+ const SfxPoolItem* pItem,
+ USHORT nEndPos,
+ SwShareBoxFmts* pShareFmts )
+{
+ SwTableBox* pBox = (SwTableBox*)&rCollTLB.GetBox( rStt );
+ USHORT nNextPos;
+ const SvxBorderLine* pLn = &rLine;
+
+ do {
+ if( pLn && *pLn == rLine )
+ {
+ SvxBoxItem aBox( *(SvxBoxItem*)pItem );
+ if( bTop )
+ aBox.SetLine( 0, BOX_LINE_TOP );
+ else
+ aBox.SetLine( 0, BOX_LINE_BOTTOM );
+
+ if( pShareFmts )
+ pShareFmts->SetAttr( *pBox, aBox );
+ else
+ pBox->ClaimFrmFmt()->SetAttr( aBox );
+ }
+
+ if( ++rStt >= rCollTLB.Count() )
+ break;
+
+ pBox = (SwTableBox*)&rCollTLB.GetBox( rStt, &nNextPos );
+ if( nNextPos > nEndPos )
+ break;
+
+ pLn = ::binfilter::lcl_GCBorder_GetBorder( *pBox, bTop, &pItem );
+
+ } while( TRUE );
+}
+
+
+BOOL lcl_GC_Line_Border( const SwTableLine*& rpLine, void* pPara )
+{
+ _SwGCLineBorder* pGCPara = (_SwGCLineBorder*)pPara;
+
+ // zuerst die rechte Kante mit der linken Kante der naechsten Box
+ // innerhalb dieser Line
+ {
+ _SwGCBorder_BoxBrd aBPara;
+ const SvxBorderLine* pBrd;
+ const SfxPoolItem* pItem;
+ const SwTableBoxes& rBoxes = rpLine->GetTabBoxes();
+ for( USHORT n = 0, nBoxes = rBoxes.Count() - 1; n < nBoxes; ++n )
+ {
+ SwTableBoxes aBoxes;
+ {
+ const SwTableBox* pBox = rBoxes[ n ];
+ if( pBox->GetSttNd() )
+ aBoxes.Insert( pBox, 0 );
+ else
+ ::binfilter::lcl_GCBorder_GetLastBox_B( pBox, &aBoxes );
+ }
+
+ SwTableBox* pBox;
+ for( USHORT i = aBoxes.Count(); i; )
+ if( SFX_ITEM_SET == (pBox = aBoxes[ --i ])->GetFrmFmt()->
+ GetItemState( RES_BOX, TRUE, &pItem ) &&
+ 0 != ( pBrd = ((SvxBoxItem*)pItem)->GetRight() ) )
+ {
+ aBPara.SetBorder( *pBrd );
+ const SwTableBox* pNextBox = rBoxes[n+1];
+ if( lcl_GCBorder_ChkBoxBrd_B( pNextBox, &aBPara ) &&
+ aBPara.IsAnyBorderFound() )
+ {
+ SvxBoxItem aBox( *(SvxBoxItem*)pItem );
+ aBox.SetLine( 0, BOX_LINE_RIGHT );
+ if( pGCPara->pShareFmts )
+ pGCPara->pShareFmts->SetAttr( *pBox, aBox );
+ else
+ pBox->ClaimFrmFmt()->SetAttr( aBox );
+ }
+ }
+
+ aBoxes.Remove( 0, aBoxes.Count() );
+ }
+ }
+
+ // und jetzt die eigene untere Kante mit der nachfolgenden oberen Kante
+ if( !pGCPara->IsLastLine() )
+ {
+ SwCollectTblLineBoxes aBottom( FALSE );
+ SwCollectTblLineBoxes aTop( TRUE );
+
+ ::binfilter::lcl_Line_CollectBox( rpLine, &aBottom );
+
+ const SwTableLine* pNextLine = (*pGCPara->pLines)[ pGCPara->nLinePos+1 ];
+ ::binfilter::lcl_Line_CollectBox( pNextLine, &aTop );
+
+ // dann entferne mal alle "doppelten" gleichen Lines
+ USHORT nBtmPos, nTopPos,
+ nSttBtm = 0, nSttTop = 0,
+ nEndBtm = aBottom.Count(), nEndTop = aTop.Count();
+
+ const SwTableBox *pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos ),
+ *pTopBox = &aTop.GetBox( nSttTop++, &nTopPos );
+ const SfxPoolItem *pBtmItem, *pTopItem;
+ const SvxBorderLine *pBtmLine, *pTopLine;
+ BOOL bGetTopItem = TRUE, bGetBtmItem = TRUE;
+
+ do {
+ if( bGetBtmItem )
+ pBtmLine = ::binfilter::lcl_GCBorder_GetBorder( *pBtmBox, FALSE, &pBtmItem );
+ if( bGetTopItem )
+ pTopLine = ::binfilter::lcl_GCBorder_GetBorder( *pTopBox, TRUE, &pTopItem );
+
+ if( pTopLine && pBtmLine && *pTopLine == *pBtmLine )
+ {
+ // dann kann einer entfernt werden, aber welche?
+ USHORT nSavSttBtm = nSttBtm, nSavSttTop = nSttTop;
+ USHORT nBtmEndPos = ::binfilter::lcl_FindEndPosOfBorder( aBottom,
+ *pTopLine, nSttBtm, FALSE );
+ if( !nBtmEndPos ) nBtmEndPos = nBtmPos;
+ USHORT nTopEndPos = ::binfilter::lcl_FindEndPosOfBorder( aTop,
+ *pTopLine, nSttTop, TRUE );
+ if( !nTopEndPos ) nTopEndPos = nTopPos;
+
+
+ if( nTopEndPos <= nBtmEndPos )
+ {
+ // dann die TopBorder bis zur BottomEndPos loeschen
+ nSttTop = nSavSttTop;
+ if( nTopPos <= nBtmEndPos )
+ ::binfilter::lcl_GCBorder_DelBorder( aTop, --nSttTop, TRUE,
+ *pBtmLine, pTopItem, nBtmEndPos,
+ pGCPara->pShareFmts );
+ else
+ nSttBtm = nSavSttBtm;
+ }
+ else
+ {
+ // sonst die BottomBorder bis zur TopEndPos loeschen
+ nSttBtm = nSavSttBtm;
+ if( nBtmPos <= nTopEndPos )
+ ::binfilter::lcl_GCBorder_DelBorder( aBottom, --nSttBtm, FALSE,
+ *pTopLine, pBtmItem, nTopEndPos,
+ pGCPara->pShareFmts );
+ else
+ nSttTop = nSavSttTop;
+ }
+ nTopPos = nBtmPos;
+ }
+
+ if( nTopPos == nBtmPos )
+ {
+ if( nSttBtm >= nEndBtm || nSttTop >= nEndTop )
+ break;
+
+ pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos );
+ pTopBox = &aTop.GetBox( nSttTop++, &nTopPos );
+ bGetTopItem = bGetBtmItem = TRUE;
+ }
+ else if( nTopPos < nBtmPos )
+ {
+ if( nSttTop >= nEndTop )
+ break;
+ pTopBox = &aTop.GetBox( nSttTop++, &nTopPos );
+ bGetTopItem = TRUE;
+ bGetBtmItem = FALSE;
+ }
+ else
+ {
+ if( nSttBtm >= nEndBtm )
+ break;
+ pBtmBox = &aBottom.GetBox( nSttBtm++, &nBtmPos );
+ bGetTopItem = FALSE;
+ bGetBtmItem = TRUE;
+ }
+
+ } while( TRUE );
+ }
+
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_GC_Box_Border, pPara );
+
+ ++pGCPara->nLinePos;
+
+ return TRUE;
+}
+
+
+BOOL lcl_GC_Box_Border( const SwTableBox*& rpBox, void* pPara )
+{
+ if( rpBox->GetTabLines().Count() )
+ {
+ _SwGCLineBorder aPara( *rpBox );
+ aPara.pShareFmts = ((_SwGCLineBorder*)pPara)->pShareFmts;
+ ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_GC_Line_Border, &aPara );
+ }
+ return TRUE;
+}
+
+
+void SwTable::GCBorderLines()
+{
+ // alle doppleten Borderlines benachbarter Tabellen-Content-Boxen
+ // entfernen. Und zwar wird versucht, die Struktur unserer default
+ // Border wiederherzustellen, die wie folgt aussieht:
+ //
+ // +-- +--+
+ // | | |
+ // +-- +--+
+ //
+ // | | |
+ // +-- +--+
+
+ SwShareBoxFmts aShareFmts;
+ _SwGCLineBorder aPara( *this );
+ aPara.pShareFmts = &aShareFmts;
+ GetTabLines().ForEach( &::binfilter::lcl_GC_Line_Border, &aPara );
+}
+
+/* */
+
+struct _GCLinePara
+{
+ SwTableLines* pLns;
+ SwShareBoxFmts* pShareFmts;
+
+ _GCLinePara( SwTableLines& rLns, _GCLinePara* pPara = 0 )
+ : pLns( &rLns ), pShareFmts( pPara ? pPara->pShareFmts : 0 )
+ {}
+};
+
+/*N*/ BOOL lcl_MergeGCBox( const SwTableBox*& rpTblBox, void* pPara )
+/*N*/ {
+/*N*/ SwTableBox*& rpBox = (SwTableBox*&)rpTblBox;
+/*N*/ USHORT n, nLen = rpBox->GetTabLines().Count();
+/*N*/ if( nLen )
+/*N*/ {
+/*N*/ // ACHTUNG: die Anzahl der Lines kann sich aendern!
+/*N*/ _GCLinePara aPara( rpBox->GetTabLines(), (_GCLinePara*)pPara );
+/*N*/ for( n = 0; n < rpBox->GetTabLines().Count() &&
+/*N*/ lcl_MergeGCLine( *(rpBox->GetTabLines().GetData() + n), &aPara );
+/*N*/ ++n )
+/*N*/ ;
+/*N*/
+/*N*/ if( 1 == rpBox->GetTabLines().Count() )
+/*N*/ {
+/*N*/ // Box mit einer Line, dann verschiebe alle Boxen der Line
+/*N*/ // hinter diese Box in der Parent-Line und loesche diese Box
+/*?*/ SwTableLine* pInsLine = rpBox->GetUpper();
+/*?*/ SwTableLine* pCpyLine = rpBox->GetTabLines()[0];
+/*?*/ USHORT nInsPos = pInsLine->GetTabBoxes().C40_GETPOS( SwTableBox, rpBox );
+/*?*/ for( n = 0; n < pCpyLine->GetTabBoxes().Count(); ++n )
+/*?*/ pCpyLine->GetTabBoxes()[n]->SetUpper( pInsLine );
+/*?*/
+/*?*/ pInsLine->GetTabBoxes().Insert( &pCpyLine->GetTabBoxes(), nInsPos+1 );
+/*?*/ pCpyLine->GetTabBoxes().Remove( 0, n );
+/*?*/ // loesche alte die Box mit der Line
+/*?*/ pInsLine->GetTabBoxes().DeleteAndDestroy( nInsPos );
+/*?*/
+/*?*/ return FALSE; // neu aufsetzen
+/*N*/ }
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara )
+/*N*/ {
+/*N*/ SwTableLine* pLn = (SwTableLine*)rpLine;
+/*N*/ USHORT nLen = pLn->GetTabBoxes().Count();
+/*N*/ if( nLen )
+/*N*/ {
+/*N*/ _GCLinePara* pGCPara = (_GCLinePara*)pPara;
+/*N*/ while( 1 == nLen )
+/*N*/ {
+/*N*/ // es gibt eine Box mit Lines
+/*N*/ SwTableBox* pBox = pLn->GetTabBoxes()[0];
+/*N*/ if( !pBox->GetTabLines().Count() )
+/*N*/ break;
+/*N*/
+/*N*/ SwTableLine* pLine = pBox->GetTabLines()[0];
+/*N*/
+/*N*/ // pLine wird zu der aktuellen, also der rpLine,
+/*N*/ // die restlichen werden ins LinesArray hinter der akt.
+/*N*/ // verschoben.
+/*N*/ // Das LinesArray ist im pPara!
+/*N*/ nLen = pBox->GetTabLines().Count();
+/*N*/
+/*N*/ SwTableLines& rLns = *pGCPara->pLns;
+/*N*/ const SwTableLine* pTmp = pLn;
+/*N*/ USHORT nInsPos = rLns.GetPos( pTmp );
+/*N*/ ASSERT( USHRT_MAX != nInsPos, "Line nicht gefunden!" );
+/*N*/
+/*N*/ SwTableBox* pUpper = pLn->GetUpper();
+/*N*/
+/*N*/ rLns.Remove( nInsPos, 1 ); // die Line dem aus Array loeschen
+/*N*/ rLns.Insert( &pBox->GetTabLines(), nInsPos );
+/*N*/
+/*N*/ // JP 31.03.99: Bug 60000 - die Attribute der zu loeschenden
+/*N*/ // Line an die "eingefuegten" uebertragen
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pLn->GetFrmFmt()->GetItemState(
+/*N*/ RES_BACKGROUND, TRUE, &pItem ))
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ pBox->GetTabLines().Remove( 0, nLen ); // Lines aus Array loeschen
+/*N*/
+/*N*/ delete pLn;
+/*N*/
+/*N*/ // Abhaengigkeit neu setzen
+/*N*/ while( nLen-- )
+/*N*/ rLns[ nInsPos++ ]->SetUpper( pUpper );
+/*N*/
+/*N*/ pLn = pLine; // und neu setzen
+/*N*/ nLen = pLn->GetTabBoxes().Count();
+/*N*/ }
+/*N*/
+/*N*/ // ACHTUNG: die Anzahl der Boxen kann sich aendern!
+/*N*/ for( nLen = 0; nLen < pLn->GetTabBoxes().Count(); ++nLen )
+/*N*/ if( !lcl_MergeGCBox( *(pLn->GetTabBoxes().GetData() + nLen ), pPara ))
+/*N*/ --nLen;
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+ // Struktur ein wenig aufraeumen
+/*N*/ void SwTable::GCLines()
+/*N*/ {
+/*N*/ // ACHTUNG: die Anzahl der Lines kann sich aendern!
+/*N*/ _GCLinePara aPara( GetTabLines() );
+/*N*/ SwShareBoxFmts aShareFmts;
+/*N*/ aPara.pShareFmts = &aShareFmts;
+/*N*/ for( USHORT n = 0; n < GetTabLines().Count() &&
+/*N*/ lcl_MergeGCLine( *(GetTabLines().GetData() + n ), &aPara ); ++n )
+/*N*/ ;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_htmltbl.cxx b/binfilter/bf_sw/source/core/doc/sw_htmltbl.cxx
new file mode 100644
index 000000000000..ed9658ad517e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_htmltbl.cxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+//#define TEST_DELAYED_RESIZE
+
+#ifdef TEST_DELAYED_RESIZE
+#endif
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+
+#include "htmltbl.hxx"
+namespace binfilter {
+
+#define COLFUZZY 20
+#define MAX_TABWIDTH (USHRT_MAX - 2001)
+
+/*N*/ SwHTMLTableLayout::~SwHTMLTableLayout()
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+// Die Breiten der Umrandung werden zunaechst wie in Netscape berechnet:
+// Aussere Umrandung: BORDER + CELLSPACING + CELLPADDING
+// Innere Umrandung: CELLSPACING + CELLPADDING
+// Allerdings wird die Breite der Umrandung im SW trotzdem beachtet, wenn
+// bSwBorders gesetzt ist, damit nicht faellschlich umgebrochen wird.
+// MIB 27.6.97: Dabei muss auch der Abstand zum Inhalt berueckichtigt werden,
+// und zwar auch dann, wenn wenn nur die gegenueberliegende Seite
+// eine Umrandung hat.
+
+
+
+
+
+
+
+
+
+
+
+
+
+// nAbsAvail ist der verfuegbare Platz in TWIPS.
+// nRelAvail ist der auf USHRT_MAX bezogene verfuegbare Platz oder 0
+// nAbsSpace ist der Anteil von nAbsAvail, der durch der umgebende Zelle
+// fur die Umrandung und den Abstand zum Inhalt reserviert ist.
+
+
+
+
+
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_lineinfo.cxx b/binfilter/bf_sw/source/core/doc/sw_lineinfo.cxx
new file mode 100644
index 000000000000..864ad4013188
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_lineinfo.cxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "lineinfo.hxx"
+#include "charfmt.hxx"
+#include "poolfmt.hxx"
+#include "rootfrm.hxx"
+#include "viewsh.hxx"
+namespace binfilter {
+
+/*N*/ void SwDoc::SetLineNumberInfo( const SwLineNumberInfo &rNew )
+/*N*/ {
+/*N*/ if ( GetRootFrm() &&
+/*N*/ (rNew.IsCountBlankLines() != pLineNumberInfo->IsCountBlankLines() ||
+/*N*/ rNew.IsRestartEachPage() != pLineNumberInfo->IsRestartEachPage()) )
+/*N*/ {
+/*?*/ GetRootFrm()->StartAllAction();
+/*?*/ GetRootFrm()->InvalidateAllCntnt( INV_LINENUM );
+/*?*/ GetRootFrm()->EndAllAction();
+/*N*/ }
+/*N*/ *pLineNumberInfo = rNew;
+/*N*/ SetModified();
+/*N*/ }
+
+/*N*/ SwLineNumberInfo::SwLineNumberInfo() :
+/*N*/ nPosFromLeft( MM50 ),
+/*N*/ nCountBy( 5 ),
+/*N*/ nDividerCountBy( 3 ),
+/*N*/ ePos( LINENUMBER_POS_LEFT ),
+/*N*/ bPaintLineNumbers( FALSE ),
+/*N*/ bCountBlankLines( TRUE ),
+/*N*/ bCountInFlys( FALSE ),
+/*N*/ bRestartEachPage( FALSE )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwLineNumberInfo::SwLineNumberInfo(const SwLineNumberInfo &rCpy ) :
+/*N*/ aType( rCpy.GetNumType() ),
+/*N*/ aDivider( rCpy.GetDivider() ),
+/*N*/ nPosFromLeft( rCpy.GetPosFromLeft() ),
+/*N*/ nCountBy( rCpy.GetCountBy() ),
+/*N*/ nDividerCountBy( rCpy.GetDividerCountBy() ),
+/*N*/ ePos( rCpy.GetPos() ),
+/*N*/ bPaintLineNumbers( rCpy.IsPaintLineNumbers() ),
+/*N*/ bCountBlankLines( rCpy.IsCountBlankLines() ),
+/*N*/ bCountInFlys( rCpy.IsCountInFlys() ),
+/*N*/ bRestartEachPage( rCpy.IsRestartEachPage() )
+/*N*/ {
+/*N*/ if ( rCpy.GetRegisteredIn() )
+/*?*/ ((SwModify*)rCpy.GetRegisteredIn())->Add( this );
+/*N*/ }
+
+/*N*/ SwLineNumberInfo& SwLineNumberInfo::operator=(const SwLineNumberInfo &rCpy)
+/*N*/ {
+/*N*/ if ( rCpy.GetRegisteredIn() )
+/*N*/ ((SwModify*)rCpy.GetRegisteredIn())->Add( this );
+/*N*/ else if ( GetRegisteredIn() )
+/*?*/ pRegisteredIn->Remove( this );
+/*N*/
+/*N*/ aType = rCpy.GetNumType();
+/*N*/ aDivider = rCpy.GetDivider();
+/*N*/ nPosFromLeft = rCpy.GetPosFromLeft();
+/*N*/ nCountBy = rCpy.GetCountBy();
+/*N*/ nDividerCountBy = rCpy.GetDividerCountBy();
+/*N*/ ePos = rCpy.GetPos();
+/*N*/ bPaintLineNumbers = rCpy.IsPaintLineNumbers();
+/*N*/ bCountBlankLines = rCpy.IsCountBlankLines();
+/*N*/ bCountInFlys = rCpy.IsCountInFlys();
+/*N*/ bRestartEachPage = rCpy.IsRestartEachPage();
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+
+/*N*/ SwCharFmt* SwLineNumberInfo::GetCharFmt(SwDoc &rDoc) const
+/*N*/ {
+/*N*/ if ( !GetRegisteredIn() )
+/*?*/ {
+/*?*/ SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( RES_POOLCHR_LINENUM );
+/*?*/ pFmt->Add( (SwClient*)this );
+/*?*/ }
+/*N*/ return (SwCharFmt*)GetRegisteredIn();
+/*N*/ }
+
+/*N*/ void SwLineNumberInfo::SetCharFmt( SwCharFmt *pChFmt )
+/*N*/ {
+/*N*/ ASSERT( pChFmt, "SetCharFmt, 0 is not a valid pointer" );
+/*N*/ pChFmt->Add( this );
+/*N*/ }
+
+/*N*/ void SwLineNumberInfo::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ SwClient::Modify( pOld, pNew );
+/*N*/ SwDoc *pDoc = ((SwCharFmt*)GetRegisteredIn())->GetDoc();
+/*N*/ SwRootFrm* pRoot = pDoc->GetRootFrm();
+/*N*/ if( pRoot && pRoot->GetCurrShell() )
+/*N*/ {
+/*?*/ pRoot->StartAllAction();
+/*?*/ pRoot->GetCurrShell()->AddPaintRect( pRoot->Frm() );
+/*?*/ pRoot->EndAllAction();
+/*N*/ }
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_notxtfrm.cxx b/binfilter/bf_sw/source/core/doc/sw_notxtfrm.cxx
new file mode 100644
index 000000000000..4c5d723b1838
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_notxtfrm.cxx
@@ -0,0 +1,436 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+
+#include <horiornt.hxx>
+
+#include <vcl/window.hxx>
+
+#include <fmtsrnd.hxx>
+#include <frmfmt.hxx>
+#include <errhdl.hxx>
+#include <viscrs.hxx>
+#include <fesh.hxx>
+#include <doc.hxx>
+#include <flyfrm.hxx>
+#include <frmtool.hxx>
+#include <viewopt.hxx>
+#include <hints.hxx>
+#include <dflyobj.hxx>
+#include <notxtfrm.hxx>
+#include <ndgrf.hxx>
+#include <frmsh.hxx>
+
+#include <mdiexp.hxx>
+#include <comcore.hrc>
+namespace binfilter {
+
+#define DEFTEXTSIZE 12
+
+// OD 25.09.2002 #99739# - insert declaration of global methods <SwAlignRect>
+// and <SwAlignGrtRect>.
+// Methods are implemented in /core/layout/paintfrm.cxx
+// OD 24.01.2003 #106593# - no longer needed, included in <frmtool.hxx>
+//extern void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh );
+//extern void SwAlignGrfRect( SwRect *pGrfRect, const OutputDevice &rOut );
+
+//Zum asynchronen (erstmaligem) anfordern von Grafiken
+
+
+extern void ClrContourCache( const SdrObject *pObj ); // TxtFly.Cxx
+
+
+
+
+
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* SwGrfFrm::SwGrfFrm(ViewShell * const,SwGrfNode *)
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 03. Mar. 93
+|*
+*************************************************************************/
+
+
+/*N*/ SwNoTxtFrm::SwNoTxtFrm(SwNoTxtNode * const pNode)
+/*N*/ : SwCntntFrm(pNode)
+/*N*/ {
+/*N*/ InitCtor();
+/*N*/ }
+
+// Initialisierung: z.Zt. Eintragen des Frames im Cache
+
+
+/*N*/ void SwNoTxtFrm::InitCtor()
+/*N*/ {
+/*N*/ nType = FRMC_NOTXT;
+/*N*/ // Das Gewicht der Grafik ist 0, wenn sie noch nicht
+/*N*/ // gelesen ist, < 0, wenn ein Lesefehler auftrat und
+/*N*/ // Ersatzdarstellung angewendet werden musste und >0,
+/*N*/ // wenn sie zur Verfuegung steht.
+/*N*/ nWeight = 0;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwNoTxtNode::MakeFrm()
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 03. Mar. 93
+|*
+*************************************************************************/
+
+
+/*N*/ SwCntntFrm *SwNoTxtNode::MakeFrm()
+/*N*/ {
+/*N*/ return new SwNoTxtFrm(this);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::~SwNoTxtFrm()
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 30. Apr. 96
+|*
+*************************************************************************/
+
+/*N*/ SwNoTxtFrm::~SwNoTxtFrm()
+/*N*/ {
+/*N*/ StopAnimation();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* void SwNoTxtFrm::Modify( SwHint * pOld, SwHint * pNew )
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung JP 05.03.91
+|*
+*************************************************************************/
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* void SwNoTxtFrm::Paint()
+|*
+|* Beschreibung
+|* Ersterstellung JP 05.03.91
+|* Letzte Aenderung MA 10. Jan. 97
+|*
+*************************************************************************/
+
+/*N*/ void SwNoTxtFrm::Paint( const SwRect &rRect ) const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*************************************************************************
+|*
+|* void lcl_CalcRect( Point & aPt, Size & aDim,
+|* USHORT nMirror )
+|*
+|* Beschreibung Errechne die Position und die Groesse der Grafik im
+|* Frame, entsprechen der aktuellen Grafik-Attribute
+|*
+|* Parameter Point& die Position im Frame ( auch Return-Wert )
+|* Size& die Groesse der Grafik ( auch Return-Wert )
+|* MirrorGrf akt. Spiegelungs-Attribut
+|* Ersterstellung JP 04.03.91
+|* Letzte Aenderung JP 31.08.94
+|*
+*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* void SwNoTxtFrm::GetGrfArea()
+|*
+|* Beschreibung Errechne die Position und die Groesse der Bitmap
+|* innerhalb des uebergebenem Rechtecks.
+|*
+|* Ersterstellung JP 03.09.91
+|* Letzte Aenderung MA 11. Oct. 94
+|*
+*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* Size SwNoTxtFrm::GetSize()
+|*
+|* Beschreibung Gebe die Groesse des umgebenen FLys und
+|* damit die der Grafik zurueck.
+|* Ersterstellung JP 04.03.91
+|* Letzte Aenderung JP 31.08.94
+|*
+*************************************************************************/
+
+
+/*N*/ const Size& SwNoTxtFrm::GetSize() const
+/*N*/ {
+/*N*/ // gebe die Groesse des Frames zurueck
+/*N*/ const SwFrm *pFly = FindFlyFrm();
+/*N*/ if( !pFly )
+/*?*/ pFly = this;
+/*N*/ return pFly->Prt().SSize();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::MakeAll()
+|*
+|* Ersterstellung MA 29. Nov. 96
+|* Letzte Aenderung MA 29. Nov. 96
+|*
+*************************************************************************/
+
+
+/*N*/ void SwNoTxtFrm::MakeAll()
+/*N*/ {
+/*N*/ SwCntntNotify aNotify( this );
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/
+/*N*/ while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ MakePos();
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ Frm().Width( GetUpper()->Prt().Width() );
+/*N*/
+/*N*/ MakePrtArea( rAttrs );
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ { bValidSize = TRUE;
+/*N*/ Format();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::Format()
+|*
+|* Beschreibung Errechne die Groesse der Bitmap, wenn noetig
+|* Ersterstellung JP 11.03.91
+|* Letzte Aenderung MA 13. Mar. 96
+|*
+*************************************************************************/
+
+
+/*M*/ void SwNoTxtFrm::Format( const SwBorderAttrs * )
+/*M*/ {
+/*M*/ const Size aNewSize( GetSize() );
+/*M*/
+/*M*/ // hat sich die Hoehe geaendert?
+/*M*/ SwTwips nChgHght = IsVertical() ?
+/*M*/ (SwTwips)(aNewSize.Width() - Prt().Width()) :
+/*M*/ (SwTwips)(aNewSize.Height() - Prt().Height());
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ if( nChgHght > 0)
+/*M*/ Grow( nChgHght );
+/*M*/ else if( nChgHght < 0)
+/*M*/ Shrink( Min(Prt().Height(), -nChgHght) );
+/*M*/ #else
+/*M*/ const SzPtr pVar = pVARSIZE;
+/*M*/ if( nChgHght > 0)
+/*M*/ Grow( nChgHght, pVar );
+/*M*/ else if( nChgHght < 0)
+/*M*/ Shrink( Min(Prt().Height(), -nChgHght), pVar );
+/*M*/ #endif
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwNoTxtFrm::GetCharRect()
+|*
+|* Beschreibung
+|* Ersterstellung SS 29-Apr-1991
+|* Letzte Aenderung MA 10. Oct. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos,
+/*N*/ SwCrsrMoveState *pCMS ) const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ BOOL SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& aPoint,
+/*N*/ const SwCrsrMoveState* ) const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ #define CLEARCACHE( pNd ) {\
+/*N*/ (pNd)->GetGrfObj().ReleaseFromCache();\
+/*N*/ SwFlyFrm* pFly = FindFlyFrm();\
+/*N*/ if( pFly && pFly->GetFmt()->GetSurround().IsContour() )\
+/*N*/ {\
+/*N*/ ClrContourCache( pFly->GetVirtDrawObj() );\
+/*N*/ pFly->NotifyBackground( FindPageFrm(), Prt(), PREP_FLY_ATTR_CHG );\
+/*N*/ }\
+/*N*/ }
+
+/*N*/ void SwNoTxtFrm::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ USHORT nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0;
+/*N*/
+/*N*/ if ( RES_GRAPHIC_PIECE_ARRIVED != nWhich &&
+/*N*/ RES_GRAPHIC_ARRIVED != nWhich &&
+/*N*/ RES_GRF_REREAD_AND_INCACHE != nWhich )
+/*N*/ SwCntntFrm::Modify( pOld, pNew );
+/*N*/
+/*N*/ FASTBOOL bCompletePaint = TRUE;
+/*N*/
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_OBJECTDYING:
+/*N*/ break;
+/*N*/
+/*?*/ case RES_GRF_REREAD_AND_INCACHE:
+/*?*/ if( ND_GRFNODE == GetNode()->GetNodeType() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 bCompletePaint = FALSE;
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*N*/ case RES_UPDATE_ATTR:
+/*N*/ case RES_FMT_CHG:
+/*N*/ CLEARCACHE( (SwGrfNode*) GetNode() )
+/*N*/ break;
+/*N*/
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ {
+ USHORT n;
+/*N*/ for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n )
+/*N*/ if( SFX_ITEM_SET == ((SwAttrSetChg*)pOld)->GetChgSet()->
+/*N*/ GetItemState( n, FALSE ))
+/*N*/ {
+/*N*/ CLEARCACHE( (SwGrfNode*) GetNode() )
+/*N*/ break;
+/*N*/ }
+/*N*/ if( RES_GRFATR_END == n ) // not found
+/*N*/ return ;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_GRAPHIC_PIECE_ARRIVED:
+/*N*/ case RES_GRAPHIC_ARRIVED:
+/*N*/ if ( GetNode()->GetNodeType() == ND_GRFNODE )
+/*N*/ {
+/*N*/ bCompletePaint = FALSE;
+/*N*/ SwGrfNode* pNd = (SwGrfNode*) GetNode();
+/*N*/
+/*N*/ CLEARCACHE( pNd )
+/*N*/
+/*N*/ SwRect aRect( Frm() );
+/*N*/
+/*N*/ ViewShell *pVSh = 0;
+/*N*/ pNd->GetDoc()->GetEditShell( &pVSh );
+/*N*/ if( !pVSh )
+/*N*/ break;
+/*N*/
+/*N*/ ViewShell *pSh = pVSh;
+/*N*/ do {
+/*N*/ SET_CURR_SHELL( pSh );
+/*N*/ if( pSh->IsPreView() )
+/*N*/ {
+/*?*/ if( pSh->GetWin() )
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ::binfilter::RepaintPagePreview( pSh, aRect );
+/*?*/ }
+/*?*/ else if ( pSh->VisArea().IsOver( aRect ) &&
+/*?*/ OUTDEV_WINDOW == pSh->GetOut()->GetOutDevType() )
+/*?*/ {
+/*?*/ // OD 27.11.2002 #105519# - invalidate instead of painting
+/*?*/ pSh->GetWin()->Invalidate( aRect.SVRect() );
+/*?*/ }
+/*N*/
+/*N*/ pSh = (ViewShell *)pSh->GetNext();
+/*N*/ } while( pSh != pVSh );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*?*/ if( !pNew || RES_GRFATR_BEGIN > nWhich || nWhich >= RES_GRFATR_END )
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ if( bCompletePaint )
+/*N*/ {
+/*N*/ InvalidatePrt();
+/*N*/ SetCompletePaint();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwNoTxtFrm::StopAnimation( OutputDevice* pOut ) const
+/*N*/ {
+/*N*/ //animierte Grafiken anhalten
+/*N*/ SwGrfNode* pGrfNd = (SwGrfNode*)GetNode()->GetGrfNode();
+/*N*/ if( pGrfNd && pGrfNd->IsAnimated() )
+/*N*/ pGrfNd->GetGrfObj().StopAnimation( pOut, long(this) );
+/*N*/ }
+
+
+/*N*/ BOOL SwNoTxtFrm::HasAnimation() const
+/*N*/ {
+/*N*/ const SwGrfNode* pGrfNd = GetNode()->GetGrfNode();
+/*N*/ return pGrfNd && pGrfNd->IsAnimated();
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_number.cxx b/binfilter/bf_sw/source/core/doc/sw_number.cxx
new file mode 100644
index 000000000000..9834b1b35c9b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_number.cxx
@@ -0,0 +1,631 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <string.h>
+
+#include <vcl/font.hxx>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <fmtornt.hxx>
+#include <doc.hxx>
+#include <charfmt.hxx>
+#include <paratr.hxx>
+#include <ndtxt.hxx>
+#include <docary.hxx>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+USHORT SwNumRule::nRefCount = 0;
+SwNumFmt* SwNumRule::aBaseFmts[ RULE_END ][ MAXLEVEL ] = {
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0 };
+
+Font* SwNumRule::pDefBulletFont = 0;
+sal_Char* SwNumRule::pDefOutlineName = "Outline";
+
+USHORT SwNumRule::aDefNumIndents[ MAXLEVEL ] = {
+//cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
+ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+};
+
+#if defined( UNX ) && defined( GCC )
+extern const sal_Char __FAR_DATA sBulletFntName[];
+const sal_Char __FAR_DATA sBulletFntName[] = "StarSymbol";
+#else
+extern const sal_Char __FAR_DATA sBulletFntName[] = "StarSymbol";
+#endif
+
+/*N*/ inline void lcl_SetRuleChgd( SwTxtNode& rNd, BYTE nLevel )
+/*N*/ {
+/*N*/ if( rNd.GetNum() &&
+/*N*/ (~NO_NUMLEVEL & rNd.GetNum()->GetLevel() ) == nLevel )
+/*N*/ rNd.NumRuleChgd();
+/*N*/ }
+/* -----------------------------22.02.01 13:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwNumFmt::SwNumFmt() :
+/*N*/ SwClient( 0 ),
+/*N*/ SvxNumberFormat(SVX_NUM_ARABIC),
+/*N*/ pVertOrient(new SwFmtVertOrient( 0, VERT_NONE))
+/*N*/ {
+/*N*/ }
+/* -----------------------------22.02.01 13:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwNumFmt::SwNumFmt( const SwNumFmt& rFmt) :
+/*N*/ SwClient( rFmt.pRegisteredIn ),
+/*N*/ SvxNumberFormat(rFmt),
+/*N*/ pVertOrient(new SwFmtVertOrient( 0, (SwVertOrient)rFmt.GetVertOrient()))
+/*N*/ {
+/*N*/ SvxFrameVertOrient eVertOrient = rFmt.GetVertOrient();
+/*N*/ SetGraphicBrush( rFmt.GetBrush(), &rFmt.GetGraphicSize(),
+/*N*/ &eVertOrient);
+/*N*/ }
+/* -----------------------------22.02.01 13:58--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwNumFmt::SwNumFmt(const SvxNumberFormat& rNumFmt, SwDoc* pDoc) :
+/*N*/ SvxNumberFormat(rNumFmt),
+/*N*/ pVertOrient(new SwFmtVertOrient( 0, (SwVertOrient)rNumFmt.GetVertOrient()))
+/*N*/ {
+/*N*/ SvxFrameVertOrient eVertOrient = rNumFmt.GetVertOrient();
+/*N*/ SetGraphicBrush( rNumFmt.GetBrush(), &rNumFmt.GetGraphicSize(),
+/*N*/ &eVertOrient);
+/*N*/ const String& rCharStyleName = rNumFmt.SvxNumberFormat::GetCharFmtName();
+/*N*/ if( rCharStyleName.Len() )
+/*N*/ {
+/*N*/ SwCharFmt* pCFmt = pDoc->FindCharFmtByName( rCharStyleName );
+/*N*/ if( !pCFmt )
+/*N*/ {
+/*N*/ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rCharStyleName,
+/*N*/ GET_POOLID_CHRFMT );
+/*?*/ pCFmt = nId != USHRT_MAX
+/*?*/ ? pDoc->GetCharFmtFromPool( nId )
+/*?*/ : pDoc->MakeCharFmt( rCharStyleName, 0 );
+/*N*/ }
+/*N*/ pCFmt->Add( this );
+/*N*/ }
+/*N*/ else if( GetRegisteredIn() )
+/*?*/ pRegisteredIn->Remove( this );
+
+/*N*/ }
+/* -----------------------------22.02.01 13:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwNumFmt::~SwNumFmt()
+/*N*/ {
+/*N*/ delete pVertOrient;
+/*N*/ }
+/* -----------------------------02.07.01 15:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwNumFmt::NotifyGraphicArrived()
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/* -----------------------------23.02.01 09:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwNumFmt& SwNumFmt::operator=( const SwNumFmt& rNumFmt)
+/*N*/ {
+/*N*/ SvxNumberFormat::operator=(rNumFmt);
+/*N*/ if( rNumFmt.GetRegisteredIn() )
+/*N*/ rNumFmt.pRegisteredIn->Add( this );
+/*N*/ else if( GetRegisteredIn() )
+/*?*/ pRegisteredIn->Remove( this );
+/*N*/ return *this;
+/*N*/ }
+/* -----------------------------23.02.01 09:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ BOOL SwNumFmt::operator==( const SwNumFmt& rNumFmt) const
+/*N*/ {
+/*N*/ BOOL bRet = SvxNumberFormat::operator==(rNumFmt) &&
+/*N*/ pRegisteredIn == rNumFmt.pRegisteredIn;
+/*N*/ return bRet;
+/*N*/ }
+
+/* -----------------------------22.02.01 13:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ const Graphic* SwNumFmt::GetGraphic() const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return 0; //STRIP001
+/*N*/ }
+/* -----------------------------22.02.01 13:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwNumFmt::SetCharFmt( SwCharFmt* pChFmt)
+/*N*/ {
+/*N*/ if( pChFmt )
+/*N*/ pChFmt->Add( this );
+/*N*/ else if( GetRegisteredIn() )
+/*?*/ pRegisteredIn->Remove( this );
+/*N*/ }
+/* -----------------------------22.02.01 13:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwNumFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ // dann suche mal in dem Doc nach dem NumRules-Object, in dem dieses
+/*N*/ // NumFormat gesetzt ist. Das Format muss es nicht geben!
+/*N*/ const SwCharFmt* pFmt = 0;
+/*N*/ switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
+/*N*/ {
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ case RES_FMT_CHG:
+/*N*/ pFmt = GetCharFmt();
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pFmt && !pFmt->GetDoc()->IsInDtor() )
+/*N*/ UpdateNumNodes( (SwDoc*)pFmt->GetDoc() );
+/*N*/ else
+/*N*/ SwClient::Modify( pOld, pNew );
+/*N*/ }
+/* -----------------------------23.02.01 11:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwNumFmt::SetCharFmtName(const String& rSet)
+/*N*/ {
+/*N*/ SvxNumberFormat::SetCharFmtName(rSet);
+/*N*/ }
+/* -----------------------------22.02.01 13:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ const String& SwNumFmt::GetCharFmtName() const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return aEmptyStr;
+/*N*/ }
+/* -----------------------------22.02.01 16:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwNumFmt::SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize,
+/*N*/ const SvxFrameVertOrient* pOrient)
+/*N*/ {
+/*N*/ if(pOrient)
+/*N*/ pVertOrient->SetVertOrient( (SwVertOrient)*pOrient );
+/*N*/ SvxNumberFormat::SetGraphicBrush( pBrushItem, pSize, pOrient);
+/*N*/ }
+/* -----------------------------22.02.01 16:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwNumFmt::SetVertOrient(SvxFrameVertOrient eSet)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/* -----------------------------22.02.01 16:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SvxFrameVertOrient SwNumFmt::GetVertOrient() const
+/*N*/ {
+/*N*/ return SvxNumberFormat::GetVertOrient();
+/*N*/ }
+/* -----------------------------22.02.01 13:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwNumFmt::UpdateNumNodes( SwDoc* pDoc )
+/*N*/ {
+/*N*/ BOOL bDocIsModified = pDoc->IsModified();
+/*N*/ BOOL bFnd = FALSE;
+/*N*/ const SwNumRule* pRule;
+/*N*/ for( USHORT n = pDoc->GetNumRuleTbl().Count(); !bFnd && n; )
+/*N*/ {
+/*N*/ pRule = pDoc->GetNumRuleTbl()[ --n ];
+/*N*/ for( BYTE i = 0; i < MAXLEVEL; ++i )
+/*N*/ if( pRule->GetNumFmt( i ) == this )
+/*N*/ {
+/*N*/ const String& rRuleNm = pRule->GetName();
+/*N*/
+/*N*/ SwModify* pMod;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT k, nMaxItems = pDoc->GetAttrPool().GetItemCount(
+/*N*/ RES_PARATR_NUMRULE );
+/*N*/ for( k = 0; k < nMaxItems; ++k )
+/*N*/ if( 0 != (pItem = pDoc->GetAttrPool().GetItem(
+/*N*/ RES_PARATR_NUMRULE, k ) ) &&
+/*N*/ 0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->
+/*N*/ GetDefinedIn()) &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue() == rRuleNm )
+/*N*/ {
+/*N*/ if( pMod->IsA( TYPE( SwFmt )) )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwNumRuleInfo aInfo( rRuleNm );
+/*?*/ }
+/*N*/ else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
+/*N*/ lcl_SetRuleChgd( *(SwTxtNode*)pMod, i );
+/*N*/ }
+/*N*/ bFnd = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !bFnd )
+/*N*/ {
+/*?*/ pRule = pDoc->GetOutlineNumRule();
+/*?*/ for( BYTE i = 0; i < MAXLEVEL; ++i )
+/*?*/ if( pRule->GetNumFmt( i ) == this )
+/*?*/ {
+/*?*/ ULONG nStt = pDoc->GetNodes().GetEndOfContent().StartOfSectionIndex();
+/*?*/ const SwTxtFmtColls& rColls = *pDoc->GetTxtFmtColls();
+/*?*/ for( USHORT n = 1; n < rColls.Count(); ++n )
+/*?*/ {
+/*?*/ const SwTxtFmtColl* pColl = rColls[ n ];
+/*?*/ if( i == pColl->GetOutlineLevel() )
+/*?*/ {
+/*?*/ SwClientIter aIter( *(SwTxtFmtColl*)pColl );
+/*?*/ for( SwTxtNode* pNd = (SwTxtNode*)aIter.First( TYPE( SwTxtNode ));
+/*?*/ pNd; pNd = (SwTxtNode*)aIter.Next() )
+/*?*/ if( pNd->GetNodes().IsDocNodes() &&
+/*?*/ nStt < pNd->GetIndex() &&
+/*?*/ pNd->GetOutlineNum() && i == (~NO_NUMLEVEL &
+/*?*/ pNd->GetOutlineNum()->GetLevel() ) )
+/*?*/ pNd->NumRuleChgd();
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ bFnd = TRUE;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*N*/
+/*N*/ if( bFnd && !bDocIsModified )
+/*?*/ pDoc->ResetModified();
+/*N*/ }
+/* -----------------------------31.05.01 16:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ const SwFmtVertOrient* SwNumFmt::GetGraphicOrientation() const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return 0;//STRIP001
+/*N*/ }
+
+/*N*/ BOOL SwNodeNum::operator==( const SwNodeNum& rNum ) const
+/*N*/ {
+/*N*/ return nMyLevel == rNum.nMyLevel &&
+/*N*/ nSetValue == rNum.nSetValue &&
+/*N*/ bStartNum == rNum.bStartNum &&
+/*N*/ ( nMyLevel >= MAXLEVEL ||
+/*N*/ 0 == memcmp( nLevelVal, rNum.nLevelVal,
+/*N*/ sizeof( USHORT ) * (nMyLevel+1) ));
+/*N*/ }
+
+/*N*/ SwNumRule::SwNumRule( const String& rNm, SwNumRuleType eType, BOOL bAutoFlg )
+/*N*/ : eRuleType( eType ),
+/*N*/ sName( rNm ),
+/*N*/ bAutoRuleFlag( bAutoFlg ),
+/*N*/ bInvalidRuleFlag( TRUE ),
+/*N*/ bContinusNum( FALSE ),
+/*N*/ bAbsSpaces( FALSE ),
+/*N*/ nPoolFmtId( USHRT_MAX ),
+/*N*/ nPoolHelpId( USHRT_MAX ),
+/*N*/ nPoolHlpFileId( UCHAR_MAX )
+/*N*/ {
+/*N*/ if( !nRefCount++ ) // zum erstmal, also initialisiern
+/*N*/ {
+/*N*/ SwNumFmt* pFmt;
+/*N*/ // Nummerierung:
+ int n=0;
+/*N*/ for( n = 0; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ pFmt = new SwNumFmt;
+/*N*/ pFmt->SetIncludeUpperLevels( 1 );
+/*N*/ pFmt->SetStart( 1 );
+/*N*/ pFmt->SetLSpace( lNumIndent );
+/*N*/ pFmt->SetAbsLSpace( SwNumRule::GetNumIndent( n ) );
+/*N*/ pFmt->SetFirstLineOffset( lNumFirstLineOffset );
+/*N*/ pFmt->SetSuffix( aDotStr );
+/*N*/ SwNumRule::aBaseFmts[ NUM_RULE ][ n ] = pFmt;
+/*N*/ }
+/*N*/
+/*N*/ // Gliederung:
+/*N*/ for( n = 0; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ pFmt = new SwNumFmt;
+/*N*/ //JP 18.01.96: heute soll es mal wieder vollstaendig numeriert werden
+/*N*/ //JP 10.03.96: und nun mal wieder nicht
+/*N*/ pFmt->SetNumberingType(SVX_NUM_NUMBER_NONE);
+/*N*/ pFmt->SetIncludeUpperLevels( MAXLEVEL );
+/*N*/ // pFmt->eType = ARABIC;
+/*N*/ pFmt->SetStart( 1 );
+/*N*/ SwNumRule::aBaseFmts[ OUTLINE_RULE ][ n ] = pFmt;
+/*N*/ }
+/*N*/ }
+/*N*/ memset( aFmts, 0, sizeof( aFmts ));
+/*N*/ ASSERT( sName.Len(), "NumRule ohne Namen!" );
+/*N*/ }
+
+/*N*/ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
+/*N*/ : eRuleType( rNumRule.eRuleType ),
+/*N*/ sName( rNumRule.sName ),
+/*N*/ bAutoRuleFlag( rNumRule.bAutoRuleFlag ),
+/*N*/ bInvalidRuleFlag( TRUE ),
+/*N*/ bContinusNum( rNumRule.bContinusNum ),
+/*N*/ bAbsSpaces( rNumRule.bAbsSpaces ),
+/*N*/ nPoolFmtId( rNumRule.GetPoolFmtId() ),
+/*N*/ nPoolHelpId( rNumRule.GetPoolHelpId() ),
+/*N*/ nPoolHlpFileId( rNumRule.GetPoolHlpFileId() )
+/*N*/ {
+/*N*/ ++nRefCount;
+/*N*/ memset( aFmts, 0, sizeof( aFmts ));
+/*N*/ for( USHORT n = 0; n < MAXLEVEL; ++n )
+/*N*/ if( rNumRule.aFmts[ n ] )
+/*N*/ Set( n, *rNumRule.aFmts[ n ] );
+/*N*/ }
+/*N*/
+/*N*/ SwNumRule::~SwNumRule()
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < MAXLEVEL; ++n )
+/*N*/ delete aFmts[ n ];
+/*N*/
+/*N*/ if( !--nRefCount ) // der letzte macht die Tuer zu
+/*N*/ {
+/*N*/ // Nummerierung:
+/*N*/ SwNumFmt** ppFmts = (SwNumFmt**)SwNumRule::aBaseFmts;
+ int n=0;
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
+/*N*/ delete *ppFmts, *ppFmts = 0;
+/*N*/
+/*N*/ // Gliederung:
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++ppFmts )
+/*N*/ delete *ppFmts, *ppFmts = 0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ void SwNumRule::_MakeDefBulletFont()
+/*N*/ {
+/*N*/ pDefBulletFont = new Font( String::CreateFromAscii( sBulletFntName ),
+/*N*/ aEmptyStr, Size( 0, 14 ) );
+/*N*/ pDefBulletFont->SetCharSet( RTL_TEXTENCODING_SYMBOL );
+/*N*/ pDefBulletFont->SetFamily( FAMILY_DONTKNOW );
+/*N*/ pDefBulletFont->SetPitch( PITCH_DONTKNOW );
+/*N*/ pDefBulletFont->SetWeight( WEIGHT_DONTKNOW );
+/*N*/ pDefBulletFont->SetTransparent( TRUE );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ void SwNumRule::CheckCharFmts( SwDoc* pDoc )
+/*N*/ {
+/*N*/ SwCharFmt* pFmt;
+/*N*/ for( BYTE n = 0; n < MAXLEVEL; ++n )
+/*N*/ if( aFmts[ n ] && 0 != ( pFmt = aFmts[ n ]->GetCharFmt() ) &&
+/*N*/ pFmt->GetDoc() != pDoc )
+/*N*/ {
+/*N*/ // dann kopieren!
+/*N*/ SwNumFmt* pNew = new SwNumFmt( *aFmts[ n ] );
+/*N*/ pNew->SetCharFmt( pDoc->CopyCharFmt( *pFmt ) );
+/*N*/ delete aFmts[ n ];
+/*N*/ aFmts[ n ] = pNew;
+/*N*/ }
+/*N*/ }
+
+ // setzt Num oder NoNum fuer den Level am TextNode UND setzt die
+ // richtige Attributierung
+
+
+/*N*/ SwNumRule& SwNumRule::operator=( const SwNumRule& rNumRule )
+/*N*/ {
+/*N*/ if( this != &rNumRule )
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < MAXLEVEL; ++n )
+/*N*/ Set( n, rNumRule.aFmts[ n ] );
+/*N*/
+/*N*/ eRuleType = rNumRule.eRuleType;
+/*N*/ sName = rNumRule.sName;
+/*N*/ bAutoRuleFlag = rNumRule.bAutoRuleFlag;
+/*N*/ bInvalidRuleFlag = TRUE;
+/*N*/ bContinusNum = rNumRule.bContinusNum;
+/*N*/ bAbsSpaces = rNumRule.bAbsSpaces;
+/*N*/ nPoolFmtId = rNumRule.GetPoolFmtId();
+/*N*/ nPoolHelpId = rNumRule.GetPoolHelpId();
+/*N*/ nPoolHlpFileId = rNumRule.GetPoolHlpFileId();
+/*N*/ }
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ BOOL SwNumRule::operator==( const SwNumRule& rRule ) const
+/*N*/ {
+/*N*/ BOOL bRet = eRuleType == rRule.eRuleType &&
+/*N*/ sName == rRule.sName &&
+/*N*/ bAutoRuleFlag == rRule.bAutoRuleFlag &&
+/*N*/ bContinusNum == rRule.bContinusNum &&
+/*N*/ bAbsSpaces == rRule.bAbsSpaces &&
+/*N*/ nPoolFmtId == rRule.GetPoolFmtId() &&
+/*N*/ nPoolHelpId == rRule.GetPoolHelpId() &&
+/*N*/ nPoolHlpFileId == rRule.GetPoolHlpFileId();
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ for( BYTE n = 0; n < MAXLEVEL; ++n )
+/*N*/ if( !( rRule.Get( n ) == Get( n ) ))
+/*N*/ {
+/*N*/ bRet = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ void SwNumRule::Set( USHORT i, const SwNumFmt& rNumFmt )
+/*N*/ {
+/*N*/ if( !aFmts[ i ] || !(rNumFmt == Get( i )) )
+/*N*/ {
+/*N*/ delete aFmts[ i ];
+/*N*/ aFmts[ i ] = new SwNumFmt( rNumFmt );
+/*N*/ bInvalidRuleFlag = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ void SwNumRule::Set( USHORT i, const SwNumFmt* pNumFmt )
+/*N*/ {
+/*N*/ SwNumFmt* pOld = aFmts[ i ];
+/*N*/ if( !pOld )
+/*N*/ {
+/*N*/ if( pNumFmt )
+/*N*/ {
+/*N*/ aFmts[ i ] = new SwNumFmt( *pNumFmt );
+/*N*/ bInvalidRuleFlag = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( !pNumFmt )
+/*?*/ delete pOld, aFmts[ i ] = 0, bInvalidRuleFlag = TRUE;
+/*N*/ else if( *pOld != *pNumFmt )
+/*N*/ *pOld = *pNumFmt, bInvalidRuleFlag = TRUE;
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ String SwNumRule::MakeNumString( const SwNodeNum& rNum, BOOL bInclStrings,
+/*N*/ BOOL bOnlyArabic ) const
+/*N*/ {
+/*N*/ String aStr;
+/*N*/ if( NO_NUM > rNum.GetLevel() && !( NO_NUMLEVEL & rNum.GetLevel() ) )
+/*N*/ {
+/*N*/ const SwNumFmt& rMyNFmt = Get( rNum.GetLevel() );
+/*N*/ if( SVX_NUM_NUMBER_NONE != rMyNFmt.GetNumberingType() )
+/*N*/ {
+/*N*/ BYTE i = rNum.GetLevel();
+/*N*/
+/*N*/ if( !IsContinusNum() &&
+/*N*/ rMyNFmt.GetIncludeUpperLevels() ) // nur der eigene Level ?
+/*N*/ {
+/*N*/ BYTE n = rMyNFmt.GetIncludeUpperLevels();
+/*N*/ if( 1 < n )
+/*N*/ {
+/*N*/ if( i+1 >= n )
+/*N*/ i -= n - 1;
+/*N*/ else
+/*N*/ i = 0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ for( ; i <= rNum.GetLevel(); ++i )
+/*N*/ {
+/*N*/ const SwNumFmt& rNFmt = Get( i );
+/*N*/ if( SVX_NUM_NUMBER_NONE == rNFmt.GetNumberingType() )
+/*N*/ {
+/*N*/ // Soll aus 1.1.1 --> 2. NoNum --> 1..1 oder 1.1 ??
+/*N*/ // if( i != rNum.nMyLevel )
+/*N*/ // aStr += aDotStr;
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ if( rNum.GetLevelVal()[ i ] )
+/*N*/ {
+/*N*/ if( bOnlyArabic )
+/*?*/ aStr += String::CreateFromInt32( rNum.GetLevelVal()[ i ] );
+/*N*/ else
+/*N*/ aStr += rNFmt.GetNumStr( rNum.GetLevelVal()[ i ] );
+/*N*/ }
+/*N*/ else
+/*N*/ aStr += '0'; // alle 0-Level sind eine 0
+/*N*/ if( i != rNum.GetLevel() && aStr.Len() )
+/*N*/ aStr += aDotStr;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //JP 14.12.99: the type dont have any number, so dont append
+/*N*/ // the Post-/Prefix String
+/*N*/ if( bInclStrings && !bOnlyArabic &&
+/*N*/ SVX_NUM_CHAR_SPECIAL != rMyNFmt.GetNumberingType() &&
+/*N*/ SVX_NUM_BITMAP != rMyNFmt.GetNumberingType() )
+/*N*/ {
+/*N*/ aStr.Insert( rMyNFmt.GetPrefix(), 0 );
+/*N*/ aStr += rMyNFmt.GetSuffix();
+/*N*/ }
+/*N*/ }
+/*N*/ return aStr;
+/*N*/ }
+
+// ----- Copy-Methode vom SwNumRule ------
+
+ // eine Art Copy-Constructor, damit die Num-Formate auch an den
+ // richtigen CharFormaten eines Dokumentes haengen !!
+ // (Kopiert die NumFormate und returnt sich selbst)
+
+/* -----------------30.10.98 08:33-------------------
+ *
+ * --------------------------------------------------*/
+/*N*/ void SwNumRule::SetSvxRule(const SvxNumRule& rNumRule, SwDoc* pDoc)
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ const SvxNumberFormat* pSvxFmt = rNumRule.Get(n);
+/*N*/ delete aFmts[n];
+/*N*/ aFmts[n] = pSvxFmt ? new SwNumFmt(*pSvxFmt, pDoc) : 0;
+/*N*/ }
+
+// eRuleType = rNumRule.eRuleType;
+// sName = rNumRule.sName;
+// bAutoRuleFlag = rNumRule.bAutoRuleFlag;
+/*N*/ bInvalidRuleFlag = TRUE;
+/*N*/ bContinusNum = rNumRule.IsContinuousNumbering();
+//!!! bAbsSpaces = rNumRule.IsAbsSpaces();
+/*N*/ }
+/* -----------------30.10.98 08:33-------------------
+ *
+ * --------------------------------------------------*/
+/*N*/ SvxNumRule SwNumRule::MakeSvxNumRule() const
+/*N*/ {
+/*N*/ SvxNumRule aRule(NUM_CONTINUOUS|NUM_CHAR_TEXT_DISTANCE|NUM_CHAR_STYLE|
+/*N*/ NUM_ENABLE_LINKED_BMP|NUM_ENABLE_EMBEDDED_BMP,
+/*N*/ MAXLEVEL,
+/*N*/ eRuleType ==
+/*N*/ NUM_RULE ?
+/*N*/ SVX_RULETYPE_NUMBERING :
+/*N*/ SVX_RULETYPE_OUTLINE_NUMBERING );
+/*N*/ aRule.SetContinuousNumbering(bContinusNum);
+/*N*/ //!!! aRule.SetAbsSpaces( bAbsSpaces );
+/*N*/ for( USHORT n = 0; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ SwNumFmt aNumFmt = Get(n);
+/*N*/ if(aNumFmt.GetCharFmt())
+/*N*/ aNumFmt.SetCharFmtName(aNumFmt.GetCharFmt()->GetName());
+/*N*/ aRule.SetLevel(n, aNumFmt, aFmts[n] != 0);
+/*N*/ }
+/*N*/ return aRule;
+/*N*/ }
+
+/* #109308# */
+void SwNumRule::SetNumAdjust(SvxAdjust eNumAdjust)
+{
+ for (int i = 0; i < MAXLEVEL; i++)
+ aFmts[i]->SetNumAdjust(eNumAdjust);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_numpara.cxx b/binfilter/bf_sw/source/core/doc/sw_numpara.cxx
new file mode 100644
index 000000000000..69685333d451
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_numpara.cxx
@@ -0,0 +1,291 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+#include "doc.hxx"
+#include "docsh.hxx"
+#include "ndtxt.hxx"
+
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include "numpara.hxx"
+#include "number.hxx"
+
+
+
+#ifdef JP_DEBUG
+
+#include <svwindow.hxx>
+namespace binfilter {
+
+class GrfWindow : public WorkWindow, public Timer
+{
+ Graphic aGrf;
+ Size aSz;
+ virtual void Timeout();
+ virtual void Paint( const Rectangle& );
+public:
+ GrfWindow( const Graphic& rGrf );
+ virtual ~GrfWindow();
+};
+
+GrfWindow::GrfWindow( const Graphic& rGrf )
+ : WorkWindow( GetpApp()->GetAppWindow() ), aGrf( rGrf )
+{
+ SetTimeout( 10000 );
+
+ aSz = ::GetGraphicSizeTwip( &rGrf );
+ SetMapMode( MapMode( MAP_TWIP ));
+ SetPosSizePixel( Point( 100, 0 ), LogicToPixel( aSz ));
+ Show();
+ Invalidate();
+ Update();
+ Start();
+}
+SEXPORT GrfWindow::~GrfWindow()
+{
+}
+void SEXPORT GrfWindow::Timeout()
+{
+ delete this;
+}
+void SEXPORT GrfWindow::Paint( const Rectangle& )
+{
+ aGrf.Draw( this, Point(0,0), PixelToLogic( GetSizePixel() ) );
+}
+
+#endif
+
+// waehrend des Nummerierens ist das Undo am Doc abgeschaltet !!!
+
+
+_NumPara::_NumPara( char nOffset, const SwNodeIndex& rNdIdx,
+ const SwNumSection& rSect, ULONG nCntNodes )
+ : aNdIdx( rNdIdx ),
+ rNumSection( rSect ),
+ aNum( 0, rSect.pRules ),
+ nCnt( nCntNodes ),
+ nDiff( nOffset )
+{
+ bInitNum = rNdIdx.GetIndex() <= rNumSection.aStart.GetIndex();
+ _Init();
+}
+
+
+_NumPara::_NumPara( const SwNodeIndex& rNdIdx, const SwNumSection& rSect )
+ : aNdIdx( rNdIdx ),
+ rNumSection( rSect ),
+ aNum( 0, rSect.pRules ),
+ nCnt( 0 ),
+ nDiff( 0 )
+{
+ bInitNum = rNdIdx.GetIndex() <= rNumSection.aStart.GetIndex();
+ _Init();
+}
+
+
+BOOL lcl_GoPrevNd( SwNodeIndex* pIdx )
+{
+ // ACHTUNG: Tabellen ueberspringen !
+ BOOL bRet = TRUE;
+ SwEndNode* pEndNd;
+ SwNodeIndex aIdx( *pIdx, -1 );
+ while( 0 != ( pEndNd = aIdx.GetNode().GetEndNode() ) &&
+ pEndNd->FindStartNode()->IsTableNode() )
+ {
+ aIdx = *pEndNd->StartOfSectionNode();
+ bRet = 0 != pEndNd->GetNodes().GoPrevious( &aIdx );
+ if( !bRet )
+ break; // weiter gehts nicht
+ }
+ if( bRet )
+ *pIdx = aIdx;
+ return bRet;
+}
+
+
+void _NumPara::_Init()
+{
+ bOverTbl = FALSE;
+ SwDoc* pDoc = aNdIdx.GetNodes().GetDoc();
+
+ if( !bInitNum ) // hole vom Vorgaenger die aktuelle Nummerierung
+ {
+ const SwNodes& rNds = aNdIdx.GetNodes();
+ SwTxtNode* pTxtNd = 0;
+ SwNodeIndex aIdx( aNdIdx );
+ while( lcl_GoPrevNd( &aIdx ) && ( !pTxtNd ||
+ (NO_NUM == pTxtNd->GetpSwpHints()->GetNum().nMyLevel ||
+ NO_NUMLEVEL & pTxtNd->GetpSwpHints()->GetNum().nMyLevel )) &&
+ rNumSection.aStart.GetIndex() <= aIdx.GetIndex() )
+ pTxtNd = rNds[ aIdx ]->GetTxtNode();
+
+ ASSERT( pTxtNd, "NumSection ohne Start-TextNode? " );
+ aNum = pTxtNd->GetpSwpHints()->GetNum();
+ aNum.pRules = rNumSection.pRules;
+ if( NO_NUM == aNum.nMyLevel || NO_NUMLEVEL & aNum.nMyLevel )
+ {
+ aNum.nMyLevel = 0;
+ aNum.nLevelVal[ 0 ] = aNum.pRules->Get( 0 ).GetStartValue();
+ bInitNum = TRUE;
+ }
+ }
+ else
+ aNum.nLevelVal[ 0 ] = aNum.pRules->Get( 0 ).GetStartValue();
+
+ nOldLevel = aNum.nMyLevel;
+}
+
+
+_NumPara::~_NumPara()
+{
+ SwDoc* pDoc = aNdIdx.GetNodes().GetDoc();
+}
+
+
+void _NumPara::UpdateNum( SwTxtNode& rTxtNd )
+{
+ BYTE nLevel = aNum.nMyLevel;
+ BYTE nNdOldLvl = MAXLEVEL;
+ if( rTxtNd.GetpSwpHints() )
+ {
+ const SwNum& rNum = rTxtNd.GetpSwpHints()->GetNum();
+ if( NO_NUMBERING != rNum.nMyLevel &&
+ (!rNum.pRules || NUM_RULES == rNum.pRules->GetRulesType() ))
+ nNdOldLvl = nLevel = rNum.nMyLevel;
+ }
+
+ if( NO_NUMLEVEL & nLevel ) // NoNum mit Ebene
+ {
+ if( ( -1 == nDiff && NO_NUMLEVEL < nLevel ) ||
+ ( 1 == nDiff && ( NO_NUMLEVEL + MAXLEVEL - 1 ) > nLevel ) )
+ nLevel += nDiff;
+ aNum.nMyLevel = nLevel;
+
+ rTxtNd.UpdateNum( aNum );
+ }
+ else if( NO_NUM != nLevel )
+ {
+ if( ( -1 == nDiff && 0 < nLevel ) || ( 1 == nDiff && MAXLEVEL-1 > nLevel ))
+ nLevel += nDiff;
+
+ BYTE nTmpLvl = aNum.nMyLevel & ~NO_NUMLEVEL;
+ if( nTmpLvl < nLevel )
+ {
+ // Erfrage wie geloescht werden soll:
+ // z.B von Stufe 0 -> 1: 1 -> 0.1 ; wenn nStart = 1
+ // aber Stufe 1 -> 2: 1.1 -> 1.1.1 !!, nur 0.1 -> 0.0.1
+ if( !bInitNum )
+ ++nTmpLvl;
+
+ memset( aNum.nLevelVal + nTmpLvl, 0,
+ (MAXLEVEL - nTmpLvl) * sizeof( aNum.nLevelVal[0]) );
+ aNum.nLevelVal[ nLevel ] = aNum.pRules->Get( nLevel ).GetStartValue();
+ }
+ else if( !aNum.nLevelVal[ nLevel ] )
+ aNum.nLevelVal[ nLevel ] = aNum.pRules->Get( nLevel ).GetStartValue();
+ else if( !bInitNum )
+ aNum.nLevelVal[ nLevel ]++;
+
+ bInitNum = FALSE;
+ aNum.nMyLevel = nLevel;
+
+ // beim Format mit Bitmap die Graphicen schon mal anfordern
+ const SwNumFmt* pNumFmt = aNum.GetNumFmt();
+ if( pNumFmt && USER_BITMAP == pNumFmt->eType )
+ {
+ SwDoc* pDoc = aNdIdx.GetNodes().GetDoc();
+ const Graphic* pGrf = pNumFmt->GetGrfBrush()->
+ GetGraphic( pDoc->GetDocShell() );
+
+#ifdef JP_DEBUG
+ new GrfWindow( *pGrf );
+#endif
+ }
+
+ rTxtNd.UpdateNum( aNum );
+ }
+ else
+ ((SwNum&)rTxtNd.GetpSwpHints()->GetNum()).pRules = aNum.pRules;
+
+ // falls keine Nummerierung mehr gueltig ist, steht in "nOldLevel"
+ // der letze gueltiege (0..MAXLEVEL) Level.
+ if( NO_NUM != nLevel )
+ nOldLevel = nLevel & ~NO_NUMLEVEL;
+
+//FEATURE::CONDCOLL
+ BOOL bCheck = TRUE;
+ if( RES_CONDTXTFMTCOLL == rTxtNd.GetFmtColl()->Which() )
+ {
+ SwFmtColl* pChgColl = rTxtNd.GetCondFmtColl();
+ rTxtNd.ChkCondColl();
+ if( rTxtNd.GetCondFmtColl() )
+ {
+ // es gab eine Aenderung -> harte Einzuege entfernen
+ if( pChgColl != rTxtNd.GetCondFmtColl() )
+ rTxtNd.ResetAttr( RES_LR_SPACE );
+ bCheck = FALSE;
+ }
+ }
+//FEATURE::CONDCOLL
+
+ // hat sich eine Level - Aenderung ergeben, so setze jetzt die
+ // gueltigen Einzuege
+ if( bCheck && ( nLevel != nNdOldLvl || rTxtNd.IsSetNumLSpace() ) &&
+ (nLevel & ~NO_NUMLEVEL) < MAXLEVEL )
+ {
+ SvxLRSpaceItem aLR( ((SvxLRSpaceItem&)rTxtNd.SwCntntNode::GetAttr(
+ RES_LR_SPACE )) );
+
+ const SwNumFmt& rNFmt = aNum.pRules->Get( nLevel & ~NO_NUMLEVEL );
+
+ // ohne Nummer immer ohne FirstLineOffset!!!!
+ aLR.SetTxtFirstLineOfstValue( ( nLevel & NO_NUMLEVEL )
+ ? 0 : rNFmt.GetFirstLineOffset() );
+ aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
+
+ rTxtNd.SwCntntNode::SetAttr( aLR );
+ }
+ // Flag immer loeschen!
+ rTxtNd.SetNumLSpace( FALSE );
+
+
+ aNdIdx++;
+}
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_poolfmt.cxx b/binfilter/bf_sw/source/core/doc/sw_poolfmt.cxx
new file mode 100644
index 000000000000..8e4d4f385e65
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_poolfmt.cxx
@@ -0,0 +1,2240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hintids.hxx>
+
+#include <frmatr.hxx>
+
+#include <unotools/localedatawrapper.hxx>
+
+#include <bf_svx/wghtitem.hxx>
+#include <bf_svx/fontitem.hxx>
+#include <bf_svx/fhgtitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/adjitem.hxx>
+#include <bf_svx/postitem.hxx>
+#include <bf_svx/keepitem.hxx>
+#include <bf_svx/opaqitem.hxx>
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/cmapitem.hxx>
+#include <bf_svx/udlnitem.hxx>
+#include <bf_svx/colritem.hxx>
+#include <bf_svx/protitem.hxx>
+#include <bf_svx/paperinf.hxx>
+#include <bf_svx/escpitem.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/charrotateitem.hxx>
+#include <bf_svx/frmdiritem.hxx>
+#include <bf_svx/emphitem.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtfsize.hxx>
+#include <poolfmt.hxx>
+#include <paratr.hxx>
+#include <pagedesc.hxx>
+#include <hints.hxx>
+#include <charfmt.hxx>
+#include <docary.hxx>
+#include <ndtxt.hxx>
+#include <fmtline.hxx>
+
+#include <poolfmt.hrc>
+#include <GetMetricVal.hxx>
+namespace binfilter {
+const USHORT PT_3 = 3 * 20; // 3 pt
+const USHORT PT_6 = 6 * 20; // 6 pt
+const USHORT PT_7 = 7 * 20; // 6 pt
+const USHORT PT_8 = 8 * 20; // 8 pt
+const USHORT PT_9 = 9 * 20; // 9 pt
+const USHORT PT_10 = 10 * 20; // 10 pt
+const USHORT PT_11 = 11 * 20; // 11 pt
+const USHORT PT_12 = 12 * 20; // 12 pt
+const USHORT PT_14 = 14 * 20; // 14 pt
+const USHORT PT_16 = 16 * 20; // 16 pt
+const USHORT PT_18 = 18 * 20; // 18 pt
+const USHORT PT_22 = 22 * 20; // 22 pt
+const USHORT PT_24 = 24 * 20; // 22 pt
+
+
+//const USHORT HTML_PARSPACE = ((CM_05 * 7) / 10);
+#define HTML_PARSPACE GetMetricVal( CM_05 )
+
+static const sal_Char __FAR_DATA sKomma[] = ", ";
+
+static const USHORT aHeadlineSizes[ 2 * MAXLEVEL ] = {
+// PT_16, PT_14, PT_14, PT_12, PT_12, // normal
+//JP 10.12.96: jetzt soll alles prozentual sein:
+ 115, 100, 100, 85, 85,
+ 75, 75, 75, 75, 75, // normal
+// PT_22, PT_16, PT_12, PT_11, PT_9 // HTML-Mode
+ PT_24, PT_18, PT_14, PT_12, PT_10,
+ PT_7, PT_7, PT_7, PT_7, PT_7 // HTML-Mode
+};
+
+/*N*/ long lcl_GetRightMargin( SwDoc& rDoc )
+/*N*/ {
+/*N*/ // sorge dafuer, dass die Druckereinstellungen in die Standard-
+/*N*/ // Seitenvorlage uebernommen wurden.
+/*N*/ long nLeft, nRight, nWidth;
+/*N*/ const SfxPrinter* pPrt = rDoc.GetPrt( !rDoc.IsInReading() );
+/*N*/ if( !pPrt )
+/*N*/ {
+/*N*/ SvxPaper ePaper;
+/*N*/ if( MEASURE_METRIC == GetAppLocaleData().getMeasurementSystemEnum() )
+/*N*/ {
+/*?*/ ePaper = SVX_PAPER_A4;
+/*?*/ nLeft = nRight = 1134; //2 Zentimeter
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ePaper = SVX_PAPER_LEGAL;
+/*N*/ nLeft = nRight = 1800; // 1,25 Inch
+/*N*/ }
+/*N*/
+/*N*/ nWidth = SvxPaperInfo::GetPaperSize( ePaper ).Width();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwFrmFmt& rPgDscFmt = rDoc.GetPageDesc( 0 ).GetMaster();
+/*N*/ const SvxLRSpaceItem& rLR = rPgDscFmt.GetLRSpace();
+/*N*/ nLeft = rLR.GetLeft();
+/*N*/ nRight = rLR.GetRight();
+/*N*/ nWidth = rPgDscFmt.GetFrmSize().GetWidth();
+/*N*/ }
+/*N*/ return nWidth - nLeft - nRight;
+/*N*/ }
+
+/*N*/ void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem )
+/*N*/ {
+/*N*/ rSet.Put( rItem );
+/*N*/ USHORT nWhCJK = 0, nWhCTL = 0;
+/*N*/ switch( rItem.Which() )
+/*N*/ {
+/*N*/ case RES_CHRATR_FONTSIZE:
+/*N*/ nWhCJK = RES_CHRATR_CJK_FONTSIZE, nWhCTL = RES_CHRATR_CTL_FONTSIZE;
+/*N*/ break;
+/*N*/ case RES_CHRATR_FONT:
+/*N*/ nWhCJK = RES_CHRATR_CJK_FONT, nWhCTL = RES_CHRATR_CTL_FONT;
+/*N*/ break;
+/*?*/ case RES_CHRATR_LANGUAGE:
+/*?*/ nWhCJK = RES_CHRATR_CJK_LANGUAGE, nWhCTL = RES_CHRATR_CTL_LANGUAGE;
+/*?*/ break;
+/*N*/ case RES_CHRATR_POSTURE:
+/*N*/ nWhCJK = RES_CHRATR_CJK_POSTURE, nWhCTL = RES_CHRATR_CTL_POSTURE;
+/*N*/ break;
+/*N*/ case RES_CHRATR_WEIGHT:
+/*N*/ nWhCJK = RES_CHRATR_CJK_WEIGHT, nWhCTL = RES_CHRATR_CTL_WEIGHT;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( nWhCJK )
+/*N*/ rSet.Put( rItem, nWhCJK );
+/*N*/ if( nWhCTL )
+/*N*/ rSet.Put( rItem, nWhCTL );
+/*N*/ }
+
+/*N*/ void lcl_SetDfltFont( USHORT nFntType, SfxItemSet& rSet )
+/*N*/ {
+/*N*/ static struct {
+/*N*/ USHORT nResLngId;
+/*N*/ USHORT nResFntId;
+/*N*/ } aArr[ 3 ] = {
+/*N*/ { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT },
+/*N*/ { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT },
+/*N*/ { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT }
+/*N*/ };
+/*N*/ for( USHORT n = 0; n < 3; ++n )
+/*N*/ {
+/*N*/ USHORT nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
+/*N*/ aArr[n].nResLngId )).GetLanguage();
+/*N*/ Font aFnt( OutputDevice::GetDefaultFont( nFntType,
+/*N*/ nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
+/*N*/
+/*N*/ rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+/*N*/ aEmptyStr, aFnt.GetPitch(),
+/*N*/ aFnt.GetCharSet(), aArr[n].nResFntId ));
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl,
+/*N*/ SfxItemSet& rSet,
+/*N*/ USHORT nOutLvlBits, BYTE nLevel, BOOL bItalic )
+/*N*/ {
+/*N*/ SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD ) );
+/*N*/ SvxFontHeightItem aHItem;
+/*N*/ if( pDoc->IsHTMLMode() )
+/*?*/ aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] );
+/*N*/ else
+/*N*/ aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] );
+/*N*/ SetAllScriptItem( rSet, aHItem );
+/*N*/
+/*N*/ if( bItalic && !pDoc->IsHTMLMode() )
+/*N*/ SetAllScriptItem( rSet, SvxPostureItem( ITALIC_NORMAL ) );
+/*N*/
+/*N*/ if( pDoc->IsHTMLMode() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ::lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT, DEFAULTFONT_CJK_TEXT,
+/*N*/ }
+/*N*/
+/*N*/ if( pColl )
+/*N*/ {
+/*N*/ if( !( nOutLvlBits & ( 1 << nLevel )) )
+/*N*/ {
+/*N*/ pColl->SetOutlineLevel( nLevel );
+/*N*/ if( !pDoc->IsHTMLMode() )
+/*N*/ {
+/*N*/ const SwNumFmt& rNFmt = pDoc->GetOutlineNumRule()->Get( nLevel );
+/*N*/ if( rNFmt.GetAbsLSpace() || rNFmt.GetFirstLineOffset() )
+/*N*/ {
+/*?*/ SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetAttr( RES_LR_SPACE ) );
+/*?*/ aLR.SetTxtFirstLineOfstValue( rNFmt.GetFirstLineOffset() );
+/*?*/ aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
+/*?*/ pColl->SetAttr( aLR );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_TEXT ));
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, USHORT nFact,
+/*N*/ BOOL bHeader, BOOL bTab )
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ USHORT nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0;
+/*N*/ aLR.SetTxtLeft( nLeft );
+/*N*/
+/*N*/ rSet.Put( aLR );
+/*N*/ if( bHeader )
+/*N*/ {
+/*N*/ SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD ) );
+/*N*/ SetAllScriptItem( rSet, SvxFontHeightItem( PT_16 ) );
+/*N*/ }
+/*N*/ if( bTab )
+/*N*/ {
+/*N*/ long nRightMargin = lcl_GetRightMargin( *pDoc );
+/*N*/ SvxTabStopItem aTStops( 0, 0 );
+/*N*/ aTStops.Insert( SvxTabStop( nRightMargin - nLeft,
+/*N*/ SVX_TAB_ADJUST_RIGHT,
+/*N*/ cDfltDecimalChar, '.' ));
+/*N*/ rSet.Put( aTStops );
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl,
+/*N*/ SfxItemSet& rSet,
+/*N*/ USHORT nNxt, SwTwips nEZ, SwTwips nLeft,
+/*N*/ SwTwips nUpper, SwTwips nLower )
+/*N*/ {
+/*N*/
+/*N*/ SvxLRSpaceItem aLR; SvxULSpaceItem aUL;
+/*N*/ aLR.SetTxtFirstLineOfst( USHORT(nEZ) ); aLR.SetTxtLeft( USHORT(nLeft) );
+/*N*/ aUL.SetUpper( USHORT(nUpper) ); aUL.SetLower( USHORT(nLower) );
+/*N*/ rSet.Put( aLR );
+/*N*/ rSet.Put( aUL );
+/*N*/
+/*N*/ if( !pColl )
+/*?*/ pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool( nNxt ));
+/*N*/ }
+
+
+
+ // Gebe die "Auto-Collection" mit der Id zurueck. Existiert
+ // sie noch nicht, dann erzeuge sie
+ // Ist der String-Pointer definiert, dann erfrage nur die
+ // Beschreibung der Attribute, !! es legt keine Vorlage an !!
+
+/*N*/ SvxFrameDirection GetDefaultFrameDirection(ULONG nLanguage)
+/*N*/ {
+/*N*/ SvxFrameDirection eResult = FRMDIR_HORI_LEFT_TOP;
+/*N*/
+/*N*/ switch (nLanguage)
+/*N*/ {
+/*N*/ case LANGUAGE_ARABIC_PRIMARY_ONLY:
+/*N*/ case LANGUAGE_ARABIC_SAUDI_ARABIA:
+/*N*/ case LANGUAGE_ARABIC_IRAQ:
+/*N*/ case LANGUAGE_ARABIC_EGYPT:
+/*N*/ case LANGUAGE_ARABIC_LIBYA:
+/*N*/ case LANGUAGE_ARABIC_ALGERIA:
+/*N*/ case LANGUAGE_ARABIC_MOROCCO:
+/*N*/ case LANGUAGE_ARABIC_TUNISIA:
+/*N*/ case LANGUAGE_ARABIC_OMAN:
+/*N*/ case LANGUAGE_ARABIC_YEMEN:
+/*N*/ case LANGUAGE_ARABIC_SYRIA:
+/*N*/ case LANGUAGE_ARABIC_JORDAN:
+/*N*/ case LANGUAGE_ARABIC_LEBANON:
+/*N*/ case LANGUAGE_ARABIC_KUWAIT:
+/*N*/ case LANGUAGE_ARABIC_UAE:
+/*N*/ case LANGUAGE_ARABIC_BAHRAIN:
+/*N*/ case LANGUAGE_ARABIC_QATAR:
+/*N*/ case LANGUAGE_HEBREW:
+/*N*/ case LANGUAGE_URDU:
+/*N*/ eResult = FRMDIR_HORI_RIGHT_TOP;
+/*N*/
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ return eResult;
+/*N*/ }
+
+/*N*/ SwTxtFmtColl* SwDoc::GetTxtCollFromPool
+/*N*/ ( USHORT nId, String* pDesc, SfxItemPresentation ePres,
+/*N*/ SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, BOOL bRegardLanguage)
+/*N*/ {
+/*N*/ ASSERT(
+/*N*/ (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
+/*N*/ (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
+/*N*/ (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
+/*N*/ (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
+/*N*/ (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
+/*N*/ (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
+/*N*/ "Falsche AutoFormat-Id" );
+/*N*/
+/*N*/ SwTxtFmtColl* pNewColl;
+/*N*/ USHORT nOutLvlBits = 0;
+/*N*/ for( USHORT n = 0; n < pTxtFmtCollTbl->Count(); ++n )
+/*N*/ {
+/*N*/ if( nId == ( pNewColl = (*pTxtFmtCollTbl)[ n ] )->GetPoolFmtId() )
+/*N*/ {
+/*N*/ if( pDesc )
+/*N*/ pNewColl->GetPresentation( ePres, eCoreMetric,
+/*N*/ ePresMetric, *pDesc );
+/*N*/ return pNewColl;
+/*N*/ }
+/*N*/ if( !pDesc && pNewColl->GetOutlineLevel() < MAXLEVEL )
+/*N*/ nOutLvlBits |= ( 1 << pNewColl->GetOutlineLevel() );
+/*N*/ }
+/*N*/
+/*N*/ // bis hierher nicht gefunden -> neu anlegen
+/*N*/ USHORT nResId = 0;
+/*N*/ if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
+/*N*/ nResId = RC_POOLCOLL_TEXT_BEGIN - RES_POOLCOLL_TEXT_BEGIN;
+/*N*/ else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END)
+/*N*/ nResId = RC_POOLCOLL_LISTS_BEGIN - RES_POOLCOLL_LISTS_BEGIN;
+/*N*/ else if (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END)
+/*N*/ nResId = RC_POOLCOLL_EXTRA_BEGIN - RES_POOLCOLL_EXTRA_BEGIN;
+/*N*/ else if (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END)
+/*N*/ nResId = RC_POOLCOLL_REGISTER_BEGIN - RES_POOLCOLL_REGISTER_BEGIN;
+/*N*/ else if (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END)
+/*N*/ nResId = RC_POOLCOLL_DOC_BEGIN - RES_POOLCOLL_DOC_BEGIN;
+/*N*/ else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END)
+/*N*/ nResId = RC_POOLCOLL_HTML_BEGIN - RES_POOLCOLL_HTML_BEGIN;
+/*N*/
+/*N*/ ASSERT( nResId, "Ungueltige Pool-ID" );
+/*N*/ if( !nResId )
+/*N*/ return GetTxtCollFromPool( RES_POOLCOLL_STANDARD, pDesc, ePres,
+/*N*/ eCoreMetric, ePresMetric );
+/*N*/
+/*N*/ ResId aResId( nResId + nId, *pSwResMgr );
+/*N*/ String aNm( aResId );
+/*N*/
+/*N*/ // ein Set fuer alle zusetzenden Attribute
+/*N*/ SwAttrSet aSet( GetAttrPool(), aTxtFmtCollSetRange );
+/*N*/ USHORT nParent = GetPoolParent( nId );
+/*N*/ if( pDesc )
+/*N*/ {
+/*?*/ pNewColl = 0;
+/*?*/ if( nParent )
+/*?*/ *pDesc = SW_RESSTR( nResId + nParent );
+/*?*/ else
+/*?*/ *pDesc = aEmptyStr;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ if(::binfilter::IsConditionalByPoolId( nId ))
+/*N*/ pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), aNm, !nParent
+/*N*/ ? pDfltTxtFmtColl
+/*N*/ : GetTxtCollFromPool( nParent ));
+/*N*/ else
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ pNewColl = new SwTxtFmtColl( GetAttrPool(), aNm, !nParent
+/*N*/ ? pDfltTxtFmtColl
+/*N*/ : GetTxtCollFromPool( nParent ));
+/*N*/ pNewColl->SetPoolFmtId( nId );
+/*N*/ pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
+/*N*/ }
+/*N*/
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ // allgemeine Inhaltsformen
+/*N*/ case RES_POOLCOLL_STANDARD:
+/*N*/ if (bRegardLanguage &&
+/*N*/ GetDefaultFrameDirection(GetAppLanguage()) ==
+/*N*/ FRMDIR_HORI_RIGHT_TOP)
+/*N*/ {
+/*N*/ SvxAdjustItem aAdjust(SVX_ADJUST_RIGHT);
+/*N*/ aSet.Put(aAdjust);
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_TEXT: // Textkoerper
+/*N*/ {
+/*N*/ SvxULSpaceItem aUL( 0, PT_6 );
+/*N*/ if( IsHTMLMode() ) aUL.SetLower( HTML_PARSPACE );
+/*N*/ aSet.Put( aUL );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TEXT_IDENT: // Textkoerper Einzug
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetTxtFirstLineOfst( GetMetricVal( CM_05 ));
+/*N*/ aSet.Put( aLR );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TEXT_NEGIDENT: // Textkoerper neg. Einzug
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
+/*N*/ aLR.SetTxtLeft( GetMetricVal( CM_1 ));
+/*N*/ SvxTabStopItem aTStops; aTStops.Insert( SvxTabStop( 0 ));
+/*N*/
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aTStops );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TEXT_MOVE: // Textkoerper Einrueckung
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetTxtLeft( GetMetricVal( CM_05 ));
+/*N*/ aSet.Put( aLR );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_CONFRONTATION: // Textkoerper Gegenueberstellung
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetTxtFirstLineOfst( - short( GetMetricVal( CM_1 ) * 4 +
+/*N*/ GetMetricVal( CM_05)) );
+/*N*/ aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 5 );
+/*N*/ SvxTabStopItem aTStops; aTStops.Insert( SvxTabStop( 0 ));
+/*N*/
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aTStops );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_MARGINAL: // Textkoerper maginalie
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 4 );
+/*N*/ aSet.Put( aLR );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_HEADLINE_BASE: // Basis Ueberschrift
+/*N*/ {
+/*N*/ static const USHORT aFntInit[] = {
+/*N*/ DEFAULTFONT_LATIN_HEADING, RES_CHRATR_FONT,
+/*N*/ RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US,
+/*N*/ DEFAULTFONT_CJK_HEADING, RES_CHRATR_CJK_FONT,
+/*N*/ RES_CHRATR_CJK_LANGUAGE, LANGUAGE_ENGLISH_US,
+/*N*/ DEFAULTFONT_CTL_HEADING, RES_CHRATR_CTL_FONT,
+/*N*/ RES_CHRATR_CTL_LANGUAGE, LANGUAGE_ARABIC_SAUDI_ARABIA,
+/*N*/ 0
+/*N*/ };
+/*N*/
+/*N*/ for( const USHORT* pArr = aFntInit; *pArr; pArr += 4 )
+/*N*/ {
+/*N*/ USHORT nLng = ((SvxLanguageItem&)GetDefault( *(pArr+2) )).GetLanguage();
+/*N*/ if( LANGUAGE_DONTKNOW == nLng )
+/*N*/ nLng = *(pArr+3);
+/*N*/
+/*N*/ Font aFnt( OutputDevice::GetDefaultFont( *pArr,
+/*N*/ nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
+/*N*/
+/*N*/ aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
+/*N*/ aEmptyStr, aFnt.GetPitch(),
+/*N*/ aFnt.GetCharSet(), *(pArr+1) ));
+/*N*/ }
+/*N*/
+/*N*/ SvxFontHeightItem aFntSize( PT_14 );
+/*N*/ SvxULSpaceItem aUL( PT_12, PT_6 );
+/*N*/ if( IsHTMLMode() )
+/*?*/ aUL.SetLower( HTML_PARSPACE );
+/*N*/ aSet.Put( SvxFmtKeepItem( TRUE ));
+/*N*/
+/*N*/ if( !pDesc )
+/*N*/ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_TEXT ));
+/*N*/
+/*N*/ aSet.Put( aUL );
+/*N*/ SetAllScriptItem( aSet, aFntSize );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_NUMBUL_BASE: // Basis Numerierung/Aufzaehlung
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_GREETING: // Grussformel
+/*N*/ case RES_POOLCOLL_REGISTER_BASE: // Basis Verzeichnisse
+/*N*/ case RES_POOLCOLL_SIGNATURE: // Unterschrift
+/*N*/ case RES_POOLCOLL_TABLE: // Tabelle-Inhalt
+/*N*/ {
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_HEADLINE1: // Ueberschrift 1
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 0, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE2: // Ueberschrift 2
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 1, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE3: // Ueberschrift 3
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 2, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE4: // Ueberschrift 4
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 3, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE5: // Ueberschrift 5
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 4, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE6: // Ueberschrift 6
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 5, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE7: // Ueberschrift 7
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 6, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE8: // Ueberschrift 8
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 7, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE9: // Ueberschrift 9
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 8, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HEADLINE10: // Ueberschrift 10
+/*N*/ lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 9, FALSE );
+/*N*/ break;
+/*N*/
+/*N*/
+/*N*/ // Sonderbereiche:
+/*N*/ // Kopfzeilen
+/*N*/ case RES_POOLCOLL_HEADER:
+/*N*/ case RES_POOLCOLL_HEADERL:
+/*N*/ case RES_POOLCOLL_HEADERR:
+/*N*/ // Fusszeilen
+/*N*/ case RES_POOLCOLL_FOOTER:
+/*N*/ case RES_POOLCOLL_FOOTERL:
+/*N*/ case RES_POOLCOLL_FOOTERR:
+/*N*/ {
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/
+/*N*/ long nRightMargin = lcl_GetRightMargin( *this );
+/*N*/
+/*N*/ SvxTabStopItem aTStops( 0, 0 );
+/*N*/ aTStops.Insert( SvxTabStop( nRightMargin / 2, SVX_TAB_ADJUST_CENTER ) );
+/*N*/ aTStops.Insert( SvxTabStop( nRightMargin, SVX_TAB_ADJUST_RIGHT ) );
+/*N*/
+/*N*/ aSet.Put( aTStops );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_TABLE_HDLN:
+/*N*/ {
+/*N*/ SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD ) );
+/*N*/ if( !IsHTMLMode() )
+/*N*/ SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL ) );
+/*N*/ aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER ) );
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_FOOTNOTE: // Fussnote
+/*N*/ case RES_POOLCOLL_ENDNOTE:
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
+/*N*/ aLR.SetTxtLeft( GetMetricVal( CM_05 ));
+/*N*/ SetAllScriptItem( aSet, SvxFontHeightItem( PT_10 ) );
+/*N*/ aSet.Put( aLR );
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_LABEL: // Beschriftung-Basis
+/*N*/ {
+/*N*/ SvxULSpaceItem aUL; aUL.SetUpper( PT_6 ); aUL.SetLower( PT_6 );
+/*N*/ aSet.Put( aUL );
+/*N*/ SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL ) );
+/*N*/ SetAllScriptItem( aSet, SvxFontHeightItem( PT_10 ) );
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_FRAME: // Rahmen Inhalt
+/*N*/ case RES_POOLCOLL_LABEL_ABB: // Beschriftung-Abbildung
+/*N*/ case RES_POOLCOLL_LABEL_TABLE: // Beschriftung-Tabelle
+/*N*/ case RES_POOLCOLL_LABEL_FRAME: // Beschriftung-Rahmen
+/*N*/ case RES_POOLCOLL_LABEL_DRAWING: // Beschriftung-Zeichnung
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_JAKETADRESS: // UmschlagAdresse
+/*N*/ {
+/*N*/ SvxULSpaceItem aUL; aUL.SetLower( PT_3 );
+/*N*/ aSet.Put( aUL );
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_SENDADRESS: // AbsenderAdresse
+/*N*/ {
+/*N*/ if( IsHTMLMode() )
+/*?*/ SetAllScriptItem( aSet, SvxPostureItem(ITALIC_NORMAL) );
+/*N*/ else
+/*N*/ {
+/*N*/ SvxULSpaceItem aUL; aUL.SetLower( PT_3 );
+/*N*/ aSet.Put( aUL );
+/*N*/ }
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ // Benutzer-Verzeichnisse:
+/*N*/ case RES_POOLCOLL_TOX_USERH: // Header
+/*N*/ lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
+/*N*/ {
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER1: // 1. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 0, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER2: // 2. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 1, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER3: // 3. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 2, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER4: // 4. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 3, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER5: // 5. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 4, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER6: // 6. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 5, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER7: // 7. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 6, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER8: // 8. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 7, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER9: // 9. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 8, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_USER10: // 10. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 9, FALSE, TRUE );
+/*N*/ break;
+/*N*/
+/*N*/ // Index-Verzeichnisse
+/*N*/ case RES_POOLCOLL_TOX_IDXH: // Header
+/*N*/ lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
+/*N*/ {
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_IDX1: // 1. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 0, FALSE, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_IDX2: // 2. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 1, FALSE, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_IDX3: // 3. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 2, FALSE, FALSE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_IDXBREAK: // Trenner
+/*N*/ lcl_SetRegister( this, aSet, 0, FALSE, FALSE );
+/*N*/ break;
+/*N*/
+/*N*/ // Inhalts-Verzeichnisse
+/*N*/ case RES_POOLCOLL_TOX_CNTNTH: // Header
+/*N*/ lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
+/*N*/ {
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT1: // 1. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 0, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT2: // 2. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 1, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT3: // 3. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 2, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT4: // 4. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 3, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT5: // 5. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 4, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT6: // 6. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 5, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT7: // 7. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 6, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT8: // 8. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 7, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT9: // 9. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 8, FALSE, TRUE );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_CNTNT10: // 10. Ebene
+/*N*/ lcl_SetRegister( this, aSet, 9, FALSE, TRUE );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_TOX_ILLUSH:
+/*N*/ case RES_POOLCOLL_TOX_OBJECTH:
+/*N*/ case RES_POOLCOLL_TOX_TABLESH:
+/*N*/ case RES_POOLCOLL_TOX_AUTHORITIESH:
+/*N*/ lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
+/*N*/ {
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_TOX_ILLUS1:
+/*N*/ case RES_POOLCOLL_TOX_OBJECT1:
+/*N*/ case RES_POOLCOLL_TOX_TABLES1:
+/*N*/ case RES_POOLCOLL_TOX_AUTHORITIES1:
+/*N*/ lcl_SetRegister( this, aSet, 0, FALSE, TRUE );
+/*N*/ break;
+/*N*/
+/*N*/
+/*N*/
+/*N*/ case RES_POOLCOLL_NUM_LEVEL1S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL1:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL1E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_NONUM1:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1,
+/*N*/ 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL2S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL2:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL2E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_NONUM2:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2,
+/*N*/ 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL3S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL3:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL3E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_NONUM3:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3,
+/*N*/ 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL4S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL4:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL4E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_NONUM4:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4,
+/*N*/ 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL5S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL5:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_LEVEL5E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
+/*N*/ lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_NUM_NONUM5:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5,
+/*N*/ 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_BUL_LEVEL1S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL1:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL1E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_NONUM1:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM1,
+/*N*/ 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL2S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL2:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL2E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_NONUM2:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM2,
+/*N*/ 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL3S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL3:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL3E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_NONUM3:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM3,
+/*N*/ 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL4S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL4:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL4E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_NONUM4:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM4,
+/*N*/ 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL5S:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
+/*N*/ PT_12, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL5:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
+/*N*/ 0, PT_6 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_LEVEL5E:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
+/*N*/ lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
+/*N*/ 0, PT_12 );
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_BUL_NONUM5:
+/*N*/ lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM5,
+/*N*/ 0, SwNumRule::GetBullIndent( 4 ), 0, PT_6 );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_DOC_TITEL: // Doc. Titel
+/*N*/ {
+/*N*/ SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD ) );
+/*N*/ SetAllScriptItem( aSet, SvxFontHeightItem( PT_18 ) );
+/*N*/
+/*N*/ aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER ) );
+/*N*/
+/*N*/ if( !pDesc )
+/*N*/ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_DOC_SUBTITEL ));
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_DOC_SUBTITEL: // Doc. UnterTitel
+/*N*/ {
+/*N*/ SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL ));
+/*N*/ SetAllScriptItem( aSet, SvxFontHeightItem( PT_14 ));
+/*N*/
+/*N*/ aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER ));
+/*N*/
+/*N*/ if( !pDesc )
+/*N*/ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_TEXT ));
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_HTML_BLOCKQUOTE:
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetLeft( GetMetricVal( CM_1 ));
+/*N*/ aLR.SetRight( GetMetricVal( CM_1 ));
+/*N*/ aSet.Put( aLR );
+/*N*/ // aSet.Put( SvxAdjustItem( SVX_ADJUST_BLOCK ) );
+/*N*/ SvxULSpaceItem aUL;
+/*N*/ if( !pDesc )
+/*N*/ aUL = pNewColl->GetULSpace();
+/*N*/ aUL.SetLower( HTML_PARSPACE );
+/*N*/ aSet.Put( aUL);
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_HTML_PRE:
+/*N*/ {
+/*N*/ ::binfilter::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
+/*N*/
+/*N*/ // WORKAROUND: PRE auf 10pt setzten
+/*N*/ SetAllScriptItem( aSet, SvxFontHeightItem(PT_10) );
+/*N*/ // WORKAROUND: PRE auf 10pt setzten
+/*N*/
+/*N*/ // der untere Absatz-Abstand wird explizit gesetzt (macht
+/*N*/ // die harte Attributierung einfacher)
+/*N*/ SvxULSpaceItem aULSpaceItem;
+/*N*/ if( !pDesc )
+/*N*/ aULSpaceItem = pNewColl->GetULSpace();
+/*N*/ aULSpaceItem.SetLower( 0 );
+/*N*/ aSet.Put( aULSpaceItem );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_HTML_HR:
+/*N*/ {
+/*N*/ SvxBoxItem aBox;
+/*N*/ Color aColor( COL_GRAY );
+/*N*/ SvxBorderLine aNew( &aColor, DEF_DOUBLE_LINE0_OUT,
+/*N*/ DEF_DOUBLE_LINE0_IN,
+/*N*/ DEF_DOUBLE_LINE0_DIST );
+/*N*/ aBox.SetLine( &aNew, BOX_LINE_BOTTOM );
+/*N*/
+/*N*/ aSet.Put( aBox );
+/*N*/ aSet.Put( SwParaConnectBorderItem( FALSE ) );
+/*N*/ SetAllScriptItem( aSet, SvxFontHeightItem(120) );
+/*N*/
+/*N*/ SvxULSpaceItem aUL;
+/*N*/ if( !pDesc )
+/*N*/ {
+/*N*/ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_TEXT ));
+/*N*/ aUL = pNewColl->GetULSpace();
+/*N*/ }
+/*N*/ aUL.SetLower( HTML_PARSPACE );
+/*N*/ aSet.Put( aUL);
+/*N*/ SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
+/*N*/ aSet.Put( aLN );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLCOLL_HTML_DD:
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ if( !pDesc )
+/*N*/ aLR = pNewColl->GetLRSpace();
+/*N*/ // es wird um 1cm eingerueckt. Die IDs liegen immer 2 auseinander!
+/*N*/ aLR.SetLeft( GetMetricVal( CM_1 ));
+/*N*/ aSet.Put( aLR );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_HTML_DT:
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ if( !pDesc )
+/*N*/ {
+/*N*/ pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_HTML_DD ));
+/*N*/ aLR = pNewColl->GetLRSpace();
+/*N*/ }
+/*N*/ // es wird um 0cm eingerueckt. Die IDs liegen immer 2 auseinander!
+/*N*/ aLR.SetLeft( 0 );
+/*N*/ aSet.Put( aLR );
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( aSet.Count() )
+/*N*/ {
+/*N*/ if( pDesc )
+/*N*/ {
+/*?*/ String aStr;
+/*?*/ aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, aStr );
+/*?*/ pDesc->AppendAscii( sKomma );
+/*?*/ *pDesc += aStr;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pNewColl->SetAttr( aSet );
+/*N*/ // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
+/*N*/ // (Bug: 18545)
+/*N*/ // SetModified();
+/*N*/ }
+/*N*/ }
+/*N*/ return pNewColl;
+/*N*/ }
+
+
+
+ // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
+ // benutzt wird
+
+
+
+
+
+ // Gebe das "Auto[matische]-Format" mit der Id zurueck. Existiert
+ // es noch nicht, dann erzeuge es
+
+/*N*/ typedef SwFmt* (SwDoc::*FnMakeFmt)( const String &, SwFmt * );
+/*M*/ SwFmt* SwDoc::GetFmtFromPool( USHORT nId, String* pDesc,
+/*M*/ SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric )
+/*M*/ {
+/*M*/ SwFmt *pNewFmt, *pDeriveFmt;
+/*M*/
+/*M*/ SvPtrarr* pArray[ 2 ];
+/*M*/ USHORT nArrCnt = 1, nRCId = 0;
+/*M*/ FnMakeFmt fnMkFmt;
+/*M*/ USHORT* pWhichRange = 0;
+/*M*/
+/*M*/ switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
+/*M*/ {
+/*M*/ case POOLGRP_CHARFMT:
+/*M*/ {
+/*M*/ pArray[0] = pCharFmtTbl;
+/*M*/ pDeriveFmt = pDfltCharFmt;
+/*M*/ fnMkFmt= (FnMakeFmt)&SwDoc::MakeCharFmt;
+/*M*/
+/*M*/ if( nId > RES_POOLCHR_NORMAL_END )
+/*M*/ nRCId = RC_POOLCHRFMT_HTML_BEGIN - RES_POOLCHR_HTML_BEGIN;
+/*M*/ else
+/*M*/ nRCId = RC_POOLCHRFMT_BEGIN - RES_POOLCHR_BEGIN;
+/*M*/ pWhichRange = aCharFmtSetRange;
+/*M*/
+/*M*/ // Fehlerfall: unbekanntes Format, aber CharFormat
+/*M*/ // -> returne das erste
+/*M*/ if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END )
+/*M*/ {
+/*M*/ ASSERT( !this, "ungueltige Id" );
+/*M*/ nId = RES_POOLCHR_BEGIN;
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/ case POOLGRP_FRAMEFMT:
+/*M*/ {
+/*M*/ pArray[0] = pFrmFmtTbl;
+/*M*/ pArray[1] = pSpzFrmFmtTbl;
+/*M*/ pDeriveFmt = pDfltFrmFmt;
+/*M*/ fnMkFmt= (FnMakeFmt)&SwDoc::MakeFrmFmt;
+/*M*/ nArrCnt = 2;
+/*M*/ nRCId = RC_POOLFRMFMT_BEGIN - RES_POOLFRM_BEGIN;
+/*M*/ pWhichRange = aFrmFmtSetRange;
+/*M*/
+/*M*/ // Fehlerfall: unbekanntes Format, aber FrameFormat
+/*M*/ // -> returne das erste
+/*M*/ if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END )
+/*M*/ {
+/*M*/ ASSERT( !this, "ungueltige Id" );
+/*M*/ nId = RES_POOLFRM_BEGIN;
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ default:
+/*M*/ // Fehlerfall, unbekanntes Format
+/*M*/ ASSERT( nId, "ungueltige Id" );
+/*M*/ return 0;
+/*M*/ }
+/*M*/ ASSERT( nRCId, "ungueltige Id" );
+/*M*/
+/*M*/ while( nArrCnt-- )
+/*M*/ for( USHORT n = 0; n < (*pArray[nArrCnt]).Count(); ++n )
+/*M*/ if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
+/*M*/ GetPoolFmtId() )
+/*M*/ {
+/*M*/ if( pDesc )
+/*M*/ pNewFmt->GetPresentation( ePres, eCoreMetric,
+/*M*/ ePresMetric, *pDesc );
+/*M*/ return pNewFmt;
+/*M*/ }
+/*M*/
+/*M*/ ResId aResId( nRCId + nId, *pSwResMgr );
+/*M*/ String aNm( aResId );
+/*M*/ SwAttrSet aSet( GetAttrPool(), pWhichRange );
+/*M*/
+/*M*/ if( pDesc )
+/*M*/ {
+/*M*/ pNewFmt = 0;
+/*M*/ // *pDesc = aEmptyStr; // oder den Namen ?? aNm;
+/*M*/ *pDesc = aNm;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ BOOL bIsModified = IsModified();
+/*M*/ pNewFmt = (this->*fnMkFmt)( aNm, pDeriveFmt );
+/*M*/ if( !bIsModified )
+/*M*/ ResetModified();
+/*M*/ pNewFmt->SetPoolFmtId( nId );
+/*M*/ pNewFmt->SetAuto( FALSE ); // kein Auto-Format
+/*M*/ }
+/*M*/
+/*M*/ switch( nId )
+/*M*/ {
+/*M*/ case RES_POOLCHR_FOOTNOTE: // Fussnote
+/*M*/ case RES_POOLCHR_PAGENO: // Seiten/Feld
+/*M*/ case RES_POOLCHR_LABEL: // Beschriftung
+/*M*/ case RES_POOLCHR_DROPCAPS: // Initialien
+/*M*/ case RES_POOLCHR_NUM_LEVEL: // Aufzaehlungszeichen
+/*M*/ case RES_POOLCHR_TOXJUMP: // Verzeichnissprung
+/*M*/ case RES_POOLCHR_ENDNOTE: // Endnote
+/*M*/ case RES_POOLCHR_LINENUM: // Zeilennummerierung
+/*M*/ break;
+/*M*/
+/*M*/ case RES_POOLCHR_ENDNOTE_ANCHOR: // Endnotenanker
+/*M*/ case RES_POOLCHR_FOOTNOTE_ANCHOR: // Fussnotenanker
+/*M*/ {
+/*M*/ aSet.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER, 58 ) );
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/
+/*M*/ case RES_POOLCHR_BUL_LEVEL: // Aufzaehlungszeichen
+/*M*/ {
+/*M*/ const Font& rBulletFont = SwNumRule::GetDefBulletFont();
+/*M*/ SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamily(),
+/*M*/ rBulletFont.GetName(), rBulletFont.GetStyleName(),
+/*M*/ rBulletFont.GetPitch(), rBulletFont.GetCharSet() ));
+/*M*/ SetAllScriptItem( aSet, SvxFontHeightItem( PT_9 ));
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_POOLCHR_INET_NORMAL:
+/*M*/ {
+/*M*/ Color aCol( COL_BLUE );
+/*M*/ aSet.Put( SvxColorItem( aCol ) );
+/*M*/ aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE ) );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_POOLCHR_INET_VISIT:
+/*M*/ {
+/*M*/ Color aCol( COL_RED );
+/*M*/ aSet.Put( SvxColorItem( aCol ) );
+/*M*/ aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE ) );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_POOLCHR_JUMPEDIT:
+/*M*/ {
+/*M*/ Color aCol( COL_CYAN );
+/*M*/ aSet.Put( SvxColorItem( aCol ) );
+/*M*/ aSet.Put( SvxUnderlineItem( UNDERLINE_DOTTED ) );
+/*M*/ aSet.Put( SvxCaseMapItem( SVX_CASEMAP_KAPITAELCHEN ) );
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_POOLCHR_RUBYTEXT:
+/*M*/ {
+/*M*/ long nH = ((SvxFontHeightItem*)GetDfltAttr(
+/*M*/ RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2;
+/*M*/ SetAllScriptItem( aSet, SvxFontHeightItem( nH ));
+/*N*/ aSet.Put(SvxUnderlineItem( UNDERLINE_NONE ));
+/*N*/ aSet.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE) );
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_POOLCHR_HTML_EMPHASIS:
+/*M*/ case RES_POOLCHR_HTML_CITIATION:
+/*M*/ case RES_POOLCHR_HTML_VARIABLE:
+/*M*/ {
+/*M*/ SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL ) );
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_POOLCHR_IDX_MAIN_ENTRY:
+/*M*/ case RES_POOLCHR_HTML_STRONG:
+/*M*/ {
+/*M*/ SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD ));
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_POOLCHR_HTML_CODE:
+/*M*/ case RES_POOLCHR_HTML_SAMPLE:
+/*M*/ case RES_POOLCHR_HTML_KEYBOARD:
+/*M*/ case RES_POOLCHR_HTML_TELETYPE:
+/*M*/ {
+/*M*/ ::binfilter::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_POOLCHR_VERT_NUM:
+/*M*/ aSet.Put( SvxCharRotateItem( 900 ) );
+/*M*/ break;
+/*M*/ //nichts besonderes
+/*M*/ // case RES_POOLCHR_HTML_DEFINSTANCE:
+/*M*/ // break;
+/*M*/
+/*M*/
+/*M*/ case RES_POOLFRM_FRAME:
+/*M*/ {
+/*M*/ if ( IsBrowseMode() )
+/*M*/ {
+/*M*/ aSet.Put( SwFmtAnchor( FLY_IN_CNTNT ));
+/*M*/ aSet.Put( SwFmtVertOrient( 0, VERT_LINE_CENTER, PRTAREA ) );
+/*M*/ aSet.Put( SwFmtSurround( SURROUND_NONE ) );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ aSet.Put( SwFmtAnchor( FLY_AT_CNTNT ));
+/*M*/ aSet.Put( SwFmtSurround( SURROUND_PARALLEL ) );
+/*M*/ aSet.Put( SwFmtHoriOrient( 0, HORI_CENTER, PRTAREA ) );
+/*M*/ aSet.Put( SwFmtVertOrient( 0, VERT_TOP, PRTAREA ) );
+/*M*/ Color aCol( COL_BLACK );
+/*M*/ SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
+/*M*/ SvxBoxItem aBox;
+/*M*/ aBox.SetLine( &aLine, BOX_LINE_TOP );
+/*M*/ aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
+/*M*/ aBox.SetLine( &aLine, BOX_LINE_LEFT );
+/*M*/ aBox.SetLine( &aLine, BOX_LINE_RIGHT );
+/*M*/ aBox.SetDistance( 85 );
+/*M*/ aSet.Put( aBox );
+/*M*/ aSet.Put( SvxLRSpaceItem( 114, 114 ) );
+/*M*/ aSet.Put( SvxULSpaceItem( 114, 114 ) );
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_POOLFRM_GRAPHIC:
+/*M*/ case RES_POOLFRM_OLE:
+/*M*/ {
+/*M*/ aSet.Put( SwFmtAnchor( FLY_AT_CNTNT ));
+/*M*/ aSet.Put( SwFmtHoriOrient( 0, HORI_CENTER, FRAME ));
+/*M*/ aSet.Put( SwFmtVertOrient( 0, VERT_TOP, FRAME ));
+/*M*/ aSet.Put( SwFmtSurround( SURROUND_NONE ));
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_POOLFRM_FORMEL:
+/*M*/ {
+/*M*/ aSet.Put( SwFmtAnchor( FLY_IN_CNTNT ) );
+/*M*/ aSet.Put( SwFmtVertOrient( 0, VERT_CHAR_CENTER, FRAME ) );
+/*M*/ aSet.Put( SvxLRSpaceItem( 114, 114 ) );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_POOLFRM_MARGINAL:
+/*M*/ {
+/*M*/ aSet.Put( SwFmtAnchor( FLY_AT_CNTNT ));
+/*M*/ aSet.Put( SwFmtHoriOrient( 0, HORI_LEFT, FRAME ));
+/*M*/ aSet.Put( SwFmtVertOrient( 0, VERT_TOP, FRAME ));
+/*M*/ aSet.Put( SwFmtSurround( SURROUND_PARALLEL ));
+/*M*/ // Breite 3.5 centimeter vorgegeben, als Hoehe nur den
+/*M*/ // min. Wert benutzen
+/*M*/ aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE,
+/*M*/ GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ),
+/*M*/ MM50 ));
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_POOLFRM_WATERSIGN:
+/*M*/ {
+/*M*/ aSet.Put( SwFmtAnchor( FLY_PAGE ));
+/*M*/ aSet.Put( SwFmtHoriOrient( 0, HORI_CENTER, FRAME ));
+/*M*/ aSet.Put( SwFmtVertOrient( 0, VERT_CENTER, FRAME ));
+/*M*/ aSet.Put( SvxOpaqueItem( FALSE ));
+/*M*/ aSet.Put( SwFmtSurround( SURROUND_THROUGHT ));
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_POOLFRM_LABEL:
+/*M*/ {
+/*M*/ aSet.Put( SwFmtAnchor( FLY_IN_CNTNT ) );
+/*M*/ aSet.Put( SwFmtVertOrient( 0, VERT_TOP, FRAME ) );
+/*M*/ aSet.Put( SvxLRSpaceItem( 114, 114 ) );
+/*M*/
+/*M*/ SvxProtectItem aProtect;
+/*M*/ aProtect.SetSizeProtect( TRUE );
+/*M*/ aProtect.SetPosProtect( TRUE );
+/*M*/ aSet.Put( aProtect );
+/*M*/
+/*M*/ if( !pDesc )
+/*M*/ pNewFmt->SetAutoUpdateFmt( TRUE );
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/ if( aSet.Count() )
+/*M*/ {
+/*M*/ if( pDesc )
+/*M*/ {
+/*M*/ String aStr;
+/*M*/ aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, aStr );
+/*M*/ pDesc->AppendAscii( sKomma );
+/*M*/ *pDesc += aStr;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ pNewFmt->SetAttr( aSet );
+/*M*/ // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
+/*M*/ // (Bug: 18545)
+/*M*/ // SetModified();
+/*M*/ }
+/*M*/ }
+/*M*/ return pNewFmt;
+/*M*/ }
+
+
+
+ // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
+ // benutzt wird
+
+
+
+/*N*/ void lcl_GetStdPgSize( SwDoc* pDoc, SfxItemSet& rSet )
+/*N*/ {
+/*N*/ SwPageDesc* pStdPgDsc = pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+/*N*/ SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
+/*N*/ if( pStdPgDsc->GetLandscape() )
+/*N*/ {
+/*N*/ SwTwips nTmp = aFrmSz.GetHeight();
+/*N*/ aFrmSz.SetHeight( aFrmSz.GetWidth() );
+/*N*/ aFrmSz.SetWidth( nTmp );
+/*N*/ }
+/*N*/ rSet.Put( aFrmSz );
+/*N*/ }
+
+
+
+/*N*/ SwPageDesc* SwDoc::GetPageDescFromPool( USHORT nId, String* pDesc,
+/*N*/ SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric,
+/*N*/ BOOL bRegardLanguage)
+/*N*/ {
+/*N*/ ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
+/*N*/ "Falsche AutoFormat-Id" );
+/*N*/
+/*N*/ SwPageDesc *pNewPgDsc;
+ USHORT n=0;
+/*N*/ for( n = 0; n < aPageDescs.Count(); ++n )
+/*N*/ if( nId == ( pNewPgDsc = aPageDescs[ n ] )->GetPoolFmtId() )
+/*N*/ {
+/*N*/ if( pDesc )
+/*N*/ pNewPgDsc->GetPresentation( ePres, eCoreMetric,
+/*N*/ ePresMetric, *pDesc );
+/*N*/ return pNewPgDsc;
+/*N*/ }
+/*N*/
+/*N*/ // Fehlerfall: unbekannte Poolvorlage
+/*N*/ if( RES_POOLPAGE_BEGIN > nId || nId >= RES_POOLPAGE_END )
+/*N*/ {
+/*?*/ ASSERT( !this, "ungueltige Id" );
+/*?*/ nId = RES_POOLPAGE_BEGIN;
+/*N*/ }
+/*N*/
+/*N*/ ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr );
+/*N*/ String aNm( aResId );
+/*N*/ if( pDesc )
+/*N*/ {
+/*?*/ pNewPgDsc = 0;
+/*?*/ // *pDesc = aEmptyStr; // oder den Namen ?? aNm;
+/*?*/ *pDesc = aNm;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bIsModified = IsModified();
+/*N*/ n = MakePageDesc( aNm, 0, bRegardLanguage );
+/*N*/ pNewPgDsc = aPageDescs[ n ];
+/*N*/ pNewPgDsc->SetPoolFmtId( nId );
+/*N*/ if( !bIsModified )
+/*N*/ ResetModified();
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ aLR.SetLeft( GetMetricVal( CM_1 ) * 2 );
+/*N*/ aLR.SetRight( aLR.GetLeft() );
+/*N*/ SvxULSpaceItem aUL;
+/*N*/ aUL.SetUpper( (USHORT)aLR.GetLeft() );
+/*N*/ aUL.SetLower( (USHORT)aLR.GetLeft() );
+/*N*/
+/*N*/ SwAttrSet aSet( GetAttrPool(), aPgFrmFmtSetRange );
+/*N*/ BOOL bSetLeft = TRUE;
+/*N*/
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ case RES_POOLPAGE_STANDARD: // Standard-Seite
+/*N*/ {
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aUL );
+/*N*/ if( pNewPgDsc )
+/*N*/ pNewPgDsc->SetUseOn( PD_ALL );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLPAGE_FIRST: // Erste Seite
+/*N*/ case RES_POOLPAGE_REGISTER: // Verzeichnis
+/*N*/ {
+/*N*/ lcl_GetStdPgSize( this, aSet );
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aUL );
+/*N*/ if( pNewPgDsc )
+/*N*/ {
+/*N*/ pNewPgDsc->SetUseOn( PD_ALL );
+/*N*/ if( RES_POOLPAGE_FIRST == nId )
+/*N*/ pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD ));
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLPAGE_LEFT: // Linke Seite
+/*N*/ {
+/*N*/ lcl_GetStdPgSize( this, aSet );
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aUL );
+/*N*/ bSetLeft = FALSE;
+/*N*/ if( pNewPgDsc )
+/*N*/ pNewPgDsc->SetUseOn( PD_LEFT );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLPAGE_RIGHT: // Rechte Seite
+/*N*/ {
+/*N*/ lcl_GetStdPgSize( this, aSet );
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aUL );
+/*N*/ bSetLeft = FALSE;
+/*N*/ if( pNewPgDsc )
+/*N*/ pNewPgDsc->SetUseOn( PD_RIGHT );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLPAGE_JAKET: // Umschlag
+/*N*/ {
+/*N*/ aLR.SetLeft( 0 ); aLR.SetRight( 0 );
+/*N*/ aUL.SetUpper( 0 ); aUL.SetLower( 0 );
+/*N*/ Size aPSize( SvxPaperInfo::GetPaperSize( SVX_PAPER_C65 ) );
+/*N*/ LandscapeSwap( aPSize );
+/*N*/ aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() ));
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aUL );
+/*N*/
+/*N*/ if( pNewPgDsc )
+/*N*/ {
+/*N*/ pNewPgDsc->SetUseOn( PD_ALL );
+/*N*/ pNewPgDsc->SetLandscape( TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLPAGE_HTML: // HTML
+/*N*/ {
+/*N*/ lcl_GetStdPgSize( this, aSet );
+/*N*/ aLR.SetRight( GetMetricVal( CM_1 ));
+/*N*/ aUL.SetUpper( (USHORT)aLR.GetRight() );
+/*N*/ aUL.SetLower( (USHORT)aLR.GetRight() );
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aUL );
+/*N*/
+/*N*/ if( pNewPgDsc )
+/*N*/ pNewPgDsc->SetUseOn( PD_ALL );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLPAGE_FOOTNOTE:
+/*N*/ case RES_POOLPAGE_ENDNOTE:
+/*N*/ {
+/*N*/ lcl_GetStdPgSize( this, aSet );
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aUL );
+/*N*/ if( pNewPgDsc )
+/*N*/ pNewPgDsc->SetUseOn( PD_ALL );
+/*N*/ SwPageFtnInfo aInf( pNewPgDsc->GetFtnInfo() );
+/*N*/ aInf.SetLineWidth( 0 );
+/*N*/ aInf.SetTopDist( 0 );
+/*N*/ aInf.SetBottomDist( 0 );
+/*N*/ pNewPgDsc->SetFtnInfo( aInf );
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( aSet.Count() )
+/*N*/ {
+/*N*/ if( pDesc )
+/*N*/ {
+/*?*/ String aStr;
+/*?*/ aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, aStr );
+/*?*/ pDesc->AppendAscii( sKomma );
+/*?*/ *pDesc += aStr;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( bSetLeft )
+/*N*/ pNewPgDsc->GetLeft().SetAttr( aSet );
+/*N*/ pNewPgDsc->GetMaster().SetAttr( aSet );
+/*N*/ // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
+/*N*/ // (Bug: 18545)
+/*N*/ // SetModified();
+/*N*/ }
+/*N*/ }
+/*N*/ return pNewPgDsc;
+/*N*/ }
+
+/*N*/ SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId, String* pDesc,
+/*N*/ SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric )
+/*N*/ {
+/*N*/ ASSERT( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END,
+/*N*/ "Falsche AutoFormat-Id" );
+/*N*/
+/*N*/ SwNumRule* pNewRule;
+ USHORT n=0;
+/*N*/ for( n = 0; n < GetNumRuleTbl().Count(); ++n )
+/*N*/ if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() )
+/*N*/ {
+/*?*/ if( pDesc )
+/*?*/ *pDesc = pNewRule->GetName();
+/*?*/ return pNewRule;
+/*N*/ }
+
+ // Fehlerfall: unbekannte Poolvorlage
+/*N*/ if( RES_POOLNUMRULE_BEGIN > nId || nId >= RES_POOLNUMRULE_END )
+/*N*/ {
+/*?*/ ASSERT( !this, "ungueltige Id" );
+/*?*/ nId = RES_POOLNUMRULE_BEGIN;
+/*N*/ }
+
+/*N*/ ResId aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN + nId - RES_POOLNUMRULE_BEGIN), *pSwResMgr );
+/*N*/ String aNm( aResId );
+/*N*/
+/*N*/ SwCharFmt *pNumCFmt = 0, *pBullCFmt = 0;
+/*N*/
+/*N*/ if( pDesc )
+/*N*/ {
+/*?*/ pNewRule = new SwNumRule( aNm );
+/*?*/ *pDesc = aNm;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bIsModified = IsModified();
+/*N*/ n = MakeNumRule( aNm );
+/*N*/ pNewRule = GetNumRuleTbl()[ n ];
+/*N*/ pNewRule->SetPoolFmtId( nId );
+/*N*/ pNewRule->SetAutoRule( FALSE );
+/*N*/
+/*N*/ if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 )
+/*N*/ pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
+/*N*/
+/*N*/ if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) ||
+/*N*/ RES_POOLNUMRULE_NUM5 == nId )
+/*N*/ pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
+/*N*/
+/*N*/ if( !bIsModified )
+/*?*/ ResetModified();
+/*N*/ }
+/*N*/
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ case RES_POOLNUMRULE_NUM1:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+/*N*/ aFmt.SetCharFmt( pNumCFmt );
+/*N*/ aFmt.SetStart( 1 );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetSuffix( aDotStr );
+/*N*/
+/*N*/ static const USHORT aAbsSpace[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
+/*N*/ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+/*N*/ };
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+/*N*/ };
+/*N*/ const USHORT* pArr = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace
+/*N*/ : aAbsSpaceInch;
+/*N*/ #else
+/*N*/ const USHORT* pArr = aAbsSpace;
+/*N*/ #endif
+/*N*/
+/*N*/ aFmt.SetFirstLineOffset( - (*pArr) );
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+/*N*/ {
+/*N*/ aFmt.SetAbsLSpace( *pArr );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLNUMRULE_NUM2:
+/*N*/ {
+/*N*/ static const USHORT aAbsSpace[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 283, 283, 567, 709, // 0.50, 0.50, 1.00, 1.25
+/*N*/ 850, 1021, 1304, 1474, // 1.50, 1.80, 2.30, 2.60
+/*N*/ 1588, 1758 // 2.80, 3.10
+/*N*/ };
+/*N*/
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 385, 385, 770, 963,
+/*N*/ 1155, 1386, 1771, 2002,
+/*N*/ 2156, 2387
+/*N*/ };
+/*N*/
+/*N*/ const USHORT* pArr = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace
+/*N*/ : aAbsSpaceInch;
+/*N*/ #else
+/*N*/ const USHORT* pArr = aAbsSpace;
+/*N*/ #endif
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+/*N*/ aFmt.SetCharFmt( pNumCFmt );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ USHORT nSpace = 0;
+/*N*/ for( n = 0; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ aFmt.SetAbsLSpace( nSpace += pArr[ n ] );
+/*N*/ aFmt.SetFirstLineOffset( - pArr[ n ] );
+/*N*/ aFmt.SetStart( n+1 );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLNUMRULE_NUM3:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+/*N*/ aFmt.SetCharFmt( pNumCFmt );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ USHORT nOffs = GetMetricVal( CM_1 ) * 3;
+/*N*/ aFmt.SetFirstLineOffset( - nOffs );
+/*N*/
+/*N*/ for( n = 0; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ aFmt.SetAbsLSpace( (n+1) * nOffs );
+/*N*/ aFmt.SetStart( n+1 );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLNUMRULE_NUM4:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER);
+/*N*/ aFmt.SetCharFmt( pNumCFmt );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetSuffix( aDotStr );
+/*N*/
+/*N*/ static const USHORT aAbsSpace[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
+/*N*/ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+/*N*/ };
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
+/*N*/ };
+/*N*/ const USHORT* pArr = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace
+/*N*/ : aAbsSpaceInch;
+/*N*/ #else
+/*N*/ const USHORT* pArr = aAbsSpace;
+/*N*/ #endif
+/*N*/
+/*N*/ aFmt.SetFirstLineOffset( - (*pArr) );
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+/*N*/ {
+/*N*/ aFmt.SetStart( n + 1 );
+/*N*/ aFmt.SetAbsLSpace( *pArr );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLNUMRULE_NUM5:
+/*N*/ {
+/*N*/ // [ First, LSpace ]
+/*N*/ static const USHORT aAbsSpace0to2[] =
+/*N*/ {
+/*N*/ 227, 227, // 0.40, 0.40,
+/*N*/ 369, 624, // 0.65, 1.10,
+/*N*/ 255, 879 // 0.45, 1.55
+/*N*/ };
+/*N*/ static const USHORT aAbsSpaceInch0to2[] =
+/*N*/ {
+/*N*/ 308, 308,
+/*N*/ 501, 847,
+/*N*/ 347, 1194
+/*N*/ };
+/*N*/
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ const USHORT* pArr0to2 = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace0to2
+/*N*/ : aAbsSpaceInch0to2;
+/*N*/ #else
+/*N*/ const USHORT* pArr0to2 = aAbsSpace0to2;
+/*N*/ #endif
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+/*N*/ aFmt.SetStart( 1 );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetSuffix( aDotStr );
+/*N*/ aFmt.SetFirstLineOffset( -pArr0to2[0] ); // == 0.40 cm
+/*N*/ aFmt.SetAbsLSpace( pArr0to2[1] ); // == 0.40 cm
+/*N*/
+/*N*/ aFmt.SetCharFmt( pNumCFmt );
+/*N*/ pNewRule->Set( 0, aFmt );
+/*N*/
+/*N*/ aFmt.SetIncludeUpperLevels( 2 );
+/*N*/ aFmt.SetStart( 2 );
+/*N*/ aFmt.SetFirstLineOffset( -pArr0to2[2] ); // == 0.65 cm
+/*N*/ aFmt.SetAbsLSpace( pArr0to2[3] ); // == 1.10 cm
+/*N*/ pNewRule->Set( 1, aFmt );
+/*N*/
+/*N*/ aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER);
+/*N*/ aFmt.SetSuffix( ')');
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetStart( 3 );
+/*N*/ aFmt.SetFirstLineOffset( - pArr0to2[4] ); // == 0.45cm
+/*N*/ aFmt.SetAbsLSpace( pArr0to2[5] ); // == 1.55 cm
+/*N*/ pNewRule->Set( 2, aFmt );
+/*N*/
+/*N*/
+/*N*/ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+/*N*/ aFmt.SetCharFmt( pBullCFmt );
+/*N*/ aFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
+/*N*/ aFmt.SetBulletChar( cBulletChar );
+/*N*/ USHORT nOffs = GetMetricVal( CM_01 ) * 4,
+/*N*/ nOffs2 = GetMetricVal( CM_1 ) * 2;
+/*N*/
+/*N*/ aFmt.SetFirstLineOffset( - nOffs );
+/*N*/ aFmt.SetSuffix( aEmptyStr );
+/*N*/ for( n = 3; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ aFmt.SetStart( n+1 );
+/*N*/ aFmt.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_POOLNUMRULE_BUL1:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+/*N*/ aFmt.SetCharFmt( pBullCFmt );
+/*N*/ aFmt.SetStart( 1 );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
+/*N*/ aFmt.SetBulletChar( cBulletChar );
+/*N*/
+/*N*/ static const USHORT aAbsSpace[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
+/*N*/ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+/*N*/ };
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+/*N*/ };
+/*N*/ const USHORT* pArr = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace
+/*N*/ : aAbsSpaceInch;
+/*N*/ #else
+/*N*/ const USHORT* pArr = aAbsSpace;
+/*N*/ #endif
+/*N*/
+/*N*/ aFmt.SetFirstLineOffset( - (*pArr) );
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+/*N*/ {
+/*N*/ aFmt.SetAbsLSpace( *pArr );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLNUMRULE_BUL2:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+/*N*/ aFmt.SetCharFmt( pBullCFmt );
+/*N*/ aFmt.SetStart( 1 );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
+/*N*/ aFmt.SetBulletChar( 0x2013 );
+/*N*/
+/*N*/ static const USHORT aAbsSpace[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ // cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0
+/*N*/ 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
+/*N*/ };
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
+/*N*/ };
+/*N*/ const USHORT* pArr = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace
+/*N*/ : aAbsSpaceInch;
+/*N*/ #else
+/*N*/ const USHORT* pArr = aAbsSpace;
+/*N*/ #endif
+/*N*/
+/*N*/ aFmt.SetFirstLineOffset( - (*pArr) );
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+/*N*/ {
+/*N*/ aFmt.SetAbsLSpace( *pArr );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLNUMRULE_BUL3:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+/*N*/ aFmt.SetCharFmt( pBullCFmt );
+/*N*/ aFmt.SetStart( 1 );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
+/*N*/ USHORT nOffs = GetMetricVal( CM_01 ) * 4;
+/*N*/ aFmt.SetFirstLineOffset( - nOffs );
+/*N*/
+/*N*/ for( n = 0; n < MAXLEVEL; ++n )
+/*N*/ {
+/*N*/ aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) );
+/*N*/ aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLNUMRULE_BUL4:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+/*N*/ aFmt.SetCharFmt( pBullCFmt );
+/*N*/ aFmt.SetStart( 1 );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
+/*N*/
+/*N*/ static const USHORT aAbsSpace[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
+/*N*/ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+/*N*/ };
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+/*N*/ };
+/*N*/ const USHORT* pArr = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace
+/*N*/ : aAbsSpaceInch;
+/*N*/ #else
+/*N*/ const USHORT* pArr = aAbsSpace;
+/*N*/ #endif
+/*N*/
+/*N*/ aFmt.SetFirstLineOffset( - (*pArr) );
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+/*N*/ {
+/*N*/ switch( n )
+/*N*/ {
+/*N*/ case 0: aFmt.SetBulletChar( 0x27a2 ); break;
+/*N*/ case 1: aFmt.SetBulletChar( 0xE006 ); break;
+/*N*/ default: aFmt.SetBulletChar( 0xE004 ); break;
+/*N*/ }
+/*N*/ aFmt.SetAbsLSpace( *pArr );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_POOLNUMRULE_BUL5:
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+/*N*/ aFmt.SetCharFmt( pBullCFmt );
+/*N*/ aFmt.SetStart( 1 );
+/*N*/ aFmt.SetIncludeUpperLevels( 1 );
+/*N*/ aFmt.SetBulletChar( 0x2717 );
+/*N*/ aFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
+/*N*/
+/*N*/ static const USHORT aAbsSpace[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
+/*N*/ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+/*N*/ };
+/*N*/ #ifdef USE_MEASUREMENT
+/*N*/ static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
+/*N*/ {
+/*N*/ 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
+/*N*/ };
+/*N*/ const USHORT* pArr = MEASURE_METRIC ==
+/*N*/ GetAppLocaleData().getMeasurementSystemEnum()
+/*N*/ ? aAbsSpace
+/*N*/ : aAbsSpaceInch;
+/*N*/ #else
+/*N*/ const USHORT* pArr = aAbsSpace;
+/*N*/ #endif
+/*N*/
+/*N*/ aFmt.SetFirstLineOffset( - (*pArr) );
+/*N*/ for( n = 0; n < MAXLEVEL; ++n, ++pArr )
+/*N*/ {
+/*N*/ aFmt.SetAbsLSpace( *pArr );
+/*N*/ pNewRule->Set( n, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pDesc )
+/*N*/ {
+/*N*/ //JP 25.02.98: wie soll die Beschreibung sein??
+/*N*/ // String aStr;
+/*N*/ // aSet.GetPresentation( ePres, eCoreMetric, ePresMetric, aStr );
+/*N*/ // *pDesc += sKomma;
+/*N*/ // *pDesc += aStr;
+/*N*/
+/*?*/ delete pNewRule, pNewRule = 0;
+/*N*/ }
+/*N*/
+/*N*/ return pNewRule;
+/*N*/ }
+
+
+
+ // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
+ // benutzt wird
+
+ // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
+ // benutzt wird
+
+
+
+// erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
+/*N*/ BOOL SwDoc::IsUsed( const SwModify& rModify ) const
+/*N*/ {
+/*N*/ // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
+/*N*/ // (auch indirekte fuer Format-Ableitung! )
+/*N*/ SwAutoFmtGetDocNode aGetHt( &aNodes );
+/*N*/ return !rModify.GetInfo( aGetHt );
+/*N*/ }
+
+// erfrage ob die NumRule benutzt wird
+/*N*/ BOOL SwDoc::IsUsed( const SwNumRule& rRule ) const
+/*N*/ {
+/*N*/ // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
+/*N*/ // (auch indirekte fuer Format-Ableitung! )
+/*N*/ BOOL bUsed = FALSE;
+/*N*/ SwAutoFmtGetDocNode aGetHt( &aNodes );
+/*N*/ SwModify* pMod;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT i, nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_NUMRULE);
+/*N*/ for( i = 0; i < nMaxItems; ++i )
+/*N*/ if( 0 != (pItem = GetAttrPool().GetItem( RES_PARATR_NUMRULE, i ) ) &&
+/*N*/ 0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->GetDefinedIn()) &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue().Len() &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue() == rRule.GetName() )
+/*N*/ {
+/*N*/ if( pMod->IsA( TYPE( SwFmt )) )
+/*N*/ {
+/*?*/ bUsed = !pMod->GetInfo( aGetHt );
+/*?*/ if( bUsed )
+/*?*/ break;
+/*N*/ }
+/*N*/ else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ bUsed = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return bUsed;
+/*N*/ }
+
+ // loeche die nicht mehr benutzten Pattern-Namen aus dem Array.
+ // alle nicht mehr referenzierten Namen werden durch 0-Pointer
+ // ersetzt. Diese Positionen koennen wieder vergeben werden.
+
+ // Suche die Position vom Vorlagen-Namen. Ist nicht vorhanden
+ // dann fuege neu ein
+USHORT SwDoc::SetDocPattern( const String& rPatternName )
+{
+ ASSERT( rPatternName.Len(), "kein Dokument-Vorlagenname" );
+
+ USHORT nNewPos = aPatternNms.Count();
+ for( USHORT n = 0; n < aPatternNms.Count(); ++n )
+ if( !aPatternNms[n] )
+ {
+ if( nNewPos == aPatternNms.Count() )
+ nNewPos = n;
+ }
+ else if( rPatternName == *aPatternNms[n] )
+ return n;
+
+ if( nNewPos < aPatternNms.Count() )
+ aPatternNms.Remove( nNewPos ); // Platz wieder frei machen
+
+ String* pNewNm = new String( rPatternName );
+ aPatternNms.Insert( pNewNm, nNewPos );
+ SetModified();
+ return nNewPos;
+}
+
+/*N*/ USHORT GetPoolParent( USHORT nId )
+/*N*/ {
+/*N*/ USHORT nRet = USHRT_MAX;
+/*N*/ if( POOLGRP_NOCOLLID & nId ) // 1 == Formate / 0 == Collections
+/*N*/ {
+/*N*/ switch( ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ) & nId )
+/*?*/ {
+/*?*/ case POOLGRP_CHARFMT:
+/*?*/ case POOLGRP_FRAMEFMT:
+/*?*/ nRet = 0; // vom default abgeleitet
+/*?*/ break;
+/*?*/ case POOLGRP_PAGEDESC:
+/*?*/ case POOLGRP_NUMRULE:
+/*?*/ break; // es gibt keine Ableitung
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ switch( COLL_GET_RANGE_BITS & nId )
+/*N*/ {
+/*N*/ case COLL_TEXT_BITS:
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ case RES_POOLCOLL_STANDARD:
+/*N*/ nRet = 0; break;
+/*N*/ case RES_POOLCOLL_TEXT_IDENT:
+/*N*/ case RES_POOLCOLL_TEXT_NEGIDENT:
+/*N*/ case RES_POOLCOLL_TEXT_MOVE:
+/*N*/ case RES_POOLCOLL_CONFRONTATION:
+/*N*/ case RES_POOLCOLL_MARGINAL:
+/*N*/ nRet = RES_POOLCOLL_TEXT; break;
+/*N*/
+/*N*/ case RES_POOLCOLL_TEXT:
+/*N*/ case RES_POOLCOLL_GREETING:
+/*N*/ case RES_POOLCOLL_SIGNATURE:
+/*N*/ case RES_POOLCOLL_HEADLINE_BASE:
+/*N*/ nRet = RES_POOLCOLL_STANDARD; break;
+/*N*/
+/*N*/ case RES_POOLCOLL_HEADLINE1:
+/*N*/ case RES_POOLCOLL_HEADLINE2:
+/*N*/ case RES_POOLCOLL_HEADLINE3:
+/*N*/ case RES_POOLCOLL_HEADLINE4:
+/*N*/ case RES_POOLCOLL_HEADLINE5:
+/*N*/ case RES_POOLCOLL_HEADLINE6:
+/*N*/ case RES_POOLCOLL_HEADLINE7:
+/*N*/ case RES_POOLCOLL_HEADLINE8:
+/*N*/ case RES_POOLCOLL_HEADLINE9:
+/*N*/ case RES_POOLCOLL_HEADLINE10:
+/*N*/ nRet = RES_POOLCOLL_HEADLINE_BASE; break;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case COLL_LISTS_BITS:
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ case RES_POOLCOLL_NUMBUL_BASE:
+/*N*/ nRet = RES_POOLCOLL_TEXT; break;
+/*N*/
+/*N*/ default:
+/*N*/ nRet = RES_POOLCOLL_NUMBUL_BASE; break;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case COLL_EXTRA_BITS:
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ case RES_POOLCOLL_FRAME:
+/*N*/ case RES_POOLCOLL_TABLE:
+/*N*/ nRet = RES_POOLCOLL_TEXT; break;
+/*N*/
+/*N*/ case RES_POOLCOLL_TABLE_HDLN:
+/*N*/ nRet = RES_POOLCOLL_TABLE; break;
+/*N*/
+/*N*/ case RES_POOLCOLL_FOOTNOTE:
+/*N*/ case RES_POOLCOLL_ENDNOTE:
+/*N*/ case RES_POOLCOLL_JAKETADRESS:
+/*N*/ case RES_POOLCOLL_SENDADRESS:
+/*N*/ case RES_POOLCOLL_HEADER:
+/*N*/ case RES_POOLCOLL_HEADERL:
+/*N*/ case RES_POOLCOLL_HEADERR:
+/*N*/ case RES_POOLCOLL_FOOTER:
+/*N*/ case RES_POOLCOLL_FOOTERL:
+/*N*/ case RES_POOLCOLL_FOOTERR:
+/*N*/ case RES_POOLCOLL_LABEL:
+/*N*/ nRet = RES_POOLCOLL_STANDARD; break;
+/*N*/
+/*N*/ case RES_POOLCOLL_LABEL_ABB:
+/*N*/ case RES_POOLCOLL_LABEL_TABLE:
+/*N*/ case RES_POOLCOLL_LABEL_FRAME:
+/*N*/ case RES_POOLCOLL_LABEL_DRAWING:
+/*N*/ nRet = RES_POOLCOLL_LABEL; break;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case COLL_REGISTER_BITS:
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ case RES_POOLCOLL_REGISTER_BASE:
+/*N*/ nRet = RES_POOLCOLL_STANDARD; break;
+/*N*/
+/*N*/ case RES_POOLCOLL_TOX_USERH:
+/*N*/ case RES_POOLCOLL_TOX_CNTNTH:
+/*N*/ case RES_POOLCOLL_TOX_IDXH:
+/*N*/ case RES_POOLCOLL_TOX_ILLUSH:
+/*N*/ case RES_POOLCOLL_TOX_OBJECTH:
+/*N*/ case RES_POOLCOLL_TOX_TABLESH:
+/*N*/ case RES_POOLCOLL_TOX_AUTHORITIESH:
+/*N*/ nRet = RES_POOLCOLL_HEADLINE_BASE; break;
+/*N*/
+/*N*/ default:
+/*N*/ nRet = RES_POOLCOLL_REGISTER_BASE; break;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case COLL_DOC_BITS:
+/*N*/ nRet = RES_POOLCOLL_HEADLINE_BASE;
+/*N*/ break;
+/*N*/
+/*N*/ case COLL_HTML_BITS:
+/*N*/ nRet = RES_POOLCOLL_STANDARD;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return nRet;
+/*N*/ }
+
+void SwDoc::RemoveAllFmtLanguageDependencies()
+{
+ /* #106748# Restore the language independ pool defaults and styles. */
+ GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST );
+ GetTxtCollFromPool( RES_POOLCOLL_STANDARD )->ResetAttr( RES_PARATR_ADJUST );
+
+ SvxFrameDirectionItem aFrameDir( FRMDIR_HORI_LEFT_TOP );
+
+ sal_uInt16 nCount = GetPageDescCnt();
+ for( sal_uInt16 i=0; i<nCount; ++i )
+ {
+ SwPageDesc& rDesc = _GetPageDesc( i );
+ rDesc.GetMaster().SetAttr( aFrameDir );
+ rDesc.GetLeft().SetAttr( aFrameDir );
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_sortopt.cxx b/binfilter/bf_sw/source/core/doc/sw_sortopt.cxx
new file mode 100644
index 000000000000..0d2766858bfe
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_sortopt.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <tools/debug.hxx>
+#include <i18npool/lang.h>
+
+#include <sortopt.hxx>
+namespace binfilter {
+
+
+/*N*/ SV_IMPL_PTRARR(SwSortKeys, SwSortKey*)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortier-Schluessel
+ --------------------------------------------------------------------*/
+
+/*N*/ SwSortKey::SwSortKey() :
+/*N*/ eSortOrder( SRT_ASCENDING ),
+/*N*/ nColumnId( 0 ),
+/*N*/ bIsNumeric( TRUE )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwSortKey::SwSortKey(const SwSortKey& rOld) :
+/*N*/ eSortOrder( rOld.eSortOrder ),
+/*N*/ sSortType( rOld.sSortType ),
+/*N*/ nColumnId( rOld.nColumnId ),
+/*N*/ bIsNumeric( rOld.bIsNumeric )
+/*N*/ {
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortieroptionen fuers Sortieren
+ --------------------------------------------------------------------*/
+
+
+/*N*/ SwSortOptions::SwSortOptions()
+/*?*/ : //STRIP001 eDirection( SRT_ROWS ),
+/*N*/ nLanguage( LANGUAGE_SYSTEM ),
+/*N*/ cDeli( 9 ),
+/*N*/ bTable( FALSE ),
+/*N*/ bIgnoreCase( FALSE )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) :
+/*N*/ eDirection( rOpt.eDirection ),
+/*N*/ cDeli( rOpt.cDeli ),
+/*N*/ nLanguage( rOpt.nLanguage ),
+/*N*/ bTable( rOpt.bTable ),
+/*N*/ bIgnoreCase( rOpt.bIgnoreCase )
+/*N*/ {
+/*N*/ for( USHORT i=0; i < rOpt.aKeys.Count(); ++i )
+/*N*/ {
+/*N*/ SwSortKey* pNew = new SwSortKey(*rOpt.aKeys[i]);
+/*N*/ aKeys.C40_INSERT( SwSortKey, pNew, aKeys.Count());
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwSortOptions::~SwSortOptions()
+/*N*/ {
+/*N*/ aKeys.DeleteAndDestroy(0, aKeys.Count());
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_swserv.cxx b/binfilter/bf_sw/source/core/doc/sw_swserv.cxx
new file mode 100644
index 000000000000..9322d44c5605
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_swserv.cxx
@@ -0,0 +1,202 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svx/linkmgr.hxx>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <doc.hxx>
+#include <swserv.hxx>
+#include <swbaslnk.hxx>
+#include <mvsave.hxx>
+#include <bookmrk.hxx>
+#include <pam.hxx>
+
+#include <swerror.h>
+namespace binfilter {
+
+/*N*/ SV_IMPL_REF( SwServerObject )
+
+/*N*/ SwServerObject::~SwServerObject()
+/*N*/ {
+/*N*/ }
+
+
+
+
+
+
+
+
+
+
+/*N*/ BOOL SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const
+/*N*/ {
+/*N*/ ULONG nSttNd = 0, nEndNd = 0;
+/*N*/ xub_StrLen nStt, nEnd;
+/*N*/ const SwNode* pNd = 0;
+/*N*/ const SwNodes* pNds = 0;
+/*N*/
+/*N*/ switch( eType )
+/*N*/ {
+/*?*/ case BOOKMARK_SERVER:
+/*?*/ if( CNTNT_TYPE.pBkmk->GetOtherPos() )
+/*?*/ {
+/*?*/ SwBookmark& rBkmk = *CNTNT_TYPE.pBkmk;
+/*?*/ const SwPosition* pStt = &rBkmk.GetPos(),
+/*?*/ * pEnd = rBkmk.GetOtherPos();
+/*?*/ if( *pStt > *pEnd )
+/*?*/ {
+/*?*/ const SwPosition* pTmp = pStt;
+/*?*/ pStt = pEnd;
+/*?*/ pEnd = pTmp;
+/*?*/ }
+/*?*/
+/*?*/ nSttNd = pStt->nNode.GetIndex();
+/*?*/ nStt = pStt->nContent.GetIndex();
+/*?*/ nEndNd = pEnd->nNode.GetIndex();
+/*?*/ nEnd = pEnd->nContent.GetIndex();
+/*?*/ pNds = &pStt->nNode.GetNodes();
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case TABLE_SERVER: pNd = CNTNT_TYPE.pTblNd; break;
+/*?*/ case SECTION_SERVER: pNd = CNTNT_TYPE.pSectNd; break;
+/*?*/
+/*N*/ case SECTION_SERVER+1:
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/
+/*N*/ if( pNd )
+/*N*/ {
+/*N*/ nSttNd = pNd->GetIndex();
+/*N*/ nEndNd = pNd->EndOfSectionIndex();
+/*N*/ nStt = 0, nEnd = USHRT_MAX;
+/*N*/ pNds = &pNd->GetNodes();
+/*N*/ }
+/*N*/
+/*N*/ if( nSttNd && nEndNd )
+/*N*/ {
+/*N*/ // LinkManager besorgen:
+/*N*/ const ::binfilter::SvBaseLinks& rLnks = pNds->GetDoc()->GetLinkManager().GetLinks();
+/*N*/
+/*N*/ // um Rekursionen zu Verhindern: ServerType umsetzen!
+/*N*/ SwServerObject::ServerModes eSave = eType;
+/*N*/ if( !pChkLnk )
+/*N*/ // sowas sollte man nicht tun, wer weiss schon, wie gross ein enum ist
+/*N*/ // ICC nimmt keinen int
+/*N*/ // #41723#
+/*N*/ // *((int*)&eType) = SECTION_SERVER+1;
+/*N*/ ((SwServerObject*)this)->eType = NONE_SERVER;
+/*N*/ for( USHORT n = rLnks.Count(); n; )
+/*N*/ {
+/*N*/ const ::binfilter::SvBaseLink* pLnk = &(*rLnks[ --n ]);
+/*N*/ if( pLnk && OBJECT_CLIENT_GRF != pLnk->GetObjType() &&
+/*N*/ pLnk->ISA( SwBaseLink ) &&
+/*N*/ !((SwBaseLink*)pLnk)->IsNoDataFlag() &&
+/*N*/ ((SwBaseLink*)pLnk)->IsInRange( nSttNd, nEndNd, nStt, nEnd ))
+/*N*/ {
+/*N*/ if( pChkLnk )
+/*N*/ {
+/*N*/ if( pLnk == pChkLnk ||
+/*N*/ ((SwBaseLink*)pLnk)->IsRecursion( pChkLnk ) )
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ else if( ((SwBaseLink*)pLnk)->IsRecursion( (SwBaseLink*)pLnk ) )
+/*N*/ ((SwBaseLink*)pLnk)->SetNoDataFlag();
+/*N*/ }
+/*N*/ }
+/*N*/ if( !pChkLnk )
+/*N*/ // *((int*)&eType) = eSave;
+/*?*/ ((SwServerObject*)this)->eType = eSave;
+/*N*/ }
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+/* */
+
+
+/*N*/ SwDataChanged::SwDataChanged( const SwPaM& rPam, USHORT nTyp )
+/*N*/ : pPam( &rPam ), nType( nTyp ), pDoc( rPam.GetDoc() ), pPos( 0 )
+/*N*/ {
+/*N*/ nNode = rPam.GetPoint()->nNode.GetIndex();
+/*N*/ nCntnt = rPam.GetPoint()->nContent.GetIndex();
+/*N*/ }
+
+
+/*N*/ SwDataChanged::SwDataChanged( SwDoc* pDoc, const SwPosition& rPos, USHORT nTyp )
+/*N*/ : pPam( 0 ), nType( nTyp ), pDoc( pDoc ), pPos( &rPos )
+/*N*/ {
+/*N*/ nNode = rPos.nNode.GetIndex();
+/*N*/ nCntnt = rPos.nContent.GetIndex();
+/*N*/ }
+/*N*/
+
+/*N*/ SwDataChanged::~SwDataChanged()
+/*N*/ {
+/*N*/ // JP 09.04.96: nur wenn das Layout vorhanden ist ( also waehrend der
+/*N*/ // Eingabe)
+/*N*/ if( pDoc->GetRootFrm() )
+/*N*/ {
+/*N*/ const ::binfilter::SvLinkSources& rServers = pDoc->GetLinkManager().GetServers();
+/*N*/
+/*N*/ for( USHORT nCnt = rServers.Count(); nCnt; )
+/*N*/ {
+/*N*/ ::binfilter::SvLinkSourceRef refObj( rServers[ --nCnt ] );
+/*N*/ // noch jemand am Object interessiert ?
+/*?*/ if( refObj->HasDataLinks() && refObj->ISA( SwServerObject ))
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwServerObject& rObj = *(SwServerObject*)&refObj;
+/*?*/ }
+/*?*/
+/*?*/ // sollte jetzt gar keine Verbindung mehr bestehen
+/*?*/ if( !refObj->HasDataLinks() )
+/*?*/ {
+/*?*/ // dann raus aus der Liste (Object bleibt aber bestehen!)
+/*?*/ // falls es noch da ist !!
+/*?*/ if( nCnt < rServers.Count() && &refObj == rServers[ nCnt ] )
+/*?*/ pDoc->GetLinkManager().RemoveServer( nCnt, 1 );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_swtable.cxx b/binfilter/bf_sw/source/core/doc/sw_swtable.cxx
new file mode 100644
index 000000000000..bcdd8b8f257c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_swtable.cxx
@@ -0,0 +1,1076 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#ifdef WTC
+#define private public
+#endif
+
+#include <ctype.h>
+#include <float.h>
+
+#include <hintids.hxx>
+#include <hints.hxx> // fuer SwAttrSetChg
+
+#include <bf_svx/linkmgr.hxx>
+
+
+#include <fmtfsize.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <frame.hxx>
+#include <ndtxt.hxx>
+#include <cellfrm.hxx>
+#include <rowfrm.hxx>
+#include <swserv.hxx>
+#include <mdiexp.hxx>
+#include <cellatr.hxx>
+#include <txatbase.hxx>
+#include <htmltbl.hxx>
+#include <swtblfmt.hxx>
+#include <tblrwcl.hxx>
+#include <redline.hxx>
+namespace binfilter {
+
+/*N*/ TYPEINIT1( SwTable, SwClient );
+/*N*/ TYPEINIT1( SwTableBox, SwClient );
+/*N*/ TYPEINIT1( SwTableLine, SwClient );
+/*N*/ TYPEINIT1( SwTableFmt, SwFrmFmt );
+/*N*/ TYPEINIT1( SwTableBoxFmt, SwFrmFmt );
+/*N*/ TYPEINIT1( SwTableLineFmt, SwFrmFmt );
+
+/*N*/ SV_IMPL_PTRARR(SwTableLines,SwTableLine*);
+/*N*/ SV_IMPL_PTRARR(SwTableBoxes,SwTableBox*);
+/*N*/ SV_IMPL_PTRARR_SORT(SwTableSortBoxes,SwTableBoxPtr);
+
+/*N*/ SV_IMPL_REF( SwServerObject )
+
+#define COLFUZZY 20
+
+//----------------------------------
+
+/*N*/ class SwTableBox_Impl
+/*N*/ {
+/*N*/ Color *pUserColor, *pNumFmtColor;
+/*N*/
+/*N*/ void SetNewCol( Color** ppCol, const Color* pNewCol );
+/*N*/ public:
+/*N*/ SwTableBox_Impl() : pUserColor(0), pNumFmtColor(0) {}
+/*N*/ ~SwTableBox_Impl() { delete pUserColor; delete pNumFmtColor; }
+/*N*/
+/*N*/ const Color* GetSaveUserColor() const { return pUserColor; }
+/*N*/ const Color* GetSaveNumFmtColor() const { return pNumFmtColor; }
+/*N*/ void SetSaveUserColor(const Color* p ) { SetNewCol( &pUserColor, p ); }
+/*N*/ void SetSaveNumFmtColor( const Color* p ) { SetNewCol( &pNumFmtColor, p ); }
+/*N*/ };
+
+// ----------- Inlines -----------------------------
+
+
+
+
+
+//JP 15.09.98: Bug 55741 - Tabs beibehalten (vorne und hinten)
+
+
+
+/*************************************************************************
+|*
+|* SwTable::SwTable()
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 05. May. 93
+|*
+|*************************************************************************/
+/*N*/ SwTable::SwTable( SwTableFmt* pFmt )
+/*N*/ : SwClient( pFmt ),
+/*N*/ pHTMLLayout( 0 ),
+/*N*/ nGrfsThatResize( 0 )
+/*N*/ {
+/*N*/ bModifyLocked = FALSE;
+/*N*/ bHeadlineRepeat = TRUE;
+/*N*/
+/*N*/ // default Wert aus den Optionen setzen
+/*N*/ eTblChgMode = (TblChgMode)0;//STRIP001 GetTblChgDefaultMode();
+/*N*/ }
+
+/*N*/ SwTable::SwTable( const SwTable& rTable )
+/*N*/ : SwClient( rTable.GetFrmFmt() ),
+/*N*/ pHTMLLayout( 0 ),
+/*N*/ nGrfsThatResize( 0 )
+/*N*/ {
+/*N*/ bHeadlineRepeat = rTable.IsHeadlineRepeat();
+/*N*/ bModifyLocked = FALSE;
+/*N*/ eTblChgMode = rTable.eTblChgMode;
+/*N*/ }
+
+/*N*/ void DelBoxNode( SwTableSortBoxes& rSortCntBoxes )
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < rSortCntBoxes.Count(); ++n )
+/*N*/ rSortCntBoxes[ n ]->pSttNd = 0;
+/*N*/ }
+
+/*N*/ SwTable::~SwTable()
+/*N*/ {
+/*N*/ if( refObj.Is() )
+/*N*/ {
+/*?*/ SwDoc* pDoc = GetFrmFmt()->GetDoc();
+/*?*/ if( !pDoc->IsInDtor() ) // dann aus der Liste entfernen
+/*?*/ pDoc->GetLinkManager().RemoveServer( &refObj );
+/*?*/
+/*?*/ refObj->Closed();
+/*N*/ }
+/*N*/
+/*N*/ // ist die Tabelle der letzte Client im FrameFormat, kann dieses
+/*N*/ // geloescht werden
+/*N*/ SwTableFmt* pFmt = (SwTableFmt*)GetFrmFmt();
+/*N*/ pFmt->Remove( this ); // austragen,
+/*N*/
+/*N*/ if( !pFmt->GetDepends() )
+/*N*/ pFmt->GetDoc()->DelTblFrmFmt( pFmt ); // und loeschen
+/*N*/
+/*N*/ // Loesche die Pointer aus dem SortArray der Boxen, die
+/*N*/ // Objecte bleiben erhalten und werden vom DTOR der Lines/Boxes
+/*N*/ // Arrays geloescht.
+/*N*/ //JP: reicht leider nicht, es muessen die Pointer auf den StartNode
+/*N*/ // der Section geloescht werden
+/*N*/ DelBoxNode( aSortCntBoxes );
+/*N*/ aSortCntBoxes.Remove( (USHORT)0, aSortCntBoxes.Count() );
+/*N*/ delete pHTMLLayout;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTable::Modify()
+|*
+|* Ersterstellung JP ??
+|* Letzte Aenderung MA 06. May. 93
+|*
+|*************************************************************************/
+/*?*/ inline BOOL FmtInArr( SvPtrarr& rFmtArr, SwFmt* pBoxFmt )
+/*?*/ {
+/*?*/ BOOL bRet = USHRT_MAX != rFmtArr.GetPos( (VoidPtr)pBoxFmt );
+/*?*/ if( !bRet )
+/*?*/ rFmtArr.Insert( (VoidPtr)pBoxFmt, rFmtArr.Count() );
+/*?*/ return bRet;
+/*?*/ }
+
+/*N*/ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld,
+/*N*/ const long nNew, SvPtrarr& rFmtArr );
+/*N*/
+/*N*/ void lcl_ModifyLines( SwTableLines &rLines, const long nOld,
+/*N*/ const long nNew, SvPtrarr& rFmtArr )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < rLines.Count(); ++i )
+/*N*/ ::binfilter::lcl_ModifyBoxes( rLines[i]->GetTabBoxes(), nOld, nNew, rFmtArr );
+/*N*/ }
+
+/*N*/ void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const long nOld,
+/*N*/ const long nNew, SvPtrarr& rFmtArr )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < rBoxes.Count(); ++i )
+/*N*/ {
+/*N*/ SwTableBox &rBox = *rBoxes[i];
+/*N*/ if ( rBox.GetTabLines().Count() )
+/*?*/ ::binfilter::lcl_ModifyLines( rBox.GetTabLines(), nOld, nNew, rFmtArr );
+/*N*/ //Die Box anpassen
+/*N*/ SwFrmFmt *pFmt = rBox.GetFrmFmt();
+/*N*/ if ( !FmtInArr( rFmtArr, pFmt ) )
+/*N*/ {
+/*N*/ long nBox = pFmt->GetFrmSize().GetWidth();
+/*N*/ nBox *= nNew;
+/*N*/ nBox /= nOld;
+/*N*/ SwFmtFrmSize aNewBox( ATT_VAR_SIZE, nBox, 0 );
+/*N*/ pFmt->LockModify();
+/*N*/ pFmt->SetAttr( aNewBox );
+/*N*/ pFmt->UnlockModify();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwTable::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ // fange SSize Aenderungen ab, um die Lines/Boxen anzupassen
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+/*N*/ const SwFmtFrmSize* pNewSize = 0, *pOldSize = 0;
+/*N*/
+/*N*/ if( RES_ATTRSET_CHG == nWhich )
+/*N*/ {
+/*N*/ if( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+/*N*/ RES_FRM_SIZE, FALSE, (const SfxPoolItem**)&pNewSize ))
+/*N*/ pOldSize = &((SwAttrSetChg*)pOld)->GetChgSet()->GetFrmSize();
+/*N*/ }
+/*N*/ else if( RES_FRM_SIZE == nWhich )
+/*N*/ {
+/*?*/ pOldSize = (const SwFmtFrmSize*)pOld;
+/*?*/ pNewSize = (const SwFmtFrmSize*)pNew;
+/*N*/ }
+
+/*N*/ if( pOldSize || pNewSize )
+/*N*/ {
+/*N*/ if ( !IsModifyLocked() )
+/*N*/ {
+/*N*/ ASSERT( pOldSize && pOldSize->Which() == RES_FRM_SIZE &&
+/*N*/ pNewSize && pNewSize->Which() == RES_FRM_SIZE,
+/*N*/ "Kein Old oder New fuer FmtFrmSize-Modify der SwTable." );
+/*N*/
+/*N*/ // Array zum Vergleichen der Box-Formatpointer; um zu verhindern,
+/*N*/ // das das gleiche Attribut immer wieder im selben Format
+/*N*/ // gesetzt wird. (+1 fuer das Ende-Kennzeichen)
+/*N*/ SvPtrarr aFmtArr( (BYTE)aLines[0]->GetTabBoxes().Count(), 1 );
+/*N*/
+/*N*/ ::binfilter::lcl_ModifyLines( aLines, pOldSize->GetWidth(), pNewSize->GetWidth(),
+/*N*/ aFmtArr );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ SwClient::Modify( pOld, pNew ); // fuers ObjectDying
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTable::GetTabCols()
+|*
+|* Ersterstellung MA 04. May. 93
+|* Letzte Aenderung MA 30. Nov. 95
+|*
+|*************************************************************************/
+
+
+
+
+// MS: Sonst Absturz auf der DEC-Kiste
+//
+#if defined(ALPHA) && defined(_MSC_VER)
+#pragma optimize("", off)
+#endif
+
+
+/*N*/ void SwTable::GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
+/*N*/ FASTBOOL bRefreshHidden, BOOL bCurRowOnly ) const
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //MA 30. Nov. 95: Opt: wenn bHidden gesetzt ist, wird neu das Hidden
+/*N*/ }
+
+#if defined(ALPHA) && defined(_MSC_VER)
+#pragma optimize("", on)
+#endif
+
+/*************************************************************************
+|*
+|* SwTable::SetTabCols()
+|*
+|* Ersterstellung MA 04. May. 93
+|* Letzte Aenderung MA 26. Aug. 98
+|*
+|*************************************************************************/
+//Struktur zur Parameteruebergabe
+
+
+
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* const SwTableBox* SwTable::GetTblBox( const Strn¡ng& rName ) const
+|* gebe den Pointer auf die benannte Box zurueck.
+|*
+|* Ersterstellung JP 30. Jun. 93
+|* Letzte Aenderung JP 30. Jun. 93
+|*
+|*************************************************************************/
+/*N*/ USHORT SwTable::_GetBoxNum( String& rStr, BOOL bFirst )
+/*N*/ {
+/*N*/ USHORT nRet = 0;
+/*N*/ xub_StrLen nPos = 0;
+/*N*/ if( bFirst )
+/*N*/ {
+/*N*/ // die 1. ist mit Buchstaben addressiert!
+/*N*/ sal_Unicode cChar;
+/*N*/ BOOL bFirst = TRUE;
+/*N*/ while( 0 != ( cChar = rStr.GetChar( nPos )) &&
+/*N*/ ( (cChar >= 'A' && cChar <= 'Z') ||
+/*N*/ (cChar >= 'a' && cChar <= 'z') ) )
+/*N*/ {
+/*N*/ if( (cChar -= 'A') >= 26 )
+/*?*/ cChar -= 'a' - '[';
+/*N*/ if( bFirst )
+/*N*/ bFirst = FALSE;
+/*N*/ else
+/*?*/ ++nRet;
+/*N*/ nRet = nRet * 52 + cChar;
+/*N*/ ++nPos;
+/*N*/ }
+/*N*/ rStr.Erase( 0, nPos ); // Zeichen aus dem String loeschen
+/*N*/ }
+/*N*/ else if( STRING_NOTFOUND == ( nPos = rStr.Search( aDotStr ) ))
+/*N*/ {
+/*N*/ nRet = rStr.ToInt32();
+/*N*/ rStr.Erase();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ nRet = rStr.Copy( 0, nPos ).ToInt32();
+/*?*/ rStr.Erase( 0, nPos+1 );
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ const SwTableBox* SwTable::GetTblBox( const String& rName ) const
+/*N*/ {
+/*N*/ const SwTableBox* pBox = 0;
+/*N*/ const SwTableLine* pLine;
+/*N*/ const SwTableLines* pLines;
+/*N*/ const SwTableBoxes* pBoxes;
+/*N*/
+/*N*/ USHORT nLine, nBox;
+/*N*/ String aNm( rName );
+/*N*/ while( aNm.Len() )
+/*N*/ {
+/*N*/ nBox = SwTable::_GetBoxNum( aNm, 0 == pBox );
+/*N*/ // erste Box ?
+/*N*/ if( !pBox )
+/*N*/ pLines = &GetTabLines();
+/*N*/ else
+/*N*/ {
+/*?*/ pLines = &pBox->GetTabLines();
+/*?*/ if( nBox )
+/*?*/ --nBox;
+/*N*/ }
+
+/*N*/ nLine = SwTable::_GetBoxNum( aNm );
+/*N*/
+/*N*/ // bestimme die Line
+/*N*/ if( !nLine || nLine > pLines->Count() )
+/*N*/ return 0;
+/*N*/ pLine = (*pLines)[ nLine-1 ];
+/*N*/
+/*N*/ // bestimme die Box
+/*N*/ pBoxes = &pLine->GetTabBoxes();
+/*N*/ if( nBox >= pBoxes->Count() )
+/*N*/ return 0;
+/*N*/ pBox = (*pBoxes)[ nBox ];
+/*N*/ }
+
+ // abpruefen, ob die gefundene Box auch wirklich eine Inhaltstragende
+ // Box ist ??
+/*N*/ if( pBox && !pBox->GetSttNd() )
+/*N*/ {
+/*?*/ ASSERT( FALSE, "Box ohne Inhalt, suche die naechste !!" );
+/*?*/ // "herunterfallen lassen" bis zur ersten Box
+/*?*/ while( pBox->GetTabLines().Count() )
+/*?*/ pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
+/*N*/ }
+/*N*/ return pBox;
+/*N*/ }
+
+/*M*/ SwTableBox* SwTable::GetTblBox( ULONG nSttIdx )
+/*M*/ {
+/*M*/ //MA: Zur Optimierung nicht immer umstaendlich das ganze SortArray abhuenern.
+/*M*/ //OS: #102675# converting text to table tries und certain conditions
+/*M*/ // to ask for a table box of a table that is not yet having a format
+/*M*/ if(!GetFrmFmt())
+/*M*/ return 0;
+/*M*/ SwTableBox *pRet = 0;
+/*M*/ SwNodes &rNds = GetFrmFmt()->GetDoc()->GetNodes();
+/*M*/ ULONG nIndex;
+/*M*/ SwCntntNode *pCNd = 0;
+/*M*/
+/*M*/ for ( nIndex = nSttIdx + 1; nIndex < rNds.Count() &&
+/*M*/ 0 == (pCNd = rNds[nIndex]->GetCntntNode());
+/*M*/ ++nIndex )
+/*M*/ /* do nothing */;
+/*M*/
+/*M*/ if ( pCNd )
+/*M*/ {
+/*M*/ SwClientIter aIter( *pCNd );
+/*M*/ SwFrm *pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) );
+/*M*/ while ( pFrm && !pFrm->IsCellFrm() )
+/*M*/ pFrm = pFrm->GetUpper();
+/*M*/ if ( pFrm )
+/*M*/ pRet = (SwTableBox*)((SwCellFrm*)pFrm)->GetTabBox();
+/*M*/ }
+/*M*/
+/*M*/ //Falls es das Layout noch nicht gibt oder sonstwie etwas schieft geht.
+/*M*/ if ( !pRet )
+/*M*/ {
+/*M*/ for( USHORT n = aSortCntBoxes.Count(); n; )
+/*M*/ if( aSortCntBoxes[ --n ]->GetSttIdx() == nSttIdx )
+/*M*/ return aSortCntBoxes[ n ];
+/*M*/ }
+/*M*/ return pRet;
+/*M*/ }
+
+/*N*/ BOOL SwTable::IsTblComplex() const
+/*N*/ {
+/*N*/ // returnt TRUE wenn sich in der Tabelle Verschachtelungen befinden
+/*N*/ // steht eine Box nicht in der obersten Line, da wurde gesplittet/
+/*N*/ // gemergt und die Struktur ist komplexer.
+/*N*/ for( USHORT n = 0; n < aSortCntBoxes.Count(); ++n )
+/*N*/ if( aSortCntBoxes[ n ]->GetUpper()->GetUpper() )
+/*N*/ return TRUE;
+/*N*/ return FALSE;
+/*N*/ }
+
+
+
+/*************************************************************************
+|*
+|* SwTableLine::SwTableLine()
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 09. Mar. 93
+|*
+|*************************************************************************/
+/*N*/ SwTableLine::SwTableLine( SwTableLineFmt *pFmt, USHORT nBoxes,
+/*N*/ SwTableBox *pUp )
+/*N*/ : SwClient( pFmt ),
+/*N*/ aBoxes( (BYTE)nBoxes, 1 ),
+/*N*/ pUpper( pUp )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwTableLine::~SwTableLine()
+/*N*/ {
+/*N*/ // ist die TabelleLine der letzte Client im FrameFormat, kann dieses
+/*N*/ // geloescht werden
+/*N*/ SwModify* pMod = GetFrmFmt();
+/*N*/ pMod->Remove( this ); // austragen,
+/*N*/ if( !pMod->GetDepends() )
+/*N*/ delete pMod; // und loeschen
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTableLine::ClaimFrmFmt(), ChgFrmFmt()
+|*
+|* Ersterstellung MA 03. May. 93
+|* Letzte Aenderung MA 07. Feb. 96
+|*
+|*************************************************************************/
+/*N*/ SwFrmFmt* SwTableLine::ClaimFrmFmt()
+/*N*/ {
+/*N*/ //Wenn noch andere TableLines ausser mir selbst an dem FrmFmt haengen,
+/*N*/ //sehe ich mich leider gezwungen mir ein eingenes zu machen und mich
+/*N*/ //bei diesem anzumelden.
+/*N*/ SwTableLineFmt *pOld = (SwTableLineFmt*)GetFrmFmt();
+/*N*/ SwClientIter aIter( *pOld );
+/*N*/
+/*N*/ SwClient* pLast;
+/*N*/
+/*N*/ for( pLast = aIter.First( TYPE( SwTableLine )); pLast && pLast == this;
+/*N*/ pLast = aIter.Next() )
+/*N*/ ;
+/*N*/
+/*N*/ if( pLast )
+/*N*/ {
+/*N*/ SwTableLineFmt *pNewFmt = pOld->GetDoc()->MakeTableLineFmt();
+/*N*/ *pNewFmt = *pOld;
+/*N*/
+/*N*/ //Erstmal die Frms ummelden.
+/*N*/ for( pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() )
+/*N*/ if( ((SwRowFrm*)pLast)->GetTabLine() == this )
+/*?*/ pNewFmt->Add( pLast );
+/*N*/
+/*N*/ //Jetzt noch mich selbst ummelden.
+/*N*/ pNewFmt->Add( this );
+/*N*/ pOld = pNewFmt;
+/*N*/ }
+/*N*/
+/*N*/ return pOld;
+/*N*/ }
+
+ void SwTableLine::ChgFrmFmt( SwTableLineFmt *pNewFmt )
+ {
+ SwFrmFmt *pOld = GetFrmFmt();
+ SwClientIter aIter( *pOld );
+ SwClient* pLast;
+
+ //Erstmal die Frms ummelden.
+ for( pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() )
+ {
+ SwRowFrm *pRow = (SwRowFrm*)pLast;
+ if( pRow->GetTabLine() == this )
+ {
+ pNewFmt->Add( pLast );
+ pRow->InvalidateSize();
+ pRow->_InvalidatePrt();
+ pRow->SetCompletePaint();
+ pRow->ReinitializeFrmSizeAttrFlags();
+ }
+ }
+
+ //Jetzt noch mich selbst ummelden.
+ pNewFmt->Add( this );
+
+ if ( !aIter.GoStart() )
+ delete pOld;
+ }
+
+/*************************************************************************
+|*
+|* SwTableBox::SwTableBox()
+|*
+|* Ersterstellung MA 04. May. 93
+|* Letzte Aenderung MA 04. May. 93
+|*
+|*************************************************************************/
+/*N*/ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, USHORT nLines, SwTableLine *pUp )
+/*N*/ : SwClient( 0 ),
+/*N*/ aLines( (BYTE)nLines, 1 ),
+/*N*/ pSttNd( 0 ),
+/*N*/ pUpper( pUp ),
+/*N*/ pImpl( 0 )
+/*N*/ {
+/*N*/ CheckBoxFmt( pFmt )->Add( this );
+/*N*/ }
+
+/*N*/ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwNodeIndex &rIdx,
+/*N*/ SwTableLine *pUp )
+/*N*/ : SwClient( 0 ),
+/*N*/ aLines( 0, 0 ),
+/*N*/ pUpper( pUp ),
+/*N*/ pImpl( 0 )
+/*N*/ {
+/*N*/ SwDoc* pDoc = pFmt->GetDoc();
+/*N*/ CheckBoxFmt( pFmt )->Add( this );
+/*N*/
+/*N*/ pSttNd = pDoc->GetNodes()[ rIdx ]->GetStartNode();
+/*N*/
+/*N*/ // an der Table eintragen
+/*N*/ const SwTableNode* pTblNd = pSttNd->FindTableNode();
+/*N*/ ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" );
+/*N*/ SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable().
+/*N*/ GetTabSortBoxes();
+/*N*/ SwTableBox* p = this; // error: &this
+/*N*/ rSrtArr.Insert( p ); // eintragen
+/*N*/ }
+
+/*N*/ SwTableBox::SwTableBox( SwTableBoxFmt* pFmt, const SwStartNode& rSttNd, SwTableLine *pUp ) :
+/*N*/ SwClient( 0 ),
+/*N*/ aLines( 0, 0 ),
+/*N*/ pUpper( pUp ),
+/*N*/ pImpl( 0 ),
+/*N*/ pSttNd( &rSttNd )
+/*N*/ {
+/*N*/ SwDoc* pDoc = pFmt->GetDoc();
+/*N*/ CheckBoxFmt( pFmt )->Add( this );
+/*N*/
+/*N*/ // an der Table eintragen
+/*N*/ const SwTableNode* pTblNd = pSttNd->FindTableNode();
+/*N*/ ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" );
+/*N*/ SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable().
+/*N*/ GetTabSortBoxes();
+/*N*/ SwTableBox* p = this; // error: &this
+/*N*/ rSrtArr.Insert( p ); // eintragen
+/*N*/ }
+
+/*N*/ SwTableBox::~SwTableBox()
+/*N*/ {
+/*N*/ // Inhaltstragende Box ?
+/*N*/ if( !GetFrmFmt()->GetDoc()->IsInDtor() && pSttNd )
+/*N*/ {
+/*N*/ // an der Table austragen
+/*?*/ const SwTableNode* pTblNd = pSttNd->FindTableNode();
+/*?*/ ASSERT( pTblNd, "in welcher Tabelle steht denn die Box?" );
+/*?*/ SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTblNd->GetTable().
+/*?*/ GetTabSortBoxes();
+/*?*/ SwTableBox *p = this; // error: &this
+/*?*/ rSrtArr.Remove( p ); // austragen
+/*N*/ }
+/*N*/
+/*N*/ // ist die TabelleBox der letzte Client im FrameFormat, kann dieses
+/*N*/ // geloescht werden
+/*N*/ SwModify* pMod = GetFrmFmt();
+/*N*/ pMod->Remove( this ); // austragen,
+/*N*/ if( !pMod->GetDepends() )
+/*N*/ delete pMod; // und loeschen
+/*N*/
+/*N*/ delete pImpl;
+/*N*/ }
+
+/*N*/ SwTableBoxFmt* SwTableBox::CheckBoxFmt( SwTableBoxFmt* pFmt )
+/*N*/ {
+ // sollte das Format eine Formel oder einen Value tragen, dann muss die
+ // Box alleine am Format haengen. Ggfs. muss ein neues angelegt werden.
+/*N*/ if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, FALSE ) ||
+/*N*/ SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMULA, FALSE ) )
+/*N*/ {
+/*N*/ SwClient* pOther = SwClientIter( *pFmt ).First( TYPE( SwTableBox ));
+/*N*/ if( pOther )
+/*N*/ {
+/*?*/ SwTableBoxFmt* pNewFmt = pFmt->GetDoc()->MakeTableBoxFmt();
+/*?*/ pNewFmt->LockModify();
+/*?*/ *pNewFmt = *pFmt;
+/*?*/
+/*?*/ // Values und Formeln entfernen
+/*?*/ pNewFmt->ResetAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
+/*?*/ pNewFmt->UnlockModify();
+/*?*/
+/*?*/ pFmt = pNewFmt;
+/*N*/ }
+/*N*/ }
+/*N*/ return pFmt;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTableBox::ClaimFrmFmt(), ChgFrmFmt()
+|*
+|* Ersterstellung MA 04. May. 93
+|* Letzte Aenderung MA 07. Feb. 96
+|*
+|*************************************************************************/
+/*N*/ SwFrmFmt* SwTableBox::ClaimFrmFmt()
+/*N*/ {
+/*N*/ //Wenn noch andere TableBoxen ausser mir selbst an dem FrmFmt haengen,
+/*N*/ //sehe ich mich leider gezwungen mir ein eingenes zu machen und mich
+/*N*/ //bei diesem anzumelden.
+/*N*/ SwTableBoxFmt *pOld = (SwTableBoxFmt*)GetFrmFmt();
+/*N*/ SwClientIter aIter( *pOld );
+/*N*/ SwClient* pLast;
+/*N*/
+/*N*/ for( pLast = aIter.First( TYPE( SwTableBox )); pLast && pLast == this;
+/*N*/ pLast = aIter.Next() )
+/*N*/ ;
+/*N*/
+/*N*/ if( pLast )
+/*N*/ {
+/*N*/ SwTableBoxFmt* pNewFmt = pOld->GetDoc()->MakeTableBoxFmt();
+/*N*/
+/*N*/ pNewFmt->LockModify();
+/*N*/ *pNewFmt = *pOld;
+/*N*/
+/*N*/ // Values und Formeln nie kopieren
+/*N*/ pNewFmt->ResetAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
+/*N*/ pNewFmt->UnlockModify();
+/*N*/
+/*N*/ //Erstmal die Frms ummelden.
+/*N*/ for( pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() )
+/*N*/ if( ((SwCellFrm*)pLast)->GetTabBox() == this )
+/*N*/ pNewFmt->Add( pLast );
+/*N*/
+/*N*/ //Jetzt noch mich selbst ummelden.
+/*N*/ pNewFmt->Add( this );
+/*N*/ pOld = pNewFmt;
+/*N*/ }
+/*N*/ return pOld;
+/*N*/ }
+
+/*N*/ void SwTableBox::ChgFrmFmt( SwTableBoxFmt* pNewFmt )
+/*N*/ {
+/*N*/ SwFrmFmt *pOld = GetFrmFmt();
+/*N*/ SwClientIter aIter( *pOld );
+/*N*/ SwClient* pLast;
+/*N*/
+/*N*/ //Erstmal die Frms ummelden.
+/*N*/ for( pLast = aIter.First( TYPE( SwFrm ) ); pLast; pLast = aIter.Next() )
+/*N*/ {
+/*N*/ SwCellFrm *pCell = (SwCellFrm*)pLast;
+/*N*/ if( pCell->GetTabBox() == this )
+/*N*/ {
+/*?*/ pNewFmt->Add( pLast );
+/*?*/ pCell->InvalidateSize();
+/*?*/ pCell->_InvalidatePrt();
+/*?*/ pCell->SetCompletePaint();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Jetzt noch mich selbst ummelden.
+/*N*/ pNewFmt->Add( this );
+/*N*/
+/*N*/ if( !aIter.GoStart() )
+/*?*/ delete pOld;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* String SwTableBox::GetName() const
+|* gebe den Namen dieser Box zurueck. Dieser wird dynamisch bestimmt
+|* und ergibt sich aus der Position in den Lines/Boxen/Tabelle
+|*
+|* Ersterstellung JP 30. Jun. 93
+|* Letzte Aenderung JP 30. Jun. 93
+|*
+|*************************************************************************/
+/*N*/ void lcl_GetTblBoxColStr( USHORT nCol, String& rNm )
+/*N*/ {
+/*N*/ const USHORT coDiff = 52; // 'A'-'Z' 'a' - 'z'
+/*N*/ register USHORT nCalc;
+/*N*/
+/*N*/ do {
+/*N*/ nCalc = nCol % coDiff;
+/*N*/ if( nCalc >= 26 )
+/*N*/ rNm.Insert( sal_Unicode('a' - 26 + nCalc ), 0 );
+/*N*/ else
+/*N*/ rNm.Insert( sal_Unicode('A' + nCalc ), 0 );
+/*N*/
+/*N*/ if( !(nCol -= nCalc) )
+/*N*/ break;
+/*N*/ nCol /= coDiff;
+/*N*/ --nCol;
+/*N*/ } while( 1 );
+/*N*/ }
+
+/*N*/ String SwTableBox::GetName() const
+/*N*/ {
+/*N*/ if( !pSttNd ) // keine Content Box ??
+/*N*/ {
+/*N*/ // die naechste erste Box suchen ??
+/*?*/ return aEmptyStr;
+/*N*/ }
+
+/*N*/ const SwTable& rTbl = pSttNd->FindTableNode()->GetTable();
+/*N*/ register USHORT nPos;
+/*N*/ String sNm, sTmp;
+/*N*/ const SwTableBox* pBox = this;
+/*N*/ do {
+/*N*/ const SwTableBoxes* pBoxes = &pBox->GetUpper()->GetTabBoxes();
+/*N*/ const SwTableLine* pLine = pBox->GetUpper();
+/*N*/ // auf oberstere Ebene ?
+/*N*/ const SwTableLines* pLines = pLine->GetUpper()
+/*N*/ ? &pLine->GetUpper()->GetTabLines() : &rTbl.GetTabLines();
+/*N*/
+/*N*/ sTmp = String::CreateFromInt32( nPos = pLines->GetPos( pLine ) + 1 );
+/*N*/ if( sNm.Len() )
+/*N*/ sNm.Insert( aDotStr, 0 ).Insert( sTmp, 0 );
+/*N*/ else
+/*N*/ sNm = sTmp;
+/*N*/
+/*N*/ sTmp = String::CreateFromInt32(( nPos = pBoxes->GetPos( pBox )) + 1 );
+/*N*/ if( 0 != ( pBox = pLine->GetUpper()) )
+/*N*/ sNm.Insert( aDotStr, 0 ).Insert( sTmp, 0 );
+/*N*/ else
+/*N*/ ::binfilter::lcl_GetTblBoxColStr( nPos, sNm );
+/*N*/
+/*N*/ } while( pBox );
+/*N*/ return sNm;
+/*N*/ }
+
+ // gebe den Zellnamen zu der angebenen Row/Col zurueck. Das ist
+ // nur fuer ausgeglichene Tabellen interessant, weil diese keine
+ // "Sub"Boxen kennen. Es wird z.B. aus (0,0) ein "A1".
+
+/*N*/ BOOL SwTableBox::IsInHeadline( const SwTable* pTbl ) const
+/*N*/ {
+/*N*/ if( !GetUpper() ) // sollte nur beim Merge vorkommen.
+/*N*/ return FALSE;
+/*N*/
+/*N*/ if( !pTbl )
+/*?*/ pTbl = &pSttNd->FindTableNode()->GetTable();
+/*N*/
+/*N*/ const SwTableLine* pLine = GetUpper();
+/*N*/ while( pLine->GetUpper() )
+/*?*/ pLine = pLine->GetUpper()->GetUpper();
+
+ // Headerline?
+/*N*/ return pTbl->GetTabLines()[ 0 ] == pLine;
+/*N*/ }
+
+#ifdef DBG_UTIL
+
+/*N*/ ULONG SwTableBox::GetSttIdx() const
+/*N*/ {
+/*N*/ return pSttNd ? pSttNd->GetIndex() : 0;
+/*N*/ }
+#endif
+
+ // erfrage vom Client Informationen
+/*N*/ BOOL SwTable::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ switch( rInfo.Which() )
+/*N*/ {
+/*N*/ case RES_AUTOFMT_DOCNODE:
+/*N*/ if( aSortCntBoxes.Count() &&
+/*N*/ &aSortCntBoxes[ 0 ]->GetSttNd()->GetNodes() ==
+/*N*/ ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *aSortCntBoxes[ 0 ]->GetSttNd() );
+/*N*/ ((SwAutoFmtGetDocNode&)rInfo).pCntntNode =
+/*N*/ GetFrmFmt()->GetDoc()->GetNodes().GoNext( &aIdx );
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FINDNEARESTNODE:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( GetFrmFmt() && ((SwFmtPageDesc&)GetFrmFmt()->GetAttr(
+/*?*/ break;
+/*?*/
+/*?*/ case RES_CONTENT_VISIBLE:
+/*?*/ {
+/*?*/ ((SwPtrMsgPoolItem&)rInfo).pObject =
+/*?*/ SwClientIter( *GetFrmFmt() ).First( TYPE(SwFrm) );
+/*?*/ }
+/*?*/ return FALSE;
+/*?*/ }
+/*?*/ return TRUE;
+/*N*/ }
+
+/*N*/ SwTable* SwTable::FindTable( SwFrmFmt* pFmt )
+/*N*/ {
+/*N*/ return pFmt ? (SwTable*)SwClientIter( *pFmt ).First( TYPE(SwTable) ) : 0;
+/*N*/ }
+
+/*N*/ SwTableNode* SwTable::GetTableNode() const
+/*N*/ {
+/*N*/ return GetTabSortBoxes().Count()
+/*N*/ ? (SwTableNode*)GetTabSortBoxes()[ 0 ]->GetSttNd()->FindTableNode()
+/*N*/ : 0;
+/*N*/ }
+
+ void SwTable::SetHTMLTableLayout( SwHTMLTableLayout *p )
+ {
+ delete pHTMLLayout;
+ pHTMLLayout = p;
+ }
+
+// zum Erkennen von Veraenderungen (haupts. TableBoxAttribute)
+/*N*/ void SwTableBoxFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ if( !IsModifyLocked() && !IsInDocDTOR() )
+/*N*/ {
+/*N*/ const SwTblBoxNumFormat *pNewFmt = 0, *pOldFmt = 0;
+/*N*/ const SwTblBoxFormula *pNewFml = 0, *pOldFml = 0;
+/*N*/ const SwTblBoxValue *pNewVal = 0, *pOldVal = 0;
+/*N*/ double aOldValue = 0;
+/*N*/ ULONG nOldFmt = NUMBERFORMAT_TEXT;
+/*N*/
+/*N*/ SwAttrSetChg *pNewChgSet = 0, *pOldChgSet = 0;
+/*N*/
+/*N*/ switch( pNew ? pNew->Which() : 0 )
+/*N*/ {
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ {
+/*N*/ const SfxItemSet& rSet = *((SwAttrSetChg*)pNew)->GetChgSet();
+/*N*/ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT,
+/*N*/ FALSE, (const SfxPoolItem**)&pNewFmt ) )
+/*N*/ nOldFmt = ((SwTblBoxNumFormat&)((SwAttrSetChg*)pOld)->
+/*N*/ GetChgSet()->Get( RES_BOXATR_FORMAT )).GetValue();
+/*N*/ rSet.GetItemState( RES_BOXATR_FORMULA, FALSE,
+/*N*/ (const SfxPoolItem**)&pNewFml );
+/*N*/ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE,
+/*N*/ FALSE, (const SfxPoolItem**)&pNewVal ) )
+/*N*/ aOldValue = ((SwTblBoxValue&)((SwAttrSetChg*)pOld)->
+/*N*/ GetChgSet()->Get( RES_BOXATR_VALUE )).GetValue();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_BOXATR_FORMAT:
+/*N*/ pNewFmt = (SwTblBoxNumFormat*)pNew;
+/*N*/ nOldFmt = ((SwTblBoxNumFormat*)pOld)->GetValue();
+/*N*/ break;
+/*N*/ case RES_BOXATR_FORMULA:
+/*N*/ pNewFml = (SwTblBoxFormula*)pNew;
+/*N*/ break;
+/*N*/ case RES_BOXATR_VALUE:
+/*N*/ pNewVal = (SwTblBoxValue*)pNew;
+/*N*/ aOldValue = ((SwTblBoxValue*)pOld)->GetValue();
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ // es hat sich etwas getan und im Set ist noch irgendein BoxAttribut
+/*N*/ // vorhanden!
+/*N*/ if( pNewFmt || pNewFml || pNewVal )
+/*N*/ {
+/*N*/ GetDoc()->SetFieldsDirty( TRUE );
+/*N*/
+/*N*/ if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMAT, FALSE ) ||
+/*N*/ SFX_ITEM_SET == GetItemState( RES_BOXATR_VALUE, FALSE ) ||
+/*N*/ SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, FALSE ) )
+/*N*/ {
+/*N*/ // die Box holen
+/*N*/ SwClientIter aIter( *this );
+/*N*/ SwTableBox* pBox = (SwTableBox*)aIter.First( TYPE( SwTableBox ) );
+/*N*/ if( pBox )
+/*N*/ {
+/*?*/ ASSERT( !aIter.Next(), "keine Box oder mehrere am Format" );
+/*?*/
+/*?*/ ULONG nNewFmt;
+/*?*/ if( pNewFmt )
+/*?*/ {
+/*?*/ nNewFmt = pNewFmt->GetValue();
+/*?*/ // neu Formatieren
+/*?*/ // ist es neuer oder wurde der akt. entfernt?
+/*?*/ if( SFX_ITEM_SET != GetItemState( RES_BOXATR_VALUE, FALSE ))
+/*?*/ pNewFmt = 0;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // das akt. Item besorgen
+/*?*/ GetItemState( RES_BOXATR_FORMAT, FALSE,
+/*?*/ (const SfxPoolItem**)&pNewFmt );
+/*?*/ nOldFmt = GetTblBoxNumFmt().GetValue();
+/*?*/ nNewFmt = pNewFmt ? pNewFmt->GetValue() : nOldFmt;
+/*?*/ }
+/*?*/
+/*?*/ // ist es neuer oder wurde der akt. entfernt?
+/*?*/ if( pNewVal )
+/*?*/ {
+/*?*/ if( NUMBERFORMAT_TEXT != nNewFmt )
+/*?*/ {
+/*?*/ if( SFX_ITEM_SET == GetItemState(
+/*?*/ RES_BOXATR_VALUE, FALSE ))
+/*?*/ nOldFmt = NUMBERFORMAT_TEXT;
+/*?*/ else
+/*?*/ nNewFmt = NUMBERFORMAT_TEXT;
+/*?*/ }
+/*?*/ else if( NUMBERFORMAT_TEXT == nNewFmt )
+/*?*/ nOldFmt = 0;
+/*?*/ }
+/*?*/
+/*?*/ // Logik:
+/*?*/ // ValueAenderung: -> "simuliere" eine FormatAenderung!
+/*?*/ // FormatAenderung:
+/*?*/ // Text -> !Text oder FormatAenderung:
+/*?*/ // - Ausrichtung auf RECHTS, wenn LINKS oder Blocksatz
+/*?*/ // - vertikale Ausrichtung auf UNTEN wenn OBEN oder nicht
+/*?*/ // gesetzt ist.
+/*?*/ // - Text ersetzen (Farbe?? neg. Zahlen ROT??)
+/*?*/ // !Text -> Text:
+/*?*/ // - Ausrichtung auf LINKS, wenn RECHTS
+/*?*/ // - vertikale Ausrichtung auf OEBN, wenn UNTEN gesetzt ist
+/*?*/
+/*?*/ SvNumberFormatter* pNumFmtr = GetDoc()->GetNumberFormatter();
+/*?*/ BOOL bNewIsTxtFmt = pNumFmtr->IsTextFormat( nNewFmt ) ||
+/*?*/ NUMBERFORMAT_TEXT == nNewFmt;
+/*?*/
+/*?*/ if( !bNewIsTxtFmt && nOldFmt != nNewFmt || pNewFml )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 BOOL bChgTxt = TRUE;
+/*?*/ }
+/*?*/ else if( bNewIsTxtFmt && nOldFmt != nNewFmt )
+/*?*/ {
+/*?*/ // auf jedenfall muessen jetzt die Formeln/Values
+/*?*/ // geloescht werden!
+/*?*/ // LockModify();
+/*?*/ // ResetAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
+/*?*/ // UnlockModify();
+/*?*/
+/*?*/
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ChgNumToText( *pBox, nNewFmt );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Und die Basis-Klasse rufen
+/*N*/ SwFrmFmt::Modify( pOld, pNew );
+/*N*/ }
+
+
+
+/*N*/ ULONG SwTableBox::IsValidNumTxtNd( BOOL bCheckAttr ) const
+/*N*/ {
+/*N*/ ULONG nPos = ULONG_MAX;
+/*N*/ if( pSttNd )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *pSttNd );
+/*N*/ const SwCntntNode* pCNd = pSttNd->GetNodes().GoNext( &aIdx );
+/*N*/ if( pCNd && pCNd->IsTxtNode() &&
+/*N*/ pSttNd->GetNodes()[ aIdx.GetIndex() + 1 ]->IsEndNode() )
+/*N*/ {
+/*N*/ if( bCheckAttr )
+/*N*/ {
+/*N*/ const SwpHints* pHts = ((SwTxtNode*)pCNd)->GetpSwpHints();
+/*N*/ const String& rTxt = ((SwTxtNode*)pCNd)->GetTxt();
+/*N*/ // if( rTxt.Len() )
+/*N*/ {
+/*N*/ nPos = aIdx.GetIndex();
+/*N*/
+/*N*/ // dann teste doch mal, ob das wirklich nur Text im Node steht!
+/*N*/ // Flys/Felder/..
+/*N*/ if( pHts )
+/*N*/ {
+/*?*/ for( USHORT n = 0; n < pHts->Count(); ++n )
+/*?*/ {
+/*?*/ const SwTxtAttr* pAttr = (*pHts)[ n ];
+/*?*/ if( RES_TXTATR_NOEND_BEGIN <= pAttr->Which() ||
+/*?*/ *pAttr->GetStart() ||
+/*?*/ *pAttr->GetAnyEnd() < rTxt.Len() )
+/*?*/ {
+/*?*/ nPos = ULONG_MAX;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nPos = aIdx.GetIndex();
+/*N*/ }
+/*N*/ }
+/*N*/ return nPos;
+/*N*/ }
+
+// ist das eine FormelBox oder eine Box mit numerischen Inhalt (AutoSum)
+
+// JP 12.09.97 - Bug 41223:
+// falls an der International Einstellung gedreht wurde, so muss beim Laden
+// eine entsprechende Aktualisierung erfolgen.
+/*N*/ void SwTableBox::ChgByLanguageSystem()
+/*N*/ {
+/*N*/ const SfxPoolItem *pFmtItem, *pValItem;
+/*N*/ SwFrmFmt* pFmt = GetFrmFmt();
+/*N*/ ULONG nFmtId;
+/*N*/ if( SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_FORMAT, TRUE, &pFmtItem )
+/*N*/ && ( nFmtId = ((SwTblBoxNumFormat*)pFmtItem)->GetValue()) < SV_COUNTRY_LANGUAGE_OFFSET
+/*N*/ && SFX_ITEM_SET == pFmt->GetItemState( RES_BOXATR_VALUE, TRUE, &pValItem ))
+/*N*/ {
+/*N*/ ULONG nNdPos;
+/*N*/ SvNumberFormatter* pNumFmtr = pFmt->GetDoc()->GetNumberFormatter();
+/*N*/
+/*N*/ if( !pNumFmtr->IsTextFormat( nFmtId ) &&
+/*N*/ ULONG_MAX != (nNdPos = IsValidNumTxtNd( TRUE )) )
+/*N*/ {
+/*N*/ double fVal = ((SwTblBoxValue*)pValItem)->GetValue();
+/*N*/ Color* pCol = 0;
+/*N*/ String sNewTxt;
+/*N*/ pNumFmtr->GetOutputString( fVal, nFmtId, sNewTxt, &pCol );
+/*N*/
+/*N*/ const String& rTxt = pSttNd->GetNodes()[ nNdPos ]->GetTxtNode()->GetTxt();
+/*N*/ if( rTxt != sNewTxt )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 ChgTextToNum( *this, sNewTxt, pCol, FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_tblafmt.cxx b/binfilter/bf_sw/source/core/doc/sw_tblafmt.cxx
new file mode 100644
index 000000000000..14bc8ad33d9d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_tblafmt.cxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+
+
+
+#include <horiornt.hxx>
+
+#include <bf_svtools/zformat.hxx>
+#include <bf_svx/dialogs.hrc>
+
+#define READ_OLDVERS // erstmal noch alte Versionen lesen
+
+#include <doc.hxx>
+#include <tblafmt.hxx>
+#include <cellatr.hxx>
+#include <errhdl.hxx>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+// bis SO5PF
+const USHORT AUTOFORMAT_ID_X = 9501;
+const USHORT AUTOFORMAT_ID_358 = 9601;
+const USHORT AUTOFORMAT_DATA_ID_X = 9502;
+
+// ab SO5
+//! in nachfolgenden Versionen muss der Betrag dieser IDs groesser sein
+const USHORT AUTOFORMAT_ID_504 = 9801;
+const USHORT AUTOFORMAT_DATA_ID_504 = 9802;
+
+const USHORT AUTOFORMAT_ID_552 = 9901;
+const USHORT AUTOFORMAT_DATA_ID_552 = 9902;
+
+// --- from 641 on: CJK and CTL font settings
+const USHORT AUTOFORMAT_ID_641 = 10001;
+const USHORT AUTOFORMAT_DATA_ID_641 = 10002;
+
+// current version
+const USHORT AUTOFORMAT_ID = AUTOFORMAT_ID_641;
+const USHORT AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_641;
+
+
+#ifdef READ_OLDVERS
+const USHORT AUTOFORMAT_OLD_ID = 8201;
+const USHORT AUTOFORMAT_OLD_ID1 = 8301;
+const USHORT AUTOFORMAT_OLD_DATA_ID = 8202;
+#endif
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_tblrwcl.cxx b/binfilter/bf_sw/source/core/doc/sw_tblrwcl.cxx
new file mode 100644
index 000000000000..ef000b483afd
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_tblrwcl.cxx
@@ -0,0 +1,1270 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#define _ZFORLIST_DECLARE_TABLE
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+
+#include <bf_svx/boxitem.hxx>
+
+#include <fmtfsize.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <frmtool.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <rowfrm.hxx>
+#include <swtblfmt.hxx>
+#include <tblrwcl.hxx>
+namespace binfilter {
+
+#define COLFUZZY 20
+#define ROWFUZZY 10
+
+typedef SwTableLine* SwTableLinePtr;
+
+/*N*/ SV_IMPL_PTRARR( _SwShareBoxFmts, SwShareBoxFmt* )
+
+// fuers setzen der Frame-Formate an den Boxen reicht es, das aktuelle
+// im Array zu suchen. Ist es vorhanden, so gebe das neue zurueck
+
+
+
+
+#if defined(DBG_UTIL) || defined( JP_DEBUG )
+
+void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize )
+{
+ const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
+
+ SwTwips nAktSize = 0;
+ // checke doch mal ob die Tabellen korrekte Breiten haben
+ for( USHORT n = 0; n < rBoxes.Count(); ++n )
+ {
+ const SwTableBox* pBox = rBoxes[ n ];
+ SwTwips nBoxW = pBox->GetFrmFmt()->GetFrmSize().GetWidth();
+ nAktSize += nBoxW;
+
+ for( USHORT i = 0; i < pBox->GetTabLines().Count(); ++i )
+ _CheckBoxWidth( *pBox->GetTabLines()[ i ], nBoxW );
+ }
+
+ if( Abs( nAktSize - nSize ) > ( COLFUZZY * rBoxes.Count() ) )
+ {
+ DBG_ERROR( "Boxen der Line zu klein/gross" );
+#if defined( WNT ) && defined( JP_DEBUG )
+ __asm int 3;
+#endif
+ }
+}
+
+ #define CHECKBOXWIDTH \
+ { \
+ SwTwips nSize = GetFrmFmt()->GetFrmSize().GetWidth(); \
+ for( USHORT n = 0; n < aLines.Count(); ++n ) \
+ _CheckBoxWidth( *aLines[ n ], nSize ); \
+ }
+
+ #define CHECKTABLELAYOUT \
+ { \
+ for ( int i = 0; i < GetTabLines().Count(); ++i ) \
+ { \
+ SwFrmFmt* pFmt = GetTabLines()[i]->GetFrmFmt(); \
+ SwClientIter aIter( *pFmt ); \
+ SwClient* pLast = aIter.GoStart(); \
+ if( pLast ) \
+ { \
+ do \
+ { \
+ SwFrm *pFrm = PTR_CAST( SwFrm, pLast ); \
+ if ( pFrm && \
+ ((SwRowFrm*)pFrm)->GetTabLine() == GetTabLines()[i] ) \
+ { \
+ ASSERT( pFrm->GetUpper()->IsTabFrm(), \
+ "Table layout does not match table structure" ) \
+ } \
+ } while ( 0 != ( pLast = aIter++ ) ); \
+ } \
+ } \
+ }
+
+#else
+
+#define CHECKBOXWIDTH
+#define CHECKTABLELAYOUT
+
+#endif
+
+//-----------------------------------------------------------
+
+
+
+void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset,
+ BOOL bFirst, SwShareBoxFmts& rShareFmts );
+
+void lcl_LastBoxSetWidthLine( SwTableLines &rLines, const long nOffset,
+ BOOL bFirst, SwShareBoxFmts& rShareFmts )
+{
+ for ( USHORT i = 0; i < rLines.Count(); ++i )
+ lcl_LastBoxSetWidth( rLines[i]->GetTabBoxes(), nOffset, bFirst,
+ rShareFmts );
+}
+
+void lcl_LastBoxSetWidth( SwTableBoxes &rBoxes, const long nOffset,
+ BOOL bFirst, SwShareBoxFmts& rShareFmts )
+{
+ SwTableBox& rBox = *rBoxes[ bFirst ? 0 : rBoxes.Count() - 1 ];
+ if( !rBox.GetSttNd() )
+ lcl_LastBoxSetWidthLine( rBox.GetTabLines(), nOffset,
+ bFirst, rShareFmts );
+
+ //Die Box anpassen
+ SwFrmFmt *pBoxFmt = rBox.GetFrmFmt();
+ SwFmtFrmSize aNew( pBoxFmt->GetFrmSize() );
+ aNew.SetWidth( aNew.GetWidth() + nOffset );
+ SwFrmFmt *pFmt = rShareFmts.GetFormat( *pBoxFmt, aNew );
+ if( pFmt )
+ rBox.ChgFrmFmt( (SwTableBoxFmt*)pFmt );
+ else
+ {
+ pFmt = rBox.ClaimFrmFmt();
+
+ pFmt->LockModify();
+ pFmt->SetAttr( aNew );
+ pFmt->UnlockModify();
+
+ rShareFmts.AddFormat( *pBoxFmt, *pFmt );
+ }
+}
+
+ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox,
+ BOOL bCalcNewSize, const BOOL bCorrBorder,
+ SwShareBoxFmts* pShareFmts )
+ {
+ do {
+ SwTwips nBoxSz = bCalcNewSize ?
+ pBox->GetFrmFmt()->GetFrmSize().GetWidth() : 0;
+ SwTableLine* pLine = pBox->GetUpper();
+ SwTableBoxes& rTblBoxes = pLine->GetTabBoxes();
+ USHORT nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pBox );
+ SwTableBox* pUpperBox = pBox->GetUpper()->GetUpper();
+
+ // Sonderbehandlung fuer Umrandung:
+ if( bCorrBorder && 1 < rTblBoxes.Count() )
+ {
+ BOOL bChgd = FALSE;
+ const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox();
+
+ if( rBoxItem.GetLeft() || rBoxItem.GetRight() )
+ {
+ //JP 02.04.97: 1.Teil fuer Bug 36271
+ // zuerst die linken/rechten Kanten
+ if( nDelPos + 1 < rTblBoxes.Count() )
+ {
+ SwTableBox* pNxtBox = rTblBoxes[ nDelPos + 1 ];
+ const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrmFmt()->GetBox();
+
+ SwTableBox* pPrvBox = nDelPos ? rTblBoxes[ nDelPos - 1 ] : 0;
+
+ if( pNxtBox->GetSttNd() && !rNxtBoxItem.GetLeft() &&
+ ( !pPrvBox || !pPrvBox->GetFrmFmt()->GetBox().GetRight()) )
+ {
+ SvxBoxItem aTmp( rNxtBoxItem );
+ aTmp.SetLine( rBoxItem.GetLeft() ? rBoxItem.GetLeft()
+ : rBoxItem.GetRight(),
+ BOX_LINE_LEFT );
+ if( pShareFmts )
+ pShareFmts->SetAttr( *pNxtBox, aTmp );
+ else
+ pNxtBox->ClaimFrmFmt()->SetAttr( aTmp );
+ bChgd = TRUE;
+ }
+ }
+ if( !bChgd && nDelPos )
+ {
+ SwTableBox* pPrvBox = rTblBoxes[ nDelPos - 1 ];
+ const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrmFmt()->GetBox();
+
+ SwTableBox* pNxtBox = nDelPos + 1 < rTblBoxes.Count()
+ ? rTblBoxes[ nDelPos + 1 ] : 0;
+
+ if( pPrvBox->GetSttNd() && !rPrvBoxItem.GetRight() &&
+ ( !pNxtBox || !pNxtBox->GetFrmFmt()->GetBox().GetLeft()) )
+ {
+ SvxBoxItem aTmp( rPrvBoxItem );
+ aTmp.SetLine( rBoxItem.GetLeft() ? rBoxItem.GetLeft()
+ : rBoxItem.GetRight(),
+ BOX_LINE_RIGHT );
+ if( pShareFmts )
+ pShareFmts->SetAttr( *pPrvBox, aTmp );
+ else
+ pPrvBox->ClaimFrmFmt()->SetAttr( aTmp );
+ }
+ }
+ }
+
+ }
+
+ // erst die Box, dann die Nodes loeschen!!
+ SwStartNode* pSttNd = (SwStartNode*)pBox->GetSttNd();
+ if( pShareFmts )
+ pShareFmts->RemoveFormat( *rTblBoxes[ nDelPos ]->GetFrmFmt() );
+ rTblBoxes.DeleteAndDestroy( nDelPos );
+
+ if( pSttNd )
+ {
+ pSttNd->GetDoc()->DeleteSection( pSttNd );
+ }
+
+ // auch die Zeile noch loeschen ??
+ if( rTblBoxes.Count() )
+ {
+ // dann passe noch die Frame-SSize an
+ BOOL bLastBox = nDelPos == rTblBoxes.Count();
+ if( bLastBox )
+ --nDelPos;
+ pBox = rTblBoxes[nDelPos];
+ if( bCalcNewSize )
+ {
+ SwFmtFrmSize aNew( pBox->GetFrmFmt()->GetFrmSize() );
+ aNew.SetWidth( aNew.GetWidth() + nBoxSz );
+ if( pShareFmts )
+ pShareFmts->SetSize( *pBox, aNew );
+ else
+ pBox->ClaimFrmFmt()->SetAttr( aNew );
+
+ if( !pBox->GetSttNd() )
+ {
+ // dann muss es auch rekursiv in allen Zeilen, in allen
+ // Zellen erfolgen!
+ SwShareBoxFmts aShareFmts;
+ lcl_LastBoxSetWidthLine( pBox->GetTabLines(), nBoxSz,
+ !bLastBox,
+ pShareFmts ? *pShareFmts
+ : aShareFmts );
+ }
+ }
+ break; // nichts mehr loeschen
+ }
+ // loesche die Line aus Tabelle/Box
+ if( !pUpperBox )
+ {
+ // dann loesche auch noch die Line aus der Tabelle
+ nDelPos = rTbl.GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ if( pShareFmts )
+ pShareFmts->RemoveFormat( *rTbl.GetTabLines()[ nDelPos ]->GetFrmFmt() );
+ rTbl.GetTabLines().DeleteAndDestroy( nDelPos );
+ break; // mehr kann nicht geloescht werden
+ }
+
+ // dann loesche auch noch die Line
+ pBox = pUpperBox;
+ nDelPos = pBox->GetTabLines().C40_GETPOS( SwTableLine, pLine );
+ if( pShareFmts )
+ pShareFmts->RemoveFormat( *pBox->GetTabLines()[ nDelPos ]->GetFrmFmt() );
+ pBox->GetTabLines().DeleteAndDestroy( nDelPos );
+ } while( !pBox->GetTabLines().Count() );
+ }
+
+ SwTableBox* lcl_FndNxtPrvDelBox( const SwTableLines& rTblLns,
+ SwTwips nBoxStt, SwTwips nBoxWidth,
+ USHORT nLinePos, BOOL bNxt,
+ SwSelBoxes* pAllDelBoxes, USHORT* pCurPos )
+ {
+ SwTableBox* pFndBox = 0;
+ do {
+ if( bNxt )
+ ++nLinePos;
+ else
+ --nLinePos;
+ SwTableLine* pLine = rTblLns[ nLinePos ];
+ SwTwips nFndBoxWidth, nFndWidth = nBoxStt + nBoxWidth;
+ USHORT nBoxCnt = pLine->GetTabBoxes().Count();
+
+ for( USHORT n = 0; 0 < nFndWidth && n < nBoxCnt; ++n )
+ {
+ pFndBox = pLine->GetTabBoxes()[ n ];
+ nFndWidth -= (nFndBoxWidth = pFndBox->GetFrmFmt()->
+ GetFrmSize().GetWidth());
+ }
+
+ // suche die erste ContentBox
+ while( !pFndBox->GetSttNd() )
+ {
+ const SwTableLines& rLowLns = pFndBox->GetTabLines();
+ if( bNxt )
+ pFndBox = rLowLns[ 0 ]->GetTabBoxes()[ 0 ];
+ else
+ pFndBox = rLowLns[ rLowLns.Count() - 1 ]->GetTabBoxes()[ 0 ];
+ }
+
+ if( Abs( nFndWidth ) > COLFUZZY ||
+ Abs( nBoxWidth - nFndBoxWidth ) > COLFUZZY )
+ pFndBox = 0;
+ else if( pAllDelBoxes )
+ {
+ // falls der Vorganger auch geloscht wird, ist nicht zu tun
+ USHORT nFndPos;
+ if( !pAllDelBoxes->Seek_Entry( pFndBox, &nFndPos ) )
+ break;
+
+ // sonst noch mal weitersuchen
+ // Die Box muessen wir aber nicht nochmal abpruefen
+ pFndBox = 0;
+ if( nFndPos <= *pCurPos )
+ --*pCurPos;
+ pAllDelBoxes->Remove( nFndPos );
+ }
+ } while( bNxt ? ( nLinePos + 1 < rTblLns.Count() ) : nLinePos );
+ return pFndBox;
+ }
+
+ void lcl_SaveUpperLowerBorder( SwTable& rTbl, const SwTableBox& rBox,
+ SwShareBoxFmts& rShareFmts,
+ SwSelBoxes* pAllDelBoxes = 0,
+ USHORT* pCurPos = 0 )
+ {
+ //JP 16.04.97: 2.Teil fuer Bug 36271
+ BOOL bChgd = FALSE;
+ const SwTableLine* pLine = rBox.GetUpper();
+ const SwTableBoxes& rTblBoxes = pLine->GetTabBoxes();
+ const SwTableBox* pUpperBox = &rBox;
+ USHORT nDelPos = rTblBoxes.C40_GETPOS( SwTableBox, pUpperBox );
+ pUpperBox = rBox.GetUpper()->GetUpper();
+ const SvxBoxItem& rBoxItem = rBox.GetFrmFmt()->GetBox();
+
+ // dann die unteren/oberen Kanten
+ if( rBoxItem.GetTop() || rBoxItem.GetBottom() )
+ {
+ bChgd = FALSE;
+ const SwTableLines* pTblLns;
+ if( pUpperBox )
+ pTblLns = &pUpperBox->GetTabLines();
+ else
+ pTblLns = &rTbl.GetTabLines();
+
+ USHORT nLnPos = pTblLns->GetPos( pLine );
+
+ // bestimme die Attr.Position der akt. zu loeschenden Box
+ // und suche dann in der unteren / oberen Line die entspr.
+ // Gegenstuecke
+ SwTwips nBoxStt = 0;
+ for( USHORT n = 0; n < nDelPos; ++n )
+ nBoxStt += rTblBoxes[ n ]->GetFrmFmt()->GetFrmSize().GetWidth();
+ SwTwips nBoxWidth = rBox.GetFrmFmt()->GetFrmSize().GetWidth();
+
+ SwTableBox *pPrvBox = 0, *pNxtBox = 0;
+ if( nLnPos ) // Vorgaenger?
+ pPrvBox = lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth,
+ nLnPos, FALSE, pAllDelBoxes, pCurPos );
+
+ if( nLnPos + 1 < pTblLns->Count() ) // Nachfolger?
+ pNxtBox = lcl_FndNxtPrvDelBox( *pTblLns, nBoxStt, nBoxWidth,
+ nLnPos, TRUE, pAllDelBoxes, pCurPos );
+
+ if( pNxtBox && pNxtBox->GetSttNd() )
+ {
+ const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrmFmt()->GetBox();
+ if( !rNxtBoxItem.GetTop() && ( !pPrvBox ||
+ !pPrvBox->GetFrmFmt()->GetBox().GetBottom()) )
+ {
+ SvxBoxItem aTmp( rNxtBoxItem );
+ aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
+ : rBoxItem.GetBottom(),
+ BOX_LINE_TOP );
+ rShareFmts.SetAttr( *pNxtBox, aTmp );
+ bChgd = TRUE;
+ }
+ }
+ if( !bChgd && pPrvBox && pPrvBox->GetSttNd() )
+ {
+ const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrmFmt()->GetBox();
+ if( !rPrvBoxItem.GetTop() && ( !pNxtBox ||
+ !pNxtBox->GetFrmFmt()->GetBox().GetTop()) )
+ {
+ SvxBoxItem aTmp( rPrvBoxItem );
+ aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
+ : rBoxItem.GetBottom(),
+ BOX_LINE_BOTTOM );
+ rShareFmts.SetAttr( *pPrvBox, aTmp );
+ }
+ }
+
+ }
+ }
+
+
+ BOOL SwTable::DeleteSel( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+ const BOOL bDelMakeFrms, const BOOL bCorrBorder )
+ {
+ ASSERT( pDoc && rBoxes.Count(), "keine gueltigen Werte" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return FALSE;
+
+ // es darf nie die gesamte Tabelle geloescht werden
+ SwNodes& rNds = pDoc->GetNodes();
+ if( rBoxes[0]->GetSttIdx()-1 == pTblNd->GetIndex() &&
+ rBoxes[rBoxes.Count()-1]->GetSttNd()->EndOfSectionIndex()+1
+ == pTblNd->EndOfSectionIndex() )
+ return FALSE;
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ //Lines fuer das Layout-Update herausuchen.
+ _FndBox aFndBox( 0, 0 );
+ if ( bDelMakeFrms )
+ {
+ aFndBox.SetTableLines( rBoxes, *this );
+ aFndBox.DelFrms( *this );
+ }
+ aFndBox.SaveChartData( *this );
+
+ SwShareBoxFmts aShareFmts;
+
+ // erst die Umrandung umsetzen, dann loeschen
+ if( bCorrBorder )
+ {
+ SwSelBoxes aBoxes;
+ aBoxes.Insert( &rBoxes );
+ for( USHORT n = 0; n < aBoxes.Count(); ++n )
+ lcl_SaveUpperLowerBorder( *this, *rBoxes[ n ], aShareFmts,
+ &aBoxes, &n );
+ }
+
+ for( USHORT n = 0; n < rBoxes.Count(); ++n )
+ _DeleteBox( *this, rBoxes[n], TRUE, bCorrBorder, &aShareFmts );
+
+ // dann raeume die Struktur aller Lines auf
+ GCLines();
+
+ if( bDelMakeFrms && aFndBox.AreLinesToRestore( *this ) )
+ aFndBox.MakeFrms( *this );
+ aFndBox.RestoreChartData( *this );
+
+ CHECKTABLELAYOUT
+
+ return TRUE;
+ }
+
+// ---------------------------------------------------------------
+
+/*
+ ----------------------- >> MERGE << ------------------------
+ Algorythmus:
+ ist in der _FndBox nur eine Line angegeben, nehme die Line
+ und teste die Anzahl der Boxen
+ - ist mehr als 1 Box angegeben, so wird auf Boxenebene zusammen-
+ gefasst, d.H. die neue Box wird so Breit wie die alten.
+ - Alle Lines die ueber/unter dem Bereich liegen werden in die
+ Box als Line + Box mit Lines eingefuegt
+ - Alle Lines die vor/hinter dem Bereich liegen werden in
+ die Boxen Left/Right eingetragen
+
+ ----------------------- >> MERGE << ------------------------
+*/
+
+void lcl_CpyLines( USHORT nStt, USHORT nEnd,
+ SwTableLines& rLines,
+ SwTableBox* pInsBox,
+ USHORT nPos = USHRT_MAX )
+{
+ for( USHORT n = nStt; n < nEnd; ++n )
+ rLines[n]->SetUpper( pInsBox );
+ if( USHRT_MAX == nPos )
+ nPos = pInsBox->GetTabLines().Count();
+ pInsBox->GetTabLines().Insert( &rLines, nPos, nStt, nEnd );
+ rLines.Remove( nStt, nEnd - nStt );
+}
+
+ void lcl_CpyBoxes( USHORT nStt, USHORT nEnd,
+ SwTableBoxes& rBoxes,
+ SwTableLine* pInsLine,
+ USHORT nPos = USHRT_MAX )
+ {
+ for( USHORT n = nStt; n < nEnd; ++n )
+ rBoxes[n]->SetUpper( pInsLine );
+ if( USHRT_MAX == nPos )
+ nPos = pInsLine->GetTabBoxes().Count();
+ pInsLine->GetTabBoxes().Insert( &rBoxes, nPos, nStt, nEnd );
+ rBoxes.Remove( nStt, nEnd - nStt );
+ }
+
+ void lcl_CalcWidth( SwTableBox* pBox )
+ {
+ // Annahme: jede Line in der Box ist gleich gross
+ SwFrmFmt* pFmt = pBox->ClaimFrmFmt();
+ ASSERT( pBox->GetTabLines().Count(), "Box hat keine Lines" );
+
+ SwTableLine* pLine = pBox->GetTabLines()[0];
+ ASSERT( pLine, "Box steht in keiner Line" );
+
+ long nWidth = 0;
+ for( USHORT n = 0; n < pLine->GetTabBoxes().Count(); ++n )
+ nWidth += pLine->GetTabBoxes()[n]->GetFrmFmt()->GetFrmSize().GetWidth();
+
+ pFmt->SetAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth, 0 ));
+
+ // in Boxen mit Lines darf es nur noch Size/Fillorder geben
+ pFmt->ResetAttr( RES_LR_SPACE, RES_FRMATR_END - 1 );
+ pFmt->ResetAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 );
+ }
+
+
+
+struct _InsULPara
+{
+ SwTableNode* pTblNd;
+ SwTableLine* pInsLine;
+ SwTableBox* pInsBox;
+ BOOL bUL_LR : 1; // Upper-Lower(TRUE) oder Left-Right(FALSE) ?
+ BOOL bUL : 1; // Upper-Left(TRUE) oder Lower-Right(FALSE) ?
+
+ SwTableBox* pLeftBox;
+ SwTableBox* pRightBox;
+ SwTableBox* pMergeBox;
+
+ _InsULPara( SwTableNode* pTNd, BOOL bUpperLower, BOOL bUpper,
+ SwTableBox* pLeft, SwTableBox* pMerge, SwTableBox* pRight,
+ SwTableLine* pLine=0, SwTableBox* pBox=0 )
+ : pTblNd( pTNd ), pInsLine( pLine ), pInsBox( pBox ),
+ pLeftBox( pLeft ), pMergeBox( pMerge ), pRightBox( pRight )
+ { bUL_LR = bUpperLower; bUL = bUpper; }
+
+ void SetLeft( SwTableBox* pBox=0 )
+ { bUL_LR = FALSE; bUL = TRUE; if( pBox ) pInsBox = pBox; }
+ void SetRight( SwTableBox* pBox=0 )
+ { bUL_LR = FALSE; bUL = FALSE; if( pBox ) pInsBox = pBox; }
+ void SetUpper( SwTableLine* pLine=0 )
+ { bUL_LR = TRUE; bUL = TRUE; if( pLine ) pInsLine = pLine; }
+ void SetLower( SwTableLine* pLine=0 )
+ { bUL_LR = TRUE; bUL = FALSE; if( pLine ) pInsLine = pLine; }
+};
+
+
+BOOL lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara )
+{
+ _InsULPara* pULPara = (_InsULPara*)pPara;
+ SwTableBoxes* pBoxes;
+
+ USHORT nStt = 0, nEnd = rpFndBox->GetLines().Count();
+ USHORT nInsPos = USHRT_MAX;
+ if( !pULPara->bUL_LR ) // Left/Right
+ {
+ USHORT nPos;
+ SwTableBox* pFndBox = (SwTableBox*)rpFndBox->GetBox();
+ pBoxes = &pFndBox->GetUpper()->GetTabBoxes();
+ if( pULPara->bUL ) // Left ?
+ {
+ // gibt es noch davor Boxen, dann move sie
+ if( 0 != ( nPos = pBoxes->C40_GETPOS( SwTableBox, pFndBox )) )
+ lcl_CpyBoxes( 0, nPos, *pBoxes, pULPara->pInsLine );
+ }
+ else // Right
+ // gibt es noch dahinter Boxen, dann move sie
+ if( (nPos = pBoxes->C40_GETPOS( SwTableBox, pFndBox )) +1 < pBoxes->Count() )
+ {
+ nInsPos = pULPara->pInsLine->GetTabBoxes().Count();
+ lcl_CpyBoxes( nPos+1, pBoxes->Count(),
+ *pBoxes, pULPara->pInsLine );
+ }
+ }
+ // Upper/Lower und gehts noch tiefer ??
+ else if( rpFndBox->GetLines().Count() )
+ {
+ // suche nur die Line, ab der Verschoben werden muss
+ nStt = pULPara->bUL ? 0 : rpFndBox->GetLines().Count()-1;
+ nEnd = nStt+1;
+ }
+
+ pBoxes = &pULPara->pInsLine->GetTabBoxes();
+
+ // geht es noch eine weitere Stufe runter?
+ if( rpFndBox->GetBox()->GetTabLines().Count() )
+ {
+ SwTableBox* pBox = new SwTableBox(
+ (SwTableBoxFmt*)rpFndBox->GetBox()->GetFrmFmt(), 0, pULPara->pInsLine );
+ _InsULPara aPara( *pULPara );
+ aPara.pInsBox = pBox;
+ ((_FndBox*)rpFndBox)->GetLines().ForEach( nStt, nEnd,
+ &lcl_Merge_MoveLine, &aPara );
+ if( pBox->GetTabLines().Count() )
+ {
+ if( USHRT_MAX == nInsPos )
+ nInsPos = pBoxes->Count();
+ pBoxes->C40_INSERT( SwTableBox, pBox, nInsPos );
+ lcl_CalcWidth( pBox ); // bereche die Breite der Box
+ }
+ else
+ delete pBox;
+ }
+ return TRUE;
+}
+
+BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara )
+{
+ _InsULPara* pULPara = (_InsULPara*)pPara;
+ SwTableLines* pLines;
+
+ USHORT nStt = 0, nEnd = rpFndLine->GetBoxes().Count();
+ USHORT nInsPos = USHRT_MAX;
+ if( pULPara->bUL_LR ) // UpperLower ?
+ {
+ USHORT nPos;
+ SwTableLine* pFndLn = (SwTableLine*)rpFndLine->GetLine();
+ pLines = pFndLn->GetUpper() ?
+ &pFndLn->GetUpper()->GetTabLines() :
+ &pULPara->pTblNd->GetTable().GetTabLines();
+
+ SwTableBox* pLBx = rpFndLine->GetBoxes()[0]->GetBox();
+ SwTableBox* pRBx = rpFndLine->GetBoxes()[
+ rpFndLine->GetBoxes().Count()-1]->GetBox();
+ USHORT nLeft = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pLBx );
+ USHORT nRight = pFndLn->GetTabBoxes().C40_GETPOS( SwTableBox, pRBx );
+
+// if( ( nLeft && nRight+1 < pFndLn->GetTabBoxes().Count() ) ||
+// ( !nLeft && nRight+1 >= pFndLn->GetTabBoxes().Count() ) )
+ if( !nLeft || nRight == pFndLn->GetTabBoxes().Count() )
+ {
+ if( pULPara->bUL ) // Upper ?
+ {
+ // gibt es noch davor Zeilen, dann move sie
+ if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) )
+ lcl_CpyLines( 0, nPos, *pLines, pULPara->pInsBox );
+ }
+ else
+ // gibt es noch dahinter Zeilen, dann move sie
+ if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() )
+ {
+ nInsPos = pULPara->pInsBox->GetTabLines().Count();
+ lcl_CpyLines( nPos+1, pLines->Count(), *pLines,
+ pULPara->pInsBox );
+ }
+ }
+ else if( nLeft )
+ {
+ // es gibt links noch weitere Boxen, also setze Left-
+ // und Merge-Box in eine Box und Line, fuege davor/dahinter
+ // eine Line mit Box ein, in die die oberen/unteren Lines
+ // eingefuegt werden
+ SwTableLine* pInsLine = pULPara->pLeftBox->GetUpper();
+ SwTableBox* pLMBox = new SwTableBox(
+ (SwTableBoxFmt*)pULPara->pLeftBox->GetFrmFmt(), 0, pInsLine );
+ SwTableLine* pLMLn = new SwTableLine(
+ (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pLMBox );
+ pLMLn->ClaimFrmFmt()->ResetAttr( RES_FRM_SIZE );
+
+ pLMBox->GetTabLines().C40_INSERT( SwTableLine, pLMLn, 0 );
+
+ lcl_CpyBoxes( 0, 2, pInsLine->GetTabBoxes(), pLMLn );
+
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pLMBox, 0 );
+
+ if( pULPara->bUL ) // Upper ?
+ {
+ // gibt es noch davor Zeilen, dann move sie
+ if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) )
+ lcl_CpyLines( 0, nPos, *pLines, pLMBox, 0 );
+ }
+ else
+ // gibt es noch dahinter Zeilen, dann move sie
+ if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() )
+ lcl_CpyLines( nPos+1, pLines->Count(), *pLines,
+ pLMBox );
+ lcl_CalcWidth( pLMBox ); // bereche die Breite der Box
+ }
+ else if( nRight+1 < pFndLn->GetTabBoxes().Count() )
+ {
+ // es gibt rechts noch weitere Boxen, also setze Right-
+ // und Merge-Box in eine Box und Line, fuege davor/dahinter
+ // eine Line mit Box ein, in die die oberen/unteren Lines
+ // eingefuegt werden
+ SwTableLine* pInsLine = pULPara->pRightBox->GetUpper();
+ SwTableBox* pRMBox;
+ if( pULPara->pLeftBox->GetUpper() == pInsLine )
+ {
+ pRMBox = new SwTableBox(
+ (SwTableBoxFmt*)pULPara->pRightBox->GetFrmFmt(), 0, pInsLine );
+ SwTableLine* pRMLn = new SwTableLine(
+ (SwTableLineFmt*)pInsLine->GetFrmFmt(), 2, pRMBox );
+ pRMLn->ClaimFrmFmt()->ResetAttr( RES_FRM_SIZE );
+ pRMBox->GetTabLines().C40_INSERT( SwTableLine, pRMLn, 0 );
+
+ lcl_CpyBoxes( 1, 3, pInsLine->GetTabBoxes(), pRMLn );
+
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, 0 );
+ }
+ else
+ {
+ // Left und Merge wurden schon zusammengefuegt, also move
+ // Right auch mit in die Line
+
+ pInsLine = pULPara->pLeftBox->GetUpper();
+ USHORT nMvPos = pULPara->pRightBox->GetUpper()->GetTabBoxes().
+ C40_GETPOS( SwTableBox, pULPara->pRightBox );
+ lcl_CpyBoxes( nMvPos, nMvPos+1,
+ pULPara->pRightBox->GetUpper()->GetTabBoxes(),
+ pInsLine );
+ pRMBox = pInsLine->GetUpper();
+
+ // sind schon Lines vorhanden, dann muessen diese in eine
+ // neue Line und Box
+ nMvPos = pRMBox->GetTabLines().C40_GETPOS( SwTableLine, pInsLine );
+ if( pULPara->bUL ? nMvPos
+ : nMvPos+1 < pRMBox->GetTabLines().Count() )
+ {
+ // alle Lines zu einer neuen Line und Box zusammenfassen
+ SwTableLine* pNewLn = new SwTableLine(
+ (SwTableLineFmt*)pInsLine->GetFrmFmt(), 1, pRMBox );
+ pNewLn->ClaimFrmFmt()->ResetAttr( RES_FRM_SIZE );
+ pRMBox->GetTabLines().C40_INSERT( SwTableLine, pNewLn,
+ pULPara->bUL ? nMvPos : nMvPos+1 );
+ pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn );
+ pNewLn->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox, 0 );
+
+ USHORT nPos1, nPos2;
+ if( pULPara->bUL )
+ nPos1 = 0,
+ nPos2 = nMvPos;
+ else
+ nPos1 = nMvPos+2,
+ nPos2 = pNewLn->GetUpper()->GetTabLines().Count();
+
+ lcl_CpyLines( nPos1, nPos2,
+ pNewLn->GetUpper()->GetTabLines(), pRMBox );
+ lcl_CalcWidth( pRMBox ); // bereche die Breite der Box
+
+ pRMBox = new SwTableBox( (SwTableBoxFmt*)pRMBox->GetFrmFmt(), 0, pNewLn );
+ pNewLn->GetTabBoxes().C40_INSERT( SwTableBox, pRMBox,
+ pNewLn->GetTabBoxes().Count() );
+ }
+ }
+ if( pULPara->bUL ) // Upper ?
+ {
+ // gibt es noch davor Zeilen, dann move sie
+ if( 0 != ( nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) )
+ lcl_CpyLines( 0, nPos, *pLines, pRMBox, 0 );
+ }
+ else
+ // gibt es noch dahinter Zeilen, dann move sie
+ if( (nPos = pLines->C40_GETPOS( SwTableLine, pFndLn )) +1 < pLines->Count() )
+ lcl_CpyLines( nPos+1, pLines->Count(), *pLines,
+ pRMBox );
+ lcl_CalcWidth( pRMBox ); // bereche die Breite der Box
+ }
+ else
+ ASSERT( FALSE , "Was denn nun" );
+ }
+ // Left/Right
+ else
+ {
+ // suche nur die Line, ab der Verschoben werden muss
+ nStt = pULPara->bUL ? 0 : rpFndLine->GetBoxes().Count()-1;
+ nEnd = nStt+1;
+ }
+ pLines = &pULPara->pInsBox->GetTabLines();
+
+ SwTableLine* pNewLine = new SwTableLine(
+ (SwTableLineFmt*)rpFndLine->GetLine()->GetFrmFmt(), 0, pULPara->pInsBox );
+ _InsULPara aPara( *pULPara ); // kopieren
+ aPara.pInsLine = pNewLine;
+ ((_FndLine*)rpFndLine)->GetBoxes().ForEach( nStt, nEnd,
+ &::binfilter::lcl_Merge_MoveBox, &aPara );
+ if( pNewLine->GetTabBoxes().Count() )
+ {
+ if( USHRT_MAX == nInsPos )
+ nInsPos = pLines->Count();
+ pLines->C40_INSERT( SwTableLine, pNewLine, nInsPos );
+ }
+ else
+ delete pNewLine;
+
+ return TRUE;
+}
+
+
+ BOOL SwTable::Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+ SwTableBox* pMergeBox )
+ {
+ ASSERT( pDoc && rBoxes.Count() && pMergeBox, "keine gueltigen Werte" );
+ SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ if( !pTblNd )
+ return FALSE;
+
+ // suche alle Boxen / Lines
+ _FndBox aFndBox( 0, 0 );
+ {
+ _FndPara aPara( rBoxes, &aFndBox );
+ GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ }
+ if( !aFndBox.GetLines().Count() )
+ return FALSE;
+
+ SetHTMLTableLayout( 0 ); // MIB 9.7.97: HTML-Layout loeschen
+
+ //Lines fuer das Layout-Update herausuchen.
+ aFndBox.SetTableLines( *this );
+ aFndBox.DelFrms( *this );
+ aFndBox.SaveChartData( *this );
+
+ _FndBox* pFndBox = &aFndBox;
+ while( 1 == pFndBox->GetLines().Count() &&
+ 1 == pFndBox->GetLines()[0]->GetBoxes().Count() )
+ pFndBox = pFndBox->GetLines()[0]->GetBoxes()[0];
+
+ SwTableLine* pInsLine = new SwTableLine(
+ (SwTableLineFmt*)pFndBox->GetLines()[0]->GetLine()->GetFrmFmt(), 0,
+ !pFndBox->GetUpper() ? 0 : pFndBox->GetBox() );
+ pInsLine->ClaimFrmFmt()->ResetAttr( RES_FRM_SIZE );
+
+ // trage die neue Line ein
+ SwTableLines* pLines = pFndBox->GetUpper() ?
+ &pFndBox->GetBox()->GetTabLines() : &GetTabLines();
+
+ SwTableLine* pNewLine = pFndBox->GetLines()[0]->GetLine();
+ USHORT nInsPos = pLines->C40_GETPOS( SwTableLine, pNewLine );
+ pLines->C40_INSERT( SwTableLine, pInsLine, nInsPos );
+
+ SwTableBox* pLeft = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine );
+ SwTableBox* pRight = new SwTableBox( (SwTableBoxFmt*)pMergeBox->GetFrmFmt(), 0, pInsLine );
+ pMergeBox->SetUpper( pInsLine );
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pLeft, 0 );
+ pLeft->ClaimFrmFmt();
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pMergeBox, 1 );
+ pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pRight, 2 );
+ pRight->ClaimFrmFmt();
+
+ // in diese kommen alle Lines, die ueber dem selektierten Bereich stehen
+ // Sie bilden also eine Upper/Lower Line
+ _InsULPara aPara( pTblNd, TRUE, TRUE, pLeft, pMergeBox, pRight, pInsLine );
+
+ // move die oben/unten ueberhaengenden Lines vom selektierten Bereich
+ pFndBox->GetLines()[0]->GetBoxes().ForEach( &::binfilter::lcl_Merge_MoveBox,
+ &aPara );
+ aPara.SetLower( pInsLine );
+ USHORT nEnd = pFndBox->GetLines().Count()-1;
+ pFndBox->GetLines()[nEnd]->GetBoxes().ForEach( &::binfilter::lcl_Merge_MoveBox,
+ &aPara );
+
+ // move die links/rechts hereinreichenden Boxen vom selektierten Bereich
+ aPara.SetLeft( pLeft );
+ pFndBox->GetLines().ForEach( &::binfilter::lcl_Merge_MoveLine, &aPara );
+
+ aPara.SetRight( pRight );
+ pFndBox->GetLines().ForEach( &lcl_Merge_MoveLine, &aPara );
+
+ if( !pLeft->GetTabLines().Count() )
+ _DeleteBox( *this, pLeft, 0, FALSE, FALSE );
+ else
+ {
+ lcl_CalcWidth( pLeft ); // bereche die Breite der Box
+ }
+ if( !pRight->GetTabLines().Count() )
+ _DeleteBox( *this, pRight, 0, FALSE, FALSE );
+ else
+ {
+ lcl_CalcWidth( pRight ); // bereche die Breite der Box
+ }
+
+ DeleteSel( pDoc, rBoxes, FALSE, FALSE );
+
+ // dann raeume die Struktur dieser Line noch mal auf:
+ // generell alle Aufraeumen
+ GCLines();
+
+ GetTabLines()[0]->GetTabBoxes().ForEach( &::binfilter::lcl_BoxSetHeadCondColl, 0 );
+
+ aFndBox.MakeFrms( *this );
+ aFndBox.RestoreChartData( *this );
+ CHECKBOXWIDTH
+ CHECKTABLELAYOUT
+
+ return TRUE;
+ }
+
+// ---------------------------------------------------------------
+
+// suche ab dieser Line nach der naechsten Box mit Inhalt
+ SwTableBox* SwTableLine::FindNextBox( const SwTable& rTbl,
+ const SwTableBox* pSrchBox, BOOL bOvrTblLns ) const
+ {
+ const SwTableLine* pLine = this; // fuer M800
+ SwTableBox* pBox;
+ USHORT nFndPos;
+ if( GetTabBoxes().Count() && pSrchBox &&
+ USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) &&
+ nFndPos + 1 != GetTabBoxes().Count() )
+ {
+ pBox = GetTabBoxes()[ nFndPos + 1 ];
+ while( pBox->GetTabLines().Count() )
+ pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
+ return pBox;
+ }
+
+ if( GetUpper() )
+ {
+ nFndPos = GetUpper()->GetTabLines().GetPos( pLine );
+ ASSERT( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" );
+ // gibts eine weitere Line
+ if( nFndPos+1 >= GetUpper()->GetTabLines().Count() )
+ return GetUpper()->GetUpper()->FindNextBox( rTbl, GetUpper(), bOvrTblLns );
+ pLine = GetUpper()->GetTabLines()[nFndPos+1];
+ }
+ else if( bOvrTblLns ) // ueber die "GrundLines" einer Tabelle ?
+ {
+ // suche in der Tabelle nach der naechsten Line
+ nFndPos = rTbl.GetTabLines().GetPos( pLine );
+ if( nFndPos + 1 >= rTbl.GetTabLines().Count() )
+ return 0; // es gibt keine weitere Box mehr
+
+ pLine = rTbl.GetTabLines()[ nFndPos+1 ];
+ }
+ else
+ return 0;
+
+ if( pLine->GetTabBoxes().Count() )
+ {
+ pBox = pLine->GetTabBoxes()[0];
+ while( pBox->GetTabLines().Count() )
+ pBox = pBox->GetTabLines()[0]->GetTabBoxes()[0];
+ return pBox;
+ }
+ return pLine->FindNextBox( rTbl, 0, bOvrTblLns );
+ }
+
+// suche ab dieser Line nach der vorherigen Box
+ SwTableBox* SwTableLine::FindPreviousBox( const SwTable& rTbl,
+ const SwTableBox* pSrchBox, BOOL bOvrTblLns ) const
+ {
+ const SwTableLine* pLine = this; // fuer M800
+ SwTableBox* pBox;
+ USHORT nFndPos;
+ if( GetTabBoxes().Count() && pSrchBox &&
+ USHRT_MAX != ( nFndPos = GetTabBoxes().GetPos( pSrchBox )) &&
+ nFndPos )
+ {
+ pBox = GetTabBoxes()[ nFndPos - 1 ];
+ while( pBox->GetTabLines().Count() )
+ {
+ pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1];
+ pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ }
+ return pBox;
+ }
+
+ if( GetUpper() )
+ {
+ nFndPos = GetUpper()->GetTabLines().GetPos( pLine );
+ ASSERT( USHRT_MAX != nFndPos, "Line nicht in der Tabelle" );
+ // gibts eine weitere Line
+ if( !nFndPos )
+ return GetUpper()->GetUpper()->FindPreviousBox( rTbl, GetUpper(), bOvrTblLns );
+ pLine = GetUpper()->GetTabLines()[nFndPos-1];
+ }
+ else if( bOvrTblLns ) // ueber die "GrundLines" einer Tabelle ?
+ {
+ // suche in der Tabelle nach der naechsten Line
+ nFndPos = rTbl.GetTabLines().GetPos( pLine );
+ if( !nFndPos )
+ return 0; // es gibt keine weitere Box mehr
+
+ pLine = rTbl.GetTabLines()[ nFndPos-1 ];
+ }
+ else
+ return 0;
+
+ if( pLine->GetTabBoxes().Count() )
+ {
+ pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ while( pBox->GetTabLines().Count() )
+ {
+ pLine = pBox->GetTabLines()[pBox->GetTabLines().Count()-1];
+ pBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ }
+ return pBox;
+ }
+ return pLine->FindPreviousBox( rTbl, 0, bOvrTblLns );
+ }
+
+// suche ab dieser Line nach der naechsten Box mit Inhalt
+
+// suche ab dieser Line nach der naechsten Box mit Inhalt
+BOOL lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara )
+{
+ // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen
+ const SwStartNode* pSttNd = rpBox->GetSttNd();
+ if( pSttNd )
+ pSttNd->CheckSectionCondColl();
+ else
+ ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_LineSetHeadCondColl, 0 );
+ return TRUE;
+}
+
+BOOL lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara )
+{
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_BoxSetHeadCondColl, 0 );
+ return TRUE;
+}
+
+/* */
+
+#ifdef _MSC_VER
+#pragma optimize( "", off )
+#endif
+
+
+//#pragma optimize( "", on )
+
+
+/* */
+
+//#pragma optimize( "", off )
+
+//#pragma optimize( "", on )
+
+
+// das Ergebnis des Positions Vergleiches
+// POS_BEFORE, // Box liegt davor
+// POS_BEHIND, // Box liegt dahinter
+// POS_INSIDE, // Box liegt vollstaendig in Start/End
+// POS_OUTSIDE, // Box ueberlappt Start/End vollstaendig
+// POS_EQUAL, // Box und Start/End sind gleich
+// POS_OVERLAP_BEFORE, // Box ueberlappt den Start
+// POS_OVERLAP_BEHIND // Box ueberlappt das Ende
+
+
+// Dummy Funktion fuer die Methode SetColWidth
+
+/* */
+
+
+#if defined(DBG_UTIL) || defined( JP_DEBUG )
+
+
+#endif
+
+#ifdef _MSC_VER
+#pragma optimize( "", on )
+#endif
+
+/* */
+
+
+ SwFrmFmt* SwShareBoxFmt::GetFormat( long nWidth ) const
+ {
+ SwFrmFmt *pRet = 0, *pTmp;
+ for( USHORT n = aNewFmts.Count(); n; )
+ if( ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])->GetFrmSize().GetWidth()
+ == nWidth )
+ {
+ pRet = pTmp;
+ break;
+ }
+ return pRet;
+ }
+
+ SwFrmFmt* SwShareBoxFmt::GetFormat( const SfxPoolItem& rItem ) const
+ {
+ const SfxPoolItem* pItem;
+ USHORT nWhich = rItem.Which();
+ SwFrmFmt *pRet = 0, *pTmp;
+ const SfxPoolItem& rFrmSz = pOldFmt->GetAttr( RES_FRM_SIZE, FALSE );
+ for( USHORT n = aNewFmts.Count(); n; )
+ if( SFX_ITEM_SET == ( pTmp = (SwFrmFmt*)aNewFmts[ --n ])->
+ GetItemState( nWhich, FALSE, &pItem ) && *pItem == rItem &&
+ pTmp->GetAttr( RES_FRM_SIZE, FALSE ) == rFrmSz )
+ {
+ pRet = pTmp;
+ break;
+ }
+ return pRet;
+ }
+
+ void SwShareBoxFmt::AddFormat( const SwFrmFmt& rNew )
+ {
+ void* pFmt = (void*)&rNew;
+ aNewFmts.Insert( pFmt, aNewFmts.Count() );
+ }
+
+ FASTBOOL SwShareBoxFmt::RemoveFormat( const SwFrmFmt& rFmt )
+ {
+ // returnt TRUE, wenn geloescht werden kann
+ if( pOldFmt == &rFmt )
+ return TRUE;
+
+ void* p = (void*)&rFmt;
+ USHORT nFnd = aNewFmts.GetPos( p );
+ if( USHRT_MAX != nFnd )
+ aNewFmts.Remove( nFnd );
+ return 0 == aNewFmts.Count();
+ }
+
+/*N*/ SwShareBoxFmts::~SwShareBoxFmts()
+/*N*/ {
+/*N*/ }
+
+ SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt, long nWidth ) const
+ {
+ USHORT nPos;
+ return Seek_Entry( rFmt, &nPos )
+ ? aShareArr[ nPos ]->GetFormat( nWidth )
+ : 0;
+ }
+ SwFrmFmt* SwShareBoxFmts::GetFormat( const SwFrmFmt& rFmt,
+ const SfxPoolItem& rItem ) const
+ {
+ USHORT nPos;
+ return Seek_Entry( rFmt, &nPos )
+ ? aShareArr[ nPos ]->GetFormat( rItem )
+ : 0;
+ }
+
+ void SwShareBoxFmts::AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew )
+ {
+ // wenn das Format nicht geshared ist, braucht es auch nicht in die
+ // Liste aufgenommen werden. Denn es gibt keinen 2. der es sucht.
+ //leider werden auch die CellFrms gefunden
+ // if( !rOld.IsLastDepend() )
+ {
+ USHORT nPos;
+ SwShareBoxFmt* pEntry;
+ if( !Seek_Entry( rOld, &nPos ))
+ {
+ pEntry = new SwShareBoxFmt( rOld );
+ aShareArr.C40_INSERT( SwShareBoxFmt, pEntry, nPos );
+ }
+ else
+ pEntry = aShareArr[ nPos ];
+
+ pEntry->AddFormat( rNew );
+ }
+ }
+ void SwShareBoxFmts::ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn,
+ SwFrmFmt& rFmt )
+ {
+ SwClient aCl;
+ SwFrmFmt* pOld = 0;
+ if( pBox )
+ {
+ pOld = pBox->GetFrmFmt();
+ pOld->Add( &aCl );
+ pBox->ChgFrmFmt( (SwTableBoxFmt*)&rFmt );
+ }
+ else if( pLn )
+ {
+ pOld = pLn->GetFrmFmt();
+ pOld->Add( &aCl );
+ pLn->ChgFrmFmt( (SwTableLineFmt*)&rFmt );
+ }
+ if( pOld && pOld->IsLastDepend() )
+ {
+ RemoveFormat( *pOld );
+ delete pOld;
+ }
+ }
+
+void SwShareBoxFmts::SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz )
+{
+ SwFrmFmt *pBoxFmt = rBox.GetFrmFmt(),
+ *pRet = GetFormat( *pBoxFmt, rSz.GetWidth() );
+ if( pRet )
+ ChangeFrmFmt( &rBox, 0, *pRet );
+ else
+ {
+ pRet = rBox.ClaimFrmFmt();
+ pRet->SetAttr( rSz );
+ AddFormat( *pBoxFmt, *pRet );
+ }
+}
+
+ void SwShareBoxFmts::SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem )
+ {
+ SwFrmFmt *pBoxFmt = rBox.GetFrmFmt(),
+ *pRet = GetFormat( *pBoxFmt, rItem );
+ if( pRet )
+ ChangeFrmFmt( &rBox, 0, *pRet );
+ else
+ {
+ pRet = rBox.ClaimFrmFmt();
+ pRet->SetAttr( rItem );
+ AddFormat( *pBoxFmt, *pRet );
+ }
+ }
+
+
+ void SwShareBoxFmts::RemoveFormat( const SwFrmFmt& rFmt )
+ {
+ for( USHORT i = aShareArr.Count(); i; )
+ if( aShareArr[ --i ]->RemoveFormat( rFmt ))
+ aShareArr.DeleteAndDestroy( i );
+ }
+
+ BOOL SwShareBoxFmts::Seek_Entry( const SwFrmFmt& rFmt, USHORT* pPos ) const
+ {
+ ULONG nIdx = (ULONG)&rFmt;
+ register USHORT nO = aShareArr.Count(), nM, nU = 0;
+ if( nO > 0 )
+ {
+ nO--;
+ while( nU <= nO )
+ {
+ nM = nU + ( nO - nU ) / 2;
+ ULONG nFmt = (ULONG)&aShareArr[ nM ]->GetOldFormat();
+ if( nFmt == nIdx )
+ {
+ if( pPos )
+ *pPos = nM;
+ return TRUE;
+ }
+ else if( nFmt < nIdx )
+ nU = nM + 1;
+ else if( nM == 0 )
+ {
+ if( pPos )
+ *pPos = nU;
+ return FALSE;
+ }
+ else
+ nO = nM - 1;
+ }
+ }
+ if( pPos )
+ *pPos = nU;
+ return FALSE;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/doc/sw_visiturl.cxx b/binfilter/bf_sw/source/core/doc/sw_visiturl.cxx
new file mode 100644
index 000000000000..c3ad467d87b5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/doc/sw_visiturl.cxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include <bf_sfx2/docfile.hxx>
+#include <bf_svtools/inethist.hxx>
+
+#include <fmtinfmt.hxx>
+#include <txtinet.hxx>
+#include <doc.hxx>
+#include <visiturl.hxx>
+#include <hints.hxx>
+#include <ndtxt.hxx>
+#include <viscrs.hxx>
+#include <editsh.hxx>
+#include <docsh.hxx>
+namespace binfilter {
+
+
+/*N*/ SwURLStateChanged::SwURLStateChanged( const SwDoc* pD )
+/*N*/ : pDoc( pD )
+/*N*/ {
+/*N*/ StartListening( *INetURLHistory::GetOrCreate() );
+/*N*/ }
+
+/*N*/ SwURLStateChanged::~SwURLStateChanged()
+/*N*/ {
+/*N*/ EndListening( *INetURLHistory::GetOrCreate() );
+/*N*/ }
+
+/*N*/ void SwURLStateChanged::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+/*N*/ {
+/*N*/ if( rHint.ISA( INetURLHistoryHint ) && pDoc->GetRootFrm() )
+/*N*/ {
+/*N*/ // diese URL wurde veraendert:
+/*N*/ const INetURLObject* pIURL = ((INetURLHistoryHint&)rHint).GetObject();
+/*N*/ String sURL( pIURL->GetMainURL( INetURLObject::NO_DECODE ) ), sBkmk;
+/*N*/
+/*N*/ SwEditShell* pESh = pDoc->GetEditShell();
+/*N*/
+/*N*/ if( pDoc->GetDocShell() && pDoc->GetDocShell()->GetMedium() &&
+/*N*/ // falls das unser Doc ist, kann es auch lokale Spruenge geben!
+/*N*/ sURL == pDoc->GetDocShell()->GetMedium()->GetName() )
+/*?*/ (sBkmk = pIURL->GetMark()).Insert( INET_MARK_TOKEN, 0 );
+/*N*/
+/*N*/ BOOL bAction = FALSE, bUnLockView = FALSE;
+/*N*/ const SwFmtINetFmt* pItem;
+/*N*/ const SwTxtINetFmt* pTxtAttr;
+/*N*/ const SwTxtNode* pTxtNd;
+/*N*/ USHORT n, nMaxItems = pDoc->GetAttrPool().GetItemCount( RES_TXTATR_INETFMT );
+/*N*/ for( n = 0; n < nMaxItems; ++n )
+/*N*/ if( 0 != (pItem = (SwFmtINetFmt*)pDoc->GetAttrPool().GetItem(
+/*N*/ RES_TXTATR_INETFMT, n ) ) &&
+/*N*/ ( pItem->GetValue() == sURL ||
+/*N*/ ( sBkmk.Len() && pItem->GetValue() == sBkmk )) &&
+/*N*/ 0 != ( pTxtAttr = pItem->GetTxtINetFmt()) &&
+/*N*/ 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) )
+/*N*/ {
+/*?*/ if( !bAction && pESh )
+/*?*/ {
+/*?*/ pESh->StartAllAction();
+/*?*/ bAction = TRUE;
+/*?*/ bUnLockView = !pESh->IsViewLocked();
+/*?*/ pESh->LockView( TRUE );
+/*?*/ }
+/*?*/ ((SwTxtINetFmt*)pTxtAttr)->SetValidVis( FALSE );
+/*?*/ const SwTxtAttr* pAttr = pTxtAttr;
+/*?*/ SwUpdateAttr aUpdateAttr( *pAttr->GetStart(),
+/*?*/ *pAttr->GetEnd(),
+/*?*/ RES_FMT_CHG );
+/*?*/ ((SwTxtNode*)pTxtNd)->SwCntntNode::Modify( &aUpdateAttr,
+/*?*/ &aUpdateAttr );
+/*?*/ }
+/*N*/
+/*N*/ if( bAction )
+/*?*/ pESh->EndAllAction();
+/*N*/ if( bUnLockView )
+/*?*/ pESh->LockView( FALSE );
+/*N*/ }
+/*N*/ }
+
+ // erfrage ob die URL besucht war. Uebers Doc, falls nur ein Bookmark
+ // angegeben ist. Dann muss der Doc. Name davor gesetzt werden!
+/*N*/ BOOL SwDoc::IsVisitedURL( const String& rURL ) const
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static long nTmp = 0;
+/*N*/ ++nTmp;
+/*N*/ #endif
+/*N*/
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if( rURL.Len() )
+/*N*/ {
+/*N*/ INetURLHistory *pHist = INetURLHistory::GetOrCreate();
+/*N*/ if( '#' == rURL.GetChar( 0 ) && pDocShell && pDocShell->GetMedium() )
+/*N*/ {
+/*N*/ INetURLObject aIObj( pDocShell->GetMedium()->GetURLObject() );
+/*N*/ aIObj.SetMark( rURL.Copy( 1 ) );
+/*N*/ bRet = pHist->QueryUrl( aIObj );
+/*N*/ }
+/*N*/ else
+/*N*/ bRet = pHist->QueryUrl( rURL );
+/*N*/
+/*N*/ // dann wollen wird auch ueber Statusaenderungen in der History
+/*N*/ // informiert werden!
+/*N*/ if( !pURLStateChgd )
+/*N*/ {
+/*N*/ SwDoc* pD = (SwDoc*)this;
+/*N*/ pD->pURLStateChgd = new SwURLStateChanged( this );
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/makefile.mk b/binfilter/bf_sw/source/core/docnode/makefile.mk
new file mode 100644
index 000000000000..86c4fdc61eee
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/makefile.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_docnode
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_ndindex.cxx \
+ sw_ndcopy.cxx \
+ sw_ndnotxt.cxx \
+ sw_ndnum.cxx \
+ sw_ndsect.cxx \
+ sw_ndtbl.cxx \
+ sw_ndtbl1.cxx \
+ sw_node.cxx \
+ sw_node2lay.cxx \
+ sw_nodes.cxx \
+ sw_section.cxx \
+ sw_swbaslnk.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/sw_ndindex.obj \
+ $(SLO)$/sw_ndcopy.obj \
+ $(SLO)$/sw_ndnotxt.obj \
+ $(SLO)$/sw_ndnum.obj \
+ $(SLO)$/sw_ndsect.obj \
+ $(SLO)$/sw_ndtbl.obj \
+ $(SLO)$/sw_ndtbl1.obj \
+ $(SLO)$/sw_node.obj \
+ $(SLO)$/sw_node2lay.obj \
+ $(SLO)$/sw_nodes.obj \
+ $(SLO)$/sw_section.obj \
+ $(SLO)$/sw_swbaslnk.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndarr.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndarr.cxx
new file mode 100644
index 000000000000..677da90cd4ae
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndarr.cxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <index.hxx>
+#include <ndarr.hxx>
+namespace binfilter {
+
+
+void SwNds::Insert(const SwNodePtr &aElement, const SwIndex & aPos)
+{
+ theArr.Insert((const ElementPtr&) aElement, aPos.GetIndex());
+ SwIndexReg::Update(aPos, 1);
+}
+
+void SwNds::Insert(const SwNodePtr* pElement, USHORT nLen, const SwIndex & aPos)
+{
+ theArr.Insert((const ElementPtr*) pElement, nLen, aPos.GetIndex());
+ SwIndexReg::Update(aPos, nLen);
+}
+
+void SwNds::Remove(const SwIndex & aPos, USHORT nLen)
+{
+ if(nLen)
+ {
+ theArr.Remove(aPos.GetIndex(), nLen);
+ SwIndexReg::Update(aPos, nLen, TRUE);
+ }
+}
+
+BOOL SwNds::Move( const SwIndex & rOldPos, const SwIndex & rNewPos )
+{
+ register USHORT nDelPos = rOldPos.GetIndex(),
+ nInsPos = rNewPos.GetIndex();
+ if( nDelPos == nInsPos || nDelPos +1 == nInsPos )
+ return FALSE;
+ theArr.Move( nDelPos, nInsPos );
+ SwIndexReg::MoveIdx( rOldPos, rNewPos );
+ return TRUE;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndcopy.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndcopy.cxx
new file mode 100644
index 000000000000..84fd550cfd82
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndcopy.cxx
@@ -0,0 +1,563 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _ZFORLIST_DECLARE_TABLE
+#include <hintids.hxx>
+
+
+
+#include <fmtanchr.hxx>
+#include <fmtcntnt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx>
+#include <ddefld.hxx>
+#include <mvsave.hxx>
+#include <cellatr.hxx>
+#include <swtblfmt.hxx>
+#include <swddetbl.hxx>
+#include <docary.hxx>
+#include <fmtcnct.hxx>
+#include <redline.hxx>
+namespace binfilter {
+
+// Struktur fuer das Mappen von alten und neuen Frame-Formaten an den
+// Boxen und Lines einer Tabelle
+
+/*N*/ struct _MapTblFrmFmt
+/*N*/ {
+/*N*/ const SwFrmFmt *pOld, *pNew;
+/*N*/ _MapTblFrmFmt( const SwFrmFmt *pOldFmt, const SwFrmFmt*pNewFmt )
+/*N*/ : pOld( pOldFmt ), pNew( pNewFmt )
+/*N*/ {}
+/*N*/ };
+
+/*N*/ SV_DECL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt, 0, 10 )//STRIP008 ;
+/*N*/ SV_IMPL_VARARR( _MapTblFrmFmts, _MapTblFrmFmt );
+
+/*N*/ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+/*N*/ {
+/*N*/ // the Copy-Textnode is the Node with the Text, the Copy-Attrnode is the
+/*N*/ // node with the collection and hard attributes. Normally ist the same
+/*N*/ // node, but if insert a glossary without formatting, then the Attrnode
+/*N*/ // is the prev node of the destionation position in dest. document.
+/*N*/ SwTxtNode* pCpyTxtNd = (SwTxtNode*)this;
+/*N*/ SwTxtNode* pCpyAttrNd = pCpyTxtNd;
+/*N*/
+/*N*/ // kopiere die Formate in das andere Dokument:
+/*N*/ SwTxtFmtColl* pColl = 0;
+/*N*/ if( pDoc->IsInsOnlyTextGlossary() )
+/*N*/ {
+/*?*/ SwNodeIndex aIdx( rIdx, -1 );
+/*?*/ if( aIdx.GetNode().IsTxtNode() )
+/*?*/ {
+/*?*/ pCpyAttrNd = aIdx.GetNode().GetTxtNode();
+/*?*/ pColl = &pCpyAttrNd->GetTxtColl()->GetNextTxtFmtColl();
+/*?*/ }
+/*N*/ }
+/*N*/ if( !pColl )
+/*N*/ pColl = pDoc->CopyTxtColl( *GetTxtColl() );
+/*N*/
+/*N*/ SwTxtNode* pTxtNd = pDoc->GetNodes().MakeTxtNode( rIdx, pColl );
+/*N*/
+/*N*/ // kopiere Attribute/Text
+/*N*/ if( !pCpyAttrNd->GetpSwAttrSet() )
+/*N*/ // wurde ein AttrSet fuer die Numerierung angelegt, so loesche diesen!
+/*N*/ pTxtNd->ResetAllAttr();
+/*N*/
+/*N*/ // if Copy-Textnode unequal to Copy-Attrnode, then copy first
+/*N*/ // the attributes into the new Node.
+/*N*/ if( pCpyAttrNd != pCpyTxtNd )
+/*N*/ {
+/*?*/ pCpyAttrNd->CopyAttr( pTxtNd, 0, 0 );
+/*?*/ if( pCpyAttrNd->GetpSwAttrSet() )
+/*?*/ {
+/*?*/ SwAttrSet aSet( *pCpyAttrNd->GetpSwAttrSet() );
+/*?*/ aSet.ClearItem( RES_PAGEDESC );
+/*?*/ aSet.ClearItem( RES_BREAK );
+/*?*/ aSet.CopyToModify( *pTxtNd );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // ??? reicht das ??? was ist mit PostIts/Feldern/FeldTypen ???
+/*N*/ pCpyTxtNd->Copy( pTxtNd, SwIndex( pCpyTxtNd ), pCpyTxtNd->GetTxt().Len() );
+/*N*/
+/*N*/ if( pCpyAttrNd->GetNum() )
+/*N*/ pTxtNd->UpdateNum( *pCpyAttrNd->GetNum() );
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ if( RES_CONDTXTFMTCOLL == pColl->Which() )
+/*N*/ pTxtNd->ChkCondColl();
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ return pTxtNd;
+/*N*/ }
+
+
+/*N*/ BOOL lcl_SrchNew( const _MapTblFrmFmt& rMap, void * pPara )
+/*N*/ {
+/*N*/ if( rMap.pOld != *(const SwFrmFmt**)pPara )
+/*N*/ return TRUE;
+/*N*/ *((const SwFrmFmt**)pPara) = rMap.pNew;
+/*N*/ return FALSE; // abbrechen, Pointer gefunden
+/*N*/ }
+
+
+/*N*/ struct _CopyTable
+/*N*/ {
+/*N*/ SwDoc* pDoc;
+/*N*/ ULONG nOldTblSttIdx;
+/*N*/ _MapTblFrmFmts& rMapArr;
+/*N*/ SwTableLine* pInsLine;
+/*N*/ SwTableBox* pInsBox;
+/*N*/ SwTableNode *pTblNd;
+/*N*/ const SwTable *pOldTable;
+/*N*/
+/*N*/ _CopyTable( SwDoc* pDc, _MapTblFrmFmts& rArr, ULONG nOldStt,
+/*N*/ SwTableNode& rTblNd, const SwTable* pOldTbl )
+/*N*/ : pDoc(pDc), pTblNd(&rTblNd), nOldTblSttIdx(nOldStt),
+/*N*/ rMapArr(rArr), pOldTable( pOldTbl ), pInsLine(0), pInsBox(0)
+/*N*/ {}
+/*N*/ };
+
+/*N*/ BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara );
+
+/*N*/ BOOL lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara );
+
+/*N*/ BOOL lcl_CopyTblBox( const SwTableBox*& rpBox, void* pPara )
+/*N*/ {
+/*N*/ _CopyTable* pCT = (_CopyTable*)pPara;
+/*N*/
+/*N*/ SwTableBoxFmt* pBoxFmt = (SwTableBoxFmt*)rpBox->GetFrmFmt();
+/*N*/ pCT->rMapArr.ForEach( lcl_SrchNew, &pBoxFmt );
+/*N*/ if( pBoxFmt == rpBox->GetFrmFmt() ) // ein neues anlegen ??
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_FORMULA, FALSE,
+/*N*/ &pItem ) && ((SwTblBoxFormula*)pItem)->IsIntrnlName() )
+/*N*/ {
+/*?*/ ((SwTblBoxFormula*)pItem)->PtrToBoxNm( pCT->pOldTable );
+/*N*/ }
+/*N*/
+/*N*/ pBoxFmt = pCT->pDoc->MakeTableBoxFmt();
+/*N*/ pBoxFmt->CopyAttrs( *rpBox->GetFrmFmt() );
+/*N*/
+/*N*/ if( rpBox->GetSttIdx() )
+/*N*/ {
+/*N*/ SvNumberFormatter* pN = pCT->pDoc->GetNumberFormatter( FALSE );
+/*N*/ if( pN && pN->HasMergeFmtTbl() && SFX_ITEM_SET == pBoxFmt->
+/*N*/ GetItemState( RES_BOXATR_FORMAT, FALSE, &pItem ) )
+/*N*/ {
+/*?*/ ULONG nOldIdx = ((SwTblBoxNumFormat*)pItem)->GetValue();
+/*?*/ ULONG nNewIdx = pN->GetMergeFmtIndex( nOldIdx );
+/*?*/ if( nNewIdx != nOldIdx )
+/*?*/ pBoxFmt->SetAttr( SwTblBoxNumFormat( nNewIdx ));
+/*?*/
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pCT->rMapArr.Insert( _MapTblFrmFmt( rpBox->GetFrmFmt(), pBoxFmt ),
+/*N*/ pCT->rMapArr.Count() );
+/*N*/ }
+/*N*/
+/*N*/ USHORT nLines = rpBox->GetTabLines().Count();
+/*N*/ SwTableBox* pNewBox;
+/*N*/ if( nLines )
+/*?*/ pNewBox = new SwTableBox( pBoxFmt, nLines, pCT->pInsLine );
+/*N*/ else
+/*N*/ {
+/*N*/ SwNodeIndex aNewIdx( *pCT->pTblNd,
+/*N*/ rpBox->GetSttIdx() - pCT->nOldTblSttIdx );
+/*N*/ ASSERT( aNewIdx.GetNode().IsStartNode(), "Index nicht auf einem StartNode" );
+/*N*/ pNewBox = new SwTableBox( pBoxFmt, aNewIdx, pCT->pInsLine );
+/*N*/ }
+/*N*/
+/*N*/ pCT->pInsLine->GetTabBoxes().C40_INSERT( SwTableBox, pNewBox,
+/*N*/ pCT->pInsLine->GetTabBoxes().Count() );
+/*N*/
+/*N*/ if( nLines )
+/*N*/ {
+/*?*/ _CopyTable aPara( *pCT );
+/*?*/ aPara.pInsBox = pNewBox;
+/*?*/ ((SwTableBox*)rpBox)->GetTabLines().ForEach( &lcl_CopyTblLine, &aPara );
+/*N*/ }
+/*N*/ else if( pNewBox->IsInHeadline( &pCT->pTblNd->GetTable() ))
+/*N*/ // in der HeadLine sind die Absaetze mit BedingtenVorlage anzupassen
+/*N*/ pNewBox->GetSttNd()->CheckSectionCondColl();
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL lcl_CopyTblLine( const SwTableLine*& rpLine, void* pPara )
+/*N*/ {
+/*N*/ _CopyTable* pCT = (_CopyTable*)pPara;
+/*N*/ SwTableLineFmt* pLineFmt = (SwTableLineFmt*)rpLine->GetFrmFmt();
+/*N*/ pCT->rMapArr.ForEach( lcl_SrchNew, &pLineFmt );
+/*N*/ if( pLineFmt == rpLine->GetFrmFmt() ) // ein neues anlegen ??
+/*N*/ {
+/*N*/ pLineFmt = pCT->pDoc->MakeTableLineFmt();
+/*N*/ pLineFmt->CopyAttrs( *rpLine->GetFrmFmt() );
+/*N*/ pCT->rMapArr.Insert( _MapTblFrmFmt( rpLine->GetFrmFmt(), pLineFmt ),
+/*N*/ pCT->rMapArr.Count());
+/*N*/ }
+/*N*/ SwTableLine* pNewLine = new SwTableLine( pLineFmt,
+/*N*/ rpLine->GetTabBoxes().Count(), pCT->pInsBox );
+/*N*/ // die neue Zeile in die Tabelle eintragen
+/*N*/ if( pCT->pInsBox )
+/*N*/ {
+/*?*/ pCT->pInsBox->GetTabLines().C40_INSERT( SwTableLine, pNewLine,
+/*?*/ pCT->pInsBox->GetTabLines().Count() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pCT->pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pNewLine,
+/*N*/ pCT->pTblNd->GetTable().GetTabLines().Count() );
+/*N*/ }
+/*N*/ pCT->pInsLine = pNewLine;
+/*N*/ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &lcl_CopyTblBox, pCT );
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+/*N*/ {
+/*N*/ // in welchen Array steht ich denn Nodes, UndoNodes ??
+/*N*/ SwNodes& rNds = (SwNodes&)GetNodes();
+/*N*/
+/*N*/ if( pDoc->IsIdxInTbl( rIdx ) )
+/*N*/ // zur Zeit keine Tabelle in Tabelle kopieren unterstuetzen
+/*N*/ // (sprich: Text + Tabelle + Text )
+/*?*/ return 0;
+/*N*/
+/*N*/ {
+/*N*/ // nicht in Fussnoten kopieren !!
+/*
+!! Mal ohne Frames
+ SwCntntNode* pCNd = pDoc->GetNodes()[ rIdx ]->GetCntntNode();
+ SwFrm* pFrm;
+ if( (pCNd && 0 != ( pFrm = pCNd->GetFrm()))
+ ? pFrm->FindFtnFrm()
+ : rIdx < pDoc->GetNodes().EndOfInserts &&
+ pDoc->GetNodes()[pDoc->GetNodes().EndOfInserts]->StartOfSection()
+ < rIdx )
+*/
+/*N*/ if( rIdx < pDoc->GetNodes().GetEndOfInserts().GetIndex() &&
+/*N*/ rIdx >= pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex() )
+/*?*/ return 0;
+/*N*/ }
+/*N*/
+/*N*/ // das TableFrmFmt kopieren
+/*N*/ String sTblName( GetTable().GetFrmFmt()->GetName() );
+/*N*/ if( !pDoc->IsCopyIsMove() )
+/*N*/ {
+/*N*/ const SwFrmFmts& rTblFmts = *pDoc->GetTblFrmFmts();
+/*N*/ for( USHORT n = rTblFmts.Count(); n; )
+/*N*/ if( rTblFmts[ --n ]->GetName() == sTblName )
+/*N*/ {
+/*N*/ sTblName = pDoc->GetUniqueTblName();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwFrmFmt* pTblFmt = pDoc->MakeTblFrmFmt( sTblName, pDoc->GetDfltFrmFmt() );
+/*N*/ pTblFmt->CopyAttrs( *GetTable().GetFrmFmt() );
+/*N*/ SwTableNode* pTblNd = new SwTableNode( rIdx );
+/*N*/ SwEndNode* pEndNd = new SwEndNode( rIdx, *pTblNd );
+/*N*/ SwNodeIndex aInsPos( *pEndNd );
+/*N*/
+/*N*/ SwTable& rTbl = (SwTable&)pTblNd->GetTable();
+/*N*/ pTblFmt->Add( &rTbl ); // das Frame-Format setzen
+/*N*/
+/*N*/ rTbl.SetHeadlineRepeat( GetTable().IsHeadlineRepeat() );
+/*N*/ rTbl.SetTblChgMode( GetTable().GetTblChgMode() );
+/*N*/
+/*N*/ SwDDEFieldType* pDDEType = 0;
+/*N*/ if( IS_TYPE( SwDDETable, &GetTable() ))
+/*N*/ {
+/*?*/ // es wird eine DDE-Tabelle kopiert
+/*?*/ // ist im neuen Dokument ueberhaupt der FeldTyp vorhanden ?
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pDDEType = ((SwDDETable&)GetTable()).GetDDEFldType();
+/*N*/ }
+/*N*/ // dann kopiere erstmal den Inhalt der Tabelle, die Zuordnung der
+/*N*/ // Boxen/Lines und das anlegen der Frames erfolgt spaeter
+/*N*/ SwNodeRange aRg( *this, +1, *EndOfSectionNode() ); // (wo stehe in denn nun ??)
+/*N*/ rNds._Copy( aRg, aInsPos, FALSE );
+/*N*/
+/*N*/ // Sonderbehandlung fuer eine einzelne Box
+/*N*/ if( 1 == GetTable().GetTabSortBoxes().Count() )
+/*N*/ {
+/*?*/ aRg.aStart.Assign( *pTblNd, 1 );
+/*?*/ aRg.aEnd.Assign( *pTblNd->EndOfSectionNode() );
+/*?*/ pDoc->GetNodes().SectionDown( &aRg, SwTableBoxStartNode );
+/*N*/ }
+/*N*/
+/*N*/ // loesche alle Frames vom kopierten Bereich, diese werden beim
+/*N*/ // erzeugen des TableFrames angelegt !
+/*N*/ pTblNd->DelFrms();
+/*N*/
+/*N*/ _MapTblFrmFmts aMapArr;
+/*N*/ _CopyTable aPara( pDoc, aMapArr, GetIndex(), *pTblNd, &GetTable() );
+/*N*/
+/*N*/ ((SwTable&)GetTable()).GetTabLines().ForEach( &lcl_CopyTblLine, &aPara );
+/*N*/
+/*N*/ if( pDDEType && pDoc->GetRootFrm() )
+/*?*/ pDDEType->IncRefCnt();
+/*N*/
+/*N*/ return pTblNd;
+/*N*/ }
+
+
+
+// ----- Copy-Methode vom SwDoc ------
+
+ // verhinder das Kopieren in Fly's, die im Bereich verankert sind.
+
+
+
+
+
+// Kopieren eines Bereiches im oder in ein anderes Dokument !
+
+/*N*/ BOOL SwDoc::Copy( SwPaM& rPam, SwPosition& rPos ) const
+/*N*/ {
+/*N*/ const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+/*N*/ // kein Copy abfangen.
+/*N*/ if( !rPam.HasMark() || *pStt >= *pEnd )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ SwDoc* pDoc = rPos.nNode.GetNode().GetDoc();
+/*N*/
+/*N*/ // verhinder das Kopieren in Fly's, die im Bereich verankert sind.
+/*N*/ if( pDoc == this )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 // Start-/EndNode noch korrigieren
+/*N*/ }
+/*N*/
+/*N*/ SwPaM* pRedlineRange = 0;
+/*N*/ if( pDoc->IsRedlineOn() ||
+/*N*/ (!pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) )
+/*N*/ pRedlineRange = new SwPaM( rPos );
+/*N*/
+/*N*/ SwRedlineMode eOld = pDoc->GetRedlineMode();
+/*N*/
+/*N*/ BOOL bRet = FALSE;
+/*N*/
+/*N*/ if( pDoc && pDoc != this )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren
+/*N*/ // Copy in sich selbst (ueber mehrere Nodes wird hier gesondert
+/*N*/ // behandelt; in einem TextNode wird normal behandelt)
+/*N*/ else if( ! ( *pStt <= rPos && rPos < *pEnd &&
+/*N*/ ( pStt->nNode != pEnd->nNode ||
+/*N*/ !pStt->nNode.GetNode().IsTxtNode() )) )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 bRet = _Copy( rPam, rPos, TRUE, pRedlineRange ); // nur normales Kopieren
+/*N*/
+/*N*/ else
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ASSERT( this == pDoc, " falscher Copy-Zweig!" );
+/*N*/ }
+/*N*/
+/*N*/ pDoc->SetRedlineMode_intern( eOld );
+/*N*/ if( pRedlineRange )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( pDoc->IsRedlineOn() )
+/*N*/ }
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+// Kopieren eines Bereiches im oder in ein anderes Dokument !
+// Die Position darf nicht im Bereich liegen !!
+
+
+
+// ----- Copy-Methode vom SwDoc - "kopiere Fly's in Fly's" ------
+
+/*N*/ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg,
+/*N*/ const SwNodeIndex& rInsPos, BOOL bMakeNewFrms,
+/*N*/ BOOL bDelRedlines, BOOL bCopyFlyAtFly ) const
+/*N*/ {
+/*N*/ SwDoc* pDest = rInsPos.GetNode().GetDoc();
+/*N*/
+/*N*/ _SaveRedlEndPosForRestore aRedlRest( rInsPos );
+/*N*/
+/*N*/ SwNodeIndex aSavePos( rInsPos, -1 );
+/*N*/ BOOL bEndIsEqualEndPos = rInsPos == rRg.aEnd;
+/*N*/ GetNodes()._CopyNodes( rRg, rInsPos, bMakeNewFrms, TRUE );
+/*N*/ aSavePos++;
+/*N*/ if( bEndIsEqualEndPos )
+/*N*/ ((SwNodeIndex&)rRg.aEnd) = aSavePos;
+/*N*/
+/*N*/ aRedlRest.Restore();
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ {
+/*N*/ //JP 17.06.99: Bug 66973 - check count only if the selection is in
+/*N*/ // the same (or no) section. Becaus not full selected
+/*N*/ // section are not copied.
+/*N*/ const SwSectionNode* pSSectNd = rRg.aStart.GetNode().FindSectionNode();
+/*N*/ SwNodeIndex aTmpI( rRg.aEnd, -1 );
+/*N*/ const SwSectionNode* pESectNd = aTmpI.GetNode().FindSectionNode();
+/*N*/ if( pSSectNd == pESectNd &&
+/*N*/ !rRg.aStart.GetNode().IsSectionNode() &&
+/*N*/ !aTmpI.GetNode().IsEndNode() )
+/*N*/ {
+/*N*/ ASSERT( rInsPos.GetIndex() - aSavePos.GetIndex() ==
+/*N*/ rRg.aEnd.GetIndex() - rRg.aStart.GetIndex(),
+/*N*/ "Es wurden zu wenig Nodes kopiert!" )
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ _CopyFlyInFly( rRg, aSavePos, bCopyFlyAtFly );
+/*N*/
+/*N*/ SwNodeRange aCpyRange( aSavePos, rInsPos );
+/*N*/
+/*N*/ // dann kopiere noch alle Bookmarks
+/*N*/ if( GetBookmarks().Count() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aRgTmp( rRg.aStart, rRg.aEnd );
+/*N*/ }
+/*N*/
+/*N*/ if( bDelRedlines && ( REDLINE_DELETE_REDLINES & pDest->GetRedlineMode() ))
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 lcl_DeleteRedlines( rRg, aCpyRange );
+/*N*/
+/*N*/ pDest->GetNodes()._DelDummyNodes( aCpyRange );
+/*N*/ }
+
+
+/*N*/ void SwDoc::_CopyFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rSttIdx,
+/*N*/ BOOL bCopyFlyAtFly ) const
+/*N*/ {
+/*N*/ // Bug 22727: suche erst mal alle Flys zusammen, sortiere sie entsprechend
+/*N*/ // ihrer Ordnungsnummer und kopiere sie erst dann. Damit wird
+/*N*/ // die Ordnungsnummer (wird nur im DrawModel verwaltet)
+/*N*/ // beibehalten.
+/*N*/ SwDoc* pDest = rSttIdx.GetNode().GetDoc();
+/*N*/ _ZSortFlys aArr;
+/*N*/ USHORT nArrLen = GetSpzFrmFmts()->Count();
+ USHORT n=0;
+/*N*/ for( n = 0; n < nArrLen; ++n )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = (*GetSpzFrmFmts())[n];
+/*N*/ const SwFmtAnchor* pAnchor = &pFmt->GetAnchor();
+/*N*/ const SwPosition* pAPos;
+/*N*/ if ( ( pAnchor->GetAnchorId() == FLY_AT_CNTNT ||
+/*N*/ pAnchor->GetAnchorId() == FLY_AT_FLY ||
+/*N*/ pAnchor->GetAnchorId() == FLY_AUTO_CNTNT ) &&
+/*N*/ 0 != ( pAPos = pAnchor->GetCntntAnchor()) &&
+/*N*/ (( bCopyFlyAtFly && FLY_AT_FLY == pAnchor->GetAnchorId() )
+/*N*/ ? rRg.aStart <= pAPos->nNode.GetIndex() + 1
+/*N*/ : ( IsRedlineMove()
+/*N*/ ? rRg.aStart < pAPos->nNode
+/*N*/ : rRg.aStart <= pAPos->nNode )) &&
+/*N*/ pAPos->nNode < rRg.aEnd )
+/*N*/ {
+/*N*/ aArr.Insert( _ZSortFly( pFmt, pAnchor, nArrLen + aArr.Count() ));
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Alle kopierten (also die neu erzeugten) Rahmen in ein weiteres Array
+/*N*/ //stopfen. Dort sizten sie passend zu den Originalen, damit hinterher
+/*N*/ //die Chains entsprechend aufgebaut werden koennen.
+/*N*/ SvPtrarr aNewArr( 10, 10 );
+/*N*/
+/*N*/ for( n = 0; n < aArr.Count(); ++n )
+/*N*/ {
+/*N*/ // neuen Anker anlegen
+/*N*/ const _ZSortFly& rZSortFly = aArr[ n ];
+/*N*/ SwFmtAnchor aAnchor( *rZSortFly.GetAnchor() );
+/*N*/ SwPosition *pNewPos = (SwPosition*)aAnchor.GetCntntAnchor();
+/*N*/ long nOffset = pNewPos->nNode.GetIndex() -
+/*N*/ rRg.aStart.GetIndex();
+/*N*/ SwNodeIndex aIdx( rSttIdx, nOffset );
+/*N*/ pNewPos->nNode = aIdx;
+/*N*/ // die am Zeichen Flys wieder ans das vorgegebene Zeichen setzen
+/*N*/ if( FLY_AUTO_CNTNT == aAnchor.GetAnchorId() &&
+/*N*/ aIdx.GetNode().IsTxtNode() )
+/*?*/ pNewPos->nContent.Assign( (SwTxtNode*)&aIdx.GetNode(),
+/*?*/ pNewPos->nContent.GetIndex() );
+/*N*/ else
+/*N*/ pNewPos->nContent.Assign( 0, 0 );
+/*N*/
+/*N*/ // ueberpruefe Rekursion: Inhalt in "seinen eigenen" Frame
+/*N*/ // kopieren. Dann nicht kopieren
+/*N*/ FASTBOOL bMakeCpy = TRUE;
+/*N*/ if( pDest == this )
+/*N*/ {
+/*N*/ const SwFmtCntnt& rCntnt = rZSortFly.GetFmt()->GetCntnt();
+/*N*/ const SwStartNode* pSNd;
+/*N*/ if( rCntnt.GetCntntIdx() &&
+/*N*/ 0 != ( pSNd = rCntnt.GetCntntIdx()->GetNode().GetStartNode() ) &&
+/*N*/ pSNd->GetIndex() < rSttIdx.GetIndex() &&
+/*N*/ rSttIdx.GetIndex() < pSNd->EndOfSectionIndex() )
+/*N*/ {
+/*?*/ bMakeCpy = FALSE;
+/*?*/ aArr.Remove( n, 1 );
+/*?*/ --n;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Format kopieren und den neuen Anker setzen
+/*N*/ if( bMakeCpy )
+/*N*/ aNewArr.Insert( pDest->CopyLayoutFmt( *rZSortFly.GetFmt(),
+/*N*/ aAnchor, FALSE, TRUE/*FALSE*/ ), aNewArr.Count() );
+/*N*/ }
+/*N*/
+/*N*/ //Alle chains, die im Original vorhanden sind, soweit wie moeglich wieder
+/*N*/ //aufbauen.
+/*N*/ ASSERT( aArr.Count() == aNewArr.Count(), "Missing new Flys" );
+/*N*/ if ( aArr.Count() == aNewArr.Count() )
+/*N*/ {
+/*N*/ for ( n = 0; n < aArr.Count(); ++n )
+/*N*/ {
+/*N*/ const SwFrmFmt *pFmt = aArr[n].GetFmt();
+/*N*/ const SwFmtChain &rChain = pFmt->GetChain();
+/*N*/ int nCnt = 0 != rChain.GetPrev();
+/*N*/ nCnt += rChain.GetNext() ? 1: 0;
+/*N*/ for ( USHORT k = 0; nCnt && k < aArr.Count(); ++k )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const _ZSortFly &rTmp = aArr[k];
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndindex.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndindex.cxx
new file mode 100644
index 000000000000..ebe69fa6235d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndindex.cxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "errhdl.hxx" // fuers ASSERT
+#include "error.h" // fuers ASSERT
+#include "ndindex.hxx"
+namespace binfilter {
+
+#ifdef DBG_UTIL
+int SwNodeIndex::nSerial = 0;
+#endif
+
+
+/*N*/ SwNodeRange::SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
+/*N*/ : aStart( rS ), aEnd( rE )
+/*N*/ {}
+
+/*N*/ SwNodeRange::SwNodeRange( const SwNodeRange &rRange )
+/*N*/ : aStart( rRange.aStart ), aEnd( rRange.aEnd )
+/*N*/ {}
+
+/*N*/ SwNodeRange::SwNodeRange( const SwNodeIndex& rS, long nSttDiff,
+/*N*/ const SwNodeIndex& rE, long nEndDiff )
+/*N*/ : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
+/*N*/ {}
+
+/*N*/ SwNodeRange::SwNodeRange( const SwNode& rS, long nSttDiff,
+/*N*/ const SwNode& rE, long nEndDiff )
+/*N*/ : aStart( rS, nSttDiff ), aEnd( rE, nEndDiff )
+/*N*/ {}
+
+
+/*N*/ SwNodeIndex::SwNodeIndex( SwNodes& rNds, ULONG nIdx )
+/*N*/ : pNd( rNds[ nIdx ] ), pNext( 0 ), pPrev( 0 )
+/*N*/ {
+/*N*/ rNds.RegisterIndex( *this );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+/*N*/ #endif
+/*N*/ }
+
+
+/*N*/ SwNodeIndex::SwNodeIndex( const SwNodeIndex& rIdx, long nDiff )
+/*N*/ : pNext( 0 ), pPrev( 0 )
+/*N*/ {
+/*N*/ if( nDiff )
+/*N*/ pNd = rIdx.GetNodes()[ rIdx.GetIndex() + nDiff ];
+/*N*/ else
+/*N*/ pNd = rIdx.pNd;
+/*N*/
+/*N*/ pNd->GetNodes().RegisterIndex( *this );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+/*N*/ #endif
+/*N*/ }
+
+
+/*N*/ SwNodeIndex::SwNodeIndex( const SwNode& rNd, long nDiff )
+/*N*/ : pNext( 0 ), pPrev( 0 )
+/*N*/ {
+/*N*/ if( nDiff )
+/*N*/ pNd = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
+/*N*/ else
+/*N*/ pNd = (SwNode*)&rNd;
+/*N*/
+/*N*/ pNd->GetNodes().RegisterIndex( *this );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ MySerial = ++nSerial; // nur in der nicht PRODUCT-Version
+/*N*/ #endif
+/*N*/ }
+
+
+/*N*/ void SwNodeIndex::Remove()
+/*N*/ {
+/*N*/ pNd->GetNodes().DeRegisterIndex( *this );
+/*N*/ }
+
+/*N*/ SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
+/*N*/ {
+/*N*/ if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
+/*N*/ {
+/*N*/ pNd->GetNodes().DeRegisterIndex( *this );
+/*N*/ pNd = rIdx.pNd;
+/*N*/ pNd->GetNodes().RegisterIndex( *this );
+/*N*/ }
+/*N*/ else
+/*N*/ pNd = rIdx.pNd;
+/*N*/ return *this;
+/*N*/ }
+
+/*N*/ SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
+/*N*/ {
+/*N*/ if( &pNd->GetNodes() != &rNd.GetNodes() )
+/*N*/ {
+/*?*/ pNd->GetNodes().DeRegisterIndex( *this );
+/*?*/ pNd = (SwNode*)&rNd;
+/*?*/ pNd->GetNodes().RegisterIndex( *this );
+/*N*/ }
+/*N*/ else
+/*N*/ pNd = (SwNode*)&rNd;
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
+/*N*/ {
+/*N*/ if( &pNd->GetNodes() != &rNd.GetNodes() )
+/*N*/ {
+/*?*/ pNd->GetNodes().DeRegisterIndex( *this );
+/*?*/ pNd = (SwNode*)&rNd;
+/*?*/ pNd->GetNodes().RegisterIndex( *this );
+/*N*/ }
+/*N*/ else
+/*N*/ pNd = (SwNode*)&rNd;
+/*N*/
+/*N*/ if( nOffset )
+/*N*/ pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndnotxt.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndnotxt.cxx
new file mode 100644
index 000000000000..051a34074fcf
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndnotxt.cxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#include <vcl/graph.hxx>
+#include <vcl/gdimtf.hxx>
+#include <bf_so3/ipobj.hxx>
+
+#include <tools/poly.hxx>
+#include <vcl/outdev.hxx>
+
+#include <horiornt.hxx>
+
+
+#include <errhdl.hxx>
+
+#include <ndgrf.hxx>
+#include <ndole.hxx>
+#include <hints.hxx> // fuer SwFmtChg
+namespace binfilter {
+
+
+/*N*/ SwNoTxtNode::SwNoTxtNode( const SwNodeIndex & rWhere,
+/*N*/ const BYTE nNdType,
+/*N*/ SwGrfFmtColl *pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr ) :
+/*N*/ SwCntntNode( rWhere, nNdType, pGrfColl ),
+/*N*/ pContour( 0 ),
+/*N*/ bAutomaticContour( FALSE ),
+/*N*/ bContourMapModeValid( TRUE ),
+/*N*/ bPixelContour( FALSE )
+/*N*/ {
+/*N*/ // soll eine Harte-Attributierung gesetzt werden?
+/*N*/ if( pAutoAttr )
+/*N*/ SetAttr( *pAutoAttr );
+/*N*/ }
+
+
+/*N*/ SwNoTxtNode::~SwNoTxtNode()
+/*N*/ {
+/*N*/ delete pContour;
+/*N*/ }
+
+
+// erzeugt fuer alle Ableitungen einen AttrSet mit Bereichen
+// fuer Frame- und Grafik-Attributen
+/*N*/ void SwNoTxtNode::NewAttrSet( SwAttrPool& rPool )
+/*N*/ {
+/*N*/ ASSERT( !pAttrSet, "AttrSet ist doch gesetzt" );
+/*N*/ pAttrSet = new SwAttrSet( rPool, aNoTxtNodeSetRange );
+/*N*/ pAttrSet->SetParent( &GetFmtColl()->GetAttrSet() );
+/*N*/ }
+
+// Dummies fuer das Laden/Speichern von persistenten Daten
+// bei Grafiken und OLE-Objekten
+
+
+
+
+
+
+/*N*/ void SwNoTxtNode::SetContour( const PolyPolygon *pPoly, BOOL bAutomatic )
+/*N*/ {
+/*N*/ delete pContour;
+/*N*/ if ( pPoly )
+/*?*/ pContour = new PolyPolygon( *pPoly );
+/*N*/ else
+/*N*/ pContour = 0;
+/*N*/ bAutomaticContour = bAutomatic;
+/*N*/ bContourMapModeValid = TRUE;
+/*N*/ bPixelContour = FALSE;
+/*N*/ }
+
+
+
+/*N*/ const PolyPolygon *SwNoTxtNode::HasContour() const
+/*N*/ {
+/*N*/ if( !bContourMapModeValid )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const MapMode aGrfMap( GetGraphic().GetPrefMapMode() );
+/*N*/ }
+/*N*/
+/*N*/ return pContour;
+/*N*/ }
+
+
+
+/*N*/ BOOL SwNoTxtNode::GetContourAPI( PolyPolygon &rContour ) const
+/*N*/ {
+/*N*/ if( !pContour )
+/*N*/ return FALSE;
+/*N*/
+/*?*/ rContour = *pContour;
+/*?*/ if( bContourMapModeValid )
+/*?*/ {
+/*?*/ const MapMode aGrfMap( GetGraphic().GetPrefMapMode() );
+ /*?*/ const MapMode aContourMap( MAP_100TH_MM );
+ /*?*/ ASSERT( aGrfMap.GetMapUnit() != MAP_PIXEL ||
+ /*?*/ aGrfMap == MapMode( MAP_PIXEL ),
+ /*?*/ "scale factor for pixel unsupported" );
+ /*?*/ if( aGrfMap.GetMapUnit() != MAP_PIXEL &&
+ /*?*/ aGrfMap != aContourMap )
+ /*?*/ {
+ /*?*/ USHORT nPolyCount = rContour.Count();
+ /*?*/ for( USHORT j=0; j<nPolyCount; j++ )
+ /*?*/ {
+ /*?*/ Polygon& rPoly = (*pContour)[j];
+ /*?*/
+ /*?*/ USHORT nCount = rPoly.GetSize();
+ /*?*/ for( USHORT i=0 ; i<nCount; i++ )
+ /*?*/ {
+ /*?*/ rPoly[i] = OutputDevice::LogicToLogic( rPoly[i], aGrfMap,
+ /*?*/ aContourMap );
+ /*?*/ }
+ /*?*/ }
+ /*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ return TRUE;
+/*N*/ }
+
+BOOL SwNoTxtNode::IsPixelContour() const
+{
+ BOOL bRet;
+ if( bContourMapModeValid )
+ {
+ const MapMode aGrfMap( GetGraphic().GetPrefMapMode() );
+ bRet = aGrfMap.GetMapUnit() == MAP_PIXEL;
+ }
+ else
+ {
+ bRet = bPixelContour;
+ }
+
+ return bRet;
+}
+
+
+Graphic SwNoTxtNode::GetGraphic() const
+{
+ Graphic aRet;
+ if ( GetGrfNode() )
+ {
+ ((SwGrfNode*)this)->SwapIn( TRUE );
+ aRet = ((SwGrfNode*)this)->GetGrf();
+ }
+ else
+ {
+ ASSERT( GetOLENode(), "new type of Node?" );
+ SvInPlaceObjectRef xObj( ((SwOLENode*)this)->GetOLEObj().GetOleRef() );
+ GDIMetaFile aMtf;
+ aRet = xObj->GetGDIMetaFile( aMtf );
+ }
+ return aRet;
+}
+
+
+/*N*/ void SwNoTxtNode::SetAlternateText( const String& rTxt, sal_Bool bBroadcast )
+/*N*/ {
+/*N*/ if( bBroadcast )
+/*N*/ {
+/*?*/ SwStringMsgPoolItem aOld( RES_ALT_TEXT_CHANGED, aAlternateText );
+/*?*/ SwStringMsgPoolItem aNew( RES_ALT_TEXT_CHANGED, rTxt );
+/*?*/ aAlternateText = rTxt;
+/*?*/ Modify( &aOld, &aNew );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aAlternateText = rTxt;
+/*N*/ }
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndnum.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndnum.cxx
new file mode 100644
index 000000000000..c293c178bfbf
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndnum.cxx
@@ -0,0 +1,371 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx> // UpdateFlds der KapitelNummerierung
+namespace binfilter {
+
+
+//-------------------------------------------------------
+// Gliederung
+
+/*N*/ struct _OutlinePara
+/*N*/ {
+/*N*/ SwNodeNum aNum;
+/*N*/ const SwNodes& rNds;
+/*N*/ BYTE nMin, nNewLevel;
+/*N*/ // OD 21.11.2002 #100043# - array to remember, which level numbering
+/*N*/ // has to be started.
+/*N*/ bool aStartLevel[ MAXLEVEL ];
+/*N*/
+/*N*/ _OutlinePara( const SwNodes& rNodes, USHORT nSttPos, BYTE nOld, BYTE nNew );
+/*N*/ BOOL UpdateOutline( SwTxtNode& rTxtNd );
+/*N*/ };
+
+/*N*/ _SV_IMPL_SORTAR_ALG( SwOutlineNodes, SwNodePtr )
+/*N*/ BOOL SwOutlineNodes::Seek_Entry( const SwNodePtr rSrch, USHORT* pFndPos ) const
+/*N*/ {
+/*N*/ ULONG nIdx = rSrch->GetIndex();
+/*N*/
+/*N*/ register USHORT nO = Count(), nM, nU = 0;
+/*N*/ if( nO > 0 )
+/*N*/ {
+/*N*/ //JP 17.03.98: aufgrund des Bug 48592 - wo unter anderem nach Undo/Redo
+/*N*/ // Nodes aus dem falschen NodesArray im OutlineArray standen,
+/*N*/ // jetzt mal einen Check eingebaut.
+/*N*/ #ifdef DBG_UTIL
+/*N*/ {
+/*N*/ for( register USHORT n = 1; n < nO; ++n )
+/*N*/ if( &(*this)[ n-1 ]->GetNodes() !=
+/*N*/ &(*this)[ n ]->GetNodes() )
+/*N*/ {
+/*?*/ ASSERT( !this, "Node im falschen Outline-Array" );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ nO--;
+/*N*/ while( nU <= nO )
+/*N*/ {
+/*N*/ nM = nU + ( nO - nU ) / 2;
+/*N*/ if( (*this)[ nM ] == rSrch )
+/*N*/ {
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nM;
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ else if( (*this)[ nM ]->GetIndex() < nIdx )
+/*N*/ nU = nM + 1;
+/*N*/ else if( nM == 0 )
+/*N*/ {
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nU;
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ nO = nM - 1;
+/*N*/ }
+/*N*/ }
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nU;
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ _OutlinePara::_OutlinePara( const SwNodes& rNodes, USHORT nSttPos,
+/*N*/ BYTE nOld, BYTE nNew )
+/*N*/ : rNds( rNodes ),
+/*N*/ aNum( NO_NUM > nNew ? nNew : 0 ),
+/*N*/ nMin( Min( nOld, nNew )),
+/*N*/ nNewLevel( nNew )
+/*N*/ {
+/*N*/ // OD 25.11.2002 #100043# - init <aStartLevel[]> with defaults, only valid
+/*N*/ // if update of outline numbering started at first outline numbering node.
+/*N*/ for ( int i = 0; i < MAXLEVEL; ++i)
+/*N*/ aStartLevel[i] = true;
+/*N*/
+/*N*/ // hole vom Vorgaenger die aktuelle Nummerierung
+/*N*/ SwNode* pNd;
+/*N*/ ULONG nEndOfExtras = rNds.GetEndOfExtras().GetIndex();
+/*N*/ if ( nSttPos &&
+/*N*/ (pNd = rNds.GetOutLineNds()[ --nSttPos ])->GetIndex() > nEndOfExtras &&
+/*N*/ static_cast<SwTxtNode*>(pNd)->GetOutlineNum()
+/*N*/ )
+/*N*/ {
+/*N*/ const SwNodeNum* pNum = ((SwTxtNode*)pNd)->GetOutlineNum();
+/*N*/ #ifdef TASK_59308
+/*N*/ if( pNum->GetLevel() & NO_NUMLEVEL )
+/*N*/ {
+/*N*/ // dann suche den mit richtigem Level:
+/*N*/ BYTE nSrchLvl = aNum.GetLevel();
+/*N*/ pNum = 0;
+/*N*/ while( nSttPos-- )
+/*N*/ {
+/*N*/ if( ( pNd = rNds.GetOutLineNds()[ nSttPos ])->
+/*N*/ GetIndex() < nEndOfExtras )
+/*N*/ break;
+/*N*/
+/*N*/ if( 0 != ( pNum = ((SwTxtNode*)pNd)->GetOutlineNum() ))
+/*N*/ {
+/*N*/ // uebergeordnete Ebene
+/*N*/ if( nSrchLvl > (pNum->GetLevel() &~ NO_NUMLEVEL ))
+/*N*/ {
+/*N*/ pNum = 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ // gleiche Ebene und kein NO_NUMLEVEL
+/*N*/ if( nSrchLvl == (pNum->GetLevel() &~ NO_NUMLEVEL)
+/*N*/ && !( pNum->GetLevel() & NO_NUMLEVEL ))
+/*N*/ break;
+/*N*/
+/*N*/ pNum = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ #endif
+/*N*/ if( pNum )
+/*N*/ {
+/*N*/ aNum = *pNum;
+/*N*/ aNum.SetStart( FALSE );
+/*N*/ aNum.SetSetValue( USHRT_MAX );
+/*N*/ }
+/*N*/
+/*N*/ if( aNum.GetLevel()+1 < MAXLEVEL )
+/*N*/ {
+/*N*/ memset( aNum.GetLevelVal() + (aNum.GetLevel()+1), 0,
+/*N*/ (MAXLEVEL - (aNum.GetLevel()+1)) * sizeof(aNum.GetLevelVal()[0]) );
+/*N*/ }
+/*N*/ // OD 22.11.2002 #100043# - init array <aStartLevel[]>, not starting at
+/*N*/ // first outline numbering node.
+/*N*/ aStartLevel[ pNum->GetLevel() ] = false;
+/*N*/ USHORT nHighestLevelFound = pNum->GetLevel();
+/*N*/ while ( pNum->GetLevel() > 0 && nSttPos-- )
+/*N*/ {
+/*N*/ pNd = rNds.GetOutLineNds()[ nSttPos ];
+/*N*/ if ( pNd->GetIndex() < nEndOfExtras )
+/*N*/ break;
+/*N*/ pNum = static_cast<SwTxtNode*>(pNd)->GetOutlineNum();
+/*N*/ if ( pNum && pNum->GetLevel() < nHighestLevelFound )
+/*N*/ {
+/*N*/ aStartLevel[ pNum->GetLevel() ] = false;
+/*N*/ nHighestLevelFound = pNum->GetLevel();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ BOOL _OutlinePara::UpdateOutline( SwTxtNode& rTxtNd )
+/*N*/ {
+/*N*/ // alle die ausserhalb des Fliesstextes liegen, NO_NUM zuweisen.
+/*N*/ if( rTxtNd.GetIndex() < rNds.GetEndOfExtras().GetIndex() )
+/*N*/ {
+/*N*/ BYTE nTmpLevel = aNum.GetLevel();
+/*N*/ aNum.SetLevel( NO_NUM );
+/*N*/ rTxtNd.UpdateOutlineNum( aNum );
+/*N*/ aNum.SetLevel( nTmpLevel );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/
+/*N*/ BYTE nLevel = rTxtNd.GetTxtColl()->GetOutlineLevel();
+/*N*/ BOOL bRet = !(nMin > nLevel);
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ // existierte am Node schon eine Nummerierung ??
+/*N*/ // dann erfrage den "User definierten Wert"
+/*N*/ USHORT nSetValue;
+/*N*/ const SwNumRule* pOutlRule = rTxtNd.GetDoc()->GetOutlineNumRule();
+/*N*/ const SwNodeNum* pOutlNum = rTxtNd.GetOutlineNum();
+/*N*/
+/*N*/ #ifdef TASK_59308
+/*N*/ if( pOutlNum && ( pOutlNum->GetLevel() & NO_NUMLEVEL ) &&
+/*N*/ GetRealLevel( pOutlNum->GetLevel() ) == nLevel )
+/*N*/ {
+/*N*/ // diesen nicht mit numerieren
+/*N*/ BYTE nTmpLevel = aNum.GetLevel();
+/*N*/ aNum.SetLevel( pOutlNum->GetLevel() );
+/*N*/ rTxtNd.UpdateOutlineNum( aNum );
+/*N*/ aNum.SetLevel( nTmpLevel );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ // OD 21.11.2002 #100043# - determine, if level numbering has to be started.
+/*N*/ // OD 09.12.2002 #106070# - correct outline numbering, even for the
+/*N*/ // first heading. Thus, state of <aStartLevel[]> always has to be
+/*N*/ // consulted, not only on level change.
+/*N*/ if( aStartLevel[ nLevel ] )
+/*N*/ {
+/*N*/ nSetValue= pOutlRule->Get( nLevel ).GetStart();
+/*N*/ // OD 21.11.2002 #100043# - reset <aStartLevel[nLevel]>
+/*N*/ aStartLevel[ nLevel ] = false;
+/*N*/ }
+/*N*/ else
+/*N*/ nSetValue = aNum.GetLevelVal()[ nLevel ] + 1;
+/*N*/
+/*N*/ // alle unter dem neuen Level liegenden auf 0 setzen
+/*N*/ if( aNum.GetLevel() > nLevel && nLevel+1 < MAXLEVEL
+/*N*/ /* ??? && NO_NUM > nNewLevel */ )
+/*N*/ {
+/*N*/ memset( aNum.GetLevelVal() + (nLevel+1), 0,
+/*N*/ (MAXLEVEL - ( nLevel+1 )) * sizeof(aNum.GetLevelVal()[0]) );
+/*N*/ // OD 22.11.2002 #100043# - all next level numberings have to be started.
+/*N*/ for ( int i = nLevel+1; i < MAXLEVEL; ++i)
+/*N*/ aStartLevel[i] = true;
+/*N*/ }
+/*N*/
+/*N*/ if( pOutlNum && USHRT_MAX != pOutlNum->GetSetValue() )
+/*N*/ aNum.SetSetValue( nSetValue = pOutlNum->GetSetValue() );
+/*N*/
+/*N*/ aNum.GetLevelVal()[ nLevel ] = nSetValue;
+/*N*/ aNum.SetLevel( nLevel );
+/*N*/ rTxtNd.UpdateOutlineNum( aNum );
+/*N*/ aNum.SetSetValue( USHRT_MAX );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+
+/*N*/ BOOL lcl_UpdateOutline( const SwNodePtr& rpNd, void* pPara )
+/*N*/ {
+/*N*/ _OutlinePara* pOutlPara = (_OutlinePara*)pPara;
+/*N*/ SwTxtNode* pTxtNd = rpNd->GetTxtNode();
+/*N*/ ASSERT( pTxtNd, "kein TextNode als OutlineNode !" );
+/*N*/
+/*N*/ return pOutlPara->UpdateOutline( *pTxtNd );
+/*N*/ }
+
+
+
+
+/*N*/ void SwNodes::UpdateOutlineNode( const SwNode& rNd, BYTE nOldLevel,
+/*N*/ BYTE nNewLevel )
+/*N*/ {
+/*N*/ const SwNodePtr pSrch = (SwNodePtr)&rNd;
+/*N*/ USHORT nSttPos;
+/*N*/ BOOL bSeekIdx = pOutlineNds->Seek_Entry( pSrch, &nSttPos );
+/*N*/
+/*N*/ if( NO_NUMBERING == nOldLevel ) // neuen Level einfuegen
+/*N*/ {
+/*N*/ // nicht vorhanden, also einfuegen
+/*N*/ ASSERT( !bSeekIdx, "Der Node ist schon als OutlineNode vorhanden" );
+/*N*/
+/*N*/ //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen
+/*N*/ ULONG nNd = rNd.GetIndex();
+/*N*/ if( nNd < GetEndOfRedlines().GetIndex() &&
+/*N*/ nNd > GetEndOfRedlines().FindStartNode()->GetIndex() )
+/*?*/ return ;
+/*N*/
+/*N*/ // jetzt noch alle nachfolgende Outline-Nodes updaten
+/*N*/ pOutlineNds->Insert( pSrch );
+/*N*/ if( NO_NUM <= nNewLevel )
+/*?*/ return; // keine Nummerierung dann kein Update
+/*N*/ }
+/*N*/ else if( NO_NUMBERING == nNewLevel ) // Level entfernen
+/*N*/ {
+/*?*/ if( !bSeekIdx )
+/*?*/ return;
+/*?*/
+/*?*/ // jetzt noch alle nachfolgende Outline-Nodes updaten
+/*?*/ pOutlineNds->Remove( nSttPos );
+/*?*/ if( NO_NUM <= nOldLevel )
+/*?*/ return; // keine Nummerierung dann kein Update
+/*N*/ }
+/*N*/ else if( !bSeekIdx ) // Update und Index nicht gefunden ??
+/*?*/ return ;
+/*N*/
+/*N*/ _OutlinePara aPara( *this, nSttPos, nOldLevel, nNewLevel );
+/*N*/ pOutlineNds->ForEach( nSttPos, pOutlineNds->Count(),
+/*N*/ lcl_UpdateOutline, &aPara );
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ {
+/*N*/ SwCntntNode* pCNd;
+/*N*/ ULONG nSttNd = rNd.GetIndex();
+/*N*/ if( NO_NUMBERING != nNewLevel )
+/*N*/ ++nSttPos;
+/*N*/
+/*N*/ ULONG nChkCount = ( nSttPos < pOutlineNds->Count()
+/*N*/ ? (*pOutlineNds)[ nSttPos ]->GetIndex()
+/*N*/ : GetEndOfContent().GetIndex() )
+/*N*/ - nSttNd;
+/*N*/ for( ; nChkCount--; ++nSttNd )
+/*N*/ if( 0 != (pCNd = (*this)[ nSttNd ]->GetCntntNode() ) &&
+/*N*/ RES_CONDTXTFMTCOLL == pCNd->GetFmtColl()->Which() )
+/*N*/ pCNd->ChkCondColl();
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ // die Gliederungs-Felder Updaten
+/*N*/ GetDoc()->GetSysFldType( RES_CHAPTERFLD )->UpdateFlds();
+/*N*/ }
+
+
+
+/*N*/ void SwNodes::UpdtOutlineIdx( const SwNode& rNd )
+/*N*/ {
+/*N*/ if( !pOutlineNds->Count() ) // keine OutlineNodes vorhanden ?
+/*N*/ return;
+/*N*/
+/*N*/ const SwNodePtr pSrch = (SwNodePtr)&rNd;
+/*N*/ USHORT nPos;
+/*N*/ pOutlineNds->Seek_Entry( pSrch, &nPos );
+/*N*/ if( nPos == pOutlineNds->Count() ) // keine zum Updaten vorhanden ?
+/*N*/ return;
+/*N*/
+/*N*/ if( nPos )
+/*N*/ --nPos;
+/*N*/
+/*N*/ if( !GetDoc()->IsInDtor() && IsDocNodes() )
+/*N*/ UpdateOutlineNode( *(*pOutlineNds)[ nPos ], 0, 0 );
+/*N*/ }
+
+
+
+/*N*/ void SwNodes::UpdateOutlineNodes()
+/*N*/ {
+/*N*/ if( pOutlineNds->Count() ) // OutlineNodes vorhanden ?
+/*N*/ UpdateOutlineNode( *(*pOutlineNds)[ 0 ], 0, 0 );
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndsect.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndsect.cxx
new file mode 100644
index 000000000000..2dcdeb6a4413
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndsect.cxx
@@ -0,0 +1,940 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <bf_svx/linkmgr.hxx>
+#include <bf_svtools/itemiter.hxx>
+#include <tools/resid.hxx>
+
+#include <fmtcntnt.hxx>
+#include <txtftn.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <ndtxt.hxx>
+#include <swtable.hxx>
+#include <ftnidx.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <sectfrm.hxx>
+#include <cntfrm.hxx>
+#include <node2lay.hxx>
+#include <doctxm.hxx>
+#include <fmtftntx.hxx>
+#include <hints.hxx>
+
+#include <comcore.hrc>
+namespace binfilter {
+
+/*N*/ int lcl_IsInSameTblBox( SwNodes& rNds, const SwNode& rNd,
+/*N*/ const SwNodeIndex& rIdx2 )
+/*N*/ {
+/*N*/ const SwTableNode* pTblNd = rNd.FindTableNode();
+/*N*/ if( !pTblNd )
+/*N*/ return TRUE;
+/*N*/
+/*?*/ // dann suche den StartNode der Box
+/*?*/ const SwTableSortBoxes& rSortBoxes = pTblNd->GetTable().GetTabSortBoxes();
+/*?*/ ULONG nIdx = rNd.GetIndex();
+/*?*/ for( USHORT n = 0; n < rSortBoxes.Count(); ++n )
+/*?*/ {
+/*?*/ const SwStartNode* pNd = rSortBoxes[ n ]->GetSttNd();
+/*?*/ if( pNd->GetIndex() < nIdx &&
+/*?*/ nIdx < pNd->EndOfSectionIndex() )
+/*?*/ {
+/*?*/ // dann muss der andere Index in derselben Section liegen
+/*?*/ nIdx = rIdx2.GetIndex();
+/*?*/ return pNd->GetIndex() < nIdx && nIdx < pNd->EndOfSectionIndex();
+/*?*/ }
+/*?*/ }
+/*?*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ SwSection* SwDoc::Insert( const SwPaM& rRange, const SwSection& rNew,
+/*N*/ const SfxItemSet* pAttr, BOOL bUpdate )
+/*N*/ {
+/*N*/ const SwNode* pPrvNd = 0;
+/*N*/ USHORT nRegionRet = 0;
+/*N*/ if( rRange.HasMark() &&
+/*N*/ 0 == ( nRegionRet = IsInsRegionAvailable( rRange, &pPrvNd ) ))
+/*N*/ {
+/*?*/ ASSERT( !this, "Selection ueber verschiedene Sections" );
+/*?*/ return 0;
+/*N*/ }
+/*N*/
+/*N*/ // Teste ob das gesamte Dokument versteckt werden soll,
+/*N*/ // koennen wir zur Zeit nicht !!!!
+/*N*/ if( rNew.IsHidden() && rRange.HasMark() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
+/*N*/ }
+/*N*/
+/*N*/ SwSectionFmt* pFmt = MakeSectionFmt( 0 );
+/*N*/ if( pAttr )
+/*N*/ pFmt->SetAttr( *pAttr );
+/*N*/
+/*N*/ SwSectionNode* pNewSectNode = 0;
+/*N*/
+/*N*/ SwRedlineMode eOld = GetRedlineMode();
+/*N*/ SetRedlineMode_intern( (eOld & ~REDLINE_SHOW_MASK) | REDLINE_IGNORE );
+/*N*/
+/*N*/ if( rRange.HasMark() )
+/*N*/ {
+/*N*/ SwPosition *pSttPos = (SwPosition*)rRange.Start(),
+/*N*/ *pEndPos = (SwPosition*)rRange.End();
+/*N*/ if( pPrvNd && 3 == nRegionRet )
+/*N*/ {
+/*?*/ ASSERT( pPrvNd, "der SectionNode fehlt" );
+/*?*/ SwNodeIndex aStt( pSttPos->nNode ), aEnd( pEndPos->nNode, +1 );
+/*?*/ while( pPrvNd != aStt.GetNode().FindStartNode() )
+/*?*/ aStt--;
+/*?*/ while( pPrvNd != aEnd.GetNode().FindStartNode() )
+/*?*/ aEnd++;
+/*?*/
+/*?*/ --aEnd; // im InsertSection ist Ende inclusive
+/*?*/ pNewSectNode = GetNodes().InsertSection( aStt, *pFmt, rNew, &aEnd );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwCntntNode* pCNd;
+/*N*/ if( pPrvNd && 1 == nRegionRet )
+/*N*/ {
+/*?*/ pSttPos->nNode.Assign( *pPrvNd );
+/*?*/ pSttPos->nContent.Assign( pSttPos->nNode.GetNode().GetCntntNode(), 0 );
+/*N*/ }
+/*N*/ else if( pSttPos->nContent.GetIndex() )
+/*?*/ SplitNode( *pSttPos );
+/*N*/
+/*N*/ if( pPrvNd && 2 == nRegionRet )
+/*N*/ {
+/*?*/ pEndPos->nNode.Assign( *pPrvNd );
+/*?*/ pEndPos->nContent.Assign( pEndPos->nNode.GetNode().GetCntntNode(), 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pCNd = pEndPos->nNode.GetNode().GetCntntNode();
+/*N*/ if( pCNd && pCNd->Len() != pEndPos->nContent.GetIndex() )
+/*N*/ {
+/*?*/ xub_StrLen nCntnt = pSttPos->nContent.GetIndex();
+/*?*/ SplitNode( *pEndPos );
+/*?*/
+/*?*/ SwTxtNode* pTNd;
+/*?*/ if( pEndPos->nNode.GetIndex() == pSttPos->nNode.GetIndex() )
+/*?*/ {
+/*?*/ pSttPos->nNode--;
+/*?*/ pEndPos->nNode--;
+/*?*/ pTNd = pSttPos->nNode.GetNode().GetTxtNode();
+/*?*/ pSttPos->nContent.Assign( pTNd, nCntnt );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // wieder ans Ende vom vorherigen setzen
+/*?*/ pEndPos->nNode--;
+/*?*/ pTNd = pEndPos->nNode.GetNode().GetTxtNode();
+/*?*/ }
+/*?*/ if( pTNd ) nCntnt = pTNd->GetTxt().Len(); else nCntnt = 0;
+/*?*/ pEndPos->nContent.Assign( pTNd, nCntnt );
+/*N*/ }
+/*N*/ }
+/*N*/ pNewSectNode = GetNodes().InsertSection( pSttPos->nNode, *pFmt, rNew,
+/*N*/ &pEndPos->nNode );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwPosition* pPos = rRange.GetPoint();
+/*N*/ const SwCntntNode* pCNd = pPos->nNode.GetNode().GetCntntNode();
+/*N*/ if( !pPos->nContent.GetIndex() )
+/*N*/ {
+/*N*/ pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, TRUE );
+/*N*/ }
+/*N*/ else if( pPos->nContent.GetIndex() == pCNd->Len() )
+/*N*/ {
+/*?*/ pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, FALSE );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ SplitNode( *pPos );
+/*?*/ pNewSectNode = GetNodes().InsertSection( pPos->nNode, *pFmt, rNew, 0, TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ pNewSectNode->CheckSectionCondColl();
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ SetRedlineMode_intern( eOld );
+/*N*/
+/*N*/ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aPam( *pNewSectNode->EndOfSectionNode(), *pNewSectNode, 1 );
+/*N*/ }
+/*N*/
+/*N*/ // ist eine Condition gesetzt
+/*N*/ if( rNew.IsHidden() && rNew.GetCondition().Len() )
+/*N*/ {
+/*?*/ // dann berechne bis zu dieser Position
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwCalc aCalc( *this );
+/*N*/ }
+/*N*/
+/*N*/ BOOL bUpdateFtn = FALSE;
+/*N*/ if( GetFtnIdxs().Count() && pAttr )
+/*N*/ {
+/*?*/ USHORT nVal = ((SwFmtFtnAtTxtEnd&)pAttr->Get(
+/*?*/ RES_FTN_AT_TXTEND )).GetValue();
+/*?*/ if( ( FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
+/*?*/ FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ) ||
+/*?*/ ( FTNEND_ATTXTEND_OWNNUMSEQ == ( nVal = ((SwFmtEndAtTxtEnd&)
+/*?*/ pAttr->Get( RES_END_AT_TXTEND )).GetValue() ) ||
+/*?*/ FTNEND_ATTXTEND_OWNNUMANDFMT == nVal ))
+/*?*/ bUpdateFtn = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ if( rNew.IsLinkType() )
+/*?*/ pNewSectNode->GetSection().CreateLink( bUpdate ? CREATE_UPDATE : CREATE_CONNECT );
+/*N*/
+/*N*/ if( bUpdateFtn )
+/*?*/ GetFtnIdxs().UpdateFtn( SwNodeIndex( *pNewSectNode ));
+/*N*/
+/*N*/ SetModified();
+/*N*/ return &pNewSectNode->GetSection();
+/*N*/ }
+
+/*N*/ USHORT SwDoc::IsInsRegionAvailable( const SwPaM& rRange,
+/*N*/ const SwNode** ppSttNd ) const
+/*N*/ {
+/*N*/ USHORT nRet = 1;
+/*N*/ if( rRange.HasMark() )
+/*N*/ {
+/*N*/ // teste ob es sich um eine gueltige Selektion handelt
+/*N*/ const SwPosition* pStt = rRange.Start(),
+/*N*/ * pEnd = rRange.End();
+/*N*/
+/*N*/ const SwCntntNode* pCNd = pEnd->nNode.GetNode().GetCntntNode();
+/*N*/ const SwNode* pNd = &pStt->nNode.GetNode();
+/*N*/ const SwSectionNode* pSectNd = pNd->FindSectionNode();
+/*N*/ const SwSectionNode* pEndSectNd = pCNd ? pCNd->FindSectionNode() : 0;
+/*N*/ if( pSectNd && pEndSectNd && pSectNd != pEndSectNd )
+/*N*/ {
+/*?*/ // versuche eine umschliessende Section zu erzeugen
+/*?*/ // Aber, nur wenn der Start am Sectionanfang und das Ende am
+/*?*/ // Section Ende liegt!
+/*?*/ nRet = 0;
+/*?*/ if( !pStt->nContent.GetIndex() && pSectNd->GetIndex()
+/*?*/ == pStt->nNode.GetIndex() - 1 && pEnd->nContent.GetIndex() ==
+/*?*/ pCNd->Len() )
+/*?*/ {
+/*?*/ SwNodeIndex aIdx( pStt->nNode, -1 );
+/*?*/ ULONG nCmp = pEnd->nNode.GetIndex();
+/*?*/ const SwStartNode* pPrvNd;
+/*?*/ const SwEndNode* pNxtNd;
+/*?*/ while( 0 != ( pPrvNd = (pNd = &aIdx.GetNode())->GetSectionNode() ) &&
+/*?*/ !( aIdx.GetIndex() < nCmp &&
+/*?*/ nCmp < pPrvNd->EndOfSectionIndex() ) )
+/*?*/ {
+/*?*/ aIdx--;
+/*?*/ }
+/*?*/ if( !pPrvNd )
+/*?*/ pPrvNd = pNd->IsStartNode() ? (SwStartNode*)pNd
+/*?*/ : pNd->FindStartNode();
+/*?*/
+/*?*/ aIdx = pEnd->nNode.GetIndex() + 1;
+/*?*/ nCmp = pStt->nNode.GetIndex();
+/*?*/ while( 0 != ( pNxtNd = (pNd = &aIdx.GetNode())->GetEndNode() ) &&
+/*?*/ pNxtNd->FindStartNode()->IsSectionNode() &&
+/*?*/ !( pNxtNd->StartOfSectionIndex() < nCmp &&
+/*?*/ nCmp < aIdx.GetIndex() ) )
+/*?*/ {
+/*?*/ aIdx++;
+/*?*/ }
+/*?*/ if( !pNxtNd )
+/*?*/ pNxtNd = pNd->EndOfSectionNode();
+/*?*/
+/*?*/ if( pPrvNd && pNxtNd && pPrvNd == pNxtNd->FindStartNode() )
+/*?*/ {
+/*?*/ nRet = 3;
+/*?*/
+/*?*/ if( ppSttNd )
+/*?*/ *ppSttNd = pPrvNd;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ else if( !pSectNd && pEndSectNd )
+/*N*/ {
+/*?*/ // versuche eine umschliessende Section zu erzeugen
+/*?*/ // Aber, nur wenn das Ende am Section Ende liegt!
+/*?*/ nRet = 0;
+/*?*/ if( pEnd->nContent.GetIndex() == pCNd->Len() )
+/*?*/ {
+/*?*/ SwNodeIndex aIdx( pEnd->nNode, 1 );
+/*?*/ if( aIdx.GetNode().IsEndNode() &&
+/*?*/ 0 != aIdx.GetNode().FindSectionNode() )
+/*?*/ {
+/*?*/ do {
+/*?*/ aIdx++;
+/*?*/ } while( aIdx.GetNode().IsEndNode() &&
+/*?*/ 0 != aIdx.GetNode().FindSectionNode() );
+/*?*/ // if( !aIdx.GetNode().IsEndNode() )
+/*?*/ {
+/*?*/ nRet = 2;
+/*?*/ if( ppSttNd )
+/*?*/ {
+/*?*/ aIdx--;
+/*?*/ *ppSttNd = &aIdx.GetNode();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ else if( pSectNd && !pEndSectNd )
+/*N*/ {
+/*?*/ // versuche eine umschliessende Section zu erzeugen
+/*?*/ // Aber, nur wenn der Start am Section Anfang liegt!
+/*?*/ nRet = 0;
+/*?*/ if( !pStt->nContent.GetIndex() )
+/*?*/ {
+/*?*/ SwNodeIndex aIdx( pStt->nNode, -1 );
+/*?*/ if( aIdx.GetNode().IsSectionNode() )
+/*?*/ {
+/*?*/ do {
+/*?*/ aIdx--;
+/*?*/ } while( aIdx.GetNode().IsSectionNode() );
+/*?*/ if( !aIdx.GetNode().IsSectionNode() )
+/*?*/ {
+/*?*/ nRet = 1;
+/*?*/ if( ppSttNd )
+/*?*/ {
+/*?*/ aIdx++;
+/*?*/ *ppSttNd = &aIdx.GetNode();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ SwSection* SwDoc::GetCurrSection( const SwPosition& rPos ) const
+/*N*/ {
+/*N*/ const SwSectionNode* pSectNd = rPos.nNode.GetNode().FindSectionNode();
+/*N*/ if( pSectNd )
+/*N*/ return (SwSection*)&pSectNd->GetSection();
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ SwSectionFmt* SwDoc::MakeSectionFmt( SwSectionFmt *pDerivedFrom )
+/*N*/ {
+/*N*/ if( !pDerivedFrom )
+/*N*/ pDerivedFrom = (SwSectionFmt*)pDfltFrmFmt;
+/*N*/ SwSectionFmt* pNew = new SwSectionFmt( pDerivedFrom, this );
+/*N*/ pSectionFmtTbl->Insert( pNew, pSectionFmtTbl->Count() );
+/*N*/ return pNew;
+/*N*/ }
+
+/*N*/ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes )
+/*N*/ {
+/*N*/ USHORT nPos = pSectionFmtTbl->GetPos( pFmt );
+/*N*/ if( USHRT_MAX != nPos )
+/*N*/ {
+/*N*/ const SwNodeIndex* pIdx = pFmt->GetCntnt( FALSE ).GetCntntIdx();
+/*N*/ const SfxPoolItem* pFtnEndAtTxtEnd;
+/*N*/ if( SFX_ITEM_SET != pFmt->GetItemState(
+/*N*/ RES_FTN_AT_TXTEND, TRUE, &pFtnEndAtTxtEnd ) ||
+/*N*/ SFX_ITEM_SET != pFmt->GetItemState(
+/*N*/ RES_END_AT_TXTEND, TRUE, &pFtnEndAtTxtEnd ))
+/*N*/ pFtnEndAtTxtEnd = 0;
+/*N*/
+/*N*/ const SwSectionNode* pSectNd;
+/*N*/
+/*N*/ if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
+/*N*/ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+/*N*/ {
+/*?*/ SwNodeIndex aUpdIdx( *pIdx );
+/*?*/ DeleteSection( (SwNode*)pSectNd );
+/*?*/ if( pFtnEndAtTxtEnd )
+/*?*/ GetFtnIdxs().UpdateFtn( aUpdIdx );
+/*?*/ SetModified();
+/*?*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
+/*N*/ pFmt->Modify( &aMsgHint, &aMsgHint );
+/*N*/ }
+/*N*/
+/*N*/ // ACHTUNG: erst aus dem Array entfernen und dann loeschen.
+/*N*/ // Der Section-DTOR versucht selbst noch sein Format
+/*N*/ // zu loeschen!
+/*N*/ pSectionFmtTbl->Remove( nPos );
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ ULONG nCnt = 0, nSttNd = 0;
+/*N*/ if( pIdx && &GetNodes() == &pIdx->GetNodes() &&
+/*N*/ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+/*N*/ {
+/*?*/ nSttNd = pSectNd->GetIndex();
+/*?*/ nCnt = pSectNd->EndOfSectionIndex() - nSttNd - 1;
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ delete pFmt;
+/*N*/
+/*N*/ if( nSttNd && pFtnEndAtTxtEnd )
+/*N*/ {
+/*?*/ SwNodeIndex aUpdIdx( GetNodes(), nSttNd );
+/*?*/ GetFtnIdxs().UpdateFtn( aUpdIdx );
+/*N*/ }
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ SwCntntNode* pCNd;
+/*N*/ for( ; nCnt--; ++nSttNd )
+/*N*/ if( 0 != (pCNd = GetNodes()[ nSttNd ]->GetCntntNode() ) &&
+/*?*/ RES_CONDTXTFMTCOLL == pCNd->GetFmtColl()->Which() )
+/*?*/ pCNd->ChkCondColl();
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ }
+/*N*/ SetModified();
+/*N*/ }
+
+/*N*/ void SwDoc::ChgSection( USHORT nPos, const SwSection& rSect,
+/*N*/ const SfxItemSet* pAttr,
+/*N*/ sal_Bool bPreventLinkUpdate )
+/*N*/ {
+/*N*/ SwSectionFmt* pFmt = (*pSectionFmtTbl)[ nPos ];
+/*N*/ SwSection* pSection = pFmt->GetSection();
+/*N*/ /// OD 04.10.2002 #102894#
+/*N*/ /// remember hidden condition flag of SwSection before changes
+/*N*/ bool bOldCondHidden = pSection->IsCondHidden() ? true : false;
+/*N*/
+/*N*/ if( *pSection == rSect )
+/*N*/ {
+/*N*/ // die Attribute ueberpruefen
+/*N*/ BOOL bOnlyAttrChg = FALSE;
+/*N*/ if( pAttr && pAttr->Count() )
+/*N*/ {
+/*N*/ SfxItemIter aIter( *pAttr );
+/*N*/ USHORT nWhich = aIter.GetCurItem()->Which();
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ if( pFmt->GetAttr( nWhich ) != *aIter.GetCurItem() )
+/*N*/ {
+/*N*/ bOnlyAttrChg = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*?*/ if( aIter.IsAtEnd() )
+/*?*/ break;
+/*?*/ nWhich = aIter.NextItem()->Which();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bOnlyAttrChg )
+/*N*/ {
+/*N*/ pFmt->SetAttr( *pAttr );
+/*N*/ SetModified();
+/*N*/ }
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Teste ob eine gesamte Content-Section (Dokument/TabellenBox/Fly)
+/*N*/ // versteckt werden soll, koennen wir zur Zeit nicht !!!!
+/*N*/ const SwNodeIndex* pIdx = 0;
+/*N*/ {
+/*N*/ const SwSectionNode* pSectNd;
+/*N*/ if( rSect.IsHidden() && 0 != (pIdx = pFmt->GetCntnt().GetCntntIdx() )
+/*N*/ && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ) )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ::lcl_CheckEmptyLayFrm( GetNodes(), (SwSection&)rSect,
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ // #56167# Der LinkFileName koennte auch nur aus Separatoren bestehen
+/*N*/ String sCompareString = ::binfilter::cTokenSeperator;
+/*N*/ sCompareString += ::binfilter::cTokenSeperator;
+/*N*/ BOOL bUpdate = ( !pSection->IsLinkType() && rSect.IsLinkType() ) ||
+/*N*/ ( rSect.GetLinkFileName().Len() &&
+/*N*/ rSect.GetLinkFileName() != sCompareString &&
+/*N*/ rSect.GetLinkFileName() !=
+/*N*/ pSection->GetLinkFileName());
+/*N*/
+/*N*/ String sSectName( rSect.GetName() );
+/*N*/ if( sSectName != pSection->GetName() )
+/*?*/ GetUniqueSectionName( &sSectName );
+/*N*/ else
+/*N*/ sSectName.Erase();
+/*N*/
+/*N*/ /// OD 04.10.2002 #102894# - NOTE
+/*N*/ /// In SwSection::operator=(..) class member bCondHiddenFlag is always set to TRUE.
+/*N*/ /// IMHO this have to be changed, but I can't estimate the consequences:
+/*N*/ /// Either it is set to TRUE using corresponding method <SwSection.SetCondHidden(..)>,
+/*N*/ /// or it is set to the value of SwSection which is assigned to it.
+/*N*/ /// Discussion with AMA results that the adjustment to the assignment operator
+/*N*/ /// could be very risky -> see notes in bug #102894#.
+/*N*/ *pSection = rSect;
+/*N*/
+/*N*/ if( pAttr )
+/*?*/ pSection->GetFmt()->SetAttr( *pAttr );
+/*N*/
+/*N*/ if( sSectName.Len() )
+/*?*/ pSection->SetName( sSectName );
+/*N*/
+/*N*/ // ist eine Condition gesetzt
+/*N*/ if( pSection->IsHidden() && pSection->GetCondition().Len() )
+/*N*/ {
+/*?*/ // dann berechne bis zu dieser Position
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwCalc aCalc( *this );
+/*N*/ }
+/*N*/
+/*N*/ if( bUpdate )
+/*N*/ pSection->CreateLink( bPreventLinkUpdate ? CREATE_CONNECT : CREATE_UPDATE );
+/*N*/ else if( !pSection->IsLinkType() && pSection->IsConnected() )
+/*N*/ {
+/*?*/ pSection->Disconnect();
+/*?*/ GetLinkManager().Remove( &pSection->GetBaseLink() );
+/*N*/ }
+/*N*/
+/*N*/ SetModified();
+/*N*/ }
+
+
+/* -----------------19.02.99 09:31-------------------
+ * LockFrms wurde im InsertSection genutzt, um zu verhindern, dass
+ * SectionFrms durch das DelFrms zerstoert werden. Dies ist durch
+ * den Destroy-Listen-Mechanismus ueberfluessig geworden.
+ * Falls diese Methode doch noch einmal reanimiert wird, bietet es
+ * sich vielleicht an, beim Entlocken die SectionFrms auf Inhalt zu
+ * pruefen und dann ggf. zur Zerstoerung anzumelden.
+ * --------------------------------------------------*/
+
+// und dann waren da noch die Fussnoten:
+/*N*/ void lcl_DeleteFtn( SwSectionNode *pNd, ULONG nStt, ULONG nEnd )
+/*N*/ {
+/*N*/ SwFtnIdxs& rFtnArr = pNd->GetDoc()->GetFtnIdxs();
+/*N*/ if( rFtnArr.Count() )
+/*N*/ {
+/*?*/ USHORT nPos;
+ /*?*/ rFtnArr.SeekEntry( SwNodeIndex( *pNd ), &nPos );
+ /*?*/ SwTxtFtn* pSrch;
+ /*?*/
+ /*?*/ // loesche erstmal alle, die dahinter stehen
+ /*?*/ while( nPos < rFtnArr.Count() &&
+ /*?*/ _SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) <= nEnd )
+ /*?*/ {
+ /*?*/ // Werden die Nodes nicht geloescht mussen sie bei den Seiten
+ /*?*/ // abmeldet (Frms loeschen) werden, denn sonst bleiben sie
+ /*?*/ // stehen (Undo loescht sie nicht!)
+ /*?*/ pSrch->DelFrms();
+ /*?*/ ++nPos;
+ /*?*/ }
+ /*?*/
+ /*?*/ while( nPos-- &&
+ /*?*/ _SwTxtFtn_GetIndex( (pSrch = rFtnArr[ nPos ]) ) >= nStt )
+ /*?*/ {
+ /*?*/ // Werden die Nodes nicht geloescht mussen sie bei den Seiten
+ /*?*/ // abmeldet (Frms loeschen) werden, denn sonst bleiben sie
+ /*?*/ // stehen (Undo loescht sie nicht!)
+ /*?*/ pSrch->DelFrms();
+ /*?*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ inline BOOL lcl_IsTOXSection( const SwSection& rSection )
+/*N*/ {
+/*N*/ return TOX_CONTENT_SECTION == rSection.GetType() ||
+/*N*/ TOX_HEADER_SECTION == rSection.GetType();
+/*N*/ }
+
+/*N*/ SwSectionNode* SwNodes::InsertSection( const SwNodeIndex& rNdIdx,
+/*N*/ SwSectionFmt& rSectionFmt,
+/*N*/ const SwSection& rSection,
+/*N*/ const SwNodeIndex* pEnde,
+/*N*/ BOOL bInsAtStart, BOOL bCreateFrms )
+/*N*/ {
+/*N*/ SwNodeIndex aInsPos( rNdIdx );
+/*N*/ if( !pEnde ) // kein Bereich also neue Section davor/hinter anlegen
+/*N*/ {
+/*N*/ if( bInsAtStart )
+/*N*/ {
+/*?*/ if( !lcl_IsTOXSection( rSection ))
+/*?*/ {
+/*?*/ do {
+/*?*/ aInsPos--;
+/*?*/ } while( aInsPos.GetNode().IsSectionNode() );
+/*?*/ aInsPos++;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ SwNode* pNd;
+/*?*/ aInsPos++;
+/*?*/ if( !lcl_IsTOXSection( rSection ))
+/*?*/ while( aInsPos.GetIndex() < Count() - 1 &&
+/*?*/ ( pNd = &aInsPos.GetNode())->IsEndNode() &&
+/*?*/ pNd->FindStartNode()->IsSectionNode())
+/*?*/ aInsPos++;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwSectionNode* pSectNd = new SwSectionNode( aInsPos, rSectionFmt );
+/*N*/ if( pEnde )
+/*N*/ {
+/*N*/ // Sonderfall fuer die Reader/Writer
+/*N*/ if( &pEnde->GetNode() != &GetEndOfContent() )
+/*N*/ aInsPos = pEnde->GetIndex()+1;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwTxtNode* pCpyTNd = rNdIdx.GetNode().GetTxtNode();
+/*N*/ if( pCpyTNd )
+/*N*/ {
+/*N*/ SwTxtNode* pTNd = new SwTxtNode( aInsPos, pCpyTNd->GetTxtColl() );
+/*N*/ if( pCpyTNd->GetpSwAttrSet() )
+/*N*/ {
+/*?*/ // Task 70955 - move PageDesc/Break to the first Node of the
+/*?*/ // section
+/*?*/ const SfxItemSet& rSet = *pCpyTNd->GetpSwAttrSet();
+/*?*/ if( SFX_ITEM_SET == rSet.GetItemState( RES_BREAK ) ||
+/*?*/ SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC ))
+/*?*/ {
+/*?*/ SfxItemSet aSet( rSet );
+/*?*/ if( bInsAtStart )
+/*?*/ pCpyTNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
+/*?*/ else
+/*?*/ {
+/*?*/ aSet.ClearItem( RES_PAGEDESC );
+/*?*/ aSet.ClearItem( RES_BREAK );
+/*?*/ }
+/*?*/ pTNd->SwCntntNode::SetAttr( aSet );
+/*?*/ }
+/*?*/ else
+/*?*/ pTNd->SwCntntNode::SetAttr( rSet );
+/*N*/ }
+/*N*/ // den Frame anlegen nicht vergessen !!
+/*N*/ pCpyTNd->MakeFrms( *pTNd );
+/*N*/ }
+/*N*/ else
+/*?*/ new SwTxtNode( aInsPos, (SwTxtFmtColl*)GetDoc()->GetDfltTxtFmtColl() );
+/*N*/ }
+/*N*/ SwEndNode* pEndNd = new SwEndNode( aInsPos, *pSectNd );
+/*N*/
+/*N*/ pSectNd->GetSection() = rSection;
+/*N*/ SwSectionFmt* pSectFmt = pSectNd->GetSection().GetFmt();
+/*N*/
+/*N*/ // Hier bietet sich als Optimierung an, vorhandene Frames nicht zu
+/*N*/ // zerstoeren und wieder neu anzulegen, sondern nur umzuhaengen.
+/*N*/ BOOL bInsFrm = bCreateFrms && !pSectNd->GetSection().IsHidden() &&
+/*N*/ GetDoc()->GetRootFrm();
+/*N*/ SwNode2Layout *pNode2Layout = NULL;
+/*N*/ if( bInsFrm )
+/*N*/ {
+/*N*/ SwNodeIndex aTmp( *pSectNd );
+/*N*/ if( !pSectNd->GetNodes().FindPrvNxtFrmNode( aTmp, pSectNd->EndOfSectionNode() ) )
+/*N*/ // dann sammel mal alle Uppers ein
+/*?*/ pNode2Layout = new SwNode2Layout( *pSectNd );
+/*N*/ }
+/*N*/
+/*N*/ // jetzt noch bei allen im Bereich den richtigen StartNode setzen
+/*N*/ ULONG nEnde = pSectNd->EndOfSectionIndex();
+/*N*/ ULONG nStart = pSectNd->GetIndex()+1;
+/*N*/ ULONG nSkipIdx = ULONG_MAX;
+/*N*/ for( ULONG n = nStart; n < nEnde; ++n )
+/*N*/ {
+/*N*/ SwNode* pNd = (*this)[n];
+/*N*/
+/*N*/ //JP 30.04.99: Bug 65644 - alle in der NodeSection liegenden
+/*N*/ // Sections unter die neue haengen
+/*N*/ if( ULONG_MAX == nSkipIdx )
+/*N*/ pNd->pStartOfSection = pSectNd;
+/*N*/ else if( n >= nSkipIdx )
+/*?*/ nSkipIdx = ULONG_MAX;
+/*N*/
+/*N*/ if( pNd->IsStartNode() )
+/*N*/ {
+/*?*/ // die Verschachtelung der Formate herstellen!
+/*?*/ if( pNd->IsSectionNode() )
+/*?*/ {
+/*?*/ ((SwSectionNode*)pNd)->GetSection().GetFmt()->
+/*?*/ SetDerivedFrom( pSectFmt );
+/*?*/ ((SwSectionNode*)pNd)->DelFrms();
+/*?*/ n = pNd->EndOfSectionIndex();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ if( pNd->IsTableNode() )
+/*?*/ ((SwTableNode*)pNd)->DelFrms();
+/*?*/
+/*?*/ if( ULONG_MAX == nSkipIdx )
+/*?*/ nSkipIdx = pNd->EndOfSectionIndex();
+/*?*/ }
+/*N*/ }
+/*N*/ else if( pNd->IsCntntNode() )
+/*N*/ ((SwCntntNode*)pNd)->DelFrms();
+/*N*/ }
+/*N*/
+/*N*/ lcl_DeleteFtn( pSectNd, nStart, nEnde );
+/*N*/
+/*N*/ if( bInsFrm )
+/*N*/ {
+/*N*/ if( pNode2Layout )
+/*N*/ {
+/*?*/ ULONG nIdx = pSectNd->GetIndex();
+/*?*/ pNode2Layout->RestoreUpperFrms( pSectNd->GetNodes(), nIdx, nIdx + 1 );
+/*?*/ delete pNode2Layout;
+/*N*/ }
+/*N*/ else
+/*N*/ pSectNd->MakeFrms( &aInsPos );
+/*N*/ }
+/*N*/
+/*N*/ return pSectNd;
+/*N*/ }
+
+/*N*/ SwSectionNode* SwNode::FindSectionNode()
+/*N*/ {
+/*N*/ if( IsSectionNode() )
+/*N*/ return GetSectionNode();
+/*N*/ SwStartNode* pTmp = pStartOfSection;
+/*N*/ while( !pTmp->IsSectionNode() && pTmp->GetIndex() )
+/*N*/ #if defined( ALPHA ) && defined( UNX )
+/*?*/ pTmp = ((SwNode*)pTmp)->pStartOfSection;
+/*N*/ #else
+/*N*/ pTmp = pTmp->pStartOfSection;
+/*N*/ #endif
+/*N*/ return pTmp->GetSectionNode();
+/*N*/ }
+
+
+//---------
+// SwSectionNode
+//---------
+
+/*N*/ SwSectionNode::SwSectionNode( const SwNodeIndex& rIdx, SwSectionFmt& rFmt )
+/*N*/ : SwStartNode( rIdx, ND_SECTIONNODE )
+/*N*/ {
+/*N*/ SwSectionNode* pParent = FindStartNode()->FindSectionNode();
+/*N*/ if( pParent )
+/*N*/ {
+/*N*/ // das Format beim richtigen Parent anmelden.
+/*N*/ rFmt.SetDerivedFrom( pParent->GetSection().GetFmt() );
+/*N*/ }
+/*N*/ pSection = new SwSection( CONTENT_SECTION, rFmt.GetName(), &rFmt );
+/*N*/
+/*N*/ // jetzt noch die Verbindung von Format zum Node setzen
+/*N*/ // Modify unterdruecken, interresiert keinen
+/*N*/ rFmt.LockModify();
+/*N*/ rFmt.SetAttr( SwFmtCntnt( this ) );
+/*N*/ rFmt.UnlockModify();
+/*N*/ }
+
+//Hier werden ueberfluessige SectionFrms entfernt
+
+/*N*/ SwSectionNode::~SwSectionNode()
+/*N*/ {
+/*N*/ {
+/*N*/ SwClientIter aIter( *(pSection->GetFmt()) );
+/*N*/ SwClient *pLast = aIter.GoStart();
+/*N*/ while ( pLast )
+/*N*/ {
+/*N*/ if ( pLast->IsA( TYPE(SwFrm) ) )
+/*N*/ {
+/*?*/ SwSectionFrm *pSectFrm = (SwSectionFrm*)pLast;
+/*?*/ SwSectionFrm::MoveCntntAndDelete( pSectFrm, TRUE );
+/*?*/ pLast = aIter.GoStart();
+/*N*/ }
+/*N*/ else
+/*N*/ pLast = aIter++;
+/*N*/ }
+/*N*/ }
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/
+/*N*/ SwSectionFmt* pFmt = pSection->GetFmt();
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ // das Attribut entfernen, weil die Section ihr Format loescht
+/*N*/ // und falls das Cntnt-Attribut vorhanden ist, die Section aufhebt.
+/*N*/ pFmt->LockModify();
+/*N*/ pFmt->ResetAttr( RES_CNTNT );
+/*N*/ pFmt->UnlockModify();
+/*N*/ }
+/*N*/
+/*N*/ DELETEZ( pSection );
+/*N*/ }
+
+// setze ein neues SectionObject. Erstmal nur gedacht fuer die
+// neuen VerzeichnisSections. Der geht ueber in den Besitz des Nodes!
+/*N*/ void SwSectionNode::SetNewSection( SwSection* pNewSection )
+/*N*/ {
+/*N*/ ASSERT( pNewSection, "ohne Pointer geht hier nichts" );
+/*N*/ if( pNewSection )
+/*N*/ {
+/*N*/ SwNode2Layout aN2L( *this );
+/*N*/
+/*N*/ // einige Flags sollten ueber nommen werden!
+/*N*/ pNewSection->bProtectFlag = pSection->bProtectFlag;
+/*N*/ pNewSection->bHiddenFlag = pSection->bHiddenFlag;
+/*N*/ pNewSection->bHidden = pSection->bHidden;
+/*N*/ pNewSection->bCondHiddenFlag = pSection->bCondHiddenFlag;
+/*N*/
+/*N*/ // The section frame contains a pointer to the section. That for,
+/*N*/ // the frame must be destroyed before deleting the section.
+/*N*/ DelFrms();
+/*N*/
+/*N*/ delete pSection;
+/*N*/ pSection = pNewSection;
+/*N*/
+/*N*/ ULONG nIdx = GetIndex();
+/*N*/ aN2L.RestoreUpperFrms( GetNodes(), nIdx, nIdx + 1 );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwFrm *SwSectionNode::MakeFrm()
+/*N*/ {
+/*N*/ pSection->bHiddenFlag = FALSE;
+/*N*/ return new SwSectionFrm( *pSection );
+/*N*/ }
+
+//Fuer jedes vorkommen im Layout einen SectionFrm anlegen und vor den
+//entsprechenden CntntFrm pasten.
+
+/*N*/ void SwSectionNode::MakeFrms( SwNodeIndex* pIdxBehind, SwNodeIndex* pEndIdx )
+/*N*/ {
+/*N*/ ASSERT( pIdxBehind, "kein Index" );
+/*N*/ SwNodes& rNds = GetNodes();
+/*N*/ SwDoc* pDoc = rNds.GetDoc();
+/*N*/
+/*N*/ *pIdxBehind = *this;
+/*N*/
+/*N*/ pSection->bHiddenFlag = TRUE;
+/*N*/
+/*N*/ if( rNds.IsDocNodes() )
+/*N*/ {
+/*N*/ SwNodeIndex *pEnd = pEndIdx ? pEndIdx :
+/*N*/ new SwNodeIndex( *EndOfSectionNode(), 1 );
+/*N*/ ::binfilter::MakeFrms( pDoc, *pIdxBehind, *pEnd );
+/*N*/ if( !pEndIdx )
+/*N*/ delete pEnd;
+/*N*/ }
+/*N*/
+/*N*/ }
+
+/*N*/ void SwSectionNode::DelFrms()
+/*N*/ {
+/*N*/ ULONG nStt = GetIndex()+1, nEnd = EndOfSectionIndex();
+/*N*/ if( nStt >= nEnd )
+/*N*/ {
+/*?*/ // unser Flag muessen wir noch aktualisieren
+/*?*/ // pSection->bHiddenFlag = TRUE;
+/*?*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ SwNodes& rNds = GetNodes();
+/*N*/ pSection->GetFmt()->DelFrms();
+/*N*/
+/*N*/ // unser Flag muessen wir noch aktualisieren
+/*N*/ pSection->bHiddenFlag = TRUE;
+/*N*/
+/*N*/ // Bug 30582: falls der Bereich in Fly oder TabellenBox ist, dann
+/*N*/ // kann er nur "gehiddet" werden, wenn weiterer Content
+/*N*/ // vorhanden ist, der "Frames" haelt. Sonst hat der
+/*N*/ // Fly/TblBox-Frame keinen Lower !!!
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *this );
+/*N*/ if( !rNds.GoPrevSection( &aIdx, TRUE, FALSE ) ||
+/*N*/ !CheckNodesRange( *this, aIdx, TRUE ) ||
+/*N*/ !lcl_IsInSameTblBox( rNds, *this, aIdx ))
+/*N*/ {
+/*N*/ aIdx = *EndOfSectionNode();
+/*N*/ if( !rNds.GoNextSection( &aIdx, TRUE, FALSE ) ||
+/*N*/ !CheckNodesRange( *EndOfSectionNode(), aIdx, TRUE ) ||
+/*N*/ !lcl_IsInSameTblBox( rNds, *EndOfSectionNode(), aIdx ))
+/*?*/ pSection->bHiddenFlag = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ String SwDoc::GetUniqueSectionName( const String* pChkStr ) const
+/*N*/ {
+/*N*/ ResId aId( STR_REGION_DEFNAME, *pSwResMgr );
+/*N*/ String aName( aId );
+/*N*/ xub_StrLen nNmLen = aName.Len();
+/*N*/
+/*N*/ USHORT nNum, nTmp, nFlagSize = ( pSectionFmtTbl->Count() / 8 ) +2;
+/*N*/ BYTE* pSetFlags = new BYTE[ nFlagSize ];
+/*N*/ memset( pSetFlags, 0, nFlagSize );
+/*N*/
+/*N*/ const SwSectionNode* pSectNd;
+ USHORT n=0;
+/*N*/ for( n = 0; n < pSectionFmtTbl->Count(); ++n )
+/*N*/ if( 0 != ( pSectNd = (*pSectionFmtTbl)[ n ]->GetSectionNode( FALSE ) ))
+/*N*/ {
+/*N*/ const String& rNm = pSectNd->GetSection().GetName();
+/*N*/ if( rNm.Match( aName ) == nNmLen )
+/*N*/ {
+/*?*/ // Nummer bestimmen und das Flag setzen
+/*?*/ nNum = rNm.Copy( nNmLen ).ToInt32();
+/*?*/ if( nNum-- && nNum < pSectionFmtTbl->Count() )
+/*?*/ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+/*N*/ }
+/*N*/ if( pChkStr && pChkStr->Equals( rNm ) )
+/*?*/ pChkStr = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( !pChkStr )
+/*N*/ {
+/*?*/ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+/*?*/ nNum = pSectionFmtTbl->Count();
+/*?*/ for( n = 0; n < nFlagSize; ++n )
+/*?*/ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+/*?*/ {
+/*?*/ // also die Nummer bestimmen
+/*?*/ nNum = n * 8;
+/*?*/ while( nTmp & 1 )
+/*?*/ ++nNum, nTmp >>= 1;
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*N*/ }
+/*N*/ delete [] pSetFlags;
+/*N*/ if( pChkStr )
+/*N*/ return *pChkStr;
+/*?*/ return aName += String::CreateFromInt32( ++nNum );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndtbl.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndtbl.cxx
new file mode 100644
index 000000000000..a4a40b52e65b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndtbl.cxx
@@ -0,0 +1,920 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#ifdef WTC
+#define private public
+#endif
+
+#include <hintids.hxx>
+
+
+#include <bf_svx/lrspitem.hxx>
+
+#include <fmtfsize.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <fmtfordr.hxx>
+#include <fmtlsplt.hxx>
+
+#include <doc.hxx>
+#include <cntfrm.hxx>
+#include <hints.hxx>
+#include <poolfmt.hxx>
+#include <tabfrm.hxx>
+#include <tblafmt.hxx>
+#include <cellatr.hxx>
+#include <swtblfmt.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <tblrwcl.hxx>
+#include <editsh.hxx>
+
+#include <node2lay.hxx>
+
+#include <comcore.hrc>
+
+#include "docsh.hxx"
+
+#ifdef _MSAVE_HXX
+#endif
+
+#ifdef LINUX
+#endif
+
+#include <ndtxt.hxx>
+namespace binfilter {
+
+const sal_Unicode T2T_PARA = 0x0a;
+
+
+// steht im gctable.cxx
+
+
+/*N*/ void lcl_SetDfltBoxAttr( SwFrmFmt& rFmt, BYTE nId )
+/*N*/ {
+/*N*/ BOOL bTop = FALSE, bBottom = FALSE, bLeft = FALSE, bRight = FALSE;
+/*N*/ switch ( nId )
+/*N*/ {
+/*?*/ case 0: bTop = bBottom = bLeft = TRUE; break;
+/*N*/ case 1: bTop = bBottom = bLeft = bRight = TRUE; break;
+/*?*/ case 2: bBottom = bLeft = TRUE; break;
+/*?*/ case 3: bBottom = bLeft = bRight = TRUE; break;
+/*N*/ }
+/*N*/
+/*N*/ const BOOL bHTML = rFmt.GetDoc()->IsHTMLMode();
+/*N*/ Color aCol( bHTML ? COL_GRAY : COL_BLACK );
+/*N*/ SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
+/*N*/ if ( bHTML )
+/*N*/ {
+/*?*/ aLine.SetOutWidth( DEF_DOUBLE_LINE7_OUT );
+/*?*/ aLine.SetInWidth ( DEF_DOUBLE_LINE7_IN );
+/*?*/ aLine.SetDistance( DEF_DOUBLE_LINE7_DIST);
+/*N*/ }
+/*N*/ SvxBoxItem aBox; aBox.SetDistance( 55 );
+/*N*/ if ( bTop )
+/*N*/ aBox.SetLine( &aLine, BOX_LINE_TOP );
+/*N*/ if ( bBottom )
+/*N*/ aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
+/*N*/ if ( bLeft )
+/*N*/ aBox.SetLine( &aLine, BOX_LINE_LEFT );
+/*N*/ if ( bRight )
+/*N*/ aBox.SetLine( &aLine, BOX_LINE_RIGHT );
+/*N*/ rFmt.SetAttr( aBox );
+/*N*/ }
+
+
+/* --> #109161# */
+static bool lcl_IsItemSet(const SwCntntNode & rNode, USHORT which)
+{
+ bool bResult = false;
+
+ if (SFX_ITEM_SET == rNode.GetSwAttrSet().GetItemState(which))
+ bResult = true;
+
+ return bResult;
+}
+
+/* <-- #109161# */
+
+/*N*/ SwTableBoxFmt *lcl_CreateDfltBoxFmt( SwDoc &rDoc, SvPtrarr &rBoxFmtArr,
+/*N*/ USHORT nCols, BYTE nId )
+/*N*/ {
+/*N*/ if ( !rBoxFmtArr[nId] )
+/*N*/ {
+/*N*/ SwTableBoxFmt* pBoxFmt = rDoc.MakeTableBoxFmt();
+/*N*/ if( USHRT_MAX != nCols )
+/*N*/ pBoxFmt->SetAttr( SwFmtFrmSize( ATT_VAR_SIZE,
+/*N*/ USHRT_MAX / nCols, 0 ));
+/*N*/ ::binfilter::lcl_SetDfltBoxAttr( *pBoxFmt, nId );
+/*N*/ rBoxFmtArr.Replace( pBoxFmt, nId );
+/*N*/ }
+/*N*/ return (SwTableBoxFmt*)rBoxFmtArr[nId];
+/*N*/ }
+
+
+/*N*/ SwTableNode* SwDoc::IsIdxInTbl(const SwNodeIndex& rIdx)
+/*N*/ {
+/*N*/ SwTableNode* pTableNd = 0;
+/*N*/ ULONG nIndex = rIdx.GetIndex();
+/*N*/ do {
+/*N*/ SwNode* pNd = (SwNode*)GetNodes()[ nIndex ]->StartOfSectionNode();
+/*N*/ if( 0 != ( pTableNd = pNd->GetTableNode() ) )
+/*?*/ break;
+/*N*/
+/*N*/ nIndex = pNd->GetIndex();
+/*N*/ } while ( nIndex );
+/*N*/ return pTableNd;
+/*N*/ }
+
+
+// --------------- einfuegen einer neuen Box --------------
+
+ // fuege in der Line, vor der InsPos eine neue Box ein.
+
+ BOOL SwNodes::InsBoxen( SwTableNode* pTblNd,
+ SwTableLine* pLine,
+ SwTableBoxFmt* pBoxFmt,
+ SwTxtFmtColl* pTxtColl,
+ SwAttrSet* pAutoAttr,
+ USHORT nInsPos,
+ USHORT nCnt )
+ {
+ if( !nCnt )
+ return FALSE;
+ ASSERT( pLine, "keine gueltige Zeile" );
+
+ // Index hinter die letzte Box der Line
+ ULONG nIdxPos;
+ SwTableBox *pPrvBox = 0, *pNxtBox = 0;
+ if( pLine->GetTabBoxes().Count() )
+ {
+ if( nInsPos < pLine->GetTabBoxes().Count() )
+ {
+ if( 0 == (pPrvBox = pLine->FindPreviousBox( pTblNd->GetTable(),
+ pLine->GetTabBoxes()[ nInsPos ] )))
+ pPrvBox = pLine->FindPreviousBox( pTblNd->GetTable() );
+ }
+ else if( 0 == ( pNxtBox = pLine->FindNextBox( pTblNd->GetTable(),
+ pLine->GetTabBoxes()[ nInsPos-1 ] )))
+ pNxtBox = pLine->FindNextBox( pTblNd->GetTable() );
+ }
+ else if( 0 == ( pNxtBox = pLine->FindNextBox( pTblNd->GetTable() )))
+ pPrvBox = pLine->FindPreviousBox( pTblNd->GetTable() );
+
+ if( !pPrvBox && !pNxtBox )
+ {
+ BOOL bSetIdxPos = TRUE;
+ if( pTblNd->GetTable().GetTabLines().Count() && !nInsPos )
+ {
+ const SwTableLine* pTblLn = pLine;
+ while( pTblLn->GetUpper() )
+ pTblLn = pTblLn->GetUpper()->GetUpper();
+
+ if( pTblNd->GetTable().GetTabLines()[ 0 ] == pTblLn )
+ {
+ // also vor die erste Box der Tabelle
+ while( ( pNxtBox = pLine->GetTabBoxes()[0])->GetTabLines().Count() )
+ pLine = pNxtBox->GetTabLines()[0];
+ nIdxPos = pNxtBox->GetSttIdx();
+ bSetIdxPos = FALSE;
+ }
+ }
+ if( bSetIdxPos )
+ // Tabelle ohne irgendeinen Inhalt oder am Ende, also vors Ende
+ nIdxPos = pTblNd->EndOfSectionIndex();
+ }
+ else if( pNxtBox ) // es gibt einen Nachfolger
+ nIdxPos = pNxtBox->GetSttIdx();
+ else // es gibt einen Vorgaenger
+ nIdxPos = pPrvBox->GetSttNd()->EndOfSectionIndex() + 1;
+
+ SwNodeIndex aEndIdx( *this, nIdxPos );
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ SwStartNode* pSttNd = new SwStartNode( aEndIdx, ND_STARTNODE,
+ SwTableBoxStartNode );
+ pSttNd->pStartOfSection = pTblNd;
+ SwEndNode* pEndNd = new SwEndNode( aEndIdx, *pSttNd );
+
+ pPrvBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
+
+ SwTableBoxes & rTabBoxes = pLine->GetTabBoxes();
+ USHORT nRealInsPos = nInsPos + n;
+ if (nRealInsPos > rTabBoxes.Count())
+ nRealInsPos = rTabBoxes.Count();
+
+ rTabBoxes.C40_INSERT( SwTableBox, pPrvBox, nRealInsPos );
+
+ if( NO_NUMBERING == pTxtColl->GetOutlineLevel()
+ //FEATURE::CONDCOLL
+ && RES_CONDTXTFMTCOLL != pTxtColl->Which()
+ //FEATURE::CONDCOLL
+ )
+ new SwTxtNode( SwNodeIndex( *pSttNd->EndOfSectionNode() ),
+ pTxtColl, pAutoAttr );
+ else
+ {
+ // Outline-Numerierung richtig behandeln !!!
+ SwTxtNode* pTNd = new SwTxtNode(
+ SwNodeIndex( *pSttNd->EndOfSectionNode() ),
+ (SwTxtFmtColl*)GetDoc()->GetDfltTxtFmtColl(),
+ pAutoAttr );
+ pTNd->ChgFmtColl( pTxtColl );
+ }
+ }
+ return TRUE;
+ }
+
+// --------------- einfuegen einer neuen Tabelle --------------
+
+/*N*/ const SwTable* SwDoc::InsertTable( const SwPosition& rPos, USHORT nRows,
+/*N*/ USHORT nCols, SwHoriOrient eAdjust,
+/*N*/ USHORT nInsTblFlags,
+/*N*/ const SwTableAutoFmt* pTAFmt,
+/*N*/ const SvUShorts* pColArr,
+/*N*/ BOOL bCalledFromShell )
+/*N*/ {
+/*N*/ ASSERT( nRows, "Tabelle ohne Zeile?" );
+/*N*/ ASSERT( nCols, "Tabelle ohne Spalten?" );
+/*N*/
+/*N*/ {
+/*N*/ // nicht in Fussnoten kopieren !!
+/*N*/ if( rPos.nNode < GetNodes().GetEndOfInserts().GetIndex() &&
+/*N*/ rPos.nNode >= GetNodes().GetEndOfInserts().StartOfSectionIndex() )
+/*?*/ return 0;
+/*N*/
+/*N*/ // sollte das ColumnArray die falsche Anzahl haben wird es ignoriert!
+/*N*/ if( pColArr &&
+/*N*/ (nCols + ( HORI_NONE == eAdjust ? 2 : 1 )) != pColArr->Count() )
+/*?*/ pColArr = 0;
+/*N*/ }
+/*N*/
+/*N*/ // fuege erstmal die Nodes ein
+/*N*/ // hole das Auto-Format fuer die Tabelle
+/*N*/ SwTxtFmtColl *pBodyColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE ),
+/*N*/ *pHeadColl = pBodyColl;
+/*N*/
+/*N*/ BOOL bDfltBorders = nInsTblFlags & DEFAULT_BORDER;
+/*N*/
+/*N*/ if( (nInsTblFlags & HEADLINE) && (1 != nRows || !bDfltBorders) )
+/*?*/ pHeadColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN );
+/*N*/
+/*N*/ /* #106283# Save content node to extract FRAMEDIR from. */
+/*N*/ const SwCntntNode * pCntntNd = rPos.nNode.GetNode().GetCntntNode();
+/*N*/
+ /* #109161# If we are called from a shell pass the attrset from
+ pCntntNd (aka the node the table is inserted at) thus causing
+ SwNodes::InsertTable to propagate an adjust item if
+ necessary. */
+/*N*/ SwTableNode *pTblNd = GetNodes().InsertTable
+/*N*/ ( rPos.nNode, nCols, pBodyColl, nRows, pHeadColl,
+/*N*/ bCalledFromShell ? &pCntntNd->GetSwAttrSet() : 0 );
+/*N*/
+/*N*/ // dann erstelle die Box/Line/Table-Struktur
+/*N*/ SwTableLineFmt* pLineFmt = MakeTableLineFmt();
+/*N*/ SwTableFmt* pTableFmt = MakeTblFrmFmt( GetUniqueTblName(), GetDfltFrmFmt() );
+/*N*/
+ /* #106283# If the node to insert the table at is a context node and has a
+ non-default FRAMEDIR propagate it to the table. */
+/*N*/ if (pCntntNd)
+/*N*/ {
+/*N*/ const SwAttrSet & aNdSet = pCntntNd->GetSwAttrSet();
+/*N*/ const SfxPoolItem *pItem = NULL;
+/*N*/
+/*N*/ if (SFX_ITEM_SET == aNdSet.GetItemState( RES_FRAMEDIR, TRUE, &pItem )
+/*N*/ && pItem != NULL)
+/*N*/ {
+/*N*/ pTableFmt->SetAttr( *pItem );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Orientation am Fmt der Table setzen
+/*N*/ pTableFmt->SetAttr( SwFmtHoriOrient( 0, eAdjust ) );
+/*N*/ // alle Zeilen haben die Fill-Order von links nach rechts !
+/*N*/ pLineFmt->SetAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ));
+/*N*/
+/*N*/ // die Tabelle bekommt USHRT_MAX als default SSize
+/*N*/ SwTwips nWidth = USHRT_MAX;
+/*N*/ if( pColArr )
+/*N*/ {
+/*?*/ USHORT nSttPos = (*pColArr)[ 0 ];
+/*?*/ USHORT nLastPos = (*pColArr)[ USHORT(pColArr->Count()-1)];
+/*?*/ if( HORI_NONE == eAdjust )
+/*?*/ {
+/*?*/ USHORT nFrmWidth = nLastPos;
+/*?*/ nLastPos = (*pColArr)[ USHORT(pColArr->Count()-2)];
+/*?*/ pTableFmt->SetAttr( SvxLRSpaceItem( nSttPos, nFrmWidth - nLastPos ) );
+/*?*/ }
+/*?*/ nWidth = nLastPos - nSttPos;
+/*N*/ }
+/*N*/ pTableFmt->SetAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth ));
+/*N*/ if( !(nInsTblFlags & SPLIT_LAYOUT) )
+/*?*/ pTableFmt->SetAttr( SwFmtLayoutSplit( FALSE ));
+/*N*/
+/*N*/ // verschiebe ggfs. die harten PageDesc/PageBreak Attribute:
+/*N*/ SwCntntNode* pNextNd = GetNodes()[ pTblNd->EndOfSectionIndex()+1 ]
+/*N*/ ->GetCntntNode();
+/*N*/ if( pNextNd && pNextNd->GetpSwAttrSet() )
+/*N*/ {
+/*?*/ SwAttrSet* pNdSet = pNextNd->GetpSwAttrSet();
+/*?*/ const SfxPoolItem *pItem;
+/*?*/ if( SFX_ITEM_SET == pNdSet->GetItemState( RES_PAGEDESC, FALSE,
+/*?*/ &pItem ) )
+/*?*/ {
+/*?*/ pTableFmt->SetAttr( *pItem );
+/*?*/ pNextNd->ResetAttr( RES_PAGEDESC );
+/*?*/ pNdSet = pNextNd->GetpSwAttrSet();
+/*?*/ }
+/*?*/ if( pNdSet && SFX_ITEM_SET == pNdSet->GetItemState( RES_BREAK, FALSE,
+/*?*/ &pItem ) )
+/*?*/ {
+/*?*/ pTableFmt->SetAttr( *pItem );
+/*?*/ pNextNd->ResetAttr( RES_BREAK );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwTable * pNdTbl = &pTblNd->GetTable();
+/*N*/ pTableFmt->Add( pNdTbl ); // das Frame-Format setzen
+/*N*/
+/*N*/ pNdTbl->SetHeadlineRepeat( HEADLINE_REPEAT == (nInsTblFlags & HEADLINE_REPEAT) );
+/*N*/
+/*N*/ SvPtrarr aBoxFmtArr( 0, 16 );
+/*N*/ SwTableBoxFmt* pBoxFmt = 0;
+/*N*/ if( !bDfltBorders && !pTAFmt )
+/*N*/ {
+/*?*/ pBoxFmt = MakeTableBoxFmt();
+/*?*/ pBoxFmt->SetAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX / nCols, 0 ));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const USHORT nBoxArrLen = pTAFmt ? 16 : 4;
+/*N*/ for( USHORT i = 0; i < nBoxArrLen; ++i )
+/*N*/ aBoxFmtArr.Insert( (void*)0, i );
+/*N*/ }
+/*N*/ SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_PARATR_END-1 );
+/*N*/
+/*N*/ SwNodeIndex aNdIdx( *pTblNd, 1 ); // auf den ersten Box-StartNode
+/*N*/ SwTableLines& rLines = pNdTbl->GetTabLines();
+/*N*/ for( USHORT n = 0; n < nRows; ++n )
+/*N*/ {
+/*N*/ SwTableLine* pLine = new SwTableLine( pLineFmt, nCols, 0 );
+/*N*/ rLines.C40_INSERT( SwTableLine, pLine, n );
+/*N*/ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+/*N*/ for( USHORT i = 0; i < nCols; ++i )
+/*N*/ {
+/*N*/ SwTableBoxFmt *pBoxF;
+/*N*/ if( pTAFmt )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 BYTE nId = !n ? 0 : (( n+1 == nRows )
+/*N*/ }
+/*N*/ else if( bDfltBorders )
+/*N*/ {
+/*N*/ BYTE nBoxId = (i < nCols - 1 ? 0 : 1) + (n ? 2 : 0 );
+/*N*/ pBoxF = ::binfilter::lcl_CreateDfltBoxFmt( *this, aBoxFmtArr, nCols, nBoxId);
+/*N*/ }
+/*N*/ else
+/*?*/ pBoxF = pBoxFmt;
+/*N*/
+/*N*/ // fuer AutoFormat bei der Eingabe: beim Einfuegen der Tabelle
+/*N*/ // werden gleich die Spalten gesetzt. Im Array stehen die
+/*N*/ // Positionen der Spalten!! (nicht deren Breite!)
+/*N*/ if( pColArr )
+/*N*/ {
+/*?*/ nWidth = (*pColArr)[ USHORT(i + 1) ] - (*pColArr)[ i ];
+/*?*/ if( pBoxF->GetFrmSize().GetWidth() != nWidth )
+/*?*/ {
+/*?*/ if( pBoxF->GetDepends() ) // neues Format erzeugen!
+/*?*/ {
+/*?*/ SwTableBoxFmt *pNewFmt = MakeTableBoxFmt();
+/*?*/ *pNewFmt = *pBoxF;
+/*?*/ pBoxF = pNewFmt;
+/*?*/ }
+/*?*/ pBoxF->SetAttr( SwFmtFrmSize( ATT_VAR_SIZE, nWidth ));
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwTableBox *pBox = new SwTableBox( pBoxF, aNdIdx, pLine);
+/*N*/ rBoxes.C40_INSERT( SwTableBox, pBox, i );
+/*N*/ aNdIdx += 3; // StartNode, TextNode, EndNode == 3 Nodes
+/*N*/ }
+/*N*/ }
+/*N*/ // und Frms einfuegen.
+/*N*/ GetNodes().GoNext( &aNdIdx ); // zum naechsten ContentNode
+/*N*/ pTblNd->MakeFrms( &aNdIdx );
+/*N*/
+/*N*/ if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwPaM aPam( *pTblNd->EndOfSectionNode(), *pTblNd, 1 );
+/*N*/ }
+/*N*/
+/*N*/ SetModified();
+/*N*/ return pNdTbl;
+/*N*/ }
+
+/*N*/ SwTableNode* SwNodes::InsertTable( const SwNodeIndex& rNdIdx,
+/*N*/ USHORT nBoxes,
+/*N*/ SwTxtFmtColl* pCntntTxtColl,
+/*N*/ USHORT nLines,
+/*N*/ SwTxtFmtColl* pHeadlineTxtColl,
+/*N*/ const SwAttrSet * pAttrSet)
+/*N*/ {
+/*N*/ if( !nBoxes )
+/*?*/ return 0;
+/*N*/
+/*N*/ // wenn Lines angegeben, erzeuge die Matrix aus Lines & Boxen
+/*N*/ if( !pHeadlineTxtColl || !nLines )
+/*N*/ pHeadlineTxtColl = pCntntTxtColl;
+/*N*/
+/*N*/ SwTableNode * pTblNd = new SwTableNode( rNdIdx );
+/*N*/ SwEndNode* pEndNd = new SwEndNode( rNdIdx, *pTblNd );
+/*N*/
+/*N*/ if( !nLines ) // fuer die FOR-Schleife
+/*N*/ ++nLines;
+/*N*/
+/*N*/ SwNodeIndex aIdx( *pEndNd );
+/*N*/ register SwTxtFmtColl* pTxtColl = pHeadlineTxtColl;
+/*N*/ for( register USHORT nL = 0; nL < nLines; ++nL )
+/*N*/ {
+/*N*/ for( register USHORT nB = 0; nB < nBoxes; ++nB )
+/*N*/ {
+/*N*/ SwStartNode* pSttNd = new SwStartNode( aIdx, ND_STARTNODE,
+/*N*/ SwTableBoxStartNode );
+/*N*/ pSttNd->pStartOfSection = pTblNd;
+
+ /** #109161# If there is no adjust item in pTxtColl
+ propagate any existing adjust item in pAttrSet to the
+ newly created context node in the new cell.
+ */
+/*N*/ SwTxtNode * pTmpNd = new SwTxtNode( aIdx, pTxtColl );
+/*N*/
+/*N*/ const SfxPoolItem * pItem = NULL;
+/*N*/
+/*N*/ if (! lcl_IsItemSet(*pTmpNd, RES_PARATR_ADJUST) &&
+/*N*/ pAttrSet != NULL &&
+/*N*/ SFX_ITEM_SET == pAttrSet->GetItemState( RES_PARATR_ADJUST, TRUE,
+/*N*/ &pItem)
+/*N*/ )
+/*N*/ {
+/*N*/ static_cast<SwCntntNode *>(pTmpNd)->SetAttr(*pItem);
+/*N*/ }
+/*N*/
+/*N*/ new SwEndNode( aIdx, *pSttNd );
+/*N*/ }
+/*N*/ pTxtColl = pCntntTxtColl;
+/*N*/ }
+/*N*/ return pTblNd;
+/*N*/ }
+
+
+//---------------- Text -> Tabelle -----------------------
+
+
+
+//---------------- Tabelle -> Text -----------------------
+
+
+
+// -- benutze die ForEach Methode vom PtrArray um aus einer Tabelle wieder
+// Text zuerzeugen. (Die Boxen koennen auch noch Lines enthalten !!)
+
+// forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen
+// koennen.
+
+
+
+
+
+
+
+// ----- einfuegen von Spalten/Zeilen ------------------------
+
+
+
+
+
+// ----- loeschen von Spalten/Zeilen ------------------------
+
+
+
+
+
+// ---------- teilen / zusammenfassen von Boxen in der Tabelle --------
+
+/*N*/ BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt,
+/*N*/ sal_Bool bSameHeight )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+
+
+
+
+// -------------------------------------------------------
+
+//---------
+// SwTableNode
+//---------
+
+/*N*/ SwTableNode::SwTableNode( const SwNodeIndex& rIdx )
+/*N*/ : SwStartNode( rIdx, ND_TABLENODE )
+/*N*/ {
+/*N*/ pTable = new SwTable( 0 );
+/*N*/ }
+
+/*M*/ SwTableNode::~SwTableNode()
+/*M*/ {
+/*M*/ //don't forget to notify uno wrappers
+/*M*/ SwFrmFmt* pTblFmt = GetTable().GetFrmFmt();
+/*M*/ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
+/*M*/ pTblFmt );
+/*M*/ pTblFmt->Modify( &aMsgHint, &aMsgHint );
+/*M*/ DelFrms();
+/*M*/ delete pTable;
+/*M*/ }
+
+/*N*/ SwTabFrm *SwTableNode::MakeFrm()
+/*N*/ {
+/*N*/ return new SwTabFrm( *pTable );
+/*N*/ }
+
+//Fuer jede Shell einen TblFrm anlegen und vor den entsprechenden
+//CntntFrm pasten.
+
+/*N*/ void SwTableNode::MakeFrms( SwNodeIndex* pIdxBehind )
+/*N*/ {
+/*N*/ ASSERT( pIdxBehind, "kein Index" );
+/*N*/ *pIdxBehind = *this;
+/*N*/ SwNode *pNd = GetNodes().FindPrvNxtFrmNode( *pIdxBehind, EndOfSectionNode() );
+/*N*/ if( !pNd )
+/*N*/ return ;
+/*N*/
+/*N*/ // liegt der gefundene ContentNode vor oder hinter der Tabelle ?
+/*N*/ BOOL bBehind = EndOfSectionIndex() < pIdxBehind->GetIndex();
+/*N*/
+/*N*/ SwFrm *pFrm, *pNew;
+/*N*/
+/*N*/ SwNode2Layout aNode2Layout( *pNd, GetIndex() );
+/*N*/ while( 0 != (pFrm = aNode2Layout.NextFrm()) )
+/*N*/ {
+/*N*/ pNew = MakeFrm();
+/*N*/ pNew->Paste( pFrm->GetUpper(), bBehind ? pFrm : pFrm->GetNext() );
+/*N*/ ((SwTabFrm*)pNew)->RegistFlys();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwTableNode::DelFrms()
+/*N*/ {
+/*N*/ //Erstmal die TabFrms ausschneiden und deleten, die Columns und Rows
+/*N*/ //nehmen sie mit in's Grab.
+/*N*/ //Die TabFrms haengen am FrmFmt des SwTable.
+/*N*/ //Sie muessen etwas umstaendlich zerstort werden, damit die Master
+/*N*/ //die Follows mit in's Grab nehmen.
+/*N*/
+/*N*/ SwClientIter aIter( *(pTable->GetFrmFmt()) );
+/*N*/ SwClient *pLast = aIter.GoStart();
+/*N*/ while ( pLast )
+/*N*/ {
+/*N*/ BOOL bAgain = FALSE;
+/*N*/ if ( pLast->IsA( TYPE(SwFrm) ) )
+/*N*/ {
+/*N*/ SwTabFrm *pFrm = (SwTabFrm*)pLast;
+/*N*/ if ( !pFrm->IsFollow() )
+/*N*/ {
+/*N*/ while ( pFrm->HasFollow() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pFrm->JoinAndDelFollows();
+/*N*/ pFrm->Cut();
+/*N*/ delete pFrm;
+/*N*/ bAgain = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ pLast = bAgain ? aIter.GoStart() : aIter++;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwTableNode::SetNewTable( SwTable* pNewTable, BOOL bNewFrames )
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 DelFrms();
+/*N*/ }
+
+ // setze das TabelleAttribut Undo auf:
+
+
+
+/* -----------------18.07.98 11:45-------------------
+ * Direktzugriff fuer UNO
+ * --------------------------------------------------*/
+
+void SwCollectTblLineBoxes::AddBox( const SwTableBox& rBox )
+{
+ aPosArr.Insert( nWidth, aPosArr.Count() );
+ SwTableBox* p = (SwTableBox*)&rBox;
+ aBoxes.Insert( p, aBoxes.Count() );
+ nWidth += (USHORT)rBox.GetFrmFmt()->GetFrmSize().GetWidth();
+}
+
+const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
+{
+ const SwTableBox* pRet = 0;
+ if( aPosArr.Count() )
+ {
+ USHORT n;
+ for( n = 0; n < aPosArr.Count(); ++n )
+ if( aPosArr[ n ] == nWidth )
+ break;
+ else if( aPosArr[ n ] > nWidth )
+ {
+ if( n )
+ --n;
+ break;
+ }
+
+ if( n >= aPosArr.Count() )
+ --n;
+
+ nWidth += (USHORT)rBox.GetFrmFmt()->GetFrmSize().GetWidth();
+ pRet = aBoxes[ n ];
+ }
+ return pRet;
+}
+
+BOOL lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara )
+{
+ SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara;
+ if( pSplPara->IsGetValues() )
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &::binfilter::lcl_Box_CollectBox, pPara );
+ else
+ ((SwTableLine*)rpLine)->GetTabBoxes().ForEach( &::binfilter::lcl_BoxSetSplitBoxFmts, pPara );
+ return TRUE;
+}
+
+BOOL lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara )
+{
+ SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara;
+ USHORT nLen = rpBox->GetTabLines().Count();
+ if( nLen )
+ {
+ // dann mit der richtigen Line weitermachen
+ if( pSplPara->IsGetFromTop() )
+ nLen = 0;
+ else
+ --nLen;
+
+ const SwTableLine* pLn = rpBox->GetTabLines()[ nLen ];
+ lcl_Line_CollectBox( pLn, pPara );
+ }
+ else
+ pSplPara->AddBox( *rpBox );
+ return TRUE;
+}
+
+BOOL lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara )
+{
+ SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara;
+ USHORT nLen = rpBox->GetTabLines().Count();
+ if( nLen )
+ {
+ // dann mit der richtigen Line weitermachen
+ if( pSplPara->IsGetFromTop() )
+ nLen = 0;
+ else
+ --nLen;
+
+ const SwTableLine* pLn = rpBox->GetTabLines()[ nLen ];
+ lcl_Line_CollectBox( pLn, pPara );
+ }
+ else
+ {
+ const SwTableBox* pSrcBox = pSplPara->GetBoxOfPos( *rpBox );
+ SwFrmFmt* pFmt = pSrcBox->GetFrmFmt();
+ SwTableBox* pBox = (SwTableBox*)rpBox;
+
+ if( HEADLINE_BORDERCOPY == pSplPara->GetMode() )
+ {
+ const SvxBoxItem& rBoxItem = pBox->GetFrmFmt()->GetBox();
+ if( !rBoxItem.GetTop() )
+ {
+ SvxBoxItem aNew( rBoxItem );
+ aNew.SetLine( pFmt->GetBox().GetBottom(), BOX_LINE_TOP );
+ if( aNew != rBoxItem )
+ pBox->ClaimFrmFmt()->SetAttr( aNew );
+ }
+ }
+ else
+ {
+USHORT __FAR_DATA aTableSplitBoxSetRange[] = {
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ 0 };
+ SfxItemSet aTmpSet( pFmt->GetDoc()->GetAttrPool(),
+ aTableSplitBoxSetRange );
+ aTmpSet.Put( pFmt->GetAttrSet() );
+ if( aTmpSet.Count() )
+ pBox->ClaimFrmFmt()->SetAttr( aTmpSet );
+
+ if( HEADLINE_BOXATRCOLLCOPY == pSplPara->GetMode() )
+ {
+ SwNodeIndex aIdx( *pSrcBox->GetSttNd(), 1 );
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+ if( !pCNd )
+ pCNd = aIdx.GetNodes().GoNext( &aIdx );
+ aIdx = *pBox->GetSttNd();
+ SwCntntNode* pDNd = aIdx.GetNodes().GoNext( &aIdx );
+
+ // nur wenn der Node alleine in der Section steht
+ if( 2 == pDNd->EndOfSectionIndex() -
+ pDNd->StartOfSectionIndex() )
+ {
+ pDNd->ChgFmtColl( pCNd->GetFmtColl() );
+ }
+ }
+
+ // bedingte Vorlage beachten
+ pBox->GetSttNd()->CheckSectionCondColl();
+ }
+ }
+ return TRUE;
+}
+
+
+
+// und die Umkehrung davon. rPos muss in der Tabelle stehen, die bestehen
+// bleibt. Das Flag besagt ob die aktuelle mit der davor oder dahinter
+// stehenden vereint wird.
+
+
+// -------------------------------------------------------------------
+
+
+// -- benutze die ForEach Methode vom PtrArray
+
+// forward deklarieren damit sich die Lines und Boxen rekursiv aufrufen
+// koennen.
+
+
+
+
+ // AutoFormat fuer die Tabelle/TabellenSelection
+
+
+ // Erfrage wie attributiert ist
+
+/*N*/ String SwDoc::GetUniqueTblName() const
+/*N*/ {
+/*N*/ ResId aId( STR_TABLE_DEFNAME, *pSwResMgr );
+/*N*/ String aName( aId );
+/*N*/ xub_StrLen nNmLen = aName.Len();
+/*N*/
+/*N*/ USHORT nNum, nTmp, nFlagSize = ( pTblFrmFmtTbl->Count() / 8 ) +2;
+/*N*/ BYTE* pSetFlags = new BYTE[ nFlagSize ];
+/*N*/ memset( pSetFlags, 0, nFlagSize );
+/*N*/
+ USHORT n=0;
+/*N*/ for( n = 0; n < pTblFrmFmtTbl->Count(); ++n )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = (*pTblFrmFmtTbl)[ n ];
+/*N*/ if( !pFmt->IsDefault() && IsUsed( *pFmt ) &&
+/*N*/ pFmt->GetName().Match( aName ) == nNmLen )
+/*N*/ {
+/*N*/ // Nummer bestimmen und das Flag setzen
+/*N*/ nNum = pFmt->GetName().Copy( nNmLen ).ToInt32();
+/*N*/ if( nNum-- && nNum < pTblFrmFmtTbl->Count() )
+/*N*/ pSetFlags[ nNum / 8 ] |= (0x01 << ( nNum & 0x07 ));
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+/*N*/ nNum = pTblFrmFmtTbl->Count();
+/*N*/ for( n = 0; n < nFlagSize; ++n )
+/*N*/ if( 0xff != ( nTmp = pSetFlags[ n ] ))
+/*N*/ {
+/*N*/ // also die Nummer bestimmen
+/*N*/ nNum = n * 8;
+/*N*/ while( nTmp & 1 )
+/*N*/ ++nNum, nTmp >>= 1;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ delete [] pSetFlags;
+/*N*/ return aName += String::CreateFromInt32( ++nNum );
+/*N*/ }
+
+/*N*/ SwTableFmt* SwDoc::FindTblFmtByName( const String& rName, BOOL bAll ) const
+/*N*/ {
+/*N*/ const SwFmt* pRet = 0;
+/*N*/ if( bAll )
+/*?*/ pRet = FindFmtByName( (SvPtrarr&)*pTblFrmFmtTbl, rName );
+/*N*/ else
+/*N*/ {
+/*N*/ // dann nur die, die im Doc gesetzt sind
+/*N*/ for( USHORT n = 0; n < pTblFrmFmtTbl->Count(); ++n )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = (*pTblFrmFmtTbl)[ n ];
+/*N*/ if( !pFmt->IsDefault() && IsUsed( *pFmt ) &&
+/*N*/ pFmt->GetName() == rName )
+/*N*/ {
+/*?*/ pRet = pFmt;
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return (SwTableFmt*)pRet;
+/*N*/ }
+
+
+
+
+
+/*N*/ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode )
+/*N*/ {
+/*N*/ SwStartNode* pSttNd;
+/*N*/ if( 0 != ( pSttNd = GetNodes()[ rNode ]->
+/*N*/ FindSttNodeByType( SwTableBoxStartNode )) &&
+/*N*/ 2 == pSttNd->EndOfSectionIndex() - pSttNd->GetIndex() )
+/*N*/ {
+/*N*/ SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
+/*N*/ GetTblBox( pSttNd->GetIndex() );
+/*N*/
+/*N*/ const SfxPoolItem* pFmtItem = 0;
+/*N*/ const SfxItemSet& rSet = pBox->GetFrmFmt()->GetAttrSet();
+/*N*/ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, FALSE, &pFmtItem ) ||
+/*N*/ SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA, FALSE ) ||
+/*N*/ SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE, FALSE ))
+/*N*/ {
+/*?*/ SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt();
+/*?*/
+/*?*/ //JP 01.09.97: TextFormate bleiben erhalten!
+/*?*/ USHORT nWhich1 = RES_BOXATR_FORMAT;
+/*?*/ if( pFmtItem && GetNumberFormatter()->IsTextFormat(
+/*?*/ ((SwTblBoxNumFormat*)pFmtItem)->GetValue() ))
+/*?*/ nWhich1 = RES_BOXATR_FORMULA;
+/*?*/ else
+/*?*/ // JP 15.01.99: Nur Attribute zuruecksetzen reicht nicht.
+/*?*/ // Sorge dafuer, das der Text auch entsprechend
+/*?*/ // formatiert wird!
+/*?*/ pBoxFmt->SetAttr( *GetDfltAttr( RES_BOXATR_FORMAT ));
+/*?*/
+/*?*/ pBoxFmt->ResetAttr( nWhich1, RES_BOXATR_VALUE );
+/*?*/ SetModified();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+// kopiert eine Tabelle aus dem selben oder einem anderen Doc in sich
+// selbst. Dabei wird eine neue Tabelle angelegt oder eine bestehende
+// mit dem Inhalt gefuellt; wobei entweder der Inhalt ab einer Box oder
+// in eine bestehende TblSelektion gefuellt wird.
+// Gerufen wird es von: edglss.cxx/fecopy.cxx
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_ndtbl1.cxx b/binfilter/bf_sw/source/core/docnode/sw_ndtbl1.cxx
new file mode 100644
index 000000000000..8e9bd7c03747
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_ndtbl1.cxx
@@ -0,0 +1,407 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#ifdef WTC
+#define private public
+#endif
+
+#include "hintids.hxx"
+
+#include <bf_svx/boxitem.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <frmatr.hxx>
+#include <cellfrm.hxx>
+#include <tabfrm.hxx>
+#include <txtfrm.hxx>
+
+#include "doc.hxx"
+#include "viscrs.hxx"
+#include "swtblfmt.hxx"
+namespace binfilter {
+
+
+extern void ClearFEShellTabCols();
+
+//siehe auch swtable.cxx
+#define COLFUZZY 20L
+
+
+
+
+
+
+
+/*N*/ void lcl_GetStartEndCell( const SwCursor& rCrsr,
+/*N*/ SwLayoutFrm *&prStart, SwLayoutFrm *&prEnd )
+/*N*/ {
+/*N*/ ASSERT( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ),
+/*N*/ "Tabselection nicht auf Cnt." );
+/*N*/
+/*N*/ Point aPtPos, aMkPos;
+/*N*/ const SwShellCrsr* pShCrsr = rCrsr;
+/*N*/ if( pShCrsr )
+/*N*/ {
+/*N*/ aPtPos = pShCrsr->GetPtPos();
+/*N*/ aMkPos = pShCrsr->GetMkPos();
+/*N*/ }
+/*N*/
+/*N*/ prStart = rCrsr.GetCntntNode()->GetFrm( &aPtPos )->GetUpper();
+/*N*/ prEnd = rCrsr.GetCntntNode(FALSE)->GetFrm( &aMkPos )->GetUpper();
+/*N*/ }
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : SetRowHeight(), GetRowHeight()
+#* Datum : MA 17. May. 93
+#* Update : JP 28.04.98
+#***********************************************************************/
+//Die Zeilenhoehe wird ausgehend von der Selektion ermittelt/gesetzt.
+//Ausgehend von jeder Zelle innerhalb der Selektion werden nach oben alle
+//Zeilen abgeklappert, die oberste Zeile erhaelt den gewuenschten Wert alle
+//tieferliegenden Zeilen einen entsprechenden Wert der sich aus der
+//Relation der alten und neuen Groesse der obersten Zeile und ihrer
+//eigenen Groesse ergiebt.
+//Alle veraenderten Zeilen erhalten ggf. ein eigenes FrmFmt.
+//Natuerlich darf jede Zeile nur einmal angefasst werden.
+
+/*N*/ inline void InsertLine( SvPtrarr& rLineArr, SwTableLine* pLine )
+/*N*/ {
+/*N*/ if( USHRT_MAX == rLineArr.GetPos( (void*&)pLine ) )
+/*N*/ rLineArr.Insert( (void*&)pLine, rLineArr.Count() );
+/*N*/ }
+
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+
+/*N*/ struct LinesAndTable
+/*N*/ {
+/*N*/ SvPtrarr &rLines;
+/*N*/ const SwTable &rTable;
+/*N*/ BOOL bInsertLines;
+/*N*/
+/*N*/ LinesAndTable( SvPtrarr &rL, const SwTable &rTbl ) :
+/*N*/ rLines( rL ), rTable( rTbl ), bInsertLines( TRUE ) {}
+/*N*/ };
+
+
+/*N*/ BOOL _FindLine( const _FndLine*& rpLine, void* pPara );
+
+/*N*/ BOOL _FindBox( const _FndBox*& rpBox, void* pPara )
+/*N*/ {
+/*N*/ if ( rpBox->GetLines().Count() )
+/*N*/ {
+/*N*/ ((LinesAndTable*)pPara)->bInsertLines = TRUE;
+/*N*/ ((_FndBox*)rpBox)->GetLines().ForEach( _FindLine, pPara );
+/*N*/ if ( ((LinesAndTable*)pPara)->bInsertLines )
+/*N*/ {
+/*N*/ const SwTableLines &rLines = rpBox->GetBox()
+/*N*/ ? rpBox->GetBox()->GetTabLines()
+/*N*/ : ((LinesAndTable*)pPara)->rTable.GetTabLines();
+/*N*/ if ( rpBox->GetLines().Count() == rLines.Count() )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < rLines.Count(); ++i )
+/*N*/ ::binfilter::InsertLine( ((LinesAndTable*)pPara)->rLines,
+/*N*/ (SwTableLine*)rLines[i] );
+/*N*/ }
+/*N*/ else
+/*N*/ ((LinesAndTable*)pPara)->bInsertLines = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( rpBox->GetBox() )
+/*N*/ ::binfilter::InsertLine( ((LinesAndTable*)pPara)->rLines,
+/*N*/ (SwTableLine*)rpBox->GetBox()->GetUpper() );
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL _FindLine( const _FndLine*& rpLine, void* pPara )
+/*N*/ {
+/*N*/ ((_FndLine*)rpLine)->GetBoxes().ForEach( _FindBox, pPara );
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methoden : SetTabBorders(), GetTabBorders()
+#* Datum : MA 18. May. 93
+#* Update : JP 29.04.98
+#***********************************************************************/
+/*N*/ inline void InsertCell( SvPtrarr& rCellArr, SwCellFrm* pCellFrm )
+/*N*/ {
+/*N*/ if( USHRT_MAX == rCellArr.GetPos( (void*&)pCellFrm ) )
+/*N*/ rCellArr.Insert( (void*&)pCellFrm, rCellArr.Count() );
+/*N*/ }
+
+//-----------------------------------------------------------------------------
+/*N*/ void lcl_CollectCells( SvPtrarr &rArr, const SwRect &rUnion,
+/*N*/ SwTabFrm *pTab )
+/*N*/ {
+/*N*/ SwLayoutFrm *pCell = pTab->FirstCell();
+/*N*/ do
+/*N*/ {
+/*N*/ // Wenn in der Zelle ein spaltiger Bereich sitzt, muessen wir
+/*N*/ // uns erst wieder zur Zelle hochhangeln
+/*N*/ while ( !pCell->IsCellFrm() )
+/*?*/ pCell = pCell->GetUpper();
+/*N*/ ASSERT( pCell, "Frame ist keine Zelle." );
+/*N*/ if ( rUnion.IsOver( pCell->Frm() ) )
+/*N*/ ::binfilter::InsertCell( rArr, (SwCellFrm*)pCell );
+/*N*/ //Dafuer sorgen, dass die Zelle auch verlassen wird (Bereiche)
+/*N*/ SwLayoutFrm *pTmp = pCell;
+/*N*/ do
+/*N*/ { pTmp = pTmp->GetNextLayoutLeaf();
+/*N*/ } while ( pCell->IsAnLower( pTmp ) );
+/*N*/ pCell = pTmp;
+/*N*/ } while( pCell && pTab->IsAnLower( pCell ) );
+/*N*/ }
+
+
+
+
+/*N*/ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
+/*N*/ {
+/*N*/ SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
+/*N*/ if( !pTblNd )
+/*?*/ return ;
+/*N*/
+/*N*/ SwLayoutFrm *pStart, *pEnd;
+/*N*/ ::binfilter::lcl_GetStartEndCell( rCursor, pStart, pEnd );
+/*N*/
+/*N*/ SwSelUnions aUnions;
+/*N*/ ::binfilter::MakeSelUnions( aUnions, pStart, pEnd );
+/*N*/
+/*N*/ if( aUnions.Count() )
+/*N*/ {
+/*N*/ SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX ));
+/*N*/ SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER));
+/*N*/
+/*N*/ BOOL bTopSet = FALSE,
+/*N*/ bBottomSet = FALSE,
+/*N*/ bLeftSet = FALSE,
+/*N*/ bRightSet = FALSE,
+/*N*/ bHoriSet = FALSE,
+/*N*/ bVertSet = FALSE,
+/*N*/ bDistanceSet = FALSE;
+/*N*/
+/*N*/ aSetBoxInfo.ResetFlags();
+/*N*/
+/*N*/ for ( USHORT i = 0; i < aUnions.Count(); ++i )
+/*N*/ {
+/*N*/ SwSelUnion *pUnion = aUnions[i];
+/*N*/ const SwTabFrm *pTab = pUnion->GetTable();
+/*N*/ const SwRect &rUnion = pUnion->GetUnion();
+/*N*/ const BOOL bFirst = i == 0 ? TRUE : FALSE;
+/*N*/ const BOOL bLast = i == aUnions.Count() - 1 ? TRUE : FALSE;
+/*N*/
+/*N*/ SvPtrarr aCellArr( 255, 255 );
+/*N*/ ::binfilter::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab );
+/*N*/
+/*N*/ for ( USHORT j = 0; j < aCellArr.Count(); ++j )
+/*N*/ {
+/*N*/ const SwCellFrm *pCell = (const SwCellFrm*)aCellArr[j];
+/*N*/ const sal_Bool bVert = pCell->IsVertical();
+/*N*/ const sal_Bool bRTL = pCell->IsRightToLeft();
+/*N*/ sal_Bool bTopOver, bLeftOver, bRightOver, bBottomOver;
+/*N*/ if ( bVert )
+/*N*/ {
+/*N*/ bTopOver = pCell->Frm().Right() >= rUnion.Right();
+/*N*/ bLeftOver = pCell->Frm().Top() <= rUnion.Top();
+/*N*/ bRightOver = pCell->Frm().Bottom() >= rUnion.Bottom();
+/*N*/ bBottomOver = pCell->Frm().Left() <= rUnion.Left();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bTopOver = pCell->Frm().Top() <= rUnion.Top();
+/*N*/ bLeftOver = pCell->Frm().Left() <= rUnion.Left();
+/*N*/ bRightOver = pCell->Frm().Right() >= rUnion.Right();
+/*N*/ bBottomOver = pCell->Frm().Bottom() >= rUnion.Bottom();
+/*N*/ }
+/*N*/
+/*N*/ if ( bRTL )
+/*N*/ {
+/*N*/ sal_Bool bTmp = bRightOver;
+/*N*/ bRightOver = bLeftOver;
+/*N*/ bLeftOver = bTmp;
+/*N*/ }
+/*N*/
+/*N*/ const SwFrmFmt *pFmt = pCell->GetFmt();
+/*N*/ const SvxBoxItem &rBox = pFmt->GetBox();
+/*N*/
+/*N*/ //Obere Kante
+/*N*/ if ( bFirst && bTopOver )
+/*N*/ {
+/*N*/ if (aSetBoxInfo.IsValid(VALID_TOP))
+/*N*/ {
+/*N*/ if ( !bTopSet )
+/*N*/ { bTopSet = TRUE;
+/*N*/ aSetBox.SetLine( rBox.GetTop(), BOX_LINE_TOP );
+/*N*/ }
+/*?*/ else if ((aSetBox.GetTop() && rBox.GetTop() &&
+/*?*/ !(*aSetBox.GetTop() == *rBox.GetTop())) ||
+/*?*/ ((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR-Ausdruck ist TRUE, wenn genau einer der beiden Pointer 0 ist
+/*?*/ {
+/*?*/ aSetBoxInfo.SetValid(VALID_TOP, FALSE );
+/*?*/ aSetBox.SetLine( 0, BOX_LINE_TOP );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Linke Kante
+/*N*/ if ( bLeftOver )
+/*N*/ {
+/*N*/ if (aSetBoxInfo.IsValid(VALID_LEFT))
+/*N*/ {
+/*N*/ if ( !bLeftSet )
+/*N*/ { bLeftSet = TRUE;
+/*N*/ aSetBox.SetLine( rBox.GetLeft(), BOX_LINE_LEFT );
+/*N*/ }
+/*N*/ else if ((aSetBox.GetLeft() && rBox.GetLeft() &&
+/*?*/ !(*aSetBox.GetLeft() == *rBox.GetLeft())) ||
+/*?*/ ((!aSetBox.GetLeft()) ^ (!rBox.GetLeft())))
+/*?*/ {
+/*?*/ aSetBoxInfo.SetValid(VALID_LEFT, FALSE );
+/*?*/ aSetBox.SetLine( 0, BOX_LINE_LEFT );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ if (aSetBoxInfo.IsValid(VALID_VERT))
+/*?*/ {
+/*?*/ if ( !bVertSet )
+/*?*/ { bVertSet = TRUE;
+/*?*/ aSetBoxInfo.SetLine( rBox.GetLeft(), BOXINFO_LINE_VERT );
+/*?*/ }
+/*?*/ else if ((aSetBoxInfo.GetVert() && rBox.GetLeft() &&
+/*?*/ !(*aSetBoxInfo.GetVert() == *rBox.GetLeft())) ||
+/*?*/ ((!aSetBoxInfo.GetVert()) ^ (!rBox.GetLeft())))
+/*?*/ { aSetBoxInfo.SetValid( VALID_VERT, FALSE );
+/*?*/ aSetBoxInfo.SetLine( 0, BOXINFO_LINE_VERT );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Rechte Kante
+/*N*/ if ( aSetBoxInfo.IsValid(VALID_RIGHT) && bRightOver )
+/*N*/ {
+/*N*/ if ( !bRightSet )
+/*N*/ { bRightSet = TRUE;
+/*N*/ aSetBox.SetLine( rBox.GetRight(), BOX_LINE_RIGHT );
+/*N*/ }
+/*N*/ else if ((aSetBox.GetRight() && rBox.GetRight() &&
+/*?*/ !(*aSetBox.GetRight() == *rBox.GetRight())) ||
+/*?*/ (!aSetBox.GetRight() ^ !rBox.GetRight()))
+/*?*/ { aSetBoxInfo.SetValid( VALID_RIGHT, FALSE );
+/*?*/ aSetBox.SetLine( 0, BOX_LINE_RIGHT );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Untere Kante
+/*N*/ if ( bLast && bBottomOver )
+/*N*/ {
+/*N*/ if ( aSetBoxInfo.IsValid(VALID_BOTTOM) )
+/*N*/ {
+/*N*/ if ( !bBottomSet )
+/*N*/ { bBottomSet = TRUE;
+/*N*/ aSetBox.SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM );
+/*N*/ }
+/*N*/ else if ((aSetBox.GetBottom() && rBox.GetBottom() &&
+/*?*/ !(*aSetBox.GetBottom() == *rBox.GetBottom())) ||
+/*?*/ (!aSetBox.GetBottom() ^ !rBox.GetBottom()))
+/*?*/ { aSetBoxInfo.SetValid( VALID_BOTTOM, FALSE );
+/*?*/ aSetBox.SetLine( 0, BOX_LINE_BOTTOM );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ //in allen Zeilen ausser der letzten werden die
+/*N*/ // horiz. Linien aus der Bottom-Linie entnommen
+/*N*/ else
+/*N*/ {
+/*?*/ if (aSetBoxInfo.IsValid(VALID_HORI))
+/*?*/ {
+/*?*/ if ( !bHoriSet )
+/*?*/ { bHoriSet = TRUE;
+/*?*/ aSetBoxInfo.SetLine( rBox.GetBottom(), BOXINFO_LINE_HORI );
+/*?*/ }
+/*?*/ else if ((aSetBoxInfo.GetHori() && rBox.GetBottom() &&
+/*?*/ !(*aSetBoxInfo.GetHori() == *rBox.GetBottom())) ||
+/*?*/ ((!aSetBoxInfo.GetHori()) ^ (!rBox.GetBottom())))
+/*?*/ {
+/*?*/ aSetBoxInfo.SetValid( VALID_HORI, FALSE );
+/*?*/ aSetBoxInfo.SetLine( 0, BOXINFO_LINE_HORI );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Abstand zum Text
+/*N*/ if (aSetBoxInfo.IsValid(VALID_DISTANCE))
+/*N*/ {
+/*N*/ static USHORT __READONLY_DATA aBorders[] = {
+/*N*/ BOX_LINE_BOTTOM, BOX_LINE_TOP,
+/*N*/ BOX_LINE_RIGHT, BOX_LINE_LEFT };
+/*N*/ const USHORT* pBrd = aBorders;
+/*N*/
+/*N*/ if( !bDistanceSet ) // bei 1. Durchlauf erstmal setzen
+/*N*/ {
+/*N*/ bDistanceSet = TRUE;
+/*N*/ for( int i = 0; i < 4; ++i, ++pBrd )
+/*N*/ aSetBox.SetDistance( rBox.GetDistance( *pBrd ),
+/*N*/ *pBrd );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ for( int i = 0; i < 4; ++i, ++pBrd )
+/*?*/ if( aSetBox.GetDistance( *pBrd ) !=
+/*?*/ rBox.GetDistance( *pBrd ) )
+/*?*/ {
+/*?*/ aSetBoxInfo.SetValid( VALID_DISTANCE, FALSE );
+/*?*/ aSetBox.SetDistance( (USHORT) 0 );
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ rSet.Put( aSetBox );
+/*N*/ rSet.Put( aSetBoxInfo );
+/*N*/ }
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_node.cxx b/binfilter/bf_sw/source/core/docnode/sw_node.cxx
new file mode 100644
index 000000000000..b25a262f0ded
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_node.cxx
@@ -0,0 +1,1351 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/protitem.hxx>
+#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
+
+#include <fmtanchr.hxx>
+#include <txtftn.hxx>
+#include <ftnfrm.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <swtable.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <section.hxx>
+#include <flyfrm.hxx>
+#include <txtfrm.hxx>
+#include <paratr.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <fmtcntnt.hxx>
+#include <frmtool.hxx>
+#include <pagefrm.hxx>
+#include <node2lay.hxx>
+#include <hints.hxx>
+#include <breakit.hxx>
+#include <crsskip.hxx>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+using namespace ::com::sun::star::i18n;
+
+/*N*/ TYPEINIT2( SwCntntNode, SwModify, SwIndexReg )
+
+/*******************************************************************
+|*
+|* SwNode::GetSectionLevel
+|*
+|* Beschreibung
+|* Die Funktion liefert den Sectionlevel an der durch
+|* aIndex bezeichneten Position.
+|*
+|* Die Logik ist wie folgt: ( S -> Start, E -> End, C -> CntntNode)
+|* Level 0 E
+|* 1 S E
+|* 2 SC
+|*
+|* alle EndNodes der GrundSection haben den Level 0
+|* alle StartNodes der GrundSection haben den Level 1
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Aenderung: JP 11.08.93
+|* keine Rekursion mehr !!
+|*
+*******************************************************************/
+
+
+
+/*******************************************************************
+|*
+|* SwNode::SwNode
+|*
+|* Beschreibung
+|* Konstruktor; dieser fuegt einen Node in das Array rNodes
+|* an der Position rWhere ein. Dieser bekommt als
+|* theEndOfSection den EndOfSection-Index des Nodes
+|* unmittelbar vor ihm. Falls er sich an der Position 0
+|* innerhalb des variablen Arrays befindet, wird
+|* theEndOfSection 0 (der neue selbst).
+|*
+|* Parameter
+|* IN
+|* rNodes bezeichnet das variable Array, in das der Node
+|* eingefuegt werden soll
+|* IN
+|* rWhere bezeichnet die Position innerhalb dieses Arrays,
+|* an der der Node eingefuegt werden soll
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+
+/*N*/ SwNode::SwNode( const SwNodeIndex &rWhere, const BYTE nNdType )
+/*N*/ : pStartOfSection( 0 ), nNodeType( nNdType )
+/*N*/ {
+/*N*/ bWrongDirty = bACmplWrdDirty = TRUE;
+/*N*/ bSetNumLSpace = bIgnoreDontExpand = FALSE;
+/*N*/ nAFmtNumLvl = 0;
+/*N*/
+/*N*/ SwNodes& rNodes = (SwNodes&)rWhere.GetNodes();
+/*N*/ SwNode* pInsNd = this; // der MAC kann this nicht einfuegen !!
+/*N*/ if( rWhere.GetIndex() )
+/*N*/ {
+/*N*/ SwNode* pNd = rNodes[ rWhere.GetIndex() -1 ];
+/*N*/ rNodes.Insert( pInsNd, rWhere );
+/*N*/ if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
+/*N*/ {
+/*N*/ pStartOfSection = pNd->pStartOfSection;
+/*N*/ if( pNd->GetEndNode() ) // EndNode ? Section ueberspringen!
+/*N*/ {
+/*N*/ pNd = pStartOfSection;
+/*N*/ pStartOfSection = pNd->pStartOfSection;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ rNodes.Insert( pInsNd, rWhere );
+/*?*/ pStartOfSection = (SwStartNode*)this;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwNode::SwNode( SwNodes& rNodes, ULONG nPos, const BYTE nNdType )
+/*N*/ : pStartOfSection( 0 ), nNodeType( nNdType )
+/*N*/ {
+/*N*/ bWrongDirty = bACmplWrdDirty = TRUE;
+/*N*/ bSetNumLSpace = bIgnoreDontExpand = FALSE;
+/*N*/ nAFmtNumLvl = 0;
+/*N*/
+/*N*/ SwNode* pInsNd = this; // der MAC kann this nicht einfuegen !!
+/*N*/ if( nPos )
+/*N*/ {
+/*N*/ SwNode* pNd = rNodes[ nPos - 1 ];
+/*N*/ rNodes.Insert( pInsNd, nPos );
+/*N*/ if( 0 == ( pStartOfSection = pNd->GetStartNode()) )
+/*N*/ {
+/*N*/ pStartOfSection = pNd->pStartOfSection;
+/*N*/ if( pNd->GetEndNode() ) // EndNode ? Section ueberspringen!
+/*N*/ {
+/*N*/ pNd = pStartOfSection;
+/*N*/ pStartOfSection = pNd->pStartOfSection;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rNodes.Insert( pInsNd, nPos );
+/*N*/ pStartOfSection = (SwStartNode*)this;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwNode::~SwNode()
+/*N*/ {
+/*N*/ }
+
+// suche den TabellenNode, in dem dieser steht. Wenn in keiner
+// Tabelle wird 0 returnt.
+
+
+/*N*/ SwTableNode* SwNode::FindTableNode()
+/*N*/ {
+/*N*/ if( IsTableNode() )
+/*N*/ return GetTableNode();
+/*N*/ SwStartNode* pTmp = pStartOfSection;
+/*N*/ while( !pTmp->IsTableNode() && pTmp->GetIndex() )
+/*N*/ #if defined( ALPHA ) && defined( UNX )
+/*?*/ pTmp = ((SwNode*)pTmp)->pStartOfSection;
+/*N*/ #else
+/*N*/ pTmp = pTmp->pStartOfSection;
+/*N*/ #endif
+/*N*/ return pTmp->GetTableNode();
+/*N*/ }
+
+
+// liegt der Node im Sichtbarenbereich der Shell ?
+
+/*N*/ BOOL SwNode::IsInProtectSect() const
+/*N*/ {
+/*N*/ const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this;
+/*N*/ const SwSectionNode* pSectNd = pNd->FindSectionNode();
+/*N*/ return pSectNd && pSectNd->GetSection().IsProtectFlag();
+/*N*/ }
+
+ // befindet sich der Node in irgendetwas geschuetzten ?
+ // (Bereich/Rahmen/Tabellenzellen/... incl. des Ankers bei
+ // Rahmen/Fussnoten/..)
+/*N*/ BOOL SwNode::IsProtect() const
+/*N*/ {
+/*N*/ const SwNode* pNd = ND_SECTIONNODE == nNodeType ? pStartOfSection : this;
+/*N*/ const SwStartNode* pSttNd = pNd->FindSectionNode();
+/*N*/ if( pSttNd && ((SwSectionNode*)pSttNd)->GetSection().IsProtectFlag() )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ if( 0 != ( pSttNd = FindTableBoxStartNode() ) )
+/*N*/ {
+/*N*/ SwCntntFrm* pCFrm;
+/*N*/ if( IsCntntNode() && 0 != (pCFrm = ((SwCntntNode*)this)->GetFrm() ))
+/*N*/ return pCFrm->IsProtected();
+/*N*/
+/*N*/ const SwTableBox* pBox = pSttNd->FindTableNode()->GetTable().
+/*N*/ GetTblBox( pSttNd->GetIndex() );
+/*N*/ if( pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/
+/*N*/ SwFrmFmt* pFlyFmt = GetFlyFmt();
+/*N*/ if( pFlyFmt )
+/*N*/ {
+/*N*/ if( pFlyFmt->GetProtect().IsCntntProtected() )
+/*?*/ return TRUE;
+/*N*/ const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor();
+/*N*/ return rAnchor.GetCntntAnchor()
+/*N*/ ? rAnchor.GetCntntAnchor()->nNode.GetNode().IsProtect()
+/*N*/ : FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if( 0 != ( pSttNd = FindFootnoteStartNode() ) )
+/*N*/ {
+/*?*/ const SwTxtFtn* pTFtn = GetDoc()->GetFtnIdxs().SeekEntry(
+/*?*/ SwNodeIndex( *pSttNd ) );
+/*?*/ if( pTFtn )
+/*?*/ return pTFtn->GetTxtNode().IsProtect();
+/*N*/ }
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+ // suche den PageDesc, mit dem dieser Node formatiert ist. Wenn das
+ // Layout vorhanden ist wird ueber das gesucht, ansonsten gibt es nur
+ // die harte Tour ueber die Nodes nach vorne suchen!!
+
+
+ // falls der Node in einem Fly steht, dann wird das entsprechende Format
+ // returnt
+/*N*/ SwFrmFmt* SwNode::GetFlyFmt() const
+/*N*/ {
+/*N*/ SwFrmFmt* pRet = 0;
+/*N*/ const SwNode* pSttNd = FindFlyStartNode();
+/*N*/ if( pSttNd )
+/*N*/ {
+/*N*/ if( IsCntntNode() )
+/*N*/ {
+/*N*/ SwClientIter aIter( *(SwCntntNode*)this );
+/*N*/ SwClient* pCli = aIter.First( TYPE( SwCntntFrm ));
+/*N*/ if( pCli )
+/*N*/ pRet = ((SwCntntFrm*)pCli)->FindFlyFrm()->GetFmt();
+/*N*/ }
+/*N*/ if( !pRet )
+/*N*/ {
+/*N*/ // dann gibts noch harten steinigen Weg uebers Dokument:
+/*N*/ const SwSpzFrmFmts& rFrmFmtTbl = *GetDoc()->GetSpzFrmFmts();
+/*N*/ for( USHORT n = 0; n < rFrmFmtTbl.Count(); ++n )
+/*N*/ {
+/*N*/ SwFrmFmt* pFmt = rFrmFmtTbl[n];
+/*N*/ const SwFmtCntnt& rCntnt = pFmt->GetCntnt();
+/*N*/ if( rCntnt.GetCntntIdx() &&
+/*N*/ &rCntnt.GetCntntIdx()->GetNode() == pSttNd )
+/*N*/ {
+/*N*/ pRet = pFmt;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+
+/*N*/ SwTableBox* SwNode::GetTblBox() const
+/*N*/ {
+/*N*/ SwTableBox* pBox = 0;
+/*N*/ const SwNode* pSttNd = FindTableBoxStartNode();
+/*N*/ if( pSttNd )
+/*N*/ pBox = (SwTableBox*)pSttNd->FindTableNode()->GetTable().GetTblBox(
+/*N*/ pSttNd->GetIndex() );
+/*N*/ return pBox;
+/*N*/ }
+
+/*N*/ SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp )
+/*N*/ {
+/*N*/ SwStartNode* pTmp = IsStartNode() ? (SwStartNode*)this : pStartOfSection;
+/*N*/
+/*N*/ while( eTyp != pTmp->GetStartNodeType() && pTmp->GetIndex() )
+/*N*/ #if defined( ALPHA ) && defined( UNX )
+/*?*/ pTmp = ((SwNode*)pTmp)->pStartOfSection;
+/*N*/ #else
+/*N*/ pTmp = pTmp->pStartOfSection;
+/*N*/ #endif
+/*N*/ return eTyp == pTmp->GetStartNodeType() ? pTmp : 0;
+/*N*/ }
+
+/*N*/ const SwTxtNode* SwNode::FindOutlineNodeOfLevel( BYTE nLvl ) const
+/*N*/ {
+/*N*/ const SwTxtNode* pRet = 0;
+/*N*/ const SwOutlineNodes& rONds = GetNodes().GetOutLineNds();
+/*N*/ if( MAXLEVEL > nLvl && rONds.Count() )
+/*N*/ {
+/*N*/ USHORT nPos;
+/*N*/ SwNode* pNd = (SwNode*)this;
+/*N*/ BOOL bCheckFirst = FALSE;
+/*N*/ if( !rONds.Seek_Entry( pNd, &nPos ))
+/*N*/ {
+/*N*/ if( nPos )
+/*N*/ nPos = nPos-1;
+/*N*/ else
+/*?*/ bCheckFirst = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ if( bCheckFirst )
+/*N*/ {
+/*?*/ // der 1.GliederungsNode liegt hinter dem Fragenden. Dann
+/*?*/ // teste mal, ob dieser auf der gleichen Seite steht. Wenn
+/*?*/ // nicht, ist das ein ungueltiger. Bug 61865
+/*?*/ pRet = rONds[0]->GetTxtNode();
+/*?*/
+/*?*/ const SwCntntNode* pCNd = GetCntntNode();
+/*?*/
+/*?*/ Point aPt( 0, 0 );
+/*?*/ const SwFrm* pFrm = pRet->GetFrm( &aPt, 0, FALSE ),
+/*?*/ * pMyFrm = pCNd ? pCNd->GetFrm( &aPt, 0, FALSE ) : 0;
+/*?*/ const SwPageFrm* pPgFrm = pFrm ? pFrm->FindPageFrm() : 0;
+/*?*/ if( pPgFrm && pMyFrm &&
+/*?*/ pPgFrm->Frm().Top() > pMyFrm->Frm().Top() )
+/*?*/ {
+/*?*/ // der Fragende liegt vor der Seite, also ist er ungueltig
+/*?*/ pRet = 0;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // oder ans Feld und von dort holen !!
+/*N*/ while( nPos && nLvl < ( pRet = rONds[nPos]->GetTxtNode() )
+/*N*/ ->GetTxtColl()->GetOutlineLevel() )
+/*N*/ --nPos;
+/*N*/
+/*N*/ if( !nPos ) // bei 0 gesondert holen !!
+/*N*/ pRet = rONds[0]->GetTxtNode();
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+// is the node the first and/or last node of a section?
+// This information is used for the export filters. Our layout never have a
+// distance before or after if the node is the first or last in a section.
+
+
+
+/*******************************************************************
+|*
+|* SwNode::StartOfSection
+|*
+|* Beschreibung
+|* Die Funktion liefert die StartOfSection des Nodes.
+|*
+|* Parameter
+|* IN
+|* rNodes bezeichnet das variable Array, in dem sich der Node
+|* befindet
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+
+/*N*/ SwStartNode::SwStartNode( const SwNodeIndex &rWhere, const BYTE nNdType,
+/*N*/ SwStartNodeType eSttNd )
+/*N*/ : SwNode( rWhere, nNdType ), eSttNdTyp( eSttNd )
+/*N*/ {
+/*N*/ // erstmal temporaer, bis der EndNode eingefuegt wird.
+/*N*/ pEndOfSection = (SwEndNode*)this;
+/*N*/ }
+
+/*N*/ SwStartNode::SwStartNode( SwNodes& rNodes, ULONG nPos )
+/*N*/ : SwNode( rNodes, nPos, ND_STARTNODE ), eSttNdTyp( SwNormalStartNode )
+/*N*/ {
+/*N*/ // erstmal temporaer, bis der EndNode eingefuegt wird.
+/*N*/ pEndOfSection = (SwEndNode*)this;
+/*N*/ }
+
+
+/*N*/ void SwStartNode::CheckSectionCondColl() const
+/*N*/ {
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ SwNodeIndex aIdx( *this );
+/*N*/ ULONG nEndIdx = EndOfSectionIndex();
+/*N*/ const SwNodes& rNds = GetNodes();
+/*N*/ SwCntntNode* pCNd;
+/*N*/ while( 0 != ( pCNd = rNds.GoNext( &aIdx )) && pCNd->GetIndex() < nEndIdx )
+/*N*/ pCNd->ChkCondColl();
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ }
+
+/*******************************************************************
+|*
+|* SwEndNode::SwEndNode
+|*
+|* Beschreibung
+|* Konstruktor; dieser fuegt einen Node in das Array rNodes
+|* an der Position aWhere ein. Der
+|* theStartOfSection-Pointer wird entsprechend gesetzt,
+|* und der EndOfSection-Pointer des zugehoerigen
+|* Startnodes -- durch rStartOfSection bezeichnet --
+|* wird auf diesen Node gesetzt.
+|*
+|* Parameter
+|* IN
+|* rNodes bezeichnet das variable Array, in das der Node
+|* eingefuegt werden soll
+|* IN
+|* aWhere bezeichnet die Position innerhalb dieses Arrays,
+|* an der der Node eingefuegt werden soll
+|* !!!!!!!!!!!!
+|* Es wird eine Kopie uebergeben!
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+
+/*N*/ SwEndNode::SwEndNode( const SwNodeIndex &rWhere, SwStartNode& rSttNd )
+/*N*/ : SwNode( rWhere, ND_ENDNODE )
+/*N*/ {
+/*N*/ pStartOfSection = &rSttNd;
+/*N*/ pStartOfSection->pEndOfSection = this;
+/*N*/ }
+
+/*N*/ SwEndNode::SwEndNode( SwNodes& rNds, ULONG nPos, SwStartNode& rSttNd )
+/*N*/ : SwNode( rNds, nPos, ND_ENDNODE )
+/*N*/ {
+/*N*/ pStartOfSection = &rSttNd;
+/*N*/ pStartOfSection->pEndOfSection = this;
+/*N*/ }
+
+
+
+// --------------------
+// SwCntntNode
+// --------------------
+
+
+/*N*/ SwCntntNode::SwCntntNode( const SwNodeIndex &rWhere, const BYTE nNdType,
+/*N*/ SwFmtColl *pColl )
+/*N*/ : SwNode( rWhere, nNdType ),
+/*N*/ pAttrSet( 0 ),
+/*N*/ pCondColl( 0 ),
+/*N*/ SwModify( pColl ) // CrsrsShell, FrameFmt
+/*N*/ #ifdef OLD_INDEX
+/*N*/ ,SwIndexReg(2)
+/*N*/ #endif
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwCntntNode::~SwCntntNode()
+/*N*/ {
+/*N*/ // Die Basisklasse SwClient vom SwFrm nimmt sich aus
+/*N*/ // der Abhaengikeitsliste raus!
+/*N*/ // Daher muessen alle Frames in der Abhaengigkeitsliste geloescht werden.
+/*N*/ if( GetDepends() )
+/*N*/ DelFrms();
+/*N*/
+/*N*/ if( pAttrSet )
+/*N*/ delete pAttrSet;
+/*N*/ if( pCondColl )
+/*?*/ delete pCondColl;
+/*N*/ }
+
+
+/*N*/ void SwCntntNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+/*N*/ {
+/*N*/ USHORT nWhich = pOldValue ? pOldValue->Which() :
+/*N*/ pNewValue ? pNewValue->Which() : 0 ;
+/*N*/ BOOL bNumRuleSet = FALSE, bCallModify = TRUE;
+/*N*/ String sNumRule, sOldNumRule;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_OBJECTDYING :
+/*N*/ {
+/*?*/ SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
+/*?*/
+/*?*/ // nicht umhaengen wenn dieses das oberste Format ist !!
+/*?*/ if( pRegisteredIn == pFmt )
+/*?*/ {
+/*?*/ if( pFmt->GetRegisteredIn() )
+/*?*/ {
+/*?*/ // wenn Parent, dann im neuen Parent wieder anmelden
+/*?*/ ((SwModify*)pFmt->GetRegisteredIn())->Add( this );
+/*?*/ if ( pAttrSet )
+/*?*/ pAttrSet->SetParent(
+/*?*/ &((SwFmt*)GetRegisteredIn())->GetAttrSet() );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // sonst auf jeden Fall beim sterbenden abmelden
+/*?*/ ((SwModify*)GetRegisteredIn())->Remove( this );
+/*?*/ if ( pAttrSet )
+/*?*/ pAttrSet->SetParent( 0 );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/
+/*N*/ case RES_FMT_CHG:
+/*N*/ // falls mein Format Parent umgesetzt wird, dann melde ich
+/*N*/ // meinen Attrset beim Neuen an.
+/*N*/
+/*N*/ // sein eigenes Modify ueberspringen !!
+/*N*/ if( pAttrSet &&
+/*N*/ ((SwFmtChg*)pNewValue)->pChangedFmt == GetRegisteredIn() )
+/*N*/ {
+/*N*/ // den Set an den neuen Parent haengen
+/*N*/ pAttrSet->SetParent( GetRegisteredIn() ?
+/*N*/ &((SwFmt*)GetRegisteredIn())->GetAttrSet() : 0 );
+/*N*/ }
+/*N*/ if( GetNodes().IsDocNodes() && IsTxtNode() )
+/*N*/ {
+/*N*/ if( 0 != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, TRUE )))
+/*N*/ {
+/*?*/ bNumRuleSet = TRUE;
+/*?*/ sNumRule = ((SwNumRuleItem*)pItem)->GetValue();
+/*N*/ }
+/*N*/ sOldNumRule = ((SwFmtChg*)pOldValue)->pChangedFmt->GetNumRule().GetValue();
+/*N*/ }
+/*N*/ break;
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ case RES_CONDCOLL_CONDCHG:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( ((SwCondCollCondChg*)pNewValue)->pChangedFmt == GetRegisteredIn() &&
+/*?*/ return ; // nicht an die Basisklasse / Frames weitergeben
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ if( GetNodes().IsDocNodes() && IsTxtNode() )
+/*N*/ {
+/*N*/ if( SFX_ITEM_SET == ((SwAttrSetChg*)pNewValue)->GetChgSet()->GetItemState(
+/*N*/ RES_PARATR_NUMRULE, FALSE, &pItem ))
+/*N*/ {
+/*N*/ bNumRuleSet = TRUE;
+/*N*/ sNumRule = ((SwNumRuleItem*)pItem)->GetValue();
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == ((SwAttrSetChg*)pOldValue)->GetChgSet()->GetItemState(
+/*N*/ RES_PARATR_NUMRULE, FALSE, &pItem ))
+/*N*/ sOldNumRule = ((SwNumRuleItem*)pItem)->GetValue();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_PARATR_NUMRULE:
+/*?*/ if( GetNodes().IsDocNodes() && IsTxtNode() )
+/*?*/ {
+/*?*/ if( pNewValue )
+/*?*/ {
+/*?*/ bNumRuleSet = TRUE;
+/*?*/ sNumRule = ((SwNumRuleItem*)pNewValue)->GetValue();
+/*?*/ }
+/*?*/ if( pOldValue )
+/*?*/ sOldNumRule = ((SwNumRuleItem*)pOldValue)->GetValue();
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*N*/
+/*N*/ if( bNumRuleSet )
+/*N*/ {
+/*N*/ if( sNumRule.Len() )
+/*N*/ {
+/*N*/ if( !((SwTxtNode*)this)->GetNum() )
+/*N*/ ((SwTxtNode*)this)->UpdateNum( SwNodeNum(0) );
+/*N*/ #ifndef NUM_RELSPACE
+/*N*/ SetNumLSpace( TRUE );
+/*N*/ #endif
+/*N*/ SwNumRule* pRule = GetDoc()->FindNumRulePtr( sNumRule );
+/*N*/ if( !pRule )
+/*N*/ {
+/*?*/ USHORT nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, GET_POOLID_NUMRULE );
+/*?*/ if( USHRT_MAX != nPoolId )
+/*?*/ pRule = GetDoc()->GetNumRuleFromPool( nPoolId );
+/*N*/ }
+/*N*/ if( pRule )
+/*N*/ pRule->SetInvalidRule( TRUE );
+/*N*/ }
+/*N*/ else if( ((SwTxtNode*)this)->GetNum() )
+/*N*/ {
+/*?*/ bCallModify = FALSE;
+/*?*/ SwModify::Modify( pOldValue, pNewValue );
+/*?*/ ((SwTxtNode*)this)->UpdateNum( SwNodeNum(NO_NUMBERING) );
+/*?*/ #ifndef NUM_RELSPACE
+/*?*/ SetNumLSpace( TRUE );
+/*?*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ if( sOldNumRule.Len() && sNumRule != sOldNumRule )
+/*N*/ {
+/*?*/ SwNumRule* pRule = GetDoc()->FindNumRulePtr( sOldNumRule );
+/*?*/ if( pRule )
+/*?*/ pRule->SetInvalidRule( TRUE );
+/*N*/ }
+/*N*/
+/*N*/ if( bCallModify )
+/*N*/ SwModify::Modify( pOldValue, pNewValue );
+/*N*/ }
+
+/*N*/ BOOL SwCntntNode::InvalidateNumRule()
+/*N*/ {
+/*N*/ SwNumRule* pRule = 0;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( GetNodes().IsDocNodes() &&
+/*N*/ 0 != ( pItem = GetNoCondAttr( RES_PARATR_NUMRULE, TRUE )) &&
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue().Len() &&
+/*N*/ 0 != (pRule = GetDoc()->FindNumRulePtr(
+/*N*/ ((SwNumRuleItem*)pItem)->GetValue() ) ) )
+/*N*/ {
+/*N*/ pRule->SetInvalidRule( TRUE );
+/*N*/ }
+/*N*/ return 0 != pRule;
+/*N*/ }
+
+
+/*N*/ SwCntntFrm *SwCntntNode::GetFrm( const Point* pPoint,
+/*N*/ const SwPosition *pPos,
+/*N*/ const BOOL bCalcFrm ) const
+/*N*/ {
+/*N*/ return (SwCntntFrm*) ::binfilter::GetFrmOfModify( *(SwModify*)this, FRM_CNTNT,
+/*N*/ pPoint, pPos, bCalcFrm );
+/*N*/ }
+
+
+
+/*N*/ xub_StrLen SwCntntNode::Len() const { return 0; }
+
+
+
+/*N*/ SwFmtColl *SwCntntNode::ChgFmtColl( SwFmtColl *pNewColl )
+/*N*/ {
+/*N*/ ASSERT( pNewColl, Collectionpointer ist 0. );
+/*N*/ SwFmtColl *pOldColl = GetFmtColl();
+/*N*/ if( pNewColl != pOldColl )
+/*N*/ {
+/*N*/ pNewColl->Add( this );
+/*N*/
+/*N*/ // setze den Parent von unseren Auto-Attributen auf die neue
+/*N*/ // Collection:
+/*N*/ if( pAttrSet )
+/*?*/ pAttrSet->SetParent( &pNewColl->GetAttrSet() );
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ // HACK: hier muss die entsprechend der neuen Vorlage die Bedingungen
+/*N*/ // neu ueberprueft werden!
+/*N*/ if( TRUE /*pNewColl */ )
+/*N*/ {
+/*N*/ SetCondFmtColl( 0 );
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ if( !IsModifyLocked() )
+/*N*/ {
+/*N*/ SwFmtChg aTmp1( pOldColl );
+/*N*/ SwFmtChg aTmp2( pNewColl );
+/*N*/ // SwModify::Modify( &aTmp1, &aTmp2 );
+/*N*/ // damit alles was im Modify passiert hier nicht noch impl.
+/*N*/ // werden muss
+/*N*/ SwCntntNode::Modify( &aTmp1, &aTmp2 );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*?*/ SwFrm::GetCache().Delete( this );
+/*?*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ return pOldColl;
+/*N*/ }
+
+
+/*N*/ BOOL SwCntntNode::GoNext(SwIndex * pIdx, USHORT nMode ) const
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/ if( pIdx->GetIndex() < Len() )
+/*N*/ {
+/*N*/ if( !IsTxtNode() )
+/*?*/ (*pIdx)++;
+/*N*/ else
+/*N*/ {
+/*N*/ const SwTxtNode& rTNd = *GetTxtNode();
+/*N*/ xub_StrLen nPos = pIdx->GetIndex();
+/*N*/ if( pBreakIt->xBreak.is() )
+/*N*/ {
+/*N*/ sal_Int32 nDone = 0;
+/*N*/ sal_uInt16 nItrMode = CRSR_SKIP_CHARS == nMode
+/*N*/ ? CharacterIteratorMode::SKIPCONTROLCHARACTER
+/*N*/ : CharacterIteratorMode::SKIPCELL;
+/*N*/ nPos = pBreakIt->xBreak->nextCharacters( rTNd.GetTxt(), nPos,
+/*N*/ pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
+/*N*/ nItrMode, 1, nDone );
+/*N*/ if( 1 == nDone )
+/*N*/ *pIdx = nPos;
+/*N*/ else
+/*?*/ bRet = FALSE;
+/*N*/ }
+/*N*/ else if( nPos < rTNd.GetTxt().Len() )
+/*?*/ (*pIdx)++;
+/*N*/ else
+/*?*/ bRet = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bRet = FALSE;
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ BOOL SwCntntNode::GoPrevious(SwIndex * pIdx, USHORT nMode ) const
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/ if( pIdx->GetIndex() > 0 )
+/*N*/ {
+/*N*/ if( !IsTxtNode() )
+/*?*/ (*pIdx)--;
+/*N*/ else
+/*N*/ {
+/*N*/ const SwTxtNode& rTNd = *GetTxtNode();
+/*N*/ xub_StrLen nPos = pIdx->GetIndex();
+/*N*/ if( pBreakIt->xBreak.is() )
+/*N*/ {
+/*N*/ sal_Int32 nDone = 0;
+/*N*/ sal_uInt16 nItrMode = CRSR_SKIP_CHARS == nMode
+/*N*/ ? CharacterIteratorMode::SKIPCONTROLCHARACTER
+/*N*/ : CharacterIteratorMode::SKIPCELL;
+/*N*/ nPos = pBreakIt->xBreak->previousCharacters( rTNd.GetTxt(), nPos,
+/*N*/ pBreakIt->GetLocale( rTNd.GetLang( nPos ) ),
+/*N*/ nItrMode, 1, nDone );
+/*N*/ if( 1 == nDone )
+/*N*/ *pIdx = nPos;
+/*N*/ else
+/*?*/ bRet = FALSE;
+/*N*/ }
+/*N*/ else if( nPos )
+/*?*/ (*pIdx)--;
+/*N*/ else
+/*?*/ bRet = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bRet = FALSE;
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*
+ * Methode erzeugt fuer den vorhergehenden Node alle Ansichten vom
+ * Dokument. Die erzeugten Contentframes werden in das entsprechende
+ * Layout gehaengt.
+ */
+
+
+/*N*/ void SwCntntNode::MakeFrms( SwCntntNode& rNode )
+/*N*/ {
+/*N*/ ASSERT( &rNode != this,
+/*N*/ "Kein Contentnode oder Copy-Node und neuer Node identisch." );
+/*N*/
+/*N*/ if( !GetDepends() || &rNode == this ) // gibt es ueberhaupt Frames ??
+/*?*/ return;
+/*N*/
+/*N*/ SwFrm *pFrm, *pNew;
+/*N*/ SwLayoutFrm *pUpper;
+/*N*/ // Frames anlegen fuer Nodes, die vor oder hinter der Tabelle stehen ??
+/*N*/ ASSERT( FindTableNode() == rNode.FindTableNode(), "Table confusion" )
+/*N*/
+/*N*/ SwNode2Layout aNode2Layout( *this, rNode.GetIndex() );
+/*N*/
+/*N*/ while( 0 != (pUpper = aNode2Layout.UpperFrm( pFrm, rNode )) )
+/*N*/ {
+/*N*/ pNew = rNode.MakeFrm();
+/*N*/ pNew->Paste( pUpper, pFrm );
+/*N*/ }
+/*N*/ }
+
+/*
+ * Methode loescht fuer den Node alle Ansichten vom
+ * Dokument. Die Contentframes werden aus dem entsprechenden
+ * Layout ausgehaengt.
+ */
+
+
+/*N*/ void SwCntntNode::DelFrms()
+/*N*/ {
+/*N*/ if( !GetDepends() )
+/*N*/ return;
+/*N*/
+/*N*/ SwClientIter aIter( *this );
+/*N*/ SwCntntFrm *pFrm;
+/*N*/
+/*N*/ for( pFrm = (SwCntntFrm*)aIter.First( TYPE(SwCntntFrm)); pFrm;
+/*N*/ pFrm = (SwCntntFrm*)aIter.Next() )
+/*N*/ {
+/*N*/ if( pFrm->HasFollow() )
+/*N*/ pFrm->GetFollow()->_SetIsFollow( pFrm->IsFollow() );
+/*N*/ if( pFrm->IsFollow() )
+/*N*/ {
+/*?*/ SwCntntFrm* pMaster = (SwTxtFrm*)pFrm->FindMaster();
+/*?*/ pMaster->SetFollow( pFrm->GetFollow() );
+/*?*/ pFrm->_SetIsFollow( FALSE );
+/*N*/ }
+/*N*/ pFrm->SetFollow( 0 );//Damit er nicht auf dumme Gedanken kommt.
+/*N*/ //Andernfalls kann es sein, dass ein Follow
+/*N*/ //vor seinem Master zerstoert wird, der Master
+/*N*/ //greift dann ueber den ungueltigen
+/*N*/ //Follow-Pointer auf fremdes Memory zu.
+/*N*/ //Die Kette darf hier zerknauscht werden, weil
+/*N*/ //sowieso alle zerstoert werden.
+/*N*/ if( pFrm->GetUpper() && pFrm->IsInFtn() && !pFrm->GetIndNext() &&
+/*N*/ !pFrm->GetIndPrev() )
+/*N*/ {
+/*?*/ SwFtnFrm *pFtn = pFrm->FindFtnFrm();
+/*?*/ ASSERT( pFtn, "You promised a FtnFrm?" );
+/*?*/ SwCntntFrm* pCFrm;
+/*?*/ if( !pFtn->GetFollow() && !pFtn->GetMaster() &&
+/*?*/ 0 != ( pCFrm = pFtn->GetRefFromAttr()) && pCFrm->IsFollow() )
+/*?*/ {
+/*?*/ ASSERT( pCFrm->IsTxtFrm(), "NoTxtFrm has Footnote?" );
+/*?*/ ((SwTxtFrm*)pCFrm->FindMaster())->Prepare( PREP_FTN_GONE );
+/*?*/ }
+/*N*/ }
+/*N*/ pFrm->Cut();
+/*N*/ delete pFrm;
+/*N*/ }
+/*N*/ if( IsTxtNode() )
+/*N*/ {
+/*N*/ ((SwTxtNode*)this)->SetWrong( NULL );
+/*N*/ SetWrongDirty( TRUE );
+/*N*/ SetAutoCompleteWordDirty( TRUE );
+/*N*/ }
+/*N*/ }
+
+
+ SwCntntNode *SwCntntNode::JoinNext()
+ {
+ return this;
+ }
+
+
+ SwCntntNode *SwCntntNode::JoinPrev()
+ {
+ return this;
+ }
+
+
+
+ // erfrage vom Modify Informationen
+/*N*/ BOOL SwCntntNode::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ const SwNumRuleItem* pItem;
+/*N*/ switch( rInfo.Which() )
+/*N*/ {
+/*N*/ case RES_AUTOFMT_DOCNODE:
+/*N*/ if( &GetNodes() == ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+/*N*/ {
+/*N*/ ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = this;
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ break;
+/*?*/ case RES_GETNUMNODES:
+/*?*/ if( IsTxtNode() && 0 != ( pItem = (SwNumRuleItem*)GetNoCondAttr(
+/*?*/ RES_PARATR_NUMRULE, TRUE )) &&
+/*?*/ pItem->GetValue().Len() &&
+/*?*/ pItem->GetValue() == ((SwNumRuleInfo&)rInfo).GetName() &&
+/*?*/ GetNodes().IsDocNodes() )
+/*?*/ {
+/*?*/ ((SwNumRuleInfo&)rInfo).AddNode( *(SwTxtNode*)this );
+/*?*/ }
+/*?*/ return TRUE;
+/*?*/
+/*?*/ case RES_GETLOWERNUMLEVEL:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( IsTxtNode() && ((SwTxtNode*)this)->GetNum() &&
+/*?*/ break;
+/*?*/
+/*?*/ case RES_FINDNEARESTNODE:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( ((SwFmtPageDesc&)GetAttr( RES_PAGEDESC )).GetPageDesc() )
+/*?*/ return TRUE;
+/*?*/
+/*?*/ case RES_CONTENT_VISIBLE:
+/*?*/ {
+/*?*/ ((SwPtrMsgPoolItem&)rInfo).pObject =
+/*?*/ SwClientIter( *(SwCntntNode*)this ).First( TYPE(SwFrm) );
+/*?*/ }
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/ return SwModify::GetInfo( rInfo );
+/*N*/ }
+
+
+ // setze ein Attribut
+/*N*/ BOOL SwCntntNode::SetAttr(const SfxPoolItem& rAttr )
+/*N*/ {
+/*N*/ if( !pAttrSet ) // lasse von den entsprechenden Nodes die
+/*N*/ NewAttrSet( GetDoc()->GetAttrPool() ); // AttrSets anlegen
+/*N*/
+/*N*/ ASSERT( pAttrSet, "warum wurde kein AttrSet angelegt?" );
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/
+/*N*/ BOOL bRet = FALSE;
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt
+/*N*/ if( IsModifyLocked() ||
+/*N*/ ( !GetDepends() && RES_PARATR_NUMRULE != rAttr.Which() ))
+/*N*/ {
+/*N*/ if( 0 != ( bRet = (0 != pAttrSet->Put( rAttr )) ))
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ pAttrSet->SetModifyAtAttr( this );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwAttrSet aOld( *pAttrSet->GetPool(), pAttrSet->GetRanges() ),
+/*N*/ aNew( *pAttrSet->GetPool(), pAttrSet->GetRanges() );
+/*N*/ if( 0 != ( bRet = pAttrSet->Put_BC( rAttr, &aOld, &aNew ) ))
+/*N*/ {
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ pAttrSet->SetModifyAtAttr( this );
+/*N*/
+/*N*/ SwAttrSetChg aChgOld( *pAttrSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( *pAttrSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ BOOL SwCntntNode::SetAttr( const SfxItemSet& rSet )
+/*N*/ {
+/*N*/ if( !pAttrSet ) // lasse von den entsprechenden Nodes die
+/*N*/ NewAttrSet( GetDoc()->GetAttrPool() ); // AttrSets anlegen
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/
+/*N*/ BOOL bRet = FALSE;
+/*N*/
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt
+/*N*/ if( IsModifyLocked() || ( !GetDepends() &&
+/*N*/ SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_NUMRULE, FALSE )) )
+/*N*/ {
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ if( 0 != (bRet = (0 != pAttrSet->Put( rSet ))) )
+/*N*/ pAttrSet->SetModifyAtAttr( this );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwAttrSet aOld( *pAttrSet->GetPool(), pAttrSet->GetRanges() ),
+/*N*/ aNew( *pAttrSet->GetPool(), pAttrSet->GetRanges() );
+/*N*/ if( 0 != (bRet = pAttrSet->Put_BC( rSet, &aOld, &aNew )) )
+/*N*/ {
+/*N*/ // einige Sonderbehandlungen fuer Attribute
+/*N*/ pAttrSet->SetModifyAtAttr( this );
+/*N*/ SwAttrSetChg aChgOld( *pAttrSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( *pAttrSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+// Nimmt den Hint mit nWhich aus dem Delta-Array
+
+
+/*N*/ BOOL SwCntntNode::ResetAttr( USHORT nWhich1, USHORT nWhich2 )
+/*N*/ {
+/*N*/ if( !pAttrSet )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*?*/ SwFrm::GetCache().Delete( this );
+/*?*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt
+/*N*/ if( IsModifyLocked() )
+/*N*/ {
+/*?*/ USHORT nDel = (!nWhich2 || nWhich2 < nWhich1)
+/*?*/ ? pAttrSet->ClearItem( nWhich1 )
+/*?*/ : pAttrSet->ClearItem_BC( nWhich1, nWhich2 );
+/*?*/
+/*?*/ if( !pAttrSet->Count() ) // leer, dann loeschen
+/*?*/ DELETEZ( pAttrSet );
+/*?*/ return 0 != nDel;
+/*N*/ }
+/*N*/
+/*N*/ // sollte kein gueltiger Bereich definiert sein ?
+/*N*/ if( !nWhich2 || nWhich2 < nWhich1 )
+/*N*/ nWhich2 = nWhich1; // dann setze auf 1. Id, nur dieses Item
+/*N*/
+/*N*/ SwAttrSet aOld( *pAttrSet->GetPool(), pAttrSet->GetRanges() ),
+/*N*/ aNew( *pAttrSet->GetPool(), pAttrSet->GetRanges() );
+/*N*/ BOOL bRet = 0 != pAttrSet->ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
+/*N*/
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ SwAttrSetChg aChgOld( *pAttrSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( *pAttrSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/
+/*N*/ if( !pAttrSet->Count() ) // leer, dann loeschen
+/*N*/ DELETEZ( pAttrSet );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ USHORT SwCntntNode::ResetAllAttr()
+/*N*/ {
+/*N*/ if( !pAttrSet )
+/*N*/ return 0;
+/*N*/
+/*N*/ if ( IsInCache() )
+/*N*/ {
+/*?*/ SwFrm::GetCache().Delete( this );
+/*?*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/
+/*N*/ // wenn Modify gelockt ist, werden keine Modifies verschickt
+/*N*/ if( IsModifyLocked() )
+/*N*/ {
+/*?*/ USHORT nDel = pAttrSet->ClearItem( 0 );
+/*?*/ if( !pAttrSet->Count() ) // leer, dann loeschen
+/*?*/ DELETEZ( pAttrSet );
+/*?*/ return nDel;
+/*N*/ }
+/*N*/
+/*N*/ SwAttrSet aOld( *pAttrSet->GetPool(), pAttrSet->GetRanges() ),
+/*N*/ aNew( *pAttrSet->GetPool(), pAttrSet->GetRanges() );
+/*N*/ BOOL bRet = 0 != pAttrSet->ClearItem_BC( 0, &aOld, &aNew );
+/*N*/
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ SwAttrSetChg aChgOld( *pAttrSet, aOld );
+/*N*/ SwAttrSetChg aChgNew( *pAttrSet, aNew );
+/*N*/ Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
+/*N*/
+/*N*/ if( !pAttrSet->Count() ) // leer, dann loeschen
+/*N*/ DELETEZ( pAttrSet );
+/*N*/ }
+/*N*/ return aNew.Count();
+/*N*/ }
+
+
+/*N*/ BOOL SwCntntNode::GetAttr( SfxItemSet& rSet, BOOL bInParent ) const
+/*N*/ {
+/*N*/ if( rSet.Count() )
+/*?*/ rSet.ClearItem();
+/*N*/
+/*N*/ const SwAttrSet& rAttrSet = GetSwAttrSet();
+/*N*/ if( bInParent )
+/*N*/ return rSet.Set( rAttrSet, TRUE ) ? TRUE : FALSE;
+/*N*/
+/*?*/ rSet.Put( rAttrSet );
+/*?*/ return rSet.Count() ? TRUE : FALSE;
+/*N*/ }
+
+/*N*/ const SfxPoolItem* SwCntntNode::GetNoCondAttr( USHORT nWhich,
+/*N*/ BOOL bInParents ) const
+/*N*/ {
+/*N*/ const SfxPoolItem* pFnd = 0;
+/*N*/ if( pCondColl && pCondColl->GetRegisteredIn() )
+/*N*/ {
+/*?*/ if( !pAttrSet || ( SFX_ITEM_SET != pAttrSet->GetItemState(
+/*?*/ nWhich, FALSE, &pFnd ) && bInParents ))
+/*?*/ ((SwFmt*)GetRegisteredIn())->GetItemState( nWhich, bInParents, &pFnd );
+/*N*/ }
+/*N*/ else
+/*N*/ GetSwAttrSet().GetItemState( nWhich, bInParents, &pFnd );
+/*N*/ return pFnd;
+/*N*/ }
+
+ // koennen 2 Nodes zusammengefasst werden ?
+ // in pIdx kann die 2. Position returnt werden.
+/*N*/ int SwCntntNode::CanJoinNext( SwNodeIndex* pIdx ) const
+/*N*/ {
+/*N*/ const SwNodes& rNds = GetNodes();
+/*N*/ BYTE nNdType = GetNodeType();
+/*N*/ SwNodeIndex aIdx( *this, 1 );
+/*N*/
+/*N*/ const SwNode* pNd = this;
+/*N*/ while( aIdx < rNds.Count()-1 &&
+/*N*/ (( pNd = &aIdx.GetNode())->IsSectionNode() ||
+/*N*/ ( pNd->IsEndNode() && pNd->FindStartNode()->IsSectionNode() )))
+/*N*/ aIdx++;
+/*N*/
+/*N*/ if( pNd->GetNodeType() != nNdType || rNds.Count()-1 == aIdx.GetIndex() )
+/*N*/ return FALSE;
+/*N*/ if( pIdx )
+/*N*/ *pIdx = aIdx;
+/*N*/ return TRUE;
+/*N*/ }
+
+
+ // koennen 2 Nodes zusammengefasst werden ?
+ // in pIdx kann die 2. Position returnt werden.
+/*N*/ int SwCntntNode::CanJoinPrev( SwNodeIndex* pIdx ) const
+/*N*/ {
+/*N*/ const SwNodes& rNds = GetNodes();
+/*N*/ BYTE nNdType = GetNodeType();
+/*N*/ SwNodeIndex aIdx( *this, -1 );
+/*N*/
+/*N*/ const SwNode* pNd = this;
+/*N*/ while( aIdx.GetIndex() &&
+/*N*/ (( pNd = &aIdx.GetNode())->IsSectionNode() ||
+/*N*/ ( pNd->IsEndNode() && pNd->FindStartNode()->IsSectionNode() )))
+/*?*/ aIdx--;
+/*N*/
+/*N*/ if( pNd->GetNodeType() != nNdType || 0 == aIdx.GetIndex() )
+/*?*/ return FALSE;
+/*N*/ if( pIdx )
+/*N*/ *pIdx = aIdx;
+/*N*/ return TRUE;
+/*N*/ }
+
+
+//FEATURE::CONDCOLL
+
+
+/*N*/ void SwCntntNode::SetCondFmtColl( SwFmtColl* pColl )
+/*N*/ {
+/*N*/ if( (!pColl && pCondColl) || ( pColl && !pCondColl ) ||
+/*N*/ ( pColl && pColl != pCondColl->GetRegisteredIn() ) )
+/*N*/ {
+/*?*/ SwFmtColl* pOldColl = GetCondFmtColl();
+/*?*/ delete pCondColl;
+/*?*/ if( pColl )
+/*?*/ pCondColl = new SwDepend( this, pColl );
+/*?*/ else
+/*?*/ pCondColl = 0;
+/*?*/
+/*?*/ if( pAttrSet )
+/*?*/ {
+/*?*/ // Attrset beibehalten oder loeschen??
+/*?*/ // 13.04.99: Bisher wurden er geloescht, jetzt wird er beibehalten.
+/*?*/ // #64637#: Beim Laden eines Dokuments wird die bedingte
+/*?*/ // Vorlage nach dem Laden der harten Attribute gesetzt. Deshalb
+/*?*/ // wurden die harten Attribute geloescht.
+/*?*/
+/*?*/ pAttrSet->SetParent( &GetAnyFmtColl().GetAttrSet() );
+/*?*/ // steht im docfmt.cxx
+/*?*/ //extern BOOL lcl_RstAttr( const SwNodePtr&, void* );
+/*?*/ // lcl_RstAttr( this, 0 );
+/*?*/ // if( pAttrSet && !pAttrSet->Count() )
+/*?*/ // delete pAttrSet, pAttrSet = 0;
+/*?*/ }
+/*?*/
+/*?*/ if( !IsModifyLocked() )
+/*?*/ {
+/*?*/ SwFmtChg aTmp1( pOldColl ? pOldColl : GetFmtColl() );
+/*?*/ SwFmtChg aTmp2( pColl ? pColl : GetFmtColl() );
+/*?*/ SwModify::Modify( &aTmp1, &aTmp2 );
+/*?*/ }
+/*?*/ if( IsInCache() )
+/*?*/ {
+/*?*/ SwFrm::GetCache().Delete( this );
+/*?*/ SetInCache( FALSE );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ BOOL SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const
+/*N*/ {
+/*N*/ const SwNodes& rNds = GetNodes();
+/*N*/ {
+/*N*/ int nCond = 0;
+/*N*/ const SwStartNode* pSttNd = FindStartNode();
+/*N*/ while( pSttNd )
+/*N*/ {
+/*N*/ switch( pSttNd->GetNodeType() )
+/*N*/ {
+/*?*/ case ND_TABLENODE: nCond = PARA_IN_TABLEBODY; break;
+/*N*/ case ND_SECTIONNODE: nCond = PARA_IN_SECTION; break;
+/*N*/
+/*N*/ default:
+/*N*/ switch( pSttNd->GetStartNodeType() )
+/*N*/ {
+/*N*/ case SwTableBoxStartNode:
+/*N*/ {
+/*N*/ nCond = PARA_IN_TABLEBODY;
+/*N*/ const SwTableNode* pTblNd = pSttNd->FindTableNode();
+/*N*/ const SwTableBox* pBox;
+/*N*/ if( pTblNd && 0 != ( pBox = pTblNd->GetTable().
+/*N*/ GetTblBox( pSttNd->GetIndex() ) ) &&
+/*N*/ pBox->IsInHeadline( &pTblNd->GetTable() ) )
+/*N*/ nCond = PARA_IN_TABLEHEAD;
+/*N*/ }
+/*N*/ break;
+/*N*/ case SwFlyStartNode: nCond = PARA_IN_FRAME; break;
+/*N*/ case SwFootnoteStartNode:
+/*?*/ {
+/*?*/ nCond = PARA_IN_FOOTENOTE;
+/*?*/ const SwFtnIdxs& rFtnArr = rNds.GetDoc()->GetFtnIdxs();
+/*?*/ const SwTxtFtn* pTxtFtn;
+/*?*/ const SwNode* pSrchNd = pSttNd;
+/*?*/
+/*?*/ for( USHORT n = 0; n < rFtnArr.Count(); ++n )
+/*?*/ if( 0 != ( pTxtFtn = rFtnArr[ n ])->GetStartNode() &&
+/*?*/ pSrchNd == &pTxtFtn->GetStartNode()->GetNode() )
+/*?*/ {
+/*?*/ if( pTxtFtn->GetFtn().IsEndNote() )
+/*?*/ nCond = PARA_IN_ENDNOTE;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/ case SwHeaderStartNode: nCond = PARA_IN_HEADER; break;
+/*?*/ case SwFooterStartNode: nCond = PARA_IN_FOOTER; break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nCond )
+/*N*/ {
+/*N*/ rTmp.SetCondition( (Master_CollConditions)nCond, 0 );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ pSttNd = pSttNd->GetIndex()
+/*N*/ ? pSttNd->FindStartNode()
+/*N*/ : 0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ USHORT nPos;
+/*N*/ const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
+/*N*/ if( rOutlNds.Count() )
+/*N*/ {
+/*N*/ if( !rOutlNds.Seek_Entry( (SwCntntNode*)this, &nPos ) && nPos )
+/*N*/ --nPos;
+/*N*/ if( nPos < rOutlNds.Count() &&
+/*N*/ rOutlNds[ nPos ]->GetIndex() < GetIndex() )
+/*N*/ {
+/*N*/ SwTxtNode* pOutlNd = rOutlNds[ nPos ]->GetTxtNode();
+/*N*/
+/*N*/ if( pOutlNd->GetOutlineNum() && !pOutlNd->GetNumRule() )
+/*N*/ {
+/*N*/ rTmp.SetCondition( PARA_IN_OUTLINE,
+/*N*/ pOutlNd->GetOutlineNum()->GetLevel() );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ void SwCntntNode::ChkCondColl()
+/*N*/ {
+/*N*/ // zur Sicherheit abfragen
+/*N*/ if( RES_CONDTXTFMTCOLL == GetFmtColl()->Which() )
+/*N*/ {
+/*N*/ SwCollCondition aTmp( 0, 0, 0 );
+/*N*/ const SwCollCondition* pCColl;
+/*N*/
+/*N*/ if( IsAnyCondition( aTmp ) && 0 != ( pCColl =
+/*N*/ ((SwConditionTxtFmtColl*)GetFmtColl())->HasCondition( aTmp )))
+/*?*/ SetCondFmtColl( pCColl->GetTxtFmtColl() );
+/*N*/ else
+/*N*/ {
+/*N*/ if( IsTxtNode() && ((SwTxtNode*)this)->GetNumRule() &&
+/*N*/ ((SwTxtNode*)this)->GetNum() )
+/*N*/ {
+/*N*/ // steht in einer Numerierung
+/*N*/ // welcher Level?
+/*N*/ aTmp.SetCondition( PARA_IN_LIST,
+/*N*/ ((SwTxtNode*)this)->GetNum()->GetLevel() );
+/*N*/ pCColl = ((SwConditionTxtFmtColl*)GetFmtColl())->
+/*N*/ HasCondition( aTmp );
+/*N*/ }
+/*N*/ else
+/*N*/ pCColl = 0;
+/*N*/
+/*N*/ if( pCColl )
+/*?*/ SetCondFmtColl( pCColl->GetTxtFmtColl() );
+/*N*/ else if( pCondColl )
+/*?*/ SetCondFmtColl( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+//FEATURE::CONDCOLL
+// Metoden aus Node.hxx - erst hier ist der TxtNode bekannt !!
+// os: nur fuer ICC, da der zum optimieren zu dumm ist
+/*N*/ #ifdef ICC
+/*N*/ SwTxtNode *SwNode::GetTxtNode()
+/*N*/ {
+/*N*/ return ND_TEXTNODE == nNodeType ? (SwTxtNode*)this : 0;
+/*N*/ }
+/*N*/ const SwTxtNode *SwNode::GetTxtNode() const
+/*N*/ {
+/*N*/ return ND_TEXTNODE == nNodeType ? (const SwTxtNode*)this : 0;
+/*N*/ }
+/*N*/ #endif
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_node2lay.cxx b/binfilter/bf_sw/source/core/docnode/sw_node2lay.cxx
new file mode 100644
index 000000000000..7f83032aa787
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_node2lay.cxx
@@ -0,0 +1,360 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <errhdl.hxx>
+
+#include <ndindex.hxx>
+#include <swtable.hxx>
+#include <ftnfrm.hxx>
+#include <sectfrm.hxx>
+#include "cntfrm.hxx"
+#include "tabfrm.hxx"
+#include "frmtool.hxx"
+#include "section.hxx"
+#include "node2lay.hxx"
+namespace binfilter {
+
+
+/* -----------------25.02.99 10:31-------------------
+ * Die SwNode2LayImpl-Klasse erledigt die eigentliche Arbeit,
+ * die SwNode2Layout-Klasse ist nur die der Oefffentlichkeit bekannte Schnittstelle
+ * --------------------------------------------------*/
+/*N*/ class SwNode2LayImpl
+/*N*/ {
+/*N*/ SwClientIter *pIter; // Der eigentliche Iterator
+/*N*/ SvPtrarr *pUpperFrms;// Zum Einsammeln der Upper
+/*N*/ ULONG nIndex; // Der Index des einzufuegenden Nodes
+/*N*/ BOOL bMaster : 1; // TRUE => nur Master , FALSE => nur Frames ohne Follow
+/*N*/ BOOL bInit : 1; // Ist am SwClient bereits ein First()-Aufruf erfolgt?
+/*N*/ public:
+/*N*/ SwNode2LayImpl( const SwNode& rNode, ULONG nIdx, BOOL bSearch );
+/*N*/ ~SwNode2LayImpl() { delete pIter; delete pUpperFrms; }
+/*N*/ SwFrm* NextFrm(); // liefert den naechsten "sinnvollen" Frame
+/*N*/ SwLayoutFrm* UpperFrm( SwFrm* &rpFrm, const SwNode &rNode );
+/*N*/ void SaveUpperFrms(); // Speichert (und lockt ggf.) die pUpper
+/*N*/ // Fuegt unter jeden pUpper des Arrays einen Frame ein.
+/*N*/ void RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd );
+/*N*/
+/*N*/ };
+
+/* -----------------25.02.99 10:38-------------------
+ * Hauptaufgabe des Ctor: Das richtige SwModify zu ermitteln,
+ * ueber das iteriert wird.
+ * Uebergibt man bSearch == TRUE, so wird der naechste Cntnt- oder TableNode
+ * gesucht, der Frames besitzt ( zum Einsammeln der pUpper ), ansonsten wird
+ * erwartet, das rNode bereits auf einem solchen Cntnt- oder TableNode sitzt,
+ * vor oder hinter den eingefuegt werden soll.
+ * --------------------------------------------------*/
+
+/*N*/ SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, ULONG nIdx, BOOL bSearch )
+/*N*/ : pUpperFrms( NULL ), nIndex( nIdx ), bInit( FALSE )
+/*N*/ {
+/*N*/ const SwNode* pNd = NULL;
+/*N*/ if( bSearch || rNode.IsSectionNode() )
+/*N*/ {
+/*N*/ // Suche den naechsten Cntnt/TblNode, der einen Frame besitzt,
+/*N*/ // damit wir uns vor/hinter ihn haengen koennen
+/*N*/ if( !bSearch && rNode.GetIndex() < nIndex )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwNodeIndex aTmp( *rNode.EndOfSectionNode(), +1 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwNodeIndex aTmp( rNode, -1 );
+/*N*/ pNd = rNode.GetNodes().GoNextWithFrm( &aTmp );
+/*N*/ bMaster = TRUE;
+/*N*/ if( !bSearch && pNd && rNode.EndOfSectionIndex() < pNd->GetIndex() )
+/*N*/ pNd = NULL; // Nicht ueber den Bereich hinausschiessen
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pNd = &rNode;
+/*N*/ bMaster = nIndex < rNode.GetIndex();
+/*N*/ }
+/*N*/ if( pNd )
+/*N*/ {
+/*N*/ SwModify *pMod;
+/*N*/ if( pNd->IsCntntNode() )
+/*?*/ pMod = (SwModify*)pNd->GetCntntNode();
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( pNd->IsTableNode(), "For Tablenodes only" );
+/*?*/ pMod = pNd->GetTableNode()->GetTable().GetFrmFmt();
+/*N*/ }
+/*N*/ pIter = new SwClientIter( *pMod );
+/*N*/ }
+/*N*/ else
+/*N*/ pIter = NULL;
+/*N*/ }
+
+/* -----------------25.02.99 10:41-------------------
+ * SwNode2LayImpl::NextFrm() liefert den naechsten "sinnvollen" Frame,
+ * beim ersten Aufruf wird am eigentlichen Iterator ein First gerufen,
+ * danach die Next-Methode. Das Ergebnis wird auf Brauchbarkeit untersucht,
+ * so werden keine Follows akzeptiert, ein Master wird beim Einsammeln der
+ * pUpper und beim Einfuegen vor ihm akzeptiert. Beim Einfuegen dahinter
+ * wird vom Master ausgehend der letzte Follow gesucht und zurueckgegeben.
+ * Wenn der Frame innerhalb eines SectionFrms liegt, wird noch festgestellt,
+ * ob statt des Frames der SectionFrm der geeignete Rueckgabewert ist, dies
+ * ist der Fall, wenn der neu einzufuegende Node ausserhalb des Bereichs liegt.
+ * --------------------------------------------------*/
+/*N*/ SwFrm* SwNode2LayImpl::NextFrm()
+/*N*/ {
+/*N*/ SwFrm* pRet;
+/*N*/ if( !pIter )
+/*N*/ return FALSE;
+/*N*/ if( !bInit )
+/*N*/ {
+/*N*/ pRet = (SwFrm*)pIter->First(TYPE(SwFrm));
+/*N*/ bInit = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ pRet = (SwFrm*)pIter->Next();
+/*N*/ while( pRet )
+/*N*/ {
+/*N*/ SwFlowFrm* pFlow = SwFlowFrm::CastFlowFrm( pRet );
+/*N*/ ASSERT( pFlow, "Cntnt or Table expected?!" );
+/*N*/ // Follows sind fluechtige Gestalten, deshalb werden sie ignoriert.
+/*N*/ // Auch wenn wir hinter dem Frame eingefuegt werden sollen, nehmen wir
+/*N*/ // zunaechst den Master, hangeln uns dann aber zum letzten Follow durch.
+/*N*/ if( !pFlow->IsFollow() )
+/*N*/ {
+/*N*/ if( !bMaster )
+/*N*/ {
+/*N*/ while( pFlow->HasFollow() )
+/*N*/ pFlow = pFlow->GetFollow();
+/*N*/ pRet = pFlow->GetFrm();
+/*N*/ }
+/*N*/ if( pRet->IsInSct() )
+/*N*/ {
+/*N*/ SwSectionFrm* pSct = pRet->FindSctFrm();
+/*N*/ // Vorsicht: Wenn wir in einer Fussnote sind, so kann diese
+/*N*/ // Layoutmaessig in einem spaltigen Bereich liegen, obwohl
+/*N*/ // sie nodemaessig ausserhalb liegt. Deshalb muss bei Fussnoten
+/*N*/ // ueberprueft werden, ob auch der SectionFrm in der Fussnote
+/*N*/ // und nicht ausserhalb liegt.
+/*N*/ if( !pRet->IsInFtn() || pSct->IsInFtn() )
+/*N*/ {
+/*N*/ ASSERT( pSct && pSct->GetSection(), "Where's my section?" );
+/*N*/ SwSectionNode* pNd = pSct->GetSection()->GetFmt()->GetSectionNode();
+/*N*/ ASSERT( pNd, "Lost SectionNode" );
+/*N*/ // Wenn der erhaltene Frame in einem Bereichsframe steht,
+/*N*/ // dessen Bereich den Ausgangsnode nicht umfasst, so kehren
+/*N*/ // wir mit dem SectionFrm zurueck, sonst mit dem Cntnt/TabFrm
+/*N*/ if( bMaster )
+/*N*/ {
+/*N*/ if( pNd->GetIndex() >= nIndex )
+/*N*/ pRet = pSct;
+/*N*/ }
+/*N*/ else if( pNd->EndOfSectionIndex() < nIndex )
+/*N*/ pRet = pSct;
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+/*N*/ pRet = (SwFrm*)pIter->Next();
+/*N*/ }
+/*N*/ return NULL;
+/*N*/ }
+
+/*N*/ void SwNode2LayImpl::SaveUpperFrms()
+/*N*/ {
+/*N*/ pUpperFrms = new SvPtrarr( 0, 20 );
+/*N*/ SwFrm* pFrm;
+/*N*/ while( 0 != (pFrm = NextFrm()) )
+/*N*/ {
+/*N*/ SwFrm* pPrv = pFrm->GetPrev();
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsFtnFrm() )
+/*?*/ ((SwFtnFrm*)pFrm)->ColLock();
+/*N*/ else if( pFrm->IsInSct() )
+/*?*/ pFrm->FindSctFrm()->ColLock();
+/*N*/ if( pPrv && pPrv->IsSctFrm() )
+/*N*/ ((SwSectionFrm*)pPrv)->LockJoin();
+/*N*/ pUpperFrms->Insert( (void*)pPrv, pUpperFrms->Count() );
+/*N*/ pUpperFrms->Insert( (void*)pFrm, pUpperFrms->Count() );
+/*N*/ }
+/*N*/ }
+/*N*/ delete pIter;
+/*N*/ pIter = NULL;
+/*N*/ }
+
+/*N*/ SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
+/*N*/ {
+/*N*/ rpFrm = NextFrm();
+/*N*/ if( !rpFrm )
+/*N*/ return NULL;
+/*N*/ SwLayoutFrm* pUpper = rpFrm->GetUpper();
+/*N*/ if( rpFrm->IsSctFrm() )
+/*N*/ {
+/*?*/ const SwNode* pNode = rNode.StartOfSectionNode();
+/*?*/ if( pNode->IsSectionNode() )
+/*?*/ {
+/*?*/ SwFrm* pFrm = bMaster ? rpFrm->FindPrev() : rpFrm->FindNext();
+/*?*/ if( pFrm && pFrm->IsSctFrm() )
+/*?*/ {
+/*?*/ if( ((SwSectionNode*)pNode)->GetSection() ==
+/*?*/ *((SwSectionFrm*)pFrm)->GetSection() )
+/*?*/ {
+/*?*/ rpFrm = bMaster ? NULL : ((SwLayoutFrm*)pFrm)->Lower();
+/*?*/ return ((SwLayoutFrm*)pFrm);
+/*?*/ }
+/*?*/ pUpper = new SwSectionFrm(((SwSectionNode*)pNode)->GetSection());
+/*?*/ pUpper->Paste( rpFrm->GetUpper(),
+/*?*/ bMaster ? rpFrm : rpFrm->GetNext() );
+/*?*/ static_cast<SwSectionFrm*>(pUpper)->Init();
+/*?*/ rpFrm = NULL;
+/*?*/ return pUpper;
+/*?*/ }
+/*?*/ }
+/*N*/ };
+/*N*/ if( !bMaster )
+/*N*/ rpFrm = rpFrm->GetNext();
+/*N*/ return pUpper;
+/*N*/ }
+
+/*N*/ void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd )
+/*N*/ {
+/*N*/ ASSERT( pUpperFrms, "RestoreUpper without SaveUpper?" )
+/*N*/ SwNode* pNd;
+/*N*/ SwDoc *pDoc = rNds.GetDoc();
+/*N*/ BOOL bFirst = TRUE;
+/*N*/ for( ; nStt < nEnd; ++nStt )
+/*N*/ {
+/*N*/ SwFrm* pNew = 0;
+/*N*/ SwFrm* pNxt;
+/*N*/ SwLayoutFrm* pUp;
+/*N*/ if( (pNd = rNds[nStt])->IsCntntNode() )
+/*?*/ for( USHORT n = 0; n < pUpperFrms->Count(); )
+/*?*/ {
+/*?*/ pNxt = (SwFrm*)(*pUpperFrms)[n++];
+/*?*/ if( bFirst && pNxt && pNxt->IsSctFrm() )
+/*?*/ ((SwSectionFrm*)pNxt)->UnlockJoin();
+/*?*/ pUp = (SwLayoutFrm*)(*pUpperFrms)[n++];
+/*?*/ if( pNxt )
+/*?*/ pNxt = pNxt->GetNext();
+/*?*/ else
+/*?*/ pNxt = pUp->Lower();
+/*?*/ pNew = ((SwCntntNode*)pNd)->MakeFrm();
+/*?*/ pNew->Paste( pUp, pNxt );
+/*?*/ (*pUpperFrms)[n-2] = pNew;
+/*?*/ }
+/*N*/ else if( pNd->IsTableNode() )
+/*?*/ for( USHORT x = 0; x < pUpperFrms->Count(); )
+/*?*/ {
+/*?*/ pNxt = (SwFrm*)(*pUpperFrms)[x++];
+/*?*/ if( bFirst && pNxt && pNxt->IsSctFrm() )
+/*?*/ ((SwSectionFrm*)pNxt)->UnlockJoin();
+/*?*/ pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
+/*?*/ if( pNxt )
+/*?*/ pNxt = pNxt->GetNext();
+/*?*/ else
+/*?*/ pNxt = pUp->Lower();
+/*?*/ pNew = ((SwTableNode*)pNd)->MakeFrm();
+/*?*/ ASSERT( pNew->IsTabFrm(), "Table exspected" );
+/*?*/ pNew->Paste( pUp, pNxt );
+/*?*/ ((SwTabFrm*)pNew)->RegistFlys();
+/*?*/ (*pUpperFrms)[x-2] = pNew;
+/*?*/ }
+/*N*/ else if( pNd->IsSectionNode() )
+/*N*/ {
+/*N*/ nStt = pNd->EndOfSectionIndex();
+/*N*/ for( USHORT x = 0; x < pUpperFrms->Count(); )
+/*N*/ {
+/*N*/ pNxt = (SwFrm*)(*pUpperFrms)[x++];
+/*N*/ if( bFirst && pNxt && pNxt->IsSctFrm() )
+/*N*/ ((SwSectionFrm*)pNxt)->UnlockJoin();
+/*N*/ pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
+/*N*/ ASSERT( pUp->GetUpper() || pUp->IsFlyFrm(), "Lost Upper" );
+/*N*/ ::binfilter::_InsertCnt( pUp, pDoc, pNd->GetIndex(), FALSE, nStt+1, pNxt );
+/*N*/ pNxt = pUp->Lower();
+/*N*/ if( pNxt )
+/*N*/ while( pNxt->GetNext() )
+/*N*/ pNxt = pNxt->GetNext();
+/*N*/ (*pUpperFrms)[x-2] = pNxt;
+/*N*/ }
+/*N*/ }
+/*N*/ bFirst = FALSE;
+/*N*/ }
+/*N*/ for( USHORT x = 0; x < pUpperFrms->Count(); ++x )
+/*N*/ {
+/*N*/ SwFrm* pTmp = (SwFrm*)(*pUpperFrms)[++x];
+/*N*/ if( pTmp->IsFtnFrm() )
+/*?*/ ((SwFtnFrm*)pTmp)->ColUnlock();
+/*N*/ else if( pTmp->IsInSct() )
+/*?*/ pTmp->FindSctFrm()->ColUnlock();
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwNode2Layout::SwNode2Layout( const SwNode& rNd, ULONG nIdx )
+/*N*/ {
+/*N*/ pImpl = new SwNode2LayImpl( rNd, nIdx, FALSE );
+/*N*/ }
+
+/*N*/ SwNode2Layout::SwNode2Layout( const SwNode& rNd )
+/*N*/ {
+/*N*/ pImpl = new SwNode2LayImpl( rNd, rNd.GetIndex(), TRUE );
+/*N*/ pImpl->SaveUpperFrms();
+/*N*/ }
+
+/*N*/ void SwNode2Layout::RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd )
+/*N*/ {
+/*N*/ ASSERT( pImpl, "RestoreUpperFrms without SaveUpperFrms" );
+/*N*/ pImpl->RestoreUpperFrms( rNds, nStt, nEnd );
+/*N*/ }
+
+/*N*/ SwFrm* SwNode2Layout::NextFrm()
+/*N*/ {
+/*N*/ return pImpl->NextFrm();
+/*N*/ }
+
+/*N*/ SwLayoutFrm* SwNode2Layout::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
+/*N*/ {
+/*N*/ return pImpl->UpperFrm( rpFrm, rNode );
+/*N*/ }
+
+/*N*/ SwNode2Layout::~SwNode2Layout()
+/*N*/ {
+/*N*/ delete pImpl;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_nodes.cxx b/binfilter/bf_sw/source/core/docnode/sw_nodes.cxx
new file mode 100644
index 000000000000..c8dc613a8b25
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_nodes.cxx
@@ -0,0 +1,1421 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdlib.h>
+
+#include <errhdl.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pam.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <hints.hxx>
+#include <ndtxt.hxx>
+#include <section.hxx>
+#include <ddefld.hxx>
+#include <swddetbl.hxx>
+#include <frame.hxx>
+namespace binfilter {//STRIP009
+/*N*/ extern FASTBOOL CheckNodesRange( const SwNodeIndex& rStt,
+/*N*/ const SwNodeIndex& rEnd, FASTBOOL bChkSection );
+
+SV_DECL_PTRARR(SwSttNdPtrs,SwStartNode*,2,2)//STRIP008 ;
+} //namespace binfilter
+
+//#define JP_DEBUG
+#ifdef JP_DEBUG
+#endif
+namespace binfilter {
+
+
+// Funktion zum bestimmen des hoechsten Levels innerhalb des Bereiches
+
+
+//-----------------------------------------------------------------------
+
+/*******************************************************************
+|* SwNodes::SwNodes
+|*
+|* Beschreibung
+|* Konstruktor; legt die vier Grundsektions (PostIts,
+|* Inserts, Icons, Inhalt) an
+*******************************************************************/
+/*N*/ SwNodes::SwNodes( SwDoc* pDocument )
+/*N*/ : pMyDoc( pDocument ), pRoot( 0 )
+/*N*/ {
+/*N*/ bInNodesDel = bInDelUpdOutl = bInDelUpdNum = FALSE;
+/*N*/
+/*N*/ ASSERT( pMyDoc, "in welchem Doc stehe ich denn?" );
+/*N*/
+/*N*/ ULONG nPos = 0;
+/*N*/ SwStartNode* pSttNd = new SwStartNode( *this, nPos++ );
+/*N*/ pEndOfPostIts = new SwEndNode( *this, nPos++, *pSttNd );
+/*N*/
+/*N*/ SwStartNode* pTmp = new SwStartNode( *this, nPos++ );
+/*N*/ pEndOfInserts = new SwEndNode( *this, nPos++, *pTmp );
+/*N*/
+/*N*/ pTmp = new SwStartNode( *this, nPos++ );
+/*N*/ pTmp->pStartOfSection = pSttNd;
+/*N*/ pEndOfAutotext = new SwEndNode( *this, nPos++, *pTmp );
+/*N*/
+/*N*/ pTmp = new SwStartNode( *this, nPos++ );
+/*N*/ pTmp->pStartOfSection = pSttNd;
+/*N*/ pEndOfRedlines = new SwEndNode( *this, nPos++, *pTmp );
+/*N*/
+/*N*/ pTmp = new SwStartNode( *this, nPos++ );
+/*N*/ pTmp->pStartOfSection = pSttNd;
+/*N*/ pEndOfContent = new SwEndNode( *this, nPos++, *pTmp );
+/*N*/
+/*N*/ pOutlineNds = new SwOutlineNodes;
+/*N*/ }
+
+/*******************************************************************
+|*
+|* SwNodes::~SwNodes
+|*
+|* Beschreibung
+|* dtor, loescht alle Nodes, deren Pointer in diesem dynamischen
+|* Array sind. Ist kein Problem, da Nodes ausserhalb dieses
+|* Arrays nicht erzeugt werden koennen und somit auch nicht
+|* in mehreren drin sein koennen
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+/*N*/ SwNodes::~SwNodes()
+/*N*/ {
+/*N*/ delete pOutlineNds;
+/*N*/
+/*N*/ {
+/*N*/ SwNode *pNode;
+/*N*/ SwNodeIndex aNdIdx( *this );
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ pNode = &aNdIdx.GetNode();
+/*N*/ if( pNode == pEndOfContent )
+/*N*/ break;
+/*N*/
+/*N*/ aNdIdx++;
+/*N*/ delete pNode;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // jetzt muessen alle SwNodeIndizies abgemeldet sein!!!
+/*N*/ delete pEndOfContent;
+/*N*/ }
+
+/*******************************************************************
+|*
+|* SwNodes::SectionDown
+|*
+|* Beschreibung
+|* SectionDown() legt ein Paar von Start- und EndSection-Node
+|* (andere Nodes koennen dazwischen liegen) an.
+|*
+|* Zustand des SRange beim Verlassen der Funktion: nStart ist der
+|* Index des ersten Node hinter dem Start Section Node, nEnd ist
+|* der Index des End Section Nodes. Beispiel: Wird Insert Section
+|* mehrmals hintereinander aufgerufen, so werden mehrere
+|* unmittelbar geschachtelte Sections (keine Content Nodes
+|* zwischen Start- bzw. End Nodes) angelegt.
+|*
+|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
+|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
+|*
+|* Parameter
+|* SwRange &rRange
+|* IO:
+|* IN
+|* rRange.aStart: Einfuegeposition des StartNodes
+|* rRange.aEnd: Einfuegeposition des EndNodes
+|* OUT
+|* rRange.aStart: steht hinter dem eingefuegten Startnode
+|* rRange.aEnd: steht auf dem eingefuegen Endnode
+|*
+|* Ausnahmen
+|* 1. SRange-Anfang und SRange-Ende muessen auf dem gleichen Level sein
+|* 2. duerfen nicht auf dem obersten Level sein
+|* Ist dies nicht der Fall, wird die
+|* Funktion durch Aufruf von ERR_RAISE verlassen.
+|*
+|* Debug-Funktionen
+|* die Debugging Tools geben rRange beim Eintritt und beim
+|* Verlassen der Funktion aus
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+/*N*/ void SwNodes::SectionDown(SwNodeRange *pRange, SwStartNodeType eSttNdTyp )
+/*N*/ {
+/*N*/ if( pRange->aStart >= pRange->aEnd ||
+/*N*/ pRange->aEnd >= Count() ||
+/*N*/ !CheckNodesRange( pRange->aStart, pRange->aEnd ))
+/*?*/ return;
+/*N*/
+/*N*/ // Ist der Anfang vom Bereich vor oder auf einem EndNode, so loesche
+/*N*/ // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen.
+/*N*/ // Bei anderen Nodes wird eine neuer StartNode eingefuegt
+/*N*/ SwNode * pAktNode = &pRange->aStart.GetNode();
+/*N*/ SwNodeIndex aTmpIdx( *pAktNode->StartOfSectionNode() );
+/*N*/
+/*N*/ if( pAktNode->GetEndNode() )
+/*?*/ DelNodes( pRange->aStart, 1 ); // verhinder leere Section
+/*N*/ else
+/*N*/ {
+/*N*/ // fuege einen neuen StartNode ein
+/*N*/ SwNode* pSttNd = new SwStartNode( pRange->aStart, ND_STARTNODE, eSttNdTyp );
+/*N*/ pRange->aStart = *pSttNd;
+/*N*/ aTmpIdx = pRange->aStart;
+/*N*/ }
+/*N*/
+/*N*/ // Ist das Ende vom Bereich vor oder auf einem StartNode, so loesche
+/*N*/ // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen
+/*N*/ // Bei anderen Nodes wird eine neuer EndNode eingefuegt
+/*N*/ pRange->aEnd--;
+/*N*/ if( pRange->aEnd.GetNode().GetStartNode() )
+/*?*/ DelNodes( pRange->aEnd, 1 );
+/*N*/ else
+/*N*/ {
+/*N*/ pRange->aEnd++;
+/*N*/ // fuege einen neuen EndNode ein
+/*N*/ new SwEndNode( pRange->aEnd, *pRange->aStart.GetNode().GetStartNode() );
+/*N*/ }
+/*N*/ pRange->aEnd--;
+/*N*/
+/*N*/ SectionUpDown( aTmpIdx, pRange->aEnd );
+/*N*/ }
+
+/*******************************************************************
+|*
+|* SwNodes::SectionUp
+|*
+|* Beschreibung
+|* Der von rRange umspannte Bereich wird auf die naechst hoehere
+|* Ebene gehoben. Das geschieht dadurch, dass bei
+|* rRange.aStart ein Endnode und bei rRange.aEnd ein
+|* Startnode eingefuegt wird. Die Indices fuer den Bereich
+|* innerhalb von rRange werden geupdated.
+|*
+|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
+|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
+|*
+|* Parameter
+|* SwRange &rRange
+|* IO:
+|* IN
+|* rRange.aStart: Anfang des hoeher zubewegenden Bereiches
+|* rRange.aEnd: der 1.Node hinter dem Bereich
+|* OUT
+|* rRange.aStart: an der ersten Position innerhalb des
+|* hochbewegten Bereiches
+|* rRange.aEnd: an der letzten Position innerhalb des
+|* hochbewegten Bereiches
+|*
+|* Debug-Funktionen
+|* die Debugging Tools geben rRange beim Eintritt und beim
+|* Verlassen der Funktion aus
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwNodes::SectionUpDown()
+|*
+|* Beschreibung
+|* Methode setzt die Indizies die bei SectionUp oder SectionDwon
+|* veraendert wurden wieder richtig, sodass die Ebenen wieder
+|* Konsistent sind.
+|*
+|* Parameter
+|* SwIndex & aStart StartNode !!!
+|* SwIndex & aEnd EndPunkt
+|*
+|* Ersterstellung JP 23.04.91
+|* Letzte Aenderung JP 23.04.91
+|*
+*************************************************************************/
+/*N*/ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEnd )
+/*N*/ {
+/*N*/ SwNode * pAktNode;
+/*N*/ SwNodeIndex aTmpIdx( aStart, +1 );
+/*N*/ // das Array bildet einen Stack, es werden alle StartOfSelction's gesichert
+/*N*/ SwSttNdPtrs aSttNdStack( 1, 5 );
+/*N*/ SwStartNode* pTmp = aStart.GetNode().GetStartNode();
+/*N*/ aSttNdStack.C40_INSERT( SwStartNode, pTmp, 0 );
+/*N*/
+/*N*/ // durchlaufe bis der erste zu aendernde Start-Node gefunden wurde
+/*N*/ // ( Es wird vom eingefuegten EndNode bis nach vorne die Indexe gesetzt )
+/*N*/ for( ;; aTmpIdx++ )
+/*N*/ {
+/*N*/ pAktNode = &aTmpIdx.GetNode();
+/*N*/ pAktNode->pStartOfSection = aSttNdStack[ aSttNdStack.Count()-1 ];
+/*N*/
+/*N*/ if( pAktNode->GetStartNode() )
+/*N*/ {
+/*?*/ pTmp = (SwStartNode*)pAktNode;
+/*?*/ aSttNdStack.C40_INSERT( SwStartNode, pTmp, aSttNdStack.Count() );
+/*N*/ }
+/*N*/ else if( pAktNode->GetEndNode() )
+/*N*/ {
+/*N*/ SwStartNode* pSttNd = aSttNdStack[ aSttNdStack.Count() - 1 ];
+/*N*/ pSttNd->pEndOfSection = (SwEndNode*)pAktNode;
+/*N*/ aSttNdStack.Remove( aSttNdStack.Count() - 1 );
+/*N*/ if( aSttNdStack.Count() )
+/*?*/ continue; // noch genuegend EndNodes auf dem Stack
+/*N*/
+/*N*/ else if( aTmpIdx < aEnd ) // Uebergewicht an StartNodes
+/*N*/ // ist das Ende noch nicht erreicht, so hole den Start von
+/*N*/ // der uebergeordneten Section
+/*N*/ {
+/*?*/ aSttNdStack.C40_INSERT( SwStartNode, pSttNd->pStartOfSection, 0 );
+/*N*/ }
+/*N*/ else // wenn ueber den Bereich hinaus, dann Ende
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+
+/*******************************************************************
+|*
+|* SwNodes::Delete
+|*
+|* Beschreibung
+|* Spezielle Implementierung der Delete-Funktion des
+|* variablen Array. Diese spezielle Implementierung ist
+|* notwendig, da durch das Loeschen von Start- bzw.
+|* Endnodes Inkonsistenzen entstehen koennen. Diese werden
+|* durch diese Funktion beseitigt.
+|*
+|* Parameter
+|* IN
+|* SwIndex &rIndex bezeichnet die Position, an der
+|* geloescht wird
+|* rIndex ist nach Aufruf der Funktion unveraendert (Kopie?!)
+|* USHORT nNodes bezeichnet die Anzahl der zu loeschenden
+|* Nodes; ist auf 1 defaulted
+|*
+|* Debug-Funktionen
+|* geben beim Eintritt in die Funktion Position und Anzahl
+|* der zu loeschenden Nodes aus.
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+/*N*/ void SwNodes::Delete(const SwNodeIndex &rIndex, ULONG nNodes)
+/*N*/ {
+/*N*/ USHORT nLevel = 0; // Level-Counter
+/*N*/ SwNode * pAktNode;
+/*N*/
+/*N*/ ULONG nCnt = Count() - rIndex.GetIndex() - 1;
+/*N*/ if( nCnt > nNodes ) nCnt = nNodes;
+/*N*/
+/*N*/ if( nCnt == 0 ) // keine Anzahl -> return
+/*?*/ return;
+/*N*/
+/*N*/ SwNodeRange aRg( rIndex, 0, rIndex, nCnt-1 );
+/*N*/ // ueberprufe ob rIndex..rIndex + nCnt ueber einen Bereich hinausragt !!
+/*N*/ if( ( !aRg.aStart.GetNode().StartOfSectionIndex() &&
+/*N*/ !aRg.aStart.GetIndex() ) ||
+/*N*/ ! CheckNodesRange( aRg.aStart, aRg.aEnd ) )
+/*?*/ return;
+/*N*/
+/*N*/
+/*N*/ // falls aEnd auf keinem ContentNode steht, dann suche den vorherigen
+/*N*/ while( ( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() ||
+/*N*/ ( pAktNode->GetEndNode() &&
+/*N*/ !pAktNode->pStartOfSection->IsTableNode() ))
+/*?*/ aRg.aEnd--;
+/*N*/
+/*N*/ nCnt = 0;
+/*N*/ // Start erhoehen, damit auf < abgefragt wird. ( bei <= kann es zu
+/*N*/ // Problemen fuehren; ist aEnd == aStart und wird aEnd geloscht,
+/*N*/ // so ist aEnd <= aStart
+/*N*/ aRg.aStart--;
+/*N*/
+/*N*/ BOOL bSaveInNodesDel = bInNodesDel;
+/*N*/ bInNodesDel = TRUE;
+/*N*/ BOOL bUpdateOutline = FALSE;
+/*N*/
+/*N*/ // bis alles geloescht ist
+/*N*/ while( aRg.aStart < aRg.aEnd )
+/*N*/ {
+/*N*/ pAktNode = &aRg.aEnd.GetNode();
+/*N*/
+/*N*/ if( pAktNode->GetEndNode() )
+/*N*/ {
+/*N*/ // die gesamte Section loeschen ?
+/*N*/ if( pAktNode->StartOfSectionIndex() > aRg.aStart.GetIndex() )
+/*N*/ {
+/*N*/ SwTableNode* pTblNd = pAktNode->pStartOfSection->GetTableNode();
+/*N*/ if( pTblNd )
+/*N*/ pTblNd->DelFrms();
+/*N*/
+/*N*/ SwNode *pNd, *pChkNd = pAktNode->pStartOfSection;
+/*N*/ USHORT nIdxPos;
+/*N*/ do {
+/*N*/ pNd = &aRg.aEnd.GetNode();
+/*N*/
+/*N*/ if( pNd->IsTxtNode() )
+/*N*/ {
+/*N*/ if( NO_NUMBERING !=
+/*N*/ ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() &&
+/*N*/ pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
+/*N*/ {
+/*?*/ // loesche die Gliederungs-Indizies.
+/*?*/ pOutlineNds->Remove( nIdxPos );
+/*?*/ bUpdateOutline = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pNd->IsEndNode() &&
+/*N*/ pNd->pStartOfSection->IsTableNode() )
+/*N*/ ((SwTableNode*)pNd->pStartOfSection)->DelFrms();
+/*N*/
+/*N*/ aRg.aEnd--;
+/*N*/ nCnt++;
+/*N*/
+/*N*/ } while( pNd != pChkNd );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ RemoveNode( aRg.aEnd.GetIndex()+1, nCnt, TRUE ); // loesche
+/*?*/ nCnt = 0;
+/*?*/ aRg.aEnd--; // vor den EndNode
+/*?*/ nLevel++;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pAktNode->GetStartNode() ) // StartNode gefunden
+/*N*/ {
+/*?*/ if( nLevel == 0 ) // es wird eine Stufe runter gestuft
+/*?*/ {
+/*?*/ if( nCnt )
+/*?*/ {
+/*?*/ // loesche jetzt das Array
+/*?*/ aRg.aEnd++;
+/*?*/ RemoveNode( aRg.aEnd.GetIndex(), nCnt, TRUE );
+/*?*/ nCnt = 0;
+/*?*/ }
+/*?*/ }
+/*?*/ else // es werden alle Nodes Innerhalb eines Start- und
+/*?*/ { // End-Nodes geloescht, loesche mit Start/EndNode
+/*?*/ RemoveNode( aRg.aEnd.GetIndex(), nCnt + 2, TRUE ); // loesche Array
+/*?*/ nCnt = 0;
+/*?*/ nLevel--;
+/*?*/ }
+/*?*/
+/*?*/ // nach dem loeschen kann aEnd auf einem EndNode stehen
+/*?*/ // loesche alle leeren Start-/End-Node-Paare
+/*?*/ SwNode* pTmpNode = aRg.aEnd.GetNode().GetEndNode();
+/*?*/ aRg.aEnd--;
+/*?*/ while( pTmpNode &&
+/*?*/ ( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() &&
+/*?*/ pAktNode->StartOfSectionIndex() )
+/*?*/ {
+/*?*/ // loesche den EndNode und StartNode
+/*?*/ DelNodes( aRg.aEnd, 2 );
+/*?*/ pTmpNode = aRg.aEnd.GetNode().GetEndNode();
+/*?*/ aRg.aEnd--;
+/*?*/ }
+/*N*/ }
+/*N*/ else // normaler Node, also ins TmpArray einfuegen
+/*N*/ {
+/*N*/ SwTxtNode* pTxtNd = pAktNode->GetTxtNode();
+/*N*/ if( pTxtNd )
+/*N*/ {
+/*N*/ if( NO_NUMBERING != pTxtNd->GetTxtColl()->GetOutlineLevel() )
+/*N*/ { // loesche die Gliederungs-Indizies.
+/*N*/ pOutlineNds->Remove( pTxtNd );
+/*N*/ bUpdateOutline = TRUE;
+/*N*/ }
+/*N*/ pTxtNd->InvalidateNumRule();
+/*N*/ }
+/*N*/ else if( pAktNode->IsCntntNode() )
+/*?*/ ((SwCntntNode*)pAktNode)->InvalidateNumRule();
+/*N*/
+/*N*/ aRg.aEnd--;
+/*N*/ nCnt++;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ aRg.aEnd++;
+/*N*/ if( nCnt != 0 )
+/*N*/ RemoveNode( aRg.aEnd.GetIndex(), nCnt, TRUE ); // loesche den Rest
+/*N*/
+/*N*/ // loesche alle leeren Start-/End-Node-Paare
+/*N*/ while( aRg.aEnd.GetNode().GetEndNode() &&
+/*N*/ ( pAktNode = &aRg.aStart.GetNode())->GetStartNode() &&
+/*N*/ pAktNode->StartOfSectionIndex() )
+/*N*/ // aber ja keinen der heiligen 5.
+/*N*/ {
+/*?*/ DelNodes( aRg.aStart, 2 ); // loesche den Start- und EndNode
+/*?*/ aRg.aStart--;
+/*N*/ }
+/*N*/
+/*N*/ bInNodesDel = bSaveInNodesDel;
+/*N*/
+/*N*/ if( !bInNodesDel )
+/*N*/ {
+/*N*/ // rufe jetzt noch das Update fuer die Gliederung/Nummerierung auf
+/*N*/ if( bUpdateOutline || bInDelUpdOutl )
+/*N*/ {
+/*N*/ UpdtOutlineIdx( aRg.aEnd.GetNode() );
+/*N*/ bInDelUpdOutl = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ if( bUpdateOutline )
+/*?*/ bInDelUpdOutl = TRUE;
+/*N*/ }
+/*N*/ }
+
+/*******************************************************************
+|*
+|* SwNodes::GetSectionLevel
+|*
+|* Beschreibung
+|* Die Funktion liefert den Sectionlevel an der durch
+|* aIndex bezeichneten Position. Die Funktion ruft die
+|* GetSectionlevel-Funktion des durch aIndex bezeichneten
+|* Nodes. Diese ist eine virtuelle Funktion, die fuer
+|* Endnodes speziell implementiert werden musste.
+|* Die Sectionlevels werden ermittelt, indem rekursiv durch
+|* die Nodesstruktur (jeweils zum naechsten theEndOfSection)
+|* gegangen wird, bis die oberste Ebene erreicht ist
+|* (theEndOfSection == 0)
+|*
+|* Parameter
+|* aIndex bezeichnet die Position des Nodes, dessen
+|* Sectionlevel ermittelt werden soll. Hier wird eine Kopie
+|* uebergeben, da eine Veraenderung der Variablen in der
+|* rufenden Funktion nicht wuenschenswert ist.
+|*
+|* Ausnahmen
+|* Der erste Node im Array sollte immer ein Startnode sein.
+|* Dieser erfaehrt in der Funktion SwNodes::GetSectionLevel()
+|* eine Sonderbehandlung; es wird davon ausgegangen, dass der
+|* erste Node auch ein Startnode ist.
+|*
+|* Ersterstellung
+|* VER0100 vb 901214
+|*
+|* Stand
+|* VER0100 vb 901214
+|*
+*******************************************************************/
+
+/*N*/ void SwNodes::GoStartOfSection(SwNodeIndex *pIdx) const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*N*/ void SwNodes::GoEndOfSection(SwNodeIndex *pIdx) const
+/*N*/ {
+/*N*/ // falls er vor einem Endnode steht --> nichts tun
+/*N*/ if( !pIdx->GetNode().IsEndNode() )
+/*N*/ (*pIdx) = *pIdx->GetNode().EndOfSectionNode();
+/*N*/ }
+
+/*N*/ SwCntntNode* SwNodes::GoNext(SwNodeIndex *pIdx) const
+/*N*/ {
+/*N*/ if( pIdx->GetIndex() >= Count() - 1 )
+/*?*/ return 0;
+/*N*/
+/*N*/ SwNodeIndex aTmp(*pIdx, +1);
+/*N*/ SwNode* pNd;
+/*N*/ while( aTmp < Count()-1 && 0 == ( pNd = &aTmp.GetNode())->IsCntntNode() )
+/*N*/ aTmp++;
+/*N*/
+/*N*/ if( aTmp == Count()-1 )
+/*N*/ pNd = 0;
+/*N*/ else
+/*N*/ (*pIdx) = aTmp;
+/*N*/ return (SwCntntNode*)pNd;
+/*N*/ }
+
+/*N*/ SwCntntNode* SwNodes::GoPrevious(SwNodeIndex *pIdx) const
+/*N*/ {
+/*N*/ if( !pIdx->GetIndex() )
+/*?*/ return 0;
+/*N*/
+/*N*/ SwNodeIndex aTmp( *pIdx, -1 );
+/*N*/ SwNode* pNd;
+/*N*/ while( aTmp.GetIndex() && 0 == ( pNd = &aTmp.GetNode())->IsCntntNode() )
+/*N*/ aTmp--;
+/*N*/
+/*N*/ if( !aTmp.GetIndex() )
+/*?*/ pNd = 0;
+/*N*/ else
+/*N*/ (*pIdx) = aTmp;
+/*N*/ return (SwCntntNode*)pNd;
+/*N*/ }
+
+/*N*/ SwNode* SwNodes::GoNextWithFrm(SwNodeIndex *pIdx) const
+/*N*/ {
+/*N*/ if( pIdx->GetIndex() >= Count() - 1 )
+/*?*/ return 0;
+/*N*/
+/*N*/ SwNodeIndex aTmp(*pIdx, +1);
+/*N*/ SwNode* pNd;
+/*N*/ while( aTmp < Count()-1 )
+/*N*/ {
+/*N*/ pNd = &aTmp.GetNode();
+/*N*/ SwModify *pMod = 0;
+/*N*/ if ( pNd->IsCntntNode() )
+/*N*/ pMod = (SwCntntNode*)pNd;
+/*N*/ else if ( pNd->IsTableNode() )
+/*N*/ pMod = ((SwTableNode*)pNd)->GetTable().GetFrmFmt();
+/*N*/ else if( pNd->IsEndNode() && !pNd->FindStartNode()->IsSectionNode() )
+/*N*/ {
+/*N*/ pNd = 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ if ( pMod && pMod->GetDepends() )
+/*N*/ {
+/*N*/ SwClientIter aIter( *pMod );
+/*N*/ if( aIter.First( TYPE(SwFrm) ) )
+/*N*/ break;
+/*N*/ }
+/*N*/ aTmp++;
+/*N*/ }
+/*N*/ if( aTmp == Count()-1 )
+/*N*/ pNd = 0;
+/*N*/ else if( pNd )
+/*N*/ (*pIdx) = aTmp;
+/*N*/ return pNd;
+/*N*/ }
+
+
+
+
+/*************************************************************************
+|*
+|* BOOL SwNodes::CheckNodesRange()
+|*
+|* Beschreibung
+|* Teste ob der uebergene SRange nicht ueber die Grenzen der
+|* einzelnen Bereiche (PosIts, Autotext, Content, Icons und Inserts )
+|* hinaus reicht.
+|* Nach Wahrscheinlichkeit des Ranges sortiert.
+|*
+|* Alg.: Da festgelegt ist, das aRange.aEnd den 1.Node hinter dem Bereich
+|* bezeichnet, wird hier auf aEnd <= End.. getestet !!
+|*
+|* Parameter SwIndex & Start-Index vom Bereich
+|* SwIndex & End-Index vom Bereich
+|* BOOL TRUE: Start+End in gleicher Section!
+|* FALSE: Start+End in verschiedenen Sect.
+|* Return-Wert BOOL TRUE: gueltiger SRange
+|* FALSE: ungueltiger SRange
+|*
+|* Ersterstellung JP 23.04.91
+|* Letzte Aenderung JP 18.06.92
+|*
+*************************************************************************/
+
+/*N*/ inline int TstIdx( ULONG nSttIdx, ULONG nEndIdx, ULONG nStt, ULONG nEnd )
+/*N*/ {
+/*N*/ return nStt < nSttIdx && nEnd >= nSttIdx &&
+/*N*/ nStt < nEndIdx && nEnd >= nEndIdx;
+/*N*/ }
+
+/*N*/ BOOL SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const
+/*N*/ {
+/*N*/ ULONG nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex();
+/*N*/ if( TstIdx( nStt, nEnd, pEndOfContent->StartOfSectionIndex(),
+/*N*/ pEndOfContent->GetIndex() )) return TRUE;
+/*?*/ if( TstIdx( nStt, nEnd, pEndOfAutotext->StartOfSectionIndex(),
+/*?*/ pEndOfAutotext->GetIndex() )) return TRUE;
+/*?*/ if( TstIdx( nStt, nEnd, pEndOfPostIts->StartOfSectionIndex(),
+/*?*/ pEndOfPostIts->GetIndex() )) return TRUE;
+/*?*/ if( TstIdx( nStt, nEnd, pEndOfInserts->StartOfSectionIndex(),
+/*?*/ pEndOfInserts->GetIndex() )) return TRUE;
+/*?*/ if( TstIdx( nStt, nEnd, pEndOfRedlines->StartOfSectionIndex(),
+/*?*/ pEndOfRedlines->GetIndex() )) return TRUE;
+/*?*/
+/*?*/ return FALSE; // liegt irgendwo dazwischen, FEHLER
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* void SwNodes::DelNodes()
+|*
+|* Beschreibung
+|* Loesche aus den NodesArray ab einer Position entsprechend Node's.
+|*
+|* Parameter SwIndex & Der Startpunkt im Nodes-Array
+|* USHORT die Anzahl
+|*
+|* Ersterstellung JP 23.04.91
+|* Letzte Aenderung JP 23.04.91
+|*
+*************************************************************************/
+/*N*/ void SwNodes::DelNodes( const SwNodeIndex & rStart, ULONG nCnt )
+/*N*/ {
+/*N*/ int bUpdateNum = 0;
+/*N*/ ULONG nSttIdx = rStart.GetIndex();
+/*N*/
+/*N*/ if( !nSttIdx && nCnt == GetEndOfContent().GetIndex()+1 )
+/*N*/ {
+/*N*/ // es wird das gesamte Nodes-Array zerstoert, man ist im Doc DTOR!
+/*N*/ // Die initialen Start-/End-Nodes duerfen nur im SwNodes-DTOR
+/*N*/ // zerstoert werden!
+/*N*/ SwNode* aEndNdArr[] = { pEndOfContent,
+/*N*/ pEndOfPostIts, pEndOfInserts,
+/*N*/ pEndOfAutotext, pEndOfRedlines,
+/*N*/ 0
+/*N*/ };
+/*N*/
+/*N*/ SwNode** ppEndNdArr = aEndNdArr;
+/*N*/ while( *ppEndNdArr )
+/*N*/ {
+/*N*/ nSttIdx = (*ppEndNdArr)->StartOfSectionIndex() + 1;
+/*N*/ ULONG nEndIdx = (*ppEndNdArr)->GetIndex();
+/*N*/
+/*N*/ if( nSttIdx != nEndIdx )
+/*N*/ RemoveNode( nSttIdx, nEndIdx - nSttIdx, TRUE );
+/*N*/
+/*N*/ ++ppEndNdArr;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ for( ULONG n = nSttIdx, nEnd = nSttIdx + nCnt; n < nEnd; ++n )
+/*N*/ {
+/*N*/ SwNode* pNd = (*this)[ n ];
+/*N*/
+/*N*/ if( pNd->IsTxtNode() &&
+/*N*/ NO_NUMBERING != ((SwTxtNode*)pNd)->GetTxtColl()->GetOutlineLevel() )
+/*N*/ { // loesche die Gliederungs-Indizies.
+/*?*/ USHORT nIdxPos;
+/*?*/ if( pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
+/*?*/ {
+/*?*/ pOutlineNds->Remove( nIdxPos );
+/*?*/ bUpdateNum = 1;
+/*?*/ }
+/*N*/ }
+/*N*/ if( pNd->IsCntntNode() )
+/*N*/ ((SwCntntNode*)pNd)->InvalidateNumRule();
+/*N*/ }
+/*N*/ RemoveNode( nSttIdx, nCnt, TRUE );
+/*N*/
+/*N*/ // rufe noch das Update fuer die Gliederungsnumerierung auf
+/*N*/ if( bUpdateNum )
+/*?*/ UpdtOutlineIdx( rStart.GetNode() );
+/*N*/ }
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* USHORT HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange )
+|*
+|* Beschreibung
+|* Berechne den hoehsten Level innerhalb des Bereiches
+|*
+|* Parameter SwNodes & das Node-Array
+|* SwNodeRange & der zu ueberpruefende Bereich
+|* Return USHORT der hoechste Level
+|*
+|* Ersterstellung JP 24.04.91
+|* Letzte Aenderung JP 24.04.91
+|*
+*************************************************************************/
+
+
+
+
+/*************************************************************************
+|*
+|* SwNodes::Move()
+|*
+|* Beschreibung
+|* Parameter SwPaM& zu kopierender Bereich
+|* SwNodes& in dieses Nodes-Array
+|* SwPosition& auf diese Position im Nodes-Array
+|* Ersterstellung JP 09.07.92
+|* Letzte Aenderung JP 09.07.92
+|*
+*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwNodes::_Copy()
+|*
+|* Beschreibung
+|* Parameter SwNodeRange& zu kopierender Bereich
+|* SwDoc& in dieses Dokument
+|* SwIndex& auf diese Position im Nodes-Array
+|* Ersterstellung JP 11.11.92
+|* Letzte Aenderung JP 11.11.92
+|*
+*************************************************************************/
+
+/*N*/ inline BYTE MaxLvl( BYTE nMin, BYTE nMax, short nNew )
+/*N*/ {
+/*N*/ return (BYTE)(nNew < nMin ? nMin : nNew > nMax ? nMax : nNew);
+/*N*/ }
+
+/*N*/ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
+/*N*/ const SwNodeIndex& rIndex, BOOL bNewFrms, BOOL bTblInsDummyNode ) const
+/*N*/ {
+/*N*/ SwDoc* pDoc = rIndex.GetNode().GetDoc();
+/*N*/
+/*N*/ SwNode * pAktNode;
+/*N*/ if( rIndex == 0 ||
+/*N*/ ( (pAktNode = &rIndex.GetNode())->GetStartNode() &&
+/*N*/ !pAktNode->StartOfSectionIndex() ))
+/*?*/ return;
+/*N*/
+/*N*/ SwNodeRange aRg( rRange );
+/*N*/
+/*N*/ // "einfache" StartNodes oder EndNodes ueberspringen
+/*N*/ while( ND_STARTNODE == (pAktNode = (*this)[ aRg.aStart ])->GetNodeType()
+/*N*/ || ( pAktNode->IsEndNode() &&
+/*N*/ !pAktNode->pStartOfSection->IsSectionNode() ) )
+/*N*/ aRg.aStart++;
+/*N*/
+/*N*/ // falls aEnd-1 auf keinem ContentNode steht, dann suche den vorherigen
+/*N*/ aRg.aEnd--;
+/*N*/ while( (( pAktNode = (*this)[ aRg.aEnd ])->GetStartNode() &&
+/*N*/ !pAktNode->IsSectionNode() ) ||
+/*N*/ ( pAktNode->IsEndNode() &&
+/*N*/ ND_STARTNODE == pAktNode->pStartOfSection->GetNodeType()) )
+/*N*/ aRg.aEnd--;
+/*N*/ aRg.aEnd++;
+/*N*/
+/*N*/ // wird im selben Array's verschoben, dann ueberpruefe die Einfuegepos.
+/*N*/ if( aRg.aStart >= aRg.aEnd )
+/*?*/ return;
+/*N*/
+/*N*/ if( this == &pDoc->GetNodes() &&
+/*N*/ rIndex.GetIndex() >= aRg.aStart.GetIndex() &&
+/*N*/ rIndex.GetIndex() < aRg.aEnd.GetIndex() )
+/*?*/ return;
+/*N*/
+/*N*/ SwNodeIndex aInsPos( rIndex );
+/*N*/ SwNodeIndex aOrigInsPos( rIndex, -1 ); // Originale Insert Pos
+/*N*/ USHORT nLevel = 0; // Level-Counter
+/*N*/
+/*N*/ for( ULONG nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
+/*N*/ nNodeCnt > 0; --nNodeCnt )
+/*N*/ {
+/*N*/ pAktNode = &aRg.aStart.GetNode();
+/*N*/ switch( pAktNode->GetNodeType() )
+/*N*/ {
+/*N*/ case ND_TABLENODE:
+/*N*/ // dann kopiere mal den TableNode
+/*N*/ // Tabelle in Tabelle kopieren ?
+/*N*/ // Tabell in Fussnote kopieren ?
+/*N*/ if( pDoc->IsIdxInTbl( aInsPos ) ||
+/*N*/ ( aInsPos < pDoc->GetNodes().GetEndOfInserts().GetIndex() &&
+/*N*/ pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
+/*N*/ < aInsPos.GetIndex() ))
+/*N*/ {
+/*?*/ nNodeCnt -=
+/*?*/ ( pAktNode->EndOfSectionIndex() -
+/*?*/ aRg.aStart.GetIndex() );
+/*?*/
+/*?*/ // dann alle Nodes der Tabelle in die akt. Zelle kopieren
+/*?*/ // fuer den TabellenNode einen DummyNode einfuegen?
+/*?*/ if( bTblInsDummyNode )
+/*?*/ new SwNode( aInsPos, ND_SECTIONDUMMY );
+/*?*/
+/*?*/ for( aRg.aStart++; aRg.aStart.GetIndex() <
+/*?*/ pAktNode->EndOfSectionIndex();
+/*?*/ aRg.aStart++ )
+/*?*/ {
+/*?*/ // fuer den Box-StartNode einen DummyNode einfuegen?
+/*?*/ if( bTblInsDummyNode )
+/*?*/ new SwNode( aInsPos, ND_SECTIONDUMMY );
+/*?*/
+/*?*/ SwStartNode* pSttNd = aRg.aStart.GetNode().GetStartNode();
+/*?*/ _CopyNodes( SwNodeRange( *pSttNd, + 1,
+/*?*/ *pSttNd->EndOfSectionNode() ),
+/*?*/ aInsPos, bNewFrms, FALSE );
+/*?*/
+/*?*/ // fuer den Box-EndNode einen DummyNode einfuegen?
+/*?*/ if( bTblInsDummyNode )
+/*?*/ new SwNode( aInsPos, ND_SECTIONDUMMY );
+/*?*/ aRg.aStart = *pSttNd->EndOfSectionNode();
+/*?*/ }
+/*?*/ // fuer den TabellenEndNode einen DummyNode einfuegen?
+/*?*/ if( bTblInsDummyNode )
+/*?*/ new SwNode( aInsPos, ND_SECTIONDUMMY );
+/*?*/ aRg.aStart = *pAktNode->EndOfSectionNode();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwNodeIndex nStt( aInsPos, -1 );
+/*N*/ SwTableNode* pTblNd = ((SwTableNode*)pAktNode)->
+/*N*/ MakeCopy( pDoc, aInsPos );
+/*N*/ nNodeCnt -= aInsPos.GetIndex() - nStt.GetIndex() -2;
+/*N*/
+/*N*/ aRg.aStart = pAktNode->EndOfSectionIndex();
+/*N*/
+/*N*/ if( bNewFrms && pTblNd )
+/*N*/ {
+/*N*/ nStt = aInsPos;
+/*N*/ pTblNd->MakeFrms( &nStt );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case ND_SECTIONNODE: // SectionNode
+/*?*/ // der gesamte Bereich oder nur ein Teil ??
+/*?*/ if( pAktNode->EndOfSectionIndex() < aRg.aEnd.GetIndex() )
+/*?*/ {
+/*?*/ // also der gesamte, lege einen neuen SectionNode an
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwNodeIndex nStt( aInsPos, -1 );
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*N*/ case ND_STARTNODE: // StartNode gefunden
+/*N*/ {
+/*N*/ SwStartNode* pTmp = new SwStartNode( aInsPos, ND_STARTNODE,
+/*N*/ ((SwStartNode*)pAktNode)->GetStartNodeType() );
+/*N*/ new SwEndNode( aInsPos, *pTmp );
+/*N*/ aInsPos--;
+/*N*/ nLevel++;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case ND_ENDNODE:
+/*N*/ if( nLevel ) // vollstaendige Section
+/*N*/ {
+/*N*/ --nLevel;
+/*N*/ aInsPos++; // EndNode schon vorhanden
+/*N*/ }
+/*N*/ else if( !pAktNode->pStartOfSection->IsSectionNode() )
+/*N*/ {
+/*N*/ // erzeuge eine Section an der originalen InsertPosition
+/*N*/ SwNodeRange aTmpRg( aOrigInsPos, 1, aInsPos );
+/*N*/ pDoc->GetNodes().SectionDown( &aTmpRg,
+/*N*/ pAktNode->pStartOfSection->GetStartNodeType() );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case ND_TEXTNODE:
+/*N*/ case ND_GRFNODE:
+/*N*/ case ND_OLENODE:
+/*N*/ {
+/*N*/ SwCntntNode* pNew = ((SwCntntNode*)pAktNode)->MakeCopy(
+/*N*/ pDoc, aInsPos );
+/*N*/ if( !bNewFrms ) // dflt. werden die Frames immer angelegt
+/*N*/ pNew->DelFrms();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case ND_SECTIONDUMMY:
+ /*if( (const SwNodes*)this == GetDoc()->GetUndoNds() )
+ {
+ // dann muss an der akt. InsPos auch ein SectionNode
+ // (Start/Ende) stehen; dann diesen ueberspringen.
+ // Andernfalls nicht weiter beachten.
+ SwNode* pTmpNd = pDoc->GetNodes()[ aInsPos ];
+ if( pTmpNd->IsSectionNode() ||
+ pTmpNd->FindStartNode()->IsSectionNode() )
+ aInsPos++; // ueberspringen
+ }
+ else */
+ ASSERT( FALSE, "wie kommt diser Node ins Nodes-Array??" );
+ break;
+
+/*?*/ default:
+/*?*/ ASSERT( FALSE, "weder Start-/End-/Content-Node, unbekannter Typ" );
+/*N*/ }
+/*N*/ aRg.aStart++;
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ #ifdef JP_DEBUG
+/*N*/ {
+/*N*/ extern Writer* GetDebugWriter(const String&);
+/*N*/
+/*N*/ Writer* pWriter = GetDebugWriter(aEmptyStr);
+/*N*/ if( pWriter )
+/*N*/ {
+/*N*/ int nError;
+/*N*/ SvFileStream aStrm( "c:\\$$copy.db", STREAM_WRITE );
+/*N*/ SwWriter aWriter( aStrm, *pMyDoc );
+/*N*/ aWriter.Write( &nError, pWriter );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ void SwNodes::_DelDummyNodes( const SwNodeRange& rRg )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( rRg.aStart );
+/*N*/ while( aIdx.GetIndex() < rRg.aEnd.GetIndex() )
+/*N*/ {
+/*N*/ if( ND_SECTIONDUMMY == aIdx.GetNode().GetNodeType() )
+/*?*/ RemoveNode( aIdx.GetIndex(), 1, TRUE );
+/*N*/ else
+/*N*/ aIdx++;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwStartNode* SwNodes::MakeEmptySection( const SwNodeIndex& rIdx,
+/*N*/ SwStartNodeType eSttNdTyp )
+/*N*/ {
+/*N*/ SwStartNode* pSttNd = new SwStartNode( rIdx, ND_STARTNODE, eSttNdTyp );
+/*N*/ new SwEndNode( rIdx, *pSttNd );
+/*N*/ return pSttNd;
+/*N*/ }
+
+
+/*N*/ SwStartNode* SwNodes::MakeTextSection( const SwNodeIndex & rWhere,
+/*N*/ SwStartNodeType eSttNdTyp,
+/*N*/ SwTxtFmtColl *pColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ {
+/*N*/ SwStartNode* pSttNd = new SwStartNode( rWhere, ND_STARTNODE, eSttNdTyp );
+/*N*/ new SwEndNode( rWhere, *pSttNd );
+/*N*/ MakeTxtNode( SwNodeIndex( rWhere, - 1 ), pColl, pAutoAttr );
+/*N*/ return pSttNd;
+/*N*/ }
+
+ // zum naechsten Content-Node, der nicht geschuetzt oder versteckt ist
+ // (beides auf FALSE ==> GoNext/GoPrevious!!!)
+/*N*/ SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx,
+/*N*/ int bSkipHidden, int bSkipProtect ) const
+/*N*/ {
+/*N*/ int bFirst = TRUE;
+/*N*/ SwNodeIndex aTmp( *pIdx );
+/*N*/ const SwNode* pNd;
+/*N*/ while( aTmp < Count() - 1 )
+/*N*/ {
+/*N*/ if( ND_SECTIONNODE == ( pNd = (*this)[aTmp])->GetNodeType() )
+/*N*/ {
+/*N*/ const SwSection& rSect = ((SwSectionNode*)pNd)->GetSection();
+/*N*/ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+/*N*/ (bSkipProtect && rSect.IsProtectFlag()) )
+/*N*/ // dann diese Section ueberspringen
+/*?*/ aTmp = *pNd->EndOfSectionNode();
+/*N*/ bFirst = FALSE;
+/*N*/ }
+/*N*/ else if( bFirst )
+/*N*/ {
+/*N*/ bFirst = FALSE;
+/*N*/ if( pNd->pStartOfSection->IsSectionNode() )
+/*N*/ {
+/*N*/ const SwSection& rSect = ((SwSectionNode*)pNd->
+/*N*/ pStartOfSection)->GetSection();
+/*N*/ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+/*N*/ (bSkipProtect && rSect.IsProtectFlag()) )
+/*N*/ // dann diese Section ueberspringen
+/*N*/ aTmp = *pNd->EndOfSectionNode();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( ND_CONTENTNODE & pNd->GetNodeType() )
+/*N*/ {
+/*N*/ const SwSectionNode* pSectNd;
+/*N*/ if( ( bSkipHidden || bSkipProtect ) &&
+/*N*/ 0 != (pSectNd = pNd->FindSectionNode() ) &&
+/*N*/ ( ( bSkipHidden && pSectNd->GetSection().IsHiddenFlag() ) ||
+/*N*/ ( bSkipProtect && pSectNd->GetSection().IsProtectFlag() )) )
+/*N*/ {
+/*?*/ aTmp = *pSectNd->EndOfSectionNode();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ (*pIdx) = aTmp;
+/*N*/ return (SwCntntNode*)pNd;
+/*N*/ }
+/*N*/ }
+/*N*/ aTmp++;
+/*N*/ bFirst = FALSE;
+/*N*/ }
+/*?*/ return 0;
+/*N*/ }
+
+/*N*/ SwCntntNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx,
+/*N*/ int bSkipHidden, int bSkipProtect ) const
+/*N*/ {
+/*N*/ int bFirst = TRUE;
+/*N*/ SwNodeIndex aTmp( *pIdx );
+/*N*/ const SwNode* pNd;
+/*N*/ while( aTmp > 0 )
+/*N*/ {
+/*N*/ if( ND_ENDNODE == ( pNd = (*this)[aTmp])->GetNodeType() )
+/*N*/ {
+/*N*/ if( pNd->pStartOfSection->IsSectionNode() )
+/*N*/ {
+/*N*/ const SwSection& rSect = ((SwSectionNode*)pNd->
+/*N*/ pStartOfSection)->GetSection();
+/*N*/ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+/*N*/ (bSkipProtect && rSect.IsProtectFlag()) )
+/*N*/ // dann diese Section ueberspringen
+/*?*/ aTmp = *pNd->StartOfSectionNode();
+/*N*/ }
+/*N*/ bFirst = FALSE;
+/*N*/ }
+/*N*/ else if( bFirst )
+/*N*/ {
+/*N*/ bFirst = FALSE;
+/*N*/ if( pNd->pStartOfSection->IsSectionNode() )
+/*N*/ {
+/*?*/ const SwSection& rSect = ((SwSectionNode*)pNd->
+/*?*/ pStartOfSection)->GetSection();
+/*?*/ if( (bSkipHidden && rSect.IsHiddenFlag()) ||
+/*?*/ (bSkipProtect && rSect.IsProtectFlag()) )
+/*?*/ // dann diese Section ueberspringen
+/*?*/ aTmp = *pNd->StartOfSectionNode();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( ND_CONTENTNODE & pNd->GetNodeType() )
+/*N*/ {
+/*N*/ const SwSectionNode* pSectNd;
+/*N*/ if( ( bSkipHidden || bSkipProtect ) &&
+/*N*/ 0 != (pSectNd = pNd->FindSectionNode() ) &&
+/*N*/ ( ( bSkipHidden && pSectNd->GetSection().IsHiddenFlag() ) ||
+/*N*/ ( bSkipProtect && pSectNd->GetSection().IsProtectFlag() )) )
+/*N*/ {
+/*?*/ aTmp = *pSectNd;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ (*pIdx) = aTmp;
+/*N*/ return (SwCntntNode*)pNd;
+/*N*/ }
+/*N*/ }
+/*N*/ aTmp--;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+
+ // suche den vorhergehenden [/nachfolgenden ] ContentNode oder
+ // TabellenNode mit Frames. Wird kein Ende angeben, dann wird mit
+ // dem FrameIndex begonnen; ansonsten, wird mit dem vor rFrmIdx und
+ // dem hintern pEnd die Suche gestartet. Sollte kein gueltiger Node
+ // gefunden werden, wird 0 returnt. rFrmIdx zeigt auf dem Node mit
+ // Frames
+/*N*/ SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx,
+/*N*/ const SwNode* pEnd ) const
+/*N*/ {
+/*N*/ SwNode* pFrmNd = 0;
+/*N*/
+/*N*/ // habe wir gar kein Layout, vergiss es
+/*N*/ if( GetDoc()->GetRootFrm() )
+/*N*/ {
+/*N*/ SwNode* pSttNd = &rFrmIdx.GetNode();
+/*N*/
+/*N*/ // wird in eine versteckte Section verschoben ??
+/*N*/ SwSectionNode* pSectNd = pSttNd->IsSectionNode()
+/*N*/ ? pSttNd->FindStartNode()->FindSectionNode()
+/*N*/ : pSttNd->FindSectionNode();
+/*N*/ if( !( pSectNd && pSectNd->GetSection().CalcHiddenFlag()/*IsHiddenFlag()*/ ) )
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( rFrmIdx );
+/*N*/ SwNode* pNd;
+/*N*/ if( pEnd )
+/*N*/ {
+/*N*/ aIdx--;
+/*N*/ pNd = &aIdx.GetNode();
+/*N*/ }
+/*N*/ else
+/*?*/ pNd = pSttNd;
+/*N*/
+/*N*/ if( ( pFrmNd = pNd )->IsCntntNode() )
+/*N*/ rFrmIdx = aIdx;
+/*N*/
+/*N*/ // suche nach vorne/hinten nach einem Content Node
+/*N*/ else if( 0 != ( pFrmNd = GoPrevSection( &aIdx, TRUE, FALSE )) &&
+/*N*/ ::binfilter::CheckNodesRange( aIdx, rFrmIdx, TRUE ) &&
+/*N*/ // nach vorne nie aus der Tabelle hinaus!
+/*N*/ pFrmNd->FindTableNode() == pSttNd->FindTableNode() &&
+/*N*/ // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus!
+/*N*/ (!pFrmNd->FindTableNode() || pFrmNd->FindTableBoxStartNode()
+/*N*/ == pSttNd->FindTableBoxStartNode() ) &&
+/*N*/ (!pSectNd || pSttNd->IsSectionNode() ||
+/*N*/ pSectNd->GetIndex() < pFrmNd->GetIndex())
+/*N*/ )
+/*N*/ {
+/*N*/ rFrmIdx = aIdx;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pEnd )
+/*N*/ aIdx = pEnd->GetIndex() + 1;
+/*N*/ else
+/*?*/ aIdx = rFrmIdx;
+/*N*/
+/*N*/ // JP 19.09.93: aber nie die Section dafuer verlassen !!
+/*N*/ if( ( pEnd && ( pFrmNd = &aIdx.GetNode())->IsCntntNode() ) ||
+/*N*/ ( 0 != ( pFrmNd = GoNextSection( &aIdx, TRUE, FALSE )) &&
+/*N*/ ::binfilter::CheckNodesRange( aIdx, rFrmIdx, TRUE ) &&
+/*N*/ // JP 27.01.99: wenn der "Start"Node ein TabellenNode ist,
+/*N*/ // dann kann der dahinter liegende nie der gleiche sein!
+/*N*/ ( pSttNd->IsTableNode() ||
+/*N*/ ( pFrmNd->FindTableNode() == pSttNd->FindTableNode() &&
+/*N*/ // Bug 37652: nach hinten nie aus der Tabellenzelle hinaus!
+/*N*/ (!pFrmNd->FindTableNode() || pFrmNd->FindTableBoxStartNode()
+/*N*/ == pSttNd->FindTableBoxStartNode() ))) &&
+/*N*/ (!pSectNd || pSttNd->IsSectionNode() ||
+/*N*/ pSectNd->EndOfSectionIndex() > pFrmNd->GetIndex())
+/*N*/ ))
+/*N*/ {
+/*N*/ //JP 18.02.99: Undo von Merge einer Tabelle mit der
+/*N*/ // der vorherigen, wenn dahinter auch noch eine steht
+/*N*/ // falls aber der Node in einer Tabelle steht, muss
+/*N*/ // natuerlich dieser returnt werden, wenn der SttNode eine
+/*N*/ // Section oder Tabelle ist!
+/*N*/ SwTableNode* pTblNd;
+/*N*/ if( ( pSttNd->IsTableNode() ) &&
+/*N*/ 0 != ( pTblNd = pFrmNd->FindTableNode() ))
+/*N*/ {
+/*?*/ pFrmNd = pTblNd;
+/*?*/ rFrmIdx = *pFrmNd;
+/*N*/ }
+/*N*/ else
+/*N*/ rFrmIdx = aIdx;
+/*N*/ }
+/*N*/ else if( pNd->IsEndNode() && pNd->FindStartNode()->IsTableNode() )
+/*N*/ {
+/*?*/ pFrmNd = pNd->FindStartNode();
+/*?*/ rFrmIdx = *pFrmNd;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ if( pEnd )
+/*?*/ aIdx = pEnd->GetIndex() + 1;
+/*?*/ else
+/*?*/ aIdx = rFrmIdx.GetIndex() + 1;
+/*?*/
+/*?*/ if( (pFrmNd = &aIdx.GetNode())->IsTableNode() )
+/*?*/ rFrmIdx = aIdx;
+/*?*/ else
+/*?*/ {
+/*?*/ pFrmNd = 0;
+/*?*/
+/*?*/ // is there some sectionnodes before a tablenode?
+/*?*/ while( aIdx.GetNode().IsSectionNode() )
+/*?*/ {
+/*?*/ const SwSection& rSect = aIdx.GetNode().
+/*?*/ GetSectionNode()->GetSection();
+/*?*/ if( rSect.IsHiddenFlag() )
+/*?*/ aIdx = aIdx.GetNode().EndOfSectionIndex()+1;
+/*?*/ else
+/*?*/ aIdx++;
+/*?*/ }
+/*?*/ if( aIdx.GetNode().IsTableNode() )
+/*?*/ {
+/*?*/ rFrmIdx = aIdx;
+/*?*/ pFrmNd = &aIdx.GetNode();
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pFrmNd;
+/*N*/ }
+
+
+/*N*/ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
+/*N*/ FnForEach_SwNodes fnForEach, void* pArgs )
+/*N*/ {
+/*N*/ BigPtrArray::ForEach( rStart.GetIndex(), rEnd.GetIndex(),
+/*N*/ (FnForEach) fnForEach, pArgs );
+/*N*/ }
+
+/*N*/ struct _TempBigPtrEntry : public BigPtrEntry
+/*N*/ {
+/*N*/ _TempBigPtrEntry() {}
+/*N*/ };
+
+
+/*N*/ void SwNodes::RemoveNode( ULONG nDelPos, ULONG nSize, FASTBOOL bDel )
+/*N*/ {
+/*N*/ ULONG nEnd = nDelPos + nSize;
+/*N*/ SwNode* pNew = (*this)[ nEnd ];
+/*N*/
+/*N*/ if( pRoot )
+/*N*/ {
+/*N*/ SwNodeIndex *p = pRoot;
+/*N*/ while( p )
+/*N*/ {
+/*N*/ ULONG nIdx = p->GetIndex();
+/*N*/ SwNodeIndex* pNext = p->pNext;
+/*N*/ if( nDelPos <= nIdx && nIdx < nEnd )
+/*N*/ (*p) = *pNew;
+/*N*/
+/*N*/ p = pNext;
+/*N*/ }
+/*N*/
+/*N*/ p = pRoot->pPrev;
+/*N*/ while( p )
+/*N*/ {
+/*?*/ ULONG nIdx = p->GetIndex();
+/*?*/ SwNodeIndex* pPrev = p->pPrev;
+/*?*/ if( nDelPos <= nIdx && nIdx < nEnd )
+/*?*/ (*p) = *pNew;
+/*?*/
+/*?*/ p = pPrev;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bDel )
+/*N*/ {
+/*N*/ ULONG nCnt = nSize;
+/*N*/ SwNode *pDel = (*this)[ nDelPos+nCnt-1 ], *pPrev = (*this)[ nDelPos+nCnt-2 ];
+/*N*/
+/*N*/ #if 1
+/*N*/ // temp. Object setzen
+/*N*/ //JP 24.08.98: muessten eigentlich einzeln removed werden, weil
+/*N*/ // das Remove auch rekursiv gerufen werden kann, z.B. bei
+/*N*/ // zeichengebundenen Rahmen. Da aber dabei viel zu viel
+/*N*/ // ablaueft, wird hier ein temp. Objekt eingefuegt, das
+/*N*/ // dann mit dem Remove wieder entfernt wird.
+/*N*/ // siehe Bug 55406
+/*N*/ _TempBigPtrEntry aTempEntry;
+/*N*/ BigPtrEntry* pTempEntry = &aTempEntry;
+/*N*/
+/*N*/ while( nCnt-- )
+/*N*/ {
+/*N*/ delete pDel;
+/*N*/ pDel = pPrev;
+/*N*/ ULONG nPrevNdIdx = pPrev->GetIndex();
+/*N*/ BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry );
+/*N*/ if( nCnt )
+/*N*/ pPrev = (*this)[ nPrevNdIdx - 1 ];
+/*N*/ }
+/*N*/ nDelPos = pDel->GetIndex() + 1;
+/*N*/ }
+/*N*/ #else
+/*N*/ // nach jedem Del ein Remove rufen - teuer!
+/*N*/ //JP 24.08.98: muessen leider einzeln removed werden, weil das
+/*N*/ // auch rekursiv gerufen wird - zeichengeb. Flys!
+/*N*/ // siehe Bug 55406
+/*N*/ while( nCnt-- )
+/*N*/ {
+/*N*/ delete pDel;
+/*N*/ pDel = pPrev;
+/*N*/ ULONG nPrevNdIdx = pPrev->GetIndex();
+/*N*/ BigPtrArray::Remove( nPrevNdIdx+1, 1 );
+/*N*/ if( nCnt )
+/*N*/ pPrev = (*this)[ nPrevNdIdx - 1 ];
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ #endif
+/*N*/
+/*N*/ BigPtrArray::Remove( nDelPos, nSize );
+/*N*/ }
+
+/*N*/ void SwNodes::RegisterIndex( SwNodeIndex& rIdx )
+/*N*/ {
+/*N*/ if( !pRoot ) // noch keine Root gesetzt?
+/*N*/ {
+/*N*/ pRoot = &rIdx;
+/*N*/ pRoot->pPrev = 0;
+/*N*/ pRoot->pNext = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // immer hinter die Root haengen
+/*N*/ rIdx.pNext = pRoot->pNext;
+/*N*/ pRoot->pNext = &rIdx;
+/*N*/ rIdx.pPrev = pRoot;
+/*N*/ if( rIdx.pNext )
+/*N*/ rIdx.pNext->pPrev = &rIdx;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwNodes::DeRegisterIndex( SwNodeIndex& rIdx )
+/*N*/ {
+/*N*/ register SwNodeIndex* pN = rIdx.pNext;
+/*N*/ register SwNodeIndex* pP = rIdx.pPrev;
+/*N*/
+/*N*/ if( pRoot == &rIdx )
+/*N*/ pRoot = pP ? pP : pN;
+/*N*/
+/*N*/ if( pP )
+/*N*/ pP->pNext = pN;
+/*N*/ if( pN )
+/*N*/ pN->pPrev = pP;
+/*N*/
+/*N*/ rIdx.pNext = 0;
+/*N*/ rIdx.pPrev = 0;
+/*N*/ }
+
+/*N*/ void SwNodes::Insert( const SwNodePtr pNode, const SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ const ElementPtr pIns = pNode;
+/*N*/ BigPtrArray::Insert( pIns, rPos.GetIndex() );
+/*N*/ }
+
+/*N*/ void SwNodes::Insert(const SwNodePtr pNode, ULONG nPos)
+/*N*/ {
+/*N*/ const ElementPtr pIns = pNode;
+/*N*/ BigPtrArray::Insert( pIns, nPos );
+/*N*/ }
+
+ // #i31620#
+ SwNode * SwNodes::operator[](int n) const
+ {
+ return operator[]((ULONG) n);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_section.cxx b/binfilter/bf_sw/source/core/docnode/sw_section.cxx
new file mode 100644
index 000000000000..37c61be85fde
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_section.cxx
@@ -0,0 +1,1150 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdlib.h>
+
+#include <hintids.hxx>
+
+#include <bf_svtools/intitem.hxx>
+#include <bf_svtools/stritem.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <bf_sfx2/docfilt.hxx>
+#include <bf_svx/protitem.hxx>
+#include <bf_svx/linkmgr.hxx>
+#include <tools/urlobj.hxx>
+
+#include <docary.hxx>
+#include <fmtcntnt.hxx>
+#include <errhdl.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pam.hxx>
+#include <editsh.hxx>
+#include <hints.hxx>
+#include <docsh.hxx>
+#include <ndtxt.hxx>
+#include <swserv.hxx>
+#include <shellio.hxx>
+#include <poolfmt.hxx>
+#include <swbaslnk.hxx>
+#include <mvsave.hxx>
+#include <sectfrm.hxx>
+#include <ftnidx.hxx>
+#include <doctxm.hxx>
+
+#include <swerror.h>
+
+#include <frmatr.hxx>
+
+namespace binfilter {
+
+/*N*/ SV_IMPL_REF( SwServerObject )
+
+//static const char __FAR_DATA sSectionFmtNm[] = "Section";
+#define sSectionFmtNm aEmptyStr
+
+/*N*/ class SwIntrnlSectRefLink : public SwBaseLink
+/*N*/ {
+/*N*/ SwSectionFmt& rSectFmt;
+/*N*/ public:
+/*N*/ SwIntrnlSectRefLink( SwSectionFmt& rFmt, USHORT nUpdateType, USHORT nFmt )
+/*N*/ : SwBaseLink( nUpdateType, nFmt ),
+/*N*/ rSectFmt( rFmt )
+/*N*/ {}
+/*N*/
+/*N*/ virtual void DataChanged( const String& rMimeType,
+/*N*/ const ::com::sun::star::uno::Any & rValue );
+/*N*/
+/*N*/ virtual BOOL IsInRange( ULONG nSttNd, ULONG nEndNd, xub_StrLen nStt = 0,
+/*N*/ xub_StrLen nEnd = STRING_NOTFOUND ) const;
+/*N*/ };
+
+
+/*N*/ TYPEINIT1(SwSectionFmt,SwFrmFmt );
+/*N*/ TYPEINIT1(SwSection,SwClient );
+
+/*N*/ typedef SwSection* SwSectionPtr;
+
+/*N*/ SV_IMPL_PTRARR(SwSectionFmts,SwSectionFmt*)
+
+
+
+/*N*/ SwSection::SwSection( SectionType eTyp, const String& rName,
+/*N*/ SwSectionFmt* pFmt )
+/*N*/ : SwClient( pFmt ),
+/*N*/ eType( eTyp ), sSectionNm( rName )
+/*N*/ {
+/*N*/ bHidden = FALSE;
+/*N*/ bHiddenFlag = FALSE;
+/*N*/ bProtectFlag = FALSE;
+/*N*/ bCondHiddenFlag = TRUE;
+/*N*/ bConnectFlag = TRUE;
+/*N*/
+/*N*/ SwSectionPtr pParentSect = GetParent();
+/*N*/ if( pParentSect )
+/*N*/ {
+/*N*/ FASTBOOL bPHFlag = pParentSect->IsHiddenFlag();
+/*N*/ if( pParentSect->IsHiddenFlag() )
+/*?*/ SetHidden( TRUE );
+/*N*/
+/*N*/ _SetProtectFlag( pParentSect->IsProtectFlag() );
+/*N*/ }
+/*N*/
+/*N*/ if( pFmt && !bProtectFlag )
+/*N*/ _SetProtectFlag( pFmt->GetProtect().IsCntntProtected() );
+/*N*/ }
+
+
+/*N*/ SwSection::~SwSection()
+/*N*/ {
+/*N*/ SwSectionFmt* pFmt = GetFmt();
+/*N*/ if( !pFmt )
+/*N*/ return;
+/*N*/
+/*N*/ SwDoc* pDoc = pFmt->GetDoc();
+/*N*/ if( pDoc->IsInDtor() )
+/*N*/ {
+/*N*/ // dann melden wir noch schnell unser Format um ans dflt FrameFmt,
+/*N*/ // damit es keine Abhaengigkeiten gibt
+/*N*/ if( pFmt->DerivedFrom() != pDoc->GetDfltFrmFmt() )
+/*N*/ pDoc->GetDfltFrmFmt()->Add( pFmt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pFmt->Remove( this ); // austragen,
+/*N*/
+/*N*/ if( CONTENT_SECTION != eType ) // den Link austragen
+/*N*/ pDoc->GetLinkManager().Remove( refLink );
+/*N*/
+/*N*/ if( refObj.Is() ) // als Server austragen
+/*?*/ pDoc->GetLinkManager().RemoveServer( &refObj );
+/*N*/
+/*N*/ // ist die Section der letzte Client im Format, kann dieses
+/*N*/ // geloescht werden
+/*N*/ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFmt );
+/*N*/ pFmt->Modify( &aMsgHint, &aMsgHint );
+/*N*/ if( !pFmt->GetDepends() )
+/*N*/ {
+/*?*/ // Bug: 28191 - nicht ins Undo aufnehmen, sollte schon vorher
+/*?*/ // geschehen sein!!
+/*?*/ pDoc->DelSectionFmt( pFmt ); // und loeschen
+/*N*/ }
+/*N*/ }
+/*N*/ if( refObj.Is() )
+/*N*/ refObj->Closed();
+/*N*/ }
+
+
+/*N*/ SwSection& SwSection::operator=( const SwSection& rCpy )
+/*N*/ {
+/*N*/ sSectionNm = rCpy.sSectionNm;
+/*N*/ sCondition = rCpy.sCondition;
+/*N*/ sLinkFileName = rCpy.GetLinkFileName();
+/*N*/ SetLinkFilePassWd( rCpy.GetLinkFilePassWd() );
+/*N*/ SetConnectFlag( rCpy.IsConnectFlag() );
+/*N*/ SetPasswd( rCpy.GetPasswd() );
+/*N*/
+/*N*/ eType = rCpy.eType;
+/*N*/
+/*N*/ if( !GetFmt() )
+/*N*/ SetProtect( rCpy.IsProtect() );
+/*N*/ else if( rCpy.GetFmt() )
+/*?*/ _SetProtectFlag( rCpy.bProtectFlag );
+/*N*/ else
+/*N*/ SetProtect( rCpy.bProtectFlag );
+/*N*/
+/*N*/ bCondHiddenFlag = TRUE; // sollte immer defaultet werden
+/*N*/ SetHidden( rCpy.bHidden );
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+
+/*N*/ int SwSection::operator==( const SwSection& rCmp ) const
+/*N*/ {
+/*N*/ return sSectionNm == rCmp.sSectionNm &&
+/*N*/ sCondition == rCmp.sCondition &&
+/*N*/ eType == rCmp.eType &&
+/*N*/ bHidden == rCmp.bHidden &&
+/*N*/ IsProtect() == rCmp.IsProtect() &&
+/*N*/ GetLinkFileName() == rCmp.GetLinkFileName() &&
+/*N*/ GetLinkFilePassWd() == rCmp.GetLinkFilePassWd() &&
+/*N*/ GetPasswd() == rCmp.GetPasswd() &&
+/*N*/ ( !GetFmt() || !rCmp.GetFmt() || GetFmt() == rCmp.GetFmt());
+/*N*/ }
+
+
+void SwSection::_SetHiddenFlag( int bHidden, int bCondition )
+{
+ SwSectionFmt* pFmt = GetFmt();
+ if( pFmt )
+ {
+ int bHide = bHidden && bCondition;
+
+ if( bHide ) // die Nodes also "verstecken"
+ {
+ if( !bHiddenFlag ) // ist nicht versteckt
+ {
+ // wie sieht es mit dem Parent aus, ist der versteckt ?
+ // (eigentlich muesste das vom bHiddenFlag angezeigt werden!)
+
+ // erstmal allen Childs sagen, das sie versteckt sind
+ SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN );
+ pFmt->Modify( &aMsgItem, &aMsgItem );
+
+ // alle Frames loeschen
+ pFmt->DelFrms();
+ }
+ }
+ else if( bHiddenFlag ) // die Nodes wieder anzeigen
+ {
+ // alle Frames sichtbar machen ( Childs Sections werden vom
+ // MakeFrms beruecksichtigt). Aber nur wenn die ParentSection
+ // nichts dagegen hat !
+ SwSection* pParentSect = pFmt->GetParentSection();
+ if( !pParentSect || !pParentSect->IsHiddenFlag() )
+ {
+ // erstmal allen Childs sagen, das der Parent nicht mehr
+ // versteckt ist
+ SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN );
+ pFmt->Modify( &aMsgItem, &aMsgItem );
+
+ pFmt->MakeFrms();
+ }
+ }
+ }
+}
+
+/*N*/ int SwSection::CalcHiddenFlag() const
+/*N*/ {
+/*N*/ const SwSection* pSect = this;
+/*N*/ do {
+/*N*/ if( pSect->IsHidden() && pSect->IsCondHidden() )
+/*?*/ return TRUE;
+/*N*/ } while( 0 != ( pSect = pSect->GetParent()) );
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ int SwSection::_IsProtect() const
+/*N*/ {
+/*N*/ return GetFmt()->GetProtect().IsCntntProtected();
+/*N*/ }
+
+
+/*N*/ void SwSection::SetHidden( int bFlag )
+/*N*/ {
+/*N*/ if( bHidden == bFlag )
+/*N*/ return;
+/*N*/
+/*?*/ bHidden = bFlag;
+/*?*/ _SetHiddenFlag( bHidden, bCondHiddenFlag );
+/*N*/ }
+
+
+/*N*/ void SwSection::SetProtect( int bFlag )
+/*N*/ {
+/*N*/ if( GetFmt() )
+/*N*/ {
+/*N*/ SvxProtectItem aItem;
+/*N*/ aItem.SetCntntProtect( (BOOL)bFlag );
+/*N*/ GetFmt()->SetAttr( aItem );
+/*N*/ }
+/*N*/ else
+/*N*/ bProtectFlag = bFlag;
+/*N*/ }
+
+
+/*N*/ void SwSection::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ BOOL bRemake = FALSE, bUpdateFtn = FALSE;
+/*N*/ switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
+/*N*/ {
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ {
+/*N*/ SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet();
+/*N*/ SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet();
+/*N*/ const SfxPoolItem* pItem;
+/*N*/
+/*N*/ if( SFX_ITEM_SET == pNewSet->GetItemState(
+/*N*/ RES_PROTECT, FALSE, &pItem ) )
+/*N*/ {
+/*?*/ _SetProtectFlag( ((SvxProtectItem*)pItem)->IsCntntProtected() );
+/*?*/ pNewSet->ClearItem( RES_PROTECT );
+/*?*/ pOldSet->ClearItem( RES_PROTECT );
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET == pNewSet->GetItemState(
+/*N*/ RES_FTN_AT_TXTEND, FALSE, &pItem ) ||
+/*N*/ SFX_ITEM_SET == pNewSet->GetItemState(
+/*N*/ RES_END_AT_TXTEND, FALSE, &pItem ))
+/*?*/ bUpdateFtn = TRUE;
+/*N*/
+/*N*/ if( !pNewSet->Count() )
+/*?*/ return;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_PROTECT:
+/*N*/ if( pNew )
+/*N*/ {
+/*N*/ BOOL bNewFlag = ((SvxProtectItem*)pNew)->IsCntntProtected();
+/*N*/ if( !bNewFlag )
+/*N*/ {
+/*N*/ // Abschalten: teste ob nicht vielleich ueber die Parents
+/*N*/ // doch ein Schutzt besteht!
+/*N*/ const SwSection* pSect = this;
+/*N*/ do {
+/*N*/ if( pSect->IsProtect() )
+/*N*/ {
+/*N*/ bNewFlag = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ } while( 0 != ( pSect = pSect->GetParent()) );
+/*N*/ }
+/*N*/
+/*N*/ _SetProtectFlag( bNewFlag );
+/*N*/ }
+/*N*/ return;
+/*N*/
+/*?*/ case RES_SECTION_HIDDEN:
+/*?*/ bHiddenFlag = TRUE;
+/*?*/ return;
+/*?*/
+/*?*/ case RES_SECTION_NOT_HIDDEN:
+/*?*/ case RES_SECTION_RESETHIDDENFLAG:
+/*?*/ bHiddenFlag = bHidden && bCondHiddenFlag;
+/*?*/ return;
+/*?*/
+/*?*/ case RES_COL:
+/*?*/ /* wird ggf. vom Layout erledigt */
+/*?*/ break;
+/*?*/
+/*?*/ case RES_FTN_AT_TXTEND:
+/*?*/ if( pNew && pOld )
+/*?*/ bUpdateFtn = TRUE;
+/*?*/ break;
+/*?*/
+/*?*/ case RES_END_AT_TXTEND:
+/*?*/ if( pNew && pOld )
+/*?*/ bUpdateFtn = TRUE;
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( bRemake )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 GetFmt()->DelFrms();
+/*N*/ }
+/*N*/
+/*N*/ if( bUpdateFtn )
+/*N*/ {
+/*?*/ SwSectionNode* pSectNd = GetFmt()->GetSectionNode( FALSE );
+/*?*/ if( pSectNd )
+/*?*/ pSectNd->GetDoc()->GetFtnIdxs().UpdateFtn(SwNodeIndex( *pSectNd ));
+/*N*/ }
+/*N*/ SwClient::Modify( pOld, pNew );
+/*N*/ }
+
+/*N*/ void SwSection::SetRefObject( SwServerObject* pObj )
+/*N*/ {
+/*N*/ refObj = pObj;
+/*N*/ }
+
+
+void SwSection::SetCondHidden( int bFlag )
+{
+ if( bCondHiddenFlag == bFlag )
+ return;
+
+ bCondHiddenFlag = bFlag;
+ _SetHiddenFlag( bHidden, bCondHiddenFlag );
+}
+
+
+// setze/erfrage den gelinkten FileNamen
+/*N*/ const String& SwSection::GetLinkFileName() const
+/*N*/ {
+/*N*/ if( refLink.Is() )
+/*N*/ {
+/*N*/ String sTmp;
+/*N*/ switch( eType )
+/*N*/ {
+/*N*/ case DDE_LINK_SECTION:
+/*?*/ sTmp = refLink->GetLinkSourceName();
+/*?*/ break;
+/*N*/
+/*N*/ case FILE_LINK_SECTION:
+/*N*/ {
+/*N*/ String sRange, sFilter;
+/*N*/ if( refLink->GetLinkManager() &&
+/*N*/ refLink->GetLinkManager()->GetDisplayNames(
+/*N*/ refLink, 0, &sTmp, &sRange, &sFilter ) )
+/*N*/ {
+/*N*/ ( sTmp += ::binfilter::cTokenSeperator ) += sFilter;
+/*N*/ ( sTmp += ::binfilter::cTokenSeperator ) += sRange;
+/*N*/ }
+/*N*/ else if( GetFmt() && !GetFmt()->GetSectionNode() )
+/*N*/ {
+/*N*/ // ist die Section im UndoNodesArray, dann steht
+/*N*/ // der Link nicht im LinkManager, kann also auch nicht
+/*N*/ // erfragt werden. Dann returne den akt. Namen
+/*?*/ return sLinkFileName;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ ((SwSection*)this)->sLinkFileName = sTmp;
+/*N*/ }
+/*N*/ return sLinkFileName;
+/*N*/ }
+
+
+/*N*/ void SwSection::SetLinkFileName( const String& rNew, const String* pPassWd )
+/*N*/ {
+/*N*/ if( refLink.Is() )
+/*?*/ refLink->SetLinkSourceName( rNew );
+/*N*/ else
+/*N*/ sLinkFileName = rNew;
+/*N*/ if( pPassWd )
+/*?*/ SetLinkFilePassWd( *pPassWd );
+/*N*/ }
+
+// falls es ein gelinkter Bereich war, dann muessen alle
+// Child-Verknuepfungen sichtbar bemacht werden.
+
+
+/*N*/ SwSectionFmt::SwSectionFmt( SwSectionFmt* pDrvdFrm, SwDoc *pDoc )
+/*N*/ : SwFrmFmt( pDoc->GetAttrPool(), sSectionFmtNm, pDrvdFrm )
+/*N*/ {
+/*N*/ LockModify();
+/*N*/ SetAttr( *GetDfltAttr( RES_COL ) );
+/*N*/ UnlockModify();
+/*N*/ }
+
+/*N*/ SwSectionFmt::~SwSectionFmt()
+/*N*/ {
+/*N*/ if( !GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ SwSectionNode* pSectNd;
+/*N*/ const SwNodeIndex* pIdx = GetCntnt( FALSE ).GetCntntIdx();
+/*N*/ if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
+/*N*/ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwSection& rSect = pSectNd->GetSection();
+/*N*/ }
+/*N*/ LockModify();
+/*N*/ ResetAttr( RES_CNTNT );
+/*N*/ UnlockModify();
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwSectionPtr SwSectionFmt::_GetSection() const
+/*N*/ {
+/*N*/ if( GetDepends() )
+/*N*/ {
+/*N*/ SwClientIter aIter( *(SwSectionFmt*)this );
+/*N*/ return (SwSectionPtr)aIter.First( TYPE(SwSection) );
+/*N*/ }
+/*N*/
+/*?*/ ASSERT( FALSE, "keine Section als Client." )
+/*?*/ return 0;
+/*N*/ }
+
+/*N*/ extern void lcl_DeleteFtn( SwSectionNode *pNd, ULONG nStt, ULONG nEnd );
+
+//Vernichtet alle Frms in aDepend (Frms werden per PTR_CAST erkannt).
+/*N*/ void SwSectionFmt::DelFrms()
+/*N*/ {
+/*N*/ SwSectionNode* pSectNd;
+/*N*/ const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx();
+/*N*/ if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
+/*N*/ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+/*N*/ {
+/*N*/ SwClientIter aIter( *this );
+/*N*/ SwClient *pLast = aIter.GoStart();
+/*N*/ while ( pLast )
+/*N*/ {
+/*N*/ if ( pLast->IsA( TYPE(SwFrm) ) )
+/*N*/ {
+/*N*/ SwSectionFrm *pFrm = (SwSectionFrm*)pLast;
+/*N*/ SwSectionFrm::MoveCntntAndDelete( pFrm, FALSE );
+/*N*/ pLast = aIter.GoStart();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( pLast->IsA( TYPE(SwSectionFmt) ) )
+/*?*/ ((SwSectionFmt*)pLast)->DelFrms();
+/*N*/ pLast = aIter++;
+/*N*/ }
+/*N*/ }
+/*N*/ ULONG nEnde = pSectNd->EndOfSectionIndex();
+/*N*/ ULONG nStart = pSectNd->GetIndex()+1;
+/*N*/ lcl_DeleteFtn( pSectNd, nStart, nEnde );
+/*N*/ }
+/*N*/ if( pIdx )
+/*N*/ {
+/*N*/ //JP 22.09.98:
+/*N*/ //Hint fuer Pagedesc versenden. Das mueste eigntlich das Layout im
+/*N*/ //Paste der Frames selbst erledigen, aber das fuehrt dann wiederum
+/*N*/ //zu weiteren Folgefehlern, die mit Laufzeitkosten geloest werden
+/*N*/ //muesten. #56977# #55001# #56135#
+/*N*/ SwNodeIndex aNextNd( *pIdx );
+/*N*/ SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection( &aNextNd, TRUE, FALSE );
+/*N*/ if( pCNd )
+/*N*/ {
+/*N*/ const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get( RES_PAGEDESC );
+/*N*/ pCNd->Modify( (SfxPoolItem*)&rItem, (SfxPoolItem*)&rItem );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+//Erzeugt die Ansichten
+void SwSectionFmt::MakeFrms()
+{
+ SwSectionNode* pSectNd;
+ const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx();
+
+ if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
+ 0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
+ {
+ SwNodeIndex aIdx( *pIdx );
+ pSectNd->MakeFrms( &aIdx );
+ }
+}
+
+/*N*/ void lcl_ClientIter( SwSectionFmt* pFmt, const SfxPoolItem* pOld,
+/*N*/ const SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ SwClientIter aIter( *pFmt );
+/*N*/ SwClient * pLast = aIter.GoStart();
+/*N*/ if( pLast )
+/*N*/ do {
+/*N*/ pLast->Modify( (SfxPoolItem*)pOld, (SfxPoolItem*)pNew );
+/*N*/ } while( 0 != ( pLast = aIter++ ));
+/*N*/ }
+
+/*N*/ void SwSectionFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ BOOL bClients = FALSE;
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ if( GetDepends() )
+/*N*/ {
+/*N*/ SfxItemSet* pNewSet = ((SwAttrSetChg*)pNew)->GetChgSet();
+/*N*/ SfxItemSet* pOldSet = ((SwAttrSetChg*)pOld)->GetChgSet();
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if( SFX_ITEM_SET == pNewSet->GetItemState(
+/*N*/ RES_PROTECT, FALSE, &pItem ))
+/*N*/ {
+/*N*/ lcl_ClientIter( this, pItem, pItem );
+/*N*/ pNewSet->ClearItem( RES_PROTECT );
+/*N*/ pOldSet->ClearItem( RES_PROTECT );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pNewSet->GetItemState(
+/*N*/ RES_FTN_AT_TXTEND, FALSE, &pItem ))
+/*N*/ {
+/*?*/ lcl_ClientIter( this, &pOldSet->Get( RES_FTN_AT_TXTEND ),
+/*?*/ pItem );
+/*?*/ pNewSet->ClearItem( RES_FTN_AT_TXTEND );
+/*?*/ pOldSet->ClearItem( RES_FTN_AT_TXTEND );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pNewSet->GetItemState(
+/*N*/ RES_END_AT_TXTEND, FALSE, &pItem ))
+/*N*/ {
+/*?*/ lcl_ClientIter( this, &pOldSet->Get( RES_END_AT_TXTEND ),
+/*?*/ pItem );
+/*?*/ pNewSet->ClearItem( RES_END_AT_TXTEND );
+/*?*/ pOldSet->ClearItem( RES_END_AT_TXTEND );
+/*N*/ }
+/*N*/ if( !((SwAttrSetChg*)pOld)->GetChgSet()->Count() )
+/*N*/ return;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*?*/ case RES_SECTION_RESETHIDDENFLAG:
+/*?*/ case RES_FTN_AT_TXTEND:
+/*?*/ case RES_END_AT_TXTEND : bClients = TRUE;
+/*?*/ // no break !!
+/*?*/ case RES_SECTION_HIDDEN:
+/*?*/ case RES_SECTION_NOT_HIDDEN:
+/*?*/ {
+/*?*/ SwSection* pSect = GetSection();
+/*?*/ if( pSect && ( bClients || ( RES_SECTION_HIDDEN == nWhich ?
+/*?*/ !pSect->IsHiddenFlag() : pSect->IsHiddenFlag() ) ) )
+/*?*/ {
+/*?*/ // selbst ueber die Clients iterieren, sollte schneller sein!
+/*?*/ SwClientIter aIter( *this );
+/*?*/ SwClient * pLast = aIter.GoStart();
+/*?*/ do {
+/*?*/ pLast->Modify( pOld, pNew );
+/*?*/ } while( 0 != ( pLast = aIter++ ));
+/*?*/ }
+/*?*/ }
+/*?*/ return ;
+/*?*/
+/*?*/
+/*?*/ case RES_PROTECT:
+/*?*/ // diese Messages bis zum Ende des Baums durchreichen !
+/*?*/ if( GetDepends() )
+/*?*/ {
+/*?*/ SwClientIter aIter( *this );
+/*?*/ SwClient * pLast = aIter.GoStart();
+/*?*/ if( pLast ) // konnte zum Anfang gesprungen werden ??
+/*?*/ do {
+/*?*/ pLast->Modify( pOld, pNew );
+/*?*/ } while( 0 != ( pLast = aIter++ ));
+/*?*/ }
+/*?*/ return; // das wars
+/*?*/
+/*?*/ case RES_OBJECTDYING:
+/*?*/ if( !GetDoc()->IsInDtor() &&
+/*?*/ ((SwPtrMsgPoolItem *)pOld)->pObject == (void*)GetRegisteredIn() )
+/*?*/ {
+/*?*/ // mein Parent wird vernichtet, dann an den Parent vom Parent
+/*?*/ // umhaengen und wieder aktualisieren
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFrmFmt::Modify( pOld, pNew ); // erst umhaengen !!!
+/*?*/ }
+/*?*/ break;
+/*N*/
+/*N*/ case RES_FMT_CHG:
+/*N*/ if( !GetDoc()->IsInDtor() &&
+/*N*/ ((SwFmtChg*)pNew)->pChangedFmt == (void*)GetRegisteredIn() &&
+/*N*/ ((SwFmtChg*)pNew)->pChangedFmt->IsA( TYPE( SwSectionFmt )) )
+/*N*/ {
+/*?*/ // mein Parent wird veraendert, muss mich aktualisieren
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFrmFmt::Modify( pOld, pNew ); // erst umhaengen !!!
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ SwFrmFmt::Modify( pOld, pNew );
+/*N*/ }
+
+ // erfrage vom Format Informationen
+
+
+ // alle Sections, die von dieser abgeleitet sind
+/*N*/ USHORT SwSectionFmt::GetChildSections( SwSections& rArr,
+/*N*/ SectionSort eSort,
+/*N*/ int bAllSections ) const
+/*N*/ {
+/*N*/ rArr.Remove( 0, rArr.Count() );
+/*N*/
+/*N*/ if( GetDepends() )
+/*N*/ {
+/*N*/ SwClientIter aIter( *(SwSectionFmt*)this );
+/*N*/ SwClient * pLast;
+/*N*/ const SwNodeIndex* pIdx;
+/*N*/ for( pLast = aIter.First(TYPE(SwSectionFmt)); pLast; pLast = aIter.Next() )
+/*N*/ if( bAllSections ||
+/*N*/ ( 0 != ( pIdx = ((SwSectionFmt*)pLast)->GetCntnt(FALSE).
+/*N*/ GetCntntIdx()) && &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
+/*N*/ {
+/*N*/ const SwSection* Dummy=((SwSectionFmt*)pLast)->GetSection();
+/*N*/ rArr.C40_INSERT( SwSection,
+/*N*/ Dummy,
+/*N*/ rArr.Count() );
+/*N*/ }
+/*N*/
+/*N*/ // noch eine Sortierung erwuenscht ?
+/*N*/ if( 1 < rArr.Count() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 switch( eSort )
+/*N*/ }
+/*N*/ return rArr.Count();
+/*N*/ }
+
+ // erfrage, ob sich die Section im Nodes-Array oder UndoNodes-Array
+ // befindet.
+/*N*/ int SwSectionFmt::IsInNodesArr() const
+/*N*/ {
+/*N*/ const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx();
+/*N*/ return pIdx && &pIdx->GetNodes() == &GetDoc()->GetNodes();
+/*N*/ }
+
+
+
+
+/*N*/ SwSectionNode* SwSectionFmt::GetSectionNode( BOOL bAlways )
+/*N*/ {
+/*N*/ const SwNodeIndex* pIdx = GetCntnt(FALSE).GetCntntIdx();
+/*N*/ if( pIdx && ( bAlways || &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
+/*N*/ return pIdx->GetNode().GetSectionNode();
+/*N*/ return 0;
+/*N*/ }
+
+ // ist die Section eine gueltige fuers GlobalDocument?
+/*N*/ const SwSection* SwSectionFmt::GetGlobalDocSection() const
+/*N*/ {
+/*N*/ const SwSectionNode* pNd = GetSectionNode();
+/*N*/ if( pNd &&
+/*N*/ ( FILE_LINK_SECTION == pNd->GetSection().GetType() ||
+/*N*/ TOX_CONTENT_SECTION == pNd->GetSection().GetType() ) &&
+/*N*/ pNd->GetIndex() > pNd->GetNodes().GetEndOfExtras().GetIndex() &&
+/*N*/ !pNd->FindStartNode()->IsSectionNode() &&
+/*N*/ !pNd->FindStartNode()->FindSectionNode() )
+/*N*/ return &pNd->GetSection();
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
+/*N*/ {
+/*N*/ SwDoc* pDoc = rSectNd.GetDoc();
+/*N*/ SwDocShell* pDShell = pDoc->GetDocShell();
+/*N*/ if( !pDShell || !pDShell->GetMedium() )
+/*?*/ return ;
+/*N*/
+/*N*/ String sName( pDShell->GetMedium()->GetName() );
+/*N*/ SwBaseLink* pBLink;
+/*N*/ String sMimeType( SotExchange::GetFormatMimeType( FORMAT_FILE ));
+/*N*/ ::com::sun::star::uno::Any aValue;
+/*N*/ aValue <<= ::rtl::OUString( sName ); // beliebiger Name
+/*N*/
+/*N*/ const ::binfilter::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks();
+/*N*/ for( USHORT n = rLnks.Count(); n; )
+/*N*/ {
+/*N*/ ::binfilter::SvBaseLink* pLnk = &(*rLnks[ --n ]);
+/*N*/ if( pLnk && pLnk != &rUpdLnk &&
+/*N*/ OBJECT_CLIENT_FILE == pLnk->GetObjType() &&
+/*N*/ pLnk->ISA( SwBaseLink ) &&
+/*N*/ ( pBLink = (SwBaseLink*)pLnk )->IsInRange( rSectNd.GetIndex(),
+/*N*/ rSectNd.EndOfSectionIndex() ) )
+/*N*/ {
+/*?*/ // liegt in dem Bereich: also updaten. Aber nur wenns nicht
+/*?*/ // im gleichen File liegt
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 String sFName;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+// sucht sich die richtige DocShell raus oder erzeugt eine neue:
+// Der Return-Wert gibt an, was mit der Shell zu geschehen hat:
+// 0 - Fehler, konnte DocShell nicht finden
+// 1 - DocShell ist ein existieren Document
+// 2 - DocShell wurde neu angelegt, muss also wieder geschlossen werden
+
+/*N*/ int lcl_FindDocShell( SfxObjectShellRef& xDocSh,
+/*N*/ const String& rFileName,
+/*N*/ const String& rPasswd,
+/*N*/ String& rFilter,
+/*N*/ INT16 nVersion,
+/*N*/ SwDocShell* pDestSh )
+/*N*/ {
+/*N*/ if( !rFileName.Len() )
+/*?*/ return 0;
+/*N*/
+/*N*/ // 1. existiert die Datei schon in der Liste aller Dokumente?
+/*N*/ INetURLObject aTmpObj( rFileName );
+/*N*/ aTmpObj.SetMark( aEmptyStr );
+/*N*/
+/*N*/ // erstmal nur ueber die DocumentShells laufen und die mit dem
+/*N*/ // Namen heraussuchen:
+/*N*/ TypeId aType( TYPE(SwDocShell) );
+/*N*/
+/*N*/ SfxObjectShell* pShell = pDestSh;
+/*N*/ BOOL bFirst = 0 != pShell;
+/*N*/
+/*N*/ if( !bFirst )
+/*N*/ // keine DocShell uebergeben, also beginne mit der ersten aus der
+/*N*/ // DocShell Liste
+/*?*/ pShell = SfxObjectShell::GetFirst( &aType );
+/*N*/
+/*N*/ while( pShell )
+/*N*/ {
+/*N*/ // die wollen wir haben
+/*N*/ SfxMedium* pMed = pShell->GetMedium();
+/*N*/ if( pMed && pMed->GetURLObject() == aTmpObj )
+/*N*/ {
+/*?*/ const SfxPoolItem* pItem;
+/*?*/ if( ( SFX_ITEM_SET == pMed->GetItemSet()->GetItemState(
+/*?*/ SID_VERSION, FALSE, &pItem ) )
+/*?*/ ? (nVersion == ((SfxInt16Item*)pItem)->GetValue())
+/*?*/ : !nVersion )
+/*?*/ {
+/*?*/ // gefunden also returnen
+/*?*/ xDocSh = pShell;
+/*?*/ return 1;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bFirst )
+/*N*/ {
+/*N*/ bFirst = FALSE;
+/*N*/ pShell = SfxObjectShell::GetFirst( &aType );
+/*N*/ }
+/*N*/ else
+/*?*/ pShell = SfxObjectShell::GetNext( *pShell, &aType );
+/*N*/ }
+/*N*/
+/*N*/ // 2. selbst die Date oeffnen
+/*N*/ SfxMedium* pMed = new SfxMedium( aTmpObj.GetMainURL(
+/*N*/ INetURLObject::NO_DECODE ), STREAM_READ, TRUE );
+/*N*/ if( INET_PROT_FILE == aTmpObj.GetProtocol() )
+/*N*/ pMed->DownLoad(); // nur mal das Medium anfassen (DownLoaden)
+/*N*/
+/*N*/ const SfxFilter* pSfxFlt = 0;
+/*N*/ if( !pMed->GetError() )
+/*N*/ {
+/*N*/ // kein Filter, dann suche ihn. Ansonsten teste, ob der angegebene
+/*N*/ // ein gueltiger ist
+/*N*/ if( rFilter.Len() )
+/*N*/ {
+/*N*/ pSfxFlt = SwIoSystem::GetFilterOfFilterTxt( rFilter );
+/*N*/ if( pSfxFlt && !SwIoSystem::IsFileFilter( *pMed, pSfxFlt->GetUserData() ) && (pSfxFlt->GetFilterFlags() & SFX_FILTER_STARONEFILTER) == 0 )
+/*N*/ pSfxFlt = 0; // dann neu detecten lassen
+/*N*/ }
+/*N*/
+/*N*/ if( !pSfxFlt )
+/*N*/ pSfxFlt = SwIoSystem::GetFileFilter( pMed->GetPhysicalName(), aEmptyStr );
+/*N*/
+/*N*/ if( pSfxFlt )
+/*N*/ {
+/*N*/ // ohne Filter geht gar nichts
+/*N*/ pMed->SetFilter( pSfxFlt );
+/*N*/
+/*N*/ if( nVersion )
+/*?*/ pMed->GetItemSet()->Put( SfxInt16Item( SID_VERSION, nVersion ));
+/*N*/
+/*N*/ if( rPasswd.Len() )
+/*?*/ pMed->GetItemSet()->Put( SfxStringItem( SID_PASSWORD, rPasswd ));
+/*N*/
+/*N*/ xDocSh = new SwDocShell( SFX_CREATE_MODE_INTERNAL );
+/*N*/ if( xDocSh->DoLoad( pMed ) )
+/*N*/ return 2;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*?*/ if( !xDocSh.Is() ) // Medium muss noch geloescht werden
+/*?*/ delete pMed;
+/*?*/
+/*?*/ return 0; // das war wohl nichts
+/*N*/ }
+
+
+/*N*/ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
+/*N*/ const ::com::sun::star::uno::Any & rValue )
+/*N*/ {
+/*N*/ SwSectionNode* pSectNd = rSectFmt.GetSectionNode( FALSE );
+/*N*/ SwDoc* pDoc = rSectFmt.GetDoc();
+/*N*/
+/*N*/ ULONG nDataFormat = SotExchange::GetFormatIdFromMimeType( rMimeType );
+/*N*/
+/*N*/ if( !pSectNd || !pDoc || pDoc->IsInDtor() || ChkNoDataFlag() ||
+/*N*/ SvxLinkManager::RegisterStatusInfoId() == nDataFormat )
+/*N*/ {
+/*N*/ // sollten wir schon wieder im Undo stehen?
+/*?*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ // Undo immer abschalten
+/*N*/ BOOL bWasVisibleLinks = pDoc->IsVisibleLinks();
+/*N*/ pDoc->SetVisibleLinks( FALSE );
+/*N*/
+/*N*/ SwPaM* pPam;
+/*N*/ ViewShell* pVSh = 0;
+/*N*/ SwEditShell* pESh = pDoc->GetEditShell( &pVSh );
+/*N*/ pDoc->LockExpFlds();
+/*N*/ {
+/*N*/ // am Anfang des Bereichs einen leeren TextNode einfuegen
+/*N*/ SwNodeIndex aIdx( *pSectNd, +1 );
+/*N*/ SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
+/*N*/ SwTxtNode* pNewNd = pDoc->GetNodes().MakeTxtNode( aIdx,
+/*N*/ pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT ) );
+/*N*/
+/*N*/ if( pESh )
+/*N*/ pESh->StartAllAction();
+/*N*/ else if( pVSh )
+/*?*/ pVSh->StartAction();
+/*N*/
+/*N*/ SwPosition aPos( aIdx, SwIndex( pNewNd, 0 ));
+/*N*/ aPos.nNode--;
+/*N*/ pDoc->CorrAbs( aIdx, aEndIdx, aPos, TRUE );
+/*N*/
+/*N*/ pPam = new SwPaM( aPos );
+/*N*/
+/*N*/ //und alles dahinter liegende loeschen
+/*N*/ aIdx--;
+/*N*/ DelFlyInRange( aIdx, aEndIdx );
+/*N*/ _DelBookmarks( aIdx, aEndIdx );
+/*N*/ aIdx++;
+/*N*/
+/*N*/ pDoc->GetNodes().Delete( aIdx, aEndIdx.GetIndex() - aIdx.GetIndex() );
+/*N*/ }
+/*N*/
+/*N*/ SwSection& rSection = pSectNd->GetSection();
+/*N*/ rSection.SetConnectFlag( FALSE );
+/*N*/
+/*N*/ ::rtl::OUString sNewFileName;
+/*N*/ Reader* pRead = 0;
+/*N*/ switch( nDataFormat )
+/*N*/ {
+/*N*/ case FORMAT_STRING:
+/*?*/ pRead = ReadAscii;
+/*?*/ break;
+/*?*/
+/*?*/ case FORMAT_RTF:
+/*?*/ pRead = ReadRtf;
+/*?*/ break;
+/*N*/
+/*N*/ case FORMAT_FILE:
+/*N*/ if( rValue.hasValue() && ( rValue >>= sNewFileName ) )
+/*N*/ {
+/*N*/ String sFilter, sRange, sFileName( sNewFileName );
+/*N*/ pDoc->GetLinkManager().GetDisplayNames( this, 0, &sFileName,
+/*N*/ &sRange, &sFilter );
+/*N*/
+/*N*/ SwRedlineMode eOldRedlineMode = REDLINE_NONE;
+/*N*/ SfxObjectShellRef xDocSh;
+/*N*/ int nRet;
+/*N*/ if( !sFileName.Len() )
+/*N*/ {
+/*N*/ xDocSh = pDoc->GetDocShell();
+/*N*/ nRet = 1;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nRet = lcl_FindDocShell( xDocSh, sFileName,
+/*N*/ rSection.GetLinkFilePassWd(),
+/*N*/ sFilter, 0, pDoc->GetDocShell() );
+/*N*/ if( nRet )
+/*N*/ {
+/*N*/ SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
+/*N*/ eOldRedlineMode = pSrcDoc->GetRedlineMode();
+/*N*/ pSrcDoc->SetRedlineMode( REDLINE_SHOW_INSERT );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nRet )
+/*N*/ {
+/*N*/ rSection.SetConnectFlag( TRUE );
+/*N*/
+/*N*/ SwNodeIndex aSave( pPam->GetPoint()->nNode, -1 );
+/*N*/ SwNodeRange* pCpyRg = 0;
+/*N*/
+/*N*/ if( xDocSh->GetMedium() &&
+/*N*/ !rSection.GetLinkFilePassWd().Len() )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == xDocSh->GetMedium()->GetItemSet()->
+/*N*/ GetItemState( SID_PASSWORD, FALSE, &pItem ) )
+/*?*/ rSection.SetLinkFilePassWd(
+/*?*/ ((SfxStringItem*)pItem)->GetValue() );
+/*N*/ }
+/*N*/
+/*N*/ SwDoc* pSrcDoc = ((SwDocShell*)&xDocSh)->GetDoc();
+/*N*/
+/*N*/ if( sRange.Len() )
+/*N*/ {
+/*N*/ // Rekursionen abfangen
+/*N*/ BOOL bRecursion = FALSE;
+/*N*/ if( pSrcDoc == pDoc )
+/*N*/ {
+/*N*/ SwServerObjectRef refObj( (SwServerObject*)
+/*N*/ pDoc->CreateLinkSource( sRange ));
+/*N*/ if( refObj.Is() )
+/*N*/ {
+/*N*/ bRecursion = refObj->IsLinkInServer( this ) ||
+/*N*/ ChkNoDataFlag();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
+/*N*/
+/*N*/ SwPaM* pCpyPam = 0;
+/*N*/ if( !bRecursion &&
+/*N*/ pSrcDoc->SelectServerObj( sRange, pCpyPam, pCpyRg )
+/*N*/ && pCpyPam )
+/*N*/ {
+/*?*/ if( pSrcDoc != pDoc ||
+/*?*/ pCpyPam->Start()->nNode > rInsPos ||
+/*?*/ rInsPos >= pCpyPam->End()->nNode )
+/*?*/ pSrcDoc->Copy( *pCpyPam, *pPam->GetPoint() );
+/*?*/ delete pCpyPam;
+/*N*/ }
+/*N*/ if( pCpyRg && pSrcDoc == pDoc &&
+/*N*/ pCpyRg->aStart < rInsPos && rInsPos < pCpyRg->aEnd )
+/*?*/ delete pCpyRg, pCpyRg = 0;
+/*N*/ }
+/*N*/ else if( pSrcDoc != pDoc )
+/*N*/ pCpyRg = new SwNodeRange( pSrcDoc->GetNodes().GetEndOfExtras(), 2,
+/*N*/ pSrcDoc->GetNodes().GetEndOfContent() );
+/*N*/
+/*N*/ if( pCpyRg )
+/*N*/ {
+/*N*/ SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
+/*N*/ BOOL bCreateFrm = rInsPos.GetIndex() <=
+/*N*/ pDoc->GetNodes().GetEndOfExtras().GetIndex() ||
+/*N*/ rInsPos.GetNode().FindTableNode();
+/*N*/
+/*N*/ SwTblNumFmtMerge aTNFM( *pSrcDoc, *pDoc );
+/*N*/
+/*N*/ pSrcDoc->CopyWithFlyInFly( *pCpyRg, rInsPos, bCreateFrm );
+/*N*/ aSave++;
+/*N*/
+/*N*/ if( !bCreateFrm )
+/*N*/ ::binfilter::MakeFrms( pDoc, aSave, rInsPos );
+/*N*/
+/*N*/ // den letzten Node noch loeschen, aber nur wenn
+/*N*/ // erfolgreich kopiert werden konnte, also der Bereich
+/*N*/ // mehr als 1 Node enthaelt
+/*N*/ if( 2 < pSectNd->EndOfSectionIndex() - pSectNd->GetIndex() )
+/*N*/ {
+/*N*/ aSave = rInsPos;
+/*N*/ pPam->Move( fnMoveBackward, fnGoNode );
+/*N*/ pPam->SetMark(); // beide SwPositions ummelden!
+/*N*/
+/*N*/ pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, TRUE );
+/*N*/ pDoc->GetNodes().Delete( aSave, 1 );
+/*N*/ }
+/*N*/ delete pCpyRg;
+/*N*/ }
+/*N*/
+/*N*/ // update alle Links in diesem Bereich
+/*N*/ lcl_UpdateLinksInSect( *this, *pSectNd );
+/*N*/ }
+/*N*/ if( xDocSh.Is() )
+/*N*/ {
+/*N*/ if( 2 == nRet )
+/*N*/ xDocSh->DoClose();
+/*N*/ else if( ((SwDocShell*)&xDocSh)->GetDoc() )
+/*N*/ ((SwDocShell*)&xDocSh)->GetDoc()->SetRedlineMode(
+/*N*/ eOldRedlineMode );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ // !!!! DDE nur updaten wenn Shell vorhanden ist??
+/*N*/ ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
+/*N*/ if( pRead && rValue.hasValue() && ( rValue >>= aSeq ) )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( pESh )
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ // Alle UndoActions entfernen und Undo wieder einschalten
+/*N*/ pDoc->SetVisibleLinks( bWasVisibleLinks );
+/*N*/
+/*N*/ pDoc->UnlockExpFlds();
+/*N*/ if( !pDoc->IsExpFldsLocked() )
+/*N*/ pDoc->UpdateExpFlds();
+/*N*/
+/*N*/ if( pESh )
+/*N*/ pESh->EndAllAction();
+/*N*/ else if( pVSh )
+/*?*/ pVSh->EndAction();
+/*N*/ delete pPam; // wurde am Anfang angelegt
+/*N*/ }
+
+
+
+
+/*N*/ void SwSection::CreateLink( LinkCreateType eCreateType )
+/*N*/ {
+/*N*/ SwSectionFmt* pFmt = GetFmt();
+/*N*/ if( !pFmt || CONTENT_SECTION == eType )
+/*?*/ return ;
+/*N*/
+/*N*/ USHORT nUpdateType = ::binfilter::LINKUPDATE_ALWAYS;
+/*N*/
+/*N*/ if( !refLink.Is() )
+/*N*/ // dann mal den BaseLink aufbauen
+/*N*/ refLink = new SwIntrnlSectRefLink( *pFmt, nUpdateType, FORMAT_RTF );
+/*N*/ else
+/*N*/ // sonst aus dem Linkmanager entfernen
+/*?*/ pFmt->GetDoc()->GetLinkManager().Remove( refLink );
+/*N*/
+/*N*/ SwIntrnlSectRefLink* pLnk = (SwIntrnlSectRefLink*)&refLink;
+/*N*/
+/*N*/ String sCmd( sLinkFileName );
+/*N*/ xub_StrLen nPos;
+/*N*/ while( STRING_NOTFOUND != (nPos = sCmd.SearchAscii( " " )) )
+/*?*/ sCmd.Erase( nPos, 1 );
+/*N*/
+/*N*/ pLnk->SetUpdateMode( nUpdateType );
+/*N*/ pLnk->SetVisible( pFmt->GetDoc()->IsVisibleLinks() );
+/*N*/
+/*N*/ switch( eType )
+/*N*/ {
+/*N*/ case DDE_LINK_SECTION:
+/*?*/ pLnk->SetLinkSourceName( sCmd );
+/*?*/ pFmt->GetDoc()->GetLinkManager().InsertDDELink( pLnk );
+/*?*/ break;
+/*N*/ case FILE_LINK_SECTION:
+/*N*/ {
+/*N*/ pLnk->SetContentType( FORMAT_FILE );
+/*N*/ String sFltr( sCmd.GetToken( 1, ::binfilter::cTokenSeperator ) );
+/*N*/ String sRange( sCmd.GetToken( 2, ::binfilter::cTokenSeperator ) );
+/*N*/ pFmt->GetDoc()->GetLinkManager().InsertFileLink( *pLnk, eType,
+/*N*/ sCmd.GetToken( 0, ::binfilter::cTokenSeperator ),
+/*N*/ ( sFltr.Len() ? &sFltr : 0 ),
+/*N*/ ( sRange.Len() ? &sRange : 0 ) );
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ ASSERT( !this, "Was ist das fuer ein Link?" )
+/*N*/ }
+/*N*/
+/*N*/ switch( eCreateType )
+/*N*/ {
+/*N*/ case CREATE_CONNECT: // Link gleich connecten
+/*N*/ pLnk->Connect();
+/*N*/ break;
+/*N*/
+/*N*/ case CREATE_UPDATE: // Link connecten und updaten
+/*N*/ pLnk->Update();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ BOOL SwIntrnlSectRefLink::IsInRange( ULONG nSttNd, ULONG nEndNd,
+/*N*/ xub_StrLen nStt, xub_StrLen nEnd ) const
+/*N*/ {
+/*N*/ SwStartNode* pSttNd = rSectFmt.GetSectionNode( FALSE );
+/*N*/ return pSttNd &&
+/*N*/ nSttNd < pSttNd->GetIndex() &&
+/*N*/ pSttNd->EndOfSectionIndex() < nEndNd;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/docnode/sw_swbaslnk.cxx b/binfilter/bf_sw/source/core/docnode/sw_swbaslnk.cxx
new file mode 100644
index 000000000000..39f769f714ce
--- /dev/null
+++ b/binfilter/bf_sw/source/core/docnode/sw_swbaslnk.cxx
@@ -0,0 +1,478 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+
+#include <hintids.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/svxids.hrc> // fuer die EventIds
+#include <bf_svx/linkmgr.hxx>
+
+#include <fmtfsize.hxx>
+#include <fmtanchr.hxx>
+#include <frmatr.hxx>
+#include <frmfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <pam.hxx>
+#include <editsh.hxx>
+#include <swbaslnk.hxx>
+#include <swserv.hxx>
+#include <ndgrf.hxx>
+#include <hints.hxx>
+#include <cntfrm.hxx>
+namespace binfilter {
+
+/*N*/ BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd );
+
+/*N*/ TYPEINIT1( SwBaseLink, ::binfilter::SvBaseLink );
+
+/*N*/ SV_IMPL_REF( SwServerObject )
+
+/*N*/ SwBaseLink::~SwBaseLink()
+/*N*/ {
+/*N*/ }
+
+/*N*/ void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
+/*N*/ {
+/*N*/ //JP 4.7.2001: call fist all not SwNoTxtFrames, then the SwNoTxtFrames.
+/*N*/ // The reason is, that in the SwNoTxtFrames the Graphic
+/*N*/ // after a Paint will be swapped out! So all other "behind"
+/*N*/ // them havent't a loaded Graphic. - #86501#
+/*N*/ rGrfNd.LockModify();
+/*N*/
+/*N*/ SwClientIter aIter( rGrfNd );
+/*N*/ for( int n = 0; n < 2; ++n )
+/*N*/ {
+/*N*/ SwClient * pLast = aIter.GoStart();
+/*N*/ if( pLast ) // konnte zum Anfang gesprungen werden ??
+/*N*/ {
+/*N*/ do {
+/*N*/ if( (0 == n) ^ ( 0 != pLast->ISA( SwCntntFrm )) )
+/*N*/ pLast->Modify( &rItem, &rItem );
+/*N*/ } while( 0 != ( pLast = aIter++ ));
+/*N*/ }
+/*N*/ }
+/*N*/ rGrfNd.UnlockModify();
+/*N*/ }
+
+
+/*N*/ void SwBaseLink::DataChanged( const String& rMimeType,
+/*N*/ const ::com::sun::star::uno::Any & rValue )
+/*N*/ {
+/*N*/ if( !pCntntNode )
+/*N*/ {
+/*?*/ ASSERT(!this, "DataChanged ohne ContentNode" );
+/*?*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ SwDoc* pDoc = pCntntNode->GetDoc();
+/*N*/ if( pDoc->IsInDtor() || ChkNoDataFlag() || bIgnoreDataChanged )
+/*N*/ {
+/*?*/ bIgnoreDataChanged = FALSE;
+/*?*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ ULONG nFmt = SotExchange::GetFormatIdFromMimeType( rMimeType );
+/*N*/
+/*N*/ if( pCntntNode->IsNoTxtNode() &&
+/*N*/ nFmt == SvxLinkManager::RegisterStatusInfoId() )
+/*N*/ {
+/*?*/ // nur eine Statusaenderung - Events bedienen ?
+/*?*/ ::rtl::OUString sState;
+/*?*/ if( rValue.hasValue() && ( rValue >>= sState ))
+/*?*/ {
+/*?*/ USHORT nEvent = 0;
+/*?*/ switch( sState.toInt32() )
+/*?*/ {
+/*?*/ case STATE_LOAD_OK: nEvent = SVX_EVENT_IMAGE_LOAD; break;
+/*?*/ case STATE_LOAD_ERROR: nEvent = SVX_EVENT_IMAGE_ERROR; break;
+/*?*/ case STATE_LOAD_ABORT: nEvent = SVX_EVENT_IMAGE_ABORT; break;
+/*?*/ }
+/*?*/
+/*?*/ SwFrmFmt* pFmt;
+/*?*/ if( nEvent && 0 != ( pFmt = pCntntNode->GetFlyFmt() ))
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwCallMouseEvent aCallEvent;
+/*?*/ }
+/*?*/ }
+/*?*/ return; // das wars!
+/*N*/ }
+/*N*/
+/*N*/ FASTBOOL bUpdate = FALSE;
+/*N*/ FASTBOOL bGraphicArrived = FALSE;
+/*N*/ FASTBOOL bGraphicPieceArrived = FALSE;
+/*N*/ FASTBOOL bDontNotify = FALSE;
+/*N*/ Size aGrfSz, aFrmFmtSz;
+/*N*/
+/*N*/ if( pCntntNode->IsGrfNode() )
+/*N*/ {
+/*N*/ BfGraphicObject& rGrfObj = ((SwGrfNode*)pCntntNode)->GetGrfObj();
+/*N*/
+/*N*/ bDontNotify = ((SwGrfNode*)pCntntNode)->IsFrameInPaint();
+/*N*/
+/*N*/ bGraphicArrived = GetObj()->IsDataComplete();
+/*N*/ bGraphicPieceArrived = GetObj()->IsPending();
+/*N*/ ((SwGrfNode*)pCntntNode)->SetGrafikArrived( bGraphicArrived );
+/*N*/
+/*N*/ Graphic aGrf;
+/*N*/ if( SvxLinkManager::GetGraphicFromAny( rMimeType, rValue, aGrf ) &&
+/*N*/ ( GRAPHIC_DEFAULT != aGrf.GetType() ||
+/*N*/ GRAPHIC_DEFAULT != rGrfObj.GetType() ) )
+/*N*/ {
+/*N*/ aGrfSz = ::binfilter::GetGraphicSizeTwip( aGrf, 0 );
+/*N*/ if( static_cast< const SwGrfNode * >( pCntntNode )->IsChgTwipSizeFromPixel() )
+/*N*/ {
+/*N*/ const MapMode aMapTwip( MAP_TWIP );
+/*N*/ aFrmFmtSz =
+/*N*/ Application::GetDefaultDevice()->PixelToLogic(
+/*N*/ aGrf.GetSizePixel(), aMapTwip );
+/*N*/
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrmFmtSz = aGrfSz;
+/*N*/ }
+/*N*/ Size aSz( ((SwGrfNode*)pCntntNode)->GetTwipSize() );
+/*N*/
+/*N*/ if( bGraphicPieceArrived && GRAPHIC_DEFAULT != aGrf.GetType() &&
+/*N*/ ( !aSz.Width() || !aSz.Height() ) )
+/*N*/ {
+/*N*/ // wenn nur ein Teil ankommt, aber die Groesse nicht
+/*N*/ // gesetzt ist, dann muss "unten" der Teil von
+/*N*/ // bGraphicArrived durchlaufen werden!
+/*N*/ // (ansonten wird die Grafik in deft. Size gepaintet)
+/*N*/ bGraphicArrived = TRUE;
+/*N*/ bGraphicPieceArrived = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ rGrfObj.SetGraphic( aGrf, rGrfObj.GetLink() );
+/*N*/ bUpdate = TRUE;
+/*N*/
+/*N*/ // Bug 33999: damit der Node den Transparent-Status
+/*N*/ // richtig gesetzt hat, ohne auf die Grafik
+/*N*/ // zugreifen zu muessen (sonst erfolgt ein SwapIn!).
+/*N*/ if( bGraphicArrived )
+/*N*/ {
+/*N*/ // Bug #34735#: immer mit der korrekten Grafik-Size
+/*N*/ // arbeiten
+/*N*/ if( aGrfSz.Height() && aGrfSz.Width() &&
+/*N*/ aSz.Height() && aSz.Width() &&
+/*N*/ aGrfSz != aSz )
+/*?*/ ((SwGrfNode*)pCntntNode)->SetTwipSize( aGrfSz );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bUpdate && !bGraphicArrived && !bGraphicPieceArrived )
+/*?*/ ((SwGrfNode*)pCntntNode)->SetTwipSize( Size(0,0) );
+/*N*/ }
+/*N*/ else if( pCntntNode->IsOLENode() )
+/*?*/ bUpdate = TRUE;
+/*N*/
+/*N*/ ViewShell *pSh = 0;
+/*N*/ SwEditShell* pESh = pDoc->GetEditShell( &pSh );
+/*N*/
+/*N*/ if ( bUpdate && bGraphicPieceArrived && !(bSwapIn || bDontNotify) )
+/*N*/ {
+/*?*/ //Hint ohne Actions verschicken, loest direktes Paint aus.
+/*?*/ if ( (!pSh || !pSh->ActionPend()) && (!pESh || !pESh->ActionPend()) )
+/*?*/ {
+/*?*/ SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
+/*?*/ pCntntNode->Modify( &aMsgHint, &aMsgHint );
+/*?*/ bUpdate = FALSE;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ static BOOL bInNotifyLinks = FALSE;
+/*N*/ if( bUpdate && !bDontNotify && (!bSwapIn || bGraphicArrived) &&
+/*N*/ !bInNotifyLinks)
+/*N*/ {
+/*N*/ BOOL bLockView = FALSE;
+/*N*/ if( pSh )
+/*N*/ {
+/*N*/ bLockView = pSh->IsViewLocked();
+/*N*/ pSh->LockView( TRUE );
+/*N*/ }
+/*N*/
+/*N*/ if( pESh )
+/*N*/ pESh->StartAllAction();
+/*N*/ else if( pSh )
+/*?*/ pSh->StartAction();
+/*N*/
+/*N*/ SwMsgPoolItem aMsgHint( bGraphicArrived ? RES_GRAPHIC_ARRIVED :
+/*N*/ RES_UPDATE_ATTR );
+/*N*/
+/*N*/ if ( bGraphicArrived )
+/*N*/ {
+/*N*/ //Alle benachrichtigen, die am gleichen Link horchen.
+/*N*/ bInNotifyLinks = TRUE;
+/*N*/
+/*N*/ const ::binfilter::SvBaseLinks& rLnks = pDoc->GetLinkManager().GetLinks();
+/*N*/ for( USHORT n = rLnks.Count(); n; )
+/*N*/ {
+/*N*/ ::binfilter::SvBaseLink* pLnk = &(*rLnks[ --n ]);
+/*N*/ if( pLnk && OBJECT_CLIENT_GRF == pLnk->GetObjType() &&
+/*N*/ pLnk->ISA( SwBaseLink ) && pLnk->GetObj() == GetObj() )
+/*N*/ {
+/*N*/ SwBaseLink* pBLink = (SwBaseLink*)pLnk;
+/*N*/ SwGrfNode* pGrfNd = (SwGrfNode*)pBLink->pCntntNode;
+/*N*/
+/*N*/ if( pBLink != this &&
+/*N*/ ( !bSwapIn ||
+/*N*/ GRAPHIC_DEFAULT == pGrfNd->GetGrfObj().GetType()))
+/*N*/ {
+/*?*/ pBLink->bIgnoreDataChanged = FALSE;
+/*?*/ pBLink->DataChanged( rMimeType, rValue );
+/*?*/ pBLink->bIgnoreDataChanged = TRUE;
+/*?*/
+/*?*/ pGrfNd->SetGrafikArrived( ((SwGrfNode*)pCntntNode)->
+/*?*/ IsGrafikArrived() );
+/*?*/
+/*?*/ // Fly der Grafik anpassen !
+/*?*/ if( !::binfilter::SetGrfFlySize( aGrfSz, aFrmFmtSz, pGrfNd ) )
+/*?*/ ::binfilter::lcl_CallModify( *pGrfNd, aMsgHint );
+/*N*/ }
+/*N*/ else if( pBLink == this &&
+/*N*/ !::binfilter::SetGrfFlySize( aGrfSz, aFrmFmtSz, pGrfNd ) )
+/*N*/ // Fly der Grafik anpassen !
+/*N*/ ::binfilter::lcl_CallModify( *pGrfNd, aMsgHint );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ bInNotifyLinks = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ pCntntNode->Modify( &aMsgHint, &aMsgHint );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ if( pESh )
+/*N*/ {
+/*N*/ const BOOL bEndActionByVirDev = pESh->IsEndActionByVirDev();
+/*N*/ pESh->SetEndActionByVirDev( TRUE );
+/*N*/ pESh->EndAllAction();
+/*N*/ pESh->SetEndActionByVirDev( bEndActionByVirDev );
+/*N*/ }
+/*N*/ else if( pSh )
+/*?*/ pSh->EndAction();
+/*N*/
+/*N*/ if( pSh && !bLockView )
+/*N*/ pSh->LockView( FALSE );
+/*N*/ }
+/*N*/ }
+
+/*N*/ FASTBOOL SwBaseLink::IsShowQuickDrawBmp() const
+/*N*/ {
+/*N*/ return pCntntNode && pCntntNode->IsGrfNode() &&
+/*N*/ #ifdef NEW_GRFOBJ
+/*N*/ ((SwGrfNode*)pCntntNode)->HasMagicId()
+/*N*/ #else
+/*N*/ // wie kommt man an die Info dran, das eine Grafik im Cache steht?
+/*N*/ FALSE
+/*N*/ #endif
+/*N*/ ;
+/*N*/ }
+
+
+/*N*/ BOOL SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfNd )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ ViewShell *pSh;
+/*N*/ CurrShell *pCurr = 0;
+/*N*/ if ( pGrfNd->GetDoc()->GetEditShell( &pSh ) )
+/*N*/ pCurr = new CurrShell( pSh );
+/*N*/
+/*N*/ Size aSz = pGrfNd->GetTwipSize();
+/*N*/ if ( !(aSz.Width() && aSz.Height()) &&
+/*N*/ rGrfSz.Width() && rGrfSz.Height() )
+/*N*/ {
+/*N*/ SwFrmFmt* pFmt;
+/*N*/ if( pGrfNd->IsChgTwipSize() &&
+/*N*/ 0 != (pFmt = pGrfNd->GetFlyFmt()) )
+/*N*/ {
+/*?*/ Size aCalcSz( aSz );
+/*?*/ if ( !aSz.Height() && aSz.Width() )
+/*?*/ //passende Hoehe ausrechnen.
+/*?*/ aCalcSz.Height() = rFrmSz.Height() *
+/*?*/ aSz.Width() / rFrmSz.Width();
+/*?*/ else if ( !aSz.Width() && aSz.Height() )
+/*?*/ //passende Breite ausrechnen
+/*?*/ aCalcSz.Width() = rFrmSz.Width() *
+/*?*/ aSz.Height() / rFrmSz.Height();
+/*?*/ else
+/*?*/ //Hoehe und Breite uebernehmen
+/*?*/ aCalcSz = rFrmSz;
+/*?*/
+/*?*/ const SvxBoxItem &rBox = pFmt->GetBox();
+/*?*/ aCalcSz.Width() += rBox.CalcLineSpace(BOX_LINE_LEFT) +
+/*?*/ rBox.CalcLineSpace(BOX_LINE_RIGHT);
+/*?*/ aCalcSz.Height()+= rBox.CalcLineSpace(BOX_LINE_TOP) +
+/*?*/ rBox.CalcLineSpace(BOX_LINE_BOTTOM);
+/*?*/ const SwFmtFrmSize& rOldAttr = pFmt->GetFrmSize();
+/*?*/ if( rOldAttr.GetSize() != aCalcSz )
+/*?*/ {
+/*?*/ SwFmtFrmSize aAttr( rOldAttr );
+/*?*/ aAttr.SetSize( aCalcSz );
+/*?*/ pFmt->SetAttr( aAttr );
+/*?*/ bRet = TRUE;
+/*?*/ }
+/*?*/
+/*?*/ if( !aSz.Width() )
+/*?*/ {
+/*?*/ // Wenn die Grafik in einer Tabelle verankert ist, muess
+/*?*/ // die Tabellen-Spalten neu berechnet werden
+/*?*/ const SwDoc *pDoc = pGrfNd->GetDoc();
+/*?*/ const SwPosition* pAPos = pFmt->GetAnchor().GetCntntAnchor();
+/*?*/ SwNode *pANd;
+/*?*/ SwTableNode *pTblNd;
+/*?*/ if( pAPos &&
+/*?*/ 0 != (pANd = pDoc->GetNodes()[pAPos->nNode]) &&
+/*?*/ 0 != (pTblNd = pANd->FindTableNode()) )
+/*?*/ {
+/*?*/ BOOL bLastGrf = !pTblNd->GetTable().DecGrfsThatResize();
+/*?*/ SwHTMLTableLayout *pLayout =
+/*?*/ pTblNd->GetTable().GetHTMLTableLayout();
+/*?*/ if( pLayout )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 USHORT nBrowseWidth =
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // SetTwipSize skaliert ggf. eine ImageMap neu und
+/*N*/ // braucht dazu das Frame-Format
+/*N*/ pGrfNd->SetTwipSize( rGrfSz );
+/*N*/ }
+/*N*/
+/*N*/ delete pCurr;
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ FASTBOOL SwBaseLink::SwapIn( BOOL bWaitForData, BOOL bNativFormat )
+/*N*/ {
+/*N*/ bSwapIn = TRUE;
+/*N*/
+/*N*/ FASTBOOL bRes;
+/*N*/
+/*N*/ if( !GetObj() && ( bNativFormat || ( !IsSynchron() && bWaitForData ) ))
+/*N*/ {
+/*?*/ AddNextRef();
+/*?*/ _GetRealObject();
+/*?*/ ReleaseRef();
+/*N*/ }
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ {
+/*N*/ String sGrfNm;
+/*N*/ GetLinkManager()->GetDisplayNames( this, 0, &sGrfNm, 0, 0 );
+/*N*/ int x = 0;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if( GetObj() )
+/*N*/ {
+/*N*/ String aMimeType( SotExchange::GetFormatMimeType( GetContentType() ));
+/*N*/
+/*N*/ //!! ??? what have we here to do ????
+/*N*/ //!! if( bNativFormat )
+/*N*/ //!! aData.SetAspect( aData.GetAspect() | ASPECT_ICON );
+/*N*/
+/*N*/ ::com::sun::star::uno::Any aValue;
+/*N*/ GetObj()->GetData( aValue, aMimeType, !IsSynchron() && bWaitForData );
+/*N*/
+/*N*/ if( bWaitForData && !GetObj() )
+/*N*/ {
+/*?*/ ASSERT( !this, "das SvxFileObject wurde in einem GetData geloescht!" );
+/*?*/ bRes = FALSE;
+/*N*/ }
+/*N*/ else if( 0 != ( bRes = aValue.hasValue() ) )
+/*N*/ {
+/*N*/ //JP 14.04.99: Bug 64820 - das Flag muss beim SwapIn natuerlich
+/*N*/ // zurueckgesetzt werden. Die Daten sollen ja neu
+/*N*/ // uebernommen werden
+/*N*/ bIgnoreDataChanged = FALSE;
+/*N*/ DataChanged( aMimeType, aValue );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( !IsSynchron() && bWaitForData )
+/*N*/ {
+/*?*/ SetSynchron( TRUE );
+/*?*/ bRes = Update();
+/*?*/ SetSynchron( FALSE );
+/*N*/ }
+/*N*/ else
+/*N*/ bRes = Update();
+/*N*/
+/*N*/ bSwapIn = FALSE;
+/*N*/ return bRes;
+/*N*/ }
+
+
+
+/*N*/ BOOL SwBaseLink::IsRecursion( const SwBaseLink* pChkLnk ) const
+/*N*/ {
+/*N*/ SwServerObjectRef aRef( (SwServerObject*)GetObj() );
+/*N*/ if( aRef.Is() )
+/*N*/ {
+/*N*/ // es ist ein ServerObject, also frage nach allen darin
+/*N*/ // befindlichen Links, ob wir darin enthalten sind. Ansonsten
+/*N*/ // handelt es sich um eine Rekursion.
+/*N*/ return aRef->IsLinkInServer( pChkLnk );
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ BOOL SwBaseLink::IsInRange( ULONG, ULONG, xub_StrLen, xub_StrLen ) const
+/*N*/ {
+/*N*/ // Grafik oder OLE-Links nicht,
+/*N*/ // Felder oder Sections haben eigene Ableitung!
+/*N*/ return FALSE;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/draw/makefile.mk b/binfilter/bf_sw/source/core/draw/makefile.mk
new file mode 100644
index 000000000000..ad87fd296f03
--- /dev/null
+++ b/binfilter/bf_sw/source/core/draw/makefile.mk
@@ -0,0 +1,56 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_draw
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_dcontact.obj \
+ $(SLO)$/sw_dflyobj.obj \
+ $(SLO)$/sw_drawdoc.obj \
+ $(SLO)$/sw_dobjfac.obj \
+ $(SLO)$/sw_dpage.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/draw/sw_dcontact.cxx b/binfilter/bf_sw/source/core/draw/sw_dcontact.cxx
new file mode 100644
index 000000000000..912d9f993205
--- /dev/null
+++ b/binfilter/bf_sw/source/core/draw/sw_dcontact.cxx
@@ -0,0 +1,1570 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/svdpage.hxx>
+#include <bf_svx/fmglob.hxx>
+#include <bf_svx/svdogrp.hxx>
+#include <bf_svx/svdviter.hxx>
+#include <bf_svx/svdview.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <viewimp.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtanchr.hxx>
+#include <fmtcntnt.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <frmtool.hxx> // Notify_Background
+#include <flyfrm.hxx>
+#include <frmfmt.hxx>
+#include <dflyobj.hxx>
+#include <dcontact.hxx>
+#include <pam.hxx>
+#include <doc.hxx>
+#include <hints.hxx>
+#include <txtfrm.hxx>
+#include <editsh.hxx>
+#include <docary.hxx>
+
+// #108784#
+#include <bf_svx/xoutx.hxx>
+
+// OD 18.06.2003 #108784#
+#include <algorithm>
+namespace binfilter {
+
+
+/*N*/ TYPEINIT1( SwContact, SwClient )
+/*N*/ TYPEINIT1( SwFlyDrawContact, SwContact )
+/*N*/ TYPEINIT1( SwDrawContact, SwContact )
+
+
+//Der Umgekehrte Weg: Sucht das Format zum angegebenen Objekt.
+//Wenn das Object ein SwVirtFlyDrawObj ist so wird das Format von
+//selbigem besorgt.
+//Anderfalls ist es eben ein einfaches Zeichenobjekt. Diese hat einen
+//UserCall und der ist Client vom gesuchten Format.
+
+/*N*/ SwFrmFmt *FindFrmFmt( SdrObject *pObj )
+/*N*/ {
+/*N*/ SwFrmFmt* pRetval = 0L;
+/*N*/
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ pRetval = ((SwVirtFlyDrawObj*)pObj)->GetFmt();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwDrawContact* pContact = static_cast<SwDrawContact*>(GetUserCall( pObj ));
+/*N*/ if ( pContact )
+/*N*/ {
+/*N*/ pRetval = pContact->GetFmt();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return pRetval;
+/*N*/ }
+
+/*N*/ sal_Bool HasWrap( const SdrObject* pObj )
+/*N*/ {
+/*N*/ if ( pObj )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = ::binfilter::FindFrmFmt( pObj );
+/*N*/ if ( pFmt )
+/*N*/ {
+/*N*/ return SURROUND_THROUGHT != pFmt->GetSurround().GetSurround();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return sal_False;
+/*N*/ }
+
+/*****************************************************************************
+ *
+ * GetBoundRect liefert das BoundRect _inklusive_ Abstand des Objekts.
+ *
+ *****************************************************************************/
+
+/*N*/ SwRect GetBoundRect( const SdrObject* pObj )
+/*N*/ {
+/*N*/ SwRect aRet( pObj->GetBoundRect() );
+/*N*/ const SwFmt *pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
+/*N*/ const SvxULSpaceItem &rUL = pFmt->GetULSpace();
+/*N*/ const SvxLRSpaceItem &rLR = pFmt->GetLRSpace();
+/*N*/ {
+/*N*/ aRet.Top ( Max( aRet.Top() - long(rUL.GetUpper()), 0L ));
+/*N*/ aRet.Left( Max( aRet.Left()- long(rLR.GetLeft()), 0L ));
+/*N*/ aRet.SSize().Height() += rUL.GetLower();
+/*N*/ aRet.SSize().Width() += rLR.GetRight();
+/*N*/ }
+/*N*/ return aRet;
+/*N*/ }
+
+/*****************************************************************************
+ *
+ * Moves a SdrObj so that it fits to a given frame
+ *
+ *****************************************************************************/
+
+/*N*/ void CaptureDrawObj( SdrObject& rObj, const SwRect& rFrm )
+/*N*/ {
+/*N*/ Rectangle aRect( rObj.GetBoundRect() );
+/*N*/ if ( aRect.Right() >= rFrm.Right() + 10 )
+/*N*/ {
+/*N*/ Size aSize( rFrm.Right() - aRect.Right(), 0 );
+/*N*/ rObj.Move( aSize );
+/*N*/ aRect = rObj.GetBoundRect();
+/*N*/ }
+/*N*/
+/*N*/ if ( aRect.Left() + 10 <= rFrm.Left() )
+/*N*/ {
+/*N*/ Size aSize( rFrm.Left() - aRect.Left(), 0 );
+/*N*/ rObj.Move( aSize );
+/*N*/ }
+/*N*/ }
+
+//Liefert den UserCall ggf. vom Gruppenobjekt
+/*N*/ SdrObjUserCall* GetUserCall( const SdrObject* pObj )
+/*N*/ {
+/*N*/ SdrObject *pTmp;
+/*N*/ while ( !pObj->GetUserCall() && 0 != (pTmp = pObj->GetUpGroup()) )
+/*N*/ pObj = pTmp;
+/*N*/ return pObj->GetUserCall();
+/*N*/ }
+
+// liefert TRUE falls das SrdObject ein Marquee-Object (Lauftext) ist
+
+/*************************************************************************
+|*
+|* SwContact, Ctor und Dtor
+|*
+|* Ersterstellung AMA 27.Sep.96 18:13
+|* Letzte Aenderung AMA 27.Sep.96
+|*
+|*************************************************************************/
+
+/*N*/ SwContact::SwContact( SwFrmFmt *pToRegisterIn, SdrObject *pObj ) :
+/*N*/ SwClient( pToRegisterIn ),
+/*N*/ pMasterObj( pObj )
+/*N*/ {
+/*N*/ pObj->SetUserCall( this );
+/*N*/ }
+
+/*N*/ SwContact::~SwContact()
+/*N*/ {
+/*N*/ if ( pMasterObj )
+/*N*/ {
+/*N*/ pMasterObj->SetUserCall( 0 ); //Soll mir nicht in den Ruecken fallen.
+/*N*/ if ( pMasterObj->GetPage() ) //Der SdrPage die Verantwortung entziehen.
+/*N*/ pMasterObj->GetPage()->RemoveObject( pMasterObj->GetOrdNum() );
+/*N*/ delete pMasterObj;
+/*N*/ }
+/*N*/ }
+
+// OD 13.05.2003 #108784# - copied inline-implementation of <GetMaster()> and
+// <SetMaster()>
+/*N*/ const SdrObject* SwContact::GetMaster() const
+/*N*/ {
+/*N*/ return pMasterObj;
+/*N*/ }
+/*N*/ SdrObject* SwContact::GetMaster()
+/*N*/ {
+/*N*/ return pMasterObj;
+/*N*/ }
+/*N*/ void SwContact::SetMaster( SdrObject* pNew )
+/*N*/ {
+/*N*/ pMasterObj = pNew;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyDrawContact, Ctor und Dtor
+|*
+|* Ersterstellung OK 23.11.94 18:13
+|* Letzte Aenderung MA 06. Apr. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyDrawContact::SwFlyDrawContact( SwFlyFrmFmt *pToRegisterIn, SdrModel *pMod ) :
+/*N*/ SwContact( pToRegisterIn )
+/*N*/ {
+/*N*/ SetMaster( new SwFlyDrawObj() );
+/*N*/ GetMaster()->SetOrdNum( 0xFFFFFFFE );
+/*N*/ GetMaster()->SetUserCall( this );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyDrawContact::CreateNewRef()
+|*
+|* Ersterstellung MA 14. Dec. 94
+|* Letzte Aenderung MA 24. Apr. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwVirtFlyDrawObj *SwFlyDrawContact::CreateNewRef( SwFlyFrm *pFly )
+/*N*/ {
+/*N*/ SwVirtFlyDrawObj *pDrawObj = new SwVirtFlyDrawObj( *GetMaster(), pFly );
+/*N*/ pDrawObj->SetModel( GetMaster()->GetModel() );
+/*N*/ pDrawObj->SetUserCall( this );
+/*N*/
+/*N*/ //Der Reader erzeugt die Master und setzt diese, um die Z-Order zu
+/*N*/ //transportieren, in die Page ein. Beim erzeugen der ersten Referenz werden
+/*N*/ //die Master aus der Liste entfernt und fuehren von da an ein
+/*N*/ //Schattendasein.
+/*N*/ SdrPage *pPg;
+/*N*/ if ( 0 != ( pPg = GetMaster()->GetPage() ) )
+/*N*/ {
+/*N*/ const UINT32 nOrdNum = GetMaster()->GetOrdNum();
+/*N*/ pPg->ReplaceObject( pDrawObj, nOrdNum );
+/*N*/ }
+/*N*/ return pDrawObj;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyDrawContact::Modify()
+|*
+|* Ersterstellung OK 08.11.94 10:21
+|* Letzte Aenderung MA 06. Dec. 94
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDrawContact, Ctor+Dtor
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 22. Jul. 98
+|*
+|*************************************************************************/
+/*N*/ bool CheckControlLayer( const SdrObject *pObj )
+/*N*/ {
+/*N*/ if ( FmFormInventor == pObj->GetObjInventor() )
+/*N*/ return true;
+/*N*/ if ( pObj->ISA( SdrObjGroup ) )
+/*N*/ {
+/*N*/ const SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList();
+/*N*/ for ( USHORT i = 0; i < pLst->GetObjCount(); ++i )
+/*N*/ if ( ::binfilter::CheckControlLayer( pLst->GetObj( i ) ) )
+/*N*/ return false;
+/*N*/ }
+/*N*/ return false;
+/*N*/ }
+
+/*N*/ SwDrawContact::SwDrawContact( SwFrmFmt *pToRegisterIn, SdrObject *pObj ) :
+/*N*/ SwContact( pToRegisterIn, pObj ),
+/*N*/ pAnchor( 0 ),
+/*N*/ pPage( 0 )
+/*N*/ {
+/*N*/ // clear vector containing 'virtual' drawing objects.
+/*N*/ maDrawVirtObjs.clear();
+/*N*/
+/*N*/ //Controls muessen immer im Control-Layer liegen. Das gilt auch fuer
+/*N*/ //Gruppenobjekte, wenn diese Controls enthalten.
+/*N*/ if ( ::binfilter::CheckControlLayer( pObj ) )
+/*N*/ {
+/*N*/ // OD 25.06.2003 #108784# - set layer of object to corresponding invisible layer.
+/*N*/ pObj->SetLayer( pToRegisterIn->GetDoc()->GetInvisibleControlsId() );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwDrawContact::~SwDrawContact()
+/*N*/ {
+/*N*/ DisconnectFromLayout();
+/*N*/
+/*N*/ // OD 25.06.2003 #108784# - remove 'master' from drawing page
+/*N*/ RemoveMasterFromDrawPage();
+/*N*/
+/*N*/ // remove and destroy 'virtual' drawing objects.
+/*N*/ RemoveAllVirtObjs();
+/*N*/ }
+
+// OD 23.06.2003 #108784# - method to create a new 'virtual' drawing object.
+/*N*/ SwDrawVirtObj* SwDrawContact::CreateVirtObj()
+/*N*/ {
+/*N*/ // determine 'master'
+/*N*/ SdrObject* pOrgMasterSdrObj = GetMaster();
+/*N*/
+/*N*/ // create 'virtual' drawing object
+/*N*/ SwDrawVirtObj* pNewDrawVirtObj = new SwDrawVirtObj ( *(pOrgMasterSdrObj), *(this) );
+/*N*/
+/*N*/ // add new 'virtual' drawing object managing data structure
+/*N*/ maDrawVirtObjs.push_back( pNewDrawVirtObj );
+/*N*/
+/*N*/ return pNewDrawVirtObj;
+/*N*/ }
+
+// OD 23.06.2003 #108784# - destroys a given 'virtual' drawing object.
+// side effect: 'virtual' drawing object is removed from data structure
+// <maDrawVirtObjs>.
+/*N*/ void SwDrawContact::DestroyVirtObj( SwDrawVirtObj* _pVirtObj )
+/*N*/ {
+/*N*/ if ( _pVirtObj )
+/*N*/ {
+/*N*/ delete _pVirtObj;
+/*N*/ _pVirtObj = 0;
+/*N*/ }
+/*N*/ }
+
+// OD 16.05.2003 #108784# - add a 'virtual' drawing object to drawing page.
+// Use an already created one, which isn't used, or create a new one.
+/*N*/ SwDrawVirtObj* SwDrawContact::AddVirtObj()
+/*N*/ {
+/*N*/ SwDrawVirtObj* pAddedDrawVirtObj = 0L;
+/*N*/
+/*N*/ // check, if a disconnected 'virtual' drawing object exist and use it
+/*N*/ std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
+/*N*/ std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
+/*N*/ UsedOrUnusedVirtObjPred( false ) );
+/*N*/
+/*N*/ if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
+/*N*/ {
+/*N*/ // use already created, disconnected 'virtual' drawing object
+/*N*/ pAddedDrawVirtObj = (*aFoundVirtObjIter);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // create new 'virtual' drawing object.
+/*N*/ pAddedDrawVirtObj = CreateVirtObj();
+/*N*/ }
+/*N*/ pAddedDrawVirtObj->AddToDrawingPage();
+/*N*/
+/*N*/ return pAddedDrawVirtObj;
+/*N*/ }
+
+// OD 16.05.2003 #108784# - remove 'virtual' drawing objects and destroy them.
+/*N*/ void SwDrawContact::RemoveAllVirtObjs()
+/*N*/ {
+/*N*/ for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjsIter = maDrawVirtObjs.begin();
+/*N*/ aDrawVirtObjsIter != maDrawVirtObjs.end();
+/*N*/ ++aDrawVirtObjsIter )
+/*N*/ {
+/*N*/ // remove and destroy 'virtual object'
+/*N*/ SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjsIter);
+/*N*/ pDrawVirtObj->RemoveFromWriterLayout();
+/*N*/ pDrawVirtObj->RemoveFromDrawingPage();
+/*N*/ DestroyVirtObj( pDrawVirtObj );
+/*N*/ }
+/*N*/ maDrawVirtObjs.clear();
+/*N*/ }
+
+// OD 16.05.2003 #108784# - overload <SwContact::SetMaster(..)> in order to
+// assert, if the 'master' drawing object is replaced.
+// OD 10.07.2003 #110742# - replace of master object correctly handled, if
+// handled by method <SwDrawContact::ChangeMasterObject(..)>. Thus, assert
+// only, if a debug level is given.
+/*N*/ void SwDrawContact::SetMaster( SdrObject* pNew )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ ASSERT( !pNew, "debug notification - master replaced!" );
+/*N*/ #endif
+/*N*/ SwContact::SetMaster( pNew );
+/*N*/ }
+
+// OD 19.06.2003 #108784# - get drawing object ('master' or 'virtual') by frame.
+/*N*/ SdrObject* SwDrawContact::GetDrawObjectByAnchorFrm( const SwFrm& _rAnchorFrm )
+/*N*/ {
+/*N*/ SdrObject* pRetDrawObj = 0L;
+/*N*/
+/*N*/ if ( GetAnchor() && GetAnchor() == &_rAnchorFrm )
+/*N*/ {
+/*N*/ pRetDrawObj = GetMaster();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
+/*N*/ std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
+/*N*/ VirtObjAnchoredAtFrmPred( _rAnchorFrm ) );
+/*N*/
+/*N*/ if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
+/*N*/ {
+/*N*/ pRetDrawObj = (*aFoundVirtObjIter);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return pRetDrawObj;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDrawContact::Changed
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 29. May. 96
+|*
+|*************************************************************************/
+
+/*N*/ void lcl_Notify( SwDrawContact* pThis, const Rectangle* pOldBoundRect )
+/*N*/ {
+/*N*/ SwFrm *pAnch = pThis->GetAnchor();
+/*N*/ if( pAnch )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = pAnch->FindPageFrm();
+/*N*/ ASSERT( GetUserCall(pThis->GetMaster()) == pThis, "Wrong Master" );
+/*N*/ if( pOldBoundRect && pPage )
+/*N*/ {
+/*N*/ SwRect aOldRect( *pOldBoundRect );
+/*N*/ if( aOldRect.HasArea() )
+/*N*/ Notify_Background( pThis->GetMaster(),pPage, aOldRect,
+/*N*/ PREP_FLY_LEAVE,TRUE);
+/*N*/ }
+/*N*/ SwRect aRect( pThis->GetMaster()->GetBoundRect() );
+/*N*/ if( aRect.HasArea() )
+/*N*/ {
+/*N*/ SwPageFrm *pPg = pThis->FindPage( aRect );
+/*N*/ if( pPg )
+/*N*/ Notify_Background( pThis->GetMaster(), pPg, aRect,
+/*N*/ PREP_FLY_ARRIVE, TRUE );
+/*N*/ }
+/*N*/ ClrContourCache( pThis->GetMaster() );
+/*N*/
+/*N*/ // OD 03.07.2003 #108784# - notify background of all 'virtual' drawing objects
+/*N*/ pThis->NotifyBackgrdOfAllVirtObjs( pOldBoundRect );
+/*N*/ }
+/*N*/ }
+
+// OD 03.07.2003 #108784#
+/*N*/ void SwDrawContact::NotifyBackgrdOfAllVirtObjs( const Rectangle* pOldBoundRect )
+/*N*/ {
+/*N*/ for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjIter = maDrawVirtObjs.begin();
+/*N*/ aDrawVirtObjIter != maDrawVirtObjs.end();
+/*N*/ ++aDrawVirtObjIter )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjIter);
+/*N*/ if ( pDrawVirtObj->GetAnchorFrm() )
+/*N*/ {
+/*N*/ SwPageFrm* pPage = pDrawVirtObj->GetAnchorFrm()->FindPageFrm();
+/*N*/ if( pOldBoundRect && pPage )
+/*N*/ {
+/*N*/ SwRect aOldRect( *pOldBoundRect );
+/*N*/ aOldRect.Pos() += pDrawVirtObj->GetOffset();
+/*N*/ if( aOldRect.HasArea() )
+/*N*/ Notify_Background( pDrawVirtObj ,pPage,
+/*N*/ aOldRect, PREP_FLY_LEAVE,TRUE);
+/*N*/ }
+/*N*/ SwRect aRect( pDrawVirtObj->GetBoundRect() );
+/*N*/ if( aRect.HasArea() )
+/*N*/ {
+/*N*/ SwPageFrm *pPg = pDrawVirtObj->GetPageFrm();
+/*N*/ if ( !pPg )
+/*N*/ pPg = pDrawVirtObj->GetAnchorFrm()->FindPageFrm();
+/*N*/ if ( pPg )
+/*N*/ pPg = (SwPageFrm*)::binfilter::FindPage( aRect, pPg );
+/*N*/ if( pPg )
+/*N*/ Notify_Background( pDrawVirtObj, pPg, aRect,
+/*N*/ PREP_FLY_ARRIVE, TRUE );
+/*N*/ }
+/*N*/ ClrContourCache( pDrawVirtObj );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwDrawContact::Changed( const SdrObject& rObj,
+/*N*/ SdrUserCallType eType,
+/*N*/ const Rectangle& rOldBoundRect )
+/*N*/ {
+/*N*/ //Action aufsetzen, aber nicht wenn gerade irgendwo eine Action laeuft.
+/*N*/ ViewShell *pSh = 0, *pOrg;
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ if ( pDoc->GetRootFrm() && pDoc->GetRootFrm()->IsCallbackActionEnabled() )
+/*N*/ {
+/*N*/ pDoc->GetEditShell( &pOrg );
+/*N*/ pSh = pOrg;
+/*N*/ if ( pSh )
+/*N*/ do
+/*N*/ { if ( pSh->Imp()->IsAction() || pSh->Imp()->IsIdleAction() )
+/*N*/ pSh = 0;
+/*N*/ else
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh && pSh != pOrg );
+/*N*/
+/*N*/ if ( pSh )
+/*N*/ pDoc->GetRootFrm()->StartAllAction();
+/*N*/ }
+/*N*/
+/*N*/ SdrObjUserCall::Changed( rObj, eType, rOldBoundRect );
+/*N*/ _Changed( rObj, eType, &rOldBoundRect ); //Achtung, ggf. Suizid!
+/*N*/
+/*N*/ if ( pSh )
+/*N*/ pDoc->GetRootFrm()->EndAllAction();
+/*N*/ }
+
+/*N*/ void SwDrawContact::_Changed( const SdrObject& rObj,
+/*N*/ SdrUserCallType eType,
+/*N*/ const Rectangle* pOldBoundRect )
+/*N*/ {
+/*N*/ BOOL bInCntnt = FLY_IN_CNTNT == GetFmt()->GetAnchor().GetAnchorId();
+/*N*/ /// OD 05.08.2002 #100843# - do *not* notify, if document is destructing
+/*N*/ BOOL bNotify = !bInCntnt &&
+/*N*/ !(GetFmt()->GetDoc()->IsInDtor()) &&
+/*N*/ ( SURROUND_THROUGHT != GetFmt()->GetSurround().GetSurround() );
+/*N*/ switch( eType )
+/*N*/ {
+/*N*/ case SDRUSERCALL_DELETE:
+/*N*/ {
+/*N*/ if( bNotify )
+/*N*/ lcl_Notify( this, pOldBoundRect );
+/*N*/ DisconnectFromLayout( false );
+/*N*/ SetMaster( NULL );
+/*N*/ delete this;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRUSERCALL_INSERTED:
+/*N*/ {
+/*N*/ ConnectToLayout();
+/*N*/ if( bNotify )
+/*N*/ lcl_Notify( this, pOldBoundRect );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRUSERCALL_REMOVED:
+/*N*/ {
+/*N*/ if( bNotify )
+/*N*/ lcl_Notify( this, pOldBoundRect );
+/*N*/ DisconnectFromLayout( false );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SDRUSERCALL_MOVEONLY:
+/*N*/ case SDRUSERCALL_RESIZE:
+/*N*/ case SDRUSERCALL_CHILD_MOVEONLY :
+/*N*/ case SDRUSERCALL_CHILD_RESIZE :
+/*N*/ case SDRUSERCALL_CHILD_CHGATTR :
+/*N*/ case SDRUSERCALL_CHILD_DELETE :
+/*N*/ case SDRUSERCALL_CHILD_COPY :
+/*N*/ case SDRUSERCALL_CHILD_INSERTED :
+/*N*/ case SDRUSERCALL_CHILD_REMOVED :
+/*N*/ if( bInCntnt )
+/*N*/ {
+/*N*/ SwFrm *pAnch = GetAnchor();
+/*N*/ if( !pAnch )
+/*N*/ {
+/*N*/ ConnectToLayout();
+/*N*/ pAnch = GetAnchor();
+/*N*/ }
+/*N*/ if( pAnch && !((SwTxtFrm*)pAnch)->IsLocked() &&
+/*N*/ &rObj == GetMaster() )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = GetFmt();
+/*N*/ const SwFmtVertOrient &rVert = pFmt->GetVertOrient();
+/*N*/ SwTwips nRel;
+/*N*/ if( pAnch->IsVertical() )
+/*N*/ {
+/*N*/ nRel = rObj.GetRelativePos().X();
+/*N*/ if( !pAnch->IsReverse() )
+/*N*/ nRel = - nRel - rObj.GetSnapRect().GetWidth();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nRel = rObj.GetRelativePos().Y();
+/*N*/ }
+/*N*/ if( rVert.GetPos() != nRel )
+/*N*/ {
+/*N*/ SwFmtVertOrient aVert( rVert );
+/*N*/ aVert.SetVertOrient( VERT_NONE );
+/*N*/ aVert.SetPos( nRel );
+/*N*/ pFmt->SetAttr( aVert );
+/*N*/ }
+/*N*/ ((SwTxtFrm*)pAnch)->Prepare();
+/*N*/ InvalidateAnchorOfVirtObjs();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( bNotify )
+/*N*/ lcl_Notify( this, pOldBoundRect );
+/*N*/ break;
+/*N*/ case SDRUSERCALL_CHGATTR:
+/*N*/ if( bNotify )
+/*N*/ lcl_Notify( this, pOldBoundRect );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDrawContact::Modify()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 03. Dec. 95
+|*
+|*************************************************************************/
+
+/*N*/ void SwDrawContact::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ //Es kommen immer Sets herein.
+/*N*/ //MA 03. Dec. 95: Falsch es kommen nicht immer Sets herein
+/*N*/ //(siehe SwRootFrm::AssertPageFlys()
+/*N*/ USHORT nWhich = pNew ? pNew->Which() : 0;
+/*N*/ SwFmtAnchor *pAnch = 0;
+/*N*/ if( RES_ATTRSET_CHG == nWhich )
+/*N*/ {
+/*N*/ if( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+/*N*/ RES_ANCHOR, FALSE, (const SfxPoolItem**)&pAnch ))
+/*N*/ ; // Beim GetItemState wird der AnkerPointer gesetzt !
+/*N*/ else if( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->
+/*N*/ GetItemState( RES_VERT_ORIENT, FALSE ))
+/*N*/ {
+/*N*/ SwFrm *pFrm = GetAnchor();
+/*N*/ if( !pFrm )
+/*N*/ {
+/*N*/ ConnectToLayout();
+/*N*/ pFrm = GetAnchor();
+/*N*/ }
+/*N*/ if( pFrm && pFrm->IsTxtFrm() )
+/*N*/ ((SwTxtFrm*)pFrm)->Prepare();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( RES_ANCHOR == nWhich )
+/*?*/ pAnch = (SwFmtAnchor*)pNew;
+/*N*/
+/*N*/ if ( pAnch )
+/*N*/ {
+/*N*/ // JP 10.04.95: nicht auf ein Reset Anchor reagieren !!!!!
+/*N*/ if( SFX_ITEM_SET == ((SwFrmFmt*)pRegisteredIn)->GetAttrSet().
+/*N*/ GetItemState( RES_ANCHOR, FALSE ) )
+/*N*/ {
+/*N*/ if( !FLY_IN_CNTNT == pAnch->GetAnchorId() )
+/*N*/ ((SwFrmFmt*)pRegisteredIn)->ResetAttr( RES_VERT_ORIENT );
+/*N*/
+/*N*/ SwFrm *pOldAnch = GetAnchor();
+/*N*/ SwPageFrm *pPg = NULL;
+/*N*/ SwRect aOldRect;
+/*N*/ if( pOldAnch )
+/*N*/ {
+/*N*/ pPg = pOldAnch->FindPageFrm();
+/*N*/ aOldRect = SwRect( GetMaster()->GetBoundRect() );
+/*N*/ }
+/*N*/ ConnectToLayout( pAnch );
+/*N*/ if( pPg && aOldRect.HasArea() )
+/*N*/ Notify_Background(GetMaster(),pPg,aOldRect,PREP_FLY_LEAVE,TRUE);
+/*N*/ lcl_Notify( this, NULL );
+/*N*/
+/*N*/ // #86973#
+/*N*/ if(GetMaster())
+/*N*/ {
+/*N*/ GetMaster()->SetChanged();
+/*N*/ GetMaster()->SendRepaintBroadcast();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ DisconnectFromLayout();
+/*N*/ }
+/*N*/ else if( RES_SURROUND == nWhich || RES_UL_SPACE == nWhich ||
+/*N*/ RES_LR_SPACE == nWhich ||
+/*N*/ ( RES_ATTRSET_CHG == nWhich &&
+/*N*/ ( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+/*N*/ RES_SURROUND, FALSE ) ||
+/*N*/ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+/*N*/ RES_LR_SPACE, FALSE ) ||
+/*N*/ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+/*N*/ RES_UL_SPACE, FALSE ) ) ) )
+/*N*/ lcl_Notify( this, NULL );
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwDrawContact::DisconnectFromLayout()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 25. Mar. 99
+|*
+|*************************************************************************/
+
+void SwDrawContact::DisconnectFromLayout( bool _bMoveMasterToInvisibleLayer )
+{
+ // OD 16.05.2003 #108784# - remove 'virtual' drawing objects from writer
+ // layout and from drawing page
+ for ( std::list<SwDrawVirtObj*>::iterator aDisconnectIter = maDrawVirtObjs.begin();
+ aDisconnectIter != maDrawVirtObjs.end();
+ ++aDisconnectIter )
+ {
+ SwDrawVirtObj* pDrawVirtObj = (*aDisconnectIter);
+ pDrawVirtObj->RemoveFromWriterLayout();
+ pDrawVirtObj->RemoveFromDrawingPage();
+ }
+
+ if ( pAnchor )
+ {
+ pAnchor->RemoveDrawObj( this );
+ }
+
+ if ( _bMoveMasterToInvisibleLayer && GetMaster() && GetMaster()->IsInserted() )
+ {
+ SdrViewIter aIter( GetMaster() );
+ for( SdrView* pView = aIter.FirstView(); pView;
+ pView = aIter.NextView() )
+ {
+ pView->MarkObj( GetMaster(), pView->GetPageViewPvNum(0), TRUE );
+ }
+
+ // OD 25.06.2003 #108784# - Instead of removing 'master' object from
+ // drawing page, move the 'master' drawing object into the corresponding
+ // invisible layer.
+ {
+ //((SwFrmFmt*)pRegisteredIn)->GetDoc()->GetDrawModel()->GetPage(0)->
+ // RemoveObject( GetMaster()->GetOrdNum() );
+ SwDoc* pWriterDoc = ((SwFrmFmt*)pRegisteredIn)->GetDoc();
+ if ( pWriterDoc->IsVisibleLayerId( GetMaster()->GetLayer() ) )
+ {
+ SdrLayerID nInvisibleLayerId =
+ pWriterDoc->GetInvisibleLayerIdByVisibleOne( GetMaster()->GetLayer() );
+ GetMaster()->SetLayer( nInvisibleLayerId );
+ }
+ }
+ }
+}
+
+// OD 26.06.2003 #108784# - method to remove 'master' drawing object
+// from drawing page.
+void SwDrawContact::RemoveMasterFromDrawPage()
+{
+ if ( GetMaster() )
+ {
+ GetMaster()->SetUserCall( 0 );
+ if ( GetMaster()->IsInserted() )
+ {
+ ((SwFrmFmt*)pRegisteredIn)->GetDoc()->GetDrawModel()->GetPage(0)->
+ RemoveObject( GetMaster()->GetOrdNum() );
+ }
+ }
+}
+
+// OD 19.06.2003 #108784# - disconnect for a dedicated drawing object -
+// could be 'master' or 'virtual'.
+// a 'master' drawing object will disconnect a 'virtual' drawing object
+// in order to take its place.
+/*N*/ void SwDrawContact::DisconnectObjFromLayout( SdrObject* _pDrawObj )
+/*N*/ {
+/*N*/ if ( !GetAnchor()->FindFooterOrHeader() )
+/*N*/ {
+/*N*/ // disconnect completely from layout
+/*N*/ DisconnectFromLayout();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( _pDrawObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(_pDrawObj);
+/*N*/ pDrawVirtObj->RemoveFromWriterLayout();
+/*N*/ pDrawVirtObj->RemoveFromDrawingPage();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ std::list<SwDrawVirtObj*>::const_iterator aFoundVirtObjIter =
+/*N*/ std::find_if( maDrawVirtObjs.begin(), maDrawVirtObjs.end(),
+/*N*/ UsedOrUnusedVirtObjPred( true ) );
+/*N*/ if ( aFoundVirtObjIter != maDrawVirtObjs.end() )
+/*N*/ {
+/*N*/ // replace found 'virtual' drawing object by 'master' drawing
+/*N*/ // object and disconnect the 'virtual' one
+/*N*/ SwDrawVirtObj* pDrawVirtObj = (*aFoundVirtObjIter);
+/*N*/ SwFrm* pNewAnchorFrmOfMaster = pDrawVirtObj->GetAnchorFrm();
+/*N*/ Point aNewAnchorPos = pDrawVirtObj->GetAnchorPos();
+/*N*/ // disconnect 'virtual' drawing object
+/*N*/ pDrawVirtObj->RemoveFromWriterLayout();
+/*N*/ pDrawVirtObj->RemoveFromDrawingPage();
+/*N*/ // disconnect 'master' drawing object from current frame
+/*N*/ pAnchor->RemoveDrawObj( this );
+/*N*/ // re-connect 'master' drawing object to frame of found 'virtual'
+/*N*/ // drawing object.
+/*N*/ pNewAnchorFrmOfMaster->AppendDrawObj( this );
+/*N*/ // set anchor position at 'master' virtual drawing object to the
+/*N*/ // one of the found 'virtual' drawing object.
+/*N*/ GetMaster()->SetAnchorPos( aNewAnchorPos );
+/*N*/ // restore positions of remaining 'virtual' drawing objects
+/*N*/ CorrectRelativePosOfVirtObjs();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // no connected 'virtual' drawing object found. Thus, disconnect
+/*N*/ // completely from layout.
+/*N*/ DisconnectFromLayout();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDrawContact::ConnectToLayout()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 25. Mar. 99
+|*
+|*************************************************************************/
+
+void SwDrawContact::ConnectToLayout( const SwFmtAnchor* pAnch )
+{
+ SwFrmFmt* pDrawFrmFmt = (SwFrmFmt*)pRegisteredIn;
+
+ SwRootFrm* pRoot = pDrawFrmFmt->GetDoc()->GetRootFrm();
+ if ( !pRoot )
+ {
+ return;
+ }
+
+ // OD 16.05.2003 #108784# - remove 'virtual' drawing objects from writer
+ // layout and from drawing page, and remove 'master' drawing object from
+ // writer layout - 'master' object will remain in drawing page.
+ DisconnectFromLayout( false );
+
+ if ( !pAnch )
+ {
+ pAnch = &(pDrawFrmFmt->GetAnchor());
+ }
+
+ bool bSetAnchorPos = true;
+
+ switch ( pAnch->GetAnchorId() )
+ {
+ case FLY_PAGE:
+ {
+ USHORT nPgNum = pAnch->GetPageNum();
+ SwPageFrm *pPage = static_cast<SwPageFrm*>(pRoot->Lower());
+
+ for ( USHORT i = 1; i < nPgNum && pPage; ++i )
+ {
+ pPage = static_cast<SwPageFrm*>(pPage->GetNext());
+ }
+
+ if ( pPage )
+ {
+ bSetAnchorPos = false;
+ pPage->SwFrm::AppendDrawObj( this );
+ }
+ else
+ //Sieht doof aus, ist aber erlaubt (vlg. SwFEShell::SetPageObjsNewPage)
+ pRoot->SetAssertFlyPages();
+ }
+ break;
+
+ case FLY_AUTO_CNTNT:
+ case FLY_AT_CNTNT:
+ case FLY_AT_FLY:
+ case FLY_IN_CNTNT:
+ {
+ if ( pAnch->GetAnchorId() == FLY_IN_CNTNT )
+ {
+ ClrContourCache( GetMaster() );
+ }
+ // OD 16.05.2003 #108784# - support drawing objects in header/footer,
+ // but not control objects:
+ // anchor at first found frame the 'master' object and
+ // at the following frames 'virtual' drawing objects.
+ // Note: method is similar to <SwFlyFrmFmt::MakeFrms(..)>
+ SwModify *pModify = 0;
+ if( pAnch->GetCntntAnchor() )
+ {
+ if ( pAnch->GetAnchorId() == FLY_AT_FLY )
+ {
+ SwNodeIndex aIdx( pAnch->GetCntntAnchor()->nNode );
+ SwCntntNode* pCNd = pDrawFrmFmt->GetDoc()->GetNodes().GoNext( &aIdx );
+ SwClientIter aIter( *pCNd );
+ if ( aIter.First( TYPE(SwFrm) ) )
+ pModify = pCNd;
+ else
+ {
+ const SwNodeIndex& rIdx = pAnch->GetCntntAnchor()->nNode;
+ SwSpzFrmFmts& rFmts = *(pDrawFrmFmt->GetDoc()->GetSpzFrmFmts());
+ for( sal_uInt16 i = 0; i < rFmts.Count(); ++i )
+ {
+ SwFrmFmt* pFlyFmt = rFmts[i];
+ if( pFlyFmt->GetCntnt().GetCntntIdx() &&
+ rIdx == *(pFlyFmt->GetCntnt().GetCntntIdx()) )
+ {
+ pModify = pFlyFmt;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ pModify = pAnch->GetCntntAnchor()->nNode.GetNode().GetCntntNode();
+ }
+ }
+ SwClientIter aIter( *pModify );
+ SwFrm* pAnchorFrmOfMaster = 0;
+ for( SwFrm *pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) );
+ pFrm;
+ pFrm = (SwFrm*)aIter.Next() )
+ {
+ // append drawing object, if
+ // (1) proposed anchor frame isn't a follow and
+ // (2) drawing object isn't a control object to be anchored
+ // in header/footer.
+ const bool bAdd = ( !pFrm->IsCntntFrm() ||
+ !((SwCntntFrm*)pFrm)->IsFollow() ) &&
+ ( !CheckControlLayer( GetMaster() ) ||
+ !pFrm->FindFooterOrHeader() );
+
+ if( bAdd )
+ {
+ if ( FLY_AT_FLY == pAnch->GetAnchorId() && !pFrm->IsFlyFrm() )
+ {
+ pFrm = pFrm->FindFlyFrm();
+ }
+
+ if ( !pAnchorFrmOfMaster )
+ {
+ // OD 02.07.2003 #108784# - check, if 'master' drawing
+ // objects is inserted into drawing page. If not,
+ // assert and insert 'master' drawing object.
+ if ( !GetMaster()->IsInserted() )
+ {
+ // OD 25.06.2003 #108784# - debug assert
+ ASSERT( false, "<SwDrawContact::ConnectToLayout(..)> - master drawing object not inserted!?" );
+
+ pDrawFrmFmt->GetDoc()->GetDrawModel()->GetPage(0)->
+ InsertObject( GetMaster(), GetMaster()->GetOrdNumDirect() );
+ }
+ // append 'master' drawing object
+ pAnchorFrmOfMaster = pFrm;
+ pFrm->AppendDrawObj( this );
+ }
+ else
+ {
+ // append 'virtual' drawing object
+ SwDrawVirtObj* pDrawVirtObj = AddVirtObj();
+ if ( pAnch->GetAnchorId() == FLY_IN_CNTNT )
+ {
+ ClrContourCache( pDrawVirtObj );
+ }
+ pFrm->AppendVirtDrawObj( this, pDrawVirtObj );
+ pDrawVirtObj->SendRepaintBroadcast();
+ }
+
+ if ( pAnch->GetAnchorId() == FLY_IN_CNTNT )
+ {
+ pFrm->InvalidatePrt();
+ }
+
+ bSetAnchorPos = false;
+ }
+ }
+ }
+ break;
+/*
+ case FLY_AT_FLY:
+ {
+ if( pAnch->GetCntntAnchor() ) // LAYER_IMPL
+ {
+ SwFrm *pAnchor = 0;
+ //Erst einmal ueber den Inhalt suchen, weil konstant schnell. Kann
+ //Bei verketteten Rahmen aber auch schief gehen, weil dann evtl.
+ //niemals ein Frame zu dem Inhalt existiert. Dann muss leider noch
+ //die Suche vom StartNode zum FrameFormat sein.
+ SwNodeIndex aIdx( pAnch->GetCntntAnchor()->nNode );
+ SwCntntNode *pCNd = pFmt->GetDoc()->GetNodes().GoNext( &aIdx );
+ if ( pCNd && 0 != (pAnchor = pCNd->GetFrm( 0, 0, FALSE ) ) )
+ pAnchor = pAnchor->FindFlyFrm();
+ else
+ {
+ const SwNodeIndex &rIdx = pAnch->GetCntntAnchor()->nNode;
+ SwSpzFrmFmts& rFmts = *pFmt->GetDoc()->GetSpzFrmFmts();
+ for( USHORT i = 0; i < rFmts.Count(); ++i )
+ {
+ SwFrmFmt *pFmt = rFmts[i];
+ SwFlyFrmFmt* pFlyFmt;
+ if( 0 != (pFlyFmt = PTR_CAST( SwFlyFrmFmt, pFmt )) &&
+ pFlyFmt->GetCntnt().GetCntntIdx() && //#57390#, Reader
+ rIdx == *pFlyFmt->GetCntnt().GetCntntIdx() )
+ {
+ pAnchor = pFlyFmt->GetFrm( 0, FALSE );
+ break;
+ }
+ }
+ }
+ if ( pAnchor ) //Kann sein, dass der Anker noch nicht existiert
+ {
+ pAnchor->FindFlyFrm()->AppendDrawObj( this );
+ bSetAnchorPos = false;
+ }
+ }
+ }
+ break;
+*/
+/*
+ case FLY_IN_CNTNT:
+ {
+ ClrContourCache( GetMaster() );
+ SwCntntNode *pNode = GetFmt()->GetDoc()->
+ GetNodes()[pAnch->GetCntntAnchor()->nNode]->GetCntntNode();
+ SwCntntFrm *pCntnt = pNode->GetFrm( 0, 0, FALSE );
+ if ( pCntnt )
+ {
+ //Kann sein, dass der Anker noch nicht existiert
+ pCntnt->AppendDrawObj( this );
+ pCntnt->InvalidatePrt();
+ }
+ bSetAnchorPos = false;
+ }
+ break;
+*/
+#ifdef DBG_UTIL
+ default: ASSERT( FALSE, "Unknown Anchor." );
+#endif
+ }
+ if ( GetAnchor() )
+ {
+ if( bSetAnchorPos )
+ {
+ GetMaster()->SetAnchorPos( GetAnchor()->GetFrmAnchorPos( ::binfilter::HasWrap( GetMaster() ) ) );
+ }
+ if ( !pDrawFrmFmt->GetDoc()->IsVisibleLayerId( GetMaster()->GetLayer() ) )
+ {
+ SdrLayerID nVisibleLayerId =
+ pDrawFrmFmt->GetDoc()->GetVisibleLayerIdByInvisibleOne( GetMaster()->GetLayer() );
+ GetMaster()->SetLayer( nVisibleLayerId );
+ }
+ }
+}
+
+// OD 20.06.2003 #108784# - method in order to correct relative positioning of
+// 'virtual' drawing objects, e.g. caused by a <NbcSetAnchorPos(..)> at the
+// 'master' drawing object.
+void SwDrawContact::CorrectRelativePosOfVirtObjs()
+{
+ for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjIter = maDrawVirtObjs.begin();
+ aDrawVirtObjIter != maDrawVirtObjs.end();
+ ++aDrawVirtObjIter )
+ {
+ SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjIter);
+ pDrawVirtObj->AdjustRelativePosToReference();
+ }
+}
+
+// OD 20.06.2003 #108784# - correct in-direct movements of the 'virtual'
+// drawing objects, e.g. caused by a <NbcMove(..)> at the 'master' drawing object
+void SwDrawContact::MoveOffsetOfVirtObjs( const Size& _rMoveSize )
+{
+ for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjIter = maDrawVirtObjs.begin();
+ aDrawVirtObjIter != maDrawVirtObjs.end();
+ ++aDrawVirtObjIter )
+ {
+ SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjIter);
+ pDrawVirtObj->SetOffset( pDrawVirtObj->GetOffset() - Point(_rMoveSize.Width(), _rMoveSize.Height()) );
+ }
+}
+
+// OD 26.06.2003 #108784# - invalidate anchor frames of 'virtual' drawing objects.
+// Needed for, e.g., 'as character' anchored drawing objects and a change of the
+// 'master' drawing object.
+void SwDrawContact::InvalidateAnchorOfVirtObjs()
+{
+ for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjIter = maDrawVirtObjs.begin();
+ aDrawVirtObjIter != maDrawVirtObjs.end();
+ ++aDrawVirtObjIter )
+ {
+ SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjIter);
+ if ( pDrawVirtObj->GetAnchorFrm() )
+ {
+ pDrawVirtObj->GetAnchorFrm()->Prepare();
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::FindPage(), ChkPage()
+|*
+|* Ersterstellung MA 21. Mar. 95
+|* Letzte Aenderung MA 19. Jul. 96
+|*
+|*************************************************************************/
+
+SwPageFrm* SwDrawContact::FindPage( const SwRect &rRect )
+{
+ SwPageFrm *pPg = pPage;
+ if ( !pPg && pAnchor )
+ pPg = pAnchor->FindPageFrm();
+ if ( pPg )
+ pPg = (SwPageFrm*)::binfilter::FindPage( rRect, pPg );
+ return pPg;
+}
+
+void SwDrawContact::ChkPage()
+{
+ SwPageFrm* pPg = pAnchor && pAnchor->IsPageFrm() ?
+ pPage : FindPage( GetMaster()->GetBoundRect() );
+ if ( pPage != pPg )
+ {
+ // OD 27.06.2003 #108784# - if drawing object is anchor in header/footer
+ // a change of the page is a dramatic change. Thus, completely re-connect
+ // to the layout
+ if ( pAnchor && pAnchor->FindFooterOrHeader() )
+ {
+ ConnectToLayout();
+ }
+ else
+ {
+ if ( pPage )
+ pPage->SwPageFrm::RemoveDrawObj( this );
+ pPg->SwPageFrm::AppendDrawObj( this );
+ ChgPage( pPg );
+ }
+ }
+}
+
+/*************************************************************************
+|*
+|* SwDrawContact::ChangeMasterObject()
+|*
+|* Ersterstellung MA 07. Aug. 95
+|* Letzte Aenderung MA 20. Apr. 99
+|*
+|*************************************************************************/
+
+// OD 10.07.2003 #110742# - Important note:
+// method is called by method <SwDPage::ReplaceObject(..)>, which called its
+// corresponding superclass method <FmFormPage::ReplaceObject(..)>.
+// Note: 'master' drawing object *has* to be connected to layout (GetAnchor()
+// returns a frame), if method is called.
+
+// =============================================================================
+/** implementation of class <SwDrawVirtObj>
+
+ OD 14.05.2003 #108784#
+
+ @author OD
+*/
+
+TYPEINIT1(SwDrawVirtObj,SdrVirtObj);
+
+// #108784#
+// implemetation of SwDrawVirtObj
+SwDrawVirtObj::SwDrawVirtObj( SdrObject& _rNewObj,
+ SwDrawContact& _rDrawContact )
+ : SdrVirtObj( _rNewObj ),
+ mpAnchorFrm( 0 ),
+ mpPageFrm( 0 ),
+ mrDrawContact( _rDrawContact )
+{}
+
+SwDrawVirtObj::~SwDrawVirtObj()
+{}
+
+void SwDrawVirtObj::SetOffset(const Point& rNewOffset)
+{
+ maOffset = rNewOffset;
+ SetRectsDirty();
+}
+
+const Point SwDrawVirtObj::GetOffset() const
+{
+ return maOffset;
+}
+
+void SwDrawVirtObj::operator=( const SdrObject& rObj )
+{
+DBG_BF_ASSERT(0, "STRIP");//STRIP001
+}
+
+SdrObject* SwDrawVirtObj::Clone() const
+{
+ SwDrawVirtObj* pObj = new SwDrawVirtObj( rRefObj, mrDrawContact );
+
+ if ( pObj )
+ {
+ pObj->operator=(static_cast<const SdrObject&>(*this));
+ //*pObj = *this;
+
+ // members <mpAnchorFrm> and <mpPageFrm> not cloned.
+ }
+
+ return pObj;
+}
+
+// --------------------------------------------------------------------
+// connection to writer layout: <SetAnchorFrm(..)>, <GetAnchorFrm()>,
+// <SetPageFrm(..)>, <GetPageFrm()> and <RemoveFromWriterLayout()>
+// --------------------------------------------------------------------
+void SwDrawVirtObj::SetAnchorFrm( SwFrm* _pNewAnchorFrm )
+{
+ mpAnchorFrm = _pNewAnchorFrm;
+}
+
+SwFrm* SwDrawVirtObj::GetAnchorFrm() const
+{
+ return mpAnchorFrm;
+}
+
+void SwDrawVirtObj::SetPageFrm( SwPageFrm* _pNewPageFrm )
+{
+ mpPageFrm = _pNewPageFrm;
+}
+
+SwPageFrm* SwDrawVirtObj::GetPageFrm() const
+{
+ return mpPageFrm;
+}
+
+void SwDrawVirtObj::RemoveFromWriterLayout()
+{
+ // remove contact object from frame for 'virtual' drawing object
+ if ( GetAnchorFrm() )
+ {
+ GetAnchorFrm()->RemoveVirtDrawObj( &mrDrawContact, this );
+ }
+}
+
+// --------------------------------------------------------------------
+// connection to writer layout: <AddToDrawingPage()>, <RemoveFromDrawingPage()>
+// --------------------------------------------------------------------
+void SwDrawVirtObj::AddToDrawingPage()
+{
+ // determine 'master'
+ SdrObject* pOrgMasterSdrObj = mrDrawContact.GetMaster();
+
+ // insert 'virtual' drawing object into page, set layer and user call.
+ SdrPage *pPg;
+ if ( 0 != ( pPg = pOrgMasterSdrObj->GetPage() ) )
+ {
+ pPg->InsertObject( this );
+ }
+ SetUserCall( &mrDrawContact );
+}
+
+void SwDrawVirtObj::RemoveFromDrawingPage()
+{
+ SetUserCall( 0 );
+ if ( GetPage() )
+ {
+ GetPage()->RemoveObject( GetOrdNum() );
+ }
+}
+
+// is 'virtual' drawing object connected to writer layout and to drawing layer.
+bool SwDrawVirtObj::IsConnected() const
+{
+ bool bRetVal = GetAnchorFrm() &&
+ ( GetPage() && GetUserCall() );
+
+ return bRetVal;
+}
+
+// OD 19.06.2003 #108784# - adjust the relative postion of the 'virtual'
+// drawing object to the reference object
+void SwDrawVirtObj::AdjustRelativePosToReference()
+{
+ Point aVirtRelPos = GetRelativePos();
+ Point aOrigialRelativePos = GetReferencedObj().GetRelativePos();
+ Point aDiff = aVirtRelPos - aOrigialRelativePos;
+ if( aDiff.X() || aDiff.Y() )
+ {
+ SetOffset( GetOffset() - aDiff );
+ }
+}
+
+// #108784#
+// All AnchorPos influencing methods which shall not change the
+// original object positions.
+
+void SwDrawVirtObj::NbcSetRelativePos(const Point& rPnt)
+{
+ ReferencedObj().NbcSetRelativePos( rPnt );
+}
+
+void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt)
+{
+ Point aDelta(rPnt - aAnchor);
+
+ aAnchor = rPnt;
+ maOffset += aDelta;
+ SetRectsDirty();
+}
+
+// #108784#
+// All overloaded methods which need to use the offset to move
+// the object position virtually.
+
+const Rectangle& SwDrawVirtObj::GetBoundRect() const
+{
+ ((SwDrawVirtObj*)this)->aOutRect = rRefObj.GetBoundRect(); // Hier noch optimieren
+ ((SwDrawVirtObj*)this)->aOutRect += maOffset;
+
+ return aOutRect;
+}
+
+void SwDrawVirtObj::RecalcBoundRect()
+{
+ aOutRect = rRefObj.GetBoundRect();
+ aOutRect += maOffset;
+}
+
+FASTBOOL SwDrawVirtObj::Paint(ExtOutputDevice& rOut, const SdrPaintInfoRec& rInfoRec) const
+{
+ FASTBOOL bRet;
+
+ Point aOfs(rOut.GetOffset());
+ rOut.SetOffset(aOfs + maOffset);
+ if ( GetSubList() && GetSubList()->GetObjCount() )
+ {
+ SdrPaintInfoRec aCopyInfoRec = rInfoRec;
+ aCopyInfoRec.aCheckRect.Move( -maOffset.X(), -maOffset.Y() );
+ aCopyInfoRec.aDirtyRect.Move( -maOffset.X(), -maOffset.Y() );
+ bRet = rRefObj.Paint(rOut, aCopyInfoRec);
+ }
+ else
+ {
+ bRet = rRefObj.Paint(rOut, rInfoRec);
+ }
+ rOut.SetOffset(aOfs);
+
+ return bRet;
+}
+
+SdrObject* SwDrawVirtObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const
+{
+ Point aPnt(rPnt - maOffset);
+ FASTBOOL bRet = rRefObj.CheckHit(aPnt, nTol, pVisiLayer) != NULL;
+
+ return bRet ? (SdrObject*)this : NULL;
+}
+
+void SwDrawVirtObj::TakeXorPoly(XPolyPolygon& rPoly, FASTBOOL bDetail) const
+{
+ rRefObj.TakeXorPoly(rPoly, bDetail);
+ rPoly.Move(maOffset.X(), maOffset.Y());
+}
+
+void SwDrawVirtObj::TakeContour(XPolyPolygon& rPoly) const
+{
+ rRefObj.TakeContour(rPoly);
+ rPoly.Move(maOffset.X(), maOffset.Y());
+}
+
+SdrHdl* SwDrawVirtObj::GetHdl(USHORT nHdlNum) const
+{DBG_BF_ASSERT(0, "STRIP");return NULL;//STRIP001
+}
+
+SdrHdl* SwDrawVirtObj::GetPlusHdl(const SdrHdl& rHdl, USHORT nPlNum) const
+{DBG_BF_ASSERT(0, "STRIP");return NULL;//STRIP001
+}
+
+void SwDrawVirtObj::NbcMove(const Size& rSiz)
+{
+ rRefObj.NbcMove( rSiz );
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ rRefObj.NbcResize(rRef - maOffset, xFact, yFact);
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ rRefObj.NbcRotate(rRef - maOffset, nWink, sn, cs);
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
+{
+ rRefObj.NbcMirror(rRef1 - maOffset, rRef2 - maOffset);
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::NbcShear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ rRefObj.NbcShear(rRef - maOffset, nWink, tn, bVShear);
+ SetRectsDirty();
+}
+
+void SwDrawVirtObj::Move(const Size& rSiz)
+{
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetBoundRect();
+ rRefObj.Move( rSiz );
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+void SwDrawVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
+{
+ if(xFact.GetNumerator() != xFact.GetDenominator() || yFact.GetNumerator() != yFact.GetDenominator())
+ {
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetBoundRect();
+ rRefObj.Resize(rRef - maOffset, xFact, yFact);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+ }
+}
+
+void SwDrawVirtObj::Rotate(const Point& rRef, long nWink, double sn, double cs)
+{
+ if(nWink)
+ {
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetBoundRect();
+ rRefObj.Rotate(rRef - maOffset, nWink, sn, cs);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+ }
+}
+
+void SwDrawVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
+{DBG_BF_ASSERT(0, "STRIP");//STRIP001
+}
+
+void SwDrawVirtObj::Shear(const Point& rRef, long nWink, double tn, FASTBOOL bVShear)
+{
+ if(nWink)
+ {
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetBoundRect();
+ rRefObj.Shear(rRef - maOffset, nWink, tn, bVShear);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+ }
+}
+
+void SwDrawVirtObj::RecalcSnapRect()
+{
+ aSnapRect = rRefObj.GetSnapRect();
+ aSnapRect += maOffset;
+}
+
+const Rectangle& SwDrawVirtObj::GetSnapRect() const
+{
+ ((SwDrawVirtObj*)this)->aSnapRect = rRefObj.GetSnapRect();
+ ((SwDrawVirtObj*)this)->aSnapRect += maOffset;
+
+ return aSnapRect;
+}
+
+void SwDrawVirtObj::SetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetBoundRect();
+ Rectangle aR(rRect);
+ aR -= maOffset;
+ rRefObj.SetSnapRect(aR);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+void SwDrawVirtObj::NbcSetSnapRect(const Rectangle& rRect)
+{
+ Rectangle aR(rRect);
+ aR -= maOffset;
+ SetRectsDirty();
+ rRefObj.NbcSetSnapRect(aR);
+}
+
+const Rectangle& SwDrawVirtObj::GetLogicRect() const
+{
+ ((SwDrawVirtObj*)this)->aSnapRect = rRefObj.GetLogicRect();
+ ((SwDrawVirtObj*)this)->aSnapRect += maOffset;
+
+ return aSnapRect;
+}
+
+void SwDrawVirtObj::SetLogicRect(const Rectangle& rRect)
+{
+ Rectangle aBoundRect0; if(pUserCall) aBoundRect0 = GetBoundRect();
+ Rectangle aR(rRect);
+ aR -= maOffset;
+ rRefObj.SetLogicRect(aR);
+ SetRectsDirty();
+ SendUserCall(SDRUSERCALL_RESIZE, aBoundRect0);
+}
+
+void SwDrawVirtObj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ Rectangle aR(rRect);
+ aR -= maOffset;
+ rRefObj.NbcSetLogicRect(aR);
+ SetRectsDirty();
+}
+
+Point SwDrawVirtObj::GetSnapPoint(USHORT i) const
+{DBG_BF_ASSERT(0, "STRIP");Point ap; return ap;//STRIP001
+}
+
+const Point& SwDrawVirtObj::GetPoint(USHORT i) const
+{
+ ((SwDrawVirtObj*)this)->aHack = rRefObj.GetPoint(i);
+ ((SwDrawVirtObj*)this)->aHack += maOffset;
+
+ return aHack;
+}
+
+void SwDrawVirtObj::NbcSetPoint(const Point& rPnt, USHORT i)
+{
+ Point aP(rPnt);
+ aP -= maOffset;
+ rRefObj.SetPoint(aP, i);
+ SetRectsDirty();
+}
+
+// #108784#
+FASTBOOL SwDrawVirtObj::HasTextEdit() const
+{
+ return rRefObj.HasTextEdit();
+}
+
+// OD 18.06.2003 #108784# - overloaded 'layer' methods for 'virtual' drawing
+// object to assure, that layer of 'virtual' object is the layer of the referenced
+// object.
+// NOTE: member <
+SdrLayerID SwDrawVirtObj::GetLayer() const
+{
+ return GetReferencedObj().GetLayer();
+}
+
+void SwDrawVirtObj::NbcSetLayer(SdrLayerID nLayer)
+{
+ ReferencedObj().NbcSetLayer( nLayer );
+ SdrVirtObj::NbcSetLayer( ReferencedObj().GetLayer() );
+}
+
+void SwDrawVirtObj::SetLayer(SdrLayerID nLayer)
+{
+ ReferencedObj().SetLayer( nLayer );
+ SdrVirtObj::NbcSetLayer( ReferencedObj().GetLayer() );
+}
+// eof
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/draw/sw_dflyobj.cxx b/binfilter/bf_sw/source/core/draw/sw_dflyobj.cxx
new file mode 100644
index 000000000000..46a0bd072c95
--- /dev/null
+++ b/binfilter/bf_sw/source/core/draw/sw_dflyobj.cxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+
+#include <bf_svx/protitem.hxx>
+#include <bf_svx/svdpage.hxx>
+
+
+
+#include <horiornt.hxx>
+
+#include "frmatr.hxx"
+#include "dflyobj.hxx"
+#include "frmfmt.hxx"
+#include "flyfrms.hxx"
+namespace binfilter {
+
+static FASTBOOL bInResize = FALSE;
+
+/*N*/ TYPEINIT1( SwFlyDrawObj, SdrObject )
+/*N*/ TYPEINIT1( SwVirtFlyDrawObj, SdrVirtObj )
+
+/*************************************************************************
+|*
+|* SwFlyDrawObj::Ctor
+|*
+|* Ersterstellung MA 18. Apr. 95
+|* Letzte Aenderung MA 28. May. 96
+|*
+*************************************************************************/
+/*N*/ SwFlyDrawObj::SwFlyDrawObj()
+/*N*/ {
+/*N*/ bNotPersistent = TRUE;
+/*N*/ mpLocalItemSet = NULL;
+/*N*/ }
+
+/*N*/ SwFlyDrawObj::~SwFlyDrawObj()
+/*N*/ {
+/*N*/ if(mpLocalItemSet)
+/*?*/ delete mpLocalItemSet;
+/*N*/ }
+
+
+
+/*************************************************************************
+|*
+|* SwFlyDrawObj::Paint()
+|*
+|* Ersterstellung MA 08. Dec. 94
+|* Letzte Aenderung MA 20. May. 95
+|*
+*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwFlyDrawObj::Factory-Methoden
+|*
+|* Ersterstellung MA 23. Feb. 95
+|* Letzte Aenderung MA 23. Feb. 95
+|*
+*************************************************************************/
+
+/*N*/ UINT32 __EXPORT SwFlyDrawObj::GetObjInventor() const
+/*N*/ {
+/*N*/ return SWGInventor;
+/*N*/ }
+
+
+/*N*/ UINT16 __EXPORT SwFlyDrawObj::GetObjIdentifier() const
+/*N*/ {
+/*N*/ return SwFlyDrawObjIdentifier;
+/*N*/ }
+
+
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::CToren, Dtor
+|*
+|* Ersterstellung MA 08. Dec. 94
+|* Letzte Aenderung MA 28. May. 96
+|*
+*************************************************************************/
+
+/*N*/ SwVirtFlyDrawObj::SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrm* pFly) :
+/*N*/ SdrVirtObj( rNew ),
+/*N*/ pFlyFrm( pFly )
+/*N*/ {
+/*N*/ bNotPersistent = bNeedColorRestore = bWriterFlyFrame = TRUE;
+/*N*/ const SvxProtectItem &rP = pFlyFrm->GetFmt()->GetProtect();
+/*N*/ bMovProt = rP.IsPosProtected();
+/*N*/ bSizProt = rP.IsSizeProtected();
+/*N*/ }
+
+
+/*N*/ __EXPORT SwVirtFlyDrawObj::~SwVirtFlyDrawObj()
+/*N*/ {
+/*N*/ if ( GetPage() ) //Der SdrPage die Verantwortung entziehen.
+/*N*/ GetPage()->RemoveObject( GetOrdNum() );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::GetFmt()
+|*
+|* Ersterstellung MA 08. Dec. 94
+|* Letzte Aenderung MA 08. Dec. 94
+|*
+*************************************************************************/
+
+
+
+/*N*/ SwFrmFmt *SwVirtFlyDrawObj::GetFmt()
+/*N*/ {
+/*N*/ return GetFlyFrm()->GetFmt();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::Paint()
+|*
+|* Ersterstellung MA 20. Dec. 94
+|* Letzte Aenderung MA 18. Dec. 95
+|*
+*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::CheckHit()
+|* Beschreibung Das Teil ist genau dann getroffen wenn
+|* 1. der Point im Rand des Frm liegt.
+|* 2. der Point im heissen Bereich liegt.
+|* 3. der Point in der Flaeche liegt und es sich um
+|* einen Rahmen mit NoTxtFrm handelt und dieser
+|* keine URL traegt.
+|* 3a nicht aber wenn ueber dem Fly noch ein Fly liegt,
+|* und der Point in dessen Flaeche nicht steht.
+|* 4. der Point in der Flaeche liegt und der Rahmen
+|* selektiert ist.
+|* Ersterstellung MA 08. Dec. 94
+|* Letzte Aenderung JP 25.03.96
+|*
+*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::TakeObjInfo()
+|*
+|* Ersterstellung MA 03. May. 95
+|* Letzte Aenderung MA 03. May. 95
+|*
+*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::Groessenermittlung
+|*
+|* Ersterstellung MA 12. Jan. 95
+|* Letzte Aenderung MA 10. Nov. 95
+|*
+*************************************************************************/
+
+/*N*/ void SwVirtFlyDrawObj::SetRect() const
+/*N*/ {
+/*N*/ if ( GetFlyFrm()->Frm().HasArea() )
+/*N*/ ((SwVirtFlyDrawObj*)this)->aOutRect = GetFlyFrm()->Frm().SVRect();
+/*N*/ else
+/*?*/ ((SwVirtFlyDrawObj*)this)->aOutRect = Rectangle();
+/*N*/ }
+
+
+/*N*/ const Rectangle& __EXPORT SwVirtFlyDrawObj::GetBoundRect() const
+/*N*/ {
+/*N*/ SetRect();
+/*N*/ return aOutRect;
+/*N*/ }
+
+
+
+
+
+
+/*N*/ const Rectangle& __EXPORT SwVirtFlyDrawObj::GetSnapRect() const
+/*N*/ {
+/*N*/ SetRect();
+/*N*/ return aOutRect;
+/*N*/ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* SwVirtFlyDrawObj::Move() und Resize()
+|*
+|* Ersterstellung MA 12. Jan. 95
+|* Letzte Aenderung MA 26. Jul. 96
+|*
+*************************************************************************/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/draw/sw_dobjfac.cxx b/binfilter/bf_sw/source/core/draw/sw_dobjfac.cxx
new file mode 100644
index 000000000000..53f13968852e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/draw/sw_dobjfac.cxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include <errhdl.hxx>
+#include <dobjfac.hxx>
+#include <dflyobj.hxx>
+namespace binfilter {
+
+SwObjectFactory aSwObjectFactory;
+
+/*************************************************************************
+|*
+|* void SwObjectFactory::MakeObject()
+|*
+\************************************************************************/
+
+/*N*/ IMPL_LINK( SwObjectFactory, MakeObject, SdrObjFactory*, pObjFactory )
+/*N*/ {
+/*N*/ if ( pObjFactory->nInventor == SWGInventor )
+/*N*/ {
+/*N*/ //Kein switch, derzeit gibt es nur einen.
+/*?*/ ASSERT( pObjFactory->nIdentifier == SwFlyDrawObjIdentifier,
+/*?*/ "Falscher Inventor oder identifier." );
+/*?*/ pObjFactory->pNewObj = new SwFlyDrawObj();
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/draw/sw_dpage.cxx b/binfilter/bf_sw/source/core/draw/sw_dpage.cxx
new file mode 100644
index 000000000000..bf25b11b2ce4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/draw/sw_dpage.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <frmfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <drawdoc.hxx>
+#include <dpage.hxx>
+#include <dcontact.hxx>
+#include <docsh.hxx>
+#include <flyfrm.hxx>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::frame;
+
+/*?*/ SwDPage::SwDPage(SwDrawDocument& rNewModel, BOOL bMasterPage) :
+/*?*/ FmFormPage(rNewModel, 0, bMasterPage),
+/*?*/ pGridLst( 0 ),
+/*?*/ rDoc(rNewModel.GetDoc())
+/*?*/ {
+/*?*/ }
+
+
+/*N*/ SwDPage::~SwDPage()
+/*N*/ {
+/*N*/ delete pGridLst;
+/*N*/ }
+
+
+// #i3694#
+// This GetOffset() method is not needed anymore, it even leads to errors.
+//Point SwDPage::GetOffset() const
+//{
+// return Point( DOCUMENTBORDER, DOCUMENTBORDER );
+//}
+
+/*************************************************************************
+|*
+|* SwDPage::ReplaceObject()
+|*
+|* Ersterstellung MA 07. Aug. 95
+|* Letzte Aenderung MA 07. Aug. 95
+|*
+*************************************************************************/
+
+/*N*/ SdrObject* SwDPage::ReplaceObject( SdrObject* pNewObj, ULONG nObjNum )
+/*N*/ {
+/*N*/ SdrObject *pOld = GetObj( nObjNum );
+/*N*/ ASSERT( pOld, "Oups, Object not replaced" );
+/*N*/ SdrObjUserCall* pContact;
+/*N*/ if ( 0 != ( pContact = GetUserCall(pOld) ) &&
+/*N*/ RES_DRAWFRMFMT == ((SwContact*)pContact)->GetFmt()->Which())
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ ((SwDrawContact*)pContact)->ChangeMasterObject( pNewObj );
+/*N*/ return FmFormPage::ReplaceObject( pNewObj, nObjNum );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDPage::GetGridFrameList()
+|*
+|* Ersterstellung MA 04. Sep. 95
+|* Letzte Aenderung MA 15. Feb. 96
+|*
+*************************************************************************/
+
+
+
+
+/*************************************************************************
+|*
+|* String SwDPage::GetLinkData( const String& )
+|* void SwDPage::SetLinkData( const String&, const String& )
+|* void SwDPage::UpdateLinkData( const String&, const String& )
+|*
+|* Ersterstellung JP 04.09.95
+|* Letzte Aenderung JP 04.09.95
+|*
+*************************************************************************/
+
+
+
+
+
+
+
+/*
+Bug 29593: QuickHelp immer an der MausPosition anzeigen (besonders unter OS/2)
+
+ Rectangle aRect( pObj->GetSnapRect() );
+ Point aPt( pWindow->OutputToScreenPixel( pWindow->LogicToPixel( aRect.TopLeft() )));
+ aRect.Left() = aPt.X();
+ aRect.Top() = aPt.Y();
+ aPt = pWindow->OutputToScreenPixel( pWindow->LogicToPixel( aRect.BottomRight() ));
+ aRect.Right() = aPt.X();
+ aRect.Bottom() = aPt.Y();
+*/
+/* -----------------------------27.11.00 07:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ Reference< XInterface > SwDPage::createUnoPage()
+/*N*/ {
+/*N*/ Reference<XModel> xModel = rDoc.GetDocShell()->GetBaseModel();
+/*N*/ Reference<XDrawPageSupplier> xPageSupp(xModel, UNO_QUERY);
+/*N*/ return xPageSupp->getDrawPage();
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/draw/sw_drawdoc.cxx b/binfilter/bf_sw/source/core/draw/sw_drawdoc.cxx
new file mode 100644
index 000000000000..f09994dd7575
--- /dev/null
+++ b/binfilter/bf_sw/source/core/draw/sw_drawdoc.cxx
@@ -0,0 +1,308 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svx/svxids.hrc>
+#include <bf_svtools/pathoptions.hxx>
+#include <bf_svtools/intitem.hxx>
+#include <bf_offmgr/app.hxx>
+#include <bf_svx/forbiddencharacterstable.hxx>
+
+#define ITEMID_COLOR_TABLE SID_COLOR_TABLE
+#define ITEMID_GRADIENT_LIST SID_GRADIENT_LIST
+#define ITEMID_HATCH_LIST SID_HATCH_LIST
+#define ITEMID_BITMAP_LIST SID_BITMAP_LIST
+#define ITEMID_DASH_LIST SID_DASH_LIST
+#define ITEMID_LINEEND_LIST SID_LINEEND_LIST
+#include <bf_svx/drawitem.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <drawdoc.hxx>
+#include <dpage.hxx>
+#include <docsh.hxx>
+#include <shellio.hxx>
+#include <sw3io.hxx>
+#include <hintids.hxx>
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+/*N*/ const String GetPalettePath()
+/*N*/ {
+/*N*/ SvtPathOptions aPathOpt;
+/*N*/ return aPathOpt.GetPalettePath();
+/*N*/ }
+
+/*N*/ SwDrawDocument::SwDrawDocument( SwDoc* pD ) :
+ /*N*/ FmFormModel( ::binfilter::GetPalettePath(), &pD->GetAttrPool(),
+/*N*/ pD->GetDocShell(), TRUE ),
+/*N*/ pDoc( pD )
+/*N*/ {
+/*N*/ SetScaleUnit( MAP_TWIP );
+/*N*/ SetSwapGraphics( TRUE );
+/*N*/
+/*N*/ SwDocShell* pDocSh = pDoc->GetDocShell();
+/*N*/ if ( pDocSh )
+/*N*/ {
+/*N*/ SetObjectShell( pDocSh );
+/*N*/ SvxColorTableItem* pColItem = ( SvxColorTableItem* )
+/*N*/ ( pDocSh->GetItem( ITEMID_COLOR_TABLE ) );
+/*N*/ XColorTable *pXCol = pColItem ? pColItem->GetColorTable() :
+/*N*/ OFF_APP()->GetStdColorTable();
+/*N*/ SetColorTable( pXCol );
+/*N*/
+/*N*/ if ( !pColItem )
+/*N*/ pDocSh->PutItem( SvxColorTableItem( pXCol ) );
+/*N*/
+/*N*/ pDocSh->PutItem( SvxGradientListItem( GetGradientList() ));
+/*N*/ pDocSh->PutItem( SvxHatchListItem( GetHatchList() ) );
+/*N*/ pDocSh->PutItem( SvxBitmapListItem( GetBitmapList() ) );
+/*N*/ pDocSh->PutItem( SvxDashListItem( GetDashList() ) );
+/*N*/ pDocSh->PutItem( SvxLineEndListItem( GetLineEndList() ) );
+/*N*/ pDocSh->PutItem( SfxUInt16Item(SID_ATTR_LINEEND_WIDTH_DEFAULT, 111) );
+/*N*/ SetObjectShell( pDocSh );
+/*N*/ }
+/*N*/ else
+/*?*/ SetColorTable( OFF_APP()->GetStdColorTable() );
+/*N*/
+/*N*/ // copy all the default values to the SdrModel
+/*N*/ SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool();
+/*N*/ if( pSdrPool )
+/*N*/ {
+/*N*/ const USHORT aWhichRanges[] =
+/*N*/ {
+/*N*/ RES_CHRATR_BEGIN, RES_CHRATR_END,
+/*N*/ RES_PARATR_BEGIN, RES_PARATR_END,
+/*N*/ 0
+/*N*/ };
+/*N*/
+/*N*/ SfxItemPool& rDocPool = pD->GetAttrPool();
+/*N*/ USHORT nEdtWhich, nSlotId;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ for( const USHORT* pRangeArr = aWhichRanges;
+/*N*/ *pRangeArr; pRangeArr += 2 )
+/*N*/ for( USHORT nW = *pRangeArr, nEnd = *(pRangeArr+1);
+/*N*/ nW < nEnd; ++nW )
+/*N*/ if( 0 != (pItem = rDocPool.GetPoolDefaultItem( nW )) &&
+/*N*/ 0 != (nSlotId = rDocPool.GetSlotId( nW ) ) &&
+/*N*/ nSlotId != nW &&
+/*N*/ 0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) &&
+/*N*/ nSlotId != nEdtWhich )
+/*N*/ {
+/*N*/ SfxPoolItem* pCpy = pItem->Clone();
+/*N*/ pCpy->SetWhich( nEdtWhich );
+/*N*/ pSdrPool->SetPoolDefaultItem( *pCpy );
+/*N*/ delete pCpy;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SetForbiddenCharsTable( pD->GetForbiddenCharacterTbl() );
+/*N*/ // #87795# Implementation for asian compression
+/*N*/ SetCharCompressType( pD->GetCharCompressType() );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Konstruktor, fuer einfuegen Document
+|*
+\************************************************************************/
+
+
+SwDrawDocument::SwDrawDocument( SfxItemPool *pPool, SwDocShell *pDocSh )
+ : FmFormModel( GetPalettePath(), pPool, pDocSh, TRUE ),
+ pDoc( pDocSh->GetDoc() )
+{
+ SetScaleUnit( MAP_TWIP );
+ SetDefaultFontHeight( 240 );
+ SetSwapGraphics( TRUE );
+
+ ASSERT( pDocSh, "DocShell not found" );
+ SvxColorTableItem* pColItem = ( SvxColorTableItem* )
+ ( pDocSh->GetItem( ITEMID_COLOR_TABLE ) );
+ XColorTable *pXCol = pColItem ? pColItem->GetColorTable() :
+ OFF_APP()->GetStdColorTable();
+ SetColorTable( pXCol );
+
+ if ( !pColItem )
+ pDocSh->PutItem( SvxColorTableItem( pXCol ) );
+
+ // Bug 35371:
+ // fuers "Datei einfuegen" NIE die anderen Items an der DocShell setzen!!!
+ // Diese zeigen sonst immer in das temporaere SdrModel !
+ SetObjectShell( pDocSh );
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+
+/*N*/ SwDrawDocument::~SwDrawDocument()
+/*N*/ {
+/*N*/ Broadcast(SdrHint(HINT_MODELCLEARED));
+/*N*/
+/*N*/ Clear();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* Diese Methode erzeugt eine neue Seite (SdPage) und gibt einen Zeiger
+|* darauf zurueck. Die Drawing Engine benutzt diese Methode beim Laden
+|* zur Erzeugung von Seiten (deren Typ sie ja nicht kennt, da es ABLEITUNGEN
+|* der SdrPage sind).
+|*
+\************************************************************************/
+
+
+/*N*/ SdrPage* SwDrawDocument::AllocPage(FASTBOOL bMasterPage)
+/*N*/ {
+/*N*/ SwDPage* pPage = new SwDPage(*this, bMasterPage);
+/*N*/ pPage->SetName( String::CreateFromAscii(
+/*N*/ RTL_CONSTASCII_STRINGPARAM( "Controls" )) );
+/*N*/ return pPage;
+/*N*/ }
+
+
+/*N*/ SvStream* SwDrawDocument::GetDocumentStream( SdrDocumentStreamInfo& rInfo ) const
+/*N*/ {
+/*N*/ SvStream* pRet = NULL;
+/*N*/ SvStorageRef xRoot( pDoc->GetDocStorage() );
+/*N*/ String sDrawStrmNm( String::CreateFromAscii(
+/*N*/ RTL_CONSTASCII_STRINGPARAM( DRAWING_STREAM_NAME )));
+/*N*/
+/*N*/ if( xRoot.Is() && SVSTREAM_OK == xRoot->GetError() )
+/*N*/ {
+/*N*/ if( rInfo.maUserData.Len() &&
+/*N*/ ( rInfo.maUserData.GetToken( 0, ':' ) ==
+/*N*/ String( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package" ) ) ) )
+/*N*/ {
+/*?*/ const String aPicturePath( rInfo.maUserData.GetToken( 1, ':' ) );
+/*?*/
+/*?*/ // graphic from picture stream in picture storage in XML package
+/*?*/ if( aPicturePath.GetTokenCount( '/' ) == 2 )
+/*?*/ {
+/*?*/ SvStorageRef xPictureStorage;
+/*?*/ const String aPictureStorageName( aPicturePath.GetToken( 0, '/' ) );
+/*?*/ const String aPictureStreamName( aPicturePath.GetToken( 1, '/' ) );
+/*?*/
+/*?*/ if( xRoot->IsContained( aPictureStorageName ) &&
+/*?*/ xRoot->IsStorage( aPictureStorageName ) )
+/*?*/ {
+/*?*/ xPictureStorage = xRoot->OpenUCBStorage( aPictureStorageName,
+/*?*/ STREAM_READ |
+/*?*/ STREAM_SHARE_DENYWRITE |
+/*?*/ STREAM_NOCREATE );
+/*?*/ }
+/*?*/
+/*?*/ if( xPictureStorage.Is() &&
+/*?*/ xPictureStorage->IsContained( aPictureStreamName ) &&
+/*?*/ xPictureStorage->IsStream( aPictureStreamName ) )
+/*?*/ {
+/*?*/ pRet = xPictureStorage->OpenSotStream( aPictureStreamName,
+/*?*/ STREAM_READ |
+/*?*/ STREAM_SHARE_DENYWRITE |
+/*?*/ STREAM_NOCREATE );
+/*?*/
+/*?*/ if( pRet )
+/*?*/ {
+/*?*/ pRet->SetVersion( xPictureStorage->GetVersion() );
+/*?*/ pRet->SetKey( xPictureStorage->GetKey() );
+/*?*/
+/*?*/ rInfo.mbDeleteAfterUse = TRUE;
+/*?*/ rInfo.mpStorageRef = new SvStorageRef( xPictureStorage );
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ else if( xRoot->IsStream( sDrawStrmNm ) )
+/*N*/ {
+/*N*/ long nFFVersion = xRoot->GetVersion();
+/*N*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_31 ||
+/*N*/ nFFVersion == SOFFICE_FILEFORMAT_40 ||
+/*N*/ nFFVersion == SOFFICE_FILEFORMAT_50,
+/*N*/ "Am Root-Storage ist keine FF-Version gesetzt!" );
+/*N*/
+/*N*/ // Wenn eine 3.1-Clipboard-ID gesetzt ist, die Fileformat-Version
+/*N*/ // auf 3.1 setzten.
+/*N*/ if( SOT_FORMATSTR_ID_STARWRITER_30 == xRoot->GetFormat() &&
+/*N*/ nFFVersion != SOFFICE_FILEFORMAT_31 )
+/*N*/ {
+/*?*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_31,
+/*?*/ "Fileformat-Version auf 3.1 umgesetzt" );
+/*?*/ xRoot->SetVersion( nFFVersion = SOFFICE_FILEFORMAT_31 );
+/*N*/ }
+/*N*/ else if( ( SOT_FORMATSTR_ID_STARWRITER_40 == xRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERWEB_40 == xRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERGLOB_40 == xRoot->GetFormat() ) &&
+/*N*/ nFFVersion != SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*?*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_40,
+/*?*/ "Fileformat-Version auf 4.0 umgesetzt" );
+/*?*/ xRoot->SetVersion( nFFVersion = SOFFICE_FILEFORMAT_40 );
+/*N*/ }
+/*N*/ else if( ( SOT_FORMATSTR_ID_STARWRITER_50 == xRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERWEB_50 == xRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERGLOB_50 == xRoot->GetFormat() ) &&
+/*N*/ nFFVersion != SOFFICE_FILEFORMAT_50 )
+/*N*/ {
+/*?*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_50,
+/*?*/ "Fileformat-Version auf 4.0 umgesetzt" );
+/*?*/ xRoot->SetVersion( nFFVersion = SOFFICE_FILEFORMAT_50 );
+/*N*/ }
+/*N*/
+/*N*/ pRet = xRoot->OpenStream( sDrawStrmNm,
+/*N*/ STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE );
+/*N*/
+/*N*/ if( pRet )
+/*N*/ rInfo.mbDeleteAfterUse = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/draw/sw_dview.cxx b/binfilter/bf_sw/source/core/draw/sw_dview.cxx
new file mode 100644
index 000000000000..af8ca69c97f4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/draw/sw_dview.cxx
@@ -0,0 +1,238 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+
+
+
+
+#include <horiornt.hxx>
+
+#include "frmfmt.hxx"
+#include "dcontact.hxx"
+#include "viewsh.hxx"
+#include "viewimp.hxx"
+#include "dview.hxx"
+
+#include <fmtanchr.hxx>
+
+// #i7672#
+
+// OD 18.06.2003 #108784#
+#include <vector>
+namespace binfilter {
+
+class SwSdrHdl : public SdrHdl
+{
+public:
+ SwSdrHdl(const Point& rPnt, bool bTopRight ) :
+ SdrHdl( rPnt, bTopRight ? HDL_ANCHOR_TR : HDL_ANCHOR ) {}
+};
+
+
+
+/*************************************************************************
+|*
+|* SwDrawView::Ctor
+|*
+|* Ersterstellung OK 18.11.94
+|* Letzte Aenderung MA 22. Jul. 96
+|*
+*************************************************************************/
+
+
+
+/*N*/ SwDrawView::SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice *pOutDev) :
+/*N*/ FmFormView( (FmFormModel*)pMd, pOutDev ),
+/*N*/ rImp( rI )
+/*N*/ {
+/*N*/ SetPageVisible( FALSE );
+/*N*/ SetBordVisible( FALSE );
+/*N*/ SetGridVisible( FALSE );
+/*N*/ SetHlplVisible( FALSE );
+/*N*/ SetGlueVisible( FALSE );
+/*N*/ SetFrameDragSingles( TRUE );
+/*N*/ SetVirtualObjectBundling( TRUE );
+/*N*/ SetSwapAsynchron( TRUE );
+/*N*/
+/*N*/ EnableExtendedKeyInputDispatcher( FALSE );
+/*N*/ EnableExtendedMouseEventDispatcher( FALSE );
+/*N*/ EnableExtendedCommandEventDispatcher( FALSE );
+/*N*/
+/*N*/ SetHitTolerancePixel( GetMarkHdlSizePixel()/2 );
+/*N*/
+/*N*/ SetPrintPreview( rI.GetShell()->IsPreView() );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwDrawView::AddCustomHdl()
+|*
+|* Gets called every time the handles need to be build
+|*
+|* Ersterstellung AW 06. Sep. 99
+|* Letzte Aenderung AW 06. Sep. 99
+|*
+*************************************************************************/
+
+/*M*/ void SwDrawView::AddCustomHdl()
+/*M*/ {
+/*M*/ const SdrMarkList &rMrkList = GetMarkList();
+/*M*/
+/*M*/ if(rMrkList.GetMarkCount() != 1 || !GetUserCall(rMrkList.GetMark( 0 )->GetObj()))
+/*M*/ return;
+/*M*/
+/*?*/ SdrObject *pObj = rMrkList.GetMark(0)->GetObj();
+/*?*/ const SwFmtAnchor &rAnchor = ::binfilter::FindFrmFmt(pObj)->GetAnchor();
+/*?*/
+/*?*/ if(FLY_IN_CNTNT == rAnchor.GetAnchorId())
+/*?*/ return;
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwDrawView::GetMaxToTopObj(), _GetMaxToTopObj()
+|*
+|* Ersterstellung MA 13. Jan. 95
+|* Letzte Aenderung MA 18. Mar. 97
+|*
+*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwDrawView::GetMaxToBtmObj()
+|*
+|* Ersterstellung MA 13. Jan. 95
+|* Letzte Aenderung MA 05. Sep. 96
+|*
+*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwDrawView::ObjOrderChanged()
+|*
+|* Ersterstellung MA 31. Jul. 95
+|* Letzte Aenderung MA 18. Mar. 97
+|*
+*************************************************************************/
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* SwDrawView::TakeDragLimit()
+|*
+|* Ersterstellung AMA 26. Apr. 96
+|* Letzte Aenderung MA 03. May. 96
+|*
+*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwDrawView::CalcAnchor()
+|*
+|* Ersterstellung MA 13. Jan. 95
+|* Letzte Aenderung MA 08. Nov. 96
+|*
+*************************************************************************/
+
+
+
+
+
+/*************************************************************************
+|*
+|* SwDrawView::ShowDragXor(), HideDragXor()
+|*
+|* Ersterstellung MA 17. Jan. 95
+|* Letzte Aenderung MA 27. Jan. 95
+|*
+*************************************************************************/
+
+
+
+
+
+/*************************************************************************
+|*
+|* SwDrawView::MarkListHasChanged()
+|*
+|* Ersterstellung OM 02. Feb. 95
+|* Letzte Aenderung OM 07. Jul. 95
+|*
+*************************************************************************/
+
+
+/*N*/ void SwDrawView::MarkListHasChanged()
+/*N*/ {
+/*N*/ Imp().GetShell()->DrawSelChanged(this);
+/*N*/ FmFormView::MarkListHasChanged();
+/*N*/ }
+
+// #i7672#
+/*N*/ void SwDrawView::ModelHasChanged()
+/*N*/ {
+ // The ModelHasChanged() call in DrawingLayer also updates
+ // a eventually active text edit view (OutlinerView). This also leads
+ // to newly setting the background color for that edit view. Thus,
+ // this method rescues the current background color if a OutlinerView
+ // exists and re-establishes it then. To be more safe, the OutlinerView
+ // will be fetched again (maybe textedit has ended).
+/*N*/ OutlinerView* pView = GetTextEditOutlinerView();
+/*N*/ Color aBackColor;
+/*N*/ sal_Bool bColorWasSaved(sal_False);
+/*N*/
+/*N*/ if(pView)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ // call parent
+/*N*/ FmFormView::ModelHasChanged();
+/*N*/
+/*N*/ if(bColorWasSaved)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/makefile.mk b/binfilter/bf_sw/source/core/edit/makefile.mk
new file mode 100644
index 000000000000..a952620ddafe
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/makefile.mk
@@ -0,0 +1,60 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_edit
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_autofmt.obj \
+ $(SLO)$/sw_edatmisc.obj \
+ $(SLO)$/sw_edfld.obj \
+ $(SLO)$/sw_ednumber.obj \
+ $(SLO)$/sw_edredln.obj \
+ $(SLO)$/sw_edtab.obj \
+ $(SLO)$/sw_edundo.obj \
+ $(SLO)$/sw_edws.obj \
+ $(SLO)$/sw_edsect.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/edit/sw_autofmt.cxx b/binfilter/bf_sw/source/core/edit/sw_autofmt.cxx
new file mode 100644
index 000000000000..580f80aaea6d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_autofmt.cxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#define _SVSTDARR_LONGS
+#define _SVSTDARR_USHORTS
+
+#include <ctype.h>
+#include <hintids.hxx>
+
+
+
+#include <horiornt.hxx>
+
+#include <editsh.hxx>
+
+#include <statstr.hrc>
+#include <comcore.hrc>
+
+namespace binfilter {
+
+//-------------------------------------------------------------------
+
+//JP 16.12.99: definition:
+// from pos cPosEnDash to cPosEmDash all chars changed to endashes,
+// from pos cPosEmDash to cPosEnd all chars changed to emdashes
+// all other chars are changed to the user configuration
+
+
+
+
+/*N*/ SvxSwAutoFmtFlags* SwEditShell::pAutoFmtFlags = 0;
+
+// Anzahl von Num-/Bullet-Absatzvorlagen. MAXLEVEL wird demnaechst auf
+// x erhoeht, die Anzahl Vorlagen aber nicht (Ueberbleibsel aus <= 4.0)
+
+ static BOOL m_bAskForCancelUndoWhileBufferOverflow;
+ static short m_nActionWhileAutoformatUndoBufferOverflow;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_edatmisc.cxx b/binfilter/bf_sw/source/core/edit/sw_edatmisc.cxx
new file mode 100644
index 000000000000..d7f9d24091f7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_edatmisc.cxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include <editsh.hxx>
+#include <doc.hxx> // fuer aNodes
+namespace binfilter {
+
+
+
+/*************************************
+ * harte Formatierung (Attribute)
+ *************************************/
+
+
+
+
+
+
+// Setze das Attribut als neues default Attribut im Dokument.
+
+
+
+/*
+
+void SwEditShell::SetDefault( const SfxItemSet& rSet )
+{
+ // 7502: Action-Klammerung
+ StartAllAction();
+ GetDoc()->SetDefault( rSet );
+ EndAllAction();
+}
+*/
+
+// Erfrage das Default Attribut in diesem Dokument.
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_edfld.cxx b/binfilter/bf_sw/source/core/edit/sw_edfld.cxx
new file mode 100644
index 000000000000..6408b12faadc
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_edfld.cxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include <editsh.hxx>
+#include <ndtxt.hxx> // GetCurFld
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <expfld.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include "pam.hxx"
+
+#include "doc.hxx"
+
+namespace binfilter {
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::rtl;
+
+
+// wenn Selektion groesser Max Nodes oder mehr als Max Selektionen
+// => keine Attribute
+static const USHORT nMaxLookup = 40;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen zu einer ResId zaehlen
+ wenn 0 alle zaehlen
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen zu einer ResId finden
+ wenn 0 alle finden
+ --------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: Den ersten Typen mit ResId und Namen finden
+ --------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen loeschen
+ --------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: FieldType ueber Name loeschen
+ --------------------------------------------------------------------*/
+
+
+
+/*************************************************************************
+|*
+|* SwEditShell::Insert( SwField )
+|*
+|* Beschreibung an der Cursorposition ein Feld einfuegen
+|* Quelle: vgl. SwEditShell::Insert( String )
+|*
+*************************************************************************/
+
+
+/*N*/ inline SwTxtFld *GetDocTxtFld( const SwPosition* pPos )
+/*N*/ {
+/*N*/ SwTxtNode *pNode = pPos->nNode.GetNode().GetTxtNode();
+/*N*/ if( pNode )
+/*N*/ return pNode->GetTxtFld( pPos->nContent );
+/*N*/ else
+/*N*/ return 0;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_ednumber.cxx b/binfilter/bf_sw/source/core/edit/sw_ednumber.cxx
new file mode 100644
index 000000000000..51a5cc11ab7c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_ednumber.cxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include <editsh.hxx>
+#include <edimp.hxx>
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <viscrs.hxx>
+#include <paratr.hxx>
+namespace binfilter {
+
+/*N*/ SV_IMPL_VARARR_SORT( _SwPamRanges, SwPamRange )
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_edredln.cxx b/binfilter/bf_sw/source/core/edit/sw_edredln.cxx
new file mode 100644
index 000000000000..d4982244989f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_edredln.cxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <errhdl.hxx>
+
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "editsh.hxx"
+namespace binfilter {
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_edsect.cxx b/binfilter/bf_sw/source/core/edit/sw_edsect.cxx
new file mode 100644
index 000000000000..53170b85f078
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_edsect.cxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <editsh.hxx>
+#include <pam.hxx>
+#include <docary.hxx>
+#include <section.hxx>
+
+namespace binfilter {
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_edtab.cxx b/binfilter/bf_sw/source/core/edit/sw_edtab.cxx
new file mode 100644
index 000000000000..7822487b7201
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_edtab.cxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hintids.hxx>
+
+#define _SVSTDARR_ULONGS
+
+
+
+#include <horiornt.hxx>
+
+#include <editsh.hxx>
+#include <doc.hxx>
+#include <hints.hxx>
+#include <node.hxx>
+#include <mdiexp.hxx>
+namespace binfilter {
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_edundo.cxx b/binfilter/bf_sw/source/core/edit/sw_edundo.cxx
new file mode 100644
index 000000000000..f5f7fd71590d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_edundo.cxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include <fesh.hxx>
+#include <doc.hxx>
+namespace binfilter {
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/edit/sw_edws.cxx b/binfilter/bf_sw/source/core/edit/sw_edws.cxx
new file mode 100644
index 000000000000..b4b174bb595f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/edit/sw_edws.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <vcl/window.hxx>
+
+#include <horiornt.hxx>
+
+#include <editsh.hxx>
+#include <doc.hxx>
+#include <pam.hxx>
+namespace binfilter {
+
+/********************************************************
+ * Ctor/Dtor
+ ********************************************************/
+
+// ctor/dtor
+
+
+/*N*/ SwEditShell::~SwEditShell() // USED
+/*N*/ {
+/*N*/ }
+
+/******************************************************************************
+ * void SwEditShell::StartAllAction()
+ ******************************************************************************/
+
+
+/*N*/ void SwEditShell::StartAllAction()
+/*N*/ {
+/*N*/ ViewShell *pSh = this;
+/*N*/ do {
+/*N*/ if( pSh->IsA( TYPE( SwEditShell ) ) )
+/*N*/ ((SwEditShell*)pSh)->StartAction();
+/*N*/ else
+/*?*/ pSh->StartAction();
+/*N*/ pSh = (ViewShell *)pSh->GetNext();
+/*N*/ } while(pSh != this);
+/*N*/ }
+/******************************************************************************
+ * void SwEditShell::EndAllAction()
+ ******************************************************************************/
+
+
+/*N*/ void SwEditShell::EndAllAction()
+/*N*/ {
+/*N*/ ViewShell *pSh = this;
+/*N*/ do {
+/*N*/ if( pSh->IsA( TYPE( SwEditShell ) ) )
+/*N*/ ((SwEditShell*)pSh)->EndAction();
+/*N*/ else
+/*?*/ pSh->EndAction();
+/*N*/ pSh = (ViewShell *)pSh->GetNext();
+/*N*/ } while(pSh != this);
+/*N*/ }
+
+/******************************************************************************
+ * void SwEditShell::CalcLayout()
+ ******************************************************************************/
+
+
+/*N*/ void SwEditShell::CalcLayout()
+/*N*/ {
+/*N*/ StartAllAction();
+/*N*/ ViewShell::CalcLayout();
+/*N*/
+/*N*/ ViewShell *pSh = this;
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pSh->GetWin() )
+/*N*/ pSh->GetWin()->Invalidate();
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != this );
+/*N*/
+/*N*/ EndAllAction();
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/except/makefile.mk b/binfilter/bf_sw/source/core/except/makefile.mk
new file mode 100644
index 000000000000..f7ec01c54c68
--- /dev/null
+++ b/binfilter/bf_sw/source/core/except/makefile.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_except
+
+#GEN_HID=TRUE
+#GEN_HID_OTHER=TRUE
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+#.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+
+# hier kein PCH!
+prjpch=
+PRJPCH=
+
+.INCLUDE : settings.mk
+#.INCLUDE : $(PRJ)$/inc$/sw.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+CXXFILES =
+
+.IF "$(dbgutil)"!=""
+CXXFILES += \
+ sw_errhdl.cxx
+
+SLOFILES += \
+ $(SLO)$/sw_errhdl.obj
+.ENDIF
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/except/sw_dbgloop.cxx b/binfilter/bf_sw/source/core/except/sw_dbgloop.cxx
new file mode 100644
index 000000000000..68a46a75ee77
--- /dev/null
+++ b/binfilter/bf_sw/source/core/except/sw_dbgloop.cxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+namespace binfilter {
+
+//DbgLoopStack DbgLoop::aDbgLoopStack;
+
+/*************************************************************************
+ * class DbgLoopStack
+ *************************************************************************/
+
+///*N*/ DbgLoopStack::DbgLoopStack()
+///*N*/ {
+///*N*/ Reset();
+///*N*/ }
+
+///*N*/ void DbgLoopStack::Reset()
+///*N*/ {
+///*N*/ nPtr = 0;
+///*N*/ pDbg = 0;
+///*N*/ for( USHORT i = 0; i < DBG_MAX_STACK; ++i )
+///*N*/ aCount[i] = 0;
+///*N*/ }
+
+/*************************************************************************
+ * DbgLoopStack::Push()
+ *************************************************************************/
+
+///*N*/ void DbgLoopStack::Push( const void *pThis )
+///*N*/ {
+///*N*/ // Wir muessen irgendwie mitbekommen, wann die erste Stackposition
+///*N*/ // resettet werden soll, z.B. wenn wir einen Nullpointer uebergeben
+///*N*/ if( !nPtr && ( pDbg != pThis || !pThis ) )
+///*N*/ {
+///*N*/ aCount[1] = 0;
+///*N*/ pDbg = pThis;
+///*N*/ }
+///*N*/
+///*N*/ ++nPtr;
+///*N*/ if( DBG_MAX_STACK > nPtr )
+///*N*/ {
+///*N*/ // Wenn eine loop entdeckt wird, wird der counter wieder zurueckgesetzt.
+///*N*/ ASSERT( DBG_MAX_LOOP > aCount[nPtr], "DbgLoopStack::Push: loop detected" );
+///*N*/ if( DBG_MAX_LOOP > aCount[nPtr] )
+///*N*/ ++(aCount[nPtr]);
+///*N*/ else
+///*N*/ aCount[nPtr] = 0;
+///*N*/ }
+///*N*/ }
+
+/*************************************************************************
+ * DbgLoopStack::Pop()
+ *************************************************************************/
+
+///*N*/ void DbgLoopStack::Pop()
+///*N*/ {
+///*N*/ if( DBG_MAX_STACK > nPtr )
+///*N*/ {
+///*N*/ ASSERT( nPtr, "DbgLoopStack::Pop: can't pop the stack" );
+///*N*/
+///*N*/ ASSERT( aCount[nPtr], "DbgLoopStack::Pop: can't dec the count" );
+///*N*/ if( DBG_MAX_STACK > nPtr + 1 )
+///*N*/ aCount[nPtr + 1] = 0;
+///*N*/ }
+///*N*/ --nPtr;
+///*N*/ }
+
+/*************************************************************************
+ * DbgLoopStack::Print()
+ *************************************************************************/
+
+
+//#ifdef STAND_ALONE
+// compile with: cl /AL /DSTAND_ALONE dbgloop.cxx
+
+/*************************************************************************
+ * main()
+ *************************************************************************/
+
+//#include <stdlib.h>
+
+///*N*/ void AssertFail( const char *pErr, const char *pFile, USHORT nLine )
+///*N*/ {
+///*N*/ cout << pErr << '\n';
+/////*N*/ PrintLoopStack( cout );
+///*N*/ exit(0);
+///*N*/ }
+
+//#endif
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/except/sw_errhdl.cxx b/binfilter/bf_sw/source/core/except/sw_errhdl.cxx
new file mode 100644
index 000000000000..e39aa977a4a2
--- /dev/null
+++ b/binfilter/bf_sw/source/core/except/sw_errhdl.cxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define _ERRHDL_CXX
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "stdlib.h"
+#ifdef WIN
+#include <svwin.h> // fuer die Goodies der Windows User
+#include <dos.h>
+#endif
+
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/sound.hxx>
+
+#include <error.h> // fuer die defines von ERR_SW6MSG_ ...
+namespace binfilter {
+
+// break into CodeView
+#if defined(ZTC) && defined(WIN)
+#define CVBREAK asm( 0xCC );
+#endif
+#if defined(MSC) && defined(WIN)
+#define CVBREAK __asm int 3;
+#endif
+#ifndef CVBREAK
+#define CVBREAK
+#endif
+
+BOOL bAssertFail = FALSE; // ist gerade eine Assertbox oben ?
+BOOL bAssert = FALSE; // TRUE, wenn mal ein ASSERT kam.
+
+/*------------------------------------------------------------------------
+ Ausgabe einer Fehlermeldung inkl. Bedingung, Dateiname und Zeilennummer
+ wo der Fehler auftrat.
+ Die Funktion wird durch das ASSERT Makro gerufen!
+ Parameter:
+ char *pError Fehlermeldung
+ char *pFileName Filename in dem der Fehler auftrat
+ USHORT nLine Zeilennummer in dem der Fehler auftrat
+------------------------------------------------------------------------*/
+
+/*N*/ void AssertFail( const sal_Char* pError, const sal_Char* pFileName, USHORT nLine )
+/*N*/ {
+/*N*/ CVBREAK;
+/*N*/ // NOTE4("ASSERT: %s at %d: %s\n", pFileName, nLine, pError);
+/*N*/ bAssert = TRUE;
+/*N*/
+/*N*/ if( !bAssertFail && GetpApp() && GetpApp()->IsInMain() )
+/*N*/ {
+/*N*/ bAssertFail = TRUE;
+/*N*/ ByteString aErr;
+/*N*/ aErr = "Assertion failed\n==================\nFILE : ";
+/*N*/ aErr += pFileName;
+/*N*/ aErr += " at line ";
+/*N*/ aErr += ByteString::CreateFromInt32( nLine );
+/*N*/ aErr += "\nERROR : ";
+/*N*/ aErr += pError;
+/*N*/
+/*N*/ ByteString aTmp( getenv( "SW_NOBEEP" ) );
+/*N*/ if ( aTmp != "TRUE" )
+/*N*/ Sound::Beep(SOUND_ERROR);
+/*N*/
+/*N*/ #if defined( UNX ) && !defined( DBG_UTIL )
+/*N*/ DBG_ERROR( aErr.GetBuffer() ); // DbgErr ist in UNIX-nicht Produkt-Versionen nicht definiert
+/*N*/ #else
+/*N*/ DbgError( aErr.GetBuffer() );
+/*N*/ #endif
+/*N*/ bAssertFail = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Sound::Beep(SOUND_ERROR);
+/*N*/ Sound::Beep(SOUND_ERROR);
+/*N*/ Sound::Beep(SOUND_ERROR);
+/*N*/ if( !bAssertFail )
+/*N*/ #if defined( MAC )
+/*N*/ if( !bAssertFail )
+/*N*/ *(short *)1 = 4711; // odd address error erzeugen
+/*N*/ #endif
+/*N*/ if( !bAssertFail )
+/*N*/ *(short *)0 = 4711; // UAE ausloesen
+/*N*/ }
+/*N*/ }
+
+/*------------------------------------------------------------------------
+ Ausgabe einer Fehlermeldung inkl. Bedingung, Dateiname und Zeilennummer
+ wo der Fehler auftrat.
+ Die Funktion wird durch das ASSERT Makro gerufen!
+ Parameter:
+ USHORT nErrorId Id fuer Fehlermeldung
+ char *pFileName Filename in dem der Fehler auftrat
+ USHORT nLine Zeilennummer in dem der Fehler auftrat
+------------------------------------------------------------------------*/
+
+/*N*/ void AssertFail( USHORT nErrorId, const sal_Char* pFileName, USHORT nLine )
+/*N*/ {
+/*N*/ // Umsetzung der ErrorId in eine Fehlermeldung
+/*N*/ static const sal_Char
+/*N*/ /* Error Fehlermeldungen zugriffe ausserhalb eines Bereiches */
+/*N*/ sERR_VAR_IDX[] = "Op[]",
+/*N*/ sERR_OUTOFSCOPE[] = "Zugriff ausserhalb des Bereiches",
+/*N*/ /* Error Codes fuer Numerierungsregeln */
+/*N*/ sERR_NUMLEVEL[] = "Falscher Num-Level",
+/*N*/ /* Error Codes fuer TxtNode */
+/*N*/ sERR_NOHINTS[] = "Zugriff auf ungueltiges HintsArray",
+/*N*/ sERR_UNKNOWN[] = "???";
+/*N*/
+/*N*/ static const sal_Char* aErrStrTab[ ERR_SWGMSG_END - ERR_SWGMSG_START +1 ] =
+/*N*/ {
+/*N*/ sERR_VAR_IDX, sERR_OUTOFSCOPE, sERR_NUMLEVEL, sERR_NOHINTS
+/*N*/ };
+/*N*/
+/*N*/ const sal_Char* pMsg;
+/*N*/ if( nErrorId >= ERR_SWGMSG_START && nErrorId < ERR_SWGMSG_END )
+/*N*/ pMsg = aErrStrTab[ nErrorId - ERR_SWGMSG_START ];
+/*N*/ else
+/*N*/ pMsg = sERR_UNKNOWN;
+/*N*/
+/*N*/ AssertFail( pMsg, pFileName, nLine );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/makefile.mk b/binfilter/bf_sw/source/core/fields/makefile.mk
new file mode 100644
index 000000000000..7d8bb38405bf
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/makefile.mk
@@ -0,0 +1,68 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_fields
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_authfld.obj \
+ $(SLO)$/sw_cellfml.obj \
+ $(SLO)$/sw_chpfld.obj \
+ $(SLO)$/sw_dbfld.obj \
+ $(SLO)$/sw_ddefld.obj \
+ $(SLO)$/sw_ddetbl.obj \
+ $(SLO)$/sw_docufld.obj \
+ $(SLO)$/sw_expfld.obj \
+ $(SLO)$/sw_fldbas.obj \
+ $(SLO)$/sw_flddat.obj \
+ $(SLO)$/sw_flddropdown.obj \
+ $(SLO)$/sw_scrptfld.obj \
+ $(SLO)$/sw_macrofld.obj \
+ $(SLO)$/sw_reffld.obj \
+ $(SLO)$/sw_tblcalc.obj \
+ $(SLO)$/sw_usrfld.obj
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/fields/sw_authfld.cxx b/binfilter/bf_sw/source/core/fields/sw_authfld.cxx
new file mode 100644
index 000000000000..4a1bf017322c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_authfld.cxx
@@ -0,0 +1,854 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_LONGS
+#define _SVSTDARR_ULONGS
+
+#include <hintids.hxx>
+
+#include <bf_svx/unolingu.hxx>
+
+#include <authfld.hxx>
+#include <expfld.hxx>
+
+#include <errhdl.hxx>
+
+#include <pam.hxx>
+#include <cntfrm.hxx>
+#include <tox.hxx>
+#include <txmsrt.hxx>
+#include <doctxm.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <unofldmid.h>
+#include <unoprnms.hxx>
+namespace binfilter {
+
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::rtl;
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+
+typedef SwAuthEntry* SwAuthEntryPtr;
+SV_DECL_PTRARR_DEL( SwAuthDataArr, SwAuthEntryPtr, 5, 5 )
+SV_IMPL_PTRARR( SwAuthDataArr, SwAuthEntryPtr )
+
+
+typedef SwTOXSortKey* TOXSortKeyPtr;
+SV_DECL_PTRARR_DEL( SortKeyArr, TOXSortKeyPtr, 5, 5 )
+SV_IMPL_PTRARR( SortKeyArr, TOXSortKeyPtr )
+
+
+/* -----------------16.09.99 11:53-------------------
+
+ --------------------------------------------------*/
+ SwAuthEntry::SwAuthEntry(const SwAuthEntry& rCopy)
+ : nRefCount(0)
+ {
+ for(USHORT i = 0; i < AUTH_FIELD_END; i++)
+ aAuthFields[i] = rCopy.aAuthFields[i];
+ }
+// --------------------------------------------------------
+BOOL SwAuthEntry::operator==(const SwAuthEntry& rComp)
+{
+ for(USHORT i = 0; i < AUTH_FIELD_END; i++)
+ if(aAuthFields[i] != rComp.aAuthFields[i])
+ return FALSE;
+ return TRUE;
+}
+// --------------------------------------------------------
+BOOL SwAuthEntry::GetFirstAuthorField(USHORT& nPos, String& rToFill)const
+{
+ BOOL bRet = FALSE;
+ for(USHORT i = 0; i < AUTH_FIELD_END; i++)
+ if(aAuthFields[i].Len())
+ {
+ rToFill = aAuthFields[i];
+ nPos = i;
+ bRet = TRUE;
+ break;
+ }
+ return bRet;
+}
+// --------------------------------------------------------
+BOOL SwAuthEntry::GetNextAuthorField(USHORT& nPos, String& rToFill)const
+{
+ BOOL bRet = FALSE;
+ if(AUTH_FIELD_END > ++nPos)
+ {
+ for(USHORT i = nPos; i < AUTH_FIELD_END; i++)
+ if(aAuthFields[i].Len())
+ {
+ rToFill = aAuthFields[i];
+ nPos = i;
+ bRet = TRUE;
+ break;
+ }
+ }
+ return bRet;
+}
+
+// --------------------------------------------------------
+
+/* -----------------14.09.99 16:15-------------------
+
+ --------------------------------------------------*/
+SwAuthorityFieldType::SwAuthorityFieldType(SwDoc* pDoc)
+ : SwFieldType( RES_AUTHORITY ),
+ m_pDoc(pDoc),
+ m_pDataArr(new SwAuthDataArr ),
+ m_pSequArr(new SvLongs(5, 5)),
+ m_pSortKeyArr(new SortKeyArr(3, 3)),
+ m_bSortByDocument(TRUE),
+ m_bIsSequence(FALSE),
+ m_cPrefix('['),
+ m_cSuffix(']'),
+ m_eLanguage((LanguageType)GetAppLanguage())
+{
+}
+
+SwAuthorityFieldType::SwAuthorityFieldType( const SwAuthorityFieldType& rFType)
+ : SwFieldType( RES_AUTHORITY ),
+ m_pDataArr(new SwAuthDataArr ),
+ m_pSequArr(new SvLongs(5, 5)),
+ m_pSortKeyArr(new SortKeyArr(3, 3)),
+ m_bSortByDocument(rFType.m_bSortByDocument),
+ m_bIsSequence(rFType.m_bIsSequence),
+ m_cPrefix(rFType.m_cPrefix),
+ m_cSuffix(rFType.m_cSuffix),
+ m_eLanguage(rFType.m_eLanguage),
+ m_sSortAlgorithm(rFType.m_sSortAlgorithm)
+{
+ for(USHORT i = 0; i < rFType.m_pSortKeyArr->Count(); i++)
+ m_pSortKeyArr->Insert((*rFType.m_pSortKeyArr)[i], i);
+}
+
+/* -----------------17.09.99 13:52-------------------
+
+ --------------------------------------------------*/
+SwAuthorityFieldType::~SwAuthorityFieldType()
+{
+// DBG_ASSERT(!m_pDataArr->Count(), "Array is not empty");
+ m_pSortKeyArr->DeleteAndDestroy(0, m_pSortKeyArr->Count());
+ delete m_pSortKeyArr;
+ delete m_pSequArr;
+ delete m_pDataArr;
+}
+/*-- 14.09.99 16:22:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwFieldType* SwAuthorityFieldType::Copy() const
+{
+ return new SwAuthorityFieldType(m_pDoc);
+}
+/* -----------------17.09.99 13:43-------------------
+
+ --------------------------------------------------*/
+void SwAuthorityFieldType::RemoveField(long nHandle)
+{
+#ifdef DBG_UTIL
+ BOOL bRemoved = FALSE;
+#endif
+ for(USHORT j = 0; j < m_pDataArr->Count(); j++)
+ {
+ SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
+ long nRet = (long)(void*)pTemp;
+ if(nRet == nHandle)
+ {
+#ifdef DBG_UTIL
+ bRemoved = TRUE;
+#endif
+ pTemp->RemoveRef();
+ if(!pTemp->GetRefCount())
+ {
+ m_pDataArr->DeleteAndDestroy(j, 1);
+ //re-generate positions of the fields
+ DelSequenceArray();
+ }
+ break;
+ }
+ }
+#ifdef DBG_UTIL
+ DBG_ASSERT(bRemoved, "Field unknown" );
+#endif
+}
+/* -----------------17.09.99 13:43-------------------
+
+ --------------------------------------------------*/
+long SwAuthorityFieldType::AddField(const String& rFieldContents)
+{
+ long nRet = 0;
+ SwAuthEntry* pEntry = new SwAuthEntry;
+ for( USHORT i = 0; i < AUTH_FIELD_END; ++i )
+ pEntry->SetAuthorField( (ToxAuthorityField)i,
+ rFieldContents.GetToken( i, TOX_STYLE_DELIMITER ));
+
+ for(USHORT j = 0; j < m_pDataArr->Count() && pEntry; j++)
+ {
+ SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
+ if(*pTemp == *pEntry)
+ {
+ DELETEZ(pEntry);
+ nRet = (long)(void*)pTemp;
+ pTemp->AddRef();
+ }
+ }
+ //if it is a new Entry - insert
+ if(pEntry)
+ {
+ nRet = (long)(void*)pEntry;
+ pEntry->AddRef();
+ m_pDataArr->Insert(pEntry, m_pDataArr->Count());
+ //re-generate positions of the fields
+ DelSequenceArray();
+ }
+ return nRet;
+}
+/* -----------------17.09.99 14:18-------------------
+
+ --------------------------------------------------*/
+BOOL SwAuthorityFieldType::AddField(long nHandle)
+{
+ BOOL bRet = FALSE;
+ for( USHORT j = 0; j < m_pDataArr->Count(); j++ )
+ {
+ SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
+ long nTmp = (long)(void*)pTemp;
+ if( nTmp == nHandle )
+ {
+ bRet = TRUE;
+ pTemp->AddRef();
+ //re-generate positions of the fields
+ DelSequenceArray();
+ break;
+ }
+ }
+ DBG_ASSERT(bRet, "::AddField(long) failed");
+ return bRet;
+}
+/* -----------------17.09.99 14:52-------------------
+
+ --------------------------------------------------*/
+const SwAuthEntry* SwAuthorityFieldType::GetEntryByHandle(long nHandle) const
+{
+ const SwAuthEntry* pRet = 0;
+ for(USHORT j = 0; j < m_pDataArr->Count(); j++)
+ {
+ const SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
+ long nTmp = (long)(void*)pTemp;
+ if( nTmp == nHandle )
+ {
+ pRet = pTemp;
+ break;
+ }
+ }
+ ASSERT( pRet, "invalid Handle" );
+ return pRet;
+}
+/*-- 11.10.99 08:49:22---------------------------------------------------
+ Description: appends a new entry (if new) and returns the array position
+
+ -----------------------------------------------------------------------*/
+USHORT SwAuthorityFieldType::AppendField( const SwAuthEntry& rInsert )
+{
+ USHORT nRet = 0;
+ for( nRet = 0; nRet < m_pDataArr->Count(); ++nRet )
+ {
+ SwAuthEntry* pTemp = m_pDataArr->GetObject( nRet );
+ if( *pTemp == rInsert )
+ {
+ break;
+ //ref count unchanged
+ }
+ }
+
+ //if it is a new Entry - insert
+ if( nRet == m_pDataArr->Count() )
+ m_pDataArr->Insert( new SwAuthEntry( rInsert ), nRet );
+
+ return nRet;
+}
+
+/*-- 11.10.99 08:49:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+long SwAuthorityFieldType::GetHandle(USHORT nPos)
+{
+ long nRet = 0;
+ if( nPos < m_pDataArr->Count() )
+ {
+ SwAuthEntry* pTemp = m_pDataArr->GetObject(nPos);
+ nRet = (long)(void*)pTemp;
+ }
+ return nRet;
+}
+/* -----------------20.10.99 13:38-------------------
+
+ --------------------------------------------------*/
+USHORT SwAuthorityFieldType::GetPosition(long nHandle)
+{
+ USHORT j = 0;
+ for( ; j < m_pDataArr->Count(); ++j )
+ {
+ const SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
+ long nTmp = (long)(void*)pTemp;
+ if( nTmp == nHandle )
+ break;
+ }
+ if( j == m_pDataArr->Count() )
+ j = USHRT_MAX;
+
+ ASSERT( USHRT_MAX != j, "handle not found" );
+ return j;
+}
+
+/*-- 11.10.99 08:51:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+USHORT SwAuthorityFieldType::GetEntryCount() const
+{
+ return m_pDataArr->Count();
+}
+/*-- 11.10.99 08:51:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwAuthEntry* SwAuthorityFieldType::GetEntryByPosition(USHORT nPos) const
+{
+ if(nPos < m_pDataArr->Count())
+ return m_pDataArr->GetObject(nPos);
+ DBG_ERROR("wrong index");
+ return 0;
+}
+/* -----------------19.10.99 13:46-------------------
+
+ --------------------------------------------------*/
+USHORT SwAuthorityFieldType::GetSequencePos(long nHandle)
+{
+ //find the field in a sorted array of handles,
+#ifdef DBG_UTIL
+ sal_Bool bCurrentFieldWithoutTextNode = sal_False;
+#endif
+ if(m_pSequArr->Count() && m_pSequArr->Count() != m_pDataArr->Count())
+ DelSequenceArray();
+ if(!m_pSequArr->Count())
+ {
+ SwTOXSortTabBases aSortArr;
+ SwClientIter aIter( *this );
+
+ SwTOXInternational aIntl(m_eLanguage, 0, m_sSortAlgorithm);
+
+ for( SwFmtFld* pFmtFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) );
+ pFmtFld; pFmtFld = (SwFmtFld*)aIter.Next() )
+ {
+ SwAuthorityField* pAFld = (SwAuthorityField*)pFmtFld->GetFld();
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if(!pTxtFld || !pTxtFld->GetpTxtNode())
+ {
+#ifdef DBG_UTIL
+ if(nHandle == pAFld->GetHandle())
+ bCurrentFieldWithoutTextNode = sal_True;
+#endif
+ continue;
+ }
+ const SwTxtNode& rFldTxtNode = pTxtFld->GetTxtNode();
+ SwPosition aFldPos(rFldTxtNode);
+ SwDoc& rDoc = *(SwDoc*)rFldTxtNode.GetDoc();
+ SwCntntFrm *pFrm = rFldTxtNode.GetFrm();
+ const SwTxtNode* pTxtNode = 0;
+ if(pFrm && !pFrm->IsInDocBody())
+ pTxtNode = GetBodyTxtNode( rDoc, aFldPos, *pFrm );
+ //if no text node could be found or the field is in the document
+ //body the directly available text node will be used
+ if(!pTxtNode)
+ pTxtNode = &rFldTxtNode;
+ ULONG nPos = pTxtNode->GetIndex();
+ if( pTxtNode->GetTxt().Len() && pTxtNode->GetFrm() &&
+ pTxtNode->GetNodes().IsDocNodes() )
+ {
+ SwTOXAuthority* pNew = new SwTOXAuthority( *pTxtNode,
+ *pFmtFld, aIntl );
+
+ for(short i = 0; i < aSortArr.Count(); ++i)
+ {
+ SwTOXSortTabBase* pOld = aSortArr[i];
+ if(*pOld == *pNew)
+ {
+ //only the first occurence in the document
+ //has to be in the array
+ if(*pOld < *pNew)
+ DELETEZ(pNew);
+ else // remove the old content
+ aSortArr.DeleteAndDestroy( i, 1 );
+ break;
+ }
+ }
+ //if it still exists - insert at the correct position
+ if(pNew)
+ {
+ short j;
+ for(j = 0; j < aSortArr.Count(); ++j)
+ {
+ SwTOXSortTabBase* pOld = aSortArr[j];
+ if(*pNew < *pOld)
+ break;
+ }
+ aSortArr.Insert(pNew, j );
+ }
+ }
+ }
+
+ for(USHORT i = 0; i < aSortArr.Count(); i++)
+ {
+ const SwTOXSortTabBase& rBase = *aSortArr[i];
+ SwFmtFld& rFmtFld = ((SwTOXAuthority&)rBase).GetFldFmt();
+ SwAuthorityField* pAFld = (SwAuthorityField*)rFmtFld.GetFld();
+ m_pSequArr->Insert(pAFld->GetHandle(), i);
+ }
+ aSortArr.DeleteAndDestroy(0, aSortArr.Count());
+ }
+ //find nHandle
+ USHORT nRet = 0;
+ for(USHORT i = 0; i < m_pSequArr->Count(); i++)
+ {
+ if((*m_pSequArr)[i] == nHandle)
+ {
+ nRet = i + 1;
+ break;
+ }
+ }
+ ASSERT(bCurrentFieldWithoutTextNode || nRet, "Handle not found")
+ return nRet;
+}
+/* -----------------------------15.11.00 17:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwAuthorityFieldType::QueryValue( Any& rVal, BYTE nMId ) const
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ case FIELD_PROP_PAR2:
+ {
+ OUString sVal;
+ sal_Unicode uRet = FIELD_PROP_PAR1 == nMId ? m_cPrefix : m_cSuffix;
+ if(uRet)
+ sVal = OUString(uRet);
+ rVal <<= sVal;
+ }
+ break;
+ case FIELD_PROP_PAR3:
+ rVal <<= OUString(GetSortAlgorithm());
+ break;
+
+ case FIELD_PROP_BOOL1:
+ case FIELD_PROP_BOOL2:
+ {
+ sal_Bool bVal = FIELD_PROP_BOOL1 == nMId ? m_bIsSequence: m_bSortByDocument;
+ rVal.setValue(&bVal, ::getBooleanCppuType());
+ }
+ break;
+
+ case FIELD_PROP_LOCALE:
+ rVal <<= SvxCreateLocale(GetLanguage());
+ break;
+
+ case FIELD_PROP_PROP_SEQ:
+ {
+ Sequence<PropertyValues> aRet(m_pSortKeyArr->Count());
+ PropertyValues* pValues = aRet.getArray();
+ OUString sProp1( C2U(SW_PROP_NAME_STR(UNO_NAME_SORT_KEY)) ),
+ sProp2( C2U(SW_PROP_NAME_STR(UNO_NAME_IS_SORT_ASCENDING)));
+ for(sal_uInt16 i = 0; i < m_pSortKeyArr->Count(); i++)
+ {
+ const SwTOXSortKey* pKey = (*m_pSortKeyArr)[i];
+ pValues[i].realloc(2);
+ PropertyValue* pValue = pValues[i].getArray();
+ pValue[0].Name = sProp1;
+ pValue[0].Value <<= sal_Int16(pKey->eField);
+ pValue[1].Name = sProp2;
+ pValue[1].Value.setValue(&pKey->bSortAscending, ::getBooleanCppuType());
+ }
+ rVal <<= aRet;
+ }
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return TRUE;
+}
+/* -----------------------------15.11.00 17:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwAuthorityFieldType::PutValue( const Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ sal_Bool bRet = TRUE;
+ String sTmp;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ case FIELD_PROP_PAR2:
+ {
+ ::binfilter::GetString( rAny, sTmp );
+ sal_Unicode uSet = sTmp.GetChar(0);
+ if( FIELD_PROP_PAR1 == nMId )
+ m_cPrefix = uSet;
+ else
+ m_cSuffix = uSet;
+ }
+ break;
+ case FIELD_PROP_PAR3:
+ SetSortAlgorithm( ::binfilter::GetString( rAny, sTmp ));
+ break;
+
+ case FIELD_PROP_BOOL1:
+ m_bIsSequence = *(sal_Bool*)rAny.getValue();
+ break;
+ case FIELD_PROP_BOOL2:
+ m_bSortByDocument = *(sal_Bool*)rAny.getValue();
+ break;
+
+ case FIELD_PROP_LOCALE:
+ {
+ Locale aLocale;
+ if( 0 != (bRet = rAny >>= aLocale ))
+ SetLanguage( SvxLocaleToLanguage( aLocale ));
+ }
+ break;
+
+ case FIELD_PROP_PROP_SEQ:
+ {
+ Sequence<PropertyValues> aSeq;
+ if( 0 != (bRet = rAny >>= aSeq) )
+ {
+ m_pSortKeyArr->DeleteAndDestroy(0, m_pSortKeyArr->Count());
+ const PropertyValues* pValues = aSeq.getConstArray();
+ for(sal_Int32 i = 0; i < aSeq.getLength() && i < USHRT_MAX / 4; i++)
+ {
+ const PropertyValue* pValue = pValues[i].getConstArray();
+ SwTOXSortKey* pSortKey = new SwTOXSortKey;
+ for(sal_Int32 j = 0; j < pValues[i].getLength(); j++)
+ {
+ if(pValue[j].Name.equalsAsciiL(SW_PROP_NAME(UNO_NAME_SORT_KEY)))
+ {
+ sal_Int16 nVal = -1; pValue[j].Value >>= nVal;
+ if(nVal >= 0 && nVal < AUTH_FIELD_END)
+ pSortKey->eField = (ToxAuthorityField) nVal;
+ else
+ bRet = FALSE;
+ }
+ else if(pValue[j].Name.equalsAsciiL(SW_PROP_NAME(UNO_NAME_IS_SORT_ASCENDING)))
+ {
+ pSortKey->bSortAscending = *(sal_Bool*)pValue[j].Value.getValue();
+ }
+ }
+ m_pSortKeyArr->Insert(pSortKey, m_pSortKeyArr->Count());
+ }
+ }
+ }
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return bRet;
+}
+/* -----------------19.10.99 13:25-------------------
+
+ --------------------------------------------------*/
+void SwAuthorityFieldType::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+{
+ //re-generate positions of the fields
+ DelSequenceArray();
+ SwModify::Modify( pOld, pNew );
+}
+/* -----------------20.10.99 13:38-------------------
+
+ --------------------------------------------------*/
+USHORT SwAuthorityFieldType::GetSortKeyCount() const
+{
+ return m_pSortKeyArr->Count();
+}
+/* -----------------20.10.99 13:38-------------------
+
+ --------------------------------------------------*/
+const SwTOXSortKey* SwAuthorityFieldType::GetSortKey(USHORT nIdx) const
+{
+ SwTOXSortKey* pRet = 0;
+ if(m_pSortKeyArr->Count() > nIdx)
+ pRet = (*m_pSortKeyArr)[nIdx];
+ DBG_ASSERT(pRet, "Sort key not found");
+ return pRet;
+}
+/* -----------------20.10.99 13:38-------------------
+
+ --------------------------------------------------*/
+void SwAuthorityFieldType::SetSortKeys(USHORT nKeyCount, SwTOXSortKey aKeys[])
+{
+ m_pSortKeyArr->DeleteAndDestroy(0, m_pSortKeyArr->Count());
+ USHORT nArrIdx = 0;
+ for(USHORT i = 0; i < nKeyCount; i++)
+ if(aKeys[i].eField < AUTH_FIELD_END)
+ m_pSortKeyArr->Insert(new SwTOXSortKey(aKeys[i]), nArrIdx++);
+}
+
+/* -----------------14.09.99 16:15-------------------
+
+ --------------------------------------------------*/
+SwAuthorityField::SwAuthorityField( SwAuthorityFieldType* pType,
+ const String& rFieldContents )
+ : SwField(pType)
+{
+ nHandle = pType->AddField( rFieldContents );
+}
+/* -----------------17.09.99 14:24-------------------
+
+ --------------------------------------------------*/
+SwAuthorityField::SwAuthorityField( SwAuthorityFieldType* pType,
+ long nSetHandle )
+ : SwField( pType ),
+ nHandle( nSetHandle )
+{
+ pType->AddField( nHandle );
+}
+/* -----------------15.09.99 15:00-------------------
+
+ --------------------------------------------------*/
+SwAuthorityField::~SwAuthorityField()
+{
+ ((SwAuthorityFieldType* )GetTyp())->RemoveField(nHandle);
+}
+/*-- 14.09.99 16:20:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String SwAuthorityField::Expand() const
+{
+ SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
+ String sRet;
+ if(pAuthType->GetPrefix())
+ sRet.Assign(pAuthType->GetPrefix());
+
+ if( pAuthType->IsSequence() )
+ {
+ sRet += String::CreateFromInt32( pAuthType->GetSequencePos( nHandle ));
+ }
+ else
+ {
+ const SwAuthEntry* pEntry = pAuthType->GetEntryByHandle(nHandle);
+ //TODO: Expand to: identifier, number sequence, ...
+ if(pEntry)
+ sRet += pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER);
+ }
+ if(pAuthType->GetSuffix())
+ sRet += pAuthType->GetSuffix();
+ return sRet;
+}
+/*-- 14.09.99 16:21:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwField* SwAuthorityField::Copy() const
+{
+ SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
+ return new SwAuthorityField(pAuthType, nHandle);
+}
+/* -----------------21.09.99 12:55-------------------
+
+ --------------------------------------------------*/
+const String& SwAuthorityField::GetFieldText(ToxAuthorityField eField) const
+{
+ SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
+ const SwAuthEntry* pEntry = pAuthType->GetEntryByHandle( nHandle );
+ return pEntry->GetAuthorField( eField );
+}
+/* -----------------21.09.99 14:57-------------------
+
+ --------------------------------------------------*/
+void SwAuthorityField::SetPar1(const String& rStr)
+{
+ SwAuthorityFieldType* pType = (SwAuthorityFieldType* )GetTyp();
+ pType->RemoveField(nHandle);
+ nHandle = pType->AddField(rStr);
+}
+/* -----------------11.10.99 09:43-------------------
+
+ --------------------------------------------------*/
+USHORT SwAuthorityField::GetHandlePosition() const
+{
+ SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)GetTyp();
+ DBG_ASSERT(pAuthType, "no field type");
+ return pAuthType->GetPosition(nHandle);
+}
+/* -----------------------------15.11.00 17:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const char* aFieldNames[] =
+{
+ "Identifier",
+ "BibiliographicType",
+ "Address",
+ "Annote",
+ "Author",
+ "Booktitle",
+ "Chapter",
+ "Edition",
+ "Editor",
+ "Howpublished",
+ "Institution",
+ "Journal",
+ "Month",
+ "Note",
+ "Number",
+ "Organizations",
+ "Pages",
+ "Publisher",
+ "School",
+ "Series",
+ "Title",
+ "Report_Type",
+ "Volume",
+ "Year",
+ "URL",
+ "Custom1",
+ "Custom2",
+ "Custom3",
+ "Custom4",
+ "Custom5",
+ "ISBN"
+};
+/* -----------------------------16.11.00 12:27--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwAuthorityField::QueryValue( Any& rAny, BYTE nMId ) const
+{
+ nMId &= ~CONVERT_TWIPS;
+ if(!GetTyp())
+ return FALSE;
+ const SwAuthEntry* pAuthEntry = ((SwAuthorityFieldType*)GetTyp())->GetEntryByHandle(nHandle);
+ if(!pAuthEntry)
+ return FALSE;
+ Sequence <PropertyValue> aRet(AUTH_FIELD_END);
+ PropertyValue* pValues = aRet.getArray();
+ for(sal_Int16 i = 0; i < AUTH_FIELD_END; i++)
+ {
+ pValues[i].Name = C2U(aFieldNames[i]);
+ const String& rField = pAuthEntry->GetAuthorField((ToxAuthorityField) i);
+ if(i == AUTH_FIELD_AUTHORITY_TYPE)
+ pValues[i].Value <<= sal_Int16(rField.ToInt32());
+ else
+ pValues[i].Value <<= OUString(rField);
+ }
+ rAny <<= aRet;
+ return FALSE;
+}
+/* -----------------------------15.11.00 17:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int16 lcl_Find(const OUString& rFieldName)
+{
+ for(sal_Int16 i = 0; i < AUTH_FIELD_END; i++)
+ if(!rFieldName.compareToAscii(aFieldNames[i]))
+ return i;
+ return -1;
+}
+//----------------------------------------------------------------------------
+BOOL SwAuthorityField::PutValue( const Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ if(!GetTyp() || !((SwAuthorityFieldType*)GetTyp())->GetEntryByHandle(nHandle))
+ return FALSE;
+
+ Sequence <PropertyValue> aParam;
+ if(!(rAny >>= aParam))
+ return FALSE;
+
+ String sToSet;
+ sToSet.Fill(AUTH_FIELD_ISBN, TOX_STYLE_DELIMITER);
+ const PropertyValue* pParam = aParam.getConstArray();
+ for(sal_Int32 i = 0; i < aParam.getLength(); i++)
+ {
+ sal_Int16 nFound = lcl_Find(pParam[i].Name);
+ if(nFound >= 0)
+ {
+ OUString sContent;
+ if(AUTH_FIELD_AUTHORITY_TYPE == nFound)
+ {
+ sal_Int16 nVal;
+ pParam[i].Value >>= nVal;
+ sContent = OUString::valueOf((sal_Int32)nVal);
+ }
+ else
+ pParam[i].Value >>= sContent;
+ sToSet.SetToken(nFound, TOX_STYLE_DELIMITER, sContent);
+ }
+ }
+
+ ((SwAuthorityFieldType*)GetTyp())->RemoveField(nHandle);
+ nHandle = ((SwAuthorityFieldType*)GetTyp())->AddField(sToSet);
+
+ return FALSE;
+}
+/* -----------------11.10.99 09:43-------------------
+
+ --------------------------------------------------*/
+SwFieldType* SwAuthorityField::ChgTyp( SwFieldType* pFldTyp )
+{
+ SwAuthorityFieldType* pSrcTyp = (SwAuthorityFieldType*)GetTyp(),
+ * pDstTyp = (SwAuthorityFieldType*)pFldTyp;
+ if( pSrcTyp != pDstTyp )
+ {
+
+ const SwAuthEntry* pEntry = pSrcTyp->GetEntryByHandle( nHandle );
+ USHORT nHdlPos = pDstTyp->AppendField( *pEntry );
+ pSrcTyp->RemoveField( nHandle );
+ nHandle = pDstTyp->GetHandle( nHdlPos );
+ pDstTyp->AddField( nHandle );
+ SwField::ChgTyp( pFldTyp );
+ }
+ return pSrcTyp;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_cellfml.cxx b/binfilter/bf_sw/source/core/fields/sw_cellfml.cxx
new file mode 100644
index 000000000000..f257e3a45c7d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_cellfml.cxx
@@ -0,0 +1,586 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <float.h>
+
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <frmfmt.hxx>
+#include <cntfrm.hxx>
+#include <tabfrm.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <tblsel.hxx>
+#include <cellfml.hxx>
+#include <calc.hxx>
+#include <expfld.hxx>
+#include <usrfld.hxx>
+#include <flddat.hxx>
+#include <cellatr.hxx>
+#include <ndindex.hxx>
+#include <hints.hxx>
+namespace binfilter {
+
+const sal_Unicode cRelTrenner = ',';
+const sal_Unicode cRelKennung = ''; // CTRL-R
+
+const USHORT cMAXSTACKSIZE = 50;
+
+/*N*/ const SwFrm* lcl_GetBoxFrm( const SwTableBox& rBox );
+
+
+/*************************************************************************
+|*
+|* double SwTableBox::GetValue() const
+|* gebe den Wert dieser Box zurueck. Der Wert ergibt sich aus dem 1.
+|* TextNode. Beginnt dieser mit einer Zahl/Formel, so berechne diese;
+|* oder mit einem Feld, dann hole den Wert.
+|* Alle anderen Bedingungen returnen einen Fehler (oder 0 ?)
+|*
+|* Ersterstellung JP 30. Jun. 93
+|* Letzte Aenderung JP 30. Jun. 93
+|*
+|*************************************************************************/
+
+/*N*/ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const
+/*N*/ {
+/*N*/ double nRet = 0;
+/*N*/
+/*N*/ if( rCalcPara.rCalc.IsCalcError() )
+/*?*/ return nRet; // schon ein Fehler in der Berechnung
+/*N*/
+/*N*/ rCalcPara.rCalc.SetCalcError( CALC_SYNTAX ); // default immer Fehler
+/*N*/
+/*N*/ // keine Content Box ?
+/*N*/ if( !pSttNd )
+/*?*/ return nRet;
+/*N*/
+/*N*/ if( rCalcPara.IncStackCnt() )
+/*?*/ return nRet;
+/*N*/
+/*N*/ rCalcPara.SetLastTblBox( this );
+/*N*/
+/*N*/ // wird eine Rekursion erzeugt ?
+/*N*/ SwTableBox* pBox = (SwTableBox*)this;
+/*N*/ if( rCalcPara.pBoxStk->Seek_Entry( pBox ))
+/*?*/ return nRet; // steht schon auf dem Stack: FEHLER
+/*N*/
+/*N*/ // bei dieser Box nochmal aufsetzen
+/*N*/ rCalcPara.SetLastTblBox( this );
+/*N*/
+/*N*/ rCalcPara.pBoxStk->Insert( pBox ); // eintragen
+/*N*/ do { // Middle-Check-Loop, damit aus dieser gesprungen werden kann
+/*N*/ // hier aufgespannt, damit am Ende der Box-Pointer aus dem
+/*N*/ // Stack ausgetragen wird
+/*N*/ SwDoc* pDoc = GetFrmFmt()->GetDoc();
+/*N*/
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == GetFrmFmt()->GetItemState(
+/*N*/ RES_BOXATR_FORMULA, FALSE, &pItem ) )
+/*N*/ {
+/*?*/ rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // wieder zuruecksetzen
+/*?*/ if( !((SwTblBoxFormula*)pItem)->IsValid() )
+/*?*/ {
+/*?*/ // dann berechnen
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwTable* pTmp = rCalcPara.pTbl;
+/*?*/ }
+/*?*/ else
+/*?*/ nRet = GetFrmFmt()->GetTblBoxValue().GetValue();
+/*?*/ break;
+/*N*/ }
+/*N*/ else if( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+/*N*/ RES_BOXATR_VALUE, FALSE, &pItem ) )
+/*N*/ {
+/*?*/ rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // wieder zuruecksetzen
+/*?*/ nRet = ((SwTblBoxValue*)pItem)->GetValue();
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ SwTxtNode* pTxtNd = pDoc->GetNodes()[ pSttNd->GetIndex() + 1 ]->GetTxtNode();
+/*N*/ if( !pTxtNd )
+/*?*/ break;
+/*N*/
+/*N*/ xub_StrLen nSttPos = 0;
+/*N*/ const String& rTxt = pTxtNd->GetTxt();
+/*N*/ while( nSttPos < rTxt.Len() &&
+/*N*/ ( ' ' == rTxt.GetChar( nSttPos ) || '\t' == rTxt.GetChar( nSttPos ) ) )
+/*?*/ ++nSttPos;
+/*N*/
+/*N*/ // beginnt an erster Position ein "RechenFeld", dann erfrage den Wert
+/*N*/ // von diesem
+/*N*/ sal_Unicode cChr;
+/*N*/ if( nSttPos < rTxt.Len() &&
+/*N*/ ( CH_TXTATR_BREAKWORD == ( cChr = rTxt.GetChar(nSttPos)) ||
+/*N*/ CH_TXTATR_INWORD == cChr ))
+/*N*/ {
+/*N*/ SwIndex aIdx( pTxtNd, nSttPos );
+/*N*/ SwTxtFld* pTxtFld = pTxtNd->GetTxtFld( aIdx );
+/*N*/ if( !pTxtFld )
+/*?*/ break;
+/*N*/
+/*N*/ rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // wieder zuruecksetzen
+/*N*/
+/*N*/ const SwField* pFld = pTxtFld->GetFld().GetFld();
+/*N*/ switch( pFld->GetTyp()->Which() )
+/*N*/ {
+/*N*/ case RES_SETEXPFLD:
+/*?*/ nRet = ((SwSetExpField*)pFld)->GetValue();
+/*?*/ break;
+/*?*/ case RES_USERFLD:
+/*?*/ nRet = ((SwUserFieldType*)pFld)->GetValue();
+/*?*/ break;
+/*N*/ case RES_TABLEFLD:
+/*N*/ {
+/*N*/ SwTblField* pTblFld = (SwTblField*)pFld;
+/*N*/ if( !pTblFld->IsValid() ) // ist der Wert gueltig ??
+/*N*/ {
+/*N*/ // die richtige Tabelle mitgeben!
+/*N*/ const SwTable* pTmp = rCalcPara.pTbl;
+/*N*/ rCalcPara.pTbl = &pTxtNd->FindTableNode()->GetTable();
+/*N*/ pTblFld->CalcField( rCalcPara );
+/*N*/ rCalcPara.pTbl = pTmp;
+/*N*/ }
+/*N*/ nRet = pTblFld->GetValue();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DATETIMEFLD:
+/*?*/ nRet = ((SwDateTimeField*)pFld)->GetValue();
+/*?*/ break;
+/*?*/
+/*?*/ case RES_JUMPEDITFLD:
+/*?*/ //JP 14.09.98: Bug 56112 - der Platzhalter kann nie einen
+/*?*/ // gueltigen Inhalt haben!
+/*?*/ nRet = 0;
+/*?*/ break;
+/*?*/
+/*?*/ default:
+/*?*/ nRet = rCalcPara.rCalc.Calculate( pFld->Expand() ).GetDouble();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Ergebnis ist 0 und kein Fehler!
+/*N*/ rCalcPara.rCalc.SetCalcError( CALC_NOERR ); // wieder zuruecksetzen
+/*N*/
+/*N*/ double aNum;
+/*N*/ String sTxt( rTxt.Copy( nSttPos ) );
+/*N*/ sal_uInt32 nFmtIndex = GetFrmFmt()->GetTblBoxNumFmt().GetValue();
+/*N*/
+/*N*/ SvNumberFormatter* pNumFmtr = pDoc->GetNumberFormatter();
+/*N*/
+/*N*/ if( NUMBERFORMAT_TEXT == nFmtIndex )
+/*N*/ nFmtIndex = 0;
+/*N*/ // JP 22.04.98: Bug 49659 - Sonderbehandlung fuer Prozent
+/*?*/ else if( sTxt.Len() &&
+/*?*/ NUMBERFORMAT_PERCENT == pNumFmtr->GetType( nFmtIndex ))
+/*?*/ {
+/*?*/ sal_uInt32 nTmpFmt = 0;
+/*?*/ if( pNumFmtr->IsNumberFormat( sTxt, nTmpFmt, aNum ) &&
+/*?*/ NUMBERFORMAT_NUMBER == pNumFmtr->GetType( nTmpFmt ))
+/*?*/ sTxt += '%';
+/*?*/ }
+/*N*/
+/*N*/ if( pNumFmtr->IsNumberFormat( sTxt, nFmtIndex, aNum ))
+/*N*/ nRet = aNum;
+/*N*/ }
+/*N*/
+/*N*/ // ?? sonst ist das ein Fehler
+/*N*/ } while( FALSE );
+/*N*/
+/*N*/ if( !rCalcPara.IsStackOverFlow() )
+/*N*/ {
+/*N*/ rCalcPara.pBoxStk->Remove( pBox ); // raus aus dem Stack
+/*N*/ rCalcPara.DecStackCnt();
+/*N*/ }
+/*N*/
+/*N*/ //JP 12.01.99: mit Fehlererkennung, Bug 60794
+/*N*/ if( DBL_MAX == nRet )
+/*?*/ rCalcPara.rCalc.SetCalcError( CALC_SYNTAX ); // Fehler setzen
+/*N*/
+/*N*/ return nRet;
+/*N*/ }
+
+/* */
+
+// Struktur, die zum TabelleRechnen benoetigt wird
+
+/*N*/ SwTblCalcPara::SwTblCalcPara( SwCalc& rCalculator, const SwTable& rTable )
+/*N*/ : rCalc( rCalculator ), pTbl( &rTable ), nStackCnt( 0 ),
+/*N*/ nMaxSize( cMAXSTACKSIZE ), pLastTblBox( 0 )
+/*N*/ {
+/*N*/ pBoxStk = new SwTableSortBoxes;
+/*N*/ }
+
+/*N*/ SwTblCalcPara::~SwTblCalcPara()
+/*N*/ {
+/*N*/ delete pBoxStk;
+/*N*/ }
+
+
+/* */
+
+/*N*/ SwTableFormula::SwTableFormula( const String& rFormel )
+/*N*/ : sFormel( rFormel )
+/*N*/ {
+/*N*/ eNmType = EXTRNL_NAME;
+/*N*/ bValidValue = FALSE;
+/*N*/ }
+
+/*N*/ void SwTableFormula::_MakeFormel( const SwTable& rTbl, String& rNewStr,
+/*N*/ String& rFirstBox, String* pLastBox, void* pPara ) const
+/*N*/ {
+/*N*/ SwTblCalcPara* pCalcPara = (SwTblCalcPara*)pPara;
+/*N*/ if( pCalcPara->rCalc.IsCalcError() ) // ist schon Fehler gesetzt ?
+/*?*/ return;
+/*N*/
+/*N*/ SwTableBox* pSttBox, *pEndBox = 0;
+/*N*/
+/*N*/ rFirstBox.Erase(0,1); // Kennung fuer Box loeschen
+/*N*/ // ein Bereich in dieser Klammer ?
+/*N*/ if( pLastBox )
+/*N*/ {
+/*N*/ //TODOUNICODE: does it work?
+/*N*/ // pEndBox = (SwTableBox*)(long)(*pLastBox);
+/*N*/ pEndBox = (SwTableBox*)pLastBox->ToInt32();
+/*N*/
+/*N*/ // ist das ueberhaupt ein gueltiger Pointer ??
+/*N*/ if( !rTbl.GetTabSortBoxes().Seek_Entry( pEndBox ))
+/*?*/ pEndBox = 0;
+/*N*/ rFirstBox.Erase( 0, pLastBox->Len()+1 );
+/*N*/ }
+/*N*/ //TODOUNICODE: does it work?
+/*N*/ // pSttBox = (SwTableBox*)(long)rFirstBox;
+/*N*/ pSttBox = (SwTableBox*)rFirstBox.ToInt32();
+/*N*/ // ist das ueberhaupt ein gueltiger Pointer ??
+/*N*/ if( !rTbl.GetTabSortBoxes().Seek_Entry( pSttBox ))
+/*?*/ pSttBox = 0;
+/*N*/
+/*N*/ rNewStr += ' ';
+/*N*/ if( pEndBox && pSttBox ) // Bereich ?
+/*N*/ {
+/*N*/ // hole ueber das Layout alle "selectierten" Boxen und berechne
+/*N*/ // deren Werte
+/*N*/ SwSelBoxes aBoxes;
+/*N*/ GetBoxes( *pSttBox, *pEndBox, aBoxes );
+/*N*/
+/*N*/ rNewStr += '(';
+/*N*/ for( USHORT n = 0; n < aBoxes.Count() &&
+/*N*/ !pCalcPara->rCalc.IsCalcError(); ++n )
+/*N*/ {
+/*N*/ if( n )
+/*N*/ rNewStr += cListDelim;
+/*N*/ rNewStr += pCalcPara->rCalc.GetStrResult(
+/*N*/ aBoxes[n]->GetValue( *pCalcPara ), FALSE );
+/*N*/ }
+/*N*/ rNewStr += ')';
+/*N*/ }
+/*N*/ else if( pSttBox && !pLastBox ) // nur die StartBox ?
+/*N*/ //JP 12.01.99: und keine EndBox in der Formel!
+/*N*/ // Berechne den Wert der Box
+/*N*/ rNewStr += pCalcPara->rCalc.GetStrResult(
+/*N*/ pSttBox->GetValue( *pCalcPara ), FALSE );
+/*N*/ else
+/*?*/ pCalcPara->rCalc.SetCalcError( CALC_SYNTAX ); // Fehler setzen
+/*N*/ rNewStr += ' ';
+/*N*/ }
+
+/*N*/ void SwTableFormula::PtrToBoxNms( const SwTable& rTbl, String& rNewStr,
+/*N*/ String& rFirstBox, String* pLastBox, void* ) const
+/*N*/ {
+/*N*/ // ein Bereich in dieser Klammer ?
+/*N*/ SwTableBox* pBox;
+/*N*/
+/*N*/ rNewStr += rFirstBox.Copy(0,1); // Kennung fuer Box erhalten
+/*N*/ rFirstBox.Erase(0,1);
+/*N*/ if( pLastBox )
+/*N*/ {
+/*N*/ // pBox = (SwTableBox*)(long)(*pLastBox);
+/*N*/ pBox = (SwTableBox*)pLastBox->ToInt32();
+/*N*/
+/*N*/ // ist das ueberhaupt ein gueltiger Pointer ??
+/*N*/ if( rTbl.GetTabSortBoxes().Seek_Entry( pBox ))
+/*N*/ rNewStr += pBox->GetName();
+/*N*/ else
+/*N*/ rNewStr += '?';
+/*N*/ rNewStr += ':';
+/*N*/ rFirstBox.Erase( 0, pLastBox->Len()+1 );
+/*N*/ }
+/*N*/
+/*N*/ // pBox = (SwTableBox*)(long)rFirstBox;
+/*N*/ pBox = (SwTableBox*)rFirstBox.ToInt32();
+/*N*/ // ist das ueberhaupt ein gueltiger Pointer ??
+/*N*/ if( rTbl.GetTabSortBoxes().Seek_Entry( pBox ))
+/*N*/ rNewStr += pBox->GetName();
+/*N*/ else
+/*N*/ rNewStr += '?';
+/*N*/
+/*N*/ // Kennung fuer Box erhalten
+/*N*/ rNewStr += rFirstBox.GetChar( rFirstBox.Len() - 1 );
+/*N*/ }
+
+/*N*/ void SwTableFormula::BoxNmsToPtr( const SwTable& rTbl, String& rNewStr,
+/*N*/ String& rFirstBox, String* pLastBox, void* ) const
+/*N*/ {
+/*N*/ // ein Bereich in dieser Klammer ?
+/*N*/ const SwTableBox* pBox;
+/*N*/
+/*N*/ rNewStr += rFirstBox.Copy(0,1); // Kennung fuer Box erhalten
+/*N*/ rFirstBox.Erase(0,1);
+/*N*/ if( pLastBox )
+/*N*/ {
+/*N*/ pBox = rTbl.GetTblBox( *pLastBox );
+/*N*/ rNewStr += String::CreateFromInt32( (long)pBox );
+/*N*/ rNewStr += ':';
+/*N*/ rFirstBox.Erase( 0, pLastBox->Len()+1 );
+/*N*/ }
+/*N*/
+/*N*/ pBox = rTbl.GetTblBox( rFirstBox );
+/*N*/ rNewStr += String::CreateFromInt32( (long)pBox );
+/*N*/
+/*N*/ // Kennung fuer Box erhalten
+/*N*/ rNewStr += rFirstBox.GetChar( rFirstBox.Len() - 1 );
+/*N*/ }
+
+ // erzeuge die externe (fuer UI) Formel
+/*N*/ void SwTableFormula::PtrToBoxNm( const SwTable* pTbl )
+/*N*/ {
+/*N*/ const SwNode* pNd = 0;
+/*N*/ FnScanFormel fnFormel = 0;
+/*N*/ switch( eNmType)
+/*N*/ {
+/*N*/ case INTRNL_NAME:
+/*N*/ if( pTbl )
+/*N*/ fnFormel = &SwTableFormula::PtrToBoxNms;
+/*N*/ break;
+/*N*/ case REL_NAME:
+/*?*/ if( pTbl )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 fnFormel = &SwTableFormula::RelNmsToBoxNms;
+/*?*/ }
+/*?*/ break;
+/*N*/ case EXTRNL_NAME:
+/*N*/ return;
+/*N*/ }
+/*?*/ sFormel = ScanString( fnFormel, *pTbl, (void*)pNd );
+/*?*/ eNmType = EXTRNL_NAME;
+/*N*/ }
+
+ // erzeuge die interne (in CORE) Formel
+/*N*/ void SwTableFormula::BoxNmToPtr( const SwTable* pTbl )
+/*N*/ {
+/*N*/ const SwNode* pNd = 0;
+/*N*/ FnScanFormel fnFormel = 0;
+/*N*/ switch( eNmType)
+/*N*/ {
+/*N*/ case EXTRNL_NAME:
+/*?*/ if( pTbl )
+/*?*/ fnFormel = &SwTableFormula::BoxNmsToPtr;
+/*?*/ break;
+/*?*/ case REL_NAME:
+/*?*/ if( pTbl )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 fnFormel = &SwTableFormula::RelBoxNmsToPtr;
+/*?*/ }
+/*?*/ break;
+/*?*/ case INTRNL_NAME:
+/*?*/ return;
+/*N*/ }
+/*N*/ sFormel = ScanString( fnFormel, *pTbl, (void*)pNd );
+/*N*/ eNmType = INTRNL_NAME;
+/*N*/ }
+
+/*N*/ String SwTableFormula::ScanString( FnScanFormel fnFormel, const SwTable& rTbl,
+/*N*/ void* pPara ) const
+/*N*/ {
+/*N*/ String aStr;
+/*N*/ USHORT nFml = 0, nStt = 0, nEnd = 0, nTrenner;
+/*N*/
+/*N*/ do {
+/*N*/ // falls der Formel ein Name vorangestellt ist, diese Tabelle
+/*N*/ // benutzen !!
+/*N*/ const SwTable* pTbl = &rTbl;
+/*N*/
+/*N*/ nStt = sFormel.Search( '<', nFml );
+/*N*/ if( STRING_NOTFOUND != nStt )
+/*N*/ {
+/*N*/ while( STRING_NOTFOUND != nStt &&
+/*N*/ ( ' ' == sFormel.GetChar( nStt + 1 ) ||
+/*N*/ '=' == sFormel.GetChar( nStt + 1 ) ) )
+/*?*/ nStt = sFormel.Search( '<', nStt + 1 );
+/*N*/
+/*N*/ if( STRING_NOTFOUND != nStt )
+/*N*/ nEnd = sFormel.Search( '>', nStt+1 );
+/*N*/ }
+/*N*/ if( STRING_NOTFOUND == nStt || STRING_NOTFOUND == nEnd )
+/*N*/ {
+/*N*/ // den Rest setzen und beenden
+/*N*/ aStr.Insert( sFormel, nFml, sFormel.Len() - nFml );
+/*N*/ break;
+/*N*/ }
+/*N*/ aStr.Insert( sFormel, nFml, nStt - nFml ); // Anfang schreiben
+/*N*/
+/*N*/ if( fnFormel != NULL )
+/*N*/ {
+/*N*/ // ist ein TabellenName vorangestellt ??
+/*N*/ // JP 16.02.99: SplitMergeBoxNm behandeln den Namen selbst
+/*N*/ // JP 22.02.99: der CAST muss fuer den Linux-Compiler sein
+/*N*/ // JP 28.06.99: rel. BoxName have no preceding tablename!
+/*N*/ if( fnFormel != (FnScanFormel)&SwTableFormula::_SplitMergeBoxNm &&
+/*N*/ 1 < sFormel.Len() && cRelKennung != sFormel.GetChar( 1 ) &&
+/*N*/ STRING_NOTFOUND != ( nTrenner = sFormel.Search( '.', nStt ))
+/*N*/ && nTrenner < nEnd )
+/*N*/ {
+/*?*/ String sTblNm( sFormel.Copy( nStt, nEnd - nStt ));
+/*?*/
+/*?*/ // falls im Namen schon die Punkte enthalten sind,
+/*?*/ // treten diese immer paarig auf!!! (A1.1.1 !!)
+/*?*/ if( (sTblNm.GetTokenCount( '.' ) - 1 ) & 1 )
+/*?*/ {
+/*?*/ sTblNm.Erase( nTrenner - nStt );
+/*?*/
+/*?*/ // beim Bauen der Formel ist der TabellenName unerwuenscht
+/*?*/ //JP 22.02.99: der CAST muss fuer den Linux-Compiler sein
+/*?*/ if( fnFormel != (FnScanFormel)&SwTableFormula::_MakeFormel )
+/*?*/ aStr += sTblNm;
+/*?*/ nStt = nTrenner;
+/*?*/
+/*?*/ sTblNm.Erase( 0, 1 ); // Trenner loeschen
+/*?*/ if( sTblNm != rTbl.GetFrmFmt()->GetName() )
+/*?*/ {
+/*?*/ // dann suchen wir uns mal unsere Tabelle:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwTable* pFnd = FindTable(
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ String sBox( sFormel.Copy( nStt, nEnd - nStt + 1 ));
+/*N*/ // ein Bereich in dieser Klammer ?
+/*N*/ if( STRING_NOTFOUND != ( nTrenner = sFormel.Search( ':', nStt ))
+/*N*/ && nTrenner < nEnd )
+/*N*/ {
+/*N*/ // ohne die Anfangsklammer
+/*N*/ String aFirstBox( sFormel.Copy( nStt+1, nTrenner - nStt - 1 ));
+/*N*/ (this->*fnFormel)( *pTbl, aStr, sBox, &aFirstBox, pPara );
+/*N*/ }
+/*N*/ else
+/*N*/ (this->*fnFormel)( *pTbl, aStr, sBox, 0, pPara );
+/*N*/ }
+/*N*/
+/*N*/ nFml = nEnd+1;
+/*N*/ } while( TRUE );
+/*N*/ return aStr;
+/*N*/ }
+
+
+/* */
+
+/*N*/ const SwFrm* lcl_GetBoxFrm( const SwTableBox& rBox )
+/*N*/ {
+/*
+
+ // oder besser ueber die Box den Frame suchen
+
+ SwClientIter aIter( *pBox->GetFrmFmt() );
+ ULONG nMinPos = ULONG_MAX;
+ const SwFrm* pFnd = 0;
+ for( SwFrm* pF = (SwFrm*)aIter.First( TYPE( SwCellFrm )); pF;
+ pF = (SwFrm*)aIter.Next() )
+ {
+ if( pF->Frm().Y() <
+ }
+*/
+/*N*/
+/*N*/ SwNodeIndex aIdx( *rBox.GetSttNd() );
+/*N*/ SwCntntNode* pCNd = aIdx.GetNodes().GoNext( &aIdx );
+/*N*/ ASSERT( pCNd, "Box hat keinen TextNode" );
+/*N*/ Point aPt; // den im Layout 1. Frame returnen - Tab.Kopfzeile !!
+/*N*/ return pCNd->GetFrm( &aPt, NULL, FALSE );
+/*N*/ }
+
+/*N*/ void SwTableFormula::GetBoxes( const SwTableBox& rSttBox,
+/*N*/ const SwTableBox& rEndBox,
+/*N*/ SwSelBoxes& rBoxes ) const
+/*N*/ {
+/*N*/ // hole ueber das Layout alle "selektierten" Boxen
+/*N*/ const SwLayoutFrm *pStt, *pEnd;
+/*N*/ const SwFrm* pFrm = lcl_GetBoxFrm( rSttBox );
+/*N*/ pStt = pFrm ? pFrm->GetUpper() : 0;
+/*N*/ pEnd = ( 0 != (pFrm = lcl_GetBoxFrm( rEndBox ))) ? pFrm->GetUpper() : 0;
+/*N*/ if( !pStt || !pEnd )
+/*?*/ return ; // no valid selection
+/*N*/
+/*N*/ GetTblSel( pStt, pEnd, rBoxes );
+/*N*/
+/*N*/ const SwTable* pTbl = pStt->FindTabFrm()->GetTable();
+/*N*/
+/*N*/ // filter die Kopfzeilen-Boxen heraus:
+/*N*/ if( pTbl->IsHeadlineRepeat() )
+/*N*/ do { // middle-check loop
+/*N*/ const SwTableLine* pHeadLine = pTbl->GetTabLines()[0];
+/*N*/ const SwTableLine* pLine = rSttBox.GetUpper();
+/*N*/ while( pLine->GetUpper() )
+/*?*/ pLine = pLine->GetUpper()->GetUpper();
+/*N*/
+/*N*/ if( pLine == pHeadLine )
+/*?*/ break; // Headline mit im Bereich !
+/*N*/ // vielleicht ist ja Start und Ende vertauscht
+/*N*/ pLine = rEndBox.GetUpper();
+/*N*/ while ( pLine->GetUpper() )
+/*?*/ pLine = pLine->GetUpper()->GetUpper();
+/*N*/ if( pLine == pHeadLine )
+/*?*/ break; // Headline mit im Bereich !
+/*N*/
+/*N*/ const SwTabFrm *pTable = pStt->FindTabFrm();
+/*N*/ const SwTabFrm *pEndTable = pEnd->FindTabFrm();
+/*N*/ if( pTable == pEndTable ) // keine gespl. Tabelle
+/*N*/ break;
+/*N*/
+/*N*/ // dann mal die Tabellenkoepfe raus:
+/*?*/ for( USHORT n = 0; n < rBoxes.Count(); ++n )
+/*?*/ {
+/*?*/ while( (pLine = rBoxes[n]->GetUpper())->GetUpper() )
+/*?*/ pLine = pLine->GetUpper()->GetUpper();
+/*?*/
+/*?*/ if( pLine == pHeadLine )
+/*?*/ rBoxes.Remove( n--, 1 );
+/*?*/ }
+/*?*/ } while( FALSE );
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_chpfld.cxx b/binfilter/bf_sw/source/core/fields/sw_chpfld.cxx
new file mode 100644
index 000000000000..9142e48538c5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_chpfld.cxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/text/ChapterFormat.hpp>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <frame.hxx> // SwChapterFieldType::ChangeExpansion()
+#include <ndtxt.hxx>
+#include <chpfld.hxx>
+#include <expfld.hxx> // fuer GetBodyTxtNode
+#include <unofldmid.h>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwChapterFieldType
+ --------------------------------------------------------------------*/
+
+
+/*N*/ SwChapterFieldType::SwChapterFieldType()
+/*N*/ : SwFieldType( RES_CHAPTERFLD )
+/*N*/ {
+/*N*/ }
+
+
+SwFieldType* SwChapterFieldType::Copy() const
+{
+ return new SwChapterFieldType();
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Kapittelfeld
+ --------------------------------------------------------------------*/
+
+
+/*N*/ SwChapterField::SwChapterField(SwChapterFieldType* pTyp, sal_uInt32 nFmt)
+/*N*/ : SwField(pTyp, nFmt), nLevel( 0 )
+/*N*/ {}
+
+
+/*N*/ String SwChapterField::Expand() const
+/*N*/ {
+/*N*/ String sStr( sNumber );
+/*N*/ switch( GetFormat() )
+/*N*/ {
+/*N*/ case CF_TITLE: sStr = sTitle; break;
+/*N*/
+/*N*/ case CF_NUMBER:
+/*N*/ case CF_NUM_TITLE: sStr.Insert( sPre, 0 );
+/*N*/ sStr += sPost;
+/*N*/ if( CF_NUM_TITLE == GetFormat() )
+/*N*/ sStr += sTitle;
+/*N*/ break;
+/*N*/
+/*?*/ case CF_NUM_NOPREPST_TITLE: sStr += sTitle; break;
+/*N*/ }
+/*N*/ return sStr;
+/*N*/ }
+
+
+/*N*/ SwField* SwChapterField::Copy() const
+/*N*/ {
+/*N*/ SwChapterField *pTmp =
+/*N*/ new SwChapterField((SwChapterFieldType*)GetTyp(), GetFormat());
+/*N*/ pTmp->nLevel = nLevel;
+/*N*/ pTmp->sTitle = sTitle;
+/*N*/ pTmp->sNumber = sNumber;
+/*N*/ pTmp->sPost = sPost;
+/*N*/ pTmp->sPre = sPre;
+/*N*/
+/*N*/ return pTmp;
+/*N*/ }
+
+
+/*N*/ void SwChapterField::ChangeExpansion( const SwFrm* pFrm,
+/*N*/ const SwTxtNode* pTxtNd,
+/*N*/ sal_Bool bSrchNum )
+/*N*/ {
+/*N*/ ASSERT( pFrm, "in welchem Frame stehe ich denn?" )
+/*N*/ SwDoc* pDoc = (SwDoc*)pTxtNd->GetDoc();
+/*N*/ SwPosition aPos( pDoc->GetNodes().GetEndOfContent() );
+/*N*/
+/*N*/ if( pFrm->IsInDocBody() )
+/*N*/ aPos.nNode = *pTxtNd;
+/*N*/ else if( 0 == (pTxtNd = GetBodyTxtNode( *pDoc, aPos, *pFrm )) )
+/*N*/ // kein TxtNode (Formatierung Kopf/Fusszeile)
+/*?*/ return;
+/*N*/
+/*N*/ ASSERT( pTxtNd, "Wo steht das Feld" );
+/*N*/ pTxtNd = pTxtNd->FindOutlineNodeOfLevel( nLevel );
+/*N*/ if( pTxtNd )
+/*N*/ {
+/*N*/ if( bSrchNum )
+/*N*/ {
+/*N*/ const SwTxtNode* pONd = pTxtNd;
+/*N*/ do {
+/*N*/ if( pONd && pONd->GetTxtColl() )
+/*N*/ {
+/*N*/ BYTE nPrevLvl = nLevel;
+/*N*/ nLevel = GetRealLevel( pONd->GetTxtColl()->
+/*N*/ GetOutlineLevel() );
+/*N*/ if( nPrevLvl < nLevel )
+/*?*/ nLevel = nPrevLvl;
+/*N*/ else if( SVX_NUM_NUMBER_NONE != pDoc->GetOutlineNumRule()
+/*N*/ ->Get( nLevel ).GetNumberingType() )
+/*N*/ {
+/*?*/ pTxtNd = pONd;
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( !nLevel-- )
+/*N*/ break;
+/*N*/ pONd = pTxtNd->FindOutlineNodeOfLevel( nLevel );
+/*N*/ }
+/*N*/ else
+/*?*/ break;
+/*N*/ } while( sal_True );
+/*N*/ }
+/*N*/
+/*N*/ const SwNodeNum& rNum = *pTxtNd->GetOutlineNum();
+/*N*/ // nur die Nummer besorgen, ohne Pre-/Post-fixstrings
+/*N*/ sNumber = pDoc->GetOutlineNumRule()->MakeNumString( rNum, sal_False );
+/*N*/
+/*N*/ if( NO_NUM > rNum.GetLevel() && !( NO_NUMLEVEL & rNum.GetLevel() ) )
+/*N*/ {
+/*N*/ const SwNumFmt& rNFmt = pDoc->GetOutlineNumRule()->Get( rNum.GetLevel() );
+/*N*/ sPost = rNFmt.GetSuffix();
+/*N*/ sPre = rNFmt.GetPrefix();
+/*N*/ }
+/*N*/ else
+/*?*/ sPost = aEmptyStr, sPre = aEmptyStr;
+/*N*/
+/*N*/ sTitle = pTxtNd->GetExpandTxt();
+/*N*/
+/*N*/ for( xub_StrLen i = 0; i < sTitle.Len(); ++i )
+/*N*/ if( ' ' > sTitle.GetChar( i ) )
+/*?*/ sTitle.Erase( i--, 1 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ sNumber = aEmptyStr;
+/*?*/ sTitle = aEmptyStr;
+/*?*/ sPost = aEmptyStr;
+/*?*/ sPre = aEmptyStr;
+/*N*/ }
+/*N*/ }
+
+/*-----------------05.03.98 16:19-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwChapterField::QueryValue( ::com::sun::star::uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BYTE1:
+/*N*/ rAny <<= (sal_Int8)nLevel;
+/*N*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ {
+/*N*/ sal_Int16 nRet;
+/*N*/ switch( GetFormat() )
+/*N*/ {
+/*N*/ case CF_NUMBER: nRet = text::ChapterFormat::NUMBER; break;
+/*N*/ case CF_TITLE: nRet = text::ChapterFormat::NAME; break;
+/*N*/ case CF_NUMBER_NOPREPST:
+/*N*/ nRet = text::ChapterFormat::DIGIT;
+/*N*/ break;
+/*N*/ case CF_NUM_NOPREPST_TITLE:
+/*?*/ nRet = text::ChapterFormat::NO_PREFIX_SUFFIX;
+/*?*/ break;
+/*N*/ case CF_NUM_TITLE:
+/*N*/ default: nRet = text::ChapterFormat::NAME_NUMBER;
+/*N*/ }
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 16:19-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwChapterField::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BYTE1:
+/*?*/ sal_Int8 nTmp;
+/*?*/ rAny >>= nTmp;
+/*?*/ if(nTmp >= 0 && nTmp < MAXLEVEL)
+/*?*/ nLevel = nTmp;
+/*?*/ else
+/*?*/ bRet = FALSE;
+/*?*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ {
+/*N*/ sal_Int16 nVal;
+/*N*/ rAny >>= nVal;
+/*N*/ switch( nVal )
+/*N*/ {
+/*N*/ case text::ChapterFormat::NAME: SetFormat(CF_TITLE); break;
+/*N*/ case text::ChapterFormat::NUMBER: SetFormat(CF_NUMBER); break;
+/*N*/ case text::ChapterFormat::NO_PREFIX_SUFFIX:
+/*?*/ SetFormat(CF_NUM_NOPREPST_TITLE);
+/*?*/ break;
+/*N*/ case text::ChapterFormat::DIGIT:
+/*N*/ SetFormat(CF_NUMBER_NOPREPST);
+/*N*/ break;
+/*N*/ //case text::ChapterFormat::NAME_NUMBER:
+/*N*/ default: SetFormat(CF_NUM_TITLE);
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*?*/ bRet = FALSE;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_dbfld.cxx b/binfilter/bf_sw/source/core/fields/sw_dbfld.cxx
new file mode 100644
index 000000000000..435500cfddf2
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_dbfld.cxx
@@ -0,0 +1,996 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <float.h>
+
+#include <bf_svx/pageitem.hxx>
+#include <unotools/transliterationwrapper.hxx>
+
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+
+#include <horiornt.hxx>
+
+#include <docary.hxx>
+#include <ndtxt.hxx>
+#include <dbfld.hxx>
+#include <dbmgr.hxx>
+#include <docfld.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbanktrenner durch Punkte fuer Anzeige ersetzen
+ --------------------------------------------------------------------*/
+
+/*N*/ String lcl_DBTrennConv(const String& aContent)
+/*N*/ {
+/*N*/ String sTmp(aContent);
+/*N*/ sal_Unicode* pStr = sTmp.GetBufferAccess();
+/*N*/ for( USHORT i = sTmp.Len(); i; --i, ++pStr )
+/*N*/ if( DB_DELIM == *pStr )
+/*N*/ *pStr = '.';
+/*N*/ return sTmp;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: DatenbankFeldTyp
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBFieldType::SwDBFieldType(SwDoc* pDocPtr, const String& rNam, const SwDBData& rDBData ) :
+/*N*/ SwValueFieldType( pDocPtr, RES_DBFLD ),
+/*N*/ aDBData(rDBData),
+/*N*/ nRefCnt(0),
+/*N*/ sColumn(rNam)
+/*N*/ {
+/*N*/ if(aDBData.sDataSource.getLength() || aDBData.sCommand.getLength())
+/*N*/ {
+/*N*/ sName = aDBData.sDataSource;
+/*N*/ sName += DB_DELIM;
+/*N*/ sName += (String)aDBData.sCommand;
+/*N*/ sName += DB_DELIM;
+/*N*/ }
+/*N*/ sName += GetColumnName();
+/*N*/ }
+//------------------------------------------------------------------------------
+
+/*N*/ SwFieldType* SwDBFieldType::Copy() const
+/*N*/ {
+/*N*/ SwDBFieldType* pTmp = new SwDBFieldType(GetDoc(), sColumn, aDBData);
+/*N*/ return pTmp;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+/*N*/ const String& SwDBFieldType::GetName() const
+/*N*/ {
+/*N*/ return sName;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ void SwDBFieldType::ReleaseRef()
+/*N*/ {
+/*N*/ ASSERT(nRefCnt > 0, "RefCount kleiner 0!");
+/*N*/
+/*N*/ if (--nRefCnt <= 0)
+/*N*/ {
+/*N*/ USHORT nPos = GetDoc()->GetFldTypes()->GetPos(this);
+/*N*/
+/*N*/ if (nPos != USHRT_MAX)
+/*N*/ {
+/*N*/ GetDoc()->RemoveFldType(nPos);
+/*N*/ delete this;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/* -----------------24.02.99 14:51-------------------
+ *
+ * --------------------------------------------------*/
+/*N*/ BOOL SwDBFieldType::QueryValue( ::com::sun::star::uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ rAny <<= aDBData.sDataSource;
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR4:
+/*N*/ rAny <<= aDBData.sCommand;
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ rAny <<= OUString(sColumn);
+/*N*/ break;
+/*N*/ case FIELD_PROP_SHORT1:
+/*N*/ rAny <<= aDBData.nCommandType;
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/* -----------------24.02.99 14:51-------------------
+ *
+ * --------------------------------------------------*/
+/*N*/ BOOL SwDBFieldType::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR2:
+/*?*/ rAny >>= aDBData.sDataSource;
+/*?*/ break;
+/*?*/ case FIELD_PROP_PAR4:
+/*?*/ rAny >>= aDBData.sCommand;
+/*?*/ break;
+/*?*/ case FIELD_PROP_PAR1:
+/*?*/ {
+/*?*/ String sTmp;
+/*?*/ ::binfilter::GetString( rAny, sTmp );
+/*?*/ if( sTmp != sColumn )
+/*?*/ {
+/*?*/ sColumn = sTmp;
+/*?*/ SwClientIter aIter( *this );
+/*?*/ SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+/*?*/ while(pFld)
+/*?*/ {
+/*?*/ // Feld im Undo?
+/*?*/ SwTxtFld *pTxtFld = pFld->GetTxtFld();
+/*?*/ if(pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+/*?*/ {
+/*?*/ SwDBField* pDBField = (SwDBField*)pFld->GetFld();
+/*?*/ pDBField->ClearInitialized();
+/*?*/ pDBField->InitContent();
+/*?*/ }
+/*?*/ pFld = (SwFmtFld*)aIter.Next();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*N*/ case FIELD_PROP_SHORT1:
+/*N*/ rAny >>= aDBData.nCommandType;
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: SwDBField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBField::SwDBField(SwDBFieldType* pTyp, ULONG nFmt)
+/*N*/ : SwValueField(pTyp, nFmt),
+/*N*/ bValidValue(FALSE),
+/*N*/ bIsInBodyTxt(TRUE),
+/*N*/ bInitialized(FALSE),
+/*N*/ nSubType(0)
+/*N*/ {
+/*N*/ if (GetTyp())
+/*N*/ ((SwDBFieldType*)GetTyp())->AddRef();
+/*N*/ InitContent();
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwDBField::~SwDBField()
+/*N*/ {
+/*N*/ if (GetTyp())
+/*N*/ ((SwDBFieldType*)GetTyp())->ReleaseRef();
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ void SwDBField::InitContent()
+/*N*/ {
+/*N*/ if (!IsInitialized())
+/*N*/ {
+/*N*/ aContent = '<';
+/*N*/ aContent += ((SwDBFieldType*)GetTyp())->GetColumnName();
+/*N*/ aContent += '>';
+/*N*/ }
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ void SwDBField::InitContent(const String& rExpansion)
+/*N*/ {
+/*N*/ if (rExpansion.Len() > 2)
+/*N*/ {
+/*N*/ if (rExpansion.GetChar(0) == '<' &&
+/*N*/ rExpansion.GetChar(rExpansion.Len() - 1) == '>')
+/*N*/ {
+/*N*/ String sColumn( rExpansion.Copy( 1, rExpansion.Len() - 2 ) );
+/*N*/ if( ::binfilter::GetAppCmpStrIgnore().isEqual( sColumn,
+/*N*/ ((SwDBFieldType *)GetTyp())->GetColumnName() ))
+/*N*/ {
+/*N*/ InitContent();
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ SetExpansion( rExpansion );
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwDBField::GetOldContent()
+/*N*/ {
+/*N*/ String sOldExpand = Expand();
+/*N*/ String sNewExpand = sOldExpand;
+/*N*/ BOOL bOldInit = bInitialized;
+/*N*/
+/*N*/ bInitialized = FALSE;
+/*N*/ InitContent();
+/*N*/ bInitialized = bOldInit;
+/*N*/
+/*N*/ if( ::binfilter::GetAppCmpStrIgnore().isEqual( sNewExpand, Expand() ) )
+/*N*/ {
+/*N*/ sNewExpand = '<';
+/*N*/ sNewExpand += ((SwDBFieldType *)GetTyp())->GetColumnName();
+/*N*/ sNewExpand += '>';
+/*N*/ }
+/*N*/ SetExpansion( sOldExpand );
+/*N*/
+/*N*/ return sNewExpand;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwDBField::Expand() const
+/*N*/ {
+/*N*/ String sRet;
+/*N*/ if(0 ==(GetSubType() & SUB_INVISIBLE))
+/*N*/ sRet = lcl_DBTrennConv(aContent);
+/*N*/ return sRet;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwField* SwDBField::Copy() const
+/*N*/ {
+/*N*/ SwDBField *pTmp = new SwDBField((SwDBFieldType*)GetTyp(), GetFormat());
+/*N*/ pTmp->aContent = aContent;
+/*N*/ pTmp->bIsInBodyTxt = bIsInBodyTxt;
+/*N*/ pTmp->bValidValue = bValidValue;
+/*N*/ pTmp->bInitialized = bInitialized;
+/*N*/ pTmp->nSubType = nSubType;
+/*N*/ pTmp->SetValue(GetValue());
+/*N*/
+/*N*/ return pTmp;
+/*N*/ }
+
+
+//------------------------------------------------------------------------------
+
+void SwDBField::ChgValue( double d, BOOL bVal )
+{
+ bValidValue = bVal;
+ SetValue(d);
+
+ if( bValidValue )
+ aContent = ((SwValueFieldType*)GetTyp())->ExpandValue(d, GetFormat(), GetLanguage());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFieldType* SwDBField::ChgTyp( SwFieldType* pNewType )
+{
+ SwFieldType* pOld = SwValueField::ChgTyp( pNewType );
+
+ ((SwDBFieldType*)pNewType)->AddRef();
+ ((SwDBFieldType*)pOld)->ReleaseRef();
+
+ return pOld;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuellen Field-Value holen und chachen
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDBField::Evaluate()
+ /*N*/ { DBG_ERROR("STRIP");
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Namen erfragen
+ --------------------------------------------------------------------*/
+
+const String& SwDBField::GetPar1() const
+{
+ return ((SwDBFieldType*)GetTyp())->GetName();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ USHORT SwDBField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDBField::SetSubType(USHORT nType)
+/*N*/ {
+/*N*/ nSubType = nType;
+/*N*/ }
+
+/*-----------------06.03.98 16:15-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDBField::QueryValue( ::com::sun::star::uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ BOOL bTemp = 0 == (GetSubType()&SUB_OWN_FMT);
+/*N*/ rAny.setValue(&bTemp, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ sal_Bool bVal = 0 == (GetSubType() & SUB_INVISIBLE);
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int32)GetFormat();
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ rAny <<= OUString(aContent);
+/*?*/ break;
+/*?*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/
+/*N*/ }
+/*-----------------06.03.98 16:15-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDBField::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ if( *(sal_Bool*)rAny.getValue() )
+/*N*/ SetSubType(GetSubType()&~SUB_OWN_FMT);
+/*N*/ else
+/*N*/ SetSubType(GetSubType()|SUB_OWN_FMT);
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ USHORT nSubType = GetSubType();
+/*N*/ sal_Bool bVisible;
+/*N*/ if(!(rAny >>= bVisible))
+/*N*/ return FALSE;
+/*N*/ if(bVisible)
+/*N*/ nSubType &= ~SUB_INVISIBLE;
+/*N*/ else
+/*N*/ nSubType |= SUB_INVISIBLE;
+/*N*/ SetSubType(nSubType);
+/*N*/ //invalidate text node
+/*N*/ if(GetTyp())
+/*N*/ {
+/*N*/ SwClientIter aIter( *GetTyp() );
+/*N*/ SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+/*N*/ while(pFld)
+/*N*/ {
+/*N*/ SwTxtFld *pTxtFld = pFld->GetTxtFld();
+/*N*/ if(pTxtFld && (SwDBField*)pFld->GetFld() == this )
+/*N*/ {
+/*N*/ //notify the change
+/*N*/ pTxtFld->NotifyContentChange(*pFld);
+/*N*/ break;
+/*N*/ }
+/*N*/ pFld = (SwFmtFld*)aIter.Next();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ {
+/*N*/ sal_Int32 nTemp;
+/*N*/ rAny >>= nTemp;
+/*N*/ SetFormat(nTemp);
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ ::binfilter::GetString( rAny, aContent );
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Basisklasse fuer alle weiteren Datenbankfelder
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBNameInfField::SwDBNameInfField(SwFieldType* pTyp, const SwDBData& rDBData, ULONG nFmt) :
+/*N*/ SwField(pTyp, nFmt),
+/*N*/ aDBData(rDBData),
+/*N*/ nSubType(0)
+/*N*/ {
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwDBData SwDBNameInfField::GetDBData(SwDoc* pDoc)
+/*N*/ {
+/*N*/ SwDBData aRet;
+/*N*/ if(aDBData.sDataSource.getLength())
+/*N*/ aRet = aDBData;
+/*N*/ else
+/*N*/ aRet = pDoc->GetDBData();
+/*N*/ return aRet;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*-----------------06.03.98 16:55-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDBNameInfField::QueryValue( ::com::sun::star::uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ rAny <<= aDBData.sDataSource;
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ rAny <<= aDBData.sCommand;
+/*N*/ break;
+/*N*/ case FIELD_PROP_SHORT1:
+/*N*/ rAny <<= aDBData.nCommandType;
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ sal_Bool bVal = 0 == (GetSubType() & SUB_INVISIBLE);
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*-----------------06.03.98 16:55-------------------
+
+--------------------------------------------------*/
+BOOL SwDBNameInfField::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ rAny >>= aDBData.sDataSource;
+ break;
+ case FIELD_PROP_PAR2:
+ rAny >>= aDBData.sCommand;
+ break;
+ case FIELD_PROP_SHORT1:
+ rAny >>= aDBData.nCommandType;
+ break;
+ case FIELD_PROP_BOOL2:
+ {
+ USHORT nSubType = GetSubType();
+ sal_Bool bVisible;
+ if(!(rAny >>= bVisible))
+ return FALSE;
+ if(bVisible)
+ nSubType &= ~SUB_INVISIBLE;
+ else
+ nSubType |= SUB_INVISIBLE;
+ SetSubType(nSubType);
+ }
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return TRUE;
+}
+/* -----------------4/10/2003 15:03------------------
+
+ --------------------------------------------------*/
+/*N*/ USHORT SwDBNameInfField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+/* -----------------4/10/2003 15:03------------------
+
+ --------------------------------------------------*/
+/*N*/ void SwDBNameInfField::SetSubType(USHORT nType)
+/*N*/ {
+/*N*/ nSubType = nType;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: NaechsterDatensatz
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBNextSetFieldType::SwDBNextSetFieldType()
+/*N*/ : SwFieldType( RES_DBNEXTSETFLD )
+/*N*/ {
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwFieldType* SwDBNextSetFieldType::Copy() const
+/*N*/ {
+ SwDBNextSetFieldType* pTmp = new SwDBNextSetFieldType();
+ return pTmp;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: SwDBSetField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBNextSetField::SwDBNextSetField(SwDBNextSetFieldType* pTyp,
+/*N*/ const String& rCond,
+/*N*/ const String& rDummy,
+/*N*/ const SwDBData& rDBData) :
+/*N*/ SwDBNameInfField(pTyp, rDBData), aCond(rCond), bCondValid(TRUE)
+/*N*/ {}
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwDBNextSetField::Expand() const
+/*N*/ {
+/*N*/ return aEmptyStr;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwField* SwDBNextSetField::Copy() const
+/*N*/ {
+/*N*/ SwDBNextSetField *pTmp = new SwDBNextSetField((SwDBNextSetFieldType*)GetTyp(),
+/*N*/ aCond, aEmptyStr, GetDBData());
+/*N*/ pTmp->SetSubType(GetSubType());
+/*N*/ pTmp->bCondValid = bCondValid;
+/*N*/ return pTmp;
+/*N*/ }
+//------------------------------------------------------------------------------
+
+/*N*/ void SwDBNextSetField::Evaluate(SwDoc* pDoc)
+/*N*/ {
+/*N*/ SwNewDBMgr* pMgr = pDoc->GetNewDBMgr();
+/*N*/ const SwDBData& rData = GetDBData();
+/*N*/ if( !bCondValid ||
+/*N*/ !pMgr || !pMgr->IsDataSourceOpen(rData.sDataSource, rData.sCommand, sal_False))
+/*N*/ return ;
+/*N*/ pMgr->ToNextRecord(rData.sDataSource, rData.sCommand);
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bedingung
+ --------------------------------------------------------------------*/
+
+/*N*/ const String& SwDBNextSetField::GetPar1() const
+/*N*/ {
+/*N*/ return aCond;
+/*N*/ }
+
+void SwDBNextSetField::SetPar1(const String& rStr)
+{
+ aCond = rStr;
+}
+/*-----------------06.03.98 16:16-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDBNextSetField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ BOOL bRet = TRUE;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR3:
+/*N*/ rAny <<= OUString(aCond);
+/*N*/ break;
+/*N*/ default:
+/*N*/ bRet = SwDBNameInfField::QueryValue( rAny, nMId );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*-----------------06.03.98 16:16-------------------
+
+--------------------------------------------------*/
+BOOL SwDBNextSetField::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ BOOL bRet = TRUE;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR3:
+ ::binfilter::GetString( rAny, aCond );
+ break;
+ default:
+ bRet = SwDBNameInfField::PutValue( rAny, nMId );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+/*
+String SwDBNextSetField::GetPar2() const
+{
+ return GetDBName();
+}
+
+void SwDBNextSetField::SetPar2(const String& rStr)
+{
+ GetDBName() = rStr;
+}
+*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datensatz mit bestimmter ID
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBNumSetFieldType::SwDBNumSetFieldType() :
+/*N*/ SwFieldType( RES_DBNUMSETFLD )
+/*N*/ {
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwFieldType* SwDBNumSetFieldType::Copy() const
+/*N*/ {
+ SwDBNumSetFieldType* pTmp = new SwDBNumSetFieldType();
+ return pTmp;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwDBSetField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBNumSetField::SwDBNumSetField(SwDBNumSetFieldType* pTyp,
+/*N*/ const String& rCond,
+/*N*/ const String& rDBNum,
+/*N*/ const SwDBData& rDBData) :
+/*N*/ SwDBNameInfField(pTyp, rDBData),
+/*N*/ aCond(rCond),
+/*N*/ aPar2(rDBNum),
+/*N*/ bCondValid(TRUE)
+/*N*/ {}
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwDBNumSetField::Expand() const
+/*N*/ {
+/*N*/ return aEmptyStr;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwField* SwDBNumSetField::Copy() const
+/*N*/ {
+/*N*/ SwDBNumSetField *pTmp = new SwDBNumSetField((SwDBNumSetFieldType*)GetTyp(),
+/*N*/ aCond, aPar2, GetDBData());
+/*N*/ pTmp->bCondValid = bCondValid;
+/*N*/ pTmp->SetSubType(GetSubType());
+/*N*/ return pTmp;
+/*N*/ }
+
+/*N*/ void SwDBNumSetField::Evaluate(SwDoc* pDoc)
+/*N*/ {
+/*N*/ SwNewDBMgr* pMgr = pDoc->GetNewDBMgr();
+/*N*/ const SwDBData& aTmpData = GetDBData();
+/*N*/
+/*N*/ if( bCondValid && pMgr && pMgr->IsInMerge() &&
+/*N*/ pMgr->IsDataSourceOpen(aTmpData.sDataSource, aTmpData.sCommand, sal_True))
+/*N*/ { // Bedingug OK -> aktuellen Set einstellen
+/*N*/ pMgr->ToRecordId(Max((USHORT)aPar2.ToInt32(), USHORT(1))-1);
+/*N*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: LogDBName
+ --------------------------------------------------------------------*/
+
+/*N*/ const String& SwDBNumSetField::GetPar1() const
+/*N*/ {
+/*N*/ return aCond;
+/*N*/ }
+
+void SwDBNumSetField::SetPar1(const String& rStr)
+{
+ aCond = rStr;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bedingung
+ --------------------------------------------------------------------*/
+
+/*N*/ String SwDBNumSetField::GetPar2() const
+/*N*/ {
+/*N*/ return aPar2;
+/*N*/ }
+
+void SwDBNumSetField::SetPar2(const String& rStr)
+{
+ aPar2 = rStr;
+}
+/*-----------------06.03.98 16:16-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDBNumSetField::QueryValue( ::com::sun::star::uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ BOOL bRet = TRUE;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR3:
+/*N*/ rAny <<= OUString(aCond);
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int32)aPar2.ToInt32();
+/*N*/ break;
+/*N*/ default:
+/*N*/ bRet = SwDBNameInfField::QueryValue(rAny, nMId );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*-----------------06.03.98 16:16-------------------
+
+--------------------------------------------------*/
+BOOL SwDBNumSetField::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ BOOL bRet = TRUE;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR3:
+ ::binfilter::GetString( rAny, aCond );
+ break;
+ case FIELD_PROP_FORMAT:
+ {
+ sal_Int32 nVal;
+ rAny >>= nVal;
+ aPar2 = String::CreateFromInt32(nVal);
+ }
+ break;
+ default:
+ bRet = SwDBNameInfField::PutValue(rAny, nMId );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwDBNameFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBNameFieldType::SwDBNameFieldType(SwDoc* pDocument)
+/*N*/ : SwFieldType( RES_DBNAMEFLD )
+/*N*/ {
+/*N*/ pDoc = pDocument;
+/*N*/ }
+//------------------------------------------------------------------------------
+
+/*N*/ String SwDBNameFieldType::Expand(ULONG nFmt) const
+/*N*/ {
+/*N*/ ASSERT( nFmt >= FF_BEGIN && nFmt < FF_END, "Expand: kein guelt. Fmt!" );
+/*N*/ const SwDBData aData = pDoc->GetDBData();
+/*N*/ String sRet(aData.sDataSource);
+/*N*/ sRet += '.';
+/*N*/ sRet += (String)aData.sCommand;
+/*N*/ return sRet;
+/*N*/ }
+//------------------------------------------------------------------------------
+
+/*N*/ SwFieldType* SwDBNameFieldType::Copy() const
+/*N*/ {
+ SwDBNameFieldType *pTmp = new SwDBNameFieldType(pDoc);
+ return pTmp;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung: Name der angedockten DB
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBNameField::SwDBNameField(SwDBNameFieldType* pTyp, const SwDBData& rDBData, ULONG nFmt)
+/*N*/ : SwDBNameInfField(pTyp, rDBData, nFmt)
+/*N*/ {}
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwDBNameField::Expand() const
+/*N*/ {
+/*N*/ String sRet;
+/*N*/ if(0 ==(GetSubType() & SUB_INVISIBLE))
+/*N*/ sRet = ((SwDBNameFieldType*)GetTyp())->Expand(GetFormat());
+/*N*/ return sRet;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwField* SwDBNameField::Copy() const
+/*N*/ {
+/*N*/ SwDBNameField *pTmp = new SwDBNameField((SwDBNameFieldType*)GetTyp(), GetDBData());
+/*N*/ pTmp->ChangeFormat(GetFormat());
+/*N*/ pTmp->SetLanguage(GetLanguage());
+/*N*/ pTmp->SetSubType(GetSubType());
+/*N*/ return pTmp;
+/*N*/ }
+
+/*-----------------06.03.98 16:16-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDBNameField::QueryValue( ::com::sun::star::uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ return SwDBNameInfField::QueryValue(rAny, nMId );
+/*N*/ }
+/*-----------------06.03.98 16:16-------------------
+
+--------------------------------------------------*/
+BOOL SwDBNameField::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+{
+ return SwDBNameInfField::PutValue(rAny, nMId );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: SwDBNameFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBSetNumberFieldType::SwDBSetNumberFieldType()
+/*N*/ : SwFieldType( RES_DBSETNUMBERFLD )
+/*N*/ {
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwFieldType* SwDBSetNumberFieldType::Copy() const
+/*N*/ {
+ SwDBSetNumberFieldType *pTmp = new SwDBSetNumberFieldType;
+ return pTmp;
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung: SetNumber der angedockten DB
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDBSetNumberField::SwDBSetNumberField(SwDBSetNumberFieldType* pTyp,
+/*N*/ const SwDBData& rDBData,
+/*N*/ ULONG nFmt)
+/*N*/ : SwDBNameInfField(pTyp, rDBData, nFmt), nNumber(0)
+/*N*/ {}
+
+//------------------------------------------------------------------------------
+
+/*N*/ String SwDBSetNumberField::Expand() const
+/*N*/ {
+/*N*/ if(0 !=(GetSubType() & SUB_INVISIBLE) || nNumber == 0)
+/*?*/ return aEmptyStr;
+/*N*/ else
+/*N*/ return FormatNumber((USHORT)nNumber, GetFormat());
+/*N*/ //return(nNumber == 0 ? aEmptyStr : FormatNumber(nNumber, GetFormat()));
+/*N*/ }
+
+//------------------------------------------------------------------------------
+
+/*N*/ void SwDBSetNumberField::Evaluate(SwDoc* pDoc)
+/*N*/ {
+/*N*/ SwNewDBMgr* pMgr = pDoc->GetNewDBMgr();
+/*N*/
+/*N*/ const SwDBData& aTmpData = GetDBData();
+/*N*/ if (!pMgr || !pMgr->IsInMerge() ||
+/*N*/ !pMgr->IsDataSourceOpen(aTmpData.sDataSource, aTmpData.sCommand, sal_False))
+/*N*/ return;
+/*N*/ nNumber = pMgr->GetSelectedRecordId();
+/*N*/ }
+
+
+//------------------------------------------------------------------------------
+
+/*N*/ SwField* SwDBSetNumberField::Copy() const
+/*N*/ {
+/*N*/ SwDBSetNumberField *pTmp =
+/*N*/ new SwDBSetNumberField((SwDBSetNumberFieldType*)GetTyp(), GetDBData(), GetFormat());
+/*N*/ pTmp->SetLanguage(GetLanguage());
+/*N*/ pTmp->SetSetNumber(nNumber);
+/*N*/ pTmp->SetSubType(GetSubType());
+/*N*/ return pTmp;
+/*N*/ }
+/*-----------------06.03.98 16:15-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDBSetNumberField::QueryValue( ::com::sun::star::uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ rAny <<= (sal_Int16)GetFormat();
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= nNumber;
+/*N*/ break;
+/*N*/ default:
+/*N*/ bRet = SwDBNameInfField::QueryValue( rAny, nMId );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*-----------------06.03.98 16:15-------------------
+
+--------------------------------------------------*/
+BOOL SwDBSetNumberField::PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMId )
+{
+ BOOL bRet = TRUE;
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_USHORT1:
+ {
+ sal_Int16 nSet;
+ rAny >>= nSet;
+ if(nSet < (INT16) SVX_NUMBER_NONE )
+ SetFormat(nSet);
+ else
+ //exception(wrong_value)
+ ;
+ }
+ break;
+ case FIELD_PROP_FORMAT:
+ rAny >>= nNumber;
+ break;
+ default:
+ bRet = SwDBNameInfField::PutValue( rAny, nMId );
+ }
+ return bRet;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_ddefld.cxx b/binfilter/bf_sw/source/core/fields/sw_ddefld.cxx
new file mode 100644
index 000000000000..ba4dc6b6178a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_ddefld.cxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svx/linkmgr.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <errhdl.hxx>
+#include <ddefld.hxx>
+#include <swbaslnk.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+
+using namespace rtl;
+
+#ifdef PM2
+#define DDE_TXT_ENCODING RTL_TEXTENCODING_IBM_850
+#else
+#define DDE_TXT_ENCODING RTL_TEXTENCODING_MS_1252
+#endif
+
+/*--------------------------------------------------------------------
+ Beschreibung: Globale Variablen
+ --------------------------------------------------------------------*/
+
+/*N*/ class SwIntrnlRefLink : public SwBaseLink
+/*N*/ {
+/*N*/ SwDDEFieldType& rFldType;
+/*N*/ public:
+/*N*/ SwIntrnlRefLink( SwDDEFieldType& rType, USHORT nUpdateType, USHORT nFmt )
+/*N*/ : SwBaseLink( nUpdateType, nFmt ),
+/*N*/ rFldType( rType )
+/*N*/ {}
+/*N*/
+
+/*N*/ };
+
+
+
+
+
+
+/*N*/ SwDDEFieldType::SwDDEFieldType(const String& rName,
+/*N*/ const String& rCmd, USHORT nUpdateType )
+/*N*/ : SwFieldType( RES_DDEFLD ),
+/*N*/ aName( rName ), pDoc( 0 ), nRefCnt( 0 )
+/*N*/ {
+/*N*/ bCRLFFlag = bDeleted = FALSE;
+/*N*/ refLink = new SwIntrnlRefLink( *this, nUpdateType, FORMAT_STRING );
+/*N*/ SetCmd( rCmd );
+/*N*/ }
+
+/*N*/ SwDDEFieldType::~SwDDEFieldType()
+/*N*/ {
+/*N*/ if( pDoc && !pDoc->IsInDtor() )
+/*?*/ pDoc->GetLinkManager().Remove( refLink );
+/*N*/ refLink->Disconnect();
+/*N*/ }
+
+
+/*N*/ SwFieldType* SwDDEFieldType::Copy() const
+/*N*/ {
+/*N*/ SwDDEFieldType* pType = new SwDDEFieldType( aName, GetCmd(), GetType() );
+/*N*/ pType->aExpansion = aExpansion;
+/*N*/ pType->bCRLFFlag = bCRLFFlag;
+/*N*/ pType->bDeleted = bDeleted;
+/*N*/ pType->SetDoc( pDoc );
+/*N*/ return pType;
+/*N*/ }
+
+/*N*/ const String& SwDDEFieldType::GetName() const
+/*N*/ {
+/*N*/ return aName;
+/*N*/ }
+
+/*N*/ void SwDDEFieldType::SetCmd( const String& rStr )
+/*N*/ {
+/*N*/ String sCmd( rStr );
+/*N*/ xub_StrLen nPos;
+/*N*/ while( STRING_NOTFOUND != (nPos = sCmd.SearchAscii( " " )) )
+/*?*/ sCmd.Erase( nPos, 1 );
+/*N*/ refLink->SetLinkSourceName( sCmd );
+/*N*/ }
+
+/*N*/ String SwDDEFieldType::GetCmd() const
+/*N*/ {
+/*N*/ return refLink->GetLinkSourceName();
+/*N*/ }
+
+/*N*/ void SwDDEFieldType::SetDoc( SwDoc* pNewDoc )
+/*N*/ {
+/*N*/ if( pNewDoc == pDoc )
+/*N*/ return;
+/*N*/
+/*N*/ if( pDoc && refLink.Is() )
+/*N*/ {
+/*?*/ ASSERT( !nRefCnt, "wie kommen die Referenzen rueber?" );
+/*?*/ pDoc->GetLinkManager().Remove( refLink );
+/*N*/ }
+/*N*/
+/*N*/ pDoc = pNewDoc;
+/*N*/ if( pDoc && nRefCnt )
+/*N*/ {
+/*?*/ refLink->SetVisible( pDoc->IsVisibleLinks() );
+/*?*/ pDoc->GetLinkManager().InsertDDELink( refLink );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwDDEFieldType::_RefCntChgd()
+/*N*/ {
+/*N*/ if( nRefCnt )
+/*N*/ {
+/*N*/ refLink->SetVisible( pDoc->IsVisibleLinks() );
+/*N*/ pDoc->GetLinkManager().InsertDDELink( refLink );
+/*N*/ if( pDoc->GetRootFrm() )
+/*?*/ UpdateNow();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ Disconnect();
+/*?*/ pDoc->GetLinkManager().Remove( refLink );
+/*N*/ }
+/*N*/ }
+/* -----------------------------28.08.00 16:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwDDEFieldType::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMId ) const
+{
+ BYTE nPart = 0;
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR2: nPart = 3; break;
+ case FIELD_PROP_PAR4: nPart = 2; break;
+ case FIELD_PROP_SUBTYPE: nPart = 1; break;
+ case FIELD_PROP_BOOL1:
+ {
+ sal_Bool bSet = GetType() == ::binfilter::LINKUPDATE_ALWAYS ? TRUE : FALSE;
+ rVal.setValue(&bSet, ::getBooleanCppuType());
+ }
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ if( nPart )
+ rVal <<= OUString(GetCmd().GetToken(nPart-1, ::binfilter::cTokenSeperator));
+ return TRUE;
+}
+/* -----------------------------28.08.00 16:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwDDEFieldType::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMId )
+{
+ BYTE nPart = 0;
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR2: nPart = 3; break;
+ case FIELD_PROP_PAR4: nPart = 2; break;
+ case FIELD_PROP_SUBTYPE: nPart = 1; break;
+ case FIELD_PROP_BOOL1:
+ SetType( *(sal_Bool*)rVal.getValue() ? ::binfilter::LINKUPDATE_ALWAYS
+ : ::binfilter::LINKUPDATE_ONCALL );
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ if( nPart )
+ {
+ String sTmp, sCmd( GetCmd() );
+ while(3 > sCmd.GetTokenCount(::binfilter::cTokenSeperator))
+ sCmd += ::binfilter::cTokenSeperator;
+ sCmd.SetToken( nPart-1, ::binfilter::cTokenSeperator, ::binfilter::GetString( rVal, sTmp ) );
+ SetCmd( sCmd );
+ }
+ return TRUE;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwDDEField::SwDDEField( SwDDEFieldType* pType )
+/*N*/ : SwField(pType)
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwDDEField::~SwDDEField()
+/*N*/ {
+/*N*/ if( GetTyp()->IsLastDepend() ) // der Letzte mach das
+/*N*/ ((SwDDEFieldType*)GetTyp())->Disconnect(); // Licht aus
+/*N*/ }
+
+/*N*/ String SwDDEField::Expand() const
+/*N*/ {
+/*N*/ xub_StrLen nPos;
+/*N*/ String aStr( ((SwDDEFieldType*)GetTyp())->GetExpansion() );
+/*N*/
+/*N*/ aStr.EraseAllChars( '\r' );
+/*N*/ while( (nPos = aStr.Search( '\t' )) != STRING_NOTFOUND )
+/*?*/ aStr.SetChar( nPos, ' ' );
+/*N*/ while( (nPos = aStr.Search( '\n' )) != STRING_NOTFOUND )
+/*?*/ aStr.SetChar( nPos, '|' );
+/*N*/ if( aStr.Len() && ( aStr.GetChar( aStr.Len()-1 ) == '|') )
+/*?*/ aStr.Erase( aStr.Len()-1, 1 );
+/*N*/ return aStr;
+/*N*/ }
+
+/*N*/ SwField* SwDDEField::Copy() const
+/*N*/ {
+/*N*/ return new SwDDEField((SwDDEFieldType*)GetTyp());
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parameter des Typen erfragen
+ Name
+ --------------------------------------------------------------------*/
+const String& SwDDEField::GetPar1() const
+{
+ return ((SwDDEFieldType*)GetTyp())->GetName();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parameter des Typen erfragen
+ Commando
+ --------------------------------------------------------------------*/
+String SwDDEField::GetPar2() const
+{
+ return ((SwDDEFieldType*)GetTyp())->GetCmd();
+}
+
+void SwDDEField::SetPar2(const String& rStr)
+{
+ ((SwDDEFieldType*)GetTyp())->SetCmd(rStr);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_ddetbl.cxx b/binfilter/bf_sw/source/core/fields/sw_ddetbl.cxx
new file mode 100644
index 000000000000..4fbabee3b1fe
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_ddetbl.cxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx>
+#include <swddetbl.hxx>
+namespace binfilter {
+
+
+/*N*/ TYPEINIT1( SwDDETable, SwTable );
+
+ // Constructor movet alle Lines/Boxen aus der SwTable zu sich.
+ // Die SwTable ist danach Leer und muss geloescht werden.
+
+
+
+
+/*N*/ SwDDEFieldType* SwDDETable::GetDDEFldType()
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 //STRIP001 return (SwDDEFieldType*)aDepend.GetRegisteredIn();
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_docufld.cxx b/binfilter/bf_sw/source/core/fields/sw_docufld.cxx
new file mode 100644
index 000000000000..0318cae2bff8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_docufld.cxx
@@ -0,0 +1,2274 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+
+#include <com/sun/star/text/PlaceholderType.hpp>
+#include <com/sun/star/text/TemplateDisplayFormat.hpp>
+#include <com/sun/star/text/PageNumberType.hpp>
+#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <unotools/localedatawrapper.hxx>
+#include <bf_svx/unolingu.hxx>
+
+#include <bf_svtools/urihelper.hxx>
+#include <bf_svtools/useroptions.hxx>
+
+#include <bf_sfx2/docfile.hxx>
+#include <bf_sfx2/doctempl.hxx>
+#include <bf_svx/adritem.hxx>
+
+
+#include <charfmt.hxx>
+#include <docstat.hxx>
+#include <pagedesc.hxx>
+#include <fmtpdsc.hxx>
+
+#include <horiornt.hxx>
+
+#include <rootfrm.hxx> // AuthorField
+#include <pagefrm.hxx> //
+#include <dbmgr.hxx>
+#include <docufld.hxx>
+#include <flddat.hxx>
+#include <docfld.hxx>
+#include <pam.hxx>
+#include <poolfmt.hxx>
+#include <docsh.hxx>
+#include <hints.hxx>
+#include <unofldmid.h>
+#include <swunohelper.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+#define URL_DECODE INetURLObject::DECODE_UNAMBIGUOUS
+namespace binfilter {
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::rtl;
+/*--------------------------------------------------------------------
+ Beschreibung: SwPageNumberFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwPageNumberFieldType::SwPageNumberFieldType()
+/*N*/ : SwFieldType( RES_PAGENUMBERFLD ),
+/*N*/ nNumberingType( SVX_NUM_ARABIC ),
+/*N*/ nNum( 0 ),
+/*N*/ nMax( USHRT_MAX ),
+/*N*/ bVirtuell( sal_False )
+/*N*/ {
+/*N*/ }
+
+/*N*/ String& SwPageNumberFieldType::Expand( sal_uInt32 nFmt, short nOff,
+/*N*/ const String& rUserStr, String& rRet ) const
+/*N*/ {
+/*N*/ sal_uInt32 nTmpFmt = (SVX_NUM_PAGEDESC == nFmt) ? (sal_uInt32)nNumberingType : nFmt;
+/*N*/ long nTmp = nNum + nOff;
+/*N*/
+/*N*/ if( 0 >= nTmp || SVX_NUM_NUMBER_NONE == nTmpFmt || (!bVirtuell && nTmp > nMax) )
+/*N*/ rRet = aEmptyStr;
+/*N*/ else if( SVX_NUM_CHAR_SPECIAL == nTmpFmt )
+/*?*/ rRet = rUserStr;
+/*N*/ else
+/*N*/ rRet = FormatNumber( (sal_uInt16)nTmp, nTmpFmt );
+/*N*/ return rRet;
+/*N*/ }
+
+/*N*/ SwFieldType* SwPageNumberFieldType::Copy() const
+/*N*/ {
+ SwPageNumberFieldType *pTmp = new SwPageNumberFieldType();
+ pTmp->nNum = nNum;
+ pTmp->nMax = nMax;
+ pTmp->nNumberingType = nNumberingType;
+ pTmp->bVirtuell = bVirtuell;
+
+ return pTmp;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verschiedene Expandierung
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwPageNumberFieldType::ChangeExpansion( SwDoc* pDoc, sal_uInt16 nPage,
+/*N*/ sal_uInt16 nNumPages, sal_Bool bVirt,
+/*N*/ const sal_Int16* pNumFmt )
+/*N*/ {
+/*N*/ nNum = nPage;
+/*N*/ nMax = nNumPages;
+/*N*/ if( pNumFmt )
+/*N*/ nNumberingType = *pNumFmt;
+/*N*/
+/*N*/ bVirtuell = sal_False;
+/*N*/ if( bVirt )
+/*N*/ {
+/*N*/ // dann muss das Flag ueberprueft werden, denn das Layout setzt
+/*N*/ // es NIE zurueck
+/*N*/ const SfxItemPool &rPool = pDoc->GetAttrPool();
+/*N*/ const SwFmtPageDesc *pDesc;
+/*N*/ sal_uInt16 nMaxItems = rPool.GetItemCount( RES_PAGEDESC );
+/*N*/ for( sal_uInt16 n = 0; n < nMaxItems; ++n )
+/*N*/ if( 0 != (pDesc = (SwFmtPageDesc*)rPool.GetItem( RES_PAGEDESC, n ) )
+/*N*/ && pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
+/*N*/ {
+/*N*/ if( pDesc->GetDefinedIn()->ISA( SwCntntNode ))
+/*N*/ {
+/*N*/ SwClientIter aIter( *(SwModify*)pDesc->GetDefinedIn() );
+/*N*/ if( aIter.First( TYPE( SwFrm ) ) )
+/*N*/ {
+/*N*/ bVirtuell = sal_True;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pDesc->GetDefinedIn()->ISA( SwFmt ))
+/*N*/ {
+/*N*/ SwAutoFmtGetDocNode aGetHt( &pDoc->GetNodes() );
+/*N*/ bVirtuell = !pDesc->GetDefinedIn()->GetInfo( aGetHt );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwPageNumberField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwPageNumberField::SwPageNumberField(SwPageNumberFieldType* pTyp,
+/*N*/ sal_uInt16 nSub, sal_uInt32 nFmt, short nOff)
+/*N*/ : SwField(pTyp, nFmt), nOffset(nOff), nSubType(nSub)
+/*N*/ {
+/*N*/ }
+
+/*N*/ String SwPageNumberField::Expand() const
+/*N*/ {
+/*N*/ String sRet;
+/*N*/ SwPageNumberFieldType* pFldType = (SwPageNumberFieldType*)GetTyp();
+/*N*/
+/*N*/ if( PG_NEXT == nSubType && 1 != nOffset )
+/*N*/ {
+/*?*/ if( pFldType->Expand( GetFormat(), 1, sUserStr, sRet ).Len() )
+/*?*/ pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
+/*N*/ }
+/*N*/ else if( PG_PREV == nSubType && -1 != nOffset )
+/*N*/ {
+/*?*/ if( pFldType->Expand( GetFormat(), -1, sUserStr, sRet ).Len() )
+/*?*/ pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
+/*N*/ }
+/*N*/ else
+/*N*/ pFldType->Expand( GetFormat(), nOffset, sUserStr, sRet );
+/*N*/ return sRet;
+/*N*/ }
+
+/*N*/ SwField* SwPageNumberField::Copy() const
+/*N*/ {
+/*N*/ SwPageNumberField *pTmp =
+/*N*/ new SwPageNumberField((SwPageNumberFieldType*)GetTyp(), nSubType, GetFormat(), nOffset);
+/*N*/ pTmp->SetLanguage( GetLanguage() );
+/*N*/ pTmp->SetUserString( sUserStr );
+/*N*/ return pTmp;
+/*N*/ }
+
+/*N*/ String SwPageNumberField::GetPar2() const
+/*N*/ {
+/*N*/ return String::CreateFromInt32(nOffset);
+/*N*/ }
+
+void SwPageNumberField::SetPar2(const String& rStr)
+{
+ nOffset = (short)rStr.ToInt32();
+}
+
+/*N*/ sal_uInt16 SwPageNumberField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+/*-----------------05.03.98 10:25-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwPageNumberField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int16)GetFormat();
+/*N*/ break;
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ rAny <<= nOffset;
+/*N*/ break;
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ {
+/*N*/ text::PageNumberType eType;
+/*N*/ eType = text::PageNumberType_CURRENT;
+/*N*/ if(nSubType == PG_PREV)
+/*?*/ eType = text::PageNumberType_PREV;
+/*N*/ else if(nSubType == PG_NEXT)
+/*?*/ eType = text::PageNumberType_NEXT;
+/*N*/ rAny.setValue(&eType, ::getCppuType((const text::PageNumberType*)0));
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ rAny <<= OUString(sUserStr);
+/*?*/ break;
+/*?*/
+/*?*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 10:25-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwPageNumberField::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/ sal_Int16 nSet;
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_FORMAT:
+/*?*/ rAny >>= nSet;
+/*?*/
+/*?*/ // TODO: woher kommen die defines?
+/*?*/ if(nSet <= SVX_NUM_PAGEDESC )
+/*?*/ SetFormat(nSet);
+/*?*/ else
+/*?*/ //exception(wrong_value)
+/*?*/ ;
+/*?*/ break;
+/*?*/ case FIELD_PROP_USHORT1:
+/*?*/ rAny >>= nSet;
+/*?*/ nOffset = nSet;
+/*?*/ break;
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ switch( SWUnoHelper::GetEnumAsInt32( rAny ) )
+/*N*/ {
+/*N*/ case text::PageNumberType_CURRENT:
+/*N*/ nSubType = PG_RANDOM;
+/*N*/ break;
+/*N*/ case text::PageNumberType_PREV:
+/*?*/ nSubType = PG_PREV;
+/*?*/ break;
+/*?*/ case text::PageNumberType_NEXT:
+/*?*/ nSubType = PG_NEXT;
+/*?*/ break;
+/*?*/ default:
+/*?*/ bRet = FALSE;
+/*N*/ }
+/*N*/ break;
+/*?*/ case FIELD_PROP_PAR1:
+/*?*/ ::binfilter::GetString( rAny, sUserStr );
+/*?*/ break;
+/*?*/
+/*?*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: SwAuthorFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwAuthorFieldType::SwAuthorFieldType()
+/*N*/ : SwFieldType( RES_AUTHORFLD )
+/*N*/ {
+/*N*/ }
+
+/*N*/ String SwAuthorFieldType::Expand(ULONG nFmt) const
+/*N*/ {
+/*N*/ String sRet;
+/*N*/ SvtUserOptions aOpt;
+/*N*/ if((nFmt & 0xff) == AF_NAME)
+/*N*/ sRet = aOpt.GetFullName();
+/*N*/ else
+/*N*/ sRet = aOpt.GetID();
+/*N*/ return sRet;
+/*N*/ }
+
+/*N*/ SwFieldType* SwAuthorFieldType::Copy() const
+/*N*/ {
+ return new SwAuthorFieldType;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwAuthorField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, sal_uInt32 nFmt)
+/*N*/ : SwField(pTyp, nFmt)
+/*N*/ {
+/*N*/ aContent = ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat());
+/*N*/ }
+
+/*N*/ String SwAuthorField::Expand() const
+/*N*/ {
+/*N*/ if (!IsFixed())
+/*N*/ ((SwAuthorField*)this)->aContent =
+/*N*/ ((SwAuthorFieldType*)GetTyp())->Expand(GetFormat());
+/*N*/
+/*N*/ return aContent;
+/*N*/ }
+
+/*N*/ SwField* SwAuthorField::Copy() const
+/*N*/ {
+/*N*/ SwAuthorField *pTmp = new SwAuthorField( (SwAuthorFieldType*)GetTyp(),
+/*N*/ GetFormat());
+/*N*/ pTmp->SetExpansion(aContent);
+/*N*/ return pTmp;
+/*N*/ }
+
+/*-----------------05.03.98 11:15-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwAuthorField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ sal_Bool bVal;
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ bVal = GetFormat() == AF_NAME;
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ bVal = IsFixed();
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ rAny <<= ::rtl::OUString(GetContent());
+/*?*/ break;
+/*?*/
+/*?*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 11:15-------------------
+
+--------------------------------------------------*/
+BOOL SwAuthorField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_BOOL1:
+ SetFormat( *(sal_Bool*)rAny.getValue() ? AF_NAME : AF_SHORTCUT );
+ break;
+
+ case FIELD_PROP_BOOL2:
+ if( *(sal_Bool*)rAny.getValue() )
+ SetFormat( GetFormat() | AF_FIXED);
+ else
+ SetFormat( GetFormat() & ~AF_FIXED);
+ break;
+
+ case FIELD_PROP_PAR1:
+ ::binfilter::GetString( rAny, aContent );
+ break;
+
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwFileNameFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwFileNameFieldType::SwFileNameFieldType(SwDoc *pDocument)
+/*N*/ : SwFieldType( RES_FILENAMEFLD )
+/*N*/ {
+/*N*/ pDoc = pDocument;
+/*N*/ }
+
+/*M*/ String SwFileNameFieldType::Expand(ULONG nFmt) const
+/*M*/ {
+/*M*/ String aRet;
+/*M*/ const SwDocShell* pDShell = pDoc->GetDocShell();
+/*M*/ if( pDShell && pDShell->HasName() )
+/*M*/ {
+/*M*/ const INetURLObject& rURLObj = pDShell->GetMedium()->GetURLObject();
+/*M*/ switch( nFmt & ~FF_FIXED )
+/*M*/ {
+/*M*/ case FF_PATH:
+/*M*/ {
+/*M*/ if( INET_PROT_FILE == rURLObj.GetProtocol() )
+/*M*/ {
+/*M*/ INetURLObject aTemp(rURLObj);
+/*M*/ aTemp.removeSegment();
+/*M*/ // #101947# last slash should belong to the pathname
+/*M*/ aRet = aTemp.PathToFileName();//GetFull();
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ aRet = removePassword(
+/*M*/ rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
+/*M*/ INetURLObject::WAS_ENCODED, URL_DECODE );
+/*M*/ aRet.Erase( aRet.Search( String(rURLObj.GetLastName(
+/*M*/ URL_DECODE )) ) );
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case FF_NAME:
+/*M*/ aRet = rURLObj.GetLastName( URL_DECODE );
+/*M*/ break;
+/*M*/
+/*M*/ case FF_NAME_NOEXT:
+/*M*/ aRet = rURLObj.GetBase();
+/*M*/ break;
+/*M*/
+/*M*/ default:
+/*M*/ if( INET_PROT_FILE == rURLObj.GetProtocol() )
+/*M*/ aRet = rURLObj.GetFull();
+/*M*/ else
+/*M*/ aRet = removePassword(
+/*M*/ rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
+/*M*/ INetURLObject::WAS_ENCODED, URL_DECODE );
+/*M*/ }
+/*M*/ }
+/*M*/ return aRet;
+/*M*/ }
+
+/*N*/ SwFieldType* SwFileNameFieldType::Copy() const
+/*N*/ {
+ SwFieldType *pTmp = new SwFileNameFieldType(pDoc);
+ return pTmp;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: SwFileNameField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwFileNameField::SwFileNameField(SwFileNameFieldType* pTyp, sal_uInt32 nFmt)
+/*N*/ : SwField(pTyp, nFmt)
+/*N*/ {
+/*N*/ aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
+/*N*/ }
+
+/*N*/ String SwFileNameField::Expand() const
+/*N*/ {
+/*N*/ if (!IsFixed())
+/*N*/ ((SwFileNameField*)this)->aContent = ((SwFileNameFieldType*)GetTyp())->Expand(GetFormat());
+/*N*/
+/*N*/ return aContent;
+/*N*/ }
+
+/*N*/ SwField* SwFileNameField::Copy() const
+/*N*/ {
+/*N*/ SwFileNameField *pTmp =
+/*N*/ new SwFileNameField((SwFileNameFieldType*)GetTyp(), GetFormat());
+/*N*/ pTmp->SetExpansion(aContent);
+/*N*/
+/*N*/ return pTmp;
+/*N*/ }
+
+/*-----------------05.03.98 08:59-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwFileNameField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ {
+/*N*/ sal_Int16 nRet;
+/*N*/ switch( GetFormat() &(~FF_FIXED) )
+/*N*/ {
+/*N*/ case FF_PATH:
+/*N*/ nRet = text::FilenameDisplayFormat::PATH;
+/*N*/ break;
+/*N*/ case FF_NAME_NOEXT:
+/*N*/ nRet = text::FilenameDisplayFormat::NAME;
+/*N*/ break;
+/*N*/ case FF_NAME:
+/*N*/ nRet = text::FilenameDisplayFormat::NAME_AND_EXT;
+/*N*/ break;
+/*N*/ default: nRet = text::FilenameDisplayFormat::FULL;
+/*N*/ }
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ BOOL bVal = IsFixed();
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_PAR3:
+/*?*/ rAny <<= OUString(GetContent());
+/*?*/ break;
+/*?*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 09:01-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwFileNameField::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ {
+/*N*/ //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
+/*N*/ // called with a int32 value! But normally we need
+/*N*/ // here only a int16
+/*N*/ sal_Int32 nType;
+/*N*/ rAny >>= nType;
+/*N*/ BOOL bFixed = IsFixed();
+/*N*/ switch( nType )
+/*N*/ {
+/*N*/ case text::FilenameDisplayFormat::PATH:
+/*N*/ nType = FF_PATH;
+/*N*/ break;
+/*N*/ case text::FilenameDisplayFormat::NAME:
+/*N*/ nType = FF_NAME_NOEXT;
+/*N*/ break;
+/*N*/ case text::FilenameDisplayFormat::NAME_AND_EXT:
+/*N*/ nType = FF_NAME;
+/*N*/ break;
+/*N*/ default: nType = FF_PATHNAME;
+/*N*/ }
+/*N*/ if(bFixed)
+/*?*/ nType |= FF_FIXED;
+/*N*/ SetFormat(nType);
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_BOOL2:
+/*?*/ if( *(sal_Bool*)rAny.getValue() )
+/*?*/ SetFormat( GetFormat() | FF_FIXED);
+/*?*/ else
+/*?*/ SetFormat( GetFormat() & ~FF_FIXED);
+/*?*/ break;
+/*?*/
+/*?*/ case FIELD_PROP_PAR3:
+/*?*/ ::binfilter::GetString( rAny, aContent );
+/*?*/ break;
+/*?*/
+/*?*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: SwTemplNameFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwTemplNameFieldType::SwTemplNameFieldType(SwDoc *pDocument)
+/*N*/ : SwFieldType( RES_TEMPLNAMEFLD )
+/*N*/ {
+/*N*/ pDoc = pDocument;
+/*N*/ }
+
+/*N*/ String SwTemplNameFieldType::Expand(ULONG nFmt) const
+/*N*/ {
+/*N*/ ASSERT(nFmt >= FF_BEGIN && nFmt < FF_END, "Expand: kein guelt. Fmt!" );
+/*N*/
+/*N*/ String aRet;
+/*N*/ const SfxDocumentInfo* pDInfo = pDoc->GetpInfo();
+/*N*/
+/*N*/ if( pDInfo )
+/*N*/ {
+/*N*/ if( FF_UI_NAME == nFmt )
+/*N*/ aRet = pDInfo->GetTemplateName();
+/*N*/ else if( pDInfo->GetTemplateFileName().Len() )
+/*N*/ {
+/*N*/ if( FF_UI_RANGE == nFmt )
+/*N*/ {
+ DBG_ERROR("Strip!");
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ INetURLObject aPathName( pDInfo->GetTemplateFileName() );
+/*N*/ if( FF_NAME == nFmt )
+/*N*/ aRet = aPathName.GetName(URL_DECODE);
+/*N*/ else if( FF_NAME_NOEXT == nFmt )
+/*N*/ aRet = aPathName.GetBase();
+/*N*/ else
+/*N*/ {
+/*N*/ if( FF_PATH == nFmt )
+/*N*/ {
+/*N*/ aPathName.removeSegment();
+/*N*/ aRet = aPathName.GetFull();
+/*N*/ }
+/*N*/ else
+/*N*/ aRet = aPathName.GetFull();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return aRet;
+/*N*/ }
+
+/*N*/ SwFieldType* SwTemplNameFieldType::Copy() const
+/*N*/ {
+ SwFieldType *pTmp = new SwTemplNameFieldType(pDoc);
+ return pTmp;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: SwTemplNameField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwTemplNameField::SwTemplNameField(SwTemplNameFieldType* pTyp, sal_uInt32 nFmt)
+/*N*/ : SwField(pTyp, nFmt)
+/*N*/ {}
+
+/*N*/ String SwTemplNameField::Expand() const
+/*N*/ {
+/*N*/ return((SwTemplNameFieldType*)GetTyp())->Expand(GetFormat());
+/*N*/ }
+
+/*N*/ SwField* SwTemplNameField::Copy() const
+/*N*/ {
+/*N*/ SwTemplNameField *pTmp =
+/*N*/ new SwTemplNameField((SwTemplNameFieldType*)GetTyp(), GetFormat());
+/*N*/ return pTmp;
+/*N*/ }
+
+/*-----------------05.03.98 08:59-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwTemplNameField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch ( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ {
+/*N*/ sal_Int16 nRet;
+/*N*/ switch( GetFormat() )
+/*N*/ {
+/*N*/ case FF_PATH: nRet = text::FilenameDisplayFormat::PATH; break;
+/*N*/ case FF_NAME_NOEXT: nRet = text::FilenameDisplayFormat::NAME; break;
+/*N*/ case FF_NAME: nRet = text::FilenameDisplayFormat::NAME_AND_EXT; break;
+/*N*/ case FF_UI_RANGE: nRet = text::TemplateDisplayFormat::AREA; break;
+/*N*/ case FF_UI_NAME: nRet = text::TemplateDisplayFormat::TITLE; break;
+/*N*/ default: nRet = text::FilenameDisplayFormat::FULL;
+/*N*/
+/*N*/ }
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 09:01-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwTemplNameField::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch ( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ {
+/*N*/ //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
+/*N*/ // called with a int32 value! But normally we need
+/*N*/ // here only a int16
+/*N*/ sal_Int32 nType;
+/*N*/ rAny >>= nType;
+/*N*/ switch( nType )
+/*N*/ {
+/*N*/ case text::FilenameDisplayFormat::PATH:
+/*N*/ SetFormat(FF_PATH);
+/*N*/ break;
+/*N*/ case text::FilenameDisplayFormat::NAME:
+/*N*/ SetFormat(FF_NAME_NOEXT);
+/*N*/ break;
+/*N*/ case text::FilenameDisplayFormat::NAME_AND_EXT:
+/*N*/ SetFormat(FF_NAME);
+/*N*/ break;
+/*N*/ case text::TemplateDisplayFormat::AREA :
+/*N*/ SetFormat(FF_UI_RANGE);
+/*N*/ break;
+/*N*/ case text::TemplateDisplayFormat::TITLE :
+/*N*/ SetFormat(FF_UI_NAME);
+/*N*/ break;
+/*N*/ default: SetFormat(FF_PATHNAME);
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: SwDocStatFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDocStatFieldType::SwDocStatFieldType(SwDoc* pDocument)
+/*N*/ : SwFieldType( RES_DOCSTATFLD ), nNumberingType( SVX_NUM_ARABIC )
+/*N*/ {
+/*N*/ pDoc = pDocument;
+/*N*/ }
+
+/*N*/ String SwDocStatFieldType::Expand(sal_uInt16 nSubType, sal_uInt32 nFmt) const
+/*N*/ {
+/*N*/ sal_uInt32 nVal = 0;
+/*N*/ const SwDocStat& rDStat = pDoc->GetDocStat();
+/*N*/ switch( nSubType )
+/*N*/ {
+/*N*/ case DS_TBL: nVal = rDStat.nTbl; break;
+/*N*/ case DS_GRF: nVal = rDStat.nGrf; break;
+/*N*/ case DS_OLE: nVal = rDStat.nOLE; break;
+/*N*/ case DS_PARA: nVal = rDStat.nPara; break;
+/*N*/ case DS_WORD: nVal = rDStat.nWord; break;
+/*N*/ case DS_CHAR: nVal = rDStat.nChar; break;
+/*N*/ case DS_PAGE:
+/*N*/ if( pDoc->GetRootFrm() )
+/*N*/ ((SwDocStat &)rDStat).nPage = pDoc->GetRootFrm()->GetPageNum();
+/*N*/ nVal = rDStat.nPage;
+/*N*/ if( SVX_NUM_PAGEDESC == nFmt )
+/*?*/ nFmt = (sal_uInt32)nNumberingType;
+/*N*/ break;
+/*N*/ default:
+/*?*/ ASSERT( sal_False, "SwDocStatFieldType::Expand: unbekannter SubType" );
+/*N*/ }
+/*N*/
+/*N*/ String sRet;
+/*N*/ if( nVal <= SHRT_MAX )
+/*N*/ sRet = FormatNumber( (sal_uInt16)nVal, nFmt );
+/*N*/ else
+/*?*/ sRet = String::CreateFromInt32( nVal );
+/*N*/ return sRet;
+/*N*/ }
+
+/*N*/ SwFieldType* SwDocStatFieldType::Copy() const
+/*N*/ {
+ SwDocStatFieldType *pTmp = new SwDocStatFieldType(pDoc);
+ return pTmp;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwDocStatFieldType
+ Aus historischen Gruenden steht in nFormat der
+ SubType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFmt)
+/*N*/ : SwField(pTyp, nFmt),
+/*N*/ nSubType(nSub)
+/*N*/ {}
+
+/*N*/ String SwDocStatField::Expand() const
+/*N*/ {
+/*N*/ return((SwDocStatFieldType*)GetTyp())->Expand(nSubType, GetFormat());
+/*N*/ }
+
+/*N*/ SwField* SwDocStatField::Copy() const
+/*N*/ {
+/*N*/ SwDocStatField *pTmp = new SwDocStatField(
+/*N*/ (SwDocStatFieldType*)GetTyp(), nSubType, GetFormat() );
+/*N*/ return pTmp;
+/*N*/ }
+
+/*N*/ sal_uInt16 SwDocStatField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+void SwDocStatField::SetSubType(sal_uInt16 nSub)
+{
+ nSubType = nSub;
+}
+
+/*N*/ void SwDocStatField::ChangeExpansion( const SwFrm* pFrm )
+/*N*/ {
+/*N*/ if( DS_PAGE == nSubType && SVX_NUM_PAGEDESC == GetFormat() )
+/*N*/ ((SwDocStatFieldType*)GetTyp())->SetNumFormat(
+/*?*/ pFrm->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType() );
+/*N*/ }
+
+/*-----------------05.03.98 11:38-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDocStatField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch ( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_USHORT2:
+/*N*/ rAny <<= (sal_Int16)GetFormat();
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 11:38-------------------
+
+--------------------------------------------------*/
+BOOL SwDocStatField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ BOOL bRet = FALSE;
+ nMId &= ~CONVERT_TWIPS;
+ switch ( nMId )
+ {
+ case FIELD_PROP_USHORT2:
+ {
+ sal_Int16 nSet;
+ rAny >>= nSet;
+ if(nSet <= SVX_NUM_CHARS_LOWER_LETTER_N &&
+ nSet != SVX_NUM_CHAR_SPECIAL &&
+ nSet != SVX_NUM_BITMAP)
+ {
+ SetFormat(nSet);
+ bRet = TRUE;
+ }
+ }
+ break;
+
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: DokumentinfoFields
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDocInfoFieldType::SwDocInfoFieldType(SwDoc* pDc)
+/*N*/ : SwValueFieldType( pDc, RES_DOCINFOFLD )
+/*N*/ {
+/*N*/ }
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwFieldType* SwDocInfoFieldType::Copy() const
+/*N*/ {
+ SwDocInfoFieldType* pType = new SwDocInfoFieldType(GetDoc());
+ return pType;
+/*N*/ }
+
+/*N*/ void lcl_GetLocalDataWrapper( ULONG nLang,
+/*N*/ LocaleDataWrapper **ppAppLocalData,
+/*N*/ LocaleDataWrapper **ppLocalData )
+/*N*/ {
+/*N*/ *ppAppLocalData = &GetAppLocaleData();
+/*N*/ *ppLocalData = *ppAppLocalData;
+/*N*/ if( nLang != SvxLocaleToLanguage( (*ppLocalData)->getLocale() ) )
+/*N*/ *ppLocalData = new LocaleDataWrapper(
+/*N*/ ::legacy_binfilters::getLegacyProcessServiceFactory(),
+/*N*/ SvxCreateLocale( nLang ) );
+/*N*/ }
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwDocInfoFieldType::Expand( sal_uInt16 nSub, sal_uInt32 nFormat,
+/*N*/ sal_uInt16 nLang) const
+/*N*/ {
+/*N*/ String aStr;
+/*N*/ LocaleDataWrapper *pAppLocalData = 0, *pLocalData = 0;
+/*N*/ const SfxDocumentInfo* pInf = GetDoc()->GetInfo();
+/*N*/
+/*N*/ sal_uInt16 nExtSub = nSub & 0xff00;
+/*N*/ nSub &= 0xff; // ExtendedSubTypes nicht beachten
+/*N*/
+/*N*/ switch(nSub)
+/*N*/ {
+/*N*/ case DI_TITEL: aStr = pInf->GetTitle(); break;
+/*N*/ case DI_THEMA: aStr = pInf->GetTheme(); break;
+/*N*/ case DI_KEYS: aStr = pInf->GetKeywords(); break;
+/*N*/ case DI_COMMENT:aStr = pInf->GetComment(); break;
+/*N*/ case DI_INFO1:
+/*N*/ case DI_INFO2:
+/*N*/ case DI_INFO3:
+/*N*/ case DI_INFO4: aStr = pInf->GetUserKey(nSub - DI_INFO1).GetWord();break;
+/*N*/ case DI_DOCNO: aStr = String::CreateFromInt32(
+/*N*/ pInf->GetDocumentNumber() );
+/*N*/ break;
+/*N*/ case DI_EDIT:
+/*N*/ if ( !nFormat )
+/*N*/ {
+/*?*/ lcl_GetLocalDataWrapper( nLang, &pAppLocalData, &pLocalData );
+/*?*/ aStr = pLocalData->getTime( pInf->GetTime(), sal_False, sal_False);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ double fVal = Time(pInf->GetTime()).GetTimeInDays();
+/*N*/ aStr = ExpandValue(fVal, nFormat, nLang);
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ {
+/*N*/ SfxStamp aTmp;
+/*N*/ aTmp = pInf->GetCreated();
+/*N*/ if( nSub == DI_CREATE )
+/*N*/ ; // das wars schon!!
+/*N*/ else if( nSub == DI_CHANGE &&
+/*N*/ (pInf->GetChanged().GetTime() != aTmp.GetTime() ||
+/*N*/ (nExtSub & ~DI_SUB_FIXED) == DI_SUB_AUTHOR &&
+/*N*/ pInf->GetDocumentNumber() > 1) )
+/*N*/ aTmp = pInf->GetChanged();
+/*N*/ else if( nSub == DI_PRINT &&
+/*N*/ pInf->GetPrinted().GetTime() != aTmp.GetTime() )
+/*N*/ aTmp = pInf->GetPrinted();
+/*N*/ else
+/*?*/ break;
+/*N*/
+/*N*/ if (aTmp.IsValid())
+/*N*/ {
+/*N*/ switch (nExtSub & ~DI_SUB_FIXED)
+/*N*/ {
+/*N*/ case DI_SUB_AUTHOR:
+/*N*/ aStr = aTmp.GetName();
+/*N*/ break;
+/*N*/
+/*N*/ case DI_SUB_TIME:
+/*N*/ if (!nFormat)
+/*N*/ {
+/*N*/ lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
+/*N*/ &pLocalData );
+/*N*/ aStr = pLocalData->getTime( aTmp.GetTime(),
+/*N*/ sal_False, sal_False);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ // Numberformatter anwerfen!
+/*?*/ double fVal = SwDateTimeField::GetDateTime( GetDoc(),
+/*?*/ aTmp.GetTime());
+/*?*/ aStr = ExpandValue(fVal, nFormat, nLang);
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case DI_SUB_DATE:
+/*N*/ if (!nFormat)
+/*N*/ {
+/*N*/ lcl_GetLocalDataWrapper( nLang, &pAppLocalData,
+/*N*/ &pLocalData );
+/*N*/ aStr = pLocalData->getDate( aTmp.GetTime() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ // Numberformatter anwerfen!
+/*?*/ double fVal = SwDateTimeField::GetDateTime( GetDoc(),
+/*?*/ aTmp.GetTime());
+/*?*/ aStr = ExpandValue(fVal, nFormat, nLang);
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pAppLocalData != pLocalData )
+/*N*/ delete pLocalData;
+/*N*/
+/*N*/ return aStr;
+/*N*/ }
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwDocInfoField::SwDocInfoField(SwDocInfoFieldType* pType, sal_uInt16 nSub, sal_uInt32 nFmt) :
+/*N*/ SwValueField(pType, nFmt), nSubType(nSub)
+/*N*/ {
+/*N*/ aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, nFmt, GetLanguage());
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwDocInfoField::Expand() const
+/*N*/ {
+/*N*/ if (!IsFixed()) // aContent fuer Umschaltung auf fixed mitpflegen
+/*N*/ ((SwDocInfoField*)this)->aContent = ((SwDocInfoFieldType*)GetTyp())->Expand(nSubType, GetFormat(), GetLanguage());
+/*N*/
+/*N*/ return aContent;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwDocInfoField::GetCntnt(sal_Bool bName) const
+/*N*/ {
+/*N*/ if ( bName )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 String aStr(SwFieldType::GetTypeStr(GetTypeId()));
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwField* SwDocInfoField::Copy() const
+/*N*/ {
+/*N*/ SwDocInfoField* pFld = new SwDocInfoField((SwDocInfoFieldType*)GetTyp(), nSubType, GetFormat());
+/*N*/ pFld->SetAutomaticLanguage(IsAutomaticLanguage());
+/*N*/ pFld->aContent = aContent;
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ sal_uInt16 SwDocInfoField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDocInfoField::SetSubType(sal_uInt16 nSub)
+{
+ nSubType = nSub;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwDocInfoField::SetLanguage(sal_uInt16 nLng)
+/*N*/ {
+/*N*/ if (!GetFormat())
+/*N*/ SwField::SetLanguage(nLng);
+/*N*/ else
+/*N*/ SwValueField::SetLanguage(nLng);
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ BOOL SwDocInfoField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ rAny <<= OUString(aContent);
+/*?*/ break;
+/*?*/
+/*?*/ case FIELD_PROP_USHORT1:
+/*?*/ rAny <<= (sal_Int16)aContent.ToInt32();
+/*?*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ sal_Bool bVal = 0 != (nSubType & DI_SUB_FIXED);
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int32)GetFormat();
+/*N*/ break;
+/*N*/
+/*?*/ case FIELD_PROP_DOUBLE:
+/*?*/ {
+/*?*/ double fVal = GetValue();
+/*?*/ rAny.setValue(&fVal, ::getCppuType(&fVal));
+/*?*/ }
+/*?*/ break;
+/*?*/ case FIELD_PROP_PAR3:
+/*?*/ rAny <<= ::rtl::OUString(Expand());
+/*?*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ sal_uInt16 nExtSub = (nSubType & 0xff00) & ~DI_SUB_FIXED;
+/*N*/ sal_Bool bVal = (nExtSub == DI_SUB_DATE);
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ return SwField::QueryValue(rAny, nMId);
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwDocInfoField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ sal_Int32 nValue;
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ if( nSubType & DI_SUB_FIXED )
+ ::binfilter::GetString( rAny, aContent );
+ break;
+
+ case FIELD_PROP_USHORT1:
+ if( nSubType & DI_SUB_FIXED )
+ {
+ rAny >>= nValue;
+ aContent = String::CreateFromInt32(nValue);
+ }
+ break;
+
+ case FIELD_PROP_BOOL1:
+ if(*(sal_Bool*)rAny.getValue())
+ nSubType |= DI_SUB_FIXED;
+ else
+ nSubType &= ~DI_SUB_FIXED;
+ break;
+ case FIELD_PROP_FORMAT:
+ {
+ rAny >>= nValue;
+ if( nValue >= 0)
+ SetFormat(nValue);
+ }
+ break;
+
+ case FIELD_PROP_PAR3:
+ ::binfilter::GetString( rAny, aContent );
+ break;
+ case FIELD_PROP_BOOL2:
+ nSubType &= 0xf0ff;
+ if(*(sal_Bool*)rAny.getValue())
+ nSubType |= DI_SUB_DATE;
+ else
+ nSubType |= DI_SUB_TIME;
+ break;
+ default:
+ return SwField::PutValue(rAny, nMId);
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwHiddenTxtFieldType by JP
+ --------------------------------------------------------------------*/
+
+/*N*/ SwHiddenTxtFieldType::SwHiddenTxtFieldType( sal_Bool bSetHidden )
+/*N*/ : SwFieldType( RES_HIDDENTXTFLD ), bHidden( bSetHidden )
+/*N*/ {}
+
+/*N*/ SwFieldType* SwHiddenTxtFieldType::Copy() const
+/*N*/ {
+ return new SwHiddenTxtFieldType( bHidden );
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwHiddenTxtField::SwHiddenTxtField( SwHiddenTxtFieldType* pFldType,
+/*N*/ sal_Bool bConditional,
+/*N*/ const String& rCond,
+/*N*/ const String& rStr,
+/*N*/ sal_Bool bHidden,
+/*N*/ sal_uInt16 nSub) :
+/*N*/ SwField( pFldType ), aCond(rCond), bValid(sal_False),
+/*N*/ bCanToggle(bConditional), bIsHidden(bHidden), nSubType(nSub)
+/*N*/ {
+/*N*/ if(nSubType == TYP_CONDTXTFLD)
+/*N*/ {
+/*N*/ sal_uInt16 nPos = 0;
+/*N*/ aTRUETxt = rStr.GetToken(0, '|', nPos);
+/*N*/
+/*N*/ if(nPos != STRING_NOTFOUND)
+/*N*/ {
+/*N*/ aFALSETxt = rStr.GetToken(0, '|', nPos);
+/*N*/ if(nPos != STRING_NOTFOUND)
+/*N*/ {
+/*?*/ aContent = rStr.GetToken(0, '|', nPos);
+/*?*/ bValid = sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ aTRUETxt = rStr;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwHiddenTxtField::SwHiddenTxtField( SwHiddenTxtFieldType* pFldType,
+/*N*/ const String& rCond,
+/*N*/ const String& rTrue,
+/*N*/ const String& rFalse,
+/*N*/ sal_uInt16 nSub)
+/*N*/ : SwField( pFldType ), aCond(rCond), bIsHidden(sal_True), nSubType(nSub),
+/*N*/ aTRUETxt(rTrue), aFALSETxt(rFalse), bValid(sal_False)
+/*N*/ {
+/*N*/ bCanToggle = aCond.Len() > 0;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwHiddenTxtField::Expand() const
+/*N*/ {
+/*N*/ // Type: !Hidden -> immer anzeigen
+/*N*/ // Hide -> Werte die Bedingung aus
+/*N*/
+/*N*/ if( TYP_CONDTXTFLD == nSubType )
+/*N*/ {
+/*N*/ if( bValid )
+/*?*/ return aContent;
+/*N*/
+/*N*/ if( bCanToggle && !bIsHidden )
+/*?*/ return aTRUETxt;
+/*N*/ }
+/*N*/ else if( !((SwHiddenTxtFieldType*)GetTyp())->GetHiddenFlag() ||
+/*N*/ ( bCanToggle && bIsHidden ))
+/*?*/ return aTRUETxt;
+/*N*/
+/*N*/ return aFALSETxt;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuellen Field-Value holen und cachen
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwHiddenTxtField::Evaluate(SwDoc* pDoc)
+/*N*/ {
+/*N*/ ASSERT(pDoc, Wo ist das Dokument Seniore);
+/*N*/
+/*N*/ if( TYP_CONDTXTFLD == nSubType )
+/*N*/ {
+/*N*/ SwNewDBMgr* pMgr = pDoc->GetNewDBMgr();
+/*N*/
+/*N*/ bValid = sal_False;
+/*N*/ String sTmpName;
+/*N*/
+/*N*/ if (bCanToggle && !bIsHidden)
+/*N*/ sTmpName = aTRUETxt;
+/*N*/ else
+/*N*/ sTmpName = aFALSETxt;
+/*N*/
+/*N*/ // OS 21.08.97: #42943# Datenbankausdruecke muessen sich von
+/*N*/ // einfachem Text unterscheiden. also wird der einfache Text
+/*N*/ // bevorzugt in Anfuehrungszeichen gesetzt.
+/*N*/ // Sind diese vorhanden werden umschliessende entfernt.
+/*N*/ // Wenn nicht, dann wird auf die Tauglichkeit als Datenbankname
+/*N*/ // geprueft. Nur wenn zwei oder mehr Punkte vorhanden sind und kein
+/*N*/ // Anfuehrungszeichen enthalten ist, gehen wir von einer DB aus.
+/*N*/ if(sTmpName.Len() > 1 && sTmpName.GetChar(0) == '\"' &&
+/*N*/ sTmpName.GetChar((sTmpName.Len() - 1)))
+/*N*/ {
+/*N*/ aContent = sTmpName.Copy(1, sTmpName.Len() - 2);
+/*N*/ bValid = sal_True;
+/*N*/ }
+/*N*/ else if(sTmpName.Search('\"') == STRING_NOTFOUND &&
+/*N*/ sTmpName.GetTokenCount('.') > 2)
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwHiddenTxtField::GetCntnt(sal_Bool bName) const
+/*N*/ {
+/*N*/ if ( bName )
+/*N*/ {
+/*?*/ String aStr(SwFieldType::GetTypeStr(nSubType));
+/*?*/ aStr += ' ';
+/*?*/ aStr += aCond;
+/*?*/ aStr += ' ';
+/*?*/ aStr += aTRUETxt;
+/*?*/
+/*?*/ if(nSubType == TYP_CONDTXTFLD)
+/*?*/ {
+/*?*/ static char __READONLY_DATA cTmp[] = " : ";
+/*?*/ aStr.AppendAscii(cTmp);
+/*?*/ aStr += aFALSETxt;
+/*?*/ }
+/*?*/ return aStr;
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwField* SwHiddenTxtField::Copy() const
+/*N*/ {
+/*N*/ SwHiddenTxtField* pFld =
+/*N*/ new SwHiddenTxtField((SwHiddenTxtFieldType*)GetTyp(), aCond,
+/*N*/ aTRUETxt, aFALSETxt);
+/*N*/ pFld->bIsHidden = bIsHidden;
+/*N*/ pFld->bValid = bValid;
+/*N*/ pFld->aContent = aContent;
+/*N*/ pFld->SetFormat(GetFormat());
+/*N*/ pFld->nSubType = nSubType;
+/*N*/ return pFld;
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bedingung setzen
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwHiddenTxtField::SetPar1(const String& rStr)
+/*N*/ {
+/*N*/ aCond = rStr;
+/*N*/ bCanToggle = aCond.Len() > 0;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ const String& SwHiddenTxtField::GetPar1() const
+/*N*/ {
+/*N*/ return aCond;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: True/False Text
+ --------------------------------------------------------------------*/
+
+void SwHiddenTxtField::SetPar2(const String& rStr)
+{
+ if(nSubType == TYP_CONDTXTFLD)
+ {
+ sal_uInt16 nPos = rStr.Search('|');
+ aTRUETxt = rStr.Copy(0, nPos);
+
+ if(nPos != STRING_NOTFOUND)
+ aFALSETxt = rStr.Copy(nPos + 1);
+ }
+ else
+ aTRUETxt = rStr;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwHiddenTxtField::GetPar2() const
+/*N*/ {
+/*N*/ String aRet(aTRUETxt);
+/*N*/ if(nSubType == TYP_CONDTXTFLD)
+/*N*/ {
+/*N*/ aRet += '|';
+/*N*/ aRet += aFALSETxt;
+/*N*/ }
+/*N*/ return aRet;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ sal_uInt16 SwHiddenTxtField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ BOOL SwHiddenTxtField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ const String* pOut = 0;
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ pOut = &aCond;
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ pOut = &aTRUETxt;
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR3:
+/*N*/ pOut = &aFALSETxt;
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ sal_Bool bHidden = bIsHidden;
+/*N*/ rAny.setValue(&bHidden, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ if( pOut )
+/*N*/ rAny <<= OUString( *pOut );
+/*N*/ return sal_True;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwHiddenTxtField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ {
+ String sVal;
+ SetPar1(binfilter::GetString( rAny, sVal ));
+ }
+ break;
+ case FIELD_PROP_PAR2:
+ ::binfilter::GetString( rAny, aTRUETxt );
+ break;
+ case FIELD_PROP_PAR3:
+ ::binfilter::GetString( rAny, aFALSETxt );
+ break;
+ case FIELD_PROP_BOOL1:
+ bIsHidden = *(sal_Bool*)rAny.getValue();
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+//------------------------------------------------------------------------------
+
+
+//------------------------------------------------------------------------------
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Feldtyp fuer Zeilenhoehe 0
+ --------------------------------------------------------------------*/
+
+/*N*/ SwHiddenParaFieldType::SwHiddenParaFieldType()
+/*N*/ : SwFieldType( RES_HIDDENPARAFLD )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFieldType* SwHiddenParaFieldType::Copy() const
+/*N*/ {
+ SwHiddenParaFieldType* pType = new SwHiddenParaFieldType();
+ return pType;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Das Feld Zeilenhoehe 0
+ --------------------------------------------------------------------*/
+
+/*N*/ SwHiddenParaField::SwHiddenParaField(SwHiddenParaFieldType* pType, const String& rStr)
+/*N*/ : SwField(pType), aCond(rStr)
+/*N*/ {
+/*N*/ bIsHidden = sal_False;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwHiddenParaField::Expand() const
+/*N*/ {
+/*N*/ return aEmptyStr;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwField* SwHiddenParaField::Copy() const
+/*N*/ {
+/*N*/ SwHiddenParaField* pFld = new SwHiddenParaField((SwHiddenParaFieldType*)GetTyp(), aCond);
+/*N*/ pFld->bIsHidden = bIsHidden;
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+/*-----------------05.03.98 13:25-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwHiddenParaField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch ( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ rAny <<= OUString(aCond);
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ sal_Bool bHidden = bIsHidden;
+/*N*/ rAny.setValue(&bHidden, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 13:25-------------------
+
+--------------------------------------------------*/
+BOOL SwHiddenParaField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch ( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ ::binfilter::GetString( rAny, aCond );
+ break;
+ case FIELD_PROP_BOOL1:
+ bIsHidden = *(sal_Bool*)rAny.getValue();
+ break;
+
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bedingung setzen
+ --------------------------------------------------------------------*/
+
+void SwHiddenParaField::SetPar1(const String& rStr)
+{
+ aCond = rStr;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ const String& SwHiddenParaField::GetPar1() const
+/*N*/ {
+/*N*/ return aCond;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: PostIt
+ --------------------------------------------------------------------*/
+
+/*N*/ SwPostItFieldType::SwPostItFieldType()
+/*N*/ : SwFieldType( RES_POSTITFLD )
+/*N*/ {}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwFieldType* SwPostItFieldType::Copy() const
+/*N*/ {
+ return new SwPostItFieldType;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwPostItFieldType
+ --------------------------------------------------------------------*/
+
+/*?*/ SwPostItField::SwPostItField( SwPostItFieldType* pType,
+/*?*/ const String& rAuthor, const String& rTxt, const Date& rDate )
+/*?*/ : SwField( pType ), sTxt( rTxt ), sAuthor( rAuthor ), aDate( rDate )
+/*?*/ {
+/*?*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*?*/ String SwPostItField::Expand() const
+/*?*/ {
+/*?*/ return aEmptyStr;
+/*?*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwField* SwPostItField::Copy() const
+{
+ return new SwPostItField( (SwPostItFieldType*)GetTyp(), sAuthor,
+ sTxt, aDate );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Author setzen
+ --------------------------------------------------------------------*/
+
+void SwPostItField::SetPar1(const String& rStr)
+{
+ sAuthor = rStr;
+}
+
+const String& SwPostItField::GetPar1() const
+{
+ return sAuthor;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Text fuers PostIt setzen
+ --------------------------------------------------------------------*/
+
+void SwPostItField::SetPar2(const String& rStr)
+{
+ sTxt = rStr;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwPostItField::GetPar2() const
+{
+ return sTxt;
+}
+
+/*-----------------05.03.98 13:42-------------------
+
+--------------------------------------------------*/
+BOOL SwPostItField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ rAny <<= OUString(sAuthor);
+ break;
+ case FIELD_PROP_PAR2:
+ rAny <<= OUString(sTxt);
+ break;
+ case FIELD_PROP_DATE:
+ {
+ util::Date aSetDate;
+ aSetDate.Day = aDate.GetDay();
+ aSetDate.Month = aDate.GetMonth();
+ aSetDate.Year = aDate.GetYear();
+ rAny.setValue(&aSetDate, ::getCppuType((util::Date*)0));
+ }
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+/*-----------------05.03.98 13:42-------------------
+
+--------------------------------------------------*/
+BOOL SwPostItField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ ::binfilter::GetString( rAny, sAuthor );
+ break;
+ case FIELD_PROP_PAR2:
+ ::binfilter::GetString( rAny, sTxt );
+ break;
+ case FIELD_PROP_DATE:
+ if( rAny.getValueType() == ::getCppuType((util::Date*)0) )
+ {
+ util::Date aSetDate = *(util::Date*)rAny.getValue();
+ aDate = Date(aSetDate.Day, aSetDate.Month, aSetDate.Year);
+ }
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: DokumentinfoFields
+ --------------------------------------------------------------------*/
+
+/*N*/ SwExtUserFieldType::SwExtUserFieldType()
+/*N*/ : SwFieldType( RES_EXTUSERFLD )
+/*N*/ {
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwFieldType* SwExtUserFieldType::Copy() const
+/*N*/ {
+ SwExtUserFieldType* pType = new SwExtUserFieldType;
+ return pType;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwExtUserFieldType::Expand(sal_uInt16 nSub, sal_uInt32 nFormat) const
+/*N*/ {
+/*N*/ SvxAddressItem aAdr;
+/*N*/ String aRet( aEmptyStr );
+/*N*/ sal_uInt16 nRet = USHRT_MAX;
+/*N*/ switch(nSub)
+/*N*/ {
+/*N*/ case EU_FIRSTNAME: aRet = aAdr.GetFirstName(); break;
+/*N*/ case EU_NAME: aRet = aAdr.GetName(); break;
+/*N*/ case EU_SHORTCUT: aRet = aAdr.GetShortName(); break;
+/*N*/
+/*N*/ case EU_COMPANY: nRet = POS_COMPANY; break;
+/*N*/ case EU_STREET: nRet = POS_STREET; break;
+/*N*/ case EU_TITLE: nRet = POS_TITLE; break;
+/*N*/ case EU_POSITION: nRet = POS_POSITION; break;
+/*N*/ case EU_PHONE_PRIVATE: nRet = POS_TEL_PRIVATE; break;
+/*N*/ case EU_PHONE_COMPANY: nRet = POS_TEL_COMPANY; break;
+/*N*/ case EU_FAX: nRet = POS_FAX; break;
+/*N*/ case EU_EMAIL: nRet = POS_EMAIL; break;
+/*N*/ case EU_COUNTRY: nRet = POS_COUNTRY; break;
+/*N*/ case EU_ZIP: nRet = POS_PLZ; break;
+/*N*/ case EU_CITY: nRet = POS_CITY; break;
+/*N*/ case EU_STATE: nRet = POS_STATE; break;
+/*?*/ case EU_FATHERSNAME: nRet = POS_FATHERSNAME; break;
+/*?*/ case EU_APARTMENT: nRet = POS_APARTMENT; break;
+/*?*/ default: ASSERT( !this, "Field unknown");
+/*N*/ }
+/*N*/ if( USHRT_MAX != nRet )
+/*N*/ aRet = aAdr.GetToken( nRet );
+/*N*/ return aRet;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwExtUserField::SwExtUserField(SwExtUserFieldType* pType, sal_uInt16 nSubTyp, sal_uInt32 nFmt) :
+/*N*/ SwField(pType, nFmt), nType(nSubTyp)
+/*N*/ {
+/*N*/ aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat());
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwExtUserField::Expand() const
+/*N*/ {
+/*N*/ if (!IsFixed())
+/*N*/ ((SwExtUserField*)this)->aContent = ((SwExtUserFieldType*)GetTyp())->Expand(nType, GetFormat());
+/*N*/
+/*N*/ return aContent;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwField* SwExtUserField::Copy() const
+/*N*/ {
+/*N*/ SwExtUserField* pFld = new SwExtUserField((SwExtUserFieldType*)GetTyp(), nType, GetFormat());
+/*N*/ pFld->SetExpansion(aContent);
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ sal_uInt16 SwExtUserField::GetSubType() const
+/*N*/ {
+/*N*/ return nType;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwExtUserField::SetSubType(sal_uInt16 nSub)
+{
+ nType = nSub;
+}
+
+/*-----------------05.03.98 14:14-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwExtUserField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ rAny <<= OUString(aContent);
+/*?*/ break;
+/*N*/
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ {
+/*N*/ sal_Int16 nTmp = nType;
+/*N*/ rAny <<= nTmp;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ sal_Bool bTmp = IsFixed();
+/*N*/ rAny.setValue(&bTmp, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 14:14-------------------
+
+--------------------------------------------------*/
+BOOL SwExtUserField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ ::binfilter::GetString( rAny, aContent );
+ break;
+
+ case FIELD_PROP_USHORT1:
+ {
+ sal_Int16 nTmp;
+ rAny >>= nTmp;
+ nType = nTmp;
+ }
+ break;
+ case FIELD_PROP_BOOL1:
+ if( *(sal_Bool*)rAny.getValue() )
+ SetFormat(GetFormat() | AF_FIXED);
+ else
+ SetFormat(GetFormat() & ~AF_FIXED);
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+//-------------------------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung: Relatives Seitennummern - Feld
+ --------------------------------------------------------------------*/
+
+/*N*/ SwRefPageSetFieldType::SwRefPageSetFieldType()
+/*N*/ : SwFieldType( RES_REFPAGESETFLD )
+/*N*/ {
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwFieldType* SwRefPageSetFieldType::Copy() const
+/*N*/ {
+ return new SwRefPageSetFieldType;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+// ueberlagert, weil es nichts zum Updaten gibt!
+
+/*--------------------------------------------------------------------
+ Beschreibung: Relative Seitennummerierung
+ --------------------------------------------------------------------*/
+
+/*?*/ SwRefPageSetField::SwRefPageSetField( SwRefPageSetFieldType* pType,
+/*?*/ short nOff, sal_Bool bFlag )
+/*?*/ : SwField( pType ), nOffset( nOff ), bOn( bFlag )
+/*?*/ {
+/*?*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*?*/ String SwRefPageSetField::Expand() const
+/*?*/ {
+/*?*/ return aEmptyStr;
+/*?*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwField* SwRefPageSetField::Copy() const
+{
+ return new SwRefPageSetField( (SwRefPageSetFieldType*)GetTyp(), nOffset, bOn );
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwRefPageSetField::GetPar2() const
+{
+ return String::CreateFromInt32( GetOffset() );
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwRefPageSetField::SetPar2(const String& rStr)
+{
+ SetOffset( (short) rStr.ToInt32() );
+}
+
+/*-----------------05.03.98 14:52-------------------
+
+--------------------------------------------------*/
+BOOL SwRefPageSetField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_BOOL1:
+ rAny.setValue(&bOn, ::getBooleanCppuType());
+ break;
+ case FIELD_PROP_USHORT1:
+ rAny <<= (sal_Int16)nOffset;
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+/*-----------------05.03.98 14:52-------------------
+
+--------------------------------------------------*/
+BOOL SwRefPageSetField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_BOOL1:
+ bOn = *(sal_Bool*)rAny.getValue();
+ break;
+ case FIELD_PROP_USHORT1:
+ rAny >>=nOffset;
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: relatives Seitennummern - Abfrage Feld
+ --------------------------------------------------------------------*/
+
+/*N*/ SwRefPageGetFieldType::SwRefPageGetFieldType( SwDoc* pDc )
+/*N*/ : SwFieldType( RES_REFPAGEGETFLD ), nNumberingType( SVX_NUM_ARABIC ), pDoc( pDc )
+/*N*/ {
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwFieldType* SwRefPageGetFieldType::Copy() const
+/*N*/ {
+ SwRefPageGetFieldType* pNew = new SwRefPageGetFieldType( pDoc );
+ pNew->nNumberingType = nNumberingType;
+ return pNew;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwRefPageGetFieldType::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ // Update auf alle GetReferenz-Felder
+/*N*/ if( !pNew && !pOld && GetDepends() )
+/*N*/ {
+/*?*/ // sammel erstmal alle SetPageRefFelder ein.
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 _SetGetExpFlds aTmpLst( 10, 5 );
+/*N*/ }
+/*N*/
+/*N*/ // weiter an die Text-Felder, diese "Expandieren" den Text
+/*N*/ SwModify::Modify( pOld, pNew );
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: Relative Seitennummerierung Abfragen
+ --------------------------------------------------------------------*/
+
+/*?*/ SwRefPageGetField::SwRefPageGetField( SwRefPageGetFieldType* pType,
+/*?*/ sal_uInt32 nFmt )
+/*?*/ : SwField( pType, nFmt )
+/*?*/ {
+/*?*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*?*/ String SwRefPageGetField::Expand() const
+/*?*/ {
+/*?*/ return sTxt;
+/*?*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwField* SwRefPageGetField::Copy() const
+{
+ SwRefPageGetField* pCpy = new SwRefPageGetField(
+ (SwRefPageGetFieldType*)GetTyp(), GetFormat() );
+ pCpy->SetText( sTxt );
+ return pCpy;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*-----------------05.03.98 14:52-------------------
+
+--------------------------------------------------*/
+BOOL SwRefPageGetField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_USHORT1:
+ rAny <<= (sal_Int16)GetFormat();
+ break;
+ case FIELD_PROP_PAR1:
+ rAny <<= OUString(sTxt);
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+/*-----------------05.03.98 14:52-------------------
+
+--------------------------------------------------*/
+BOOL SwRefPageGetField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_USHORT1:
+ {
+ sal_Int16 nSet;
+ rAny >>= nSet;
+ if(nSet <= SVX_NUM_PAGEDESC )
+ SetFormat(nSet);
+ else
+ //exception(wrong_value)
+ ;
+ }
+ break;
+ case FIELD_PROP_PAR1:
+ {
+ OUString sTmp;
+ rAny >>= sTmp;
+ sTxt = sTmp;
+ }
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feld zum Anspringen und Editieren
+ --------------------------------------------------------------------*/
+
+/*N*/ SwJumpEditFieldType::SwJumpEditFieldType( SwDoc* pD )
+/*N*/ : SwFieldType( RES_JUMPEDITFLD ), pDoc( pD ), aDep( this, 0 )
+/*N*/ {
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwFieldType* SwJumpEditFieldType::Copy() const
+/*N*/ {
+ return new SwJumpEditFieldType( pDoc );
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwCharFmt* SwJumpEditFieldType::GetCharFmt()
+/*N*/ {
+/*N*/ SwCharFmt* pFmt = pDoc->GetCharFmtFromPool( RES_POOLCHR_JUMPEDIT );
+/*N*/
+/*N*/ // noch nicht registriert ?
+/*N*/ if( !aDep.GetRegisteredIn() )
+/*N*/ pFmt->Add( &aDep ); // anmelden
+/*N*/
+/*N*/ return pFmt;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwJumpEditField::SwJumpEditField( SwJumpEditFieldType* pTyp, sal_uInt32 nFormat,
+/*N*/ const String& rTxt, const String& rHelp )
+/*N*/ : SwField( pTyp, nFormat ), sTxt( rTxt ), sHelp( rHelp )
+/*N*/ {
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwJumpEditField::Expand() const
+/*N*/ {
+/*N*/ String sTmp( '<' );
+/*N*/ sTmp += sTxt;
+/*N*/ return sTmp += '>';
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ SwField* SwJumpEditField::Copy() const
+/*N*/ {
+/*N*/ return new SwJumpEditField( (SwJumpEditFieldType*)GetTyp(), GetFormat(),
+/*N*/ sTxt, sHelp );
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+// Platzhalter-Text
+
+/*N*/ const String& SwJumpEditField::GetPar1() const
+/*N*/ {
+/*N*/ return sTxt;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwJumpEditField::SetPar1(const String& rStr)
+{
+ sTxt = rStr;
+}
+
+// HinweisText
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ String SwJumpEditField::GetPar2() const
+/*N*/ {
+/*N*/ return sHelp;
+/*N*/ }
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwJumpEditField::SetPar2(const String& rStr)
+{
+ sHelp = rStr;
+}
+
+/*-----------------05.03.98 15:00-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwJumpEditField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ {
+/*N*/ sal_Int16 nRet;
+/*N*/ switch( GetFormat() )
+/*N*/ {
+/*N*/ case JE_FMT_TABLE: nRet = text::PlaceholderType::TABLE; break;
+/*N*/ case JE_FMT_FRAME: nRet = text::PlaceholderType::TEXTFRAME; break;
+/*N*/ case JE_FMT_GRAPHIC:nRet = text::PlaceholderType::GRAPHIC; break;
+/*N*/ case JE_FMT_OLE: nRet = text::PlaceholderType::OBJECT; break;
+/*N*/ // case JE_FMT_TEXT:
+/*N*/ default:
+/*N*/ nRet = text::PlaceholderType::TEXT; break;
+/*N*/ }
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1 :
+/*N*/ rAny <<= OUString(sHelp);
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2 :
+/*?*/ rAny <<= OUString(sTxt);
+/*?*/ break;
+/*?*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------05.03.98 15:00-------------------
+
+--------------------------------------------------*/
+BOOL SwJumpEditField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_USHORT1:
+ {
+ //JP 24.10.2001: int32 because in UnoField.cxx a putvalue is
+ // called with a int32 value! But normally we need
+ // here only a int16
+ sal_Int32 nSet;
+ rAny >>= nSet;
+ switch( nSet )
+ {
+ case text::PlaceholderType::TEXT : SetFormat(JE_FMT_TEXT); break;
+ case text::PlaceholderType::TABLE : SetFormat(JE_FMT_TABLE); break;
+ case text::PlaceholderType::TEXTFRAME: SetFormat(JE_FMT_FRAME); break;
+ case text::PlaceholderType::GRAPHIC : SetFormat(JE_FMT_GRAPHIC); break;
+ case text::PlaceholderType::OBJECT : SetFormat(JE_FMT_OLE); break;
+ }
+ }
+ break;
+ case FIELD_PROP_PAR1 :
+ ::binfilter::GetString( rAny, sHelp );
+ break;
+ case FIELD_PROP_PAR2 :
+ ::binfilter::GetString( rAny, sTxt);
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Combined Character Fieldtype / Field
+ --------------------------------------------------------------------*/
+
+/*N*/ SwCombinedCharFieldType::SwCombinedCharFieldType()
+/*N*/ : SwFieldType( RES_COMBINED_CHARS )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFieldType* SwCombinedCharFieldType::Copy() const
+/*N*/ {
+ return new SwCombinedCharFieldType;
+/*N*/ }
+
+/* --------------------------------------------------------------------*/
+
+/*?*/ SwCombinedCharField::SwCombinedCharField( SwCombinedCharFieldType* pFTyp,
+/*?*/ const String& rChars )
+/*?*/ : SwField( pFTyp, 0 ),
+/*?*/ sCharacters( rChars.Copy( 0, MAX_COMBINED_CHARACTERS ))
+/*?*/ {
+/*?*/ }
+
+/*?*/ String SwCombinedCharField::Expand() const
+/*?*/ {
+/*?*/ return sCharacters;
+/*?*/ }
+
+SwField* SwCombinedCharField::Copy() const
+{
+ return new SwCombinedCharField( (SwCombinedCharFieldType*)GetTyp(),
+ sCharacters );
+}
+
+const String& SwCombinedCharField::GetPar1() const
+{
+ return sCharacters;
+}
+
+void SwCombinedCharField::SetPar1(const String& rStr)
+{
+ sCharacters = rStr.Copy( 0, MAX_COMBINED_CHARACTERS );
+}
+
+BOOL SwCombinedCharField::QueryValue( ::com::sun::star::uno::Any& rAny,
+ BYTE nMId ) const
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ rAny <<= ::rtl::OUString( sCharacters );
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+BOOL SwCombinedCharField::PutValue( const ::com::sun::star::uno::Any& rAny,
+ BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ ::binfilter::GetString( rAny, sCharacters ).Erase( MAX_COMBINED_CHARACTERS );
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_expfld.cxx b/binfilter/bf_sw/source/core/fields/sw_expfld.cxx
new file mode 100644
index 000000000000..53a12d490b52
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_expfld.cxx
@@ -0,0 +1,1122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <unotools/charclass.hxx>
+#include <bf_svx/unolingu.hxx>
+#include <bf_svx/pageitem.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/fontitem.hxx>
+#include <com/sun/star/text/SetVariableType.hpp>
+
+
+#include <errhdl.hxx>
+
+#include <unofield.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <fmtanchr.hxx>
+#include <txtftn.hxx>
+
+#include <horiornt.hxx>
+
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <tabfrm.hxx>
+#include <flyfrm.hxx>
+#include <ftnfrm.hxx>
+#include <expfld.hxx>
+#include <usrfld.hxx>
+#include <ndtxt.hxx>
+#include <docfld.hxx>
+#include <swcache.hxx>
+#include <swtable.hxx>
+#include <breakit.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::rtl;
+
+/*N*/ void InsertSort( SvUShorts& rArr, USHORT nIdx )
+/*N*/ {
+/*N*/ register USHORT nO = rArr.Count(), nM, nU = 0;
+/*N*/ if( nO > 0 )
+/*N*/ {
+/*N*/ nO--;
+/*N*/ while( nU <= nO )
+/*N*/ {
+/*N*/ nM = nU + ( nO - nU ) / 2;
+/*N*/ if( *(rArr.GetData() + nM) == nIdx )
+/*N*/ {
+/*N*/ ASSERT( FALSE, "Index ist schon vorhanden, darf nie sein!" );
+/*N*/ return;
+/*N*/ }
+/*N*/ if( *(rArr.GetData() + nM) < nIdx )
+/*N*/ nU = nM + 1;
+/*N*/ else if( nM == 0 )
+/*N*/ break;
+/*N*/ else
+/*N*/ nO = nM - 1;
+/*N*/ }
+/*N*/ }
+/*N*/ rArr.Insert( nIdx, nU );
+/*N*/ }
+
+//-----------------------------------------------------------------------------
+/*N*/ sal_Int16 lcl_SubTypeToAPI(USHORT nSubType)
+/*N*/ {
+/*N*/ sal_Int16 nRet = -1;
+/*N*/ switch(nSubType)
+/*N*/ {
+/*N*/ case GSE_EXPR : nRet = SetVariableType::VAR /*0*/; break;
+/*N*/ case GSE_SEQ : nRet = SetVariableType::SEQUENCE /*1*/; break;
+/*N*/ case GSE_FORMULA: nRet = SetVariableType::FORMULA /*2*/; break;
+/*N*/ case GSE_STRING : nRet = SetVariableType::STRING /*3*/; break;
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+//-----------------------------------------------------------------------------
+/*N*/ sal_Int32 lcl_APIToSubType(const uno::Any& rAny)
+/*N*/ {
+/*N*/ sal_Int16 nVal;
+/*N*/ rAny >>= nVal;
+/*N*/ sal_Int32 nSet = 0;
+/*N*/ switch(nVal)
+/*N*/ {
+/*N*/ case SetVariableType::VAR: nSet = GSE_EXPR; break;
+/*N*/ case SetVariableType::SEQUENCE: nSet = GSE_SEQ; break;
+/*?*/ case SetVariableType::FORMULA: nSet = GSE_FORMULA; break;
+/*N*/ case SetVariableType::STRING: nSet = GSE_STRING; break;
+/*N*/ default:
+/*?*/ DBG_ERROR("wrong value");
+/*?*/ nSet = -1;
+/*N*/ }
+/*N*/ return nSet;
+/*N*/ }
+//-----------------------------------------------------------------------------
+
+/*N*/ void ReplacePoint( String& rTmpName, BOOL bWithCommandType )
+/*N*/ {
+/*N*/ // replace first and last (if bWithCommandType: last two) dot Ersten und letzten Punkt ersetzen, da in Tabellennamen Punkte erlaubt sind
+/*N*/ // since table names may contain dots
+/*N*/
+/*N*/ xub_StrLen nLen = rTmpName.Len();
+/*N*/ sal_Unicode *pStr = rTmpName.GetBufferAccess(), *pBackStr = pStr + nLen;
+/*N*/
+/*N*/ long nBackCount = bWithCommandType ? 2 : 1;
+ xub_StrLen i;
+/*N*/ for( i = nLen; i; --i, pBackStr-- )
+/*N*/ if( '.' == *pBackStr )
+/*N*/ {
+/*?*/ *pBackStr = DB_DELIM;
+/*?*/ if(!--nBackCount)
+/*?*/ break;
+/*N*/ }
+/*N*/ for( i = 0; i < nLen; ++i, ++pStr )
+/*N*/ if( '.' == *pStr )
+/*N*/ {
+/*?*/ *pStr = DB_DELIM;
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwTxtNode* GetFirstTxtNode( const SwDoc& rDoc, SwPosition& rPos,
+/*N*/ const SwCntntFrm *pCFrm, Point &rPt )
+/*N*/ {
+/*N*/ SwTxtNode* pTxtNode;
+/*N*/ if ( !pCFrm )
+/*N*/ {
+/*?*/ rPos.nNode = *rDoc.GetNodes().GetEndOfContent().StartOfSectionNode();
+/*?*/ SwCntntNode* pCNd;
+/*?*/ while( 0 != (pCNd = rDoc.GetNodes().GoNext( &rPos.nNode ) ) &&
+/*?*/ 0 == ( pTxtNode = pCNd->GetTxtNode() ) )
+/*?*/ ;
+/*?*/ ASSERT( pTxtNode, "wo ist der 1.TextNode" );
+/*?*/ rPos.nContent.Assign( pTxtNode, 0 );
+/*N*/ }
+/*N*/ else if ( !pCFrm->IsValid() )
+/*N*/ {
+/*N*/ pTxtNode = (SwTxtNode*)pCFrm->GetNode();
+/*N*/ rPos.nNode = *pTxtNode;
+/*N*/ rPos.nContent.Assign( pTxtNode, 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pCFrm->GetCrsrOfst( &rPos, rPt );
+/*N*/ pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+/*N*/ }
+/*N*/ return pTxtNode;
+/*N*/ }
+
+/*N*/ const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos,
+/*N*/ const SwFrm& rFrm )
+/*N*/ {
+/*N*/ const SwLayoutFrm* pLayout = (SwLayoutFrm*)rFrm.GetUpper();
+/*N*/ const SwTxtNode* pTxtNode = 0;
+/*N*/
+/*N*/ while( pLayout )
+/*N*/ {
+/*N*/ if( pLayout->IsFlyFrm() )
+/*N*/ {
+/*N*/ // hole das FlyFormat
+/*N*/ SwFrmFmt* pFlyFmt = ((SwFlyFrm*)pLayout)->GetFmt();
+/*N*/ ASSERT( pFlyFmt, "kein FlyFormat gefunden, wo steht das Feld" );
+/*N*/
+/*N*/ const SwFmtAnchor &rAnchor = pFlyFmt->GetAnchor();
+/*N*/
+/*N*/ if( FLY_AT_FLY == rAnchor.GetAnchorId() )
+/*N*/ {
+/*N*/ // und der Fly muss irgendwo angehaengt sein, also
+/*N*/ // den befragen
+/*?*/ pLayout = (SwLayoutFrm*)((SwFlyFrm*)pLayout)->GetAnchor();
+/*?*/ continue;
+/*N*/ }
+/*N*/ else if( FLY_AT_CNTNT == rAnchor.GetAnchorId() ||
+/*N*/ FLY_AUTO_CNTNT == rAnchor.GetAnchorId() ||
+/*N*/ FLY_IN_CNTNT == rAnchor.GetAnchorId() )
+/*N*/ {
+/*N*/ ASSERT( rAnchor.GetCntntAnchor(), "keine gueltige Position" );
+/*N*/ rPos = *rAnchor.GetCntntAnchor();
+/*N*/ pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+/*N*/ if( FLY_AT_CNTNT == rAnchor.GetAnchorId() )
+/*?*/ ((SwTxtNode*)pTxtNode)->MakeStartIndex( &rPos.nContent );
+/*N*/ // oder doch besser das Ende vom (Anker-)TextNode nehmen ??
+/*N*/ // ((SwTxtNode*)pTxtNode)->MakeEndIndex( &rPos.nContent );
+/*N*/
+/*N*/ // noch nicht abbrechen, kann ja auch noch im
+/*N*/ // Header/Footer/Footnote/Fly stehen !!
+/*N*/ pLayout = ((SwFlyFrm*)pLayout)->GetAnchor()
+/*N*/ ? ((SwFlyFrm*)pLayout)->GetAnchor()->GetUpper() : 0;
+/*N*/ continue;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pLayout->FindPageFrm()->GetCntntPosition(
+/*N*/ pLayout->Frm().Pos(), rPos );
+/*N*/ pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pLayout->IsFtnFrm() )
+/*N*/ {
+/*?*/ // hole den Node vom Anker
+/*?*/ const SwTxtFtn* pFtn = ((SwFtnFrm*)pLayout)->GetAttr();
+/*?*/ pTxtNode = &pFtn->GetTxtNode();
+/*?*/ rPos.nNode = *pTxtNode;
+/*?*/ rPos.nContent = *pFtn->GetStart();
+/*N*/ }
+/*N*/ else if( pLayout->IsHeaderFrm() || pLayout->IsFooterFrm() )
+/*N*/ {
+/*N*/ const SwCntntFrm* pCntFrm;
+/*N*/ const SwPageFrm* pPgFrm = pLayout->FindPageFrm();
+/*N*/ if( pLayout->IsHeaderFrm() )
+/*N*/ {
+/*N*/ const SwTabFrm *pTab;
+/*N*/ if( 0 != ( pCntFrm = pPgFrm->FindFirstBodyCntnt()) &&
+/*N*/ 0 != (pTab = pCntFrm->FindTabFrm()) && pTab->IsFollow() &&
+/*N*/ pTab->GetTable()->IsHeadlineRepeat() &&
+/*N*/ ((SwLayoutFrm*)pTab->Lower())->IsAnLower( pCntFrm ))
+/*N*/ {
+/*N*/ // take the next line
+/*N*/ const SwLayoutFrm* pRow = (SwLayoutFrm*)pTab->Lower();
+/*N*/ pRow = (SwLayoutFrm*)pRow->GetNext();
+/*N*/ pCntFrm = pRow->ContainsCntnt();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ pCntFrm = pPgFrm->FindLastBodyCntnt();
+/*N*/
+/*N*/ if( pCntFrm )
+/*N*/ {
+/*N*/ pTxtNode = pCntFrm->GetNode()->GetTxtNode();
+/*N*/ rPos.nNode = *pTxtNode;
+/*N*/ ((SwTxtNode*)pTxtNode)->MakeEndIndex( &rPos.nContent );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Point aPt( pLayout->Frm().Pos() );
+/*N*/ aPt.Y()++; // aus dem Header raus
+/*N*/ pCntFrm = pPgFrm->GetCntntPos( aPt, FALSE, TRUE, FALSE );
+/*N*/ pTxtNode = GetFirstTxtNode( rDoc, rPos, pCntFrm, aPt );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pLayout = pLayout->GetUpper();
+/*N*/ continue;
+/*N*/ }
+/*N*/ break; // gefunden und beende die Schleife
+/*N*/ }
+/*N*/ return pTxtNode;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwSetExpFieldType by JP
+ --------------------------------------------------------------------*/
+
+/*N*/ SwGetExpFieldType::SwGetExpFieldType(SwDoc* pDoc)
+/*N*/ : SwValueFieldType( pDoc, RES_GETEXPFLD )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFieldType* SwGetExpFieldType::Copy() const
+/*N*/ {
+ return new SwGetExpFieldType(GetDoc());
+/*N*/ }
+
+/*N*/ void SwGetExpFieldType::Modify( SfxPoolItem*, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ if( pNew && RES_DOCPOS_UPDATE == pNew->Which() )
+/*N*/ SwModify::Modify( 0, pNew );
+/*N*/ // sonst nichts weiter expandieren
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwGetExpField by JP
+ --------------------------------------------------------------------*/
+
+/*N*/ SwGetExpField::SwGetExpField(SwGetExpFieldType* pTyp, const String& rFormel,
+/*N*/ USHORT nSub, ULONG nFmt)
+/*N*/ : SwFormulaField( pTyp, nFmt, 0.0 ),
+/*N*/ nSubType(nSub),
+/*N*/ bIsInBodyTxt( TRUE )
+/*N*/ {
+/*N*/ SetFormula( rFormel );
+/*N*/ }
+
+/*N*/ String SwGetExpField::Expand() const
+/*N*/ {
+/*N*/ if(nSubType & SUB_CMD)
+/*N*/ return GetFormula();
+/*N*/ else
+/*N*/ return sExpand;
+/*N*/ }
+
+/*N*/ String SwGetExpField::GetCntnt(BOOL bName) const
+/*N*/ {
+/*N*/ if ( bName )
+/*N*/ {
+/*?*/ String aStr( SwFieldType::GetTypeStr( GSE_FORMULA & nSubType
+/*?*/ ? TYP_FORMELFLD
+/*?*/ : TYP_GETFLD ) );
+/*?*/ aStr += ' ';
+/*?*/ aStr += GetFormula();
+/*?*/ return aStr;
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+
+/*N*/ SwField* SwGetExpField::Copy() const
+/*N*/ {
+/*N*/ SwGetExpField *pTmp = new SwGetExpField((SwGetExpFieldType*)GetTyp(),
+/*N*/ GetFormula(), nSubType, GetFormat());
+/*N*/ pTmp->SetLanguage(GetLanguage());
+/*N*/ pTmp->SwValueField::SetValue(GetValue());
+/*N*/ pTmp->sExpand = sExpand;
+/*N*/ pTmp->bIsInBodyTxt = bIsInBodyTxt;
+/*N*/ pTmp->SetAutomaticLanguage(IsAutomaticLanguage());
+/*N*/
+/*N*/ return pTmp;
+/*N*/ }
+
+
+String SwGetExpField::GetPar2() const
+{
+ return GetFormula();
+}
+
+void SwGetExpField::SetPar2(const String& rStr)
+{
+ SetFormula(rStr);
+}
+
+/*N*/ USHORT SwGetExpField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+/*N*/ void SwGetExpField::SetSubType(USHORT nType)
+/*N*/ {
+/*N*/ nSubType = nType;
+/*N*/ }
+
+/*N*/ void SwGetExpField::SetLanguage(USHORT nLng)
+/*N*/ {
+/*N*/ if (nSubType & SUB_CMD)
+/*N*/ SwField::SetLanguage(nLng);
+/*N*/ else
+/*N*/ SwValueField::SetLanguage(nLng);
+/*N*/ }
+
+/*-----------------07.03.98 16:08-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwGetExpField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_DOUBLE:
+/*N*/ rAny <<= GetValue();
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int32)GetFormat();
+/*N*/ break;
+/*N*/ case FIELD_PROP_USHORT1:
+/*?*/ rAny <<= (sal_Int16)nSubType;
+/*?*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ rAny <<= OUString( GetFormula() );
+/*N*/ break;
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ {
+/*N*/ sal_Int16 nRet = lcl_SubTypeToAPI(GetSubType() & 0xff);
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ BOOL bTmp = 0 != (nSubType & SUB_CMD);
+/*N*/ rAny.setValue(&bTmp, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR4:
+/*?*/ rAny <<= ::rtl::OUString(GetExpStr());
+/*?*/ break;
+/*?*/ default:
+/*?*/ return SwField::QueryValue(rAny, nMId);
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*-----------------07.03.98 16:08-------------------
+
+--------------------------------------------------*/
+BOOL SwGetExpField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ sal_Int32 nTmp;
+ String sTmp;
+ switch( nMId )
+ {
+ case FIELD_PROP_DOUBLE:
+ SwValueField::SetValue(*(double*) rAny.getValue());
+ break;
+ case FIELD_PROP_FORMAT:
+ rAny >>= nTmp;
+ SetFormat(nTmp);
+ break;
+ case FIELD_PROP_USHORT1:
+ rAny >>= nTmp;
+ nSubType = nTmp;
+ break;
+ case FIELD_PROP_PAR1:
+ SetFormula( binfilter::GetString( rAny, sTmp ));
+ break;
+ case FIELD_PROP_SUBTYPE:
+ nTmp = lcl_APIToSubType(rAny);
+ if( nTmp >=0 )
+ SetSubType( (GetSubType() & 0xff00) | nTmp);
+ break;
+ case FIELD_PROP_BOOL2:
+ if(*(sal_Bool*) rAny.getValue())
+ nSubType |= SUB_CMD;
+ else
+ nSubType &= (~SUB_CMD);
+ break;
+ case FIELD_PROP_PAR4:
+ ChgExpStr(binfilter::GetString( rAny, sTmp ));
+ break;
+ default:
+ return SwField::PutValue(rAny, nMId);
+ }
+ return TRUE;
+}
+
+/*-----------------JP: 17.06.93 -------------------
+ Set-Expression-Type
+ --------------------------------------------------*/
+
+/*N*/ SwSetExpFieldType::SwSetExpFieldType( SwDoc* pDoc, const String& rName, USHORT nTyp )
+/*N*/ : SwValueFieldType( pDoc, RES_SETEXPFLD ),
+/*N*/ sName( rName ),
+/*N*/ nType(nTyp),
+/*N*/ cDelim( '.' ), nLevel( UCHAR_MAX ),
+/*N*/ bDeleted( FALSE ),
+/*N*/ pOutlChgNd( 0 )
+/*N*/ {
+/*N*/ if( ( GSE_SEQ | GSE_STRING ) & nType )
+/*N*/ EnableFormat(FALSE); // Numberformatter nicht einsetzen
+/*N*/ }
+
+/*N*/ SwFieldType* SwSetExpFieldType::Copy() const
+/*N*/ {
+/*N*/ SwSetExpFieldType* pNew = new SwSetExpFieldType(GetDoc(), sName, nType);
+/*N*/ pNew->bDeleted = bDeleted;
+/*N*/ pNew->cDelim = cDelim;
+/*N*/ pNew->nLevel = nLevel;
+/*N*/
+/*N*/ return pNew;
+/*N*/ }
+
+/*N*/ const String& SwSetExpFieldType::GetName() const
+/*N*/ {
+/*N*/ return sName;
+/*N*/ }
+
+void SwSetExpFieldType::Modify( SfxPoolItem*, SfxPoolItem* )
+{
+ return; // nicht weiter expandieren
+}
+
+
+
+/*N*/ USHORT SwSetExpFieldType::SetSeqRefNo( SwSetExpField& rFld )
+/*N*/ {
+/*N*/ if( !GetDepends() || !(GSE_SEQ & nType) )
+/*?*/ return USHRT_MAX;
+/*N*/
+/*N*/ SvUShorts aArr( 64 );
+/*N*/
+/*N*/ USHORT n;
+/*N*/
+/*N*/ // dann testmal, ob die Nummer schon vergeben ist oder ob eine neue
+/*N*/ // bestimmt werden muss.
+/*N*/ SwClientIter aIter( *this );
+/*N*/ const SwTxtNode* pNd;
+/*N*/ for( SwFmtFld* pF = (SwFmtFld*)aIter.First( TYPE( SwFmtFld )); pF;
+/*N*/ pF = (SwFmtFld*)aIter.Next() )
+/*N*/ if( pF->GetFld() != &rFld && pF->GetTxtFld() &&
+/*N*/ 0 != ( pNd = pF->GetTxtFld()->GetpTxtNode() ) &&
+/*N*/ pNd->GetNodes().IsDocNodes() )
+/*N*/ ::binfilter::InsertSort( aArr, ((SwSetExpField*)pF->GetFld())->GetSeqNumber() );
+/*N*/
+/*N*/
+/*N*/ // teste erstmal ob die Nummer schon vorhanden ist:
+/*N*/ USHORT nNum = rFld.GetSeqNumber();
+/*N*/ if( USHRT_MAX != nNum )
+/*N*/ {
+/*N*/ for( n = 0; n < aArr.Count(); ++n )
+/*N*/ if( aArr[ n ] > nNum )
+/*?*/ return nNum; // nicht vorhanden -> also benutzen
+/*N*/ else if( aArr[ n ] == nNum )
+/*N*/ break; // schon vorhanden -> neue erzeugen
+/*N*/
+/*N*/ if( n == aArr.Count() )
+/*N*/ return nNum; // nicht vorhanden -> also benutzen
+/*N*/ }
+/*N*/
+/*N*/ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+/*N*/ for( n = 0; n < aArr.Count(); ++n )
+/*N*/ if( n != aArr[ n ] )
+/*?*/ break;
+/*N*/
+/*N*/ rFld.SetSeqNumber( n );
+/*N*/ return n;
+/*N*/ }
+
+
+
+
+/* -----------------24.03.99 09:44-------------------
+ *
+ * --------------------------------------------------*/
+/*N*/ BOOL SwSetExpFieldType::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ {
+/*N*/ sal_Int16 nRet = lcl_SubTypeToAPI(GetType());
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*?*/ rAny <<= OUString(GetDelimiter());
+/*?*/ break;
+/*N*/ case FIELD_PROP_SHORT1:
+/*N*/ {
+/*N*/ sal_Int8 nRet = nLevel < MAXLEVEL? nLevel : -1;
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL SwSetExpFieldType::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ {
+/*N*/ sal_Int32 nSet = lcl_APIToSubType(rAny);
+/*N*/ if(nSet >=0)
+/*N*/ SetType(nSet);
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ {
+/*?*/ String sTmp;
+/*?*/ if( ::binfilter::GetString( rAny, sTmp ).Len() )
+/*?*/ SetDelimiter( sTmp.GetChar( 0 ));
+/*?*/ else
+/*?*/ SetDelimiter(' ');
+/*?*/ }
+/*?*/ break;
+/*N*/ case FIELD_PROP_SHORT1:
+/*N*/ {
+/*N*/ sal_Int8 nLvl;
+/*N*/ rAny >>= nLvl;
+/*N*/ if(nLvl < 0 || nLvl >= MAXLEVEL)
+/*N*/ SetOutlineLvl(UCHAR_MAX);
+/*N*/ else
+/*?*/ SetOutlineLvl(nLvl);
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwSetExpField by JP
+ --------------------------------------------------------------------*/
+
+/*N*/ SwSetExpField::SwSetExpField(SwSetExpFieldType* pTyp, const String& rFormel,
+/*N*/ ULONG nFmt)
+/*N*/ : SwFormulaField( pTyp, nFmt, 0.0 ), nSeqNo( USHRT_MAX ),
+/*N*/ nSubType(0)
+/*N*/ {
+/*N*/ SetFormula(rFormel);
+/*N*/ // SubType ignorieren !!!
+/*N*/ bInput = FALSE;
+/*N*/ if( IsSequenceFld() )
+/*N*/ {
+/*N*/ SwValueField::SetValue(1.0);
+/*N*/ if( !rFormel.Len() )
+/*N*/ {
+/*N*/ String sFormel(rFormel);
+/*N*/ sFormel += pTyp->GetName();
+/*N*/ sFormel += '+';
+/*N*/ sFormel += '1';
+/*N*/ SetFormula(sFormel);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ String SwSetExpField::Expand() const
+/*N*/ {
+/*N*/ String aStr;
+/*N*/ if (nSubType & SUB_CMD)
+/*N*/ { // Der CommandString ist gefragt
+/*?*/ aStr = GetTyp()->GetName();
+/*?*/ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " = " ));
+/*?*/ aStr += GetFormula();
+/*N*/ }
+/*N*/ else if(!(nSubType & SUB_INVISIBLE))
+/*N*/ { // Der Wert ist sichtbar
+/*N*/ aStr = sExpand;
+/*N*/ }
+/*N*/ return aStr;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: liefert den Namen oder den Inhalt
+ --------------------------------------------------------------------*/
+
+/*N*/ String SwSetExpField::GetCntnt(BOOL bName) const
+/*N*/ {
+/*N*/ if( bName )
+/*N*/ {
+/*?*/ USHORT nStrType;
+/*?*/
+/*?*/ if( IsSequenceFld() )
+/*?*/ nStrType = TYP_SEQFLD;
+/*?*/ else if( bInput )
+/*?*/ nStrType = TYP_SETINPFLD;
+/*?*/ else
+/*?*/ nStrType = TYP_SETFLD;
+/*?*/
+/*?*/ String aStr( SwFieldType::GetTypeStr( nStrType ) );
+/*?*/ aStr += ' ';
+/*?*/ aStr += GetTyp()->GetName();
+/*?*/
+/*?*/ if( TYP_SEQFLD != nStrType )
+/*?*/ {
+/*?*/ // Sequence nicht die Formel ausgeben
+/*?*/ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " = " ));
+/*?*/ aStr += GetFormula();
+/*?*/ }
+/*?*/ return aStr;
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+
+/*N*/ SwField* SwSetExpField::Copy() const
+/*N*/ {
+/*N*/ SwSetExpField *pTmp = new SwSetExpField((SwSetExpFieldType*)GetTyp(),
+/*N*/ GetFormula(), GetFormat());
+/*N*/ pTmp->SwValueField::SetValue(GetValue());
+/*N*/ pTmp->sExpand = sExpand;
+/*N*/ pTmp->SetAutomaticLanguage(IsAutomaticLanguage());
+/*N*/ pTmp->SetLanguage(GetLanguage());
+/*N*/ pTmp->aPText = aPText;
+/*N*/ pTmp->bInput = bInput;
+/*N*/ pTmp->nSeqNo = nSeqNo;
+/*N*/ pTmp->SetSubType(GetSubType());
+/*N*/
+/*N*/ return pTmp;
+/*N*/ }
+
+/*N*/ void SwSetExpField::SetSubType(USHORT nSub)
+/*N*/ {
+/*N*/ ((SwSetExpFieldType*)GetTyp())->SetType(nSub & 0xff);
+/*N*/ nSubType = nSub & 0xff00;
+/*N*/
+/*N*/ DBG_ASSERT( (nSub & 0xff) != 3, "SubType ist illegal!" );
+/*N*/ }
+
+/*N*/ USHORT SwSetExpField::GetSubType() const
+/*N*/ {
+/*N*/ return ((SwSetExpFieldType*)GetTyp())->GetType() | nSubType;
+/*N*/ }
+
+/*N*/ void SwSetExpField::SetValue( const double& rAny )
+/*N*/ {
+/*N*/ SwValueField::SetValue(rAny);
+/*N*/
+/*N*/ if( IsSequenceFld() )
+/*N*/ sExpand = FormatNumber( (USHORT)GetValue(), GetFormat() );
+/*N*/ else
+/*N*/ sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue( rAny,
+/*N*/ GetFormat(), GetLanguage());
+/*N*/ }
+
+/*N*/ void SwGetExpField::SetValue( const double& rAny )
+/*N*/ {
+/*N*/ SwValueField::SetValue(rAny);
+/*N*/ sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue( rAny, GetFormat(),
+/*N*/ GetLanguage());
+/*N*/ }
+/* -----------------14.07.99 12:21-------------------
+ Description: Find the index of the reference text
+ following the current field
+ --------------------------------------------------*/
+/*N*/ xub_StrLen SwGetExpField::GetReferenceTextPos( const SwFmtFld& rFmt, SwDoc& rDoc)
+/*N*/ {
+/*N*/ //
+/*N*/ const SwTxtFld* pTxtFld = rFmt.GetTxtFld();
+/*N*/ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+/*N*/ //
+/*N*/ xub_StrLen nRet = *pTxtFld->GetStart() + 1;
+/*N*/ String sNodeText = rTxtNode.GetTxt();
+/*N*/ sNodeText.Erase(0, nRet);
+/*N*/ if(sNodeText.Len())
+/*N*/ {
+/*N*/ //now check if sNodeText starts with a non-alphanumeric character plus a blank
+/*N*/ USHORT nSrcpt = pBreakIt->GetRealScriptOfText( sNodeText, 0 );
+/*N*/
+/*N*/ static USHORT nIds[] =
+/*N*/ {
+/*N*/ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+/*N*/ RES_CHRATR_FONT, RES_CHRATR_FONT,
+/*N*/ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+/*N*/ RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
+/*N*/ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+/*N*/ RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT,
+/*N*/ 0, 0
+/*N*/ };
+/*N*/ SwAttrSet aSet(rDoc.GetAttrPool(), nIds);
+/*N*/ rTxtNode.GetAttr(aSet, nRet, nRet+1);
+/*N*/
+/*N*/ if( RTL_TEXTENCODING_SYMBOL != ((SvxFontItem&)aSet.Get(
+/*N*/ GetWhichOfScript( RES_CHRATR_FONT, nSrcpt )) ).GetCharSet() )
+/*N*/ {
+/*N*/ LanguageType eLang = ((SvxLanguageItem&)aSet.Get(
+/*N*/ GetWhichOfScript( RES_CHRATR_LANGUAGE, nSrcpt )) ).GetLanguage();
+/*N*/ CharClass aCC( SvxCreateLocale( eLang ));
+/*N*/ sal_Unicode c0 = sNodeText.GetChar(0);
+/*N*/ BOOL bIsAlphaNum = aCC.isAlphaNumeric( sNodeText, 0 );
+/*N*/ if( !bIsAlphaNum ||
+/*N*/ (c0 == ' ' || c0 == '\t'))
+/*N*/ {
+/*N*/ nRet++;
+/*N*/ if( sNodeText.Len() > 1 &&
+/*N*/ (sNodeText.GetChar(1) == ' ' ||
+/*N*/ sNodeText.GetChar(1) == '\t'))
+/*N*/ nRet++;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parameter setzen
+ --------------------------------------------------------------------*/
+
+/*N*/ const String& SwSetExpField::GetPar1() const
+/*N*/ {
+/*N*/ return ((SwSetExpFieldType*)GetTyp())->GetName();
+/*N*/ }
+
+String SwSetExpField::GetPar2() const
+{
+ USHORT nType = ((SwSetExpFieldType*)GetTyp())->GetType();
+
+ if (nType & GSE_STRING)
+ return GetFormula();
+ return GetExpandedFormula();
+}
+
+void SwSetExpField::SetPar2(const String& rStr)
+{
+ USHORT nType = ((SwSetExpFieldType*)GetTyp())->GetType();
+
+ if( !(nType & GSE_SEQ) || rStr.Len() )
+ {
+ if (nType & GSE_STRING)
+ SetFormula(rStr);
+ else
+ SetExpandedFormula(rStr);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eingabefeld Type
+ ---------------------------------------------------------------------*/
+
+/*N*/ SwInputFieldType::SwInputFieldType( SwDoc* pD )
+/*N*/ : SwFieldType( RES_INPUTFLD ), pDoc( pD )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFieldType* SwInputFieldType::Copy() const
+/*N*/ {
+ SwInputFieldType* pType = new SwInputFieldType( pDoc );
+ return pType;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eingabefeld
+ --------------------------------------------------------------------*/
+
+/*N*/ SwInputField::SwInputField(SwInputFieldType* pType, const String& rContent,
+/*N*/ const String& rPrompt, USHORT nSub, ULONG nFmt) :
+/*N*/ SwField(pType, nFmt), nSubType(nSub), aContent(rContent), aPText(rPrompt)
+/*N*/ {
+/*N*/ }
+
+/*N*/ String SwInputField::GetCntnt(BOOL bName) const
+/*N*/ {
+/*N*/ if ( bName )
+/*N*/ {
+/*?*/ String aStr(SwField::GetCntnt(bName));
+/*?*/ if ((nSubType & 0x00ff) == INP_USR)
+/*?*/ {
+/*?*/ aStr += GetTyp()->GetName();
+/*?*/ aStr += ' ';
+/*?*/ aStr += aContent;
+/*?*/ }
+/*?*/ return aStr;
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+
+/*N*/ SwField* SwInputField::Copy() const
+/*N*/ {
+/*N*/ SwInputField* pFld = new SwInputField((SwInputFieldType*)GetTyp(), aContent,
+/*N*/ aPText, GetSubType(), GetFormat());
+/*N*/ pFld->SetAutomaticLanguage(IsAutomaticLanguage());
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ String SwInputField::Expand() const
+/*N*/ {
+/*N*/ String sRet;
+/*N*/ if((nSubType & 0x00ff) == INP_TXT)
+/*N*/ sRet = aContent;
+/*N*/
+/*N*/ else if( (nSubType & 0x00ff) == INP_USR )
+/*N*/ {
+/*?*/ SwUserFieldType* pUserTyp = (SwUserFieldType*)
+/*?*/ ((SwInputFieldType*)GetTyp())->GetDoc()->
+/*?*/ GetFldType( RES_USERFLD, aContent );
+/*?*/ if( pUserTyp )
+/*?*/ sRet = pUserTyp->GetContent();
+/*N*/ }
+/*N*/ return sRet;
+/*N*/ }
+
+/*-----------------06.03.98 11:12-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwInputField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ rAny <<= OUString( aContent );
+/*?*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ rAny <<= OUString( aPText );
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*-----------------06.03.98 11:12-------------------
+
+--------------------------------------------------*/
+BOOL SwInputField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ binfilter::GetString( rAny, aContent );
+ break;
+ case FIELD_PROP_PAR2:
+ binfilter::GetString( rAny, aPText );
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return TRUE;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Bedingung setzen
+ --------------------------------------------------------------------*/
+
+void SwInputField::SetPar1(const String& rStr)
+{
+ aContent = rStr;
+}
+
+/*N*/ const String& SwInputField::GetPar1() const
+/*N*/ {
+/*N*/ return aContent;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: True/False Text
+ --------------------------------------------------------------------*/
+
+void SwInputField::SetPar2(const String& rStr)
+{
+ aPText = rStr;
+}
+
+/*N*/ String SwInputField::GetPar2() const
+/*N*/ {
+/*N*/ return aPText;
+/*N*/ }
+
+/*N*/ USHORT SwInputField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+void SwInputField::SetSubType(USHORT nSub)
+{
+ nSubType = nSub;
+}
+/*-----------------05.03.98 17:22-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwSetExpField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ sal_Bool bVal = 0 == (nSubType & SUB_INVISIBLE);
+/*N*/ rAny.setValue(&bVal, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int32)GetFormat();
+/*N*/ break;
+/*N*/ case FIELD_PROP_USHORT2:
+/*N*/ rAny <<= (sal_Int16)GetFormat();
+/*N*/ break;
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ rAny <<= (sal_Int16)nSeqNo;
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ rAny <<= OUString ( SwStyleNameMapper::GetProgName(GetPar1(), GET_POOLID_TXTCOLL ) );
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ {
+/*N*/ //I18N - if the formula contains only "TypeName+1"
+/*N*/ //and it's one of the initially created sequence fields
+/*N*/ //then the localized names has to be replaced by a programmatic name
+/*N*/ OUString sFormula = SwXFieldMaster::LocalizeFormula(*this, GetFormula(), TRUE);
+/*N*/ rAny <<= OUString( sFormula );
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_DOUBLE:
+/*N*/ rAny <<= (double)GetValue();
+/*N*/ break;
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ {
+/*N*/ sal_Int16 nRet = 0;
+/*N*/ nRet = lcl_SubTypeToAPI(GetSubType() & 0xff);
+/*N*/ rAny <<= nRet;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR3:
+/*?*/ rAny <<= OUString( aPText );
+/*?*/ break;
+/*?*/ case FIELD_PROP_BOOL3:
+/*?*/ {
+/*?*/ BOOL bTmp = 0 != (nSubType & SUB_CMD);
+/*?*/ rAny.setValue(&bTmp, ::getBooleanCppuType());
+/*?*/ }
+/*?*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ BOOL bTmp = GetInputFlag();
+/*N*/ rAny.setValue(&bTmp, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR4:
+/*?*/ rAny <<= ::rtl::OUString(GetExpStr());
+/*?*/ break;
+/*?*/ default:
+/*?*/ return SwField::QueryValue(rAny, nMId);
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*-----------------05.03.98 17:22-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwSetExpField::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ sal_Int32 nTmp32;
+/*N*/ sal_Int16 nTmp16;
+/*N*/ String sTmp;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL2:
+/*?*/ if(*(sal_Bool*)rAny.getValue())
+/*?*/ nSubType &= ~SUB_INVISIBLE;
+/*?*/ else
+/*?*/ nSubType |= SUB_INVISIBLE;
+/*?*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny >>= nTmp32;
+/*N*/ SetFormat(nTmp32);
+/*N*/ break;
+/*N*/ case FIELD_PROP_USHORT2:
+/*?*/ {
+/*?*/ rAny >>= nTmp16;
+/*?*/ if(nTmp16 <= SVX_NUMBER_NONE )
+/*?*/ SetFormat(nTmp16);
+/*?*/ else
+/*?*/ //exception(wrong_value)
+/*?*/ ;
+/*?*/ }
+/*?*/ break;
+/*?*/ case FIELD_PROP_USHORT1:
+/*?*/ rAny >>= nTmp16;
+/*?*/ nSeqNo = nTmp16;
+/*?*/ break;
+/*?*/ case FIELD_PROP_PAR1:
+/*?*/ SetPar1( SwStyleNameMapper::GetUIName(
+/*?*/ ::binfilter::GetString( rAny, sTmp ), GET_POOLID_TXTCOLL ) );
+/*?*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ {
+/*N*/ OUString uTmp;
+/*N*/ rAny >>= uTmp;
+/*N*/ //I18N - if the formula contains only "TypeName+1"
+/*N*/ //and it's one of the initially created sequence fields
+/*N*/ //then the localized names has to be replaced by a programmatic name
+/*N*/ OUString sFormula = SwXFieldMaster::LocalizeFormula(*this, uTmp, FALSE);
+/*N*/ SetFormula( sFormula );
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_DOUBLE:
+/*N*/ {
+/*N*/ double fVal;
+/*N*/ rAny >>= fVal;
+/*N*/ SetValue(fVal);
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ nTmp32 = lcl_APIToSubType(rAny);
+/*N*/ if(nTmp32 >= 0)
+/*N*/ SetSubType((GetSubType() & 0xff00) | nTmp32);
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR3:
+/*?*/ ::binfilter::GetString( rAny, aPText );
+/*?*/ break;
+/*N*/ case FIELD_PROP_BOOL3:
+/*N*/ if(*(sal_Bool*) rAny.getValue())
+/*?*/ nSubType |= SUB_CMD;
+/*N*/ else
+/*N*/ nSubType &= (~SUB_CMD);
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*?*/ SetInputFlag(*(sal_Bool*) rAny.getValue());
+/*?*/ break;
+/*N*/ case FIELD_PROP_PAR4:
+/*N*/ ChgExpStr( ::binfilter::GetString( rAny, sTmp ));
+/*N*/ break;
+/*N*/ default:
+/*?*/ return SwField::PutValue(rAny, nMId);
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_fldbas.cxx b/binfilter/bf_sw/source/core/fields/sw_fldbas.cxx
new file mode 100644
index 000000000000..04a5f5f7839b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_fldbas.cxx
@@ -0,0 +1,647 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#ifdef MAC
+#include <stdlib.h>
+#endif
+#include <float.h>
+
+#include <rtl/math.hxx>
+#include <bf_svtools/zformat.hxx>
+#include <unofldmid.h>
+
+#include <horiornt.hxx>
+
+#include <errhdl.hxx>
+#include <viscrs.hxx>
+#include <editsh.hxx>
+#include <docfld.hxx>
+#include <docufld.hxx>
+#include <shellres.hxx>
+namespace binfilter {
+
+
+using namespace ::com::sun::star;
+
+/*N*/ USHORT lcl_GetLanguageOfFormat( USHORT nLng, ULONG nFmt,
+/*N*/ const SvNumberFormatter& rFormatter )
+/*N*/ {
+/*N*/ if( nLng == LANGUAGE_NONE ) // wegen Bug #60010
+/*?*/ nLng = LANGUAGE_SYSTEM;
+/*N*/ else if( nLng == ::binfilter::GetAppLanguage() )
+/*N*/ switch( rFormatter.GetIndexTableOffset( nFmt ))
+/*N*/ {
+/*?*/ case NF_NUMBER_SYSTEM:
+/*?*/ case NF_DATE_SYSTEM_SHORT:
+/*?*/ case NF_DATE_SYSTEM_LONG:
+/*?*/ case NF_DATETIME_SYSTEM_SHORT_HHMM:
+/*?*/ nLng = LANGUAGE_SYSTEM;
+/*?*/ break;
+/*N*/ }
+/*N*/ return nLng;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Globals
+ --------------------------------------------------------------------*/
+// Array der Feldname
+
+/*N*/ SvStringsDtor* SwFieldType::pFldNames = 0;
+
+/*N*/ DBG_NAME(SwFieldType)
+
+ // ????? TYP_USRINPFLD,
+
+
+
+/*N*/ const String& SwFieldType::GetTypeStr(USHORT nTypeId)
+/*N*/ {
+/*N*/ if( !pFldNames )
+/*N*/ _GetFldName();
+/*N*/
+/*N*/ if( nTypeId < SwFieldType::pFldNames->Count() )
+/*N*/ return *SwFieldType::pFldNames->GetObject( nTypeId );
+/*N*/ else
+/*?*/ return aEmptyStr;
+/*N*/ }
+
+/*---------------------------------------------------
+ Jedes Feld referenziert einen Feldtypen, der fuer
+ jedes Dokument einmalig ist.
+ --------------------------------------------------*/
+
+/*N*/ SwFieldType::SwFieldType( USHORT nWhichId )
+/*N*/ : SwModify(0),
+/*N*/ nWhich( nWhichId )
+/*N*/ {
+/*N*/ DBG_CTOR( SwFieldType, 0 );
+/*N*/ }
+
+/*N*/ #ifdef DBG_UTIL
+
+/*N*/ SwFieldType::~SwFieldType()
+/*N*/ {
+/*N*/ DBG_DTOR( SwFieldType, 0 );
+/*N*/ }
+
+/*N*/ #endif
+
+/*N*/ const String& SwFieldType::GetName() const
+/*N*/ {
+/*N*/ return aEmptyStr;
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Basisklasse aller Felder
+ Felder referenzieren einen Feldtyp
+ Felder sind n-mal vorhanden, Feldtypen nur einmal
+ --------------------------------------------------------------------*/
+
+/*N*/ SwField::SwField(SwFieldType* pTyp, sal_uInt32 nFmt, USHORT nLng) :
+/*N*/ nFormat(nFmt),
+/*N*/ nLang(nLng),
+/*N*/ bIsAutomaticLanguage(TRUE)
+/*N*/ {
+/*N*/ ASSERT( pTyp, "SwField: ungueltiger SwFieldType" );
+/*N*/ pType = pTyp;
+/*N*/ }
+
+/*N*/ SwField::~SwField()
+/*N*/ {
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Statt Umweg ueber den Typ
+ --------------------------------------------------------------------*/
+
+/*N*/ #ifdef DBG_UTIL
+/*N*/ USHORT SwField::Which() const
+/*N*/ {
+/*N*/ ASSERT(pType, "Kein Typ vorhanden");
+/*N*/ return pType->Which();
+/*N*/ }
+/*N*/ #endif
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: liefert den Namen oder den Inhalt
+ --------------------------------------------------------------------*/
+
+/*N*/ String SwField::GetCntnt( BOOL bName ) const
+/*N*/ {
+/*N*/ String sRet;
+/*N*/ if( bName )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 USHORT nTypeId = GetTypeId();
+/*N*/ }
+/*N*/ else
+/*N*/ sRet = Expand();
+/*N*/ return sRet;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parameter setzen auslesen
+ --------------------------------------------------------------------*/
+
+/*N*/ const String& SwField::GetPar1() const
+/*N*/ {
+/*N*/ return aEmptyStr;
+/*N*/ }
+
+/*N*/ String SwField::GetPar2() const
+/*N*/ {
+/*N*/ return aEmptyStr;
+/*N*/ }
+
+/*N*/ String SwField::GetFormula() const
+/*N*/ {
+/*N*/ return GetPar2();
+/*N*/ }
+
+void SwField::SetPar1(const String& rStr)
+{}
+
+void SwField::SetPar2(const String& rStr)
+ {}
+
+/*N*/ USHORT SwField::GetSubType() const
+/*N*/ {
+/*N*/ // ASSERT(0, "Sorry Not implemented");
+/*N*/ return 0;
+/*N*/ }
+
+void SwField::SetSubType(USHORT nType)
+{
+// ASSERT(0, "Sorry Not implemented");
+}
+
+/*N*/ BOOL SwField::QueryValue( uno::Any& rVal, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL4:
+/*N*/ {
+/*N*/ BOOL bFixed = !bIsAutomaticLanguage;
+/*N*/ rVal.setValue(&bFixed, ::getCppuBooleanType());
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ BOOL SwField::PutValue( const uno::Any& rVal, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL4:
+/*N*/ {
+/*N*/ BOOL bFixed;
+/*N*/ if(rVal >>= bFixed)
+/*N*/ bIsAutomaticLanguage = !bFixed;
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: neuen Typ setzen
+ (wird fuer das Kopieren zwischen Dokumenten benutzt)
+ muss immer vom gleichen Typ sein.
+ --------------------------------------------------------------------*/
+
+SwFieldType* SwField::ChgTyp( SwFieldType* pNewType )
+{
+ ASSERT( pNewType && pNewType->Which() == pType->Which(),
+ "kein Typ oder ungleiche Typen" );
+
+ SwFieldType* pOld = pType;
+ pType = pNewType;
+ return pOld;
+}
+
+ // hat das Feld eine Action auf dem ClickHandler ? (z.B. INetFelder,..)
+
+/*N*/ void SwField::SetLanguage(USHORT nLng)
+/*N*/ {
+/*N*/ nLang = nLng;
+/*N*/ }
+
+/*N*/ void SwField::ChangeFormat(sal_uInt32 n)
+/*N*/ {
+/*N*/ nFormat = n;
+/*N*/ }
+
+/*N*/ FASTBOOL SwField::IsFixed() const
+/*N*/ {
+/*N*/ FASTBOOL bRet = FALSE;
+/*N*/ switch( pType->Which() )
+/*N*/ {
+/*N*/ case RES_FIXDATEFLD:
+/*N*/ case RES_FIXTIMEFLD:
+/*?*/ bRet = TRUE;
+/*?*/ break;
+/*N*/
+/*N*/ case RES_DATETIMEFLD:
+/*N*/ bRet = 0 != (GetSubType() & FIXEDFLD);
+/*N*/ break;
+/*N*/
+/*N*/ case RES_EXTUSERFLD:
+/*N*/ case RES_AUTHORFLD:
+/*N*/ bRet = 0 != (GetFormat() & AF_FIXED);
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FILENAMEFLD:
+/*N*/ bRet = 0 != (GetFormat() & FF_FIXED);
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DOCINFOFLD:
+/*N*/ bRet = 0 != (GetSubType() & DI_SUB_FIXED);
+/*N*/ break;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortierte Feldliste aller Felder usw.
+ --------------------------------------------------------------------*/
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Felder aus der Liste in sortierter Reihenfolge
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: von der CursorPos das naechste und das Letzte Feld
+ in der Liste anfahren
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Numerierung expandieren
+ --------------------------------------------------------------------*/
+
+/*N*/ String FormatNumber(USHORT nNum, sal_uInt32 nFormat)
+/*N*/ {
+/*N*/ if(SVX_NUM_PAGEDESC == nFormat)
+/*?*/ return String::CreateFromInt32( nNum );
+/*N*/ SvxNumberType aNumber;
+/*N*/
+/*N*/ ASSERT(nFormat != SVX_NUM_NUMBER_NONE, "Falsches Nummern-Format" );
+/*N*/
+/*N*/ aNumber.SetNumberingType((sal_Int16)nFormat);
+/*N*/ return aNumber.GetNumStr(nNum);
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: CTOR SwValueFieldType
+ --------------------------------------------------------------------*/
+
+/*N*/ SwValueFieldType::SwValueFieldType( SwDoc* pDocPtr, USHORT nWhichId )
+/*N*/ : SwFieldType(nWhichId),
+/*N*/ pDoc(pDocPtr),
+/*N*/ bUseFormat(TRUE)
+/*N*/ {
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Wert formatiert als String zurueckgeben
+ --------------------------------------------------------------------*/
+
+/*N*/ String SwValueFieldType::ExpandValue( const double& rVal,
+/*N*/ sal_uInt32 nFmt, USHORT nLng) const
+/*N*/ {
+/*N*/ if (rVal >= DBL_MAX) // FehlerString fuer Calculator
+/*?*/ return ViewShell::GetShellRes()->aCalc_Error;
+/*N*/
+/*N*/ String sExpand;
+/*N*/ SvNumberFormatter* pFormatter = pDoc->GetNumberFormatter();
+/*N*/ Color* pCol = 0;
+/*N*/
+/*N*/ // wegen Bug #60010
+/*N*/ USHORT nFmtLng = ::binfilter::lcl_GetLanguageOfFormat( nLng, nFmt, *pFormatter );
+/*N*/
+/*N*/ if( nFmt < SV_COUNTRY_LANGUAGE_OFFSET && LANGUAGE_SYSTEM != nFmtLng )
+/*N*/ {
+/*?*/ short nType = NUMBERFORMAT_DEFINED;
+/*?*/ xub_StrLen nDummy;
+/*?*/
+/*?*/ const SvNumberformat* pEntry = pFormatter->GetEntry(nFmt);
+/*?*/
+/*?*/ if (pEntry && nLng != pEntry->GetLanguage())
+/*?*/ {
+/*?*/ sal_uInt32 nNewFormat = pFormatter->GetFormatForLanguageIfBuiltIn(nFmt,
+/*?*/ (LanguageType)nFmtLng);
+/*?*/
+/*?*/ if (nNewFormat == nFmt)
+/*?*/ {
+/*?*/ // Warscheinlich benutzerdefiniertes Format
+/*?*/ String sFmt(pEntry->GetFormatstring());
+/*?*/
+/*?*/ pFormatter->PutandConvertEntry(sFmt, nDummy, nType, nFmt,
+/*?*/ pEntry->GetLanguage(), nFmtLng );
+/*?*/ }
+/*?*/ else
+/*?*/ nFmt = nNewFormat;
+/*?*/ }
+/*?*/ ASSERT(pEntry, "Unbekanntes Zahlenformat!");
+/*N*/ }
+/*N*/
+/*N*/ if( pFormatter->IsTextFormat( nFmt ) )
+/*N*/ {
+/*?*/ String sValue;
+/*?*/ DoubleToString(sValue, rVal, nFmtLng);
+/*?*/ pFormatter->GetOutputString(sValue, nFmt, sExpand, &pCol);
+/*N*/ }
+/*N*/ else
+/*N*/ pFormatter->GetOutputString(rVal, nFmt, sExpand, &pCol);
+/*N*/
+/*N*/ return sExpand;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwValueFieldType::DoubleToString( String &rValue, const double &rVal,
+/*N*/ USHORT nLng ) const
+/*N*/ {
+/*N*/ SvNumberFormatter* pFormatter = pDoc->GetNumberFormatter();
+/*N*/
+/*N*/ // wegen Bug #60010
+/*N*/ if( nLng == LANGUAGE_NONE ) // wegen Bug #60010
+/*?*/ nLng = LANGUAGE_SYSTEM;
+/*N*/
+/*N*/ pFormatter->ChangeIntl( nLng ); // Separator in der richtigen Sprache besorgen
+/*N*/ rValue = ::rtl::math::doubleToUString( rVal, rtl_math_StringFormat_F, 12,
+/*N*/ pFormatter->GetDecSep(), TRUE );
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: CTOR SwValueField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwValueField::SwValueField( SwValueFieldType* pFldType, sal_uInt32 nFmt,
+/*N*/ USHORT nLang, const double fVal )
+/*N*/ : SwField(pFldType, nFmt, nLang),
+/*N*/ fValue(fVal)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwValueField::~SwValueField()
+/*N*/ {
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung: neuen Typ setzen
+ (wird fuer das Kopieren zwischen Dokumenten benutzt)
+ muss immer vom gleichen Typ sein.
+ --------------------------------------------------------------------*/
+
+SwFieldType* SwValueField::ChgTyp( SwFieldType* pNewType )
+{
+ SwDoc* pNewDoc = ((SwValueFieldType *)pNewType)->GetDoc();
+ SwDoc* pDoc = GetDoc();
+
+ if( pNewDoc && pDoc && pDoc != pNewDoc)
+ {
+ SvNumberFormatter* pFormatter = pNewDoc->GetNumberFormatter();
+
+ if( pFormatter && pFormatter->HasMergeFmtTbl() &&
+ ((SwValueFieldType *)GetTyp())->UseFormat() )
+ SetFormat(pFormatter->GetMergeFmtIndex( GetFormat() ));
+ }
+
+ return SwField::ChgTyp(pNewType);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Format aendern
+ --------------------------------------------------------------------*/
+/*
+ Was sollte das denn?
+void SwValueField::ChangeFormat(ULONG n)
+{
+ nFormat = n;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Format in Office-Sprache ermitteln
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sprache im Format anpassen
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwValueField::SetLanguage( USHORT nLng )
+/*N*/ {
+/*N*/ if( IsAutomaticLanguage() &&
+/*N*/ ((SwValueFieldType *)GetTyp())->UseFormat() &&
+/*N*/ GetFormat() != SAL_MAX_UINT32 )
+/*N*/ {
+/*N*/ // wegen Bug #60010
+/*N*/ SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
+/*N*/ USHORT nFmtLng = ::binfilter::lcl_GetLanguageOfFormat( nLng, GetFormat(),
+/*N*/ *pFormatter );
+/*N*/
+/*N*/ if( (GetFormat() >= SV_COUNTRY_LANGUAGE_OFFSET ||
+/*N*/ LANGUAGE_SYSTEM != nFmtLng ) &&
+/*N*/ !(Which() == RES_USERFLD && (GetSubType()&SUB_CMD) ) )
+/*N*/ {
+/*N*/ const SvNumberformat* pEntry = pFormatter->GetEntry(GetFormat());
+/*N*/
+/*N*/ if( pEntry && nFmtLng != pEntry->GetLanguage() )
+/*N*/ {
+/*N*/ sal_uInt32 nNewFormat = pFormatter->GetFormatForLanguageIfBuiltIn(
+/*N*/ GetFormat(), (LanguageType)nFmtLng );
+/*N*/
+/*N*/ if( nNewFormat == GetFormat() )
+/*N*/ {
+/*?*/ // Warscheinlich benutzerdefiniertes Format
+/*?*/ short nType = NUMBERFORMAT_DEFINED;
+/*?*/ xub_StrLen nDummy;
+/*?*/ String sFmt( pEntry->GetFormatstring() );
+/*?*/ pFormatter->PutandConvertEntry( sFmt, nDummy, nType,
+/*?*/ nNewFormat,
+/*?*/ pEntry->GetLanguage(),
+/*?*/ nFmtLng );
+/*N*/ }
+/*N*/ SetFormat( nNewFormat );
+/*N*/ }
+/*N*/ ASSERT(pEntry, "Unbekanntes Zahlenformat!");
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwField::SetLanguage(nLng);
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ double SwValueField::GetValue() const
+/*N*/ {
+/*N*/ return fValue;
+/*N*/ }
+
+/*N*/ void SwValueField::SetValue( const double& rVal )
+/*N*/ {
+/*N*/ fValue = rVal;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwFormulaField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwFormulaField::SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt, const double fVal)
+/*N*/ : SwValueField(pFldType, nFmt, LANGUAGE_SYSTEM, fVal)
+/*N*/ {
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ String SwFormulaField::GetFormula() const
+/*N*/ {
+/*N*/ return sFormula;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwFormulaField::SetFormula(const String& rStr)
+/*N*/ {
+/*N*/ sFormula = rStr;
+/*N*/
+/*N*/ sal_uInt32 nFmt(GetFormat());
+/*N*/
+/*N*/ if( nFmt && SAL_MAX_UINT32 != nFmt )
+/*N*/ {
+/*N*/ xub_StrLen nPos = 0;
+/*N*/ double fValue;
+/*N*/ if( SwCalc::Str2Double( rStr, nPos, fValue, GetDoc() ) )
+/*N*/ SwValueField::SetValue( fValue );
+/*N*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFormulaField::SetExpandedFormula( const String& rStr )
+{
+ sal_uInt32 nFmt(GetFormat());
+
+ if (nFmt && nFmt != SAL_MAX_UINT32 && ((SwValueFieldType *)GetTyp())->UseFormat())
+ {
+ double fValue;
+
+ SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
+
+ if (pFormatter->IsNumberFormat(rStr, nFmt, fValue))
+ {
+ SwValueField::SetValue(fValue);
+ sFormula.Erase();
+
+ ((SwValueFieldType *)GetTyp())->DoubleToString(sFormula, fValue, nFmt);
+ return;
+ }
+ }
+ sFormula = rStr;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+String SwFormulaField::GetExpandedFormula() const
+{
+ sal_uInt32 nFmt(GetFormat());
+
+ if (nFmt && nFmt != SAL_MAX_UINT32 && ((SwValueFieldType *)GetTyp())->UseFormat())
+ {
+ String sFormattedValue;
+ Color* pCol = 0;
+
+ SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
+
+ if (pFormatter->IsTextFormat(nFmt))
+ {
+ String sValue;
+ ((SwValueFieldType *)GetTyp())->DoubleToString(sValue, GetValue(), nFmt);
+ pFormatter->GetOutputString(sValue, nFmt, sFormattedValue, &pCol);
+ }
+ else
+ pFormatter->GetOutputString(GetValue(), nFmt, sFormattedValue, &pCol);
+
+ return sFormattedValue;
+ }
+ else
+ return GetFormula();
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_flddat.cxx b/binfilter/bf_sw/source/core/fields/sw_flddat.cxx
new file mode 100644
index 000000000000..dbb4bed78f39
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_flddat.cxx
@@ -0,0 +1,320 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <math.h>
+
+#include <bf_svtools/zforlist.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <flddat.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+/*--------------------------------------------------
+ Beschreibung: Datum/Zeit-Typ
+ ---------------------------------------------------*/
+
+/*N*/ SwDateTimeFieldType::SwDateTimeFieldType(SwDoc* pDoc)
+/*N*/ : SwValueFieldType( pDoc, RES_DATETIMEFLD )
+/*N*/ {}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ SwFieldType* SwDateTimeFieldType::Copy() const
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 //STRIP001 SwDateTimeFieldType *pTmp = new SwDateTimeFieldType(GetDoc());
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datum/Zeit-Feld
+ --------------------------------------------------------------------*/
+
+/*N*/ SwDateTimeField::SwDateTimeField(SwDateTimeFieldType* pType, USHORT nSub, ULONG nFmt, USHORT nLng)
+/*N*/ : SwValueField(pType, nFmt, nLng, 0.0),
+/*N*/ nSubType(nSub),
+/*N*/ nOffset(0)
+/*N*/ {
+/*N*/ if (!nFmt)
+/*N*/ {
+/*N*/ SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
+/*N*/ if (nSubType & DATEFLD)
+/*N*/ ChangeFormat(pFormatter->GetFormatIndex(NF_DATE_SYSTEM_SHORT, GetLanguage()));
+/*N*/ else
+/*?*/ ChangeFormat(pFormatter->GetFormatIndex(NF_TIME_HHMMSS, GetLanguage()));
+/*N*/ }
+/*N*/ if (IsFixed())
+/*N*/ {
+/*N*/ DateTime aDateTime;
+/*N*/ SetDateTime(aDateTime);
+/*N*/ }
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ String SwDateTimeField::Expand() const
+/*N*/ {
+/*N*/ double fVal;
+/*N*/
+/*N*/ if (!(IsFixed()))
+/*N*/ {
+/*N*/ DateTime aDateTime;
+/*N*/ fVal = GetDateTime(GetDoc(), aDateTime);
+/*N*/ }
+/*N*/ else
+/*N*/ fVal = GetValue();
+/*N*/
+/*N*/ if (nOffset)
+/*N*/ fVal += (double)(nOffset * 60L) / 86400.0;
+/*N*/
+/*N*/ return ExpandValue(fVal, GetFormat(), GetLanguage());
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ SwField* SwDateTimeField::Copy() const
+/*N*/ {
+/*N*/ SwDateTimeField *pTmp =
+/*N*/ new SwDateTimeField((SwDateTimeFieldType*)GetTyp(), nSubType,
+/*N*/ GetFormat(), GetLanguage());
+/*N*/
+/*N*/ pTmp->SetValue(GetValue());
+/*N*/ pTmp->SetOffset(nOffset);
+/*N*/ pTmp->SetAutomaticLanguage(IsAutomaticLanguage());
+/*N*/
+/*N*/ return pTmp;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ USHORT SwDateTimeField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDateTimeField::SetSubType(USHORT nType) //SW40.SDW
+/*N*/ {
+/*N*/ nSubType = nType;
+/*N*/ }
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ void SwDateTimeField::SetDateTime(const DateTime& rDT)
+/*N*/ {
+/*N*/ SetValue(GetDateTime(GetDoc(), rDT));
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ double SwDateTimeField::GetDateTime(SwDoc* pDoc, const DateTime& rDT)
+/*N*/ {
+/*N*/ SvNumberFormatter* pFormatter = pDoc->GetNumberFormatter();
+/*N*/ Date* pNullDate = pFormatter->GetNullDate();
+/*N*/
+/*N*/ double fResult = rDT - DateTime(*pNullDate);
+/*N*/
+/*N*/ return fResult;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ double SwDateTimeField::GetValue() const
+/*N*/ {
+/*N*/ if (IsFixed())
+/*N*/ return SwValueField::GetValue();
+/*N*/ else
+/*N*/ return GetDateTime(GetDoc(), DateTime());
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ Date SwDateTimeField::GetDate(BOOL bUseOffset) const
+/*N*/ {
+/*N*/ SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
+/*N*/ Date* pNullDate = pFormatter->GetNullDate();
+/*N*/
+/*N*/ long nVal = GetValue();
+/*N*/
+/*N*/ if (bUseOffset && nOffset)
+/*?*/ nVal += nOffset / 60 / 24;
+/*N*/
+/*N*/ Date aDate = *pNullDate + nVal;
+/*N*/
+/*N*/ return aDate;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*N*/ Time SwDateTimeField::GetTime(BOOL bUseOffset) const
+/*N*/ {
+/*N*/ double fDummy;
+/*N*/ double fFract = modf(GetValue(), &fDummy);
+/*N*/ DateTime aDT((long)fDummy, 0);
+/*N*/ aDT += fFract;
+/*N*/ if (bUseOffset)
+/*N*/ aDT += Time(0, nOffset);
+/*N*/ return (Time)aDT;
+/*N*/ }
+
+/*-----------------04.03.98 11:05-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDateTimeField::QueryValue( uno::Any& rVal, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ BOOL bTmp = IsFixed();
+/*N*/ rVal.setValue(&bTmp, ::getCppuBooleanType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ BOOL bTmp = IsDate();
+/*N*/ rVal.setValue(&bTmp, ::getCppuBooleanType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rVal <<= (sal_Int32)GetFormat();
+/*N*/ break;
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ rVal <<= (sal_Int32)nOffset;
+/*N*/ break;
+/*N*/ case FIELD_PROP_DATE_TIME:
+/*N*/ {
+/*N*/ DateTime aDateTime(GetDate(), GetTime());
+/*N*/
+/*N*/ util::DateTime DateTimeValue;
+/*N*/ DateTimeValue.HundredthSeconds = aDateTime.Get100Sec();
+/*N*/ DateTimeValue.Seconds = aDateTime.GetSec();
+/*N*/ DateTimeValue.Minutes = aDateTime.GetMin();
+/*N*/ DateTimeValue.Hours = aDateTime.GetHour();
+/*N*/ DateTimeValue.Day = aDateTime.GetDay();
+/*N*/ DateTimeValue.Month = aDateTime.GetMonth();
+/*N*/ DateTimeValue.Year = aDateTime.GetYear();
+/*N*/ rVal <<= DateTimeValue;
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ return SwField::QueryValue(rVal, nMId);
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*-----------------04.03.98 11:05-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwDateTimeField::PutValue( const uno::Any& rVal, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ sal_Int32 nTmp;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ if(*(sal_Bool*)rVal.getValue())
+/*N*/ nSubType |= FIXEDFLD;
+/*N*/ else
+/*N*/ nSubType &= ~FIXEDFLD;
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ nSubType &= ~(DATEFLD|TIMEFLD);
+/*N*/ nSubType |= *(sal_Bool*)rVal.getValue() ? DATEFLD : TIMEFLD;
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rVal >>= nTmp;
+/*N*/ ChangeFormat(nTmp);
+/*N*/ break;
+/*N*/ case FIELD_PROP_SUBTYPE:
+/*N*/ rVal >>= nTmp;
+/*N*/ nOffset = nTmp;
+/*N*/ break;
+/*N*/ case FIELD_PROP_DATE_TIME:
+/*N*/ {
+/*N*/ util::DateTime aDateTimeValue;
+/*N*/ if(!(rVal >>= aDateTimeValue))
+/*N*/ return FALSE;
+/*N*/ DateTime aDateTime;
+/*N*/ aDateTime.Set100Sec(aDateTimeValue.HundredthSeconds);
+/*N*/ aDateTime.SetSec(aDateTimeValue.Seconds);
+/*N*/ aDateTime.SetMin(aDateTimeValue.Minutes);
+/*N*/ aDateTime.SetHour(aDateTimeValue.Hours);
+/*N*/ aDateTime.SetDay(aDateTimeValue.Day);
+/*N*/ aDateTime.SetMonth(aDateTimeValue.Month);
+/*N*/ aDateTime.SetYear(aDateTimeValue.Year);
+/*N*/ SetDateTime(aDateTime);
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ return SwField::PutValue(rVal, nMId);
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_flddropdown.cxx b/binfilter/bf_sw/source/core/fields/sw_flddropdown.cxx
new file mode 100644
index 000000000000..3466c6688871
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_flddropdown.cxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <algorithm>
+#include <bf_svtools/poolitem.hxx>
+#include <unofldmid.h>
+#include <flddropdown.hxx>
+namespace binfilter {
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+static String aEmptyString;
+
+SwDropDownFieldType::SwDropDownFieldType()
+ : SwFieldType(RES_DROPDOWN)
+{
+}
+
+SwDropDownFieldType::~SwDropDownFieldType()
+{
+}
+
+SwFieldType * SwDropDownFieldType::Copy() const
+{
+ return new SwDropDownFieldType;
+}
+
+SwDropDownField::SwDropDownField(SwFieldType * pTyp)
+ : SwField(pTyp, 0, LANGUAGE_SYSTEM)
+{
+}
+
+SwDropDownField::SwDropDownField(const SwDropDownField & rSrc)
+ : SwField(rSrc.GetTyp(), rSrc.GetFormat(), rSrc.GetLanguage()),
+ aValues(rSrc.aValues), aSelectedItem(rSrc.aSelectedItem),
+ aName(rSrc.aName)
+{
+}
+
+SwDropDownField::~SwDropDownField()
+{
+}
+
+String SwDropDownField::Expand() const
+{
+ String sSelect = GetSelectedItem();
+ if(!sSelect.Len())
+ {
+ vector<String>::const_iterator aIt = aValues.begin();
+ if ( aIt != aValues.end())
+ sSelect = *aIt;
+ }
+ //if still no list value is available a default text of 10 spaces is to be set
+ if(!sSelect.Len())
+ sSelect.AppendAscii ( RTL_CONSTASCII_STRINGPARAM (" "));
+ return sSelect;
+}
+
+SwField * SwDropDownField::Copy() const
+{
+ return new SwDropDownField(*this);
+}
+
+const String & SwDropDownField::GetPar1() const
+{
+ return GetSelectedItem();
+}
+
+String SwDropDownField::GetPar2() const
+{
+ return GetName();
+}
+
+void SwDropDownField::SetPar1(const String & rStr)
+{
+ SetSelectedItem(rStr);
+}
+
+void SwDropDownField::SetPar2(const String & rName)
+{
+ SetName(rName);
+}
+
+void SwDropDownField::SetItems(const Sequence<OUString> & rItems)
+{
+ aValues.clear();
+
+ sal_Int32 aCount = rItems.getLength();
+ for (int i = 0; i < aCount; i++)
+ aValues.push_back(rItems[i]);
+
+ aSelectedItem = aEmptyString;
+}
+
+Sequence<OUString> SwDropDownField::GetItemSequence() const
+{
+ Sequence<OUString> aSeq( aValues.size() );
+ OUString* pSeq = aSeq.getArray();
+ int i = 0;
+ vector<String>::const_iterator aIt;
+
+ for (aIt = aValues.begin(); aIt != aValues.end(); aIt++)
+ {
+ pSeq[i] = ::rtl::OUString(*aIt);
+
+ i++;
+ }
+
+ return aSeq;
+}
+
+const String & SwDropDownField::GetSelectedItem() const
+{
+ return aSelectedItem;
+}
+
+const String & SwDropDownField::GetName() const
+{
+ return aName;
+}
+
+BOOL SwDropDownField::SetSelectedItem(const String & rItem)
+{
+ vector<String>::const_iterator aIt =
+ find(aValues.begin(), aValues.end(), rItem);
+
+ if (aIt != aValues.end())
+ aSelectedItem = *aIt;
+ else
+ aSelectedItem = String();
+
+ return (aIt != aValues.end());
+}
+
+void SwDropDownField::SetName(const String & rName)
+{
+ aName = rName;
+}
+
+BOOL SwDropDownField::QueryValue(Any &rVal, BYTE nMId)
+ const
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ rVal <<= ::rtl::OUString(GetSelectedItem());
+ break;
+ case FIELD_PROP_PAR2:
+ rVal <<= ::rtl::OUString(GetName());
+ break;
+ case FIELD_PROP_STRINGS:
+ rVal <<= GetItemSequence();
+
+ break;
+
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+
+BOOL SwDropDownField::PutValue(const Any &rVal,
+ BYTE nMId)
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ {
+ String aTmpStr;
+ ::binfilter::GetString( rVal, aTmpStr );
+
+ SetSelectedItem(aTmpStr);
+ }
+ break;
+
+ case FIELD_PROP_PAR2:
+ {
+ String aTmpStr;
+ ::binfilter::GetString( rVal, aTmpStr );
+
+ SetName(aTmpStr);
+ }
+ break;
+
+ case FIELD_PROP_STRINGS:
+ {
+ Sequence<OUString> aSeq;
+ rVal >>= aSeq;
+ SetItems(aSeq);
+ }
+ break;
+
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return sal_True;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_inetfld.cxx b/binfilter/bf_sw/source/core/fields/sw_inetfld.cxx
new file mode 100644
index 000000000000..636029b8ef94
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_inetfld.cxx
@@ -0,0 +1,241 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+
+#include <bf_svtools/macitem.hxx>
+
+
+#include <charfmt.hxx>
+#include "doc.hxx"
+#include "inetfld.hxx"
+#include "poolfmt.hxx"
+#include "hints.hxx"
+namespace binfilter {
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwINetFieldType by JP
+ --------------------------------------------------------------------*/
+
+
+
+SwINetFieldType::SwINetFieldType( SwDoc* pD )
+ : SwFieldType( RES_INTERNETFLD ), pDoc( pD ),
+ aNormalFmt( this, 0 ), aVisitFmt( this, 0 )
+{
+}
+
+
+
+SwFieldType* SwINetFieldType::Copy() const
+{
+ return new SwINetFieldType( pDoc );
+}
+
+
+
+SwCharFmt* SwINetFieldType::GetCharFmt( const SwINetField& rFld )
+{
+ USHORT nId = RES_POOLCHR_INET_NORMAL;
+ SwDepend* pDepend = &aNormalFmt;
+
+ if( rFld.sURL.Len() && pDoc->IsVisitedURL( rFld.sURL ) )
+ {
+ nId = RES_POOLCHR_INET_VISIT;
+ pDepend = &aVisitFmt;
+ }
+
+ SwCharFmt* pFmt = pDoc->GetCharFmtFromPool( nId );
+
+ // noch nicht registriert ?
+ if( !pDepend->GetRegisteredIn() )
+ pFmt->Add( pDepend ); // anmelden
+
+ return pFmt;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwINetFieldType by JP
+ --------------------------------------------------------------------*/
+
+
+
+SwINetField::SwINetField( SwINetFieldType* pTyp, USHORT nFmt,
+ const String& rURL, const String& rText )
+ : SwField( pTyp, nFmt ), sURL( rURL ), sText( rText ),
+ pMacroTbl( 0 )
+{
+}
+
+
+
+SwINetField::~SwINetField()
+{
+ delete pMacroTbl;
+}
+
+
+
+String SwINetField::Expand() const
+{
+ return sText;
+}
+
+
+
+String SwINetField::GetCntnt(BOOL bName) const
+{
+ if( bName )
+ {
+ String aStr( sText );
+ aStr += ' ';
+ aStr += sURL;
+ return aStr;
+ }
+ return Expand();
+}
+
+
+
+SwField* SwINetField::Copy() const
+{
+ SwINetField *pTmp = new SwINetField( (SwINetFieldType*)pType, nFormat,
+ sURL, sText );
+ pTmp->SetLanguage( GetLanguage() );
+ pTmp->sTargetFrameName = sTargetFrameName;
+
+ if( pMacroTbl )
+ pTmp->pMacroTbl = new SvxMacroTableDtor( *pMacroTbl );
+
+ return pTmp;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parameter setzen
+ --------------------------------------------------------------------*/
+
+
+const String& SwINetField::GetPar1() const
+{
+ return sURL;
+}
+
+
+
+String SwINetField::GetPar2() const
+{
+ return sText;
+}
+
+
+
+void SwINetField::SetPar1(const String& rStr)
+{
+ sURL = rStr;
+}
+
+
+
+void SwINetField::SetPar2(const String& rStr)
+{
+ sText = rStr;
+}
+
+
+
+SwCharFmt* SwINetField::GetCharFmt()
+{
+ return ((SwINetFieldType*)pType)->GetCharFmt( *this );
+}
+
+
+
+void SwINetField::SetMacroTbl( const SvxMacroTableDtor* pNewTbl )
+{
+ if( pNewTbl )
+ {
+ if( pMacroTbl )
+ *pMacroTbl = *pNewTbl;
+ else
+ pMacroTbl = new SvxMacroTableDtor( *pNewTbl );
+ }
+ else if( pMacroTbl )
+ delete pMacroTbl, pMacroTbl = 0;
+}
+
+
+
+void SwINetField::SetMacro( USHORT nEvent, const SvxMacro& rMacro )
+{
+ if( !pMacroTbl )
+ pMacroTbl = new SvxMacroTableDtor;
+
+ SvxMacro *pOldMacro;
+ if( 0 != ( pOldMacro = pMacroTbl->Get( nEvent )) )
+ {
+ delete pOldMacro;
+ pMacroTbl->Replace( nEvent, new SvxMacro( rMacro ) );
+ }
+ else
+ pMacroTbl->Insert( nEvent, new SvxMacro( rMacro ) );
+}
+
+
+
+const SvxMacro* SwINetField::GetMacro( USHORT nEvent ) const
+{
+ const SvxMacro* pRet = 0;
+ if( pMacroTbl && pMacroTbl->IsKeyValid( nEvent ) )
+ pRet = pMacroTbl->Get( nEvent );
+ return pRet;
+}
+
+#ifdef USED
+
+
+String SwINetField::GetBookmark() const
+{
+ String sRet;
+ USHORT nPos = sURL.Search( '#' );
+ if( nPos < sURL.Len() )
+ sRet = sURL.Copy( nPos+1 );
+ return sRet;
+}
+#endif
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_macrofld.cxx b/binfilter/bf_sw/source/core/fields/sw_macrofld.cxx
new file mode 100644
index 000000000000..53a1680285a3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_macrofld.cxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include <docufld.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+/*--------------------------------------------------------------------
+ Beschreibung: MacroFeldtypen
+ --------------------------------------------------------------------*/
+
+/*N*/ SwMacroFieldType::SwMacroFieldType(SwDoc* pDocument)
+/*N*/ : SwFieldType( RES_MACROFLD ),
+/*N*/ pDoc(pDocument)
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFieldType* SwMacroFieldType::Copy() const
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 //STRIP001 SwMacroFieldType* pType = new SwMacroFieldType(pDoc);
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Das Macrofeld selbst
+ --------------------------------------------------------------------*/
+
+/*N*/ SwMacroField::SwMacroField(SwMacroFieldType* pType,
+/*N*/ const String& rLibAndName, const String& rTxt) :
+/*N*/ SwField(pType), aMacro(rLibAndName), aText(rTxt)
+/*N*/ {
+/*N*/ }
+
+/*N*/ String SwMacroField::Expand() const
+/*N*/ { // Button malen anstatt von
+/*N*/ return aText ;
+/*N*/ }
+
+/*N*/ SwField* SwMacroField::Copy() const
+/*N*/ {
+/*N*/ return new SwMacroField((SwMacroFieldType*)GetTyp(), aMacro, aText);
+/*N*/ }
+
+/*N*/ String SwMacroField::GetCntnt(BOOL bName) const
+/*N*/ {
+/*N*/ if(bName)
+/*N*/ {
+/*?*/ String aStr(GetTyp()->GetName());
+/*?*/ aStr += ' ';
+/*?*/ aStr += aMacro;
+/*?*/ return aStr;
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+
+/*N*/ String SwMacroField::GetLibName() const
+/*N*/ {
+/*N*/ if (aMacro.Len())
+/*N*/ {
+/*N*/ USHORT nPos = aMacro.Len();
+/*N*/
+/*N*/ for (USHORT i = 0; i < 3 && nPos > 0; i++)
+/*N*/ while (aMacro.GetChar(--nPos) != '.' && nPos > 0);
+/*N*/
+/*N*/ return aMacro.Copy(0, nPos );
+/*N*/ }
+/*N*/
+/*?*/ DBG_ASSERT(0, "Kein Macroname vorhanden");
+/*?*/ return aEmptyStr;
+/*N*/ }
+
+/*N*/ String SwMacroField::GetMacroName() const
+/*N*/ {
+/*N*/ if (aMacro.Len())
+/*N*/ {
+/*N*/ USHORT nPos = aMacro.Len();
+/*N*/
+/*N*/ for (USHORT i = 0; i < 3 && nPos > 0; i++)
+/*N*/ while (aMacro.GetChar(--nPos) != '.' && nPos > 0);
+/*N*/
+/*N*/ return aMacro.Copy( ++nPos );
+/*N*/ }
+/*N*/
+/*?*/ DBG_ASSERT(0, "Kein Macroname vorhanden");
+/*?*/ return aEmptyStr;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: LibName und MacroName
+ --------------------------------------------------------------------*/
+
+void SwMacroField::SetPar1(const String& rStr)
+{
+ aMacro = rStr;
+}
+
+/*N*/ const String& SwMacroField::GetPar1() const
+/*N*/ {
+/*N*/ return aMacro;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Macrotext
+ --------------------------------------------------------------------*/
+
+void SwMacroField::SetPar2(const String& rStr)
+{
+ aText = rStr;
+}
+
+/*N*/ String SwMacroField::GetPar2() const
+/*N*/ {
+/*N*/ return aText;
+/*N*/ }
+
+/*-----------------05.03.98 13:38-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwMacroField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ rAny <<= OUString(GetMacroName());
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ rAny <<= OUString(aText);
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR3:
+/*N*/ rAny <<= OUString(GetLibName());
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*-----------------05.03.98 13:38-------------------
+
+--------------------------------------------------*/
+BOOL SwMacroField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ String sTmp;
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ CreateMacroString( aMacro, ::binfilter::GetString(rAny, sTmp), GetLibName());
+ break;
+ case FIELD_PROP_PAR2:
+ ::binfilter::GetString( rAny, aText );
+ break;
+ case FIELD_PROP_PAR3:
+ CreateMacroString(aMacro, GetMacroName(), ::binfilter::GetString(rAny, sTmp) );
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return TRUE;
+}
+
+// create an internally used macro name from the library and macro name parts
+/*N*/ void SwMacroField::CreateMacroString(
+/*N*/ String& rMacro,
+/*N*/ const String& rMacroName,
+/*N*/ const String& rLibraryName )
+/*N*/ {
+/*N*/ // concatenate library and name; use dot only if both strings have content
+/*N*/ rMacro = rLibraryName;
+/*N*/ if ( rLibraryName.Len() > 0 && rMacroName.Len() > 0 )
+/*N*/ rMacro += '.';
+/*N*/ rMacro += rMacroName;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_reffld.cxx b/binfilter/bf_sw/source/core/fields/sw_reffld.cxx
new file mode 100644
index 000000000000..3cc89b63ad4c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_reffld.cxx
@@ -0,0 +1,815 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_USHORTS
+
+#include <com/sun/star/text/ReferenceFieldPart.hpp>
+#include <com/sun/star/text/ReferenceFieldSource.hpp>
+#include <unotools/localedatawrapper.hxx>
+#include <bf_svx/unolingu.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <pagefrm.hxx>
+#include <docary.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <txtftn.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <fmtftn.hxx>
+#include <ndtxt.hxx>
+#include <chpfld.hxx>
+#include <reffld.hxx>
+#include <expfld.hxx>
+#include <txtfrm.hxx>
+#include <flyfrm.hxx>
+#include <pagedesc.hxx>
+#include <bookmrk.hxx>
+#include <ftnidx.hxx>
+#include <unofldmid.h>
+#include <SwStyleNameMapper.hxx>
+#include <poolfmt.hxx>
+#include <poolfmt.hrc>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+namespace binfilter {
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::lang;
+using namespace ::rtl;
+
+
+/*N*/ void lcl_GetLayTree( const SwFrm* pFrm, SvPtrarr& rArr )
+/*N*/ {
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsBodyFrm() ) // soll uns nicht weiter interessieren
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ else
+/*N*/ {
+/*N*/ void* p = (void*)pFrm;
+/*N*/ rArr.Insert( p, rArr.Count() );
+/*N*/
+/*N*/ // bei der Seite ist schluss
+/*N*/ if( pFrm->IsPageFrm() )
+/*N*/ break;
+/*N*/
+/*N*/ if( pFrm->IsFlyFrm() )
+/*N*/ pFrm = ((SwFlyFrm*)pFrm)->GetAnchor();
+/*N*/ else
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ BOOL IsFrameBehind( const SwTxtNode& rMyNd, USHORT nMySttPos,
+/*N*/ const SwTxtNode& rBehindNd, USHORT nSttPos )
+/*N*/ {
+/*N*/ const SwTxtFrm *pMyFrm = (SwTxtFrm*)rMyNd.GetFrm(0,0,FALSE),
+/*N*/ *pFrm = (SwTxtFrm*)rBehindNd.GetFrm(0,0,FALSE);
+/*N*/
+/*N*/ while( pFrm && !pFrm->IsInside( nSttPos ) )
+/*N*/ pFrm = (SwTxtFrm*)pFrm->GetFollow();
+/*N*/ while( pMyFrm && !pMyFrm->IsInside( nMySttPos ) )
+/*N*/ pMyFrm = (SwTxtFrm*)pMyFrm->GetFollow();
+/*N*/
+/*N*/ if( !pFrm || !pMyFrm || pFrm == pMyFrm )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ SvPtrarr aRefArr( 10, 10 ), aArr( 10, 10 );
+/*N*/ ::binfilter::lcl_GetLayTree( pFrm, aRefArr );
+/*N*/ ::binfilter::lcl_GetLayTree( pMyFrm, aArr );
+/*N*/
+/*N*/ USHORT nRefCnt = aRefArr.Count() - 1, nCnt = aArr.Count() - 1;
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ BOOL bVert = FALSE;
+/*N*/ BOOL bR2L = FALSE;
+/*N*/ #endif
+/*N*/
+/*N*/ // solange bis ein Frame ungleich ist ?
+/*N*/ while( nRefCnt && nCnt && aRefArr[ nRefCnt ] == aArr[ nCnt ] )
+/*N*/ {
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ const SwFrm* pFrm = (const SwFrm*)aArr[ nCnt ];
+/*N*/ bVert = pFrm->IsVertical();
+/*N*/ bR2L = pFrm->IsRightToLeft();
+/*N*/ #endif
+/*N*/ --nCnt, --nRefCnt;
+/*N*/ }
+/*N*/
+/*N*/ // sollte einer der Counter ueberlaeufen?
+/*N*/ if( aRefArr[ nRefCnt ] == aArr[ nCnt ] )
+/*N*/ {
+/*N*/ if( nCnt )
+/*N*/ --nCnt;
+/*N*/ else
+/*N*/ --nRefCnt;
+/*N*/ }
+/*N*/
+/*N*/ const SwFrm* pRefFrm = (const SwFrm*)aRefArr[ nRefCnt ];
+/*N*/ const SwFrm* pFldFrm = (const SwFrm*)aArr[ nCnt ];
+/*N*/
+/*N*/ // unterschiedliche Frames, dann ueberpruefe deren Y-/X-Position
+/*N*/ BOOL bRefIsLower;
+/*N*/ if( ( FRM_COLUMN | FRM_CELL ) & pFldFrm->GetType() ||
+/*N*/ ( FRM_COLUMN | FRM_CELL ) & pRefFrm->GetType() )
+/*N*/ {
+/*?*/ if( pFldFrm->GetType() == pRefFrm->GetType() )
+/*?*/ {
+/*?*/ // hier ist die X-Pos wichtiger!
+/*?*/ #ifdef VERTICAL_LAYOUT
+/*?*/ if( bVert )
+/*?*/ {
+/*?*/ if( bR2L )
+/*?*/ bRefIsLower = pRefFrm->Frm().Top() < pFldFrm->Frm().Top() ||
+/*?*/ ( pRefFrm->Frm().Top() == pFldFrm->Frm().Top() &&
+/*?*/ pRefFrm->Frm().Left() < pFldFrm->Frm().Left() );
+/*?*/ else
+/*?*/ bRefIsLower = pRefFrm->Frm().Top() < pFldFrm->Frm().Top() ||
+/*?*/ ( pRefFrm->Frm().Top() == pFldFrm->Frm().Top() &&
+/*?*/ pRefFrm->Frm().Left() > pFldFrm->Frm().Left() );
+/*?*/ }
+/*?*/ else if( bR2L )
+/*?*/ bRefIsLower = pRefFrm->Frm().Left() > pFldFrm->Frm().Left() ||
+/*?*/ ( pRefFrm->Frm().Left() == pFldFrm->Frm().Left() &&
+/*?*/ pRefFrm->Frm().Top() < pFldFrm->Frm().Top() );
+/*?*/ else
+/*?*/ bRefIsLower = pRefFrm->Frm().Left() < pFldFrm->Frm().Left() ||
+/*?*/ ( pRefFrm->Frm().Left() == pFldFrm->Frm().Left() &&
+/*?*/ pRefFrm->Frm().Top() < pFldFrm->Frm().Top() );
+/*?*/ #else
+/*?*/ bRefIsLower = pRefFrm->Frm().Left() < pFldFrm->Frm().Left() ||
+/*?*/ ( pRefFrm->Frm().Left() == pFldFrm->Frm().Left() &&
+/*?*/ pRefFrm->Frm().Top() < pFldFrm->Frm().Top() );
+/*?*/ #endif
+/*?*/ pRefFrm = 0;
+/*?*/ }
+/*?*/ else if( ( FRM_COLUMN | FRM_CELL ) & pFldFrm->GetType() )
+/*?*/ pFldFrm = (const SwFrm*)aArr[ nCnt - 1 ];
+/*?*/ else
+/*?*/ pRefFrm = (const SwFrm*)aRefArr[ nRefCnt - 1 ];
+/*N*/ }
+/*N*/
+/*N*/ if( pRefFrm ) // als Flag missbrauchen
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ {
+/*?*/ if( bR2L )
+/*?*/ bRefIsLower = pRefFrm->Frm().Left() < pFldFrm->Frm().Left() ||
+/*?*/ ( pRefFrm->Frm().Left() == pFldFrm->Frm().Left() &&
+/*?*/ pRefFrm->Frm().Top() < pFldFrm->Frm().Top() );
+/*?*/ else
+/*?*/ bRefIsLower = pRefFrm->Frm().Left() > pFldFrm->Frm().Left() ||
+/*?*/ ( pRefFrm->Frm().Left() == pFldFrm->Frm().Left() &&
+/*?*/ pRefFrm->Frm().Top() < pFldFrm->Frm().Top() );
+/*N*/ }
+/*N*/ else if( bR2L )
+/*N*/ bRefIsLower = pRefFrm->Frm().Top() < pFldFrm->Frm().Top() ||
+/*N*/ ( pRefFrm->Frm().Top() == pFldFrm->Frm().Top() &&
+/*N*/ pRefFrm->Frm().Left() > pFldFrm->Frm().Left() );
+/*N*/ else
+/*N*/ bRefIsLower = pRefFrm->Frm().Top() < pFldFrm->Frm().Top() ||
+/*N*/ ( pRefFrm->Frm().Top() == pFldFrm->Frm().Top() &&
+/*N*/ pRefFrm->Frm().Left() < pFldFrm->Frm().Left() );
+/*N*/ }
+/*N*/ #else
+/*N*/ bRefIsLower = pRefFrm->Frm().Top() < pFldFrm->Frm().Top() ||
+/*N*/ ( pRefFrm->Frm().Top() == pFldFrm->Frm().Top() &&
+/*N*/ pRefFrm->Frm().Left() < pFldFrm->Frm().Left() );
+/*N*/ #endif
+/*N*/ return bRefIsLower;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Referenzen holen
+ --------------------------------------------------------------------*/
+
+
+/*N*/ SwGetRefField::SwGetRefField( SwGetRefFieldType* pFldType,
+/*N*/ const String& rSetRef, USHORT nSubTyp,
+/*N*/ USHORT nSeqenceNo, ULONG nFmt )
+/*N*/ : SwField( pFldType, nFmt ), sSetRefName( rSetRef ),
+/*N*/ nSubType( nSubTyp ), nSeqNo( nSeqenceNo )
+/*N*/ {
+/*N*/ }
+
+/*N*/ USHORT SwGetRefField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+void SwGetRefField::SetSubType( USHORT n )
+{
+ nSubType = n;
+}
+
+/*N*/ String SwGetRefField::Expand() const
+/*N*/ {
+/*N*/ return sTxt;
+/*N*/ }
+
+
+/*N*/ String SwGetRefField::GetCntnt(BOOL bName) const
+/*N*/ {
+/*N*/ if( !bName )
+/*N*/ return Expand();
+/*N*/
+/*?*/ String aStr(GetTyp()->GetName());
+/*?*/ aStr += ' ';
+/*?*/ aStr += sSetRefName;
+/*?*/ return aStr;
+/*N*/ }
+
+
+/*N*/ void SwGetRefField::UpdateField()
+/*N*/ {
+/*N*/ sTxt.Erase();
+/*N*/
+/*N*/ SwDoc* pDoc = ((SwGetRefFieldType*)GetTyp())->GetDoc();
+/*N*/ USHORT nStt, nEnd;
+/*N*/ SwTxtNode* pTxtNd = SwGetRefFieldType::FindAnchor( pDoc, sSetRefName,
+/*N*/ nSubType, nSeqNo, &nStt, &nEnd );
+/*N*/ if( !pTxtNd )
+/*N*/ return ;
+/*N*/
+/*N*/ switch( GetFormat() )
+/*N*/ {
+/*N*/ case REF_CONTENT:
+/*N*/ case REF_ONLYNUMBER:
+/*N*/ case REF_ONLYCAPTION:
+/*N*/ case REF_ONLYSEQNO:
+/*N*/ {
+/*N*/ switch( nSubType )
+/*N*/ {
+/*N*/ case REF_SEQUENCEFLD:
+/*N*/ nEnd = pTxtNd->GetTxt().Len();
+/*N*/ switch( GetFormat() )
+/*N*/ {
+/*N*/ case REF_ONLYNUMBER:
+/*N*/ if( nStt + 1 < nEnd )
+/*N*/ nEnd = nStt + 1;
+/*N*/ nStt = 0;
+/*N*/ break;
+/*N*/
+/*N*/ case REF_ONLYCAPTION:
+/*N*/ {
+/*N*/ const SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttr( nStt,
+/*N*/ RES_TXTATR_FIELD );
+/*N*/ if( pTxtAttr )
+/*N*/ nStt = SwGetExpField::GetReferenceTextPos(
+/*N*/ pTxtAttr->GetFld(), *pDoc );
+/*N*/ else if( nStt + 1 < nEnd )
+/*N*/ ++nStt;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case REF_ONLYSEQNO:
+/*N*/ if( nStt + 1 < nEnd )
+/*N*/ nEnd = nStt + 1;
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ nStt = 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case REF_BOOKMARK:
+/*N*/ if( USHRT_MAX == nEnd )
+/*N*/ {
+/*N*/ // Text steht ueber verschiedene Nodes verteilt.
+/*N*/ // Gesamten Text oder nur bis zum Ende vom Node?
+/*N*/ nEnd = pTxtNd->GetTxt().Len();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case REF_OUTLINE:
+/*N*/ break;
+/*N*/
+/*N*/ case REF_FOOTNOTE:
+/*N*/ case REF_ENDNOTE:
+/*N*/ {
+/*N*/ // die Nummer oder den NumString besorgen
+/*N*/ USHORT n, nFtnCnt = pDoc->GetFtnIdxs().Count();
+/*N*/ SwTxtFtn* pFtnIdx;
+/*N*/ for( n = 0; n < nFtnCnt; ++n )
+/*N*/ if( nSeqNo == (pFtnIdx = pDoc->GetFtnIdxs()[ n ])->GetSeqRefNo() )
+/*N*/ {
+/*N*/ sTxt = pFtnIdx->GetFtn().GetViewNumStr( *pDoc );
+/*N*/ break;
+/*N*/ }
+/*N*/ nStt = nEnd; // kein Bereich, der String ist fertig
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( nStt != nEnd ) // ein Bereich?
+/*N*/ {
+/*N*/ sTxt = pTxtNd->GetExpandTxt( nStt, nEnd - nStt, FALSE );
+/*N*/
+/*N*/ // alle Sonderzeichen entfernen (durch Blanks ersetzen):
+/*N*/ if( sTxt.Len() )
+/*N*/ {
+/*N*/ sTxt.EraseAllChars( 0xad );
+/*N*/ for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p )
+/*N*/ {
+/*N*/ if( *p < 0x20 )
+/*N*/ *p = 0x20;
+/*N*/ else if(*p == 0x2011)
+/*N*/ *p = '-';
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case REF_PAGE:
+/*N*/ case REF_PAGE_PGDESC:
+/*N*/ {
+/*N*/ const SwTxtFrm* pFrm = (SwTxtFrm*)pTxtNd->GetFrm(0,0,FALSE),
+/*N*/ *pSave = pFrm;
+/*N*/ while( pFrm && !pFrm->IsInside( nStt ) )
+/*N*/ pFrm = (SwTxtFrm*)pFrm->GetFollow();
+/*N*/
+/*N*/ if( pFrm || 0 != ( pFrm = pSave ))
+/*N*/ {
+/*N*/ USHORT nPageNo = pFrm->GetVirtPageNum();
+/*N*/ const SwPageFrm *pPage;
+/*N*/ if( REF_PAGE_PGDESC == GetFormat() &&
+/*N*/ 0 != ( pPage = pFrm->FindPageFrm() ) &&
+/*N*/ pPage->GetPageDesc() )
+/*N*/ sTxt = pPage->GetPageDesc()->GetNumType().GetNumStr( nPageNo );
+/*N*/ else
+/*N*/ sTxt = String::CreateFromInt32(nPageNo);
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case REF_CHAPTER:
+/*N*/ {
+/*N*/ // ein bischen trickreich: suche irgend einen Frame
+/*N*/ const SwFrm* pFrm = pTxtNd->GetFrm();
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ SwChapterFieldType aFldTyp;
+/*N*/ SwChapterField aFld( &aFldTyp, 0 );
+/*N*/ aFld.SetLevel( MAXLEVEL - 1 );
+/*N*/ aFld.ChangeExpansion( pFrm, pTxtNd, TRUE );
+/*N*/ sTxt = aFld.GetNumber();
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case REF_UPDOWN:
+/*N*/ {
+/*N*/ const SwTxtFld* pTFld = 0;
+/*N*/
+/*N*/ {
+/*N*/ SwClientIter aIter( *GetTyp() );
+/*N*/ for( SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) );
+/*N*/ pFld; pFld = (SwFmtFld*)aIter.Next() )
+/*N*/ if( pFld->GetFld() == this )
+/*N*/ {
+/*N*/ pTFld = pFld->GetTxtFld();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !pTFld || !pTFld->GetpTxtNode() ) // noch nicht im Node gestezt?
+/*N*/ break;
+/*N*/
+/*N*/ LocaleDataWrapper aLocaleData(
+/*N*/ ::legacy_binfilters::getLegacyProcessServiceFactory(),
+/*N*/ SvxCreateLocale( GetLanguage() ) );
+/*N*/
+/*N*/ // erstmal ein "Kurz" - Test - falls beide im selben
+/*N*/ // Node stehen!
+/*N*/ if( pTFld->GetpTxtNode() == pTxtNd )
+/*N*/ {
+/*N*/ sTxt = nStt < *pTFld->GetStart()
+/*N*/ ? aLocaleData.getAboveWord()
+/*N*/ : aLocaleData.getBelowWord();
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ sTxt = ::binfilter::IsFrameBehind( *pTFld->GetpTxtNode(), *pTFld->GetStart(),
+/*N*/ *pTxtNd, nStt )
+/*N*/ ? aLocaleData.getAboveWord()
+/*N*/ : aLocaleData.getBelowWord();
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwField* SwGetRefField::Copy() const
+/*N*/ {
+/*N*/ SwGetRefField* pFld = new SwGetRefField( (SwGetRefFieldType*)GetTyp(),
+/*N*/ sSetRefName, nSubType,
+/*N*/ nSeqNo, GetFormat() );
+/*N*/ pFld->sTxt = sTxt;
+/*N*/ return pFld;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: ReferenzName holen
+ --------------------------------------------------------------------*/
+
+
+/*N*/ const String& SwGetRefField::GetPar1() const
+/*N*/ {
+/*N*/ return sSetRefName;
+/*N*/ }
+
+
+void SwGetRefField::SetPar1( const String& rName )
+{
+ sSetRefName = rName;
+}
+
+
+String SwGetRefField::GetPar2() const
+{
+ return Expand();
+}
+
+/*-----------------06.03.98 13:34-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwGetRefField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ {
+/*N*/ sal_Int16 nPart = 0;
+/*N*/ switch(GetFormat())
+/*N*/ {
+/*N*/ case REF_PAGE : nPart = ReferenceFieldPart::PAGE ; break;
+/*N*/ case REF_CHAPTER : nPart = ReferenceFieldPart::CHAPTER ; break;
+/*N*/ case REF_CONTENT : nPart = ReferenceFieldPart::TEXT ; break;
+/*N*/ case REF_UPDOWN : nPart = ReferenceFieldPart::UP_DOWN ; break;
+/*?*/ case REF_PAGE_PGDESC: nPart = ReferenceFieldPart::PAGE_DESC ; break;
+/*N*/ case REF_ONLYNUMBER : nPart = ReferenceFieldPart::CATEGORY_AND_NUMBER ; break;
+/*N*/ case REF_ONLYCAPTION: nPart = ReferenceFieldPart::ONLY_CAPTION ; break;
+/*N*/ case REF_ONLYSEQNO : nPart = ReferenceFieldPart::ONLY_SEQUENCE_NUMBER; break;
+/*N*/ }
+/*N*/ rAny <<= nPart;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_USHORT2:
+/*N*/ {
+/*N*/ sal_Int16 nSource = 0;
+/*N*/ switch(nSubType)
+/*N*/ {
+/*N*/ case REF_SETREFATTR : nSource = ReferenceFieldSource::REFERENCE_MARK; break;
+/*N*/ case REF_SEQUENCEFLD: nSource = ReferenceFieldSource::SEQUENCE_FIELD; break;
+/*?*/ case REF_BOOKMARK : nSource = ReferenceFieldSource::BOOKMARK; break;
+/*?*/ case REF_OUTLINE : DBG_ERROR("not implemented"); break;
+/*?*/ case REF_FOOTNOTE : nSource = ReferenceFieldSource::FOOTNOTE; break;
+/*?*/ case REF_ENDNOTE : nSource = ReferenceFieldSource::ENDNOTE; break;
+/*N*/ }
+/*N*/ rAny <<= nSource;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*N*/ {
+/*N*/ String sTmp(GetPar1());
+/*N*/ if(REF_SEQUENCEFLD == nSubType)
+/*N*/ {
+/*N*/ sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sTmp, GET_POOLID_TXTCOLL );
+/*N*/ switch( nPoolId )
+/*N*/ {
+/*N*/ case RES_POOLCOLL_LABEL_ABB:
+/*N*/ case RES_POOLCOLL_LABEL_TABLE:
+/*N*/ case RES_POOLCOLL_LABEL_FRAME:
+/*N*/ case RES_POOLCOLL_LABEL_DRAWING:
+/*?*/ SwStyleNameMapper::FillProgName(nPoolId, sTmp) ;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ rAny <<= ::rtl::OUString(sTmp);
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR3:
+/*?*/ rAny <<= ::rtl::OUString(Expand());
+/*?*/ break;
+/*N*/ case FIELD_PROP_SHORT1:
+/*N*/ rAny <<= (sal_Int16)nSeqNo;
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*-----------------06.03.98 13:34-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwGetRefField::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ String sTmp;
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_USHORT1:
+/*N*/ {
+/*N*/ sal_Int16 nPart;
+/*N*/ rAny >>= nPart;
+/*N*/ switch(nPart)
+/*N*/ {
+/*N*/ case ReferenceFieldPart::PAGE: nPart = REF_PAGE; break;
+/*N*/ case ReferenceFieldPart::CHAPTER: nPart = REF_CHAPTER; break;
+/*N*/ case ReferenceFieldPart::TEXT: nPart = REF_CONTENT; break;
+/*N*/ case ReferenceFieldPart::UP_DOWN: nPart = REF_UPDOWN; break;
+/*?*/ case ReferenceFieldPart::PAGE_DESC: nPart = REF_PAGE_PGDESC; break;
+/*N*/ case ReferenceFieldPart::CATEGORY_AND_NUMBER: nPart = REF_ONLYNUMBER; break;
+/*N*/ case ReferenceFieldPart::ONLY_CAPTION: nPart = REF_ONLYCAPTION; break;
+/*N*/ case ReferenceFieldPart::ONLY_SEQUENCE_NUMBER : nPart = REF_ONLYSEQNO; break;
+/*?*/ default: return FALSE;
+/*N*/ }
+/*N*/ SetFormat(nPart);
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_USHORT2:
+/*N*/ {
+/*N*/ sal_Int16 nSource;
+/*N*/ rAny >>= nSource;
+/*N*/ switch(nSource)
+/*N*/ {
+/*N*/ case ReferenceFieldSource::REFERENCE_MARK : nSubType = REF_SETREFATTR ; break;
+/*N*/ case ReferenceFieldSource::SEQUENCE_FIELD :
+/*N*/ {
+/*N*/ if(REF_SEQUENCEFLD == nSubType)
+/*?*/ break;
+/*N*/ nSubType = REF_SEQUENCEFLD;
+/*N*/ ConvertProgrammaticToUIName();
+/*N*/ }
+/*N*/ break;
+/*?*/ case ReferenceFieldSource::BOOKMARK : nSubType = REF_BOOKMARK ; break;
+/*?*/ case ReferenceFieldSource::FOOTNOTE : nSubType = REF_FOOTNOTE ; break;
+/*?*/ case ReferenceFieldSource::ENDNOTE : nSubType = REF_ENDNOTE ; break;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 OUString sTmp;
+/*?*/ }
+/*?*/ break;
+/*?*/ case FIELD_PROP_PAR3:
+/*?*/ SetExpand( ::binfilter::GetString( rAny, sTmp ));
+/*?*/ break;
+/*N*/ case FIELD_PROP_SHORT1:
+/*N*/ {
+/*N*/ sal_Int16 nSetSeq;
+/*N*/ rAny >>= nSetSeq;
+/*N*/ if(nSetSeq >= 0)
+/*N*/ nSeqNo = nSetSeq;
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/* -----------------------------11.01.2002 12:50------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ void SwGetRefField::ConvertProgrammaticToUIName()
+/*N*/ {
+/*N*/ if(GetTyp() && REF_SEQUENCEFLD == nSubType)
+/*N*/ {
+/*N*/ SwDoc* pDoc = ((SwGetRefFieldType*)GetTyp())->GetDoc();
+/*N*/ const String& rPar1 = GetPar1();
+/*N*/ //don't convert when the name points to an existing field type
+/*N*/ if(!pDoc->GetFldType(RES_SETEXPFLD, rPar1))
+/*N*/ {
+/*N*/ sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromProgName( rPar1, GET_POOLID_TXTCOLL );
+/*N*/ USHORT nResId = USHRT_MAX;
+/*N*/ switch( nPoolId )
+/*N*/ {
+/*?*/ case RES_POOLCOLL_LABEL_ABB:
+/*?*/ nResId = STR_POOLCOLL_LABEL_ABB;
+/*?*/ break;
+/*?*/ case RES_POOLCOLL_LABEL_TABLE:
+/*?*/ nResId = STR_POOLCOLL_LABEL_TABLE;
+/*?*/ break;
+/*?*/ case RES_POOLCOLL_LABEL_FRAME:
+/*?*/ nResId = STR_POOLCOLL_LABEL_FRAME;
+/*?*/ break;
+/*?*/ case RES_POOLCOLL_LABEL_DRAWING:
+/*?*/ nResId = STR_POOLCOLL_LABEL_DRAWING;
+/*?*/ break;
+/*N*/ }
+/*N*/ if( nResId != USHRT_MAX )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 SetPar1(SW_RESSTR( nResId ));
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*-----------------JP: 18.06.93 -------------------
+ Get-Referenz-Type
+ --------------------------------------------------*/
+
+
+/*N*/ SwGetRefFieldType::SwGetRefFieldType( SwDoc* pDc )
+/*N*/ : SwFieldType( RES_GETREFFLD ), pDoc( pDc )
+/*N*/ {}
+
+
+/*N*/ SwFieldType* SwGetRefFieldType::Copy() const
+/*N*/ {
+DBG_BF_ASSERT(0, "STRIP");return NULL; //STRIP001 //STRIP001 return new SwGetRefFieldType( pDoc );
+/*N*/ }
+
+
+/*N*/ void SwGetRefFieldType::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ // Update auf alle GetReferenz-Felder
+/*N*/ if( !pNew && !pOld )
+/*N*/ {
+/*N*/ SwClientIter aIter( *this );
+/*N*/ for( SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) );
+/*N*/ pFld; pFld = (SwFmtFld*)aIter.Next() )
+/*N*/ {
+/*N*/ // nur die GetRef-Felder Updaten
+/*N*/ //JP 3.4.2001: Task 71231 - we need the correct language
+/*N*/ SwGetRefField* pGRef = (SwGetRefField*)pFld->GetFld();
+/*N*/ const SwTxtFld* pTFld;
+/*N*/ if( !pGRef->GetLanguage() &&
+/*N*/ 0 != ( pTFld = pFld->GetTxtFld()) &&
+/*N*/ pTFld->GetpTxtNode() )
+/*N*/ pGRef->SetLanguage( pTFld->GetpTxtNode()->GetLang(
+/*N*/ *pTFld->GetStart() ) );
+/*N*/
+/*N*/ pGRef->UpdateField();
+/*N*/ }
+/*N*/ }
+/*N*/ // weiter an die Text-Felder, diese "Expandieren" den Text
+/*N*/ SwModify::Modify( pOld, pNew );
+/*N*/ }
+
+/*N*/ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark,
+/*N*/ USHORT nSubType, USHORT nSeqNo,
+/*N*/ USHORT* pStt, USHORT* pEnd )
+/*N*/ {
+/*N*/ ASSERT( pStt, "warum wird keine StartPos abgefragt?" );
+/*N*/
+/*N*/ SwTxtNode* pTxtNd = 0;
+/*N*/ switch( nSubType )
+/*N*/ {
+/*N*/ case REF_SETREFATTR:
+/*N*/ {
+/*N*/ const SwFmtRefMark *pRef = pDoc->GetRefMark( rRefMark );
+/*N*/ if( pRef && pRef->GetTxtRefMark() )
+/*N*/ {
+/*N*/ pTxtNd = (SwTxtNode*)&pRef->GetTxtRefMark()->GetTxtNode();
+/*N*/ *pStt = *pRef->GetTxtRefMark()->GetStart();
+/*N*/ if( pEnd )
+/*N*/ *pEnd = *pRef->GetTxtRefMark()->GetAnyEnd();
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case REF_SEQUENCEFLD:
+/*?*/ {
+/*?*/ SwFieldType* pFldType = pDoc->GetFldType( RES_SETEXPFLD, rRefMark );
+/*?*/ if( pFldType && pFldType->GetDepends() &&
+/*?*/ GSE_SEQ & ((SwSetExpFieldType*)pFldType)->GetType() )
+/*?*/ {
+/*?*/ SwClientIter aIter( *pFldType );
+/*?*/ for( SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) );
+/*?*/ pFld; pFld = (SwFmtFld*)aIter.Next() )
+/*?*/ {
+/*?*/ if( pFld->GetTxtFld() && nSeqNo ==
+/*?*/ ((SwSetExpField*)pFld->GetFld())->GetSeqNumber() )
+/*?*/ {
+/*?*/ SwTxtFld* pTxtFld = pFld->GetTxtFld();
+/*?*/ pTxtNd = (SwTxtNode*)pTxtFld->GetpTxtNode();
+/*?*/ *pStt = *pTxtFld->GetStart();
+/*?*/ if( pEnd )
+/*?*/ *pEnd = (*pStt) + 1;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case REF_BOOKMARK:
+/*?*/ {
+/*?*/ USHORT nPos = pDoc->FindBookmark( rRefMark );
+/*?*/ if( USHRT_MAX != nPos )
+/*?*/ {
+/*?*/ const SwBookmark& rBkmk = *pDoc->GetBookmarks()[ nPos ];
+/*?*/ const SwPosition* pPos = &rBkmk.GetPos();
+/*?*/ if( rBkmk.GetOtherPos() && *pPos > *rBkmk.GetOtherPos() )
+/*?*/ pPos = rBkmk.GetOtherPos();
+/*?*/
+/*?*/ pTxtNd = pDoc->GetNodes()[ pPos->nNode ]->GetTxtNode();
+/*?*/ *pStt = pPos->nContent.GetIndex();
+/*?*/ if( pEnd )
+/*?*/ {
+/*?*/ if( !rBkmk.GetOtherPos() )
+/*?*/ *pEnd = *pStt;
+/*?*/ else if( rBkmk.GetOtherPos()->nNode == rBkmk.GetPos().nNode )
+/*?*/ {
+/*?*/ *pEnd = rBkmk.GetOtherPos() == pPos
+/*?*/ ? rBkmk.GetPos().nContent.GetIndex()
+/*?*/ : rBkmk.GetOtherPos()->nContent.GetIndex();
+/*?*/ }
+/*?*/ else
+/*?*/ *pEnd = USHRT_MAX;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case REF_OUTLINE:
+/*?*/ break;
+/*?*/
+/*?*/ case REF_FOOTNOTE:
+/*?*/ case REF_ENDNOTE:
+/*?*/ {
+/*?*/ USHORT n, nFtnCnt = pDoc->GetFtnIdxs().Count();
+/*?*/ SwTxtFtn* pFtnIdx;
+/*?*/ for( n = 0; n < nFtnCnt; ++n )
+/*?*/ if( nSeqNo == (pFtnIdx = pDoc->GetFtnIdxs()[ n ])->GetSeqRefNo() )
+/*?*/ {
+/*?*/ SwNodeIndex* pIdx = pFtnIdx->GetStartNode();
+/*?*/ if( pIdx )
+/*?*/ {
+/*?*/ SwNodeIndex aIdx( *pIdx, 1 );
+/*?*/ if( 0 == ( pTxtNd = aIdx.GetNode().GetTxtNode()))
+/*?*/ pTxtNd = (SwTxtNode*)pDoc->GetNodes().GoNext( &aIdx );
+/*?*/ }
+/*?*/ *pStt = 0;
+/*?*/ if( pEnd )
+/*?*/ *pEnd = 0;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ return pTxtNd;
+/*N*/ }
+
+
+
+
+
+
+/*N*/ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc )
+/*N*/ {
+/*N*/ if( &rDestDoc != pDoc &&
+/*N*/ rDestDoc.GetSysFldType( RES_GETREFFLD )->GetDepends() )
+/*N*/ {
+/*?*/ // dann gibt es im DestDoc RefFelder, also muessen im SourceDoc
+/*?*/ // alle RefFelder auf einduetige Ids in beiden Docs umgestellt
+/*?*/ // werden.
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 _RefIdsMap aFntMap( aEmptyStr );
+/*N*/ }
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_scrptfld.cxx b/binfilter/bf_sw/source/core/fields/sw_scrptfld.cxx
new file mode 100644
index 000000000000..04b8a4b29aed
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_scrptfld.cxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <docufld.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+/*--------------------------------------------------------------------
+ Beschreibung: ScriptField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwScriptFieldType::SwScriptFieldType( SwDoc* pD )
+/*N*/ : SwFieldType( RES_SCRIPTFLD ), pDoc( pD )
+/*N*/ {}
+
+/*N*/ SwFieldType* SwScriptFieldType::Copy() const
+/*N*/ {
+ return new SwScriptFieldType( pDoc );
+/*N*/ }
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwScriptField
+ --------------------------------------------------------------------*/
+
+/*N*/ SwScriptField::SwScriptField( SwScriptFieldType* pType,
+/*N*/ const String& rType, const String& rCode,
+/*N*/ BOOL bURL )
+/*N*/ : SwField( pType ), sType( rType ), sCode( rCode ), bCodeURL( bURL )
+/*N*/ {
+/*N*/ }
+
+/*N*/ String SwScriptField::Expand() const
+/*N*/ {
+/*N*/ return aEmptyStr;
+/*N*/ }
+
+SwField* SwScriptField::Copy() const
+{
+ return new SwScriptField( (SwScriptFieldType*)GetTyp(), sType, sCode, bCodeURL );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Type setzen
+ --------------------------------------------------------------------*/
+
+void SwScriptField::SetPar1( const String& rStr )
+{
+ sType = rStr;
+}
+
+const String& SwScriptField::GetPar1() const
+{
+ return sType;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Code setzen
+ --------------------------------------------------------------------*/
+
+void SwScriptField::SetPar2( const String& rStr )
+{
+ sCode = rStr;
+}
+
+
+String SwScriptField::GetPar2() const
+{
+ return sCode;
+}
+/*-----------------05.03.98 15:00-------------------
+
+--------------------------------------------------*/
+BOOL SwScriptField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ rAny <<= OUString( sType );
+ break;
+ case FIELD_PROP_PAR2:
+ rAny <<= OUString( sCode );
+ break;
+ case FIELD_PROP_BOOL1:
+ rAny.setValue(&bCodeURL, ::getBooleanCppuType());
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return TRUE;
+}
+/*-----------------05.03.98 15:00-------------------
+
+--------------------------------------------------*/
+BOOL SwScriptField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ switch( nMId )
+ {
+ case FIELD_PROP_PAR1:
+ ::binfilter::GetString( rAny, sType );
+ break;
+ case FIELD_PROP_PAR2:
+ ::binfilter::GetString( rAny, sCode );
+ break;
+ case FIELD_PROP_BOOL1:
+ bCodeURL = *(sal_Bool*)rAny.getValue();
+ break;
+ default:
+ DBG_ERROR("illegal property");
+ }
+ return TRUE;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_tblcalc.cxx b/binfilter/bf_sw/source/core/fields/sw_tblcalc.cxx
new file mode 100644
index 000000000000..4c3c1d271c04
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_tblcalc.cxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <cntfrm.hxx>
+
+#include <horiornt.hxx>
+
+#include <ndtxt.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <expfld.hxx>
+#include <docfld.hxx> // fuer _SetGetExpFld
+#include <unofldmid.h>
+namespace binfilter {
+
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+
+/*N*/ SwTblFieldType::SwTblFieldType(SwDoc* pDocPtr)
+/*N*/ : SwValueFieldType( pDocPtr, RES_TABLEFLD )
+/*N*/ {}
+
+
+/*N*/ SwFieldType* SwTblFieldType::Copy() const
+/*N*/ {
+ return new SwTblFieldType(GetDoc());
+/*N*/ }
+
+
+
+/*N*/ void SwTblField::CalcField( SwTblCalcPara& rCalcPara )
+/*N*/ {
+/*N*/ if( rCalcPara.rCalc.IsCalcError() ) // ist schon Fehler gesetzt ?
+/*?*/ return;
+/*N*/
+/*N*/ // erzeuge aus den BoxNamen die Pointer
+/*N*/ BoxNmToPtr( rCalcPara.pTbl );
+/*N*/ String sFml( MakeFormel( rCalcPara ));
+/*N*/ SetValue( rCalcPara.rCalc.Calculate( sFml ).GetDouble() );
+/*N*/ ChgValid( !rCalcPara.IsStackOverFlow() ); // ist der Wert wieder gueltig?
+/*N*/ }
+
+
+
+/*N*/ SwTblField::SwTblField( SwTblFieldType* pType, const String& rFormel,
+/*N*/ USHORT nType, ULONG nFmt )
+/*N*/ : SwValueField( pType, nFmt ), SwTableFormula( rFormel ),
+/*N*/ nSubType(nType), sExpand( '0' )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwField* SwTblField::Copy() const
+/*N*/ {
+/*N*/ SwTblField* pTmp = new SwTblField( (SwTblFieldType*)GetTyp(),
+/*N*/ SwTableFormula::GetFormula(), nSubType, GetFormat() );
+/*N*/ pTmp->sExpand = sExpand;
+/*N*/ pTmp->SwValueField::SetValue(GetValue());
+/*N*/ pTmp->SwTableFormula::operator=( *this );
+/*N*/ pTmp->SetAutomaticLanguage(IsAutomaticLanguage());
+/*N*/ return pTmp;
+/*N*/ }
+
+
+/*N*/ String SwTblField::GetCntnt(BOOL bName) const
+/*N*/ {
+/*N*/ if( bName )
+/*N*/ {
+/*?*/ String aStr(GetTyp()->GetName());
+/*?*/ aStr += ' ';
+/*?*/
+/*?*/ USHORT nOldSubType = nSubType;
+/*?*/ SwTblField* pThis = (SwTblField*)this;
+/*?*/ pThis->nSubType |= SUB_CMD;
+/*?*/ aStr += Expand();
+/*?*/ pThis->nSubType = nOldSubType;
+/*?*/
+/*?*/ return aStr;
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+
+// suche den TextNode, in dem das Feld steht
+/*N*/ const SwNode* SwTblField::GetNodeOfFormula() const
+/*N*/ {
+/*N*/ if( !GetTyp()->GetDepends() )
+/*N*/ return 0;
+/*N*/
+/*N*/ SwClientIter aIter( *GetTyp() );
+/*N*/ SwClient * pLast = aIter.GoStart();
+/*N*/ if( pLast ) // konnte zum Anfang gesprungen werden ??
+/*N*/ do {
+/*N*/ const SwFmtFld* pFmtFld = (SwFmtFld*)pLast;
+/*N*/ if( this == pFmtFld->GetFld() )
+/*N*/ return (SwTxtNode*)&pFmtFld->GetTxtFld()->GetTxtNode();
+/*N*/
+/*N*/ } while( 0 != ( pLast = aIter++ ));
+/*N*/ return 0;
+/*N*/ }
+
+
+/*N*/ String SwTblField::Expand() const
+/*N*/ {
+/*N*/ String aStr;
+/*N*/ if (nSubType & SUB_CMD)
+/*N*/ {
+/*N*/ if( EXTRNL_NAME != GetNameType() )
+/*N*/ {
+/*?*/ const SwNode* pNd = GetNodeOfFormula();
+/*?*/ const SwTableNode* pTblNd = pNd ? pNd->FindTableNode() : 0;
+/*?*/ if( pTblNd )
+/*?*/ ((SwTblField*)this)->PtrToBoxNm( &pTblNd->GetTable() );
+/*N*/ }
+/*N*/ if( EXTRNL_NAME == GetNameType() )
+/*N*/ aStr = SwTableFormula::GetFormula();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aStr = sExpand;
+/*N*/ if(nSubType & GSE_STRING)
+/*N*/ {
+/*?*/ // es ist ein String
+/*?*/ aStr = sExpand;
+/*?*/ aStr.Erase( 0,1 );
+/*?*/ aStr.Erase( aStr.Len()-1, 1 );
+/*N*/ }
+/*N*/ }
+/*N*/ return aStr;
+/*N*/ }
+
+/*N*/ USHORT SwTblField::GetSubType() const
+/*N*/ {
+/*N*/ return nSubType;
+/*N*/ }
+
+void SwTblField::SetSubType(USHORT nType)
+{
+ nSubType = nType;
+}
+
+
+/*N*/ void SwTblField::SetValue( const double& rVal )
+/*N*/ {
+/*N*/ SwValueField::SetValue(rVal);
+/*N*/ sExpand = ((SwValueFieldType*)GetTyp())->ExpandValue(rVal, GetFormat(), GetLanguage());
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parameter setzen
+ --------------------------------------------------------------------*/
+
+
+/*N*/ String SwTblField::GetPar2() const
+/*N*/ {
+/*N*/ return SwTableFormula::GetFormula();
+/*N*/ }
+
+
+void SwTblField::SetPar2(const String& rStr)
+{
+ SetFormula( rStr );
+}
+
+
+/*-----------------04.03.98 10:33-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwTblField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ BOOL bRet = TRUE;
+/*N*/ switch ( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ {
+/*N*/ USHORT nOldSubType = nSubType;
+/*N*/ SwTblField* pThis = (SwTblField*)this;
+/*N*/ pThis->nSubType |= SUB_CMD;
+/*N*/ rAny <<= ::rtl::OUString( Expand() );
+/*N*/ pThis->nSubType = nOldSubType;
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ BOOL bFormula = 0 != (SUB_CMD & nSubType);
+/*N*/ rAny.setValue(&bFormula, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR1:
+/*?*/ rAny <<= ::rtl::OUString(GetExpStr());
+/*?*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int32)GetFormat();
+/*N*/ break;
+/*N*/ default:
+/*?*/ bRet = sal_False;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*-----------------04.03.98 10:33-------------------
+
+--------------------------------------------------*/
+BOOL SwTblField::PutValue( const uno::Any& rAny, BYTE nMId )
+{
+ nMId &= ~CONVERT_TWIPS;
+ BOOL bRet = TRUE;
+ String sTmp;
+ switch ( nMId )
+ {
+ case FIELD_PROP_PAR2:
+ SetFormula( ::binfilter::GetString( rAny, sTmp ));
+ break;
+ case FIELD_PROP_BOOL1:
+ if(*(sal_Bool*)rAny.getValue())
+ nSubType = GSE_FORMULA|SUB_CMD;
+ else
+ nSubType = GSE_FORMULA;
+ break;
+ case FIELD_PROP_PAR1:
+ ChgExpStr( ::binfilter::GetString( rAny, sTmp ));
+ break;
+ case FIELD_PROP_FORMAT:
+ {
+ sal_Int32 nTmp;
+ rAny >>= nTmp;
+ SetFormat(nTmp);
+ }
+ break;
+ default:
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/fields/sw_usrfld.cxx b/binfilter/bf_sw/source/core/fields/sw_usrfld.cxx
new file mode 100644
index 000000000000..f7862a824a92
--- /dev/null
+++ b/binfilter/bf_sw/source/core/fields/sw_usrfld.cxx
@@ -0,0 +1,377 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svtools/zformat.hxx>
+
+
+#include <calc.hxx>
+#include <usrfld.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+extern String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+using namespace ::com::sun::star;
+using namespace ::rtl;
+/*--------------------------------------------------------------------
+ Beschreibung: Benutzerfelder
+ --------------------------------------------------------------------*/
+
+/*N*/ SwUserField::SwUserField(SwUserFieldType* pTyp, sal_uInt16 nSub, sal_uInt32 nFmt)
+/*N*/ : SwValueField(pTyp, nFmt),
+/*N*/ nSubType(nSub)
+/*N*/ {
+/*N*/ }
+
+/*N*/ String SwUserField::Expand() const
+/*N*/ {
+/*N*/ String sStr;
+/*N*/ if(!(nSubType & SUB_INVISIBLE))
+/*N*/ sStr = ((SwUserFieldType*)GetTyp())->Expand(GetFormat(), nSubType, GetLanguage());
+/*N*/
+/*N*/ return sStr;
+/*N*/ }
+
+/*N*/ SwField* SwUserField::Copy() const
+/*N*/ {
+/*N*/ SwField* pTmp = new SwUserField((SwUserFieldType*)GetTyp(), nSubType, GetFormat());
+/*N*/ pTmp->SetAutomaticLanguage(IsAutomaticLanguage());
+/*N*/ return pTmp;
+/*N*/ }
+
+/*N*/ String SwUserField::GetCntnt(sal_Bool bName) const
+/*N*/ {
+/*N*/ if ( bName )
+/*N*/ { String aStr(SwFieldType::GetTypeStr(TYP_USERFLD));
+/*?*/ aStr += ' ';
+/*?*/ aStr += GetTyp()->GetName();
+/*?*/ aStr.AppendAscii(" = ");
+/*?*/ aStr += ((SwUserFieldType*)GetTyp())->GetContent();
+/*?*/ return aStr;
+/*N*/ }
+/*N*/ return Expand();
+/*N*/ }
+
+double SwUserField::GetValue() const
+{
+ return ((SwUserFieldType*)GetTyp())->GetValue();
+}
+
+void SwUserField::SetValue( const double& rVal )
+{
+ ((SwUserFieldType*)GetTyp())->SetValue(rVal);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Name
+ --------------------------------------------------------------------*/
+
+const String& SwUserField::GetPar1() const
+{
+ return ((SwUserFieldType*)GetTyp())->GetName();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Content
+ --------------------------------------------------------------------*/
+
+String SwUserField::GetPar2() const
+{
+ return ((SwUserFieldType*)GetTyp())->GetContent(GetFormat());
+}
+
+void SwUserField::SetPar2(const String& rStr)
+{
+ ((SwUserFieldType*)GetTyp())->SetContent(rStr, GetFormat());
+}
+
+/*N*/ sal_uInt16 SwUserField::GetSubType() const
+/*N*/ {
+/*N*/ return ((SwUserFieldType*)GetTyp())->GetType() | nSubType;
+/*N*/ }
+
+/*N*/ void SwUserField::SetSubType(sal_uInt16 nSub)
+/*N*/ {
+/*N*/ ((SwUserFieldType*)GetTyp())->SetType(nSub & 0x00ff);
+/*N*/ nSubType = nSub & 0xff00;
+/*N*/ }
+
+/*-----------------09.03.98 08:04-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwUserField::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ {
+/*N*/ BOOL bTmp = 0 != (nSubType & SUB_CMD);
+/*N*/ rAny.setValue(&bTmp, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ BOOL bTmp = 0 == (nSubType & SUB_INVISIBLE);
+/*N*/ rAny.setValue(&bTmp, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*N*/ rAny <<= (sal_Int32)GetFormat();
+/*N*/ break;
+/*N*/ default:
+/*?*/ return SwField::QueryValue(rAny, nMId);
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------09.03.98 08:04-------------------
+
+--------------------------------------------------*/
+/*N*/ sal_Bool SwUserField::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ if(*(sal_Bool*) rAny.getValue())
+/*N*/ nSubType &= (~SUB_INVISIBLE);
+/*N*/ else
+/*?*/ nSubType |= SUB_INVISIBLE;
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL2:
+/*N*/ if(*(sal_Bool*) rAny.getValue())
+/*N*/ nSubType |= SUB_CMD;
+/*N*/ else
+/*N*/ nSubType &= (~SUB_CMD);
+/*N*/ break;
+/*N*/ case FIELD_PROP_FORMAT:
+/*?*/ {
+/*?*/ sal_Int32 nTmp;
+/*?*/ rAny >>= nTmp;
+/*?*/ SetFormat(nTmp);
+/*?*/ }
+/*?*/ break;
+/*?*/ default:
+/*?*/ return SwField::PutValue(rAny, nMId);
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benutzerfeldtypen
+ --------------------------------------------------------------------*/
+
+/*N*/ SwUserFieldType::SwUserFieldType( SwDoc* pDocPtr, const String& aNam )
+/*N*/ : SwValueFieldType( pDocPtr, RES_USERFLD ),
+/*N*/ nType(GSE_STRING),
+/*N*/ nValue( 0 )
+/*N*/ {
+/*N*/ bValidValue = bDeleted = sal_False;
+/*N*/ aName = aNam;
+/*N*/
+/*N*/ if (nType & GSE_STRING)
+/*N*/ EnableFormat(sal_False); // Numberformatter nicht einsetzen
+/*N*/ }
+
+/*N*/ String SwUserFieldType::Expand(sal_uInt32 nFmt, sal_uInt16 nSubType, sal_uInt16 nLng)
+/*N*/ {
+/*N*/ String aStr(aContent);
+/*N*/ if((nType & GSE_EXPR) && !(nSubType & SUB_CMD))
+/*N*/ {
+/*N*/ EnableFormat(sal_True);
+/*N*/ aStr = ExpandValue(nValue, nFmt, nLng);
+/*N*/ }
+/*N*/ else
+/*N*/ EnableFormat(sal_False); // Numberformatter nicht einsetzen
+/*N*/
+/*N*/ return aStr;
+/*N*/ }
+
+/*N*/ SwFieldType* SwUserFieldType::Copy() const
+/*N*/ {
+/*N*/ SwUserFieldType *pTmp = new SwUserFieldType( GetDoc(), aName );
+/*N*/ pTmp->aContent = aContent;
+/*N*/ pTmp->nType = nType;
+/*N*/ pTmp->bValidValue = bValidValue;
+/*N*/ pTmp->nValue = nValue;
+/*N*/ pTmp->bDeleted = bDeleted;
+/*N*/
+/*N*/ return pTmp;
+/*N*/ }
+
+/*N*/ const String& SwUserFieldType::GetName() const
+/*N*/ {
+/*N*/ return aName;
+/*N*/ }
+
+
+/*N*/ double SwUserFieldType::GetValue( SwCalc& rCalc )
+/*N*/ {
+/*N*/ if(bValidValue)
+/*N*/ return nValue;
+/*N*/
+/*N*/ if(!rCalc.Push( this ))
+/*N*/ {
+/*N*/ rCalc.SetCalcError( CALC_SYNTAX );
+/*N*/ return 0;
+/*N*/ }
+/*N*/ nValue = rCalc.Calculate( aContent ).GetDouble();
+/*N*/ rCalc.Pop( this );
+/*N*/
+/*N*/ if( !rCalc.IsCalcError() )
+/*N*/ bValidValue = sal_True;
+/*N*/ else
+/*N*/ nValue = 0;
+/*N*/
+/*N*/ return nValue;
+/*N*/ }
+
+/*N*/ String SwUserFieldType::GetContent( sal_uInt32 nFmt )
+/*N*/ {
+/*N*/ if (nFmt && nFmt != SAL_MAX_UINT32)
+/*N*/ {
+/*?*/ String sFormattedValue;
+/*?*/ Color* pCol = 0;
+/*?*/
+/*?*/ SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
+/*?*/
+/*?*/ pFormatter->GetOutputString(GetValue(), nFmt, sFormattedValue, &pCol);
+/*?*/ return sFormattedValue;
+/*N*/ }
+/*N*/ else
+/*N*/ return aContent;
+/*N*/ }
+
+/*N*/ void SwUserFieldType::SetContent( const String& rStr, sal_uInt32 nFmt )
+/*N*/ {
+/*N*/ if( aContent != rStr )
+/*N*/ {
+/*N*/ aContent = rStr;
+/*N*/
+/*N*/ if (nFmt && nFmt != SAL_MAX_UINT32)
+/*N*/ {
+/*?*/ double fValue;
+/*?*/
+/*?*/ SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
+/*?*/
+/*?*/ if (pFormatter->IsNumberFormat(rStr, nFmt, fValue))
+/*?*/ {
+/*?*/ SetValue(fValue);
+/*?*/ aContent.Erase();
+/*?*/ DoubleToString(aContent, fValue, nFmt);
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // der SdrPage (und damit den VCControls) sagen, das sich was getan hat
+/*N*/ if( GetDoc()->GetDrawModel() && GetDepends() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 ((SwDPage*)GetDoc()->GetDrawModel()->GetPage( 0 ))->
+/*N*/
+/*N*/ sal_Bool bModified = GetDoc()->IsModified();
+/*N*/ GetDoc()->SetModified();
+/*N*/ }
+/*N*/ }
+
+/*-----------------04.03.98 17:05-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwUserFieldType::QueryValue( uno::Any& rAny, BYTE nMId ) const
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_DOUBLE:
+/*N*/ rAny <<= (double) nValue;
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ rAny <<= ::rtl::OUString(aContent);
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ {
+/*N*/ BOOL bExpression = 0 != (GSE_EXPR&nType);
+/*N*/ rAny.setValue(&bExpression, ::getBooleanCppuType());
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*-----------------04.03.98 17:05-------------------
+
+--------------------------------------------------*/
+/*N*/ BOOL SwUserFieldType::PutValue( const uno::Any& rAny, BYTE nMId )
+/*N*/ {
+/*N*/ nMId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMId )
+/*N*/ {
+/*N*/ case FIELD_PROP_DOUBLE:
+/*N*/ {
+/*N*/ double fVal;
+/*N*/ rAny >>= fVal;
+/*N*/ nValue = fVal;
+/*N*/
+/*N*/ // Folgende Zeile ist eigentlich falsch, da die Sprache unbekannt ist
+/*N*/ // (haengt am Feld) und aContent daher auch eigentlich ans Feld gehoeren
+/*N*/ // muesste. Jedes Feld kann eine andere Sprache, aber den gleichen Inhalt
+/*N*/ // haben, nur die Formatierung ist unterschiedlich.
+/*N*/ DoubleToString(aContent, nValue, (sal_uInt16)LANGUAGE_SYSTEM);
+/*N*/ }
+/*N*/ break;
+/*N*/ case FIELD_PROP_PAR2:
+/*N*/ ::binfilter::GetString( rAny, aContent );
+/*N*/ break;
+/*N*/ case FIELD_PROP_BOOL1:
+/*N*/ if(*(sal_Bool*)rAny.getValue())
+/*N*/ {
+/*N*/ nType |= GSE_EXPR;
+/*N*/ nType &= ~GSE_STRING;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nType &= ~GSE_EXPR;
+/*N*/ nType |= GSE_STRING;
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ DBG_ERROR("illegal property");
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/frmedt/makefile.mk b/binfilter/bf_sw/source/core/frmedt/makefile.mk
new file mode 100644
index 000000000000..b0ace787adee
--- /dev/null
+++ b/binfilter/bf_sw/source/core/frmedt/makefile.mk
@@ -0,0 +1,61 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_frmedt
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+
+.IF "$(mydebug)" != ""
+CDEFS+=-Dmydebug
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_fefly1.obj \
+ $(SLO)$/sw_feshview.obj \
+ $(SLO)$/sw_fetab.obj \
+ $(SLO)$/sw_fews.obj \
+ $(SLO)$/sw_tblsel.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/frmedt/sw_fefly1.cxx b/binfilter/bf_sw/source/core/frmedt/sw_fefly1.cxx
new file mode 100644
index 000000000000..e8a89cb7427e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/frmedt/sw_fefly1.cxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+#include <fmtanchr.hxx>
+#include <fmtcntnt.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtfsize.hxx>
+#include <fesh.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <txtfrm.hxx>
+#include <viewimp.hxx>
+#include <viscrs.hxx>
+#include <doc.hxx>
+#include <dview.hxx>
+#include <dflyobj.hxx>
+#include <frmfmt.hxx>
+#include <ndtxt.hxx>
+#include <ndgrf.hxx>
+#include <flyfrms.hxx>
+namespace binfilter {
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//Zum anmelden von Flys in Flys in ...
+//definiert in layout/frmtool.cxx
+
+/***********************************************************************
+#* Class : SwDoc
+#* Methode : UseSpzLayoutFmt
+#* Beschreibung: Anhand des Request werden zu dem Format entsprechende
+#* Aenderungen an den Spezifischen Layouts vorgenommen.
+#* Datum : MA 23. Sep. 92
+#* Update : JP 09.03.98
+#***********************************************************************/
+
+
+/*N*/ BOOL lcl_FindAnchorPos( SwDoc& rDoc, const Point& rPt, const SwFrm& rFrm,
+/*N*/ SfxItemSet& rSet )
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/ SwFmtAnchor aNewAnch( (SwFmtAnchor&)rSet.Get( RES_ANCHOR ) );
+/*N*/ RndStdIds nNew = aNewAnch.GetAnchorId();
+/*N*/ const SwFrm *pNewAnch;
+/*N*/
+/*N*/ //Neuen Anker ermitteln
+/*N*/ Point aTmpPnt( rPt );
+/*N*/ switch( nNew )
+/*N*/ {
+/*N*/ case FLY_IN_CNTNT: // sollte der nicht auch mit hinein?
+/*N*/ case FLY_AT_CNTNT:
+/*N*/ case FLY_AUTO_CNTNT: // LAYER_IMPL
+/*N*/ {
+/*N*/ //Ausgehend von der linken oberen Ecke des Fly den
+/*N*/ //dichtesten CntntFrm suchen.
+/*N*/ const SwFrm* pFrm = rFrm.IsFlyFrm() ? ((SwFlyFrm&)rFrm).GetAnchor()
+/*N*/ : &rFrm;
+/*N*/ pNewAnch = ::binfilter::FindAnchor( pFrm, aTmpPnt );
+/*N*/ if( pNewAnch->IsProtected() )
+/*N*/ {
+/*N*/ bRet = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ SwPosition aPos( *((SwCntntFrm*)pNewAnch)->GetNode() );
+/*N*/ if( FLY_AUTO_CNTNT == nNew || FLY_IN_CNTNT == nNew )
+/*N*/ {
+/*N*/ // es muss ein TextNode gefunden werden, denn nur in diesen
+/*N*/ // ist ein Inhaltsgebundene Frames zu verankern
+/*N*/ SwCrsrMoveState aState( MV_SETONLYTEXT );
+/*N*/ aTmpPnt.X() -= 1; //nicht im Fly landen!!
+/*N*/ if( !pNewAnch->GetCrsrOfst( &aPos, aTmpPnt, &aState ) )
+/*N*/ {
+/*N*/ SwCntntNode* pCNd = ((SwCntntFrm*)pNewAnch)->GetNode();
+/*N*/ if( pNewAnch->Frm().Bottom() < aTmpPnt.Y() )
+/*N*/ pCNd->MakeStartIndex( &aPos.nContent );
+/*N*/ else
+/*N*/ pCNd->MakeEndIndex( &aPos.nContent );
+/*N*/ }
+/*N*/ }
+/*N*/ aNewAnch.SetAnchor( &aPos );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case FLY_AT_FLY: // LAYER_IMPL
+/*N*/ {
+/*N*/ //Ausgehend von der linken oberen Ecke des Fly den
+/*N*/ //dichtesten SwFlyFrm suchen.
+/*N*/ SwCrsrMoveState aState( MV_SETONLYTEXT );
+/*N*/ SwPosition aPos( rDoc.GetNodes() );
+/*N*/ aTmpPnt.X() -= 1; //nicht im Fly landen!!
+/*N*/ rDoc.GetRootFrm()->GetCrsrOfst( &aPos, aTmpPnt, &aState );
+/*N*/ pNewAnch = ::binfilter::FindAnchor(
+/*N*/ aPos.nNode.GetNode().GetCntntNode()->GetFrm( 0, 0, sal_False ),
+/*N*/ aTmpPnt )->FindFlyFrm();
+/*N*/
+/*N*/ if( pNewAnch && &rFrm != pNewAnch && !pNewAnch->IsProtected() )
+/*N*/ {
+/*N*/ aPos.nNode = *((SwFlyFrm*)pNewAnch)->GetFmt()->GetCntnt().
+/*N*/ GetCntntIdx();
+/*N*/ aNewAnch.SetAnchor( &aPos );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ aNewAnch.SetType( nNew = FLY_PAGE );
+/*N*/ // no break
+/*N*/
+/*N*/ case FLY_PAGE:
+/*N*/ pNewAnch = rFrm.FindPageFrm();
+/*N*/ aNewAnch.SetPageNum( pNewAnch->GetPhyPageNum() );
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ ASSERT( !&rDoc, "Falsche ID fuer neuen Anker." );
+/*N*/ }
+/*N*/
+/*N*/ rSet.Put( aNewAnch );
+/*N*/ return bRet;
+/*N*/ }
+
+//
+//! also used in unoframe.cxx
+//
+/*N*/ sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet )
+/*N*/ {
+/*N*/ const SwFrmFmt& rFmt = *rFly.GetFmt();
+/*N*/ const SwFmtAnchor &rOldAnch = rFmt.GetAnchor();
+/*N*/ const RndStdIds nOld = rOldAnch.GetAnchorId();
+/*N*/
+/*N*/ RndStdIds nNew = ((SwFmtAnchor&)rSet.Get( RES_ANCHOR )).GetAnchorId();
+/*N*/
+/*N*/ if( nOld == nNew )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ SwDoc* pDoc = (SwDoc*)rFmt.GetDoc();
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ASSERT( !(nNew == FLY_PAGE &&
+/*N*/ (FLY_AT_CNTNT==nOld || FLY_AUTO_CNTNT==nOld || FLY_IN_CNTNT==nOld ) &&
+/*N*/ pDoc->IsInHeaderFooter( rOldAnch.GetCntntAnchor()->nNode )),
+/*N*/ "Unerlaubter Ankerwechsel in Head/Foot." );
+/*N*/ #endif
+/*N*/
+/*N*/ return ::binfilter::lcl_FindAnchorPos( *pDoc, rFly.Frm().Pos(), rFly, rSet );
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwFEShell::FindFlyFrm()
+|*
+|* Beschreibung Liefert den Fly wenn einer Selektiert ist.
+|* Ersterstellung MA 03. Nov. 92
+|* Letzte Aenderung MA 05. Mar. 96
+|*
+*************************************************************************/
+
+/*N*/ SwFlyFrm *SwFEShell::FindFlyFrm() const
+/*N*/ {
+/*N*/ if ( Imp()->HasDrawView() )
+/*N*/ {
+/*N*/ // Ein Fly ist genau dann erreichbar, wenn er selektiert ist.
+/*N*/ const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkList();
+/*N*/ if( rMrkList.GetMarkCount() != 1 )
+/*N*/ return 0;
+/*N*/
+/*?*/ SdrObject *pO = rMrkList.GetMark( 0 )->GetObj();
+/*?*/ return pO->IsWriterFlyFrame() ? ((SwVirtFlyDrawObj*)pO)->GetFlyFrm() : 0;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+} //namespace binfilter
+#include <fmtcnct.hxx>
+#if 0
+#include <algorithm>
+#include <iostream>
+#include <iterator>
+
+
+/*M*/ static ::std::ostream & operator << (::std::ostream & aStream,
+/*M*/ const String & aString)
+/*M*/ {
+/*M*/ ByteString aByteString(aString, RTL_TEXTENCODING_ASCII_US);
+/*M*/ aStream << aByteString.GetBuffer();
+/*M*/
+/*M*/ return aStream;
+/*M*/ }
+
+/*M*/ void lcl_PrintFrameChainPrev(const SwFrmFmt * pFmt)
+/*M*/ {
+/*M*/ if (pFmt != NULL)
+/*M*/ {
+/*M*/ lcl_PrintFrameChainPrev(pFmt->GetChain().GetPrev());
+/*M*/
+/*M*/ ::std::clog << pFmt->GetName() << "->";
+/*M*/ }
+/*M*/ }
+
+/*M*/ void lcl_PrintFrameChainNext(const SwFrmFmt * pFmt)
+/*M*/ {
+/*M*/ if (pFmt != NULL)
+/*M*/ {
+/*M*/ ::std::clog << "->" << pFmt->GetName();
+/*M*/
+/*M*/ lcl_PrintFrameChainPrev(pFmt->GetChain().GetNext());
+/*M*/ }
+/*M*/ }
+
+/*M*/ void lcl_PrintFrameChain(const SwFrmFmt & rFmt)
+/*M*/ {
+/*M*/ lcl_PrintFrameChainPrev(rFmt.GetChain().GetPrev());
+/*M*/ ::std::clog << "(" << rFmt.GetName() << ")";
+/*M*/ lcl_PrintFrameChainNext(rFmt.GetChain().GetNext());
+/*M*/ ::std::clog << ::std::endl;
+/*M*/ }
+
+/*M*/ String lcl_GetChainableString(int nVal)
+/*M*/ {
+/*M*/ switch(nVal)
+/*M*/ {
+/*M*/ case SW_CHAIN_OK:
+/*M*/ return String::CreateFromAscii("OK");
+/*M*/
+/*M*/ case SW_CHAIN_SOURCE_CHAINED:
+/*M*/ return String::CreateFromAscii("source chained");
+/*M*/
+/*M*/ case SW_CHAIN_SELF:
+/*M*/ return String::CreateFromAscii("self");
+/*M*/
+/*M*/ case SW_CHAIN_IS_IN_CHAIN:
+/*M*/ return String::CreateFromAscii("in chain");
+/*M*/
+/*M*/ case SW_CHAIN_NOT_FOUND:
+/*M*/ return String::CreateFromAscii("not found");
+/*M*/
+/*M*/ case SW_CHAIN_NOT_EMPTY:
+/*M*/ return String::CreateFromAscii("not empty");
+/*M*/
+/*M*/ case SW_CHAIN_WRONG_AREA:
+/*M*/ return String::CreateFromAscii("wrong area");
+/*M*/
+/*M*/ default:
+/*M*/ return String::CreateFromAscii("??");
+/*M*/
+/*M*/ }
+/*M*/ }
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/frmedt/sw_feshview.cxx b/binfilter/bf_sw/source/core/frmedt/sw_feshview.cxx
new file mode 100644
index 000000000000..8f3d9a4f9498
--- /dev/null
+++ b/binfilter/bf_sw/source/core/frmedt/sw_feshview.cxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include "hintids.hxx"
+
+#ifdef WIN
+#define NEEDED_BY_FESHVIEW
+#define _FESHVIEW_ONLY_INLINE_NEEDED
+#endif
+
+#include <bf_svx/svdopath.hxx>
+#include <bf_svx/svdvmark.hxx>
+#include <bf_svx/protitem.hxx>
+#include <bf_so3/ipobj.hxx>
+
+#include <poolfmt.hrc> // fuer InitFldTypes
+#include <frmfmt.hxx>
+#include <frmatr.hxx>
+
+#include <horiornt.hxx>
+
+#include "fesh.hxx"
+#include "doc.hxx"
+#include "dview.hxx"
+#include "dflyobj.hxx"
+#include "dcontact.hxx"
+#include "viewimp.hxx"
+#include "flyfrm.hxx"
+#include "ndole.hxx"
+#include "txtfrm.hxx"
+namespace binfilter {
+
+#define SCROLLVAL 75
+
+//Tattergrenze fuer Drawing-SS
+#define MINMOVE ((USHORT)GetOut()->PixelToLogic(Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width())
+
+/*N*/ SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, ViewShell *pSh )
+/*N*/ {
+/*N*/ if ( !pLst )
+/*?*/ pLst = pSh->HasDrawView() ? &pSh->Imp()->GetDrawView()->GetMarkList():0;
+/*N*/
+/*N*/ if ( pLst && pLst->GetMarkCount() == 1 )
+/*N*/ {
+/*?*/ SdrObject *pO = pLst->GetMark( 0 )->GetObj();
+/*?*/ if ( pO->IsWriterFlyFrame() )
+/*?*/ return ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ BOOL SwFEShell::IsFrmSelected() const
+/*N*/ {
+/*N*/ if ( !Imp()->HasDrawView() )
+/*N*/ return FALSE;
+/*N*/ else
+/*N*/ return 0 != ::binfilter::GetFlyFromMarked( &Imp()->GetDrawView()->GetMarkList(),
+/*N*/ (ViewShell*)this );
+/*N*/ }
+
+
+
+// zeige das akt. selektierte "Object" an
+/*N*/ void SwFEShell::MakeSelVisible()
+/*N*/ {
+/*N*/ if( Imp()->HasDrawView() &&
+/*N*/ Imp()->GetDrawView()->GetMarkList().GetMarkCount() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 MakeVisible( Imp()->GetDrawView()->GetAllMarkedRect() );
+/*N*/ }
+/*N*/ else
+/*N*/ SwCrsrShell::MakeSelVisible();
+/*N*/ }
+
+
+/*N*/ void SwFEShell::HideChainMarker()
+/*N*/ {
+/*N*/ if ( pChainFrom )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pChainFrom->Hide();
+/*N*/ if ( pChainTo )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pChainTo->Hide();
+/*N*/ }
+
+/*N*/ void SwFEShell::SetChainMarker()
+/*N*/ {
+/*N*/ FASTBOOL bDelFrom = TRUE,
+/*N*/ bDelTo = TRUE;
+/*N*/ if ( IsFrmSelected() )
+/*N*/ {
+/*?*/ SwFlyFrm *pFly = FindFlyFrm();
+/*?*/
+/*?*/ XPolygon aPoly(3);
+/*?*/ if ( pFly->GetPrevLink() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*?*/ }
+/*?*/ if ( pFly->GetNextLink() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*?*/ }
+/*N*/ }
+/*N*/ if ( bDelFrom )
+/*N*/ delete pChainFrom, pChainFrom = 0;
+/*N*/ if ( bDelTo )
+/*N*/ delete pChainTo, pChainTo = 0;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/frmedt/sw_fetab.cxx b/binfilter/bf_sw/source/core/frmedt/sw_fetab.cxx
new file mode 100644
index 000000000000..4617e034c4be
--- /dev/null
+++ b/binfilter/bf_sw/source/core/frmedt/sw_fetab.cxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hintids.hxx>
+
+#include <bf_svx/svxids.hrc>
+
+
+#include <horiornt.hxx>
+
+#include <fesh.hxx>
+#include <doc.hxx>
+#include <cntfrm.hxx>
+#include <tabfrm.hxx>
+#include <cellfrm.hxx>
+#include <ndtxt.hxx>
+#include <tabcol.hxx>
+#include <viscrs.hxx>
+
+#include <swerror.h>
+namespace binfilter {
+
+//siehe auch swtable.cxx
+#define COLFUZZY 20L
+
+
+/*N*/ SwTabCols *pLastCols = 0;
+
+
+
+/*N*/ inline const SwCursor& GetShellCursor( const SwCrsrShell& rShell )
+/*N*/ {
+/*N*/ const SwShellCrsr *pCrsr = rShell.GetTableCrsr();
+/*N*/ if( !pCrsr )
+/*N*/ pCrsr = (SwShellCrsr*)*rShell.GetSwCrsr( FALSE );
+/*N*/ return *pCrsr;
+/*N*/ }
+
+
+/*N*/ void ClearFEShellTabCols()
+/*N*/ {
+/*N*/ DELETEZ( pLastCols );
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/frmedt/sw_fews.cxx b/binfilter/bf_sw/source/core/frmedt/sw_fews.cxx
new file mode 100644
index 000000000000..5407c8641606
--- /dev/null
+++ b/binfilter/bf_sw/source/core/frmedt/sw_fews.cxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svx/svdvmark.hxx>
+
+#include <horiornt.hxx>
+
+#include <fesh.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <frmtool.hxx>
+#include <viewimp.hxx>
+#include <dview.hxx>
+#include <pam.hxx>
+#include <sectfrm.hxx>
+#include <tabfrm.hxx>
+#include <flyfrms.hxx>
+#include <txtfrm.hxx> // SwTxtFrm
+#include <mdiexp.hxx>
+#include <pagedesc.hxx>
+namespace binfilter {
+
+/*N*/ TYPEINIT1(SwFEShell,SwEditShell)
+
+/*N*/ SwFEShell::~SwFEShell()
+/*N*/ {
+/*N*/ delete pChainFrom;
+/*N*/ delete pChainTo;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/frmedt/sw_tblsel.cxx b/binfilter/bf_sw/source/core/frmedt/sw_tblsel.cxx
new file mode 100644
index 000000000000..9dc8c963209c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/frmedt/sw_tblsel.cxx
@@ -0,0 +1,1571 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hintids.hxx>
+
+#include <bf_svx/protitem.hxx>
+#include <bf_sch/schdll.hxx>
+#include <bf_sch/memchrt.hxx>
+
+#include <fmtfsize.hxx>
+#include <frmatr.hxx>
+
+#include <horiornt.hxx>
+
+#include <crsrsh.hxx>
+#include <doc.hxx>
+#include <ndole.hxx>
+#include <cntfrm.hxx>
+#include <tabfrm.hxx>
+#include <rowfrm.hxx>
+#include <cellfrm.hxx>
+#include <viscrs.hxx>
+#include <swtblfmt.hxx>
+namespace binfilter {
+
+//siehe auch swtable.cxx
+#define COLFUZZY 20L
+
+// defines, die bestimmen, wie Tabellen Boxen gemergt werden:
+// - 1. alle leeren Zeilen entfernen, alle Boxen werden mit Blank,
+// alle Lines mit ParaBreak getrennt
+// - 2. alle leeren Zeilen und alle leeren Boxen am Anfang und Ende
+// entfernen, alle Boxen werden mit Blank,
+// alle Lines mit ParaBreak getrennt
+// - 3. alle leeren Boxen entfernen, alle Boxen werden mit Blank,
+// alle Lines mit ParaBreak getrennt
+
+#undef DEL_ONLY_EMPTY_LINES
+#undef DEL_EMPTY_BOXES_AT_START_AND_END
+#define DEL_ALL_EMPTY_BOXES
+
+
+/*N*/ _SV_IMPL_SORTAR_ALG( SwSelBoxes, SwTableBoxPtr )
+/*N*/ BOOL SwSelBoxes::Seek_Entry( const SwTableBoxPtr rSrch, USHORT* pFndPos ) const
+/*N*/ {
+/*N*/ ULONG nIdx = rSrch->GetSttIdx();
+/*N*/
+/*N*/ register USHORT nO = Count(), nM, nU = 0;
+/*N*/ if( nO > 0 )
+/*N*/ {
+/*N*/ nO--;
+/*N*/ while( nU <= nO )
+/*N*/ {
+/*N*/ nM = nU + ( nO - nU ) / 2;
+/*N*/ if( (*this)[ nM ]->GetSttNd() == rSrch->GetSttNd() )
+/*N*/ {
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nM;
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ else if( (*this)[ nM ]->GetSttIdx() < nIdx )
+/*N*/ nU = nM + 1;
+/*N*/ else if( nM == 0 )
+/*N*/ {
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nU;
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ nO = nM - 1;
+/*N*/ }
+/*N*/ }
+/*N*/ if( pFndPos )
+/*N*/ *pFndPos = nU;
+/*N*/ return FALSE;
+/*N*/ }
+
+
+
+
+
+
+/*N*/ SV_IMPL_PTRARR( _FndBoxes, _FndBox* )
+/*N*/ SV_IMPL_PTRARR( _FndLines, _FndLine* )
+
+
+/*N*/ struct _Sort_CellFrm
+/*N*/ {
+/*N*/ const SwCellFrm* pFrm;
+/*N*/
+/*N*/ _Sort_CellFrm( const SwCellFrm& rCFrm )
+/*N*/ : pFrm( &rCFrm ) {}
+/*N*/ };
+
+/*N*/ SV_DECL_VARARR( _Sort_CellFrms, _Sort_CellFrm, 16, 16 )
+/*N*/ SV_IMPL_VARARR( _Sort_CellFrms, _Sort_CellFrm )
+
+/*N*/ SV_IMPL_PTRARR( SwChartBoxes, SwTableBoxPtr );
+/*N*/ SV_IMPL_PTRARR( SwChartLines, SwChartBoxes* );
+
+/*N*/ const SwLayoutFrm *lcl_FindCellFrm( const SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ while ( pLay && !pLay->IsCellFrm() )
+/*?*/ pLay = pLay->GetUpper();
+/*N*/ return pLay;
+/*N*/ }
+
+/*N*/ const SwLayoutFrm *lcl_FindNextCellFrm( const SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ //Dafuer sorgen, dass die Zelle auch verlassen wird (Bereiche)
+/*N*/ const SwLayoutFrm *pTmp = pLay;
+/*N*/ do {
+/*N*/ pTmp = pTmp->GetNextLayoutLeaf();
+/*N*/ } while( pLay->IsAnLower( pTmp ) );
+/*N*/
+/*N*/ while( pTmp && !pTmp->IsCellFrm() )
+/*N*/ pTmp = pTmp->GetUpper();
+/*N*/ return pTmp;
+/*N*/ }
+
+/*N*/ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
+/*N*/ SwSelBoxes& rBoxes, const SwTblSearchType eSearchType )
+/*N*/ {
+/*N*/ //Muss ein HeadlineRepeat beachtet werden?
+/*N*/ const BOOL bRepeat = pStart->FindTabFrm()->GetTable()->IsHeadlineRepeat();
+/*N*/ int bChkProtected = TBLSEARCH_PROTECT & eSearchType;
+/*N*/
+/*N*/ BOOL bTblIsValid;
+/*N*/ int nLoopMax = 100; //JP 28.06.99: max 100 loops - Bug 67292
+/*N*/ do {
+/*N*/ bTblIsValid = TRUE;
+/*N*/
+/*N*/ //Zuerst lassen wir uns die Tabellen und die Rechtecke heraussuchen.
+/*N*/ SwSelUnions aUnions;
+/*N*/ ::binfilter::MakeSelUnions( aUnions, pStart, pEnd, eSearchType );
+/*N*/
+/*N*/ //Jetzt zu jedem Eintrag die Boxen herausfischen und uebertragen.
+ USHORT i=0;
+/*N*/ for( i = 0; i < aUnions.Count() && bTblIsValid; ++i )
+/*N*/ {
+/*N*/ SwSelUnion *pUnion = aUnions[i];
+/*N*/ const SwTabFrm *pTable = pUnion->GetTable();
+/*N*/ if( !pTable->IsValid() && nLoopMax )
+/*N*/ {
+/*?*/ bTblIsValid = FALSE;
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ const SwLayoutFrm *pRow = (const SwLayoutFrm*)pTable->Lower();
+/*N*/ //Wenn die Row eine wiederholte Headline ist wird sie nicht
+/*N*/ //beachtet.
+/*N*/ if( bRepeat && pTable->IsFollow() )
+/*?*/ pRow = (const SwLayoutFrm*)pRow->GetNext();
+/*N*/
+/*N*/ while( pRow && bTblIsValid )
+/*N*/ {
+/*N*/ if( !pRow->IsValid() && nLoopMax )
+/*N*/ {
+/*?*/ bTblIsValid = FALSE;
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if ( pRow->Frm().IsOver( pUnion->GetUnion() ) )
+/*N*/ {
+/*N*/ const SwLayoutFrm *pCell = pRow->FirstCell();
+/*N*/
+/*N*/ while( bTblIsValid && pCell && pRow->IsAnLower( pCell ) )
+/*N*/ {
+/*N*/ if( !pCell->IsValid() && nLoopMax )
+/*N*/ {
+/*?*/ bTblIsValid = FALSE;
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" );
+/*N*/ if( ::binfilter::IsFrmInTblSel( pUnion->GetUnion(), pCell ) )
+/*N*/ {
+/*N*/ SwTableBox* pBox = (SwTableBox*)
+/*N*/ ((SwCellFrm*)pCell)->GetTabBox();
+/*N*/ // Zellenschutzt beachten ??
+/*N*/ if( !bChkProtected ||
+/*N*/ !pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
+/*N*/ rBoxes.Insert( pBox );
+/*N*/ }
+/*N*/ if ( pCell->GetNext() )
+/*N*/ {
+/*N*/ pCell = (const SwLayoutFrm*)pCell->GetNext();
+/*N*/ if ( pCell->Lower()->IsRowFrm() )
+/*?*/ pCell = pCell->FirstCell();
+/*N*/ }
+/*N*/ else
+/*N*/ pCell = ::binfilter::lcl_FindNextCellFrm( pCell );
+/*N*/ }
+/*N*/ }
+/*N*/ pRow = (const SwLayoutFrm*)pRow->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bTblIsValid )
+/*N*/ break;
+/*N*/
+/*N*/ // ansonsten das Layout der Tabelle kurz "kalkulieren" lassen
+/*N*/ // und nochmals neu aufsetzen
+/*?*/ SwTabFrm *pTable = aUnions[0]->GetTable();
+/*?*/ for( i = 0; i < aUnions.Count(); ++i )
+/*?*/ {
+/*?*/ if( pTable->IsValid() )
+/*?*/ pTable->InvalidatePos();
+/*?*/ pTable->SetONECalcLowers();
+/*?*/ pTable->Calc();
+/*?*/ pTable->SetCompletePaint();
+/*?*/ if( 0 == (pTable = pTable->GetFollow()) )
+/*?*/ break;
+/*?*/ }
+/*?*/ i = 0;
+/*?*/ rBoxes.Remove( i, rBoxes.Count() );
+/*?*/ --nLoopMax;
+/*?*/
+/*?*/ } while( TRUE );
+/*N*/ ASSERT( nLoopMax, "das Layout der Tabelle wurde nicht valide!" );
+/*N*/ }
+
+
+
+/*N*/ BOOL ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd,
+/*N*/ SwChartLines* pGetCLines )
+/*N*/ {
+/*N*/ const SwTableNode* pTNd = rSttNd.FindTableNode();
+/*N*/ if( !pTNd )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ Point aNullPos;
+/*N*/ SwNodeIndex aIdx( rSttNd );
+/*N*/ const SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+/*N*/ if( !pCNd )
+/*N*/ pCNd = aIdx.GetNodes().GoNextSection( &aIdx, FALSE, FALSE );
+/*N*/
+/*N*/ // #109394# if table is invisible, return
+/*N*/ // (layout needed for forming table selection further down, so we can't
+/*N*/ // continue with invisible tables)
+/*N*/ if( pCNd->GetFrm() == NULL )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ const SwLayoutFrm *pStart = pCNd ? pCNd->GetFrm( &aNullPos )->GetUpper() : 0;
+/*N*/ ASSERT( pStart, "ohne Frame geht gar nichts" );
+/*N*/
+/*N*/ aIdx = rEndNd;
+/*N*/ pCNd = aIdx.GetNode().GetCntntNode();
+/*N*/ if( !pCNd )
+/*N*/ pCNd = aIdx.GetNodes().GoNextSection( &aIdx, FALSE, FALSE );
+/*N*/
+/*N*/ const SwLayoutFrm *pEnd = pCNd ? pCNd->GetFrm( &aNullPos )->GetUpper() : 0;
+/*N*/ ASSERT( pEnd, "ohne Frame geht gar nichts" );
+/*N*/
+/*N*/
+/*N*/ //Muss ein HeadlineRepeat beachtet werden?
+/*N*/ const BOOL bRepeat = pTNd->GetTable().IsHeadlineRepeat();
+/*N*/
+/*N*/ BOOL bTblIsValid, bValidChartSel;
+/*N*/ int nLoopMax = 100; //JP 28.06.99: max 100 loops - Bug 67292
+/*N*/ do {
+/*N*/ bTblIsValid = TRUE;
+/*N*/ bValidChartSel = TRUE;
+/*N*/
+/*N*/ USHORT nRowCells = USHRT_MAX;
+/*N*/
+/*N*/ //Zuerst lassen wir uns die Tabellen und die Rechtecke heraussuchen.
+/*N*/ SwSelUnions aUnions;
+/*N*/ ::binfilter::MakeSelUnions( aUnions, pStart, pEnd, TBLSEARCH_NO_UNION_CORRECT );
+/*N*/
+/*N*/ //Jetzt zu jedem Eintrag die Boxen herausfischen und uebertragen.
+ USHORT i=0;
+/*N*/ for( i = 0; i < aUnions.Count() && bTblIsValid &&
+/*N*/ bValidChartSel; ++i )
+/*N*/ {
+/*N*/ SwSelUnion *pUnion = aUnions[i];
+/*N*/ const SwTabFrm *pTable = pUnion->GetTable();
+/*N*/
+/*N*/ SWRECTFN( pTable )
+/*N*/ #ifdef BIDI
+/*N*/ sal_Bool bRTL = pTable->IsRightToLeft();
+/*N*/ #endif
+/*N*/
+/*N*/ if( !pTable->IsValid() && nLoopMax )
+/*N*/ {
+/*N*/ bTblIsValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ _Sort_CellFrms aCellFrms;
+/*N*/
+/*N*/ const SwLayoutFrm *pRow = (const SwLayoutFrm*)pTable->Lower();
+/*N*/ //Wenn die Row eine wiederholte Headline ist wird sie nicht
+/*N*/ //beachtet.
+/*N*/ if( bRepeat && pTable->IsFollow() )
+/*N*/ pRow = (const SwLayoutFrm*)pRow->GetNext();
+/*N*/
+/*N*/ while( pRow && bTblIsValid && bValidChartSel )
+/*N*/ {
+/*N*/ if( !pRow->IsValid() && nLoopMax )
+/*N*/ {
+/*N*/ bTblIsValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pRow->Frm().IsOver( pUnion->GetUnion() ) )
+/*N*/ {
+/*N*/ const SwLayoutFrm *pCell = pRow->FirstCell();
+/*N*/
+/*N*/ while( bValidChartSel && bTblIsValid && pCell &&
+/*N*/ pRow->IsAnLower( pCell ) )
+/*N*/ {
+/*N*/ if( !pCell->IsValid() && nLoopMax )
+/*N*/ {
+/*N*/ bTblIsValid = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( pCell->IsCellFrm(), "Frame ohne Celle" );
+/*N*/ const SwRect& rUnion = pUnion->GetUnion(),
+/*N*/ & rFrmRect = pCell->Frm();
+/*N*/
+/*N*/ const long nUnionRight = rUnion.Right();
+/*N*/ const long nUnionBottom = rUnion.Bottom();
+/*N*/ const long nFrmRight = rFrmRect.Right();
+/*N*/ const long nFrmBottom = rFrmRect.Bottom();
+/*N*/
+/*N*/ // liegt das FrmRect ausserhalb der Union, kann es
+/*N*/ // ignoriert werden.
+/*N*/
+/*N*/ const long nXFuzzy = bVert ? 0 : 20;
+/*N*/ const long nYFuzzy = bVert ? 20 : 0;
+/*N*/
+/*N*/ if( !( rUnion.Top() + nYFuzzy > nFrmBottom ||
+/*N*/ nUnionBottom < rFrmRect.Top() + nYFuzzy ||
+/*N*/ rUnion.Left() + nXFuzzy > nFrmRight ||
+/*N*/ nUnionRight < rFrmRect.Left() + nXFuzzy ))
+/*N*/ {
+/*N*/ // ok, rUnion is _not_ completely outside of rFrmRect
+/*N*/
+/*N*/ // wenn es aber nicht komplett in der Union liegt,
+/*N*/ // dann ist es fuers Chart eine ungueltige
+/*N*/ // Selektion.
+/*N*/ if( rUnion.Left() <= rFrmRect.Left() + nXFuzzy &&
+/*N*/ rFrmRect.Left() <= nUnionRight &&
+/*N*/ rUnion.Left() <= nFrmRight &&
+/*N*/ nFrmRight <= nUnionRight + nXFuzzy &&
+/*N*/ rUnion.Top() <= rFrmRect.Top() + nYFuzzy &&
+/*N*/ rFrmRect.Top() <= nUnionBottom &&
+/*N*/ rUnion.Top() <= nFrmBottom &&
+/*N*/ nFrmBottom <= nUnionBottom+ nYFuzzy )
+/*N*/
+/*N*/ aCellFrms.Insert(
+/*N*/ _Sort_CellFrm( *(SwCellFrm*)pCell ),
+/*N*/ aCellFrms.Count() );
+/*N*/ else
+/*N*/ {
+/*N*/ bValidChartSel = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pCell->GetNext() )
+/*N*/ {
+/*N*/ pCell = (const SwLayoutFrm*)pCell->GetNext();
+/*N*/ if ( pCell->Lower()->IsRowFrm() )
+/*N*/ pCell = pCell->FirstCell();
+/*N*/ }
+/*N*/ else
+/*N*/ pCell = ::binfilter::lcl_FindNextCellFrm( pCell );
+/*N*/ }
+/*N*/ }
+/*N*/ pRow = (const SwLayoutFrm*)pRow->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if( !bValidChartSel )
+/*N*/ break;
+/*N*/
+/*N*/ // alle Zellen der (Teil-)Tabelle zusammen. Dann teste mal ob
+/*N*/ // all huebsch nebeneinander liegen.
+/*N*/ USHORT n, nEnd, nCellCnt = 0;
+/*N*/ long nYPos = LONG_MAX, nXPos, nHeight;
+/*N*/
+/*N*/ for( n = 0, nEnd = aCellFrms.Count(); n < nEnd; ++n )
+/*N*/ {
+/*N*/ const _Sort_CellFrm& rCF = aCellFrms[ n ];
+/*N*/ if( (rCF.pFrm->Frm().*fnRect->fnGetTop)() != nYPos )
+/*N*/ {
+/*N*/ // neue Zeile
+/*N*/ if( n )
+/*N*/ {
+/*N*/ if( USHRT_MAX == nRowCells ) // 1. Zeilenwechsel
+/*N*/ nRowCells = nCellCnt;
+/*N*/ else if( nRowCells != nCellCnt )
+/*N*/ {
+/*N*/ bValidChartSel = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ nCellCnt = 1;
+/*N*/ nYPos = (rCF.pFrm->Frm().*fnRect->fnGetTop)();
+/*N*/ nHeight = (rCF.pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ nXPos = bRTL ?
+/*N*/ (rCF.pFrm->Frm().*fnRect->fnGetLeft)() :
+/*N*/ (rCF.pFrm->Frm().*fnRect->fnGetRight)();
+/*N*/ }
+/*N*/ else if( nXPos == ( bRTL ?
+/*N*/ (rCF.pFrm->Frm().*fnRect->fnGetRight)() :
+/*N*/ (rCF.pFrm->Frm().*fnRect->fnGetLeft)() ) &&
+/*N*/ nHeight == (rCF.pFrm->Frm().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ nXPos += ( bRTL ? (-1) : 1 ) *
+/*N*/ (rCF.pFrm->Frm().*fnRect->fnGetWidth)();
+/*N*/ ++nCellCnt;
+/*N*/ }
+/*N*/
+/*N*/ #else
+/*N*/ nXPos = (rCF.pFrm->Frm().*fnRect->fnGetRight)();
+/*N*/ }
+/*N*/ else if( nXPos == (rCF.pFrm->Frm().*fnRect->fnGetLeft)() &&
+/*N*/ nHeight == (rCF.pFrm->Frm().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ nXPos += (rCF.pFrm->Frm().*fnRect->fnGetWidth)();
+/*N*/ ++nCellCnt;
+/*N*/ }
+/*N*/ #endif
+/*N*/ else
+/*N*/ {
+/*N*/ bValidChartSel = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ if( bValidChartSel )
+/*N*/ {
+/*N*/ if( USHRT_MAX == nRowCells )
+/*N*/ nRowCells = nCellCnt;
+/*N*/ else if( nRowCells != nCellCnt )
+/*N*/ bValidChartSel = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if( bValidChartSel && pGetCLines )
+/*N*/ {
+/*N*/ nYPos = LONG_MAX;
+/*N*/ SwChartBoxes* pBoxes;
+/*N*/ for( n = 0, nEnd = aCellFrms.Count(); n < nEnd; ++n )
+/*N*/ {
+/*N*/ const _Sort_CellFrm& rCF = aCellFrms[ n ];
+/*N*/ if( (rCF.pFrm->Frm().*fnRect->fnGetTop)() != nYPos )
+/*N*/ {
+/*N*/ pBoxes = new SwChartBoxes( 255 < nRowCells
+/*N*/ ? 255 : (BYTE)nRowCells);
+/*N*/ pGetCLines->C40_INSERT( SwChartBoxes, pBoxes, pGetCLines->Count() );
+/*N*/ nYPos = (rCF.pFrm->Frm().*fnRect->fnGetTop)();
+/*N*/ }
+/*N*/ SwTableBoxPtr pBox = (SwTableBox*)rCF.pFrm->GetTabBox();
+/*N*/ pBoxes->Insert( pBox, pBoxes->Count() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bTblIsValid )
+/*N*/ break;
+/*N*/
+/*N*/ // ansonsten das Layout der Tabelle kurz "kalkulieren" lassen
+/*N*/ // und nochmals neu aufsetzen
+/*N*/ SwTabFrm *pTable = aUnions[0]->GetTable();
+/*N*/ for( i = 0; i < aUnions.Count(); ++i )
+/*N*/ {
+/*N*/ if( pTable->IsValid() )
+/*N*/ pTable->InvalidatePos();
+/*N*/ pTable->SetONECalcLowers();
+/*N*/ pTable->Calc();
+/*N*/ pTable->SetCompletePaint();
+/*N*/ if( 0 == (pTable = pTable->GetFollow()) )
+/*N*/ break;
+/*N*/ }
+/*N*/ --nLoopMax;
+/*N*/ if( pGetCLines )
+/*N*/ pGetCLines->DeleteAndDestroy( 0, pGetCLines->Count() );
+/*N*/ } while( TRUE );
+/*N*/
+/*N*/ ASSERT( nLoopMax, "das Layout der Tabelle wurde nicht valide!" );
+/*N*/
+/*N*/ if( !bValidChartSel && pGetCLines )
+/*N*/ pGetCLines->DeleteAndDestroy( 0, pGetCLines->Count() );
+/*N*/
+/*N*/ return bValidChartSel;
+/*N*/ }
+
+
+/*N*/ BOOL IsFrmInTblSel( const SwRect& rUnion, const SwFrm* pCell )
+/*N*/ {
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ if( pCell->IsVertical() )
+/*?*/ return ( rUnion.Right() >= pCell->Frm().Right() &&
+/*?*/ rUnion.Left() <= pCell->Frm().Left() &&
+/*?*/ (( rUnion.Top() <= pCell->Frm().Top()+20 &&
+/*?*/ rUnion.Bottom() > pCell->Frm().Top() ) ||
+/*?*/ ( rUnion.Top() >= pCell->Frm().Top() &&
+/*?*/ rUnion.Bottom() < pCell->Frm().Bottom() )) ? TRUE : FALSE );
+/*N*/ #endif
+/*N*/ return (
+/*N*/ rUnion.Top() <= pCell->Frm().Top() &&
+/*N*/ rUnion.Bottom() >= pCell->Frm().Bottom() &&
+/*N*/
+/*N*/ (( rUnion.Left() <= pCell->Frm().Left()+20 &&
+/*N*/ rUnion.Right() > pCell->Frm().Left() ) ||
+/*N*/
+/*N*/ ( rUnion.Left() >= pCell->Frm().Left() &&
+/*N*/ rUnion.Right() < pCell->Frm().Right() )) ? TRUE : FALSE );
+/*N*/ }
+
+
+BOOL lcl_CheckCol( const _FndBox*& rpFndBox, void* pPara );
+
+BOOL lcl_CheckRow( const _FndLine*& rpFndLine, void* pPara )
+{
+ ((_FndLine*)rpFndLine)->GetBoxes().ForEach( &::binfilter::lcl_CheckCol, pPara );
+ return *(BOOL*)pPara;
+}
+
+BOOL lcl_CheckCol( const _FndBox*& rpFndBox, void* pPara )
+{
+ if( !rpFndBox->GetBox()->GetSttNd() )
+ {
+ if( rpFndBox->GetLines().Count() !=
+ rpFndBox->GetBox()->GetTabLines().Count() )
+ *((BOOL*)pPara) = FALSE;
+ else
+ ((_FndBox*)rpFndBox)->GetLines().ForEach( &lcl_CheckRow, pPara );
+ }
+ // Box geschuetzt ??
+ else if( rpFndBox->GetBox()->GetFrmFmt()->GetProtect().IsCntntProtected() )
+ *((BOOL*)pPara) = FALSE;
+ return *(BOOL*)pPara;
+}
+
+USHORT CheckMergeSel( const SwSelBoxes& rBoxes )
+{
+ USHORT eRet = TBLMERGE_NOSELECTION;
+ if( rBoxes.Count() )
+ {
+ eRet = TBLMERGE_OK;
+
+ _FndBox aFndBox( 0, 0 );
+ _FndPara aPara( rBoxes, &aFndBox );
+ const SwTableNode* pTblNd = aPara.rBoxes[0]->GetSttNd()->FindTableNode();
+ ((SwTable&)pTblNd->GetTable()).GetTabLines().ForEach(
+ &_FndLineCopyCol, &aPara );
+ if( aFndBox.GetLines().Count() )
+ {
+ BOOL bMergeSelOk = TRUE;
+ _FndBox* pFndBox = &aFndBox;
+ _FndLine* pFndLine = 0;
+ while( pFndBox && 1 == pFndBox->GetLines().Count() )
+ {
+ pFndLine = pFndBox->GetLines()[0];
+ if( 1 == pFndLine->GetBoxes().Count() )
+ pFndBox = pFndLine->GetBoxes()[0];
+ else
+ pFndBox = 0;
+ }
+ if( pFndBox )
+ pFndBox->GetLines().ForEach( &::binfilter::lcl_CheckRow, &bMergeSelOk );
+ else if( pFndLine )
+ pFndLine->GetBoxes().ForEach( &::binfilter::lcl_CheckCol, &bMergeSelOk );
+ if( !bMergeSelOk )
+ eRet = TBLMERGE_TOOCOMPLEX;
+ }
+ else
+ eRet = TBLMERGE_NOSELECTION;
+ }
+ return eRet;
+}
+
+//Ermittelt die von einer Tabellenselektion betroffenen Tabellen und die
+//Union-Rechteckte der Selektionen - auch fuer aufgespaltene Tabellen.
+/*N*/ SV_IMPL_PTRARR( SwSelUnions, SwSelUnion* );
+
+/*M*/ SwTwips lcl_CalcWish( const SwLayoutFrm *pCell, long nWish,
+/*M*/ const long nAct )
+/*M*/ {
+/*M*/ const SwLayoutFrm *pTmp = pCell;
+/*M*/ if ( !nWish )
+/*M*/ nWish = 1;
+/*M*/
+/*M*/ #ifdef BIDI
+/*M*/ const sal_Bool bRTL = pCell->IsRightToLeft();
+/*M*/ SwTwips nRet = bRTL ?
+/*M*/ nAct - pCell->Frm().Width() :
+/*M*/ 0;
+/*M*/ #else
+/*M*/ SwTwips nRet = 0;
+/*M*/ #endif
+/*M*/
+/*M*/
+/*M*/ while ( pTmp )
+/*M*/ {
+/*M*/ while ( pTmp->GetPrev() )
+/*M*/ {
+/*M*/ pTmp = (SwLayoutFrm*)pTmp->GetPrev();
+/*M*/ long nTmp = pTmp->GetFmt()->GetFrmSize().GetWidth();
+/*M*/ #ifdef BIDI
+/*M*/ nRet += ( bRTL ? ( -1 ) : 1 ) * nTmp * nAct / nWish;
+/*M*/ #else
+/*M*/ nRet += nTmp * nAct / nWish;
+/*M*/ #endif
+/*M*/ }
+/*M*/ pTmp = pTmp->GetUpper()->GetUpper();
+/*M*/ if ( pTmp && !pTmp->IsCellFrm() )
+/*M*/ pTmp = 0;
+/*M*/ }
+/*M*/ return nRet;
+/*M*/ }
+
+/* MA: 20. Sep. 93 wird nicht mehr gebraucht.
+static const SwLayoutFrm *GetPrevCell( const SwLayoutFrm *pCell )
+{
+ const SwLayoutFrm *pLay = pCell->GetPrevLayoutLeaf();
+ if ( pLay && pLay->IsLayoutFrm() && !pLay->IsTab() )
+ {
+ //GetPrevLayoutLeaf() liefert ggf. auch die Umgebung einer Tab zurueck
+ //(naehmlich genau dann, wenn die Zelle noch Vorgaenger hat).
+ const SwFrm *pFrm = pLay->Lower();
+ while ( pFrm->GetNext() )
+ pFrm = pFrm->GetNext();
+ pLay = pFrm->IsTabFrm() ? (SwLayoutFrm*)pFrm : 0;
+ }
+ if ( pLay && pLay->IsTabFrm() )
+ {
+ //GetPrevLayoutLeaf() liefert ggf. auch Tabellen zurueck die letzte
+ //Zelle dieser Tabelle ist das das gesuchte Blatt.
+ pLay = ((SwTabFrm*)pLay)->FindLastCntnt()->GetUpper();
+ while ( !pLay->IsCellFrm() )
+ pLay = pLay->GetUpper();
+ }
+ return pLay;
+}
+*/
+
+/*N*/ void lcl_FindStartEndRow( const SwLayoutFrm *&rpStart,
+/*N*/ const SwLayoutFrm *&rpEnd,
+/*N*/ const int bChkProtected )
+/*N*/ {
+/*N*/ //Start an den Anfang seiner Zeile setzen.
+/*N*/ //End an das Ende seiner Zeile setzen.
+/*N*/ rpStart = (SwLayoutFrm*)rpStart->GetUpper()->Lower();
+/*N*/ while ( rpEnd->GetNext() )
+/*?*/ rpEnd = (SwLayoutFrm*)rpEnd->GetNext();
+/*N*/
+/*N*/ SvPtrarr aSttArr( 8, 8 ), aEndArr( 8, 8 );
+/*N*/ const SwLayoutFrm *pTmp;
+/*N*/ for( pTmp = rpStart; (FRM_CELL|FRM_ROW) & pTmp->GetType();
+/*N*/ pTmp = pTmp->GetUpper() )
+/*N*/ {
+/*N*/ void* p = (void*)pTmp;
+/*N*/ aSttArr.Insert( p, 0 );
+/*N*/ }
+/*N*/ for( pTmp = rpEnd; (FRM_CELL|FRM_ROW) & pTmp->GetType();
+/*N*/ pTmp = pTmp->GetUpper() )
+/*N*/ {
+/*N*/ void* p = (void*)pTmp;
+/*N*/ aEndArr.Insert( p, 0 );
+/*N*/ }
+/*N*/
+/*N*/ for( USHORT n = 0; n < aEndArr.Count() && n < aSttArr.Count(); ++n )
+/*N*/ if( aSttArr[ n ] != aEndArr[ n ] )
+/*N*/ {
+/*?*/ // first unequal line or box - all odds are
+/*?*/ if( n & 1 ) // 1, 3, 5, ... are boxes
+/*?*/ {
+/*?*/ rpStart = (SwLayoutFrm*)aSttArr[ n ];
+/*?*/ rpEnd = (SwLayoutFrm*)aEndArr[ n ];
+/*?*/ }
+/*?*/ else // 0, 2, 4, ... are lines
+/*?*/ {
+/*?*/ // check if start & end line are the first & last Line of the
+/*?*/ // box. If not return these cells.
+/*?*/ // Else the hole line with all Boxes has to be deleted.
+/*?*/ rpStart = (SwLayoutFrm*)aSttArr[ n+1 ];
+/*?*/ rpEnd = (SwLayoutFrm*)aEndArr[ n+1 ];
+/*?*/ if( n )
+/*?*/ {
+/*?*/ const SwCellFrm* pCellFrm = (SwCellFrm*)aSttArr[ n-1 ];
+/*?*/ const SwTableLines& rLns = pCellFrm->
+/*?*/ GetTabBox()->GetTabLines();
+/*?*/ if( rLns[ 0 ] == ((SwRowFrm*)aSttArr[ n ])->GetTabLine() &&
+/*?*/ rLns[ rLns.Count() - 1 ] ==
+/*?*/ ((SwRowFrm*)aEndArr[ n ])->GetTabLine() )
+/*?*/ {
+/*?*/ rpStart = rpEnd = pCellFrm;
+/*?*/ while ( rpStart->GetPrev() )
+/*?*/ rpStart = (SwLayoutFrm*)rpStart->GetPrev();
+/*?*/ while ( rpEnd->GetNext() )
+/*?*/ rpEnd = (SwLayoutFrm*)rpEnd->GetNext();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( !bChkProtected ) // geschuetzte Zellen beachten ?
+/*N*/ return;
+/*N*/
+/*N*/
+/*?*/ //Anfang und Ende duerfen nicht auf geschuetzten Zellen liegen.
+/*?*/ while ( rpStart->GetFmt()->GetProtect().IsCntntProtected() )
+/*?*/ rpStart = (SwLayoutFrm*)rpStart->GetNext();
+/*?*/ while ( rpEnd->GetFmt()->GetProtect().IsCntntProtected() )
+/*?*/ rpEnd = (SwLayoutFrm*)rpEnd->GetPrev();
+/*N*/ }
+
+
+/*M*/ void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart,
+/*M*/ const SwLayoutFrm *&rpEnd,
+/*M*/ const int bChkProtected )
+/*M*/ {
+/*M*/ //Start und End senkrecht bis an den Rand der Tabelle denken; es muss
+/*M*/ //die Gesamttabelle betrachtet werden, also inklusive Masters und
+/*M*/ //Follows.
+/*M*/ //Fuer den Start brauchen wir den Mutter-TabellenFrm.
+/*M*/ if( !rpStart )
+/*M*/ return;
+/*M*/ const SwTabFrm *pOrg = rpStart->FindTabFrm();
+/*M*/ const SwTabFrm *pTab = pOrg;
+/*M*/
+/*M*/ SWRECTFN( pTab )
+/*M*/
+/*M*/ #ifdef BIDI
+/*M*/ sal_Bool bRTL = pTab->IsRightToLeft();
+/*M*/ #endif
+/*M*/
+/*M*/ const long nWish = pOrg->GetFmt()->GetFrmSize().GetWidth();
+/*M*/ while ( pTab->IsFollow() )
+/*M*/ {
+/*M*/ const SwFrm *pTmp = pTab->FindPrev();
+/*M*/ ASSERT( pTmp->IsTabFrm(), "Vorgaenger vom Follow nicht der Master." );
+/*M*/ pTab = (const SwTabFrm*)pTmp;
+/*M*/ }
+/*M*/
+/*M*/ SwTwips nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)();
+/*M*/ const SwTwips nSX = ::binfilter::lcl_CalcWish( rpStart, nWish, nPrtWidth ) +
+/*M*/ (pTab->*fnRect->fnGetPrtLeft)();
+/*M*/
+/*M*/ const SwTwips nSX2= nSX + (rpStart->GetFmt()->GetFrmSize().GetWidth() *
+/*M*/ nPrtWidth / nWish);
+/*M*/
+/*M*/ const SwLayoutFrm *pTmp = pTab->FirstCell();
+/*M*/
+/*M*/ #ifdef BIDI
+/*M*/ while ( pTmp &&
+/*M*/ (!pTmp->IsCellFrm() ||
+/*M*/ ( ( ! bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() < nSX &&
+/*M*/ (pTmp->Frm().*fnRect->fnGetRight)()< nSX2 ) ||
+/*M*/ bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() > nSX &&
+/*M*/ (pTmp->Frm().*fnRect->fnGetRight)()> nSX2 ) ) )
+/*M*/ #else
+/*M*/ while ( pTmp &&
+/*M*/ (!pTmp->IsCellFrm() ||
+/*M*/ ( (pTmp->Frm().*fnRect->fnGetLeft)() < nSX &&
+/*M*/ (pTmp->Frm().*fnRect->fnGetRight)()< nSX2 ) ) )
+/*M*/ #endif
+/*M*/ pTmp = pTmp->GetNextLayoutLeaf();
+/*M*/
+/*M*/ if ( pTmp )
+/*M*/ rpStart = pTmp;
+/*M*/
+/*M*/ pTab = pOrg;
+/*M*/ while ( pTab->GetFollow() )
+/*M*/ pTab = pTab->GetFollow();
+/*M*/
+/*M*/ nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)();
+/*M*/ const SwTwips nEX = ::binfilter::lcl_CalcWish( rpEnd, nWish, nPrtWidth ) +
+/*M*/ (pTab->*fnRect->fnGetPrtLeft)();
+/*M*/ rpEnd = pTab->FindLastCntnt()->GetUpper();
+/*M*/ while( !rpEnd->IsCellFrm() )
+/*M*/ rpEnd = rpEnd->GetUpper();
+/*M*/
+/*M*/ #ifdef BIDI
+/*M*/ while ( ( bRTL && (rpEnd->Frm().*fnRect->fnGetLeft)() < nEX ) ||
+/*M*/ ( ! bRTL && (rpEnd->Frm().*fnRect->fnGetLeft)() > nEX ) )
+/*M*/ #else
+/*M*/ while ( (rpEnd->Frm().*fnRect->fnGetLeft)() > nEX ) )
+/*M*/ #endif
+/*M*/ {
+/*M*/ const SwLayoutFrm* pTmp = rpEnd->GetPrevLayoutLeaf();
+/*M*/ if( !pTmp || !pTab->IsAnLower( pTmp ) )
+/*M*/ break;
+/*M*/ rpEnd = pTmp;
+/*M*/ }
+/*M*/
+/*M*/ if( !bChkProtected ) // geschuetzte Zellen beachten ?
+/*M*/ return;
+/*M*/
+/*M*/ //Anfang und Ende duerfen nicht auf geschuetzten Zellen liegen.
+/*M*/ //Also muss ggf. nocheinmal rueckwaerts gesucht werden.
+/*M*/ while ( rpStart->GetFmt()->GetProtect().IsCntntProtected() )
+/*M*/ {
+/*M*/ const SwLayoutFrm *pTmp = rpStart;
+/*M*/ pTmp = pTmp->GetNextLayoutLeaf();
+/*M*/ while ( pTmp && (pTmp->Frm().*fnRect->fnGetLeft)() > nEX )//erstmal die Zeile ueberspr.
+/*M*/ pTmp = pTmp->GetNextLayoutLeaf();
+/*M*/ while ( pTmp && (pTmp->Frm().*fnRect->fnGetLeft)() < nSX &&
+/*M*/ (pTmp->Frm().*fnRect->fnGetRight)()< nSX2 )
+/*M*/ pTmp = pTmp->GetNextLayoutLeaf();
+/*M*/ const SwTabFrm *pTab = rpStart->FindTabFrm();
+/*M*/ if ( !pTab->IsAnLower( pTmp ) )
+/*M*/ {
+/*M*/ pTab = pTab->GetFollow();
+/*M*/ rpStart = pTab->FirstCell();
+/*M*/ while ( (rpStart->Frm().*fnRect->fnGetLeft)() < nSX &&
+/*M*/ (rpStart->Frm().*fnRect->fnGetRight)()< nSX2 )
+/*M*/ rpStart = rpStart->GetNextLayoutLeaf();
+/*M*/ }
+/*M*/ else
+/*M*/ rpStart = pTmp;
+/*M*/ }
+/*M*/ while ( rpEnd->GetFmt()->GetProtect().IsCntntProtected() )
+/*M*/ {
+/*M*/ const SwLayoutFrm *pTmp = rpEnd;
+/*M*/ pTmp = pTmp->GetPrevLayoutLeaf();
+/*M*/ while ( pTmp && (pTmp->Frm().*fnRect->fnGetLeft)() < nEX )//erstmal die Zeile ueberspr.
+/*M*/ pTmp = pTmp->GetPrevLayoutLeaf();
+/*M*/ while ( pTmp && (pTmp->Frm().*fnRect->fnGetLeft)() > nEX )
+/*M*/ pTmp = pTmp->GetPrevLayoutLeaf();
+/*M*/ const SwTabFrm *pTab = rpEnd->FindTabFrm();
+/*M*/ if ( !pTmp || !pTab->IsAnLower( pTmp ) )
+/*M*/ {
+/*M*/ pTab = (const SwTabFrm*)pTab->FindPrev();
+/*M*/ ASSERT( pTab->IsTabFrm(), "Vorgaenger vom Follow nicht der Master.");
+/*M*/ rpEnd = pTab->FindLastCntnt()->GetUpper();
+/*M*/ while( !rpEnd->IsCellFrm() )
+/*M*/ rpEnd = rpEnd->GetUpper();
+/*M*/ while ( (rpEnd->Frm().*fnRect->fnGetLeft)() > nEX )
+/*M*/ rpEnd = rpEnd->GetPrevLayoutLeaf();
+/*M*/ }
+/*M*/ else
+/*M*/ rpEnd = pTmp;
+/*M*/ }
+/*M*/ }
+
+
+/*M*/ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart,
+/*M*/ const SwLayoutFrm *pEnd, const SwTblSearchType eSearchType )
+/*M*/ {
+/*M*/ while ( !pStart->IsCellFrm() )
+/*M*/ pStart = pStart->GetUpper();
+/*M*/ while ( !pEnd->IsCellFrm() )
+/*M*/ pEnd = pEnd->GetUpper();
+/*M*/
+/*M*/ const SwTabFrm *pTable = pStart->FindTabFrm();
+/*M*/ const SwTabFrm *pEndTable = pEnd->FindTabFrm();
+/*M*/ if( !pTable || !pEndTable )
+/*M*/ return;
+/*M*/ BOOL bExchange = FALSE;
+/*M*/
+/*M*/ if ( pTable != pEndTable )
+/*M*/ {
+/*M*/ if ( !pTable->IsAnFollow( pEndTable ) )
+/*M*/ {
+/*M*/ ASSERT( pEndTable->IsAnFollow( pTable ), "Tabkette verknotet." );
+/*M*/ bExchange = TRUE;
+/*M*/ }
+/*M*/ }
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ else
+/*M*/ {
+/*M*/ SWRECTFN( pStart )
+/*M*/ long nSttTop = (pStart->Frm().*fnRect->fnGetTop)();
+/*M*/ long nEndTop = (pEnd->Frm().*fnRect->fnGetTop)();
+/*M*/ if( nSttTop == nEndTop )
+/*M*/ {
+/*M*/ if( (pStart->Frm().*fnRect->fnGetLeft)() >
+/*M*/ (pEnd->Frm().*fnRect->fnGetLeft)() )
+/*M*/ bExchange = TRUE;
+/*M*/ }
+/*M*/ else if( bVert == ( nSttTop < nEndTop ) )
+/*M*/ bExchange = TRUE;
+/*M*/ }
+/*M*/ #else
+/*M*/ else if ( pStart->Frm().Top() > pEnd->Frm().Top() ||
+/*M*/ (pStart->Frm().Top() == pEnd->Frm().Top() &&
+/*M*/ pStart->Frm().Left() > pEnd->Frm().Left()) )
+/*M*/ bExchange = TRUE;
+/*M*/ #endif
+/*M*/ if ( bExchange )
+/*M*/ {
+/*M*/ const SwLayoutFrm *pTmp = pStart;
+/*M*/ pStart = pEnd;
+/*M*/ pEnd = pTmp;
+/*M*/ //pTable und pEndTable nicht umsortieren, werden unten neu gesetzt.
+/*M*/ //MA: 28. Dec. 93 Bug: 5190
+/*M*/ }
+/*M*/
+/*M*/ //Start und End sind jetzt huebsch sortiert, jetzt muessen sie falls
+/*M*/ //erwuenscht noch versetzt werden.
+/*M*/ if( TBLSEARCH_ROW == ((~TBLSEARCH_PROTECT ) & eSearchType ) )
+/*M*/ ::binfilter::lcl_FindStartEndRow( pStart, pEnd, TBLSEARCH_PROTECT & eSearchType );
+/*M*/ else if( TBLSEARCH_COL == ((~TBLSEARCH_PROTECT ) & eSearchType ) )
+/*M*/ ::binfilter::lcl_FindStartEndCol( pStart, pEnd, TBLSEARCH_PROTECT & eSearchType );
+/*M*/
+/*M*/ //neu besorgen, da sie jetzt verschoben sind. MA: 28. Dec. 93 Bug 5190
+/*M*/ pTable = pStart->FindTabFrm();
+/*M*/ pEndTable = pEnd->FindTabFrm();
+/*M*/
+/*M*/ const FASTBOOL bRepeat = pTable->GetTable()->IsHeadlineRepeat();
+/*M*/
+/*M*/ const long nStSz = pStart->GetFmt()->GetFrmSize().GetWidth();
+/*M*/ const long nEdSz = pEnd->GetFmt()->GetFrmSize().GetWidth();
+/*M*/ const long nWish = Max( 1L, pTable->GetFmt()->GetFrmSize().GetWidth() );
+/*M*/ while ( pTable )
+/*M*/ {
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ SWRECTFN( pTable )
+/*M*/ const long nOfst = (pTable->*fnRect->fnGetPrtLeft)();
+/*M*/ const long nPrtWidth = (pTable->Prt().*fnRect->fnGetWidth)();
+/*M*/ long nSt1 = ::binfilter::lcl_CalcWish( pStart, nWish, nPrtWidth ) + nOfst;
+/*M*/ long nEd1 = ::binfilter::lcl_CalcWish( pEnd, nWish, nPrtWidth ) + nOfst;
+/*M*/
+/*M*/ if ( nSt1 <= nEd1 )
+/*M*/ nEd1 += (long)((nEdSz * nPrtWidth) / nWish) - 1;
+/*M*/ else
+/*M*/ nSt1 += (long)((nStSz * nPrtWidth) / nWish) - 1;
+/*M*/
+/*M*/ long nSt2;
+/*M*/ long nEd2;
+/*M*/ if( pTable->IsAnLower( pStart ) )
+/*M*/ nSt2 = (pStart->Frm().*fnRect->fnGetTop)();
+/*M*/ else
+/*M*/ nSt2 = (pTable->Frm().*fnRect->fnGetTop)();
+/*M*/ if( pTable->IsAnLower( pEnd ) )
+/*M*/ nEd2 = (pEnd->Frm().*fnRect->fnGetBottom)();
+/*M*/ else
+/*M*/ nEd2 = (pTable->Frm().*fnRect->fnGetBottom)();
+/*M*/ Point aSt, aEd;
+/*M*/ if( nSt1 > nEd1 )
+/*M*/ {
+/*M*/ long nTmp = nSt1;
+/*M*/ nSt1 = nEd1;
+/*M*/ nEd1 = nTmp;
+/*M*/ }
+/*M*/ if( nSt2 > nEd2 )
+/*M*/ {
+/*M*/ long nTmp = nSt2;
+/*M*/ nSt2 = nEd2;
+/*M*/ nEd2 = nTmp;
+/*M*/ }
+/*M*/ if( bVert )
+/*M*/ {
+/*M*/ aSt = Point( nSt2, nSt1 );
+/*M*/ aEd = Point( nEd2, nEd1 );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ aSt = Point( nSt1, nSt2 );
+/*M*/ aEd = Point( nEd1, nEd2 );
+/*M*/ }
+/*M*/ #else
+/*M*/ const long nOfst = pTable->Frm().Left() + pTable->Prt().Left();
+/*M*/ long nSt = ::binfilter::lcl_CalcWish( pStart, nWish, pTable->Prt().Width() ) + nOfst;
+/*M*/ long nEd = ::binfilter::lcl_CalcWish( pEnd, nWish, pTable->Prt().Width() ) + nOfst;
+/*M*/
+/*M*/ if ( nSt <= nEd )
+/*M*/ nEd += (long)((nEdSz * pTable->Prt().Width()) / nWish) - 1;
+/*M*/ else
+/*M*/ nSt += (long)((nStSz * pTable->Prt().Width()) / nWish) - 1;
+/*M*/
+/*M*/ Point aSt( nSt, pStart->Frm().Top() ),
+/*M*/ aEd( nEd, pEnd->Frm().Bottom() );
+/*M*/
+/*M*/ if ( !pTable->IsAnLower( pStart ) )
+/*M*/ aSt.Y() = pTable->Frm().Top();
+/*M*/ if ( !pTable->IsAnLower( pEnd ) )
+/*M*/ aEd.Y() = pTable->Frm().Bottom();
+/*M*/ #endif
+/*M*/
+/*M*/ SwRect aUnion( aSt, aEd );
+/*M*/ aUnion.Justify();
+/*M*/
+/*M*/ // fuers
+/*M*/ if( !(TBLSEARCH_NO_UNION_CORRECT & eSearchType ))
+/*M*/ {
+/*M*/ //Leider ist die Union jetzt mit Rundungsfehlern behaftet und dadurch
+/*M*/ //wuerden beim Split/Merge fehlertraechtige Umstaende entstehen.
+/*M*/ //Um dies zu vermeiden werden jetzt fuer die Table die erste und
+/*M*/ //letzte Zelle innerhalb der Union ermittelt und aus genau deren
+/*M*/ //Werten wird die Union neu gebildet.
+/*M*/ const SwLayoutFrm *pRow = (SwLayoutFrm*)pTable->Lower();
+/*M*/ if ( bRepeat && pRow && pTable->IsFollow() )
+/*M*/ pRow = (SwLayoutFrm*)pRow->GetNext();
+/*M*/ while ( pRow && !pRow->Frm().IsOver( aUnion ) )
+/*M*/ pRow = (SwLayoutFrm*)pRow->GetNext();
+/*M*/ const SwLayoutFrm *pFirst = pRow ? pRow->FirstCell() : 0;
+/*M*/ while ( pFirst && !::binfilter::IsFrmInTblSel( aUnion, pFirst ) )
+/*M*/ {
+/*M*/ if ( pFirst->GetNext() )
+/*M*/ {
+/*M*/ pFirst = (const SwLayoutFrm*)pFirst->GetNext();
+/*M*/ if ( pFirst->Lower()->IsRowFrm() )
+/*M*/ pFirst = pFirst->FirstCell();
+/*M*/ }
+/*M*/ else
+/*M*/ pFirst = ::binfilter::lcl_FindNextCellFrm( pFirst );
+/*M*/ }
+/*M*/ const SwLayoutFrm *pLast = ::binfilter::lcl_FindCellFrm( pTable->FindLastCntnt()->GetUpper());
+/*M*/ while ( pLast && !::binfilter::IsFrmInTblSel( aUnion, pLast ) )
+/*M*/ pLast = ::binfilter::lcl_FindCellFrm( pLast->GetPrevLayoutLeaf() );
+/*M*/
+/*M*/ if ( pFirst && pLast ) //Robust
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ {
+/*M*/ aUnion = pFirst->Frm();
+/*M*/ aUnion.Union( pLast->Frm() );
+/*M*/ }
+/*M*/ #else
+/*M*/ aUnion = SwRect( pFirst->Frm().Pos(),
+/*M*/ Point( pLast->Frm().Right(),
+/*M*/ pLast->Frm().Bottom() ) );
+/*M*/ #endif
+/*M*/ else
+/*M*/ aUnion.Width( 0 );
+/*M*/ }
+/*M*/
+/*M*/ if( (aUnion.*fnRect->fnGetWidth)() )
+/*M*/ {
+/*M*/ SwSelUnion *pTmp = new SwSelUnion( aUnion, (SwTabFrm*)pTable );
+/*M*/ rUnions.C40_INSERT( SwSelUnion, pTmp, rUnions.Count() );
+/*M*/ }
+/*M*/
+/*M*/ pTable = pTable->GetFollow();
+/*M*/ if ( pTable != pEndTable && pEndTable->IsAnFollow( pTable ) )
+/*M*/ pTable = 0;
+/*M*/ }
+/*M*/ }
+
+
+
+// -------------------------------------------------------------------
+// Diese Klassen kopieren die aktuelle Tabellen-Selektion (rBoxes)
+// unter Beibehaltung der Tabellen-Struktur in eine eigene Struktur
+// neu: SS zum gezielten Loeschen/Retaurieren des Layouts.
+
+ void lcl_InsertRow( SwTableLine &rLine, SwLayoutFrm *pUpper, SwFrm *pSibling )
+ {
+ SwRowFrm *pRow = new SwRowFrm( rLine );
+ if ( pUpper->IsTabFrm() && ((SwTabFrm*)pUpper)->IsFollow() )
+ {
+ ((SwTabFrm*)pUpper)->FindMaster()->InvalidatePos(); //kann die Zeile vielleicht aufnehmen
+ if ( ((SwTabFrm*)pUpper)->GetTable()->IsHeadlineRepeat() &&
+ pSibling && !pSibling->GetPrev() )
+ {
+ //Nicht vor die Headline-Wiederholung pasten.
+ pSibling = pSibling->GetNext();
+ }
+ }
+ pRow->Paste( pUpper, pSibling );
+ pRow->RegistFlys();
+ }
+
+
+ BOOL _FndBoxCopyCol( const SwTableBox*& rpBox, void* pPara )
+ {
+ _FndPara* pFndPara = (_FndPara*)pPara;
+ _FndBox* pFndBox = new _FndBox( (SwTableBox*)rpBox, pFndPara->pFndLine );
+ if( rpBox->GetTabLines().Count() )
+ {
+ _FndPara aPara( *pFndPara, pFndBox );
+ pFndBox->GetBox()->GetTabLines().ForEach( &_FndLineCopyCol, &aPara );
+ if( !pFndBox->GetLines().Count() )
+ {
+ delete pFndBox;
+ return TRUE;
+ }
+ }
+ else
+ {
+ SwTableBoxPtr pSrch = (SwTableBoxPtr)rpBox;
+ USHORT nFndPos;
+ if( !pFndPara->rBoxes.Seek_Entry( pSrch, &nFndPos ))
+ {
+ delete pFndBox;
+ return TRUE;
+ }
+ }
+ pFndPara->pFndLine->GetBoxes().C40_INSERT( _FndBox, pFndBox,
+ pFndPara->pFndLine->GetBoxes().Count() );
+ return TRUE;
+ }
+
+/*N*/ BOOL _FndLineCopyCol( const SwTableLine*& rpLine, void* pPara )
+/*N*/ {
+ _FndPara* pFndPara = (_FndPara*)pPara;
+ _FndLine* pFndLine = new _FndLine( (SwTableLine*)rpLine, pFndPara->pFndBox );
+ _FndPara aPara( *pFndPara, pFndLine );
+ pFndLine->GetLine()->GetTabBoxes().ForEach( &_FndBoxCopyCol, &aPara );
+ if( pFndLine->GetBoxes().Count() )
+ {
+ pFndPara->pFndBox->GetLines().C40_INSERT( _FndLine, pFndLine,
+ pFndPara->pFndBox->GetLines().Count() );
+ }
+ else
+ delete pFndLine;
+/*N*/ return TRUE;
+/*N*/ }
+
+void _FndBox::SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable )
+{
+ //Pointer auf die Lines vor und hinter den zu verarbeitenden Bereich
+ //setzen. Wenn die erste/letzte Zeile in den Bereich eingeschlossen
+ //sind, so bleiben die Pointer eben einfach 0.
+ //Gesucht werden zunachst die Positionen der ersten/letzten betroffenen
+ //Line im Array der SwTable. Damit die 0 fuer 'keine Line' verwand werden
+ //kann werden die Positionen um 1 nach oben versetzt!
+
+ USHORT nStPos = USHRT_MAX;
+ USHORT nEndPos= 0;
+
+ for ( USHORT i = 0; i < rBoxes.Count(); ++i )
+ {
+ SwTableLine *pLine = rBoxes[i]->GetUpper();
+ while ( pLine->GetUpper() )
+ pLine = pLine->GetUpper()->GetUpper();
+ const USHORT nPos = rTable.GetTabLines().GetPos(
+ (const SwTableLine*&)pLine ) + 1;
+
+ ASSERT( nPos != USHRT_MAX, "TableLine not found." );
+
+ if( nStPos > nPos )
+ nStPos = nPos;
+
+ if( nEndPos < nPos )
+ nEndPos = nPos;
+ }
+ if ( nStPos > 1 )
+ pLineBefore = rTable.GetTabLines()[nStPos - 2];
+ if ( nEndPos < rTable.GetTabLines().Count() )
+ pLineBehind = rTable.GetTabLines()[nEndPos];
+}
+
+void _FndBox::SetTableLines( const SwTable &rTable )
+{
+ // Pointer auf die Lines vor und hinter den zu verarbeitenden Bereich
+ // setzen. Wenn die erste/letzte Zeile in den Bereich eingeschlossen
+ // sind, so bleiben die Pointer eben einfach 0.
+ // Die Positionen der ersten/letzten betroffenen Line im Array der
+ // SwTable steht in der FndBox. Damit die 0 fuer 'keine Line' verwand
+ // werdenkann werden die Positionen um 1 nach oben versetzt!
+
+ if( !GetLines().Count() )
+ return;
+
+ SwTableLine* pTmpLine = GetLines()[0]->GetLine();
+ USHORT nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pTmpLine );
+ ASSERT( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" );
+ if( nPos )
+ pLineBefore = rTable.GetTabLines()[ nPos - 1 ];
+
+ pTmpLine = GetLines()[GetLines().Count()-1]->GetLine();
+ nPos = rTable.GetTabLines().C40_GETPOS( SwTableLine, pTmpLine );
+ ASSERT( USHRT_MAX != nPos, "Line steht nicht in der Tabelle" );
+ if( ++nPos < rTable.GetTabLines().Count() )
+ pLineBehind = rTable.GetTabLines()[nPos];
+}
+
+inline void UnsetFollow( SwFlowFrm *pTab )
+{
+ pTab->bIsFollow = FALSE;
+}
+
+void _FndBox::DelFrms( SwTable &rTable )
+{
+ //Alle Lines zwischen pLineBefore und pLineBehind muessen aus dem
+ //Layout ausgeschnitten und geloescht werden.
+ //Entstehen dabei leere Follows so muessen diese vernichtet werden.
+ //Wird ein Master vernichtet, so muss der Follow Master werden.
+ //Ein TabFrm muss immer uebrigbleiben.
+
+ USHORT nStPos = 0;
+ USHORT nEndPos= rTable.GetTabLines().Count() - 1;
+ if ( pLineBefore )
+ {
+ nStPos = rTable.GetTabLines().GetPos(
+ (const SwTableLine*&)pLineBefore );
+ ASSERT( nStPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" );
+ ++nStPos;
+ }
+ if ( pLineBehind )
+ {
+ nEndPos = rTable.GetTabLines().GetPos(
+ (const SwTableLine*&)pLineBehind );
+ ASSERT( nEndPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" );
+ --nEndPos;
+ }
+ for ( USHORT i = nStPos; i <= nEndPos; ++i)
+ {
+ SwFrmFmt *pFmt = rTable.GetTabLines()[i]->GetFrmFmt();
+ SwClientIter aIter( *pFmt );
+ SwClient* pLast = aIter.GoStart();
+ if( pLast )
+ {
+ do {
+ SwFrm *pFrm = PTR_CAST( SwFrm, pLast );
+ if ( pFrm &&
+ ((SwRowFrm*)pFrm)->GetTabLine() == rTable.GetTabLines()[i] )
+ {
+ BOOL bDel = TRUE;
+ SwTabFrm *pUp = !pFrm->GetPrev() && !pFrm->GetNext() ?
+ (SwTabFrm*)pFrm->GetUpper() : 0;
+ if ( !pUp )
+ {
+ if ( ((SwTabFrm*)pFrm->GetUpper())->GetTable()->IsHeadlineRepeat() &&
+ ((SwTabFrm*)pFrm->GetUpper())->IsFollow() )
+ {
+ if ( !pFrm->GetNext() && pFrm->GetPrev() &&
+ !pFrm->GetPrev()->GetPrev() )
+ {
+ pUp = (SwTabFrm*)pFrm->GetUpper();
+ }
+ }
+ }
+ if ( pUp )
+ {
+ SwTabFrm *pFollow = pUp->GetFollow();
+ SwTabFrm *pPrev = pUp->IsFollow() ? pUp : 0;
+ if ( pPrev )
+ {
+ SwFrm *pTmp = pPrev->FindPrev();
+ ASSERT( pTmp->IsTabFrm(),
+ "Vorgaenger vom Follow kein Master.");
+ pPrev = (SwTabFrm*)pTmp;
+ }
+ if ( pPrev )
+ pPrev->SetFollow( pFollow );
+ else if ( pFollow )
+ ::binfilter::UnsetFollow( pFollow );
+
+ //Ein TabellenFrm muss immer stehenbleiben!
+ if ( pPrev || pFollow )
+ {
+ pUp->Cut();
+ delete pUp;
+ bDel = FALSE;//Die Row wird mit in den Abgrund
+ //gerissen.
+ }
+ }
+ if ( bDel )
+ {
+ pFrm->Cut();
+ delete pFrm;
+ }
+ }
+ } while( 0 != ( pLast = aIter++ ));
+ }
+ }
+}
+
+BOOL lcl_IsLineOfTblFrm( const SwTabFrm& rTable, const SwFrm& rChk )
+{
+ const SwTabFrm* pTblFrm = rChk.FindTabFrm();
+ while( pTblFrm->IsFollow() )
+ pTblFrm = pTblFrm->FindMaster();
+ return &rTable == pTblFrm;
+}
+
+ void _FndBox::MakeFrms( SwTable &rTable )
+ {
+ //Alle Lines zwischen pLineBefore und pLineBehind muessen im Layout
+ //wieder neu erzeugt werden.
+ //Und Zwar fuer alle Auspraegungen der Tabelle (mehrere z.B. im Kopf/Fuss).
+
+ USHORT nStPos = 0;
+ USHORT nEndPos= rTable.GetTabLines().Count() - 1;
+ if ( pLineBefore )
+ {
+ nStPos = rTable.GetTabLines().GetPos(
+ (const SwTableLine*&)pLineBefore );
+ ASSERT( nStPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" );
+ ++nStPos;
+
+ }
+ if ( pLineBehind )
+ {
+ nEndPos = rTable.GetTabLines().GetPos(
+ (const SwTableLine*&)pLineBehind );
+ ASSERT( nEndPos != USHRT_MAX, "Fuchs Du hast die Line gestohlen!" );
+ --nEndPos;
+ }
+ //Jetzt die grosse Einfuegeoperation fuer alle Tabllen.
+ SwClientIter aTabIter( *rTable.GetFrmFmt() );
+ for ( SwTabFrm *pTable = (SwTabFrm*)aTabIter.First( TYPE(SwFrm) ); pTable;
+ pTable = (SwTabFrm*)aTabIter.Next() )
+ {
+ if ( !pTable->IsFollow() )
+ {
+ SwFrm *pSibling = 0;
+ SwFrm *pUpper = 0;
+ int i;
+ for ( i = rTable.GetTabLines().Count()-1;
+ i >= 0 && !pSibling; --i )
+ {
+ SwTableLine *pLine = pLineBehind ? pLineBehind :
+ rTable.GetTabLines()[i];
+ SwClientIter aIter( *pLine->GetFrmFmt() );
+ for ( pSibling = (SwFrm*)aIter.First( TYPE(SwFrm) );
+ pSibling && (
+ ((SwRowFrm*)pSibling)->GetTabLine() != pLine ||
+ !lcl_IsLineOfTblFrm( *pTable, *pSibling ) );
+ pSibling = (SwFrm*)aIter.Next() )
+ /* do nothing */;
+ }
+ if ( pSibling )
+ {
+ pUpper = pSibling->GetUpper();
+ if ( !pLineBehind )
+ pSibling = 0;
+ }
+ else
+ // ???? oder das der Letzte Follow der Tabelle ????
+ pUpper = pTable;
+
+ for ( i = nStPos; (USHORT)i <= nEndPos; ++i )
+ lcl_InsertRow( *rTable.GetTabLines()[i],
+ (SwLayoutFrm*)pUpper, pSibling );
+ if ( pUpper->IsTabFrm() )
+ ((SwTabFrm*)pUpper)->SetCalcLowers();
+ }
+ else if ( nStPos == 0 && rTable.IsHeadlineRepeat() )
+ {
+ //Headline in den Follow einsetzen
+ SwRowFrm *pRow = new SwRowFrm( *rTable.GetTabLines()[0] );
+ pRow->Paste( pTable, pTable->Lower() );
+ pRow->RegistFlys();
+ pTable->SetCalcLowers();
+ }
+ }
+ }
+
+ BOOL _FndBox::AreLinesToRestore( const SwTable &rTable ) const
+ {
+ //Lohnt es sich MakeFrms zu rufen?
+
+ if ( !pLineBefore && !pLineBehind && rTable.GetTabLines().Count() )
+ return TRUE;
+
+ USHORT nBfPos;
+ if(pLineBefore)
+ {
+ const SwTableLine* rLBefore = (const SwTableLine*)pLineBefore;
+ nBfPos = rTable.GetTabLines().GetPos( rLBefore );
+ }
+ else
+ nBfPos = USHRT_MAX;
+
+ USHORT nBhPos;
+ if(pLineBehind)
+ {
+ const SwTableLine* rLBehind = (const SwTableLine*)pLineBehind;
+ nBhPos = rTable.GetTabLines().GetPos( rLBehind );
+ }
+ else
+ nBhPos = USHRT_MAX;
+
+ if ( nBfPos == nBhPos ) //Duerfte eigentlich nie vorkommen.
+ {
+ ASSERT( FALSE, "Table, Loeschen auf keinem Bereich !?!" );
+ return FALSE;
+ }
+
+ if ( nBfPos == USHRT_MAX && nBhPos == 0 )
+ {
+ // ups. sollte unsere zu wiederholende Kopfzeile geloescht worden
+ // sein??
+ if( rTable.IsHeadlineRepeat() )
+ {
+ SwClientIter aIter( *rTable.GetFrmFmt() );
+ for( SwTabFrm* pTable = (SwTabFrm*)aIter.First( TYPE( SwFrm ));
+ pTable; pTable = (SwTabFrm*)aIter.Next() )
+ if( pTable->IsFollow() )
+ {
+ //Headline in den Follow einsetzen
+ SwRowFrm *pRow = new SwRowFrm( *rTable.GetTabLines()[0] );
+ pRow->Paste( pTable, pTable->Lower() );
+ pRow->RegistFlys();
+ }
+ }
+ return FALSE;
+ }
+
+ if ( nBhPos == USHRT_MAX && nBfPos == (rTable.GetTabLines().Count() - 1) )
+ return FALSE;
+
+ if ( nBfPos != USHRT_MAX && nBhPos != USHRT_MAX && (nBfPos + 1) == nBhPos )
+ return FALSE;
+
+ return TRUE;
+ }
+
+//Save- und RestoreChartData:
+//Zu der Tabelle werden alle Charts gesucht. Die Namentliche Addressierung der
+//Boxen in der Tabelle (etwa: <A1:C3>) wird ausgelesen. Die Addressen der
+//Boxen werden im Chart festgehalten. Im Restore wird versucht zu den Pointern
+//die Boxen wiederzufinden. Wenn dies gelingt, wird die neue Addressierung
+//wieder in das Chart geschrieben. Wenn sie nicht gefunden werden gibt es
+//einen FallBack auf die erste/letzte Box.
+
+ const SwTableBox *lcl_FindFirstBox( const SwTable &rTable )
+ {
+ const SwTableLines *pLines = &rTable.GetTabLines();
+ const SwTableBox *pBox;
+ do
+ { pBox = (*pLines)[0]->GetTabBoxes()[0];
+ if ( pBox->GetSttNd() )
+ pLines = 0;
+ else
+ pLines = &pBox->GetTabLines();
+
+ } while ( pLines );
+ return pBox;
+ }
+
+ const SwTableBox *lcl_FindLastBox( const SwTable &rTable )
+ {
+ const SwTableLines *pLines = &rTable.GetTabLines();
+ const SwTableBox *pBox;
+ do
+ { const SwTableBoxes &rBoxes = (*pLines)[pLines->Count()-1]->GetTabBoxes();
+ pBox = rBoxes[rBoxes.Count()-1];
+ if ( pBox->GetSttNd() )
+ pLines = 0;
+ else
+ pLines = &pBox->GetTabLines();
+
+ } while ( pLines );
+
+ return pBox;
+ }
+
+
+//GPF bei Tab in letzer Zelle mit MSC4
+
+void _FndBox::SaveChartData( const SwTable &rTable )
+{
+ SwDoc *pDoc = rTable.GetFrmFmt()->GetDoc();
+ SwClientIter aIter( *(SwModify*)pDoc->GetDfltGrfFmtColl() );
+ SwClient *pCli;
+ if ( 0 != (pCli = aIter.First( TYPE(SwCntntNode) )) )
+ do
+ { if ( !((SwCntntNode*)pCli)->GetOLENode() )
+ continue;
+ SwOLENode *pONd = (SwOLENode*)pCli;
+ if ( rTable.GetFrmFmt()->GetName() == pONd->GetChartTblName() )
+ {
+ SwOLEObj& rOObj = pONd->GetOLEObj();
+ SchMemChart *pData = SchDLL::GetChartData( rOObj.GetOleRef() );
+ if ( pData )
+ {
+ String &rStr = pData->SomeData1();
+ xub_StrLen nTmp = rStr.Search( ':' );
+ String aBox( rStr.Copy( 1, nTmp - 1 ) );
+ //const this, weil Borland so dumm ist!
+ const SwTableBox *pSttBox = rTable.GetTblBox( aBox );
+ if ( !pSttBox )
+ pSttBox = rTable.GetTabLines()[0]->GetTabBoxes()[0];
+ aBox = rStr.Copy( nTmp + 1, rStr.Len()-2 - nTmp);
+ const SwTableBox *pEndBox = rTable.GetTblBox( aBox );
+ if ( !pEndBox )
+ {
+ SwTableLine *pLine =
+ rTable.GetTabLines()[rTable.GetTabLines().Count()-1];
+ pEndBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ }
+ pData->SomeData3() = String::CreateFromInt32(
+ pSttBox != ::binfilter::lcl_FindFirstBox(rTable)
+ ? long(pSttBox)
+ : LONG_MAX );
+ pData->SomeData4() = String::CreateFromInt32(
+ pEndBox != ::binfilter::lcl_FindLastBox(rTable)
+ ? long(pEndBox)
+ : LONG_MAX );
+ }
+ }
+ } while ( 0 != (pCli = aIter.Next()) );
+}
+
+ void _FndBox::RestoreChartData( const SwTable &rTable )
+ {
+ SwDoc *pDoc = rTable.GetFrmFmt()->GetDoc();
+ SwClientIter aIter( *(SwModify*)pDoc->GetDfltGrfFmtColl() );
+ SwClient *pCli;
+ if ( 0 != (pCli = aIter.First( TYPE(SwCntntNode) )) )
+ do
+ { if ( !((SwCntntNode*)pCli)->GetOLENode() )
+ continue;
+ SwOLENode *pONd = (SwOLENode*)pCli;
+ if ( rTable.GetFrmFmt()->GetName() == pONd->GetChartTblName() )
+ {
+ SwOLEObj& rOObj = pONd->GetOLEObj();
+ SchMemChart *pData = SchDLL::GetChartData( rOObj.GetOleRef() );
+ if ( pData )
+ {
+ const SwTableBox *pSttBox = (SwTableBox*)
+ pData->SomeData3().ToInt32();
+ if ( long(pSttBox) == LONG_MAX )
+ pSttBox = ::binfilter::lcl_FindFirstBox( rTable );
+ const SwTableBox *pEndBox = (SwTableBox*)
+ pData->SomeData4().ToInt32();
+ if ( long(pEndBox) == LONG_MAX )
+ pEndBox = ::binfilter::lcl_FindLastBox( rTable );
+ FASTBOOL bSttFound = FALSE, bEndFound = FALSE;
+ const SwTableSortBoxes &rBoxes = rTable.GetTabSortBoxes();
+ for ( USHORT i = 0; i < rBoxes.Count(); ++i )
+ {
+ const SwTableBox *pTmp = rBoxes[i];
+ if ( pTmp == pSttBox )
+ bSttFound = TRUE;
+ if ( pTmp == pEndBox )
+ bEndFound = TRUE;
+ }
+ if ( !bSttFound )
+ pSttBox = rTable.GetTabLines()[0]->GetTabBoxes()[0];
+ if ( !bEndFound )
+ {
+ SwTableLine *pLine =
+ rTable.GetTabLines()[rTable.GetTabLines().Count()-1];
+ pEndBox = pLine->GetTabBoxes()[pLine->GetTabBoxes().Count()-1];
+ }
+ String &rStr = pData->SomeData1();
+ rStr = '<'; rStr += pSttBox->GetName(); rStr += ':';
+ rStr += pEndBox->GetName(); rStr += '>';
+ pData->SomeData3().Erase(); pData->SomeData4().Erase();
+ SchDLL::Update( rOObj.GetOleRef(), pData );
+ }
+ }
+ } while ( 0 != (pCli = aIter.Next()) );
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/graphic/makefile.mk b/binfilter/bf_sw/source/core/graphic/makefile.mk
new file mode 100644
index 000000000000..e0dec07fe69c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/graphic/makefile.mk
@@ -0,0 +1,58 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_graphic
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_grfatr.cxx \
+ sw_ndgrf.cxx
+
+SLOFILES = \
+ $(SLO)$/sw_grfatr.obj \
+ $(SLO)$/sw_ndgrf.obj
+
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/graphic/sw_grfatr.cxx b/binfilter/bf_sw/source/core/graphic/sw_grfatr.cxx
new file mode 100644
index 000000000000..f19454675835
--- /dev/null
+++ b/binfilter/bf_sw/source/core/graphic/sw_grfatr.cxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/HorizontalAdjust.hpp>
+#include <com/sun/star/text/DocumentStatistic.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/HoriOrientationFormat.hpp>
+#include <com/sun/star/text/NotePrintMode.hpp>
+#include <com/sun/star/text/SizeType.hpp>
+#include <com/sun/star/text/VertOrientationFormat.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
+
+#include <bf_goodies/graphicobject.hxx>
+#include <swtypes.hxx>
+#include <grfatr.hxx>
+#include <swunohelper.hxx>
+
+#include <cmdid.h>
+#include <unomid.h>
+#include <errhdl.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+/*N*/ TYPEINIT1_AUTOFACTORY(SwCropGrf, SfxPoolItem)
+/*N*/ TYPEINIT1_AUTOFACTORY(SwGammaGrf, SfxPoolItem)
+
+/******************************************************************************
+ * Implementierung class SwMirrorGrf
+ ******************************************************************************/
+
+/*N*/ SfxPoolItem* SwMirrorGrf::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwMirrorGrf( *this );
+/*N*/ }
+
+sal_uInt16 SwMirrorGrf::GetValueCount() const
+{
+ return RES_GRFMIRROR_END - RES_GRFMIRROR_BEGIN;
+}
+
+/*N*/ int SwMirrorGrf::operator==( const SfxPoolItem& rItem) const
+/*N*/ {
+/*N*/ return SfxEnumItem::operator==(rItem) &&
+/*N*/ ((SwMirrorGrf&)rItem).IsGrfToggle() == IsGrfToggle();
+/*N*/ }
+
+/*N*/ BOOL lcl_IsHoriOnEvenPages(int nEnum, BOOL bToggle)
+/*N*/ {
+/*N*/ BOOL bEnum = nEnum == RES_MIRROR_GRF_VERT ||
+/*N*/ nEnum == RES_MIRROR_GRF_BOTH;
+/*N*/ return bEnum != bToggle;
+/*N*/ }
+/*N*/ BOOL lcl_IsHoriOnOddPages(int nEnum)
+/*N*/ {
+/*N*/ BOOL bEnum = nEnum == RES_MIRROR_GRF_VERT ||
+/*N*/ nEnum == RES_MIRROR_GRF_BOTH;
+/*N*/ return bEnum;
+/*N*/ }
+/*N*/ bool SwMirrorGrf::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+/*N*/ {
+ /*N*/ bool bRet = true;
+/*N*/ sal_Bool bVal;
+/*N*/ // Vertikal und Horizontal sind mal getauscht worden!
+/*N*/ nMemberId &= ~CONVERT_TWIPS;
+/*N*/ switch ( nMemberId )
+/*N*/ {
+/*N*/ case MID_MIRROR_HORZ_EVEN_PAGES:
+/*N*/ bVal = lcl_IsHoriOnEvenPages(GetValue(), IsGrfToggle());
+/*N*/ break;
+/*N*/ case MID_MIRROR_HORZ_ODD_PAGES:
+/*N*/ bVal = lcl_IsHoriOnOddPages(GetValue());
+/*N*/ break;
+/*N*/ case MID_MIRROR_VERT:
+/*N*/ bVal = GetValue() == RES_MIRROR_GRF_HOR ||
+/*N*/ GetValue() == RES_MIRROR_GRF_BOTH;
+/*N*/ break;
+/*N*/ default:
+/*N*/ ASSERT( !this, "unknown MemberId" );
+/*N*/ bRet = sal_False;
+/*N*/ }
+/*N*/ rVal.setValue( &bVal, ::getBooleanCppuType() );
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ bool SwMirrorGrf::PutValue( const uno::Any& rVal, BYTE nMemberId )
+/*N*/ {
+/*N*/ bool bRet = true;
+/*N*/ sal_Bool bVal = *(sal_Bool*)rVal.getValue();
+/*N*/ // Vertikal und Horizontal sind mal getauscht worden!
+/*N*/ nMemberId &= ~CONVERT_TWIPS;
+/*N*/ switch ( nMemberId )
+/*N*/ {
+/*N*/ case MID_MIRROR_HORZ_EVEN_PAGES:
+/*N*/ case MID_MIRROR_HORZ_ODD_PAGES:
+/*N*/ {
+/*N*/ BOOL bIsVert = GetValue() == RES_MIRROR_GRF_HOR ||
+/*N*/ GetValue() == RES_MIRROR_GRF_BOTH;
+/*N*/ BOOL bOnOddPages = nMemberId == MID_MIRROR_HORZ_EVEN_PAGES ?
+/*N*/ lcl_IsHoriOnOddPages(GetValue()) : bVal;
+/*N*/ BOOL bOnEvenPages = nMemberId == MID_MIRROR_HORZ_ODD_PAGES ?
+/*N*/ lcl_IsHoriOnEvenPages(GetValue(), IsGrfToggle()) : bVal;
+/*N*/ GRFMIRROR nEnum = bOnOddPages ?
+/*N*/ bIsVert ? RES_MIRROR_GRF_BOTH : RES_MIRROR_GRF_VERT :
+/*N*/ bIsVert ? RES_MIRROR_GRF_HOR : RES_DONT_MIRROR_GRF;
+/*N*/ BOOL bToggle = bOnOddPages != bOnEvenPages;
+/*N*/ SetValue(nEnum);
+/*N*/ SetGrfToggle( bToggle );
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_MIRROR_VERT:
+/*N*/ if ( bVal )
+/*N*/ {
+/*?*/ if ( GetValue() == RES_MIRROR_GRF_VERT )
+/*?*/ SetValue( RES_MIRROR_GRF_BOTH );
+/*?*/ else if ( GetValue() != RES_MIRROR_GRF_BOTH )
+/*?*/ SetValue( RES_MIRROR_GRF_HOR );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( GetValue() == RES_MIRROR_GRF_BOTH )
+/*?*/ SetValue( RES_MIRROR_GRF_VERT );
+/*N*/ else if ( GetValue() == RES_MIRROR_GRF_HOR )
+/*?*/ SetValue( RES_DONT_MIRROR_GRF );
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ ASSERT( !this, "unknown MemberId" );
+/*N*/ bRet = false;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/******************************************************************************
+ * Implementierung class SwCropGrf
+ ******************************************************************************/
+
+/*N*/ SwCropGrf::SwCropGrf()
+/*N*/ : SvxGrfCrop( RES_GRFATR_CROPGRF )
+/*N*/ {}
+
+SwCropGrf::SwCropGrf(sal_Int32 nL, sal_Int32 nR, sal_Int32 nT, sal_Int32 nB )
+ : SvxGrfCrop( nL, nR, nT, nB, RES_GRFATR_CROPGRF )
+{}
+
+/*N*/ SfxPoolItem* SwCropGrf::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwCropGrf( *this );
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwRotationGrf::Clone( SfxItemPool * ) const
+/*N*/ {
+/*N*/ return new SwRotationGrf( GetValue(), aUnrotatedSize );
+/*N*/ }
+
+
+/*N*/ int SwRotationGrf::operator==( const SfxPoolItem& rCmp ) const
+/*N*/ {
+/*N*/ return SfxUInt16Item::operator==( rCmp ) &&
+/*N*/ GetUnrotatedSize() == ((SwRotationGrf&)rCmp).GetUnrotatedSize();
+/*N*/ }
+
+
+/*N*/ bool SwRotationGrf::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+/*N*/ {
+/*N*/ // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w)
+/*N*/ // where we still want this to be a sal_Int16
+/*N*/ rVal <<= (sal_Int16)GetValue();
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool SwRotationGrf::PutValue( const uno::Any& rVal, BYTE nMemberId )
+/*N*/ {
+/*N*/ // SfxUInt16Item::QueryValue returns sal_Int32 in Any now... (srx642w)
+/*N*/ // where we still want this to be a sal_Int16
+/*N*/ sal_Int16 nValue;
+/*N*/ if (rVal >>= nValue)
+/*N*/ {
+/*N*/ // UINT16 argument needed
+/*N*/ SetValue( (UINT16) nValue );
+/*N*/ return true;
+/*N*/ }
+/*N*/
+/*N*/ DBG_ERROR( "SwRotationGrf::PutValue - Wrong type!" );
+/*N*/ return true;
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwLuminanceGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwLuminanceGrf( *this );
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwContrastGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwContrastGrf( *this );
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwChannelRGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwChannelRGrf( *this );
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwChannelGGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwChannelGGrf( *this );
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwChannelBGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwChannelBGrf( *this );
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwGammaGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwGammaGrf( *this );
+/*N*/ }
+
+/*N*/ int SwGammaGrf::operator==( const SfxPoolItem& rCmp ) const
+/*N*/ {
+/*N*/ return SfxPoolItem::operator==( rCmp ) &&
+/*N*/ nValue == ((SwGammaGrf&)rCmp).GetValue();
+/*N*/ }
+
+/*N*/ bool SwGammaGrf::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+/*N*/ {
+/*N*/ rVal <<= nValue;
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool SwGammaGrf::PutValue( const uno::Any& rVal, BYTE nMemberId )
+/*N*/ {
+/*N*/ return rVal >>= nValue;
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwInvertGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwInvertGrf( *this );
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwTransparencyGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwTransparencyGrf( *this );
+/*N*/ }
+// ------------------------------------------------------------------
+/*N*/ bool SwTransparencyGrf::QueryValue( ::com::sun::star::uno::Any& rVal,
+/*N*/ BYTE nMemberId ) const
+/*N*/ {
+/*N*/ DBG_ASSERT(ISA(SfxByteItem),"Put/QueryValue should be removed!");
+/*N*/ sal_Int16 nRet = GetValue();
+/*N*/ DBG_ASSERT( 0 <= nRet && nRet <= 100, "value out of range" );
+/*N*/ rVal <<= nRet;
+/*N*/ return true;
+/*N*/ }
+// ------------------------------------------------------------------
+/*N*/ bool SwTransparencyGrf::PutValue( const ::com::sun::star::uno::Any& rVal,
+/*N*/ BYTE nMemberId )
+/*N*/ {
+/*N*/ //temporary conversion until this is a SfxInt16Item!
+/*N*/ DBG_ASSERT(ISA(SfxByteItem),"Put/QueryValue should be removed!");
+/*N*/ sal_Int16 nVal;
+/*N*/ if(!(rVal >>= nVal) || nVal < -100 || nVal > 100)
+/*N*/ return FALSE;
+/*N*/ if(nVal < 0)
+/*N*/ {
+/*N*/ // for compatibility with old documents
+/*N*/ // OD 05.11.2002 #104308# - introduce rounding as for SO 6.0 PP2
+/*N*/ // introduced by fix of #104293#.
+/*N*/ nVal = ( ( nVal * 128 ) - (99/2) ) / 100;
+/*N*/ nVal += 128;
+/*N*/ }
+/*N*/ DBG_ASSERT( 0 <= nVal && nVal <= 100, "value out of range" );
+/*N*/ SetValue(nVal);
+/*N*/ return true;
+/*N*/ }
+
+// ------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwDrawModeGrf::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwDrawModeGrf( *this );
+/*N*/ }
+
+
+/*N*/ bool SwDrawModeGrf::QueryValue( ::com::sun::star::uno::Any& rVal,
+/*N*/ BYTE nMemberId ) const
+/*N*/ {
+/*N*/ drawing::ColorMode eRet = (drawing::ColorMode)GetEnumValue();
+/*N*/ rVal <<= eRet;
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool SwDrawModeGrf::PutValue( const ::com::sun::star::uno::Any& rVal,
+/*N*/ BYTE nMemberId )
+/*N*/ {
+/*N*/ sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal );
+/*N*/ if(eVal >= 0 && eVal <= GRAPHICDRAWMODE_WATERMARK)
+/*N*/ {
+/*N*/ SetEnumValue((USHORT)eVal);
+/*N*/ return true;
+/*N*/ }
+/*N*/ return false;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/graphic/sw_ndgrf.cxx b/binfilter/bf_sw/source/core/graphic/sw_ndgrf.cxx
new file mode 100644
index 000000000000..5ddf5ba79a9d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/graphic/sw_ndgrf.cxx
@@ -0,0 +1,924 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hintids.hxx>
+
+#include <vcl/salbtype.hxx> // FRound
+#include <tools/urlobj.hxx>
+#include <bf_svtools/undo.hxx>
+#include <bf_svtools/fstathelper.hxx>
+#include <bf_svtools/imap.hxx>
+#include <bf_svtools/filter.hxx>
+#include <bf_so3/svstor.hxx>
+#include <bf_sfx2/docinf.hxx>
+#include <bf_svx/linkmgr.hxx>
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/impgrf.hxx>
+#include <sot/formats.hxx>
+
+#include <fmtfsize.hxx>
+#include <fmturl.hxx>
+#include <frmfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <frmatr.hxx>
+#include <grfatr.hxx>
+#include <swtypes.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndgrf.hxx>
+#include <fmtcol.hxx>
+#include <hints.hxx>
+#include <sw3io.hxx>
+#include <swbaslnk.hxx>
+#include <pagefrm.hxx>
+#include <viscrs.hxx>
+#include <editsh.hxx>
+#include <pam.hxx>
+namespace binfilter {
+
+// --------------------
+// SwGrfNode
+// --------------------
+/*N*/ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
+/*N*/ const String& rGrfName, const String& rFltName,
+/*N*/ const Graphic* pGraphic,
+/*N*/ SwGrfFmtColl *pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ : SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr )
+/*N*/ {
+/*N*/ aGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
+/*N*/ bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf =
+/*N*/ bFrameInPaint = bScaleImageMap = FALSE;
+/*N*/ bGrafikArrived = TRUE;
+/*N*/ ReRead( rGrfName, rFltName, pGraphic, 0, FALSE );
+/*N*/ }
+
+/*N*/ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
+/*N*/ const BfGraphicObject& rGrfObj,
+/*N*/ SwGrfFmtColl *pGrfColl, SwAttrSet* pAutoAttr )
+/*N*/ : SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr )
+/*N*/ {
+/*N*/ aGrfObj = rGrfObj;
+/*N*/ aGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
+/*N*/ if( rGrfObj.HasUserData() && rGrfObj.IsSwappedOut() )
+/*?*/ aGrfObj.SetSwapState();
+/*N*/ bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel= bLoadLowResGrf =
+/*N*/ bFrameInPaint = bScaleImageMap = FALSE;
+/*N*/ bGrafikArrived = TRUE;
+/*N*/ }
+
+// Konstruktor fuer den SW/G-Reader. Dieser ctor wird verwendet,
+// wenn eine gelinkte Grafik gelesen wird. Sie liest diese NICHT ein.
+
+
+/*N*/ SwGrfNode::SwGrfNode( const SwNodeIndex & rWhere,
+/*N*/ const String& rGrfName, const String& rFltName,
+/*N*/ SwGrfFmtColl *pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ : SwNoTxtNode( rWhere, ND_GRFNODE, pGrfColl, pAutoAttr )
+/*N*/ {
+/*N*/ aGrfObj.SetSwapStreamHdl( LINK( this, SwGrfNode, SwapGraphic ) );
+/*N*/
+/*N*/ Graphic aGrf; aGrf.SetDefaultType();
+/*N*/ aGrfObj.SetGraphic( aGrf, rGrfName );
+/*N*/
+/*N*/ bInSwapIn = bChgTwipSize = bChgTwipSizeFromPixel = bLoadLowResGrf =
+/*N*/ bFrameInPaint = bScaleImageMap = FALSE;
+/*N*/ bGrafikArrived = TRUE;
+/*N*/
+/*N*/ InsertLink( rGrfName, rFltName );
+/*N*/ if( IsLinkedFile() )
+/*N*/ {
+/*N*/ INetURLObject aUrl( rGrfName );
+/*N*/ if( INET_PROT_FILE == aUrl.GetProtocol() &&
+/*N*/ ::binfilter::IsDocument( aUrl.GetMainURL( INetURLObject::NO_DECODE ) ))
+/*N*/ {
+/*N*/ // File vorhanden, Verbindung herstellen ohne ein Update
+/*N*/ ((SwBaseLink*)&refLink)->Connect();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+// erneutes Einlesen, falls Graphic nicht Ok ist. Die
+// aktuelle wird durch die neue ersetzt.
+
+/*N*/ BOOL SwGrfNode::ReRead( const String& rGrfName, const String& rFltName,
+/*N*/ const Graphic* pGraphic, const BfGraphicObject* pGrfObj,
+/*N*/ BOOL bNewGrf )
+/*N*/ {
+/*N*/ BOOL bReadGrf = FALSE, bSetTwipSize = TRUE;
+/*N*/
+/*N*/ ASSERT( pGraphic || pGrfObj || rGrfName.Len(),
+/*N*/ "GraphicNode without a name, Graphic or GraphicObject" );
+/*N*/
+/*N*/ // ReadRead mit Namen
+/*N*/ if( refLink.Is() )
+/*N*/ {
+/*?*/ ASSERT( !bInSwapIn, "ReRead: stehe noch im SwapIn" );
+/*?*/ if( rGrfName.Len() )
+/*?*/ {
+/*?*/ // Besonderheit: steht im FltNamen DDE, handelt es sich um eine
+/*?*/ // DDE-gelinkte Grafik
+/*?*/ String sCmd( rGrfName );
+/*?*/ if( rFltName.Len() )
+/*?*/ {
+/*?*/ USHORT nNewType;
+/*?*/ if( rFltName.EqualsAscii( "DDE" ))
+/*?*/ nNewType = OBJECT_CLIENT_DDE;
+/*?*/ else
+/*?*/ {
+/*?*/ ::binfilter::MakeLnkName( sCmd, 0, rGrfName, aEmptyStr, &rFltName );
+/*?*/ nNewType = OBJECT_CLIENT_GRF;
+/*?*/ }
+/*?*/
+/*?*/ if( nNewType != refLink->GetObjType() )
+/*?*/ {
+/*?*/ refLink->Disconnect();
+/*?*/ ((SwBaseLink*)&refLink)->SetObjType( nNewType );
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ refLink->SetLinkSourceName( sCmd );
+/*?*/ }
+/*?*/ else // kein Name mehr, Link aufheben
+/*?*/ {
+/*?*/ GetDoc()->GetLinkManager().Remove( refLink );
+/*?*/ refLink.Clear();
+/*?*/ }
+/*?*/
+/*?*/ if( pGraphic )
+/*?*/ {
+/*?*/ aGrfObj.SetGraphic( *pGraphic, rGrfName );
+/*?*/ bReadGrf = TRUE;
+/*?*/ }
+/*?*/ else if( pGrfObj )
+/*?*/ {
+/*?*/ aGrfObj = *pGrfObj;
+/*?*/ if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
+/*?*/ aGrfObj.SetSwapState();
+/*?*/ aGrfObj.SetLink( rGrfName );
+/*?*/ bReadGrf = TRUE;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // MIB 25.02.97: Daten der alten Grafik zuruecksetzen, damit
+/*?*/ // die korrekte Ersatz-Darstellung erscheint, wenn die
+/*?*/ // der neue Link nicht geladen werden konnte.
+/*?*/ Graphic aGrf; aGrf.SetDefaultType();
+/*?*/ aGrfObj.SetGraphic( aGrf, rGrfName );
+/*?*/
+/*?*/ if( refLink.Is() )
+/*?*/ {
+/*?*/ if( GetFrm() )
+/*?*/ {
+/*?*/ SwMsgPoolItem aMsgHint( RES_GRF_REREAD_AND_INCACHE );
+/*?*/ Modify( &aMsgHint, &aMsgHint );
+/*?*/ }
+/*?*/ else
+/*?*/ ((SwBaseLink*)&refLink)->SwapIn();
+/*?*/ }
+/*?*/ bSetTwipSize = FALSE;
+/*?*/ }
+/*N*/ }
+/*N*/ else if( pGraphic && !rGrfName.Len() )
+/*N*/ {
+/*N*/ // MIB 27.02.2001: Old stream must be deleted before the new one is set.
+/*N*/ if( HasStreamName() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ DelStreamName();
+/*N*/
+/*N*/ aGrfObj.SetGraphic( *pGraphic );
+/*N*/ bReadGrf = TRUE;
+/*N*/ }
+/*N*/ else if( pGrfObj && !rGrfName.Len() )
+/*N*/ {
+/*N*/ // MIB 27.02.2001: Old stream must be deleted before the new one is set.
+/*?*/ if( HasStreamName() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ DelStreamName();
+/*?*/
+/*?*/ aGrfObj = *pGrfObj;
+/*?*/ if( pGrfObj->HasUserData() && pGrfObj->IsSwappedOut() )
+/*?*/ aGrfObj.SetSwapState();
+/*?*/ bReadGrf = TRUE;
+/*N*/ }
+/*N*/ // Import einer Grafik:
+/*N*/ // Ist die Grafik bereits geladen?
+/*N*/ else if( !bNewGrf && GRAPHIC_NONE != aGrfObj.GetType() )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ else
+/*N*/ {
+/*N*/ if( HasStreamName() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ DelStreamName();
+/*N*/
+/*N*/ // einen neuen Grafik-Link anlegen
+/*N*/ InsertLink( rGrfName, rFltName );
+/*N*/
+/*N*/ if( GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ if( pGraphic )
+/*N*/ {
+/*N*/ aGrfObj.SetGraphic( *pGraphic, rGrfName );
+/*N*/ bReadGrf = TRUE;
+/*N*/ // Verbindung herstellen ohne ein Update; Grafik haben wir!
+/*N*/ ((SwBaseLink*)&refLink)->Connect();
+/*N*/ }
+/*N*/ else if( pGrfObj )
+/*N*/ {
+/*?*/ aGrfObj = *pGrfObj;
+/*?*/ aGrfObj.SetLink( rGrfName );
+/*?*/ bReadGrf = TRUE;
+/*?*/ // Verbindung herstellen ohne ein Update; Grafik haben wir!
+/*?*/ ((SwBaseLink*)&refLink)->Connect();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // MIB 25.02.97: Daten der alten Grafik zuruecksetzen, damit
+/*N*/ // die korrekte Ersatz-Darstellung erscheint, wenn die
+/*N*/ // der neue Kink nicht geladen werden konnte.
+/*N*/ Graphic aGrf; aGrf.SetDefaultType();
+/*N*/ aGrfObj.SetGraphic( aGrf, rGrfName );
+/*N*/ ((SwBaseLink*)&refLink)->SwapIn();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Bug 39281: Size nicht sofort loeschen - Events auf ImageMaps
+/*N*/ // sollten nicht beim Austauschen nicht ins "leere greifen"
+/*N*/ if( bSetTwipSize )
+/*N*/ SetTwipSize( ::binfilter::GetGraphicSizeTwip( aGrfObj.GetGraphic(), 0 ) );
+/*N*/
+/*N*/ // erzeuge noch einen Update auf die Frames
+/*N*/ if( bReadGrf && bNewGrf )
+/*N*/ {
+/*?*/ SwMsgPoolItem aMsgHint( RES_UPDATE_ATTR );
+/*?*/ Modify( &aMsgHint, &aMsgHint );
+/*N*/ }
+/*N*/
+/*N*/ return bReadGrf;
+/*N*/ }
+
+
+/*N*/ SwGrfNode::~SwGrfNode()
+/*N*/ {
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ if( refLink.Is() )
+/*N*/ {
+/*N*/ ASSERT( !bInSwapIn, "DTOR: stehe noch im SwapIn" );
+/*N*/ pDoc->GetLinkManager().Remove( refLink );
+/*N*/ refLink->Disconnect();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pDoc->IsInDtor() && HasStreamName() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ DelStreamName();
+/*N*/ }
+/*N*/ //#39289# Die Frames muessen hier bereits geloescht weil der DTor der
+/*N*/ //Frms die Grafik noch fuer StopAnimation braucht.
+/*N*/ if( GetDepends() )
+/*?*/ DelFrms();
+/*N*/ }
+
+
+/*N*/ SwCntntNode *SwGrfNode::SplitNode( const SwPosition &rPos )
+/*N*/ {
+/*?*/ return this;
+/*N*/ }
+
+
+/*N*/ SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
+/*N*/ const String& rGrfName,
+/*N*/ const String& rFltName,
+/*N*/ const Graphic* pGraphic,
+/*N*/ SwGrfFmtColl* pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr,
+/*N*/ BOOL bDelayed )
+/*N*/ {
+/*N*/ ASSERT( pGrfColl, "MakeGrfNode: Formatpointer ist 0." );
+/*N*/ SwGrfNode *pNode;
+/*N*/ // Delayed erzeugen nur aus dem SW/G-Reader
+/*N*/ if( bDelayed )
+/*N*/ pNode = new SwGrfNode( rWhere, rGrfName,
+/*N*/ rFltName, pGrfColl, pAutoAttr );
+/*N*/ else
+/*N*/ pNode = new SwGrfNode( rWhere, rGrfName,
+/*N*/ rFltName, pGraphic, pGrfColl, pAutoAttr );
+/*N*/ return pNode;
+/*N*/ }
+
+/*N*/ SwGrfNode * SwNodes::MakeGrfNode( const SwNodeIndex & rWhere,
+/*N*/ const BfGraphicObject& rGrfObj,
+/*N*/ SwGrfFmtColl* pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ {
+/*N*/ ASSERT( pGrfColl, "MakeGrfNode: Formatpointer ist 0." );
+/*N*/ return new SwGrfNode( rWhere, rGrfObj, pGrfColl, pAutoAttr );
+/*N*/ }
+
+
+/*N*/ Size SwGrfNode::GetTwipSize() const
+/*N*/ {
+/*N*/ return nGrfSize;
+/*N*/ }
+
+
+
+
+// Returnwert:
+// -1 : ReRead erfolgreich
+// 0 : nicht geladen
+// 1 : Einlesen erfolgreich
+
+short SwGrfNode::SwapIn( BOOL bWaitForData )
+{
+ if( bInSwapIn ) // nicht rekuriv!!
+ return !aGrfObj.IsSwappedOut();
+
+ short nRet = 0;
+ bInSwapIn = TRUE;
+ SwBaseLink* pLink = (SwBaseLink*)(::binfilter::SvBaseLink*) refLink;
+ if( pLink )
+ {
+ if( GRAPHIC_NONE == aGrfObj.GetType() ||
+ GRAPHIC_DEFAULT == aGrfObj.GetType() )
+ {
+ // noch nicht geladener Link
+ if( pLink->SwapIn( bWaitForData ) )
+ nRet = -1;
+ else if( GRAPHIC_DEFAULT == aGrfObj.GetType() )
+ {
+ // keine default Bitmap mehr, also neu Painten!
+ aGrfObj.SetGraphic( Graphic() );
+ SwMsgPoolItem aMsgHint( RES_GRAPHIC_PIECE_ARRIVED );
+ Modify( &aMsgHint, &aMsgHint );
+ }
+ }
+ else if( aGrfObj.IsSwappedOut() )
+ // nachzuladender Link
+ nRet = pLink->SwapIn( bWaitForData ) ? 1 : 0;
+ else
+ nRet = 1;
+ }
+ else if( aGrfObj.IsSwappedOut() )
+ {
+ // Die Grafik ist im Storage oder im TempFile drin
+ if( !HasStreamName() )
+ nRet = (short)aGrfObj.SwapIn();
+ else
+ {
+ SvStorageRef refRoot = GetDoc()->GetDocStorage();
+ ASSERT( refRoot.Is(), "Kein Storage am Doc" );
+ if( refRoot.Is() )
+ {
+ String aStrmName, aPicStgName;
+ BOOL bGraphic = GetStreamStorageNames( aStrmName, aPicStgName );
+ SvStorageRef refPics = aPicStgName.Len()
+ ? refRoot->OpenStorage( aPicStgName,
+ STREAM_READ | STREAM_SHARE_DENYWRITE )
+ : &refRoot;
+ if( refPics->GetError() == SVSTREAM_OK )
+ {
+ SvStorageStreamRef refStrm =
+ refPics->OpenStream( aStrmName,
+ STREAM_READ | STREAM_SHARE_DENYWRITE );
+ if( refStrm->GetError() == SVSTREAM_OK )
+ {
+ refStrm->SetVersion( refRoot->GetVersion() );
+ if( bGraphic ? aGrfObj.SwapIn( refStrm )
+ : ImportGraphic( *refStrm ) )
+ nRet = 1;
+ }
+ }
+ }
+ }
+ if( 1 == nRet )
+ {
+ SwMsgPoolItem aMsg( RES_GRAPHIC_SWAPIN );
+ SwCntntNode::Modify( &aMsg, &aMsg );
+ }
+ }
+ else
+ nRet = 1;
+ DBG_ASSERTWARNING( nRet, "Grafik kann nicht eingeswapt werden" );
+
+ if( nRet )
+ {
+ if( !nGrfSize.Width() && !nGrfSize.Height() )
+ SetTwipSize( ::binfilter::GetGraphicSizeTwip( aGrfObj.GetGraphic(), 0 ) );
+ }
+ bInSwapIn = FALSE;
+ return nRet;
+}
+
+
+
+// Wird nach einem SaveAs aufgerufen und setzt die StreamNamen um
+
+
+/*N*/ void SwGrfNode::SaveCompleted( BOOL bClear )
+/*N*/ {
+/*N*/ if( aNewStrmName.Len() )
+/*N*/ {
+/*N*/ if( !bClear ) // der Name wird zum aktuellen
+/*N*/ SetStreamName( aNewStrmName );
+/*N*/ aNewStrmName.Erase();
+/*N*/ }
+/*N*/ }
+
+
+// Falls die Grafik noch nicht im Doc-Storage existiert,
+// wird sie neu geschrieben; falls sie bereits drin ist,
+// wird nicht geschrieben. Wenn der Storage nicht dem
+// Doc-Storage entspricht, wird, falls aNewStrmName nicht
+// besetzt ist, in diesem Storage unter dem angegebenen
+// Streamnamen abgelegt (SaveAs). nach einem SaveAs wird
+// vom SW3-I/O-System noch SaveCompleted() aufgerufen,
+// da nun der Doc-Storage dem neuen Storage entspricht.
+// MIB 02/28/2001: This method is called only to store graphics
+// in the 3.1 to 5.0 formats. For the 6.0 format, graphics
+// are exported using the SvXMLGraphicObjectHelper class.
+
+
+/*N*/ BOOL SwGrfNode::StoreGraphics( SvStorage* pRoot )
+/*N*/ {
+/*N*/ if( !refLink.Is() )
+/*N*/ {
+/*N*/ BOOL bGraphic = TRUE; // Does the graphic stream (if it exists)
+/*N*/ // contain a streamed graphic (TRUE) or the
+/*N*/ // raw image data only (FALSE)
+/*N*/ String aSrcStrmName, aSrcPicStgName;
+/*N*/ if( HasStreamName() )
+/*N*/ bGraphic = GetStreamStorageNames( aSrcStrmName, aSrcPicStgName );
+/*N*/ SvStorage* pDocStg = GetDoc()->GetDocStorage();
+/*N*/ if( !pRoot )
+/*N*/ pRoot = pDocStg;
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_60 > pRoot->GetVersion(),
+/*N*/ "SwGrfNode::StoreGraphic called for 6.0+ file format" );
+/*N*/
+/*N*/ String aDstPicStgName(
+/*N*/ RTL_CONSTASCII_STRINGPARAM( "EmbeddedPictures" ) );
+/*N*/ String aDstStrmName( aSrcStrmName );
+/*N*/ if( pRoot != pDocStg || !bGraphic )
+/*N*/ {
+/*N*/ // If the stream does not contain a streamed graphic object,
+/*N*/ // the graphic has to be stored again.
+/*N*/ ASSERT( pRoot != pDocStg || aSrcStrmName.Len(),
+/*N*/ "raw image data stream but no stream name" );
+/*N*/ // Neuer Storage. Wenn die Grafik im DocStg drin ist,
+/*N*/ // kann sie bequem per CopyTo() kopiert werden.
+/*N*/ if( aSrcStrmName.Len() )
+/*N*/ {
+/*N*/ SvStorageRef refSrcPics = aSrcPicStgName.Len()
+/*N*/ ? pDocStg->OpenStorage( aSrcPicStgName,
+/*N*/ STREAM_READ | STREAM_SHARE_DENYWRITE )
+/*N*/ : pDocStg;
+/*N*/
+/*N*/ SvStorageStreamRef refStrm;
+/*N*/
+/*N*/ BOOL bWriteNew = pDocStg->GetVersion() != pRoot->GetVersion() ||
+/*N*/ !bGraphic;
+/*N*/ if( !bWriteNew &&
+/*N*/ SOFFICE_FILEFORMAT_40 <= pRoot->GetVersion() )
+/*N*/ {
+/*N*/ refStrm = refSrcPics->OpenStream( aSrcStrmName,
+/*N*/ STREAM_READ | STREAM_SHARE_DENYWRITE );
+/*N*/ if( SVSTREAM_OK == refStrm->GetError() )
+/*N*/ {
+/*N*/ // JP 21.06.98: pruefe ob der CompressMode uebereinstimmt
+/*N*/ USHORT nCmprsMode =
+/*N*/ Graphic::GetGraphicsCompressMode(*refStrm ) &
+/*N*/ ~(COMPRESSMODE_ZBITMAP|COMPRESSMODE_NATIVE );
+/*N*/ USHORT nNewCmprsMode = 0;
+/*N*/ if( GRAPHIC_BITMAP == aGrfObj.GetType() &&
+/*N*/ GetDoc()->GetInfo()->IsSaveGraphicsCompressed() )
+/*N*/ nNewCmprsMode |= COMPRESSMODE_ZBITMAP;
+/*N*/ if( SOFFICE_FILEFORMAT_40 < pRoot->GetVersion() &&
+/*N*/ GetDoc()->GetInfo()->IsSaveOriginalGraphics() )
+/*N*/ nNewCmprsMode |= COMPRESSMODE_NATIVE;
+/*N*/
+/*N*/ if( nCmprsMode != nNewCmprsMode )
+/*N*/ {
+/*N*/ // der Kompressedmode stimmt nicht, also muss
+/*N*/ // ggfs. die Grafik reingeswappt und ueber den
+/*N*/ // unteren Teil neu geschrieben werden.
+/*N*/ bWriteNew = TRUE;
+/*N*/ refStrm->Seek( STREAM_SEEK_TO_BEGIN );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bWriteNew )
+/*N*/ {
+/*N*/ if( aGrfObj.IsSwappedOut() &&
+/*N*/ SVSTREAM_OK == refSrcPics->GetError() )
+/*N*/ {
+/*N*/ if( !refStrm.Is() )
+/*?*/ refStrm = refSrcPics->OpenStream( aSrcStrmName,
+/*?*/ STREAM_READ | STREAM_SHARE_DENYWRITE );
+/*N*/ if( SVSTREAM_OK == refStrm->GetError() )
+/*N*/ {
+/*N*/ refStrm->SetVersion( pDocStg->GetVersion() );
+/*N*/ if( !(bGraphic ? aGrfObj.SwapIn( refStrm )
+/*N*/ : ImportGraphic( *refStrm ) ) )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ // If the graphic is restored within the same storage,
+/*N*/ // its storage has to be removed.
+/*N*/ if( pRoot == pDocStg )
+/*N*/ {
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ refStrm.Clear();
+/*N*/ }
+/*N*/ aDstStrmName.Erase();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SvStorageRef refDstPics =
+/*N*/ pRoot->OpenStorage( aDstPicStgName,
+/*N*/ STREAM_READWRITE | STREAM_SHARE_DENYALL );
+/*N*/ if( refDstPics->IsContained( aDstStrmName ) )
+/*N*/ // nur neu erzeugen, wenn Name schon vorhanden ist!
+/*?*/ aDstStrmName = Sw3Io::UniqueName( refDstPics, "Pic" );
+/*N*/
+/*N*/ if( refSrcPics->CopyTo( aSrcStrmName, refDstPics,
+/*N*/ aDstStrmName )
+/*N*/ && refDstPics->Commit() )
+/*N*/ aNewStrmName = aDstStrmName;
+/*N*/ else
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !aDstStrmName.Len() )
+/*N*/ {
+/*N*/ ASSERT( pRoot, "Kein Storage gegeben" );
+/*N*/ if( pRoot )
+/*N*/ {
+/*N*/ SvStorageRef refPics =
+/*N*/ pRoot->OpenStorage( aDstPicStgName,
+/*N*/ STREAM_READWRITE | STREAM_SHARE_DENYALL );
+/*N*/ if( SVSTREAM_OK == refPics->GetError() )
+/*N*/ {
+/*N*/ aDstStrmName = Sw3Io::UniqueName( refPics, "Pic" );
+/*N*/ SvStorageStreamRef refStrm =
+/*N*/ refPics->OpenStream( aDstStrmName,
+/*N*/ STREAM_READWRITE | STREAM_SHARE_DENYALL );
+/*N*/ if( SVSTREAM_OK == refStrm->GetError() )
+/*N*/ {
+/*N*/ // HACK bis die Grafik als Portable markiert
+/*N*/ // werden kann!!!
+/*N*/ // Die Grafik kann in einer TempFile sein!
+/*N*/ FASTBOOL bIsSwapOut = aGrfObj.IsSwappedOut();
+/*N*/ if( bIsSwapOut && !aGrfObj.SwapIn() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ refStrm->SetVersion( pRoot->GetVersion() );
+/*N*/
+/*N*/ //JP 04.05.98: laut ChangesMail vom KA und Bug 49617
+/*N*/ //JP 21.06.98: laut ChangesMail vom KA, natives Save
+/*N*/ USHORT nComprMode = refStrm->GetCompressMode();
+/*N*/ if( SOFFICE_FILEFORMAT_40 <= refStrm->GetVersion() &&
+/*N*/ GRAPHIC_BITMAP == aGrfObj.GetType() &&
+/*N*/ GetDoc()->GetInfo()->IsSaveGraphicsCompressed() )
+/*N*/ nComprMode |= COMPRESSMODE_ZBITMAP;
+/*N*/ else
+/*N*/ nComprMode &= ~COMPRESSMODE_ZBITMAP;
+/*N*/
+/*N*/ //JP 21.06.98: laut ChangesMail vom KA, natives Save
+/*N*/ if( SOFFICE_FILEFORMAT_40 < refStrm->GetVersion() &&
+/*N*/ GetDoc()->GetInfo()->IsSaveOriginalGraphics() )
+/*N*/ nComprMode |= COMPRESSMODE_NATIVE;
+/*N*/ else
+/*N*/ nComprMode &= ~COMPRESSMODE_NATIVE;
+/*N*/ refStrm->SetCompressMode( nComprMode );
+/*N*/
+/*N*/ BOOL bRes = FALSE;
+/*N*/ if( pRoot == pDocStg )
+/*N*/ {
+/*?*/ if( aGrfObj.SwapOut( refStrm ) &&
+/*?*/ ( refStrm->Commit() | refPics->Commit()
+/*?*/ /*| pRoot->Commit()*/ ))
+/*?*/ {
+/*?*/ SetStreamName( aDstStrmName );
+/*?*/ bRes = TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ else if( ((Graphic&)aGrfObj.GetGraphic()).
+/*N*/ WriteEmbedded( *refStrm )
+/*N*/ && ( refStrm->Commit() | refPics->Commit()
+/*N*/ /*| pRoot->Commit()*/ ))
+/*N*/ {
+/*N*/ if( bIsSwapOut )
+/*?*/ aGrfObj.SwapOut();
+/*N*/ aNewStrmName = aDstStrmName;
+/*N*/ bRes = TRUE;
+/*N*/ }
+/*N*/ return bRes;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Da fehlte doch was?
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ // Schon drin im Storage oder Linked
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ BOOL SwGrfNode::GetFileFilterNms( String* pFileNm, String* pFilterNm ) const
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if( refLink.Is() && refLink->GetLinkManager() )
+/*N*/ {
+/*N*/ USHORT nType = refLink->GetObjType();
+/*N*/ if( OBJECT_CLIENT_GRF == nType )
+/*N*/ bRet = refLink->GetLinkManager()->GetDisplayNames(
+/*N*/ refLink, 0, pFileNm, 0, pFilterNm );
+/*N*/ else if( OBJECT_CLIENT_DDE == nType && pFileNm && pFilterNm )
+/*N*/ {
+/*?*/ String sApp, sTopic, sItem;
+/*?*/ if( refLink->GetLinkManager()->GetDisplayNames(
+/*?*/ refLink, &sApp, &sTopic, &sItem ) )
+/*?*/ {
+/*?*/ ( *pFileNm = sApp ) += ::binfilter::cTokenSeperator;
+/*?*/ ( *pFileNm += sTopic ) += ::binfilter::cTokenSeperator;
+/*?*/ *pFileNm += sItem;
+/*?*/ pFilterNm->AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDE" ));
+/*?*/ bRet = TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ String SwGrfNode::GetStreamName() const
+/*N*/ {
+/*N*/ if( aNewStrmName.Len() )
+/*N*/ return aNewStrmName;
+/*N*/ return aGrfObj.GetUserData();
+/*N*/ }
+
+// Eine Grafik Undo-faehig machen. Falls sie sich bereits in
+// einem Storage befindet, muss sie geladen werden.
+
+
+
+
+
+/*N*/ void SwGrfNode::InsertLink( const String& rGrfName, const String& rFltName )
+/*N*/ {
+/*N*/ refLink = new SwBaseLink( ::binfilter::LINKUPDATE_ONCALL, FORMAT_GDIMETAFILE, this );
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ if( GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ refLink->SetVisible( pDoc->IsVisibleLinks() );
+/*N*/ if( rFltName.EqualsAscii( "DDE" ))
+/*N*/ {
+/*?*/ USHORT nTmp = 0;
+/*?*/ String sApp, sTopic, sItem;
+/*?*/ sApp = rGrfName.GetToken( 0, ::binfilter::cTokenSeperator, nTmp );
+/*?*/ sTopic = rGrfName.GetToken( 0, ::binfilter::cTokenSeperator, nTmp );
+/*?*/ sItem = rGrfName.Copy( nTmp );
+/*?*/ pDoc->GetLinkManager().InsertDDELink( refLink,
+/*N*/ sApp, sTopic, sItem );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bSync = rFltName.EqualsAscii( "SYNCHRON" );
+/*N*/ refLink->SetSynchron( bSync );
+/*N*/ refLink->SetContentType( SOT_FORMATSTR_ID_SVXB );
+/*N*/
+/*N*/ pDoc->GetLinkManager().InsertFileLink( *refLink,
+/*N*/ OBJECT_CLIENT_GRF, rGrfName,
+/*N*/ (!bSync && rFltName.Len() ? &rFltName : 0) );
+/*N*/ }
+/*N*/ }
+/*N*/ aGrfObj.SetLink( rGrfName );
+/*N*/ }
+
+
+
+
+/*N*/ void SwGrfNode::SetTwipSize( const Size& rSz )
+/*N*/ {
+/*N*/ nGrfSize = rSz;
+/*N*/ if( IsScaleImageMap() && nGrfSize.Width() && nGrfSize.Height() )
+/*N*/ {
+/*N*/ // Image-Map an Grafik-Groesse anpassen
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ ScaleImageMap();
+/*N*/ }
+/*N*/ }
+
+ // Prioritaet beim Laden der Grafik setzen. Geht nur, wenn der Link
+ // ein FileObject gesetzt hat
+
+
+
+
+
+/*N*/ BOOL SwGrfNode::GetStreamStorageNames( String& rStrmName,
+/*N*/ String& rStorName ) const
+/*N*/ {
+/*N*/ BOOL bGraphic = FALSE;
+/*N*/ rStorName.Erase();
+/*N*/ rStrmName.Erase();
+/*N*/
+/*N*/ String aUserData( aGrfObj.GetUserData() );
+/*N*/ if( !aUserData.Len() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ String aProt( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.Package:" ) );
+/*N*/ if( 0 == aUserData.CompareTo( aProt, aProt.Len() ) )
+/*N*/ {
+/*N*/ // 6.0 (XML) Package
+/*?*/ xub_StrLen nPos = aUserData.Search( '/' );
+/*?*/ if( STRING_NOTFOUND == nPos )
+/*?*/ {
+/*?*/ rStrmName = aUserData.Copy( aProt.Len() );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ rStorName = aUserData.Copy( aProt.Len(), nPos-aProt.Len() );
+/*?*/ rStrmName = aUserData.Copy( nPos+1 );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // 3.1 - 5.2
+/*N*/ rStorName = String( RTL_CONSTASCII_STRINGPARAM( "EmbeddedPictures" ) );
+/*N*/ rStrmName = aUserData;
+/*N*/ bGraphic = TRUE;
+/*N*/ }
+/*N*/ ASSERT( STRING_NOTFOUND == rStrmName.Search( '/' ),
+/*N*/ "invalid graphic stream name" );
+/*N*/
+/*N*/ return bGraphic;
+/*N*/ }
+
+/*N*/ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+/*N*/ {
+/*N*/ // kopiere die Formate in das andere Dokument:
+/*N*/ SwGrfFmtColl* pColl = pDoc->CopyGrfColl( *GetGrfColl() );
+/*N*/
+/*N*/ SwGrfNode* pThis = (SwGrfNode*)this;
+/*N*/
+/*N*/ Graphic aTmpGrf;
+/*N*/ SwBaseLink* pLink = (SwBaseLink*)(::binfilter::SvBaseLink*) refLink;
+/*N*/ if( !pLink && HasStreamName() )
+/*N*/ {
+/*?*/ SvStorageRef refRoot = pThis->GetDoc()->GetDocStorage();
+/*?*/ ASSERT( refRoot.Is(), "Kein Storage am Doc" );
+/*?*/ if( refRoot.Is() )
+/*?*/ {
+/*?*/ String aStrmName, aPicStgName;
+/*?*/ BOOL bGraphic = GetStreamStorageNames( aStrmName, aPicStgName );
+/*?*/ SvStorageRef refPics = aPicStgName.Len()
+/*?*/ ? refRoot->OpenStorage( aPicStgName,
+/*?*/ STREAM_READ | STREAM_SHARE_DENYWRITE )
+/*?*/ : &refRoot;
+/*?*/ if( refPics->GetError() == SVSTREAM_OK )
+/*?*/ {
+/*?*/ SvStorageStreamRef refStrm = refPics->OpenStream( aStrmName,
+/*?*/ STREAM_READ | STREAM_SHARE_DENYWRITE );
+/*?*/ if( refStrm->GetError() == SVSTREAM_OK )
+/*?*/ {
+/*?*/ refStrm->SetVersion( refRoot->GetVersion() );
+/*?*/ if( bGraphic )
+/*?*/ aTmpGrf.SwapIn( refStrm );
+/*?*/ else
+/*?*/ GetGrfFilter()->ImportGraphic( aTmpGrf, String(),
+/*?*/ *refStrm );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( aGrfObj.IsSwappedOut() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pThis->SwapIn();
+/*N*/ aTmpGrf = aGrfObj.GetGraphic();
+/*N*/ }
+/*N*/
+/*N*/ const ::binfilter::SvLinkManager& rMgr = GetDoc()->GetLinkManager();
+/*N*/ String sFile, sFilter;
+/*N*/ if( IsLinkedFile() )
+/*N*/ rMgr.GetDisplayNames( refLink, 0, &sFile, 0, &sFilter );
+/*N*/ else if( IsLinkedDDE() )
+/*N*/ {
+/*?*/ String sTmp1, sTmp2;
+/*?*/ rMgr.GetDisplayNames( refLink, &sTmp1, &sTmp2, &sFilter );
+/*?*/ ::binfilter::MakeLnkName( sFile, &sTmp1, sTmp2, sFilter );
+/*?*/ sFilter.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDE" ));
+/*N*/ }
+/*N*/
+/*N*/ SwGrfNode* pGrfNd = pDoc->GetNodes().MakeGrfNode( rIdx, sFile, sFilter,
+/*N*/ &aTmpGrf, pColl,
+/*N*/ (SwAttrSet*)GetpSwAttrSet() );
+/*N*/ pGrfNd->SetAlternateText( GetAlternateText() );
+/*N*/ pGrfNd->SetContour( HasContour(), HasAutomaticContour() );
+/*N*/ return pGrfNd;
+/*N*/ }
+
+/*M*/ IMPL_LINK( SwGrfNode, SwapGraphic, BfGraphicObject*, pGrfObj )
+/*M*/ {
+/*M*/ SvStream* pRet = NULL;
+/*M*/
+/*M*/ // #101174#: Keep graphic while in swap in. That's at least important
+/*M*/ // when breaking links, because in this situation a reschedule call and
+/*M*/ // a DataChanged call lead to a paint of the graphic.
+/*M*/ if( pGrfObj->IsInSwapOut() && (IsSelected() || bInSwapIn) )
+/*M*/ pRet = GRFMGR_AUTOSWAPSTREAM_NONE;
+/*M*/ else if( refLink.Is() )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
+/*M*/
+/*M*/ if( HasStreamName() )
+/*M*/ {
+/*M*/ SvStorageRef refRoot = GetDoc()->GetDocStorage();
+/*M*/ ASSERT( refRoot.Is(), "Kein Storage am Doc" );
+/*M*/ if( refRoot.Is() )
+/*M*/ {
+/*M*/ String aStrmName, aPicStgName;
+/*M*/ BOOL bGraphic = GetStreamStorageNames( aStrmName, aPicStgName );
+/*M*/ SvStorageRef refPics = aPicStgName.Len()
+/*M*/ ? refRoot->OpenStorage( aPicStgName,
+/*M*/ STREAM_READ | STREAM_SHARE_DENYWRITE )
+/*M*/ : &refRoot;
+/*M*/ if( refPics->GetError() == SVSTREAM_OK )
+/*M*/ {
+/*M*/ SvStream* pTmp = refPics->OpenStream( aStrmName,
+/*M*/ STREAM_READ | STREAM_SHARE_DENYWRITE );
+/*M*/ BOOL bDelStrm = TRUE;
+/*M*/ if( pTmp->GetError() == SVSTREAM_OK )
+/*M*/ {
+/*M*/ if( pGrfObj->IsInSwapOut() )
+/*M*/ pRet = GRFMGR_AUTOSWAPSTREAM_LINK;
+/*M*/ else
+/*M*/ {
+/*M*/ if( bGraphic )
+/*M*/ {
+/*M*/ pRet = pTmp;
+/*M*/ bDelStrm = FALSE;
+/*M*/ pRet->SetVersion( refRoot->GetVersion() );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ ImportGraphic( *pTmp );
+/*M*/ pRet = GRFMGR_AUTOSWAPSTREAM_LOADED;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ if( bDelStrm )
+/*M*/ delete pTmp;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ return (long)pRet;
+/*M*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/GetMetricVal.hxx b/binfilter/bf_sw/source/core/inc/GetMetricVal.hxx
new file mode 100644
index 000000000000..757d0dd4bf68
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/GetMetricVal.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GETMETRICVAL_HXX
+#define _GETMETRICVAL_HXX
+namespace binfilter {
+
+#define CM_1 0 // 1 centimeter or 1/2 inch
+#define CM_05 1 // 0.5 centimeter or 1/4 inch
+#define CM_01 2 // 0.1 centimeter or 1/20 inch
+
+inline USHORT GetMetricVal( int n )
+{
+#ifdef USE_MEASUREMENT
+ USHORT nVal = MEASURE_METRIC == GetAppLocaleData().getMeasurementSystemEnum()
+ ? 567 // 1 cm
+ : 770; // 1/2 Inch
+#else
+ USHORT nVal = 567; // 1 cm
+#endif
+
+ if( CM_01 == n )
+ nVal /= 10;
+ else if( CM_05 == n )
+ nVal /= 2;
+ return nVal;
+}
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/SwPortionHandler.hxx b/binfilter/bf_sw/source/core/inc/SwPortionHandler.hxx
new file mode 100644
index 000000000000..53addf249c4a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/SwPortionHandler.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_PORTIONHANDLER_HXX
+#define _SW_PORTIONHANDLER_HXX
+
+#include <tools/solar.h>
+class String;
+namespace binfilter {
+
+
+/** The SwPortionHandler interface implements a visitor for the layout
+ * engine's text portions. This can be used to gather information of
+ * the on-screen representation of a single paragraph.
+ *
+ * For each text portion, one of the methods text(...) or special(...)
+ * is called, depending on whether it is a 'normal' run of text, or
+ * any other portion. Additionally, the linebreak() method is called
+ * once at the end of every on-screen line.
+ *
+ * All parameters relate to the 'model string', which is the text string
+ * held by the corresponding SwTxtNode.
+ *
+ * The SwPortionHandler can be used with the
+ * SwTextFrame::VisitPortions(...) method.
+ */
+class SwPortionHandler
+{
+public:
+
+ SwPortionHandler() {} /// (emtpy) constructor
+
+ virtual ~SwPortionHandler() {} /// (empty) destructor
+
+ /** text portion. A run of nLength characters from the model
+ * string, that contains no special characters like embedded
+ * fields, etc. Thus, the on-screen text of this portion
+ * corresponds exactly to the corresponding characters in the
+ * model string.
+ */
+ virtual void Text(
+ USHORT nLength, /// length of this portion in the model string
+ USHORT nType /// type of this portion
+ ) = 0;
+
+ /** special portion. This method is called for every non-text
+ * portion. The parameters describe the length of the
+ * corresponding characters in the model string (often 0 or 1),
+ * the text which is displayed, and the type of the portion.
+ */
+ virtual void Special(
+ USHORT nLength, /// length of this portion in the model string
+ const String& rText, /// text which is painted on-screen
+ USHORT nType /// type of this portion
+ ) = 0;
+
+ /** line break. This method is called whenever a line break in the
+ * layout occurs.
+ */
+ virtual void LineBreak() = 0;
+
+ /** skip characters. The SwTxtFrame may only display partially
+ * display a certain paragraph (e.g. when the paragaph is split
+ * across multiple pages). In this case, the Skip() method must be
+ * called to inform the portion handler to ignore a certain run of
+ * characters in the 'model string'. Skip(), if used at all, must
+ * be called before any of the other methods is called. Calling
+ * Skip() between portions is not allowed.
+ */
+ virtual void Skip(
+ USHORT nLength /// number of 'model string' characters to be skipped
+ ) = 0;
+
+ /** end of paragraph. This method is to be called when all the
+ * paragraph's portions have been processed.
+ */
+ virtual void Finish() = 0;
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/SwXTextDefaults.hxx b/binfilter/bf_sw/source/core/inc/SwXTextDefaults.hxx
new file mode 100644
index 000000000000..2548c0ecbf16
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/SwXTextDefaults.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_XTEXT_DEFAULTS_HXX
+#define _SW_XTEXT_DEFAULTS_HXX
+
+#include <cppuhelper/implbase3.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <doc.hxx>
+#include <bf_svtools/itemprop.hxx>
+namespace binfilter {
+
+class SwXTextDefaults : public cppu::WeakImplHelper3
+ <
+ ::com::sun::star::beans::XPropertyState,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+ SfxItemPropertySet aPropSet;
+ SwDoc * pDoc;
+public:
+ SwXTextDefaults ( SwDoc * pNewDoc );
+ ~SwXTextDefaults ();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& rPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& rPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& rPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+};
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/atrhndl.hxx b/binfilter/bf_sw/source/core/inc/atrhndl.hxx
new file mode 100644
index 000000000000..27d306326dd8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/atrhndl.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ATRHNDL_HXX
+#define _ATRHNDL_HXX
+
+#define INITIAL_NUM_ATTR 4
+#define NUM_ATTRIBUTE_STACKS 37
+
+#include <txatbase.hxx>
+#include <swfntcch.hxx>
+
+namespace binfilter {
+class SfxPoolItem;
+class SwAttrSet;
+class SwDoc;
+class ViewShell;
+
+extern const BYTE StackPos[];
+
+/*************************************************************************
+ * class SwAttrHandler
+ *
+ * Used by Attribute Iterators to organize attributes on stacks to
+ * find the valid attribute in each category
+ *************************************************************************/
+
+class SwAttrHandler
+{
+private:
+
+ /*************************************************************************
+ * class SwAttrStack
+ *
+ * Container for SwTxtAttr Objects
+ *************************************************************************/
+
+ class SwAttrStack
+ {
+ private:
+ SwTxtAttr* pInitialArray[ INITIAL_NUM_ATTR ];
+ SwTxtAttr** pArray;
+ USHORT nCount; // number of elements on stack
+ USHORT nSize; // number of positions in Array
+
+ public:
+ // Ctor, Dtor
+ inline SwAttrStack();
+ inline ~SwAttrStack() {
+ if ( nSize > INITIAL_NUM_ATTR ) delete [] pArray; }
+
+ // reset stack
+ inline void Reset() { nCount = 0; };
+
+ // insert on top
+ inline void Push( const SwTxtAttr& rAttr ) { Insert( rAttr, nCount ); };
+ // insert at specified position, take care for not inserting behind
+ // the value returned by Count()
+ void Insert( const SwTxtAttr& rAttr, const USHORT nPos );
+
+ // remove specified attribute
+ void Remove( const SwTxtAttr& rAttr );
+
+ // get attribute from top if exists, otherwise 0
+ const SwTxtAttr* Top() const;
+
+ // number of elements on stack
+ inline USHORT Count() const { return nCount; };
+
+ // returns position of rAttr on Stack if found, otherwise USHRT_MAX
+ // can be used for Remove of an attribute
+ USHORT Pos( const SwTxtAttr& rAttr ) const;
+ };
+
+ SwAttrStack aAttrStack[ NUM_ATTRIBUTE_STACKS ]; // stack collection
+ const SfxPoolItem* pDefaultArray[ NUM_DEFAULT_VALUES ];
+ const SwDoc* pDoc;
+ const ViewShell* pShell;
+ sal_Bool bVertLayout;
+
+ // This is the base font for the paragraph. It is stored in order to have
+ // a template, if we have to restart the attribute evaluation
+ SwFont* pFnt;
+
+ // change font according to pool item
+ void FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPush );
+
+ // push attribute to specified stack, returns true, if attribute has
+ // been pushed on top of stack (important for stacks containing different
+ // attributes with different priority and redlining)
+ sal_Bool Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem, SwFont& rFnt );
+
+ // apply top attribute on stack to font
+ void ActivateTop( SwFont& rFnt, USHORT nStackPos );
+
+public:
+ // Ctor
+ SwAttrHandler();
+ ~SwAttrHandler();
+
+ // set default attributes to values in rAttrSet or from cache
+ void Init( const SfxPoolItem** pPoolItem, const SwAttrSet* pAttrSet,
+ const SwDoc& rDoc, const ViewShell* pShell, SwFont& rFnt,
+ sal_Bool bVertLayout );
+
+ // remove everything from internal stacks, keep default data
+ void Reset( );
+
+ // insert specified attribute and change font
+ void PushAndChg( const SwTxtAttr& rAttr, SwFont& rFnt );
+
+ // remove specified attribute and reset font
+ void PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt );
+
+ // apply script dependent attributes
+// void ChangeScript( SwFont& rFnt, const BYTE nScr );
+
+ // returns the default value for stack nStack
+ inline const SfxPoolItem& GetDefault( const USHORT nAttribID ) const;
+ // do not call these if you only used the small init function
+ inline void ResetFont( SwFont& rFnt ) const;
+ inline const SwFont* GetFont() const;
+};
+
+inline const SfxPoolItem& SwAttrHandler::GetDefault( const USHORT nAttribID ) const
+{
+ ASSERT( 0 <= nAttribID && nAttribID < RES_TXTATR_END,
+ "this attrib does not ex."
+ );
+ ASSERT( pDefaultArray[ StackPos[ nAttribID ] ], "array not initialized" );
+ return *pDefaultArray[ StackPos[ nAttribID ] ];
+}
+
+inline void SwAttrHandler::ResetFont( SwFont& rFnt ) const
+{
+ ASSERT( pFnt, "ResetFont without a font" );
+ if ( pFnt )
+ rFnt = *pFnt;
+};
+
+inline const SwFont* SwAttrHandler::GetFont() const
+{
+ return pFnt;
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/blink.hxx b/binfilter/bf_sw/source/core/inc/blink.hxx
new file mode 100644
index 000000000000..823732cc8bb6
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/blink.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _BLINK_HXX
+#define _BLINK_HXX
+
+class SwLinePortion;
+class SwRootFrm;
+class SwTxtFrm;
+
+#include <bf_svtools/svarray.hxx>
+#include <tools/gen.hxx>
+namespace binfilter {
+
+class SwBlinkPortion
+{
+ Point aPos;
+ const SwLinePortion *pPor;
+ const SwRootFrm *pFrm;
+ USHORT nDir;
+public:
+ SwBlinkPortion( const SwLinePortion* pPortion, USHORT nDirection )
+ { pPor = pPortion; nDir = nDirection; }
+ SwBlinkPortion( const SwBlinkPortion* pBlink, const SwLinePortion* pPort )
+ { pPor = pPort; pFrm = pBlink->pFrm; aPos = pBlink->aPos; nDir = pBlink->nDir; }
+ void SetPos( const Point& aNew ){ aPos = aNew; }
+ const Point& GetPos() const{ return aPos; }
+ void SetRootFrm( const SwRootFrm* pNew ){ pFrm = pNew; }
+ const SwRootFrm* GetRootFrm() const{ return pFrm; }
+ const SwLinePortion *GetPortion() const{ return pPor; }
+ USHORT GetDirection() const { return nDir; }
+ BOOL operator<( const SwBlinkPortion& rBlinkPortion ) const
+ { return (long)pPor < (long)rBlinkPortion.pPor; }
+ BOOL operator==( const SwBlinkPortion& rBlinkPortion ) const
+ { return (long)pPor == (long)rBlinkPortion.pPor; }
+};
+
+typedef SwBlinkPortion* SwBlinkPortionPtr;
+SV_DECL_PTRARR_SORT_DEL(SwBlinkList, SwBlinkPortionPtr, 0, 10)
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/bodyfrm.hxx b/binfilter/bf_sw/source/core/inc/bodyfrm.hxx
new file mode 100644
index 000000000000..05baa5fef1e0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/bodyfrm.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BODYFRM_HXX
+#define _BODYFRM_HXX
+
+#include <tools/mempool.hxx>
+
+#include "layfrm.hxx"
+namespace binfilter {
+
+class SwBorderAttrs;
+
+class SwBodyFrm: public SwLayoutFrm
+{
+protected:
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+
+#if defined ( GCC) && defined ( C272 )
+ ~SwBodyFrm();
+#endif
+public:
+ SwBodyFrm( SwFrmFmt* );
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwBodyFrm)
+};
+
+} //namespace binfilter
+#endif //_BODYFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/cellfrm.hxx b/binfilter/bf_sw/source/core/inc/cellfrm.hxx
new file mode 100644
index 000000000000..80e7a3a20b24
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/cellfrm.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CELLFRM_HXX
+#define _CELLFRM_HXX
+
+#include <tools/mempool.hxx>
+
+#include "layfrm.hxx"
+namespace binfilter {
+
+class SwTableBox;
+struct SwCrsrMoveState;
+class SwBorderAttrs;
+
+class SwCellFrm: public SwLayoutFrm
+{
+ const SwTableBox *pTabBox;
+
+protected:
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+
+public:
+ SwCellFrm( const SwTableBox & );
+ ~SwCellFrm();
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+
+ const SwTableBox *GetTabBox() const { return pTabBox; }
+ DECL_FIXEDMEMPOOL_NEWDEL(SwCellFrm)
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/cntfrm.hxx b/binfilter/bf_sw/source/core/inc/cntfrm.hxx
new file mode 100644
index 000000000000..5f595d46f109
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/cntfrm.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CNTFRM_HXX
+#define _CNTFRM_HXX
+
+#include "frame.hxx"
+#include "flowfrm.hxx"
+#include "cshtyp.hxx"
+namespace binfilter {
+
+class SwLayoutFrm;
+class SwPageFrm;
+class SwCntntNode;
+struct SwCrsrMoveState;
+class SwBorderAttrs;
+class SwAttrSetChg;
+
+//Implementiert in cntfrm.cxx, wird von cntfrm.cxx und crsrsh.cxx angezogen
+extern BOOL GetFrmInPage( const SwCntntFrm*, SwWhichPage, SwPosPage, SwPaM* );
+
+class SwCntntFrm: public SwFrm, public SwFlowFrm
+{
+ friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ); //ruft MakePrtArea
+
+ BOOL _WouldFit( SwTwips nSpace, SwLayoutFrm *pNewUpper, BOOL bTstMove );
+ virtual void MakeAll();
+
+ void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &,
+ SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
+
+ virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL& );
+
+protected:
+
+ BOOL MakePrtArea( const SwBorderAttrs & );
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+ virtual SwTwips ShrinkFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual SwTwips GrowFrm ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+
+ SwCntntFrm( SwCntntNode * const );
+
+public:
+ virtual ~SwCntntFrm();
+ TYPEINFO(); //bereits in Basisklassen drin
+
+ virtual void Cut();
+ virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
+
+ inline SwCntntNode *GetNode();
+ inline const SwCntntNode *GetNode() const;
+ USHORT GetSectionLevel();
+
+ inline const SwCntntFrm *GetFollow() const;
+ inline SwCntntFrm *GetFollow();
+
+ //Layoutabhaengiges Cursortravelling
+ inline BOOL StartNextPage( SwPaM * ) const;
+ inline BOOL StartPrevPage( SwPaM * ) const;
+ inline BOOL StartCurrPage( SwPaM * ) const;
+ inline BOOL EndCurrPage( SwPaM * ) const;
+ inline BOOL EndNextPage( SwPaM * ) const;
+ inline BOOL EndPrevPage( SwPaM * ) const;
+
+ //nMaxHeight liefert die benoetigte Hoehe,
+ //bSplit sagt, obj der Absatz gesplittet werden muss.
+ virtual BOOL WouldFit( SwTwips &nMaxHeight, BOOL &bSplit );
+
+};
+
+inline SwCntntNode *SwCntntFrm::GetNode()
+{
+ return (SwCntntNode*)GetDep();
+}
+inline const SwCntntNode *SwCntntFrm::GetNode() const
+{
+ return (SwCntntNode*)GetDep();
+}
+
+inline const SwCntntFrm *SwCntntFrm::GetFollow() const
+{
+ return (const SwCntntFrm*)SwFlowFrm::GetFollow();
+}
+inline SwCntntFrm *SwCntntFrm::GetFollow()
+{
+ return (SwCntntFrm*)SwFlowFrm::GetFollow();
+}
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/colfrm.hxx b/binfilter/bf_sw/source/core/inc/colfrm.hxx
new file mode 100644
index 000000000000..b5baeeed4118
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/colfrm.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _COLFRM_HXX
+#define _COLFRM_HXX
+
+#include <tools/mempool.hxx>
+
+#include "ftnboss.hxx"
+namespace binfilter {
+
+
+class SwColumnFrm: public SwFtnBossFrm
+{
+public:
+ SwColumnFrm( SwFrmFmt* );
+ ~SwColumnFrm();
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwColumnFrm)
+};
+
+} //namespace binfilter
+#endif //_COLFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/dbg_lay.hxx b/binfilter/bf_sw/source/core/inc/dbg_lay.hxx
new file mode 100644
index 000000000000..92a463d933e7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/dbg_lay.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DBG_LAY_HXX
+#define _DBG_LAY_HXX
+
+
+#define PROT_FILE_INIT 0x00000000
+#define PROT_INIT 0x00000001
+#define PROT_MAKEALL 0x00000002
+#define PROT_MOVE_FWD 0x00000004
+#define PROT_MOVE_BWD 0x00000008
+#define PROT_GROW 0x00000010
+#define PROT_SHRINK 0x00000020
+#define PROT_GROW_TST 0x00000040
+#define PROT_SHRINK_TST 0x00000080
+#define PROT_SIZE 0x00000100
+#define PROT_PRTAREA 0x00000200
+#define PROT_POS 0x00000400
+#define PROT_ADJUSTN 0x00000800
+#define PROT_SECTION 0x00001000
+#define PROT_CUT 0x00002000
+#define PROT_PASTE 0x00004000
+#define PROT_LEAF 0x00008000
+#define PROT_TESTFORMAT 0x00010000
+#define PROT_FRMCHANGES 0x00020000
+#define PROT_SNAPSHOT 0x00040000
+
+#define ACT_START 1
+#define ACT_END 2
+#define ACT_CREATE_MASTER 3
+#define ACT_CREATE_FOLLOW 4
+#define ACT_DEL_MASTER 5
+#define ACT_DEL_FOLLOW 6
+#define ACT_MERGE 7
+#define ACT_NEXT_SECT 8
+#define ACT_PREV_SECT 9
+
+#define SNAP_LOWER 0x00000001
+#define SNAP_FLYFRAMES 0x00000002
+#define SNAP_TABLECONT 0x00000004
+
+#ifdef DBG_UTIL
+
+#include <tools/debug.hxx>
+namespace binfilter {
+class SwImplProtocol;
+class SwFrm;
+class SwImplEnterLeave;
+
+class SwProtocol
+{
+ static ULONG nRecord;
+ static SwImplProtocol* pImpl;
+ static BOOL Start() { return 0 != ( PROT_INIT & nRecord ); }
+public:
+ static ULONG Record() { return nRecord; }
+ static void SetRecord( ULONG nNew ) { nRecord = nNew; }
+ static BOOL Record( ULONG nFunc ) { return 0 != (( nFunc | PROT_INIT ) & nRecord); }
+ static void Record( const SwFrm* pFrm, ULONG nFunction, ULONG nAction, void* pParam ){DBG_BF_ASSERT(0, "STRIP");} //STRIP001 static void Record( const SwFrm* pFrm, ULONG nFunction, ULONG nAction, void* pParam );
+ static void Init();
+ static void Stop();
+};
+
+class SwEnterLeave
+{
+ SwImplEnterLeave* pImpl;
+ void Ctor( const SwFrm* pFrm, ULONG nFunc, ULONG nAct, void* pPar ){DBG_BF_ASSERT(0, "STRIP");} //STRIP001 void Ctor( const SwFrm* pFrm, ULONG nFunc, ULONG nAct, void* pPar );
+ void Dtor(){DBG_BF_ASSERT(0, "STRIP");} //STRIP001 void Dtor();
+public:
+ SwEnterLeave( const SwFrm* pFrm, ULONG nFunc, ULONG nAct, void* pPar )
+ { if( SwProtocol::Record( nFunc ) ) Ctor( pFrm, nFunc, nAct, pPar ); else pImpl = NULL; }
+ ~SwEnterLeave() { if( pImpl ) Dtor(); }
+};
+
+#define PROTOCOL( pFrm, nFunc, nAct, pPar ) { if( SwProtocol::Record( nFunc ) )\
+ SwProtocol::Record( pFrm, nFunc, nAct, pPar ); }
+#define PROTOCOL_INIT SwProtocol::Init();
+#define PROTOCOL_STOP SwProtocol::Stop();
+#define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar ) SwEnterLeave aEnter( pFrm, nFunc, nAct, pPar );
+#define PROTOCOL_SNAPSHOT( pFrm, nFlags ) SwProtocol::SnapShot( pFrm, nFlags );
+#define GET_VARIABLE( nNo, nVar ) SwProtocol::GetVar( nNo, nVar );
+} //STRIP008 end of namespace binfilter
+#else
+namespace binfilter {
+#define PROTOCOL( pFrm, nFunc, nAct, pPar )
+#define PROTOCOL_INIT
+#define PROTOCOL_STOP
+#define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar )
+#define PROTOCOL_SNAPSHOT( pFrm, nFlags )
+#define GET_VARIABLE( nNo, nVar )
+} //namespace binfilter
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/dflyobj.hxx b/binfilter/bf_sw/source/core/inc/dflyobj.hxx
new file mode 100644
index 000000000000..3137bf273e0c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/dflyobj.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DFLYOBJ_HXX
+#define _DFLYOBJ_HXX
+
+#include <bf_svx/svdovirt.hxx>
+#include <bf_svx/svdobj.hxx>
+namespace binfilter {
+
+class SwFlyFrm;
+class SwFrmFmt;
+class SdrObjMacroHitRec;
+
+const UINT32 SWGInventor = UINT32('S')*0x00000001+
+ UINT32('W')*0x00000100+
+ UINT32('G')*0x00010000;
+
+const UINT16 SwFlyDrawObjIdentifier = 0x0001;
+const UINT16 SwDrawFirst = 0x0001;
+
+//---------------------------------------
+//SwFlyDrawObj, Die DrawObjekte fuer Flys.
+
+class SwFlyDrawObj : public SdrObject
+{
+ SfxItemSet* mpLocalItemSet;
+
+public:
+ TYPEINFO();
+
+ SwFlyDrawObj();
+ ~SwFlyDrawObj();
+
+
+ // ItemSet access
+
+ //Damit eine Instanz dieser Klasse beim laden erzeugt werden kann
+ //(per Factory).
+ virtual UINT32 GetObjInventor() const;
+ virtual UINT16 GetObjIdentifier() const;
+};
+
+//---------------------------------------
+//SwVirtFlyDrawObj, die virtuellen Objekte fuer Flys.
+//Flys werden immer mit virtuellen Objekten angezeigt. Nur so koennen sie
+//ggf. mehrfach angezeigt werden (Kopf-/Fusszeilen).
+
+class SwVirtFlyDrawObj : public SdrVirtObj
+{
+ SwFlyFrm *pFlyFrm;
+
+public:
+ TYPEINFO();
+
+ SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrm* pFly);
+ ~SwVirtFlyDrawObj();
+
+ //Ueberladene Methoden der Basisklasse SdrVirtObj
+
+ //Wir nehemen die Groessenbehandlung vollstaendig selbst in die Hand.
+ virtual const Rectangle& GetBoundRect() const;
+ virtual const Rectangle& GetSnapRect() const;
+
+ SwFrmFmt *GetFmt();
+
+ // Get Methoden fuer die Fly Verpointerung
+ SwFlyFrm* GetFlyFrm() { return pFlyFrm; }
+ const SwFlyFrm* GetFlyFrm() const { return pFlyFrm; }
+
+ void SetRect() const;
+ void _SetRectsDirty() { SetRectsDirty(); }
+
+ // ist eine URL an einer Grafik gesetzt, dann ist das ein Makro-Object
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/docfld.hxx b/binfilter/bf_sw/source/core/inc/docfld.hxx
new file mode 100644
index 000000000000..73bb8a0f5aab
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/docfld.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DOCFLD_HXX
+#define _DOCFLD_HXX
+
+#include <calc.hxx> // fuer SwHash
+#include <doc.hxx>
+namespace binfilter {
+
+class SwTxtFld;
+class SwIndex;
+class SwNodeIndex;
+class SwCntntNode;
+class SwCntntFrm;
+class SwSectionNode;
+class SwSection;
+class SwTxtTOXMark;
+class SwTableBox;
+class SwTxtINetFmt;
+class SwFlyFrmFmt;
+
+// Update an den Expression Feldern
+class _SetGetExpFld
+{
+ ULONG nNode;
+ xub_StrLen nCntnt;
+ union {
+ const SwTxtFld* pTxtFld;
+ const SwSection* pSection;
+ const SwPosition* pPos;
+ const SwTxtTOXMark* pTxtTOX;
+ const SwTableBox* pTBox;
+ const SwTxtINetFmt* pTxtINet;
+ const SwFlyFrmFmt* pFlyFmt;
+ } CNTNT;
+ enum _SetGetExpFldType
+ {
+ TEXTFIELD, TEXTTOXMARK, SECTIONNODE, CRSRPOS, TABLEBOX,
+ TEXTINET, FLYFRAME
+ } eSetGetExpFldType;
+
+public:
+ _SetGetExpFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld = 0,
+ const SwIndex* pIdx = 0 );
+
+ _SetGetExpFld( const SwSectionNode& rSectNode,
+ const SwPosition* pPos = 0 );
+
+ BOOL operator==( const _SetGetExpFld& rFld ) const
+ { return nNode == rFld.nNode && nCntnt == rFld.nCntnt &&
+ ( !CNTNT.pTxtFld || !rFld.CNTNT.pTxtFld ||
+ CNTNT.pTxtFld == rFld.CNTNT.pTxtFld ); }
+ BOOL operator<( const _SetGetExpFld& rFld ) const;
+
+ const SwTxtFld* GetFld() const
+ { return TEXTFIELD == eSetGetExpFldType ? CNTNT.pTxtFld : 0; }
+ const SwSection* GetSection() const
+ { return SECTIONNODE == eSetGetExpFldType ? CNTNT.pSection : 0; }
+ ULONG GetNode() const { return nNode; }
+ const void* GetPointer() const { return CNTNT.pTxtFld; }
+ const SwNode* GetNodeFromCntnt() const;
+ xub_StrLen GetCntPosFromCntnt() const;
+};
+
+typedef _SetGetExpFld* _SetGetExpFldPtr;
+SV_DECL_PTRARR_SORT_DEL( _SetGetExpFlds, _SetGetExpFldPtr, 0, 10 )
+
+
+// Struktur zum Speichern der Strings aus SetExp-String-Feldern
+struct _HashStr : public SwHash
+{
+ String aSetStr;
+ _HashStr( const String& rName, const String& rText, _HashStr* = 0 );
+};
+
+struct SwCalcFldType : public SwHash
+{
+ const SwFieldType* pFldType;
+
+ SwCalcFldType( const String& rStr, const SwFieldType* pFldTyp )
+ : SwHash( rStr ), pFldType( pFldTyp )
+ {}
+};
+
+// Suche nach dem String, der unter dem Namen in der HashTabelle abgelegt
+// wurde
+void LookString( SwHash** ppTbl, USHORT nSize, const String& rName,
+ String& rRet, USHORT* pPos = 0 );
+
+
+// --------
+
+const int GETFLD_ALL = 3; // veroderte Flags !!
+const int GETFLD_CALC = 1;
+const int GETFLD_EXPAND = 2;
+
+class SwDocUpdtFld
+{
+ _SetGetExpFlds* pFldSortLst; // akt. Field-Liste zum Calculieren
+ SwCalcFldType* aFldTypeTable[ TBLSZ ];
+
+// noch eine weitere Optimierung - wird z.Z. nicht angesprochen!
+ long nFldUpdtPos; // ab dieser Position mit Update starten
+ SwCntntNode* pCNode; // der TxtNode zur UpdatePos.
+
+ ULONG nNodes; // sollte die NodesAnzahl unterschiedlich sein
+ BYTE nFldLstGetMode;
+
+ BOOL bInUpdateFlds : 1; // zur Zeit laeuft ein UpdateFlds,
+ BOOL bFldsDirty : 1; // irgendwelche Felder sind ungueltig
+
+ void _MakeFldList( SwDoc& pDoc, int eGetMode );
+ void GetBodyNode( const SwTxtFld& , USHORT nFldWhich );
+ void GetBodyNode( const SwSectionNode&);
+public:
+ SwDocUpdtFld();
+ ~SwDocUpdtFld();
+
+ const _SetGetExpFlds* GetSortLst() const { return pFldSortLst; }
+
+ void MakeFldList( SwDoc& rDoc, int bAll, int eGetMode )
+ {
+ if( !pFldSortLst || bAll || !( eGetMode & nFldLstGetMode ) ||
+ rDoc.GetNodes().Count() != nNodes )
+ _MakeFldList( rDoc, eGetMode );
+ }
+
+ void InsDelFldInFldLst( BOOL bIns, const SwTxtFld& rFld );
+
+ void InsertFldType( const SwFieldType& rType );
+
+ BOOL IsInUpdateFlds() const { return bInUpdateFlds; }
+ void SetInUpdateFlds( BOOL b ) { bInUpdateFlds = b; }
+
+ BOOL IsFieldsDirty() const { return bFldsDirty; }
+ void SetFieldsDirty( BOOL b ) { bFldsDirty = b; }
+
+ SwHash** GetFldTypeTable() const { return (SwHash**)aFldTypeTable; }
+};
+
+
+} //namespace binfilter
+#endif // _DOCFLD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/docfunc.hxx b/binfilter/bf_sw/source/core/inc/docfunc.hxx
new file mode 100644
index 000000000000..ab15a6b9402b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/docfunc.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DOCFUNC_HXX
+#define _DOCFUNC_HXX
+
+
+// Diese Klasse wird von der Editshell benutz um fuer belibige
+// Doc-Aktionen ueber eine definierte Schnittstelle alle Cursor/
+// Bookmarks/usw. aus dem Loeschbereich zu verschieben, mit einem
+// anschliessenden Join-Node.
+// Das wird zur Zeit vom
+// - Delete
+// - Replace
+// benotigt.
+
+
+#include <tools/string.hxx>
+namespace binfilter {
+class SwPaM;
+
+enum DocFNType { DOC_DELETE, DOC_REPLACE };
+
+class SwCallDocFunction
+{
+ // Parameter fuers Replace (leider kein union moeglich; Str-Klasse !!)
+ const String aRplStr;
+ DocFNType eDocFnType;
+ BOOL bRplRegExp;
+
+public:
+ // fuer parameterlose Methoden
+ SwCallDocFunction( DocFNType eDocFn ) : eDocFnType( eDocFn ), aRplStr() {}
+ // fuer das Replace
+ SwCallDocFunction( const String& rStr, BOOL bFlag );
+
+ BOOL Call( SwPaM& );
+
+ // ALLE Methoden stehen im eddel.cxx !!
+};
+
+
+} //namespace binfilter
+#endif
+ //_DOCFUNC_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/doctxm.hxx b/binfilter/bf_sw/source/core/inc/doctxm.hxx
new file mode 100644
index 000000000000..7b67d76c70cb
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/doctxm.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DOCTXM_HXX
+#define _DOCTXM_HXX
+
+
+#include <bf_svtools/svarray.hxx>
+#include <tools/gen.hxx>
+
+#include <tox.hxx>
+#include <section.hxx>
+class SvUShorts;
+class SvStringsDtor;
+class SvPtrarr;
+namespace binfilter {
+
+class SwTOXInternational;
+
+class SwTxtNode;
+class SwTxtFmtColl;
+struct SwPosition;
+struct SwTOXSortTabBase;
+
+typedef SwTOXSortTabBase* SwTOXSortTabBasePtr;
+
+SV_DECL_PTRARR(SwTOXSortTabBases, SwTOXSortTabBasePtr, 0, 5 )//STRIP008 ;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ring der speziellen Verzeichnisse
+ --------------------------------------------------------------------*/
+
+class SwTOXBaseSection : public SwTOXBase, public SwSection
+{
+ SwTOXSortTabBases aSortArr;
+
+ void UpdateAll();
+
+ // Sortiert einfuegen ins Array fuer die Generierung
+
+ // Alpha-Trennzeichen bei der Generierung einfuegen
+
+ // Textrumpf generieren
+ // OD 18.03.2003 #106329# - add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc>
+
+ // Seitennummerplatzhalter gegen aktuelle Nummern austauschen
+
+ // Bereich fuer Stichwort einfuegen suchen
+
+ // returne die TextCollection ueber den Namen / aus Format-Pool
+
+public:
+ SwTOXBaseSection( const SwTOXBase& rBase );
+ virtual ~SwTOXBaseSection();
+
+ // OD 19.03.2003 #106329# - add parameter <_bNewTOX> in order to distinguish
+ // between the creation of a new table-of-content or an update of
+ // a table-of-content. Default value: false
+ void Update( const SfxItemSet* pAttr = 0,
+ const bool _bNewTOX = false ); // Formatieren
+ void UpdatePageNum(); // Seitennummern einfuegen
+ TYPEINFO(); // fuers rtti
+
+};
+/* -----------------02.09.99 07:52-------------------
+
+ --------------------------------------------------*/
+struct SwDefTOXBase_Impl
+{
+ SwTOXBase* pContBase;
+ SwTOXBase* pIdxBase;
+ SwTOXBase* pUserBase;
+ SwTOXBase* pTblBase;
+ SwTOXBase* pObjBase;
+ SwTOXBase* pIllBase;
+ SwTOXBase* pAuthBase;
+
+ SwDefTOXBase_Impl() :
+ pContBase(0),
+ pIdxBase(0),
+ pUserBase(0),
+ pTblBase(0),
+ pObjBase(0),
+ pIllBase(0),
+ pAuthBase(0)
+ {}
+ ~SwDefTOXBase_Impl()
+ {
+ delete pContBase;
+ delete pIdxBase;
+ delete pUserBase;
+ delete pTblBase;
+ delete pObjBase;
+ delete pIllBase;
+ delete pAuthBase;
+ }
+
+};
+
+} //namespace binfilter
+#endif // _DOCTXM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/drawdev.hxx b/binfilter/bf_sw/source/core/inc/drawdev.hxx
new file mode 100644
index 000000000000..52720fcec81a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/drawdev.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DRAWDEV_HXX
+#define _DRAWDEV_HXX
+
+#include "swrect.hxx"
+
+#include <vcl/outdev.hxx>
+namespace binfilter {
+
+/*************************************************************************
+ * class SwDrawDev
+ *
+ * Alle Draw-Methoden werden um den Offset *pPos verschoben.
+ *************************************************************************/
+
+class SwDrawDev
+{
+ OutputDevice *pOut;
+ const Point *pPos;
+
+public:
+ inline SwDrawDev( OutputDevice *pOut, const Point *pPos )
+ :pOut(pOut), pPos(pPos) { }
+
+ inline OutputDevice *GetOut() { return pOut; }
+
+ // Ausgabemethoden
+ inline void DrawText( const Point& rStart, const String& rTxt,
+ const USHORT nIdx = 0,
+ const USHORT nLen = STRING_LEN );
+ inline void DrawStretchText( const Point& rStart, USHORT nWidth,
+ const String& rTxt,
+ const USHORT nIdx = 0,
+ const USHORT nLen = STRING_LEN );
+ inline void DrawTextArray( const Point& rStart,
+ const String& rTxt,
+ long *pKernArray = 0,
+ const USHORT nIdx = 0,
+ const USHORT nLen = STRING_LEN);
+ inline void DrawLine( const Point& rStart, const Point& rEnd );
+ inline void DrawRect( const SwRect& rRect,
+ const USHORT nHorzRount = 0,
+ const USHORT nVertRound = 0 );
+
+ inline const Point *GetOrigin() const {return pPos; }
+};
+
+/*************************************************************************
+ * SwDrawDev::DrawText
+ *************************************************************************/
+
+inline void SwDrawDev::DrawText( const Point& rStart, const String& rTxt,
+ const USHORT nIdx, const USHORT nLen )
+{
+ if( !pPos )
+ pOut->DrawText( rStart, rTxt, nIdx, nLen );
+ else
+ pOut->DrawText( rStart - *pPos, rTxt, nIdx, nLen );
+}
+
+/*************************************************************************
+ * SwDrawDev::DrawStretchText
+ *************************************************************************/
+
+inline void SwDrawDev::DrawStretchText( const Point& rStart, USHORT nWidth,
+ const String& rTxt, const USHORT nIdx, const USHORT nLen )
+{
+ if( !pPos )
+ pOut->DrawStretchText( rStart, nWidth, rTxt, nIdx, nLen );
+ else
+ pOut->DrawStretchText( rStart - *pPos, nWidth, rTxt, nIdx, nLen );
+}
+
+/*************************************************************************
+ * SwDrawDev::DrawTextArray
+ *************************************************************************/
+
+inline void SwDrawDev::DrawTextArray( const Point& rStart, const String& rTxt,
+ long *pKernArray, const USHORT nIdx, const USHORT nLen )
+{
+ if( !pPos )
+ pOut->DrawTextArray( rStart, rTxt, pKernArray, nIdx, nLen );
+ else
+ pOut->DrawTextArray( rStart - *pPos, rTxt, pKernArray, nIdx, nLen );
+}
+
+/*************************************************************************
+ * SwDrawDev::DrawLine
+ *************************************************************************/
+
+inline void SwDrawDev::DrawLine( const Point& rStart, const Point& rEnd )
+{
+ if( !pPos )
+ pOut->DrawLine( rStart, rEnd );
+ else
+ pOut->DrawLine( rStart - *pPos, rEnd - *pPos );
+}
+
+/*************************************************************************
+ * SwDrawDev::DrawRect
+ *************************************************************************/
+
+inline void SwDrawDev::DrawRect( const SwRect& rRect,
+ const USHORT nHorzRound, const USHORT nVertRound )
+{
+ SwRect aRect( rRect );
+ if( pPos )
+ aRect.Pos() -= *pPos;
+ pOut->DrawRect( aRect.SVRect(), nHorzRound, nVertRound );
+}
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/drawfont.hxx b/binfilter/bf_sw/source/core/inc/drawfont.hxx
new file mode 100644
index 000000000000..d7f8d37ee121
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/drawfont.hxx
@@ -0,0 +1,767 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DRAWFONT_HXX
+#define _DRAWFONT_HXX
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_SHORTS
+#define _SVSTDARR_BYTES
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_XUB_STRLEN
+#include <bf_svtools/svstdarr.hxx>
+#endif
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+#include "errhdl.hxx"
+#include <tools/fract.hxx>
+
+#include <i18npool/lang.h>
+class OutputDevice;
+class Point;
+class Size;
+class Font;
+namespace binfilter {
+
+class SwWrongList;
+class SwFont;
+
+class ViewShell;
+class SwTxtNode;
+class SwAttrHandler;
+class SwTxtFrm;
+class SwUnderlineFont;
+
+/*************************************************************************
+ * class SwScanner
+ * Hilfsklasse, die beim Spellen die Worte im gewuenschten Bereich
+ * nacheinander zur Verfuegung stellt.
+ *************************************************************************/
+
+class SwScanner
+{
+ XubString aWord;
+ const SwWrongList* pWrong;
+ const SwTxtNode& rNode;
+ xub_StrLen nEndPos;
+ xub_StrLen nBegin;
+ xub_StrLen nLen;
+ LanguageType aCurrLang;
+ USHORT nWordType;
+ BOOL bReverse;
+ BOOL bStart;
+ BOOL bIsOnlineSpell;
+
+public:
+ SwScanner( const SwTxtNode& rNd, const SwWrongList* pWrng, USHORT nWordType,
+ xub_StrLen nStart, xub_StrLen nEnde, BOOL bRev, BOOL bOS );
+
+ // This next word function tries to find the language for the next word
+ // It should currently _not_ be used for spell checking, and works only for
+ // ! bReverse
+ BOOL NextWord();
+
+ const XubString& GetWord() const { return aWord; }
+
+ xub_StrLen GetBegin() const { return nBegin; }
+ xub_StrLen GetEnd() const { return nBegin + nLen; }
+ xub_StrLen GetLen() const { return nLen; }
+};
+
+/*************************************************************************
+ * class SwScriptInfo
+ *
+ * encapsultes information about script changes
+ *************************************************************************/
+
+class SwScriptInfo
+{
+private:
+ SvXub_StrLens aScriptChg;
+ SvBytes aScriptType;
+ SvXub_StrLens aDirChg;
+ SvBytes aDirType;
+ SvXub_StrLens aKashida;
+ SvXub_StrLens aCompChg;
+ SvXub_StrLens aCompLen;
+ SvBytes aCompType;
+ xub_StrLen nInvalidityPos;
+ BYTE nDefaultDir;
+
+ void UpdateBidiInfo( const String& rTxt );
+
+public:
+ enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE };
+
+ inline SwScriptInfo() : nInvalidityPos( 0 ), nDefaultDir( 0 ) {};
+
+ // determines script changes
+ void InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL );
+
+ // set/get position from which data is invalid
+ inline void SetInvalidity( const xub_StrLen nPos );
+ inline xub_StrLen GetInvalidity() const { return nInvalidityPos; };
+
+ // get default direction for paragraph
+ inline BYTE GetDefaultDir() const { return nDefaultDir; };
+
+ // array operations, nCnt refers to array position
+ inline USHORT CountScriptChg() const;
+ inline xub_StrLen GetScriptChg( const USHORT nCnt ) const;
+ inline BYTE GetScriptType( const USHORT nCnt ) const;
+
+ inline USHORT CountDirChg() const;
+ inline xub_StrLen GetDirChg( const USHORT nCnt ) const;
+ inline BYTE GetDirType( const USHORT nCnt ) const;
+
+ inline USHORT CountKashida() const;
+ inline xub_StrLen GetKashida( const USHORT nCnt ) const;
+
+ inline USHORT CountCompChg() const;
+ inline xub_StrLen GetCompStart( const USHORT nCnt ) const;
+ inline xub_StrLen GetCompLen( const USHORT nCnt ) const;
+ inline BYTE GetCompType( const USHORT nCnt ) const;
+
+ // "high" level operations, nPos refers to string position
+ xub_StrLen NextScriptChg( const xub_StrLen nPos ) const;
+ BYTE ScriptType( const xub_StrLen nPos ) const;
+
+ // Returns the position of the next direction level change.
+ // If bLevel is set, the position of the next level which is smaller
+ // than the level at position nPos is returned. This is required to
+ // obtain the end of a SwBidiPortion
+ xub_StrLen NextDirChg( const xub_StrLen nPos,
+ const BYTE* pLevel = 0 ) const;
+ BYTE DirType( const xub_StrLen nPos ) const;
+
+
+ // examines the range [ nStart, nStart + nEnd ] if there are kanas
+ // returns start index of kana entry in array, otherwise USHRT_MAX
+ USHORT HasKana( xub_StrLen nStart, const xub_StrLen nEnd ) const;
+
+ // modifies the kerning array according to a given compress value
+ long Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen nLen,
+ const USHORT nCompress, const USHORT nFontHeight,
+ Point* pPoint = NULL ) const;
+};
+
+inline void SwScriptInfo::SetInvalidity( const xub_StrLen nPos )
+{
+ if ( nPos < nInvalidityPos )
+ nInvalidityPos = nPos;
+};
+inline USHORT SwScriptInfo::CountScriptChg() const { return aScriptChg.Count(); }
+inline xub_StrLen SwScriptInfo::GetScriptChg( const USHORT nCnt ) const
+{
+ ASSERT( nCnt < aScriptChg.Count(),"No ScriptChange today!");
+ return aScriptChg[ nCnt ];
+}
+inline BYTE SwScriptInfo::GetScriptType( const xub_StrLen nCnt ) const
+{
+ ASSERT( nCnt < aScriptChg.Count(),"No ScriptType today!");
+ return aScriptType[ nCnt ];
+}
+
+inline USHORT SwScriptInfo::CountDirChg() const { return aDirChg.Count(); }
+inline xub_StrLen SwScriptInfo::GetDirChg( const USHORT nCnt ) const
+{
+ ASSERT( nCnt < aDirChg.Count(),"No DirChange today!");
+ return aDirChg[ nCnt ];
+}
+inline BYTE SwScriptInfo::GetDirType( const xub_StrLen nCnt ) const
+{
+ ASSERT( nCnt < aDirChg.Count(),"No DirType today!");
+ return aDirType[ nCnt ];
+}
+
+inline USHORT SwScriptInfo::CountKashida() const { return aKashida.Count(); }
+inline xub_StrLen SwScriptInfo::GetKashida( const USHORT nCnt ) const
+{
+ ASSERT( nCnt < aKashida.Count(),"No Kashidas today!");
+ return aKashida[ nCnt ];
+}
+
+inline USHORT SwScriptInfo::CountCompChg() const { return aCompChg.Count(); };
+inline xub_StrLen SwScriptInfo::GetCompStart( const USHORT nCnt ) const
+{
+ ASSERT( nCnt < aCompChg.Count(),"No CompressionStart today!");
+ return aCompChg[ nCnt ];
+}
+inline xub_StrLen SwScriptInfo::GetCompLen( const USHORT nCnt ) const
+{
+ ASSERT( nCnt < aCompChg.Count(),"No CompressionLen today!");
+ return aCompLen[ nCnt ];
+}
+
+inline BYTE SwScriptInfo::GetCompType( const USHORT nCnt ) const
+{
+ ASSERT( nCnt < aCompChg.Count(),"No CompressionType today!");
+ return aCompType[ nCnt ];
+}
+
+/*************************************************************************
+ * class SwDrawTextInfo
+ *
+ * encapsulates information for drawing text
+ *************************************************************************/
+
+class SwDrawTextInfo
+{
+ const SwTxtFrm* pFrm;
+ OutputDevice* pOut;
+ ViewShell* pSh;
+ const SwScriptInfo* pScriptInfo;
+ const Point* pPos;
+ const XubString* pText;
+ const SwWrongList* pWrong;
+ const Size* pSize;
+ SwFont *pFnt;
+ SwUnderlineFont* pUnderFnt;
+ xub_StrLen* pHyphPos;
+// Fraction aZoom;
+ long nLeft;
+ long nRight;
+ long nKanaDiff;
+ xub_StrLen nIdx;
+ xub_StrLen nLen;
+ xub_StrLen nOfst;
+ USHORT nWidth;
+ USHORT nAscent;
+ USHORT nCompress;
+ short nSperren;
+ short nKern;
+ short nSpace;
+ BYTE nCursorBidiLevel;
+ BOOL bBullet : 1;
+ BOOL bUpper : 1; // Fuer Kapitaelchen: Grossbuchstaben-Flag
+ BOOL bDrawSpace : 1; // Fuer Kapitaelchen: Unter/Durchstreichung
+ BOOL bGreyWave : 1; // Graue Wellenlinie beim extended TextInput
+ BOOL bSpaceStop : 1; // For underlining we need to know, if a portion
+ // is right in front of a hole portion or a
+ // fix margin portion.
+ BOOL bSnapToGrid : 1; // Does paragraph snap to grid?
+ BOOL bIgnoreFrmRTL : 1; // Paint text as if text has LTR direction, used for
+ // line numbering
+ BOOL bPosMatchesBounds :1; // GetCrsrOfst should not return the next
+ // position if screen position is inside second
+ // have of bound rect, used for Accessibility
+
+ SwDrawTextInfo(); // nicht zulaessig
+public:
+#ifdef DBG_UTIL
+ BOOL bOut : 1; // In der Non-Product wird der Zugriff auf die Member
+ BOOL bPos : 1; // durch diese Flags ueberwacht.
+ BOOL bText : 1; // Wird ein Member gesetzt, so wird das entsprechende
+ BOOL bWrong : 1; // Flag gesetzt.
+ BOOL bSize : 1; // Wird ein Member ausgelesen, so wird ASSERTet, dass
+ BOOL bFnt : 1; // dieser zuvor gesetzt worden ist.
+ BOOL bIdx : 1;
+ BOOL bLen : 1;
+ BOOL bWidth : 1;
+ BOOL bAscent: 1;
+ BOOL bSperr : 1;
+ BOOL bKern : 1;
+ BOOL bSpace : 1;
+ BOOL bBull : 1;
+ BOOL bSpec : 1;
+ BOOL bUppr : 1;
+ BOOL bDrawSp: 1;
+ BOOL bGreyWv: 1;
+ BOOL bLeft : 1;
+ BOOL bRight : 1;
+ BOOL bKana : 1;
+ BOOL bOfst : 1;
+ BOOL bHyph : 1;
+#endif
+
+ SwDrawTextInfo( ViewShell *pS, OutputDevice &rO, const SwScriptInfo* pSI,
+ const XubString &rSt, xub_StrLen nI, xub_StrLen nL,
+ USHORT nW = 0, BOOL bB = FALSE )
+ {
+ pFrm = NULL;
+ pSh = pS;
+ pOut = &rO;
+ pScriptInfo = pSI;
+ pText = &rSt;
+ nIdx = nI;
+ nLen = nL;
+ nKern = 0;
+ nCompress = 0;
+ nWidth = nW;
+ nCursorBidiLevel = 0;
+ bBullet = bB;
+ pUnderFnt = 0;
+ bGreyWave = FALSE;
+ bSpaceStop = FALSE;
+ bSnapToGrid = FALSE;
+ bIgnoreFrmRTL = FALSE;
+ bPosMatchesBounds = FALSE;
+
+#ifdef DBG_UTIL
+ bOut = bText = bIdx = bLen = bWidth = bKern = bBull = bSpec =
+ bGreyWv = TRUE;
+
+ bPos = bWrong = bSize = bFnt = bAscent = bSpace = bUppr =
+ bDrawSp = bLeft = bRight = bKana = bOfst = bHyph = FALSE;
+#endif
+ }
+
+ const SwTxtFrm* GetFrm() const
+ {
+ return pFrm;
+ }
+
+ void SetFrm( const SwTxtFrm* pNewFrm )
+ {
+ pFrm = pNewFrm;
+ }
+
+ ViewShell *GetShell() const
+ {
+ return pSh;
+ }
+
+ OutputDevice& GetOut() const
+ {
+ ASSERT( bOut, "DrawTextInfo: Undefined Outputdevice" );
+ return *pOut;
+ }
+
+ OutputDevice *GetpOut() const
+ {
+ ASSERT( bOut, "DrawTextInfo: Undefined Outputdevice" );
+ return pOut;
+ }
+
+ const SwScriptInfo* GetScriptInfo() const
+ {
+ return pScriptInfo;
+ }
+
+ const Point &GetPos() const
+ {
+ ASSERT( bPos, "DrawTextInfo: Undefined Position" );
+ return *pPos;
+ }
+
+ xub_StrLen *GetHyphPos() const
+ {
+ ASSERT( bHyph, "DrawTextInfo: Undefined Hyph Position" );
+ return pHyphPos;
+ }
+
+ const XubString &GetText() const
+ {
+ ASSERT( bText, "DrawTextInfo: Undefined String" );
+ return *pText;
+ }
+
+ const SwWrongList* GetWrong() const
+ {
+ ASSERT( bWrong, "DrawTextInfo: Undefined WrongList" );
+ return pWrong;
+ }
+
+ const Size &GetSize() const
+ {
+ ASSERT( bSize, "DrawTextInfo: Undefined Size" );
+ return *pSize;
+ }
+
+ SwFont* GetFont() const
+ {
+ ASSERT( bFnt, "DrawTextInfo: Undefined Font" );
+ return pFnt;
+ }
+
+ SwUnderlineFont* GetUnderFnt() const
+ {
+ ASSERT( bSpec, "DrawTextInfo: Undefined Underlinefont" );
+ return pUnderFnt;
+ }
+
+ xub_StrLen GetIdx() const
+ {
+ ASSERT( bIdx, "DrawTextInfo: Undefined Index" );
+ return nIdx;
+ }
+
+ xub_StrLen GetLen() const
+ {
+ ASSERT( bLen, "DrawTextInfo: Undefined Length" );
+ return nLen;
+ }
+
+ xub_StrLen GetOfst() const
+ {
+ ASSERT( bOfst, "DrawTextInfo: Undefined Offset" );
+ return nOfst;
+ }
+
+ xub_StrLen GetEnd() const
+ {
+ ASSERT( bIdx, "DrawTextInfo: Undefined Index" );
+ ASSERT( bLen, "DrawTextInfo: Undefined Length" );
+ return nIdx + nLen;
+ }
+
+ long GetLeft() const
+ {
+ ASSERT( bLeft, "DrawTextInfo: Undefined left range" );
+ return nLeft;
+ }
+
+ long GetRight() const
+ {
+ ASSERT( bRight, "DrawTextInfo: Undefined right range" );
+ return nRight;
+ }
+
+ long GetKanaDiff() const
+ {
+ ASSERT( bKana, "DrawTextInfo: Undefined kana difference" );
+ return nKanaDiff;
+ }
+
+ USHORT GetWidth() const
+ {
+ ASSERT( bWidth, "DrawTextInfo: Undefined Width" );
+ return nWidth;
+ }
+
+ USHORT GetAscent() const
+ {
+ ASSERT( bAscent, "DrawTextInfo: Undefined Ascent" );
+ return nAscent;
+ }
+
+ USHORT GetKanaComp() const
+ {
+ return nCompress;
+ }
+
+ short GetSperren() const
+ {
+ ASSERT( bSperr, "DrawTextInfo: Undefined >Sperren<" );
+ return nSperren;
+ }
+
+ short GetKern() const
+ {
+ ASSERT( bKern, "DrawTextInfo: Undefined Kerning" );
+ return nKern;
+ }
+
+ short GetSpace() const
+ {
+ ASSERT( bSpace, "DrawTextInfo: Undefined Spacing" );
+ return nSpace;
+ }
+
+ BYTE GetCursorBidiLevel() const
+ {
+ return nCursorBidiLevel;
+ }
+
+ BOOL GetBullet() const
+ {
+ ASSERT( bBull, "DrawTextInfo: Undefined Bulletflag" );
+ return bBullet;
+ }
+
+ BOOL GetUpper() const
+ {
+ ASSERT( bUppr, "DrawTextInfo: Undefined Upperflag" );
+ return bUpper;
+ }
+
+ BOOL GetDrawSpace() const
+ {
+ ASSERT( bDrawSp, "DrawTextInfo: Undefined DrawSpaceflag" );
+ return bDrawSpace;
+ }
+
+ BOOL GetGreyWave() const
+ {
+ ASSERT( bGreyWv, "DrawTextInfo: Undefined GreyWave" );
+ return bGreyWave;
+ }
+
+ BOOL IsSpaceStop() const
+ {
+ return bSpaceStop;
+ }
+
+ BOOL SnapToGrid() const
+ {
+ return bSnapToGrid;
+ }
+
+ BOOL IsIgnoreFrmRTL() const
+ {
+ return bIgnoreFrmRTL;
+ }
+
+ BOOL IsPosMatchesBounds() const
+ {
+ return bPosMatchesBounds;
+ }
+
+ void SetOut( OutputDevice &rNew )
+ {
+ pOut = &rNew;
+#ifdef DBG_UTIL
+ bOut = TRUE;
+#endif
+ }
+
+ void SetPos( const Point &rNew )
+ {
+ pPos = &rNew;
+#ifdef DBG_UTIL
+ bPos = TRUE;
+#endif
+ }
+
+ void SetHyphPos( xub_StrLen *pNew )
+ {
+ pHyphPos = pNew;
+#ifdef DBG_UTIL
+ bHyph = TRUE;
+#endif
+ }
+
+ void SetText( const XubString &rNew )
+ {
+ pText = &rNew;
+#ifdef DBG_UTIL
+ bText = TRUE;
+#endif
+ }
+
+ void SetWrong( const SwWrongList* pNew )
+ {
+ pWrong = pNew;
+#ifdef DBG_UTIL
+ bWrong = TRUE;
+#endif
+ }
+
+ void SetSize( const Size &rNew )
+ {
+ pSize = &rNew;
+#ifdef DBG_UTIL
+ bSize = TRUE;
+#endif
+ }
+
+ void SetFont( SwFont* pNew )
+ {
+ pFnt = pNew;
+#ifdef DBG_UTIL
+ bFnt = TRUE;
+#endif
+ }
+
+ void SetIdx( xub_StrLen nNew )
+ {
+ nIdx = nNew;
+#ifdef DBG_UTIL
+ bIdx = TRUE;
+#endif
+ }
+
+ void SetLen( xub_StrLen nNew )
+ {
+ nLen = nNew;
+#ifdef DBG_UTIL
+ bLen = TRUE;
+#endif
+ }
+
+ void SetOfst( xub_StrLen nNew )
+ {
+ nOfst = nNew;
+#ifdef DBG_UTIL
+ bOfst = TRUE;
+#endif
+ }
+
+ void SetLeft( long nNew )
+ {
+ nLeft = nNew;
+#ifdef DBG_UTIL
+ bLeft = TRUE;
+#endif
+ }
+
+ void SetRight( long nNew )
+ {
+ nRight = nNew;
+#ifdef DBG_UTIL
+ bRight = TRUE;
+#endif
+ }
+
+ void SetKanaDiff( long nNew )
+ {
+ nKanaDiff = nNew;
+#ifdef DBG_UTIL
+ bKana = TRUE;
+#endif
+ }
+
+ void SetWidth( USHORT nNew )
+ {
+ nWidth = nNew;
+#ifdef DBG_UTIL
+ bWidth = TRUE;
+#endif
+ }
+
+ void SetAscent( USHORT nNew )
+ {
+ nAscent = nNew;
+#ifdef DBG_UTIL
+ bAscent = TRUE;
+#endif
+ }
+
+ void SetKern( short nNew )
+ {
+ nKern = nNew;
+#ifdef DBG_UTIL
+ bKern = TRUE;
+#endif
+ }
+
+ void SetSperren( short nNew )
+ {
+ nSperren = nNew;
+#ifdef DBG_UTIL
+ bSperr = TRUE;
+#endif
+ }
+
+ void SetSpace( short nNew )
+ {
+ if( nNew < 0 )
+ {
+ SetSperren( -nNew );
+ nSpace = 0;
+ }
+ else
+ {
+ nSpace = nNew;
+ SetSperren( 0 );
+ }
+#ifdef DBG_UTIL
+ bSpace = TRUE;
+#endif
+ }
+
+ void SetCursorBidiLevel( BYTE nNew )
+ {
+ nCursorBidiLevel = nNew;
+ }
+
+ void SetKanaComp( short nNew )
+ {
+ nCompress = nNew;
+ }
+
+ void SetBullet( BOOL bNew )
+ {
+ bBullet = bNew;
+#ifdef DBG_UTIL
+ bBull = TRUE;
+#endif
+ }
+
+ void SetUnderFnt( SwUnderlineFont* pFntIn )
+ {
+ pUnderFnt = pFntIn;
+#ifdef DBG_UTIL
+ bSpec = TRUE;
+#endif
+ }
+
+ void SetUpper( BOOL bNew )
+ {
+ bUpper = bNew;
+#ifdef DBG_UTIL
+ bUppr = TRUE;
+#endif
+ }
+
+ void SetDrawSpace( BOOL bNew )
+ {
+ bDrawSpace = bNew;
+#ifdef DBG_UTIL
+ bDrawSp = TRUE;
+#endif
+ }
+
+ void SetGreyWave( BOOL bNew )
+ {
+ bGreyWave = bNew;
+#ifdef DBG_UTIL
+ bGreyWv = TRUE;
+#endif
+ }
+
+ void SetSpaceStop( BOOL bNew )
+ {
+ bSpaceStop = bNew;
+ }
+
+ void SetSnapToGrid( BOOL bNew )
+ {
+ bSnapToGrid = bNew;
+ }
+
+ void SetIgnoreFrmRTL( BOOL bNew )
+ {
+ bIgnoreFrmRTL = bNew;
+ }
+
+ void SetPosMatchesBounds( BOOL bNew )
+ {
+ bPosMatchesBounds = bNew;
+ }
+
+
+ // sets a new color at the output device if necessary
+ // if a font is passed as argument, the change if made to the font
+ // otherwise the font at the output device is changed
+ // returns if the font has been changed
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/dview.hxx b/binfilter/bf_sw/source/core/inc/dview.hxx
new file mode 100644
index 000000000000..990a9b80a3c1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/dview.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DVIEW_HXX
+#define _DVIEW_HXX
+
+
+#include <bf_svx/fmview.hxx>
+class OutputDevice;
+namespace binfilter {
+
+
+class SwViewImp;
+
+class SwDrawView : public FmFormView
+{
+ //Fuer den Anker
+ Point aAnchorPoint; //Ankerposition
+ SwViewImp &rImp; //Die View gehoert immer zu einer Shell
+
+
+protected:
+ // add custom handles (used by other apps, e.g. AnchorPos)
+ virtual void AddCustomHdl();
+
+public:
+ SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice* pOutDev=NULL );
+
+ //aus der Basisklasse
+ virtual void MarkListHasChanged();
+
+ // #i7672#
+ // Overload to resue edit background color in active text edit view (OutlinerView)
+ virtual void ModelHasChanged();
+
+
+ const SwViewImp &Imp() const { return rImp; }
+ SwViewImp &Imp() { return rImp; }
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/flowfrm.hxx b/binfilter/bf_sw/source/core/inc/flowfrm.hxx
new file mode 100644
index 000000000000..eb95082218b4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/flowfrm.hxx
@@ -0,0 +1,194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLOWFRM_HXX
+#define _FLOWFRM_HXX
+
+#include <frmtool.hxx>
+
+namespace binfilter {
+
+//Der FlowFrm gibt die Funktionalitaet fuer alle Frms vor, die fliessen und
+//die sich aufspalten koennen (wie CntntFrm oder TabFrm).
+//Teile der Funktionalitaet sind im FlowFrm implementiert, andere Teile werden
+//von den spezifischen Frms implementiert.
+//Der FlowFrm ist kein eigenstaender Frm, es kann also auch niemals eine
+//eigenstaendige Instanz vom FlowFrm existieren.
+//Der FlowFrm ist nicht einmal ein echter Frm. Die naheliegende Implementierung
+//waere ein FlowFrm der virtual vom SwFrm abgeleitet ist und direkt auf den
+//eigenen Instanzdaten arbeitet. Abgeleitete Klassen muessten sich
+//vom FlowFrm und (ueber mehrere Basisklassen weil der Klassenbaum sich direkt
+//vom SwFrm zu SwCntntFrm und zum SwLayoutFrm spaltet) virtual vom SwFrm
+//ableiten.
+//Leider entstehen dadurch - neben Problemen mit Compilern und Debuggern -
+//erhebliche zusaetzliche Kosten, die wir uns heutzutage IMHO nicht erlauben
+//koennen.
+//Ich greife deshalb auf eine andere Technik zurueck: Der FlowFrm hat eine
+//Referenz auf den SwFrm - der er genau betrachtet selbst ist - und ist mit
+//diesem befreundet. So kann der FlowFrm anstelle des this-Pointer mit der
+//Referenz auf den SwFrm arbeiten.
+
+#include "frame.hxx" //fuer inlines
+
+class SwPageFrm;
+class SwRect;
+class SwBorderAttrs;
+class SwDoc;
+class SwNodeIndex;
+
+class SwFlowFrm
+{
+ //PrepareMake darf Locken/Unlocken (Robustheit)
+ friend inline void PrepareLock ( SwFlowFrm * );
+ friend inline void PrepareUnlock( SwFlowFrm * );
+
+ //TblSel darf das Follow-Bit zuruecksetzen.
+ friend inline void UnsetFollow( SwFlowFrm *pFlow );
+
+ friend void MakeFrms( SwDoc *, const SwNodeIndex &, const SwNodeIndex & );
+
+ friend class SwNode2LayImpl;
+
+ SwFrm &rThis;
+
+ //Hilfsfunktionen fuer MoveSubTree()
+ static SwLayoutFrm *CutTree( SwFrm* );
+ static BOOL PasteTree( SwFrm *, SwLayoutFrm *, SwFrm *, SwFrm* );
+
+ //Wird fuer das Zusammenspiel von _GetPrevxxx und MoveBwd gebraucht, damit
+ //mehrere Blaetter gleichzeitig uebersprungen werden koennen.
+ //Wird auch vom MoveBwd des TabFrm ausgewertet!
+ static BOOL bMoveBwdJump;
+
+protected:
+
+ SwFlowFrm *pFollow;
+
+ BOOL bIsFollow :1; //Ist's ein Follow
+ BOOL bLockJoin :1; //Join (und damit deleten) verboten wenn TRUE!
+ BOOL bUndersized:1; // wir sind kleiner als gewuenscht
+ BOOL bFtnAtEnd :1; // For sectionfrms only: footnotes at the end of section
+ BOOL bEndnAtEnd :1; // " " " : endnotes at the end of section
+ BOOL bCntntLock :1; // " " " : content locked
+ BOOL bOwnFtnNum :1; // " " " : special numbering of footnotes
+ BOOL bFtnLock :1; // " " " : ftn, don't leave this section bwd
+ BOOL bFlyLock :1; // Stop positioning of at-character flyframes
+
+ //Prueft ob Vorwaertsfluss noch Sinn macht Endloswanderschaften (unterbinden)
+ inline BOOL IsFwdMoveAllowed();
+ BOOL IsKeepFwdMoveAllowed(); //Wie oben, Move fuer Keep.
+
+ //Prueft ob ein Obj das Umlauf wuenscht ueberlappt.
+ //eine Null bedeutet, kein Objekt ueberlappt,
+ // 1 heisst, Objekte, die am FlowFrm selbst verankert sind, ueberlappen
+ // 2 heisst, Objekte, die woanders verankert sind, ueberlappen
+ // 3 heistt, beiderlei verankerte Objekte ueberlappen
+ BYTE BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRect );
+
+ void LockJoin() { bLockJoin = TRUE; }
+ void UnlockJoin() { bLockJoin = FALSE; }
+
+ BOOL CheckMoveFwd( BOOL &rbMakePage, BOOL bKeep, BOOL bMovedBwd );
+ BOOL MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways = FALSE );
+ virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat )=0;
+ BOOL MoveBwd( BOOL &rbReformat );
+
+ BOOL IsKeep( const SwBorderAttrs &rAttrs ) const; //Ist ein Keep zu beruecksichtigen (Breaks!)
+
+public:
+ SwFlowFrm( SwFrm &rFrm );
+
+ const SwFrm *GetFrm() const { return &rThis; }
+ SwFrm *GetFrm() { return &rThis; }
+
+ static BOOL IsMoveBwdJump() { return bMoveBwdJump; }
+ static void SetMoveBwdJump( BOOL bNew ){ bMoveBwdJump = bNew; }
+
+ inline void SetUndersized( const BOOL bNew ) { bUndersized = bNew; }
+ inline BOOL IsUndersized() const { return bUndersized; }
+
+ BOOL IsPrevObjMove() const;
+
+ //Die Kette mit minimalen Operationen und Benachrichtigungen unter den
+ //neuen Parent Moven.
+ void MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling = 0 );
+
+ BOOL HasFollow() const { return pFollow ? TRUE : FALSE; }
+ BOOL IsFollow() const { return bIsFollow; }
+ inline void _SetIsFollow( BOOL bSet ) { bIsFollow = bSet; }
+ const SwFlowFrm *GetFollow() const { return pFollow; }
+ SwFlowFrm *GetFollow() { return pFollow; }
+ BOOL IsAnFollow( const SwFlowFrm *pFlow ) const;
+ inline void SetFollow( SwFlowFrm *pNew ) { pFollow = pNew; }
+ SwFlowFrm *FindMaster();
+ inline const SwFlowFrm *FindMaster() const;
+
+ sal_Bool IsJoinLocked() const { return bLockJoin; }
+ sal_Bool IsAnyJoinLocked() const { return bLockJoin || HasLockedFollow(); }
+ BOOL IsFtnAtEnd() const { return bFtnAtEnd; }
+ BOOL IsEndnAtEnd() const { return bEndnAtEnd; }
+ BOOL IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; }
+ BOOL AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; }
+
+ BOOL IsPageBreak( BOOL bAct ) const;
+ BOOL IsColBreak( BOOL bAct ) const;
+ sal_Bool HasLockedFollow() const;
+
+ SwTwips CalcUpperSpace( const SwBorderAttrs *pAttrs = NULL,
+ const SwFrm* pPr = NULL ) const;
+
+ void CheckKeep();
+
+ void SetFtnLock( BOOL bNew ){ bFtnLock = bNew; }
+ BOOL IsFtnLock() const { return bFtnLock; }
+ void SetFlyLock( BOOL bNew ){ bFlyLock = bNew; }
+ BOOL IsFlyLock() const { return bFlyLock; }
+ void SetOwnFtnNum( BOOL bNew ){ bOwnFtnNum = bNew; }
+ BOOL IsOwnFtnNum() const { return bOwnFtnNum; }
+ void SetCntntLock( BOOL bNew ){ bCntntLock = bNew; }
+ BOOL IsCntntLocked() const { return bCntntLock; }
+
+ //casten einen Frm auf einen FlowFrm - wenns denn einer ist, sonst 0
+ //Diese Methoden muessen fuer neue Ableitungen geaendert werden!
+ static SwFlowFrm *CastFlowFrm( SwFrm *pFrm );
+ static const SwFlowFrm *CastFlowFrm( const SwFrm *pFrm );
+};
+
+inline const SwFlowFrm *SwFlowFrm::FindMaster() const
+{
+ return ((SwFlowFrm*)this)->FindMaster();
+}
+inline BOOL SwFlowFrm::IsFwdMoveAllowed()
+{
+ return rThis.GetIndPrev() != 0;
+}
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/flyfrm.hxx b/binfilter/bf_sw/source/core/inc/flyfrm.hxx
new file mode 100644
index 000000000000..f0db77e8fc8b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/flyfrm.hxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLYFRM_HXX
+#define _FLYFRM_HXX
+
+#include "layfrm.hxx"
+#include <orntenum.hxx>
+
+class PolyPolygon;
+namespace binfilter {
+class SwPageFrm;
+class SwFlyFrmFmt;
+class SwFmtFrmSize;
+struct SwCrsrMoveState;
+class SwBorderAttrs;
+class SwVirtFlyDrawObj;
+class SwSpzFrmFmts;
+class SwAttrSetChg;
+
+
+
+//Sucht ausgehend von pOldAnch einen Anker fuer Absatzgebundene Rahmen.
+//Wird beim Draggen von Absatzgebundenen Objekten zur Ankeranzeige sowie
+//fuer Ankerwechsel benoetigt.
+//implementiert in layout/flycnt.cxx
+const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew,
+ const BOOL bBody = FALSE );
+
+// berechnet das Rechteck, in dem das Objekt bewegt bzw. resized werden darf
+BOOL CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, BOOL bMove = TRUE );
+
+//allg. Basisklasse fuer alle Freifliegenden Rahmen
+class SwFlyFrm : public SwLayoutFrm
+{
+ //darf Locken. Definiert in frmtool.cxx
+ friend void AppendObjs ( const SwSpzFrmFmts *, ULONG, SwFrm *, SwPageFrm * );
+ friend void AppendAllObjs( const SwSpzFrmFmts * );
+ friend void Notify( SwFlyFrm *, SwPageFrm *pOld, const SwRect &rOld );
+ //darf die Pos berechnen (lassen)
+ friend void lcl_MakeFlyPosition( SwFlyFrm *pFly );
+
+ void InitDrawObj( BOOL bNotify ); //Wird von den CToren gerufen.
+ void FinitDrawObj(); //Wird vom CTor gerufen.
+
+ void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &,
+ SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
+
+protected:
+
+ SwVirtFlyDrawObj *pDrawObj; // das Drawingobject zum Fly
+ SwFrm *pAnchor; // An diesem LayoutFrm haengt der Frm, kann 0 sein
+
+ SwFlyFrm *pPrevLink, // Vorgaenger/Nachfolger fuer Verkettung mit
+ *pNextLink; // Textfluss
+
+ Point aRelPos; //Die Relative Position zum Master
+
+private:
+ BOOL bLocked :1; //Cntnt-gebundene Flys muessen derart blockiert werden
+ //koennen, dass sie nicht Formatiert werden; :MakeAll
+ //returnt dann sofort. Dies ist bei Seitenwechseln
+ //waehrend der Formatierung notwendig.
+ //Auch wahrend des RootCTors ist dies notwendig da
+ //sonst der Anker formatiert wird obwohl die Root noch
+ //nicht korrekt an der Shell haengt und weil sonst
+ //initial zuviel Formatiert wuerde.
+ BOOL bNotifyBack:1; //TRUE wenn am Ende eines MakeAll() der Background
+ //vom NotifyDTor benachrichtigt werden muss.
+protected:
+
+ BOOL bInvalid :1; //Pos, PrtArea od. SSize wurden Invalidiert, sie werden
+ //gleich wieder Validiert, denn sie muessen _immer_
+ //gueltig sein. Damit in LayAction korrekt gearbeitet
+ //werden kann muss hier festgehalten werden, dass sie
+ //invalidiert wurden. Ausnahmen bestaetigen die Regelt!
+ BOOL bMinHeight:1; //TRUE wenn die vom Attribut vorgegebene Hoehe eine
+ //eine Minimalhoehe ist (der Frm also bei Bedarf
+ //darueberhinaus wachsen kann).
+ BOOL bHeightClipped :1; //TRUE wenn der Fly nicht die Pos/Size anhand der Attrs
+ BOOL bWidthClipped :1; //formatieren konnte, weil z.B. nicht genug Raum vorh.
+ //war.
+ BOOL bFormatHeightOnly :1; //Damit nach einer Anpassung der Breite
+ //(CheckClip) nur das Format aufgerufen wird;
+ //nicht aber die Breite anhand der Attribute
+ //wieder bestimmt wird.
+ BOOL bInCnt :1; // FLY_IN_CNTNT, als Zeichen verankert
+ BOOL bAtCnt :1; // FLY_AT_CNTNT, am Absatz verankert
+ BOOL bLayout :1; // FLY_PAGE, FLY_AT_FLY, an Seite oder Rahmen
+ BOOL bAutoPosition :1; // FLY_AUTO_CNTNT, im Text verankerter Rahmen
+ BOOL bNoShrink :1; // temporary forbud of shrinking to avoid loops
+
+ friend class SwNoTxtFrm; // Darf NotifyBackground rufen
+ virtual void NotifyBackground( SwPageFrm *pPage,
+ const SwRect& rRect, PrepareHint eHint) = 0;
+
+ //Wird nur von SwXFrm::MakeAll() gerufen; wer es anders macht wird
+ //in einen Sack gesteckt und muss zwei Tage drin hocken bleiben.
+ virtual void MakeFlyPos();
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+ void MakePrtArea( const SwBorderAttrs &rAttrs );
+
+ void Lock() { bLocked = TRUE; }
+ void Unlock() { bLocked = FALSE; }
+
+ void SetMinHeight() { bMinHeight = TRUE; }
+ void ResetMinHeight(){ bMinHeight = FALSE; }
+
+ Size CalcRel( const SwFmtFrmSize &rSz ) const;
+
+ SwFlyFrm( SwFlyFrmFmt*, SwFrm *pAnchor );
+public:
+
+ virtual ~SwFlyFrm();
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+ // erfrage vom Client Informationen
+ virtual BOOL GetInfo( SfxPoolItem& ) const;
+ virtual void ChgSize( const Size& aNewSize );
+
+ virtual void Cut();
+#ifdef DBG_UTIL
+#endif
+
+ SwTwips _Shrink( SwTwips, SZPTR BOOL bTst );
+ SwTwips _Grow ( SwTwips, SZPTR BOOL bTst );
+ void _Invalidate( SwPageFrm *pPage = 0 );
+
+ BOOL FrmSizeChg( const SwFmtFrmSize & );
+
+ const SwFrm *GetAnchor() const { return pAnchor; }
+ SwFrm *GetAnchor() { return pAnchor; }
+ void ChgAnchor( SwFrm *pNew ) { pAnchor = pNew; }
+
+ SwFlyFrm *GetPrevLink() { return pPrevLink; }
+ SwFlyFrm *GetNextLink() { return pNextLink; }
+
+
+
+ const SwVirtFlyDrawObj *GetVirtDrawObj() const { return pDrawObj; }
+ SwVirtFlyDrawObj *GetVirtDrawObj() { return pDrawObj; }
+ void NotifyDrawObj();
+
+ const Point& GetCurRelPos() const { return aRelPos; }
+ BOOL IsInvalid() const { return bInvalid; }
+ void Invalidate() const { ((SwFlyFrm*)this)->bInvalid = TRUE; }
+ void Validate() const { ((SwFlyFrm*)this)->bInvalid = FALSE; }
+
+ BOOL IsMinHeight() const { return bMinHeight; }
+ BOOL IsLocked() const { return bLocked; }
+ BOOL IsAutoPos() const { return bAutoPosition; }
+ BOOL IsFlyInCntFrm() const { return bInCnt; }
+ BOOL IsFlyFreeFrm() const { return bAtCnt || bLayout; }
+ BOOL IsFlyLayFrm() const { return bLayout; }
+ BOOL IsFlyAtCntFrm() const { return bAtCnt; }
+
+ BOOL IsNotifyBack() const { return bNotifyBack; }
+ void SetNotifyBack() { bNotifyBack = TRUE; }
+ void ResetNotifyBack() { bNotifyBack = FALSE; }
+ BOOL IsNoShrink() const { return bNoShrink; }
+ void SetNoShrink( BOOL bNew ) { bNoShrink = bNew; }
+
+ BOOL IsClipped() const { return bHeightClipped || bWidthClipped; }
+ BOOL IsHeightClipped() const { return bHeightClipped; }
+ BOOL IsWidthClipped() const { return bWidthClipped; }
+
+ BOOL IsLowerOf( const SwLayoutFrm *pUpper ) const;
+ inline BOOL IsUpperOf( const SwFlyFrm *pLower ) const;
+
+
+ SwRect AddSpacesToFrm() const;
+
+ // OD 16.04.2003 #i13147# - add parameter <_bForPaint> to avoid load of
+ // the graphic during paint. Default value: sal_False
+ BOOL GetContour( PolyPolygon& rContour,
+ const sal_Bool _bForPaint = sal_False ) const;
+
+ BOOL ConvertHoriTo40( SwHoriOrient &rHori, SwRelationOrient &rRel, SwTwips &rPos ) const;
+
+ //Auf dieser Shell painten (PreView, Print-Flag usw. rekursiv beachten)?.
+
+ /** SwFlyFrm::IsBackgroundTransparent - for feature #99657#
+
+ OD 12.08.2002
+ determines, if background of fly frame has to be drawn transparent
+ definition found in /core/layout/paintfrm.cxx
+
+ @author OD
+
+ @return true, if background color is transparent or a existing background
+ graphic is transparent.
+ */
+ sal_Bool IsBackgroundTransparent() const;
+};
+
+inline BOOL SwFlyFrm::IsUpperOf( const SwFlyFrm *pLower ) const
+{
+ return pLower->IsLowerOf( this );
+}
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/flyfrms.hxx b/binfilter/bf_sw/source/core/inc/flyfrms.hxx
new file mode 100644
index 000000000000..08a8355c7b07
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/flyfrms.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLYFRMS_HXX
+#define _FLYFRMS_HXX
+
+#include "flyfrm.hxx"
+namespace binfilter {
+
+//Basisklasse fuer diejenigen Flys, die sich relativ frei Bewegen koennen -
+//also die nicht _im_ Inhalt gebundenen Flys.
+class SwFlyFreeFrm : public SwFlyFrm
+{
+ SwPageFrm *pPage; //Bei dieser Seite ist der Fly angemeldet.
+
+ void CheckClip( const SwFmtFrmSize &rSz ); //'Emergency' Clipping.
+
+protected:
+ virtual void NotifyBackground( SwPageFrm *pPage,
+ const SwRect& rRect, PrepareHint eHint);
+
+
+ SwFlyFreeFrm( SwFlyFrmFmt*, SwFrm *pAnchor );
+public:
+
+ virtual ~SwFlyFreeFrm();
+
+ virtual void MakeAll();
+
+ SwPageFrm *GetPage() { return pPage; }
+ const SwPageFrm *GetPage() const { return pPage; }
+ void SetPage( SwPageFrm *pNew ) { pPage = pNew; }
+};
+
+
+//Die Fly's, die an einem Layoutfrm haengen und nicht inhaltsgebunden sind
+class SwFlyLayFrm : public SwFlyFreeFrm
+{
+public:
+ SwFlyLayFrm( SwFlyFrmFmt*, SwFrm *pAnchor );
+ SwFlyLayFrm( SwFlyLayFrm& );
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+
+};
+
+//Die Flys, die an einem Cntnt haengen nicht aber im Inhalt
+class SwFlyAtCntFrm : public SwFlyFreeFrm
+{
+ SwRect aLastCharRect; // Fuer autopositionierte Frames ( LAYER_IMPL )
+protected:
+ //Stellt sicher, das der Fly an der richtigen Seite haengt.
+ void AssertPage();
+
+ virtual void MakeAll();
+ virtual void MakeFlyPos();
+public:
+ SwFlyAtCntFrm( SwFlyFrmFmt*, SwFrm *pAnchor );
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+
+
+ // Fuer autopositionierte Frames ( LAYER_IMPL ), ueberprueft, ob sich
+ // die Ankerposition geaendert hat und invalidiert ggf.
+
+ SwTwips GetLastCharX() const { return aLastCharRect.Left() - Frm().Left(); }
+
+ SwTwips GetRelCharX( const SwFrm* pFrm ) const
+ { return aLastCharRect.Left() - pFrm->Frm().Left(); }
+ SwTwips GetRelCharY( const SwFrm* pFrm ) const
+ { return aLastCharRect.Bottom() - pFrm->Frm().Top(); }
+
+ void AddLastCharY( long nDiff ){ aLastCharRect.Pos().Y() += nDiff; }
+};
+
+//Die Flys, die an einem Zeichen in einem Cntnt haengen.
+class SwFlyInCntFrm : public SwFlyFrm
+{
+ Point aRef; //Relativ zu diesem Point wird die AbsPos berechnet.
+ long nLine; //Zeilenhoehe, Ref.Y() - nLine == Zeilenanfang.
+
+ BOOL bInvalidLayout :1;
+ BOOL bInvalidCntnt :1;
+
+ virtual void MakeFlyPos();
+
+protected:
+ virtual void NotifyBackground( SwPageFrm *pPage,
+ const SwRect& rRect, PrepareHint eHint);
+ virtual void MakeAll();
+
+public:
+ SwFlyInCntFrm( SwFlyFrmFmt*, SwFrm *pAnchor );
+
+ virtual ~SwFlyInCntFrm();
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+
+ void SetRefPoint( const Point& rPoint, const Point &rRelAttr,
+ const Point &rRelPos );
+ const Point &GetRefPoint() const { return aRef; }
+ const Point &GetRelPos() const;
+ long GetLineHeight() const { return nLine; }
+
+ inline void InvalidateLayout() const;
+ inline void InvalidateCntnt() const;
+ inline void ValidateLayout() const;
+ inline void ValidateCntnt() const;
+ BOOL IsInvalid() const { return (bInvalidLayout || bInvalidCntnt); }
+ BOOL IsInvalidLayout() const { return bInvalidLayout; }
+ BOOL IsInvalidCntnt() const { return bInvalidCntnt; }
+
+
+ //BP 26.11.93: vgl. tabfrm.hxx, gilt bestimmt aber fuer andere auch...
+ //Zum Anmelden der Flys nachdem ein FlyCnt erzeugt _und_ eingefuegt wurde.
+ //Muss vom Erzeuger gerufen werden, denn erst nach dem Konstruieren wird
+ //Das Teil gepastet; mithin ist auch erst dann die Seite zum Anmelden der
+ //Flys erreichbar.
+ void RegistFlys();
+
+ //siehe layact.cxx
+ void AddRefOfst( long nOfst ) { aRef.Y() += nOfst; }
+};
+
+inline void SwFlyInCntFrm::InvalidateLayout() const
+{
+ ((SwFlyInCntFrm*)this)->bInvalidLayout = TRUE;
+}
+inline void SwFlyInCntFrm::InvalidateCntnt() const
+{
+ ((SwFlyInCntFrm*)this)->bInvalidCntnt = TRUE;
+}
+inline void SwFlyInCntFrm::ValidateLayout() const
+{
+ ((SwFlyInCntFrm*)this)->bInvalidLayout = FALSE;
+}
+inline void SwFlyInCntFrm::ValidateCntnt() const
+{
+ ((SwFlyInCntFrm*)this)->bInvalidCntnt = FALSE;
+}
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/fntcache.hxx b/binfilter/bf_sw/source/core/inc/fntcache.hxx
new file mode 100644
index 000000000000..baa1c9ecc773
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/fntcache.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FNTCACHE_HXX
+#define _FNTCACHE_HXX
+
+
+#include <vcl/font.hxx>
+#include <tools/mempool.hxx>
+
+#include "swtypes.hxx"
+#include "swcache.hxx"
+/*N*/ #include <tools/debug.hxx> //for stripping
+class Printer;
+class OutputDevice;
+class FontMetric;
+namespace binfilter {
+
+class SwFntObj;
+class SwDrawTextInfo; // DrawText
+class SwScriptInfo;
+class ViewShell;
+class SwSubFont;
+
+/*************************************************************************
+ * class SwFntCache
+ *************************************************************************/
+
+class SwFntCache : public SwCache
+{
+public:
+
+ inline SwFntCache() : SwCache(50,50
+#ifdef DBG_UTIL
+ , ByteString( RTL_CONSTASCII_STRINGPARAM(
+ "Globaler Font-Cache pFntCache" ))
+#endif
+ ) {}
+
+ inline SwFntObj *First( ) { return (SwFntObj *)SwCache::First(); }
+ inline SwFntObj *Next( SwFntObj *pFntObj)
+ { return (SwFntObj *)SwCache::Next( (SwCacheObj *)pFntObj ); }
+ void Flush();
+};
+
+// Font-Cache, globale Variable, in txtinit.Cxx angelegt/zerstoert
+extern SwFntCache *pFntCache;
+extern SwFntObj *pLastFont;
+extern BYTE *pMagicNo;
+extern Color *pWaveCol;
+
+/*************************************************************************
+ * class SwFntObj
+ *************************************************************************/
+
+class SwFntObj : public SwCacheObj
+{
+ friend class SwFntAccess;
+ friend void _InitCore();
+ friend void _FinitCore();
+
+ Font aFont;
+ Font *pScrFont;
+ Font *pPrtFont;
+ OutputDevice* pPrinter;
+ USHORT nLeading;
+ USHORT nScrAscent;
+ USHORT nPrtAscent;
+ USHORT nScrHeight;
+ USHORT nPrtHeight;
+ USHORT nPropWidth;
+ USHORT nZoom;
+ BOOL bSymbol : 1;
+ BOOL bPaintBlank : 1;
+ void ChooseFont( ViewShell *pSh, OutputDevice *pOut );
+
+ static long nPixWidth;
+ static MapMode *pPixMap;
+ static OutputDevice *pPixOut;
+
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL(SwFntObj)
+
+ SwFntObj( const SwSubFont &rFont, const void* pOwner,
+ ViewShell *pSh );
+
+ virtual ~SwFntObj();
+
+ inline Font *GetScrFont() { return pScrFont; }
+ inline Font *GetFont() { return &aFont; }
+ inline const Font *GetFont() const { return &aFont; }
+
+ inline USHORT GetLeading() const { return nLeading; }
+
+ void GuessLeading( const ViewShell *pSh, const FontMetric& rMet );
+ USHORT GetAscent( const ViewShell *pSh, const OutputDevice *pOut );
+ USHORT GetHeight( const ViewShell *pSh, const OutputDevice *pOut );
+
+ void SetDevFont( const ViewShell *pSh, OutputDevice *pOut );
+ inline OutputDevice* GetPrt() const { return pPrinter; }
+ inline USHORT GetZoom() const { return nZoom; }
+ inline USHORT GetPropWidth() const { return nPropWidth; }
+ inline BOOL IsSymbol() const { return bSymbol; }
+
+ Size GetTextSize( SwDrawTextInfo &rInf );
+
+ void CreateScrFont( const ViewShell *pSh, const OutputDevice& rOut );
+ void CreatePrtFont( const OutputDevice& rOut );
+};
+
+/*************************************************************************
+ * class SwFntAccess
+ *************************************************************************/
+
+
+class SwFntAccess : public SwCacheAccess
+{
+ ViewShell *pShell;
+protected:
+ virtual SwCacheObj *NewObj( );
+
+public:
+ SwFntAccess( const void * &rMagic, USHORT &rIndex, const void *pOwner,
+ ViewShell *pShell,
+ BOOL bCheck = FALSE );
+ inline SwFntObj* Get() { return (SwFntObj*) SwCacheAccess::Get(); };
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/frame.hxx b/binfilter/bf_sw/source/core/inc/frame.hxx
new file mode 100644
index 000000000000..69269f4dd1f0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/frame.hxx
@@ -0,0 +1,1093 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FRAME_HXX
+#define _FRAME_HXX
+
+#include <bf_svtools/svarray.hxx>
+#include "swtypes.hxx" // fuer SwTwips
+#include "swrect.hxx"
+#include "calbck.hxx" // fuer SwClient
+#include <tools/debug.hxx>
+
+#define SZPTR
+#define PHEIGHT
+#define PWIDTH
+#define BFIXHEIGHT bFixSize
+#define PTPTR PointPtr
+#define SIZEPTR SizePtr
+typedef long Size::* SizePtr;
+typedef long Point::* PointPtr;
+class Brush;
+class Color;
+
+namespace binfilter {
+class SfxPoolItem;
+
+class SwLayoutFrm;
+class SwRootFrm;
+class SwPageFrm;
+class SwFlyFrm;
+class SwSectionFrm;
+class SdrObject;
+class SwDrawContact;
+class SwFtnFrm;
+class SwFtnBossFrm;
+class SwTabFrm;
+class SwFlowFrm;
+class SwCntntFrm;
+
+class SwAttrSet;
+class ViewShell;
+class SwBorderAttrs;
+class SwCache;
+class SvxBrushItem;
+class SwTxtFtn;
+struct SwPosition;
+struct SwCrsrMoveState;
+// OD 20.05.2003 #108784#
+class SwDrawVirtObj;
+
+//Jeder FrmTyp findet sich hier in einem Bit wieder.
+//Die Bits muessen so gesetzt werden, dass mit einer Maskierung festgestellt
+//werden kann was fuer ein FrmTyp eine Instanz ist _und_ von welchen Klassen
+//sie abgeleitet ist.
+//Der Frm hat in der Basisklasse einen Member der von den CToren der
+//einzelnen Frms entsprechend gesetzt werden muss.
+#define FRM_ROOT 0x0001
+#define FRM_PAGE 0x0002
+#define FRM_COLUMN 0x0004
+#define FRM_HEADER 0x0008
+#define FRM_FOOTER 0x0010
+#define FRM_FTNCONT 0x0020
+#define FRM_FTN 0x0040
+#define FRM_BODY 0x0080
+#define FRM_FLY 0x0100
+#define FRM_SECTION 0x0200
+#define FRM_UNUSED 0x0400
+#define FRM_TAB 0x0800
+#define FRM_ROW 0x1000
+#define FRM_CELL 0x2000
+#define FRM_TXT 0x4000
+#define FRM_NOTXT 0x8000
+
+//Fuer den internen Gebrauch ein paar gebraeuchliche Verknuepfungen.
+#define FRM_LAYOUT 0x3FFF
+#define FRM_CNTNT 0xC000
+#define FRM_FTNBOSS 0x0006
+#ifdef ACCESSIBLE_LAYOUT
+#define FRM_ACCESSIBLE (FRM_HEADER|FRM_FOOTER|FRM_FTN|FRM_TXT|FRM_ROOT|FRM_FLY|FRM_TAB|FRM_CELL|FRM_PAGE)
+#endif
+
+ //Weils so schon ist das ganze als Bitfeld....
+//0000 0000 0000 0001 ROOT
+//0000 0000 0000 0010 PAGE
+//0000 0000 0000 0100 COLUMN
+//0000 0000 0000 1000 HEADER
+//0000 0000 0001 0000 FOOTER
+//0000 0000 0010 0000 FTNCONT
+//0000 0000 0100 0000 FTN
+//0000 0000 1000 0000 BODY
+//0000 0001 0000 0000 FLY
+//0000 0010 0000 0000 SECTION
+//0000 0100 0000 0000 UNUSED
+//0000 1000 0000 0000 TAB
+//0001 0000 0000 0000 ROW
+//0010 0000 0000 0000 CELL
+//0100 0000 0000 0000 TXT
+//1000 0000 0000 0000 NOTXT
+
+// The type of the frame is internal represented by the 4-bit value nType,
+// which can expanded to the types above by shifting a bit (0x1 << nType)
+// Here are the corresponding defines for the compressed representation:
+
+#define FRMC_ROOT 0
+#define FRMC_PAGE 1
+#define FRMC_COLUMN 2
+#define FRMC_HEADER 3
+#define FRMC_FOOTER 4
+#define FRMC_FTNCONT 5
+#define FRMC_FTN 6
+#define FRMC_BODY 7
+#define FRMC_FLY 8
+#define FRMC_SECTION 9
+#define FRMC_UNUSED 10
+#define FRMC_TAB 11
+#define FRMC_ROW 12
+#define FRMC_CELL 13
+#define FRMC_TXT 14
+#define FRMC_NOTXT 15
+
+#define FRM_NEIGHBOUR 0x2004
+#define FRM_NOTE_VERT 0x5a60
+#define FRM_HEADFOOT 0x0018
+#define FRM_BODYFTNC 0x00a0
+
+class SwFrm;
+typedef long (SwFrm:: *SwFrmGet)() const;
+typedef BOOL (SwFrm:: *SwFrmMax)( long );
+typedef void (SwFrm:: *SwFrmMakePos)( const SwFrm*, const SwFrm*, BOOL );
+typedef long (*SwOperator)( long, long );
+typedef void (SwFrm:: *SwFrmSet)( long, long );
+
+struct SwRectFnCollection
+{
+ SwRectGet fnGetTop;
+ SwRectGet fnGetBottom;
+ SwRectGet fnGetLeft;
+ SwRectGet fnGetRight;
+ SwRectGet fnGetWidth;
+ SwRectGet fnGetHeight;
+ SwRectPoint fnGetPos;
+ SwRectSize fnGetSize;
+
+ SwRectSet fnSetTop;
+ SwRectSet fnSetBottom;
+ SwRectSet fnSetLeft;
+ SwRectSet fnSetRight;
+ SwRectSet fnSetWidth;
+ SwRectSet fnSetHeight;
+
+ SwRectSet fnSubTop;
+ SwRectSet fnAddBottom;
+ SwRectSet fnSubLeft;
+ SwRectSet fnAddRight;
+ SwRectSet fnAddWidth;
+ SwRectSet fnAddHeight;
+
+ SwRectSet fnSetPosX;
+ SwRectSet fnSetPosY;
+
+ SwFrmGet fnGetTopMargin;
+ SwFrmGet fnGetBottomMargin;
+ SwFrmGet fnGetLeftMargin;
+ SwFrmGet fnGetRightMargin;
+ SwFrmSet fnSetXMargins;
+ SwFrmSet fnSetYMargins;
+ SwFrmGet fnGetPrtTop;
+ SwFrmGet fnGetPrtBottom;
+ SwFrmGet fnGetPrtLeft;
+ SwFrmGet fnGetPrtRight;
+ SwRectDist fnTopDist;
+ SwRectDist fnBottomDist;
+ SwRectDist fnLeftDist;
+ SwRectDist fnRightDist;
+ SwFrmMax fnSetLimit;
+ SwRectMax fnOverStep;
+
+ SwRectSetPos fnSetPos;
+ SwFrmMakePos fnMakePos;
+ SwOperator fnXDiff;
+ SwOperator fnYDiff;
+ SwOperator fnXInc;
+ SwOperator fnYInc;
+
+ SwRectSetTwice fnSetLeftAndWidth;
+ SwRectSetTwice fnSetTopAndHeight;
+};
+
+typedef SwRectFnCollection* SwRectFn;
+extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R;
+
+#define SWRECTFN( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \
+ sal_Bool bRev = pFrm->IsReverse(); \
+ SwRectFn fnRect = bVert ? \
+ ( bRev ? fnRectVL2R : fnRectVert ): \
+ ( bRev ? fnRectB2T : fnRectHori );
+#define SWRECTFNX( pFrm ) sal_Bool bVertX = pFrm->IsVertical(); \
+ sal_Bool bRevX = pFrm->IsReverse(); \
+ SwRectFn fnRectX = bVertX ? \
+ ( bRevX ? fnRectVL2R : fnRectVert ): \
+ ( bRevX ? fnRectB2T : fnRectHori );
+#define SWREFRESHFN( pFrm ) { if( bVert != pFrm->IsVertical() || \
+ bRev != pFrm->IsReverse() ) \
+ bVert = pFrm->IsVertical(); \
+ bRev = pFrm->IsReverse(); \
+ fnRect = bVert ? \
+ ( bRev ? fnRectVL2R : fnRectVert ): \
+ ( bRev ? fnRectB2T : fnRectHori ); }
+#define SWRECTFN2( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \
+ sal_Bool bNeighb = pFrm->IsNeighbourFrm(); \
+ SwRectFn fnRect = bVert == bNeighb ? \
+ fnRectHori : fnRectVert;
+#define POS_DIFF( aFrm1, aFrm2 ) \
+ ( (aFrm1.*fnRect->fnGetTop)() != (aFrm2.*fnRect->fnGetTop)() || \
+ (aFrm1.*fnRect->fnGetLeft)() != (aFrm2.*fnRect->fnGetLeft)() )
+
+
+//fuer Prepare() zur Benachrichtigung des Inhaltes durch das Layout auf
+//dem kurzen Dienstweg.
+//Der Inhalt sorgt dafuer, dass beim naechsten Aufruf von ::Format() das
+//minimal notwendige berechnet wird.
+enum PrepareHint
+{
+ PREP_BEGIN, //BEGIN
+ PREP_CLEAR = PREP_BEGIN,//Komplett neuformatieren.
+ PREP_WIDOWS_ORPHANS, //Nur Witwen- und Waisen-Regelung pruefen und ggf.
+ //Aufspalten.
+ PREP_FIXSIZE_CHG, //Die FixSize hat sich veraendert.
+ PREP_FOLLOW_FOLLOWS, //Follow ist jetzt moeglicherweise direkter
+ //Nachbar.
+ PREP_ADJUST_FRM, //Groesse per Grow/Shrink Ausrichten ohne zu
+ //Formatieren.
+ PREP_FLY_CHGD, //Ein FlyFrm hat sich (Groesse) veraendert.
+ PREP_FLY_ATTR_CHG, //Ein FlyFrm hat seine Attribute veraendert
+ //(z.B. Umlauf)
+ PREP_FLY_ARRIVE, //Ein FlyFrm ueberlappt den Bereich jetzt neu.
+ PREP_FLY_LEAVE, //Ein FlyFrm hat den Bereich verlassen.
+ PREP_FTN, //Fussnoten-Invalidierung
+ PREP_POS_CHGD, //Position des Frm hat sich verandert
+ //(Zum Fly-Umbruch pruefen). Im void* des Prepare()
+ //wird ein BOOL& uebergeben, dieser zeigt mit TRUE,
+ //dass ein Format ausgefuehrt wurde.
+ PREP_UL_SPACE, //UL-Space hat sich veraendert, TxtFrms muessen
+ //den Zeilenabstand neu kalkulieren.
+ PREP_MUST_FIT, //Frm passen machen (aufspalten) auch wenn die
+ //Attribute es nicht erlauben (z.B. zusammenhalten).
+ PREP_WIDOWS, // Ein Follow stellt fest, dass in ihm die Orphans-
+ // regel zuschlaegt und verschickt an seinen
+ // Vorgaenger (Master/Follow) ein PREP_WIDOWS
+ PREP_QUOVADIS, // Wenn eine Fussnote _zwischen_ zwei Absaetzen
+ // aufgespalten werden muss, dann muss der
+ // letzte auf der Seite noch ein QUOVADIS bekommen
+ // damit er den Text hineinformatiert.
+ PREP_BOSS_CHGD, // Wenn ein Frm die Spalte/Seite wechselt, wird dieses
+ // Zusatzprepare zum POS_CHGD im MoveFwd/Bwd
+ // verschickt (Ftn-Nummern joinen etc.)
+ // Die Richtung wird ueber pVoid mitgeteilt:
+ // MoveFwd: pVoid == 0
+ // MoveBwd: pVoid == pOldPage
+ PREP_SWAP, //Grafiken Swappen, fuer Grafiken im sichtbaren
+ //Bereich.
+ PREP_REGISTER, //Registerhaltige Frames invalidieren
+ PREP_FTN_GONE, //Ein Follow verliert eine Fussnote, ggf. kann seine erste
+ //Zeile hochrutschen
+ PREP_MOVEFTN, //eine Fussnote wechselt die Seite, der Inhalt bekommt
+ //zunaechst eine Hoehe von Null, damit nicht zuviel
+ //Unruhe entsteht. Beim Formatieren prueft er, ob er
+ //ueberhaupt passt und wechselt ggf. unbemerkt wieder
+ //die Seite.
+ PREP_ERGOSUM, //wg. Bewegung in FtnFrms QuoVadis/ErgoSum pruefen
+ PREP_END //END
+};
+
+//Fuer GetNextLeaf/GetPrevLeaf.
+enum MakePageType
+{
+ MAKEPAGE_NONE, //Keine Seite bzw. Fussnote anlegen
+ MAKEPAGE_APPEND, //Nur ggf. Seite anhaengen
+ MAKEPAGE_INSERT, //Seite ggf. anhaengen oder einfuegen.
+ MAKEPAGE_FTN, //Fussnote ggf. einfuegen.
+ MAKEPAGE_NOSECTION // Don't create section frames
+};
+
+typedef SdrObject* SdrObjectPtr;
+SV_DECL_PTRARR(SwDrawObjs,SdrObjectPtr,1,1)//STRIP008 ;
+
+class SwFrm: public SwClient
+{
+ //Der verkappte Frm
+ friend class SwFlowFrm;
+ friend class SwLayoutFrm; // Sw3FrameIo: fuer pNext, pPrev
+ friend class SwLooping; // LoopControlling (layouter.cxx)
+
+ //Hebt die Lower waehrend eines Spaltenumbaus auf.
+ friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart = NULL );
+ friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling );
+
+ //Checkt ob sich beim MakePos die Pos des Frm aendert oder nicht
+ //layact.cxx
+ friend BOOL CheckPos( SwFrm *pFrm );
+
+ //entfernt leere SwSectionFrms aus einer Kette
+ friend SwFrm* SwClearDummies( SwFrm* pFrm );
+
+ //Zum validieren eines unsinnig invalidierten in SwCntntFrm::MakeAll
+ friend void ValidateSz( SwFrm *pFrm );
+ // Implementiert in text/txtftn.cxx, verhindert Ftn-Oszillation
+ friend void ValidateTxt( SwFrm *pFrm );
+
+// friend void CalcAnchorAndKeep( SwFlyFrm * );
+
+ friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt );
+
+ //Cache fuer (Umrandungs-)Attribute.
+ static SwCache *pCache;
+
+#ifdef DBG_UTIL
+ //Nur zu Debugging Zwecken! eindeutige Nummerierung aller Frames,
+ //verwaltet in den CToren.
+ static USHORT nLastFrmId;
+ const USHORT nFrmId;
+#endif
+
+ SwLayoutFrm *pUpper;
+ SwFrm *pNext;
+ SwFrm *pPrev;
+
+ //Schatten und Umrandung painten
+ SwFrm *_FindNext();
+ SwFrm *_FindPrev();
+ SwCntntFrm *_FindNextCnt();
+
+ void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE & );
+ SwFrm* _GetIndPrev();
+ SwFrm* _GetIndNext();
+ void SetDirFlags( BOOL bVert );
+
+ SwFrm( SwFrm & ); //Kopieren ist nicht erlaubt.
+
+ SwCntntFrm* ImplGetNextCntntFrm() const;
+ SwCntntFrm* ImplGetPrevCntntFrm() const;
+
+protected:
+ SwDrawObjs *pDrawObjs; //Hier haengen die DrawObjs, kann 0 sein
+
+ SwRect aFrm; //Absolute Dokumentposition und groesse des Frm
+ SwRect aPrt; //Position der PrtArea rel zum Frm und groesse der PrtArea
+
+ USHORT bFlag01: 1;
+ USHORT bFlag02: 1;
+ USHORT bFlag03: 1;
+ USHORT bFlag04: 1;
+ USHORT bFlag05: 1;
+ USHORT bReverse: 1; // Next line above/at the right side instead
+ // under/at the left side of the previous line.
+ USHORT bInvalidR2L: 1;
+ USHORT bDerivedR2L: 1;
+ USHORT bRightToLeft: 1;
+ USHORT bInvalidVert: 1;
+ USHORT bDerivedVert: 1;
+ USHORT bVertical: 1;
+ USHORT nType: 4; //Who am I?
+
+ BOOL bValidPos: 1;
+ BOOL bValidPrtArea: 1;
+ BOOL bValidSize: 1;
+ BOOL bValidLineNum: 1;
+ BOOL bFixSize: 1;
+ BOOL bUnUsed1: 1;
+ BOOL bCompletePaint: 1; //Frame wird ganz gepaintet wenn TRUE, auch
+ //wenn der Inhalt nur teilw. veraendert ist;
+ //Bei CntntFrms wird ausschliesslich wenn TRUE
+ //der Border (von Action) gemalt.
+ BOOL bRetouche: 1; //Der Frame ist fuer Retusche verantwortlich
+ //wenn TRUE.
+public:
+ BOOL bUnUsed2: 1;
+protected:
+ BOOL bInfInvalid: 1; //InfoFlags sind Invalid.
+ BOOL bInfBody: 1; //Frm steht im DokumentBody.
+ BOOL bInfTab: 1; //Frm steht in einer Tabelle.
+ BOOL bInfFly: 1; //Frm steht in einem Fly.
+ BOOL bInfFtn: 1; //Frm steht in einer Fussnote.
+ BOOL bInfSct: 1; //Frm steht in einem Bereich.
+ BOOL bColLocked: 1; //Grow/Shrink sperren bei spaltigen Section-
+ //oder Fly-Frames, wird im Format gesetzt
+
+ void ColLock() { bColLocked = TRUE; }
+ void ColUnlock() { bColLocked = FALSE; }
+
+ SwPageFrm *InsertPage( SwPageFrm *pSibling, BOOL bFtn );
+ void PrepareMake();
+ void OptPrepareMake();
+ void MakePos();
+ virtual void MakeAll() = 0;
+ //Adjustierung der Frames einer Seite
+ SwTwips AdjustNeighbourhood( SwTwips nDiff, BOOL bTst = FALSE );
+
+
+ //Aendern nur die Framesize, nicht die PrtArea-SSize
+ virtual SwTwips ShrinkFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE ) = 0;
+ virtual SwTwips GrowFrm ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE ) = 0;
+
+ SwModify *GetDep() { return pRegisteredIn; }
+ const SwModify *GetDep() const { return pRegisteredIn; }
+
+ SwFrm( SwModify* );
+
+ void CheckDir( UINT16 nDir, BOOL bVert, BOOL bOnlyBiDi, BOOL bBrowse );
+public:
+ TYPEINFO(); //Bereits in Basisklasse Client drin.
+
+ USHORT GetType() const { return 0x1 << nType; }
+
+ static SwCache &GetCache() { return *pCache; }
+ static SwCache *GetCachePtr() { return pCache; }
+ static void SetCache( SwCache *pNew ) { pCache = pNew; }
+
+ //Aendern die PrtArea-SSize und die FrmSize.
+ SwTwips Shrink( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ SwTwips Grow ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+
+ //Wir brauchen unterschiedliche Methoden (wg. Performance) fuer das
+ //Einfuegenin den Layout Baum:
+
+ //Einfuegen vor pBehind oder am Ende der Kette unter pUpper
+ void InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind );
+ //Einfuegen hinter pBefore oder am Anfang der Kette unter pUpper
+ void InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore );
+ //Einfuegen vor pBehind oder am Ende der Kette, unter Beruecksichtigung
+ //der Geschwister von pSct
+ void Remove();
+
+ //For internal use only; wer es anders macht wird
+ //in einen Sack gesteckt und muss zwei Tage drin hocken bleiben.
+ //Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch (Tabellen).
+ SwLayoutFrm *GetLeaf( MakePageType eMakePage, BOOL bFwd );
+ SwLayoutFrm *GetNextLeaf ( MakePageType eMakePage );
+ SwLayoutFrm *GetNextSctLeaf( MakePageType eMakePage );
+ SwLayoutFrm *GetPrevLeaf ( MakePageType eMakeFtn = MAKEPAGE_FTN );
+ SwLayoutFrm *GetPrevSctLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN );
+ const SwLayoutFrm *GetLeaf ( MakePageType eMakePage, BOOL bFwd,
+ const SwFrm *pAnch ) const;
+ BOOL WrongPageDesc( SwPageFrm* pNew );
+
+ void AppendDrawObj( SwDrawContact *pObj );
+ void RemoveDrawObj( SwDrawContact *pToRemove );
+ // OD 20.05.2003 #108784# - <AppendDrawObj>/<RemoveDrawObj> for virtual drawing objects
+ void AppendVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj );
+ void RemoveVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj );
+
+ //Arbeiten mit der Kette der FlyFrms
+ void AppendFly( SwFlyFrm *pNew );
+ void RemoveFly( SwFlyFrm *pToRemove );
+ const SwDrawObjs *GetDrawObjs() const { return pDrawObjs; }
+ SwDrawObjs *GetDrawObjs() { return pDrawObjs; }
+ void CalcFlys( BOOL bInvaPosOnly );
+
+
+ //Retouche, nicht im Bereich des uebergebenen Rect!
+
+
+ inline void SetCompletePaint() const;
+ inline void ResetCompletePaint() const;
+ inline BOOL IsCompletePaint() const { return bCompletePaint; }
+
+ inline void SetRetouche() const;
+ inline void ResetRetouche() const;
+ inline BOOL IsRetouche() const { return bRetouche; }
+
+ void SetInfFlags(); //Setzen der InfoFlags
+ inline void InvalidateInfFlags() { bInfInvalid = TRUE; }
+ inline BOOL IsInDocBody() const; //Benutzen die InfoFlags.
+ inline BOOL IsInFtn() const; //ggf. werden die Flags ermittelt.
+ inline BOOL IsInTab() const;
+ inline BOOL IsInFly() const;
+ inline BOOL IsInSct() const;
+ inline BOOL IsReverse() const { return bReverse; }
+ inline void SetReverse( BOOL bNew ){ bReverse = bNew ? 1 : 0; }
+ inline BOOL IsVertical() const;
+ inline BOOL GetVerticalFlag() const;
+ inline void SetVertical( BOOL bNew ){ bVertical = bNew ? 1 : 0; }
+ inline void SetDerivedVert( BOOL bNew ){ bDerivedVert = bNew ? 1 : 0; }
+ inline void SetInvalidVert( BOOL bNew) { bInvalidVert = bNew ? 1 : 0; }
+ inline BOOL IsRightToLeft() const;
+ inline BOOL GetRightToLeftFlag() const;
+ inline void SetRightToLeft( BOOL bNew ){ bRightToLeft = bNew ? 1 : 0; }
+ inline void SetDerivedR2L( BOOL bNew ) { bDerivedR2L = bNew ? 1 : 0; }
+ inline void SetInvalidR2L( BOOL bNew ) { bInvalidR2L = bNew ? 1 : 0; }
+ void CheckDirChange();
+ // returns upper left frame position for LTR and
+ // upper right frame position for Asian / RTL frames
+ Point GetFrmAnchorPos( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const;
+ BOOL IsMoveable() const;
+
+ //Ist es fuer den (Txt)Frm in der aktuellen Umgebung erlaubt eine
+ //Fussnote einzufuegen (nicht z.B. in wiederholten TabellenHeadlines).
+ BOOL IsFtnAllowed() const;
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 ){DBG_BF_ASSERT(0, "STRIP");} //STRIP001 virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+
+ virtual void CheckDirection( BOOL bVert );
+
+ void ReinitializeFrmSizeAttrFlags();
+
+ const SwAttrSet *GetAttrSet() const;
+ SwAttrSet *GetAttrSet();
+ void GetAttrSet( SwAttrSet* );
+
+ inline BOOL HasFixSize() const { return bFixSize; }
+
+ //Kann 0 liefern, pruefen auch ob die Shell zum richtigen Dokument
+ //gehoert. Impl in frmsh.hxx
+ inline ViewShell *GetShell() const;
+
+ //Prueft alle Seiten ab der Uebergebenen und korrigiert ggf.
+ static void CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields = TRUE );
+
+ //Koennen 0 liefern, einmal const einmal nicht
+ SwFrm *GetNext() { return pNext; }
+ SwFrm *GetPrev() { return pPrev; }
+ SwLayoutFrm *GetUpper() { return pUpper; }
+ SwRootFrm *FindRootFrm();
+ SwPageFrm *FindPageFrm();
+ SwFrm *FindColFrm();
+ SwFtnBossFrm *FindFtnBossFrm( BOOL bFootnotes = FALSE );
+ SwTabFrm *ImplFindTabFrm();
+ SwFtnFrm *ImplFindFtnFrm();
+ SwFlyFrm *ImplFindFlyFrm();
+ SwSectionFrm *ImplFindSctFrm();
+ SwFrm *FindFooterOrHeader();
+ SwFrm *GetLower();
+ const SwFrm *GetNext() const { return pNext; }
+ const SwFrm *GetPrev() const { return pPrev; }
+ const SwLayoutFrm *GetUpper() const { return pUpper; }
+ inline SwTabFrm *FindTabFrm();
+ inline SwFtnFrm *FindFtnFrm();
+ inline SwFlyFrm *FindFlyFrm();
+ inline SwSectionFrm *FindSctFrm();
+ inline SwFrm *FindNext();
+ inline SwCntntFrm *FindNextCnt();
+ inline SwFrm *FindPrev();
+ inline const SwPageFrm *FindPageFrm() const;
+ inline const SwRootFrm *FindRootFrm() const;
+ inline const SwFtnBossFrm *FindFtnBossFrm( BOOL bFtn = FALSE ) const;
+ inline const SwFrm *FindColFrm() const;
+ inline const SwFrm *FindFooterOrHeader() const;
+ inline const SwTabFrm *FindTabFrm() const;
+ inline const SwFtnFrm *FindFtnFrm() const;
+ inline const SwFlyFrm *FindFlyFrm() const;
+ inline const SwSectionFrm *FindSctFrm() const;
+ inline const SwFrm *FindNext() const;
+ inline const SwCntntFrm *FindNextCnt() const;
+ inline const SwFrm *FindPrev() const;
+ const SwFrm *GetLower() const;
+
+ SwFrm* GetIndPrev()
+ { return ( pPrev || !IsInSct() ) ? pPrev : _GetIndPrev(); }
+ const SwFrm* GetIndPrev() const { return ((SwFrm*)this)->GetIndPrev(); }
+ SwFrm* GetIndNext()
+ { return ( pNext || !IsInSct() ) ? pNext : _GetIndNext(); }
+ const SwFrm* GetIndNext() const { return ((SwFrm*)this)->GetIndNext(); }
+
+ USHORT GetPhyPageNum() const; //Seitennummer ohne Offset
+ USHORT GetVirtPageNum() const; //Seitenummer mit Offset
+ BOOL OnRightPage() const { return 0 != GetPhyPageNum() % 2; };
+ BOOL WannaRightPage() const;
+
+ const SwLayoutFrm *GetPrevLayoutLeaf() const;
+ const SwLayoutFrm *GetNextLayoutLeaf() const;
+ inline SwLayoutFrm *GetPrevLayoutLeaf();
+ inline SwLayoutFrm *GetNextLayoutLeaf();
+
+ inline void Calc() const; //Hier wird ggf. 'Formatiert'
+ inline void OptCalc() const; //Hier wird zur Optimierung davon ausgegangen,
+ //das die Vorgaenger bereits formatiert sind.
+
+ inline Point GetRelPos() const;
+ const SwRect &Frm() const { return aFrm; }
+ const SwRect &Prt() const { return aPrt; }
+
+ // The PaintArea is the area, where content may be displayed.
+ // The margin of the page or the space between columns belongs to her.
+ const SwRect PaintArea() const;
+ // The UnionFrm is the union of frm- and prt-area, normally identical
+ // to the frm-area except the case of negative prt-margins.
+ const SwRect UnionFrm( BOOL bBorder = FALSE ) const;
+
+ //Der Zugriff auf die Member wird hier ausnahmsweiste gestattet,
+ //dies soll aber nicht dazu dienen die Werte wahllos zu veraendern;
+ //es ist nur die einzige Moeglichkeit die Compilerprobleme zu umgehen
+ //(gleiche Methode mal public mal protected).
+ SwRect &Frm() { return aFrm; }
+ SwRect &Prt() { return aPrt; }
+
+ virtual void ChgSize( const Size& aNewSize );
+
+ virtual void Cut() = 0;
+ virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) = 0;
+
+ void ValidateLineNum() { bValidLineNum = TRUE; }
+
+ BOOL GetValidPosFlag() const { return bValidPos; }
+ BOOL GetValidPrtAreaFlag()const { return bValidPrtArea; }
+ BOOL GetValidSizeFlag() const { return bValidSize; }
+ BOOL GetValidLineNumFlag()const { return bValidLineNum; }
+ BOOL IsValid() const { return bValidPos && bValidSize && bValidPrtArea; }
+
+ //Invalideren nur den Frm
+ void _InvalidateSize() { bValidSize = FALSE; }
+ void _InvalidatePrt() { bValidPrtArea = FALSE; }
+ void _InvalidatePos() { bValidPos = FALSE; }
+ void _InvalidateLineNum() { bValidLineNum = FALSE; }
+ void _InvalidateAll() { bValidSize = bValidPrtArea = bValidPos = FALSE; }
+
+ //Benachrichtigen gleich die Seite mit.
+ inline void InvalidateSize();
+ inline void InvalidatePrt();
+ inline void InvalidatePos();
+ inline void InvalidateLineNum();
+ inline void InvalidateAll();
+ void ImplInvalidateSize();
+ void ImplInvalidatePrt();
+ void ImplInvalidatePos();
+ void ImplInvalidateLineNum();
+
+ inline void InvalidateNextPos( BOOL bNoFtn = FALSE );
+ void ImplInvalidateNextPos( BOOL bNoFtn = FALSE );
+ void InvalidatePage( const SwPageFrm *pPage = 0 ) const;
+
+ virtual BOOL GetCrsrOfst( SwPosition *, Point&,
+ const SwCrsrMoveState* = 0 ) const{DBG_BF_ASSERT(0, "STRIP"); return FALSE;} //STRIP001 const SwCrsrMoveState* = 0 ) const;
+ virtual BOOL GetCharRect( SwRect &, const SwPosition&,
+ SwCrsrMoveState* = 0 ) const;
+
+ // der "kurze Dienstweg" zwischen den Frames und der Formatierung.
+ // Wer den void* falsch Casted ist selbst schuld!
+ // Auf jedenfall muss der void* auf 0 geprueft werden.
+ virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
+ const void *pVoid = 0, BOOL bNotify = TRUE );
+
+ //TRUE wenn's die richtige Klasse ist, FALSE sonst
+ inline BOOL IsLayoutFrm() const;
+ inline BOOL IsRootFrm() const;
+ inline BOOL IsPageFrm() const;
+ inline BOOL IsColumnFrm() const;
+ inline BOOL IsFtnBossFrm() const; // Fussnotenbosse sind PageFrms und ColumnFrms
+ inline BOOL IsHeaderFrm() const;
+ inline BOOL IsFooterFrm() const;
+ inline BOOL IsFtnContFrm() const;
+ inline BOOL IsFtnFrm() const;
+ inline BOOL IsBodyFrm() const;
+ inline BOOL IsColBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb ColumnFrm
+ inline BOOL IsPageBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb PageFrm
+ inline BOOL IsFlyFrm() const;
+ inline BOOL IsSctFrm() const;
+ inline BOOL IsTabFrm() const;
+ inline BOOL IsRowFrm() const;
+ inline BOOL IsCellFrm() const;
+ inline BOOL IsCntntFrm() const;
+ inline BOOL IsTxtFrm() const;
+ inline BOOL IsNoTxtFrm() const;
+ inline BOOL IsFlowFrm() const; //Frms deren PrtArea von den Nachbarn
+ //abhaengen und die halt im Inhaltsfluss
+ //stehen.
+ inline BOOL IsRetoucheFrm() const; //Frms die Retouchefaehig sind bzw. die
+ //u.U. hinter sich Retouchieren muessen.
+#ifdef ACCESSIBLE_LAYOUT
+ inline BOOL IsAccessibleFrm() const;
+#endif
+
+
+ //Ist der Frm (bzw. die Section in der er steht) geschuetzt?
+ //Auch Fly in Fly in ... und Fussnoten
+ BOOL IsProtected() const;
+
+ BOOL IsColLocked() const { return bColLocked; }
+
+ virtual ~SwFrm();
+
+ // No inline cause we need the function pointers
+ long GetTopMargin() const;
+ long GetBottomMargin() const;
+ long GetLeftMargin() const;
+ long GetRightMargin() const;
+ void SetTopBottomMargins( long, long );
+ void SetBottomTopMargins( long, long );
+ void SetLeftRightMargins( long, long );
+ void SetRightLeftMargins( long, long );
+ void SetLeftAndWidth( long nLeft, long nWidth );
+ void SetTopAndHeight( long nTop, long nHeight );
+ void SetRightAndWidth( long nRight, long nWidth );
+ void SetBottomAndHeight( long nBottom, long nHeight );
+ long GetPrtLeft() const;
+ long GetPrtBottom() const;
+ long GetPrtRight() const;
+ long GetPrtTop() const;
+ BOOL SetMinLeft( long );
+ BOOL SetMaxBottom( long );
+ BOOL SetMaxRight( long );
+ BOOL SetMinTop( long );
+ void MakeBelowPos( const SwFrm*, const SwFrm*, BOOL );
+ void MakeUpperPos( const SwFrm*, const SwFrm*, BOOL );
+ void MakeLeftPos( const SwFrm*, const SwFrm*, BOOL );
+ void MakeRightPos( const SwFrm*, const SwFrm*, BOOL );
+ inline BOOL IsNeighbourFrm() const
+ { return GetType() & FRM_NEIGHBOUR ? TRUE : FALSE; }
+
+ inline SwCntntFrm* GetNextCntntFrm() const;
+ inline SwCntntFrm* GetPrevCntntFrm() const;
+
+#ifdef DBG_UTIL
+ inline USHORT GetFrmId() const { return nFrmId; }
+ inline USHORT GetLastFrmId() const { return nLastFrmId; }
+#endif
+};
+
+inline BOOL SwFrm::IsInDocBody() const
+{
+ if ( bInfInvalid )
+ ((SwFrm*)this)->SetInfFlags();
+ return bInfBody;
+}
+inline BOOL SwFrm::IsInFtn() const
+{
+ if ( bInfInvalid )
+ ((SwFrm*)this)->SetInfFlags();
+ return bInfFtn;
+}
+inline BOOL SwFrm::IsInTab() const
+{
+ if ( bInfInvalid )
+ ((SwFrm*)this)->SetInfFlags();
+ return bInfTab;
+}
+inline BOOL SwFrm::IsInFly() const
+{
+ if ( bInfInvalid )
+ ((SwFrm*)this)->SetInfFlags();
+ return bInfFly;
+}
+inline BOOL SwFrm::IsInSct() const
+{
+ if ( bInfInvalid )
+ ((SwFrm*)this)->SetInfFlags();
+ return bInfSct;
+}
+BOOL SwFrm::IsVertical() const
+{
+ if( bInvalidVert )
+ ((SwFrm*)this)->SetDirFlags( TRUE );
+ return bVertical != 0;
+}
+BOOL SwFrm::GetVerticalFlag() const
+{
+ return bVertical != 0;
+}
+inline BOOL SwFrm::IsRightToLeft() const
+{
+ if( bInvalidR2L )
+ ((SwFrm*)this)->SetDirFlags( FALSE );
+ return bRightToLeft != 0;
+}
+BOOL SwFrm::GetRightToLeftFlag() const
+{
+ return bRightToLeft != 0;
+}
+
+inline void SwFrm::SetCompletePaint() const
+{
+ ((SwFrm*)this)->bCompletePaint = TRUE;
+}
+inline void SwFrm::ResetCompletePaint() const
+{
+ ((SwFrm*)this)->bCompletePaint = FALSE;
+}
+
+inline void SwFrm::SetRetouche() const
+{
+ ((SwFrm*)this)->bRetouche = TRUE;
+}
+inline void SwFrm::ResetRetouche() const
+{
+ ((SwFrm*)this)->bRetouche = FALSE;
+}
+
+inline SwLayoutFrm *SwFrm::GetPrevLayoutLeaf()
+{
+ return (SwLayoutFrm*)((const SwFrm*)this)->GetPrevLayoutLeaf();
+}
+inline SwLayoutFrm *SwFrm::GetNextLayoutLeaf()
+{
+ return (SwLayoutFrm*)((const SwFrm*)this)->GetNextLayoutLeaf();
+}
+
+inline void SwFrm::InvalidateSize()
+{
+ if ( bValidSize )
+ ImplInvalidateSize();
+}
+inline void SwFrm::InvalidatePrt()
+{
+ if ( bValidPrtArea )
+ ImplInvalidatePrt();
+}
+inline void SwFrm::InvalidatePos()
+{
+ if ( bValidPos )
+ ImplInvalidatePos();
+}
+inline void SwFrm::InvalidateLineNum()
+{
+ if ( bValidLineNum )
+ ImplInvalidateLineNum();
+}
+
+inline void SwFrm::InvalidateAll()
+{
+ if ( bValidPrtArea && bValidSize && bValidPos )
+ ImplInvalidatePos();
+ bValidPrtArea = bValidSize = bValidPos = FALSE;
+}
+
+inline void SwFrm::InvalidateNextPos( BOOL bNoFtn )
+{
+ if ( pNext && !pNext->IsSctFrm() )
+ pNext->InvalidatePos();
+#ifndef C30 // vielleicht geht es ja bei C40 ?
+ else
+ ImplInvalidateNextPos( bNoFtn );
+#else
+ if ( !pNext )
+ ImplInvalidateNextPos( bNoFtn );
+#endif
+}
+
+inline void SwFrm::Calc() const
+{
+ if ( !bValidPos || !bValidPrtArea || !bValidSize )
+ ((SwFrm*)this)->PrepareMake();
+}
+inline void SwFrm::OptCalc() const
+{
+ if ( !bValidPos || !bValidPrtArea || !bValidSize )
+ ((SwFrm*)this)->OptPrepareMake();
+}
+
+inline Point SwFrm::GetRelPos() const
+{
+ Point aRet( aFrm.Pos() );
+ //hier wird gecasted, weil die Klasse SwLayoutFrm nur vorward-
+ //declariert ist.
+ aRet -= ((SwFrm*)GetUpper())->Prt().Pos();
+ aRet -= ((SwFrm*)GetUpper())->Frm().Pos();
+ return aRet;
+}
+
+inline const SwPageFrm *SwFrm::FindPageFrm() const
+{
+ return ((SwFrm*)this)->FindPageFrm();
+}
+inline const SwRootFrm *SwFrm::FindRootFrm() const
+{
+ return ((SwFrm*)this)->FindRootFrm();
+}
+inline const SwFrm *SwFrm::FindColFrm() const
+{
+ return ((SwFrm*)this)->FindColFrm();
+}
+inline const SwFrm *SwFrm::FindFooterOrHeader() const
+{
+ return ((SwFrm*)this)->FindFooterOrHeader();
+}
+inline SwTabFrm *SwFrm::FindTabFrm()
+{
+ return IsInTab() ? ImplFindTabFrm() : 0;
+}
+inline const SwFtnBossFrm *SwFrm::FindFtnBossFrm( BOOL bFtn ) const
+{
+ return ((SwFrm*)this)->FindFtnBossFrm( bFtn );
+}
+inline SwFtnFrm *SwFrm::FindFtnFrm()
+{
+ return IsInFtn() ? ImplFindFtnFrm() : 0;
+}
+inline SwFlyFrm *SwFrm::FindFlyFrm()
+{
+ return IsInFly() ? ImplFindFlyFrm() : 0;
+}
+inline SwSectionFrm *SwFrm::FindSctFrm()
+{
+ return IsInSct() ? ImplFindSctFrm() : 0;
+}
+
+
+inline const SwTabFrm *SwFrm::FindTabFrm() const
+{
+ return IsInTab() ? ((SwFrm*)this)->ImplFindTabFrm() : 0;
+}
+inline const SwFtnFrm *SwFrm::FindFtnFrm() const
+{
+ return IsInFtn() ? ((SwFrm*)this)->ImplFindFtnFrm() : 0;
+}
+inline const SwFlyFrm *SwFrm::FindFlyFrm() const
+{
+ return IsInFly() ? ((SwFrm*)this)->ImplFindFlyFrm() : 0;
+}
+inline const SwSectionFrm *SwFrm::FindSctFrm() const
+{
+ return IsInSct() ? ((SwFrm*)this)->ImplFindSctFrm() : 0;
+}
+inline SwFrm *SwFrm::FindNext()
+{
+ if ( pNext )
+ return pNext;
+ else
+ return _FindNext();
+}
+inline const SwFrm *SwFrm::FindNext() const
+{
+ if ( pNext )
+ return pNext;
+ else
+ return ((SwFrm*)this)->_FindNext();
+}
+inline SwCntntFrm *SwFrm::FindNextCnt()
+{
+ if ( pNext && pNext->IsCntntFrm() )
+ return (SwCntntFrm*)pNext;
+ else
+ return _FindNextCnt();
+}
+inline const SwCntntFrm *SwFrm::FindNextCnt() const
+{
+ if ( pNext && pNext->IsCntntFrm() )
+ return (SwCntntFrm*)pNext;
+ else
+ return ((SwFrm*)this)->_FindNextCnt();
+}
+inline SwFrm *SwFrm::FindPrev()
+{
+ if ( pPrev && !pPrev->IsSctFrm() )
+ return pPrev;
+ else
+ return _FindPrev();
+}
+inline const SwFrm *SwFrm::FindPrev() const
+{
+ if ( pPrev && !pPrev->IsSctFrm() )
+ return pPrev;
+ else
+ return ((SwFrm*)this)->_FindPrev();
+}
+
+
+inline SwCntntFrm *SwFrm::GetNextCntntFrm() const
+{
+ if ( GetNext() && GetNext()->IsCntntFrm() )
+ return (SwCntntFrm*)GetNext();
+ else
+ return ImplGetNextCntntFrm();
+}
+inline SwCntntFrm *SwFrm::GetPrevCntntFrm() const
+{
+ if ( GetPrev() && GetPrev()->IsCntntFrm() )
+ return (SwCntntFrm*)GetPrev();
+ else
+ return ImplGetPrevCntntFrm();
+}
+
+
+inline BOOL SwFrm::IsLayoutFrm() const
+{
+ return GetType() & FRM_LAYOUT ? TRUE : FALSE;
+}
+inline BOOL SwFrm::IsRootFrm() const
+{
+ return nType == FRMC_ROOT;
+}
+inline BOOL SwFrm::IsPageFrm() const
+{
+ return nType == FRMC_PAGE;
+}
+inline BOOL SwFrm::IsColumnFrm() const
+{
+ return nType == FRMC_COLUMN;
+}
+inline BOOL SwFrm::IsFtnBossFrm() const
+{
+ return GetType() & FRM_FTNBOSS ? TRUE : FALSE;
+}
+inline BOOL SwFrm::IsHeaderFrm() const
+{
+ return nType == FRMC_HEADER;
+}
+inline BOOL SwFrm::IsFooterFrm() const
+{
+ return nType == FRMC_FOOTER;
+}
+inline BOOL SwFrm::IsFtnContFrm() const
+{
+ return nType == FRMC_FTNCONT;
+}
+inline BOOL SwFrm::IsFtnFrm() const
+{
+ return nType == FRMC_FTN;
+}
+inline BOOL SwFrm::IsBodyFrm() const
+{
+ return nType == FRMC_BODY;
+}
+inline BOOL SwFrm::IsFlyFrm() const
+{
+ return nType == FRMC_FLY;
+}
+inline BOOL SwFrm::IsSctFrm() const
+{
+ return nType == FRMC_SECTION;
+}
+inline BOOL SwFrm::IsTabFrm() const
+{
+ return nType == FRMC_TAB;
+}
+inline BOOL SwFrm::IsRowFrm() const
+{
+ return nType == FRMC_ROW;
+}
+inline BOOL SwFrm::IsCellFrm() const
+{
+ return nType == FRMC_CELL;
+}
+inline BOOL SwFrm::IsCntntFrm() const
+{
+ return GetType() & FRM_CNTNT ? TRUE : FALSE;
+}
+inline BOOL SwFrm::IsTxtFrm() const
+{
+ return nType == FRMC_TXT;
+}
+inline BOOL SwFrm::IsNoTxtFrm() const
+{
+ return nType == FRMC_NOTXT;
+}
+inline BOOL SwFrm::IsFlowFrm() const
+{
+ return GetType() & 0xCA00 ? TRUE : FALSE; //TabFrm, CntntFrm, SectionFrm
+}
+inline BOOL SwFrm::IsRetoucheFrm() const
+{
+ return GetType() & 0xCA40 ? TRUE : FALSE; //TabFrm, CntntFrm, SectionFrm, Ftnfrm
+}
+#ifdef ACCESSIBLE_LAYOUT
+inline BOOL SwFrm::IsAccessibleFrm() const
+{
+ return GetType() & FRM_ACCESSIBLE ? TRUE : FALSE;
+}
+#endif
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/frmsh.hxx b/binfilter/bf_sw/source/core/inc/frmsh.hxx
new file mode 100644
index 000000000000..b19099dc0a82
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/frmsh.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FRMSH_HXX
+#define _FRMSH_HXX
+
+#include "rootfrm.hxx"
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* SwFrm::GetShell()
+|*
+|* Beschreibung Liefert die aktuelle Shell, ggf. auch NULL.
+|* Ersterstellung MA 14. Aug. 92
+|* Letzte Aenderung MA 18. Feb. 99
+|*
+|*************************************************************************/
+
+inline ViewShell * SwFrm::GetShell() const
+{
+ const SwRootFrm *pRoot;
+ if ( 0 != (pRoot = FindRootFrm()) )
+ return pRoot->GetCurrShell();
+ return 0;
+}
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/frmtool.hxx b/binfilter/bf_sw/source/core/inc/frmtool.hxx
new file mode 100644
index 000000000000..fe106393caad
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/frmtool.hxx
@@ -0,0 +1,460 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FRMTOOL_HXX
+#define _FRMTOOL_HXX
+
+#include "swtypes.hxx"
+#include "layfrm.hxx"
+#include "frmatr.hxx"
+#include "swcache.hxx"
+class BigInt;
+class OutputDevice;
+namespace binfilter {
+
+class SwPageFrm;
+class SwFlyFrm;
+class SwCntntFrm;
+class SwFtnContFrm;
+class SwDoc;
+class SwAttrSet;
+class SdrObject;
+
+class SvxBrushItem;
+class SdrMarkList;
+class SwNodeIndex;
+
+class SwPageDesc;
+class SwCrsrShell;
+// OD 21.05.2003 #108789#
+class SwTxtFrm;
+
+#if defined(MSC)
+#define MA_FASTCALL __fastcall
+#else
+#define MA_FASTCALL
+#endif
+
+#define WEIT_WECH LONG_MAX - 20000 //Initale Position der Flys.
+#define BROWSE_HEIGHT 56700L * 10L //10 Meter
+
+#define GRFNUM_NO 0
+#define GRFNUM_YES 1
+#define GRFNUM_REPLACE 2
+
+//Painten des Hintergrunds. Mit Brush oder Graphic.
+// OD 05.08.2002 #99657# - add 6th parameter to indicate that method should
+// consider background transparency, saved in the color of the brush item
+void MA_FASTCALL DrawGraphic( const SvxBrushItem *, OutputDevice *,
+ const SwRect &rOrg, const SwRect &rOut, const BYTE nGrfNum = GRFNUM_NO,
+ const sal_Bool bConsiderBackgroundTransparency = sal_False );
+
+// OD 24.01.2003 #106593# - method to align graphic rectangle
+// Created declaration here to avoid <extern> declarations
+void SwAlignGrfRect( SwRect *pGrfRect, const OutputDevice &rOut );
+
+//Fly besorgen, wenn keine List hineingereicht wird, wir die der aktuellen
+//Shell benutzt.
+//Implementierung in feshview.cxx
+SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, ViewShell *pSh );
+
+SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart );
+void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling );
+
+//Nicht gleich die math.lib anziehen.
+ULONG MA_FASTCALL SqRt( BigInt nX );
+
+//CntntNodes besorgen, CntntFrms erzeugen und in den LayFrm haengen.
+void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, ULONG nIndex,
+ BOOL bPages = FALSE, ULONG nEndIndex = 0,
+ SwFrm *pPrv = 0 );
+
+//Erzeugen der Frames fuer einen bestimmten Bereich, verwendet _InsertCnt
+void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
+ const SwNodeIndex &rEndIdx );
+
+//Um z.B. fuer Tabelleheadlines das Erzeugen der Flys in _InsertCnt zu unterbinden.
+extern FASTBOOL bDontCreateObjects;
+
+//Fuer FlyCnts, siehe SwFlyAtCntFrm::MakeAll()
+extern FASTBOOL bSetCompletePaintOnInvalidate;
+
+//Fuer Tabelleneinstellung per Tastatur.
+long MA_FASTCALL CalcRowRstHeight( SwLayoutFrm *pRow );
+long MA_FASTCALL CalcHeightWidthFlys( const SwFrm *pFrm ); //MA_FLY_HEIGHT
+
+//Neue Seite einsetzen
+SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
+ BOOL bOdd, BOOL bInsertEmpty, BOOL bFtn,
+ SwFrm *pSibling );
+
+//Flys bei der Seite anmelden.
+void RegistFlys( SwPageFrm*, const SwLayoutFrm* );
+
+//Benachrichtung des Fly Hintergrundes wenn Notwendig.
+void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld );
+
+void Notify_Background( SdrObject *pObj, SwPageFrm *pPage, const SwRect& rRect,
+ const PrepareHint eHint, const BOOL bInva );
+
+const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos );
+
+BOOL Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj );
+
+const SwFrm *FindKontext( const SwFrm *pFrm, USHORT nAdditionalKontextTyp );
+
+BOOL IsFrmInSameKontext( const SwFrm *pInnerFrm, const SwFrm *pFrm );
+
+void MA_ParkCrsr( SwPageDesc *pDesc, SwCrsrShell &rSh );
+
+const SwFrm * MA_FASTCALL FindPage( const SwRect &rRect, const SwFrm *pPage );
+
+// JP 07.05.98: wird von SwCntntNode::GetFrm und von SwFlyFrm::GetFrm
+// gerufen
+SwFrm* GetFrmOfModify( SwModify&, USHORT nFrmType, const Point* = 0,
+ const SwPosition *pPos = 0,
+ const BOOL bCalcFrm = FALSE );
+
+//Sollen ExtraDaten (Reline-Strich, Zeilennummern) gepaintet werden?
+FASTBOOL IsExtraData( const SwDoc *pDoc );
+
+// OD 14.03.2003 #i11760# - method declaration <CalcCntnt(..)>
+void CalcCntnt( SwLayoutFrm *pLay,
+ bool bNoColl = false,
+ bool bNoCalcFollow = false );
+
+
+//Die Notify-Klassen merken sich im CTor die aktuellen Groessen und fuehren
+//im DTor ggf. die notwendigen Benachrichtigungen durch.
+
+class SwFrmNotify
+{
+protected:
+ SwFrm *pFrm;
+ const SwRect aFrm;
+ const SwRect aPrt;
+ SwTwips mnFlyAnchorOfst;
+ SwTwips mnFlyAnchorOfstNoWrap;
+ FASTBOOL bHadFollow;
+ FASTBOOL bInvaKeep;
+#ifdef ACCESSIBLE_LAYOUT
+ FASTBOOL bValidSize;
+#endif
+
+public:
+ SwFrmNotify( SwFrm *pFrm );
+ ~SwFrmNotify();
+
+ const SwRect &Frm() const { return aFrm; }
+ const SwRect &Prt() const { return aPrt; }
+ void SetInvaKeep() { bInvaKeep = TRUE; }
+};
+
+class SwLayNotify : public SwFrmNotify
+{
+ SwTwips nHeightOfst;
+ SwTwips nWidthOfst;
+ FASTBOOL bLowersComplete;
+
+ SwLayoutFrm *GetLay() { return (SwLayoutFrm*)pFrm; }
+public:
+ SwLayNotify( SwLayoutFrm *pLayFrm );
+ ~SwLayNotify();
+
+ void AddHeightOfst ( SwTwips nAdd ) { nHeightOfst += nAdd; }
+ void AddWidthOfst ( SwTwips nAdd ) { nHeightOfst += nAdd; }
+ void SubtractHeightOfst( SwTwips nSub ) { nWidthOfst -= nSub; }
+ void SubtractWidthOfst ( SwTwips nSub ) { nWidthOfst -= nSub; }
+ SwTwips GetHeightOfst() const { return nHeightOfst; }
+ SwTwips GetWidthOfst() const { return nWidthOfst; }
+ void ResetHeightOfst() { nHeightOfst = 0; }
+ void ResetWidthOfst() { nWidthOfst = 0; }
+
+ void SetLowersComplete( FASTBOOL b ) { bLowersComplete = b; }
+ FASTBOOL IsLowersComplete() { return bLowersComplete; }
+};
+
+class SwFlyNotify : public SwLayNotify
+{
+ SwPageFrm *pOldPage;
+ const SwRect aFrmAndSpace;
+ SwFlyFrm *GetFly() { return (SwFlyFrm*)pFrm; }
+public:
+ SwFlyNotify( SwFlyFrm *pFlyFrm );
+ ~SwFlyNotify();
+
+ SwPageFrm *GetOldPage() const { return pOldPage; }
+};
+
+class SwCntntNotify : public SwFrmNotify
+{
+ SwCntntFrm *GetCnt() { return (SwCntntFrm*)pFrm; }
+public:
+ SwCntntNotify( SwCntntFrm *pCntFrm );
+ ~SwCntntNotify();
+};
+
+//SwBorderAttrs kapselt die Berechnung fuer die Randattribute inclusive
+//Umrandung. Die Attribute und die errechneten Werte werden gecached.
+//Neu: Die gesammte Klasse wird gecached.
+
+//!!!Achtung: Wenn weitere Attribute gecached werden muss unbedingt die
+//Methode Modify::Modify mitgepflegt werden!!!
+
+// OD 23.01.2003 #106895# - delete old method <SwBorderAttrs::CalcRight()> and
+// the stuff that belongs to it.
+class SwBorderAttrs : public SwCacheObj
+{
+ const SwAttrSet &rAttrSet;
+ const SvxULSpaceItem &rUL;
+ const SvxLRSpaceItem &rLR;
+ const SvxBoxItem &rBox;
+ const SvxShadowItem &rShadow;
+ const Size aFrmSize; //Die FrmSize
+
+ BOOL bBorderDist :1; //Ist's ein Frm der auch ohne Linie
+ //einen Abstand haben kann?
+
+ //Mit den Folgenden Bools werden die gecache'ten Werte fuer UNgueltig
+ //erklaert - bis sie einmal berechnet wurden.
+ BOOL bTopLine :1;
+ BOOL bBottomLine :1;
+ BOOL bLeftLine :1;
+ BOOL bRightLine :1;
+ BOOL bTop :1;
+ BOOL bBottom :1;
+ BOOL bLine :1;
+
+ BOOL bIsLine :1; //Umrandung an mind. einer Kante?
+
+ BOOL bCacheGetLine :1; //GetTopLine(), GetBottomLine() cachen?
+ BOOL bCachedGetTopLine :1; //GetTopLine() gecached?
+ BOOL bCachedGetBottomLine :1; //GetBottomLine() gecached?
+ // OD 21.05.2003 #108789# - booleans indicating, if values <bJoinedWithPrev>
+ // and <bJoinedWithNext> are cached and valid.
+ // Caching depends on value of <bCacheGetLine>.
+ mutable BOOL bCachedJoinedWithPrev :1;
+ mutable BOOL bCachedJoinedWithNext :1;
+ // OD 21.05.2003 #108789# - booleans indicating, if borders are joined
+ // with previous/next frame.
+ BOOL bJoinedWithPrev :1;
+ BOOL bJoinedWithNext :1;
+
+ //Die gecache'ten Werte, undefiniert bis sie einmal berechnet wurden.
+ USHORT nTopLine,
+ nBottomLine,
+ nLeftLine,
+ nRightLine,
+ nTop,
+ nBottom,
+ nGetTopLine,
+ nGetBottomLine;
+
+ //Nur die Lines + Shadow errechnen.
+ void _CalcTopLine();
+ void _CalcBottomLine();
+ void _CalcLeftLine();
+ void _CalcRightLine();
+
+ //Lines + Shadow + Abstaende
+ void _CalcTop();
+ void _CalcBottom();
+
+
+ void _GetTopLine ( const SwFrm *pFrm );
+ void _GetBottomLine( const SwFrm *pFrm );
+
+ // OD 21.05.2003 #108789# - private methods to calculate cached values
+ // <bJoinedWithPrev> and <bJoinedWithNext>.
+ void _CalcJoinedWithPrev( const SwFrm& _rFrm );
+ void _CalcJoinedWithNext( const SwFrm& _rFrm );
+
+ // OD 21.05.2003 #108789# - internal helper method for methods
+ // <_CalcJoinedWithPrev> and <_CalcJoinedWithNext>.
+ BOOL _JoinWithCmp( const SwFrm& _rCallerFrm,
+ const SwFrm& _rCmpFrm ) const;
+
+ //Rechte und linke Linie sowie LRSpace gleich?
+ // OD 21.05.2003 #108789# - change name of 1st parameter - "rAttrs" -> "rCmpAttrs".
+ BOOL CmpLeftRight( const SwBorderAttrs &rCmpAttrs,
+ const SwFrm *pCaller,
+ const SwFrm *pCmp ) const;
+
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL(SwBorderAttrs)
+
+ SwBorderAttrs( const SwModify *pOwner, const SwFrm *pConstructor );
+ ~SwBorderAttrs();
+
+ inline const SwAttrSet &GetAttrSet() const { return rAttrSet; }
+ inline const SvxULSpaceItem &GetULSpace() const { return rUL; }
+ inline const SvxLRSpaceItem &GetLRSpace() const { return rLR; }
+ inline const SvxBoxItem &GetBox() const { return rBox; }
+ inline const SvxShadowItem &GetShadow() const { return rShadow; }
+
+ inline USHORT CalcTopLine() const;
+ inline USHORT CalcBottomLine() const;
+ inline USHORT CalcLeftLine() const;
+ inline USHORT CalcRightLine() const;
+ inline USHORT CalcTop() const;
+ inline USHORT CalcBottom() const;
+ long CalcLeft( const SwFrm *pCaller ) const;
+ long CalcRight( const SwFrm *pCaller ) const;
+
+
+ inline const Size &GetSize() const { return aFrmSize; }
+
+ inline BOOL IsBorderDist() const { return bBorderDist; }
+
+ //Sollen obere bzw. untere Umrandung fuer den Frm ausgewertet werden?
+ inline USHORT GetTopLine ( const SwFrm *pFrm ) const;
+ inline USHORT GetBottomLine( const SwFrm *pFrm ) const;
+ inline void SetGetCacheLine( BOOL bNew ) const;
+ // OD 21.05.2003 #108789# - accessors for cached values <bJoinedWithPrev>
+ // and <bJoinedWithPrev>
+ BOOL JoinedWithPrev( const SwFrm& _rFrm ) const;
+ BOOL JoinedWithNext( const SwFrm& _rFrm ) const;
+};
+
+class SwBorderAttrAccess : public SwCacheAccess
+{
+ const SwFrm *pConstructor; //opt: Zur weitergabe an SwBorderAttrs
+protected:
+ virtual SwCacheObj *NewObj();
+
+public:
+ SwBorderAttrAccess( SwCache &rCache, const SwFrm *pOwner );
+
+ SwBorderAttrs *Get();
+};
+
+//---------------------------------------------------------------------
+//Iterator fuer die DrawObjecte einer Seite. Die Objecte werden Nach ihrer
+//Z-Order iteriert.
+//Das iterieren ist nicht eben billig, denn fuer alle Operationen muss jeweils
+//ueber das gesamte SortArray iteriert werden.
+class SwOrderIter
+{
+ const SwPageFrm *pPage;
+ const SdrObject *pCurrent;
+ const FASTBOOL bFlysOnly;
+public:
+ SwOrderIter( const SwPageFrm *pPage, FASTBOOL bFlysOnly = TRUE );
+
+ void Current( const SdrObject *pNew ) { pCurrent = pNew; }
+ const SdrObject *Current() const { return pCurrent; }
+ const SdrObject *operator()() const { return pCurrent; }
+ const SdrObject *Bottom();
+ const SdrObject *Next();
+};
+
+
+class StackHack
+{
+ static BYTE nCnt;
+ static BOOL bLocked;
+public:
+ StackHack()
+ {
+ if ( ++StackHack::nCnt > 50 )
+ StackHack::bLocked = TRUE;
+ }
+ ~StackHack()
+ {
+ if ( --StackHack::nCnt == 0 )
+ StackHack::bLocked = FALSE;
+ }
+
+ static BOOL IsLocked() { return StackHack::bLocked; }
+ static BYTE Count() { return StackHack::nCnt; }
+};
+
+
+//Sollen obere bzw. untere Umrandung fuer den Frm ausgewertet werden?
+inline USHORT SwBorderAttrs::GetTopLine ( const SwFrm *pFrm ) const
+{
+ if ( !bCachedGetTopLine )
+ ((SwBorderAttrs*)this)->_GetTopLine( pFrm );
+ return nGetTopLine;
+}
+inline USHORT SwBorderAttrs::GetBottomLine( const SwFrm *pFrm ) const
+{
+ if ( !bCachedGetBottomLine )
+ ((SwBorderAttrs*)this)->_GetBottomLine( pFrm );
+ return nGetBottomLine;
+}
+inline void SwBorderAttrs::SetGetCacheLine( BOOL bNew ) const
+{
+ ((SwBorderAttrs*)this)->bCacheGetLine = bNew;
+ ((SwBorderAttrs*)this)->bCachedGetBottomLine =
+ ((SwBorderAttrs*)this)->bCachedGetTopLine = FALSE;
+ // OD 21.05.2003 #108789# - invalidate cache for values <bJoinedWithPrev>
+ // and <bJoinedWithNext>.
+ bCachedJoinedWithPrev = FALSE;
+ bCachedJoinedWithNext = FALSE;
+}
+
+inline USHORT SwBorderAttrs::CalcTopLine() const
+{
+ if ( bTopLine )
+ ((SwBorderAttrs*)this)->_CalcTopLine();
+ return nTopLine;
+}
+inline USHORT SwBorderAttrs::CalcBottomLine() const
+{
+ if ( bBottomLine )
+ ((SwBorderAttrs*)this)->_CalcBottomLine();
+ return nBottomLine;
+}
+inline USHORT SwBorderAttrs::CalcLeftLine() const
+{
+ if ( bLeftLine )
+ ((SwBorderAttrs*)this)->_CalcLeftLine();
+ return nLeftLine;
+}
+inline USHORT SwBorderAttrs::CalcRightLine() const
+{
+ if ( bRightLine )
+ ((SwBorderAttrs*)this)->_CalcRightLine();
+ return nRightLine;
+}
+inline USHORT SwBorderAttrs::CalcTop() const
+{
+ if ( bTop )
+ ((SwBorderAttrs*)this)->_CalcTop();
+ return nTop;
+}
+inline USHORT SwBorderAttrs::CalcBottom() const
+{
+ if ( bBottom )
+ ((SwBorderAttrs*)this)->_CalcBottom();
+ return nBottom;
+}
+} //namespace binfilter
+#endif //_FRMTOOL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/ftnboss.hxx b/binfilter/bf_sw/source/core/inc/ftnboss.hxx
new file mode 100644
index 000000000000..9eb0ad7167c9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/ftnboss.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FTNBOSS_HXX
+#define _FTNBOSS_HXX
+
+#include "layfrm.hxx"
+namespace binfilter {
+
+class SwFtnBossFrm;
+class SwFtnContFrm;
+class SwFtnFrm;
+class SwTxtFtn;
+
+
+//Setzen des maximalen Fussnotenbereiches. Restaurieren des alten Wertes im DTor.
+//Implementierung im ftnfrm.cxx
+class SwSaveFtnHeight
+{
+ SwFtnBossFrm *pBoss;
+ const SwTwips nOldHeight;
+ SwTwips nNewHeight;
+public:
+ SwSaveFtnHeight( SwFtnBossFrm *pBs, const SwTwips nDeadLine );
+ ~SwSaveFtnHeight();
+};
+
+#define NA_ONLY_ADJUST 0
+#define NA_GROW_SHRINK 1
+#define NA_GROW_ADJUST 2
+#define NA_ADJUST_GROW 3
+
+class SwFtnBossFrm: public SwLayoutFrm
+{
+ //Fuer die privaten Fussnotenoperationen
+ friend class SwFrm;
+ friend class SwSaveFtnHeight;
+ friend class SwPageFrm; // fuer das Setzen der MaxFtnHeight
+
+ //Maximale Hoehe des Fussnotencontainers fuer diese Seite.
+ SwTwips nMaxFtnHeight;
+
+ SwFtnContFrm *MakeFtnCont();
+ SwFtnFrm *FindFirstFtn();
+ BYTE _NeighbourhoodAdjustment( const SwFrm* pFrm ) const;
+protected:
+
+ void InsertFtn( SwFtnFrm * );
+ static void ResetFtn( const SwFtnFrm *pAssumed );
+public:
+ inline SwFtnBossFrm( SwFrmFmt* pFmt) : SwLayoutFrm( pFmt ) {}
+
+ SwLayoutFrm *FindBodyCont();
+ inline const SwLayoutFrm *FindBodyCont() const;
+ inline void SetMaxFtnHeight( const SwTwips nNewMax ) { nMaxFtnHeight = nNewMax; }
+
+ //Fussnotenschnittstelle
+ void AppendFtn( SwCntntFrm *, SwTxtFtn * );
+ void RemoveFtn( const SwCntntFrm *, const SwTxtFtn *, BOOL bPrep = TRUE );
+ static SwFtnFrm *FindFtn( const SwCntntFrm *, const SwTxtFtn * );
+ SwFtnContFrm *FindFtnCont();
+ inline const SwFtnContFrm *FindFtnCont() const;
+ const SwFtnFrm *FindFirstFtn( SwCntntFrm* ) const;
+ SwFtnContFrm *FindNearestFtnCont( BOOL bDontLeave = FALSE );
+
+ void RearrangeFtns( const SwTwips nDeadLine, const BOOL bLock = FALSE,
+ const SwTxtFtn *pAttr = 0 );
+
+ //SS damit der Textformatierer Temporaer die Fussnotenhoehe begrenzen
+ //kann. DeadLine in Dokumentkoordinaten.
+ void SetFtnDeadLine( const SwTwips nDeadLine );
+ SwTwips GetMaxFtnHeight() const { return nMaxFtnHeight; }
+
+ //Liefert den Wert, der noch uebrig ist, bis der Body seine minimale
+ //Hoehe erreicht hat.
+ SwTwips GetVarSpace() const;
+
+ //Layoutseitig benoetigte Methoden
+ /// OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFtns> and
+ /// <_pRefFtnBossFrm> in order to control, if only footnotes, which are positioned
+ /// before the given reference footnote boss frame have to be collected.
+ /// Note: if parameter <_bCollectOnlyPreviousFtns> is true, then parameter
+ /// <_pRefFtnBossFrm> have to be referenced to an object.
+ /// OD 03.04.2003 #108446# - add parameter <_bCollectOnlyPreviousFtns> in
+ /// order to control, if only footnotes, which are positioned before the
+ /// footnote boss frame <this> have to be collected.
+ // Sollte AdjustNeighbourhood gerufen werden (oder Grow/Shrink)?
+ BYTE NeighbourhoodAdjustment( const SwFrm* pFrm ) const
+ { return IsPageFrm() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrm ); }
+};
+
+inline const SwLayoutFrm *SwFtnBossFrm::FindBodyCont() const
+{
+ return ((SwFtnBossFrm*)this)->FindBodyCont();
+}
+inline const SwFtnContFrm *SwFtnBossFrm::FindFtnCont() const
+{
+ return ((SwFtnBossFrm*)this)->FindFtnCont();
+}
+
+} //namespace binfilter
+#endif //_FTNBOSS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/ftnfrm.hxx b/binfilter/bf_sw/source/core/inc/ftnfrm.hxx
new file mode 100644
index 000000000000..15d3566664a8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/ftnfrm.hxx
@@ -0,0 +1,126 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FTNFRM_HXX
+#define _FTNFRM_HXX
+
+#include "layfrm.hxx"
+namespace binfilter {
+
+class SwCntntFrm;
+class SwTxtFtn;
+class SwBorderAttrs;
+class SwFtnFrm;
+
+//Fuer Fussnoten gibt es einen Speziellen Bereich auf der Seite. Dieser
+//Bereich ist ein SwFtnContFrm.
+//Jede Fussnote ist durch einen SwFtnFrm abgegrenzt, dieser nimmt die
+//Fussnotenabsaetze auf. SwFtnFrm koennen aufgespalten werden, sie gehen
+//dann auf einer anderen Seite weiter.
+
+class SwFtnContFrm: public SwLayoutFrm
+{
+public:
+ SwFtnContFrm( SwFrmFmt* );
+
+
+ virtual SwTwips ShrinkFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual SwTwips GrowFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+};
+
+class SwFtnFrm: public SwLayoutFrm
+{
+ //Zeiger auf den FtnFrm in dem die Fussnote weitergefuehrt wird:
+ // 0 wenn kein Follow vorhanden,
+ // this beim letzten
+ // der Follow sonst.
+ SwFtnFrm *pFollow;
+ SwFtnFrm *pMaster; //Der FtnFrm dessen Follow ich bin.
+ SwCntntFrm *pRef; //In diesem CntntFrm steht die Fussnotenref.
+ SwTxtFtn *pAttr; //Fussnotenattribut (zum wiedererkennen)
+
+ BOOL bBackMoveLocked; //Absaetze in dieser Fussnote duerfen derzeit
+ //nicht rueckwaerts fliessen.
+#ifdef DBG_UTIL
+protected:
+ virtual SwTwips ShrinkFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual SwTwips GrowFrm ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+#endif
+
+
+public:
+ SwFtnFrm( SwFrmFmt*, SwCntntFrm*, SwTxtFtn* );
+
+ virtual void Cut();
+ virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
+
+
+#ifndef DBG_UTIL
+ const SwCntntFrm *GetRef() const { return pRef; }
+ SwCntntFrm *GetRef() { return pRef; }
+#else
+ //JP 15.10.2001: in a non pro version test if the attribute has the same
+ // meaning which his reference is
+ const SwCntntFrm *GetRef() const;
+ SwCntntFrm *GetRef();
+#endif
+ const SwCntntFrm *GetRefFromAttr() const;
+ SwCntntFrm *GetRefFromAttr();
+
+ const SwFtnFrm *GetFollow() const { return pFollow; }
+ SwFtnFrm *GetFollow() { return pFollow; }
+
+ const SwFtnFrm *GetMaster() const { return pMaster; }
+ SwFtnFrm *GetMaster() { return pMaster; }
+
+ const SwTxtFtn *GetAttr() const { return pAttr; }
+ SwTxtFtn *GetAttr() { return pAttr; }
+
+ void SetFollow( SwFtnFrm *pNew ) { pFollow = pNew; }
+ void SetMaster( SwFtnFrm *pNew ) { pMaster = pNew; }
+ void SetRef ( SwCntntFrm *pNew ) { pRef = pNew; }
+
+ void InvalidateNxtFtnCnts( SwPageFrm* pPage );
+
+ void LockBackMove() { bBackMoveLocked = TRUE; }
+ void UnlockBackMove() { bBackMoveLocked = FALSE;}
+ BOOL IsBackMoveLocked() { return bBackMoveLocked; }
+
+ // Verhindert, dass der letzte Inhalt den SwFtnFrm mitloescht (Cut())
+ inline void ColLock() { bColLocked = TRUE; }
+ inline void ColUnlock() { bColLocked = FALSE; }
+};
+
+} //namespace binfilter
+#endif //_FTNFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/hffrm.hxx b/binfilter/bf_sw/source/core/inc/hffrm.hxx
new file mode 100644
index 000000000000..bb467a1014d7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/hffrm.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _HFFRM_HXX
+#define _HFFRM_HXX
+
+#include <tools/mempool.hxx>
+
+#include "layfrm.hxx"
+namespace binfilter {
+
+
+class SwHeadFootFrm : public SwLayoutFrm
+{
+protected:
+ void FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs);
+ void FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs);
+ inline BOOL GetEatSpacing() const; // in hffrm.cxx
+public:
+ SwHeadFootFrm(SwFrmFmt * pFrm, USHORT aType);
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+ virtual SwTwips GrowFrm( SwTwips,
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual SwTwips ShrinkFrm( SwTwips,
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+};
+
+class SwHeaderFrm: public SwHeadFootFrm
+{
+public:
+ SwHeaderFrm( SwFrmFmt* pFrm ) : SwHeadFootFrm(pFrm, FRMC_HEADER) {};
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwHeaderFrm)
+};
+
+class SwFooterFrm: public SwHeadFootFrm
+{
+public:
+ SwFooterFrm( SwFrmFmt* pFrm ) : SwHeadFootFrm(pFrm, FRMC_FOOTER) {};
+
+ DECL_FIXEDMEMPOOL_NEWDEL(SwFooterFrm)
+};
+
+} //namespace binfilter
+#endif //_HFFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/layact.hxx b/binfilter/bf_sw/source/core/inc/layact.hxx
new file mode 100644
index 000000000000..c96364cef1c1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/layact.hxx
@@ -0,0 +1,245 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LAYACT_HXX
+#define _LAYACT_HXX
+
+#include "swtypes.hxx"
+#include "swrect.hxx"
+namespace binfilter {
+
+class SwRootFrm;
+class SwLayoutFrm;
+class SwPageFrm;
+class SwFlyFrm;
+class SwFlyInCntFrm;
+class SwCntntFrm;
+class SwTabFrm;
+class SwViewImp;
+class SwCntntNode;
+class SwWait;
+
+//Die Verwendung der LayAction laeuft immer gleich ab:
+//
+// 1. Erzeugen des LayAction-Objektes.
+// 2. Einstellen des gewuenschten Verhaltens mittels der Set-Methoden
+// 3. Aufruf von Action()
+// 4. Baldiges Zerstoeren des Objektes.
+//
+// Das Objekt meldet sich im CTor beim SwViewImp an und erst im DTor
+// wieder ab! Es handelt sich mithin um ein typisches Stackobjekt.
+
+
+class SwLayAction
+{
+ SwRootFrm *pRoot;
+ SwViewImp *pImp; //Hier Meldet sich die Action an und ab.
+
+ //Zur Optimierung, damit die Tabellen etwas besser am Crsr kleben beim
+ //Return/Backspace davor.
+ //Wenn der erste TabFrm, der sich Paintet (pro Seite) traegt sich im
+ //Pointer ein. Die CntntFrms unterhalb der Seite brauchen sich
+ //dann nicht mehr bei der Shell zum Painten anmelden.
+ const SwTabFrm *pOptTab;
+
+ SwWait *pWait;
+
+ SfxProgress * pProgress;
+
+ //Wenn ein Absatz - oder was auch immer - bei der Formatierung mehr
+ //als eine Seite rueckwaerts floss traegt er seine neue Seitennummer
+ //hier ein. Die Steuerung der InternalAction kann dann geeignet reagieren.
+ USHORT nPreInvaPage;
+
+ ULONG nStartTicks; //Startzeitpunkt der Aktion, vergeht zu viel Zeit kann
+ //der WaitCrsr per CheckWaitCrsr() eingeschaltet werden.
+
+ USHORT nInputType; //Bei welchem Input soll die Verarbeitung abgebrochen
+ //werden?
+ USHORT nEndPage; //StatBar Steuerung.
+ USHORT nCheckPageNum; //CheckPageDesc() wurde verzoegert wenn != USHRT_MAX
+ //ab dieser Seite Checken.
+
+ BOOL bPaint; //Painten oder nur Formatieren?
+ BOOL bComplete; //Alles bis zum sichtbaren Bereich Formatieren oder
+ //oder nur den sichtbaren Bereich?
+ BOOL bCalcLayout; //Vollstaendige Reformatierung?
+ BOOL bAgain; //Zur automatisch wiederholten Action wenn Seiten
+ //geloscht werden.
+ BOOL bNextCycle; //Wiederaufsetzen bei der ersten Ungueltigen Seite.
+ BOOL bInput; //Zum Abbrechen der Verarbeitung wenn ein Input anliegt.
+ BOOL bIdle; //True wenn die Layaction vom Idler ausgeloest wurde.
+ BOOL bReschedule; //Soll das Reschedule - abhaengig vom Progress -
+ //gerufen werden?
+ BOOL bCheckPages; //CheckPageDescs() ausfuehren oder verzoegern.
+ BOOL bUpdateExpFlds;//Wird gesetzt wenn nach dem Formatierien noch eine
+ //Runde fuer den ExpFld laufen muss.
+ BOOL bBrowseActionStop; //Action fruehzeitig beenden (per bInput) und den
+ //Rest dem Idler ueberlassen.
+ BOOL bWaitAllowed; //Wartecursor erlaubt?
+ BOOL bPaintExtraData; //Anzeige von Zeilennumerierung o. ae. eingeschaltet?
+ BOOL bActionInProgress; // wird in Action() anfangs gesetzt und zum Schluss geloescht
+
+ // OD 14.04.2003 #106346# - new flag for content formatting on interrupt.
+ sal_Bool mbFormatCntntOnInterrupt;
+#ifdef _LAYACT_CXX
+
+ void _AddScrollRect( const SwCntntFrm *, const SwPageFrm *,
+ const SwTwips, const SwTwips );
+ void PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
+ const SwRect &rOldRect, long nOldBottom );
+ BOOL PaintWithoutFlys( const SwRect &, const SwCntntFrm *,
+ const SwPageFrm * );
+ inline BOOL _PaintCntnt( const SwCntntFrm *, const SwPageFrm *,
+ const SwRect & );
+
+ void ChkFlyAnchor( SwFlyFrm *, const SwPageFrm * );
+
+ void FormatFlyLayout( const SwPageFrm * );
+ BOOL FormatFlyCntnt( const SwPageFrm *, sal_Bool bDontShrink );
+ BOOL _FormatFlyCntnt( const SwFlyFrm * );
+ BOOL __FormatFlyCntnt( const SwCntntFrm * );
+ void FormatFlyInCnt( SwFlyInCntFrm* );
+ BOOL FormatLayout( SwLayoutFrm *, BOOL bAddRect = TRUE );
+ BOOL FormatLayoutTab( SwTabFrm *, BOOL bAddRect = TRUE );
+ BOOL FormatLayoutFly( SwFlyFrm *, BOOL bAddRect = TRUE );
+ BOOL FormatCntnt( const SwPageFrm* pPage );
+ void _FormatCntnt( const SwCntntFrm* pCntnt,
+ const SwPageFrm* pPage );
+ BOOL IsShortCut( SwPageFrm *& );
+
+ BOOL TurboAction();
+ BOOL _TurboAction( const SwCntntFrm * );
+ void InternalAction();
+
+ SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage );
+
+ BOOL RemoveEmptyBrowserPages();
+
+ inline void CheckIdleEnd();
+ inline ULONG GetStartTicks() { return nStartTicks; }
+
+#endif
+
+public:
+ SwLayAction( SwRootFrm *pRt, SwViewImp *pImp );
+ ~SwLayAction();
+
+#ifdef _LAYACT_CXX
+ void SetIdle ( BOOL bNew ) { bIdle = bNew; }
+ void SetCheckPages ( BOOL bNew ) { bCheckPages = bNew; }
+ void SetBrowseActionStop(BOOL bNew ) { bBrowseActionStop = bNew; }
+ void SetNextCycle ( BOOL bNew ) { bNextCycle = bNew; }
+
+ BOOL IsWaitAllowed() const { return bWaitAllowed; }
+ BOOL IsNextCycle() const { return bNextCycle; }
+ BOOL IsInput() const { return bInput; }
+ BOOL IsWait() const { return 0 != pWait; }
+ BOOL IsPaint() const { return bPaint; }
+ BOOL IsIdle() const { return bIdle; }
+ BOOL IsReschedule() const { return bReschedule; }
+ BOOL IsPaintExtraData() const { return bPaintExtraData;}
+ BOOL IsStopPrt() const;
+ BOOL IsInterrupt() const { return IsInput() || IsStopPrt(); }
+
+ USHORT GetInputType() const { return nInputType; }
+#endif
+
+ //Einstellen der Action auf das gewuenschte Verhalten.
+ void SetPaint ( BOOL bNew ) { bPaint = bNew; }
+ void SetComplete ( BOOL bNew ) { bComplete = bNew; }
+ void SetStatBar ( BOOL bNew );
+ void SetInputType ( USHORT nNew ) { nInputType = nNew; }
+ void SetCalcLayout ( BOOL bNew ) { bCalcLayout = bNew; }
+ void SetReschedule ( BOOL bNew ) { bReschedule = bNew; }
+ void SetWaitAllowed ( BOOL bNew ) { bWaitAllowed = bNew; }
+
+ void SetAgain() { bAgain = TRUE; }
+ void SetUpdateExpFlds() {bUpdateExpFlds = TRUE; }
+ void SetProgress(SfxProgress * _pProgress = NULL)
+ { pProgress = _pProgress; }
+
+ inline void SetCheckPageNum( USHORT nNew );
+ inline void SetCheckPageNumDirect( USHORT nNew ) { nCheckPageNum = nNew; }
+
+ void Action(); //Jetzt gehts loos...
+ void Reset(); //Zurueck auf CTor-Defaults.
+
+ BOOL IsAgain() const { return bAgain; }
+ BOOL IsComplete() const { return bComplete; }
+ BOOL IsExpFlds() const { return bUpdateExpFlds; }
+ BOOL IsCalcLayout() const { return bCalcLayout; }
+ BOOL IsCheckPages() const { return bCheckPages; }
+ BOOL IsBrowseActionStop() const { return bBrowseActionStop; }
+ BOOL IsActionInProgress() const { return bActionInProgress; }
+
+ USHORT GetCheckPageNum() const { return nCheckPageNum; }
+
+ //Auch andere sollen den Wartecrsr einschalten koennen.
+ void CheckWaitCrsr();
+};
+
+class SwLayIdle
+{
+
+ SwRootFrm *pRoot;
+ SwViewImp *pImp; // Hier Meldet sich der Idler an und ab.
+ SwCntntNode *pCntntNode; // Hier wird die aktuelle Cursorposition
+ xub_StrLen nTxtPos; // zwischengespeichert.
+ BOOL bPageValid; // Konnte die Seite alles validiert werden?
+ BOOL bAllValid; // Konnte alles validiert werden?
+
+#ifdef DBG_UTIL
+ BOOL bIndicator;
+#endif
+
+#ifdef _LAYACT_CXX
+
+#ifdef DBG_UTIL
+ void ShowIdle( ColorData eName );
+#endif
+
+ BOOL _CollectAutoCmplWords( const SwCntntFrm *, BOOL bOnlyVisArea );
+ BOOL CollectAutoCmplWords( BOOL );
+
+#endif
+
+public:
+ SwLayIdle( SwRootFrm *pRt, SwViewImp *pImp );
+ ~SwLayIdle();
+};
+
+inline void SwLayAction::SetCheckPageNum( USHORT nNew )
+{
+ if ( nNew < nCheckPageNum )
+ nCheckPageNum = nNew;
+}
+
+} //namespace binfilter
+#endif //_LAYACT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/laycache.hxx b/binfilter/bf_sw/source/core/inc/laycache.hxx
new file mode 100644
index 000000000000..0945baabc39b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/laycache.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LAYCACHE_HXX
+#define _LAYCACHE_HXX
+namespace binfilter {
+
+
+class SwDoc;
+class SwLayCacheImpl;
+
+/*************************************************************************
+ * class SwLayoutCache
+ *
+ * This class allows to save layout information in the file and it contains
+ * this information after loading of a file.
+ * Call Write(..) with a stream and the document to save and the page break
+ * information of the document will be written.
+ * Call Read(..) with a stream and the member pLayCacheImpl will
+ * read the information from the stream and store it in an internal structur.
+ * There's a simple locking mechanism at these classes,
+ * if somebody reads the information, he increments the lock count by 1,
+ * during the Read(..) function the lock count will set to $8000.
+ *
+ **************************************************************************/
+
+class SwLayoutCache
+{
+ SwLayCacheImpl *pImpl;
+ USHORT nLockCount;
+public:
+ SwLayoutCache() : pImpl( NULL ), nLockCount( 0 ) {}
+ ~SwLayoutCache();
+
+ void Read( SvStream &rStream );
+ void Write( SvStream &rStream, const SwDoc& rDoc );
+
+ void ClearImpl();
+ sal_Bool IsLocked() const { return nLockCount > 0; }
+ USHORT& GetLockCount() { return nLockCount; }
+ SwLayCacheImpl *LockImpl()
+ { if( nLockCount & 0x8000 ) return NULL;
+ if ( pImpl )
+ ++nLockCount;
+ return pImpl; }
+ void UnlockImpl() { --nLockCount; }
+
+#ifdef DBG_UTIL
+#endif
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/layfrm.hxx b/binfilter/bf_sw/source/core/inc/layfrm.hxx
new file mode 100644
index 000000000000..ab6861558be9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/layfrm.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LAYFRM_HXX
+#define _LAYFRM_HXX
+
+#include "frame.hxx"
+namespace binfilter {
+
+class SwCntntFrm;
+class SwFlowFrm;
+class SwFmtCol;
+struct SwCrsrMoveState;
+class SwFrmFmt;
+class SwBorderAttrs;
+class SwFmtFrmSize;
+class SwCellFrm;
+
+class SwLayoutFrm: public SwFrm
+{
+ //Der verkappte SwFrm
+ friend class SwFlowFrm;
+ friend class SwFrm;
+
+ //Hebt die Lower waehrend eines Spaltenumbaus auf.
+ friend SwFrm* SaveCntnt( SwLayoutFrm *, SwFrm * );
+ friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling );
+
+ //entfernt leere SwSectionFrms aus einer Kette
+ friend SwFrm* SwClearDummies( SwFrm* pFrm );
+
+ void CopySubtree( const SwLayoutFrm *pDest );
+protected:
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+ virtual void MakeAll();
+
+ SwFrm *pLower;
+
+ virtual SwTwips ShrinkFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual SwTwips GrowFrm ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+
+ long CalcRel( const SwFmtFrmSize &rSz, BOOL bWidth ) const;
+
+public:
+ void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const;
+
+ //Proportionale Groessenanpassung der untergeordneten.
+ void ChgLowersProp( const Size& rOldSize );
+
+ void AdjustColumns( const SwFmtCol *pCol, BOOL bAdjustAttributes,
+ BOOL bAutoWidth = FALSE);
+
+ void ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
+ const BOOL bChgFtn = FALSE );
+
+
+ //Painted die Column-Trennlinien fuer die innenliegenden Columns.
+
+
+ virtual void Cut();
+ virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
+
+ //sucht den dichtesten Cntnt zum SPoint, wird bei Seiten, Flys und Cells
+ //benutzt wenn GetCrsrOfst versagt hat.
+ const SwCntntFrm* GetCntntPos( Point &rPoint, const BOOL bDontLeave,
+ const BOOL bBodyOnly = FALSE,
+ const BOOL bCalc = FALSE,
+ const SwCrsrMoveState *pCMS = 0,
+ const BOOL bDefaultExpand = TRUE ) const;
+
+ SwLayoutFrm( SwFrmFmt* );
+ ~SwLayoutFrm();
+
+ const SwFrm *Lower() const { return pLower; }
+ SwFrm *Lower() { return pLower; }
+ const SwCntntFrm *ContainsCntnt() const;
+ inline SwCntntFrm *ContainsCntnt();
+ const SwCellFrm *FirstCell() const;
+ inline SwCellFrm *FirstCell();
+ const SwFrm *ContainsAny() const;
+ inline SwFrm *ContainsAny();
+ BOOL IsAnLower( const SwFrm * ) const;
+
+ const SwFrmFmt *GetFmt() const { return (const SwFrmFmt*)GetDep(); }
+ SwFrmFmt *GetFmt() { return (SwFrmFmt*)GetDep(); }
+ void SetFrmFmt( SwFrmFmt* );
+
+ //Verschieben der Ftns aller Lower - ab dem StartCntnt.
+ //TRUE wenn mindestens eine Ftn verschoben wurde.
+ //Ruft das Update der Seitennummer wenn bFtnNums gesetzt ist.
+ BOOL MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
+ SwFtnBossFrm *pNewBoss, const BOOL bFtnNums );
+
+ //Sorgt dafuer, dass innenliegende Flys noetigenfalls zum clippen bzw.
+ //reformatieren invalidiert werden.
+ void NotifyFlys();
+
+ //Invalidiert diejenigen innenliegenden Frames, deren Breite und/oder
+ //Hoehe Prozentual berechnet werden. Auch Rahmen, die an this oder an
+ //innenliegenden verankert sind werden ggf. invalidiert.
+ void InvaPercentLowers( SwTwips nDiff = 0 );
+
+ //Gerufen von Format fuer Rahmen und Bereichen mit Spalten.
+ void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder,
+ const SwTwips nMinHeight );
+
+ // InnerHeight returns the height of the content and may be bigger or
+ // less than the PrtArea-Height of the layoutframe himself
+ SwTwips InnerHeight() const;
+
+ /** method to check relative position of layout frame to
+ a given layout frame.
+
+ OD 08.11.2002 - refactoring of pseudo-local method <lcl_Apres(..)> in
+ <txtftn.cxx> for #104840#.
+
+ @param _aCheckRefLayFrm
+ constant reference of an instance of class <SwLayoutFrm> which
+ is used as the reference for the relative position check.
+
+ @author OD
+
+ @return true, if <this> is positioned before the layout frame <p>
+ */
+ bool IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const;
+};
+
+//Um doppelte Implementierung zu sparen wird hier ein bischen gecasted
+inline SwCntntFrm* SwLayoutFrm::ContainsCntnt()
+{
+ return (SwCntntFrm*)(((const SwLayoutFrm*)this)->ContainsCntnt());
+}
+
+inline SwCellFrm* SwLayoutFrm::FirstCell()
+{
+ return (SwCellFrm*)(((const SwLayoutFrm*)this)->FirstCell());
+}
+
+inline SwFrm* SwLayoutFrm::ContainsAny()
+{
+ return (SwFrm*)(((const SwLayoutFrm*)this)->ContainsAny());
+}
+
+// Diese SwFrm-inlines sind hier, damit frame.hxx nicht layfrm.hxx includen muss
+inline BOOL SwFrm::IsColBodyFrm() const
+{
+ return nType == FRMC_BODY && GetUpper()->IsColumnFrm();
+}
+
+inline BOOL SwFrm::IsPageBodyFrm() const
+{
+ return nType == FRMC_BODY && GetUpper()->IsPageFrm();
+}
+
+} //namespace binfilter
+#endif //_LAYFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/layouter.hxx b/binfilter/bf_sw/source/core/inc/layouter.hxx
new file mode 100644
index 000000000000..bf5bde68ebfd
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/layouter.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LAYOUTER_HXX
+#define _LAYOUTER_HXX
+
+#include "swtypes.hxx"
+namespace binfilter {
+
+class SwDoc;
+class SwSectionFrm;
+class SwFtnFrm;
+class SwPageFrm;
+class SwLooping;
+
+#define LOOP_PAGE 1
+
+class SwLayouter
+{
+ SwLooping* pLooping;
+ BOOL StartLooping( SwPageFrm* pPage );
+public:
+ SwLayouter();
+ ~SwLayouter();
+
+ void LoopControl( SwPageFrm* pPage, BYTE nLoop );
+ void EndLoopControl();
+
+ static BOOL StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage );
+};
+
+} //namespace binfilter
+#endif //_LAYOUTER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/mvsave.hxx b/binfilter/bf_sw/source/core/inc/mvsave.hxx
new file mode 100644
index 000000000000..73586a0d8daa
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/mvsave.hxx
@@ -0,0 +1,212 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MVSAVE_HXX
+#define _MVSAVE_HXX
+
+
+#include <tools/string.hxx>
+#include <vcl/keycod.hxx>
+#include <bf_svtools/svarray.hxx>
+namespace binfilter {
+class SvULongs;
+
+class SvNumberFormatter;
+
+class SwBookmark;
+class SwDoc;
+class SwFmtAnchor;
+class SwFrmFmt;
+class SwIndex;
+class SwNodeIndex;
+class SwNodeRange;
+class SwPaM;
+class SwRedline;
+struct SwPosition;
+
+enum SaveBookmarkType { BKMK_POS_NONE = 0x00,
+ BKMK_POS = 0x01,
+ BKMK_POS_OTHER = 0x02
+ };
+
+class SaveBookmark
+{
+ String aName, aShortName;
+ ULONG nNode1, nNode2;
+ xub_StrLen nCntnt1, nCntnt2;
+ KeyCode aCode;
+ SaveBookmarkType eBkmkType;
+ BOOKMARK_TYPE eOrigBkmType;
+
+public:
+ SaveBookmark( int, const SwBookmark&, const SwNodeIndex&,
+ const SwIndex* pIdx = 0 );
+};
+
+SV_DECL_PTRARR_DEL( SaveBookmarks, SaveBookmark*, 0, 10 )
+
+void _DelBookmarks( const SwNodeIndex& rStt,
+ const SwNodeIndex& rEnd,
+ SaveBookmarks* pSaveBkmk = 0,
+ const SwIndex* pSttIdx = 0,
+ const SwIndex* pEndIdx = 0 );
+
+
+#define SAVEFLY 1
+#define SAVEFLY_SPLIT 2
+
+void _SaveCntntIdx( SwDoc* pDoc, ULONG nNode, xub_StrLen nCntnt,
+ SvULongs& rSaveArr, BYTE nSaveFly = 0 );
+void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr,
+ULONG nNode, xub_StrLen nOffset = 0,
+BOOL bAuto = FALSE );
+
+
+/** data structure to temporarily hold fly anchor positions relative to some
+ * location. */
+struct _SaveFly
+{
+ ULONG nNdDiff; /// relative node difference
+ SwFrmFmt* pFrmFmt; /// the fly's frame format
+ sal_Bool bInsertPosition; /// if true, anchor _at_ insert position
+
+ _SaveFly( ULONG nNodeDiff, SwFrmFmt* pFmt, sal_Bool bInsert )
+ : nNdDiff( nNodeDiff ), pFrmFmt( pFmt ), bInsertPosition( bInsert )
+ { }
+};
+
+SV_DECL_VARARR( _SaveFlyArr, _SaveFly, 0, 10 )
+
+
+void DelFlyInRange( const SwNodeIndex& rMkNdIdx,
+ const SwNodeIndex& rPtNdIdx );
+
+
+class SwDataChanged
+{
+ const SwPaM* pPam;
+ const SwPosition* pPos;
+ SwDoc* pDoc;
+ ULONG nNode;
+ xub_StrLen nCntnt;
+ USHORT nType; // Insert/Move/Delete/... (UndoIds)
+
+public:
+ SwDataChanged( const SwPaM& rPam, USHORT nType );
+ SwDataChanged( SwDoc* pDoc, const SwPosition& rPos, USHORT nType );
+ ~SwDataChanged();
+
+ ULONG GetNode() const { return nNode; }
+ xub_StrLen GetCntnt() const { return nCntnt; }
+};
+
+
+// Funktions-Deklaration damit auch alles unter der CrsrShell mal die
+// Crsr verschieben kann
+// die Funktionen rufen nicht die SwDoc::Corr - Methoden!
+
+ // Setzt alle PaMs an OldPos auf NewPos + Offset
+void PaMCorrAbs( const SwPosition &rOldPos,
+ const SwPosition &rNewPos,
+ const xub_StrLen nOffset = 0 );
+
+ // Setzt alle PaMs in OldNode auf NewPos + Offset
+void PaMCorrAbs( const SwNodeIndex &rOldNode,
+ const SwPosition &rNewPos,
+ const xub_StrLen nOffset = 0 );
+
+ // Setzt alle PaMs im Bereich vom Range nach NewPos
+void PaMCorrAbs( const SwPaM& rRange,
+ const SwPosition& rNewPos );
+
+ // Setzt alle PaMs im Bereich von [StartNode, EndNode] nach NewPos
+void PaMCorrAbs( const SwNodeIndex &rStartNode,
+ const SwNodeIndex &rEndNode,
+ const SwPosition &rNewPos );
+
+ // Setzt alle PaMs in OldNode auf relative Pos
+void PaMCorrRel( const SwNodeIndex &rOldNode,
+ const SwPosition &rNewPos,
+ const xub_StrLen nOffset = 0 );
+
+
+// Hilfsklasse zum kopieren von absatzgebundenen Flys. Durch die Sortierung
+// nach der Ordnungsnummer wird versucht die layout seitige Anordnung
+// bei zu behalten
+class _ZSortFly
+{
+ const SwFrmFmt* pFmt;
+ const SwFmtAnchor* pAnchor;
+ UINT32 nOrdNum;
+
+public:
+ _ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAnchor,
+ UINT32 nArrOrdNum );
+ _ZSortFly& operator=( const _ZSortFly& rCpy )
+ {
+ pFmt = rCpy.pFmt, pAnchor = rCpy.pAnchor, nOrdNum = rCpy.nOrdNum;
+ return *this;
+ }
+
+ int operator==( const _ZSortFly& ) const { return FALSE; }
+ int operator<( const _ZSortFly& rCmp ) const
+ { return nOrdNum < rCmp.nOrdNum; }
+
+ const SwFrmFmt* GetFmt() const { return pFmt; }
+ const SwFmtAnchor* GetAnchor() const { return pAnchor; }
+};
+
+SV_DECL_VARARR_SORT( _ZSortFlys, _ZSortFly, 0, 10 )
+
+
+class SwTblNumFmtMerge
+{
+ SvNumberFormatter* pNFmt;
+public:
+ SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest );
+ ~SwTblNumFmtMerge();
+};
+
+
+class _SaveRedlEndPosForRestore
+{
+ SvPtrarr* pSavArr;
+ SwNodeIndex* pSavIdx;
+
+ void _Restore();
+public:
+ _SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx );
+ ~_SaveRedlEndPosForRestore();
+ void Restore() { if( pSavArr ) _Restore(); }
+};
+
+
+} //namespace binfilter
+#endif // _MVSAVE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/node2lay.hxx b/binfilter/bf_sw/source/core/inc/node2lay.hxx
new file mode 100644
index 000000000000..065c4cd1f188
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/node2lay.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NODE2LAY_HXX
+#define _NODE2LAY_HXX
+namespace binfilter {
+
+/* -----------------23.02.99 11:33-------------------
+ * Die Klasse SwNode2Layout stellt die Verbindung von Nodes zum Layout her.
+ * Sie liefert einen intelligenten Iterator ueber die zum Node oder Nodebereich
+ * gehoerenden Frames. Je nach Zweck der Iteration, z.B. um vor oder hinter
+ * den Frames andere Frames einzufuegen, werden Master/Follows erkannt und nur
+ * die relevanten zurueckgegeben. Auch wiederholte Tabellenueberschriften werden
+ * beachtet.
+ * Es ist auch moeglich, ueber SectionNodes zu iterieren, die durch Schachtelung
+ * manchmal gar keinem SectionFrm direkt zugeordnet sind, manchmal aber sogar
+ * mehreren.
+ * SwNode2Layout ist ein Schnittstelle zwischen der aufrufenden Methode und
+ * einem SwClientIter, sie waehlt je nach Aufgabenstellung das richtige
+ * SwModify aus, erzeugt einen SwClientIter und filtert dessen Iterationen
+ * je nach Aufgabenstellung.
+ * Die Aufgabenstellung wird durch die Wahl des Ctors bestimmt.
+ * 1. Das Einsammeln der UpperFrms, damit spaeter RestoreUpperFrms wird,
+ * wird von MakeFrms gerufen, wenn es keinen PrevNext gibt, vor/hinter den
+ * die Frames gehaengt werden koennen.
+ * 2. Die Lieferung der Frames hinter/vor die die neuen Frames eines Nodes
+ * gehaengt werden muessen, ebenfalls von MakeFrms gerufen.
+ * --------------------------------------------------*/
+
+class SwNode2LayImpl;
+class SwFrm;
+class SwLayoutFrm;
+class SwNode;
+
+class SwNode2Layout
+{
+ SwNode2LayImpl *pImpl;
+public:
+ // Dieser Ctor ist zum Einsammeln der UpperFrms gedacht.
+ SwNode2Layout( const SwNode& rNd );
+ // Dieser Ctor ist fuer das Einfuegen vor oder hinter rNd gedacht,
+ // nIdx ist der Index des einzufuegenden Nodes
+ SwNode2Layout( const SwNode& rNd, ULONG nIdx );
+ ~SwNode2Layout();
+ SwFrm* NextFrm();
+ SwLayoutFrm* UpperFrm( SwFrm* &rpFrm, const SwNode& rNode );
+ void RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd );
+
+ SwFrm *GetFrm( const Point* pDocPos = 0,
+ const SwPosition *pPos = 0,
+ const BOOL bCalcFrm = TRUE ) const;
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/noteurl.hxx b/binfilter/bf_sw/source/core/inc/noteurl.hxx
new file mode 100644
index 000000000000..ab3b033297a0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/noteurl.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _NOTEURL_HXX
+#define _NOTEURL_HXX
+
+
+#include <bf_svtools/svarray.hxx>
+#include <tools/string.hxx>
+#include "swrect.hxx"
+class MapMode;
+
+namespace binfilter {
+
+class ImageMap;
+
+class SwURLNote
+{
+ String aURL;
+ String aTarget;
+ SwRect aRect;
+public:
+ SwURLNote( const String& rURL, const String& rTarget, const SwRect& rRect )
+ : aURL( rURL ), aTarget( rTarget ), aRect( rRect )
+ {}
+ const String& GetURL() const { return aURL; }
+ const String& GetTarget() const { return aTarget; }
+ const SwRect& GetRect() const { return aRect; }
+ BOOL operator==( const SwURLNote& rSwURLNote ) const
+ { return aRect == rSwURLNote.aRect; }
+};
+
+typedef SwURLNote* SwURLNotePtr;
+SV_DECL_PTRARR_DEL(SwURLNoteList, SwURLNotePtr, 0, 5)
+
+class SwNoteURL
+{
+ SwURLNoteList aList;
+public:
+ SwNoteURL() {}
+ USHORT Count() const { return aList.Count(); }
+ const SwURLNote& GetURLNote( USHORT nPos ) const
+ { return *aList.GetObject( nPos ); }
+};
+
+// globale Variable, in NoteURL.Cxx angelegt
+extern SwNoteURL *pNoteURL;
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/notxtfrm.hxx b/binfilter/bf_sw/source/core/inc/notxtfrm.hxx
new file mode 100644
index 000000000000..7fee828d8036
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/notxtfrm.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NOTXTFRM_HXX
+#define _NOTXTFRM_HXX
+
+#include <cntfrm.hxx>
+class OutputDevice;
+class Bitmap;
+namespace binfilter {
+
+class SwNoTxtNode;
+
+class SwBorderAttrs;
+
+struct SwCrsrMoveState;
+
+class SwNoTxtFrm: public SwCntntFrm
+{
+ friend void _FrmFinit(); //erase pErrorBmp and pReplaceBmp
+ static Bitmap *pErrorBmp, *pReplaceBmp;
+
+ short nWeight; // "Wichtigkeit" der Grafik
+
+ const Size& GetSize() const;
+
+ void InitCtor();
+
+ void Format ( const SwBorderAttrs *pAttrs = 0 );
+ void PaintCntnt ( OutputDevice*, const SwRect&, const SwRect& ) const;
+ /// OD 25.09.2002 #99739# - delete unused 3rd parameter
+ void PaintPicture( OutputDevice*, const SwRect& ) const;
+protected:
+ virtual void MakeAll();
+public:
+ SwNoTxtFrm( SwNoTxtNode * const );
+ ~SwNoTxtFrm();
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+ virtual void Paint(const SwRect& ) const;
+ virtual BOOL GetCharRect( SwRect &, const SwPosition&,
+ SwCrsrMoveState* = 0) const;
+ BOOL GetCrsrOfst(SwPosition* pPos, Point& aPoint,
+ const SwCrsrMoveState* = 0) const;
+
+ const Size &GetGrfSize() const { return GetSize(); }
+ void GetGrfArea( SwRect &rRect, SwRect * = 0, BOOL bMirror = TRUE ) const;
+
+ void StopAnimation( OutputDevice* = 0 ) const;
+ BOOL HasAnimation() const;
+
+ // Routinen fuer den Grafik-Cache
+ USHORT GetWeight() { return nWeight; }
+
+ static const Bitmap& GetBitmap( BOOL bError );
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/numpara.hxx b/binfilter/bf_sw/source/core/inc/numpara.hxx
new file mode 100644
index 000000000000..75d6f9b74590
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/numpara.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NUMPARA_HXX
+#define _NUMPARA_HXX
+
+#include "numrule.hxx"
+#include "ndarr.hxx"
+#include "ndindex.hxx"
+namespace binfilter {
+
+class SwTxtNode;
+class SwDoc;
+class SwNumSection;
+class SwNodes;
+
+class _NumPara
+{
+ const SwNumSection& rNumSection;
+
+ void _Init();
+
+public:
+ SwNodeIndex aNdIdx;
+ ULONG nCnt;
+ SwNum aNum;
+ char nDiff; // +1, 0, -1 !! dafuer reicht ein char !!
+ BYTE nOldLevel;
+ BOOL bInitNum : 1;
+ BOOL bWasUndo : 1;
+ BOOL bOverTbl : 1; // Flag fuer ForEach-Methoden, Tabelle ueberspr.
+
+ _NumPara( char nOffset, const SwNodeIndex& rNdIdx,
+ const SwNumSection& rSect, ULONG nCntNodes );
+ _NumPara( const SwNodeIndex& rNdIdx, const SwNumSection& rSect );
+ ~_NumPara();
+
+ void UpdateNum( SwTxtNode& rTxtNd );
+};
+
+// Funktion fuer ForEach am Nodes-Array
+BOOL _NumUpDown( const SwNodePtr& rpNode, void* pPara );
+
+
+} //namespace binfilter
+#endif // _NUMPARA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/pagefrm.hxx b/binfilter/bf_sw/source/core/inc/pagefrm.hxx
new file mode 100644
index 000000000000..e9da3a99f9de
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/pagefrm.hxx
@@ -0,0 +1,435 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PAGEFRM_HXX
+#define _PAGEFRM_HXX
+
+
+
+#include <bf_svtools/svarray.hxx>
+
+#include "ftnboss.hxx"
+
+#include <tools/mempool.hxx>
+namespace binfilter {
+
+class SvPtrarr;
+class SwFlyFrm;
+class SwFrmFmt;
+class SwPageDesc;
+class SwCntntFrm;
+struct SwPosition;
+struct SwCrsrMoveState;
+class SwFmtAnchor;
+class SdrObject;
+class SwDrawContact;
+class SwAttrSetChg;
+
+
+SV_DECL_PTRARR_SORT(SwSortDrawObjs,SdrObjectPtr,1,2)//STRIP008 ;
+
+enum SwPageChg
+{
+ CHG_NEWPAGE,
+ CHG_CUTPAGE,
+ CHG_CHGPAGE
+};
+
+void SetLastPage( SwPageFrm* );
+
+class SwPageFrm: public SwFtnBossFrm
+{
+ friend class SwFrm;
+
+ //Array fuer die Draw-Objekte auf der Seite.
+ //Das Sortierte Array ist nach den Pointeraddressen sortiert.
+ //Die Objs in dem Array haben ihren Anker nicht notwendigerweise auf
+ //der Seite.
+ SwSortDrawObjs *pSortedObjs;
+
+ SwPageDesc *pDesc; //PageDesc der die Seite beschreibt.
+
+ USHORT nPhyPageNum; //Physikalische Seitennummer.
+
+ BOOL bInvalidCntnt :1;
+ BOOL bInvalidLayout :1;
+ BOOL bInvalidFlyCntnt :1;
+ BOOL bInvalidFlyLayout :1;
+ BOOL bInvalidFlyInCnt :1;
+ BOOL bFtnPage :1; //Diese Seite ist fuer Dokumentende-Fussnoten.
+ BOOL bEmptyPage :1; //Dies ist eine explizite Leerseite
+ BOOL bInvalidSpelling :1; //Das Online-Spelling ist gefordert
+ BOOL bEndNotePage :1; //'Fussnotenseite' fuer Endnoten
+ BOOL bInvalidAutoCmplWrds :1; //Auto-Complete Wordliste aktualisieren
+#ifdef VERTICAL_LAYOUT
+ BOOL bHasGrid :1; // Grid for Asian layout
+#endif
+
+ // OD 12.02.2003 #i9719#, #105645#
+ static const sal_Int8 mnBorderPxWidth;
+ static const sal_Int8 mnShadowPxWidth;
+
+ //Anpassung der RootSize und Benachrichtigungen beim Einsetzen,
+ //Entfernen und Groessenaenderungen der Seite.
+ void AdjustRootSize( const SwPageChg eChgType, const SwRect *pOld );
+
+ void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &,
+ SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
+
+ // Anpassen der max. Fussnotenhoehen in den einzelnen Spalten
+
+ /** determine rectangle for page border
+
+ OD 12.02.2003 for #i9719# and #105645#
+
+ @author OD
+
+ @param _rPageRect
+ input parameter - constant instance reference of the page rectangle.
+ Generally, it's the frame area of the page, but for empty pages in print
+ preview, this parameter is useful.
+
+ @param _pViewShell
+ input parameter - instance of the view shell, for which the rectangle
+ has to be generated.
+
+ @param _orBorderRect
+ output parameter - instance reference of the border rectangle for
+ the given page rectangle
+ */
+ void GetBorderRect( const SwRect& _rPageRect,
+ ViewShell* _pViewShell,
+ SwRect& _orBorderRect ) const;
+
+ /** determine rectangle for right page shadow
+
+ OD 12.02.2003 for #i9719# and #105645#
+
+ @author OD
+
+ @param _rPageRect
+ input parameter - constant instance reference of the page rectangle.
+ Generally, it's the frame area of the page, but for empty pages in print
+ preview, this parameter is useful.
+
+ @param _pViewShell
+ input parameter - instance of the view shell, for which the rectangle
+ has to be generated.
+
+ @param _orRightShadowRect
+ output parameter - instance reference of the right shadow rectangle for
+ the given page rectangle
+ */
+ void GetRightShadowRect( const SwRect& _rPageRect,
+ ViewShell* _pViewShell,
+ SwRect& _orRightShadowRect ) const;
+
+ /** determine rectangle for bottom page shadow
+
+ OD 12.02.2003 for #i9719# and #105645#
+
+ @author OD
+
+ @param _rPageRect
+ input parameter - constant instance reference of the page rectangle.
+ Generally, it's the frame area of the page, but for empty pages in print
+ preview, this parameter is useful.
+
+ @param _pViewShell
+ input parameter - instance of the view shell, for which the rectangle
+ has to be generated.
+
+ @param _orBottomShadowRect
+ output parameter - instance reference of the bottom shadow rectangle for
+ the given page rectangle
+ */
+ void GetBottomShadowRect( const SwRect& _rPageRect,
+ ViewShell* _pViewShell,
+ SwRect& _orBottomShadowRect ) const;
+
+protected:
+ virtual void MakeAll();
+
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm)
+
+ SwPageFrm( SwFrmFmt*, SwPageDesc* );
+ ~SwPageFrm();
+
+ //public, damit die ViewShell beim Umschalten vom BrowseMode darauf
+ //zugreifen kann.
+ void PrepareHeader(); //Kopf-/Fusszeilen anlegen/entfernen.
+ void PrepareFooter();
+
+ const SwSortDrawObjs *GetSortedObjs() const { return pSortedObjs; }
+ SwSortDrawObjs *GetSortedObjs() { return pSortedObjs; }
+
+ void AppendDrawObj( SwDrawContact *pNew );
+ void RemoveDrawObj( SwDrawContact *pToRemove );
+ // OD 20.05.2003 #108784# - <AppendDrawObj>/<RemoveDrawObj> for virtual drawing objects
+ void AppendVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj );
+ void RemoveVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj );
+
+ void AppendFly( SwFlyFrm *pNew );
+ void RemoveFly( SwFlyFrm *pToRemove );
+ void MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest );//optimiertes Remove/Append
+
+ void SetPageDesc( SwPageDesc *, SwFrmFmt * );
+ SwPageDesc *GetPageDesc() { return pDesc; }
+ const SwPageDesc *GetPageDesc() const { return pDesc; }
+ SwPageDesc *FindPageDesc();
+
+ SwCntntFrm *FindLastBodyCntnt();
+ inline SwCntntFrm *FindFirstBodyCntnt();
+ inline const SwCntntFrm *FindFirstBodyCntnt() const;
+ inline const SwCntntFrm *FindLastBodyCntnt() const;
+
+ //Spezialisiertes GetCntntPos() fuer Felder in Rahmen.
+ void GetCntntPosition( const Point &rPt, SwPosition &rPos ) const;
+
+ BOOL IsEmptyPage() const { return bEmptyPage; } //explizite Leerseite.
+
+ void UpdateFtnNum();
+
+ //Immer nach dem Paste rufen. Erzeugt die Seitengeb. Rahmen und Formatiert
+ //generischen Inhalt.
+ void PreparePage( BOOL bFtn );
+
+ //Schickt an alle ContentFrames ein Prepare wg. geaenderter Registervorlage
+ void PrepareRegisterChg();
+
+ //Haengt einen Fly an den geeigneten LayoutFrm unterhalb der Seite,
+ //fuer SwFEShell und Modify der Flys.
+ SwFrm *PlaceFly( SwFlyFrm *, SwFrmFmt *, const SwFmtAnchor * );
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+ // erfrage vom Client Informationen
+
+ virtual void Cut();
+ virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
+#ifdef VERTICAL_LAYOUT
+ virtual void CheckDirection( BOOL bVert );
+ void CheckGrid( BOOL bInvalidate );
+ BOOL HasGrid() const { return bHasGrid; }
+#endif
+
+ //Zeilennummern usw malen
+
+ //Hilfslinien malen.
+
+ //Fussnotenschnittstelle
+ BOOL IsFtnPage() const { return bFtnPage; }
+ BOOL IsEndNotePage() const { return bEndNotePage; }
+ void SetFtnPage( BOOL b ) { bFtnPage = b; }
+ void SetEndNotePage( BOOL b ) { bEndNotePage = b; }
+
+ inline USHORT GetPhyPageNum() const { return nPhyPageNum;}
+ inline void SetPhyPageNum( USHORT nNum ) { nPhyPageNum = nNum;}
+ inline void DecrPhyPageNum() { --nPhyPageNum; }
+ inline void IncrPhyPageNum() { ++nPhyPageNum; }
+
+ //Validieren, invalidieren und abfragen des Status der Seite.
+ //Layout/Cntnt und jeweils Fly/nicht Fly werden getrennt betrachtet.
+ inline void InvalidateFlyLayout() const;
+ inline void InvalidateFlyCntnt() const;
+ inline void InvalidateFlyInCnt() const;
+ inline void InvalidateLayout() const;
+ inline void InvalidateCntnt() const;
+ inline void InvalidateSpelling() const;
+ inline void InvalidateAutoCompleteWords() const;
+ inline void ValidateFlyLayout() const;
+ inline void ValidateFlyCntnt() const;
+ inline void ValidateFlyInCnt() const;
+ inline void ValidateLayout() const;
+ inline void ValidateCntnt() const;
+ inline void ValidateSpelling() const;
+ inline void ValidateAutoCompleteWords() const;
+ inline BOOL IsInvalid() const;
+ inline BOOL IsInvalidFly() const;
+ BOOL IsInvalidFlyLayout() const { return bInvalidFlyLayout; }
+ BOOL IsInvalidFlyCntnt() const { return bInvalidFlyCntnt; }
+ BOOL IsInvalidFlyInCnt() const { return bInvalidFlyInCnt; }
+ BOOL IsInvalidLayout() const { return bInvalidLayout; }
+ BOOL IsInvalidCntnt() const { return (bInvalidCntnt || bInvalidFlyInCnt); }
+ BOOL IsInvalidSpelling() const { return bInvalidSpelling; }
+ BOOL IsInvalidAutoCompleteWords() const { return bInvalidAutoCmplWrds; }
+
+ /** SwPageFrm::GetDrawBackgrdColor - for #102450#
+
+ 29.08.2002:
+ determine the color, that is respectively will be drawn as background
+ for the page frame.
+
+ @author OD
+
+ @return reference to an instance of class Color
+ */
+ const Color& GetDrawBackgrdColor() const;
+
+ /** paint margin area of a page
+
+ OD 20.11.2002 for #104598#:
+ implement paint of margin area; margin area will be painted for a
+ view shell with a window and if the document is not in online layout.
+
+ @author OD
+
+ @param _rOutputRect
+ input parameter - constant instance reference of the rectangle, for
+ which an output has to be generated.
+
+ @param _pViewShell
+ input parameter - instance of the view shell, on which the output
+ has to be generated.
+ */
+ void PaintMarginArea( const SwRect& _rOutputRect,
+ ViewShell* _pViewShell ) const;
+
+ /** paint page border and shadow
+
+ OD 12.02.2003 for #i9719# and #105645#
+ implement paint of page border and shadow
+
+ @author OD
+
+ @param _rPageRect
+ input parameter - constant instance reference of the page rectangle.
+ Generally, it's the frame area of the page, but for empty pages in print
+ preview, this parameter is useful.
+
+ @param _pViewShell
+ input parameter - instance of the view shell, on which the output
+ has to be generated.
+ */
+ void PaintBorderAndShadow( const SwRect& _rPageRect,
+ ViewShell* _pViewShell ) const;
+
+ inline sal_Int8 BorderPxWidth() const
+ {
+ return mnBorderPxWidth;
+ }
+ inline sal_Int8 ShadowPxWidth() const
+ {
+ return mnShadowPxWidth;
+ }
+};
+
+inline SwCntntFrm *SwPageFrm::FindFirstBodyCntnt()
+{
+ SwLayoutFrm *pBody = FindBodyCont();
+ return pBody ? pBody->ContainsCntnt() : 0;
+}
+inline const SwCntntFrm *SwPageFrm::FindFirstBodyCntnt() const
+{
+ const SwLayoutFrm *pBody = FindBodyCont();
+ return pBody ? pBody->ContainsCntnt() : 0;
+}
+inline const SwCntntFrm *SwPageFrm::FindLastBodyCntnt() const
+{
+ return ((SwPageFrm*)this)->FindLastBodyCntnt();
+}
+inline void SwPageFrm::InvalidateFlyLayout() const
+{
+ ((SwPageFrm*)this)->bInvalidFlyLayout = TRUE;
+}
+inline void SwPageFrm::InvalidateFlyCntnt() const
+{
+ ((SwPageFrm*)this)->bInvalidFlyCntnt = TRUE;
+}
+inline void SwPageFrm::InvalidateFlyInCnt() const
+{
+ ((SwPageFrm*)this)->bInvalidFlyInCnt = TRUE;
+}
+inline void SwPageFrm::InvalidateLayout() const
+{
+ ((SwPageFrm*)this)->bInvalidLayout = TRUE;
+}
+inline void SwPageFrm::InvalidateCntnt() const
+{
+ ((SwPageFrm*)this)->bInvalidCntnt = TRUE;
+}
+inline void SwPageFrm::InvalidateSpelling() const
+{
+ ((SwPageFrm*)this)->bInvalidSpelling = TRUE;
+}
+inline void SwPageFrm::InvalidateAutoCompleteWords() const
+{
+ ((SwPageFrm*)this)->bInvalidAutoCmplWrds = FALSE;
+}
+inline void SwPageFrm::ValidateFlyLayout() const
+{
+ ((SwPageFrm*)this)->bInvalidFlyLayout = FALSE;
+}
+inline void SwPageFrm::ValidateFlyCntnt() const
+{
+ ((SwPageFrm*)this)->bInvalidFlyCntnt = FALSE;
+}
+inline void SwPageFrm::ValidateFlyInCnt() const
+{
+ ((SwPageFrm*)this)->bInvalidFlyInCnt = FALSE;
+}
+inline void SwPageFrm::ValidateLayout() const
+{
+ ((SwPageFrm*)this)->bInvalidLayout = FALSE;
+}
+inline void SwPageFrm::ValidateCntnt() const
+{
+ ((SwPageFrm*)this)->bInvalidCntnt = FALSE;
+}
+inline void SwPageFrm::ValidateSpelling() const
+{
+ ((SwPageFrm*)this)->bInvalidSpelling = FALSE;
+}
+inline void SwPageFrm::ValidateAutoCompleteWords() const
+{
+ ((SwPageFrm*)this)->bInvalidAutoCmplWrds = FALSE;
+}
+
+
+inline BOOL SwPageFrm::IsInvalid() const
+{
+ return (bInvalidCntnt || bInvalidLayout || bInvalidFlyInCnt);
+}
+inline BOOL SwPageFrm::IsInvalidFly() const
+{
+ return bInvalidFlyLayout || bInvalidFlyCntnt;
+}
+
+#ifdef VERTICAL_LAYOUT
+#define GETGRID( pPage ) const SwTextGridItem *pGrid = NULL; \
+ {if( pPage && pPage->HasGrid() && GRID_NONE==(pGrid=(SwTextGridItem*)&pPage->\
+ GetPageDesc()->GetMaster().GetAttr(RES_TEXTGRID))->GetGridType() ) \
+ pGrid = NULL;}
+#endif
+
+
+} //namespace binfilter
+#endif //_PAGEFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/pamtyp.hxx b/binfilter/bf_sw/source/core/inc/pamtyp.hxx
new file mode 100644
index 000000000000..02b6b26d4af4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/pamtyp.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PAMTYP_HXX
+#define _PAMTYP_HXX
+
+#include <bf_svtools/txtcmp.hxx>
+#include <pam.hxx>
+#include <node.hxx>
+#include <tools/string.hxx>
+namespace binfilter {
+
+class SwpHints;
+struct SwPosition;
+class SwPaM;
+class SwTxtAttr;
+
+// Funktions-Deklarationen fuer die Move/Find-Methoden vom SwPaM
+
+void GoStartDoc( SwPosition*);
+void GoEndDoc( SwPosition*);
+void GoStartSection( SwPosition*);
+void GoEndSection( SwPosition*);
+FASTBOOL GoInDoc( SwPaM&, SwMoveFn);
+FASTBOOL GoInSection( SwPaM&, SwMoveFn);
+FASTBOOL GoInNode( SwPaM&, SwMoveFn);
+FASTBOOL GoInCntnt( SwPaM&, SwMoveFn);
+FASTBOOL GoInCntntCells( SwPaM&, SwMoveFn);
+const SwTxtAttr* GetFrwrdTxtHint( const SwpHints&, USHORT&, xub_StrLen );
+const SwTxtAttr* GetBkwrdTxtHint( const SwpHints&, USHORT&, xub_StrLen );
+
+FASTBOOL GoNext(SwNode* pNd, SwIndex * pIdx, USHORT nMode );
+FASTBOOL GoPrevious(SwNode* pNd, SwIndex * pIdx, USHORT nMode );
+SwCntntNode* GoNextNds( SwNodeIndex * pIdx, FASTBOOL );
+SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, FASTBOOL );
+
+// --------- Funktionsdefinitionen fuer die SwCrsrShell --------------
+
+FASTBOOL GoPrevPara( SwPaM&, SwPosPara);
+FASTBOOL GoCurrPara( SwPaM&, SwPosPara);
+FASTBOOL GoNextPara( SwPaM&, SwPosPara);
+FASTBOOL GoPrevSection( SwPaM&, SwPosSection);
+FASTBOOL GoCurrSection( SwPaM&, SwPosSection);
+FASTBOOL GoNextSection( SwPaM&, SwPosSection);
+
+
+// ------------ Typedefiniton fuer Funktionen ----------------------
+
+typedef FASTBOOL (*GoNd)( SwNode*, SwIndex*, USHORT );
+typedef SwCntntNode* (*GoNds)( SwNodeIndex*, FASTBOOL );
+typedef void (*GoDoc)( SwPosition* );
+typedef void (*GoSection)( SwPosition* );
+typedef FASTBOOL (SwPosition:: *CmpOp)( const SwPosition& ) const;
+typedef const SwTxtAttr* (*GetHint)( const SwpHints&, USHORT&, xub_StrLen );
+typedef int (::utl::TextSearch:: *SearchTxt)( const String&, xub_StrLen*,
+ xub_StrLen*, ::com::sun::star::util::SearchResult* );
+typedef void (SwNodes:: *MvSection)( SwNodeIndex * ) const;
+
+
+struct SwMoveFnCollection
+{
+ GoNd fnNd;
+ GoNds fnNds;
+ GoDoc fnDoc;
+ GoSection fnSections;
+ CmpOp fnCmpOp;
+ GetHint fnGetHint;
+ SearchTxt fnSearch;
+ MvSection fnSection;
+};
+
+// --------- Funktionsdefinitionen fuers Suchen --------------
+SwCntntNode* GetNode( SwPaM&, FASTBOOL&, SwMoveFn, FASTBOOL bInReadOnly = FALSE );
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/prevwpage.hxx b/binfilter/bf_sw/source/core/inc/prevwpage.hxx
new file mode 100644
index 000000000000..8df4f5ec05d4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/prevwpage.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#ifndef _PREVIEWPAGES_HXX
+#define _PREVIEWPAGES_HXX
+
+// classes <Point>, <Size> and <Rectangle>
+#include <tools/gen.hxx>
+namespace binfilter {
+class SwPageFrm;
+
+/** data structure for a preview page in the current preview layout
+
+ OD 12.12.2002 #103492# - struct <PrevwPage>
+
+ @author OD
+*/
+struct PrevwPage
+{
+ const SwPageFrm* pPage;
+ bool bVisible;
+ Size aPageSize;
+ Point aPrevwWinPos;
+ Point aLogicPos;
+ Point aMapOffset;
+
+ inline PrevwPage();
+};
+
+inline PrevwPage::PrevwPage()
+ : pPage( 0 ),
+ bVisible( false ),
+ aPageSize( Size(0,0) ),
+ aPrevwWinPos( Point(0,0) ),
+ aLogicPos( Point(0,0) ),
+ aMapOffset( Point(0,0) )
+{};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/ptqueue.hxx b/binfilter/bf_sw/source/core/inc/ptqueue.hxx
new file mode 100644
index 000000000000..21fb2ed1254e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/ptqueue.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PTQUEUE_HXX
+#define _PTQUEUE_HXX
+namespace binfilter {
+
+//Leider vertragen wir es nicht so gut, wenn wir mehr als ein Paint
+//gleichzeitig verarbeiten sollen. Insbesondere beim Drucken kommt dies
+//leider haeufig vor.
+//SwRootFrm::Paint() stellt fest, dass es zum zweitenmal gerufen wird, und
+//traegt das Rechteck sowie die dazugehoerige Shell in den PaintCollector ein.
+//Diejenigen stellen, die moeglicherweise das doppelte Paint "Verursachen"
+//brauchen nur noch zum richtigen Zeitpunkt die gesammelten Paints verarbeiten.
+//Derzeit bietet sich der Druckvorgang an, und zwar nach dem Druck von jeweils
+//einer Seite.
+
+//Das Invalidieren der Windows direkt aus dem RootFrm::Paint hat sich als nicht
+//erfolgreich erwiesen, weil die Paints dann in den allermeisten Faellen
+//wiederum zu einem sehr unguenstigen Zeitpunkt ankommen.
+//Nach dem Druck jeder Seite ein Update auf alle Fenster auszuloesen scheint
+//auch nicht angeraten, weil einerseits die edit-Windows nicht im direkten
+//Zugriff sind und anderseits das notwendige Update je nach Plattform extrem
+//teuer werden kann.
+
+class SwQueuedPaint;
+class ViewShell;
+class SwRect;
+
+class SwPaintQueue
+{
+public:
+ static SwQueuedPaint *pQueue;
+
+ static void Remove( ViewShell *pSh );
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/rootfrm.hxx b/binfilter/bf_sw/source/core/inc/rootfrm.hxx
new file mode 100644
index 000000000000..bf5d8af13b69
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/rootfrm.hxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ROOTFRM_HXX
+#define _ROOTFRM_HXX
+
+#include "layfrm.hxx"
+class OutputDevice;
+namespace binfilter {
+
+class SwCntntFrm;
+class ViewShell;
+class SdrPage;
+class SwFrmFmt;
+class SwPaM;
+class SwCursor;
+class SwShellCrsr;
+class SwTableCursor;
+class SwRegionRects;
+
+class SwLayVout;
+class SwDestroyList;
+class SwCurrShells;
+struct SwPosition;
+struct SwCrsrMoveState;
+
+#define HACK_TABLEMODE_INIT 0
+#define HACK_TABLEMODE_LOCKLINES 1
+#define HACK_TABLEMODE_PAINTLINES 2
+#define HACK_TABLEMODE_UNLOCKLINES 3
+#define HACK_TABLEMODE_EXIT 4
+
+#define INV_SIZE 1
+#define INV_PRTAREA 2
+#define INV_POS 4
+#define INV_TABLE 8
+#define INV_SECTION 16
+#define INV_LINENUM 32
+#define INV_DIRECTION 64
+
+class SwRootFrm: public SwLayoutFrm
+{
+ //Muss das Superfluous temporaer abschalten.
+ friend void AdjustSizeChgNotify( SwRootFrm *pRoot );
+
+ //Pflegt pLastPage (Cut() und Paste() vom SwPageFrm
+ friend inline void SetLastPage( SwPageFrm* );
+
+ // Fuer das Anlegen und Zerstoeren des virtuellen Outputdevice-Managers
+ friend void _FrmInit(); //erzeugt pVout
+ friend void _FrmFinit(); //loescht pVout
+
+ static SwLayVout *pVout;
+ static BOOL bInPaint; //Schutz gegen doppelte Paints.
+ static BOOL bNoVirDev; //Bei SystemPaints kein virt. Device
+
+ BOOL bCheckSuperfluous :1; //Leere Seiten suchen?
+ BOOL bIdleFormat :1; //Idle-Formatierer anwerfen?
+ BOOL bBrowseWidthValid :1; //Ist nBrowseWidth gueltig?
+ BOOL bDummy2 :1; //Unbenutzt
+ BOOL bTurboAllowed :1;
+ BOOL bAssertFlyPages :1; //Ggf. weitere Seiten fuer Flys einfuegen?
+ BOOL bDummy :1; //Unbenutzt
+ BOOL bIsVirtPageNum :1; //gibt es eine virtuelle Seitennummer ?
+ BOOL bIsNewLayout :1; //Layout geladen oder neu erzeugt.
+ BOOL bCallbackActionEnabled:1; //Keine Action in Benachrichtung erwuenscht
+ //siehe dcontact.cxx, ::Changed()
+
+ //Fuer den BrowseMode. nBrowseWidth ist die Aeussere Kante des am weitesten
+ //rechts stehenden Objectes. Die rechte Kante der Seiten soll im BrowseMode
+ //nicht kleiner werden als dieser Wert.
+ long nBrowseWidth;
+
+ //Wenn nur _ein: CntntFrm zu formatieren ist, so steht dieser in pTurbo.
+ const SwCntntFrm *pTurbo;
+
+ //Die letzte Seite wollen wir uns nicht immer muehsam zusammensuchen.
+ SwPageFrm *pLastPage;
+
+ //Die Root kuemmert sich nun auch um den Shell-Zugriff. Ueber das Dokument
+ //sollte man auch immer an die Root herankommen und somit auch immer
+ //einen Zugriff auf die Shell haben.
+ //Der Pointer pCurrShell ist der Pointer auf irgendeine der Shells fuer
+ //das Dokument
+ //Da es durchaus nicht immer egal ist, auf welcher Shell gearbeitet wird,
+ //ist es notwendig die aktive Shell zu kennen. Das wird dadurch angenaehert,
+ //dass der Pointer pCurrShell immer dann umgesetzt wird, wenn eine
+ //Shell den Fokus erhaelt (FEShell). Zusaetzlich wird der Pointer
+ //Temporaer von SwCurrShell umgesetzt, dieses wird typischerweise
+ //ueber das Macro SET_CURR_SHELL erledigt. Makro + Klasse sind in der
+ //ViewShell zu finden. Diese Objekte koennen auch verschachtelt (auch fuer
+ //unterschiedliche Shells) erzeugt werden. Sie werden im Array pCurrShells
+ //gesammelt.
+ //Weiterhin kann es noch vorkommen, dass eine Shell aktiviert wird,
+ //waehrend noch ein CurrShell-Objekt "aktiv" ist. Dieses wird dann in
+ //pWaitingCurrShell eingetragen und vom letzten DTor der CurrShell
+ //"aktiviert".
+ //Ein weiteres Problem ist dass Zerstoeren einer Shell waehrend sie aktiv
+ //ist. Der Pointer pCurrShell wird dann auf eine beliebige andere Shell
+ //umgesetzt.
+ //Wenn zum Zeitpunkt der zerstoerung einer Shell diese noch in irgendwelchen
+ //CurrShell-Objekten referenziert wird, so wird auch dies aufgeklart.
+ friend class CurrShell;
+ friend void InitCurrShells( SwRootFrm *pRoot );
+ ViewShell *pCurrShell;
+ ViewShell *pWaitingCurrShell;
+ SwCurrShells *pCurrShells;
+
+ //Eine Page im DrawModel pro Dokument, hat immer die Groesse der Root.
+ SdrPage *pDrawPage;
+
+ SwDestroyList* pDestroy;
+
+ USHORT nPhyPageNums; //Anzahl der Seiten.
+#ifdef ACCESSIBLE_LAYOUT
+ sal_uInt16 nAccessibleShells; // Number of accessible shells
+#endif
+
+ void ImplCalcBrowseWidth();
+ void ImplInvalidateBrowseWidth();
+
+ void _DeleteEmptySct(); // zerstoert ggf. die angemeldeten SectionFrms
+ void _RemoveFromList( SwSectionFrm* pSct ); // entfernt SectionFrms aus der Delete-Liste
+
+protected:
+
+ virtual void MakeAll();
+
+public:
+
+ //MasterObjekte aus der Page entfernen (von den Ctoren gerufen).
+ static void RemoveMasterObjs( SdrPage *pPg );
+
+ //Virtuelles Device ausgeben (z.B. wenn Animationen ins Spiel kommen)
+ //Clipping sparen, wenn im Vout eh genau das Cliprechteck ausgegeben wird
+
+ SwRootFrm( SwFrmFmt*, ViewShell* );
+ ~SwRootFrm();
+
+ ViewShell *GetCurrShell() const { return pCurrShell; }
+ void DeRegisterShell( ViewShell *pSh );
+
+ //Start-/EndAction fuer alle Shells auf moeglichst hoeher
+ //(Shell-Ableitungs-)Ebene aufsetzen. Fuer die StarONE Anbindung, die
+ //die Shells nicht dirkt kennt.
+ //Der ChangeLinkd der CrsrShell (UI-Benachrichtigung) wird im EndAllAction
+ //automatisch gecallt.
+ void StartAllAction();
+ void EndAllAction( BOOL bVirDev = FALSE );
+
+ // fuer bestimmte UNO-Aktionen (Tabellencursor) ist es notwendig, dass alle Actions
+ // kurzfristig zurueckgesetzt werden. Dazu muss sich jede ViewShell ihren alten Action-zaehler
+ // merken
+ void UnoRemoveAllActions(){DBG_BF_ASSERT(0, "STRIP");} //STRIP001 void UnoRemoveAllActions();
+ void UnoRestoreAllActions(){DBG_BF_ASSERT(0, "STRIP");} //STRIP001 void UnoRestoreAllActions();
+
+ const SdrPage* GetDrawPage() const { return pDrawPage; }
+ SdrPage* GetDrawPage() { return pDrawPage; }
+ void SetDrawPage( SdrPage* pNew ){ pDrawPage = pNew; }
+
+ virtual SwTwips ShrinkFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual SwTwips GrowFrm ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+#ifdef DBG_UTIL
+#endif
+
+#ifndef VERTICAL_LAYOUT
+ void SetFixSize( SzPtr );
+#endif
+ virtual void ChgSize( const Size& aNewSize );
+
+ inline void SetIdleFlags();
+ BOOL IsIdleFormat() const { return bIdleFormat; }
+ void ResetIdleFormat() { bIdleFormat = FALSE; }
+
+ //Sorgt dafuer, dass alle gewuenschten Seitengebunden Flys eine Seite finden
+ void SetAssertFlyPages() { bAssertFlyPages = TRUE; }
+ void AssertFlyPages();
+ BOOL IsAssertFlyPages() { return bAssertFlyPages; }
+
+ //Stellt sicher, dass ab der uebergebenen Seite auf allen Seiten die
+ //Seitengebundenen Rahmen auf der richtigen Seite (Seitennummer) stehen.
+ void AssertPageFlys( SwPageFrm * );
+
+ //Saemtlichen Inhalt invalidieren, Size oder PrtArea
+ void InvalidateAllCntnt( BYTE nInvalidate = INV_SIZE );
+
+ //Ueberfluessige Seiten entfernen.
+ void SetSuperfluous() { bCheckSuperfluous = TRUE; }
+ BOOL IsSuperfluous() const { return bCheckSuperfluous; }
+ void RemoveSuperfluous();
+
+ //abfragen/setzen der aktuellen Seite und der Gesamtzahl der Seiten.
+ //Es wird soweit wie notwendig Formatiert.
+ USHORT GetPageNum() const { return nPhyPageNums; }
+ void DecrPhyPageNums() { --nPhyPageNums; }
+ void IncrPhyPageNums() { ++nPhyPageNums; }
+ BOOL IsVirtPageNum() const { return bIsVirtPageNum; }
+ inline void SetVirtPageNum( const BOOL bOf ) const;
+
+
+ //Der Crsr moechte die zu selektierenden Bereiche wissen.
+
+ // Calculates the cells included from the current selection
+ // false: There was no result because of an invalid layout
+ // true: Everything worked fine.
+
+ void DisallowTurbo() const { ((SwRootFrm*)this)->bTurboAllowed = FALSE; }
+ void ResetTurboFlag() const { ((SwRootFrm*)this)->bTurboAllowed = TRUE; }
+ BOOL IsTurboAllowed() const { return bTurboAllowed; }
+ void SetTurbo( const SwCntntFrm *pCntnt ) { pTurbo = pCntnt; }
+ void ResetTurbo() { pTurbo = 0; }
+ const SwCntntFrm *GetTurbo() { return pTurbo; }
+
+ //Fussnotennummern aller Seiten auf den neuesten Stand bringen.
+
+ //Alle Fussnoten (nicht etwa die Referenzen) entfernen.
+ void RemoveFtns( SwPageFrm *pPage = 0, BOOL bPageOnly = FALSE,
+ BOOL bEndNotes = FALSE );
+ void CheckFtnPageDescs( BOOL bEndNote );
+
+ const SwPageFrm *GetLastPage() const { return pLastPage; }
+ SwPageFrm *GetLastPage() { return pLastPage; }
+
+ static BOOL IsInPaint() { return bInPaint; }
+
+ static void SetNoVirDev( const BOOL bNew ) { bNoVirDev = bNew; }
+
+ inline long GetBrowseWidth() const;
+ void SetBrowseWidth( long n ) { bBrowseWidthValid = TRUE; nBrowseWidth = n;}
+ inline void InvalidateBrowseWidth();
+
+
+ BOOL IsNewLayout() const { return bIsNewLayout; }
+ void ResetNewLayout() { bIsNewLayout = FALSE;}
+
+ // Hier werden leere SwSectionFrms zur Zerstoerung angemeldet
+ // und spaeter zerstoert oder wieder abgemeldet
+ void InsertEmptySct( SwSectionFrm* pDel );
+ void DeleteEmptySct() { if( pDestroy ) _DeleteEmptySct(); }
+ void RemoveFromList( SwSectionFrm* pSct ) { if( pDestroy ) _RemoveFromList( pSct ); }
+#ifdef DBG_UTIL
+ // Wird zur Zeit nur fuer ASSERTs benutzt:
+ BOOL IsInDelList( SwSectionFrm* pSct ) const; // Ist der SectionFrm in der Liste enthalten?
+#endif
+
+
+ void SetCallbackActionEnabled( BOOL b ) { bCallbackActionEnabled = b; }
+ BOOL IsCallbackActionEnabled() const { return bCallbackActionEnabled; }
+
+#ifdef ACCESSIBLE_LAYOUT
+ sal_Bool IsAnyShellAccessible() const { return nAccessibleShells > 0; }
+ void AddAccessibleShell() { ++nAccessibleShells; }
+ void RemoveAccessibleShell() { --nAccessibleShells; }
+#endif
+
+ /** get page frame by phyiscal page number
+
+ OD 14.01.2003 #103492#
+ looping through the lowers, which are page frame, in order to find the
+ page frame with the given physical page number.
+ if no page frame is found, 0 is returned.
+ Note: Empty page frames are also returned.
+
+ @param _nPageNum
+ input parameter - physical page number of page frame to be searched and
+ returned.
+
+ @return pointer to the page frame with the given physical page number
+ */
+ SwPageFrm* GetPageByPageNum( sal_uInt16 _nPageNum ) const;
+};
+
+inline long SwRootFrm::GetBrowseWidth() const
+{
+ if ( !bBrowseWidthValid )
+ ((SwRootFrm*)this)->ImplCalcBrowseWidth();
+ return nBrowseWidth;
+}
+
+inline void SwRootFrm::InvalidateBrowseWidth()
+{
+ if ( bBrowseWidthValid )
+ ImplInvalidateBrowseWidth();
+}
+
+inline void SwRootFrm::SetIdleFlags()
+{
+ bIdleFormat = TRUE;
+}
+
+inline void SwRootFrm::SetVirtPageNum( const BOOL bOf) const
+{
+ ((SwRootFrm*)this)->bIsVirtPageNum = bOf;
+}
+
+} //namespace binfilter
+#endif //_ROOTFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/rowfrm.hxx b/binfilter/bf_sw/source/core/inc/rowfrm.hxx
new file mode 100644
index 000000000000..7523c988ed0c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/rowfrm.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ROWFRM_HXX
+#define _ROWFRM_HXX
+
+#include <tools/mempool.hxx>
+
+#include "layfrm.hxx"
+namespace binfilter {
+
+class SwTableLine;
+class SwBorderAttrs;
+
+class SwRowFrm: public SwLayoutFrm
+{
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+ //Aendern nur die Framesize, nicht die PrtArea-SSize
+ virtual SwTwips ShrinkFrm( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+ virtual SwTwips GrowFrm ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+
+ const SwTableLine *pTabLine;
+
+protected:
+ virtual void MakeAll();
+
+public:
+ SwRowFrm( const SwTableLine & );
+ ~SwRowFrm();
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+
+ //Zum Anmelden der Flys nachdem eine Zeile erzeugt _und_ eingefuegt wurde.
+ //Muss vom Erzeuger gerufen werden, denn erst nach dem Konstruieren wird
+ //Das Teil gepastet; mithin ist auch erst dann die Seite zum Anmelden der
+ //Flys erreichbar.
+ void RegistFlys( SwPageFrm *pPage = 0 );
+
+ const SwTableLine *GetTabLine() const { return pTabLine; }
+
+ //Passt die Zellen auf die aktuelle Hoehe an, invalidiert die Zellen
+ //wenn die Direction nicht der Hoehe entspricht.
+ void AdjustCells( const SwTwips nHeight, const BOOL bHeight );
+ DECL_FIXEDMEMPOOL_NEWDEL(SwRowFrm)
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/scrrect.hxx b/binfilter/bf_sw/source/core/inc/scrrect.hxx
new file mode 100644
index 000000000000..5951aafb84d1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/scrrect.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SCRRECT_HXX
+#define _SCRRECT_HXX
+
+
+#include <bf_svtools/svarray.hxx>
+#include "swrect.hxx"
+#include <swtypes.hxx>
+namespace binfilter {
+
+class SwStripe
+{
+ SwTwips nY;
+ SwTwips nHeight;
+public:
+ inline SwStripe( SwTwips nPos, SwTwips nHght )
+ : nY( nPos ), nHeight( nHght ) {}
+ inline SwTwips GetY() const { return nY; }
+ inline SwTwips& Y() { return nY; }
+ inline SwTwips GetHeight() const { return nHeight; }
+ inline SwTwips& Height() { return nHeight; }
+ inline SwTwips GetBottom() const { return nHeight ? nY + nHeight - 1 : nY; }
+ inline BOOL operator<( const SwStripe &rTst ) const
+ { return nY < rTst.nY || ( nY == rTst.nY && nHeight > rTst.nHeight ); }
+ inline BOOL operator==( const SwStripe& rTst ) const
+ { return nY == rTst.nY && nHeight == rTst.nHeight; }
+};
+
+SV_DECL_VARARR( SwStripeArr, SwStripe, 1, 4 )//STRIP008 ;
+
+class SwStripes : public SwStripeArr, public SwStripe
+{
+ SwTwips nMin; // Left minimum
+ SwTwips nMax; // Right maximum
+public:
+#ifdef VERTICAL_LAYOUT
+ SwStripes( SwTwips nPos, SwTwips nSize, SwTwips nMn, SwTwips nMx )
+ : SwStripe( nPos, nSize ), nMin( nMn ), nMax( nMx ) {}
+#else
+ SwStripes( const SwRect& rRect ) : SwStripe( rRect.Top(), rRect.Height() ),
+ nMin(rRect.Left()), nMax(rRect.Left() + rRect.Width()) {}
+#endif
+ inline SwTwips GetMin() const { return nMin; }
+ inline SwTwips GetMax() const { return nMax; }
+ inline void SetMin( const SwTwips nNew ) { nMin = nNew; }
+ inline void SetMax( const SwTwips nNew ) { nMax = nNew; }
+ inline void ChkMin( const SwTwips nNew ) { if( nNew < nMin ) nMin = nNew; }
+ inline void ChkMax( const SwTwips nNew ) { if( nNew > nMax ) nMax = nNew; }
+ inline SwTwips GetRight() const { return nMax > nMin ? nMax - 1 : nMax; }
+ inline SwTwips GetWidth() const { return nMax - nMin; }
+};
+
+class SwScrollColumn
+{
+ SwTwips nX;
+ SwTwips nWidth;
+ SwTwips nOffs;
+#ifdef VERTICAL_LAYOUT
+ BOOL bVertical;
+public:
+ inline SwScrollColumn( SwTwips nPos, SwTwips nSz, SwTwips nOff, BOOL bVert )
+ : nX( nPos ), nWidth( nSz ), nOffs( nOff ), bVertical( bVert ) {}
+ inline SwScrollColumn( const SwScrollColumn& rCol )
+ : nX( rCol.nX ), nWidth( rCol.nWidth ),
+ nOffs( rCol.nOffs ), bVertical( rCol.bVertical ) {}
+ BOOL IsVertical() const { return bVertical; }
+ inline BOOL operator<( const SwScrollColumn &rTst ) const
+ { return bVertical < rTst.bVertical || ( bVertical == rTst.bVertical &&
+ ( nX < rTst.nX || ( nX == rTst.nX && ( nWidth < rTst.nWidth ||
+ ( nWidth == rTst.nWidth && nOffs < rTst.nOffs ) ) ) ) ); }
+ inline BOOL operator==( const SwScrollColumn &rTst ) const
+ { return bVertical == rTst.bVertical && nX == rTst.nX &&
+ nWidth == rTst.nWidth && nOffs == rTst.nOffs;}
+#else
+public:
+ inline SwScrollColumn( const SwRect& rRect, SwTwips nOff )
+ : nX( rRect.Left() ), nWidth( rRect.Width() ), nOffs( nOff ) {}
+ inline SwScrollColumn( const SwScrollColumn& rCol )
+ : nX( rCol.nX ), nWidth( rCol.nWidth ), nOffs( rCol.nOffs ) {}
+ inline BOOL operator<( const SwScrollColumn &rTst ) const
+ { return nX < rTst.nX || ( nX == rTst.nX && ( nWidth < rTst.nWidth ||
+ ( nWidth == rTst.nWidth && nOffs < rTst.nOffs ) ) ); }
+ inline BOOL operator==( const SwScrollColumn &rTst ) const
+ { return nX == rTst.nX && nWidth == rTst.nWidth && nOffs == rTst.nOffs;}
+#endif
+ inline SwTwips GetX() const { return nX; }
+ inline SwTwips GetWidth() const { return nWidth; }
+ inline SwTwips GetOffs() const { return nOffs; }
+ inline void ClrOffs() { nOffs = 0; }
+ inline SwTwips GetRight() const { return nWidth ? nX + nWidth - 1 : nX; }
+};
+
+typedef SwStripes* SwStripesPtr;
+SV_DECL_PTRARR_SORT(SwScrollStripes, SwStripesPtr, 1, 4)
+
+class SwScrollArea : public SwScrollColumn, public SwScrollStripes
+{
+public:
+ inline SwScrollArea( const SwScrollColumn &rCol, SwStripes* pStripes )
+ : SwScrollColumn( rCol )
+ { Insert( pStripes ); }
+};
+
+typedef SwScrollArea* SwScrollAreaPtr;
+SV_DECL_PTRARR_SORT(SScrAreas,SwScrollAreaPtr,1,2)//STRIP008 ;
+
+class SwScrollAreas : public SScrAreas
+{
+public:
+};
+
+
+} //namespace binfilter
+#endif //_SCRRECT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/sectfrm.hxx b/binfilter/bf_sw/source/core/inc/sectfrm.hxx
new file mode 100644
index 000000000000..1bdabf05c508
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/sectfrm.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SECTFRM_HXX
+#define _SECTFRM_HXX
+
+#include <tools/mempool.hxx>
+
+#include "layfrm.hxx"
+#include "flowfrm.hxx"
+namespace binfilter {
+
+class SwSection;
+class SwSectionFmt;
+class SwAttrSetChg;
+class SwFtnContFrm;
+class SwFtnFrm;
+class SwLayouter;
+
+#define FINDMODE_ENDNOTE 1
+#define FINDMODE_LASTCNT 2
+#define FINDMODE_MYLAST 4
+
+class SwSectionFrm: public SwLayoutFrm, public SwFlowFrm
+{
+ SwSection* pSection;
+
+ void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &,
+ SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
+ void _Cut( BOOL bRemove );
+ // Is there a FtnContainer?
+ // An empty sectionfrm without FtnCont is superfluous
+ BOOL IsSuperfluous() const { return !ContainsAny() && !ContainsFtnCont(); }
+ void CalcFtnAtEndFlag();
+ void CalcEndAtEndFlag();
+protected:
+ virtual void MakeAll();
+ virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat ){DBG_BF_ASSERT(0, "STRIP"); return FALSE;} //STRIP001 virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat );
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+public:
+ SwSectionFrm( SwSection & ); //Inhalt wird nicht erzeugt!
+ SwSectionFrm( SwSectionFrm &, BOOL bMaster );//_Nur_ zum Erzeugen von Master/Follows
+ ~SwSectionFrm();
+
+ void Init();
+ virtual void CheckDirection( BOOL bVert );
+
+ virtual void Cut();
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+
+ inline const SwSectionFrm *GetFollow() const;
+ inline SwSectionFrm *GetFollow();
+ inline const SwSectionFrm *FindMaster() const;
+ inline SwSectionFrm *FindMaster();
+ SwCntntFrm *FindLastCntnt( BYTE nMode = 0 );
+ inline const SwCntntFrm *FindLastCntnt( BYTE nMode = 0 ) const;
+ inline SwSection* GetSection() { return pSection; }
+ inline const SwSection* GetSection() const { return pSection; }
+ inline void ColLock() { bColLocked = TRUE; }
+ inline void ColUnlock() { bColLocked = FALSE; }
+
+ void CalcFtnCntnt();
+ void SimpleFormat();
+ void MergeNext( SwSectionFrm* pNxt );
+ //Zerlegt den pFrm umgebenden SectionFrm in zwei Teile,
+ //pFrm an den Anfang des 2. Teils
+ void DelEmpty( BOOL bRemove ); // wie Cut(), Follow-Verkettung wird aber mitgepflegt
+ BOOL IsToIgnore() const // Keine Groesse, kein Inhalt, muss ignoriert werden
+ { return !Frm().Height() && !ContainsCntnt(); }
+ SwSectionFrm *FindSectionMaster();
+ SwFtnContFrm* ContainsFtnCont( const SwFtnContFrm* pCont = NULL ) const;
+ BOOL Growable() const;
+ SwTwips _Shrink( SwTwips, SZPTR BOOL bTst );
+ SwTwips _Grow ( SwTwips, SZPTR BOOL bTst );
+
+ // A sectionfrm has to maximize, if he has a follow or a ftncontainer at
+ // the end of the page. A superfluous follow will be ignored,
+ // if bCheckFollow is set.
+ BOOL ToMaximize( BOOL bCheckFollow ) const;
+ inline BOOL _ToMaximize() const
+ { if( !pSection ) return FALSE; return ToMaximize( FALSE ); }
+ BOOL MoveAllowed( const SwFrm* ) const;
+ BOOL CalcMinDiff( SwTwips& rMinDiff ) const;
+ // Uebergibt man kein bOverSize bzw. FALSE, so ist der Returnwert
+ // >0 fuer Undersized-Frames, ==0 sonst.
+ // Uebergibt man TRUE, so kann es auch einen negativen Returnwert geben,
+ // wenn der SectionFrm nicht vollstaendig ausgefuellt ist, was z.B. bei
+ // SectionFrm mit Follow meist vorkommt. Benoetigt wird dies im
+ // FormatWidthCols, um "Luft" aus den Spalten zu lassen.
+ long Undersize( BOOL bOverSize = FALSE );
+ // Groesse an die Umgebung anpassen
+ void _CheckClipping( BOOL bGrow, BOOL bMaximize );
+
+ void InvalidateFtnPos();
+
+ static void MoveCntntAndDelete( SwSectionFrm* pDel, BOOL bSave );
+ DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
+};
+
+typedef SwSectionFrm* SwSectionFrmPtr;
+SV_DECL_PTRARR_SORT( SwDestroyList, SwSectionFrmPtr, 1, 5)
+
+inline const SwSectionFrm *SwSectionFrm::GetFollow() const
+{
+ return (const SwSectionFrm*)SwFlowFrm::GetFollow();
+}
+inline SwSectionFrm *SwSectionFrm::GetFollow()
+{
+ return (SwSectionFrm*)SwFlowFrm::GetFollow();
+}
+
+inline const SwSectionFrm *SwSectionFrm::FindMaster() const
+{
+ return (const SwSectionFrm*)SwFlowFrm::FindMaster();
+}
+inline SwSectionFrm *SwSectionFrm::FindMaster()
+{
+ return (SwSectionFrm*)SwFlowFrm::FindMaster();
+}
+
+inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( BYTE nMode ) const
+{
+ return ((SwSectionFrm*)this)->FindLastCntnt( nMode );
+}
+
+
+} //namespace binfilter
+#endif //_SECTFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/setmapvirtdev.hxx b/binfilter/bf_sw/source/core/inc/setmapvirtdev.hxx
new file mode 100644
index 000000000000..4965afa41abe
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/setmapvirtdev.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SETMAPVIRTDEV_HXX
+#define _SETMAPVIRTDEV_HXX
+class OutputDevice;
+class VirtualDevice;
+class MapMode;
+class Point;
+namespace binfilter {
+
+
+
+/** method to set mapping/pixel offset for virtual output device
+
+ OD 12.11.2002 #96272# - method implements two solutions for the mapping of
+ the virtual output device:
+ The old solution set the origin of the mapping mode, which will be used in
+ the virtual output device. This causes several paint errors, because of the
+ different roundings in the virtual output device and the original output device.
+ The new solution avoids the rounding differences between virtual and original
+ output device by setting a pixel offset at the virtual output device.
+ A local boolean controls, which solution is used, in order to switch in
+ escalation back to old solution.
+
+ @author OD
+
+ @param _pOrgOutDev
+ input parameter - constant instance of the original output device, for which
+ the virtual output device is created.
+
+ @param _pVirDev
+ input/output parameter - instance of the virtual output device.
+
+ @param _pMapMode
+ input/output parameter - instance of the mapping mode, which will be set
+ at the virtual output device.
+
+ @param _rNewOrigin
+ input parameter - constant instance of the origin, which will be used in
+ the virtual output device
+*/
+void SetMappingForVirtDev( const Point& _rNewOrigin,
+ MapMode* _pMapMode,
+ const OutputDevice* _pOrgOutDev,
+ VirtualDevice* _pVirDev );
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/splargs.hxx b/binfilter/bf_sw/source/core/inc/splargs.hxx
new file mode 100644
index 000000000000..29ab650fd06b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/splargs.hxx
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SPLARGS_HXX
+#define _SPLARGS_HXX
+
+#include <tools/solar.h>
+#include <tools/gen.hxx>
+#include <limits.h> // USHRT_MAX
+#include <tools/string.hxx>
+
+class SwTxtNode;
+class SwIndex;
+class SpellCheck;
+
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+namespace binfilter {
+
+/*************************************************************************
+ * struct SwConversionArgs
+ *************************************************************************/
+
+
+struct SwArgsBase // used for text conversion (Hangul/Hanja, ...)
+{
+ SwTxtNode *pStartNode;
+ SwIndex &rStartIdx;
+ SwTxtNode *pEndNode;
+ SwIndex &rEndIdx;
+
+ SwArgsBase(
+ SwTxtNode* pStart, SwIndex& rStart,
+ SwTxtNode* pEnd, SwIndex& rEnd )
+ : pStartNode( pStart ), rStartIdx( rStart ),
+ pEndNode( pEnd ), rEndIdx( rEnd )
+ {}
+};
+
+/*************************************************************************
+ * struct SwConversionArgs
+ * used for text conversion (Hangul/Hanja, ...)
+ *************************************************************************/
+
+struct SwConversionArgs : SwArgsBase
+{
+ ::rtl::OUString aConvText;
+ sal_Bool bConvTextFound; // convertible text portion found
+
+ SwConversionArgs(
+ SwTxtNode* pStart, SwIndex& rStart,
+ SwTxtNode* pEnd, SwIndex& rEnd )
+ : SwArgsBase( pStart, rStart, pEnd, rEnd ),
+ bConvTextFound( sal_False )
+ {}
+};
+
+/*************************************************************************
+ * struct SwSpellArgs
+ *************************************************************************/
+
+struct SwSpellArgs : SwArgsBase
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpeller;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt;
+
+ SwSpellArgs(::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &rxSplChk,
+ SwTxtNode* pStart, SwIndex& rStart,
+ SwTxtNode* pEnd, SwIndex& rEnd )
+ : SwArgsBase( pStart, rStart, pEnd, rEnd ),
+ xSpeller( rxSplChk )
+ {}
+};
+
+/*************************************************************************
+ * class SwInterHyphInfo
+ *************************************************************************/
+
+// Parameter-Klasse fuer Hyphenate
+// docedt.cxx: SwDoc::Hyphenate()
+// txtedt.cxx: SwTxtNode::Hyphenate()
+// txthyph.cxx: SwTxtFrm::Hyphenate()
+
+class SwInterHyphInfo
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
+ const Point aCrsrPos;
+ sal_Bool bAuto : 1;
+ sal_Bool bNoLang : 1;
+ sal_Bool bCheck : 1;
+public:
+ xub_StrLen nStart;
+ xub_StrLen nLen;
+ xub_StrLen nWordStart;
+ xub_StrLen nWordLen;
+ xub_StrLen nHyphPos;
+ sal_uInt16 nMinTrail;
+
+ inline SwInterHyphInfo( const Point &rCrsrPos,
+ const sal_uInt16 nStart = 0,
+ const sal_uInt16 nLen = USHRT_MAX )
+ : aCrsrPos( rCrsrPos ),
+ bAuto(sal_False), bNoLang(sal_False), bCheck(sal_False),
+ nStart(nStart), nLen(nLen),
+ nWordStart(0), nWordLen(0),
+ nMinTrail(0), nHyphPos(0)
+ { }
+ inline xub_StrLen GetStart() const { return nStart; }
+ inline xub_StrLen GetLen() const { return nLen; }
+ inline xub_StrLen GetEnd() const
+ { return STRING_LEN == nLen ? nLen : nStart + nLen; }
+ inline const Point *GetCrsrPos() const
+ { return aCrsrPos.X() || aCrsrPos.Y() ? &aCrsrPos : 0; }
+ inline sal_Bool IsAuto() const { return bAuto; }
+ inline void SetAuto( const sal_Bool bNew ) { bAuto = bNew; }
+ inline sal_Bool IsCheck() const { return bCheck; }
+ inline void SetCheck( const sal_Bool bNew ) { bCheck = bNew; }
+ inline sal_Bool IsNoLang() const { return bNoLang; }
+ inline void SetNoLang( const sal_Bool bNew ) { bNoLang = bNew; }
+
+ inline void
+ SetHyphWord(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > &rxHW)
+ { xHyphWord = rxHW; }
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord >
+ GetHyphWord() { return xHyphWord; }
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/splcstk.hxx b/binfilter/bf_sw/source/core/inc/splcstk.hxx
new file mode 100644
index 000000000000..e035feb2b6a4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/splcstk.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SPLCSTK_HXX
+#define _SPLCSTK_HXX
+
+#include <tools/solar.h>
+namespace binfilter {
+
+class SwIntrnlCrsr;
+class SwCrsrShell;
+struct SwPosition;
+
+class SwSpellCrsrStk
+{
+ SwPosition* pErrorPos;
+ SwIntrnlCrsr * pCurCrsr; // der aktuelle Cursor
+ SwIntrnlCrsr * pCrsrStk; // der Cursor-Stack
+ SwCrsrShell & rCrsrShell; // die akt. CrsrShell
+
+public:
+ SwSpellCrsrStk( SwCrsrShell& rShell );
+ ~SwSpellCrsrStk();
+
+ void SetCurCrsr(); // akt. Cursor in der CrsrShell mit akt. setzen
+ BOOL SetNextCrsr(); // gehe zum naechsten Cursor im Ring (falls am
+ // Ende returne FALSE;
+ void RestoreCrsrs(); // alle Cursor aus dem CursorStack wieder
+ // in der Shell setzen
+ void StoreErrPos(); // speicher die akt. Start-Position als Error,
+ // an dieser wird spaeter wieder aufgesetzt
+ void SetErrPos(); // akt. Cursor auf die Error Position setzen
+
+#if 0
+ // ??? wird das ueberhaupt benoetigt ???
+ // fuer die EditShell, damit sie die Cursor
+ // aus den Loeschbereichen verschieben kann
+ SwPaM* GetCurCrsr() const;
+ SwPosition* GetErrorPos() const { return pErrorPos; }
+#endif
+};
+
+
+} //namespace binfilter
+#endif // _SPLCSTK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/swblocks.hxx b/binfilter/bf_sw/source/core/inc/swblocks.hxx
new file mode 100644
index 000000000000..7a2bb3ba1bb9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/swblocks.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWBLOCKS_HXX
+#define _SWBLOCKS_HXX
+
+#include <bf_so3/persist.hxx>
+/*N*/#include <tools/debug.hxx> //addded for stripping
+class SvxMacroTableDtor;
+namespace binfilter {
+
+class SfxMedium;
+class SwPaM;
+class SwDoc;
+
+class SvXMLTextBlocks;
+// Name eines Textblocks:
+
+
+
+
+class SwImpBlocks
+{
+ friend class SwTextBlocks;
+protected:
+ String aFile; // physikalischer Dateiname
+ String aName; // logischer Name der Datei
+ SwImpBlocks( const String&, BOOL = FALSE ){DBG_ASSERT(0, "STRIP")}; //STRIP001 ;
+public:
+ const String& GetFileName() const {return aFile;} // phys. Dateinamen liefern
+};
+
+
+
+
+class Sw3Io;
+class Sw3IoImp;
+
+class Sw3TextBlocks : public SwImpBlocks
+{
+
+public:
+ Sw3TextBlocks( const String& rFile): SwImpBlocks( rFile ){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 Sw3TextBlocks( const String& );
+
+
+
+ // Methoden fuer die neue Autokorrektur
+
+
+
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/swcache.hxx b/binfilter/bf_sw/source/core/inc/swcache.hxx
new file mode 100644
index 000000000000..29e85864e8df
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/swcache.hxx
@@ -0,0 +1,304 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWCACHE_HXX
+#define _SWCACHE_HXX
+
+
+
+
+/*
+ * Es werden Pointer auf Objekte verwaltet. Diese werden in einem einfachen
+ * PtrArray verwaltet.
+ * Angelegt (new) werden die Objekte von Cache-Zugriffsklassen, zuerstoert
+ * werden die Objekte vom Cache.
+ *
+ * Auf die Objekte kann wahlweise per Index in das Array oder per Suche
+ * zugegriffen werden. Soll per Index zugegriffen werden, so obliegt die
+ * Verwaltung des Index dem Anwender des Cache.
+ *
+ * Fuer die verwalteten Cache-Objekte gibt es eine Basisklasse, von dieser
+ * sind spezifische Klassen abzuleiten.
+ * In der Basisklasse werden die Cache-Objekte eines Cache doppelt verkettet,
+ * das ermoeglich die Implementierung eines LRU-Algorithmus.
+ *
+ * Der LRU kann in der Cache-Basisklasse manipuliert werden, indem ein
+ * virtueller First-Pointer gesetzt wird. Dieser kann auf den echten ersten
+ * plus einem Ofst gesetzt werden. Dadurch kann man den Anfangsbereich des
+ * Cache sichern und so dafuer sorgen, dass man waehrend bestimmter
+ * Operationen nicht den Cache versaut. Beispiel: Der Idle-Handler sollte nicht
+ * den Cache fuer den sichtbaren Bereich vernichten.
+ *
+ * Der Cache kann in der Groesse erweitert und wieder verkleinert werden.
+ * Beispiel: Fuer jede neue Shell wird der Cache fuer FormatInfo vergrossert
+ * und beim Destruieren der Shell wieder verkleinert.
+ *
+ */
+
+#ifdef DBG_UTIL
+#include <tools/string.hxx>
+#endif
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#include <bf_svtools/svstdarr.hxx>
+#endif
+namespace binfilter {
+class SwCacheObj;
+
+SV_DECL_PTRARR_DEL(SwCacheObjArr,SwCacheObj*,1,1)
+
+class SwCache : public SwCacheObjArr
+{
+ SvUShorts aFreePositions; //Freie Positionen fuer das Insert wenn
+ //die Maximalgrenze nicht erreicht ist.
+ //Immer wenn ein Objekt ausgetragen wird,
+ //so wird seine Position hier eingetragen.
+
+ SwCacheObj *pRealFirst; //_immer_ der echte LRU-erste
+ SwCacheObj *pFirst; //der virtuelle erste.
+ SwCacheObj *pLast;
+
+ const USHORT nMax; //Mehr sollen nicht aufgenommen werden,
+ //der Cache kann aber dynamisch um jeweils
+ //nMax vergroessert werden.
+ USHORT nCurMax; //Mehr werden nicht aufgenommen.
+
+
+ void DeleteObj( SwCacheObj *pObj );
+
+#ifdef DBG_UTIL
+ ByteString aName;
+ long nAppend; //Anzahl der Eintragungen durch Erweiterung.
+ long nInsertFree; //Anzahl der Eintragungen auf freie Plaetze.
+ long nReplace; //Anzahl der Ersetzungen durch ein neues Objekt
+ long nGetSuccess; //Anzahl der Erfolgreichen Get's
+ long nGetFail; //Anzahl der nicht Erfolgreichen Get's
+ long nToTop; //Anzahl der Umsortierungen (LRU)
+ long nDelete; //Anzahl der Loeschungen (von Aussen)
+ long nGetSeek; //Anzahl der Get's ohne Index
+ long nAverageSeekCnt; //Anzahl der Seek's fuer alle Get's ohne Index
+ long nFlushCnt; //Anzahl von Flush-Aufrufen.
+ long nFlushedObjects; //Anzahl der wg. Flush vernichteten Objekte
+ long nIncreaseMax; //Anzahl Cache-Erweiterungen
+ long nDecreaseMax; //Anzahl Cache-Verkleinerungen
+
+ void Check(); //Wird bei swcache.cxx mit DEBUG aktiv!
+#endif
+
+public:
+
+ //nur BYTE hineinstecken!!!
+#ifdef DBG_UTIL
+ SwCache( const USHORT nInitSize, const USHORT nGrowSize,
+ const ByteString &rNm );
+ ~SwCache();
+#else
+ SwCache( const USHORT nInitSize, const USHORT nGrowSize );
+#endif
+
+ void Flush( const BYTE nPercent = 100 );
+
+ //bToTop == FALSE -> Keine LRU-Umsortierung!
+ SwCacheObj *Get( const void *pOwner, const BOOL bToTop = TRUE );
+ SwCacheObj *Get( const void *pOwner, const USHORT nIndex,
+ const BOOL bToTop = TRUE );
+ void ToTop( SwCacheObj *pObj );
+
+ BOOL Insert( SwCacheObj *pNew );
+ void Delete( const void *pOwner );
+// void Delete( const void *pOwner, const USHORT nIndex );
+
+ void SetLRUOfst( const USHORT nOfst ); //nOfst sagt wieviele unangetastet
+ //bleiben sollen.
+ void ResetLRUOfst() { pFirst = pRealFirst; }
+
+ inline void IncreaseMax( const USHORT nAdd );
+ inline void DecreaseMax( const USHORT nSub );
+ USHORT GetCurMax() const { return nCurMax; }
+ inline SwCacheObj *First() { return pRealFirst; }
+ inline SwCacheObj *Last() { return pLast; }
+ inline SwCacheObj *Next( SwCacheObj *pCacheObj);
+};
+
+//Cache-Manipulation auf die sichere Art.
+class SwSaveSetLRUOfst
+{
+ SwCache &rCache;
+public:
+ SwSaveSetLRUOfst( SwCache &rC, const USHORT nOfst )
+ : rCache( rC ) { rCache.SetLRUOfst( nOfst ); }
+
+ ~SwSaveSetLRUOfst() { rCache.ResetLRUOfst(); }
+};
+
+//Das allgemeine CacheObjekt. Anwender des Cache muessen eine Klasse vom
+//CacheObjekt ableiten und dort die Nutzdaten unterbringen.
+
+class SwCacheObj
+{
+ friend class SwCache; //Der darf alles
+
+ SwCacheObj *pNext; //Fuer die LRU-Verkettung.
+ SwCacheObj *pPrev;
+
+ USHORT nCachePos; //Position im Cache-Array.
+
+ BYTE nLock;
+
+ inline SwCacheObj *GetNext() { return pNext; }
+ inline SwCacheObj *GetPrev() { return pPrev; }
+ inline void SetNext( SwCacheObj *pNew ) { pNext = pNew; }
+ inline void SetPrev( SwCacheObj *pNew ) { pPrev = pNew; }
+
+ inline void SetCachePos( const USHORT nNew ) { nCachePos = nNew; }
+
+protected:
+ const void *pOwner;
+ inline void SetOwner( const void *pNew ) { pOwner = pNew; }
+
+public:
+
+ SwCacheObj( const void *pOwner );
+ virtual ~SwCacheObj();
+
+ inline const void *GetOwner() const { return pOwner; }
+ inline BOOL IsOwner( const void *pNew ) const;
+
+ inline USHORT GetCachePos() const { return nCachePos; }
+ inline void Invalidate() { pOwner = 0; }
+
+ inline BOOL IsLocked() const { return 0 != nLock; }
+
+#ifndef DBG_UTIL
+ inline void Lock() { ++nLock; }
+ inline void Unlock() { --nLock; }
+#else
+ void Lock();
+ void Unlock();
+#endif
+
+ SwCacheObj *Next() { return pNext; }
+ SwCacheObj *Prev() { return pPrev; }
+
+};
+
+//Zugriffsklasse fuer den Cache. Im CTor wird das CacheObjekt erzeugt.
+//Wenn der Cache keines herausrueckt wird der Member zunaechst auf 0 gesetzt.
+//Beim Get wird dann eines erzeugt und, falls moeglich, in den Cache
+//eingetragen.
+//Anwender der des Cache muessen eine Klasse vom Access ableiten um
+//fuer Typsicherheit zu sorgen, die Basisklasse sollte fuer das Get aber immer
+//gerufen werden, ein Abgeleitetes Get sollte nur der Typsicherheit dienen.
+//Cache-Objekte werden stets gelockt solange die Instanz lebt.
+
+class SwCacheAccess
+{
+ SwCache &rCache;
+
+ void _Get();
+
+protected:
+ SwCacheObj *pObj;
+ const void *pOwner; //Kann ggf. in NewObj benutzt werden.
+
+ virtual SwCacheObj *NewObj() = 0;
+
+ inline SwCacheObj *Get();
+
+ inline SwCacheAccess( SwCache &rCache, const void *pOwner, BOOL bSeek = TRUE );
+ inline SwCacheAccess( SwCache &rCache, const void *pOwner, const USHORT nIndex );
+
+public:
+ ~SwCacheAccess() { if ( pObj ) pObj->Unlock(); }
+
+
+ //Abkuerzung fuer diejenigen, die wissen, das die Ableitung das IsAvailable
+ //nicht ueberladen haben.
+ BOOL IsAvail() const { return pObj != 0; }
+};
+
+inline void SwCache::IncreaseMax( const USHORT nAdd )
+{
+ nCurMax += nAdd;
+#ifdef DBG_UTIL
+ ++nIncreaseMax;
+#endif
+}
+inline void SwCache::DecreaseMax( const USHORT nSub )
+{
+ if ( nCurMax > nSub )
+ nCurMax -= nSub;
+#ifdef DBG_UTIL
+ ++nDecreaseMax;
+#endif
+}
+
+inline BOOL SwCacheObj::IsOwner( const void *pNew ) const
+{
+ return pOwner && pOwner == pNew;
+}
+
+inline SwCacheObj *SwCache::Next( SwCacheObj *pCacheObj)
+{
+ if ( pCacheObj )
+ return pCacheObj->GetNext();
+ else
+ return NULL;
+}
+
+inline SwCacheAccess::SwCacheAccess( SwCache &rC, const void *pOwn, BOOL bSeek ) :
+ rCache( rC ),
+ pOwner( pOwn ),
+ pObj( 0 )
+{
+ if ( bSeek && pOwner && 0 != (pObj = rCache.Get( pOwner )) )
+ pObj->Lock();
+}
+
+inline SwCacheAccess::SwCacheAccess( SwCache &rC, const void *pOwn,
+ const USHORT nIndex ) :
+ rCache( rC ),
+ pOwner( pOwn ),
+ pObj( 0 )
+{
+ if ( pOwner && 0 != (pObj = rCache.Get( pOwner, nIndex )) )
+ pObj->Lock();
+}
+
+inline SwCacheObj *SwCacheAccess::Get()
+{
+ if ( !pObj )
+ _Get();
+ return pObj;
+}
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/swfntcch.hxx b/binfilter/bf_sw/source/core/inc/swfntcch.hxx
new file mode 100644
index 000000000000..388c53c5f929
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/swfntcch.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFNTCCH_HXX
+#define _SWFNTCCH_HXX
+
+#include <tools/mempool.hxx>
+
+#define NUM_DEFAULT_VALUES 34
+
+#include "swcache.hxx"
+#include "swfont.hxx"
+namespace binfilter {
+
+class SfxPoolItem;
+class ViewShell;
+
+
+/*************************************************************************
+ * class SwFontCache
+ *************************************************************************/
+
+class SwFontCache : public SwCache
+{
+public:
+
+ inline SwFontCache() : SwCache(50,50
+#ifdef DBG_UTIL
+ , "Globaler AttributSet/Font-Cache pSwFontCache"
+#endif
+ ) {}
+
+};
+
+// AttributSet/Font-Cache, globale Variable, in FontCache.Cxx angelegt
+extern SwFontCache *pSwFontCache;
+
+/*************************************************************************
+ * class SwFontObj
+ *************************************************************************/
+
+class SwFontObj : public SwCacheObj
+{
+ friend class SwFontAccess;
+
+private:
+ SwFont aSwFont;
+ const SfxPoolItem* pDefaultArray[ NUM_DEFAULT_VALUES ];
+
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL(SwFontObj)
+
+ SwFontObj( const void* pOwner, ViewShell *pSh );
+
+ virtual ~SwFontObj();
+
+ inline SwFont *GetFont() { return &aSwFont; }
+ inline const SwFont *GetFont() const { return &aSwFont; }
+ inline const SfxPoolItem** GetDefault() { return pDefaultArray; }
+};
+
+/*************************************************************************
+ * class SwFontAccess
+ *************************************************************************/
+
+
+class SwFontAccess : public SwCacheAccess
+{
+ ViewShell *pShell;
+protected:
+ virtual SwCacheObj *NewObj( );
+
+public:
+ SwFontAccess( const void *pOwner, ViewShell *pSh );
+ SwFontObj *Get();
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/swfont.hxx b/binfilter/bf_sw/source/core/inc/swfont.hxx
new file mode 100644
index 000000000000..5fde26786ba4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/swfont.hxx
@@ -0,0 +1,859 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFONT_HXX
+#define _SWFONT_HXX
+
+
+#include <i18npool/lang.h>
+#include <tools/color.hxx>
+#include <tools/stream.hxx>
+#include <bf_svx/svxfont.hxx>
+#include <swtypes.hxx>
+#include <drawfont.hxx> // SwDrawTextInfo
+namespace binfilter {
+
+class SfxItemSet;
+class LinguBase; // SetLingu()
+
+class SwAttrSet;
+class SwDoCapitals; // DoCapitals
+class SwWrongList;
+class SwDrawTextInfo; // _DrawText
+class SwScriptInfo; // _GetTxtSize
+class ViewShell;
+class SwDoc;
+
+const xub_Unicode CH_BLANK = ' '; // ' ' Leerzeichen
+const xub_Unicode CH_BREAK = 0x0A; //
+const xub_Unicode CH_TAB = '\t'; // \t
+const xub_Unicode CH_PAR = 0xB6; // Paragraph
+const xub_Unicode CH_BULLET = 0xB7; // mittiger Punkt
+
+class SwSubFont : public SvxFont
+{
+ friend class SwFont;
+ const void *pMagic; // "MagicNumber" innerhalb des Fontcaches
+ Size aSize; // Fremde kriegen nur diese Size zu sehen
+ USHORT nFntIndex; // Index im Fontcache
+ USHORT nOrgHeight; // Hoehe inkl. Escapement/Proportion
+ USHORT nOrgAscent; // Ascent inkl. Escapement/Proportion
+ USHORT nPropWidth; // proportional width
+ inline SwSubFont() : aSize(0,0)
+ { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; }
+
+ USHORT CalcEscAscent( const USHORT nOldAscent ) const;
+ USHORT CalcEscHeight( const USHORT nOldHeight,
+ const USHORT nOldAscent ) const;
+
+ inline void CopyMagic( const SwSubFont& rFnt )
+ { pMagic = rFnt.pMagic; nFntIndex = rFnt.nFntIndex; }
+
+ BOOL operator==( const SwFont &rFnt ) const;
+ SwSubFont& operator=( const SwSubFont &rFont );
+
+ short _CheckKerning( );
+
+ BOOL ChgFnt( ViewShell *pSh, OutputDevice *pOut );
+ BOOL IsSymbol( ViewShell *pSh );
+ USHORT GetAscent( ViewShell *pSh, const OutputDevice *pOut );
+ USHORT GetHeight( ViewShell *pSh, const OutputDevice *pOut );
+ Size _GetTxtSize( SwDrawTextInfo& rInf );
+ Size GetCapitalSize( SwDrawTextInfo& rInf );
+ void DoOnCapitals( SwDoCapitals &rDo );
+ xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf );
+
+ inline void SetColor( const Color& rColor );
+ inline void SetFillColor( const Color& rColor );
+ inline void SetCharSet( const CharSet eCharSet );
+ inline void SetPitch( const FontPitch ePitch );
+ inline void SetAlign( const FontAlign eAlign );
+ inline void SetUnderline( const FontUnderline eUnderline );
+ inline void SetStrikeout( const FontStrikeout eStrikeout );
+ inline void SetItalic( const FontItalic eItalic );
+ inline void SetOutline( const BOOL bOutline );
+ inline void SetVertical( const USHORT nDir, const BOOL bVertFormat );
+ inline void SetShadow( const BOOL bShadow );
+ inline void SetAutoKern( const BYTE nAutoKern );
+ inline void SetWordLineMode( const BOOL bWordLineMode );
+ inline void SetEmphasisMark( const FontEmphasisMark eValue );
+ inline void SetRelief( const FontRelief eNew );
+
+ // Methoden fuer die Hoch-/Tiefstellung
+ inline void SetEscapement( const short nNewEsc );
+ inline void SetProportion( const BYTE nNewPropr );
+
+ inline void SetFamily( const FontFamily eFamily );
+ inline void SetName( const XubString& rName );
+ inline void SetStyleName( const XubString& rStyleName );
+ inline void SetSize( const Size& rSize );
+ inline void SetWeight( const FontWeight eWeight );
+ inline void SetLanguage( LanguageType eNewLang );
+ inline short CheckKerning()
+ { return GetFixKerning() >= 0 ? GetFixKerning() : _CheckKerning( ); }
+ inline void SetPropWidth( const USHORT nNew )
+ { pMagic = 0; nPropWidth = nNew; }
+public:
+ USHORT GetPropWidth() const { return nPropWidth; }
+};
+
+#define SW_LATIN 0
+#define SW_CJK 1
+#define SW_CTL 2
+#define SW_SCRIPTS 3
+
+class SwFont
+{ // CJK == Chinese, Japanese, Korean
+ // CTL == Complex text layout ( Hebrew, Arabic )
+ SwSubFont aSub[SW_SCRIPTS]; // Latin-, CJK- and CTL-font
+ Color* pBackColor; // background color (i.e. at character styles)
+ Color aUnderColor; // color of the underlining
+ BYTE nToxCnt; // Zaehlt die Schachtelungstiefe der Tox
+ BYTE nRefCnt; // Zaehlt die Schachtelungstiefe der Refs
+ BYTE nActual; // actual font (Latin, CJK or CTL)
+
+ // Schalter fuer die Font-Extensions
+ BOOL bNoHyph :1; // SwTxtNoHyphenHere: keine Trennstelle
+ BOOL bBlink :1; // blinkender Font
+ BOOL bPaintBlank :1; // Blanks nicht mit DrawRect
+ BOOL bFntChg :1;
+ BOOL bOrgChg :1; // nOrgHeight/Ascent sind invalid
+ BOOL bURL :1;
+ BOOL bPaintWrong :1; // Flag fuer Rechtschreibfehler
+ BOOL bGreyWave :1; // Fuers extended TextInput: Graue Wellenlinie
+ BOOL bNoColReplace :1; // Replacement without colormanipulation
+
+ BOOL operator==( const SwFont &rFnt ) const;
+
+protected:
+ inline SwFont() { pBackColor = NULL; nActual = SW_LATIN; }
+
+public:
+ SwFont( const SwAttrSet* pSet, const SwDoc *pDoc );
+ SwFont( const SwFont& rFont );
+
+ inline void ChgFnt( ViewShell *pSh, OutputDevice *pOut )
+ { bPaintBlank = aSub[nActual].ChgFnt( pSh, pOut ); }
+
+ ~SwFont(){ delete pBackColor; }
+
+ SwFont& operator=( const SwFont &rFont );
+
+ inline BYTE GetActual() const { return nActual; }
+ inline void SetActual( BYTE nNew );
+ inline const SvxFont& GetActualFont() const { return aSub[nActual]; }
+
+ // holt sich eine MagicNumber ueber SwFntAccess
+ void GoMagic( ViewShell *pSh, BYTE nWhich );
+ // set background color
+ void SetBackColor( Color* pNewColor );
+ inline const Color* GetBackColor() const{ return pBackColor; }
+
+ inline void ChkMagic( ViewShell *pSh, BYTE nWhich )
+ { if( !aSub[ nWhich ].pMagic ) GoMagic( pSh, nWhich ); }
+ // uebernimmt die MagicNumber eines (hoffentlich ident.) Kollegen
+ inline void CopyMagic( const SwFont* pFnt, BYTE nWhich )
+ { aSub[nWhich].CopyMagic( pFnt->aSub[nWhich] ); }
+ inline void GetMagic( const void* &rMagic, USHORT &rIdx, BYTE nWhich )
+ { rMagic = aSub[nWhich].pMagic; rIdx = aSub[nWhich].nFntIndex; }
+ inline void SetMagic( const void* pNew, const USHORT nIdx, BYTE nWhich )
+ { aSub[nWhich].pMagic = pNew; aSub[nWhich].nFntIndex = nIdx; }
+ inline BOOL DifferentMagic( const SwFont* pFnt, BYTE nWhich )
+ { return aSub[nWhich].pMagic != pFnt->aSub[nWhich].pMagic ||
+ !aSub[nWhich].pMagic || !pFnt->aSub[nWhich].pMagic; }
+
+ inline const Size &GetSize( BYTE nWhich ) const
+ { return aSub[nWhich].aSize; }
+ inline BOOL IsFntChg() const { return bFntChg; }
+ inline void SetFntChg( const BOOL bNew ) { bFntChg = bNew; }
+
+ // die gekapselten SV-Font-Methoden (setzen bFntChg auf TRUE)
+ inline void SetColor( const Color& rColor );
+ inline void SetFillColor( const Color& rColor );
+ inline void SetAlign( const FontAlign eAlign );
+ inline void SetUnderline( const FontUnderline eUnderline );
+ inline void SetUnderColor( const Color &rColor ) { aUnderColor = rColor; }
+ inline void SetStrikeout( const FontStrikeout eStrikeout );
+ inline void SetOutline( const BOOL bOutline );
+ void SetVertical( USHORT nDir, const BOOL nVertLayout = FALSE );
+ inline void SetShadow( const BOOL bShadow );
+ inline void SetAutoKern( BYTE nAutoKern );
+ inline void SetTransparent( const BOOL bTrans );
+ inline void SetWordLineMode( const BOOL bWordLineMode );
+ inline void SetFixKerning( const short nNewKern );
+ inline void SetCaseMap( const SvxCaseMap eNew );
+ inline void SetEmphasisMark( const FontEmphasisMark eValue );
+
+ // Methoden fuer die Hoch-/Tiefstellung
+ inline void SetEscapement( const short nNewEsc );
+ inline void SetProportion( const BYTE nNewPropr );
+
+ inline void SetPropWidth( const USHORT nNew );
+
+ inline void SetFamily( const FontFamily eFamily, const BYTE nWhich );
+ inline void SetName( const XubString& rName, const BYTE nWhich );
+ inline void SetStyleName( const XubString& rStyleName, const BYTE nWhich );
+ inline void SetSize( const Size& rSize, const BYTE nWhich );
+ inline void SetWeight( const FontWeight eWeight, const BYTE nWhich );
+ inline void SetItalic( const FontItalic eItalic, const BYTE nWhich );
+ inline void SetLanguage( LanguageType eNewLang, const BYTE nWhich );
+ inline void SetCharSet( const CharSet eCharSet, const BYTE nWhich );
+ inline void SetPitch( const FontPitch ePitch, const BYTE nWhich );
+ inline void SetRelief( const FontRelief eNew );
+
+ // Get/Set-Methoden fuer die aktuelle Einstellung
+ inline void SetNoHyph( const BOOL bNew );
+ inline BOOL IsNoHyph() const { return bNoHyph; }
+ inline void SetBlink( const BOOL bBlink );
+ inline BOOL IsBlink() const { return bBlink; }
+ inline BYTE &GetTox() { return nToxCnt; }
+ inline BYTE GetTox() const { return nToxCnt; }
+ inline BOOL IsTox() const { return ( 0 != nToxCnt ); }
+ inline BYTE &GetRef() { return nRefCnt; }
+ inline BYTE GetRef() const { return nRefCnt; }
+ inline BOOL IsRef() const { return ( 0 != nRefCnt ); }
+ inline void SetURL( const BOOL bURL );
+ inline BOOL IsURL() const { return bURL; }
+ inline void SetGreyWave( const BOOL bNew );
+ inline BOOL IsGreyWave() const { return bGreyWave; }
+ inline void SetNoCol( const BOOL bNew );
+ inline BOOL IsNoCol() const { return bNoColReplace; }
+
+ inline void SetPaintBlank( const BOOL bNew );
+ inline BOOL IsPaintBlank() const { return bPaintBlank; }
+ inline void SetPaintWrong( const BOOL bNew );
+ inline BOOL IsPaintWrong() const { return bPaintWrong; }
+
+ // Setzen der Basisklasse Font fuer SwTxtCharFmt
+ void SetDiffFnt( const SfxItemSet* pSet, const SwDoc *pDoc );
+
+ inline const SvxFont &GetFnt( const BYTE nWhich ) const
+ { return aSub[nWhich]; };
+
+ BOOL IsSymbol( ViewShell *pSh )
+ { return aSub[nActual].IsSymbol( pSh ); }
+ FontUnderline GetUnderline() const { return aSub[nActual].GetUnderline(); }
+ const Color& GetUnderColor() const { return aUnderColor; }
+ short GetFixKerning() const { return aSub[nActual].GetFixKerning(); }
+ FontStrikeout GetStrikeout() const { return aSub[nActual].GetStrikeout(); }
+ const Color& GetColor() const { return aSub[nActual].GetColor(); }
+ BOOL IsShadow() const { return aSub[nActual].IsShadow(); }
+ BOOL IsWordLineMode() const { return aSub[nActual].IsWordLineMode(); }
+ BOOL IsOutline() const { return aSub[nActual].IsOutline(); }
+ BOOL IsKerning() const { return aSub[nActual].IsKerning(); }
+ short GetEscapement() const { return aSub[nActual].GetEscapement(); }
+ SvxCaseMap GetCaseMap() const { return aSub[nActual].GetCaseMap(); }
+ BYTE GetPropr() const { return aSub[nActual].GetPropr(); }
+ FontItalic GetItalic() const { return aSub[nActual].GetItalic(); }
+ LanguageType GetLanguage() const { return aSub[nActual].GetLanguage(); }
+ FontAlign GetAlign() const { return aSub[nActual].GetAlign(); }
+ const XubString& GetName() const { return aSub[nActual].GetName(); }
+ const XubString& GetStyleName() const {return aSub[nActual].GetStyleName();}
+ FontFamily GetFamily() const { return aSub[nActual].GetFamily(); }
+ FontPitch GetPitch() const { return aSub[nActual].GetPitch(); }
+ rtl_TextEncoding GetCharSet() const { return aSub[nActual].GetCharSet(); }
+ long GetHeight() const { return aSub[nActual].GetSize().Height(); }
+ FontWeight GetWeight() const { return aSub[nActual].GetWeight(); }
+ FontEmphasisMark GetEmphasisMark() const
+ { return aSub[nActual].GetEmphasisMark(); }
+ USHORT GetPropWidth() const { return aSub[nActual].GetPropWidth(); }
+ USHORT GetOrientation( const BOOL nVertLayout = FALSE ) const;
+
+ inline const XubString& GetName( const BYTE nWhich ) const
+ { return aSub[nWhich].GetName(); }
+ inline LanguageType GetLanguage( const BYTE nWhich ) const
+ { return aSub[nWhich].GetLanguage(); }
+ inline const XubString& GetStyleName( const BYTE nWhich ) const
+ { return aSub[nWhich].GetStyleName(); }
+ inline FontFamily GetFamily( const BYTE nWhich ) const
+ { return aSub[nWhich].GetFamily(); }
+ inline FontItalic GetItalic( const BYTE nWhich ) const
+ { return aSub[nWhich].GetItalic(); }
+ inline FontPitch GetPitch( const BYTE nWhich ) const
+ { return aSub[nWhich].GetPitch(); }
+ inline rtl_TextEncoding GetCharSet( const BYTE nWhich ) const
+ { return aSub[nWhich].GetCharSet(); }
+ inline long GetHeight( const BYTE nWhich ) const
+ { return aSub[nWhich].GetSize().Height(); }
+ inline FontWeight GetWeight( const BYTE nWhich ) const
+ { return aSub[nWhich].GetWeight(); }
+ inline FontEmphasisMark GetEmphasisMark( const BYTE nWhich ) const
+ { return aSub[nWhich].GetEmphasisMark(); }
+
+ // Macht den logischen Font im OutputDevice wirksam.
+ void ChgPhysFnt( ViewShell *pSh, OutputDevice *pOut );
+
+ Size GetCapitalSize( SwDrawTextInfo& rInf )
+ { return aSub[nActual].GetCapitalSize( rInf ); }
+
+
+
+
+
+ void DoOnCapitals( SwDoCapitals &rDo )
+ { aSub[nActual].DoOnCapitals( rDo ); }
+
+ Size _GetTxtSize( SwDrawTextInfo& rInf )
+ { rInf.SetFont( this ); return aSub[nActual]._GetTxtSize( rInf ); }
+
+ xub_StrLen GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth );
+
+
+
+ xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf )
+ { return aSub[nActual]._GetCrsrOfst( rInf ); }
+
+
+
+ inline short CheckKerning()
+ { return aSub[nActual].CheckKerning(); }
+ inline USHORT GetAscent( ViewShell *pSh, const OutputDevice *pOut )
+ { return aSub[nActual].GetAscent( pSh, pOut ); }
+ inline USHORT GetHeight( ViewShell *pSh, const OutputDevice *pOut )
+ { return aSub[nActual].GetHeight( pSh, pOut ); }
+ inline void Invalidate()
+ { bFntChg = bOrgChg = TRUE; }
+};
+
+inline void SwFont::SetColor( const Color& rColor )
+{
+ bFntChg = TRUE;
+ aSub[0].SetColor( rColor );
+ aSub[1].SetColor( rColor );
+ aSub[2].SetColor( rColor );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetColor( const Color& rColor )
+{
+ pMagic = 0;
+ Font::SetColor( rColor );
+}
+
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetFillColor( const Color& rColor )
+{
+ pMagic = 0;
+ Font::SetFillColor( rColor );
+}
+
+inline void SwFont::SetFillColor( const Color& rColor )
+{
+ bFntChg = TRUE;
+ aSub[0].SetFillColor( rColor );
+ aSub[1].SetFillColor( rColor );
+ aSub[2].SetFillColor( rColor );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetFamily( const FontFamily eFamily )
+{
+ pMagic = 0;
+ Font::SetFamily( eFamily );
+}
+
+inline void SwFont::SetFamily( const FontFamily eFamily, const BYTE nWhich )
+{
+ bFntChg = TRUE;
+ aSub[nWhich].SetFamily( eFamily );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetName( const XubString& rName )
+{
+ pMagic = 0;
+ Font::SetName( rName );
+}
+
+inline void SwFont::SetName( const XubString& rName, const BYTE nWhich )
+{
+ bFntChg = TRUE;
+ aSub[nWhich].SetName( rName );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetStyleName( const XubString& rStyleName )
+{
+ pMagic = 0;
+ Font::SetStyleName( rStyleName );
+}
+
+inline void SwFont::SetStyleName( const XubString& rStyle, const BYTE nWhich )
+{
+ bFntChg = TRUE;
+ aSub[nWhich].SetStyleName( rStyle );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetCharSet( const CharSet eCharSet )
+{
+ pMagic = 0;
+ Font::SetCharSet( eCharSet );
+}
+
+inline void SwFont::SetCharSet( const CharSet eCharSet, const BYTE nWhich )
+{
+ bFntChg = TRUE;
+ aSub[nWhich].SetCharSet( eCharSet );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetPitch( const FontPitch ePitch )
+{
+ pMagic = 0;
+ Font::SetPitch( ePitch );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwFont::SetPitch( const FontPitch ePitch, const BYTE nWhich )
+{
+ bFntChg = TRUE;
+ aSub[nWhich].SetPitch( ePitch );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetAlign( const FontAlign eAlign )
+{
+ pMagic = 0;
+ Font::SetAlign( eAlign );
+}
+
+inline void SwFont::SetAlign( const FontAlign eAlign )
+{
+ bFntChg = TRUE;
+ aSub[0].SetAlign( eAlign );
+ aSub[1].SetAlign( eAlign );
+ aSub[2].SetAlign( eAlign );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetWeight( const FontWeight eWeight )
+{
+ pMagic = 0;
+ Font::SetWeight( eWeight );
+}
+
+inline void SwFont::SetWeight( const FontWeight eWeight, const BYTE nWhich )
+{
+ bFntChg = TRUE;
+ aSub[nWhich].SetWeight( eWeight );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetUnderline( const FontUnderline eUnderline )
+{
+ pMagic = 0;
+ Font::SetUnderline( eUnderline );
+}
+
+inline void SwFont::SetUnderline( const FontUnderline eUnderline )
+{
+ bFntChg = TRUE;
+ aSub[0].SetUnderline( eUnderline );
+ aSub[1].SetUnderline( eUnderline );
+ aSub[2].SetUnderline( eUnderline );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetStrikeout( const FontStrikeout eStrikeout )
+{
+ pMagic = 0;
+ Font::SetStrikeout( eStrikeout );
+}
+
+inline void SwFont::SetStrikeout( const FontStrikeout eStrikeout )
+{
+ bFntChg = TRUE;
+ aSub[0].SetStrikeout( eStrikeout );
+ aSub[1].SetStrikeout( eStrikeout );
+ aSub[2].SetStrikeout( eStrikeout );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetItalic( const FontItalic eItalic )
+{
+ pMagic = 0;
+ Font::SetItalic( eItalic );
+}
+
+inline void SwFont::SetItalic( const FontItalic eItalic, const BYTE nWhich )
+{
+ bFntChg = TRUE;
+ aSub[nWhich].SetItalic( eItalic );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetOutline( const BOOL bOutline )
+{
+ pMagic = 0;
+ Font::SetOutline( bOutline );
+}
+
+inline void SwFont::SetOutline( const BOOL bOutline )
+{
+ bFntChg = TRUE;
+ aSub[0].SetOutline( bOutline );
+ aSub[1].SetOutline( bOutline );
+ aSub[2].SetOutline( bOutline );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetShadow( const BOOL bShadow )
+{
+ pMagic = 0;
+ Font::SetShadow( bShadow );
+}
+
+inline void SwFont::SetShadow( const BOOL bShadow )
+{
+ bFntChg = TRUE;
+ aSub[0].SetShadow( bShadow );
+ aSub[1].SetShadow( bShadow );
+ aSub[2].SetShadow( bShadow );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetAutoKern( const BYTE nAutoKern )
+{
+ pMagic = 0;
+ Font::SetKerning( nAutoKern );
+}
+
+inline void SwFont::SetAutoKern( BYTE nAutoKern )
+{
+ bFntChg = TRUE;
+ aSub[1].SetAutoKern( nAutoKern );
+ if( nAutoKern )
+ nAutoKern = KERNING_FONTSPECIFIC;
+ aSub[0].SetAutoKern( nAutoKern );
+ aSub[2].SetAutoKern( nAutoKern );
+}
+
+inline void SwFont::SetTransparent( const BOOL bTrans )
+{
+ aSub[0].SetTransparent( bTrans );
+ aSub[1].SetTransparent( bTrans );
+ aSub[2].SetTransparent( bTrans );
+}
+
+inline void SwFont::SetFixKerning( const short nNewKern )
+{
+ aSub[SW_LATIN].SetFixKerning( nNewKern );
+ aSub[SW_CJK].SetFixKerning( nNewKern );
+ aSub[SW_CTL].SetFixKerning( nNewKern );
+}
+
+inline void SwFont::SetCaseMap( const SvxCaseMap eNew )
+{
+ aSub[SW_LATIN].SetCaseMap( eNew );
+ aSub[SW_CJK].SetCaseMap( eNew );
+ aSub[SW_CTL].SetCaseMap( eNew );
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetWordLineMode( const BOOL bWordLineMode )
+{
+ pMagic = 0;
+ Font::SetWordLineMode( bWordLineMode );
+}
+
+inline void SwFont::SetWordLineMode( const BOOL bWordLineMode )
+{
+ bFntChg = TRUE;
+ aSub[0].SetWordLineMode( bWordLineMode );
+ aSub[1].SetWordLineMode( bWordLineMode );
+ aSub[2].SetWordLineMode( bWordLineMode );
+}
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetEmphasisMark( const FontEmphasisMark eValue )
+{
+ pMagic = 0;
+ Font::SetEmphasisMark( eValue );
+}
+
+inline void SwFont::SetEmphasisMark( const FontEmphasisMark eValue )
+{
+ bFntChg = TRUE;
+ aSub[0].SetEmphasisMark( eValue );
+ aSub[1].SetEmphasisMark( eValue );
+ aSub[2].SetEmphasisMark( eValue );
+}
+
+inline void SwFont::SetPropWidth( const USHORT nNew )
+{
+ if( nNew != aSub[0].GetPropWidth() )
+ {
+ bFntChg = TRUE;
+ aSub[0].SetPropWidth( nNew );
+ aSub[1].SetPropWidth( nNew );
+ aSub[2].SetPropWidth( nNew );
+ }
+}
+
+// gekapselte SV-Font-Methode
+inline void SwSubFont::SetRelief( const FontRelief eNew )
+{
+ pMagic = 0;
+ Font::SetRelief( eNew );
+}
+
+inline void SwFont::SetRelief( const FontRelief eNew )
+{
+ if( eNew != aSub[0].GetRelief() )
+ {
+ bFntChg = TRUE;
+ aSub[0].SetRelief( eNew );
+ aSub[1].SetRelief( eNew );
+ aSub[2].SetRelief( eNew );
+ }
+}
+
+// ueberladene Font-Methode
+inline void SwSubFont::SetSize( const Size& rSize )
+{
+ aSize = rSize;
+ if ( GetPropr() == 100 )
+ Font::SetSize( aSize );
+ else
+ {
+ Font::SetSize( Size(
+ (long) aSize.Width() * GetPropr() / 100L,
+ (long) aSize.Height() * GetPropr() / 100L ) );
+ }
+ pMagic = 0;
+}
+
+inline void SwFont::SetSize( const Size& rSize, const BYTE nWhich )
+{
+ if( aSub[nWhich].aSize != rSize )
+ {
+ aSub[nWhich].SetSize( rSize );
+ bFntChg = TRUE;
+ bOrgChg = TRUE;
+ }
+}
+
+inline void SwFont::SetActual( BYTE nNew )
+{
+ if ( nActual != nNew )
+ {
+ bFntChg = TRUE;
+ bOrgChg = TRUE;
+ nActual = nNew;
+ }
+}
+
+inline void SwSubFont::SetProportion( const BYTE nNewPropr )
+{
+ pMagic = 0;
+ Font::SetSize( Size( (long) aSize.Width() * nNewPropr / 100L,
+ (long) aSize.Height() * nNewPropr / 100L ) );
+ SvxFont::SetPropr( nNewPropr );
+}
+
+inline void SwFont::SetProportion( const BYTE nNewPropr )
+{
+ if( nNewPropr != aSub[0].GetPropr() )
+ {
+ bFntChg = TRUE;
+ bOrgChg = TRUE;
+
+ aSub[0].SetProportion( nNewPropr );
+ aSub[1].SetProportion( nNewPropr );
+ aSub[2].SetProportion( nNewPropr );
+ }
+}
+
+inline void SwSubFont::SetEscapement( const short nNewEsc )
+{
+ pMagic = 0;
+ SvxFont::SetEscapement( nNewEsc );
+}
+
+inline void SwFont::SetEscapement( const short nNewEsc )
+{
+ if( nNewEsc != aSub[0].GetEscapement() )
+ {
+ // these have to be set, otherwise nOrgHeight and nOrgAscent will not
+ // be calculated
+ bFntChg = TRUE;
+ bOrgChg = TRUE;
+
+ aSub[0].SetEscapement( nNewEsc );
+ aSub[1].SetEscapement( nNewEsc );
+ aSub[2].SetEscapement( nNewEsc );
+ }
+}
+
+inline void SwSubFont::SetLanguage( LanguageType eNewLang )
+{
+ if( eNewLang == LANGUAGE_SYSTEM )
+ eNewLang = (LanguageType)GetAppLanguage();
+ SvxFont::SetLanguage( eNewLang );
+}
+
+inline void SwFont::SetLanguage( const LanguageType eNewLang, const BYTE nWhich )
+{
+ aSub[nWhich].SetLanguage( eNewLang );
+ if( SW_CJK == nWhich )
+ {
+ aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
+ aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
+ aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
+ }
+}
+
+inline void SwFont::SetPaintBlank( const BOOL bNew )
+{
+ bPaintBlank = bNew;
+}
+
+inline void SwFont::SetPaintWrong( const BOOL bNew )
+{
+ bPaintWrong = bNew;
+}
+
+inline void SwFont::SetNoHyph( const BOOL bNew )
+{
+ bNoHyph = bNew;
+}
+
+inline void SwFont::SetBlink( const BOOL bNew )
+{
+ bBlink = bNew;
+}
+
+inline void SwFont::SetURL( const BOOL bNew )
+{
+ bURL = bNew;
+}
+
+inline void SwFont::SetGreyWave( const BOOL bNew )
+{
+ bGreyWave = bNew;
+}
+
+inline void SwFont::SetNoCol( const BOOL bNew )
+{
+ bNoColReplace = bNew;
+}
+
+inline void SwSubFont::SetVertical( const USHORT nDir, const BOOL bVertFormat )
+{
+ pMagic = 0;
+ Font::SetVertical( bVertFormat );
+ Font::SetOrientation( nDir );
+}
+
+
+/*************************************************************************
+ * class SwUnderlineFont
+ *
+ * Used for the "continuous underline" feature.
+ *************************************************************************/
+
+class SwUnderlineFont
+{
+ Point aPos;
+ SwFont* pFnt;
+
+public:
+ // sets the font which should paint the common baseline
+ // and the starting point of the common baseline
+ SwUnderlineFont( SwFont& rFnt, const Point& rPoint );
+ ~SwUnderlineFont();
+
+ SwFont& GetFont()
+ {
+ ASSERT( pFnt, "No underline font" )
+ return *pFnt;
+ }
+ const Point& GetPos() const { return aPos; }
+ // the x coordinate of the starting point has to be set for each portion
+ void SetPos( const Point& rPoint ) { aPos = rPoint; }
+};
+
+
+/*************************************************************************
+ * class SvStatistics
+ *************************************************************************/
+
+#ifndef DBG_UTIL
+#define SV_STAT(nWhich)
+#else
+
+class SvStatistics
+{
+public:
+ USHORT nGetTextSize;
+ USHORT nDrawText;
+ USHORT nGetStretchTextSize;
+ USHORT nDrawStretchText;
+ USHORT nChangeFont;
+ USHORT nGetFontMetric;
+
+ inline void Reset()
+ {
+ nGetTextSize = nDrawText = nGetStretchTextSize =
+ nDrawStretchText = nChangeFont = nGetFontMetric = 0;
+ }
+
+ inline SvStatistics() { Reset(); }
+
+ inline void PrintOn( SvStream &rOS ) const; //$ ostream
+ inline BOOL IsEmpty() const
+ {
+ return !( nGetTextSize || nDrawText ||
+ nDrawStretchText || nChangeFont || nGetFontMetric );
+ }
+};
+
+// globale Variable, implementiert in swfont.cxx
+extern SvStatistics aSvStat;
+
+#define SV_STAT(nWhich) ++(aSvStat.nWhich);
+
+inline void SvStatistics::PrintOn( SvStream &rOS ) const //$ ostream
+{
+ if( IsEmpty() )
+ return;
+
+ rOS << "{ SV called:" << '\n';
+ if( nGetTextSize )
+ rOS << "\tnGetTextSize: " << nGetTextSize << '\n'; if( nDrawText )
+ rOS << "\tnDrawText: " << nDrawText << '\n'; if( nGetStretchTextSize )
+ rOS << "\tnGetStretchTextSize: " << nGetStretchTextSize << '\n'; if( nDrawStretchText )
+ rOS << "\tnDrawStretchText: " << nDrawStretchText << '\n'; if( nChangeFont )
+ rOS << "\tnChangeFont: " << nChangeFont << '\n'; if( nGetFontMetric )
+ rOS << "\tnGetFontMetric: " << nGetFontMetric << '\n'; rOS << "}" << '\n'; }
+#endif /* PRODUCT */
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/tabfrm.hxx b/binfilter/bf_sw/source/core/inc/tabfrm.hxx
new file mode 100644
index 000000000000..0bf94d0e0b54
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/tabfrm.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TABFRM_HXX
+#define _TABFRM_HXX
+
+#include <tools/mempool.hxx>
+#include "layfrm.hxx"
+#include "flowfrm.hxx"
+namespace binfilter {
+
+class SwTable;
+class SwBorderAttrs;
+class SwAttrSetChg;
+
+class SwTabFrm: public SwLayoutFrm, public SwFlowFrm
+{
+ // OD 14.03.2003 #i11760# - adjustment, because of method signature change
+ //darf mit den Flags spielen.
+ friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow );
+
+ //Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch.
+ SwLayoutFrm *GetLeaf( MakePageType eMakePage, BOOL bFwd );
+
+ SwTable *pTable;
+
+ BOOL bComplete :1; //Eintrage als Repaint ohne das CompletePaint
+ //der Basisklasse gesetzt werden muss. Damit
+ //sollen unertraegliche Tabellen-Repaints
+ //vermieden werden.
+ BOOL bCalcLowers :1; //Im MakeAll auf jedenfall auch fuer Stabilitaet
+ //des Inhaltes sorgen.
+ BOOL bLowersFormatted :1;//Kommunikation zwischen MakeAll und Layact
+ BOOL bLockBackMove :1; //BackMove-Test hat der Master erledigt.
+ BOOL bResizeHTMLTable :1; //Resize des HTMLTableLayout rufen im MakeAll
+ //Zur Optimierung, damit dies nicht im
+ //CntntFrm::Grow gerufen werden muss, denn dann
+ //wird es ggf. fuer jede Zelle gerufen #47483#
+ BOOL bONECalcLowers :1; //Primaer fuer die StarONE-SS. Beim MakeAll werden
+ //die Cntnts auf jedenfall per Calc() formatiert.
+ //es finden keine zusaetzlichen Invalidierungen
+ //statt und dieser Weg kann auch kaum garantien
+ //geben.
+
+ //Split() spaltet den Frm an der angegebenen Stelle, es wird ein
+ //Follow erzeugt und aufgebaut und direkt hinter this gepastet.
+ //Join() Holt sich den Inhalt aus dem Follow und vernichtet diesen.
+ SwTwips Split( const SwTwips nCutPos );
+ SwTwips Join();
+
+ void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &,
+ SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
+
+ virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat );
+
+protected:
+ virtual void MakeAll();
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+ //Aendert nur die Framesize, nicht die PrtArea-SSize
+ virtual SwTwips GrowFrm ( SwTwips, SZPTR
+ BOOL bTst = FALSE, BOOL bInfo = FALSE );
+public:
+ SwTabFrm( SwTable & ); //Immer nach dem erzeugen _und_ pasten das
+ //Regist Flys rufen!
+ SwTabFrm( SwTabFrm & ); //_Nur_ zum erzeugen von Follows
+ ~SwTabFrm();
+
+
+ //Ruft das RegistFlys der Zeilen.
+ void RegistFlys();
+
+ inline const SwTabFrm *GetFollow() const;
+ inline SwTabFrm *GetFollow();
+ inline const SwTabFrm *FindMaster() const;
+ inline SwTabFrm *FindMaster();
+
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+ virtual BOOL GetInfo( SfxPoolItem &rHnt ) const;
+ virtual void CheckDirection( BOOL bVert );
+
+ virtual void Cut();
+ virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
+
+ virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
+ const void *pVoid = 0, sal_Bool bNotify = sal_True );
+
+ SwCntntFrm *FindLastCntnt();
+ inline const SwCntntFrm *FindLastCntnt() const;
+
+ const SwTable *GetTable() const { return pTable; }
+ SwTable *GetTable() { return pTable; }
+
+ BOOL IsComplete() { return bComplete; }
+ void SetComplete() { bComplete = TRUE; }
+ void ResetComplete() { bComplete = FALSE; }
+
+ BOOL IsLowersFormatted() const { return bLowersFormatted; }
+ void SetLowersFormatted( BOOL b ) { bLowersFormatted = b; }
+
+ void SetCalcLowers() { bCalcLowers = TRUE; } //Sparsam einsetzen!
+ void SetResizeHTMLTable() { bResizeHTMLTable = TRUE; } //dito
+ void SetONECalcLowers() { bONECalcLowers = TRUE; }
+
+ BOOL CalcFlyOffsets( SwTwips& rUpper, long& rLeftOffset,
+ long& rRightOffset ) const;
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
+};
+
+inline const SwCntntFrm *SwTabFrm::FindLastCntnt() const
+{
+ return ((SwTabFrm*)this)->FindLastCntnt();
+}
+
+inline const SwTabFrm *SwTabFrm::GetFollow() const
+{
+ return (const SwTabFrm*)SwFlowFrm::GetFollow();
+}
+inline SwTabFrm *SwTabFrm::GetFollow()
+{
+ return (SwTabFrm*)SwFlowFrm::GetFollow();
+}
+
+inline const SwTabFrm *SwTabFrm::FindMaster() const
+{
+ return (const SwTabFrm*)SwFlowFrm::FindMaster();
+}
+inline SwTabFrm *SwTabFrm::FindMaster()
+{
+ return (SwTabFrm*)SwFlowFrm::FindMaster();
+}
+
+} //namespace binfilter
+#endif //_TABFRM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/tblrwcl.hxx b/binfilter/bf_sw/source/core/inc/tblrwcl.hxx
new file mode 100644
index 000000000000..1f7c2eab6924
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/tblrwcl.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBLRWCL_HXX
+#define _TBLRWCL_HXX
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#include <bf_svtools/svstdarr.hxx>
+#endif
+
+#include <swtypes.hxx>
+#include <tblsel.hxx>
+#include <swtable.hxx>
+namespace binfilter {
+
+class SfxPoolItem;
+class SvxBorderLine;
+class SwDoc;
+class SwTableNode;
+class _FndLine;
+class _FndBox;
+class SwTableLine;
+class SwTableBox;
+class SwTableBoxFmt;
+class SwTableLineFmt;
+class SwHistory;
+class SwCntntNode;
+
+class SwShareBoxFmts;
+class SwFmtFrmSize;
+
+// Funktions Deklarationen:
+BOOL lcl_CopyRow( const _FndLine*& rpFndLine, void* pPara );
+BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara );
+
+BOOL lcl_MergeGCBox( const SwTableBox*& rpBox, void* pPara );
+BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara );
+
+BOOL lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara );
+BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara );
+
+BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara );
+BOOL lcl_CopyLineToDoc( const _FndLine*& rpFndLn, void* pPara );
+
+BOOL lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara );
+BOOL lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara );
+
+
+#ifdef DBG_UTIL
+#endif
+
+void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd,
+ SwTableLine* pLine, SwTableBoxFmt* pBoxFrmFmt,
+ SwTableBox* pBox, USHORT nInsPos, USHORT nCnt = 1 );
+
+void _DeleteBox( SwTable& rTbl, SwTableBox* pBox,
+ BOOL bCalcNewSize = TRUE, const BOOL bCorrBorder = TRUE,
+ SwShareBoxFmts* pShareFmts = 0 );
+
+// Klasse fuers SplitTable
+// sammelt von einer Line die Boxen aller obersten oder untersten Lines
+// in einem Array. Zusaetzlich werden die Positionen vermerkt.
+// ( die Implementierung steht im ndtbl.cxx)
+
+ class SwCollectTblLineBoxes
+ {
+ SvUShorts aPosArr;
+ SwSelBoxes_SAR aBoxes;
+ SwHistory* pHst;
+ USHORT nMode, nWidth;
+ BOOL bGetFromTop : 1;
+ BOOL bGetValues : 1;
+
+ public:
+ SwCollectTblLineBoxes( BOOL bTop, USHORT nMd = 0, SwHistory* pHist=0 )
+ : aPosArr( 16, 16 ), aBoxes( 16, 16 ),
+ bGetFromTop( bTop ), bGetValues( TRUE ), nMode( nMd ),
+ nWidth( 0 ), pHst( pHist )
+ {}
+
+ void AddBox( const SwTableBox& rBox );
+ const SwTableBox* GetBoxOfPos( const SwTableBox& rBox );
+
+ USHORT Count() const { return aBoxes.Count(); }
+ const SwTableBox& GetBox( USHORT nPos, USHORT* pWidth = 0 ) const
+ {
+ // hier wird die EndPos der Spalte benoetigt!
+ if( pWidth )
+ *pWidth = nPos+1 == aPosArr.Count() ? nWidth
+ : aPosArr[ nPos+1 ];
+ return *aBoxes[ nPos ];
+ }
+
+ BOOL IsGetFromTop() const { return bGetFromTop; }
+ BOOL IsGetValues() const { return bGetValues; }
+
+ USHORT GetMode() const { return nMode; }
+ void SetValues( BOOL bFlag ) { bGetValues = FALSE; nWidth = 0;
+ bGetFromTop = bFlag; }
+ FASTBOOL Resize( USHORT nOffset, USHORT nWidth );
+ };
+
+BOOL lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara );
+BOOL lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara );
+
+BOOL lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara );
+
+struct _SwGCLineBorder
+{
+ const SwTableLines* pLines;
+ SwShareBoxFmts* pShareFmts;
+ USHORT nLinePos;
+
+ _SwGCLineBorder( const SwTable& rTable )
+ : pLines( &rTable.GetTabLines() ), nLinePos( 0 ), pShareFmts(0) {}
+
+ _SwGCLineBorder( const SwTableBox& rBox )
+ : pLines( &rBox.GetTabLines() ), nLinePos( 0 ), pShareFmts(0) {}
+ BOOL IsLastLine() const { return nLinePos + 1 >= pLines->Count(); }
+};
+
+class _SwGCBorder_BoxBrd
+{
+ const SvxBorderLine* pBrdLn;
+ BOOL bAnyBorderFnd;
+public:
+ _SwGCBorder_BoxBrd() : pBrdLn( 0 ), bAnyBorderFnd( FALSE ) {}
+
+ void SetBorder( const SvxBorderLine& rBorderLine )
+ { pBrdLn = &rBorderLine; bAnyBorderFnd = FALSE; }
+
+ // checke, ob die linke Border dieselbe wie die gesetzte ist
+ // returnt FALSE falls gar keine Border gesetzt ist
+ BOOL CheckLeftBorderOfFormat( const SwFrmFmt& rFmt );
+
+ BOOL IsAnyBorderFound() const { return bAnyBorderFnd; }
+};
+
+BOOL lcl_GC_Line_Border( const SwTableLine*& , void* pPara );
+BOOL lcl_GC_Box_Border( const SwTableBox*& , void* pPara );
+
+BOOL lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& , void* pPara );
+BOOL lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& , void* pPara );
+
+BOOL lcl_GCBorder_GetLastBox_L( const SwTableLine*& , void* pPara );
+BOOL lcl_GCBorder_GetLastBox_B( const SwTableBox*& , void* pPara );
+
+
+class SwShareBoxFmt
+{
+ const SwFrmFmt* pOldFmt;
+ SvPtrarr aNewFmts;
+
+public:
+ SwShareBoxFmt( const SwFrmFmt& rFmt )
+ : pOldFmt( &rFmt ), aNewFmts( 1, 4 )
+ {}
+
+ const SwFrmFmt& GetOldFormat() const { return *pOldFmt; }
+
+ SwFrmFmt* GetFormat( long nWidth ) const;
+ SwFrmFmt* GetFormat( const SfxPoolItem& rItem ) const;
+ void AddFormat( const SwFrmFmt& rFmt );
+//STRIP001 // returnt TRUE, wenn geloescht werden kann
+ FASTBOOL RemoveFormat( const SwFrmFmt& rFmt );
+};
+
+
+SV_DECL_PTRARR_DEL( _SwShareBoxFmts, SwShareBoxFmt*, 8, 8 )
+
+class SwShareBoxFmts
+{
+ _SwShareBoxFmts aShareArr;
+ BOOL Seek_Entry( const SwFrmFmt& rFmt, USHORT* pPos ) const;
+
+ void ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, SwFrmFmt& rFmt );
+public:
+ SwShareBoxFmts() {}
+ ~SwShareBoxFmts();
+
+ SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, long nWidth ) const;
+ SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& ) const;
+ void AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew );
+ void SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz );
+ void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem );
+ void RemoveFormat( const SwFrmFmt& rFmt );
+};
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/toxhlp.hxx b/binfilter/bf_sw/source/core/inc/toxhlp.hxx
new file mode 100644
index 000000000000..97ff27b9a365
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/toxhlp.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOXHLP_HXX
+#define _TOXHLP_HXX
+
+#include <tools/solar.h>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+
+namespace drafts { namespace com { namespace sun { namespace star {
+namespace i18n {
+ class XExtendedIndexEntrySupplier;
+}
+namespace lang {
+ class XMultiServiceFactory;
+}
+}}}};
+namespace binfilter {
+
+
+
+ class IndexEntrySupplierWrapper
+ {
+ STAR_NMSPC::lang::Locale aLcl;
+ STAR_NMSPC::uno::Reference < ::com::sun::star::i18n::XExtendedIndexEntrySupplier > xIES;
+
+ public:
+ IndexEntrySupplierWrapper(
+ const STAR_NMSPC::lang::Locale& rLcl,
+ STAR_REFERENCE( lang::XMultiServiceFactory )& rxMSF );
+ ~IndexEntrySupplierWrapper();
+
+ STAR_NMSPC::uno::Sequence< ::rtl::OUString >
+ GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLcl ) const;
+
+ sal_Bool LoadAlgorithm( const STAR_NMSPC::lang::Locale& rLcl,
+ const String& sSortAlgorithm, long nOptions ) const;
+
+ sal_Int16 CompareIndexEntry( const String& rTxt1, const String& rTxtReading1,
+ const STAR_NMSPC::lang::Locale& rLcl1,
+ const String& rTxt2, const String& rTxtReading2,
+ const STAR_NMSPC::lang::Locale& rLcl2 ) const;
+ };
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/txmsrt.hxx b/binfilter/bf_sw/source/core/inc/txmsrt.hxx
new file mode 100644
index 000000000000..e69afd0e07c1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/txmsrt.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXMSRT_HXX
+#define _TXMSRT_HXX
+
+#include <i18npool/lang.h>
+#include <tox.hxx>
+class CharClass;
+namespace binfilter {
+
+
+class SwCntntNode;
+class SwTxtNode;
+class SwTxtTOXMark;
+class SwIndex;
+class SwFmtFld;
+class IndexEntrySupplierWrapper;
+
+enum TOXSortType
+{
+ TOX_SORT_INDEX,
+ TOX_SORT_CUSTOM,
+ TOX_SORT_CONTENT,
+ TOX_SORT_PARA,
+ TOX_SORT_TABLE,
+ TOX_SORT_AUTHORITY
+};
+
+struct SwTOXSource
+{
+ const SwCntntNode* pNd;
+ xub_StrLen nPos;
+ BOOL bMainEntry;
+
+ SwTOXSource() : pNd(0), nPos(0), bMainEntry(FALSE) {}
+ SwTOXSource( const SwCntntNode* pNode, xub_StrLen n, BOOL bMain )
+ : pNd(pNode), nPos(n), bMainEntry(bMain)
+ {}
+};
+
+SV_DECL_VARARR( SwTOXSources, SwTOXSource, 0, 10 )
+
+class SwTOXInternational
+{
+ IndexEntrySupplierWrapper* pIndexWrapper;
+ CharClass* pCharClass;
+ LanguageType eLang;
+ String sSortAlgorithm;
+ USHORT nOptions;
+
+ void Init();
+
+public:
+ SwTOXInternational( LanguageType nLang, USHORT nOptions,
+ const String& rSortAlgorithm );
+ SwTOXInternational( const SwTOXInternational& );
+ ~SwTOXInternational();
+
+ sal_Int32 Compare( const String& rTxt1, const String& rTxtReading1,
+ const ::com::sun::star::lang::Locale& rLocale1,
+ const String& rTxt2, const String& rTxtReading2,
+ const ::com::sun::star::lang::Locale& rLocale2 ) const;
+
+ inline BOOL IsEqual( const String& rTxt1, const String& rTxtReading1,
+ const ::com::sun::star::lang::Locale& rLocale1,
+ const String& rTxt2, const String& rTxtReading2,
+ const ::com::sun::star::lang::Locale& rLocale2 ) const
+ {
+ return 0 == Compare( rTxt1, rTxtReading1, rLocale1,
+ rTxt2, rTxtReading2, rLocale2 );
+ }
+ inline BOOL IsNumeric( const String& rStr ) const;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Klassen fuer die Sortierung der Verzeichnisse
+ --------------------------------------------------------------------*/
+
+struct SwTOXSortTabBase
+{
+ SwTOXSources aTOXSources;
+ ::com::sun::star::lang::Locale aLocale;
+ const SwTxtNode* pTOXNd;
+ const SwTxtTOXMark* pTxtMark;
+ const SwTOXInternational* pTOXIntl;
+ ULONG nPos;
+ xub_StrLen nCntPos;
+ USHORT nType;
+ static USHORT nOpt;
+
+ SwTOXSortTabBase( TOXSortType nType,
+ const SwCntntNode* pTOXSrc,
+ const SwTxtTOXMark* pTxtMark,
+ const SwTOXInternational* pIntl,
+ const ::com::sun::star::lang::Locale* pLocale = NULL );
+
+ USHORT GetType() const { return nType; }
+ USHORT GetOptions() const { return nOpt; }
+
+ virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0) const;
+ virtual USHORT GetLevel() const = 0;
+ virtual BOOL operator==( const SwTOXSortTabBase& );
+ virtual BOOL operator<( const SwTOXSortTabBase& );
+
+ virtual String GetURL() const;
+
+ inline void GetTxt( String&, String& ) const;
+ inline const ::com::sun::star::lang::Locale& GetLocale() const;
+
+private:
+ BOOL bValidTxt;
+ String sSortTxt;
+ String sSortTxtReading;
+
+ virtual void _GetText( String&, String& ) = 0;
+};
+
+inline void SwTOXSortTabBase::GetTxt( String& rSortTxt,
+ String& rSortTxtReading ) const
+{
+ if( !bValidTxt )
+ {
+ SwTOXSortTabBase* pThis = (SwTOXSortTabBase*)this;
+ pThis->_GetText( pThis->sSortTxt, pThis->sSortTxtReading );
+ pThis->bValidTxt = TRUE;
+ }
+
+ rSortTxt = sSortTxt;
+ rSortTxtReading = sSortTxtReading;
+ }
+
+ inline const ::com::sun::star::lang::Locale& SwTOXSortTabBase::GetLocale() const
+ {
+ return aLocale;
+ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: fuer Sortierung nach Text
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: fuer Sortierung nach Position
+ --------------------------------------------------------------------*/
+
+
+
+
+struct SwTOXAuthority : public SwTOXSortTabBase
+{
+private:
+ SwFmtFld& m_rField;
+ virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const;
+ virtual void _GetText( String&, String& );
+
+public:
+ SwTOXAuthority( const SwCntntNode& rNd, SwFmtFld& rField, const SwTOXInternational& rIntl );
+ SwFmtFld& GetFldFmt() {return m_rField;}
+
+ virtual BOOL operator==( const SwTOXSortTabBase& );
+ virtual BOOL operator<( const SwTOXSortTabBase& );
+ virtual USHORT GetLevel() const;
+};
+
+
+} //namespace binfilter
+#endif // _TXMSRT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/txtfrm.hxx b/binfilter/bf_sw/source/core/inc/txtfrm.hxx
new file mode 100644
index 000000000000..cd89ef7acf0b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/txtfrm.hxx
@@ -0,0 +1,707 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTFRM_HXX
+#define _TXTFRM_HXX
+
+#include <tools/mempool.hxx>
+#include <tools/string.hxx>
+#include "cntfrm.hxx"
+/*N*/ #include <tools/debug.hxx> //for stripping
+class OutputDevice;
+namespace binfilter {
+#define STRSIZE(x) (sizeof(x)-1)
+
+class SwCharRange;
+class SwTxtNode;
+class SwTxtFormatter;
+class SwTxtFormatInfo;
+class SwParaPortion;
+class WidowsAndOrphans;
+class SwBodyFrm;
+class SwFooterFrm;
+class SwTxtFtn;
+class SwInterHyphInfo; // Hyphenate()
+class SwCache;
+class SwBorderAttrs;
+class SwFrmFmt;
+class SwFldPortion;
+
+class SwTestFormat;
+class SwStripes;
+struct SwCrsrMoveState;
+struct SwFillData;
+class SwPortionHandler;
+class SwScriptInfo;
+
+#define GRID_ON 0
+#define GRID_HEIGHT 1
+#define RUBY_HEIGHT 2
+#define RUBY_TOP 3
+#define GRID_CELLS 4
+
+class SwTxtFrm: public SwCntntFrm
+{
+ friend class SwTxtIter;
+ friend class SwTestFormat;
+ friend class WidowsAndOrphans;
+ friend class SwTxtFrmLocker; // duerfen Lock()/Unlock()
+
+ static SwCache *pTxtCache; //Pointer auf den Line-Cache
+ static long nMinPrtLine; //Diese Linie darf beim Drucken nicht
+ //unterschritten werden, Hack fuer Tabellenzellen ueber mehrere Seiten
+
+ ULONG nAllLines :24;//Anzahl der Zeilen fuer das Paint (inkl. nThisLines)
+ ULONG nThisLines :8; //Anzahl der Zeilen dieses Frames
+
+ // The x position for flys anchored at this paragraph.
+ // These values are calculated in SwTxtFrm::CalcBaseOfstForFly()
+ SwTwips mnFlyAnchorOfst;
+ // The x position for wrap-through flys anchored at this paragraph.
+ SwTwips mnFlyAnchorOfstNoWrap;
+
+ xub_StrLen nOfst; //nOfst gibt den Offset im Cntnt (Anzahl Zeichen) an.
+
+ USHORT nCacheIdx; //Index in den Cache, USHRT_MAX wenn definitiv
+ //kein passendes Objekt im Cache steht.
+
+ //Teilt den Master ab und erzeugt einen Follow oder passt die
+ //Daten im Follow an.
+ void _AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
+ const xub_StrLen nStrEnd, const sal_uInt8 nMode );
+ inline void AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
+ const xub_StrLen nStrEnd, const sal_uInt8 nMode );
+
+ //Iteriert ueber alle Zeilen und stellt das Linespacing
+ //entsprechend dem Attribut ein.
+ void CalcLineSpace();
+
+ void InitCtor(); // Wird in beiden Ctoren gerufen
+
+ // Wird nur in Format gerufen:
+ void AdjustFrm( const SwTwips nChgHeight, sal_Bool bHasToFit = sal_False );
+
+ // wertet in Format() die Preps aus.
+ sal_Bool CalcPreps();
+ void PrepWidows( const USHORT nNeed, sal_Bool bNotify = sal_True );
+ void _InvalidateRange( const SwCharRange &, const long = 0);
+ inline void InvalidateRange( const SwCharRange &, const long = 0);
+
+ // WidowsAndOrphans, AdjustFrm, AdjustFollow
+ void FormatAdjust( SwTxtFormatter &rLine, WidowsAndOrphans &rFrmBreak,
+ const xub_StrLen nStrLen, const sal_Bool bDummy );
+
+ sal_Bool bLocked : 1; // im Format?
+ sal_Bool bFormatted : 1; // nach Format auf sal_True
+ sal_Bool bWidow : 1; // sind wir ein Widow
+ sal_Bool bJustWidow : 1; // haben wir soeben Widow angefordert
+ sal_Bool bEmpty : 1; // sind wir ein leerer Absatz
+ sal_Bool bInFtnConnect : 1; // Steht gerade im Connect
+ sal_Bool bFtn : 1; // Hat mindestens eine Fussnote
+ sal_Bool bRepaint : 1; // TxtFrm: Repaint steht zur Abholung bereit
+ sal_Bool bBlinkPor : 1; // enthaelt Blink-Portions
+ sal_Bool bFieldFollow : 1; // beginne mit Feldrest des Masters
+ sal_Bool bHasAnimation : 1; // enthaelt animierte SwGrfNumPortion
+ sal_Bool bIsSwapped : 1; // during text formatting we swap the
+ // width and height for vertical formatting
+ // OD 14.03.2003 #i11760# - flag to control, if follow is formatted in
+ // method <CalcFollow(..)>.
+ // E.g., avoid formatting of follow, if method <SwLayoutFrm::FormatWidthCols(..)>
+ // is running.
+ sal_Bool mbFollowFormatAllowed : 1;
+
+ void ResetPreps();
+ inline void Lock() { bLocked = sal_True; }
+ inline void Unlock() { bLocked = sal_False; }
+ inline void SetFormatted( const sal_Bool bNew ) { bFormatted = bNew; }
+ inline void SetWidow( const sal_Bool bNew ) { bWidow = bNew; }
+ inline void SetJustWidow( const sal_Bool bNew ) { bJustWidow = bNew; }
+ inline void SetEmpty( const sal_Bool bNew ) { bEmpty = bNew; }
+ inline void SetFieldFollow( const sal_Bool bNew ) { bFieldFollow = bNew; }
+
+ sal_Bool IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) const;
+
+ // Wechselt den Frame oder auch nicht (vgl. FlyCnt)
+ sal_Bool _GetCrsrOfst(SwPosition *pPos, const Point &rPoint,
+ const sal_Bool bChgFrm, const SwCrsrMoveState* = 0 ) const;
+
+ // formatiert genau eine Zeile ...
+ sal_Bool FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev );
+
+ // Um Stack einzusparen aufgeteilt ...
+ // _Format ruft _Format mit Parametern
+ void _Format( SwParaPortion *pPara );
+ void _Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
+ const sal_Bool bAdjust = sal_False );
+ void FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf );
+
+ // formatiert den Follow und sorgt fuer die Entsorgung bei Orphans
+ sal_Bool CalcFollow( const xub_StrLen nTxtOfst );
+
+ // korrigiert die Stelle ab der formatiert werden muss.
+ xub_StrLen FindBrk(const String &rTxt, const xub_StrLen nStart,
+ const xub_StrLen nEnd) const;
+
+ // inline-Weiche
+ SwTwips _GetFtnFrmHeight() const;
+
+ // Aus CalcPreps ausgelagert.
+ sal_Bool CalcPrepFtnAdjust();
+
+ // Fuer Ftn und WidOrp: Zwangsvalidierung
+ void ValidateFrm();
+ void ValidateBodyFrm();
+
+
+ void SetPara( SwParaPortion *pNew, sal_Bool bDelete = sal_True );
+
+ sal_Bool _IsFtnNumFrm() const;
+
+ // 6995: Formatinformationen auffrischen
+ sal_Bool FormatQuick();
+
+ // Opt: Leere Absaetze formatieren
+ sal_Bool FormatEmpty();
+ SwTwips EmptyHeight() const;
+ // Opt: Leere Absaetze painten
+
+ void ChgThisLines();//Muss immer gerufen werden, wenn sich die Zeilenazahl
+ //veraendert haben kann.
+
+ // required for 'new' relative anchor position
+ void CalcBaseOfstForFly();
+
+public:
+
+ //public, weil der eine oder andere die Methode rufen darf um das
+ //Prepare zu sparen - mit Vorsicht zu geniessen!
+ void Init();
+
+ // Wird von FormatSpelling( ) gerufen
+ SwRect _AutoSpell( SwCntntNode* , USHORT );
+ // Wird vom CollectAutoCmplWords gerufen
+ void CollectAutoCmplWrds( SwCntntNode* , USHORT , sal_Bool bIsVisArea );
+
+ // Returns the screen position of rPos. The values are relative to the upper
+ // left position of the page frame.
+ // Additional information can be obtained by passing an SwCrsrMoveState object.
+ // Returns sal_False if rPos > number of character is string
+ virtual sal_Bool GetCharRect( SwRect& rRect, const SwPosition& rPos,
+ SwCrsrMoveState* pCMS = 0 ) const;
+ // Eine etwas abgespeckte GetCharRect-Version fuer autopositionierte Rahmen
+ sal_Bool GetAutoPos( SwRect &, const SwPosition& ) const;
+
+ //Liefert in nOffset den Offset des Characters innerhalb des
+ //gesetzten Textbuffers zurueck, welcher der durch aPoint
+ //gegebenen Position innerhalb der SSize des Layout am
+ //naechsten ist. Wenn der SPoint ausserhalb der SSize liegt,
+ //liefert die Funktion sal_False, sal_True sonst.
+ virtual sal_Bool GetCrsrOfst( SwPosition *, Point&,
+ const SwCrsrMoveState* = 0) const;
+
+ // GetKeyCrsrOfst sorgt dafuer, dass der Frame nicht gewechselt wird
+ // (z.B. Wechsel in den zeichengebundenen Frame).
+ inline sal_Bool GetKeyCrsrOfst(SwPosition *pPos, const Point &rPoint ) const
+ { return _GetCrsrOfst( pPos, rPoint, sal_False ); }
+
+ SwRect Paint();
+ virtual void Modify( SfxPoolItem*, SfxPoolItem* );
+ virtual sal_Bool GetInfo( SfxPoolItem & ) const;
+
+ //Layoutorientiertes Cursortravelling: Linker, rechter Rand,
+ //vorhergehende/naechste Zeile, gleiche horizontale Position.
+
+
+ // Prepares the cursor position for a visual cursor move (BiDi).
+ // The behaviour is different for insert and overwrite cursors
+ void PrepareVisualMove( xub_StrLen& nPos, BYTE& nCrsrLevel,
+ sal_Bool& bRight, sal_Bool bInsertCrsr );
+
+ // Methoden zur Verwaltung von FolgeFrames
+ SwCntntFrm *SplitFrm( const xub_StrLen nTxtPos );
+ SwCntntFrm *JoinFrm();
+ inline USHORT GetOfst() const { return nOfst; }
+ void _SetOfst( const USHORT nNewOfst );
+ inline void SetOfst ( const USHORT nNewOfst );
+ inline void ManipOfst ( const USHORT nNewOfst ){ nOfst = nNewOfst; }
+ SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos);
+ inline const SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos) const;
+ SwTxtFrm *GetFrmAtOfst( const xub_StrLen nOfst );
+ // Wenn es einen Follow gibt und wir selbst keinen Text enthalten:
+ inline sal_Bool IsEmptyMaster() const
+ { return GetFollow() && !GetFollow()->GetOfst(); }
+
+ // Liefert den zu bearbeitenden Textausschnitt zurueck (inline, s.u.)
+ const String& GetTxt() const;
+ inline SwTxtNode *GetTxtNode()
+ { return (SwTxtNode*)SwCntntFrm::GetNode(); }
+ inline const SwTxtNode *GetTxtNode() const
+ { return (SwTxtNode*)SwCntntFrm::GetNode(); }
+
+ SwTxtFrm(SwTxtNode * const);
+ inline ~SwTxtFrm() { if( HasAnimation() ) ClearPara(); }
+
+ // SwCntntFrm: der "kurze Dienstweg" fuer die Frames.
+ // Wer den void* falsch casted ist selbst Schuld!
+ // Auf jedenfall muss der void* auf 0 geprueft werden.
+ virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
+ const void *pVoid = 0, sal_Bool bNotify = sal_True );
+
+ //nMaxHeight liefert die benoetigte Hoehe,
+ //bSplit sagt, obj der Absatz gesplittet werden muss.
+ virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit );
+
+ // Hier das WouldFit-Aequivalent fuer mal kurz probeweise
+ // umgehaengte TextFrames, auch hier liefert
+ // nMaxHeight die benoetigte Hoehe,
+ // und bSplit sagt, obj der Absatz gesplittet werden muss.
+ // Uebergeben wird der potentielle Vorgaenger fuer die Abstandsberechnung
+ sal_Bool TestFormat( const SwFrm* pPrv, SwTwips &nMaxHeight, sal_Bool &bSplit );
+
+ // Wir formatieren eine Zeile fuer die interaktive Trennung
+ // Return: found
+
+ // Probegrow
+ inline SwTwips GrowTst( const SwTwips nGrow );
+
+ SwParaPortion *GetPara();
+ inline const SwParaPortion *GetPara() const;
+ inline sal_Bool HasPara() const;
+ sal_Bool _HasPara() const;
+ // If there are any hanging punctuation portions in the margin
+ // the offset will be returned.
+ SwTwips HangingMargin() const;
+
+ // RTTI
+ TYPEINFO();
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTxtFrm)
+
+ // Locking
+ inline sal_Bool IsLocked() const { return bLocked; }
+ inline sal_Bool IsFormatted() const { return bFormatted; }
+
+ inline sal_Bool IsWidow() const { return bWidow; }
+ inline sal_Bool IsJustWidow() const { return bJustWidow; }
+ inline sal_Bool IsEmpty() const { return bEmpty; }
+ inline sal_Bool HasFtn() const { return bFtn; }
+ inline sal_Bool IsInFtnConnect()const { return bInFtnConnect;}
+ inline sal_Bool IsFieldFollow() const { return bFieldFollow;}
+
+ inline void SetRepaint() const;
+ inline void ResetRepaint() const;
+ inline sal_Bool HasRepaint() const { return bRepaint; }
+ inline void SetBlinkPor() const;
+ inline void ResetBlinkPor() const;
+ inline sal_Bool HasBlinkPor() const { return bBlinkPor; }
+ inline void SetAnimation() const
+ { ( (SwTxtFrm*)this )->bHasAnimation = sal_True; }
+ inline sal_Bool HasAnimation() const { return bHasAnimation; }
+
+ inline sal_Bool IsSwapped() const { return bIsSwapped; }
+
+ // Hat der Frm eine lokale Fussnote (in diesem Frm bzw. Follow)?
+#ifndef DBG_UTIL
+ void CalcFtnFlag();
+#else
+ void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//Fuer den Test von SplitFrm
+#endif
+
+ // Hidden
+ sal_Bool IsHiddenNow() const; // bHidden && pOut == pPrt
+ void HideHidden(); // Anhaengsel entfernen wenn Hidden
+
+ // Ftn
+ void RemoveFtn( const xub_StrLen nStart = 0,
+ const xub_StrLen nLen = STRING_LEN );
+ inline SwTwips GetFtnFrmHeight() const;
+ SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn );
+ inline const SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn ) const
+ { return FindFtnRef( pFtn ); }
+ void ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine );
+
+ // Wenn wir eine Ftn sind, die auf ihre Referenz zu waechst...
+ // public weil von SwCntntFrm::MakeAll benoetigt.
+ SwTwips GetFtnLine( const SwTxtFtn *pFtn, sal_Bool bLocked ) const;
+
+ // Liefern den linken und den rechten Rand in
+ // Dokumentkoordinaten (unter Beachtung der Absatzattribute).
+ inline SwTwips GetLeftMargin() const;
+ inline SwTwips GetRightMargin() const;
+
+ virtual void Format( const SwBorderAttrs *pAttrs = 0 );
+ virtual void CheckDirection( BOOL bVert );
+
+ // Liefert die Summe der Zeilenhoehen in pLine zurueck.
+ USHORT GetParHeight() const;
+
+ // Liefert die Resthoehe zurueck
+ inline SwTwips GetRstHeight() const;
+
+ inline SwTxtFrm *GetFollow();
+ inline const SwTxtFrm *GetFollow() const;
+ inline SwTxtFrm *FindMaster();
+ inline const SwTxtFrm *FindMaster() const;
+
+ // Suche die Seitennummer von ErgoSum und QuoVadis
+ SwTxtFrm *FindQuoVadisFrm();
+
+ // holt die Formatierug nach, wenn der Idle-Handler zugeschlagen hat.
+ SwTxtFrm *GetFormatted();
+
+ // wird demnaechst uebertragen
+ inline void SetFtn( const sal_Bool bNew ) { bFtn = bNew; }
+
+ // Beruecksichtigung der Follows
+ inline sal_Bool IsInside( const xub_StrLen nPos ) const;
+
+ const SwBodyFrm *FindBodyFrm() const;
+
+ // DropCaps und Selektionen
+
+ static SwCache *GetTxtCache() { return pTxtCache; }
+ static void SetTxtCache( SwCache *pNew ) { pTxtCache = pNew; }
+
+ static long GetMinPrtLine() { return nMinPrtLine; }
+ static void SetMinPrtLine( long nNew ) { nMinPrtLine = nNew; }
+
+ inline USHORT GetCacheIdx() const { return nCacheIdx; }
+ inline void SetCacheIdx( const USHORT nNew ) { nCacheIdx = nNew; }
+
+ //Entfert die Line-Informationen aus dem Cache.
+ void ClearPara();
+
+ // Bin ich ein FtnFrm, der eine Nummer am Absatzanfang hat?
+ inline sal_Bool IsFtnNumFrm() const
+ { return IsInFtn() && !GetIndPrev() && _IsFtnNumFrm(); }
+
+ // simuliert eine Formatierung, als wenn es keinen rechten Rand und
+ // keine Flys oder andere Hindernisse gaebe und liefert die Breite.
+
+ // liefert den zusaetzlichen Zeilenabstand fuer den naechsten Absatz
+ USHORT GetLineSpace() const;
+
+ // liefert die erste Zeilenhoehe zurueck
+ USHORT FirstLineHeight() const;
+
+ const SwFrmFmt* IsFirstBullet();
+
+ // Haengt FlyInCntFrm um, wenn nEnd > Index >= nStart ist.
+ void MoveFlyInCnt( SwTxtFrm *pNew, USHORT nStart, USHORT nEnd );
+
+ // Berechnet die Position von FlyInCntFrms
+ USHORT CalcFlyPos( SwFrmFmt* pSearch );
+
+ // Ermittelt die Startposition und Schrittweite des Registers
+ sal_Bool FillRegister( SwTwips& rRegStart, USHORT& rRegDiff );
+
+
+
+ //Fuer die Anzeige der Zeilennummern.
+ ULONG GetAllLines() const { return nAllLines; }
+ ULONG GetThisLines() const { return nThisLines;}
+ void RecalcAllLines();
+
+ // Stoppt Animationen innerhalb von Numerierungen
+
+
+ // visit all portions for Accessibility
+
+ // returns the script info stored at the paraportion
+ const SwScriptInfo* GetScriptInfo() const;
+
+ // Swaps width and height of the text frame
+ void SwapWidthAndHeight();
+ // Calculates the coordinates of a rectangle when switching from
+ // horizontal to vertical layout.
+ void SwitchHorizontalToVertical( SwRect& rRect ) const{DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 void SwitchHorizontalToVertical( SwRect& rRect ) const;
+ // Calculates the coordinates of a point when switching from
+ // horizontal to vertical layout.
+ void SwitchHorizontalToVertical( Point& rPoint ) const{DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 void SwitchHorizontalToVertical( Point& rPoint ) const;
+ // Calculates the a limit value when switching from
+ // horizontal to vertical layout.
+ long SwitchHorizontalToVertical( long nLimit ) const;
+ // Calculates the coordinates of a rectangle when switching from
+ // vertical to horizontal layout.
+ void SwitchVerticalToHorizontal( SwRect& rRect ) const;
+ // Calculates the coordinates of a point when switching from
+ // vertical to horizontal layout.
+ void SwitchVerticalToHorizontal( Point& rPoint ) const;
+
+#ifdef BIDI
+ // Calculates the coordinates of a point when switching from
+ // LTR to RTL layout.
+ void SwitchLTRtoRTL( Point& rPoint ) const;
+ // Calculates the coordinates of a point when switching from
+ // RTL to LTR layout.
+ inline void SwitchRTLtoLTR( Point& rPoint ) const { SwitchLTRtoRTL( rPoint ); };
+
+#endif
+
+ // OD 14.03.2003 #i11760# - access to new member <mbNoFollowFormat>
+ inline bool FollowFormatAllowed() const
+ {
+ return mbFollowFormatAllowed;
+ }
+ inline void AllowFollowFormat()
+ {
+ mbFollowFormatAllowed = true;
+ }
+ inline void ForbidFollowFormat()
+ {
+ mbFollowFormatAllowed = false;
+ }
+
+ SwTwips GetBaseOfstForFly( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const
+ {
+ return ( bIgnoreFlysAnchoredAtThisFrame ?
+ mnFlyAnchorOfst :
+ mnFlyAnchorOfstNoWrap );
+ }
+};
+
+/*************************************************************************
+ * class SwTxtFrmLocker
+ *************************************************************************/
+
+class SwTxtFrmLocker
+{
+private:
+ SwTxtFrm * const pFrm;
+public:
+ inline SwTxtFrmLocker( SwTxtFrm *pTxtFrm )
+ : pFrm( pTxtFrm->IsLocked() ? 0 : pTxtFrm )
+ { if( pFrm ) pFrm->Lock(); }
+ inline ~SwTxtFrmLocker() { if( pFrm ) pFrm->Unlock(); }
+};
+
+/*************************************************************************
+ * Inline-Implementierung
+ *************************************************************************/
+
+inline const SwParaPortion *SwTxtFrm::GetPara() const
+{
+ return ((SwTxtFrm*)this)->GetPara();
+}
+
+inline sal_Bool SwTxtFrm::HasPara() const
+{
+ return nCacheIdx != USHRT_MAX ? _HasPara() : sal_False;
+}
+
+// 9104: Frm().Height() - Prt().Height(), siehe widorp.cxx und 7455, 6114, 7908
+inline SwTwips SwTxtFrm::GetRstHeight() const
+{
+ return !GetUpper() ? 0 : ((const SwFrm*)GetUpper())->Frm().Top()
+ + ((const SwFrm*)GetUpper())->Prt().Top()
+ + ((const SwFrm*)GetUpper())->Prt().Height()
+ - Frm().Top() - (Frm().Height() - Prt().Height());
+}
+
+inline SwTwips SwTxtFrm::GetLeftMargin() const
+{
+ return Frm().Left() + Prt().Left();
+}
+inline SwTwips SwTxtFrm::GetRightMargin() const
+{
+ return Frm().Left() + Prt().Left() + Prt().Width();
+}
+inline SwTwips SwTxtFrm::GrowTst( const SwTwips nGrow )
+{
+ return Grow( nGrow, sal_True );
+}
+
+#if OSL_DEBUG_LEVEL > 1
+// fragt auf WYSIWYG DBG ab
+extern sal_Bool IsDbg( const SwTxtFrm *pFrm );
+#define DBTXTFRM aDbstream << "SwTxtFrm[" << GetFrmId() << "]"
+#endif
+
+inline sal_Bool SwTxtFrm::IsInside( const xub_StrLen nPos ) const
+{
+ sal_Bool bRet = sal_True;
+ if( nPos < GetOfst() )
+ bRet = sal_False;
+ else
+ {
+ const SwTxtFrm *pFoll = GetFollow();
+ if( pFoll && nPos >= pFoll->GetOfst() )
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+inline SwTwips SwTxtFrm::GetFtnFrmHeight() const
+{
+ if( !IsFollow() && IsInFtn() && HasPara() )
+ return _GetFtnFrmHeight();
+ else
+ return 0;
+}
+
+inline SwTxtFrm *SwTxtFrm::FindMaster()
+{
+ return (SwTxtFrm*)SwFlowFrm::FindMaster();
+}
+inline const SwTxtFrm *SwTxtFrm::FindMaster() const
+{
+ return (const SwTxtFrm*)SwFlowFrm::FindMaster();
+}
+inline const SwTxtFrm *SwTxtFrm::GetFollow() const
+{
+ return (const SwTxtFrm*)SwCntntFrm::GetFollow();
+}
+inline SwTxtFrm *SwTxtFrm::GetFollow()
+{
+ return (SwTxtFrm*)SwCntntFrm::GetFollow();
+}
+
+inline const SwTxtFrm *SwTxtFrm::GetFrmAtPos( const SwPosition &rPos) const
+{
+ return ((SwTxtFrm*)this)->GetFrmAtPos( rPos );
+}
+
+inline void SwTxtFrm::AdjustFollow( SwTxtFormatter &rLine,
+ const xub_StrLen nOffset, const xub_StrLen nStrEnd, const sal_uInt8 nMode )
+{
+ if ( HasFollow() )
+ _AdjustFollow( rLine, nOffset, nStrEnd, nMode );
+}
+
+inline void SwTxtFrm::SetOfst( const xub_StrLen nNewOfst )
+{
+ if ( nOfst != nNewOfst )
+ _SetOfst( nNewOfst );
+}
+
+inline void SwTxtFrm::SetRepaint() const
+{
+ ((SwTxtFrm*)this)->bRepaint = sal_True;
+}
+inline void SwTxtFrm::ResetRepaint() const
+{
+ ((SwTxtFrm*)this)->bRepaint = sal_False;
+}
+
+inline void SwTxtFrm::SetBlinkPor() const
+{
+ ((SwTxtFrm*)this)->bBlinkPor = sal_True;
+}
+inline void SwTxtFrm::ResetBlinkPor() const
+{
+ ((SwTxtFrm*)this)->bBlinkPor = sal_False;
+}
+
+#ifdef LINGU_STATISTIK
+
+class SwLinguStatistik
+{
+public:
+ long nWords; // gepruefte Worte
+ long nFlushCnt; // zaehlt die Messungen
+
+ long nWrong; // als falsch erkannt
+ long nAlter; // Alternativvorschlaege
+ long nSpellTime; // Zeitmessung
+ long nSynonym; // Thesaurus
+ long nNoSynonym; // Thesaurus ratlos
+ long nMeaning; // Thesaurus-Bedeutung
+ long nNoMeaning; // Thesaurus meinungslos
+ long nTheTime; // Zeitmessung
+ long nHyphens; // Trennstellen
+ long nNoHyph; // Worte ohne Trennstellen
+ long nHyphErr; // Fehler beim Trennen
+ long nHyphTime; // Zeitmessung
+ SpellCheck *pSpell;
+ LanguageType eLang;
+
+ void Flush();
+
+ inline SwLinguStatistik()
+ { nWords = nWrong = nAlter = nSynonym = nNoSynonym =
+ nHyphens = nNoHyph = nHyphErr = nSpellTime = nTheTime =
+ nHyphTime = nFlushCnt = 0;
+ pSpell = NULL;
+ eLang = LANGUAGE_DONTKNOW; }
+ inline ~SwLinguStatistik(){ Flush(); }
+};
+
+// globale Variable, implementiert in txtfrm.cxx
+extern SwLinguStatistik aSwLinguStat;
+
+#define SW_LING(nWhich,nInc) (aSwLinguStat.nWhich) += nInc;
+
+#endif
+
+#define SWAP_IF_SWAPPED( pFrm )\
+ sal_Bool bUndoSwap = sal_False; \
+ if ( pFrm->IsVertical() && pFrm->IsSwapped() )\
+ { \
+ bUndoSwap = sal_True; \
+ ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \
+ }
+
+#define SWAP_IF_NOT_SWAPPED( pFrm )\
+ sal_Bool bUndoSwap = sal_False; \
+ if ( pFrm->IsVertical() && ! pFrm->IsSwapped() )\
+ { \
+ bUndoSwap = sal_True; \
+ ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \
+ }
+
+#define UNDO_SWAP( pFrm )\
+ if ( bUndoSwap )\
+ ((SwTxtFrm*)pFrm)->SwapWidthAndHeight();
+
+// Helper class which can be used instead of the macros if a function
+// has too many returns
+class SwFrmSwapper
+{
+ const SwTxtFrm* pFrm;
+ sal_Bool bUndo;
+public:
+ SwFrmSwapper( const SwTxtFrm* pFrm, sal_Bool bSwapIfNotSwapped );
+ ~SwFrmSwapper();
+};
+
+#ifdef BIDI
+
+class SwLayoutModeModifier
+{
+ const OutputDevice& rOut;
+ long nOldLayoutMode;
+public:
+ SwLayoutModeModifier( const OutputDevice& rOutp );
+ ~SwLayoutModeModifier();
+ void SetAuto();
+};
+
+#endif
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/txttypes.hxx b/binfilter/bf_sw/source/core/inc/txttypes.hxx
new file mode 100644
index 000000000000..842c087e9f6b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/txttypes.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTTYPES_HXX
+#define _TXTTYPES_HXX
+
+namespace binfilter {
+
+// Ueberpruefte USHORTs, z.B. Indizes auf Arrays oder garantiert kleine
+// Integerwerte, auch von aussen vorgegebene
+#define MSHORT USHORT
+#define MSHRT_MAX USHRT_MAX
+// Koordinaten: Breite, Hoehe und Offsets in X-/Y-Richtung sowie Ascent etc.
+#define KSHORT USHORT
+#define KSHRT_MAX USHRT_MAX
+
+// Portiontypen
+#define POR_LIN 0x0000
+#define POR_FLYCNT 0x0001
+
+#define POR_HOLE 0x0080
+#define POR_TMPEND 0x0081
+#define POR_BRK 0x0082
+#define POR_KERN 0x0083
+#define POR_ARROW 0x0084
+#define POR_MULTI 0x0085
+
+#define POR_TXT 0x8000
+#define POR_LAY 0x8001
+#define POR_PARA 0x8002
+#define POR_URL 0x8003
+#define POR_HNG 0x8004
+
+#define POR_DROP 0x8080
+#define POR_TOX 0x8089
+#define POR_ISOTOX 0x808a
+#define POR_REF 0x808b
+#define POR_ISOREF 0x808c
+
+#define POR_EXP 0xc080
+#define POR_BLANK 0xc081
+#define POR_POSTITS 0xc082
+
+#define POR_HYPH 0xd080
+#define POR_HYPHSTR 0xd081
+#define POR_SOFTHYPH 0xd082
+#define POR_SOFTHYPHSTR 0xd083
+#define POR_SOFTHYPH_COMP 0xd084
+
+#define POR_FLD 0xe080
+#define POR_HIDDEN 0xe081
+#define POR_QUOVADIS 0xe082
+#define POR_ERGOSUM 0xe083
+#define POR_COMBINED 0xe084
+#define POR_FTN 0xe085
+
+#define POR_FTNNUM 0xe880
+#define POR_NUMBER 0xe881
+#define POR_BULLET 0xe882
+#define POR_GRFNUM 0xe883
+
+#define POR_GLUE 0x0480
+
+#define POR_MARGIN 0x04c0
+
+#define POR_FIX 0x06c0
+#define POR_FLY 0x06c1
+
+#define POR_TAB 0x0750
+
+#define POR_TABRIGHT 0x07d0
+#define POR_TABCENTER 0x07d1
+#define POR_TABDECIMAL 0x07d2
+
+#define POR_TABLEFT 0x0740
+
+} //namespace binfilter
+#endif //_TXTTYPES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/unoclbck.hxx b/binfilter/bf_sw/source/core/inc/unoclbck.hxx
new file mode 100644
index 000000000000..597cae3a6834
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/unoclbck.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOCLBCK_HXX
+#define _UNOCLBCK_HXX
+
+
+#include <calbck.hxx>
+namespace binfilter {
+
+class SwXReferenceMark;
+class SwFmtRefMark;
+class SwFmtFtn;
+class SwXFootnote;
+class SwTOXMark;
+class SwXDocumentIndexMark;
+
+class SwUnoCallBack : public SwModify
+{
+public:
+ SwUnoCallBack(SwModify *pToRegisterIn);
+ virtual ~SwUnoCallBack();
+
+ // returns the API object of a reference mark if available
+ SwXReferenceMark* GetRefMark(const SwFmtRefMark& rMark);
+ SwXFootnote* GetFootnote(const SwFmtFtn& rMark);
+ SwXDocumentIndexMark* GetTOXMark(const SwTOXMark& rMark);
+};
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/unofldmid.h b/binfilter/bf_sw/source/core/inc/unofldmid.h
new file mode 100644
index 000000000000..f74d999844f9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/unofldmid.h
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_UNOFLDMID_H
+#define SW_UNOFLDMID_H
+
+class String;
+namespace com { namespace sun { namespace star { namespace uno {
+ class Any;
+} } } }
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+//Abbildung der Properties auf den Descriptor
+#define FIELD_PROP_PAR1 10
+#define FIELD_PROP_PAR2 11
+#define FIELD_PROP_PAR3 12
+#define FIELD_PROP_FORMAT 13
+#define FIELD_PROP_SUBTYPE 14
+#define FIELD_PROP_BOOL1 15
+#define FIELD_PROP_BOOL2 16
+#define FIELD_PROP_DATE 17
+#define FIELD_PROP_USHORT1 18
+#define FIELD_PROP_USHORT2 19
+#define FIELD_PROP_BYTE1 20
+#define FIELD_PROP_DOUBLE 21
+#define FIELD_PROP_BOOL3 22
+#define FIELD_PROP_PAR4 23
+#define FIELD_PROP_SHORT1 24
+#define FIELD_PROP_DATE_TIME 25
+#define FIELD_PROP_PROP_SEQ 26
+#define FIELD_PROP_LOCALE 27
+#define FIELD_PROP_BOOL4 28
+#define FIELD_PROP_STRINGS 29
+
+String& GetString( const com::sun::star::uno::Any&, String& rStr );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/viewimp.hxx b/binfilter/bf_sw/source/core/inc/viewimp.hxx
new file mode 100644
index 000000000000..a7e8c4e23e43
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/viewimp.hxx
@@ -0,0 +1,327 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VIEWIMP_HXX
+#define _VIEWIMP_HXX
+
+
+#include <vcl/timer.hxx>
+#include <tools/color.hxx>
+// OD 25.06.2003 #108784#
+#include <bf_svx/svdtypes.hxx>
+
+#include "swtypes.hxx"
+#include "swrect.hxx"
+#include <tools/debug.hxx> //for strip
+#ifdef ACCESSIBLE_LAYOUT
+class Fraction;
+#endif
+namespace binfilter {
+class ViewShell;
+class SwFlyFrm;
+class SwViewOption;
+class SwRegionRects;
+class SwScrollAreas;
+class SwScrollColumn;
+class SwFrm;
+class SwLayAction;
+class SwLayIdle;
+class SwDrawView;
+class SdrPageView;
+class SwPageFrm;
+class SwRegionRects;
+class ExtOutputDevice;
+class SdrPaintInfoRec;
+struct SdrPaintProcRec;
+#ifdef ACCESSIBLE_LAYOUT
+class SwAccessibleMap;
+class SdrObject;
+//STRIP008 class Fraction;
+#endif
+// OD 12.12.2002 #103492#
+class SwPagePreviewLayout;
+// OD 15.01.2003 #103492#
+} //namespace binfilter
+
+#include <prevwpage.hxx>
+// OD 15.01.2003 #103492#
+#include <vector>
+namespace binfilter {//STRIP009
+class SwViewImp
+{
+ friend class ViewShell;
+
+ friend class SwLayAction; //Lay- und IdleAction tragen sich ein und aus.
+ friend class SwLayIdle;
+
+ // OD 12.12.2002 #103492# - for paint of page preview
+ friend class SwPagePreviewLayout;
+
+ ViewShell *pSh; //Falls jemand einen Imp durchreicht und doch
+ //mal eine ViewShell braucht hier die
+ //Rueckwaertsverkettung.
+
+ SwDrawView *pDrawView; //Unsere DrawView
+ SdrPageView *pSdrPageView; //Genau eine Seite fuer unsere DrawView
+
+ SwPageFrm *pFirstVisPage;//Zeigt immer auf die erste sichtbare Seite.
+ SwRegionRects *pRegion; //Sammler fuer Paintrects aus der LayAction.
+ SwScrollAreas *pScrollRects; //Sammler fuer Scrollrects aus der LayAction.
+ SwScrollAreas *pScrolledArea;//Sammler der gescrollten Rechtecke.
+
+ SwLayAction *pLayAct; //Ist gesetzt wenn ein Action-Objekt existiert
+ //Wird vom SwLayAction-CTor ein- und vom DTor
+ //ausgetragen.
+ SwLayIdle *pIdleAct; //Analog zur SwLayAction fuer SwLayIdle.
+
+#ifdef ACCESSIBLE_LAYOUT
+#endif
+
+
+ AutoTimer aScrollTimer; //Fuer das Aufraeumen nach dem Scrollen.
+
+ BOOL bFirstPageInvalid :1; //Pointer auf erste Seite ungueltig?
+ BOOL bNextScroll :1; //Scroll in der folgenden EndAction erlaubt?
+ BOOL bScroll :1; //Scroll in der aktuellen EndAction erlaubt?
+ BOOL bScrolled :1; //Wurde gescrolled? Dann im Idle aufraeumen.
+
+ BOOL bResetXorVisibility:1; //StartAction/EndAction
+ BOOL bShowHdlPaint :1; //LockPaint/UnlockPaint
+ BOOL bResetHdlHiddenPaint:1;// -- "" --
+ BOOL bPaintInScroll :1; //Paint (Update() im ScrollHdl der ViewShell
+
+ BOOL bSmoothUpdate :1; //Meber fuer SmoothScroll
+ BOOL bStopSmooth :1;
+ BOOL bStopPrt :1; // Stop Printing
+
+ USHORT nRestoreActions ; //Die Anzahl der zu restaurierenden Actions (UNO)
+ SwRect aSmoothRect;
+
+ // OD 12.12.2002 #103492#
+
+ /**
+ Signal whether to stop printing.
+
+ @param _useless just to fit macro
+ */
+ DECL_LINK(SetStopPrt, void * _useless = NULL);
+
+ /**
+ Returns if printer shall be stopped.
+
+ @retval TRUE The printer shall be stopped.
+ @retval FALSE else
+ */
+ BOOL IsStopPrt() { return bStopPrt; }
+
+ /**
+ Resets signal for stopping printing.
+
+ */
+ void ResetStopPrt() { bStopPrt = FALSE; }
+
+ void SetFirstVisPage(); //Neue Ermittlung der ersten sichtbaren Seite
+
+ void ResetNextScroll() { bNextScroll = FALSE; }
+ void SetNextScroll() { bNextScroll = TRUE; }
+ void SetScroll() { bScroll = TRUE; }
+ void ResetScrolled() { bScrolled = FALSE; }
+ void SetScrolled() { bScrolled = TRUE; }
+
+ SwScrollAreas *GetScrollRects() { return pScrollRects; }
+
+ void StartAction(); //Henkel Anzeigen und verstecken.
+ void EndAction(); //gerufen von ViewShell::ImplXXXAction
+
+#ifdef ACCESSIBLE_LAYOUT
+#endif
+
+public:
+ ~SwViewImp();
+ void Init( const SwViewOption * ); //nur fuer ViewShell::Init()
+
+ const ViewShell *GetShell() const { return pSh; }
+ ViewShell *GetShell() { return pSh; }
+
+
+ //Verwaltung zur ersten sichtbaren Seite
+ inline const SwPageFrm *GetFirstVisPage() const;
+ inline SwPageFrm *GetFirstVisPage();
+ void SetFirstVisPageInvalid() { bFirstPageInvalid = TRUE; }
+
+ //SS'en fuer Paint- und Scrollrects.
+ BOOL AddPaintRect( const SwRect &rRect );
+ void AddScrollRect( const SwFrm *pFrm, const SwRect &rRect, long nOffs );
+ SwRegionRects *GetRegion() { return pRegion; }
+ void DelRegions(); //Loescht Scroll- und PaintRects
+
+ //Handler fuer das Refresh von gescrollten Bereichen (Korrektur des
+ //Alignments). Ruft das Refresh mit der ScrolledArea.
+ //RefreshScrolledArea kann z.B. beim Setzen des Crsr genutzt werden, es
+ //wird nur der Anteil des Rect refreshed, der mit der ScrolledArea
+ //ueberlappt. Das 'reingereichte Rechteck wird veraendert!
+ void RestartScrollTimer() { aScrollTimer.Start(); }
+ DECL_LINK( RefreshScrolledHdl, Timer * );
+
+ //Wird vom Layout ggf. waehrend einer Action gerufen, wenn der
+ //Verdacht besteht, dass es etwas drunter und drueber geht.
+ void ResetScroll() { bScroll = FALSE; }
+
+ BOOL IsNextScroll() const { return bNextScroll; }
+ BOOL IsScroll() const { return bScroll; }
+ BOOL IsScrolled() const { return bScrolled; }
+
+ BOOL IsPaintInScroll() const { return bPaintInScroll; }
+
+ // neues Interface fuer StarView Drawing
+ inline BOOL HasDrawView() const { return 0 != pDrawView; }
+ SwDrawView* GetDrawView() { return pDrawView; }
+ const SwDrawView* GetDrawView() const { return pDrawView; }
+ SdrPageView*GetPageView() { return pSdrPageView; }
+ const SdrPageView*GetPageView() const { return pSdrPageView; }
+ void MakeDrawView();
+
+ // OD 29.08.2002 #102450#
+ // add 3rd parameter <const Color* pPageBackgrdColor> for setting this
+ // color as the background color at the outliner of the draw view
+ // for painting layers <hell> and <heaven>
+ // OD 09.12.2002 #103045# - add 4th parameter for the horizontal text
+ // direction of the page in order to set the default horizontal text
+ // direction at the outliner of the draw view for painting layers <hell>
+ // and <heaven>.
+ // OD 25.06.2003 #108784# - correct type of 1st parameter
+
+ //wird als Link an die DrawEngine uebergeben, entscheidet was wie
+ //gepaintet wird oder nicht.
+
+ // Interface Drawing
+ void NotifySizeChg( const Size &rNewSz );
+
+ //SS Fuer die Lay- bzw. IdleAction und verwandtes
+ BOOL IsAction() const { return pLayAct != 0; }
+ BOOL IsIdleAction() const { return pIdleAct != 0; }
+ SwLayAction &GetLayAction() { return *pLayAct; }
+ const SwLayAction &GetLayAction() const { return *pLayAct; }
+ SwLayIdle &GetIdleAction() { return *pIdleAct;}
+ const SwLayIdle &GetIdleAction() const { return *pIdleAct;}
+
+ //Wenn eine Aktion laueft wird diese gebeten zu pruefen ob es
+ //an der zeit ist den WaitCrsr einzuschalten.
+ void CheckWaitCrsr();
+ BOOL IsCalcLayoutProgress() const; //Fragt die LayAction wenn vorhanden.
+ //TRUE wenn eine LayAction laeuft, dort wird dann auch das Flag fuer
+ //ExpressionFields gesetzt.
+ BOOL IsUpdateExpFlds();
+
+ void SetRestoreActions(USHORT nSet){nRestoreActions = nSet;}
+ USHORT GetRestoreActions() const{return nRestoreActions;}
+
+ // OD 12.12.2002 #103492#
+
+ // OD 12.12.2002 #103492#
+
+#ifdef ACCESSIBLE_LAYOUT
+ // Is this view accessible?
+
+
+ // Update (this) accessible view
+
+ // Remove a frame from the accessible view
+ void DisposeAccessible( const SwFrm *pFrm, const SdrObject *pObj,
+ sal_Bool bRecursive );
+ inline void DisposeAccessibleObj( const SdrObject *pObj );
+
+ // Move a frame's position in the accessible view
+ void MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
+ const SwRect& rOldFrm );
+
+ // Add a frame in the accessible view
+
+ inline void AddAccessibleObj( const SdrObject *pObj );
+
+ // Invalidate accessible frame's frame's content
+ void InvalidateAccessibleFrmContent( const SwFrm *pFrm );
+
+ // Invalidate accessible frame's cursor position
+
+ // Invalidate editable state for all accessible frames
+
+ // Invalidate opaque state for all accessible frames
+
+ // Invalidate frame's relation set (for chained frames)
+
+ // update data for accessible preview
+ // OD 15.01.2003 #103492# - change method signature due to new page preview
+ // functionality
+
+
+ // Fire all accessible events that have been collected so far
+#endif
+};
+
+//Kann auf dem Stack angelegt werden, wenn etwas ausgegeben oder
+//gescrolled wird. Handles und sontiges vom Drawing werden im CTor
+//gehidet und im DTor wieder sichtbar gemacht.
+//AW 06-Sep99: Hiding of handles is no longer necessary, removed
+
+
+inline SwPageFrm *SwViewImp::GetFirstVisPage()
+{
+ if ( bFirstPageInvalid )
+ SetFirstVisPage();
+ return pFirstVisPage;
+}
+
+inline const SwPageFrm *SwViewImp::GetFirstVisPage() const
+{
+ if ( bFirstPageInvalid )
+ ((SwViewImp*)this)->SetFirstVisPage();
+ return pFirstVisPage;
+}
+
+#ifdef ACCESSIBLE_LAYOUT
+
+
+inline void SwViewImp::DisposeAccessibleObj( const SdrObject *pObj )
+{
+ DisposeAccessible( 0, pObj, sal_False );
+}
+
+
+
+inline void SwViewImp::AddAccessibleObj( const SdrObject *pObj )
+{
+ SwRect aEmptyRect;
+ MoveAccessible( 0, pObj, aEmptyRect );
+}
+
+#endif
+
+} //namespace binfilter
+#endif //_VIEWIMP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/visiturl.hxx b/binfilter/bf_sw/source/core/inc/visiturl.hxx
new file mode 100644
index 000000000000..ff0b4ab90e5f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/visiturl.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VISITURL_HXX
+#define _VISITURL_HXX
+
+
+
+
+#include <bf_svtools/lstner.hxx>
+namespace binfilter {
+class SwDoc;
+
+class SwURLStateChanged : public SfxListener
+{
+ const SwDoc* pDoc;
+public:
+ SwURLStateChanged( const SwDoc* pD );
+ virtual ~SwURLStateChanged();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+};
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/inc/wrong.hxx b/binfilter/bf_sw/source/core/inc/wrong.hxx
new file mode 100644
index 000000000000..0cddd5f2a386
--- /dev/null
+++ b/binfilter/bf_sw/source/core/inc/wrong.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _WRONG_HXX
+#define _WRONG_HXX
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_XUB_STRLEN
+#define _SVSTDARR_ULONGS
+#include <bf_svtools/svstdarr.hxx>
+#endif
+/*N*/ #include <tools/debug.hxx> //for stripping
+namespace binfilter {
+#define WRPOS( nIdx ) ((xub_StrLen)( GetObject( nIdx ) ))
+#define WRLEN( nIdx ) ((xub_StrLen)( aLen.GetObject( nIdx ) ))
+
+class SwWrongList : public SvXub_StrLens
+{
+ SvXub_StrLens aLen;
+ xub_StrLen nBeginInvalid; // Start des ungueltigen Bereichs
+ xub_StrLen nEndInvalid; // Ende des ungueltigen Bereichs
+ void ShiftLeft( xub_StrLen &rPos, xub_StrLen nStart, xub_StrLen nEnd )
+ { if( rPos > nStart ) rPos = rPos > nEnd ? rPos - nEnd + nStart : nStart; }
+ void ShiftRight( xub_StrLen &rPos, xub_StrLen nStart, xub_StrLen nEnd )
+ { if( rPos >= nStart ) rPos += nStart - nEnd; }
+ void _Invalidate( xub_StrLen nBegin, xub_StrLen nEnd );
+public:
+ inline SwWrongList() :
+ SvXub_StrLens(5,5), aLen(5,5), nBeginInvalid( STRING_LEN ){}
+ inline xub_StrLen GetBeginInv() const { return nBeginInvalid; }
+ inline xub_StrLen GetEndInv() const { return nEndInvalid; }
+ inline BOOL InsideInvalid( xub_StrLen nChk ) const
+ { return nChk >= nBeginInvalid && nChk <= nEndInvalid; }
+ inline void SetInvalid( xub_StrLen nBegin, xub_StrLen nEnd )
+ { nBeginInvalid = nBegin; nEndInvalid = nEnd; }
+ inline void Validate(){ nBeginInvalid = STRING_LEN; }
+ inline void Invalidate( xub_StrLen nBegin, xub_StrLen nEnd )
+ { if( STRING_LEN == GetBeginInv() ) SetInvalid( nBegin, nEnd );
+ else _Invalidate( nBegin, nEnd ); }
+ BOOL InvalidateWrong();
+ void Move( xub_StrLen nPos, long nDiff ){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 void Move( xub_StrLen nPos, long nDiff );
+
+ // Divide the list into two part, the wrong words until nSplitPos will be
+ // removed and transferred to a new SwWrongList.
+ // Join the next SwWrongList, nInsertPos is my own text length, where
+ // the other wrong list has to be inserted.
+
+ inline xub_StrLen Len( USHORT nIdx ) const { return WRLEN( nIdx ); }
+ inline xub_StrLen Pos( USHORT nIdx ) const { return WRPOS( nIdx ); }
+ inline void Insert( xub_StrLen nNewPos, xub_StrLen nNewLen, USHORT nWhere )
+ {SvXub_StrLens::Insert( nNewPos, nWhere ); aLen.Insert( nNewLen, nWhere );}
+
+// Wer braucht dies?
+ void Insert( ULONG nNew )
+ ;// { SvULongs::Insert( nNew, GetPos( (USHORT)( nNew & WRMASK ) ) ); }
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/layhelp.hxx b/binfilter/bf_sw/source/core/layout/layhelp.hxx
new file mode 100644
index 000000000000..6db28b653727
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/layhelp.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LAYHELP_HXX
+#define _LAYHELP_HXX
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_ULONGS
+#define _SVSTDARR_BYTES
+#define _SVSTDARR_XUB_STRLEN
+#include <bf_svtools/svstdarr.hxx>
+#endif
+#include <swrect.hxx>
+class SvStream;
+namespace binfilter {
+
+class SwDoc;
+class SwFrm;
+class SwLayoutFrm;
+class SwPageFrm;
+class SwFlyFrm;
+class SwSectionFrm;
+class SwSectionNode;
+class SwLayoutCache;
+
+
+/*************************************************************************
+ * class SwLayCacheImpl
+ * contains the page break information and the text frame positions
+ * of the document (after loading)
+ * and is used inside the constructor of the layout rootframe to
+ * insert content and text frames at the right pages.
+ * For every page of the main text (body content, no footnotes, text frames etc.)
+ * we have the nodeindex of the first content at the page,
+ * the type of content ( table or paragraph )
+ * and if it's not the first part of the table/paragraph,
+ * the row/character-offset inside the table/paragraph.
+ * The text frame positions are stored in the SwPageFlyCache array.
+ *************************************************************************/
+
+class SwFlyCache;
+typedef SwFlyCache* SwFlyCachePtr;
+SV_DECL_PTRARR_DEL( SwPageFlyCache, SwFlyCachePtr, 0, 4 )
+
+class SwLayCacheImpl : public SvULongs
+{
+ SvXub_StrLens aOffset;
+ SvUShorts aType;
+ SwPageFlyCache aFlyCache;
+ sal_Bool bUseFlyCache;
+ void Insert( USHORT nType, ULONG nIndex, xub_StrLen nOffset );
+
+public:
+ SwLayCacheImpl() : SvULongs( 20, 10 ), aOffset( 20, 10 ), aType( 20, 10 ) {}
+ BOOL Read( SvStream& rStream );
+
+ ULONG GetBreakIndex( USHORT nIdx ) const { return GetObject( nIdx ); }
+ xub_StrLen GetBreakOfst( USHORT nIdx ) const { return aOffset[ nIdx ]; }
+ USHORT GetBreakType( USHORT nIdx ) const { return aType[ nIdx ]; }
+
+ USHORT GetFlyCount() const { return aFlyCache.Count(); }
+ SwFlyCache *GetFlyCache( USHORT nIdx ) const { return aFlyCache[ nIdx ]; }
+
+ sal_Bool IsUseFlyCache() const { return bUseFlyCache; }
+};
+
+/*************************************************************************
+ * class SwActualSection
+ * helps to create the sectionframes during the _InsertCnt-function
+ * by controlling nested sections.
+ *************************************************************************/
+
+class SwActualSection
+{
+ SwActualSection *pUpper;
+ SwSectionFrm *pSectFrm;
+ SwSectionNode *pSectNode;
+public:
+ SwActualSection( SwActualSection *pUpper,
+ SwSectionFrm *pSect,
+ SwSectionNode *pNd );
+
+ SwSectionFrm *GetSectionFrm() { return pSectFrm; }
+ void SetSectionFrm( SwSectionFrm *p ) { pSectFrm = p; }
+ SwSectionNode *GetSectionNode() { return pSectNode;}
+ SwActualSection *GetUpper() { return pUpper; }
+};
+
+/*************************************************************************
+ * class SwLayHelper
+ * helps during the _InsertCnt-function to create new pages.
+ * If there's a layoutcache available, this information is used.
+ *************************************************************************/
+
+class SwLayHelper
+{
+ SwFrm* &rpFrm;
+ SwFrm* &rpPrv;
+ SwPageFrm* &rpPage;
+ SwLayoutFrm* &rpLay;
+ SwActualSection* &rpActualSection;
+ BOOL &rbBreakAfter;
+ SwDoc* pDoc;
+ SwLayCacheImpl* pImpl;
+ ULONG nMaxParaPerPage;
+ ULONG nParagraphCnt;
+ ULONG nStartOfContent;
+ USHORT nIndex; // the index in the page break array
+ USHORT nFlyIdx; // the index in the fly cache array
+ BOOL bFirst : 1;
+ void _CheckFlyCache( SwPageFrm* pPage );
+public:
+ SwLayHelper( SwDoc *pD, SwFrm* &rpF, SwFrm* &rpP, SwPageFrm* &rpPg,
+ SwLayoutFrm* &rpL, SwActualSection* &rpA, BOOL &rBrk,
+ ULONG nNodeIndex, BOOL bCache );
+ ~SwLayHelper();
+ ULONG CalcPageCount();
+ BOOL CheckInsert( ULONG nNodeIndex );
+
+ BOOL BreakPage( xub_StrLen& rOffs, ULONG nNodeIndex );
+ BOOL CheckInsertPage();
+
+ // Look for fresh text frames at this (new) page and set them to the right
+ // position, if they are in the fly cache.
+ void CheckFlyCache( SwPageFrm* pPage )
+ { if( pImpl && nFlyIdx < pImpl->GetFlyCount() ) _CheckFlyCache( pPage ); }
+
+ // Look for this text frame and set it to the right position,
+ // if it's in the fly cache.
+ static BOOL CheckPageFlyCache( SwPageFrm* &rpPage, SwFlyFrm* pFly );
+};
+
+/*************************************************************************
+ * class SwLayCacheIoImpl
+ * contains the data structures that are required to read and write a
+ * layout cache.
+ *************************************************************************/
+
+#define SW_LAYCACHE_IO_REC_PAGES 'p'
+#define SW_LAYCACHE_IO_REC_PARA 'P'
+#define SW_LAYCACHE_IO_REC_TABLE 'T'
+#define SW_LAYCACHE_IO_REC_FLY 'F'
+
+#define SW_LAYCACHE_IO_VERSION_MAJOR 1
+#define SW_LAYCACHE_IO_VERSION_MINOR 1
+
+class SwLayCacheIoImpl
+{
+ SvBytes aRecTypes;
+ SvULongs aRecSizes;
+
+ SvStream *pStream;
+
+ ULONG nFlagRecEnd;
+
+ USHORT nMajorVersion;
+ USHORT nMinorVersion;
+
+ BOOL bWriteMode : 1;
+ BOOL bError : 1;
+
+public:
+ SwLayCacheIoImpl( SvStream& rStrm, BOOL bWrtMd );
+
+ // Get input or output stream
+ SvStream& GetStream() const { return *pStream; }
+
+ // Open a record of type "nType"
+ BOOL OpenRec( BYTE nType );
+
+ // Close a record of type "nType". This skips any unread data that
+ // remains in the record.
+ BOOL CloseRec( BYTE nType );
+
+ // Return the number of bytes contained in the current record that
+ // haven't been read by now.
+ UINT32 BytesLeft();
+
+ // Return the current record's type
+ BYTE Peek();
+
+ // Skip the current record
+
+ // Open a flag record for reading. The uppermost four bits are flags,
+ // while the lowermost are the flag record's size. Flag records cannot
+ // be nested.
+ BYTE OpenFlagRec();
+
+ // Open flag record for writing;
+ void OpenFlagRec( BYTE nFlags, BYTE nLen );
+
+ // Close a flag record. Any bytes left are skipped.
+ void CloseFlagRec();
+
+ BOOL HasError() const { return bError; }
+
+ USHORT GetMajorVersion() const { return nMajorVersion; }
+ USHORT GetMinorVersion() const { return nMinorVersion; }
+};
+
+// Stored information about text frames:
+class SwFlyCache : public SwRect // position and size
+{
+public:
+ ULONG nOrdNum; // Id to recognize text frames
+ USHORT nPageNum; // page number
+ SwFlyCache( USHORT nP, ULONG nO, long nX, long nY, long nW, long nH ) :
+ SwRect( nX, nY, nW, nH ), nOrdNum( nO ), nPageNum( nP ){}
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/makefile.mk b/binfilter/bf_sw/source/core/layout/makefile.mk
new file mode 100644
index 000000000000..6836c8fcde05
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/makefile.mk
@@ -0,0 +1,135 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_layout
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+
+.IF "$(mydebug)" != ""
+CDEFS+=-Dmydebug
+.ENDIF
+
+.IF "$(madebug)" != ""
+CDEFS+=-DDEBUG
+.ENDIF
+
+# "Querdarstellung des Dokumentes"
+# CDEFS=$(CDEFS) -DQUER
+
+# CDEFS=$(CDEFS) -DPAGE
+
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_atrfrm.cxx \
+ sw_calcmove.cxx \
+ sw_colfrm.cxx \
+ sw_findfrm.cxx \
+ sw_flowfrm.cxx \
+ sw_fly.cxx \
+ sw_flycnt.cxx \
+ sw_flyincnt.cxx \
+ sw_flylay.cxx \
+ sw_flypos.cxx \
+ sw_frmtool.cxx \
+ sw_ftnfrm.cxx \
+ sw_hffrm.cxx \
+ sw_layact.cxx \
+ sw_laycache.cxx \
+ sw_layouter.cxx \
+ sw_newfrm.cxx \
+ sw_pagechg.cxx \
+ sw_pagedesc.cxx \
+ sw_pageiter.cxx \
+ sw_paintfrm.cxx \
+ sw_sectfrm.cxx \
+ sw_ssfrm.cxx \
+ sw_tabfrm.cxx \
+ sw_trvlfrm.cxx \
+ sw_unusedf.cxx \
+ sw_wsfrm.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/sw_atrfrm.obj \
+ $(SLO)$/sw_calcmove.obj \
+ $(SLO)$/sw_colfrm.obj \
+ $(SLO)$/sw_findfrm.obj \
+ $(SLO)$/sw_flowfrm.obj \
+ $(SLO)$/sw_fly.obj \
+ $(SLO)$/sw_flycnt.obj \
+ $(SLO)$/sw_flyincnt.obj \
+ $(SLO)$/sw_flylay.obj \
+ $(SLO)$/sw_flypos.obj \
+ $(SLO)$/sw_frmtool.obj \
+ $(SLO)$/sw_ftnfrm.obj \
+ $(SLO)$/sw_hffrm.obj \
+ $(SLO)$/sw_layact.obj \
+ $(SLO)$/sw_laycache.obj \
+ $(SLO)$/sw_layouter.obj \
+ $(SLO)$/sw_newfrm.obj \
+ $(SLO)$/sw_pagechg.obj \
+ $(SLO)$/sw_pagedesc.obj \
+ $(SLO)$/sw_pageiter.obj \
+ $(SLO)$/sw_paintfrm.obj \
+ $(SLO)$/sw_sectfrm.obj \
+ $(SLO)$/sw_ssfrm.obj \
+ $(SLO)$/sw_tabfrm.obj \
+ $(SLO)$/sw_trvlfrm.obj \
+ $(SLO)$/sw_unusedf.obj \
+ $(SLO)$/sw_wsfrm.obj
+
+.IF "$(dbgutil)"!=""
+CXXFILES += \
+ sw_dbg_lay.cxx
+SLOFILES += \
+ $(SLO)$/sw_dbg_lay.obj
+.ENDIF
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/layout/sw_atrfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_atrfrm.cxx
new file mode 100644
index 000000000000..9fb5fec638fc
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_atrfrm.cxx
@@ -0,0 +1,2716 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/text/TextGridMode.hpp>
+#include <bf_svtools/unoimap.hxx>
+#include <bf_svtools/imap.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+
+#include <unosett.hxx>
+#include <fmtclds.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <fmthdft.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfordr.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtanchr.hxx>
+#include <fmtlsplt.hxx>
+#include <fmtftntx.hxx>
+#include <fmteiro.hxx>
+#include <fmturl.hxx>
+#include <fmtcnct.hxx>
+#include <section.hxx>
+#include <fmtline.hxx>
+#include <tgrditem.hxx>
+#include <hfspacingitem.hxx>
+#include <doc.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <cntfrm.hxx>
+#include <crsrsh.hxx>
+#include <dflyobj.hxx>
+#include <dcontact.hxx>
+#include <frmtool.hxx>
+#include <hints.hxx>
+#include <flyfrms.hxx>
+#include <pagedesc.hxx>
+#include <docary.hxx>
+#include <node2lay.hxx>
+#include <fmtclbl.hxx>
+#include <swunohelper.hxx>
+#include <unocoll.hxx>
+#include <unoframe.hxx>
+#include <SwStyleNameMapper.hxx>
+/// OD 22.08.2002 #99657#
+/// include definition of class SvxBrushItem and GraphicObject
+/// in order to determine, if background is transparent.
+#include <bf_svx/brshitem.hxx>
+#include <bf_goodies/graphicobject.hxx>
+
+#include <cmdid.h>
+#include <unomid.h>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+
+using rtl::OUString;
+
+SV_IMPL_PTRARR(SwColumns,SwColumn*)
+
+TYPEINIT1(SwFrmFmt, SwFmt ); //rtti fuer SwFrmFmt
+TYPEINIT1(SwFlyFrmFmt, SwFrmFmt);
+TYPEINIT1(SwDrawFrmFmt, SwFrmFmt);
+TYPEINIT1(SwFmtVertOrient, SfxPoolItem);
+TYPEINIT1(SwFmtHoriOrient, SfxPoolItem);
+TYPEINIT2(SwFmtHeader, SfxPoolItem, SwClient );
+TYPEINIT2(SwFmtFooter, SfxPoolItem, SwClient );
+TYPEINIT2(SwFmtPageDesc, SfxPoolItem, SwClient );
+TYPEINIT1_AUTOFACTORY(SwFmtLineNumber, SfxPoolItem);
+
+/* -----------------19.05.98 09:26-------------------
+ * Umwandlung fuer QueryValue
+ * --------------------------------------------------*/
+sal_Int16 lcl_RelToINT(SwRelationOrient eRelation)
+{
+ sal_Int16 nRet = text::RelOrientation::FRAME;
+ switch(eRelation)
+ {
+ case PRTAREA: nRet = text::RelOrientation::PRINT_AREA; break;
+ case REL_CHAR: nRet = text::RelOrientation::CHAR; break;
+ case REL_PG_LEFT: nRet = text::RelOrientation::PAGE_LEFT; break;
+ case REL_PG_RIGHT: nRet = text::RelOrientation::PAGE_RIGHT; break;
+ case REL_FRM_LEFT: nRet = text::RelOrientation::FRAME_LEFT; break;
+ case REL_FRM_RIGHT: nRet = text::RelOrientation::FRAME_RIGHT; break;
+ case REL_PG_FRAME: nRet = text::RelOrientation::PAGE_FRAME; break;
+ case REL_PG_PRTAREA: nRet = text::RelOrientation::PAGE_PRINT_AREA; break;
+ }
+ return nRet;
+}
+SwRelationOrient lcl_IntToRelation(const uno::Any& rVal)
+{
+ SwRelationOrient eRet = FRAME;
+ sal_Int16 nVal;
+ rVal >>= nVal;
+ switch(nVal)
+ {
+ case text::RelOrientation::PRINT_AREA: eRet = PRTAREA ; break;
+ case text::RelOrientation::CHAR: eRet = REL_CHAR ; break;
+ case text::RelOrientation::PAGE_LEFT: eRet = REL_PG_LEFT ; break;
+ case text::RelOrientation::PAGE_RIGHT: eRet = REL_PG_RIGHT ; break;
+ case text::RelOrientation::FRAME_LEFT: eRet = REL_FRM_LEFT ; break;
+ case text::RelOrientation::FRAME_RIGHT: eRet = REL_FRM_RIGHT ; break;
+ case text::RelOrientation::PAGE_FRAME: eRet = REL_PG_FRAME ; break;
+ case text::RelOrientation::PAGE_PRINT_AREA: eRet = REL_PG_PRTAREA ; break;
+ }
+ return eRet;
+}
+
+void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt )
+{
+ //Wenn der Client der letzte ist der das Format benutzt, so muss dieses
+ //vernichtet werden. Zuvor muss jedoch ggf. die Inhaltssection vernichtet
+ //werden.
+ SwDoc* pDoc = pFmt->GetDoc();
+ pFmt->Remove( pToRemove );
+ if( pDoc->IsInDtor() )
+ {
+ delete pFmt;
+ return;
+ }
+
+ //Nur noch Frms angemeldet?
+ sal_Bool bDel = sal_True;
+ {
+ // Klammer, weil im DTOR SwClientIter das Flag bTreeChg zurueck
+ // gesetzt wird. Unguenstig, wenn das Format vorher zerstoert wird.
+ SwClientIter aIter( *pFmt );
+ SwClient *pLast = aIter.GoStart();
+ if( pLast )
+ do {
+ bDel = pLast->IsA( TYPE(SwFrm) )|| pLast->IsA(TYPE(SwXHeadFootText));
+ } while( bDel && 0 != ( pLast = aIter++ ));
+ }
+
+ if ( bDel )
+ {
+ //Wenn in einem der Nodes noch ein Crsr angemeldet ist, muss das
+ //ParkCrsr einer (beliebigen) Shell gerufen werden.
+ SwFmtCntnt& rCnt = (SwFmtCntnt&)pFmt->GetCntnt();
+ if ( rCnt.GetCntntIdx() )
+ {
+ SwNode *pNode = 0;
+ {
+ SwNodeIndex aIdx( *rCnt.GetCntntIdx(), 1 );
+ //Wenn in einem der Nodes noch ein Crsr angemeldet ist, muss das
+ //ParkCrsr einer (beliebigen) Shell gerufen werden.
+ pNode = pDoc->GetNodes()[ aIdx ];
+ sal_uInt32 nEnd = pNode->EndOfSectionIndex();
+ while ( aIdx < nEnd )
+ {
+ if ( pNode->IsCntntNode() &&
+ ((SwCntntNode*)pNode)->GetDepends() )
+ {
+ SwClientIter aIter( *(SwCntntNode*)pNode );
+ do
+ {
+ if( aIter()->ISA( SwCrsrShell ) )
+ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ((SwCrsrShell*)aIter())->ParkCrsr( aIdx );
+ }
+ } while ( aIter++ );
+ }
+ aIdx++;
+ pNode = pDoc->GetNodes()[ aIdx ];
+ }
+ }
+ rCnt.SetNewCntntIdx( (const SwNodeIndex*)0 );
+
+ // beim Loeschen von Header/Footer-Formaten IMMER das Undo
+ // abschalten! (Bug 31069)
+
+ ASSERT( pNode, "Ein grosses Problem." );
+ pDoc->DeleteSection( pNode );
+
+ }
+ delete pFmt;
+ }
+}
+
+// class SwFmtFrmSize
+// Implementierung teilweise inline im hxx
+
+SwFmtFrmSize::SwFmtFrmSize( SwFrmSize eSize, SwTwips nWidth, SwTwips nHeight )
+ : SfxPoolItem( RES_FRM_SIZE ),
+ aSize( nWidth, nHeight ),
+ eFrmSize( eSize )
+{
+ nWidthPercent = nHeightPercent = 0;
+}
+
+SwFmtFrmSize& SwFmtFrmSize::operator=( const SwFmtFrmSize& rCpy )
+{
+ aSize = rCpy.GetSize();
+ eFrmSize = rCpy.GetSizeType();
+ nHeightPercent = rCpy.GetHeightPercent();
+ nWidthPercent = rCpy.GetWidthPercent();
+ return *this;
+}
+
+int SwFmtFrmSize::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return( eFrmSize == ((SwFmtFrmSize&)rAttr).eFrmSize &&
+ aSize == ((SwFmtFrmSize&)rAttr).GetSize()&&
+ nWidthPercent == ((SwFmtFrmSize&)rAttr).GetWidthPercent() &&
+ nHeightPercent == ((SwFmtFrmSize&)rAttr).GetHeightPercent() );
+}
+
+SfxPoolItem* SwFmtFrmSize::Clone( SfxItemPool* ) const
+{
+ return new SwFmtFrmSize( *this );
+}
+
+
+/* -----------------24.04.98 11:36-------------------
+ *
+ * --------------------------------------------------*/
+bool SwFmtFrmSize::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case MID_FRMSIZE_SIZE:
+ {
+ awt::Size aTmp;
+ aTmp.Height = TWIP_TO_MM100(aSize.Height());
+ aTmp.Width = TWIP_TO_MM100(aSize.Width());
+ rVal.setValue(&aTmp, ::getCppuType((const awt::Size*)0));
+ }
+ break;
+ case MID_FRMSIZE_REL_HEIGHT:
+ rVal <<= (sal_Int16)(GetHeightPercent() != 0xFF ? GetHeightPercent() : 0);
+ break;
+ case MID_FRMSIZE_REL_WIDTH:
+ rVal <<= (sal_Int16)(GetWidthPercent() != 0xFF ? GetWidthPercent() : 0);
+ break;
+ case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH:
+ {
+ BOOL bTmp = 0xFF == GetHeightPercent();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT:
+ {
+ BOOL bTmp = 0xFF == GetWidthPercent();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ case MID_FRMSIZE_WIDTH :
+ rVal <<= (sal_Int32)TWIP_TO_MM100(aSize.Width());
+ break;
+ case MID_FRMSIZE_HEIGHT:
+ // #95848# returned size should never be zero.
+ // (there was a bug that allowed for setting height to 0.
+ // Thus there some documents existing with that not allowed
+ // attribut value which may cause problems on import.)
+ rVal <<= (sal_Int32)TWIP_TO_MM100(aSize.Height() < MINLAY ? MINLAY : aSize.Height() );
+ break;
+ case MID_FRMSIZE_SIZE_TYPE:
+ rVal <<= (sal_Int16)GetSizeType();
+ break;
+ case MID_FRMSIZE_IS_AUTO_HEIGHT:
+ {
+ BOOL bTmp = ATT_FIX_SIZE != GetSizeType();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ }
+ return true;
+}
+
+/* -----------------24.04.98 11:36-------------------
+ *
+ * --------------------------------------------------*/
+bool SwFmtFrmSize::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ sal_Bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_FRMSIZE_SIZE:
+ {
+ awt::Size aVal;
+ if(!(rVal >>= aVal))
+ bRet = false;
+ else
+ {
+ Size aTmp(aVal.Width, aVal.Height);
+ if(bConvert)
+ {
+ aTmp.Height() = MM100_TO_TWIP(aTmp.Height());
+ aTmp.Width() = MM100_TO_TWIP(aTmp.Width());
+ }
+ if(aTmp.Height() && aTmp.Width())
+ aSize = aTmp;
+ else
+ bRet = false;
+ }
+ }
+ break;
+ case MID_FRMSIZE_REL_HEIGHT:
+ {
+ sal_Int16 nSet;
+ rVal >>= nSet;
+ if(nSet >= 0 && nSet <= 0xfe)
+ SetHeightPercent((BYTE)nSet);
+ else
+ bRet = false;
+ }
+ break;
+ case MID_FRMSIZE_REL_WIDTH:
+ {
+ sal_Int16 nSet;
+ rVal >>= nSet;
+ if(nSet >= 0 && nSet <= 0xfe)
+ SetWidthPercent((BYTE)nSet);
+ else
+ bRet = false;
+ }
+ break;
+ case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH:
+ {
+ sal_Bool bSet = *(sal_Bool*)rVal.getValue();
+ if(bSet)
+ SetHeightPercent(0xff);
+ else if( 0xff == GetHeightPercent() )
+ SetHeightPercent( 0 );
+ }
+ break;
+ case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT:
+ {
+ sal_Bool bSet = *(sal_Bool*)rVal.getValue();
+ if(bSet)
+ SetWidthPercent(0xff);
+ else if( 0xff == GetWidthPercent() )
+ SetWidthPercent(0);
+ }
+ break;
+ case MID_FRMSIZE_WIDTH :
+ {
+ sal_Int32 nWd;
+ if(rVal >>= nWd)
+ {
+ if(bConvert)
+ nWd = MM100_TO_TWIP(nWd);
+ if(nWd > 0)
+ aSize.Width() = nWd;
+ else
+ bRet = false;
+ }
+ else
+ bRet = false;
+ }
+ break;
+ case MID_FRMSIZE_HEIGHT:
+ {
+ sal_Int32 nHg;
+ if(rVal >>= nHg)
+ {
+ if(bConvert)
+ nHg = MM100_TO_TWIP(nHg);
+ if(nHg > 0)
+ aSize.Height() = nHg;
+ else
+ bRet = false;
+ }
+ else
+ bRet = false;
+ }
+ break;
+ case MID_FRMSIZE_SIZE_TYPE:
+ {
+ sal_Int16 nType;
+ if((rVal >>= nType) && nType >= 0 && nType <= ATT_MIN_SIZE )
+ {
+ SetSizeType((SwFrmSize)nType);
+ }
+ else
+ bRet = false;
+ }
+ break;
+ case MID_FRMSIZE_IS_AUTO_HEIGHT:
+ {
+ sal_Bool bSet = *(sal_Bool*)rVal.getValue();
+ SetSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
+ }
+ break;
+ default:
+ bRet = false;
+ }
+ return bRet;
+}
+
+Size SwFmtFrmSize::GetSizeConvertedToSw31(
+ const SvxLRSpaceItem *pLRSpace,
+ const SvxULSpaceItem *pULSpace ) const
+{
+ // Sw4.0: Groesse enthaelt keine Raender
+ // Sw3.x: Groesse enthaelt Raender
+ // ==> Raender addieren
+ Size aNewSize = GetSize();
+ if( pLRSpace )
+ {
+ aNewSize.Width() += pLRSpace->GetLeft();
+ aNewSize.Width() += pLRSpace->GetRight();
+ }
+ if( pULSpace )
+ {
+ aNewSize.Height() += pULSpace->GetUpper();
+ aNewSize.Height() += pULSpace->GetLower();
+ }
+ return aNewSize;
+}
+
+Size SwFmtFrmSize::GetSizeConvertedFromSw31(
+ const SvxLRSpaceItem *pLRSpace,
+ const SvxULSpaceItem *pULSpace ) const
+{
+ // Sw4.0: Groesse enthaelt keine Raender
+ // Sw3.x: Groesse enthaelt Raender
+ // ==> Raender subtrahieren
+ Size aNewSize = GetSize();
+ if( pLRSpace )
+ {
+ aNewSize.Width() -= pLRSpace->GetLeft();
+ aNewSize.Width() -= pLRSpace->GetRight();
+ }
+ if( pULSpace )
+ {
+ aNewSize.Height() -= pULSpace->GetUpper();
+ aNewSize.Height() -= pULSpace->GetLower();
+ }
+ return aNewSize;
+}
+
+
+// class SwFmtFillOrder
+// Implementierung teilweise inline im hxx
+
+SwFmtFillOrder::SwFmtFillOrder( SwFillOrder nFO )
+ : SfxEnumItem( RES_FILL_ORDER, sal_uInt16(nFO) )
+{}
+
+SfxPoolItem* SwFmtFillOrder::Clone( SfxItemPool* ) const
+{
+ return new SwFmtFillOrder( GetFillOrder() );
+}
+
+
+// class SwFmtHeader
+// Implementierung teilweise inline im hxx
+
+SwFmtHeader::SwFmtHeader( SwFrmFmt *pHeaderFmt )
+ : SfxPoolItem( RES_HEADER ),
+ SwClient( pHeaderFmt ),
+ bActive( pHeaderFmt ? sal_True : sal_False )
+{
+}
+
+SwFmtHeader::SwFmtHeader( const SwFmtHeader &rCpy )
+ : SfxPoolItem( RES_HEADER ),
+ SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
+ bActive( rCpy.IsActive() )
+{
+}
+
+SwFmtHeader::SwFmtHeader( sal_Bool bOn )
+ : SfxPoolItem( RES_HEADER ),
+ SwClient( 0 ),
+ bActive( bOn )
+{
+}
+
+SwFmtHeader::~SwFmtHeader()
+{
+ if ( GetHeaderFmt() )
+ DelHFFormat( this, GetHeaderFmt() );
+}
+
+int SwFmtHeader::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return ( pRegisteredIn == ((SwFmtHeader&)rAttr).GetRegisteredIn() &&
+ bActive == ((SwFmtHeader&)rAttr).IsActive() );
+}
+
+SfxPoolItem* SwFmtHeader::Clone( SfxItemPool* ) const
+{
+ return new SwFmtHeader( *this );
+}
+
+// class SwFmtFooter
+// Implementierung teilweise inline im hxx
+
+SwFmtFooter::SwFmtFooter( SwFrmFmt *pFooterFmt )
+ : SfxPoolItem( RES_FOOTER ),
+ SwClient( pFooterFmt ),
+ bActive( pFooterFmt ? sal_True : sal_False )
+{
+}
+
+SwFmtFooter::SwFmtFooter( const SwFmtFooter &rCpy )
+ : SfxPoolItem( RES_FOOTER ),
+ SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
+ bActive( rCpy.IsActive() )
+{
+}
+
+SwFmtFooter::SwFmtFooter( sal_Bool bOn )
+ : SfxPoolItem( RES_FOOTER ),
+ SwClient( 0 ),
+ bActive( bOn )
+{
+}
+
+SwFmtFooter::~SwFmtFooter()
+{
+ if ( GetFooterFmt() )
+ DelHFFormat( this, GetFooterFmt() );
+}
+
+int SwFmtFooter::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return ( pRegisteredIn == ((SwFmtFooter&)rAttr).GetRegisteredIn() &&
+ bActive == ((SwFmtFooter&)rAttr).IsActive() );
+}
+
+SfxPoolItem* SwFmtFooter::Clone( SfxItemPool* ) const
+{
+ return new SwFmtFooter( *this );
+}
+
+// class SwFmtCntnt
+// Implementierung teilweise inline im hxx
+
+SwFmtCntnt::SwFmtCntnt( const SwFmtCntnt &rCpy )
+ : SfxPoolItem( RES_CNTNT )
+{
+ pStartNode = rCpy.GetCntntIdx() ?
+ new SwNodeIndex( *rCpy.GetCntntIdx() ) : 0;
+}
+
+SwFmtCntnt::SwFmtCntnt( const SwStartNode *pStartNd )
+ : SfxPoolItem( RES_CNTNT )
+{
+ pStartNode = pStartNd ? new SwNodeIndex( *pStartNd ) : 0;
+}
+
+SwFmtCntnt::~SwFmtCntnt()
+{
+ delete pStartNode;
+}
+
+void SwFmtCntnt::SetNewCntntIdx( const SwNodeIndex *pIdx )
+{
+ delete pStartNode;
+ pStartNode = pIdx ? new SwNodeIndex( *pIdx ) : 0;
+}
+
+int SwFmtCntnt::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ if( (long)pStartNode ^ (long)((SwFmtCntnt&)rAttr).pStartNode )
+ return 0;
+ if( pStartNode )
+ return ( *pStartNode == *((SwFmtCntnt&)rAttr).GetCntntIdx() );
+ return 1;
+}
+
+SfxPoolItem* SwFmtCntnt::Clone( SfxItemPool* ) const
+{
+ return new SwFmtCntnt( *this );
+}
+
+// class SwFmtPageDesc
+// Implementierung teilweise inline im hxx
+
+SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy )
+ : SfxPoolItem( RES_PAGEDESC ),
+ SwClient( (SwPageDesc*)rCpy.GetPageDesc() ),
+ pDefinedIn( 0 ),
+ nNumOffset( rCpy.nNumOffset ),
+ nDescNameIdx( rCpy.nDescNameIdx )
+{
+}
+
+SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc )
+ : SfxPoolItem( RES_PAGEDESC ),
+ SwClient( (SwPageDesc*)pDesc ),
+ pDefinedIn( 0 ),
+ nNumOffset( 0 ),
+ nDescNameIdx( 0xFFFF ) // IDX_NO_VALUE
+{
+}
+
+SwFmtPageDesc::~SwFmtPageDesc() {}
+
+int SwFmtPageDesc::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return ( pDefinedIn == ((SwFmtPageDesc&)rAttr).pDefinedIn ) &&
+ ( nNumOffset == ((SwFmtPageDesc&)rAttr).nNumOffset ) &&
+ ( GetPageDesc() == ((SwFmtPageDesc&)rAttr).GetPageDesc() );
+}
+
+SfxPoolItem* SwFmtPageDesc::Clone( SfxItemPool* ) const
+{
+ return new SwFmtPageDesc( *this );
+}
+
+void SwFmtPageDesc::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+{
+ if( !pDefinedIn )
+ return;
+
+ sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+ switch( nWhich )
+ {
+ case RES_OBJECTDYING:
+ //Der Pagedesc, bei dem ich angemeldet bin stirbt, ich trage
+ //mich also bei meinem Format aus.
+ //Dabei werden ich Deletet!!!
+ if( IS_TYPE( SwFmt, pDefinedIn ))
+#ifdef DBG_UTIL
+ {
+ sal_Bool bDel = ((SwFmt*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
+ ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." );
+ }
+#else
+ ((SwFmt*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
+#endif
+ else if( IS_TYPE( SwCntntNode, pDefinedIn ))
+#ifdef DBG_UTIL
+ {
+ sal_Bool bDel = ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
+ ASSERT( bDel, ";-) FmtPageDesc nicht zerstoert." );
+ }
+#else
+ ((SwCntntNode*)pDefinedIn)->ResetAttr( RES_PAGEDESC );
+#endif
+ break;
+
+ default:
+ /* do nothing */;
+ }
+}
+
+bool SwFmtPageDesc::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_PAGEDESC_PAGENUMOFFSET:
+ rVal <<= (sal_Int16)GetNumOffset();
+ break;
+
+ case MID_PAGEDESC_PAGEDESCNAME:
+ {
+ const SwPageDesc* pDesc = GetPageDesc();
+ if( pDesc )
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(pDesc->GetName(), aString, GET_POOLID_PAGEDESC, sal_True );
+ rVal <<= OUString( aString );
+ }
+ else
+ rVal.clear();
+ }
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+bool SwFmtPageDesc::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_PAGEDESC_PAGENUMOFFSET:
+ {
+ sal_Int16 nOffset;
+ if(rVal >>= nOffset)
+ SetNumOffset( nOffset );
+ else
+ bRet = false;
+ }
+ break;
+
+ case MID_PAGEDESC_PAGEDESCNAME:
+ /* geht nicht, weil das Attribut eigentlich nicht den Namen
+ * sondern einen Pointer auf den PageDesc braucht (ist Client davon).
+ * Der Pointer waere aber ueber den Namen nur vom Dokument zu erfragen.
+ */
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+
+// class SwFmtCol
+// Implementierung teilweise inline im hxx
+
+SwColumn::SwColumn() :
+ nUpper( 0 ),
+ nLower( 0 ),
+ nLeft ( 0 ),
+ nRight( 0 ),
+ nWish ( 0 )
+{
+}
+
+sal_Bool SwColumn::operator==( const SwColumn &rCmp )
+{
+ return (nWish == rCmp.GetWishWidth() &&
+ GetLeft() == rCmp.GetLeft() &&
+ GetRight() == rCmp.GetRight() &&
+ GetUpper() == rCmp.GetUpper() &&
+ GetLower() == rCmp.GetLower()) ? sal_True : sal_False;
+}
+
+SwFmtCol::SwFmtCol( const SwFmtCol& rCpy )
+ : SfxPoolItem( RES_COL ),
+ nLineWidth( rCpy.nLineWidth),
+ aLineColor( rCpy.aLineColor),
+ nLineHeight( rCpy.GetLineHeight() ),
+ eAdj( rCpy.GetLineAdj() ),
+ nWidth( rCpy.GetWishWidth() ),
+ bOrtho( rCpy.IsOrtho() ),
+ aColumns( (sal_Int8)rCpy.GetNumCols(), 1 )
+{
+ for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
+ {
+ SwColumn *pCol = new SwColumn( *rCpy.GetColumns()[i] );
+ aColumns.Insert( pCol, aColumns.Count() );
+ }
+}
+
+SwFmtCol::~SwFmtCol() {}
+
+SwFmtCol& SwFmtCol::operator=( const SwFmtCol& rCpy )
+{
+ nLineWidth = rCpy.nLineWidth;
+ aLineColor = rCpy.aLineColor;
+ nLineHeight = rCpy.GetLineHeight();
+ eAdj = rCpy.GetLineAdj();
+ nWidth = rCpy.GetWishWidth();
+ bOrtho = rCpy.IsOrtho();
+
+ if ( aColumns.Count() )
+ aColumns.DeleteAndDestroy( 0, aColumns.Count() );
+ for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
+ {
+ SwColumn *pCol = new SwColumn( *rCpy.GetColumns()[i] );
+ aColumns.Insert( pCol, aColumns.Count() );
+ }
+ return *this;
+}
+
+SwFmtCol::SwFmtCol()
+ : SfxPoolItem( RES_COL ),
+ nLineHeight( 100 ),
+ eAdj( COLADJ_NONE ),
+ nWidth( USHRT_MAX ),
+ bOrtho( sal_True ),
+ nLineWidth(0)
+{
+}
+
+int SwFmtCol::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ const SwFmtCol &rCmp = (const SwFmtCol&)rAttr;
+ if( !(nLineWidth == rCmp.nLineWidth &&
+ aLineColor == rCmp.aLineColor &&
+ nLineHeight == rCmp.GetLineHeight() &&
+ eAdj == rCmp.GetLineAdj() &&
+ nWidth == rCmp.GetWishWidth() &&
+ bOrtho == rCmp.IsOrtho() &&
+ aColumns.Count() == rCmp.GetNumCols()) )
+ return 0;
+
+ for ( sal_uInt16 i = 0; i < aColumns.Count(); ++i )
+ if ( !(*aColumns[i] == *rCmp.GetColumns()[i]) )
+ return 0;
+
+ return 1;
+}
+
+SfxPoolItem* SwFmtCol::Clone( SfxItemPool* ) const
+{
+ return new SwFmtCol( *this );
+}
+
+sal_uInt16 SwFmtCol::GetGutterWidth( sal_Bool bMin ) const
+{
+ sal_uInt16 nRet = 0;
+ if ( aColumns.Count() == 2 )
+ nRet = aColumns[0]->GetRight() + aColumns[1]->GetLeft();
+ else if ( aColumns.Count() > 2 )
+ {
+ sal_Bool bSet = sal_False;
+ for ( sal_uInt16 i = 1; i < aColumns.Count()-1; ++i )
+ {
+ const sal_uInt16 nTmp = aColumns[i]->GetRight() + aColumns[i+1]->GetLeft();
+ if ( bSet )
+ {
+ if ( nTmp != nRet )
+ {
+ if ( !bMin )
+ return USHRT_MAX;
+ if ( nRet > nTmp )
+ nRet = nTmp;
+ }
+ }
+ else
+ { bSet = sal_True;
+ nRet = nTmp;
+ }
+ }
+ }
+ return nRet;
+}
+
+
+void SwFmtCol::Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct )
+{
+ //Loeschen scheint hier auf den erste Blick vielleicht etwas zu heftig;
+ //anderfalls muessten allerdings alle Werte der verbleibenden SwColumn's
+ //initialisiert werden.
+ if ( aColumns.Count() )
+ aColumns.DeleteAndDestroy( 0, aColumns.Count() );
+ for ( sal_uInt16 i = 0; i < nNumCols; ++i )
+ { SwColumn *pCol = new SwColumn;
+ aColumns.Insert( pCol, i );
+ }
+ bOrtho = sal_True;
+ nWidth = USHRT_MAX;
+ if( nNumCols )
+ Calc( nGutterWidth, nAct );
+}
+
+
+sal_uInt16 SwFmtCol::CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const
+{
+ ASSERT( nCol < aColumns.Count(), ":-( ColumnsArr ueberindiziert." );
+ if ( nWidth != nAct )
+ {
+ long nW = aColumns[nCol]->GetWishWidth();
+ nW *= nAct;
+ nW /= nWidth;
+ return sal_uInt16(nW);
+ }
+ else
+ return aColumns[nCol]->GetWishWidth();
+}
+
+
+void SwFmtCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct )
+{
+ //Erstmal die Spalten mit der Aktuellen Breite einstellen, dann die
+ //Wunschbreite der Spalten anhand der Gesamtwunschbreite hochrechnen.
+
+ const sal_uInt16 nGutterHalf = nGutterWidth ? nGutterWidth / 2 : 0;
+
+ //Breite der PrtAreas ist Gesamtbreite - Zwischenraeume / Anzahl
+ const sal_uInt16 nPrtWidth =
+ (nAct - ((GetNumCols()-1) * nGutterWidth)) / GetNumCols();
+ sal_uInt16 nAvail = nAct;
+
+ //Die erste Spalte ist PrtBreite + (Zwischenraumbreite/2)
+ const sal_uInt16 nLeftWidth = nPrtWidth + nGutterHalf;
+ SwColumn *pCol = aColumns[0];
+ pCol->SetWishWidth( nLeftWidth );
+ pCol->SetRight( nGutterHalf );
+ pCol->SetLeft ( 0 );
+ nAvail -= nLeftWidth;
+
+ //Spalte 2 bis n-1 ist PrtBreite + Zwischenraumbreite
+ const sal_uInt16 nMidWidth = nPrtWidth + nGutterWidth;
+ sal_uInt16 i; for ( i = 1; i < GetNumCols()-1; ++i )
+ {
+ pCol = aColumns[i];
+ pCol->SetWishWidth( nMidWidth );
+ pCol->SetLeft ( nGutterHalf );
+ pCol->SetRight( nGutterHalf );
+ nAvail -= nMidWidth;
+ }
+
+ //Die Letzte Spalte entspricht wieder der ersten, um Rundungsfehler
+ //auszugleichen wird der letzten Spalte alles zugeschlagen was die
+ //anderen nicht verbraucht haben.
+ pCol = aColumns[aColumns.Count()-1];
+ pCol->SetWishWidth( nAvail );
+ pCol->SetLeft ( nGutterHalf );
+ pCol->SetRight( 0 );
+
+ //Umrechnen der aktuellen Breiten in Wunschbreiten.
+ for ( i = 0; i < aColumns.Count(); ++i )
+ {
+ pCol = aColumns[i];
+ long nTmp = pCol->GetWishWidth();
+ nTmp *= GetWishWidth();
+ nTmp /= nAct;
+ pCol->SetWishWidth( sal_uInt16(nTmp) );
+ }
+}
+
+bool SwFmtCol::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
+ {
+ DBG_ERROR("not implemented");
+ }
+ else
+ {
+ uno::Reference< text::XTextColumns > xCols = new SwXTextColumns(*this);
+ rVal.setValue(&xCols, ::getCppuType((uno::Reference< text::XTextColumns>*)0));
+ }
+ return true;
+}
+
+bool SwFmtCol::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = false;
+ if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
+ {
+ DBG_ERROR("not implemented");
+ }
+ else
+ {
+ uno::Reference< text::XTextColumns > xCols;
+ rVal >>= xCols;
+ if(xCols.is())
+ {
+ uno::Sequence<text::TextColumn> aSetColumns = xCols->getColumns();
+ const text::TextColumn* pArray = aSetColumns.getConstArray();
+ aColumns.DeleteAndDestroy(0, aColumns.Count());
+ //max. Count ist hier 64K - das kann das Array aber nicht
+ sal_uInt16 nCount = Min( (sal_uInt16)aSetColumns.getLength(),
+ (sal_uInt16) 0x3fff );
+ sal_uInt16 nWidthSum = 0;
+ // #101224# one column is no column
+ //
+ if(nCount > 1)
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwColumn* pCol = new SwColumn;
+ pCol->SetWishWidth( pArray[i].Width );
+ nWidthSum += pArray[i].Width;
+ pCol->SetLeft ( MM100_TO_TWIP(pArray[i].LeftMargin) );
+ pCol->SetRight( MM100_TO_TWIP(pArray[i].RightMargin) );
+ aColumns.Insert(pCol, i);
+ }
+ bRet = true;
+ nWidth = nWidthSum;
+ bOrtho = sal_False;
+
+ uno::Reference<lang::XUnoTunnel> xNumTunnel(xCols, uno::UNO_QUERY);
+ SwXTextColumns* pSwColums = 0;
+ if(xNumTunnel.is())
+ {
+ pSwColums = (SwXTextColumns*)
+ xNumTunnel->getSomething( SwXTextColumns::getUnoTunnelId() );
+ }
+ if(pSwColums)
+ {
+ bOrtho = pSwColums->IsAutomaticWidth();
+ nLineWidth = pSwColums->GetSepLineWidth();
+ aLineColor.SetColor(pSwColums->GetSepLineColor());
+ nLineHeight = pSwColums->GetSepLineHeightRelative();
+ if(!pSwColums->GetSepLineIsOn())
+ eAdj = COLADJ_NONE;
+ else switch(pSwColums->GetSepLineVertAlign())
+ {
+ case 0: eAdj = COLADJ_TOP; break; //VerticalAlignment_TOP
+ case 1: eAdj = COLADJ_CENTER;break; //VerticalAlignment_MIDDLE
+ case 2: eAdj = COLADJ_BOTTOM;break; //VerticalAlignment_BOTTOM
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+
+// class SwFmtSurround
+// Implementierung teilweise inline im hxx
+
+SwFmtSurround::SwFmtSurround( SwSurround eFly ) :
+ SfxEnumItem( RES_SURROUND, sal_uInt16( eFly ) )
+{
+ bAnchorOnly = bContour = bOutside = sal_False;
+}
+
+SwFmtSurround::SwFmtSurround( const SwFmtSurround &rCpy ) :
+ SfxEnumItem( RES_SURROUND, rCpy.GetValue() )
+{
+ bAnchorOnly = rCpy.bAnchorOnly;
+ bContour = rCpy.bContour;
+ bOutside = rCpy.bOutside;
+}
+
+int SwFmtSurround::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return ( GetValue() == ((SwFmtSurround&)rAttr).GetValue() &&
+ bAnchorOnly== ((SwFmtSurround&)rAttr).bAnchorOnly &&
+ bContour== ((SwFmtSurround&)rAttr).bContour &&
+ bOutside== ((SwFmtSurround&)rAttr).bOutside );
+}
+
+SfxPoolItem* SwFmtSurround::Clone( SfxItemPool* ) const
+{
+ return new SwFmtSurround( *this );
+}
+
+
+
+bool SwFmtSurround::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_SURROUND_SURROUNDTYPE:
+ rVal <<= (text::WrapTextMode)GetSurround();
+ break;
+ case MID_SURROUND_ANCHORONLY:
+ {
+ BOOL bTmp = IsAnchorOnly();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ case MID_SURROUND_CONTOUR:
+ {
+ BOOL bTmp = IsContour();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ case MID_SURROUND_CONTOUROUTSIDE:
+ {
+ BOOL bTmp = IsOutside();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+bool SwFmtSurround::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ sal_Bool bRet = sal_True;
+ switch ( nMemberId )
+ {
+ case MID_SURROUND_SURROUNDTYPE:
+ {
+ sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal );
+ if( eVal >= 0 && eVal < (sal_Int16)SURROUND_END )
+ SetValue( eVal );
+ else
+ //exception
+ ;
+ }
+ break;
+
+ case MID_SURROUND_ANCHORONLY:
+ SetAnchorOnly( *(sal_Bool*)rVal.getValue() );
+ break;
+ case MID_SURROUND_CONTOUR:
+ SetContour( *(sal_Bool*)rVal.getValue() );
+ break;
+ case MID_SURROUND_CONTOUROUTSIDE:
+ SetOutside( *(sal_Bool*)rVal.getValue() );
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+// class SwFmtVertOrient
+// Implementierung teilweise inline im hxx
+
+SwFmtVertOrient::SwFmtVertOrient( SwTwips nY, SwVertOrient eVert,
+ SwRelationOrient eRel )
+ : SfxPoolItem( RES_VERT_ORIENT ),
+ nYPos( nY ),
+ eOrient( eVert ),
+ eRelation( eRel )
+{}
+
+int SwFmtVertOrient::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return ( nYPos == ((SwFmtVertOrient&)rAttr).nYPos &&
+ eOrient == ((SwFmtVertOrient&)rAttr).eOrient &&
+ eRelation == ((SwFmtVertOrient&)rAttr).eRelation );
+}
+
+SfxPoolItem* SwFmtVertOrient::Clone( SfxItemPool* ) const
+{
+ return new SwFmtVertOrient( nYPos, eOrient, eRelation );
+}
+
+
+SwTwips SwFmtVertOrient::GetPosConvertedToSw31(
+ const SvxULSpaceItem *pULSpace ) const
+{
+ SwTwips nNewPos = GetPos();
+
+ if( VERT_NONE==GetVertOrient() && pULSpace )
+ {
+ nNewPos -= pULSpace->GetUpper();
+ }
+
+ return nNewPos;
+}
+
+SwTwips SwFmtVertOrient::GetPosConvertedFromSw31(
+ const SvxULSpaceItem *pULSpace ) const
+{
+ SwTwips nNewPos = GetPos();
+
+ if( VERT_NONE==GetVertOrient() && pULSpace )
+ {
+ nNewPos += pULSpace->GetUpper();
+ }
+
+ return nNewPos;
+}
+
+
+bool SwFmtVertOrient::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_VERTORIENT_ORIENT:
+ {
+ sal_Int16 nRet = text::VertOrientation::NONE;
+ switch( eOrient )
+ {
+ case VERT_TOP : nRet = text::VertOrientation::TOP ;break;
+ case VERT_CENTER : nRet = text::VertOrientation::CENTER ;break;
+ case VERT_BOTTOM : nRet = text::VertOrientation::BOTTOM ;break;
+ case VERT_CHAR_TOP : nRet = text::VertOrientation::CHAR_TOP ;break;
+ case VERT_CHAR_CENTER: nRet = text::VertOrientation::CHAR_CENTER;break;
+ case VERT_CHAR_BOTTOM: nRet = text::VertOrientation::CHAR_BOTTOM;break;
+ case VERT_LINE_TOP : nRet = text::VertOrientation::LINE_TOP ;break;
+ case VERT_LINE_CENTER: nRet = text::VertOrientation::LINE_CENTER;break;
+ case VERT_LINE_BOTTOM: nRet = text::VertOrientation::LINE_BOTTOM;break;
+ }
+ rVal <<= nRet;
+ }
+ break;
+ case MID_VERTORIENT_RELATION:
+ rVal <<= lcl_RelToINT(eRelation);
+ break;
+ case MID_VERTORIENT_POSITION:
+ rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos());
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+bool SwFmtVertOrient::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ sal_Bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_VERTORIENT_ORIENT:
+ {
+ sal_uInt16 nVal;
+ rVal >>= nVal;
+ switch( nVal )
+ {
+ case text::VertOrientation::NONE: eOrient = VERT_NONE; break;
+ case text::VertOrientation::TOP : eOrient = VERT_TOP; break;
+ case text::VertOrientation::CENTER : eOrient = VERT_CENTER; break;
+ case text::VertOrientation::BOTTOM : eOrient = VERT_BOTTOM; break;
+ case text::VertOrientation::CHAR_TOP : eOrient = VERT_CHAR_TOP; break;
+ case text::VertOrientation::CHAR_CENTER: eOrient = VERT_CHAR_CENTER;break;
+ case text::VertOrientation::CHAR_BOTTOM: eOrient = VERT_CHAR_BOTTOM;break;
+ case text::VertOrientation::LINE_TOP : eOrient = VERT_LINE_TOP; break;
+ case text::VertOrientation::LINE_CENTER: eOrient = VERT_LINE_CENTER;break;
+ case text::VertOrientation::LINE_BOTTOM: eOrient = VERT_LINE_BOTTOM;break;
+ }
+ }
+ break;
+ case MID_VERTORIENT_RELATION:
+ {
+ eRelation = lcl_IntToRelation(rVal);
+ }
+ break;
+ case MID_VERTORIENT_POSITION:
+ {
+ sal_Int32 nVal;
+ rVal >>= nVal;
+ if(bConvert)
+ nVal = MM100_TO_TWIP(nVal);
+ SetPos( nVal );
+ }
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+
+
+// class SwFmtHoriOrient
+// Implementierung teilweise inline im hxx
+
+SwFmtHoriOrient::SwFmtHoriOrient( SwTwips nX, SwHoriOrient eHori,
+ SwRelationOrient eRel, sal_Bool bPos )
+ : SfxPoolItem( RES_HORI_ORIENT ),
+ nXPos( nX ),
+ eOrient( eHori ),
+ eRelation( eRel ),
+ bPosToggle( bPos )
+{}
+
+int SwFmtHoriOrient::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return ( nXPos == ((SwFmtHoriOrient&)rAttr).nXPos &&
+ eOrient == ((SwFmtHoriOrient&)rAttr).eOrient &&
+ eRelation == ((SwFmtHoriOrient&)rAttr).eRelation &&
+ bPosToggle == ((SwFmtHoriOrient&)rAttr).bPosToggle );
+}
+
+SfxPoolItem* SwFmtHoriOrient::Clone( SfxItemPool* ) const
+{
+ return new SwFmtHoriOrient( nXPos, eOrient, eRelation, bPosToggle );
+}
+
+
+SwTwips SwFmtHoriOrient::GetPosConvertedToSw31(
+ const SvxLRSpaceItem *pLRSpace ) const
+{
+ SwTwips nNewPos = GetPos();
+
+ if( HORI_NONE==GetHoriOrient() && pLRSpace )
+ {
+ nNewPos -= pLRSpace->GetLeft();
+ }
+
+ return nNewPos;
+}
+
+SwTwips SwFmtHoriOrient::GetPosConvertedFromSw31(
+ const SvxLRSpaceItem *pLRSpace ) const
+{
+ SwTwips nNewPos = GetPos();
+
+ if( HORI_NONE==GetHoriOrient() && pLRSpace )
+ {
+ nNewPos += pLRSpace->GetLeft();
+ }
+
+ return nNewPos;
+}
+
+bool SwFmtHoriOrient::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_HORIORIENT_ORIENT:
+ {
+ sal_Int16 nRet = text::HoriOrientation::NONE;
+ switch( eOrient )
+ {
+ case HORI_RIGHT: nRet = text::HoriOrientation::RIGHT; break;
+ case HORI_CENTER : nRet = text::HoriOrientation::CENTER; break;
+ case HORI_LEFT : nRet = text::HoriOrientation::LEFT; break;
+ case HORI_INSIDE : nRet = text::HoriOrientation::INSIDE; break;
+ case HORI_OUTSIDE: nRet = text::HoriOrientation::OUTSIDE; break;
+ case HORI_FULL: nRet = text::HoriOrientation::FULL; break;
+ case HORI_LEFT_AND_WIDTH :
+ nRet = text::HoriOrientation::LEFT_AND_WIDTH;
+ break;
+ }
+ rVal <<= nRet;
+ }
+ break;
+ case MID_HORIORIENT_RELATION:
+ rVal <<= lcl_RelToINT(eRelation);
+ break;
+ case MID_HORIORIENT_POSITION:
+ rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos());
+ break;
+ case MID_HORIORIENT_PAGETOGGLE:
+ {
+ BOOL bTmp = IsPosToggle();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+bool SwFmtHoriOrient::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ sal_Bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_HORIORIENT_ORIENT:
+ {
+ sal_Int16 nVal;
+ rVal >>= nVal;
+ switch( nVal )
+ {
+ case text::HoriOrientation::NONE: eOrient = HORI_NONE ; break;
+ case text::HoriOrientation::RIGHT: eOrient = HORI_RIGHT; break;
+ case text::HoriOrientation::CENTER : eOrient = HORI_CENTER; break;
+ case text::HoriOrientation::LEFT : eOrient = HORI_LEFT; break;
+ case text::HoriOrientation::INSIDE : eOrient = HORI_INSIDE; break;
+ case text::HoriOrientation::OUTSIDE: eOrient = HORI_OUTSIDE; break;
+ case text::HoriOrientation::FULL: eOrient = HORI_FULL; break;
+ case text::HoriOrientation::LEFT_AND_WIDTH:
+ eOrient = HORI_LEFT_AND_WIDTH;
+ break;
+ }
+ }
+ break;
+ case MID_HORIORIENT_RELATION:
+ {
+ eRelation = lcl_IntToRelation(rVal);
+ }
+ break;
+ case MID_HORIORIENT_POSITION:
+ {
+ sal_Int32 nVal;
+ if(!(rVal >>= nVal))
+ bRet = false;
+ if(bConvert)
+ nVal = MM100_TO_TWIP(nVal);
+ SetPos( nVal );
+ }
+ break;
+ case MID_HORIORIENT_PAGETOGGLE:
+ SetPosToggle( *(sal_Bool*)rVal.getValue());
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+
+
+// class SwFmtAnchor
+// Implementierung teilweise inline im hxx
+
+SwFmtAnchor::SwFmtAnchor( RndStdIds nRnd, sal_uInt16 nPage )
+ : SfxPoolItem( RES_ANCHOR ),
+ pCntntAnchor( 0 ),
+ nAnchorId( nRnd ),
+ nPageNum( nPage )
+{}
+
+SwFmtAnchor::SwFmtAnchor( const SwFmtAnchor &rCpy )
+ : SfxPoolItem( RES_ANCHOR ),
+ nAnchorId( rCpy.GetAnchorId() ),
+ nPageNum( rCpy.GetPageNum() )
+{
+ pCntntAnchor = rCpy.GetCntntAnchor() ?
+ new SwPosition( *rCpy.GetCntntAnchor() ) : 0;
+}
+
+SwFmtAnchor::~SwFmtAnchor()
+{
+ delete pCntntAnchor;
+}
+
+void SwFmtAnchor::SetAnchor( const SwPosition *pPos )
+{
+ if ( pCntntAnchor )
+ delete pCntntAnchor;
+ pCntntAnchor = pPos ? new SwPosition( *pPos ) : 0;
+ //AM Absatz gebundene Flys sollten nie in den Absatz hineinzeigen.
+ if ( pCntntAnchor && ( FLY_AT_CNTNT == nAnchorId ||
+ FLY_AT_FLY == nAnchorId ))
+ pCntntAnchor->nContent.Assign( 0, 0 );
+}
+
+SwFmtAnchor& SwFmtAnchor::operator=(const SwFmtAnchor& rAnchor)
+{
+ nAnchorId = rAnchor.GetAnchorId();
+ nPageNum = rAnchor.GetPageNum();
+
+ delete pCntntAnchor;
+ pCntntAnchor = rAnchor.pCntntAnchor ?
+ new SwPosition(*(rAnchor.pCntntAnchor)) : 0;
+ return *this;
+}
+
+int SwFmtAnchor::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return ( nAnchorId == ((SwFmtAnchor&)rAttr).GetAnchorId() &&
+ nPageNum == ((SwFmtAnchor&)rAttr).GetPageNum() &&
+ //Anker vergleichen. Entweder zeigen beide auf das gleiche
+ //Attribut bzw. sind 0 oder die SwPosition* sind beide
+ //gueltig und die SwPositions sind gleich.
+ (pCntntAnchor == ((SwFmtAnchor&)rAttr).GetCntntAnchor() ||
+ (pCntntAnchor && ((SwFmtAnchor&)rAttr).GetCntntAnchor() &&
+ *pCntntAnchor == *((SwFmtAnchor&)rAttr).GetCntntAnchor())));
+}
+
+SfxPoolItem* SwFmtAnchor::Clone( SfxItemPool* ) const
+{
+ return new SwFmtAnchor( *this );
+}
+
+/*-----------------16.02.98 15:21-------------------
+
+ --------------------------------------------------*/
+bool SwFmtAnchor::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_ANCHOR_ANCHORTYPE:
+
+ text::TextContentAnchorType eRet;
+ switch((sal_Int16)GetAnchorId())
+ {
+ case FLY_AUTO_CNTNT : eRet = text::TextContentAnchorType_AT_CHARACTER;break;
+ case FLY_PAGE : eRet = text::TextContentAnchorType_AT_PAGE; break;
+ case FLY_AT_FLY : eRet = text::TextContentAnchorType_AT_FRAME; break;
+ case FLY_IN_CNTNT : eRet = text::TextContentAnchorType_AS_CHARACTER;break;
+ //case FLY_AT_CNTNT :
+ default: eRet = text::TextContentAnchorType_AT_PARAGRAPH;
+ }
+ rVal <<= eRet;
+ break;
+ case MID_ANCHOR_PAGENUM:
+ rVal <<= (sal_Int16)GetPageNum();
+ break;
+ case MID_ANCHOR_ANCHORFRAME:
+ {
+ if(pCntntAnchor && FLY_AT_FLY == nAnchorId)
+ {
+ SwFrmFmt* pFmt = pCntntAnchor->nNode.GetNode().GetFlyFmt();
+ if(pFmt)
+ {
+ Reference<XNamed> xNamed = SwXFrames::GetObject( *pFmt, FLYCNTTYPE_FRM );
+ Reference<XTextFrame> xRet(xNamed, UNO_QUERY);
+ rVal <<= xRet;
+ }
+ }
+ }
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+bool SwFmtAnchor::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_ANCHOR_ANCHORTYPE:
+ {
+ RndStdIds eAnchor;
+ switch( SWUnoHelper::GetEnumAsInt32( rVal ) )
+ {
+ case text::TextContentAnchorType_AS_CHARACTER:
+ eAnchor = FLY_IN_CNTNT;
+ break;
+ case text::TextContentAnchorType_AT_PAGE:
+ eAnchor = FLY_PAGE;
+ if( GetPageNum() > 0 && pCntntAnchor )
+ {
+ // If the anchor type is page and a valid page number
+ // has been set, the content position isn't required
+ // any longer.
+ delete pCntntAnchor;
+ pCntntAnchor = 0;
+ }
+ break;
+ case text::TextContentAnchorType_AT_FRAME:
+ eAnchor = FLY_AT_FLY;
+ break;
+ case text::TextContentAnchorType_AT_CHARACTER:
+ eAnchor = FLY_AUTO_CNTNT;
+ break;
+ //case text::TextContentAnchorType_AT_PARAGRAPH:
+ default:
+ eAnchor = FLY_AT_CNTNT;
+ break;
+ }
+ SetType( eAnchor );
+ }
+ break;
+ case MID_ANCHOR_PAGENUM:
+ {
+ sal_Int16 nVal;
+ if((rVal >>= nVal) && nVal > 0)
+ {
+ SetPageNum( nVal );
+ if( FLY_PAGE == GetAnchorId() && pCntntAnchor )
+ {
+ // If the anchor type is page and a valid page number
+ // is set, the content paoition has to be deleted to not
+ // confuse the layout (frmtool.cxx). However, if the
+ // anchor type is not page, any content position will
+ // be kept.
+ delete pCntntAnchor;
+ pCntntAnchor = 0;
+ }
+ }
+ else
+ bRet = false;
+ }
+ break;
+ case MID_ANCHOR_ANCHORFRAME:
+ //no break here!;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+// class SwFmtURL
+// Implementierung teilweise inline im hxx
+
+SwFmtURL::SwFmtURL() :
+ SfxPoolItem( RES_URL ),
+ pMap( 0 ),
+ bIsServerMap( sal_False )
+{
+}
+
+SwFmtURL::SwFmtURL( const SwFmtURL &rURL) :
+ SfxPoolItem( RES_URL ),
+ sURL( rURL.GetURL() ),
+ sTargetFrameName( rURL.GetTargetFrameName() ),
+ sName( rURL.GetName() ),
+ bIsServerMap( rURL.IsServerMap() )
+{
+ pMap = rURL.GetMap() ? new ImageMap( *rURL.GetMap() ) : 0;
+}
+
+SwFmtURL::~SwFmtURL()
+{
+ if ( pMap )
+ delete pMap;
+}
+
+int SwFmtURL::operator==( const SfxPoolItem &rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ const SwFmtURL &rCmp = (SwFmtURL&)rAttr;
+ sal_Bool bRet = bIsServerMap == rCmp.IsServerMap() &&
+ sURL == rCmp.GetURL() &&
+ sTargetFrameName == rCmp.GetTargetFrameName() &&
+ sName == rCmp.GetName();
+ if ( bRet )
+ {
+ if ( pMap && rCmp.GetMap() )
+ bRet = *pMap == *rCmp.GetMap();
+ else
+ bRet = pMap == rCmp.GetMap();
+ }
+ return bRet;
+}
+
+SfxPoolItem* SwFmtURL::Clone( SfxItemPool* pPool ) const
+{
+ return new SwFmtURL( *this );
+}
+
+void SwFmtURL::SetURL( const XubString &rURL, sal_Bool bServerMap )
+{
+ sURL = rURL;
+ bIsServerMap = bServerMap;
+}
+
+void SwFmtURL::SetMap( const ImageMap *pM )
+{
+ if ( pMap )
+ delete pMap;
+ pMap = pM ? new ImageMap( *pM ) : 0;
+}
+extern const SvEventDescription* lcl_GetSupportedMacroItems();
+
+bool SwFmtURL::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_URL_URL:
+ {
+ OUString sRet = GetURL();
+ rVal <<= sRet;
+ }
+ break;
+ case MID_URL_TARGET:
+ {
+ OUString sRet = GetTargetFrameName();
+ rVal <<= sRet;
+ }
+ break;
+ case MID_URL_HYPERLINKNAME:
+ rVal <<= OUString( GetName() );
+ break;
+ case MID_URL_CLIENTMAP:
+ {
+ Reference< XInterface > xInt;
+ if(pMap)
+ {
+ xInt = SvUnoImageMap_createInstance( *pMap, lcl_GetSupportedMacroItems() );
+ }
+ else
+ {
+ ImageMap aEmptyMap;
+ xInt = SvUnoImageMap_createInstance( aEmptyMap, lcl_GetSupportedMacroItems() );
+ }
+ Reference< XIndexContainer > xCont(xInt, UNO_QUERY);
+ rVal <<= xCont;
+ }
+ break;
+ case MID_URL_SERVERMAP:
+ {
+ BOOL bTmp = IsServerMap();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+bool SwFmtURL::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_URL_URL:
+ {
+ OUString sTmp;
+ rVal >>= sTmp;
+ SetURL( sTmp, bIsServerMap );
+ }
+ break;
+ case MID_URL_TARGET:
+ {
+ OUString sTmp;
+ rVal >>= sTmp;
+ SetTargetFrameName( sTmp );
+ }
+ break;
+ case MID_URL_HYPERLINKNAME:
+ {
+ OUString sTmp;
+ rVal >>= sTmp;
+ SetName( sTmp );
+ }
+ break;
+ case MID_URL_CLIENTMAP:
+ {
+ Reference<XIndexContainer> xCont;
+ if(!rVal.hasValue())
+ DELETEZ(pMap);
+ else if(rVal >>= xCont)
+ {
+ if(!pMap)
+ pMap = new ImageMap;
+ bRet = SvUnoImageMap_fillImageMap( xCont, *pMap );
+ }
+ else
+ bRet = false;
+ }
+ break;
+ case MID_URL_SERVERMAP:
+ bIsServerMap = *(sal_Bool*)rVal.getValue();
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+
+// class SwNoReadOnly
+
+SfxPoolItem* SwFmtEditInReadonly::Clone( SfxItemPool* pPool ) const
+{
+ return new SwFmtEditInReadonly( Which(), GetValue() );
+}
+
+// class SwFmtLayoutSplit
+
+SfxPoolItem* SwFmtLayoutSplit::Clone( SfxItemPool* pPool ) const
+{
+ return new SwFmtLayoutSplit( GetValue() );
+}
+
+// class SwFmtNoBalancedColumns
+
+SfxPoolItem* SwFmtNoBalancedColumns::Clone( SfxItemPool* pPool ) const
+{
+ return new SwFmtNoBalancedColumns( GetValue() );
+}
+
+// class SwFmtFtnEndAtTxtEnd
+
+
+SwFmtFtnEndAtTxtEnd& SwFmtFtnEndAtTxtEnd::operator=(
+ const SwFmtFtnEndAtTxtEnd& rAttr )
+{
+ SfxEnumItem::SetValue( rAttr.GetValue() );
+ aFmt = rAttr.aFmt;
+ nOffset = rAttr.nOffset;
+ sPrefix = rAttr.sPrefix;
+ sSuffix = rAttr.sSuffix;
+ return *this;
+}
+
+int SwFmtFtnEndAtTxtEnd::operator==( const SfxPoolItem& rItem ) const
+{
+ const SwFmtFtnEndAtTxtEnd& rAttr = (SwFmtFtnEndAtTxtEnd&)rItem;
+ return SfxEnumItem::operator==( rAttr ) &&
+ aFmt.GetNumberingType() == rAttr.aFmt.GetNumberingType() &&
+ nOffset == rAttr.nOffset &&
+ sPrefix == rAttr.sPrefix &&
+ sSuffix == rAttr.sSuffix;
+}
+
+bool SwFmtFtnEndAtTxtEnd::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch(nMemberId)
+ {
+ case MID_COLLECT :
+ {
+ sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND;
+ rVal.setValue(&bVal, ::getBooleanCppuType());
+ }
+ break;
+ case MID_RESTART_NUM :
+ {
+ sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ;
+ rVal.setValue(&bVal, ::getBooleanCppuType());
+ }
+ break;
+ case MID_NUM_START_AT: rVal <<= (sal_Int16) nOffset; break;
+ case MID_OWN_NUM :
+ {
+ sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT;
+ rVal.setValue(&bVal, ::getBooleanCppuType());
+ }
+ break;
+ case MID_NUM_TYPE : rVal <<= aFmt.GetNumberingType(); break;
+ case MID_PREFIX : rVal <<= OUString(sPrefix); break;
+ case MID_SUFFIX : rVal <<= OUString(sSuffix); break;
+ default: return false;
+ }
+ return true;
+}
+
+bool SwFmtFtnEndAtTxtEnd::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ bool bRet = true;
+ nMemberId &= ~CONVERT_TWIPS;
+ switch(nMemberId)
+ {
+ case MID_COLLECT :
+ {
+ sal_Bool bVal = *(sal_Bool*)rVal.getValue();
+ if(!bVal && GetValue() >= FTNEND_ATTXTEND)
+ SetValue(FTNEND_ATPGORDOCEND);
+ else if(bVal && GetValue() < FTNEND_ATTXTEND)
+ SetValue(FTNEND_ATTXTEND);
+ }
+ break;
+ case MID_RESTART_NUM :
+ {
+ sal_Bool bVal = *(sal_Bool*)rVal.getValue();
+ if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ)
+ SetValue(FTNEND_ATTXTEND);
+ else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMSEQ)
+ SetValue(FTNEND_ATTXTEND_OWNNUMSEQ);
+ }
+ break;
+ case MID_NUM_START_AT:
+ {
+ sal_Int16 nVal;
+ rVal >>= nVal;
+ if(nVal >= 0)
+ nOffset = nVal;
+ else
+ bRet = false;
+ }
+ break;
+ case MID_OWN_NUM :
+ {
+ sal_Bool bVal = *(sal_Bool*)rVal.getValue();
+ if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT)
+ SetValue(FTNEND_ATTXTEND_OWNNUMSEQ);
+ else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMANDFMT)
+ SetValue(FTNEND_ATTXTEND_OWNNUMANDFMT);
+ }
+ break;
+ case MID_NUM_TYPE :
+ {
+ sal_Int16 nVal;
+ rVal >>= nVal;
+ if(nVal >= 0 &&
+ (nVal <= SVX_NUM_ARABIC ||
+ SVX_NUM_CHARS_UPPER_LETTER_N == nVal ||
+ SVX_NUM_CHARS_LOWER_LETTER_N == nVal ))
+ aFmt.SetNumberingType(nVal);
+ else
+ bRet = false;
+ }
+ break;
+ case MID_PREFIX :
+ {
+ OUString sVal; rVal >>= sVal;
+ sPrefix = sVal;
+ }
+ break;
+ case MID_SUFFIX :
+ {
+ OUString sVal; rVal >>= sVal;
+ sSuffix = sVal;
+ }
+ break;
+ default: bRet = false;
+ }
+ return bRet;
+}
+
+
+// class SwFmtFtnAtTxtEnd
+
+SfxPoolItem* SwFmtFtnAtTxtEnd::Clone( SfxItemPool* pPool ) const
+{
+ SwFmtFtnAtTxtEnd* pNew = new SwFmtFtnAtTxtEnd;
+ *pNew = *this;
+ return pNew;
+}
+
+// class SwFmtEndAtTxtEnd
+
+SfxPoolItem* SwFmtEndAtTxtEnd::Clone( SfxItemPool* pPool ) const
+{
+ SwFmtEndAtTxtEnd* pNew = new SwFmtEndAtTxtEnd;
+ *pNew = *this;
+ return pNew;
+}
+
+//class SwFmtChain
+
+
+int SwFmtChain::operator==( const SfxPoolItem &rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+
+ return GetPrev() == ((SwFmtChain&)rAttr).GetPrev() &&
+ GetNext() == ((SwFmtChain&)rAttr).GetNext();
+}
+
+SwFmtChain::SwFmtChain( const SwFmtChain &rCpy ) :
+ SfxPoolItem( RES_CHAIN )
+{
+ SetPrev( rCpy.GetPrev() );
+ SetNext( rCpy.GetNext() );
+}
+
+SfxPoolItem* SwFmtChain::Clone( SfxItemPool* pPool ) const
+{
+ SwFmtChain *pRet = new SwFmtChain;
+ pRet->SetPrev( GetPrev() );
+ pRet->SetNext( GetNext() );
+ return pRet;
+}
+
+void SwFmtChain::SetPrev( SwFlyFrmFmt *pFmt )
+{
+ if ( pFmt )
+ pFmt->Add( &aPrev );
+ else if ( aPrev.GetRegisteredIn() )
+ ((SwModify*)aPrev.GetRegisteredIn())->Remove( &aPrev );
+}
+
+void SwFmtChain::SetNext( SwFlyFrmFmt *pFmt )
+{
+ if ( pFmt )
+ pFmt->Add( &aNext );
+ else if ( aNext.GetRegisteredIn() )
+ ((SwModify*)aNext.GetRegisteredIn())->Remove( &aNext );
+}
+
+bool SwFmtChain::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ XubString aRet;
+ switch ( nMemberId )
+ {
+ case MID_CHAIN_PREVNAME:
+ if ( GetPrev() )
+ aRet = GetPrev()->GetName();
+ break;
+ case MID_CHAIN_NEXTNAME:
+ if ( GetNext() )
+ aRet = GetNext()->GetName();
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ rVal <<= OUString(aRet);
+ return bRet;
+}
+
+
+
+
+//class SwFmtLineNumber
+
+SwFmtLineNumber::SwFmtLineNumber() :
+ SfxPoolItem( RES_LINENUMBER )
+{
+ nStartValue = 0;
+ bCountLines = sal_True;
+}
+
+SwFmtLineNumber::~SwFmtLineNumber()
+{
+}
+
+int SwFmtLineNumber::operator==( const SfxPoolItem &rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+
+ return nStartValue == ((SwFmtLineNumber&)rAttr).GetStartValue() &&
+ bCountLines == ((SwFmtLineNumber&)rAttr).IsCount();
+}
+
+SfxPoolItem* SwFmtLineNumber::Clone( SfxItemPool* pPool ) const
+{
+ return new SwFmtLineNumber( *this );
+}
+
+bool SwFmtLineNumber::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_LINENUMBER_COUNT:
+ {
+ BOOL bTmp = IsCount();
+ rVal.setValue(&bTmp, ::getBooleanCppuType());
+ }
+ break;
+ case MID_LINENUMBER_STARTVALUE:
+ rVal <<= (sal_Int32)GetStartValue();
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+bool SwFmtLineNumber::PutValue( const uno::Any& rVal, BYTE nMemberId )
+{
+ // hier wird immer konvertiert!
+ nMemberId &= ~CONVERT_TWIPS;
+ bool bRet = true;
+ switch ( nMemberId )
+ {
+ case MID_LINENUMBER_COUNT:
+ SetCountLines( *(sal_Bool*)rVal.getValue() );
+ break;
+ case MID_LINENUMBER_STARTVALUE:
+ {
+ sal_Int32 nVal;
+ if(rVal >>= nVal)
+ SetStartValue( nVal );
+ else
+ bRet = false;
+ }
+ break;
+ default:
+ ASSERT( !this, "unknown MemberId" );
+ bRet = false;
+ }
+ return bRet;
+}
+
+/*************************************************************************
+ * class SwTextGridItem
+ *************************************************************************/
+
+SwTextGridItem::SwTextGridItem()
+ : SfxPoolItem( RES_TEXTGRID ), aColor( COL_LIGHTGRAY ), nLines( 20 ),
+ nBaseHeight( 400 ), nRubyHeight( 200 ), eGridType( GRID_NONE ),
+ bRubyTextBelow( 0 ), bPrintGrid( 1 ), bDisplayGrid( 1 )
+{
+}
+
+SwTextGridItem::~SwTextGridItem()
+{
+}
+
+int SwTextGridItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return eGridType == ((SwTextGridItem&)rAttr).GetGridType() &&
+ nLines == ((SwTextGridItem&)rAttr).GetLines() &&
+ nBaseHeight == ((SwTextGridItem&)rAttr).GetBaseHeight() &&
+ nRubyHeight == ((SwTextGridItem&)rAttr).GetRubyHeight() &&
+ bRubyTextBelow == ((SwTextGridItem&)rAttr).GetRubyTextBelow() &&
+ bDisplayGrid == ((SwTextGridItem&)rAttr).GetDisplayGrid() &&
+ bPrintGrid == ((SwTextGridItem&)rAttr).GetPrintGrid() &&
+ aColor == ((SwTextGridItem&)rAttr).GetColor();
+}
+
+SfxPoolItem* SwTextGridItem::Clone( SfxItemPool* pPool ) const
+{
+ return new SwTextGridItem( *this );
+}
+
+SwTextGridItem& SwTextGridItem::operator=( const SwTextGridItem& rCpy )
+{
+ aColor = rCpy.GetColor();
+ nLines = rCpy.GetLines();
+ nBaseHeight = rCpy.GetBaseHeight();
+ nRubyHeight = rCpy.GetRubyHeight();
+ eGridType = rCpy.GetGridType();
+ bRubyTextBelow = rCpy.GetRubyTextBelow();
+ bPrintGrid = rCpy.GetPrintGrid();
+ bDisplayGrid = rCpy.GetDisplayGrid();
+
+ return *this;
+}
+
+bool SwTextGridItem::QueryValue( ::com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ bool bRet = true;
+
+ switch( nMemberId & ~CONVERT_TWIPS )
+ {
+ case MID_GRID_COLOR:
+ rVal <<= GetColor().GetColor();
+ break;
+ case MID_GRID_LINES:
+ rVal <<= GetLines();
+ break;
+ case MID_GRID_RUBY_BELOW:
+ rVal.setValue( &bRubyTextBelow, ::getBooleanCppuType() );
+ break;
+ case MID_GRID_PRINT:
+ rVal.setValue( &bPrintGrid, ::getBooleanCppuType() );
+ break;
+ case MID_GRID_DISPLAY:
+ rVal.setValue( &bDisplayGrid, ::getBooleanCppuType() );
+ break;
+ case MID_GRID_BASEHEIGHT:
+ DBG_ASSERT( (nMemberId & CONVERT_TWIPS) != 0,
+ "This value needs TWIPS-MM100 conversion" );
+ rVal <<= (sal_Int32) TWIP_TO_MM100(nBaseHeight);
+ break;
+ case MID_GRID_RUBYHEIGHT:
+ DBG_ASSERT( (nMemberId & CONVERT_TWIPS) != 0,
+ "This value needs TWIPS-MM100 conversion" );
+ rVal <<= (sal_Int32)TWIP_TO_MM100(nRubyHeight);
+ break;
+ case MID_GRID_TYPE:
+ switch( GetGridType() )
+ {
+ case GRID_NONE:
+ rVal <<= TextGridMode::NONE;
+ break;
+ case GRID_LINES_ONLY:
+ rVal <<= TextGridMode::LINES;
+ break;
+ case GRID_LINES_CHARS:
+ rVal <<= TextGridMode::LINES_AND_CHARS;
+ break;
+ default:
+ DBG_ERROR("unknown SwTextGrid value");
+ bRet = false;
+ break;
+ }
+ break;
+ default:
+ DBG_ERROR("Unknown SwTextGridItem member");
+ bRet = false;
+ break;
+ }
+
+ return bRet;
+}
+
+bool SwTextGridItem::PutValue( const ::com::sun::star::uno::Any& rVal,
+ BYTE nMemberId )
+{
+ bool bRet = true;
+ switch( nMemberId & ~CONVERT_TWIPS )
+ {
+ case MID_GRID_COLOR:
+ {
+ sal_Int32 nTmp;
+ bRet = (rVal >>= nTmp);
+ if( bRet )
+ SetColor( Color(nTmp) );
+ }
+ break;
+ case MID_GRID_LINES:
+ {
+ sal_Int16 nTmp;
+ bRet = (rVal >>= nTmp);
+ if( bRet && (nTmp >= 0) )
+ SetLines( (sal_uInt16)nTmp );
+ else
+ bRet = false;
+ }
+ break;
+ case MID_GRID_RUBY_BELOW:
+ SetRubyTextBelow( *(sal_Bool*)rVal.getValue() );
+ break;
+ case MID_GRID_PRINT:
+ SetPrintGrid( *(sal_Bool*)rVal.getValue() );
+ break;
+ case MID_GRID_DISPLAY:
+ SetDisplayGrid( *(sal_Bool*)rVal.getValue() );
+ break;
+ case MID_GRID_BASEHEIGHT:
+ case MID_GRID_RUBYHEIGHT:
+ {
+ DBG_ASSERT( (nMemberId & CONVERT_TWIPS) != 0,
+ "This value needs TWIPS-MM100 conversion" );
+ sal_Int32 nTmp;
+ bRet = (rVal >>= nTmp);
+ nTmp = MM100_TO_TWIP( nTmp );
+ if( bRet && (nTmp >= 0) && ( nTmp <= USHRT_MAX) )
+ if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEHEIGHT )
+ SetBaseHeight( (USHORT)nTmp );
+ else
+ SetRubyHeight( (USHORT)nTmp );
+ else
+ bRet = false;
+ }
+ break;
+ case MID_GRID_TYPE:
+ sal_Int16 nTmp;
+ bRet = (rVal >>= nTmp);
+ if( bRet )
+ {
+ switch( nTmp )
+ {
+ case TextGridMode::NONE:
+ SetGridType( GRID_NONE );
+ break;
+ case TextGridMode::LINES:
+ SetGridType( GRID_LINES_ONLY );
+ break;
+ case TextGridMode::LINES_AND_CHARS:
+ SetGridType( GRID_LINES_CHARS );
+ break;
+ default:
+ bRet = false;
+ break;
+ }
+ }
+ break;
+ default:
+ DBG_ERROR("Unknown SwTextGridItem member");
+ bRet = false;
+ }
+
+ return bRet;
+}
+
+// class SwHeaderAndFooterEatSpacingItem
+
+SfxPoolItem* SwHeaderAndFooterEatSpacingItem::Clone( SfxItemPool* pPool ) const
+{
+ return new SwHeaderAndFooterEatSpacingItem( Which(), GetValue() );
+}
+
+
+// class SwFrmFmt
+// Implementierung teilweise inline im hxx
+
+void SwFrmFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+{
+ SwFmtHeader *pH = 0;
+ SwFmtFooter *pF = 0;
+
+ sal_uInt16 nWhich = pNew ? pNew->Which() : 0;
+
+ if( RES_ATTRSET_CHG == nWhich )
+ {
+ ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_HEADER, sal_False, (const SfxPoolItem**)&pH );
+ ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
+ RES_FOOTER, sal_False, (const SfxPoolItem**)&pF );
+ }
+ else if( RES_HEADER == nWhich )
+ pH = (SwFmtHeader*)pNew;
+ else if( RES_FOOTER == nWhich )
+ pF = (SwFmtFooter*)pNew;
+
+ if( pH && pH->IsActive() && !pH->GetHeaderFmt() )
+ { //Hat er keinen, mach ich ihm einen
+ SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_HEADER );
+ pFmt->Add( pH );
+ }
+
+ if( pF && pF->IsActive() && !pF->GetFooterFmt() )
+ { //Hat er keinen, mach ich ihm einen
+ SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_FOOTER );
+ pFmt->Add( pF );
+ }
+
+ // MIB 24.3.98: Modify der Basisklasse muss immer gerufen werden, z.B.
+ // wegen RESET_FMTWRITTEN.
+ // if ( GetDepends() )
+ SwFmt::Modify( pOld, pNew );
+}
+
+//Vernichtet alle Frms, die in aDepend angemeldet sind.
+
+void SwFrmFmt::DelFrms()
+{
+ SwClientIter aIter( *this );
+ SwClient * pLast = aIter.GoStart();
+ if( pLast )
+ do {
+ if ( pLast->ISA(SwFrm) )
+ {
+ ((SwFrm*)pLast)->Cut();
+ delete pLast;
+ }
+ } while( 0 != ( pLast = aIter++ ));
+}
+
+void SwFrmFmt::MakeFrms()
+{
+ ASSERT( !this, "Sorry not implemented." );
+}
+
+
+
+SwRect SwFrmFmt::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint,
+ const sal_Bool bCalcFrm ) const
+{
+ SwRect aRet;
+ SwFrm *pFrm = 0;
+ if( ISA( SwSectionFmt ) )
+ {
+ // dann den ::com::sun::star::frame::Frame per Node2Layout besorgen
+ SwSectionNode* pSectNd = ((SwSectionFmt*)this)->GetSectionNode();
+ if( pSectNd )
+ {
+ SwNode2Layout aTmp( *pSectNd, pSectNd->GetIndex() - 1 );
+ pFrm = aTmp.NextFrm();
+
+ if( pFrm && pFrm->GetRegisteredIn() != this )
+ {
+ // die Section hat keinen eigenen ::com::sun::star::frame::Frame, also falls
+ // jemand die tatsaechliche Groeáe braucht, so muss das
+ // noch implementier werden, in dem sich vom Ende noch
+ // der entsprechende ::com::sun::star::frame::Frame besorgt wird.
+ // PROBLEM: was passiert bei SectionFrames, die auf unter-
+ // schiedlichen Seiten stehen??
+ if( bPrtArea )
+ aRet = pFrm->Prt();
+ else
+ {
+ aRet = pFrm->Frm();
+ --aRet.Pos().Y();
+ }
+ pFrm = 0; // das Rect ist ja jetzt fertig
+ }
+ }
+ }
+ else
+ {
+ sal_uInt16 nFrmType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX;
+ pFrm = ::binfilter::GetFrmOfModify( *(SwModify*)this, nFrmType, pPoint,
+ 0, bCalcFrm );
+ }
+
+ if( pFrm )
+ {
+ if( bPrtArea )
+ aRet = pFrm->Prt();
+ else
+ aRet = pFrm->Frm();
+ }
+ return aRet;
+}
+
+SwContact* SwFrmFmt::FindContactObj()
+{
+ SwClientIter aIter( *this );
+ return (SwContact*)aIter.First( TYPE( SwContact ) );
+}
+
+SdrObject* SwFrmFmt::FindSdrObject()
+{
+ SwClientIter aIter( *this );
+ SwClient* pFnd = aIter.First( TYPE( SwContact ) );
+ return pFnd ? ((SwContact*)pFnd)->GetMaster() : 0;
+}
+
+SdrObject* SwFrmFmt::FindRealSdrObject()
+{
+ if( RES_FLYFRMFMT == Which() )
+ {
+ Point aNullPt;
+ SwFlyFrm* pFly = (SwFlyFrm*)::binfilter::GetFrmOfModify( *this, FRM_FLY,
+ &aNullPt, 0, sal_False );
+ return pFly ? pFly->GetVirtDrawObj() : 0;
+ }
+ return FindSdrObject();
+}
+
+
+
+// class SwFlyFrmFmt
+// Implementierung teilweise inline im hxx
+
+SwFlyFrmFmt::~SwFlyFrmFmt()
+{
+ SwClientIter aIter( *this );
+ SwClient * pLast = aIter.GoStart();
+ if( pLast )
+ do {
+ if ( pLast->ISA( SwFlyFrm ) )
+ delete pLast;
+
+ } while( 0 != ( pLast = aIter++ ));
+
+ pLast = aIter.GoStart();
+ if( pLast )
+ do {
+ if ( pLast->ISA( SwFlyDrawContact ) )
+ delete pLast;
+
+ } while( 0 != ( pLast = aIter++ ));
+}
+
+//Erzeugen der Frms wenn das Format einen Absatzgebundenen Rahmen beschreibt.
+//MA: 14. Feb. 94, Erzeugen der Frms auch fuer Seitengebundene Rahmen.
+
+void SwFlyFrmFmt::MakeFrms()
+{
+ // gibts ueberhaupt ein Layout ??
+ if( !GetDoc()->GetRootFrm() )
+ return;
+
+ SwModify *pModify = 0;
+ // OD 24.07.2003 #111032# - create local copy of anchor attribute for possible changes.
+ SwFmtAnchor aAnchorAttr( GetAnchor() );
+ switch( aAnchorAttr.GetAnchorId() )
+ {
+ case FLY_IN_CNTNT:
+ case FLY_AT_CNTNT:
+ case FLY_AUTO_CNTNT:
+ if( aAnchorAttr.GetCntntAnchor() )
+ pModify = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
+ break;
+
+ case FLY_AT_FLY:
+ if( aAnchorAttr.GetCntntAnchor() )
+ {
+ //Erst einmal ueber den Inhalt suchen, weil konstant schnell. Kann
+ //Bei verketteten Rahmen aber auch schief gehen, weil dann evtl.
+ //niemals ein ::com::sun::star::frame::Frame zu dem Inhalt existiert. Dann muss leider noch
+ //die Suche vom StartNode zum FrameFormat sein.
+ SwNodeIndex aIdx( aAnchorAttr.GetCntntAnchor()->nNode );
+ SwCntntNode *pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
+ SwClientIter aIter( *pCNd );
+ if ( aIter.First( TYPE(SwFrm) ) )
+ pModify = pCNd;
+ else
+ {
+ const SwNodeIndex &rIdx = aAnchorAttr.GetCntntAnchor()->nNode;
+ SwSpzFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts();
+ for( sal_uInt16 i = 0; i < rFmts.Count(); ++i )
+ {
+ SwFrmFmt* pFlyFmt = rFmts[i];
+ if( pFlyFmt->GetCntnt().GetCntntIdx() &&
+ rIdx == *pFlyFmt->GetCntnt().GetCntntIdx() )
+ {
+ pModify = pFlyFmt;
+ break;
+ }
+ }
+ }
+ }
+ break;
+
+ case FLY_PAGE:
+ {
+ sal_uInt16 nPgNum = aAnchorAttr.GetPageNum();
+ SwPageFrm *pPage = (SwPageFrm*)GetDoc()->GetRootFrm()->Lower();
+ if( !nPgNum && aAnchorAttr.GetCntntAnchor() )
+ {
+ SwCntntNode *pCNd =
+ aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
+ SwClientIter aIter( *pCNd );
+ do
+ {
+ if( aIter()->ISA( SwFrm ) )
+ {
+ pPage = ((SwFrm*)aIter())->FindPageFrm();
+ if( pPage )
+ {
+ nPgNum = pPage->GetPhyPageNum();
+ // OD 24.07.2003 #111032# - update anchor attribute
+ aAnchorAttr.SetPageNum( nPgNum );
+ aAnchorAttr.SetAnchor( 0 );
+ SetAttr( aAnchorAttr );
+ }
+ break;
+ }
+ } while ( aIter++ );
+ }
+ while ( pPage )
+ {
+ if ( pPage->GetPhyPageNum() == nPgNum )
+ {
+ pPage->PlaceFly( 0, this, &aAnchorAttr );
+ break;
+ }
+ pPage = (SwPageFrm*)pPage->GetNext();
+ }
+ }
+ break;
+ }
+
+ if( pModify )
+ {
+ SwClientIter aIter( *pModify );
+ for( SwFrm *pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) );
+ pFrm;
+ pFrm = (SwFrm*)aIter.Next() )
+ {
+ FASTBOOL bAdd = !pFrm->IsCntntFrm() ||
+ !((SwCntntFrm*)pFrm)->IsFollow();
+
+ if ( FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrm->IsFlyFrm() )
+ pFrm = pFrm->FindFlyFrm();
+
+ if( pFrm->GetDrawObjs() )
+ {
+ SwDrawObjs &rObjs = *pFrm->GetDrawObjs();
+ for( sal_uInt16 i = 0; i < rObjs.Count(); ++i)
+ {
+ SdrObject *pO = rObjs[i];
+ if( pO->ISA( SwVirtFlyDrawObj ) &&
+ ((SwVirtFlyDrawObj*)pO)->GetFmt() == this )
+ {
+ bAdd = sal_False;
+ break;
+ }
+ }
+ }
+
+ if( bAdd )
+ {
+ SwFlyFrm *pFly = 0;
+ switch( aAnchorAttr.GetAnchorId() )
+ {
+ case FLY_AT_FLY:
+ pFly = new SwFlyLayFrm( this, pFrm );
+ break;
+
+ case FLY_AT_CNTNT:
+ case FLY_AUTO_CNTNT:
+ pFly = new SwFlyAtCntFrm( this, pFrm );
+ break;
+
+ case FLY_IN_CNTNT:
+ pFly = new SwFlyInCntFrm( this, pFrm );
+ break;
+#ifdef DBG_UTIL
+ default:
+ ASSERT( !this, "Neuer Ankertyp" );
+#endif
+ }
+ pFrm->AppendFly( pFly );
+ SwPageFrm *pPage = pFly->FindPageFrm();
+ if( pPage )
+ ::binfilter::RegistFlys( pPage, pFly );
+ }
+ }
+ }
+}
+
+SwFlyFrm* SwFlyFrmFmt::GetFrm( const Point* pPoint, const sal_Bool bCalcFrm ) const
+{
+ return (SwFlyFrm*)::binfilter::GetFrmOfModify( *(SwModify*)this, FRM_FLY,
+ pPoint, 0, bCalcFrm );
+}
+
+sal_Bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const
+{
+ switch( rInfo.Which() )
+ {
+ case RES_CONTENT_VISIBLE:
+ {
+ ((SwPtrMsgPoolItem&)rInfo).pObject =
+ SwClientIter( *(SwFlyFrmFmt*)this ).First( TYPE(SwFrm) );
+ }
+ return sal_False;
+
+ default:
+ return SwFrmFmt::GetInfo( rInfo );
+ }
+ return sal_True;
+}
+
+/** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
+
+ OD 22.08.2002 - overloading virtual method and its default implementation,
+ because format of fly frame provides transparent backgrounds.
+ Method determines, if background of fly frame is transparent.
+
+ @author OD
+
+ @return true, if background color is transparent, but not "no fill"
+ or the transparency of a existing background graphic is set.
+*/
+sal_Bool SwFlyFrmFmt::IsBackgroundTransparent() const
+{
+ sal_Bool bReturn = sal_False;
+
+ /// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
+ /// and there is no background graphic, it "inherites" the background
+ /// from its anchor.
+ if ( (GetBackground().GetColor().GetTransparency() != 0) &&
+ (GetBackground().GetColor() != COL_TRANSPARENT)
+ )
+ {
+ bReturn = sal_True;
+ }
+ else
+ {
+ const BfGraphicObject* pTmpGrf =
+ static_cast<const BfGraphicObject*>(GetBackground().GetGraphicObject());
+ if ( (pTmpGrf) &&
+ (pTmpGrf->GetAttr().GetTransparency() != 0)
+ )
+ {
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+}
+
+/** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898#
+
+ OD 08.10.2002 - method to determine, if the brush for drawing the
+ background is "inherited" from its parent/grandparent.
+ This is the case, if no background graphic is set and the background
+ color is "no fill"/"auto fill"
+ NOTE: condition is "copied" from method <SwFrm::GetBackgroundBrush(..).
+
+ @author OD
+
+ @return true, if background brush is "inherited" from parent/grandparent
+*/
+
+
+// class SwDrawFrmFmt
+// Implementierung teilweise inline im hxx
+
+#ifdef _MSC_VER
+#pragma optimize( "e", off )
+#endif
+
+SwDrawFrmFmt::~SwDrawFrmFmt()
+{
+ SwContact *pContact = FindContactObj();
+ delete pContact;
+}
+
+#ifdef _MSC_VER
+#pragma optimize( "e", on )
+#endif
+
+void SwDrawFrmFmt::MakeFrms()
+{
+ SwDrawContact *pContact = (SwDrawContact*)FindContactObj();
+ if ( pContact )
+ pContact->ConnectToLayout();
+}
+
+void SwDrawFrmFmt::DelFrms()
+{
+ SwDrawContact *pContact = (SwDrawContact *)FindContactObj();
+ if ( pContact ) //fuer den Reader und andere Unabwaegbarkeiten.
+ pContact->DisconnectFromLayout();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_calcmove.cxx b/binfilter/bf_sw/source/core/layout/sw_calcmove.cxx
new file mode 100644
index 000000000000..12459849a0ba
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_calcmove.cxx
@@ -0,0 +1,1643 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "pagefrm.hxx"
+#include "viewsh.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "dflyobj.hxx"
+#include "dcontact.hxx"
+#include "flyfrm.hxx"
+#include "frmtool.hxx"
+#include "txtftn.hxx"
+#include "fmtftn.hxx"
+
+#include <bf_svx/keepitem.hxx>
+
+#include <vcl/outdev.hxx>
+
+#include <fmtfsize.hxx>
+#include <fmtanchr.hxx>
+#include <fmtclbl.hxx>
+
+#include "tabfrm.hxx"
+#include "ftnfrm.hxx"
+#include "txtfrm.hxx"
+#include "frmsh.hxx"
+#include "pagedesc.hxx"
+#include "sectfrm.hxx"
+#include "dbg_lay.hxx"
+namespace binfilter {
+
+
+//------------------------------------------------------------------------
+// Move-Methoden
+//------------------------------------------------------------------------
+
+/*************************************************************************
+|*
+|* SwCntntFrm::ShouldBwdMoved()
+|*
+|* Beschreibung Returnwert sagt, ob der Frm verschoben werden sollte.
+|* Ersterstellung MA 05. Dec. 96
+|* Letzte Aenderung MA 05. Dec. 96
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwCntntFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL & )
+/*N*/ {
+/*N*/ if ( (SwFlowFrm::IsMoveBwdJump() || !IsPrevObjMove()))
+/*N*/ {
+/*N*/ //Das zurueckfliessen von Frm's ist leider etwas Zeitintensiv.
+/*N*/ //Der haufigste Fall ist der, dass dort wo der Frm hinfliessen
+/*N*/ //moechte die FixSize die gleiche ist, die der Frm selbst hat.
+/*N*/ //In diesem Fall kann einfach geprueft werden, ob der Frm genug
+/*N*/ //Platz fuer seine VarSize findet, ist dies nicht der Fall kann
+/*N*/ //gleich auf das Verschieben verzichtet werden.
+/*N*/ //Die Pruefung, ob der Frm genug Platz findet fuehrt er selbst
+/*N*/ //durch, dabei wird beruecksichtigt, dass er sich moeglicherweise
+/*N*/ //aufspalten kann.
+/*N*/ //Wenn jedoch die FixSize eine andere ist oder Flys im Spiel sind
+/*N*/ //(an der alten oder neuen Position) hat alle Prueferei keinen Sinn
+/*N*/ //der Frm muss dann halt Probehalber verschoben werden (Wenn ueberhaupt
+/*N*/ //etwas Platz zur Verfuegung steht).
+/*N*/
+/*N*/ //Die FixSize der Umgebungen in denen Cntnts herumlungern ist immer
+/*N*/ //Die Breite.
+/*N*/
+/*N*/ //Wenn mehr als ein Blatt zurueckgegangen wurde (z.B. ueberspringen
+/*N*/ //von Leerseiten), so muss in jedemfall gemoved werden - sonst wuerde,
+/*N*/ //falls der Frm nicht in das Blatt passt, nicht mehr auf die
+/*N*/ //dazwischenliegenden Blaetter geachtet werden.
+/*N*/ BYTE nMoveAnyway = 0;
+/*N*/ SwPageFrm * const pNewPage = pNewUpper->FindPageFrm();
+/*N*/ SwPageFrm *pOldPage = FindPageFrm();
+/*N*/
+/*N*/ if ( SwFlowFrm::IsMoveBwdJump() )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ if( IsInFtn() && IsInSct() )
+/*N*/ {
+/*?*/ SwFtnFrm* pFtn = FindFtnFrm();
+/*?*/ SwSectionFrm* pMySect = pFtn->FindSctFrm();
+/*?*/ if( pMySect && pMySect->IsFtnLock() )
+/*?*/ {
+/*?*/ SwSectionFrm *pSect = pNewUpper->FindSctFrm();
+/*?*/ while( pSect && pSect->IsInFtn() )
+/*?*/ pSect = pSect->GetUpper()->FindSctFrm();
+/*?*/ ASSERT( pSect, "Escaping footnote" );
+/*?*/ if( pSect != pMySect )
+/*?*/ return FALSE;
+/*?*/ }
+/*N*/ }
+/*N*/ SWRECTFN( this )
+/*N*/ SWRECTFNX( pNewUpper )
+/*N*/ if( Abs( (pNewUpper->Prt().*fnRectX->fnGetWidth)() -
+/*N*/ (GetUpper()->Prt().*fnRect->fnGetWidth)() ) > 1 )
+/*N*/ nMoveAnyway = 2; // Damit kommt nur noch ein _WouldFit mit Umhaengen in Frage
+/*N*/ if ( (nMoveAnyway |= BwdMoveNecessary( pOldPage, Frm() )) < 3 )
+/*N*/ {
+/*N*/ SwTwips nSpace = 0;
+/*N*/ SwRect aRect( pNewUpper->Prt() );
+/*N*/ aRect.Pos() += pNewUpper->Frm().Pos();
+/*N*/ const SwFrm *pPrevFrm = pNewUpper->Lower();
+/*N*/ while ( pPrevFrm )
+/*N*/ {
+/*N*/ (aRect.*fnRectX->fnSetTop)(
+/*N*/ (pPrevFrm->Frm().*fnRectX->fnGetBottom)() );
+/*N*/ pPrevFrm = pPrevFrm->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ nMoveAnyway |= BwdMoveNecessary( pNewPage, aRect);
+/*N*/ if ( nMoveAnyway < 3 )
+/*N*/ {
+/*N*/ //Zur Verfuegung stehenden Raum berechnen.
+/*N*/ nSpace = (aRect.*fnRectX->fnGetHeight)();
+/*N*/ if ( IsInFtn() || GetAttrSet()->GetDoc()->IsBrowseMode() ||
+/*N*/ ( pNewUpper->IsInSct() && ( pNewUpper->IsSctFrm() ||
+/*N*/ ( pNewUpper->IsColBodyFrm() &&
+/*N*/ !pNewUpper->GetUpper()->GetPrev() &&
+/*N*/ !pNewUpper->GetUpper()->GetNext() ) ) ) )
+/*N*/ nSpace += pNewUpper->Grow( LONG_MAX PHEIGHT, TRUE );
+/*N*/ if ( nSpace )
+/*N*/ {
+/*N*/ //Keine Beruecksichtigung der Fussnoten die an dem Absatz
+/*N*/ //kleben, denn dies wuerde extrem unuebersichtlichen Code
+/*N*/ //beduerfen (wg. Beruecksichtung der Breiten und vor allem
+/*N*/ //der Flys, die ja wieder Einfluss auf die Fussnoten nehmen...).
+/*N*/
+/*N*/ // _WouldFit kann bei gleicher Breite und _nur_ selbst verankerten Flys
+/*N*/ // befragt werden.
+/*N*/ // _WouldFit kann auch gefragt werden, wenn _nur_ fremdverankerte Flys vorliegen,
+/*N*/ // dabei ist sogar die Breite egal, da ein TestFormat in der neuen Umgebung
+/*N*/ // vorgenommen wird.
+/*N*/ return _WouldFit( nSpace, pNewUpper, nMoveAnyway == 2 );
+/*N*/ }
+/*N*/ //Bei einem spaltigen Bereichsfrischling kann _WouldFit kein
+/*N*/ //brauchbares Ergebnis liefern, also muessen wir wirklich
+/*N*/ //zurueckfliessen
+/*N*/ else if( pNewUpper->IsInSct() && pNewUpper->IsColBodyFrm() &&
+/*N*/ !(pNewUpper->Prt().*fnRectX->fnGetWidth)() &&
+/*N*/ ( pNewUpper->GetUpper()->GetPrev() ||
+/*N*/ pNewUpper->GetUpper()->GetNext() ) )
+/*?*/ return TRUE;
+/*N*/ else
+/*N*/ return FALSE; // Kein Platz, dann ist es sinnlos, zurueckzufliessen
+/*N*/ }
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+//------------------------------------------------------------------------
+// Calc-Methoden
+//------------------------------------------------------------------------
+
+/*************************************************************************
+|*
+|* SwFrm::Prepare()
+|*
+|* Beschreibung Bereitet den Frm auf die 'Formatierung' (MakeAll())
+|* vor. Diese Methode dient dazu auf dem Stack Platz einzusparen,
+|* denn zur Positionsberechnung des Frm muss sichergestellt sein, dass
+|* die Position von Upper und Prev gueltig sind, mithin also ein
+|* rekursiver Aufruf (Schleife waere relativ teuer, da selten notwendig).
+|* Jeder Aufruf von MakeAll verbraucht aber ca. 500Byte Stack -
+|* das Ende ist leicht abzusehen. _Prepare benoetigt nur wenig Stack,
+|* deshalb solle der Rekursive Aufruf hier kein Problem sein.
+|* Ein weiterer Vorteil ist, das eines schoenen Tages das _Prepare und
+|* damit die Formatierung von Vorgaengern umgangen werden kann.
+|* So kann evtl. mal 'schnell' an's Dokumentende gesprungen werden.
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 13. Dec. 93
+|*
+|*************************************************************************/
+//Zwei kleine Freundschaften werden hier zu einem Geheimbund.
+/*N*/ inline void PrepareLock( SwFlowFrm *pTab )
+/*N*/ {
+/*N*/ pTab->LockJoin();
+/*N*/ }
+/*N*/ inline void PrepareUnlock( SwFlowFrm *pTab )
+/*N*/ {
+/*N*/ pTab->UnlockJoin();
+/*N*/
+/*N*/ }
+
+
+
+/*N*/ void SwFrm::PrepareMake()
+/*N*/ {
+/*N*/ StackHack aHack;
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*M*/ if( !GetUpper()->IsSctFrm() && !GetUpper()->IsFooterFrm() )
+/*N*/ GetUpper()->Calc();
+/*N*/ ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." );
+/*N*/ if ( !GetUpper() )
+/*?*/ return;
+/*N*/
+/*N*/ const BOOL bCnt = IsCntntFrm();
+/*N*/ const BOOL bTab = IsTabFrm();
+/*N*/ BOOL bNoSect = IsInSct();
+/*N*/ BOOL bOldTabLock = FALSE, bFoll = FALSE;
+/*N*/ SwFlowFrm* pThis = bCnt ? (SwCntntFrm*)this : NULL;
+/*N*/
+/*N*/ if ( bTab )
+/*N*/ {
+/*N*/ pThis = (SwTabFrm*)this;
+/*N*/ bOldTabLock = ((SwTabFrm*)this)->IsJoinLocked();
+/*N*/ ::binfilter::PrepareLock( (SwTabFrm*)this );
+/*N*/ bFoll = pThis->IsFollow();
+/*N*/ }
+/*N*/ else if( IsSctFrm() )
+/*N*/ {
+/*N*/ pThis = (SwSectionFrm*)this;
+/*N*/ bFoll = pThis->IsFollow();
+/*N*/ bNoSect = FALSE;
+/*N*/ }
+/*N*/ else if ( bCnt && TRUE == (bFoll = pThis->IsFollow()) &&
+/*N*/ GetPrev() )
+/*N*/ {
+/*N*/ //Wenn der Master gereade ein CalcFollow ruft braucht die Kette
+/*N*/ //nicht durchlaufen werden. Das spart Zeit und vermeidet Probleme.
+/*N*/ if ( ((SwTxtFrm*)((SwTxtFrm*)this)->FindMaster())->IsLocked() )
+/*N*/ {
+/*N*/ MakeAll();
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwFrm *pFrm = GetUpper()->Lower();
+/*N*/ while ( pFrm != this )
+/*N*/ {
+/*N*/ ASSERT( pFrm, ":-( Layoutgeruest wackelig (this not found)." );
+/*N*/ if ( !pFrm )
+/*?*/ return; //Oioioioi ...
+/*N*/
+/*N*/ if ( !pFrm->IsValid() )
+/*N*/ {
+/*N*/ //Ein kleiner Eingriff der hoffentlich etwas zur Verbesserung
+/*N*/ //der Stabilitaet beitraegt:
+/*N*/ //Wenn ich Follow _und_ Nachbar eines Frms vor mir bin,
+/*N*/ //so wuerde dieser mich beim Formatieren deleten; wie jeder
+/*N*/ //leicht sehen kann waere dies eine etwas unuebersichtliche
+/*N*/ //Situation die es zu vermeiden gilt.
+/*N*/ if ( bFoll && pFrm->IsFlowFrm() &&
+/*N*/ (SwFlowFrm::CastFlowFrm(pFrm))->IsAnFollow( pThis ) )
+/*?*/ break;
+/*N*/
+/*N*/ //MA: 24. Mar. 94, Calc wuerde doch nur wieder in ein _Prepare laufen und so
+/*N*/ //die ganze Kette nocheinmal abhuenern.
+/*N*/ // pFrm->Calc();
+/*N*/ pFrm->MakeAll();
+/*N*/ if( IsSctFrm() && !((SwSectionFrm*)this)->GetSection() )
+/*?*/ break;
+/*N*/ }
+/*N*/ //Die Kette kann bei CntntFrms waehrend des durchlaufens
+/*N*/ //aufgebrochen werden, deshalb muss der Nachfolger etwas
+/*N*/ //umstaendlich ermittelt werden. However, irgendwann _muss_
+/*N*/ //ich wieder bei mir selbst ankommen.
+/*N*/ pFrm = pFrm->FindNext();
+/*N*/
+/*N*/ //Wenn wir in einem SectionFrm gestartet sind, koennen wir durch die
+/*N*/ //MakeAll-Aufrufe in einen Section-Follow gewandert sein.
+/*N*/ //FindNext liefert allerdings den SectionFrm, nicht seinen Inhalt.
+/*N*/ // => wir finden uns selbst nicht mehr!
+/*N*/ if( bNoSect && pFrm && pFrm->IsSctFrm() )
+/*N*/ {
+/*N*/ SwFrm* pCnt = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if( pCnt )
+/*N*/ pFrm = pCnt;
+/*N*/ }
+/*N*/ }
+/*N*/ ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech II)." );
+/*N*/ if ( !GetUpper() )
+/*?*/ return;
+/*N*/
+/*M*/ if( !GetUpper()->IsSctFrm() && !GetUpper()->IsFooterFrm() )
+/*N*/ GetUpper()->Calc();
+/*N*/
+/*N*/ ASSERT( GetUpper(), "Layoutgeruest wackelig (Upper wech III)." );
+/*N*/
+/*N*/ if ( bTab && !bOldTabLock )
+/*N*/ ::binfilter::PrepareUnlock( (SwTabFrm*)this );
+/*N*/ }
+/*N*/ MakeAll();
+/*N*/ }
+
+/*N*/ void SwFrm::OptPrepareMake()
+/*N*/ {
+/*M*/ if ( GetUpper() && !GetUpper()->IsFooterFrm() )
+/*N*/ {
+/*N*/ GetUpper()->Calc();
+/*N*/ ASSERT( GetUpper(), ":-( Layoutgeruest wackelig (Upper wech)." );
+/*N*/ if ( !GetUpper() )
+/*?*/ return;
+/*N*/ }
+/*N*/ if ( GetPrev() && !GetPrev()->IsValid() )
+/*N*/ PrepareMake();
+/*N*/ else
+/*N*/ {
+/*N*/ StackHack aHack;
+/*N*/ MakeAll();
+/*N*/ }
+/*N*/ }
+
+
+
+
+/*************************************************************************
+|*
+|* SwFrm::MakePos()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 24. May. 93
+|*
+|*************************************************************************/
+
+// Hier wird GetPrev() zurueckgegeben, allerdings werden
+// dabei leere SectionFrms ueberlesen
+/*N*/ SwFrm* lcl_Prev( SwFrm* pFrm, BOOL bSectPrv = TRUE )
+/*N*/ {
+/*N*/ SwFrm* pRet = pFrm->GetPrev();
+/*N*/ if( !pRet && pFrm->GetUpper() && pFrm->GetUpper()->IsSctFrm() &&
+/*N*/ bSectPrv && !pFrm->IsColumnFrm() )
+/*N*/ pRet = pFrm->GetUpper()->GetPrev();
+/*N*/ while( pRet && pRet->IsSctFrm() &&
+/*N*/ !((SwSectionFrm*)pRet)->GetSection() )
+/*N*/ pRet = pRet->GetPrev();
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ SwFrm* lcl_NotHiddenPrev( SwFrm* pFrm )
+/*N*/ {
+/*N*/ SwFrm *pRet = pFrm;
+/*N*/ do
+/*N*/ {
+/*N*/ pRet = lcl_Prev( pRet );
+/*N*/ } while ( pRet && pRet->IsTxtFrm() && ((SwTxtFrm*)pRet)->IsHiddenNow() );
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ void SwFrm::MakePos()
+/*N*/ {
+/*N*/ if ( !bValidPos )
+/*N*/ {
+/*N*/ bValidPos = TRUE;
+/*N*/ FASTBOOL bUseUpper = FALSE;
+/*N*/ SwFrm* pPrv = lcl_Prev( this );
+/*N*/ if ( pPrv &&
+/*N*/ ( !pPrv->IsCntntFrm() ||
+/*N*/ ( ((SwCntntFrm*)pPrv)->GetFollow() != this ) )
+/*N*/ )
+/*N*/ {
+/*N*/ if ( !StackHack::IsLocked() &&
+/*N*/ ( !IsInSct() || IsSctFrm() ) &&
+/*N*/ !pPrv->IsSctFrm() &&
+/*N*/ !pPrv->GetAttrSet()->GetKeep().GetValue()
+/*N*/ )
+/*N*/ {
+/*N*/ pPrv->Calc(); //hierbei kann der Prev verschwinden!
+/*N*/ }
+/*N*/ else if ( pPrv->Frm().Top() == 0 )
+/*N*/ {
+/*N*/ bUseUpper = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pPrv = lcl_Prev( this, FALSE );
+/*N*/ USHORT nMyType = GetType();
+/*N*/ SWRECTFN( this )
+/*N*/ if ( !bUseUpper && pPrv )
+/*N*/ {
+/*N*/ aFrm.Pos( pPrv->Frm().Pos() );
+/*N*/ if( FRM_NEIGHBOUR & nMyType )
+/*N*/ {
+/*N*/ BOOL bR2L = IsRightToLeft();
+/*N*/ if( bR2L )
+/*N*/ (aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() -
+/*N*/ (aFrm.*fnRect->fnGetWidth)() );
+/*N*/ else
+/*N*/ (aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() +
+/*N*/ (pPrv->Frm().*fnRect->fnGetWidth)() );
+/*N*/ }
+/*N*/ else if( bVert && FRM_NOTE_VERT & nMyType )
+/*N*/ {
+/*N*/ if( bReverse )
+/*N*/ aFrm.Pos().X() += pPrv->Frm().Width();
+/*N*/ else
+/*N*/ aFrm.Pos().X() -= aFrm.Width();
+/*N*/ }
+/*N*/ else
+/*N*/ aFrm.Pos().Y() += pPrv->Frm().Height();
+/*N*/ }
+/*N*/ else if ( GetUpper() )
+/*N*/ {
+/*N*/ /// OD 15.10.2002 #103517# - add safeguard for <SwFooterFrm::Calc()>
+/*N*/ /// If parent frame is a footer frame and its <ColLocked()>, then
+/*N*/ /// do *not* calculate it.
+/*N*/ /// NOTE: Footer frame is <ColLocked()> during its
+/*N*/ /// <FormatSize(..)>, which is called from <Format(..)>, which
+/*N*/ /// is called from <MakeAll()>, which is called from <Calc()>.
+/*N*/ if ( !GetUpper()->IsSctFrm() &&
+/*N*/ !( GetUpper()->IsFooterFrm() &&
+/*N*/ GetUpper()->IsColLocked() )
+/*N*/ )
+/*N*/ {
+/*N*/ SwFlyFrm* pTmpFly = FindFlyFrm();
+/*N*/ if( !pTmpFly || !pTmpFly->IsFlyInCntFrm() )
+/*N*/ GetUpper()->Calc();
+/*N*/ }
+/*N*/ pPrv = lcl_Prev( this, FALSE );
+/*N*/ if ( !bUseUpper && pPrv )
+/*N*/ {
+/*N*/ aFrm.Pos( pPrv->Frm().Pos() );
+/*N*/ if( FRM_NEIGHBOUR & nMyType )
+/*N*/ {
+/*N*/ BOOL bR2L = IsRightToLeft();
+/*N*/ if( bR2L )
+/*N*/ (aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() -
+/*N*/ (aFrm.*fnRect->fnGetWidth)() );
+/*N*/ else
+/*N*/ (aFrm.*fnRect->fnSetPosX)( (aFrm.*fnRect->fnGetLeft)() +
+/*N*/ (pPrv->Frm().*fnRect->fnGetWidth)() );
+/*N*/ }
+/*N*/ else if( bVert && FRM_NOTE_VERT & nMyType )
+/*N*/ {
+/*N*/ if( bReverse )
+/*N*/ aFrm.Pos().X() += pPrv->Frm().Width();
+/*N*/ else
+/*N*/ aFrm.Pos().X() -= aFrm.Width();
+/*N*/ }
+/*N*/ else
+/*N*/ aFrm.Pos().Y() += pPrv->Frm().Height();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrm.Pos( GetUpper()->Frm().Pos() );
+/*N*/ aFrm.Pos() += GetUpper()->Prt().Pos();
+/*N*/ if( FRM_NEIGHBOUR & nMyType && IsRightToLeft() )
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ aFrm.Pos().Y() += GetUpper()->Prt().Height()
+/*N*/ - aFrm.Height();
+/*N*/ else
+/*N*/ aFrm.Pos().X() += GetUpper()->Prt().Width()
+/*N*/ - aFrm.Width();
+/*N*/ }
+/*N*/ else if( bVert && FRM_NOTE_VERT & nMyType && !bReverse )
+/*N*/ aFrm.Pos().X() -= aFrm.Width() - GetUpper()->Prt().Width();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ aFrm.Pos().X() = aFrm.Pos().Y() = 0;
+/*N*/ if( IsBodyFrm() && bVert && !bReverse && GetUpper() )
+/*N*/ aFrm.Pos().X() += GetUpper()->Prt().Width() - aFrm.Width();
+/*N*/ bValidPos = TRUE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::MakeAll()
+|*
+|* Ersterstellung MA 23. Feb. 93
+|* Letzte Aenderung MA 20. Jul. 98
+|*
+|*************************************************************************/
+
+/*N*/ void lcl_CheckObjects( SwSortDrawObjs* pSortedObjs, SwFrm* pFrm, long& rBot )
+/*N*/ {
+/*N*/ //Und dann kann es natuerlich noch Absatzgebundene
+/*N*/ //Rahmen geben, die unterhalb ihres Absatzes stehen.
+/*N*/ long nMax = 0;
+/*N*/ for ( USHORT i = 0; i < pSortedObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pSortedObjs)[i];
+/*N*/ long nTmp = 0;
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ if( pFly->Frm().Top() != WEIT_WECH &&
+/*N*/ ( pFrm->IsPageFrm() ? pFly->IsFlyLayFrm() :
+/*N*/ ( pFly->IsFlyAtCntFrm() &&
+/*N*/ ( pFrm->IsBodyFrm() ? pFly->GetAnchor()->IsInDocBody() :
+/*N*/ pFly->GetAnchor()->IsInFtn() ) ) ) )
+/*N*/ {
+/*N*/ nTmp = pFly->Frm().Bottom();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nTmp = pObj->GetBoundRect().Bottom();
+/*N*/ nMax = Max( nTmp, nMax );
+/*N*/ }
+/*N*/ ++nMax; //Unterkante vs. Hoehe!
+/*N*/ rBot = Max( rBot, nMax );
+/*N*/ }
+
+
+/*N*/ void SwPageFrm::MakeAll()
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
+/*N*/
+/*N*/ const SwRect aOldRect( Frm() ); //Anpassung der Root-Groesse
+/*N*/ const SwLayNotify aNotify( this ); //uebernimmt im DTor die Benachrichtigung
+/*N*/ SwBorderAttrAccess *pAccess = 0;
+/*N*/ const SwBorderAttrs*pAttrs = 0;
+/*N*/
+/*N*/ while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ if ( !bValidPos )
+/*N*/ {
+/*N*/ MakePos();
+/*N*/ if ( GetPrev() && !((SwPageFrm*)GetPrev())->IsEmptyPage() )
+/*N*/ aFrm.Pos().Y() += DOCUMENTBORDER/2;
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ if ( IsEmptyPage() )
+/*N*/ {
+/*N*/ Frm().Width( 0 ); Prt().Width( 0 );
+/*N*/ Frm().Height( 0 ); Prt().Height( 0 );
+/*N*/ Prt().Left( 0 ); Prt().Top( 0 );
+/*N*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( !pAccess )
+/*N*/ {
+/*N*/ pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this );
+/*N*/ pAttrs = pAccess->Get();
+/*N*/ }
+/*N*/ //Bei der BrowseView gelten feste Einstellungen.
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ if ( pSh && GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
+/*N*/ const long nTop = pAttrs->CalcTopLine() + aBorder.Height();
+/*N*/ const long nBottom = pAttrs->CalcBottomLine()+ aBorder.Height();
+/*N*/
+/*N*/ long nWidth = GetUpper() ? ((SwRootFrm*)GetUpper())->
+/*N*/ GetBrowseWidth() + 2 * aBorder.Width() : 0;
+/*N*/ // if ( !pSh->VisArea().Width() )
+/*N*/ // nWidth = Max( nWidth, 5000L );
+/*N*/ if ( nWidth < pSh->VisArea().Width() )
+/*N*/ nWidth = pSh->VisArea().Width();
+/*N*/ nWidth = Max( nWidth, 2L * aBorder.Width() + 4L*MM50 );
+/*N*/ Frm().Width( nWidth );
+/*N*/
+/*N*/ SwLayoutFrm *pBody = FindBodyCont();
+/*N*/ if ( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrm() )
+/*N*/ {
+/*N*/ //Fuer Spalten gilt eine feste Hoehe
+/*N*/ Frm().Height( pAttrs->GetSize().Height() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Fuer Seiten ohne Spalten bestimmt der Inhalt die
+/*N*/ //Groesse.
+/*N*/ long nBot = Frm().Top() + nTop;
+/*N*/ SwFrm *pFrm = Lower();
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ long nTmp = 0;
+/*N*/ SwFrm *pCnt = ((SwLayoutFrm*)pFrm)->ContainsAny();
+/*N*/ while ( pCnt && (pCnt->GetUpper() == pFrm ||
+/*N*/ ((SwLayoutFrm*)pFrm)->IsAnLower( pCnt )))
+/*N*/ {
+/*N*/ nTmp += pCnt->Frm().Height();
+/*N*/ if( pCnt->IsTxtFrm() &&
+/*N*/ ((SwTxtFrm*)pCnt)->IsUndersized() )
+/*N*/ nTmp += ((SwTxtFrm*)pCnt)->GetParHeight()
+/*N*/ - pCnt->Prt().Height();
+/*N*/ else if( pCnt->IsSctFrm() &&
+/*N*/ ((SwSectionFrm*)pCnt)->IsUndersized() )
+/*N*/ nTmp += ((SwSectionFrm*)pCnt)->Undersize();
+/*N*/ pCnt = pCnt->FindNext();
+/*N*/ }
+/*N*/ // OD 29.10.2002 #97265# - consider invalid body frame properties
+/*N*/ if ( pFrm->IsBodyFrm() &&
+/*N*/ ( !pFrm->GetValidSizeFlag() ||
+/*N*/ !pFrm->GetValidPrtAreaFlag() ) &&
+/*N*/ ( pFrm->Frm().Height() < pFrm->Prt().Height() )
+/*N*/ )
+/*N*/ {
+/*N*/ nTmp = Min( nTmp, pFrm->Frm().Height() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // OD 30.10.2002 #97265# - assert invalid lower property
+/*N*/ ASSERT( !(pFrm->Frm().Height() < pFrm->Prt().Height()),
+/*N*/ "SwPageFrm::MakeAll(): Lower with frame height < printing height" );
+/*N*/ nTmp += pFrm->Frm().Height() - pFrm->Prt().Height();
+/*N*/ }
+/*N*/ if ( !pFrm->IsBodyFrm() )
+/*N*/ nTmp = Min( nTmp, pFrm->Frm().Height() );
+/*N*/ nBot += nTmp;
+/*N*/ // Hier werden die absatzgebundenen Objekte ueberprueft,
+/*N*/ // ob sie ueber den Body/FtnCont hinausragen.
+/*N*/ if( pSortedObjs && !pFrm->IsHeaderFrm() &&
+/*N*/ !pFrm->IsFooterFrm() )
+/*N*/ lcl_CheckObjects( pSortedObjs, pFrm, nBot );
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ nBot += nBottom;
+/*N*/ //Und die Seitengebundenen
+/*N*/ if ( pSortedObjs )
+/*N*/ lcl_CheckObjects( pSortedObjs, this, nBot );
+/*N*/ nBot -= Frm().Top();
+/*N*/ if ( !GetPrev() )
+/*N*/ nBot = Max( nBot, pSh->VisArea().Height() );
+/*N*/ Frm().Height( nBot );
+/*N*/ }
+/*N*/ Prt().Left ( pAttrs->CalcLeftLine() + aBorder.Width() );
+/*N*/ Prt().Top ( nTop );
+/*N*/ Prt().Width( Frm().Width() - ( Prt().Left()
+/*N*/ + pAttrs->CalcRightLine() + aBorder.Width() ) );
+/*N*/ Prt().Height( Frm().Height() - (nTop + nBottom) );
+/*N*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ { //FixSize einstellen, bei Seiten nicht vom Upper sondern vom
+/*N*/ //Attribut vorgegeben.
+/*N*/ Frm().SSize( pAttrs->GetSize() );
+/*N*/ Format( pAttrs );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ } //while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ delete pAccess;
+/*N*/ if ( Frm() != aOldRect )
+/*N*/ AdjustRootSize( CHG_CHGPAGE, &aOldRect );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ //Der Upper (Root) muss mindestens so breit
+/*N*/ //sein, dass er die breiteste Seite aufnehmen kann.
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ ASSERT( GetUpper()->Prt().Width() >= aFrm.Width(), "Rootsize" );
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::MakeAll()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 28. Nov. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwLayoutFrm::MakeAll()
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
+/*N*/
+/*N*/ //uebernimmt im DTor die Benachrichtigung
+/*N*/ const SwLayNotify aNotify( this );
+/*N*/ BOOL bVert = IsVertical();
+/*N*/ SwRectFn fnRect = ( IsNeighbourFrm() == bVert )? fnRectHori : fnRectVert;
+/*N*/
+/*N*/ SwBorderAttrAccess *pAccess = 0;
+/*N*/ const SwBorderAttrs*pAttrs = 0;
+/*N*/
+/*N*/ while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ if ( !bValidPos )
+/*N*/ MakePos();
+/*N*/
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ //FixSize einstellen, die VarSize wird von Format() nach
+/*N*/ //Berechnung der PrtArea eingestellt.
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ SwTwips nPrtWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
+/*N*/ if( bVert && ( IsBodyFrm() || IsFtnContFrm() ) )
+/*N*/ {
+/*N*/ SwFrm* pNxt = GetPrev();
+/*N*/ while( pNxt && !pNxt->IsHeaderFrm() )
+/*N*/ pNxt = pNxt->GetPrev();
+/*N*/ if( pNxt )
+/*N*/ nPrtWidth -= pNxt->Frm().Height();
+/*N*/ pNxt = GetNext();
+/*N*/ while( pNxt && !pNxt->IsFooterFrm() )
+/*N*/ pNxt = pNxt->GetNext();
+/*N*/ if( pNxt )
+/*N*/ nPrtWidth -= pNxt->Frm().Height();
+/*N*/ }
+/*N*/ const long nDiff = nPrtWidth - (Frm().*fnRect->fnGetWidth)();
+/*N*/ if( IsNeighbourFrm() && IsRightToLeft() )
+/*N*/ (Frm().*fnRect->fnSubLeft)( nDiff );
+/*N*/ else
+/*N*/ (Frm().*fnRect->fnAddRight)( nDiff );
+/*N*/ }
+/*N*/ else
+/*N*/ { // Don't leave your upper
+/*N*/ const SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*N*/ if( (Frm().*fnRect->fnOverStep)( nDeadLine ) )
+/*N*/ bValidSize = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ if ( !pAccess )
+/*N*/ {
+/*N*/ pAccess = new SwBorderAttrAccess( SwFrm::GetCache(), this );
+/*N*/ pAttrs = pAccess->Get();
+/*N*/ }
+/*N*/ Format( pAttrs );
+/*N*/ }
+/*N*/ } //while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ if ( pAccess )
+/*N*/ delete pAccess;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::MakePrtArea()
+|*
+|* Ersterstellung MA 17. Nov. 92
+|* Letzte Aenderung MA 03. Mar. 96
+|*
+|*************************************************************************/
+
+/*N*/ BOOL SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
+/*N*/ {
+/*N*/ BOOL bSizeChgd = FALSE;
+/*N*/
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ bValidPrtArea = TRUE;
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ const FASTBOOL bTxtFrm = IsTxtFrm();
+/*N*/ SwTwips nUpper = 0;
+/*N*/ if ( bTxtFrm && ((SwTxtFrm*)this)->IsHiddenNow() )
+/*N*/ {
+/*N*/ if ( ((SwTxtFrm*)this)->HasFollow() )
+/*N*/ ((SwTxtFrm*)this)->JoinFrm();
+/*N*/
+/*N*/ if( (Prt().*fnRect->fnGetHeight)() )
+/*N*/ ((SwTxtFrm*)this)->HideHidden();
+/*N*/ Prt().Pos().X() = Prt().Pos().Y() = 0;
+/*N*/ (Prt().*fnRect->fnSetWidth)( (Frm().*fnRect->fnGetWidth)() );
+/*N*/ (Prt().*fnRect->fnSetHeight)( 0 );
+/*N*/ nUpper = -( (Frm().*fnRect->fnGetHeight)() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Vereinfachung: CntntFrms sind immer in der Hoehe Variabel!
+/*N*/
+/*N*/ //An der FixSize gibt der umgebende Frame die Groesse vor, die
+/*N*/ //Raender werden einfach abgezogen.
+/*N*/ const long nLeft = rAttrs.CalcLeft( this );
+/*N*/ #ifdef BIDI
+/*N*/ const long nRight = ((SwBorderAttrs&)rAttrs).CalcRight( this );
+/*N*/ (this->*fnRect->fnSetXMargins)( nLeft, nRight );
+/*N*/ #else
+/*N*/ (this->*fnRect->fnSetXMargins)( nLeft, rAttrs.CalcRight() );
+/*N*/ #endif
+/*N*/
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ SwTwips nWidthArea;
+/*N*/ if( pSh && 0!=(nWidthArea=(pSh->VisArea().*fnRect->fnGetWidth)()) &&
+/*N*/ GetUpper()->IsPageBodyFrm() && // nicht dagegen bei BodyFrms in Columns
+/*N*/ pSh->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ //Nicht ueber die Kante des sichbaren Bereiches hinausragen.
+/*N*/ //Die Seite kann breiter sein, weil es Objekte mit "ueberbreite"
+/*N*/ //geben kann (RootFrm::ImplCalcBrowseWidth())
+/*N*/ long nMinWidth = 0;
+/*N*/
+/*N*/ for (USHORT i = 0; GetDrawObjs() && i < GetDrawObjs()->Count();++i)
+/*N*/ {
+/*N*/ SdrObject *pObj = (*GetDrawObjs())[i];
+/*N*/ SwFrmFmt *pFmt = ::binfilter::FindFrmFmt( pObj );
+/*N*/ const FASTBOOL bFly = pObj->IsWriterFlyFrame();
+/*N*/ if ( bFly &&
+/*N*/ WEIT_WECH == ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->Frm().Width()||
+/*N*/ pFmt->GetFrmSize().GetWidthPercent() )
+/*N*/ continue;
+/*N*/
+/*N*/ if ( FLY_IN_CNTNT == pFmt->GetAnchor().GetAnchorId() )
+/*N*/ nMinWidth = Max( nMinWidth,
+/*N*/ bFly ? pFmt->GetFrmSize().GetWidth()
+/*N*/ : pObj->GetBoundRect().GetWidth() );
+/*N*/ }
+/*N*/
+/*N*/ const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
+/*N*/ long nWidth = nWidthArea - 2 * ( IsVertical() ?
+/*N*/ aBorder.Width() : aBorder.Height() );
+/*N*/ nWidth -= (Prt().*fnRect->fnGetLeft)();
+/*N*/ nWidth -= rAttrs.CalcRightLine();
+/*N*/ nWidth = Max( nMinWidth, nWidth );
+/*N*/ (Prt().*fnRect->fnSetWidth)( Min( nWidth,
+/*N*/ (Prt().*fnRect->fnGetWidth)() ) );
+/*N*/ }
+/*N*/
+/*N*/ if ( (Prt().*fnRect->fnGetWidth)() <= MINLAY )
+/*N*/ {
+/*N*/ //Die PrtArea sollte schon wenigstens MINLAY breit sein, passend
+/*N*/ //zu den Minimalwerten des UI
+/*N*/ (Prt().*fnRect->fnSetWidth)( Min( long(MINLAY),
+/*N*/ (Frm().*fnRect->fnGetWidth)() ) );
+/*N*/ SwTwips nTmp = (Frm().*fnRect->fnGetWidth)() -
+/*N*/ (Prt().*fnRect->fnGetWidth)();
+/*N*/ if( (Prt().*fnRect->fnGetLeft)() > nTmp )
+/*N*/ (Prt().*fnRect->fnSetLeft)( nTmp );
+/*N*/ }
+/*N*/
+/*N*/ //Fuer die VarSize gelten folgende Regeln:
+/*N*/ //1. Der erste einer Kette hat keinen Rand nach oben
+/*N*/ //2. Nach unten gibt es nie einen Rand
+/*N*/ //3. Der Rand nach oben ist das Maximum aus dem Abstand des
+/*N*/ // Prev nach unten und dem eigenen Abstand nach oben.
+/*N*/ //Die drei Regeln werden auf die Berechnung der Freiraeume, die von
+/*N*/ //UL- bzw. LRSpace vorgegeben werden, angewand. Es gibt in alle
+/*N*/ //Richtungen jedoch ggf. trotzdem einen Abstand; dieser wird durch
+/*N*/ //Umrandung und/oder Schatten vorgegeben.
+/*N*/ //4. Der Abstand fuer TextFrms entspricht mindestens dem Durchschuss
+/*N*/
+/*N*/ nUpper = CalcUpperSpace( &rAttrs, NULL );
+/*N*/ // in balanced columned section frames we do not want the
+/*N*/ // common border
+/*N*/ sal_Bool bCommonBorder = sal_True;
+/*N*/ if ( IsInSct() && GetUpper()->IsColBodyFrm() )
+/*N*/ {
+/*N*/ const SwSectionFrm* pSct = FindSctFrm();
+/*N*/ bCommonBorder = pSct->GetFmt()->GetBalancedColumns().GetValue();
+/*N*/ }
+/*N*/ SwTwips nLower = bCommonBorder ?
+/*N*/ rAttrs.GetBottomLine( this ) :
+/*N*/ rAttrs.CalcBottomLine();
+/*N*/
+/*N*/ (Prt().*fnRect->fnSetPosY)( (!bVert || bReverse) ? nUpper : nLower);
+/*N*/ nUpper += nLower;
+/*N*/ nUpper -= (Frm().*fnRect->fnGetHeight)() -
+/*N*/ (Prt().*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/ //Wenn Unterschiede zwischen Alter und neuer Groesse,
+/*N*/ //Grow() oder Shrink() rufen
+/*N*/ if ( nUpper )
+/*N*/ {
+/*N*/ if ( nUpper > 0 )
+/*N*/ GrowFrm( nUpper );
+/*N*/ else
+/*N*/ ShrinkFrm( -nUpper );
+/*N*/ bSizeChgd = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ return bSizeChgd;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::MakeAll()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 16. Dec. 96
+|*
+|*************************************************************************/
+
+#define STOP_FLY_FORMAT 10
+
+/*N*/ inline void ValidateSz( SwFrm *pFrm )
+/*N*/ {
+/*N*/ if ( pFrm )
+/*N*/ {
+/*N*/ pFrm->bValidSize = TRUE;
+/*N*/ pFrm->bValidPrtArea = TRUE;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwCntntFrm::MakeAll()
+/*N*/ {
+/*N*/ ASSERT( GetUpper(), "keinen Upper?" );
+/*N*/ ASSERT( IsTxtFrm(), "MakeAll(), NoTxt" );
+/*N*/
+/*N*/ if ( !IsFollow() && StackHack::IsLocked() )
+/*N*/ return;
+/*N*/
+/*N*/ if ( IsJoinLocked() )
+/*N*/ return;
+/*N*/
+/*N*/ ASSERT( !((SwTxtFrm*)this)->IsSwapped(), "Calculation of a swapped frame" );
+/*N*/
+/*N*/ StackHack aHack;
+/*N*/
+/*N*/ if ( ((SwTxtFrm*)this)->IsLocked() )
+/*N*/ {
+/*N*/ ASSERT( FALSE, "Format fuer gelockten TxtFrm." );
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ LockJoin();
+/*N*/ long nFormatCount = 0;
+/*N*/ PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ SwDoc *pDoc = GetAttrSet()->GetDoc();
+/*N*/ if( pDoc )
+/*N*/ {
+/*N*/ static sal_Bool bWarn = sal_False;
+/*N*/ if( pDoc->InXMLExport() )
+/*N*/ {
+/*N*/ ASSERT( bWarn, "Formatting during XML-export!" );
+/*N*/ bWarn = sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ bWarn = sal_False;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ //uebernimmt im DTor die Benachrichtigung
+/*N*/ SwCntntNotify *pNotify = new SwCntntNotify( this );
+/*N*/
+/*N*/ BOOL bMakePage = TRUE; //solange TRUE kann eine neue Seite
+/*N*/ //angelegt werden (genau einmal)
+/*N*/ BOOL bMovedBwd = FALSE; //Wird TRUE wenn der Frame zurueckfliesst
+/*N*/ BOOL bMovedFwd = FALSE; //solange FALSE kann der Frm zurueck-
+/*N*/ //fliessen (solange, bis er einmal
+/*N*/ //vorwaerts ge'moved wurde).
+/*N*/ BOOL bFormatted = FALSE; //Fuer die Witwen und Waisen Regelung
+/*N*/ //wird der letzte CntntFrm einer Kette
+/*N*/ //u.U. zum Formatieren angeregt, dies
+/*N*/ //braucht nur einmal zu passieren.
+/*N*/ //Immer wenn der Frm gemoved wird muss
+/*N*/ //das Flag zurueckgesetzt werden.
+/*N*/ BOOL bMustFit = FALSE; //Wenn einmal die Notbremse gezogen wurde,
+/*N*/ //werden keine anderen Prepares mehr
+/*N*/ //abgesetzt.
+/*N*/ BOOL bFitPromise = FALSE; //Wenn ein Absatz nicht passte, mit WouldFit
+/*N*/ //aber verspricht, dass er sich passend
+/*N*/ //einstellt wird dieses Flag gesetzt.
+/*N*/ //Wenn er dann sein Versprechen nicht haelt,
+/*N*/ //kann kontrolliert verfahren werden.
+/*N*/ BOOL bMoveable;
+/*N*/ const BOOL bFly = IsInFly();
+/*N*/ const BOOL bTab = IsInTab();
+/*N*/ const BOOL bFtn = IsInFtn();
+/*N*/ const BOOL bSct = IsInSct();
+/*N*/ Point aOldFrmPos; //Damit bei Turnarounds jew. mit der
+/*N*/ Point aOldPrtPos; //letzten Pos verglichen und geprueft
+/*N*/ //werden kann, ob ein Prepare sinnvoll ist.
+/*N*/
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/
+/*N*/ const BOOL bKeep = IsKeep( rAttrs );
+/*N*/
+/*N*/ SwSaveFtnHeight *pSaveFtn = 0;
+/*N*/ if ( bFtn )
+/*N*/ {
+/*N*/ SwFtnFrm *pFtn = FindFtnFrm();
+/*N*/ SwSectionFrm* pSct = pFtn->FindSctFrm();
+/*N*/ if ( !((SwTxtFrm*)pFtn->GetRef())->IsLocked() )
+/*N*/ {
+/*N*/ SwFtnBossFrm* pBoss = pFtn->GetRef()->FindFtnBossFrm(
+/*N*/ pFtn->GetAttr()->GetFtn().IsEndNote() );
+/*N*/ if( !pSct || pSct->IsColLocked() || !pSct->Growable() )
+/*N*/ pSaveFtn = new SwSaveFtnHeight( pBoss,
+/*N*/ ((SwTxtFrm*)pFtn->GetRef())->GetFtnLine( pFtn->GetAttr(),
+/*N*/ pFtn->IsBackMoveLocked() ) );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Wenn ein Follow neben seinem Master steht und nicht passt, kann er
+/*N*/ //gleich verschoben werden.
+/*N*/ if( lcl_Prev( this ) && ((SwTxtFrm*)this)->IsFollow() && IsMoveable() )
+/*N*/ {
+/*N*/ bMovedFwd = TRUE;
+/*N*/ MoveFwd( bMakePage, FALSE );
+/*N*/ }
+/*N*/
+/*N*/ // OD 08.11.2002 #104840# - check footnote content for forward move.
+/*N*/ // If a content of a footnote is on a prior page/column as its invalid
+/*N*/ // reference, it can be moved forward.
+/*N*/ if ( bFtn && !bValidPos )
+/*N*/ {
+/*N*/ SwFtnFrm* pFtn = FindFtnFrm();
+/*N*/ SwCntntFrm* pRefCnt = pFtn ? pFtn->GetRef() : 0;
+/*N*/ if ( pRefCnt && !pRefCnt->IsValid() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/
+/*N*/ while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ if ( TRUE == (bMoveable = IsMoveable()) )
+/*N*/ {
+/*N*/ SwFrm *pPre = GetIndPrev();
+/*N*/ if ( CheckMoveFwd( bMakePage, bKeep, bMovedBwd ) )
+/*N*/ {
+/*N*/ SWREFRESHFN( this )
+/*N*/ bMovedFwd = TRUE;
+/*N*/ if ( bMovedBwd )
+/*N*/ {
+/*N*/ //Beim zurueckfliessen wurde der Upper angeregt sich
+/*N*/ //vollstaendig zu Painten, dass koennen wir uns jetzt
+/*N*/ //nach dem hin und her fliessen sparen.
+/*N*/ GetUpper()->ResetCompletePaint();
+/*N*/ //Der Vorgaenger wurde Invalidiert, das ist jetzt auch obsolete.
+/*N*/ ASSERT( pPre, "missing old Prev" );
+/*N*/ if( !pPre->IsSctFrm() )
+/*N*/ ::binfilter::ValidateSz( pPre );
+/*N*/ }
+/*N*/ bMoveable = IsMoveable();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ aOldFrmPos = (Frm().*fnRect->fnGetPos)();
+/*N*/ aOldPrtPos = (Prt().*fnRect->fnGetPos)();
+/*N*/
+/*N*/ if ( !bValidPos )
+/*N*/ MakePos();
+/*N*/
+/*N*/ //FixSize einstellen, die VarSize wird von Format() justiert.
+/*N*/ if ( !bValidSize )
+/*N*/ (Frm().*fnRect->fnSetWidth)( (GetUpper()->
+/*N*/ Prt().*fnRect->fnGetWidth)() );
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ const long nOldW = (Prt().*fnRect->fnGetWidth)();
+/*N*/ MakePrtArea( rAttrs );
+/*N*/ if ( nOldW != (Prt().*fnRect->fnGetWidth)() )
+/*N*/ Prepare( PREP_FIXSIZE_CHG );
+/*N*/ }
+/*N*/
+/*N*/ if ( aOldFrmPos != (Frm().*fnRect->fnGetPos)() )
+/*N*/ CalcFlys( TRUE );
+/*N*/ //Damit die Witwen- und Waisen-Regelung eine Change bekommt muss der
+/*N*/ //CntntFrm benachrichtigt werden.
+/*N*/ //Kriterium:
+/*N*/ //- Er muss Moveable sein (sonst mach das Spalten keinen Sinn.)
+/*N*/ //- Er muss mit der Unterkante der PrtArea des Upper ueberlappen.
+/*N*/ if ( !bMustFit )
+/*N*/ {
+/*N*/ BOOL bWidow = TRUE;
+/*N*/ const SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*N*/ if ( bMoveable && !bFormatted && ( GetFollow() ||
+/*N*/ ( (Frm().*fnRect->fnOverStep)( nDeadLine ) ) ) )
+/*N*/ {
+/*N*/ Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
+/*N*/ bValidSize = bWidow = FALSE;
+/*N*/ }
+/*N*/ if( (Frm().*fnRect->fnGetPos)() != aOldFrmPos ||
+/*N*/ (Prt().*fnRect->fnGetPos)() != aOldPrtPos )
+/*N*/ {
+/*N*/ // In diesem Prepare erfolgt ggf. ein _InvalidateSize().
+/*N*/ // bValidSize wird FALSE und das Format() wird gerufen.
+/*N*/ Prepare( PREP_POS_CHGD, (const void*)&bFormatted, FALSE );
+/*N*/ if ( bWidow && GetFollow() )
+/*N*/ { Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
+/*N*/ bValidSize = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ bValidSize = bFormatted = TRUE;
+/*N*/ ++nFormatCount;
+/*N*/ if( nFormatCount > STOP_FLY_FORMAT )
+/*N*/ SetFlyLock( TRUE );
+/*N*/ Format();
+/*N*/ }
+/*N*/
+ // FME 16.07.2003 #i16930# - removed this code because it did not work
+
+ // OD 04.04.2003 #108446# - react on the situation detected in the text
+ // formatting - see <SwTxtFrm::FormatAdjust(..)>:
+ // text frame has to move forward, because its text formatting stopped,
+ // created a follow and detected, that it contains no content.
+/* if ( IsTxtFrm() && bValidPos && bValidSize && bValidPrtArea &&
+ (Frm().*fnRect->fnGetHeight)() == 0 &&
+ HasFollow()
+ )
+ {
+ SwFrm* pOldUpper = GetUpper();
+ MoveFwd( TRUE, FALSE );
+ if ( GetUpper() != pOldUpper )
+ {
+ bMovedFwd = TRUE;
+ SWREFRESHFN( this )
+ continue;
+ }
+ } */
+/*N*/
+/*N*/ //Wenn ich der erste einer Kette bin koennte ich mal sehen ob
+/*N*/ //ich zurueckfliessen kann (wenn ich mich ueberhaupt bewegen soll).
+/*N*/ //Damit es keine Oszillation gibt, darf ich nicht gerade vorwaerts
+/*N*/ //geflossen sein.
+/*N*/ BOOL bDummy;
+/*N*/ if ( !lcl_Prev( this ) && !bMovedFwd && (bMoveable || (bFly && !bTab)) &&
+/*N*/ (!bFtn || !GetUpper()->FindFtnFrm()->GetPrev()) && MoveBwd( bDummy ))
+/*N*/ {
+/*N*/ SWREFRESHFN( this )
+/*N*/ bMovedBwd = TRUE;
+/*N*/ bFormatted = FALSE;
+/*N*/ if ( bKeep && bMoveable )
+/*N*/ {
+/*N*/ if( CheckMoveFwd( bMakePage, FALSE, bMovedBwd ) )
+/*N*/ {
+/*N*/ bMovedFwd = TRUE;
+/*N*/ bMoveable = IsMoveable();
+/*N*/ SWREFRESHFN( this )
+/*N*/ }
+/*N*/ Point aOldPos = (Frm().*fnRect->fnGetPos)();
+/*N*/ MakePos();
+/*N*/ if( aOldPos != (Frm().*fnRect->fnGetPos)() )
+/*N*/ {
+/*N*/ CalcFlys( TRUE );
+/*N*/ Prepare( PREP_POS_CHGD, (const void*)&bFormatted, FALSE );
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ (Frm().*fnRect->fnSetWidth)( (GetUpper()->
+/*N*/ Prt().*fnRect->fnGetWidth)() );
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ const long nOldW = (Prt().*fnRect->fnGetWidth)();
+/*N*/ MakePrtArea( rAttrs );
+/*N*/ if( nOldW != (Prt().*fnRect->fnGetWidth)() )
+/*N*/ Prepare( PREP_FIXSIZE_CHG, 0, FALSE );
+/*N*/ }
+/*N*/ if( GetFollow() )
+/*N*/ Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
+/*N*/ bValidSize = bFormatted = TRUE;
+/*N*/ Format();
+/*N*/ }
+/*N*/ }
+/*N*/ SwFrm *pNxt = HasFollow() ? NULL : FindNext();
+/*N*/ while( pNxt && pNxt->IsSctFrm() )
+/*N*/ { // Leere Bereiche auslassen, in die anderen hinein
+/*N*/ if( ((SwSectionFrm*)pNxt)->GetSection() )
+/*N*/ {
+/*N*/ SwFrm* pTmp = ((SwSectionFrm*)pNxt)->ContainsAny();
+/*N*/ if( pTmp )
+/*N*/ {
+/*N*/ pNxt = pTmp;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ pNxt = pNxt->FindNext();
+/*N*/ }
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ pNxt->Calc();
+/*N*/ if( bValidPos && !GetIndNext() )
+/*N*/ {
+/*N*/ SwSectionFrm *pSct = FindSctFrm();
+/*N*/ if( pSct && !pSct->GetValidSizeFlag() )
+/*N*/ {
+/*N*/ SwSectionFrm* pNxtSct = pNxt->FindSctFrm();
+/*N*/ if( pNxtSct && pSct->IsAnFollow( pNxtSct ) )
+/*N*/ bValidPos = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ bValidPos = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Der TxtFrm Validiert sich bei Fussnoten ggf. selbst, dass kann leicht
+/*N*/ //dazu fuehren, dass seine Position obwohl unrichtig valide ist.
+/*N*/ if ( bValidPos )
+/*N*/ {
+/*N*/ if ( bFtn )
+/*N*/ {
+/*N*/ bValidPos = FALSE;
+/*N*/ MakePos();
+/*N*/ aOldFrmPos = (Frm().*fnRect->fnGetPos)();
+/*N*/ aOldPrtPos = (Prt().*fnRect->fnGetPos)();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Wieder ein Wert ungueltig? - dann nochmal das ganze...
+/*N*/ if ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ continue;
+/*N*/
+/*N*/ //Fertig?
+/*N*/ // Achtung, wg. Hoehe==0, ist es besser statt Bottom() Top()+Height() zu nehmen
+/*N*/ // (kommt bei Undersized TxtFrms an der Unterkante eines spaltigen Bereichs vor)
+/*N*/ if( (Frm().*fnRect->fnBottomDist)( (GetUpper()->*fnRect->fnGetPrtBottom)() )
+/*N*/ >= 0 )
+/*N*/ {
+/*N*/ if ( bKeep && bMoveable )
+/*N*/ {
+/*N*/ //Wir sorgen dafuer, dass der Nachfolger gleich mit formatiert
+/*N*/ //wird. Dadurch halten wir das Heft in der Hand, bis wirklich
+/*N*/ //(fast) alles stabil ist. So vermeiden wir Endlosschleifen,
+/*N*/ //die durch staendig wiederholte Versuche entstehen.
+/*N*/ //Das bMoveFwdInvalid ist fuer #38407# notwendig. War urspruenglich
+/*N*/ //in flowfrm.cxx rev 1.38 behoben, das unterbrach aber obiges
+/*N*/ //Schema und spielte lieber Tuerme von Hanoi (#43669#).
+/*N*/ SwFrm *pNxt = HasFollow() ? NULL : FindNext();
+/*N*/ // Bei Bereichen nehmen wir lieber den Inhalt, denn nur
+/*N*/ // dieser kann ggf. die Seite wechseln
+/*N*/ while( pNxt && pNxt->IsSctFrm() )
+/*N*/ {
+/*N*/ if( ((SwSectionFrm*)pNxt)->GetSection() )
+/*N*/ {
+/*N*/ pNxt = ((SwSectionFrm*)pNxt)->ContainsAny();
+/*N*/ break;
+/*N*/ }
+/*N*/ pNxt = pNxt->FindNext();
+/*N*/ }
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ const FASTBOOL bMoveFwdInvalid = 0 != GetIndNext();
+/*N*/ const FASTBOOL bNxtNew =
+/*N*/ ( 0 == (pNxt->Prt().*fnRect->fnGetHeight)() ) &&
+/*N*/ (!pNxt->IsTxtFrm() ||!((SwTxtFrm*)pNxt)->IsHiddenNow());
+/*N*/ pNxt->Calc();
+/*N*/ if ( !bMovedBwd &&
+/*N*/ ((bMoveFwdInvalid && !GetIndNext()) ||
+/*N*/ bNxtNew) )
+/*N*/ {
+/*N*/ if( bMovedFwd )
+/*N*/ pNotify->SetInvaKeep();
+/*N*/ bMovedFwd = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ //Ich passe nicht mehr in meinen Uebergeordneten, also ist es jetzt
+/*N*/ //an der Zeit moeglichst konstruktive Veranderungen vorzunehmen
+/*N*/
+/*N*/ //Wenn ich den uebergeordneten Frm nicht verlassen darf, habe
+/*N*/ //ich ein Problem; Frei nach Artur Dent tun wir das einzige das man
+/*N*/ //mit einen nicht loesbaren Problem tun kann: wir ignorieren es - und
+/*N*/ //zwar mit aller Kraft.
+/*N*/ if ( !bMoveable || IsUndersized() )
+/*N*/ {
+/*N*/ if( !bMoveable && IsInTab() )
+/*N*/ {
+/*N*/ long nDiff = -(Frm().*fnRect->fnBottomDist)(
+/*N*/ (GetUpper()->*fnRect->fnGetPrtBottom)() );
+/*N*/ long nReal = GetUpper()->Grow( nDiff PHEIGHT );
+/*N*/ if( nReal )
+/*N*/ continue;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ //Wenn ich nun ueberhaupt ganz und garnicht in meinen Upper passe
+/*N*/ //so kann die Situation vielleicht doch noch durch Aufbrechen
+/*N*/ //aufgeklart werden. Diese Situation tritt bei einem frisch
+/*N*/ //erzeugten Follow auf, der zwar auf die Folgeseite geschoben wurde
+/*N*/ //aber selbst noch zu gross fuer diese ist; also wiederum
+/*N*/ //aufgespalten werden muss.
+/*N*/ //Wenn ich nicht passe und nicht Spaltbar (WouldFit()) bin, so schicke
+/*N*/ //ich meinem TxtFrmanteil die Nachricht, dass eben falls moeglich
+/*N*/ //trotz des Attributes 'nicht aufspalten' aufgespalten werden muss.
+/*N*/ BOOL bMoveOrFit = FALSE;
+/*N*/ BOOL bDontMoveMe = !GetIndPrev();
+/*N*/ if( bDontMoveMe && IsInSct() )
+/*N*/ {
+/*N*/ SwFtnBossFrm* pBoss = FindFtnBossFrm();
+/*N*/ bDontMoveMe = !pBoss->IsInSct() ||
+/*N*/ ( !pBoss->Lower()->GetNext() && !pBoss->GetPrev() );
+/*N*/ }
+/*N*/
+/*N*/ if ( bDontMoveMe && (Frm().*fnRect->fnGetHeight)() >
+/*N*/ (GetUpper()->Prt().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ if ( !bFitPromise )
+/*N*/ {
+/*N*/ SwTwips nTmp = (GetUpper()->Prt().*fnRect->fnGetHeight)() -
+/*N*/ (Prt().*fnRect->fnGetTop)();
+/*N*/ BOOL bSplit = !GetIndPrev();
+/*N*/ if ( nTmp > 0 && WouldFit( nTmp, bSplit ) )
+/*N*/ {
+/*N*/ Prepare( PREP_WIDOWS_ORPHANS, 0, FALSE );
+/*N*/ bValidSize = FALSE;
+/*N*/ bFitPromise = TRUE;
+/*N*/ continue;
+/*N*/ }
+ /* -----------------19.02.99 12:58-------------------
+ * Frueher wurde in Rahmen und Bereichen niemals versucht,
+ * durch bMoveOrFit den TxtFrm unter Verzicht auf seine
+ * Attribute (Widows,Keep) doch noch passend zu bekommen.
+ * Dies haette zumindest bei spaltigen Rahmen versucht
+ * werden muessen, spaetestens bei verketteten Rahmen und
+ * in Bereichen muss es versucht werden.
+ * Ausnahme: Wenn wir im FormatWidthCols stehen, duerfen die
+ * Attribute nicht ausser Acht gelassen werden.
+ * --------------------------------------------------*/
+/*N*/ else if ( !bFtn && bMoveable &&
+/*N*/ ( !bFly || !FindFlyFrm()->IsColLocked() ) &&
+/*N*/ ( !bSct || !FindSctFrm()->IsColLocked() ) )
+/*N*/ bMoveOrFit = TRUE;
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( FALSE, "+TxtFrm hat WouldFit-Versprechen nicht eingehalten." );
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/
+/*N*/ //Mal sehen ob ich irgenwo Platz finde...
+/*N*/ //Benachbarte Fussnoten werden in _MoveFtnCntFwd 'vorgeschoben'
+/*N*/ SwFrm *pPre = GetIndPrev();
+/*N*/ SwFrm *pOldUp = GetUpper();
+
+/* MA 13. Oct. 98: Was soll das denn sein!?
+ * AMA 14. Dec 98: Wenn ein spaltiger Bereich keinen Platz mehr fuer seinen ersten ContentFrm
+ * bietet, so soll dieser nicht nur in die naechste Spalte, sondern ggf. bis zur naechsten
+ * Seite wandern und dort einen Section-Follow erzeugen.
+ */
+/*N*/ if( IsInSct() && bMovedFwd && bMakePage && pOldUp->IsColBodyFrm() &&
+/*N*/ pOldUp->GetUpper()->GetUpper()->IsSctFrm() &&
+/*N*/ ( pPre || pOldUp->GetUpper()->GetPrev() ) &&
+/*N*/ ((SwSectionFrm*)pOldUp->GetUpper()->GetUpper())->MoveAllowed(this) )
+/*N*/ bMovedFwd = FALSE;
+/*N*/
+/*N*/ const sal_Bool bCheckForGrownBody = pOldUp->IsBodyFrm();
+/*N*/ const long nOldBodyHeight = (pOldUp->Frm().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ if ( !bMovedFwd && !MoveFwd( bMakePage, FALSE ) )
+/*N*/ bMakePage = FALSE;
+/*N*/ SWREFRESHFN( this )
+/*N*/
+/*N*/ // If MoveFwd moves the paragraph to the next page, a following
+/*N*/ // paragraph, which contains footnotes can can cause the old upper
+/*N*/ // frame to grow. In this case we explicitely allow a new check
+/*N*/ // for MoveBwd. Robust: We also check the bMovedBwd flag again.
+/*N*/ // If pOldUp was a footnote frame, it has been deleted inside MoveFwd.
+/*N*/ // Therefore we only check for growing body frames.
+/*N*/ if ( bCheckForGrownBody && ! bMovedBwd && pOldUp != GetUpper() &&
+/*N*/ (pOldUp->Frm().*fnRect->fnGetHeight)() > nOldBodyHeight )
+/*N*/ bMovedFwd = FALSE;
+/*N*/ else
+/*N*/ bMovedFwd = TRUE;
+/*N*/
+/*N*/ bFormatted = FALSE;
+/*N*/ if ( bMoveOrFit && GetUpper() == pOldUp )
+/*N*/ {
+/*N*/ Prepare( PREP_MUST_FIT, 0, FALSE );
+/*N*/ bValidSize = FALSE;
+/*N*/ bMustFit = TRUE;
+/*N*/ continue;
+/*N*/ }
+/*N*/ if ( bMovedBwd && GetUpper() )
+/*N*/ { //Unuetz gewordene Invalidierungen zuruecknehmen.
+/*N*/ GetUpper()->ResetCompletePaint();
+/*N*/ if( pPre && !pPre->IsSctFrm() )
+/*N*/ ::binfilter::ValidateSz( pPre );
+/*N*/ }
+/*N*/
+/*N*/ if ( bValidPos && bValidSize && bValidPrtArea && GetDrawObjs() &&
+/*N*/ Prt().SSize() != pNotify->Prt().SSize() )
+/*N*/ {
+/*N*/ //Wenn sich meine PrtArea in der Groesse verandert hat, so ist die
+/*N*/ //automatische Ausrichtung der Flys zum Teufel. Diese muss
+/*N*/ //Waehrend der Fahrt korrigiert werden, weil sie mich ggf. wiederum
+/*N*/ //invalidiert.
+/*N*/ SwDrawObjs &rObjs = *GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ ((SwVirtFlyDrawObj*)pO)->GetFlyFrm()->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ } //while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/
+/*N*/ if ( pSaveFtn )
+/*N*/ delete pSaveFtn;
+/*N*/
+/*N*/ UnlockJoin();
+/*N*/ if ( bMovedFwd || bMovedBwd )
+/*N*/ pNotify->SetInvaKeep();
+/*N*/ delete pNotify;
+/*N*/ SetFlyLock( FALSE );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::_WouldFit()
+|*
+|* Ersterstellung MA 28. Feb. 95
+|* Letzte Aenderung AMA 15. Feb. 99
+|*
+|*************************************************************************/
+
+
+
+
+/*N*/ void MakeNxt( SwFrm *pFrm, SwFrm *pNxt )
+/*N*/ {
+/*N*/ //fix(25455): Validieren, sonst kommt es zu einer Rekursion.
+/*N*/ //Der erste Versuch, der Abbruch mit pFrm = 0 wenn !Valid,
+/*N*/ //fuehrt leider zu dem Problem, dass das Keep dann u.U. nicht mehr
+/*N*/ //korrekt beachtet wird (27417)
+/*N*/ const BOOL bOldPos = pFrm->GetValidPosFlag();
+/*N*/ const BOOL bOldSz = pFrm->GetValidSizeFlag();
+/*N*/ const BOOL bOldPrt = pFrm->GetValidPrtAreaFlag();
+/*N*/ pFrm->bValidPos = pFrm->bValidPrtArea = pFrm->bValidSize = TRUE;
+/*N*/
+/*N*/ //fix(29272): Nicht MakeAll rufen, dort wird evtl. pFrm wieder invalidert
+/*N*/ //und kommt rekursiv wieder herein.
+/*N*/ if ( pNxt->IsCntntFrm() )
+/*N*/ {
+/*N*/ SwCntntNotify aNotify( (SwCntntFrm*)pNxt );
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNxt );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ if ( !pNxt->GetValidSizeFlag() )
+/*N*/ {
+/*N*/ if( pNxt->IsVertical() )
+/*N*/ pNxt->Frm().Height( pNxt->GetUpper()->Prt().Height() );
+/*N*/ else
+/*N*/ pNxt->Frm().Width( pNxt->GetUpper()->Prt().Width() );
+/*N*/ }
+/*N*/ ((SwCntntFrm*)pNxt)->MakePrtArea( rAttrs );
+/*N*/ pNxt->Format( &rAttrs );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwLayNotify aNotify( (SwLayoutFrm*)pNxt );
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNxt );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ if ( !pNxt->GetValidSizeFlag() )
+/*N*/ {
+/*N*/ if( pNxt->IsVertical() )
+/*N*/ pNxt->Frm().Height( pNxt->GetUpper()->Prt().Height() );
+/*N*/ else
+/*N*/ pNxt->Frm().Width( pNxt->GetUpper()->Prt().Width() );
+/*N*/ }
+/*N*/ pNxt->Format( &rAttrs );
+/*N*/ }
+/*N*/
+/*N*/ pFrm->bValidPos = bOldPos;
+/*N*/ pFrm->bValidSize = bOldSz;
+/*N*/ pFrm->bValidPrtArea = bOldPrt;
+/*N*/ }
+
+// Diese Routine ueberprueft, ob zwischen dem FtnBoss von pFrm und dem
+// von pNxt keine anderen FtnBosse liegen
+
+
+/*N*/ BOOL SwCntntFrm::_WouldFit( SwTwips nSpace, SwLayoutFrm *pNewUpper, BOOL bTstMove )
+/*N*/ {
+/*N*/ //Damit die Fussnote sich ihren Platz sorgsam waehlt, muss
+/*N*/ //sie in jedem Fall gemoved werden, wenn zwischen dem
+/*N*/ //neuen Upper und ihrer aktuellen Seite/Spalte mindestens eine
+/*N*/ //Seite/Spalte liegt.
+/*N*/ SwFtnFrm* pFtnFrm = 0;
+/*N*/ if ( IsInFtn() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ BOOL bRet;
+/*N*/ BOOL bSplit = !pNewUpper->Lower();
+/*N*/ SwCntntFrm *pFrm = this;
+/*N*/ const SwFrm *pPrev = pNewUpper->Lower();
+/*N*/ if( pPrev && pPrev->IsFtnFrm() )
+/*N*/ pPrev = ((SwFtnFrm*)pPrev)->Lower();
+/*N*/ while ( pPrev && pPrev->GetNext() )
+/*N*/ pPrev = pPrev->GetNext();
+/*N*/ do
+/*N*/ {
+/*N*/ if ( bTstMove || IsInFly() || ( IsInSct() &&
+/*N*/ ( pFrm->GetUpper()->IsColBodyFrm() || ( pFtnFrm &&
+/*N*/ pFtnFrm->GetUpper()->GetUpper()->IsColumnFrm() ) ) ) )
+/*N*/ {
+/*N*/ //Jetzt wirds ein bischen hinterlistig; empfindliche Gemueter sollten
+/*N*/ //lieber wegsehen. Wenn ein Flys Spalten enthaelt so sind die Cntnts
+/*N*/ //moveable, mit Ausnahme der in der letzten Spalte (siehe
+/*N*/ //SwFrm::IsMoveable()). Zurueckfliessen duerfen sie aber natuerlich.
+/*N*/ //Das WouldFit() liefert leider nur dann einen vernueftigen Wert, wenn
+/*N*/ //der Frm moveable ist. Um dem WouldFit() einen Moveable Frm
+/*N*/ //vorzugaukeln haenge ich ihn einfach solange um.
+/*N*/ // Auch bei spaltigen Bereichen muss umgehaengt werden, damit
+/*N*/ // SwSectionFrm::Growable() den richtigen Wert liefert.
+/*N*/ // Innerhalb von Fussnoten muss ggf. sogar der SwFtnFrm umgehaengt werden,
+/*N*/ // falls es dort keinen SwFtnFrm gibt.
+/*N*/ SwFrm* pTmpFrm = pFrm->IsInFtn() && !pNewUpper->FindFtnFrm() ?
+/*N*/ (SwFrm*)pFrm->FindFtnFrm() : pFrm;
+/*N*/ SwLayoutFrm *pUp = pTmpFrm->GetUpper();
+/*N*/ SwFrm *pOldNext = pTmpFrm->GetNext();
+/*N*/ pTmpFrm->Remove();
+/*N*/ pTmpFrm->InsertBefore( pNewUpper, 0 );
+/*N*/ if ( pFrm->IsTxtFrm() &&
+/*N*/ ( bTstMove ||
+/*N*/ ((SwTxtFrm*)pFrm)->HasFollow() ||
+/*N*/ ( !((SwTxtFrm*)pFrm)->HasPara() &&
+/*N*/ !((SwTxtFrm*)pFrm)->IsEmpty()
+/*N*/ )
+/*N*/ )
+/*N*/ )
+/*N*/ {
+/*N*/ bTstMove = TRUE;
+/*N*/ bRet = ((SwTxtFrm*)pFrm)->TestFormat( pPrev, nSpace, bSplit );
+/*N*/ }
+/*N*/ else
+/*?*/ bRet = pFrm->WouldFit( nSpace, bSplit );
+/*N*/ pTmpFrm->Remove();
+/*N*/ pTmpFrm->InsertBefore( pUp, pOldNext );
+/*N*/ }
+/*N*/ else
+/*N*/ bRet = pFrm->WouldFit( nSpace, bSplit );
+/*N*/
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/
+/*N*/ //Bitter aber wahr: Der Abstand muss auch noch mit einkalkuliert werden.
+/*N*/ //Bei TestFormatierung ist dies bereits geschehen.
+/*N*/ if ( bRet && !bTstMove )
+/*N*/ {
+/*N*/ SwTwips nUpper;
+/*N*/ if ( pPrev )
+/*N*/ {
+/*N*/ nUpper = CalcUpperSpace( NULL, pPrev );
+/*N*/
+/*N*/ // in balanced columned section frames we do not want the
+/*N*/ // common border
+/*N*/ sal_Bool bCommonBorder = sal_True;
+/*N*/ if ( pFrm->IsInSct() && pFrm->GetUpper()->IsColBodyFrm() )
+/*N*/ {
+/*?*/ const SwSectionFrm* pSct = pFrm->FindSctFrm();
+/*?*/ bCommonBorder = pSct->GetFmt()->GetBalancedColumns().GetValue();
+/*N*/ }
+/*N*/ nUpper += bCommonBorder ?
+/*N*/ rAttrs.GetBottomLine( pFrm ) :
+/*N*/ rAttrs.CalcBottomLine();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pFrm->IsVertical() )
+/*?*/ nUpper = pFrm->Frm().Width() - pFrm->Prt().Width();
+/*N*/ else
+/*N*/ nUpper = pFrm->Frm().Height() - pFrm->Prt().Height();
+/*N*/ }
+/*N*/ nSpace -= nUpper;
+/*N*/ if ( nSpace < 0 )
+/*N*/ bRet = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if ( bRet && !bSplit && pFrm->IsKeep( rAttrs ) )
+/*N*/ {
+/*N*/ if( bTstMove )
+/*N*/ {
+/*?*/ while( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->HasFollow() )
+/*?*/ {
+/*?*/ pFrm = ((SwTxtFrm*)pFrm)->GetFollow();
+/*?*/ }
+/*?*/ // OD 11.04.2003 #108824# - If last follow frame of <this> text
+/*?*/ // frame isn't valid, a formatting of the next content frame
+/*?*/ // doesn't makes sense. Thus, return TRUE.
+/*?*/ if ( IsAnFollow( pFrm ) && !pFrm->IsValid() )
+/*?*/ {
+/*?*/ ASSERT( false, "Only a warning for task 108824:/n<SwCntntFrm::_WouldFit(..) - follow not valid!" );
+/*?*/ return TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ SwFrm *pNxt;
+/*N*/ if( 0 != (pNxt = pFrm->FindNext()) && pNxt->IsCntntFrm() &&
+/*N*/ ( !pFtnFrm || ( pNxt->IsInFtn() &&
+/*N*/ pNxt->FindFtnFrm()->GetAttr() == pFtnFrm->GetAttr() ) ) )
+/*N*/ {
+/*N*/ // ProbeFormatierung vertraegt keine absatz- oder gar zeichengebundene Objekte
+/*N*/ if( bTstMove && pNxt->GetDrawObjs() )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ if ( !pNxt->IsValid() )
+/*N*/ MakeNxt( pFrm, pNxt );
+/*N*/
+/*N*/ //Kleiner Trick: Wenn der naechste einen Vorgaenger hat, so hat
+/*N*/ //er den Absatzabstand bereits berechnet. Er braucht dann nicht
+/*N*/ //teuer kalkuliert werden.
+/*N*/ if( lcl_NotHiddenPrev( pNxt ) )
+/*N*/ pPrev = 0;
+/*N*/ else
+/*N*/ {
+/*?*/ if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow() )
+/*?*/ pPrev = lcl_NotHiddenPrev( pFrm );
+/*?*/ else
+/*?*/ pPrev = pFrm;
+/*N*/ }
+/*N*/ pFrm = (SwCntntFrm*)pNxt;
+/*N*/ }
+/*N*/ else
+/*N*/ pFrm = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ pFrm = 0;
+/*N*/
+/*N*/ } while ( bRet && pFrm );
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_colfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_colfrm.cxx
new file mode 100644
index 000000000000..74cd30880204
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_colfrm.cxx
@@ -0,0 +1,484 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "cntfrm.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include "hintids.hxx"
+
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+
+#include <fmtclds.hxx>
+#include <fmtfordr.hxx>
+#include <frmfmt.hxx>
+#include "frmtool.hxx"
+#include "colfrm.hxx"
+#include "pagefrm.hxx"
+#include "bodyfrm.hxx" // ColumnFrms jetzt mit BodyFrm
+#include "rootfrm.hxx" // wg. RemoveFtns
+#include "sectfrm.hxx" // wg. FtnAtEnd-Flag
+namespace binfilter {
+
+// ftnfrm.cxx:
+/*N*/ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, BOOL bPageOnly, BOOL bEndNotes );
+
+
+/*************************************************************************
+|*
+|* SwColumnFrm::SwColumnFrm()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung AMA 30. Oct 98
+|*
+|*************************************************************************/
+/*N*/ SwColumnFrm::SwColumnFrm( SwFrmFmt *pFmt ):
+/*N*/ SwFtnBossFrm( pFmt )
+/*N*/ {
+/*N*/ nType = FRMC_COLUMN;
+/*N*/ SwBodyFrm* pColBody = new SwBodyFrm( pFmt->GetDoc()->GetDfltFrmFmt() );
+/*N*/ pColBody->InsertBehind( this, 0 ); // ColumnFrms jetzt mit BodyFrm
+/*N*/ SetMaxFtnHeight( LONG_MAX );
+/*N*/ }
+
+/*N*/ SwColumnFrm::~SwColumnFrm()
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = GetFmt();
+/*N*/ SwDoc *pDoc;
+/*N*/ if ( !(pDoc = pFmt->GetDoc())->IsInDtor() && pFmt->IsLastDepend() )
+/*N*/ {
+/*N*/ //Ich bin der einzige, weg mit dem Format.
+/*N*/ //Vorher ummelden, damit die Basisklasse noch klarkommt.
+/*N*/ pDoc->GetDfltFrmFmt()->Add( this );
+/*N*/ pDoc->DelFrmFmt( pFmt );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::ChgColumns()
+|*
+|* Ersterstellung MA 11. Feb. 93
+|* Letzte Aenderung MA 12. Oct. 98
+|*
+|*************************************************************************/
+
+/*N*/ void MA_FASTCALL lcl_RemoveColumns( SwLayoutFrm *pCont, USHORT nCnt )
+/*N*/ {
+/*N*/ ASSERT( pCont && pCont->Lower() && pCont->Lower()->IsColumnFrm(),
+/*N*/ "Keine Spalten zu entfernen." );
+/*N*/
+/*N*/ SwColumnFrm *pColumn = (SwColumnFrm*)pCont->Lower();
+/*N*/ ::binfilter::lcl_RemoveFtns( pColumn, TRUE, TRUE );
+/*N*/ while ( pColumn->GetNext() )
+/*N*/ {
+/*N*/ ASSERT( pColumn->GetNext()->IsColumnFrm(),
+/*N*/ "Nachbar von ColFrm kein ColFrm." );
+/*N*/ pColumn = (SwColumnFrm*)pColumn->GetNext();
+/*N*/ }
+/*N*/ for ( USHORT i = 0; i < nCnt; ++i )
+/*N*/ {
+/*N*/ SwColumnFrm *pTmp = (SwColumnFrm*)pColumn->GetPrev();
+/*N*/ pColumn->Cut();
+/*N*/ delete pColumn; //Format wird ggf. im DTor mit vernichtet.
+/*N*/ pColumn = pTmp;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwLayoutFrm * MA_FASTCALL lcl_FindColumns( SwLayoutFrm *pLay, USHORT nCount )
+/*N*/ {
+/*N*/ SwFrm *pCol = pLay->Lower();
+/*N*/ if ( pLay->IsPageFrm() )
+/*N*/ pCol = ((SwPageFrm*)pLay)->FindBodyCont()->Lower();
+/*N*/
+/*N*/ if ( pCol && pCol->IsColumnFrm() )
+/*N*/ {
+/*N*/ SwFrm *pTmp = pCol;
+/*N*/ USHORT i;
+/*N*/ for ( i = 0; pTmp; pTmp = pTmp->GetNext(), ++i )
+/*N*/ /* do nothing */;
+/*N*/ return i == nCount ? (SwLayoutFrm*)pCol : 0;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+
+/*N*/ BOOL MA_FASTCALL lcl_AddColumns( SwLayoutFrm *pCont, USHORT nCount )
+/*N*/ {
+/*N*/ SwDoc *pDoc = pCont->GetFmt()->GetDoc();
+/*N*/ const BOOL bMod = pDoc->IsModified();
+/*N*/
+/*N*/ //Format sollen soweit moeglich geshared werden. Wenn es also schon einen
+/*N*/ //Nachbarn mit den selben Spalteneinstellungen gibt, so koennen die
+/*N*/ //Spalten an die selben Formate gehaengt werden.
+/*N*/ //Der Nachbar kann ueber das Format gesucht werden, wer der Owner des Attributes
+/*N*/ //ist, ist allerdings vom Frametyp abhaengig.
+/*N*/ SwLayoutFrm *pAttrOwner = pCont;
+/*N*/ if ( pCont->IsBodyFrm() )
+/*N*/ pAttrOwner = pCont->FindPageFrm();
+/*N*/ SwLayoutFrm *pNeighbourCol = 0;
+/*N*/ SwClientIter aIter( *pAttrOwner->GetFmt() );
+/*N*/ SwLayoutFrm *pNeighbour = (SwLayoutFrm*)aIter.First( TYPE(SwLayoutFrm) );
+/*N*/
+/*N*/ USHORT nAdd = 0;
+/*N*/ SwFrm *pCol = pCont->Lower();
+/*N*/ if ( pCol && pCol->IsColumnFrm() )
+/*?*/ for ( nAdd = 1; pCol; pCol = pCol->GetNext(), ++nAdd )
+/*?*/ /* do nothing */;
+/*N*/ while ( pNeighbour )
+/*N*/ {
+/*N*/ if ( 0 != (pNeighbourCol = lcl_FindColumns( pNeighbour, nCount+nAdd )) &&
+/*N*/ pNeighbourCol != pCont )
+/*N*/ break;
+/*N*/ pNeighbourCol = 0;
+/*N*/ pNeighbour = (SwLayoutFrm*)aIter.Next();
+/*N*/ }
+/*N*/
+/*N*/ BOOL bRet;
+/*N*/ SwTwips nMax = pCont->IsPageBodyFrm() ?
+/*N*/ pCont->FindPageFrm()->GetMaxFtnHeight() : LONG_MAX;
+/*N*/ if ( pNeighbourCol )
+/*N*/ {
+/*N*/ bRet = FALSE;
+/*N*/ SwFrm *pTmp = pCont->Lower();
+/*N*/ while ( pTmp )
+/*N*/ {
+/*?*/ pTmp = pTmp->GetNext();
+/*?*/ pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext();
+/*N*/ }
+/*N*/ for ( USHORT i = 0; i < nCount; ++i )
+/*N*/ {
+/*N*/ SwColumnFrm *pTmp = new SwColumnFrm( pNeighbourCol->GetFmt() );
+/*N*/ pTmp->SetMaxFtnHeight( nMax );
+/*N*/ pTmp->InsertBefore( pCont, NULL );
+/*N*/ pNeighbourCol = (SwLayoutFrm*)pNeighbourCol->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bRet = TRUE;
+/*N*/ for ( USHORT i = 0; i < nCount; ++i )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = pDoc->MakeFrmFmt( aEmptyStr, pDoc->GetDfltFrmFmt());
+/*N*/ SwColumnFrm *pTmp = new SwColumnFrm( pFmt );
+/*N*/ pTmp->SetMaxFtnHeight( nMax );
+/*N*/ pTmp->Paste( pCont );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( !bMod )
+/*N*/ pDoc->ResetModified();
+/*N*/ return bRet;
+/*N*/ }
+
+/*-----------------21.09.99 15:42-------------------
+ * ChgColumns() adds or removes columns from a layoutframe.
+ * Normally, a layoutframe with a column attribut of 1 or 0 columns contains
+ * no columnframe. However, a sectionframe with "footnotes at the end" needs
+ * a columnframe. If the bChgFtn-flag is set, the columnframe will be inserted
+ * or remove, if necessary.
+ * --------------------------------------------------*/
+
+/*N*/ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
+/*N*/ const BOOL bChgFtn )
+/*N*/ {
+/*N*/ if ( rOld.GetNumCols() <= 1 && rNew.GetNumCols() <= 1 && !bChgFtn )
+/*N*/ return;
+/*N*/ USHORT nNewNum, nOldNum = 1;
+/*N*/ if( Lower() && Lower()->IsColumnFrm() )
+/*N*/ {
+/*N*/ SwFrm* pCol = Lower();
+/*N*/ while( 0 != (pCol=pCol->GetNext()) )
+/*N*/ ++nOldNum;
+/*N*/ }
+/*N*/ nNewNum = rNew.GetNumCols();
+/*N*/ if( !nNewNum )
+/*N*/ ++nNewNum;
+/*N*/ BOOL bAtEnd;
+/*N*/ if( IsSctFrm() )
+/*?*/ bAtEnd = ((SwSectionFrm*)this)->IsAnyNoteAtEnd();
+/*N*/ else
+/*N*/ bAtEnd = FALSE;
+/*N*/
+/*N*/ //Einstellung der Spaltenbreiten ist nur bei neuen Formaten notwendig.
+/*N*/ BOOL bAdjustAttributes = nOldNum != rOld.GetNumCols();
+/*N*/
+/*N*/ //Wenn die Spaltenanzahl unterschiedlich ist, wird der Inhalt
+/*N*/ //gesichert und restored.
+/*N*/ SwFrm *pSave = 0;
+/*N*/ if( nOldNum != nNewNum || bChgFtn )
+/*N*/ {
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ ASSERT( pDoc, "FrmFmt gibt kein Dokument her." );
+/*N*/ // SaveCntnt wuerde auch den Inhalt der Fussnotencontainer aufsaugen
+/*N*/ // und im normalen Textfluss unterbringen.
+/*N*/ if( IsPageBodyFrm() )
+/*N*/ pDoc->GetRootFrm()->RemoveFtns( (SwPageFrm*)GetUpper(), TRUE, FALSE );
+/*N*/ pSave = ::binfilter::SaveCntnt( this );
+/*N*/
+/*N*/ //Wenn Spalten existieren, jetzt aber eine Spaltenanzahl von
+/*N*/ //0 oder eins gewuenscht ist, so werden die Spalten einfach vernichtet.
+/*N*/ if ( nNewNum == 1 && !bAtEnd )
+/*N*/ {
+/*N*/ ::binfilter::lcl_RemoveColumns( this, nOldNum );
+/*N*/ if ( IsBodyFrm() )
+/*N*/ SetFrmFmt( pDoc->GetDfltFrmFmt() );
+/*N*/ else
+/*?*/ GetFmt()->SetAttr( SwFmtFillOrder() );
+/*N*/ if ( pSave )
+/*N*/ ::binfilter::RestoreCntnt( pSave, this, 0 );
+/*N*/ return;
+/*N*/ }
+/*N*/ if ( nOldNum == 1 )
+/*N*/ {
+/*N*/ if ( IsBodyFrm() )
+/*N*/ SetFrmFmt( pDoc->GetColumnContFmt() );
+/*N*/ else
+/*N*/ GetFmt()->SetAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
+/*N*/ if( !Lower() || !Lower()->IsColumnFrm() )
+/*N*/ --nOldNum;
+/*N*/ }
+/*N*/ if ( nOldNum > nNewNum )
+/*N*/ {
+/*?*/ ::binfilter::lcl_RemoveColumns( this, nOldNum - nNewNum );
+/*?*/ bAdjustAttributes = TRUE;
+/*N*/ }
+/*N*/ else if( nOldNum < nNewNum )
+/*N*/ {
+/*N*/ USHORT nAdd = nNewNum - nOldNum;
+/*N*/ bAdjustAttributes = ::binfilter::lcl_AddColumns( this, nAdd );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( !bAdjustAttributes )
+/*N*/ {
+/*N*/ if ( rOld.GetLineWidth() != rNew.GetLineWidth() ||
+/*N*/ rOld.GetWishWidth() != rNew.GetWishWidth() ||
+/*N*/ rOld.IsOrtho() != rNew.IsOrtho() )
+/*N*/ bAdjustAttributes = TRUE;
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nCount = Min( rNew.GetColumns().Count(), rOld.GetColumns().Count() );
+/*N*/ for ( USHORT i = 0; i < nCount; ++i )
+/*?*/ if ( !(*rOld.GetColumns()[i] == *rNew.GetColumns()[i]) )
+/*?*/ {
+/*?*/ bAdjustAttributes = TRUE;
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Sodele, jetzt koennen die Spalten bequem eingestellt werden.
+/*N*/ AdjustColumns( &rNew, bAdjustAttributes );
+/*N*/
+/*N*/ //Erst jetzt den Inhalt restaurieren. Ein frueheres Restaurieren wuerde
+/*N*/ //unnuetzte Aktionen beim Einstellen zur Folge haben.
+/*N*/ if ( pSave )
+/*N*/ {
+/*N*/ ASSERT( Lower() && Lower()->IsLayoutFrm() &&
+/*N*/ ((SwLayoutFrm*)Lower())->Lower() &&
+/*N*/ ((SwLayoutFrm*)Lower())->Lower()->IsLayoutFrm(),
+/*N*/ "Gesucht: Spaltenbody (Tod oder Lebend)." ); // ColumnFrms jetzt mit BodyFrm
+/*N*/ ::binfilter::RestoreCntnt( pSave, (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower(), 0 );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::AdjustColumns()
+|*
+|* Ersterstellung MA 19. Jan. 99
+|* Letzte Aenderung MA 19. Jan. 99
+|*
+|*************************************************************************/
+
+/*N*/ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, BOOL bAdjustAttributes,
+/*N*/ BOOL bAutoWidth )
+/*N*/ {
+/*N*/ if( !Lower()->GetNext() )
+/*N*/ {
+/*?*/ Lower()->ChgSize( Prt().SSize() );
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ const FASTBOOL bVert = IsVertical();
+/*N*/ SwRectFn fnRect = bVert ? fnRectVert : fnRectHori;
+/*N*/
+/*N*/ //Ist ein Pointer da, oder sollen wir die Attribute einstellen,
+/*N*/ //so stellen wir auf jeden Fall die Spaltenbreiten ein. Andernfalls
+/*N*/ //checken wir, ob eine Einstellung notwendig ist.
+/*N*/ if ( !pAttr )
+/*N*/ {
+/*N*/ pAttr = &GetFmt()->GetCol();
+/*N*/ if ( !bAdjustAttributes )
+/*N*/ {
+/*N*/ long nAvail = (Prt().*fnRect->fnGetWidth)();
+/*N*/ for ( SwLayoutFrm *pCol = (SwLayoutFrm*)Lower();
+/*N*/ pCol;
+/*N*/ pCol = (SwLayoutFrm*)pCol->GetNext() )
+/*N*/ nAvail -= (pCol->Frm().*fnRect->fnGetWidth)();
+/*N*/ if ( !nAvail )
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Sodele, jetzt koennen die Spalten bequem eingestellt werden.
+/*N*/ //Die Breiten werden mitgezaehlt, damit wir dem letzten den Rest geben
+/*N*/ //koennen.
+/*N*/ SwTwips nAvail = (Prt().*fnRect->fnGetWidth)();
+/*N*/ const BOOL bR2L = IsRightToLeft();
+/*N*/ const BOOL bLine = pAttr->GetLineAdj() != COLADJ_NONE;
+/*N*/ USHORT nMin = 0;
+/*N*/ if ( bLine )
+/*N*/ nMin = USHORT(20 + (pAttr->GetLineWidth() / 2));
+/*N*/ SwFrm *pCol = Lower();
+/*N*/ if( bR2L )
+/*?*/ while( pCol->GetNext() )
+/*?*/ pCol = pCol->GetNext();
+/*N*/ long nGutter = 0;
+/*N*/ BOOL bOrtho = bAutoWidth || ( pAttr->IsOrtho() && bAdjustAttributes &&
+/*N*/ pAttr->GetNumCols() > 0 );
+/*N*/ for ( USHORT i = 0; i < pAttr->GetNumCols();
+/*N*/ pCol = bR2L ? pCol->GetPrev() : pCol->GetNext(), ++i )
+/*N*/ {
+/*N*/ if( !bOrtho )
+/*N*/ {
+/*N*/ const SwTwips nWidth = i == (pAttr->GetNumCols() - 1) ? nAvail :
+/*N*/ pAttr->CalcColWidth( i, USHORT( (Prt().*fnRect->fnGetWidth)() ) );
+/*N*/ Size aColSz = bVert ? Size( Prt().Width(), nWidth ) :
+/*N*/ Size( nWidth, Prt().Height() );
+/*N*/ pCol->ChgSize( aColSz );
+/*N*/
+/*N*/ // Hierdurch werden die ColumnBodyFrms von Seitenspalten angepasst und
+/*N*/ // ihr bFixHeight-Flag wird gesetzt, damit sie nicht schrumpfen/wachsen.
+/*N*/ // Bei Rahmenspalten hingegen soll das Flag _nicht_ gesetzt werden,
+/*N*/ // da BodyFrms in Rahmenspalten durchaus wachsen/schrumpfen duerfen.
+/*N*/ if( IsBodyFrm() )
+/*N*/ ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz );
+/*N*/
+/*N*/ nAvail -= nWidth;
+/*N*/ }
+/*N*/
+/*N*/ if ( bAutoWidth || bAdjustAttributes )
+/*N*/ {
+/*N*/ SwColumn *pC = pAttr->GetColumns()[i];
+/*N*/ SwAttrSet* pSet = pCol->GetAttrSet();
+/*N*/ SvxLRSpaceItem aLR( pSet->GetLRSpace() );
+/*N*/ SvxULSpaceItem aUL( pSet->GetULSpace() );
+/*N*/
+/*N*/ {
+/*N*/ //Damit die Trennlinien Platz finden, muessen sie hier
+/*N*/ //Beruecksichtigung finden. Ueberall wo zwei Spalten aufeinanderstossen
+/*N*/ //wird jeweils rechts bzw. links ein Sicherheitsabstand von 20 plus
+/*N*/ //der halben Penbreite einkalkuliert.
+/*N*/ USHORT nRight, nLeft;
+/*N*/ if( sal_False && bR2L )
+/*N*/ {
+/*?*/ nRight = pC->GetLeft();
+/*?*/ nLeft = pC->GetRight();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nLeft = pC->GetLeft();
+/*N*/ nRight = pC->GetRight();
+/*N*/ }
+/*N*/ if ( bLine )
+/*N*/ {
+/*N*/ if ( i == 0 )
+/*N*/ { aLR.SetLeft ( nLeft );
+/*N*/ aLR.SetRight( Max(nRight, nMin) );
+/*N*/ }
+/*N*/ else if ( i == (pAttr->GetNumCols() - 1) )
+/*N*/ { aLR.SetLeft ( Max(nLeft, nMin) );
+/*N*/ aLR.SetRight( nRight );
+/*N*/ }
+/*N*/ else
+/*N*/ { aLR.SetLeft ( Max(nLeft, nMin) );
+/*N*/ aLR.SetRight( Max(nRight, nMin) );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aLR.SetLeft ( nLeft );
+/*N*/ aLR.SetRight( nRight);
+/*N*/ }
+/*N*/ aUL.SetUpper( pC->GetUpper());
+/*N*/ aUL.SetLower( pC->GetLower());
+/*N*/ }
+/*N*/
+/*N*/ if ( bAdjustAttributes )
+/*N*/ {
+/*N*/ ((SwLayoutFrm*)pCol)->GetFmt()->SetAttr( aLR );
+/*N*/ ((SwLayoutFrm*)pCol)->GetFmt()->SetAttr( aUL );
+/*N*/ }
+/*N*/
+/*N*/ nGutter += aLR.GetLeft() + aLR.GetRight();
+/*N*/ }
+/*N*/ }
+/*N*/ if( bOrtho )
+/*N*/ {
+/*N*/ nAvail = (Prt().*fnRect->fnGetWidth)();
+/*N*/ long nInnerWidth = ( nAvail - nGutter )/ pAttr->GetNumCols();
+/*N*/ pCol = Lower();
+/*N*/ for( USHORT i = 0; i < pAttr->GetNumCols(); pCol = pCol->GetNext(), ++i)
+/*N*/ {
+/*N*/ SwTwips nWidth;
+/*N*/ if( i == (pAttr->GetNumCols() - 1) )
+/*N*/ nWidth = nAvail;
+/*N*/ else
+/*N*/ {
+/*N*/ SvxLRSpaceItem aLR( pCol->GetAttrSet()->GetLRSpace() );
+/*N*/ nWidth = nInnerWidth + aLR.GetLeft() + aLR.GetRight();
+/*N*/ }
+/*N*/ if( nWidth < 0 )
+/*?*/ nWidth = 0;
+/*N*/ Size aColSz = bVert ? Size( Prt().Width(), nWidth ) :
+/*N*/ Size( nWidth, Prt().Height() );
+/*N*/ pCol->ChgSize( aColSz );
+/*N*/ if( IsBodyFrm() )
+/*N*/ ((SwLayoutFrm*)pCol)->Lower()->ChgSize( aColSz );
+/*N*/ nAvail -= nWidth;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_dbg_lay.cxx b/binfilter/bf_sw/source/core/layout/sw_dbg_lay.cxx
new file mode 100644
index 000000000000..0dc615365564
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_dbg_lay.cxx
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/* -----------------08.01.99 14:55-------------------
+ * Und hier die Beschreibung:
+ *
+ * Durch die PROTOCOL-Makros wird es ermoeglicht, Ereignisse im Frame-Methoden zu protokollieren.
+ * In protokollwuerdigen Stellen in Frame-Methoden muss entweder ein PROTOCOL(...) oder bei Methoden,
+ * bei denen auch das Verlassen der Methode mitprotokolliert werden soll, ein PROTOCOL_ENTER(...)-Makro
+ * stehen.
+ * Die Parameter der PROTOCOL-Makros sind
+ * 1. Ein Pointer auf einen SwFrm, also meist "this" oder "rThis"
+ * 2. Die Funktionsgruppe z.B. PROT_MAKEALL, hierueber wird (inline) entschieden, ob dies
+ * zur Zeit protokolliert werden soll oder nicht.
+ * 3. Die Aktion, im Normalfall 0, aber z.B. ein ACT_START bewirkt eine Einrueckung in der
+ * Ausgabedatei, ein ACT_END nimmt dies wieder zurueck. Auf diese Art wird z.B. durch
+ * PROTOCOL_ENTER am Anfang einer Methode eingerueckt und beim Verlassen wieder zurueck.
+ * 4. Der vierte Parameter ist ein void-Pointer, damit man irgendetwas uebergeben kann,
+ * was in das Protokoll einfliessen kann, typesches Beispiel bei PROT_GROW muss man
+ * einen Pointer auf den Wert, um den gegrowt werden soll, uebergeben.
+ *
+ *
+ * Das Protokoll ist die Datei "dbg_lay.out" im aktuellen (BIN-)Verzeichnis.
+ * Es enthaelt Zeilen mit FrmId, Funktionsgruppe sowie weiteren Infos.
+ *
+ * Was genau protokolliert wird, kann auf folgende Arten eingestellt werden:
+ * 1. Die statische Variable SwProtokoll::nRecord enthaelt die Funktionsgruppen,
+ * die aufgezeichnet werden sollen.
+ * Ein Wert von z.B. PROT_GROW bewirkt, das Aufrufe von SwFrm::Grow dokumentiert werden,
+ * PROT_MAKEALL protokolliert Aufrufe von xxx::MakeAll.
+ * Die PROT_XY-Werte koennen oderiert werden.
+ * Default ist Null, es wird keine Methode aufgezeichnet.
+ * 2. In der SwImplProtocol-Klasse gibt es einen Filter fuer Frame-Typen,
+ * nur die Methodenaufrufe von Frame-Typen, die dort gesetzt sind, werden protokolliert.
+ * Der Member nTypes kann auf Werte wie FRM_PAGE, FRM_SECTION gesetzt und oderiert werden.
+ * Default ist 0xFFFF, d.h. alle Frame-Typen.
+ * 3. In der SwImplProtocol-Klasse gibt es einen ArrayPointer auf FrmIds, die zu ueberwachen sind.
+ * Ist der Pointer Null, so werden alle Frames protokolliert, ansonsten nur Frames,
+ * die in dem Array vermerkt sind.
+ *
+ * Eine Aufzeichnung in Gang zu setzen, erfordert entweder Codemanipulation, z.B. in
+ * SwProtocol::Init() einen anderen Default fuer nRecord setzen oder Debuggermanipulation.
+ * Im Debugger gibt verschiedene, sich anbietende Stellen:
+ * 1. In SwProtocol::Init() einen Breakpoint setzen und dort nRecord manipulieren, ggf.
+ * FrmIds eintragen, dann beginnt die Aufzeichnung bereits beim Programmstart.
+ * 2. Waehrend des Programmlaufs einen Breakpoint vor irgendein PROTOCOL oder PROTOCOL_ENTER-
+ * Makro setzen, dann am SwProtocol::nRecord das unterste Bit setzen (PROT_INIT). Dies
+ * bewirkt, dass die Funktionsgruppe des folgenden Makros aktiviert und in Zukunft
+ * protokolliert wird.
+ * 3. Spezialfall von 2.: Wenn man 2. in der Methode SwRootFrm::Paint(..) anwendet, werden
+ * die Aufzeichnungseinstellung aus der Datei "dbg_lay.ini" ausgelesen!
+ * In dieser INI-Datei kann es Kommentarzeilen geben, diese beginnen mit '#', dann
+ * sind die Sektionen "[frmid]", "[frmtype]" und "[record]" relevant.
+ * Nach [frmid] koennen die FrameIds der zu protokollierenden Frames folgen. Gibt es
+ * dort keine Eintraege, werden alle Frames aufgezeichnet.
+ * Nach [frmtype] koennen FrameTypen folgen, die aufgezeichnet werden sollen, da der
+ * Default hier allerdings USHRT_MAX ist, werden sowieso alle aufgezeichnet. Man kann
+ * allerdings auch Typen entfernen, in dem man ein '!' vor den Wert setzt, z.B.
+ * !0xC000 nimmt die SwCntntFrms aus der Aufzeichnung heraus.
+ * Nach [record] folgen die Funktionsgruppen, die aufgezeichnet werden sollen, Default
+ * ist hier 0, also keine. Auch hier kann man mit einem vorgestellten '!' Funktionen
+ * wieder entfernen.
+ * Hier mal ein Beispiel fuer eine INI-Datei:
+ * ------------------------------------------
+ * #Funktionen: Alle, ausser PRTAREA
+ * [record] 0xFFFFFFE !0x200
+ * [frmid]
+ * #folgende FrmIds:
+ * 1 2 12 13 14 15
+ * #keine Layoutframes ausser ColumnFrms
+ * [frmtype] !0x3FFF 0x4
+ * ------------------------------------------
+ *
+ * Wenn die Aufzeichnung erstmal laeuft, kann man in SwImplProtocol::_Record(...) mittels
+ * Debugger vielfaeltige Manipulationen vornehmen, z.B. bezueglich FrameTypen oder FrmIds.
+ *
+ * --------------------------------------------------*/
+
+#ifndef DBG_UTIL
+#error Wer fummelt denn an den makefiles rum?
+#endif
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "dbg_lay.hxx"
+
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_LONGS
+#endif
+
+#include <stdio.h>
+
+
+#include <horiornt.hxx>
+
+#include "txtfrm.hxx"
+#include "dflyobj.hxx"
+#include <fntcache.hxx>
+namespace binfilter {
+
+/*N*/ ULONG SwProtocol::nRecord = 0;
+/*N*/ SwImplProtocol* SwProtocol::pImpl = NULL;
+
+
+/*N*/ class SwImplProtocol
+/*N*/ {
+/*N*/ public:
+ SwImplProtocol(){DBG_BF_ASSERT(0, "STRIP");} //STRIP001 SwImplProtocol();
+/*N*/ };
+
+/* -----------------11.01.99 10:43-------------------
+ * Durch das PROTOCOL_ENTER-Makro wird ein SwEnterLeave-Objekt erzeugt,
+ * wenn die aktuelle Funktion aufgezeichnet werden soll, wird ein
+ * SwImplEnterLeave-Objekt angelegt. Der Witz dabei ist, das der Ctor
+ * des Impl-Objekt am Anfang der Funktion und automatisch der Dtor beim
+ * Verlassen der Funktion gerufen wird. In der Basis-Implementierung ruft
+ * der Ctor lediglich ein PROTOCOL(..) mit ACT_START und im Dtor ein
+ * PROTOCOL(..) mit ACT_END.
+ * Es lassen sich Ableitungen der Klasse bilden, um z.B. beim Verlassen
+ * einer Funktion Groessenaenderungen des Frames zu dokumentieren u.v.a.m.
+ * Dazu braucht dann nur noch in SwEnterLeave::Ctor(...) die gewuenschte
+ * SwImplEnterLeave-Klasse angelegt zu werden.
+ *
+ * --------------------------------------------------*/
+
+
+
+
+
+
+// Die folgende Funktion wird beim Anziehen der Writer-DLL durch TxtInit(..) aufgerufen
+// und ermoeglicht dem Debuggenden Funktionen und/oder FrmIds freizuschalten
+
+/*N*/ void SwProtocol::Init()
+/*N*/ {
+/*N*/ nRecord = 0;
+/*N*/ XubString aName( "dbg_lay.go", RTL_TEXTENCODING_MS_1252 );
+/*N*/ SvFileStream aStream( aName, STREAM_READ );
+/*N*/ if( aStream.IsOpen() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pImpl = new SwImplProtocol();
+/*N*/ }
+/*N*/ aStream.Close();
+/*N*/ }
+
+// Ende der Aufzeichnung
+
+/*N*/ void SwProtocol::Stop()
+/*N*/ {
+/*N*/ if( pImpl )
+/*N*/ {
+/*?*/ delete pImpl;
+/*?*/ pImpl = NULL;
+/*?*/ if( pFntCache )
+/*?*/ pFntCache->Flush();
+/*N*/ }
+/*N*/ nRecord = 0;
+/*N*/ }
+
+// Creates a more or less detailed snapshot of the layout structur
+
+
+
+
+
+
+/* -----------------11.01.99 11:03-------------------
+ * SwImplProtocol::CheckLine analysiert eine Zeile der INI-Datei
+ * --------------------------------------------------*/
+
+
+/* -----------------11.01.99 11:17-------------------
+ * SwImplProtocol::FileInit() liest die Datei "dbg_lay.ini"
+ * im aktuellen Verzeichnis und wertet sie aus.
+ * --------------------------------------------------*/
+
+/* -----------------11.01.99 11:20-------------------
+ * lcl_Start sorgt fuer Einrueckung um zwei Blanks bei ACT_START
+ * und nimmt diese bei ACT_END wieder zurueck.
+ * --------------------------------------------------*/
+
+/* -----------------11.01.99 11:21-------------------
+ * lcl_Flags gibt das ValidSize-, ValidPos- und ValidPrtArea-Flag ("Sz","Ps","PA")
+ * des Frames aus, "+" fuer valid, "-" fuer invalid.
+ * --------------------------------------------------*/
+
+
+/* -----------------11.01.99 11:23-------------------
+ * lcl_FrameType gibt den Typ des Frames in Klartext aus.
+ * --------------------------------------------------*/
+
+
+/* -----------------11.01.99 11:25-------------------
+ * SwImplProtocol::Record(..) wird nur gerufen, wenn das PROTOCOL-Makro
+ * feststellt, dass die Funktion aufgezeichnet werden soll ( SwProtocol::nRecord ).
+ * In dieser Methode werden noch die beiden weiteren Einschraenkungen ueberprueft,
+ * ob die FrmId und der FrameType zu den aufzuzeichnenden gehoeren.
+ * --------------------------------------------------*/
+
+
+/* -----------------13.01.99 11:39-------------------
+ * SwImplProtocol::SectFunc(...) wird von SwImplProtocol::_Record(..) gerufen,
+ * hier werden die Ausgaben rund um SectionFrms abgehandelt.
+ * --------------------------------------------------*/
+
+
+/* -----------------11.01.99 11:31-------------------
+ * SwImplProtocol::InsertFrm(..) nimmt eine neue FrmId zum Aufzeichnen auf,
+ * wenn pFrmIds==NULL, werden alle aufgezeichnet, sobald durch InsertFrm(..)
+ * pFrmIds angelegt wird, werden nur noch die enthaltenen FrmIds aufgezeichnet.
+ * --------------------------------------------------*/
+
+
+/* -----------------11.01.99 11:52-------------------
+ * SwImplProtocol::DeleteFrm(..) entfernt eine FrmId aus dem pFrmIds-Array,
+ * so dass diese Frame nicht mehr aufgezeichnet wird.
+ * --------------------------------------------------*/
+
+/*-----------------20.9.2001 10:29------------------
+ * SwProtocol::SnapShot(..)
+ * creates a snapshot of the given frame and its content.
+ * --------------------------------------------------*/
+
+/* -----------------11.01.99 11:53-------------------
+ * SwEnterLeave::Ctor(..) wird vom eigentlichen (inline-)Kontruktor gerufen,
+ * wenn die Funktion aufgezeichnet werden soll.
+ * Die Aufgabe ist es abhaengig von der Funktion das richtige SwImplEnterLeave-Objekt
+ * zu erzeugen, alles weitere geschieht dann in dessen Ctor/Dtor.
+ * --------------------------------------------------*/
+
+/* -----------------11.01.99 11:56-------------------
+ * SwEnterLeave::Dtor() ruft lediglich den Destruktor des SwImplEnterLeave-Objekts,
+ * ist nur deshalb nicht inline, damit die SwImplEnterLeave-Definition nicht
+ * im dbg_lay.hxx zu stehen braucht.
+ * --------------------------------------------------*/
+
+
+
+
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_findfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_findfrm.cxx
new file mode 100644
index 000000000000..942a6f809ac7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_findfrm.cxx
@@ -0,0 +1,1136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "pagefrm.hxx"
+#include "cntfrm.hxx"
+#include "node.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "frmtool.hxx"
+
+#include <frmfmt.hxx>
+#include "tabfrm.hxx"
+#include "sectfrm.hxx"
+#include "flyfrms.hxx"
+#include "ftnfrm.hxx"
+#include "txtftn.hxx"
+#include "fmtftn.hxx"
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* FindBodyCont, FindLastBodyCntnt()
+|*
+|* Beschreibung Sucht den ersten/letzten CntntFrm im BodyText unterhalb
+|* der Seite.
+|* Ersterstellung MA 15. Feb. 93
+|* Letzte Aenderung MA 18. Apr. 94
+|*
+|*************************************************************************/
+/*N*/ SwLayoutFrm *SwFtnBossFrm::FindBodyCont()
+/*N*/ {
+/*N*/ SwFrm *pLay = Lower();
+/*N*/ while ( pLay && !pLay->IsBodyFrm() )
+/*N*/ pLay = pLay->GetNext();
+/*N*/ return (SwLayoutFrm*)pLay;
+/*N*/ }
+
+SwCntntFrm *SwPageFrm::FindLastBodyCntnt()
+{
+ SwCntntFrm *pRet = FindFirstBodyCntnt();
+ SwCntntFrm *pNxt = pRet;
+ while ( pNxt && pNxt->IsInDocBody() && IsAnLower( pNxt ) )
+ { pRet = pNxt;
+ pNxt = pNxt->FindNextCnt();
+ }
+ return pRet;
+}
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::ContainsCntnt
+|*
+|* Beschreibung Prueft, ob der Frame irgendwo in seiner
+|* untergeordneten Struktur einen oder mehrere CntntFrm's enthaelt;
+|* Falls ja wird der erste gefundene CntntFrm zurueckgegeben.
+|*
+|* Ersterstellung MA 13. May. 92
+|* Letzte Aenderung MA 20. Apr. 94
+|*
+|*************************************************************************/
+
+/*N*/ const SwCntntFrm *SwLayoutFrm::ContainsCntnt() const
+/*N*/ {
+/*N*/ //LayoutBlatt nach unten hin suchen und wenn dieses keinen Inhalt hat
+/*N*/ //solange die weiteren Blatter abklappern bis Inhalt gefunden oder der
+/*N*/ //this verlassen wird.
+/*N*/ //Sections: Cntnt neben Sections wuerde so nicht gefunden (leere Section
+/*N*/ //direct neben CntntFrm), deshalb muss fuer diese Aufwendiger rekursiv gesucht
+/*N*/ //werden.
+/*N*/
+/*N*/ const SwLayoutFrm *pLayLeaf = this;
+/*N*/ do
+/*N*/ {
+/*N*/ while ( (!pLayLeaf->IsSctFrm() || pLayLeaf == this ) &&
+/*N*/ pLayLeaf->Lower() && pLayLeaf->Lower()->IsLayoutFrm() )
+/*N*/ pLayLeaf = (SwLayoutFrm*)pLayLeaf->Lower();
+/*N*/
+/*N*/ if( pLayLeaf->IsSctFrm() && pLayLeaf != this )
+/*N*/ {
+/*N*/ const SwCntntFrm *pCnt = pLayLeaf->ContainsCntnt();
+/*N*/ if( pCnt )
+/*N*/ return pCnt;
+/*N*/ if( pLayLeaf->GetNext() )
+/*N*/ {
+/*N*/ if( pLayLeaf->GetNext()->IsLayoutFrm() )
+/*N*/ {
+/*N*/ pLayLeaf = (SwLayoutFrm*)pLayLeaf->GetNext();
+/*N*/ continue;
+/*N*/ }
+/*N*/ else
+/*N*/ return (SwCntntFrm*)pLayLeaf->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pLayLeaf->Lower() )
+/*N*/ return (SwCntntFrm*)pLayLeaf->Lower();
+/*N*/
+/*N*/ pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+/*N*/ if( !IsAnLower( pLayLeaf) )
+/*N*/ return 0;
+/*N*/ } while( pLayLeaf );
+/*?*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::FirstCell
+|*
+|* Beschreibung ruft zunaechst ContainsAny auf, um in die innerste Zelle
+|* hineinzukommen. Dort hangelt es sich wieder hoch zum
+|* ersten SwCellFrm, seit es SectionFrms gibt, reicht kein
+|* ContainsCntnt()->GetUpper() mehr...
+|* Ersterstellung AMA 17. Mar. 99
+|* Letzte Aenderung AMA 17. Mar. 99
+|*
+|*************************************************************************/
+
+/*N*/ const SwCellFrm *SwLayoutFrm::FirstCell() const
+/*N*/ {
+/*N*/ const SwFrm* pCnt = ContainsAny();
+/*N*/ while( pCnt && !pCnt->IsCellFrm() )
+/*N*/ pCnt = pCnt->GetUpper();
+/*N*/ return (const SwCellFrm*)pCnt;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::ContainsAny
+|*
+|* Beschreibung wie ContainsCntnt, nur dass nicht nur CntntFrms, sondern auch
+|* Bereiche und Tabellen zurueckgegeben werden.
+|* Ersterstellung AMA 10. Mar. 99
+|* Letzte Aenderung AMA 10. Mar. 99
+|*
+|*************************************************************************/
+
+/*N*/ const SwFrm *SwLayoutFrm::ContainsAny() const
+/*N*/ {
+/*N*/ //LayoutBlatt nach unten hin suchen und wenn dieses keinen Inhalt hat
+/*N*/ //solange die weiteren Blatter abklappern bis Inhalt gefunden oder der
+/*N*/ //this verlassen wird.
+/*N*/ // Oder bis wir einen SectionFrm oder TabFrm gefunden haben
+/*N*/
+/*N*/ const SwLayoutFrm *pLayLeaf = this;
+/*N*/ BOOL bNoFtn = IsSctFrm();
+/*N*/ do
+/*N*/ {
+/*N*/ while ( ( (!pLayLeaf->IsSctFrm() && !pLayLeaf->IsTabFrm())
+/*N*/ || pLayLeaf == this ) &&
+/*N*/ pLayLeaf->Lower() && pLayLeaf->Lower()->IsLayoutFrm() )
+/*N*/ pLayLeaf = (SwLayoutFrm*)pLayLeaf->Lower();
+/*N*/
+/*N*/ if( ( pLayLeaf->IsTabFrm() || pLayLeaf->IsSctFrm() )
+/*N*/ && pLayLeaf != this )
+/*N*/ {
+/*N*/ // Wir liefern jetzt auch "geloeschte" SectionFrms zurueck,
+/*N*/ // damit diese beim SaveCntnt und RestoreCntnt mitgepflegt werden.
+/*N*/ return pLayLeaf;
+/*N*/ #ifdef USED
+/*N*/ const SwCntntFrm *pCnt = pLayLeaf->ContainsCntnt();
+/*N*/ if( pCnt )
+/*N*/ return pLayLeaf;
+/*N*/ if( pLayLeaf->GetNext() )
+/*N*/ {
+/*N*/ if( pLayLeaf->GetNext()->IsLayoutFrm() )
+/*N*/ {
+/*N*/ pLayLeaf = (SwLayoutFrm*)pLayLeaf->GetNext();
+/*N*/ continue;
+/*N*/ }
+/*N*/ else
+/*N*/ return (SwCntntFrm*)pLayLeaf->GetNext();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ else if ( pLayLeaf->Lower() )
+/*N*/ return (SwCntntFrm*)pLayLeaf->Lower();
+/*N*/
+/*N*/ pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+/*N*/ if( bNoFtn && pLayLeaf && pLayLeaf->IsInFtn() )
+/*N*/ {
+/*?*/ do
+/*?*/ {
+/*?*/ pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+/*?*/ } while( pLayLeaf && pLayLeaf->IsInFtn() );
+/*N*/ }
+/*N*/ if( !IsAnLower( pLayLeaf) )
+/*N*/ return 0;
+/*?*/ } while( pLayLeaf );
+/*?*/ return 0;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwFrm::GetLower()
+|*
+|* Ersterstellung MA 27. Jul. 92
+|* Letzte Aenderung MA 09. Oct. 97
+|*
+|*************************************************************************/
+/*N*/ const SwFrm* SwFrm::GetLower() const
+/*N*/ {
+/*N*/ return IsLayoutFrm() ? ((SwLayoutFrm*)this)->Lower() : 0;
+/*N*/ }
+
+/*N*/ SwFrm* SwFrm::GetLower()
+/*N*/ {
+/*N*/ return IsLayoutFrm() ? ((SwLayoutFrm*)this)->Lower() : 0;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::IsAnLower()
+|*
+|* Ersterstellung MA 18. Mar. 93
+|* Letzte Aenderung MA 18. Mar. 93
+|*
+|*************************************************************************/
+/*N*/ BOOL SwLayoutFrm::IsAnLower( const SwFrm *pAssumed ) const
+/*N*/ {
+/*N*/ const SwFrm *pUp = pAssumed;
+/*N*/ while ( pUp )
+/*N*/ {
+/*N*/ if ( pUp == this )
+/*N*/ return TRUE;
+/*N*/ if ( pUp->IsFlyFrm() )
+/*N*/ pUp = ((SwFlyFrm*)pUp)->GetAnchor();
+/*N*/ else
+/*N*/ pUp = pUp->GetUpper();
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/** method to check relative position of layout frame to
+ a given layout frame.
+
+ OD 08.11.2002 - refactoring of pseudo-local method <lcl_Apres(..)> in
+ <txtftn.cxx> for #104840#.
+
+ @param _aCheckRefLayFrm
+ constant reference of an instance of class <SwLayoutFrm> which
+ is used as the reference for the relative position check.
+
+ @author OD
+
+ @return true, if <this> is positioned before the layout frame <p>
+*/
+/*N*/ bool SwLayoutFrm::IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetPrevLayoutLeaf()
+|*
+|* Beschreibung Findet das vorhergehende Layout-Blatt. Ein Layout-
+|* Blatt ist ein LayoutFrm, der keinen LayoutFrm in seinen Unterbaum hat;
+|* genau gesagt, darf pLower kein LayoutFrm sein.
+|* Anders ausgedrueckt: pLower darf 0 sein oder auf einen CntntFrm
+|* zeigen.
+|* pLower darf allerdings auf einen TabFrm zeigen, denn diese stehen
+|* direkt neben den CntntFrms.
+|* Ersterstellung MA 29. May. 92
+|* Letzte Aenderung MA 30. Oct. 97
+|*
+|*************************************************************************/
+/*N*/ const SwFrm * MA_FASTCALL lcl_LastLower( const SwFrm *pFrm )
+/*N*/ {
+/*N*/ const SwFrm *pLower = pFrm->GetLower();
+/*N*/ if ( pLower )
+/*N*/ while ( pLower->GetNext() )
+/*N*/ pLower = pLower->GetNext();
+/*N*/ return pLower;
+/*N*/ }
+
+/*N*/ const SwLayoutFrm *SwFrm::GetPrevLayoutLeaf() const
+/*N*/ {
+/*N*/ const SwFrm *pFrm = this;
+/*N*/ const SwLayoutFrm *pLayoutFrm = 0;
+/*N*/ const SwFrm *p;
+/*N*/ FASTBOOL bGoingUp = TRUE;
+/*N*/ do {
+/*N*/ FASTBOOL bGoingBwd = FALSE, bGoingDown = FALSE;
+/*N*/ if( !(bGoingDown = (!bGoingUp && ( 0 != (p = ::binfilter::lcl_LastLower( pFrm ))))) &&
+/*N*/ !(bGoingBwd = (0 != (p = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->GetPrevLink()
+/*N*/ : pFrm->GetPrev()))) &&
+/*N*/ !(bGoingUp = (0 != (p = pFrm->GetUpper()))))
+/*N*/ return 0;
+/*N*/ bGoingUp = !( bGoingBwd || bGoingDown );
+/*N*/ pFrm = p;
+/*N*/ p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0;
+/*N*/ } while( (p && !p->IsFlowFrm()) ||
+/*N*/ pFrm == this ||
+/*N*/ 0 == (pLayoutFrm = pFrm->IsLayoutFrm() ? (SwLayoutFrm*)pFrm:0) ||
+/*N*/ pLayoutFrm->IsAnLower( this ) );
+/*N*/
+/*N*/ return pLayoutFrm;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwFrm::GetNextLayoutLeaf
+|*
+|* Beschreibung Findet das naechste Layout-Blatt. Ein Layout-Blatt
+|* ist ein LayoutFrm, der kein LayoutFrm in seinen Unterbaum hat;
+|* genau gesagt, darf pLower kein LayoutFrm sein.
+|* Anders ausgedrueckt: pLower darf 0 sein oder auf einen CntntFrm
+|* zeigen.
+|* pLower darf allerdings auf einen TabFrm zeigen, denn diese stehen
+|* direkt neben den CntntFrms.
+|* Ersterstellung MA 13. May. 92
+|* Letzte Aenderung MA 30. Oct. 97
+|*
+|*************************************************************************/
+/*N*/ const SwLayoutFrm *SwFrm::GetNextLayoutLeaf() const
+/*N*/ {
+/*N*/ const SwFrm *pFrm = this;
+/*N*/ const SwLayoutFrm *pLayoutFrm = 0;
+/*N*/ const SwFrm *p;
+/*N*/ FASTBOOL bGoingUp = FALSE;
+/*N*/ do {
+/*N*/ FASTBOOL bGoingFwd = FALSE, bGoingDown = FALSE;
+/*N*/ if( !(bGoingDown = (!bGoingUp && ( 0 !=
+/*N*/ (p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0)))) &&
+/*N*/ !(bGoingFwd = (0 != (p = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->GetNextLink()
+/*N*/ : pFrm->GetNext()))) &&
+/*N*/ !(bGoingUp = (0 != (p = pFrm->GetUpper()))))
+/*N*/ return 0;
+/*N*/ bGoingUp = !( bGoingFwd || bGoingDown );
+/*N*/ pFrm = p;
+/*N*/ p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0;
+/*N*/ } while( (p && !p->IsFlowFrm()) ||
+/*N*/ pFrm == this ||
+/*N*/ 0 == (pLayoutFrm = pFrm->IsLayoutFrm() ? (SwLayoutFrm*)pFrm:0 ) ||
+/*N*/ pLayoutFrm->IsAnLower( this ) );
+/*N*/
+/*N*/ return pLayoutFrm;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::FindRootFrm(), FindTabFrm(), FindFtnFrm(), FindFlyFrm(),
+|* FindPageFrm(), FindColFrm()
+|*
+|* Ersterstellung ??
+|* Letzte Aenderung MA 05. Sep. 93
+|*
+|*************************************************************************/
+/*N*/ SwRootFrm* SwFrm::FindRootFrm()
+/*N*/ {
+/*N*/ // MIB: A layout frame is always registerd at a SwFrmFmt and a content
+/*N*/ // frame alyways at a SwCntntNode. For any other case we won't find
+/*N*/ // a root frame.
+/*N*/ // Casting the GetDep() result instead of the frame itself (that has
+/*N*/ // been done before) makes it save to use that method in constructors
+/*N*/ // and destructors.
+/*N*/ ASSERT( GetDep(), "frame is not registered any longer" );
+/*N*/ ASSERT( IsLayoutFrm() || IsCntntFrm(), "invalid frame type" );
+/*N*/ SwDoc *pDoc = IsLayoutFrm()
+/*N*/ ? static_cast < SwFrmFmt * >( GetDep() )->GetDoc()
+/*N*/ : static_cast < SwCntntNode * >( GetDep() )->GetDoc();
+/*N*/ return pDoc->GetRootFrm();
+/*N*/ }
+
+/*N*/ SwPageFrm* SwFrm::FindPageFrm()
+/*N*/ {
+/*N*/ SwFrm *pRet = this;
+/*N*/ while ( pRet && !pRet->IsPageFrm() )
+/*N*/ {
+/*N*/ if ( pRet->GetUpper() )
+/*N*/ pRet = pRet->GetUpper();
+/*N*/ else if ( pRet->IsFlyFrm() )
+/*N*/ {
+/*N*/ if ( ((SwFlyFrm*)pRet)->IsFlyFreeFrm() &&
+/*N*/ ((SwFlyFreeFrm*)pRet)->GetPage() )
+/*N*/ pRet = ((SwFlyFreeFrm*)pRet)->GetPage();
+/*N*/ else
+/*N*/ pRet = ((SwFlyFrm*)pRet)->GetAnchor();
+/*N*/ }
+/*N*/ else
+/*N*/ return 0;
+/*N*/ }
+/*N*/ return (SwPageFrm*)pRet;
+/*N*/ }
+
+/*N*/ SwFtnBossFrm* SwFrm::FindFtnBossFrm( BOOL bFootnotes )
+/*N*/ {
+/*N*/ SwFrm *pRet = this;
+/*N*/ // Innerhalb einer Tabelle gibt es keine Fussnotenbosse, auch spaltige
+/*N*/ // Bereiche enthalten dort keine Fussnotentexte
+/*N*/ if( pRet->IsInTab() )
+/*N*/ pRet = pRet->FindTabFrm();
+/*N*/ while ( pRet && !pRet->IsFtnBossFrm() )
+/*N*/ {
+/*N*/ if ( pRet->GetUpper() )
+/*N*/ pRet = pRet->GetUpper();
+/*N*/ else if ( pRet->IsFlyFrm() )
+/*N*/ {
+/*N*/ if ( ((SwFlyFrm*)pRet)->IsFlyFreeFrm() )
+/*N*/ pRet = ((SwFlyFreeFrm*)pRet)->GetPage();
+/*N*/ else
+/*N*/ pRet = ((SwFlyFrm*)pRet)->GetAnchor();
+/*N*/ }
+/*N*/ else
+/*?*/ return 0;
+/*N*/ }
+/*N*/ if( bFootnotes && pRet && pRet->IsColumnFrm() &&
+/*N*/ !pRet->GetNext() && !pRet->GetPrev() )
+/*N*/ {
+/*?*/ SwSectionFrm* pSct = pRet->FindSctFrm();
+/*?*/ ASSERT( pSct, "FindFtnBossFrm: Single column outside section?" );
+/*?*/ if( !pSct->IsFtnAtEnd() )
+/*?*/ return pSct->FindFtnBossFrm( TRUE );
+/*N*/ }
+/*N*/ return (SwFtnBossFrm*)pRet;
+/*N*/ }
+
+/*N*/ SwTabFrm* SwFrm::ImplFindTabFrm()
+/*N*/ {
+/*N*/ SwFrm *pRet = this;
+/*N*/ while ( !pRet->IsTabFrm() )
+/*N*/ {
+/*N*/ pRet = pRet->GetUpper();
+/*N*/ if ( !pRet )
+/*?*/ return 0;
+/*N*/ }
+/*N*/ return (SwTabFrm*)pRet;
+/*N*/ }
+
+/*N*/ SwSectionFrm* SwFrm::ImplFindSctFrm()
+/*N*/ {
+/*N*/ SwFrm *pRet = this;
+/*N*/ while ( !pRet->IsSctFrm() )
+/*N*/ {
+/*N*/ pRet = pRet->GetUpper();
+/*N*/ if ( !pRet )
+/*?*/ return 0;
+/*N*/ }
+/*N*/ return (SwSectionFrm*)pRet;
+/*N*/ }
+
+
+/*N*/ SwFtnFrm *SwFrm::ImplFindFtnFrm()
+/*N*/ {
+/*N*/ SwFrm *pRet = this;
+/*N*/ while ( !pRet->IsFtnFrm() )
+/*N*/ {
+/*N*/ pRet = pRet->GetUpper();
+/*N*/ if ( !pRet )
+/*?*/ return 0;
+/*N*/ }
+/*N*/ return (SwFtnFrm*)pRet;
+/*N*/ }
+
+/*N*/ SwFlyFrm *SwFrm::ImplFindFlyFrm()
+/*N*/ {
+/*N*/ const SwFrm *pRet = this;
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pRet->IsFlyFrm() )
+/*N*/ return (SwFlyFrm*)pRet;
+/*N*/ else
+/*N*/ pRet = pRet->GetUpper();
+/*N*/ } while ( pRet );
+/*?*/ return 0;
+/*N*/ }
+
+/*N*/ SwFrm *SwFrm::FindColFrm()
+/*N*/ {
+/*N*/ SwFrm *pFrm = this;
+/*N*/ do
+/*N*/ { pFrm = pFrm->GetUpper();
+/*N*/ } while ( pFrm && !pFrm->IsColumnFrm() );
+/*N*/ return pFrm;
+/*N*/ }
+
+/*N*/ SwFrm* SwFrm::FindFooterOrHeader()
+/*N*/ {
+/*N*/ SwFrm* pRet = this;
+/*N*/ do
+/*N*/ { if ( pRet->GetType() & 0x0018 ) //Header und Footer
+/*N*/ return pRet;
+/*N*/ else if ( pRet->GetUpper() )
+/*N*/ pRet = pRet->GetUpper();
+/*N*/ else if ( pRet->IsFlyFrm() )
+/*N*/ pRet = ((SwFlyFrm*)pRet)->GetAnchor();
+/*N*/ else
+/*N*/ return 0;
+/*N*/ } while ( pRet );
+/*?*/ return pRet;
+/*N*/ }
+
+
+
+
+/*************************************************************************
+|*
+|* SwFrmFrm::GetAttrSet()
+|*
+|* Ersterstellung MA 02. Aug. 93
+|* Letzte Aenderung MA 02. Aug. 93
+|*
+|*************************************************************************/
+/*N*/ const SwAttrSet* SwFrm::GetAttrSet() const
+/*N*/ {
+/*N*/ if ( IsCntntFrm() )
+/*N*/ return &((const SwCntntFrm*)this)->GetNode()->GetSwAttrSet();
+/*N*/ else
+/*N*/ return &((const SwLayoutFrm*)this)->GetFmt()->GetAttrSet();
+/*N*/ }
+
+/*N*/ SwAttrSet* SwFrm::GetAttrSet()
+/*N*/ {
+/*N*/ if ( IsCntntFrm() )
+/*N*/ return &((SwCntntFrm*)this)->GetNode()->GetSwAttrSet();
+/*N*/ else
+/*N*/ return (SwAttrSet*)&((SwLayoutFrm*)this)->GetFmt()->GetAttrSet();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::_FindNext(), _FindPrev(), InvalidateNextPos()
+|* _FindNextCnt() geht in Tabellen und Bereiche hineinund liefert
+|* nur SwCntntFrms.
+|*
+|* Beschreibung Invalidiert die Position des Naechsten Frames.
+|* Dies ist der direkte Nachfolger, oder bei CntntFrm's der naechste
+|* CntntFrm der im gleichen Fluss liegt wie ich:
+|* - Body,
+|* - Fussnoten,
+|* - Bei Kopf-/Fussbereichen ist die Benachrichtigung nur innerhalb des
+|* Bereiches weiterzuleiten.
+|* - dito fuer Flys.
+|* - Cntnts in Tabs halten sich ausschliesslich innerhalb ihrer Zelle
+|* auf.
+|* - Tabellen verhalten sich prinzipiell analog zu den Cntnts
+|* - Bereiche ebenfalls
+|* Ersterstellung AK 14-Feb-1991
+|* Letzte Aenderung AMA 10. Mar. 99
+|*
+|*************************************************************************/
+
+// Diese Hilfsfunktion ist ein Aequivalent zur ImplGetNextCntntFrm()-Methode,
+// sie liefert allerdings neben ContentFrames auch TabFrms und SectionFrms.
+/*N*/ SwFrm* lcl_NextFrm( SwFrm* pFrm )
+/*N*/ {
+/*N*/ SwFrm *pRet = 0;
+/*N*/ FASTBOOL bGoingUp = FALSE;
+/*N*/ do {
+/*N*/ SwFrm *p;
+/*N*/ FASTBOOL bGoingFwd = FALSE, bGoingDown = FALSE;
+/*N*/ if( !(bGoingDown = (!bGoingUp && ( 0 !=
+/*N*/ (p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0)))) &&
+/*N*/ !(bGoingFwd = (0 != (p = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->GetNextLink()
+/*N*/ : pFrm->GetNext()))) &&
+/*N*/ !(bGoingUp = (0 != (p = pFrm->GetUpper()))))
+/*N*/ return 0;
+/*N*/ bGoingUp = !(bGoingFwd || bGoingDown);
+/*N*/ pFrm = p;
+/*N*/ } while ( 0 == (pRet = ( ( pFrm->IsCntntFrm() || ( !bGoingUp &&
+/*N*/ ( pFrm->IsTabFrm() || pFrm->IsSctFrm() ) ) )? pFrm : 0 ) ) );
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ SwFrm *SwFrm::_FindNext()
+/*N*/ {
+/*N*/ BOOL bIgnoreTab = FALSE;
+/*N*/ SwFrm *pThis = this;
+/*N*/
+/*N*/ if ( IsTabFrm() )
+/*N*/ {
+/*N*/ //Der letzte Cntnt der Tabelle wird
+/*N*/ //gegriffen und dessen Nachfolger geliefert. Um die Spezialbeh.
+/*N*/ //Fuer Tabellen (s.u.) auszuschalten wird bIgnoreTab gesetzt.
+/*N*/ if ( ((SwTabFrm*)this)->GetFollow() )
+/*N*/ return ((SwTabFrm*)this)->GetFollow();
+/*N*/
+/*N*/ pThis = ((SwTabFrm*)this)->FindLastCntnt();
+/*N*/ if ( !pThis )
+/*?*/ pThis = this;
+/*N*/ bIgnoreTab = TRUE;
+/*N*/ }
+/*N*/ else if ( IsSctFrm() )
+/*N*/ {
+/*N*/ //Der letzte Cntnt des Bereichs wird gegriffen und dessen Nachfolger
+/*N*/ // geliefert.
+/*N*/ if ( ((SwSectionFrm*)this)->GetFollow() )
+/*N*/ return ((SwSectionFrm*)this)->GetFollow();
+/*N*/
+/*N*/ pThis = ((SwSectionFrm*)this)->FindLastCntnt();
+/*N*/ if ( !pThis )
+/*N*/ pThis = this;
+/*N*/ }
+/*N*/ else if ( IsCntntFrm() )
+/*N*/ {
+/*N*/ if( ((SwCntntFrm*)this)->GetFollow() )
+/*N*/ return ((SwCntntFrm*)this)->GetFollow();
+/*N*/ }
+/*N*/ else if ( IsRowFrm() )
+/*N*/ {
+/*N*/ SwFrm* pUpper = GetUpper();
+/*N*/ if ( pUpper->IsTabFrm() && ((SwTabFrm*)pUpper)->GetFollow() )
+/*N*/ return ((SwTabFrm*)pUpper)->GetFollow()->GetLower();
+/*N*/ else return NULL;
+/*N*/ }
+/*N*/ else
+/*N*/ return NULL;
+/*N*/
+/*N*/ SwFrm* pRet = NULL;
+/*N*/ const BOOL bFtn = pThis->IsInFtn();
+/*N*/ if ( !bIgnoreTab && pThis->IsInTab() )
+/*N*/ {
+/*N*/ SwLayoutFrm *pUp = pThis->GetUpper();
+/*N*/ while ( !pUp->IsCellFrm() )
+/*?*/ pUp = pUp->GetUpper();
+/*N*/ ASSERT( pUp, "Cntnt in Tabelle aber nicht in Zelle." );
+/*N*/ SwFrm *pNxt = lcl_NextFrm( pThis );
+/*N*/ if ( pUp->IsAnLower( pNxt ) )
+/*?*/ pRet = pNxt;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const BOOL bBody = pThis->IsInDocBody();
+/*N*/ SwFrm *pNxtCnt = lcl_NextFrm( pThis );
+/*N*/ if ( pNxtCnt )
+/*N*/ {
+/*N*/ if ( bBody || bFtn )
+/*N*/ {
+/*N*/ while ( pNxtCnt )
+/*N*/ {
+/*N*/ // OD 02.04.2003 #108446# - check for endnote, only if found
+/*N*/ // next content isn't contained in a section, that collect its
+/*N*/ // endnotes at its end.
+/*N*/ bool bEndn = IsInSct() && !IsSctFrm() &&
+/*N*/ ( !pNxtCnt->IsInSct() ||
+/*N*/ !pNxtCnt->FindSctFrm()->IsEndnAtEnd()
+/*N*/ );
+/*N*/ if ( ( bBody && pNxtCnt->IsInDocBody() ) ||
+/*N*/ ( pNxtCnt->IsInFtn() &&
+/*N*/ ( bFtn ||
+/*N*/ ( bEndn && pNxtCnt->FindFtnFrm()->GetAttr()->GetFtn().IsEndNote() )
+/*N*/ )
+/*N*/ )
+/*N*/ )
+/*N*/ {
+/*N*/ pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrm()
+/*N*/ : (SwFrm*)pNxtCnt;
+/*N*/ break;
+/*N*/ }
+/*N*/ pNxtCnt = lcl_NextFrm( pNxtCnt );
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pThis->IsInFly() )
+/*N*/ {
+/*N*/ pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrm()
+/*N*/ : (SwFrm*)pNxtCnt;
+/*N*/ }
+/*N*/ else //Fuss-/oder Kopfbereich
+/*N*/ {
+/*N*/ const SwFrm *pUp = pThis->GetUpper();
+/*N*/ const SwFrm *pCntUp = pNxtCnt->GetUpper();
+/*N*/ while ( pUp && pUp->GetUpper() &&
+/*N*/ !pUp->IsHeaderFrm() && !pUp->IsFooterFrm() )
+/*?*/ pUp = pUp->GetUpper();
+/*N*/ while ( pCntUp && pCntUp->GetUpper() &&
+/*N*/ !pCntUp->IsHeaderFrm() && !pCntUp->IsFooterFrm() )
+/*N*/ pCntUp = pCntUp->GetUpper();
+/*N*/ if ( pCntUp == pUp )
+/*N*/ {
+/*?*/ pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrm()
+/*?*/ : (SwFrm*)pNxtCnt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( pRet && pRet->IsInSct() )
+/*N*/ {
+/*N*/ SwSectionFrm* pSct = pRet->FindSctFrm();
+/*N*/ //Fussnoten in spaltigen Rahmen duerfen nicht den Bereich
+/*N*/ //liefern, der die Fussnoten umfasst
+/*N*/ if( !pSct->IsAnLower( this ) &&
+/*N*/ (!bFtn || pSct->IsInFtn() ) )
+/*N*/ return pSct;
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ SwCntntFrm *SwFrm::_FindNextCnt()
+/*N*/ {
+/*N*/ SwFrm *pThis = this;
+/*N*/
+/*N*/ if ( IsTabFrm() )
+/*N*/ {
+/*N*/ if ( ((SwTabFrm*)this)->GetFollow() )
+/*N*/ {
+/*N*/ pThis = ((SwTabFrm*)this)->GetFollow()->ContainsCntnt();
+/*N*/ if( pThis )
+/*N*/ return (SwCntntFrm*)pThis;
+/*N*/ }
+/*N*/ pThis = ((SwTabFrm*)this)->FindLastCntnt();
+/*N*/ if ( !pThis )
+/*?*/ return 0;
+/*N*/ }
+/*N*/ else if ( IsSctFrm() )
+/*N*/ {
+/*?*/ if ( ((SwSectionFrm*)this)->GetFollow() )
+/*?*/ {
+/*?*/ pThis = ((SwSectionFrm*)this)->GetFollow()->ContainsCntnt();
+/*?*/ if( pThis )
+/*?*/ return (SwCntntFrm*)pThis;
+/*?*/ }
+/*?*/ pThis = ((SwSectionFrm*)this)->FindLastCntnt();
+/*?*/ if ( !pThis )
+/*?*/ return 0;
+/*N*/ }
+/*N*/ else if ( IsCntntFrm() && ((SwCntntFrm*)this)->GetFollow() )
+/*N*/ return ((SwCntntFrm*)this)->GetFollow();
+/*N*/
+/*N*/ if ( pThis->IsCntntFrm() )
+/*N*/ {
+/*N*/ const BOOL bBody = pThis->IsInDocBody();
+/*N*/ const BOOL bFtn = pThis->IsInFtn();
+/*N*/ SwCntntFrm *pNxtCnt = ((SwCntntFrm*)pThis)->GetNextCntntFrm();
+/*N*/ if ( pNxtCnt )
+/*N*/ {
+/*N*/ if ( bBody || bFtn )
+/*N*/ {
+/*N*/ while ( pNxtCnt )
+/*N*/ {
+/*N*/ if ( (bBody && pNxtCnt->IsInDocBody()) ||
+/*N*/ (bFtn && pNxtCnt->IsInFtn()) )
+/*N*/ return pNxtCnt;
+/*N*/ pNxtCnt = pNxtCnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pThis->IsInFly() )
+/*N*/ return pNxtCnt;
+/*N*/ else //Fuss-/oder Kopfbereich
+/*N*/ {
+/*N*/ const SwFrm *pUp = pThis->GetUpper();
+/*N*/ const SwFrm *pCntUp = pNxtCnt->GetUpper();
+/*N*/ while ( pUp && pUp->GetUpper() &&
+/*N*/ !pUp->IsHeaderFrm() && !pUp->IsFooterFrm() )
+/*?*/ pUp = pUp->GetUpper();
+/*N*/ while ( pCntUp && pCntUp->GetUpper() &&
+/*N*/ !pCntUp->IsHeaderFrm() && !pCntUp->IsFooterFrm() )
+/*N*/ pCntUp = pCntUp->GetUpper();
+/*N*/ if ( pCntUp == pUp )
+/*?*/ return pNxtCnt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ SwFrm *SwFrm::_FindPrev()
+/*N*/ {
+/*N*/ BOOL bIgnoreTab = FALSE;
+/*N*/ SwFrm *pThis = this;
+/*N*/
+/*N*/ if ( IsTabFrm() )
+/*N*/ {
+/*N*/ //Der erste Cntnt der Tabelle wird
+/*N*/ //gegriffen und dessen Vorgaenger geliefert. Um die Spezialbeh.
+/*N*/ //Fuer Tabellen (s.u.) auszuschalten wird bIgnoreTab gesetzt.
+/*N*/ pThis = ((SwTabFrm*)this)->ContainsCntnt();
+/*N*/ bIgnoreTab = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ if ( pThis->IsCntntFrm() )
+/*N*/ {
+/*N*/ SwCntntFrm *pPrvCnt = ((SwCntntFrm*)pThis)->GetPrevCntntFrm();
+/*N*/ if( !pPrvCnt )
+/*N*/ return 0;
+/*N*/ if ( !bIgnoreTab && pThis->IsInTab() )
+/*N*/ {
+/*?*/ SwLayoutFrm *pUp = pThis->GetUpper();
+/*?*/ while ( !pUp->IsCellFrm() )
+/*?*/ pUp = pUp->GetUpper();
+/*?*/ ASSERT( pUp, "Cntnt in Tabelle aber nicht in Zelle." );
+/*?*/ if ( pUp->IsAnLower( pPrvCnt ) )
+/*?*/ return pPrvCnt;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwFrm* pRet;
+/*N*/ const BOOL bBody = pThis->IsInDocBody();
+/*N*/ const BOOL bFtn = bBody ? FALSE : pThis->IsInFtn();
+/*N*/ if ( bBody || bFtn )
+/*N*/ {
+/*N*/ while ( pPrvCnt )
+/*N*/ {
+/*N*/ if ( (bBody && pPrvCnt->IsInDocBody()) ||
+/*N*/ (bFtn && pPrvCnt->IsInFtn()) )
+/*N*/ {
+/*N*/ pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrm()
+/*N*/ : (SwFrm*)pPrvCnt;
+/*N*/ return pRet;
+/*N*/ }
+/*N*/ pPrvCnt = pPrvCnt->GetPrevCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pThis->IsInFly() )
+/*N*/ {
+/*N*/ pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrm()
+/*N*/ : (SwFrm*)pPrvCnt;
+/*N*/ return pRet;
+/*N*/ }
+/*N*/ else //Fuss-/oder Kopfbereich oder Fly
+/*N*/ {
+/*?*/ const SwFrm *pUp = pThis->GetUpper();
+/*?*/ const SwFrm *pCntUp = pPrvCnt->GetUpper();
+/*?*/ while ( pUp && pUp->GetUpper() &&
+/*?*/ !pUp->IsHeaderFrm() && !pUp->IsFooterFrm() )
+/*?*/ pUp = pUp->GetUpper();
+/*?*/ while ( pCntUp && pCntUp->GetUpper() )
+/*?*/ pCntUp = pCntUp->GetUpper();
+/*?*/ if ( pCntUp == pUp )
+/*?*/ {
+/*?*/ pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrm()
+/*?*/ : (SwFrm*)pPrvCnt;
+/*?*/ return pRet;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ void SwFrm::ImplInvalidateNextPos( BOOL bNoFtn )
+/*N*/ {
+/*N*/ SwFrm *pFrm;
+/*N*/ if ( 0 != (pFrm = _FindNext()) )
+/*N*/ {
+/*N*/ if( pFrm->IsSctFrm() )
+/*N*/ {
+/*N*/ while( pFrm && pFrm->IsSctFrm() )
+/*N*/ {
+/*N*/ if( ((SwSectionFrm*)pFrm)->GetSection() )
+/*N*/ {
+/*N*/ SwFrm* pTmp = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if( pTmp )
+/*N*/ pTmp->InvalidatePos();
+/*N*/ else if( !bNoFtn )
+/*N*/ ((SwSectionFrm*)pFrm)->InvalidateFtnPos();
+/*N*/ if( !IsInSct() || FindSctFrm()->GetFollow() != pFrm )
+/*N*/ pFrm->InvalidatePos();
+/*N*/ return;
+/*N*/ }
+/*N*/ pFrm = pFrm->FindNext();
+/*N*/ }
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ if ( pFrm->IsSctFrm())
+/*N*/ { // Damit der Inhalt eines Bereichs die Chance erhaelt,
+/*?*/ // die Seite zu wechseln, muss er ebenfalls invalidiert werden.
+/*?*/ SwFrm* pTmp = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*?*/ if( pTmp )
+/*?*/ pTmp->InvalidatePos();
+/*?*/ if( !IsInSct() || FindSctFrm()->GetFollow() != pFrm )
+/*?*/ pFrm->InvalidatePos();
+/*N*/ }
+/*N*/ else
+/*N*/ pFrm->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pFrm->InvalidatePos();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* lcl_IsInColSect()
+|* liefert nur TRUE, wenn der Frame _direkt_ in einem spaltigen Bereich steht,
+|* nicht etwa, wenn er in einer Tabelle steht, die in einem spaltigen Bereich ist.
+|*
+|*************************************************************************/
+
+/*N*/ BOOL lcl_IsInColSct( const SwFrm *pUp )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ while( pUp )
+/*N*/ {
+/*N*/ if( pUp->IsColumnFrm() )
+/*N*/ bRet = TRUE;
+/*N*/ else if( pUp->IsSctFrm() )
+/*N*/ return bRet;
+/*N*/ else if( pUp->IsTabFrm() )
+/*N*/ return FALSE;
+/*N*/ pUp = pUp->GetUpper();
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::IsMoveable();
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 05. May. 95
+|*
+|*************************************************************************/
+/*N*/ BOOL SwFrm::IsMoveable() const
+/*N*/ {
+/*N*/ if ( IsFlowFrm() )
+/*N*/ {
+/*N*/ if( IsInSct() && lcl_IsInColSct( GetUpper() ) )
+/*?*/ return TRUE;
+/*N*/ if( IsInFly() || IsInDocBody() || IsInFtn() )
+/*N*/ {
+/*N*/ if ( IsInTab() && !IsTabFrm() )
+/*N*/ return FALSE;
+/*N*/ BOOL bRet = TRUE;
+/*N*/ if ( IsInFly() )
+/*N*/ {
+/*N*/ //Wenn der Fly noch einen Follow hat ist der Inhalt auf jeden
+/*N*/ //Fall moveable
+/*N*/ if ( !((SwFlyFrm*)FindFlyFrm())->GetNextLink() )
+/*N*/ {
+/*N*/ //Fuer Inhalt innerhab von Spaltigen Rahmen ist nur der Inhalt
+/*N*/ //der letzten Spalte nicht moveable.
+/*N*/ const SwFrm *pCol = GetUpper();
+/*N*/ while ( pCol && !pCol->IsColumnFrm() )
+/*N*/ pCol = pCol->GetUpper();
+/*N*/ if ( !pCol || (pCol && !pCol->GetNext()) )
+/*N*/ bRet = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::ImplGetNextCntntFrm(), ImplGetPrevCntntFrm()
+|*
+|* Rueckwaertswandern im Baum: Den untergeordneten Frm greifen,
+|* wenn es einen gibt und nicht gerade zuvor um eine Ebene
+|* aufgestiegen wurde (das wuerde zu einem endlosen Auf und Ab
+|* fuehren!). Damit wird sichergestellt, dass beim
+|* Rueckwaertswandern alle Unterbaeume durchsucht werden. Wenn
+|* abgestiegen wurde, wird zuerst an das Ende der Kette gegangen,
+|* weil im weiteren ja vom letzten Frm innerhalb eines anderen
+|* Frms rueckwaerts gegangen wird.
+|* Vorwaetzwander funktioniert analog.
+|*
+|* Ersterstellung ??
+|* Letzte Aenderung MA 30. Oct. 97
+|*
+|*************************************************************************/
+
+
+// Achtung: Fixes in ImplGetNextCntntFrm() muessen moeglicherweise auch in
+// die weiter oben stehende Methode lcl_NextFrm(..) eingepflegt werden
+/*M*/ SwCntntFrm* SwFrm::ImplGetNextCntntFrm() const
+/*M*/ {
+/*M*/ const SwFrm *pFrm = this;
+/*M*/ // #100926#
+/*M*/ SwCntntFrm *pCntntFrm = 0;
+/*M*/ FASTBOOL bGoingUp = ! IsCntntFrm();
+/*M*/ do {
+/*M*/ const SwFrm *p;
+/*M*/ FASTBOOL bGoingFwd = FALSE, bGoingDown = FALSE;
+/*M*/ if( !(bGoingDown = (!bGoingUp && ( 0 !=
+/*M*/ (p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0)))) &&
+/*M*/ !(bGoingFwd = (0 != (p = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->GetNextLink()
+/*M*/ : pFrm->GetNext()))) &&
+/*M*/ !(bGoingUp = (0 != (p = pFrm->GetUpper()))))
+/*M*/ return 0;
+/*M*/ bGoingUp = !(bGoingFwd || bGoingDown);
+/*M*/ pFrm = p;
+/*M*/ } while ( 0 == (pCntntFrm = (pFrm->IsCntntFrm() ? (SwCntntFrm*)pFrm:0) ));
+/*M*/ return pCntntFrm;
+/*M*/
+/*M*/ }
+
+/*M*/ SwCntntFrm* SwFrm::ImplGetPrevCntntFrm() const
+/*M*/ {
+/*M*/ const SwFrm *pFrm = this;
+/*M*/ SwCntntFrm *pCntntFrm = 0;
+/*M*/ // #100926#
+/*M*/ FASTBOOL bGoingUp = ! IsCntntFrm();
+/*M*/ do {
+/*M*/ const SwFrm *p;
+/*M*/ FASTBOOL bGoingBack = FALSE, bGoingDown = FALSE;
+/*M*/ if( !(bGoingDown = (!bGoingUp && (0 !=
+/*M*/ (p = pFrm->IsLayoutFrm() ? ((SwLayoutFrm*)pFrm)->Lower() : 0)))) &&
+/*M*/ !(bGoingBack = (0 != (p = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->GetPrevLink()
+/*M*/ : pFrm->GetPrev()))) &&
+/*M*/ !(bGoingUp = (0 != (p = pFrm->GetUpper()))))
+/*M*/ return 0;
+/*M*/ bGoingUp = !(bGoingBack || bGoingDown);
+/*M*/ if( bGoingDown && p )
+/*M*/ while ( p->GetNext() )
+/*M*/ p = p->GetNext();
+/*M*/ pFrm = p;
+/*M*/ } while ( 0 == (pCntntFrm = (pFrm->IsCntntFrm() ? (SwCntntFrm*)pFrm:0) ));
+/*M*/ return pCntntFrm;
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::SetInfFlags();
+|*
+|* Ersterstellung MA 05. Apr. 94
+|* Letzte Aenderung MA 05. Apr. 94
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::SetInfFlags()
+/*N*/ {
+/*N*/ if ( !IsFlyFrm() && !GetUpper() ) //noch nicht gepastet, keine Informationen
+/*N*/ return; //lieferbar
+/*N*/
+/*N*/ bInfInvalid = bInfBody = bInfTab = bInfFly = bInfFtn = bInfSct = FALSE;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ BOOL bIsInTab = FALSE;
+/*N*/ #endif
+/*N*/
+/*N*/ SwFrm *pFrm = this;
+/*N*/ if( IsFtnContFrm() )
+/*N*/ bInfFtn = TRUE;
+/*N*/ do
+/*N*/ { // bInfBody wird nur am Seitenbody, nicht im ColumnBody gesetzt
+/*N*/ if ( pFrm->IsBodyFrm() && !bInfFtn && pFrm->GetUpper()
+/*N*/ && pFrm->GetUpper()->IsPageFrm() )
+/*N*/ bInfBody = TRUE;
+/*N*/ else if ( pFrm->IsTabFrm() || pFrm->IsCellFrm() )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( pFrm->IsTabFrm() )
+/*N*/ {
+/*N*/ ASSERT( !bIsInTab, "Table in table: Not implemented." );
+/*N*/ bIsInTab = TRUE;
+/*N*/ }
+/*N*/ #endif
+/*N*/ bInfTab = TRUE;
+/*N*/ }
+/*N*/ else if ( pFrm->IsFlyFrm() )
+/*N*/ bInfFly = TRUE;
+/*N*/ else if ( pFrm->IsSctFrm() )
+/*N*/ bInfSct = TRUE;
+/*N*/ else if ( pFrm->IsFtnFrm() )
+/*N*/ bInfFtn = TRUE;
+/*N*/
+/*N*/ //MA: 06. Apr. 94, oberhalb eines Fly geht es nicht weiter!
+/*N*/ // if ( pFrm->IsFlyFrm() )
+/*N*/ // pFrm = ((SwFlyFrm*)pFrm)->GetAnchor();
+/*N*/ // else
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/
+/*N*/ } while ( pFrm && !pFrm->IsPageFrm() ); //Oberhalb der Seite kommt nix
+/*N*/ }
+
+/*-----------------22.8.2001 14:30------------------
+ * SwFrm::SetDirFlags( BOOL )
+ * actualizes the vertical or the righttoleft-flags.
+ * If the property is derived, it's from the upper or (for fly frames) from
+ * the anchor. Otherwise we've to call a virtual method to check the property.
+ * --------------------------------------------------*/
+
+/*N*/ void SwFrm::SetDirFlags( BOOL bVert )
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ USHORT bInv = 0;
+/*N*/ if( bDerivedVert )
+/*N*/ {
+/*N*/ SwFrm* pAsk = IsFlyFrm() ?
+/*N*/ ((SwFlyFrm*)this)->GetAnchor() : GetUpper();
+/*N*/ if( pAsk )
+/*N*/ {
+/*N*/ bVertical = pAsk->IsVertical() ? 1 : 0;
+/*N*/ bReverse = pAsk->IsReverse() ? 1 : 0;
+/*N*/ }
+/*N*/ if( !pAsk || pAsk->bInvalidVert )
+/*N*/ bInv = bInvalidVert;
+/*N*/ }
+/*N*/ else
+/*N*/ CheckDirection( bVert );
+/*N*/ bInvalidVert = bInv;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bInv = 0;
+/*N*/ if( !bDerivedR2L ) // CheckDirection is able to set bDerivedR2L!
+/*N*/ CheckDirection( bVert );
+/*N*/ if( bDerivedR2L )
+/*N*/ {
+/*N*/ SwFrm* pAsk = IsFlyFrm() ?
+/*N*/ ((SwFlyFrm*)this)->GetAnchor() : GetUpper();
+/*N*/ if( pAsk )
+/*N*/ bRightToLeft = pAsk->IsRightToLeft() ? 1 : 0;
+/*N*/ if( !pAsk || pAsk->bInvalidR2L )
+/*N*/ bInv = bInvalidR2L;
+/*N*/ }
+/*N*/ bInvalidR2L = bInv;
+/*N*/ }
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_flowfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_flowfrm.cxx
new file mode 100644
index 000000000000..51b4467a024c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_flowfrm.cxx
@@ -0,0 +1,1896 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+#include "pam.hxx"
+#include "swtable.hxx"
+#include "pagefrm.hxx"
+
+#include <horiornt.hxx>
+
+#include "viewsh.hxx"
+#include "doc.hxx"
+#include "viewimp.hxx"
+#include "dflyobj.hxx"
+#include "frmtool.hxx"
+#include "dcontact.hxx"
+
+#include <bf_svx/brkitem.hxx>
+#include <bf_svx/keepitem.hxx>
+
+#include <fmtsrnd.hxx>
+#include <fmtanchr.hxx>
+#include <fmtpdsc.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <tgrditem.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <bf_svx/pgrditem.hxx>
+#include <paratr.hxx>
+
+#include "ftnfrm.hxx"
+#include "txtfrm.hxx"
+#include "tabfrm.hxx"
+#include "pagedesc.hxx"
+#include "layact.hxx"
+#include "frmsh.hxx"
+#include "fmtornt.hxx"
+#include "flyfrms.hxx"
+#include "sectfrm.hxx"
+#include "section.hxx"
+#include "dbg_lay.hxx"
+#include "lineinfo.hxx"
+namespace binfilter {
+
+/*N*/ BOOL SwFlowFrm::bMoveBwdJump = FALSE;
+
+
+/*************************************************************************
+|*
+|* SwFlowFrm::SwFlowFrm()
+|*
+|* Ersterstellung MA 26. Apr. 95
+|* Letzte Aenderung MA 26. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*M*/ SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) :
+/*M*/ rThis( rFrm ),
+/*M*/ pFollow( 0 )
+/*M*/ {
+/*M*/ bLockJoin = bIsFollow = bCntntLock = bOwnFtnNum =
+/*M*/ bFtnLock = bFlyLock = FALSE;
+/*M*/ }
+
+
+/*************************************************************************
+|*
+|* SwFlowFrm::IsFollowLocked()
+|* return TRUE if any follow has the JoinLocked flag
+|*
+|*************************************************************************/
+
+/*M*/ sal_Bool SwFlowFrm::HasLockedFollow() const
+/*M*/ {
+/*M*/ const SwFlowFrm* pFrm = GetFollow();
+/*M*/ while( pFrm )
+/*M*/ {
+/*M*/ if( pFrm->IsJoinLocked() )
+/*M*/ return sal_True;
+/*M*/ pFrm = pFrm->GetFollow();
+/*M*/ }
+/*M*/ return sal_False;
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::IsKeepFwdMoveAllowed()
+|*
+|* Ersterstellung MA 20. Jul. 94
+|* Letzte Aenderung MA 16. May. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::IsKeepFwdMoveAllowed()
+/*N*/ {
+/*N*/ //Wenn der Vorgaenger das KeepAttribut traegt und auch dessen
+/*N*/ //Vorgaenger usw. bis zum ersten der Kette und fuer diesen das
+/*N*/ //IsFwdMoveAllowed ein FALSE liefert, so ist das Moven eben nicht erlaubt.
+/*N*/ SwFrm *pFrm = &rThis;
+/*N*/ if ( !pFrm->IsInFtn() )
+/*N*/ do
+/*N*/ { if ( pFrm->GetAttrSet()->GetKeep().GetValue() )
+/*N*/ pFrm = pFrm->GetIndPrev();
+/*N*/ else
+/*N*/ return TRUE;
+/*N*/ } while ( pFrm );
+/*N*/
+/*N*/ //Siehe IsFwdMoveAllowed()
+/*N*/ return pFrm ? pFrm->GetIndPrev() != 0 : FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::CheckKeep()
+|*
+|* Beschreibung
+|* Ersterstellung MA 20. Jun. 95
+|* Letzte Aenderung MA 09. Apr. 97
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFlowFrm::CheckKeep()
+/*N*/ {
+/*N*/ //Den 'letzten' Vorgaenger mit KeepAttribut anstossen, denn
+/*N*/ //die ganze Truppe koennte zuruckrutschen.
+/*N*/ SwFrm *pPre = rThis.GetIndPrev();
+/*N*/ if( pPre->IsSctFrm() )
+/*N*/ {
+/*N*/ SwFrm *pLast = ((SwSectionFrm*)pPre)->FindLastCntnt();
+/*N*/ if( pLast && pLast->FindSctFrm() == pPre )
+/*N*/ pPre = pLast;
+/*N*/ else
+/*N*/ return;
+/*N*/ }
+/*N*/ SwFrm* pTmp;
+/*N*/ BOOL bKeep;
+/*N*/ while ( TRUE == (bKeep = pPre->GetAttrSet()->GetKeep().GetValue()) &&
+/*N*/ 0 != ( pTmp = pPre->GetIndPrev() ) )
+/*N*/ {
+/*N*/ if( pTmp->IsSctFrm() )
+/*N*/ {
+/*N*/ SwFrm *pLast = ((SwSectionFrm*)pTmp)->FindLastCntnt();
+/*N*/ if( pLast && pLast->FindSctFrm() == pTmp )
+/*N*/ pTmp = pLast;
+/*N*/ else
+/*?*/ break;
+/*N*/ }
+/*N*/ pPre = pTmp;
+/*N*/ }
+/*N*/ if ( bKeep )
+/*N*/ pPre->InvalidatePos();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::IsKeep()
+|*
+|* Ersterstellung MA 09. Apr. 97
+|* Letzte Aenderung MA 09. Apr. 97
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::IsKeep( const SwBorderAttrs &rAttrs ) const
+/*N*/ {
+/*N*/ BOOL bKeep = !rThis.IsInFtn() && rAttrs.GetAttrSet().GetKeep().GetValue();
+/*N*/ //Keep Zaehlt nicht wenn die Umbrueche dagegen sprechen.
+/*N*/ if ( bKeep )
+/*N*/ {
+/*N*/ switch ( rAttrs.GetAttrSet().GetBreak().GetBreak() )
+/*N*/ {
+/*?*/ case SVX_BREAK_COLUMN_AFTER:
+/*?*/ case SVX_BREAK_COLUMN_BOTH:
+/*?*/ case SVX_BREAK_PAGE_AFTER:
+/*?*/ case SVX_BREAK_PAGE_BOTH:
+/*?*/ bKeep = FALSE;
+/*N*/ }
+/*N*/ if ( bKeep )
+/*N*/ {
+/*N*/ SwFrm *pNxt;
+/*N*/ if( 0 != (pNxt = rThis.FindNextCnt()) &&
+/*N*/ (!pFollow || pNxt != pFollow->GetFrm()))
+/*N*/ {
+/*N*/ const SwAttrSet* pSet = NULL;
+/*N*/
+/*N*/ if ( pNxt->IsInTab() )
+/*N*/ {
+/*N*/ SwTabFrm* pTab = pNxt->FindTabFrm();
+/*N*/ if ( ! rThis.IsInTab() || rThis.FindTabFrm() != pTab )
+/*N*/ pSet = &pTab->GetFmt()->GetAttrSet();
+/*N*/ }
+/*N*/
+/*N*/ if ( ! pSet )
+/*N*/ pSet = pNxt->GetAttrSet();
+/*N*/
+/*N*/ ASSERT( pSet, "No AttrSet to check keep attribute" )
+/*N*/
+/*N*/ if ( pSet->GetPageDesc().GetPageDesc() )
+/*N*/ bKeep = FALSE;
+/*N*/ else switch ( pSet->GetBreak().GetBreak() )
+/*N*/ {
+/*N*/ case SVX_BREAK_COLUMN_BEFORE:
+/*N*/ case SVX_BREAK_COLUMN_BOTH:
+/*N*/ case SVX_BREAK_PAGE_BEFORE:
+/*N*/ case SVX_BREAK_PAGE_BOTH:
+/*N*/ bKeep = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return bKeep;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::BwdMoveNecessary()
+|*
+|* Ersterstellung MA 20. Jul. 94
+|* Letzte Aenderung MA 02. May. 96
+|*
+|*************************************************************************/
+
+
+/*N*/ BYTE SwFlowFrm::BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRect )
+/*N*/ {
+/*N*/ // Der return-Wert entscheidet mit,
+/*N*/ // ob auf Zurueckgeflossen werden muss, (3)
+/*N*/ // ob das gute alte WouldFit gerufen werden kann (0, 1)
+/*N*/ // oder ob ein Umhaengen und eine Probeformatierung sinnvoll ist (2)
+/*N*/ // dabei bedeutet Bit 1, dass Objekte an mir selbst verankert sind
+/*N*/ // und Bit 2, dass ich anderen Objekten ausweichen muss.
+/*N*/
+/*N*/ //Wenn ein SurroundObj, dass einen Umfluss wuenscht mit dem Rect ueberlappt
+/*N*/ //ist der Fluss notwendig (weil die Verhaeltnisse nicht geschaetzt werden
+/*N*/ //koennen), es kann allerdings ggf. eine TestFormatierung stattfinden.
+/*N*/ //Wenn das SurroundObj ein Fly ist und ich selbst ein Lower bin oder der Fly
+/*N*/ //Lower von mir ist, so spielt er keine Rolle.
+/*N*/ //Wenn das SurroundObj in einem zeichengebunden Fly verankert ist, und ich
+/*N*/ //selbst nicht Lower dieses Zeichengebundenen Flys bin, so spielt der Fly
+/*N*/ //keine Rolle.
+/*N*/ //#32639# Wenn das Objekt bei mir verankert ist kann ich es
+/*N*/ //vernachlaessigen, weil es hoechstwahrscheinlich (!?) mitfliesst,
+/*N*/ //eine TestFormatierung ist dann allerdings nicht erlaubt!
+/*N*/ BYTE nRet = 0;
+/*N*/ SwFlowFrm *pTmp = this;
+/*N*/ do
+/*N*/ { // Wenn an uns oder einem Follow Objekte haengen, so
+/*N*/ // kann keine ProbeFormatierung stattfinden, da absatzgebundene
+/*N*/ // nicht richtig beruecksichtigt wuerden und zeichengebundene sollten
+/*N*/ // gar nicht zur Probe formatiert werden.
+/*N*/ if( pTmp->GetFrm()->GetDrawObjs() )
+/*N*/ nRet = 1;
+/*N*/ pTmp = pTmp->GetFollow();
+/*N*/ } while ( !nRet && pTmp );
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ const SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*N*/ ULONG nIndex = ULONG_MAX;
+/*N*/ for ( USHORT i = 0; nRet < 3 && i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = rObjs[i];
+/*N*/ SdrObjUserCall *pUserCall;
+/*N*/ const SwFrmFmt *pFmt = pObj->IsWriterFlyFrame() ?
+/*N*/ ((SwVirtFlyDrawObj*)pObj)->GetFmt() :
+/*N*/ ((SwContact*)(pUserCall = GetUserCall(pObj)))->GetFmt();
+/*N*/ const SwRect aRect( pObj->GetBoundRect() );
+/*N*/ if ( aRect.IsOver( rRect ) &&
+/*N*/ pFmt->GetSurround().GetSurround() != SURROUND_THROUGHT )
+/*N*/ {
+/*N*/ if( rThis.IsLayoutFrm() && //Fly Lower von This?
+/*N*/ Is_Lower_Of( &rThis, pObj ) )
+/*N*/ continue;
+/*N*/ const SwFrm* pAnchor;
+/*N*/ if( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ if ( pFly->IsAnLower( &rThis ) )//This Lower vom Fly?
+/*N*/ continue;
+/*N*/ pAnchor = pFly->GetAnchor();
+/*N*/ }
+/*N*/ else
+/*N*/ pAnchor = ((SwDrawContact*)pUserCall)->GetAnchor();
+/*N*/
+/*N*/ if ( pAnchor == &rThis )
+/*N*/ {
+/*N*/ nRet |= 1;
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ //Nicht wenn das Objekt im Textfluss hinter mir verankert ist,
+/*N*/ //denn dann weiche ich ihm nicht aus.
+/*N*/ if ( ::binfilter::IsFrmInSameKontext( pAnchor, &rThis ) )
+/*N*/ {
+/*N*/ if ( pFmt->GetAnchor().GetAnchorId() == FLY_AT_CNTNT )
+/*N*/ {
+/*N*/ // Den Index des anderen erhalten wir immer ueber das Ankerattr.
+/*N*/ ULONG nTmpIndex = pFmt->GetAnchor().GetCntntAnchor()->nNode.GetIndex();
+/*N*/ // Jetzt wird noch ueberprueft, ob der aktuelle Absatz vor dem
+/*N*/ // Anker des verdraengenden Objekts im Text steht, dann wird
+/*N*/ // nicht ausgewichen.
+/*N*/ // Der Index wird moeglichst ueber einen SwFmtAnchor ermittelt,
+/*N*/ // da sonst recht teuer.
+/*N*/ if( ULONG_MAX == nIndex )
+/*N*/ {
+/*N*/ const SwNode *pNode;
+/*N*/ if ( rThis.IsCntntFrm() )
+/*N*/ pNode = ((SwCntntFrm&)rThis).GetNode();
+/*N*/ else if( rThis.IsSctFrm() )
+/*?*/ pNode = ((SwSectionFmt*)((SwSectionFrm&)rThis).
+/*?*/ GetFmt())->GetSectionNode();
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( rThis.IsTabFrm(), "new FowFrm?" );
+/*?*/ pNode = ((SwTabFrm&)rThis).GetTable()->
+/*?*/ GetTabSortBoxes()[0]->GetSttNd()->FindTableNode();
+/*N*/ }
+/*N*/ nIndex = pNode->GetIndex();
+/*N*/ }
+/*N*/ if( nIndex < nTmpIndex )
+/*?*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ continue;
+/*N*/
+/*N*/ nRet |= 2;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::CutTree(), PasteTree(), MoveSubTree()
+|*
+|* Beschreibung Eine Spezialisierte Form des Cut() und Paste(), die
+|* eine ganze Kette umhaengt (naehmlich this und folgende). Dabei werden
+|* nur minimale Operationen und Benachrichtigungen ausgefuehrt.
+|* Ersterstellung MA 18. Mar. 93
+|* Letzte Aenderung MA 18. May. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ SwLayoutFrm *SwFlowFrm::CutTree( SwFrm *pStart )
+/*N*/ {
+/*N*/ //Der Start und alle Nachbarn werden ausgeschnitten, sie werden aneinander-
+/*N*/ //gereiht und ein Henkel auf den ersten wird zurueckgeliefert.
+/*N*/ //Zurueckbleibende werden geeignet invalidiert.
+/*N*/
+/*N*/ SwLayoutFrm *pLay = pStart->GetUpper();
+/*N*/ if ( pLay->IsInFtn() )
+/*?*/ pLay = pLay->FindFtnFrm();
+/*N*/ if( pLay )
+/*N*/ {
+/*N*/ SwFrm* pTmp = pStart->GetIndPrev();
+/*N*/ if( pTmp )
+/*N*/ pTmp->Prepare( PREP_QUOVADIS );
+/*N*/ }
+/*N*/
+/*N*/ //Nur fix auschneiden und zwar so, dass klare Verhaeltnisse bei den
+/*N*/ //Verlassenen herrschen. Die Pointer der ausgeschnittenen Kette zeigen
+/*N*/ //noch wer weiss wo hin.
+/*N*/ if ( pStart == pStart->GetUpper()->Lower() )
+/*N*/ pStart->GetUpper()->pLower = 0;
+/*N*/ if ( pStart->GetPrev() )
+/*N*/ {
+/*N*/ pStart->GetPrev()->pNext = 0;
+/*N*/ pStart->pPrev = 0;
+/*N*/ }
+/*N*/
+/*N*/ if ( pLay->IsFtnFrm() )
+/*N*/ { if ( !pLay->Lower() && !pLay->IsColLocked() &&
+/*?*/ !((SwFtnFrm*)pLay)->IsBackMoveLocked() )
+/*?*/ { pLay->Cut();
+/*?*/ delete pLay;
+/*?*/ }
+/*?*/ else
+/*?*/ { BOOL bUnlock = !((SwFtnFrm*)pLay)->IsBackMoveLocked();
+/*?*/ ((SwFtnFrm*)pLay)->LockBackMove();
+/*?*/ pLay->InvalidateSize();
+/*?*/ pLay->Calc();
+/*?*/ SwCntntFrm *pCnt = pLay->ContainsCntnt();
+/*?*/ while ( pCnt && pLay->IsAnLower( pCnt ) )
+/*?*/ {
+/*?*/ //Kann sein, dass der CntFrm gelockt ist, wir wollen hier nicht
+/*?*/ //in eine endlose Seitenwanderung hineinlaufen und rufen das
+/*?*/ //Calc garnicht erst!
+/*?*/ ASSERT( pCnt->IsTxtFrm(), "Die Graphic ist gelandet." );
+/*?*/ if ( ((SwTxtFrm*)pCnt)->IsLocked() ||
+/*?*/ ((SwTxtFrm*)pCnt)->GetFollow() == pStart )
+/*?*/ break;
+/*?*/ pCnt->Calc();
+/*?*/ pCnt = pCnt->GetNextCntntFrm();
+/*?*/ }
+/*?*/ if( bUnlock )
+/*?*/ ((SwFtnFrm*)pLay)->UnlockBackMove();
+/*?*/ }
+/*?*/ pLay = 0;
+/*N*/ }
+/*N*/ return pLay;
+/*N*/ }
+
+
+
+/*N*/ BOOL SwFlowFrm::PasteTree( SwFrm *pStart, SwLayoutFrm *pParent, SwFrm *pSibling,
+/*N*/ SwFrm *pOldParent )
+/*N*/ {
+/*N*/ //returnt TRUE wenn in der Kette ein LayoutFrm steht.
+/*N*/ BOOL bRet = FALSE;
+/*N*/
+/*N*/ //Die mit pStart beginnende Kette wird vor den Sibling unter den Parent
+/*N*/ //gehaengt. Fuer geeignete Invalidierung wird ebenfalls gesorgt.
+/*N*/
+/*N*/ //Ich bekomme eine fertige Kette. Der Anfang der Kette muss verpointert
+/*N*/ //werden, dann alle Upper fuer die Kette und schliesslich dass Ende.
+/*N*/ //Unterwegs werden alle geeignet invalidiert.
+/*N*/ if ( pSibling )
+/*N*/ {
+/*N*/ if ( 0 != (pStart->pPrev = pSibling->GetPrev()) )
+/*N*/ pStart->GetPrev()->pNext = pStart;
+/*N*/ else
+/*N*/ pParent->pLower = pStart;
+/*N*/ pSibling->_InvalidatePos();
+/*N*/ pSibling->_InvalidatePrt();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( 0 == (pStart->pPrev = pParent->Lower()) )
+/*N*/ pParent->pLower = pStart;
+/*N*/ else
+/*N*/ pParent->Lower()->pNext = pStart;
+/*N*/ }
+/*N*/ SwFrm *pFloat = pStart;
+/*N*/ SwFrm *pLst;
+/*N*/ SWRECTFN( pParent )
+/*N*/ SwTwips nGrowVal = 0;
+/*N*/ do
+/*N*/ { pFloat->pUpper = pParent;
+/*N*/ pFloat->_InvalidateAll();
+/*N*/ pFloat->CheckDirChange();
+/*N*/
+/*N*/ //Ich bin Freund des TxtFrm und darf deshalb so einiges. Das mit
+/*N*/ //dem CacheIdx scheint etwas riskant!
+/*N*/ if ( pFloat->IsTxtFrm() )
+/*N*/ {
+/*N*/ if ( ((SwTxtFrm*)pFloat)->GetCacheIdx() != USHRT_MAX )
+/*N*/ ((SwTxtFrm*)pFloat)->Init(); //Ich bin sein Freund.
+/*N*/ }
+/*N*/ else
+/*N*/ bRet = TRUE;
+/*N*/
+/*N*/ nGrowVal += (pFloat->Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( pFloat->GetNext() )
+/*N*/ pFloat = pFloat->GetNext();
+/*N*/ else
+/*N*/ { pLst = pFloat;
+/*N*/ pFloat = 0;
+/*N*/ }
+/*N*/ } while ( pFloat );
+/*N*/
+/*N*/ if ( pSibling )
+/*N*/ {
+/*N*/ pLst->pNext = pSibling;
+/*N*/ pSibling->pPrev = pLst;
+/*N*/ if( pSibling->IsInFtn() )
+/*N*/ {
+/*N*/ if( pSibling->IsSctFrm() )
+/*N*/ pSibling = ((SwSectionFrm*)pSibling)->ContainsAny();
+/*N*/ if( pSibling )
+/*N*/ pSibling->Prepare( PREP_ERGOSUM );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( nGrowVal )
+/*N*/ {
+/*N*/ if ( pOldParent && pOldParent->IsBodyFrm() ) //Fuer variable Seitenhoehe beim Browsen
+/*N*/ pOldParent->Shrink( nGrowVal PHEIGHT );
+/*N*/ pParent->Grow( nGrowVal PHEIGHT );
+/*N*/ }
+/*N*/
+/*N*/ if ( pParent->IsFtnFrm() )
+/*N*/ ((SwFtnFrm*)pParent)->InvalidateNxtFtnCnts( pParent->FindPageFrm() );
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+/*N*/ void SwFlowFrm::MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling )
+/*N*/ {
+/*N*/ ASSERT( pParent, "Kein Parent uebergeben." );
+/*N*/ ASSERT( rThis.GetUpper(), "Wo kommen wir denn her?" );
+/*N*/
+/*N*/ //Sparsamer benachrichtigen wenn eine Action laeuft.
+/*N*/ ViewShell *pSh = rThis.GetShell();
+/*N*/ const SwViewImp *pImp = pSh ? pSh->Imp() : 0;
+/*N*/ const BOOL bComplete = pImp && pImp->IsAction() && pImp->GetLayAction().IsComplete();
+/*N*/
+/*N*/ if ( !bComplete )
+/*N*/ {
+/*N*/ SwFrm *pPre = rThis.GetIndPrev();
+/*N*/ if ( pPre )
+/*N*/ {
+/*N*/ pPre->SetRetouche();
+/*N*/ pPre->InvalidatePage();
+/*N*/ }
+/*N*/ else
+/*N*/ { rThis.GetUpper()->SetCompletePaint();
+/*N*/ rThis.GetUpper()->InvalidatePage();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwPageFrm *pOldPage = rThis.FindPageFrm();
+/*N*/
+/*N*/ SwLayoutFrm *pOldParent = CutTree( &rThis );
+/*N*/ const BOOL bInvaLay = PasteTree( &rThis, pParent, pSibling, pOldParent );
+/*N*/
+/*N*/ // Wenn durch das Cut&Paste ein leerer SectionFrm entstanden ist, sollte
+/*N*/ // dieser automatisch verschwinden.
+/*N*/ SwSectionFrm *pSct;
+/*N*/ if ( pOldParent && !pOldParent->Lower() &&
+/*N*/ (pOldParent->IsInSct() &&
+/*N*/ !(pSct = pOldParent->FindSctFrm())->ContainsCntnt() ) )
+/*N*/ pSct->DelEmpty( FALSE );
+/*N*/ // In einem spaltigen Bereich rufen wir lieber kein Calc "von unten"
+/*N*/ if( !rThis.IsInSct() )
+/*N*/ rThis.GetUpper()->Calc();
+/*N*/ else if( rThis.GetUpper()->IsSctFrm() )
+/*N*/ {
+/*N*/ SwSectionFrm* pSct = (SwSectionFrm*)rThis.GetUpper();
+/*N*/ BOOL bOld = pSct->IsCntntLocked();
+/*N*/ pSct->SetCntntLock( TRUE );
+/*N*/ pSct->Calc();
+/*N*/ if( !bOld )
+/*N*/ pSct->SetCntntLock( FALSE );
+/*N*/ }
+/*N*/ SwPageFrm *pPage = rThis.FindPageFrm();
+/*N*/
+/*N*/ if ( pOldPage != pPage )
+/*N*/ {
+/*N*/ rThis.InvalidatePage( pPage );
+/*N*/ if ( rThis.IsLayoutFrm() )
+/*N*/ {
+/*N*/ SwCntntFrm *pCnt = ((SwLayoutFrm*)&rThis)->ContainsCntnt();
+/*N*/ if ( pCnt )
+/*N*/ pCnt->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ else if ( pSh && pSh->GetDoc()->GetLineNumberInfo().IsRestartEachPage()
+/*N*/ && pPage->FindFirstBodyCntnt() == &rThis )
+/*N*/ {
+/*?*/ rThis._InvalidateLineNum();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bInvaLay || (pSibling && pSibling->IsLayoutFrm()) )
+/*N*/ rThis.GetUpper()->InvalidatePage( pPage );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::IsAnFollow()
+|*
+|* Ersterstellung MA 26. Apr. 95
+|* Letzte Aenderung MA 26. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::IsAnFollow( const SwFlowFrm *pAssumed ) const
+/*N*/ {
+/*N*/ const SwFlowFrm *pFoll = this;
+/*N*/ do
+/*N*/ { if ( pAssumed == pFoll )
+/*N*/ return TRUE;
+/*N*/ pFoll = pFoll->GetFollow();
+/*N*/ } while ( pFoll );
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::FindMaster()
+|*
+|* Ersterstellung MA 26. Apr. 95
+|* Letzte Aenderung MA 26. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*M*/ SwFlowFrm *SwFlowFrm::FindMaster()
+/*M*/ {
+/*M*/ ASSERT( IsFollow(), "FindMaster und kein Follow." );
+/*M*/
+/*M*/ SwCntntFrm *pCnt;
+/*M*/ BOOL bCntnt;
+/*M*/ if ( rThis.IsCntntFrm() )
+/*M*/ {
+/*M*/ pCnt = (SwCntntFrm*)&rThis;
+/*M*/ pCnt = pCnt->GetPrevCntntFrm();
+/*M*/
+/*M*/ bCntnt = TRUE;
+/*M*/ }
+/*M*/ else if( rThis.IsTabFrm() )
+/*M*/ {
+/*M*/ pCnt = rThis.GetPrevCntntFrm();
+/*M*/
+/*M*/ #ifdef DBG_UTIL
+/*M*/ SwCntntFrm* pTmpCnt = ((SwLayoutFrm&)rThis).ContainsCntnt();
+/*M*/ ASSERT( ! pTmpCnt || pTmpCnt->GetPrevCntntFrm() == pCnt,
+/*M*/ "Two different results for the master of a table?" )
+/*M*/ #endif
+/*M*/
+/*M*/ bCntnt = FALSE;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ ASSERT( rThis.IsSctFrm(), "FindMaster: Funny FrameTyp" );
+/*M*/ return ((SwSectionFrm&)rThis).FindSectionMaster();
+/*M*/ }
+/*M*/
+/*M*/ while ( pCnt )
+/*M*/ {
+/*M*/ if ( bCntnt )
+/*M*/ {
+/*M*/ if ( pCnt->HasFollow() && pCnt->GetFollow() == this )
+/*M*/ return pCnt;
+/*M*/ }
+/*M*/ else
+/*M*/ { SwTabFrm *pTab = pCnt->FindTabFrm();
+/*M*/ if ( pTab && pTab->GetFollow() == this )
+/*M*/ return pTab;
+/*M*/ }
+/*M*/ pCnt = pCnt->GetPrevCntntFrm();
+/*M*/ }
+/*M*/ ASSERT( FALSE, "Follow ist lost in Space." );
+/*M*/ return 0;
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetLeaf()
+|*
+|* Beschreibung Liefert das naechste/vorhergehende LayoutBlatt,
+|* das _nicht_ unterhalb von this liegt (oder gar this selbst ist).
+|* Ausserdem muss dieses LayoutBlatt im gleichen Textfluss wie
+|* pAnch Ausgangsfrm liegen (Body, Ftn)
+|* Ersterstellung MA 25. Nov. 92
+|* Letzte Aenderung MA 25. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ const SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, BOOL bFwd,
+/*N*/ const SwFrm *pAnch ) const
+/*N*/ {
+/*N*/ //Ohne Fluss kein genuss...
+/*N*/ if ( IsInTab() || !(IsInDocBody() || IsInFtn() || IsInFly()) )
+/*?*/ return 0;
+/*N*/
+/*N*/ const SwFrm *pLeaf = this;
+/*N*/ BOOL bFound = FALSE;
+/*N*/
+/*N*/ do
+/*N*/ { pLeaf = ((SwFrm*)pLeaf)->GetLeaf( eMakePage, bFwd );
+/*N*/
+/*N*/ if ( pLeaf &&
+/*N*/ (!IsLayoutFrm() || !((SwLayoutFrm*)this)->IsAnLower( pLeaf )))
+/*N*/ {
+/*N*/ if ( pAnch->IsInDocBody() == pLeaf->IsInDocBody() &&
+/*N*/ pAnch->IsInFtn() == pLeaf->IsInFtn() )
+/*N*/ {
+/*N*/ bFound = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ } while ( !bFound && pLeaf );
+/*N*/
+/*N*/ return (const SwLayoutFrm*)pLeaf;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetLeaf()
+|*
+|* Beschreibung Ruft Get[Next|Prev]Leaf
+|*
+|* Ersterstellung MA 20. Mar. 93
+|* Letzte Aenderung MA 25. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ SwLayoutFrm *SwFrm::GetLeaf( MakePageType eMakePage, BOOL bFwd )
+/*N*/ {
+/*N*/ if ( IsInFtn() )
+/*?*/ { DBG_BF_ASSERT(0, "STRIP");} //STRIP001 return bFwd ? GetNextFtnLeaf( eMakePage ) : GetPrevFtnLeaf( eMakePage );
+/*N*/ if ( IsInSct() )
+/*N*/ return bFwd ? GetNextSctLeaf( eMakePage ) : GetPrevSctLeaf( eMakePage );
+/*N*/ return bFwd ? GetNextLeaf( eMakePage ) : GetPrevLeaf( eMakePage );
+/*N*/ }
+
+
+
+/*N*/ BOOL SwFrm::WrongPageDesc( SwPageFrm* pNew )
+/*N*/ {
+/*N*/ //Jetzt wirds leider etwas kompliziert:
+/*N*/ //Ich bringe ich evtl. selbst
+/*N*/ //einen Pagedesc mit; der der Folgeseite muss dann damit
+/*N*/ //uebereinstimmen.
+/*N*/ //Anderfalls muss ich mir etwas genauer ansehen wo der
+/*N*/ //Folgepagedesc herkam.
+/*N*/ //Wenn die Folgeseite selbst schon sagt, dass ihr
+/*N*/ //Pagedesc nicht stimmt so kann ich das Teil bedenkenlos
+/*N*/ //auswechseln.
+/*N*/ //Wenn die Seite meint, dass ihr Pagedesc stimmt, so heisst
+/*N*/ //das leider noch immer nicht, dass ich damit etwas anfangen
+/*N*/ //kann: Wenn der erste BodyCntnt einen PageDesc oder einen
+/*N*/ //PageBreak wuenscht, so muss ich ebenfalls eine neue
+/*N*/ //Seite einfuegen; es sein denn die gewuenschte Seite ist
+/*N*/ //die richtige.
+/*N*/ //Wenn ich einen neue Seite eingefuegt habe, so fangen die
+/*N*/ //Probleme leider erst an, denn wahrscheinlich wird die dann
+/*N*/ //folgende Seite verkehrt gewesen und ausgewechselt worden
+/*N*/ //sein. Das hat zur Folge, dass ich zwar eine neue (und
+/*N*/ //jetzt richtige) Seite habe, die Bedingungen zum auswechseln
+/*N*/ //aber leider noch immer stimmen.
+/*N*/ //Ausweg: Vorlaeufiger Versuch, nur einmal eine neue Seite
+/*N*/ //einsetzen (Leerseiten werden noetigenfalls bereits von
+/*N*/ //InsertPage() eingefuegt.
+/*N*/ const SwFmtPageDesc &rFmtDesc = GetAttrSet()->GetPageDesc();
+/*N*/
+/*N*/ //Mein Pagedesc zaehlt nicht, wenn ich ein Follow bin!
+/*N*/ SwPageDesc *pDesc = 0;
+/*N*/ USHORT nTmp = 0;
+/*N*/ SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( this );
+/*N*/ if ( !pFlow || !pFlow->IsFollow() )
+/*N*/ {
+/*N*/ pDesc = (SwPageDesc*)rFmtDesc.GetPageDesc();
+/*N*/ if( pDesc )
+/*N*/ {
+/*N*/ if( !pDesc->GetRightFmt() )
+/*?*/ nTmp = 2;
+/*N*/ else if( !pDesc->GetLeftFmt() )
+/*N*/ nTmp = 1;
+/*N*/ else if( rFmtDesc.GetNumOffset() )
+/*N*/ nTmp = rFmtDesc.GetNumOffset();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Bringt der Cntnt einen Pagedesc mit oder muss zaehlt die
+/*N*/ //virtuelle Seitennummer des neuen Layoutleafs?
+/*N*/ // Bei Follows zaehlt der PageDesc nicht
+/*N*/ const BOOL bOdd = nTmp ? ( nTmp % 2 ? TRUE : FALSE )
+/*N*/ : pNew->OnRightPage();
+/*N*/ if ( !pDesc )
+/*N*/ pDesc = pNew->FindPageDesc();
+/*N*/ const SwFlowFrm *pNewFlow = pNew->FindFirstBodyCntnt();
+/*N*/ // Haben wir uns selbst gefunden?
+/*N*/ if( pNewFlow == pFlow )
+/*?*/ pNewFlow = NULL;
+/*N*/ if ( pNewFlow && pNewFlow->GetFrm()->IsInTab() )
+/*N*/ pNewFlow = pNewFlow->GetFrm()->FindTabFrm();
+/*N*/ const SwPageDesc *pNewDesc= ( pNewFlow && !pNewFlow->IsFollow() )
+/*N*/ ? pNewFlow->GetFrm()->GetAttrSet()->GetPageDesc().GetPageDesc():0;
+/*N*/
+/*N*/ return ( pNew->GetPageDesc() != pDesc || // own desc ?
+/*N*/ pNew->GetFmt() != (bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt()) ||
+/*N*/ ( pNewDesc && pNewDesc == pDesc ) );
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwFrm::GetNextLeaf()
+|*
+|* Beschreibung Liefert das naechste LayoutBlatt in den das
+|* Frame gemoved werden kann.
+|*
+|* Ersterstellung MA 16. Nov. 92
+|* Letzte Aenderung MA 05. Dec. 96
+|*
+|*************************************************************************/
+
+/*N*/ SwLayoutFrm *SwFrm::GetNextLeaf( MakePageType eMakePage )
+/*N*/ {
+/*N*/ ASSERT( !IsInFtn(), "GetNextLeaf(), don't call me for Ftn." );
+/*N*/ ASSERT( !IsInSct(), "GetNextLeaf(), don't call me for Sections." );
+/*N*/
+/*N*/ const BOOL bBody = IsInDocBody(); //Wenn ich aus dem DocBody komme
+/*N*/ //Will ich auch im Body landen.
+/*N*/
+/*N*/ // Bei Flys macht es keinen Sinn, Seiten einzufuegen, wir wollen lediglich
+/*N*/ // die Verkettung absuchen.
+/*N*/ if( IsInFly() )
+/*N*/ eMakePage = MAKEPAGE_NONE;
+/*N*/ //Bei Tabellen gleich den grossen Sprung wagen, ein einfaches GetNext...
+/*N*/ //wuerde die erste Zellen und in der Folge alle weiteren Zellen nacheinander
+/*N*/ //abklappern....
+/*N*/ SwLayoutFrm *pLayLeaf;
+/*N*/ if ( IsTabFrm() )
+/*N*/ pLayLeaf = ((SwTabFrm*)this)->FindLastCntnt()->GetUpper();
+/*N*/ else
+/*N*/ pLayLeaf = GetNextLayoutLeaf();
+/*N*/
+/*N*/ SwLayoutFrm *pOldLayLeaf = 0; //Damit bei neu erzeugten Seiten
+/*N*/ //nicht wieder vom Anfang gesucht
+/*N*/ //wird.
+/*N*/ BOOL bNewPg = FALSE; //nur einmal eine neue Seite einfuegen.
+/*N*/
+/*N*/ while ( TRUE )
+/*N*/ {
+/*N*/ if ( pLayLeaf )
+/*N*/ {
+/*N*/ //Es gibt noch einen weiteren LayoutFrm, mal sehen,
+/*N*/ //ob er bereit ist mich aufzunehmen.
+/*N*/ //Dazu braucht er nur von der gleichen Art wie mein Ausgangspunkt
+/*N*/ //sein (DocBody bzw. Footnote.)
+/*N*/ if ( pLayLeaf->FindPageFrm()->IsFtnPage() )
+/*N*/ { //Wenn ich bei den Endnotenseiten angelangt bin hat sichs.
+/*?*/ pLayLeaf = 0;
+/*?*/ continue;
+/*N*/ }
+/*N*/ if ( (bBody && !pLayLeaf->IsInDocBody()) || pLayLeaf->IsInTab()
+/*N*/ || pLayLeaf->IsInSct() )
+/*N*/ {
+/*N*/ //Er will mich nicht; neuer Versuch, neues Glueck
+/*N*/ pOldLayLeaf = pLayLeaf;
+/*N*/ pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+/*N*/ continue;
+/*N*/ }
+/*N*/ //Er will mich, also ist er der gesuchte und ich bin fertig.
+/*N*/ //Bei einem Seitenwechsel kann es allerdings noch sein, dass
+/*N*/ //Der Seitentyp nicht der gewuenschte ist, in diesem Fall muessen
+/*N*/ //wir eine Seite des richtigen Typs einfuegen.
+/*N*/
+/*N*/ if( !IsFlowFrm() && ( eMakePage == MAKEPAGE_NONE ||
+/*N*/ eMakePage==MAKEPAGE_APPEND || eMakePage==MAKEPAGE_NOSECTION ) )
+/*N*/ return pLayLeaf;
+/*N*/
+/*N*/ SwPageFrm *pNew = pLayLeaf->FindPageFrm();
+/*N*/ if ( pNew != FindPageFrm() && !bNewPg )
+/*N*/ {
+/*N*/ if( WrongPageDesc( pNew ) )
+/*N*/ {
+/*N*/ SwFtnContFrm *pCont = pNew->FindFtnCont();
+/*N*/ if( pCont )
+/*N*/ {
+/*?*/ // Falls die Referenz der ersten Fussnote dieser Seite
+/*?*/ // vor der Seite liegt, fuegen wir lieber keine neue Seite
+/*?*/ // ein (Bug #55620#)
+/*?*/ SwFtnFrm *pFtn = (SwFtnFrm*)pCont->Lower();
+/*?*/ if( pFtn && pFtn->GetRef() )
+/*?*/ {
+/*?*/ const USHORT nRefNum = pNew->GetPhyPageNum();
+/*?*/ if( pFtn->GetRef()->GetPhyPageNum() < nRefNum )
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ //Erwischt, die folgende Seite ist verkehrt, also
+/*N*/ //muss eine neue eingefuegt werden.
+/*N*/ if ( eMakePage == MAKEPAGE_INSERT )
+/*N*/ {
+/*N*/ bNewPg = TRUE;
+/*N*/
+/*N*/ SwPageFrm *pPg = pOldLayLeaf ?
+/*N*/ pOldLayLeaf->FindPageFrm() : 0;
+/*N*/ if ( pPg && pPg->IsEmptyPage() )
+/*N*/ //Nicht hinter, sondern vor der EmptyPage einfuegen.
+/*?*/ pPg = (SwPageFrm*)pPg->GetPrev();
+/*N*/
+/*N*/ if ( !pPg || pPg == pNew )
+/*N*/ pPg = FindPageFrm();
+/*N*/
+/*N*/ InsertPage( pPg, FALSE );
+/*N*/ pLayLeaf = GetNextLayoutLeaf();
+/*N*/ pOldLayLeaf = 0;
+/*N*/ continue;
+/*N*/ }
+/*N*/ else
+/*?*/ pLayLeaf = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Es gibt keinen passenden weiteren LayoutFrm, also muss eine
+/*N*/ //neue Seite her.
+/*N*/ if ( eMakePage == MAKEPAGE_APPEND || eMakePage == MAKEPAGE_INSERT )
+/*N*/ {
+/*N*/ InsertPage(
+/*N*/ pOldLayLeaf ? pOldLayLeaf->FindPageFrm() : FindPageFrm(),
+/*N*/ FALSE );
+/*N*/
+/*N*/ //und nochmal das ganze
+/*N*/ pLayLeaf = pOldLayLeaf ? pOldLayLeaf : GetNextLayoutLeaf();
+/*N*/ }
+/*N*/ else
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return pLayLeaf;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetPrevLeaf()
+|*
+|* Beschreibung Liefert das vorhergehende LayoutBlatt in das der
+|* Frame gemoved werden kann.
+|* Ersterstellung MA 16. Nov. 92
+|* Letzte Aenderung MA 25. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ SwLayoutFrm *SwFrm::GetPrevLeaf( MakePageType eMakeFtn )
+/*N*/ {
+/*N*/ ASSERT( !IsInFtn(), "GetPrevLeaf(), don't call me for Ftn." );
+/*N*/
+/*N*/ const BOOL bBody = IsInDocBody(); //Wenn ich aus dem DocBody komme
+/*N*/ //will ich auch im Body landen.
+/*N*/ const BOOL bFly = IsInFly();
+/*N*/
+/*N*/ SwLayoutFrm *pLayLeaf = GetPrevLayoutLeaf();
+/*N*/ SwLayoutFrm *pPrevLeaf = 0;
+/*N*/
+/*N*/ while ( pLayLeaf )
+/*N*/ {
+/*N*/ if ( pLayLeaf->IsInTab() || //In Tabellen geht's niemals hinein.
+/*N*/ pLayLeaf->IsInSct() ) //In Bereiche natuerlich auch nicht!
+/*N*/ pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
+/*N*/ else if ( bBody && pLayLeaf->IsInDocBody() )
+/*N*/ {
+/*N*/ if ( pLayLeaf->Lower() )
+/*N*/ break;
+/*N*/ pPrevLeaf = pLayLeaf;
+/*N*/ pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
+/*N*/ if ( pLayLeaf )
+/*N*/ SwFlowFrm::SetMoveBwdJump( TRUE );
+/*N*/ }
+/*N*/ else if ( bFly )
+/*N*/ break; //Cntnts in Flys sollte jedes Layout-Blatt recht sein.
+/*N*/ else
+/*N*/ pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
+/*N*/ }
+/*N*/ return pLayLeaf ? pLayLeaf : pPrevLeaf;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::IsPrevObjMove()
+|*
+|* Ersterstellung MA 20. Feb. 96
+|* Letzte Aenderung MA 22. Feb. 96
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::IsPrevObjMove() const
+/*N*/ {
+/*N*/ //TRUE der FlowFrm soll auf einen Rahmen des Vorgaengers Ruecksicht nehmen
+/*N*/ // und fuer diesen ggf. Umbrechen.
+/*N*/
+/*N*/ //!!!!!!!!!!!Hack!!!!!!!!!!!
+/*N*/ if ( rThis.GetUpper()->GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ SwFrm *pPre = rThis.FindPrev();
+/*N*/
+/*N*/ if ( pPre && pPre->GetDrawObjs() )
+/*N*/ {
+/*N*/ ASSERT( SwFlowFrm::CastFlowFrm( pPre ), "new flowfrm?" );
+/*N*/ if( SwFlowFrm::CastFlowFrm( pPre )->IsAnFollow( this ) )
+/*?*/ return FALSE;
+/*N*/ SwFrm* pPreUp = pPre->GetUpper();
+/*N*/ // Wenn der Upper ein SectionFrm oder die Spalte eines SectionFrms ist,
+/*N*/ // duerfen wir aus diesem durchaus heraushaengen,
+/*N*/ // es muss stattdessen der Upper des SectionFrms beruecksichtigt werden.
+/*N*/ if( pPreUp->IsInSct() )
+/*N*/ {
+/*N*/ if( pPreUp->IsSctFrm() )
+/*N*/ pPreUp = pPreUp->GetUpper();
+/*?*/ else if( pPreUp->IsColBodyFrm() &&
+/*?*/ pPreUp->GetUpper()->GetUpper()->IsSctFrm() )
+/*?*/ pPreUp = pPreUp->GetUpper()->GetUpper()->GetUpper();
+/*N*/ }
+/*N*/ const long nBottom = pPreUp->Frm().Bottom();
+/*N*/ const long nRight = pPreUp->Frm().Right();
+/*N*/ const FASTBOOL bCol = pPreUp->IsColBodyFrm();//ColFrms jetzt mit BodyFrm
+/*N*/ for ( USHORT i = 0; i < pPre->GetDrawObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ const SdrObject *pObj = (*pPre->GetDrawObjs())[i];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/
+/*N*/ if ( WEIT_WECH != pFly->Frm().Top() && !pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*N*/ if( pObj->GetSnapRect().Top() > nBottom )
+/*N*/ return TRUE;
+/*N*/ if( bCol && pObj->GetSnapRect().Left() > nRight )
+/*N*/ {
+/*N*/ SwFmtHoriOrient aHori( pFly->GetFmt()->GetHoriOrient() );
+/*N*/ if( FRAME == aHori.GetRelationOrient() ||
+/*N*/ PRTAREA == aHori.GetRelationOrient() ||
+/*N*/ REL_CHAR == aHori.GetRelationOrient() ||
+/*N*/ REL_FRM_LEFT == aHori.GetRelationOrient() ||
+/*N*/ REL_FRM_RIGHT == aHori.GetRelationOrient() )
+/*N*/ {
+/*N*/ if( HORI_NONE == aHori.GetHoriOrient() )
+/*N*/ {
+/*N*/ SwTwips nAdd = 0;
+/*N*/ switch ( aHori.GetRelationOrient() )
+/*N*/ {
+/*N*/ case PRTAREA:
+/*?*/ nAdd = pFly->Prt().Left(); break;
+/*?*/ case REL_FRM_RIGHT:
+/*?*/ nAdd = pFly->Frm().Width(); break;
+/*?*/ case REL_CHAR:
+/*?*/ if( pFly->IsFlyAtCntFrm() )
+/*?*/ nAdd = ((SwFlyAtCntFrm*)pFly)->GetLastCharX();
+/*?*/ break;
+/*N*/ }
+/*N*/ nAdd += aHori.GetPos();
+/*N*/ if( nAdd < pPreUp->Frm().Width() &&
+/*N*/ nAdd + pFly->Frm().Width() > 0 )
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ else
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* BOOL SwFlowFrm::IsPageBreak()
+|*
+|* Beschreibung Wenn vor dem Frm ein harter Seitenumbruch steht UND
+|* es einen Vorgaenger auf der gleichen Seite gibt, wird TRUE
+|* zurueckgeliefert (es muss ein PageBreak erzeugt werden) FALSE sonst.
+|* Wenn in bAct TRUE uebergeben wird, gibt die Funktion dann TRUE
+|* zurueck, wenn ein PageBreak besteht.
+|* Fuer Follows wird der harte Seitenumbruch natuerlich nicht
+|* ausgewertet.
+|* Der Seitenumbruch steht im eigenen FrmFmt (BEFORE) oder im FrmFmt
+|* des Vorgaengers (AFTER). Wenn es keinen Vorgaenger auf der Seite
+|* gibt ist jede weitere Ueberlegung ueberfluessig.
+|* Ein Seitenumbruch (oder der Bedarf) liegt auch dann vor, wenn
+|* im FrmFmt ein PageDesc angegeben wird.
+|* Die Implementierung arbeitet zuaechst nur auf CntntFrms!
+|* -->Fuer LayoutFrms ist die Definition des Vorgaengers unklar.
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 21. Mar. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::IsPageBreak( BOOL bAct ) const
+/*N*/ {
+/*N*/ const SwAttrSet *pSet;
+/*N*/ if ( !IsFollow() && rThis.IsInDocBody() &&
+/*N*/ !(pSet = rThis.GetAttrSet())->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ //Vorgaenger ermitteln
+/*N*/ const SwFrm *pPrev = rThis.FindPrev();
+/*N*/ while ( pPrev && ( !pPrev->IsInDocBody() ||
+/*N*/ ( pPrev->IsTxtFrm() && ((SwTxtFrm*)pPrev)->IsHiddenNow() ) ) )
+/*?*/ pPrev = pPrev->FindPrev();
+/*N*/
+/*N*/ if ( pPrev )
+/*N*/ {
+/*N*/ ASSERT( pPrev->IsInDocBody(), "IsPageBreak: Not in DocBody?" );
+/*N*/ if ( bAct )
+/*N*/ { if ( rThis.FindPageFrm() == pPrev->FindPageFrm() )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ { if ( rThis.FindPageFrm() != pPrev->FindPageFrm() )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/ const SvxBreak eBreak = pSet->GetBreak().GetBreak();
+/*N*/ if ( eBreak == SVX_BREAK_PAGE_BEFORE || eBreak == SVX_BREAK_PAGE_BOTH )
+/*N*/ return TRUE;
+/*N*/ else
+/*N*/ {
+/*N*/ const SvxBreak &ePrB = pPrev->GetAttrSet()->GetBreak().GetBreak();
+/*N*/ if ( ePrB == SVX_BREAK_PAGE_AFTER ||
+/*N*/ ePrB == SVX_BREAK_PAGE_BOTH ||
+/*N*/ pSet->GetPageDesc().GetPageDesc() )
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* BOOL SwFlowFrm::IsColBreak()
+|*
+|* Beschreibung Wenn vor dem Frm ein harter Spaltenumbruch steht UND
+|* es einen Vorgaenger in der gleichen Spalte gibt, wird TRUE
+|* zurueckgeliefert (es muss ein PageBreak erzeugt werden) FALSE sonst.
+|* Wenn in bAct TRUE uebergeben wird, gibt die Funktion dann TRUE
+|* zurueck, wenn ein ColBreak besteht.
+|* Fuer Follows wird der harte Spaltenumbruch natuerlich nicht
+|* ausgewertet.
+|* Der Spaltenumbruch steht im eigenen FrmFmt (BEFORE) oder im FrmFmt
+|* des Vorgaengers (AFTER). Wenn es keinen Vorgaenger in der Spalte
+|* gibt ist jede weitere Ueberlegung ueberfluessig.
+|* Die Implementierung arbeitet zuaechst nur auf CntntFrms!
+|* -->Fuer LayoutFrms ist die Definition des Vorgaengers unklar.
+|* Ersterstellung MA 11. Jun. 93
+|* Letzte Aenderung MA 21. Mar. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::IsColBreak( BOOL bAct ) const
+/*N*/ {
+/*N*/ if ( !IsFollow() && (rThis.IsMoveable() || bAct) )
+/*N*/ {
+/*N*/ const SwFrm *pCol = rThis.FindColFrm();
+/*N*/ if ( pCol )
+/*N*/ {
+/*N*/ //Vorgaenger ermitteln
+/*N*/ const SwFrm *pPrev = rThis.FindPrev();
+/*N*/ while( pPrev && ( ( !pPrev->IsInDocBody() && !rThis.IsInFly() ) ||
+/*N*/ ( pPrev->IsTxtFrm() && ((SwTxtFrm*)pPrev)->IsHiddenNow() ) ) )
+/*?*/ pPrev = pPrev->FindPrev();
+/*N*/
+/*N*/ if ( pPrev )
+/*N*/ {
+/*N*/ if ( bAct )
+/*N*/ { if ( pCol == pPrev->FindColFrm() )
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ { if ( pCol != pPrev->FindColFrm() )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/ const SvxBreak eBreak = rThis.GetAttrSet()->GetBreak().GetBreak();
+/*N*/ if ( eBreak == SVX_BREAK_COLUMN_BEFORE ||
+/*N*/ eBreak == SVX_BREAK_COLUMN_BOTH )
+/*N*/ return TRUE;
+/*N*/ else
+/*N*/ {
+/*N*/ const SvxBreak &ePrB = pPrev->GetAttrSet()->GetBreak().GetBreak();
+/*N*/ if ( ePrB == SVX_BREAK_COLUMN_AFTER ||
+/*N*/ ePrB == SVX_BREAK_COLUMN_BOTH )
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ SwTwips SwFlowFrm::CalcUpperSpace( const SwBorderAttrs *pAttrs,
+/*N*/ const SwFrm* pPr ) const
+/*N*/ {
+/*N*/ const SwFrm *pPre = pPr ? pPr : rThis.GetPrev();
+/*N*/ BOOL bInFtn = rThis.IsInFtn();
+/*N*/ do {
+/*N*/ while( pPre && ( (pPre->IsTxtFrm() && ((SwTxtFrm*)pPre)->IsHiddenNow())
+/*N*/ || ( pPre->IsSctFrm() && !((SwSectionFrm*)pPre)->GetSection() ) ) )
+/*N*/ pPre = pPre->GetPrev();
+/*N*/ if( !pPre && bInFtn )
+/*N*/ {
+/*N*/ bInFtn = FALSE;
+/*N*/ if( !rThis.IsInSct() || rThis.IsSctFrm() ||
+/*N*/ !rThis.FindSctFrm()->IsInFtn() )
+/*N*/ pPre = rThis.FindFtnFrm()->GetPrev();
+/*N*/ if( pPre )
+/*N*/ {
+/*?*/ pPre = ((SwFtnFrm*)pPre)->Lower();
+/*?*/ if( pPre )
+/*?*/ while( pPre->GetNext() )
+/*?*/ pPre = pPre->GetNext();
+/*?*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ if( pPre && pPre->IsSctFrm() )
+/*N*/ {
+/*N*/ SwSectionFrm* pSect = (SwSectionFrm*)pPre;
+/*N*/ pPre = pSect->FindLastCntnt();
+/*N*/ // If the last content is in a table _inside_ the section,
+/*N*/ // take the table herself.
+/*N*/ if( pPre && pPre->IsInTab() && !pSect->IsInTab() )
+/*?*/ pPre = pPre->FindTabFrm();
+/*N*/ }
+/*N*/ break;
+/*?*/ } while( pPre );
+/*N*/ SwBorderAttrAccess *pAccess;
+/*N*/ SwFrm* pOwn;
+/*N*/ if( !pAttrs )
+/*N*/ {
+/*N*/ if( rThis.IsSctFrm() )
+/*N*/ {
+/*N*/ SwSectionFrm* pFoll = &((SwSectionFrm&)rThis);
+/*N*/ do
+/*N*/ pOwn = pFoll->ContainsAny();
+/*N*/ while( !pOwn && 0 != ( pFoll = pFoll->GetFollow() ) );
+/*N*/ if( !pOwn )
+/*?*/ return 0;
+/*N*/ }
+/*N*/ else
+/*N*/ pOwn = &rThis;
+/*N*/ pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), pOwn );
+/*N*/ pAttrs = pAccess->Get();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pAccess = NULL;
+/*N*/ pOwn = &rThis;
+/*N*/ }
+/*N*/ SwTwips nUpper = 0;
+/*N*/ if( pPre )
+/*N*/ {
+/*N*/ const SvxULSpaceItem &rPrevUL = pPre->GetAttrSet()->GetULSpace();
+/*N*/ if( rThis.GetAttrSet()->GetDoc()->IsParaSpaceMax() )
+/*N*/ {
+/*?*/ nUpper = rPrevUL.GetLower() + pAttrs->GetULSpace().GetUpper();
+/*?*/ SwTwips nAdd = 0;
+/*?*/ if ( pOwn->IsTxtFrm() )
+/*?*/ nAdd = Max( nAdd, long(((SwTxtFrm&)rThis).GetLineSpace()) );
+/*?*/ if ( pPre->IsTxtFrm() )
+/*?*/ nAdd = Max( nAdd, long(((SwTxtFrm*)pPre)->GetLineSpace()) );
+/*?*/ nUpper += nAdd;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nUpper = Max( rPrevUL.GetLower(), pAttrs->GetULSpace().GetUpper() );
+/*N*/ if ( pOwn->IsTxtFrm() )
+/*N*/ nUpper = Max( nUpper, long(((SwTxtFrm*)pOwn)->GetLineSpace()) );
+/*N*/ if ( pPre->IsTxtFrm() )
+/*N*/ nUpper = Max( nUpper, long(((SwTxtFrm*)pPre)->GetLineSpace()) );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( rThis.GetAttrSet()->GetDoc()->IsParaSpaceMaxAtPages() &&
+/*N*/ 1) //STRIP001 CastFlowFrm( pOwn )->HasParaSpaceAtPages( rThis.IsSctFrm() ) )
+/*?*/ { DBG_BF_ASSERT(0, "STRIP");} //STRIP001 nUpper = pAttrs->GetULSpace().GetUpper();
+/*N*/
+/*N*/ nUpper += pAttrs->GetTopLine( &rThis );
+/*N*/
+/*N*/ if( rThis.IsInDocBody() && rThis.GetAttrSet()->GetParaGrid().GetValue() )
+/*N*/ {
+/*N*/ const SwPageFrm* pPg = rThis.FindPageFrm();
+/*N*/ GETGRID( pPg )
+/*N*/ if( pGrid )
+/*N*/ {
+/*?*/ const SwFrm* pBody = pPg->FindBodyCont();
+/*?*/ if( pBody )
+/*?*/ {
+/*?*/ long nSum = pGrid->GetBaseHeight() + pGrid->GetRubyHeight();
+/*?*/ SWRECTFN( (&rThis) )
+/*?*/ SwTwips nOrig = (pBody->*fnRect->fnGetPrtTop)();
+/*?*/ SwTwips nTop = (rThis.Frm().*fnRect->fnGetTop)();
+/*?*/ if( bVert )
+/*?*/ {
+/*?*/ nTop -= nUpper;
+/*?*/ SwTwips nY = nOrig - nSum *( ( nOrig - nTop ) / nSum );
+/*?*/ if( nY > nTop )
+/*?*/ nY -= nSum;
+/*?*/ nUpper = nTop + nUpper - nY;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nTop += nUpper;
+/*?*/ SwTwips nY = nOrig + nSum *( ( nTop - nOrig ) / nSum );
+/*?*/ if( nY < nTop )
+/*?*/ nY += nSum;
+/*?*/ nUpper = nY - rThis.Frm().Top();
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ delete pAccess;
+/*N*/ return nUpper;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* BOOL SwFlowFrm::CheckMoveFwd()
+|*
+|* Beschreibung Moved den Frm vorwaerts wenn es durch die aktuellen
+|* Bedingungen und Attribute notwendig erscheint.
+|* Ersterstellung MA 05. Dec. 96
+|* Letzte Aenderung MA 09. Mar. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::CheckMoveFwd( BOOL &rbMakePage, BOOL bKeep, BOOL bMovedBwd )
+/*N*/ {
+/*N*/ const SwFrm* pNxt = rThis.GetIndNext();
+/*N*/
+/*N*/ if ( bKeep && //!bMovedBwd &&
+/*N*/ ( !pNxt || ( pNxt->IsTxtFrm() && ((SwTxtFrm*)pNxt)->IsEmptyMaster() ) ) &&
+/*N*/ ( 0 != (pNxt = rThis.FindNext()) ) && IsKeepFwdMoveAllowed() )
+/*N*/ {
+/*N*/ if( pNxt->IsSctFrm() )
+/*N*/ { // Nicht auf leere SectionFrms hereinfallen
+/*?*/ const SwFrm* pTmp = NULL;
+/*?*/ while( pNxt && pNxt->IsSctFrm() &&
+/*?*/ ( !((SwSectionFrm*)pNxt)->GetSection() ||
+/*?*/ !( pTmp = ((SwSectionFrm*)pNxt)->ContainsAny() ) ) )
+/*?*/ {
+/*?*/ pNxt = pNxt->FindNext();
+/*?*/ pTmp = NULL;
+/*?*/ }
+/*?*/ if( pTmp )
+/*?*/ pNxt = pTmp; // the content of the next notempty sectionfrm
+/*N*/ }
+/*N*/ if( pNxt && pNxt->GetValidPosFlag() )
+/*N*/ {
+/*N*/ BOOL bMove = FALSE;
+/*N*/ const SwSectionFrm *pSct = rThis.FindSctFrm();
+/*N*/ if( pSct && !pSct->GetValidSizeFlag() )
+/*N*/ {
+/*?*/ const SwSectionFrm* pNxtSct = pNxt->FindSctFrm();
+/*?*/ if( pNxtSct && pSct->IsAnFollow( pNxtSct ) )
+/*?*/ bMove = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ bMove = TRUE;
+/*N*/ if( bMove )
+/*N*/ {
+/*N*/ //Keep together with the following frame
+/*N*/ MoveFwd( rbMakePage, FALSE );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ BOOL bMovedFwd = FALSE;
+/*N*/
+/*N*/ if ( rThis.GetIndPrev() )
+/*N*/ {
+/*N*/ if ( IsPrevObjMove() ) //Auf Objekte des Prev Ruecksicht nehmen?
+/*N*/ {
+/*N*/ bMovedFwd = TRUE;
+/*N*/ if ( !MoveFwd( rbMakePage, FALSE ) )
+/*N*/ rbMakePage = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( IsPageBreak( FALSE ) )
+/*N*/ {
+/*N*/ while ( MoveFwd( rbMakePage, TRUE ) )
+/*N*/ /* do nothing */;
+/*N*/ rbMakePage = FALSE;
+/*N*/ bMovedFwd = TRUE;
+/*N*/ }
+/*N*/ else if ( IsColBreak ( FALSE ) )
+/*N*/ {
+/*N*/ const SwPageFrm *pPage = rThis.FindPageFrm();
+/*N*/ SwFrm *pCol = rThis.FindColFrm();
+/*N*/ do
+/*N*/ { MoveFwd( rbMakePage, FALSE );
+/*N*/ SwFrm *pTmp = rThis.FindColFrm();
+/*N*/ if( pTmp != pCol )
+/*N*/ {
+/*N*/ bMovedFwd = TRUE;
+/*N*/ pCol = pTmp;
+/*N*/ }
+/*N*/ else
+/*?*/ break;
+/*N*/ } while ( IsColBreak( FALSE ) );
+/*N*/ if ( pPage != rThis.FindPageFrm() )
+/*N*/ rbMakePage = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return bMovedFwd;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* BOOL SwFlowFrm::MoveFwd()
+|*
+|* Beschreibung Returnwert sagt, ob der Frm die Seite gewechselt hat.
+|* Ersterstellung MA 05. Dec. 96
+|* Letzte Aenderung MA 05. Dec. 96
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFlowFrm::MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways )
+/*N*/ {
+/*N*/ //!!!!MoveFtnCntFwd muss ggf. mitgepflegt werden.
+/*N*/ SwFtnBossFrm *pOldBoss = rThis.FindFtnBossFrm();
+/*N*/ if ( rThis.IsInFtn() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 return ((SwCntntFrm&)rThis).MoveFtnCntFwd( bMakePage, pOldBoss );
+/*N*/
+/*N*/ if( !IsFwdMoveAllowed() && !bMoveAlways )
+/*N*/ {
+/*N*/ BOOL bNoFwd = TRUE;
+/*N*/ if( rThis.IsInSct() )
+/*N*/ {
+/*?*/ SwFtnBossFrm* pBoss = rThis.FindFtnBossFrm();
+/*?*/ bNoFwd = !pBoss->IsInSct() || ( !pBoss->Lower()->GetNext() &&
+/*?*/ !pBoss->GetPrev() );
+/*N*/ }
+/*N*/ if( bNoFwd )
+/*N*/ {
+/*N*/ //Fuer PageBreak ist das Moven erlaubt, wenn der Frm nicht
+/*N*/ //bereits der erste der Seite ist.
+/*N*/ if ( !bPageBreak )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ const SwFrm *pCol = rThis.FindColFrm();
+/*N*/ if ( !pCol || !pCol->GetPrev() )
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ BOOL bSamePage = TRUE;
+/*N*/ SwLayoutFrm *pNewUpper =
+/*N*/ rThis.GetLeaf( bMakePage ? MAKEPAGE_INSERT : MAKEPAGE_NONE, TRUE );
+/*N*/
+/*N*/ if ( pNewUpper )
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( &rThis, PROT_MOVE_FWD, 0, 0 );
+/*N*/ SwPageFrm *pOldPage = pOldBoss->FindPageFrm();
+/*N*/ //Wir moven uns und alle direkten Nachfolger vor den ersten
+/*N*/ //CntntFrm unterhalb des neuen Uppers.
+/*N*/
+/*N*/ // Wenn unser NewUpper in einem SectionFrm liegt, muessen wir
+/*N*/ // verhindern, dass sich dieser im Calc selbst zerstoert
+/*N*/ SwSectionFrm* pSect = pNewUpper->FindSctFrm();
+/*N*/ BOOL bUnlock = FALSE;
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ // Wenn wir nur innerhalb unseres SectionFrms die Spalte wechseln,
+/*N*/ // rufen wir lieber kein Calc, sonst wird noch der SectionFrm
+/*N*/ // formatiert, der wiederum uns ruft etc.
+/*N*/ if( pSect != rThis.FindSctFrm() )
+/*N*/ {
+/*N*/ bUnlock = !pSect->IsColLocked();
+/*N*/ pSect->ColLock();
+/*N*/ pNewUpper->Calc();
+/*N*/ if( bUnlock )
+/*N*/ pSect->ColUnlock();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pNewUpper->Calc();
+/*N*/
+/*N*/ SwFtnBossFrm *pNewBoss = pNewUpper->FindFtnBossFrm();
+/*N*/ BOOL bBossChg = pNewBoss != pOldBoss;
+/*N*/ pNewBoss = pNewBoss->FindFtnBossFrm( TRUE );
+/*N*/ pOldBoss = pOldBoss->FindFtnBossFrm( TRUE );
+/*N*/ SwPageFrm* pNewPage = pOldPage;
+/*N*/
+/*N*/ //Erst die Fussnoten verschieben!
+/*N*/ BOOL bFtnMoved = FALSE;
+/*N*/ if ( pNewBoss != pOldBoss )
+/*N*/ {
+/*N*/ pNewPage = pNewBoss->FindPageFrm();
+/*N*/ bSamePage = pNewPage == pOldPage;
+/*N*/ //Damit die Fussnoten nicht auf dumme Gedanken kommen
+/*N*/ //setzen wir hier die Deadline.
+/*N*/ SWRECTFN( pOldBoss )
+/*N*/ SwSaveFtnHeight aHeight( pOldBoss,
+/*N*/ (pOldBoss->Frm().*fnRect->fnGetBottom)() );
+/*N*/ SwCntntFrm* pStart = rThis.IsCntntFrm() ?
+/*N*/ (SwCntntFrm*)&rThis : ((SwLayoutFrm&)rThis).ContainsCntnt();
+/*N*/ ASSERT( pStart, "MoveFwd: Missing Content" );
+/*N*/ SwLayoutFrm* pBody = pStart ? ( pStart->IsTxtFrm() ?
+/*N*/ (SwLayoutFrm*)((SwTxtFrm*)pStart)->FindBodyFrm() : 0 ) : 0;
+/*N*/ if( pBody )
+/*N*/ bFtnMoved = pBody->MoveLowerFtns( pStart, pOldBoss, pNewBoss,
+/*N*/ FALSE);
+/*N*/ }
+/*N*/ // Bei SectionFrms ist es moeglich, dass wir selbst durch pNewUpper->Calc()
+/*N*/ // bewegt wurden, z. B. in den pNewUpper.
+/*N*/ // MoveSubTree bzw. PasteTree ist auf so etwas nicht vorbereitet.
+/*N*/ if( pNewUpper != rThis.GetUpper() )
+/*N*/ {
+/*N*/ MoveSubTree( pNewUpper, pNewUpper->Lower() );
+/*N*/
+/*N*/ if ( bFtnMoved && !bSamePage )
+/*N*/ {
+/*?*/ pOldPage->UpdateFtnNum();
+/*?*/ pNewPage->UpdateFtnNum();
+/*N*/ }
+/*N*/
+/*N*/ if( bBossChg )
+/*N*/ {
+/*N*/ rThis.Prepare( PREP_BOSS_CHGD, 0, FALSE );
+/*N*/ if( !bSamePage )
+/*N*/ {
+/*N*/ ViewShell *pSh = rThis.GetShell();
+/*N*/ if ( pSh && !pSh->Imp()->IsUpdateExpFlds() )
+/*N*/ pSh->GetDoc()->SetNewFldLst(); //Wird von CalcLayout() hinterher erledigt!
+/*N*/ pNewPage->InvalidateSpelling();
+/*N*/ pNewPage->InvalidateAutoCompleteWords();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // OD 30.10.2002 #97265# - no <CheckPageDesc(..)> in online layout
+/*N*/ if ( !pNewPage->GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ //Bei Sections kann es passieren, das wir gleich in den Follow geflutscht
+/*N*/ //sind. Dadurch wird nicht vom GetLeaf fuer die richtige Seite gesorgt.
+/*N*/ //Das muessen wir fuer diesen Fall pruefen.
+/*N*/ if ( !bSamePage && pNewUpper->IsInSct() &&
+/*N*/ ( rThis.GetAttrSet()->GetPageDesc().GetPageDesc() ||
+/*N*/ pOldPage->GetPageDesc()->GetFollow() != pNewPage->GetPageDesc() ) )
+/*N*/ SwFrm::CheckPageDescs( pNewPage, FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ return bSamePage;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* BOOL SwFlowFrm::MoveBwd()
+|*
+|* Beschreibung Returnwert sagt, ob der Frm die Seite wechseln soll.
+|* Sollte von abgeleiteten Klassen gerufen werden.
+|* Das moven selbst muessen die abgeleiteten uebernehmen.
+|* Ersterstellung MA 05. Dec. 96
+|* Letzte Aenderung MA 05. Dec. 96
+|*
+|*************************************************************************/
+
+/*N*/ BOOL SwFlowFrm::MoveBwd( BOOL &rbReformat )
+/*N*/ {
+/*N*/ SwFlowFrm::SetMoveBwdJump( FALSE );
+/*N*/
+/*N*/ SwFtnFrm* pFtn = rThis.FindFtnFrm();
+/*N*/ if ( pFtn && pFtn->IsBackMoveLocked() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ SwFtnBossFrm * pOldBoss = rThis.FindFtnBossFrm();
+/*N*/ SwPageFrm * const pOldPage = pOldBoss->FindPageFrm();
+/*N*/ SwLayoutFrm *pNewUpper = 0;
+/*N*/ FASTBOOL bCheckPageDescs = FALSE;
+/*N*/
+/*N*/ if ( pFtn )
+/*N*/ {
+/*N*/ //Wenn die Fussnote bereits auf der gleichen Seite/Spalte wie die Referenz
+/*N*/ //steht, ist nix mit zurueckfliessen. Die breaks brauche fuer die
+/*N*/ //Fussnoten nicht geprueft zu werden.
+/*N*/ BOOL bEndnote = pFtn->GetAttr()->GetFtn().IsEndNote();
+/*N*/ SwFrm* pRef = bEndnote && pFtn->IsInSct() ?
+/*N*/ pFtn->FindSctFrm()->FindLastCntnt( FINDMODE_LASTCNT ) : pFtn->GetRef();
+/*N*/ ASSERT( pRef, "MoveBwd: Endnote for an empty section?" );
+/*N*/ if( !bEndnote )
+/*N*/ pOldBoss = pOldBoss->FindFtnBossFrm( TRUE );
+/*N*/ SwFtnBossFrm *pRefBoss = pRef->FindFtnBossFrm( !bEndnote );
+/*N*/ if ( pOldBoss != pRefBoss &&
+/*N*/ // OD 08.11.2002 #104840# - use <SwLayoutFrm::IsBefore(..)>
+/*N*/ ( !bEndnote ||
+/*N*/ pRefBoss->IsBefore( pOldBoss ) )
+/*N*/ )
+/*?*/ pNewUpper = rThis.GetLeaf( MAKEPAGE_FTN, FALSE );
+/*N*/ }
+/*N*/ else if ( IsPageBreak( TRUE ) ) //PageBreak zu beachten?
+/*N*/ {
+/*N*/ //Wenn auf der vorhergehenden Seite kein Frm im Body steht,
+/*N*/ //so ist das Zurueckfliessen trotz Pagebreak sinnvoll
+/*N*/ //(sonst: leere Seite).
+/*N*/ //Natuerlich muessen Leereseiten geflissentlich uebersehen werden!
+/*N*/ const SwFrm *pFlow = &rThis;
+/*N*/ do
+/*N*/ { pFlow = pFlow->FindPrev();
+/*N*/ } while ( pFlow && ( pFlow->FindPageFrm() == pOldPage ||
+/*N*/ !pFlow->IsInDocBody() ) );
+/*N*/ if ( pFlow )
+/*N*/ {
+/*N*/ long nDiff = pOldPage->GetPhyPageNum() - pFlow->GetPhyPageNum();
+/*N*/ if ( nDiff > 1 )
+/*N*/ {
+/*N*/ if ( ((SwPageFrm*)pOldPage->GetPrev())->IsEmptyPage() )
+/*N*/ nDiff -= 1;
+/*N*/ if ( nDiff > 1 )
+/*N*/ {
+/*N*/ pNewUpper = rThis.GetLeaf( MAKEPAGE_NONE, FALSE );
+/*N*/
+/*N*/ //
+/*N*/ // START OF HACK for #i14206#
+/*N*/ //
+/*N*/
+/*N*/ // Get the bodyframe of the next page.
+/*N*/ // There was a loop in this situation:
+/*N*/ // Page 5: Section frame
+/*N*/ // Page 6: Empty body frame
+/*N*/ // Page 7: Tab frame with page break before.
+/*N*/ // Here, the tab frame moves to page 5. Therefore the
+/*N*/ // section frame on page 5 is invalidated. During further
+/*N*/ // formatting of the tab frame, it is moved to page 6
+/*N*/ // because of the page break. During formatting of
+/*N*/ // the section frame, the tab frame moves to page 7 again and so on.
+/*N*/
+/*N*/ if ( pFlow->IsInSct() && SwFlowFrm::IsMoveBwdJump() && 2 == nDiff &&
+/*N*/ !((SwPageFrm*)pOldPage->GetPrev())->IsEmptyPage() &&
+/*N*/ pNewUpper && pNewUpper->IsPageBodyFrm() )
+/*N*/ {
+/*N*/ SwPageFrm* pNextPage = (SwPageFrm*)pNewUpper->GetUpper()->GetNext();
+/*N*/ if ( pNextPage )
+/*N*/ {
+/*N*/ SwFrm* pLayout = pNextPage->Lower();
+/*N*/ if ( pLayout && pLayout->IsHeaderFrm() )
+/*N*/ pLayout = pLayout->GetNext();
+/*N*/
+/*N*/ if ( pLayout && pLayout->IsBodyFrm() && !((SwLayoutFrm*)pLayout)->Lower() )
+/*N*/ {
+/*N*/ pNewUpper = (SwLayoutFrm*)pLayout;
+/*N*/ SwFlowFrm::SetMoveBwdJump( FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //
+/*N*/ // END OF HACK for #i14206#
+/*N*/ //
+/*N*/
+/*N*/ bCheckPageDescs = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( IsColBreak( TRUE ) )
+/*N*/ {
+/*N*/ //Wenn in der vorhergehenden Spalte kein CntntFrm steht, so ist
+/*N*/ //das Zurueckfliessen trotz ColumnBreak sinnvoll
+/*N*/ //(sonst: leere Spalte).
+/*N*/ if( rThis.IsInSct() )
+/*N*/ {
+/*?*/ pNewUpper = rThis.GetLeaf( MAKEPAGE_NONE, FALSE );
+/*?*/ if( pNewUpper && !SwFlowFrm::IsMoveBwdJump() &&
+/*?*/ ( pNewUpper->ContainsCntnt() ||
+/*?*/ ( ( !pNewUpper->IsColBodyFrm() ||
+/*?*/ !pNewUpper->GetUpper()->GetPrev() ) &&
+/*?*/ !pNewUpper->FindSctFrm()->GetPrev() ) ) )
+/*?*/ pNewUpper = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwFrm *pCol = rThis.FindColFrm();
+/*N*/ BOOL bGoOn = TRUE;
+/*N*/ BOOL bJump = FALSE;
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pCol->GetPrev() )
+/*N*/ pCol = pCol->GetPrev();
+/*N*/ else
+/*N*/ {
+/*N*/ bGoOn = FALSE;
+/*N*/ pCol = rThis.GetLeaf( MAKEPAGE_NONE, FALSE );
+/*N*/ }
+/*N*/ if ( pCol )
+/*N*/ {
+/*N*/ // ColumnFrms jetzt mit BodyFrm
+/*N*/ SwLayoutFrm* pColBody = pCol->IsColumnFrm() ?
+/*N*/ (SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower() :
+/*N*/ (SwLayoutFrm*)pCol;
+/*N*/ if ( pColBody->ContainsCntnt() )
+/*N*/ {
+/*N*/ bGoOn = FALSE; // Hier gibt's Inhalt, wir akzeptieren diese
+/*N*/ // nur, wenn GetLeaf() das MoveBwdJump-Flag gesetzt hat.
+/*N*/ if( SwFlowFrm::IsMoveBwdJump() )
+/*N*/ pNewUpper = pColBody;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pNewUpper ) // Wir hatten schon eine leere Spalte, haben
+/*?*/ bJump = TRUE; // also eine uebersprungen
+/*N*/ pNewUpper = pColBody; // Diese leere Spalte kommt in Frage,
+/*N*/ // trotzdem weitersuchen
+/*N*/ }
+/*N*/ }
+/*N*/ } while( bGoOn );
+/*N*/ if( bJump )
+/*?*/ SwFlowFrm::SetMoveBwdJump( TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ else //Keine Breaks also kann ich zurueckfliessen
+/*N*/ pNewUpper = rThis.GetLeaf( MAKEPAGE_NONE, FALSE );
+/*N*/
+/*N*/ //Fuer Follows ist das zurueckfliessen nur dann erlaubt wenn in der
+/*N*/ //neuen Umgebung kein Nachbar existiert (denn dieses waere der Master).
+/*N*/ //(6677)Wenn allerdings leere Blaetter uebersprungen wurden wird doch gemoved.
+/*N*/ if ( pNewUpper && IsFollow() && pNewUpper->Lower() )
+/*N*/ {
+/*N*/ if ( SwFlowFrm::IsMoveBwdJump() )
+/*N*/ {
+/*N*/ //Nicht hinter den Master sondern in das naechstfolgende leere
+/*N*/ //Blatt moven.
+/*N*/ SwFrm *pFrm = pNewUpper->Lower();
+/*N*/ while ( pFrm->GetNext() )
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ pNewUpper = pFrm->GetLeaf( MAKEPAGE_INSERT, TRUE );
+/*N*/ if( pNewUpper == rThis.GetUpper() ) //Landen wir wieder an der gleichen Stelle?
+/*?*/ pNewUpper = NULL; //dann eruebrigt sich das Moven
+/*N*/ }
+/*N*/ else
+/*N*/ pNewUpper = 0;
+/*N*/ }
+/*N*/ if ( pNewUpper && !ShouldBwdMoved( pNewUpper, TRUE, rbReformat ) )
+/*N*/ {
+/*N*/ if( !pNewUpper->Lower() )
+/*N*/ {
+/*N*/ if( pNewUpper->IsFtnContFrm() )
+/*N*/ {
+/*?*/ pNewUpper->Cut();
+/*?*/ delete pNewUpper;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwSectionFrm* pSectFrm = pNewUpper->FindSctFrm();
+/*N*/ if( pSectFrm && !pSectFrm->IsColLocked() && !pSectFrm->ContainsCntnt() )
+/*N*/ {
+/*N*/ pSectFrm->DelEmpty( TRUE );
+/*N*/ delete pSectFrm;
+/*N*/ rThis.bValidPos = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pNewUpper = 0;
+/*N*/ }
+/*N*/ if ( pNewUpper )
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( &rThis, PROT_MOVE_BWD, 0, 0 );
+/*N*/ if ( pNewUpper->IsFtnContFrm() )
+/*N*/ {
+/*?*/ //Kann sein, dass ich einen Container bekam.
+/*?*/ SwFtnFrm *pOld = rThis.FindFtnFrm();
+/*?*/ SwFtnFrm *pNew = new SwFtnFrm( pOld->GetFmt(),
+/*?*/ pOld->GetRef(), pOld->GetAttr() );
+/*?*/ if ( pOld->GetMaster() )
+/*?*/ {
+/*?*/ pNew->SetMaster( pOld->GetMaster() );
+/*?*/ pOld->GetMaster()->SetFollow( pNew );
+/*?*/ }
+/*?*/ pNew->SetFollow( pOld );
+/*?*/ pOld->SetMaster( pNew );
+/*?*/ pNew->Paste( pNewUpper );
+/*?*/ pNewUpper = pNew;
+/*N*/ }
+/*N*/ if( pNewUpper->IsFtnFrm() && rThis.IsInSct() )
+/*N*/ {
+/*?*/ SwSectionFrm* pSct = rThis.FindSctFrm();
+/*?*/ //Wenn wir in einem Bereich in einer Fussnote stecken, muss im
+/*?*/ //neuen Upper ggf. ein SwSectionFrm angelegt werden
+/*?*/ if( pSct->IsInFtn() )
+/*?*/ {
+/*?*/ SwFrm* pTmp = pNewUpper->Lower();
+/*?*/ if( pTmp )
+/*?*/ {
+/*?*/ while( pTmp->GetNext() )
+/*?*/ pTmp = pTmp->GetNext();
+/*?*/ if( !pTmp->IsSctFrm() ||
+/*?*/ ((SwSectionFrm*)pTmp)->GetFollow() != pSct )
+/*?*/ pTmp = NULL;
+/*?*/ }
+/*?*/ if( pTmp )
+/*?*/ pNewUpper = (SwSectionFrm*)pTmp;
+/*?*/ else
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pSct = new SwSectionFrm( *pSct, TRUE );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ BOOL bUnlock = FALSE;
+/*N*/ BOOL bFollow;
+/*N*/ //Section locken, sonst kann sie bei Fluss des einzigen Cntnt etwa
+/*N*/ //von zweiter in die erste Spalte zerstoert werden.
+/*N*/ SwSectionFrm* pSect = pNewUpper->FindSctFrm();
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ bUnlock = !pSect->IsColLocked();
+/*N*/ pSect->ColLock();
+/*N*/ bFollow = pSect->HasFollow();
+/*N*/ }
+/*N*/ pNewUpper->Calc();
+/*N*/ rThis.Cut();
+/*N*/ if( bUnlock )
+/*N*/ {
+/*N*/ if( pSect->HasFollow() != bFollow )
+/*N*/ pSect->_InvalidateSize();
+/*N*/ pSect->ColUnlock();
+/*N*/ }
+/*N*/
+/*N*/ rThis.Paste( pNewUpper );
+/*N*/
+/*N*/ SwPageFrm *pNewPage = rThis.FindPageFrm();
+/*N*/ if( pNewPage != pOldPage )
+/*N*/ {
+/*N*/ rThis.Prepare( PREP_BOSS_CHGD, (const void*)pOldPage, FALSE );
+/*N*/ ViewShell *pSh = rThis.GetShell();
+/*N*/ if ( pSh && !pSh->Imp()->IsUpdateExpFlds() )
+/*N*/ pSh->GetDoc()->SetNewFldLst(); //Wird von CalcLayout() hinterher eledigt!
+/*N*/ pNewPage->InvalidateSpelling();
+/*N*/ pNewPage->InvalidateAutoCompleteWords();
+/*N*/ // OD 30.10.2002 #97265# - no <CheckPageDesc(..)> in online layout
+/*N*/ if ( !pNewPage->GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ if ( bCheckPageDescs && pNewPage->GetNext() )
+/*N*/ SwFrm::CheckPageDescs( (SwPageFrm*)pNewPage->GetNext(), FALSE);
+/*N*/ else if ( rThis.GetAttrSet()->GetPageDesc().GetPageDesc() )
+/*N*/ {
+/*N*/ //Erste Seite wird etwa durch Ausblenden eines Bereiches leer
+/*N*/ SwFrm::CheckPageDescs( (SwPageFrm*)pNewPage, FALSE);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pNewUpper != 0;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlowFrm::CastFlowFrm
+|*
+|* Ersterstellung MA 03. May. 95
+|* Letzte Aenderung AMA 02. Dec. 97
+|*
+|*************************************************************************/
+
+/*N*/ SwFlowFrm *SwFlowFrm::CastFlowFrm( SwFrm *pFrm )
+/*N*/ {
+/*N*/ if ( pFrm->IsCntntFrm() )
+/*N*/ return (SwCntntFrm*)pFrm;
+/*N*/ if ( pFrm->IsTabFrm() )
+/*N*/ return (SwTabFrm*)pFrm;
+/*N*/ if ( pFrm->IsSctFrm() )
+/*N*/ return (SwSectionFrm*)pFrm;
+/*?*/ return 0;
+/*N*/ }
+
+/*N*/ const SwFlowFrm *SwFlowFrm::CastFlowFrm( const SwFrm *pFrm )
+/*N*/ {
+/*N*/ if ( pFrm->IsCntntFrm() )
+/*N*/ return (SwCntntFrm*)pFrm;
+/*N*/ if ( pFrm->IsTabFrm() )
+/*N*/ return (SwTabFrm*)pFrm;
+/*N*/ if ( pFrm->IsSctFrm() )
+/*N*/ return (SwSectionFrm*)pFrm;
+/*?*/ return 0;
+/*N*/ }
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_fly.cxx b/binfilter/bf_sw/source/core/layout/sw_fly.cxx
new file mode 100644
index 000000000000..5051bc3d83d9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_fly.cxx
@@ -0,0 +1,2073 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+#include <bf_svtools/itemiter.hxx>
+#include <bf_svtools/imap.hxx>
+#include <bf_svx/opaqitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/frmdiritem.hxx>
+
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtclds.hxx>
+#include <fmtcntnt.hxx>
+#include <fmturl.hxx>
+#include <fmtsrnd.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <fmtcnct.hxx>
+#include <layhelp.hxx>
+// OD 16.04.2003 #i13147# - for <SwFlyFrm::GetContour(..)>
+
+#include "doc.hxx"
+#include "viewsh.hxx"
+#include "pagefrm.hxx"
+#include "viewimp.hxx"
+#include "dcontact.hxx"
+#include "dflyobj.hxx"
+#include "dview.hxx"
+#include "frmtool.hxx"
+#include "frmfmt.hxx"
+#include "hints.hxx"
+#include "frmsh.hxx"
+#include "tabfrm.hxx"
+#include "txtfrm.hxx"
+#include "ndnotxt.hxx"
+#include "flyfrms.hxx"
+#include "ndindex.hxx" // GetGrfArea
+#include "sectfrm.hxx"
+namespace binfilter {
+
+//Aus dem PageFrm:
+
+/*N*/ SV_IMPL_PTRARR_SORT(SwSortDrawObjs,SdrObjectPtr)
+
+
+/*************************************************************************
+|*
+|* SwFlyFrm::SwFlyFrm()
+|*
+|* Ersterstellung MA 28. Sep. 92
+|* Letzte Aenderung MA 09. Apr. 99
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) :
+/*N*/ SwLayoutFrm( pFmt ),
+/*N*/ aRelPos(),
+/*N*/ pAnchor( 0 ),
+/*N*/ pPrevLink( 0 ),
+/*N*/ pNextLink( 0 ),
+/*N*/ bInCnt( FALSE ),
+/*N*/ bAtCnt( FALSE ),
+/*N*/ bLayout( FALSE ),
+/*N*/ bAutoPosition( FALSE ),
+/*N*/ bNoShrink( FALSE )
+/*N*/ {
+/*N*/ nType = FRMC_FLY;
+/*N*/
+/*N*/ bInvalid = bNotifyBack = TRUE;
+/*N*/ bLocked = bMinHeight =
+/*N*/ bHeightClipped = bWidthClipped = bFormatHeightOnly = FALSE;
+/*N*/
+/*N*/ //Grosseneinstellung, Fixe groesse ist immer die Breite
+/*N*/ const SwFmtFrmSize &rFrmSize = pFmt->GetFrmSize();
+/*N*/ BOOL bVert = FALSE;
+/*N*/ UINT16 nDir =
+/*N*/ ((SvxFrameDirectionItem&)pFmt->GetAttr( RES_FRAMEDIR )).GetValue();
+/*N*/ if( FRMDIR_ENVIRONMENT == nDir )
+/*N*/ {
+/*N*/ bDerivedVert = 1;
+/*N*/ bDerivedR2L = 1;
+/*N*/ if( pAnch && pAnch->IsVertical() )
+/*?*/ bVert = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ bInvalidVert = 0;
+/*?*/ bDerivedVert = 0;
+/*?*/ bDerivedR2L = 0;
+/*?*/ if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir
+/*?*/ || pFmt->GetDoc()->IsBrowseMode() )
+/*?*/ bVertical = 0;
+/*?*/ else
+/*?*/ bVertical = 1;
+/*?*/ bVert = bVertical;
+/*?*/ bInvalidR2L = 0;
+/*?*/ if( FRMDIR_HORI_RIGHT_TOP == nDir )
+/*?*/ bRightToLeft = 1;
+/*?*/ else
+/*?*/ bRightToLeft = 0;
+/*?*/ }
+/*N*/
+/*N*/ Frm().Width( rFrmSize.GetWidth() );
+/*N*/ Frm().Height( rFrmSize.GetHeight() );
+/*N*/
+/*N*/ //Hoehe Fix oder Variabel oder was?
+/*N*/ if ( rFrmSize.GetSizeType() == ATT_MIN_SIZE )
+/*N*/ bMinHeight = TRUE;
+/*N*/ else if ( rFrmSize.GetSizeType() == ATT_FIX_SIZE )
+/*N*/ bFixSize = TRUE;
+/*N*/
+/*N*/ //Spalten?
+/*N*/ const SwFmtCol &rCol = pFmt->GetCol();
+/*N*/ if ( rCol.GetNumCols() > 1 )
+/*N*/ {
+/*N*/ //PrtArea ersteinmal so gross wie der Frm, damit die Spalten
+/*N*/ //vernuenftig eingesetzt werden koennen; das schaukelt sich dann
+/*N*/ //schon zurecht.
+/*N*/ Prt().Width( Frm().Width() );
+/*N*/ Prt().Height( Frm().Height() );
+/*N*/ const SwFmtCol aOld; //ChgColumns() verlaesst sich darauf, dass auch ein
+/*N*/ //Old-Wert hereingereicht wird.
+/*N*/ ChgColumns( aOld, rCol );
+/*N*/ }
+/*N*/
+/*N*/ //Erst das Init, dann den Inhalt, denn zum Inhalt koennen widerum
+/*N*/ //Objekte/Rahmen gehoeren die dann angemeldet werden.
+/*N*/ InitDrawObj( FALSE );
+/*N*/
+/*N*/ //Fuer Verkettungen kann jetzt die Verbindung aufgenommen werden. Wenn
+/*N*/ //ein Nachbar nicht existiert, so macht das nichts, denn dieser wird ja
+/*N*/ //irgendwann Konsturiert und nimmt dann die Verbindung auf.
+/*N*/ const SwFmtChain &rChain = pFmt->GetChain();
+/*N*/ if ( rChain.GetPrev() || rChain.GetNext() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if ( rChain.GetNext() )
+/*N*/ }
+/*N*/
+/*N*/ if ( !GetPrevLink() ) //Inhalt gehoert sonst immer dem Master und meiner Zaehlt nicht
+/*N*/ {
+/*N*/ const SwFmtCntnt &rCntnt = pFmt->GetCntnt();
+/*N*/ ASSERT( rCntnt.GetCntntIdx(), ":-( Kein Inhalt vorbereitet." );
+/*N*/ ULONG nIndex = rCntnt.GetCntntIdx()->GetIndex();
+/*N*/ // Lower() bedeutet SwColumnFrm, eingefuegt werden muss der Inhalt dann in den (Column)BodyFrm
+/*N*/ ::binfilter::_InsertCnt( Lower() ? (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower() : (SwLayoutFrm*)this,
+/*N*/ pFmt->GetDoc(), nIndex );
+/*N*/
+/*N*/ //NoTxt haben immer eine FixHeight.
+/*N*/ if ( Lower() && Lower()->IsNoTxtFrm() )
+/*N*/ {
+/*N*/ bFixSize = TRUE;
+/*N*/ bMinHeight = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Und erstmal in den Wald stellen die Kiste, damit bei neuen Dokument nicht
+/*N*/ //unnoetig viel formatiert wird.
+/*N*/ Frm().Pos().X() = Frm().Pos().Y() = WEIT_WECH;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::~SwFlyFrm()
+|*
+|* Ersterstellung MA 28. Sep. 92
+|* Letzte Aenderung MA 07. Jul. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyFrm::~SwFlyFrm()
+/*N*/ {
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // Accessible objects for fly frames will be destroyed in this destructor.
+/*N*/ // For frames bound as char or frames that don't have an anchor we have
+/*N*/ // to do that ourselves. For any other frame the call RemoveFly at the
+/*N*/ // anchor will do that.
+/*N*/ if( IsAccessibleFrm() && GetFmt() && (IsFlyInCntFrm() || !pAnchor) )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ //Aus der Verkettung loessen.
+/*N*/ if ( GetPrevLink() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 UnchainFrames( GetPrevLink(), this );
+/*N*/ if ( GetNextLink() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 UnchainFrames( this, GetNextLink() );
+/*N*/
+/*N*/ //Unterstruktur zerstoeren, wenn dies erst im LayFrm DTor passiert ist's
+/*N*/ //zu spaet, denn dort ist die Seite nicht mehr erreichbar (muss sie aber
+/*N*/ //sein, damit sich ggf. weitere Flys abmelden koennen).
+/*N*/ SwFrm *pFrm = pLower;
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ //Erst die Flys des Frm vernichten, denn diese koennen sich sonst nach
+/*N*/ //dem Remove nicht mehr bei der Seite abmelden.
+/*N*/ while ( pFrm->GetDrawObjs() && pFrm->GetDrawObjs()->Count() )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pFrm->GetDrawObjs())[0];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ delete ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ else
+/*N*/ // OD 23.06.2003 #108784# - consider 'virtual' drawing objects
+/*N*/ {
+/*N*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
+/*N*/ pDrawVirtObj->RemoveFromWriterLayout();
+/*N*/ pDrawVirtObj->RemoveFromDrawingPage();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SdrObjUserCall* pUserCall = GetUserCall(pObj);
+/*N*/ if ( pUserCall )
+/*N*/ {
+/*N*/ static_cast<SwDrawContact*>(pUserCall)->DisconnectFromLayout();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pFrm->Remove();
+/*N*/ delete pFrm;
+/*N*/ pFrm = pLower;
+/*N*/ }
+/*N*/
+/*N*/ //Damit kein zerstoerter Cntnt als Turbo bei der Root angemeldet bleiben
+/*N*/ //kann verhindere ich hier, dass dort ueberhaupt noch einer angemeldet
+/*N*/ //ist.
+/*N*/ InvalidatePage();
+/*N*/
+/*N*/ //Tschuess sagen.
+/*N*/ if ( pAnchor )
+/*N*/ pAnchor->RemoveFly( this );
+/*N*/ }
+/*N*/ FinitDrawObj();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::InitDrawObj()
+|*
+|* Ersterstellung MA 02. Dec. 94
+|* Letzte Aenderung MA 30. Nov. 95
+|*
+|*************************************************************************/
+#ifdef _MSC_VER
+#pragma optimize("",off)
+#endif
+
+/*N*/ void SwFlyFrm::InitDrawObj( BOOL bNotify )
+/*N*/ {
+/*N*/ //ContactObject aus dem Format suchen. Wenn bereits eines existiert, so
+/*N*/ //braucht nur eine neue Ref erzeugt werden, anderfalls ist es jetzt an
+/*N*/ //der Zeit das Contact zu erzeugen.
+/*N*/ SwClientIter aIter( *GetFmt() );
+/*N*/ SwFlyDrawContact *pContact = (SwFlyDrawContact*)
+/*N*/ aIter.First( TYPE(SwFlyDrawContact) );
+/*N*/ if ( !pContact )
+/*N*/ pContact = new SwFlyDrawContact( (SwFlyFrmFmt*)GetFmt(),
+/*N*/ GetFmt()->GetDoc()->MakeDrawModel() );
+/*N*/ ASSERT( pContact, "InitDrawObj failed" );
+/*N*/ pDrawObj = pContact->CreateNewRef( this );
+/*N*/
+/*N*/ //Den richtigen Layer setzen.
+/*N*/ pDrawObj->SetLayer( GetFmt()->GetOpaque().GetValue() ?
+/*N*/ GetFmt()->GetDoc()->GetHeavenId() :
+/*N*/ GetFmt()->GetDoc()->GetHellId() );
+/*N*/ if ( bNotify )
+/*?*/ NotifyDrawObj();
+/*N*/ }
+
+/*N*/ #ifdef _MSC_VER
+/*N*/ #pragma optimize("",on)
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* SwFlyFrm::FinitDrawObj()
+|*
+|* Ersterstellung MA 12. Dec. 94
+|* Letzte Aenderung MA 15. May. 95
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::FinitDrawObj()
+/*N*/ {
+/*N*/ if ( !pDrawObj )
+/*?*/ return;
+/*N*/
+/*N*/ //Bei den SdrPageViews abmelden falls das Objekt dort noch selektiert ist.
+/*N*/ if ( !GetFmt()->GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ ViewShell *p1St = GetShell();
+/*N*/ if ( p1St )
+/*N*/ {
+/*N*/ ViewShell *pSh = p1St;
+/*N*/ do
+/*N*/ { //z.Zt. kann das Drawing nur ein Unmark auf alles, weil das
+/*N*/ //Objekt bereits Removed wurde.
+/*N*/ if( pSh->HasDrawView() )
+/*N*/ pSh->Imp()->GetDrawView()->UnmarkAll();
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != p1St );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //VirtObject mit in das Grab nehmen. Wenn das letzte VirObject
+/*N*/ //zerstoert wird, mussen das DrawObject und DrawContact ebenfalls
+/*N*/ //zerstoert werden.
+/*N*/ SwFlyDrawContact *pMyContact = 0;
+/*N*/ if ( GetFmt() )
+/*N*/ {
+/*N*/ SwClientIter aIter( *GetFmt() );
+/*N*/ aIter.GoStart();
+/*N*/ do {
+/*N*/ if ( aIter()->ISA(SwFrm) && (SwFrm*)aIter() != this )
+/*N*/ {
+/*N*/ pMyContact = 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ if( !pMyContact && aIter()->ISA(SwFlyDrawContact) )
+/*N*/ pMyContact = (SwFlyDrawContact*)aIter();
+/*N*/ aIter++;
+/*N*/ } while( aIter() );
+/*N*/ }
+/*N*/
+/*N*/ pDrawObj->SetUserCall( 0 ); //Ruft sonst Delete des ContactObj
+/*N*/ delete pDrawObj; //Meldet sich selbst beim Master ab.
+/*N*/ if ( pMyContact )
+/*N*/ delete pMyContact; //zerstoert den Master selbst.
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::ChainFrames()
+|*
+|* Ersterstellung MA 29. Oct. 97
+|* Letzte Aenderung MA 20. Jan. 98
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFlyFrm::FindChainNeighbour()
+|*
+|* Ersterstellung MA 11. Nov. 97
+|* Letzte Aenderung MA 09. Apr. 99
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFlyFrm::FindLastLower()
+|*
+|* Ersterstellung MA 29. Oct. 97
+|* Letzte Aenderung MA 29. Oct. 97
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFlyFrm::FrmSizeChg()
+|*
+|* Ersterstellung MA 17. Dec. 92
+|* Letzte Aenderung MA 24. Jul. 96
+|*
+|*************************************************************************/
+
+/*N*/ BOOL SwFlyFrm::FrmSizeChg( const SwFmtFrmSize &rFrmSize )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ SwTwips nDiffHeight = Frm().Height();
+/*N*/ if ( rFrmSize.GetSizeType() == ATT_VAR_SIZE )
+/*?*/ BFIXHEIGHT = bMinHeight = FALSE;
+/*N*/ else
+/*N*/ {
+/*N*/ if ( rFrmSize.GetSizeType() == ATT_FIX_SIZE )
+/*N*/ { BFIXHEIGHT = TRUE;
+/*N*/ bMinHeight = FALSE;
+/*N*/ }
+/*N*/ else if ( rFrmSize.GetSizeType() == ATT_MIN_SIZE )
+/*?*/ { BFIXHEIGHT = FALSE;
+/*?*/ bMinHeight = TRUE;
+/*N*/ }
+/*N*/ nDiffHeight -= rFrmSize.GetHeight();
+/*N*/ }
+/*N*/ //Wenn der Fly Spalten enthaehlt muessen der Fly und
+/*N*/ //die Spalten schon einmal auf die Wunschwerte gebracht
+/*N*/ //werden, sonst haben wir ein kleines Problem.
+/*N*/ if ( Lower() )
+/*N*/ {
+/*N*/ if ( Lower()->IsColumnFrm() )
+/*N*/ {
+/*?*/ const SwRect aOld( AddSpacesToFrm() );
+/*?*/ const Size aOldSz( Prt().SSize() );
+/*?*/ const SwTwips nDiffWidth = Frm().Width() - rFrmSize.GetWidth();
+/*?*/ aFrm.Height( aFrm.Height() - nDiffHeight );
+/*?*/ aFrm.Width ( aFrm.Width() - nDiffWidth );
+/*?*/ aPrt.Height( aPrt.Height() - nDiffHeight );
+/*?*/ aPrt.Width ( aPrt.Width() - nDiffWidth );
+/*?*/ ChgLowersProp( aOldSz );
+/*?*/ ::binfilter::Notify( this, FindPageFrm(), aOld );
+/*?*/ bValidPos = FALSE;
+/*?*/ bRet = TRUE;
+/*N*/ }
+/*N*/ else if ( Lower()->IsNoTxtFrm() )
+/*N*/ {
+/*N*/ BFIXHEIGHT = TRUE;
+/*N*/ bMinHeight = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::Modify()
+|*
+|* Ersterstellung MA 17. Dec. 92
+|* Letzte Aenderung MA 17. Jan. 97
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ BYTE nInvFlags = 0;
+/*N*/
+/*N*/ if( pNew && RES_ATTRSET_CHG == pNew->Which() )
+/*N*/ {
+/*N*/ SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
+/*N*/ SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
+/*N*/ SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
+/*N*/ SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
+/*N*/ (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+/*N*/ &aOldSet, &aNewSet );
+/*N*/ if( aNIter.IsAtEnd() )
+/*N*/ break;
+/*?*/ aNIter.NextItem();
+/*?*/ aOIter.NextItem();
+/*N*/ }
+/*N*/ if ( aOldSet.Count() || aNewSet.Count() )
+/*N*/ SwLayoutFrm::Modify( &aOldSet, &aNewSet );
+/*N*/ }
+/*N*/ else
+/*N*/ _UpdateAttr( pOld, pNew, nInvFlags );
+/*N*/
+/*N*/ if ( nInvFlags != 0 )
+/*N*/ {
+/*N*/ _Invalidate();
+/*N*/ if ( nInvFlags & 0x01 )
+/*N*/ _InvalidatePos();
+/*N*/ if ( nInvFlags & 0x02 )
+/*N*/ _InvalidateSize();
+/*N*/ if ( nInvFlags & 0x04 )
+/*N*/ _InvalidatePrt();
+/*N*/ if ( nInvFlags & 0x08 )
+/*N*/ SetNotifyBack();
+/*N*/ if ( nInvFlags & 0x10 )
+/*N*/ SetCompletePaint();
+/*N*/ if ( ( nInvFlags & 0x40 ) && Lower() && Lower()->IsNoTxtFrm() )
+/*N*/ ClrContourCache( GetVirtDrawObj() );
+/*N*/ SwRootFrm *pRoot;
+/*N*/ if ( nInvFlags & 0x20 && 0 != (pRoot = FindRootFrm()) )
+/*N*/ pRoot->InvalidateBrowseWidth();
+/*N*/ }
+/*N*/ }
+
+/*M*/ void SwFlyFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew,
+/*M*/ BYTE &rInvFlags,
+/*M*/ SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
+/*M*/ {
+/*M*/ BOOL bClear = TRUE;
+/*M*/ const USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*M*/ ViewShell *pSh = GetShell();
+/*M*/ switch( nWhich )
+/*M*/ {
+/*M*/ case RES_VERT_ORIENT:
+/*M*/ case RES_HORI_ORIENT:
+/*M*/ //Achtung! _immer_ Aktion in ChgRePos() mitpflegen.
+/*M*/ rInvFlags |= 0x09;
+/*M*/ break;
+/*M*/
+/*M*/ case RES_SURROUND:
+/*M*/ {
+/*M*/ rInvFlags |= 0x40;
+/*M*/ //Der Hintergrund muss benachrichtigt und Invalidiert werden.
+/*M*/ const SwRect aTmp( AddSpacesToFrm() );
+/*M*/ NotifyBackground( FindPageFrm(), aTmp, PREP_FLY_ATTR_CHG );
+/*M*/
+/*M*/ // Durch eine Umlaufaenderung von rahmengebundenen Rahmen kann eine
+/*M*/ // vertikale Ausrichtung aktiviert/deaktiviert werden => MakeFlyPos
+/*M*/ if( FLY_AT_FLY == GetFmt()->GetAnchor().GetAnchorId() )
+/*M*/ rInvFlags |= 0x09;
+/*M*/
+/*M*/ //Ggf. die Kontur am Node loeschen.
+/*M*/ if ( Lower() && Lower()->IsNoTxtFrm() &&
+/*M*/ !GetFmt()->GetSurround().IsContour() )
+/*M*/ {
+/*M*/ SwNoTxtNode *pNd = (SwNoTxtNode*)((SwCntntFrm*)Lower())->GetNode();
+/*M*/ if ( pNd->HasContour() )
+/*M*/ pNd->SetContour( 0 );
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_PROTECT:
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ case RES_COL:
+/*M*/ {
+/*?*/ ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew );
+/*?*/ const SwFmtFrmSize &rNew = GetFmt()->GetFrmSize();
+/*?*/ if ( FrmSizeChg( rNew ) )
+/*?*/ NotifyDrawObj();
+/*?*/ rInvFlags |= 0x1A;
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ case RES_FRM_SIZE:
+/*M*/ case RES_FMT_CHG:
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ break;
+/*M*/ }
+/*M*/ case RES_UL_SPACE:
+/*M*/ case RES_LR_SPACE:
+/*M*/ {
+/*?*/ rInvFlags |= 0x41;
+/*?*/ if ( GetFmt()->GetDoc()->IsBrowseMode() )
+/*?*/ GetFmt()->GetDoc()->GetRootFrm()->InvalidateBrowseWidth();
+/*?*/ SwRect aNew( AddSpacesToFrm() );
+/*?*/ SwRect aOld( aFrm );
+/*?*/ if ( RES_UL_SPACE == nWhich )
+/*?*/ {
+/*?*/ const SvxULSpaceItem &rUL = *(SvxULSpaceItem*)pNew;
+/*?*/ aOld.Top( Max( aOld.Top() - long(rUL.GetUpper()), 0L ) );
+/*?*/ aOld.SSize().Height()+= rUL.GetLower();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ const SvxLRSpaceItem &rLR = *(SvxLRSpaceItem*)pNew;
+/*?*/ aOld.Left ( Max( aOld.Left() - long(rLR.GetLeft()), 0L ) );
+/*?*/ aOld.SSize().Width() += rLR.GetRight();
+/*?*/ }
+/*?*/ aNew.Union( aOld );
+/*?*/ NotifyBackground( FindPageFrm(), aNew, PREP_CLEAR );
+/*?*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_BOX:
+/*M*/ case RES_SHADOW:
+/*M*/ rInvFlags |= 0x17;
+/*M*/ break;
+/*M*/
+/*M*/ case RES_FRAMEDIR :
+/*?*/ SetDerivedVert( FALSE );
+/*?*/ SetDerivedR2L( FALSE );
+/*?*/ CheckDirChange();
+/*M*/ break;
+/*M*/
+/*M*/ case RES_OPAQUE:
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*M*/ case RES_URL:
+/*M*/ //Das Interface arbeitet bei Textrahmen auf der Rahmengroesse,
+/*M*/ //die Map muss sich aber auf die FrmSize beziehen
+/*?*/ if ( (!Lower() || !Lower()->IsNoTxtFrm()) &&
+/*?*/ ((SwFmtURL*)pNew)->GetMap() && ((SwFmtURL*)pOld)->GetMap() )
+/*?*/ {
+/*?*/ const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
+/*?*/ if ( rSz.GetHeight() != Frm().Height() ||
+/*?*/ rSz.GetWidth() != Frm().Width() )
+/*?*/ {
+/*?*/ SwFmtURL aURL( GetFmt()->GetURL() );
+/*?*/ Fraction aScaleX( Frm().Width(), rSz.GetWidth() );
+/*?*/ Fraction aScaleY( Frm().Height(), rSz.GetHeight() );
+/*?*/ aURL.GetMap()->Scale( aScaleX, aScaleY );
+/*?*/ SwFrmFmt *pFmt = GetFmt();
+/*?*/ pFmt->LockModify();
+/*?*/ pFmt->SetAttr( aURL );
+/*?*/ pFmt->UnlockModify();
+/*?*/ }
+/*?*/ }
+/*M*/ /* Keine Invalidierung notwendig */
+/*M*/ break;
+/*M*/
+/*M*/ case RES_CHAIN:
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/
+/*M*/ default:
+/*M*/ bClear = FALSE;
+/*M*/ }
+/*M*/ if ( bClear )
+/*M*/ {
+/*M*/ if ( pOldSet || pNewSet )
+/*M*/ {
+/*M*/ if ( pOldSet )
+/*M*/ pOldSet->ClearItem( nWhich );
+/*M*/ if ( pNewSet )
+/*M*/ pNewSet->ClearItem( nWhich );
+/*M*/ }
+/*M*/ else
+/*M*/ SwLayoutFrm::Modify( pOld, pNew );
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::GetInfo()
+|*
+|* Beschreibung erfragt Informationen
+|* Ersterstellung JP 31.03.94
+|* Letzte Aenderung JP 31.03.94
+|*
+*************************************************************************/
+
+ // erfrage vom Modify Informationen
+/*N*/ BOOL SwFlyFrm::GetInfo( SfxPoolItem & rInfo ) const
+/*N*/ {
+/*N*/ if( RES_AUTOFMT_DOCNODE == rInfo.Which() )
+/*N*/ return FALSE; // es gibt einen FlyFrm also wird er benutzt
+/*?*/ return TRUE; // weiter suchen
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::_Invalidate()
+|*
+|* Ersterstellung MA 15. Oct. 92
+|* Letzte Aenderung MA 26. Jun. 96
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::_Invalidate( SwPageFrm *pPage )
+/*N*/ {
+/*N*/ InvalidatePage( pPage );
+/*N*/ bNotifyBack = bInvalid = TRUE;
+/*N*/
+/*N*/ SwFlyFrm *pFrm;
+/*N*/ if ( GetAnchor() && 0 != (pFrm = GetAnchor()->FindFlyFrm()) )
+/*N*/ {
+/*N*/ //Gaanz dumm: Wenn der Fly innerhalb eines Fly gebunden ist, der
+/*N*/ //Spalten enthaehlt, sollte das Format von diesem ausgehen.
+/*N*/ if ( !pFrm->IsLocked() && !pFrm->IsColLocked() &&
+/*N*/ pFrm->Lower() && pFrm->Lower()->IsColumnFrm() )
+/*N*/ pFrm->InvalidateSize();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::ChgRelPos()
+|*
+|* Beschreibung Aenderung der relativen Position, die Position wird
+|* damit automatisch Fix, das Attribut wird entprechend angepasst.
+|* Ersterstellung MA 25. Aug. 92
+|* Letzte Aenderung MA 09. Aug. 95
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwFlyFrm::Format()
+|*
+|* Beschreibung: "Formatiert" den Frame; Frm und PrtArea.
+|* Die Fixsize wird hier nicht eingestellt.
+|* Ersterstellung MA 14. Jun. 93
+|* Letzte Aenderung MA 13. Jun. 96
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::Format( const SwBorderAttrs *pAttrs )
+/*N*/ {
+/*N*/ ASSERT( pAttrs, "FlyFrm::Format, pAttrs ist 0." );
+/*N*/
+/*N*/ ColLock();
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ if ( Frm().Top() == WEIT_WECH && Frm().Left() == WEIT_WECH )
+/*N*/ //Sicherheitsschaltung wegnehmen (siehe SwFrm::CTor)
+/*N*/ Frm().Pos().X() = Frm().Pos().Y() = 0;
+/*N*/
+/*N*/ //Breite der Spalten pruefen und ggf. einstellen.
+/*N*/ if ( Lower() && Lower()->IsColumnFrm() )
+/*N*/ AdjustColumns( 0, FALSE );
+/*N*/
+/*N*/ bValidSize = TRUE;
+/*N*/
+/*N*/ const SwTwips nUL = pAttrs->CalcTopLine() + pAttrs->CalcBottomLine();
+/*N*/ const SwTwips nLR = pAttrs->CalcLeftLine()+ pAttrs->CalcRightLine();
+/*N*/ const Size &rSz = pAttrs->GetSize();
+/*N*/ const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize();
+/*N*/
+/*N*/ ASSERT( rSz.Height() != 0 || rFrmSz.GetHeightPercent(), "Hoehe des RahmenAttr ist 0." );
+/*N*/ ASSERT( rSz.Width() != 0 || rFrmSz.GetWidthPercent(), "Breite des RahmenAttr ist 0." );
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ if( !HasFixSize() )
+/*N*/ {
+/*N*/ SwTwips nRemaining = 0;
+/*N*/ SwTwips nOldHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ long nMinHeight = 0;
+/*N*/ if( IsMinHeight() )
+/*N*/ {
+/*N*/ Size aSz( CalcRel( rFrmSz ) );
+/*N*/ nMinHeight = bVert ? aSz.Width() : aSz.Height();
+/*N*/ }
+/*N*/ if ( Lower() )
+/*N*/ {
+/*N*/ if ( Lower()->IsColumnFrm() )
+/*N*/ {
+/*N*/ FormatWidthCols( *pAttrs, nUL, nMinHeight );
+/*N*/ nRemaining = (Lower()->Frm().*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwFrm *pFrm = Lower();
+/*N*/ while ( pFrm )
+/*N*/ { nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
+/*N*/ // Dieser TxtFrm waere gern ein bisschen groesser
+/*N*/ nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight()
+/*N*/ - (pFrm->Prt().*fnRect->fnGetHeight)();
+/*N*/ else if( pFrm->IsSctFrm() && ((SwSectionFrm*)pFrm)->IsUndersized() )
+/*N*/ nRemaining += ((SwSectionFrm*)pFrm)->Undersize();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ if( !nRemaining )
+/*N*/ nRemaining = nOldHeight - nUL;
+/*N*/ }
+/*N*/ if ( GetDrawObjs() )
+/*N*/ {
+/*?*/ USHORT nCnt = GetDrawObjs()->Count();
+/*?*/ SwTwips nTop = (Frm().*fnRect->fnGetTop)();
+/*?*/ SwTwips nBorder = (Frm().*fnRect->fnGetHeight)() -
+/*?*/ (Prt().*fnRect->fnGetHeight)();
+/*?*/ for ( USHORT i = 0; i < nCnt; ++i )
+/*?*/ {
+/*?*/ SdrObject *pO = (*GetDrawObjs())[i];
+/*?*/ if ( pO->IsWriterFlyFrame() )
+/*?*/ {
+/*?*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*?*/ if( pFly->IsFlyLayFrm() &&
+/*?*/ pFly->Frm().Top() != WEIT_WECH )
+/*?*/ {
+/*?*/ SwTwips nDist = -(pFly->Frm().*fnRect->
+/*?*/ fnBottomDist)( nTop );
+/*?*/ if( nDist > nBorder + nRemaining )
+/*?*/ nRemaining = nDist - nBorder;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( IsMinHeight() )
+/*N*/ {
+/*N*/ const Size aSizeII = CalcRel( rFrmSz );
+/*N*/ ASSERT( nMinHeight==(bVert? aSizeII.Width() : aSizeII.Height()),
+/*N*/ "FlyFrm::Format: Changed MinHeight" );
+/*N*/ }
+/*N*/ #endif
+/*N*/ if( IsMinHeight() && (nRemaining + nUL) < nMinHeight )
+/*N*/ nRemaining = nMinHeight - nUL;
+/*N*/ //Weil das Grow/Shrink der Flys die Groessen nicht direkt
+/*N*/ //einstellt, sondern indirekt per Invalidate ein Format
+/*N*/ //ausloesst, muessen die Groessen hier direkt eingestellt
+/*N*/ //werden. Benachrichtung laeuft bereits mit.
+/*N*/ //Weil bereits haeufiger 0en per Attribut hereinkamen wehre
+/*N*/ //ich mich ab sofort dagegen.
+/*N*/ if ( nRemaining < MINFLY )
+/*?*/ nRemaining = MINFLY;
+/*N*/ (Prt().*fnRect->fnSetHeight)( nRemaining );
+/*N*/ nRemaining -= (Frm().*fnRect->fnGetHeight)();
+/*N*/ (Frm().*fnRect->fnAddBottom)( nRemaining + nUL );
+/*N*/ bValidSize = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bValidSize = TRUE; //Fixe Frms formatieren sich nicht.
+/*N*/ //Flys stellen ihre Groesse anhand des Attr ein.
+/*N*/ Size aSz( CalcRel( rFrmSz ) );
+/*N*/ SwTwips nNewSize = bVert ? aSz.Width() : aSz.Height();
+/*N*/ nNewSize -= nUL;
+/*N*/ if( nNewSize < MINFLY )
+/*?*/ nNewSize = MINFLY;
+/*N*/ (Prt().*fnRect->fnSetHeight)( nNewSize );
+/*N*/ nNewSize += nUL - (Frm().*fnRect->fnGetHeight)();
+/*N*/ (Frm().*fnRect->fnAddBottom)( nNewSize );
+/*N*/ }
+/*N*/ if ( !bFormatHeightOnly )
+/*N*/ {
+/*N*/ Size aSz( CalcRel( rFrmSz ) );
+/*N*/ SwTwips nNewSize = bVert ? aSz.Height() : aSz.Width();
+/*N*/ nNewSize -= nLR;
+/*N*/ if( nNewSize < MINFLY )
+/*?*/ nNewSize = MINFLY;
+/*N*/ (Prt().*fnRect->fnSetWidth)( nNewSize );
+/*N*/ nNewSize += nLR - (Frm().*fnRect->fnGetWidth)();
+/*N*/ (Frm().*fnRect->fnAddRight)( nNewSize );
+/*N*/ }
+/*N*/ }
+/*N*/ ColUnlock();
+/*N*/ }
+
+// OD 14.03.2003 #i11760# - change parameter <bNoColl>: type <bool>;
+// default value = false.
+// OD 14.03.2003 #i11760# - add new parameter <bNoCalcFollow> with
+// default value = false.
+// OD 11.04.2003 #108824# - new parameter <bNoCalcFollow> was used by method
+// <FormatWidthCols(..)> to avoid follow formatting
+// for text frames. But, unformatted follows causes
+// problems in method <SwCntntFrm::_WouldFit(..)>,
+// which assumes that the follows are formatted.
+// Thus, <bNoCalcFollow> no longer used by <FormatWidthCols(..)>.
+//void CalcCntnt( SwLayoutFrm *pLay, BOOL bNoColl )
+/*N*/ void CalcCntnt( SwLayoutFrm *pLay,
+/*N*/ bool bNoColl,
+/*N*/ bool bNoCalcFollow )
+/*N*/ {
+/*N*/ SwSectionFrm* pSect;
+/*N*/ BOOL bCollect = FALSE;
+/*N*/ if( pLay->IsSctFrm() )
+/*N*/ {
+/*N*/ pSect = (SwSectionFrm*)pLay;
+/*N*/ if( pSect->IsEndnAtEnd() && !bNoColl )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 bCollect = TRUE;
+/*N*/ }
+/*N*/ pSect->CalcFtnCntnt();
+/*N*/ }
+/*N*/ else
+/*N*/ pSect = NULL;
+/*N*/ SwFrm *pFrm = pLay->ContainsAny();
+/*N*/ if ( !pFrm )
+/*N*/ {
+/*?*/ if( pSect )
+/*?*/ {
+/*?*/ if( pSect->HasFollow() )
+/*?*/ pFrm = pSect->GetFollow()->ContainsAny();
+/*?*/ if( !pFrm )
+/*?*/ {
+/*?*/ if( pSect->IsEndnAtEnd() )
+/*?*/ {
+/*?*/ if( bCollect )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pLay->GetFmt()->GetDoc()->GetLayouter()->
+/*?*/ BOOL bLock = pSect->IsFtnLock();
+/*?*/ pSect->SetFtnLock( TRUE );
+/*?*/ pSect->CalcFtnCntnt();
+/*?*/ pSect->CalcFtnCntnt();
+/*?*/ pSect->SetFtnLock( bLock );
+/*?*/ }
+/*?*/ return;
+/*?*/ }
+/*?*/ pFrm->_InvalidatePos();
+/*?*/ }
+/*?*/ else
+/*?*/ return;
+/*N*/ }
+/*N*/ pFrm->InvalidatePage();
+/*N*/
+/*N*/ do
+/*N*/ {
+/*N*/ SwFlyFrm *pAgainFly1 = 0, //Oszillation abknipsen.
+/*N*/ *pAgainFly2 = 0;
+/*N*/ SwFrm* pLast;
+/*N*/ do
+/*N*/ {
+/*N*/ pLast = pFrm;
+/*N*/ if( pFrm->IsVertical() ?
+/*N*/ ( pFrm->GetUpper()->Prt().Height() != pFrm->Frm().Height() )
+/*N*/ : ( pFrm->GetUpper()->Prt().Width() != pFrm->Frm().Width() ) )
+/*N*/ {
+/*N*/ pFrm->Prepare( PREP_FIXSIZE_CHG );
+/*N*/ pFrm->_InvalidateSize();
+/*N*/ }
+/*N*/
+/*N*/ if ( pFrm->IsTabFrm() )
+/*N*/ {
+/*N*/ ((SwTabFrm*)pFrm)->bCalcLowers = TRUE;
+/*N*/ if ( ((SwTabFrm*)pFrm)->IsFollow() )
+/*?*/ ((SwTabFrm*)pFrm)->bLockBackMove = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ // OD 14.03.2003 #i11760# - forbid format of follow, if requested.
+/*N*/ if ( bNoCalcFollow && pFrm->IsTxtFrm() )
+/*N*/ static_cast<SwTxtFrm*>(pFrm)->ForbidFollowFormat();
+/*N*/ pFrm->Calc();
+/*N*/ // OD 14.03.2003 #i11760# - reset control flag for follow format.
+/*N*/ if ( pFrm->IsTxtFrm() )
+/*N*/ {
+/*N*/ static_cast<SwTxtFrm*>(pFrm)->AllowFollowFormat();
+/*N*/ }
+/*N*/
+/*N*/ //Dumm aber wahr, die Flys muessen mitkalkuliert werden.
+/*N*/ BOOL bAgain = FALSE;
+/*N*/ if ( pFrm->GetDrawObjs() && pLay->IsAnLower( pFrm ) )
+/*N*/ {
+/*N*/ USHORT nCnt = pFrm->GetDrawObjs()->Count();
+/*N*/ for ( USHORT i = 0; i < nCnt; ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pFrm->GetDrawObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ pFly->InvalidatePos();
+/*N*/ SwRect aRect( pFly->Frm() );
+/*N*/ pFly->Calc();
+/*N*/ if ( aRect != pFly->Frm() )
+/*N*/ {
+/*N*/ bAgain = TRUE;
+/*N*/ if ( pAgainFly2 == pFly )
+/*N*/ {
+/*?*/ //Oszillation unterbinden.
+/*?*/ SwFrmFmt *pFmt = pFly->GetFmt();
+/*?*/ SwFmtSurround aAttr( pFmt->GetSurround() );
+/*?*/ if( SURROUND_THROUGHT != aAttr.GetSurround() )
+/*?*/ {
+/*?*/ // Bei autopositionierten hilft manchmal nur
+/*?*/ // noch, auf Durchlauf zu schalten
+/*?*/ if( pFly->IsAutoPos() &&
+/*?*/ SURROUND_PARALLEL == aAttr.GetSurround() )
+/*?*/ aAttr.SetSurround( SURROUND_THROUGHT );
+/*?*/ else
+/*?*/ aAttr.SetSurround( SURROUND_PARALLEL );
+/*?*/ pFmt->LockModify();
+/*?*/ pFmt->SetAttr( aAttr );
+/*?*/ pFmt->UnlockModify();
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( pAgainFly1 == pFly )
+/*?*/ pAgainFly2 = pFly;
+/*N*/ pAgainFly1 = pFly;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pFrm->GetDrawObjs() )
+/*?*/ break;
+/*N*/ if ( pFrm->GetDrawObjs()->Count() < nCnt )
+/*N*/ {
+/*?*/ --i;
+/*?*/ --nCnt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bAgain )
+/*N*/ {
+/*N*/ pFrm = pLay->ContainsCntnt();
+/*N*/ if ( pFrm && pFrm->IsInTab() )
+/*?*/ pFrm = pFrm->FindTabFrm();
+/*N*/ if( pFrm && pFrm->IsInSct() )
+/*N*/ {
+/*?*/ SwSectionFrm* pTmp = pFrm->FindSctFrm();
+/*?*/ if( pTmp != pLay && pLay->IsAnLower( pTmp ) )
+/*?*/ pFrm = pTmp;
+/*N*/ }
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pFrm->IsTabFrm() )
+/*N*/ {
+/*N*/ if ( ((SwTabFrm*)pFrm)->IsFollow() )
+/*?*/ ((SwTabFrm*)pFrm)->bLockBackMove = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ pFrm = pFrm->FindNext();
+/*N*/ if( pFrm && pFrm->IsSctFrm() && pSect )
+/*N*/ {
+/*N*/ // Es koennen hier leere SectionFrms herumspuken
+/*N*/ while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
+/*?*/ pFrm = pFrm->FindNext();
+/*N*/ // Wenn FindNext den Follow des urspruenglichen Bereichs liefert,
+/*N*/ // wollen wir mit dessen Inhalt weitermachen, solange dieser
+/*N*/ // zurueckfliesst.
+/*N*/ if( pFrm && pFrm->IsSctFrm() && ( pFrm == pSect->GetFollow() ||
+/*N*/ ((SwSectionFrm*)pFrm)->IsAnFollow( pSect ) ) )
+/*N*/ {
+/*N*/ pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if( pFrm )
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ // Im pLay bleiben, Ausnahme, bei SectionFrms mit Follow wird der erste
+/*N*/ // CntntFrm des Follows anformatiert, damit er die Chance erhaelt, in
+/*N*/ // pLay zu landen. Solange diese Frames in pLay landen, geht's weiter.
+/*N*/ } while ( pFrm && ( pLay->IsAnLower( pFrm ) ||
+/*N*/ ( pSect && ( ( pSect->HasFollow() && ( pLay->IsAnLower( pLast )
+/*N*/ ||(pLast->IsInSct() && pLast->FindSctFrm()->IsAnFollow(pSect)) )
+/*N*/ && pSect->GetFollow()->IsAnLower( pFrm ) ) || ( pFrm->IsInSct()
+/*N*/ && pFrm->FindSctFrm()->IsAnFollow( pSect ) ) ) ) ) );
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ if( bCollect )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pLay->GetFmt()->GetDoc()->GetLayouter()->InsertEndnotes(pSect);
+/*N*/ }
+/*N*/ if( pSect->HasFollow() )
+/*N*/ {
+/*N*/ SwSectionFrm* pNxt = pSect->GetFollow();
+/*N*/ while( pNxt && !pNxt->ContainsCntnt() )
+/*?*/ pNxt = pNxt->GetFollow();
+/*N*/ if( pNxt )
+/*N*/ pNxt->CalcFtnCntnt();
+/*N*/ }
+/*N*/ if( bCollect )
+/*N*/ {
+/*?*/ pFrm = pLay->ContainsAny();
+/*?*/ bCollect = FALSE;
+/*?*/ if( pFrm )
+/*?*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*?*/ while( TRUE );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::MakeFlyPos()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 14. Nov. 96
+|*
+|*************************************************************************/
+
+/*M*/ void SwFlyFrm::MakeFlyPos()
+/*M*/ {
+/*M*/ if ( !bValidPos )
+/*M*/ { bValidPos = TRUE;
+/*M*/ GetAnchor()->Calc();
+/*M*/ SWRECTFN( GetAnchor() );
+/*M*/ //Die Werte in den Attributen muessen ggf. upgedated werden,
+/*M*/ //deshalb werden hier Attributinstanzen und Flags benoetigt.
+/*M*/ SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
+/*M*/ BOOL bFlyAtFly = FLY_AT_FLY == pFmt->GetAnchor().GetAnchorId();
+/*M*/ SwFmtVertOrient aVert( pFmt->GetVertOrient() );
+/*M*/ SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
+/*M*/ const SvxLRSpaceItem &rLR = pFmt->GetLRSpace();
+/*M*/ const SvxULSpaceItem &rUL = pFmt->GetULSpace();
+/*M*/ FASTBOOL bVertChgd = FALSE,
+/*M*/ bHoriChgd = FALSE;
+/*M*/
+/*M*/ //Horizontale und vertikale Positionen werden getrennt berechnet.
+/*M*/ //Sie koennen jeweils Fix oder Variabel (automatisch) sein.
+/*M*/
+/*M*/ //Erst die vertikale Position
+/*M*/ BOOL bVertPrt = aVert.GetRelationOrient() == PRTAREA ||
+/*M*/ aVert.GetRelationOrient() == REL_PG_PRTAREA;
+/*M*/ if ( aVert.GetVertOrient() == VERT_NONE )
+/*M*/ {
+/*M*/ SwTwips nYPos = aVert.GetPos();
+/*M*/ if ( bVertPrt )
+/*M*/ {
+/*M*/ nYPos += (GetAnchor()->*fnRect->fnGetTopMargin)();
+/*M*/ if( GetAnchor()->IsPageFrm() && !bVert )
+/*M*/ {
+/*M*/ SwFrm* pPrtFrm = ((SwPageFrm*)GetAnchor())->Lower();
+/*M*/ if( pPrtFrm && pPrtFrm->IsHeaderFrm() )
+/*M*/ nYPos += (pPrtFrm->Frm().*fnRect->fnGetHeight)();
+/*M*/ }
+/*M*/ }
+/*M*/ if( nYPos < 0 )
+/*M*/ #ifdef AMA_OUT_OF_FLY
+/*M*/ if( !bFlyAtFly )
+/*M*/ #endif
+/*M*/ nYPos = 0;
+/*M*/ if( bVert )
+/*M*/ {
+/*M*/ aRelPos.X() = bRev ? nYPos : -nYPos;
+/*M*/ aRelPos.X() -= Frm().Width();
+/*M*/ }
+/*M*/ else
+/*M*/ aRelPos.Y() = nYPos;
+/*M*/ }
+/*M*/ else
+/*M*/ { //Zuerst den Bezugsrahmen festlegen (PrtArea oder Frame)
+/*M*/ SwTwips nRel, nAdd;
+/*M*/ if ( bVertPrt )
+/*M*/ { nRel = (GetAnchor()->Prt().*fnRect->fnGetHeight)();
+/*M*/ nAdd = (GetAnchor()->*fnRect->fnGetTopMargin)();
+/*M*/ if( GetAnchor()->IsPageFrm() && !bVert )
+/*M*/ {
+/*M*/ // Wenn wir am SeitenTextBereich ausgerichtet sind,
+/*M*/ // sollen Kopf- und Fusszeilen _nicht_ mit zaehlen.
+/*M*/ SwFrm* pPrtFrm = ((SwPageFrm*)GetAnchor())->Lower();
+/*M*/ while( pPrtFrm )
+/*M*/ {
+/*M*/ if( pPrtFrm->IsHeaderFrm() )
+/*M*/ {
+/*M*/ nRel -= pPrtFrm->Frm().Height();
+/*M*/ nAdd += pPrtFrm->Frm().Height();
+/*M*/ }
+/*M*/ else if( pPrtFrm->IsFooterFrm() )
+/*M*/ nRel -= pPrtFrm->Frm().Height();
+/*M*/ pPrtFrm = pPrtFrm->GetNext();
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ { nRel = (GetAnchor()->Frm().*fnRect->fnGetHeight)();
+/*M*/ nAdd = 0;
+/*M*/ }
+/*M*/ // Bei rahmengebunden Rahmen wird nur vertikal unten oder zentriert
+/*M*/ // ausgerichtet, wenn der Text durchlaeuft oder der Anker eine feste
+/*M*/ // Hoehe besitzt.
+/*M*/ SwTwips nRelPosY;
+/*M*/ SwTwips nFrmHeight = (aFrm.*fnRect->fnGetHeight)();
+/*M*/ if( bFlyAtFly && VERT_TOP != aVert.GetVertOrient() &&
+/*M*/ SURROUND_THROUGHT != pFmt->GetSurround().GetSurround() &&
+/*M*/ !GetAnchor()->HasFixSize() )
+/*M*/ nRelPosY = bVert ? rLR.GetRight() : rUL.GetUpper();
+/*M*/ else if ( aVert.GetVertOrient() == VERT_CENTER )
+/*M*/ nRelPosY = (nRel / 2) - (nFrmHeight / 2);
+/*M*/ else if ( aVert.GetVertOrient() == VERT_BOTTOM )
+/*M*/ nRelPosY = nRel - ( nFrmHeight +
+/*M*/ ( bVert ? rLR.GetLeft() : rUL.GetLower() ) );
+/*M*/ else
+/*M*/ nRelPosY = bVert ? rLR.GetRight() : rUL.GetUpper();
+/*M*/ nRelPosY += nAdd;
+/*M*/ if( bVert )
+/*M*/ nRelPosY += nFrmHeight;
+/*M*/
+/*M*/ if ( aVert.GetPos() != nRelPosY )
+/*M*/ { aVert.SetPos( nRelPosY );
+/*M*/ bVertChgd = TRUE;
+/*M*/ }
+/*M*/ if( bVert )
+/*M*/ {
+/*M*/ if( !bRev )
+/*M*/ nRelPosY = - nRelPosY;
+/*M*/ aRelPos.X() = nRelPosY;
+/*M*/ }
+/*M*/ else
+/*M*/ aRelPos.Y() = nRelPosY;
+/*M*/ }
+/*M*/
+/*M*/ //Fuer die Hoehe der Seiten im Browser muessen wir etwas tricksen. Das
+/*M*/ //Grow muessen wir auf den Body rufen; wegen ggf. eingeschalteter
+/*M*/ //Kopfzeilen und weil die Seite sowieso eine fix-Hoehe hat.
+/*M*/ if ( !bFlyAtFly && GetFmt()->GetDoc()->IsBrowseMode() &&
+/*M*/ GetAnchor()->IsPageFrm() ) //Was sonst?
+/*M*/ {
+/*M*/ const long nAnchorBottom = GetAnchor()->Frm().Bottom();
+/*M*/ const long nBottom = GetAnchor()->Frm().Top() + aRelPos.Y() + Frm().Height();
+/*M*/ if ( nAnchorBottom < nBottom )
+/*M*/ {
+/*M*/ ((SwPageFrm*)GetAnchor())->FindBodyCont()->
+/*M*/ Grow( nBottom - nAnchorBottom PHEIGHT );
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/
+/*M*/ //Jetzt die Horizontale Position
+/*M*/ const BOOL bToggle = aHori.IsPosToggle()&&!FindPageFrm()->OnRightPage();
+/*M*/ BOOL bTmpToggle = bToggle;
+/*M*/ //und wieder erst der Bezugsrahmen
+/*M*/ SwTwips nRel, nAdd;
+/*M*/ SwHoriOrient eHOri = aHori.GetHoriOrient();
+/*M*/ if( bToggle )
+/*M*/ {
+/*M*/ if( HORI_RIGHT == eHOri )
+/*M*/ eHOri = HORI_LEFT;
+/*M*/ else if( HORI_LEFT == eHOri )
+/*M*/ eHOri = HORI_RIGHT;
+/*M*/ }
+/*M*/ switch ( aHori.GetRelationOrient() )
+/*M*/ {
+/*M*/ case PRTAREA:
+/*M*/ case REL_PG_PRTAREA:
+/*M*/ {
+/*M*/ nRel = (GetAnchor()->Prt().*fnRect->fnGetWidth)();
+/*M*/ nAdd = (GetAnchor()->*fnRect->fnGetLeftMargin)();
+/*M*/ break;
+/*M*/ }
+/*M*/ case REL_PG_LEFT:
+/*M*/ case REL_FRM_LEFT:
+/*M*/ bTmpToggle = !bToggle;
+/*M*/ // kein break;
+/*M*/ case REL_PG_RIGHT:
+/*M*/ case REL_FRM_RIGHT:
+/*M*/ {
+/*M*/ if ( bTmpToggle ) // linker Seitenrand
+/*M*/ {
+/*M*/ nRel = (GetAnchor()->*fnRect->fnGetLeftMargin)();
+/*M*/ nAdd = 0;
+/*M*/ }
+/*M*/ else // rechter Seitenrand
+/*M*/ {
+/*M*/ nRel = (GetAnchor()->Frm().*fnRect->fnGetWidth)();
+/*M*/ nAdd = (GetAnchor()->Prt().*fnRect->fnGetRight)();
+/*M*/ nRel -= nAdd;
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/ default:
+/*M*/ {
+/*M*/ nRel = (GetAnchor()->Frm().*fnRect->fnGetWidth)();
+/*M*/ nAdd = 0;
+/*M*/ break;
+/*M*/ }
+/*M*/ }
+/*M*/ SwTwips nFrmWidth = (Frm().*fnRect->fnGetWidth)();
+/*M*/ if( bRev )
+/*M*/ {
+/*M*/ nFrmWidth = -nFrmWidth;
+/*M*/ nRel = -nRel;
+/*M*/ nAdd = -nAdd;
+/*M*/ }
+/*M*/ SwTwips nRelX;
+/*M*/ if ( aHori.GetHoriOrient() == HORI_NONE )
+/*M*/ {
+/*M*/ if( bToggle ||
+/*M*/ ( !aHori.IsPosToggle() && GetAnchor()->IsRightToLeft() ) )
+/*M*/ nRelX = nRel - nFrmWidth - aHori.GetPos();
+/*M*/ else
+/*M*/ nRelX = aHori.GetPos();
+/*M*/ }
+/*M*/ else if ( HORI_CENTER == eHOri )
+/*M*/ nRelX = (nRel / 2) - (nFrmWidth / 2);
+/*M*/ else if ( HORI_RIGHT == eHOri )
+/*M*/ nRelX = nRel - ( nFrmWidth +
+/*M*/ ( bVert ? rUL.GetLower() : rLR.GetRight() ) );
+/*M*/ else
+/*M*/ nRelX = bVert ? rUL.GetUpper() : rLR.GetLeft();
+/*M*/ nRelX += nAdd;
+/*M*/
+/*M*/ if( ( nRelX < 0 ) != bRev )
+/*M*/ nRelX = 0;
+/*M*/ if( bVert )
+/*M*/ aRelPos.Y() = nRelX;
+/*M*/ else
+/*M*/ aRelPos.X() = nRelX;
+/*M*/ if ( HORI_NONE != aHori.GetHoriOrient() &&
+/*M*/ aHori.GetPos() != nRelX )
+/*M*/ { aHori.SetPos( nRelX );
+/*M*/ bHoriChgd = TRUE;
+/*M*/ }
+/*M*/ //Die Absolute Position ergibt sich aus der absoluten Position des
+/*M*/ //Ankers plus der relativen Position.
+/*M*/ aFrm.Pos( aRelPos );
+/*M*/ aFrm.Pos() += (GetAnchor()->Frm().*fnRect->fnGetPos)();
+/*M*/
+/*M*/ //Und ggf. noch die aktuellen Werte im Format updaten, dabei darf
+/*M*/ //zu diesem Zeitpunkt natuerlich kein Modify verschickt werden.
+/*M*/ pFmt->LockModify();
+/*M*/ if ( bVertChgd )
+/*M*/ pFmt->SetAttr( aVert );
+/*M*/ if ( bHoriChgd )
+/*M*/ pFmt->SetAttr( aHori );
+/*M*/ pFmt->UnlockModify();
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::MakePrtArea()
+|*
+|* Ersterstellung MA 23. Jun. 93
+|* Letzte Aenderung MA 23. Jun. 93
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
+/*N*/ {
+/*N*/
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ bValidPrtArea = TRUE;
+/*N*/
+/*N*/ //Position einstellen.
+/*N*/ aPrt.Left( rAttrs.CalcLeftLine() );
+/*N*/ aPrt.Top ( rAttrs.CalcTopLine() );
+/*N*/
+/*N*/ //Sizes einstellen; die Groesse gibt der umgebende Frm vor, die
+/*N*/ //die Raender werden einfach abgezogen.
+/*N*/ aPrt.Width ( aFrm.Width() - (rAttrs.CalcRightLine() + aPrt.Left()) );
+/*N*/ aPrt.Height( aFrm.Height()- (aPrt.Top() + rAttrs.CalcBottomLine()));
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::_Grow(), _Shrink()
+|*
+|* Ersterstellung MA 05. Oct. 92
+|* Letzte Aenderung MA 05. Sep. 96
+|*
+|*************************************************************************/
+
+/*N*/ SwTwips SwFlyFrm::_Grow( SwTwips nDist, BOOL bTst )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ if ( Lower() && !IsColLocked() && !HasFixSize() )
+/*N*/ {
+/*N*/ SwTwips nSize = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nSize > 0 && nDist > ( LONG_MAX - nSize ) )
+/*?*/ nDist = LONG_MAX - nSize;
+/*N*/
+/*N*/ if ( nDist <= 0L )
+/*?*/ return 0L;
+/*N*/
+/*N*/ if ( Lower()->IsColumnFrm() )
+/*N*/ { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
+/*N*/ //das Wachstum (wg. des Ausgleichs).
+/*N*/ if ( !bTst )
+/*N*/ { _InvalidatePos();
+/*N*/ InvalidateSize();
+/*N*/ }
+/*N*/ return 0L;
+/*N*/ }
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ const SwRect aOld( AddSpacesToFrm() );
+/*N*/ _InvalidateSize();
+/*N*/ const BOOL bOldLock = bLocked;
+/*N*/ Unlock();
+/*N*/ if ( IsFlyFreeFrm() )
+/*N*/ ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll();
+/*N*/ else
+/*N*/ MakeAll();
+/*N*/ _InvalidateSize();
+/*N*/ InvalidatePos();
+/*N*/ if ( bOldLock )
+/*?*/ Lock();
+/*N*/ const SwRect aNew( AddSpacesToFrm() );
+/*N*/ if ( aOld != aNew )
+/*N*/ ::binfilter::Notify( this, FindPageFrm(), aOld );
+/*N*/ return (aNew.*fnRect->fnGetHeight)()-(aOld.*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/ return nDist;
+/*N*/ }
+/*N*/ return 0L;
+/*N*/ }
+
+/*M*/ SwTwips SwFlyFrm::_Shrink( SwTwips nDist, BOOL bTst )
+/*M*/ {
+/*M*/ if( Lower() && !IsColLocked() && !HasFixSize() && !IsNoShrink() )
+/*M*/ {
+/*M*/ SWRECTFN( this )
+/*M*/ SwTwips nHeight = (Frm().*fnRect->fnGetHeight)();
+/*M*/ if ( nDist > nHeight )
+/*M*/ nDist = nHeight;
+/*M*/
+/*M*/ SwTwips nVal = nDist;
+/*M*/ if ( IsMinHeight() )
+/*M*/ {
+/*M*/ const SwFmtFrmSize& rFmtSize = GetFmt()->GetFrmSize();
+/*M*/ SwTwips nFmtHeight = bVert ? rFmtSize.GetWidth() : rFmtSize.GetHeight();
+/*M*/
+/*M*/ nVal = Min( nDist, nHeight - nFmtHeight );
+/*M*/ }
+/*M*/
+/*M*/ if ( nVal <= 0L )
+/*M*/ return 0L;
+/*M*/
+/*M*/ if ( Lower()->IsColumnFrm() )
+/*M*/ { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
+/*M*/ //das Wachstum (wg. des Ausgleichs).
+/*M*/ if ( !bTst )
+/*M*/ {
+/*M*/ SwRect aOld( AddSpacesToFrm() );
+/*M*/ (Frm().*fnRect->fnSetHeight)( nHeight - nVal );
+/*M*/ nHeight = (Prt().*fnRect->fnGetHeight)();
+/*M*/ (Prt().*fnRect->fnSetHeight)( nHeight - nVal );
+/*M*/ _InvalidatePos();
+/*M*/ InvalidateSize();
+/*M*/ ::binfilter::Notify( this, FindPageFrm(), aOld );
+/*M*/ NotifyDrawObj();
+/*M*/ if ( GetAnchor()->IsInFly() )
+/*M*/ GetAnchor()->FindFlyFrm()->Shrink( nDist, bTst );
+/*M*/ }
+/*M*/ return 0L;
+/*M*/ }
+/*M*/
+/*M*/ if ( !bTst )
+/*M*/ {
+/*M*/ const SwRect aOld( AddSpacesToFrm() );
+/*M*/ _InvalidateSize();
+/*M*/ const BOOL bOldLocked = bLocked;
+/*M*/ Unlock();
+/*M*/ if ( IsFlyFreeFrm() )
+/*M*/ ((SwFlyFreeFrm*)this)->SwFlyFreeFrm::MakeAll();
+/*M*/ else
+/*M*/ MakeAll();
+/*M*/ _InvalidateSize();
+/*M*/ InvalidatePos();
+/*M*/ if ( bOldLocked )
+/*M*/ Lock();
+/*M*/ const SwRect aNew( AddSpacesToFrm() );
+/*M*/ if ( aOld != aNew )
+/*M*/ {
+/*M*/ ::binfilter::Notify( this, FindPageFrm(), aOld );
+/*M*/ if ( GetAnchor()->IsInFly() )
+/*M*/ GetAnchor()->FindFlyFrm()->Shrink( nDist, bTst );
+/*M*/ }
+/*M*/ return (aOld.*fnRect->fnGetHeight)() -
+/*M*/ (aNew.*fnRect->fnGetHeight)();
+/*M*/ }
+/*M*/ return nVal;
+/*M*/ }
+/*M*/ return 0L;
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::ChgSize()
+|*
+|* Ersterstellung MA 05. Oct. 92
+|* Letzte Aenderung MA 04. Sep. 96
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::ChgSize( const Size& aNewSize )
+/*N*/ {
+/*N*/ if ( aNewSize != Frm().SSize() )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = GetFmt();
+/*N*/ SwFmtFrmSize aSz( pFmt->GetFrmSize() );
+/*N*/ aSz.SetWidth( aNewSize.Width() );
+/*N*/ if ( Abs(aNewSize.Height() - aSz.GetHeight()) > 1 )
+/*N*/ aSz.SetHeight( aNewSize.Height() );
+/*N*/ // uebers Doc fuers Undo!
+/*N*/ pFmt->GetDoc()->SetAttr( aSz, *pFmt );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::IsLowerOf()
+|*
+|* Ersterstellung MA 27. Dec. 93
+|* Letzte Aenderung MA 27. Dec. 93
+|*
+|*************************************************************************/
+
+/*N*/ BOOL SwFlyFrm::IsLowerOf( const SwLayoutFrm *pUpper ) const
+/*N*/ {
+/*N*/ ASSERT( GetAnchor(), "8-( Fly is lost in Space." );
+/*N*/ const SwFrm *pFrm = GetAnchor();
+/*N*/ do
+/*N*/ { if ( pFrm == pUpper )
+/*N*/ return TRUE;
+/*N*/ pFrm = pFrm->IsFlyFrm() ? ((const SwFlyFrm*)pFrm)->GetAnchor() :
+/*N*/ pFrm->GetUpper();
+/*N*/ } while ( pFrm );
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::Cut()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 23. Feb. 94
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::Cut()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::AppendFly(), RemoveFly()
+|*
+|* Ersterstellung MA 25. Aug. 92
+|* Letzte Aenderung MA 09. Jun. 95
+|*
+|*************************************************************************/
+
+/*N*/ void SwFrm::AppendFly( SwFlyFrm *pNew )
+/*N*/ {
+/*N*/ if ( !pDrawObjs )
+/*N*/ pDrawObjs = new SwDrawObjs();
+/*N*/ SdrObject *pObj = pNew->GetVirtDrawObj();
+/*N*/ pDrawObjs->Insert( pObj, pDrawObjs->Count() );
+/*N*/ pNew->ChgAnchor( this );
+/*N*/
+/*N*/ //Bei der Seite anmelden; kann sein, dass noch keine da ist - die
+/*N*/ //Anmeldung wird dann in SwPageFrm::PreparePage durch gefuehrt.
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( pPage )
+/*N*/ {
+/*N*/ if ( pNew->IsFlyAtCntFrm() && pNew->Frm().Top() == WEIT_WECH )
+/*N*/ {
+/*N*/ //Versuch die Seitenformatierung von neuen Dokumenten etwas
+/*N*/ //guenstiger zu gestalten.
+/*N*/ //Wir haengen die Flys erstenmal nach hinten damit sie bei heftigem
+/*N*/ //Fluss der Anker nicht unoetig oft formatiert werden.
+/*N*/ //Damit man noch brauchbar an das Ende des Dokumentes springen
+/*N*/ //kann werden die Flys nicht ganz an das Ende gehaengt.
+/*N*/ SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
+/*N*/ if( !SwLayHelper::CheckPageFlyCache( pPage, pNew ) )
+/*N*/ {
+/*N*/ SwPageFrm *pTmp = pRoot->GetLastPage();
+/*N*/ if ( pTmp->GetPhyPageNum() > 30 )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < 10; ++i )
+/*N*/ {
+/*N*/ pTmp = (SwPageFrm*)pTmp->GetPrev();
+/*N*/ if( pTmp->GetPhyPageNum() <= pPage->GetPhyPageNum() )
+/*N*/ break; // damit wir nicht vor unserem Anker landen
+/*N*/ }
+/*N*/ if ( pTmp->IsEmptyPage() )
+/*?*/ pTmp = (SwPageFrm*)pTmp->GetPrev();
+/*N*/ pPage = pTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ pPage->SwPageFrm::AppendFly( pNew );
+/*N*/ }
+/*N*/ else
+/*N*/ pPage->SwPageFrm::AppendFly( pNew );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwFrm::RemoveFly( SwFlyFrm *pToRemove )
+/*N*/ {
+/*N*/ //Bei der Seite Abmelden - kann schon passiert sein weil die Seite
+/*N*/ //bereits destruiert wurde.
+/*N*/ SwPageFrm *pPage = pToRemove->FindPageFrm();
+/*N*/ if ( pPage && pPage->GetSortedObjs() )
+/*N*/ pPage->SwPageFrm::RemoveFly( pToRemove );
+/*N*/
+/*N*/ const SdrObjectPtr pObj = pToRemove->GetVirtDrawObj();
+/*N*/ pDrawObjs->Remove( pDrawObjs->GetPos( pObj ) );
+/*N*/ if ( !pDrawObjs->Count() )
+/*N*/ DELETEZ( pDrawObjs );
+/*N*/
+/*N*/ pToRemove->ChgAnchor( 0 );
+/*N*/
+/*N*/ if ( !pToRemove->IsFlyInCntFrm() && GetUpper() && IsInTab() )//MA_FLY_HEIGHT
+/*?*/ GetUpper()->InvalidateSize();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::AppendDrawObj(), RemoveDrawObj()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 26. Jun. 95
+|*
+|*************************************************************************/
+
+void SwFrm::AppendDrawObj( SwDrawContact *pNew )
+{
+ if ( pNew->GetAnchor() && pNew->GetAnchor() != this )
+ pNew->DisconnectFromLayout( false );
+
+ SdrObject* pObj = pNew->GetMaster();
+ if ( pNew->GetAnchor() != this )
+ {
+ if ( !pDrawObjs )
+ pDrawObjs = new SwDrawObjs();
+ pDrawObjs->Insert( pObj, pDrawObjs->Count() );
+ pNew->ChgAnchor( this );
+ }
+
+ const SwFmtAnchor &rAnch = pNew->GetFmt()->GetAnchor();
+ if( FLY_AUTO_CNTNT == rAnch.GetAnchorId() )
+ {
+ SwRect aTmpRect;
+ SwPosition *pPos = (SwPosition*)rAnch.GetCntntAnchor();
+ if ( IsValid() )
+ GetCharRect( aTmpRect, *pPos );
+ else
+ aTmpRect = Frm();
+ pNew->GetMaster()->SetAnchorPos( aTmpRect.Pos() );
+ }
+ else if( FLY_IN_CNTNT != rAnch.GetAnchorId() )
+ {
+ pNew->GetMaster()->SetAnchorPos( GetFrmAnchorPos( ::binfilter::HasWrap( pNew->GetMaster() ) ) );
+ }
+
+ // OD 27.06.2003 #108784# - move 'master' drawing object to visible layer
+ {
+ SwDoc* pDoc = pNew->GetFmt()->GetDoc();
+ if ( pDoc )
+ {
+ if ( !pDoc->IsVisibleLayerId( pObj->GetLayer() ) )
+ {
+ pObj->SetLayer( pDoc->GetVisibleLayerIdByInvisibleOne( pObj->GetLayer() ) );
+ }
+ }
+ }
+
+ //Bei der Seite anmelden; kann sein, dass noch keine da ist - die
+ //Anmeldung wird dann in SwPageFrm::PreparePage durch gefuehrt.
+ SwPageFrm *pPage = FindPageFrm();
+ if ( pPage )
+ pPage->SwPageFrm::AppendDrawObj( pNew );
+
+#ifdef ACCESSIBLE_LAYOUT
+ // Notify accessible layout.
+ ViewShell* pSh = GetShell();
+ if( pSh && pSh->GetLayout()->IsAnyShellAccessible() )
+ pSh->Imp()->AddAccessibleObj( pNew->GetMaster() );
+#endif
+}
+
+// OD 20.05.2003 #108784# - add 'virtual' drawing object to frame.
+void SwFrm::AppendVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj )
+{
+ if ( _pDrawVirtObj->GetAnchorFrm() != this )
+ {
+ if ( !pDrawObjs )
+ pDrawObjs = new SwDrawObjs();
+ pDrawObjs->Insert( _pDrawVirtObj, pDrawObjs->Count() );
+ _pDrawVirtObj->SetAnchorFrm( this );
+ }
+
+ // positioning of 'virtual' drawing object.
+ const SwFmtAnchor &rAnch = _pDrawContact->GetFmt()->GetAnchor();
+ switch ( rAnch.GetAnchorId() )
+ {
+ case FLY_AUTO_CNTNT:
+ {
+ ASSERT( false,
+ "<SwFrm::AppendVirtDrawObj(..)> - at character anchored drawing objects aren't supported." );
+ }
+ break;
+ case FLY_PAGE:
+ case FLY_AT_CNTNT:
+ case FLY_AT_FLY:
+ {
+ // set anchor position
+ _pDrawVirtObj->NbcSetAnchorPos( GetFrmAnchorPos( ::binfilter::HasWrap( _pDrawVirtObj ) ) );
+ // set offset in relation to reference object
+ Point aOffset = GetFrmAnchorPos( ::binfilter::HasWrap( _pDrawVirtObj ) ) -
+ _pDrawContact->GetAnchor()->GetFrmAnchorPos( ::binfilter::HasWrap( _pDrawVirtObj ) );
+ _pDrawVirtObj->SetOffset( aOffset );
+ // correct relative position at 'virtual' drawing object
+ _pDrawVirtObj->AdjustRelativePosToReference();
+ }
+ break;
+ case FLY_IN_CNTNT:
+ {
+ /*nothing to do*/;
+ }
+ break;
+ default: ASSERT( false, "<SwFrm::AppendVirtDrawObj(..) - unknown anchor type." );
+ }
+
+ //Bei der Seite anmelden; kann sein, dass noch keine da ist - die
+ //Anmeldung wird dann in SwPageFrm::PreparePage durch gefuehrt.
+ SwPageFrm *pPage = FindPageFrm();
+ if ( pPage )
+ {
+ pPage->SwPageFrm::AppendVirtDrawObj( _pDrawContact, _pDrawVirtObj );
+ }
+
+ // Notify accessible layout.
+ ViewShell* pSh = GetShell();
+ if( pSh && pSh->GetLayout()->IsAnyShellAccessible() )
+ {
+ pSh->Imp()->AddAccessibleObj( _pDrawVirtObj );
+ }
+}
+
+/*N*/ void SwFrm::RemoveDrawObj( SwDrawContact *pToRemove )
+/*N*/ {
+/*N*/ //Bei der Seite Abmelden - kann schon passiert sein weil die Seite
+/*N*/ //bereits destruiert wurde.
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // Notify accessible layout.
+/*N*/ ViewShell* pSh = GetShell();
+/*N*/ if( pSh && pSh->GetLayout()->IsAnyShellAccessible() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pSh->Imp()->DisposeAccessibleObj( pToRemove->GetMaster() );
+/*N*/ #endif
+/*N*/ SwPageFrm *pPage = pToRemove->GetPage();
+/*N*/ if ( pPage && pPage->GetSortedObjs() )
+/*N*/ pPage->SwPageFrm::RemoveDrawObj( pToRemove );
+/*N*/
+/*N*/ SdrObject *pObj = pToRemove->GetMaster();
+/*N*/ pDrawObjs->Remove( pDrawObjs->GetPos( pObj ) );
+/*N*/ if ( !pDrawObjs->Count() )
+/*N*/ DELETEZ( pDrawObjs );
+/*N*/
+/*N*/ pToRemove->ChgAnchor( 0 );
+/*N*/ }
+
+// OD 20.05.2003 #108784# - remove 'virtual' drawing object from frame.
+void SwFrm::RemoveVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj )
+{
+ // Notify accessible layout.
+ ViewShell* pSh = GetShell();
+ if( pSh && pSh->GetLayout()->IsAnyShellAccessible() )
+ {
+ pSh->Imp()->DisposeAccessibleObj( _pDrawVirtObj );
+ }
+
+ SwPageFrm *pPage = _pDrawVirtObj->GetPageFrm();
+ if ( pPage && pPage->GetSortedObjs() )
+ {
+ pPage->SwPageFrm::RemoveVirtDrawObj( _pDrawContact, _pDrawVirtObj );
+ }
+
+ pDrawObjs->Remove( pDrawObjs->GetPos( _pDrawVirtObj ) );
+ if ( !pDrawObjs->Count() )
+ DELETEZ( pDrawObjs );
+
+ _pDrawVirtObj->SetAnchorFrm( 0 );
+}
+
+/*************************************************************************
+|*
+|* SwFrm::CalcFlys()
+|*
+|* Ersterstellung MA 29. Nov. 96
+|* Letzte Aenderung MA 29. Nov. 96
+|*
+|*************************************************************************/
+
+/*N*/ void lcl_MakeFlyPosition( SwFlyFrm *pFly )
+/*N*/ {
+/*N*/ if( pFly->IsFlyFreeFrm() )
+/*N*/ {
+/*N*/ ((SwFlyFreeFrm*)pFly)->SwFlyFreeFrm::MakeAll();
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*?*/ BOOL bOldLock = pFly->IsLocked();
+/*?*/ pFly->Lock();
+/*?*/ SwFlyNotify aNotify( pFly );
+/*?*/ pFly->MakeFlyPos();
+/*?*/ if( !bOldLock )
+/*?*/ pFly->Unlock();
+/*N*/ }
+
+void SwFrm::CalcFlys( BOOL bPosOnly )
+{
+ if ( GetDrawObjs() )
+ {
+ USHORT nCnt = GetDrawObjs()->Count();
+ for ( USHORT i = 0; i < nCnt; ++i )
+ {
+ SdrObject *pO = (*GetDrawObjs())[i];
+ if ( pO->IsWriterFlyFrame() )
+ {
+ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+ // Bei autopositionierten (am Zeichen geb.) Rahmen vertrauen wir
+ // darauf, dass die Positionierung vom SwTxtFrm::Format vorgenommen
+ // wird. Wenn wir sie dagegen hier kalkulieren wuerden, fuehrt es
+ // zur Endlosschleife in Bug 50796.
+ if ( pFly->IsFlyInCntFrm() )
+ continue;
+ if( pFly->IsAutoPos() )
+ {
+ if( bPosOnly )
+ {
+ pFly->_Invalidate();
+ pFly->_InvalidatePos();
+ }
+ continue;
+ }
+ pFly->_Invalidate();
+ pFly->_InvalidatePos();
+
+ if ( bPosOnly && pFly->GetValidSizeFlag() && pFly->GetValidPrtAreaFlag() )
+ ::binfilter::lcl_MakeFlyPosition( pFly );
+ else
+ {
+ if ( !bPosOnly )
+ pFly->_InvalidateSize();
+ pFly->Calc();
+ }
+ if ( !GetDrawObjs() )
+ break;
+ if ( GetDrawObjs()->Count() < nCnt )
+ {
+ --i;
+ --nCnt;
+ }
+ }
+ else
+ {
+ // assumption: <pO> is a drawing object.
+ SwFrmFmt *pFrmFmt = ::binfilter::FindFrmFmt( pO );
+ if( !pFrmFmt ||
+ FLY_IN_CNTNT != pFrmFmt->GetAnchor().GetAnchorId() )
+ {
+ // change anchor position
+ pO->SetAnchorPos( GetFrmAnchorPos( ::binfilter::HasWrap( pO ) ) );
+ // OD 19.06.2003 #108784# - correct relative position of
+ // <SwDrawVirtObj>-objects to reference object.
+ if ( pO->ISA(SwDrawVirtObj) )
+ {
+ static_cast<SwDrawVirtObj*>(pO)->AdjustRelativePosToReference();
+ }
+ else
+ {
+ if ( GetValidPosFlag() )
+ {
+ SwPageFrm* pPage = FindPageFrm();
+ if ( pPage && ! pPage->IsInvalidLayout() )
+ {
+ // check if the new position
+ // would not exceed the margins of the page
+ CaptureDrawObj( *pO, pPage->Frm() );
+ }
+ }
+
+ ((SwDrawContact*)GetUserCall(pO))->ChkPage();
+
+ // OD 27.06.2003 #108784# - correct movement of 'virtual'
+ // drawing objects caused by the <SetAnchorPos(..)>
+ // of the 'master' drawing object.
+ SwDrawContact* pDrawContact =
+ static_cast<SwDrawContact*>(pO->GetUserCall());
+ if ( pDrawContact )
+ {
+ pDrawContact->CorrectRelativePosOfVirtObjs();
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::NotifyFlys()
+|*
+|* Ersterstellung MA 18. Feb. 94
+|* Letzte Aenderung MA 26. Jun. 96
+|*
+|*************************************************************************/
+
+/*N*/ void SwLayoutFrm::NotifyFlys()
+/*N*/ {
+/*N*/ //Sorgt dafuer, dass untergeordnete Flys pruefen, ob sich sich an
+/*N*/ //die Verhaeltnisse anpassen muessen.
+/*N*/
+/*N*/ //Wenn mehr Platz da ist muessen die Positionen und Sizes der
+/*N*/ //Flys berechnet werden, denn es koennte sein, das sie kuenstlich
+/*N*/ //geschrumpft/vershoben wurden und jetzt wieder naeher an ihre
+/*N*/ //Sollwerte gehen duerfen.
+/*N*/ //Ist weniger Platz da, so reicht es wenn sie in das MakeAll laufen
+/*N*/ //der preiswerteste Weg dazu ist die Invalidierung der PrtArea.
+/*N*/
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( pPage && pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ //Die Seite nur einmal antriggern.
+/*N*/ FASTBOOL bPageInva = TRUE;
+/*N*/
+/*N*/ SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*N*/ const BOOL bHeadFoot = IsHeaderFrm() || IsFooterFrm();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/
+/*N*/ if ( pFly->Frm().Left() == WEIT_WECH )
+/*N*/ continue;
+/*N*/
+/*N*/ //Wenn der Fly nicht irgendwo ausserhalb liegt braucht er nur
+/*N*/ //nur benachrichtigt werden, wenn er geclipped ist.
+/*N*/ // Bei Header/Footer keine Abkuerzung, denn hier muesste die
+/*N*/ // die PrtArea geprueft werden, die zu diesem Zeitpunkt
+/*N*/ // (ShrinkFrm) noch nicht angepasst ist.
+/*N*/ if( ( !bHeadFoot && Frm().IsInside( pFly->Frm() )
+/*N*/ && !pFly->IsClipped() ) || pFly->IsAnLower( this ) )
+/*N*/ continue;
+/*N*/
+/*N*/ const BOOL bLow = pFly->IsLowerOf( this );
+/*N*/ if ( bLow || pFly->GetAnchor()->FindPageFrm() != pPage )
+/*N*/ {
+/*N*/ pFly->_Invalidate( pPage );
+/*N*/ if ( !bLow || pFly->IsFlyAtCntFrm() )
+/*N*/ pFly->_InvalidatePos();
+/*N*/ else
+/*?*/ pFly->_InvalidatePrt();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::NotifyDrawObj()
+|*
+|* Ersterstellung OK 22. Nov. 94
+|* Letzte Aenderung MA 10. Jan. 97
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFrm::NotifyDrawObj()
+/*N*/ {
+/*N*/ pDrawObj->SetRect();
+/*N*/ pDrawObj->_SetRectsDirty();
+/*N*/ pDrawObj->SetChanged();
+/*N*/ pDrawObj->SendRepaintBroadcast( TRUE ); //Broadcast ohne Repaint!
+/*N*/ if ( GetFmt()->GetSurround().IsContour() )
+/*?*/ ClrContourCache( pDrawObj );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::CalcRel()
+|*
+|* Ersterstellung MA 13. Jun. 96
+|* Letzte Aenderung MA 10. Oct. 96
+|*
+|*************************************************************************/
+
+/*N*/ Size SwFlyFrm::CalcRel( const SwFmtFrmSize &rSz ) const
+/*N*/ {
+/*N*/ Size aRet( rSz.GetSize() );
+/*N*/
+/*N*/ const SwFrm *pRel = IsFlyLayFrm() ? GetAnchor() : GetAnchor()->GetUpper();
+/*N*/ if( pRel ) // LAYER_IMPL
+/*N*/ {
+/*N*/ long nRelWidth = LONG_MAX, nRelHeight = LONG_MAX;
+/*N*/ const ViewShell *pSh = GetShell();
+/*N*/ if ( ( pRel->IsBodyFrm() || pRel->IsPageFrm() ) &&
+/*N*/ GetFmt()->GetDoc()->IsBrowseMode() &&
+/*N*/ pSh && pSh->VisArea().HasArea() )
+/*N*/ {
+/*?*/ nRelWidth = pSh->VisArea().Width();
+/*?*/ nRelHeight = pSh->VisArea().Height();
+/*?*/ const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
+/*?*/ nRelWidth -= 2*aBorder.Width();
+/*?*/ long nDiff = nRelWidth - pRel->Prt().Width();
+/*?*/ if ( nDiff > 0 )
+/*?*/ nRelWidth -= nDiff;
+/*?*/ nRelHeight -= 2*aBorder.Height();
+/*?*/ nDiff = nRelHeight - pRel->Prt().Height();
+/*?*/ if ( nDiff > 0 )
+/*?*/ nRelHeight -= nDiff;
+/*N*/ }
+/*N*/ nRelWidth = Min( nRelWidth, pRel->Prt().Width() );
+/*N*/ nRelHeight = Min( nRelHeight, pRel->Prt().Height() );
+/*N*/ if( !pRel->IsPageFrm() )
+/*N*/ {
+/*N*/ const SwPageFrm* pPage = FindPageFrm();
+/*N*/ if( pPage )
+/*N*/ {
+/*N*/ nRelWidth = Min( nRelWidth, pPage->Prt().Width() );
+/*N*/ nRelHeight = Min( nRelHeight, pPage->Prt().Height() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( rSz.GetWidthPercent() && rSz.GetWidthPercent() != 0xFF )
+/*N*/ aRet.Width() = nRelWidth * rSz.GetWidthPercent() / 100;
+/*N*/ if ( rSz.GetHeightPercent() && rSz.GetHeightPercent() != 0xFF )
+/*N*/ aRet.Height() = nRelHeight * rSz.GetHeightPercent() / 100;
+/*N*/
+/*N*/ if ( rSz.GetWidthPercent() == 0xFF )
+/*N*/ {
+/*?*/ aRet.Width() *= aRet.Height();
+/*?*/ aRet.Width() /= rSz.GetHeight();
+/*N*/ }
+/*N*/ else if ( rSz.GetHeightPercent() == 0xFF )
+/*N*/ {
+/*N*/ aRet.Height() *= aRet.Width();
+/*N*/ aRet.Height() /= rSz.GetWidth();
+/*N*/ }
+/*N*/ }
+/*N*/ return aRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::AddSpacesToFrm
+|*
+|* Ersterstellung MA 11. Nov. 96
+|* Letzte Aenderung MA 10. Mar. 97
+|*
+|*************************************************************************/
+
+/*N*/ SwRect SwFlyFrm::AddSpacesToFrm() const
+/*N*/ {
+/*N*/ SwRect aRect( Frm() );
+/*N*/ const SvxULSpaceItem &rUL = GetFmt()->GetULSpace();
+/*N*/ const SvxLRSpaceItem &rLR = GetFmt()->GetLRSpace();
+/*N*/ aRect.Left( Max( aRect.Left() - long(rLR.GetLeft()), 0L ) );
+/*N*/ aRect.SSize().Width() += rLR.GetRight();
+/*N*/ aRect.Top( Max( aRect.Top() - long(rUL.GetUpper()), 0L ) );
+/*N*/ aRect.SSize().Height()+= rUL.GetLower();
+/*N*/ return aRect;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFrm::GetContour()
+|*
+|* Ersterstellung MA 09. Jan. 97
+|* Letzte Aenderung MA 10. Jan. 97
+|*
+|*************************************************************************/
+/// OD 16.04.2003 #i13147# - If called for paint and the <SwNoTxtFrm> contains
+/// a graphic, load of intrinsic graphic has to be avoided.
+
+BOOL SwFlyFrm::ConvertHoriTo40( SwHoriOrient &rHori, SwRelationOrient &rRel,
+ SwTwips &rPos ) const
+{
+ ASSERT( rHori > PRTAREA, "ConvertHoriTo40: Why?" );
+ if( !GetAnchor() )
+ return FALSE;
+ rHori = HORI_NONE;
+ rRel = FRAME;
+ rPos = Frm().Left() - GetAnchor()->Frm().Left();
+ return TRUE;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_flycnt.cxx b/binfilter/bf_sw/source/core/layout/sw_flycnt.cxx
new file mode 100644
index 000000000000..e91750ea3dde
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_flycnt.cxx
@@ -0,0 +1,2194 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <tools/bigint.hxx>
+#include "pagefrm.hxx"
+#include "rootfrm.hxx"
+
+#include <horiornt.hxx>
+
+#include "txtfrm.hxx"
+#include "doc.hxx"
+#include "pam.hxx"
+#include "frmfmt.hxx"
+#include "frmtool.hxx"
+#include "dflyobj.hxx"
+#include "hints.hxx"
+#include "ndtxt.hxx"
+
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include <fmtsrnd.hxx>
+#include "tabfrm.hxx"
+#include "flyfrms.hxx"
+#include "sectfrm.hxx"
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* SwFlyAtCntFrm::SwFlyAtCntFrm()
+|*
+|* Ersterstellung MA 11. Nov. 92
+|* Letzte Aenderung MA 09. Apr. 99
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyAtCntFrm::SwFlyAtCntFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) :
+/*N*/ SwFlyFreeFrm( pFmt, pAnch )
+/*N*/ {
+/*N*/ bAtCnt = TRUE;
+/*N*/ bAutoPosition = FLY_AUTO_CNTNT == pFmt->GetAnchor().GetAnchorId();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyAtCntFrm::CheckCharRect()
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwFlyAtCntFrm::Modify()
+|*
+|* Ersterstellung MA 08. Feb. 93
+|* Letzte Aenderung MA 23. Nov. 94
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyAtCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ USHORT nWhich = pNew ? pNew->Which() : 0;
+/*N*/ const SwFmtAnchor *pAnch = 0;
+/*N*/ if( RES_ATTRSET_CHG == nWhich && SFX_ITEM_SET ==
+/*N*/ ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_ANCHOR, FALSE,
+/*N*/ (const SfxPoolItem**)&pAnch ))
+/*N*/ ; // Beim GetItemState wird der AnkerPointer gesetzt !
+/*N*/
+/*N*/ else if( RES_ANCHOR == nWhich )
+/*N*/ {
+/*N*/ //Ankerwechsel, ich haenge mich selbst um.
+/*N*/ //Es darf sich nicht um einen Wechsel des Ankertyps handeln,
+/*N*/ //dies ist nur ueber die SwFEShell moeglich.
+/*?*/ pAnch = (const SwFmtAnchor*)pNew;
+/*N*/ }
+/*N*/
+/*N*/ if( pAnch )
+/*N*/ {
+/*N*/ ASSERT( pAnch->GetAnchorId() == GetFmt()->GetAnchor().GetAnchorId(),
+/*N*/ "Unzulaessiger Wechsel des Ankertyps." );
+/*N*/
+/*N*/ //Abmelden, neuen Anker besorgen und 'dranhaengen.
+/*N*/ SwRect aOld( AddSpacesToFrm() );
+/*N*/ SwPageFrm *pOldPage = FindPageFrm();
+/*N*/ const SwFrm *pOldAnchor = GetAnchor();
+/*N*/ SwCntntFrm *pCntnt = (SwCntntFrm*)GetAnchor();
+/*N*/ GetAnchor()->RemoveFly( this );
+/*N*/
+/*N*/ const BOOL bBodyFtn = (pCntnt->IsInDocBody() || pCntnt->IsInFtn());
+/*N*/
+/*N*/ //Den neuen Anker anhand des NodeIdx suchen, am alten und
+/*N*/ //neuen NodeIdx kann auch erkannt werden, in welche Richtung
+/*N*/ //gesucht werden muss.
+/*N*/ const SwNodeIndex aNewIdx( pAnch->GetCntntAnchor()->nNode );
+/*N*/ SwNodeIndex aOldIdx( *pCntnt->GetNode() );
+/*N*/
+/*N*/ //fix: Umstellung, ehemals wurde in der do-while-Schleife nach vorn bzw.
+/*N*/ //nach hinten gesucht; je nachdem wie welcher Index kleiner war.
+/*N*/ //Das kann aber u.U. zu einer Endlosschleife fuehren. Damit
+/*N*/ //wenigstens die Schleife unterbunden wird suchen wir nur in eine
+/*N*/ //Richtung. Wenn der neue Anker nicht gefunden wird koennen wir uns
+/*N*/ //immer noch vom Node einen Frame besorgen. Die Change, dass dies dann
+/*N*/ //der richtige ist, ist gut.
+/*N*/ const FASTBOOL bNext = aOldIdx < aNewIdx;
+/*N*/ while ( pCntnt && aOldIdx != aNewIdx )
+/*N*/ {
+/*N*/ do
+/*N*/ { if ( bNext )
+/*?*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ else
+/*N*/ pCntnt = pCntnt->GetPrevCntntFrm();
+/*N*/ } while ( pCntnt &&
+/*N*/ !(bBodyFtn == (pCntnt->IsInDocBody() ||
+/*N*/ pCntnt->IsInFtn())) );
+/*N*/ if (pCntnt)
+/*N*/ aOldIdx = *pCntnt->GetNode();
+/*N*/ }
+/*N*/ if ( !pCntnt )
+/*N*/ {
+/*?*/ SwCntntNode *pNode = aNewIdx.GetNode().GetCntntNode();
+/*?*/ pCntnt = pNode->GetFrm( &pOldAnchor->Frm().Pos(), 0, FALSE );
+/*?*/ ASSERT( pCntnt, "Neuen Anker nicht gefunden" );
+/*N*/ }
+/*N*/ //Flys haengen niemals an einem Follow sondern immer am
+/*N*/ //Master, den suchen wir uns jetzt.
+/*N*/ const SwFlowFrm *pFlow = pCntnt;
+/*N*/ while ( pFlow->IsFollow() )
+/*?*/ pFlow = pFlow->FindMaster();
+/*N*/ pCntnt = (SwCntntFrm*)pFlow->GetFrm();
+/*N*/
+/*N*/ //und schwupp angehaengt das teil...
+/*N*/ pCntnt->AppendFly( this );
+/*N*/ if ( pOldPage && pOldPage != FindPageFrm() )
+/*N*/ NotifyBackground( pOldPage, aOld, PREP_FLY_LEAVE );
+/*N*/
+/*N*/ //Fix(3495)
+/*N*/ _InvalidatePos();
+/*N*/ InvalidatePage();
+/*N*/ SetNotifyBack();
+/*N*/ }
+/*N*/ else
+/*N*/ SwFlyFrm::Modify( pOld, pNew );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyAtCntFrm::MakeAll()
+|*
+|* Beschreibung Bei einem Absatzgebunden Fly kann es durchaus sein,
+|* das der Anker auf die Veraenderung des Flys reagiert. Auf diese
+|* Reaktion hat der Fly natuerlich auch wieder zu reagieren.
+|* Leider kann dies zu Oszillationen fuehren z.b. Der Fly will nach
+|* unten, dadurch kann der Inhalt nach oben, der TxtFrm wird kleiner,
+|* der Fly muss wieder hoeher woduch der Text wieder nach unten
+|* verdraengt wird...
+|* Um derartige Oszillationen zu vermeiden, wird ein kleiner Positions-
+|* stack aufgebaut. Wenn der Fly ein Position erreicht, die er bereits
+|* einmal einnahm, so brechen wir den Vorgang ab. Um keine Risiken
+|* einzugehen, wird der Positionsstack so aufgebaut, dass er fuenf
+|* Positionen zurueckblickt.
+|* Wenn der Stack ueberlaeuft, wird ebenfalls abgebrochen.
+|* Der Abbruch fuer dazu, dass der Fly am Ende eine unguenste Position
+|* einnimmt. Damit es nicht durch einen wiederholten Aufruf von
+|* Aussen zu einer 'grossen Oszillation' kommen kann wird im Abbruch-
+|* fall das Attribut des Rahmens auf automatische Ausrichtung oben
+|* eingestellt.
+|*
+|* Ersterstellung MA 12. Nov. 92
+|* Letzte Aenderung MA 20. Sep. 96
+|*
+|*************************************************************************/
+//Wir brauchen ein Paar Hilfsklassen zur Kontrolle der Ozillation und ein paar
+//Funktionen um die Uebersicht zu gewaehrleisten.
+
+/*N*/ class SwOszControl
+/*N*/ {
+/*N*/ static const SwFlyFrm *pStk1;
+/*N*/ static const SwFlyFrm *pStk2;
+/*N*/ static const SwFlyFrm *pStk3;
+/*N*/ static const SwFlyFrm *pStk4;
+/*N*/ static const SwFlyFrm *pStk5;
+/*N*/
+/*N*/ const SwFlyFrm *pFly;
+/*N*/ Point aStk1, aStk2, aStk3, aStk4, aStk5;
+/*N*/
+/*N*/ public:
+/*N*/ SwOszControl( const SwFlyFrm *pFrm );
+/*N*/ ~SwOszControl();
+/*N*/ FASTBOOL ChkOsz();
+/*N*/ static FASTBOOL IsInProgress( const SwFlyFrm *pFly );
+/*N*/ };
+/*N*/ const SwFlyFrm *SwOszControl::pStk1 = 0;
+/*N*/ const SwFlyFrm *SwOszControl::pStk2 = 0;
+/*N*/ const SwFlyFrm *SwOszControl::pStk3 = 0;
+/*N*/ const SwFlyFrm *SwOszControl::pStk4 = 0;
+/*N*/ const SwFlyFrm *SwOszControl::pStk5 = 0;
+
+/*N*/ SwOszControl::SwOszControl( const SwFlyFrm *pFrm ) :
+/*N*/ pFly( pFrm )
+/*N*/ {
+/*N*/ if ( !SwOszControl::pStk1 )
+/*N*/ SwOszControl::pStk1 = pFly;
+/*N*/ else if ( !SwOszControl::pStk2 )
+/*?*/ SwOszControl::pStk2 = pFly;
+/*?*/ else if ( !SwOszControl::pStk3 )
+/*?*/ SwOszControl::pStk3 = pFly;
+/*?*/ else if ( !SwOszControl::pStk4 )
+/*?*/ SwOszControl::pStk4 = pFly;
+/*?*/ else if ( !SwOszControl::pStk5 )
+/*?*/ SwOszControl::pStk5 = pFly;
+/*N*/ }
+
+/*N*/ SwOszControl::~SwOszControl()
+/*N*/ {
+/*N*/ if ( SwOszControl::pStk1 == pFly )
+/*N*/ SwOszControl::pStk1 = 0;
+/*N*/ else if ( SwOszControl::pStk2 == pFly )
+/*?*/ SwOszControl::pStk2 = 0;
+/*?*/ else if ( SwOszControl::pStk3 == pFly )
+/*?*/ SwOszControl::pStk3 = 0;
+/*?*/ else if ( SwOszControl::pStk4 == pFly )
+/*?*/ SwOszControl::pStk4 = 0;
+/*?*/ else if ( SwOszControl::pStk5 == pFly )
+/*?*/ SwOszControl::pStk5 = 0;
+/*N*/ }
+
+/*N*/ FASTBOOL IsInProgress( const SwFlyFrm *pFly )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 //STRIP001 return SwOszControl::IsInProgress( pFly );
+/*N*/ }
+
+/*N*/ FASTBOOL SwOszControl::IsInProgress( const SwFlyFrm *pFly )
+/*N*/ {
+/*N*/ if ( SwOszControl::pStk1 && !pFly->IsLowerOf( SwOszControl::pStk1 ) )
+/*N*/ return TRUE;
+/*N*/ if ( SwOszControl::pStk2 && !pFly->IsLowerOf( SwOszControl::pStk2 ) )
+/*?*/ return TRUE;
+/*N*/ if ( SwOszControl::pStk3 && !pFly->IsLowerOf( SwOszControl::pStk3 ) )
+/*?*/ return TRUE;
+/*N*/ if ( SwOszControl::pStk4 && !pFly->IsLowerOf( SwOszControl::pStk4 ) )
+/*?*/ return TRUE;
+/*N*/ if ( SwOszControl::pStk5 && !pFly->IsLowerOf( SwOszControl::pStk5 ) )
+/*?*/ return TRUE;
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ FASTBOOL SwOszControl::ChkOsz()
+/*N*/ {
+/*N*/ FASTBOOL bRet = TRUE;
+/*N*/ Point aTmp = pFly->Frm().Pos();
+/*N*/ if( aTmp == Point() )
+/*N*/ aTmp.X() = 1;
+/*N*/ //Ist der Stack am Ende?
+/*N*/ if ( aStk1 != Point() )
+/*?*/ return TRUE;
+/*N*/ if ( aTmp != aStk1 && aTmp != aStk2 && aTmp != aStk3 &&
+/*N*/ aTmp != aStk4 && aTmp != aStk5 )
+/*N*/ {
+/*N*/ aStk1 = aStk2;
+/*N*/ aStk2 = aStk3;
+/*N*/ aStk3 = aStk4;
+/*N*/ aStk4 = aStk5;
+/*N*/ aStk5 = aTmp;
+/*N*/ bRet = FALSE;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*M*/ void SwFlyAtCntFrm::MakeAll()
+/*M*/ {
+/*M*/ if ( !SwOszControl::IsInProgress( this ) && !IsLocked() && !IsColLocked() )
+/*M*/ {
+/*M*/ if( !GetPage() && GetAnchor() && GetAnchor()->IsInFly() )
+/*M*/ {
+/*M*/ SwFlyFrm* pFly = GetAnchor()->FindFlyFrm();
+/*M*/ SwPageFrm *pPage = pFly ? pFly->FindPageFrm() : NULL;
+/*M*/ if( pPage )
+/*M*/ pPage->SwPageFrm::AppendFly( this );
+/*M*/ }
+/*M*/ if( GetPage() )
+/*M*/ {
+/*M*/ //Den Anker muessen wir zwischendurch natuerlich Formatieren, damit
+/*M*/ //Repaints usw. stimmen sollte er natuerlich trotzdem Invalid bleiben.
+/*M*/ //Jetzt Stufe 2: Damit Repaints stimmen muessen alle Frms wieder Invalidiert
+/*M*/ //werden, die unterwegs formatiert werden.
+/*M*/ //Dazu werden sie ein ein PrtArr eingetragen; die Frms mit CompletePaint
+/*M*/ //zu flaggen scheint mir hier das Mittel der Wahl.
+/*M*/ //(Vielleicht sollte es einmal die Moeglichkeit geben sie einfach mit
+/*M*/ //Paint zu flaggen; kein Formatieren, aber ein Paint-Aufruf, vor allem
+/*M*/ //wohl fuer TxtFrms geeignet.
+/*M*/ //Jetzt Stufe 3: einfach ein globales Flag und schon flaggen sie sich
+/*M*/ //selbst.
+/*M*/ bSetCompletePaintOnInvalidate = TRUE;
+/*M*/ sal_Bool bLockedAnchor =
+/*M*/ static_cast<const SwTxtFrm*>( GetAnchor() )->IsAnyJoinLocked();
+/*M*/ {
+/*M*/ SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
+/*M*/ const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize();
+/*M*/ if( rFrmSz.GetHeightPercent() != 0xFF &&
+/*M*/ rFrmSz.GetHeightPercent() >= 100 )
+/*M*/ {
+/*M*/ pFmt->LockModify();
+/*M*/ SwFmtSurround aMain( pFmt->GetSurround() );
+/*M*/ if ( aMain.GetSurround() == SURROUND_NONE )
+/*M*/ {
+/*M*/ aMain.SetSurround( SURROUND_THROUGHT );
+/*M*/ pFmt->SetAttr( aMain );
+/*M*/ }
+/*M*/ pFmt->UnlockModify();
+/*M*/ }
+/*M*/ }
+/*M*/ SwOszControl aOszCntrl( this );
+/*M*/
+/*M*/ if( !bLockedAnchor )
+/*M*/ {
+/*M*/ if( GetAnchor()->IsInSct() )
+/*M*/ {
+/*M*/ SwSectionFrm *pSct = GetAnchor()->FindSctFrm();
+/*M*/ pSct->Calc();
+/*M*/ }
+/*M*/
+/*M*/ GetAnchor()->Calc();
+/*M*/ }
+/*M*/
+/*M*/ SwFrm* pFooter = GetAnchor()->FindFooterOrHeader();
+/*M*/ if( pFooter && !pFooter->IsFooterFrm() )
+/*M*/ pFooter = NULL;
+/*M*/ FASTBOOL bOsz = FALSE;
+/*M*/ FASTBOOL bExtra = Lower() && Lower()->IsColumnFrm();
+/*M*/
+/*M*/ do {
+/*M*/ SWRECTFN( this )
+/*M*/ Point aOldPos( (Frm().*fnRect->fnGetPos)() );
+/*M*/ SwFlyFreeFrm::MakeAll();
+/*M*/ BOOL bPosChg = aOldPos != (Frm().*fnRect->fnGetPos)();
+/*M*/ if( !bLockedAnchor )
+/*M*/ {
+/*M*/ if( GetAnchor()->IsInSct() )
+/*M*/ {
+/*M*/ SwSectionFrm *pSct = GetAnchor()->FindSctFrm();
+/*M*/ pSct->Calc();
+/*M*/ }
+/*M*/
+/*M*/ GetAnchor()->Calc();
+/*M*/ }
+/*M*/
+/*M*/ if( aOldPos != (Frm().*fnRect->fnGetPos)() ||
+/*M*/ ( !GetValidPosFlag() &&( pFooter || bPosChg ) ) )
+/*M*/ bOsz = aOszCntrl.ChkOsz();
+/*M*/ if( bExtra && Lower() && !Lower()->GetValidPosFlag() )
+/*M*/ { // Wenn ein mehrspaltiger Rahmen wg. Positionswechsel ungueltige
+/*M*/ // Spalten hinterlaesst, so drehen wir lieber hier eine weitere
+/*M*/ // Runde und formatieren unseren Inhalt via FormatWidthCols nochmal.
+/*M*/ _InvalidateSize();
+/*M*/ bExtra = FALSE; // Sicherhaltshalber gibt es nur eine Ehrenrunde.
+/*M*/ }
+/*M*/ } while ( !IsValid() && !bOsz );
+/*M*/
+/*M*/ if ( bOsz )
+/*M*/ {
+/*M*/ SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
+/*M*/ pFmt->LockModify();
+/*M*/ SwFmtSurround aMain( pFmt->GetSurround() );
+/*M*/ // Im Notfall setzen wir automatisch positionierte Rahmen mit
+/*M*/ // Rekursion auf Durchlauf, das duerfte beruhigend wirken.
+/*M*/ if( IsAutoPos() && aMain.GetSurround() != SURROUND_THROUGHT )
+/*M*/ {
+/*M*/ aMain.SetSurround( SURROUND_THROUGHT );
+/*M*/ pFmt->SetAttr( aMain );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ SwFmtVertOrient aOrient( pFmt->GetVertOrient() );
+/*M*/ aOrient.SetVertOrient( VERT_TOP );
+/*M*/ pFmt->SetAttr( aOrient );
+/*M*/ //Wenn der Rahmen auf "Kein Umlauf" steht, versuchen wir es mal
+/*M*/ //mit Seitenumlauf.
+/*M*/ if ( aMain.GetSurround() == SURROUND_NONE )
+/*M*/ {
+/*M*/ aMain.SetSurround( SURROUND_PARALLEL );
+/*M*/ pFmt->SetAttr( aMain );
+/*M*/ }
+/*M*/ }
+/*M*/ pFmt->UnlockModify();
+/*M*/
+/*M*/ _InvalidatePos();
+/*M*/ SwFlyFreeFrm::MakeAll();
+/*M*/ if( !bLockedAnchor )
+/*M*/ GetAnchor()->Calc();
+/*M*/ if ( !GetValidPosFlag() )
+/*M*/ {
+/*M*/ SwFlyFreeFrm::MakeAll();
+/*M*/ if( !bLockedAnchor )
+/*M*/ GetAnchor()->Calc();
+/*M*/ }
+/*M*/ //Osz auf jeden fall zum Stehen bringen.
+/*M*/ bValidPos = bValidSize = bValidPrtArea = TRUE;
+/*M*/ }
+/*M*/ bSetCompletePaintOnInvalidate = FALSE;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+|*
+|* FindAnchor() und Hilfsfunktionen.
+|*
+|* Beschreibung: Sucht ausgehend von pOldAnch einen Anker fuer
+|* Absatzgebundene Objekte.
+|* Wird beim Draggen von Absatzgebundenen Objekten zur Ankeranzeige sowie
+|* fuer Ankerwechsel benoetigt.
+|* Ersterstellung MA 22. Jun. 93
+|* Letzte Aenderung MA 30. Jan. 95
+|*
+|*************************************************************************/
+
+/*N*/ class SwDistance
+/*N*/ {
+/*N*/ public:
+/*N*/ SwTwips nMain, nSub;
+/*N*/ SwDistance() { nMain = nSub = 0; }
+/*N*/ SwDistance& operator=( const SwDistance &rTwo )
+/*N*/ { nMain = rTwo.nMain; nSub = rTwo.nSub; return *this; }
+/*N*/ BOOL operator<( const SwDistance& rTwo )
+/*N*/ { return nMain < rTwo.nMain || ( nMain == rTwo.nMain && nSub &&
+/*N*/ rTwo.nSub && nSub < rTwo.nSub ); }
+/*N*/ BOOL operator<=( const SwDistance& rTwo )
+/*N*/ { return nMain < rTwo.nMain || ( nMain == rTwo.nMain && ( !nSub ||
+/*N*/ !rTwo.nSub || nSub <= rTwo.nSub ) ); }
+/*N*/ };
+
+/*N*/ const SwFrm * MA_FASTCALL lcl_CalcDownDist( SwDistance &rRet,
+/*N*/ const Point &rPt,
+/*N*/ const SwCntntFrm *pCnt )
+/*N*/ {
+/*N*/ rRet.nSub = 0;
+/*N*/ //Wenn der Point direkt innerhalb des Cnt steht ist die Sache klar und
+/*N*/ //der Cntnt hat automatisch eine Entfernung von 0
+/*N*/ if ( pCnt->Frm().IsInside( rPt ) )
+/*N*/ {
+/*N*/ rRet.nMain = 0;
+/*N*/ return pCnt;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwLayoutFrm *pUp = pCnt->IsInTab() ? pCnt->FindTabFrm()->GetUpper() : pCnt->GetUpper();
+/*N*/ // einspaltige Bereiche muessen zu ihrem Upper durchschalten
+/*N*/ while( pUp->IsSctFrm() )
+/*N*/ pUp = pUp->GetUpper();
+/*N*/ SWRECTFN( pUp )
+/*N*/ //Dem Textflus folgen.
+/*N*/ if ( pUp->Frm().IsInside( rPt ) )
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ rRet.nMain = pCnt->Frm().Left() + pCnt->Frm().Width() -rPt.X();
+/*N*/ else
+/*N*/ rRet.nMain = rPt.Y() - pCnt->Frm().Top();
+/*N*/ return pCnt;
+/*N*/ }
+/*N*/ else if ( rPt.Y() <= pUp->Frm().Top() )
+/*N*/ {
+/*N*/ rRet.nMain = LONG_MAX;
+/*N*/ }
+/*N*/ else if( rPt.X() < pUp->Frm().Left() &&
+/*N*/ rPt.Y() <= ( bVert ? pUp->Frm().Top() : pUp->Frm().Bottom() ) )
+/*N*/ {
+/*?*/ const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, FALSE, pCnt );
+/*?*/ if( !pLay ||
+/*?*/ (bVert && (pLay->Frm().Top() + pLay->Prt().Bottom()) <rPt.Y())||
+/*?*/ (!bVert && (pLay->Frm().Left() + pLay->Prt().Right())<rPt.X()) )
+/*?*/ {
+/*?*/ if( bVert )
+/*?*/ rRet.nMain = pCnt->Frm().Left() + pCnt->Frm().Width()
+/*?*/ - rPt.X();
+/*?*/ else
+/*?*/ rRet.nMain = rPt.Y() - pCnt->Frm().Top();
+/*?*/ return pCnt;
+/*?*/ }
+/*?*/ else
+/*?*/ rRet.nMain = LONG_MAX;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rRet.nMain = bVert ? pCnt->Frm().Left() + pCnt->Frm().Width() -
+/*N*/ (pUp->Frm().Left() + pUp->Prt().Left())
+/*N*/ : (pUp->Frm().Top() + pUp->Prt().Bottom()) - pCnt->Frm().Top();
+/*N*/
+/*N*/ const SwFrm *pPre = pCnt;
+/*N*/ const SwFrm *pLay = pUp->GetLeaf( MAKEPAGE_NONE, TRUE, pCnt );
+/*N*/ SwTwips nFrmTop, nPrtHeight;
+/*N*/ BOOL bSct;
+/*N*/ const SwSectionFrm *pSect = pUp->FindSctFrm();
+/*N*/ if( pSect )
+/*N*/ {
+/*N*/ rRet.nSub = rRet.nMain;
+/*N*/ rRet.nMain = 0;
+/*N*/ }
+/*N*/ if( pSect && !pSect->IsAnLower( pLay ) )
+/*N*/ {
+/*?*/ bSct = FALSE;
+/*?*/ const SwSectionFrm* pNxtSect = pLay ? pLay->FindSctFrm() : 0;
+/*?*/ if( pSect->IsAnFollow( pNxtSect ) )
+/*?*/ {
+/*?*/ if( pLay->IsVertical() )
+/*?*/ {
+/*?*/ nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
+/*?*/ nPrtHeight = pLay->Prt().Width();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nFrmTop = pLay->Frm().Top();
+/*?*/ nPrtHeight = pLay->Prt().Height();
+/*?*/ }
+/*?*/ pSect = pNxtSect;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pLay = pSect->GetUpper();
+/*?*/ if( pLay->IsVertical() )
+/*?*/ {
+/*?*/ nFrmTop = pSect->Frm().Left();
+/*?*/ nPrtHeight = pSect->Frm().Left() - pLay->Frm().Left()
+/*?*/ - pLay->Prt().Left();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nFrmTop = pSect->Frm().Bottom();
+/*?*/ nPrtHeight = pLay->Frm().Top() + pLay->Prt().Top()
+/*?*/ + pLay->Prt().Height() - pSect->Frm().Top()
+/*?*/ - pSect->Frm().Height();
+/*?*/ }
+/*?*/ pSect = 0;
+/*?*/ }
+/*?*/ }
+/*N*/ else if( pLay )
+/*N*/ {
+/*N*/ if( pLay->IsVertical() )
+/*N*/ {
+/*N*/ nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
+/*N*/ nPrtHeight = pLay->Prt().Width();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nFrmTop = pLay->Frm().Top();
+/*N*/ nPrtHeight = pLay->Prt().Height();
+/*N*/ }
+/*N*/ bSct = 0 != pSect;
+/*N*/ }
+/*N*/ while ( pLay && !pLay->Frm().IsInside( rPt ) &&
+/*N*/ ( pLay->Frm().Top() <= rPt.Y() || pLay->IsInFly() ||
+/*N*/ ( pLay->IsInSct() &&
+/*N*/ pLay->FindSctFrm()->GetUpper()->Frm().Top() <= rPt.Y())) )
+/*N*/ {
+/*N*/ if ( pLay->IsFtnContFrm() )
+/*N*/ {
+/*N*/ if ( !((SwLayoutFrm*)pLay)->Lower() )
+/*N*/ {
+/*N*/ SwFrm *pDel = (SwFrm*)pLay;
+/*N*/ pDel->Cut();
+/*N*/ delete pDel;
+/*N*/ return pPre;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( bSct || pSect )
+/*N*/ rRet.nSub += nPrtHeight;
+/*N*/ else
+/*N*/ rRet.nMain += nPrtHeight;
+/*N*/ pPre = pLay;
+/*N*/ pLay = pLay->GetLeaf( MAKEPAGE_NONE, TRUE, pCnt );
+/*N*/ if( pSect && !pSect->IsAnLower( pLay ) )
+/*N*/ { // If we're leaving a SwSectionFrm, the next Leaf-Frm
+/*?*/ // is the part of the upper below the SectionFrm.
+/*?*/ const SwSectionFrm* pNxtSect = pLay ?
+/*?*/ pLay->FindSctFrm() : NULL;
+/*?*/ bSct = FALSE;
+/*?*/ if( pSect->IsAnFollow( pNxtSect ) )
+/*?*/ {
+/*?*/ pSect = pNxtSect;
+/*?*/ if( pLay->IsVertical() )
+/*?*/ {
+/*?*/ nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
+/*?*/ nPrtHeight = pLay->Prt().Width();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nFrmTop = pLay->Frm().Top();
+/*?*/ nPrtHeight = pLay->Prt().Height();
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pLay = pSect->GetUpper();
+/*?*/ if( pLay->IsVertical() )
+/*?*/ {
+/*?*/ nFrmTop = pSect->Frm().Left();
+/*?*/ nPrtHeight = pSect->Frm().Left() -
+/*?*/ pLay->Frm().Left() - pLay->Prt().Left();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nFrmTop = pSect->Frm().Bottom();
+/*?*/ nPrtHeight = pLay->Frm().Top()+pLay->Prt().Top()
+/*?*/ + pLay->Prt().Height() - pSect->Frm().Top()
+/*?*/ - pSect->Frm().Height();
+/*?*/ }
+/*?*/ pSect = 0;
+/*?*/ }
+/*N*/ }
+/*N*/ else if( pLay )
+/*N*/ {
+/*N*/ if( pLay->IsVertical() )
+/*N*/ {
+/*N*/ nFrmTop = pLay->Frm().Left() + pLay->Frm().Width();
+/*N*/ nPrtHeight = pLay->Prt().Width();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nFrmTop = pLay->Frm().Top();
+/*N*/ nPrtHeight = pLay->Prt().Height();
+/*N*/ }
+/*N*/ bSct = 0 != pSect;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pLay )
+/*N*/ {
+/*?*/ if ( pLay->Frm().IsInside( rPt ) )
+/*?*/ {
+/*?*/ SwTwips nDiff = pLay->IsVertical() ? ( nFrmTop - rPt.X() )
+/*?*/ : ( rPt.Y() - nFrmTop );
+/*?*/ if( bSct || pSect )
+/*?*/ rRet.nSub += nDiff;
+/*?*/ else
+/*?*/ rRet.nMain += nDiff;
+/*?*/ }
+/*?*/ if ( pLay->IsFtnContFrm() && !((SwLayoutFrm*)pLay)->Lower() )
+/*?*/ {
+/*?*/ SwFrm *pDel = (SwFrm*)pLay;
+/*?*/ pDel->Cut();
+/*?*/ delete pDel;
+/*?*/ return 0;
+/*?*/ }
+/*?*/ return pLay;
+/*N*/ }
+/*N*/ else
+/*N*/ rRet.nMain = LONG_MAX;
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+//Bug 3985, optimierungsproblem, vergleiche auch trvlfrm.cxx lcl_FindCntnt()
+
+/*N*/ ULONG MA_FASTCALL lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
+/*N*/ const SwCntntFrm *& rpCnt,
+/*N*/ const BOOL bBody, const BOOL bFtn )
+/*N*/ {
+/*N*/ //Sucht unterhalb von pLay den dichtesten Cnt zum Point. Der Bezugspunkt
+/*N*/ //der Cntnts ist immer die linke obere Ecke.
+/*N*/ //Der Cnt soll moeglichst ueber dem Point liegen.
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ Point arPoint( rPt );
+/*N*/ #endif
+/*N*/
+/*N*/ rpCnt = 0;
+/*N*/ ULONG nDistance = ULONG_MAX;
+/*N*/ ULONG nNearest = ULONG_MAX;
+/*N*/ const SwCntntFrm *pCnt = pLay->ContainsCntnt();
+/*N*/
+/*N*/ while ( pCnt && (bBody != pCnt->IsInDocBody() || bFtn != pCnt->IsInFtn()))
+/*N*/ {
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ if ( !pLay->IsAnLower( pCnt ) )
+/*N*/ pCnt = 0;
+/*N*/ }
+/*N*/ const SwCntntFrm *pNearest = pCnt;
+/*N*/ if ( pCnt )
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ //Jetzt die Entfernung zwischen den beiden Punkten berechnen.
+/*N*/ //'Delta' X^2 + 'Delta'Y^2 = 'Entfernung'^2
+/*N*/ sal_uInt32 dX = Max( pCnt->Frm().Left(), rPt.X() ) -
+/*N*/ Min( pCnt->Frm().Left(), rPt.X() ),
+/*N*/ dY = Max( pCnt->Frm().Top(), rPt.Y() ) -
+/*N*/ Min( pCnt->Frm().Top(), rPt.Y() );
+/*N*/ BigInt dX1( dX ), dY1( dY );
+/*N*/ dX1 *= dX1; dY1 *= dY1;
+/*N*/ const ULONG nDiff = ::binfilter::SqRt( dX1 + dY1 );
+/*N*/ if ( pCnt->Frm().Top() <= rPt.Y() )
+/*N*/ {
+/*N*/ if ( nDiff < nDistance )
+/*N*/ { //Der ist dichter dran
+/*N*/ nDistance = nNearest = nDiff;
+/*N*/ rpCnt = pNearest = pCnt;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( nDiff < nNearest )
+/*N*/ {
+/*N*/ nNearest = nDiff;
+/*N*/ pNearest = pCnt;
+/*N*/ }
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ while ( pCnt &&
+/*N*/ (bBody != pCnt->IsInDocBody() || bFtn != pCnt->IsInFtn()))
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/
+/*N*/ } while ( pCnt && pLay->IsAnLower( pCnt ) );
+/*N*/ }
+/*N*/ if ( nDistance == ULONG_MAX )
+/*N*/ { rpCnt = pNearest;
+/*N*/ return nNearest;
+/*N*/ }
+/*N*/ return nDistance;
+/*N*/ }
+
+/*N*/ #ifdef _MSC_VER
+/*N*/ #pragma optimize("e",on)
+/*N*/ #endif
+
+/*N*/ const SwCntntFrm * MA_FASTCALL lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
+/*N*/ const BOOL bBody, const BOOL bFtn )
+/*N*/ {
+/*N*/ //Sucht ausgehen von pCnt denjenigen CntntFrm, dessen linke obere
+/*N*/ //Ecke am dichtesten am Point liegt.
+/*N*/ //Liefert _immer_ einen CntntFrm zurueck.
+/*N*/
+/*N*/ //Zunaechst wird versucht den dichtesten Cntnt innerhalt derjenigen
+/*N*/ //Seite zu suchen innerhalb derer der Cntnt steht.
+/*N*/ //Ausgehend von der Seite muessen die Seiten in beide
+/*N*/ //Richtungen beruecksichtigt werden.
+/*N*/ //Falls moeglich wird ein Cntnt geliefert, dessen Y-Position ueber der
+/*N*/ //des Point sitzt.
+/*N*/ const SwCntntFrm *pRet, *pNew;
+/*N*/ const SwLayoutFrm *pLay = pCnt->FindPageFrm();
+/*N*/ ULONG nDist;
+/*N*/
+/*N*/ nDist = ::binfilter::lcl_FindCntDiff( rPt, pLay, pNew, bBody, bFtn );
+/*N*/ if ( pNew )
+/*N*/ pRet = pNew;
+/*N*/ else
+/*N*/ { pRet = pCnt;
+/*N*/ nDist = ULONG_MAX;
+/*N*/ }
+/*N*/ const SwCntntFrm *pNearest = pRet;
+/*N*/ ULONG nNearest = nDist;
+/*N*/
+/*N*/ if ( pLay )
+/*N*/ {
+/*N*/ const SwLayoutFrm *pPge = pLay;
+/*N*/ ULONG nOldNew = ULONG_MAX;
+/*N*/ for ( USHORT i = 0; pPge->GetPrev() && (i < 3); ++i )
+/*N*/ {
+/*N*/ pPge = (SwLayoutFrm*)pPge->GetPrev();
+/*N*/ const ULONG nNew = ::binfilter::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn );
+/*N*/ if ( nNew < nDist )
+/*N*/ {
+/*N*/ if ( pNew->Frm().Top() <= rPt.Y() )
+/*N*/ {
+/*N*/ pRet = pNearest = pNew;
+/*N*/ nDist = nNearest = nNew;
+/*N*/ }
+/*N*/ else if ( nNew < nNearest )
+/*N*/ {
+/*N*/ pNearest = pNew;
+/*N*/ nNearest = nNew;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( nOldNew != ULONG_MAX && nNew > nOldNew )
+/*N*/ break;
+/*N*/ else
+/*N*/ nOldNew = nNew;
+/*N*/
+/*N*/ }
+/*N*/ pPge = pLay;
+/*N*/ nOldNew = ULONG_MAX;
+/*N*/ for ( USHORT j = 0; pPge->GetNext() && (j < 3); ++j )
+/*N*/ {
+/*N*/ pPge = (SwLayoutFrm*)pPge->GetNext();
+/*N*/ const ULONG nNew = ::binfilter::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn );
+/*N*/ if ( nNew < nDist )
+/*N*/ {
+/*N*/ if ( pNew->Frm().Top() <= rPt.Y() )
+/*N*/ {
+/*N*/ pRet = pNearest = pNew;
+/*N*/ nDist = nNearest = nNew;
+/*N*/ }
+/*N*/ else if ( nNew < nNearest )
+/*N*/ {
+/*N*/ pNearest = pNew;
+/*N*/ nNearest = nNew;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( nOldNew != ULONG_MAX && nNew > nOldNew )
+/*N*/ break;
+/*N*/ else
+/*N*/ nOldNew = nNew;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( (pRet->Frm().Top() > rPt.Y()) )
+/*N*/ return pNearest;
+/*N*/ else
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ void lcl_PointToPrt( Point &rPoint, const SwFrm *pFrm )
+/*N*/ {
+/*N*/ SwRect aTmp( pFrm->Prt() );
+/*N*/ aTmp += pFrm->Frm().Pos();
+/*N*/ if ( rPoint.X() < aTmp.Left() )
+/*N*/ rPoint.X() = aTmp.Left();
+/*N*/ else if ( rPoint.X() > aTmp.Right() )
+/*N*/ rPoint.X() = aTmp.Right();
+/*N*/ if ( rPoint.Y() < aTmp.Top() )
+/*N*/ rPoint.Y() = aTmp.Top();
+/*N*/ else if ( rPoint.Y() > aTmp.Bottom() )
+/*N*/ rPoint.Y() = aTmp.Bottom();
+/*N*/
+/*N*/ }
+
+/*N*/ const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew,
+/*N*/ const BOOL bBodyOnly )
+/*N*/ {
+/*N*/ //Zu der angegebenen DokumentPosition wird der dichteste Cnt im
+/*N*/ //Textfluss gesucht. AusgangsFrm ist der uebergebene Anker.
+/*N*/ const SwCntntFrm *pCnt;
+/*N*/ if ( pOldAnch->IsCntntFrm() )
+/*N*/ pCnt = (const SwCntntFrm*)pOldAnch;
+/*N*/ else
+/*N*/ { Point aTmp( rNew );
+/*N*/ SwLayoutFrm *pTmpLay = (SwLayoutFrm*)pOldAnch;
+/*N*/ if( pTmpLay->IsRootFrm() )
+/*N*/ {
+/*N*/ SwRect aTmpRect( aTmp, Size(0,0) );
+/*N*/ pTmpLay = (SwLayoutFrm*)::binfilter::FindPage( aTmpRect, pTmpLay->Lower() );
+/*N*/ }
+/*N*/ pCnt = pTmpLay->GetCntntPos( aTmp, FALSE, bBodyOnly );
+/*N*/ }
+/*N*/
+/*N*/ //Beim Suchen darauf achten, dass die Bereiche sinnvoll erhalten
+/*N*/ //bleiben. D.h. in diesem Fall nicht in Header/Footer hinein und
+/*N*/ //nicht aus Header/Footer hinaus.
+/*N*/ const BOOL bBody = pCnt->IsInDocBody() || bBodyOnly;
+/*N*/ const BOOL bFtn = !bBodyOnly && pCnt->IsInFtn();
+/*N*/
+/*N*/ Point aNew( rNew );
+/*N*/ if ( bBody )
+/*N*/ {
+/*N*/ //#38848 Vom Seitenrand in den Body ziehen.
+/*N*/ const SwFrm *pPage = pCnt->FindPageFrm();
+/*N*/ ::binfilter::lcl_PointToPrt( aNew, pPage->GetUpper() );
+/*N*/ SwRect aTmp( aNew, Size( 0, 0 ) );
+/*N*/ pPage = ::binfilter::FindPage( aTmp, pPage );
+/*N*/ ::binfilter::lcl_PointToPrt( aNew, pPage );
+/*N*/ }
+/*N*/
+/*N*/ if ( pCnt->IsInDocBody() == bBody && pCnt->Frm().IsInside( aNew ) )
+/*N*/ return pCnt;
+/*N*/ else if ( pOldAnch->IsInDocBody() || pOldAnch->IsPageFrm() )
+/*N*/ {
+/*N*/ //Vielleicht befindet sich der gewuenschte Anker ja auf derselben
+/*N*/ //Seite wie der aktuelle Anker.
+/*N*/ //So gibt es kein Problem mit Spalten.
+/*N*/ Point aTmp( aNew );
+/*N*/ const SwCntntFrm *pTmp = pCnt->FindPageFrm()->
+/*N*/ GetCntntPos( aTmp, FALSE, TRUE, FALSE );
+/*N*/ if ( pTmp && pTmp->Frm().IsInside( aNew ) )
+/*N*/ return pTmp;
+/*N*/ }
+/*N*/
+/*N*/ //Ausgehend vom Anker suche ich jetzt in beide Richtungen bis ich
+/*N*/ //den jeweils dichtesten gefunden habe.
+/*N*/ //Nicht die direkte Entfernung ist relevant sondern die Strecke die
+/*N*/ //im Textfluss zurueckgelegt werden muss.
+/*N*/ const SwCntntFrm *pUpLst;
+/*N*/ const SwCntntFrm *pUpFrm = pCnt;
+/*N*/ SwDistance nUp, nUpLst;
+/*N*/ ::binfilter::lcl_CalcDownDist( nUp, aNew, pUpFrm );
+/*N*/ SwDistance nDown = nUp;
+/*N*/ BOOL bNegAllowed = TRUE;//Einmal aus dem negativen Bereich heraus lassen.
+/*N*/ do
+/*N*/ {
+/*N*/ pUpLst = pUpFrm; nUpLst = nUp;
+/*N*/ pUpFrm = pUpLst->GetPrevCntntFrm();
+/*N*/ while ( pUpFrm &&
+/*N*/ (bBody != pUpFrm->IsInDocBody() || bFtn != pUpFrm->IsInFtn()))
+/*N*/ pUpFrm = pUpFrm->GetPrevCntntFrm();
+/*N*/ if ( pUpFrm )
+/*N*/ {
+/*N*/ ::binfilter::lcl_CalcDownDist( nUp, aNew, pUpFrm );
+/*N*/ //Wenn die Distanz innnerhalb einer Tabelle waechst, so lohnt es
+/*N*/ //sich weiter zu suchen.
+/*N*/ if ( pUpLst->IsInTab() && pUpFrm->IsInTab() )
+/*N*/ {
+/*N*/ while ( pUpFrm && ((nUpLst < nUp && pUpFrm->IsInTab()) ||
+/*N*/ bBody != pUpFrm->IsInDocBody()) )
+/*N*/ {
+/*N*/ pUpFrm = pUpFrm->GetPrevCntntFrm();
+/*N*/ if ( pUpFrm )
+/*N*/ ::binfilter::lcl_CalcDownDist( nUp, aNew, pUpFrm );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pUpFrm )
+/*N*/ nUp.nMain = LONG_MAX;
+/*N*/ if ( nUp.nMain >= 0 && LONG_MAX != nUp.nMain )
+/*N*/ {
+/*N*/ bNegAllowed = FALSE;
+/*N*/ if ( nUpLst.nMain < 0 ) //nicht den falschen erwischen, wenn der Wert
+/*N*/ //gerade von negativ auf positiv gekippt ist.
+/*N*/ { pUpLst = pUpFrm;
+/*N*/ nUpLst = nUp;
+/*N*/ }
+/*N*/ }
+/*N*/ } while ( pUpFrm && ( ( bNegAllowed && nUp.nMain < 0 ) || ( nUp <= nUpLst ) ) );
+/*N*/
+/*N*/ const SwCntntFrm *pDownLst;
+/*N*/ const SwCntntFrm *pDownFrm = pCnt;
+/*N*/ SwDistance nDownLst;
+/*N*/ if ( nDown.nMain < 0 )
+/*N*/ nDown.nMain = LONG_MAX;
+/*N*/ do
+/*N*/ {
+/*N*/ pDownLst = pDownFrm; nDownLst = nDown;
+/*N*/ pDownFrm = pDownLst->GetNextCntntFrm();
+/*N*/ while ( pDownFrm &&
+/*N*/ (bBody != pDownFrm->IsInDocBody() || bFtn != pDownFrm->IsInFtn()))
+/*N*/ pDownFrm = pDownFrm->GetNextCntntFrm();
+/*N*/ if ( pDownFrm )
+/*N*/ {
+/*N*/ ::binfilter::lcl_CalcDownDist( nDown, aNew, pDownFrm );
+/*N*/ if ( nDown.nMain < 0 )
+/*N*/ nDown.nMain = LONG_MAX;
+/*N*/ //Wenn die Distanz innnerhalb einer Tabelle waechst, so lohnt es
+/*N*/ //sich weiter zu suchen.
+/*N*/ if ( pDownLst->IsInTab() && pDownFrm->IsInTab() )
+/*N*/ {
+/*N*/ while ( pDownFrm && ( ( nDown.nMain != LONG_MAX && nDownLst < nDownLst
+/*N*/ && pDownFrm->IsInTab()) || bBody != pDownFrm->IsInDocBody() ) )
+/*N*/ {
+/*N*/ pDownFrm = pDownFrm->GetNextCntntFrm();
+/*N*/ if ( pDownFrm )
+/*N*/ ::binfilter::lcl_CalcDownDist( nDown, aNew, pDownFrm );
+/*N*/ if ( nDown.nMain < 0 )
+/*N*/ nDown.nMain = LONG_MAX;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pDownFrm )
+/*N*/ nDown.nMain = LONG_MAX;
+/*N*/
+/*N*/ } while ( pDownFrm && nDown <= nDownLst &&
+/*N*/ nDown.nMain != LONG_MAX && nDownLst.nMain != LONG_MAX );
+/*N*/
+/*N*/ //Wenn ich in beide Richtungen keinen gefunden habe, so suche ich mir
+/*N*/ //denjenigen Cntnt dessen linke obere Ecke dem Point am naechsten liegt.
+/*N*/ //Eine derartige Situation tritt z.b. auf, wenn der Point nicht im Text-
+/*N*/ //fluss sondern in irgendwelchen Raendern steht.
+/*N*/ if ( nDownLst.nMain == LONG_MAX && nUpLst.nMain == LONG_MAX )
+/*N*/ {
+/*N*/ // #102861# If an OLE objects, which is contained in a fly frame
+/*N*/ // is resized in inplace mode and the new Position is outside the
+/*N*/ // fly frame, we do not want to leave our fly frame.
+/*N*/ if ( pCnt->IsInFly() )
+/*N*/ return pCnt;
+/*N*/
+/*N*/ return ::binfilter::lcl_FindCnt( aNew, pCnt, bBody, bFtn );
+/*N*/ }
+/*N*/ else
+/*N*/ return nDownLst < nUpLst ? pDownLst : pUpLst;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyAtCntFrm::SetAbsPos()
+|*
+|* Ersterstellung MA 22. Jun. 93
+|* Letzte Aenderung MA 11. Sep. 98
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwFlyAtCntFrm::MakeFlyPos()
+|*
+|* Beschreibung:
+|*
+|* virtueller Anker: Der virtuelle Anker eines Flys ist der Anker selbst
+|* oder einer seiner Follows. Es ist genau derjenige
+|* Cntnt, der dem Fly aktuell am naechsten liegt,
+|* genauer der aktuellen relativen Position des Fly
+|* (siehe auch VertPos, Fix). Es wird nur die
+|* vertikale Entfernung gemessen.
+|* Der virtuelle Anker fuer die Horizontale Ausrichtung
+|* muss nicht ein CntntFrm sein, denn wenn der Fly
+|* z.B. ueber einer leeren Spalte steht, so muss eben
+|* der LayoutFrm als virtueller Anker dienen, der im
+|* Textfluss des Ankers liegt.
+|*
+|* HoriPos:
+|* - Automatisch: Die automatische Ausrichtung orientiert sich
+|* an einem SwFrm der folgendermassen ermittelt wird: Abhaengig
+|* vom Attriut und ausgehend vom virtuellen Anker wird der
+|* Bezugsframe gesucht (CntntFrm, LayoutFrm).
+|* - Fix: Der Wert der relativen Entfernung aus dem Attribut ist
+|* die relative Entfernung vom virtuellen Anker.
+|* VertPos:
+|* - Automatisch: Die automatische Ausrichtung orientiert sich immer
+|* am virtuellen Anker.
+|* - Fix: Der Fly muss nicht in der Umgebung untergebracht sein, in
+|* der sein Anker steht; er folgt aber stets dem Textfluss dem
+|* der Anker folgt. Geclippt (Drawing) wird der Fly am Rootfrm.
+|* Damit die erstgenannte Bedingung erreicht wird, wird der
+|* Fly ggf. entsprechend verschoben. Dabei bleibt die relative
+|* Position des Attributes erhalten, die tatsaechliche relative
+|* Position verhaelt sich zu der des Attributes etwa wie ein
+|* Teleskoparm. Der Betrag der relativen Position ist die
+|* Entfernung zur AbsPos des Ankers im Textfluss.
+|*
+|* Es wird immer zuerst die vertikale Position bestimmt, denn erst dann
+|* steht der virtuelle Anker fest.
+|* Die tatsaechliche relative Position (Member aRelPos) ist immer die
+|* die Entfernung zum Anker - sie muss also nicht mit den im Attribut
+|* angegebenen Werten uebereinstimmen, denn diese geben die Entfernung
+|* 'im Textfluss' an.
+|*
+|* Ersterstellung MA 19. Nov. 92
+|* Letzte Aenderung MA 14. Nov. 96
+|*
+|*************************************************************************/
+
+/*N*/ inline void ValidateSz( SwFrm *pFrm )
+/*N*/ {
+/*N*/ if ( pFrm )
+/*N*/ pFrm->bValidSize = TRUE;
+/*N*/ }
+
+/*M*/ void DeepCalc( const SwFrm *pFrm )
+/*M*/ {
+/*M*/ if( pFrm->IsSctFrm() ||
+/*M*/ ( pFrm->IsFlyFrm() && ((SwFlyFrm*)pFrm)->IsFlyInCntFrm() ) )
+/*M*/ return;
+/*M*/ const SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( pFrm );
+/*M*/ if( pFlow && pFlow->IsAnyJoinLocked() )
+/*M*/ return;
+/*M*/
+/*M*/ USHORT nCnt = 0;
+/*M*/
+/*M*/ FASTBOOL bContinue = FALSE;
+/*M*/ do
+/*M*/ { if ( ++nCnt == 10 )
+/*M*/ {
+/*M*/ ASSERT( !nCnt, "DeepCalc: Loop detected1?" );
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ const FASTBOOL bSetComplete = !pFrm->IsValid();
+/*M*/ const SwRect aOldFrm( pFrm->Frm() );
+/*M*/ const SwRect aOldPrt( pFrm->Prt() );
+/*M*/
+/*M*/ const SwFrm *pUp = pFrm->GetUpper();
+/*M*/ if ( pUp )
+/*M*/ {
+/*M*/ //Nicht weiter wenn der Up ein Fly mit Spalten ist.
+/*M*/ if( ( !pUp->IsFlyFrm() || !((SwLayoutFrm*)pUp)->Lower() ||
+/*M*/ !((SwLayoutFrm*)pUp)->Lower()->IsColumnFrm() ) &&
+/*M*/ !pUp->IsSctFrm() )
+/*M*/ {
+/*M*/ SWRECTFN( pUp )
+/*M*/ const Point aPt( (pUp->Frm().*fnRect->fnGetPos)() );
+/*M*/ ::binfilter::DeepCalc( pUp );
+/*M*/ bContinue = aPt != (pUp->Frm().*fnRect->fnGetPos)();
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ pUp = pFrm;
+/*M*/
+/*M*/ pFrm->Calc();
+/*M*/ if ( bSetComplete && (aOldFrm != pFrm->Frm() || aOldPrt != pFrm->Prt()))
+/*M*/ pFrm->SetCompletePaint();
+/*M*/
+/*M*/ // bContinue = !pUp->IsValid();
+/*M*/ if ( pUp->IsFlyFrm() )
+/*M*/ {
+/*M*/ if ( ((SwFlyFrm*)pUp)->IsLocked() ||
+/*M*/ (((SwFlyFrm*)pUp)->IsFlyAtCntFrm() &&
+/*M*/ SwOszControl::IsInProgress( (const SwFlyFrm*)pUp )) )
+/*M*/ {
+/*M*/ bContinue = FALSE;
+/*M*/ }
+/*M*/ }
+/*M*/ } while ( bContinue );
+/*M*/ }
+
+//Ermittlung des virtuellen Ankers fuer die Positionierung.
+//Dieser ist entweder der Anker selbst oder einer seiner Follows.
+
+/*N*/ const SwCntntFrm *GetVirtualAnchor( const SwFlyAtCntFrm *pFly, xub_StrLen nOfs )
+/*N*/ {
+/*N*/ const SwTxtFrm *pAct = (const SwTxtFrm*)pFly->GetAnchor();
+/*N*/ const SwTxtFrm* pTmp;
+/*N*/ do
+/*N*/ {
+/*N*/ pTmp = pAct;
+/*N*/ pAct = pTmp->GetFollow();
+/*N*/ }
+/*N*/ while( pAct && nOfs >= pAct->GetOfst() );
+/*N*/ return pTmp;
+/*N*/ }
+
+//Ermittlung des virtuellen Ankers, an dem sich die horizontale Ausrichtung
+//orientieren muss.
+//pAssumed enthaelt entweder bereits den Anker (Es ist dann der Anker des
+//Flys oder einer seiner Follows) oder die Umgebung die der Orientierung,
+//mangels einer besseren Moeglichkeit, dienen muss.
+
+/*N*/ const SwFrm *GetVirtualHoriAnchor( const SwFrm *pAssumed, const SwFlyFrm *pFly )
+/*N*/ {
+/*N*/ const SwFrm *pRet = pAssumed;
+/*N*/
+/*N*/ if ( !pRet->IsCntntFrm() )
+/*N*/ { //Wenn es Lower gibt, die selbst der Anker des Fly oder ein Follow
+/*N*/ //desselben sind, so wird derjenige ausgewaehlt, der der aktuellen
+/*N*/ //absoluten vertikalen Position des Fly am naechsten steht.
+/*N*/ //Gibt es keinen, so bleib es bei pAssumed
+/*N*/ const SwFrm *pFlow = ((SwLayoutFrm*)pRet)->Lower();
+/*N*/ SwTwips nCntDiff = LONG_MAX;
+/*N*/ while ( pFlow )
+/*N*/ {
+/*N*/ if ( pFlow->IsCntntFrm() &&
+/*N*/ ((SwCntntFrm*)pFly->GetAnchor())->IsAnFollow( (SwCntntFrm*)pFlow ) )
+/*N*/ {
+/*N*/ SWRECTFN( pFlow )
+/*N*/ SwTwips nDiff = (pFly->Frm().*fnRect->fnGetTop)() -
+/*N*/ (pFlow->Frm().*fnRect->fnGetTop)();
+/*N*/ if ( (nDiff = Abs(nDiff)) < nCntDiff )
+/*N*/ {
+/*N*/ pRet = pFlow; //Der ist dichter dran
+/*N*/ nCntDiff = nDiff;
+/*N*/ }
+/*N*/ }
+/*N*/ pFlow = pFlow->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/
+/*N*/ }
+
+/*N*/ void SwFlyAtCntFrm::AssertPage()
+/*N*/ {
+/*N*/ //Prueft ob der Fly an der Seite haengt, auf der er steht, falls nicht
+/*N*/ //wird er umgehaengt. Zur Pruefung wird nur die vertikale Ausrichtung
+/*N*/ //herangezogen.
+/*N*/
+/*N*/ SwPageFrm *pNewPage = FindPageFrm();
+/*N*/ SwPageFrm *pMyPage = pNewPage;
+/*N*/ BOOL bSuperfluous = FALSE;
+/*N*/
+/*N*/ //#45516# Ausnahmebehandlung. Eine Tabelle ist zu gross und haengt aus der
+/*N*/ //Seite heraus. Der Rahmen kann dann zwar richtig bei seinem Anker stehen,
+/*N*/ //Positionsmaessig aber ueber der naechsten Seite haengen. Damit das dann
+/*N*/ //noch halbwegs brauchbar gedruckt werden kann (HTML) und der Rahmen nicht
+/*N*/ //wirr in der Gegend gepaintet wird, wird der Rahmen bei der Seite verankert,
+/*N*/ //auf der auch sein Anker sitzt.
+/*N*/ if ( GetAnchor()->GetValidSizeFlag() &&
+/*N*/ Frm().Top() >= GetAnchor()->Frm().Top() &&
+/*N*/ Frm().Top() < GetAnchor()->Frm().Bottom() )
+/*N*/ {
+/*N*/ pNewPage = GetAnchor()->FindPageFrm();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BOOL bFound = FALSE;
+/*N*/ const BOOL bFtn = GetAnchor()->IsInFtn();
+/*N*/ int nDir = INT_MAX; // 1 == Forward, 2 == Backward.
+/*N*/ while ( !bFound )
+/*N*/ {
+/*N*/ pNewPage->Calc();
+/*N*/ if ( Frm().Top() < pNewPage->Frm().Top() && pNewPage->GetPrev() )
+/*N*/ {
+/*N*/ pNewPage = (SwPageFrm*)pNewPage->GetPrev();
+/*N*/ // OD 19.02.2003 #105643# - skip empty page and consider empty
+/*N*/ // page at the beginning of the document.
+/*N*/ // Assumption about document layout:
+/*N*/ // No two empty pages following each other.
+/*N*/ if ( pNewPage->IsEmptyPage() )
+/*N*/ {
+/*N*/ if ( pNewPage->GetPrev() )
+/*N*/ {
+/*N*/ pNewPage = static_cast<SwPageFrm*>(pNewPage->GetPrev());
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bFound = TRUE;
+/*N*/ pNewPage = static_cast<SwPageFrm*>(pNewPage->GetNext());
+/*N*/ }
+/*N*/ }
+/*N*/ if ( nDir == 2 )
+/*N*/ {
+/*?*/ bFound = TRUE;
+/*?*/ pNewPage = GetAnchor()->FindPageFrm();
+/*N*/ }
+/*N*/ else
+/*N*/ nDir = 1;
+/*N*/ }
+/*N*/ else if ( Frm().Top() > pNewPage->Frm().Bottom() )
+/*N*/ {
+/*N*/ if ( nDir == 1 )
+/*N*/ {
+/*?*/ bFound = TRUE;
+/*?*/ pNewPage = GetAnchor()->FindPageFrm();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nDir = 2;
+/*N*/ if ( !pNewPage->GetNext() )
+/*N*/ {
+/*?*/ pNewPage->GetLeaf( bFtn ? MAKEPAGE_NONE : MAKEPAGE_APPEND,
+/*?*/ TRUE, GetAnchor());
+/*?*/ bSuperfluous = TRUE;
+/*N*/ }
+/*N*/ if ( pNewPage->GetNext() )
+/*N*/ {
+/*N*/ pNewPage = (SwPageFrm*)pNewPage->GetNext();
+/*N*/ if( pNewPage->IsEmptyPage() )
+/*N*/ {
+/*?*/ if( pNewPage->GetNext() )
+/*?*/ pNewPage = (SwPageFrm*)pNewPage->GetNext();
+/*?*/ else
+/*?*/ {
+/*?*/ bFound = TRUE;
+/*?*/ pNewPage = (SwPageFrm*)pNewPage->GetPrev();
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ bFound = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bFound = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( pMyPage != pNewPage )
+/*N*/ {
+/*N*/ ASSERT( IsLocked(), "AssertPage: Unlocked Frame??" );
+/*N*/ pMyPage->MoveFly( this, pNewPage );
+/*N*/ if ( bSuperfluous && pMyPage->GetPhyPageNum() > pNewPage->GetPhyPageNum() )
+/*?*/ ((SwRootFrm*)pNewPage->GetUpper())->SetSuperfluous();
+/*N*/ }
+/*N*/
+/*N*/ }
+
+/*N*/ BOOL MA_FASTCALL lcl_IsMoveable( SwFlyFrm *pFly, SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ //Waere der Anker auch in der neuen Umgebung noch moveable?
+/*N*/ BOOL bRet;
+/*N*/ SwLayoutFrm *pUp = pFly->GetAnchor()->GetUpper();
+/*N*/ SwFrm *pNext = pFly->GetAnchor()->GetNext();
+/*N*/ pFly->GetAnchor()->Remove();
+/*N*/ pFly->GetAnchor()->InsertBefore( pLay, pLay->Lower() );
+/*N*/ bRet = pFly->GetAnchor()->IsMoveable();
+/*N*/ pFly->GetAnchor()->Remove();
+/*N*/ pFly->GetAnchor()->InsertBefore( pUp, pNext );
+/*N*/ return bRet;
+/*N*/
+/*N*/ }
+
+// Wer weicht wem aus bzw. welcher Bereich ist "linker"/"rechter" als welcher?
+/*N*/ BOOL MA_FASTCALL lcl_Minor( SwRelationOrient eRelO, SwRelationOrient eRelO2,
+/*N*/ BOOL bLeft )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+/*N*/ void SwFlyAtCntFrm::MakeFlyPos()
+/*N*/ {
+/*N*/ /// OD 02.10.2002 #102646#
+/*N*/ /// if fly frame position is valid, nothing is to do, Thus, return
+/*N*/ if ( bValidPos )
+/*N*/ {
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ /// OD 02.10.2002 #102646# - NOTE
+/*N*/ /// declare and set <pFooter> to footer frame, if fly frame is anchored
+/*N*/ /// at a frame belonging to the footer.
+/*N*/ const SwFrm* pFooter = GetAnchor()->FindFooterOrHeader();
+/*N*/ if( pFooter && !pFooter->IsFooterFrm() )
+/*N*/ pFooter = NULL;
+/*N*/
+/*N*/ /// OD 02.10.2002 #102646# - NOTE
+/*N*/ /// declare and set <bBrowse> to TRUE, if document is in browser mode and
+/*N*/ /// fly frame is anchored at the body, but not at frame belonging to a table.
+/*N*/ const FASTBOOL bBrowse = GetAnchor()->IsInDocBody() && !GetAnchor()->IsInTab() ?
+/*N*/ GetFmt()->GetDoc()->IsBrowseMode() : FALSE;
+/*N*/
+/*N*/ /// OD 02.10.2002 #102646# - NOTE
+/*N*/ /// declare and init <bInvalidatePage> to FALSE, in order to invalidate
+/*N*/ /// page size, if <bInvalidatePage> is set during the calculation of the
+/*N*/ /// fly frame position.
+/*N*/ FASTBOOL bInvalidatePage = FALSE;
+/*N*/
+/*N*/ /// OD 02.10.2002 #102646# - NOTE
+/*N*/ /// determine fly frame format and its left/right and its upper/lower spacing.
+/*N*/ SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
+/*N*/ const SvxLRSpaceItem &rLR = pFmt->GetLRSpace();
+/*N*/ const SvxULSpaceItem &rUL = pFmt->GetULSpace();
+/*N*/
+/*N*/ /// OD 02.10.2002 #102646# - NOTE
+/*N*/ /// determine, if fly frame has no surrounding.
+/*N*/ const SwFmtSurround& rSurround = pFmt->GetSurround();
+/*N*/ const FASTBOOL bNoSurround =
+/*N*/ rSurround.GetSurround() == SURROUND_NONE;
+/*N*/ const FASTBOOL bWrapThrough =
+/*N*/ rSurround.GetSurround() == SURROUND_THROUGHT;
+/*N*/
+/*N*/ BOOL bGrow =
+/*N*/ !GetAnchor()->IsInTab() || !pFmt->GetFrmSize().GetHeightPercent();
+/*N*/
+/*N*/ for (;;)
+/*N*/ {
+/*N*/ bValidPos = TRUE;
+/*N*/ if( !pFooter )
+/*N*/ ::binfilter::DeepCalc( GetAnchor() );
+/*N*/ bValidPos = TRUE;
+/*N*/
+/*N*/ //Die Werte in den Attributen muessen ggf. upgedated werden,
+/*N*/ //deshalb werden hier Attributinstanzen und Flags benoetigt.
+/*N*/ SwFmtVertOrient aVert( pFmt->GetVertOrient() );
+/*N*/ SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
+/*N*/ BOOL bVertChgd = FALSE,
+/*N*/ bHoriChgd = FALSE,
+/*N*/ bMoveable = GetAnchor()->IsMoveable();
+/*N*/
+/*N*/ //Wird waehrend der Berechnung der vertikalen Position benutzt
+/*N*/ //und enthaelt hinterher den Frm, an dem sich die horizontale
+/*N*/ //Positionierung orientieren muss.
+/*N*/ const SwFrm *pOrient = GetAnchor();
+/*N*/
+/*N*/ // Dies wird der Frame, der das Zeichen eines am Zeichen gebundenen
+/*N*/ // Rahmens enthaelt.
+/*N*/ const SwFrm *pAutoOrient = pOrient;
+/*N*/
+/*N*/ SwRect *pAutoPos;
+/*N*/ if( FLY_AUTO_CNTNT == pFmt->GetAnchor().GetAnchorId() )
+/*N*/ {
+/*N*/ const SwFmtAnchor& rAnch = pFmt->GetAnchor();
+/*N*/ if( !aLastCharRect.Height() &&
+/*N*/ !((SwTxtFrm*)GetAnchor())->GetAutoPos( aLastCharRect,
+/*N*/ *rAnch.GetCntntAnchor() ) )
+/*N*/ return;
+/*N*/ pAutoPos = &aLastCharRect;
+/*N*/ pAutoOrient = ::binfilter::GetVirtualAnchor( this, rAnch.GetCntntAnchor()->
+/*N*/ nContent.GetIndex() );
+/*N*/ }
+/*N*/ else
+/*N*/ pAutoPos = NULL;
+/*N*/
+/*N*/ //Horizontale und vertikale Positionen werden getrennt berechnet.
+/*N*/ //Sie koennen jeweils Fix oder Variabel sein.
+/*N*/ SWRECTFN( pAutoOrient )
+/*N*/
+/*N*/ //Zuerst die vertikale Position, damit feststeht auf welcher Seite
+/*N*/ //bzw. in welchen Upper sich der Fly befindet.
+/*N*/ if ( aVert.GetVertOrient() != VERT_NONE )
+/*N*/ {
+/*N*/ pOrient = pAutoOrient;
+/*N*/ if( !pFooter )
+/*N*/ ::binfilter::DeepCalc( pOrient );
+/*N*/ SwTwips nHeight, nAdd;
+/*N*/ if ( aVert.GetRelationOrient() == PRTAREA )
+/*N*/ {
+/*N*/ nHeight = (pOrient->Prt().*fnRect->fnGetHeight)();
+/*N*/ nAdd = (pOrient->*fnRect->fnGetTopMargin)();
+/*N*/ }
+/*N*/ else if( pAutoPos && REL_CHAR == aVert.GetRelationOrient() )
+/*N*/ {
+/*N*/ nHeight = (pAutoPos->*fnRect->fnGetHeight)();
+/*N*/ nAdd = (*fnRect->fnYDiff)( (pAutoPos->*fnRect->fnGetTop)(),
+/*N*/ (pOrient->Frm().*fnRect->fnGetTop)() );
+/*N*/ }
+/*N*/ else
+/*N*/ { nHeight = (pOrient->Frm().*fnRect->fnGetHeight)();
+/*N*/ nAdd = 0;
+/*N*/ }
+/*N*/ SwTwips nRelPosY;
+/*N*/ SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( aVert.GetVertOrient() == VERT_CENTER )
+/*N*/ nRelPosY = (nHeight / 2) - (nFrmHeight / 2);
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nUpper = bVert ? rLR.GetRight() : rUL.GetUpper();
+/*N*/ if ( aVert.GetVertOrient() == VERT_BOTTOM )
+/*N*/ {
+/*N*/ if( bNoSurround )
+/*N*/ nRelPosY = nHeight + nUpper;
+/*N*/ else
+/*N*/ nRelPosY = nHeight - (nFrmHeight + ( bVert ?
+/*N*/ rLR.GetLeft() : rUL.GetLower()));
+/*N*/ }
+/*N*/ else if( pAutoPos && aVert.GetVertOrient() == VERT_CHAR_BOTTOM )
+/*N*/ {
+/*N*/ nRelPosY = nHeight + nUpper;
+/*N*/ if( bVert )
+/*N*/ nRelPosY += aFrm.Width();
+/*N*/ }
+/*N*/ else
+/*N*/ nRelPosY = nUpper;
+/*N*/ }
+/*N*/ nRelPosY += nAdd;
+/*N*/ SwTwips nOTop = (pOrient->Frm().*fnRect->fnGetTop)();
+/*N*/ SwTwips nBot = nRelPosY + nFrmHeight + (*fnRect->fnYDiff)( nOTop,
+/*N*/ (pOrient->GetUpper()->*fnRect->fnGetPrtBottom)());
+/*N*/ if( nBot > 0 )
+/*N*/ nRelPosY -= nBot;
+/*N*/ if( nRelPosY < 0 )
+/*N*/ nRelPosY = 0;
+/*N*/ //Da die relative Position immer zum Anker relativ ist, muss dessen
+/*N*/ //Entfernung zum virtuellen Anker aufaddiert werden.
+/*N*/ if ( GetAnchor() != pOrient )
+/*N*/ nRelPosY += (*fnRect->fnYDiff)( nOTop,
+/*N*/ (GetAnchor()->Frm().*fnRect->fnGetTop)());
+/*N*/ if ( nRelPosY != aVert.GetPos() )
+/*N*/ { aVert.SetPos( nRelPosY );
+/*N*/ bVertChgd = TRUE;
+/*N*/ }
+/*N*/ if( bVert )
+/*N*/ aRelPos.X() = nRelPosY;
+/*N*/ else
+/*N*/ aRelPos.Y() = nRelPosY;
+/*N*/ }
+/*N*/
+/*N*/ pOrient = aVert.GetVertOrient() == VERT_NONE ?
+/*N*/ GetAnchor()->GetUpper() : pAutoOrient->GetUpper();
+/*N*/ if( !pFooter )
+/*N*/ ::binfilter::DeepCalc( pOrient );
+/*N*/
+/*N*/ SwTwips nRelDiff = 0;
+/*N*/ if ( aVert.GetVertOrient() == VERT_NONE )
+/*N*/ {
+/*N*/ /// OD 02.10.2002 #102646# - NOTE
+/*N*/ /// local variable <nRel> for calculation of relative vertical
+/*N*/ /// distance to anchor.
+/*N*/ SwTwips nRel;
+/*N*/ if( pAutoPos && REL_CHAR == aVert.GetRelationOrient() )
+/*N*/ {
+/*N*/ nRel = (*fnRect->fnYDiff)( (pAutoPos->*fnRect->fnGetBottom)(),
+/*N*/ (pAutoOrient->Frm().*fnRect->fnGetTop)() );
+/*N*/ nRel -= aVert.GetPos();
+/*N*/ if( pAutoOrient != GetAnchor() )
+/*N*/ {
+/*N*/ SwTxtFrm* pTmp = (SwTxtFrm*)GetAnchor();
+/*N*/ SWREFRESHFN( pTmp )
+/*N*/ nRel -=(*fnRect->fnYDiff)((pTmp->Frm().*fnRect->fnGetTop)(),
+/*N*/ (pTmp->GetUpper()->*fnRect->fnGetPrtTop)());
+/*N*/ while( pTmp != pAutoOrient )
+/*N*/ {
+/*N*/ SWREFRESHFN( pTmp )
+/*N*/ nRel +=(pTmp->GetUpper()->Prt().*fnRect->fnGetHeight)();
+/*N*/ pTmp = pTmp->GetFollow();
+/*N*/ }
+/*N*/ SWREFRESHFN( pTmp )
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ /// OD 02.10.2002 #102646#
+/*N*/ /// consider that vertical position can be relativ to "margin"
+/*N*/ /// or to "text area".
+/*N*/ /// Thus, increase <nRel> by margin height, if position is
+/*N*/ /// vertical to "text area"
+/*N*/ nRel = aVert.GetPos();
+/*N*/ if ( aVert.GetRelationOrient() == PRTAREA )
+/*N*/ {
+/*N*/ nRel += (pAutoOrient->*fnRect->fnGetTopMargin)();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Einen einspaltigen Bereich koennen wir getrost ignorieren,
+/*N*/ // er hat keine Auswirkung auf die Fly-Position
+/*N*/ while( pOrient->IsSctFrm() )
+/*N*/ pOrient = pOrient->GetUpper();
+/*N*/ //pOrient ist das LayoutBlatt, das gerade verfolgt wird.
+/*N*/ //nRel enthaelt die noch zu verarbeitende relative Entfernung.
+/*N*/ //nAvail enthaelt die Strecke die im LayoutBlatt, das gerade
+/*N*/ // verfolgt wird zur Verfuegung steht.
+/*N*/
+/*N*/ if( nRel <= 0 )
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ aRelPos.X() = 0;
+/*N*/ else
+/*N*/ aRelPos.Y() = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SWREFRESHFN( GetAnchor() )
+/*N*/ SwTwips nAvail =
+/*N*/ (*fnRect->fnYDiff)( (pOrient->*fnRect->fnGetPrtBottom)(),
+/*N*/ (GetAnchor()->Frm().*fnRect->fnGetTop)());
+/*N*/ const BOOL bFtn = GetAnchor()->IsInFtn();
+/*N*/ while ( nRel )
+/*N*/ { if ( nRel <= nAvail ||
+/*N*/ (bBrowse &&
+/*N*/ ((SwFrm*)pOrient)->Grow( nRel-nAvail, TRUE)) ||
+/*N*/ (pOrient->IsInTab() && bGrow &&
+/*N*/ ((SwFrm*)pOrient)->Grow( nRel-nAvail, TRUE)))
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ aRelPos.X() = GetAnchor()->Frm().Left() +
+/*N*/ GetAnchor()->Frm().Width() -
+/*N*/ pOrient->Frm().Left() -
+/*N*/ pOrient->Prt().Left() - nAvail + nRel;
+/*N*/ else
+/*N*/ aRelPos.Y() = pOrient->Frm().Top() +
+/*N*/ pOrient->Prt().Top() + pOrient->Prt().Height()
+/*N*/ - nAvail + nRel - GetAnchor()->Frm().Top();
+/*N*/ if ( ( bBrowse || ( pOrient->IsInTab() && bGrow ) )
+/*N*/ && nRel - nAvail > 0 )
+/*N*/ {
+/*N*/ nRel = ((SwFrm*)pOrient)->Grow( nRel-nAvail );
+/*N*/ SwFrm *pTmp = (SwFrm*) pOrient->FindPageFrm();
+/*N*/ ::binfilter::ValidateSz( pTmp );
+/*N*/ bInvalidatePage = TRUE;
+/*N*/ //Schon mal einstellen, weil wir wahrscheinlich
+/*N*/ //wegen Invalidierung eine Ehrenrunde drehen.
+/*N*/ if( bVert )
+/*N*/ aFrm.Pos().X() = aFrm.Left() - nRel;
+/*N*/ else
+/*N*/ aFrm.Pos().Y() = aFrm.Top() + nRel;
+/*N*/ }
+/*N*/ nRel = 0;
+/*N*/ }
+/*N*/ else if ( bMoveable )
+/*N*/ { //Dem Textfluss folgen.
+/*N*/ nRel -= nAvail;
+/*N*/ const BOOL bSct = pOrient->IsInSct();
+/*N*/ MakePageType eMakePage = bFtn ? MAKEPAGE_NONE
+/*N*/ : MAKEPAGE_APPEND;
+/*N*/ if( bSct )
+/*N*/ eMakePage = MAKEPAGE_NOSECTION;
+/*N*/ const SwFrm *pTmp = pOrient->
+/*N*/ GetLeaf( eMakePage, TRUE, GetAnchor() );
+/*N*/ if ( pTmp && ( !bSct || pOrient->FindSctFrm()->
+/*N*/ IsAnFollow( pTmp->FindSctFrm() ) ) )
+/*N*/ {
+/*N*/ pOrient = pTmp;
+/*N*/ bMoveable =
+/*N*/ ::binfilter::lcl_IsMoveable( this, (SwLayoutFrm*)pOrient);
+/*N*/ if( !pFooter )
+/*N*/ ::binfilter::DeepCalc( pOrient );
+/*N*/ SWREFRESHFN( pOrient )
+/*N*/ nAvail = (pOrient->Prt().*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Wenn wir innerhalb des (spaltigen) Bereichs nicht genug
+/*N*/ // Platz ist, wird es Zeit, diesen zu verlassen. Wir gehen
+/*N*/ // also in seinen Upper und nehmen als nAvail den Platz, der
+/*N*/ // hinter dem Bereich ist. Sollte dieser immer noch nicht
+/*N*/ // ausreichen, wandern wir weiter, es hindert uns aber nun
+/*N*/ // niemand mehr, neue Seiten anzulegen.
+/*N*/ if( bSct )
+/*N*/ {
+/*N*/ const SwFrm* pSct = pOrient->FindSctFrm();
+/*N*/ pOrient = pSct->GetUpper();
+/*N*/ nAvail = (*fnRect->fnYDiff)(
+/*N*/ (pOrient->*fnRect->fnGetPrtBottom)(),
+/*N*/ (pSct->*fnRect->fnGetPrtBottom)() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nRelDiff = nRel;
+/*N*/ nRel = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nRel = 0;
+/*N*/ }
+/*N*/ if ( !bValidPos )
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ //Damit das Teil ggf. auf die richtige Seite gestellt und in die
+/*N*/ //PrtArea des LayLeaf gezogen werden kann, muss hier seine
+/*N*/ //absolute Position berechnet werden.
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ aFrm.Pos().X() = GetAnchor()->Frm().Left() - aFrm.Width() +
+/*N*/ GetAnchor()->Frm().Width() - aRelPos.X() +nRelDiff;
+/*N*/ }
+/*N*/ else
+/*N*/ aFrm.Pos().Y() = GetAnchor()->Frm().Top() +
+/*N*/ (aRelPos.Y() - nRelDiff);
+/*N*/
+/*N*/ //Bei automatischer Ausrichtung nicht ueber die Oberkante hinausschiessen.
+/*N*/ if ( aVert.GetVertOrient() != VERT_NONE )
+/*N*/ {
+/*N*/ SwTwips nTop;
+/*N*/ if ( aVert.GetRelationOrient() == PRTAREA )
+/*N*/ nTop = (pOrient->*fnRect->fnGetPrtTop)();
+/*N*/ else
+/*N*/ nTop = (pOrient->Frm().*fnRect->fnGetTop)();
+/*N*/ SwTwips nTmp = (Frm().*fnRect->fnGetTop)();
+/*N*/ if( (nTmp = (fnRect->fnYDiff)( nTmp, nTop ) ) < 0 )
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ aFrm.Pos().X() += nTmp;
+/*N*/ aRelPos.X() = nTop - GetAnchor()->Frm().Left()
+/*N*/ - GetAnchor()->Frm().Width();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrm.Pos().Y() = nTop;
+/*N*/ aRelPos.Y() = nTop - GetAnchor()->Frm().Top();
+/*N*/ }
+/*N*/ bHeightClipped = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const BOOL bFtn = GetAnchor()->IsInFtn();
+/*N*/ while( pOrient->IsSctFrm() )
+/*N*/ pOrient = pOrient->GetUpper();
+/*N*/ SwTwips nDist = (aFrm.*fnRect->fnBottomDist)(
+/*N*/ (pOrient->*fnRect->fnGetPrtBottom)() );
+/*N*/ if( nDist < 0 )
+/*N*/ {
+/*N*/ if( ( bBrowse && GetAnchor()->IsMoveable() ) ||
+/*N*/ ( GetAnchor()->IsInTab() && bGrow ) )
+/*N*/ {
+/*N*/ ((SwFrm*)pOrient)->Grow( -nDist );
+/*N*/ SwFrm *pTmp = (SwFrm*) pOrient->FindPageFrm();
+/*N*/ ::binfilter::ValidateSz( pTmp );
+/*N*/ bInvalidatePage = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ nDist = (aFrm.*fnRect->fnBottomDist)(
+/*N*/ (pOrient->*fnRect->fnGetPrtBottom)() );
+/*N*/ while( bMoveable && nDist < 0 )
+/*N*/ {
+/*N*/ // Vorsicht, auch innerhalb von Bereichen duerfen keine neuen Seiten angelegt werden
+/*N*/ BOOL bSct = pOrient->IsInSct();
+/*N*/ if( bSct )
+/*N*/ {
+/*N*/ const SwFrm* pTmp = pOrient->FindSctFrm()->GetUpper();
+/*N*/ nDist = (aFrm.*fnRect->fnBottomDist)(
+/*N*/ (pTmp->*fnRect->fnGetPrtBottom)() );
+/*N*/ if( nDist < 0 )
+/*N*/ pOrient = pTmp;
+/*N*/ else
+/*N*/ break;
+/*N*/ bSct = pOrient->IsInSct();
+/*N*/ }
+/*N*/ if( !bSct && (Frm().*fnRect->fnGetTop)() ==
+/*N*/ (pOrient->*fnRect->fnGetPrtTop)() )
+/*N*/ //Das teil passt nimmer, da hilft auch kein moven.
+/*N*/ break;
+/*N*/
+/*N*/ const SwLayoutFrm *pNextLay = pOrient->GetLeaf( bSct ?
+/*N*/ MAKEPAGE_NOSECTION : bFtn ? MAKEPAGE_NONE : MAKEPAGE_APPEND,
+/*N*/ TRUE, GetAnchor() );
+/*N*/ if( pNextLay )
+/*N*/ {
+/*N*/ SWRECTFNX( pNextLay )
+/*N*/ if( !bSct || ( pOrient->FindSctFrm()->IsAnFollow(
+/*N*/ pNextLay->FindSctFrm() ) &&
+/*N*/ (pNextLay->Prt().*fnRectX->fnGetHeight)() ) )
+/*N*/ {
+/*N*/ if( !pFooter )
+/*N*/ ::binfilter::DeepCalc( pNextLay );
+/*N*/ if( bVertX )
+/*N*/ aRelPos.X() = GetAnchor()->Frm().Left() +
+/*N*/ GetAnchor()->Frm().Width() -
+/*N*/ pNextLay->Frm().Left() -
+/*N*/ pNextLay->Prt().Left()-
+/*N*/ pNextLay->Prt().Width();
+/*N*/ else
+/*N*/ aRelPos.Y() = pNextLay->Frm().Top() +
+/*N*/ pNextLay->Prt().Top() -GetAnchor()->Frm().Top();
+/*N*/ pOrient = pNextLay;
+/*N*/ SWREFRESHFN( pOrient )
+/*N*/ bMoveable = ::binfilter::lcl_IsMoveable( this,
+/*N*/ (SwLayoutFrm*)pOrient );
+/*N*/ if ( bMoveable && !pFooter )
+/*N*/ ::binfilter::DeepCalc( pOrient );
+/*N*/ if( bVertX )
+/*N*/ aFrm.Pos().X() = GetAnchor()->Frm().Left()
+/*N*/ + GetAnchor()->Frm().Width()
+/*N*/ - aRelPos.X() - aFrm.Width();
+/*N*/ else
+/*N*/ aFrm.Pos().Y() = GetAnchor()->Frm().Top()
+/*N*/ + aRelPos.Y();
+/*N*/ nDist = (aFrm.*fnRect->fnBottomDist)(
+/*N*/ (pOrient->*fnRect->fnGetPrtBottom)() );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( bSct )
+/*N*/ {
+/*N*/ // Wenn wir innerhalb des Bereich nicht genug Platz haben, gucken
+/*N*/ // wir uns mal die Seite an.
+/*N*/ const SwFrm* pTmp = pOrient->FindSctFrm()->GetUpper();
+/*N*/ nDist = (aFrm.*fnRect->fnBottomDist)(
+/*N*/ (pTmp->*fnRect->fnGetPrtBottom)() );
+/*N*/ if( nDist < 0 )
+/*N*/ pOrient = pTmp;
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ else
+/*N*/ bMoveable = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ AssertPage();
+/*N*/
+/*N*/ //Horizontale Ausrichtung.
+/*N*/ //Die absolute Pos in der vertikalen muss schon mal eingestellt
+/*N*/ //werden, sonst habe ich Schwierigkeiten den virtuellen Anker
+/*N*/ //zu ermitteln.
+/*N*/ if( bVert )
+/*N*/ aFrm.Pos().X() = GetAnchor()->Frm().Left() - aFrm.Width() +
+/*N*/ GetAnchor()->Frm().Width() - aRelPos.X();
+/*N*/ else
+/*N*/ aFrm.Pos().Y() = aRelPos.Y() + GetAnchor()->Frm().Top();
+/*N*/ //Den Frm besorgen, an dem sich die horizontale Ausrichtung orientiert.
+/*N*/ pOrient = ::binfilter::GetVirtualHoriAnchor( pOrient, this );
+/*N*/
+/*N*/ if( !pFooter )
+/*N*/ ::binfilter::DeepCalc( pOrient );
+/*N*/
+/*N*/ // Achtung: pPage ist nicht unbedingt ein PageFrm, es kann auch ein
+/*N*/ // SwFlyFrm oder SwCellFrm dahinterstecken
+/*N*/ const SwFrm *pPage = pOrient;
+/*N*/ while( !pPage->IsPageFrm() && !pPage->IsFlyFrm() && !pPage->IsCellFrm() )
+/*N*/ {
+/*N*/ ASSERT( pPage->GetUpper(), "MakeFlyPos: No Page/FlyFrm Found" );
+/*N*/ pPage = pPage->GetUpper();
+/*N*/ }
+/*N*/
+/*N*/ const BOOL bEven = !pPage->OnRightPage();
+/*N*/ const BOOL bToggle = aHori.IsPosToggle() && bEven;
+/*N*/ BOOL bTmpToggle = bToggle;
+/*N*/ BOOL bPageRel = FALSE;
+/*N*/ SwTwips nWidth, nAdd;
+/*N*/ SWREFRESHFN( pOrient )
+/*N*/ switch ( aHori.GetRelationOrient() )
+/*N*/ {
+/*N*/ case PRTAREA:
+/*N*/ {
+/*N*/ nWidth = (pOrient->Prt().*fnRect->fnGetWidth)();
+/*N*/ nAdd = (pOrient->*fnRect->fnGetLeftMargin)();
+/*N*/ if ( pOrient->IsTxtFrm() )
+/*N*/ nAdd += ((SwTxtFrm*)pOrient)->GetBaseOfstForFly( !bWrapThrough );
+/*N*/ break;
+/*N*/ }
+/*N*/ case REL_PG_LEFT:
+/*N*/ bTmpToggle = !bToggle;
+/*N*/ // kein break;
+/*N*/ case REL_PG_RIGHT:
+/*N*/ {
+/*N*/ if ( bTmpToggle ) // linker Seitenrand
+/*N*/ {
+/*N*/ nAdd = (*fnRect->fnXDiff)((pPage->Frm().*fnRect->fnGetLeft)(),
+/*N*/ (pOrient->Frm().*fnRect->fnGetLeft)());
+/*N*/ nWidth = (pPage->*fnRect->fnGetLeftMargin)();
+/*N*/ }
+/*N*/ else // rechter Seitenrand
+/*N*/ {
+/*N*/ nAdd = (*fnRect->fnXDiff)((pPage->*fnRect->fnGetPrtRight)(),
+/*N*/ (pOrient->Frm().*fnRect->fnGetLeft)());
+/*N*/ nWidth = (pPage->*fnRect->fnGetRightMargin)();
+/*N*/ }
+/*N*/ bPageRel = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case REL_FRM_LEFT:
+/*N*/ bTmpToggle = !bToggle;
+/*N*/ // kein break;
+/*N*/ case REL_FRM_RIGHT:
+/*N*/ {
+/*N*/ if ( bTmpToggle ) // linker Absatzrand
+/*N*/ {
+/*N*/ nWidth = (pOrient->*fnRect->fnGetLeftMargin)();
+/*N*/ nAdd = 0;
+/*N*/ }
+/*N*/ else // rechter Absatzrand
+/*N*/ {
+/*N*/ nWidth = (pOrient->*fnRect->fnGetRightMargin)();
+/*N*/ nAdd = (pOrient->Frm().*fnRect->fnGetWidth)()-nWidth;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ case REL_CHAR:
+/*N*/ {
+/*N*/ if( pAutoPos )
+/*N*/ {
+/*N*/ nWidth = 0;
+/*N*/ nAdd = (*fnRect->fnXDiff)( (pAutoPos->*fnRect->fnGetLeft)(),
+/*N*/ (pAutoOrient->Frm().*fnRect->fnGetLeft)() );
+/*N*/ break;
+/*N*/ }
+/*N*/ // No Break!
+/*N*/ }
+/*N*/ case REL_PG_PRTAREA:
+/*N*/ {
+/*N*/ nWidth = (pPage->Prt().*fnRect->fnGetWidth)();
+/*N*/ nAdd = (*fnRect->fnXDiff)( (pPage->*fnRect->fnGetPrtLeft)(),
+/*N*/ (pOrient->Frm().*fnRect->fnGetLeft)());
+/*N*/ bPageRel = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ case REL_PG_FRAME:
+/*N*/ {
+/*N*/ nWidth = (pPage->Frm().*fnRect->fnGetWidth)();
+/*N*/ nAdd = (*fnRect->fnXDiff)( (pPage->Frm().*fnRect->fnGetLeft)(),
+/*N*/ (pOrient->Frm().*fnRect->fnGetLeft)());
+/*N*/ bPageRel = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/ default:
+/*N*/ {
+/*N*/ nWidth = (pOrient->Frm().*fnRect->fnGetWidth)();
+/*N*/ nAdd = pOrient->IsTxtFrm() ?
+/*N*/ ((SwTxtFrm*)pOrient)->GetBaseOfstForFly( !bWrapThrough ) :
+/*N*/ 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ SwTwips nRelPosX = nAdd;
+/*N*/ sal_Bool bR2L = GetAnchor()->IsRightToLeft();
+/*N*/ if ( aHori.GetHoriOrient() == HORI_NONE )
+/*N*/ {
+/*N*/ if( pAutoPos && REL_CHAR == aHori.GetRelationOrient() )
+/*N*/ {
+/*N*/ if( bR2L )
+/*N*/ nRelPosX -= aHori.GetPos();
+/*N*/ else
+/*N*/ nRelPosX += aHori.GetPos();
+/*N*/ }
+/*N*/ else if( bToggle || ( !aHori.IsPosToggle() && bR2L ) )
+/*N*/ nRelPosX = nWidth - aFrm.Width() - aHori.GetPos() +
+/*N*/ ( bR2L ? nAdd : 0 );
+/*N*/ else
+/*N*/ nRelPosX += aHori.GetPos();
+/*N*/ //Da die relative Position immer zum Anker relativ ist,
+/*N*/ //muss dessen Entfernung zum virtuellen Anker aufaddiert werden.
+/*N*/ if ( GetAnchor() != pOrient )
+/*N*/ {
+/*N*/ long nTmp = (pOrient->Frm().*fnRect->fnGetLeft)();
+/*N*/ nRelPosX += (*fnRect->fnXDiff)( nTmp,
+/*N*/ (GetAnchor()->Frm().*fnRect->fnGetLeft)() );
+/*N*/ //fix(18546): Kleine Notbremse, wenn der Rahmen jetzt so positioniert
+/*N*/ //wird, dass er den Anker verdraengt, muessen wir unbedingt agieren.
+/*N*/ //fix(22698): in Ergaenzung zu obigem Bug passen wir jetzt etwas
+/*N*/ //grundlicher auf.
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ if( !bPageRel && nTmp > pAnchor->Frm().Bottom() &&
+/*N*/ Frm().Right() > GetAnchor()->Frm().Left() )
+/*N*/ {
+/*N*/ nTmp = nRelPosX + GetAnchor()->Frm().Top();
+/*N*/ if( nTmp < GetAnchor()->Frm().Bottom() )
+/*N*/ nRelPosX = GetAnchor()->Frm().Height() + 1;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !bPageRel && nTmp > pAnchor->Frm().Right() &&
+/*N*/ Frm().Top() < GetAnchor()->Frm().Bottom() )
+/*N*/ {
+/*N*/ nTmp = aRelPos.X() + GetAnchor()->Frm().Left();
+/*N*/ if ( nTmp < GetAnchor()->Frm().Right() )
+/*N*/ nRelPosX = GetAnchor()->Frm().Width()+1;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ if( GetAnchor()->Frm().Top() + nRelPosX + aFrm.Height() >
+/*N*/ pPage->Frm().Bottom() )
+/*N*/ nRelPosX = pPage->Frm().Bottom() - GetAnchor()->Frm().Top()
+/*N*/ - aFrm.Height();
+/*N*/ if( GetAnchor()->Frm().Top() + nRelPosX < pPage->Frm().Top() )
+/*N*/ nRelPosX = pPage->Frm().Top() - GetAnchor()->Frm().Top();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( GetAnchor()->Frm().Left() + nRelPosX + aFrm.Width() >
+/*N*/ pPage->Frm().Right() )
+/*N*/ nRelPosX = pPage->Frm().Right() -
+/*N*/ GetAnchor()->Frm().Left() - aFrm.Width();
+/*N*/ if( GetAnchor()->Frm().Left() + nRelPosX < pPage->Frm().Left() )
+/*N*/ nRelPosX = pPage->Frm().Left() - GetAnchor()->Frm().Left();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwHoriOrient eHOri = aHori.GetHoriOrient();
+/*N*/ SwRelationOrient eRelO = aHori.GetRelationOrient();
+/*N*/ if( bToggle )
+/*N*/ {
+/*N*/ if( HORI_RIGHT == eHOri )
+/*N*/ eHOri = HORI_LEFT;
+/*N*/ else if( HORI_LEFT == eHOri )
+/*N*/ eHOri = HORI_RIGHT;
+/*N*/ if( REL_PG_RIGHT == eRelO )
+/*N*/ eRelO = REL_PG_LEFT;
+/*N*/ else if( REL_PG_LEFT == eRelO )
+/*N*/ eRelO = REL_PG_RIGHT;
+/*N*/ else if( REL_FRM_RIGHT == eRelO )
+/*N*/ eRelO = REL_FRM_LEFT;
+/*N*/ else if( REL_FRM_LEFT == eRelO )
+/*N*/ eRelO = REL_FRM_RIGHT;
+/*N*/ }
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ if ( eHOri == HORI_CENTER )
+/*N*/ nRelPosX = (nWidth / 2) - (aFrm.Height() / 2);
+/*N*/ else if ( eHOri == HORI_RIGHT )
+/*N*/ nRelPosX = nWidth - (aFrm.Height() + rUL.GetLower());
+/*N*/ else
+/*N*/ nRelPosX = rUL.GetUpper();
+/*N*/ nRelPosX += nAdd;
+/*N*/
+/*N*/ if( GetAnchor() != pOrient )
+/*N*/ nRelPosX += pOrient->Frm().Top() -
+/*N*/ GetAnchor()->Frm().Top();
+/*N*/
+/*N*/ if( GetAnchor()->Frm().Top() + nRelPosX + aFrm.Height() >
+/*N*/ pPage->Frm().Bottom() )
+/*N*/ nRelPosX = pPage->Frm().Bottom() - GetAnchor()->Frm().Top()
+/*N*/ - aFrm.Height();
+/*N*/ if( GetAnchor()->Frm().Top() + nRelPosX < pPage->Frm().Top() )
+/*N*/ nRelPosX = pPage->Frm().Top() - GetAnchor()->Frm().Top();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( eHOri == HORI_CENTER )
+/*N*/ nRelPosX = (nWidth / 2) - (aFrm.Width() / 2);
+/*N*/ else if ( eHOri == HORI_RIGHT )
+/*N*/ nRelPosX = nWidth - (aFrm.Width() + rLR.GetRight());
+/*N*/ else
+/*N*/ nRelPosX = rLR.GetLeft();
+/*N*/ nRelPosX += nAdd;
+/*N*/
+/*N*/ //Da die relative Position immer zum Anker relativ ist,
+/*N*/ //muss dessen Entfernung zum virtuellen Anker aufaddiert werden.
+/*N*/ if( GetAnchor() != pOrient )
+/*N*/ nRelPosX += pOrient->Frm().Left() -
+/*N*/ GetAnchor()->Frm().Left();
+/*N*/ if( GetAnchor()->Frm().Left() + nRelPosX + aFrm.Width() >
+/*N*/ pPage->Frm().Right() )
+/*N*/ nRelPosX = pPage->Frm().Right() - GetAnchor()->Frm().Left()
+/*N*/ - aFrm.Width();
+/*N*/ if( GetAnchor()->Frm().Left() + nRelPosX < pPage->Frm().Left() )
+/*N*/ nRelPosX = pPage->Frm().Left() - GetAnchor()->Frm().Left();
+/*N*/ }
+/*N*/
+/*N*/ //Es muss allen Rahmen ausgewichen werden, die die selbe
+/*N*/ //automatische Ausrichtung haben und die unter dem Rahmen liegen.
+/*N*/ if ( HORI_CENTER != eHOri && REL_CHAR != eRelO )
+/*N*/ {
+/*N*/ Point aTmpPos = (GetAnchor()->Frm().*fnRect->fnGetPos)();
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ aTmpPos.X() -= aRelPos.X() + aFrm.Width();
+/*N*/ aTmpPos.Y() += nRelPosX;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aTmpPos.X() += nRelPosX;
+/*N*/ aTmpPos.Y() += aRelPos.Y();
+/*N*/ }
+/*N*/ SwRect aTmpFrm( aTmpPos, Frm().SSize() );
+/*N*/ const UINT32 nMyOrd = GetVirtDrawObj()->GetOrdNum();
+/*N*/ const SwPageFrm *pPage = FindPageFrm();
+/*N*/ SwOrderIter aIter( pPage, TRUE );
+/*N*/ const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)aIter.Bottom())->GetFlyFrm();
+/*N*/ const SwFrm *pKontext = ::binfilter::FindKontext( GetAnchor(), FRM_COLUMN );
+/*N*/ ULONG nMyIndex = ((SwTxtFrm*)GetAnchor())->GetTxtNode()->GetIndex();
+/*N*/ while ( pFly && nMyOrd > pFly->GetVirtDrawObj()->GetOrdNumDirect() )
+/*N*/ {
+/*N*/ if ( pFly->IsFlyAtCntFrm() && //pFly->IsValid() &&
+/*N*/ (pFly->Frm().*fnRect->fnBottomDist)(
+/*N*/ (aTmpFrm.*fnRect->fnGetTop)() ) < 0 &&
+/*N*/ (aTmpFrm.*fnRect->fnBottomDist)(
+/*N*/ (pFly->Frm().*fnRect->fnGetTop)() ) < 0 &&
+/*N*/ ::binfilter::FindKontext( pFly->GetAnchor(), FRM_COLUMN ) == pKontext )
+/*N*/ {
+/*N*/ ULONG nOtherIndex = ((SwTxtFrm*)pFly->GetAnchor())
+/*N*/ ->GetTxtNode()->GetIndex();
+/*N*/ if( nMyIndex >= nOtherIndex )
+/*N*/ {
+/*N*/ const SwFmtHoriOrient &rHori =
+/*N*/ pFly->GetFmt()->GetHoriOrient();
+/*N*/ SwRelationOrient eRelO2 = rHori.GetRelationOrient();
+/*N*/ if( REL_CHAR != eRelO2 )
+/*N*/ {
+/*N*/ SwHoriOrient eHOri2 = rHori.GetHoriOrient();
+/*N*/ if( bEven && rHori.IsPosToggle() )
+/*N*/ {
+/*N*/ if( HORI_RIGHT == eHOri2 )
+/*N*/ eHOri2 = HORI_LEFT;
+/*N*/ else if( HORI_LEFT == eHOri2 )
+/*N*/ eHOri2 = HORI_RIGHT;
+/*N*/ if( REL_PG_RIGHT == eRelO2 )
+/*N*/ eRelO2 = REL_PG_LEFT;
+/*N*/ else if( REL_PG_LEFT == eRelO2 )
+/*N*/ eRelO2 = REL_PG_RIGHT;
+/*N*/ else if( REL_FRM_RIGHT == eRelO2 )
+/*N*/ eRelO2 = REL_FRM_LEFT;
+/*N*/ else if( REL_FRM_LEFT == eRelO2 )
+/*N*/ eRelO2 = REL_FRM_RIGHT;
+/*N*/ }
+/*N*/ if ( eHOri2 == eHOri &&
+/*N*/ lcl_Minor( eRelO, eRelO2, HORI_LEFT == eHOri ) )
+/*N*/ {
+/*N*/ //Die Berechnung wird dadurch etwas aufwendiger, das die
+/*N*/ //Ausgangsbasis der Flys unterschiedlich sein koennen.
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ const SvxULSpaceItem &rULI = pFly->GetFmt()->GetULSpace();
+/*N*/ const SwTwips nFlyTop = pFly->Frm().Top() - rULI.GetUpper();
+/*N*/ const SwTwips nFlyBot = pFly->Frm().Bottom() + rULI.GetLower();
+/*N*/ if( nFlyTop <= aTmpFrm.Bottom() + rUL.GetLower() &&
+/*N*/ nFlyBot >= aTmpFrm.Top() - rUL.GetUpper() )
+/*N*/ {
+/*N*/ if ( eHOri == HORI_LEFT )
+/*N*/ {
+/*N*/ SwTwips nTmp = nFlyBot + 1
+/*N*/ + rUL.GetUpper()
+/*N*/ - GetAnchor()->Frm().Top();
+/*N*/ if( nTmp > nRelPosX &&
+/*N*/ nTmp + Frm().Height() +
+/*N*/ GetAnchor()->Frm().Top() +
+/*N*/ rUL.GetLower() <=
+/*N*/ pPage->Frm().Height() +
+/*N*/ pPage->Frm().Top() )
+/*N*/ {
+/*N*/ nRelPosX = nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( eHOri == HORI_RIGHT )
+/*N*/ {
+/*N*/ SwTwips nTmp = nFlyTop - 1
+/*N*/ - rUL.GetLower()
+/*N*/ - Frm().Height()
+/*N*/ - GetAnchor()->Frm().Top();
+/*N*/ if( nTmp < nRelPosX &&
+/*N*/ nTmp - rUL.GetUpper() +
+/*N*/ GetAnchor()->Frm().Top()
+/*N*/ >= pPage->Frm().Top() )
+/*N*/ {
+/*N*/ nRelPosX = nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ aTmpFrm.Pos().Y() = GetAnchor()->Frm().Top() + nRelPosX;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SvxLRSpaceItem &rLRI = pFly->GetFmt()->GetLRSpace();
+/*N*/ const SwTwips nFlyLeft = pFly->Frm().Left() - rLRI.GetLeft();
+/*N*/ const SwTwips nFlyRight = pFly->Frm().Right() + rLRI.GetRight();
+/*N*/ if( nFlyLeft <= aTmpFrm.Right() + rLR.GetRight() &&
+/*N*/ nFlyRight >= aTmpFrm.Left() - rLR.GetLeft() )
+/*N*/ {
+/*N*/ if ( eHOri == HORI_LEFT )
+/*N*/ {
+/*N*/ SwTwips nTmp = nFlyRight + 1
+/*N*/ + rLR.GetLeft()
+/*N*/ - GetAnchor()->Frm().Left();
+/*N*/ if( nTmp > nRelPosX &&
+/*N*/ nTmp + Frm().Width() +
+/*N*/ GetAnchor()->Frm().Left() +
+/*N*/ rLR.GetRight() <=
+/*N*/ pPage->Frm().Width() +
+/*N*/ pPage->Frm().Left() )
+/*N*/ {
+/*N*/ nRelPosX = nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( eHOri == HORI_RIGHT )
+/*N*/ {
+/*N*/ SwTwips nTmp = nFlyLeft - 1
+/*N*/ - rLR.GetRight()
+/*N*/ - Frm().Width()
+/*N*/ - GetAnchor()->Frm().Left();
+/*N*/ if( nTmp < nRelPosX &&
+/*N*/ nTmp - rLR.GetLeft() +
+/*N*/ GetAnchor()->Frm().Left()
+/*N*/ >= pPage->Frm().Left() )
+/*N*/ {
+/*N*/ nRelPosX = nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ aTmpFrm.Pos().X() = GetAnchor()->Frm().Left() + nRelPosX;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pFly = ((SwVirtFlyDrawObj*)aIter.Next())->GetFlyFrm();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( aHori.GetPos() != nRelPosX )
+/*N*/ { aHori.SetPos( nRelPosX );
+/*N*/ bHoriChgd = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ if( bVert )
+/*N*/ aRelPos.Y() = nRelPosX;
+/*N*/ else
+/*N*/ aRelPos.X() = nRelPosX;
+/*N*/ AssertPage();
+/*N*/
+/*N*/ //Die AbsPos ergibt sich aus der Absoluten Position des Ankers
+/*N*/ //plus der relativen Position
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ aFrm.Pos().X() = GetAnchor()->Frm().Left() +
+/*N*/ GetAnchor()->Frm().Width() -
+/*N*/ aFrm.Width() - aRelPos.X();
+/*N*/ aFrm.Pos().Y() = GetAnchor()->Frm().Top() + aRelPos.Y();
+/*N*/ AssertPage();
+/*N*/ }
+/*N*/ else
+/*N*/ aFrm.Pos( aRelPos + GetAnchor()->Frm().Pos() );
+/*N*/ //Und ggf. noch die aktuellen Werte im Format updaten, dabei darf
+/*N*/ //zu diesem Zeitpunkt natuerlich kein Modify verschickt werden.
+/*N*/ pFmt->LockModify();
+/*N*/ if ( bVertChgd )
+/*N*/ pFmt->SetAttr( aVert );
+/*N*/ if ( bHoriChgd )
+/*N*/ pFmt->SetAttr( aHori );
+/*N*/ pFmt->UnlockModify();
+/*N*/
+/*N*/ break;
+/*N*/ } /// OD 02.10.2002 #102646# - End of loop
+/*N*/
+/*N*/ if ( bInvalidatePage )
+/*N*/ FindPageFrm()->InvalidateSize();
+/*N*/ if ( !bValidPos && !GetAnchor()->IsValid() )
+/*N*/ {
+/*N*/ // ASSERT( StackHack::IsLocked(), "invalid Anchor" );
+/*N*/ bValidPos = TRUE;
+/*N*/ }
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_flyincnt.cxx b/binfilter/bf_sw/source/core/layout/sw_flyincnt.cxx
new file mode 100644
index 000000000000..5acfbc62c0d2
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_flyincnt.cxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "frmtool.hxx"
+#include "frmfmt.hxx"
+#include "hints.hxx"
+
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include "txtfrm.hxx" //fuer IsLocked()
+#include "flyfrms.hxx"
+namespace binfilter {
+
+//aus FlyCnt.cxx
+/*N*/ void DeepCalc( const SwFrm *pFrm );
+
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::SwFlyInCntFrm(), ~SwFlyInCntFrm()
+|*
+|* Ersterstellung MA 01. Dec. 92
+|* Letzte Aenderung MA 09. Apr. 99
+|*
+|*************************************************************************/
+/*N*/ SwFlyInCntFrm::SwFlyInCntFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) :
+/*N*/ SwFlyFrm( pFmt, pAnch )
+/*N*/ {
+/*N*/ bInCnt = bInvalidLayout = bInvalidCntnt = TRUE;
+/*N*/ SwTwips nRel = pFmt->GetVertOrient().GetPos();
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ if( pAnch && pAnch->IsVertical() )
+/*?*/ aRelPos.X() = pAnch->IsReverse() ? nRel : -nRel;
+/*N*/ else
+/*N*/ #endif
+/*N*/ aRelPos.Y() = nRel;
+/*N*/ }
+
+/*N*/ SwFlyInCntFrm::~SwFlyInCntFrm()
+/*N*/ {
+/*N*/ //und Tschuess.
+/*N*/ if ( !GetFmt()->GetDoc()->IsInDtor() && GetAnchor() )
+/*N*/ {
+/*N*/ SwRect aTmp( AddSpacesToFrm() );
+/*N*/ SwFlyInCntFrm::NotifyBackground( FindPageFrm(), aTmp, PREP_FLY_LEAVE );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::SetRefPoint(),
+|*
+|* Ersterstellung MA 01. Dec. 92
+|* Letzte Aenderung MA 06. Aug. 95
+|*
+|*************************************************************************/
+/*M*/ void SwFlyInCntFrm::SetRefPoint( const Point& rPoint, const Point& rRelAttr,
+/*M*/ const Point& rRelPos )
+/*M*/ {
+/*M*/ ASSERT( rPoint != aRef || rRelAttr != aRelPos, "SetRefPoint: no change" );
+/*M*/ SwFlyNotify *pNotify = NULL;
+/*M*/ // No notify at a locked fly frame, if a fly frame is locked, there's
+/*M*/ // already a SwFlyNotify object on the stack (MakeAll).
+/*M*/ if( !IsLocked() )
+/*M*/ pNotify = new SwFlyNotify( this );
+/*M*/ aRef = rPoint;
+/*M*/ aRelPos = rRelAttr;
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ SWRECTFN( GetAnchor() )
+/*M*/ (Frm().*fnRect->fnSetPos)( rPoint + rRelPos );
+/*M*/ #else
+/*M*/ Frm().Pos( rPoint + rRelPos );
+/*M*/ #endif
+/*
+ //Kein InvalidatePos hier, denn das wuerde dem Cntnt ein Prepare
+ //senden - dieser hat uns aber gerade gerufen.
+ //Da der Frm aber durchaus sein Position wechseln kann, muss hier
+ //der von ihm abdeckte Window-Bereich invalidiert werden damit keine
+ //Reste stehenbleiben.
+ //Fix: Nicht fuer PreView-Shells, dort ist es nicht notwendig und
+ //fuehrt zu fiesen Problemen (Der Absatz wird nur formatiert weil
+ //er gepaintet wird und der Cache uebergelaufen ist, beim Paint durch
+ //das Invalidate wird der Absatz formatiert weil...)
+ if ( Frm().HasArea() && GetShell()->ISA(SwCrsrShell) )
+ GetShell()->InvalidateWindows( Frm() );
+*/
+/*M*/ if( pNotify )
+/*M*/ {
+/*M*/ InvalidatePage();
+/*M*/ bValidPos = FALSE;
+/*M*/ bInvalid = TRUE;
+/*M*/ Calc();
+/*M*/ delete pNotify;
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::Modify()
+|*
+|* Ersterstellung MA 16. Dec. 92
+|* Letzte Aenderung MA 02. Sep. 93
+|*
+|*************************************************************************/
+/*N*/ void SwFlyInCntFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ BOOL bCallPrepare = FALSE;
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ if( RES_ATTRSET_CHG == nWhich )
+/*N*/ {
+/*N*/ if( SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->
+/*N*/ GetItemState( RES_SURROUND, FALSE ) ||
+/*N*/ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->
+/*N*/ GetItemState( RES_FRMMACRO, FALSE ) )
+/*N*/ {
+/*N*/ SwAttrSetChg aOld( *(SwAttrSetChg*)pOld );
+/*N*/ SwAttrSetChg aNew( *(SwAttrSetChg*)pNew );
+/*N*/
+/*N*/ aOld.ClearItem( RES_SURROUND );
+/*N*/ aNew.ClearItem( RES_SURROUND );
+/*N*/ aOld.ClearItem( RES_FRMMACRO );
+/*N*/ aNew.ClearItem( RES_FRMMACRO );
+/*N*/ if( aNew.Count() )
+/*N*/ {
+/*?*/ SwFlyFrm::Modify( &aOld, &aNew );
+/*?*/ bCallPrepare = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( ((SwAttrSetChg*)pNew)->GetChgSet()->Count())
+/*N*/ {
+/*N*/ SwFlyFrm::Modify( pOld, pNew );
+/*N*/ bCallPrepare = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( nWhich != RES_SURROUND && RES_FRMMACRO != nWhich )
+/*N*/ {
+/*N*/ SwFlyFrm::Modify( pOld, pNew );
+/*N*/ bCallPrepare = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ if ( bCallPrepare && GetAnchor() )
+/*N*/ GetAnchor()->Prepare( PREP_FLY_ATTR_CHG, GetFmt() );
+/*N*/ }
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::Format()
+|*
+|* Beschreibung: Hier wird der Inhalt initial mit Formatiert.
+|* Ersterstellung MA 16. Dec. 92
+|* Letzte Aenderung MA 19. May. 93
+|*
+|*************************************************************************/
+/*N*/ void SwFlyInCntFrm::Format( const SwBorderAttrs *pAttrs )
+/*N*/ {
+/*N*/ if ( !Frm().Height() )
+/*N*/ {
+/*?*/ Lock(); //nicht hintenherum den Anker formatieren.
+/*?*/ SwCntntFrm *pCntnt = ContainsCntnt();
+/*?*/ while ( pCntnt )
+/*?*/ { pCntnt->Calc();
+/*?*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*?*/ }
+/*?*/ Unlock();
+/*N*/ }
+/*N*/ SwFlyFrm::Format( pAttrs );
+/*N*/ }
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::MakeFlyPos()
+|*
+|* Beschreibung Im Unterschied zu anderen Frms wird hier nur die
+|* die RelPos berechnet. Die absolute Position wird ausschliesslich
+|* per SetAbsPos errechnet.
+|* Ersterstellung MA 03. Dec. 92
+|* Letzte Aenderung MA 12. Apr. 96
+|*
+|*************************************************************************/
+/*N*/ void SwFlyInCntFrm::MakeFlyPos()
+/*N*/ {
+/*N*/ if ( !bValidPos )
+/*N*/ {
+/*N*/ if ( !GetAnchor()->IsTxtFrm() || !((SwTxtFrm*)GetAnchor())->IsLocked() )
+/*N*/ ::binfilter::DeepCalc( GetAnchor() );
+/*N*/ if( GetAnchor()->IsTxtFrm() )
+/*N*/ ((SwTxtFrm*)GetAnchor())->GetFormatted();
+/*N*/ bValidPos = TRUE;
+/*N*/ SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
+/*N*/ const SwFmtVertOrient &rVert = pFmt->GetVertOrient();
+/*N*/ //Und ggf. noch die aktuellen Werte im Format updaten, dabei darf
+/*N*/ //zu diesem Zeitpunkt natuerlich kein Modify verschickt werden.
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ SWRECTFN( GetAnchor() )
+/*N*/ SwTwips nOld = rVert.GetPos();
+/*N*/ SwTwips nAct = bVert ? -aRelPos.X() : aRelPos.Y();
+/*N*/ if( bRev )
+/*?*/ nAct = -nAct;
+/*N*/ if( nAct != nOld )
+/*N*/ {
+/*N*/ SwFmtVertOrient aVert( rVert );
+/*N*/ aVert.SetPos( nAct );
+/*N*/ #else
+/*N*/ if ( rVert.GetPos() != aRelPos.Y() )
+/*N*/ {
+/*N*/ SwFmtVertOrient aVert( rVert );
+/*N*/ aVert.SetPos( aRelPos.Y() );
+/*N*/ #endif
+/*N*/ pFmt->LockModify();
+/*N*/ pFmt->SetAttr( aVert );
+/*N*/ pFmt->UnlockModify();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::NotifyBackground()
+|*
+|* Ersterstellung MA 03. Dec. 92
+|* Letzte Aenderung MA 26. Aug. 93
+|*
+|*************************************************************************/
+/*N*/ void SwFlyInCntFrm::NotifyBackground( SwPageFrm *, const SwRect& rRect,
+/*N*/ PrepareHint eHint)
+/*N*/ {
+/*N*/ if ( eHint == PREP_FLY_ATTR_CHG )
+/*?*/ GetAnchor()->Prepare( PREP_FLY_ATTR_CHG );
+/*N*/ else
+/*N*/ GetAnchor()->Prepare( eHint, (void*)&rRect );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::GetRelPos()
+|*
+|* Ersterstellung MA 04. Dec. 92
+|* Letzte Aenderung MA 04. Dec. 92
+|*
+|*************************************************************************/
+/*N*/ const Point &SwFlyInCntFrm::GetRelPos() const
+/*N*/ {
+/*N*/ Calc();
+/*N*/ return GetCurRelPos();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::RegistFlys()
+|*
+|* Ersterstellung MA 26. Nov. 93
+|* Letzte Aenderung MA 26. Nov. 93
+|*
+|*************************************************************************/
+/*N*/ void SwFlyInCntFrm::RegistFlys()
+/*N*/ {
+/*N*/ // vgl. SwRowFrm::RegistFlys()
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ ASSERT( pPage, "Flys ohne Seite anmelden?" );
+/*N*/ ::binfilter::RegistFlys( pPage, this );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyInCntFrm::MakeAll()
+|*
+|* Ersterstellung MA 18. Feb. 94
+|* Letzte Aenderung MA 13. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ void SwFlyInCntFrm::MakeAll()
+/*N*/ {
+/*N*/ if ( !GetAnchor() || IsLocked() || IsColLocked() || !FindPageFrm() )
+/*N*/ return;
+/*N*/
+/*N*/ Lock(); //Der Vorhang faellt
+/*N*/
+/*N*/ //uebernimmt im DTor die Benachrichtigung
+/*N*/ const SwFlyNotify aNotify( this );
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ const Size &rSz = rAttrs.GetSize();
+/*N*/ const SwFmtFrmSize &rFrmSz = GetFmt()->GetFrmSize();
+/*N*/
+/*N*/ if ( IsClipped() )
+/*N*/ bValidSize = bHeightClipped = bWidthClipped = FALSE;
+/*N*/
+/*N*/ while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ //Nur einstellen wenn das Flag gesetzt ist!!
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ long nOldWidth = aFrm.Width();
+/*N*/ aFrm.Width( CalcRel( rFrmSz ).Width() );
+/*N*/
+/*N*/ if ( aFrm.Width() > nOldWidth )
+/*N*/ //Damit sich der Inhalt anpasst
+/*N*/ aFrm.Height( CalcRel( rFrmSz ).Height() );
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidPrtArea )
+/*N*/ MakePrtArea( rAttrs );
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ Format( &rAttrs );
+/*N*/
+/*N*/ if ( !bValidPos )
+/*N*/ MakeFlyPos();
+/*N*/
+/*N*/ if ( bValidPos && bValidSize )
+/*N*/ {
+/*N*/ SwFrm *pFrm = GetAnchor();
+/*N*/ if (
+/*N*/ //MA 03. Apr. 96 fix(26652), Das trifft uns bestimmt nocheinmal
+/*N*/ // !pFrm->IsMoveable() &&
+/*N*/ Frm().Left() == (pFrm->Frm().Left()+pFrm->Prt().Left()) &&
+/*N*/ Frm().Width() > pFrm->Prt().Width() )
+/*N*/ {
+/*N*/ Frm().Width( pFrm->Prt().Width() );
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ bWidthClipped = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ Unlock();
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_flylay.cxx b/binfilter/bf_sw/source/core/layout/sw_flylay.cxx
new file mode 100644
index 000000000000..d0470cdf6003
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_flylay.cxx
@@ -0,0 +1,1143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "pagefrm.hxx"
+#include "cntfrm.hxx"
+#include "dflyobj.hxx"
+#include "dcontact.hxx"
+#include "ftnfrm.hxx"
+#include "frmtool.hxx"
+#include "frmfmt.hxx"
+#include "hints.hxx"
+#include "pam.hxx"
+#include "sectfrm.hxx"
+
+
+#include <bf_svx/svdpage.hxx>
+
+#include <bf_svx/ulspitem.hxx>
+
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include "tabfrm.hxx"
+#include "flyfrms.hxx"
+
+#ifdef ACCESSIBLE_LAYOUT
+#include <frmsh.hxx>
+#endif
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* SwFlyFreeFrm::SwFlyFreeFrm(), ~SwFlyFreeFrm()
+|*
+|* Ersterstellung MA 03. Dec. 92
+|* Letzte Aenderung MA 09. Apr. 99
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyFreeFrm::SwFlyFreeFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) :
+/*N*/ SwFlyFrm( pFmt, pAnch ),
+/*N*/ pPage( 0 )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFlyFreeFrm::~SwFlyFreeFrm()
+/*N*/ {
+/*N*/ //und Tschuess.
+/*N*/ if( GetPage() )
+/*N*/ {
+/*N*/ if( GetFmt()->GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ if ( IsFlyAtCntFrm() && GetPage()->GetSortedObjs() )
+/*N*/ GetPage()->GetSortedObjs()->Remove( GetVirtDrawObj() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwRect aTmp( AddSpacesToFrm() );
+/*N*/ SwFlyFreeFrm::NotifyBackground( GetPage(), aTmp, PREP_FLY_LEAVE );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFreeFrm::NotifyBackground()
+|*
+|* Beschreibung Benachrichtigt den Hintergrund (alle CntntFrms die
+|* gerade ueberlappt werden. Ausserdem wird das Window in einigen
+|* Faellen direkt invalidiert (vor allem dort, wo keine CntntFrms
+|* ueberlappt werden.
+|* Es werden auch die CntntFrms innerhalb von anderen Flys
+|* beruecksichtigt.
+|* Ersterstellung MA 03. Dec. 92
+|* Letzte Aenderung MA 26. Aug. 93
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFreeFrm::NotifyBackground( SwPageFrm *pPage,
+/*N*/ const SwRect& rRect, PrepareHint eHint )
+/*N*/ {
+/*N*/ ::binfilter::Notify_Background( GetVirtDrawObj(), pPage, rRect, eHint, TRUE );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFreeFrm::MakeAll()
+|*
+|* Ersterstellung MA 18. Feb. 94
+|* Letzte Aenderung MA 03. Mar. 97
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFreeFrm::MakeAll()
+/*N*/ {
+/*N*/ if ( !GetAnchor() || IsLocked() || IsColLocked() )
+/*N*/ return;
+/*N*/ if( !GetPage() && GetAnchor() && GetAnchor()->IsInFly() )
+/*N*/ {
+/*?*/ SwFlyFrm* pFly = GetAnchor()->FindFlyFrm();
+/*?*/ SwPageFrm *pPage = pFly ? pFly->FindPageFrm() : NULL;
+/*?*/ if( pPage )
+/*?*/ pPage->SwPageFrm::AppendFly( this );
+/*N*/ }
+/*N*/ if( !GetPage() )
+/*?*/ return;
+/*N*/
+/*N*/ Lock(); //Der Vorhang faellt
+/*N*/
+/*N*/ //uebernimmt im DTor die Benachrichtigung
+/*N*/ const SwFlyNotify aNotify( this );
+/*N*/
+/*N*/ if ( IsClipped() )
+/*N*/ bValidPos = bValidSize = bHeightClipped = bWidthClipped = FALSE;
+/*N*/
+/*N*/ while ( !bValidPos || !bValidSize || !bValidPrtArea || bFormatHeightOnly )
+/*N*/ {
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ SWRECTFN( this )
+/*N*/ #endif
+/*N*/ const SwFmtFrmSize *pSz;
+/*N*/ { //Zusaetzlicher Scope, damit aAccess vor dem Check zerstoert wird!
+/*N*/
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ pSz = &rAttrs.GetAttrSet().GetFrmSize();
+/*N*/
+/*N*/ //Nur einstellen wenn das Flag gesetzt ist!!
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ const Size aTmp( CalcRel( *pSz ) );
+/*N*/ const SwTwips nMin = MINFLY + rAttrs.CalcLeftLine()+rAttrs.CalcRightLine();
+/*N*/ long nDiff = bVert ? aTmp.Height() : aTmp.Width();
+/*N*/ if( nDiff < nMin )
+/*?*/ nDiff = nMin;
+/*N*/ nDiff -= (aFrm.*fnRect->fnGetWidth)();
+/*N*/ if( nDiff )
+/*N*/ {
+/*N*/ (aFrm.*fnRect->fnAddRight)( nDiff );
+/*N*/ bValidPos = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidPrtArea )
+/*N*/ MakePrtArea( rAttrs );
+/*N*/
+/*N*/ if ( !bValidSize || bFormatHeightOnly )
+/*N*/ {
+/*N*/ bValidSize = FALSE;
+/*N*/ Format( &rAttrs );
+/*N*/ bFormatHeightOnly = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidPos )
+/*N*/ {
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ const Point aOldPos( (Frm().*fnRect->fnGetPos)() );
+/*N*/ MakeFlyPos();
+/*N*/ if( aOldPos == (Frm().*fnRect->fnGetPos)() )
+/*N*/ #else
+/*?*/ const Point aOldPos( Frm().Pos() );
+/*?*/ MakeFlyPos();
+/*?*/ if( aOldPos == Frm().Pos() )
+/*N*/ #endif
+/*N*/ {
+/*N*/ if( !bValidPos && GetAnchor()->IsInSct() &&
+/*N*/ !GetAnchor()->FindSctFrm()->IsValid() )
+/*?*/ bValidPos = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ bValidSize = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bValidPos && bValidSize )
+/*N*/ CheckClip( *pSz );
+/*N*/ }
+/*N*/ Unlock();
+/*N*/
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ #ifdef DBG_UTIL
+/*N*/ SWRECTFN( this )
+/*N*/ ASSERT( bHeightClipped || ( (Frm().*fnRect->fnGetHeight)() > 0 &&
+/*N*/ (Prt().*fnRect->fnGetHeight)() > 0),
+/*N*/ "SwFlyFreeFrm::Format(), flipping Fly." );
+/*N*/
+/*N*/ #endif
+/*N*/ #else
+/*?*/ ASSERT( bHeightClipped || (Frm().Height() > 0 && Prt().Height() > 0),
+/*?*/ "SwFlyFreeFrm::Format(), flipping Fly." );
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyFreeFrm::CheckClip()
+|*
+|* Ersterstellung MA 21. Feb. 94
+|* Letzte Aenderung MA 03. Mar. 97
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyFreeFrm::CheckClip( const SwFmtFrmSize &rSz )
+/*N*/ {
+/*N*/ //Jetzt ist es ggf. an der Zeit geignete Massnahmen zu ergreifen wenn
+/*N*/ //der Fly nicht in seine Umgebung passt.
+/*N*/ //Zuerst gibt der Fly seine Position auf. Danach wird er zunaechst
+/*N*/ //formatiert. Erst wenn er auch durch die Aufgabe der Position nicht
+/*N*/ //passt wird die Breite oder Hoehe aufgegeben - der Rahmen wird soweit
+/*N*/ //wie notwendig zusammengequetscht.
+/*N*/
+/*N*/ const SwVirtFlyDrawObj *pObj = GetVirtDrawObj();
+/*N*/ SwRect aClip, aTmpStretch;
+/*N*/ ::binfilter::CalcClipRect( pObj, aClip, TRUE );
+/*N*/ ::binfilter::CalcClipRect( pObj, aTmpStretch, FALSE );
+/*N*/ aClip._Intersection( aTmpStretch );
+/*N*/
+/*N*/ const long nBot = Frm().Top() + Frm().Height();
+/*N*/ const long nRig = Frm().Left() + Frm().Width();
+/*N*/ const long nClipBot = aClip.Top() + aClip.Height();
+/*N*/ const long nClipRig = aClip.Left() + aClip.Width();
+/*N*/
+/*N*/ const FASTBOOL bBot = nBot > nClipBot;
+/*N*/ const FASTBOOL bRig = nRig > nClipRig;
+/*N*/ if ( bBot || bRig )
+/*N*/ {
+/*N*/ FASTBOOL bAgain = FALSE;
+/*N*/ if ( bBot && !GetDrawObjs() && !GetAnchor()->IsInTab() )
+/*N*/ {
+/*N*/ SwFrm* pHeader = FindFooterOrHeader();
+/*N*/ // In a header, correction of the position is no good idea.
+/*N*/ // If the fly moves, some paragraphs has to be formatted, this
+/*N*/ // could cause a change of the height of the headerframe,
+/*N*/ // now the flyframe can change its position and so on ...
+/*N*/ if( !pHeader || !pHeader->IsHeaderFrm() )
+/*N*/ {
+/*N*/ const long nOld = Frm().Top();
+/*N*/ Frm().Pos().Y() = Max( aClip.Top(), nClipBot - Frm().Height() );
+/*N*/ if ( Frm().Top() != nOld )
+/*N*/ bAgain = TRUE;
+/*N*/ bHeightClipped = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bRig )
+/*N*/ {
+/*N*/ const long nOld = Frm().Left();
+/*N*/ Frm().Pos().X() = Max( aClip.Left(), nClipRig - Frm().Width() );
+/*N*/ if ( Frm().Left() != nOld )
+/*N*/ {
+/*N*/ const SwFmtHoriOrient &rH = GetFmt()->GetHoriOrient();
+/*N*/ // Links ausgerichtete duerfen nicht nach links verschoben werden,
+/*N*/ // wenn sie einem anderen ausweichen.
+/*N*/ if( rH.GetHoriOrient() == HORI_LEFT )
+/*?*/ Frm().Pos().X() = nOld;
+/*N*/ else
+/*N*/ bAgain = TRUE;
+/*N*/ }
+/*N*/ bWidthClipped = TRUE;
+/*N*/ }
+/*N*/ if ( bAgain )
+/*N*/ bValidSize = FALSE;
+/*N*/ else
+/*N*/ {
+/*N*/ //Wenn wir hier ankommen ragt der Frm in unerlaubte Bereiche
+/*N*/ //hinein, und eine Positionskorrektur ist nicht erlaubt bzw.
+/*N*/ //moeglich oder noetig.
+/*N*/
+/*N*/ //Fuer Flys mit OLE-Objekten als Lower sorgen wir dafuer, dass
+/*N*/ //immer proportional Resized wird.
+/*N*/ Size aOldSize( Frm().SSize() );
+/*N*/
+/*N*/ //Zuerst wird das FrmRect eingestellt, und dann auf den Frm
+/*N*/ //uebertragen.
+/*N*/ SwRect aFrmRect( Frm() );
+/*N*/
+/*N*/ if ( bBot )
+/*N*/ {
+/*N*/ long nDiff = nClipBot;
+/*N*/ nDiff -= aFrmRect.Top(); //nDiff ist die verfuegbare Strecke.
+/*N*/ nDiff = aFrmRect.Height() - nDiff;
+/*N*/ aFrmRect.Height( aFrmRect.Height() - nDiff );
+/*N*/ bHeightClipped = TRUE;
+/*N*/ }
+/*N*/ if ( bRig )
+/*N*/ {
+/*N*/ long nDiff = nClipRig;
+/*N*/ nDiff -= aFrmRect.Left();//nDiff ist die verfuegbare Strecke.
+/*N*/ nDiff = aFrmRect.Width() - nDiff;
+/*N*/ aFrmRect.Width( aFrmRect.Width() - nDiff );
+/*N*/ bWidthClipped = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ if ( Lower() && Lower()->IsNoTxtFrm() && !FindFooterOrHeader() )
+/*N*/ {
+/*?*/ //Wenn Breite und Hoehe angepasst wurden, so ist die
+/*?*/ //groessere Veraenderung massgeblich.
+/*?*/ if ( aFrmRect.Width() != aOldSize.Width() &&
+/*?*/ aFrmRect.Height()!= aOldSize.Height() )
+/*?*/ {
+/*?*/ if ( (aOldSize.Width() - aFrmRect.Width()) >
+/*?*/ (aOldSize.Height()- aFrmRect.Height()) )
+/*?*/ aFrmRect.Height( aOldSize.Height() );
+/*?*/ else
+/*?*/ aFrmRect.Width( aOldSize.Width() );
+/*?*/ }
+/*?*/
+/*?*/ //Breite angepasst? - Hoehe dann proportional verkleinern
+/*?*/ if( aFrmRect.Width() != aOldSize.Width() )
+/*?*/ {
+/*?*/ aFrmRect.Height( aFrmRect.Width() * aOldSize.Height() /
+/*?*/ aOldSize.Width() );
+/*?*/ bHeightClipped = TRUE;
+/*?*/ }
+/*?*/ //Hoehe angepasst? - Breite dann proportional verkleinern
+/*?*/ else if( aFrmRect.Height() != aOldSize.Height() )
+/*?*/ {
+/*?*/ aFrmRect.Width( aFrmRect.Height() * aOldSize.Width() /
+/*?*/ aOldSize.Height() );
+/*?*/ bWidthClipped = TRUE;
+/*?*/ }
+/*?*/
+/*?*/ // if( bWidthClipped || bHeightClipped )
+/*?*/ // {
+/*?*/ // SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
+/*?*/ // pFmt->LockModify();
+/*?*/ // SwFmtFrmSize aFrmSize( rSz );
+/*?*/ // aFrmSize.SetWidth( aFrmRect.Width() );
+/*?*/ // aFrmSize.SetHeight( aFrmRect.Height() );
+/*?*/ // pFmt->SetAttr( aFrmSize );
+/*?*/ // pFmt->UnlockModify();
+/*?*/ // }
+/*N*/ }
+/*N*/
+/*N*/ //Jetzt die Einstellungen am Frm vornehmen, bei Spalten werden
+/*N*/ //die neuen Werte in die Attribute eingetragen, weil es sonst
+/*N*/ //ziemlich fiese Oszillationen gibt.
+/*N*/ const long nPrtHeightDiff = Frm().Height() - Prt().Height();
+/*N*/ const long nPrtWidthDiff = Frm().Width() - Prt().Width();
+/*N*/ Frm().Height( aFrmRect.Height() );
+/*N*/ Frm().Width ( Max( long(MINLAY), aFrmRect.Width() ) );
+/*N*/ if ( Lower() && Lower()->IsColumnFrm() )
+/*N*/ {
+/*?*/ ColLock(); //Grow/Shrink locken.
+/*?*/ const Size aOldSize( Prt().SSize() );
+/*?*/ Prt().Height( Frm().Height() - nPrtHeightDiff );
+/*?*/ Prt().Width ( Frm().Width() - nPrtWidthDiff );
+/*?*/ ChgLowersProp( aOldSize );
+/*?*/ SwFrm *pLow = Lower();
+/*?*/ do
+/*?*/ { pLow->Calc();
+/*?*/ // auch den (Column)BodyFrm mitkalkulieren
+/*?*/ ((SwLayoutFrm*)pLow)->Lower()->Calc();
+/*?*/ pLow = pLow->GetNext();
+/*?*/ } while ( pLow );
+/*?*/ ::binfilter::CalcCntnt( this );
+/*?*/ ColUnlock();
+/* MA 02. Sep. 96: Wenn das Attribut gesetzt wird funktionieren Flys in Flys
+ * nicht (30095 30096)
+ SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)GetFmt();
+ pFmt->LockModify();
+ SwFmtFrmSize aFrmSize( rSz );
+ if ( bRig )
+ aFrmSize.SetWidth( Frm().Width() );
+ if ( bBot )
+ {
+ aFrmSize.SetSizeType( ATT_FIX_SIZE );
+ aFrmSize.SetHeight( Frm().Height() );
+ bFixHeight = TRUE;
+ bMinHeight = FALSE;
+ }
+ pFmt->SetAttr( aFrmSize );
+ pFmt->UnlockModify();
+*/
+/*?*/ //Stattdessen:
+/*?*/ if ( !bValidSize && !bWidthClipped )
+/*?*/ bFormatHeightOnly = bValidSize = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Prt().Height( Frm().Height() - nPrtHeightDiff );
+/*N*/ Prt().Width ( Frm().Width() - nPrtWidthDiff );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyLayFrm::SwFlyLayFrm()
+|*
+|* Ersterstellung MA 25. Aug. 92
+|* Letzte Aenderung MA 09. Apr. 99
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyLayFrm::SwFlyLayFrm( SwFlyFrmFmt *pFmt, SwFrm *pAnch ) :
+/*N*/ SwFlyFreeFrm( pFmt, pAnch )
+/*N*/ {
+/*N*/ bLayout = TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyLayFrm::Modify()
+|*
+|* Ersterstellung MA 08. Feb. 93
+|* Letzte Aenderung MA 28. Aug. 93
+|*
+|*************************************************************************/
+
+/*N*/ void SwFlyLayFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ USHORT nWhich = pNew ? pNew->Which() : 0;
+/*N*/
+/*N*/ SwFmtAnchor *pAnch = 0;
+/*N*/ if( RES_ATTRSET_CHG == nWhich && SFX_ITEM_SET ==
+/*N*/ ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_ANCHOR, FALSE,
+/*N*/ (const SfxPoolItem**)&pAnch ))
+/*N*/ ; // Beim GetItemState wird der AnkerPointer gesetzt !
+/*N*/
+/*N*/ else if( RES_ANCHOR == nWhich )
+/*N*/ {
+/*N*/ //Ankerwechsel, ich haenge mich selbst um.
+/*N*/ //Es darf sich nicht um einen Wechsel des Ankertyps handeln,
+/*N*/ //dies ist nur ueber die SwFEShell moeglich.
+/*?*/ pAnch = (SwFmtAnchor*)pNew;
+/*N*/ }
+/*N*/
+/*N*/ if( pAnch )
+/*N*/ {
+/*?*/ ASSERT( pAnch->GetAnchorId() ==
+/*?*/ GetFmt()->GetAnchor().GetAnchorId(),
+/*?*/ "8-) Unzulaessiger Wechsel des Ankertyps." );
+/*?*/
+/*?*/ //Abmelden, Seite besorgen, an den entsprechenden LayoutFrm
+/*?*/ //haengen.
+/*?*/ SwRect aOld( AddSpacesToFrm() );
+/*?*/ SwPageFrm *pOldPage = GetPage();
+/*?*/ GetAnchor()->RemoveFly( this );
+/*?*/
+/*?*/ if( FLY_PAGE == pAnch->GetAnchorId() )
+/*?*/ {
+/*?*/ USHORT nPgNum = pAnch->GetPageNum();
+/*?*/ SwRootFrm *pRoot = FindRootFrm();
+/*?*/ SwPageFrm *pPage = (SwPageFrm*)pRoot->Lower();
+/*?*/ for ( USHORT i = 1; (i <= nPgNum) && pPage; ++i,
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext() )
+/*?*/ {
+/*?*/ if ( i == nPgNum )
+/*?*/ pPage->PlaceFly( this, 0, pAnch );
+/*?*/ }
+/*?*/ if( !pPage )
+/*?*/ {
+/*?*/ pRoot->SetAssertFlyPages();
+/*?*/ pRoot->AssertFlyPages();
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ SwNodeIndex aIdx( pAnch->GetCntntAnchor()->nNode );
+/*?*/ SwCntntFrm *pCntnt = GetFmt()->GetDoc()->GetNodes().GoNext( &aIdx )->
+/*?*/ GetCntntNode()->GetFrm( 0, 0, FALSE );
+/*?*/ if( pCntnt )
+/*?*/ {
+/*?*/ SwFlyFrm *pTmp = pCntnt->FindFlyFrm();
+/*?*/ if( pTmp )
+/*?*/ pTmp->AppendFly( this );
+/*?*/ }
+/*?*/ }
+/*?*/ if ( pOldPage && pOldPage != GetPage() )
+/*?*/ NotifyBackground( pOldPage, aOld, PREP_FLY_LEAVE );
+/*?*/ SetCompletePaint();
+/*?*/ InvalidateAll();
+/*?*/ SetNotifyBack();
+/*N*/ }
+/*N*/ else
+/*N*/ SwFlyFrm::Modify( pOld, pNew );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::AppendFly()
+|*
+|* Ersterstellung MA 10. Oct. 92
+|* Letzte Aenderung MA 08. Jun. 96
+|*
+|*************************************************************************/
+
+/*N*/ void SwPageFrm::AppendFly( SwFlyFrm *pNew )
+/*N*/ {
+/*N*/ if ( !pNew->GetVirtDrawObj()->IsInserted() )
+/*N*/ FindRootFrm()->GetDrawPage()->InsertObject(
+/*N*/ (SdrObject*)pNew->GetVirtDrawObj(),
+/*N*/ pNew->GetVirtDrawObj()->GetReferencedObj().GetOrdNumDirect() );
+/*N*/
+/*N*/ InvalidateSpelling();
+/*N*/ InvalidateAutoCompleteWords();
+/*N*/
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ ((SwRootFrm*)GetUpper())->SetIdleFlags();
+/*N*/ ((SwRootFrm*)GetUpper())->InvalidateBrowseWidth();
+/*N*/ }
+/*N*/
+/*N*/ const SdrObjectPtr pObj = pNew->GetVirtDrawObj();
+/*N*/ ASSERT( pNew->GetAnchor(), "Fly without Anchor" );
+/*N*/ SwFlyFrm *pFly = pNew->GetAnchor()->FindFlyFrm();
+/*N*/ if ( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() )
+/*N*/ {
+/*?*/ UINT32 nNewNum = pFly->GetVirtDrawObj()->GetOrdNumDirect() + 1;
+/*?*/ if ( pObj->GetPage() )
+/*?*/ pObj->GetPage()->SetObjectOrdNum( pObj->GetOrdNumDirect(), nNewNum);
+/*?*/ else
+/*?*/ pObj->SetOrdNum( nNewNum );
+/*N*/ }
+/*N*/
+/*N*/ //Flys die im Cntnt sitzen beachten wir nicht weiter.
+/*N*/ if ( pNew->IsFlyInCntFrm() )
+/*N*/ InvalidateFlyInCnt();
+/*N*/ else
+/*N*/ {
+/*N*/ InvalidateFlyCntnt();
+/*N*/
+/*N*/ if ( !pSortedObjs )
+/*N*/ pSortedObjs = new SwSortDrawObjs();
+/*N*/ if ( !pSortedObjs->Insert( pObj ) )
+/*?*/ ASSERT( FALSE, "Fly nicht in Sorted eingetragen." );
+/*N*/
+/*N*/ ((SwFlyFreeFrm*)pNew)->SetPage( this );
+/*N*/ pNew->InvalidatePage( this );
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // Notify accessible layout. That's required at this place for
+/*N*/ // frames only where the anchor is moved. Creation of new frames
+/*N*/ // is additionally handled by the SwFrmNotify class.
+/*N*/ if( GetUpper() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->IsAnyShellAccessible() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell()->Imp()
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ if( pNew->GetDrawObjs() )
+/*N*/ {
+/*?*/ SwDrawObjs &rObjs = *pNew->GetDrawObjs();
+/*?*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*?*/ {
+/*?*/ SdrObject *pO = rObjs[i];
+/*?*/ if( pO->IsWriterFlyFrame() )
+/*?*/ {
+/*?*/ SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*?*/ if( pFly->IsFlyFreeFrm() && !((SwFlyFreeFrm*)pFly)->GetPage() )
+/*?*/ SwPageFrm::AppendFly( pFly );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ //fix(3018): Kein pNew->Calc() oder sonstiges hier.
+/*N*/ //Code enfernt in flylay.cxx Rev 1.51
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::RemoveFly()
+|*
+|* Ersterstellung MA 10. Oct. 92
+|* Letzte Aenderung MA 26. Aug. 96
+|*
+|*************************************************************************/
+
+/*N*/ void SwPageFrm::RemoveFly( SwFlyFrm *pToRemove )
+/*N*/ {
+/*N*/ const UINT32 nOrdNum = pToRemove->GetVirtDrawObj()->GetOrdNum();
+/*N*/ FindRootFrm()->GetDrawPage()->RemoveObject( nOrdNum );
+/*N*/ pToRemove->GetVirtDrawObj()->ReferencedObj().SetOrdNum( nOrdNum );
+/*N*/
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ if ( !pToRemove->IsFlyInCntFrm() )
+/*N*/ ((SwRootFrm*)GetUpper())->SetSuperfluous();
+/*N*/ ((SwRootFrm*)GetUpper())->InvalidateBrowseWidth();
+/*N*/ }
+/*N*/
+/*N*/ //Flys die im Cntnt sitzen beachten wir nicht weiter.
+/*N*/ if ( pToRemove->IsFlyInCntFrm() )
+/*?*/ return;
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // Notify accessible layout. That's required at this place for
+/*N*/ // frames only where the anchor is moved. Creation of new frames
+/*N*/ // is additionally handled by the SwFrmNotify class.
+/*N*/ if( GetUpper() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->IsAnyShellAccessible() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell()->Imp()
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ //Collections noch nicht loeschen. Das passiert am Ende
+/*N*/ //der Action im RemoveSuperfluous der Seite - angestossen von gleich-
+/*N*/ //namiger Methode der Root.
+/*N*/ //Die FlyColl kann bereits weg sein, weil der DTor der Seite
+/*N*/ //gerade 'laeuft'
+/*N*/ if ( pSortedObjs )
+/*N*/ {
+/*N*/ pSortedObjs->Remove( pToRemove->GetVirtDrawObj() );
+/*N*/ if ( !pSortedObjs->Count() )
+/*N*/ { DELETEZ( pSortedObjs );
+/*N*/ }
+/*N*/ }
+/*N*/ ((SwFlyFreeFrm*)pToRemove)->SetPage( 0 );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::MoveFly
+|*
+|* Ersterstellung MA 25. Jan. 97
+|* Letzte Aenderung MA 25. Jan. 97
+|*
+|*************************************************************************/
+
+/*N*/ void SwPageFrm::MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest )
+/*N*/ {
+/*N*/ //Invalidierungen
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ ((SwRootFrm*)GetUpper())->SetIdleFlags();
+/*N*/ if ( !pToMove->IsFlyInCntFrm() && pDest->GetPhyPageNum() < GetPhyPageNum() )
+/*N*/ ((SwRootFrm*)GetUpper())->SetSuperfluous();
+/*N*/ }
+/*N*/ pDest->InvalidateSpelling();
+/*N*/ pDest->InvalidateAutoCompleteWords();
+/*N*/
+/*N*/ if ( pToMove->IsFlyInCntFrm() )
+/*N*/ {
+/*?*/ pDest->InvalidateFlyInCnt();
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // Notify accessible layout. That's required at this place for
+/*N*/ // frames only where the anchor is moved. Creation of new frames
+/*N*/ // is additionally handled by the SwFrmNotify class.
+/*N*/ if( GetUpper() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->IsAnyShellAccessible() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell()->Imp()
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ //Die FlyColl kann bereits weg sein, weil der DTor der Seite
+/*N*/ //gerade 'laeuft'
+/*N*/ const SdrObjectPtr pObj = pToMove->GetVirtDrawObj();
+/*N*/ if ( pSortedObjs )
+/*N*/ {
+/*N*/ pSortedObjs->Remove( pObj );
+/*N*/ if ( !pSortedObjs->Count() )
+/*N*/ { DELETEZ( pSortedObjs );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Anmelden
+/*N*/ if ( !pDest->GetSortedObjs() )
+/*N*/ pDest->pSortedObjs = new SwSortDrawObjs();
+/*N*/ if ( !pDest->GetSortedObjs()->Insert( pObj ) )
+/*?*/ ASSERT( FALSE, "Fly nicht in Sorted eingetragen." );
+/*N*/
+/*N*/ ((SwFlyFreeFrm*)pToMove)->SetPage( pDest );
+/*N*/ pToMove->InvalidatePage( pDest );
+/*N*/ pToMove->SetNotifyBack();
+/*N*/ pDest->InvalidateFlyCntnt();
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // Notify accessible layout. That's required at this place for
+/*N*/ // frames only where the anchor is moved. Creation of new frames
+/*N*/ // is additionally handled by the SwFrmNotify class.
+/*N*/ if( GetUpper() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->IsAnyShellAccessible() &&
+/*N*/ static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 static_cast< SwRootFrm * >( GetUpper() )->GetCurrShell()->Imp()
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::AppendDrawObject(), RemoveDrawObject()
+|*
+|* Ersterstellung MA 09. Jan. 95
+|* Letzte Aenderung MA 31. Jul. 96
+|*
+|*************************************************************************/
+
+/*N*/ void SwPageFrm::AppendDrawObj( SwDrawContact *pNew )
+/*N*/ {
+/*N*/ if ( GetUpper() )
+/*N*/ ((SwRootFrm*)GetUpper())->InvalidateBrowseWidth();
+/*N*/
+/*N*/ const SdrObjectPtr pObj = pNew->GetMaster();
+/*N*/ ASSERT( pNew->GetAnchor(), "Contact without Anchor" );
+/*N*/ SwFlyFrm *pFly = pNew->GetAnchor()->FindFlyFrm();
+/*N*/ if ( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() )
+/*N*/ {
+/*?*/ UINT32 nNewNum = pFly->GetVirtDrawObj()->GetOrdNumDirect() + 1;
+/*?*/ if ( pObj->GetPage() )
+/*?*/ pObj->GetPage()->SetObjectOrdNum( pObj->GetOrdNumDirect(), nNewNum);
+/*?*/ else
+/*?*/ pObj->SetOrdNum( nNewNum );
+/*N*/ }
+/*N*/
+/*N*/ if ( FLY_IN_CNTNT == pNew->GetFmt()->GetAnchor().GetAnchorId() )
+/*N*/ return;
+/*N*/
+/*N*/ if ( !pSortedObjs )
+/*N*/ pSortedObjs = new SwSortDrawObjs();
+/*N*/ if ( !pSortedObjs->Insert( pObj ) )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ USHORT nIdx;
+/*N*/ ASSERT( pSortedObjs->Seek_Entry( pObj, &nIdx ),
+/*N*/ "Fly nicht in Sorted eingetragen." );
+/*N*/ #endif
+/*N*/ }
+/*N*/ pNew->ChgPage( this );
+/*N*/ }
+
+// OD 20.05.2003 #108784# - adding 'virtual' drawing object to page frame
+void SwPageFrm::AppendVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj )
+{
+ if ( GetUpper() )
+ {
+ ((SwRootFrm*)GetUpper())->InvalidateBrowseWidth();
+ }
+
+ ASSERT( _pDrawVirtObj->GetAnchorFrm(), "virtual draw contact without anchor" );
+ SwFlyFrm *pFly = _pDrawVirtObj->GetAnchorFrm()->FindFlyFrm();
+ if ( pFly && _pDrawVirtObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() )
+ {
+ UINT32 nNewNum = pFly->GetVirtDrawObj()->GetOrdNumDirect() + 1;
+ if ( _pDrawVirtObj->GetPage() )
+ _pDrawVirtObj->GetPage()->SetObjectOrdNum( _pDrawVirtObj->GetOrdNumDirect(), nNewNum);
+ else
+ _pDrawVirtObj->SetOrdNum( nNewNum );
+ }
+
+ if ( FLY_IN_CNTNT == _pDrawContact->GetFmt()->GetAnchor().GetAnchorId() )
+ {
+ return;
+ }
+
+ if ( !pSortedObjs )
+ {
+ pSortedObjs = new SwSortDrawObjs();
+ }
+ if ( !pSortedObjs->Insert( _pDrawVirtObj ) )
+ {
+#ifdef DBG_UTIL
+ USHORT nIdx;
+ ASSERT( pSortedObjs->Seek_Entry( _pDrawVirtObj, &nIdx ),
+ "Fly nicht in Sorted eingetragen." );
+#endif
+ }
+ _pDrawVirtObj->SetPageFrm( this );
+}
+
+/*N*/ void SwPageFrm::RemoveDrawObj( SwDrawContact *pToRemove )
+/*N*/ {
+/*N*/ //Auch Zeichengebundene muessen hier leider durchlaufen, weil beim
+/*N*/ //setzen des Attributes zuerst das Attribut gesetzt und dann das Modify
+/*N*/ //versendet wird.
+/*N*/
+/*N*/ //Die FlyColl kann bereits weg sein, weil der DTor der Seite
+/*N*/ //gerade 'laeuft'
+/*N*/ if ( pSortedObjs )
+/*N*/ {
+/*N*/ const SdrObjectPtr *pDel = pSortedObjs->GetData();
+/*N*/ pSortedObjs->Remove( pToRemove->GetMaster() );
+/*N*/ if ( !pSortedObjs->Count() )
+/*N*/ {
+/*N*/ DELETEZ( pSortedObjs );
+/*N*/ }
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ if ( FLY_IN_CNTNT != pToRemove->GetFmt()->GetAnchor().GetAnchorId() )
+/*N*/ {
+/*N*/ ((SwRootFrm*)GetUpper())->SetSuperfluous();
+/*N*/ InvalidatePage();
+/*N*/ }
+/*N*/ ((SwRootFrm*)GetUpper())->InvalidateBrowseWidth();
+/*N*/ }
+/*N*/ }
+/*N*/ pToRemove->ChgPage( 0 );
+/*N*/ }
+
+// OD 20.05.2003 #108784# - remove 'virtual' drawing object from page frame.
+void SwPageFrm::RemoveVirtDrawObj( SwDrawContact* _pDrawContact,
+ SwDrawVirtObj* _pDrawVirtObj )
+{
+ if ( pSortedObjs )
+ {
+ pSortedObjs->Remove( _pDrawVirtObj );
+ if ( !pSortedObjs->Count() )
+ {
+ DELETEZ( pSortedObjs );
+ }
+ if ( GetUpper() )
+ {
+ if ( FLY_IN_CNTNT != _pDrawContact->GetFmt()->GetAnchor().GetAnchorId() )
+ {
+ ((SwRootFrm*)GetUpper())->SetSuperfluous();
+ InvalidatePage();
+ }
+ ((SwRootFrm*)GetUpper())->InvalidateBrowseWidth();
+ }
+ }
+ _pDrawVirtObj->SetPageFrm( 0 );
+}
+
+/*************************************************************************
+|*
+|* SwPageFrm::PlaceFly
+|*
+|* Ersterstellung MA 08. Feb. 93
+|* Letzte Aenderung MA 27. Feb. 93
+|*
+|*************************************************************************/
+
+/*N*/ SwFrm *SwPageFrm::PlaceFly( SwFlyFrm *pFly, SwFrmFmt *pFmt,
+/*N*/ const SwFmtAnchor *pAnch )
+/*N*/ {
+/*N*/ //Der Fly will immer an der Seite direkt haengen.
+/*N*/ ASSERT( pAnch->GetAnchorId() == FLY_PAGE, "Unerwartete AnchorId." );
+/*N*/
+/*N*/ //Wenn ein Fly uebergeben wurde, so benutzen wir diesen, ansonsten wird
+/*N*/ //mit dem Format einer erzeugt.
+/*N*/ if ( pFly )
+/*?*/ SwFrm::AppendFly( pFly );
+/*N*/ else
+/*N*/ { ASSERT( pFmt, ":-( kein Format fuer Fly uebergeben." );
+/*N*/ pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, this );
+/*N*/ SwFrm::AppendFly( pFly );
+/*N*/ ::binfilter::RegistFlys( this, pFly );
+/*N*/ }
+/*N*/ return pFly;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ::CalcClipRect
+|*
+|* Ersterstellung AMA 24. Sep. 96
+|* Letzte Aenderung MA 18. Dec. 96
+|*
+|*************************************************************************/
+
+BOOL CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, BOOL bMove )
+{
+ BOOL bRet = TRUE;
+ if ( pSdrObj->IsWriterFlyFrame() )
+ {
+ const SwFlyFrm *pFly = ((const SwVirtFlyDrawObj*)pSdrObj)->GetFlyFrm();
+ if( pFly->IsFlyLayFrm() )
+ {
+#ifdef AMA_OUT_OF_FLY
+ const SwFrm *pClip = pFly->GetAnchor()->FindPageFrm();
+#else
+ const SwFrm *pClip = pFly->GetAnchor();
+#endif
+ pClip->Calc();
+
+ rRect = pClip->Frm();
+ SWRECTFN( pClip )
+
+ //Vertikales clipping: Top und Bottom, ggf. an PrtArea
+ const SwFmtVertOrient &rV = pFly->GetFmt()->GetVertOrient();
+ if( rV.GetVertOrient() != VERT_NONE &&
+ rV.GetRelationOrient() == PRTAREA )
+ {
+ (rRect.*fnRect->fnSetTop)( (pClip->*fnRect->fnGetPrtTop)() );
+ (rRect.*fnRect->fnSetBottom)( (pClip->*fnRect->fnGetPrtBottom)() );
+ }
+ //Horizontales clipping: Left und Right, ggf. an PrtArea
+ const SwFmtHoriOrient &rH = pFly->GetFmt()->GetHoriOrient();
+ if( rH.GetHoriOrient() != HORI_NONE &&
+ rH.GetRelationOrient() == PRTAREA )
+ {
+ (rRect.*fnRect->fnSetLeft)( (pClip->*fnRect->fnGetPrtLeft)() );
+ (rRect.*fnRect->fnSetRight)((pClip->*fnRect->fnGetPrtRight)());
+ }
+ }
+ else if( pFly->IsFlyAtCntFrm() )
+ {
+ const SwFrm *pClip = pFly->GetAnchor();
+ SWRECTFN( pClip )
+ const SwLayoutFrm *pUp = pClip->GetUpper();
+ const SwFrm *pCell = pUp->IsCellFrm() ? pUp : 0;
+ USHORT nType = bMove ? FRM_ROOT | FRM_FLY | FRM_HEADER |
+ FRM_FOOTER | FRM_FTN
+ : FRM_BODY | FRM_FLY | FRM_HEADER |
+ FRM_FOOTER | FRM_CELL| FRM_FTN;
+
+ while ( !(pUp->GetType() & nType) || pUp->IsColBodyFrm() )
+ {
+ pUp = pUp->GetUpper();
+ if ( !pCell && pUp->IsCellFrm() )
+ pCell = pUp;
+ }
+ if ( bMove )
+ {
+ if ( pUp->IsRootFrm() )
+ {
+ rRect = pUp->Prt();
+ rRect += pUp->Frm().Pos();
+ pUp = 0;
+ }
+ }
+ if ( pUp )
+ {
+ if ( !pUp->IsFooterFrm() && ( !pUp->IsFlyFrm() ||
+ (!pUp->Lower() || !pUp->Lower()->IsColumnFrm()) ) )
+ pUp->Calc();
+ if ( pUp->GetType() & FRM_BODY )
+ {
+ const SwPageFrm *pPg;
+ if ( pUp->GetUpper() != (pPg = pFly->FindPageFrm()) )
+ pUp = pPg->FindBodyCont();
+ rRect = pUp->GetUpper()->Frm();
+ (rRect.*fnRect->fnSetTop)( (pUp->*fnRect->fnGetPrtTop)() );
+ (rRect.*fnRect->fnSetBottom)((pUp->*fnRect->fnGetPrtBottom)());
+ }
+ else
+ {
+ if( ( pUp->GetType() & (FRM_FLY | FRM_FTN ) ) &&
+ !pUp->Frm().IsInside( pFly->Frm().Pos() ) )
+ {
+ if( pUp->IsFlyFrm() )
+ {
+ SwFlyFrm *pTmpFly = (SwFlyFrm*)pUp;
+ while( pTmpFly->GetNextLink() )
+ {
+ pTmpFly = pTmpFly->GetNextLink();
+ if( pTmpFly->Frm().IsInside( pFly->Frm().Pos() ) )
+ break;
+ }
+ pUp = pTmpFly;
+ }
+ else if( pUp->IsInFtn() )
+ {
+ const SwFtnFrm *pTmp = pUp->FindFtnFrm();
+ while( pTmp->GetFollow() )
+ {
+ pTmp = pTmp->GetFollow();
+ if( pTmp->Frm().IsInside( pFly->Frm().Pos() ) )
+ break;
+ }
+ pUp = pTmp;
+ }
+ }
+ rRect = pUp->Prt();
+ rRect.Pos() += pUp->Frm().Pos();
+ if ( pUp->GetType() & (FRM_HEADER | FRM_FOOTER) )
+ {
+ rRect.Left ( pUp->GetUpper()->Frm().Left() );
+ rRect.Width( pUp->GetUpper()->Frm().Width());
+ }
+ else if ( pUp->IsCellFrm() ) //MA_FLY_HEIGHT
+ {
+ const SwFrm *pTab = pUp->FindTabFrm();
+ (rRect.*fnRect->fnSetBottom)(
+ (pTab->GetUpper()->*fnRect->fnGetPrtBottom)() );
+ }
+ }
+ }
+ if ( pCell )
+ {
+ //CellFrms koennen auch in 'unerlaubten' Bereichen stehen, dann
+ //darf der Fly das auch.
+ SwRect aTmp( pCell->Prt() );
+ aTmp += pCell->Frm().Pos();
+ rRect.Union( aTmp );
+ }
+ }
+ else
+ {
+ const SwFrm *pUp = pFly->GetAnchor()->GetUpper();
+ if( !pUp->IsFooterFrm() )
+ pUp->Calc();
+ SWRECTFN( pFly->GetAnchor() )
+ while( pUp->IsColumnFrm() || pUp->IsSctFrm() || pUp->IsColBodyFrm())
+ pUp = pUp->GetUpper();
+ rRect = pUp->Frm();
+ if( !pUp->IsBodyFrm() )
+ {
+ rRect += pUp->Prt().Pos();
+ rRect.SSize( pUp->Prt().SSize() );
+ if ( pUp->IsCellFrm() )
+ {
+ const SwFrm *pTab = pUp->FindTabFrm();
+ (rRect.*fnRect->fnSetBottom)(
+ (pTab->GetUpper()->*fnRect->fnGetPrtBottom)() );
+ }
+ }
+ long nHeight = (9*(rRect.*fnRect->fnGetHeight)())/10;
+ long nTop;
+ const SwFmt *pFmt = ((SwContact*)GetUserCall(pSdrObj))->GetFmt();
+ const SvxULSpaceItem &rUL = pFmt->GetULSpace();
+ if( bMove )
+ {
+ nTop = bVert ? ((SwFlyInCntFrm*)pFly)->GetRefPoint().X() :
+ ((SwFlyInCntFrm*)pFly)->GetRefPoint().Y();
+ nTop = (*fnRect->fnYInc)( nTop, -nHeight );
+ long nWidth = (pFly->Frm().*fnRect->fnGetWidth)();
+ (rRect.*fnRect->fnSetLeftAndWidth)( bVert ?
+ ((SwFlyInCntFrm*)pFly)->GetRefPoint().Y() :
+ ((SwFlyInCntFrm*)pFly)->GetRefPoint().X(), nWidth );
+ nHeight = 2*nHeight - rUL.GetLower() - rUL.GetUpper();
+ }
+ else
+ {
+ nTop = (*fnRect->fnYInc)( (pFly->Frm().*fnRect->fnGetBottom)(),
+ rUL.GetLower() - nHeight );
+ nHeight = 2*nHeight - (pFly->Frm().*fnRect->fnGetHeight)()
+ - rUL.GetLower() - rUL.GetUpper();
+ }
+ (rRect.*fnRect->fnSetTopAndHeight)( nTop, nHeight );
+ }
+ }
+ else
+ {
+ const SwDrawContact *pC = (const SwDrawContact*)GetUserCall(pSdrObj);
+ const SwFrmFmt *pFmt = (const SwFrmFmt*)pC->GetFmt();
+ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+ if ( FLY_IN_CNTNT == rAnch.GetAnchorId() )
+ {
+ const SwFrm *pFrm = pC->GetAnchor();
+ if( !pFrm )
+ {
+ ((SwDrawContact*)pC)->ConnectToLayout();
+ pFrm = pC->GetAnchor();
+ }
+ const SwFrm *pUp = pFrm->GetUpper();
+ if( !pUp->IsFooterFrm() )
+ pUp->Calc();
+ rRect = pUp->Prt();
+ rRect += pUp->Frm().Pos();
+ SWRECTFN( pFrm )
+ long nHeight = (9*(rRect.*fnRect->fnGetHeight)())/10;
+ long nTop;
+ const SvxULSpaceItem &rUL = pFmt->GetULSpace();
+ SwRect aSnapRect( pSdrObj->GetSnapRect() );
+ long nTmpH = 0;
+ if( bMove )
+ {
+ nTop = (*fnRect->fnYInc)( bVert ? pSdrObj->GetAnchorPos().X() :
+ pSdrObj->GetAnchorPos().Y(), -nHeight );
+ long nWidth = (aSnapRect.*fnRect->fnGetWidth)();
+ (rRect.*fnRect->fnSetLeftAndWidth)( bVert ?
+ pSdrObj->GetAnchorPos().Y() :
+ pSdrObj->GetAnchorPos().X(), nWidth );
+ }
+ else
+ {
+ nTop = (*fnRect->fnYInc)( (aSnapRect.*fnRect->fnGetTop)(),
+ rUL.GetLower() + nTmpH - nHeight );
+ nTmpH = bVert ? pSdrObj->GetBoundRect().GetWidth() :
+ pSdrObj->GetBoundRect().GetHeight();
+ }
+ nHeight = 2*nHeight - nTmpH - rUL.GetLower() - rUL.GetUpper();
+ (rRect.*fnRect->fnSetTopAndHeight)( nTop, nHeight );
+ }
+ else
+ {
+ // OD 23.06.2003 #108784# - restrict clip rectangle for drawing
+ // objects in header/footer to the page frame.
+ const SwFrm* pAnchorFrm = 0L;
+ if ( pSdrObj->ISA(SwDrawVirtObj) )
+ {
+ pAnchorFrm = static_cast<const SwDrawVirtObj*>(pSdrObj)->GetAnchorFrm();
+ }
+ else
+ {
+ pAnchorFrm = pC->GetAnchor();
+ }
+ if ( pAnchorFrm && pAnchorFrm->FindFooterOrHeader() )
+ {
+ // clip frame is the page frame the header/footer is on.
+ const SwFrm* pClipFrm = pAnchorFrm->FindPageFrm();
+ rRect = pClipFrm->Frm();
+ }
+ else
+ {
+ bRet = FALSE;
+ }
+ }
+ }
+ return bRet;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_flypos.cxx b/binfilter/bf_sw/source/core/layout/sw_flypos.cxx
new file mode 100644
index 000000000000..1fd3e4a17e33
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_flypos.cxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <errhdl.hxx>
+
+#include <docary.hxx>
+
+
+#include <fmtanchr.hxx>
+#include "flypos.hxx"
+#include "frmfmt.hxx"
+#include "dcontact.hxx"
+#include "flyfrm.hxx"
+#include "dflyobj.hxx"
+#include "ndindex.hxx"
+namespace binfilter {
+
+
+
+/*N*/ SV_IMPL_OP_PTRARR_SORT( SwPosFlyFrms, SwPosFlyFrmPtr )
+
+/*N*/ SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt,
+/*N*/ USHORT nArrPos )
+/*N*/ : pNdIdx( (SwNodeIndex*) &rIdx ), pFrmFmt( pFmt )
+/*N*/ {
+/*N*/ BOOL bFnd = FALSE;
+/*N*/ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+/*N*/ if( FLY_PAGE == rAnchor.GetAnchorId() )
+/*?*/ pNdIdx = new SwNodeIndex( rIdx );
+/*N*/ else if( pFmt->GetDoc()->GetRootFrm() )
+/*N*/ {
+/*N*/ SwClientIter aIter( (SwFmt&)*pFmt );
+/*N*/ if( RES_FLYFRMFMT == pFmt->Which() )
+/*N*/ {
+/*N*/ // Schauen, ob es ein SdrObject dafuer gibt
+/*N*/ if( aIter.First( TYPE( SwFlyFrm) ) )
+/*N*/ nOrdNum = ((SwFlyFrm*)aIter())->GetVirtDrawObj()->GetOrdNum(),
+/*N*/ bFnd = TRUE;
+/*N*/ }
+/*N*/ else if( RES_DRAWFRMFMT == pFmt->Which() )
+/*N*/ {
+/*N*/ // Schauen, ob es ein SdrObject dafuer gibt
+/*N*/ if( aIter.First( TYPE(SwDrawContact) ) )
+/*N*/ nOrdNum = ((SwDrawContact*)aIter())->GetMaster()->GetOrdNum(),
+/*N*/ bFnd = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !bFnd )
+/*N*/ {
+/*N*/ nOrdNum = pFmt->GetDoc()->GetSpzFrmFmts()->Count();
+/*N*/ nOrdNum += nArrPos;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwPosFlyFrm::~SwPosFlyFrm()
+/*N*/ {
+/*N*/ const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
+/*N*/ if( FLY_PAGE == rAnchor.GetAnchorId() )
+/*?*/ delete pNdIdx;
+/*N*/ }
+
+/*N*/ BOOL SwPosFlyFrm::operator==( const SwPosFlyFrm& rPosFly )
+/*N*/ {
+/*N*/ return FALSE; // FlyFrames koennen auf der gleichen Position stehen
+/*N*/ }
+
+/*N*/ BOOL SwPosFlyFrm::operator<( const SwPosFlyFrm& rPosFly )
+/*N*/ {
+/*N*/ if( pNdIdx->GetIndex() == rPosFly.pNdIdx->GetIndex() )
+/*N*/ {
+/*N*/ // dann entscheidet die Ordnungsnummer!
+/*N*/ return nOrdNum < rPosFly.nOrdNum;
+/*N*/ }
+/*N*/ return pNdIdx->GetIndex() < rPosFly.pNdIdx->GetIndex();
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_frmtool.cxx b/binfilter/bf_sw/source/core/layout/sw_frmtool.cxx
new file mode 100644
index 000000000000..bd451cd83fb1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_frmtool.cxx
@@ -0,0 +1,3164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#define ITEMID_SIZE SID_ATTR_PAGE_SIZE
+#include <hintids.hxx>
+
+
+#include <tools/bigint.hxx>
+#include <bf_svx/svdmodel.hxx>
+#include <bf_svx/svdpage.hxx>
+#include <bf_sfx2/progress.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/keepitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/boxitem.hxx>
+#include <bf_sfx2/printer.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <docary.hxx>
+#include <lineinfo.hxx>
+#include <swmodule.hxx>
+#include "pagefrm.hxx"
+#include "colfrm.hxx"
+#include "doc.hxx"
+#include "fesh.hxx"
+#include "viewimp.hxx"
+#include "pam.hxx"
+#include "dflyobj.hxx"
+#include "dcontact.hxx"
+#include "frmtool.hxx"
+#include "docsh.hxx"
+#include "tabfrm.hxx"
+#include "rowfrm.hxx"
+#include "ftnfrm.hxx"
+#include "txtfrm.hxx"
+#include "notxtfrm.hxx"
+#include "flyfrms.hxx"
+#include "frmsh.hxx"
+#include "layact.hxx"
+#include "pagedesc.hxx"
+#include "section.hxx"
+#include "sectfrm.hxx"
+#include "node2lay.hxx"
+#include "ndole.hxx"
+#include "ndtxt.hxx"
+#include "hints.hxx"
+#include <layhelp.hxx>
+#include <laycache.hxx>
+
+#include "mdiexp.hxx"
+#include "statstr.hrc"
+// OD 21.05.2003 #108789#
+#include <paratr.hxx>
+namespace binfilter {
+
+// ftnfrm.cxx:
+/*N*/ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, BOOL bPageOnly, BOOL bEndNotes );
+
+/*N*/ FASTBOOL bObjsDirect = TRUE;
+/*N*/ FASTBOOL bDontCreateObjects = FALSE;
+/*N*/ FASTBOOL bSetCompletePaintOnInvalidate = FALSE;
+
+/*N*/ BYTE StackHack::nCnt = 0;
+/*N*/ BOOL StackHack::bLocked = FALSE;
+
+
+
+/*************************************************************************
+|*
+|* SwFrmNotify::SwFrmNotify()
+|*
+|* Ersterstellung MA 27. Nov. 92
+|* Letzte Aenderung MA 09. Apr. 97
+|*
+|*************************************************************************/
+
+/*N*/ SwFrmNotify::SwFrmNotify( SwFrm *pF ) :
+/*N*/ pFrm( pF ),
+/*N*/ aFrm( pF->Frm() ),
+/*N*/ aPrt( pF->Prt() ),
+/*N*/ bInvaKeep( FALSE )
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ ,bValidSize( pF->GetValidSizeFlag() )
+/*N*/ #endif
+/*N*/ {
+/*N*/ if ( pF->IsTxtFrm() )
+/*N*/ {
+/*N*/ mnFlyAnchorOfst = ((SwTxtFrm*)pF)->GetBaseOfstForFly( sal_True );
+/*N*/ mnFlyAnchorOfstNoWrap = ((SwTxtFrm*)pF)->GetBaseOfstForFly( sal_False );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ mnFlyAnchorOfst = 0;
+/*N*/ mnFlyAnchorOfstNoWrap = 0;
+/*N*/ }
+/*N*/
+/*N*/ bHadFollow = pF->IsCntntFrm() ?
+/*N*/ (((SwCntntFrm*)pF)->GetFollow() ? TRUE : FALSE) :
+/*N*/ FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrmNotify::~SwFrmNotify()
+|*
+|* Ersterstellung MA 27. Nov. 92
+|* Letzte Aenderung MA 09. Apr. 97
+|*
+|*************************************************************************/
+
+/*N*/ SwFrmNotify::~SwFrmNotify()
+/*N*/ {
+/*N*/ SWRECTFN( pFrm )
+/*N*/ const FASTBOOL bAbsP = POS_DIFF( aFrm, pFrm->Frm() );
+/*N*/ const FASTBOOL bChgWidth =
+/*N*/ (aFrm.*fnRect->fnGetWidth)() != (pFrm->Frm().*fnRect->fnGetWidth)();
+/*N*/ const FASTBOOL bChgHeight =
+/*N*/ (aFrm.*fnRect->fnGetHeight)()!=(pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ const FASTBOOL bChgFlyBasePos = pFrm->IsTxtFrm() &&
+/*N*/ ( ( mnFlyAnchorOfst != ((SwTxtFrm*)pFrm)->GetBaseOfstForFly( sal_True ) ) ||
+/*N*/ ( mnFlyAnchorOfstNoWrap != ((SwTxtFrm*)pFrm)->GetBaseOfstForFly( sal_False ) ) );
+/*N*/
+/*N*/ if ( pFrm->IsFlowFrm() && !pFrm->IsInFtn() )
+/*N*/ {
+/*N*/ SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( pFrm );
+/*N*/
+/*N*/ if ( !pFlow->IsFollow() )
+/*N*/ {
+/*N*/ if ( !pFrm->GetIndPrev() )
+/*N*/ {
+/*N*/ if ( bInvaKeep )
+/*N*/ {
+/*N*/ //Wenn der Vorgaenger das Attribut fuer Zusammenhalten traegt
+/*N*/ //muss er angestossen werden.
+/*N*/ SwFrm *pPre;
+/*N*/ if ( 0 != (pPre = pFrm->FindPrev()) &&
+/*N*/ pPre->GetAttrSet()->GetKeep().GetValue() )
+/*N*/ pPre->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( !pFlow->HasFollow() )
+/*N*/ {
+/*N*/ long nOldHeight = (aFrm.*fnRect->fnGetHeight)();
+/*N*/ long nNewHeight = (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( (nOldHeight > nNewHeight) || (!nOldHeight && nNewHeight) )
+/*N*/ pFlow->CheckKeep();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bAbsP )
+/*N*/ {
+/*N*/ pFrm->SetCompletePaint();
+/*N*/
+/*N*/ SwFrm* pNxt = pFrm->GetIndNext();
+/*N*/
+/*N*/ if ( pNxt )
+/*N*/ pNxt->InvalidatePos();
+/*N*/ else
+/*N*/ {
+/*N*/ // OD 04.11.2002 #104100# - correct condition for setting retouche
+/*N*/ // flag for vertical layout.
+/*N*/ if( pFrm->IsRetoucheFrm() &&
+/*N*/ (aFrm.*fnRect->fnTopDist)( (pFrm->Frm().*fnRect->fnGetTop)() ) > 0 )
+/*N*/ {
+/*N*/ pFrm->SetRetouche();
+/*N*/ }
+/*N*/
+/*N*/ //Wenn ein TxtFrm gerade einen Follow erzeugt hat, so ist dieser
+/*N*/ //frisch formatiert und braucht nicht nocheinmal angestossen werden.
+/*N*/ if ( bHadFollow || !pFrm->IsCntntFrm() ||
+/*N*/ !((SwCntntFrm*)pFrm)->GetFollow() )
+/*N*/ pFrm->InvalidateNextPos();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Fuer Hintergrundgrafiken muss bei Groessenaenderungen ein Repaint her.
+/*N*/ const FASTBOOL bPrtWidth =
+/*N*/ (aPrt.*fnRect->fnGetWidth)() != (pFrm->Prt().*fnRect->fnGetWidth)();
+/*N*/ const FASTBOOL bPrtHeight =
+/*N*/ (aPrt.*fnRect->fnGetHeight)()!=(pFrm->Prt().*fnRect->fnGetHeight)();
+/*N*/ if ( bPrtWidth || bPrtHeight )
+/*N*/ {
+/*N*/ const SvxGraphicPosition ePos = pFrm->GetAttrSet()->GetBackground().GetGraphicPos();
+/*N*/ if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
+/*N*/ pFrm->SetCompletePaint();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // OD 13.11.2002 #97597# - consider case that *only* margins between
+/*N*/ // frame and printing area has changed. Then, frame has to be repainted,
+/*N*/ // in order to force paint of the margin areas.
+/*N*/ if ( !bAbsP && (bChgWidth || bChgHeight) )
+/*N*/ {
+/*N*/ pFrm->SetCompletePaint();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const FASTBOOL bPrtP = POS_DIFF( aPrt, pFrm->Prt() );
+/*N*/ if ( bAbsP || bPrtP || bChgWidth || bChgHeight ||
+/*N*/ bPrtWidth || bPrtHeight || bChgFlyBasePos )
+/*N*/ {
+/*N*/ if( pFrm->IsAccessibleFrm() )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = pFrm->FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( pFrm, aFrm );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Auch die Flys wollen etwas von den Veraenderungen mitbekommen,
+/*N*/ //FlyInCnts brauchen hier nicht benachrichtigt werden.
+/*N*/ if ( pFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs &rObjs = *pFrm->GetDrawObjs();
+/*N*/ SwPageFrm *pPage = 0;
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ FASTBOOL bNotify = FALSE;
+/*N*/ FASTBOOL bNotifySize = FALSE;
+/*N*/ SdrObject *pObj = rObjs[i];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ if ( !pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*N*/ //Wenn sich die AbsPos geaendert hat oder der Anker kein
+/*N*/ //CntntFrm ist, so benachrichten wir auf jeden Fall.
+/*N*/ if ( bAbsP || !pFly->GetAnchor()->IsCntntFrm() )
+/*N*/ {
+/*N*/ bNotify = TRUE;
+/*N*/ if ( bAbsP )
+/*N*/ {
+/*N*/ if ( !pPage )
+/*N*/ pPage = pFrm->FindPageFrm();
+/*N*/ SwPageFrm *pFlyPage = pFly->FindPageFrm();
+/*N*/ // Am Rahmen gebundene Objekte wandern stets mit,
+/*N*/ // an TxtFrms gebundene nicht unbedingt.
+/*N*/ //MA 09. Jul. 98: An TxtFrms gebundene wurden
+/*N*/ //bereits im MakeAll formatiert und sollten
+/*N*/ //damit auf der richtigen Seite stehen.
+/*N*/ if ( pPage != pFlyPage && pFrm->IsFlyFrm() )
+/*N*/ // (pFrm->IsFlyFrm() || pOldPage != pPage ||
+/*N*/ // WEIT_WECH == pFly->Frm().Top()) )
+/*N*/ {
+/*?*/ ASSERT( pFlyPage, "~SwFrmNotify: Fly from Nowhere" );
+/*?*/ if( pFlyPage )
+/*?*/ pFlyPage->MoveFly( pFly, pPage );
+/*?*/ else
+/*?*/ pPage->SwPageFrm::AppendFly( pFly );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Andere benachrichtigen wir nur wenn sie eine
+/*N*/ //automatische Ausrichtung haben.
+/*N*/ //MA 16. Oct. 95: (fix:21063) Verfeinert.
+/*N*/ const SwFmtVertOrient &rVert =
+/*N*/ pFly->GetFmt()->GetVertOrient();
+/*N*/ const SwFmtHoriOrient &rHori =
+/*N*/ pFly->GetFmt()->GetHoriOrient();
+/*N*/ if ( (rVert.GetVertOrient() == VERT_CENTER ||
+/*N*/ rVert.GetVertOrient() == VERT_BOTTOM ||
+/*N*/ rVert.GetRelationOrient()== PRTAREA) &&
+/*N*/ ( bChgHeight || bPrtHeight ) )
+/*N*/ {
+/*N*/ bNotify = TRUE;
+/*N*/ }
+/*N*/ if ( ( rHori.GetHoriOrient() != HORI_NONE ||
+/*N*/ rHori.GetRelationOrient()== PRTAREA ||
+/*N*/ rHori.GetRelationOrient()== FRAME ) &&
+/*N*/ ( bChgWidth || bPrtWidth || bChgFlyBasePos ) )
+/*N*/ {
+/*N*/ bNotify = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if( bPrtWidth )
+/*N*/ {
+/*N*/ bNotify = TRUE;
+/*N*/ bNotifySize = TRUE;
+/*N*/ }
+/*N*/ if ( bNotify )
+/*N*/ {
+/*N*/ if ( bNotifySize )
+/*N*/ pFly->_InvalidateSize();
+/*N*/ pFly->_InvalidatePos();
+/*N*/ pFly->_Invalidate();
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( bAbsP || bChgFlyBasePos )
+/*N*/ {
+/*N*/ SwFrmFmt *pFrmFmt = FindFrmFmt( pObj );
+/*N*/ if( !pFrmFmt ||
+/*N*/ FLY_IN_CNTNT != pFrmFmt->GetAnchor().GetAnchorId() )
+/*N*/ {
+/*N*/ // OD 30.06.2003 #108784# - consider 'virtual' drawing objects.
+/*N*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
+/*N*/ pDrawVirtObj->SetAnchorPos( pFrm->GetFrmAnchorPos( ::binfilter::HasWrap( pObj ) ) );
+/*N*/ pDrawVirtObj->AdjustRelativePosToReference();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pObj->SetAnchorPos( pFrm->GetFrmAnchorPos( ::binfilter::HasWrap( pObj ) ) );
+/*N*/ ((SwDrawContact*)GetUserCall(pObj))->ChkPage();
+/*N*/ // OD 30.06.2003 #108784# - correct relative position
+/*N*/ // of 'virtual' drawing objects.
+/*N*/ SwDrawContact* pDrawContact =
+/*N*/ static_cast<SwDrawContact*>(pObj->GetUserCall());
+/*N*/ if ( pDrawContact )
+/*N*/ {
+/*N*/ pDrawContact->CorrectRelativePosOfVirtObjs();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ else if( pFrm->IsTxtFrm() && bValidSize != pFrm->GetValidSizeFlag() )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = pFrm->FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {
+/*N*/ pRootFrm->GetCurrShell()->Imp()->InvalidateAccessibleFrmContent( pFrm );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayNotify::SwLayNotify()
+|*
+|* Ersterstellung MA 17. Nov. 92
+|* Letzte Aenderung MA 03. Jun. 93
+|*
+|*************************************************************************/
+
+
+/*N*/ SwLayNotify::SwLayNotify( SwLayoutFrm *pLayFrm ) :
+/*N*/ SwFrmNotify( pLayFrm ),
+/*N*/ nHeightOfst( 0 ),
+/*N*/ nWidthOfst ( 0 ),
+/*N*/ bLowersComplete( FALSE )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayNotify::~SwLayNotify()
+|*
+|* Ersterstellung MA 17. Nov. 92
+|* Letzte Aenderung MA 13. Jun. 96
+|*
+|*************************************************************************/
+
+/*M*/ void MA_FASTCALL lcl_MoveDrawObjs( SwFrm *pLow, const Point &rDiff,
+/*M*/ SwPageFrm *pNewPage )
+/*M*/ {
+/*M*/ for ( USHORT i = 0; pLow->GetDrawObjs() && i < pLow->GetDrawObjs()->Count();
+/*M*/ ++i )
+/*M*/ {
+/*M*/ SdrObject *pObj = (*pLow->GetDrawObjs())[i];
+/*M*/ if ( pObj->IsWriterFlyFrame() )
+/*M*/ {
+/*M*/ SwFlyFrm *pF = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*M*/ if ( pF->Frm().Left() != WEIT_WECH )
+/*M*/ {
+/*M*/ BOOL bOldBack = pF->IsNotifyBack();
+/*M*/ {//Scope fuer Notify
+/*M*/ SwFlyNotify aNotify( pF );
+/*M*/ pF->Frm().Pos() += rDiff;
+/*M*/ //Wenn ein Fly die Position wechselt muss er
+/*M*/ //natuerlich an der Seite umgemeldet werden.
+/*M*/ if ( pF->IsFlyFreeFrm() )
+/*M*/ {
+/*M*/ if ( aNotify.GetOldPage() != pNewPage )
+/*M*/ {
+/*M*/ if( aNotify.GetOldPage() )
+/*M*/ aNotify.GetOldPage()->MoveFly( pF, pNewPage );
+/*M*/ else
+/*M*/ pNewPage->SwPageFrm::AppendFly( pF );
+/*M*/ }
+/*M*/ }
+/*M*/ pF->ResetNotifyBack();
+/*M*/ }
+/*M*/ if( bOldBack )
+/*M*/ pF->SetNotifyBack();
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*N*/ {
+/*N*/ // OD 30.06.2003 #108784# - consider 'virtual' drawing objects.
+/*N*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
+/*N*/ pDrawVirtObj->SetAnchorPos( pObj->GetAnchorPos() + rDiff );
+/*N*/ pDrawVirtObj->AdjustRelativePosToReference();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pObj->SetAnchorPos( pObj->GetAnchorPos() + rDiff );
+/*N*/ ((SwDrawContact*)GetUserCall(pObj))->ChkPage();
+/*N*/ // OD 30.06.2003 #108784# - correct relative position
+/*N*/ // of 'virtual' drawing objects.
+/*N*/ SwDrawContact* pDrawContact =
+/*N*/ static_cast<SwDrawContact*>(pObj->GetUserCall());
+/*N*/ if ( pDrawContact )
+/*N*/ {
+/*N*/ pDrawContact->CorrectRelativePosOfVirtObjs();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_MoveLowerFlys( SwLayoutFrm *pLay, const Point &rDiff,
+/*N*/ SwPageFrm *pNewPage )
+/*N*/ {
+/*N*/ if( pLay->IsFlyFrm() )
+/*N*/ ::binfilter::lcl_MoveDrawObjs( pLay, rDiff, pNewPage );
+/*N*/
+/*N*/ SwFrm *pLow = pLay->Lower();
+/*N*/ if( !pLow )
+/*N*/ return ;
+/*N*/
+/*N*/ do
+/*N*/ { if ( pLow->GetDrawObjs() )
+/*N*/ ::binfilter::lcl_MoveDrawObjs( pLow, rDiff, pNewPage );
+/*N*/ pLow->Frm().Pos() += rDiff;
+/*N*/ pLow->InvalidatePos();
+/*N*/ if ( pLow->IsTxtFrm() )
+/*N*/ ((SwTxtFrm*)pLow)->Prepare( PREP_POS_CHGD );
+/*N*/ else if ( pLow->IsTabFrm() )
+/*N*/ pLow->InvalidatePrt();
+/*N*/ if ( pLow->IsLayoutFrm() )
+/*N*/ ::binfilter::lcl_MoveLowerFlys( (SwLayoutFrm*)pLow, rDiff, pNewPage );
+/*N*/
+/*N*/ pLow = pLow->GetNext();
+/*N*/ } while ( pLow );
+/*N*/ }
+
+/*N*/ SwLayNotify::~SwLayNotify()
+/*N*/ {
+/*N*/ SwLayoutFrm *pLay = GetLay();
+/*N*/ SWRECTFN( pLay )
+/*N*/ FASTBOOL bNotify = FALSE;
+/*N*/ if ( pLay->Prt().SSize() != aPrt.SSize() )
+/*N*/ {
+/*N*/ if ( !IsLowersComplete() )
+/*N*/ {
+/*N*/ BOOL bInvaPercent;
+/*N*/
+/*N*/ if ( pLay->IsRowFrm() )
+/*N*/ {
+/*N*/ bInvaPercent = TRUE;
+/*N*/ long nNew = (pLay->Prt().*fnRect->fnGetHeight)();
+/*N*/ if( nNew != (aPrt.*fnRect->fnGetHeight)() )
+/*N*/ ((SwRowFrm*)pLay)->AdjustCells( nNew, TRUE);
+/*N*/ if( (pLay->Prt().*fnRect->fnGetWidth)()
+/*N*/ != (aPrt.*fnRect->fnGetWidth)() )
+/*N*/ ((SwRowFrm*)pLay)->AdjustCells( 0, FALSE );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Proportionale Anpassung der innenliegenden.
+/*N*/ //1. Wenn der Formatierte kein Fly ist
+/*N*/ //2. Wenn er keine Spalten enthaelt
+/*N*/ //3. Wenn der Fly eine feste Hoehe hat und die Spalten in der
+/*N*/ // Hoehe danebenliegen.
+/*N*/ //4. niemals bei SectionFrms.
+/*N*/ BOOL bLow;
+/*N*/ if( pLay->IsFlyFrm() )
+/*N*/ {
+/*N*/ if ( pLay->Lower() )
+/*N*/ {
+/*N*/ bLow = !pLay->Lower()->IsColumnFrm() ||
+/*N*/ (pLay->Lower()->Frm().*fnRect->fnGetHeight)()
+/*N*/ != (pLay->Prt().*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/ else
+/*?*/ bLow = FALSE;
+/*N*/ }
+/*N*/ else if( pLay->IsSctFrm() )
+/*N*/ {
+/*N*/ if ( pLay->Lower() )
+/*N*/ {
+/*N*/ if( pLay->Lower()->IsColumnFrm() && pLay->Lower()->GetNext() )
+/*?*/ bLow = pLay->Lower()->Frm().Height() != pLay->Prt().Height();
+/*N*/ else
+/*N*/ bLow = pLay->Prt().Width() != aPrt.Width();
+/*N*/ }
+/*N*/ else
+/*N*/ bLow = FALSE;
+/*N*/ }
+/*N*/ else if( pLay->IsFooterFrm() && !pLay->HasFixSize() )
+/*N*/ bLow = pLay->Prt().Width() != aPrt.Width();
+/*N*/ else
+/*N*/ bLow = TRUE;
+/*N*/ bInvaPercent = bLow;
+/*N*/ if ( bLow )
+/*N*/ {
+/*N*/ if ( nHeightOfst || nWidthOfst )
+/*N*/ {
+/*N*/ const Size aSz( aPrt.Width() + nWidthOfst,
+/*N*/ aPrt.Height() + nHeightOfst );
+/*N*/ if ( pLay->Prt().SSize() != aSz )
+/*N*/ pLay->ChgLowersProp( aSz );
+/*N*/ }
+/*N*/ else
+/*N*/ pLay->ChgLowersProp( aPrt.SSize() );
+/*N*/
+/*N*/ }
+/*N*/ //Wenn die PrtArea gewachsen ist, so ist es moeglich, dass die
+/*N*/ //Kette der Untergeordneten einen weiteren Frm aufnehmen kann,
+/*N*/ //mithin muss also der 'moeglicherweise passende' Invalidiert werden.
+/*N*/ //Das invalidieren lohnt nur, wenn es sich beim mir bzw. meinen
+/*N*/ //Uppers um eine Moveable-Section handelt.
+/*N*/ //Die PrtArea ist gewachsen, wenn die Breite oder die Hoehe groesser
+/*N*/ //geworden ist.
+/*N*/ if ( (pLay->Prt().Height() > aPrt.Height() ||
+/*N*/ pLay->Prt().Width() > aPrt.Width()) &&
+/*N*/ (pLay->IsMoveable() || pLay->IsFlyFrm()) )
+/*N*/ {
+/*N*/ SwFrm *pFrm = pLay->Lower();
+/*N*/ if ( pFrm && pFrm->IsFlowFrm() )
+/*N*/ {
+/*N*/ while ( pFrm->GetNext() )
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ pFrm->InvalidateNextPos();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ bNotify = TRUE;
+/*N*/ //TEUER!! aber wie macht man es geschickter?
+/*N*/ if( bInvaPercent )
+/*N*/ pLay->InvaPercentLowers( pLay->Prt().Height() - aPrt.Height() );
+/*N*/ }
+/*N*/ if ( pLay->IsTabFrm() )
+/*N*/ //Damit _nur_ der Shatten bei Groessenaenderungen gemalt wird.
+/*N*/ ((SwTabFrm*)pLay)->SetComplete();
+/*N*/ else if ( !pLay->GetFmt()->GetDoc()->IsBrowseMode() ||
+/*N*/ !(pLay->GetType() & (FRM_BODY | FRM_PAGE)) )
+/*N*/ //Damit die untergeordneten sauber retouchiert werden.
+/*N*/ //Problembsp: Flys an den Henkeln packen und verkleinern.
+/*N*/ //Nicht fuer Body und Page, sonst flackerts beim HTML-Laden.
+/*N*/ pLay->SetCompletePaint();
+/*N*/
+/*N*/ }
+/*N*/ //Lower benachrichtigen wenn sich die Position veraendert hat.
+/*N*/ const BOOL bPrtPos = POS_DIFF( aPrt, pLay->Prt() );
+/*N*/ const BOOL bPos = bPrtPos || POS_DIFF( aFrm, pLay->Frm() );
+/*N*/ const BOOL bSize = pLay->Frm().SSize() != aFrm.SSize();
+/*N*/
+/*N*/ if ( bPos && pLay->Lower() && !IsLowersComplete() )
+/*N*/ pLay->Lower()->InvalidatePos();
+/*N*/
+/*N*/ if ( bPrtPos )
+/*N*/ pLay->SetCompletePaint();
+/*N*/
+/*N*/ //Nachfolger benachrichtigen wenn sich die SSize geaendert hat.
+/*N*/ if ( bSize )
+/*N*/ {
+/*N*/ if( pLay->GetNext() )
+/*N*/ {
+/*N*/ if ( pLay->GetNext()->IsLayoutFrm() )
+/*N*/ pLay->GetNext()->_InvalidatePos();
+/*N*/ else
+/*N*/ pLay->GetNext()->InvalidatePos();
+/*N*/ }
+/*N*/ else if( pLay->IsSctFrm() )
+/*N*/ pLay->InvalidateNextPos();
+/*N*/ }
+/*N*/ if ( !IsLowersComplete() &&
+/*N*/ !((pLay->GetType()&FRM_FLY|FRM_SECTION) &&
+/*N*/ pLay->Lower() && pLay->Lower()->IsColumnFrm()) &&
+/*N*/ (bPos || bNotify) && !(pLay->GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
+/*N*/ {
+/*N*/ pLay->NotifyFlys();
+/*N*/ }
+/*N*/ if ( bPos && pLay->IsFtnFrm() && pLay->Lower() )
+/*N*/ {
+/*N*/ Point aDiff( (pLay->Frm().*fnRect->fnGetPos)() );
+/*N*/ aDiff -= (aFrm.*fnRect->fnGetPos)();
+/*N*/ lcl_MoveLowerFlys( pLay, aDiff, pLay->FindPageFrm() );
+/*N*/ }
+/*N*/ if( ( bPos || bSize ) && pLay->IsFlyFrm() && ((SwFlyFrm*)pLay)->GetAnchor()
+/*N*/ && ((SwFlyFrm*)pLay)->GetAnchor()->IsFlyFrm() )
+/*?*/ ((SwFlyFrm*)pLay)->GetAnchor()->InvalidateSize();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyNotify::SwFlyNotify()
+|*
+|* Ersterstellung MA 17. Nov. 92
+|* Letzte Aenderung MA 26. Aug. 93
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyNotify::SwFlyNotify( SwFlyFrm *pFlyFrm ) :
+/*N*/ SwLayNotify( pFlyFrm ),
+/*N*/ pOldPage( pFlyFrm->FindPageFrm() ),
+/*N*/ aFrmAndSpace( pFlyFrm->AddSpacesToFrm() )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFlyNotify::~SwFlyNotify()
+|*
+|* Ersterstellung MA 17. Nov. 92
+|* Letzte Aenderung MA 09. Nov. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwFlyNotify::~SwFlyNotify()
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = GetFly();
+/*N*/ if ( pFly->IsNotifyBack() )
+/*N*/ {
+/*N*/ ViewShell *pSh = pFly->GetShell();
+/*N*/ SwViewImp *pImp = pSh ? pSh->Imp() : 0;
+/*N*/ if ( !pImp || !pImp->IsAction() || !pImp->GetLayAction().IsAgain() )
+/*N*/ {
+/*N*/ //Wenn in der LayAction das IsAgain gesetzt ist kann es sein,
+/*N*/ //dass die alte Seite inzwischen vernichtet wurde!
+/*N*/ ::binfilter::Notify( pFly, pOldPage, aFrmAndSpace );
+/*N*/ }
+/*N*/ pFly->ResetNotifyBack();
+/*N*/ }
+/*N*/
+/*N*/ //Haben sich Groesse oder Position geaendert, so sollte die View
+/*N*/ //das wissen.
+/*N*/ SWRECTFN( pFly )
+/*N*/ const BOOL bPosChgd = POS_DIFF( aFrm, pFly->Frm() );
+/*N*/ if ( bPosChgd || pFly->Frm().SSize() != aFrm.SSize() )
+/*N*/ {
+/*N*/ pFly->NotifyDrawObj();
+/*N*/ }
+/*N*/ if ( bPosChgd && aFrm.Pos().X() != WEIT_WECH )
+/*N*/ {
+/*N*/ //Bei Spalten sind die Lower wahrscheinlich bereits Formatiert und
+/*N*/ //Positioniert. Bei zeichengebundenen Rahmen mit Spalten macht dies
+/*N*/ //heftige Probleme #42867#
+/*N*/ if ( pFly->Lower() &&
+/*N*/ (!pFly->IsFlyInCntFrm() || !pFly->Lower()->IsColumnFrm()) )
+/*N*/ {
+/*N*/ Point aDiff( (pFly->Frm().*fnRect->fnGetPos)() );
+/*N*/ aDiff -= (aFrm.*fnRect->fnGetPos)();
+/*N*/ lcl_MoveLowerFlys( pFly, aDiff, pFly->FindPageFrm() );
+/*N*/ }
+/*N*/
+/*N*/ if ( pFly->IsFlyAtCntFrm() )
+/*N*/ {
+/*N*/ SwFrm *pNxt = pFly->GetAnchor()->FindNext();
+/*N*/ if ( pNxt )
+/*N*/ pNxt->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*************************************************************************
+|*
+|* SwCntntNotify::SwCntntNotify()
+|*
+|* Ersterstellung MA 24. Nov. 92
+|* Letzte Aenderung MA 16. May. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwCntntNotify::SwCntntNotify( SwCntntFrm *pCntntFrm ) :
+/*N*/ SwFrmNotify( pCntntFrm )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntNotify::~SwCntntNotify()
+|*
+|* Ersterstellung MA 24. Nov. 92
+|* Letzte Aenderung MA 09. Apr. 97
+|*
+|*************************************************************************/
+
+/*N*/ SwCntntNotify::~SwCntntNotify()
+/*N*/ {
+/*N*/ SwCntntFrm *pCnt = GetCnt();
+/*N*/ if ( bSetCompletePaintOnInvalidate )
+/*N*/ pCnt->SetCompletePaint();
+/*N*/
+/*N*/
+/*N*/ //Wenn sich meine PrtArea in der Fix-Size geaendert hat, so muss mein
+/*N*/ //Nachfolger dazu angeregt werden sich auch neu zu Formatieren.
+/*N*/
+/*N*/ //MA: Ist das wirklich noetig? Auf keinen Fall sollte das doch notwendig sein,
+/*N*/ //wenn der Frm das erste Mal formatiert wurde (alte PrtArea == 0).
+/* if ( pCnt->GetNext() &&
+ pCnt->Prt().Width() != aPrt.Width() )
+ {
+ pCnt->GetNext()->Prepare( PREP_FIXSIZE_CHG );
+ pCnt->GetNext()->_InvalidatePrt();
+ pCnt->GetNext()->InvalidateSize();
+ }
+*/
+/*N*/ SWRECTFN( pCnt )
+/*N*/ if ( pCnt->IsInTab() && ( POS_DIFF( pCnt->Frm(), aFrm ) ||
+/*N*/ pCnt->Frm().SSize() != aFrm.SSize()))
+/*N*/ {
+/*N*/ SwLayoutFrm* pCell = pCnt->GetUpper();
+/*N*/ while( !pCell->IsCellFrm() && pCell->GetUpper() )
+/*?*/ pCell = pCell->GetUpper();
+/*N*/ ASSERT( pCell->IsCellFrm(), "Where's my cell?" );
+/*N*/ if ( VERT_NONE != pCell->GetFmt()->GetVertOrient().GetVertOrient() )
+/*N*/ pCell->InvalidatePrt(); //fuer vertikale Ausrichtung.
+/*N*/ }
+/*N*/
+/*N*/ FASTBOOL bFirst = (aFrm.*fnRect->fnGetWidth)() == 0;
+/*N*/
+/*N*/ if ( pCnt->IsNoTxtFrm() )
+/*N*/ {
+/*N*/ //Aktive PlugIn's oder OLE-Objekte sollten etwas von der Veraenderung
+/*N*/ //mitbekommen, damit sie Ihr Window entsprechend verschieben.
+/*N*/ ViewShell *pSh = pCnt->GetShell();
+/*N*/ if ( pSh )
+/*N*/ {
+/*N*/ SwOLENode *pNd;
+/*N*/ if ( 0 != (pNd = pCnt->GetNode()->GetOLENode()) &&
+/*N*/ (pNd->GetOLEObj().IsOleRef() ||
+/*N*/ pNd->IsOLESizeInvalid()) )
+/*N*/ {
+/*N*/ ASSERT( pCnt->IsInFly(), "OLE not in FlyFrm" );
+/*N*/ SwFlyFrm *pFly = pCnt->FindFlyFrm();
+/*N*/ SvEmbeddedObjectRef xObj( (SvInPlaceObject*) pNd->GetOLEObj().GetOleRef() );
+/*N*/ SwFEShell *pFESh = 0;
+/*N*/ ViewShell *pTmp = pSh;
+/*N*/ do
+/*N*/ { if ( pTmp->ISA( SwCrsrShell ) )
+/*N*/ {
+/*N*/ pFESh = (SwFEShell*)pTmp;
+ // #108369#: Here used to be the condition if (!bFirst).
+ // I think this should mean "do not call CalcAndSetScale"
+ // if the frame is formatted for the first time.
+ // Unfortunately this is not valid anymore since the
+ // SwNoTxtFrm already gets a width during CalcLowerPreps.
+ // Nevertheless, the indention of !bFirst seemed to be
+ // to assure that the OLE objects have already been notified
+ // if necessary before calling CalcAndSetScale.
+ // So I replaced !bFirst by !IsOLESizeInvalid. There is
+ // one additional problem specific to the word import:
+ // The layout is calculated _before_ calling PrtOLENotify,
+ // and the OLE objects are not invalidated during import.
+ // Therefore I added the condition !IsUpdateExpFld,
+ // have a look at the occurence of CalcLayout in
+ // uiview/view.cxx.
+/*N*/ if ( !pNd->IsOLESizeInvalid() &&
+/*N*/ !pSh->GetDoc()->IsUpdateExpFld() )
+/*N*/ pFESh->CalcAndSetScale( xObj, &pFly->Prt(), &pFly->Frm());
+/*N*/ }
+/*N*/ pTmp = (ViewShell*)pTmp->GetNext();
+/*N*/ } while ( pTmp != pSh );
+/*N*/
+/*N*/ if ( pFESh && pNd->IsOLESizeInvalid() )
+/*N*/ {
+/*N*/ pNd->SetOLESizeInvalid( FALSE );
+/*N*/ xObj->OnDocumentPrinterChanged( pNd->GetDoc()->GetPrt() );
+/*N*/ pFESh->CalcAndSetScale( xObj );//Client erzeugen lassen.
+/*N*/ }
+/*N*/ }
+/*N*/ //dito Animierte Grafiken
+/*N*/ if ( Frm().HasArea() && ((SwNoTxtFrm*)pCnt)->HasAnimation() )
+/*N*/ {
+/*?*/ ((SwNoTxtFrm*)pCnt)->StopAnimation();
+/*?*/ pSh->InvalidateWindows( Frm() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bFirst )
+/*N*/ {
+/*N*/ pCnt->SetRetouche(); //fix(13870)
+/*N*/
+/*N*/ SwDoc *pDoc = pCnt->GetNode()->GetDoc();
+/*N*/ if ( pDoc->GetSpzFrmFmts()->Count() &&
+/*N*/ !pDoc->IsLoaded() && !pDoc->IsNewDoc() )
+/*N*/ {
+/*N*/ //Der Frm wurde wahrscheinlich zum ersten mal formatiert.
+/*N*/ //Wenn ein Filter Flys oder Zeichenobjekte einliest und diese
+/*N*/ //Seitengebunden sind, hat er ein Problem, weil er i.d.R. die
+/*N*/ //Seitennummer nicht kennt. Er weiss lediglich welches der Inhalt
+/*N*/ //(CntntNode) an dieser Stelle ist.
+/*N*/ //Die Filter stellen dazu das Ankerattribut der Objekte so ein, dass
+/*N*/ //sie vom Typ zwar Seitengebunden sind, aber der Index des Ankers
+/*N*/ //auf diesen CntntNode zeigt.
+/*N*/ //Hier werden diese vorlauefigen Verbindungen aufgeloest.
+/*N*/
+/*N*/ const SwPageFrm *pPage = 0;
+/*N*/ SwNodeIndex *pIdx = 0;
+/*N*/ SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
+/*N*/
+/*N*/ for ( USHORT i = 0; i < pTbl->Count(); ++i )
+/*N*/ {
+/*N*/ if ( !pPage )
+/*N*/ pPage = pCnt->FindPageFrm();
+/*N*/ SwFrmFmt *pFmt = (*pTbl)[i];
+/*N*/ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+/*N*/
+/*N*/ if ( FLY_PAGE != rAnch.GetAnchorId() &&
+/*N*/ FLY_AT_CNTNT != rAnch.GetAnchorId() )
+/*N*/ continue; //#60878# nicht etwa zeichengebundene.
+/*N*/
+/*N*/ FASTBOOL bCheckPos = FALSE;
+/*N*/ if ( rAnch.GetCntntAnchor() )
+/*N*/ {
+/*N*/ if ( !pIdx )
+/*N*/ {
+/*N*/ pIdx = new SwNodeIndex( *pCnt->GetNode() );
+/*N*/ }
+/*N*/ if ( rAnch.GetCntntAnchor()->nNode == *pIdx )
+/*N*/ {
+/*N*/ bCheckPos = TRUE;
+/*N*/ if ( FLY_PAGE == rAnch.GetAnchorId() )
+/*N*/ {
+/*?*/ SwFmtAnchor aAnch( rAnch );
+/*?*/ aAnch.SetAnchor( 0 );
+/*?*/ aAnch.SetPageNum( pPage->GetPhyPageNum() );
+/*?*/ pFmt->SetAttr( aAnch );
+/*?*/ if ( RES_DRAWFRMFMT != pFmt->Which() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pFmt->MakeFrms();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !bCheckPos || RES_DRAWFRMFMT != pFmt->Which() )
+/*N*/ continue;
+/*N*/
+/*N*/ SdrObject *pObj = pFmt->FindSdrObject();
+/*N*/ const Point aAktPos( pObj->GetSnapRect().TopLeft() );
+/*N*/ Point aPos( aAktPos );
+/*N*/ FASTBOOL bSetPos = FALSE;
+/*N*/ SwFmtVertOrient *pVert;
+/*N*/ if ( SFX_ITEM_SET == pFmt->GetAttrSet().GetItemState(
+/*N*/ RES_VERT_ORIENT, FALSE, (const SfxPoolItem**)&pVert ) )
+/*N*/ {
+/*?*/ bSetPos = TRUE;
+/*?*/ switch ( pVert->GetRelationOrient() )
+/*?*/ {
+/*?*/ case REL_PG_FRAME: aPos.Y() = pPage->Frm().Top(); break;
+/*?*/ case REL_PG_PRTAREA: aPos.Y() = pPage->Frm().Top();
+/*?*/ aPos.Y() += pPage->Prt().Top(); break;
+/*?*/ case PRTAREA: aPos.Y() = pCnt->Frm().Top();
+/*?*/ aPos.Y() += pCnt->Prt().Top(); break;
+/*?*/ case FRAME: aPos.Y() = pCnt->Frm().Top(); break;
+/*?*/ default:
+/*?*/ bSetPos = FALSE;
+/*?*/ ASSERT( !this,"neuer Trick vom WW Reader?" );
+/*?*/ }
+/*?*/ aPos.Y() += pVert->GetPos();
+/*?*/ pFmt->ResetAttr( RES_VERT_ORIENT );
+/*N*/ }
+/*N*/ SwFmtHoriOrient *pHori;
+/*N*/ if ( SFX_ITEM_SET == pFmt->GetAttrSet().GetItemState(
+/*N*/ RES_HORI_ORIENT, FALSE, (const SfxPoolItem**)&pHori ) )
+/*N*/ {
+/*?*/ bSetPos = TRUE;
+/*?*/ switch ( pHori->GetRelationOrient() )
+/*?*/ {
+/*?*/ case REL_PG_FRAME: aPos.X() = pPage->Frm().Left(); break;
+/*?*/ case REL_PG_PRTAREA: aPos.X() = pPage->Frm().Left();
+/*?*/ aPos.X() += pPage->Prt().Left(); break;
+/*?*/ case PRTAREA:
+/*?*/ case FRAME:
+/*?*/ // da es fuer den WW95/97 Import ist und die
+/*?*/ // Horizontal nur Spalten kennen, muss hier die
+/*?*/ // Spalte gesucht werden. Wenn es keine gibt,
+/*?*/ // ist es die PrtArea der Seite.
+/*?*/ {
+/*?*/ SwFrm* pColFrm = pCnt->FindColFrm();
+/*?*/ if( pColFrm )
+/*?*/ aPos.X() = pColFrm->Frm().Left() +
+/*?*/ pColFrm->Prt().Left();
+/*?*/ else
+/*?*/ aPos.X() = pPage->Frm().Left() +
+/*?*/ pPage->Prt().Left();
+/*?*/ }
+/*?*/ break;
+/*?*/ default:
+/*?*/ bSetPos = FALSE;
+/*?*/ ASSERT( !this,"neuer Trick vom WW Reader?" );
+/*?*/ }
+/*?*/ aPos.X() += pHori->GetPos();
+/*?*/ pFmt->ResetAttr( RES_HORI_ORIENT );
+/*N*/ }
+/*N*/ if ( bSetPos )
+/*N*/ {
+/*?*/ aPos -= aAktPos;
+/*?*/ pObj->Move( Size( aPos.X(), aPos.Y() ) );
+/*N*/ }
+/*N*/ }
+/*N*/ delete pIdx;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* InsertCnt
+|*
+|* Beschreibung Hilfsfunktionen, die friend von irgendwem sind, damit
+|* nicht immer gleich 'ne ganze Klasse befreundet werden
+|* muss.
+|* Ersterstellung MA 13. Apr. 93
+|* Letzte Aenderung MA 11. May. 95
+|*
+|*************************************************************************/
+
+void AppendObjs( const SwSpzFrmFmts *pTbl, ULONG nIndex,
+ SwFrm *pFrm, SwPageFrm *pPage )
+{
+ for ( USHORT i = 0; i < pTbl->Count(); ++i )
+ {
+ SwFrmFmt *pFmt = (SwFrmFmt*)(*pTbl)[i];
+ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+ if ( rAnch.GetCntntAnchor() &&
+ (rAnch.GetCntntAnchor()->nNode.GetIndex() == nIndex) )
+ {
+ const bool bFlyAtFly = rAnch.GetAnchorId() == FLY_AT_FLY; // LAYER_IMPL
+ //Wird ein Rahmen oder ein SdrObject beschrieben?
+ const bool bSdrObj = RES_DRAWFRMFMT == pFmt->Which();
+ // OD 23.06.2003 #108784# - append also drawing objects anchored
+ // as character.
+ const bool bDrawObjInCntnt = bSdrObj &&
+ rAnch.GetAnchorId() == FLY_IN_CNTNT;
+
+ if( bFlyAtFly ||
+ rAnch.GetAnchorId() == FLY_AT_CNTNT ||
+ rAnch.GetAnchorId() == FLY_AUTO_CNTNT ||
+ bDrawObjInCntnt )
+ {
+ SdrObject* pSdrObj = 0;
+ if ( bSdrObj && 0 == (pSdrObj = pFmt->FindSdrObject()) )
+ {
+ ASSERT( !bSdrObj, "DrawObject not found." );
+ pFmt->GetDoc()->DelFrmFmt( pFmt );
+ --i;
+ continue;
+ }
+ if ( pSdrObj )
+ {
+ if ( !pSdrObj->GetPage() )
+ {
+ pFmt->GetDoc()->GetDrawModel()->GetPage(0)->
+ InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect());
+ }
+ // OD 25.06.2003 #108784# - move object to visible layer,
+ // if necessary.
+ if ( !pFmt->GetDoc()->IsVisibleLayerId( pSdrObj->GetLayer() ) )
+ {
+ SdrLayerID nVisibleLayerId =
+ pFmt->GetDoc()->GetVisibleLayerIdByInvisibleOne( pSdrObj->GetLayer() );
+ pSdrObj->SetLayer( nVisibleLayerId );
+ }
+
+ SwDrawContact *pNew = (SwDrawContact*)GetUserCall(pSdrObj);
+ if( !pNew->GetAnchor() )
+ {
+ pFrm->AppendDrawObj( pNew );
+ }
+ // OD 19.06.2003 #108784# - add 'virtual' drawing object,
+ // if necessary. But control objects have to be excluded.
+ else if ( !CheckControlLayer( pSdrObj ) &&
+ pNew->GetAnchor() != pFrm &&
+ !pNew->GetDrawObjectByAnchorFrm( *pFrm ) )
+ {
+ SwDrawVirtObj* pDrawVirtObj = pNew->AddVirtObj();
+ pFrm->AppendVirtDrawObj( pNew, pDrawVirtObj );
+ pDrawVirtObj->SendRepaintBroadcast();
+ }
+
+ }
+ else
+ {
+ SwFlyFrm *pFly;
+ if( bFlyAtFly )
+ pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pFrm );
+ else
+ pFly = new SwFlyAtCntFrm( (SwFlyFrmFmt*)pFmt, pFrm );
+ pFly->Lock();
+ pFrm->AppendFly( pFly );
+ pFly->Unlock();
+ if ( pPage )
+ ::binfilter::RegistFlys( pPage, pFly );
+ }
+ }
+ }
+ }
+}
+
+/*N*/ FASTBOOL MA_FASTCALL lcl_ObjConnected( SwFrmFmt *pFmt )
+/*N*/ {
+/*N*/ SwClientIter aIter( *pFmt );
+/*N*/ if ( RES_FLYFRMFMT == pFmt->Which() )
+/*N*/ return 0 != aIter.First( TYPE(SwFlyFrm) );
+/*N*/ else
+/*N*/ {
+/*N*/ SwDrawContact *pContact;
+/*N*/ if ( 0 != (pContact = (SwDrawContact*)aIter.First( TYPE(SwDrawContact))))
+/*N*/ return pContact->GetAnchor() != 0;
+/*N*/ }
+/*?*/ return FALSE;
+/*N*/ }
+
+/** helper method to determine, if a <SwFrmFmt>, which has an object connected,
+ is located in header or footer.
+
+ OD 23.06.2003 #108784#
+
+ @author OD
+*/
+bool lcl_InHeaderOrFooter( SwFrmFmt& _rFmt )
+{
+ ASSERT( lcl_ObjConnected( &_rFmt ),
+ "::lcl_InHeaderOrFooter(..) - <SwFrmFmt> has no connected object" );
+
+ bool bRetVal = false;
+
+ const SwFmtAnchor& rAnch = _rFmt.GetAnchor();
+
+ if ( rAnch.GetAnchorId() != FLY_PAGE )
+ {
+ bRetVal = _rFmt.GetDoc()->IsInHeaderFooter( rAnch.GetCntntAnchor()->nNode );
+ }
+
+ return bRetVal;
+}
+
+/*N*/ void AppendAllObjs( const SwSpzFrmFmts *pTbl )
+/*N*/ {
+/*N*/ //Verbinden aller Objekte, die in der SpzTbl beschrieben sind mit dem
+/*N*/ //Layout.
+/*N*/ //Wenn sich nix mehr tut hoeren wir auf. Dann koennen noch Formate
+/*N*/ //uebrigbleiben, weil wir weder zeichengebunde Rahmen verbinden noch
+/*N*/ //Objecte die in zeichengebundenen verankert sind.
+/*N*/
+/*N*/ SwSpzFrmFmts aCpy( 255, 255 );
+/*N*/ aCpy.Insert( pTbl, 0 );
+/*N*/
+/*N*/ USHORT nOldCnt = USHRT_MAX;
+/*N*/
+/*N*/ while ( aCpy.Count() && aCpy.Count() != nOldCnt )
+/*N*/ {
+/*N*/ nOldCnt = aCpy.Count();
+/*N*/ for ( int i = 0; i < int(aCpy.Count()); ++i )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = (SwFrmFmt*)aCpy[ USHORT(i) ];
+/*N*/ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+/*N*/ FASTBOOL bRemove = FALSE;
+/*N*/ if ( rAnch.GetAnchorId() == FLY_PAGE || rAnch.GetAnchorId() == FLY_IN_CNTNT )
+/*N*/ //Seitengebunde sind bereits verankert, zeichengebundene
+/*N*/ //will ich hier nicht.
+/*N*/ bRemove = TRUE;
+/*N*/ else if ( FALSE == (bRemove = ::binfilter::lcl_ObjConnected( pFmt )) ||
+/*N*/ ::binfilter::lcl_InHeaderOrFooter( *pFmt ) )
+/*N*/ {
+/*N*/ // OD 23.06.2003 #108784# - correction: for objects in header
+/*N*/ // or footer create frames, in spite of the fact that an connected
+/*N*/ // objects already exists.
+/*N*/ //Fuer Flys und DrawObjs nur dann ein MakeFrms rufen wenn noch
+/*N*/ //keine abhaengigen Existieren, andernfalls, oder wenn das
+/*N*/ //MakeFrms keine abhaengigen erzeugt, entfernen.
+/*N*/ pFmt->MakeFrms();
+/*N*/ bRemove = ::binfilter::lcl_ObjConnected( pFmt );
+/*N*/ }
+/*N*/ if ( bRemove )
+/*N*/ {
+/*N*/ aCpy.Remove( USHORT(i) );
+/*N*/ --i;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ aCpy.Remove( 0, aCpy.Count() );
+/*N*/ }
+
+/*M*/ void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
+/*M*/ ULONG nIndex, BOOL bPages, ULONG nEndIndex,
+/*M*/ SwFrm *pPrv )
+/*M*/ {
+/*M*/ const BOOL bOldIdle = pDoc->IsIdleTimerActive();
+/*M*/ pDoc->StopIdleTimer();
+/*M*/ const BOOL bOldCallbackActionEnabled = pDoc->GetRootFrm()->IsCallbackActionEnabled();
+/*M*/ pDoc->GetRootFrm()->SetCallbackActionEnabled( FALSE );
+/*M*/
+/*M*/ //Bei der Erzeugung des Layouts wird bPages mit TRUE uebergeben. Dann
+/*M*/ //werden schon mal alle x Absaetze neue Seiten angelegt. Bei umbruechen
+/*M*/ //und/oder Pagedescriptorwechseln werden gleich die entsprechenden Seiten
+/*M*/ //angelegt.
+/*M*/ //Vorteil ist, das einerseits schon eine annaehernd realistische Zahl von
+/*M*/ //Seiten angelegt wird, vor allem aber gibt es nicht mehr eine schier
+/*M*/ //lange Kette von Absaetzen teuer verschoben werden muss, bis sie sich auf
+/*M*/ //ertraegliches mass reduziert hat.
+/*M*/ //Wir gehen mal davon aus, da?20 Absaetze auf eine Seite passen
+/*M*/ //Damit es in extremen Faellen nicht gar so heftig rechenen wir je nach
+/*M*/ //Node noch etwas drauf.
+/*M*/ //Wenn in der DocStatistik eine brauchebare Seitenzahl angegeben ist
+/*M*/ //(wird beim Schreiben gepflegt), so wird von dieser Seitenanzahl
+/*M*/ //ausgegengen.
+/*M*/ BOOL bStartPercent = bPages && !nEndIndex &&
+/*M*/ !SfxProgress::GetActiveProgress() &&
+/*M*/ !SfxProgress::GetActiveProgress( pDoc->GetDocShell() );
+/*M*/
+/*M*/ SwPageFrm *pPage = pLay->FindPageFrm();
+/*M*/ const SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
+/*M*/ SwFrm *pFrm = 0;
+/*M*/ BOOL bBreakAfter = FALSE;
+/*M*/
+/*M*/ SwActualSection *pActualSection = 0;
+/*M*/ SwLayHelper *pPageMaker;
+/*M*/
+/*M*/ //Wenn das Layout erzeugt wird (bPages == TRUE) steuern wir den Progress
+/*M*/ //an. Flys und DrawObjekte werden dann nicht gleich verbunden, dies
+/*M*/ //passiert erst am Ende der Funktion.
+/*M*/ if ( bPages )
+/*M*/ {
+/*M*/ // Attention: the SwLayHelper class uses references to the content-,
+/*M*/ // page-, layout-frame etc. and may change them!
+/*M*/ pPageMaker = new SwLayHelper( pDoc, pFrm, pPrv, pPage, pLay,
+/*M*/ pActualSection, bBreakAfter, nIndex, 0 == nEndIndex );
+/*M*/ if( bStartPercent )
+/*M*/ {
+/*M*/ ULONG nPageCount = pPageMaker->CalcPageCount();
+/*M*/ if( nPageCount )
+/*M*/ {
+/*M*/ ::binfilter::StartProgress( STR_STATSTR_LAYOUTINIT, 1, nPageCount,
+/*M*/ pDoc->GetDocShell());
+/*M*/ bObjsDirect = FALSE;
+/*M*/ }
+/*M*/ else
+/*M*/ bStartPercent = FALSE;
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ pPageMaker = NULL;
+/*M*/
+/*M*/ if( pLay->IsInSct() &&
+/*M*/ ( pLay->IsSctFrm() || pLay->GetUpper() ) ) // Hierdurch werden Frischlinge
+/*M*/ // abgefangen, deren Flags noch nicht ermittelt werden koennen,
+/*M*/ // so z.B. beim Einfuegen einer Tabelle
+/*M*/ {
+/*M*/ SwSectionFrm* pSct = pLay->FindSctFrm();
+/*M*/ // Wenn Inhalt in eine Fussnote eingefuegt wird, die in einem spaltigen
+/*M*/ // Bereich liegt, so darf der spaltige Bereich nicht aufgebrochen werden.
+/*M*/ // Nur wenn im Innern der Fussnote ein Bereich liegt, ist dies ein
+/*M*/ // Kandidat fuer pActualSection.
+/*M*/ // Gleiches gilt fuer Bereiche in Tabellen, wenn innerhalb einer Tabelle
+/*M*/ // eingefuegt wird, duerfen nur Bereiche, die ebenfalls im Innern liegen,
+/*M*/ // aufgebrochen werden.
+/*M*/ if( ( !pLay->IsInFtn() || pSct->IsInFtn() ) &&
+/*M*/ ( !pLay->IsInTab() || pSct->IsInTab() ) )
+/*M*/ {
+/*M*/ pActualSection = new SwActualSection( 0, pSct, 0 );
+/*M*/ ASSERT( !pLay->Lower() || !pLay->Lower()->IsColumnFrm(),
+/*M*/ "_InsertCnt: Wrong Call" );
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ //If a section is "open", the pActualSection points to an SwActualSection.
+/*M*/ //If the page breaks, for "open" sections a follow will created.
+/*M*/ //For nested sections (which have, however, not a nested layout),
+/*M*/ //the SwActualSection class has a member, which points to an upper(section).
+/*M*/ //When the "inner" section finishs, the upper will used instead.
+/*M*/
+/*M*/ while( TRUE )
+/*M*/ {
+/*M*/ SwNode *pNd = pDoc->GetNodes()[nIndex];
+/*M*/ if ( pNd->IsCntntNode() )
+/*M*/ {
+/*M*/ SwCntntNode* pNode = (SwCntntNode*)pNd;
+/*M*/ pFrm = pNode->IsTxtNode() ? new SwTxtFrm( (SwTxtNode*)pNode ) :
+/*M*/ pNode->MakeFrm();
+/*M*/ if( pPageMaker && pPageMaker->CheckInsert( nIndex )
+/*M*/ && bStartPercent )
+/*M*/ ::binfilter::SetProgressState( pPage->GetPhyPageNum(),pDoc->GetDocShell());
+/*M*/
+/*M*/ pFrm->InsertBehind( pLay, pPrv );
+/*M*/ pFrm->Frm().Pos() = pLay->Frm().Pos();
+/*M*/ pFrm->Frm().Pos().Y() += 1; //wg. Benachrichtigungen.
+/*M*/ pPrv = pFrm;
+/*M*/
+/*M*/ if ( pTbl->Count() && bObjsDirect && !bDontCreateObjects )
+/*M*/ AppendObjs( pTbl, nIndex, pFrm, pPage );
+/*M*/ }
+/*M*/ else if ( pNd->IsTableNode() )
+/*M*/ { //Sollten wir auf eine Tabelle gestossen sein?
+/*M*/ SwTableNode *pTblNode = (SwTableNode*)pNd;
+
+ // #108116# loading may produce table structures that GCLines
+ // needs to clean up. To keep table formulas correct, change
+ // all table formulas to internal (BOXPTR) representation.
+/*N*/ SwTableFmlUpdate aMsgHnt( &pTblNode->GetTable() );
+/*N*/ aMsgHnt.eFlags = TBL_BOXPTR;
+/*N*/ pDoc->UpdateTblFlds( &aMsgHnt );
+/*N*/ pTblNode->GetTable().GCLines();
+/*N*/
+/*M*/ pFrm = pTblNode->MakeFrm();
+/*M*/
+/*M*/ if( pPageMaker && pPageMaker->CheckInsert( nIndex )
+/*M*/ && bStartPercent )
+/*M*/ ::binfilter::SetProgressState( pPage->GetPhyPageNum(),pDoc->GetDocShell());
+/*M*/
+/*M*/ pFrm->InsertBehind( pLay, pPrv );
+/*M*/ if ( bObjsDirect && pTbl->Count() )
+/*M*/ ((SwTabFrm*)pFrm)->RegistFlys();
+/*M*/ pFrm->Frm().Pos() = pLay->Frm().Pos();
+/*M*/ pFrm->Frm().Pos().Y() += 1; //wg. Benachrichtigungen.
+/*M*/ pPrv = pFrm;
+/*M*/ //Index auf den Endnode der Tabellensection setzen.
+/*M*/ nIndex = pTblNode->EndOfSectionIndex();
+/*N*/
+/*N*/ SwTabFrm* pTmpFrm = (SwTabFrm*)pFrm;
+/*N*/ while ( pTmpFrm )
+/*N*/ {
+/*N*/ pTmpFrm->CheckDirChange();
+/*N*/ pTmpFrm = pTmpFrm->IsFollow() ? pTmpFrm->FindMaster() : NULL;
+/*N*/ }
+/*N*/
+/*M*/ }
+/*M*/ else if ( pNd->IsSectionNode() )
+/*M*/ {
+/*M*/ SwSectionNode *pNode = (SwSectionNode*)pNd;
+/*M*/ if( pNode->GetSection().CalcHiddenFlag() )
+/*M*/ // ist versteckt, ueberspringe den Bereich
+/*M*/ nIndex = pNode->EndOfSectionIndex();
+/*M*/ else
+/*M*/ {
+/*M*/ pFrm = pNode->MakeFrm();
+/*M*/ pActualSection = new SwActualSection( pActualSection,
+/*M*/ (SwSectionFrm*)pFrm, pNode );
+/*M*/ if ( pActualSection->GetUpper() )
+/*M*/ {
+/*M*/ //Hinter den Upper einsetzen, beim EndNode wird der "Follow"
+/*M*/ //des Uppers erzeugt.
+/*M*/ SwSectionFrm *pTmp = pActualSection->GetUpper()->GetSectionFrm();
+/*M*/ pFrm->InsertBehind( pTmp->GetUpper(), pTmp );
+/*N*/ // OD 25.03.2003 #108339# - direct initialization of section
+/*N*/ // after insertion in the layout
+/*N*/ static_cast<SwSectionFrm*>(pFrm)->Init();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pFrm->InsertBehind( pLay, pPrv );
+/*N*/ // OD 25.03.2003 #108339# - direct initialization of section
+/*N*/ // after insertion in the layout
+/*N*/ static_cast<SwSectionFrm*>(pFrm)->Init();
+/*N*/ if( pPrv && pPrv->IsInFtn() )
+/*N*/ {
+/*N*/ if( pPrv->IsSctFrm() )
+/*N*/ pPrv = ((SwSectionFrm*)pPrv)->ContainsCntnt();
+/*N*/ if( pPrv && pPrv->IsTxtFrm() )
+/*N*/ ((SwTxtFrm*)pPrv)->Prepare( PREP_QUOVADIS, 0, FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ pFrm->CheckDirChange();
+/*N*/
+/*N*/ pFrm->Frm().Pos() = pLay->Frm().Pos();
+/*N*/ pFrm->Frm().Pos().Y() += 1; //wg. Benachrichtigungen.
+/*N*/ // OD 20.11.2002 #105405# - no page, no invalidate.
+/*N*/ if ( pPage )
+/*N*/ {
+/*N*/ // OD 18.09.2002 #100522#
+/*N*/ // invalidate page in order to force format and paint of
+/*N*/ // inserted section frame
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ // OD 14.11.2002 #104684# - invalidate page content in order to
+/*N*/ // force format and paint of section content.
+/*N*/ pPage->InvalidateCntnt();
+/*N*/ }
+/*N*/
+/*N*/ pLay = (SwLayoutFrm*)pFrm;
+/*N*/ if ( pLay->Lower() && pLay->Lower()->IsLayoutFrm() )
+/*N*/ pLay = pLay->GetNextLayoutLeaf();
+/*N*/ pPrv = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pNd->IsEndNode() && pNd->FindStartNode()->IsSectionNode() )
+/*N*/ {
+/*N*/ ASSERT( pActualSection, "Sectionende ohne Anfang?" );
+/*N*/ ASSERT( pActualSection->GetSectionNode() == pNd->FindStartNode(),
+/*N*/ "Sectionende mit falschen Start Node?" );
+/*N*/
+/*N*/ //Section schliessen, ggf. die umgebende Section wieder
+/*N*/ //aktivieren.
+/*N*/ SwActualSection *pTmp = pActualSection->GetUpper();
+/*N*/ delete pActualSection;
+/*N*/ pLay = pLay->FindSctFrm();
+/*N*/ if ( 0 != (pActualSection = pTmp) )
+/*N*/ {
+/*N*/ //Koennte noch sein, das der letzte SectionFrm leer geblieben
+/*N*/ //ist. Dann ist es jetzt an der Zeit ihn zu entfernen.
+/*N*/ if ( !pLay->ContainsCntnt() )
+/*N*/ {
+/*N*/ SwFrm *pTmp = pLay;
+/*N*/ pLay = pTmp->GetUpper();
+/*N*/ pPrv = pTmp->GetPrev();
+/*N*/ pTmp->Remove();
+/*N*/ delete pTmp;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pPrv = pLay;
+/*N*/ pLay = pLay->GetUpper();
+/*N*/ }
+/*N*/
+/*N*/ // new section frame
+/*N*/ pFrm = pActualSection->GetSectionNode()->MakeFrm();
+/*N*/ pFrm->InsertBehind( pLay, pPrv );
+/*N*/ static_cast<SwSectionFrm*>(pFrm)->Init();
+/*N*/
+/*N*/ pFrm->Frm().Pos() = pLay->Frm().Pos();
+/*N*/ pFrm->Frm().Pos().Y() += 1; //wg. Benachrichtigungen.
+/*N*/
+/*N*/ SwSectionFrm* pOuterSectionFrm = pActualSection->GetSectionFrm();
+/*N*/
+/*N*/ // a follow has to be appended to the new section frame
+/*N*/ SwSectionFrm* pFollow = pOuterSectionFrm->GetFollow();
+/*N*/ if ( pFollow )
+/*N*/ {
+/*N*/ pOuterSectionFrm->SetFollow( NULL );
+/*N*/ pOuterSectionFrm->InvalidateSize();
+/*N*/ ((SwSectionFrm*)pFrm)->SetFollow( pFollow );
+/*N*/ }
+/*N*/
+/*N*/ // Wir wollen keine leeren Teile zuruecklassen
+/*N*/ if( ! pOuterSectionFrm->IsColLocked() &&
+/*N*/ ! pOuterSectionFrm->ContainsCntnt() )
+/*N*/ {
+/*N*/ pOuterSectionFrm->DelEmpty( TRUE );
+/*N*/ delete pOuterSectionFrm;
+/*N*/ }
+/*N*/ pActualSection->SetSectionFrm( (SwSectionFrm*)pFrm );
+/*N*/
+/*N*/ pLay = (SwLayoutFrm*)pFrm;
+/*N*/ if ( pLay->Lower() && pLay->Lower()->IsLayoutFrm() )
+/*N*/ pLay = pLay->GetNextLayoutLeaf();
+/*N*/ pPrv = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Nix mehr mit Sections, es geht direkt hinter dem SectionFrame
+/*N*/ //weiter.
+/*N*/ pPrv = pLay;
+/*N*/ pLay = pLay->GetUpper();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pNd->IsStartNode() &&
+/*N*/ SwFlyStartNode == ((SwStartNode*)pNd)->GetStartNodeType() )
+/*N*/ {
+/*N*/ if ( pTbl->Count() && bObjsDirect && !bDontCreateObjects )
+/*N*/ {
+/*N*/ SwFlyFrm* pFly = pLay->FindFlyFrm();
+/*N*/ if( pFly )
+/*N*/ AppendObjs( pTbl, nIndex, pFly, pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ // Weder Cntnt noch Tabelle noch Section,
+/*N*/ // also muessen wir fertig sein.
+/*N*/ break;
+/*N*/
+/*N*/ ++nIndex;
+/*N*/ // Der Endnode wird nicht mehr mitgenommen, es muss vom
+/*N*/ // Aufrufenden (Section/MakeFrms()) sichergestellt sein, dass das Ende
+/*N*/ // des Bereichs vor dem EndIndex liegt!
+/*N*/ if ( nEndIndex && nIndex >= nEndIndex )
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if ( pActualSection )
+/*N*/ {
+/*N*/ //Kann passieren, dass noch eine leere (Follow-)Section uebrig geblieben ist.
+/*N*/ if ( !(pLay = pActualSection->GetSectionFrm())->ContainsCntnt() )
+/*N*/ {
+/*N*/ pLay->Remove();
+/*N*/ delete pLay;
+/*N*/ }
+/*N*/ delete pActualSection;
+/*N*/ }
+/*N*/
+/*N*/ if ( bPages ) //Jetzt noch die Flys verbinden lassen.
+/*N*/ {
+/*N*/ if ( !bDontCreateObjects )
+/*N*/ AppendAllObjs( pTbl );
+/*N*/ bObjsDirect = TRUE;
+/*N*/ if ( bStartPercent )
+/*N*/ ::binfilter::EndProgress( pDoc->GetDocShell() );
+/*N*/ }
+/*N*/
+/*N*/ if( pPageMaker )
+/*N*/ {
+/*N*/ pPageMaker->CheckFlyCache( pPage );
+/*N*/ delete pPageMaker;
+/*N*/ if( pDoc->GetLayoutCache() )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pDoc->GetLayoutCache()->CompareLayout( *pDoc );
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ pDoc->GetLayoutCache()->ClearImpl();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bOldIdle )
+/*N*/ pDoc->StartIdleTimer();
+/*N*/ pDoc->GetRootFrm()->SetCallbackActionEnabled( bOldCallbackActionEnabled );
+/*N*/ }
+
+
+void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
+ const SwNodeIndex &rEndIdx )
+{
+ bObjsDirect = FALSE;
+
+ SwNodeIndex aTmp( rSttIdx );
+ ULONG nEndIdx = rEndIdx.GetIndex();
+ SwNode* pNd = pDoc->GetNodes().FindPrvNxtFrmNode( aTmp,
+ pDoc->GetNodes()[ nEndIdx-1 ]);
+ if ( pNd )
+ {
+ BOOL bApres = aTmp < rSttIdx;
+ SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() );
+ SwFrm* pFrm;
+ while( 0 != (pFrm = aNode2Layout.NextFrm()) )
+ {
+ SwLayoutFrm *pUpper = pFrm->GetUpper();
+ SwFtnFrm* pFtnFrm = pUpper->FindFtnFrm();
+ BOOL bOldLock, bOldFtn;
+ if( pFtnFrm )
+ {
+ bOldFtn = pFtnFrm->IsColLocked();
+ pFtnFrm->ColLock();
+ }
+ else
+ bOldFtn = TRUE;
+ SwSectionFrm* pSct = pUpper->FindSctFrm();
+ // Es sind innerhalb von Fussnoten nur die Bereiche interessant,
+ // die in den Fussnoten liegen, nicht etwa die (spaltigen) Bereiche,
+ // in denen die Fussnoten(Container) liegen.
+ // #109767# Table frame is in section, insert section in cell frame.
+ if( pSct && ( pFtnFrm && !pSct->IsInFtn() ) || pUpper->IsCellFrm() )
+ pSct = NULL;
+ if( pSct )
+ { // damit der SectionFrm nicht zerstoert wird durch pTmp->MoveFwd()
+ bOldLock = pSct->IsColLocked();
+ pSct->ColLock();
+ }
+ else
+ bOldLock = TRUE;
+
+ // Wenn pFrm sich nicht bewegen kann, koennen wir auch niemanden
+ // auf die naechste Seite schieben. Innerhalb eines Rahmens auch
+ // nicht ( in der 1. Spalte eines Rahmens waere pFrm Moveable()! )
+ // Auch in spaltigen Bereichen in Tabellen waere pFrm Moveable.
+ BOOL bMoveNext = nEndIdx - rSttIdx.GetIndex() > 120;
+ BOOL bAllowMove = !pFrm->IsInFly() && pFrm->IsMoveable() &&
+ (!pFrm->IsInTab() || pFrm->IsTabFrm() );
+ if ( bMoveNext && bAllowMove )
+ {
+ SwFrm *pMove = pFrm;
+ SwFrm *pPrev = pFrm->GetPrev();
+ SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pMove );
+ ASSERT( pTmp, "Missing FlowFrm" );
+
+ if ( bApres )
+ {
+ // Wir wollen, dass der Rest der Seite leer ist, d.h.
+ // der naechste muss auf die naechste Seite wandern.
+ // Dieser kann auch in der naechsten Spalte stehen!
+ ASSERT( !pTmp->HasFollow(), "Follows forbidden" );
+ pPrev = pFrm;
+ // Wenn unser umgebender SectionFrm einen Next besitzt,
+ // so soll dieser ebenfalls gemoved werden!
+ pMove = pFrm->GetIndNext();
+ SwColumnFrm* pCol = (SwColumnFrm*)pFrm->FindColFrm();
+ if( pCol )
+ pCol = (SwColumnFrm*)pCol->GetNext();
+ do
+ {
+ if( pCol && !pMove )
+ { // Bisher haben wir keinen Nachfolger gefunden
+ // jetzt gucken wir in die naechste Spalte
+ pMove = pCol->ContainsAny();
+ if( pCol->GetNext() )
+ pCol = (SwColumnFrm*)pCol->GetNext();
+ else if( pCol->IsInSct() )
+ { // Wenn es keine naechste Spalte gibt, wir aber
+ // innerhalb eines spaltigen Bereichs sind,
+ // koennte es noch ausserhalb des Bereich
+ // (Seiten-)Spalten geben
+ pCol = (SwColumnFrm*)pCol->FindSctFrm()->FindColFrm();
+ if( pCol )
+ pCol = (SwColumnFrm*)pCol->GetNext();
+ }
+ else
+ pCol = NULL;
+ }
+ // Falls hier verschrottete SectionFrms herumgammeln,
+ // muessen diese uebersprungen werden.
+ while( pMove && pMove->IsSctFrm() &&
+ !((SwSectionFrm*)pMove)->GetSection() )
+ pMove = pMove->GetNext();
+ } while( !pMove && pCol );
+
+ if( pMove )
+ {
+ if ( pMove->IsCntntFrm() )
+ pTmp = (SwCntntFrm*)pMove;
+ else if ( pMove->IsTabFrm() )
+ pTmp = (SwTabFrm*)pMove;
+ else if ( pMove->IsSctFrm() )
+ {
+ pMove = ((SwSectionFrm*)pMove)->ContainsAny();
+ if( pMove )
+ pTmp = SwFlowFrm::CastFlowFrm( pMove );
+ else
+ pTmp = NULL;
+ }
+ }
+ else
+ pTmp = 0;
+ }
+ else
+ {
+ ASSERT( !pTmp->IsFollow(), "Follows really forbidden" );
+ // Bei Bereichen muss natuerlich der Inhalt auf die Reise
+ // geschickt werden.
+ if( pMove->IsSctFrm() )
+ {
+ while( pMove && pMove->IsSctFrm() &&
+ !((SwSectionFrm*)pMove)->GetSection() )
+ pMove = pMove->GetNext();
+ if( pMove && pMove->IsSctFrm() )
+ pMove = ((SwSectionFrm*)pMove)->ContainsAny();
+ if( pMove )
+ pTmp = SwFlowFrm::CastFlowFrm( pMove );
+ else
+ pTmp = NULL;
+ }
+ }
+
+ if( pTmp )
+ {
+ SwFrm* pOldUp = pTmp->GetFrm()->GetUpper();
+ // MoveFwd==TRUE bedeutet, dass wir auf der gleichen
+ // Seite geblieben sind, wir wollen aber die Seite wechseln,
+ // sofern dies moeglich ist
+ BOOL bOldLock = pTmp->IsJoinLocked();
+ pTmp->LockJoin();
+ while( pTmp->MoveFwd( TRUE, FALSE, TRUE ) )
+ {
+ if( pOldUp == pTmp->GetFrm()->GetUpper() )
+ break;
+ pOldUp = pTmp->GetFrm()->GetUpper();
+ }
+ if( !bOldLock )
+ pTmp->UnlockJoin();
+ }
+ ::binfilter::_InsertCnt( pUpper, pDoc, rSttIdx.GetIndex(),
+ pFrm->IsInDocBody(), nEndIdx, pPrev );
+ }
+ else
+ {
+ BOOL bSplit;
+ SwFrm* pPrv = bApres ? pFrm : pFrm->GetPrev();
+ // Wenn in einen SectionFrm ein anderer eingefuegt wird,
+ // muss dieser aufgebrochen werden
+ if( pSct && rSttIdx.GetNode().IsSectionNode() )
+ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+ }
+ else
+ bSplit = FALSE;
+ ::binfilter::_InsertCnt( pUpper, pDoc, rSttIdx.GetIndex(), FALSE,
+ nEndIdx, pPrv );
+ // OD 23.06.2003 #108784# - correction: append objects doesn't
+ // depend on value of <bAllowMove>
+ if( !bDontCreateObjects )
+ {
+ const SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
+ if( pTbl->Count() )
+ AppendAllObjs( pTbl );
+ }
+
+ // Wenn nichts eingefuegt wurde, z.B. ein ausgeblendeter Bereich,
+ // muss das Splitten rueckgaengig gemacht werden
+ if( bSplit && pSct && pSct->GetNext()
+ && pSct->GetNext()->IsSctFrm() )
+ pSct->MergeNext( (SwSectionFrm*)pSct->GetNext() );
+ if( pFrm->IsInFly() )
+ pFrm->FindFlyFrm()->_Invalidate();
+ if( pFrm->IsInTab() )
+ pFrm->InvalidateSize();
+ }
+
+ SwPageFrm *pPage = pUpper->FindPageFrm();
+ SwFrm::CheckPageDescs( pPage, FALSE );
+ if( !bOldFtn )
+ pFtnFrm->ColUnlock();
+ if( !bOldLock )
+ {
+ pSct->ColUnlock();
+ // Zum Beispiel beim Einfuegen von gelinkten Bereichen,
+ // die wiederum Bereiche enthalten, kann pSct jetzt leer sein
+ // und damit ruhig zerstoert werden.
+ if( !pSct->ContainsCntnt() )
+ {
+ pSct->DelEmpty( TRUE );
+ pDoc->GetRootFrm()->RemoveFromList( pSct );
+ delete pSct;
+ }
+ }
+ }
+ }
+
+ bObjsDirect = TRUE;
+}
+
+
+/*************************************************************************
+|*
+|* SwBorderAttrs::Ctor, DTor
+|*
+|* Ersterstellung MA 19. May. 93
+|* Letzte Aenderung MA 25. Jan. 97
+|*
+|*************************************************************************/
+
+/*N*/ SwBorderAttrs::SwBorderAttrs( const SwModify *pMod, const SwFrm *pConstructor ) :
+/*N*/ SwCacheObj( pMod ),
+/*N*/ rAttrSet( pConstructor->IsCntntFrm()
+/*N*/ ? ((SwCntntFrm*)pConstructor)->GetNode()->GetSwAttrSet()
+/*N*/ : ((SwLayoutFrm*)pConstructor)->GetFmt()->GetAttrSet() ),
+/*N*/ rUL ( rAttrSet.GetULSpace() ),
+/*N*/ rLR ( rAttrSet.GetLRSpace() ),
+/*N*/ rBox ( rAttrSet.GetBox() ),
+/*N*/ rShadow ( rAttrSet.GetShadow() ),
+/*N*/ aFrmSize( rAttrSet.GetFrmSize().GetSize() )
+/*N*/ {
+/*N*/ //Achtung: Die USHORTs fuer die gecache'ten Werte werden absichtlich
+/*N*/ //nicht initialisiert!
+/*N*/
+/*N*/ //Muessen alle einmal berechnet werden:
+/*N*/ bTopLine = bBottomLine = bLeftLine = bRightLine =
+/*N*/ bTop = bBottom = bLine = TRUE;
+/*N*/
+/*N*/ bCacheGetLine = bCachedGetTopLine = bCachedGetBottomLine = FALSE;
+/*N*/ // OD 21.05.2003 #108789# - init cache status for values <bJoinedWithPrev>
+/*N*/ // and <bJoinedWithNext>, which aren't initialized by default.
+/*N*/ bCachedJoinedWithPrev = FALSE;
+/*N*/ bCachedJoinedWithNext = FALSE;
+/*N*/
+/*N*/ bBorderDist = 0 != (pConstructor->GetType() & (FRM_CELL));
+/*N*/ }
+
+/*N*/ SwBorderAttrs::~SwBorderAttrs()
+/*N*/ {
+/*N*/ ((SwModify*)pOwner)->SetInCache( FALSE );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwBorderAttrs::CalcTop(), CalcBottom(), CalcLeft(), CalcRight()
+|*
+|* Beschreibung Die Calc-Methoden errechnen zusaetzlich zu den
+|* von den Attributen vorgegebenen Groessen einen Sicherheitsabstand.
+|* der Sicherheitsabstand wird nur einkalkuliert, wenn Umrandung und/oder
+|* Schatten im Spiel sind; er soll vermeiden, dass aufgrund der
+|* groben physikalischen Gegebenheiten Raender usw. uebermalt werden.
+|* Ersterstellung MA 19. May. 93
+|* Letzte Aenderung MA 08. Jul. 93
+|*
+|*************************************************************************/
+
+/*N*/ void SwBorderAttrs::_CalcTop()
+/*N*/ {
+/*N*/ nTop = CalcTopLine() + rUL.GetUpper();
+/*N*/ bTop = FALSE;
+/*N*/ }
+
+/*N*/ void SwBorderAttrs::_CalcBottom()
+/*N*/ {
+/*N*/ nBottom = CalcBottomLine() + rUL.GetLower();
+/*N*/ bBottom = FALSE;
+/*N*/ }
+
+/*N*/ long SwBorderAttrs::CalcRight( const SwFrm* pCaller ) const
+/*N*/ {
+/*N*/ long nRight;
+/*N*/
+/*N*/ // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
+/*N*/ // and right border are painted on the right respectively left.
+/*N*/ if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
+/*N*/ nRight = CalcLeftLine();
+/*N*/ else
+/*N*/ nRight = CalcRightLine();
+/*N*/
+/*N*/ // for paragraphs, "left" is "before text" and "right" is "after text"
+/*N*/ if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
+/*N*/ nRight += rLR.GetLeft();
+/*N*/ else
+/*N*/ nRight += rLR.GetRight();
+/*N*/
+/*N*/ return nRight;
+/*N*/ }
+
+/*N*/ long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const
+/*N*/ {
+/*N*/ long nLeft;
+/*N*/
+/*N*/ // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
+/*N*/ // and right border are painted on the right respectively left.
+/*N*/ if ( pCaller->IsCellFrm() && pCaller->IsRightToLeft() )
+/*N*/ nLeft = CalcRightLine();
+/*N*/ else
+/*N*/ nLeft = CalcLeftLine();
+/*N*/
+/*N*/ // for paragraphs, "left" is "before text" and "right" is "after text"
+/*N*/ if ( pCaller->IsTxtFrm() && pCaller->IsRightToLeft() )
+/*N*/ nLeft += rLR.GetRight();
+/*N*/ else
+/*N*/ nLeft += rLR.GetLeft();
+/*N*/
+/*N*/ if ( pCaller->IsTxtFrm() )
+/*N*/ nLeft += ((SwTxtFrm*)pCaller)->GetTxtNode()->GetLeftMarginWithNum();
+/*N*/
+/*N*/ return nLeft;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwBorderAttrs::CalcTopLine(), CalcBottomLine(),
+|* CalcLeftLine(), CalcRightLine()
+|*
+|* Beschreibung Berechnung der Groessen fuer Umrandung und Schatten.
+|* Es kann auch ohne Linien ein Abstand erwuenscht sein,
+|* dieser wird dann nicht vom Attribut sondern hier
+|* beruecksichtigt (bBorderDist, z.B. fuer Zellen).
+|* Ersterstellung MA 21. May. 93
+|* Letzte Aenderung MA 07. Jun. 99
+|*
+|*************************************************************************/
+
+/*N*/ void SwBorderAttrs::_CalcTopLine()
+/*N*/ {
+/*N*/ nTopLine = (bBorderDist && !rBox.GetTop())
+/*N*/ ? rBox.GetDistance (BOX_LINE_TOP)
+/*N*/ : rBox.CalcLineSpace(BOX_LINE_TOP);
+/*N*/ nTopLine += rShadow.CalcShadowSpace(SHADOW_TOP);
+/*N*/ bTopLine = FALSE;
+/*N*/ }
+
+/*N*/ void SwBorderAttrs::_CalcBottomLine()
+/*N*/ {
+/*N*/ nBottomLine = (bBorderDist && !rBox.GetBottom())
+/*N*/ ? rBox.GetDistance (BOX_LINE_BOTTOM)
+/*N*/ : rBox.CalcLineSpace(BOX_LINE_BOTTOM);
+/*N*/ nBottomLine += rShadow.CalcShadowSpace(SHADOW_BOTTOM);
+/*N*/ bBottomLine = FALSE;
+/*N*/ }
+
+/*N*/ void SwBorderAttrs::_CalcLeftLine()
+/*N*/ {
+/*N*/ nLeftLine = (bBorderDist && !rBox.GetLeft())
+/*N*/ ? rBox.GetDistance (BOX_LINE_LEFT)
+/*N*/ : rBox.CalcLineSpace(BOX_LINE_LEFT);
+/*N*/ nLeftLine += rShadow.CalcShadowSpace(SHADOW_LEFT);
+/*N*/ bLeftLine = FALSE;
+/*N*/ }
+
+/*N*/ void SwBorderAttrs::_CalcRightLine()
+/*N*/ {
+/*N*/ nRightLine = (bBorderDist && !rBox.GetRight())
+/*N*/ ? rBox.GetDistance (BOX_LINE_RIGHT)
+/*N*/ : rBox.CalcLineSpace(BOX_LINE_RIGHT);
+/*N*/ nRightLine += rShadow.CalcShadowSpace(SHADOW_RIGHT);
+/*N*/ bRightLine = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwBorderAttrs::_IsLine()
+|*
+|* Ersterstellung MA 29. Sep. 94
+|* Letzte Aenderung MA 29. Sep. 94
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwBorderAttrs::CmpLeftRightLine(), IsTopLine(), IsBottomLine()
+|*
+|* Die Umrandungen benachbarter Absaetze werden nach folgendem
+|* Algorithmus zusammengefasst:
+|*
+|* 1. Die Umrandung oben faellt weg, wenn der Vorgaenger dieselbe
+|* Umrandung oben aufweist und 3. Zutrifft.
+|* Zusaetzlich muss der Absatz mindestens rechts oder links oder
+|* unten eine Umrandung haben.
+|* 2. Die Umrandung unten faellt weg, wenn der Nachfolger dieselbe
+|* Umrandung untern aufweist und 3. Zustrifft.
+|* Zusaetzlich muss der Absatz mindestens rechts oder links oder
+|* oben eine Umrandung haben.
+|* 3. Die Umrandungen links und rechts vor Vorgaenger bzw. Nachfolger
+|* sind identisch.
+|*
+|* Ersterstellung MA 22. Mar. 95
+|* Letzte Aenderung MA 22. May. 95
+|*
+|*************************************************************************/
+/*N*/ inline int CmpLines( const SvxBorderLine *pL1, const SvxBorderLine *pL2 )
+/*N*/ {
+/*N*/ return ( ((pL1 && pL2) && (*pL1 == *pL2)) || (!pL1 && !pL2) );
+/*N*/ }
+
+// OD 21.05.2003 #108789# - change name of 1st parameter - "rAttrs" -> "rCmpAttrs"
+// OD 21.05.2003 #108789# - compare <CalcRight()> and <rCmpAttrs.CalcRight()>
+// instead of only the right LR-spacing, because R2L-layout has to be
+// considered.
+BOOL SwBorderAttrs::CmpLeftRight( const SwBorderAttrs &rCmpAttrs,
+ const SwFrm *pCaller,
+ const SwFrm *pCmp ) const
+{
+ return ( CmpLines( rCmpAttrs.GetBox().GetLeft(), GetBox().GetLeft() ) &&
+ CmpLines( rCmpAttrs.GetBox().GetRight(),GetBox().GetRight() ) &&
+ CalcLeft( pCaller ) == rCmpAttrs.CalcLeft( pCmp ) &&
+ // OD 21.05.2003 #108789# - compare <CalcRight> with <rCmpAttrs.CalcRight>.
+ CalcRight( pCaller ) == rCmpAttrs.CalcRight( pCmp ) );
+}
+
+BOOL SwBorderAttrs::_JoinWithCmp( const SwFrm& _rCallerFrm,
+ const SwFrm& _rCmpFrm ) const
+{
+ BOOL bReturnVal = FALSE;
+
+ SwBorderAttrAccess aCmpAccess( SwFrm::GetCache(), &_rCmpFrm );
+ const SwBorderAttrs &rCmpAttrs = *aCmpAccess.Get();
+ if ( rShadow == rCmpAttrs.GetShadow() &&
+ CmpLines( rBox.GetTop(), rCmpAttrs.GetBox().GetTop() ) &&
+ CmpLines( rBox.GetBottom(), rCmpAttrs.GetBox().GetBottom() ) &&
+ CmpLeftRight( rCmpAttrs, &_rCallerFrm, &_rCmpFrm )
+ )
+ {
+ bReturnVal = TRUE;
+ }
+
+ return bReturnVal;
+}
+
+// OD 21.05.2003 #108789# - method to determine, if borders are joined with
+// previous frame. Calculated value saved in cached value <bJoinedWithPrev>
+void SwBorderAttrs::_CalcJoinedWithPrev( const SwFrm& _rFrm )
+{
+ // set default
+ bJoinedWithPrev = FALSE;
+
+ // text frame can potentially join with previous text frame, if
+ // corresponding attribute set is set at previous text frame.
+ if ( _rFrm.GetPrev() &&
+ _rFrm.IsTxtFrm() && _rFrm.GetPrev()->IsTxtFrm() &&
+ _rFrm.GetPrev()->GetAttrSet()->GetParaConnectBorder().GetValue()
+ )
+ {
+ bJoinedWithPrev = _JoinWithCmp( _rFrm, *(_rFrm.GetPrev()) );
+ }
+
+ // valid cache status, if demanded
+ bCachedJoinedWithPrev = bCacheGetLine;
+}
+
+// OD 21.05.2003 #108789# - method to determine, if borders are joined with
+// next frame. Calculated value saved in cached value <bJoinedWithNext>
+void SwBorderAttrs::_CalcJoinedWithNext( const SwFrm& _rFrm )
+{
+ // set default
+ bJoinedWithNext = FALSE;
+
+ // text frame can potentially join with next text frame, if
+ // corresponding attribute set is set at current text frame.
+ if ( _rFrm.GetNext() &&
+ _rFrm.IsTxtFrm() && _rFrm.GetNext()->IsTxtFrm() &&
+ _rFrm.GetAttrSet()->GetParaConnectBorder().GetValue()
+ )
+ {
+ bJoinedWithNext = _JoinWithCmp( _rFrm, *(_rFrm.GetNext()) );
+ }
+
+ // valid cache status, if demanded
+ bCachedJoinedWithNext = bCacheGetLine;
+}
+
+// OD 21.05.2003 #108789# - accessor for cached values <bJoinedWithPrev>
+BOOL SwBorderAttrs::JoinedWithPrev( const SwFrm& _rFrm ) const
+{
+ if ( !bCachedJoinedWithPrev )
+ {
+ const_cast<SwBorderAttrs*>(this)->_CalcJoinedWithPrev( _rFrm );
+ }
+
+ return bJoinedWithPrev;
+}
+
+BOOL SwBorderAttrs::JoinedWithNext( const SwFrm& _rFrm ) const
+{
+ if ( !bCachedJoinedWithNext )
+ {
+ const_cast<SwBorderAttrs*>(this)->_CalcJoinedWithNext( _rFrm );
+ }
+
+ return bJoinedWithNext;
+}
+
+void SwBorderAttrs::_GetTopLine( const SwFrm *pFrm )
+{
+ USHORT nRet = CalcTopLine();
+
+ // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
+ if ( JoinedWithPrev( *(pFrm) ) )
+ {
+ nRet = 0;
+ }
+ /*
+ if ( nRet && pFrm->GetPrev() && pFrm->IsCntntFrm() && pFrm->GetPrev()->IsCntntFrm() )
+ {
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm->GetPrev() );
+ const SwBorderAttrs &rAttrs = *aAccess.Get();
+ if ( nRet == rAttrs.CalcTopLine() )
+ {
+ if ( (GetBox().GetLeft() || GetBox().GetRight() || GetBox().GetBottom()) &&
+ rAttrs.GetShadow() == rShadow &&
+ CmpLines( rAttrs.GetBox().GetTop(), rBox.GetTop() ) &&
+ CmpLeftRight( rAttrs, pFrm, pFrm->GetPrev() ) )
+ {
+ nRet = 0;
+ }
+ }
+ }
+ */
+
+ bCachedGetTopLine = bCacheGetLine;
+
+ nGetTopLine = nRet;
+}
+
+void SwBorderAttrs::_GetBottomLine( const SwFrm *pFrm )
+{
+ USHORT nRet = CalcBottomLine();
+
+ // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
+ if ( JoinedWithNext( *(pFrm) ) )
+ {
+ nRet = 0;
+ }
+ /*
+ if ( nRet && pFrm->GetNext() && pFrm->IsCntntFrm() && pFrm->GetNext()->IsCntntFrm() )
+ {
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm->GetNext() );
+ const SwBorderAttrs &rAttrs = *aAccess.Get();
+ if ( nRet == rAttrs.CalcBottomLine() )
+ {
+ if ( (GetBox().GetLeft() || GetBox().GetRight() || GetBox().GetTop()) &&
+ rAttrs.GetShadow() == rShadow &&
+ CmpLines( rAttrs.GetBox().GetBottom(), rBox.GetBottom() ) &&
+ CmpLeftRight( rAttrs, pFrm, pFrm->GetNext() ) )
+ {
+ nRet = 0;
+ }
+ }
+ }
+ */
+ bCachedGetBottomLine = bCacheGetLine;
+
+ nGetBottomLine = nRet;
+}
+
+/*************************************************************************
+|*
+|* SwBorderAttrAccess::CTor
+|*
+|* Ersterstellung MA 20. Mar. 95
+|* Letzte Aenderung MA 29. Nov. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwBorderAttrAccess::SwBorderAttrAccess( SwCache &rCache, const SwFrm *pFrm ) :
+/*N*/ SwCacheAccess( rCache, (pFrm->IsCntntFrm() ?
+/*N*/ (void*)((SwCntntFrm*)pFrm)->GetNode() :
+/*N*/ (void*)((SwLayoutFrm*)pFrm)->GetFmt()),
+/*N*/ (BOOL)(pFrm->IsCntntFrm() ?
+/*N*/ (BOOL)((SwModify*)((SwCntntFrm*)pFrm)->GetNode())->IsInCache() :
+/*N*/ (BOOL)((SwModify*)((SwLayoutFrm*)pFrm)->GetFmt())->IsInCache()) ),
+/*N*/ pConstructor( pFrm )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwBorderAttrAccess::NewObj, Get
+|*
+|* Ersterstellung MA 20. Mar. 95
+|* Letzte Aenderung MA 20. Mar. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwCacheObj *SwBorderAttrAccess::NewObj()
+/*N*/ {
+/*N*/ ((SwModify*)pOwner)->SetInCache( TRUE );
+/*N*/ return new SwBorderAttrs( (SwModify*)pOwner, pConstructor );
+/*N*/ }
+
+/*N*/ SwBorderAttrs *SwBorderAttrAccess::Get()
+/*N*/ {
+/*N*/ return (SwBorderAttrs*)SwCacheAccess::Get();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwOrderIter::Ctor
+|*
+|* Ersterstellung MA 06. Jan. 95
+|* Letzte Aenderung MA 22. Nov. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwOrderIter::SwOrderIter( const SwPageFrm *pPg, FASTBOOL bFlys ) :
+/*N*/ pPage( pPg ),
+/*N*/ pCurrent( 0 ),
+/*N*/ bFlysOnly( bFlys )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwOrderIter::Top()
+|*
+|* Ersterstellung MA 06. Jan. 95
+|* Letzte Aenderung MA 22. Nov. 95
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwOrderIter::Bottom()
+|*
+|* Ersterstellung MA 06. Jan. 95
+|* Letzte Aenderung MA 22. Nov. 95
+|*
+|*************************************************************************/
+
+/*N*/ const SdrObject *SwOrderIter::Bottom()
+/*N*/ {
+/*N*/ pCurrent = 0;
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ UINT32 nBotOrd = USHRT_MAX;
+/*N*/ const SwSortDrawObjs *pObjs = pPage->GetSortedObjs();
+/*N*/ if ( pObjs->Count() )
+/*N*/ {
+/*N*/ (*pObjs)[0]->GetOrdNum(); //Aktualisieren erzwingen!
+/*N*/ for ( USHORT i = 0; i < pObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pObjs)[i];
+/*N*/ if ( bFlysOnly && !pObj->IsWriterFlyFrame() )
+/*N*/ continue;
+/*N*/ UINT32 nTmp = pObj->GetOrdNumDirect();
+/*N*/ if ( nTmp < nBotOrd )
+/*N*/ {
+/*N*/ nBotOrd = nTmp;
+/*N*/ pCurrent = pObj;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pCurrent;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwOrderIter::Next()
+|*
+|* Ersterstellung MA 06. Jan. 95
+|* Letzte Aenderung MA 22. Nov. 95
+|*
+|*************************************************************************/
+
+/*N*/ const SdrObject *SwOrderIter::Next()
+/*N*/ {
+/*N*/ const UINT32 nCurOrd = pCurrent ? pCurrent->GetOrdNumDirect() : 0;
+/*N*/ pCurrent = 0;
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ UINT32 nOrd = USHRT_MAX;
+/*N*/ const SwSortDrawObjs *pObjs = pPage->GetSortedObjs();
+/*N*/ if ( pObjs->Count() )
+/*N*/ {
+/*N*/ (*pObjs)[0]->GetOrdNum(); //Aktualisieren erzwingen!
+/*N*/ for ( USHORT i = 0; i < pObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pObjs)[i];
+/*N*/ if ( bFlysOnly && !pObj->IsWriterFlyFrame() )
+/*N*/ continue;
+/*N*/ UINT32 nTmp = pObj->GetOrdNumDirect();
+/*N*/ if ( nTmp > nCurOrd && nTmp < nOrd )
+/*N*/ {
+/*N*/ nOrd = nTmp;
+/*N*/ pCurrent = pObj;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pCurrent;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwOrderIter::Prev()
+|*
+|* Ersterstellung MA 06. Jan. 95
+|* Letzte Aenderung MA 22. Nov. 95
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SaveCntnt(), RestoreCntnt()
+|*
+|* Ersterstellung MA 10. Jun. 93
+|* Letzte Aenderung MA 07. Mar. 95
+|*
+|*************************************************************************/
+
+//Unterstruktur eines LayoutFrms fuer eine Aktion aufheben und wieder
+//restaurieren.
+//Neuer Algorithmus: Es ist unuetz jeden Nachbarn einzeln zu betrachten und
+//die Pointer sauber zu setzen (Upper, Nachbarn, usw.)
+//Es reicht vollkommen jeweils eine Einzelkette zu loesen, und mit dem
+//Letzen der Einzelkette nachzuschauen ob noch eine weitere Kette
+//angeheangt werden muss. Es brauchen nur die Pointer korrigiert werden,
+//die zur Verkettung notwendig sind. So koennen Beipspielsweise die Pointer
+//auf die Upper auf den alten Uppern stehenbleiben. Korrigiert werden die
+//Pointer dann im RestoreCntnt. Zwischenzeitlich ist sowieso jeder Zugriff
+//verboten.
+//Unterwegs werden die Flys bei der Seite abgemeldet.
+
+/*N*/ void MA_FASTCALL lcl_RemoveFlysFromPage( SwCntntFrm *pCntnt )
+/*N*/ {
+/*N*/ ASSERT( pCntnt->GetDrawObjs(), "Keine DrawObjs fuer lcl_RemoveFlysFromPage." );
+/*N*/ SwDrawObjs &rObjs = *pCntnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ SwVirtFlyDrawObj *pObj = pO->IsWriterFlyFrame() ?
+/*N*/ (SwVirtFlyDrawObj*)pO : 0;
+/*N*/ if ( pObj && pObj->GetFlyFrm()->IsFlyFreeFrm() )
+/*N*/ {
+/*N*/ SwCntntFrm *pCnt = pObj->GetFlyFrm()->ContainsCntnt();
+/*N*/ while ( pCnt )
+/*N*/ {
+/*N*/ if ( pCnt->GetDrawObjs() )
+/*?*/ ::binfilter::lcl_RemoveFlysFromPage( pCnt );
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ ((SwFlyFreeFrm*)pObj->GetFlyFrm())->GetPage()->
+/*N*/ SwPageFrm::RemoveFly( pObj->GetFlyFrm() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
+/*N*/ {
+/*N*/ if( pLay->IsSctFrm() && pLay->Lower() && pLay->Lower()->IsColumnFrm() )
+/*?*/ lcl_RemoveFtns( (SwColumnFrm*)pLay->Lower(), TRUE, TRUE );
+/*N*/
+/*N*/ SwFrm *pSav;
+/*N*/ if ( 0 == (pSav = pLay->ContainsAny()) )
+/*N*/ return 0;
+/*N*/
+/*N*/ if( pSav->IsInFtn() && !pLay->IsInFtn() )
+/*N*/ {
+/*?*/ do
+/*?*/ pSav = pSav->FindNext();
+/*?*/ while( pSav && pSav->IsInFtn() );
+/*?*/ if( !pSav || !pLay->IsAnLower( pSav ) )
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ // Tabellen sollen immer komplett gesichert werden, es sei denn, es wird
+/*N*/ // der Inhalt eines Bereichs innerhalb einer Tabelle gesichert.
+/*N*/ if ( pSav->IsInTab() && !( pLay->IsSctFrm() && pLay->IsInTab() ) )
+/*?*/ while ( !pSav->IsTabFrm() )
+/*?*/ pSav = pSav->GetUpper();
+/*N*/
+/*N*/ if( pSav->IsInSct() )
+/*N*/ { // Jetzt wird der oberste Bereich gesucht, der innerhalb von pLay ist.
+/*N*/ SwFrm* pSect = pLay->FindSctFrm();
+/*N*/ SwFrm *pTmp = pSav;
+/*N*/ do
+/*N*/ {
+/*N*/ pSav = pTmp;
+/*N*/ pTmp = pSav->GetUpper() ? pSav->GetUpper()->FindSctFrm() : NULL;
+/*N*/ } while ( pTmp != pSect );
+/*N*/ }
+/*N*/
+/*N*/ SwFrm *pFloat = pSav;
+/*N*/ if( !pStart )
+/*N*/ pStart = pSav;
+/*N*/ BOOL bGo = pStart == pSav;
+/*N*/ do
+/*N*/ {
+/*N*/ if( bGo )
+/*N*/ pFloat->GetUpper()->pLower = 0; //Die Teilkette ausklinken.
+/*N*/
+/*N*/ //Das Ende der Teilkette suchen, unterwegs die Flys abmelden.
+/*N*/ do
+/*N*/ {
+/*N*/ if( bGo )
+/*N*/ {
+/*N*/ if ( pFloat->IsCntntFrm() )
+/*N*/ {
+/*N*/ if ( pFloat->GetDrawObjs() )
+/*N*/ ::binfilter::lcl_RemoveFlysFromPage( (SwCntntFrm*)pFloat );
+/*N*/ }
+/*N*/ else if ( pFloat->IsTabFrm() || pFloat->IsSctFrm() )
+/*N*/ {
+/*N*/ SwCntntFrm *pCnt = ((SwLayoutFrm*)pFloat)->ContainsCntnt();
+/*N*/ if( pCnt )
+/*N*/ {
+/*N*/ do
+/*N*/ { if ( pCnt->GetDrawObjs() )
+/*?*/ ::binfilter::lcl_RemoveFlysFromPage( pCnt );
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ } while ( pCnt && ((SwLayoutFrm*)pFloat)->IsAnLower( pCnt ) );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ ASSERT( !pFloat, "Neuer Float-Frame?" );
+/*N*/ }
+/*N*/ if ( pFloat->GetNext() )
+/*N*/ {
+/*N*/ if( bGo )
+/*N*/ pFloat->pUpper = NULL;
+/*N*/ pFloat = pFloat->GetNext();
+/*N*/ if( !bGo && pFloat == pStart )
+/*N*/ {
+/*?*/ bGo = TRUE;
+/*?*/ pFloat->pPrev->pNext = NULL;
+/*?*/ pFloat->pPrev = NULL;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/
+/*N*/ } while ( pFloat );
+/*N*/
+/*N*/ //Die naechste Teilkette suchen und die Ketten miteinander verbinden.
+/*N*/ SwFrm *pTmp = pFloat->FindNext();
+/*N*/ if( bGo )
+/*N*/ pFloat->pUpper = NULL;
+/*N*/
+/*N*/ if( !pLay->IsInFtn() )
+/*N*/ while( pTmp && pTmp->IsInFtn() )
+/*?*/ pTmp = pTmp->FindNext();
+/*N*/
+/*N*/ if ( !pLay->IsAnLower( pTmp ) )
+/*N*/ pTmp = 0;
+/*N*/
+/*N*/ if ( pTmp && bGo )
+/*N*/ {
+/*N*/ pFloat->pNext = pTmp; //Die beiden Ketten verbinden.
+/*N*/ pFloat->pNext->pPrev = pFloat;
+/*N*/ }
+/*N*/ pFloat = pTmp;
+/*N*/ bGo = bGo || ( pStart == pFloat );
+/*N*/ } while ( pFloat );
+/*N*/
+/*N*/ return bGo ? pStart : NULL;
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_AddFlysToPage( SwCntntFrm *pCntnt, SwPageFrm *pPage )
+/*N*/ {
+/*N*/ ASSERT( pCntnt->GetDrawObjs(), "Keine DrawObjs fuer lcl_AddFlysToPage." );
+/*N*/ SwDrawObjs &rObjs = *pCntnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ SwVirtFlyDrawObj *pObj = pO->IsWriterFlyFrame() ?
+/*N*/ (SwVirtFlyDrawObj*)pO : 0;
+/*N*/ if ( pObj && pObj->GetFlyFrm()->IsFlyFreeFrm() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = pObj->GetFlyFrm();
+/*N*/ pPage->SwPageFrm::AppendFly( pFly );
+/*N*/ pFly->_InvalidatePos();
+/*N*/ pFly->_InvalidateSize();
+/*N*/ pFly->InvalidatePage( pPage );
+/*N*/ SwCntntFrm *pCnt = pFly->ContainsCntnt();
+/*N*/ while ( pCnt )
+/*N*/ {
+/*N*/ if ( pCnt->GetDrawObjs() )
+/*?*/ ::binfilter::lcl_AddFlysToPage( pCnt, pPage );
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling )
+/*N*/ {
+/*N*/ ASSERT( pSav && pParent, "Kein Save oder Parent fuer Restore." );
+/*N*/
+/*N*/ //Wenn es bereits FlowFrms unterhalb des neuen Parent gibt, so wird die
+/*N*/ //Kette, beginnend mit pSav, hinter dem letzten angehaengt.
+/*N*/ //Die Teile werden kurzerhand insertet und geeignet invalidiert.
+/*N*/ //Unterwegs werden die Flys der CntntFrms bei der Seite angemeldet.
+/*N*/
+/*N*/ SwPageFrm *pPage = pParent->FindPageFrm();
+/*N*/
+/*N*/ if ( pPage )
+/*N*/ pPage->InvalidatePage( pPage ); //Invalides Layout anmelden.
+/*N*/
+/*N*/ //Vorgaenger festellen und die Verbindung herstellen bzw. initialisieren.
+/*N*/ pSav->pPrev = pSibling;
+/*N*/ SwFrm* pNxt;
+/*N*/ if ( pSibling )
+/*N*/ {
+/*N*/ pNxt = pSibling->pNext;
+/*N*/ pSibling->pNext = pSav;
+/*N*/ pSibling->_InvalidatePrt();
+/*N*/ ((SwCntntFrm*)pSibling)->InvalidatePage( pPage );//Invaliden Cntnt anmelden.
+/*N*/ if ( ((SwCntntFrm*)pSibling)->GetFollow() )
+/*?*/ pSibling->Prepare( PREP_CLEAR, 0, sal_False );
+/*N*/ }
+/*N*/ else
+/*N*/ { pNxt = pParent->pLower;
+/*N*/ pParent->pLower = pSav;
+/*N*/ pSav->pUpper = pParent; //Schon mal setzen, sonst ist fuer das
+/*N*/ //invalidate der Parent (z.B. ein Fly) nicht klar.
+/*N*/ //Invaliden Cntnt anmelden.
+/*N*/ if ( pSav->IsCntntFrm() )
+/*N*/ ((SwCntntFrm*)pSav)->InvalidatePage( pPage );
+/*N*/ else
+/*N*/ { // pSav koennte auch ein leerer SectFrm sein
+/*N*/ SwCntntFrm* pCnt = pParent->ContainsCntnt();
+/*N*/ if( pCnt )
+/*N*/ pCnt->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Der Parent muss entsprechend gegrow'ed werden.
+/*N*/ SwTwips nGrowVal = 0;
+/*N*/ SwFrm* pLast;
+/*N*/ do
+/*N*/ { pSav->pUpper = pParent;
+/*N*/ nGrowVal += pSav->Frm().Height();
+/*N*/ pSav->_InvalidateAll();
+/*N*/
+/*N*/ //Jetzt die Flys anmelden, fuer TxtFrms gleich geeignet invalidieren.
+/*N*/ if ( pSav->IsCntntFrm() )
+/*N*/ {
+/*N*/ if ( pSav->IsTxtFrm() &&
+/*N*/ ((SwTxtFrm*)pSav)->GetCacheIdx() != USHRT_MAX )
+/*N*/ ((SwTxtFrm*)pSav)->Init(); //Ich bin sein Freund.
+/*N*/
+/*N*/ if ( pPage && pSav->GetDrawObjs() )
+/*N*/ ::binfilter::lcl_AddFlysToPage( (SwCntntFrm*)pSav, pPage );
+/*N*/ }
+/*N*/ else
+/*N*/ { SwCntntFrm *pBlub = ((SwLayoutFrm*)pSav)->ContainsCntnt();
+/*N*/ if( pBlub )
+/*N*/ {
+/*N*/ do
+/*N*/ { if ( pPage && pBlub->GetDrawObjs() )
+/*?*/ ::binfilter::lcl_AddFlysToPage( pBlub, pPage );
+/*N*/ if( pBlub->IsTxtFrm() && ((SwTxtFrm*)pBlub)->HasFtn() &&
+/*N*/ ((SwTxtFrm*)pBlub)->GetCacheIdx() != USHRT_MAX )
+/*?*/ ((SwTxtFrm*)pBlub)->Init(); //Ich bin sein Freund.
+/*N*/ pBlub = pBlub->GetNextCntntFrm();
+/*N*/ } while ( pBlub && ((SwLayoutFrm*)pSav)->IsAnLower( pBlub ));
+/*N*/ }
+/*N*/ }
+/*N*/ pLast = pSav;
+/*N*/ pSav = pSav->GetNext();
+/*N*/
+/*N*/ } while ( pSav );
+/*N*/
+/*N*/ if( pNxt )
+/*N*/ {
+/*?*/ pLast->pNext = pNxt;
+/*?*/ pNxt->pPrev = pLast;
+/*N*/ }
+/*N*/ pParent->Grow( nGrowVal PHEIGHT );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SqRt() Berechnung der Quadratwurzel, damit die math.lib
+|* nicht auch noch dazugelinkt werden muss.
+|*
+|* Ersterstellung OK ??
+|* Letzte Aenderung MA 09. Jan. 97
+|*
+|*************************************************************************/
+
+/*N*/ ULONG MA_FASTCALL SqRt( BigInt nX )
+/*N*/ {
+/*N*/ BigInt nErg = 1;
+/*N*/
+/*N*/ if ( !nX.IsNeg() )
+/*N*/ {
+/*N*/ BigInt nOldErg = 1;
+/*N*/ for ( int i = 0; i <= 5; i++ )
+/*N*/ {
+/*N*/ nErg = (nOldErg + (nX / nOldErg)) / BigInt(2);
+/*N*/ nOldErg = nErg;
+/*N*/ }
+/*N*/ }
+/*N*/ return nErg >= BigInt(SAL_MAX_UINT32) ? ULONG_MAX : (ULONG)nErg;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* InsertNewPage() Einsetzen einer neuen Seite.
+|*
+|* Ersterstellung MA 01. Jul. 93
+|* Letzte Aenderung MA 31. Jul. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
+/*N*/ BOOL bOdd, BOOL bInsertEmpty, BOOL bFtn,
+/*N*/ SwFrm *pSibling )
+/*N*/ {
+/*N*/ SwPageFrm *pRet;
+/*N*/ SwDoc *pDoc = ((SwLayoutFrm*)pUpper)->GetFmt()->GetDoc();
+/*N*/ SwFrmFmt *pFmt = bOdd ? rDesc.GetRightFmt() : rDesc.GetLeftFmt();
+/*N*/ //Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben
+/*N*/ //eine Leerseite einfuegen.
+/*N*/ if ( !pFmt )
+/*N*/ {
+/*N*/ pFmt = bOdd ? rDesc.GetLeftFmt() : rDesc.GetRightFmt();
+/*N*/ ASSERT( pFmt, "Descriptor without any format?!" );
+/*N*/ bInsertEmpty = !bInsertEmpty;
+/*N*/ }
+/*N*/ if( bInsertEmpty )
+/*N*/ {
+/*N*/ SwPageDesc *pTmpDesc = pSibling && pSibling->GetPrev() ?
+/*N*/ ((SwPageFrm*)pSibling->GetPrev())->GetPageDesc() : &rDesc;
+/*N*/ pRet = new SwPageFrm( pDoc->GetEmptyPageFmt(), pTmpDesc );
+/*N*/ pRet->Paste( pUpper, pSibling );
+/*N*/ pRet->PreparePage( bFtn );
+/*N*/ }
+/*N*/ pRet = new SwPageFrm( pFmt, &rDesc );
+/*N*/ pRet->Paste( pUpper, pSibling );
+/*N*/ pRet->PreparePage( bFtn );
+/*N*/ if ( pRet->GetNext() )
+/*?*/ ((SwRootFrm*)pRet->GetUpper())->AssertPageFlys( pRet );
+/*N*/ return pRet;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* RegistFlys(), Regist() Die beiden folgenden Methoden durchsuchen rekursiv
+|* eine Layoutstruktur und melden alle FlyFrms, die einen beliebigen Frm
+|* innerhalb der Struktur als Anker haben bei der Seite an.
+|*
+|* Ersterstellung MA 08. Jul. 93
+|* Letzte Aenderung MA 07. Jul. 95
+|*
+|*************************************************************************/
+
+/*N*/ void MA_FASTCALL lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch )
+/*N*/ {
+/*N*/ SwDrawObjs *pObjs = (SwDrawObjs*)pAnch->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < pObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pObjs)[i];
+/*N*/ SwVirtFlyDrawObj *pFObj = pObj->IsWriterFlyFrame() ?
+/*N*/ (SwVirtFlyDrawObj*)pObj : 0;
+/*N*/ if ( pFObj )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = pFObj->GetFlyFrm();
+/*N*/ //Ggf. ummelden, nicht anmelden wenn bereits bekannt.
+/*N*/ SwPageFrm *pPg = pFly->IsFlyFreeFrm() ?
+/*N*/ ((SwFlyFreeFrm*)pFly)->GetPage() : pFly->FindPageFrm();
+/*N*/ if ( pPg != pPage )
+/*N*/ {
+/*N*/ if ( pPg )
+/*N*/ pPg->SwPageFrm::RemoveFly( pFly );
+/*N*/ pPage->AppendFly( pFly );
+/*N*/ }
+/*N*/ ::binfilter::RegistFlys( pPage, pFly );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwDrawContact* pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
+/*N*/ // OD 20.06.2003 #108784# - consider 'virtual' drawing objects
+/*N*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
+/*N*/ if ( pDrawVirtObj->GetPageFrm() != pPage )
+/*N*/ {
+/*N*/ if ( pDrawVirtObj->GetPageFrm() )
+/*N*/ {
+/*N*/ pDrawVirtObj->GetPageFrm()->RemoveVirtDrawObj( pContact, pDrawVirtObj );
+/*N*/ }
+/*N*/ pPage->AppendVirtDrawObj( pContact, pDrawVirtObj );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( pContact->GetPage() != pPage )
+/*N*/ {
+/*N*/ if ( pContact->GetPage() )
+/*N*/ pContact->GetPage()->SwPageFrm::RemoveDrawObj( pContact );
+/*N*/ pPage->AppendDrawObj( pContact );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SwFlyFrm *pFly = pAnch->FindFlyFrm();
+/*N*/ if( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() &&
+/*N*/ pObj->GetPage() )
+/*N*/ pObj->GetPage()->SetObjectOrdNum( pObj->GetOrdNumDirect(),
+/*N*/ pFly->GetVirtDrawObj()->GetOrdNumDirect() + 1 );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void RegistFlys( SwPageFrm *pPage, const SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ if ( pLay->GetDrawObjs() )
+/*?*/ ::binfilter::lcl_Regist( pPage, pLay );
+/*N*/ const SwFrm *pFrm = pLay->Lower();
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ if ( pFrm->IsLayoutFrm() )
+/*N*/ ::binfilter::RegistFlys( pPage, (const SwLayoutFrm*)pFrm );
+/*N*/ else if ( pFrm->GetDrawObjs() )
+/*N*/ ::binfilter::lcl_Regist( pPage, pFrm );
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* void Notify()
+|*
+|* Beschreibung Benachrichtigt den Hintergrund je nach der
+|* Veraenderung zwischen altem und neuem Rechteckt.
+|* Ersterstellung MA 18. Jun. 93
+|* Letzte Aenderung MA 06. Jun. 96
+|*
+|*************************************************************************/
+
+/*N*/ void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld )
+/*N*/ {
+/*N*/ const SwRect aFrm( pFly->AddSpacesToFrm() );
+/*N*/ if ( rOld.Pos() != aFrm.Pos() )
+/*N*/ { //Positionsaenderung, alten und neuen Bereich invalidieren
+/*N*/ if ( rOld.HasArea() &&
+/*N*/ rOld.Left()+pFly->GetFmt()->GetLRSpace().GetLeft() < WEIT_WECH )
+/*N*/ {
+/*N*/ pFly->NotifyBackground( pOld, rOld, PREP_FLY_LEAVE );
+/*N*/ }
+/*N*/ pFly->NotifyBackground( pFly->FindPageFrm(), aFrm, PREP_FLY_ARRIVE );
+/*N*/ }
+/*N*/ else if ( rOld.SSize() != aFrm.SSize() )
+/*N*/ { //Groessenaenderung, den Bereich der Verlassen wurde bzw. jetzt
+/*N*/ //ueberdeckt wird invalidieren.
+/*N*/ //Der Einfachheit halber wird hier bewusst jeweils ein Twip
+/*N*/ //unnoetig invalidiert.
+/*N*/
+/*N*/ ViewShell *pSh = pFly->GetShell();
+/*N*/ if( pSh && rOld.HasArea() )
+/*N*/ pSh->InvalidateWindows( rOld );
+/*N*/
+/*N*/ if ( rOld.Left() != aFrm.Left() )
+/*?*/ { SwRect aTmp( rOld );
+/*?*/ aTmp.Union( aFrm );
+/*?*/ aTmp.Left( Min(aFrm.Left(), rOld.Left()) );
+/*?*/ aTmp.Right( Max(aFrm.Left(), rOld.Left()) );
+/*?*/ pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
+/*N*/ }
+/*N*/ SwTwips nOld = rOld.Right();
+/*N*/ SwTwips nNew = aFrm.Right();
+/*N*/ if ( nOld != nNew )
+/*N*/ { SwRect aTmp( rOld );
+/*N*/ aTmp.Union( aFrm );
+/*N*/ aTmp.Left( Min(nNew, nOld) );
+/*N*/ aTmp.Right( Max(nNew, nOld) );
+/*N*/ pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
+/*N*/ }
+/*N*/ if ( rOld.Top() != aFrm.Top() )
+/*?*/ { SwRect aTmp( rOld );
+/*?*/ aTmp.Union( aFrm );
+/*?*/ aTmp.Top( Min(aFrm.Top(), rOld.Top()) );
+/*?*/ aTmp.Bottom( Max(aFrm.Top(), rOld.Top()) );
+/*?*/ pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
+/*N*/ }
+/*N*/ nOld = rOld.Bottom();
+/*N*/ nNew = aFrm.Bottom();
+/*N*/ if ( nOld != nNew )
+/*N*/ { SwRect aTmp( rOld );
+/*N*/ aTmp.Union( aFrm );
+/*N*/ aTmp.Top( Min(nNew, nOld) );
+/*N*/ aTmp.Bottom( Max(nNew, nOld) );
+/*N*/ pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* NotifyBackground()
+|*
+|*************************************************************************/
+
+/*N*/ void lcl_CheckFlowBack( SwFrm* pFrm, const SwRect &rRect )
+/*N*/ {
+/*N*/ SwTwips nBottom = rRect.Bottom();
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsLayoutFrm() )
+/*N*/ {
+/*N*/ if( rRect.IsOver( pFrm->Frm() ) )
+/*N*/ lcl_CheckFlowBack( ((SwLayoutFrm*)pFrm)->Lower(), rRect );
+/*N*/ }
+/*N*/ else if( !pFrm->GetNext() && nBottom > pFrm->Frm().Bottom() )
+/*N*/ {
+/*N*/ if( pFrm->IsCntntFrm() && ((SwCntntFrm*)pFrm)->HasFollow() )
+/*N*/ pFrm->InvalidateSize();
+/*N*/ else
+/*N*/ pFrm->InvalidateNextPos();
+/*N*/ }
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ #ifdef _MSC_VER
+/*N*/ #pragma optimize("",off)
+/*N*/ #endif
+
+/*N*/ void MA_FASTCALL lcl_NotifyCntnt( SdrObject *pThis, SwCntntFrm *pCnt,
+/*N*/ const SwRect &rRect, const PrepareHint eHint )
+/*N*/ {
+/*N*/ if ( pCnt->IsTxtFrm() )
+/*N*/ {
+/*N*/ SwRect aCntPrt( pCnt->Prt() );
+/*N*/ aCntPrt.Pos() += pCnt->Frm().Pos();
+/*N*/ if ( eHint == PREP_FLY_ATTR_CHG )
+/*N*/ {
+/*N*/ if ( aCntPrt.IsOver( pThis->GetBoundRect() ) )
+/*?*/ pCnt->Prepare( PREP_FLY_ATTR_CHG );
+/*N*/ }
+/*N*/ else if ( aCntPrt.IsOver( rRect ) || pCnt->IsFollow() || pCnt->HasFollow() )
+/*N*/ pCnt->Prepare( eHint, (void*)&aCntPrt._Intersection( rRect ) );
+/*N*/ if ( pCnt->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs &rObjs = *pCnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*N*/ SwCntntFrm *pCntnt = pFly->ContainsCntnt();
+/*N*/ while ( pCntnt )
+/*N*/ {
+/*N*/ ::binfilter::lcl_NotifyCntnt( pThis, pCntnt, rRect, eHint );
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Notify_Background( SdrObject *pObj, SwPageFrm *pPage, const SwRect& rRect,
+/*N*/ const PrepareHint eHint, const BOOL bInva )
+/*N*/ {
+/*N*/
+/*N*/ //Wenn der Frm gerade erstmalig sinnvoll positioniert wurde, braucht der
+/*N*/ //alte Bereich nicht benachrichtigt werden.
+/*N*/ if ( eHint == PREP_FLY_LEAVE && rRect.Top() == WEIT_WECH )
+/*N*/ return;
+/*N*/
+/*N*/ SwLayoutFrm *pArea;
+/*N*/ SwFlyFrm *pFlyFrm = 0;
+/*N*/ SwFrm* pAnchor;
+/*N*/ if( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ pFlyFrm = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/
+/*N*/ //MA: Wozu ausserhalb des Ankers invalidieren? Dort wird ja eh nicht
+/*N*/ //auf den Rahmen Ruecksicht genommen; normalerweise kann er dort
+/*N*/ //gar nicht hin, ausser temporaer beim Formatieren.
+/*N*/ pAnchor = pFlyFrm->GetAnchor();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pFlyFrm = NULL;
+/*N*/ pAnchor = ((SwDrawContact*)GetUserCall(pObj))->GetAnchor();
+/*N*/ }
+/*N*/ if( PREP_FLY_LEAVE != eHint && pAnchor->IsInFly() )
+/*N*/ pArea = pAnchor->FindFlyFrm();
+/*N*/ else
+/*N*/ pArea = pPage;
+/*N*/ SwCntntFrm *pCnt = 0;
+/*N*/ if ( pArea )
+/*N*/ {
+/*N*/ if( PREP_FLY_ARRIVE != eHint )
+/*N*/ lcl_CheckFlowBack( pArea, rRect );
+/*N*/
+/*N*/ //Es reagieren sowieso nur die auf den Anker folgenden auf den Fly, also
+/*N*/ //brauchen diese nicht abgeklappert werden.
+/*N*/ //Ausnahme sind ist natuerlich das LEAVE, denn der Fly koennte ja von
+/*N*/ //"oben" kommen.
+/*N*/ // Wenn der Anker auf der vorhergehenden Seite liegt, muss ebenfalls
+/*N*/ // die gesamte Seite abgearbeitet werden. (47722)
+/*N*/ if ( PREP_FLY_LEAVE != eHint && pAnchor->IsCntntFrm() &&
+/*N*/ pArea->IsAnLower( pAnchor ) )
+/*N*/ pCnt = (SwCntntFrm*)pAnchor;
+/*N*/ else
+/*N*/ pCnt = pArea->ContainsCntnt();
+/*N*/ }
+/*N*/ SwFrm *pLastTab = 0;
+/*N*/
+/*N*/ while ( pCnt && pArea->IsAnLower( pCnt ) )
+/*N*/ {
+/*N*/ ::binfilter::lcl_NotifyCntnt( pObj, pCnt, rRect, eHint );
+/*N*/ if ( pCnt->IsInTab() )
+/*N*/ {
+/*N*/ SwLayoutFrm* pCell = pCnt->GetUpper();
+/*N*/ if( pCell->IsCellFrm() &&
+/*N*/ ( (pCell->Frm().IsOver( pObj->GetBoundRect() ) ||
+/*N*/ pCell->Frm().IsOver( rRect )) ) )
+/*N*/ {
+/*N*/ const SwFmtVertOrient &rOri = pCell->GetFmt()->GetVertOrient();
+/*N*/ if ( VERT_NONE != rOri.GetVertOrient() )
+/*N*/ pCell->InvalidatePrt();
+/*N*/ }
+/*N*/ SwTabFrm *pTab = pCnt->FindTabFrm();
+/*N*/ if ( pTab != pLastTab )
+/*N*/ {
+/*N*/ pLastTab = pTab;
+/*N*/ if ( pTab->Frm().IsOver( pObj->GetBoundRect() ) ||
+/*N*/ pTab->Frm().IsOver( rRect ) )
+/*N*/ {
+/*N*/ if ( !pFlyFrm || !pFlyFrm->IsLowerOf( pTab ) )
+/*N*/ pTab->InvalidatePrt();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ }
+// #108745# Sorry, but this causes nothing but trouble. I remove these lines
+// taking the risk that the footer frame will have a wrong height
+// if( pPage->Lower() )
+// {
+// SwFrm* pFrm = pPage->Lower();
+// while( pFrm->GetNext() )
+// pFrm = pFrm->GetNext();
+// if( pFrm->IsFooterFrm() &&
+// ( ( pFrm->Frm().IsOver( pObj->GetBoundRect() ) ||
+// pFrm->Frm().IsOver( rRect ) ) ) )
+// pFrm->InvalidateSize();
+// }
+
+/*N*/ if( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ pObj->GetOrdNum();
+/*N*/ const SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ if( pO == pObj )
+/*N*/ continue;
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->Frm().Top() == WEIT_WECH )
+/*N*/ continue;
+/*N*/
+/*N*/ if ( !pFlyFrm ||
+/*N*/ (!pFly->IsLowerOf( pFlyFrm ) &&
+/*N*/ pFly->GetVirtDrawObj()->GetOrdNumDirect() < pObj->GetOrdNumDirect()))
+/*N*/ {
+/*N*/ pCnt = pFly->ContainsCntnt();
+/*N*/ while ( pCnt )
+/*N*/ {
+/*N*/ ::binfilter::lcl_NotifyCntnt( pObj, pCnt, rRect, eHint );
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ if( pFly->IsFlyLayFrm() )
+/*N*/ {
+/*N*/ if( pFly->Lower() && pFly->Lower()->IsColumnFrm() &&
+/*N*/ pFly->Frm().Bottom() >= rRect.Top() &&
+/*N*/ pFly->Frm().Top() <= rRect.Bottom() &&
+/*N*/ pFly->Frm().Right() >= rRect.Left() &&
+/*N*/ pFly->Frm().Left() <= rRect.Right() )
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rSz = pFly->GetFmt()->GetFrmSize();
+/*N*/ pFly->InvalidateSize();
+/*N*/ }
+/*N*/ }
+/*N*/ //Flys, die ueber mir liegen muessen/mussten evtl.
+/*N*/ //ausweichen, wenn sie eine automatische Ausrichtung haben.
+/*N*/ //das ist unabhaengig von meinem Attribut, weil dies sich
+/*N*/ //gerade geaendert haben kann und eben deshalb
+/*N*/ //umformatiert wurde.
+/*N*/ else if ( pFly->IsFlyAtCntFrm() &&
+/*N*/ pObj->GetOrdNumDirect() <
+/*N*/ pFly->GetVirtDrawObj()->GetOrdNumDirect() &&
+/*N*/ pFlyFrm && !pFly->IsLowerOf( pFlyFrm ) )
+/*N*/ {
+/*N*/ const SwFmtHoriOrient &rH = pFly->GetFmt()->GetHoriOrient();
+/*N*/ if ( HORI_NONE != rH.GetHoriOrient() &&
+/*N*/ HORI_CENTER != rH.GetHoriOrient() &&
+/*N*/ ( !pFly->IsAutoPos() || REL_CHAR != rH.GetRelationOrient() ) &&
+/*N*/ (pFly->Frm().Bottom() >= rRect.Top() &&
+/*N*/ pFly->Frm().Top() <= rRect.Bottom()) )
+/*N*/ pFly->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pFlyFrm && pAnchor->GetUpper() && pAnchor->IsInTab() )//MA_FLY_HEIGHT
+/*N*/ pAnchor->GetUpper()->InvalidateSize();
+/*N*/
+/*N*/ ViewShell *pSh;
+/*N*/ if( bInva && 0 != (pSh = pPage->GetShell()) )
+/*N*/ pSh->InvalidateWindows( rRect );
+/*N*/ }
+
+/*N*/ #ifdef _MSC_VER
+/*N*/ #pragma optimize("",on)
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* GetVirtualUpper() liefert bei absatzgebundenen Objekten den Upper
+|* des Ankers. Falls es sich dabei um verkettete Rahmen oder
+|* Fussnoten handelt, wird ggf. der "virtuelle" Upper ermittelt.
+|*
+|*************************************************************************/
+
+/*N*/ const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos )
+/*N*/ {
+/*N*/ if( pFrm->IsTxtFrm() )
+/*N*/ {
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ if( !pFrm->Frm().IsInside( rPos ) )
+/*N*/ {
+/*N*/ if( pFrm->IsFtnFrm() )
+/*N*/ {
+/*?*/ const SwFtnFrm* pTmp = ((SwFtnFrm*)pFrm)->GetFollow();
+/*?*/ while( pTmp )
+/*?*/ {
+/*?*/ if( pTmp->Frm().IsInside( rPos ) )
+/*?*/ return pTmp;
+/*?*/ pTmp = pTmp->GetFollow();
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwFlyFrm* pTmp = (SwFlyFrm*)pFrm->FindFlyFrm();
+/*N*/ while( pTmp )
+/*N*/ {
+/*N*/ if( pTmp->Frm().IsInside( rPos ) )
+/*N*/ return pTmp;
+/*N*/ pTmp = pTmp->GetNextLink();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pFrm;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* IsLowerOf()
+|*
+|*************************************************************************/
+
+/*N*/ BOOL Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj )
+/*N*/ {
+/*N*/ Point aPos;
+/*N*/ const SwFrm* pFrm;
+/*N*/ if( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ const SwFlyFrm* pFly = ( (SwVirtFlyDrawObj*)pObj )->GetFlyFrm();
+/*N*/ pFrm = pFly->GetAnchor();
+/*N*/ aPos = pFly->Frm().Pos();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pFrm = ( (SwDrawContact*)GetUserCall(pObj) )->GetAnchor();
+/*N*/ aPos = pObj->GetBoundRect().TopLeft();
+/*N*/ }
+/*N*/ ASSERT( pFrm, "8-( Fly is lost in Space." );
+/*N*/ pFrm = GetVirtualUpper( pFrm, aPos );
+/*N*/ do
+/*N*/ { if ( pFrm == pCurrFrm )
+/*N*/ return TRUE;
+/*N*/ if( pFrm->IsFlyFrm() )
+/*N*/ {
+/*N*/ aPos = pFrm->Frm().Pos();
+/*N*/ pFrm = GetVirtualUpper( ((const SwFlyFrm*)pFrm)->GetAnchor(), aPos );
+/*N*/ }
+/*N*/ else
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ } while ( pFrm );
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ const SwFrm *FindKontext( const SwFrm *pFrm, USHORT nAdditionalKontextTyp )
+/*N*/ {
+/*N*/ //Liefert die Umgebung des Frm in die kein Fly aus einer anderen
+/*N*/ //Umgebung hineinragen kann.
+/*N*/ const USHORT nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT |
+/*N*/ FRM_FTN | FRM_FLY |
+/*N*/ FRM_TAB | FRM_ROW | FRM_CELL |
+/*N*/ nAdditionalKontextTyp;
+/*N*/ do
+/*N*/ { if ( pFrm->GetType() & nTyp )
+/*N*/ break;
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ } while( pFrm );
+/*N*/ return pFrm;
+/*N*/ }
+
+/*N*/ BOOL IsFrmInSameKontext( const SwFrm *pInnerFrm, const SwFrm *pFrm )
+/*N*/ {
+/*N*/ const SwFrm *pKontext = FindKontext( pInnerFrm, 0 );
+/*N*/
+/*N*/ const USHORT nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT |
+/*N*/ FRM_FTN | FRM_FLY |
+/*N*/ FRM_TAB | FRM_ROW | FRM_CELL;
+/*N*/ do
+/*N*/ { if ( pFrm->GetType() & nTyp )
+/*N*/ {
+/*N*/ if( pFrm == pKontext )
+/*N*/ return TRUE;
+/*N*/ if( pFrm->IsCellFrm() )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if( pFrm->IsFlyFrm() )
+/*N*/ {
+/*N*/ Point aPos( pFrm->Frm().Pos() );
+/*N*/ pFrm = GetVirtualUpper( ((const SwFlyFrm*)pFrm)->GetAnchor(), aPos );
+/*N*/ }
+/*N*/ else
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ } while( pFrm );
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+
+//---------------------------------
+
+
+
+
+
+/*N*/ const SwFrm* MA_FASTCALL FindPage( const SwRect &rRect, const SwFrm *pPage )
+/*N*/ {
+/*N*/ if ( !rRect.IsOver( pPage->Frm() ) )
+/*N*/ {
+/*N*/ BOOL bPrvAllowed = TRUE;
+/*N*/ BOOL bNxtAllowed = TRUE;
+/*N*/ do
+/*N*/ { if ( pPage->Frm().Top() > rRect.Top() && bPrvAllowed )
+/*N*/ {
+/*N*/ if ( pPage->GetPrev() )
+/*N*/ {
+/*N*/ bNxtAllowed = FALSE;
+/*N*/ pPage = pPage->GetPrev();
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ else if ( pPage->Frm().Bottom() < rRect.Top() && bNxtAllowed )
+/*N*/ {
+/*N*/ if ( pPage->GetNext() )
+/*N*/ {
+/*N*/ bPrvAllowed = FALSE;
+/*N*/ pPage = pPage->GetNext();
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/
+/*N*/ } while ( !rRect.IsOver( pPage->Frm() ) );
+/*N*/ }
+/*N*/ return pPage;
+/*N*/ }
+
+
+/*N*/ SwFrm* GetFrmOfModify( SwModify& rMod, USHORT nFrmType, const Point* pPoint,
+/*N*/ const SwPosition *pPos, const BOOL bCalcFrm )
+/*N*/ {
+/*N*/ SwFrm *pMinFrm = 0, *pTmpFrm;
+/*N*/ SwRect aCalcRect;
+/*N*/
+/*N*/ SwClientIter aIter( rMod );
+/*N*/ do {
+/*N*/ pMinFrm = 0;
+/*N*/ Size aMinSize;
+/*N*/
+/*N*/ for( pTmpFrm = (SwFrm*)aIter.First( TYPE( SwFrm )); pTmpFrm;
+/*N*/ pTmpFrm = (SwFrm*)aIter.Next() )
+/*N*/ if( pTmpFrm->GetType() & nFrmType &&
+/*N*/ (!pTmpFrm->IsFlowFrm() ||
+/*N*/ !SwFlowFrm::CastFlowFrm( pTmpFrm )->IsFollow() ))
+/*N*/ {
+/*N*/ if( pPoint )
+/*N*/ {
+/*N*/ if( bCalcFrm )
+/*N*/ pTmpFrm->Calc();
+/*N*/
+/*N*/ if( aIter.IsChanged() ) // der Liste hat sich ver-
+/*N*/ break; // aendert, neu anfangen !!
+/*N*/
+/*N*/ // bei Flys ggfs. ueber den Parent gehen wenn sie selbst
+/*N*/ // nocht nicht "formatiert" sind
+/*N*/ if( !bCalcFrm && nFrmType & FRM_FLY &&
+/*N*/ ((SwFlyFrm*)pTmpFrm)->GetAnchor() &&
+/*N*/ WEIT_WECH == pTmpFrm->Frm().Pos().X() &&
+/*N*/ WEIT_WECH == pTmpFrm->Frm().Pos().Y() )
+/*N*/ aCalcRect = ((SwFlyFrm*)pTmpFrm)->GetAnchor()->Frm();
+/*N*/ else
+/*N*/ aCalcRect = pTmpFrm->Frm();
+/*N*/
+/*N*/ // fasse den Point und das Recteck zusammen, falls
+/*N*/ // er Point nicht innerhalb liegt. Liegt er ausserhalb,
+/*N*/ // wird nach dem kleinsten Rectangle gesucht, also das,
+/*N*/ // wo der Point am dichtesten dran liegt. Ist der Point im
+/*N*/ // Rechteck, wird die Schleife beendet.
+/*N*/ {
+/*N*/ BOOL bInside = TRUE;
+/*N*/ // die Left/Right-Position erweitern
+/*N*/ if( pPoint->X() < aCalcRect.Left() )
+/*N*/ { bInside = FALSE; aCalcRect.Left( pPoint->X() ); }
+/*N*/ if( pPoint->X() > aCalcRect.Right() )
+/*N*/ { bInside = FALSE; aCalcRect.Right( pPoint->X() ); }
+/*N*/
+/*N*/ if( pPoint->Y() > aCalcRect.Bottom() )
+/*N*/ { bInside = FALSE; aCalcRect.Bottom( pPoint->Y() ); }
+/*N*/ if( pPoint->Y() < aCalcRect.Top() )
+/*N*/ { bInside = FALSE; aCalcRect.Top( pPoint->Y() ); }
+/*N*/ if( bInside )
+/*N*/ {
+/*N*/ pMinFrm = pTmpFrm;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pMinFrm )
+/*N*/ {
+/*?*/ long nDiffW = aMinSize.Width() - aCalcRect.Width();
+/*?*/ long nDiffH = aMinSize.Height() - aCalcRect.Height();
+/*?*/
+/*?*/ // gleiche Hoehe, dann entscheided die Breite
+/*?*/ if( !nDiffH ) { if( 0 >= nDiffW ) continue; }
+/*?*/ // gleiche Breite, dann entscheided die Hoehe
+/*?*/ else if( !nDiffW ) { if( 0 >= nDiffH ) continue; }
+/*?*/
+/*?*/ // hoehere Gewichtung auf die Hoehe !!
+/*?*/ else if( !(0 < nDiffW && 0 < nDiffH ) &&
+/*?*/ ((0 > nDiffW && 0 > nDiffH ) ||
+/*?*/ 0 >= nDiffH ))
+/*?*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Wenn kein pPoint angegeben ist, dann reichen
+/*N*/ // wir irgendeinen raus: den ersten!
+/*N*/ pMinFrm = pTmpFrm;
+/*N*/ break;
+/*N*/ }
+/*N*/ pMinFrm = pTmpFrm;
+/*N*/ aMinSize = aCalcRect.SSize();
+/*N*/ }
+/*N*/ } while( aIter.IsChanged() );
+/*N*/
+/*N*/ if( pPos && pMinFrm && pMinFrm->IsTxtFrm() )
+/*N*/ return ((SwTxtFrm*)pMinFrm)->GetFrmAtPos( *pPos );
+/*N*/
+/*N*/ return pMinFrm;
+/*N*/ }
+
+/*N*/ FASTBOOL IsExtraData( const SwDoc *pDoc )
+/*N*/ {
+/*N*/ const SwLineNumberInfo &rInf = pDoc->GetLineNumberInfo();
+/*N*/ return rInf.IsPaintLineNumbers() ||
+/*N*/ rInf.IsCountInFlys() ||
+/*N*/ ((SwHoriOrient)SW_MOD()->GetRedlineMarkPos() != HORI_NONE &&
+/*N*/ pDoc->GetRedlineTbl().Count());
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_ftnfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_ftnfrm.cxx
new file mode 100644
index 000000000000..65c9479534fd
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_ftnfrm.cxx
@@ -0,0 +1,2244 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <ftnidx.hxx>
+#include <pagefrm.hxx>
+#include <colfrm.hxx>
+#include <rootfrm.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <frmtool.hxx>
+#include <swtable.hxx>
+#include <ftnfrm.hxx>
+#include <txtfrm.hxx>
+#include <tabfrm.hxx>
+#include <pagedesc.hxx>
+#include <ftninfo.hxx>
+#include <sectfrm.hxx>
+#include <pam.hxx>
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* lcl_FindFtnPos() Sucht die Position des Attributes im FtnArray am
+|* Dokument, dort stehen die Fussnoten gluecklicherweise nach ihrem
+|* Index sortiert.
+|*
+|* Ersterstellung MA 29. Jun. 93
+|* Letzte Aenderung MA 13. Dec. 93
+|*
+|*************************************************************************/
+
+/*N*/ #define ENDNOTE 0x80000000
+
+/*N*/ ULONG MA_FASTCALL lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr )
+/*N*/ {
+/*N*/ const SwFtnIdxs &rFtnIdxs = pDoc->GetFtnIdxs();
+/*N*/
+/*N*/ #ifdef MA_DEBUG
+/*N*/ //Wenn das Array nicht stimmt haben wir ein Problem, denn viele
+/*N*/ //Ftn-Functions bauen auf dem Array auf.
+/*N*/ for ( USHORT k = 0; k+1 < rFtnIdxs.Count(); ++k )
+/*N*/ {
+/*N*/ SwIndex aIdx1(&pDoc->GetNodes());
+/*N*/ SwIndex aIdx2(&pDoc->GetNodes());
+/*N*/ rFtnIdxs[k]->pFtn-> GetTxtNode().GetIndex(aIdx1);
+/*N*/ rFtnIdxs[k+1]->pFtn->GetTxtNode().GetIndex(aIdx2);
+/*N*/ if ( aIdx1.GetIndex() > aIdx2.GetIndex() )
+/*N*/ {
+/*N*/ ASSERT( !rFtnIdxs.Count(), "FtnIdxs not up to date" );
+/*N*/ }
+/*N*/ else if ( aIdx1.GetIndex() == aIdx2.GetIndex() )
+/*N*/ {
+/*N*/ SwTxtFtn *p1 = rFtnIdxs[k];
+/*N*/ SwTxtFtn *p2 = rFtnIdxs[k+1];
+/*N*/ ASSERT( *p1->GetStart() < *p2->GetStart(),
+/*N*/ "FtnIdxs not up to date" );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ USHORT nRet;
+/*N*/ SwTxtFtnPtr pBla = (SwTxtFtn*)pAttr;
+/*N*/ if ( rFtnIdxs.Seek_Entry( pBla, &nRet ) )
+/*N*/ {
+/*N*/ if( pAttr->GetFtn().IsEndNote() )
+/*?*/ return ULONG(nRet) + ENDNOTE;
+/*N*/ return nRet;
+/*N*/ }
+/*?*/ ASSERT( !pDoc, "FtnPos not found." );
+/*?*/ return 0;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* BOOL lcl_NextFtnBoss( SwFtnBossFrm* pBoss, SwPageFrm* pPage)
+|* setzt pBoss auf den naechsten SwFtnBossFrm, das kann entweder eine Spalte
+|* oder eine Seite (ohne Spalten) sein. Wenn die Seite dabei gewechselt wird
+|* enthaelt pPage die neue Seite und die Funktion liefert TRUE.
+|*
+|* Ersterstellung AMA 06. Nov. 98
+|* Letzte Aenderung AMA 06. Nov. 98
+|*
+|*************************************************************************/
+
+/*N*/ BOOL lcl_NextFtnBoss( SwFtnBossFrm* &rpBoss, SwPageFrm* &rpPage,
+/*N*/ BOOL bDontLeave )
+/*N*/ {
+/*N*/ if( rpBoss->IsColumnFrm() )
+/*N*/ {
+/*?*/ if( rpBoss->GetNext() )
+/*?*/ {
+/*?*/ rpBoss = (SwFtnBossFrm*)rpBoss->GetNext(); //naechste Spalte
+/*?*/ return FALSE;
+/*?*/ }
+/*?*/ if( rpBoss->IsInSct() )
+/*?*/ {
+/*?*/ SwSectionFrm* pSct = rpBoss->FindSctFrm()->GetFollow();
+/*?*/ if( pSct )
+/*?*/ {
+/*?*/ ASSERT( pSct->Lower() && pSct->Lower()->IsColumnFrm(),
+/*?*/ "Where's the column?" );
+/*?*/ rpBoss = (SwColumnFrm*)pSct->Lower();
+/*?*/ SwPageFrm* pOld = rpPage;
+/*?*/ rpPage = pSct->FindPageFrm();
+/*?*/ return pOld != rpPage;
+/*?*/ }
+/*?*/ else if( bDontLeave )
+/*?*/ {
+/*?*/ rpPage = NULL;
+/*?*/ rpBoss = NULL;
+/*?*/ return FALSE;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ rpPage = (SwPageFrm*)rpPage->GetNext(); // naechste Seite
+/*N*/ rpBoss = rpPage;
+/*N*/ if( rpPage )
+/*N*/ {
+/*N*/ SwLayoutFrm* pBody = rpPage->FindBodyCont();
+/*N*/ if( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrm() )
+/*?*/ rpBoss = (SwFtnBossFrm*)pBody->Lower(); // erste Spalte
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* USHORT lcl_ColumnNum( SwFrm* pBoss )
+|* liefert die Spaltennummer, wenn pBoss eine Spalte ist,
+|* sonst eine Null (bei Seiten).
+|*
+|* Ersterstellung AMA 06. Nov. 98
+|* Letzte Aenderung AMA 06. Nov. 98
+|*
+|*************************************************************************/
+
+/*N*/ USHORT lcl_ColumnNum( const SwFrm* pBoss )
+/*N*/ {
+/*N*/ USHORT nRet = 0;
+/*N*/ if( !pBoss->IsColumnFrm() )
+/*N*/ return 0;
+/*?*/ const SwFrm* pCol;
+/*?*/ if( pBoss->IsInSct() )
+/*?*/ {
+/*?*/ pCol = pBoss->GetUpper()->FindColFrm();
+/*?*/ if( pBoss->GetNext() || pBoss->GetPrev() )
+/*?*/ {
+/*?*/ while( pBoss )
+/*?*/ {
+/*?*/ ++nRet; // Section columns
+/*?*/ pBoss = pBoss->GetPrev();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ pCol = pBoss;
+/*?*/ while( pCol )
+/*?*/ {
+/*?*/ nRet += 256; // Page columns
+/*?*/ pCol = pCol->GetPrev();
+/*?*/ }
+/*?*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnContFrm::SwFtnContFrm()
+|*
+|* Ersterstellung MA 24. Feb. 93
+|* Letzte Aenderung MA 02. Mar. 93
+|*
+|*************************************************************************/
+
+
+/*N*/ SwFtnContFrm::SwFtnContFrm( SwFrmFmt *pFmt ):
+/*N*/ SwLayoutFrm( pFmt )
+/*N*/ {
+/*N*/ nType = FRMC_FTNCONT;
+/*N*/ }
+
+
+// lcl_Undersize(..) klappert einen SwFrm und dessen Inneres ab
+// und liefert die Summe aller TxtFrm-Vergroesserungswuensche
+
+/*N*/ long lcl_Undersize( const SwFrm* pFrm )
+/*N*/ {
+/*N*/ long nRet = 0;
+/*N*/ SWRECTFN( pFrm )
+/*N*/ if( pFrm->IsTxtFrm() )
+/*N*/ {
+/*N*/ if( ((SwTxtFrm*)pFrm)->IsUndersized() )
+/*N*/ {
+/*?*/ // Dieser TxtFrm waere gern ein bisschen groesser
+/*?*/ nRet = ((SwTxtFrm*)pFrm)->GetParHeight() -
+/*?*/ (pFrm->Prt().*fnRect->fnGetHeight)();
+/*?*/ if( nRet < 0 )
+/*?*/ nRet = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pFrm->IsLayoutFrm() )
+/*N*/ {
+/*N*/ const SwFrm* pNxt = ((SwLayoutFrm*)pFrm)->Lower();
+/*N*/ while( pNxt )
+/*N*/ {
+/*N*/ nRet += lcl_Undersize( pNxt );
+/*N*/ pNxt = pNxt->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnContFrm::Format()
+|*
+|* Beschreibung: "Formatiert" den Frame;
+|* Die Fixsize wird hier nicht eingestellt.
+|* Ersterstellung MA 01. Mar. 93
+|* Letzte Aenderung MA 17. Nov. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnContFrm::Format( const SwBorderAttrs * )
+/*N*/ {
+/*N*/ //GesamtBorder ermitteln, es gibt nur einen Abstand nach oben.
+/*N*/ const SwPageFrm* pPage = FindPageFrm();
+/*N*/ const SwPageFtnInfo &rInf = pPage->GetPageDesc()->GetFtnInfo();
+/*N*/ const SwTwips nBorder = rInf.GetTopDist() + rInf.GetBottomDist() +
+/*N*/ rInf.GetLineWidth();
+/*N*/ SWRECTFN( this )
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ bValidPrtArea = TRUE;
+/*N*/ (Prt().*fnRect->fnSetTop)( nBorder );
+/*N*/ (Prt().*fnRect->fnSetWidth)( (Frm().*fnRect->fnGetWidth)() );
+/*N*/ (Prt().*fnRect->fnSetHeight)((Frm().*fnRect->fnGetHeight)() - nBorder );
+/*N*/ if( (Prt().*fnRect->fnGetHeight)() < 0 && !pPage->IsFtnPage() )
+/*N*/ bValidSize = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ if ( pPage->IsFtnPage() && !GetFmt()->GetDoc()->IsBrowseMode() )
+/*?*/ Grow( LONG_MAX PHEIGHT, FALSE );
+/*N*/ else
+/*N*/ {
+/*N*/ //Die Groesse in der VarSize wird durch den Inhalt plus den
+/*N*/ //Raendern bestimmt.
+/*N*/ SwTwips nRemaining = 0;
+/*N*/ SwFrm *pFrm = pLower;
+/*N*/ while ( pFrm )
+/*N*/ { // lcl_Undersize(..) beruecksichtigt (rekursiv) TxtFrms, die gerne
+/*N*/ // groesser waeren. Diese entstehen insbesondere in spaltigen Rahmen,
+/*N*/ // wenn diese noch nicht ihre maximale Groesse haben.
+/*N*/ nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)()
+/*N*/ + lcl_Undersize( pFrm );
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ //Jetzt noch den Rand addieren
+/*N*/ nRemaining += nBorder;
+/*N*/
+/*N*/ SwTwips nDiff;
+/*N*/ if( IsInSct() )
+/*N*/ {
+/*?*/ nDiff = -(Frm().*fnRect->fnBottomDist)(
+/*?*/ (GetUpper()->*fnRect->fnGetPrtBottom)() );
+/*?*/ if( nDiff > 0 )
+/*?*/ {
+/*?*/ if( nDiff > (Frm().*fnRect->fnGetHeight)() )
+/*?*/ nDiff = (Frm().*fnRect->fnGetHeight)();
+/*?*/ (Frm().*fnRect->fnAddBottom)( -nDiff );
+/*?*/ (Prt().*fnRect->fnAddHeight)( -nDiff );
+/*?*/ }
+/*N*/ }
+/*N*/ nDiff = (Frm().*fnRect->fnGetHeight)() - nRemaining;
+/*N*/ if ( nDiff > 0 )
+/*?*/ Shrink( nDiff PHEIGHT );
+/*N*/ else if ( nDiff < 0 )
+/*N*/ {
+/*N*/ Grow( -nDiff PHEIGHT );
+/*N*/ //Es kann passieren, dass weniger Platz zur Verfuegung steht,
+/*N*/ //als der bereits der Border benoetigt - die Groesse der
+/*N*/ //PrtArea wird dann negativ.
+/*N*/ SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ if( nPrtHeight < 0 )
+/*N*/ {
+/*?*/ const SwTwips nDiff = Max( (Prt().*fnRect->fnGetTop)(),
+/*?*/ -nPrtHeight );
+/*?*/ (Prt().*fnRect->fnSubTop)( nDiff );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ bValidSize = TRUE;
+/*N*/ }
+/*N*/ }
+/*************************************************************************
+|*
+|* SwFtnContFrm::GrowFrm(), ShrinkFrm()
+|*
+|* Ersterstellung MA 24. Feb. 93
+|* Letzte Aenderung AMA 05. Nov. 98
+|*
+|*************************************************************************/
+
+/*N*/ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ //Keine Pruefung ob FixSize oder nicht, die FtnContainer sind immer bis
+/*N*/ //zur Maximalhoehe variabel.
+/*N*/ //Wenn die Maximalhoehe LONG_MAX ist, so nehmen wir uns soviel Platz wie eben
+/*N*/ //moeglich.
+/*N*/ //Wenn die Seite eine spezielle Fussnotenseite ist, so nehmen wir uns auch
+/*N*/ //soviel Platz wie eben moeglich.
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( !GetUpper() || !GetUpper()->IsFtnBossFrm() )
+/*?*/ { ASSERT( !this, "Keine FtnBoss." );
+/*?*/ return 0;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ if( (Frm().*fnRect->fnGetHeight)() > 0 &&
+/*N*/ nDist > ( LONG_MAX - (Frm().*fnRect->fnGetHeight)() ) )
+/*N*/ nDist = LONG_MAX - (Frm().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ SwFtnBossFrm *pBoss = (SwFtnBossFrm*)GetUpper();
+/*N*/ if( IsInSct() )
+/*N*/ {
+/*?*/ SwSectionFrm* pSect = FindSctFrm();
+/*?*/ ASSERT( pSect, "GrowFrm: Missing SectFrm" );
+/*?*/ // In a section, which has to maximize, a footnotecontainer is allowed
+/*?*/ // to grow, when the section can't grow anymore.
+/*?*/ if( !bTst && !pSect->IsColLocked() &&
+/*?*/ pSect->ToMaximize( FALSE ) && pSect->Growable() )
+/*?*/ {
+/*?*/ pSect->InvalidateSize();
+/*?*/ return 0;
+/*?*/ }
+/*N*/ }
+/*N*/ SwPageFrm *pPage = pBoss->FindPageFrm();
+/*N*/ if ( !pPage->IsFtnPage() || GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ if ( pBoss->GetMaxFtnHeight() != LONG_MAX )
+/*N*/ {
+/*N*/ nDist = Min( nDist, pBoss->GetMaxFtnHeight()
+/*N*/ - (Frm().*fnRect->fnGetHeight)() );
+/*N*/ if ( nDist <= 0 )
+/*?*/ return 0L;
+/*N*/ }
+/*N*/ //Der FtnBoss will bezueglich des MaxWerts auch noch mitreden.
+/*N*/ if( !IsInSct() )
+/*N*/ {
+/*N*/ const SwTwips nMax = pBoss->GetVarSpace();
+/*N*/ if ( nDist > nMax )
+/*N*/ nDist = nMax;
+/*N*/ if ( nDist <= 0 )
+/*?*/ return 0L;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( nDist > (GetPrev()->Frm().*fnRect->fnGetHeight)() )
+/*N*/ //aber mehr als der Body kann koennen und wollen wir nun auch wieder
+/*N*/ //nicht herausruecken.
+/*?*/ nDist = (GetPrev()->Frm().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ long nAvail = 0;
+/*N*/ if ( GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*?*/ nAvail = GetUpper()->Prt().Height();
+/*?*/ const SwFrm *pAvail = GetUpper()->Lower();
+/*?*/ do
+/*?*/ { nAvail -= pAvail->Frm().Height();
+/*?*/ pAvail = pAvail->GetNext();
+/*?*/ } while ( pAvail );
+/*?*/ if ( nAvail > nDist )
+/*?*/ nAvail = nDist;
+/*N*/ }
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)() + nDist );
+/*N*/ if( IsVertical() && !IsReverse() )
+/*?*/ Frm().Pos().X() -= nDist;
+/*N*/ }
+/*N*/ long nGrow = nDist - nAvail,
+/*N*/ nReal = 0;
+/*N*/ if ( nGrow > 0 )
+/*N*/ {
+/*N*/ BYTE nAdjust = pBoss->NeighbourhoodAdjustment( this );
+/*N*/ if( NA_ONLY_ADJUST == nAdjust )
+/*N*/ nReal = AdjustNeighbourhood( nGrow, bTst );
+/*N*/ else
+/*N*/ {
+/*?*/ if( NA_GROW_ADJUST == nAdjust )
+/*?*/ {
+/*?*/ SwFrm* pFtn = Lower();
+/*?*/ if( pFtn )
+/*?*/ {
+/*?*/ while( pFtn->GetNext() )
+/*?*/ pFtn = pFtn->GetNext();
+/*?*/ if( ((SwFtnFrm*)pFtn)->GetAttr()->GetFtn().IsEndNote() )
+/*?*/ {
+/*?*/ nReal = AdjustNeighbourhood( nGrow, bTst );
+/*?*/ nAdjust = NA_GROW_SHRINK; // no more AdjustNeighbourhood
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ nReal += pBoss->Grow( nGrow - nReal, bTst );
+/*?*/ if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust )
+/*?*/ && nReal < nGrow )
+/*?*/ nReal += AdjustNeighbourhood( nGrow - nReal, bTst );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ nReal += nAvail;
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ if ( nReal != nDist )
+/*N*/ {
+/*?*/ nDist -= nReal;
+/*?*/ //Den masslosen Wunsch koennen wir leider nur in Grenzen erfuellen.
+/*?*/ Frm().SSize().Height() -= nDist;
+/*?*/ if( IsVertical() && !IsReverse() )
+/*?*/ Frm().Pos().X() += nDist;
+/*N*/ }
+/*N*/
+/*N*/ //Nachfolger braucht nicht invalidiert werden, denn wir wachsen
+/*N*/ //immer nach oben.
+/*N*/ if( nReal )
+/*N*/ {
+/*N*/ _InvalidateSize();
+/*N*/ _InvalidatePos();
+/*N*/ InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+
+
+/*N*/ SwTwips SwFtnContFrm::ShrinkFrm( SwTwips nDiff, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( pPage && (!pPage->IsFtnPage() || GetFmt()->GetDoc()->IsBrowseMode()) )
+/*N*/ {
+/*N*/ SwTwips nRet = SwLayoutFrm::ShrinkFrm( nDiff, bTst, bInfo );
+/*N*/ if( IsInSct() && !bTst )
+/*N*/ FindSctFrm()->InvalidateNextPos();
+/*N*/ if ( !bTst && nRet )
+/*N*/ {
+/*N*/ _InvalidatePos();
+/*N*/ InvalidatePage( pPage );
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+/*?*/ return 0;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwFtnFrm::SwFtnFrm()
+|*
+|* Ersterstellung MA 24. Feb. 93
+|* Letzte Aenderung MA 11. Oct. 93
+|*
+|*************************************************************************/
+
+
+/*N*/ SwFtnFrm::SwFtnFrm( SwFrmFmt *pFmt, SwCntntFrm *pCnt, SwTxtFtn *pAt ):
+/*N*/ SwLayoutFrm( pFmt ),
+/*N*/ pFollow( 0 ),
+/*N*/ pMaster( 0 ),
+/*N*/ pRef( pCnt ),
+/*N*/ pAttr( pAt ),
+/*N*/ bBackMoveLocked( FALSE )
+/*N*/ {
+/*N*/ nType = FRMC_FTN;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnFrm::InvalidateNxtFtnCnts()
+|*
+|* Ersterstellung MA 29. Jun. 93
+|* Letzte Aenderung MA 29. Jun. 93
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnFrm::InvalidateNxtFtnCnts( SwPageFrm *pPage )
+/*N*/ {
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ SwFrm *pCnt = ((SwLayoutFrm*)GetNext())->ContainsAny();
+/*N*/ if( pCnt )
+/*N*/ {
+/*?*/ pCnt->InvalidatePage( pPage );
+/*?*/ pCnt->_InvalidatePrt();
+/*?*/ do
+/*?*/ { pCnt->_InvalidatePos();
+/*?*/ if( pCnt->IsSctFrm() )
+/*?*/ {
+/*?*/ SwFrm* pTmp = ((SwSectionFrm*)pCnt)->ContainsAny();
+/*?*/ if( pTmp )
+/*?*/ pTmp->_InvalidatePos();
+/*?*/ }
+/*?*/ pCnt->GetUpper()->_InvalidateSize();
+/*?*/ pCnt = pCnt->FindNext();
+/*?*/ } while ( pCnt && GetUpper()->IsAnLower( pCnt ) );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ #ifdef DBG_UTIL
+/*N*/
+/*N*/ SwTwips SwFtnFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static USHORT nNum = USHRT_MAX;
+/*N*/ SwTxtFtn* pTxtFtn = GetAttr();
+/*N*/ if ( pTxtFtn->GetFtn().GetNumber() == nNum )
+/*N*/ {
+/*?*/ int bla = 5;
+/*N*/ }
+/*N*/ #endif
+/*N*/ return SwLayoutFrm::GrowFrm( nDist, bTst, bInfo );
+/*N*/ }
+
+
+/*N*/ SwTwips SwFtnFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static USHORT nNum = USHRT_MAX;
+/*N*/ if( nNum != USHRT_MAX )
+/*N*/ {
+/*?*/ SwTxtFtn* pTxtFtn = GetAttr();
+/*?*/ if( &pTxtFtn->GetAttr() && pTxtFtn->GetFtn().GetNumber() == nNum )
+/*?*/ {
+/*?*/ int bla = 5;
+/*?*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ return SwLayoutFrm::ShrinkFrm( nDist, bTst, bInfo );
+/*N*/ }
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* SwFtnFrm::Cut()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 24. Jul. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnFrm::Cut()
+/*N*/ {
+/*N*/ if ( GetNext() )
+/*?*/ GetNext()->InvalidatePos();
+/*N*/ else if ( GetPrev() )
+/*?*/ GetPrev()->SetRetouche();
+/*N*/
+/*N*/ //Erst removen, dann Upper Shrinken.
+/*N*/ SwLayoutFrm *pUp = GetUpper();
+/*N*/
+/*N*/ //Verkettung korrigieren.
+/*N*/ SwFtnFrm *pFtn = (SwFtnFrm*)this;
+/*N*/ if ( pFtn->GetFollow() )
+/*?*/ pFtn->GetFollow()->SetMaster( pFtn->GetMaster() );
+/*N*/ if ( pFtn->GetMaster() )
+/*?*/ pFtn->GetMaster()->SetFollow( pFtn->GetFollow() );
+/*N*/ pFtn->SetFollow( 0 );
+/*N*/ pFtn->SetMaster( 0 );
+/*N*/
+/*N*/ // Alle Verbindungen kappen.
+/*N*/ Remove();
+/*N*/
+/*N*/ if ( pUp )
+/*N*/ {
+/*N*/ //Die letzte Fussnote nimmt ihren Container mit.
+/*N*/ if ( !pUp->Lower() )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = pUp->FindPageFrm();
+/*N*/ if ( pPage )
+/*N*/ {
+/*N*/ SwLayoutFrm *pBody = pPage->FindBodyCont();
+/*N*/ if ( !pBody->ContainsCntnt() )
+/*?*/ pPage->FindRootFrm()->SetSuperfluous();
+/*N*/ }
+/*N*/ SwSectionFrm* pSect = pUp->FindSctFrm();
+/*N*/ pUp->Cut();
+/*N*/ delete pUp;
+/*N*/ // Wenn der letzte Fussnotencontainer aus einem spaltigen Bereich verschwindet,
+/*N*/ // so kann dieser, falls er keinen Follow besitzt, zusammenschrumpfen.
+/*N*/ if( pSect && !pSect->ToMaximize( FALSE ) && !pSect->IsColLocked() )
+/*?*/ pSect->_InvalidateSize();
+/*N*/ }
+/*N*/ else
+/*?*/ { if ( Frm().Height() )
+/*?*/ pUp->Shrink( Frm().Height() PHEIGHT );
+/*?*/ pUp->SetCompletePaint();
+/*?*/ pUp->InvalidatePage();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnFrm::Paste()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 23. Feb. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
+/*N*/ {
+/*N*/ ASSERT( pParent, "Kein Parent fuer Paste." );
+/*N*/ ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
+/*N*/ ASSERT( pParent != this, "Bin selbst der Parent." );
+/*N*/ ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
+/*N*/ ASSERT( !GetPrev() && !GetNext() && !GetUpper(),
+/*N*/ "Bin noch irgendwo angemeldet." );
+/*N*/
+/*N*/ //In den Baum einhaengen.
+/*N*/ InsertBefore( (SwLayoutFrm*)pParent, pSibling );
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ if( (Frm().*fnRect->fnGetWidth)()!=(pParent->Prt().*fnRect->fnGetWidth)() )
+/*?*/ _InvalidateSize();
+/*N*/ _InvalidatePos();
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ if ( GetNext() )
+/*?*/ GetNext()->_InvalidatePos();
+/*N*/ if( (Frm().*fnRect->fnGetHeight)() )
+/*?*/ pParent->Grow( (Frm().*fnRect->fnGetHeight)() );
+/*N*/
+/*N*/ //Wenn mein Vorgaenger mein Master ist und/oder wenn mein Nachfolger mein
+/*N*/ //Follow ist so kann ich deren Inhalt uebernehmen und sie vernichten.
+/*N*/ if ( GetPrev() && GetPrev() == GetMaster() )
+/*?*/ { ASSERT( SwFlowFrm::CastFlowFrm( GetPrev()->GetLower() ),
+/*?*/ "Fussnote ohne Inhalt?" );
+/*?*/ (SwFlowFrm::CastFlowFrm( GetPrev()->GetLower()))->
+/*?*/ MoveSubTree( this, GetLower() );
+/*?*/ SwFrm *pDel = GetPrev();
+/*?*/ pDel->Cut();
+/*?*/ delete pDel;
+/*N*/ }
+/*N*/ if ( GetNext() && GetNext() == GetFollow() )
+/*?*/ { ASSERT( SwFlowFrm::CastFlowFrm( GetNext()->GetLower() ),
+/*?*/ "Fussnote ohne Inhalt?" );
+/*?*/ (SwFlowFrm::CastFlowFrm( GetNext()->GetLower()))->MoveSubTree( this );
+/*?*/ SwFrm *pDel = GetNext();
+/*?*/ pDel->Cut();
+/*?*/ delete pDel;
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ if ( GetPrev() )
+/*N*/ {
+/*N*/ ASSERT( lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetPrev())->GetAttr() ) <=
+/*?*/ lcl_FindFtnPos( pDoc, GetAttr() ), "Prev ist not FtnPrev" );
+/*N*/ }
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*?*/ ASSERT( lcl_FindFtnPos( pDoc, GetAttr() ) <=
+/*?*/ lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetNext())->GetAttr() ),
+/*?*/ "Next is not FtnNext" );
+/*N*/ }
+/*N*/ #endif
+/*N*/ InvalidateNxtFtnCnts( pPage );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetNextFtnLeaf()
+|*
+|* Beschreibung Liefert das naechste LayoutBlatt in den das
+|* Frame gemoved werden kann.
+|* Neue Seiten werden nur dann erzeugt, wenn der Parameter TRUE ist.
+|* Ersterstellung MA 16. Nov. 92
+|* Letzte Aenderung AMA 09. Nov. 98
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFrm::GetPrevFtnLeaf()
+|*
+|* Beschreibung Liefert das vorhergehende LayoutBlatt in das der
+|* Frame gemoved werden kann.
+|* Ersterstellung MA 16. Nov. 92
+|* Letzte Aenderung AMA 06. Nov. 98
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFrm::IsFtnAllowed()
+|*
+|* Ersterstellung MA 22. Mar. 94
+|* Letzte Aenderung MA 01. Dec. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwFrm::IsFtnAllowed() const
+/*N*/ {
+/*N*/ if ( !IsInDocBody() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ if ( IsInTab() )
+/*N*/ {
+/*N*/ //Keine Ftns in wiederholten Headlines.
+/*N*/ const SwTabFrm *pTab = ((SwFrm*)this)->ImplFindTabFrm();
+/*N*/ if ( pTab->GetTable()->IsHeadlineRepeat() && pTab->IsFollow() )
+/*N*/ return !((SwLayoutFrm*)pTab->Lower())->IsAnLower( this );
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::UpdateFtnNums()
+|*
+|* Ersterstellung MA 02. Mar. 93
+|* Letzte Aenderung MA 09. Dec. 97
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* RemoveFtns() Entfernen aller Fussnoten (nicht etwa die Referenzen)
+|* und Entfernen aller Fussnotenseiten.
+|*
+|* Ersterstellung MA 05. Dec. 97
+|* Letzte Aenderung AMA 06. Nov. 98
+|*
+|*************************************************************************/
+
+/*N*/ void lcl_RemoveFtns( SwFtnBossFrm* pBoss, BOOL bPageOnly, BOOL bEndNotes )
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ SwFtnContFrm *pCont = pBoss->FindFtnCont();
+/*N*/ if ( pCont )
+/*N*/ {
+/*?*/ SwFtnFrm *pFtn = (SwFtnFrm*)pCont->Lower();
+/*?*/ ASSERT( pFtn, "FtnCont ohne Ftn." );
+/*?*/ if ( bPageOnly )
+/*?*/ while ( pFtn->GetMaster() )
+/*?*/ pFtn = pFtn->GetMaster();
+/*?*/ do
+/*?*/ {
+/*?*/ SwFtnFrm *pNxt = (SwFtnFrm*)pFtn->GetNext();
+/*?*/ if ( !pFtn->GetAttr()->GetFtn().IsEndNote() ||
+/*?*/ bEndNotes )
+/*?*/ {
+/*?*/ pFtn->GetRef()->Prepare( PREP_FTN, (void*)pFtn->GetAttr() );
+/*?*/ if ( bPageOnly && !pNxt )
+/*?*/ pNxt = pFtn->GetFollow();
+/*?*/ pFtn->Cut();
+/*?*/ delete pFtn;
+/*?*/ }
+/*?*/ pFtn = pNxt;
+/*?*/
+/*?*/ } while ( pFtn );
+/*N*/ }
+/*N*/ if( !pBoss->IsInSct() )
+/*N*/ {
+/*N*/ // A sectionframe with the Ftn/EndnAtEnd-flags may contain
+/*N*/ // foot/endnotes. If the last lower frame of the bodyframe is
+/*N*/ // a multicolumned sectionframe, it may contain footnotes, too.
+/*N*/ SwLayoutFrm* pBody = pBoss->FindBodyCont();
+/*N*/ if( pBody && pBody->Lower() )
+/*N*/ {
+/*N*/ SwFrm* pLow = pBody->Lower();
+/*N*/ while( pLow->GetNext() )
+/*N*/ {
+/*N*/ if( pLow->IsSctFrm() && ( !pLow->GetNext() ||
+/*N*/ ((SwSectionFrm*)pLow)->IsAnyNoteAtEnd() ) &&
+/*N*/ ((SwSectionFrm*)pLow)->Lower() &&
+/*N*/ ((SwSectionFrm*)pLow)->Lower()->IsColumnFrm() )
+/*?*/ lcl_RemoveFtns( (SwColumnFrm*)((SwSectionFrm*)pLow)->Lower(),
+/*?*/ bPageOnly, bEndNotes );
+/*N*/ pLow = pLow->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // noch 'ne Spalte?
+/*N*/ pBoss = pBoss->IsColumnFrm() ? (SwColumnFrm*)pBoss->GetNext() : NULL;
+/*N*/ } while( pBoss );
+/*N*/ }
+
+/*N*/ void SwRootFrm::RemoveFtns( SwPageFrm *pPage, BOOL bPageOnly, BOOL bEndNotes )
+/*N*/ {
+/*N*/ if ( !pPage )
+/*?*/ pPage = (SwPageFrm*)Lower();
+/*N*/
+/*N*/ do
+/*N*/ { // Bei spaltigen Seiten muessen wir in allen Spalten aufraeumen
+/*N*/ SwFtnBossFrm* pBoss;
+/*N*/ SwLayoutFrm* pBody = pPage->FindBodyCont();
+/*N*/ if( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrm() )
+/*N*/ pBoss = (SwFtnBossFrm*)pBody->Lower(); // die erste Spalte
+/*N*/ else
+/*N*/ pBoss = pPage; // keine Spalten
+/*N*/ lcl_RemoveFtns( pBoss, bPageOnly, bEndNotes );
+/*N*/ if ( !bPageOnly )
+/*N*/ {
+/*?*/ if ( pPage->IsFtnPage() &&
+/*?*/ (!pPage->IsEndNotePage() || bEndNotes) )
+/*?*/ {
+/*?*/ SwFrm *pDel = pPage;
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*?*/ pDel->Cut();
+/*?*/ delete pDel;
+/*?*/ }
+/*?*/ else
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/
+/*?*/ } while ( pPage );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SetFtnPageDescs() Seitenvorlagen der Fussnotenseiten aendern
+|*
+|* Ersterstellung MA 11. Dec. 97
+|* Letzte Aenderung MA 11. Dec. 97
+|*
+|*************************************************************************/
+
+void SwRootFrm::CheckFtnPageDescs( BOOL bEndNote )
+{
+ SwPageFrm *pPage = (SwPageFrm*)Lower();
+ while ( pPage && !pPage->IsFtnPage() )
+ pPage = (SwPageFrm*)pPage->GetNext();
+ while ( pPage && pPage->IsEndNotePage() != bEndNote )
+ pPage = (SwPageFrm*)pPage->GetNext();
+ if ( pPage )
+ SwFrm::CheckPageDescs( pPage, FALSE );
+}
+
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::MakeFtnCont()
+|*
+|* Ersterstellung MA 25. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ SwFtnContFrm *SwFtnBossFrm::MakeFtnCont()
+/*N*/ {
+/*N*/ //Einfuegen eines Fussnotencontainers. Der Fussnotencontainer sitzt
+/*N*/ //immer direkt hinter dem Bodytext.
+/*N*/ //Sein FrmFmt ist immer das DefaultFrmFmt.
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( FindFtnCont() )
+/*?*/ { ASSERT( !this, "Fussnotencontainer bereits vorhanden." );
+/*?*/ return 0;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ SwFtnContFrm *pNew = new SwFtnContFrm( GetFmt()->GetDoc()->GetDfltFrmFmt());
+/*N*/ SwLayoutFrm *pLay = FindBodyCont();
+/*N*/ pNew->Paste( this, pLay->GetNext() );
+/*N*/ return pNew;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::FindFtnCont()
+|*
+|* Ersterstellung MA 25. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ SwFtnContFrm *SwFtnBossFrm::FindFtnCont()
+/*N*/ {
+/*N*/ SwFrm *pFrm = Lower();
+/*N*/ while( pFrm && !pFrm->IsFtnContFrm() )
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( pFrm )
+/*N*/ {
+/*N*/ SwFrm *pFtn = pFrm->GetLower();
+/*N*/ ASSERT( pFtn, "Cont ohne Fussnote." );
+/*N*/ while ( pFtn )
+/*N*/ {
+/*N*/ ASSERT( pFtn->IsFtnFrm(), "Nachbar von Fussnote keine Fussnote." );
+/*N*/ pFtn = pFtn->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ return (SwFtnContFrm*)pFrm;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::FindNearestFtnCont() Sucht den naechst greifbaren Fussnotencontainer.
+|*
+|* Ersterstellung MA 02. Aug. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+/*N*/ SwFtnContFrm *SwFtnBossFrm::FindNearestFtnCont( BOOL bDontLeave )
+/*N*/ {
+/*N*/ SwFtnContFrm *pCont = 0;
+/*N*/ if ( GetFmt()->GetDoc()->GetFtnIdxs().Count() )
+/*N*/ {
+/*N*/ pCont = FindFtnCont();
+/*N*/ if ( !pCont )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ SwFtnBossFrm* pBoss = this;
+/*N*/ BOOL bEndNote = pPage->IsEndNotePage();
+/*N*/ do
+/*N*/ {
+/*N*/ BOOL bChgPage = lcl_NextFtnBoss( pBoss, pPage, bDontLeave );
+/*N*/ // Haben wir noch einen Boss gefunden? Bei einem Seitenwechsel muss
+/*N*/ // zudem noch das EndNotenFlag uebereinstimmen
+/*N*/ if( pBoss && ( !bChgPage || pPage->IsEndNotePage() == bEndNote ) )
+/*N*/ pCont = pBoss->FindFtnCont();
+/*N*/ } while ( !pCont && pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ return pCont;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::FindFirstFtn()
+|*
+|* Beschreibung Erste Fussnote des Fussnotenbosses suchen.
+|* Ersterstellung MA 26. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 99
+|*
+|*************************************************************************/
+
+
+/*N*/ SwFtnFrm *SwFtnBossFrm::FindFirstFtn()
+/*N*/ {
+/*N*/ //Erstmal den naechsten FussnotenContainer suchen.
+/*N*/ SwFtnContFrm *pCont = FindNearestFtnCont();
+/*N*/ if ( !pCont )
+/*N*/ return 0;
+/*N*/
+/*N*/ //Ab der ersten Fussnote im Container die erste suchen, die
+/*N*/ //von der aktuellen Spalte (bzw. einspaltigen Seite) referenziert wird.
+/*N*/
+/*N*/ SwFtnFrm *pRet = (SwFtnFrm*)pCont->Lower();
+/*N*/ const USHORT nRefNum = FindPageFrm()->GetPhyPageNum();
+/*N*/ const USHORT nRefCol = lcl_ColumnNum( this );
+/*N*/ USHORT nPgNum, nColNum; //Seitennummer, Spaltennummer
+/*N*/ SwFtnBossFrm* pBoss;
+/*N*/ SwPageFrm* pPage;
+/*N*/ if( pRet )
+/*N*/ {
+/*N*/ pBoss = pRet->GetRef()->FindFtnBossFrm();
+/*N*/ ASSERT( pBoss, "FindFirstFtn: No boss found" );
+/*N*/ if( !pBoss )
+/*?*/ return FALSE; // ´There must be a bug, but no GPF
+/*N*/ pPage = pBoss->FindPageFrm();
+/*N*/ nPgNum = pPage->GetPhyPageNum();
+/*N*/ if ( nPgNum == nRefNum )
+/*N*/ {
+/*N*/ nColNum = lcl_ColumnNum( pBoss );
+/*N*/ if( nColNum == nRefCol )
+/*N*/ return pRet; //hat ihn.
+/*?*/ else if( nColNum > nRefCol )
+/*?*/ return NULL; //mind. eine Spalte zu weit.
+/*?*/ }
+/*?*/ else if ( nPgNum > nRefNum )
+/*?*/ return NULL; //mind. eine Seite zu weit.
+/*?*/ }
+/*?*/ else
+/*?*/ return NULL;
+/*?*/ // Ende, wenn Ref auf einer spaeteren Seite oder auf der gleichen Seite in einer
+/*?*/ // spaeteren Spalte liegt
+/*?*/
+/*?*/ do
+/*?*/ {
+/*?*/ while ( pRet->GetFollow() )
+/*?*/ pRet = pRet->GetFollow();
+/*?*/
+/*?*/ SwFtnFrm *pNxt = (SwFtnFrm*)pRet->GetNext();
+/*?*/ if ( !pNxt )
+/*?*/ {
+/*?*/ pBoss = pRet->FindFtnBossFrm();
+/*?*/ pPage = pBoss->FindPageFrm();
+/*?*/ lcl_NextFtnBoss( pBoss, pPage, FALSE ); // naechster FtnBoss
+/*?*/ pCont = pBoss ? pBoss->FindNearestFtnCont() : 0;
+/*?*/ if ( pCont )
+/*?*/ pNxt = (SwFtnFrm*)pCont->Lower();
+/*?*/ }
+/*?*/ if ( pNxt )
+/*?*/ {
+/*?*/ pRet = pNxt;
+/*?*/ pBoss = pRet->GetRef()->FindFtnBossFrm();
+/*?*/ pPage = pBoss->FindPageFrm();
+/*?*/ nPgNum = pPage->GetPhyPageNum();
+/*?*/ if ( nPgNum == nRefNum )
+/*?*/ {
+/*?*/ nColNum = lcl_ColumnNum( pBoss );
+/*?*/ if( nColNum == nRefCol )
+/*?*/ break; //hat ihn.
+/*?*/ else if( nColNum > nRefCol )
+/*?*/ pRet = 0; //mind. eine Spalte zu weit.
+/*?*/ }
+/*?*/ else if ( nPgNum > nRefNum )
+/*?*/ pRet = 0; //mind. eine Seite zu weit.
+/*?*/ }
+/*?*/ else
+/*?*/ pRet = 0; //Gibt eben keinen.
+/*?*/ } while( pRet );
+/*?*/ return pRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::FindFirstFtn()
+|*
+|* Beschreibunt Erste Fussnote zum Cnt suchen.
+|* Ersterstellung MA 04. Mar. 93
+|* Letzte Aenderung AMA 28. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ const SwFtnFrm *SwFtnBossFrm::FindFirstFtn( SwCntntFrm *pCnt ) const
+/*N*/ {
+/*N*/ const SwFtnFrm *pRet = ((SwFtnBossFrm*)this)->FindFirstFtn();
+/*N*/ if ( pRet )
+/*N*/ {
+/*N*/ const USHORT nColNum = lcl_ColumnNum( this ); //Spaltennummer
+/*N*/ const USHORT nPageNum = GetPhyPageNum();
+/*N*/ while ( pRet && (pRet->GetRef() != pCnt) )
+/*N*/ {
+/*?*/ while ( pRet->GetFollow() )
+/*?*/ pRet = pRet->GetFollow();
+/*?*/
+/*?*/ if ( pRet->GetNext() )
+/*?*/ pRet = (const SwFtnFrm*)pRet->GetNext();
+/*?*/ else
+/*?*/ { SwFtnBossFrm *pBoss = (SwFtnBossFrm*)pRet->FindFtnBossFrm();
+/*?*/ SwPageFrm *pPage = pBoss->FindPageFrm();
+/*?*/ lcl_NextFtnBoss( pBoss, pPage, FALSE ); // naechster FtnBoss
+/*?*/ SwFtnContFrm *pCont = pBoss ? pBoss->FindNearestFtnCont() : 0;
+/*?*/ pRet = pCont ? (SwFtnFrm*)pCont->Lower() : 0;
+/*?*/ }
+/*?*/ if ( pRet )
+/*?*/ {
+/*?*/ const SwFtnBossFrm* pBoss = pRet->GetRef()->FindFtnBossFrm();
+/*?*/ if( pBoss->GetPhyPageNum() != nPageNum ||
+/*?*/ nColNum != lcl_ColumnNum( pBoss ) )
+/*?*/ pRet = 0;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::ResetFtn()
+|*
+|* Ersterstellung MA 11. May. 95
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck )
+/*N*/ {
+/*N*/ //Vernichten der Inkarnationen von Fussnoten zum Attribut, wenn sie nicht
+/*N*/ //zu pAssumed gehoeren.
+/*N*/ ASSERT( !pCheck->GetMaster(), "Master not an Master." );
+/*N*/
+/*N*/ SwNodeIndex aIdx( *pCheck->GetAttr()->GetStartNode(), 1 );
+/*N*/ SwCntntNode *pNd = aIdx.GetNode().GetCntntNode();
+/*N*/ if ( !pNd )
+/*?*/ pNd = pCheck->GetFmt()->GetDoc()->
+/*?*/ GetNodes().GoNextSection( &aIdx, TRUE, FALSE );
+/*N*/ SwClientIter aIter( *pNd );
+/*N*/ SwClient* pLast = aIter.GoStart();
+/*N*/ while( pLast )
+/*N*/ {
+/*N*/ if ( pLast->ISA(SwFrm) )
+/*N*/ {
+/*N*/ SwFrm *pFrm = (SwFrm*)pLast;
+/*N*/ SwFrm *pTmp = pFrm->GetUpper();
+/*N*/ while ( pTmp && !pTmp->IsFtnFrm() )
+/*?*/ pTmp = pTmp->GetUpper();
+/*N*/
+/*N*/ SwFtnFrm *pFtn = (SwFtnFrm*)pTmp;
+/*N*/ while ( pFtn && pFtn->GetMaster() )
+/*?*/ pFtn = pFtn->GetMaster();
+/*N*/ if ( pFtn != pCheck )
+/*N*/ {
+/*?*/ while ( pFtn )
+/*?*/ {
+/*?*/ SwFtnFrm *pNxt = pFtn->GetFollow();
+/*?*/ pFtn->Cut();
+/*?*/ delete pFtn;
+/*?*/ pFtn = pNxt;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pLast = ++aIter;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::InsertFtn()
+|*
+|* Ersterstellung MA 26. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
+/*N*/ {
+/*N*/ #if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL)
+/*N*/ static USHORT nStop = 0;
+/*N*/ if ( nStop == pNew->GetFrmId() )
+/*N*/ {
+/*?*/ int bla = 5;
+/*N*/ }
+/*N*/ #endif
+/*N*/ //Die Fussnote haben wir, sie muss jetzt nur noch irgendwo
+/*N*/ //hin und zwar vor die Fussnote, deren Attribut vor das
+/*N*/ //der neuen zeigt (Position wird ueber das Doc ermittelt)
+/*N*/ //Gibt es in diesem Fussnotenboss noch keine Fussnoten, so muss eben ein
+/*N*/ //Container erzeugt werden.
+/*N*/ //Gibt es bereits einen Container aber noch keine Fussnote zu diesem
+/*N*/ //Fussnotenboss, so muss die Fussnote hinter die letzte Fussnote der dichtesten
+/*N*/ //Vorseite/spalte.
+/*N*/
+/*N*/ ResetFtn( pNew );
+/*N*/ SwFtnFrm *pSibling = FindFirstFtn();
+/*N*/ BOOL bDontLeave = FALSE;
+/*N*/
+/*N*/ // Ok, a sibling has been found, but is the sibling in an acceptable
+/*N*/ // environment?
+/*N*/ if( IsInSct() )
+/*N*/ {
+/*?*/ SwSectionFrm* pMySect = ImplFindSctFrm();
+/*?*/ BOOL bEndnt = pNew->GetAttr()->GetFtn().IsEndNote();
+/*?*/ if( bEndnt )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwSectionFmt* pEndFmt = pMySect->GetEndSectFmt();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ bDontLeave = pMySect->IsFtnAtEnd();
+/*?*/ if( pSibling )
+/*?*/ {
+/*?*/ if( pMySect->IsFtnAtEnd() )
+/*?*/ {
+/*?*/ if( !pSibling->IsInSct() ||
+/*?*/ !pMySect->IsAnFollow( pSibling->ImplFindSctFrm() ) )
+/*?*/ pSibling = NULL;
+/*?*/ }
+/*?*/ else if( pSibling->IsInSct() )
+/*?*/ pSibling = NULL;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pSibling && pSibling->FindPageFrm()->IsEndNotePage() !=
+/*N*/ FindPageFrm()->IsEndNotePage() )
+/*?*/ pSibling = NULL;
+/*N*/
+/*N*/ //Damit die Position herausgefunden werden kann.
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ const ULONG nStPos = ::binfilter::lcl_FindFtnPos( pDoc, pNew->GetAttr() );
+/*N*/
+/*N*/ ULONG nCmpPos, nLastPos;
+/*N*/ SwFtnContFrm *pParent = 0;
+/*N*/ if( pSibling )
+/*N*/ {
+/*?*/ nCmpPos = ::binfilter::lcl_FindFtnPos( pDoc, pSibling->GetAttr() );
+/*?*/ if( nCmpPos > nStPos )
+/*?*/ pSibling = NULL;
+/*N*/ }
+/*N*/
+/*N*/ if ( !pSibling )
+/*N*/ { pParent = FindFtnCont();
+/*N*/ if ( !pParent )
+/*N*/ {
+/*N*/ //Es gibt noch keinen FussnotenContainer, also machen wir einen.
+/*N*/ //HAAAAAAAALT! So einfach ist das leider mal wieder nicht: Es kann
+/*N*/ //sein, dass irgendeine naechste Fussnote existiert die vor der
+/*N*/ //einzufuegenden zu stehen hat, weil z.B. eine Fussnote ueber zig
+/*N*/ //Seiten aufgespalten ist usw.
+/*N*/ pParent = FindNearestFtnCont( bDontLeave );
+/*N*/ if ( pParent )
+/*N*/ {
+/*?*/ SwFtnFrm *pFtn = (SwFtnFrm*)pParent->Lower();
+/*?*/ if ( pFtn )
+/*?*/ {
+/*?*/
+/*?*/ nCmpPos = ::binfilter::lcl_FindFtnPos( pDoc, pFtn->GetAttr() );
+/*?*/ if ( nCmpPos > nStPos )
+/*?*/ pParent = 0;
+/*?*/ }
+/*?*/ else
+/*?*/ pParent = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pParent )
+/*N*/ //Jetzt kann aber ein Fussnotencontainer gebaut werden.
+/*N*/ pParent = MakeFtnCont();
+/*N*/ else
+/*N*/ {
+/*?*/ //Ausgehend von der ersten Fussnote unterhalb des Parents wird die
+/*?*/ //erste Fussnote gesucht deren Index hinter dem Index der
+/*?*/ //einzufuegenden liegt; vor dieser kann der neue dann gepastet
+/*?*/ //werden.
+/*?*/ pSibling = (SwFtnFrm*)pParent->Lower();
+/*?*/ if ( !pSibling )
+/*?*/ { ASSERT( !this, "Keinen Platz fuer Fussnote gefunden.");
+/*?*/ return;
+/*?*/ }
+/*?*/ nCmpPos = ::binfilter::lcl_FindFtnPos( pDoc, pSibling->GetAttr() );
+/*?*/
+/*?*/ SwFtnBossFrm *pNxtB = this; //Immer den letzten merken, damit wir nicht
+/*?*/ SwFtnFrm *pLastSib = 0; //ueber das Ziel hinausschiessen.
+/*?*/
+/*?*/ while ( pSibling && nCmpPos <= nStPos )
+/*?*/ {
+/*?*/ pLastSib = pSibling; // der kommt schon mal in Frage
+/*?*/ nLastPos = nCmpPos;
+/*?*/
+/*?*/ while ( pSibling->GetFollow() )
+/*?*/ pSibling = pSibling->GetFollow();
+/*?*/
+/*?*/ if ( pSibling->GetNext() )
+/*?*/ {
+/*?*/ pSibling = (SwFtnFrm*)pSibling->GetNext();
+/*?*/ ASSERT( !pSibling->GetMaster() || ( ENDNOTE > nStPos &&
+/*?*/ pSibling->GetAttr()->GetFtn().IsEndNote() ),
+/*?*/ "InsertFtn: Master expected I" );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pNxtB = pSibling->FindFtnBossFrm();
+/*?*/ SwPageFrm *pSibPage = pNxtB->FindPageFrm();
+/*?*/ BOOL bEndNote = pSibPage->IsEndNotePage();
+/*?*/ BOOL bChgPage = lcl_NextFtnBoss( pNxtB, pSibPage, bDontLeave );
+/*?*/ // Bei Seitenwechsel muss das EndNoteFlag ueberprueft werden.
+/*?*/ SwFtnContFrm *pCont = pNxtB && ( !bChgPage ||
+/*?*/ pSibPage->IsEndNotePage() == bEndNote )
+/*?*/ ? pNxtB->FindNearestFtnCont( bDontLeave ) : 0;
+/*?*/ if( pCont )
+/*?*/ pSibling = (SwFtnFrm*)pCont->Lower();
+/*?*/ else // kein weiterer FtnContainer, dann werden wir uns wohl hinter
+/*?*/ break; // pSibling haengen
+/*?*/ }
+/*?*/ if ( pSibling )
+/*?*/ {
+/*?*/ nCmpPos = ::binfilter::lcl_FindFtnPos( pDoc, pSibling->GetAttr() );
+/*?*/ ASSERT( nCmpPos > nLastPos, "InsertFtn: Order of FtnFrm's buggy" );
+/*?*/ }
+/*?*/ }
+/*?*/ // pLastSib ist jetzt die letzte Fussnote vor uns,
+/*?*/ // pSibling leer oder die erste nach uns.
+/*?*/ if ( pSibling && pLastSib && (pSibling != pLastSib) )
+/*?*/ { //Sind wir vielleicht bereits ueber das Ziel hinausgeschossen?
+/*?*/ if ( nCmpPos > nStPos )
+/*?*/ pSibling = pLastSib;
+/*?*/ }
+/*?*/ else if ( !pSibling )
+/*?*/ { //Eine Chance haben wir noch: wir nehmen einfach die letzte
+/*?*/ //Fussnote im Parent. Ein Sonderfall, der z.B. beim
+/*?*/ //zurueckfliessen von Absaetzen mit mehreren Fussnoten
+/*?*/ //vorkommt.
+/*?*/ //Damit wir nicht die Reihenfolge verwuerfeln muessen wir den
+/*?*/ //Parent der letzten Fussnote, die wir an der Hand hatten benutzen.
+/*?*/ pSibling = pLastSib;
+/*?*/ while( pSibling->GetFollow() )
+/*?*/ pSibling = pSibling->GetFollow();
+/*?*/ ASSERT( !pSibling->GetNext(), "InsertFtn: Who's that guy?" );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ { //Die erste Fussnote der Spalte/Seite haben wir an der Hand, jetzt ausgehend
+/*?*/ //von dieser die erste zur selben Spalte/Seite suchen deren Index hinter
+/*?*/ //den uebergebenen zeigt, die letzte, die wir an der Hand hatten, ist
+/*?*/ //dann der Vorgaenger.
+/*?*/ SwFtnBossFrm* pBoss = pNew->GetRef()->FindFtnBossFrm(
+/*?*/ !pNew->GetAttr()->GetFtn().IsEndNote() );
+/*?*/ USHORT nRefNum = pBoss->GetPhyPageNum(); // Die Seiten- und
+/*?*/ USHORT nRefCol = lcl_ColumnNum( pBoss ); // Spaltennummer der neuen Fussnote
+/*?*/ BOOL bEnd = FALSE;
+/*?*/ SwFtnFrm *pLastSib = 0;
+/*?*/ while ( pSibling && !bEnd && (nCmpPos <= nStPos) )
+/*?*/ {
+/*?*/ pLastSib = pSibling;
+/*?*/ nLastPos = nCmpPos;
+/*?*/
+/*?*/ while ( pSibling->GetFollow() )
+/*?*/ pSibling = pSibling->GetFollow();
+/*?*/
+/*?*/ SwFtnFrm *pFoll = (SwFtnFrm*)pSibling->GetNext();
+/*?*/ if ( pFoll )
+/*?*/ {
+/*?*/ pBoss = pSibling->GetRef()->FindFtnBossFrm( !pSibling->
+/*?*/ GetAttr()->GetFtn().IsEndNote() );
+/*?*/ USHORT nTmpRef;
+/*?*/ if( nStPos >= ENDNOTE ||
+/*?*/ (nTmpRef = pBoss->GetPhyPageNum()) < nRefNum ||
+/*?*/ ( nTmpRef == nRefNum && lcl_ColumnNum( pBoss ) <= nRefCol ))
+/*?*/ pSibling = pFoll;
+/*?*/ else
+/*?*/ bEnd = TRUE;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ SwFtnBossFrm* pNxtB = pSibling->FindFtnBossFrm();
+/*?*/ SwPageFrm *pSibPage = pNxtB->FindPageFrm();
+/*?*/ BOOL bEndNote = pSibPage->IsEndNotePage();
+/*?*/ BOOL bChgPage = lcl_NextFtnBoss( pNxtB, pSibPage, bDontLeave );
+/*?*/ // Bei Seitenwechsel muss das EndNoteFlag ueberprueft werden.
+/*?*/ SwFtnContFrm *pCont = pNxtB && ( !bChgPage ||
+/*?*/ pSibPage->IsEndNotePage() == bEndNote )
+/*?*/ ? pNxtB->FindNearestFtnCont( bDontLeave ) : 0;
+/*?*/ if ( pCont )
+/*?*/ pSibling = (SwFtnFrm*)pCont->Lower();
+/*?*/ else
+/*?*/ bEnd = TRUE;
+/*?*/ }
+/*?*/ if ( !bEnd && pSibling )
+/*?*/ nCmpPos = ::binfilter::lcl_FindFtnPos( pDoc, pSibling->GetAttr() );
+/*?*/ if ( pSibling && pLastSib && (pSibling != pLastSib) )
+/*?*/ { //Sind wir vielleicht bereits ueber das Ziel hinausgeschossen?
+/*?*/ if ( (nLastPos < nCmpPos) && (nCmpPos > nStPos) )
+/*?*/ {
+/*?*/ pSibling = pLastSib;
+/*?*/ bEnd = TRUE;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ if ( pSibling )
+/*N*/ {
+/*?*/ nCmpPos = ::binfilter::lcl_FindFtnPos( pDoc, pSibling->GetAttr() );
+/*?*/ if ( nCmpPos < nStPos )
+/*?*/ {
+/*?*/ while ( pSibling->GetFollow() )
+/*?*/ pSibling = pSibling->GetFollow();
+/*?*/ pParent = (SwFtnContFrm*)pSibling->GetUpper();
+/*?*/ pSibling = (SwFtnFrm*)pSibling->GetNext();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ if( pSibling->GetMaster() )
+/*?*/ {
+/*?*/ if( ENDNOTE > nCmpPos || nStPos >= ENDNOTE )
+/*?*/ {
+/*?*/ ASSERT( FALSE, "InsertFtn: Master expected II" );
+/*?*/ do
+/*?*/ pSibling = pSibling->GetMaster();
+/*?*/ while ( pSibling->GetMaster() );
+/*?*/ }
+/*?*/ }
+/*?*/ pParent = (SwFtnContFrm*)pSibling->GetUpper();
+/*?*/ }
+/*N*/ }
+/*N*/ ASSERT( pParent, "paste in space?" );
+/*N*/ pNew->Paste( pParent, pSibling );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::AppendFtn()
+|*
+|* Ersterstellung MA 25. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
+/*N*/ {
+/*N*/ //Wenn es die Fussnote schon gibt tun wir nix.
+/*N*/ if ( FindFtn( pRef, pAttr ) )
+/*?*/ return;
+/*N*/
+/*N*/ //Wenn Fussnoten am Dokumentende eingestellt sind, so brauchen wir 'eh erst
+/*N*/ //ab der entsprechenden Seite zu suchen.
+/*N*/ //Wenn es noch keine gibt, muss eben eine erzeugt werden.
+/*N*/ //Wenn es sich um eine Endnote handelt, muss eine Endnotenseite gesucht
+/*N*/ //bzw. erzeugt werden.
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ SwFtnBossFrm *pBoss = this;
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ SwPageFrm *pMyPage = pPage;
+/*N*/ BOOL bChgPage = FALSE;
+/*N*/ BOOL bEnd = FALSE;
+/*N*/ if ( pAttr->GetFtn().IsEndNote() )
+/*N*/ {
+/*?*/ bEnd = TRUE;
+/*?*/ if( GetUpper()->IsSctFrm() &&
+/*?*/ ((SwSectionFrm*)GetUpper())->IsEndnAtEnd() )
+/*?*/ {
+/*?*/ SwFrm* pLast =
+/*?*/ ((SwSectionFrm*)GetUpper())->FindLastCntnt( FINDMODE_ENDNOTE );
+/*?*/ if( pLast )
+/*?*/ {
+/*?*/ pBoss = pLast->FindFtnBossFrm();
+/*?*/ pPage = pBoss->FindPageFrm();
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ while ( pPage->GetNext() && !pPage->IsEndNotePage() )
+/*?*/ {
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*?*/ bChgPage = TRUE;
+/*?*/ }
+/*?*/ if ( !pPage->IsEndNotePage() )
+/*?*/ {
+/*?*/ SwPageDesc *pDesc = pDoc->GetEndNoteInfo().GetPageDesc( *pDoc );
+/*?*/ pPage = ::binfilter::InsertNewPage( *pDesc, pPage->GetUpper(),
+/*?*/ !pPage->OnRightPage(), FALSE, TRUE, 0 );
+/*?*/ pPage->SetEndNotePage( TRUE );
+/*?*/ bChgPage = TRUE;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ //Wir koennen wenigstens schon mal ungefaehr die richtige Seite
+/*?*/ //suchen. Damit stellen wir sicher das wir auch bei hunderten
+/*?*/ //Fussnoten noch in endlicher Zeit fertig werden.
+/*?*/ SwPageFrm *pNxt = (SwPageFrm*)pPage->GetNext();
+/*?*/ const ULONG nStPos = ::binfilter::lcl_FindFtnPos( pDoc, pAttr );
+/*?*/ while ( pNxt && pNxt->IsEndNotePage() )
+/*?*/ {
+/*?*/ SwFtnContFrm *pCont = pNxt->FindFtnCont();
+/*?*/ if ( pCont && pCont->Lower() )
+/*?*/ {
+/*?*/ ASSERT( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" );
+/*?*/ if ( nStPos > ::binfilter::lcl_FindFtnPos( pDoc,
+/*?*/ ((SwFtnFrm*)pCont->Lower())->GetAttr()))
+/*?*/ {
+/*?*/ pPage = pNxt;
+/*?*/ pNxt = (SwPageFrm*)pPage->GetNext();
+/*?*/ continue;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ else if( FTNPOS_CHAPTER == pDoc->GetFtnInfo().ePos && ( !GetUpper()->
+/*N*/ IsSctFrm() || !((SwSectionFrm*)GetUpper())->IsFtnAtEnd() ) )
+/*N*/ {
+/*?*/ while ( pPage->GetNext() && !pPage->IsFtnPage() &&
+/*?*/ !((SwPageFrm*)pPage->GetNext())->IsEndNotePage() )
+/*?*/ {
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*?*/ bChgPage = TRUE;
+/*?*/ }
+/*?*/
+/*?*/ if ( !pPage->IsFtnPage() )
+/*?*/ {
+/*?*/ SwPageDesc *pDesc = pDoc->GetFtnInfo().GetPageDesc( *pDoc );
+/*?*/ pPage = ::binfilter::InsertNewPage( *pDesc, pPage->GetUpper(),
+/*?*/ !pPage->OnRightPage(), FALSE, TRUE, pPage->GetNext() );
+/*?*/ bChgPage = TRUE;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ //Wir koennen wenigstens schon mal ungefaehr die richtige Seite
+/*?*/ //suchen. Damit stellen wir sicher das wir auch bei hunderten
+/*?*/ //Fussnoten noch in endlicher Zeit fertig werden.
+/*?*/ SwPageFrm *pNxt = (SwPageFrm*)pPage->GetNext();
+/*?*/ const ULONG nStPos = ::binfilter::lcl_FindFtnPos( pDoc, pAttr );
+/*?*/ while ( pNxt && pNxt->IsFtnPage() && !pNxt->IsEndNotePage() )
+/*?*/ {
+/*?*/ SwFtnContFrm *pCont = pNxt->FindFtnCont();
+/*?*/ if ( pCont && pCont->Lower() )
+/*?*/ {
+/*?*/ ASSERT( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" );
+/*?*/ if ( nStPos > ::binfilter::lcl_FindFtnPos( pDoc,
+/*?*/ ((SwFtnFrm*)pCont->Lower())->GetAttr()))
+/*?*/ {
+/*?*/ pPage = pNxt;
+/*?*/ pNxt = (SwPageFrm*)pPage->GetNext();
+/*?*/ continue;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Erstmal eine Fussnote und die benoetigten CntntFrms anlegen.
+/*N*/ if ( !pAttr->GetStartNode() )
+/*?*/ { ASSERT( !this, "Kein Fussnoteninhalt." );
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Wenn es auf der Seite/Spalte bereits einen FtnCont gibt,
+/*N*/ // kann in einen spaltigen Bereich keiner erzeugt werden.
+/*N*/ if( pBoss->IsInSct() && pBoss->IsColumnFrm() && !pPage->IsFtnPage() )
+/*N*/ {
+/*?*/ SwSectionFrm* pSct = pBoss->FindSctFrm();
+/*?*/ if( bEnd ? !pSct->IsEndnAtEnd() : !pSct->IsFtnAtEnd() )
+/*?*/ {
+/*?*/ SwFtnContFrm* pFtnCont = pSct->FindFtnBossFrm(!bEnd)->FindFtnCont();
+/*?*/ if( pFtnCont )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFtnFrm* pTmp = (SwFtnFrm*)pFtnCont->Lower();
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwFtnFrm *pNew = new SwFtnFrm( pDoc->GetDfltFrmFmt(), pRef, pAttr );
+/*N*/ {
+/*N*/ SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 );
+/*N*/ ::binfilter::_InsertCnt( pNew, pDoc, aIdx.GetIndex() );
+/*N*/ }
+/*N*/ // Wenn die Seite gewechselt (oder gar neu angelegt) wurde,
+/*N*/ // muessen wir uns dort in die erste Spalte setzen
+/*N*/ if( bChgPage )
+/*N*/ {
+/*?*/ SwLayoutFrm* pBody = pPage->FindBodyCont();
+/*?*/ ASSERT( pBody, "AppendFtn: NoPageBody?" );
+/*?*/ if( pBody->Lower() && pBody->Lower()->IsColumnFrm() )
+/*?*/ pBoss = (SwFtnBossFrm*)pBody->Lower();
+/*?*/ else
+/*?*/ pBoss = pPage; // bei nichtspaltigen Seiten auf die Seite selbst
+/*N*/ }
+/*N*/ pBoss->InsertFtn( pNew );
+/*N*/ if ( pNew->GetUpper() ) //Eingesetzt oder nicht?
+/*N*/ {
+/*N*/ ::binfilter::RegistFlys( pNew->FindPageFrm(), pNew );
+/*N*/ SwSectionFrm* pSect = FindSctFrm();
+/*N*/ // Der Inhalt des FtnContainers in einem (spaltigen) Bereich
+/*N*/ // braucht nur kalkuliert zu werden,
+/*N*/ // wenn der Bereich bereits bis zur Unterkante seines Uppers geht.
+/*N*/ if( pSect && !pSect->IsJoinLocked() && ( bEnd ? !pSect->IsEndnAtEnd() :
+/*N*/ !pSect->IsFtnAtEnd() ) && pSect->Growable() )
+/*?*/ pSect->InvalidateSize();
+/*N*/ else
+/*N*/ {
+/*N*/ SwCntntFrm *pCnt = pNew->ContainsCntnt();
+/*N*/ while ( pCnt && pCnt->FindFtnFrm()->GetAttr() == pAttr )
+/*N*/ {
+/*N*/ pCnt->Calc();
+/*N*/ pCnt = (SwCntntFrm*)pCnt->FindNextCnt();
+/*N*/ }
+/*N*/ }
+/*N*/ pMyPage->UpdateFtnNum();
+/*N*/ }
+/*N*/ else
+/*?*/ delete pNew;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwFtnBossFrm::FindFtn()
+|*
+|* Ersterstellung MA 25. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr )
+/*N*/ {
+/*N*/ //Der einfachste und sicherste Weg geht ueber das Attribut.
+/*N*/ ASSERT( pAttr->GetStartNode(), "FtnAtr ohne StartNode." );
+/*N*/ SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 );
+/*N*/ SwCntntNode *pNd = aIdx.GetNode().GetCntntNode();
+/*N*/ if ( !pNd )
+/*N*/ pNd = pRef->GetAttrSet()->GetDoc()->
+/*?*/ GetNodes().GoNextSection( &aIdx, TRUE, FALSE );
+/*N*/ if ( !pNd )
+/*?*/ return 0;
+/*N*/ SwClientIter aIter( *pNd );
+/*N*/ SwClient *pClient;
+/*N*/ if ( 0 != (pClient = aIter.GoStart()) )
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pClient->IsA( TYPE(SwFrm) ) )
+/*N*/ {
+/*N*/ SwFrm *pFrm = ((SwFrm*)pClient)->GetUpper();
+/*N*/ SwFtnFrm *pFtn = pFrm->FindFtnFrm();
+/*N*/ if ( pFtn && pFtn->GetRef() == pRef )
+/*N*/ {
+/*N*/ // The following condition becomes true, if the whole
+/*N*/ // footnotecontent is a section. While no frames exist,
+/*N*/ // the HiddenFlag of the section is set, this causes
+/*N*/ // the GoNextSection-function leaves the footnote.
+/*N*/ if( pFtn->GetAttr() != pAttr )
+/*?*/ return 0;
+/*N*/ while ( pFtn && pFtn->GetMaster() )
+/*?*/ pFtn = pFtn->GetMaster();
+/*N*/ return pFtn;
+/*N*/ }
+/*N*/ }
+/*?*/ } while ( 0 != (pClient = aIter++) );
+/*N*/
+/*N*/ return 0;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwFtnBossFrm::RemoveFtn()
+|*
+|* Ersterstellung MA 25. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnBossFrm::RemoveFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr,
+/*N*/ BOOL bPrep )
+/*N*/ {
+/*N*/ SwFtnFrm *pFtn = FindFtn( pRef, pAttr );
+/*N*/ if( pFtn )
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ SwFtnFrm *pFoll = pFtn->GetFollow();
+/*N*/ pFtn->Cut();
+/*N*/ delete pFtn;
+/*N*/ pFtn = pFoll;
+/*N*/ } while ( pFtn );
+/*N*/ if( bPrep && pRef->IsFollow() )
+/*N*/ {
+/*?*/ ASSERT( pRef->IsTxtFrm(), "NoTxtFrm has Footnote?" );
+/*?*/ SwTxtFrm* pMaster = (SwTxtFrm*)pRef->FindMaster();
+/*?*/ if( !pMaster->IsLocked() )
+/*?*/ pMaster->Prepare( PREP_FTN_GONE );
+/*N*/ }
+/*N*/ }
+/*N*/ FindPageFrm()->UpdateFtnNum();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::ChangeFtnRef()
+|*
+|* Ersterstellung MA 25. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::CollectFtns()
+|*
+|* Ersterstellung MA 24. Jul. 95
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/// OD 03.04.2003 #108446# - add parameter <_bCollectOnlyPreviousFtns> in
+/// order to control, if only footnotes, which are positioned before the
+/// footnote boss frame <this> have to be collected.
+
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::_CollectFtns()
+|*
+|* Ersterstellung MA 24. Jul. 95
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+/// OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFtns> and
+/// <_pRefFtnBossFrm> in order to control, if only footnotes, which are positioned
+/// before the given reference footnote boss frame have to be collected.
+/// Note: if parameter <_bCollectOnlyPreviousFtns> is true, then parameter
+/// <_pRefFtnBossFrm> have to be referenced to an object.
+/// Adjust parameter names.
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::_MoveFtns()
+|*
+|* Ersterstellung MA 26. Feb. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::MoveFtns()
+|*
+|* Ersterstellung BP 05. Aug. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::RearrangeFtns()
+|*
+|* Ersterstellung MA 20. Jan. 94
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const BOOL bLock,
+/*N*/ const SwTxtFtn *pAttr )
+/*N*/ {
+/*N*/ //Alle Fussnoten der Spalte/Seite dergestalt anformatieren,
+/*N*/ //dass sie ggf. die Spalte/Seite wechseln.
+/*N*/
+/*N*/ SwSaveFtnHeight aSave( this, nDeadLine );
+/*N*/ SwFtnFrm *pFtn = FindFirstFtn();
+/*N*/ if( pFtn && pFtn->GetPrev() && bLock )
+/*N*/ {
+/*?*/ SwFtnFrm* pFirst = (SwFtnFrm*)pFtn->GetUpper()->Lower();
+/*?*/ SwFrm* pCntnt = pFirst->ContainsAny();
+/*?*/ if( pCntnt )
+/*?*/ {
+/*?*/ BOOL bUnlock = !pFirst->IsBackMoveLocked();
+/*?*/ pFirst->LockBackMove();
+/*?*/ pFirst->Calc();
+/*?*/ pCntnt->Calc();
+/*?*/ if( bUnlock )
+/*?*/ pFirst->UnlockBackMove();
+/*?*/ }
+/*?*/ pFtn = FindFirstFtn();
+/*N*/ }
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ const ULONG nFtnPos = pAttr ? ::binfilter::lcl_FindFtnPos( pDoc, pAttr ) : 0;
+/*N*/ SwFrm *pCnt = pFtn ? pFtn->ContainsAny() : 0;
+/*N*/ if ( pCnt )
+/*N*/ {
+/*N*/ BOOL bMore = TRUE;
+/*N*/ BOOL bStart = pAttr == 0; // wenn kein Attribut uebergeben wird, alle bearbeiten
+/*N*/ do
+/*N*/ {
+/*N*/ if( !bStart )
+/*N*/ bStart = ::binfilter::lcl_FindFtnPos( pDoc, pCnt->FindFtnFrm()->GetAttr() )
+/*N*/ == nFtnPos;
+/*N*/ if( bStart )
+/*N*/ {
+/*N*/ pCnt->_InvalidatePos();
+/*N*/ pCnt->_InvalidateSize();
+/*N*/ pCnt->Prepare( PREP_ADJUST_FRM );
+/*N*/ SwFtnFrm* pFtnFrm = pCnt->FindFtnFrm();
+/*N*/ // OD 30.10.2002 #97265# - invalidate position of footnote
+/*N*/ // frame, if it's below its footnote container, in order to
+/*N*/ // assure its correct position, probably calculating its previous
+/*N*/ // footnote frames.
+/*N*/ {
+/*N*/ SWRECTFN( this );
+/*N*/ SwFrm* aFtnContFrm = pFtnFrm->GetUpper();
+/*N*/ if ( (pFtnFrm->Frm().*fnRect->fnTopDist)((aFtnContFrm->*fnRect->fnGetPrtBottom)()) > 0 )
+/*N*/ {
+/*N*/ pFtnFrm->_InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bLock )
+/*N*/ {
+/*N*/ BOOL bUnlock = !pFtnFrm->IsBackMoveLocked();
+/*N*/ pFtnFrm->LockBackMove();
+/*N*/ pFtnFrm->Calc();
+/*N*/ pCnt->Calc();
+/*N*/ if( bUnlock )
+/*N*/ {
+/*N*/ pFtnFrm->UnlockBackMove();
+/*N*/ if( !pFtnFrm->Lower() &&
+/*N*/ !pFtnFrm->IsColLocked() )
+/*N*/ {
+/*N*/ pFtnFrm->Cut();
+/*N*/ delete pFtnFrm;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pFtnFrm->Calc();
+/*N*/ pCnt->Calc();
+/*N*/ }
+/*N*/ }
+/*N*/ SwSectionFrm *pDel = NULL;
+/*N*/ if( pCnt->IsSctFrm() )
+/*N*/ {
+/*N*/ SwFrm* pTmp = ((SwSectionFrm*)pCnt)->ContainsAny();
+/*N*/ if( pTmp )
+/*N*/ {
+/*N*/ pCnt = pTmp;
+/*N*/ continue;
+/*N*/ }
+/*N*/ pDel = (SwSectionFrm*)pCnt;
+/*N*/ }
+/*N*/ if ( pCnt->GetNext() )
+/*N*/ pCnt = pCnt->GetNext();
+/*N*/ else
+/*N*/ {
+/*N*/ pCnt = pCnt->FindNext();
+/*N*/ if ( pCnt )
+/*N*/ {
+/*N*/ SwFtnFrm* pFtn = pCnt->FindFtnFrm();
+/*N*/ if( pFtn->GetRef()->FindFtnBossFrm(
+/*N*/ pFtn->GetAttr()->GetFtn().IsEndNote() ) != this )
+/*N*/ bMore = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ bMore = FALSE;
+/*N*/ }
+/*N*/ if( pDel )
+/*N*/ {
+/*N*/ pDel->Cut();
+/*N*/ delete pDel;
+/*N*/ }
+/*N*/ if ( bMore )
+/*N*/ {
+/*N*/ //Nicht weiter als bis zur angegebenen Fussnote, falls eine
+/*N*/ //angegeben wurde.
+/*N*/ if ( pAttr &&
+/*N*/ (::binfilter::lcl_FindFtnPos( pDoc,
+/*N*/ pCnt->FindFtnFrm()->GetAttr()) > nFtnPos ) )
+/*N*/ bMore = FALSE;
+/*N*/ }
+/*N*/ } while ( bMore );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::UpdateFtnNum()
+|*
+|* Ersterstellung MA 02. Mar. 93
+|* Letzte Aenderung AMA 29. Oct. 98
+|*
+|*************************************************************************/
+
+/*N*/ void SwPageFrm::UpdateFtnNum()
+/*N*/ {
+/*N*/ //Seitenweise Numerierung nur wenn es am Dokument so eingestellt ist.
+/*N*/ if ( GetFmt()->GetDoc()->GetFtnInfo().eNum != FTNNUM_PAGE )
+/*N*/ return;
+/*?*/
+/*?*/ SwLayoutFrm* pBody = FindBodyCont();
+/*?*/ if( !pBody || !pBody->Lower() )
+/*?*/ return;
+/*?*/
+/*?*/ SwCntntFrm* pCntnt = pBody->ContainsCntnt();
+/*?*/ USHORT nNum = 0;
+/*?*/
+/*?*/ while( pCntnt && pCntnt->FindPageFrm() == this )
+/*?*/ {
+/*?*/ if( ((SwTxtFrm*)pCntnt)->HasFtn() )
+/*?*/ {
+/*?*/ SwFtnBossFrm* pBoss = pCntnt->FindFtnBossFrm( TRUE );
+/*?*/ if( pBoss->GetUpper()->IsSctFrm() &&
+/*?*/ ((SwSectionFrm*)pBoss->GetUpper())->IsOwnFtnNum() )
+/*?*/ pCntnt = ((SwSectionFrm*)pBoss->GetUpper())->FindLastCntnt();
+/*?*/ else
+/*?*/ {
+/*?*/ SwFtnFrm* pFtn = (SwFtnFrm*)pBoss->FindFirstFtn( pCntnt );
+/*?*/ while( pFtn )
+/*?*/ {
+/*?*/ SwTxtFtn* pTxtFtn = pFtn->GetAttr();
+/*?*/ if( !pTxtFtn->GetFtn().IsEndNote() &&
+/*?*/ !pTxtFtn->GetFtn().GetNumStr().Len() &&
+/*?*/ !pFtn->GetMaster() &&
+/*?*/ (pTxtFtn->GetFtn().GetNumber() != ++nNum) )
+/*?*/ pTxtFtn->SetNumber( nNum );
+/*?*/ if ( pFtn->GetNext() )
+/*?*/ pFtn = (SwFtnFrm*)pFtn->GetNext();
+/*?*/ else
+/*?*/ {
+/*?*/ SwFtnBossFrm* pBoss = pFtn->FindFtnBossFrm( TRUE );
+/*?*/ SwPageFrm* pPage = pBoss->FindPageFrm();
+/*?*/ pFtn = NULL;
+/*?*/ lcl_NextFtnBoss( pBoss, pPage, FALSE );
+/*?*/ if( pBoss )
+/*?*/ {
+/*?*/ SwFtnContFrm *pCont = pBoss->FindNearestFtnCont();
+/*?*/ if ( pCont )
+/*?*/ pFtn = (SwFtnFrm*)pCont->Lower();
+/*?*/ }
+/*?*/ }
+/*?*/ if( pFtn && pFtn->GetRef() != pCntnt )
+/*?*/ pFtn = NULL;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ pCntnt = pCntnt->FindNextCnt();
+/*?*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::SetFtnDeadLine()
+|*
+|* Ersterstellung MA 02. Aug. 93
+|* Letzte Aenderung MA 16. Nov. 98
+|*
+|*************************************************************************/
+
+/*N*/ void SwFtnBossFrm::SetFtnDeadLine( const SwTwips nDeadLine )
+/*N*/ {
+/*N*/ SwFrm *pBody = FindBodyCont();
+/*N*/ pBody->Calc();
+/*N*/
+/*N*/ SwFrm *pCont = FindFtnCont();
+/*N*/ const SwTwips nMax = nMaxFtnHeight;//Aktuelle MaxHeight nicht ueberschreiten.
+/*N*/ SWRECTFN( this )
+/*N*/ if ( pCont )
+/*N*/ {
+/*N*/ pCont->Calc();
+/*N*/ nMaxFtnHeight = -(pCont->Frm().*fnRect->fnBottomDist)( nDeadLine );
+/*N*/ }
+/*N*/ else
+/*N*/ nMaxFtnHeight = -(pBody->Frm().*fnRect->fnBottomDist)( nDeadLine );
+/*N*/
+/*N*/ if ( GetFmt()->GetDoc()->IsBrowseMode() )
+/*?*/ nMaxFtnHeight += pBody->Grow( LONG_MAX PHEIGHT, TRUE );
+/*N*/ if ( IsInSct() )
+/*?*/ nMaxFtnHeight += FindSctFrm()->Grow( LONG_MAX PHEIGHT, TRUE );
+/*N*/
+/*N*/ if ( nMaxFtnHeight < 0 )
+/*N*/ nMaxFtnHeight = 0;
+/*N*/ if ( nMax != LONG_MAX && nMaxFtnHeight > nMax )
+/*N*/ nMaxFtnHeight = nMax;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::GetVarSpace()
+|*
+|* Ersterstellung MA 03. Apr. 95
+|* Letzte Aenderung MA 16. Nov. 98
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwFtnBossFrm::GetVarSpace() const
+/*N*/ {
+/*N*/ //Fuer Seiten soll ein Wert von 20% der Seitenhoehe nicht unterschritten
+/*N*/ //werden (->AMA: was macht MS da?)
+/*N*/ //->AMA: Was ist da fuer Bereiche sinnvoll (und kompatibel zu MS ;-)?
+/*N*/ //AMA: MS kennt scheinbar kein Begrenzung, die Fussnoten nehmen durchaus
+/*N*/ // die ganze Seite/Spalte ein.
+/*N*/
+/*N*/ const SwPageFrm* pPg = FindPageFrm();
+/*N*/ ASSERT( pPg, "Footnote lost page" );
+/*N*/
+/*N*/ const SwFrm *pBody = FindBodyCont();
+/*N*/ SwTwips nRet;
+/*N*/ if( pBody )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ if( IsInSct() )
+/*N*/ {
+/*?*/ nRet = 0;
+/*?*/ SwTwips nTmp = (*fnRect->fnYDiff)( (pBody->*fnRect->fnGetPrtTop)(),
+/*?*/ (Frm().*fnRect->fnGetTop)() );
+/*?*/ const SwSectionFrm* pSect = FindSctFrm();
+/*?*/ // Endnotes in a ftncontainer causes a deadline:
+/*?*/ // the bottom of the last contentfrm
+/*?*/ if( pSect->IsEndnAtEnd() ) // endnotes allowed?
+/*?*/ {
+/*?*/ ASSERT( !Lower() || !Lower()->GetNext() || Lower()->GetNext()->
+/*?*/ IsFtnContFrm(), "FtnContainer exspected" );
+/*?*/ const SwFtnContFrm* pCont = Lower() ?
+/*?*/ (SwFtnContFrm*)Lower()->GetNext() : 0;
+/*?*/ if( pCont )
+/*?*/ {
+/*?*/ SwFtnFrm* pFtn = (SwFtnFrm*)pCont->Lower();
+/*?*/ while( pFtn)
+/*?*/ {
+/*?*/ if( pFtn->GetAttr()->GetFtn().IsEndNote() )
+/*?*/ { // endnote found
+/*?*/ SwFrm* pFrm = ((SwLayoutFrm*)Lower())->Lower();
+/*?*/ if( pFrm )
+/*?*/ {
+/*?*/ while( pFrm->GetNext() )
+/*?*/ pFrm = pFrm->GetNext(); // last cntntfrm
+/*?*/ nTmp += (*fnRect->fnYDiff)(
+/*?*/ (Frm().*fnRect->fnGetTop)(),
+/*?*/ (pFrm->Frm().*fnRect->fnGetBottom)() );
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*?*/ pFtn = (SwFtnFrm*)pFtn->GetNext();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ if( nTmp < nRet )
+/*?*/ nRet = nTmp;
+/*?*/ }
+/*N*/ else
+/*N*/ nRet = - (pPg->Prt().*fnRect->fnGetHeight)()/5;
+/*N*/ nRet += (pBody->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nRet < 0 )
+/*?*/ nRet = 0;
+/*N*/ }
+/*N*/ else
+/*?*/ nRet = 0;
+/*N*/ if ( IsPageFrm() && GetFmt()->GetDoc()->IsBrowseMode() )
+/*?*/ nRet += BROWSE_HEIGHT - Frm().Height();
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFtnBossFrm::NeighbourhoodAdjustment(SwFrm*)
+|*
+|* gibt Auskunft, ob die Groessenveraenderung von pFrm von AdjustNeighbourhood(...)
+|* oder von Grow/Shrink(..) verarbeitet werden sollte.
+|* Bei einem PageFrm oder in Spalten direkt unterhalb der Seite muss AdjustNei..
+|* gerufen werden, in Rahmenspalten Grow/Shrink.
+|* Spannend sind die spaltigen Bereiche: Wenn es in der Spalte einen Fussnotencontainer
+|* gibt und die Fussnoten nicht vom Bereich eingesammelt werden, ist ein Adjust..,
+|* ansonsten ein Grow/Shrink notwendig.
+|*
+|* Ersterstellung AMA 09. Dec 98
+|* Letzte Aenderung AMA 09. Dec 98
+|*
+|*************************************************************************/
+
+/*N*/ BYTE SwFtnBossFrm::_NeighbourhoodAdjustment( const SwFrm* pFrm ) const
+/*N*/ {
+/*N*/ BYTE nRet = NA_ONLY_ADJUST;
+/*N*/ if( GetUpper() && !GetUpper()->IsPageBodyFrm() )
+/*N*/ {
+/*N*/ // Spaltige Rahmen erfordern Grow/Shrink
+/*N*/ if( GetUpper()->IsFlyFrm() )
+/*N*/ nRet = NA_GROW_SHRINK;
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( GetUpper()->IsSctFrm(), "NeighbourhoodAdjustment: Unexspected Upper" );
+/*?*/ if( !GetNext() && !GetPrev() )
+/*?*/ nRet = NA_GROW_ADJUST; // section with a single column (FtnAtEnd)
+/*?*/ else
+/*?*/ {
+/*?*/ const SwFrm* pTmp = Lower();
+/*?*/ ASSERT( pTmp, "NeighbourhoodAdjustment: Missing Lower()" );
+/*?*/ if( !pTmp->GetNext() )
+/*?*/ nRet = NA_GROW_SHRINK;
+/*?*/ else if( !GetUpper()->IsColLocked() )
+/*?*/ nRet = NA_ADJUST_GROW;
+/*?*/ ASSERT( !pTmp->GetNext() || pTmp->GetNext()->IsFtnContFrm(),
+/*?*/ "NeighbourhoodAdjustment: Who's that guy?" );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::SetColMaxFtnHeight()
+|*
+|* Ersterstellung AMA 29. Oct 98
+|* Letzte Aenderung AMA 29. Oct 98
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::MoveLowerFtns
+|*
+|* Ersterstellung MA 01. Sep. 94
+|* Letzte Aenderung MA 05. Sep. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ BOOL SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
+/*N*/ SwFtnBossFrm *pNewBoss, const BOOL bFtnNums )
+/*N*/ {
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ if ( !pDoc->GetFtnIdxs().Count() )
+/*N*/ return FALSE;
+/*?*/ if( pDoc->GetFtnInfo().ePos == FTNPOS_CHAPTER &&
+/*?*/ ( !IsInSct() || !FindSctFrm()->IsFtnAtEnd() ) )
+/*?*/ return TRUE;
+/*?*/
+/*?*/ if ( !pNewBoss )
+/*?*/ pNewBoss = FindFtnBossFrm( TRUE );
+/*?*/ if ( pNewBoss == pOldBoss )
+/*?*/ return FALSE;
+/*?*/
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 BOOL bMoved = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::MoveFtnCntFwd()
+|*
+|* Ersterstellung MA 24. Nov. 94
+|* Letzte Aenderung MA 15. Jun. 95
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* class SwSaveFtnHeight
+|*
+|* Ersterstellung MA 19. Jan. 94
+|* Letzte Aenderung MA 19. Jan. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ SwSaveFtnHeight::SwSaveFtnHeight( SwFtnBossFrm *pBs, const SwTwips nDeadLine ) :
+/*N*/ pBoss( pBs ),
+/*N*/ nOldHeight( pBs->GetMaxFtnHeight() )
+/*N*/ {
+/*N*/ pBoss->SetFtnDeadLine( nDeadLine );
+/*N*/ nNewHeight = pBoss->GetMaxFtnHeight();
+/*N*/ }
+
+
+
+/*N*/ SwSaveFtnHeight::~SwSaveFtnHeight()
+/*N*/ {
+/*N*/ //Wenn zwischendurch jemand an der DeadLine gedreht hat, so lassen wir
+/*N*/ //ihm seinen Spass!
+/*N*/ if ( nNewHeight == pBoss->GetMaxFtnHeight() )
+/*N*/ pBoss->nMaxFtnHeight = nOldHeight;
+/*N*/ }
+
+
+/*N*/ #ifdef DBG_UTIL
+//JP 15.10.2001: in a non pro version test if the attribute has the same
+// meaning which his reference is
+
+// Normally, the pRef member and the GetRefFromAttr() result has to be
+// identically. Sometimes footnote will be moved from a master to its follow,
+// but the GetRef() is called first, so we have to ignore a master/follow
+// mismatch.
+
+/*N*/ const SwCntntFrm* SwFtnFrm::GetRef() const
+/*N*/ {
+/*N*/ const SwCntntFrm* pRefAttr = GetRefFromAttr();
+/*N*/ ASSERT( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr )
+/*N*/ || pRefAttr->IsAnFollow( pRef ),
+/*N*/ "access to deleted Frame? pRef != pAttr->GetRef()" );
+/*N*/ return pRef;
+/*N*/ }
+
+/*N*/ SwCntntFrm* SwFtnFrm::GetRef()
+/*N*/ {
+/*N*/ const SwCntntFrm* pRefAttr = GetRefFromAttr();
+/*N*/ ASSERT( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr )
+/*N*/ || pRefAttr->IsAnFollow( pRef ),
+/*N*/ "access to deleted Frame? pRef != pAttr->GetRef()" );
+/*N*/ return pRef;
+/*N*/ }
+
+/*N*/ #endif
+
+/*N*/ const SwCntntFrm* SwFtnFrm::GetRefFromAttr() const
+/*N*/ {
+/*N*/ SwFtnFrm* pThis = (SwFtnFrm*)this;
+/*N*/ return pThis->GetRefFromAttr();
+/*N*/ }
+
+/*N*/ SwCntntFrm* SwFtnFrm::GetRefFromAttr()
+/*N*/ {
+/*N*/ ASSERT( pAttr, "invalid Attribute" );
+/*N*/ SwTxtNode& rTNd = (SwTxtNode&)pAttr->GetTxtNode();
+/*N*/ SwPosition aPos( rTNd, SwIndex( &rTNd, *pAttr->GetStart() ));
+/*N*/ SwCntntFrm* pCFrm = rTNd.GetFrm( 0, &aPos, FALSE );
+/*N*/ return pCFrm;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_hffrm.cxx b/binfilter/bf_sw/source/core/layout/sw_hffrm.cxx
new file mode 100644
index 000000000000..a5f6bb035a70
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_hffrm.cxx
@@ -0,0 +1,778 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "pagefrm.hxx"
+#include "viewsh.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <fmtcntnt.hxx>
+#include <fmthdft.hxx>
+#include <fmtfsize.hxx>
+#include "hffrm.hxx"
+#include "txtfrm.hxx"
+#include "sectfrm.hxx"
+#include "flyfrm.hxx"
+#include "frmtool.hxx"
+#include "dflyobj.hxx"
+#include "frmfmt.hxx"
+#include "frmsh.hxx"
+#include "ndindex.hxx"
+#include "hfspacingitem.hxx"
+namespace binfilter {
+
+/*N*/ extern FASTBOOL bObjsDirect; //frmtool.cxx
+
+/*M*/ static SwTwips lcl_GetFrmMinHeight(const SwLayoutFrm & rFrm)
+/*M*/ {
+/*M*/ const SwFmtFrmSize &rSz = rFrm.GetFmt()->GetFrmSize();
+/*M*/ SwTwips nMinHeight;
+/*M*/
+/*M*/ switch (rSz.GetSizeType())
+/*M*/ {
+/*M*/ case ATT_MIN_SIZE:
+/*M*/ nMinHeight = rSz.GetHeight();
+/*M*/
+/*M*/ break;
+/*M*/
+/*M*/ default:
+/*M*/ nMinHeight = 0;
+/*M*/ }
+/*M*/
+/*M*/
+/*M*/ return nMinHeight;
+/*M*/ }
+
+
+/*M*/ static SwTwips lcl_CalcContentHeight(SwLayoutFrm & frm)
+/*M*/ {
+/*M*/ SwFrm* pFrm = frm.Lower();
+/*M*/
+/*M*/ SwTwips nRemaining = 0;
+/*M*/ USHORT nNum = 0;
+/*M*/ pFrm = frm.Lower();
+/*M*/ while ( pFrm )
+/*M*/ {
+/*M*/ SwTwips nTmp;
+/*M*/
+/*M*/ nTmp = pFrm->Frm().Height();
+/*M*/ nRemaining += nTmp;
+/*M*/ if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
+/*M*/ {
+/*M*/ nTmp = ((SwTxtFrm*)pFrm)->GetParHeight()
+/*M*/ - pFrm->Prt().Height();
+/*M*/ // Dieser TxtFrm waere gern ein bisschen groesser
+/*M*/ nRemaining += nTmp;
+/*M*/ }
+/*M*/ else if( pFrm->IsSctFrm() && ((SwSectionFrm*)pFrm)->IsUndersized() )
+/*M*/ {
+/*M*/ nTmp = ((SwSectionFrm*)pFrm)->Undersize();
+/*M*/ nRemaining += nTmp;
+/*M*/ }
+/*M*/ pFrm = pFrm->GetNext();
+/*M*/
+/*M*/ nNum++;
+/*M*/ }
+/*M*/
+/*M*/ return nRemaining;
+/*M*/ }
+
+/*M*/ static void lcl_LayoutFrmEnsureMinHeight(SwLayoutFrm & rFrm,
+/*M*/ const SwBorderAttrs * pAttrs)
+/*M*/ {
+/*M*/ SwTwips nMinHeight = lcl_GetFrmMinHeight(rFrm);
+/*M*/
+/*M*/ if (rFrm.Frm().Height() < nMinHeight)
+/*M*/ {
+/*M*/ rFrm.Grow(nMinHeight - rFrm.Frm().Height());
+/*M*/ }
+/*M*/ }
+
+/*M*/ SwHeadFootFrm::SwHeadFootFrm( SwFrmFmt * pFmt, USHORT nTypeIn)
+/*M*/ : SwLayoutFrm(pFmt)
+/*M*/ {
+/*M*/ nType = nTypeIn;
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ SetDerivedVert( FALSE );
+/*M*/ #endif
+/*M*/
+/*M*/ const SwFmtCntnt &rCnt = pFmt->GetCntnt();
+/*M*/
+/*M*/ ASSERT( rCnt.GetCntntIdx(), "Kein Inhalt fuer Header." );
+/*M*/
+/*M*/ //Fuer Header Footer die Objekte gleich erzeugen lassen.
+/*M*/ FASTBOOL bOld = bObjsDirect;
+/*M*/ bObjsDirect = TRUE;
+/*M*/ ULONG nIndex = rCnt.GetCntntIdx()->GetIndex();
+/*M*/ ::binfilter::_InsertCnt( this, pFmt->GetDoc(), ++nIndex );
+/*M*/ bObjsDirect = bOld;
+/*M*/ }
+
+/*M*/ void SwHeadFootFrm::FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs)
+/*M*/ {
+/*M*/ if (GetEatSpacing())
+/*M*/ {
+ /* The minimal height of the print area is the minimal height of the
+ frame without the height needed for borders and shadow. */
+/*M*/ SwTwips nMinHeight = lcl_GetFrmMinHeight(*this);
+/*M*/
+/*M*/ nMinHeight -= pAttrs->CalcTop();
+/*M*/ nMinHeight -= pAttrs->CalcBottom();
+/*M*/
+ /* If the minimal height of the print area is negative, try to
+ compensate by overlapping */
+/*M*/ SwTwips nOverlap = 0;
+/*M*/ if (nMinHeight < 0)
+/*M*/ {
+/*M*/ nOverlap = -nMinHeight;
+/*M*/ nMinHeight = 0;
+/*M*/ }
+/*M*/
+ /* Calculate desired height of content. The minimal height has to be
+ adhered. */
+/*M*/ SwTwips nHeight;
+/*M*/
+/*M*/ if ( ! HasFixSize() )
+/*M*/ nHeight = lcl_CalcContentHeight(*this);
+/*M*/ else
+/*M*/ nHeight = nMinHeight;
+/*M*/
+/*M*/ if (nHeight < nMinHeight)
+/*M*/ nHeight = nMinHeight;
+/*M*/
+/*M*/ /* calculate initial spacing/line space */
+/*M*/ SwTwips nSpace, nLine;
+/*M*/
+/*M*/ if (IsHeaderFrm())
+/*M*/ {
+/*M*/ nSpace = pAttrs->CalcBottom();
+/*M*/ nLine = pAttrs->CalcBottomLine();
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ nSpace = pAttrs->CalcTop();
+/*M*/ nLine = pAttrs->CalcTopLine();
+/*M*/ }
+/*M*/
+/*M*/ /* calculate overlap and correct spacing */
+/*M*/ nOverlap += nHeight - nMinHeight;
+/*M*/ if (nOverlap < nSpace - nLine)
+/*M*/ nSpace -= nOverlap;
+/*M*/ else
+/*M*/ nSpace = nLine;
+/*M*/
+/*M*/ /* calculate real vertical space between frame and print area */
+/*M*/ if (IsHeaderFrm())
+/*M*/ nUL = pAttrs->CalcTop() + nSpace;
+/*M*/ else
+/*M*/ nUL = pAttrs->CalcBottom() + nSpace;
+/*M*/
+/*M*/ /* set print area */
+/*N*/ // OD 23.01.2003 #106895# - add first parameter to <SwBorderAttrs::CalcRight(..)>
+/*N*/ SwTwips nLR = pAttrs->CalcLeft( this ) + pAttrs->CalcRight( this );
+/*M*/
+/*M*/ aPrt.Left(pAttrs->CalcLeft(this));
+/*M*/
+/*M*/ if (IsHeaderFrm())
+/*M*/ aPrt.Top(pAttrs->CalcTop());
+/*M*/ else
+/*M*/ aPrt.Top(nSpace);
+/*M*/
+/*M*/ aPrt.Width(aFrm.Width() - nLR);
+/*M*/
+/*M*/ SwTwips nNewHeight;
+/*M*/
+/*M*/ if (nUL < aFrm.Height())
+/*M*/ nNewHeight = aFrm.Height() - nUL;
+/*M*/ else
+/*M*/ nNewHeight = 0;
+/*M*/
+/*M*/ aPrt.Height(nNewHeight);
+/*M*/
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ //Position einstellen.
+/*M*/ aPrt.Left( pAttrs->CalcLeft( this ) );
+/*M*/ aPrt.Top ( pAttrs->CalcTop() );
+/*M*/
+/*M*/ //Sizes einstellen; die Groesse gibt der umgebende Frm vor, die
+/*M*/ //die Raender werden einfach abgezogen.
+/*N*/ // OD 23.01.2003 #106895# - add first parameter to <SwBorderAttrs::CalcRight(..)>
+/*N*/ SwTwips nLR = pAttrs->CalcLeft( this ) + pAttrs->CalcRight( this );
+/*M*/ aPrt.Width ( aFrm.Width() - nLR );
+/*M*/ aPrt.Height( aFrm.Height()- nUL );
+/*M*/
+/*M*/ }
+/*M*/
+/*M*/ bValidPrtArea = TRUE;
+/*M*/ }
+
+/*M*/ void SwHeadFootFrm::FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs)
+/*M*/ {
+/*M*/ if ( !HasFixSize() )
+/*M*/ {
+/*M*/ if( !IsColLocked() )
+/*M*/ {
+/*M*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/
+/*M*/ const SwTwips nBorder = nUL;
+/*M*/ SwTwips nMinHeight = lcl_GetFrmMinHeight(*this);
+/*M*/ nMinHeight -= pAttrs->CalcTop();
+/*M*/ nMinHeight -= pAttrs->CalcBottom();
+/*M*/
+/*M*/ if (nMinHeight < 0)
+/*M*/ nMinHeight = 0;
+/*M*/
+/*M*/ ColLock();
+/*M*/
+/*M*/ SwTwips nMaxHeight = LONG_MAX;
+/*M*/ SwTwips nRemaining, nOldHeight;
+/*M*/ Point aOldPos;
+/*M*/
+/*M*/ do
+/*M*/ {
+/*M*/ nOldHeight = Prt().Height();
+/*M*/ SwFrm* pFrm = Lower();
+/*M*/ if( Frm().Pos() != aOldPos && pFrm )
+/*M*/ {
+/*M*/ pFrm->_InvalidatePos();
+/*M*/ aOldPos = Frm().Pos();
+/*M*/ }
+/*M*/ while( pFrm )
+/*M*/ {
+/*M*/ pFrm->Calc();
+/*M*/ pFrm = pFrm->GetNext();
+/*M*/ }
+/*M*/ nRemaining = 0;
+/*M*/ pFrm = Lower();
+/*N*/
+/*M*/ while ( pFrm )
+/*M*/ {
+/*M*/ nRemaining += pFrm->Frm().Height();
+/*M*/
+/*M*/ if( pFrm->IsTxtFrm() &&
+/*M*/ ((SwTxtFrm*)pFrm)->IsUndersized() )
+/*M*/ // Dieser TxtFrm waere gern ein bisschen groesser
+/*M*/ nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight()
+/*M*/ - pFrm->Prt().Height();
+/*M*/ else if( pFrm->IsSctFrm() &&
+/*M*/ ((SwSectionFrm*)pFrm)->IsUndersized() )
+/*M*/ nRemaining += ((SwSectionFrm*)pFrm)->Undersize();
+/*M*/ pFrm = pFrm->GetNext();
+/*M*/ }
+/*M*/ if ( nRemaining < nMinHeight )
+/*M*/ nRemaining = nMinHeight;
+/*M*/
+/*M*/ SwTwips nDiff = nRemaining - nOldHeight;
+/*M*/
+/*M*/ if( !nDiff )
+/*M*/ break;
+/*M*/ if( nDiff < 0 )
+/*M*/ {
+/*M*/ nMaxHeight = nOldHeight;
+/*N*/
+/*M*/ if( nRemaining <= nMinHeight )
+/*M*/ nRemaining = ( nMaxHeight + nMinHeight + 1 ) / 2;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ if (nOldHeight > nMinHeight)
+/*M*/ nMinHeight = nOldHeight;
+/*M*/
+/*M*/ if( nRemaining >= nMaxHeight )
+/*M*/ nRemaining = ( nMaxHeight + nMinHeight + 1 ) / 2;
+/*M*/ }
+/*M*/
+/*M*/ nDiff = nRemaining - nOldHeight;
+/*M*/
+/*M*/ if ( nDiff )
+/*M*/ {
+/*M*/ ColUnlock();
+/*M*/ if ( nDiff > 0 )
+/*M*/ {
+/*N*/ if ( Grow( nDiff PHEIGHT ) )
+/*N*/ {
+/*M*/ pFrm = Lower();
+/*M*/
+/*M*/ while ( pFrm )
+/*M*/ {
+/*M*/ if( pFrm->IsTxtFrm())
+/*M*/ {
+/*M*/ SwTxtFrm * pTmpFrm = (SwTxtFrm*) pFrm;
+/*M*/ if (pTmpFrm->IsUndersized() )
+/*M*/ {
+/*M*/ pTmpFrm->InvalidateSize();
+/*M*/ pTmpFrm->Prepare(PREP_ADJUST_FRM);
+/*M*/ }
+/*M*/ }
+ /* #i3568# Undersized sections need to be
+ invalidated too. */
+/*N*/ else if (pFrm->IsSctFrm())
+/*N*/ {
+/*N*/ SwSectionFrm * pTmpFrm =
+/*N*/ (SwSectionFrm*) pFrm;
+/*N*/ if (pTmpFrm->IsUndersized() )
+/*N*/ {
+/*N*/ pTmpFrm->InvalidateSize();
+/*N*/ pTmpFrm->Prepare(PREP_ADJUST_FRM);
+/*N*/ }
+/*N*/ }
+/*M*/ pFrm = pFrm->GetNext();
+/*M*/ }
+/*N*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ Shrink( -nDiff PHEIGHT );
+/*M*/ //Schnell auf dem kurzen Dienstweg die Position updaten.
+/*M*/
+/*M*/ MakePos();
+/*M*/ ColLock();
+/*M*/ }
+/*M*/ else
+/*M*/ break;
+/*M*/ //Unterkante des Uppers nicht ueberschreiten.
+/*M*/ if ( GetUpper() && Frm().Height() )
+/*M*/ {
+/*M*/ const SwTwips nDeadLine = GetUpper()->Frm().Top() +
+/*M*/ GetUpper()->Prt().Bottom();
+/*M*/ const SwTwips nBot = Frm().Bottom();
+/*M*/ if ( nBot > nDeadLine )
+/*M*/ {
+/*M*/ Frm().Bottom( nDeadLine );
+/*M*/ Prt().SSize().Height() = Frm().Height() - nBorder;
+/*M*/ }
+/*M*/ }
+/*M*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/ } while( nRemaining<=nMaxHeight && nOldHeight!=Prt().Height() );
+/*M*/ ColUnlock();
+/*M*/ }
+/*N*/ bValidSize = bValidPrtArea = TRUE;
+/*M*/ }
+/*M*/ else //if ( GetType() & 0x0018 )
+/*M*/ {
+/*M*/ do
+/*M*/ {
+/*M*/ if ( Frm().Height() != pAttrs->GetSize().Height() )
+/*M*/ ChgSize( Size( Frm().Width(), pAttrs->GetSize().Height()));
+/*M*/ bValidSize = TRUE;
+/*M*/ MakePos();
+/*M*/ } while ( !bValidSize );
+/*M*/ }
+/*M*/ }
+
+/*M*/ void SwHeadFootFrm::Format(const SwBorderAttrs * pAttrs)
+/*M*/ {
+/*M*/ ASSERT( pAttrs, "SwFooterFrm::Format, pAttrs ist 0." );
+/*M*/
+/*M*/ if ( bValidPrtArea && bValidSize )
+/*M*/ return;
+/*M*/
+/*M*/ if ( ! GetEatSpacing() && IsHeaderFrm())
+/*M*/ {
+/*M*/ SwLayoutFrm::Format(pAttrs);
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ lcl_LayoutFrmEnsureMinHeight(*this, pAttrs);
+/*M*/
+/*M*/ long nUL = pAttrs->CalcTop() + pAttrs->CalcBottom();
+/*M*/
+/*M*/ if ( !bValidPrtArea )
+/*M*/ FormatPrt(nUL, pAttrs);
+/*M*/
+/*M*/ if ( !bValidSize )
+/*M*/ FormatSize(nUL, pAttrs);
+/*M*/ }
+/*M*/ }
+
+/*M*/ SwTwips SwHeadFootFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*M*/ {
+/*M*/ SwTwips nResult;
+/*M*/
+/*M*/ if ( IsColLocked() )
+/*M*/ {
+/*M*/ nResult = 0;
+/*M*/ }
+/*M*/ else if (! GetEatSpacing())
+/*M*/ {
+/*M*/ nResult = SwLayoutFrm::GrowFrm(nDist, bTst, bInfo);
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ nResult = 0;
+/*M*/
+/*M*/ SwBorderAttrAccess * pAccess =
+/*M*/ new SwBorderAttrAccess( SwFrm::GetCache(), this );
+/*M*/ ASSERT(pAccess, "no border attributes");
+/*M*/
+/*M*/ SwBorderAttrs * pAttrs = pAccess->Get();
+/*M*/
+ /* First assume the whole amount to grow can be provided by eating
+ spacing. */
+/*M*/ SwTwips nEat = nDist;
+/*M*/ SwTwips nMaxEat;
+/*M*/
+/*M*/ /* calculate maximum eatable spacing */
+/*M*/ if (IsHeaderFrm())
+/*M*/ nMaxEat = aFrm.Height() - aPrt.Bottom() - pAttrs->CalcBottomLine();
+/*M*/ else
+/*M*/ nMaxEat = aPrt.Top() - pAttrs->CalcTopLine();
+/*M*/
+/*M*/ delete pAccess;
+/*M*/
+/*M*/ if (nMaxEat < 0)
+/*M*/ nMaxEat = 0;
+/*M*/
+ /* If the frame is too small, eat less spacing thus letting the frame
+ grow more. */
+/*M*/ SwTwips nMinHeight = lcl_GetFrmMinHeight(*this);
+/*M*/ SwTwips nFrameTooSmall = nMinHeight - Frm().Height();
+/*M*/
+/*M*/ if (nFrameTooSmall > 0)
+/*M*/ nEat -= nFrameTooSmall;
+/*M*/
+/*M*/ /* No negative eating, not eating more than allowed. */
+/*M*/ if (nEat < 0)
+/*M*/ nEat = 0;
+/*M*/ else if (nEat > nMaxEat)
+/*M*/ nEat = nMaxEat;
+/*M*/
+/*N*/ // OD 10.04.2003 #108719# - Notify fly frame, if header frame
+/*N*/ // grows. Consider, that 'normal' grow of layout frame already notifys
+/*N*/ // the fly frames.
+/*N*/ sal_Bool bNotifyFlys = sal_False;
+/*M*/ if (nEat > 0)
+/*M*/ {
+/*M*/ if ( ! bTst)
+/*M*/ {
+/*M*/ if (! IsHeaderFrm())
+/*M*/ {
+/*M*/ aPrt.Top(aPrt.Top() - nEat);
+/*M*/ aPrt.Height(aPrt.Height() - nEat);
+/*M*/ }
+/*M*/
+/*M*/ InvalidateAll();
+/*M*/ }
+/*M*/
+/*M*/ nResult += nEat;
+/*N*/ // OD 14.04.2003 #108719# - trigger fly frame notify.
+/*N*/ if ( IsHeaderFrm() )
+/*N*/ {
+/*N*/ bNotifyFlys = sal_True;
+/*N*/ }
+/*M*/ }
+/*M*/
+/*M*/ if (nDist - nEat > 0)
+/*M*/ {
+/*M*/ SwTwips nFrmGrow =
+/*M*/ SwLayoutFrm::GrowFrm( nDist - nEat, bTst, bInfo );
+/*M*/
+/*M*/ nResult += nFrmGrow;
+/*N*/ if ( nFrmGrow > 0 )
+/*N*/ {
+/*N*/ bNotifyFlys = sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // OD 10.04.2003 #108719# - notify fly frames, if necessary and triggered.
+/*N*/ if ( ( nResult > 0 ) && bNotifyFlys )
+/*N*/ {
+/*N*/ NotifyFlys();
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if ( nResult && !bTst )
+/*M*/ SetCompletePaint();
+/*M*/
+/*M*/ return nResult;
+/*M*/ }
+
+/*M*/ SwTwips SwHeadFootFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*M*/ {
+/*M*/ SwTwips nResult;
+/*M*/
+/*M*/ if ( IsColLocked() )
+/*M*/ {
+/*M*/ nResult = 0;
+/*M*/ }
+/*M*/ else if (! GetEatSpacing())
+/*M*/ {
+/*M*/ nResult = SwLayoutFrm::ShrinkFrm(nDist, bTst, bInfo);
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ nResult = 0;
+/*M*/
+/*M*/ SwTwips nMinHeight = lcl_GetFrmMinHeight(*this);
+/*M*/ SwTwips nOldHeight = Frm().Height();
+/*M*/ SwTwips nRest = 0; // Amount to shrink by spitting out spacing
+/*M*/
+/*M*/ if ( nOldHeight >= nMinHeight )
+/*M*/ {
+ /* If the frame's height is bigger than its minimum height, shrink
+ the frame towards its minimum height. If this is not sufficient
+ to provide the shrinking requested provide the rest by spitting
+ out spacing. */
+/*M*/
+/*M*/ SwTwips nBiggerThanMin = nOldHeight - nMinHeight;
+/*M*/
+/*M*/ if (nBiggerThanMin < nDist)
+/*M*/ {
+/*M*/ nRest = nDist - nBiggerThanMin;
+/*M*/ }
+/*M*/ /* info: declaration of nRest -> else nRest = 0 */
+/*M*/ }
+/*M*/ else
+ /* The frame cannot shrink. Provide shrinking by spitting out
+ spacing. */
+/*M*/ nRest = nDist;
+/*M*/
+ // OD 10.04.2003 #108719# - Notify fly frame, if header/footer frame
+ // shrinks. Consider, that 'normal' shrink of layout frame already notifys
+ // the fly frames.
+/*N*/ sal_Bool bNotifyFlys = sal_False;
+/*M*/ if (nRest > 0)
+/*M*/ {
+/*M*/
+/*M*/ SwBorderAttrAccess * pAccess =
+/*M*/ new SwBorderAttrAccess( SwFrm::GetCache(), this );
+/*M*/ ASSERT(pAccess, "no border attributes");
+/*M*/
+/*M*/ SwBorderAttrs * pAttrs = pAccess->Get();
+/*M*/
+/*M*/ /* minimal height of print area */
+/*M*/ SwTwips nMinPrtHeight = nMinHeight
+/*M*/ - pAttrs->CalcTop()
+/*M*/ - pAttrs->CalcBottom();
+/*M*/
+/*M*/ if (nMinPrtHeight < 0)
+/*M*/ nMinPrtHeight = 0;
+/*M*/
+/*M*/ delete pAccess;
+/*M*/
+/*M*/ /* assume all shrinking can be provided */
+/*M*/ SwTwips nShrink = nRest;
+/*M*/
+/*M*/ /* calculate maximum shrinking */
+/*M*/ SwTwips nMaxShrink = aPrt.Height() - nMinPrtHeight;
+/*M*/
+/*M*/ /* shrink no more than maximum shrinking */
+/*M*/ if (nShrink > nMaxShrink)
+/*M*/ {
+/*M*/ //nRest -= nShrink - nMaxShrink;
+/*M*/ nShrink = nMaxShrink;
+/*M*/ }
+/*M*/
+/*M*/ if (!bTst)
+/*M*/ {
+/*M*/ if (! IsHeaderFrm() )
+/*M*/ {
+/*M*/ aPrt.Top(aPrt.Top() + nShrink);
+/*M*/ aPrt.Height(aPrt.Height() - nShrink);
+/*M*/ }
+/*M*/
+/*M*/ InvalidateAll();
+/*M*/ }
+/*M*/ nResult += nShrink;
+/*N*/ // OD 14.04.2003 #108719# - trigger fly frame notify.
+/*N*/ if ( IsHeaderFrm() )
+/*N*/ {
+/*N*/ bNotifyFlys = sal_True;
+/*N*/ }
+/*M*/ }
+/*M*/
+ /* The shrinking not providable by spitting out spacing has to be done
+ by the frame. */
+/*M*/ if (nDist - nRest > 0)
+/*N*/ {
+/*N*/ SwTwips nShrinkAmount = SwLayoutFrm::ShrinkFrm( nDist - nRest, bTst, bInfo );
+/*N*/ nResult += nShrinkAmount;
+/*N*/ if ( nShrinkAmount > 0 )
+/*N*/ {
+/*N*/ bNotifyFlys = sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // OD 10.04.2003 #108719# - notify fly frames, if necessary.
+/*N*/ if ( ( nResult > 0 ) && bNotifyFlys )
+/*N*/ {
+/*N*/ NotifyFlys();
+/*N*/ }
+/*M*/ }
+/*M*/
+/*M*/ return nResult;
+/*M*/ }
+
+/*M*/ BOOL SwHeadFootFrm::GetEatSpacing() const
+/*M*/ {
+/*M*/ const SwFrmFmt * pFmt = GetFmt();
+/*M*/ ASSERT(pFmt, "SwHeadFootFrm: no format?");
+/*M*/
+/*M*/ if (pFmt->GetHeaderAndFooterEatSpacing().GetValue())
+/*M*/ return TRUE;
+/*M*/
+/*M*/ return FALSE;
+/*M*/ }
+
+
+/*************************************************************************
+|*
+|* SwPageFrm::PrepareHeader()
+|*
+|* Beschreibung Erzeugt oder Entfernt Header
+|* Ersterstellung MA 04. Feb. 93
+|* Letzte Aenderung MA 12. May. 96
+|*
+|*************************************************************************/
+
+
+/*N*/ void DelFlys( SwLayoutFrm *pFrm, SwPageFrm *pPage )
+/*N*/ {
+/*N*/ for ( int i = 0; pPage->GetSortedObjs() &&
+/*N*/ pPage->GetSortedObjs()->Count() &&
+/*N*/ i < (int)pPage->GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pPage->GetSortedObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwVirtFlyDrawObj *pObj = (SwVirtFlyDrawObj*)pO;
+/*N*/ if ( pFrm->IsAnLower( pObj->GetFlyFrm() ) )
+/*N*/ {
+/*?*/ delete pObj->GetFlyFrm();
+/*?*/ --i;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void SwPageFrm::PrepareHeader()
+/*N*/ {
+/*N*/ SwLayoutFrm *pLay = (SwLayoutFrm*)Lower();
+/*N*/ if ( !pLay )
+/*N*/ return;
+/*N*/
+/*N*/ const SwFmtHeader &rH = ((SwFrmFmt*)pRegisteredIn)->GetHeader();
+/*N*/
+/*N*/ const FASTBOOL bOn = !((SwFrmFmt*)pRegisteredIn)->GetDoc()->IsBrowseMode() ||
+/*N*/ ((SwFrmFmt*)pRegisteredIn)->GetDoc()->IsHeadInBrowse();
+/*N*/
+/*N*/ if ( bOn && rH.IsActive() )
+/*N*/ { //Header einsetzen, vorher entfernen falls vorhanden.
+/*N*/ ASSERT( rH.GetHeaderFmt(), "FrmFmt fuer Header nicht gefunden." );
+/*N*/
+/*N*/ if ( pLay->GetFmt() == (SwFrmFmt*)rH.GetHeaderFmt() )
+/*N*/ return; //Der Footer ist bereits der richtige
+/*N*/
+/*N*/ if ( pLay->IsHeaderFrm() )
+/*N*/ { SwLayoutFrm *pDel = pLay;
+/*N*/ pLay = (SwLayoutFrm*)pLay->GetNext();
+/*N*/ ::binfilter::DelFlys( pDel, this );
+/*N*/ pDel->Cut();
+/*N*/ delete pDel;
+/*N*/ }
+/*N*/ ASSERT( pLay, "Wohin mit dem Header?" );
+/*N*/ SwHeaderFrm *pH = new SwHeaderFrm( (SwFrmFmt*)rH.GetHeaderFmt() );
+/*N*/ pH->Paste( this, pLay );
+/*N*/ if ( GetUpper() )
+/*N*/ ::binfilter::RegistFlys( this, pH );
+/*N*/ }
+/*N*/ else if ( pLay && pLay->IsHeaderFrm() )
+/*N*/ { //Header entfernen falls vorhanden.
+/*N*/ ::binfilter::DelFlys( pLay, this );
+/*N*/ pLay->Cut();
+/*N*/ delete pLay;
+/*N*/ }
+/*N*/ }
+/*************************************************************************
+|*
+|* SwPageFrm::PrepareFooter()
+|*
+|* Beschreibung Erzeugt oder Entfernt Footer
+|* Ersterstellung MA 04. Feb. 93
+|* Letzte Aenderung MA 12. May. 96
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwPageFrm::PrepareFooter()
+/*N*/ {
+/*N*/ SwLayoutFrm *pLay = (SwLayoutFrm*)Lower();
+/*N*/ if ( !pLay )
+/*?*/ return;
+/*N*/
+/*N*/ const SwFmtFooter &rF = ((SwFrmFmt*)pRegisteredIn)->GetFooter();
+/*N*/ while ( pLay->GetNext() )
+/*N*/ pLay = (SwLayoutFrm*)pLay->GetNext();
+/*N*/
+/*N*/ const FASTBOOL bOn = !((SwFrmFmt*)pRegisteredIn)->GetDoc()->IsBrowseMode() ||
+/*N*/ ((SwFrmFmt*)pRegisteredIn)->GetDoc()->IsFootInBrowse();
+/*N*/
+/*N*/ if ( bOn && rF.IsActive() )
+/*N*/ { //Footer einsetzen, vorher entfernen falls vorhanden.
+/*N*/ ASSERT( rF.GetFooterFmt(), "FrmFmt fuer Footer nicht gefunden." );
+/*N*/
+/*N*/ if ( pLay->GetFmt() == (SwFrmFmt*)rF.GetFooterFmt() )
+/*?*/ return; //Der Footer ist bereits der richtige.
+/*N*/
+/*N*/ if ( pLay->IsFooterFrm() )
+/*?*/ { ::binfilter::DelFlys( pLay, this );
+/*?*/ pLay->Cut();
+/*?*/ delete pLay;
+/*N*/ }
+/*N*/ SwFooterFrm *pF = new SwFooterFrm( (SwFrmFmt*)rF.GetFooterFmt() );
+/*N*/ pF->Paste( this );
+/*N*/ if ( GetUpper() )
+/*N*/ ::binfilter::RegistFlys( this, pF );
+/*N*/ }
+/*N*/ else if ( pLay && pLay->IsFooterFrm() )
+/*N*/ { //Footer entfernen falls vorhanden.
+/*N*/ ::binfilter::DelFlys( pLay, this );
+/*N*/ ViewShell *pSh;
+/*N*/ if ( pLay->GetPrev() && 0 != (pSh = GetShell()) &&
+/*N*/ pSh->VisArea().HasArea() )
+/*?*/ pSh->InvalidateWindows( pSh->VisArea() );
+/*N*/ pLay->Cut();
+/*N*/ delete pLay;
+/*N*/ }
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_layact.cxx b/binfilter/bf_sw/source/core/layout/sw_layact.cxx
new file mode 100644
index 000000000000..8174b15dbbb2
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_layact.cxx
@@ -0,0 +1,2610 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <time.h>
+#include "pagefrm.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "viewimp.hxx"
+#include "crsrsh.hxx"
+#include "dflyobj.hxx"
+#include "frmtool.hxx"
+#include "dcontact.hxx"
+#include "frmfmt.hxx"
+#include "swregion.hxx"
+#include "viewopt.hxx" // OnlineSpelling ueber Internal-TabPage testen.
+#include "pam.hxx" // OnlineSpelling wg. der aktuellen Cursorposition
+#include "dbg_lay.hxx"
+#include "layouter.hxx" // LoopControlling
+
+#include <ftnidx.hxx>
+
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <bf_svx/brshitem.hxx>
+
+#define _SVSTDARR_BOOLS
+
+#define _LAYACT_CXX
+#include "layact.hxx"
+
+#include <swwait.hxx>
+#include <fmtanchr.hxx>
+#include <bf_sfx2/progress.hxx>
+
+#include "tabfrm.hxx"
+#include "ftnfrm.hxx"
+#include "txtfrm.hxx"
+#include "flyfrms.hxx"
+#include "frmsh.hxx"
+#include "mdiexp.hxx"
+#include "fmtornt.hxx"
+#include "sectfrm.hxx"
+#include <acmplwrd.hxx>
+namespace binfilter {
+
+//#pragma optimize("ity",on)
+
+/*************************************************************************
+|*
+|* SwLayAction Statisches Geraffel
+|*
+|* Ersterstellung MA 22. Dec. 93
+|* Letzte Aenderung MA 22. Dec. 93
+|*
+|*************************************************************************/
+
+/*N*/ #define IS_FLYS (pPage->GetSortedObjs())
+/*N*/ #define IS_INVAFLY (pPage->IsInvalidFly())
+
+
+//Sparen von Schreibarbeit um den Zugriff auf zerstoerte Seiten zu vermeiden.
+/*N*/ #ifdef DBG_UTIL
+
+/*N*/ static void BreakPoint()
+/*N*/ {
+/*N*/ return;
+/*N*/ }
+
+/*N*/ #define CHECKPAGE \
+/*N*/ { if ( IsAgain() ) \
+/*N*/ { BreakPoint(); \
+/*N*/ return; \
+/*N*/ } \
+/*N*/ }
+/*N*/
+/*N*/ #define XCHECKPAGE \
+/*N*/ { if ( IsAgain() ) \
+/*N*/ { BreakPoint(); \
+/*N*/ if( bNoLoop ) \
+/*N*/ pDoc->GetLayouter()->EndLoopControl(); \
+/*N*/ return; \
+/*N*/ } \
+/*N*/ }
+/*N*/ #else
+/*?*/ #define CHECKPAGE \
+/*?*/ { if ( IsAgain() ) \
+/*?*/ return; \
+/*?*/ }
+/*?*/
+/*?*/ #define XCHECKPAGE \
+/*?*/ { if ( IsAgain() ) \
+/*?*/ { \
+/*?*/ if( bNoLoop ) \
+/*?*/ pDoc->GetLayouter()->EndLoopControl(); \
+/*?*/ return; \
+/*?*/ } \
+/*?*/ }
+/*N*/ #endif
+
+/*N*/ #define RESCHEDULE \
+/*N*/ { \
+/*N*/ if ( IsReschedule() ) \
+/*N*/ { \
+/*N*/ if (pProgress) pProgress->Reschedule(); \
+/*N*/ ::binfilter::RescheduleProgress( pImp->GetShell()->GetDoc()->GetDocShell() ); \
+/*N*/ } \
+/*N*/ }
+
+/*N*/ inline ULONG Ticks()
+/*N*/ {
+/*N*/ return 1000 * clock() / CLOCKS_PER_SEC;
+/*N*/ }
+
+/*N*/ void SwLayAction::CheckWaitCrsr()
+/*N*/ {
+/*N*/ RESCHEDULE
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::CheckIdleEnd()
+|*
+|* Ersterstellung MA 12. Aug. 94
+|* Letzte Aenderung MA 24. Jun. 96
+|*
+|*************************************************************************/
+//Ist es wirklich schon soweit...
+/*N*/ inline void SwLayAction::CheckIdleEnd()
+/*N*/ {
+/*N*/ if ( !IsInput() )
+/*N*/ bInput = GetInputType() && Application::AnyInput( GetInputType() );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::SetStatBar()
+|*
+|* Ersterstellung MA 10. Aug. 94
+|* Letzte Aenderung MA 06. Aug. 95
+|*
+|*************************************************************************/
+/*N*/ void SwLayAction::SetStatBar( BOOL bNew )
+/*N*/ {
+/*N*/ if ( bNew )
+/*N*/ {
+/*N*/ nEndPage = pRoot->GetPageNum();
+/*N*/ nEndPage += nEndPage * 10 / 100;
+/*N*/ }
+/*N*/ else
+/*N*/ nEndPage = USHRT_MAX;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::PaintCntnt()
+|*
+|* Beschreibung Je nach Typ wird der Cntnt entsprechend seinen
+|* Veraenderungen ausgegeben bzw. wird die auszugebende Flaeche in der
+|* Region eingetragen.
+|* PaintCntnt: fuellt die Region,
+|* Ersterstellung BP 19. Jan. 92
+|* Letzte Aenderung MA 10. Sep. 96
+|*
+|*************************************************************************/
+/*N*/ BOOL SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwCntntFrm *pCnt,
+/*N*/ const SwPageFrm *pPage )
+/*N*/ {
+/*N*/ SwRegionRects aTmp( rRect );
+/*N*/ const SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*N*/ const SwFlyFrm *pSelfFly = pCnt->FindFlyFrm();
+/*N*/
+ USHORT i=0;
+/*N*/ for ( i = 0; i < rObjs.Count() && aTmp.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ if ( !pO->IsWriterFlyFrame() )
+/*N*/ continue;
+/*N*/
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/
+/*N*/ if ( pFly == pSelfFly || !rRect.IsOver( pFly->Frm() ) )
+/*N*/ continue;
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ BOOL bPaint = FALSE;
+/*N*/ const SwRect *pData = aTmp.GetData();
+/*N*/ for ( i = 0; i < aTmp.Count(); ++pData, ++i )
+/*N*/ bPaint |= pImp->GetShell()->AddPaintRect( *pData );
+/*N*/ return bPaint;
+/*N*/ }
+
+/*N*/ inline BOOL SwLayAction::_PaintCntnt( const SwCntntFrm *pCntnt,
+/*N*/ const SwPageFrm *pPage,
+/*N*/ const SwRect &rRect )
+/*N*/ {
+/*N*/ if ( rRect.HasArea() )
+/*N*/ {
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ return PaintWithoutFlys( rRect, pCntnt, pPage );
+/*N*/ else
+/*N*/ return pImp->GetShell()->AddPaintRect( rRect );
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ void SwLayAction::PaintCntnt( const SwCntntFrm *pCnt,
+/*N*/ const SwPageFrm *pPage,
+/*N*/ const SwRect &rOldRect,
+/*N*/ long nOldBottom )
+/*N*/ {
+/*N*/ SWRECTFN( pCnt )
+/*N*/
+/*N*/ if ( pCnt->IsCompletePaint() || !pCnt->IsTxtFrm() )
+/*N*/ {
+/*N*/ SwRect aPaint( pCnt->PaintArea() );
+/*N*/ // OD 06.11.2002 #104171#,#103931# - paint of old area no longer needed.
+/*N*/ //if( rOldRect.HasArea() )
+/*N*/ // aPaint.Union( rOldRect );
+/*N*/ if ( !_PaintCntnt( pCnt, pPage, aPaint ) )
+/*N*/ pCnt->ResetCompletePaint();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // paint the area between printing bottom and frame bottom and
+/*N*/ // the area left and right beside the frame, if its height changed.
+/*N*/ long nOldHeight = (rOldRect.*fnRect->fnGetHeight)();
+/*N*/ long nNewHeight = (pCnt->Frm().*fnRect->fnGetHeight)();
+/*N*/ const bool bHeightDiff = nOldHeight != nNewHeight;
+/*N*/ if( bHeightDiff )
+/*N*/ {
+/*N*/ // OD 05.11.2002 #94454# - consider whole potential paint area.
+/*N*/ //SwRect aDrawRect( pCnt->UnionFrm( TRUE ) );
+/*N*/ SwRect aDrawRect( pCnt->PaintArea() );
+/*N*/ if( nOldHeight > nNewHeight )
+/*N*/ nOldBottom = (pCnt->*fnRect->fnGetPrtBottom)();
+/*N*/ (aDrawRect.*fnRect->fnSetTop)( nOldBottom );
+/*N*/ _PaintCntnt( pCnt, pPage, aDrawRect );
+/*N*/ }
+/*N*/ // paint content area
+/*N*/ SwRect aPaintRect = static_cast<SwTxtFrm*>(const_cast<SwCntntFrm*>(pCnt))->Paint();
+/*N*/ _PaintCntnt( pCnt, pPage, aPaintRect );
+/*N*/ }
+/*N*/
+/*N*/ if ( pCnt->IsRetouche() && !pCnt->GetNext() )
+/*N*/ {
+/*N*/ const SwFrm *pTmp = pCnt;
+/*N*/ if( pCnt->IsInSct() )
+/*N*/ {
+/*N*/ const SwSectionFrm* pSct = pCnt->FindSctFrm();
+/*N*/ if( pSct->IsRetouche() && !pSct->GetNext() )
+/*N*/ pTmp = pSct;
+/*N*/ }
+/*N*/ SwRect aRect( pTmp->GetUpper()->PaintArea() );
+/*N*/ (aRect.*fnRect->fnSetTop)( (pTmp->*fnRect->fnGetPrtBottom)() );
+/*N*/ if ( !_PaintCntnt( pCnt, pPage, aRect ) )
+/*N*/ pCnt->ResetRetouche();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::_AddScrollRect()
+|*
+|* Ersterstellung MA 04. Mar. 94
+|* Letzte Aenderung MA 04. Mar. 94
+|*
+|*************************************************************************/
+/*N*/ BOOL MA_FASTCALL lcl_IsOverObj( const SwFrm *pFrm, const SwPageFrm *pPage,
+/*N*/ const SwRect &rRect1, const SwRect &rRect2,
+/*N*/ const SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ const SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*N*/ const SwFlyFrm *pSelfFly = pFrm->FindFlyFrm();
+/*N*/ const BOOL bInCnt = pSelfFly && pSelfFly->IsFlyInCntFrm() ? TRUE : FALSE;
+/*N*/
+/*N*/ for ( USHORT j = 0; j < rObjs.Count(); ++j )
+/*N*/ {
+/*N*/ const SdrObject *pObj = rObjs[j];
+/*N*/ const SwRect aRect( pObj->GetBoundRect() );
+/*N*/ if ( !rRect1.IsOver( aRect ) && !rRect2.IsOver( aRect ) )
+/*N*/ continue; //Keine Ueberlappung, der naechste.
+/*N*/
+/*N*/ const SwVirtFlyDrawObj *pFlyObj = pObj->IsWriterFlyFrame() ?
+/*N*/ (SwVirtFlyDrawObj*)pObj : 0;
+/*N*/ const SwFlyFrm *pFly = pFlyObj ? pFlyObj->GetFlyFrm() : 0;
+/*N*/
+/*N*/ //Wenn der Rahmen innerhalb des LayFrm verankert ist, so darf er
+/*N*/ //mitgescrollt werden, wenn er nicht seitlich aus dem Rechteck
+/*N*/ //herausschaut.
+/*N*/ if ( pLay && pFlyObj && pFlyObj->GetFlyFrm()->IsLowerOf( pLay ) )
+/*N*/ {
+/*?*/ if ( pFly->Frm().Left() < rRect1.Left() ||
+/*?*/ pFly->Frm().Right()> rRect1.Right() )
+/*?*/ return TRUE;
+/*?*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ if ( !pSelfFly ) //Nur wenn der Frm in einem Fly steht kann
+/*N*/ return TRUE; //es Einschraenkungen geben.
+/*N*/
+/*?*/ if ( !pFlyObj ) //Keine Einschraenkung fuer Zeichenobjekte.
+/*?*/ return TRUE;
+/*?*/
+/*?*/ if ( pFly != pSelfFly )
+/*?*/ {
+/*?*/ //Flys unter dem eigenen nur dann abziehen, wenn sie innerhalb des
+/*?*/ //eigenen stehen.
+/*?*/ //Fuer inhaltsgebundene Flys alle Flys abziehen fuer die gilt, dass
+/*?*/ //pSelfFly nicht innerhalb von ihnen steht.
+/*?*/ if ( bInCnt )
+/*?*/ {
+/*?*/ const SwFlyFrm *pTmp = pSelfFly->GetAnchor()->FindFlyFrm();
+/*?*/ while ( pTmp )
+/*?*/ {
+/*?*/ if ( pTmp == pFly )
+/*?*/ return FALSE;
+/*?*/ else
+/*?*/ pTmp = pTmp->GetAnchor()->FindFlyFrm();
+/*?*/ }
+/*?*/ } else if ( pObj->GetOrdNum() < pSelfFly->GetVirtDrawObj()->GetOrdNum() )
+/*?*/ {
+/*?*/ const SwFlyFrm *pTmp = pFly;
+/*?*/ do
+/*?*/ { if ( pTmp == pSelfFly )
+/*?*/ return TRUE;
+/*?*/ else
+/*?*/ pTmp = pTmp->GetAnchor()->FindFlyFrm();
+/*?*/ } while ( pTmp );
+/*?*/ } else
+/*?*/ return TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ void SwLayAction::_AddScrollRect( const SwCntntFrm *pCntnt,
+/*N*/ const SwPageFrm *pPage,
+/*N*/ const SwTwips nOfst,
+/*N*/ const SwTwips nOldBottom )
+/*N*/ {
+/*N*/ FASTBOOL bScroll = TRUE;
+/*N*/ SwRect aPaintRect( pCntnt->PaintArea() );
+/*N*/ SWRECTFN( pCntnt )
+/*N*/
+/*N*/ //Wenn altes oder neues Rechteck mit einem Fly ueberlappen, in dem der
+/*N*/ //Cntnt nicht selbst steht, so ist nichts mit Scrollen.
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ SwRect aRect( aPaintRect );
+/*N*/ if( bVert )
+/*?*/ aPaintRect.Pos().X() += nOfst;
+/*N*/ else
+/*N*/ aPaintRect.Pos().Y() -= nOfst;
+/*N*/ if ( ::binfilter::lcl_IsOverObj( pCntnt, pPage, aPaintRect, aRect, 0 ) )
+/*N*/ bScroll = FALSE;
+/*N*/ if( bVert )
+/*?*/ aPaintRect.Pos().X() -= nOfst;
+/*N*/ else
+/*N*/ aPaintRect.Pos().Y() += nOfst;
+/*N*/ }
+/*N*/ if ( bScroll && pPage->GetFmt()->GetBackground().GetGraphicPos() != GPOS_NONE )
+/*N*/ bScroll = FALSE;
+/*N*/
+ // OD 04.11.2002 #94454# - Don't intersect potential paint rectangle with
+ // union of frame and printing area, because at scroll destination position
+ // could be a frame that has filled up the potential paint area.
+ //aPaintRect.Intersection( pCntnt->UnionFrm( TRUE ) );
+
+/*N*/ if ( bScroll )
+/*N*/ {
+/*N*/ if( aPaintRect.HasArea() )
+/*N*/ pImp->GetShell()->AddScrollRect( pCntnt, aPaintRect, nOfst );
+/*N*/ if ( pCntnt->IsRetouche() && !pCntnt->GetNext() )
+/*N*/ {
+/*N*/ SwRect aRect( pCntnt->GetUpper()->PaintArea() );
+/*N*/ (aRect.*fnRect->fnSetTop)( (pCntnt->*fnRect->fnGetPrtBottom)() );
+/*N*/ if ( !pImp->GetShell()->AddPaintRect( aRect ) )
+/*N*/ pCntnt->ResetRetouche();
+/*N*/ }
+/*N*/ pCntnt->ResetCompletePaint();
+/*N*/ }
+/*N*/ else if( aPaintRect.HasArea() )
+/*N*/ {
+/*N*/ if( bVert )
+/*?*/ aPaintRect.Pos().X() += nOfst;
+/*N*/ else
+/*N*/ aPaintRect.Pos().Y() -= nOfst;
+/*N*/ PaintCntnt( pCntnt, pPage, aPaintRect, nOldBottom );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::SwLayAction()
+|*
+|* Ersterstellung MA 30. Oct. 92
+|* Letzte Aenderung MA 09. Jun. 95
+|*
+|*************************************************************************/
+/*N*/ SwLayAction::SwLayAction( SwRootFrm *pRt, SwViewImp *pI ) :
+/*N*/ pRoot( pRt ),
+/*N*/ pImp( pI ),
+/*N*/ pOptTab( 0 ),
+/*N*/ pWait( 0 ),
+/*N*/ nPreInvaPage( USHRT_MAX ),
+/*N*/ nCheckPageNum( USHRT_MAX ),
+/*N*/ nStartTicks( Ticks() ),
+/*N*/ nInputType( 0 ),
+/*N*/ nEndPage( USHRT_MAX ),
+/*N*/ pProgress(NULL)
+/*N*/ {
+/*N*/ bPaintExtraData = ::binfilter::IsExtraData( pImp->GetShell()->GetDoc() );
+/*N*/ bPaint = bComplete = bWaitAllowed = bCheckPages = TRUE;
+/*N*/ bInput = bAgain = bNextCycle = bCalcLayout = bIdle = bReschedule =
+/*N*/ bUpdateExpFlds = bBrowseActionStop = bActionInProgress = FALSE;
+/*N*/ // OD 14.04.2003 #106346# - init new flag <mbFormatCntntOnInterrupt>.
+/*N*/ mbFormatCntntOnInterrupt = sal_False;
+/*N*/
+/*N*/ pImp->pLayAct = this; //Anmelden
+/*N*/ }
+
+/*N*/ SwLayAction::~SwLayAction()
+/*N*/ {
+/*N*/ ASSERT( !pWait, "Wait object not destroyed" );
+/*N*/ pImp->pLayAct = 0; //Abmelden
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::Reset()
+|*
+|* Ersterstellung MA 11. Aug. 94
+|* Letzte Aenderung MA 09. Jun. 95
+|*
+|*************************************************************************/
+/*N*/ void SwLayAction::Reset()
+/*N*/ {
+/*N*/ pOptTab = 0;
+/*N*/ nStartTicks = Ticks();
+/*N*/ nInputType = 0;
+/*N*/ nEndPage = nPreInvaPage = nCheckPageNum = USHRT_MAX;
+/*N*/ bPaint = bComplete = bWaitAllowed = bCheckPages = TRUE;
+/*N*/ bInput = bAgain = bNextCycle = bCalcLayout = bIdle = bReschedule =
+/*N*/ bUpdateExpFlds = bBrowseActionStop = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::RemoveEmptyBrowserPages()
+|*
+|* Ersterstellung MA 10. Sep. 97
+|* Letzte Aenderung MA 10. Sep. 97
+|*
+|*************************************************************************/
+
+/*N*/ BOOL SwLayAction::RemoveEmptyBrowserPages()
+/*N*/ {
+/*N*/ //Beim umschalten vom normalen in den Browsermodus bleiben u.U. einige
+/*N*/ //unangenehm lange stehen. Diese beseiten wir mal schnell.
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if ( pRoot->GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = (SwPageFrm*)pRoot->Lower();
+/*N*/ do
+/*N*/ {
+/*N*/ if ( (pPage->GetSortedObjs() && pPage->GetSortedObjs()->Count()) ||
+/*N*/ pPage->ContainsCntnt() )
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ else
+/*N*/ {
+/*N*/ bRet = TRUE;
+/*N*/ SwPageFrm *pDel = pPage;
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ pDel->Cut();
+/*N*/ delete pDel;
+/*N*/ }
+/*N*/ } while ( pPage );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwLayAction::Action()
+|*
+|* Ersterstellung MA 10. Aug. 94
+|* Letzte Aenderung MA 06. Aug. 95
+|*
+|*************************************************************************/
+/*N*/ void SwLayAction::Action()
+/*N*/ {
+/*N*/ bActionInProgress = TRUE;
+/*N*/ //TurboMode? Disqualifiziert fuer Idle-Format.
+/*N*/ if ( IsPaint() && !IsIdle() && TurboAction() )
+/*N*/ {
+/*N*/ pRoot->ResetTurboFlag();
+/*N*/ bActionInProgress = FALSE;
+/*N*/ pRoot->DeleteEmptySct();
+/*N*/ return;
+/*N*/ }
+/*N*/ else if ( pRoot->GetTurbo() )
+/*N*/ {
+/*N*/ pRoot->DisallowTurbo();
+/*N*/ const SwFrm *pFrm = pRoot->GetTurbo();
+/*N*/ pRoot->ResetTurbo();
+/*N*/ pFrm->InvalidatePage();
+/*N*/ }
+/*N*/ pRoot->DisallowTurbo();
+/*N*/
+/*N*/ if ( IsCalcLayout() )
+/*?*/ SetCheckPages( FALSE );
+/*N*/
+/*N*/ InternalAction();
+/*N*/ bAgain |= RemoveEmptyBrowserPages();
+/*N*/ while ( IsAgain() )
+/*N*/ {
+/*N*/ bAgain = bNextCycle = FALSE;
+/*N*/ InternalAction();
+/*N*/ bAgain |= RemoveEmptyBrowserPages();
+/*N*/ }
+/*N*/ pRoot->DeleteEmptySct();
+/*N*/
+/*N*/ //Turbo-Action ist auf jedenfall wieder erlaubt.
+/*N*/ pRoot->ResetTurboFlag();
+/*N*/ pRoot->ResetTurbo();
+/*N*/
+/*N*/ if ( IsInput() )
+/*N*/ pImp->GetShell()->SetNoNextScroll();
+/*N*/ SetCheckPages( TRUE );
+/*N*/ bActionInProgress = FALSE;
+/*N*/ }
+
+/*N*/ SwPageFrm *SwLayAction::CheckFirstVisPage( SwPageFrm *pPage )
+/*N*/ {
+/*N*/ SwCntntFrm *pCnt = pPage->FindFirstBodyCntnt();
+/*N*/ SwCntntFrm *pChk = pCnt;
+/*N*/ BOOL bPageChgd = FALSE;
+/*N*/ while ( pCnt && pCnt->IsFollow() )
+/*?*/ pCnt = (SwCntntFrm*)pCnt->FindPrev();
+/*N*/ if ( pCnt && pChk != pCnt )
+/*?*/ { bPageChgd = TRUE;
+/*?*/ pPage = pCnt->FindPageFrm();
+/*N*/ }
+/*N*/
+/*N*/ if ( pPage->GetFmt()->GetDoc()->GetFtnIdxs().Count() )
+/*N*/ {
+/*N*/ SwFtnContFrm *pCont = pPage->FindFtnCont();
+/*N*/ if ( pCont )
+/*N*/ {
+/*N*/ pCnt = pCont->ContainsCntnt();
+/*N*/ pChk = pCnt;
+/*N*/ while ( pCnt && pCnt->IsFollow() )
+/*?*/ pCnt = (SwCntntFrm*)pCnt->FindPrev();
+/*N*/ if ( pCnt && pCnt != pChk )
+/*N*/ {
+/*?*/ if ( bPageChgd )
+/*?*/ {
+/*?*/ //Die 'oberste' Seite benutzten.
+/*?*/ SwPageFrm *pTmp = pCnt->FindPageFrm();
+/*?*/ if ( pPage->GetPhyPageNum() > pTmp->GetPhyPageNum() )
+/*?*/ pPage = pTmp;
+/*?*/ }
+/*?*/ else
+/*?*/ pPage = pCnt->FindPageFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pPage;
+/*N*/ }
+
+/*N*/ void SwLayAction::InternalAction()
+/*N*/ {
+/*N*/ ASSERT( pRoot->Lower()->IsPageFrm(), ":-( Keine Seite unterhalb der Root.");
+/*N*/
+/*N*/ pRoot->Calc();
+/*N*/
+/*N*/ //Die erste ungueltige bzw. zu formatierende Seite ermitteln.
+/*N*/ //Bei einer Complete-Action ist es die erste ungueltige; mithin ist die
+/*N*/ //erste zu formatierende Seite diejenige Seite mit der Numemr eins.
+/*N*/ //Bei einer Luegen-Formatierung ist die Nummer der erste Seite die Nummer
+/*N*/ //der ersten Sichtbaren Seite.
+/*N*/ SwPageFrm *pPage = IsComplete() ? (SwPageFrm*)pRoot->Lower() :
+/*N*/ pImp->GetFirstVisPage();
+/*N*/ if ( !pPage )
+/*?*/ pPage = (SwPageFrm*)pRoot->Lower();
+/*N*/
+/*N*/ //Wenn ein "Erster-Fliess-Cntnt" innerhalb der der ersten sichtbaren Seite
+/*N*/ //ein Follow ist, so schalten wir die Seite zurueck auf den Ur-Master dieses
+/*N*/ //Cntnt's
+/*N*/ if ( !IsComplete() )
+/*N*/ pPage = CheckFirstVisPage( pPage );
+/*N*/ USHORT nFirstPageNum = pPage->GetPhyPageNum();
+/*N*/
+/*N*/ while ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/
+/*N*/ SwDoc* pDoc = pRoot->GetFmt()->GetDoc();
+/*N*/ BOOL bNoLoop = pPage ? SwLayouter::StartLoopControl( pDoc, pPage ) : NULL;
+/*N*/ USHORT nPercentPageNum = 0;
+/*N*/ while ( (pPage && !IsInterrupt()) || nCheckPageNum != USHRT_MAX )
+/*N*/ {
+/*N*/ if ( !pPage && nCheckPageNum != USHRT_MAX &&
+/*N*/ (!pPage || pPage->GetPhyPageNum() >= nCheckPageNum) )
+/*N*/ {
+/*?*/ if ( !pPage || pPage->GetPhyPageNum() > nCheckPageNum )
+/*?*/ {
+/*?*/ SwPageFrm *pPg = (SwPageFrm*)pRoot->Lower();
+/*?*/ while ( pPg && pPg->GetPhyPageNum() < nCheckPageNum )
+/*?*/ pPg = (SwPageFrm*)pPg->GetNext();
+/*?*/ if ( pPg )
+/*?*/ pPage = pPg;
+/*?*/ if ( !pPage )
+/*?*/ break;
+/*?*/ }
+/*?*/ SwPageFrm *pTmp = pPage->GetPrev() ?
+/*?*/ (SwPageFrm*)pPage->GetPrev() : pPage;
+/*?*/ SetCheckPages( TRUE );
+/*?*/ SwFrm::CheckPageDescs( pPage );
+/*?*/ SetCheckPages( FALSE );
+/*?*/ nCheckPageNum = USHRT_MAX;
+/*?*/ pPage = pTmp;
+/*?*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ #ifdef MA_DEBUG
+/*?*/ static USHORT nStop = USHRT_MAX;
+/*?*/ if ( pPage->GetPhyPageNum() == nStop )
+/*?*/ {
+/*?*/ int bla = 5;
+/*?*/ }
+/*?*/ Window *pWin = pImp->GetShell()->GetWin();
+/*?*/ if ( pWin )
+/*?*/ {
+/*?*/ pWin->Push( PUSH_FILLCOLOR );
+/*?*/ pWin->SetFillColor( COL_WHITE );
+/*?*/ Point aOfst( pImp->GetShell()->VisArea().Pos() );
+/*?*/ pWin->DrawRect( Rectangle( aOfst, Size( 2000, 1000 )));
+/*?*/ pWin->DrawText( Point( 500, 500 ) + aOfst, pPage->GetPhyPageNum() );
+/*?*/ pWin->Pop();
+/*?*/ }
+/*N*/ #endif
+/*N*/ if ( nEndPage != USHRT_MAX && pPage->GetPhyPageNum() > nPercentPageNum )
+/*N*/ {
+/*?*/ nPercentPageNum = pPage->GetPhyPageNum();
+/*?*/ ::binfilter::SetProgressState( nPercentPageNum, pImp->GetShell()->GetDoc()->GetDocShell());
+/*N*/ }
+/*N*/ pOptTab = 0;
+/*N*/ //Kein ShortCut fuer Idle oder CalcLayout
+/*N*/ if ( !IsIdle() && !IsComplete() && IsShortCut( pPage ) )
+/*N*/ {
+/*N*/ pRoot->DeleteEmptySct();
+/*N*/ XCHECKPAGE;
+/*N*/ if ( !IsInterrupt() &&
+/*N*/ (pRoot->IsSuperfluous() || pRoot->IsAssertFlyPages()) )
+/*N*/ {
+/*N*/ if ( pRoot->IsAssertFlyPages() )
+/*N*/ pRoot->AssertFlyPages();
+/*N*/ if ( pRoot->IsSuperfluous() )
+/*N*/ {
+/*N*/ BOOL bOld = IsAgain();
+/*N*/ pRoot->RemoveSuperfluous();
+/*N*/ bAgain = bOld;
+/*N*/ }
+/*N*/ if ( IsAgain() )
+/*N*/ {
+/*?*/ if( bNoLoop )
+/*?*/ pDoc->GetLayouter()->EndLoopControl();
+/*?*/ return;
+/*N*/ }
+/*N*/ pPage = (SwPageFrm*)pRoot->Lower();
+/*N*/ while ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ while ( pPage && pPage->GetNext() &&
+/*N*/ pPage->GetPhyPageNum() < nFirstPageNum )
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ continue;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pRoot->DeleteEmptySct();
+/*N*/ XCHECKPAGE;
+/*N*/ //Erst das Layout der Seite formatieren. Erst wenn das Layout
+/*N*/ //stabil ist lohnt sich die Inhaltsformatiertung.
+/*N*/ //Wenn durch die Inhaltsformatierung das Layout wieder ungueltig
+/*N*/ //wird, so wird die Inhaltsformatierung abgebrochen und das
+/*N*/ //Layout wird wieder stabilisiert.
+/*N*/ //Keine Angst: im Normafall kommt es nicht zu Oszillationen.
+/*N*/ //Das Spielchen spielen wir zweimal. erst fuer die Flys, dann
+/*N*/ //fuer den Rest.
+/*N*/ //Die Flys haben Vorrang, d.h. wenn sich an den Flys waehrend der
+/*N*/ //Formatierung des Bodys etwas aendert wird die Body-Formatierung
+/*N*/ //unterbrochen und wieder bei den Flys angefangen.
+/*N*/
+/*N*/ while ( !IsInterrupt() && !IsNextCycle() &&
+/*N*/ ((IS_FLYS && IS_INVAFLY) || pPage->IsInvalid()) )
+/*N*/ {
+/*N*/ USHORT nLoop = 0; // Loop control
+/*N*/ while ( !IsInterrupt() && IS_INVAFLY && IS_FLYS )
+/*N*/ {
+/*N*/ XCHECKPAGE;
+/*N*/ if ( pPage->IsInvalidFlyLayout() )
+/*N*/ {
+/*N*/ pPage->ValidateFlyLayout();
+/*N*/ FormatFlyLayout( pPage );
+/*N*/ XCHECKPAGE;
+/*N*/ }
+/*N*/ if ( pPage->IsInvalidFlyCntnt() && IS_FLYS )
+/*N*/ {
+/*N*/ pPage->ValidateFlyCntnt();
+/*N*/ // More than 20 calls of this function are enough,
+/*N*/ // then we disallow the shrinking of fly frames.
+/*N*/ if ( !FormatFlyCntnt( pPage, nLoop > 20 ) )
+/*N*/ { XCHECKPAGE;
+/*N*/ pPage->InvalidateFlyCntnt();
+/*N*/ }
+/*N*/ }
+/*N*/ ++nLoop; // Loop count
+/*N*/ }
+/*N*/ if ( !IS_FLYS )
+/*N*/ {
+/*N*/ //Wenn keine Flys (mehr) da sind, sind die Flags
+/*N*/ //mehr als fluessig.
+/*N*/ pPage->ValidateFlyLayout();
+/*N*/ pPage->ValidateFlyCntnt();
+/*N*/ }
+/*N*/ while ( !IsInterrupt() && !IsNextCycle() && pPage->IsInvalid() &&
+/*N*/ (!IS_FLYS || (IS_FLYS && !IS_INVAFLY)) )
+/*N*/ {
+/*N*/ PROTOCOL( pPage, PROT_FILE_INIT, 0, 0)
+/*N*/ XCHECKPAGE;
+/*N*/ while ( !IsNextCycle() && pPage->IsInvalidLayout() )
+/*N*/ {
+/*N*/ pPage->ValidateLayout();
+/*N*/ FormatLayout( pPage );
+/*N*/ XCHECKPAGE;
+/*N*/ }
+/*N*/ if ( !IsNextCycle() && pPage->IsInvalidCntnt() &&
+/*N*/ (!IS_FLYS || (IS_FLYS && !IS_INVAFLY)) )
+/*N*/ {
+/*N*/ pPage->ValidateFlyInCnt();
+/*N*/ pPage->ValidateCntnt();
+/*N*/ if ( !FormatCntnt( pPage ) )
+/*N*/ {
+/*N*/ XCHECKPAGE;
+/*N*/ pPage->InvalidateCntnt();
+/*N*/ pPage->InvalidateFlyInCnt();
+/*N*/ if ( IsBrowseActionStop() )
+/*?*/ bInput = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ if( bNoLoop )
+/*N*/ pDoc->GetLayouter()->LoopControl( pPage, LOOP_PAGE );
+/*N*/
+/*N*/ }
+/*N*/ }
+/*N*/ //Eine vorige Seite kann wieder invalid sein.
+/*N*/ XCHECKPAGE;
+/*N*/ if ( !IS_FLYS )
+/*N*/ {
+/*N*/ //Wenn keine Flys (mehr) da sind, sind die Flags
+/*N*/ //mehr als fluessig.
+/*N*/ pPage->ValidateFlyLayout();
+/*N*/ pPage->ValidateFlyCntnt();
+/*N*/ }
+/*N*/ if ( !IsInterrupt() )
+/*N*/ {
+/*N*/ SetNextCycle( FALSE );
+/*N*/
+/*N*/ if ( nPreInvaPage != USHRT_MAX )
+/*N*/ {
+/*N*/ if( !IsComplete() && nPreInvaPage + 2 < nFirstPageNum )
+/*N*/ {
+/*?*/ pImp->SetFirstVisPageInvalid();
+/*?*/ SwPageFrm *pTmpPage = pImp->GetFirstVisPage();
+/*?*/ nFirstPageNum = pTmpPage->GetPhyPageNum();
+/*?*/ if( nPreInvaPage < nFirstPageNum )
+/*?*/ {
+/*?*/ nPreInvaPage = nFirstPageNum;
+/*?*/ pPage = pTmpPage;
+/*?*/ }
+/*N*/ }
+/*N*/ while ( pPage->GetPrev() && pPage->GetPhyPageNum() > nPreInvaPage )
+/*N*/ pPage = (SwPageFrm*)pPage->GetPrev();
+/*N*/ nPreInvaPage = USHRT_MAX;
+/*N*/ }
+/*N*/
+/*N*/ //Ist eine Vorseite invalid?
+/*N*/ while ( pPage->GetPrev() &&
+/*N*/ ( ((SwPageFrm*)pPage->GetPrev())->IsInvalid() ||
+/*N*/ ( ((SwPageFrm*)pPage->GetPrev())->GetSortedObjs() &&
+/*N*/ ((SwPageFrm*)pPage->GetPrev())->IsInvalidFly())) &&
+/*N*/ (((SwPageFrm*)pPage->GetPrev())->GetPhyPageNum() >=
+/*N*/ nFirstPageNum) )
+/*N*/ {
+/*N*/ pPage = (SwPageFrm*)pPage->GetPrev();
+/*N*/ }
+/*N*/ //Weiter bis zur naechsten invaliden Seite.
+/*N*/ while ( pPage && !pPage->IsInvalid() &&
+/*N*/ (!IS_FLYS || (IS_FLYS && !IS_INVAFLY)) )
+/*N*/ {
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ }
+/*N*/ if( bNoLoop )
+/*N*/ pDoc->GetLayouter()->LoopControl( pPage, LOOP_PAGE );
+/*N*/ }
+/*N*/ CheckIdleEnd();
+/*N*/ }
+/*N*/ if ( !pPage && !IsInterrupt() &&
+/*N*/ (pRoot->IsSuperfluous() || pRoot->IsAssertFlyPages()) )
+/*N*/ {
+/*N*/ if ( pRoot->IsAssertFlyPages() )
+/*N*/ pRoot->AssertFlyPages();
+/*N*/ if ( pRoot->IsSuperfluous() )
+/*N*/ {
+/*N*/ BOOL bOld = IsAgain();
+/*N*/ pRoot->RemoveSuperfluous();
+/*N*/ bAgain = bOld;
+/*N*/ }
+/*N*/ if ( IsAgain() )
+/*N*/ {
+/*?*/ if( bNoLoop )
+/*?*/ pDoc->GetLayouter()->EndLoopControl();
+/*?*/ return;
+/*N*/ }
+/*N*/ pPage = (SwPageFrm*)pRoot->Lower();
+/*N*/ while ( pPage && !pPage->IsInvalid() && !pPage->IsInvalidFly() )
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ while ( pPage && pPage->GetNext() &&
+/*N*/ pPage->GetPhyPageNum() < nFirstPageNum )
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( IsInterrupt() && pPage )
+/*N*/ {
+/*N*/ //Wenn ein Input anliegt wollen wir keinen Inhalt mehr Formatieren,
+/*N*/ //Das Layout muessen wir aber schon in Ordnung bringen.
+/*N*/ //Andernfalls kann folgende Situation auftreten (Bug: 3244):
+/*N*/ //Am Ende des Absatz der letzten Seite wird Text eingegeben, so das
+/*N*/ //der Absatz einen Follow fuer die nachste Seite erzeugt, ausserdem
+/*N*/ //wird gleich schnell weitergetippt - Es liegt waehrend der
+/*N*/ //Verarbeitung ein Input an. Der Absatz auf der neuen Seite wurde
+/*N*/ //bereits anformatiert, die neue Seite ist Formatiert und steht
+/*N*/ //auf CompletePaint, hat sich aber noch nicht im Auszugebenden Bereich
+/*N*/ //eingetragen. Es wird gepaintet, das CompletePaint der Seite wird
+/*N*/ //zurueckgesetzt weil der neue Absatz sich bereits eingetragen hatte,
+/*N*/ //aber die Raender der Seite werden nicht gepaintet. Naja, bei der
+/*N*/ //zwangslaeufig auftretenden naechsten LayAction traegt sich die Seite
+/*N*/ //nicht mehr ein, weil ihre (LayoutFrm-)Flags bereits zurueckgesetzt
+/*N*/ //wurden -- Der Rand der Seite wird nie gepaintet.
+/*N*/ SwPageFrm *pPg = pPage;
+/*N*/ XCHECKPAGE;
+/*N*/ const SwRect &rVis = pImp->GetShell()->VisArea();
+/*N*/
+/*N*/ while( pPg && pPg->Frm().Bottom() < rVis.Top() )
+/*?*/ pPg = (SwPageFrm*)pPg->GetNext();
+/*N*/ if( pPg != pPage )
+/*?*/ pPg = pPg ? (SwPageFrm*)pPg->GetPrev() : pPage;
+/*N*/
+/*N*/ // OD 14.04.2003 #106346# - set flag for interrupt content formatting
+/*N*/ mbFormatCntntOnInterrupt = IsInput() && !IsStopPrt();
+/*N*/ long nBottom = rVis.Bottom();
+/*N*/ while ( pPg && pPg->Frm().Top() < nBottom )
+/*N*/ {
+/*N*/ XCHECKPAGE;
+/*N*/ // OD 14.04.2003 #106346# - special case: interrupt content formatting
+/*N*/ while ( ( mbFormatCntntOnInterrupt &&
+/*N*/ pPg->IsInvalid() &&
+/*N*/ (!IS_FLYS || (IS_FLYS && !IS_INVAFLY))
+/*N*/ ) ||
+/*N*/ ( !mbFormatCntntOnInterrupt && pPg->IsInvalidLayout() )
+/*N*/ )
+/*N*/ {
+/*?*/ XCHECKPAGE;
+/*?*/ while ( pPg->IsInvalidLayout() )
+/*?*/ {
+/*?*/ pPg->ValidateLayout();
+/*?*/ FormatLayout( pPg );
+/*?*/ XCHECKPAGE;
+/*?*/ }
+/*N*/ if ( mbFormatCntntOnInterrupt &&
+/*N*/ pPg->IsInvalidCntnt() &&
+/*N*/ (!IS_FLYS || (IS_FLYS && !IS_INVAFLY))
+/*N*/ )
+/*N*/ {
+/*N*/ pPg->ValidateFlyInCnt();
+/*N*/ pPg->ValidateCntnt();
+/*N*/ if ( !FormatCntnt( pPg ) )
+/*N*/ {
+/*N*/ XCHECKPAGE;
+/*N*/ pPg->InvalidateCntnt();
+/*N*/ pPg->InvalidateFlyInCnt();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*?*/ pPg = (SwPageFrm*)pPg->GetNext();
+/*N*/ }
+/*N*/ // OD 14.04.2003 #106346# - reset flag for special interrupt content formatting.
+/*N*/ mbFormatCntntOnInterrupt = sal_False;
+/*N*/ }
+/*N*/ pOptTab = 0;
+/*N*/ if( bNoLoop )
+/*N*/ pDoc->GetLayouter()->EndLoopControl();
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayAction::TurboAction(), _TurboAction()
+|*
+|* Ersterstellung MA 04. Dec. 92
+|* Letzte Aenderung MA 15. Aug. 93
+|*
+|*************************************************************************/
+/*N*/ BOOL SwLayAction::_TurboAction( const SwCntntFrm *pCnt )
+/*N*/ {
+/*N*/
+/*N*/ const SwPageFrm *pPage = 0;
+/*N*/ if ( !pCnt->IsValid() || pCnt->IsCompletePaint() || pCnt->IsRetouche() )
+/*N*/ {
+/*N*/ const SwRect aOldRect( pCnt->UnionFrm( TRUE ) );
+/*N*/ const long nOldBottom = pCnt->Frm().Top() + pCnt->Prt().Bottom();
+/*N*/ pCnt->Calc();
+/*N*/ if ( pCnt->Frm().Bottom() < aOldRect.Bottom() )
+/*N*/ pCnt->SetRetouche();
+/*N*/
+/*N*/ pPage = pCnt->FindPageFrm();
+/*N*/ PaintCntnt( pCnt, pPage, aOldRect, nOldBottom );
+/*N*/
+/*N*/ if ( !pCnt->GetValidLineNumFlag() && pCnt->IsTxtFrm() )
+/*N*/ {
+/*N*/ const ULONG nAllLines = ((SwTxtFrm*)pCnt)->GetAllLines();
+/*N*/ ((SwTxtFrm*)pCnt)->RecalcAllLines();
+/*N*/ if ( nAllLines != ((SwTxtFrm*)pCnt)->GetAllLines() )
+/*N*/ {
+/*N*/ if ( IsPaintExtraData() )
+/*?*/ pImp->GetShell()->AddPaintRect( pCnt->Frm() );
+/*N*/ //Damit die restlichen LineNums auf der Seite bereichnet werden
+/*N*/ //und nicht hier abgebrochen wird.
+/*N*/ //Das im RecalcAllLines zu erledigen waere teuer, weil dort
+/*N*/ //auch in unnoetigen Faellen (normale Action) auch immer die
+/*N*/ //Seite benachrichtigt werden muesste.
+/*N*/ const SwCntntFrm *pNxt = pCnt->GetNextCntntFrm();
+/*N*/ while ( pNxt &&
+/*N*/ (pNxt->IsInTab() || pNxt->IsInDocBody() != pCnt->IsInDocBody()) )
+/*N*/ pNxt = pNxt->GetNextCntntFrm();
+/*N*/ if ( pNxt )
+/*N*/ pNxt->InvalidatePage();
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if ( pPage->IsInvalidLayout() || (IS_FLYS && IS_INVAFLY) )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if ( !pPage )
+/*?*/ pPage = pCnt->FindPageFrm();
+/*N*/ //Die im Absatz verankerten Flys wollen auch beachtet werden.
+/*N*/ if ( pPage->IsInvalidFlyInCnt() && pCnt->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs *pObjs = pCnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < pObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pObjs)[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->IsFlyInCntFrm() && ((SwFlyInCntFrm*)pFly)->IsInvalid() )
+/*N*/ {
+/*N*/ FormatFlyInCnt( (SwFlyInCntFrm*)pFly );
+/*N*/ pObjs = pCnt->GetDrawObjs();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pPage->IsInvalidCntnt() )
+/*N*/ return FALSE;
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL SwLayAction::TurboAction()
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/
+/*N*/ if ( pRoot->GetTurbo() )
+/*N*/ {
+/*N*/ if ( !_TurboAction( pRoot->GetTurbo() ) )
+/*N*/ {
+/*N*/ CheckIdleEnd();
+/*N*/ bRet = FALSE;
+/*N*/ }
+/*N*/ pRoot->ResetTurbo();
+/*N*/ }
+/*N*/ else
+/*N*/ bRet = FALSE;
+/*N*/ return bRet;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayAction::IsShortCut()
+|*
+|* Beschreibung: Liefert ein True, wenn die Seite vollstaendig unter
+|* oder rechts neben dem sichbaren Bereich liegt.
+|* Es kann passieren, dass sich die Verhaeltnisse derart aendern, dass
+|* die Verarbeitung (des Aufrufers!) mit der Vorgaengerseite der
+|* uebergebenen Seite weitergefuehrt werden muss. Der Paramter wird also
+|* ggf. veraendert!
+|* Fuer den BrowseMode kann auch dann der ShortCut aktiviert werden,
+|* wenn der ungueltige Inhalt der Seite unterhalb des sichbaren
+|* bereiches liegt.
+|* Ersterstellung MA 30. Oct. 92
+|* Letzte Aenderung MA 18. Jul. 96
+|*
+|*************************************************************************/
+/*N*/ const SwFrm *lcl_FindFirstInvaLay( const SwFrm *pFrm, long nBottom )
+/*N*/ {
+/*N*/ ASSERT( pFrm->IsLayoutFrm(), "FindFirstInvaLay, no LayFrm" );
+/*N*/
+/*N*/ if ( !pFrm->IsValid() || pFrm->IsCompletePaint() &&
+/*N*/ pFrm->Frm().Top() < nBottom )
+/*N*/ return pFrm;
+/*N*/ pFrm = ((SwLayoutFrm*)pFrm)->Lower();
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ if ( pFrm->IsLayoutFrm() )
+/*N*/ {
+/*N*/ if ( !pFrm->IsValid() || pFrm->IsCompletePaint() &&
+/*N*/ pFrm->Frm().Top() < nBottom )
+/*N*/ return pFrm;
+/*N*/ const SwFrm *pTmp;
+/*N*/ if ( 0 != (pTmp = ::binfilter::lcl_FindFirstInvaLay( pFrm, nBottom )) )
+/*N*/ return pTmp;
+/*N*/ }
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ const SwFrm *lcl_FindFirstInvaCntnt( const SwLayoutFrm *pLay, long nBottom,
+/*N*/ const SwCntntFrm *pFirst )
+/*N*/ {
+/*N*/ const SwCntntFrm *pCnt = pFirst ? pFirst->GetNextCntntFrm() :
+/*N*/ pLay->ContainsCntnt();
+/*N*/ while ( pCnt )
+/*N*/ {
+/*N*/ if ( !pCnt->IsValid() || pCnt->IsCompletePaint() )
+/*N*/ {
+/*N*/ if ( pCnt->Frm().Top() <= nBottom )
+/*N*/ return pCnt;
+/*N*/ }
+/*N*/
+/*N*/ if ( pCnt->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs &rObjs = *pCnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ const SdrObject *pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ const SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*N*/ if ( ((SwFlyInCntFrm*)pFly)->IsInvalid() ||
+/*N*/ pFly->IsCompletePaint() )
+/*N*/ {
+/*N*/ if ( pFly->Frm().Top() <= nBottom )
+/*N*/ return pFly;
+/*N*/ }
+/*N*/ const SwFrm *pFrm = lcl_FindFirstInvaCntnt( pFly, nBottom, 0 );
+/*N*/ if ( pFrm && pFrm->Frm().Bottom() <= nBottom )
+/*N*/ return pFrm;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pCnt->Frm().Top() > nBottom && !pCnt->IsInTab() )
+/*N*/ return 0;
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ if ( !pLay->IsAnLower( pCnt ) )
+/*N*/ break;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ const SwFrm *lcl_FindFirstInvaFly( const SwPageFrm *pPage, long nBottom )
+/*N*/ {
+/*N*/ ASSERT( pPage->GetSortedObjs(), "FindFirstInvaFly, no Flys" )
+/*N*/
+/*N*/ for ( USHORT i = 0; i < pPage->GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pPage->GetSortedObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->Frm().Top() <= nBottom )
+/*N*/ {
+/*N*/ if ( pFly->IsInvalid() || pFly->IsCompletePaint() )
+/*N*/ return pFly;
+/*N*/
+/*N*/ const SwFrm *pTmp;
+/*N*/ if ( 0 != (pTmp = lcl_FindFirstInvaCntnt( pFly, nBottom, 0 )) &&
+/*N*/ pTmp->Frm().Top() <= nBottom )
+/*N*/ return pTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ BOOL SwLayAction::IsShortCut( SwPageFrm *&prPage )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ const FASTBOOL bBrowse = pRoot->GetFmt()->GetDoc()->IsBrowseMode();
+/*N*/
+/*N*/ //Wenn die Seite nicht Gueltig ist wird sie schnell formatiert, sonst
+/*N*/ //gibts nix als Aerger.
+/*N*/ if ( !prPage->IsValid() )
+/*N*/ {
+/*N*/ if ( bBrowse )
+/*N*/ {
+ /// OD 15.10.2002 #103517# - format complete page
+ /// Thus, loop on all lowers of the page <prPage>, instead of only
+ /// format its first lower.
+ /// NOTE: In online layout (bBrowse == TRUE) a page can contain
+ /// a header frame and/or a footer frame beside the body frame.
+/*N*/ prPage->Calc();
+/*N*/ SwFrm* pPageLowerFrm = prPage->Lower();
+/*N*/ while ( pPageLowerFrm )
+/*N*/ {
+/*N*/ pPageLowerFrm->Calc();
+/*N*/ pPageLowerFrm = pPageLowerFrm->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ FormatLayout( prPage );
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ const SwRect &rVis = pImp->GetShell()->VisArea();
+/*N*/ if ( (prPage->Frm().Top() >= rVis.Bottom()) ||
+/*N*/ (prPage->Frm().Left()>= rVis.Right()) )
+/*N*/ {
+/*N*/ bRet = TRUE;
+/*N*/
+/*N*/ //Jetzt wird es ein bischen unangenehm: Der erste CntntFrm dieser Seite
+/*N*/ //im Bodytext muss Formatiert werden, wenn er dabei die Seite
+/*N*/ //wechselt, muss ich nochmal eine Seite zuvor anfangen, denn
+/*N*/ //es wurde ein PageBreak verarbeitet.
+/*N*/ //Noch unangenehmer: Der naechste CntntFrm ueberhaupt muss
+/*N*/ //Formatiert werden, denn es kann passieren, dass kurzfristig
+/*N*/ //leere Seiten existieren (Bsp. Absatz ueber mehrere Seiten
+/*N*/ //wird geloescht oder verkleinert).
+/*N*/
+/*N*/ //Ist fuer den Browser uninteressant, wenn der letzte Cnt davor bereits
+/*N*/ //nicht mehr sichbar ist.
+/*N*/
+/*N*/ const SwPageFrm *p2ndPage = prPage;
+/*N*/ const SwCntntFrm *pCntnt;
+/*N*/ const SwLayoutFrm* pBody = p2ndPage->FindBodyCont();
+/*N*/ if( p2ndPage->IsFtnPage() && pBody )
+/*?*/ pBody = (SwLayoutFrm*)pBody->GetNext();
+/*N*/ pCntnt = pBody ? pBody->ContainsCntnt() : 0;
+/*N*/ while ( p2ndPage && !pCntnt )
+/*N*/ {
+/*N*/ p2ndPage = (SwPageFrm*)p2ndPage->GetNext();
+/*N*/ if( p2ndPage )
+/*N*/ {
+/*N*/ pBody = p2ndPage->FindBodyCont();
+/*N*/ if( p2ndPage->IsFtnPage() && pBody )
+/*?*/ pBody = (SwLayoutFrm*)pBody->GetNext();
+/*N*/ pCntnt = pBody ? pBody->ContainsCntnt() : 0;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pCntnt )
+/*N*/ {
+/*N*/ FASTBOOL bTstCnt = TRUE;
+/*N*/ if ( bBrowse )
+/*N*/ {
+/*N*/ //Der Cnt davor schon nicht mehr sichtbar?
+/*N*/ const SwFrm *pLst = pCntnt;
+/*N*/ if ( pLst->IsInTab() )
+/*?*/ pLst = pCntnt->FindTabFrm();
+/*N*/ if ( pLst->IsInSct() )
+/*?*/ pLst = pCntnt->FindSctFrm();
+/*N*/ pLst = pLst->FindPrev();
+/*N*/ if ( pLst &&
+/*N*/ (pLst->Frm().Top() >= rVis.Bottom() ||
+/*N*/ pLst->Frm().Left()>= rVis.Right()) )
+/*N*/ {
+/*?*/ bTstCnt = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bTstCnt )
+/*N*/ {
+/*N*/ if ( pCntnt->IsInSct() )
+/*N*/ {
+/*N*/ const SwSectionFrm *pSct = ((SwFrm*)pCntnt)->ImplFindSctFrm();
+/*N*/ if ( !pSct->IsValid() )
+/*N*/ {
+/*N*/ pSct->Calc();
+/*N*/ pSct->SetCompletePaint();
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pCntnt->IsValid() )
+/*N*/ { pCntnt->Calc();
+/*N*/ pCntnt->SetCompletePaint();
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if ( pCntnt->IsInTab() )
+/*N*/ {
+/*N*/ const SwTabFrm *pTab = ((SwFrm*)pCntnt)->ImplFindTabFrm();
+/*N*/ if ( !pTab->IsValid() )
+/*N*/ {
+/*N*/ pTab->Calc();
+/*N*/ pTab->SetCompletePaint();
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pCntnt->IsInSct() )
+/*N*/ {
+/*N*/ const SwSectionFrm *pSct = ((SwFrm*)pCntnt)->ImplFindSctFrm();
+/*N*/ if ( !pSct->IsValid() )
+/*N*/ {
+/*N*/ pSct->Calc();
+/*N*/ pSct->SetCompletePaint();
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef USED
+/*?*/ if ( (pCntnt->FindPageFrm() != p2ndPage) &&
+/*?*/ prPage->GetPrev() )
+/*?*/ {
+/*?*/ prPage = (SwPageFrm*)prPage->GetPrev();
+/*?*/ bRet = FALSE;
+/*?*/ }
+/*N*/ #else
+/*N*/ const SwPageFrm* pTmp = pCntnt->FindPageFrm();
+/*N*/ if ( pTmp != p2ndPage && prPage->GetPrev() )
+/*N*/ {
+/*N*/ bRet = FALSE;
+/*N*/ if( pTmp->GetPhyPageNum() < prPage->GetPhyPageNum()
+/*N*/ && pTmp->IsInvalid() )
+/*N*/ prPage = (SwPageFrm*)pTmp;
+/*N*/ else
+/*N*/ prPage = (SwPageFrm*)prPage->GetPrev();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( !bRet && bBrowse )
+/*N*/ {
+/*N*/ const long nBottom = rVis.Bottom();
+/*N*/ const SwFrm *pFrm;
+/*N*/ if ( prPage->GetSortedObjs() &&
+/*N*/ (prPage->IsInvalidFlyLayout() || prPage->IsInvalidFlyCntnt()) &&
+/*N*/ 0 != (pFrm = lcl_FindFirstInvaFly( prPage, nBottom )) &&
+/*N*/ pFrm->Frm().Top() <= nBottom )
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if ( prPage->IsInvalidLayout() &&
+/*N*/ 0 != (pFrm = lcl_FindFirstInvaLay( prPage, nBottom )) &&
+/*N*/ pFrm->Frm().Top() <= nBottom )
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if ( (prPage->IsInvalidCntnt() || prPage->IsInvalidFlyInCnt()) &&
+/*N*/ 0 != (pFrm = lcl_FindFirstInvaCntnt( prPage, nBottom, 0 )) &&
+/*N*/ pFrm->Frm().Top() <= nBottom )
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ bRet = TRUE;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::ChkFlyAnchor()
+|*
+|* Ersterstellung MA 30. Oct. 92
+|* Letzte Aenderung MA 02. Sep. 96
+|*
+|*************************************************************************/
+/*N*/ void SwLayAction::ChkFlyAnchor( SwFlyFrm *pFly, const SwPageFrm *pPage )
+/*N*/ {
+/*N*/ //Wenn der Fly innerhalb eines anderen Rahmens gebunden ist, so sollte
+/*N*/ //dieser zuerst Formatiert werden.
+/*N*/
+/*N*/ if ( pFly->GetAnchor()->IsInTab() )
+/*N*/ pFly->GetAnchor()->FindTabFrm()->Calc();
+/*N*/
+/*N*/ SwFlyFrm *pAnch = pFly->GetAnchor()->FindFlyFrm();
+/*N*/ if ( pAnch )
+/*N*/ {
+/*N*/ ChkFlyAnchor( pAnch, pPage );
+/*N*/ CHECKPAGE;
+/*N*/ while ( pPage == pAnch->FindPageFrm() && FormatLayoutFly( pAnch ) )
+/*N*/ /* do nothing */;
+/*N*/ }
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwLayAction::FormatFlyLayout()
+|*
+|* Ersterstellung MA 30. Oct. 92
+|* Letzte Aenderung MA 03. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ void SwLayAction::FormatFlyLayout( const SwPageFrm *pPage )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; pPage->GetSortedObjs() &&
+/*N*/ i < pPage->GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pPage->GetSortedObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ const USHORT nOld = i;
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ ChkFlyAnchor( pFly, pPage );
+/*N*/ if ( IsAgain() )
+/*?*/ return;
+/*N*/ while ( pPage == pFly->FindPageFrm() )
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = pFly->GetFmt();
+/*N*/ if( FLY_AUTO_CNTNT == pFmt->GetAnchor().GetAnchorId() &&
+/*N*/ pFly->GetAnchor() &&
+/*N*/ ( REL_CHAR == pFmt->GetHoriOrient().GetRelationOrient() ||
+/*N*/ REL_CHAR == pFmt->GetVertOrient().GetRelationOrient() ) )
+/*?*/ _FormatCntnt( (SwCntntFrm*)pFly->GetAnchor(), pPage );
+/*N*/ if( !FormatLayoutFly( pFly ) )
+/*N*/ break;
+/*N*/ }
+/*N*/ CHECKPAGE;
+/*N*/ if ( !IS_FLYS )
+/*N*/ break;
+/*N*/ if ( nOld > pPage->GetSortedObjs()->Count() )
+/*?*/ i -= nOld - pPage->GetSortedObjs()->Count();
+/*N*/ else
+/*N*/ { //Positionswechsel!
+/*N*/ USHORT nAct;
+/*N*/ pPage->GetSortedObjs()->Seek_Entry(pFly->GetVirtDrawObj(),&nAct);
+/*N*/ if ( nAct < i )
+/*?*/ i = nAct;
+/*N*/ else if ( nAct > i )
+/*?*/ --i;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayAction::FormatLayout(), FormatLayoutFly, FormatLayoutTab()
+|*
+|* Ersterstellung MA 30. Oct. 92
+|* Letzte Aenderung MA 18. May. 98
+|*
+|*************************************************************************/
+// OD 15.11.2002 #105155# - introduce support for vertical layout
+/*N*/ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect )
+/*N*/ {
+/*N*/ ASSERT( !IsAgain(), "Ungueltige Seite beachten." );
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ BOOL bChanged = FALSE;
+/*N*/ BOOL bAlreadyPainted = FALSE;
+/*N*/ // OD 11.11.2002 #104414# - remember frame at complete paint
+/*N*/ SwRect aFrmAtCompletePaint;
+/*N*/
+/*N*/ if ( !pLay->IsValid() || pLay->IsCompletePaint() )
+/*N*/ {
+/*N*/ if ( pLay->GetPrev() && !pLay->GetPrev()->IsValid() )
+/*N*/ pLay->GetPrev()->SetCompletePaint();
+/*N*/
+/*N*/ SwRect aOldRect( pLay->Frm() );
+/*N*/ pLay->Calc();
+/*N*/ if ( aOldRect != pLay->Frm() )
+/*N*/ bChanged = TRUE;
+/*N*/
+/*N*/ FASTBOOL bNoPaint = FALSE;
+/*N*/ if ( pLay->IsPageBodyFrm() &&
+/*N*/ pLay->Frm().Pos() == aOldRect.Pos() &&
+/*N*/ pLay->Lower() &&
+/*N*/ pLay->GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ //HotFix: Vobis Homepage, nicht so genau hinsehen, sonst
+/*N*/ //rpaints
+/*N*/
+/*N*/ //Einschraenkungen wegen Kopf-/Fusszeilen
+/*N*/ if ( !( pLay->IsCompletePaint() &&
+/*N*/ ( pLay->GetFmt()->GetDoc()->IsHeadInBrowse() ||
+/*N*/ pLay->GetFmt()->GetDoc()->IsFootInBrowse() ||
+/*N*/ pLay->FindPageFrm()->FindFtnCont() )
+/*N*/ )
+/*N*/ )
+/*N*/ {
+/*N*/ bNoPaint = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( !bNoPaint && IsPaint() && bAddRect && (pLay->IsCompletePaint() || bChanged) )
+/*N*/ {
+/*N*/ SwRect aPaint( pLay->Frm() );
+/*N*/ // OD 13.02.2003 #i9719#, #105645# - consider border and shadow for
+/*N*/ // page frames -> enlarge paint rectangle correspondingly.
+/*N*/ if ( pLay->IsPageFrm() )
+/*N*/ {
+/*N*/ SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(pLay);
+/*N*/ const int nBorderWidth =
+/*N*/ pImp->GetShell()->GetOut()->PixelToLogic( Size( pPageFrm->BorderPxWidth(), 0 ) ).Width();
+/*N*/ const int nShadowWidth =
+/*N*/ pImp->GetShell()->GetOut()->PixelToLogic( Size( pPageFrm->ShadowPxWidth(), 0 ) ).Width();
+/*N*/ aPaint.Left( aPaint.Left() - nBorderWidth );
+/*N*/ aPaint.Top( aPaint.Top() - nBorderWidth );
+/*N*/ aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth );
+/*N*/ aPaint.Bottom( aPaint.Bottom() + nBorderWidth + nShadowWidth );
+/*N*/ }
+/*N*/
+/*N*/ if ( pLay->IsPageFrm() &&
+/*N*/ pLay->GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ // NOTE: no vertical layout in online layout
+/*N*/ //Ist die Aenderung ueberhaupt sichtbar?
+/*N*/ if ( pLay->IsCompletePaint() )
+/*N*/ {
+/*N*/ pImp->GetShell()->AddPaintRect( aPaint );
+/*N*/ bAddRect = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwRegionRects aRegion( aOldRect );
+/*N*/ aRegion -= aPaint;
+ USHORT i=0;
+/*N*/ for ( i = 0; i < aRegion.Count(); ++i )
+/*N*/ pImp->GetShell()->AddPaintRect( aRegion[i] );
+/*N*/ aRegion.ChangeOrigin( aPaint );
+/*N*/ aRegion.Remove( 0, aRegion.Count() );
+/*N*/ aRegion.Insert( aPaint, 0 );
+/*N*/ aRegion -= aOldRect;
+/*N*/ for ( i = 0; i < aRegion.Count(); ++i )
+/*N*/ pImp->GetShell()->AddPaintRect( aRegion[i] );
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pImp->GetShell()->AddPaintRect( aPaint );
+/*N*/ bAlreadyPainted = TRUE;
+/*N*/ // OD 11.11.2002 #104414# - remember frame at complete paint
+/*N*/ aFrmAtCompletePaint = pLay->Frm();
+/*N*/ }
+/*N*/
+/*N*/ // OD 13.02.2003 #i9719#, #105645# - provide paint of spacing
+/*N*/ // between pages (not only for in online mode).
+/*N*/ if ( pLay->IsPageFrm() )
+/*N*/ {
+/*N*/ if ( pLay->GetPrev() )
+/*N*/ {
+/*N*/ SwRect aSpaceToPrevPage( pLay->Frm() );
+/*N*/ SwTwips nTop = aSpaceToPrevPage.Top() - DOCUMENTBORDER/2;
+/*N*/ if ( nTop >= 0 )
+/*N*/ aSpaceToPrevPage.Top( nTop );
+/*N*/ aSpaceToPrevPage.Bottom( pLay->Frm().Top() );
+/*N*/ pImp->GetShell()->AddPaintRect( aSpaceToPrevPage );
+/*N*/ }
+/*N*/ if ( pLay->GetNext() )
+/*N*/ {
+/*N*/ SwRect aSpaceToNextPage( pLay->Frm() );
+/*N*/ aSpaceToNextPage.Bottom( aSpaceToNextPage.Bottom() + DOCUMENTBORDER/2 );
+/*N*/ aSpaceToNextPage.Top( pLay->Frm().Bottom() );
+/*N*/ pImp->GetShell()->AddPaintRect( aSpaceToNextPage );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ pLay->ResetCompletePaint();
+/*N*/ }
+/*N*/
+/*N*/ if ( IsPaint() && bAddRect &&
+/*N*/ !pLay->GetNext() && pLay->IsRetoucheFrm() && pLay->IsRetouche() )
+/*N*/ {
+/*N*/ // OD 15.11.2002 #105155# - vertical layout support
+/*N*/ SWRECTFN( pLay );
+/*N*/ SwRect aRect( pLay->GetUpper()->PaintArea() );
+/*N*/ (aRect.*fnRect->fnSetTop)( (pLay->*fnRect->fnGetPrtBottom)() );
+/*N*/ if ( !pImp->GetShell()->AddPaintRect( aRect ) )
+/*N*/ pLay->ResetRetouche();
+/*N*/ }
+/*N*/
+/*N*/ if( bAlreadyPainted )
+/*N*/ bAddRect = FALSE;
+/*N*/
+/*N*/ CheckWaitCrsr();
+/*N*/
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ //Jetzt noch diejenigen Lowers versorgen die LayoutFrm's sind
+/*N*/
+/*N*/ if ( pLay->IsFtnFrm() ) //Hat keine LayFrms als Lower.
+/*N*/ return bChanged;
+/*N*/
+/*N*/ SwFrm *pLow = pLay->Lower();
+/*N*/ BOOL bTabChanged = FALSE;
+/*N*/ while ( pLow && pLow->GetUpper() == pLay )
+/*N*/ {
+/*N*/ if ( pLow->IsLayoutFrm() )
+/*N*/ {
+/*N*/ if ( pLow->IsTabFrm() )
+/*N*/ bTabChanged |= FormatLayoutTab( (SwTabFrm*)pLow, bAddRect );
+/*N*/ // bereits zum Loeschen angemeldete Ueberspringen
+/*N*/ else if( !pLow->IsSctFrm() || ((SwSectionFrm*)pLow)->GetSection() )
+/*N*/ bChanged |= FormatLayout( (SwLayoutFrm*)pLow, bAddRect );
+/*N*/ }
+/*N*/ else if ( pImp->GetShell()->IsPaintLocked() )
+/*N*/ //Abkuerzung im die Zyklen zu minimieren, bei Lock kommt das
+/*N*/ //Paint sowieso (Primaer fuer Browse)
+/*N*/ pLow->OptCalc();
+/*N*/
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/ pLow = pLow->GetNext();
+/*N*/ }
+/*N*/ // OD 11.11.2002 #104414# - add complete frame area as paint area, if frame
+/*N*/ // area has been already added and after formating its lowers the frame area
+/*N*/ // is enlarged.
+/*N*/ if ( bAlreadyPainted &&
+/*N*/ ( pLay->Frm().Width() > aFrmAtCompletePaint.Width() ||
+/*N*/ pLay->Frm().Height() > aFrmAtCompletePaint.Height() )
+/*N*/ )
+/*N*/ {
+/*N*/ pImp->GetShell()->AddPaintRect( pLay->Frm() );
+/*N*/ }
+/*N*/ return bChanged || bTabChanged;
+/*N*/ }
+
+/*N*/ BOOL SwLayAction::FormatLayoutFly( SwFlyFrm *pFly, BOOL bAddRect )
+/*N*/ {
+/*N*/ ASSERT( !IsAgain(), "Ungueltige Seite beachten." );
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ BOOL bChanged = FALSE;
+/*N*/
+/*N*/ if ( !pFly->IsValid() || pFly->IsCompletePaint() || pFly->IsInvalid() )
+/*N*/ {
+/*N*/ //Der Frame hat sich veraendert, er wird jetzt Formatiert
+/*N*/ const SwRect aOldRect( pFly->Frm() );
+/*N*/ pFly->Calc();
+/*N*/ bChanged = aOldRect != pFly->Frm();
+/*N*/
+/*N*/ if ( IsPaint() && bAddRect && (pFly->IsCompletePaint() || bChanged) &&
+/*N*/ pFly->Frm().Top() > 0 && pFly->Frm().Left() > 0 )
+/*N*/ pImp->GetShell()->AddPaintRect( pFly->Frm() );
+/*N*/
+/*N*/ if ( bChanged )
+/*N*/ pFly->Invalidate();
+/*N*/ else
+/*N*/ pFly->Validate();
+/*N*/ bAddRect = FALSE;
+/*N*/ pFly->ResetCompletePaint();
+/*N*/ }
+/*N*/
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ //Jetzt noch diejenigen Lowers versorgen die LayoutFrm's sind
+/*N*/ BOOL bTabChanged = FALSE;
+/*N*/ SwFrm *pLow = pFly->Lower();
+/*N*/ while ( pLow )
+/*N*/ {
+/*N*/ if ( pLow->IsLayoutFrm() )
+/*N*/ {
+/*N*/ if ( pLow->IsTabFrm() )
+/*N*/ bTabChanged |= FormatLayoutTab( (SwTabFrm*)pLow, bAddRect );
+/*N*/ else
+/*N*/ bChanged |= FormatLayout( (SwLayoutFrm*)pLow, bAddRect );
+/*N*/ }
+/*N*/ pLow = pLow->GetNext();
+/*N*/ }
+/*N*/ return bChanged || bTabChanged;
+/*N*/ }
+
+/*N*/ BOOL MA_FASTCALL lcl_AreLowersScrollable( const SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ const SwFrm *pLow = pLay->Lower();
+/*N*/ while ( pLow )
+/*N*/ {
+/*N*/ if ( pLow->IsCompletePaint() || !pLow->IsValid() )
+/*N*/ return FALSE;
+/*N*/ if ( pLow->IsLayoutFrm() && !::binfilter::lcl_AreLowersScrollable( (SwLayoutFrm*)pLow ))
+/*N*/ return FALSE;
+/*N*/ pLow = pLow->GetNext();
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ SwLayoutFrm * MA_FASTCALL lcl_IsTabScrollable( SwTabFrm *pTab )
+/*N*/ {
+/*N*/ //returnt die erste unveraenderte Zeile, oder 0 wenn nicht
+/*N*/ //gescrollt werden darf.
+/*N*/ if ( !pTab->IsCompletePaint() )
+/*N*/ {
+/*N*/ SwLayoutFrm *pUnchgdRow = 0;
+/*N*/ SwLayoutFrm *pRow = (SwLayoutFrm*)pTab->Lower();
+/*N*/ while ( pRow )
+/*N*/ {
+/*N*/ if ( !::binfilter::lcl_AreLowersScrollable( pRow ) )
+/*N*/ pUnchgdRow = 0;
+/*N*/ else if ( !pUnchgdRow )
+/*N*/ pUnchgdRow = pRow;
+/*N*/ pRow = (SwLayoutFrm*)pRow->GetNext();
+/*N*/ }
+/*N*/ return pUnchgdRow;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_ValidateLowers( SwLayoutFrm *pLay, const SwTwips nOfst,
+/*N*/ SwLayoutFrm *pRow, SwPageFrm *pPage,
+/*N*/ BOOL bResetOnly )
+/*N*/ {
+/*N*/ pLay->ResetCompletePaint();
+/*N*/ SwFrm *pLow = pLay->Lower();
+/*N*/ if ( pRow )
+/*N*/ while ( pLow != pRow )
+/*N*/ pLow = pLow->GetNext();
+/*N*/
+/*N*/ SwRootFrm *pRootFrm = 0;
+/*N*/
+/*N*/ while ( pLow )
+/*N*/ {
+/*N*/ if ( !bResetOnly )
+/*N*/ {
+/*N*/ SwRect aOldFrm( pLow->Frm() );
+/*N*/ pLow->Frm().Pos().Y() += nOfst;
+/*N*/ if( pLow->IsAccessibleFrm() )
+/*N*/ {
+/*N*/ if( !pRootFrm )
+/*N*/ pRootFrm = pPage->FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pLow->IsLayoutFrm() )
+/*N*/ {
+/*N*/ ::binfilter::lcl_ValidateLowers( (SwLayoutFrm*)pLow, nOfst, 0, pPage, bResetOnly);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pLow->ResetCompletePaint();
+/*N*/ if ( pLow->GetDrawObjs() )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < pLow->GetDrawObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pLow->GetDrawObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( !bResetOnly )
+/*N*/ {
+/*N*/ pFly->Frm().Pos().Y() += nOfst;
+/*N*/ pFly->GetVirtDrawObj()->_SetRectsDirty();
+/*N*/ if ( pFly->IsFlyInCntFrm() )
+/*N*/ ((SwFlyInCntFrm*)pFly)->AddRefOfst( nOfst );
+/*N*/ }
+/*N*/ ::binfilter::lcl_ValidateLowers( pFly, nOfst, 0, pPage, bResetOnly);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // OD 30.06.2003 #108784# - consider 'virtual' drawing objects.
+/*N*/ if ( pO->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pO);
+/*N*/ pDrawVirtObj->SetAnchorPos( pLow->GetFrmAnchorPos( ::binfilter::HasWrap( pO ) ) );
+/*N*/ pDrawVirtObj->AdjustRelativePosToReference();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pO->SetAnchorPos( pLow->GetFrmAnchorPos( ::binfilter::HasWrap( pO ) ) );
+/*N*/ SwFrmFmt *pFrmFmt = FindFrmFmt( pO );
+/*N*/ if( !pFrmFmt ||
+/*N*/ FLY_IN_CNTNT != pFrmFmt->GetAnchor().GetAnchorId() )
+/*N*/ {
+/*N*/ ((SwDrawContact*)pO->GetUserCall())->ChkPage();
+/*N*/ }
+/*N*/ // OD 30.06.2003 #108784# - correct relative position
+/*N*/ // of 'virtual' drawing objects.
+/*N*/ SwDrawContact* pDrawContact =
+/*N*/ static_cast<SwDrawContact*>(pO->GetUserCall());
+/*N*/ if ( pDrawContact )
+/*N*/ {
+/*N*/ pDrawContact->CorrectRelativePosOfVirtObjs();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !bResetOnly )
+/*N*/ pLow->Calc(); //#55435# Stabil halten.
+/*N*/ pLow = pLow->GetNext();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_AddScrollRectTab( SwTabFrm *pTab, SwLayoutFrm *pRow,
+/*N*/ const SwRect &rRect,
+/*N*/ const SwTwips nOfst)
+/*N*/ {
+/*N*/ //Wenn altes oder neues Rechteck mit einem Fly ueberlappen, in dem der
+/*N*/ //Frm nicht selbst steht, so ist nichts mit Scrollen.
+/*N*/ const SwPageFrm *pPage = pTab->FindPageFrm();
+/*N*/ SwRect aRect( rRect );
+/*N*/ // OD 04.11.2002 #104100# - <SWRECTFN( pTab )> not needed.
+/*N*/ if( pTab->IsVertical() )
+/*?*/ aRect.Pos().X() -= nOfst;
+/*N*/ else
+/*N*/ aRect.Pos().Y() += nOfst;
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ if ( ::binfilter::lcl_IsOverObj( pTab, pPage, rRect, aRect, pTab ) )
+/*N*/ return;
+/*N*/ }
+/*N*/ if ( pPage->GetFmt()->GetBackground().GetGraphicPos() != GPOS_NONE )
+/*?*/ return;
+/*N*/
+/*N*/ ViewShell *pSh = pPage->GetShell();
+/*N*/ if ( pSh )
+/*N*/ pSh->AddScrollRect( pTab, aRect, nOfst );
+/*N*/ ::binfilter::lcl_ValidateLowers( pTab, nOfst, pRow, pTab->FindPageFrm(),
+/*N*/ pTab->IsLowersFormatted() );
+/*N*/ }
+
+// OD 31.10.2002 #104100#
+// NOTE: no adjustments for vertical layout support necessary
+/*N*/ BOOL CheckPos( SwFrm *pFrm )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ return TRUE;
+/*N*/ }
+
+// OD 31.10.2002 #104100#
+// Implement vertical layout support
+/*N*/ BOOL SwLayAction::FormatLayoutTab( SwTabFrm *pTab, BOOL bAddRect )
+/*N*/ {
+/*N*/ ASSERT( !IsAgain(), "8-) Ungueltige Seite beachten." );
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ SwDoc* pDoc = pRoot->GetFmt()->GetDoc();
+/*N*/ const BOOL bOldIdle = pDoc->IsIdleTimerActive();
+/*N*/ pDoc->StopIdleTimer();
+/*N*/
+/*N*/ BOOL bChanged = FALSE;
+/*N*/ FASTBOOL bPainted = FALSE;
+/*N*/
+/*N*/ const SwPageFrm *pOldPage = pTab->FindPageFrm();
+/*N*/
+/*N*/ // OD 31.10.2002 #104100# - vertical layout support
+/*N*/ // use macro to declare and init <sal_Bool bVert>, <sal_Bool bRev> and
+/*N*/ // <SwRectFn fnRect> for table frame <pTab>.
+/*N*/ SWRECTFN( pTab );
+/*N*/
+/*N*/ if ( !pTab->IsValid() || pTab->IsCompletePaint() || pTab->IsComplete() )
+/*N*/ {
+/*N*/ if ( pTab->GetPrev() && !pTab->GetPrev()->IsValid() )
+/*N*/ pTab->GetPrev()->SetCompletePaint();
+/*N*/
+/*N*/ //Potenzielles Scrollrect ist die ganze Tabelle. Da bereits ein
+/*N*/ //Wachstum innerhalb der Tabelle - und damit der Tabelle selbst -
+/*N*/ //stattgefunden haben kann, muss die untere Kante durch die
+/*N*/ //Unterkante der letzten Zeile bestimmt werden.
+/*N*/ SwLayoutFrm *pRow;
+/*N*/ SwRect aScrollRect( pTab->PaintArea() );
+/*N*/ if ( IsPaint() || bAddRect )
+/*N*/ {
+/*N*/ pRow = (SwLayoutFrm*)pTab->Lower();
+/*N*/ while ( pRow->GetNext() )
+/*N*/ pRow = (SwLayoutFrm*)pRow->GetNext();
+/*N*/ // OD 31.10.2002 #104100# - vertical layout support
+/*N*/ (aScrollRect.*fnRect->fnSetBottom)( (pRow->Frm().*fnRect->fnGetBottom)() );
+/*N*/ //Die Oberkante wird ggf. durch die erste unveraenderte Zeile bestimmt.
+/*N*/ pRow = ::binfilter::lcl_IsTabScrollable( pTab );
+/*N*/ if ( pRow && pRow != pTab->Lower() )
+/*N*/ // OD 31.10.2002 #104100# - vertical layout support
+/*N*/ (aScrollRect.*fnRect->fnSetTop)( (pRow->Frm().*fnRect->fnGetTop)() );
+/*N*/ }
+/*N*/
+/*N*/ const SwFrm *pOldUp = pTab->GetUpper();
+/*N*/
+/*N*/ SwRect aOldRect( pTab->Frm() );
+/*N*/ pTab->SetLowersFormatted( FALSE );
+/*N*/ pTab->Calc();
+/*N*/ if ( aOldRect != pTab->Frm() )
+/*N*/ bChanged = TRUE;
+/*N*/ SwRect aPaintFrm = pTab->PaintArea();
+/*N*/
+/*N*/ if ( IsPaint() && bAddRect )
+/*N*/ {
+/*N*/ if ( pRow && pOldUp == pTab->GetUpper() &&
+/*N*/ pTab->Frm().SSize() == aOldRect.SSize() &&
+/*N*/ // OD 31.10.2002 #104100# - vertical layout support
+/*N*/ (pTab->Frm().*fnRect->fnGetLeft)() == (aOldRect.*fnRect->fnGetLeft)() &&
+/*N*/ pTab->IsAnLower( pRow ) )
+/*N*/ {
+/*N*/ SwTwips nOfst;
+/*N*/ if ( pRow->GetPrev() )
+/*N*/ {
+/*N*/ if ( pRow->GetPrev()->IsValid() ||
+/*N*/ ::binfilter::CheckPos( pRow->GetPrev() ) )
+/*N*/ {
+/*N*/ // OD 31.10.2002 #104100# - vertical layout support
+/*N*/ nOfst = -(pRow->Frm().*fnRect->fnTopDist)( (pRow->GetPrev()->Frm().*fnRect->fnGetBottom)() );
+/*N*/ }
+/*N*/ else
+/*N*/ nOfst = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ // OD 31.10.2002 #104100# - vertical layout support
+/*N*/ nOfst = (pTab->Frm().*fnRect->fnTopDist)( (aOldRect.*fnRect->fnGetTop)() );
+/*N*/
+/*N*/ if ( nOfst )
+/*N*/ {
+/*N*/ ::binfilter::lcl_AddScrollRectTab( pTab, pRow, aScrollRect, nOfst );
+/*N*/ bPainted = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // OD 01.11.2002 #104100# - add condition <pTab->Frm().HasArea()>
+/*N*/ if ( !pTab->IsCompletePaint() && pTab->IsComplete() &&
+/*N*/ ( pTab->Frm().SSize() != pTab->Prt().SSize() ||
+/*N*/ // OD 31.10.2002 #104100# - vertical layout support
+/*N*/ (pTab->*fnRect->fnGetLeftMargin)()
+/*N*/ ) &&
+/*N*/ pTab->Frm().HasArea()
+/*N*/ )
+/*N*/ {
+/*N*/ // OD 01.11.2002 #104100# - re-implement calculation of margin rectangles.
+/*N*/ SwRect aMarginRect;
+/*N*/
+/*N*/ SwTwips nLeftMargin = (pTab->*fnRect->fnGetLeftMargin)();
+/*N*/ if ( nLeftMargin > 0)
+/*N*/ {
+/*N*/ aMarginRect = pTab->Frm();
+/*N*/ (aMarginRect.*fnRect->fnSetWidth)( nLeftMargin );
+/*N*/ pImp->GetShell()->AddPaintRect( aMarginRect );
+/*N*/ }
+/*N*/
+/*N*/ if ( (pTab->*fnRect->fnGetRightMargin)() > 0)
+/*N*/ {
+/*N*/ aMarginRect = pTab->Frm();
+/*N*/ (aMarginRect.*fnRect->fnSetLeft)( (pTab->*fnRect->fnGetPrtRight)() );
+/*N*/ pImp->GetShell()->AddPaintRect( aMarginRect );
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nTopMargin = (pTab->*fnRect->fnGetTopMargin)();
+/*N*/ if ( nTopMargin > 0)
+/*N*/ {
+/*N*/ aMarginRect = pTab->Frm();
+/*N*/ (aMarginRect.*fnRect->fnSetHeight)( nTopMargin );
+/*N*/ pImp->GetShell()->AddPaintRect( aMarginRect );
+/*N*/ }
+/*N*/
+/*N*/ if ( (pTab->*fnRect->fnGetBottomMargin)() > 0)
+/*N*/ {
+/*N*/ aMarginRect = pTab->Frm();
+/*N*/ (aMarginRect.*fnRect->fnSetTop)( (pTab->*fnRect->fnGetPrtBottom)() );
+/*N*/ pImp->GetShell()->AddPaintRect( aMarginRect );
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pTab->IsCompletePaint() )
+/*N*/ {
+/*N*/ pImp->GetShell()->AddPaintRect( aPaintFrm );
+/*N*/ bAddRect = FALSE;
+/*N*/ bPainted = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ if ( pTab->IsRetouche() && !pTab->GetNext() )
+/*N*/ {
+/*N*/ SwRect aRect( pTab->GetUpper()->PaintArea() );
+/*N*/ // OD 04.11.2002 #104100# - vertical layout support
+/*N*/ (aRect.*fnRect->fnSetTop)( (pTab->*fnRect->fnGetPrtBottom)() );
+/*N*/ if ( !pImp->GetShell()->AddPaintRect( aRect ) )
+/*N*/ pTab->ResetRetouche();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bAddRect = FALSE;
+/*N*/
+/*N*/ if ( pTab->IsCompletePaint() && !pOptTab )
+/*N*/ pOptTab = pTab;
+/*N*/ pTab->ResetCompletePaint();
+/*N*/ }
+/*N*/ if ( IsPaint() && bAddRect && pTab->IsRetouche() && !pTab->GetNext() )
+/*N*/ {
+/*N*/ // OD 04.10.2002 #102779#
+/*N*/ // set correct rectangle for retouche: area between bottom of table frame
+/*N*/ // and bottom of paint area of the upper frame.
+/*N*/ SwRect aRect( pTab->GetUpper()->PaintArea() );
+/*N*/ // OD 04.11.2002 #104100# - vertical layout support
+/*N*/ (aRect.*fnRect->fnSetTop)( (pTab->*fnRect->fnGetPrtBottom)() );
+/*N*/ if ( !pImp->GetShell()->AddPaintRect( aRect ) )
+/*N*/ pTab->ResetRetouche();
+/*N*/ }
+/*N*/
+/*N*/ CheckWaitCrsr();
+/*N*/
+/*N*/ if ( bOldIdle )
+/*N*/ pDoc->StartIdleTimer();
+/*N*/
+/*N*/ //Heftige Abkuerzung!
+/*N*/ if ( pTab->IsLowersFormatted() &&
+/*N*/ (bPainted || !pImp->GetShell()->VisArea().IsOver( pTab->Frm())) )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ //Jetzt noch die Lowers versorgen
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/ SwLayoutFrm *pLow = (SwLayoutFrm*)pTab->Lower();
+/*N*/ while ( pLow )
+/*N*/ {
+/*N*/ bChanged |= FormatLayout( (SwLayoutFrm*)pLow, bAddRect );
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/ pLow = (SwLayoutFrm*)pLow->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if ( pOldPage->GetPhyPageNum() > (pTab->FindPageFrm()->GetPhyPageNum() + 1) )
+/*N*/ SetNextCycle( TRUE );
+/*N*/
+/*N*/ return bChanged;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::FormatCntnt()
+|*
+|* Ersterstellung MA 30. Oct. 92
+|* Letzte Aenderung MA 16. Nov. 95
+|*
+|*************************************************************************/
+/*N*/ BOOL SwLayAction::FormatCntnt( const SwPageFrm *pPage )
+/*N*/ {
+/*N*/ const SwCntntFrm *pCntnt = pPage->ContainsCntnt();
+/*N*/ const FASTBOOL bBrowse = pRoot->GetFmt()->GetDoc()->IsBrowseMode();
+/*N*/
+/*N*/ while ( pCntnt && pPage->IsAnLower( pCntnt ) )
+/*N*/ {
+/*N*/ //Wenn der Cntnt sich eh nicht veraendert koennen wir ein paar
+/*N*/ //Abkuerzungen nutzen.
+/*N*/ const BOOL bFull = !pCntnt->IsValid() || pCntnt->IsCompletePaint() ||
+/*N*/ pCntnt->IsRetouche() || pCntnt->GetDrawObjs();
+/*N*/ if ( bFull )
+/*N*/ {
+/*N*/ //Damit wir nacher nicht suchen muessen.
+/*N*/ const BOOL bNxtCnt = IsCalcLayout() && !pCntnt->GetFollow();
+/*N*/ const SwCntntFrm *pCntntNext = bNxtCnt ? pCntnt->GetNextCntntFrm() : 0;
+/*N*/ const SwCntntFrm *pCntntPrev = pCntnt->GetPrev() ? pCntnt->GetPrevCntntFrm() : 0;
+/*N*/
+/*N*/ const SwLayoutFrm*pOldUpper = pCntnt->GetUpper();
+/*N*/ const SwTabFrm *pTab = pCntnt->FindTabFrm();
+/*N*/ const BOOL bInValid = !pCntnt->IsValid() || pCntnt->IsCompletePaint();
+/*N*/ const BOOL bOldPaint = IsPaint();
+/*N*/ bPaint = bOldPaint && !(pTab && pTab == pOptTab);
+/*N*/ _FormatCntnt( pCntnt, pPage );
+/*N*/ bPaint = bOldPaint;
+/*N*/
+/*N*/ if ( !pCntnt->GetValidLineNumFlag() && pCntnt->IsTxtFrm() )
+/*N*/ {
+/*N*/ const ULONG nAllLines = ((SwTxtFrm*)pCntnt)->GetAllLines();
+/*N*/ ((SwTxtFrm*)pCntnt)->RecalcAllLines();
+/*N*/ if ( IsPaintExtraData() && IsPaint() &&
+/*N*/ nAllLines != ((SwTxtFrm*)pCntnt)->GetAllLines() )
+/*?*/ pImp->GetShell()->AddPaintRect( pCntnt->Frm() );
+/*N*/ }
+/*N*/
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ //Wenn Layout oder Flys wieder Invalid sind breche ich die Verarbeitung
+/*N*/ //vorlaeufig ab - allerdings nicht fuer die BrowseView, denn dort wird
+/*N*/ //das Layout staendig ungueltig, weil die Seitenhoehe angepasst wird.
+/*N*/ //Desgleichen wenn der Benutzer weiterarbeiten will und mindestens ein
+/*N*/ //Absatz verarbeitet wurde.
+/*N*/ if ( (!pTab || (pTab && !bInValid)) )
+/*N*/ {
+/*N*/ CheckIdleEnd();
+/*N*/ // OD 14.04.2003 #106346# - consider interrupt formatting.
+/*N*/ if ( ( IsInterrupt() && !mbFormatCntntOnInterrupt ) ||
+/*N*/ ( !bBrowse && pPage->IsInvalidLayout() ) ||
+/*N*/ // OD 07.05.2003 #109435# - consider interrupt formatting
+/*N*/ ( IS_FLYS && IS_INVAFLY && !mbFormatCntntOnInterrupt )
+/*N*/ )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if ( pOldUpper != pCntnt->GetUpper() )
+/*N*/ {
+/*N*/ const USHORT nCurNum = pCntnt->FindPageFrm()->GetPhyPageNum();
+/*N*/ if ( nCurNum < pPage->GetPhyPageNum() )
+/*N*/ nPreInvaPage = nCurNum;
+/*N*/
+/*N*/ //Wenn der Frm mehr als eine Seite rueckwaerts geflossen ist, so
+/*N*/ //fangen wir nocheinmal von vorn an damit wir nichts auslassen.
+/*N*/ if ( !IsCalcLayout() && pPage->GetPhyPageNum() > nCurNum+1 )
+/*N*/ {
+/*N*/ SetNextCycle( TRUE );
+/*N*/ // OD 07.05.2003 #109435# - consider interrupt formatting
+/*N*/ if ( !mbFormatCntntOnInterrupt )
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ //Wenn der Frame die Seite vorwaerts gewechselt hat, so lassen wir
+/*N*/ //den Vorgaenger nocheinmal durchlaufen.
+/*N*/ //So werden einerseits Vorgaenger erwischt, die jetzt fr Retouche
+/*N*/ //verantwortlich sind, andererseits werden die Fusszeilen
+/*N*/ //auch angefasst.
+/*N*/ FASTBOOL bSetCntnt = TRUE;
+/*N*/ if ( pCntntPrev )
+/*N*/ {
+/*N*/ if ( !pCntntPrev->IsValid() && pPage->IsAnLower( pCntntPrev ) )
+/*N*/ pPage->InvalidateCntnt();
+/*N*/ if ( pOldUpper != pCntnt->GetUpper() &&
+/*N*/ pPage->GetPhyPageNum() < pCntnt->FindPageFrm()->GetPhyPageNum() )
+/*N*/ {
+/*N*/ pCntnt = pCntntPrev;
+/*N*/ bSetCntnt = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bSetCntnt )
+/*N*/ {
+/*N*/ if ( bBrowse && !IsIdle() && !IsCalcLayout() && !IsComplete() &&
+/*N*/ pCntnt->Frm().Top() > pImp->GetShell()->VisArea().Bottom())
+/*N*/ {
+/*N*/ const long nBottom = pImp->GetShell()->VisArea().Bottom();
+/*N*/ const SwFrm *pTmp = lcl_FindFirstInvaCntnt( pPage,
+/*N*/ nBottom, pCntnt );
+/*N*/ if ( !pTmp )
+/*N*/ {
+/*N*/ if ( (!(IS_FLYS && IS_INVAFLY) ||
+/*N*/ !lcl_FindFirstInvaFly( pPage, nBottom )) &&
+/*N*/ (!pPage->IsInvalidLayout() ||
+/*N*/ !lcl_FindFirstInvaLay( pPage, nBottom )))
+/*N*/ SetBrowseActionStop( TRUE );
+/*N*/ // OD 14.04.2003 #106346# - consider interrupt formatting.
+/*N*/ if ( !mbFormatCntntOnInterrupt )
+/*N*/ {
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pCntnt = bNxtCnt ? pCntntNext : pCntnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/
+/*N*/ RESCHEDULE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( !pCntnt->GetValidLineNumFlag() && pCntnt->IsTxtFrm() )
+/*N*/ {
+/*N*/ const ULONG nAllLines = ((SwTxtFrm*)pCntnt)->GetAllLines();
+/*N*/ ((SwTxtFrm*)pCntnt)->RecalcAllLines();
+/*N*/ if ( IsPaintExtraData() && IsPaint() &&
+/*N*/ nAllLines != ((SwTxtFrm*)pCntnt)->GetAllLines() )
+/*?*/ pImp->GetShell()->AddPaintRect( pCntnt->Frm() );
+/*N*/ }
+/*N*/
+/*N*/ //Falls der Frm schon vor der Abarbeitung hier formatiert wurde.
+/*N*/ if ( pCntnt->IsTxtFrm() && ((SwTxtFrm*)pCntnt)->HasRepaint() &&
+/*N*/ IsPaint() )
+/*N*/ PaintCntnt( pCntnt, pPage, pCntnt->Frm(), pCntnt->Frm().Bottom());
+/*N*/ if ( IsIdle() )
+/*N*/ {
+/*N*/ CheckIdleEnd();
+/*N*/ // OD 14.04.2003 #106346# - consider interrupt formatting.
+/*N*/ if ( IsInterrupt() && !mbFormatCntntOnInterrupt )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if ( bBrowse && !IsIdle() && !IsCalcLayout() && !IsComplete() &&
+/*N*/ pCntnt->Frm().Top() > pImp->GetShell()->VisArea().Bottom())
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const long nBottom = pImp->GetShell()->VisArea().Bottom();
+/*N*/ }
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ CheckWaitCrsr();
+/*N*/ // OD 14.04.2003 #106346# - consider interrupt formatting.
+/*N*/ return !IsInterrupt() || mbFormatCntntOnInterrupt;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayAction::_FormatCntnt()
+|*
+|* Beschreibung Returnt TRUE wenn der Absatz verarbeitet wurde,
+|* FALSE wenn es nichts zu verarbeiten gab.
+|* Ersterstellung MA 07. Dec. 92
+|* Letzte Aenderung MA 11. Mar. 98
+|*
+|*************************************************************************/
+/*N*/ void SwLayAction::_FormatCntnt( const SwCntntFrm *pCntnt,
+/*N*/ const SwPageFrm *pPage )
+/*N*/ {
+/*N*/ //wird sind hier evtl. nur angekommen, weil der Cntnt DrawObjekte haelt.
+/*N*/ const BOOL bDrawObjsOnly = pCntnt->IsValid() && !pCntnt->IsCompletePaint() &&
+/*N*/ !pCntnt->IsRetouche();
+/*N*/ SWRECTFN( pCntnt )
+/*N*/ if ( !bDrawObjsOnly && IsPaint() )
+/*N*/ {
+/*N*/ const BOOL bPosOnly = !pCntnt->GetValidPosFlag() &&
+/*N*/ !pCntnt->IsCompletePaint() &&
+/*N*/ pCntnt->GetValidSizeFlag() &&
+/*N*/ pCntnt->GetValidPrtAreaFlag() &&
+/*N*/ ( !pCntnt->IsTxtFrm() ||
+/*N*/ !((SwTxtFrm*)pCntnt)->HasAnimation() );
+/*N*/ const SwFrm *pOldUp = pCntnt->GetUpper();
+/*N*/ const SwRect aOldRect( pCntnt->UnionFrm() );
+/*N*/ const long nOldBottom = (pCntnt->*fnRect->fnGetPrtBottom)();
+/*N*/ pCntnt->OptCalc();
+/*N*/ if( IsAgain() )
+/*N*/ return;
+/*N*/ if( (*fnRect->fnYDiff)( (pCntnt->Frm().*fnRect->fnGetBottom)(),
+/*N*/ (aOldRect.*fnRect->fnGetBottom)() ) < 0 )
+/*N*/ pCntnt->SetRetouche();
+/*N*/ const SwRect aNewRect( pCntnt->UnionFrm() );
+/*N*/ if ( bPosOnly &&
+/*N*/ (aNewRect.*fnRect->fnGetTop)() != (aOldRect.*fnRect->fnGetTop)() &&
+/*N*/ !pCntnt->IsInTab() && !pCntnt->IsInSct() &&
+/*N*/ ( !pCntnt->GetPrev() || !pCntnt->GetPrev()->IsTabFrm() ) &&
+/*N*/ pOldUp == pCntnt->GetUpper() &&
+/*N*/ (aNewRect.*fnRect->fnGetLeft)() == (aOldRect.*fnRect->fnGetLeft)() &&
+/*N*/ aNewRect.SSize() == aOldRect.SSize()
+/*N*/ )
+/*N*/ {
+/*N*/ _AddScrollRect( pCntnt, pPage, (*fnRect->fnYDiff)(
+/*N*/ (pCntnt->Frm().*fnRect->fnGetTop)(),
+/*N*/ (aOldRect.*fnRect->fnGetTop)() ), nOldBottom );
+/*N*/ }
+/*N*/ else
+/*N*/ PaintCntnt( pCntnt, pCntnt->FindPageFrm(), aOldRect, nOldBottom);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( IsPaint() && pCntnt->IsTxtFrm() && ((SwTxtFrm*)pCntnt)->HasRepaint() )
+/*N*/ PaintCntnt( pCntnt, pPage, pCntnt->Frm(),
+/*N*/ (pCntnt->Frm().*fnRect->fnGetBottom)() );
+/*N*/ pCntnt->OptCalc();
+/*N*/ }
+/*N*/
+/*N*/ //Die im Absatz verankerten Flys wollen auch mitspielen.
+/*N*/ const SwDrawObjs *pObjs = pCntnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; pObjs && i < pObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pObjs)[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->IsFlyInCntFrm() && ((SwFlyInCntFrm*)pFly)->IsInvalid() )
+/*N*/ {
+/*N*/ FormatFlyInCnt( (SwFlyInCntFrm*)pFly );
+/*N*/ pObjs = pCntnt->GetDrawObjs();
+/*N*/ CHECKPAGE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayAction::FormatFlyCntnt()
+|*
+|* - Returnt TRUE wenn der Inhalt aller Flys vollstaendig verarbeitet
+|* wurde, FALSE bei einem vorzeitigen Abbruch.
+|* Ersterstellung MA 02. Dec. 92
+|* Letzte Aenderung MA 16. Sep. 93
+|*
+|*************************************************************************/
+/*N*/ BOOL SwLayAction::FormatFlyCntnt( const SwPageFrm *pPage, sal_Bool bDontShrink )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; pPage->GetSortedObjs() &&
+/*N*/ i < pPage->GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ if ( IsAgain() )
+/*?*/ return FALSE;
+/*N*/ SdrObject *pO = (*pPage->GetSortedObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ sal_Bool bOldShrink = pFly->IsNoShrink();
+/*N*/ if( bDontShrink )
+/*?*/ pFly->SetNoShrink( sal_True );
+/*N*/ if ( !_FormatFlyCntnt( pFly ) )
+/*N*/ {
+/*N*/ if( bDontShrink )
+/*?*/ pFly->SetNoShrink( bOldShrink );
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if( bDontShrink )
+/*?*/ pFly->SetNoShrink( bOldShrink );
+/*N*/ }
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayAction::FormatFlyInCnt()
+|*
+|* Beschreibung Da die Flys im Cntnt nix mit der Seite am Hut
+|* (bzw. in den Bits ;-)) haben werden sie vom Cntnt (FormatCntnt)
+|* gerufen und hier verarbeitet. Die Verarebeitungsmimik ist
+|* prinzipiell die gleich wie bei Seiten nur nicht ganz so
+|* kompliziert (SwLayAction::Action()).
+|* - Returnt TRUE wenn der Fly vollstaendig verbeitet wurde, FALSE bei
+|* einem vorzeitigen Abbruch.
+|* Ersterstellung MA 04. Dec. 92
+|* Letzte Aenderung MA 24. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ void SwLayAction::FormatFlyInCnt( SwFlyInCntFrm *pFly )
+/*N*/ {
+/*N*/ if ( IsAgain() )
+/*?*/ return;
+/*N*/ //Wg. Aenderung eine kleine Vorsichtsmassnahme. Es wird jetzt vor der
+/*N*/ //Cntntformatierung das Flag validiert und wenn die Formatierung mit
+/*N*/ //FALSE returnt wird halt wieder invalidiert.
+/*N*/ while ( pFly->IsInvalid() )
+/*N*/ {
+/*N*/ if ( pFly->IsInvalidLayout() )
+/*N*/ {
+/*N*/ while ( FormatLayoutFly( pFly ) )
+/*N*/ {
+/*N*/ if ( IsAgain() )
+/*?*/ return;
+/*N*/ }
+/*N*/ if ( IsAgain() )
+/*?*/ return;
+/*N*/ pFly->ValidateLayout();
+/*N*/ }
+/*N*/ if ( pFly->IsInvalidCntnt() )
+/*N*/ {
+/*N*/ pFly->ValidateCntnt();
+/*N*/ if ( !_FormatFlyCntnt( pFly ) )
+/*?*/ pFly->InvalidateCntnt();
+/*N*/ }
+/*N*/ }
+/*N*/ CheckWaitCrsr();
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayAction::_FormatFlyCntnt()
+|*
+|* Beschreibung:
+|* - Returnt TRUE wenn alle Cntnts des Flys vollstaendig verarbeitet
+|* wurden. FALSE wenn vorzeitig unterbrochen wurde.
+|* Ersterstellung MA 02. Dec. 92
+|* Letzte Aenderung MA 24. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ BOOL SwLayAction::_FormatFlyCntnt( const SwFlyFrm *pFly )
+/*N*/ {
+/*N*/ BOOL bOneProcessed = FALSE;
+/*N*/ const SwCntntFrm *pCntnt = pFly->ContainsCntnt();
+/*N*/
+/*N*/ while ( pCntnt )
+/*N*/ {
+/*N*/ if ( __FormatFlyCntnt( pCntnt ) )
+/*N*/ bOneProcessed = TRUE;
+/*N*/
+/*N*/ if ( !pCntnt->GetValidLineNumFlag() && pCntnt->IsTxtFrm() )
+/*N*/ {
+/*N*/ const ULONG nAllLines = ((SwTxtFrm*)pCntnt)->GetAllLines();
+/*N*/ ((SwTxtFrm*)pCntnt)->RecalcAllLines();
+/*N*/ if ( IsPaintExtraData() && IsPaint() &&
+/*N*/ nAllLines != ((SwTxtFrm*)pCntnt)->GetAllLines() )
+/*?*/ pImp->GetShell()->AddPaintRect( pCntnt->Frm() );
+/*N*/ }
+/*N*/
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ //wenn eine Eingabe anliegt breche ich die Verarbeitung ab.
+/*N*/ if ( bOneProcessed && !pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*N*/ CheckIdleEnd();
+/*N*/ // OD 14.04.2003 #106346# - consider interrupt formatting.
+/*N*/ if ( IsInterrupt() && !mbFormatCntntOnInterrupt )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ CheckWaitCrsr();
+/*N*/ // OD 14.04.2003 #106346# - consider interrupt formatting.
+/*N*/ return !(IsInterrupt() && !mbFormatCntntOnInterrupt);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayAction::__FormatFlyCntnt()
+|*
+|* Beschreibung:
+|* - Returnt TRUE, wenn der Cntnt verarbeitet,
+|* d.h. Kalkuliert und/oder gepaintet wurde.
+|*
+|* Ersterstellung MA 05. Jan. 93
+|* Letzte Aenderung MA 18. May. 95
+|*
+|*************************************************************************/
+/*N*/ BOOL SwLayAction::__FormatFlyCntnt( const SwCntntFrm *pCntnt )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if ( !pCntnt->IsValid() || pCntnt->IsCompletePaint() ||
+/*N*/ pCntnt->IsRetouche() )
+/*N*/ {
+/*N*/ if ( IsPaint() )
+/*N*/ {
+/*N*/ const SwRect aOldRect( pCntnt->UnionFrm( TRUE ) );
+/*N*/ const long nOldBottom = pCntnt->Frm().Top() + pCntnt->Prt().Bottom();
+/*N*/ pCntnt->OptCalc();
+/*N*/ if ( pCntnt->Frm().Bottom() < aOldRect.Bottom() )
+/*N*/ pCntnt->SetRetouche();
+/*N*/ PaintCntnt( pCntnt, pCntnt->FindPageFrm(), aOldRect, nOldBottom );
+/*N*/ }
+/*N*/ else
+/*N*/ pCntnt->OptCalc();
+/*N*/ if( IsAgain() )
+/*N*/ return FALSE;
+/*N*/ bRet = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Falls der Frm schon vor der Abarbeitung hier formatiert wurde.
+/*N*/ if ( pCntnt->IsTxtFrm() && ((SwTxtFrm*)pCntnt)->HasRepaint() &&
+/*N*/ IsPaint() )
+/*N*/ PaintCntnt( pCntnt, pCntnt->FindPageFrm(), pCntnt->Frm(), pCntnt->Frm().Bottom());
+/*N*/ }
+/*N*/ //Die im Absatz verankerten Flys wollen auch mitspielen.
+/*N*/ if ( pCntnt->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs *pObjs = pCntnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < pObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pObjs)[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->IsFlyInCntFrm() && ((SwFlyInCntFrm*)pFly)->IsInvalid() )
+/*N*/ {
+/*N*/ FormatFlyInCnt( (SwFlyInCntFrm*)pFly );
+/*N*/ if ( IsAgain() )
+/*N*/ return FALSE;
+/*N*/ pObjs = pCntnt->GetDrawObjs();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ BOOL SwLayAction::IsStopPrt() const
+/*N*/ {
+/*N*/ BOOL bResult = FALSE;
+/*N*/
+/*N*/ if (pImp != NULL && pProgress != NULL)
+/*N*/ bResult = pImp->IsStopPrt();
+/*N*/
+/*N*/ return bResult;
+/*N*/ }
+
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+
+/*************************************************************************
+|*
+|* void SwLayIdle::SwLayIdle()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 09. Jun. 94
+|*
+|*************************************************************************/
+/*N*/ void SwLayIdle::ShowIdle( ColorData eName )
+/*N*/ {
+/*N*/ if ( !bIndicator )
+/*N*/ {
+/*N*/ bIndicator = TRUE;
+/*N*/ Window *pWin = pImp->GetShell()->GetWin();
+/*N*/ if ( pWin )
+/*N*/ {
+/*N*/ Rectangle aRect( 0, 0, 5, 5 );
+/*N*/ aRect = pWin->PixelToLogic( aRect );
+/*N*/ pWin->Push( PUSH_FILLCOLOR );
+/*N*/ pWin->SetFillColor( eName );
+/*N*/ pWin->DrawRect( aRect );
+/*N*/ pWin->Pop();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #define SHOW_IDLE( ColorData ) ShowIdle( ColorData )
+/*N*/ #else
+/*N*/ #define SHOW_IDLE( ColorData )
+/*N*/ #endif
+/*N*/ #else
+/*N*/ #define SHOW_IDLE( ColorData )
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* void SwLayIdle::SwLayIdle()
+|*
+|* Ersterstellung MA 30. Oct. 92
+|* Letzte Aenderung MA 23. May. 95
+|*
+|*************************************************************************/
+/*N*/ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) :
+/*N*/ pRoot( pRt ),
+/*N*/ pImp( pI )
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ , bIndicator( FALSE )
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ {
+/*N*/ pImp->pIdleAct = this;
+/*N*/
+/*N*/ SHOW_IDLE( COL_LIGHTRED );
+/*N*/
+/*N*/ pImp->GetShell()->EnableSmooth( FALSE );
+/*N*/
+/*N*/ //Zuerst den Sichtbaren Bereich Spellchecken, nur wenn dort nichts
+/*N*/ //zu tun war wird das IdleFormat angestossen.
+/*N*/ {
+/*N*/ //Formatieren und ggf. Repaint-Rechtecke an der ViewShell vormerken.
+/*N*/ //Dabei muessen kuenstliche Actions laufen, damit es z.B. bei
+/*N*/ //Veraenderungen der Seitenzahl nicht zu unerwuenschten Effekten kommt.
+/*N*/ //Wir merken uns bei welchen Shells der Cursor sichtbar ist, damit
+/*N*/ //wir ihn bei Dokumentaenderung ggf. wieder sichbar machen koennen.
+/*N*/ SvBools aBools;
+/*N*/ ViewShell *pSh = pImp->GetShell();
+/*N*/ do
+/*N*/ { ++pSh->nStartAction;
+/*N*/ BOOL bVis = FALSE;
+/*N*/ if ( pSh->ISA(SwCrsrShell) )
+/*N*/ {
+/*N*/ #ifdef SW_CRSR_TIMER
+/*N*/ ((SwCrsrShell*)pSh)->ChgCrsrTimerFlag( FALSE );
+/*N*/ #endif
+/*N*/ bVis = ((SwCrsrShell*)pSh)->GetCharRect().IsOver(pSh->VisArea());
+/*N*/ }
+/*N*/ aBools.Insert( bVis, aBools.Count() );
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/ } while ( pSh != pImp->GetShell() );
+/*N*/
+/*N*/ SwLayAction aAction( pRoot, pImp );
+/*N*/ aAction.SetInputType( INPUT_ANY );
+/*N*/ aAction.SetIdle( TRUE );
+/*N*/ aAction.SetWaitAllowed( FALSE );
+/*N*/ aAction.Action();
+/*N*/
+/*N*/ //Weitere Start-/EndActions nur auf wenn irgendwo Paints aufgelaufen
+/*N*/ //sind oder wenn sich die Sichtbarkeit des CharRects veraendert hat.
+/*N*/ FASTBOOL bActions = FALSE;
+/*N*/ USHORT nBoolIdx = 0;
+/*N*/ do
+/*N*/ { --pSh->nStartAction;
+/*N*/
+/*N*/ if ( pSh->Imp()->GetRegion() || pSh->Imp()->GetScrollRects() )
+/*?*/ bActions = TRUE;
+/*N*/ else
+/*N*/ {
+/*N*/ SwRect aTmp( pSh->VisArea() );
+/*N*/ pSh->UISizeNotify();
+/*N*/
+/*N*/ bActions |= aTmp != pSh->VisArea() ||
+/*N*/ aBools[nBoolIdx] !=
+/*N*/ ((SwCrsrShell*)pSh)->GetCharRect().IsOver(pSh->VisArea());
+/*N*/ }
+/*N*/
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/ ++nBoolIdx;
+/*N*/ } while ( pSh != pImp->GetShell() );
+/*N*/
+/*N*/ if ( bActions )
+/*N*/ {
+/*?*/ //Start- EndActions aufsetzen. ueber die CrsrShell, damit der
+/*?*/ //Cursor/Selektion und die VisArea korrekt gesetzt werden.
+/*?*/ nBoolIdx = 0;
+/*?*/ do
+/*?*/ { FASTBOOL bCrsrShell = pSh->IsA( TYPE(SwCrsrShell) );
+/*?*/
+/*?*/ if ( bCrsrShell )
+/*?*/ ((SwCrsrShell*)pSh)->SttCrsrMove();
+/*?*/ // else
+/*?*/ // pSh->StartAction();
+/*?*/
+/*?*/ //Wenn Paints aufgelaufen sind, ist es am sinnvollsten schlicht das
+/*?*/ //gesamte Window zu invalidieren. Anderfalls gibt es Paintprobleme
+/*?*/ //deren Loesung unverhaeltnissmaessig aufwendig waere.
+/*?*/ //fix(18176):
+/*?*/ SwViewImp *pImp = pSh->Imp();
+/*?*/ FASTBOOL bUnlock = FALSE;
+/*?*/ if ( pImp->GetRegion() || pImp->GetScrollRects() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pImp->DelRegions();
+/*?*/ }
+/*?*/
+/*?*/ if ( bCrsrShell )
+/*?*/ //Wenn der Crsr sichbar war wieder sichbar machen, sonst
+/*?*/ //EndCrsrMove mit TRUE fuer IdleEnd.
+/*?*/ ((SwCrsrShell*)pSh)->EndCrsrMove( TRUE^aBools[nBoolIdx] );
+/*?*/ // else
+/*?*/ // pSh->EndAction();
+/*?*/ if( bUnlock )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( bCrsrShell )
+/*?*/ }
+/*?*/
+/*?*/ pSh = (ViewShell*)pSh->GetNext();
+/*?*/ ++nBoolIdx;
+/*?*/
+/*?*/ } while ( pSh != pImp->GetShell() );
+/*N*/ }
+/*N*/
+/*N*/ FASTBOOL bInValid;
+/*N*/ const SwViewOption& rVOpt = *pImp->GetShell()->GetViewOptions();
+/*N*/ SwPageFrm *pPg = (SwPageFrm*)pRoot->Lower();
+/*N*/ do
+/*N*/ { bInValid = pPg->IsInvalidCntnt() || pPg->IsInvalidLayout() ||
+/*N*/ pPg->IsInvalidFlyCntnt() || pPg->IsInvalidFlyLayout() ||
+/*N*/ pPg->IsInvalidFlyInCnt();
+/*N*/
+/*N*/ pPg = (SwPageFrm*)pPg->GetNext();
+/*N*/
+/*N*/ } while ( pPg && TRUE^bInValid );
+/*N*/
+/*N*/ if ( TRUE^bInValid )
+/*N*/ pRoot->ResetIdleFormat();
+/*N*/ }
+/*N*/
+/*N*/ pImp->GetShell()->EnableSmooth( TRUE );
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ #endif
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ if ( bIndicator && pImp->GetShell()->GetWin() )
+/*N*/ {
+/*N*/ Rectangle aRect( 0, 0, 5, 5 );
+/*N*/ aRect = pImp->GetShell()->GetWin()->PixelToLogic( aRect );
+/*N*/ pImp->GetShell()->GetWin()->Invalidate( aRect );
+/*N*/ }
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ SwLayIdle::~SwLayIdle()
+/*N*/ {
+/*N*/ pImp->pIdleAct = 0;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_laycache.cxx b/binfilter/bf_sw/source/core/layout/sw_laycache.cxx
new file mode 100644
index 000000000000..10f3527d55ae
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_laycache.cxx
@@ -0,0 +1,1166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+#include <bf_svx/brkitem.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docstat.hxx>
+#include <docary.hxx>
+#include <fmtpdsc.hxx>
+#include <laycache.hxx>
+#include <layhelp.hxx>
+#include <pagefrm.hxx>
+#include <rootfrm.hxx>
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <swtable.hxx>
+#include <tabfrm.hxx>
+#include <rowfrm.hxx>
+#include <ndindex.hxx>
+#include <sectfrm.hxx>
+#include <fmtcntnt.hxx>
+#include <pagedesc.hxx>
+#include <frmtool.hxx>
+#include <dflyobj.hxx>
+#include <dcontact.hxx>
+#include <flyfrm.hxx>
+
+#include <set>
+namespace binfilter {
+
+/*N*/ SV_IMPL_PTRARR( SwPageFlyCache, SwFlyCachePtr )
+
+/*-----------------28.5.2001 10:06------------------
+ * Reading and writing of the layout cache.
+ * The layout cache is not necessary, but it improves
+ * the performance and reduces the text flow during
+ * the formatting.
+ * The layout cache contains the index of the paragraphs/tables
+ * at the top of every page, so it's possible to create
+ * the right count of pages and to distribute the document content
+ * to this pages before the formatting starts.
+ *--------------------------------------------------*/
+
+/*N*/ void SwLayoutCache::Read( SvStream &rStream )
+/*N*/ {
+/*N*/ if( !pImpl )
+/*N*/ {
+/*N*/ pImpl = new SwLayCacheImpl;
+/*N*/ if( !pImpl->Read( rStream ) )
+/*N*/ {
+/*?*/ delete pImpl;
+/*?*/ pImpl = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+//-----------------------------------------------------------------------------
+
+/*N*/ void SwLayCacheImpl::Insert( USHORT nType, ULONG nIndex, xub_StrLen nOffset )
+/*N*/ {
+/*N*/ aType.Insert( nType, aType.Count() );
+/*N*/ SvULongs::Insert( nIndex, SvULongs::Count() );
+/*N*/ aOffset.Insert( nOffset, aOffset.Count() );
+/*N*/ }
+
+/*N*/ BOOL SwLayCacheImpl::Read( SvStream& rStream )
+/*N*/ {
+/*N*/ SwLayCacheIoImpl aIo( rStream, FALSE );
+/*N*/ if( aIo.GetMajorVersion() > SW_LAYCACHE_IO_VERSION_MAJOR )
+/*?*/ return FALSE;
+/*N*/
+/*N*/ // Due to an evil bug in the layout cache (#102759#), we cannot trust the
+/*N*/ // sizes of fly frames which have been written using the "old" layout cache.
+/*N*/ // This flag should indicate that we do not want to trust the width and
+/*N*/ // height of fly frames
+/*N*/ bUseFlyCache = aIo.GetMinorVersion() >= 1;
+/*N*/
+/*N*/ BYTE cFlags;
+/*N*/ UINT32 nIndex, nOffset;
+/*N*/
+/*N*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES );
+/*N*/ aIo.OpenFlagRec();
+/*N*/ aIo.CloseFlagRec();
+/*N*/ while( aIo.BytesLeft() && !aIo.HasError() )
+/*N*/ {
+/*N*/ switch( aIo.Peek() )
+/*N*/ {
+/*N*/ case SW_LAYCACHE_IO_REC_PARA:
+/*N*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_PARA );
+/*N*/ cFlags = aIo.OpenFlagRec();
+/*N*/ aIo.GetStream() >> nIndex;
+/*N*/ if( (cFlags & 0x01) != 0 )
+/*N*/ aIo.GetStream() >> nOffset;
+/*N*/ else
+/*N*/ nOffset = STRING_LEN;
+/*N*/ aIo.CloseFlagRec();
+/*N*/ Insert( SW_LAYCACHE_IO_REC_PARA, nIndex, (xub_StrLen)nOffset );
+/*N*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_PARA );
+/*N*/ break;
+/*N*/ case SW_LAYCACHE_IO_REC_TABLE:
+/*?*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_TABLE );
+/*?*/ aIo.OpenFlagRec();
+/*?*/ aIo.GetStream() >> nIndex
+/*?*/ >> nOffset;
+/*?*/ Insert( SW_LAYCACHE_IO_REC_TABLE, nIndex, (xub_StrLen)nOffset );
+/*?*/ aIo.CloseFlagRec();
+/*?*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_TABLE );
+/*?*/ break;
+/*N*/ case SW_LAYCACHE_IO_REC_FLY:
+/*N*/ {
+/*N*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_FLY );
+/*N*/ aIo.OpenFlagRec();
+/*N*/ aIo.CloseFlagRec();
+/*N*/ long nX, nY, nW, nH;
+/*N*/ USHORT nPgNum;
+/*N*/ aIo.GetStream() >> nPgNum >> nIndex
+/*N*/ >> nX >> nY >> nW >> nH;
+/*N*/ SwFlyCache* pFly = new SwFlyCache( nPgNum, nIndex, nX, nY, nW, nH );
+/*N*/ aFlyCache.Insert( pFly, aFlyCache.Count() );
+/*N*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_FLY );
+/*N*/ break;
+/*N*/ }
+/*N*/ default:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 aIo.SkipRec();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_PAGES );
+/*N*/
+/*N*/ return !aIo.HasError();
+/*N*/ }
+
+/*-----------------28.5.2001 10:19------------------
+ * SwLayoutCache::Write(..)
+ * writes the index (more precise: the difference between
+ * the index and the first index of the document content)
+ * of the first paragraph/table at the top of every page.
+ * If at the top of a page is the rest of a paragraph/table
+ * from the bottom of the previous page, the character/row
+ * number is stored, too.
+ * The position, size and page number of the text frames
+ * are stored, too
+ * --------------------------------------------------*/
+
+/*N*/ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
+/*N*/ {
+/*N*/ if( rDoc.GetRootFrm() ) // the layout itself ..
+/*N*/ {
+/*N*/ SwLayCacheIoImpl aIo( rStream, TRUE );
+/*N*/ // We want to save the relative index, so we need the index
+/*N*/ // of the first content
+/*N*/ ULONG nStartOfContent = rDoc.GetNodes().GetEndOfContent().
+/*N*/ FindStartNode()->GetIndex();
+/*N*/ // The first page..
+/*N*/ SwPageFrm* pPage = (SwPageFrm*)rDoc.GetRootFrm()->Lower();
+/*N*/
+/*N*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_PAGES );
+/*N*/ aIo.OpenFlagRec( 0, 0 );
+/*N*/ aIo.CloseFlagRec();
+/*N*/ while( pPage )
+/*N*/ {
+/*N*/ if( pPage->GetPrev() )
+/*N*/ {
+/*N*/ SwLayoutFrm* pLay = pPage->FindBodyCont();
+/*N*/ SwFrm* pTmp = pLay ? pLay->ContainsAny() : NULL;
+/*N*/ // We are only interested in paragraph or table frames,
+/*N*/ // a section frames contains paragraphs/tables.
+/*N*/ if( pTmp && pTmp->IsSctFrm() )
+/*?*/ pTmp = ((SwSectionFrm*)pTmp)->ContainsAny();
+/*N*/
+/*N*/ if( pTmp ) // any content
+/*N*/ {
+/*N*/ if( pTmp->IsTxtFrm() )
+/*N*/ {
+/*N*/ ULONG nNdIdx = ((SwTxtFrm*)pTmp)->GetNode()->GetIndex();
+/*N*/ if( nNdIdx > nStartOfContent )
+/*N*/ {
+/*N*/ /* Open Paragraph Record */
+/*N*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_PARA );
+/*N*/ BOOL bFollow = ((SwTxtFrm*)pTmp)->IsFollow();
+/*N*/ aIo.OpenFlagRec( bFollow ? 0x01 : 0x00,
+/*N*/ bFollow ? 8 : 4 );
+/*N*/ nNdIdx -= nStartOfContent;
+/*N*/ aIo.GetStream() << static_cast<sal_uInt32>(nNdIdx);
+/*N*/ if( bFollow )
+/*?*/ aIo.GetStream() << static_cast<sal_uInt32>(((SwTxtFrm*)pTmp)->GetOfst());
+/*N*/ aIo.CloseFlagRec();
+/*N*/ /* Close Paragraph Record */
+/*N*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_PARA );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pTmp->IsTabFrm() )
+/*N*/ {
+/*N*/ SwTabFrm* pTab = (SwTabFrm*)pTmp;
+/*N*/ ULONG nOfst = STRING_LEN;
+/*N*/ if( pTab->IsFollow() )
+/*N*/ {
+/*N*/ // If the table is a follow, we have to look for the
+/*N*/ // master and to count all rows to get the row number
+/*N*/ nOfst = 0;
+/*N*/ while( pTab->IsFollow() )
+/*N*/ pTab = pTab->FindMaster();
+/*N*/ while( pTab != pTmp )
+/*N*/ {
+/*N*/ SwFrm* pSub = pTab->Lower();
+/*N*/ while( pSub )
+/*N*/ {
+/*N*/ ++nOfst;
+/*N*/ pSub = pSub->GetNext();
+/*N*/ }
+/*N*/ pTab = pTab->GetFollow();
+/*N*/ ASSERT( pTab, "Table follow without master" );
+/*N*/ }
+/*N*/ }
+/*N*/ do
+/*N*/ {
+/*N*/ ULONG nNdIdx =
+/*N*/ pTab->GetTable()->GetTableNode()->GetIndex();
+/*N*/ if( nNdIdx > nStartOfContent )
+/*N*/ {
+/*N*/ /* Open Table Record */
+/*N*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_TABLE );
+/*N*/ aIo.OpenFlagRec( 0, 8 );
+/*N*/ nNdIdx -= nStartOfContent;
+/*N*/ aIo.GetStream() << static_cast<sal_uInt32>(nNdIdx)
+/*N*/ << static_cast<sal_uInt32>(nOfst);
+/*N*/ aIo.CloseFlagRec();
+/*N*/ /* Close Table Record */
+/*N*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_TABLE );
+/*N*/ }
+/*N*/ // If the table has a follow on the next page,
+/*N*/ // we know already the row number and store this
+/*N*/ // immediately.
+/*N*/ if( pTab->GetFollow() )
+/*N*/ {
+/*N*/ if( nOfst == STRING_LEN )
+/*?*/ nOfst = 0;
+/*N*/ do
+/*N*/ {
+/*N*/ SwFrm* pSub = pTab->Lower();
+/*N*/ while( pSub )
+/*N*/ {
+/*N*/ ++nOfst;
+/*N*/ pSub = pSub->GetNext();
+/*N*/ }
+/*N*/ pTab = pTab->GetFollow();
+/*N*/ SwPageFrm *pTabPage = pTab->FindPageFrm();
+/*N*/ if( pTabPage != pPage )
+/*N*/ {
+/*N*/ ASSERT( pPage->GetPhyPageNum() <
+/*N*/ pTabPage->GetPhyPageNum(),
+/*N*/ "Looping Tableframes" );
+/*N*/ pPage = pTabPage;
+/*N*/ break;
+/*N*/ }
+/*?*/ } while ( pTab->GetFollow() );
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/ } while( pTab );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( pPage->GetSortedObjs() )
+/*N*/ {
+/*?*/ SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*?*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*?*/ {
+/*?*/ SdrObject *pO = rObjs[i];
+/*?*/ if ( pO->IsWriterFlyFrame() )
+/*?*/ {
+/*?*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*?*/ if( pFly->Frm().Left() != WEIT_WECH &&
+/*?*/ !pFly->GetAnchor()->FindFooterOrHeader() )
+/*?*/ {
+/*?*/ const SwContact *pC = (SwContact*)GetUserCall(pO);
+/*?*/ if( pC )
+/*?*/ {
+/*?*/ sal_uInt32 nOrdNum = pO->GetOrdNum();
+/*?*/ USHORT nPageNum = pPage->GetPhyPageNum();
+/*?*/ /* Open Fly Record */
+/*?*/ aIo.OpenRec( SW_LAYCACHE_IO_REC_FLY );
+/*?*/ aIo.OpenFlagRec( 0, 0 );
+/*?*/ aIo.CloseFlagRec();
+/*?*/ SwRect &rRct = pFly->Frm();
+/*?*/ sal_Int32 nX = rRct.Left() - pPage->Frm().Left();
+/*?*/ sal_Int32 nY = rRct.Top() - pPage->Frm().Top();
+/*?*/ aIo.GetStream() << nPageNum << nOrdNum
+/*?*/ << nX << nY << rRct.Width()
+/*?*/ << rRct.Height();
+/*?*/ /* Close Fly Record */
+/*?*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_FLY );
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ }
+/*N*/ aIo.CloseRec( SW_LAYCACHE_IO_REC_PAGES );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwLayoutCache::ClearImpl()
+/*N*/ {
+/*N*/ if( !IsLocked() )
+/*N*/ {
+/*N*/ delete pImpl;
+/*N*/ pImpl = 0;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwLayoutCache::~SwLayoutCache()
+/*N*/ {
+/*N*/ ASSERT( !nLockCount, "Deleting a locked SwLayoutCache!?" );
+/*N*/ delete pImpl;
+/*N*/ }
+
+/*-----------------28.5.2001 10:47------------------
+ * SwActualSection,
+ * a help class to create not nested section frames
+ * for nested sections.
+ * --------------------------------------------------*/
+
+/*N*/ SwActualSection::SwActualSection( SwActualSection *pUp,
+/*N*/ SwSectionFrm *pSect,
+/*N*/ SwSectionNode *pNd ) :
+/*N*/ pUpper( pUp ),
+/*N*/ pSectFrm( pSect ),
+/*N*/ pSectNode( pNd )
+/*N*/ {
+/*N*/ if ( !pSectNode )
+/*N*/ {
+/*?*/ const SwNodeIndex *pIndex = pSect->GetFmt()->GetCntnt().GetCntntIdx();
+/*?*/ pSectNode = pSect->GetFmt()->GetDoc()->GetNodes()[*pIndex]->
+/*?*/ FindSectionNode();
+/*N*/ }
+/*N*/ }
+
+/*-----------------28.5.2001 11:09------------------
+ * SwLayHelper
+ * is the helper class, which utilizes the layout cache information
+ * to distribute the document content to the rigth pages.
+ * It's used by the _InsertCnt(..)-function.
+ * If there's no layout cache, the distibution to the pages is more
+ * a guess, but a guess with statistical background.
+ * --------------------------------------------------*/
+
+/*N*/ SwLayHelper::SwLayHelper( SwDoc *pD, SwFrm* &rpF, SwFrm* &rpP, SwPageFrm* &rpPg,
+/*N*/ SwLayoutFrm* &rpL, SwActualSection* &rpA, BOOL &rB,
+/*N*/ ULONG nNodeIndex, BOOL bCache )
+/*N*/ : rpFrm( rpF ), rpPrv( rpP ), rpPage( rpPg ), rpLay( rpL ),
+/*N*/ rpActualSection( rpA ), rbBreakAfter(rB), pDoc(pD), nMaxParaPerPage( 25 ),
+/*N*/ nParagraphCnt( bCache ? 0 : USHRT_MAX ), bFirst( bCache )
+/*N*/ {
+/*N*/ pImpl = pDoc->GetLayoutCache() ? pDoc->GetLayoutCache()->LockImpl() : NULL;
+/*N*/ if( pImpl )
+/*N*/ {
+/*?*/ nMaxParaPerPage = 1000;
+/*?*/ nStartOfContent = pDoc->GetNodes().GetEndOfContent().FindStartNode()
+/*?*/ ->GetIndex();
+/*?*/ nNodeIndex -= nStartOfContent;
+/*?*/ nIndex = 0;
+/*?*/ nFlyIdx = 0;
+/*?*/ while( nIndex < pImpl->Count() && (*pImpl)[ nIndex ] < nNodeIndex )
+/*?*/ ++nIndex;
+/*?*/ if( nIndex >= pImpl->Count() )
+/*?*/ {
+/*?*/ pDoc->GetLayoutCache()->UnlockImpl();
+/*?*/ pImpl = NULL;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nIndex = USHRT_MAX;
+/*N*/ nStartOfContent = ULONG_MAX;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwLayHelper::~SwLayHelper()
+/*N*/ {
+/*N*/ if( pImpl )
+/*N*/ {
+/*?*/ ASSERT( pDoc && pDoc->GetLayoutCache(), "Missing layoutcache" );
+/*?*/ pDoc->GetLayoutCache()->UnlockImpl();
+/*N*/ }
+/*N*/ }
+
+/*-----------------23.5.2001 16:40------------------
+ * SwLayHelper::CalcPageCount() does not really calculate the page count,
+ * it returns the page count value from the layout cache, if available,
+ * otherwise it estimates the page count.
+ * --------------------------------------------------*/
+
+/*N*/ ULONG SwLayHelper::CalcPageCount()
+/*N*/ {
+/*N*/ ULONG nPgCount;
+/*N*/ SwLayCacheImpl *pCache = pDoc->GetLayoutCache() ?
+/*N*/ pDoc->GetLayoutCache()->LockImpl() : NULL;
+/*N*/ if( pCache )
+/*N*/ {
+/*?*/ nPgCount = pCache->Count() + 1;
+/*?*/ pDoc->GetLayoutCache()->UnlockImpl();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nPgCount = pDoc->GetDocStat().nPage;
+/*N*/ if ( nPgCount <= 10 ) // no page insertion for less than 10 pages
+/*N*/ nPgCount = 0;
+/*N*/ ULONG nNdCount = pDoc->GetDocStat().nPara;
+/*N*/ if ( nNdCount <= 1 )
+/*N*/ {
+/*N*/ //Estimates the number of paragraphs.
+/*N*/ ULONG nTmp = pDoc->GetNodes().GetEndOfContent().GetIndex() -
+/*N*/ pDoc->GetNodes().GetEndOfExtras().GetIndex();
+/*N*/ //Tables have a little overhead..
+/*N*/ nTmp -= pDoc->GetTblFrmFmts()->Count() * 25;
+/*N*/ //Fly frames, too ..
+/*N*/ nTmp -= (pDoc->GetNodes().GetEndOfAutotext().GetIndex() -
+/*N*/ pDoc->GetNodes().GetEndOfInserts().GetIndex()) / 3 * 5;
+/*N*/ if ( nTmp > 0 )
+/*N*/ nNdCount = nTmp;
+/*N*/ }
+/*N*/ if ( nNdCount > 100 ) // no estimation below this value
+/*N*/ {
+/*N*/ if ( nPgCount > 0 )
+/*N*/ nMaxParaPerPage = nNdCount / nPgCount;
+/*N*/ else
+/*N*/ {
+/*N*/ nMaxParaPerPage = Max( ULONG(20),
+/*N*/ ULONG(20 + nNdCount / 1000 * 3) );
+/*N*/ #ifdef PM2
+/*N*/ const ULONG nMax = 49;
+/*N*/ #elif MAC
+/*N*/ const ULONG nMax = 56;
+/*N*/ #elif UNIX
+/*N*/ const ULONG nMax = 57;
+/*N*/ #else
+/*N*/ const ULONG nMax = 53;
+/*N*/ #endif
+/*N*/ nMaxParaPerPage = Min( nMaxParaPerPage, nMax );
+/*N*/ nPgCount = nNdCount / nMaxParaPerPage;
+/*N*/ }
+/*N*/ if ( nNdCount < 1000 )
+/*N*/ nPgCount = 0;// no progress bar for small documents
+/*N*/ if ( pDoc->IsBrowseMode() )
+/*?*/ nMaxParaPerPage *= 6;
+/*N*/ }
+/*N*/ }
+/*N*/ return nPgCount;
+/*N*/ }
+
+/*-----------------23.5.2001 16:44------------------
+ * SwLayHelper::CheckInsertPage()
+ * inserts a page and return TRUE, if
+ * - the break after flag is set
+ * - the actual content wants a break before
+ * - the maximum count of paragraph/rows is reached
+ *
+ * The break after flag is set, if the actual content
+ * wants a break after.
+ * --------------------------------------------------*/
+
+/*N*/ BOOL SwLayHelper::CheckInsertPage()
+/*N*/ {
+/*N*/ FASTBOOL bEnd = 0 == rpPage->GetNext();
+/*N*/ const SwAttrSet *pAttr = rpFrm->GetAttrSet();
+/*N*/ const SvxFmtBreakItem &rBrk = pAttr->GetBreak();
+/*N*/ const SwFmtPageDesc &rDesc = pAttr->GetPageDesc();
+/*N*/ const SwPageDesc *pDesc = rDesc.GetPageDesc();
+/*N*/
+/*N*/ BOOL bBrk = nParagraphCnt > nMaxParaPerPage || rbBreakAfter;
+/*N*/ rbBreakAfter = rBrk.GetBreak() == SVX_BREAK_PAGE_AFTER ||
+/*N*/ rBrk.GetBreak() == SVX_BREAK_PAGE_BOTH;
+/*N*/ if ( !bBrk )
+/*N*/ bBrk = rBrk.GetBreak() == SVX_BREAK_PAGE_BEFORE ||
+/*N*/ rBrk.GetBreak() == SVX_BREAK_PAGE_BOTH;
+/*N*/
+/*N*/ if ( bBrk || pDesc )
+/*N*/ {
+/*N*/ USHORT nPgNum = 0;
+/*N*/ if ( !pDesc )
+/*N*/ pDesc = rpPage->GetPageDesc()->GetFollow();
+/*N*/ else
+/*N*/ {
+/*N*/ if ( 0 != (nPgNum = rDesc.GetNumOffset()) )
+/*N*/ ((SwRootFrm*)rpPage->GetUpper())->SetVirtPageNum(TRUE);
+/*N*/ }
+/*N*/ BOOL bOdd = !rpPage->OnRightPage();
+/*N*/ BOOL bInsertEmpty = FALSE;
+/*N*/ if( nPgNum && bOdd != ( ( nPgNum % 2 ) != 0 ) )
+/*N*/ {
+/*N*/ bOdd = !bOdd;
+/*N*/ bInsertEmpty = TRUE;
+/*N*/ }
+/*N*/ ::binfilter::InsertNewPage( (SwPageDesc&)*pDesc, rpPage->GetUpper(),
+/*N*/ bOdd, bInsertEmpty, FALSE, rpPage->GetNext() );
+/*N*/ if ( bEnd )
+/*N*/ {
+/*N*/ ASSERT( rpPage->GetNext(), "Keine neue Seite?" );
+/*N*/ do
+/*N*/ { rpPage = (SwPageFrm*)rpPage->GetNext();
+/*N*/ } while ( rpPage->GetNext() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( rpPage->GetNext(), "Keine neue Seite?" );
+/*?*/ rpPage = (SwPageFrm*)rpPage->GetNext();
+/*?*/ if ( rpPage->IsEmptyPage() )
+/*?*/ {
+/*?*/ ASSERT( rpPage->GetNext(), "Keine neue Seite?" );
+/*?*/ rpPage = (SwPageFrm*)rpPage->GetNext();
+/*?*/ }
+/*N*/ }
+/*N*/ rpLay = rpPage->FindBodyCont();
+/*N*/ while( rpLay->Lower() )
+/*N*/ rpLay = (SwLayoutFrm*)rpLay->Lower();
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*-----------------28.5.2001 11:31------------------
+ * SwLayHelper::CheckInsert
+ * is the entry point for the _InsertCnt-function.
+ * The document content index is checked either it is
+ * in the layout cache either it's time to insert a page
+ * cause the maximal estimation of content per page is reached.
+ * A really big table or long paragraph may contains more than
+ * one page, in this case the needed count of pages will inserted.
+ * --------------------------------------------------*/
+
+/*N*/ BOOL SwLayHelper::CheckInsert( ULONG nNodeIndex )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ BOOL bLongTab = FALSE;
+/*N*/ ULONG nMaxRowPerPage;
+/*N*/ nNodeIndex -= nStartOfContent;
+/*N*/ USHORT nRows;
+/*N*/ if( rpFrm->IsTabFrm() )
+/*N*/ {
+/*N*/ //Inside a table counts every row as a paragraph
+/*N*/ SwFrm *pLow = ((SwTabFrm*)rpFrm)->Lower();
+/*N*/ nRows = 0;
+/*N*/ do
+/*N*/ {
+/*N*/ ++nRows;
+/*N*/ pLow = pLow->GetNext();
+/*N*/ } while ( pLow );
+/*N*/ nParagraphCnt += nRows;
+/*N*/ if( !pImpl && nParagraphCnt > nMaxParaPerPage + 10 )
+/*N*/ {
+/*N*/ // OD 09.04.2003 #108698# - improve heuristics:
+/*N*/ // Assume that a table, which has more than three times the quantity
+/*N*/ // of maximal paragraphs per page rows, consists of rows, which have
+/*N*/ // the height of a normal paragraph. Thus, allow as much rows per page
+/*N*/ // as much paragraphs are allowed.
+/*N*/ if ( nRows > ( 3*nMaxParaPerPage ) )
+/*N*/ {
+/*N*/ nMaxRowPerPage = nMaxParaPerPage;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwFrm *pTmp = ((SwTabFrm*)rpFrm)->Lower();
+/*N*/ if( pTmp->GetNext() )
+/*N*/ pTmp = pTmp->GetNext();
+/*N*/ pTmp = ((SwRowFrm*)pTmp)->Lower();
+/*N*/ USHORT nCnt = 0;
+/*N*/ do
+/*N*/ {
+/*N*/ ++nCnt;
+/*N*/ pTmp = pTmp->GetNext();
+/*N*/ } while( pTmp );
+/*N*/ nMaxRowPerPage = Max( ULONG(2), nMaxParaPerPage / nCnt );
+/*N*/ }
+/*N*/ bLongTab = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ ++nParagraphCnt;
+/*N*/ if( bFirst && pImpl && nIndex < pImpl->Count() &&
+/*N*/ pImpl->GetBreakIndex( nIndex ) == nNodeIndex &&
+/*N*/ ( pImpl->GetBreakOfst( nIndex ) < STRING_LEN ||
+/*N*/ ( ++nIndex < pImpl->Count() &&
+/*N*/ pImpl->GetBreakIndex( nIndex ) == nNodeIndex ) ) )
+/*?*/ bFirst = FALSE;
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ ULONG nBreakIndex = ( pImpl && nIndex < pImpl->Count() ) ?
+/*N*/ pImpl->GetBreakIndex(nIndex) : 0xffff;
+/*N*/ #endif
+/*N*/ // OD 09.04.2003 #108698# - always split a big tables.
+/*N*/ if ( !bFirst ||
+/*N*/ ( rpFrm->IsTabFrm() && bLongTab )
+/*N*/ )
+/*N*/ {
+/*N*/ ULONG nRowCount = 0;
+/*N*/ do
+/*N*/ {
+/*N*/ if( pImpl || bLongTab )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ ULONG nBrkIndex = ( pImpl && nIndex < pImpl->Count() ) ?
+/*N*/ pImpl->GetBreakIndex(nIndex) : 0xffff;
+/*N*/ #endif
+/*N*/ xub_StrLen nOfst = STRING_LEN;
+/*N*/ USHORT nType = SW_LAYCACHE_IO_REC_PAGES;
+/*N*/ if( bLongTab )
+/*N*/ {
+/*N*/ rbBreakAfter = sal_True;
+/*N*/ nOfst = nRowCount + nMaxRowPerPage;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ while( nIndex < pImpl->Count() &&
+/*?*/ pImpl->GetBreakIndex(nIndex) < nNodeIndex)
+/*?*/ ++nIndex;
+/*?*/ if( nIndex < pImpl->Count() &&
+/*?*/ pImpl->GetBreakIndex(nIndex) == nNodeIndex )
+/*?*/ {
+/*?*/ nType = pImpl->GetBreakType( nIndex );
+/*?*/ nOfst = pImpl->GetBreakOfst( nIndex++ );
+/*?*/ rbBreakAfter = sal_True;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nOfst < STRING_LEN )
+/*N*/ {
+/*N*/ sal_Bool bSplit = sal_False;
+/*N*/ sal_Bool bRepeat;
+/*N*/ if( !bLongTab && rpFrm->IsTxtFrm() &&
+/*N*/ SW_LAYCACHE_IO_REC_PARA == nType &&
+/*N*/ nOfst<((SwTxtFrm*)rpFrm)->GetTxtNode()->GetTxt().Len() )
+/*?*/ bSplit = sal_True;
+/*N*/ else if( rpFrm->IsTabFrm() && nRowCount < nOfst &&
+/*N*/ ( bLongTab || SW_LAYCACHE_IO_REC_TABLE == nType ) )
+/*N*/ {
+/*N*/ bRepeat = ((SwTabFrm*)rpFrm)->
+/*N*/ GetTable()->IsHeadlineRepeat();
+/*N*/ bSplit = nOfst < nRows;
+/*N*/ bLongTab = bLongTab && bSplit;
+/*N*/ }
+/*N*/ if( bSplit )
+/*N*/ {
+/*N*/ rpFrm->InsertBehind( rpLay, rpPrv );
+/*N*/ rpFrm->Frm().Pos() = rpLay->Frm().Pos();
+/*N*/ rpFrm->Frm().Pos().Y() += 1;
+/*N*/ rpPrv = rpFrm;
+/*N*/ if( rpFrm->IsTabFrm() )
+/*N*/ {
+/*N*/ SwTabFrm* pTab = (SwTabFrm*)rpFrm;
+/*N*/ SwFrm *pRow = pTab->Lower();
+/*N*/ SwTabFrm *pFoll = new SwTabFrm( *pTab );
+/*N*/
+/*N*/ SwFrm *pPrv;
+/*N*/ if( bRepeat )
+/*N*/ {
+/*N*/ bDontCreateObjects = TRUE; //frmtool
+/*N*/ SwRowFrm *pHeadline = new SwRowFrm(
+/*N*/ *pTab->GetTable()->GetTabLines()[0] );
+/*N*/ pHeadline->InsertBefore( pFoll, 0 );
+/*N*/ bDontCreateObjects = FALSE;
+/*N*/ pPrv = pFoll->Lower();
+/*N*/ ++nRows;
+/*N*/ }
+/*N*/ else
+/*?*/ pPrv = 0;
+/*N*/ while( pRow && nRowCount < nOfst )
+/*N*/ {
+/*N*/ pRow = pRow->GetNext();
+/*N*/ ++nRowCount;
+/*N*/ }
+/*N*/ while ( pRow )
+/*N*/ {
+/*N*/ SwFrm* pNxt = pRow->GetNext();
+/*N*/ pRow->Remove();
+/*N*/ pRow->InsertBehind( pFoll, pPrv );
+/*N*/ pPrv = pRow;
+/*N*/ pRow = pNxt;
+/*N*/ }
+/*N*/ rpFrm = pFoll;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ SwTxtFrm *pNew = new SwTxtFrm( ((SwTxtFrm*)rpFrm)->
+/*?*/ GetTxtNode() );
+/*?*/ pNew->_SetIsFollow( sal_True );
+/*?*/ pNew->ManipOfst( nOfst );
+/*?*/ pNew->SetFollow( ((SwTxtFrm*)rpFrm)->GetFollow() );
+/*?*/ ((SwTxtFrm*)rpFrm)->SetFollow( pNew );
+/*?*/ rpFrm = pNew;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwPageFrm* pLastPage = rpPage;
+/*N*/ if( CheckInsertPage() )
+/*N*/ {
+/*N*/ _CheckFlyCache( pLastPage );
+/*N*/ if( rpPrv && rpPrv->IsTxtFrm() && !rpPrv->GetValidSizeFlag() )
+/*N*/ rpPrv->Frm().Height( rpPrv->GetUpper()->Prt().Height() );
+/*N*/
+/*N*/ bRet = TRUE;
+/*N*/ rpPrv = 0;
+/*N*/ nParagraphCnt = 0;
+/*N*/
+/*N*/ if ( rpActualSection )
+/*N*/ {
+/*N*/ //Hatte der SectionFrm ueberhaupt Inhalt? Wenn
+/*N*/ //nicht kann er gleich umgehaengt werden.
+/*N*/ SwSectionFrm *pSct;
+/*N*/ BOOL bInit = FALSE;
+/*N*/ if ( !rpActualSection->GetSectionFrm()->ContainsCntnt())
+/*N*/ {
+/*N*/ pSct = rpActualSection->GetSectionFrm();
+/*N*/ pSct->Remove();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pSct = new SwSectionFrm(
+/*N*/ *rpActualSection->GetSectionFrm(), FALSE );
+/*N*/ rpActualSection->GetSectionFrm()->SimpleFormat();
+/*N*/ bInit = TRUE;
+/*N*/ }
+/*N*/ rpActualSection->SetSectionFrm( pSct );
+/*N*/ pSct->InsertBehind( rpLay, 0 );
+/*N*/ if( bInit )
+/*N*/ pSct->Init();
+/*N*/ pSct->Frm().Pos() = rpLay->Frm().Pos();
+/*N*/ pSct->Frm().Pos().Y() += 1; //wg. Benachrichtigungen.
+/*N*/
+/*N*/ rpLay = pSct;
+/*N*/ if ( rpLay->Lower() && rpLay->Lower()->IsLayoutFrm() )
+/*?*/ rpLay = rpLay->GetNextLayoutLeaf();
+/*N*/ }
+/*N*/ }
+/*N*/ } while( bLongTab || ( pImpl && nIndex < pImpl->Count() &&
+/*N*/ (*pImpl)[ nIndex ] == nNodeIndex ) );
+/*N*/ }
+/*N*/ bFirst = FALSE;
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ struct SdrObjectCompare
+/*N*/ {
+/*N*/ bool operator()( const SdrObject* pF1, const SdrObject* pF2 ) const
+/*N*/ {
+/*N*/ return pF1->GetOrdNum() < pF2->GetOrdNum();
+/*N*/ }
+/*N*/ };
+
+/*N*/ struct FlyCacheCompare
+/*N*/ {
+/*N*/ bool operator()( const SwFlyCache* pC1, const SwFlyCache* pC2 ) const
+/*N*/ {
+/*N*/ return pC1->nOrdNum < pC2->nOrdNum;
+/*N*/ }
+/*N*/ };
+
+ /*-----------------28.6.2001 14:40------------------
+ * SwLayHelper::_CheckFlyCache(..)
+ * If a new page is inserted, the last page is analysed.
+ * If there are text frames with default position, the fly cache
+ * is checked, if these frames are stored in the cache.
+ * --------------------------------------------------*/
+
+/*N*/ void SwLayHelper::_CheckFlyCache( SwPageFrm* pPage )
+/*N*/ {
+/*N*/ if( !pImpl || !pPage )
+/*N*/ return;
+/*N*/ USHORT nFlyCount = pImpl->GetFlyCount();
+/*N*/ // Any text frames at the page, fly cache avaiable?
+/*N*/ if( pPage->GetSortedObjs() && nFlyIdx < nFlyCount )
+/*N*/ {
+/*N*/ SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*N*/ USHORT nPgNum = pPage->GetPhyPageNum();
+
+/*
+
+ //
+ // NOTE: This code assumes that all objects have already been
+ // inserted into the drawing layout, so that the cached objects
+ // can be identified by their ordnum. Unfortunately this function
+ // is called with page n if page n+1 has been inserted. Thus
+ // not all the objects have been inserted and the ordnums cannot
+ // be used to identify the objects.
+ //
+
+ for ( USHORT i = 0; i < rObjs.Count(); ++i ) // check objects
+ {
+ SdrObject *pO = rObjs[i];
+ if ( pO->IsWriterFlyFrame() ) // a text frame?
+ {
+ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+ if( pFly->Frm().Left() == WEIT_WECH && pFly->GetAnchor() &&
+ !pFly->GetAnchor()->FindFooterOrHeader() )
+ { // Only frame with default position and not in header/footer
+ const SwContact *pC = (SwContact*)GetUserCall(pO);
+ if( pC )
+ {
+ ULONG nOrdNum = pO->GetOrdNum(); // the Id
+ SwFlyCache* pFlyC;
+ while( nFlyIdx < nFlyCount && ( pFlyC = pImpl->
+ GetFlyCache(nFlyIdx) )->nPageNum < nPgNum)
+ ++nFlyIdx;
+ if( nFlyIdx < nFlyCount &&
+ pFlyC->nPageNum == nPgNum )
+ {
+ USHORT nIdx = nFlyIdx;
+ while( nIdx < nFlyCount && ( pFlyC = pImpl->
+ GetFlyCache( nIdx ) )->nPageNum == nPgNum &&
+ pFlyC->nOrdNum != nOrdNum )
+ ++nIdx;
+ if( nIdx < nFlyCount && pFlyC->nPageNum == nPgNum &&
+ pFlyC->nOrdNum == nOrdNum )
+ { // we get the stored information
+ pFly->Frm().Pos().X() = pFlyC->Left() +
+ pPage->Frm().Left();
+ pFly->Frm().Pos().Y() = pFlyC->Top() +
+ pPage->Frm().Top();
+ pFly->Frm().Width( pFlyC->Width() );
+ pFly->Frm().Height( pFlyC->Height() );
+ }
+ }
+ }
+ }
+ }
+ }
+ */
+
+ //
+ // NOTE: Here we do not use the absolute ordnums but
+ // relative ordnums for the objects on this page.
+
+ // skip fly frames from pages before the current page
+/*N*/ SwFlyCache* pFlyC;
+/*N*/ while( nFlyIdx < nFlyCount && ( pFlyC = pImpl->
+/*N*/ GetFlyCache(nFlyIdx) )->nPageNum < nPgNum)
+/*N*/ ++nFlyIdx;
+/*N*/
+/*N*/ // sort cached objects on this page by ordnum
+/*N*/ std::set< const SwFlyCache*, FlyCacheCompare > aFlyCacheSet;
+/*N*/ USHORT nIdx = nFlyIdx;
+/*N*/
+/*N*/ while( nIdx < nFlyCount && ( pFlyC = pImpl->
+/*N*/ GetFlyCache( nIdx ) )->nPageNum == nPgNum )
+/*N*/ {
+/*N*/ aFlyCacheSet.insert( pFlyC );
+/*N*/ ++nIdx;
+/*N*/ }
+/*N*/
+/*N*/ // sort objects on this page by ordnum
+/*N*/ std::set< const SdrObject*, SdrObjectCompare > aFlySet;
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject* pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() ) // a text frame?
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if( pFly->GetAnchor() &&
+/*N*/ !pFly->GetAnchor()->FindFooterOrHeader() )
+/*N*/ {
+/*N*/ const SwContact *pC = (SwContact*)GetUserCall(pO);
+/*N*/ if( pC )
+/*N*/ {
+/*N*/ aFlySet.insert( pO );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( aFlyCacheSet.size() == aFlySet.size() )
+/*N*/ {
+/*N*/ std::set< const SwFlyCache*, FlyCacheCompare >::iterator aFlyCacheSetIt =
+/*N*/ aFlyCacheSet.begin();
+/*N*/ std::set< const SdrObject*, SdrObjectCompare >::iterator aFlySetIt =
+/*N*/ aFlySet.begin();
+/*N*/
+/*N*/ while ( aFlyCacheSetIt != aFlyCacheSet.end() )
+/*N*/ {
+/*N*/ const SwFlyCache* pFlyC = *aFlyCacheSetIt;
+/*N*/ SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)*aFlySetIt)->GetFlyFrm();
+/*N*/
+/*N*/ if ( pFly->Frm().Left() == WEIT_WECH )
+/*N*/ {
+/*N*/ // we get the stored information
+/*N*/ pFly->Frm().Pos().X() = pFlyC->Left() +
+/*N*/ pPage->Frm().Left();
+/*N*/ pFly->Frm().Pos().Y() = pFlyC->Top() +
+/*N*/ pPage->Frm().Top();
+/*N*/ if ( pImpl->IsUseFlyCache() )
+/*N*/ {
+/*N*/ pFly->Frm().Width( pFlyC->Width() );
+/*N*/ pFly->Frm().Height( pFlyC->Height() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ ++aFlyCacheSetIt;
+/*N*/ ++aFlySetIt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*-----------------28.6.2001 14:48------------------
+ * SwLayHelper::CheckPageFlyCache(..)
+ * looks for the given text frame in the fly cache and sets
+ * the position and size, if possible.
+ * The fly cache is sorted by pages and we start searching with the given page.
+ * If we found the page number in the fly cache, we set
+ * the rpPage parameter to the right page, if possible.
+ * --------------------------------------------------*/
+
+/*N*/ BOOL SwLayHelper::CheckPageFlyCache( SwPageFrm* &rpPage, SwFlyFrm* pFly )
+/*N*/ {
+/*N*/ if( !pFly->GetAnchor() || !pFly->GetVirtDrawObj() ||
+/*N*/ pFly->GetAnchor()->FindFooterOrHeader() )
+/*N*/ return FALSE;
+/*N*/ BOOL bRet = FALSE;
+/*N*/ SwDoc* pDoc = rpPage->GetFmt()->GetDoc();
+/*N*/ SwLayCacheImpl *pCache = pDoc->GetLayoutCache() ?
+/*N*/ pDoc->GetLayoutCache()->LockImpl() : NULL;
+/*N*/ if( pCache )
+/*N*/ {
+/*?*/ USHORT nPgNum = rpPage->GetPhyPageNum();
+/*?*/ USHORT nIdx = 0;
+/*?*/ USHORT nCnt = pCache->GetFlyCount();
+/*?*/ ULONG nOrdNum = pFly->GetVirtDrawObj()->GetOrdNum();
+/*?*/ SwFlyCache* pFlyC;
+/*?*/
+/*?*/ // skip fly frames from pages before the current page
+/*?*/ while( nIdx < nCnt &&
+/*?*/ nPgNum > (pFlyC = pCache->GetFlyCache( nIdx ))->nPageNum )
+/*?*/ ++nIdx;
+/*?*/
+/*?*/ while( nIdx < nCnt &&
+/*?*/ nOrdNum != (pFlyC = pCache->GetFlyCache( nIdx ))->nOrdNum )
+/*?*/ ++nIdx;
+/*?*/ if( nIdx < nCnt )
+/*?*/ {
+/*?*/ SwPageFrm *pPage = rpPage;
+/*?*/ while( pPage && pPage->GetPhyPageNum() < pFlyC->nPageNum )
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*?*/ if( pPage )
+/*?*/ {
+/*?*/ rpPage = pPage;
+/*?*/ pFly->Frm().Pos().X() = pFlyC->Left() + pPage->Frm().Left();
+/*?*/ pFly->Frm().Pos().Y() = pFlyC->Top() + pPage->Frm().Top();
+/*?*/ if ( pCache->IsUseFlyCache() )
+/*?*/ {
+/*?*/ pFly->Frm().Width( pFlyC->Width() );
+/*?*/ pFly->Frm().Height( pFlyC->Height() );
+/*?*/ }
+/*?*/ bRet = TRUE;
+/*?*/ }
+/*?*/ }
+/*?*/ pDoc->GetLayoutCache()->UnlockImpl();
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+// -----------------------------------------------------------------------------
+
+/*N*/ SwLayCacheIoImpl::SwLayCacheIoImpl( SvStream& rStrm, BOOL bWrtMd ) :
+/*N*/ pStream( &rStrm ),
+/*N*/ nMajorVersion(SW_LAYCACHE_IO_VERSION_MAJOR),
+/*N*/ nMinorVersion(SW_LAYCACHE_IO_VERSION_MINOR),
+/*N*/ bWriteMode( bWrtMd ),
+/*N*/ bError( FALSE )
+/*N*/ {
+/*N*/ if( bWriteMode )
+/*N*/ *pStream << nMajorVersion
+/*N*/ << nMinorVersion;
+/*N*/
+/*N*/ else
+/*N*/ *pStream >> nMajorVersion
+/*N*/ >> nMinorVersion;
+/*N*/ }
+
+/*N*/ BOOL SwLayCacheIoImpl::OpenRec( BYTE cType )
+/*N*/ {
+/*N*/ BOOL bRes = TRUE;
+/*N*/ UINT16 nLvl = aRecTypes.Count();
+/*N*/ ASSERT( nLvl == aRecSizes.Count(), "OpenRec: Level" );
+/*N*/ UINT32 nPos = pStream->Tell();
+/*N*/ if( bWriteMode )
+/*N*/ {
+/*N*/ aRecTypes.Insert( cType, nLvl );
+/*N*/ aRecSizes.Insert( nPos, nLvl );
+/*N*/ *pStream << (UINT32) 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ UINT32 nVal;
+/*N*/ *pStream >> nVal;
+/*N*/ BYTE cRecTyp = (BYTE)nVal;
+/*N*/ aRecTypes.Insert( cRecTyp, nLvl );
+/*N*/ sal_uInt32 nSize = nVal >> 8;
+/*N*/ aRecSizes.Insert( nPos + nSize, nLvl );
+/*N*/ if( !nVal || cRecTyp != cType ||
+/*N*/ pStream->GetErrorCode() != SVSTREAM_OK || pStream->IsEof() )
+/*N*/ {
+/*?*/ ASSERT( nVal, "OpenRec: Record-Header is 0" );
+/*?*/ ASSERT( cRecTyp == cType,
+/*?*/ "OpenRec: Wrong Record Type" );
+/*?*/ aRecTypes[nLvl] = 0;
+/*?*/ aRecSizes[nLvl] = pStream->Tell();
+/*?*/ bRes = sal_False;
+/*?*/ bError = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ return bRes;
+/*N*/ }
+
+// Close record
+
+/*N*/ BOOL SwLayCacheIoImpl::CloseRec( BYTE cType )
+/*N*/ {
+/*N*/ BOOL bRes = TRUE;
+/*N*/ UINT16 nLvl = aRecTypes.Count();
+/*N*/ ASSERT( nLvl == aRecSizes.Count(), "CloseRec: wrong Level" );
+/*N*/ ASSERT( nLvl, "CloseRec: no levels" );
+/*N*/ if( nLvl )
+/*N*/ {
+/*N*/ nLvl--;
+/*N*/ ASSERT( cType == aRecTypes[nLvl],
+/*N*/ "CloseRec: Wrong Block-Header" );
+/*N*/ UINT32 nPos = pStream->Tell();
+/*N*/ if( bWriteMode )
+/*N*/ {
+/*N*/ UINT32 nBgn = aRecSizes[nLvl];
+/*N*/ pStream->Seek( nBgn );
+/*N*/ UINT32 nSize = nPos - nBgn;
+/*N*/ UINT32 nVal = ( nSize << 8 ) | aRecTypes[nLvl];
+/*N*/ *pStream << nVal;
+/*N*/ pStream->Seek( nPos );
+/*N*/ if( pStream->GetError() != SVSTREAM_OK )
+/*?*/ bRes = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ UINT32 n = aRecSizes[nLvl];
+/*N*/ ASSERT( n >= nPos, "CloseRec: to much data read" );
+/*N*/ if( n != nPos )
+/*N*/ {
+/*?*/ pStream->Seek( n );
+/*?*/ if( n < nPos )
+/*?*/ bRes = FALSE;
+/*N*/ }
+/*N*/ if( pStream->GetErrorCode() != SVSTREAM_OK )
+/*?*/ bRes = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ aRecTypes.Remove( nLvl, 1 );
+/*N*/ aRecSizes.Remove( nLvl, 1 );
+/*N*/ }
+/*N*/
+/*N*/ if( !bRes )
+/*?*/ bError = TRUE;
+/*N*/
+/*N*/ return bRes;
+/*N*/ }
+
+/*N*/ UINT32 SwLayCacheIoImpl::BytesLeft()
+/*N*/ {
+/*N*/ UINT16 nLvl = aRecSizes.Count();
+/*N*/ UINT32 n = 0;
+/*N*/ if( !bError && nLvl )
+/*N*/ {
+/*N*/ UINT32 nEndPos = aRecSizes[ nLvl-1 ];
+/*N*/ UINT32 nPos = pStream->Tell();
+/*N*/ if( nEndPos > nPos )
+/*N*/ n = nEndPos - nPos;
+/*N*/ }
+/*N*/
+/*N*/ return n;
+/*N*/ }
+
+/*N*/ BYTE SwLayCacheIoImpl::Peek()
+/*N*/ {
+/*N*/ BYTE c = 0;
+/*N*/ if( !bError )
+/*N*/ {
+/*N*/ UINT32 nPos = pStream->Tell();
+/*N*/ *pStream >> c;
+/*N*/ pStream->Seek( nPos );
+/*N*/ if( pStream->GetErrorCode() != SVSTREAM_OK )
+/*N*/ {
+/*?*/ c = 0;
+/*?*/ bError = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ return c;
+/*N*/ }
+
+
+/*N*/ BYTE SwLayCacheIoImpl::OpenFlagRec()
+/*N*/ {
+/*N*/ ASSERT( !bWriteMode, "OpenFlagRec illegal in write mode" );
+/*N*/ BYTE cFlags;
+/*N*/ *pStream >> cFlags;
+/*N*/ nFlagRecEnd = pStream->Tell() + ( cFlags & 0x0F );
+/*N*/ return (cFlags >> 4);
+/*N*/ }
+
+/*N*/ void SwLayCacheIoImpl::OpenFlagRec( BYTE nFlags, BYTE nLen )
+/*N*/ {
+/*N*/ ASSERT( bWriteMode, "OpenFlagRec illegal in read mode" );
+/*N*/ ASSERT( (nFlags & 0xF0) == 0, "illegal flags set" );
+/*N*/ ASSERT( nLen < 16, "wrong flag record length" );
+/*N*/ BYTE cFlags = (nFlags << 4) + nLen;
+/*N*/ *pStream << cFlags;
+/*N*/ nFlagRecEnd = pStream->Tell() + nLen;
+/*N*/ }
+
+/*N*/ void SwLayCacheIoImpl::CloseFlagRec()
+/*N*/ {
+/*N*/ if( bWriteMode )
+/*N*/ {
+/*N*/ ASSERT( pStream->Tell() == nFlagRecEnd, "Wrong amount of data written" );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( pStream->Tell() <= nFlagRecEnd, "To many data read" );
+/*N*/ if( pStream->Tell() != nFlagRecEnd )
+/*?*/ pStream->Seek( nFlagRecEnd );
+/*N*/ }
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_layouter.cxx b/binfilter/bf_sw/source/core/layout/sw_layouter.cxx
new file mode 100644
index 000000000000..91f3915d2e63
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_layouter.cxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "layouter.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "pagefrm.hxx"
+namespace binfilter {
+
+/*N*/ #define LOOP_DETECT 250
+
+/*N*/ class SwLooping
+/*N*/ {
+/*N*/ USHORT nMinPage;
+/*N*/ USHORT nMaxPage;
+/*N*/ USHORT nCount;
+/*N*/ public:
+/*N*/ SwLooping( SwPageFrm* pPage );
+/*N*/ void Control( SwPageFrm* pPage );
+/*N*/ static void Drastic( SwFrm* pFrm );
+/*N*/ };
+
+
+
+
+
+
+/*N*/ SwLooping::SwLooping( SwPageFrm* pPage )
+/*N*/ {
+/*N*/ ASSERT( pPage, "Where's my page?" );
+/*N*/ nMinPage = pPage->GetPhyPageNum();
+/*N*/ nMaxPage = nMinPage;
+/*N*/ nCount = 0;
+/*N*/ }
+
+/*N*/ void SwLooping::Drastic( SwFrm* pFrm )
+/*N*/ {
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsLayoutFrm() )
+/*N*/ Drastic( ((SwLayoutFrm*)pFrm)->Lower() );
+/*N*/ pFrm->bValidPos = TRUE;
+/*N*/ pFrm->bValidSize = TRUE;
+/*N*/ pFrm->bValidPrtArea = TRUE;
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwLooping::Control( SwPageFrm* pPage )
+/*N*/ {
+/*N*/ if( !pPage )
+/*N*/ return;
+/*N*/ USHORT nNew = pPage->GetPhyPageNum();
+/*N*/ if( nNew > nMaxPage )
+/*N*/ nMaxPage = nNew;
+/*N*/ if( nNew < nMinPage )
+/*N*/ {
+/*N*/ nMinPage = nNew;
+/*N*/ nMaxPage = nNew;
+/*N*/ nCount = 0;
+/*N*/ }
+/*N*/ else if( nNew > nMinPage + 2 )
+/*N*/ {
+/*N*/ nMinPage = nNew - 2;
+/*N*/ nMaxPage = nNew;
+/*N*/ nCount = 0;
+/*N*/ }
+/*N*/ else if( ++nCount > LOOP_DETECT )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static BOOL bNoLouie = FALSE;
+/*N*/ if( bNoLouie )
+/*N*/ return;
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ ASSERT( FALSE, "Looping Louie" );
+/*N*/ nCount = 0;
+/*N*/ Drastic( pPage->Lower() );
+/*N*/ if( nNew > nMinPage && pPage->GetPrev() )
+/*N*/ Drastic( ((SwPageFrm*)pPage->GetPrev())->Lower() );
+/*N*/ if( nNew < nMaxPage && pPage->GetNext() )
+/*N*/ Drastic( ((SwPageFrm*)pPage->GetNext())->Lower() );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayouter::SwLayouter()
+|*
+|* Ersterstellung AMA 02. Nov. 99
+|* Letzte Aenderung AMA 02. Nov. 99
+|*
+|*************************************************************************/
+
+/*N*/ SwLayouter::SwLayouter() : pLooping( NULL ) //STRIP001 pEndnoter( NULL ), pLooping( NULL )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwLayouter::~SwLayouter()
+/*N*/ {
+/*N*/ delete pLooping;
+/*N*/ }
+
+
+
+
+
+/*N*/ void SwLayouter::LoopControl( SwPageFrm* pPage, BYTE nLoop )
+/*N*/ {
+/*N*/ ASSERT( pLooping, "Looping: Lost control" );
+/*N*/ pLooping->Control( pPage );
+/*N*/ }
+
+/*N*/ BOOL SwLayouter::StartLooping( SwPageFrm* pPage )
+/*N*/ {
+/*N*/ if( pLooping )
+/*?*/ return FALSE;
+/*N*/ pLooping = new SwLooping( pPage );
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ void SwLayouter::EndLoopControl()
+/*N*/ {
+/*N*/ delete pLooping;
+/*N*/ pLooping = NULL;
+/*N*/ }
+
+
+
+/*N*/ BOOL SwLayouter::StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage )
+/*N*/ {
+/*N*/ ASSERT( pDoc, "No doc, no fun" );
+/*N*/ if( !pDoc->GetLayouter() )
+/*N*/ pDoc->SetLayouter( new SwLayouter() );
+/*N*/ return !pDoc->GetLayouter()->pLooping &&
+/*N*/ pDoc->GetLayouter()->StartLooping( pPage );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_newfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_newfrm.cxx
new file mode 100644
index 000000000000..b48de0156ecc
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_newfrm.cxx
@@ -0,0 +1,608 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svx/svdmodel.hxx>
+#include <bf_svx/svdpage.hxx>
+
+#include <fmtpdsc.hxx>
+#include <swtable.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <viewsh.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <dflyobj.hxx>
+#include <frmtool.hxx>
+#include <virtoutp.hxx>
+#include <blink.hxx>
+#include <ndindex.hxx>
+#include <sectfrm.hxx>
+#include <notxtfrm.hxx>
+#include <pagedesc.hxx>
+namespace binfilter {
+
+/*N*/ #ifndef VERTICAL_LAYOUT
+/*N*/ PtPtr pX = &Point::nA;
+/*N*/ PtPtr pY = &Point::nB;
+/*N*/ SzPtr pWidth = &Size::nA;
+/*N*/ SzPtr pHeight = &Size::nB;
+/*N*/ #endif
+
+/*N*/ SwLayVout *SwRootFrm::pVout = 0;
+/*N*/ BOOL SwRootFrm::bInPaint = FALSE;
+/*N*/ BOOL SwRootFrm::bNoVirDev = FALSE;
+
+/*N*/ SwCache *SwFrm::pCache = 0;
+
+/*N*/ Bitmap* SwNoTxtFrm::pErrorBmp = 0;
+/*N*/ Bitmap* SwNoTxtFrm::pReplaceBmp = 0;
+/*N*/
+/*N*/ #ifdef VERTICAL_LAYOUT
+
+/*N*/ long FirstMinusSecond( long nFirst, long nSecond )
+/*N*/ { return nFirst - nSecond; }
+/*N*/ long SecondMinusFirst( long nFirst, long nSecond )
+/*N*/ { return nSecond - nFirst; }
+/*N*/ long SwIncrement( long nA, long nAdd )
+/*N*/ { return nA + nAdd; }
+/*N*/ long SwDecrement( long nA, long nSub )
+/*N*/ { return nA - nSub; }
+
+/*N*/ static SwRectFnCollection aHorizontal = {
+/*N*/ /* fnRectGet */
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Width,
+/*N*/ &SwRect::_Height,
+/*N*/ &SwRect::TopLeft,
+/*N*/ &SwRect::_Size,
+/*N*/ /* fnRectSet */
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Width,
+/*N*/ &SwRect::_Height,
+/*N*/
+/*N*/ &SwRect::SubTop,
+/*N*/ &SwRect::AddBottom,
+/*N*/ &SwRect::SubLeft,
+/*N*/ &SwRect::AddRight,
+/*N*/ &SwRect::AddWidth,
+/*N*/ &SwRect::AddHeight,
+/*N*/
+/*N*/ &SwRect::SetPosX,
+/*N*/ &SwRect::SetPosY,
+/*N*/
+/*N*/ &SwFrm::GetTopMargin,
+/*N*/ &SwFrm::GetBottomMargin,
+/*N*/ &SwFrm::GetLeftMargin,
+/*N*/ &SwFrm::GetRightMargin,
+/*N*/ &SwFrm::SetLeftRightMargins,
+/*N*/ &SwFrm::SetTopBottomMargins,
+/*N*/ &SwFrm::GetPrtTop,
+/*N*/ &SwFrm::GetPrtBottom,
+/*N*/ &SwFrm::GetPrtLeft,
+/*N*/ &SwFrm::GetPrtRight,
+/*N*/ &SwRect::GetTopDistance,
+/*N*/ &SwRect::GetBottomDistance,
+/*N*/ &SwRect::GetLeftDistance,
+/*N*/ &SwRect::GetRightDistance,
+/*N*/ &SwFrm::SetMaxBottom,
+/*N*/ &SwRect::OverStepBottom,
+/*N*/
+/*N*/ &SwRect::SetUpperLeftCorner,
+/*N*/ &SwFrm::MakeBelowPos,
+/*N*/ &FirstMinusSecond,
+/*N*/ &FirstMinusSecond,
+/*N*/ &SwIncrement,
+/*N*/ &SwIncrement,
+/*N*/ &SwRect::SetLeftAndWidth,
+/*N*/ &SwRect::SetTopAndHeight
+/*N*/ };
+/*N*/
+/*N*/ static SwRectFnCollection aVertical = {
+/*N*/ /* fnRectGet */
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Height,
+/*N*/ &SwRect::_Width,
+/*N*/ &SwRect::TopRight,
+/*N*/ &SwRect::SwappedSize,
+/*N*/ /* fnRectSet */
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Height,
+/*N*/ &SwRect::_Width,
+/*N*/
+/*N*/ &SwRect::AddRight,
+/*N*/ &SwRect::SubLeft,
+/*N*/ &SwRect::SubTop,
+/*N*/ &SwRect::AddBottom,
+/*N*/ &SwRect::AddHeight,
+/*N*/ &SwRect::AddWidth,
+/*N*/
+/*N*/ &SwRect::SetPosY,
+/*N*/ &SwRect::SetPosX,
+/*N*/
+/*N*/ &SwFrm::GetRightMargin,
+/*N*/ &SwFrm::GetLeftMargin,
+/*N*/ &SwFrm::GetTopMargin,
+/*N*/ &SwFrm::GetBottomMargin,
+/*N*/ &SwFrm::SetTopBottomMargins,
+/*N*/ &SwFrm::SetRightLeftMargins,
+/*N*/ &SwFrm::GetPrtRight,
+/*N*/ &SwFrm::GetPrtLeft,
+/*N*/ &SwFrm::GetPrtTop,
+/*N*/ &SwFrm::GetPrtBottom,
+/*N*/ &SwRect::GetRightDistance,
+/*N*/ &SwRect::GetLeftDistance,
+/*N*/ &SwRect::GetTopDistance,
+/*N*/ &SwRect::GetBottomDistance,
+/*N*/ &SwFrm::SetMinLeft,
+/*N*/ &SwRect::OverStepLeft,
+/*N*/
+/*N*/ &SwRect::SetUpperRightCorner,
+/*N*/ &SwFrm::MakeLeftPos,
+/*N*/ &FirstMinusSecond,
+/*N*/ &SecondMinusFirst,
+/*N*/ &SwIncrement,
+/*N*/ &SwDecrement,
+/*N*/ &SwRect::SetTopAndHeight,
+/*N*/ &SwRect::SetRightAndWidth
+/*N*/ };
+/*N*/
+/*N*/ static SwRectFnCollection aBottomToTop = {
+/*N*/ /* fnRectGet */
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Width,
+/*N*/ &SwRect::_Height,
+/*N*/ &SwRect::BottomLeft,
+/*N*/ &SwRect::_Size,
+/*N*/ /* fnRectSet */
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Width,
+/*N*/ &SwRect::_Height,
+/*N*/
+/*N*/ &SwRect::AddBottom,
+/*N*/ &SwRect::SubTop,
+/*N*/ &SwRect::SubLeft,
+/*N*/ &SwRect::AddRight,
+/*N*/ &SwRect::AddWidth,
+/*N*/ &SwRect::AddHeight,
+/*N*/
+/*N*/ &SwRect::SetPosX,
+/*N*/ &SwRect::SetPosY,
+/*N*/
+/*N*/ &SwFrm::GetBottomMargin,
+/*N*/ &SwFrm::GetTopMargin,
+/*N*/ &SwFrm::GetLeftMargin,
+/*N*/ &SwFrm::GetRightMargin,
+/*N*/ &SwFrm::SetLeftRightMargins,
+/*N*/ &SwFrm::SetBottomTopMargins,
+/*N*/ &SwFrm::GetPrtBottom,
+/*N*/ &SwFrm::GetPrtTop,
+/*N*/ &SwFrm::GetPrtLeft,
+/*N*/ &SwFrm::GetPrtRight,
+/*N*/ &SwRect::GetBottomDistance,
+/*N*/ &SwRect::GetTopDistance,
+/*N*/ &SwRect::GetLeftDistance,
+/*N*/ &SwRect::GetRightDistance,
+/*N*/ &SwFrm::SetMinTop,
+/*N*/ &SwRect::OverStepTop,
+/*N*/
+/*N*/ &SwRect::SetLowerLeftCorner,
+/*N*/ &SwFrm::MakeUpperPos,
+/*N*/ &FirstMinusSecond,
+/*N*/ &SecondMinusFirst,
+/*N*/ &SwIncrement,
+/*N*/ &SwDecrement,
+/*N*/ &SwRect::SetLeftAndWidth,
+/*N*/ &SwRect::SetBottomAndHeight
+/*N*/ };
+/*N*/
+/*N*/ static SwRectFnCollection aVerticalRightToLeft = {
+/*N*/ /* fnRectGet */
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Height,
+/*N*/ &SwRect::_Width,
+/*N*/ &SwRect::BottomRight,
+/*N*/ &SwRect::SwappedSize,
+/*N*/ /* fnRectSet */
+/*N*/ &SwRect::_Left,
+/*N*/ &SwRect::_Right,
+/*N*/ &SwRect::_Top,
+/*N*/ &SwRect::_Bottom,
+/*N*/ &SwRect::_Height,
+/*N*/ &SwRect::_Width,
+/*N*/
+/*N*/ &SwRect::SubLeft,
+/*N*/ &SwRect::AddRight,
+/*N*/ &SwRect::SubTop,
+/*N*/ &SwRect::AddBottom,
+/*N*/ &SwRect::AddHeight,
+/*N*/ &SwRect::AddWidth,
+/*N*/
+/*N*/ &SwRect::SetPosY,
+/*N*/ &SwRect::SetPosX,
+/*N*/
+/*N*/ &SwFrm::GetLeftMargin,
+/*N*/ &SwFrm::GetRightMargin,
+/*N*/ &SwFrm::GetTopMargin,
+/*N*/ &SwFrm::GetBottomMargin,
+/*N*/ &SwFrm::SetTopBottomMargins,
+/*N*/ &SwFrm::SetLeftRightMargins,
+/*N*/ &SwFrm::GetPrtLeft,
+/*N*/ &SwFrm::GetPrtRight,
+/*N*/ &SwFrm::GetPrtBottom,
+/*N*/ &SwFrm::GetPrtTop,
+/*N*/ &SwRect::GetLeftDistance,
+/*N*/ &SwRect::GetRightDistance,
+/*N*/ &SwRect::GetBottomDistance,
+/*N*/ &SwRect::GetTopDistance,
+/*N*/ &SwFrm::SetMaxRight,
+/*N*/ &SwRect::OverStepRight,
+/*N*/
+/*N*/ &SwRect::SetLowerLeftCorner,
+/*N*/ &SwFrm::MakeRightPos,
+/*N*/ &FirstMinusSecond,
+/*N*/ &FirstMinusSecond,
+/*N*/ &SwDecrement,
+/*N*/ &SwIncrement,
+/*N*/ &SwRect::SetBottomAndHeight,
+/*N*/ &SwRect::SetLeftAndWidth
+/*N*/ };
+/*N*/
+/*N*/ SwRectFn fnRectHori = &aHorizontal;
+/*N*/ SwRectFn fnRectVert = &aVertical;
+/*N*/ SwRectFn fnRectB2T = &aBottomToTop;
+/*N*/ SwRectFn fnRectVL2R = &aVerticalRightToLeft;
+
+/*N*/ #endif
+
+/*N*/ #ifdef DBG_UTIL
+/*N*/ USHORT SwFrm::nLastFrmId=0;
+/*N*/ #endif
+
+
+/*N*/ TYPEINIT1(SwFrm,SwClient); //rtti fuer SwFrm
+/*N*/ TYPEINIT1(SwCntntFrm,SwFrm); //rtti fuer SwCntntFrm
+
+
+/*N*/ void _FrmInit()
+/*N*/ {
+/*N*/ SwRootFrm::pVout = new SwLayVout();
+/*N*/ SwCache *pNew = new SwCache( 100, 100
+/*N*/ #ifdef DBG_UTIL
+/*N*/ , "static SwBorderAttrs::pCache"
+/*N*/ #endif
+/*N*/ );
+/*N*/ SwFrm::SetCache( pNew );
+/*N*/ }
+
+
+
+/*N*/ void _FrmFinit()
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // im Chache duerfen nur noch 0-Pointer stehen
+/*N*/ for( USHORT n = SwFrm::GetCachePtr()->Count(); n; )
+/*N*/ if( (*SwFrm::GetCachePtr())[ --n ] )
+/*N*/ {
+/*N*/ SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ];
+/*N*/ ASSERT( !pObj, "Wer hat sich nicht ausgetragen?")
+/*N*/ }
+/*N*/ #endif
+/*N*/ delete SwRootFrm::pVout;
+/*N*/ delete SwFrm::GetCachePtr();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* RootFrm::Alles was so zur CurrShell gehoert
+|*
+|* Ersterstellung MA 09. Sep. 98
+|* Letzte Aenderung MA 18. Feb. 99
+|*
+|*************************************************************************/
+
+/*N*/ typedef CurrShell* CurrShellPtr;
+/*N*/ SV_DECL_PTRARR_SORT(SwCurrShells,CurrShellPtr,4,4)
+/*N*/ SV_IMPL_PTRARR_SORT(SwCurrShells,CurrShellPtr)
+
+/*N*/ CurrShell::CurrShell( ViewShell *pNew )
+/*N*/ {
+/*N*/ ASSERT( pNew, "0-Shell einsetzen?" );
+/*N*/ pRoot = pNew->GetLayout();
+/*N*/ if ( pRoot )
+/*N*/ {
+/*N*/ pPrev = pRoot->pCurrShell;
+/*N*/ pRoot->pCurrShell = pNew;
+/*N*/ pRoot->pCurrShells->Insert( this );
+/*N*/ }
+/*N*/ else
+/*?*/ pPrev = 0;
+/*N*/ }
+
+/*N*/ CurrShell::~CurrShell()
+/*N*/ {
+/*N*/ if ( pRoot )
+/*N*/ {
+/*N*/ pRoot->pCurrShells->Remove( this );
+/*N*/ if ( pPrev )
+/*N*/ pRoot->pCurrShell = pPrev;
+/*N*/ if ( !pRoot->pCurrShells->Count() && pRoot->pWaitingCurrShell )
+/*N*/ {
+/*?*/ pRoot->pCurrShell = pRoot->pWaitingCurrShell;
+/*?*/ pRoot->pWaitingCurrShell = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwRootFrm::DeRegisterShell( ViewShell *pSh )
+/*N*/ {
+/*N*/ //Wenn moeglich irgendeine Shell aktivieren
+/*N*/ if ( pCurrShell == pSh )
+/*N*/ pCurrShell = pSh->GetNext() != pSh ? (ViewShell*)pSh->GetNext() : 0;
+/*N*/
+/*N*/ //Das hat sich eruebrigt
+/*N*/ if ( pWaitingCurrShell == pSh )
+/*?*/ pWaitingCurrShell = 0;
+/*N*/
+/*N*/ //Referenzen entfernen.
+/*N*/ for ( USHORT i = 0; i < pCurrShells->Count(); ++i )
+/*N*/ {
+/*?*/ CurrShell *pC = (*pCurrShells)[i];
+/*?*/ if (pC->pPrev == pSh)
+/*?*/ pC->pPrev = 0;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void InitCurrShells( SwRootFrm *pRoot )
+/*N*/ {
+/*N*/ pRoot->pCurrShells = new SwCurrShells;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwRootFrm::SwRootFrm()
+|*
+|* Beschreibung:
+|* Der RootFrm laesst sich grundsaetzlich vom Dokument ein eigenes
+|* FrmFmt geben. Dieses loescht er dann selbst im DTor.
+|* Das eigene FrmFmt wird vom uebergebenen Format abgeleitet.
+|* Ersterstellung SS 05-Apr-1991
+|* Letzte Aenderung MA 12. Dec. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, ViewShell * pSh ) :
+/*N*/ SwLayoutFrm( pFmt->GetDoc()->MakeFrmFmt(
+/*N*/ XubString( "Root", RTL_TEXTENCODING_MS_1252 ), pFmt ) ),
+/*N*/ pTurbo( 0 ),
+/*N*/ pLastPage( 0 ),
+/*N*/ pCurrShell( pSh ),
+/*N*/ pWaitingCurrShell( 0 ),
+/*N*/ pDestroy( 0 ),
+/*N*/ nPhyPageNums( 0 ),
+/*N*/ pDrawPage( 0 ),
+/*N*/ nBrowseWidth( MM50*4 ) //2cm Minimum
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ ,nAccessibleShells( 0 )
+/*N*/ #endif
+/*N*/ {
+/*N*/ nType = FRMC_ROOT;
+/*N*/ bIdleFormat = bTurboAllowed = bAssertFlyPages = bIsNewLayout = TRUE;
+/*N*/ bCheckSuperfluous = bBrowseWidthValid = FALSE;
+/*N*/
+/*N*/ InitCurrShells( this );
+/*N*/
+/*N*/ SwDoc *pDoc = pFmt->GetDoc();
+/*N*/ const BOOL bOldIdle = pDoc->IsIdleTimerActive();
+/*N*/ pDoc->StopIdleTimer();
+/*N*/ pDoc->SetRootFrm( this ); //Fuer das Erzeugen der Flys durch MakeFrms()
+/*N*/ bCallbackActionEnabled = FALSE; //vor Verlassen auf TRUE setzen!
+/*N*/
+/*N*/ #ifndef VERTICAL_LAYOUT
+/*N*/ #ifdef QUER
+/*N*/ //StarWriter /QUER ? bitteschoen:
+/*N*/ SetFixSize( pHeight );
+/*N*/ #else
+/*N*/ SetFixSize( pWidth );
+/*N*/ #endif
+/*N*/ #endif
+/*N*/
+/*N*/ SdrModel *pMd = pDoc->GetDrawModel();
+/*N*/ if ( pMd )
+/*N*/ {
+/*N*/ pDrawPage = pMd->GetPage( 0 );
+/*N*/ pDrawPage->SetSize( Frm().SSize() );
+/*N*/ }
+/*N*/
+/*N*/ //Initialisierung des Layouts: Seiten erzeugen. Inhalt mit cntnt verbinden
+/*N*/ //usw.
+/*N*/ //Zuerst einiges initialiseren und den ersten Node besorgen (der wird
+/*N*/ //fuer den PageDesc benoetigt).
+/*N*/
+/*N*/ SwNodeIndex aIndex( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
+/*N*/ SwCntntNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, TRUE, FALSE );
+/*N*/ SwTableNode *pTblNd= pNode->FindTableNode();
+/*N*/
+/*N*/ //PageDesc besorgen (entweder vom FrmFmt des ersten Node oder den
+/*N*/ //initialen.)
+/*N*/ SwPageDesc *pDesc = 0;
+/*N*/ USHORT nPgNum = 1;
+/*N*/
+/*N*/ if ( pTblNd )
+/*N*/ {
+/*N*/ const SwFmtPageDesc &rDesc = pTblNd->GetTable().GetFrmFmt()->GetPageDesc();
+/*N*/ pDesc = (SwPageDesc*)rDesc.GetPageDesc();
+/*N*/ //#19104# Seitennummeroffset beruecksictigen!!
+/*N*/ bIsVirtPageNum = 0 != ( nPgNum = rDesc.GetNumOffset() );
+/*N*/ }
+/*N*/ else if ( pNode )
+/*N*/ {
+/*N*/ const SwFmtPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
+/*N*/ pDesc = (SwPageDesc*)rDesc.GetPageDesc();
+/*N*/ //#19104# Seitennummeroffset beruecksictigen!!
+/*N*/ bIsVirtPageNum = 0 != ( nPgNum = rDesc.GetNumOffset() );
+/*N*/ }
+/*N*/ else
+/*?*/ bIsVirtPageNum = FALSE;
+/*N*/ if ( !pDesc )
+/*N*/ pDesc = (SwPageDesc*)&pDoc->GetPageDesc( 0 );
+/*N*/ const BOOL bOdd = !nPgNum || 0 != ( nPgNum % 2 );
+/*N*/
+/*N*/ //Eine Seite erzeugen und in das Layout stellen
+/*N*/ SwPageFrm *pPage = ::binfilter::InsertNewPage( *pDesc, this, bOdd, FALSE, FALSE, 0 );
+/*N*/
+/*N*/ //Erstes Blatt im Bodytext-Bereich suchen.
+/*N*/ SwLayoutFrm *pLay = pPage->FindBodyCont();
+/*N*/ while( pLay->Lower() )
+/*N*/ pLay = (SwLayoutFrm*)pLay->Lower();
+/*N*/
+/*N*/ SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
+/*N*/ ::binfilter::_InsertCnt( pLay, pDoc, aTmp.GetIndex(), TRUE );
+/*N*/ //Noch nicht ersetzte Master aus der Liste entfernen.
+/*N*/ RemoveMasterObjs( pDrawPage );
+/*N*/ if( pDoc->IsGlobalDoc() )
+/*N*/ pDoc->UpdateRefFlds( NULL );
+/*N*/ if ( bOldIdle )
+/*N*/ pDoc->StartIdleTimer();
+/*N*/ bCallbackActionEnabled = TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::~SwRootFrm()
+|*
+|* Ersterstellung SS 05-Apr-1991
+|* Letzte Aenderung MA 12. Dec. 94
+|*
+|*************************************************************************/
+
+
+
+/*N*/ SwRootFrm::~SwRootFrm()
+/*N*/ {
+/*N*/ bTurboAllowed = FALSE;
+/*N*/ pTurbo = 0;
+/*N*/ ((SwFrmFmt*)pRegisteredIn)->GetDoc()->DelFrmFmt( (SwFrmFmt*)pRegisteredIn );
+/*N*/ delete pDestroy;
+/*N*/
+/*N*/ //Referenzen entfernen.
+/*N*/ for ( USHORT i = 0; i < pCurrShells->Count(); ++i )
+/*?*/ (*pCurrShells)[i]->pRoot = 0;
+/*N*/
+/*N*/ delete pCurrShells;
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ ASSERT( 0==nAccessibleShells, "Some accessible shells are left" );
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::SetFixSize()
+|*
+|* Ersterstellung MA 23. Jul. 92
+|* Letzte Aenderung MA 11. Mar. 93
+|*
+|*************************************************************************/
+
+/*N*/ #ifndef VERTICAL_LAYOUT
+
+/*?*/ void SwRootFrm::SetFixSize( SzPtr pNew )
+/*?*/ {
+/*?*/ if ( pNew == pHeight )
+/*?*/ {
+/*?*/ GetFmt()->SetAttr( SwFmtFillOrder( ATT_LEFT_TO_RIGHT ) );
+/*?*/ bVarHeight = bFixWidth = FALSE;
+/*?*/ bFixHeight = TRUE;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ GetFmt()->SetAttr( SwFmtFillOrder( ATT_TOP_DOWN ) );
+/*?*/ bVarHeight = bFixWidth = TRUE;
+/*?*/ bFixHeight = FALSE;
+/*?*/ }
+/*?*/ }
+
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* SwRootFrm::RemoveMasterObjs()
+|*
+|* Ersterstellung MA 19.10.95
+|* Letzte Aenderung MA 19.10.95
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwRootFrm::RemoveMasterObjs( SdrPage *pPg )
+/*N*/ {
+/*N*/ //Alle Masterobjekte aus der Page entfernen. Nicht loeschen!!
+/*N*/ for( ULONG i = pPg ? pPg->GetObjCount() : 0; i; )
+/*N*/ {
+/*N*/ SdrObject* pObj = pPg->GetObj( --i );
+/*N*/ if( pObj->ISA(SwFlyDrawObj ) )
+/*N*/ pPg->RemoveObject( i );
+/*N*/ }
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_pagechg.cxx b/binfilter/bf_sw/source/core/layout/sw_pagechg.cxx
new file mode 100644
index 000000000000..0df0ca88cccb
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_pagechg.cxx
@@ -0,0 +1,1973 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <docary.hxx>
+#include <bf_svtools/itemiter.hxx>
+
+#include <fmtfsize.hxx>
+#include <fmthdft.hxx>
+#include <fmtclds.hxx>
+#include <fmtanchr.hxx>
+#include <fmtpdsc.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <ftninfo.hxx>
+#include <tgrditem.hxx>
+
+#include "viewimp.hxx"
+#include "pagefrm.hxx"
+#include "doc.hxx"
+#include "fesh.hxx"
+#include "dview.hxx"
+#include "dflyobj.hxx"
+#include "dcontact.hxx"
+#include "frmtool.hxx"
+#include "hints.hxx"
+
+#include "ftnidx.hxx"
+#include "bodyfrm.hxx"
+#include "ftnfrm.hxx"
+#include "tabfrm.hxx"
+#include "txtfrm.hxx"
+#include "layact.hxx"
+#include "flyfrms.hxx"
+#include "frmsh.hxx"
+#include "pagedesc.hxx"
+#include <bf_svx/frmdiritem.hxx>
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* SwBodyFrm::SwBodyFrm()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 01. Aug. 93
+|*
+|*************************************************************************/
+/*N*/ SwBodyFrm::SwBodyFrm( SwFrmFmt *pFmt ):
+/*N*/ SwLayoutFrm( pFmt )
+/*N*/ {
+/*N*/ nType = FRMC_BODY;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwBodyFrm::Format()
+|*
+|* Ersterstellung MA 30. May. 94
+|* Letzte Aenderung MA 20. Jan. 99
+|*
+|*************************************************************************/
+/*N*/ void SwBodyFrm::Format( const SwBorderAttrs *pAttrs )
+/*N*/ {
+/*N*/ //Formatieren des Body ist zu einfach, deshalb bekommt er ein eigenes
+/*N*/ //Format; Umrandungen und dergl. sind hier nicht zu beruecksichtigen.
+/*N*/ //Breite ist die der PrtArea des Uppers, Hoehe ist die Hoehe der PrtArea
+/*N*/ //des Uppers abzueglich der Nachbarn (Wird eigentlich eingestellt aber
+/*N*/ //Vorsicht ist die Mutter der Robustheit).
+/*N*/ //Die PrtArea ist stets so gross wie der Frm itself.
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ SwTwips nHeight = GetUpper()->Prt().Height();
+/*N*/ SwTwips nWidth = GetUpper()->Prt().Width();
+/*N*/ const SwFrm *pFrm = GetUpper()->Lower();
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pFrm != this )
+/*N*/ {
+/*N*/ if( pFrm->IsVertical() )
+/*?*/ nWidth -= pFrm->Frm().Width();
+/*N*/ else
+/*N*/ nHeight -= pFrm->Frm().Height();
+/*N*/ }
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ } while ( pFrm );
+/*N*/ if ( nHeight < 0 )
+/*?*/ nHeight = 0;
+/*N*/ Frm().Height( nHeight );
+/*N*/ if( IsVertical() && !IsReverse() && nWidth != Frm().Width() )
+/*?*/ Frm().Pos().X() += Frm().Width() - nWidth;
+/*N*/ Frm().Width( nWidth );
+/*N*/ }
+/*N*/
+/*N*/ BOOL bNoGrid = TRUE;
+/*N*/ if( GetUpper()->IsPageFrm() && ((SwPageFrm*)GetUpper())->HasGrid() )
+/*N*/ {
+/*?*/ GETGRID( ((SwPageFrm*)GetUpper()) )
+/*?*/ if( pGrid )
+/*?*/ {
+/*?*/ bNoGrid = FALSE;
+/*?*/ long nSum = pGrid->GetBaseHeight() + pGrid->GetRubyHeight();
+/*?*/ SWRECTFN( this )
+/*?*/ long nSize = (Frm().*fnRect->fnGetWidth)();
+/*?*/ long nBorder = 0;
+/*?*/ if( GRID_LINES_CHARS == pGrid->GetGridType() )
+/*?*/ {
+/*?*/ nBorder = nSize % pGrid->GetBaseHeight();
+/*?*/ nSize -= nBorder;
+/*?*/ nBorder /= 2;
+/*?*/ }
+/*?*/ (Prt().*fnRect->fnSetPosX)( nBorder );
+/*?*/ (Prt().*fnRect->fnSetWidth)( nSize );
+/*?*/ nBorder = (Frm().*fnRect->fnGetHeight)();
+/*?*/ nSize = nBorder / nSum;
+/*?*/ if( nSize > pGrid->GetLines() )
+/*?*/ nSize = pGrid->GetLines();
+/*?*/ nSize *= nSum;
+/*?*/ nBorder -= nSize;
+/*?*/ nBorder /= 2;
+/*?*/ (Prt().*fnRect->fnSetPosY)( nBorder );
+/*?*/ (Prt().*fnRect->fnSetHeight)( nSize );
+/*?*/ }
+/*N*/ }
+/*N*/ if( bNoGrid )
+/*N*/ {
+/*N*/ Prt().Pos().X() = Prt().Pos().Y() = 0;
+/*N*/ Prt().Height( Frm().Height() );
+/*N*/ Prt().Width( Frm().Width() );
+/*N*/ }
+/*N*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::SwPageFrm(), ~SwPageFrm()
+|*
+|* Ersterstellung MA 20. Oct. 92
+|* Letzte Aenderung MA 08. Dec. 97
+|*
+|*************************************************************************/
+/*N*/ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwPageDesc *pPgDsc ) :
+/*N*/ SwFtnBossFrm( pFmt ),
+/*N*/ pSortedObjs( 0 ),
+/*N*/ pDesc( pPgDsc ),
+/*N*/ nPhyPageNum( 0 )
+/*N*/ {
+/*N*/ SetDerivedVert( FALSE );
+/*N*/ SetDerivedR2L( FALSE );
+/*N*/ if( pDesc )
+/*N*/ {
+/*N*/ bHasGrid = TRUE;
+/*N*/ GETGRID( this )
+/*N*/ if( !pGrid )
+/*N*/ bHasGrid = FALSE;
+/*N*/ }
+/*N*/ else
+/*?*/ bHasGrid = FALSE;
+/*N*/ SetMaxFtnHeight( pPgDsc->GetFtnInfo().GetHeight() ?
+/*N*/ pPgDsc->GetFtnInfo().GetHeight() : LONG_MAX ),
+/*N*/ nType = FRMC_PAGE;
+/*N*/ bInvalidLayout = bInvalidCntnt = bInvalidSpelling = TRUE;
+/*N*/ bInvalidFlyLayout = bInvalidFlyCntnt = bInvalidFlyInCnt =
+/*N*/ bFtnPage = bEndNotePage = FALSE;
+/*N*/
+/*N*/ SwDoc *pDoc = pFmt->GetDoc();
+/*N*/ if ( pDoc->IsBrowseMode() )
+/*N*/ {
+/*N*/ Frm().Height( 0 );
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ long nWidth = pSh ? pSh->VisArea().Width():0;
+/*N*/ if ( !nWidth )
+/*N*/ nWidth = 5000L; //aendert sich sowieso
+/*N*/ Frm().Width ( nWidth );
+/*N*/ }
+/*N*/ else
+/*N*/ Frm().SSize( pFmt->GetFrmSize().GetSize() );
+/*N*/
+/*N*/ //Body-Bereich erzeugen und einsetzen, aber nur wenn ich nicht gerade
+/*N*/ //eine Leerseite bin.
+/*N*/ if ( FALSE == (bEmptyPage = pFmt == pDoc->GetEmptyPageFmt()) )
+/*N*/ {
+/*N*/ bEmptyPage = FALSE;
+/*N*/ Calc(); //Damit die PrtArea stimmt.
+/*N*/ SwBodyFrm *pBodyFrm = new SwBodyFrm( pDoc->GetDfltFrmFmt() );
+/*N*/ pBodyFrm->ChgSize( Prt().SSize() );
+/*N*/ pBodyFrm->Paste( this );
+/*N*/ pBodyFrm->Calc(); //Damit die Spalten korrekt
+/*N*/ //eingesetzt werden koennen.
+/*N*/ pBodyFrm->InvalidatePos();
+/*N*/
+/*N*/ if ( pDoc->IsBrowseMode() )
+/*N*/ _InvalidateSize(); //Alles nur gelogen
+/*N*/
+/*N*/ //Header/Footer einsetzen, nur rufen wenn aktiv.
+/*N*/ if ( pFmt->GetHeader().IsActive() )
+/*N*/ PrepareHeader();
+/*N*/ if ( pFmt->GetFooter().IsActive() )
+/*N*/ PrepareFooter();
+/*N*/
+/*N*/ const SwFmtCol &rCol = pFmt->GetCol();
+/*N*/ if ( rCol.GetNumCols() > 1 )
+/*N*/ {
+/*N*/ const SwFmtCol aOld; //ChgColumns() verlaesst sich darauf, dass ein
+/*N*/ //Old-Wert hereingereicht wird.
+/*N*/ pBodyFrm->ChgColumns( aOld, rCol );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwPageFrm::~SwPageFrm()
+/*N*/ {
+/*N*/ //FlyContainer entleeren, delete der Flys uebernimmt der Anchor
+/*N*/ //(Basisklasse SwFrm)
+/*N*/ if ( pSortedObjs )
+/*N*/ {
+/*N*/ //Objekte koennen (warum auch immer) auch an Seiten verankert sein,
+/*N*/ //die vor Ihren Ankern stehen. Dann wuerde auf bereits freigegebenen
+/*N*/ //Speicher zugegriffen.
+/*N*/ for ( USHORT i = 0; i < pSortedObjs->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pSortedObjs)[i];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ if ( pFly->IsFlyFreeFrm() )
+/*N*/ ((SwFlyFreeFrm*)pFly)->SetPage ( 0 );
+/*N*/ }
+/*N*/ else if ( pObj->GetUserCall() )
+/*N*/ {
+/*N*/ // OD 24.06.2003 #108784# - consider 'virtual' drawing objects
+/*N*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pObj);
+/*N*/ pDrawVirtObj->SetPageFrm( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ((SwDrawContact*)pObj->GetUserCall())->ChgPage( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ delete pSortedObjs;
+/*N*/ pSortedObjs = 0; //Auf 0 setzen, sonst rauchts beim Abmdelden von Flys!
+/*N*/ }
+/*N*/
+/*N*/ //Damit der Zugriff auf zerstoerte Seiten verhindert werden kann.
+/*N*/ if ( !IsEmptyPage() ) //#59184# sollte fuer Leerseiten unnoetig sein.
+/*N*/ {
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ if( pDoc && !pDoc->IsInDtor() )
+/*N*/ {
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ if ( pSh )
+/*N*/ {
+/*N*/ SwViewImp *pImp = pSh->Imp();
+/*N*/ pImp->SetFirstVisPageInvalid();
+/*N*/ if ( pImp->IsAction() )
+/*N*/ pImp->GetLayAction().SetAgain();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwPageFrm::CheckGrid( BOOL bInvalidate )
+/*N*/ {
+/*N*/ BOOL bOld = bHasGrid;
+/*N*/ bHasGrid = TRUE;
+/*N*/ GETGRID( this )
+/*N*/ bHasGrid = 0 != pGrid;
+/*N*/ if( bInvalidate || bOld != bHasGrid )
+/*N*/ {
+/*?*/ SwLayoutFrm* pBody = FindBodyCont();
+/*?*/ if( pBody )
+/*?*/ {
+/*?*/ pBody->InvalidatePrt();
+/*?*/ SwCntntFrm* pFrm = pBody->ContainsCntnt();
+/*?*/ while( pBody->IsAnLower( pFrm ) )
+/*?*/ {
+/*?*/ ((SwTxtFrm*)pFrm)->Prepare( PREP_CLEAR );
+/*?*/ pFrm = pFrm->GetNextCntntFrm();
+/*?*/ }
+/*?*/ }
+/*?*/ SetCompletePaint();
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwPageFrm::CheckDirection( BOOL bVert )
+/*N*/ {
+/*N*/ UINT16 nDir =
+/*N*/ ((SvxFrameDirectionItem&)GetFmt()->GetAttr( RES_FRAMEDIR )).GetValue();
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir ||
+/*N*/ GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ bVertical = 0;
+/*N*/ else
+/*N*/ bVertical = 1;
+/*
+ if( pDesc && pDesc->GetName().GetChar(0)=='x')
+ bReverse = 1;
+ else
+ */
+/*N*/ bReverse = 0;
+/*N*/ bInvalidVert = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( FRMDIR_HORI_RIGHT_TOP == nDir )
+/*N*/ bRightToLeft = 1;
+/*N*/ else
+/*N*/ bRightToLeft = 0;
+/*N*/ bInvalidR2L = 0;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::PreparePage()
+|*
+|* Beschreibung Erzeugt die Spezifischen Flys zur Seite und formatiert
+|* generischen Cntnt
+|* Ersterstellung MA 20. Oct. 92
+|* Letzte Aenderung MA 09. Nov. 95
+|*
+|*************************************************************************/
+/*N*/ void MA_FASTCALL lcl_FormatLay( SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ //Alle LayoutFrms - nicht aber Tables, Flys o.ae. - formatieren.
+/*N*/
+/*N*/ SwFrm *pTmp = pLay->Lower();
+/*N*/ //Erst die untergeordneten
+/*N*/ while ( pTmp )
+/*N*/ {
+/*N*/ if ( pTmp->GetType() & 0x00FF )
+/*N*/ ::binfilter::lcl_FormatLay( (SwLayoutFrm*)pTmp );
+/*N*/ pTmp = pTmp->GetNext();
+/*N*/ }
+/*N*/ pLay->Calc();
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_MakeObjs( const SwSpzFrmFmts &rTbl, SwPageFrm *pPage )
+/*N*/ {
+/*N*/ //Anlegen bzw. registrieren von Flys und Drawobjekten.
+/*N*/ //Die Formate stehen in der SpzTbl (vom Dokument).
+/*N*/ //Flys werden angelegt, DrawObjekte werden bei der Seite angemeldet.
+/*N*/
+/*N*/ for ( USHORT i = 0; i < rTbl.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pSdrObj;
+/*N*/ SwFrmFmt *pFmt = rTbl[i];
+/*N*/ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+/*N*/ if ( rAnch.GetPageNum() == pPage->GetPhyPageNum() )
+/*N*/ {
+/*N*/ if( rAnch.GetCntntAnchor() )
+/*N*/ {
+/*N*/ if( FLY_PAGE == rAnch.GetAnchorId() )
+/*N*/ {
+/*N*/ SwFmtAnchor aAnch( rAnch );
+/*N*/ aAnch.SetAnchor( 0 );
+/*N*/ pFmt->SetAttr( aAnch );
+/*N*/ }
+/*N*/ else
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ //Wird ein Rahmen oder ein SdrObject beschrieben?
+/*N*/ BOOL bSdrObj = RES_DRAWFRMFMT == pFmt->Which();
+/*N*/ pSdrObj = 0;
+/*N*/ if ( bSdrObj && 0 == (pSdrObj = pFmt->FindSdrObject()) )
+/*N*/ {
+/*N*/ ASSERT( FALSE, "DrawObject not found." );
+/*N*/ pFmt->GetDoc()->DelFrmFmt( pFmt );
+/*N*/ --i;
+/*N*/ continue;
+/*N*/ }
+/*N*/ //Das Objekt kann noch an einer anderen Seite verankert sein.
+/*N*/ //Z.B. beim Einfuegen einer neuen Seite aufgrund eines
+/*N*/ //Pagedescriptor-Wechsels. Das Objekt muss dann umgehaengt
+/*N*/ //werden.
+/*N*/ //Fuer bestimmte Faelle ist das Objekt bereits an der richtigen
+/*N*/ //Seite verankert. Das wird hier automatisch erledigt und braucht
+/*N*/ //- wenngleich performater machbar - nicht extra codiert werden.
+/*N*/ SwPageFrm *pPg = pPage->IsEmptyPage() ? (SwPageFrm*)pPage->GetNext() : pPage;
+/*N*/ if ( bSdrObj )
+/*N*/ {
+/*N*/ // OD 23.06.2003 #108784# - consider 'virtual' drawing objects
+/*N*/ if ( pSdrObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pSdrObj);
+/*N*/ SwDrawContact* pContact =
+/*N*/ static_cast<SwDrawContact*>(GetUserCall(&(pDrawVirtObj->GetReferencedObj())));
+/*N*/ if ( pContact )
+/*N*/ {
+/*N*/ pDrawVirtObj->RemoveFromWriterLayout();
+/*N*/ pDrawVirtObj->RemoveFromDrawingPage();
+/*N*/ pPg->SwFrm::AppendVirtDrawObj( pContact, pDrawVirtObj );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pSdrObj);
+/*N*/ if ( pContact->GetAnchor() )
+/*N*/ pContact->DisconnectFromLayout( false );
+/*N*/ pPg->SwFrm::AppendDrawObj( pContact );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwClientIter aIter( *pFmt );
+/*N*/ SwClient *pTmp = aIter.First( TYPE(SwFrm) );
+/*N*/ SwFlyFrm *pFly;
+/*N*/ if ( pTmp )
+/*N*/ {
+/*N*/ pFly = (SwFlyFrm*)pTmp;
+/*N*/ if( pFly->GetAnchor() )
+/*N*/ pFly->GetAnchor()->RemoveFly( pFly );
+/*N*/ }
+/*N*/ else
+/*N*/ pFly = new SwFlyLayFrm( (SwFlyFrmFmt*)pFmt, pPg );
+/*N*/ pPg->SwFrm::AppendFly( pFly );
+/*N*/ ::binfilter::RegistFlys( pPg, pFly );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwPageFrm::PreparePage( BOOL bFtn )
+/*N*/ {
+/*N*/ SetFtnPage( bFtn );
+/*N*/
+/*N*/ //Klare Verhaeltnisse schaffen, sprich LayoutFrms der Seite formatieren.
+/*N*/ if ( Lower() )
+/*N*/ ::binfilter::lcl_FormatLay( this );
+/*N*/
+/*N*/ //Vorhandene Flys bei der Seite anmelden.
+/*N*/ ::binfilter::RegistFlys( this, this );
+/*N*/
+/*N*/ //Flys und DrawObjekte die noch am Dokument bereitstehen.
+/*N*/ //Fussnotenseiten tragen keine Seitengebundenen Flys!
+/*N*/ //Es kann Flys und Objekte geben, die auf Leerseiten (Seitennummernmaessig)
+/*N*/ //stehen wollen, diese werden jedoch von den Leerseiten ignoriert;
+/*N*/ //sie werden von den Folgeseiten aufgenommen.
+/*N*/ if ( !bFtn && !IsEmptyPage() )
+/*N*/ {
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/
+/*N*/ if ( GetPrev() && ((SwPageFrm*)GetPrev())->IsEmptyPage() )
+/*N*/ lcl_MakeObjs( *pDoc->GetSpzFrmFmts(), (SwPageFrm*)GetPrev() );
+/*N*/ lcl_MakeObjs( *pDoc->GetSpzFrmFmts(), this );
+/*N*/
+/*N*/ //Kopf-/Fusszeilen) formatieren.
+/*N*/ SwLayoutFrm *pLow = (SwLayoutFrm*)Lower();
+/*N*/ while ( pLow )
+/*N*/ {
+/*N*/ if ( pLow->GetType() & (FRMTYPE_HEADER|FRMTYPE_FOOTER) )
+/*N*/ {
+/*?*/ SwCntntFrm *pCntnt = pLow->ContainsCntnt();
+/*?*/ while ( pCntnt && pLow->IsAnLower( pCntnt ) )
+/*?*/ {
+/*?*/ pCntnt->OptCalc(); //Nicht die Vorgaenger
+/*?*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*?*/ }
+/*N*/ }
+/*N*/ pLow = (SwLayoutFrm*)pLow->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::Modify()
+|*
+|* Ersterstellung MA 20. Oct. 92
+|* Letzte Aenderung MA 03. Mar. 96
+|*
+|*************************************************************************/
+/*N*/ void SwPageFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ if ( pSh )
+/*N*/ pSh->SetFirstVisPageInvalid();
+/*N*/ BYTE nInvFlags = 0;
+/*N*/
+/*N*/ if( pNew && RES_ATTRSET_CHG == pNew->Which() )
+/*N*/ {
+/*?*/ SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
+/*?*/ SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
+/*?*/ SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
+/*?*/ SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
+/*?*/ while( TRUE )
+/*?*/ {
+/*?*/ _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
+/*?*/ (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+/*?*/ &aOldSet, &aNewSet );
+/*?*/ if( aNIter.IsAtEnd() )
+/*?*/ break;
+/*?*/ aNIter.NextItem();
+/*?*/ aOIter.NextItem();
+/*?*/ }
+/*?*/ if ( aOldSet.Count() || aNewSet.Count() )
+/*?*/ SwLayoutFrm::Modify( &aOldSet, &aNewSet );
+/*N*/ }
+/*N*/ else
+/*N*/ _UpdateAttr( pOld, pNew, nInvFlags );
+/*N*/
+/*N*/ if ( nInvFlags != 0 )
+/*N*/ {
+/*N*/ InvalidatePage( this );
+/*N*/ if ( nInvFlags & 0x01 )
+/*N*/ _InvalidatePrt();
+/*N*/ if ( nInvFlags & 0x02 )
+/*N*/ SetCompletePaint();
+/*N*/ if ( nInvFlags & 0x04 && GetNext() )
+/*N*/ GetNext()->InvalidatePos();
+/*N*/ if ( nInvFlags & 0x08 )
+/*N*/ PrepareHeader();
+/*N*/ if ( nInvFlags & 0x10 )
+/*N*/ PrepareFooter();
+/*N*/ if ( nInvFlags & 0x20 )
+/*N*/ CheckGrid( nInvFlags & 0x40 );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwPageFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew,
+/*N*/ BYTE &rInvFlags,
+/*N*/ SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
+/*N*/ {
+/*N*/ BOOL bClear = TRUE;
+/*N*/ const USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_FMT_CHG:
+/*N*/ {
+/*N*/ //Wenn sich das FrmFmt aendert kann hier einiges passieren.
+/*N*/ //Abgesehen von den Grossenverhaeltnissen sind noch andere
+/*N*/ //Dinge betroffen.
+/*N*/ //1. Spaltigkeit.
+/*N*/ ASSERT( pOld && pNew, "FMT_CHG Missing Format." );
+/*N*/ const SwFmt* pOldFmt = ((SwFmtChg*)pOld)->pChangedFmt;
+/*N*/ const SwFmt* pNewFmt = ((SwFmtChg*)pNew)->pChangedFmt;
+/*N*/ ASSERT( pOldFmt && pNewFmt, "FMT_CHG Missing Format." );
+/*N*/
+/*N*/ const SwFmtCol &rOldCol = pOldFmt->GetCol();
+/*N*/ const SwFmtCol &rNewCol = pNewFmt->GetCol();
+/*N*/ if( rOldCol != rNewCol )
+/*N*/ {
+/*N*/ SwLayoutFrm *pB = FindBodyCont();
+/*N*/ ASSERT( pB, "Seite ohne Body." );
+/*N*/ pB->ChgColumns( rOldCol, rNewCol );
+/*N*/ rInvFlags |= 0x20;
+/*N*/ }
+/*N*/
+/*N*/ //2. Kopf- und Fusszeilen.
+/*N*/ const SwFmtHeader &rOldH = pOldFmt->GetHeader();
+/*N*/ const SwFmtHeader &rNewH = pNewFmt->GetHeader();
+/*N*/ if( rOldH != rNewH )
+/*N*/ rInvFlags |= 0x08;
+/*N*/
+/*N*/ const SwFmtFooter &rOldF = pOldFmt->GetFooter();
+/*N*/ const SwFmtFooter &rNewF = pNewFmt->GetFooter();
+/*N*/ if( rOldF != rNewF )
+/*N*/ rInvFlags |= 0x10;
+/*N*/ CheckDirChange();
+/*N*/ }
+/*N*/ /* kein break hier */
+/*N*/ case RES_FRM_SIZE:
+/*N*/ {
+/*N*/ const SwRect aOldPageFrmRect( Frm() );
+/*N*/ if ( GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ bValidSize = FALSE;
+/*N*/ // OD 28.10.2002 #97265# - Don't call <SwPageFrm::MakeAll()>
+/*N*/ // Calculation of the page is not necessary, because its size is
+/*N*/ // is invalidated here and further invalidation is done in the
+/*N*/ // calling method <SwPageFrm::Modify(..)> and probably by calling
+/*N*/ // <SwLayoutFrm::Modify(..)> at the end.
+/*N*/ // It can also causes inconsistences, because the lowers are
+/*N*/ // adjusted, but not calculated, and a <SwPageFrm::MakeAll()> of
+/*N*/ // a next page is called. This is performed on the switch to the
+/*N*/ // online layout.
+/*N*/ //MakeAll();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rSz = nWhich == RES_FMT_CHG ?
+/*N*/ ((SwFmtChg*)pNew)->pChangedFmt->GetFrmSize() :
+/*N*/ (const SwFmtFrmSize&)*pNew;
+/*N*/
+/*N*/ Frm().Height( Max( rSz.GetHeight(), long(MINLAY) ) );
+/*N*/ Frm().Width ( Max( rSz.GetWidth(), long(MINLAY) ) );
+/*N*/ AdjustRootSize( CHG_CHGPAGE, &aOldPageFrmRect );
+/*N*/ }
+/*N*/ //Window aufraeumen.
+/*N*/ rInvFlags |= 0x03;
+/*N*/ if ( aOldPageFrmRect.Height() != Frm().Height() )
+/*N*/ rInvFlags |= 0x04;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_COL:
+/*N*/ {
+/*N*/ SwLayoutFrm *pB = FindBodyCont();
+/*N*/ ASSERT( pB, "Seite ohne Body." );
+/*N*/ pB->ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew );
+/*N*/ rInvFlags |= 0x22;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_HEADER:
+/*N*/ rInvFlags |= 0x08;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FOOTER:
+/*N*/ rInvFlags |= 0x10;
+/*N*/ break;
+/*N*/ case RES_TEXTGRID:
+/*N*/ rInvFlags |= 0x60;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_PAGEDESC_FTNINFO:
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //Die derzeit einzig sichere Methode:
+/*N*/ break;
+/*N*/ case RES_FRAMEDIR :
+/*?*/ CheckDirChange();
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ bClear = FALSE;
+/*N*/ }
+/*N*/ if ( bClear )
+/*N*/ {
+/*N*/ if ( pOldSet || pNewSet )
+/*N*/ {
+/*?*/ if ( pOldSet )
+/*?*/ pOldSet->ClearItem( nWhich );
+/*?*/ if ( pNewSet )
+/*?*/ pNewSet->ClearItem( nWhich );
+/*N*/ }
+/*N*/ else
+/*N*/ SwLayoutFrm::Modify( pOld, pNew );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::GetInfo()
+|*
+|* Beschreibung erfragt Informationen
+|* Ersterstellung JP 31.03.94
+|* Letzte Aenderung JP 31.03.94
+|*
+*************************************************************************/
+ // erfrage vom Modify Informationen
+
+/*************************************************************************
+|*
+|* SwPageFrm::SetPageDesc()
+|*
+|* Ersterstellung MA 02. Nov. 94
+|* Letzte Aenderung MA 02. Nov. 94
+|*
+|*************************************************************************/
+/*N*/ void SwPageFrm::SetPageDesc( SwPageDesc *pNew, SwFrmFmt *pFmt )
+/*N*/ {
+/*N*/ pDesc = pNew;
+/*N*/ if ( pFmt )
+/*N*/ SetFrmFmt( pFmt );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::FindPageDesc()
+|*
+|* Beschreibung Der richtige PageDesc wird bestimmt:
+|* 0. Vom Dokument bei Fussnotenseiten und Endnotenseiten
+|* 1. vom ersten BodyCntnt unterhalb der Seite.
+|* 2. vom PageDesc der vorstehenden Seite.
+|* 3. bei Leerseiten vom PageDesc der vorigen Seite.
+|* 3.1 vom PageDesc der folgenden Seite wenn es keinen Vorgaenger gibt.
+|* 4. es ist der Default-PageDesc sonst.
+|* 5. Im BrowseMode ist der Pagedesc immer der vom ersten Absatz im
+|* Dokument oder Standard (der 0-te) wenn der erste Absatz keinen
+|* wuenscht.
+|* (6. Im HTML-Mode ist der Pagedesc immer die HTML-Seitenvorlage.)
+|* Ersterstellung MA 15. Feb. 93
+|* Letzte Aenderung MA 17. Jun. 99
+|*
+|*************************************************************************/
+/*N*/ SwPageDesc *SwPageFrm::FindPageDesc()
+/*N*/ {
+/*N*/ //0.
+/*N*/ if ( IsFtnPage() )
+/*N*/ {
+/*?*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*?*/ if ( IsEndNotePage() )
+/*?*/ return pDoc->GetEndNoteInfo().GetPageDesc( *pDoc );
+/*?*/ else
+/*?*/ return pDoc->GetFtnInfo().GetPageDesc( *pDoc );
+/*N*/ }
+/*N*/
+/*N*/ //6.
+/*N*/ //if ( GetFmt()->GetDoc()->IsHTMLMode() )
+/*N*/ // return GetFmt()->GetDoc()->GetPageDescFromPool( RES_POOLPAGE_HTML );
+/*N*/
+/*N*/ SwPageDesc *pRet = 0;
+/*N*/
+/*N*/ //5.
+/*N*/ if ( GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ SwCntntFrm *pFrm = GetUpper()->ContainsCntnt();
+/*N*/ while ( !pFrm->IsInDocBody() )
+/*?*/ pFrm = pFrm->GetNextCntntFrm();
+/*N*/ SwFrm *pFlow = pFrm;
+/*N*/ if ( pFlow->IsInTab() )
+/*?*/ pFlow = pFlow->FindTabFrm();
+/*N*/ pRet = (SwPageDesc*)pFlow->GetAttrSet()->GetPageDesc().GetPageDesc();
+/*N*/ if ( !pRet )
+/*?*/ pRet = &GetFmt()->GetDoc()->_GetPageDesc( 0 );
+/*N*/ return pRet;
+/*N*/ }
+/*N*/
+/*N*/ SwFrm *pFlow = FindFirstBodyCntnt();
+/*N*/ if ( pFlow && pFlow->IsInTab() )
+/*N*/ pFlow = pFlow->FindTabFrm();
+/*N*/
+/*N*/ //1.
+/*N*/ if ( pFlow )
+/*N*/ {
+/*N*/ SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pFlow );
+/*N*/ if ( !pTmp->IsFollow() )
+/*N*/ pRet = (SwPageDesc*)pFlow->GetAttrSet()->GetPageDesc().GetPageDesc();
+/*N*/ }
+/*N*/
+/*N*/ //3. und 3.1
+/*N*/ if ( !pRet && IsEmptyPage() )
+/*N*/ pRet = GetPrev() ? ((SwPageFrm*)GetPrev())->GetPageDesc()->GetFollow() :
+/*N*/ GetNext() ? ((SwPageFrm*)GetNext())->GetPageDesc() : 0;
+/*N*/
+/*N*/ //2.
+/*N*/ if ( !pRet )
+/*N*/ pRet = GetPrev() ?
+/*N*/ ((SwPageFrm*)GetPrev())->GetPageDesc()->GetFollow() : 0;
+/*N*/
+/*N*/ //4.
+/*N*/ if ( !pRet )
+/*N*/ pRet = (SwPageDesc*)&GetFmt()->GetDoc()->GetPageDesc( 0 );
+/*N*/
+/*N*/
+/*N*/ ASSERT( pRet, "Kein Descriptor gefunden." );
+/*N*/ return pRet;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwPageFrm::AdjustRootSize()
+|*
+|* Ersterstellung MA 13. Aug. 93
+|* Letzte Aenderung MA 25. Jun. 95
+|*
+|*************************************************************************/
+//Wenn der RootFrm seine Groesse aendert muss benachrichtigt werden.
+/*N*/ void AdjustSizeChgNotify( SwRootFrm *pRoot )
+/*N*/ {
+/*N*/ const BOOL bOld = pRoot->IsSuperfluous();
+/*N*/ pRoot->bCheckSuperfluous = FALSE;
+/*N*/ ViewShell *pSh = pRoot->GetCurrShell();
+/*N*/ if ( pSh )
+/*N*/ {
+/*N*/ pSh->Imp()->NotifySizeChg( pRoot->Frm().SSize() );//Einmal fuer das Drawing.
+/*N*/ do
+/*N*/ { pSh->SizeChgNotify( pRoot->Frm().SSize() ); //Einmal fuer jede Sicht.
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/ } while ( pSh != pRoot->GetCurrShell() );
+/*N*/ }
+/*N*/ pRoot->bCheckSuperfluous = bOld;
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_AdjustRoot( SwFrm *pPage, long nOld )
+/*N*/ {
+/*N*/ //Groesse der groessten Seite ermitteln.
+/*N*/ //nOld enthaelt den alten Wert wenn die Seite geschrumpft ist und
+/*N*/ //den aktuellen Wert wenn sie etwa ausgeschnitten wurde. Dadurch
+/*N*/ //kann abgebrochen werden, wenn eine Seite gefunden wird, deren Wert
+/*N*/ //dem alten entspricht.
+/*N*/ long nMax = pPage->Frm().Width();
+/*N*/ if ( nMax == nOld )
+/*N*/ nMax = 0;
+/*N*/ const SwFrm *pFrm = pPage->GetUpper()->Lower();
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ if ( pFrm != pPage )
+/*N*/ {
+/*N*/ const SwTwips nTmp = pFrm->Frm().Width();
+/*N*/ if ( nTmp == nOld )
+/*N*/ {
+/*N*/ nMax = 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ else if ( nTmp > nMax )
+/*N*/ nMax = nTmp;
+/*N*/ }
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ if ( nMax )
+/*N*/ pPage->GetUpper()->ChgSize( Size( nMax,
+/*N*/ pPage->GetUpper()->Frm().Height() ) );
+/*N*/ }
+
+/*N*/ void SwPageFrm::AdjustRootSize( const SwPageChg eChgType, const SwRect *pOld )
+/*N*/ {
+/*N*/ if ( !GetUpper() )
+/*N*/ return;
+/*N*/
+/*N*/ const SwRect aOld( GetUpper()->Frm() );
+/*N*/
+/*N*/ const SwTwips nVar = Frm().Height();
+/*N*/ SwTwips nFix = Frm().Width();
+/*N*/ SwTwips nDiff = 0;
+/*N*/
+/*N*/ switch ( eChgType )
+/*N*/ {
+/*N*/ case CHG_NEWPAGE:
+/*N*/ {
+/*N*/ if( nFix > GetUpper()->Prt().Width() )
+/*N*/ GetUpper()->ChgSize( Size(nFix,GetUpper()->Frm().Height()));
+/*N*/ nDiff = nVar;
+/*N*/ if ( GetPrev() && !((SwPageFrm*)GetPrev())->IsEmptyPage() )
+/*N*/ nDiff += DOCUMENTBORDER/2;
+/*N*/ else if ( !IsEmptyPage() && GetNext() )
+/*N*/ nDiff += DOCUMENTBORDER/2;
+/*N*/ }
+/*N*/ break;
+/*N*/ case CHG_CUTPAGE:
+/*N*/ {
+/*N*/ if ( nFix == GetUpper()->Prt().Width() )
+/*N*/ ::binfilter::lcl_AdjustRoot( this, nFix );
+/*N*/ nDiff = -nVar;
+/*N*/ if ( GetPrev() && !((SwPageFrm*)GetPrev())->IsEmptyPage() )
+/*N*/ nDiff -= DOCUMENTBORDER/2;
+/*N*/ else if ( !IsEmptyPage() && GetNext() )
+/*N*/ nDiff -= DOCUMENTBORDER/2;
+/*N*/ if ( IsEmptyPage() && GetNext() && GetPrev() )
+/*N*/ nDiff = -nVar;
+/*N*/ }
+/*N*/ break;
+/*N*/ case CHG_CHGPAGE:
+/*N*/ {
+/*N*/ ASSERT( pOld, "ChgPage ohne OldValue nicht moeglich." );
+/*N*/ if ( pOld->Width() < nFix )
+/*N*/ {
+/*N*/ if ( nFix > GetUpper()->Prt().Width() )
+/*N*/ GetUpper()->ChgSize( Size( nFix,
+/*N*/ GetUpper()->Frm().Height() ) );
+/*N*/ }
+/*N*/ else if ( pOld->Width() > nFix )
+/*N*/ ::binfilter::lcl_AdjustRoot( this, pOld->Width() );
+/*N*/ nDiff = nVar - pOld->Height();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*?*/ ASSERT( FALSE, "Neuer Typ fuer PageChg." );
+/*N*/ }
+/*N*/
+/*N*/ if ( nDiff > 0 )
+/*N*/ GetUpper()->Grow( nDiff );
+/*N*/ else if ( nDiff < 0 )
+/*N*/ GetUpper()->Shrink( -nDiff );
+/*N*/
+/*N*/ //Fix(8522): Calc auf die Root damit sich dir PrtArea sofort einstellt.
+/*N*/ //Anderfalls gibt es Probleme wenn mehrere Aenderungen innerhalb einer
+/*N*/ //Action laufen.
+/*N*/ GetUpper()->Calc();
+/*N*/
+/*N*/ if ( aOld != GetUpper()->Frm() )
+/*N*/ {
+/*N*/ SwLayoutFrm *pUp = GetUpper();
+/*N*/ if ( eChgType == CHG_CUTPAGE )
+/*N*/ {
+/*N*/ //Seiten vorher kurz aushaengen, weil sonst falsch formatiert wuerde.
+/*N*/ SwFrm *pSibling = GetNext();
+/*N*/ if ( ((SwRootFrm*)pUp)->GetLastPage() == this )
+/*N*/ ::binfilter::SetLastPage( (SwPageFrm*)GetPrev() );
+/*N*/ Remove();
+/*N*/ ::binfilter::AdjustSizeChgNotify( (SwRootFrm*)pUp );
+/*N*/ InsertBefore( pUp, pSibling );
+/*N*/ }
+/*N*/ else
+/*N*/ ::binfilter::AdjustSizeChgNotify( (SwRootFrm*)pUp );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::Cut()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 22. Jun. 95
+|*
+|*************************************************************************/
+/*N*/ inline void SetLastPage( SwPageFrm *pPage )
+/*N*/ {
+/*N*/ ((SwRootFrm*)pPage->GetUpper())->pLastPage = pPage;
+/*N*/ }
+
+/*N*/ void SwPageFrm::Cut()
+/*N*/ {
+/*N*/ AdjustRootSize( CHG_CUTPAGE, 0 );
+/*N*/
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ if ( !IsEmptyPage() )
+/*N*/ {
+/*N*/ if ( GetNext() )
+/*N*/ GetNext()->InvalidatePos();
+/*N*/
+/*N*/ //Flys deren Anker auf anderen Seiten stehen umhaengen.
+/*N*/ //DrawObjecte spielen hier keine Rolle.
+/*N*/ if ( GetSortedObjs() )
+/*N*/ {
+/*N*/ for ( int i = 0; GetSortedObjs() &&
+/*N*/ (USHORT)i < GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*GetSortedObjs())[i];
+/*N*/ SwFlyFrm *pFly;
+/*N*/ if ( pO->IsWriterFlyFrame() &&
+/*N*/ (pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm())->IsFlyAtCntFrm() )
+/*N*/ {
+/*N*/ SwPageFrm *pAnchPage = pFly->GetAnchor() ?
+/*N*/ pFly->GetAnchor()->FindPageFrm() : 0;
+/*N*/ if ( pAnchPage && (pAnchPage != this) )
+/*N*/ {
+/*N*/ MoveFly( pFly, pAnchPage );
+/*N*/ --i;
+/*N*/ pFly->InvalidateSize();
+/*N*/ pFly->_InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ //Window aufraeumen
+/*N*/ if ( pSh && pSh->GetWin() )
+/*N*/ pSh->InvalidateWindows( Frm() );
+/*N*/ }
+/*N*/
+/*N*/ // die Seitennummer der Root runterzaehlen.
+/*N*/ ((SwRootFrm*)GetUpper())->DecrPhyPageNums();
+/*N*/ SwPageFrm *pPg = (SwPageFrm*)GetNext();
+/*N*/ if ( pPg )
+/*N*/ {
+/*N*/ while ( pPg )
+/*N*/ {
+/*N*/ pPg->DecrPhyPageNum(); //inline --nPhyPageNum
+/*N*/ pPg = (SwPageFrm*)pPg->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ ::binfilter::SetLastPage( (SwPageFrm*)GetPrev() );
+/*N*/
+/*N*/ // Alle Verbindungen kappen.
+/*N*/ Remove();
+/*N*/ if ( pSh )
+/*N*/ pSh->SetFirstVisPageInvalid();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::Paste()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 07. Dec. 94
+|*
+|*************************************************************************/
+/*N*/ void SwPageFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
+/*N*/ {
+/*N*/ ASSERT( pParent->IsRootFrm(), "Parent ist keine Root." );
+/*N*/ ASSERT( pParent, "Kein Parent fuer Paste." );
+/*N*/ ASSERT( pParent != this, "Bin selbst der Parent." );
+/*N*/ ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
+/*N*/ ASSERT( !GetPrev() && !GetNext() && !GetUpper(),
+/*N*/ "Bin noch irgendwo angemeldet." );
+/*N*/
+/*N*/ //In den Baum einhaengen.
+/*N*/ InsertBefore( (SwLayoutFrm*)pParent, pSibling );
+/*N*/
+/*N*/ // die Seitennummer am Root hochzaehlen.
+/*N*/ ((SwRootFrm*)GetUpper())->IncrPhyPageNums();
+/*N*/ if( GetPrev() )
+/*N*/ SetPhyPageNum( ((SwPageFrm*)GetPrev())->GetPhyPageNum() + 1 );
+/*N*/ else
+/*N*/ SetPhyPageNum( 1 );
+/*N*/ SwPageFrm *pPg = (SwPageFrm*)GetNext();
+/*N*/ if ( pPg )
+/*N*/ {
+/*N*/ while ( pPg )
+/*N*/ {
+/*N*/ pPg->IncrPhyPageNum(); //inline ++nPhyPageNum
+/*N*/ pPg->_InvalidatePos();
+/*N*/ pPg->InvalidateLayout();
+/*N*/ pPg = (SwPageFrm*)pPg->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ ::binfilter::SetLastPage( this );
+/*N*/
+/*N*/ if( Frm().Width() != pParent->Prt().Width() )
+/*N*/ _InvalidateSize();
+/*N*/ InvalidatePos();
+/*N*/
+/*N*/ AdjustRootSize( CHG_NEWPAGE, 0 );
+/*N*/
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ if ( pSh )
+/*N*/ pSh->SetFirstVisPageInvalid();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFrm::PrepareRegisterChg()
+|*
+|* Ersterstellung AMA 22. Jul. 96
+|* Letzte Aenderung AMA 22. Jul. 96
+|*
+|*************************************************************************/
+/*N*/ void lcl_PrepFlyInCntRegister( SwCntntFrm *pFrm )
+/*N*/ {
+/*N*/ pFrm->Prepare( PREP_REGISTER );
+/*N*/ if( pFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ for( USHORT i = 0; i < pFrm->GetDrawObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly;
+/*N*/ SdrObject *pO = (*pFrm->GetDrawObjs())[i];
+/*N*/ if( pO->IsWriterFlyFrame() &&
+/*N*/ 0 != (pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm()) &&
+/*N*/ pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*N*/ SwCntntFrm *pCnt = pFly->ContainsCntnt();
+/*N*/ while ( pCnt )
+/*N*/ {
+/*N*/ lcl_PrepFlyInCntRegister( pCnt );
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwPageFrm::PrepareRegisterChg()
+/*N*/ {
+/*N*/ SwCntntFrm *pFrm = FindFirstBodyCntnt();
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ lcl_PrepFlyInCntRegister( pFrm );
+/*N*/ pFrm = pFrm->GetNextCntntFrm();
+/*N*/ if( !IsAnLower( pFrm ) )
+/*N*/ break;
+/*N*/ }
+/*N*/ if( GetSortedObjs() )
+/*N*/ {
+/*N*/ for( USHORT i = 0; i < GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*GetSortedObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ pFrm = pFly->ContainsCntnt();
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ ::binfilter::lcl_PrepFlyInCntRegister( pFrm );
+/*N*/ pFrm = pFrm->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::CheckPageDescs()
+|*
+|* Beschreibung Prueft alle Seiten ab der uebergebenen, daraufhin,
+|* ob sie das richtige FrmFmt verwenden. Wenn 'falsche' Seiten
+|* aufgespuehrt werden, so wird versucht die Situation moeglichst
+|* einfache zu bereinigen.
+|*
+|* Ersterstellung MA 10. Feb. 93
+|* Letzte Aenderung MA 18. Apr. 96
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields )
+/*N*/ {
+/*N*/ ASSERT( pStart, "Keine Startpage." );
+/*N*/
+/*N*/ ViewShell *pSh = pStart->GetShell();
+/*N*/ SwViewImp *pImp = pSh ? pSh->Imp() : 0;
+/*N*/
+/*N*/ if ( pImp && pImp->IsAction() && !pImp->GetLayAction().IsCheckPages() )
+/*N*/ {
+/*?*/ pImp->GetLayAction().SetCheckPageNum( pStart->GetPhyPageNum() );
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ //Fuer das Aktualisieren der Seitennummern-Felder gibt nDocPos
+/*N*/ //die Seitenposition an, _ab_ der invalidiert werden soll.
+/*N*/ SwTwips nDocPos = LONG_MAX;
+/*N*/
+/*N*/ SwRootFrm *pRoot = (SwRootFrm*)pStart->GetUpper();
+/*N*/ SwDoc* pDoc = pStart->GetFmt()->GetDoc();
+/*N*/ const BOOL bFtns = 0 != pDoc->GetFtnIdxs().Count();
+/*N*/
+/*N*/ SwPageFrm *pPage = pStart;
+/*N*/ if( pPage->GetPrev() && ((SwPageFrm*)pPage->GetPrev())->IsEmptyPage() )
+/*?*/ pPage = (SwPageFrm*)pPage->GetPrev();
+/*N*/ while ( pPage )
+/*N*/ {
+/*N*/ //gewuenschten PageDesc und FrmFmt festellen.
+/*N*/ SwPageDesc *pDesc = pPage->FindPageDesc();
+/*N*/ BOOL bCheckEmpty = pPage->IsEmptyPage();
+/*N*/ BOOL bActOdd = pPage->OnRightPage();
+/*N*/ BOOL bOdd = pPage->WannaRightPage();
+/*N*/ SwFrmFmt *pFmtWish = bOdd ? pDesc->GetRightFmt()
+/*N*/ : pDesc->GetLeftFmt();
+/*N*/
+/*N*/ if ( bActOdd != bOdd ||
+/*N*/ pDesc != pPage->GetPageDesc() || //falscher Desc
+/*N*/ ( pFmtWish != pPage->GetFmt() && //falsches Format und
+/*N*/ ( !pPage->IsEmptyPage() || pFmtWish ) //nicht Leerseite
+/*N*/ )
+/*N*/ )
+/*N*/ {
+/*N*/ //Wenn wir schon ein Seite veraendern muessen kann das eine
+/*N*/ //Weile dauern, deshalb hier den WaitCrsr pruefen.
+/*N*/ if( pImp )
+/*N*/ pImp->CheckWaitCrsr();
+/*N*/
+/*N*/ //Ab hier muessen die Felder invalidiert werden!
+/*N*/ if ( nDocPos == LONG_MAX )
+/*N*/ nDocPos = pPage->GetPrev() ?
+/*N*/ pPage->GetPrev()->Frm().Top() : pPage->Frm().Top();
+/*N*/
+/*N*/ //Faelle:
+/*N*/ //1. Wir haben eine EmptyPage und wollen eine "Normalseite".
+/*N*/ // ->EmptyPage wegwerfen und weiter mit der naechsten.
+/*N*/ //2. Wir haben eine EmptyPage und wollen eine EmptyPage mit
+/*N*/ // anderem Descriptor.
+/*N*/ // ->Descriptor austauschen.
+/*N*/ //3. Wir haben eine "Normalseite" und wollen eine EmptyPage.
+/*N*/ // ->Emptypage einfuegen, nicht aber wenn die Vorseite
+/*N*/ // bereits eine EmptyPage ist -> 6.
+/*N*/ //4. Wir haben eine "Normalseite" und wollen eine "Normalseite"
+/*N*/ // mit anderem Descriptor
+/*N*/ // ->Descriptor und Format austauschen
+/*N*/ //5. Wir haben eine "Normalseite" und wollen eine "Normalseite"
+/*N*/ // mit anderem Format
+/*N*/ // ->Format austauschen.
+/*N*/ //6. Wir haben kein Wunschformat erhalten, also nehmen wir das
+/*N*/ // 'andere' Format (rechts/links) des PageDesc.
+/*N*/
+/*N*/ if ( pPage->IsEmptyPage() && ( pFmtWish || //1.
+/*N*/ ( !bOdd && !pPage->GetPrev() ) ) )
+/*N*/ {
+/*N*/ SwPageFrm *pTmp = (SwPageFrm*)pPage->GetNext();
+/*N*/ pPage->Cut();
+/*N*/ delete pPage;
+/*N*/ if ( pStart == pPage )
+/*?*/ pStart = pTmp;
+/*N*/ pPage = pTmp;
+/*N*/ continue;
+/*N*/ }
+/*N*/ else if ( pPage->IsEmptyPage() && !pFmtWish && //2.
+/*N*/ pDesc != pPage->GetPageDesc() )
+/*N*/ {
+/*N*/ pPage->SetPageDesc( pDesc, 0 );
+/*N*/ }
+/*N*/ else if ( !pPage->IsEmptyPage() && //3.
+/*N*/ bActOdd != bOdd &&
+/*N*/ ( ( !pPage->GetPrev() && !bOdd ) ||
+/*N*/ ( pPage->GetPrev() &&
+/*N*/ !((SwPageFrm*)pPage->GetPrev())->IsEmptyPage() )
+/*N*/ )
+/*N*/ )
+/*N*/ {
+/*N*/ if ( pPage->GetPrev() )
+/*N*/ pDesc = ((SwPageFrm*)pPage->GetPrev())->GetPageDesc();
+/*N*/ SwPageFrm *pTmp = new SwPageFrm( pDoc->GetEmptyPageFmt(),pDesc);
+/*N*/ pTmp->Paste( pRoot, pPage );
+/*N*/ pTmp->PreparePage( FALSE );
+/*N*/ pPage = pTmp;
+/*N*/ }
+/*N*/ else if ( pPage->GetPageDesc() != pDesc ) //4.
+/*N*/ {
+/*N*/ SwPageDesc *pOld = pPage->GetPageDesc();
+/*N*/ pPage->SetPageDesc( pDesc, pFmtWish );
+/*N*/ if ( bFtns )
+/*N*/ {
+/*?*/ //Wenn sich bestimmte Werte der FtnInfo veraendert haben
+/*?*/ //muss etwas passieren. Wir versuchen den Schaden zu
+/*?*/ //begrenzen.
+/*?*/ //Wenn die Seiten keinen FtnCont hat, ist zwar theoretisches
+/*?*/ //ein Problem denkbar, aber das ignorieren wir mit aller Kraft.
+/*?*/ //Bei Aenderungen hoffen wir mal, dass eine Invalidierung
+/*?*/ //ausreicht, denn alles andere wuerde viel Kraft kosten.
+/*?*/ SwFtnContFrm *pCont = pPage->FindFtnCont();
+/*?*/ if ( pCont && !(pOld->GetFtnInfo() == pDesc->GetFtnInfo()) )
+/*?*/ pCont->_InvalidateAll();
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pFmtWish && pPage->GetFmt() != pFmtWish ) //5.
+/*N*/ {
+/*N*/ pPage->SetFrmFmt( pFmtWish );
+/*N*/ }
+/*N*/ else if ( !pFmtWish ) //6.
+/*N*/ {
+/*N*/ //Format mit verdrehter Logic besorgen.
+/*N*/ pFmtWish = bOdd ? pDesc->GetLeftFmt() : pDesc->GetRightFmt();
+/*N*/ if ( pPage->GetFmt() != pFmtWish )
+/*N*/ pPage->SetFrmFmt( pFmtWish );
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( FALSE, "CheckPageDescs, missing solution" );
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ if ( bCheckEmpty )
+/*N*/ {
+/*N*/ //Es kann noch sein, dass die Leerseite schlicht ueberflussig ist.
+/*N*/ //Obiger Algorithmus kann dies leider nicht feststellen.
+/*N*/ //Eigentlich muesste die Leerseite einfach praeventiv entfernt
+/*N*/ //werden; sie wuerde ja ggf. wieder eingefuegt.
+/*N*/ //Die EmptyPage ist genau dann ueberfluessig, wenn die Folgeseite
+/*N*/ //auch ohne sie auskommt. Dazu muessen wir uns die Verhaeltnisse
+/*N*/ //genauer ansehen. Wir bestimmen den PageDesc und die virtuelle
+/*N*/ //Seitennummer manuell.
+/*N*/ SwPageFrm *pPg = (SwPageFrm*)pPage->GetNext();
+/*N*/ if( !pPg || pPage->OnRightPage() == pPg->WannaRightPage() )
+/*N*/ {
+/*?*/ //Die Folgeseite hat kein Problem ein FrmFmt zu finden oder keinen
+/*?*/ //Nachfolger, also ist die Leerseite ueberfluessig.
+/*?*/ SwPageFrm *pTmp = (SwPageFrm*)pPage->GetNext();
+/*?*/ pPage->Cut();
+/*?*/ delete pPage;
+/*?*/ if ( pStart == pPage )
+/*?*/ pStart = pTmp;
+/*?*/ pPage = pTmp;
+/*?*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ pRoot->SetAssertFlyPages();
+/*N*/ pRoot->AssertPageFlys( pStart );
+/*N*/
+/*N*/ if ( bNotifyFields && (!pImp || !pImp->IsUpdateExpFlds()) )
+/*N*/ {
+/*N*/ SwDocPosUpdate aMsgHnt( nDocPos );
+/*N*/ pDoc->UpdatePageFlds( &aMsgHnt );
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ //Ein paar Pruefungen muessen schon erlaubt sein.
+/*N*/
+/*N*/ //1. Keine zwei EmptyPages hintereinander.
+/*N*/ //2. Alle PageDescs richtig?
+/*N*/ BOOL bEmpty = FALSE;
+/*N*/ SwPageFrm *pPg = pStart;
+/*N*/ while ( pPg )
+/*N*/ {
+/*N*/ if ( pPg->IsEmptyPage() )
+/*N*/ {
+/*N*/ if ( bEmpty )
+/*N*/ {
+/*?*/ ASSERT( FALSE, "Doppelte Leerseiten." );
+/*?*/ break; //Einmal reicht.
+/*N*/ }
+/*N*/ bEmpty = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ bEmpty = FALSE;
+/*N*/
+/*N*/ //MA 21. Jun. 95: Kann zu testzwecken 'rein, ist aber bei zyklen durchaus
+/*N*/ //moeglich: Ein paar Seiten, auf der ersten 'erste Seite' anwenden,
+/*N*/ //rechte als folge der ersten, linke als folge der rechten, rechte als
+/*N*/ //folge der linken.
+/*N*/ // ASSERT( pPg->GetPageDesc() == pPg->FindPageDesc(),
+/*N*/ // "Seite mit falschem Descriptor." );
+/*N*/
+/*N*/ pPg = (SwPageFrm*)pPg->GetNext();
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::InsertPage()
+|*
+|* Beschreibung
+|* Ersterstellung MA 10. Feb. 93
+|* Letzte Aenderung MA 27. Jul. 93
+|*
+|*************************************************************************/
+/*N*/ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, BOOL bFtn )
+/*N*/ {
+/*N*/ SwRootFrm *pRoot = (SwRootFrm*)pPrevPage->GetUpper();
+/*N*/ SwPageFrm *pSibling = (SwPageFrm*)pRoot->GetLower();
+/*N*/ SwPageDesc *pDesc = pSibling->GetPageDesc();
+/*N*/
+/*N*/ pSibling = (SwPageFrm*)pPrevPage->GetNext();
+/*N*/ //Rechte (ungerade) oder linke (gerade) Seite einfuegen?
+/*N*/ BOOL bNextOdd = !pPrevPage->OnRightPage();
+/*N*/ BOOL bWishedOdd = bNextOdd;
+/*N*/
+/*N*/ //Welcher PageDesc gilt?
+/*N*/ //Bei CntntFrm der aus dem Format wenn einer angegeben ist,
+/*N*/ //der Follow vom bereits in der PrevPage gueltigen sonst.
+/*N*/ pDesc = 0;
+/*N*/ if ( IsFlowFrm() && !SwFlowFrm::CastFlowFrm( this )->IsFollow() )
+/*N*/ { SwFmtPageDesc &rDesc = (SwFmtPageDesc&)GetAttrSet()->GetPageDesc();
+/*N*/ pDesc = rDesc.GetPageDesc();
+/*N*/ if ( rDesc.GetNumOffset() )
+/*N*/ {
+/*N*/ bWishedOdd = rDesc.GetNumOffset() % 2 ? TRUE : FALSE;
+/*N*/ //Die Gelegenheit nutzen wir um das Flag an der Root zu pflegen.
+/*N*/ pRoot->SetVirtPageNum( TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pDesc )
+/*N*/ pDesc = pPrevPage->GetPageDesc()->GetFollow();
+/*N*/
+/*N*/ ASSERT( pDesc, "Missing PageDesc" );
+/*N*/ if( !(bWishedOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt()) )
+/*N*/ bWishedOdd = !bWishedOdd;
+/*N*/
+/*N*/ SwDoc *pDoc = pPrevPage->GetFmt()->GetDoc();
+/*N*/ SwFrmFmt *pFmt;
+/*N*/ BOOL bCheckPages = FALSE;
+/*N*/ //Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben eine
+/*N*/ //Leerseite einfuegen.
+/*N*/ if( bWishedOdd != bNextOdd )
+/*N*/ { pFmt = pDoc->GetEmptyPageFmt();
+/*N*/ SwPageDesc *pTmpDesc = pPrevPage->GetPageDesc();
+/*N*/ SwPageFrm *pPage = new SwPageFrm( pFmt, pTmpDesc );
+/*N*/ pPage->Paste( pRoot, pSibling );
+/*N*/ pPage->PreparePage( bFtn );
+/*N*/ //Wenn der Sibling keinen Bodytext enthaelt kann ich ihn vernichten
+/*N*/ //Es sei denn, es ist eine Fussnotenseite
+/*N*/ if ( pSibling && !pSibling->IsFtnPage() &&
+/*N*/ !pSibling->FindFirstBodyCntnt() )
+/*N*/ {
+/*N*/ SwPageFrm *pDel = pSibling;
+/*N*/ pSibling = (SwPageFrm*)pSibling->GetNext();
+/*N*/ if ( pDoc->GetFtnIdxs().Count() )
+/*?*/ pRoot->RemoveFtns( pDel, TRUE );
+/*N*/ pDel->Cut();
+/*N*/ delete pDel;
+/*N*/ }
+/*N*/ else
+/*N*/ bCheckPages = TRUE;
+/*N*/ }
+/*N*/ pFmt = bWishedOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt();
+/*N*/ ASSERT( pFmt, "Descriptor without format." );
+/*N*/ SwPageFrm *pPage = new SwPageFrm( pFmt, pDesc );
+/*N*/ pPage->Paste( pRoot, pSibling );
+/*N*/ pPage->PreparePage( bFtn );
+/*N*/ //Wenn der Sibling keinen Bodytext enthaelt kann ich ihn vernichten
+/*N*/ //Es sei denn es ist eine Fussnotenseite.
+/*N*/ if ( pSibling && !pSibling->IsFtnPage() &&
+/*N*/ !pSibling->FindFirstBodyCntnt() )
+/*N*/ {
+/*N*/ SwPageFrm *pDel = pSibling;
+/*N*/ pSibling = (SwPageFrm*)pSibling->GetNext();
+/*N*/ if ( pDoc->GetFtnIdxs().Count() )
+/*?*/ pRoot->RemoveFtns( pDel, TRUE );
+/*N*/ pDel->Cut();
+/*N*/ delete pDel;
+/*N*/ }
+/*N*/ else
+/*N*/ bCheckPages = TRUE;
+/*N*/
+/*N*/ if ( pSibling )
+/*N*/ {
+/*N*/ if ( bCheckPages )
+/*N*/ {
+/*N*/ CheckPageDescs( pSibling, FALSE );
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ SwViewImp *pImp = pSh ? pSh->Imp() : 0;
+/*N*/ if ( pImp && pImp->IsAction() && !pImp->GetLayAction().IsCheckPages() )
+/*N*/ {
+/*?*/ const USHORT nNum = pImp->GetLayAction().GetCheckPageNum();
+/*?*/ if ( nNum == pPrevPage->GetPhyPageNum() + 1 )
+/*?*/ pImp->GetLayAction().SetCheckPageNumDirect(
+/*?*/ pSibling->GetPhyPageNum() );
+/*?*/ return pPage;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pRoot->AssertPageFlys( pSibling );
+/*N*/ }
+/*N*/
+/*N*/ //Fuer das Aktualisieren der Seitennummern-Felder gibt nDocPos
+/*N*/ //die Seitenposition an, _ab_ der invalidiert werden soll.
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ if ( !pSh || !pSh->Imp()->IsUpdateExpFlds() )
+/*N*/ {
+/*N*/ SwDocPosUpdate aMsgHnt( pPrevPage->Frm().Top() );
+/*N*/ pDoc->UpdatePageFlds( &aMsgHnt );
+/*N*/ }
+/*N*/ return pPage;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::GrowFrm()
+|*
+|* Ersterstellung MA 30. Jul. 92
+|* Letzte Aenderung MA 05. May. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwTwips SwRootFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ if ( !bTst )
+/*N*/ Frm().SSize().Height() += nDist;
+/*N*/ return nDist;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwRootFrm::ShrinkFrm()
+|*
+|* Ersterstellung MA 30. Jul. 92
+|* Letzte Aenderung MA 05. May. 94
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwRootFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ ASSERT( nDist >= 0, "nDist < 0." );
+/*N*/ ASSERT( nDist <= Frm().Height(), "nDist > als aktuelle Groesse." );
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ Frm().SSize().Height() -= nDist;
+/*N*/ return nDist;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::RemoveSuperfluous()
+|*
+|* Beschreibung: Entfernung von ueberfluessigen Seiten.
+|* Arbeitet nur wenn das Flag bCheckSuperfluous gesetzt ist.
+|* Definition: Eine Seite ist genau dann leer, wenn der
+|* Body-Textbereich keinen CntntFrm enthaelt, aber nicht, wenn noch
+|* mindestens ein Fly an der Seite klebt.
+|* Die Seite ist auch dann nicht leer, wenn sie noch eine
+|* Fussnote enthaelt.
+|* Es muss zweimal angesetzt werden um leeren Seiten aufzuspueren:
+|* - einmal fuer die Endnotenseiten.
+|* - und einmal fuer die Seiten des Bodytextes.
+|*
+|* Ersterstellung MA 20. May. 92
+|* Letzte Aenderung MA 10. Jan. 95
+|*
+|*************************************************************************/
+void SwRootFrm::RemoveSuperfluous()
+{
+ if ( !IsSuperfluous() )
+ return;
+ bCheckSuperfluous = FALSE;
+
+ SwPageFrm *pPage = GetLastPage();
+ long nDocPos = LONG_MAX;
+
+ //Jetzt wird fuer die jeweils letzte Seite geprueft ob sie leer ist
+ //bei der ersten nicht leeren Seite wird die Schleife beendet.
+ do
+ {
+ bool bExistEssentialObjs = ( 0 != pPage->GetSortedObjs() );
+ if ( bExistEssentialObjs )
+ {
+ //Nur weil die Seite Flys hat sind wir noch lange nicht fertig,
+ //denn wenn alle Flys an generischem Inhalt haengen, so ist sie
+ //trotzdem ueberfluessig (Ueberpruefung auf DocBody sollte reichen).
+ // OD 19.06.2003 #108784# - consider that drawing objects in
+ // header/footer are supported now.
+ bool bOnlySuperfluosObjs = true;
+ SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+ for ( USHORT i = 0; bOnlySuperfluosObjs && i < rObjs.Count(); ++i )
+ {
+ SdrObject *pO = rObjs[i];
+ if ( pO->IsWriterFlyFrame() )
+ {
+ SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+ // OD 19.06.2003 #108784# - correction
+ if ( !pFly->GetAnchor()->FindFooterOrHeader() )
+ {
+ bOnlySuperfluosObjs = false;
+ }
+ }
+ else
+ {
+ // OD 19.06.2003 #108784# - determine, if drawing object
+ // isn't anchored in header/footer frame. If so, drawing
+ // object isn't superfluos.
+ SwFrm* pAnchorFrm = 0L;
+ if ( pO->ISA(SwDrawVirtObj) )
+ {
+ pAnchorFrm = static_cast<SwDrawVirtObj*>(pO)->GetAnchorFrm();
+ }
+ else
+ {
+ SwDrawContact* pDrawContact =
+ static_cast<SwDrawContact*>(pO->GetUserCall());
+ pAnchorFrm = pDrawContact ? pDrawContact->GetAnchor() : 0L;
+ }
+ if ( pAnchorFrm )
+ {
+ if ( !pAnchorFrm->FindFooterOrHeader() )
+ {
+ bOnlySuperfluosObjs = false;
+ }
+ }
+ }
+ }
+ bExistEssentialObjs = !bOnlySuperfluosObjs;
+ }
+
+ // OD 19.06.2003 #108784# - optimization: check first, if essential objects
+ // exists.
+ if ( bExistEssentialObjs || pPage->FindFirstBodyCntnt() || pPage->FindFtnCont() )
+ {
+ if ( pPage->IsFtnPage() )
+ {
+ while ( pPage->IsFtnPage() )
+ {
+ pPage = (SwPageFrm*)pPage->GetPrev();
+ ASSERT( pPage, "Nur noch Endnotenseiten uebrig." );
+ }
+ continue;
+ }
+ else
+ pPage = 0;
+ }
+
+ if ( pPage )
+ {
+ SwPageFrm *pEmpty = pPage;
+ pPage = (SwPageFrm*)pPage->GetPrev();
+ if ( GetFmt()->GetDoc()->GetFtnIdxs().Count() )
+ RemoveFtns( pEmpty, TRUE );
+ pEmpty->Cut();
+ delete pEmpty;
+ nDocPos = pPage ? pPage->Frm().Top() : 0;
+ }
+ } while ( pPage );
+
+ ViewShell *pSh = GetShell();
+ if ( nDocPos != LONG_MAX &&
+ (!pSh || !pSh->Imp()->IsUpdateExpFlds()) )
+ {
+ SwDocPosUpdate aMsgHnt( nDocPos );
+ GetFmt()->GetDoc()->UpdatePageFlds( &aMsgHnt );
+ }
+}
+
+/*************************************************************************
+|*
+|* SwRootFrm::AssertFlyPages()
+|*
+|* Beschreibung Stellt sicher, dass genuegend Seiten vorhanden
+|* sind, damit alle Seitengebundenen Rahmen und DrawObject
+|* untergebracht sind.
+|*
+|* Ersterstellung MA 27. Jul. 93
+|* Letzte Aenderung MA 24. Apr. 97
+|*
+|*************************************************************************/
+/*N*/ void SwRootFrm::AssertFlyPages()
+/*N*/ {
+/*N*/ if ( !IsAssertFlyPages() )
+/*N*/ return;
+/*N*/ bAssertFlyPages = FALSE;
+/*N*/
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ const SwSpzFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
+/*N*/
+/*N*/ //Auf welche Seite will der 'letzte' Fly?
+/*N*/ USHORT nMaxPg = 0;
+ USHORT i=0;
+/*N*/ for ( i = 0; i < pTbl->Count(); ++i )
+/*N*/ {
+/*N*/ const SwFmtAnchor &rAnch = (*pTbl)[i]->GetAnchor();
+/*N*/ if ( !rAnch.GetCntntAnchor() && nMaxPg < rAnch.GetPageNum() )
+/*N*/ nMaxPg = rAnch.GetPageNum();
+/*N*/ }
+/*N*/ //Wieviele Seiten haben wir derzeit?
+/*N*/ SwPageFrm *pPage = (SwPageFrm*)Lower();
+/*N*/ while ( pPage && pPage->GetNext() &&
+/*N*/ !((SwPageFrm*)pPage->GetNext())->IsFtnPage() )
+/*N*/ {
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if ( nMaxPg > pPage->GetPhyPageNum() )
+/*N*/ {
+/*N*/ //Die Seiten werden ausgehend von der letzten Seite konsequent
+/*N*/ //nach den Regeln der PageDescs weitergefuehrt.
+/*N*/ BOOL bOdd = pPage->GetPhyPageNum() % 2 ? TRUE : FALSE;
+/*N*/ SwPageDesc *pDesc = pPage->GetPageDesc();
+/*N*/ SwFrm *pSibling = pPage->GetNext();
+/*N*/ for ( i = pPage->GetPhyPageNum(); i < nMaxPg; ++i )
+/*N*/ {
+/*N*/ if ( !(bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt()) )
+/*N*/ {
+/*N*/ //Leerseite einfuegen, die Flys werden aber erst von
+/*N*/ //der naechsten Seite aufgenommen!
+/*N*/ pPage = new SwPageFrm( pDoc->GetEmptyPageFmt(), pDesc );
+/*N*/ pPage->Paste( this, pSibling );
+/*N*/ pPage->PreparePage( FALSE );
+/*N*/ bOdd = bOdd ? FALSE : TRUE;
+/*N*/ ++i;
+/*N*/ }
+/*N*/ pPage = new
+/*N*/ SwPageFrm( (bOdd ? pDesc->GetRightFmt() :
+/*N*/ pDesc->GetLeftFmt()), pDesc );
+/*N*/ pPage->Paste( this, pSibling );
+/*N*/ pPage->PreparePage( FALSE );
+/*N*/ bOdd = bOdd ? FALSE : TRUE;
+/*N*/ pDesc = pDesc->GetFollow();
+/*N*/ }
+/*N*/ //Jetzt koennen die Endnotenseiten natuerlich wieder krumm sein;
+/*N*/ //in diesem Fall werden sie vernichtet.
+/*N*/ if ( pDoc->GetFtnIdxs().Count() )
+/*N*/ {
+/*?*/ pPage = (SwPageFrm*)Lower();
+/*?*/ while ( pPage && !pPage->IsFtnPage() )
+/*?*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*?*/
+/*?*/ if ( pPage )
+/*?*/ {
+/*?*/ SwPageDesc *pDesc = pPage->FindPageDesc();
+/*?*/ bOdd = pPage->OnRightPage();
+/*?*/ if ( pPage->GetFmt() !=
+/*?*/ (bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt()) )
+/*?*/ RemoveFtns( pPage, FALSE, TRUE );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::AssertPageFlys()
+|*
+|* Beschreibung Stellt sicher, dass ab der uebergebenen Seite
+|* auf allen Seiten die Seitengebunden Objecte auf der richtigen
+|* Seite (Seitennummer stehen).
+|*
+|* Ersterstellung MA 02. Nov. 94
+|* Letzte Aenderung MA 10. Aug. 95
+|*
+|*************************************************************************/
+/*N*/ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
+/*N*/ {
+/*N*/ while ( pPage )
+/*N*/ {
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ pPage->GetSortedObjs();
+/*N*/ for ( int i = 0;
+/*N*/ pPage->GetSortedObjs() && USHORT(i) < pPage->GetSortedObjs()->Count();
+/*N*/ ++i)
+/*N*/ {
+/*N*/ SwFrmFmt *pFmt = ::binfilter::FindFrmFmt( (*pPage->GetSortedObjs())[i] );
+/*N*/ const SwFmtAnchor &rAnch = pFmt->GetAnchor();
+/*N*/ const USHORT nPg = rAnch.GetPageNum();
+/*N*/ if ( rAnch.GetAnchorId() == FLY_PAGE &&
+/*N*/ nPg != pPage->GetPhyPageNum() )
+/*N*/ {
+/*N*/ //Das er auf der falschen Seite steht muss noch nichts
+/*N*/ //heissen, wenn er eigentlich auf der Vorseite
+/*N*/ //stehen will und diese eine EmptyPage ist.
+/*N*/ if( nPg && !(pPage->GetPhyPageNum()-1 == nPg &&
+/*N*/ ((SwPageFrm*)pPage->GetPrev())->IsEmptyPage()) )
+/*N*/ {
+/*?*/ //Umhaengen kann er sich selbst, indem wir ihm
+/*?*/ //einfach ein Modify mit seinem AnkerAttr schicken.
+/*?*/ #ifndef DBG_UTIL
+/*?*/ pFmt->SwModify::Modify( 0, (SwFmtAnchor*)&rAnch );
+/*?*/ #else
+/*?*/ const USHORT nCnt = pPage->GetSortedObjs()->Count();
+/*?*/ pFmt->SwModify::Modify( 0, (SwFmtAnchor*)&rAnch );
+/*?*/ ASSERT( !pPage->GetSortedObjs() ||
+/*?*/ nCnt != pPage->GetSortedObjs()->Count(),
+/*?*/ "Kann das Obj nicht umhaengen." );
+/*?*/ #endif
+/*?*/ --i;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::ChgSize()
+|*
+|* Ersterstellung MA 24. Jul. 92
+|* Letzte Aenderung MA 13. Aug. 93
+|*
+|*************************************************************************/
+/*N*/ void SwRootFrm::ChgSize( const Size& aNewSize )
+/*N*/ {
+/*N*/ Frm().SSize() = aNewSize;
+/*N*/ _InvalidatePrt();
+/*N*/ bFixSize = FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::MakeAll()
+|*
+|* Ersterstellung MA 17. Nov. 92
+|* Letzte Aenderung MA 19. Apr. 93
+|*
+|*************************************************************************/
+/*N*/ void SwRootFrm::MakeAll()
+/*N*/ {
+/*N*/ if ( !bValidPos )
+/*N*/ { bValidPos = TRUE;
+/*N*/ aFrm.Pos().X() = aFrm.Pos().Y() = DOCUMENTBORDER;
+/*N*/ }
+/*N*/ if ( !bValidPrtArea )
+/*N*/ { bValidPrtArea = TRUE;
+/*N*/ aPrt.Pos().X() = aPrt.Pos().Y() = 0;
+/*N*/ aPrt.SSize( aFrm.SSize() );
+/*N*/ }
+/*N*/ if ( !bValidSize )
+/*N*/ //SSize wird von den Seiten (Cut/Paste) eingestellt.
+/*N*/ bValidSize = TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::ImplInvalidateBrowseWidth()
+|*
+|* Ersterstellung MA 08. Jun. 96
+|* Letzte Aenderung MA 08. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ void SwRootFrm::ImplInvalidateBrowseWidth()
+/*N*/ {
+/*N*/ bBrowseWidthValid = FALSE;
+/*N*/ SwFrm *pPg = Lower();
+/*N*/ while ( pPg )
+/*N*/ {
+/*N*/ pPg->InvalidateSize();
+/*N*/ pPg = pPg->GetNext();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::ImplCalcBrowseWidth()
+|*
+|* Ersterstellung MA 07. Jun. 96
+|* Letzte Aenderung MA 13. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ void SwRootFrm::ImplCalcBrowseWidth()
+/*N*/ {
+/*N*/ ASSERT( GetFmt()->GetDoc()->IsBrowseMode(),
+/*N*/ "CalcBrowseWidth and not in BrowseView" );
+/*N*/
+/*N*/ //Die (minimale) Breite wird von Rahmen, Tabellen und Zeichenobjekten
+/*N*/ //bestimmt. Die Breite wird nicht anhand ihrer aktuellen Groessen bestimmt,
+/*N*/ //sondern anhand der Attribute. Es interessiert also nicht wie breit sie
+/*N*/ //sind, sondern wie breit sie sein wollen.
+/*N*/ //Rahmen und Zeichenobjekte innerhalb ander Objekte (Rahmen, Tabellen)
+/*N*/ //Zaehlen nicht.
+/*N*/ //Seitenraender und Spalten werden hier nicht beruecksichtigt.
+/*N*/
+/*N*/ SwFrm *pFrm = ContainsCntnt();
+/*N*/ while ( pFrm && !pFrm->IsInDocBody() )
+/*?*/ pFrm = ((SwCntntFrm*)pFrm)->GetNextCntntFrm();
+/*N*/ if ( !pFrm )
+/*N*/ return;
+/*N*/
+/*N*/ bBrowseWidthValid = TRUE;
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ nBrowseWidth = pSh
+/*N*/ ? MINLAY + 2 * pSh->GetOut()->
+/*N*/ PixelToLogic( pSh->GetBrowseBorder() ).Width()
+/*N*/ : 5000;
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pFrm->IsInTab() )
+/*N*/ pFrm = pFrm->FindTabFrm();
+/*N*/
+/*N*/ if ( pFrm->IsTabFrm() &&
+/*N*/ !((SwLayoutFrm*)pFrm)->GetFmt()->GetFrmSize().GetWidthPercent() )
+/*N*/ {
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ const SwFmtHoriOrient &rHori = rAttrs.GetAttrSet().GetHoriOrient();
+/*N*/ long nWidth = rAttrs.GetSize().Width();
+/*N*/ if ( nWidth < USHRT_MAX-2000 && //-2000, weil bei Randeinstellung per
+/*N*/ //Zuppeln das USHRT_MAX verlorengeht!
+/*N*/ HORI_FULL != rHori.GetHoriOrient() )
+/*N*/ {
+/*N*/ const SwHTMLTableLayout *pLayoutInfo =
+/*N*/ ((const SwTabFrm *)pFrm)->GetTable()
+/*N*/ ->GetHTMLTableLayout();
+/*N*/ if ( pLayoutInfo )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 nWidth = Min( nWidth, pLayoutInfo->GetBrowseWidthMin() );
+/*N*/
+/*N*/ switch ( rHori.GetHoriOrient() )
+/*N*/ {
+/*?*/ case HORI_NONE:
+/*?*/ // OD 23.01.2003 #106895# - add 1st param to <SwBorderAttrs::CalcRight(..)>
+/*?*/ nWidth += rAttrs.CalcLeft( pFrm ) + rAttrs.CalcRight( pFrm );
+/*?*/ break;
+/*?*/ case HORI_LEFT_AND_WIDTH:
+/*?*/ nWidth += rAttrs.CalcLeft( pFrm );
+/*N*/ }
+/*N*/ nBrowseWidth = Max( nBrowseWidth, nWidth );
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < pFrm->GetDrawObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pFrm->GetDrawObjs())[i];
+/*N*/ SwFrmFmt *pFmt = ::binfilter::FindFrmFmt( pObj );
+/*N*/ const FASTBOOL bFly = pObj->IsWriterFlyFrame();
+/*N*/ if ( bFly &&
+/*N*/ WEIT_WECH == ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->Frm().Width()||
+/*N*/ pFmt->GetFrmSize().GetWidthPercent() )
+/*?*/ continue;
+/*N*/
+/*N*/ long nWidth = 0;
+/*N*/ switch ( pFmt->GetAnchor().GetAnchorId() )
+/*N*/ {
+/*N*/ case FLY_IN_CNTNT:
+/*N*/ nWidth = bFly ? pFmt->GetFrmSize().GetWidth() :
+/*N*/ pObj->GetBoundRect().GetWidth();
+/*N*/ break;
+/*N*/ case FLY_AT_CNTNT:
+/*N*/ {
+/*N*/ if ( bFly )
+/*N*/ {
+/*N*/ nWidth = pFmt->GetFrmSize().GetWidth();
+/*N*/ const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient();
+/*N*/ switch ( rHori.GetHoriOrient() )
+/*N*/ {
+/*N*/ case HORI_NONE:
+/*N*/ nWidth += rHori.GetPos();
+/*N*/ break;
+/*N*/ case HORI_INSIDE:
+/*N*/ case HORI_LEFT:
+/*?*/ if ( PRTAREA == rHori.GetRelationOrient() )
+/*?*/ nWidth += pFrm->Prt().Left();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ //Fuer Zeichenobjekte ist die Auswahl sehr klein,
+/*N*/ //weil sie keine Attribute haben, also durch ihre
+/*N*/ //aktuelle Groesse bestimmt werden.
+/*N*/ nWidth = pObj->GetBoundRect().Right() -
+/*N*/ pObj->GetAnchorPos().X();
+/*N*/
+/*N*/ //MA 31. Jan. 97: Zaehlt doch garnicht mehr, seit die Flys den Rand nicht
+/*N*/ //mehr beruecksichtigen.
+/*N*/ // const SwContact *pCon = (SwContact*)pObj->GetUserCall();
+/*N*/ // const SvxLRSpaceItem &rLR = pCon->GetFmt()->GetLRSpace();
+/*N*/ // nWidth += rLR.GetLeft() + rLR.GetRight();
+/*N*/ }
+/*N*/ break;
+/*N*/ default: /* do nothing */;
+/*N*/ }
+/*N*/ nBrowseWidth = Max( nBrowseWidth, nWidth );
+/*N*/ }
+/*N*/ }
+/*N*/ pFrm = pFrm->FindNextCnt();
+/*N*/ } while ( pFrm );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::StartAllAction()
+|*
+|* Ersterstellung MA 08. Mar. 98
+|* Letzte Aenderung MA 08. Mar. 98
+|*
+|*************************************************************************/
+
+/*N*/ void SwRootFrm::StartAllAction()
+/*N*/ {
+/*N*/ ViewShell *pSh = GetCurrShell();
+/*N*/ if ( pSh )
+/*N*/ do
+/*N*/ { if ( pSh->ISA( SwCrsrShell ) )
+/*N*/ ((SwCrsrShell*)pSh)->StartAction();
+/*N*/ else
+/*?*/ pSh->StartAction();
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != GetCurrShell() );
+/*N*/ }
+
+/*N*/ void SwRootFrm::EndAllAction( BOOL bVirDev )
+/*N*/ {
+/*N*/ ViewShell *pSh = GetCurrShell();
+/*N*/ if ( pSh )
+/*N*/ do
+/*N*/ {
+/*N*/ const BOOL bOldEndActionByVirDev = pSh->IsEndActionByVirDev();
+/*N*/ pSh->SetEndActionByVirDev( bVirDev );
+/*N*/ if ( pSh->ISA( SwCrsrShell ) )
+/*N*/ {
+/*N*/ ((SwCrsrShell*)pSh)->EndAction();
+/*N*/ ((SwCrsrShell*)pSh)->CallChgLnk();
+/*N*/ if ( pSh->ISA( SwFEShell ) )
+/*N*/ ((SwFEShell*)pSh)->SetChainMarker();
+/*N*/ }
+/*N*/ else
+/*?*/ pSh->EndAction();
+/*N*/ pSh->SetEndActionByVirDev( bOldEndActionByVirDev );
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != GetCurrShell() );
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_pagedesc.cxx b/binfilter/bf_sw/source/core/layout/sw_pagedesc.cxx
new file mode 100644
index 000000000000..1c366cc6ab93
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_pagedesc.cxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hintids.hxx>
+
+#include <bf_svx/pbinitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include "bf_svx/frmdiritem.hxx"
+#include <fmtclds.hxx>
+#include <fmtfsize.hxx>
+#include <frmatr.hxx>
+#include <pagefrm.hxx>
+#include <pagedesc.hxx>
+#include <node.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx> // fuer GetAttrPool
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* SwPageDesc::SwPageDesc()
+|*
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung MA 16. Feb. 94
+|*
+|*************************************************************************/
+
+
+
+/*N*/ SwPageDesc::SwPageDesc( const String& rName, SwFrmFmt *pFmt, SwDoc *pDc ) :
+/*N*/ SwModify( 0 ),
+/*N*/ aDescName( rName ),
+/*N*/ aDepend( this, 0 ),
+/*N*/ nRegHeight( 0 ),
+/*N*/ nRegAscent( 0 ),
+/*N*/ bLandscape( FALSE ),
+/*N*/ eUse( (UseOnPage)(PD_ALL | PD_HEADERSHARE | PD_FOOTERSHARE) ),
+/*N*/ aMaster( pDc->GetAttrPool(), rName, pFmt ),
+/*N*/ aLeft( pDc->GetAttrPool(), rName, pFmt ),
+/*N*/ pFollow( this ),
+/*N*/ aFtnInfo()
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwPageDesc::SwPageDesc( const SwPageDesc &rCpy ) :
+/*N*/ SwModify( 0 ),
+/*N*/ aDepend( this, (SwModify*)rCpy.aDepend.GetRegisteredIn() ),
+/*N*/ nRegHeight( rCpy.GetRegHeight() ),
+/*N*/ nRegAscent( rCpy.GetRegAscent() ),
+/*N*/ aDescName( rCpy.GetName() ),
+/*N*/ bLandscape( rCpy.GetLandscape() ),
+/*N*/ aNumType( rCpy.GetNumType() ),
+/*N*/ eUse( rCpy.ReadUseOn() ),
+/*N*/ aMaster( rCpy.GetMaster() ),
+/*N*/ aLeft( rCpy.GetLeft() ),
+/*N*/ pFollow( rCpy.pFollow ),
+/*N*/ aFtnInfo( rCpy.GetFtnInfo() )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwPageDesc::~SwPageDesc()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageDesc::Mirror()
+|*
+|* Beschreibung Gespiegelt werden nur die Raender.
+|* Attribute wie Umrandung und dergleichen werden 1:1 kopiert.
+|* Ersterstellung MA 25. Jan. 93
+|* Letzte Aenderung 01. Nov. 94
+|*
+|*************************************************************************/
+
+
+
+/*N*/ void SwPageDesc::Mirror()
+/*N*/ {
+/*N*/ //Das Spiegeln findet nur beim RandAttribut statt, alle anderen Werte
+/*N*/ //werden schlicht uebertragen.
+/*N*/ SvxLRSpaceItem aLR;
+/*N*/ const SvxLRSpaceItem &rLR = aMaster.GetLRSpace();
+/*N*/ aLR.SetLeft( rLR.GetRight() );
+/*N*/ aLR.SetRight( rLR.GetLeft() );
+/*N*/
+/*N*/ SfxItemSet aSet( *aMaster.GetAttrSet().GetPool(),
+/*N*/ aMaster.GetAttrSet().GetRanges() );
+/*N*/ aSet.Put( aLR );
+/*N*/ aSet.Put( aMaster.GetFrmSize() );
+/*N*/ aSet.Put( aMaster.GetPaperBin() );
+/*N*/ aSet.Put( aMaster.GetULSpace() );
+/*N*/ aSet.Put( aMaster.GetBox() );
+/*N*/ aSet.Put( aMaster.GetBackground() );
+/*N*/ aSet.Put( aMaster.GetShadow() );
+/*N*/ aSet.Put( aMaster.GetCol() );
+/*N*/ aLeft.SetAttr( aSet );
+/*N*/ }
+
+/*N*/ void SwPageDesc::ResetAllAttr( sal_Bool bLeft )
+/*N*/ {
+/*N*/ SwFrmFmt& rFmt = bLeft ? GetLeft() : GetMaster();
+/*N*/
+/*N*/ rFmt.ResetAllAttr();
+/*N*/ rFmt.SetAttr( SvxFrameDirectionItem() );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageDesc::GetInfo()
+|*
+|* Beschreibung erfragt Informationen
+|* Ersterstellung JP 31.03.94
+|* Letzte Aenderung JP 31.03.94
+|*
+*************************************************************************/
+
+
+ // erfrage vom Modify Informationen
+
+/*************************************************************************
+|*
+|* SwPageDesc::SetRegisterFmtColl()
+|*
+|* Beschreibung setzt die Vorlage fuer die Registerhaltigkeit
+|* Ersterstellung AMA 22.07.96
+|* Letzte Aenderung AMA 22.07.96
+|*
+*************************************************************************/
+
+
+/*N*/ void SwPageDesc::SetRegisterFmtColl( const SwTxtFmtColl* pFmt )
+/*N*/ {
+/*N*/ if( pFmt != GetRegisterFmtColl() )
+/*N*/ {
+/*N*/ if( pFmt )
+/*N*/ ((SwTxtFmtColl*)pFmt)->Add( &aDepend );
+/*N*/ else
+/*?*/ ((SwTxtFmtColl*)GetRegisterFmtColl())->Remove( &aDepend );
+/*N*/
+/*N*/ RegisterChange();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageDesc::GetRegisterFmtColl()
+|*
+|* Beschreibung holt die Vorlage fuer die Registerhaltigkeit
+|* Ersterstellung AMA 22.07.96
+|* Letzte Aenderung AMA 22.07.96
+|*
+*************************************************************************/
+
+
+/*N*/ const SwTxtFmtColl* SwPageDesc::GetRegisterFmtColl() const
+/*N*/ {
+/*N*/ const SwModify* pReg = aDepend.GetRegisteredIn();
+/*N*/ return (SwTxtFmtColl*)pReg;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageDesc::RegisterChange()
+|*
+|* Beschreibung benachrichtigt alle betroffenen PageFrames
+|* Ersterstellung AMA 22.07.96
+|* Letzte Aenderung AMA 22.07.96
+|*
+*************************************************************************/
+
+
+/*N*/ void SwPageDesc::RegisterChange()
+/*N*/ {
+/*N*/ nRegHeight = 0;
+/*N*/ {
+/*N*/ SwClientIter aIter( GetMaster() );
+/*N*/ for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast;
+/*N*/ pLast = aIter.Next() )
+/*N*/ {
+/*N*/ if( ((SwFrm*)pLast)->IsPageFrm() )
+/*N*/ ((SwPageFrm*)pLast)->PrepareRegisterChg();
+/*N*/ }
+/*N*/ }
+/*N*/ {
+/*N*/ SwClientIter aIter( GetLeft() );
+/*N*/ for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast;
+/*N*/ pLast = aIter.Next() )
+/*N*/ {
+/*N*/ if( ((SwFrm*)pLast)->IsPageFrm() )
+/*N*/ ((SwPageFrm*)pLast)->PrepareRegisterChg();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageDesc::Modify()
+|*
+|* Beschreibung reagiert insbesondere auf Aenderungen
+|* der Vorlage fuer die Registerhaltigkeit
+|* Ersterstellung AMA 22.07.96
+|* Letzte Aenderung AMA 22.07.96
+|*
+*************************************************************************/
+
+
+/*N*/ void SwPageDesc::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*N*/ {
+/*N*/ const USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ SwModify::Modify( pOld, pNew );
+/*N*/
+/*N*/ if( RES_ATTRSET_CHG == nWhich || RES_FMT_CHG == nWhich ||
+/*N*/ ( nWhich >= RES_CHRATR_BEGIN && nWhich < RES_CHRATR_END ) ||
+/*N*/ nWhich == RES_PARATR_LINESPACING )
+/*N*/ RegisterChange();
+/*N*/ }
+
+
+
+
+
+/*************************************************************************
+|*
+|* SwPageFtnInfo::SwPageFtnInfo()
+|*
+|* Ersterstellung MA 24. Feb. 93
+|* Letzte Aenderung MA 24. Feb. 93
+|*
+|*************************************************************************/
+
+
+
+/*N*/ SwPageFtnInfo::SwPageFtnInfo() :
+/*N*/ nMaxHeight( 0 ),
+/*N*/ // aPen( PEN_SOLID ),
+/*N*/ nLineWidth(10),
+/*N*/ aWidth( 25, 100 ),
+/*N*/ eAdj( FTNADJ_LEFT ),
+/*N*/ nTopDist( 57 ), //1mm
+/*N*/ nBottomDist( 57 )
+/*N*/ {
+/*N*/ // aPen.SetWidth( 10 );
+/*N*/ }
+
+
+
+/*N*/ SwPageFtnInfo::SwPageFtnInfo( const SwPageFtnInfo &rCpy ) :
+/*N*/ nMaxHeight( rCpy.GetHeight() ),
+/*N*/ // aPen( rCpy.GetPen() ),
+/*N*/ nLineWidth(rCpy.nLineWidth),
+/*N*/ aLineColor(rCpy.aLineColor),
+/*N*/ aWidth( rCpy.GetWidth() ),
+/*N*/ eAdj( rCpy.GetAdj() ),
+/*N*/ nTopDist( rCpy.GetTopDist() ),
+/*N*/ nBottomDist( rCpy.GetBottomDist() )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwPageFtnInfo::operator=
+|*
+|* Ersterstellung MA 24. Feb. 93
+|* Letzte Aenderung MA 24. Feb. 93
+|*
+|*************************************************************************/
+
+
+
+/*N*/ SwPageFtnInfo &SwPageFtnInfo::operator=( const SwPageFtnInfo& rCpy )
+/*N*/ {
+/*N*/ nMaxHeight = rCpy.GetHeight();
+/*N*/ // aPen = rCpy.GetPen();
+/*N*/ nLineWidth = rCpy.nLineWidth;
+/*N*/ aLineColor = rCpy.aLineColor;
+/*N*/ aWidth = rCpy.GetWidth();
+/*N*/ eAdj = rCpy.GetAdj();
+/*N*/ nTopDist = rCpy.GetTopDist();
+/*N*/ nBottomDist = rCpy.GetBottomDist();
+/*N*/ return *this;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwPageFtnInfo::operator==
+|*
+|* Ersterstellung MA 01. Mar. 93
+|* Letzte Aenderung MA 01. Mar. 93
+|*
+|*************************************************************************/
+
+
+
+/*N*/ BOOL SwPageFtnInfo::operator==( const SwPageFtnInfo& rCmp ) const
+/*N*/ {
+/*N*/ // const Pen aTmp( rCmp.GetPen() );
+/*N*/ return ( nMaxHeight == rCmp.GetHeight() &&
+/*N*/ // aPen == aTmp &&
+/*N*/ nLineWidth == rCmp.nLineWidth &&
+/*N*/ aLineColor == rCmp.aLineColor &&
+/*N*/ aWidth == rCmp.GetWidth() &&
+/*N*/ eAdj == rCmp.GetAdj() &&
+/*N*/ nTopDist == rCmp.GetTopDist() &&
+/*N*/ nBottomDist== rCmp.GetBottomDist() );
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_pageiter.cxx b/binfilter/bf_sw/source/core/layout/sw_pageiter.cxx
new file mode 100644
index 000000000000..f3a46327758d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_pageiter.cxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "pagefrm.hxx"
+#include "cntfrm.hxx"
+#include "pam.hxx"
+
+#include <node.hxx>
+#include "pageiter.hxx"
+#include "txtfrm.hxx"
+namespace binfilter {
+
+
+
+
+SwPageIter::SwPageIter( const SwDoc &rDoc, const SwPosition &rStartPos )
+ : rPDoc( rDoc ), pPage(0)
+{
+ Seek( rStartPos );
+}
+
+
+
+BOOL SwPageIter::NextPage()
+{
+ if( IsEnd() )
+ return FALSE;
+ pPage = (SwPageFrm*)pPage->GetNext();
+ return TRUE;
+}
+
+
+
+const SwPageDesc* SwPageIter::GetPageDesc() const
+{
+ return ( IsEnd() )? 0 : pPage->GetPageDesc();
+}
+
+
+
+BOOL SwPageIter::Seek( const SwPosition &rPos )
+{
+ const SwTxtFrm *pTxt = (SwTxtFrm*)rPDoc.GetNodes()[rPos.nNode.GetIndex()]->
+ GetCntntNode()->GetFrm();
+ if ( !pTxt )
+ return FALSE;
+
+ pTxt = pTxt->GetFrmAtPos( rPos );
+ pPage = pTxt->FindPageFrm();
+ return TRUE;
+}
+
+
+
+BOOL SwPageIter::GetPosition( SwPosition &rPos ) const
+{
+ if( IsEnd() )
+ return FALSE;
+
+ const SwCntntFrm *pCnt = pPage->FindFirstBodyCntnt();
+ if ( !pCnt )
+ return FALSE;
+
+ pCnt = ((SwTxtFrm*)pCnt)->GetFrmAtPos( rPos );
+ if ( !pCnt )
+ return FALSE;
+
+ rPos.nNode = *pCnt->GetNode();
+ rPos.nContent.Assign( rPos.nNode.GetNode().GetCntntNode(),
+ ((SwTxtFrm*)pCnt)->GetOfst() );
+
+ return TRUE;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_paintfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_paintfrm.cxx
new file mode 100644
index 000000000000..34a677dc586f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_paintfrm.cxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <pagefrm.hxx>
+
+namespace binfilter
+{
+
+const sal_Int8 SwPageFrm::mnBorderPxWidth = 1;
+const sal_Int8 SwPageFrm::mnShadowPxWidth = 2;
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_sectfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_sectfrm.cxx
new file mode 100644
index 000000000000..13cebebfaa85
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_sectfrm.cxx
@@ -0,0 +1,2159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svtools/itemiter.hxx>
+
+#include <hints.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <fmtclbl.hxx>
+#include "sectfrm.hxx"
+#include "section.hxx" // SwSection
+#include "frmtool.hxx" // StackHack
+
+#include <horiornt.hxx>
+
+#include "doc.hxx" // SwDoc
+#include "pagefrm.hxx" // SwPageFrm
+#include "txtfrm.hxx" // SwTxtFrm
+#include "fmtclds.hxx" // SwFmtCol
+#include "colfrm.hxx" // SwColumnFrm
+#include "tabfrm.hxx" // SwTabFrm
+#include "flyfrm.hxx" // SwFlyFrm
+#include "ftnfrm.hxx" // SwFtnFrm
+#include "dbg_lay.hxx"
+#include "frmsh.hxx"
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <fmtftntx.hxx>
+namespace binfilter {
+
+/*N*/ SV_IMPL_PTRARR_SORT( SwDestroyList, SwSectionFrmPtr )
+
+/*************************************************************************
+|*
+|* SwSectionFrm::SwSectionFrm(), ~SwSectionFrm()
+|*
+|* Ersterstellung AMA 26. Nov. 97
+|* Letzte Aenderung AMA 26. Nov. 97
+|*
+|*************************************************************************/
+/*N*/ SwSectionFrm::SwSectionFrm( SwSection &rSect ) :
+/*N*/ SwLayoutFrm( rSect.GetFmt() ),
+/*N*/ SwFlowFrm( (SwFrm&)*this ),
+/*N*/ pSection( &rSect )
+/*N*/ {
+/*N*/ nType = FRMC_SECTION;
+/*N*/
+/*N*/ CalcFtnAtEndFlag();
+/*N*/ CalcEndAtEndFlag();
+/*N*/ }
+
+/*N*/ SwSectionFrm::SwSectionFrm( SwSectionFrm &rSect, BOOL bMaster ) :
+/*N*/ SwLayoutFrm( rSect.GetFmt() ),
+/*N*/ SwFlowFrm( (SwFrm&)*this ),
+/*N*/ pSection( rSect.GetSection() )
+/*N*/ {
+/*N*/ bFtnAtEnd = rSect.IsFtnAtEnd();
+/*N*/ bEndnAtEnd = rSect.IsEndnAtEnd();
+/*N*/ bLockJoin = FALSE;
+/*N*/ nType = FRMC_SECTION;
+/*N*/
+/*N*/ PROTOCOL( this, PROT_SECTION, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect )
+/*N*/
+/*N*/ if( bMaster )
+/*N*/ {
+/*N*/ if( rSect.IsFollow() )
+/*N*/ {
+/*N*/ SwSectionFrm* pMaster = rSect.FindSectionMaster();
+/*N*/ pMaster->SetFollow( this );
+/*N*/ bIsFollow = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ rSect.bIsFollow = TRUE;
+/*N*/ SetFollow( &rSect );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bIsFollow = TRUE;
+/*N*/ SetFollow( rSect.GetFollow() );
+/*N*/ rSect.SetFollow( this );
+/*N*/ if( !GetFollow() )
+/*N*/ rSect.SimpleFormat();
+/*N*/ if( !rSect.IsColLocked() )
+/*N*/ rSect.InvalidateSize();
+/*N*/ }
+/*N*/ }
+
+// NOTE: call <SwSectionFrm::Init()> directly after creation of a new section
+// frame and its insert in the layout.
+/*N*/ void SwSectionFrm::Init()
+/*N*/ {
+/*N*/ ASSERT( GetUpper(), "SwSectionFrm::Init before insertion?!" );
+/*N*/ SWRECTFN( this )
+/*N*/ long nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
+/*N*/ (Frm().*fnRect->fnSetWidth)( nWidth );
+/*N*/ (Frm().*fnRect->fnSetHeight)( 0 );
+/*N*/
+/*N*/ // #109700# LRSpace for sections
+/*N*/ const SvxLRSpaceItem& rLRSpace = GetFmt()->GetLRSpace();
+/*N*/ (Prt().*fnRect->fnSetLeft)( rLRSpace.GetLeft() );
+/*N*/ (Prt().*fnRect->fnSetWidth)( nWidth - rLRSpace.GetLeft() -
+/*N*/ rLRSpace.GetRight() );
+/*N*/ (Prt().*fnRect->fnSetHeight)( 0 );
+/*N*/
+/*N*/ const SwFmtCol &rCol = GetFmt()->GetCol();
+/*N*/ if( ( rCol.GetNumCols() > 1 || IsAnyNoteAtEnd() ) && !IsInFtn() )
+/*N*/ {
+/*N*/ const SwFmtCol *pOld = Lower() ? &rCol : new SwFmtCol;
+/*N*/ ChgColumns( *pOld, rCol, IsAnyNoteAtEnd() );
+/*N*/ if( pOld != &rCol )
+/*N*/ delete pOld;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwSectionFrm::~SwSectionFrm()
+/*N*/ {
+/*N*/ if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = GetFmt()->GetDoc()->GetRootFrm();
+/*N*/ if( pRootFrm )
+/*N*/ pRootFrm->RemoveFromList( this );
+/*N*/ if( IsFollow() )
+/*N*/ {
+/*?*/ SwSectionFrm *pMaster = FindSectionMaster();
+/*?*/ if( pMaster )
+/*?*/ {
+/*?*/ PROTOCOL( this, PROT_SECTION, ACT_DEL_FOLLOW, pMaster )
+/*?*/ pMaster->SetFollow( GetFollow() );
+/*?*/ // Ein Master greift sich immer den Platz bis zur Unterkante seines
+/*?*/ // Uppers. Wenn er keinen Follow mehr hat, kann er diesen ggf. wieder
+/*?*/ // freigeben, deshalb wird die Size des Masters invalidiert.
+/*?*/ if( !GetFollow() )
+/*?*/ pMaster->InvalidateSize();
+/*?*/ }
+/*N*/ }
+/*N*/ else if( HasFollow() )
+/*N*/ {
+/*?*/ PROTOCOL( this, PROT_SECTION, ACT_DEL_MASTER, GetFollow() )
+/*?*/ GetFollow()->bIsFollow = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::FindSectionMaster()
+|*
+|* Ersterstellung AMA 17. Dec. 97
+|* Letzte Aenderung AMA 17. Dec. 97
+|*
+|*************************************************************************/
+
+/*N*/ SwSectionFrm *SwSectionFrm::FindSectionMaster()
+/*N*/ {
+/*N*/ ASSERT( IsFollow(), "FindSectionMaster: !IsFollow" );
+/*N*/ SwClientIter aIter( *(pSection->GetFmt()) );
+/*N*/ SwClient *pLast = aIter.GoStart();
+/*N*/ while ( pLast )
+/*N*/ {
+/*N*/ if ( pLast->ISA( SwFrm ) )
+/*N*/ {
+/*N*/ SwSectionFrm* pSect = (SwSectionFrm*)pLast;
+/*N*/ if( pSect->GetFollow() == this )
+/*N*/ return pSect;
+/*N*/ }
+/*N*/ pLast = aIter++;
+/*N*/ }
+/*?*/ return NULL;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwSectionFrm::DelEmpty()
+|*
+|* Ersterstellung AMA 17. Dec. 97
+|* Letzte Aenderung AMA 17. Dec. 97
+|*
+|*************************************************************************/
+/*N*/ void SwSectionFrm::DelEmpty( BOOL bRemove )
+/*N*/ {
+/*N*/ if( IsColLocked() )
+/*N*/ {
+/*N*/ ASSERT( !bRemove, "Don't delete locked SectionFrms" );
+/*N*/ return;
+/*N*/ }
+/*N*/ SwFrm* pUp = GetUpper();
+/*N*/ if( pUp )
+/*N*/ _Cut( bRemove );
+/*N*/ if( IsFollow() )
+/*N*/ {
+/*N*/ SwSectionFrm *pMaster = FindSectionMaster();
+/*N*/ pMaster->SetFollow( GetFollow() );
+/*N*/ // Ein Master greift sich immer den Platz bis zur Unterkante seines
+/*N*/ // Uppers. Wenn er keinen Follow mehr hat, kann er diesen ggf. wieder
+/*N*/ // freigeben, deshalb wird die Size des Masters invalidiert.
+/*N*/ if( !GetFollow() && !pMaster->IsColLocked() )
+/*N*/ pMaster->InvalidateSize();
+/*N*/ bIsFollow = FALSE;
+/*N*/ }
+/*N*/ else if( HasFollow() )
+/*N*/ GetFollow()->bIsFollow = FALSE;
+/*N*/ pFollow = NULL;
+/*N*/ if( pUp )
+/*N*/ {
+/*N*/ Frm().Height( 0 );
+/*N*/ // Wenn wir sowieso sofort zerstoert werden, brauchen/duerfen wir
+/*N*/ // uns gar nicht erst in die Liste eintragen
+/*N*/ if( bRemove )
+/*N*/ { // Wenn wir bereits halbtot waren vor diesem DelEmpty, so
+/*N*/ // stehen wir vermutlich auch in der Liste und muessen uns
+/*N*/ // dort austragen
+/*N*/ if( !pSection )
+/*?*/ GetFmt()->GetDoc()->GetRootFrm()->RemoveFromList( this );
+/*N*/ }
+/*N*/ else
+/*N*/ GetFmt()->GetDoc()->GetRootFrm()->InsertEmptySct( this );
+/*N*/ pSection = NULL; // damit ist allerdings eine Reanimierung quasi ausgeschlossen
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::Cut()
+|*
+|* Ersterstellung AMA 02. Dec. 97
+|* Letzte Aenderung AMA 02. Dec. 97
+|*
+|*************************************************************************/
+/*N*/ void SwSectionFrm::Cut()
+/*N*/ {
+/*N*/ _Cut( TRUE );
+/*N*/ }
+
+/*N*/ void SwSectionFrm::_Cut( BOOL bRemove )
+/*N*/ {
+/*N*/ ASSERT( GetUpper(), "Cut ohne Upper()." );
+/*N*/
+/*N*/ PROTOCOL( this, PROT_CUT, 0, GetUpper() )
+/*N*/
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ SwFrm *pFrm = GetNext();
+/*N*/ SwFrm* pPrepFrm = NULL;
+/*N*/ while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
+/*?*/ pFrm = pFrm->GetNext();
+/*N*/ if( pFrm )
+/*N*/ { //Der alte Nachfolger hat evtl. einen Abstand zum Vorgaenger
+/*N*/ //berechnet der ist jetzt wo er der erste wird obsolete
+/*N*/ pFrm->_InvalidatePrt();
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ if( pFrm->IsSctFrm() )
+/*N*/ pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if ( pFrm && pFrm->IsCntntFrm() )
+/*N*/ {
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ if( IsInFtn() && !GetIndPrev() )
+/*?*/ pPrepFrm = pFrm;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ InvalidateNextPos();
+/*N*/ //Einer muss die Retusche uebernehmen: Vorgaenger oder Upper
+/*N*/ if ( 0 != (pFrm = GetPrev()) )
+/*N*/ { pFrm->SetRetouche();
+/*N*/ pFrm->Prepare( PREP_WIDOWS_ORPHANS );
+/*N*/ if ( pFrm->IsCntntFrm() )
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ //Wenn ich der einzige FlowFrm in meinem Upper bin (war), so muss
+/*N*/ //er die Retouche uebernehmen.
+/*N*/ //Ausserdem kann eine Leerseite entstanden sein.
+/*N*/ else
+/*N*/ { SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
+/*N*/ pRoot->SetSuperfluous();
+/*N*/ GetUpper()->SetCompletePaint();
+/*N*/ }
+/*N*/ }
+/*N*/ //Erst removen, dann Upper Shrinken.
+/*N*/ SwLayoutFrm *pUp = GetUpper();
+/*N*/ if( bRemove )
+/*N*/ {
+/*N*/ Remove();
+/*N*/ if( pUp && !pUp->Lower() && pUp->IsFtnFrm() && !pUp->IsColLocked() &&
+/*N*/ pUp->GetUpper() )
+/*N*/ {
+/*?*/ pUp->Cut();
+/*?*/ delete pUp;
+/*?*/ pUp = NULL;
+/*N*/ }
+/*N*/ }
+/*N*/ if( pPrepFrm )
+/*?*/ pPrepFrm->Prepare( PREP_FTN );
+/*N*/ if ( pUp )
+/*N*/ {
+/*N*/ SWRECTFN( this );
+/*N*/ SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nFrmHeight > 0 )
+/*N*/ {
+/*N*/ if( !bRemove )
+/*N*/ {
+/*N*/ (Frm().*fnRect->fnSetHeight)( 0 );
+/*N*/ (Prt().*fnRect->fnSetHeight)( 0 );
+/*N*/ }
+/*N*/ pUp->Shrink( nFrmHeight );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::Paste()
+|*
+|* Ersterstellung AMA 04. Dec. 97
+|* Letzte Aenderung AMA 04. Dec. 97
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwSectionFrm::HasToBreak()
+|*
+|* Hier wird entschieden, ob der this-SectionFrm den uebergebenen
+|* (Section)Frm aufbrechen soll oder nicht.
+|* Zunaechst werden uebergeordnete Bereiche immer aufgebrochen,
+|* spaeter koennte man es einstellbar machen.
+|*
+|* Ersterstellung AMA 12. Dec. 97
+|* Letzte Aenderung AMA 12. Dec. 97
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwSectionFrm::MergeNext()
+|*
+|* Ersterstellung AMA 04. Dec. 97
+|* Letzte Aenderung AMA 04. Dec. 97
+|*
+|* Verschmilzt zwei SectionFrms, falls es sich um den
+|* gleichen Bereich handelt.
+|* Notwendig kann dies sein, wenn ein (Unter-)Bereich geloescht wird, der
+|* einen anderen in zwei Teile zerlegt hatte.
+|*
+|*************************************************************************/
+
+/*N*/ void SwSectionFrm::MergeNext( SwSectionFrm* pNxt )
+/*N*/ {
+/*N*/ if( !pNxt->IsJoinLocked() && GetSection() == pNxt->GetSection() )
+/*N*/ {
+/*N*/ PROTOCOL( this, PROT_SECTION, ACT_MERGE, pNxt )
+/*N*/
+/*N*/ SwFrm* pTmp = ::binfilter::SaveCntnt( pNxt );
+/*N*/ if( pTmp )
+/*N*/ {
+/*N*/ SwFrm* pLast = Lower();
+/*N*/ SwLayoutFrm* pLay = this;
+/*N*/ if( pLast )
+/*N*/ {
+/*N*/ while( pLast->GetNext() )
+/*N*/ pLast = pLast->GetNext();
+/*N*/ if( pLast->IsColumnFrm() )
+/*N*/ { // Spalten jetzt mit BodyFrm
+/*?*/ pLay = (SwLayoutFrm*)((SwLayoutFrm*)pLast)->Lower();
+/*?*/ pLast = pLay->Lower();
+/*?*/ if( pLast )
+/*?*/ while( pLast->GetNext() )
+/*?*/ pLast = pLast->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ ::binfilter::RestoreCntnt( pTmp, pLay, pLast );
+/*N*/ }
+/*N*/ SetFollow( pNxt->GetFollow() );
+/*N*/ pNxt->SetFollow( NULL );
+/*N*/ pNxt->bIsFollow = FALSE;
+/*N*/ pNxt->Cut();
+/*N*/ delete pNxt;
+/*N*/ InvalidateSize();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::SplitSect()
+|*
+|* Ersterstellung AMA 29. Apr. 99
+|* Letzte Aenderung AMA 29. Apr. 99
+|*
+|* Zerteilt einen SectionFrm in zwei Teile, der zweite Teil beginnt mit dem
+|* uebergebenen Frame.
+|* Benoetigt wird dies beim Einfuegen eines inneren Bereichs, weil innerhalb
+|* von Rahmen oder Tabellenzellen das MoveFwd nicht den erwuenschten Effekt
+|* haben kann.
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwSectionFrm::MoveCntntAndDelete()
+|*
+|* Ersterstellung AMA 29. Jan 99
+|* Letzte Aenderung AMA 29. Jan 99
+|*
+|* MoveCntnt wird zur Zerstoerung eines SectionFrms wg. Aufhebung oder
+|* Verstecken des Bereichs gerufen, um den Inhalt umzuhaengen.
+|* Wenn der SectionFrm keinen anderen aufbrach, so wird der Inhalt in
+|* den Upper bewegt. Anderfalls wird der Inhalt in den anderen SectionFrm
+|* umgehaengt, dieser muss ggf. gemergt werden.
+|*
+|*************************************************************************/
+// Wenn ein mehrspaltiger Bereich aufgehoben wird, muessen die ContentFrms
+// invalidiert werden
+
+
+/*N*/ #define FIRSTLEAF( pLayFrm ) ( ( pLayFrm->Lower() && pLayFrm->Lower()->IsColumnFrm() )\
+/*N*/ ? pLayFrm->GetNextLayoutLeaf() \
+/*N*/ : pLayFrm )
+
+/*N*/ void SwSectionFrm::MoveCntntAndDelete( SwSectionFrm* pDel, BOOL bSave )
+/*N*/ {
+/*N*/ BOOL bSize = pDel->Lower() && pDel->Lower()->IsColumnFrm();
+/*N*/ SwFrm* pPrv = pDel->GetPrev();
+/*N*/ SwLayoutFrm* pUp = pDel->GetUpper();
+/*N*/ // OD 27.03.2003 #i12711# - initialize local pointer variables.
+/*N*/ SwSectionFrm* pPrvSct = NULL;
+/*N*/ SwSectionFrm* pNxtSct = NULL;
+/*N*/ SwSectionFmt* pParent = static_cast<SwSectionFmt*>(pDel->GetFmt())->GetParent();
+/*N*/ if( pDel->IsInTab() && pParent )
+/*N*/ {
+/*?*/ SwTabFrm *pTab = pDel->FindTabFrm();
+/*?*/ // Wenn wir innerhalb einer Tabelle liegen, koennen wir nur Bereiche
+/*?*/ // aufgebrochen haben, die ebenfalls innerhalb liegen, nicht etwa
+/*?*/ // einen Bereich, der die gesamte Tabelle umfasst.
+/*?*/ if( pTab->IsInSct() && pParent == pTab->FindSctFrm()->GetFmt() )
+/*?*/ pParent = NULL;
+/*N*/ }
+/*N*/ // Wenn unser Format einen Parent besitzt, so haben wir vermutlich
+/*N*/ // einen anderen SectionFrm aufgebrochen, dies muss geprueft werden,
+/*N*/ // dazu besorgen wir uns zunaechst den vorhergehende und den nach-
+/*N*/ // folgenden CntntFrm, mal sehen, ob diese in SectionFrms liegen.
+/*N*/ // OD 27.03.2003 #i12711# - check, if previous and next section belonging
+/*N*/ // together and can be joined, *not* only if deleted section contains content.
+/*N*/ if ( pParent )
+/*N*/ {
+/*N*/ SwFrm* pPrvCntnt = pDel->GetPrevCntntFrm();
+/*N*/ pPrvSct = pPrvCntnt ? pPrvCntnt->FindSctFrm() : NULL;
+/*N*/ SwFrm* pNxtCntnt = pDel->GetNextCntntFrm();
+/*N*/ pNxtSct = pNxtCntnt ? pNxtCntnt->FindSctFrm() : NULL;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pParent = NULL;
+/*N*/ pPrvSct = pNxtSct = NULL;
+/*N*/ }
+/*N*/ // Jetzt wird der Inhalt beseite gestellt und der Frame zerstoert
+/*N*/ SwFrm *pSave = bSave ? ::binfilter::SaveCntnt( pDel ) : NULL;
+/*N*/ BOOL bOldFtn = TRUE;
+/*N*/ if( pSave && pUp->IsFtnFrm() )
+/*N*/ {
+/*N*/ bOldFtn = ((SwFtnFrm*)pUp)->IsColLocked();
+/*N*/ ((SwFtnFrm*)pUp)->ColLock();
+/*N*/ }
+/*N*/ pDel->DelEmpty( TRUE );
+/*N*/ delete pDel;
+/*N*/ if( pParent )
+/*N*/ { // Hier wird die geeignete Einfuegeposition gesucht
+/*N*/ if( pNxtSct && pNxtSct->GetFmt() == pParent )
+/*N*/ { // Hier koennen wir uns am Anfang einfuegen
+/*N*/ pUp = FIRSTLEAF( pNxtSct );
+/*N*/ pPrv = NULL;
+/*N*/ if( pPrvSct && !( pPrvSct->GetFmt() == pParent ) )
+/*N*/ pPrvSct = NULL; // damit nicht gemergt wird
+/*N*/ }
+/*N*/ else if( pPrvSct && pPrvSct->GetFmt() == pParent )
+/*N*/ { // Wunderbar, hier koennen wir uns am Ende einfuegen
+/*N*/ pUp = pPrvSct;
+/*N*/ if( pUp->Lower() && pUp->Lower()->IsColumnFrm() )
+/*N*/ {
+/*N*/ pUp = (SwLayoutFrm*)pUp->Lower(); // Die erste Spalte
+/*N*/ while( pUp->GetNext() )
+/*N*/ pUp = (SwLayoutFrm*)pUp->GetNext();
+/*N*/ pUp = (SwLayoutFrm*)pUp->Lower(); // Der Body der letzten Spalte
+/*N*/ }
+/*N*/ pPrv = pUp->Lower(); // damit hinter dem letzten eingefuegt wird
+/*N*/ if( pPrv )
+/*N*/ while( pPrv->GetNext() )
+/*N*/ pPrv = pPrv->GetNext();
+/*N*/ pPrvSct = NULL; // damit nicht gemergt wird
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pSave )
+/*N*/ { // Folgende Situationen: Vor und hinter dem zu loeschenden Bereich
+/*N*/ // ist entweder die Bereichsgrenze des umfassenden Bereichs oder
+/*N*/ // es schliesst ein anderer (Geschwister-)Bereich direkt an, der
+/*N*/ // vom gleichen Parent abgeleitet ist.
+/*N*/ // Dann gibt es (noch) keinen Teil unseres Parents, der den Inhalt
+/*N*/ // aufnehmen kann,also bauen wir ihn uns.
+/*N*/ pPrvSct = new SwSectionFrm( *pParent->GetSection() );
+/*N*/ pPrvSct->InsertBehind( pUp, pPrv );
+/*N*/ pPrvSct->Init();
+/*N*/ SWRECTFN( pUp )
+/*N*/ (pPrvSct->*fnRect->fnMakePos)( pUp, pPrv, TRUE );
+/*N*/ pUp = FIRSTLEAF( pPrvSct );
+/*N*/ pPrv = NULL;
+/*N*/ }
+/*N*/ pPrvSct = NULL; // damit nicht gemergt wird
+/*N*/ }
+/*N*/ }
+/*N*/ // Der Inhalt wird eingefuegt..
+/*N*/ if( pSave )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ // jetzt koennen eventuell zwei Teile des uebergeordneten Bereich verschmelzen
+/*N*/ if( pPrvSct && !pPrvSct->IsJoinLocked() )
+/*N*/ {
+/*N*/ ASSERT( pNxtSct, "MoveCntnt: No Merge" );
+/*N*/ pPrvSct->MergeNext( pNxtSct );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwSectionFrm::MakeAll()
+/*N*/ {
+/*N*/ if ( IsJoinLocked() || IsColLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
+/*N*/ return;
+/*N*/ if( !pSection ) // Durch DelEmpty
+/*N*/ {
+/*?*/ ASSERT( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ), "SectionFrm without Section" );
+/*?*/ if( !bValidPos )
+/*?*/ {
+/*?*/ if( GetUpper() )
+/*?*/ {
+/*?*/ SWRECTFN( GetUpper() )
+/*?*/ (this->*fnRect->fnMakePos)( GetUpper(), GetPrev(), FALSE );
+/*?*/ }
+/*?*/ }
+/*?*/ bValidSize = bValidPos = bValidPrtArea = TRUE;
+/*?*/ return;
+/*N*/ }
+/*N*/ LockJoin(); //Ich lass mich nicht unterwegs vernichten.
+/*N*/
+/*N*/ while( GetNext() && GetNext() == GetFollow() )
+/*N*/ {
+/*?*/ const SwFrm* pFoll = GetFollow();
+/*?*/ MergeNext( (SwSectionFrm*)GetNext() );
+/*?*/ if( pFoll == GetFollow() )
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ // Ein Bereich mit Follow nimmt allen Platz bis zur Unterkante des Uppers
+/*N*/ // in Anspruch. Bewegt er sich, so kann seine Groesse zu- oder abnehmen...
+/*N*/ if( !bValidPos && ToMaximize( FALSE ) )
+/*N*/ bValidSize = FALSE;
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ const SwFmtCol &rCol = GetFmt()->GetCol();
+/*N*/ #endif
+/*N*/ SwLayoutFrm::MakeAll();
+/*N*/ UnlockJoin();
+/*N*/ if( pSection && IsSuperfluous() )
+/*?*/ DelEmpty( FALSE );
+/*N*/ }
+
+
+
+/*N*/ void lcl_FindCntntFrm( SwCntntFrm* &rpCntntFrm, SwFtnFrm* &rpFtnFrm,
+/*N*/ SwFrm* pFrm, BOOL &rbChkFtn )
+/*N*/ {
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ while( pFrm->GetNext() )
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ while( !rpCntntFrm && pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsCntntFrm() )
+/*N*/ rpCntntFrm = (SwCntntFrm*)pFrm;
+/*N*/ else if( pFrm->IsLayoutFrm() )
+/*N*/ {
+/*?*/ if( pFrm->IsFtnFrm() )
+/*?*/ {
+/*?*/ if( rbChkFtn )
+/*?*/ {
+/*?*/ rpFtnFrm = (SwFtnFrm*)pFrm;
+/*?*/ rbChkFtn = rpFtnFrm->GetAttr()->GetFtn().IsEndNote();
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ lcl_FindCntntFrm( rpCntntFrm, rpFtnFrm,
+/*?*/ ((SwLayoutFrm*)pFrm)->Lower(), rbChkFtn );
+/*N*/ }
+/*N*/ pFrm = pFrm->GetPrev();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwCntntFrm *SwSectionFrm::FindLastCntnt( BYTE nMode )
+/*N*/ {
+/*N*/ SwCntntFrm *pRet = NULL;
+/*N*/ SwFtnFrm *pFtnFrm = NULL;
+/*N*/ SwSectionFrm *pSect = this;
+/*N*/ if( nMode )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 const SwSectionFmt *pFmt = IsEndnAtEnd() ? GetEndSectFmt() :
+/*N*/ }
+/*N*/ BOOL bFtnFound = nMode == FINDMODE_ENDNOTE;
+/*N*/ do
+/*N*/ {
+/*N*/ lcl_FindCntntFrm( pRet, pFtnFrm, pSect->Lower(), bFtnFound );
+/*N*/ if( pRet || !pSect->IsFollow() || !nMode ||
+/*N*/ ( FINDMODE_MYLAST == nMode && this == pSect ) )
+/*N*/ break;
+/*?*/ pSect = pSect->FindSectionMaster();
+/*N*/ } while( pSect );
+/*N*/ if( ( nMode == FINDMODE_ENDNOTE ) && pFtnFrm )
+/*?*/ pRet = pFtnFrm->ContainsCntnt();
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ BOOL SwSectionFrm::CalcMinDiff( SwTwips& rMinDiff ) const
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+/*************************************************************************
+ *
+ * SwSectionFrm::CollectEndnotes( )
+ *
+ * Ersterstellung AMA 03. Nov 99
+ * Letzte Aenderung AMA 03. Nov 99
+ *
+ * CollectEndnotes looks for endnotes in the sectionfrm and his follows,
+ * the endnotes will cut off the layout and put into the array.
+ * If the first endnote is not a master-SwFtnFrm, the whole sectionfrm
+ * contains only endnotes and it is not necessary to collect them.
+ *
+ *************************************************************************/
+
+
+/*N*/ void lcl_ColumnRefresh( SwSectionFrm* pSect, BOOL bFollow )
+/*N*/ {
+/*N*/ while( pSect )
+/*N*/ {
+/*N*/ BOOL bOldLock = pSect->IsColLocked();
+/*N*/ pSect->ColLock();
+/*N*/ if( pSect->Lower() && pSect->Lower()->IsColumnFrm() )
+/*N*/ {
+/*?*/ SwColumnFrm *pCol = (SwColumnFrm*)pSect->Lower();
+/*?*/ do
+/*?*/ { pCol->_InvalidateSize();
+/*?*/ pCol->_InvalidatePos();
+/*?*/ ((SwLayoutFrm*)pCol)->Lower()->_InvalidateSize();
+/*?*/ pCol->Calc(); // calculation of column and
+/*?*/ ((SwLayoutFrm*)pCol)->Lower()->Calc(); // body
+/*?*/ pCol = (SwColumnFrm*)pCol->GetNext();
+/*?*/ } while ( pCol );
+/*N*/ }
+/*N*/ if( !bOldLock )
+/*N*/ pSect->ColUnlock();
+/*N*/ if( bFollow )
+/*?*/ pSect = pSect->GetFollow();
+/*N*/ else
+/*N*/ pSect = NULL;
+/*N*/ }
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwSectionFrm::_CheckClipping( BOOL bGrow, BOOL bMaximize )
+|*
+|* Beschreibung: Passt die Groesse an die Umgebung an.
+|* Wer einen Follow oder Fussnoten besitzt, soll bis zur Unterkante
+|* des Uppers gehen (bMaximize).
+|* Niemand darf ueber den Upper hinausgehen, ggf. darf man versuchen (bGrow)
+|* seinen Upper zu growen.
+|* Wenn die Groesse veraendert werden musste, wird der Inhalt kalkuliert.
+|*
+|*************************************************************************/
+
+/// OD 18.09.2002 #100522#
+/// perform calculation of content, only if height has changed.
+/*N*/ void SwSectionFrm::_CheckClipping( BOOL bGrow, BOOL bMaximize )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ long nDiff;
+/*N*/ SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*N*/ if( bGrow && ( !IsInFly() || !GetUpper()->IsColBodyFrm() ||
+/*N*/ !FindFlyFrm()->IsLocked() ) )
+/*N*/ {
+/*N*/ nDiff = -(Frm().*fnRect->fnBottomDist)( nDeadLine );
+/*N*/ if( !bMaximize )
+/*N*/ nDiff += Undersize();
+/*N*/ if( nDiff > 0 )
+/*N*/ {
+/*N*/ long nAdd = GetUpper()->Grow( nDiff );
+/*N*/ if( bVert && !bRev )
+/*?*/ nDeadLine -= nAdd;
+/*N*/ else
+/*N*/ nDeadLine += nAdd;
+/*N*/ }
+/*N*/ }
+/*N*/ nDiff = -(Frm().*fnRect->fnBottomDist)( nDeadLine );
+/*N*/ SetUndersized( !bMaximize && nDiff >= 0 );
+/*N*/ BOOL bCalc = ( IsUndersized() || bMaximize ) && ( nDiff ||
+/*N*/ (Prt().*fnRect->fnGetTop)() > (Frm().*fnRect->fnGetHeight)() );
+/*N*/ if( !bCalc && !bGrow && IsAnyNoteAtEnd() && !IsInFtn() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwSectionFrm *pSect = this;
+/*N*/ }
+/*N*/ if( bCalc )
+/*N*/ {
+/*N*/ nDiff = (*fnRect->fnYDiff)( nDeadLine, (Frm().*fnRect->fnGetTop)() );
+/*N*/ if( nDiff < 0 )
+/*N*/ {
+/*?*/ nDiff = 0;
+/*?*/ nDeadLine = (Frm().*fnRect->fnGetTop)();
+/*N*/ }
+/*N*/ const Size aOldSz( Prt().SSize() );
+/*N*/ long nTop = (this->*fnRect->fnGetTopMargin)();
+/*N*/ (Frm().*fnRect->fnSetBottom)( nDeadLine );
+/*N*/ nDiff = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nTop > nDiff )
+/*N*/ nTop = nDiff;
+/*N*/ (this->*fnRect->fnSetYMargins)( nTop, 0 );
+
+ /// OD 18.09.2002 #100522#
+ /// Determine, if height has changed.
+ /// Note: In vertical layout the height equals the width value.
+/*N*/ bool bHeightChanged = bVert ?
+/*N*/ (aOldSz.Width() != Prt().Width()) :
+/*N*/ (aOldSz.Height() != Prt().Height());
+/*N*/ // Wir haben zu guter Letzt noch einmal die Hoehe geaendert,
+/*N*/ // dann wird das innere Layout (Columns) kalkuliert und
+/*N*/ // der Inhalt ebenfalls.
+ /// OD 18.09.2002 #100522#
+ /// calculate content, only if height has changed.
+/*N*/ if( bHeightChanged && Lower() )
+/*N*/ {
+/*N*/ if( Lower()->IsColumnFrm() )
+/*N*/ {
+/*?*/ lcl_ColumnRefresh( this, FALSE );
+/*?*/ ::binfilter::CalcCntnt( this );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ChgLowersProp( aOldSz );
+/*N*/ if( !bMaximize && !IsCntntLocked() )
+/*N*/ ::binfilter::CalcCntnt( this );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwSectionFrm::SimpleFormat()
+/*N*/ {
+/*N*/ if ( IsJoinLocked() || IsColLocked() )
+/*N*/ return;
+/*N*/ // ASSERT( pFollow, "SimpleFormat: Follow required" );
+/*N*/ LockJoin();
+/*N*/ SWRECTFN( this )
+/*N*/ if( GetPrev() || GetUpper() )
+/*N*/ {
+/*N*/ (this->*fnRect->fnMakePos)( GetUpper(), GetPrev(), FALSE );
+/*N*/ bValidPos = TRUE;
+/*N*/ }
+/*N*/ SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
+ // OD 22.10.2002 #97265# - call always method <lcl_ColumnRefresh(..)>, in
+ // order to get calculated lowers, not only if there space left in its upper.
+/*N*/ if( (Frm().*fnRect->fnBottomDist)( nDeadLine ) > 0 )
+/*N*/ {
+/*N*/ const Size aOldSz( Prt().SSize() );
+/*N*/ (Frm().*fnRect->fnSetBottom)( nDeadLine );
+/*N*/ long nHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ long nTop = CalcUpperSpace();
+/*N*/ if( nTop > nHeight )
+/*?*/ nTop = nHeight;
+/*N*/ (this->*fnRect->fnSetYMargins)( nTop, 0 );
+/*N*/ }
+/*N*/ lcl_ColumnRefresh( this, FALSE );
+/*N*/ UnlockJoin();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::Format()
+|*
+|* Beschreibung: "Formatiert" den Frame; Frm und PrtArea.
+|* Ersterstellung AMA 03. Dec. 97
+|* Letzte Aenderung MA 09. Oct. 98
+|*
+|*************************************************************************/
+
+/*N*/ void SwSectionFrm::Format( const SwBorderAttrs *pAttr )
+/*N*/ {
+/*N*/ if( !pSection ) // Durch DelEmpty
+/*N*/ {
+/*N*/ ASSERT( GetFmt()->GetDoc()->GetRootFrm()->IsInDelList( this ),
+/*N*/ "SectionFrm without Section" );
+/*N*/ bValidSize = bValidPos = bValidPrtArea = TRUE;
+/*N*/ return;
+/*N*/ }
+/*N*/ SWRECTFN( this )
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ PROTOCOL( this, PROT_PRTAREA, 0, 0 )
+/*N*/ bValidPrtArea = TRUE;
+/*N*/ SwTwips nUpper = CalcUpperSpace();
+/*N*/
+/*N*/ // #109700# LRSpace for sections
+/*N*/ const SvxLRSpaceItem& rLRSpace = GetFmt()->GetLRSpace();
+/*N*/ (this->*fnRect->fnSetXMargins)( rLRSpace.GetLeft(), rLRSpace.GetRight() );
+/*N*/
+/*N*/ if( nUpper != (this->*fnRect->fnGetTopMargin)() )
+/*N*/ {
+/*N*/ bValidSize = FALSE;
+/*N*/ SwFrm* pOwn = ContainsAny();
+/*N*/ if( pOwn )
+/*N*/ pOwn->_InvalidatePos();
+/*N*/ }
+/*N*/ (this->*fnRect->fnSetYMargins)( nUpper, 0 );
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( this, PROT_SIZE, 0, 0 )
+/*N*/ const long nOldHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ BOOL bOldLock = IsColLocked();
+/*N*/ ColLock();
+/*N*/
+/*N*/ bValidSize = TRUE;
+/*N*/
+/*N*/ //die Groesse wird nur dann vom Inhalt bestimmt, wenn der SectFrm
+/*N*/ //keinen Follow hat. Anderfalls fuellt er immer den Upper bis
+/*N*/ //zur Unterkante aus. Fuer den Textfluss ist nicht er, sondern sein
+/*N*/ //Inhalt selbst verantwortlich.
+/*N*/ BOOL bMaximize = ToMaximize( FALSE );
+/*N*/
+/*N*/ // Column widths have to be adjusted before calling _CheckClipping.
+/*N*/ // _CheckClipping can cause the formatting of the lower frames
+/*N*/ // which still have a width of 0.
+/*N*/ const sal_Bool bHasColumns = Lower() && Lower()->IsColumnFrm();
+/*N*/ if ( bHasColumns && Lower()->GetNext() )
+/*N*/ AdjustColumns( 0, FALSE );
+/*N*/
+/*N*/ if( GetUpper() )
+/*N*/ {
+/*N*/ long nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
+/*N*/ (aFrm.*fnRect->fnSetWidth)( nWidth );
+/*N*/
+/*N*/ // #109700# LRSpace for sections
+/*N*/ const SvxLRSpaceItem& rLRSpace = GetFmt()->GetLRSpace();
+/*N*/ (aPrt.*fnRect->fnSetWidth)( nWidth - rLRSpace.GetLeft() -
+/*N*/ rLRSpace.GetRight() );
+/*N*/
+/*N*/ /// OD 15.10.2002 #103517# - allow grow in online layout
+/*N*/ /// Thus, set <..IsBrowseMode()> as parameter <bGrow> on calling
+/*N*/ /// method <_CheckClipping(..)>.
+/*N*/ _CheckClipping( GetFmt()->GetDoc()->IsBrowseMode(), bMaximize );
+/*N*/ bMaximize = ToMaximize( FALSE );
+/*N*/ bValidSize = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ //Breite der Spalten pruefen und ggf. einstellen.
+/*N*/ if ( bHasColumns && ! Lower()->GetNext() && bMaximize )
+/*N*/ ((SwColumnFrm*)Lower())->Lower()->Calc();
+/*N*/
+/*N*/ if ( !bMaximize )
+/*N*/ {
+/*N*/ SwTwips nRemaining = (this->*fnRect->fnGetTopMargin)(), nDiff;
+/*N*/ SwFrm *pFrm = pLower;
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsColumnFrm() && pFrm->GetNext() )
+/*N*/ {
+/*N*/ FormatWidthCols( *pAttr, nRemaining, MINLAY );
+/*N*/ while( HasFollow() && !GetFollow()->ContainsCntnt() )
+/*N*/ {
+/*N*/ SwFrm* pOld = GetFollow();
+/*N*/ GetFollow()->DelEmpty( FALSE );
+/*N*/ if( pOld == GetFollow() )
+/*N*/ break;
+/*N*/ }
+/*N*/ bMaximize = ToMaximize( FALSE );
+/*N*/ nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pFrm->IsColumnFrm() )
+/*N*/ {
+/*N*/ pFrm->Calc();
+/*N*/ pFrm = ((SwColumnFrm*)pFrm)->Lower();
+/*N*/ pFrm->Calc();
+/*N*/ pFrm = ((SwLayoutFrm*)pFrm)->Lower();
+/*N*/ CalcFtnCntnt();
+/*N*/ }
+/*N*/ // Wenn wir in einem spaltigen Rahmen stehen und dieser
+/*N*/ // gerade im FormatWidthCols ein CalcCntnt ruft, muss
+/*N*/ // unser Inhalt ggf. kalkuliert werden.
+/*N*/ if( pFrm && !pFrm->IsValid() && IsInFly() &&
+/*N*/ FindFlyFrm()->IsColLocked() )
+/*N*/ ::binfilter::CalcCntnt( this );
+/*N*/ nRemaining += InnerHeight();
+/*N*/ bMaximize = HasFollow();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ nDiff = (Frm().*fnRect->fnGetHeight)() - nRemaining;
+/*N*/ if( nDiff < 0)
+/*N*/ {
+/*N*/ SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*N*/ {
+/*N*/ long nBottom = (Frm().*fnRect->fnGetBottom)();
+/*N*/ nBottom = (*fnRect->fnYInc)( nBottom, -nDiff );
+/*N*/ long nTmpDiff = (*fnRect->fnYDiff)( nBottom, nDeadLine );
+/*N*/ if( nTmpDiff > 0 )
+/*N*/ {
+/*N*/ nTmpDiff = GetUpper()->Grow( nTmpDiff, TRUE );
+/*N*/ nDeadLine = (*fnRect->fnYInc)( nDeadLine, nTmpDiff );
+/*N*/ nTmpDiff = (*fnRect->fnYDiff)( nBottom, nDeadLine );
+/*N*/ if( nTmpDiff > 0 )
+/*N*/ nDiff += nTmpDiff;
+/*N*/ if( nDiff > 0 )
+/*N*/ nDiff = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( nDiff )
+/*N*/ {
+/*N*/ long nTmp = nRemaining - (Frm().*fnRect->fnGetHeight)();
+/*N*/ long nTop = (this->*fnRect->fnGetTopMargin)();
+/*N*/ (Frm().*fnRect->fnAddBottom)( nTmp );
+/*N*/ (this->*fnRect->fnSetYMargins)( nTop, 0 );
+/*N*/ InvalidateNextPos();
+/*N*/ if( pLower && ( !pLower->IsColumnFrm() || !pLower->GetNext() ) )
+/*N*/ {
+/*N*/ // Wenn ein einspaltiger Bereich gerade den Platz geschaffen
+/*N*/ // hat, den sich die "undersized" Absaetze gewuenscht haben,
+/*N*/ // muessen diese invalidiert und kalkuliert werden, damit
+/*N*/ // sie diesen ausfuellen.
+/*N*/ pFrm = pLower;
+/*N*/ if( pFrm->IsColumnFrm() )
+/*N*/ {
+/*N*/ pFrm->_InvalidateSize();
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ pFrm->Calc();
+/*N*/ pFrm = ((SwColumnFrm*)pFrm)->Lower();
+/*N*/ pFrm->Calc();
+/*N*/ pFrm = ((SwLayoutFrm*)pFrm)->Lower();
+/*N*/ CalcFtnCntnt();
+/*N*/ }
+/*N*/ BOOL bUnderSz = FALSE;
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
+/*N*/ {
+/*N*/ pFrm->Prepare( PREP_ADJUST_FRM );
+/*N*/ bUnderSz = TRUE;
+/*N*/ }
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ if( bUnderSz && !IsCntntLocked() )
+/*N*/ ::binfilter::CalcCntnt( this );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Unterkante des Uppers nicht ueberschreiten. Fuer Sections mit
+/*N*/ //Follows die Unterkante auch nicht unterschreiten.
+/*N*/ if ( GetUpper() )
+/*N*/ _CheckClipping( TRUE, bMaximize );
+/*N*/ if( !bOldLock )
+/*N*/ ColUnlock();
+/*N*/ long nDiff = nOldHeight - (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nDiff > 0 )
+/*N*/ {
+/*N*/ if( !GetNext() )
+/*N*/ SetRetouche(); // Dann muessen wir die Retusche selbst uebernehmen
+/*N*/ if( GetUpper() && !GetUpper()->IsFooterFrm() )
+/*N*/ GetUpper()->Shrink( nDiff PHEIGHT );
+/*N*/ }
+/*N*/ if( IsUndersized() )
+/*N*/ bValidPrtArea = TRUE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetNextSctLeaf()
+|*
+|* Beschreibung Liefert das naechste Layoutblatt in das der Frame
+|* gemoved werden kann.
+|* Neue Seiten werden nur dann erzeugt, wenn der Parameter TRUE ist.
+|* Ersterstellung AMA 07. Jan. 98
+|* Letzte Aenderung AMA 07. Jan. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ SwLayoutFrm *SwFrm::GetNextSctLeaf( MakePageType eMakePage )
+/*N*/ {
+/*N*/ //Achtung: Geschachtelte Bereiche werden zur Zeit nicht unterstuetzt.
+/*N*/
+/*N*/ PROTOCOL_ENTER( this, PROT_LEAF, ACT_NEXT_SECT, GetUpper()->FindSctFrm() )
+/*N*/
+/*N*/ // Abkuerzungen fuer spaltige Bereiche, wenn wir noch nicht in der letzten Spalte sind.
+/*N*/ // Koennen wir in die naechste Spalte des Bereichs rutschen?
+/*N*/ if( IsColBodyFrm() && GetUpper()->GetNext() )
+/*?*/ return (SwLayoutFrm*)((SwLayoutFrm*)GetUpper()->GetNext())->Lower();
+/*N*/ if( GetUpper()->IsColBodyFrm() && GetUpper()->GetUpper()->GetNext() )
+/*?*/ return (SwLayoutFrm*)((SwLayoutFrm*)GetUpper()->GetUpper()->GetNext())->Lower();
+/*N*/ // Innerhalb von Bereichen in Tabellen oder Bereichen in Kopf/Fusszeilen kann
+/*N*/ // nur ein Spaltenwechsel erfolgen, eine der oberen Abkuerzungen haette zuschlagen muessen
+/*N*/ if( ( IsInTab() && !IsTabFrm() ) || FindFooterOrHeader() )
+/*?*/ return 0;
+/*N*/
+/*N*/ //MA 03. Feb. 99: Warum GetUpper()? Das knallt mit Buch.sgl weil im
+/*N*/ //FlyAtCnt::MakeFlyPos ein Orient der SectionFrm ist und auf diesen ein
+/*N*/ //GetLeaf gerufen wird.
+/*N*/ // SwSectionFrm *pSect = GetUpper()->FindSctFrm();
+/*N*/ SwSectionFrm *pSect = FindSctFrm();
+/*N*/ BOOL bWrongPage = FALSE;
+/*N*/ ASSERT( pSect, "GetNextSctLeaf: Missing SectionFrm" );
+/*N*/
+/*N*/ // Hier eine Abkuerzung fuer Bereiche mit Follows,
+/*N*/ // dieser kann akzeptiert werden, wenn keine Spalten oder Seiten (ausser Dummyseiten)
+/*N*/ // dazwischen liegen.
+/*N*/ // Bei verketteten Rahmen und ind Fussnoten wuerde die Abkuerzung noch aufwendiger
+/*N*/ if( pSect->HasFollow() && pSect->IsInDocBody() )
+/*N*/ {
+/*N*/ if( pSect->GetFollow() == pSect->GetNext() )
+/*N*/ {
+/*?*/ SwPageFrm *pPg = pSect->GetFollow()->FindPageFrm();
+/*?*/ if( WrongPageDesc( pPg ) )
+/*?*/ bWrongPage = TRUE;
+/*?*/ else
+/*?*/ return FIRSTLEAF( pSect->GetFollow() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwFrm* pTmp;
+/*N*/ if( !pSect->GetUpper()->IsColBodyFrm() ||
+/*N*/ 0 == ( pTmp = pSect->GetUpper()->GetUpper()->GetNext() ) )
+/*N*/ pTmp = pSect->FindPageFrm()->GetNext();
+/*N*/ if( pTmp ) // ist jetzt die naechste Spalte oder Seite
+/*N*/ {
+/*N*/ SwFrm* pTmpX = pTmp;
+/*N*/ if( pTmp->IsPageFrm() && ((SwPageFrm*)pTmp)->IsEmptyPage() )
+/*?*/ pTmp = pTmp->GetNext(); // Dummyseiten ueberspringen
+/*N*/ SwFrm *pUp = pSect->GetFollow()->GetUpper();
+/*N*/ // pUp wird die Spalte, wenn der Follow in einer "nicht ersten" Spalte
+/*N*/ // liegt, ansonsten die Seite:
+/*N*/ if( !pUp->IsColBodyFrm() ||
+/*N*/ !( pUp = pUp->GetUpper() )->GetPrev() )
+/*N*/ pUp = pUp->FindPageFrm();
+/*N*/ // Jetzt muessen pUp und pTmp die gleiche Seite/Spalte sein,
+/*N*/ // sonst liegen Seiten oder Spalten zwischen Master und Follow.
+/*N*/ if( pUp == pTmp || pUp->GetNext() == pTmpX )
+/*N*/ {
+/*N*/ SwPageFrm* pNxtPg = pUp->IsPageFrm() ?
+/*N*/ (SwPageFrm*)pUp : pUp->FindPageFrm();
+/*N*/ if( WrongPageDesc( pNxtPg ) )
+/*?*/ bWrongPage = TRUE;
+/*N*/ else
+/*N*/ return FIRSTLEAF( pSect->GetFollow() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Immer im gleichen Bereich landen: Body wieder in Body etc.
+/*N*/ const BOOL bBody = IsInDocBody();
+/*N*/ const BOOL bFtnPage = FindPageFrm()->IsFtnPage();
+/*N*/
+/*N*/ SwLayoutFrm *pLayLeaf;
+/*N*/ // Eine Abkuerzung fuer TabFrms, damit nicht alle Zellen abgehuehnert werden
+/*N*/ if( bWrongPage )
+/*?*/ pLayLeaf = 0;
+/*N*/ else if( IsTabFrm() )
+/*?*/ pLayLeaf = ((SwTabFrm*)this)->FindLastCntnt()->GetUpper();
+/*N*/ else
+/*N*/ {
+/*N*/ pLayLeaf = GetNextLayoutLeaf();
+/*N*/ if( IsColumnFrm() )
+/*N*/ {
+/*?*/ while( pLayLeaf && ((SwColumnFrm*)this)->IsAnLower( pLayLeaf ) )
+/*?*/ pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwLayoutFrm *pOldLayLeaf = 0; //Damit bei neu erzeugten Seiten
+/*N*/ //nicht wieder vom Anfang gesucht
+/*N*/ //wird.
+/*N*/
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ if( pLayLeaf )
+/*N*/ {
+/*N*/ // Ein Layoutblatt wurde gefunden, mal sehen, ob er mich aufnehmen kann,
+/*N*/ // ob hier ein weiterer SectionFrm eingefuegt werden kann
+/*N*/ // oder ob wir weitersuchen muessen.
+/*N*/ SwPageFrm* pNxtPg = pLayLeaf->FindPageFrm();
+/*N*/ if ( !bFtnPage && pNxtPg->IsFtnPage() )
+/*N*/ { //Wenn ich bei den Endnotenseiten angelangt bin hat sichs.
+/*?*/ pLayLeaf = 0;
+/*?*/ continue;
+/*N*/ }
+/*N*/ // Einmal InBody, immer InBody, nicht in Tabellen hinein
+/*N*/ // und nicht in fremde Bereiche hinein
+/*N*/ if ( (bBody && !pLayLeaf->IsInDocBody()) ||
+/*N*/ (IsInFtn() != pLayLeaf->IsInFtn() ) ||
+/*N*/ pLayLeaf->IsInTab() ||
+/*N*/ ( pLayLeaf->IsInSct() && ( !pSect->HasFollow()
+/*N*/ || pSect->GetFollow() != pLayLeaf->FindSctFrm() ) ) )
+/*N*/ {
+/*N*/ //Er will mich nicht; neuer Versuch, neues Glueck
+/*N*/ pOldLayLeaf = pLayLeaf;
+/*N*/ pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
+/*N*/ continue;
+/*N*/ }
+/*N*/ if( WrongPageDesc( pNxtPg ) )
+/*N*/ {
+/*N*/ if( bWrongPage )
+/*N*/ break; // there's a column between me and my right page
+/*N*/ pLayLeaf = 0;
+/*N*/ bWrongPage = TRUE;
+/*N*/ pOldLayLeaf = 0;
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ //Es gibt keinen passenden weiteren LayoutFrm, also muss eine
+/*N*/ //neue Seite her, allerdings nuetzen uns innerhalb eines Rahmens
+/*N*/ //neue Seiten nichts.
+/*N*/ else if( !pSect->IsInFly() &&
+/*N*/ ( eMakePage == MAKEPAGE_APPEND || eMakePage == MAKEPAGE_INSERT ) )
+/*N*/ {
+/*N*/ InsertPage(pOldLayLeaf ? pOldLayLeaf->FindPageFrm() : FindPageFrm(),
+/*N*/ FALSE );
+/*N*/ //und nochmal das ganze
+/*N*/ pLayLeaf = pOldLayLeaf ? pOldLayLeaf : GetNextLayoutLeaf();
+/*N*/ continue;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pLayLeaf )
+/*N*/ {
+/*N*/ // Das passende Layoutblatt haben wir gefunden, wenn es dort bereits einen
+/*N*/ // Follow unseres Bereichs gibt, nehmen wir dessen erstes Layoutblatt,
+/*N*/ // andernfalls wird es Zeit, einen Bereichsfollow zu erzeugen
+/*N*/ SwSectionFrm* pNew;
+/*N*/
+/*N*/ //Dies kann entfallen, wenn bei existierenden Follows bereits abgekuerzt wurde
+/*N*/ SwFrm* pFirst = pLayLeaf->Lower();
+/*N*/ // Auch hier muessen zum Loeschen angemeldete SectionFrms ignoriert werden
+/*N*/ while( pFirst && pFirst->IsSctFrm() && !((SwSectionFrm*)pFirst)->GetSection() )
+/*?*/ pFirst = pFirst->GetNext();
+/*N*/ if( pFirst && pFirst->IsSctFrm() && pSect->GetFollow() == pFirst )
+/*?*/ pNew = pSect->GetFollow();
+/*N*/ else if( MAKEPAGE_NOSECTION == eMakePage )
+/*?*/ return pLayLeaf;
+/*N*/ else
+/*N*/ {
+/*N*/ pNew = new SwSectionFrm( *pSect, FALSE );
+/*N*/ pNew->InsertBefore( pLayLeaf, pLayLeaf->Lower() );
+/*N*/ pNew->Init();
+/*N*/ SWRECTFN( pNew )
+/*N*/ (pNew->*fnRect->fnMakePos)( pLayLeaf, NULL, TRUE );
+/*N*/
+/*N*/ // Wenn unser Bereichsframe einen Nachfolger hat, so muss dieser
+/*N*/ // umgehaengt werden hinter den neuen Follow der Bereichsframes.
+/*N*/ SwFrm* pTmp = pSect->GetNext();
+/*N*/ if( pTmp && pTmp != pSect->GetFollow() )
+/*N*/ {
+/*N*/ SwFlowFrm* pNxt;
+/*N*/ SwCntntFrm* pNxtCntnt = NULL;
+/*N*/ if( pTmp->IsCntntFrm() )
+/*N*/ {
+/*N*/ pNxt = (SwCntntFrm*)pTmp;
+/*N*/ pNxtCntnt = (SwCntntFrm*)pTmp;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pNxtCntnt = ((SwLayoutFrm*)pTmp)->ContainsCntnt();
+/*N*/ if( pTmp->IsSctFrm() )
+/*N*/ pNxt = (SwSectionFrm*)pTmp;
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( pTmp->IsTabFrm(), "GetNextSctLeaf: Wrong Type" );
+/*?*/ pNxt = (SwTabFrm*)pTmp;
+/*N*/ }
+/*N*/ while( !pNxtCntnt && 0 != ( pTmp = pTmp->GetNext() ) )
+/*N*/ {
+/*?*/ if( pTmp->IsCntntFrm() )
+/*?*/ pNxtCntnt = (SwCntntFrm*)pTmp;
+/*?*/ else
+/*?*/ pNxtCntnt = ((SwLayoutFrm*)pTmp)->ContainsCntnt();
+/*N*/ }
+/*N*/ }
+/*N*/ if( pNxtCntnt )
+/*N*/ {
+/*N*/ SwFtnBossFrm* pOldBoss = pSect->FindFtnBossFrm( TRUE );
+/*N*/ if( pOldBoss == pNxtCntnt->FindFtnBossFrm( TRUE ) )
+/*N*/ {
+/*N*/ SwSaveFtnHeight aHeight( pOldBoss,
+/*N*/ pOldBoss->Frm().Top() + pOldBoss->Frm().Height() );
+/*N*/ pSect->GetUpper()->MoveLowerFtns( pNxtCntnt, pOldBoss,
+/*N*/ pLayLeaf->FindFtnBossFrm( TRUE ), FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ ((SwFlowFrm*)pNxt)->MoveSubTree( pLayLeaf, pNew->GetNext() );
+/*N*/ }
+/*N*/ if( pNew->GetFollow() )
+/*N*/ pNew->SimpleFormat();
+/*N*/ }
+/*N*/ // Das gesuchte Layoutblatt ist jetzt das erste des ermittelten SctFrms:
+/*N*/ pLayLeaf = FIRSTLEAF( pNew );
+/*N*/ }
+/*N*/ return pLayLeaf;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetPrevSctLeaf()
+|*
+|* Beschreibung Liefert das vorhergehende LayoutBlatt in das der
+|* Frame gemoved werden kann.
+|* Ersterstellung AMA 07. Jan. 98
+|* Letzte Aenderung AMA 07. Jan. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ SwLayoutFrm *SwFrm::GetPrevSctLeaf( MakePageType eMakeFtn )
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( this, PROT_LEAF, ACT_PREV_SECT, GetUpper()->FindSctFrm() )
+/*N*/
+/*N*/ SwLayoutFrm* pCol;
+/*N*/ // ColumnFrm beinhalten jetzt stets einen BodyFrm
+/*N*/ if( IsColBodyFrm() )
+/*?*/ pCol = GetUpper();
+/*N*/ else if( GetUpper()->IsColBodyFrm() )
+/*?*/ pCol = GetUpper()->GetUpper();
+/*N*/ else
+/*N*/ pCol = NULL;
+/*N*/ BOOL bJump = FALSE;
+/*N*/ if( pCol )
+/*N*/ {
+/*?*/ if( pCol->GetPrev() )
+/*?*/ {
+/*?*/ do
+/*?*/ {
+/*?*/ pCol = (SwLayoutFrm*)pCol->GetPrev();
+/*?*/ // Gibt es dort Inhalt?
+/*?*/ if( ((SwLayoutFrm*)pCol->Lower())->Lower() )
+/*?*/ {
+/*?*/ if( bJump ) // Haben wir eine leere Spalte uebersprungen?
+/*?*/ SwFlowFrm::SetMoveBwdJump( TRUE );
+/*?*/ return (SwLayoutFrm*)pCol->Lower(); // Der Spaltenbody
+/*?*/ }
+/*?*/ bJump = TRUE;
+/*?*/ } while( pCol->GetPrev() );
+/*?*/
+/*?*/ // Hier landen wir, wenn alle Spalten leer sind,
+/*?*/ // pCol ist jetzt die erste Spalte, wir brauchen aber den Body:
+/*?*/ pCol = (SwLayoutFrm*)pCol->Lower();
+/*?*/ }
+/*?*/ else
+/*?*/ pCol = NULL;
+/*N*/ }
+/*N*/
+/*N*/ if( bJump ) // Haben wir eine leere Spalte uebersprungen?
+/*?*/ SwFlowFrm::SetMoveBwdJump( TRUE );
+/*N*/
+/*N*/ // Innerhalb von Bereichen in Tabellen oder Bereichen in Kopf/Fusszeilen kann
+/*N*/ // nur ein Spaltenwechsel erfolgen, eine der oberen Abkuerzungen haette
+/*N*/ // zuschlagen muessen, ebenso wenn der Bereich einen pPrev hat.
+/*N*/ // Jetzt ziehen wir sogar eine leere Spalte in Betracht...
+/*N*/ ASSERT( FindSctFrm(), "GetNextSctLeaf: Missing SectionFrm" );
+/*N*/ if( ( IsInTab() && !IsTabFrm() ) || FindFooterOrHeader() )
+/*?*/ return pCol;
+/*N*/
+/*N*/ SwSectionFrm *pSect = FindSctFrm();
+/*N*/ SwFrm *pPrv;
+/*N*/ if( 0 != ( pPrv = pSect->GetIndPrev() ) )
+/*N*/ {
+/*N*/ // Herumlungernde, halbtote SectionFrms sollen uns nicht beirren
+/*N*/ while( pPrv && pPrv->IsSctFrm() && !((SwSectionFrm*)pPrv)->GetSection() )
+/*N*/ pPrv = pPrv->GetPrev();
+/*N*/ if( pPrv )
+/*?*/ return pCol;
+/*N*/ }
+/*N*/
+/*N*/ const BOOL bBody = IsInDocBody();
+/*N*/ const BOOL bFly = IsInFly();
+/*N*/
+/*N*/ SwLayoutFrm *pLayLeaf = GetPrevLayoutLeaf();
+/*N*/ SwLayoutFrm *pPrevLeaf = 0;
+/*N*/
+/*N*/ while ( pLayLeaf )
+/*N*/ { //In Tabellen oder Bereiche geht's niemals hinein.
+/*N*/ if ( pLayLeaf->IsInTab() || pLayLeaf->IsInSct() )
+/*N*/ pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
+/*N*/ else if ( bBody && pLayLeaf->IsInDocBody() )
+/*N*/ {
+ // If there is a pLayLeaf has a lower pLayLeaf is the frame we are looking for.
+ // Exception: pLayLeaf->Lower() is a zombie section frame
+/*N*/ const SwFrm* pTmp = pLayLeaf->Lower();
+/*N*/ // OD 11.04.2003 #108824# - consider, that the zombie section frame
+/*N*/ // can have frame below it in the found layout leaf.
+/*N*/ // Thus, skipping zombie section frame, if possible.
+/*N*/ while ( pTmp && pTmp->IsSctFrm() &&
+/*N*/ !( static_cast<const SwSectionFrm*>(pTmp)->GetSection() ) &&
+/*N*/ pTmp->GetNext()
+/*N*/ )
+/*N*/ {
+/*N*/ pTmp = pTmp->GetNext();
+/*N*/ }
+/*N*/ if ( pTmp &&
+/*N*/ ( !pTmp->IsSctFrm() ||
+/*N*/ ( static_cast<const SwSectionFrm*>(pTmp)->GetSection() )
+/*N*/ )
+/*N*/ )
+/*N*/ {
+/*N*/ break;
+/*N*/ }
+/*N*/ pPrevLeaf = pLayLeaf;
+/*N*/ pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
+/*N*/ if ( pLayLeaf )
+/*N*/ SwFlowFrm::SetMoveBwdJump( TRUE );
+/*N*/ }
+/*N*/ else if ( bFly )
+/*?*/ break; //Cntnts in Flys sollte jedes Layout-Blatt recht sein. Warum?
+/*N*/ else
+/*N*/ pLayLeaf = pLayLeaf->GetPrevLayoutLeaf();
+/*N*/ }
+/*N*/ if( !pLayLeaf )
+/*N*/ {
+/*N*/ if( !pPrevLeaf )
+/*N*/ return pCol;
+/*?*/ pLayLeaf = pPrevLeaf;
+/*N*/ }
+/*N*/
+/*N*/ SwSectionFrm* pNew = NULL;
+/*N*/ // Zunaechst einmal an das Ende des Layoutblatts gehen
+/*N*/ SwFrm *pTmp = pLayLeaf->Lower();
+/*N*/ if( pTmp )
+/*N*/ {
+/*N*/ while( pTmp->GetNext() )
+/*N*/ pTmp = pTmp->GetNext();
+/*N*/ if( pTmp->IsSctFrm() )
+/*N*/ {
+/*N*/ // Halbtote stoeren hier nur...
+/*N*/ while( !((SwSectionFrm*)pTmp)->GetSection() && pTmp->GetPrev() &&
+/*N*/ pTmp->GetPrev()->IsSctFrm() )
+/*?*/ pTmp = pTmp->GetPrev();
+/*N*/ if( ((SwSectionFrm*)pTmp)->GetFollow() == pSect )
+/*N*/ pNew = (SwSectionFrm*)pTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ if( !pNew )
+/*N*/ {
+/*N*/ pNew = new SwSectionFrm( *pSect, TRUE );
+/*N*/ pNew->InsertBefore( pLayLeaf, NULL );
+/*N*/ pNew->Init();
+/*N*/ SWRECTFN( pNew )
+/*N*/ (pNew->*fnRect->fnMakePos)( pLayLeaf, pNew->GetPrev(), TRUE );
+/*N*/
+/*N*/ pLayLeaf = FIRSTLEAF( pNew );
+/*N*/ if( !pNew->Lower() ) // einspaltige Bereiche formatieren
+/*N*/ {
+/*N*/ pNew->MakePos();
+/*N*/ pLayLeaf->Format(); // damit die PrtArea fuers MoveBwd stimmt
+/*N*/ }
+/*N*/ else
+/*?*/ pNew->SimpleFormat();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pLayLeaf = FIRSTLEAF( pNew );
+/*N*/ if( pLayLeaf->IsColBodyFrm() )
+/*N*/ {
+/*?*/ // In existent section columns we're looking for the last not empty
+/*?*/ // column.
+/*?*/ SwLayoutFrm *pTmp = pLayLeaf;
+/*?*/ while( pLayLeaf->GetUpper()->GetNext() )
+/*?*/ {
+/*?*/ pLayLeaf = (SwLayoutFrm*)((SwLayoutFrm*)pLayLeaf->GetUpper()->GetNext())->Lower();
+/*?*/ if( pLayLeaf->Lower() )
+/*?*/ pTmp = pLayLeaf;
+/*?*/ }
+/*?*/ // If we skipped an empty column, we've to set the jump-flag
+/*?*/ if( pLayLeaf != pTmp )
+/*?*/ {
+/*?*/ pLayLeaf = pTmp;
+/*?*/ SwFlowFrm::SetMoveBwdJump( TRUE );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pLayLeaf;
+/*N*/ }
+
+/*N*/ SwTwips lcl_DeadLine( const SwFrm* pFrm )
+/*N*/ {
+/*N*/ const SwLayoutFrm* pUp = pFrm->GetUpper();
+/*N*/ while( pUp && pUp->IsInSct() )
+/*N*/ {
+/*?*/ if( pUp->IsSctFrm() )
+/*?*/ pUp = pUp->GetUpper();
+/*?*/ // Spalten jetzt mit BodyFrm
+/*?*/ else if( pUp->IsColBodyFrm() && pUp->GetUpper()->GetUpper()->IsSctFrm() )
+/*?*/ pUp = pUp->GetUpper()->GetUpper();
+/*?*/ else
+/*?*/ break;
+/*N*/ }
+/*N*/ SWRECTFN( pFrm )
+/*N*/ return pUp ? (pUp->*fnRect->fnGetPrtBottom)() :
+/*N*/ (pFrm->Frm().*fnRect->fnGetBottom)();
+/*N*/ }
+
+// SwSectionFrm::Growable(..) prueft, ob der SectionFrm noch wachsen kann,
+// ggf. muss die Umgebung gefragt werden
+
+/*N*/ BOOL SwSectionFrm::Growable() const
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ if( (*fnRect->fnYDiff)( lcl_DeadLine( this ),
+/*N*/ (Frm().*fnRect->fnGetBottom)() ) > 0 )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ return ( GetUpper() && ((SwFrm*)GetUpper())->Grow( LONG_MAX PHEIGHT, TRUE ) );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::_Grow(), _Shrink()
+|*
+|* Ersterstellung AMA 14. Jan. 98
+|* Letzte Aenderung AMA 14. Jan. 98
+|*
+|*************************************************************************/
+
+/*N*/ SwTwips SwSectionFrm::_Grow( SwTwips nDist, BOOL bTst )
+/*N*/ {
+/*N*/ if ( !IsColLocked() && !HasFixSize() )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nFrmHeight > 0 && nDist > (LONG_MAX - nFrmHeight) )
+/*N*/ nDist = LONG_MAX - nFrmHeight;
+/*N*/
+/*N*/ if ( nDist <= 0L )
+/*?*/ return 0L;
+/*N*/
+/*N*/ BOOL bInCalcCntnt = GetUpper() && IsInFly() && FindFlyFrm()->IsLocked();
+/*N*/ if ( !Lower() || !Lower()->IsColumnFrm() || !Lower()->GetNext() ||
+/*N*/ GetSection()->GetFmt()->GetBalancedColumns().GetValue() )
+/*N*/ {
+/*N*/ SwTwips nGrow;
+/*N*/ if( IsInFtn() )
+/*?*/ nGrow = 0;
+/*N*/ else
+/*N*/ {
+/*N*/ nGrow = lcl_DeadLine( this );
+/*N*/ nGrow = (*fnRect->fnYDiff)( nGrow,
+/*N*/ (Frm().*fnRect->fnGetBottom)() );
+/*N*/ }
+/*N*/ SwTwips nSpace = nGrow;
+/*N*/ if( !bInCalcCntnt && nGrow < nDist && GetUpper() )
+/*N*/ nGrow += GetUpper()->Grow( LONG_MAX PHEIGHT, TRUE );
+/*N*/
+/*N*/ if( nGrow > nDist )
+/*N*/ nGrow = nDist;
+/*N*/ if( nGrow <= 0 )
+/*N*/ {
+/*N*/ nGrow = 0;
+/*N*/ if( nDist && !bTst )
+/*N*/ {
+/*N*/ if( bInCalcCntnt )
+/*?*/ _InvalidateSize();
+/*N*/ else
+/*N*/ InvalidateSize();
+/*N*/ }
+/*N*/ }
+/*N*/ else if( !bTst )
+/*N*/ {
+/*N*/ if( bInCalcCntnt )
+/*?*/ _InvalidateSize();
+/*?*/ else if( nSpace < nGrow && nDist != nSpace + GetUpper()->
+/*N*/ Grow( nGrow - nSpace, FALSE ) )
+/*N*/ InvalidateSize();
+/*N*/ else
+/*N*/ {
+/*N*/ const SvxGraphicPosition ePos =
+/*N*/ GetAttrSet()->GetBackground().GetGraphicPos();
+/*N*/ if ( GPOS_RT < ePos && GPOS_TILED != ePos )
+/*N*/ {
+/*?*/ SetCompletePaint();
+/*?*/ InvalidatePage();
+/*N*/ }
+/*N*/ if( GetUpper() && GetUpper()->IsHeaderFrm() )
+/*?*/ GetUpper()->InvalidateSize();
+/*N*/ }
+/*N*/ (Frm().*fnRect->fnAddBottom)( nGrow );
+/*N*/ long nPrtHeight = (Prt().*fnRect->fnGetHeight)() + nGrow;
+/*N*/ (Prt().*fnRect->fnSetHeight)( nPrtHeight );
+/*N*/
+/*N*/ if( Lower() && Lower()->IsColumnFrm() && Lower()->GetNext() )
+/*N*/ {
+/*?*/ SwFrm* pTmp = Lower();
+/*?*/ do
+/*?*/ {
+/*?*/ pTmp->_InvalidateSize();
+/*?*/ pTmp = pTmp->GetNext();
+/*?*/ } while ( pTmp );
+/*?*/ _InvalidateSize();
+/*N*/ }
+/*N*/ if( GetNext() )
+/*N*/ {
+/*N*/ SwFrm *pFrm = GetNext();
+/*N*/ while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
+/*?*/ pFrm = pFrm->GetNext();
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ if( bInCalcCntnt )
+/*?*/ pFrm->_InvalidatePos();
+/*N*/ else
+/*N*/ pFrm->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nGrow;
+/*N*/ }
+/*?*/ if ( !bTst )
+/*?*/ {
+/*?*/ if( bInCalcCntnt )
+/*?*/ _InvalidateSize();
+/*?*/ else
+/*?*/ InvalidateSize();
+/*?*/ }
+/*?*/ }
+/*?*/ return 0L;
+/*N*/ }
+
+/*N*/ SwTwips SwSectionFrm::_Shrink( SwTwips nDist, BOOL bTst )
+/*N*/ {
+/*N*/ if ( Lower() && !IsColLocked() && !HasFixSize() )
+/*N*/ {
+/*N*/ if( ToMaximize( FALSE ) )
+/*N*/ {
+/*N*/ if( !bTst )
+/*N*/ InvalidateSize();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( nDist > nFrmHeight )
+/*N*/ nDist = nFrmHeight;
+/*N*/
+/*N*/ if ( Lower()->IsColumnFrm() && Lower()->GetNext() && // FtnAtEnd
+/*N*/ !GetSection()->GetFmt()->GetBalancedColumns().GetValue() )
+/*N*/ { //Bei Spaltigkeit ubernimmt das Format die Kontrolle ueber
+/*?*/ //das Wachstum (wg. des Ausgleichs).
+/*?*/ if ( !bTst )
+/*?*/ InvalidateSize();
+/*?*/ return nDist;
+/*N*/ }
+/*N*/ else if( !bTst )
+/*N*/ {
+/*N*/ const SvxGraphicPosition ePos =
+/*N*/ GetAttrSet()->GetBackground().GetGraphicPos();
+/*N*/ if ( GPOS_RT < ePos && GPOS_TILED != ePos )
+/*N*/ {
+/*?*/ SetCompletePaint();
+/*?*/ InvalidatePage();
+/*N*/ }
+/*N*/ (Frm().*fnRect->fnAddBottom)( -nDist );
+/*N*/ long nPrtHeight = (Prt().*fnRect->fnGetHeight)() - nDist;
+/*N*/ (Prt().*fnRect->fnSetHeight)( nPrtHeight );
+
+/*N*/ SwTwips nReal = 0;
+/*N*/ // We do not allow a section frame to shrink the its upper
+/*N*/ // footer frame. This is because in the calculation of a
+/*N*/ // footer frame, the content of the section frame is _not_
+/*N*/ // calculated. If there is a fly frame overlapping with the
+/*N*/ // footer frame, the section frame is not affected by this
+/*N*/ // during the calculation of the footer frame size.
+/*N*/ // The footer frame does not grow in its FormatSize function
+/*N*/ // but during the calculation of the content of the section
+/*N*/ // frame. The section frame grows until some of its text is
+/*N*/ // located on top of the fly frame. The next call of CalcCntnt
+/*N*/ // tries to shrink the section and here it would also shrink
+/*N*/ // the footer. This may not happen, because shrinking the footer
+/*N*/ // would cause the top of the section frame to overlap with the
+/*N*/ // fly frame again, this would result in a perfect loop.
+/*N*/ if( !GetUpper()->IsFooterFrm() )
+/*N*/ nReal = GetUpper()->Shrink( nDist, bTst );
+/*N*/
+/*N*/ if( Lower() && Lower()->IsColumnFrm() && Lower()->GetNext() )
+/*N*/ {
+/*N*/ SwFrm* pTmp = Lower();
+/*N*/ do
+/*N*/ {
+/*N*/ pTmp->_InvalidateSize();
+/*N*/ pTmp = pTmp->GetNext();
+/*N*/ } while ( pTmp );
+/*N*/ }
+/*N*/ if( GetNext() )
+/*N*/ {
+/*N*/ SwFrm* pFrm = GetNext();
+/*N*/ while( pFrm && pFrm->IsSctFrm() && !((SwSectionFrm*)pFrm)->GetSection() )
+/*?*/ pFrm = pFrm->GetNext();
+/*N*/ if( pFrm )
+/*N*/ pFrm->InvalidatePos();
+/*N*/ else
+/*?*/ SetRetouche();
+/*N*/ }
+/*N*/ else
+/*N*/ SetRetouche();
+/*N*/ return nDist;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return 0L;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::MoveAllowed()
+|*
+|* Ersterstellung MA 08. Oct. 98
+|* Letzte Aenderung MA 08. Oct. 98
+|*
+|* Wann sind Frms innerhalb eines SectionFrms moveable?
+|* Wenn sie noch nicht in der letzten Spalte des SectionFrms sind,
+|* wenn es einen Follow gibt,
+|* wenn der SectionFrm nicht mehr wachsen kann, wird es komplizierter,
+|* dann kommt es darauf an, ob der SectionFrm ein naechstes Layoutblatt
+|* finden kann. In (spaltigen/verketteten) Flys wird dies via GetNextLayout
+|* geprueft, in Tabellen und in Kopf/Fusszeilen gibt es keins, im DocBody
+|* und auch im Fussnoten dagegen immer.
+|*
+|* Benutzt wird diese Routine im TxtFormatter, um zu entscheiden, ob ein
+|* (Absatz-)Follow erzeugt werden darf oder ob der Absatz zusammenhalten muss.
+|*
+|*************************************************************************/
+
+/*N*/ BOOL SwSectionFrm::MoveAllowed( const SwFrm* pFrm) const
+/*N*/ {
+/*N*/ // Gibt es einen Follow oder ist der Frame nicht in der letzten Spalte?
+/*N*/ if( HasFollow() || ( pFrm->GetUpper()->IsColBodyFrm() &&
+/*N*/ pFrm->GetUpper()->GetUpper()->GetNext() ) )
+/*N*/ return TRUE;
+/*N*/ if( pFrm->IsInFtn() )
+/*N*/ {
+/*?*/ if( IsInFtn() )
+/*?*/ {
+/*?*/ if( GetUpper()->IsInSct() )
+/*?*/ {
+/*?*/ if( Growable() )
+/*?*/ return FALSE;
+/*?*/ return GetUpper()->FindSctFrm()->MoveAllowed( this );
+/*?*/ }
+/*?*/ else
+/*?*/ return TRUE;
+/*?*/ }
+/*?*/ // The content of footnote inside a columned sectionfrm is moveable
+/*?*/ // except in the last column
+/*?*/ const SwLayoutFrm *pLay = pFrm->FindFtnFrm()->GetUpper()->GetUpper();
+/*?*/ if( pLay->IsColumnFrm() && pLay->GetNext() )
+/*?*/ {
+/*?*/ // The first paragraph in the first footnote in the first column
+/*?*/ // in the sectionfrm at the top of the page is not moveable,
+/*?*/ // if the columnbody is empty.
+/*?*/ BOOL bRet = FALSE;
+/*?*/ if( pLay->GetIndPrev() || pFrm->GetIndPrev() ||
+/*?*/ pFrm->FindFtnFrm()->GetPrev() )
+/*?*/ bRet = TRUE;
+/*?*/ else
+/*?*/ {
+/*?*/ SwLayoutFrm* pBody = ((SwColumnFrm*)pLay)->FindBodyCont();
+/*?*/ if( pBody && pBody->Lower() )
+/*?*/ bRet = TRUE;
+/*?*/ }
+/*?*/ if( bRet && ( IsFtnAtEnd() || !Growable() ) )
+/*?*/ return TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ // Oder kann der Bereich noch wachsen?
+/*N*/ if( !IsColLocked() && Growable() )
+/*N*/ return FALSE;
+/*N*/ // Jetzt muss untersucht werden, ob es ein Layoutblatt gibt, in dem
+/*N*/ // ein Bereichsfollow erzeugt werden kann.
+/*N*/ if( IsInTab() || ( !IsInDocBody() && FindFooterOrHeader() ) )
+/*?*/ return FALSE; // In Tabellen/Kopf/Fusszeilen geht es nicht
+/*N*/ if( IsInFly() ) // Bei spaltigen oder verketteten Rahmen
+/*?*/ return 0 != ((SwFrm*)GetUpper())->GetNextLeaf( MAKEPAGE_NONE );
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ SwFrm* SwFrm::_GetIndPrev()
+/*N*/ {
+/*N*/ SwFrm *pRet = NULL;
+/*N*/ ASSERT( !pPrev && IsInSct(), "Why?" );
+/*N*/ SwFrm* pSct = GetUpper();
+/*N*/ if( !pSct )
+/*?*/ return NULL;
+/*N*/ if( pSct->IsSctFrm() )
+/*N*/ pRet = pSct->GetIndPrev();
+/*N*/ else if( pSct->IsColBodyFrm() && (pSct = pSct->GetUpper()->GetUpper())->IsSctFrm() )
+/*N*/ { // Wir duerfen nur den Vorgaenger des SectionFrms zurueckliefern,
+/*?*/ // wenn in keiner vorhergehenden Spalte mehr Inhalt ist
+/*?*/ SwFrm* pCol = GetUpper()->GetUpper()->GetPrev();
+/*?*/ while( pCol )
+/*?*/ {
+/*?*/ ASSERT( pCol->IsColumnFrm(), "GetIndPrev(): ColumnFrm expected" );
+/*?*/ ASSERT( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(),
+/*?*/ "GetIndPrev(): Where's the body?");
+/*?*/ if( ((SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower())->Lower() )
+/*?*/ return NULL;
+/*?*/ pCol = pCol->GetPrev();
+/*?*/ }
+/*?*/ pRet = pSct->GetIndPrev();
+/*N*/ }
+/*N*/ // Scheintote SectionFrames ueberspringen wir lieber
+/*N*/ while( pRet && pRet->IsSctFrm() && !((SwSectionFrm*)pRet)->GetSection() )
+/*N*/ pRet = pRet->GetIndPrev();
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ SwFrm* SwFrm::_GetIndNext()
+/*N*/ {
+/*N*/ ASSERT( !pNext && IsInSct(), "Why?" );
+/*N*/ SwFrm* pSct = GetUpper();
+/*N*/ if( !pSct )
+/*?*/ return NULL;
+/*N*/ if( pSct->IsSctFrm() )
+/*N*/ return pSct->GetIndNext();
+/*N*/ if( pSct->IsColBodyFrm() && (pSct = pSct->GetUpper()->GetUpper())->IsSctFrm() )
+/*N*/ { // Wir duerfen nur den Nachfolger des SectionFrms zurueckliefern,
+/*?*/ // wenn in keiner folgenden Spalte mehr Inhalt ist
+/*?*/ SwFrm* pCol = GetUpper()->GetUpper()->GetNext();
+/*?*/ while( pCol )
+/*?*/ {
+/*?*/ ASSERT( pCol->IsColumnFrm(), "GetIndNext(): ColumnFrm expected" );
+/*?*/ ASSERT( pCol->GetLower() && pCol->GetLower()->IsBodyFrm(),
+/*?*/ "GetIndNext(): Where's the body?");
+/*?*/ if( ((SwLayoutFrm*)((SwLayoutFrm*)pCol)->Lower())->Lower() )
+/*?*/ return NULL;
+/*?*/ pCol = pCol->GetNext();
+/*?*/ }
+/*?*/ return pSct->GetIndNext();
+/*N*/ }
+/*N*/ return NULL;
+/*N*/ }
+
+
+
+/*N*/ void SwSectionFrm::CalcFtnAtEndFlag()
+/*N*/ {
+/*N*/ SwSectionFmt *pFmt = GetSection()->GetFmt();
+/*N*/ USHORT nVal = pFmt->GetFtnAtTxtEnd( FALSE ).GetValue();
+/*N*/ bFtnAtEnd = FTNEND_ATPGORDOCEND != nVal;
+/*N*/ bOwnFtnNum = FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
+/*N*/ FTNEND_ATTXTEND_OWNNUMANDFMT == nVal;
+/*N*/ while( !bFtnAtEnd && !bOwnFtnNum )
+/*N*/ {
+/*N*/ if( pFmt->GetRegisteredIn()->ISA( SwSectionFmt ) )
+/*N*/ pFmt = (SwSectionFmt*)pFmt->GetRegisteredIn();
+/*N*/ else
+/*N*/ break;
+/*N*/ nVal = pFmt->GetFtnAtTxtEnd( FALSE ).GetValue();
+/*N*/ if( FTNEND_ATPGORDOCEND != nVal )
+/*N*/ {
+/*?*/ bFtnAtEnd = TRUE;
+/*?*/ bOwnFtnNum = bOwnFtnNum ||FTNEND_ATTXTEND_OWNNUMSEQ == nVal ||
+/*?*/ FTNEND_ATTXTEND_OWNNUMANDFMT == nVal;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwSectionFrm::CalcEndAtEndFlag()
+/*N*/ {
+/*N*/ SwSectionFmt *pFmt = GetSection()->GetFmt();
+/*N*/ bEndnAtEnd = pFmt->GetEndAtTxtEnd( FALSE ).IsAtEnd();
+/*N*/ while( !bEndnAtEnd )
+/*N*/ {
+/*N*/ if( pFmt->GetRegisteredIn()->ISA( SwSectionFmt ) )
+/*N*/ pFmt = (SwSectionFmt*)pFmt->GetRegisteredIn();
+/*N*/ else
+/*N*/ break;
+/*N*/ bEndnAtEnd = pFmt->GetEndAtTxtEnd( FALSE ).IsAtEnd();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwSectionFrm::Modify()
+|*
+|* Ersterstellung MA 08. Oct. 98
+|* Letzte Aenderung MA 08. Oct. 98
+|*
+|*************************************************************************/
+
+/*N*/ void SwSectionFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ BYTE nInvFlags = 0;
+/*N*/
+/*N*/ if( pNew && RES_ATTRSET_CHG == pNew->Which() )
+/*N*/ {
+/*N*/ SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
+/*N*/ SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
+/*N*/ SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
+/*N*/ SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
+/*N*/ (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+/*N*/ &aOldSet, &aNewSet );
+/*N*/ if( aNIter.IsAtEnd() )
+/*N*/ break;
+/*N*/ aNIter.NextItem();
+/*N*/ aOIter.NextItem();
+/*N*/ }
+/*N*/ if ( aOldSet.Count() || aNewSet.Count() )
+/*N*/ SwLayoutFrm::Modify( &aOldSet, &aNewSet );
+/*N*/ }
+/*N*/ else
+/*?*/ _UpdateAttr( pOld, pNew, nInvFlags );
+/*N*/
+/*N*/ if ( nInvFlags != 0 )
+/*N*/ {
+/*N*/ if ( nInvFlags & 0x01 )
+/*N*/ InvalidateSize();
+/*N*/ if ( nInvFlags & 0x10 )
+/*N*/ SetCompletePaint();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwSectionFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew,
+/*N*/ BYTE &rInvFlags,
+/*N*/ SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
+/*N*/ {
+/*N*/ BOOL bClear = TRUE;
+/*N*/ const USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ switch( nWhich )
+/*N*/ { // Mehrspaltigkeit in Fussnoten unterdruecken...
+/*N*/ case RES_FMT_CHG:
+/*N*/ {
+/*?*/ const SwFmtCol& rNewCol = GetFmt()->GetCol();
+/*?*/ if( !IsInFtn() )
+/*?*/ {
+/*?*/ //Dummer Fall. Bei der Zuweisung einer Vorlage k”nnen wir uns
+/*?*/ //nicht auf das alte Spaltenattribut verlassen. Da diese
+/*?*/ //wenigstens anzahlgemass fuer ChgColumns vorliegen muessen,
+/*?*/ //bleibt uns nur einen temporaeres Attribut zu basteln.
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFmtCol aCol;
+/*?*/ }
+/*?*/ rInvFlags |= 0x01;
+/*?*/ bClear = FALSE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_COL:
+/*N*/ if( !IsInFtn() )
+/*N*/ {
+/*N*/ ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew );
+/*N*/ rInvFlags |= 0x11;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FTN_AT_TXTEND:
+/*?*/ if( !IsInFtn() )
+/*?*/ {
+/*?*/ BOOL bOld = IsFtnAtEnd();
+/*?*/ CalcFtnAtEndFlag();
+/*?*/ if( bOld != IsFtnAtEnd() )
+/*?*/ {
+/*?*/ const SwFmtCol& rNewCol = GetFmt()->GetCol();
+/*?*/ ChgColumns( rNewCol, rNewCol, TRUE );
+/*?*/ rInvFlags |= 0x01;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case RES_END_AT_TXTEND:
+/*?*/ if( !IsInFtn() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 BOOL bOld = IsEndnAtEnd();
+/*?*/ }
+/*?*/ break;
+/*?*/ case RES_COLUMNBALANCE:
+/*?*/ rInvFlags |= 0x01;
+/*?*/ break;
+/*?*/
+/*?*/ case RES_FRAMEDIR :
+/*?*/ SetDerivedR2L( sal_False );
+/*?*/ CheckDirChange();
+/*?*/ break;
+/*M*/
+/*M*/ case RES_PROTECT:
+/*M*/ { DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ break;
+/*M*/
+/*N*/ default:
+/*N*/ bClear = FALSE;
+/*N*/ }
+/*N*/ if ( bClear )
+/*N*/ {
+/*N*/ if ( pOldSet || pNewSet )
+/*N*/ {
+/*N*/ if ( pOldSet )
+/*N*/ pOldSet->ClearItem( nWhich );
+/*N*/ if ( pNewSet )
+/*N*/ pNewSet->ClearItem( nWhich );
+/*N*/ }
+/*N*/ else
+/*?*/ SwLayoutFrm::Modify( pOld, pNew );
+/*N*/ }
+/*N*/ }
+
+/*-----------------09.06.99 14:58-------------------
+ * SwSectionFrm::ToMaximize(..): A follow or a ftncontainer at the end of the
+ * page causes a maximal Size of the sectionframe.
+ * --------------------------------------------------*/
+
+/*N*/ BOOL SwSectionFrm::ToMaximize( BOOL bCheckFollow ) const
+/*N*/ {
+/*N*/ if( HasFollow() )
+/*N*/ {
+/*N*/ if( !bCheckFollow ) // Don't check superfluous follows
+/*N*/ return TRUE;
+/*?*/ const SwSectionFrm* pFoll = GetFollow();
+/*?*/ while( pFoll && pFoll->IsSuperfluous() )
+/*?*/ pFoll = pFoll->GetFollow();
+/*?*/ if( pFoll )
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ if( IsFtnAtEnd() )
+/*?*/ return FALSE;
+/*N*/ const SwFtnContFrm* pCont = ContainsFtnCont();
+/*N*/ if( !IsEndnAtEnd() )
+/*N*/ return 0 != pCont;
+/*?*/ BOOL bRet = FALSE;
+/*?*/ while( pCont && !bRet )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( pCont->FindFootNote() )
+/*?*/ }
+/*?*/ return bRet;
+/*N*/ }
+
+/*-----------------09.06.99 15:07-------------------
+ * BOOL SwSectionFrm::ContainsFtnCont()
+ * checks every Column for FtnContFrms.
+ * --------------------------------------------------*/
+
+/*N*/ SwFtnContFrm* SwSectionFrm::ContainsFtnCont( const SwFtnContFrm* pCont ) const
+/*N*/ {
+/*N*/ SwFtnContFrm* pRet = NULL;
+/*N*/ const SwLayoutFrm* pLay;
+/*N*/ if( pCont )
+/*N*/ {
+/*?*/ pLay = pCont->FindFtnBossFrm( NULL );
+/*?*/ ASSERT( IsAnLower( pLay ), "ConatainsFtnCont: Wrong FtnContainer" );
+/*?*/ pLay = (SwLayoutFrm*)pLay->GetNext();
+/*N*/ }
+/*N*/ else if( Lower() && Lower()->IsColumnFrm() )
+/*?*/ pLay = (SwLayoutFrm*)Lower();
+/*N*/ else
+/*N*/ pLay = NULL;
+/*N*/ while ( !pRet && pLay )
+/*N*/ {
+/*?*/ if( pLay->Lower() && pLay->Lower()->GetNext() )
+/*?*/ {
+/*?*/ ASSERT( pLay->Lower()->GetNext()->IsFtnContFrm(),
+/*?*/ "ToMaximize: Unexspected Frame" );
+/*?*/ pRet = (SwFtnContFrm*)pLay->Lower()->GetNext();
+/*?*/ }
+/*?*/ ASSERT( !pLay->GetNext() || pLay->GetNext()->IsLayoutFrm(),
+/*?*/ "ToMaximize: ColFrm exspected" );
+/*?*/ pLay = (SwLayoutFrm*)pLay->GetNext();
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ void SwSectionFrm::InvalidateFtnPos()
+/*N*/ {
+/*N*/ SwFtnContFrm* pCont = ContainsFtnCont( NULL );
+/*N*/ if( pCont )
+/*N*/ {
+/*?*/ SwFrm *pTmp = pCont->ContainsCntnt();
+/*?*/ if( pTmp )
+/*?*/ pTmp->_InvalidatePos();
+/*N*/ }
+/*N*/ }
+
+/*-----------------18.03.99 10:37-------------------
+ * SwSectionFrm::Undersize() liefert den Betrag, um den der Bereich gern
+ * groesser waere, wenn in ihm Undersized TxtFrms liegen, ansonsten Null.
+ * Das Undersized-Flag wird ggf. korrigiert.
+ * --------------------------------------------------*/
+
+/*N*/ long SwSectionFrm::Undersize( BOOL bOverSize )
+/*N*/ {
+/*N*/ bUndersized = FALSE;
+/*N*/ SWRECTFN( this )
+/*N*/ long nRet = InnerHeight() - (Prt().*fnRect->fnGetHeight)();
+/*N*/ if( nRet > 0 )
+/*N*/ bUndersized = TRUE;
+/*N*/ else if( !bOverSize )
+/*N*/ nRet = 0;
+/*N*/ return nRet;
+/*N*/ }
+
+/// OD 01.04.2003 #108446# - determine next frame for footnote/endnote formatting
+/// before format of current one, because current one can move backward.
+/// After moving backward to a previous page method <FindNext()> will return
+/// the text frame presenting the first page footnote, if it exists. Thus, the
+/// rest of the footnote/endnote container would not be formatted.
+/*N*/ void SwSectionFrm::CalcFtnCntnt()
+/*N*/ {
+/*N*/ SwFtnContFrm* pCont = ContainsFtnCont();
+/*N*/ if( pCont )
+/*N*/ {
+/*?*/ SwFrm* pFrm = pCont->ContainsAny();
+/*?*/ if( pFrm )
+/*?*/ pCont->Calc();
+/*?*/ while( pFrm && IsAnLower( pFrm ) )
+/*?*/ {
+/*?*/ SwFtnFrm* pFtn = pFrm->FindFtnFrm();
+/*?*/ if( pFtn )
+/*?*/ pFtn->Calc();
+/*?*/ // OD 01.04.2003 #108446# - determine next frame before format current frame.
+/*?*/ SwFrm* pNextFrm = 0;
+/*?*/ {
+/*?*/ if( pFrm->IsSctFrm() )
+/*?*/ {
+/*?*/ pNextFrm = static_cast<SwSectionFrm*>(pFrm)->ContainsAny();
+/*?*/ }
+/*?*/ if( !pNextFrm )
+/*?*/ {
+/*?*/ pNextFrm = pFrm->FindNext();
+/*?*/ }
+/*?*/ }
+/*?*/ pFrm->Calc();
+/*?*/ pFrm = pNextFrm;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+/* -----------------09.02.99 14:26-------------------
+ * Wenn ein SectionFrm leerlaeuft, z.B. weil sein Inhalt die Seite/Spalte wechselt,
+ * so wird er nicht sofort zerstoert (es koennte noch jemand auf dem Stack einen Pointer
+ * auf ihn halten), sondern er traegt sich in eine Liste am RootFrm ein, die spaeter
+ * abgearbeitet wird (in LayAction::Action u.a.). Seine Groesse wird auf Null gesetzt und
+ * sein Zeiger auf seine Section ebenfalls. Solche zum Loeschen vorgesehene SectionFrms
+ * muessen vom Layout/beim Formatieren ignoriert werden.
+ *
+ * Mit InsertEmptySct nimmt der RootFrm einen SectionFrm in die Liste auf,
+ * mit RemoveFromList kann ein SectionFrm wieder aus der Liste entfernt werden (Dtor),
+ * mit DeleteEmptySct wird die Liste abgearbeitet und die SectionFrms zerstoert
+ * --------------------------------------------------*/
+
+/*N*/ void SwRootFrm::InsertEmptySct( SwSectionFrm* pDel )
+/*N*/ {
+/*N*/ if( !pDestroy )
+/*N*/ pDestroy = new SwDestroyList;
+/*N*/ USHORT nPos;
+/*N*/ if( !pDestroy->Seek_Entry( pDel, &nPos ) )
+/*N*/ pDestroy->Insert( pDel );
+/*N*/ }
+
+/*N*/ void SwRootFrm::_DeleteEmptySct()
+/*N*/ {
+/*N*/ ASSERT( pDestroy, "Keine Liste, keine Kekse" );
+/*N*/ while( pDestroy->Count() )
+/*N*/ {
+/*N*/ SwSectionFrm* pSect = (*pDestroy)[0];
+/*N*/ pDestroy->Remove( USHORT(0) );
+/*N*/ ASSERT( !pSect->IsColLocked() && !pSect->IsJoinLocked(),
+/*N*/ "DeleteEmptySct: Locked SectionFrm" );
+/*N*/ if( !pSect->Frm().HasArea() && !pSect->ContainsCntnt() )
+/*N*/ {
+/*N*/ SwLayoutFrm* pUp = pSect->GetUpper();
+/*N*/ pSect->Remove();
+/*N*/ delete pSect;
+/*N*/ if( pUp && !pUp->Lower() )
+/*N*/ {
+/*N*/ if( pUp->IsPageBodyFrm() )
+/*N*/ pUp->FindRootFrm()->SetSuperfluous();
+/*N*/ else if( pUp->IsFtnFrm() && !pUp->IsColLocked() &&
+/*N*/ pUp->GetUpper() )
+/*N*/ {
+/*?*/ pUp->Cut();
+/*?*/ delete pUp;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ ASSERT( pSect->GetSection(), "DeleteEmptySct: Halbtoter SectionFrm?!" );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwRootFrm::_RemoveFromList( SwSectionFrm* pSct )
+/*N*/ {
+/*N*/ ASSERT( pDestroy, "Where's my list?" );
+/*N*/ USHORT nPos;
+/*N*/ if( pDestroy->Seek_Entry( pSct, &nPos ) )
+/*?*/ pDestroy->Remove( nPos );
+/*N*/ }
+
+/*N*/ #ifdef DBG_UTIL
+
+/*N*/ BOOL SwRootFrm::IsInDelList( SwSectionFrm* pSct ) const
+/*N*/ {
+/*N*/ USHORT nPos;
+/*N*/ return ( pDestroy && pDestroy->Seek_Entry( pSct, &nPos ) );
+/*N*/ }
+
+/*N*/ #endif
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_ssfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_ssfrm.cxx
new file mode 100644
index 000000000000..9aa028225c6b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_ssfrm.cxx
@@ -0,0 +1,621 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <cntfrm.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <dcontact.hxx>
+#include <dflyobj.hxx>
+#include <flyfrm.hxx>
+#include <txtfrm.hxx> // ClearPara()
+#include <ftnidx.hxx>
+#include <txtftn.hxx>
+#include <ndtxt.hxx>
+#include <ndindex.hxx>
+
+#include <frmtool.hxx>
+#include <pagedesc.hxx>
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+#include <hints.hxx> //fuer SwFmtChg
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <viewsh.hxx>
+#include <frmsh.hxx>
+namespace binfilter {
+
+ // No inline cause we need the function pointers
+/*N*/ long SwFrm::GetTopMargin() const
+/*N*/ { return Prt().Top(); }
+/*N*/ long SwFrm::GetBottomMargin() const
+/*N*/ { return Frm().Height() -Prt().Height() -Prt().Top(); }
+/*N*/ long SwFrm::GetLeftMargin() const
+/*N*/ { return Prt().Left(); }
+/*N*/ long SwFrm::GetRightMargin() const
+/*N*/ { return Frm().Width() - Prt().Width() - Prt().Left(); }
+/*N*/ long SwFrm::GetPrtLeft() const
+/*N*/ { return Frm().Left() + Prt().Left(); }
+/*N*/ long SwFrm::GetPrtBottom() const
+/*N*/ { return Frm().Top() + Prt().Height() + Prt().Top(); }
+/*N*/ long SwFrm::GetPrtRight() const
+/*N*/ { return Frm().Left() + Prt().Width() + Prt().Left(); }
+/*N*/ long SwFrm::GetPrtTop() const
+/*N*/ { return Frm().Top() + Prt().Top(); }
+
+/*N*/ BOOL SwFrm::SetMinLeft( long nDeadline )
+/*N*/ {
+/*N*/ SwTwips nDiff = nDeadline - Frm().Left();
+/*N*/ if( nDiff > 0 )
+/*N*/ {
+/*?*/ Frm().Left( nDeadline );
+/*?*/ Prt().Width( Prt().Width() - nDiff );
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ BOOL SwFrm::SetMaxBottom( long nDeadline )
+/*N*/ {
+/*N*/ SwTwips nDiff = Frm().Top() + Frm().Height() - nDeadline;
+/*N*/ if( nDiff > 0 )
+/*N*/ {
+/*?*/ Frm().Height( Frm().Height() - nDiff );
+/*?*/ Prt().Height( Prt().Height() - nDiff );
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ BOOL SwFrm::SetMinTop( long nDeadline )
+/*N*/ {
+/*N*/ SwTwips nDiff = nDeadline - Frm().Top();
+/*N*/ if( nDiff > 0 )
+/*N*/ {
+/*?*/ Frm().Top( nDeadline );
+/*?*/ Prt().Height( Prt().Height() - nDiff );
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ BOOL SwFrm::SetMaxRight( long nDeadline )
+/*N*/ {
+/*N*/ SwTwips nDiff = Frm().Left() + Frm().Width() - nDeadline;
+/*N*/ if( nDiff > 0 )
+/*N*/ {
+/*?*/ Frm().Width( Frm().Width() - nDiff );
+/*?*/ Prt().Width( Prt().Width() - nDiff );
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ void SwFrm::MakeBelowPos( const SwFrm* pUp, const SwFrm* pPrv, BOOL bNotify )
+/*N*/ {
+/*N*/ if( pPrv )
+/*N*/ {
+/*N*/ aFrm.Pos( pPrv->Frm().Pos() );
+/*N*/ aFrm.Pos().Y() += pPrv->Frm().Height();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrm.Pos( pUp->Frm().Pos() );
+/*N*/ aFrm.Pos() += pUp->Prt().Pos();
+/*N*/ }
+/*N*/ if( bNotify )
+/*N*/ aFrm.Pos().Y() += 1;
+/*N*/ }
+
+/*N*/ void SwFrm::MakeUpperPos( const SwFrm* pUp, const SwFrm* pPrv, BOOL bNotify )
+/*N*/ {
+/*N*/ if( pPrv )
+/*N*/ {
+/*N*/ aFrm.Pos( pPrv->Frm().Pos() );
+/*N*/ aFrm.Pos().Y() -= Frm().Height();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrm.Pos( pUp->Frm().Pos() );
+/*N*/ aFrm.Pos() += pUp->Prt().Pos();
+/*N*/ aFrm.Pos().Y() += pUp->Prt().Height() - aFrm.Height();
+/*N*/ }
+/*N*/ if( bNotify )
+/*N*/ aFrm.Pos().Y() -= 1;
+/*N*/ }
+
+/*N*/ void SwFrm::MakeLeftPos( const SwFrm* pUp, const SwFrm* pPrv, BOOL bNotify )
+/*N*/ {
+/*N*/ if( pPrv )
+/*N*/ {
+/*N*/ aFrm.Pos( pPrv->Frm().Pos() );
+/*N*/ aFrm.Pos().X() -= Frm().Width();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrm.Pos( pUp->Frm().Pos() );
+/*N*/ aFrm.Pos() += pUp->Prt().Pos();
+/*N*/ aFrm.Pos().X() += pUp->Prt().Width() - aFrm.Width();
+/*N*/ }
+/*N*/ if( bNotify )
+/*N*/ aFrm.Pos().X() -= 1;
+/*N*/ }
+
+/*N*/ void SwFrm::MakeRightPos( const SwFrm* pUp, const SwFrm* pPrv, BOOL bNotify )
+/*N*/ {
+/*N*/ if( pPrv )
+/*N*/ {
+/*N*/ aFrm.Pos( pPrv->Frm().Pos() );
+/*N*/ aFrm.Pos().X() += pPrv->Frm().Width();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aFrm.Pos( pUp->Frm().Pos() );
+/*N*/ aFrm.Pos() += pUp->Prt().Pos();
+/*N*/ }
+/*N*/ if( bNotify )
+/*N*/ aFrm.Pos().X() += 1;
+/*N*/ }
+
+/*N*/ void SwFrm::SetTopBottomMargins( long nTop, long nBot )
+/*N*/ {
+/*N*/ Prt().Top( nTop );
+/*N*/ Prt().Height( Frm().Height() - nTop - nBot );
+/*N*/ }
+
+/*N*/ void SwFrm::SetBottomTopMargins( long nBot, long nTop )
+/*N*/ {
+/*N*/ Prt().Top( nTop );
+/*N*/ Prt().Height( Frm().Height() - nTop - nBot );
+/*N*/ }
+
+/*N*/ void SwFrm::SetLeftRightMargins( long nLeft, long nRight)
+/*N*/ {
+/*N*/ Prt().Left( nLeft );
+/*N*/ Prt().Width( Frm().Width() - nLeft - nRight );
+/*N*/ }
+
+/*N*/ void SwFrm::SetRightLeftMargins( long nRight, long nLeft)
+/*N*/ {
+/*N*/ Prt().Left( nLeft );
+/*N*/ Prt().Width( Frm().Width() - nLeft - nRight );
+/*N*/ }
+
+/*-----------------11.9.2001 11:11------------------
+ * SwFrm::CheckDirChange(..)
+ * checks the layout direction and
+ * invalidates the lower frames rekursivly, if necessary.
+ * --------------------------------------------------*/
+
+/*N*/ void SwFrm::CheckDirChange()
+/*N*/ {
+/*N*/ BOOL bOldVert = GetVerticalFlag();
+/*N*/ BOOL bOldRev = IsReverse();
+/*N*/ BOOL bOldR2L = GetRightToLeftFlag();
+/*N*/ SetInvalidVert( TRUE );
+/*N*/ SetInvalidR2L( TRUE );
+/*N*/ BOOL bChg = bOldR2L != IsRightToLeft();
+/*N*/ if( ( IsVertical() != bOldVert ) || bChg || IsReverse() != bOldRev )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+
+/*-----------------13.9.2002 11:11------------------
+ * SwFrm::GetAnchorPos(..)
+ * returns the position for anchors based on frame direction
+ * --------------------------------------------------*/
+
+/*N*/ Point SwFrm::GetFrmAnchorPos( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const
+/*N*/ {
+/*N*/ Point aAnchor = Frm().Pos();
+/*N*/ if ( IsVertical() || IsRightToLeft() )
+/*N*/ aAnchor.X() += Frm().Width();
+/*N*/
+/*N*/ if ( IsTxtFrm() )
+/*N*/ {
+/*N*/ SwTwips nBaseOfstForFly =
+/*N*/ ((SwTxtFrm*)this)->GetBaseOfstForFly( bIgnoreFlysAnchoredAtThisFrame );
+/*N*/ if ( IsVertical() )
+/*N*/ aAnchor.Y() += nBaseOfstForFly;
+/*N*/ else
+/*N*/ aAnchor.X() += nBaseOfstForFly;
+/*N*/ }
+/*N*/
+/*N*/ return aAnchor;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwFrm::~SwFrm()
+|*
+|* Ersterstellung MA 02. Mar. 94
+|* Letzte Aenderung MA 25. Jun. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ SwFrm::~SwFrm()
+/*N*/ {
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // accessible objects for fly and cell frames have been already disposed
+/*N*/ // by the destructors of the derived classes.
+/*N*/ if( IsAccessibleFrm() && !(IsFlyFrm() || IsCellFrm()) && GetDep() )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() )
+/*N*/ {
+/*?*/ ViewShell *pVSh = pRootFrm->GetCurrShell();
+/*?*/ if( pVSh && pVSh->Imp() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ASSERT( !GetLower(), "Lowers should be dispose already!" );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if( pDrawObjs )
+/*N*/ {
+/*N*/ for ( USHORT i = pDrawObjs->Count(); i; )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pDrawObjs)[--i];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ delete ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ else
+/*N*/ // OD 23.06.2003 #108784# - consider 'virtual' drawing objects
+/*N*/ {
+/*N*/ if ( pObj->GetUserCall() )
+/*N*/ {
+/*N*/ ((SwDrawContact*)pObj->GetUserCall())->DisconnectObjFromLayout( pObj );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pDrawObjs )
+/*N*/ delete pDrawObjs;
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // JP 15.10.2001: for detection of access to deleted frames
+/*N*/ pDrawObjs = (SwDrawObjs*)0x33333333;
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::SetFrmFmt()
+|* Ersterstellung MA 22. Apr. 93
+|* Letzte Aenderung MA 02. Nov. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwLayoutFrm::SetFrmFmt( SwFrmFmt *pNew )
+/*N*/ {
+/*N*/ if ( pNew != GetFmt() )
+/*N*/ {
+/*N*/ SwFmtChg aOldFmt( GetFmt() );
+/*N*/ pNew->Add( this );
+/*N*/ SwFmtChg aNewFmt( pNew );
+/*N*/ Modify( &aOldFmt, &aNewFmt );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::SwCntntFrm(), ~SwCntntFrm()
+|*
+|* Ersterstellung AK 15-Feb-1991
+|* Letzte Aenderung MA 25. Apr. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ SwCntntFrm::SwCntntFrm( SwCntntNode * const pCntnt ) :
+/*N*/ SwFrm( pCntnt ),
+/*N*/ SwFlowFrm( (SwFrm&)*this )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwCntntFrm::~SwCntntFrm()
+/*N*/ {
+/*N*/ SwCntntNode* pCNd;
+/*N*/ if( 0 != ( pCNd = PTR_CAST( SwCntntNode, pRegisteredIn )) &&
+/*N*/ !pCNd->GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ //Bei der Root abmelden wenn ich dort noch im Turbo stehe.
+/*N*/ SwRootFrm *pRoot = FindRootFrm();
+/*N*/ if( pRoot && pRoot->GetTurbo() == this )
+/*N*/ {
+/*?*/ pRoot->DisallowTurbo();
+/*?*/ pRoot->ResetTurbo();
+/*N*/ }
+/*N*/ if( IsTxtFrm() && ((SwTxtFrm*)this)->HasFtn() )
+/*N*/ {
+/*?*/ SwTxtNode *pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+/*?*/ const SwFtnIdxs &rFtnIdxs = pCNd->GetDoc()->GetFtnIdxs();
+/*?*/ USHORT nPos;
+/*?*/ ULONG nIndex = pCNd->GetIndex();
+/*?*/ rFtnIdxs.SeekEntry( *pTxtNd, &nPos );
+/*?*/ SwTxtFtn* pTxtFtn;
+/*?*/ if( nPos < rFtnIdxs.Count() )
+/*?*/ {
+/*?*/ while( nPos && pTxtNd == &(rFtnIdxs[ nPos ]->GetTxtNode()) )
+/*?*/ --nPos;
+/*?*/ if( nPos || pTxtNd != &(rFtnIdxs[ nPos ]->GetTxtNode()) )
+/*?*/ ++nPos;
+/*?*/ }
+/*?*/ while( nPos < rFtnIdxs.Count() )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pTxtFtn = rFtnIdxs[ nPos ];
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( IsTxtFrm() && ((SwTxtFrm*)this)->HasBlinkPor() )
+/*?*/ ((SwTxtFrm*)this)->ClearPara();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::~SwLayoutFrm
+|*
+|* Ersterstellung AK 28-Feb-1991
+|* Letzte Aenderung MA 11. Jan. 95
+|*
+|*************************************************************************/
+
+
+/*N*/ SwLayoutFrm::~SwLayoutFrm()
+/*N*/ {
+/*N*/ SwFrm *pFrm = pLower;
+/*N*/
+/*N*/ if( GetFmt() && !GetFmt()->GetDoc()->IsInDtor() )
+/*N*/ {
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ //Erst die Objs des Frm vernichten, denn diese koennen sich sonst nach
+/*N*/ //dem Remove nicht mehr bei der Seite abmelden.
+/*N*/ //Falls sich einer nicht abmeldet wollen wir nicht gleich
+/*N*/ //endlos schleifen.
+/*N*/
+/*N*/ USHORT nCnt;
+/*N*/ while ( pFrm->GetDrawObjs() && pFrm->GetDrawObjs()->Count() )
+/*N*/ {
+/*N*/ nCnt = pFrm->GetDrawObjs()->Count();
+/*N*/ SdrObject *pObj = (*pFrm->GetDrawObjs())[0];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ delete ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ else if ( pObj->GetUserCall() )
+/*N*/ {
+/*N*/ // OD 19.06.2003 #108784# - adjustments for drawing objects
+/*N*/ // in header/footer.
+/*N*/ ((SwDrawContact*)pObj->GetUserCall())->DisconnectObjFromLayout( pObj );
+/*N*/ }
+/*N*/
+/*N*/ if ( pFrm->GetDrawObjs() &&
+/*N*/ nCnt == pFrm->GetDrawObjs()->Count() )
+/*N*/ {
+/*N*/ pFrm->GetDrawObjs()->Remove( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ pFrm->Remove();
+/*N*/ delete pFrm;
+/*N*/ pFrm = pLower;
+/*N*/ }
+/*N*/ //Fly's vernichten. Der letzte loescht gleich das Array.
+/*N*/ USHORT nCnt;
+/*N*/ while ( GetDrawObjs() && GetDrawObjs()->Count() )
+/*N*/ {
+/*N*/ nCnt = GetDrawObjs()->Count();
+/*N*/ SdrObject *pObj = (*GetDrawObjs())[0];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ delete ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ else if ( pObj->GetUserCall() )
+/*N*/ {
+/*N*/ // OD 19.06.2003 #108784# - adjustments for drawing objects
+/*N*/ // in header/footer.
+/*N*/ ((SwDrawContact*)pObj->GetUserCall())->DisconnectObjFromLayout( pObj );
+/*N*/ }
+/*N*/
+/*N*/ if ( GetDrawObjs() && nCnt == GetDrawObjs()->Count() )
+/*N*/ GetDrawObjs()->Remove( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ SwFrm *pNxt = pFrm->GetNext();
+/*N*/ delete pFrm;
+/*N*/ pFrm = pNxt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::PaintArea()
+|*
+|* Created AMA 08/22/2000
+|* Last change AMA 08/23/2000
+|*
+|* The paintarea is the area, in which the content of a frame is allowed
+|* to be displayed. This region could be larger than the printarea (Prt())
+|* of the upper, it includes e.g. often the margin of the page.
+|*
+|*************************************************************************/
+
+/*N*/ const SwRect SwFrm::PaintArea() const
+/*N*/ {
+/*N*/ SwRect aRect( Frm() );
+/*N*/ const FASTBOOL bVert = IsVertical();
+/*N*/ SwRectFn fnRect = bVert ? fnRectVert : fnRectHori;
+/*N*/ long nRight = (aRect.*fnRect->fnGetRight)();
+/*N*/ long nLeft = (aRect.*fnRect->fnGetLeft)();
+/*N*/ const SwFrm* pTmp = this;
+/*N*/ BOOL bLeft = TRUE;
+/*N*/ BOOL bRight = TRUE;
+/*N*/ while( pTmp )
+/*N*/ {
+/*N*/ long nTmpRight = (pTmp->Frm().*fnRect->fnGetRight)();
+/*N*/ long nTmpLeft = (pTmp->Frm().*fnRect->fnGetLeft)();
+/*N*/ ASSERT( pTmp, "PaintArea lost in time and space" );
+/*N*/ if( pTmp->IsPageFrm() || pTmp->IsFlyFrm() ||
+/*N*/ pTmp->IsCellFrm() || pTmp->IsRowFrm() || //nobody leaves a table!
+/*N*/ pTmp->IsRootFrm() )
+/*N*/ {
+/*N*/ if( bLeft || nLeft < nTmpLeft )
+/*N*/ nLeft = nTmpLeft;
+/*N*/ if( bRight || nTmpRight < nRight )
+/*N*/ nRight = nTmpRight;
+/*N*/ if( pTmp->IsPageFrm() || pTmp->IsFlyFrm() || pTmp->IsRootFrm() )
+/*N*/ break;
+/*N*/ bLeft = FALSE;
+/*N*/ bRight = FALSE;
+/*N*/ }
+/*N*/ else if( pTmp->IsColumnFrm() ) // nobody enters neightbour columns
+/*N*/ {
+/*N*/ BOOL bR2L = pTmp->IsRightToLeft();
+/*N*/ // the first column has _no_ influence to the left range
+/*N*/ if( bR2L ? pTmp->GetNext() : pTmp->GetPrev() )
+/*N*/ {
+/*N*/ if( bLeft || nLeft < nTmpLeft )
+/*N*/ nLeft = nTmpLeft;
+/*N*/ bLeft = FALSE;
+/*N*/ }
+/*N*/ // the last column has _no_ influence to the right range
+/*N*/ if( bR2L ? pTmp->GetPrev() : pTmp->GetNext() )
+/*N*/ {
+/*N*/ if( bRight || nTmpRight < nRight )
+/*N*/ nRight = nTmpRight;
+/*N*/ bRight = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( bVert && pTmp->IsBodyFrm() )
+/*N*/ {
+/*?*/ // Header and footer frames have always horizontal direction and
+/*?*/ // limit the body frame.
+/*?*/ // A previous frame of a body frame must be a header,
+/*?*/ // the next frame of a body frame may be a footnotecontainer or
+/*?*/ // a footer. The footnotecontainer has the same direction like
+/*?*/ // the body frame.
+/*?*/ if( pTmp->GetPrev() && ( bLeft || nLeft < nTmpLeft ) )
+/*?*/ {
+/*?*/ nLeft = nTmpLeft;
+/*?*/ bLeft = FALSE;
+/*?*/ }
+/*?*/ if( pTmp->GetNext() &&
+/*?*/ ( pTmp->GetNext()->IsFooterFrm() || pTmp->GetNext()->GetNext() )
+/*?*/ && ( bRight || nTmpRight < nRight ) )
+/*?*/ {
+/*?*/ nRight = nTmpRight;
+/*?*/ bRight = FALSE;
+/*?*/ }
+/*N*/ }
+/*N*/ pTmp = pTmp->GetUpper();
+/*N*/ }
+/*N*/ (aRect.*fnRect->fnSetLeft)( nLeft );
+/*N*/ (aRect.*fnRect->fnSetRight)( nRight );
+/*N*/ return aRect;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::UnionFrm()
+|*
+|* Created AMA 08/22/2000
+|* Last change AMA 08/23/2000
+|*
+|* The unionframe is the framearea (Frm()) of a frame expanded by the
+|* printarea, if there's a negative margin at the left or right side.
+|*
+|*************************************************************************/
+
+/*N*/ const SwRect SwFrm::UnionFrm( BOOL bBorder ) const
+/*N*/ {
+/*N*/ BOOL bVert = IsVertical();
+/*N*/ SwRectFn fnRect = bVert ? fnRectVert : fnRectHori;
+/*N*/ long nLeft = (Frm().*fnRect->fnGetLeft)();
+/*N*/ long nWidth = (Frm().*fnRect->fnGetWidth)();
+/*N*/ long nPrtLeft = (Prt().*fnRect->fnGetLeft)();
+/*N*/ long nPrtWidth = (Prt().*fnRect->fnGetWidth)();
+/*N*/ if( nPrtLeft + nPrtWidth > nWidth )
+/*?*/ nWidth = nPrtLeft + nPrtWidth;
+/*N*/ if( nPrtLeft < 0 )
+/*N*/ {
+/*N*/ nLeft += nPrtLeft;
+/*N*/ nWidth -= nPrtLeft;
+/*N*/ }
+/*N*/ SwTwips nRight = nLeft + nWidth;
+/*N*/ long nAdd = 0;
+/*N*/ if( bBorder )
+/*N*/ {
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ const SvxBoxItem &rBox = rAttrs.GetBox();
+/*N*/ if ( rBox.GetLeft() )
+/*N*/ nLeft -= rBox.CalcLineSpace( BOX_LINE_LEFT );
+/*N*/ else if ( rAttrs.IsBorderDist() )
+/*?*/ nLeft -= rBox.GetDistance( BOX_LINE_LEFT ) + 1;
+/*N*/ if ( rBox.GetRight() )
+/*N*/ nAdd += rBox.CalcLineSpace( BOX_LINE_RIGHT );
+/*N*/ else if ( rAttrs.IsBorderDist() )
+/*?*/ nAdd += rBox.GetDistance( BOX_LINE_RIGHT ) + 1;
+/*N*/ if( rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE )
+/*N*/ {
+/*N*/ const SvxShadowItem &rShadow = rAttrs.GetShadow();
+/*N*/ nLeft -= rShadow.CalcShadowSpace( SHADOW_LEFT );
+/*N*/ nAdd += rShadow.CalcShadowSpace( SHADOW_RIGHT );
+/*N*/ }
+/*N*/ }
+/*N*/ if( IsTxtFrm() && ((SwTxtFrm*)this)->HasPara() )
+/*N*/ {
+/*N*/ long nTmp = ((SwTxtFrm*)this)->HangingMargin();
+/*N*/ if( nTmp > nAdd )
+/*?*/ nAdd = nTmp;
+/*N*/ }
+/*N*/ nWidth = nRight + nAdd - nLeft;
+/*N*/ SwRect aRet( Frm() );
+/*N*/ (aRet.*fnRect->fnSetPosX)( nLeft );
+/*N*/ (aRet.*fnRect->fnSetWidth)( nWidth );
+/*N*/ return aRet;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_tabfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_tabfrm.cxx
new file mode 100644
index 000000000000..14bcfba5ddc5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_tabfrm.cxx
@@ -0,0 +1,2812 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "pagefrm.hxx"
+#include "viewsh.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "viewimp.hxx"
+#include "swtable.hxx"
+#include "dflyobj.hxx"
+#include "frmtool.hxx"
+#include "frmfmt.hxx"
+#include "dcontact.hxx"
+#include "hints.hxx"
+#include "dbg_lay.hxx"
+
+#include <ftnidx.hxx>
+
+#include <bf_svtools/itemiter.hxx>
+
+#include <docary.hxx>
+#include <bf_svx/keepitem.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <vcl/outdev.hxx>
+
+#include <fmtlsplt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtornt.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtfsize.hxx>
+#include "tabfrm.hxx"
+#include "rowfrm.hxx"
+#include "cellfrm.hxx"
+#include "flyfrms.hxx"
+#include "txtfrm.hxx" //HasFtn()
+#include "htmltbl.hxx"
+#include "frmsh.hxx"
+#include "sectfrm.hxx" //SwSectionFrm
+namespace binfilter {
+
+/*N*/ extern void AppendObjs( const SwSpzFrmFmts *pTbl, ULONG nIndex,
+/*N*/ SwFrm *pFrm, SwPageFrm *pPage );
+
+/*************************************************************************
+|*
+|* SwTabFrm::SwTabFrm(), ~SwTabFrm()
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 30. May. 96
+|*
+|*************************************************************************/
+/*N*/ SwTabFrm::SwTabFrm( SwTable &rTab ):
+/*N*/ SwLayoutFrm( rTab.GetFrmFmt() ),
+/*N*/ SwFlowFrm( (SwFrm&)*this ),
+/*N*/ pTable( &rTab )
+/*N*/ {
+/*N*/ bComplete = bCalcLowers = bONECalcLowers = bLowersFormatted = bLockBackMove =
+/*N*/ bResizeHTMLTable = FALSE;
+/*N*/ BFIXHEIGHT = FALSE; //Nicht nochmal auf die Importfilter hereinfallen.
+/*N*/ nType = FRMC_TAB;
+/*N*/
+/*N*/ //Gleich die Zeilen erzeugen und einfuegen.
+/*N*/ const SwTableLines &rLines = rTab.GetTabLines();
+/*N*/ SwFrm *pPrev = 0;
+/*N*/ for ( USHORT i = 0; i < rLines.Count(); ++i )
+/*N*/ {
+/*N*/ SwRowFrm *pNew = new SwRowFrm( *rLines[i] );
+/*N*/ if( pNew->Lower() )
+/*N*/ {
+/*N*/ pNew->InsertBehind( this, pPrev );
+/*N*/ pPrev = pNew;
+/*N*/ }
+/*N*/ else
+/*?*/ delete pNew;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwTabFrm::SwTabFrm( SwTabFrm &rTab ) :
+/*N*/ SwLayoutFrm( rTab.GetFmt() ),
+/*N*/ SwFlowFrm( (SwFrm&)*this ),
+/*N*/ pTable( rTab.GetTable() )
+/*N*/ {
+/*N*/ bIsFollow = TRUE;
+/*N*/ bLockJoin = bComplete = bONECalcLowers = bCalcLowers = bLowersFormatted = bLockBackMove =
+/*N*/ bResizeHTMLTable = FALSE;
+/*N*/ BFIXHEIGHT = FALSE; //Nicht nochmal auf die Importfilter hereinfallen.
+/*N*/ nType = FRMC_TAB;
+/*N*/
+/*N*/ SetFollow( rTab.GetFollow() );
+/*N*/ rTab.SetFollow( this );
+/*N*/ }
+
+/*N*/ SwTabFrm::~SwTabFrm()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::JoinAndDelFollows()
+|*
+|* Ersterstellung MA 30. May. 96
+|* Letzte Aenderung MA 30. May. 96
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwTabFrm::RegistFlys()
+|*
+|* Ersterstellung MA 08. Jul. 93
+|* Letzte Aenderung MA 27. Jan. 99
+|*
+|*************************************************************************/
+/*N*/ void SwTabFrm::RegistFlys()
+/*N*/ {
+/*N*/ ASSERT( Lower() && Lower()->IsRowFrm(), "Keine Zeilen." );
+/*N*/
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( pPage )
+/*N*/ {
+/*N*/ SwRowFrm *pRow = (SwRowFrm*)Lower();
+/*N*/ do
+/*N*/ { pRow->RegistFlys( pPage );
+/*N*/ pRow = (SwRowFrm*)pRow->GetNext();
+/*N*/ } while ( pRow );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::Split(), Join()
+|*
+|* Ersterstellung MA 03. Jun. 93
+|* Letzte Aenderung MA 03. Sep. 96
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwTabFrm::Split( const SwTwips nCutPos )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ ASSERT( bVert ? nCutPos >= Frm().Left()
+/*N*/ && nCutPos <= Frm().Left() + Frm().Width() :
+/*N*/ nCutPos >= Frm().Top() && nCutPos <= Frm().Bottom(),
+/*N*/ "SplitLine out of table." );
+/*N*/
+/*N*/ //Um die Positionen der Zellen mit der CutPos zu vergleichen muessen sie
+/*N*/ //ausgehend von der Tabelle nacheinander berechnet werden. Sie koennen
+/*N*/ //wg. Positionsaenderungen der Tabelle durchaus ungueltig sein.
+/*N*/
+/*N*/ SwFrm *pRow = Lower();
+/*N*/ if( !pRow )
+/*?*/ return 0;
+/*N*/ SwTwips nCut = (*fnRect->fnYDiff)( nCutPos, (Frm().*fnRect->fnGetTop)() );
+/*N*/ nCut -= (this->*fnRect->fnGetTopMargin)();
+/*N*/ SwTwips nRowPos = (pRow->Frm().*fnRect->fnGetHeight)();
+/*N*/ const BOOL bRepeat = GetTable()->IsHeadlineRepeat();
+/*N*/ pRow = pRow->GetNext();
+/*N*/ if( pRow && bRepeat )
+/*N*/ {
+/*N*/ nRowPos += (pRow->Frm().*fnRect->fnGetHeight)();
+/*N*/ pRow = pRow->GetNext();
+/*N*/ }
+/*N*/ // No break before the first row and, in case of repeated headlines,
+/*N*/ // before the the second row.
+/*N*/ if( !pRow )
+/*?*/ return 0;
+/*N*/
+/*N*/ while( pRow && nCut >= ( nRowPos + (pRow->Frm().*fnRect->fnGetHeight)() ) )
+/*N*/ {
+/*N*/ nRowPos += (pRow->Frm().*fnRect->fnGetHeight)();
+/*N*/ pRow = pRow->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if ( !pRow )
+/*N*/ {
+/*?*/ #if OSL_DEBUG_LEVEL > 1
+/*?*/ ASSERT( FALSE, "Tablesplit out of rows?" );
+/*?*/ #endif
+/*?*/ pRow = Lower();
+/*?*/ while ( pRow && pRow->GetNext() )
+/*?*/ pRow = pRow->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ //Wenn es bereits einen Follow gibt so geht's dort hinein andernfalls
+/*N*/ //muss eben einer erzeugt werden.
+/*N*/ FASTBOOL bNewFollow;
+/*N*/ SwTabFrm *pFoll;
+/*N*/ if ( GetFollow() )
+/*N*/ {
+/*N*/ pFoll = GetFollow();
+/*N*/ bNewFollow = FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bNewFollow = TRUE;
+/*N*/ pFoll = new SwTabFrm( *this );
+/*N*/ pFoll->InsertBehind( GetUpper(), this );
+/*N*/
+/*N*/ if( bRepeat )
+/*N*/ { //Ueberschrift wiederholen.
+/*N*/ ASSERT( GetTable()->GetTabLines()[0], "Table ohne Zeilen?" );
+/*N*/ bDontCreateObjects = TRUE; //frmtool
+/*N*/ SwRowFrm *pHeadline = new SwRowFrm(
+/*N*/ *GetTable()->GetTabLines()[0] );
+/*N*/ bDontCreateObjects = FALSE;
+/*N*/ pHeadline->InsertBefore( pFoll, 0 );
+/*N*/
+/*N*/ SwPageFrm *pPage = pHeadline->FindPageFrm();
+/*N*/ const SwSpzFrmFmts *pTbl = GetFmt()->GetDoc()->GetSpzFrmFmts();
+/*N*/ if( pTbl->Count() )
+/*N*/ {
+/*N*/ ULONG nIndex;
+/*N*/ SwCntntFrm* pFrm = pHeadline->ContainsCntnt();
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ nIndex = pFrm->GetNode()->GetIndex();
+/*N*/ AppendObjs( pTbl, nIndex, pFrm, pPage );
+/*N*/ pFrm = pFrm->GetNextCntntFrm();
+/*N*/ if( !pHeadline->IsAnLower( pFrm ) )
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ SwTwips nRet = 0;
+/*N*/ SwFrm *pNxt;
+/*N*/
+/*N*/ //Optimierung beim neuen Follow braucht's kein Paste und dann kann
+/*N*/ //das Optimierte Insert verwendet werden (nur dann treten gluecklicher weise
+/*N*/ //auch groessere Mengen von Rows auf).
+/*N*/ if ( bNewFollow )
+/*N*/ {
+/*N*/ SwFrm *pPrv = GetTable()->IsHeadlineRepeat() ? pFoll->Lower() : 0;
+/*N*/ while ( pRow )
+/*N*/ {
+/*N*/ pNxt = pRow->GetNext();
+/*N*/ nRet += (pRow->Frm().*fnRect->fnGetHeight)();
+/*N*/ pRow->Remove();
+/*N*/ pRow->InsertBehind( pFoll, pPrv );
+/*N*/ pRow->_InvalidateAll();
+/*N*/ pPrv = pRow;
+/*N*/ pRow = pNxt;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwFrm *pPrv = pFoll->Lower();
+/*N*/ if ( pPrv && GetTable()->IsHeadlineRepeat() )
+/*N*/ pPrv = pPrv->GetNext();
+/*N*/ while ( pRow )
+/*N*/ {
+/*N*/ pNxt = pRow->GetNext();
+/*N*/ nRet += (pRow->Frm().*fnRect->fnGetHeight)();
+/*N*/ pRow->Remove();
+/*N*/ pRow->Paste( pFoll, pPrv );
+/*N*/ pRow->CheckDirChange();
+/*N*/ pRow = pNxt;
+/*N*/ }
+/*N*/ }
+/*N*/ ASSERT( !bNewFollow || !(pFoll->Frm().*fnRect->fnGetHeight)(),
+/*N*/ "Dont care about Performance");
+/*N*/ Shrink( nRet );
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ SwTwips SwTabFrm::Join()
+/*N*/ {
+/*N*/ SwTabFrm *pFoll = GetFollow();
+/*N*/ SwTwips nHeight = 0; //Gesamthoehe der eingefuegten Zeilen als Return.
+/*N*/
+/*N*/ if ( !pFoll->IsJoinLocked() )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ pFoll->Cut(); //Erst ausschneiden um unuetze Benachrichtigungen zu
+/*N*/ //minimieren.
+/*N*/
+/*N*/ SwFrm *pRow = pFoll->Lower(),
+/*N*/ *pNxt;
+/*N*/
+/*N*/ if ( pRow && GetTable()->IsHeadlineRepeat() )
+/*N*/ pRow = pRow->GetNext();
+/*N*/
+/*N*/ SwFrm *pPrv = Lower();
+/*N*/ while ( pPrv && pPrv->GetNext() )
+/*N*/ pPrv = pPrv->GetNext();
+/*N*/ while ( pRow )
+/*N*/ {
+/*N*/ pNxt = pRow->GetNext();
+/*N*/ nHeight += (pRow->Frm().*fnRect->fnGetHeight)();
+/*N*/ pRow->Remove();
+/*N*/ pRow->_InvalidateAll();
+/*N*/ pRow->InsertBehind( this, pPrv );
+/*N*/ pRow->CheckDirChange();
+/*N*/ pPrv = pRow;
+/*N*/ pRow = pNxt;
+/*N*/ }
+/*N*/ SetFollow( pFoll->GetFollow() );
+/*N*/ delete pFoll;
+/*N*/ Grow( nHeight PHEIGHT );
+/*N*/ }
+/*N*/ return nHeight;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::MakeAll()
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 10. Apr. 97
+|*
+|*************************************************************************/
+/*N*/ void MA_FASTCALL SwInvalidatePositions( SwFrm *pFrm, long nBottom )
+/*N*/ {
+ // LONG_MAX == nBottom means we have to calculate all
+/*N*/ BOOL bAll = LONG_MAX == nBottom;
+/*N*/ SWRECTFN( pFrm )
+/*N*/ do
+/*N*/ { pFrm->_InvalidatePos();
+/*N*/ pFrm->_InvalidateSize();
+/*N*/ if( pFrm->IsLayoutFrm() )
+/*N*/ {
+/*N*/ if ( ((SwLayoutFrm*)pFrm)->Lower() )
+/*N*/ ::binfilter::SwInvalidatePositions( ((SwLayoutFrm*)pFrm)->Lower(), nBottom);
+/*N*/ }
+/*N*/ else
+/*N*/ pFrm->Prepare( PREP_ADJUST_FRM );
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ } while ( pFrm &&
+/*N*/ ( bAll ||
+/*N*/ (*fnRect->fnYDiff)( (pFrm->Frm().*fnRect->fnGetTop)(), nBottom ) < 0 ) );
+/*N*/ }
+
+/*N*/ BOOL MA_FASTCALL lcl_CalcLowers( SwLayoutFrm *pLay, long nBottom )
+/*N*/ {
+/*N*/ // LONG_MAX == nBottom means we have to calculate all
+/*N*/ BOOL bAll = LONG_MAX == nBottom;
+/*N*/ BOOL bRet = FALSE;
+/*N*/ SwCntntFrm *pCnt = pLay->ContainsCntnt();
+/*N*/ SWRECTFN( pLay )
+/*N*/ while ( pCnt && pLay->GetUpper()->IsAnLower( pCnt ) )
+/*N*/ {
+/*N*/ bRet |= !pCnt->IsValid();
+/*N*/ pCnt->CalcFlys( FALSE );
+/*N*/ pCnt->Calc();
+/*N*/ pCnt->GetUpper()->Calc();
+/*N*/ if( ! bAll && (*fnRect->fnYDiff)((pCnt->Frm().*fnRect->fnGetTop)(), nBottom) > 0 )
+/*N*/ break;
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ BOOL MA_FASTCALL lcl_InnerCalcLayout( SwFrm *pFrm, long nBottom )
+/*N*/ {
+/*N*/ // LONG_MAX == nBottom means we have to calculate all
+/*N*/ BOOL bAll = LONG_MAX == nBottom;
+/*N*/ BOOL bRet = FALSE;
+/*N*/ const SwFrm* pOldUp = pFrm->GetUpper();
+/*N*/ SWRECTFN( pFrm )
+/*N*/ do
+/*N*/ {
+/*N*/ if( pFrm->IsLayoutFrm() )
+/*N*/ {
+/*N*/ bRet |= !pFrm->IsValid();
+/*N*/ pFrm->Calc();
+/*N*/ if( ((SwLayoutFrm*)pFrm)->Lower() )
+/*N*/ bRet |= lcl_InnerCalcLayout( ((SwLayoutFrm*)pFrm)->Lower(), nBottom);
+/*N*/ }
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ } while( pFrm &&
+/*N*/ ( bAll ||
+/*N*/ (*fnRect->fnYDiff)((pFrm->Frm().*fnRect->fnGetTop)(), nBottom) < 0 )
+/*N*/ && pFrm->GetUpper() == pOldUp );
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_CalcLayout( SwLayoutFrm *pLay, long nBottom )
+/*N*/ {
+/*N*/ BOOL bCheck = TRUE;
+/*N*/ do
+/*N*/ {
+/*N*/ while( lcl_InnerCalcLayout( pLay, nBottom ) )
+/*N*/ bCheck = TRUE;
+/*N*/ if( bCheck )
+/*N*/ {
+/*N*/ bCheck = FALSE;
+/*N*/ if( lcl_CalcLowers( pLay, nBottom ) )
+/*N*/ continue;
+/*N*/ }
+/*N*/ break;
+/*N*/ } while( TRUE );
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_FirstTabCalc( SwTabFrm *pTab )
+/*N*/ {
+/*N*/ SWRECTFN( pTab )
+/*N*/ if ( !pTab->IsFollow() && !pTab->GetTable()->IsTblComplex() )
+/*N*/ {
+/*N*/ SwLayoutFrm *pRow = (SwLayoutFrm*)pTab->Lower();
+/*N*/ do
+/*N*/ {
+/*N*/ SwLayoutFrm *pCell = (SwLayoutFrm*)pRow->Lower();
+/*N*/ SwFrm *pCnt = pCell->Lower();
+/*N*/ pCnt->Calc();
+/*N*/ const long nCellHeight = (pCell->Frm().*fnRect->fnGetHeight)();
+/*N*/ const long nCellY = (pCell->Frm().*fnRect->fnGetTop)()-1;
+/*N*/ const long nCntHeight = (pCnt->Frm().*fnRect->fnGetHeight)();
+/*N*/ const long nCntY = (pCnt->Frm().*fnRect->fnGetTop)()-1;
+/*N*/ if ( 0 != (pCell = (SwLayoutFrm*)pCell->GetNext()) )
+/*N*/ do
+/*N*/ { (pCell->Frm().*fnRect->fnSetTopAndHeight)
+/*N*/ ( nCellY, nCellHeight );
+/*N*/ (pCell->Prt().*fnRect->fnSetHeight)( nCellHeight );
+/*N*/ pCell->_InvalidateAll();
+/*N*/
+/*N*/ pCnt = pCell->Lower();
+/*N*/ (pCnt->Frm().*fnRect->fnSetTopAndHeight)(nCntY, nCntHeight);
+/*N*/ (pCnt->Prt().*fnRect->fnSetHeight)( nCntHeight );
+/*N*/ pCnt->_InvalidateAll();
+/*N*/
+/*N*/ pCell = (SwLayoutFrm*)pCell->GetNext();
+/*N*/ } while ( pCell );
+/*N*/
+/*N*/ SwTwips nRowTop = (pRow->Frm().*fnRect->fnGetTop)();
+/*N*/ SwTwips nUpBot = (pTab->GetUpper()->Frm().*fnRect->fnGetBottom)();
+/*N*/ if( (*fnRect->fnYDiff)( nUpBot, nRowTop ) < 0 )
+/*N*/ break;
+/*N*/ pRow = (SwLayoutFrm*)pRow->GetNext();
+/*N*/
+/*N*/ } while ( pRow );
+/*N*/ }
+/*N*/ SwFrm *pUp = pTab->GetUpper();
+/*N*/ long nBottom = (pUp->*fnRect->fnGetPrtBottom)();
+/*N*/ if ( pTab->GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ nBottom += pUp->Grow( LONG_MAX, TRUE );
+/*N*/ lcl_CalcLowers( (SwLayoutFrm*)pTab->Lower(), nBottom );
+/*N*/ }
+
+/*N*/ void MA_FASTCALL lcl_Recalc( SwTabFrm *pTab,
+/*N*/ SwLayoutFrm *pFirstRow,
+/*N*/ SwLayNotify &rNotify )
+/*N*/ {
+/*N*/ if ( pTab->Lower() )
+/*N*/ {
+/*N*/ SWRECTFN( pTab )
+/*N*/ const SwTwips nOldHeight = (pTab->Frm().*fnRect->fnGetHeight)();
+/*N*/ const SwTwips nOldWidth = (pTab->Frm().*fnRect->fnGetWidth)();
+/*N*/ if ( !pFirstRow )
+/*N*/ {
+/*N*/ pFirstRow = (SwLayoutFrm*)pTab->Lower();
+/*N*/ rNotify.SetLowersComplete( TRUE );
+/*N*/ }
+/*N*/ ::binfilter::SwInvalidatePositions( pFirstRow, LONG_MAX );
+/*N*/ ::binfilter::lcl_CalcLayout( pFirstRow, LONG_MAX );
+/*N*/ SwTwips nNew = (pTab->Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( nOldHeight < nNew )
+/*N*/ rNotify.AddHeightOfst( nNew - nOldHeight );
+/*N*/ else if ( nOldHeight > nNew )
+/*?*/ rNotify.SubtractHeightOfst( nOldHeight - nNew );
+/*N*/ nNew = (pTab->Frm().*fnRect->fnGetWidth)();
+/*N*/ if ( nOldWidth < nNew )
+/*N*/ rNotify.AddWidthOfst( nNew - nOldWidth );
+/*N*/ else if ( nOldWidth > nNew )
+/*?*/ rNotify.SubtractWidthOfst( nOldWidth - nNew );
+/*N*/ }
+/*N*/ }
+
+/*N*/ #define KEEPTAB ( !GetFollow() && !IsFollow() )
+
+/*N*/ void SwTabFrm::MakeAll()
+/*N*/ {
+/*N*/ if ( IsJoinLocked() || StackHack::IsLocked() || StackHack::Count() > 50 )
+/*N*/ return;
+/*N*/
+/*N*/ PROTOCOL_ENTER( this, PROT_MAKEALL, 0, 0 )
+/*N*/
+/*N*/ LockJoin(); //Ich lass mich nicht unterwegs vernichten.
+/*N*/ SwLayNotify aNotify( this ); //uebernimmt im DTor die Benachrichtigung
+/*N*/ // If pos is invalid, we have to call a SetInvaKeep at aNotify.
+/*N*/ // Otherwise the keep atribute would not work in front of a table.
+/*N*/ const BOOL bOldValidPos = GetValidPosFlag();
+/*N*/
+/*N*/ //Wenn mein direkter Nachbar gleichzeitig mein Follow ist
+/*N*/ //verleibe ich mir das Teil ein.
+/*N*/ // OD 09.04.2003 #108698# - join all follows, which are placed on the
+/*N*/ // same page/column.
+/*N*/ // OD 29.04.2003 #109213# - join follow, only if join for the follow
+/*N*/ // is not locked. Otherwise, join will not be performed and this loop
+/*N*/ // will be endless.
+/*N*/ while ( GetNext() && GetNext() == GetFollow() &&
+/*N*/ !GetFollow()->IsJoinLocked()
+/*N*/ )
+/*N*/ {
+/*N*/ aNotify.AddHeightOfst( Join() );
+/*N*/ }
+/*N*/
+/*N*/ if ( bResizeHTMLTable ) //Optimiertes Zusammenspiel mit Grow/Shrink des Inhaltes
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ BOOL bMakePage = TRUE; //solange TRUE kann eine neue Seite
+/*N*/ //angelegt werden (genau einmal)
+/*N*/ BOOL bMovedBwd = FALSE; //Wird TRUE wenn der Frame zurueckfliesst
+/*N*/ BOOL bMovedFwd = FALSE; //solange FALSE kann der Frm zurueck-
+/*N*/ //fliessen (solange, bis er einmal
+/*N*/ //vorwaerts ge'moved wurde).
+/*N*/ BOOL bSplit = FALSE; //Wird TRUE wenn der Frm gesplittet wurde.
+/*N*/ BOOL bFtnsInDoc = 0 != GetFmt()->GetDoc()->GetFtnIdxs().Count();
+/*N*/ BOOL bMoveable;
+/*N*/ const BOOL bRepeat = GetTable()->IsHeadlineRepeat();
+/*N*/ const BOOL bFly = IsInFly();
+/*N*/
+/*N*/ SwBorderAttrAccess *pAccess= new SwBorderAttrAccess( SwFrm::GetCache(), this );
+/*N*/ const SwBorderAttrs *pAttrs = pAccess->Get();
+/*N*/
+/*N*/ const BOOL bKeep = IsKeep( *pAttrs );
+/*N*/ const BOOL bDontSplit = !IsFollow() && !GetFmt()->GetLayoutSplit().GetValue();
+/*N*/
+/*N*/ if ( bDontSplit )
+/*N*/ while ( GetFollow() )
+/*N*/ aNotify.AddHeightOfst( Join() );
+/*N*/
+/*N*/ //Einen Frischling moven wir gleich schon einmal vorwaerts...
+/*N*/ if ( !Frm().Top() && IsFollow() )
+/*N*/ {
+/*N*/ SwFrm *pPre = GetPrev();
+/*N*/ if ( pPre && pPre->IsTabFrm() && ((SwTabFrm*)pPre)->GetFollow() == this)
+/*N*/ {
+/*N*/ if ( !MoveFwd( bMakePage, FALSE ) )
+/*N*/ bMakePage = FALSE;
+/*N*/ bMovedFwd = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/
+/*N*/ while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ if ( TRUE == (bMoveable = IsMoveable()) )
+/*N*/ if ( CheckMoveFwd( bMakePage, bKeep && KEEPTAB, bMovedBwd ) )
+/*N*/ {
+/*N*/ bMovedFwd = TRUE;
+/*N*/ bCalcLowers = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ Point aOldPos( (Frm().*fnRect->fnGetPos)() );
+/*N*/ MakePos();
+/*N*/ if ( aOldPos != (Frm().*fnRect->fnGetPos)() )
+/*N*/ {
+/*N*/ if ( aOldPos.Y() != (Frm().*fnRect->fnGetTop)() )
+/*N*/ {
+/*N*/ SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout();
+/*N*/ if( pLayout )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ aNotify.SetLowersComplete( FALSE );
+/*N*/ }
+/*N*/ SwFrm *pPre;
+/*N*/ if ( bKeep || (0 != (pPre = FindPrev()) &&
+/*N*/ pPre->GetAttrSet()->GetKeep().GetValue()) )
+/*N*/ {
+/*N*/ bCalcLowers = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Wir muessen die Hoehe der ersten Zeile kennen, denn nur wenn diese
+/*N*/ //kleiner wird muss ggf. der Master angestossen werden um noetigenfalls
+/*N*/ //die Zeile aufzunehmen.
+/*N*/ long n1StLineHeight = 0;
+/*N*/ if ( IsFollow() )
+/*N*/ {
+/*N*/ SwFrm *pFrm = Lower();
+/*N*/ if ( bRepeat && pFrm )
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ if ( pFrm )
+/*N*/ n1StLineHeight = (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidSize || !bValidPrtArea )
+/*N*/ {
+/*N*/ const BOOL bOptLower = (Frm().*fnRect->fnGetHeight)() == 0;
+/*N*/
+/*N*/ const long nOldPrtWidth = (Prt().*fnRect->fnGetWidth)();
+/*N*/ const long nOldFrmWidth = (Frm().*fnRect->fnGetWidth)();
+/*N*/ const Point aOldPrtPos = (Prt().*fnRect->fnGetPos)();
+/*N*/ Format( pAttrs );
+/*N*/
+/*N*/ SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout();
+/*N*/ if ( /*!bOptLower &&*/ pLayout &&
+/*N*/ ((Prt().*fnRect->fnGetWidth)() != nOldPrtWidth ||
+/*N*/ (Frm().*fnRect->fnGetWidth)() != nOldFrmWidth) )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ if ( !bOptLower && aOldPrtPos != (Prt().*fnRect->fnGetPos)() )
+/*N*/ aNotify.SetLowersComplete( FALSE );
+/*N*/
+/*N*/ if ( bOptLower )
+/*N*/ {
+/*N*/ //MA 24. May. 95: Optimierungsversuch!
+/*N*/ //Ganz nigel nagel neu das Teil. Damit wir nicht n-fach
+/*N*/ //MakeAll'en formatieren wir flugs den Inhalt.
+/*N*/ //Das erste Format mussten wir allerdings abwarten, damit
+/*N*/ //die Breiten Stimmen!
+/*N*/ //MA: Fix, Kein Calc wenn evtl. noch Seitengebunde Flys
+/*N*/ //an den Cntnt haengen (siehe frmtool.cxx, ~SwCntntNotify).
+/*N*/ SwDoc *pDoc = GetFmt()->GetDoc();
+/*N*/ if ( !pDoc->GetSpzFrmFmts()->Count() ||
+/*N*/ pDoc->IsLoaded() || pDoc->IsNewDoc() )
+/*N*/ {
+/*N*/ //MA 28. Nov. 95: Und wieder ein Trick, gleich mal sehen
+/*N*/ //ob ein Rueckfluss lohnt.
+/*N*/ if ( bMoveable && !GetPrev() )
+/*N*/ {
+/*N*/ GetLeaf( MAKEPAGE_NONE, FALSE ); //setzt das BackMoveJump
+/*N*/ if ( SwFlowFrm::IsMoveBwdJump() )
+/*N*/ {
+/*N*/ BOOL bDummy;
+/*N*/ SwFtnBossFrm *pOldBoss = bFtnsInDoc ?
+/*N*/ FindFtnBossFrm( TRUE ) : 0;
+/*N*/ const FASTBOOL bOldPrev = GetPrev() != 0;
+/*N*/ if ( MoveBwd( bDummy ) )
+/*N*/ {
+/*N*/ SWREFRESHFN( this )
+/*N*/ bMovedBwd = TRUE;
+/*N*/ if ( bFtnsInDoc )
+/*N*/ MoveLowerFtns( 0, pOldBoss, 0, TRUE );
+/*N*/
+/*N*/ long nOldTop = (Frm().*fnRect->fnGetTop)();
+/*N*/ MakePos();
+/*N*/ if( nOldTop != (Frm().*fnRect->fnGetTop)() )
+/*N*/ {
+/*N*/ SwHTMLTableLayout *pLayout =
+/*N*/ GetTable()->GetHTMLTableLayout();
+/*N*/ if( pLayout )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bOldPrev != (0 != GetPrev()) )
+/*N*/ {
+/*N*/ //Abstand nicht vergessen!
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ Format( pAttrs );
+/*N*/ }
+/*N*/ if ( bKeep && KEEPTAB )
+/*N*/ {
+/*?*/ SwFrm *pNxt = FindNextCnt();
+/*?*/ // FindNextCnt geht ggf. in einen Bereich
+/*?*/ // hinein, in eine Tabelle allerdings auch
+/*?*/ if( pNxt && pNxt->IsInTab() )
+/*?*/ pNxt = pNxt->FindTabFrm();
+/*?*/ if ( pNxt )
+/*?*/ {
+/*?*/ pNxt->Calc();
+/*?*/ if ( !GetNext() )
+/*?*/ bValidPos = FALSE;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ ::binfilter::lcl_FirstTabCalc( this );
+/*N*/ bValidSize = bValidPrtArea = FALSE;
+/*N*/ Format( pAttrs );
+/*N*/ aNotify.SetLowersComplete( TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Wenn ich der erste einer Kette bin koennte ich mal sehen ob
+/*N*/ //ich zurueckfliessen kann (wenn ich mich ueberhaupt bewegen soll).
+/*N*/ //Damit es keine Oszillation gibt, darf ich nicht gerade vorwaerts
+/*N*/ //geflosssen sein.
+/*N*/ if ( !GetIndPrev() && !bMovedFwd && (bMoveable || bFly) )
+/*N*/ {
+/*N*/ //Bei Follows muss der Master benachrichtigt
+/*N*/ //werden. Der Follow muss nur dann Moven, wenn er leere Blaetter
+/*N*/ //ueberspringen muss.
+/*N*/ if ( IsFollow() )
+/*N*/ {
+/*N*/ //Nur wenn die Hoehe der ersten Zeile kleiner geworder ist.
+/*N*/ SwFrm *pFrm = Lower();
+/*N*/ if ( bRepeat && pFrm )
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ if(pFrm && n1StLineHeight >(pFrm->Frm().*fnRect->fnGetHeight)())
+/*N*/ {
+/*N*/ SwTabFrm *pMaster = (SwTabFrm*)FindMaster();
+/*N*/ BOOL bDummy;
+/*N*/ if ( ShouldBwdMoved( pMaster->GetUpper(), FALSE, bDummy ) )
+/*N*/ pMaster->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ SwFtnBossFrm *pOldBoss = bFtnsInDoc ? FindFtnBossFrm( TRUE ) : 0;
+/*N*/ BOOL bReformat;
+/*N*/ if ( MoveBwd( bReformat ) )
+/*N*/ {
+/*N*/ SWREFRESHFN( this )
+/*N*/ bMovedBwd = TRUE;
+/*N*/ aNotify.SetLowersComplete( FALSE );
+/*N*/ if ( bFtnsInDoc )
+/*N*/ MoveLowerFtns( 0, pOldBoss, 0, TRUE );
+/*N*/ if ( bReformat || bKeep )
+/*N*/ {
+/*N*/ long nOldTop = (Frm().*fnRect->fnGetTop)();
+/*N*/ MakePos();
+/*N*/ if( nOldTop != (Frm().*fnRect->fnGetTop)() )
+/*N*/ {
+/*N*/ SwHTMLTableLayout *pLayout =
+/*N*/ GetTable()->GetHTMLTableLayout();
+/*N*/ if( pLayout )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ Format( pAttrs );
+/*N*/ }
+/*N*/ ::binfilter::lcl_Recalc( this, 0, aNotify );
+/*N*/ bLowersFormatted = TRUE;
+/*N*/ if ( bKeep && KEEPTAB )
+/*N*/ {
+/*N*/ SwFrm *pNxt = FindNextCnt();
+/*N*/ if( pNxt && pNxt->IsInTab() )
+/*N*/ pNxt = pNxt->FindTabFrm();
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ pNxt->Calc();
+/*N*/ if ( !GetNext() )
+/*N*/ bValidPos = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Wieder ein Wert ungueltig? - dann nochmal das ganze...
+/*N*/ if ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/ continue;
+/*N*/
+/*N*/ // check, if calculation of table frame is ready.
+/*N*/
+/*N*/ /// OD 23.10.2002 #103517# - Local variable <nDistanceToUpperPrtBottom>
+/*N*/ /// Introduce local variable and init it with the distance from the
+/*N*/ /// table frame bottom to the bottom of the upper printing area.
+/*N*/ /// Note: negative values denotes the situation that table frame doesn't
+/*N*/ /// fit in its upper.
+/*N*/ SwTwips nDistanceToUpperPrtBottom =
+/*N*/ (Frm().*fnRect->fnBottomDist)( (GetUpper()->*fnRect->fnGetPrtBottom)());
+/*N*/
+/*N*/ /// OD 23.10.2002 #103517# - In online layout try to grow upper of table
+/*N*/ /// frame, if table frame doesn't fit in its upper.
+/*N*/ if ( nDistanceToUpperPrtBottom < 0 &&
+/*N*/ GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ {
+/*N*/ if ( GetUpper()->Grow( -nDistanceToUpperPrtBottom ) )
+/*N*/ {
+/*N*/ // upper is grown --> recalculate <nDistanceToUpperPrtBottom>
+/*N*/ nDistanceToUpperPrtBottom =
+/*N*/ (Frm().*fnRect->fnBottomDist)( (GetUpper()->*fnRect->fnGetPrtBottom)());
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nDistanceToUpperPrtBottom >= 0)
+/*N*/ {
+/*N*/ // OD 23.10.2002 - translate german commentary
+/*N*/ // If there is space left in the upper printing area, join as for trial
+/*N*/ // at least one further row of an existing follow.
+/*N*/ if ( !bSplit && GetFollow() )
+/*N*/ {
+/*N*/ BOOL bDummy;
+/*N*/ if ( GetFollow()->ShouldBwdMoved( GetUpper(), FALSE, bDummy ) )
+/*N*/ {
+/*N*/ SwFrm *pTmp = GetUpper();
+/*N*/ SwTwips nDeadLine = (pTmp->*fnRect->fnGetPrtBottom)();
+/*N*/ if ( GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ nDeadLine += pTmp->Grow( LONG_MAX, TRUE );
+/*N*/ if( (Frm().*fnRect->fnBottomDist)( nDeadLine ) > 0 )
+/*N*/ {
+/*N*/ SwFrm *pRow = GetFollow()->Lower();
+/*N*/ if ( bRepeat )
+/*N*/ pRow = pRow->GetNext();
+/*N*/ const SwTwips nOld = (Frm().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ const BOOL bMoveFtns = bFtnsInDoc && pRow &&
+/*N*/ !GetFollow()->IsJoinLocked();
+/*N*/
+/*N*/ SwFtnBossFrm *pOldBoss;
+/*N*/ if ( bMoveFtns )
+/*N*/ pOldBoss = pRow->FindFtnBossFrm( TRUE );
+/*N*/
+/*N*/ //fix(8680): Row kann 0 werden.
+/*N*/ if ( !pRow || !pRow->GetNext() )
+/*N*/ //Der Follow wird leer und damit ueberfluessig.
+/*N*/ aNotify.AddHeightOfst( Join() );
+/*N*/ else
+/*N*/ {
+/*N*/ pRow->Cut();
+/*N*/ pRow->Paste( this );
+/*N*/ aNotify.AddHeightOfst(
+/*N*/ (pRow->Frm().*fnRect->fnGetHeight)() );
+/*N*/ }
+/*N*/ //Die Fussnoten verschieben!
+/*N*/ if ( pRow && bMoveFtns )
+/*N*/ if ( ((SwLayoutFrm*)pRow)->MoveLowerFtns(
+/*N*/ 0, pOldBoss, FindFtnBossFrm( TRUE ), TRUE ) )
+/*N*/ GetUpper()->Calc();
+/*N*/
+/*N*/ if ( pRow && nOld != (Frm().*fnRect->fnGetHeight)() )
+/*N*/ ::binfilter::lcl_Recalc( this, (SwLayoutFrm*)pRow, aNotify );
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( bKeep && KEEPTAB )
+/*N*/ {
+/*N*/ SwFrm *pNxt = FindNextCnt();
+/*N*/ if( pNxt && pNxt->IsInTab() )
+/*N*/ pNxt = pNxt->FindTabFrm();
+/*N*/ if ( pNxt )
+/*N*/ pNxt->Calc();
+/*N*/ }
+/*N*/ if ( IsValid() )
+/*N*/ {
+/*N*/ if ( bCalcLowers )
+/*N*/ {
+/*N*/ ::binfilter::lcl_Recalc( this, 0, aNotify );
+/*N*/ bLowersFormatted = TRUE;
+/*N*/ bCalcLowers = FALSE;
+/*N*/ }
+/*N*/ else if ( bONECalcLowers )
+/*N*/ {
+/*N*/ lcl_CalcLayout( (SwLayoutFrm*)Lower(), LONG_MAX );
+/*N*/ bONECalcLowers = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ //Ich passe nicht mehr in meinen Uebergeordneten, also ist es jetzt
+/*N*/ //an der Zeit moeglichst konstruktive Veranderungen vorzunehmen
+/*N*/
+/*N*/ //Wenn ich den uebergeordneten Frm nicht verlassen darf, habe
+/*N*/ //ich ein Problem; Frei nach Artur Dent tun wir das einzige das man
+/*N*/ //mit einen nicht loesbaren Problem tun kann: wir ignorieren es - und
+/*N*/ //zwar mit aller Kraft.
+/*N*/ if ( !bMoveable )
+/*N*/ {
+/*N*/ if ( bCalcLowers && IsValid() )
+/*N*/ {
+/*N*/ lcl_Recalc( this, 0, aNotify );
+/*N*/ bLowersFormatted = TRUE;
+/*N*/ bCalcLowers = FALSE;
+/*N*/ }
+/*N*/ else if ( bONECalcLowers )
+/*N*/ {
+/*N*/ lcl_CalcLayout( (SwLayoutFrm*)Lower(), LONG_MAX );
+/*N*/ bONECalcLowers = FALSE;
+/*N*/ }
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ if ( bCalcLowers && IsValid() )
+/*N*/ {
+/*N*/ ::binfilter::lcl_Recalc( this, 0, aNotify );
+/*N*/ bLowersFormatted = TRUE;
+/*N*/ bCalcLowers = FALSE;
+/*N*/ if( !IsValid() )
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ //Der erste Versuch muss natuerlich das Aufspalten der Tabelle sein.
+/*N*/ //Das funktioniert natuerlich nur dann, wenn die Tabelle mehr als eine
+/*N*/ //Zeile enthaelt und wenn die Unterkante des Upper unter der ersten
+/*N*/ //Zeile liegt.
+/*N*/ SwFrm *pIndPrev = GetIndPrev();
+/*N*/ if ( Lower()->GetNext() && (!bDontSplit || !pIndPrev) )
+/*N*/ {
+/*N*/ //Damit der Schatten nicht extra herausgerechnet werden muss,
+/*N*/ //lassen wir das Spiel gleich wenn es ein HeadlineRepeat gibt und
+/*N*/ //nur noch eine nicht Headline Zeile vorhanden ist.
+/*N*/ if ( !bRepeat || Lower()->GetNext()->GetNext() )
+/*N*/ {
+/*N*/ SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*N*/ if( IsInSct() )
+/*N*/ nDeadLine = (*fnRect->fnYInc)( nDeadLine,
+/*N*/ GetUpper()->Grow( LONG_MAX, TRUE ) );
+/*N*/ ::binfilter::lcl_CalcLayout( (SwLayoutFrm*)Lower(), nDeadLine );
+/*N*/ bLowersFormatted = TRUE;
+/*N*/ aNotify.SetLowersComplete( TRUE );
+/*N*/ if( (Frm().*fnRect->fnBottomDist)( nDeadLine ) > 0 )
+/*N*/ continue;
+/*N*/
+/*N*/ SwTwips nBreakLine = (Frm().*fnRect->fnGetTop)();
+/*N*/ nBreakLine = (*fnRect->fnYInc)( nBreakLine,
+/*N*/ (this->*fnRect->fnGetTopMargin)() +
+/*N*/ (Lower()->Frm().*fnRect->fnGetHeight)() +
+/*N*/ ( bRepeat ?
+/*N*/ (Lower()->GetNext()->Frm().*fnRect->fnGetHeight)()
+/*N*/ : 0 ) );
+/*N*/ if( (*fnRect->fnYDiff)(nDeadLine, nBreakLine) >=0 || !pIndPrev )
+/*N*/ {
+/*N*/ aNotify.SubtractHeightOfst( Split( nDeadLine ) );
+/*N*/ if ( aNotify.GetHeightOfst() < 0 )
+/*N*/ aNotify.ResetHeightOfst();
+/*N*/ aNotify.SetLowersComplete( FALSE );
+/*N*/ bSplit = TRUE;
+/*N*/ //Damit es nicht zu Oszillationen kommt, muss der
+/*N*/ //Follow gleich gueltig gemacht werden.
+/*N*/ if ( GetFollow() )
+/*N*/ {
+/*N*/ SWRECTFN( GetFollow() )
+/*N*/
+/*N*/ static BYTE nStack = 0;
+/*N*/ if ( !StackHack::IsLocked() && nStack < 4 )
+/*N*/ {
+/*N*/ ++nStack;
+/*N*/ StackHack aHack;
+/*N*/ delete pAccess;
+/*N*/ GetFollow()->MakeAll();
+/*N*/ pAccess= new SwBorderAttrAccess( SwFrm::GetCache(),
+/*N*/ this );
+/*N*/ pAttrs = pAccess->Get();
+/*N*/ ((SwTabFrm*)GetFollow())->SetLowersFormatted(FALSE);
+/*N*/ ::binfilter::lcl_CalcLayout((SwLayoutFrm*)GetFollow()->Lower(),
+/*N*/ (GetFollow()->GetUpper()->Frm().*fnRect->fnGetBottom)() );
+/*N*/ if ( !GetFollow()->GetFollow() )
+/*N*/ {
+/*N*/ SwFrm *pNxt = ((SwFrm*)GetFollow())->FindNext();
+/*N*/ if ( pNxt )
+/*N*/ pNxt->Calc();
+/*N*/ }
+/*N*/ --nStack;
+/*N*/ }
+/*N*/ else if ( GetFollow() == GetNext() )
+/*N*/ ((SwTabFrm*)GetFollow())->MoveFwd( TRUE, FALSE );
+/*N*/ ViewShell *pSh;
+/*N*/ if ( 0 != (pSh = GetShell()) )
+/*N*/ pSh->Imp()->ResetScroll();
+/*N*/ }
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( IsInSct() && bMovedFwd && bMakePage && GetUpper()->IsColBodyFrm() &&
+/*N*/ GetUpper()->GetUpper()->GetUpper()->IsSctFrm() &&
+/*N*/ ( GetUpper()->GetUpper()->GetPrev() || GetIndPrev() ) &&
+/*N*/ ((SwSectionFrm*)GetUpper()->GetUpper()->GetUpper())->MoveAllowed(this) )
+/*N*/ bMovedFwd = FALSE;
+/*N*/
+/*N*/ //Mal sehen ob ich irgenwo Platz finde...
+/*N*/ if ( !bMovedFwd && !MoveFwd( bMakePage, FALSE ) )
+/*N*/ bMakePage = FALSE;
+/*N*/ SWREFRESHFN( this )
+/*N*/ bMovedFwd = bCalcLowers = TRUE;
+/*N*/ aNotify.SetLowersComplete( FALSE );
+/*N*/ if ( IsFollow() )
+/*N*/ { //Um Oszillationen zu vermeiden sollte kein ungueltiger Master
+/*N*/ //zurueckbleiben.
+/*N*/ SwTabFrm *pTab = FindMaster();
+/*N*/ if ( pTab->GetUpper() )
+/*N*/ pTab->GetUpper()->Calc();
+/*N*/ pTab->Calc();
+/*N*/ pTab->SetLowersFormatted( FALSE );
+/*N*/ }
+/*N*/
+/*N*/ //Wenn mein direkter Nachbar jetzt gleichzeitig mein Follow ist
+/*N*/ //verleibe ich mir das Teil ein.
+/*N*/ if ( GetNext() && GetNext() == GetFollow() )
+/*N*/ aNotify.AddHeightOfst( Join() );
+/*N*/
+/*N*/ if ( bMovedBwd && GetUpper() )
+/*N*/ //Beim zurueckfliessen wurde der Upper angeregt sich vollstaendig
+/*N*/ //zu Painten, dass koennen wir uns jetzt nach dem hin und her
+/*N*/ //fliessen sparen.
+/*N*/ GetUpper()->ResetCompletePaint();
+/*N*/
+/*N*/ if ( bCalcLowers && IsValid() )
+/*N*/ {
+/*N*/ ::binfilter::lcl_Recalc( this, 0, aNotify );
+/*N*/ bLowersFormatted = TRUE;
+/*N*/ bCalcLowers = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ } //while ( !bValidPos || !bValidSize || !bValidPrtArea )
+/*N*/
+/*N*/ //Wenn mein direkter Vorgaenger jetzt mein Master ist, so kann er mich
+/*N*/ //bei der nachstbesten Gelegenheit vernichten.
+/*N*/ if ( IsFollow() )
+/*N*/ {
+/*N*/ SwFrm *pPre = GetPrev();
+/*N*/ if ( pPre && pPre->IsTabFrm() && ((SwTabFrm*)pPre)->GetFollow() == this)
+/*N*/ pPre->InvalidatePos();
+/*N*/ }
+/*N*/
+/*N*/ bCalcLowers = bONECalcLowers = FALSE;
+/*N*/ delete pAccess;
+/*N*/ UnlockJoin();
+/*N*/ if ( bMovedFwd || bMovedBwd || ! bOldValidPos )
+/*N*/ aNotify.SetInvaKeep();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::CalcFlyOffsets()
+|*
+|* Beschreibung: Berechnet die Offsets, die durch FlyFrames
+|* entstehen.
+|* Ersterstellung MA/MIB 14. Apr. 99
+|* Letzte Aenderung
+|*
+|*************************************************************************/
+/*N*/ BOOL SwTabFrm::CalcFlyOffsets( SwTwips& rUpper,
+/*N*/ long& rLeftOffset,
+/*N*/ long& rRightOffset ) const
+/*N*/ {
+/*N*/ BOOL bInvalidatePrtArea = FALSE;
+/*N*/ const SwPageFrm *pPage = FindPageFrm();
+/*N*/ const SwFlyFrm* pMyFly = FindFlyFrm();
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ long nPrtPos = (Frm().*fnRect->fnGetTop)();
+/*N*/ nPrtPos = (*fnRect->fnYInc)( nPrtPos, rUpper );
+/*N*/ SwRect aRect( Frm() );
+/*N*/ long nYDiff = (*fnRect->fnYDiff)( (Prt().*fnRect->fnGetTop)(), rUpper );
+/*N*/ if( nYDiff > 0 )
+/*N*/ (aRect.*fnRect->fnAddBottom)( -nYDiff );
+/*N*/ for ( USHORT i = 0; i < pPage->GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pPage->GetSortedObjs())[i];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ const SwRect aFlyRect = pFly->AddSpacesToFrm();
+/*N*/ if ( WEIT_WECH != (pFly->Frm().*fnRect->fnGetTop)() &&
+/*N*/ pFly->IsFlyAtCntFrm() && aFlyRect.IsOver( aRect ) &&
+ // OD 25.02.2003 #i9040# - use '<=' instead of '<'
+/*N*/ (*fnRect->fnYDiff)(
+/*N*/ (pFly->GetAnchor()->Frm().*fnRect->fnGetBottom)(),
+/*N*/ (Frm().*fnRect->fnGetTop)() ) <= 0 &&
+/*N*/ !IsAnLower( pFly ) && !pFly->IsAnLower( this ) &&
+/*N*/ ( !pMyFly || pMyFly->IsAnLower( pFly ) ) &&
+/*N*/ pPage->GetPhyPageNum() >=
+/*N*/ pFly->GetAnchor()->FindPageFrm()->GetPhyPageNum() &&
+/*N*/ // anchor should be in same page body/header/footer
+/*N*/ ( pFly->GetAnchor()->FindFooterOrHeader() ==
+/*N*/ FindFooterOrHeader() ) )
+/*N*/ {
+/*N*/ const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
+/*N*/ const SwFmtHoriOrient &rHori= pFly->GetFmt()->GetHoriOrient();
+/*N*/ if ( SURROUND_NONE == rSur.GetSurround() )
+/*N*/ {
+/*?*/ long nBottom = (aFlyRect.*fnRect->fnGetBottom)();
+/*?*/ if( (*fnRect->fnYDiff)( nPrtPos, nBottom ) < 0 )
+/*?*/ nPrtPos = nBottom;
+/*?*/ bInvalidatePrtArea = TRUE;
+/*N*/ }
+/*N*/ if ( (SURROUND_RIGHT == rSur.GetSurround() ||
+/*N*/ SURROUND_PARALLEL == rSur.GetSurround())&&
+/*N*/ HORI_LEFT == rHori.GetHoriOrient() )
+/*N*/ {
+/*N*/ const long nWidth = (*fnRect->fnXDiff)(
+/*N*/ (aFlyRect.*fnRect->fnGetRight)(),
+/*?*/ (pFly->GetAnchor()->Frm().*fnRect->fnGetLeft)() );
+/*?*/ rLeftOffset = Max( rLeftOffset, nWidth );
+/*?*/ bInvalidatePrtArea = TRUE;
+/*N*/ }
+/*N*/ if ( (SURROUND_LEFT == rSur.GetSurround() ||
+/*N*/ SURROUND_PARALLEL == rSur.GetSurround())&&
+/*N*/ HORI_RIGHT == rHori.GetHoriOrient() )
+/*N*/ {
+/*?*/ const long nWidth = (*fnRect->fnXDiff)(
+/*?*/ (pFly->GetAnchor()->Frm().*fnRect->fnGetRight)(),
+/*?*/ (aFlyRect.*fnRect->fnGetLeft)() );
+/*?*/ rRightOffset = Max( rRightOffset, nWidth );
+/*?*/ bInvalidatePrtArea = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ rUpper = (*fnRect->fnYDiff)( nPrtPos, (Frm().*fnRect->fnGetTop)() );
+/*N*/ }
+/*N*/
+/*N*/ return bInvalidatePrtArea;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::Format()
+|*
+|* Beschreibung: "Formatiert" den Frame; Frm und PrtArea
+|* Die Fixsize wird hier nicht eingestellt.
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 18. Jun. 97
+|*
+|*************************************************************************/
+/*M*/ void SwTabFrm::Format( const SwBorderAttrs *pAttrs )
+/*M*/ {
+/*M*/ ASSERT( pAttrs, "TabFrm::Format, pAttrs ist 0." );
+/*M*/
+/*M*/ SWRECTFN( this )
+/*M*/ if ( !bValidSize )
+/*M*/ {
+/*M*/ long nDiff = (GetUpper()->Prt().*fnRect->fnGetWidth)() -
+/*M*/ (Frm().*fnRect->fnGetWidth)();
+/*M*/ if( nDiff )
+/*M*/ (aFrm.*fnRect->fnAddRight)( nDiff );
+/*M*/ }
+/*M*/
+/*M*/ //VarSize ist immer die Hoehe.
+/*M*/ //Fuer den oberen/unteren Rand gelten die selben Regeln wie fuer
+/*M*/ //cntfrms (sie MakePrtArea() von diesen).
+/*M*/
+/*M*/ SwTwips nUpper = CalcUpperSpace( pAttrs );
+/*M*/
+/*M*/ //Wir wollen Rahmen ausweichen. Zwei Moeglichkeiten:
+/*M*/ //1. Es gibt Rahmen mit SurroundNone, diesen wird vollsaendig ausgewichen
+/*M*/ //2. Es gibt Rahmen mit Umlauf nur rechts bzw. nur links und diese sind
+/*M*/ // rechts bzw. links ausgerichtet, diese geben ein Minimum fuer die
+/*M*/ // Raender vor.
+/*M*/ long nTmpRight = -1000000,
+/*M*/ nLeftOffset = 0;
+/*M*/ if( CalcFlyOffsets( nUpper, nLeftOffset, nTmpRight ) )
+/*M*/ bValidPrtArea = FALSE;
+/*M*/ long nRightOffset = Max( 0L, nTmpRight );
+/*M*/
+/*M*/ SwTwips nLower = pAttrs->CalcBottomLine();
+/*M*/
+/*M*/ if ( !bValidPrtArea )
+/*M*/ { bValidPrtArea = TRUE;
+/*M*/
+/*M*/ //Die Breite der PrtArea wird vom FrmFmt vorgegeben, die Raender
+/*M*/ //sind entsprechend einzustellen.
+/*M*/ //Mindestraender werden von Umrandung und Schatten vorgegeben.
+/*M*/ //Die Rander werden so eingestellt, dass die PrtArea nach dem
+/*M*/ //angegebenen Adjustment im Frm ausgerichtet wird.
+/*M*/ //Wenn das Adjustment 0 ist, so werden die Rander anhand des
+/*M*/ //Randattributes eingestellt.
+/*N*/
+/*N*/ const SwTwips nOldHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ const SwTwips nMax = (aFrm.*fnRect->fnGetWidth)();
+/*N*/
+/*N*/ // OD 14.03.2003 #i9040# - adjust variable names.
+/*N*/ const SwTwips nLeftLine = pAttrs->CalcLeftLine();
+/*N*/ const SwTwips nRightLine = pAttrs->CalcRightLine();
+/*N*/
+/*M*/ //Die Breite ist evtl. eine Prozentangabe. Wenn die Tabelle irgendwo
+/*M*/ //'drinsteckt bezieht sie sich auf die Umgebung. Ist es der Body, so
+/*M*/ //bezieht sie sich in der BrowseView auf die Bildschirmbreite.
+/*M*/ const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
+/*N*/ // OD 14.03.2003 #i9040# - adjust variable name.
+/*N*/ const SwTwips nWishedTableWidth = CalcRel( rSz, TRUE );
+/*M*/
+/*M*/ BOOL bCheckBrowseWidth = FALSE;
+/*M*/
+/*N*/ // OD 14.03.2003 #i9040# - insert new variables for left/right spacing.
+/*N*/ SwTwips nLeftSpacing = 0;
+/*N*/ SwTwips nRightSpacing = 0;
+/*N*/ switch ( GetFmt()->GetHoriOrient().GetHoriOrient() )
+/*N*/ {
+/*N*/ case HORI_LEFT:
+/*N*/ {
+/*N*/ // left indent:
+/*N*/ nLeftSpacing = nLeftLine + nLeftOffset;
+/*N*/ // OD 06.03.2003 #i9040# - correct calculation of right indent:
+/*N*/ // - Consider right indent given by right line attributes.
+/*N*/ // - Consider negative right indent.
+/*N*/ // wished right indent determined by wished table width and
+/*N*/ // left offset given by surround fly frames on the left:
+/*N*/ const SwTwips nWishRight = nMax - nWishedTableWidth - nLeftOffset;
+/*N*/ if ( nRightOffset > 0 )
+/*N*/ {
+/*N*/ // surrounding fly frames on the right
+/*N*/ // -> right indent is maximun of given right offset
+/*N*/ // and wished right offset.
+/*N*/ nRightSpacing = nRightLine + Max( nRightOffset, nWishRight );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // no surrounding fly frames on the right
+/*N*/ // If intrinsic right indent (intrinsic means not considering
+/*N*/ // determined left indent) is negative,
+/*N*/ // then hold this intrinsic indent,
+/*N*/ // otherwise non negative wished right indent is hold.
+/*N*/ nRightSpacing = nRightLine +
+/*N*/ ( ( (nWishRight+nLeftOffset) < 0 ) ?
+/*N*/ (nWishRight+nLeftOffset) :
+/*N*/ Max( 0L, nWishRight ) );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case HORI_RIGHT:
+/*N*/ {
+/*N*/ // right indent:
+/*N*/ nRightSpacing = nRightLine + nRightOffset;
+/*N*/ // OD 06.03.2003 #i9040# - correct calculation of left indent:
+/*N*/ // - Consider left indent given by left line attributes.
+/*N*/ // - Consider negative left indent.
+/*N*/ // wished left indent determined by wished table width and
+/*N*/ // right offset given by surrounding fyl frames on the right:
+/*N*/ const SwTwips nWishLeft = nMax - nWishedTableWidth - nRightOffset;
+/*N*/ if ( nLeftOffset > 0 )
+/*N*/ {
+/*N*/ // surrounding fly frames on the left
+/*N*/ // -> right indent is maximun of given left offset
+/*N*/ // and wished left offset.
+/*N*/ nLeftSpacing = nLeftLine + Max( nLeftOffset, nWishLeft );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // no surrounding fly frames on the left
+/*N*/ // If intrinsic left indent (intrinsic = not considering
+/*N*/ // determined right indent) is negative,
+/*N*/ // then hold this intrinsic indent,
+/*N*/ // otherwise non negative wished left indent is hold.
+/*N*/ nLeftSpacing = nLeftLine +
+/*N*/ ( ( (nWishLeft+nRightOffset) < 0 ) ?
+/*N*/ (nWishLeft+nRightOffset) :
+/*N*/ Max( 0L, nWishLeft ) );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case HORI_CENTER:
+/*N*/ {
+/*N*/ // OD 07.03.2003 #i9040# - consider left/right line attribute.
+/*N*/ // OD 10.03.2003 #i9040# -
+/*N*/ const SwTwips nCenterSpacing = ( nMax - nWishedTableWidth ) / 2;
+/*N*/ nLeftSpacing = nLeftLine +
+/*N*/ ( (nLeftOffset > 0) ?
+/*N*/ Max( nCenterSpacing, nLeftOffset ) :
+/*N*/ nCenterSpacing );
+/*N*/ nRightSpacing = nRightLine +
+/*N*/ ( (nRightOffset > 0) ?
+/*N*/ Max( nCenterSpacing, nRightOffset ) :
+/*N*/ nCenterSpacing );
+/*N*/ }
+/*N*/ break;
+/*N*/ case HORI_FULL:
+/*N*/ //Das Teil dehnt sich ueber die gesamte Breite aus.
+/*N*/ //Nur die fuer die Umrandung benoetigten Freiraeume
+/*N*/ //werden beruecksichtigt.
+/*N*/ //Die Attributwerte von LRSpace werden bewusst missachtet!
+/*N*/ bCheckBrowseWidth = TRUE;
+/*N*/ nLeftSpacing = nLeftLine + nLeftOffset;
+/*N*/ nRightSpacing = nRightLine + nRightOffset;
+/*N*/ break;
+/*N*/ case HORI_NONE:
+/*N*/ {
+/*N*/ //Die Raender werden vom Randattribut bestimmt.
+/*N*/ nLeftSpacing = pAttrs->CalcLeft( this );
+/*N*/ if( nLeftOffset )
+/*N*/ {
+/*N*/ // OD 07.03.2003 #i9040# - surround fly frames only, if
+/*N*/ // they overlap with the table.
+/*N*/ // Thus, take maximun of left spacing and left offset.
+/*N*/ // OD 10.03.2003 #i9040# - consider left line attribute.
+/*N*/ nLeftSpacing = Max( nLeftSpacing, ( nLeftOffset + nLeftLine ) );
+/*N*/ }
+/*N*/ // OD 23.01.2003 #106895# - add 1st param to <SwBorderAttrs::CalcRight(..)>
+/*N*/ nRightSpacing = pAttrs->CalcRight( this );
+/*N*/ if( nRightOffset )
+/*N*/ {
+/*N*/ // OD 07.03.2003 #i9040# - surround fly frames only, if
+/*N*/ // they overlap with the table.
+/*N*/ // Thus, take maximun of right spacing and right offset.
+/*N*/ // OD 10.03.2003 #i9040# - consider right line attribute.
+/*N*/ nRightSpacing = Max( nRightSpacing, ( nRightOffset + nRightLine ) );
+/*N*/ }
+/*N*/ // OD 10.03.2003 #i9040# - do not hold wished table width.
+ /*
+ if ( !pAttrs->GetLRSpace().GetRight() )
+ nRight = Max( nRight, nMax - (nWish + nLeft + nRight));
+ */
+/*N*/ }
+/*N*/ break;
+/*N*/ case HORI_LEFT_AND_WIDTH:
+/*N*/ {
+/*N*/ //Linker Rand und die Breite zaehlen (Word-Spezialitaet)
+/*N*/ // OD 10.03.2003 #i9040# - no width alignment in online mode.
+/*N*/ //bCheckBrowseWidth = TRUE;
+/*N*/ nLeftSpacing = pAttrs->CalcLeft( this );
+/*N*/ if( nLeftOffset )
+/*N*/ {
+/*N*/ // OD 10.03.2003 #i9040# - surround fly frames only, if
+/*N*/ // they overlap with the table.
+/*N*/ // Thus, take maximun of right spacing and right offset.
+/*N*/ // OD 10.03.2003 #i9040# - consider left line attribute.
+/*N*/ nLeftSpacing = Max( nLeftSpacing, ( pAttrs->CalcLeftLine() + nLeftOffset ) );
+/*N*/ }
+/*N*/ // OD 10.03.2003 #i9040# - consider right and left line attribute.
+/*N*/ const SwTwips nWishRight =
+/*N*/ nMax - (nLeftSpacing-pAttrs->CalcLeftLine()) - nWishedTableWidth;
+/*N*/ nRightSpacing = nRightLine +
+/*N*/ ( (nRightOffset > 0) ?
+/*N*/ Max( nWishRight, nRightOffset ) :
+/*N*/ nWishRight );
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ ASSERT( FALSE, "Ungueltige orientation fuer Table." );
+/*N*/ }
+/*N*/ (this->*fnRect->fnSetYMargins)( nUpper, nLower );
+/*N*/ if( (nMax - MINLAY) < (nLeftSpacing + nRightSpacing) )
+/*N*/ (this->*fnRect->fnSetXMargins)( 0, 0 );
+/*N*/ else
+/*N*/ (this->*fnRect->fnSetXMargins)( nLeftSpacing, nRightSpacing );
+/*N*/
+/*N*/ ViewShell *pSh;
+/*N*/ if ( bCheckBrowseWidth && GetFmt()->GetDoc()->IsBrowseMode() &&
+/*N*/ GetUpper()->IsPageBodyFrm() && // nur PageBodyFrms, nicht etwa ColBodyFrms
+/*N*/ 0 != (pSh = GetShell()) && pSh->VisArea().Width() )
+/*N*/ {
+/*N*/ //Nicht ueber die Kante des sichbaren Bereiches hinausragen.
+/*N*/ //Die Seite kann breiter sein, weil es Objekte mit "ueberbreite"
+/*N*/ //geben kann (RootFrm::ImplCalcBrowseWidth())
+/*N*/ const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
+/*N*/ long nWidth = pSh->VisArea().Width() - 2 * aBorder.Width();
+/*N*/ nWidth -= Prt().Left();
+/*N*/ nWidth -= pAttrs->CalcRightLine();
+/*N*/ Prt().Width( Min( nWidth, Prt().Width() ) );
+/*N*/ }
+/*N*/
+/*N*/ if ( nOldHeight != (Prt().*fnRect->fnGetHeight)() )
+/*N*/ bValidSize = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ bValidSize = TRUE;
+/*N*/
+/*N*/ //Die Groesse wird durch den Inhalt plus den Raendern bestimmt.
+/*N*/ SwTwips nRemaining = 0, nDiff;
+/*N*/ SwFrm *pFrm = pLower;
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ //Jetzt noch die Raender addieren
+/*N*/ nRemaining += nUpper + nLower;
+/*N*/
+/*N*/ nDiff = (Frm().*fnRect->fnGetHeight)() - nRemaining;
+/*N*/ if ( nDiff > 0 )
+/*N*/ Shrink( nDiff PHEIGHT );
+/*N*/ else if ( nDiff < 0 )
+/*N*/ Grow( -nDiff PHEIGHT );
+/*N*/ }
+/*N*/ }
+/*************************************************************************
+|*
+|* SwTabFrm::GrowFrm()
+|*
+|* Ersterstellung MA 12. Mar. 93
+|* Letzte Aenderung MA 23. Sep. 96
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwTabFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ SwTwips nHeight =(Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nHeight > 0 && nDist > ( LONG_MAX - nHeight ) )
+/*N*/ nDist = LONG_MAX - nHeight;
+/*N*/
+/*N*/ //Tabelle waechst immer (sie kann ja ggf. aufgespalten werden).
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ //Der Upper wird nur soweit wie notwendig gegrowed. In nReal wird erstmal
+/*N*/ //die bereits zur Verfuegung stehende Strecke bereitgestellt.
+/*N*/ SwTwips nReal = (GetUpper()->Prt().*fnRect->fnGetHeight)();
+/*N*/ SwFrm *pFrm = GetUpper()->Lower();
+/*N*/ while ( pFrm )
+/*N*/ { nReal -= (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ SwRect aOldFrm( Frm() );
+/*N*/ nHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ (Frm().*fnRect->fnSetHeight)( nHeight + nDist );
+/*N*/ if( IsVertical() && !IsReverse() )
+/*N*/ Frm().Pos().X() -= nDist;
+/*N*/ if ( nReal < nDist )
+/*N*/ GetUpper()->Grow( nDist - (nReal>0 ? nReal : 0), bTst, bInfo );
+/*N*/
+/*N*/ SwRootFrm *pRootFrm = FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( this, aOldFrm );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ GetNext()->_InvalidatePos();
+/*N*/ if ( GetNext()->IsCntntFrm() )
+/*N*/ GetNext()->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ _InvalidateAll();
+/*N*/ InvalidatePage( pPage );
+/*N*/ SetComplete();
+/*N*/
+/*N*/ const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
+/*N*/ if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
+/*N*/ SetCompletePaint();
+/*N*/ }
+/*N*/ return nDist;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwTabFrm::Modify()
+|*
+|* Ersterstellung MA 14. Mar. 93
+|* Letzte Aenderung MA 06. Dec. 96
+|*
+|*************************************************************************/
+/*N*/ void SwTabFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ BYTE nInvFlags = 0;
+/*N*/ BOOL bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which();
+/*N*/
+/*N*/ if( bAttrSetChg )
+/*N*/ {
+/*N*/ SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
+/*N*/ SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
+/*N*/ SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
+/*N*/ SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
+/*N*/ (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+/*N*/ &aOldSet, &aNewSet );
+/*N*/ if( aNIter.IsAtEnd() )
+/*N*/ break;
+/*N*/ aNIter.NextItem();
+/*N*/ aOIter.NextItem();
+/*N*/ }
+/*N*/ if ( aOldSet.Count() || aNewSet.Count() )
+/*N*/ SwLayoutFrm::Modify( &aOldSet, &aNewSet );
+/*N*/ }
+/*N*/ else
+/*?*/ _UpdateAttr( pOld, pNew, nInvFlags );
+/*N*/
+/*N*/ if ( nInvFlags != 0 )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ // if ( nInvFlags & 0x01 )
+/*N*/ // SetCompletePaint();
+/*N*/ if ( nInvFlags & 0x02 )
+/*N*/ _InvalidatePrt();
+/*N*/ if ( nInvFlags & 0x40 )
+/*N*/ _InvalidatePos();
+/*N*/ SwFrm *pTmp;
+/*N*/ if ( 0 != (pTmp = GetIndNext()) )
+/*N*/ {
+/*N*/ if ( nInvFlags & 0x04 )
+/*N*/ {
+/*N*/ pTmp->_InvalidatePrt();
+/*N*/ if ( pTmp->IsCntntFrm() )
+/*N*/ pTmp->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if ( nInvFlags & 0x10 )
+/*N*/ pTmp->SetCompletePaint();
+/*N*/ }
+/*N*/ if ( nInvFlags & 0x08 && 0 != (pTmp = GetPrev()) )
+/*N*/ {
+/*N*/ pTmp->_InvalidatePrt();
+/*N*/ if ( pTmp->IsCntntFrm() )
+/*N*/ pTmp->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if ( nInvFlags & 0x20 )
+/*N*/ {
+/*N*/ if ( pPage && pPage->GetUpper() && !IsFollow() )
+/*N*/ ((SwRootFrm*)pPage->GetUpper())->InvalidateBrowseWidth();
+/*N*/ }
+/*N*/ if ( nInvFlags & 0x80 )
+/*N*/ InvalidateNextPos();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwTabFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew,
+/*N*/ BYTE &rInvFlags,
+/*N*/ SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
+/*N*/ {
+/*N*/ BOOL bClear = TRUE;
+/*N*/ const USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_TBLHEADLINECHG:
+/*N*/ //Es wird getoggelt.
+/*?*/ if ( IsFollow() )
+/*?*/ {
+/*?*/ if ( GetTable()->IsHeadlineRepeat() )
+/*?*/ {
+/*?*/ bDontCreateObjects = TRUE; //frmtool
+/*?*/ SwFrm *pRow = new SwRowFrm( *GetTable()->GetTabLines()[0] );
+/*?*/ bDontCreateObjects = FALSE;
+/*?*/ pRow->Paste( this, Lower() );
+/*?*/ }
+/*?*/ else if ( Lower() )
+/*?*/ {
+/*?*/ SwFrm *pLow = Lower();
+/*?*/ pLow->Cut();
+/*?*/ delete pLow;
+/*?*/ }
+/*?*/ }
+/*?*/ else if ( !HasFollow() )
+/*?*/ rInvFlags |= 0x02;
+/*?*/ break;
+/*?*/
+/*N*/ case RES_FRM_SIZE:
+/*N*/ case RES_HORI_ORIENT:
+/*N*/ rInvFlags |= 0x22;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_PAGEDESC: //Attributaenderung (an/aus)
+/*N*/ if ( IsInDocBody() )
+/*N*/ {
+/*N*/ rInvFlags |= 0x40;
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( !GetPrev() )
+/*N*/ CheckPageDescs( pPage );
+/*N*/ if ( pPage && GetFmt()->GetPageDesc().GetNumOffset() )
+/*N*/ ((SwRootFrm*)pPage->GetUpper())->SetVirtPageNum( TRUE );
+/*N*/ SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
+/*N*/ GetFmt()->GetDoc()->UpdatePageFlds( &aMsgHnt );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_BREAK:
+/*N*/ rInvFlags |= 0xC0;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_LAYOUT_SPLIT:
+/*?*/ if ( !IsFollow() )
+/*?*/ rInvFlags |= 0x40;
+/*?*/ break;
+/*N*/ case RES_FRAMEDIR :
+/*?*/ SetDerivedR2L( sal_False );
+/*?*/ CheckDirChange();
+/*?*/ break;
+/*N*/ case RES_UL_SPACE:
+/*N*/ rInvFlags |= 0x1C;
+/*N*/ /* kein Break hier */
+/*N*/
+/*N*/ default:
+/*N*/ bClear = FALSE;
+/*N*/ }
+/*N*/ if ( bClear )
+/*N*/ {
+/*N*/ if ( pOldSet || pNewSet )
+/*N*/ {
+/*N*/ if ( pOldSet )
+/*N*/ pOldSet->ClearItem( nWhich );
+/*N*/ if ( pNewSet )
+/*N*/ pNewSet->ClearItem( nWhich );
+/*N*/ }
+/*N*/ else
+/*?*/ SwLayoutFrm::Modify( pOld, pNew );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::GetInfo()
+|*
+|* Ersterstellung MA 06. Dec. 96
+|* Letzte Aenderung MA 26. Jun. 98
+|*
+|*************************************************************************/
+/*N*/ BOOL SwTabFrm::GetInfo( SfxPoolItem &rHnt ) const
+/*N*/ {
+/*N*/ if ( RES_VIRTPAGENUM_INFO == rHnt.Which() && IsInDocBody() )
+/*N*/ {
+/*N*/ SwVirtPageNumInfo &rInfo = (SwVirtPageNumInfo&)rHnt;
+/*N*/ const SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( pPage )
+/*N*/ {
+/*N*/ if ( pPage == rInfo.GetOrigPage() && !GetPrev() )
+/*N*/ {
+/*N*/ //Das sollte er sein (kann allenfalls temporaer anders sein,
+/*N*/ // sollte uns das beunruhigen?)
+/*N*/ rInfo.SetInfo( pPage, this );
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ if ( pPage->GetPhyPageNum() < rInfo.GetOrigPage()->GetPhyPageNum() &&
+/*N*/ (!rInfo.GetPage() || pPage->GetPhyPageNum() > rInfo.GetPage()->GetPhyPageNum()))
+/*N*/ {
+/*N*/ //Das koennte er sein.
+/*N*/ rInfo.SetInfo( pPage, this );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::FindLastCntnt()
+|*
+|* Ersterstellung MA 13. Apr. 93
+|* Letzte Aenderung MA 15. May. 98
+|*
+|*************************************************************************/
+/*N*/ SwCntntFrm *SwTabFrm::FindLastCntnt()
+/*N*/ {
+/*N*/ SwFrm *pRet = pLower;
+/*N*/ while ( pRet && !pRet->IsCntntFrm() )
+/*N*/ {
+/*N*/ SwFrm *pOld = pRet;
+/*N*/
+/*N*/ SwFrm *pTmp = pRet; // To skip empty section frames
+/*N*/ while ( pRet->GetNext() )
+/*N*/ {
+/*N*/ pRet = pRet->GetNext();
+/*N*/ if( !pRet->IsSctFrm() || ((SwSectionFrm*)pRet)->GetSection() )
+/*N*/ pTmp = pRet;
+/*N*/ }
+/*N*/ pRet = pTmp;
+/*N*/
+/*N*/ if ( pRet->GetLower() )
+/*N*/ pRet = pRet->GetLower();
+/*N*/ if ( pRet == pOld )
+/*N*/ { // Wenn am Ende der letzten Zelle ein spaltiger Bereich steht,
+/*?*/ // der eine leere letzte Spalte hat, muessen wir noch die anderen
+/*?*/ // Spalten abklappern, dies erledigt SwSectionFrm::FindLastCntnt
+/*?*/ if( pRet->IsColBodyFrm() )
+/*?*/ {
+/*?*/ #ifdef DBG_UTIL
+/*?*/ SwSectionFrm* pSect = pRet->FindSctFrm();
+/*?*/ ASSERT( pSect, "Wo kommt denn die Spalte her?")
+/*?*/ ASSERT( IsAnLower( pSect ), "Gespaltene Zelle?" );
+/*?*/ #endif
+/*?*/ return pRet->FindSctFrm()->FindLastCntnt();
+/*?*/ }
+/*?*/ return 0; //Hier geht es nicht weiter. Inkonsistenter Zustand
+/*?*/ //der Tabelle (z.B. Undo TextToTable).
+/*N*/ }
+/*N*/ }
+/*N*/ // ASSERT( pRet && pRet->IsCntntFrm(), "Letzter Lower von Tab kein Cnt." );
+/*N*/ if ( pRet ) //#50235#
+/*N*/ while ( pRet->GetNext() )
+/*N*/ pRet = pRet->GetNext();
+/*N*/ if( pRet->IsSctFrm() )
+/*?*/ pRet = ((SwSectionFrm*)pRet)->FindLastCntnt();
+/*N*/ ASSERT( pRet && pRet->IsCntntFrm(), "Letzter Lower von Tab kein Cnt." );
+/*N*/ return (SwCntntFrm*)pRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::GetLeaf()
+|*
+|* Ersterstellung MA 19. Mar. 93
+|* Letzte Aenderung MA 25. Apr. 95
+|*
+|*************************************************************************/
+/*N*/ SwLayoutFrm *SwTabFrm::GetLeaf( MakePageType eMakePage, BOOL bFwd )
+/*N*/ {
+/*N*/ SwLayoutFrm *pRet;
+/*N*/ if ( bFwd )
+/*N*/ {
+/*?*/ pRet = GetNextLeaf( eMakePage );
+/*?*/ while ( IsAnLower( pRet ) )
+/*?*/ pRet = pRet->GetNextLeaf( eMakePage );
+/*?*/ }
+/*N*/ else
+/*N*/ pRet = GetPrevLeaf();
+/*N*/ if ( pRet )
+/*N*/ pRet->Calc();
+/*N*/ return pRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::ShouldBwdMoved()
+|*
+|* Beschreibung Returnwert sagt ob der Frm verschoben werden sollte
+|* Ersterstellung MA 10. Jul. 95
+|* Letzte Aenderung MA 04. Mar. 97
+|*
+|*************************************************************************/
+/*N*/ BOOL SwTabFrm::ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat )
+/*N*/ {
+/*N*/ rReformat = FALSE;
+/*N*/ if ( (SwFlowFrm::IsMoveBwdJump() || !IsPrevObjMove()) )
+/*N*/ {
+/*N*/ //Das zurueckfliessen von Frm's ist leider etwas Zeitintensiv.
+/*N*/ //Der haufigste Fall ist der, dass dort wo der Frm hinfliessen
+/*N*/ //moechte die FixSize die gleiche ist, die der Frm selbst hat.
+/*N*/ //In diesem Fall kann einfach geprueft werden, ob der Frm genug
+/*N*/ //Platz fuer seine VarSize findet, ist dies nicht der Fall kann
+/*N*/ //gleich auf das Verschieben verzichtet werden.
+/*N*/ //Die Pruefung, ob der Frm genug Platz findet fuehrt er selbst
+/*N*/ //durch, dabei wird beruecksichtigt, dass er sich moeglicherweise
+/*N*/ //aufspalten kann.
+/*N*/ //Wenn jedoch die FixSize eine andere ist oder Flys im Spiel sind
+/*N*/ //(an der alten oder neuen Position) hat alle Prueferei keinen Sinn
+/*N*/ //der Frm muss dann halt Probehalber verschoben werden (Wenn ueberhaupt
+/*N*/ //etwas Platz zur Verfuegung steht).
+/*N*/
+/*N*/ //Die FixSize der Umgebungen in denen Tabellen herumlungern ist immer
+/*N*/ //Die Breite.
+/*N*/
+/*N*/ SwPageFrm *pOldPage = FindPageFrm(),
+/*N*/ *pNewPage = pNewUpper->FindPageFrm();
+/*N*/ BOOL bMoveAnyway = FALSE;
+/*N*/ SwTwips nSpace = 0;
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ if ( !SwFlowFrm::IsMoveBwdJump() )
+/*N*/ {
+/*N*/
+/*N*/ long nOldWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
+/*N*/ SWRECTFNX( pNewUpper );
+/*N*/ long nNewWidth = (pNewUpper->Prt().*fnRectX->fnGetWidth)();
+/*N*/ if( Abs( nNewWidth - nOldWidth ) < 2 )
+/*N*/ {
+/*N*/ if( FALSE ==
+/*N*/ ( bMoveAnyway = BwdMoveNecessary( pOldPage, Frm() ) > 1 ) )
+/*N*/ {
+/*N*/ SwRect aRect( pNewUpper->Prt() );
+/*N*/ aRect.Pos() += pNewUpper->Frm().Pos();
+/*N*/ const SwFrm *pPrevFrm = pNewUpper->Lower();
+/*N*/ while ( pPrevFrm )
+/*N*/ {
+/*N*/ (aRect.*fnRectX->fnSetTop)( (pPrevFrm->Frm().*fnRectX->
+/*N*/ fnGetBottom)() );
+/*N*/ pPrevFrm = pPrevFrm->GetNext();
+/*N*/ }
+/*N*/ bMoveAnyway = BwdMoveNecessary( pNewPage, aRect) > 1;
+/*N*/ nSpace = (aRect.*fnRectX->fnGetHeight)();
+/*N*/ if ( GetFmt()->GetDoc()->IsBrowseMode() )
+/*N*/ nSpace += pNewUpper->Grow( LONG_MAX, TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( !bLockBackMove )
+/*N*/ bMoveAnyway = TRUE;
+/*N*/ }
+/*N*/ else if( !bLockBackMove )
+/*N*/ bMoveAnyway = TRUE;
+/*N*/
+/*N*/ if ( bMoveAnyway )
+/*N*/ return rReformat = TRUE;
+/*N*/ else if ( !bLockBackMove )
+/*N*/ { const BOOL bRepeat = GetTable()->IsHeadlineRepeat();
+/*N*/ SwTwips nHeight = bRepeat && Lower()->GetNext() ?
+/*N*/ (Lower()->GetNext()->Frm().*fnRect->fnGetHeight)()
+/*N*/ : (Lower()->Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( bHead && bRepeat && Lower()->GetNext() )
+/*N*/ nHeight += (Lower()->Frm().*fnRect->fnGetHeight)();
+/*N*/ return nHeight <= nSpace;
+/*N*/ }
+/*N*/ }
+/*?*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::Cut()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 09. Sep. 98
+|*
+|*************************************************************************/
+/*N*/ void SwTabFrm::Cut()
+/*N*/ {
+/*N*/ ASSERT( GetUpper(), "Cut ohne Upper()." );
+/*N*/
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ SwFrm *pFrm = GetNext();
+/*N*/ if( pFrm )
+/*N*/ { //Der alte Nachfolger hat evtl. einen Abstand zum Vorgaenger
+/*N*/ //berechnet der ist jetzt wo er der erste wird obsolete
+/*N*/ pFrm->_InvalidatePrt();
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ if ( pFrm->IsCntntFrm() )
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ if( IsInSct() && !GetPrev() )
+/*N*/ {
+/*?*/ SwSectionFrm* pSct = FindSctFrm();
+/*?*/ if( !pSct->IsFollow() )
+/*?*/ {
+/*?*/ pSct->_InvalidatePrt();
+/*?*/ pSct->InvalidatePage( pPage );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ InvalidateNextPos();
+/*N*/ //Einer muss die Retusche uebernehmen: Vorgaenger oder Upper
+/*N*/ if ( 0 != (pFrm = GetPrev()) )
+/*N*/ { pFrm->SetRetouche();
+/*N*/ pFrm->Prepare( PREP_WIDOWS_ORPHANS );
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ if ( pFrm->IsCntntFrm() )
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ //Wenn ich der einzige FlowFrm in meinem Upper bin (war), so muss
+/*N*/ //er die Retouche uebernehmen.
+/*N*/ //Ausserdem kann eine Leerseite entstanden sein.
+/*N*/ else
+/*N*/ { SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
+/*N*/ pRoot->SetSuperfluous();
+/*N*/ GetUpper()->SetCompletePaint();
+/*N*/ if( IsInSct() )
+/*N*/ {
+/*?*/ SwSectionFrm* pSct = FindSctFrm();
+/*?*/ if( !pSct->IsFollow() )
+/*?*/ {
+/*?*/ pSct->_InvalidatePrt();
+/*?*/ pSct->InvalidatePage( pPage );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Erst removen, dann Upper Shrinken.
+/*N*/ SwLayoutFrm *pUp = GetUpper();
+/*N*/ SWRECTFN( this )
+/*N*/ Remove();
+/*N*/ if ( pUp )
+/*N*/ {
+/*N*/ ASSERT( !pUp->IsFtnFrm(), "Tabelle in Fussnote." );
+/*N*/ SwSectionFrm *pSct = 0;
+/*N*/ if( !pUp->Lower() && pUp->IsInSct() &&
+/*N*/ !(pSct = pUp->FindSctFrm())->ContainsCntnt() )
+/*N*/ {
+/*?*/ if ( pUp->GetUpper() )
+/*?*/ {
+/*?*/ pSct->DelEmpty( FALSE );
+/*?*/ pSct->_InvalidateSize();
+/*?*/ }
+/*N*/ }
+/*N*/ else if( (Frm().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ // OD 24.02.2003 #104992# - unlock section the table frame was in.
+/*N*/ // Otherwise, the section will not shrink.
+/*N*/ // The section will be locked in this situation, if table is
+/*N*/ // converted to text and the table was the only content in the
+/*N*/ // section beside a footnote.
+/*N*/ // Note: lock state will be restored.
+/*N*/ bool bOldLock;
+/*N*/ if ( pSct )
+/*N*/ {
+/*N*/ bOldLock = pSct->IsColLocked() ? true : false;
+/*N*/ pSct->ColUnlock();
+/*N*/ }
+/*N*/ pUp->Shrink( Frm().Height() PHEIGHT );
+/*N*/ // OD 24.02.2003 #104992# - restore section lock state.
+/*N*/ if ( pSct )
+/*N*/ {
+/*N*/ if ( bOldLock )
+/*N*/ {
+/*N*/ pSct->ColLock();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( pPage && !IsFollow() && pPage->GetUpper() )
+/*N*/ ((SwRootFrm*)pPage->GetUpper())->InvalidateBrowseWidth();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::Paste()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 09. Sep. 98
+|*
+|*************************************************************************/
+/*N*/ void SwTabFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
+/*N*/ {
+/*N*/ ASSERT( pParent, "Kein Parent fuer Paste." );
+/*N*/ ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
+/*N*/ ASSERT( pParent != this, "Bin selbst der Parent." );
+/*N*/ ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
+/*N*/ ASSERT( !GetPrev() && !GetNext() && !GetUpper(),
+/*N*/ "Bin noch irgendwo angemeldet." );
+/*N*/
+/*N*/ //In den Baum einhaengen.
+/*N*/ InsertBefore( (SwLayoutFrm*)pParent, pSibling );
+/*N*/
+/*N*/ _InvalidateAll();
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ GetNext()->_InvalidatePos();
+/*N*/ GetNext()->_InvalidatePrt();
+/*N*/ if ( GetNext()->IsCntntFrm() )
+/*N*/ GetNext()->InvalidatePage( pPage );
+/*N*/ }
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ if( (Frm().*fnRect->fnGetHeight)() )
+/*N*/ pParent->Grow( (Frm().*fnRect->fnGetHeight)() );
+/*N*/
+/*N*/ if( (Frm().*fnRect->fnGetWidth)() != (pParent->Prt().*fnRect->fnGetWidth)() )
+/*N*/ Prepare( PREP_FIXSIZE_CHG );
+/*N*/ if ( GetPrev() )
+/*N*/ {
+/*N*/ if ( !IsFollow() )
+/*N*/ {
+/*N*/ GetPrev()->InvalidateSize();
+/*N*/ if ( GetPrev()->IsCntntFrm() )
+/*N*/ GetPrev()->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( GetNext() )
+/*N*/ //Bei CntntFrm's gilt es den Abstand zum Vorgaenger/Nachfolger
+/*N*/ //zu beachten. Faelle (beide treten immer gleichzeitig auf):
+/*N*/ //a) Der Cntnt wird der erste einer Kette
+/*N*/ //b) Der neue Nachfolger war vorher der erste einer Kette
+/*N*/ GetNext()->_InvalidatePrt();
+/*N*/
+/*N*/ if ( pPage && !IsFollow() )
+/*N*/ {
+/*N*/ if ( pPage->GetUpper() )
+/*N*/ ((SwRootFrm*)pPage->GetUpper())->InvalidateBrowseWidth();
+/*N*/
+/*N*/ if ( !GetPrev() )//Mindestens fuer HTML mit Tabelle am Anfang notwendig.
+/*N*/ {
+/*N*/ const SwPageDesc *pDesc = GetFmt()->GetPageDesc().GetPageDesc();
+/*N*/ if ( (pDesc && pDesc != pPage->GetPageDesc()) ||
+/*N*/ (!pDesc && pPage->GetPageDesc() != &GetFmt()->GetDoc()->GetPageDesc(0)) )
+/*N*/ CheckPageDescs( pPage, TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTabFrm::Prepare()
+|*
+|* Created AMA 01/10/02
+|* Last Change AMA 01/10/02
+|*
+|*************************************************************************/
+/*N*/ void SwTabFrm::Prepare( const PrepareHint eHint, const void *, BOOL )
+/*N*/ {
+/*N*/ if( PREP_BOSS_CHGD == eHint )
+/*N*/ CheckDirChange();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRowFrm::SwRowFrm(), ~SwRowFrm()
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 30. May. 96
+|*
+|*************************************************************************/
+/*N*/ SwRowFrm::SwRowFrm( const SwTableLine &rLine ):
+/*N*/ SwLayoutFrm( rLine.GetFrmFmt() ),
+/*N*/ pTabLine( &rLine )
+/*N*/ {
+/*N*/ nType = FRMC_ROW;
+/*N*/
+/*N*/ //Gleich die Boxen erzeugen und einfuegen.
+/*N*/ const SwTableBoxes &rBoxes = rLine.GetTabBoxes();
+/*N*/ SwFrm *pPrev = 0;
+/*N*/ for ( USHORT i = 0; i < rBoxes.Count(); ++i )
+/*N*/ {
+/*N*/ SwCellFrm *pNew = new SwCellFrm( *rBoxes[i] );
+/*N*/ pNew->InsertBehind( this, pPrev );
+/*N*/ pPrev = pNew;
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwRowFrm::~SwRowFrm()
+/*N*/ {
+/*N*/ SwModify* pMod = GetFmt();
+/*N*/ if( pMod )
+/*N*/ {
+/*N*/ pMod->Remove( this ); // austragen,
+/*N*/ if( !pMod->GetDepends() )
+/*?*/ delete pMod; // und loeschen
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRowFrm::RegistFlys()
+|*
+|* Ersterstellung MA 08. Jul. 93
+|* Letzte Aenderung MA 08. Jul. 93
+|*
+|*************************************************************************/
+/*N*/ void SwRowFrm::RegistFlys( SwPageFrm *pPage )
+/*N*/ {
+/*N*/ ::binfilter::RegistFlys( pPage ? pPage : FindPageFrm(), this );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRowFrm::Modify()
+|*
+|* Ersterstellung MA 12. Nov. 97
+|* Letzte Aenderung MA 12. Nov. 97
+|*
+|*************************************************************************/
+/*N*/ void SwRowFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ BOOL bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which();
+/*N*/ const SfxPoolItem *pItem = 0;
+/*N*/
+/*N*/ if( bAttrSetChg )
+/*N*/ ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_FRM_SIZE, FALSE, &pItem);
+/*N*/ else if ( RES_FRM_SIZE == pNew->Which() )
+/*?*/ pItem = pNew;
+/*N*/
+/*N*/ if ( pItem )
+/*N*/ {
+/*N*/ SwTabFrm *pTab = FindTabFrm();
+/*N*/ if ( pTab && pTab->IsFollow() &&
+/*N*/ (!GetPrev() ||
+/*N*/ (pTab->GetTable()->IsHeadlineRepeat() && !GetPrev()->GetPrev())))
+/*N*/ {
+/*?*/ pTab->FindMaster()->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwLayoutFrm::Modify( pOld, pNew );
+/*N*/ }
+
+
+
+/*************************************************************************
+|*
+|* SwRowFrm::MakeAll()
+|*
+|* Ersterstellung MA 01. Mar. 94
+|* Letzte Aenderung MA 01. Mar. 94
+|*
+|*************************************************************************/
+/*N*/ void SwRowFrm::MakeAll()
+/*N*/ {
+/*N*/ if ( !GetNext() )
+/*N*/ bValidSize = FALSE;
+/*N*/ SwLayoutFrm::MakeAll();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRowFrm::Format()
+|*
+|* Ersterstellung MA 13. Mar. 93
+|* Letzte Aenderung MA 20. Jun. 96
+|*
+|*************************************************************************/
+/*M*/ long MA_FASTCALL CalcHeightWidthFlys( const SwFrm *pFrm )
+/*M*/ {
+/*M*/ SWRECTFN( pFrm )
+/*M*/ long nHeight = 0;
+/*M*/ const SwFrm* pTmp = pFrm->IsSctFrm() ?
+/*M*/ ((SwSectionFrm*)pFrm)->ContainsCntnt() : pFrm;
+/*M*/ while( pTmp )
+/*M*/ {
+/*M*/ if ( pTmp->GetDrawObjs() )
+/*M*/ {
+/*M*/ for ( USHORT i = 0; i < pTmp->GetDrawObjs()->Count(); ++i )
+/*M*/ {
+/*M*/ const SdrObject *pO = (*pTmp->GetDrawObjs())[i];
+/*M*/ if ( pO->IsWriterFlyFrame() )
+/*M*/ {
+/*M*/ const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*M*/ if( !pFly->IsFlyInCntFrm() && pFly->Frm().Top()!=WEIT_WECH )
+/*M*/ {
+/*M*/ const SwFmtFrmSize &rSz = pFly->GetFmt()->GetFrmSize();
+/*M*/ if( !rSz.GetHeightPercent() )
+/*M*/ {
+/*M*/ const SwTwips nFlyWidth =
+/*M*/ (pFly->Frm().*fnRect->fnGetHeight)() +
+/*M*/ ( bVert ?
+/*M*/ pFly->GetCurRelPos().X() :
+/*M*/ pFly->GetCurRelPos().Y() );
+/*M*/
+/*M*/ const SwTwips nFrmDiff =
+/*M*/ (*fnRect->fnYDiff)(
+/*M*/ (pTmp->Frm().*fnRect->fnGetTop)(),
+/*M*/ (pFrm->Frm().*fnRect->fnGetTop)() );
+/*M*/
+/*M*/ nHeight = Max( nHeight, nFlyWidth + nFrmDiff -
+/*M*/ (pFrm->Frm().*fnRect->fnGetHeight)() );
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ if( !pFrm->IsSctFrm() )
+/*M*/ break;
+/*M*/ pTmp = pTmp->FindNextCnt();
+/*M*/ if( !((SwSectionFrm*)pFrm)->IsAnLower( pTmp ) )
+/*M*/ break;
+/*M*/ }
+/*M*/ return nHeight;
+/*M*/ }
+
+/*N*/ SwTwips MA_FASTCALL lcl_CalcMinRowHeight( SwLayoutFrm *pRow );
+
+/*N*/ SwTwips MA_FASTCALL lcl_CalcMinCellHeight( SwLayoutFrm *pCell,
+/*N*/ const SwBorderAttrs *pAttrs = 0 )
+/*N*/ {
+/*N*/ SWRECTFN( pCell )
+/*N*/ SwTwips nHeight = 0;
+/*N*/ SwFrm *pLow = pCell->Lower();
+/*N*/ if ( pLow )
+/*N*/ {
+/*N*/ long nFlyAdd = 0;
+/*N*/ while ( pLow )
+/*N*/ {
+/*N*/ if( pLow->IsCntntFrm() || pLow->IsSctFrm() )
+/*N*/ {
+/*N*/ long nLowHeight = (pLow->Frm().*fnRect->fnGetHeight)();
+/*N*/ nHeight += nLowHeight;
+/*N*/ nFlyAdd = Max( 0L, nFlyAdd - nLowHeight );
+/*N*/ nFlyAdd = Max( nFlyAdd, ::binfilter::CalcHeightWidthFlys( pLow ) );
+/*N*/ }
+/*N*/ else
+/*N*/ nHeight += ::binfilter::lcl_CalcMinRowHeight( (SwLayoutFrm*)pLow );
+/*N*/
+/*N*/ pLow = pLow->GetNext();
+/*N*/ }
+/*N*/ if ( nFlyAdd )
+/*N*/ nHeight += nFlyAdd;
+/*N*/ }
+/*N*/ //Der Border will natuerlich auch mitspielen, er kann leider nicht
+/*N*/ //aus PrtArea und Frm errechnet werden, da diese in beliebiger
+/*N*/ //Kombination ungueltig sein koennen.
+/*N*/ if ( pAttrs )
+/*N*/ nHeight += pAttrs->CalcTop() + pAttrs->CalcBottom();
+/*N*/ else
+/*N*/ {
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pCell );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ nHeight += rAttrs.CalcTop() + rAttrs.CalcBottom();
+/*N*/ }
+/*N*/ return nHeight;
+/*N*/ }
+
+/*N*/ SwTwips MA_FASTCALL lcl_CalcMinRowHeight( SwLayoutFrm *pRow )
+/*N*/ {
+/*N*/ SWRECTFN( pRow )
+/*N*/ if ( pRow->HasFixSize() )
+/*N*/ return (pRow->Frm().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ SwTwips nHeight = 0;
+/*N*/ SwLayoutFrm *pLow = (SwLayoutFrm*)pRow->Lower();
+/*N*/ while ( pLow )
+/*N*/ {
+/*N*/ SwTwips nTmp = ::binfilter::lcl_CalcMinCellHeight( pLow );
+/*N*/ if ( nTmp > nHeight )
+/*N*/ nHeight = nTmp;
+/*N*/ pLow = (SwLayoutFrm*)pLow->GetNext();
+/*N*/ }
+/*N*/ const SwFmtFrmSize &rSz = pRow->GetFmt()->GetFrmSize();
+/*N*/ if ( rSz.GetSizeType() == ATT_MIN_SIZE )
+/*N*/ nHeight = Max( nHeight, rSz.GetHeight() );
+/*N*/ return nHeight;
+/*N*/ }
+
+/*N*/ void SwRowFrm::Format( const SwBorderAttrs *pAttrs )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ ASSERT( pAttrs, "SwRowFrm::Format ohne Attrs." );
+/*N*/
+/*N*/ const BOOL bFix = BFIXHEIGHT;
+/*N*/
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ //RowFrms haben keine Umrandung usw. also entspricht die PrtArea immer
+/*N*/ //dem Frm.
+/*N*/ bValidPrtArea = TRUE;
+/*N*/ aPrt.Left( 0 );
+/*N*/ aPrt.Top( 0 );
+/*N*/ aPrt.Width ( aFrm.Width() );
+/*N*/ aPrt.Height( aFrm.Height() );
+/*N*/ }
+/*N*/
+/*N*/ while ( !bValidSize )
+/*N*/ {
+/*N*/ bValidSize = TRUE;
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( HasFixSize() )
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rFrmSize = GetFmt()->GetFrmSize();
+/*N*/ ASSERT( rFrmSize.GetSize().Height() > 0, "Hat ihn" );
+/*N*/ }
+/*N*/ #endif
+/*N*/ const SwTwips nDiff = (Frm().*fnRect->fnGetHeight)() - (HasFixSize() ?
+/*N*/ pAttrs->GetSize().Height() :
+/*N*/ ::binfilter::lcl_CalcMinRowHeight( this ));
+/*N*/ if ( nDiff )
+/*N*/ {
+/*N*/ BFIXHEIGHT = FALSE;
+/*N*/ if ( nDiff > 0 )
+/*N*/ Shrink( nDiff PHEIGHT, FALSE, TRUE );
+/*N*/ else if ( nDiff < 0 )
+/*N*/ Grow( -nDiff PHEIGHT );
+/*N*/ BFIXHEIGHT = bFix;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !GetNext() )
+/*N*/ {
+/*N*/ //Der letzte fuellt den verbleibenden Raum im Upper aus.
+/*N*/ SwTwips nDiff = (GetUpper()->Prt().*fnRect->fnGetHeight)();
+/*N*/ SwFrm *pSibling = GetUpper()->Lower();
+/*N*/ do
+/*N*/ { nDiff -= (pSibling->Frm().*fnRect->fnGetHeight)();
+/*N*/ pSibling = pSibling->GetNext();
+/*N*/ } while ( pSibling );
+/*N*/ if ( nDiff > 0 )
+/*N*/ {
+/*N*/ BFIXHEIGHT = FALSE;
+/*N*/ Grow( nDiff PHEIGHT );
+/*N*/ BFIXHEIGHT = bFix;
+/*N*/ bValidSize = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRowFrm::AdjustCells()
+|*
+|* Ersterstellung MA 10. Aug. 93
+|* Letzte Aenderung MA 16. Dec. 96
+|*
+|*************************************************************************/
+/*N*/ void SwRowFrm::AdjustCells( const SwTwips nHeight, const BOOL bHeight )
+/*N*/ {
+/*N*/ SwFrm *pFrm = Lower();
+/*N*/ if ( bHeight )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = 0;
+/*N*/ SWRECTFN( this )
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ long nDiff = nHeight - (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nDiff )
+/*N*/ {
+/*N*/ SwRect aOldFrm( pFrm->Frm() );
+/*N*/ (pFrm->Frm().*fnRect->fnAddBottom)( nDiff );
+/*N*/ if( !pRootFrm )
+/*N*/ pRootFrm = FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( pFrm, aOldFrm );
+/*N*/ }
+/*N*/ pFrm->_InvalidatePrt();
+/*N*/ }
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ { while ( pFrm )
+/*N*/ {
+/*N*/ pFrm->_InvalidateAll();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ InvalidatePage();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRowFrm::Cut()
+|*
+|* Ersterstellung MA 12. Nov. 97
+|* Letzte Aenderung MA 12. Nov. 97
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwRowFrm::GrowFrm()
+|*
+|* Ersterstellung MA 15. Mar. 93
+|* Letzte Aenderung MA 05. May. 94
+|*
+|*************************************************************************/
+
+
+/*N*/ SwTwips SwRowFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ const SwTwips nReal = SwLayoutFrm::GrowFrm( nDist, bTst, bInfo);
+/*N*/
+/*N*/ //Hoehe der Zellen auf den neuesten Stand bringen.
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ AdjustCells( (Prt().*fnRect->fnGetHeight)() + nReal, TRUE );
+/*N*/ if ( nReal )
+/*N*/ SetCompletePaint();
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwRowFrm::ShrinkFrm()
+|*
+|* Ersterstellung MA 15. Mar. 93
+|* Letzte Aenderung MA 20. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwRowFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ if( HasFixSize() )
+/*N*/ {
+/*M*/ AdjustCells( (Prt().*fnRect->fnGetHeight)(), TRUE );
+/*N*/ return 0L;
+/*N*/ }
+/*N*/
+/*N*/ //bInfo wird ggf. vom SwRowFrm::Format auf TRUE gesetzt, hier muss dann
+/*N*/ //entsprechend reagiert werden
+/*N*/ const BOOL bShrinkAnyway = bInfo;
+/*N*/
+/*N*/ //Nur soweit Shrinken, wie es der Inhalt der groessten Zelle zulaesst.
+/*N*/ SwTwips nRealDist = nDist;
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
+/*N*/ SwTwips nMinHeight = rSz.GetSizeType() == ATT_MIN_SIZE ?
+/*N*/ rSz.GetHeight() : 0;
+/*N*/ SwLayoutFrm *pCell = (SwLayoutFrm*)Lower();
+/*N*/ if( nMinHeight < (Frm().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ SwLayoutFrm *pCell = (SwLayoutFrm*)Lower();
+/*N*/ while ( pCell )
+/*N*/ {
+/*N*/ SwTwips nAct = ::binfilter::lcl_CalcMinCellHeight( pCell );
+/*N*/ if ( nAct > nMinHeight )
+/*N*/ nMinHeight = nAct;
+/*N*/ if ( nMinHeight >= (Frm().*fnRect->fnGetHeight)() )
+/*N*/ break;
+/*N*/ pCell = (SwLayoutFrm*)pCell->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( ((Frm().*fnRect->fnGetHeight)() - nRealDist) < nMinHeight )
+/*N*/ nRealDist = (Frm().*fnRect->fnGetHeight)() - nMinHeight;
+/*N*/ }
+/*N*/ if ( nRealDist < 0 )
+/*?*/ nRealDist = 0;
+/*N*/
+/*N*/ SwTwips nReal = nRealDist;
+/*N*/ if ( nReal )
+/*N*/ {
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ SwTwips nHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ (Frm().*fnRect->fnSetHeight)( nHeight - nReal );
+/*N*/ if( IsVertical() && !bRev )
+/*?*/ Frm().Pos().X() += nReal;
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nTmp = GetUpper()->Shrink( nReal, bTst );
+/*N*/ if ( !bShrinkAnyway && !GetNext() && nTmp != nReal )
+/*N*/ {
+/*N*/ //Der letzte bekommt den Rest im Upper und nimmt deshalb
+/*N*/ //ggf. Ruecksichten (sonst: Endlosschleife)
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ nReal -= nTmp;
+/*N*/ SwTwips nHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ (Frm().*fnRect->fnSetHeight)( nHeight + nReal );
+/*N*/ if( IsVertical() && !bRev )
+/*?*/ Frm().Pos().X() -= nReal;
+/*N*/ }
+/*N*/ nReal = nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Geeignet invalidieren und die Hoehe der Zellen auf den neuesten
+/*N*/ //Stand bringen.
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ if ( nReal )
+/*N*/ {
+/*N*/ if ( GetNext() )
+/*?*/ GetNext()->_InvalidatePos();
+/*N*/ _InvalidateAll();
+/*N*/ SetCompletePaint();
+/*N*/
+/*N*/ SwTabFrm *pTab = FindTabFrm();
+/*N*/ if ( pTab->IsFollow() &&
+/*N*/ (!GetPrev() ||
+/*N*/ (pTab->GetTable()->IsHeadlineRepeat() && !GetPrev()->GetPrev())))
+/*N*/ {
+/*?*/ pTab->FindMaster()->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ AdjustCells( (Prt().*fnRect->fnGetHeight)() - nReal, TRUE );
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwCellFrm::SwCellFrm(), ~SwCellFrm()
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 30. May. 96
+|*
+|*************************************************************************/
+/*N*/ SwCellFrm::SwCellFrm( const SwTableBox &rBox ) :
+/*N*/ SwLayoutFrm( rBox.GetFrmFmt() ),
+/*N*/ pTabBox( &rBox )
+/*N*/ {
+/*N*/ nType = FRMC_CELL;
+/*N*/
+/*N*/ //Wenn ein StartIdx vorhanden ist, so werden CntntFrms in der Zelle
+/*N*/ //angelegt, andernfalls muessen Rows vorhanden sein und diese werden
+/*N*/ //angelegt.
+/*N*/ if ( rBox.GetSttIdx() )
+/*N*/ {
+/*N*/ ULONG nIndex = rBox.GetSttIdx();
+/*N*/ ::binfilter::_InsertCnt( this, rBox.GetFrmFmt()->GetDoc(), ++nIndex );
+/*N*/ }
+/*N*/ else
+/*N*/ { const SwTableLines &rLines = rBox.GetTabLines();
+/*N*/ SwFrm *pPrev = 0;
+/*N*/ for ( USHORT i = 0; i < rLines.Count(); ++i )
+/*N*/ {
+/*N*/ SwRowFrm *pNew = new SwRowFrm( *rLines[i] );
+/*N*/ pNew->InsertBehind( this, pPrev );
+/*N*/ pPrev = pNew;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwCellFrm::~SwCellFrm()
+/*N*/ {
+/*N*/ SwModify* pMod = GetFmt();
+/*N*/ if( pMod )
+/*N*/ {
+/*N*/ // At this stage the lower frames aren't destroyed already,
+/*N*/ // therfor we have to do a recursive dispose.
+/*N*/ SwRootFrm *pRootFrm = FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pRootFrm->GetCurrShell()->Imp()->DisposeAccessibleFrm( this, sal_True );
+/*N*/ }
+/*N*/ pMod->Remove( this ); // austragen,
+/*N*/ pMod->Remove( this ); // austragen,
+/*N*/ if( !pMod->GetDepends() )
+/*?*/ delete pMod; // und loeschen
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCellFrm::Format()
+|*
+|* Ersterstellung MA 09. Mar. 93
+|* Letzte Aenderung MA 29. Jan. 98
+|*
+|*************************************************************************/
+/*N*/ BOOL lcl_ArrangeLowers( SwLayoutFrm *pLay, long lYStart, BOOL bInva )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ SwFrm *pFrm = pLay->Lower();
+/*N*/ SwPageFrm* pPg = NULL;
+/*N*/ SWRECTFN( pLay )
+/*N*/ while ( pFrm )
+/*N*/ {
+/*N*/ long nFrmTop = (pFrm->Frm().*fnRect->fnGetTop)();
+/*N*/ if( nFrmTop != lYStart )
+/*N*/ {
+/*N*/ bRet = TRUE;
+/*N*/ const long lDiff = (*fnRect->fnYDiff)( lYStart, nFrmTop );
+/*N*/ const long lDiffX = lYStart - nFrmTop;
+/*N*/ (pFrm->Frm().*fnRect->fnSubTop)( -lDiff );
+/*N*/ (pFrm->Frm().*fnRect->fnAddBottom)( lDiff );
+/*N*/ pFrm->SetCompletePaint();
+/*N*/ if ( !pFrm->GetNext() )
+/*N*/ pFrm->SetRetouche();
+/*N*/ if( bInva )
+/*N*/ pFrm->Prepare( PREP_POS_CHGD );
+/*N*/ if ( pFrm->IsLayoutFrm() && ((SwLayoutFrm*)pFrm)->Lower() )
+/*N*/ lcl_ArrangeLowers( (SwLayoutFrm*)pFrm,
+/*N*/ (((SwLayoutFrm*)pFrm)->Lower()->Frm().*fnRect->fnGetTop)()
+/*N*/ + lDiffX, bInva );
+/*N*/ if ( pFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < pFrm->GetDrawObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pFrm->GetDrawObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if( WEIT_WECH != pFly->Frm().Top() )
+/*N*/ {
+/*N*/ (pFly->Frm().*fnRect->fnSubTop)( -lDiff );
+/*N*/ (pFly->Frm().*fnRect->fnAddBottom)( lDiff );
+/*N*/ }
+/*N*/ pFly->GetVirtDrawObj()->_SetRectsDirty();
+/*N*/ if ( pFly->IsFlyInCntFrm() )
+/*N*/ ((SwFlyInCntFrm*)pFly)->AddRefOfst( lDiff );
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pPg )
+/*N*/ pPg = pLay->FindPageFrm();
+/*N*/ SwPageFrm* pOld = pFly->FindPageFrm();
+/*N*/ if( pPg != pOld )
+/*N*/ pOld->MoveFly( pFly, pPg );
+/*N*/ if( pFly->IsAutoPos() )
+/*?*/ ((SwFlyAtCntFrm*)pFly)->AddLastCharY( lDiff );
+/*N*/ }
+/*N*/ if( ::binfilter::lcl_ArrangeLowers( pFly,
+/*N*/ (pFly->*fnRect->fnGetPrtTop)(), bInva ) )
+/*N*/ pFly->SetCompletePaint();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // OD 30.06.2003 #108784# - consider 'virtual' drawing
+/*N*/ // objects.
+/*N*/ if ( pO->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pO);
+/*N*/ pDrawVirtObj->SetAnchorPos( pFrm->GetFrmAnchorPos( ::binfilter::HasWrap( pO ) ) );
+/*N*/ pDrawVirtObj->AdjustRelativePosToReference();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pO->SetAnchorPos( pFrm->GetFrmAnchorPos( ::binfilter::HasWrap( pO ) ) );
+/*N*/ // OD 30.06.2003 #108784# - correct relative position
+/*N*/ // of 'virtual' drawing objects.
+/*N*/ SwDrawContact* pDrawContact =
+/*N*/ static_cast<SwDrawContact*>(pO->GetUserCall());
+/*N*/ if ( pDrawContact )
+/*N*/ {
+/*N*/ pDrawContact->CorrectRelativePosOfVirtObjs();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Columns and cells are ordered horizontal, not vertical
+/*N*/ if( !pFrm->IsColumnFrm() && !pFrm->IsCellFrm() )
+/*N*/ lYStart = (*fnRect->fnYInc)( lYStart,
+/*N*/ (pFrm->Frm().*fnRect->fnGetHeight)() );
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ void SwCellFrm::Format( const SwBorderAttrs *pAttrs )
+/*N*/ {
+/*N*/ ASSERT( pAttrs, "CellFrm::Format, pAttrs ist 0." );
+/*N*/ SWRECTFN( this )
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ bValidPrtArea = TRUE;
+/*N*/
+/*N*/ //Position einstellen.
+/*N*/ long nLeftSpace = pAttrs->CalcLeft( this );
+/*N*/ // OD 23.01.2003 #106895# - add 1st param to <SwBorderAttrs::CalcRight(..)>
+/*N*/ long nRightSpace = pAttrs->CalcRight( this );
+/*N*/ (this->*fnRect->fnSetXMargins)( nLeftSpace, nRightSpace );
+/*N*/ long nTopSpace = pAttrs->CalcTop();
+/*N*/ long nBottomSpace = pAttrs->CalcBottom();
+/*N*/ (this->*fnRect->fnSetYMargins)( nTopSpace, nBottomSpace );
+/*N*/ }
+/*N*/ long nRemaining = ::binfilter::lcl_CalcMinCellHeight( this, pAttrs );
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ bValidSize = TRUE;
+/*N*/
+/*N*/ //Die VarSize der CellFrms ist immer die Breite.
+/*N*/ //Tatsaechlich ist die Breite jedoch nicht Variabel, sie wird durch das
+/*N*/ //Format vorgegeben. Dieser Vorgegebene Wert muss aber nun wiederum
+/*N*/ //nicht der tatsaechlichen Breite entsprechen. Die Breite wird auf
+/*N*/ //Basis des Attributes errechnet, der Wert im Attribut passt zu dem
+/*N*/ //gewuenschten Wert des TabFrms. Anpassungen die dort vorgenommen
+/*N*/ //wurden werden hier Proportional beruecksichtigt.
+/*N*/ //Wenn die Celle keinen Nachbarn mehr hat beruecksichtigt sie nicht
+/*N*/ //die Attribute, sonder greift sich einfach den Rest des
+/*N*/ //Uppers.
+/*N*/ SwTwips nWidth;
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ const SwTabFrm *pTab = FindTabFrm();
+/*N*/ SwTwips nWish = pTab->GetFmt()->GetFrmSize().GetWidth();
+/*N*/ nWidth = pAttrs->GetSize().Width();
+/*N*/
+/*N*/ ASSERT( nWish, "Tabelle ohne Breite?" );
+/*N*/ ASSERT( nWidth <= nWish, "Zelle breiter als Tabelle." );
+/*N*/ ASSERT( nWidth > 0, "Box without width" );
+/*N*/
+/*N*/ long nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)();
+/*N*/ if ( nWish != nPrtWidth )
+/*N*/ {
+/*N*/ nWidth *= nPrtWidth;
+/*N*/ nWidth /= nWish;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( pAttrs->GetSize().Width() > 0, "Box without width" );
+/*N*/ nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
+/*N*/ SwFrm *pPre = GetUpper()->Lower();
+/*N*/ while ( pPre != this )
+/*N*/ { nWidth -= (pPre->Frm().*fnRect->fnGetWidth)();
+/*N*/ pPre = pPre->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ const long nDiff = nWidth - (Frm().*fnRect->fnGetWidth)();
+/*N*/ if( IsNeighbourFrm() && IsRightToLeft() )
+/*N*/ (Frm().*fnRect->fnSubLeft)( nDiff );
+/*N*/ else
+/*N*/ (Frm().*fnRect->fnAddRight)( nDiff );
+/*N*/ (Prt().*fnRect->fnAddRight)( nDiff );
+/*N*/
+/*N*/ //Jetzt die Hoehe einstellen, sie wird vom Inhalt und den Raendern
+/*N*/ //bestimmt.
+/*N*/ const long nDiffHeight = nRemaining - (Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( nDiffHeight )
+/*N*/ {
+/*N*/ if ( nDiffHeight > 0 )
+/*N*/ {
+/*N*/ //Wieder validieren wenn kein Wachstum stattgefunden hat.
+/*N*/ //Invalidiert wird durch AdjustCells von der Row.
+/*N*/ if ( !Grow( nDiffHeight PHEIGHT ) )
+/*N*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Nur dann invalidiert lassen, wenn tatsaechlich
+/*N*/ //geshrinkt wurde; das kann abgelehnt werden, weil alle
+/*N*/ //nebeneinanderliegenden Zellen gleichgross sein muessen.
+/*N*/ if ( !Shrink( -nDiffHeight PHEIGHT ) )
+/*N*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ const SwFmtVertOrient &rOri = pAttrs->GetAttrSet().GetVertOrient();
+/*N*/ if ( VERT_NONE != rOri.GetVertOrient() )
+/*N*/ {
+/*N*/ if ( !Lower()->IsCntntFrm() && !Lower()->IsSctFrm() )
+/*N*/ {
+/*N*/ //ASSERT fuer HTML-Import!
+/*N*/ ASSERT( !this, "VAlign an Zelle ohne Inhalt" );
+/*N*/ return;
+/*N*/ }
+/*N*/ BOOL bVertDir = TRUE;
+/*N*/ //Keine Ausrichtung wenn Rahmen mit Umlauf in die Zelle ragen.
+/*N*/ SwPageFrm *pPg = FindPageFrm();
+/*N*/ if ( pPg->GetSortedObjs() )
+/*N*/ {
+/*N*/ SwRect aRect( Prt() ); aRect += Frm().Pos();
+/*N*/ for ( USHORT i = 0; i < pPg->GetSortedObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ const SdrObject *pObj = (*pPg->GetSortedObjs())[i];
+/*N*/ SwRect aTmp( pObj->GetBoundRect() );
+/*N*/ if ( aTmp.IsOver( aRect ) )
+/*N*/ {
+/*N*/ SdrObjUserCall *pUserCall;
+/*N*/ const SwFmtSurround &rSur = ((SwContact*)
+/*N*/ (pUserCall=GetUserCall(pObj)))->GetFmt()->GetSurround();
+/*N*/ if ( SURROUND_THROUGHT != rSur.GetSurround() )
+/*N*/ {
+/*N*/ const SwFrm *pAnch;
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ const SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ if ( pFly->IsAnLower( this ) )
+/*N*/ continue;
+/*N*/ pAnch = pFly->GetAnchor();
+/*N*/ }
+/*N*/ else
+/*N*/ pAnch = ((SwDrawContact*)pUserCall)->GetAnchor();
+/*N*/ if ( !IsAnLower( pAnch ) )
+/*N*/ {
+/*N*/ bVertDir = FALSE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ if( ( bVertDir && ( nRemaining -= (pAttrs->CalcTop() +
+/*N*/ pAttrs->CalcBottom())) < nPrtHeight ) ||
+/*N*/ (Lower()->Frm().*fnRect->fnGetTop)() !=
+/*N*/ (this->*fnRect->fnGetPrtTop)() )
+/*N*/ {
+/*N*/ long lTopOfst = 0,
+/*N*/ nDiff = (Prt().*fnRect->fnGetHeight)() - nRemaining;
+/*N*/ if ( nDiff >= 0 )
+/*N*/ {
+/*N*/ if ( bVertDir )
+/*N*/ {
+/*N*/ switch ( rOri.GetVertOrient() )
+/*N*/ {
+/*N*/ case VERT_CENTER: lTopOfst = nDiff / 2; break;
+/*N*/ case VERT_BOTTOM: lTopOfst = nDiff; break;
+/*N*/ };
+/*N*/ }
+/*N*/ long nTmp = (*fnRect->fnYInc)(
+/*N*/ (this->*fnRect->fnGetPrtTop)(), lTopOfst );
+/*N*/ if ( lcl_ArrangeLowers( this, nTmp, !bVertDir ) )
+/*N*/ SetCompletePaint();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Ist noch eine alte Ausrichtung beruecksichtigt worden?
+/*N*/ if ( Lower()->IsCntntFrm() )
+/*N*/ {
+/*N*/ const long lYStart = (this->*fnRect->fnGetPrtTop)();
+/*N*/ lcl_ArrangeLowers( this, lYStart, TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCellFrm::Modify()
+|*
+|* Ersterstellung MA 20. Dec. 96
+|* Letzte Aenderung MA 20. Dec. 96
+|*
+|*************************************************************************/
+/*N*/ void SwCellFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ BOOL bAttrSetChg = pNew && RES_ATTRSET_CHG == pNew->Which();
+/*N*/ const SfxPoolItem *pItem = 0;
+/*N*/
+/*N*/ if( bAttrSetChg )
+/*N*/ ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_VERT_ORIENT, FALSE, &pItem);
+/*N*/ else if ( RES_VERT_ORIENT == pNew->Which() )
+/*?*/ pItem = pNew;
+/*N*/
+/*N*/ if ( pItem )
+/*N*/ {
+/*?*/ BOOL bInva = TRUE;
+/*?*/ if ( VERT_NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient() &&
+/*?*/ Lower()->IsCntntFrm() )
+/*?*/ {
+/*?*/ SWRECTFN( this )
+/*?*/ const long lYStart = (this->*fnRect->fnGetPrtTop)();
+/*?*/ bInva = lcl_ArrangeLowers( this, lYStart, FALSE );
+/*?*/ }
+/*?*/ if ( bInva )
+/*?*/ {
+/*?*/ SetCompletePaint();
+/*?*/ InvalidatePrt();
+/*?*/ }
+/*N*/ }
+/*N*/
+/*M*/ if( (bAttrSetChg &&
+/*M*/ SFX_ITEM_SET == ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState( RES_PROTECT, FALSE )) ||
+/*M*/ RES_PROTECT == pNew->Which() )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/
+/*N*/ SwLayoutFrm::Modify( pOld, pNew );
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_trvlfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_trvlfrm.cxx
new file mode 100644
index 000000000000..60173ace9e95
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_trvlfrm.cxx
@@ -0,0 +1,912 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <hintids.hxx>
+
+#include <tools/bigint.hxx>
+#include <bf_svx/protitem.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+
+#include <pagefrm.hxx>
+#include <ftnfrm.hxx>
+
+#include <horiornt.hxx>
+
+#include <flyfrm.hxx>
+#include <tabfrm.hxx>
+#include <txtfrm.hxx>
+#include <doc.hxx>
+#include <pam.hxx>
+#include <swtable.hxx>
+#include <crstate.hxx>
+#include <frmtool.hxx>
+#include <hints.hxx>
+#include <frmsh.hxx>
+namespace binfilter {
+
+
+//Fuer SwFlyFrm::GetCrsrOfst
+
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::GetCrsrOfst()
+|*
+|* Beschreibung: Sucht denjenigen CntntFrm, innerhalb dessen
+|* PrtArea der Point liegt.
+|* Ersterstellung MA 20. Jul. 92
+|* Letzte Aenderung MA 23. May. 95
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwPageFrm::GetCrsrOfst()
+|*
+|* Beschreibung: Sucht die Seite, innerhalb der der gesuchte Point
+|* liegt.
+|* Ersterstellung MA 20. Jul. 92
+|* Letzte Aenderung MA 18. Jul. 96
+|*
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwRootFrm::GetCrsrOfst()
+|*
+|* Beschreibung: Reicht Primaer den Aufruf an die erste Seite weiter.
+|* Wenn der 'reingereichte Point veraendert wird,
+|* so wird FALSE zurueckgegeben.
+|* Ersterstellung MA 01. Jun. 92
+|* Letzte Aenderung MA 30. Nov. 94
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwCellFrm::GetCrsrOfst()
+|*
+|* Beschreibung Wenn es sich um eine Cntnt-tragende Cell handelt wird
+|* der Crsr notfalls mit Gewalt in einen der CntntFrms
+|* gesetzt.
+|* In geschuetzte Zellen gibt es hier keinen Eingang.
+|* Ersterstellung MA 04. Jun. 93
+|* Letzte Aenderung MA 23. May. 95
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwFlyFrm::GetCrsrOfst()
+|*
+|* Ersterstellung MA 15. Dec. 92
+|* Letzte Aenderung MA 23. May. 95
+|*
+|*************************************************************************/
+//Problem: Wenn zwei Flys genau gleich gross sind und auf derselben
+//Position stehen, so liegt jeder innerhalb des anderen.
+//Da jeweils geprueft wird, ob der Point nicht zufaellig innerhalb eines
+//anderen Flys liegt, der sich vollstaendig innerhalb des aktuellen befindet
+//und ggf. ein rekursiver Aufruf erfolgt wuerde o.g. Situation zu einer
+//endlosen Rekursion fuehren.
+//Mit der Hilfsklasse SwCrsrOszControl unterbinden wir die Rekursion. Das
+//GetCrsrOfst entscheidet sich bei einer Rekursion fuer denjenigen der
+//am weitesten oben liegt.
+
+
+/*************************************************************************
+|*
+|* Beschreibung Layoutabhaengiges Cursortravelling
+|* Ersterstellung MA 23. Jul. 92
+|* Letzte Aenderung MA 06. Sep. 93
+|*
+|*************************************************************************/
+
+
+/*N*/ const SwCntntFrm *lcl_GetNxtCnt( const SwCntntFrm* pCnt )
+/*N*/ {
+/*N*/ return pCnt->GetNextCntntFrm();
+/*N*/ }
+
+
+/*N*/ typedef const SwCntntFrm *(*GetNxtPrvCnt)( const SwCntntFrm* );
+
+//Frame in wiederholter Headline?
+/*N*/ FASTBOOL lcl_IsInRepeatedHeadline( const SwFrm *pFrm,
+/*N*/ const SwTabFrm** ppTFrm = 0 )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001
+/*N*/ }
+
+
+//Ueberspringen geschuetzter Tabellenzellen. Optional auch
+//Ueberspringen von wiederholten Headlines.
+//MA 26. Jan. 98: Chg auch andere Geschuetzte Bereiche ueberspringen.
+/*N*/ const SwCntntFrm * MA_FASTCALL lcl_MissProtectedFrames( const SwCntntFrm *pCnt,
+/*N*/ GetNxtPrvCnt fnNxtPrv,
+/*N*/ FASTBOOL bMissHeadline,
+/*N*/ FASTBOOL bInReadOnly )
+/*N*/ {
+/*N*/ if ( pCnt && pCnt->IsInTab() )
+/*N*/ {
+/*N*/ BOOL bProtect = TRUE;
+/*N*/ while ( pCnt && bProtect )
+/*N*/ {
+/*N*/ const SwLayoutFrm *pCell = pCnt->GetUpper();
+/*N*/ while ( pCell && !pCell->IsCellFrm() )
+/*?*/ pCell = pCell->GetUpper();
+/*N*/ if ( !pCell ||
+/*N*/ ((bInReadOnly || !pCell->GetFmt()->GetProtect().IsCntntProtected()) &&
+/*N*/ (!bMissHeadline || !lcl_IsInRepeatedHeadline( pCell ) )))
+/*N*/ bProtect = FALSE;
+/*N*/ else
+/*?*/ pCnt = (*fnNxtPrv)( pCnt );
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( !bInReadOnly )
+/*N*/ while ( pCnt && pCnt->IsProtected() )
+/*N*/ pCnt = (*fnNxtPrv)( pCnt );
+/*N*/
+/*N*/ return pCnt;
+/*N*/ }
+
+
+
+
+/*************************************************************************
+|*
+|* SwRootFrm::GetCurrPage()
+|*
+|* Beschreibung: Liefert die Nummer der aktuellen Seite.
+|* Wenn die Methode einen PaM bekommt, so ist die aktuelle Seite
+|* diejenige in der der PaM sitzt. Anderfalls ist die aktuelle
+|* Seite die erste Seite innerhalb der VisibleArea.
+|* Es wird nur auf den vorhandenen Seiten gearbeitet!
+|* Ersterstellung MA 20. May. 92
+|* Letzte Aenderung MA 09. Oct. 97
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwRootFrm::SetCurrPage()
+|*
+|* Beschreibung: Liefert einen PaM der am Anfang der gewuenschten
+|* Seite sitzt.
+|* Formatiert wird soweit notwendig
+|* Liefert Null, wenn die Operation nicht moeglich ist.
+|* Der PaM sitzt in der letzten Seite, wenn die Seitenzahl zu gross
+|* gewaehlt wurde.
+|* Ersterstellung MA 20. May. 92
+|* Letzte Aenderung MA 09. Oct. 97
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwCntntFrm::StartxxPage(), EndxxPage()
+|*
+|* Beschreibung Cursor an Anfang/Ende der aktuellen/vorherigen/
+|* naechsten Seite. Alle sechs Methoden rufen GetFrmInPage() mit der
+|* entsprechenden Parametrisierung.
+|* Zwei Parameter steuern die Richtung: einer bestimmt die Seite, der
+|* andere Anfang/Ende.
+|* Fuer die Bestimmung der Seite und des Cntnt (Anfang/Ende) werden
+|* die im folgenden definierten Funktionen benutzt.
+|* Ersterstellung MA 15. Oct. 92
+|* Letzte Aenderung MA 28. Feb. 93
+|*
+|*************************************************************************/
+
+
+
+
+
+//Jetzt koennen auch die Funktionspointer initalisiert werden;
+//sie sind in cshtyp.hxx declariert.
+
+//Liefert den ersten/den letzten Contentframe (gesteuert ueber
+//den Parameter fnPosPage) in der
+//aktuellen/vorhergehenden/folgenden Seite (gesteuert durch den
+//Parameter fnWhichPage).
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::GetCntntPos()
+|*
+|* Beschreibung Es wird der nachstliegende Cntnt zum uebergebenen
+|* gesucht. Betrachtet werden die vorhergehende, die
+|* aktuelle und die folgende Seite.
+|* Wenn kein Inhalt gefunden wird, so wird der Bereich
+ * erweitert bis einer gefunden wird.
+|* Zurueckgegeben wird die 'Semantisch richtige' Position
+|* innerhalb der PrtArea des gefundenen CntntFrm
+|* Ersterstellung MA 15. Jul. 92
+|* Letzte Aenderung MA 09. Jan. 97
+|*
+|*************************************************************************/
+/*N*/ ULONG CalcDiff( const Point &rPt1, const Point &rPt2 )
+/*N*/ {
+/*N*/ //Jetzt die Entfernung zwischen den beiden Punkten berechnen.
+/*N*/ //'Delta' X^2 + 'Delta'Y^2 = 'Entfernung'^2
+/*N*/ sal_uInt32 dX = Max( rPt1.X(), rPt2.X() ) -
+/*N*/ Min( rPt1.X(), rPt2.X() ),
+/*N*/ dY = Max( rPt1.Y(), rPt2.Y() ) -
+/*N*/ Min( rPt1.Y(), rPt2.Y() );
+/*N*/ BigInt dX1( dX ), dY1( dY );
+/*N*/ dX1 *= dX1; dY1 *= dY1;
+/*N*/ return ::binfilter::SqRt( dX1 + dY1 );
+/*N*/ }
+
+// lcl_Inside ueberprueft, ob der Punkt innerhalb des Seitenteils liegt, in dem
+// auch der CntntFrame liegt. Als Seitenteile gelten in diesem Zusammenhang
+// Kopfzeile, Seitenbody, Fusszeile und FussnotenContainer.
+// Dies dient dazu, dass ein CntntFrm, der im "richtigen" Seitenteil liegt,
+// eher akzeptiert wird als ein anderer, der nicht dort liegt, auch wenn
+// dessen Abstand zum Punkt geringer ist.
+
+/*N*/ const SwLayoutFrm* lcl_Inside( const SwCntntFrm *pCnt, Point& rPt )
+/*N*/ {
+/*N*/ const SwLayoutFrm* pUp = pCnt->GetUpper();
+/*N*/ while( pUp )
+/*N*/ {
+/*N*/ if( pUp->IsPageBodyFrm() || pUp->IsFooterFrm() || pUp->IsHeaderFrm() )
+/*N*/ {
+/*N*/ if( rPt.Y() >= pUp->Frm().Top() && rPt.Y() <= pUp->Frm().Bottom() )
+/*?*/ return pUp;
+/*N*/ return NULL;
+/*N*/ }
+/*N*/ if( pUp->IsFtnContFrm() )
+/*?*/ return pUp->Frm().IsInside( rPt ) ? pUp : NULL;
+/*N*/ pUp = pUp->GetUpper();
+/*N*/ }
+/*?*/ return NULL;
+/*N*/ }
+
+//Fuer MSC keine Optimierung mit e (enable register...) hier, sonst gibts
+//einen Bug (ID: 2857)
+/*N*/ #ifdef _MSC_VER
+/*N*/ #pragma optimize("e",off)
+/*N*/ #endif
+
+/*N*/ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint,
+/*N*/ const BOOL bDontLeave,
+/*N*/ const BOOL bBodyOnly,
+/*N*/ const BOOL bCalc,
+/*N*/ const SwCrsrMoveState *pCMS,
+/*N*/ const BOOL bDefaultExpand ) const
+/*N*/ {
+/*N*/ //Ersten CntntFrm ermitteln.
+/*N*/ const SwLayoutFrm *pStart = (!bDontLeave && bDefaultExpand && GetPrev()) ?
+/*N*/ (SwLayoutFrm*)GetPrev() : this;
+/*N*/ const SwCntntFrm *pCntnt = pStart->ContainsCntnt();
+/*N*/
+/*N*/ if ( !pCntnt && (GetPrev() && !bDontLeave) )
+/*N*/ pCntnt = ContainsCntnt();
+/*N*/
+/*N*/ if ( bBodyOnly && pCntnt && !pCntnt->IsInDocBody() )
+/*N*/ while ( pCntnt && !pCntnt->IsInDocBody() )
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/
+/*N*/ const SwCntntFrm *pActual= pCntnt;
+/*N*/ const SwLayoutFrm *pInside = NULL;
+/*N*/ USHORT nMaxPage = GetPhyPageNum() + (bDefaultExpand ? 1 : 0);
+/*N*/ Point aPoint = rPoint;
+/*N*/ ULONG nDistance = ULONG_MAX;
+/*N*/
+/*N*/ while ( TRUE ) //Sicherheitsschleifchen, damit immer einer gefunden wird.
+/*N*/ {
+/*N*/ while ( pCntnt &&
+/*N*/ ((!bDontLeave || IsAnLower( pCntnt )) &&
+/*N*/ (pCntnt->GetPhyPageNum() <= nMaxPage)) )
+/*N*/ {
+/*N*/ if ( ( bCalc || pCntnt->Frm().Width() ) &&
+/*N*/ ( !bBodyOnly || pCntnt->IsInDocBody() ) )
+/*N*/ {
+/*N*/ //Wenn der Cntnt in einem geschuetzen Bereich (Zelle, Ftn, Section)
+/*N*/ //liegt, wird der nachste Cntnt der nicht geschuetzt ist gesucht.
+/*N*/ const SwCntntFrm *pComp = pCntnt;
+/*N*/ pCntnt = ::binfilter::lcl_MissProtectedFrames( pCntnt, lcl_GetNxtCnt, FALSE,
+/*N*/ pCMS ? pCMS->bSetInReadOnly : FALSE );
+/*N*/ if ( pComp != pCntnt )
+/*N*/ continue;
+/*N*/
+/*N*/ if ( !pCntnt->IsTxtFrm() || !((SwTxtFrm*)pCntnt)->IsHiddenNow() )
+/*N*/ {
+/*N*/ if ( bCalc )
+/*N*/ pCntnt->Calc();
+/*N*/
+/*N*/ SwRect aCntFrm( pCntnt->UnionFrm() );
+/*N*/ if ( aCntFrm.IsInside( rPoint ) )
+/*N*/ {
+/*N*/ pActual = pCntnt;
+/*N*/ aPoint = rPoint;
+/*N*/ break;
+/*N*/ }
+/*N*/ //Die Strecke von rPoint zum dichtesten Punkt von pCntnt wird
+/*N*/ //jetzt berechnet.
+/*N*/ Point aCntntPoint( rPoint );
+/*N*/
+/*N*/ //Erst die Vertikale Position einstellen
+/*N*/ if ( aCntFrm.Top() > aCntntPoint.Y() )
+/*N*/ aCntntPoint.Y() = aCntFrm.Top();
+/*N*/ else if ( aCntFrm.Bottom() < aCntntPoint.Y() )
+/*N*/ aCntntPoint.Y() = aCntFrm.Bottom();
+/*N*/
+/*N*/ //Jetzt die Horizontale Position
+/*N*/ if ( aCntFrm.Left() > aCntntPoint.X() )
+/*N*/ aCntntPoint.X() = aCntFrm.Left();
+/*N*/ else if ( aCntFrm.Right() < aCntntPoint.X() )
+/*N*/ aCntntPoint.X() = aCntFrm.Right();
+/*N*/
+/*N*/ // pInside ist ein Seitenbereich, in dem der Punkt liegt,
+/*N*/ // sobald pInside!=0 ist, werden nur noch Frames akzeptiert,
+/*N*/ // die innerhalb liegen.
+/*N*/ if( !pInside || ( pInside->IsAnLower( pCntnt ) &&
+/*N*/ ( !pCntnt->IsInFtn() || pInside->IsFtnContFrm() ) ) )
+/*N*/ {
+/*N*/ const ULONG nDiff = ::binfilter::CalcDiff( aCntntPoint, rPoint );
+/*N*/ BOOL bBetter = nDiff < nDistance; // Dichter dran
+/*N*/ if( !pInside )
+/*N*/ {
+/*N*/ pInside = lcl_Inside( pCntnt, rPoint );
+/*N*/ if( pInside ) // Im "richtigen" Seitenteil
+/*N*/ bBetter = TRUE;
+/*N*/ }
+/*N*/ if( bBetter )
+/*N*/ {
+/*N*/ aPoint = aCntntPoint;
+/*N*/ nDistance = nDiff;
+/*N*/ pActual = pCntnt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ if ( bBodyOnly )
+/*N*/ while ( pCntnt && !pCntnt->IsInDocBody() )
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ if ( !pActual )
+/*N*/ { //Wenn noch keiner gefunden wurde muss der Suchbereich erweitert
+/*N*/ //werden, irgenwann muessen wir einen Finden!
+/*N*/ //MA 09. Jan. 97: Opt fuer viele leere Seiten, wenn wir nur im
+/*N*/ //Body suchen, koennen wir den Suchbereich gleich in einem
+/*N*/ //Schritt hinreichend erweitern.
+/*N*/ if ( bBodyOnly )
+/*N*/ {
+/*N*/ while ( !pCntnt && pStart->GetPrev() )
+/*N*/ {
+/*N*/ ++nMaxPage;
+/*N*/ if( !pStart->GetPrev()->IsLayoutFrm() )
+/*N*/ return 0;
+/*N*/ pStart = (SwLayoutFrm*)pStart->GetPrev();
+/*N*/ pCntnt = pStart->IsInDocBody()
+/*N*/ ? pStart->ContainsCntnt()
+/*N*/ : pStart->FindPageFrm()->FindFirstBodyCntnt();
+/*N*/ }
+/*N*/ if ( !pCntnt ) //irgendwann muessen wir mit irgendeinem Anfangen!
+/*N*/ {
+/*N*/ pCntnt = pStart->FindPageFrm()->GetUpper()->ContainsCntnt();
+/*N*/ while ( pCntnt && !pCntnt->IsInDocBody() )
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ if ( !pCntnt )
+/*N*/ return 0; //Es gibt noch keine Dokumentinhalt!
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ++nMaxPage;
+/*N*/ if ( pStart->GetPrev() )
+/*N*/ {
+/*N*/ if( !pStart->GetPrev()->IsLayoutFrm() )
+/*N*/ return 0;
+/*N*/ pStart = (SwLayoutFrm*)pStart->GetPrev();
+/*N*/ pCntnt = pStart->ContainsCntnt();
+/*N*/ }
+/*N*/ else //irgendwann muessen wir mit irgendeinem Anfangen!
+/*N*/ pCntnt = pStart->FindPageFrm()->GetUpper()->ContainsCntnt();
+/*N*/ }
+/*N*/ pActual = pCntnt;
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ASSERT( pActual, "Keinen Cntnt gefunden." );
+/*N*/ if ( bBodyOnly )
+/*N*/ ASSERT( pActual->IsInDocBody(), "Cnt nicht im Body." );
+/*N*/ #endif
+/*N*/
+/*N*/ //Spezialfall fuer das selektieren von Tabellen, nicht in wiederholte
+/*N*/ //TblHedlines.
+/*N*/ if ( pActual->IsInTab() && pCMS && pCMS->eState == MV_TBLSEL )
+/*N*/ {
+/*N*/ const SwTabFrm *pTab = pActual->FindTabFrm();
+/*N*/ if ( pTab->IsFollow() && pTab->GetTable()->IsHeadlineRepeat() &&
+/*N*/ ((SwLayoutFrm*)pTab->Lower())->IsAnLower( pActual ) )
+/*N*/ {
+/*N*/ ((SwCrsrMoveState*)pCMS)->bStop = TRUE;
+/*N*/ return 0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Jetzt noch eine kleine Korrektur beim ersten/letzten
+/*N*/ Size aActualSize( pActual->Prt().SSize() );
+/*N*/ if ( aActualSize.Height() > pActual->GetUpper()->Prt().Height() )
+/*N*/ aActualSize.Height() = pActual->GetUpper()->Prt().Height();
+/*N*/
+/*N*/ SWRECTFN( pActual )
+/*N*/ if ( !pActual->GetPrev() &&
+/*N*/ (*fnRect->fnYDiff)( (pActual->*fnRect->fnGetPrtTop)(),
+/*N*/ bVert ? rPoint.X() : rPoint.Y() ) > 0 )
+/*N*/ {
+/*N*/ aPoint.Y() = pActual->Frm().Top() + pActual->Prt().Top();
+/*N*/ aPoint.X() = pActual->Frm().Left() +
+/*N*/ ( pActual->IsRightToLeft() || bVert ?
+/*N*/ pActual->Prt().Right() :
+/*N*/ pActual->Prt().Left() );
+/*N*/ }
+/*N*/ else if ( !pActual->GetNext() &&
+/*N*/ (*fnRect->fnYDiff)( (pActual->*fnRect->fnGetPrtBottom)(),
+/*N*/ bVert ? rPoint.X() : rPoint.Y() ) < 0 )
+/*N*/ {
+/*N*/ aPoint.Y() = pActual->Frm().Top() + pActual->Prt().Bottom();
+/*N*/ aPoint.X() = pActual->Frm().Left() +
+/*N*/ ( pActual->IsRightToLeft() || bVert ?
+/*N*/ pActual->Prt().Left() :
+/*N*/ pActual->Prt().Right() );
+/*N*/ }
+/*N*/
+/*N*/ //Und den Point in die PrtArea bringen
+/*N*/ if ( bCalc )
+/*N*/ pActual->Calc();
+/*N*/ const SwRect aRect( pActual->Frm().Pos() + pActual->Prt().Pos(),
+/*N*/ aActualSize );
+/*N*/ if ( aPoint.Y() < aRect.Top() )
+/*N*/ aPoint.Y() = aRect.Top();
+/*N*/ else if ( aPoint.Y() > aRect.Bottom() )
+/*N*/ aPoint.Y() = aRect.Bottom();
+/*N*/ if ( aPoint.X() < aRect.Left() )
+/*N*/ aPoint.X() = aRect.Left();
+/*N*/ else if ( aPoint.X() > aRect.Right() )
+/*N*/ aPoint.X() = aRect.Right();
+/*N*/ rPoint = aPoint;
+/*N*/ return pActual;
+/*N*/ }
+
+/*N*/ #ifdef _MSC_VER
+/*N*/ #pragma optimize("",on)
+/*N*/ #endif
+
+/*************************************************************************
+|*
+|* SwPageFrm::GetCntntPosition()
+|*
+|* Beschreibung Analog zu SwLayoutFrm::GetCntntPos().
+|* Spezialisiert fuer Felder in Rahmen.
+|*
+|* Ersterstellung MA 22. Mar. 95
+|* Letzte Aenderung MA 07. Nov. 95
+|*
+|*************************************************************************/
+/*N*/ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const
+/*N*/ {
+/*N*/ //Ersten CntntFrm ermitteln.
+/*N*/ const SwCntntFrm *pCntnt = ContainsCntnt();
+/*N*/ if ( pCntnt )
+/*N*/ {
+/*N*/ //Einen weiter zurueck schauen (falls moeglich).
+/*N*/ const SwCntntFrm *pTmp = pCntnt->GetPrevCntntFrm();
+/*N*/ while ( pTmp && !pTmp->IsInDocBody() )
+/*?*/ pTmp = pTmp->GetPrevCntntFrm();
+/*N*/ if ( pTmp )
+/*?*/ pCntnt = pTmp;
+/*N*/ }
+/*N*/ else
+/*?*/ pCntnt = GetUpper()->ContainsCntnt();
+/*N*/
+/*N*/ const SwCntntFrm *pAct = pCntnt;
+/*N*/ Point aAct = rPt;
+/*N*/ ULONG nDist = ULONG_MAX;
+/*N*/
+/*N*/ while ( pCntnt )
+/*N*/ {
+/*N*/ SwRect aCntFrm( pCntnt->UnionFrm() );
+/*N*/ if ( aCntFrm.IsInside( rPt ) )
+/*N*/ {
+/*N*/ //dichter gehts nimmer.
+/*?*/ pAct = pCntnt;
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ //Die Strecke von rPt zum dichtesten Punkt von pCntnt berechnen.
+/*N*/ Point aPoint( rPt );
+/*N*/
+/*N*/ //Erst die vertikale Position einstellen
+/*N*/ if ( aCntFrm.Top() > rPt.Y() )
+/*N*/ aPoint.Y() = aCntFrm.Top();
+/*N*/ else if ( aCntFrm.Bottom() < rPt.Y() )
+/*N*/ aPoint.Y() = aCntFrm.Bottom();
+/*N*/
+/*N*/ //Jetzt die horizontale Position
+/*N*/ if ( aCntFrm.Left() > rPt.X() )
+/*N*/ aPoint.X() = aCntFrm.Left();
+/*N*/ else if ( aCntFrm.Right() < rPt.X() )
+/*N*/ aPoint.X() = aCntFrm.Right();
+/*N*/
+/*N*/ const ULONG nDiff = ::binfilter::CalcDiff( aPoint, rPt );
+/*N*/ if ( nDiff < nDist )
+/*N*/ {
+/*N*/ aAct = aPoint;
+/*N*/ nDist = nDiff;
+/*N*/ pAct = pCntnt;
+/*N*/ }
+/*N*/ else if ( aCntFrm.Top() > Frm().Bottom() )
+/*N*/ //Dichter wirds im Sinne der Felder nicht mehr!
+/*N*/ break;
+/*N*/
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ while ( pCntnt && !pCntnt->IsInDocBody() )
+/*N*/ pCntnt = pCntnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/
+/*N*/ //Und den Point in die PrtArea bringen
+/*N*/ const SwRect aRect( pAct->Frm().Pos() + pAct->Prt().Pos(), pAct->Prt().SSize() );
+/*N*/ if ( aAct.Y() < aRect.Top() )
+/*N*/ aAct.Y() = aRect.Top();
+/*N*/ else if ( aAct.Y() > aRect.Bottom() )
+/*N*/ aAct.Y() = aRect.Bottom();
+/*N*/ if ( aAct.X() < aRect.Left() )
+/*?*/ aAct.X() = aRect.Left();
+/*N*/ else if ( aAct.X() > aRect.Right() )
+/*N*/ aAct.X() = aRect.Right();
+/*N*/
+/*N*/ if( !pAct->IsValid() )
+/*N*/ {
+/*N*/ // CntntFrm nicht formatiert -> immer auf Node-Anfang
+/*?*/ SwCntntNode* pCNd = (SwCntntNode*)pAct->GetNode();
+/*?*/ ASSERT( pCNd, "Wo ist mein CntntNode?" );
+/*?*/ rPos.nNode = *pCNd;
+/*?*/ rPos.nContent.Assign( pCNd, 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwCrsrMoveState aTmpState( MV_SETONLYTEXT );
+/*N*/ pAct->GetCrsrOfst( &rPos, aAct, &aTmpState );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::GetNextPrevCntntPos()
+|*
+|* Beschreibung Es wird der naechstliegende Cntnt zum uebergebenen
+|* Point gesucht. Es wird nur im BodyText gesucht.
+|* Ersterstellung MA 15. Jul. 92
+|* Letzte Aenderung JP 11.10.2001
+|*
+|*************************************************************************/
+
+//!!!!! Es wird nur der vertikal naechstliegende gesucht.
+//JP 11.10.2001: only in tables we try to find the right column - Bug 72294
+
+/*************************************************************************
+|*
+|* SwRootFrm::GetPagePos()
+|*
+|* Beschreibung: Liefert die absolute Dokumentpositon der gewuenschten
+|* Seite.
+|* Formatiert wird nur soweit notwendig und nur dann wenn bFormat=TRUE
+|* Liefert Null, wenn die Operation nicht moeglich ist.
+|* Die Pos ist die der letzten Seite, wenn die Seitenzahl zu gross
+|* gewaehlt wurde.
+|* Ersterstellung MA 01. Jun. 92
+|* Letzte Aenderung MA 09. Oct. 97
+|*
+|*************************************************************************/
+
+/** get page frame by phyiscal page number
+
+ OD 14.01.2003 #103492#
+
+ @return pointer to the page frame with the given physical page number
+*/
+
+/*************************************************************************
+|*
+|* SwRootFrm::IsDummyPage(USHORT)
+|*
+|* Description: Returns TRUE, when the given physical pagenumber does't exist
+|* or this page is an empty page.
+|*************************************************************************/
+
+
+/*************************************************************************
+|*
+|* SwFrm::IsProtected()
+|*
+|* Beschreibung Ist der Frm bzw. die Section in der er steht
+|* geschuetzt?
+|* Auch Fly in Fly in ... und Fussnoten
+|*
+|* Ersterstellung MA 28. Jul. 93
+|* Letzte Aenderung MA 06. Nov. 97
+|*
+|*************************************************************************/
+/*N*/ BOOL SwFrm::IsProtected() const
+/*N*/ {
+/*N*/ //Der Frm kann in Rahmen, Zellen oder Bereichen geschuetzt sein.
+/*N*/ //Geht auch FlyFrms rekursiv hoch. Geht auch von Fussnoten zum Anker.
+/*N*/ const SwFrm *pFrm = this;
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pFrm->IsCntntFrm() )
+/*N*/ {
+/*N*/ if ( ((SwCntntFrm*)pFrm)->GetNode() &&
+/*N*/ ((SwCntntFrm*)pFrm)->GetNode()->IsInProtectSect() )
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( ((SwLayoutFrm*)pFrm)->GetFmt() &&
+/*N*/ ((SwLayoutFrm*)pFrm)->GetFmt()->
+/*N*/ GetProtect().IsCntntProtected() )
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ if ( pFrm->IsFlyFrm() )
+/*N*/ {
+/*N*/ //Der Schutz des Inhaltes kann bei Verkettung vom Master der Kette
+/*N*/ //vorgegeben werden.
+/*N*/ if ( ((SwFlyFrm*)pFrm)->GetPrevLink() )
+/*N*/ {
+/*N*/ SwFlyFrm *pMaster = (SwFlyFrm*)pFrm;
+/*N*/ do
+/*N*/ { pMaster = pMaster->GetPrevLink();
+/*N*/ } while ( pMaster->GetPrevLink() );
+/*N*/ if ( pMaster->IsProtected() )
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ pFrm = ((SwFlyFrm*)pFrm)->GetAnchor();
+/*N*/ }
+/*N*/ else if ( pFrm->IsFtnFrm() )
+/*N*/ pFrm = ((SwFtnFrm*)pFrm)->GetRef();
+/*N*/ else
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/
+/*N*/ } while ( pFrm );
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetPhyPageNum()
+|* Beschreibung: Liefert die physikalische Seitennummer
+|*
+|* Ersterstellung OK 06.07.93 08:35
+|* Letzte Aenderung MA 30. Nov. 94
+|*
+|*************************************************************************/
+/*N*/ USHORT SwFrm::GetPhyPageNum() const
+/*N*/ {
+/*N*/ const SwPageFrm *pPage = FindPageFrm();
+/*N*/ return pPage ? pPage->GetPhyPageNum() : 0;
+/*N*/ }
+
+/*-----------------26.02.01 11:25-------------------
+ * SwFrm::WannaRightPage()
+ * decides if the page want to be a rightpage or not.
+ * If the first content of the page has a page descriptor,
+ * we take the follow of the page descriptor of the last not empty page.
+ * If this descriptor allows only right(left) pages and the page
+ * isn't an empty page then it wanna be such right(left) page.
+ * If the descriptor allows right and left pages, we look for a number offset
+ * in the first content. If there is one, odd number results right pages,
+ * even number results left pages.
+ * If there is no number offset, we take the physical page number instead,
+ * but a previous empty page don't count.
+ * --------------------------------------------------*/
+
+/*N*/ BOOL SwFrm::WannaRightPage() const
+/*N*/ {
+/*N*/ const SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( !pPage || !pPage->GetUpper() )
+/*?*/ return TRUE;
+/*N*/
+/*N*/ const SwFrm *pFlow = pPage->FindFirstBodyCntnt();
+/*N*/ SwPageDesc *pDesc = 0;
+/*N*/ USHORT nPgNum = 0;
+/*N*/ if ( pFlow )
+/*N*/ {
+/*N*/ if ( pFlow->IsInTab() )
+/*N*/ pFlow = pFlow->FindTabFrm();
+/*N*/ const SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pFlow );
+/*N*/ if ( !pTmp->IsFollow() )
+/*N*/ {
+/*N*/ const SwFmtPageDesc& rPgDesc = pFlow->GetAttrSet()->GetPageDesc();
+/*N*/ pDesc = (SwPageDesc*)rPgDesc.GetPageDesc();
+/*N*/ nPgNum = rPgDesc.GetNumOffset();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pDesc )
+/*N*/ {
+/*N*/ SwPageFrm *pPrv = (SwPageFrm*)pPage->GetPrev();
+/*N*/ if( pPrv && pPrv->IsEmptyPage() )
+/*N*/ pPrv = (SwPageFrm*)pPrv->GetPrev();
+/*N*/ if( pPrv )
+/*N*/ pDesc = pPrv->GetPageDesc()->GetFollow();
+/*N*/ else
+/*N*/ {
+/*N*/ const SwDoc* pDoc = pPage->GetFmt()->GetDoc();
+/*N*/ pDesc = (SwPageDesc*)&pDoc->GetPageDesc( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ ASSERT( pDesc, "No pagedescriptor" );
+/*N*/ BOOL bOdd;
+/*N*/ if( nPgNum )
+/*N*/ bOdd = nPgNum % 2 ? TRUE : FALSE;
+/*N*/ else
+/*N*/ {
+/*N*/ bOdd = pPage->OnRightPage();
+/*N*/ if( pPage->GetPrev() && ((SwPageFrm*)pPage->GetPrev())->IsEmptyPage() )
+/*N*/ bOdd = !bOdd;
+/*N*/ }
+/*N*/ if( !pPage->IsEmptyPage() )
+/*N*/ {
+/*N*/ if( !pDesc->GetRightFmt() )
+/*N*/ bOdd = FALSE;
+/*N*/ else if( !pDesc->GetLeftFmt() )
+/*N*/ bOdd = TRUE;
+/*N*/ }
+/*N*/ return bOdd;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::GetVirtPageNum()
+|* Beschreibung: Liefert die virtuelle Seitennummer mit Offset
+|*
+|* Ersterstellung OK 06.07.93 08:35
+|* Letzte Aenderung MA 30. Nov. 94
+|*
+|*************************************************************************/
+/*N*/ USHORT SwFrm::GetVirtPageNum() const
+/*N*/ {
+/*N*/ const SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( !pPage || !pPage->GetUpper() )
+/*?*/ return 0;
+/*N*/
+/*N*/ USHORT nPhyPage = pPage->GetPhyPageNum();
+/*N*/ if ( !((SwRootFrm*)pPage->GetUpper())->IsVirtPageNum() )
+/*N*/ return nPhyPage;
+/*N*/
+/*N*/ //Den am naechsten stehenden Absatz mit virtueller Seitennummer suchen.
+/*N*/ //Da das rueckwaertsuchen insgesamt sehr viel Zeit verschlingt suchen
+/*N*/ //wir jetzt gezielt ueber die Abhaengigkeiten.
+/*N*/ //von den PageDescs bekommen wir die Attribute, von den Attributen
+/*N*/ //wiederum bekommen wir die Absaetze.
+/*N*/ const SwPageFrm *pVirtPage = 0;
+/*N*/ const SwFrm *pFrm = 0;
+/*N*/ const SfxItemPool &rPool = pPage->GetFmt()->GetDoc()->GetAttrPool();
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT nMaxItems = rPool.GetItemCount( RES_PAGEDESC );
+/*N*/ for( USHORT n = 0; n < nMaxItems; ++n )
+/*N*/ {
+/*N*/ if( 0 == (pItem = rPool.GetItem( RES_PAGEDESC, n ) ))
+/*N*/ continue;
+/*N*/
+/*N*/ const SwFmtPageDesc *pDesc = (SwFmtPageDesc*)pItem;
+/*N*/ if ( pDesc->GetNumOffset() && pDesc->GetDefinedIn() )
+/*N*/ {
+/*N*/ const SwModify *pMod = pDesc->GetDefinedIn();
+/*N*/ SwVirtPageNumInfo aInfo( pPage );
+/*N*/ pMod->GetInfo( aInfo );
+/*N*/ if ( aInfo.GetPage() )
+/*N*/ {
+/*N*/ if( !pVirtPage || ( pVirtPage && aInfo.GetPage()->
+/*N*/ GetPhyPageNum() > pVirtPage->GetPhyPageNum() ) )
+/*N*/ {
+/*N*/ pVirtPage = aInfo.GetPage();
+/*N*/ pFrm = aInfo.GetFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pFrm )
+/*N*/ return nPhyPage - pFrm->GetPhyPageNum() +
+/*N*/ pFrm->GetAttrSet()->GetPageDesc().GetNumOffset();
+/*N*/ return nPhyPage;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwRootFrm::MakeTblCrsrs()
+|*
+|* Ersterstellung MA 14. May. 93
+|* Letzte Aenderung MA 02. Feb. 94
+|*
+|*************************************************************************/
+//Ermitteln und einstellen derjenigen Zellen die von der Selektion
+//eingeschlossen sind.
+
+
+
+/*************************************************************************
+|*
+|* SwRootFrm::CalcFrmRects
+|*
+|* Ersterstellung MA 24. Aug. 92
+|* Letzte Aenderung MA 24. Aug. 93
+|*
+|*************************************************************************/
+
+/*
+ * nun koennen folgende Situationen auftreten:
+ * 1. Start und Ende liegen in einer Bildschirm - Zeile und im
+ * gleichen Node
+ * -> aus Start und End ein Rectangle, dann Ok
+ * 2. Start und Ende liegen in einem Frame (dadurch im gleichen Node!)
+ * -> Start nach rechts, End nach links erweitern,
+ * und bei mehr als 2 Bildschirm - Zeilen, das dazwischen
+ * liegende berechnen
+ * 3. Start und Ende liegen in verschiedenen Frames
+ * -> Start nach rechts erweitern, bis Frame-Ende Rect berechnen
+ * Ende nach links erweitern, bis Frame-Start Rect berechnen
+ * und bei mehr als 2 Frames von allen dazwischen liegenden
+ * Frames die PrtArea dazu.
+ * 4. Wenn es sich um eine Tabellenselektion handelt wird fuer jeden
+ * PaM im Ring der CellFrm besorgt, dessen PrtArea wird zu den
+ * Rechtecken addiert.
+ *
+ * Grosser Umbau wg. der FlyFrm; denn diese muessen ausgespart werden.
+ * Ausnahmen: - Der Fly in dem die Selektion stattfindet (wenn sie in einem Fly
+ * stattfindet).
+ * - Die Flys, die vom Text unterlaufen werden.
+ * Arbeitsweise: Zuerst wird eine SwRegion mit der Root initialisiert.
+ * Aus der Region werden die zu invertierenden Bereiche
+ * ausgestantzt. Die Region wird Komprimiert und letztlich
+ * invertiert. Damit liegen dann die zu invertierenden
+ * Rechtecke vor.
+ * Am Ende werden die Flys aus der Region ausgestanzt.
+ */
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_unusedf.cxx b/binfilter/bf_sw/source/core/layout/sw_unusedf.cxx
new file mode 100644
index 000000000000..19a6b9ba16f8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_unusedf.cxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "cntfrm.hxx"
+
+#include <horiornt.hxx>
+
+namespace binfilter {
+
+
+
+
+/*N*/ BOOL SwCntntFrm::WouldFit( SwTwips &, BOOL& )
+/*N*/ {
+/*N*/ ASSERT( FALSE, "WouldFit des CntntFrm gerufen." );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+
+
+
+
+
+/*N*/ BOOL SwFrm::GetCharRect( SwRect&, const SwPosition&,
+/*N*/ SwCrsrMoveState* ) const
+/*N*/ {
+/*N*/ ASSERT( FALSE, "GetCharRect() der Basis gerufen." );
+/*N*/ return FALSE;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/sw_wsfrm.cxx b/binfilter/bf_sw/source/core/layout/sw_wsfrm.cxx
new file mode 100644
index 000000000000..6a383476d172
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/sw_wsfrm.cxx
@@ -0,0 +1,3451 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <vcl/outdev.hxx>
+#include <bf_svtools/itemiter.hxx>
+#include <bf_svx/brshitem.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <pagefrm.hxx>
+#include <section.hxx>
+#include <dcontact.hxx>
+#include <viewimp.hxx>
+#include <doc.hxx>
+#include <fesh.hxx>
+#include <docsh.hxx>
+#include <frmtool.hxx>
+#include <ftninfo.hxx>
+#include <dflyobj.hxx>
+#include <hints.hxx>
+#include <fmtclbl.hxx>
+#include <fmtfsize.hxx>
+#include <fmtpdsc.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <fmtsrnd.hxx>
+#include <ftnfrm.hxx>
+#include <tabfrm.hxx>
+#include <flyfrms.hxx>
+#include <frmsh.hxx>
+#include <sectfrm.hxx>
+#include <fmtclds.hxx>
+#include <txtfrm.hxx>
+#include <ndtxt.hxx>
+#include <bodyfrm.hxx>
+#include <dbg_lay.hxx>
+#include <bf_svx/frmdiritem.hxx>
+namespace binfilter {
+
+
+
+
+/*************************************************************************
+|*
+|* SwFrm::SwFrm()
+|*
+|* Ersterstellung AK 12-Feb-1991
+|* Letzte Aenderung MA 05. Apr. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwFrm::SwFrm( SwModify *pMod ) :
+/*N*/ SwClient( pMod ),
+/*N*/ pPrev( 0 ),
+/*N*/ pNext( 0 ),
+/*N*/ pUpper( 0 ),
+/*N*/ pDrawObjs( 0 )
+/*N*/ #ifdef DBG_UTIL
+/*N*/ , nFrmId( SwFrm::nLastFrmId++ )
+/*N*/ #endif
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ bFlag01 = bFlag02 = bFlag03 = bFlag04 = bFlag05 = 0;
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static USHORT nStopAt = USHRT_MAX;
+/*N*/ if ( nFrmId == nStopAt )
+/*N*/ {
+/*N*/ int bla = 5;
+/*N*/ }
+/*N*/ #endif
+/*N*/ #endif
+/*N*/
+/*N*/ ASSERT( pMod, "Kein Frameformat uebergeben." );
+/*N*/ bInvalidR2L = bInvalidVert = 1;
+/*N*/ bDerivedR2L = bDerivedVert = bRightToLeft = bVertical = bReverse = 0;
+/*N*/ bValidPos = bValidPrtArea = bValidSize = bValidLineNum = bRetouche =
+/*N*/ bFixSize = bColLocked = FALSE;
+/*N*/ bCompletePaint = bInfInvalid = TRUE;
+/*N*/ }
+
+/*N*/ void SwFrm::CheckDir( UINT16 nDir, BOOL bVert, BOOL bOnlyBiDi, BOOL bBrowse )
+/*N*/ {
+/*N*/ if( FRMDIR_ENVIRONMENT == nDir || ( bVert && bOnlyBiDi ) )
+/*N*/ {
+/*N*/ bDerivedVert = 1;
+/*N*/ if( FRMDIR_ENVIRONMENT == nDir )
+/*N*/ bDerivedR2L = 1;
+/*N*/ SetDirFlags( bVert );
+/*N*/ }
+/*N*/ else if( bVert )
+/*N*/ {
+/*?*/ bInvalidVert = 0;
+/*?*/ if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir
+/*?*/ || bBrowse )
+/*?*/ bVertical = 0;
+/*?*/ else
+/*?*/ bVertical = 1;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ bInvalidR2L = 0;
+/*?*/ if( FRMDIR_HORI_RIGHT_TOP == nDir )
+/*?*/ bRightToLeft = 1;
+/*?*/ else
+/*?*/ bRightToLeft = 0;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwFrm::CheckDirection( BOOL bVert )
+/*N*/ {
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ if( !IsHeaderFrm() && !IsFooterFrm() )
+/*N*/ {
+/*N*/ bDerivedVert = 1;
+/*N*/ SetDirFlags( bVert );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bDerivedR2L = 1;
+/*N*/ SetDirFlags( bVert );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwSectionFrm::CheckDirection( BOOL bVert )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = GetFmt();
+/*N*/ if( pFmt )
+/*N*/ CheckDir(((SvxFrameDirectionItem&)pFmt->GetAttr(RES_FRAMEDIR)).GetValue(),
+/*N*/ bVert, sal_True, pFmt->GetDoc()->IsBrowseMode() );
+/*N*/ else
+/*?*/ SwFrm::CheckDirection( bVert );
+/*N*/ }
+
+
+/*N*/ void SwTabFrm::CheckDirection( BOOL bVert )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = GetFmt();
+/*N*/ if( pFmt )
+/*N*/ CheckDir(((SvxFrameDirectionItem&)pFmt->GetAttr(RES_FRAMEDIR)).GetValue(),
+/*N*/ bVert, sal_True, pFmt->GetDoc()->IsBrowseMode() );
+/*N*/ else
+/*?*/ SwFrm::CheckDirection( bVert );
+/*N*/ }
+
+/*N*/ void SwTxtFrm::CheckDirection( BOOL bVert )
+/*N*/ {
+/*N*/ CheckDir( GetTxtNode()->GetSwAttrSet().GetFrmDir().GetValue(), bVert,
+/*N*/ sal_True, GetTxtNode()->GetDoc()->IsBrowseMode() );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::Modify()
+|*
+|* Ersterstellung AK 01-Mar-1991
+|* Letzte Aenderung MA 20. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ BYTE nInvFlags = 0;
+/*N*/
+/*N*/ if( pNew && RES_ATTRSET_CHG == pNew->Which() )
+/*N*/ {
+/*N*/ SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
+/*N*/ SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
+/*N*/ (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags );
+/*N*/ if( aNIter.IsAtEnd() )
+/*N*/ break;
+/*N*/ aNIter.NextItem();
+/*N*/ aOIter.NextItem();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ _UpdateAttr( pOld, pNew, nInvFlags );
+/*N*/
+/*N*/ if ( nInvFlags != 0 )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ if ( nInvFlags & 0x01 )
+/*N*/ {
+/*N*/ _InvalidatePrt();
+/*N*/ if( !GetPrev() && IsTabFrm() && IsInSct() )
+/*?*/ FindSctFrm()->_InvalidatePrt();
+/*N*/ }
+/*N*/ if ( nInvFlags & 0x02 )
+/*N*/ _InvalidateSize();
+/*N*/ if ( nInvFlags & 0x04 )
+/*N*/ _InvalidatePos();
+/*N*/ if ( nInvFlags & 0x08 )
+/*N*/ SetCompletePaint();
+/*N*/ SwFrm *pNxt;
+/*N*/ if ( nInvFlags & 0x30 && 0 != (pNxt = GetNext()) )
+/*N*/ {
+/*N*/ pNxt->InvalidatePage( pPage );
+/*N*/ if ( nInvFlags & 0x10 )
+/*?*/ pNxt->_InvalidatePos();
+/*N*/ if ( nInvFlags & 0x20 )
+/*N*/ pNxt->SetCompletePaint();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwFrm::_UpdateAttr( SfxPoolItem *pOld, SfxPoolItem *pNew,
+/*N*/ BYTE &rInvFlags )
+/*N*/ {
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_BOX:
+/*N*/ case RES_SHADOW:
+/*N*/ Prepare( PREP_FIXSIZE_CHG );
+/*N*/ // hier kein break !
+/*N*/ case RES_LR_SPACE:
+/*N*/ case RES_UL_SPACE:
+/*N*/ rInvFlags |= 0x0B;
+/*N*/ break;
+/*N*/
+/*M*/ case RES_HEADER_FOOTER_EAT_SPACING:
+/*M*/ rInvFlags |= 0x03;
+/*M*/ break;
+/*M*/
+/*N*/ case RES_BACKGROUND:
+/*N*/ rInvFlags |= 0x28;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_KEEP:
+/*N*/ rInvFlags |= 0x04;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FRM_SIZE:
+/*N*/ ReinitializeFrmSizeAttrFlags();
+/*N*/ rInvFlags |= 0x13;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_FMT_CHG:
+/*N*/ rInvFlags |= 0x0F;
+/*N*/ break;
+/*N*/
+/*?*/ case RES_COL:
+/*?*/ ASSERT( FALSE, "Spalten fuer neuen FrmTyp?" );
+/*?*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ /* do Nothing */;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::Prepare()
+|* Ersterstellung MA 13. Apr. 93
+|* Letzte Aenderung MA 26. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::Prepare( const PrepareHint, const void *, BOOL )
+/*N*/ {
+/*N*/ /* Do nothing */
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::InvalidatePage()
+|* Beschreibung: Invalidiert die Seite, in der der Frm gerade steht.
+|* Je nachdem ob es ein Layout, Cntnt oder FlyFrm ist wird die Seite
+|* entsprechend Invalidiert.
+|* Ersterstellung MA 22. Jul. 92
+|* Letzte Aenderung MA 14. Oct. 94
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::InvalidatePage( const SwPageFrm *pPage ) const
+/*N*/ {
+/*N*/ #if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL)
+/*N*/ static USHORT nStop = 0;
+/*N*/ if ( nStop == GetFrmId() )
+/*N*/ {
+/*N*/ int bla = 5;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if ( !pPage )
+/*N*/ pPage = FindPageFrm();
+/*N*/
+/*N*/ if ( pPage && pPage->GetUpper() )
+/*N*/ {
+/*N*/ if ( pPage->GetFmt()->GetDoc()->IsInDtor() )
+/*?*/ return;
+/*N*/
+/*N*/ SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
+/*N*/ const SwFlyFrm *pFly = FindFlyFrm();
+/*N*/ if ( IsCntntFrm() )
+/*N*/ {
+/*N*/ if ( pRoot->IsTurboAllowed() )
+/*N*/ {
+/*N*/ // JP 21.09.95: wenn sich der ContentFrame 2 mal eintragen
+/*N*/ // will, kann es doch eine TurboAction bleiben.
+/*N*/ // ODER????
+/*N*/ if ( !pRoot->GetTurbo() || this == pRoot->GetTurbo() )
+/*N*/ pRoot->SetTurbo( (const SwCntntFrm*)this );
+/*N*/ else
+/*N*/ {
+/*N*/ pRoot->DisallowTurbo();
+/*N*/ //Die Seite des Turbo koennte eine andere als die meinige
+/*N*/ //sein, deshalb muss sie invalidiert werden.
+/*N*/ const SwFrm *pTmp = pRoot->GetTurbo();
+/*N*/ pRoot->ResetTurbo();
+/*N*/ pTmp->InvalidatePage();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !pRoot->GetTurbo() )
+/*N*/ {
+/*N*/ if ( pFly )
+/*N*/ { if( !pFly->IsLocked() )
+/*N*/ {
+/*N*/ if ( pFly->IsFlyInCntFrm() )
+/*N*/ { pPage->InvalidateFlyInCnt();
+/*N*/ ((SwFlyInCntFrm*)pFly)->InvalidateCntnt();
+/*N*/ pFly->GetAnchor()->InvalidatePage();
+/*N*/ }
+/*N*/ else
+/*N*/ pPage->InvalidateFlyCntnt();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pPage->InvalidateCntnt();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pRoot->DisallowTurbo();
+/*N*/ if ( pFly )
+/*N*/ { if( !pFly->IsLocked() )
+/*N*/ {
+/*N*/ if ( pFly->IsFlyInCntFrm() )
+/*N*/ { pPage->InvalidateFlyInCnt();
+/*N*/ ((SwFlyInCntFrm*)pFly)->InvalidateLayout();
+/*N*/ pFly->GetAnchor()->InvalidatePage();
+/*N*/ }
+/*N*/ else
+/*N*/ pPage->InvalidateFlyLayout();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pPage->InvalidateLayout();
+/*N*/
+/*N*/ if ( pRoot->GetTurbo() )
+/*N*/ { const SwFrm *pTmp = pRoot->GetTurbo();
+/*N*/ pRoot->ResetTurbo();
+/*N*/ pTmp->InvalidatePage();
+/*N*/ }
+/*N*/ }
+/*N*/ pRoot->SetIdleFlags();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::ChgSize()
+|*
+|* Ersterstellung AK 15-Feb-1991
+|* Letzte Aenderung MA 18. Nov. 98
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::ChgSize( const Size& aNewSize )
+/*N*/ {
+/*N*/ bFixSize = TRUE;
+/*N*/ const Size aOldSize( Frm().SSize() );
+/*N*/ if ( aNewSize == aOldSize )
+/*N*/ return;
+/*N*/
+/*N*/ if ( GetUpper() )
+/*N*/ {
+/*N*/ SWRECTFN2( this )
+/*N*/ SwRect aNew( Point(0,0), aNewSize );
+/*N*/ (aFrm.*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() );
+/*N*/ long nNew = (aNew.*fnRect->fnGetHeight)();
+/*N*/ long nDiff = nNew - (aFrm.*fnRect->fnGetHeight)();
+/*N*/ if( nDiff )
+/*N*/ {
+/*N*/ if ( GetUpper()->IsFtnBossFrm() && HasFixSize() &&
+/*N*/ NA_GROW_SHRINK !=
+/*N*/ ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this ) )
+/*N*/ {
+/*N*/ (aFrm.*fnRect->fnSetHeight)( nNew );
+/*N*/ SwTwips nReal = ((SwLayoutFrm*)this)->AdjustNeighbourhood(nDiff);
+/*N*/ if ( nReal != nDiff )
+/*N*/ (aFrm.*fnRect->fnSetHeight)( nNew - nDiff + nReal );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // OD 24.10.2002 #97265# - grow/shrink not for neighbour frames
+/*N*/ // NOTE: neighbour frames are cell and column frames.
+/*N*/ if ( !bNeighb )
+/*N*/ {
+/*N*/ if ( nDiff > 0 )
+/*N*/ Grow( nDiff );
+/*N*/ else
+/*N*/ Shrink( -nDiff );
+/*N*/
+/*N*/ if ( GetUpper() && (aFrm.*fnRect->fnGetHeight)() != nNew )
+/*N*/ GetUpper()->_InvalidateSize();
+/*N*/ }
+/*N*/
+/*N*/ // Auch wenn das Grow/Shrink noch nicht die gewuenschte Breite eingestellt hat,
+/*N*/ // wie z.B. beim Aufruf durch ChgColumns, um die Spaltenbreiten einzustellen,
+/*N*/ // wird die Breite jetzt gesetzt.
+/*N*/ (aFrm.*fnRect->fnSetHeight)( nNew );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ aFrm.SSize( aNewSize );
+/*N*/
+/*N*/ if ( Frm().SSize() != aOldSize )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ GetNext()->_InvalidatePos();
+/*N*/ GetNext()->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if( IsLayoutFrm() )
+/*N*/ {
+/*N*/ if( IsRightToLeft() )
+/*N*/ _InvalidatePos();
+/*N*/ if( ((SwLayoutFrm*)this)->Lower() )
+/*N*/ ((SwLayoutFrm*)this)->Lower()->_InvalidateSize();
+/*N*/ }
+/*N*/ _InvalidatePrt();
+/*N*/ _InvalidateSize();
+/*N*/ InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::InsertBefore()
+|*
+|* Beschreibung SwFrm wird in eine bestehende Struktur eingefuegt
+|* Eingefuegt wird unterhalb des Parent und entweder
+|* vor pBehind oder am Ende der Kette wenn pBehind
+|* leer ist.
+|* Letzte Aenderung MA 06. Aug. 99
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind )
+/*N*/ {
+/*N*/ ASSERT( pParent, "Kein Parent fuer Insert." );
+/*N*/ ASSERT( (!pBehind || (pBehind && pParent == pBehind->GetUpper())),
+/*N*/ "Framebaum inkonsistent." );
+/*N*/
+/*N*/ pUpper = pParent;
+/*N*/ pNext = pBehind;
+/*N*/ if( pBehind )
+/*N*/ { //Einfuegen vor pBehind.
+/*N*/ if( 0 != (pPrev = pBehind->pPrev) )
+/*N*/ pPrev->pNext = this;
+/*N*/ else
+/*N*/ pUpper->pLower = this;
+/*N*/ pBehind->pPrev = this;
+/*N*/ }
+/*N*/ else
+/*N*/ { //Einfuegen am Ende, oder als ersten Node im Unterbaum
+/*N*/ pPrev = pUpper->Lower();
+/*N*/ if ( pPrev )
+/*N*/ {
+/*N*/ while( pPrev->pNext )
+/*N*/ pPrev = pPrev->pNext;
+/*N*/ pPrev->pNext = this;
+/*N*/ }
+/*N*/ else
+/*N*/ pUpper->pLower = this;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::InsertBehind()
+|*
+|* Beschreibung SwFrm wird in eine bestehende Struktur eingefuegt
+|* Eingefuegt wird unterhalb des Parent und entweder
+|* hinter pBefore oder am Anfang der Kette wenn pBefore
+|* leer ist.
+|* Letzte Aenderung MA 06. Aug. 99
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore )
+/*N*/ {
+/*N*/ ASSERT( pParent, "Kein Parent fuer Insert." );
+/*N*/ ASSERT( (!pBefore || (pBefore && pParent == pBefore->GetUpper())),
+/*N*/ "Framebaum inkonsistent." );
+/*N*/
+/*N*/ pUpper = pParent;
+/*N*/ pPrev = pBefore;
+/*N*/ if ( pBefore )
+/*N*/ {
+/*N*/ //Einfuegen hinter pBefore
+/*N*/ if ( 0 != (pNext = pBefore->pNext) )
+/*N*/ pNext->pPrev = this;
+/*N*/ pBefore->pNext = this;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Einfuegen am Anfang der Kette
+/*N*/ pNext = pParent->Lower();
+/*N*/ if ( pParent->Lower() )
+/*N*/ pParent->Lower()->pPrev = this;
+/*N*/ pParent->pLower = this;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::InsertGroup()
+|*
+|* Beschreibung Eine Kette von SwFrms wird in eine bestehende Struktur
+|* eingefuegt
+|* Letzte Aenderung AMA 9. Dec. 97
+|*
+|* Bisher wird dies genutzt, um einen SectionFrame, der ggf. schon Geschwister
+|* mit sich bringt, in eine bestehende Struktur einzufuegen.
+|*
+|* Wenn man den dritten Parameter als NULL uebergibt, entspricht
+|* diese Methode dem SwFrm::InsertBefore(..), nur eben mit Geschwistern.
+|*
+|* Wenn man einen dritten Parameter uebergibt, passiert folgendes:
+|* this wird pNext von pParent,
+|* pSct wird pNext vom Letzten der this-Kette,
+|* pBehind wird vom pParent an den pSct umgehaengt.
+|* Dies dient dazu: ein SectionFrm (this) wird nicht als
+|* Kind an einen anderen SectionFrm (pParent) gehaengt, sondern pParent
+|* wird in zwei Geschwister aufgespalten (pParent+pSct) und this dazwischen
+|* eingebaut.
+|*
+|*************************************************************************/
+
+/*************************************************************************
+|*
+|* SwFrm::Remove()
+|*
+|* Ersterstellung AK 01-Mar-1991
+|* Letzte Aenderung MA 07. Dec. 95
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::Remove()
+/*N*/ {
+/*N*/ ASSERT( pUpper, "Removen ohne Upper?" );
+/*N*/
+/*N*/ if( pPrev )
+/*N*/ // einer aus der Mitte wird removed
+/*N*/ pPrev->pNext = pNext;
+/*N*/ else
+/*N*/ { // der erste in einer Folge wird removed
+/*N*/ ASSERT( pUpper->pLower == this, "Layout inkonsistent." );
+/*N*/ pUpper->pLower = pNext;
+/*N*/ }
+/*N*/ if( pNext )
+/*N*/ pNext->pPrev = pPrev;
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ // inform accessibility API
+/*N*/ if ( IsInTab() )
+/*N*/ {
+/*N*/ SwTabFrm* pTableFrm = FindTabFrm();
+/*N*/ if( pTableFrm != NULL &&
+/*N*/ pTableFrm->IsAccessibleFrm() &&
+/*N*/ pTableFrm->GetFmt() != NULL )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = pTableFrm->FindRootFrm();
+/*N*/ if( pRootFrm != NULL &&
+/*N*/ pRootFrm->IsAnyShellAccessible() )
+/*N*/ {
+/*N*/ ViewShell* pShell = pRootFrm->GetCurrShell();
+/*N*/ if( pShell != NULL )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pShell->Imp()->DisposeAccessibleFrm( pTableFrm, sal_True );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ // Verbindung kappen.
+/*N*/ pNext = pPrev = 0;
+/*N*/ pUpper = 0;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwCntntFrm::Paste()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 09. Sep. 98
+|*
+|*************************************************************************/
+/*N*/ void SwCntntFrm::Paste( SwFrm* pParent, SwFrm* pSibling)
+/*N*/ {
+/*N*/ ASSERT( pParent, "Kein Parent fuer Paste." );
+/*N*/ ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
+/*N*/ ASSERT( pParent != this, "Bin selbst der Parent." );
+/*N*/ ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
+/*N*/ ASSERT( !GetPrev() && !GetNext() && !GetUpper(),
+/*N*/ "Bin noch irgendwo angemeldet." );
+/*N*/
+/*N*/ //In den Baum einhaengen.
+/*N*/ InsertBefore( (SwLayoutFrm*)pParent, pSibling );
+/*N*/
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ _InvalidateAll();
+/*N*/ InvalidatePage( pPage );
+/*N*/
+/*N*/ if( pPage )
+/*N*/ {
+/*N*/ pPage->InvalidateSpelling();
+/*N*/ pPage->InvalidateAutoCompleteWords();
+/*N*/ }
+/*N*/
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ SwFrm* pNxt = GetNext();
+/*N*/ pNxt->_InvalidatePrt();
+/*N*/ pNxt->_InvalidatePos();
+/*N*/ pNxt->InvalidatePage( pPage );
+/*N*/ if( pNxt->IsSctFrm() )
+/*?*/ pNxt = ((SwSectionFrm*)pNxt)->ContainsCntnt();
+/*N*/ if( pNxt && pNxt->IsTxtFrm() && pNxt->IsInFtn() )
+/*?*/ pNxt->Prepare( PREP_FTN, 0, FALSE );
+/*N*/ }
+/*N*/
+/*N*/ if ( Frm().Height() )
+/*N*/ pParent->Grow( Frm().Height() PHEIGHT );
+/*N*/
+/*N*/ if ( Frm().Width() != pParent->Prt().Width() )
+/*N*/ Prepare( PREP_FIXSIZE_CHG );
+/*N*/
+/*N*/ if ( GetPrev() )
+/*N*/ {
+/*N*/ if ( IsFollow() )
+/*N*/ //Ich bin jetzt direkter Nachfolger meines Masters geworden
+/*N*/ ((SwCntntFrm*)GetPrev())->Prepare( PREP_FOLLOW_FOLLOWS );
+/*N*/ else
+/*N*/ {
+/*N*/ if ( GetPrev()->Frm().Height() !=
+/*N*/ GetPrev()->Prt().Height() + GetPrev()->Prt().Top() )
+/*N*/ //Umrandung zu beruecksichtigen?
+/*N*/ GetPrev()->_InvalidatePrt();
+/*N*/ // OD 18.02.2003 #104989# - force complete paint of previous frame,
+/*N*/ // if frame is inserted at the end of a section frame, in order to
+/*N*/ // get subsidiary lines repainted for the section.
+/*N*/ if ( pParent->IsSctFrm() && !GetNext() )
+/*N*/ {
+/*N*/ // force complete paint of previous frame, if new inserted frame
+/*N*/ // in the section is the last one.
+/*N*/ GetPrev()->SetCompletePaint();
+/*N*/ }
+/*N*/ GetPrev()->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( IsInFtn() )
+/*N*/ {
+/*N*/ SwFrm* pFrm = GetIndPrev();
+/*N*/ if( pFrm && pFrm->IsSctFrm() )
+/*?*/ pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if( pFrm )
+/*N*/ pFrm->Prepare( PREP_QUOVADIS, 0, FALSE );
+/*N*/ if( !GetNext() )
+/*N*/ {
+/*N*/ pFrm = FindFtnFrm()->GetNext();
+/*N*/ if( pFrm && 0 != (pFrm=((SwLayoutFrm*)pFrm)->ContainsAny()) )
+/*?*/ pFrm->_InvalidatePrt();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ _InvalidateLineNum();
+/*N*/ SwFrm *pNxt = FindNextCnt();
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ while ( pNxt && pNxt->IsInTab() )
+/*N*/ {
+/*N*/ if( 0 != (pNxt = pNxt->FindTabFrm()) )
+/*N*/ pNxt = pNxt->FindNextCnt();
+/*N*/ }
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ pNxt->_InvalidateLineNum();
+/*N*/ if ( pNxt != GetNext() )
+/*N*/ pNxt->InvalidatePage();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::Cut()
+|*
+|* Ersterstellung AK 14-Feb-1991
+|* Letzte Aenderung MA 09. Sep. 98
+|*
+|*************************************************************************/
+/*N*/ void SwCntntFrm::Cut()
+/*N*/ {
+/*N*/ ASSERT( GetUpper(), "Cut ohne Upper()." );
+/*N*/
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ SwFrm *pFrm = GetIndPrev();
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsSctFrm() )
+/*N*/ pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if ( pFrm && pFrm->IsCntntFrm() )
+/*N*/ {
+/*N*/ pFrm->_InvalidatePrt();
+/*N*/ if( IsInFtn() )
+/*N*/ pFrm->Prepare( PREP_QUOVADIS, 0, FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwFrm *pNxt = FindNextCnt();
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ while ( pNxt && pNxt->IsInTab() )
+/*N*/ {
+/*N*/ if( 0 != (pNxt = pNxt->FindTabFrm()) )
+/*N*/ pNxt = pNxt->FindNextCnt();
+/*N*/ }
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ pNxt->_InvalidateLineNum();
+/*N*/ if ( pNxt != GetNext() )
+/*N*/ pNxt->InvalidatePage();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( 0 != (pFrm = GetIndNext()) )
+/*N*/ { //Der alte Nachfolger hat evtl. einen Abstand zum Vorgaenger
+/*N*/ //berechnet, der ist jetzt, wo er der erste wird obsolet bzw. anders.
+/*N*/ pFrm->_InvalidatePrt();
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ if( pFrm->IsSctFrm() )
+/*N*/ {
+/*N*/ pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if( pFrm )
+/*N*/ {
+/*N*/ pFrm->_InvalidatePrt();
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ if( pFrm && IsInFtn() )
+/*?*/ pFrm->Prepare( PREP_ERGOSUM, 0, FALSE );
+/*N*/ if( IsInSct() && !GetPrev() )
+/*N*/ {
+/*N*/ SwSectionFrm* pSct = FindSctFrm();
+/*N*/ if( !pSct->IsFollow() )
+/*N*/ {
+/*N*/ pSct->_InvalidatePrt();
+/*N*/ pSct->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ InvalidateNextPos();
+/*N*/ //Einer muss die Retusche uebernehmen: Vorgaenger oder Upper
+/*N*/ if ( 0 != (pFrm = GetPrev()) )
+/*N*/ { pFrm->SetRetouche();
+/*N*/ pFrm->Prepare( PREP_WIDOWS_ORPHANS );
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ pFrm->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ //Wenn ich der einzige CntntFrm in meinem Upper bin (war), so muss
+/*N*/ //er die Retouche uebernehmen.
+/*N*/ //Ausserdem kann eine Leerseite entstanden sein.
+/*N*/ else
+/*N*/ { SwRootFrm *pRoot = FindRootFrm();
+/*N*/ if ( pRoot )
+/*N*/ {
+/*N*/ pRoot->SetSuperfluous();
+/*N*/ GetUpper()->SetCompletePaint();
+/*N*/ GetUpper()->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if( IsInSct() )
+/*N*/ {
+/*N*/ SwSectionFrm* pSct = FindSctFrm();
+/*N*/ if( !pSct->IsFollow() )
+/*N*/ {
+/*?*/ pSct->_InvalidatePrt();
+/*?*/ pSct->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ //Erst removen, dann Upper Shrinken.
+/*N*/ SwLayoutFrm *pUp = GetUpper();
+/*N*/ Remove();
+/*N*/ if ( pUp )
+/*N*/ {
+/*N*/ SwSectionFrm *pSct;
+/*N*/ if ( !pUp->Lower() && ( ( pUp->IsFtnFrm() && !pUp->IsColLocked() )
+/*N*/ || ( pUp->IsInSct() && !(pSct = pUp->FindSctFrm())->ContainsCntnt() ) ) )
+/*N*/ {
+/*N*/ if ( pUp->GetUpper() )
+/*N*/ {
+/*N*/ if( pUp->IsFtnFrm() )
+/*N*/ {
+/*?*/ if( pUp->GetNext() && !pUp->GetPrev() )
+/*?*/ {
+/*?*/ SwFrm* pTmp = ((SwLayoutFrm*)pUp->GetNext())->ContainsAny();
+/*?*/ if( pTmp )
+/*?*/ pTmp->_InvalidatePrt();
+/*?*/ }
+/*?*/ pUp->Cut();
+/*?*/ delete pUp;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pSct->IsColLocked() || !pSct->IsInFtn() )
+/*N*/ {
+/*N*/ pSct->DelEmpty( FALSE );
+/*N*/ // Wenn ein gelockter Bereich nicht geloescht werden darf,
+/*N*/ // so ist zumindest seine Groesse durch das Entfernen seines
+/*N*/ // letzten Contents ungueltig geworden.
+/*N*/ pSct->_InvalidateSize();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ pSct->DelEmpty( TRUE );
+/*?*/ delete pSct;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nFrmHeight )
+/*N*/ pUp->Shrink( nFrmHeight );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::Paste()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 23. Feb. 94
+|*
+|*************************************************************************/
+/*N*/ void SwLayoutFrm::Paste( SwFrm* pParent, SwFrm* pSibling)
+/*N*/ {
+/*N*/ ASSERT( pParent, "Kein Parent fuer Paste." );
+/*N*/ ASSERT( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
+/*N*/ ASSERT( pParent != this, "Bin selbst der Parent." );
+/*N*/ ASSERT( pSibling != this, "Bin mein eigener Nachbar." );
+/*N*/ ASSERT( !GetPrev() && !GetNext() && !GetUpper(),
+/*N*/ "Bin noch irgendwo angemeldet." );
+/*N*/
+/*N*/ //In den Baum einhaengen.
+/*N*/ InsertBefore( (SwLayoutFrm*)pParent, pSibling );
+/*N*/
+ // OD 24.10.2002 #103517# - correct setting of variable <fnRect>
+ // <fnRect> is used for the following:
+ // (1) To invalidate the frame's size, if its size, which has to be the
+ // same as its upper/parent, differs from its upper's/parent's.
+ // (2) To adjust/grow the frame's upper/parent, if it has a dimension in its
+ // size, which is not determined by its upper/parent.
+ // Which size is which depends on the frame type and the layout direction
+ // (vertical or horizontal).
+ // There are the following cases:
+ // (A) Header and footer frames both in vertical and in horizontal layout
+ // have to size the width to the upper/parent. A dimension in the height
+ // has to cause a adjustment/grow of the upper/parent.
+ // --> <fnRect> = fnRectHori
+ // (B) Cell and column frames in vertical layout, the width has to be the
+ // same as upper/parent and a dimension in height causes adjustment/grow
+ // of the upper/parent.
+ // --> <fnRect> = fnRectHori
+ // in horizontal layout the other way around
+ // --> <fnRect> = fnRectVert
+ // (C) Other frames in vertical layout, the height has to be the
+ // same as upper/parent and a dimension in width causes adjustment/grow
+ // of the upper/parent.
+ // --> <fnRect> = fnRectVert
+ // in horizontal layout the other way around
+ // --> <fnRect> = fnRectHori
+ //SwRectFn fnRect = IsVertical() ? fnRectHori : fnRectVert;
+/*N*/ SwRectFn fnRect;
+/*N*/ if ( IsHeaderFrm() || IsFooterFrm() )
+/*N*/ fnRect = fnRectHori;
+/*N*/ else if ( IsCellFrm() || IsColumnFrm() )
+/*N*/ fnRect = GetUpper()->IsVertical() ? fnRectHori : fnRectVert;
+/*N*/ else
+/*N*/ fnRect = GetUpper()->IsVertical() ? fnRectVert : fnRectHori;
+/*N*/
+/*N*/ if( (Frm().*fnRect->fnGetWidth)() != (pParent->Prt().*fnRect->fnGetWidth)())
+/*N*/ _InvalidateSize();
+/*N*/ _InvalidatePos();
+/*N*/ const SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ SwFrm *pFrm;
+/*N*/ if( !IsColumnFrm() )
+/*N*/ {
+/*N*/ if( 0 != ( pFrm = GetIndNext() ) )
+/*N*/ {
+/*N*/ pFrm->_InvalidatePos();
+/*N*/ if( IsInFtn() )
+/*N*/ {
+/*N*/ if( pFrm->IsSctFrm() )
+/*?*/ pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if( pFrm )
+/*N*/ pFrm->Prepare( PREP_ERGOSUM, 0, FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( IsInFtn() && 0 != ( pFrm = GetIndPrev() ) )
+/*N*/ {
+/*N*/ if( pFrm->IsSctFrm() )
+/*?*/ pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
+/*N*/ if( pFrm )
+/*N*/ pFrm->Prepare( PREP_QUOVADIS, 0, FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( (Frm().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ // AdjustNeighbourhood wird jetzt auch in Spalten aufgerufen,
+/*N*/ // die sich nicht in Rahmen befinden
+/*N*/ BYTE nAdjust = GetUpper()->IsFtnBossFrm() ?
+/*N*/ ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
+/*N*/ : NA_GROW_SHRINK;
+/*N*/ SwTwips nGrow = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( NA_ONLY_ADJUST == nAdjust )
+/*N*/ AdjustNeighbourhood( nGrow );
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nReal = 0;
+/*N*/ if( NA_ADJUST_GROW == nAdjust )
+/*?*/ nReal = AdjustNeighbourhood( nGrow );
+/*N*/ if( nReal < nGrow )
+/*N*/ nReal += pParent->Grow( nGrow - nReal );
+/*N*/ if( NA_GROW_ADJUST == nAdjust && nReal < nGrow )
+/*?*/ AdjustNeighbourhood( nGrow - nReal );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::Cut()
+|*
+|* Ersterstellung MA 23. Feb. 94
+|* Letzte Aenderung MA 23. Feb. 94
+|*
+|*************************************************************************/
+/*N*/ void SwLayoutFrm::Cut()
+/*N*/ {
+/*N*/ if ( GetNext() )
+/*N*/ GetNext()->_InvalidatePos();
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ SwTwips nShrink = (Frm().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ //Erst removen, dann Upper Shrinken.
+/*N*/ SwLayoutFrm *pUp = GetUpper();
+/*N*/
+/*N*/ // AdjustNeighbourhood wird jetzt auch in Spalten aufgerufen,
+/*N*/ // die sich nicht in Rahmen befinden
+/*N*/
+/*N*/ // Remove must not be called before a AdjustNeighbourhood, but it has to
+/*N*/ // be called before the upper-shrink-call, if the upper-shrink takes care
+/*N*/ // of his content
+/*N*/ if ( pUp && nShrink )
+/*N*/ {
+/*N*/ if( pUp->IsFtnBossFrm() )
+/*N*/ {
+/*N*/ BYTE nAdjust= ((SwFtnBossFrm*)pUp)->NeighbourhoodAdjustment( this );
+/*N*/ if( NA_ONLY_ADJUST == nAdjust )
+/*N*/ AdjustNeighbourhood( -nShrink );
+/*N*/ else
+/*N*/ {
+/*?*/ SwTwips nReal = 0;
+/*?*/ if( NA_ADJUST_GROW == nAdjust )
+/*?*/ nReal = -AdjustNeighbourhood( -nShrink );
+/*?*/ if( nReal < nShrink )
+/*?*/ {
+/*?*/ SwTwips nOldHeight = (Frm().*fnRect->fnGetHeight)();
+/*?*/ (Frm().*fnRect->fnSetHeight)( 0 );
+/*?*/ nReal += pUp->Shrink( nShrink - nReal );
+/*?*/ (Frm().*fnRect->fnSetHeight)( nOldHeight );
+/*?*/ }
+/*?*/ if( NA_GROW_ADJUST == nAdjust && nReal < nShrink )
+/*?*/ AdjustNeighbourhood( nReal - nShrink );
+/*N*/ }
+/*N*/ Remove();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Remove();
+/*N*/ pUp->Shrink( nShrink );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ Remove();
+/*N*/
+/*N*/ if( pUp && !pUp->Lower() )
+/*N*/ {
+/*N*/ pUp->SetCompletePaint();
+/*N*/ pUp->InvalidatePage();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::Grow()
+|*
+|* Ersterstellung AK 19-Feb-1991
+|* Letzte Aenderung MA 05. May. 94
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwFrm::Grow( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ ASSERT( nDist >= 0, "Negatives Wachstum?" );
+/*N*/
+/*N*/ PROTOCOL_ENTER( this, bTst ? PROT_GROW_TST : PROT_GROW, 0, &nDist )
+/*N*/
+/*N*/ if ( nDist )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/
+/*N*/ SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ if( nPrtHeight > 0 && nDist > (LONG_MAX - nPrtHeight) )
+/*N*/ nDist = LONG_MAX - nPrtHeight;
+/*N*/
+/*N*/ if ( IsFlyFrm() )
+/*N*/ return ((SwFlyFrm*)this)->_Grow( nDist, bTst );
+/*N*/ else if( IsSctFrm() )
+/*N*/ return ((SwSectionFrm*)this)->_Grow( nDist, bTst );
+/*N*/ else
+/*N*/ {
+/*N*/ const SwTwips nReal = GrowFrm( nDist, bTst, bInfo );
+/*N*/ if( !bTst )
+/*N*/ {
+/*N*/ nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ (Prt().*fnRect->fnSetHeight)( nPrtHeight +
+/*N*/ ( IsCntntFrm() ? nDist : nReal ) );
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+/*N*/ }
+/*N*/ return 0L;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::Shrink()
+|*
+|* Ersterstellung AK 14-Feb-1991
+|* Letzte Aenderung MA 05. May. 94
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwFrm::Shrink( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ ASSERT( nDist >= 0, "Negative Verkleinerung?" );
+/*N*/
+/*N*/ PROTOCOL_ENTER( this, bTst ? PROT_SHRINK_TST : PROT_SHRINK, 0, &nDist )
+/*N*/
+/*N*/ if ( nDist )
+/*N*/ {
+/*N*/ if ( IsFlyFrm() )
+/*N*/ return ((SwFlyFrm*)this)->_Shrink( nDist, bTst );
+/*N*/ else if( IsSctFrm() )
+/*N*/ return ((SwSectionFrm*)this)->_Shrink( nDist, bTst );
+/*N*/ else
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ SwTwips nReal = (Frm().*fnRect->fnGetHeight)();
+/*N*/ ShrinkFrm( nDist, bTst, bInfo );
+/*N*/ nReal -= (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( !bTst )
+/*N*/ {
+/*N*/ SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ (Prt().*fnRect->fnSetHeight)( nPrtHeight -
+/*N*/ ( IsCntntFrm() ? nDist : nReal ) );
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+/*N*/ }
+/*?*/ return 0L;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::AdjustNeighbourhood()
+|*
+|* Beschreibung Wenn sich die Groesse eines Frm's direkt unterhalb
+|* eines Fussnotenbosses (Seite/Spalte) veraendert hat, so muss dieser
+|* "Normalisiert" werden.
+|* Es gibt dort immer einen Frame, der den "maximal moeglichen" Raum
+|* einnimmt (der Frame, der den Body.Text enhaelt) und keinen oder
+|* mehrere Frames die den Platz einnehmen den sie halt brauchen
+|* (Kopf-/Fussbereich, Fussnoten).
+|* Hat sich einer der Frames veraendert, so muss der Body-Text-Frame
+|* entsprechen wachsen oder schrumpfen; unabhaegig davon, dass er fix ist.
+|* !! Ist es moeglich dies allgemeiner zu loesen, also nicht auf die
+|* Seite beschraenkt und nicht auf einen Speziellen Frame, der den
+|* maximalen Platz einnimmt (gesteuert ueber Attribut FrmSize)? Probleme:
+|* Was ist wenn mehrere Frames nebeneinander stehen, die den maximalen
+|* Platz einnehmen?
+|* Wie wird der Maximale Platz berechnet?
+|* Wie klein duerfen diese Frames werden?
+|*
+|* Es wird auf jeden Fall nur so viel Platz genehmigt, dass ein
+|* Minimalwert fuer die Hoehe des Bodys nicht unterschritten wird.
+|*
+|* Parameter: nDiff ist der Betrag, um den Platz geschaffen werden muss
+|*
+|* Ersterstellung MA 07. May. 92
+|* Letzte Aenderung AMA 02. Nov. 98
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, BOOL bTst )
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( this, PROT_ADJUSTN, 0, &nDiff );
+/*N*/
+/*N*/ if ( !nDiff || !GetUpper()->IsFtnBossFrm() ) // nur innerhalb von Seiten/Spalten
+/*?*/ return 0L;
+/*N*/
+/*N*/ FASTBOOL bBrowse = GetUpper()->GetFmt()->GetDoc()->IsBrowseMode();
+/*N*/
+/*N*/ //Der (Page)Body veraendert sich nur im BrowseMode, aber nicht wenn er
+/*N*/ //Spalten enthaelt.
+/*N*/ if ( IsPageBodyFrm() && (!bBrowse ||
+/*N*/ (((SwLayoutFrm*)this)->Lower() &&
+/*N*/ ((SwLayoutFrm*)this)->Lower()->IsColumnFrm())) )
+/*N*/ return 0L;
+/*N*/
+/*N*/ //In der BrowseView kann der PageFrm selbst ersteinmal einiges von den
+/*N*/ //Wuenschen abfangen.
+/*N*/ long nBrowseAdd = 0;
+/*N*/ if ( bBrowse && GetUpper()->IsPageFrm() ) // nur (Page)BodyFrms
+/*N*/ {
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ SwLayoutFrm *pUp = GetUpper();
+/*N*/ long nChg;
+/*N*/ const long nUpPrtBottom = pUp->Frm().Height() -
+/*N*/ pUp->Prt().Height() - pUp->Prt().Top();
+/*N*/ SwRect aInva( pUp->Frm() );
+/*N*/ if ( pSh )
+/*N*/ {
+/*N*/ aInva.Pos().X() = pSh->VisArea().Left();
+/*N*/ aInva.Width( pSh->VisArea().Width() );
+/*N*/ }
+/*N*/ if ( nDiff > 0 )
+/*N*/ {
+/*N*/ nChg = BROWSE_HEIGHT - pUp->Frm().Height();
+/*N*/ nChg = Min( nDiff, nChg );
+/*N*/
+/*N*/ if ( !IsBodyFrm() )
+/*N*/ {
+/*?*/ SetCompletePaint();
+/*?*/ if ( !pSh || pSh->VisArea().Height() >= pUp->Frm().Height() )
+/*?*/ {
+/*?*/ //Ersteinmal den Body verkleinern. Der waechst dann schon
+/*?*/ //wieder.
+/*?*/ SwFrm *pBody = ((SwFtnBossFrm*)pUp)->FindBodyCont();
+/*?*/ const long nTmp = nChg - pBody->Prt().Height();
+/*?*/ if ( !bTst )
+/*?*/ {
+/*?*/ pBody->Frm().Height(Max( 0L, pBody->Frm().Height() - nChg ));
+/*?*/ pBody->_InvalidatePrt();
+/*?*/ pBody->_InvalidateSize();
+/*?*/ if ( pBody->GetNext() )
+/*?*/ pBody->GetNext()->_InvalidatePos();
+/*?*/ if ( !IsHeaderFrm() )
+/*?*/ pBody->SetCompletePaint();
+/*?*/ }
+/*?*/ nChg = nTmp <= 0 ? 0 : nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const long nTmp = nUpPrtBottom + 20;
+/*N*/ aInva.Top( aInva.Bottom() - nTmp );
+/*N*/ aInva.Height( nChg + nTmp );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Die Seite kann bis auf 0 schrumpfen. Die erste Seite bleibt
+/*N*/ //mindestens so gross wie die VisArea.
+/*N*/ nChg = nDiff;
+/*N*/ long nInvaAdd = 0;
+/*N*/ if ( pSh && !pUp->GetPrev() &&
+/*N*/ pUp->Frm().Height() + nDiff < pSh->VisArea().Height() )
+/*N*/ {
+/*?*/ //Das heisst aber wiederum trotzdem, das wir geeignet invalidieren
+/*?*/ //muessen.
+/*?*/ nChg = pSh->VisArea().Height() - pUp->Frm().Height();
+/*?*/ nInvaAdd = -(nDiff - nChg);
+/*N*/ }
+/*N*/
+/*N*/ //Invalidieren inklusive unterem Rand.
+/*N*/ long nBorder = nUpPrtBottom + 20;
+/*N*/ nBorder -= nChg;
+/*N*/ aInva.Top( aInva.Bottom() - (nBorder+nInvaAdd) );
+/*N*/ if ( !IsBodyFrm() )
+/*N*/ {
+/*?*/ SetCompletePaint();
+/*?*/ if ( !IsHeaderFrm() )
+/*?*/ ((SwFtnBossFrm*)pUp)->FindBodyCont()->SetCompletePaint();
+/*N*/ }
+/*N*/ //Wegen der Rahmen die Seite invalidieren. Dadurch wird die Seite
+/*N*/ //wieder entsprechend gross wenn ein Rahmen nicht passt. Das
+/*N*/ //funktioniert anderfalls nur zufaellig fuer absatzgebundene Rahmen
+/*N*/ //(NotifyFlys).
+/*N*/ pUp->InvalidateSize();
+/*N*/ }
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ //Unabhaengig von nChg
+/*N*/ if ( pSh && aInva.HasArea() && pUp->GetUpper() )
+/*?*/ pSh->InvalidateWindows( aInva );
+/*N*/ }
+/*N*/ if ( !bTst && nChg )
+/*N*/ {
+/*N*/ const SwRect aOldRect( pUp->Frm() );
+/*N*/ pUp->Frm().SSize().Height() += nChg;
+/*N*/ pUp->Prt().SSize().Height() += nChg;
+/*N*/ if ( pSh )
+/*N*/ pSh->Imp()->SetFirstVisPageInvalid();
+/*N*/
+/*N*/ if ( GetNext() )
+/*?*/ GetNext()->_InvalidatePos();
+/*N*/
+/*N*/ //Ggf. noch ein Repaint ausloesen.
+/*N*/ const SvxGraphicPosition ePos = pUp->GetFmt()->GetBackground().GetGraphicPos();
+/*N*/ if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
+/*?*/ pSh->InvalidateWindows( pUp->Frm() );
+/*N*/
+/*N*/ if ( pUp->GetUpper() )
+/*N*/ {
+/*N*/ if ( pUp->GetNext() )
+/*N*/ pUp->GetNext()->InvalidatePos();
+/*N*/
+/*N*/ //Mies aber wahr: im Notify am ViewImp wird evtl. ein Calc
+/*N*/ //auf die Seite und deren Lower gerufen. Die Werte sollten
+/*N*/ //unverandert bleiben, weil der Aufrufer bereits fuer die
+/*N*/ //Anpassung von Frm und Prt sorgen wird.
+/*N*/ const long nOldFrmHeight = Frm().Height();
+/*N*/ const long nOldPrtHeight = Prt().Height();
+/*N*/ const BOOL bOldComplete = IsCompletePaint();
+/*N*/ if ( IsBodyFrm() )
+/*N*/ Prt().SSize().Height() = nOldFrmHeight;
+/*N*/ ((SwPageFrm*)pUp)->AdjustRootSize( CHG_CHGPAGE, &aOldRect );
+/*N*/ Frm().SSize().Height() = nOldFrmHeight;
+/*N*/ Prt().SSize().Height() = nOldPrtHeight;
+/*N*/ bCompletePaint = bOldComplete;
+/*N*/ }
+/*N*/ if ( !IsBodyFrm() )
+/*?*/ pUp->_InvalidateSize();
+/*N*/ InvalidatePage( (SwPageFrm*)pUp );
+/*N*/ }
+/*N*/ nDiff -= nChg;
+/*N*/ if ( !nDiff )
+/*N*/ return nChg;
+/*N*/ else
+/*N*/ nBrowseAdd = nChg;
+/*N*/ }
+/*N*/
+/*N*/ const SwFtnBossFrm *pBoss = (SwFtnBossFrm*)GetUpper();
+/*N*/
+/*N*/ SwTwips nReal = 0,
+/*N*/ nAdd = 0;
+/*N*/ SwFrm *pFrm = 0;
+/*N*/ SWRECTFN( this )
+/*N*/
+/*N*/ if( IsBodyFrm() )
+/*N*/ {
+/*N*/ if( IsInSct() )
+/*N*/ {
+/*?*/ SwSectionFrm *pSect = FindSctFrm();
+/*?*/ if( nDiff > 0 && pSect->IsEndnAtEnd() && GetNext() &&
+/*?*/ GetNext()->IsFtnContFrm() )
+/*?*/ {
+/*?*/ SwFtnContFrm* pCont = (SwFtnContFrm*)GetNext();
+/*?*/ SwTwips nMinH = 0;
+/*?*/ SwFtnFrm* pFtn = (SwFtnFrm*)pCont->Lower();
+/*?*/ BOOL bFtn = FALSE;
+/*?*/ while( pFtn )
+/*?*/ {
+/*?*/ if( !pFtn->GetAttr()->GetFtn().IsEndNote() )
+/*?*/ {
+/*?*/ nMinH += (pFtn->Frm().*fnRect->fnGetHeight)();
+/*?*/ bFtn = TRUE;
+/*?*/ }
+/*?*/ pFtn = (SwFtnFrm*)pFtn->GetNext();
+/*?*/ }
+/*?*/ if( bFtn )
+/*?*/ nMinH += (pCont->Prt().*fnRect->fnGetTop)();
+/*?*/ nReal = (pCont->Frm().*fnRect->fnGetHeight)() - nMinH;
+/*?*/ if( nReal > nDiff )
+/*?*/ nReal = nDiff;
+/*?*/ if( nReal > 0 )
+/*?*/ pFrm = GetNext();
+/*?*/ else
+/*?*/ nReal = 0;
+/*?*/ }
+/*?*/ if( !bTst && !pSect->IsColLocked() )
+/*?*/ pSect->InvalidateSize();
+/*N*/ }
+/*N*/ if( !pFrm )
+/*N*/ return nBrowseAdd;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const BOOL bFtnPage = pBoss->IsPageFrm() && ((SwPageFrm*)pBoss)->IsFtnPage();
+/*N*/ if ( bFtnPage && !IsFtnContFrm() )
+/*?*/ pFrm = (SwFrm*)pBoss->FindFtnCont();
+/*N*/ if ( !pFrm )
+/*N*/ pFrm = (SwFrm*)pBoss->FindBodyCont();
+/*N*/
+/*N*/ if ( !pFrm )
+/*?*/ return 0;
+/*N*/
+/*N*/ //Wenn ich keinen finde eruebrigt sich alles weitere.
+/*N*/ nReal = (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nReal > nDiff )
+/*N*/ nReal = nDiff;
+/*N*/ if( !bFtnPage )
+/*N*/ {
+/*N*/ //Minimalgrenze beachten!
+/*N*/ if( nReal )
+/*N*/ {
+/*N*/ const SwTwips nMax = pBoss->GetVarSpace();
+/*N*/ if ( nReal > nMax )
+/*?*/ nReal = nMax;
+/*N*/ }
+/*N*/ if( !IsFtnContFrm() && nDiff > nReal &&
+/*N*/ pFrm->GetNext() && pFrm->GetNext()->IsFtnContFrm()
+/*N*/ && ( pFrm->GetNext()->IsVertical() == IsVertical() )
+/*N*/ )
+/*N*/ {
+/*?*/ //Wenn der Body nicht genuegend her gibt, kann ich noch mal
+/*?*/ //schauen ob es eine Fussnote gibt, falls ja kann dieser
+/*?*/ //entsprechend viel gemopst werden.
+/*?*/ const SwTwips nAddMax = (pFrm->GetNext()->Frm().*fnRect->
+/*?*/ fnGetHeight)();
+/*?*/ nAdd = nDiff - nReal;
+/*?*/ if ( nAdd > nAddMax )
+/*?*/ nAdd = nAddMax;
+/*?*/ if ( !bTst )
+/*?*/ {
+/*?*/ (pFrm->GetNext()->Frm().*fnRect->fnSetHeight)(nAddMax-nAdd);
+/*?*/ if( bVert && !bRev )
+/*?*/ pFrm->GetNext()->Frm().Pos().X() += nAdd;
+/*?*/ pFrm->GetNext()->InvalidatePrt();
+/*?*/ if ( pFrm->GetNext()->GetNext() )
+/*?*/ pFrm->GetNext()->GetNext()->_InvalidatePos();
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( !bTst && nReal )
+/*N*/ {
+/*N*/ SwTwips nTmp = (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ (pFrm->Frm().*fnRect->fnSetHeight)( nTmp - nReal );
+/*N*/ if( bVert && !bRev )
+/*?*/ pFrm->Frm().Pos().X() += nReal;
+/*N*/ pFrm->InvalidatePrt();
+/*N*/ if ( pFrm->GetNext() )
+/*N*/ pFrm->GetNext()->_InvalidatePos();
+/*N*/ if( nReal < 0 && pFrm->IsInSct() )
+/*N*/ {
+/*?*/ SwLayoutFrm* pUp = pFrm->GetUpper();
+/*?*/ if( pUp && 0 != ( pUp = pUp->GetUpper() ) && pUp->IsSctFrm() &&
+/*?*/ !pUp->IsColLocked() )
+/*?*/ pUp->InvalidateSize();
+/*N*/ }
+/*N*/ if( ( IsHeaderFrm() || IsFooterFrm() ) && pBoss->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs &rObjs = *pBoss->GetDrawObjs();
+/*N*/ ASSERT( pBoss->IsPageFrm(), "Header/Footer out of page?" );
+/*N*/ SwPageFrm *pPage = (SwPageFrm*)pBoss;
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = rObjs[i];
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ ASSERT( !pFly->IsFlyInCntFrm(), "FlyInCnt at Page?" );
+/*N*/ const SwFmtVertOrient &rVert =
+/*N*/ pFly->GetFmt()->GetVertOrient();
+/*N*/ // Wann muss invalidiert werden?
+/*N*/ // Wenn ein Rahmen am SeitenTextBereich ausgerichtet ist,
+/*N*/ // muss bei Aenderung des Headers ein TOP, MIDDLE oder NONE,
+/*N*/ // bei Aenderung des Footers ein BOTTOM oder MIDDLE
+/*N*/ // ausgerichteter Rahmen seine Position neu berechnen.
+/*N*/ if( ( rVert.GetRelationOrient() == PRTAREA ||
+/*N*/ rVert.GetRelationOrient() == REL_PG_PRTAREA ) &&
+/*N*/ ((IsHeaderFrm() && rVert.GetVertOrient()!=VERT_BOTTOM) ||
+/*N*/ (IsFooterFrm() && rVert.GetVertOrient()!=VERT_NONE &&
+/*N*/ rVert.GetVertOrient() != VERT_TOP)) )
+/*N*/ {
+/*?*/ pFly->_InvalidatePos();
+/*?*/ pFly->_Invalidate();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return (nBrowseAdd + nReal + nAdd);
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::ImplInvalidateSize(), ImplInvalidatePrt(), ImplInvalidatePos(),
+|* ImplInvalidateLineNum()
+|*
+|* Ersterstellung MA 15. Oct. 92
+|* Letzte Aenderung MA 24. Mar. 94
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::ImplInvalidateSize()
+/*N*/ {
+/*N*/ bValidSize = FALSE;
+/*N*/ if ( IsFlyFrm() )
+/*N*/ ((SwFlyFrm*)this)->_Invalidate();
+/*N*/ else
+/*N*/ InvalidatePage();
+/*N*/ }
+
+/*N*/ void SwFrm::ImplInvalidatePrt()
+/*N*/ {
+/*N*/ bValidPrtArea = FALSE;
+/*N*/ if ( IsFlyFrm() )
+/*?*/ ((SwFlyFrm*)this)->_Invalidate();
+/*N*/ else
+/*N*/ InvalidatePage();
+/*N*/ }
+
+/*N*/ void SwFrm::ImplInvalidatePos()
+/*N*/ {
+/*N*/ bValidPos = FALSE;
+/*N*/ if ( IsFlyFrm() )
+/*N*/ ((SwFlyFrm*)this)->_Invalidate();
+/*N*/ else
+/*N*/ InvalidatePage();
+/*N*/ }
+
+/*N*/ void SwFrm::ImplInvalidateLineNum()
+/*N*/ {
+/*N*/ bValidLineNum = FALSE;
+/*N*/ ASSERT( IsTxtFrm(), "line numbers are implemented for text only" );
+/*N*/ InvalidatePage();
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFrm::ReinitializeFrmSizeAttrFlags
+|*
+|* Ersterstellung MA 15. Oct. 96
+|* Letzte Aenderung MA 15. Oct. 96
+|*
+|*************************************************************************/
+/*N*/ void SwFrm::ReinitializeFrmSizeAttrFlags()
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rFmtSize = GetAttrSet()->GetFrmSize();
+/*N*/ if ( ATT_VAR_SIZE == rFmtSize.GetSizeType() ||
+/*N*/ ATT_MIN_SIZE == rFmtSize.GetSizeType())
+/*N*/ {
+/*N*/ bFixSize = FALSE;
+/*N*/ if ( GetType() & (FRM_HEADER | FRM_FOOTER | FRM_ROW) )
+/*N*/ {
+/*N*/ SwFrm *pFrm = ((SwLayoutFrm*)this)->Lower();
+/*N*/ while ( pFrm )
+/*N*/ { pFrm->_InvalidateSize();
+/*N*/ pFrm->_InvalidatePrt();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ SwCntntFrm *pCnt = ((SwLayoutFrm*)this)->ContainsCntnt();
+/*N*/ pCnt->InvalidatePage();
+/*N*/ do
+/*N*/ { pCnt->Prepare( PREP_ADJUST_FRM );
+/*N*/ pCnt->_InvalidateSize();
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ } while ( ((SwLayoutFrm*)this)->IsAnLower( pCnt ) );
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( rFmtSize.GetSizeType() == ATT_FIX_SIZE )
+/*N*/ {
+/*N*/ if( IsVertical() )
+/*?*/ ChgSize( Size( rFmtSize.GetWidth(), Frm().Height()));
+/*N*/ else
+/*N*/ ChgSize( Size( Frm().Width(), rFmtSize.GetHeight()));
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::GrowFrm()
+|*
+|* Ersterstellung MA 30. Jul. 92
+|* Letzte Aenderung MA 25. Mar. 99
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/
+/*N*/ SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nFrmHeight > 0 &&
+/*N*/ nDist > (LONG_MAX - nFrmHeight ) )
+/*N*/ nDist = LONG_MAX - nFrmHeight;
+/*N*/
+/*N*/ const FASTBOOL bBrowse = GetUpper()->GetFmt()->GetDoc()->IsBrowseMode();
+/*N*/ const USHORT nType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body
+/*N*/ if( !(GetUpper()->GetType() & nType) && GetUpper()->HasFixSize() )
+/*N*/ {
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ (Frm().*fnRect->fnSetHeight)( nFrmHeight + nDist );
+/*N*/ if( IsVertical() && !IsReverse() )
+/*?*/ Frm().Pos().X() -= nDist;
+/*N*/ if ( GetNext() )
+/*N*/ GetNext()->InvalidatePos();
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nReal = (GetUpper()->Prt().*fnRect->fnGetHeight)();
+/*N*/ SwFrm *pFrm = GetUpper()->Lower();
+/*N*/ while( pFrm && nReal > 0 )
+/*N*/ { nReal -= (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ //Cntnts werden immer auf den gewuenschten Wert gebracht.
+/*N*/ long nOld = (Frm().*fnRect->fnGetHeight)();
+/*N*/ (Frm().*fnRect->fnSetHeight)( nOld + nDist );
+/*N*/ if( IsVertical() && !IsReverse() )
+/*?*/ Frm().Pos().X() -= nDist;
+/*N*/ if ( nOld && IsInTab() )
+/*N*/ {
+/*N*/ SwTabFrm *pTab = FindTabFrm();
+/*N*/ if ( pTab->GetTable()->GetHTMLTableLayout() &&
+/*N*/ !pTab->IsJoinLocked() &&
+/*N*/ !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
+/*N*/ {
+/*?*/ pTab->InvalidatePos();
+/*?*/ pTab->SetResizeHTMLTable();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Upper nur growen wenn notwendig.
+/*M*/ if ( nReal < nDist )
+/*M*/ {
+/*M*/ if( GetUpper() )
+/*M*/ {
+/*M*/ if( bTst || !GetUpper()->IsFooterFrm() )
+/*M*/ nReal = GetUpper()->Grow( nDist - (nReal > 0 ? nReal : 0),
+/*M*/ bTst, bInfo );
+/*M*/ else
+/*M*/ {
+/*M*/ nReal = 0;
+/*M*/ GetUpper()->InvalidateSize();
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ nReal = 0;
+/*M*/ }
+/*N*/ else
+/*N*/ nReal = nDist;
+/*N*/
+/*N*/ if ( !bTst && GetNext() )
+/*N*/ GetNext()->InvalidatePos();
+/*N*/
+/*N*/ return nReal;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::ShrinkFrm()
+|*
+|* Ersterstellung MA 30. Jul. 92
+|* Letzte Aenderung MA 05. May. 94
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwCntntFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ SWRECTFN( this )
+/*N*/ ASSERT( nDist >= 0, "nDist < 0" );
+/*N*/ ASSERT( nDist <= (Frm().*fnRect->fnGetHeight)(),
+/*N*/ "nDist > als aktuelle Grosse." );
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ SwTwips nRstHeight;
+/*N*/ if( GetUpper() )
+/*N*/ nRstHeight = (Frm().*fnRect->fnBottomDist)
+/*N*/ ( (GetUpper()->*fnRect->fnGetPrtBottom)() );
+/*N*/ else
+/*N*/ nRstHeight = 0;
+/*N*/ if( nRstHeight < 0 )
+/*N*/ nRstHeight = nDist + nRstHeight;
+/*N*/ else
+/*N*/ nRstHeight = nDist;
+/*N*/ (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)() - nDist );
+/*N*/ if( IsVertical() )
+/*N*/ Frm().Pos().X() += nDist;
+/*N*/ nDist = nRstHeight;
+/*N*/ if ( IsInTab() )
+/*N*/ {
+/*N*/ SwTabFrm *pTab = FindTabFrm();
+/*N*/ if ( pTab->GetTable()->GetHTMLTableLayout() &&
+/*N*/ !pTab->IsJoinLocked() &&
+/*N*/ !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
+/*N*/ {
+/*N*/ pTab->InvalidatePos();
+/*N*/ pTab->SetResizeHTMLTable();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nReal;
+/*N*/ if( GetUpper() && nDist > 0 )
+/*N*/ {
+/*N*/ if( bTst || !GetUpper()->IsFooterFrm() )
+/*N*/ nReal = GetUpper()->Shrink( nDist, bTst, bInfo );
+/*N*/ else
+/*N*/ {
+/*N*/ nReal = 0;
+/*N*/
+/*N*/ // #108745# Sorry, dear old footer friend, I'm not gonna invalidate you,
+/*N*/ // if there are any objects anchored inside your content, which
+/*N*/ // overlap with the shrinking frame.
+/*N*/ // This may lead to a footer frame that is too big, but this is better
+/*N*/ // than looping.
+/*N*/ // #109722# : The fix for #108745# was too strict.
+/*N*/
+/*N*/ bool bInvalidate = true;
+/*N*/ const SwRect aRect( Frm() );
+/*N*/ const SwPageFrm* pPage = FindPageFrm();
+/*N*/ const SwSortDrawObjs* pSorted;
+/*N*/ if( pPage && ( pSorted = pPage->GetSortedObjs() ) )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < pSorted->Count(); ++i )
+/*N*/ {
+/*N*/ const SdrObject *pObj = (*pSorted)[i];
+/*N*/ const SwRect aBound( GetBoundRect( pObj ) );
+/*N*/
+/*N*/ if( aBound.Left() > aRect.Right() )
+/*N*/ continue;
+/*N*/
+/*N*/ if( aBound.IsOver( aRect ) )
+/*N*/ {
+/*N*/ const SwFmt* pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
+/*N*/ if( SURROUND_THROUGHT != pFmt->GetSurround().GetSurround() )
+/*N*/ {
+/*N*/ const SwFrm* pAnchor = pObj->IsWriterFlyFrame() ?
+/*N*/ ( (SwVirtFlyDrawObj*)pObj )->GetFlyFrm()->GetAnchor() :
+/*N*/ ( (SwDrawContact*)GetUserCall(pObj) )->GetAnchor();
+/*N*/
+/*N*/ if ( pAnchor && pAnchor->FindFooterOrHeader() == GetUpper() )
+/*N*/ {
+/*N*/ bInvalidate = false;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bInvalidate )
+/*N*/ GetUpper()->InvalidateSize();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nReal = 0;
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ //Die Position des naechsten Frm's veraendert sich auf jeden Fall.
+/*N*/ InvalidateNextPos();
+/*N*/
+/*N*/ //Wenn ich keinen Nachfolger habe, so muss ich mich eben selbst um
+/*N*/ //die Retusche kuemmern.
+/*N*/ if ( !GetNext() )
+/*N*/ SetRetouche();
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwCntntFrm::Modify()
+|*
+|* Beschreibung
+|* Ersterstellung AK 05-Mar-1991
+|* Letzte Aenderung MA 13. Oct. 95
+|*
+|*************************************************************************/
+/*N*/ void SwCntntFrm::Modify( SfxPoolItem * pOld, SfxPoolItem * pNew )
+/*N*/ {
+/*N*/ BYTE nInvFlags = 0;
+/*N*/
+/*N*/ if( pNew && RES_ATTRSET_CHG == pNew->Which() )
+/*N*/ {
+/*N*/ SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
+/*N*/ SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
+/*N*/ SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
+/*N*/ SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
+/*N*/ while( TRUE )
+/*N*/ {
+/*N*/ _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
+/*N*/ (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+/*N*/ &aOldSet, &aNewSet );
+/*N*/ if( aNIter.IsAtEnd() )
+/*N*/ break;
+/*N*/ aNIter.NextItem();
+/*N*/ aOIter.NextItem();
+/*N*/ }
+/*N*/ if ( aOldSet.Count() || aNewSet.Count() )
+/*N*/ SwFrm::Modify( &aOldSet, &aNewSet );
+/*N*/ }
+/*N*/ else
+/*N*/ _UpdateAttr( pOld, pNew, nInvFlags );
+/*N*/
+/*N*/ if ( nInvFlags != 0 )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ InvalidatePage( pPage );
+/*N*/ if ( nInvFlags & 0x01 )
+/*N*/ SetCompletePaint();
+/*N*/ if ( nInvFlags & 0x02 )
+/*N*/ _InvalidatePos();
+/*N*/ if ( nInvFlags & 0x04 )
+/*N*/ _InvalidateSize();
+/*N*/ if ( nInvFlags & 0x88 )
+/*N*/ {
+/*N*/ if( IsInSct() && !GetPrev() )
+/*N*/ {
+/*N*/ SwSectionFrm *pSect = FindSctFrm();
+/*N*/ if( pSect->ContainsAny() == this )
+/*N*/ {
+/*N*/ pSect->_InvalidatePrt();
+/*N*/ pSect->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ _InvalidatePrt();
+/*N*/ }
+/*N*/ SwFrm *pTmp;
+/*N*/ if ( 0 != (pTmp = GetIndNext()) && nInvFlags & 0x10)
+/*N*/ {
+/*N*/ pTmp->_InvalidatePrt();
+/*N*/ pTmp->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if ( nInvFlags & 0x80 && pTmp )
+/*N*/ pTmp->SetCompletePaint();
+/*N*/ if ( nInvFlags & 0x20 && 0 != (pTmp = GetPrev()) )
+/*N*/ {
+/*N*/ pTmp->_InvalidatePrt();
+/*N*/ pTmp->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if ( nInvFlags & 0x40 )
+/*N*/ InvalidateNextPos();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwCntntFrm::_UpdateAttr( SfxPoolItem* pOld, SfxPoolItem* pNew,
+/*N*/ BYTE &rInvFlags,
+/*N*/ SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
+/*N*/ {
+/*N*/ BOOL bClear = TRUE;
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ switch ( nWhich )
+/*N*/ {
+/*N*/ case RES_FMT_CHG:
+/*N*/ rInvFlags = 0xFF;
+/*N*/ /* kein break hier */
+/*N*/
+/*N*/ case RES_PAGEDESC: //Attributaenderung (an/aus)
+/*N*/ if ( IsInDocBody() && !IsInTab() )
+/*N*/ {
+/*N*/ rInvFlags |= 0x02;
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( !GetPrev() )
+/*N*/ CheckPageDescs( pPage );
+/*N*/ if ( pPage && GetAttrSet()->GetPageDesc().GetNumOffset() )
+/*N*/ ((SwRootFrm*)pPage->GetUpper())->SetVirtPageNum( TRUE );
+/*N*/ SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
+/*N*/ pPage->GetFmt()->GetDoc()->UpdatePageFlds( &aMsgHnt );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_UL_SPACE:
+/*N*/ {
+/*N*/ if( IsInFtn() && !GetIndNext() )
+/*N*/ {
+/*?*/ SwFrm* pNxt = FindNext();
+/*?*/ if( pNxt )
+/*?*/ {
+/*?*/ SwPageFrm* pPg = pNxt->FindPageFrm();
+/*?*/ pNxt->InvalidatePage( pPg );
+/*?*/ pNxt->_InvalidatePrt();
+/*?*/ if( pNxt->IsSctFrm() )
+/*?*/ {
+/*?*/ SwFrm* pCnt = ((SwSectionFrm*)pNxt)->ContainsAny();
+/*?*/ if( pCnt )
+/*?*/ {
+/*?*/ pCnt->_InvalidatePrt();
+/*?*/ pCnt->InvalidatePage( pPg );
+/*?*/ }
+/*?*/ }
+/*?*/ pNxt->SetCompletePaint();
+/*?*/ }
+/*N*/ }
+/*N*/ Prepare( PREP_UL_SPACE ); //TxtFrm muss Zeilenabst. korrigieren.
+/*N*/ rInvFlags |= 0x80;
+/*N*/ /* kein Break hier */
+/*N*/ }
+/*N*/ case RES_LR_SPACE:
+/*N*/ case RES_BOX:
+/*N*/ case RES_SHADOW:
+/*N*/ Prepare( PREP_FIXSIZE_CHG );
+/*N*/ SwFrm::Modify( pOld, pNew );
+/*N*/ rInvFlags |= 0x30;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_BREAK:
+/*N*/ {
+/*N*/ rInvFlags |= 0x42;
+/*N*/ if( GetAttrSet()->GetDoc()->IsParaSpaceMax() ||
+/*N*/ GetAttrSet()->GetDoc()->IsParaSpaceMaxAtPages() )
+/*N*/ {
+/*?*/ rInvFlags |= 0x1;
+/*?*/ SwFrm* pNxt = FindNext();
+/*?*/ if( pNxt )
+/*?*/ {
+/*?*/ SwPageFrm* pPg = pNxt->FindPageFrm();
+/*?*/ pNxt->InvalidatePage( pPg );
+/*?*/ pNxt->_InvalidatePrt();
+/*?*/ if( pNxt->IsSctFrm() )
+/*?*/ {
+/*?*/ SwFrm* pCnt = ((SwSectionFrm*)pNxt)->ContainsAny();
+/*?*/ if( pCnt )
+/*?*/ {
+/*?*/ pCnt->_InvalidatePrt();
+/*?*/ pCnt->InvalidatePage( pPg );
+/*?*/ }
+/*?*/ }
+/*?*/ pNxt->SetCompletePaint();
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_PARATR_TABSTOP:
+/*N*/ case RES_CHRATR_PROPORTIONALFONTSIZE:
+/*N*/ case RES_CHRATR_SHADOWED:
+/*N*/ case RES_CHRATR_AUTOKERN:
+/*N*/ case RES_CHRATR_UNDERLINE:
+/*N*/ case RES_CHRATR_KERNING:
+/*N*/ case RES_CHRATR_FONT:
+/*N*/ case RES_CHRATR_FONTSIZE:
+/*N*/ case RES_CHRATR_ESCAPEMENT:
+/*N*/ case RES_CHRATR_CONTOUR:
+/*N*/ rInvFlags |= 0x01;
+/*N*/ break;
+/*N*/
+/*N*/
+/*N*/ case RES_FRM_SIZE:
+/*?*/ rInvFlags |= 0x01;
+/*N*/ /* no break here */
+/*N*/
+/*N*/ default:
+/*N*/ bClear = FALSE;
+/*N*/ }
+/*N*/ if ( bClear )
+/*N*/ {
+/*N*/ if ( pOldSet || pNewSet )
+/*N*/ {
+/*N*/ if ( pOldSet )
+/*N*/ pOldSet->ClearItem( nWhich );
+/*N*/ if ( pNewSet )
+/*N*/ pNewSet->ClearItem( nWhich );
+/*N*/ }
+/*N*/ else
+/*N*/ SwFrm::Modify( pOld, pNew );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::SwLayoutFrm()
+|*
+|* Ersterstellung AK 14-Feb-1991
+|* Letzte Aenderung MA 12. May. 95
+|*
+|*************************************************************************/
+/*N*/ SwLayoutFrm::SwLayoutFrm( SwFrmFmt* pFmt ):
+/*N*/ SwFrm( pFmt ),
+/*N*/ pLower( 0 )
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rFmtSize = pFmt->GetFrmSize();
+/*N*/ if ( rFmtSize.GetSizeType() == ATT_FIX_SIZE )
+/*N*/ BFIXHEIGHT = TRUE;
+/*N*/ }
+
+/*-----------------10.06.99 09:42-------------------
+ * SwLayoutFrm::InnerHeight()
+ * --------------------------------------------------*/
+
+/*N*/ SwTwips SwLayoutFrm::InnerHeight() const
+/*N*/ {
+/*N*/ if( !Lower() )
+/*N*/ return 0;
+/*N*/ SwTwips nRet = 0;
+/*N*/ const SwFrm* pCnt = Lower();
+/*N*/ SWRECTFN( this )
+/*N*/ if( pCnt->IsColumnFrm() || pCnt->IsCellFrm() )
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*?*/ SwTwips nTmp = ((SwLayoutFrm*)pCnt)->InnerHeight();
+/*?*/ if( pCnt->GetValidPrtAreaFlag() )
+/*?*/ nTmp += (pCnt->Frm().*fnRect->fnGetHeight)() -
+/*?*/ (pCnt->Prt().*fnRect->fnGetHeight)();
+/*?*/ if( nRet < nTmp )
+/*?*/ nRet = nTmp;
+/*?*/ pCnt = pCnt->GetNext();
+/*?*/ } while ( pCnt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ nRet += (pCnt->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( pCnt->IsCntntFrm() && ((SwTxtFrm*)pCnt)->IsUndersized() )
+/*N*/ nRet += ((SwTxtFrm*)pCnt)->GetParHeight() -
+/*N*/ (pCnt->Prt().*fnRect->fnGetHeight)();
+/*N*/ if( pCnt->IsLayoutFrm() && !pCnt->IsTabFrm() )
+/*N*/ nRet += ((SwLayoutFrm*)pCnt)->InnerHeight() -
+/*?*/ (pCnt->Prt().*fnRect->fnGetHeight)();
+/*N*/ pCnt = pCnt->GetNext();
+/*N*/ } while( pCnt );
+/*N*/
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::GrowFrm()
+|*
+|* Ersterstellung MA 30. Jul. 92
+|* Letzte Aenderung MA 23. Sep. 96
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ const FASTBOOL bBrowse = GetFmt()->GetDoc()->IsBrowseMode();
+/*N*/ const USHORT nType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body
+/*N*/ if( !(GetType() & nType) && HasFixSize() )
+/*N*/ return 0;
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( nFrmHeight > 0 && nDist > (LONG_MAX - nFrmHeight) )
+/*?*/ nDist = LONG_MAX - nFrmHeight;
+/*N*/
+/*N*/ SwTwips nMin = 0;
+/*N*/ if ( GetUpper() && !IsCellFrm() )
+/*N*/ {
+/*N*/ SwFrm *pFrm = GetUpper()->Lower();
+/*N*/ while( pFrm )
+/*N*/ { nMin += (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ nMin = (GetUpper()->Prt().*fnRect->fnGetHeight)() - nMin;
+/*N*/ if ( nMin < 0 )
+/*N*/ nMin = 0;
+/*N*/ }
+/*N*/
+/*N*/ SwRect aOldFrm( Frm() );
+/*N*/ sal_Bool bMoveAccFrm = sal_False;
+/*N*/
+/*N*/ BOOL bChgPos = IsVertical() && !IsReverse();
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ (Frm().*fnRect->fnSetHeight)( nFrmHeight + nDist );
+/*N*/ if( bChgPos )
+/*?*/ Frm().Pos().X() -= nDist;
+/*N*/ bMoveAccFrm = sal_True;
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nReal = nDist - nMin;
+/*N*/ if ( nReal > 0 )
+/*N*/ {
+/*N*/ if ( GetUpper() )
+/*N*/ { // AdjustNeighbourhood jetzt auch in Spalten (aber nicht in Rahmen)
+/*N*/ BYTE nAdjust = GetUpper()->IsFtnBossFrm() ?
+/*N*/ ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
+/*N*/ : NA_GROW_SHRINK;
+/*N*/ if( NA_ONLY_ADJUST == nAdjust )
+/*N*/ nReal = AdjustNeighbourhood( nReal, bTst );
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nGrow = 0;
+/*N*/ if( NA_ADJUST_GROW == nAdjust )
+/*?*/ nReal += AdjustNeighbourhood( nReal - nGrow, bTst );
+/*N*/ if( nGrow < nReal )
+/*N*/ nGrow += GetUpper()->Grow( nReal - nGrow, bTst, bInfo );
+/*N*/ if( NA_GROW_ADJUST == nAdjust && nGrow < nReal )
+/*?*/ nReal += AdjustNeighbourhood( nReal - nGrow, bTst );
+/*N*/ if ( IsFtnFrm() && (nGrow != nReal) && GetNext() )
+/*N*/ {
+/*?*/ //Fussnoten koennen ihre Nachfolger verdraengen.
+/*?*/ SwTwips nSpace = bTst ? 0 : -nDist;
+/*?*/ const SwFrm *pFrm = GetUpper()->Lower();
+/*?*/ do
+/*?*/ { nSpace += (pFrm->Frm().*fnRect->fnGetHeight)();
+/*?*/ pFrm = pFrm->GetNext();
+/*?*/ } while ( pFrm != GetNext() );
+/*?*/ nSpace = (GetUpper()->Prt().*fnRect->fnGetHeight)() -nSpace;
+/*?*/ if ( nSpace < 0 )
+/*?*/ nSpace = 0;
+/*?*/ nSpace += nGrow;
+/*?*/ if ( nReal > nSpace )
+/*?*/ nReal = nSpace;
+/*?*/ if ( nReal && !bTst )
+/*?*/ ((SwFtnFrm*)this)->InvalidateNxtFtnCnts( FindPageFrm() );
+/*N*/ }
+/*N*/ else
+/*N*/ nReal = nGrow;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ nReal = 0;
+/*N*/
+/*N*/ nReal += nMin;
+/*N*/ }
+/*N*/ else
+/*N*/ nReal = nDist;
+/*N*/
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ if( nReal != nDist && !IsCellFrm() )
+/*N*/ {
+/*N*/ nDist -= nReal;
+/*N*/ (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)()
+/*N*/ - nDist );
+/*N*/ if( bChgPos )
+/*?*/ Frm().Pos().X() += nDist;
+/*N*/ bMoveAccFrm = sal_True;
+/*N*/ }
+/*N*/
+/*N*/ if ( nReal )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ GetNext()->_InvalidatePos();
+/*N*/ if ( GetNext()->IsCntntFrm() )
+/*?*/ GetNext()->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if ( !IsPageBodyFrm() )
+/*N*/ {
+/*N*/ _InvalidateAll();
+/*N*/ InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
+/*N*/ NotifyFlys();
+/*N*/
+/*N*/ if( IsCellFrm() )
+/*N*/ InvaPercentLowers( nReal );
+/*N*/
+/*N*/ const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
+/*N*/ if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
+/*?*/ SetCompletePaint();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bMoveAccFrm && IsAccessibleFrm() )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( this, aOldFrm );
+/*N*/ }
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::ShrinkFrm()
+|*
+|* Ersterstellung MA 30. Jul. 92
+|* Letzte Aenderung MA 25. Mar. 99
+|*
+|*************************************************************************/
+/*N*/ SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, BOOL bTst, BOOL bInfo )
+/*N*/ {
+/*N*/ const FASTBOOL bBrowse = GetFmt()->GetDoc()->IsBrowseMode();
+/*N*/ const USHORT nType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body
+/*N*/ if( !(GetType() & nType) && HasFixSize() )
+/*N*/ return 0;
+/*N*/
+/*N*/ ASSERT( nDist >= 0, "nDist < 0" );
+/*N*/ SWRECTFN( this )
+/*N*/ SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( nDist > nFrmHeight )
+/*?*/ nDist = nFrmHeight;
+/*N*/
+/*N*/ SwTwips nMin = 0;
+/*N*/ BOOL bChgPos = IsVertical() && !IsReverse();
+/*N*/ if ( Lower() )
+/*N*/ {
+/*N*/ if( !Lower()->IsNeighbourFrm() )
+/*N*/ { const SwFrm *pFrm = Lower();
+/*N*/ const long nTmp = (Prt().*fnRect->fnGetHeight)();
+/*N*/ while( pFrm && nMin < nTmp )
+/*N*/ { nMin += (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ SwTwips nReal = nDist;
+/*N*/ SwTwips nMinDiff = (Prt().*fnRect->fnGetHeight)() - nMin;
+/*N*/ if( nReal > nMinDiff )
+/*N*/ nReal = nMinDiff;
+/*N*/ if( nReal <= 0 )
+/*N*/ return nDist;
+/*N*/
+/*N*/ SwRect aOldFrm( Frm() );
+/*N*/ sal_Bool bMoveAccFrm = sal_False;
+/*N*/
+/*N*/ SwTwips nRealDist = nReal;
+/*N*/ if ( !bTst )
+/*N*/ {
+/*N*/ (Frm().*fnRect->fnSetHeight)( nFrmHeight - nReal );
+/*N*/ if( bChgPos )
+/*?*/ Frm().Pos().X() += nReal;
+/*N*/ bMoveAccFrm = sal_True;
+/*N*/ }
+/*N*/
+/*N*/ BYTE nAdjust = GetUpper() && GetUpper()->IsFtnBossFrm() ?
+/*N*/ ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
+/*N*/ : NA_GROW_SHRINK;
+/*N*/
+/*N*/ // AdjustNeighbourhood auch in Spalten (aber nicht in Rahmen)
+/*N*/ if( NA_ONLY_ADJUST == nAdjust )
+/*N*/ {
+/*N*/ if ( IsPageBodyFrm() && !bBrowse )
+/*?*/ nReal = nDist;
+/*N*/ else
+/*N*/ { nReal = AdjustNeighbourhood( -nReal, bTst );
+/*N*/ nReal *= -1;
+/*N*/ if ( !bTst && IsBodyFrm() && nReal < nRealDist )
+/*N*/ {
+/*?*/ (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)()
+/*?*/ + nRealDist - nReal );
+/*?*/ if( bChgPos )
+/*?*/ Frm().Pos().X() += nRealDist - nReal;
+/*?*/ ASSERT( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if( IsColumnFrm() || IsColBodyFrm() )
+/*N*/ {
+/*N*/ SwTwips nTmp = GetUpper()->Shrink( nReal, bTst, bInfo );
+/*N*/ if ( nTmp != nReal )
+/*N*/ {
+/*N*/ (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)()
+/*N*/ + nReal - nTmp );
+/*N*/ if( bChgPos )
+/*?*/ Frm().Pos().X() += nTmp - nReal;
+/*N*/ ASSERT( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" );
+/*N*/ nReal = nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nShrink = nReal;
+/*N*/ nReal = GetUpper() ? GetUpper()->Shrink( nShrink, bTst, bInfo ) : 0;
+/*N*/ if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust )
+/*N*/ && nReal < nShrink )
+/*?*/ AdjustNeighbourhood( nReal - nShrink );
+/*N*/ }
+/*N*/
+/*N*/ if( bMoveAccFrm && IsAccessibleFrm() )
+/*N*/ {
+/*N*/ SwRootFrm *pRootFrm = FindRootFrm();
+/*N*/ if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
+/*N*/ pRootFrm->GetCurrShell() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( this, aOldFrm );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !bTst && (IsCellFrm() || IsColumnFrm() ? nReal : nRealDist) )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ if ( GetNext() )
+/*N*/ {
+/*N*/ GetNext()->_InvalidatePos();
+/*N*/ if ( GetNext()->IsCntntFrm() )
+/*N*/ GetNext()->InvalidatePage( pPage );
+/*N*/ if ( IsTabFrm() )
+/*N*/ ((SwTabFrm*)this)->SetComplete();
+/*N*/ }
+/*N*/ else
+/*N*/ { if ( IsRetoucheFrm() )
+/*N*/ SetRetouche();
+/*N*/ if ( IsTabFrm() )
+/*N*/ {
+/*N*/ if( IsTabFrm() )
+/*N*/ ((SwTabFrm*)this)->SetComplete();
+/*N*/ if ( Lower() ) //Kann auch im Join stehen und leer sein!
+/*N*/ InvalidateNextPos();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !IsBodyFrm() )
+/*N*/ {
+/*N*/ _InvalidateAll();
+/*N*/ InvalidatePage( pPage );
+/*N*/ const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
+/*N*/ if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
+/*?*/ SetCompletePaint();
+/*N*/ }
+/*N*/
+/*N*/ if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
+/*N*/ NotifyFlys();
+/*N*/
+/*N*/ if( IsCellFrm() )
+/*N*/ InvaPercentLowers( nReal );
+/*N*/
+/*N*/ SwCntntFrm *pCnt;
+/*N*/ if( IsFtnFrm() && !((SwFtnFrm*)this)->GetAttr()->GetFtn().IsEndNote() &&
+/*N*/ ( GetFmt()->GetDoc()->GetFtnInfo().ePos != FTNPOS_CHAPTER ||
+/*N*/ ( IsInSct() && FindSctFrm()->IsFtnAtEnd() ) ) &&
+/*N*/ 0 != (pCnt = ((SwFtnFrm*)this)->GetRefFromAttr() ) )
+/*N*/ {
+/*N*/ if ( pCnt->IsFollow() )
+/*N*/ { // Wenn wir sowieso schon in einer anderen Spalte/Seite sitzen
+/*?*/ // als der Frame mit der Referenz, dann brauchen wir nicht
+/*?*/ // auch noch seinen Master zu invalidieren.
+/*?*/ SwFrm *pTmp = pCnt->FindFtnBossFrm(TRUE) == FindFtnBossFrm(TRUE)
+/*?*/ ? pCnt->FindMaster()->GetFrm() : pCnt;
+/*?*/ pTmp->Prepare( PREP_ADJUST_FRM );
+/*?*/ pTmp->InvalidateSize();
+/*N*/ }
+/*N*/ else
+/*N*/ pCnt->InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ return nReal;
+/*N*/ }
+/*************************************************************************
+|*
+|* SwLayoutFrm::ChgLowersProp()
+|*
+|* Beschreibung Aendert die Grosse der direkt untergeordneten Frm's
+|* die eine Fixe Groesse haben, proportional zur Groessenaenderung der
+|* PrtArea des Frm's.
+|* Die Variablen Frm's werden auch proportional angepasst; sie werden
+|* sich schon wieder zurechtwachsen/-schrumpfen.
+|* Ersterstellung MA 11.03.92
+|* Letzte Aenderung AMA 2. Nov. 98
+|*
+|*************************************************************************/
+/*N*/ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize )
+/*N*/ {
+/*N*/ // no change of lower properties for root frame or if no lower exists.
+/*N*/ if ( IsRootFrm() || !Lower() )
+/*N*/ return;
+/*N*/
+/*N*/ // declare and init <SwFrm* pLowerFrm> with first lower
+/*N*/ SwFrm *pLowerFrm = Lower();
+/*N*/
+/*N*/ // declare and init const booleans <bHeightChgd> and <bWidthChg>
+/*N*/ const bool bHeightChgd = rOldSize.Height() != Prt().Height();
+/*N*/ const bool bWidthChgd = rOldSize.Width() != Prt().Width();
+/*N*/
+/*N*/ // declare and init variables <bVert>, <bRev> and <fnRect>
+/*N*/ SWRECTFN( this )
+/*N*/
+/*N*/ // handle special case as short cut:
+/*N*/ // if method called for a body frame belonging to the flow text body
+/*N*/ // and the first lower of the body isn't a column frame (body contains real content)
+/*N*/ // and its fixed size (in vertical layout its height; in horizontal layout its
+/*N*/ // width) doesn't changed
+/*N*/ // and the body frame doesn't belong to a locked section,
+/*N*/ // then only invalidate lowers that are influence by the change.
+/*N*/ // "Only" the variable size (in vertical layout its width; in horizontal
+/*N*/ // layout its height) of body frame has changed.
+/*N*/ if ( IsBodyFrm() && IsInDocBody() &&
+/*N*/ !Lower()->IsColumnFrm() &&
+/*N*/ !( bVert ? bHeightChgd : bWidthChgd ) &&
+/*N*/ ( !IsInSct() || !FindSctFrm()->IsColLocked() )
+/*N*/ )
+/*N*/ {
+/*N*/ // Determine page frame the body frame belongs to.
+/*N*/ SwPageFrm *pPage = FindPageFrm();
+/*N*/ // Determine last lower by traveling through them using <GetNext()>.
+/*N*/ // During travel check each section frame, if it will be sized to
+/*N*/ // maximum. If Yes, invalidate size of section frame and set
+/*N*/ // corresponding flags at the page.
+/*N*/ do
+/*N*/ {
+/*N*/ if( pLowerFrm->IsSctFrm() &&((SwSectionFrm*)pLowerFrm)->_ToMaximize() )
+/*N*/ {
+/*N*/ pLowerFrm->_InvalidateSize();
+/*N*/ pLowerFrm->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ if( pLowerFrm->GetNext() )
+/*N*/ pLowerFrm = pLowerFrm->GetNext();
+/*N*/ else
+/*N*/ break;
+/*N*/ } while( TRUE );
+/*N*/ // If found last lower is a section frame containing no section
+/*N*/ // (section frame isn't valid and will be deleted in the future),
+/*N*/ // travel backwards.
+/*N*/ while( pLowerFrm->IsSctFrm() && !((SwSectionFrm*)pLowerFrm)->GetSection() &&
+/*N*/ pLowerFrm->GetPrev() )
+/*N*/ pLowerFrm = pLowerFrm->GetPrev();
+/*N*/ // If found last lower is a section frame, set <pLowerFrm> to its last
+/*N*/ // content, if the section frame is valid and is not sized to maximum.
+/*N*/ // Otherwise set <pLowerFrm> to NULL - In this case body frame only
+/*N*/ // contains invalid section frames.
+/*N*/ if( pLowerFrm->IsSctFrm() )
+/*N*/ pLowerFrm = ((SwSectionFrm*)pLowerFrm)->GetSection() &&
+/*N*/ !((SwSectionFrm*)pLowerFrm)->ToMaximize( FALSE ) ?
+/*N*/ ((SwSectionFrm*)pLowerFrm)->FindLastCntnt() : NULL;
+/*N*/
+/*N*/ // continue with found last lower, probably the last content of a section
+/*N*/ if ( pLowerFrm )
+/*N*/ {
+/*N*/ // If <pLowerFrm> is in a table frame, set <pLowerFrm> to this table
+/*N*/ // frame and continue.
+/*N*/ if ( pLowerFrm->IsInTab() )
+/*N*/ {
+/*N*/ // OD 28.10.2002 #97265# - safeguard for setting <pLowerFrm> to
+/*N*/ // its table frame - check, if the table frame is also a lower
+/*N*/ // of the body frame, in order to assure that <pLowerFrm> is not
+/*N*/ // set to a frame, which is an *upper* of the body frame.
+/*N*/ SwFrm* pTableFrm = pLowerFrm->FindTabFrm();
+/*N*/ if ( IsAnLower( pTableFrm ) )
+/*N*/ {
+/*N*/ pLowerFrm = pTableFrm;
+/*N*/ }
+/*N*/ }
+/*N*/ // Check, if variable size of body frame has grown
+/*N*/ // OD 28.10.2002 #97265# - correct check, if variable size has grown.
+/*N*/ //SwTwips nOldHeight = bVert ? rOldSize.Height() : rOldSize.Width();
+/*N*/ SwTwips nOldHeight = bVert ? rOldSize.Width() : rOldSize.Height();
+/*N*/ if( nOldHeight < (Prt().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ // If variable size of body frame has grown, only found last lower
+/*N*/ // and the position of the its next have to be invalidated.
+/*N*/ pLowerFrm->_InvalidateAll();
+/*N*/ pLowerFrm->InvalidatePage( pPage );
+/*N*/ if( !pLowerFrm->IsFlowFrm() ||
+/*N*/ !SwFlowFrm::CastFlowFrm( pLowerFrm )->HasFollow() )
+/*N*/ pLowerFrm->InvalidateNextPos( TRUE );
+/*N*/ if ( pLowerFrm->IsTxtFrm() )
+/*N*/ ((SwCntntFrm*)pLowerFrm)->Prepare( PREP_ADJUST_FRM );
+/*N*/ if ( pLowerFrm->IsInSct() )
+/*N*/ {
+/*N*/ pLowerFrm = pLowerFrm->FindSctFrm();
+/*N*/ if( IsAnLower( pLowerFrm ) )
+/*N*/ {
+/*N*/ pLowerFrm->_InvalidateSize();
+/*N*/ pLowerFrm->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // variable size of body frame has shrinked. Thus, invalidate
+/*N*/ // all lowers not matching the new body size and the dedicated
+/*N*/ // new last lower.
+/*N*/ if( bVert )
+/*N*/ {
+/*N*/ SwTwips nBot = Frm().Left() + Prt().Left();
+/*N*/ while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Left() < nBot )
+/*N*/ {
+/*N*/ pLowerFrm->_InvalidateAll();
+/*N*/ pLowerFrm->InvalidatePage( pPage );
+/*N*/ pLowerFrm = pLowerFrm->GetPrev();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nBot = Frm().Top() + Prt().Bottom();
+/*N*/ while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Top() > nBot )
+/*N*/ {
+/*N*/ pLowerFrm->_InvalidateAll();
+/*N*/ pLowerFrm->InvalidatePage( pPage );
+/*N*/ pLowerFrm = pLowerFrm->GetPrev();
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pLowerFrm )
+/*N*/ {
+/*N*/ pLowerFrm->_InvalidateSize();
+/*N*/ pLowerFrm->InvalidatePage( pPage );
+/*N*/ if ( pLowerFrm->IsTxtFrm() )
+/*N*/ ((SwCntntFrm*)pLowerFrm)->Prepare( PREP_ADJUST_FRM );
+/*N*/ if ( pLowerFrm->IsInSct() )
+/*N*/ {
+/*N*/ pLowerFrm = pLowerFrm->FindSctFrm();
+/*N*/ if( IsAnLower( pLowerFrm ) )
+/*N*/ {
+/*N*/ pLowerFrm->_InvalidateSize();
+/*N*/ pLowerFrm->InvalidatePage( pPage );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return;
+/*N*/ } // end of { special case }
+/*N*/
+/*N*/
+/*N*/ // Invalidate page for content only once.
+/*N*/ bool bInvaPageForCntnt = true;
+/*N*/
+/*N*/ // Declare booleans <bFixChgd> and <bVarChgd>, indicating for text frame
+/*N*/ // adjustment, if fixed/variable size has changed.
+/*N*/ bool bFixChgd, bVarChgd;
+/*N*/ if( bVert == pLowerFrm->IsNeighbourFrm() )
+/*N*/ {
+/*N*/ bFixChgd = bWidthChgd;
+/*N*/ bVarChgd = bHeightChgd;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bFixChgd = bHeightChgd;
+/*N*/ bVarChgd = bWidthChgd;
+/*N*/ }
+/*N*/
+/*N*/ // Declare const unsigned short <nFixWidth> and init it this frame types
+/*N*/ // which has fixed width in vertical respectively horizontal layout.
+/*N*/ // In vertical layout these are neighbour frames (cell and column frames),
+/*N*/ // header frames and footer frames.
+/*N*/ // In horizontal layout these are all frames, which aren't neighbour frames.
+/*N*/ const USHORT nFixWidth = bVert ? (FRM_NEIGHBOUR | FRM_HEADFOOT)
+/*N*/ : ~FRM_NEIGHBOUR;
+/*N*/
+/*N*/ // Declare const unsigned short <nFixHeight> and init it this frame types
+/*N*/ // which has fixed height in vertical respectively horizontal layout.
+/*N*/ // In vertical layout these are all frames, which aren't neighbour frames,
+/*N*/ // header frames, footer frames, body frames or foot note container frames.
+/*N*/ // In horizontal layout these are neighbour frames.
+/*N*/ const USHORT nFixHeight= bVert ? ~(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC)
+/*N*/ : FRM_NEIGHBOUR;
+/*N*/
+/*N*/ // Travel through all lowers using <GetNext()>
+/*N*/ while ( pLowerFrm )
+/*N*/ {
+/*N*/ if ( pLowerFrm->IsTxtFrm() )
+/*N*/ {
+/*N*/ // Text frames will only be invalidated - prepare invalidation
+/*N*/ if ( bFixChgd )
+/*N*/ static_cast<SwCntntFrm*>(pLowerFrm)->Prepare( PREP_FIXSIZE_CHG );
+/*N*/ if ( bVarChgd )
+/*N*/ static_cast<SwCntntFrm*>(pLowerFrm)->Prepare( PREP_ADJUST_FRM );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // If lower isn't a table, row, cell or section frame, adjust its
+/*N*/ // frame size.
+/*N*/ USHORT nType = pLowerFrm->GetType();
+/*N*/ if ( !(nType & (FRM_TAB|FRM_ROW|FRM_CELL|FRM_SECTION)) )
+/*N*/ {
+/*N*/ if ( bWidthChgd )
+/*N*/ {
+/*N*/ if( nType & nFixWidth )
+/*N*/ {
+/*N*/ // Considering previous conditions:
+/*N*/ // In vertical layout set width of column, header and
+/*N*/ // footer frames to its upper width.
+/*N*/ // In horizontal layout set width of header, footer,
+/*N*/ // foot note container, foot note, body and no-text
+/*N*/ // frames to its upper width.
+/*N*/ pLowerFrm->Frm().Width( Prt().Width() );
+/*N*/ }
+/*N*/ else if( rOldSize.Width() && !pLowerFrm->IsFtnFrm() )
+/*N*/ {
+/*N*/ // Adjust frame width proportional, if lower isn't a
+/*N*/ // foot note frame and condition <nType & nFixWidth>
+/*N*/ // isn't true.
+/*N*/ // Considering previous conditions:
+/*N*/ // In vertical layout these are foot note container,
+/*N*/ // body and no-text frames.
+/*N*/ // In horizontal layout these are column and no-text frames.
+/*N*/ // OD 24.10.2002 #97265# - <double> calculation
+/*N*/ // Perform <double> calculation of new width, if
+/*N*/ // one of the coefficients is greater than 50000
+/*N*/ SwTwips nNewWidth;
+/*N*/ if ( (pLowerFrm->Frm().Width() > 50000) ||
+/*N*/ (Prt().Width() > 50000) )
+/*N*/ {
+/*N*/ double nNewWidthTmp =
+/*N*/ ( double(pLowerFrm->Frm().Width())
+/*N*/ * double(Prt().Width()) )
+/*N*/ / double(rOldSize.Width());
+/*N*/ nNewWidth = SwTwips(nNewWidthTmp);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nNewWidth =
+/*N*/ (pLowerFrm->Frm().Width() * Prt().Width()) / rOldSize.Width();
+/*N*/ }
+/*N*/ pLowerFrm->Frm().Width( nNewWidth );
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bHeightChgd )
+/*N*/ {
+/*N*/ if( nType & nFixHeight )
+/*N*/ {
+/*N*/ // Considering previous conditions:
+/*N*/ // In vertical layout set height of foot note and
+/*N*/ // no-text frames to its upper height.
+/*N*/ // In horizontal layout set height of column frames
+/*N*/ // to its upper height.
+/*N*/ pLowerFrm->Frm().Height( Prt().Height() );
+/*N*/ }
+/*N*/ // OD 01.10.2002 #102211#
+/*N*/ // add conditions <!pLowerFrm->IsHeaderFrm()> and
+/*N*/ // <!pLowerFrm->IsFooterFrm()> in order to avoid that
+/*N*/ // the <Grow> of header or footer are overwritten.
+/*N*/ // NOTE: Height of header/footer frame is determined by contents.
+/*N*/ else if ( rOldSize.Height() &&
+/*N*/ !pLowerFrm->IsFtnFrm() &&
+/*N*/ !pLowerFrm->IsHeaderFrm() &&
+/*N*/ !pLowerFrm->IsFooterFrm()
+/*N*/ )
+/*N*/ {
+/*N*/ // Adjust frame height proportional, if lower isn't a
+/*N*/ // foot note, a header or a footer frame and
+/*N*/ // condition <nType & nFixHeight> isn't true.
+/*N*/ // Considering previous conditions:
+/*N*/ // In vertical layout these are column, foot note container,
+/*N*/ // body and no-text frames.
+/*N*/ // In horizontal layout these are column, foot note
+/*N*/ // container, body and no-text frames.
+/*N*/
+/*N*/ // OD 29.10.2002 #97265# - special case for page lowers
+/*N*/ // The page lowers that have to be adjusted on page height
+/*N*/ // change are the body frame and the foot note container
+/*N*/ // frame.
+/*N*/ // In vertical layout the height of both is directly
+/*N*/ // adjusted to the page height change.
+/*N*/ // In horizontal layout the height of the body frame is
+/*N*/ // directly adjsuted to the page height change and the
+/*N*/ // foot note frame height isn't touched, because its
+/*N*/ // determined by its content.
+/*N*/ // OD 31.03.2003 #108446# - apply special case for page
+/*N*/ // lowers - see description above - also for section columns.
+/*N*/ if ( IsPageFrm() ||
+/*N*/ ( IsColumnFrm() && IsInSct() )
+/*N*/ )
+/*N*/ {
+/*N*/ ASSERT( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm(),
+/*N*/ "ChgLowersProp - only for body or foot note container" );
+/*N*/ if ( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm() )
+/*N*/ {
+/*N*/ if ( IsVertical() || pLowerFrm->IsBodyFrm() )
+/*N*/ {
+/*N*/ SwTwips nNewHeight =
+/*N*/ pLowerFrm->Frm().Height() +
+/*N*/ ( Prt().Height() - rOldSize.Height() );
+/*N*/ if ( nNewHeight < 0)
+/*N*/ {
+/*N*/ // OD 01.04.2003 #108446# - adjust assertion condition and text
+/*N*/ ASSERT( !( IsPageFrm() &&
+/*N*/ (pLowerFrm->Frm().Height()>0) &&
+/*N*/ (pLowerFrm->IsValid()) ),
+/*N*/ "ChgLowersProg - negative height for lower.");
+/*N*/ nNewHeight = 0;
+/*N*/ }
+/*N*/ pLowerFrm->Frm().Height( nNewHeight );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nNewHeight;
+/*N*/ // OD 24.10.2002 #97265# - <double> calculation
+/*N*/ // Perform <double> calculation of new height, if
+/*N*/ // one of the coefficients is greater than 50000
+/*N*/ if ( (pLowerFrm->Frm().Height() > 50000) ||
+/*N*/ (Prt().Height() > 50000) )
+/*N*/ {
+/*N*/ double nNewHeightTmp =
+/*N*/ ( double(pLowerFrm->Frm().Height())
+/*N*/ * double(Prt().Height()) )
+/*N*/ / double(rOldSize.Height());
+/*N*/ nNewHeight = SwTwips(nNewHeightTmp);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nNewHeight = ( pLowerFrm->Frm().Height()
+/*N*/ * Prt().Height() ) / rOldSize.Height();
+/*N*/ }
+/*N*/ if( !pLowerFrm->GetNext() )
+/*N*/ {
+/*N*/ SwTwips nSum = Prt().Height();
+/*N*/ SwFrm* pTmp = Lower();
+/*N*/ while( pTmp->GetNext() )
+/*N*/ {
+/*N*/ if( !pTmp->IsFtnContFrm() || !pTmp->IsVertical() )
+/*N*/ nSum -= pTmp->Frm().Height();
+/*N*/ pTmp = pTmp->GetNext();
+/*N*/ }
+/*N*/ if( nSum - nNewHeight == 1 &&
+/*N*/ nSum == pLowerFrm->Frm().Height() )
+/*N*/ nNewHeight = nSum;
+/*N*/ }
+/*N*/ pLowerFrm->Frm().Height( nNewHeight );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ } // end of else { NOT text frame }
+/*N*/
+/*N*/ pLowerFrm->_InvalidateAll();
+/*N*/ if ( bInvaPageForCntnt && pLowerFrm->IsCntntFrm() )
+/*N*/ {
+/*N*/ pLowerFrm->InvalidatePage();
+/*N*/ bInvaPageForCntnt = false;
+/*N*/ }
+/*N*/
+/*N*/ if ( !pLowerFrm->GetNext() && pLowerFrm->IsRetoucheFrm() )
+/*N*/ {
+/*N*/ //Wenn ein Wachstum stattgefunden hat, und die untergeordneten
+/*N*/ //zur Retouche faehig sind (derzeit Tab, Section und Cntnt), so
+/*N*/ //trigger ich sie an.
+/*N*/ if ( rOldSize.Height() < Prt().SSize().Height() ||
+/*N*/ rOldSize.Width() < Prt().SSize().Width() )
+/*N*/ pLowerFrm->SetRetouche();
+/*N*/ }
+/*N*/ pLowerFrm = pLowerFrm->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ // Finally adjust the columns if width is set to auto
+/*N*/ // Possible optimisation: execute this code earlier in this function and
+/*N*/ // return???
+/*N*/ if ( ( bVert && bHeightChgd || ! bVert && bWidthChgd ) &&
+/*N*/ Lower()->IsColumnFrm() )
+/*N*/ {
+/*N*/ // get column attribute
+/*N*/ const SwFmtCol* pColAttr = NULL;
+/*N*/ if ( IsPageBodyFrm() )
+/*N*/ {
+/*N*/ ASSERT( GetUpper()->IsPageFrm(), "Upper is not page frame" )
+/*N*/ pColAttr = &GetUpper()->GetFmt()->GetCol();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( IsFlyFrm() || IsSctFrm(), "Columns not in fly or section" )
+/*N*/ pColAttr = &GetFmt()->GetCol();
+/*N*/ }
+/*N*/
+/*N*/ if ( pColAttr->IsOrtho() && pColAttr->GetNumCols() > 1 )
+/*N*/ AdjustColumns( pColAttr, sal_False, sal_True );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::Format()
+|*
+|* Beschreibung: "Formatiert" den Frame; Frm und PrtArea.
+|* Die Fixsize wird hier nicht eingestellt.
+|* Ersterstellung MA 28. Jul. 92
+|* Letzte Aenderung MA 21. Mar. 95
+|*
+|*************************************************************************/
+/*N*/ void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs )
+/*N*/ {
+/*N*/ ASSERT( pAttrs, "LayoutFrm::Format, pAttrs ist 0." );
+/*N*/
+/*N*/ if ( bValidPrtArea && bValidSize )
+/*?*/ return;
+/*N*/
+/*N*/ const USHORT nLeft = (USHORT)pAttrs->CalcLeft( this );
+/*N*/ const USHORT nUpper = pAttrs->CalcTop();
+/*N*/
+/*N*/ const USHORT nRight = (USHORT)((SwBorderAttrs*)pAttrs)->CalcRight( this );
+/*N*/ const USHORT nLower = pAttrs->CalcBottom();
+/*N*/ BOOL bVert = IsVertical() && !IsPageFrm();
+/*N*/ SwRectFn fnRect = bVert ? fnRectVert : fnRectHori;
+/*N*/ if ( !bValidPrtArea )
+/*N*/ {
+/*N*/ bValidPrtArea = TRUE;
+/*N*/ (this->*fnRect->fnSetXMargins)( nLeft, nRight );
+/*N*/ (this->*fnRect->fnSetYMargins)( nUpper, nLower );
+/*N*/ }
+/*N*/
+/*N*/ if ( !bValidSize )
+/*N*/ {
+/*N*/ if ( !HasFixSize() )
+/*N*/ {
+/*N*/ const SwTwips nBorder = nUpper + nLower;
+/*N*/ const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
+/*N*/ SwTwips nMinHeight = rSz.GetSizeType() == ATT_MIN_SIZE ? rSz.GetHeight() : 0;
+/*N*/ do
+/*N*/ { bValidSize = TRUE;
+/*N*/
+/*N*/ //Die Groesse in der VarSize wird durch den Inhalt plus den
+/*N*/ //Raendern bestimmt.
+/*N*/ SwTwips nRemaining = 0;
+/*N*/ SwFrm *pFrm = Lower();
+/*N*/ while ( pFrm )
+/*N*/ { nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
+/*?*/ // Dieser TxtFrm waere gern ein bisschen groesser
+/*?*/ nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight()
+/*?*/ - (pFrm->Prt().*fnRect->fnGetHeight)();
+/*N*/ else if( pFrm->IsSctFrm() && ((SwSectionFrm*)pFrm)->IsUndersized() )
+/*N*/ nRemaining += ((SwSectionFrm*)pFrm)->Undersize();
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ }
+/*N*/ nRemaining += nBorder;
+/*N*/ nRemaining = Max( nRemaining, nMinHeight );
+/*N*/ const SwTwips nDiff = nRemaining-(Frm().*fnRect->fnGetHeight)();
+/*N*/ const long nOldLeft = (Frm().*fnRect->fnGetLeft)();
+/*N*/ const long nOldTop = (Frm().*fnRect->fnGetTop)();
+/*N*/ if ( nDiff )
+/*N*/ {
+/*N*/ if ( nDiff > 0 )
+/*N*/ Grow( nDiff );
+/*N*/ else
+/*?*/ Shrink( -nDiff );
+/*N*/ //Schnell auf dem kurzen Dienstweg die Position updaten.
+/*N*/ MakePos();
+/*N*/ }
+/*N*/ //Unterkante des Uppers nicht ueberschreiten.
+/*N*/ if ( GetUpper() && (Frm().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ const SwTwips nLimit = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*N*/ if( (this->*fnRect->fnSetLimit)( nLimit ) &&
+/*N*/ nOldLeft == (Frm().*fnRect->fnGetLeft)() &&
+/*N*/ nOldTop == (Frm().*fnRect->fnGetTop)() )
+/*?*/ bValidSize = bValidPrtArea = TRUE;
+/*N*/ }
+/*N*/ } while ( !bValidSize );
+/*N*/ }
+/*N*/ else if ( GetType() & 0x0018 )
+/*N*/ {
+/*N*/ do
+/*N*/ { if ( Frm().Height() != pAttrs->GetSize().Height() )
+/*N*/ ChgSize( Size( Frm().Width(), pAttrs->GetSize().Height()));
+/*N*/ bValidSize = TRUE;
+/*N*/ MakePos();
+/*N*/ } while ( !bValidSize );
+/*N*/ }
+/*N*/ else
+/*N*/ bValidSize = TRUE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::InvalidatePercentLowers()
+|*
+|* Ersterstellung MA 13. Jun. 96
+|* Letzte Aenderung MA 13. Jun. 96
+|*
+|*************************************************************************/
+/*N*/ static void InvaPercentFlys( SwFrm *pFrm, SwTwips nDiff )
+/*N*/ {
+/*N*/ ASSERT( pFrm->GetDrawObjs(), "Can't find any Objects" );
+/*N*/ for ( USHORT i = 0; i < pFrm->GetDrawObjs()->Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pFrm->GetDrawObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ const SwFmtFrmSize &rSz = pFly->GetFmt()->GetFrmSize();
+/*N*/ if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
+/*N*/ {
+/*N*/ BOOL bNotify = TRUE;
+/*N*/ // If we've a fly with more than 90% relative height...
+/*N*/ if( rSz.GetHeightPercent() > 90 && pFly->GetAnchor() &&
+/*N*/ rSz.GetHeightPercent() != 0xFF && nDiff )
+/*N*/ {
+/*?*/ const SwFrm *pRel = pFly->IsFlyLayFrm() ? pFly->GetAnchor():
+/*?*/ pFly->GetAnchor()->GetUpper();
+/*?*/ // ... and we have already more than 90% height and we
+/*?*/ // not allow the text to go through...
+/*?*/ // then a notifycation could cause an endless loop, e.g.
+/*?*/ // 100% height and no text wrap inside a cell of a table.
+/*?*/ if( pFly->Frm().Height()*10 >
+/*?*/ ( nDiff + pRel->Prt().Height() )*9 &&
+/*?*/ pFly->GetFmt()->GetSurround().GetSurround() !=
+/*?*/ SURROUND_THROUGHT )
+/*?*/ bNotify = FALSE;
+/*N*/ }
+/*N*/ if( bNotify )
+/*N*/ pFly->InvalidateSize();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwLayoutFrm::InvaPercentLowers( SwTwips nDiff )
+/*N*/ {
+/*N*/ if ( GetDrawObjs() )
+/*N*/ ::binfilter::InvaPercentFlys( this, nDiff );
+/*N*/
+/*N*/ SwFrm *pFrm = ContainsCntnt();
+/*N*/ if ( pFrm )
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pFrm->IsInTab() && !IsTabFrm() )
+/*N*/ {
+/*N*/ SwFrm *pTmp = pFrm->FindTabFrm();
+/*N*/ ASSERT( pTmp, "Where's my TabFrm?" );
+/*N*/ if( IsAnLower( pTmp ) )
+/*N*/ pFrm = pTmp;
+/*N*/ }
+/*N*/
+/*N*/ if ( pFrm->IsTabFrm() )
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rSz = ((SwLayoutFrm*)pFrm)->GetFmt()->GetFrmSize();
+/*N*/ if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
+/*?*/ pFrm->InvalidatePrt();
+/*N*/ }
+/*N*/ else if ( pFrm->GetDrawObjs() )
+/*N*/ ::binfilter::InvaPercentFlys( pFrm, nDiff );
+/*N*/ pFrm = pFrm->FindNextCnt();
+/*N*/ } while ( pFrm && IsAnLower( pFrm ) ) ;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwLayoutFrm::CalcRel()
+|*
+|* Ersterstellung MA 13. Jun. 96
+|* Letzte Aenderung MA 10. Oct. 96
+|*
+|*************************************************************************/
+/*N*/ long SwLayoutFrm::CalcRel( const SwFmtFrmSize &rSz, BOOL bWidth ) const
+/*N*/ {
+/*N*/ ASSERT( bWidth, "NonFlys, CalcRel: width only" );
+/*N*/
+/*N*/ long nRet = rSz.GetWidth(),
+/*N*/ nPercent = rSz.GetWidthPercent();
+/*N*/
+/*N*/ if ( nPercent )
+/*N*/ {
+/*?*/ const SwFrm *pRel = GetUpper();
+/*?*/ long nRel = LONG_MAX;
+/*?*/ const ViewShell *pSh = GetShell();
+/*?*/ if ( pRel->IsPageBodyFrm() && GetFmt()->GetDoc()->IsBrowseMode() &&
+/*?*/ pSh && pSh->VisArea().Width())
+/*?*/ {
+/*?*/ nRel = pSh->VisArea().Width();
+/*?*/ const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
+/*?*/ nRel -= 2*aBorder.Width();
+/*?*/ long nDiff = nRel - pRel->Prt().Width();
+/*?*/ if ( nDiff > 0 )
+/*?*/ nRel -= nDiff;
+/*?*/ }
+/*?*/ nRel = Min( nRel, pRel->Prt().Width() );
+/*?*/ nRet = nRel * nPercent / 100;
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ long MA_FASTCALL lcl_CalcMinColDiff( SwLayoutFrm *pLayFrm )
+/*N*/ {
+/*N*/ long nDiff = 0, nFirstDiff = 0;
+/*N*/ SwLayoutFrm *pCol = (SwLayoutFrm*)pLayFrm->Lower();
+/*N*/ ASSERT( pCol, "Where's the columnframe?" );
+/*N*/ SwFrm *pFrm = pCol->Lower();
+/*N*/ do
+/*N*/ {
+/*N*/ if( pFrm && pFrm->IsBodyFrm() )
+/*N*/ pFrm = ((SwBodyFrm*)pFrm)->Lower();
+/*N*/ if ( pFrm && pFrm->IsTxtFrm() )
+/*N*/ {
+/*N*/ const long nTmp = ((SwTxtFrm*)pFrm)->FirstLineHeight();
+/*N*/ if ( nTmp != USHRT_MAX )
+/*N*/ {
+/*N*/ if ( pCol == pLayFrm->Lower() )
+/*N*/ nFirstDiff = nTmp;
+/*N*/ else
+/*N*/ nDiff = nDiff ? Min( nDiff, nTmp ) : nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ //Leere Spalten ueberspringen!
+/*N*/ pCol = (SwLayoutFrm*)pCol->GetNext();
+/*N*/ while ( pCol && 0 == (pFrm = pCol->Lower()) )
+/*?*/ pCol = (SwLayoutFrm*)pCol->GetNext();
+/*N*/
+/*N*/ } while ( pFrm && pCol );
+/*N*/
+/*N*/ return nDiff ? nDiff : nFirstDiff ? nFirstDiff : 240;
+/*N*/ }
+
+/*N*/ BOOL lcl_IsFlyHeightClipped( SwLayoutFrm *pLay )
+/*N*/ {
+/*N*/ SwFrm *pFrm = pLay->ContainsCntnt();
+/*N*/ while ( pFrm )
+/*N*/ { if ( pFrm->IsInTab() )
+/*?*/ pFrm = pFrm->FindTabFrm();
+/*N*/
+/*N*/ if ( pFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ USHORT nCnt = pFrm->GetDrawObjs()->Count();
+/*N*/ for ( USHORT i = 0; i < nCnt; ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pFrm->GetDrawObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm* pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if( pFly->IsHeightClipped() && (!pFly->IsFlyFreeFrm() ||
+/*N*/ ((SwFlyFreeFrm*)pFly)->GetPage() ) )
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pFrm = pFrm->FindNextCnt();
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs,
+/*N*/ const SwTwips nBorder, const SwTwips nMinHeight )
+/*N*/ {
+/*N*/ //Wenn Spalten im Spiel sind, so wird die Groesse an der
+/*N*/ //letzten Spalte ausgerichtet.
+/*N*/ //1. Inhalt formatieren.
+/*N*/ //2. Hoehe der letzten Spalte ermitteln, wenn diese zu
+/*N*/ // zu gross ist muss der Fly wachsen.
+/*N*/ // Der Betrag um den der Fly waechst ist aber nicht etwa
+/*N*/ // der Betrag des Ueberhangs, denn wir muessen davon
+/*N*/ // ausgehen, dass etwas Masse zurueckfliesst und so
+/*N*/ // zusaetzlicher Platz geschaffen wird.
+/*N*/ // Im Ersten Ansatz ist der Betrag um den gewachsen wird
+/*N*/ // der Ueberhang geteilt durch die Spaltenanzahl oder
+/*N*/ // der Ueberhang selbst wenn er kleiner als die Spalten-
+/*N*/ // anzahl ist.
+/*N*/ //3. Weiter mit 1. bis zur Stabilitaet.
+/*N*/
+/*N*/ const SwFmtCol &rCol = rAttrs.GetAttrSet().GetCol();
+/*N*/ const USHORT nNumCols = rCol.GetNumCols();
+/*N*/
+/*N*/ FASTBOOL bEnd = FALSE;
+/*N*/ FASTBOOL bBackLock = FALSE;
+/*N*/ SwViewImp *pImp = GetShell() ? GetShell()->Imp() : 0;
+/*N*/ {
+/*N*/ // Zugrunde liegender Algorithmus
+/*N*/ // Es wird versucht, eine optimale Hoehe fuer die Spalten zu finden.
+/*N*/ // nMinimum beginnt mit der uebergebenen Mindesthoehe und wird dann als
+/*N*/ // Maximum der Hoehen gepflegt, bei denen noch Spalteninhalt aus einer
+/*N*/ // Spalte herausragt.
+/*N*/ // nMaximum beginnt bei LONG_MAX und wird als Minimum der Hoehen gepflegt,
+/*N*/ // bei denen der Inhalt gepasst hat.
+/*N*/ // Bei spaltigen Bereichen beginnt nMaximum bei dem maximalen Wert, den
+/*N*/ // die Umgebung vorgibt, dies kann natuerlich ein Wert sein, bei dem noch
+/*N*/ // Inhalt heraushaengt.
+/*N*/ // Es werden die Spalten formatiert, wenn Inhalt heraushaengt, wird nMinimum
+/*N*/ // ggf. angepasst, dann wird gewachsen, mindestens um nMinDiff, aber nicht ueber
+/*N*/ // ein groesseres nMaximum hinaus. Wenn kein Inhalt heraushaengt, sondern
+/*N*/ // noch Luft in einer Spalte ist, schrumpfen wir entsprechend, mindestens um
+/*N*/ // nMinDiff, aber nicht unter das nMinimum.
+/*N*/ // Abgebrochen wird, wenn kein Inhalt mehr heraushaengt und das Minimum sich auf
+/*N*/ // weniger als ein MinDiff dem Maximum angenaehert hat oder das von der
+/*N*/ // Umgebung vorgegebene Maximum erreicht ist und trotzdem Inhalt heraus-
+/*N*/ // haengt.
+/*N*/
+/*N*/ // Kritik an der Implementation
+/*N*/ // 1. Es kann theoretisch Situationen geben, in denen der Inhalt in einer geringeren
+/*N*/ // Hoehe passt und in einer groesseren Hoehe nicht passt. Damit der Code robust
+/*N*/ // gegen solche Verhaeltnisse ist, sind ein paar Abfragen bezgl. Minimum und Maximum
+/*N*/ // drin, die wahrscheinlich niemals zuschlagen koennen.
+/*N*/ // 2. Es wird fuer das Schrumpfen das gleiche nMinDiff benutzt wie fuer das Wachstum,
+/*N*/ // das nMinDiff ist allerdings mehr oder weniger die kleinste erste Zeilenhoehe und
+/*N*/ // als Mindestwert fuer das Schrumpfen nicht unbedingt optimal.
+/*N*/
+/*N*/ long nMinimum = nMinHeight;
+/*N*/ long nMaximum;
+/*N*/ BOOL bNoBalance = FALSE;
+/*N*/ SWRECTFN( this )
+/*N*/ if( IsSctFrm() )
+/*N*/ {
+/*?*/ nMaximum = (Frm().*fnRect->fnGetHeight)() - nBorder +
+/*?*/ (Frm().*fnRect->fnBottomDist)(
+/*?*/ (GetUpper()->*fnRect->fnGetPrtBottom)() );
+/*?*/ nMaximum += GetUpper()->Grow( LONG_MAX PHEIGHT, TRUE );
+/*?*/ if( nMaximum < nMinimum )
+/*?*/ {
+/*?*/ if( nMaximum < 0 )
+/*?*/ nMinimum = nMaximum = 0;
+/*?*/ else
+/*?*/ nMinimum = nMaximum;
+/*?*/ }
+/*?*/ if( nMaximum > BROWSE_HEIGHT )
+/*?*/ nMaximum = BROWSE_HEIGHT;
+/*?*/
+/*?*/ bNoBalance = ((SwSectionFrm*)this)->GetSection()->GetFmt()->
+/*?*/ GetBalancedColumns().GetValue();
+/*?*/ SwFrm* pAny = ContainsAny();
+/*?*/ if( bNoBalance ||
+/*?*/ ( !(Frm().*fnRect->fnGetHeight)() && pAny ) )
+/*?*/ {
+/*?*/ long nTop = (this->*fnRect->fnGetTopMargin)();
+/*?*/ (Frm().*fnRect->fnAddBottom)( nMaximum );
+/*?*/ if( nTop > nMaximum )
+/*?*/ nTop = nMaximum;
+/*?*/ (this->*fnRect->fnSetYMargins)( nTop, 0 );
+/*?*/ }
+/*?*/ if( !pAny && !((SwSectionFrm*)this)->IsFtnLock() )
+/*?*/ {
+/*?*/ SwFtnContFrm* pFtnCont = ((SwSectionFrm*)this)->ContainsFtnCont();
+/*?*/ if( pFtnCont )
+/*?*/ {
+/*?*/ SwFrm* pFtnAny = pFtnCont->ContainsAny();
+/*?*/ if( pFtnAny && pFtnAny->IsValid() )
+/*?*/ {
+/*?*/ bBackLock = TRUE;
+/*?*/ ((SwSectionFrm*)this)->SetFtnLock( TRUE );
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nMaximum = LONG_MAX;
+/*N*/ do
+/*N*/ {
+/*N*/ //Kann eine Weile dauern, deshalb hier auf Waitcrsr pruefen.
+/*N*/ if ( pImp )
+/*N*/ pImp->CheckWaitCrsr();
+/*N*/
+/*N*/ bValidSize = TRUE;
+/*N*/ //Erstmal die Spalten formatieren, das entlastet den
+/*N*/ //Stack ein wenig.
+/*N*/ //Bei der Gelegenheit stellen wir auch gleich mal die
+/*N*/ //Breiten und Hoehen der Spalten ein (so sie denn falsch sind).
+/*N*/ SwLayoutFrm *pCol = (SwLayoutFrm*)Lower();
+/*N*/ SwTwips nAvail = (Prt().*fnRect->fnGetWidth)();
+/*N*/ USHORT nPrtWidth = (USHORT)nAvail;
+/*N*/ for ( USHORT i = 0; i < nNumCols; ++i )
+/*N*/ {
+/*N*/ SwTwips nWidth = rCol.CalcColWidth( i, nPrtWidth );
+/*N*/ if ( i == (nNumCols - 1) ) //Dem Letzten geben wir wie
+/*N*/ nWidth = nAvail; //immer den Rest.
+/*N*/
+/*N*/ SwTwips nWidthDiff = nWidth - (pCol->Frm().*fnRect->fnGetWidth)();
+/*N*/ if( nWidthDiff )
+/*N*/ {
+/*N*/ (pCol->Frm().*fnRect->fnAddRight)( nWidthDiff );
+/*N*/ pCol->_InvalidatePrt();
+/*N*/ if ( pCol->GetNext() )
+/*N*/ pCol->GetNext()->_InvalidatePos();
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nHeightDiff = (Prt().*fnRect->fnGetHeight)() -
+/*N*/ (pCol->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nHeightDiff )
+/*N*/ {
+/*N*/ (pCol->Frm().*fnRect->fnAddBottom)( nHeightDiff );
+/*N*/ pCol->_InvalidatePrt();
+/*N*/ }
+/*N*/ pCol->Calc();
+/*N*/ // ColumnFrms besitzen jetzt einen BodyFrm, der auch kalkuliert werden will
+/*N*/ pCol->Lower()->Calc();
+/*N*/ if( pCol->Lower()->GetNext() )
+/*N*/ pCol->Lower()->GetNext()->Calc(); // SwFtnCont
+/*N*/ pCol = (SwLayoutFrm*)pCol->GetNext();
+/*N*/ nAvail -= nWidth;
+/*N*/ }
+/*N*/
+/*N*/ // OD 14.03.2003 #i11760# - adjust method call <CalcCntnt(..)>:
+/*N*/ // Set 3rd parameter to true in order to forbid format of follow
+/*N*/ // during format of text frames. (2nd parameter = default value.)
+/*N*/ // OD 11.04.2003 #108824# - undo change of fix for #i11760# - allow
+/*N*/ // follow formatting for text frames.
+/*N*/ ::binfilter::CalcCntnt( this );
+/*N*/
+/*N*/ pCol = (SwLayoutFrm*)Lower();
+/*N*/ ASSERT( pCol && pCol->GetNext(), ":-( Spalten auf Urlaub?");
+/*N*/ // bMinDiff wird gesetzt, wenn es keine leere Spalte gibt
+/*N*/ BOOL bMinDiff = TRUE;
+/*N*/ // OD 28.03.2003 #108446# - check for all column content and all columns
+/*N*/ while ( bMinDiff && pCol )
+/*N*/ {
+/*N*/ bMinDiff = 0 != pCol->ContainsCntnt();
+/*N*/ pCol = (SwLayoutFrm*)pCol->GetNext();
+/*N*/ }
+/*N*/ pCol = (SwLayoutFrm*)Lower();
+/*N*/ // OD 28.03.2003 #108446# - initialize local variable
+/*N*/ SwFrm *pLow = NULL;
+/*N*/ SwTwips nDiff = 0;
+/*N*/ SwTwips nMaxFree = 0;
+/*N*/ SwTwips nAllFree = LONG_MAX;
+/*N*/ // bFoundLower wird gesetzt, wenn es mind. eine nichtleere Spalte gibt
+/*N*/ BOOL bFoundLower = FALSE;
+/*N*/ while( pCol )
+/*N*/ {
+/*N*/ SwLayoutFrm* pLay = (SwLayoutFrm*)pCol->Lower();
+/*N*/ SwTwips nInnerHeight = (pLay->Frm().*fnRect->fnGetHeight)() -
+/*N*/ (pLay->Prt().*fnRect->fnGetHeight)();
+/*N*/ if( pLay->Lower() )
+/*N*/ {
+/*N*/ bFoundLower = TRUE;
+/*N*/ nInnerHeight += pLay->InnerHeight();
+/*N*/ }
+/*N*/ else if( nInnerHeight < 0 )
+/*N*/ nInnerHeight = 0;
+/*N*/
+/*N*/ if( pLay->GetNext() )
+/*N*/ {
+/*N*/ bFoundLower = TRUE;
+/*N*/ pLay = (SwLayoutFrm*)pLay->GetNext();
+/*N*/ ASSERT( pLay->IsFtnContFrm(),"FtnContainer exspected" );
+/*N*/ nInnerHeight += pLay->InnerHeight();
+/*N*/ nInnerHeight += (pLay->Frm().*fnRect->fnGetHeight)() -
+/*N*/ (pLay->Prt().*fnRect->fnGetHeight)();
+/*N*/ }
+/*N*/ nInnerHeight -= (pCol->Prt().*fnRect->fnGetHeight)();
+/*N*/ if( nInnerHeight > nDiff )
+/*N*/ {
+/*N*/ nDiff = nInnerHeight;
+/*N*/ nAllFree = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( nMaxFree < -nInnerHeight )
+/*N*/ nMaxFree = -nInnerHeight;
+/*N*/ if( nAllFree > -nInnerHeight )
+/*N*/ nAllFree = -nInnerHeight;
+/*N*/ }
+/*N*/ pCol = (SwLayoutFrm*)pCol->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if ( bFoundLower || ( IsSctFrm() && ((SwSectionFrm*)this)->HasFollow() ) )
+/*N*/ {
+/*N*/ SwTwips nMinDiff = ::binfilter::lcl_CalcMinColDiff( this );
+/*N*/ // Hier wird entschieden, ob wir wachsen muessen, naemlich wenn
+/*N*/ // ein Spalteninhalt (nDiff) oder ein Fly herausragt.
+/*N*/ // Bei spaltigen Bereichen wird beruecksichtigt, dass mit dem
+/*N*/ // Besitz eines nichtleeren Follows die Groesse festgelegt ist.
+/*N*/ if ( nDiff || ::binfilter::lcl_IsFlyHeightClipped( this ) ||
+/*N*/ ( IsSctFrm() && ((SwSectionFrm*)this)->CalcMinDiff( nMinDiff ) ) )
+/*N*/ {
+/*N*/ long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ // Das Minimum darf nicht kleiner sein als unsere PrtHeight,
+/*N*/ // solange noch etwas herausragt.
+/*N*/ if( nMinimum < nPrtHeight )
+/*N*/ nMinimum = nPrtHeight;
+/*N*/ // Es muss sichergestellt sein, dass das Maximum nicht kleiner
+/*N*/ // als die PrtHeight ist, wenn noch etwas herausragt
+/*N*/ if( nMaximum < nPrtHeight )
+/*N*/ nMaximum = nPrtHeight; // Robust, aber kann das ueberhaupt eintreten?
+/*N*/ if( !nDiff ) // wenn nur Flys herausragen, wachsen wir um nMinDiff
+/*N*/ nDiff = nMinDiff;
+/*N*/ // Wenn wir um mehr als nMinDiff wachsen wollen, wird dies auf die
+/*N*/ // Spalten verteilt
+/*N*/ if ( Abs(nDiff - nMinDiff) > nNumCols && nDiff > (long)nNumCols )
+/*N*/ nDiff /= nNumCols;
+/*N*/
+/*N*/ if ( bMinDiff )
+/*N*/ { // Wenn es keinen leeren Spalten gibt, wollen wir mind. um nMinDiff
+/*N*/ // wachsen. Sonderfall: Wenn wir kleiner als die minimale Frmhoehe
+/*N*/ // sind und die PrtHeight kleiner als nMinDiff ist, wachsen wir so,
+/*N*/ // dass die PrtHeight hinterher genau nMinDiff ist.
+/*N*/ long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ if ( nFrmHeight > nMinHeight || nPrtHeight >= nMinDiff )
+/*N*/ nDiff = Max( nDiff, nMinDiff );
+/*N*/ else if( nDiff < nMinDiff )
+/*N*/ nDiff = nMinDiff - nPrtHeight + 1;
+/*N*/ }
+/*N*/ // nMaximum ist eine Groesse, in der der Inhalt gepasst hat,
+/*N*/ // oder der von der Umgebung vorgegebene Wert, deshalb
+/*N*/ // brauchen wir nicht ueber diesen Wrt hinauswachsen.
+/*N*/ if( nDiff + nPrtHeight > nMaximum )
+/*N*/ nDiff = nMaximum - nPrtHeight;
+/*N*/ }
+/*N*/ else if( nMaximum > nMinimum ) // Wir passen, haben wir auch noch Spielraum?
+/*N*/ {
+/*N*/ long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/ if ( nMaximum < nPrtHeight )
+/*N*/ nDiff = nMaximum - nPrtHeight; // wir sind ueber eine funktionierende
+/*N*/ // Hoehe hinausgewachsen und schrumpfen wieder auf diese zurueck,
+/*N*/ // aber kann das ueberhaupt eintreten?
+/*N*/ else
+/*N*/ { // Wir haben ein neues Maximum, eine Groesse, fuer die der Inhalt passt.
+/*N*/ nMaximum = nPrtHeight;
+/*N*/ // Wenn der Freiraum in den Spalten groesser ist als nMinDiff und wir
+/*N*/ // nicht dadurch wieder unter das Minimum rutschen, wollen wir ein wenig
+/*N*/ // Luft herauslassen.
+/*N*/ if( !bNoBalance && ( nMaxFree >= nMinDiff && (!nAllFree
+/*N*/ || nMinimum < nPrtHeight - nMinDiff ) ) )
+/*N*/ {
+/*N*/ nMaxFree /= nNumCols; // auf die Spalten verteilen
+/*N*/ nDiff = nMaxFree < nMinDiff ? -nMinDiff : -nMaxFree; // mind. nMinDiff
+/*N*/ if( nPrtHeight + nDiff <= nMinimum ) // Unter das Minimum?
+/*N*/ nDiff = ( nMinimum - nMaximum ) / 2; // dann lieber die Mitte
+/*N*/ }
+/*N*/ else if( nAllFree )
+/*N*/ {
+/*N*/ nDiff = -nAllFree;
+/*N*/ if( nPrtHeight + nDiff <= nMinimum ) // Less than minimum?
+/*N*/ nDiff = ( nMinimum - nMaximum ) / 2; // Take the center
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( nDiff ) // jetzt wird geschrumpft oder gewachsen..
+/*N*/ {
+/*N*/ Size aOldSz( Prt().SSize() );
+/*N*/ long nTop = (this->*fnRect->fnGetTopMargin)();
+/*N*/ nDiff = (Prt().*fnRect->fnGetHeight)() + nDiff + nBorder -
+/*N*/ (Frm().*fnRect->fnGetHeight)();
+/*N*/ (Frm().*fnRect->fnAddBottom)( nDiff );
+/*N*/ (this->*fnRect->fnSetYMargins)( nTop, nBorder - nTop );
+/*N*/ ChgLowersProp( aOldSz );
+/*N*/ NotifyFlys();
+/*N*/
+/*N*/ //Es muss geeignet invalidiert werden, damit
+/*N*/ //sich die Frms huebsch ausbalancieren
+/*N*/ //- Der jeweils erste ab der zweiten Spalte bekommt
+/*N*/ // ein InvalidatePos();
+/*N*/ pCol = (SwLayoutFrm*)Lower()->GetNext();
+/*N*/ while ( pCol )
+/*N*/ {
+/*N*/ pLow = pCol->Lower();
+/*N*/ if ( pLow )
+/*N*/ pLow->_InvalidatePos();
+/*N*/ pCol = (SwLayoutFrm*)pCol->GetNext();
+/*N*/ }
+/*N*/ if( IsSctFrm() && ((SwSectionFrm*)this)->HasFollow() )
+/*N*/ {
+/*N*/ // Wenn wir einen Follow erzeugt haben, muessen wir
+/*N*/ // seinem Inhalt die Chance geben, im CalcCntnt
+/*N*/ // zurueckzufliessen
+/*N*/ SwCntntFrm* pTmpCntnt =
+/*N*/ ((SwSectionFrm*)this)->GetFollow()->ContainsCntnt();
+/*N*/ if( pTmpCntnt )
+/*N*/ pTmpCntnt->_InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bEnd = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ bEnd = TRUE;
+/*N*/
+/*N*/ } while ( !bEnd || !bValidSize );
+/*N*/ }
+/*N*/ // OD 01.04.2003 #108446# - Don't collect endnotes for sections. Thus, set
+/*N*/ // 2nd parameter to <true>.
+/*N*/ ::binfilter::CalcCntnt( this, true );
+/*N*/ if( IsSctFrm() )
+/*N*/ {
+/*N*/ // OD 14.03.2003 #i11760# - adjust 2nd parameter - TRUE --> true
+/*N*/ ::binfilter::CalcCntnt( this, true );
+/*N*/ if( bBackLock )
+/*N*/ ((SwSectionFrm*)this)->SetFtnLock( FALSE );
+/*N*/ }
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwRootFrm::InvalidateAllCntnt()
+|*
+|* Ersterstellung MA 13. Feb. 98
+|* Letzte Aenderung MA 12. Aug. 00
+|*
+|*************************************************************************/
+
+
+
+/*N*/ void lcl_InvalidateAllCntnt( SwCntntFrm *pCnt, BYTE nInv );
+
+/*N*/ void lcl_InvalidateCntnt( SwCntntFrm *pCnt, BYTE nInv )
+/*N*/ {
+/*N*/ SwCntntFrm *pLastTabCnt = NULL;
+/*N*/ SwCntntFrm *pLastSctCnt = NULL;
+/*N*/ while ( pCnt )
+/*N*/ {
+/*N*/ if( nInv & INV_SECTION )
+/*N*/ {
+/*?*/ if( pCnt->IsInSct() )
+/*?*/ {
+/*?*/ // Siehe oben bei Tabellen
+/*?*/ if( !pLastSctCnt )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pLastSctCnt = lcl_InvalidateSection( pCnt, nInv );
+/*?*/ if( pLastSctCnt == pCnt )
+/*?*/ pLastSctCnt = NULL;
+/*?*/ }
+/*?*/ #ifdef DBG_UTIL
+/*?*/ else
+/*?*/ ASSERT( !pLastSctCnt, "Where's the last SctCntnt?" );
+/*?*/ #endif
+/*N*/ }
+/*N*/ if( nInv & INV_TABLE )
+/*N*/ {
+/*?*/ if( pCnt->IsInTab() )
+/*?*/ {
+/*?*/ // Um nicht fuer jeden CntntFrm einer Tabelle das FindTabFrm() zu rufen
+/*?*/ // und wieder die gleiche Tabelle zu invalidieren, merken wir uns den letzten
+/*?*/ // CntntFrm der Tabelle und reagieren erst wieder auf IsInTab(), wenn wir
+/*?*/ // an diesem vorbei sind.
+/*?*/ // Beim Eintritt in die Tabelle wird der LastSctCnt auf Null gesetzt,
+/*?*/ // damit Bereiche im Innern der Tabelle richtig invalidiert werden.
+/*?*/ // Sollte die Tabelle selbst in einem Bereich stehen, so wird an
+/*?*/ // diesem die Invalidierung bis zu dreimal durchgefuehrt, das ist vertretbar.
+/*?*/ if( !pLastTabCnt )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pLastTabCnt = lcl_InvalidateTable( pCnt->FindTabFrm(), nInv );
+/*?*/ }
+/*?*/ if( pLastTabCnt == pCnt )
+/*?*/ {
+/*?*/ pLastTabCnt = NULL;
+/*?*/ pLastSctCnt = NULL;
+/*?*/ }
+/*?*/ }
+/*?*/ #ifdef DBG_UTIL
+/*?*/ else
+/*?*/ ASSERT( !pLastTabCnt, "Where's the last TabCntnt?" );
+/*?*/ #endif
+/*N*/ }
+/*N*/
+/*N*/ if( nInv & INV_SIZE )
+/*N*/ pCnt->Prepare( PREP_CLEAR, 0, FALSE );
+/*N*/ if( nInv & INV_POS )
+/*?*/ pCnt->_InvalidatePos();
+/*N*/ if( nInv & INV_PRTAREA )
+/*?*/ pCnt->_InvalidatePrt();
+/*N*/ if ( nInv & INV_LINENUM )
+/*?*/ pCnt->InvalidateLineNum();
+/*N*/ if ( pCnt->GetDrawObjs() )
+/*N*/ lcl_InvalidateAllCntnt( pCnt, nInv );
+/*N*/ pCnt = pCnt->GetNextCntntFrm();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_InvalidateAllCntnt( SwCntntFrm *pCnt, BYTE nInv )
+/*N*/ {
+/*N*/ SwDrawObjs &rObjs = *pCnt->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if ( pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*?*/ ::binfilter::lcl_InvalidateCntnt( pFly->ContainsCntnt(), nInv );
+/*?*/ if( nInv & INV_DIRECTION )
+/*?*/ pFly->CheckDirChange();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwRootFrm::InvalidateAllCntnt( BYTE nInv )
+/*N*/ {
+/*N*/ // Erst werden alle Seitengebundenen FlyFrms abgearbeitet.
+/*N*/ SwPageFrm *pPage = (SwPageFrm*)Lower();
+/*N*/ while( pPage )
+/*N*/ {
+/*N*/ pPage->InvalidateFlyLayout();
+/*N*/ pPage->InvalidateFlyCntnt();
+/*N*/ pPage->InvalidateFlyInCnt();
+/*N*/ pPage->InvalidateLayout();
+/*N*/ pPage->InvalidateCntnt();
+/*N*/ pPage->InvalidatePage( pPage ); //Damit ggf. auch der Turbo verschwindet
+/*N*/
+/*N*/ if ( pPage->GetSortedObjs() )
+/*N*/ {
+/*N*/ const SwSortDrawObjs &rObjs = *pPage->GetSortedObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ ::binfilter::lcl_InvalidateCntnt( ((SwVirtFlyDrawObj*)pO)->GetFlyFrm()->ContainsCntnt(),
+/*N*/ nInv );
+/*N*/ if( nInv & INV_DIRECTION )
+/*?*/ ((SwVirtFlyDrawObj*)pO)->GetFlyFrm()->CheckDirChange();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( nInv & INV_DIRECTION )
+/*?*/ pPage->CheckDirChange();
+/*N*/ pPage = (SwPageFrm*)(pPage->GetNext());
+/*N*/ }
+/*N*/
+/*N*/ //Hier den gesamten Dokumentinhalt und die zeichengebundenen Flys.
+/*N*/ ::binfilter::lcl_InvalidateCntnt( ContainsCntnt(), nInv );
+/*N*/
+/*N*/ if( nInv & INV_PRTAREA )
+/*N*/ {
+/*?*/ ViewShell *pSh = GetShell();
+/*?*/ if( pSh )
+/*?*/ pSh->InvalidateWindows( Frm() );
+/*N*/ }
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/layout/virtoutp.hxx b/binfilter/bf_sw/source/core/layout/virtoutp.hxx
new file mode 100644
index 000000000000..694e1de39f05
--- /dev/null
+++ b/binfilter/bf_sw/source/core/layout/virtoutp.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VIRTOUTP_HXX
+#define _VIRTOUTP_HXX
+
+#include <vcl/virdev.hxx>
+
+#include "swtypes.hxx" // UCHAR
+#include "swrect.hxx" // SwRect
+namespace binfilter {
+
+class ViewShell;
+#define VIRTUALHEIGHT 64
+
+/*************************************************************************
+ * class SwTxtVout
+ *************************************************************************/
+
+class SwLayVout
+{
+ friend void _FrmFinit(); //loescht das Vout
+private:
+ ViewShell* pSh;
+ OutputDevice* pOut;
+ VirtualDevice* pVirDev;
+ SwRect aRect;
+ SwRect aOrgRect;
+ Size aSize;
+ USHORT nCount;
+
+
+public:
+ SwLayVout() : pVirDev(NULL), pOut(0), aSize(0, VIRTUALHEIGHT), nCount(0) {}
+ ~SwLayVout() { delete pVirDev; }
+
+ /// OD 27.09.2002 #103636# - change 2nd parameter <rRect> - no longer <const>
+
+ void SetOrgRect( SwRect &rRect ) { aOrgRect = rRect; }
+ const SwRect& GetOrgRect() const { return aOrgRect; }
+
+ BOOL IsFlushable() { return 0 != pOut; }
+};
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/makefile.mk b/binfilter/bf_sw/source/core/makefile.mk
new file mode 100644
index 000000000000..acba096db455
--- /dev/null
+++ b/binfilter/bf_sw/source/core/makefile.mk
@@ -0,0 +1,98 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..
+BFPRJ=..$/..
+
+PRJNAME=binfilter
+TARGET=sw_core
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+
+INC+= -I$(PRJ)$/inc$/bf_sw
+.IF "$(CALLTARGETS)"=="core"
+RC_SUBDIRS=
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SUBLIBS1= \
+ $(SLB)$/sw_graphic.lib \
+ $(SLB)$/sw_para.lib \
+ $(SLB)$/sw_attr.lib \
+ $(SLB)$/sw_edit.lib \
+ $(SLB)$/sw_crsr.lib \
+ $(SLB)$/sw_view.lib \
+ $(SLB)$/sw_frmedt.lib \
+ $(SLB)$/sw_ole.lib \
+ $(SLB)$/sw_fields.lib \
+ $(SLB)$/sw_tox.lib \
+ $(SLB)$/sw_bastyp.lib
+
+SUBLIBS2= \
+ $(SLB)$/sw_draw.lib \
+ $(SLB)$/sw_sw3io.lib \
+ $(SLB)$/sw_swg.lib \
+ $(SLB)$/sw_layout.lib \
+ $(SLB)$/sw_text.lib \
+ $(SLB)$/sw_txtnode.lib \
+ $(SLB)$/sw_doc.lib \
+ $(SLB)$/sw_docnode.lib \
+ $(SLB)$/sw_unocore.lib
+
+.IF "$(dbgutil)" != ""
+SUBLIBS2+= \
+ $(SLB)$/sw_except.lib
+.ENDIF
+
+#-------------------------------------------------------------------------
+
+################################################################
+
+LIB1TARGET=$(SLB)$/sw_core1.lib
+LIB1FILES= \
+ $(SUBLIBS1)
+
+LIB2TARGET=$(SLB)$/sw_core2.lib
+LIB2FILES= \
+ $(SUBLIBS2)
+
+.INCLUDE : target.mk
+
+################################################################
+
+#-------------------------------------------------------------------------
+
+
diff --git a/binfilter/bf_sw/source/core/ole/makefile.mk b/binfilter/bf_sw/source/core/ole/makefile.mk
new file mode 100644
index 000000000000..145e04fe87ce
--- /dev/null
+++ b/binfilter/bf_sw/source/core/ole/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_ole
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_ndole.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/sw_ndole.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/ole/sw_ndole.cxx b/binfilter/bf_sw/source/core/ole/sw_ndole.cxx
new file mode 100644
index 000000000000..e435257a6322
--- /dev/null
+++ b/binfilter/bf_sw/source/core/ole/sw_ndole.cxx
@@ -0,0 +1,536 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <tools/urlobj.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <unotools/configitem.hxx>
+#include <vcl/outdev.hxx>
+
+#include <fmtanchr.hxx>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <doc.hxx>
+#include <pam.hxx>
+#include <section.hxx>
+#include <cntfrm.hxx>
+#include <docsh.hxx>
+#include <ndole.hxx>
+#include <sw3io.hxx>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+using namespace ::utl;
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+
+class SwOLELRUCache : private SvPtrarr, private ::utl::ConfigItem
+{
+ sal_uInt16 nLRU_InitSize;
+ sal_Bool bInUnload;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > GetPropertyNames();
+
+public:
+ SwOLELRUCache();
+
+ void Load();
+
+ SvPtrarr::Count;
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+
+ void Insert( SwOLEObj& rObj );
+ void Remove( SwOLEObj& rObj );
+
+ void RemovePtr( SwOLEObj* pObj )
+ {
+ USHORT nPos = SvPtrarr::GetPos( pObj );
+ if( USHRT_MAX != nPos )
+ SvPtrarr::Remove( nPos );
+ }
+};
+
+void SwOLELRUCache::Commit() {}
+void SwOLELRUCache::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ) {}
+
+SwOLELRUCache* SwOLEObj::pOLELRU_Cache = 0;
+
+// --------------------
+// SwOLENode
+// --------------------
+
+/*N*/ SwOLENode::SwOLENode( const SwNodeIndex &rWhere,
+/*N*/ SvInPlaceObject *pObj,
+/*N*/ SwGrfFmtColl *pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr ) :
+/*N*/ SwNoTxtNode( rWhere, ND_OLENODE, pGrfColl, pAutoAttr ),
+/*N*/ aOLEObj( pObj ),
+/*N*/ bOLESizeInvalid( FALSE )
+/*N*/ {
+/*N*/ aOLEObj.SetNode( this );
+/*N*/ }
+
+/*N*/ SwOLENode::SwOLENode( const SwNodeIndex &rWhere,
+/*N*/ const String &rString,
+/*N*/ SwGrfFmtColl *pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr ) :
+/*N*/ SwNoTxtNode( rWhere, ND_OLENODE, pGrfColl, pAutoAttr ),
+/*N*/ aOLEObj( rString ),
+/*N*/ bOLESizeInvalid( FALSE )
+/*N*/ {
+/*N*/ aOLEObj.SetNode( this );
+/*N*/ }
+
+/*N*/ SwCntntNode *SwOLENode::SplitNode( const SwPosition & )
+/*N*/ {
+/*N*/ // OLE-Objecte vervielfaeltigen ??
+/*N*/ ASSERT( FALSE, "OleNode: can't split." );
+/*N*/ return this;
+/*N*/ }
+
+// Laden eines in den Undo-Bereich verschobenen OLE-Objekts
+
+
+// Sichern eines in den Undo-Bereich zu verschiebenden OLE-Objekts
+
+
+
+/*N*/ SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere,
+/*N*/ SvInPlaceObject *pObj,
+/*N*/ SwGrfFmtColl* pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ {
+/*N*/ ASSERT( pGrfColl,"SwNodes::MakeOLENode: Formatpointer ist 0." );
+/*N*/
+/*N*/ SwOLENode *pNode =
+/*N*/ new SwOLENode( rWhere, pObj, pGrfColl, pAutoAttr );
+/*N*/
+/*N*/ #if 0
+/*N*/ JP 02.10.97 - OLE Objecte stehen immer alleine im Rahmen, also hat es
+/*N*/ keinen Sinn, nach einem vorherigen/nachfolgenden
+/*N*/ ContentNode zu suchen!
+/*N*/
+/*N*/ SwCntntNode *pCntntNd;
+/*N*/ SwIndex aIdx( rWhere, -1 );
+/*N*/ if ( (pCntntNd=(*this)[ rWhere ]->GetCntntNode()) != 0 )
+/*N*/ pCntntNd->MakeFrms( rWhere, aIdx );
+/*N*/ else
+/*N*/ {
+/*N*/ aIdx--;
+/*N*/ if ( (pCntntNd=(*this)[aIdx]->GetCntntNode()) != 0 )
+/*N*/ {
+/*N*/ SwIndex aTmp( aIdx );
+/*N*/ aIdx++;
+/*N*/ pCntntNd->MakeFrms( aTmp, aIdx );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ return pNode;
+/*N*/ }
+
+
+/*N*/ SwOLENode * SwNodes::MakeOLENode( const SwNodeIndex & rWhere,
+/*N*/ String &rName,
+/*N*/ SwGrfFmtColl* pGrfColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ {
+/*N*/ ASSERT( pGrfColl,"SwNodes::MakeOLENode: Formatpointer ist 0." );
+/*N*/
+/*N*/ SwOLENode *pNode =
+/*N*/ new SwOLENode( rWhere, rName, pGrfColl, pAutoAttr );
+/*N*/
+/*N*/ #if 0
+/*N*/ JP 02.10.97 - OLE Objecte stehen immer alleine im Rahmen, also hat es
+/*N*/ keinen Sinn, nach einem vorherigen/nachfolgenden
+/*N*/ ContentNode zu suchen!
+/*N*/ SwCntntNode *pCntntNd;
+/*N*/ SwIndex aIdx( rWhere, -1 );
+/*N*/ if ( (pCntntNd=(*this)[ rWhere ]->GetCntntNode()) != 0 )
+/*N*/ pCntntNd->MakeFrms( rWhere, aIdx );
+/*N*/ else
+/*N*/ {
+/*N*/ aIdx--;
+/*N*/ if ( (pCntntNd=(*this)[aIdx]->GetCntntNode()) != 0 )
+/*N*/ {
+/*N*/ SwIndex aTmp( aIdx );
+/*N*/ aIdx++;
+/*N*/ pCntntNd->MakeFrms( aTmp, aIdx );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ return pNode;
+/*N*/ }
+
+
+/*N*/ Size SwOLENode::GetTwipSize() const
+/*N*/ {
+/*N*/ SvInPlaceObjectRef xRef( ((SwOLENode*)this)->aOLEObj.GetOleRef() );
+/*N*/ Size aSz( xRef->GetVisArea().GetSize() );
+/*N*/ const MapMode aDest( MAP_TWIP );
+/*N*/ const MapMode aSrc ( xRef->GetMapUnit() );
+/*N*/ return OutputDevice::LogicToLogic( aSz, aSrc, aDest );
+/*N*/ }
+
+
+/*N*/ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+/*N*/ {
+/*N*/ // Falls bereits eine SvPersist-Instanz existiert, nehmen wir diese
+/*N*/ SvPersist* p = pDoc->GetPersist();
+/*N*/ if( !p )
+/*N*/ {
+/*?*/ ASSERT( pDoc->GetRefForDocShell(),
+/*?*/ "wo ist die Ref-Klasse fuer die DocShell?")
+/*?*/ p = new SwDocShell( pDoc, SFX_CREATE_MODE_INTERNAL );
+/*?*/ *pDoc->GetRefForDocShell() = p;
+/*?*/ p->DoInitNew( NULL );
+/*N*/ }
+/*N*/
+/*N*/ // Wir hauen das Ding auf SvPersist-Ebene rein
+/*N*/ String aNewName( Sw3Io::UniqueName( p->GetStorage(), "Obj" ) );
+/*N*/ SvPersist* pSrc = GetDoc()->GetPersist();
+/*N*/
+/*N*/ p->CopyObject( aOLEObj.aName, aNewName, pSrc );
+/*N*/ SwOLENode* pOLENd = pDoc->GetNodes().MakeOLENode( rIdx, aNewName,
+/*N*/ (SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl(),
+/*N*/ (SwAttrSet*)GetpSwAttrSet() );
+/*N*/
+/*N*/ pOLENd->SetChartTblName( GetChartTblName() );
+/*N*/ pOLENd->SetAlternateText( GetAlternateText() );
+/*N*/ pOLENd->SetContour( HasContour(), HasAutomaticContour() );
+/*N*/
+/*N*/ pOLENd->SetOLESizeInvalid( TRUE );
+/*N*/ pDoc->SetOLEPrtNotifyPending();
+/*N*/
+/*N*/ return pOLENd;
+/*N*/ }
+
+
+/*N*/ BOOL SwOLENode::IsInGlobalDocSection() const
+/*N*/ {
+/*N*/ // suche den "Body Anchor"
+/*N*/ ULONG nEndExtraIdx = GetNodes().GetEndOfExtras().GetIndex();
+/*N*/ const SwNode* pAnchorNd = this;
+/*N*/ do {
+/*N*/ SwFrmFmt* pFlyFmt = pAnchorNd->GetFlyFmt();
+/*N*/ if( !pFlyFmt )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ const SwFmtAnchor& rAnchor = pFlyFmt->GetAnchor();
+/*N*/ if( !rAnchor.GetCntntAnchor() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ pAnchorNd = &rAnchor.GetCntntAnchor()->nNode.GetNode();
+/*N*/ } while( pAnchorNd->GetIndex() < nEndExtraIdx );
+/*N*/
+/*N*/ const SwSectionNode* pSectNd = pAnchorNd->FindSectionNode();
+/*N*/ if( !pSectNd )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ while( pSectNd )
+/*N*/ {
+/*N*/ pAnchorNd = pSectNd;
+/*N*/ pSectNd = pAnchorNd->FindStartNode()->FindSectionNode();
+/*N*/ }
+/*N*/
+/*N*/ // in pAnchorNd steht der zuletzt gefundene Section Node. Der muss
+/*N*/ // jetzt die Bedingung fuers GlobalDoc erfuellen.
+/*N*/ pSectNd = (SwSectionNode*)pAnchorNd;
+/*N*/ return FILE_LINK_SECTION == pSectNd->GetSection().GetType() &&
+/*N*/ pSectNd->GetIndex() > nEndExtraIdx;
+/*N*/ }
+
+
+/*N*/ BOOL SwOLENode::IsOLEObjectDeleted() const
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ if( aOLEObj.pOLERef && aOLEObj.pOLERef->Is() )
+/*N*/ {
+/*N*/ SvPersist* p = GetDoc()->GetPersist();
+/*N*/ if( p ) // muss da sein
+/*N*/ {
+/*N*/ SvInfoObjectRef aRef( p->Find( aOLEObj.aName ) );
+/*N*/ if( aRef.Is() )
+/*N*/ bRet = aRef->IsDeleted();
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*N*/ SwOLEObj::SwOLEObj( SvInPlaceObject *pObj ) :
+/*N*/ pOLERef( new SvInPlaceObjectRef( pObj ) ),
+/*N*/ pOLENd( 0 )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwOLEObj::SwOLEObj( const String &rString ) :
+/*N*/ pOLERef( 0 ),
+/*N*/ pOLENd( 0 ),
+/*N*/ aName( rString )
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwOLEObj::~SwOLEObj()
+/*N*/ {
+/*N*/ if( pOLERef && pOLERef->Is() )
+/*N*/ //#41499# Kein DoClose(). Beim Beenden ruft der Sfx ein DoClose auf
+/*N*/ //die offenen Objekte. Dadurch wird ggf. eine temp. OLE-Grafik wieder
+/*N*/ //in eine Grafik gewandelt. Der OLE-Node wird zerstoert. Das DoClose
+/*N*/ //wueder in das leere laufen, weil das Objekt bereits im DoClose steht.
+/*N*/ //Durch das remove unten waere das DoClose aber nicht vollstaendig.
+/*N*/ (*pOLERef)->GetProtocol().Reset();
+/*N*/ delete pOLERef;
+/*N*/ // Object aus dem Storage removen!!
+/*N*/ if( pOLENd && !pOLENd->GetDoc()->IsInDtor() ) //NIcht notwendig im DTor (MM)
+/*N*/ {
+/*N*/ SvPersist* p = pOLENd->GetDoc()->GetPersist();
+/*N*/ if( p ) // muss er existieren ?
+/*N*/ p->Remove( aName );
+/*N*/ }
+/*N*/
+/*N*/ if( pOLELRU_Cache )
+/*N*/ {
+/*N*/ pOLELRU_Cache->RemovePtr( this );
+/*N*/ if( !pOLELRU_Cache->Count() )
+/*N*/ // der letzte macht die Tuer zu
+/*N*/ delete pOLELRU_Cache, pOLELRU_Cache = 0;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwOLEObj::SetNode( SwOLENode* pNode )
+/*N*/ {
+/*N*/ pOLENd = pNode;
+/*N*/ if ( pOLERef && !aName.Len() )
+/*N*/ {
+/*N*/ SwDoc* pDoc = pNode->GetDoc();
+/*N*/
+/*N*/ // Falls bereits eine SvPersist-Instanz existiert, nehmen wir diese
+/*N*/ SvPersist* p = pDoc->GetPersist();
+/*N*/ if( !p )
+/*N*/ {
+/*?*/ ASSERT( !this, "warum wird hier eine DocShell angelegt?" );
+/*?*/ p = new SwDocShell( pDoc, SFX_CREATE_MODE_INTERNAL );
+/*?*/ p->DoInitNew( NULL );
+/*N*/ }
+/*N*/ // Wir hauen das Ding auf SvPersist-Ebene rein
+/*N*/ aName = Sw3Io::UniqueName( p->GetStorage(), "Obj" );
+/*N*/ SvInfoObjectRef refObj = new SvEmbeddedInfoObject( *pOLERef, aName );
+/*N*/
+/*N*/ ULONG nLstLen = p->GetObjectList() ? p->GetObjectList()->Count() : 0;
+/*N*/ if ( !p->Move( refObj, aName ) ) // Eigentuemer Uebergang!
+/*?*/ refObj.Clear();
+/*N*/ else if( nLstLen == p->GetObjectList()->Count() )
+/*N*/ {
+/*N*/ // Task 91051: Info-Object not insertet, so it exist another
+/*N*/ // InfoObject to the same Object and the Objects
+/*N*/ // is stored in the persist. This InfoObject we must
+/*N*/ // found.
+/*?*/ p->Insert( refObj );
+/*N*/ }
+/*N*/ ASSERT( refObj.Is(), "InsertObject failed" );
+/*N*/ }
+/*N*/ }
+
+/*N*/ BOOL SwOLEObj::IsOleRef() const
+/*N*/ {
+/*N*/ return pOLERef && pOLERef->Is();
+/*N*/ }
+
+/*N*/ SvInPlaceObjectRef SwOLEObj::GetOleRef()
+/*N*/ {
+/*N*/ if( !pOLERef || !pOLERef->Is() )
+/*N*/ {
+/*N*/ SvPersist* p = pOLENd->GetDoc()->GetPersist();
+/*N*/ ASSERT( p, "kein SvPersist vorhanden" );
+/*N*/
+/*N*/ // MIB 18.5.97: DIe Base-URL wird jetzt gesetzt, damit Plugins
+/*N*/ // nach dem Laden und vor dem Aktivieren des Frames korrekt
+/*N*/ // geladen werden koennen
+/*N*/ String sBaseURL( ::binfilter::StaticBaseUrl::GetBaseURL() );
+/*N*/ const SwDocShell *pDocSh = pOLENd->GetDoc()->GetDocShell();
+/*N*/ const SfxMedium *pMedium;
+/*N*/ if( pDocSh && 0 != (pMedium = pDocSh->GetMedium()) &&
+/*N*/ pMedium->GetName() != sBaseURL )
+/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( pMedium->GetName() );
+/*N*/
+/*N*/ SvPersistRef xObj = p->GetObject( aName );
+/*N*/ ASSERT( !pOLERef || !pOLERef->Is(),
+/*N*/ "rekursiver Aufruf von GetOleRef() ist nicht erlaubt" )
+/*N*/
+/*N*/ ::binfilter::StaticBaseUrl::SetBaseURL( sBaseURL );
+/*N*/
+/*N*/ if ( !xObj.Is() )
+/*N*/ {
+/*?*/ //Das Teil konnte nicht geladen werden (wahrsch. Kaputt).
+/*?*/ Rectangle aArea;
+/*?*/ SwFrm *pFrm = pOLENd->GetFrm();
+/*?*/ if ( pFrm )
+/*?*/ {
+/*?*/ Size aSz( pFrm->Frm().SSize() );
+/*?*/ const MapMode aSrc ( MAP_TWIP );
+/*?*/ const MapMode aDest( MAP_100TH_MM );
+/*?*/ aSz = OutputDevice::LogicToLogic( aSz, aSrc, aDest );
+/*?*/ aArea.SetSize( aSz );
+/*?*/ }
+/*?*/ else
+/*?*/ aArea.SetSize( Size( 5000, 5000 ) );
+/*?*/ xObj = new SvDeathObject( aArea );
+/*N*/ }
+/*N*/
+/*N*/ if( pOLERef )
+/*?*/ *pOLERef = &xObj;
+/*N*/ else
+/*N*/ pOLERef = new SvInPlaceObjectRef( xObj );
+/*N*/ }
+/*N*/
+/*N*/ if( !pOLELRU_Cache )
+/*N*/ pOLELRU_Cache = new SwOLELRUCache;
+/*N*/
+/*N*/ pOLELRU_Cache->Insert( *this );
+/*N*/
+/*N*/ return *pOLERef;
+/*N*/ }
+
+
+/*N*/ BOOL SwOLEObj::RemovedFromLRU()
+/*N*/ {
+/*N*/ BOOL bRet = TRUE;
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ SwOLELRUCache::SwOLELRUCache()
+/*N*/ : SvPtrarr( 64, 16 ),
+/*N*/ ::utl::ConfigItem( OUString::createFromAscii( "Office.Common/Cache" )),
+/*N*/ bInUnload( sal_False ),
+/*N*/ nLRU_InitSize( 20 )
+/*N*/ {
+/*N*/ EnableNotification( GetPropertyNames() );
+/*N*/ Load();
+/*N*/ }
+
+/*N*/ ::com::sun::star::uno::Sequence< ::rtl::OUString > SwOLELRUCache::GetPropertyNames()
+/*N*/ {
+/*N*/ Sequence< OUString > aNames( 1 );
+/*N*/ OUString* pNames = aNames.getArray();
+/*N*/ pNames[0] = OUString::createFromAscii( "Writer/OLE_Objects" );
+/*N*/ return aNames;
+/*N*/ }
+
+
+
+/*N*/ void SwOLELRUCache::Load()
+/*N*/ {
+/*N*/ Sequence< OUString > aNames( GetPropertyNames() );
+/*N*/ Sequence< Any > aValues = GetProperties( aNames );
+/*N*/ const Any* pValues = aValues.getConstArray();
+/*N*/ DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
+/*N*/ if( aValues.getLength() == aNames.getLength() &&
+/*N*/ pValues->hasValue() )
+/*N*/ {
+/*N*/ sal_Int32 nVal;
+/*N*/ *pValues >>= nVal;
+/*N*/ if( 20 > nVal )
+/*N*/ nVal = 20;
+/*N*/
+/*N*/ if( !bInUnload )
+/*N*/ {
+/*N*/ USHORT nPos = SvPtrarr::Count();
+/*N*/ if( nVal < nLRU_InitSize && nPos > nVal )
+/*N*/ {
+/*N*/ // remove the last entries
+/*N*/ while( nPos > nVal )
+/*N*/ {
+/*?*/ SwOLEObj* pObj = (SwOLEObj*) SvPtrarr::GetObject( --nPos );
+/*?*/ if( pObj->RemovedFromLRU() )
+/*?*/ SvPtrarr::Remove( nPos );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ nLRU_InitSize = (USHORT)nVal;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwOLELRUCache::Insert( SwOLEObj& rObj )
+/*N*/ {
+/*N*/ if( !bInUnload )
+/*N*/ {
+/*N*/ SwOLEObj* pObj = &rObj;
+/*N*/ USHORT nPos = SvPtrarr::GetPos( pObj );
+/*N*/ if( nPos ) // der auf der 0. Pos muss nicht verschoben werden!
+/*N*/ {
+/*N*/ if( USHRT_MAX != nPos )
+/*?*/ SvPtrarr::Remove( nPos );
+/*N*/
+/*N*/ SvPtrarr::Insert( pObj, 0 );
+/*N*/
+/*N*/ nPos = SvPtrarr::Count();
+/*N*/ while( nPos > nLRU_InitSize )
+/*N*/ {
+/*?*/ pObj = (SwOLEObj*) SvPtrarr::GetObject( --nPos );
+/*?*/ if( pObj->RemovedFromLRU() )
+/*?*/ SvPtrarr::Remove( nPos );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else
+/*N*/ {
+/*?*/ SwOLEObj* pObj = &rObj;
+/*?*/ USHORT nPos = SvPtrarr::GetPos( pObj );
+/*?*/ ASSERT( USHRT_MAX != nPos, "Insert a new OLE object into a looked cache" );
+/*?*/ }
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ void SwOLELRUCache::Remove( SwOLEObj& rObj )
+/*N*/ {
+/*N*/ if( !bInUnload )
+/*N*/ {
+/*N*/ USHORT nPos = SvPtrarr::GetPos( &rObj );
+/*N*/ if( USHRT_MAX != nPos && rObj.RemovedFromLRU() )
+/*N*/ SvPtrarr::Remove( nPos );
+/*N*/ }
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/para/makefile.mk b/binfilter/bf_sw/source/core/para/makefile.mk
new file mode 100644
index 000000000000..f0ed4d3edc1b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/para/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_para
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_paratr.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/sw_paratr.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/para/sw_paratr.cxx b/binfilter/bf_sw/source/core/para/sw_paratr.cxx
new file mode 100644
index 000000000000..cb4dd7085778
--- /dev/null
+++ b/binfilter/bf_sw/source/core/para/sw_paratr.cxx
@@ -0,0 +1,305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "unomid.h"
+#include <com/sun/star/style/DropCapFormat.hpp>
+
+#include <cppuhelper/implbase4.hxx>
+
+#include <SwStyleNameMapper.hxx>
+#include "errhdl.hxx"
+#include "paratr.hxx"
+#include "charfmt.hxx"
+#include "cmdid.h"
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+/*N*/ TYPEINIT2_AUTOFACTORY( SwFmtDrop, SfxPoolItem, SwClient);
+/*N*/ TYPEINIT1_AUTOFACTORY( SwRegisterItem, SfxBoolItem);
+/*N*/ TYPEINIT1_AUTOFACTORY( SwNumRuleItem, SfxStringItem);
+/*N*/ TYPEINIT1_AUTOFACTORY( SwParaConnectBorderItem, SfxBoolItem);
+
+/*************************************************************************
+|* Beschreibung Methoden von SwFmtDrop
+|* Ersterstellung MS 19.02.91
+|* Letzte Aenderung JP 08.08.94
+*************************************************************************/
+
+
+
+/*N*/ SwFmtDrop::SwFmtDrop()
+/*N*/ : SfxPoolItem( RES_PARATR_DROP ),
+/*N*/ SwClient( 0 ),
+/*N*/ nLines( 0 ),
+/*N*/ nChars( 0 ),
+/*N*/ nDistance( 0 ),
+/*N*/ pDefinedIn( 0 ),
+/*N*/ bWholeWord( sal_False ),
+/*N*/ nReadFmt( USHRT_MAX )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwFmtDrop::SwFmtDrop( const SwFmtDrop &rCpy )
+/*N*/ : SfxPoolItem( RES_PARATR_DROP ),
+/*N*/ SwClient( rCpy.pRegisteredIn ),
+/*N*/ nLines( rCpy.GetLines() ),
+/*N*/ nChars( rCpy.GetChars() ),
+/*N*/ nDistance( rCpy.GetDistance() ),
+/*N*/ bWholeWord( rCpy.GetWholeWord() ),
+/*N*/ pDefinedIn( 0 ),
+/*N*/ nReadFmt( rCpy.nReadFmt )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwFmtDrop::~SwFmtDrop()
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ void SwFmtDrop::SetCharFmt( SwCharFmt *pNew )
+/*N*/ {
+/*N*/ //Ummelden
+/*N*/ if ( pRegisteredIn )
+/*?*/ pRegisteredIn->Remove( this );
+/*N*/ if(pNew)
+/*N*/ pNew->Add( this );
+/*N*/ nReadFmt = USHRT_MAX;
+/*N*/ }
+
+
+
+/*N*/ void SwFmtDrop::Modify( SfxPoolItem *pA, SfxPoolItem *pB )
+/*N*/ {
+/*N*/ if( pDefinedIn )
+/*N*/ {
+/*N*/ if( !pDefinedIn->ISA( SwFmt ))
+/*N*/ pDefinedIn->Modify( this, this );
+/*N*/ else if( pDefinedIn->GetDepends() &&
+/*N*/ !pDefinedIn->IsModifyLocked() )
+/*N*/ {
+/*?*/ // selbst den Abhaengigen vom Format bescheid sagen. Das
+/*?*/ // Format selbst wuerde es nicht weitergeben, weil es ueber
+/*?*/ // die Abpruefung nicht hinauskommt.
+/*?*/ SwClientIter aIter( *pDefinedIn );
+/*?*/ SwClient * pLast = aIter.GoStart();
+/*?*/ if( pLast ) // konnte zum Anfang gesprungen werden ??
+/*?*/ do {
+/*?*/ pLast->Modify( this, this );
+/*?*/ if( !pDefinedIn->GetDepends() ) // Baum schon Weg ??
+/*?*/ break;
+/*?*/ } while( 0 != ( pLast = aIter++ ));
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ sal_Bool SwFmtDrop::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ // fuers UNDO: pruefe ob das Attribut wirklich in diesem Format steht
+/*N*/ #ifdef USED_30
+/*N*/ if( pDefinedIn )
+/*N*/ {
+/*N*/ if( IS_TYPE( SwTxtNode, pDefinedIn )
+/*N*/ && ((SwTxtNode*)pDefinedIn)->....... )
+/*N*/ ;
+/*N*/ else if( IS_TYPE( SwTxtFmtColl, pDefinedIn )
+/*N*/ && ((SwTxtFmtColl*)pDefinedIn)->....... )
+/*N*/ ;
+/*N*/ // this == pFmt->GetAttr( RES_PARATR_DROP, sal_False ))
+/*N*/ // return pFmt->GetInfo( rInfo );
+/*N*/
+/*N*/ }
+/*N*/ #endif
+/*N*/ return sal_True; // weiter
+/*N*/ }
+
+
+
+/*N*/ int SwFmtDrop::operator==( const SfxPoolItem& rAttr ) const
+/*N*/ {
+/*N*/ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+/*N*/ return ( nLines == ((SwFmtDrop&)rAttr).GetLines() &&
+/*N*/ nChars == ((SwFmtDrop&)rAttr).GetChars() &&
+/*N*/ nDistance == ((SwFmtDrop&)rAttr).GetDistance() &&
+/*N*/ bWholeWord == ((SwFmtDrop&)rAttr).GetWholeWord() &&
+/*N*/ GetCharFmt() == ((SwFmtDrop&)rAttr).GetCharFmt() &&
+/*N*/ pDefinedIn == ((SwFmtDrop&)rAttr).pDefinedIn );
+/*N*/ }
+
+
+
+/*N*/ SfxPoolItem* SwFmtDrop::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwFmtDrop( *this );
+/*N*/ }
+
+
+
+
+/*N*/ bool SwFmtDrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+/*N*/ {
+/*N*/ switch(nMemberId&~CONVERT_TWIPS)
+/*N*/ {
+/*N*/ case MID_DROPCAP_LINES : rVal <<= (sal_Int16)nLines; break;
+/*N*/ case MID_DROPCAP_COUNT : rVal <<= (sal_Int16)nChars; break;
+/*N*/ case MID_DROPCAP_DISTANCE : rVal <<= (sal_Int16) TWIP_TO_MM100(nDistance); break;
+/*N*/ case MID_DROPCAP_FORMAT:
+/*N*/ {
+/*N*/ style::DropCapFormat aDrop;
+/*N*/ aDrop.Lines = nLines ;
+/*N*/ aDrop.Count = nChars ;
+/*N*/ aDrop.Distance = TWIP_TO_MM100(nDistance);
+/*N*/ rVal.setValue(&aDrop, ::getCppuType((const style::DropCapFormat*)0));
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_DROPCAP_WHOLE_WORD:
+/*N*/ rVal.setValue(&bWholeWord, ::getBooleanCppuType());
+/*N*/ break;
+/*N*/ case MID_DROPCAP_CHAR_STYLE_NAME :
+/*N*/ {
+/*N*/ ::rtl::OUString sName;
+/*N*/ if(GetCharFmt())
+/*N*/ sName = SwStyleNameMapper::GetProgName(
+/*N*/ GetCharFmt()->GetName(), GET_POOLID_CHRFMT );
+/*N*/ rVal <<= sName;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ return true;
+/*N*/ }
+
+/*N*/ bool SwFmtDrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+/*N*/ {
+/*N*/ switch(nMemberId&~CONVERT_TWIPS)
+/*N*/ {
+/*N*/ case MID_DROPCAP_LINES :
+/*N*/ {
+/*N*/ sal_Int8 nTemp;
+/*N*/ rVal >>= nTemp;
+/*N*/ if(nTemp >=1 && nTemp < 0x7f)
+/*N*/ nLines = (BYTE)nTemp;
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_DROPCAP_COUNT :
+/*N*/ {
+/*N*/ sal_Int16 nTemp;
+/*N*/ rVal >>= nTemp;
+/*N*/ if(nTemp >=1 && nTemp < 0x7f)
+/*N*/ nChars = (BYTE)nTemp;
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_DROPCAP_DISTANCE :
+/*N*/ {
+/*N*/ sal_Int16 nVal;
+/*N*/ if ( rVal >>= nVal )
+/*N*/ nDistance = (sal_Int16) MM100_TO_TWIP((sal_Int32)nVal);
+/*N*/ else
+/*N*/ return sal_False;
+/*N*/ break;
+/*N*/ }
+/*N*/ case MID_DROPCAP_FORMAT:
+/*N*/ {
+/*N*/ if(rVal.getValueType() == ::getCppuType((const style::DropCapFormat*)0))
+/*N*/ {
+/*N*/ const style::DropCapFormat* pDrop = (const style::DropCapFormat*)rVal.getValue();
+/*N*/ nLines = pDrop->Lines;
+/*N*/ nChars = pDrop->Count;
+/*N*/ nDistance = MM100_TO_TWIP(pDrop->Distance);
+/*N*/ }
+/*N*/ else
+/*N*/ //exception( wrong_type)
+/*N*/ ;
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_DROPCAP_WHOLE_WORD:
+/*N*/ bWholeWord = *(sal_Bool*)rVal.getValue();
+/*N*/ break;
+/*N*/ case MID_DROPCAP_CHAR_STYLE_NAME :
+/*N*/ DBG_ERROR("char format cannot be set in PutValue()!");
+/*N*/ break;
+/*N*/ }
+/*N*/ return true;
+/*N*/ }
+
+// class SwRegisterItem -------------------------------------------------
+
+
+/*N*/ SfxPoolItem* SwRegisterItem::Clone( SfxItemPool * ) const
+/*N*/ {
+/*N*/ return new SwRegisterItem( *this );
+/*N*/ }
+
+// class SwNumRuleItem -------------------------------------------------
+/*N*/ SfxPoolItem* SwNumRuleItem::Clone( SfxItemPool *pPool ) const
+/*N*/ {
+/*N*/ return new SwNumRuleItem( *this );
+/*N*/ }
+/* -----------------------------27.06.00 11:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ bool SwNumRuleItem::QueryValue( ::com::sun::star::uno::Any& rVal, BYTE nMemberId ) const
+/*N*/ {
+/*N*/ ::rtl::OUString sRet = SwStyleNameMapper::GetProgName(GetValue(), GET_POOLID_NUMRULE );
+/*N*/ rVal <<= sRet;
+/*N*/ return true;
+/*N*/ }
+/* -----------------------------27.06.00 11:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+/*N*/ bool SwNumRuleItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE nMemberId )
+/*N*/ {
+/*N*/ ::rtl::OUString uName;
+/*N*/ rVal >>= uName;
+/*N*/ SetValue(SwStyleNameMapper::GetUIName(uName, GET_POOLID_NUMRULE));
+/*N*/ return true;
+/*N*/ }
+/* -----------------19.05.2003 10:44-----------------
+
+ --------------------------------------------------*/
+ SfxPoolItem* SwParaConnectBorderItem::Clone( SfxItemPool * ) const
+{
+ return new SwParaConnectBorderItem( *this );
+}
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/crypter.hxx b/binfilter/bf_sw/source/core/sw3io/crypter.hxx
new file mode 100644
index 000000000000..fd74ec2b35f1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/crypter.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW3CRYPT_HXX
+#define _SW3CRYPT_HXX
+
+#include <tools/solar.h>
+class String;
+namespace binfilter {
+
+
+#define PASSWDLEN 16
+
+class Crypter
+{
+ BYTE cPasswd[ PASSWDLEN ];
+public:
+ Crypter( const ByteString& rPasswd );
+ short GetMaxPasswdLen() const { return PASSWDLEN; }
+ short GetMinPasswdLen() const { return 5; }
+
+ void Encrypt( ByteString& rTxt ) const;
+ void Decrypt( ByteString& rTxt ) const;
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/makefile.mk b/binfilter/bf_sw/source/core/sw3io/makefile.mk
new file mode 100644
index 000000000000..ee2ae9122d77
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/makefile.mk
@@ -0,0 +1,92 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_sw3io
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_sw3io.cxx \
+ sw_sw3attr.cxx \
+ sw_sw3block.cxx \
+ sw_sw3doc.cxx \
+ sw_sw3field.cxx \
+ sw_sw3fmts.cxx \
+ sw_sw3imp.cxx \
+ sw_sw3misc.cxx \
+ sw_sw3nodes.cxx \
+ sw_sw3npool.cxx \
+ sw_sw3num.cxx \
+ sw_sw3page.cxx \
+ sw_sw3redln.cxx \
+ sw_sw3sectn.cxx \
+ sw_sw3style.cxx \
+ sw_sw3table.cxx \
+ sw_crypter.cxx
+
+SLOFILES = \
+ $(SLO)$/sw_sw3io.obj \
+ $(SLO)$/sw_sw3attr.obj \
+ $(SLO)$/sw_sw3block.obj \
+ $(SLO)$/sw_sw3doc.obj \
+ $(SLO)$/sw_sw3field.obj \
+ $(SLO)$/sw_sw3fmts.obj \
+ $(SLO)$/sw_sw3imp.obj \
+ $(SLO)$/sw_sw3misc.obj \
+ $(SLO)$/sw_sw3nodes.obj \
+ $(SLO)$/sw_sw3npool.obj \
+ $(SLO)$/sw_sw3num.obj \
+ $(SLO)$/sw_sw3page.obj \
+ $(SLO)$/sw_sw3redln.obj \
+ $(SLO)$/sw_sw3sectn.obj \
+ $(SLO)$/sw_sw3style.obj \
+ $(SLO)$/sw_sw3table.obj \
+ $(SLO)$/sw_crypter.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/sw3io/sw3ids.hxx b/binfilter/bf_sw/source/core/sw3io/sw3ids.hxx
new file mode 100644
index 000000000000..7db5661a4bb9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw3ids.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW3IDS_HXX
+#define _SW3IDS_HXX
+namespace binfilter {
+
+#define SWGF_NO_FRAMES 0x0001 // keine Layout-Frames einlesen
+#define SWGF_BLOCKNAME 0x0002 // Header hat Textbaustein-Namen
+#define SWGF_HAS_PASSWD 0x0008 // Stream ist passwortgeschuetzt
+#define SWGF_HAS_GRFLNK 0x0010 // Stream enthaelt Grafik-Links
+#define SWGF_HAS_DDELNK 0x0020 // Stream enthaelt DDE-Links
+#define SWGF_HAS_OLELNK 0x0040 // Stream enthaelt OLE-Links
+#define SWGF_PORT_GRAF 0x0080 // Grafiken sollen portabel sein
+#define SWGF_HAS_PGNUMS 0x0100 // Stream hat Seitennummern
+#define SWGF_PERSIST 0x0200 // Stream benoetigt SvPersist
+#define SWGF_BAD_LAYOUT 0x4000 // Fehlerhaftes Layout
+#define SWGF_BAD_FILE 0x8000 // Fehler beim Schreiben
+
+#define SWG_FRSTVERSION 0x0001 // erste Version
+#define SWG_SPOOLFLAGS 0x0002 // Flag-Byte im SWG_STRINGPOOL-Record
+#define SWG_POOLIDS 0x0003 // Pool-IDS im Stringpool
+#define SWG_ZORDER 0x0004 // Z-Order-Record im Drawing Layer
+#define SWG_LAYFRAMES 0x0005 // Layout-Frames
+#define SWG_CRYPT 0x0006 // neues Crypting im PASSWORD-Record
+#define SWG_DDESEP 0x0007 // neuer DDE-Token-Seperator
+#define SWG_OLEVIS2PAGE 0x0008 // neuer Member des Docs
+#define SWG_OLENAME 0x0009 // neuer Member des OLE-Nodes
+#define SWG_SHORTFIELDS 0x000a // neue Speicherung von Fields
+#define SWG_DELETEOLE 0x000b // unbenutzte OLE-Objecte aus Storage
+ // loeschen
+#define SWG_INTERNET 0x000c // Fussnoten-Offset
+#define SWG_FLYWRAPCHGD 0x000d // Ausweichmechanik von Txt und Table fuer
+ // Flys an umbruechen geaendert,
+ // Invalidierung notwendig.
+#define SWG_INETBROWSER 0x000e // URL-Grf-Nodes, Browse-Flag, Format-Ums.
+#define SWG_NONUMLEVEL 0x000f // NO_NUM umgestellt auf NO_NUMLEVEL
+#define SWG_MULTIDB 0x0010 // Datenbankfelder mit DB-Namen
+#define SWG_TARGETFRAME 0x0011 // Image-Maps/Target-Frames
+#define SWG_USEDDB 0x0012 // In Feldern verwendete Datenbanken
+ // speichern
+#define SWG_INETMACROTAB 0x0013 // InetFelder mit opt. MakroTabelle
+#define SWG_NEXTPREVPAGE 0x0014 // PageNumberField (Next/Prev)
+#define SWG_URLANDMAP 0x0015 // URL bzw. MAP von den Nodes in das
+ // Attribut an den Flys verschoben
+#define SWG_REGISTER 0x0016 // Spalten-Register/kein Dflt-Target-Frame
+#define SWG_NEWNUMRULE 0x0017 // neue Numrules -> Format Erweiterung
+#define SWG_DBTABLE 0x0018 // Datenbankfelder mit DB- und Tabellennamen
+#define SWG_CONDCOLLS 0x0019 // bedingte Vorlagen am TextNode
+#define SWG_WRAPDRAWOBJ 0x0020 // Umfluss um Zeichenobjekte
+#define SWG_FMTGETREFFLD 0x0021 // GetRefFelder mit erweitertem Format-Enum
+#define SWG_EXPORT31 0x0022 // Version fuer 3.1 Export aus 4.0
+
+#define SWG_DESKTOP40 0x0101 // StarDesktop 4.0
+#define SWG_SVXMACROS 0x0102 // SvxMacros um ScriptType erweitert
+#define SWG_TBLCHGMODE 0x0103 // Tabellen Change-Modus
+#define SWG_OFFICE40FP2 0x0104 // nur zur Wiedererkennung
+#define SWG_EXPORT40 0x0110 // Version fuer 4.0-Export ab 5.0
+
+// Von der 359 bis zur 362 gab es mal die Versionen 0x0120 und 0x0121.
+// Dann kam die 363, und es wurde wieder zur 0x0104 zurueckgegangen. Mit
+// den Fileformat-Umstellungen kam dann die 0x200.
+//#define SWG_OFFICE41 0x0120 // Alles nach StarOffice 4.0 (358)
+//#define SWG_SCRIPTURLS 0x0121 // Scripte koennen jetzt URLs sein
+
+#define SWG_NEWFIELDS 0x0200 // Felder mit Numberformatter-Zahlenformat
+#define SWG_LONGIDX 0x0201 // Node-Idx sind nung longs uvm.
+#define SWG_NEWERFIELDS 0x0202 // Felder aufgeraeumt
+#define SWG_HTMLCOLLCHG 0x0203 // Neue-HTML-Poolvorlagen-Ids
+#define SWG_FIXEDFLDS 0x0204 // Noch mehr fixe Felder
+#define SWG_DATEOFFSET 0x0205 // Offset fuer DateTimeFields
+#define SWG_SETEXPFLDCHG 0x0206 // SetExpFieldType - Kapitelweise numer.
+#define SWG_HIDDENDRAWOBJS 0x0207 // versteckte Zeichen-Objekte
+#define SWG_FIXEDFNFLD 0x0208 // versteckte Zeichen-Objekte
+#define SWG_LONGRECS 0x0209 // Record-Laenge > 8/16MB
+#define SWG_OLEPRTNOTIFY 0x210 // Ab hier OLE Benachrichtigung fuer Printer
+ // richtig Implementiert.
+#define SWG_NUMRELSPACE 0x0211 // relative Numerierung (5.1-Beta2)
+#define SWG_NUMRELSPACE2 0x0212 // relative Numerierung
+#define SWG_TOXTABS 0x0213 // relative Numerierung
+#define SWG_NEWTOX 0x0214 // TOXs reworked
+#define SWG_NEWTOX2 0x0215 // TOXs reworked again
+#define SWG_FTNANCHORFMT 0x0216 // Ftn-/End-Note Anchor with CharFormat
+#define SWG_TOXTABCHAR 0x0217 // TabChar in TOXs
+#define SWG_UNICODE1ST 0x0218 // unicode
+#define SWG_NEWGRFATTR 0x0219 // new graphic attributes
+#define SWG_NEWGRFATTR_FIX 0x0220 // new graphic attributes
+#define SWG_VIRTUAL_DEVICE 0x0221 // printer indepemdent formatting
+#define SWG_HIDDENOBJLAYER 0x0222 // sdr objs in hidden layer
+
+#define SWG_VERSION 0x0222 // aktuelle Version
+
+// SWG_MAJORVERSION ist die erste Version, zu der die aktuelle Version
+// noch kompatibel sein soll.
+
+#define SWG_MAJORVERSION_30 (SWG_FRSTVERSION)
+#define SWG_MAJORVERSION_40 (SWG_DESKTOP40)
+#define SWG_MAJORVERSION_50 (SWG_LONGIDX)
+#define SWG_MAJORVERSION (SWG_MAJORVERSION_50)
+
+// Die folgende Versionsnummer wird immer dann hochgezaehlt, wenn das
+// Fileformat inkompatibel zu frueheren Version wird, also aeltere SW3
+// eine mit der aktuellen Version geschriebene Datei nicht mehr lesen
+// koennen.
+// Wurde in der 373/374 voruebergehend benutzt
+
+#define SWG_CV_FRSTVER 0x00 // erste "compatbility" Version
+//#define SWG_CV_SCNDVER 0x01 // 5.0 FFmt mit 4.0 ClassID
+
+#define SWG_CVERSION 0x00 // aktuelle "compatibility" Version
+
+ // Indexwerte fuer String-IDs:
+#define IDX_NO_VALUE (USHORT) 0xFFFF // Indexwert nicht belegt
+#define IDX_DFLT_VALUE (USHORT) 0xFFFE // Defaultwert verwenden
+#define IDX_COLCNTFMT (USHORT) 0xFFFD // Frames: Default-Spaltenformat am Doc
+#define IDX_NOCONV_FF (USHORT) 0xFFFC // 0xff nicht mitkonvertieren
+ // (DB-Felder)
+#define IDX_SPEC_VALUE (USHORT) 0xFFF0 // ab hier fuer Sonderwerte reserviert
+#define IDX_PAGEFMT (USHORT) 0x8000 // Frames: Maske fuer Seitenformat-Index
+#define IDX_LEFTFMT (USHORT) 0x4000 // Frames: Maske fuer Leftformat-Index
+
+#define SWG_OUTLINE '0' // Outline-Numerierung
+#define SWG_FOOTINFO '1' // Fussnoten-Info
+#define SWG_PAGEFOOTINFO '2' // Seiten-Fussnoten-Info
+#define SWG_NODENUM '3' // Absatz-Numerierung
+#define SWG_ENDNOTEINFO '4' // Endnoten-Info
+#define SWG_LINENUMBERINFO '5' // Zeilennummer-Info
+#define SWG_DOCDUMMIES '6' // Dummy-Member des Dokuments
+#define SWG_CONFIG '7' // Config
+#define SWG_PGPREVIEWPRTDATA '8' // PagePreViewPrintData
+#define SWG_STRINGPOOL '!' // String-Pool
+#define SWG_RECSIZES '%' // Record-Groessen
+#define SWG_OUTLINEEXT '+' // Erweiterung Outline-Numerierung
+
+#define SWG_BOOKMARKS 'a' // Alle Bookmarks
+//war SWG_BLOCKNAME 'b' // Name eines Textbausteins
+#define SWG_CHARFMT 'c' // Zeichenformat-Vorlage (wird nicht
+ // geschrieben)
+#define SWG_DOCSTAT 'd' // Dokument - Statistik
+#define SWG_BLOCKTEXT 'e' // Textbaustein-Text
+#define SWG_FRAMEFMT 'f' // Frame-Format
+#define SWG_GRFFMT 'g' // Grafikformat (wird nicht
+ // gelesen/geschrieben)
+// 'h'
+#define SWG_REPTEXTNODE 'i' // Wiederholung eines Text-Nodes
+#define SWG_DICTIONARY 'j' // Woerterbuecher des Onlinespellings
+#define SWG_CONTOUR 'k' // Contour-Poly-Polygon
+#define SWG_FLYFMT 'l' // FlyFrame-Format
+#define SWG_MACRO 'm' // Makrodefinition
+#define SWG_NUMFMT 'n' // Numerierungs-Format
+#define SWG_SDRFMT 'o' // SdrObject-Frameformat
+#define SWG_PAGEDESC 'p' // Seitenvorlage
+#define SWG_NUMBERFORMATTER 'q' // der Numberformatter
+#define SWG_FREEFMT 'r' // Frameformat ohne Doc-Anbindung
+#define SWG_SECTFMT 's' // Section-Format
+#define SWG_TABLEBOX 't' // Tabellen-Zelle
+#define SWG_TOXDESCS 'u' // index descriptions (since 5.2)
+#define SWG_NODEREDLINE 'v' // Redline-Section
+#define SWG_WRONGLIST 'w' // Liste falscher Worte
+#define SWG_TOXDESC 'x' // Verzeichnis-Descriptor
+#define SWG_TOXDESCS51 'y' // Verzeichnis-Descriptoren (upto 5.1)
+#define SWG_OLELINK 'z' // OLE-Link Daten
+
+#define SWG_ATTRIBUTE 'A' // Attribut
+#define SWG_BOOKMARK 'B' // Bookmark
+#define SWG_COMMENT 'C' // Kommentare
+#define SWG_DBNAME 'D' // DatenbankName
+#define SWG_TABLE 'E' // Tabelle
+#define SWG_FLYFRAMES 'F' // FlyFrames
+#define SWG_GRFNODE 'G' // Grafik-Node
+// 'H'
+#define SWG_SECTION 'I' // Section
+#define SWG_JOBSETUP 'J' // Job-Setup
+#define SWG_MARK 'K' // Markierung
+#define SWG_TABLELINE 'L' // Tabellen-Zeile
+#define SWG_MACROTBL 'M' // Makro-Tabelle
+#define SWG_CONTENTS 'N' // Textteil
+#define SWG_OLENODE 'O' // OLE-Node
+#define SWG_PAGEDESCS 'P' // Seitenvorlagen
+// 'Q'
+#define SWG_NUMRULE 'R' // Numerierungs-Regelwerk
+#define SWG_ATTRSET 'S' // Attribut-Set
+#define SWG_TEXTNODE 'T' // Textnode
+#define SWG_LAYOUTINFO 'U' // Frame-Infos
+#define SWG_REDLINES 'V' // Redlines
+#define SWG_PASSWORD 'W' // Passwort
+#define SWG_IMAGEMAP 'X' // Image-Map (fruehr SWG_GRAPHIC_EXT)
+#define SWG_FIELDTYPE 'Y' // Feldtyp
+#define SWG_EOF 'Z' // EOF-Markierung
+
+#ifdef TEST_HUGE_DOCS
+#define SWG_TESTHUGEDOCS '?'
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+
+// IDs innerhalb eines OLENODE-Records
+
+#define SW_OLE_CHARTNAME '1' // Name der Tabelle des Chart-Objectes
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw3imp.hxx b/binfilter/bf_sw/source/core/sw3io/sw3imp.hxx
new file mode 100644
index 000000000000..87dd6ba4fb39
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw3imp.hxx
@@ -0,0 +1,847 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW3IMP_HXX
+#define _SW3IMP_HXX
+
+#include <tools/string.hxx>
+#include <bf_svtools/svarray.hxx>
+#ifndef _SVSTDARR_BYTES_DECL
+#define _SVSTDARR_BYTES
+#include <bf_svtools/svstdarr.hxx>
+#endif
+#include <bf_so3/svstor.hxx>
+#include <bf_so3/persist.hxx>
+#include <tools/poly.hxx>
+#include <unotools/fontcvt.hxx>
+
+#include <docary.hxx>
+#include <sw3ids.hxx>
+#include <docstat.hxx>
+#include <list>
+class SvStream;
+class SvXub_StrLens;
+class SvxMacroTableDtor;
+namespace binfilter {
+
+class ImageMap;
+class SvStringsDtor;
+class SvStorageInfoList;
+class SvStrings;
+
+class Crypter;
+class SvUShorts;
+
+class SfxItemSet;
+class SfxPoolItem;
+
+
+class Sw3Io;
+class SwAttrSet;
+class SwBlockNames;
+class SwBookmark;
+class SwCntntNode;
+class SwDoc;
+class SwEndNoteInfo;
+class SwField;
+class SwFieldType;
+class SwFmt;
+class SwFmtFld;
+class SwFmtINetFmt;
+class SwFrm;
+class SwFrmFmt;
+class SwIndex;
+class SwNoTxtNode;
+class SwNodeIndex;
+class SwNodeNum;
+class SwNumFmt;
+class SwNumRule;
+class SwOLENode;
+class SwPaM;
+class SwPageDesc;
+class SwPageFtnInfo;
+class SwPosFlyFrms;
+class SwRedline;
+class SwSectionNode;
+class SwStartNode;
+class SwTable;
+class SwTableBox;
+class SwTableBoxes;
+class SwTableLine;
+class SwTableLines;
+class SwTableNode;
+class SwTxtFmtColl;
+class SwTxtNode;
+class SwgReaderOption;
+class SwpHints;
+class SwFlyFrm;
+
+class Sw3RecordSizeTable;
+class SvxTabStopItem;
+class Sw3TOXBase;
+class SwInsHardBlankSoftHyph;
+class SvxFontItem;
+class SdrObject;
+
+
+extern sal_Char __FAR_DATA SW3HEADER[]; // 3.0/3.1 Header
+extern sal_Char __FAR_DATA SW4HEADER[]; // 4.0 Header
+extern sal_Char __FAR_DATA SW5HEADER[]; // 5.0 Header
+
+extern sal_Char __FAR_DATA sSW3IO_FixedField[];
+extern sal_Char __FAR_DATA sSW3IO_AuthorityField[];
+extern sal_Char __FAR_DATA sSW3IO_DropDownField[]; // #108791#
+
+// die Block-Groessen fuer die einzelnen Stream (Lesen/Schreiben)
+#define SW3_BSR_STYLES 16384
+#define SW3_BSW_STYLES 16384
+#define SW3_BSR_NUMRULES 16384
+#define SW3_BSW_NUMRULES 16384
+#define SW3_BSR_PAGESTYLES 16384
+#define SW3_BSW_PAGESTYLES 16384
+#define SW3_BSR_DRAWING 16384
+#define SW3_BSW_DRAWING 16384
+#define SW3_BSR_CONTENTS 32768
+#define SW3_BSW_CONTENTS 32768
+// Contents-Stream, wenn nur der Header gelesen wird oder es ein
+// Textbaustein-Stream ohne Formatierung ist
+#define SW3_BSR_CONTENTS_HEADER 120
+#define SW3_BSR_CONTENTS_FLAT 2048
+#define SW3_BSW_CONTENTS_FLAT 2048
+#define SW3_BSR_BLKDIR 8192
+#define SW3_BSW_BLKDIR 8192
+
+#define STRING_MAXLEN52 STRING_MAXLEN
+
+typedef ::std::list< SdrObject * > SwHiddenDrawObjList_Impl;
+
+class Sw3String : public String
+{
+ USHORT nPoolId;
+
+// OPT: Cache fuer Formate im StringPool
+ SwFmt *pCachedFmt; // Opt. fuer Lesen: Id zugeordnetes Format
+// /OPT: Cache fuer Formate im StringPool
+
+public:
+ Sw3String( const String& r, USHORT n = 0 ) :
+ String( r ), nPoolId( n ), pCachedFmt( 0 ) {}
+ USHORT GetPoolId() const { return nPoolId; }
+
+// OPT: Cache fuer Formate im StringPool
+ void SetCachedFmt( SwFmt *pFmt ) { pCachedFmt = pFmt; }
+ SwFmt *GetCachedFmt() const { return pCachedFmt; }
+// /OPT: Cache fuer Formate im StringPool
+
+};
+
+class Sw3NumRuleInfo
+{
+ String aOrigName; // Name der Rule im File.
+ String aNewName; // (ggf. neuer ) Name der Rule im Dokument
+
+ BOOL bUsed;
+
+public:
+
+ Sw3NumRuleInfo( const String& rOrigName, const String& rNewName ) :
+ aOrigName( rOrigName ), aNewName( rNewName ), bUsed( FALSE ) {}
+
+ Sw3NumRuleInfo( const String& rOrigName ) :
+ aOrigName( rOrigName ), aNewName( rOrigName ), bUsed( FALSE ) {}
+
+ void SetUsed() { bUsed = TRUE; }
+ BOOL IsUsed() const { return bUsed; }
+
+ const String& GetOrigName() const { return aOrigName; }
+ const String& GetNewName() const { return aNewName; }
+
+ inline int operator==( const Sw3NumRuleInfo& rInfo );
+ inline int operator<( const Sw3NumRuleInfo& rInfo );
+};
+
+inline int Sw3NumRuleInfo::operator==( const Sw3NumRuleInfo& rInfo )
+{
+ return aOrigName == rInfo.aOrigName;
+}
+
+inline int Sw3NumRuleInfo::operator<( const Sw3NumRuleInfo& rInfo )
+{
+ return aOrigName < rInfo.aOrigName;
+}
+
+SV_DECL_PTRARR_DEL(Sw3TOXs,Sw3TOXBase*,16,16)
+typedef SwBookmark* SwBookmarkPtr;
+SV_DECL_PTRARR(Sw3Bookmarks,SwBookmarkPtr,16,16)
+typedef Sw3String* Sw3StringPtr;
+SV_DECL_PTRARR_DEL(Sw3Strings,Sw3StringPtr,16,16)
+typedef Sw3NumRuleInfo *Sw3NumRuleInfoPtr;
+SV_DECL_PTRARR_SORT(Sw3NumRuleInfos,Sw3NumRuleInfoPtr,16,16)
+typedef SwFrmFmt *SwFrmFmtPtr;
+SV_DECL_PTRARR(Sw3FrmFmts, SwFrmFmtPtr,16,16)
+typedef SwRedline *SwRedlinePtr;
+SV_DECL_PTRARR(Sw3Redlines,SwRedlinePtr,16,16)
+SV_DECL_VARARR(Sw3ULongs,UINT32,32,32)
+SV_DECL_VARARR(Sw3Bytes,BYTE,32,32)
+
+typedef SwFmt *SwFmtPtr;
+SV_DECL_PTRARR_SORT(Sw3SortFmts,SwFmtPtr,16,16)
+
+#define SW3IO_CONV_FROM_MATH 1
+#define SW3IO_CONV_FROM_BATS 2
+#define SW3IO_CONV_TO_SYMBOL 4
+class Sw3Fmts
+{
+ Sw3SortFmts aFmts;
+ SvBytes aFlags;
+
+public:
+
+ Sw3Fmts() {}
+
+ void Insert( SwFmt *pFmt, BYTE nFlags )
+ {
+ USHORT i;
+ aFmts.Insert( pFmt, i );
+ aFlags.Insert( nFlags, i );
+ }
+
+ SwFmt *GetFmt( USHORT i ) { return aFmts[i]; }
+ BYTE GetFlags( USHORT i ) { return aFlags[i]; }
+
+ BYTE GetFlags( const SwFmt *pFmt )
+ {
+ BYTE nFlags = 0;
+ USHORT nPos;
+ if( aFmts.Seek_Entry( (SwFmt *)pFmt, &nPos ) )
+ nFlags = aFlags[nPos];
+
+ return nFlags;
+ }
+
+
+ USHORT Count() const { return aFmts.Count(); }
+};
+
+struct Sw3ExportInfo;
+class Sw3Marks;
+
+class Sw3StringPool
+{
+ String aEmpty;
+ Sw3Strings aPool;
+ long nExpFFVersion; // Export: FF-Version (SOFFICE_FILEFORMAT_??)
+
+ BOOL bFixed;
+ void Setup( SwDoc& rDoc, const SwFmt& rFmt, USHORT=0 );
+ void SetupTxtCollByName( SwDoc& rDoc, const String& rCollName );
+ void RemoveExtension( SwFmt& );
+
+public:
+ Sw3StringPool();
+ USHORT Count() { return aPool.Count(); }
+ void Clear();
+ void Setup( SwDoc&, long nFFVersion, Sw3ExportInfo* pEI );
+ void SetupRedlines( SwDoc& );
+ void SetupForNumRules( SwDoc&, long nFFVersion );
+ void RemoveExtensions( SwDoc& );
+ static void RemoveExtension( String& );
+ USHORT Add( const String&, USHORT nPoolId /*= 0*/, BOOL bDontSearch=FALSE );
+ USHORT Find( const String&, USHORT nPoolId );
+ const String& Find( USHORT );
+ USHORT FindPoolId( USHORT );
+
+// OPT: Cache fuer Formate im StringPool
+ void SetCachedFmt( USHORT, SwFmt* );
+ SwFmt *FindCachedFmt( USHORT ) const;
+// /OPT: Cache fuer Formate im StringPool
+
+ void LoadOld( SvStream& );
+ void Load( SvStream&, USHORT nVersion );
+ void Store( SvStream& );
+
+ static USHORT ConvertFromOldPoolId( USHORT nId, USHORT nVersion );
+ static USHORT ConvertToOldPoolId( USHORT nId, sal_uInt32 nFFVersion );
+};
+
+// Informationen, die nur beim Export eines Doks benoetigt werden
+struct Sw3ExportInfo
+{
+ // Wenn nichts anderes angegeben ist, werden die Infos beim Export
+ // immer gefuellt.
+
+ const SfxItemSet *pItemSet; // der gerade exportierte Item-Set
+ const SwFlyFrm *pFlyFrm; // der aktuelle Fly-Frame
+
+ // Namen der Line- und Box-Formate im StrPool (nur fuer 3.1-/4.0-Export)
+ SvStringsDtor *pTblLineBoxFmtNames40;
+ Sw3FrmFmts *pTblLineBoxFmts40;
+
+ BOOL bFlyFrmFmt : 1; // es wird ein Fly-Frame-Format exportiert
+ BOOL bDrwFrmFmt31 : 1; // es wird ein zeichen-geb. Zeichenobjekt
+ // als absatz-gebundenes Objekt exportiert
+ // (nur 3.1-Export)
+
+ Sw3ExportInfo() : pItemSet( 0 ), pFlyFrm( 0 ),
+ pTblLineBoxFmtNames40( 0 ), pTblLineBoxFmts40( 0 ),
+ bFlyFrmFmt( FALSE ), bDrwFrmFmt31( FALSE ) {}
+ ~Sw3ExportInfo();
+};
+
+struct Sw3ExportTxtAttrs;
+
+class Sw3IoImp
+{ // I/O fuer Records:
+ Sw3Bytes aRecTypes; // Satztyp-Stack
+ Sw3ULongs aRecSizes; // Satzanfang/Satzlaengen-Stack
+ Sw3ULongs aValPositions;// Stack fuer UINT16-Werte
+ ULONG nFlagRecEnd; // Ende eines Flag-gesteuerten Datenbereichs
+ BOOL bOut; // TRUE: Output Mode fuer Records
+ String aDefWordDelim; // Word Delimiter vom SwModul
+ Sw3RecordSizeTable *pRecSizes; // Tabelle fuer Records > 16MB
+ FontToSubsFontConverter hBatsFontConv;
+ FontToSubsFontConverter hMathFontConv;
+
+ void SetDBName();
+ void MakeBlockText( const ByteString& rText );
+ sal_Char ConvStarSymbolCharToStarBats( sal_Unicode c );
+ sal_Unicode ConvStarBatsCharToStarSymbol( sal_Char c );
+ sal_Unicode ConvStarMathCharToStarSymbol( sal_Char c );
+ sal_Bool ConvertText( ByteString& rText8, String& rText,
+ xub_StrLen nStart, xub_StrLen nEnd,
+ xub_StrLen nOffset, const SwTxtNode& rNd,
+ rtl_TextEncoding eEnc,
+ const SvxFontItem& rFontItem,
+ SwInsHardBlankSoftHyph* pHBSH, BOOL bTo8 );
+ void ConvertText( ByteString& rText8, String& rText,
+ xub_StrLen nOffset, SwTxtNode& rNd,
+ rtl_TextEncoding eEnc, const SvxFontItem& rFontItem,
+ SwInsHardBlankSoftHyph* pHBSH, BOOL bTo8 );
+
+public:
+ const String N_DOC; // Name des Dokument-Streams
+ const String N_PAGESTYLES; // Die Seitenvorlagen
+ const String N_NUMRULES; // Name des NumRules-Streams
+ const String N_DRAWING; // Der Drawing Layer
+ const String N_PICTURES; // Name des Grafiken-Storages
+ const String N_BLOCKDIR; // Name des Block-Directories
+ const String sStarSymbol;
+ const String sOpenSymbol;
+ const String sStarBats;
+ const String sStarMath;
+
+ Sw3Io& rIo; // kann spaeter mal wech
+ SwDoc* pDoc; // das Dokument
+ Sw3ExportInfo* pExportInfo; // Infos fuer SW3.1-Export
+ SvStorageRef pOldRoot; // zwischengespeicherter Storage
+ SvStorageRef pBlkRoot; // Root-Storage fuer alle Textbausteine
+ SvStorageRef pRoot; // logischer Root-Storage
+ SvStorageStreamRef pStyles; // Styles-Stream
+ SvStorageStreamRef pPageStyles; // Seitenvorlagen-Stream
+ SvStorageStreamRef pNumRules; // NumRules-Stream
+ SvStorageStreamRef pDrawing; // Drawing Layer
+ SvStorageStreamRef pContents; // Inhalt
+ SvStorageStreamRef pBlkDir; // Block-Directory
+ SvStream* pStrm; // der aktuelle Stream
+ SvStorageInfoList* pBlkList; // Liste aller Textbausteine
+ SvPersistRef pPersist; // SvPersist fuer Textbausteine
+ short nCurBlk; // Enumerierungswert
+ short nCurMark; // Enum-Wert fuer Bookmarks
+ Sw3StringPool aStringPool; // der String-Pool eines Dokuments
+ Sw3NumRuleInfos aNumRuleInfos; // Namen der NumRules eines Doks.
+ rtl_TextEncoding eSrcSet; // CharSet des Quell-Streams
+ rtl_TextEncoding eBlkDirSet; // CharSet des Block-Directories
+ SwDocStat aStat; // wird beim Schreiben generiert
+ String aBlkName; // Name eines Textbausteins
+ String aINetFldText;// Text eines INet-Feldes
+ ULONG nRes; // Result Code
+ ULONG nWarn; // Result-Code fuer Warnungen
+ USHORT nGblFlags; // globale Flags
+#define SW3F_NOHDRFMT 0x0001 // Header-Format nicht ausgeben
+#define SW3F_NOFTRFMT 0x0002 // Footer-Format nicht ausgeben
+#define SW3F_SHAREDFMT 0x0004 // ein Shared-Fmt wird eingelesen
+#define SW3F_UPDEXPR 0x0008 // nach dem Einlesen UpdateExpr() rufen
+#define SW3F_NODRAWING 0x0010 // keine Zeichenobjekte laden
+#define SW3F_RDTABLE 0x0020 // es wird eine Tabelle gelesen
+#define SW3F_CONVBLOCK 0x0040 // Konversion SW2-Textbausteine zu SW3
+#define SW3F_NOROOTCOMMIT 0x0100 // no commit on Block-Root
+
+ USHORT nFileFlags; // dateispezifische Flags
+ USHORT nVersion; // Versionsnummer
+ BYTE cPasswd[16]; // Passwort (codiert)
+ USHORT nFlyLevel; // != 0, falls ein FlyFmt eingelesen wird
+ ULONG nZOrderOff; // Offset fuer Z-Order bei Insert Drawings
+ ULONG nHiddenDrawObjs; // Anzahl versteckter Zeichen-Objekte
+ SwTable* pCurTbl; // aktuell ausgegebene Tabelle
+ SwNumRule* pCurNumRule; // aktuelle Numerierungsregel
+ SwPaM* pCurNumRange;// aktueller Numerierungsbereich
+ SwPaM* pCurPaM; // aktueller PaM
+ SwPosFlyFrms* pFlyFrms; // alle absatzgebundenen FlyFrames
+ Sw3TOXs* pTOXs; // I: Liste aller TOX-Bereiche
+ Sw3Bookmarks* pBookmarks; // I: Liste aller Bookmarks
+ Sw3Redlines* pRedlines; // I: Liste alle Bookmarks
+ Sw3Marks* pRedlineMarks; // I: Positionen der Redlines
+ Sw3Marks* pMarks; // alle TOXe und Bookmarks (Positionen)
+ Crypter* pCrypter; // Encrypter, falls mit Passwort
+ SwOLENodes* p30OLENodes; // OLE-Nodes, die vom SW3.0 angelegt wurd.
+ SwFmtINetFmt* pFmtINetFmt; // aus INetFld hervorgeganges Attribut
+ Sw3FrmFmts* pTblLineBoxFmts; // shared Line-/Box-Formate
+ SvUShorts* pAuthorityMap;
+ SvUShorts* pSectionDepths;
+ Sw3Fmts* pConvToSymbolFmts;
+ SwHiddenDrawObjList_Impl *pHiddenDrawObjs;
+ sal_uInt32 nCurPercent; // Aktueller Stand der Prozentanzeige
+ sal_uInt32 nEndPercent; // Maximalwert der Prozentanzeige
+ UINT32 nDate,nTime; // Zeitpunkt der Speicherung
+ long nSizeDivFac; // Divisionsfaktor fuer FRMSIZE-Attribs
+
+ ULONG nStatStart; // Start der DocStatistik
+ USHORT eStartNodeType; // fuers erzeugen von StartNodes
+ // Fly/Footer/Header!
+ USHORT nCntntBkmkStart;
+ USHORT nCntntRedlineStart;
+
+
+ // Was bedeuten die Modus-Flags, oder: nie wieder Nachdenken muessen
+ // bNormal - ist gesetzt, wenn
+ // - Dokumente geladen, oder
+ // - Dokumente eingefuegt werden, oder
+ // - Vorlagen ueber den Organizer (LoadStyles) geladen
+ // werden,
+ // aber nicht gesetzt, wenn Vorlagen (ueber Load) geladen
+ // werden. Wenn zusaetzlich noch bInsert gesetzt ist,
+ // wird eingefuegt. Wenn bOrganizer gesetzt ist, werden
+ // Vorlagen ueber den Organizer (LoadStyles) geladen .
+ // bInsert - ist gesetzt, wenn Dokumente eingefuegt werden.
+ // Gleichzeitig ist immer auch bAdditive gesetzt.
+ // bAdditive - ist gesetzt, wenn Dokumente eingefuegt werden oder wenn
+ // Vorlagen (ueber Load) geladen werden, ohne bestehende zu
+ // ueberschreiben.
+ // bTxtColls, - sind gesetzt, wenn der entsprechene Vorlagen-Typ (ueber
+ // bCharFmts, Load) geladen wird. bNormal ist nicht gesetzt, wenn eines
+ // bFrmFmts, dieser Falgs gesetzt ist. bAdditive gibt an, ob nur nicht
+ // bPageDescs, vorhandene (TRUE) Vorlagen gelesen werden sollen oder ob
+ // bNumRules vorhandene Vorlagen ueberschrieben werden sollen (FALSE).
+ // bOrganizer - ist gesetzt, wenn Vorlagen ueber LoadStyles (Organizer)
+ // geladen werden. In diesem Fall ist auch bNormal gesetzt.
+
+ BOOL bInsert; // TRUE: in Doc einfuegen
+ BOOL bNormal; // TRUE: normales Einlesen
+ BOOL bTxtColls; // TRUE: Absatzvorlagen
+ BOOL bCharFmts; // TRUE: Zeichenvorlagen
+ BOOL bFrmFmts; // TRUE: Rahmenvorlagen
+ BOOL bPageDescs; // TRUE: Seitenvorlagen
+ BOOL bNumRules; // TRUE: Numerierungsvorlagen
+ BOOL bAdditive; // TRUE: vorhandene Vorlagen nicht ersetzen
+ BOOL bNoDrawings; // TRUE: drwing layer is corrupt
+ BOOL bBlock; // TRUE: Textbausteine
+ BOOL bSw31Export; // TRUE: Sw31-Export
+ BOOL bOrganizer; // TRUE: es wurde ist ein LoadStyle
+ BOOL bInsIntoHdrFtr; // TRUE: Es wird in Kopf/Fusszeilen
+ // eingefuegt
+ BOOL bDrawFmtSkipped; // TRUE: Es wurde ein DrawFmt
+ // uebersprungen
+ BOOL bConvertNoNum; // TRUE: NO_NUM in NO_NUMLEVEL konvert.
+
+ BOOL bSaveAll; // TRUE: das ganze Doc wird gespeichert
+
+ BOOL bSpellAllAgain; // TRUE: set all TxtNode as dirty
+ BOOL bSpellWrongAgain; // TRUE: set all WrongList as dirty
+
+#ifdef DBG_UTIL
+ BYTE *pRefSdrObjects;
+#endif
+
+ Sw3IoImp( Sw3Io& );
+ ~Sw3IoImp();
+ static Sw3IoImp* GetCurrentIo();
+ void Reset();
+ void Reset2();
+ void SetReadOptions( const SwgReaderOption&, BOOL );
+ void SetSw31Export( BOOL b31 ) { bSw31Export = b31; }
+ BOOL IsSw31Export() const { return bSw31Export; }
+#ifndef DBG_UTIL
+ inline BOOL IsSw31Or40Export() const;
+ inline BOOL IsSw40Export() const;
+#else
+ BOOL IsSw31Or40Export() const;
+ BOOL IsSw40Export() const;
+#endif
+ void Error( ULONG = 0 );
+ void Warning( ULONG = 0 );
+
+ BOOL OpenStreams( BOOL bRdWr = TRUE, BOOL bUseDrawStream = TRUE );
+ void CloseStreams();
+ ULONG OpenStreamsForScan( SvStorage *pStor, BOOL bPageStyles );
+ void CloseStreamsForScan();
+ BOOL CheckStreams();
+ BOOL CheckHeader( sal_Char *pHeader );
+ BOOL Good() { return BOOL( pStrm->GetError() == SVSTREAM_OK ); }
+ BYTE Peek(); // 1 Byte peeken
+ void OutputMode( BOOL b ) { bOut = b; }
+ BOOL OpenRec( BYTE cType ); // Record oeffnen
+ void CloseRec( BYTE cType ); // Record schliessen
+ void SkipRec(); // Record uebergehen
+ void InsertRecordSize( sal_uInt32 nPos, sal_uInt32 nSize );
+ sal_uInt32 GetRecordSize( sal_uInt32 nPos );
+ BOOL HasRecSizes() const { return pRecSizes != 0; }
+ void FlushRecSizes();
+ void InRecSizes( ULONG nRecPos );
+ ULONG OutRecSizes();
+ BYTE OpenFlagRec(); // Endeposition eines Flag-Records merken
+ void CloseFlagRec(); // Flag-Record schliessen
+ void OpenValuePos16( UINT16 ); // Position fuer UINT16-Wert merken
+ void CloseValuePos16( UINT16 ); // UINT16-Wert an Position eintragen
+ void OpenValuePos32( UINT32 ); // Position fuer UINT32-Wert merken
+ void CloseValuePos32( UINT32 ); // UINT32-Wert an Position eintragen
+ ULONG BytesLeft(); // wie viele Bytes hat der Record noch?
+ void CheckIoError( SvStream*); // korrekten E/A-Fehlercode setzen
+ static ByteString ConvertStringNoDbDelim( const String& rStr,
+ rtl_TextEncoding eSource );
+ static String ConvertStringNoDbDelim( const ByteString& rStr,
+ rtl_TextEncoding eSource );
+ static ByteString ConvertStringNoDelim( const String& rStr,
+ sal_Unicode cSrcDelim,
+ sal_Char cDelim,
+ rtl_TextEncoding eSource );
+ static String ConvertStringNoDelim( const ByteString& rStr,
+ sal_Char cSrcDelim,
+ sal_Unicode cDelim,
+ rtl_TextEncoding eSource );
+ static sal_uInt32 InULong( SvStream& ); // ULONG komprimiert lesen
+ static void OutULong( SvStream&, sal_uInt32 ); // ULONG komprimiert schreiben
+ inline SvStream& InString( SvStream& rStrm, String& rStr );
+ inline SvStream& OutString( SvStream& rStrm, const String& rStr );
+
+ void AddTblLineBoxFmt( SwFrmFmt *pFmt );
+ USHORT GetTblLineBoxFmtId( SwFrmFmt *pFmt );
+ USHORT GetTblLineBoxFmtStrPoolId40( SwFrmFmt *pFmt );
+ SwFrmFmt *GetTblLineBoxFmt( USHORT nIdx );
+
+
+ void InsertHiddenDrawObjs();
+ void RemoveHiddenDrawObjs();
+
+ // Ist eingelene Datei neuer oder gleich nMinVers und aelter
+ // (und ungleeich) nMaxVers?
+ inline BOOL IsVersion( USHORT nMinVers ) const;
+ inline BOOL IsVersion( USHORT nMinVers, USHORT nMaxVers ) const;
+ inline BOOL IsVersion( USHORT nMinVers1, USHORT nMaxVers1,
+ USHORT nMinVers2 ) const;
+ inline BOOL IsVersion( USHORT nMinVers1, USHORT nMaxVers1,
+ USHORT nMinVers2, USHORT nMaxVers2 ) const;
+
+ void OpenPercentBar( sal_uInt32, sal_uInt32 );
+ void ClosePercentBar();
+ void SetPercentBar( sal_uInt32 );
+
+ void Cleanup( BOOL bConnectPageDescs = TRUE ); // Nach Einlesen aufraeumen
+ void ChangeFontItemCharSet();
+ void ConvertFmtsToStarSymbol();
+
+ void LoadDrawingLayer();
+ void SaveDrawingLayer();
+
+ void LoadNumRules();
+ void SaveNumRules( BOOL = FALSE );
+
+ void LoadPageStyles();
+ void SavePageStyles( BOOL = FALSE );
+
+ void LoadContents( SwPaM* );
+ void SaveContents( SwPaM&, const String* = NULL );
+
+ void LoadMacros();
+ void SaveMacros();
+
+ void RemoveUnusedObjects(); // unbenutzte Objekte entfernen
+
+ // Passwort-Checks
+ BOOL CheckPasswd(); // I: Passwort testen
+ void SetPasswd(); // O: Passwort setzen
+
+ // SW3STYLE.CXX
+ void LoadStyleSheets( BOOL bNew ); // I: StyleSheets
+ void SaveStyleSheets( BOOL bUsed ); // O: StyleSheets
+
+ // SW3BLOCK.CXX
+ void DetectAndSetFFVersion( SvStorage *pRoot );
+ void InitBlockMode( SvStorage*, BOOL );
+ void ResetBlockMode();
+ ULONG FirstBlockName( String& rShort, String& rLong );
+ ULONG NextBlockName( String& rShort, String& rLong );
+ ULONG GetBlock( const String& rShort, sal_Bool bConvertMode = sal_False );
+ ULONG GetBlockText( const String& rShort, String& rText );
+ BOOL CheckPersist(); // Doc mit SvPersist versehen
+ void ClearPersist(); // SvPersist freigeben
+ ULONG GetBlockMacroTable( const String& rShort,
+ SvxMacroTableDtor& rMacroTbl );
+
+ // SW3DOC.CXX
+ void LoadDocContents( SwPaM* ); // I: Dokumentinhalt
+ void SaveDocContents( SwPaM&, const String* = NULL );
+ USHORT GetStreamFlags(); // I: Stream-Flags laden
+ void InHeader( BOOL bReadRecSizes=FALSE); // I: Dateikopf
+ void OutHeader( ULONG nRecSzPos=0UL ); // O: Dateikopf
+ void OutRecordSizesPos( ULONG nRecSzPos );
+ BOOL InHeaderForScan( BOOL bReadRecSizes=FALSE );
+
+ // SW3FIELD.CXX
+ SwField* InField(); // I: Feld
+ void OutField( const SwFmtFld& ); // O: Feld
+ void OutFieldTypes(); // O: alle Feldtypen
+ SwFieldType* InFieldType(); // I: ein Feldtyp
+ BOOL OutFieldType(const SwFieldType&);// O: ein Feldtyp
+
+ // SW3FMTS.CXX
+ SfxPoolItem* InAttr( xub_StrLen&, xub_StrLen&,
+ const SwTxtNode *pTxtNd=0 );// I: Attribut
+ void OutAttr( const SfxPoolItem&, xub_StrLen nBgn, xub_StrLen nEnd );
+ void InAttrSet( SwAttrSet& rSet ); // I: AttrSet
+ void OutAttrSet( const SfxItemSet&, BOOL bSFmt=FALSE ); // O: AttrSet
+ SwFmt* InFormat( BYTE cKind, SwFmt* ); // I: Format
+ void OutFormat( BYTE, const SwFmt& ); // O: Format
+ void InFlyFrames(); // I: globale FlyFrames
+ void OutFlyFrames( SwPaM& ); // O: globale FlyFrames
+
+ // SW3MISC.CXX
+ SwFmt* FindFmt( USHORT nIdx, BYTE c ); // Suchen eines Formats per StringId
+ SwFmt* FindNamedFmt( USHORT nIdx, BYTE);// Suchen einer Formatvorlage
+ SwTxtFmtColl* FindTxtColl( USHORT n ); // Suchen einer Absatzvorlage
+ SwPageDesc* FindPageDesc( USHORT nIdx );// Suchen einer Seitenvorlage
+ void CollectFlyFrms( const SwPaM* ); // vor Ausgabe: alle FlyFrms finden
+ void FreeFlyFrms(); // nach Ausgabe. Infos freigeben
+ SwFmt* FindFlyFrm( ULONG nNodeId ); // O: absatzgebundenen Fly suchen
+ void InMacroTbl(); // I: globale Makros
+ void OutMacroTbl(); // O: globale Makros
+ void InDictionary(); // I: Woerterbuecher (Online-Spl.)
+ void OutDictionary(); // O: Woerterbuecher (Online-Spl.)
+ void InJobSetup(); // I: Job Setup
+ void OutJobSetup(); // O: Job Setup
+ void InDBName(); // I: Datenbankname
+ void OutDBName(); // O: Datenbankname
+ void InStringPool( BYTE, Sw3StringPool& );
+ void OutStringPool( BYTE, Sw3StringPool& );
+ void InPasswd(); // I: Passwort
+ void SetPasswd( const String& rPass );// IO: Passwort setzen
+ // O: TOX- und Bookmark-Bereiche suchen
+ void CollectMarks( SwPaM*, BOOL bPageStylesOnly );
+ void InNodeMark( const SwNodeIndex&, xub_StrLen nOffset ); // I: Markierung
+ void OutNodeMarks( ULONG ); // O: Markierung
+ void InBookmarks(); // I: Bookmarks
+ void OutBookmarks( BOOL bPageStyles );// O: Bookmarks
+ void InTOXs51(); // I: TOX-Bereiche
+ void OutTOXs51(); // O: TOX-Bereiche
+ void InTOXs(); // I: TOX-Bereiche
+ void OutTOXs(); // O: TOX-Bereiche
+ void CleanupMarks(); // I: nicht ben. Marks loeschen
+ void ConnectTOXs(); // I: insert TOXs
+
+ // SW3NODES.CXX
+ void OutNodeFlyFrames( ULONG nNdId );// O: Absatz- und Zeichen-Flys
+ void ExportNodeDrawFrmFmts( const SwTxtNode& rNd, xub_StrLen nStart,
+ xub_StrLen nEnd, USHORT nCount );
+ void ConvertText( SwTxtNode& rNd, const ByteString& rText8,
+ xub_StrLen, SvUShorts*, SvXub_StrLens* ); // I: Zeichensatz-Konversion
+ void InTxtNode( SwTxtNode*, SwNodeIndex&, xub_StrLen, BYTE = 0 );
+ void OutTxtNode( SwCntntNode&, xub_StrLen, xub_StrLen, ULONG );
+ void OutEmptyTxtNode( ULONG nNodeIdx=0, BOOL bNodeMarks=FALSE );
+ // I: hartes Attribut
+ Sw3ExportTxtAttrs *ExportTxtNode( const SwTxtNode& rNd,
+ xub_StrLen nStart, xub_StrLen nEnd,
+ rtl_TextEncoding eEnc,
+ SwInsHardBlankSoftHyph& rHBSH );
+ void InTxtAttr( SwTxtNode&, const ByteString& rText8,
+ xub_StrLen, SvStringsDtor**, SvXub_StrLens**,
+ SvXub_StrLens**, SvUShorts**, SvXub_StrLens** );
+ void OutTxtAttrs( const SwTxtNode&, xub_StrLen, xub_StrLen);
+ void ExportTxtAttrs( const Sw3ExportTxtAttrs*, xub_StrLen, xub_StrLen);
+ void InGrfNode( SwNodeIndex& rPos ); // I: Grafik-Node
+ void OutGrfNode( const SwNoTxtNode& );// O: Grafik-Node
+ void InOLENode( SwNodeIndex& rPos ); // I: OLE-Node
+ void OutOLENode( const SwNoTxtNode& );// O: OLE-Node
+ void InRepTxtNode( SwNodeIndex& ); // I: Textwiederholung
+ void OutRepTxtNode( ULONG ); // O: Textwiederholung
+
+ // I/O: ImageMap-Infos
+ ImageMap *InImageMap( String& rURL, String& rTarget, BOOL& rIsMap );
+ void OutImageMap( const String& rURL, const String& rTarget,
+ const ImageMap *pIMap, BOOL bIsMap );
+
+ // I/O: Contour
+ PolyPolygon *InContour();
+ void OutContour( const PolyPolygon& rPoly );
+
+ // SW3NUM.CXX
+ void InNumFmt( SwNumFmt& rFmt ); // I: Numerierungs-Format
+ void OutNumFmt( const SwNumFmt& rFmt,
+ USHORT nPrvAbsLSpace );// O: Numerierungs-Format
+ SwNumRule* InNumRule( BYTE ); // I: Numerierungs-Regelwerk
+ void OutNumRule( BYTE, const SwNumRule& );
+ void InNumRules(); // I: NumRules
+ void OutNumRules( BOOL bUsed=FALSE ); // O: alle (benutzten) NumRules
+ void InOutlineExt();
+ void InNodeNum( SwNodeNum& ); // I: Absatz-Numerierung
+ void OutNodeNum( const SwNodeNum& ); // O: Absatz-Numerierung
+
+ void InEndNoteInfo( SwEndNoteInfo &rENInf ); // I: globale Endnoten-Info
+ void OutEndNoteInfo( const SwEndNoteInfo &rENInf ); // O: globale Endnoten-Info
+ void InEndNoteInfo(); // I: globale Endnoten-Info
+ void OutEndNoteInfo(); // O: globale Endnoten-Info
+ void InFtnInfo(); // I: globale Fussnoten-Info
+ void OutFtnInfo(); // O: globale Fussnoten-Info
+ void InFtnInfo40(); // I: globale Fussn.-Info 3.1/4.0
+ void OutFtnInfo40(); // O: globale Fussn.-Info 3.1/4.0
+ void OpenNumRange40( const SwNodeIndex& ); // I: Numerierungsregel-Beginn
+ void CloseNumRange40( const SwNodeIndex& ); // I: Numerierungsregel-Ende
+
+ // SW3PAGE.CXX
+ void InPageFtnInfo( SwPageFtnInfo& ); // I: Fussnoten-Info
+ void OutPageFtnInfo( const SwPageFtnInfo& rFtn );
+ void InPageDescs(); // I: alle Seitenvorlagen
+ void OutPageDescs( BOOL=FALSE ); // O: alle Seitenvorlagen
+ SwPageDesc* InPageDesc( USHORT& ); // I: Seitenvorlage
+ void OutPageDesc( const SwPageDesc& );// O: Seitenvorlage
+ void ConnectPageDescAttrs(); // I: PageDesc-Referenzen aufloesen
+
+ // SW3SECTN.CXX
+ void InContents( SwNodeIndex&, xub_StrLen=0, BOOL=TRUE, BYTE=0, BOOL=FALSE );
+ SwStartNode& InContents(); // I: neue Section anlegen
+ void OutContents( SwPaM* ); // O: per PaM definierter Bereich
+ void OutContents( const SwNodeIndex& ); // O: abgeschlossener Bereich
+ // O: contents
+ void OutContents( ULONG,ULONG,xub_StrLen,xub_StrLen, BOOL bTopLevel=FALSE );
+ ULONG OutNodes( ULONG nCurNode, ULONG nEndNode, xub_StrLen nCurPos,
+ xub_StrLen nEndPos, BOOL bTopLevel );
+ void InSection( SwNodeIndex& ); // I: SwSection einlesen
+ ULONG OutSection(const SwSectionNode&);// O: SwSection ausgeben
+ ULONG OutTOXSection(const SwSectionNode&);// O: TOX SwSection
+
+ // SW3TABLE.CXX
+ void CollectTblLineBoxFmts40();
+ void InTable( SwNodeIndex& rPos ); // I: Tabelle
+ void OutTable( const SwTableNode& ); // O: Tabelle
+ void InTableLine( SwTableLines&, SwTableBox*, USHORT, SwNodeIndex& );
+ USHORT OutTableLine( const SwTableLine& rLine );
+ void InTableBox( SwTableBoxes&, USHORT, SwTableLine*, SwNodeIndex& );
+ USHORT OutTableBox( const SwTableBox& rBox );
+
+ // SW3REDLIN.CXX
+/*N*/ void InRedline(); //SW50.SDW // I: Redline
+ void OutRedline( const SwRedline& rRedline );
+/*N*/ void InRedlines(); //SW50.SDW
+ void OutRedlines( BOOL bPageStyles );
+ void CollectRedlines( SwPaM* pPaM, BOOL bPageOnly );
+/*N*/ void InNodeRedline( const SwNodeIndex& rNodeIdx, INT32& nOffset, BYTE=0 ); //SW50.SDW
+ void OutNodeRedlines( ULONG );
+ void CleanupRedlines();
+
+ void OutDocStat( BOOL bFirst );
+ void InDocStat();
+
+ void InNumberFormatter();
+ void OutNumberFormatter();
+
+ void InLineNumberInfo();
+ void OutLineNumberInfo();
+
+ void InDocDummies();
+ void OutDocDummies();
+
+ void InPagePreViewPrintData();
+ void OutPagePreViewPrintData();
+
+ // die folgenden Methoden sind zum Suchen von Sections
+ void GetSectionList( SvStrings& rSectionList, SvStringsDtor& rBookmarks );
+ void ScanContents( SvStrings& rSectionList, SvStringsDtor& rBookmarks );
+ void ScanTableLine( SvStrings& rSectionList, SvStringsDtor& rBookmarks );
+
+ void GetMacroTable( SvxMacroTableDtor& rMacroTbl );
+ void ScanMacroTbl( SvxMacroTableDtor& rMacroTbl );
+
+#ifdef TEST_HUGE_DOCS
+#endif
+};
+
+inline BOOL Sw3IoImp::IsVersion( USHORT nMinVers ) const
+{
+ return nVersion >= nMinVers;
+}
+
+inline BOOL Sw3IoImp::IsVersion( USHORT nMinVers, USHORT nMaxVers ) const
+{
+ return nVersion >= nMinVers && nVersion < nMaxVers;
+}
+
+inline BOOL Sw3IoImp::IsVersion( USHORT nMinVers1, USHORT nMaxVers1,
+ USHORT nMinVers2 ) const
+{
+ return (nVersion >= nMinVers1 && nVersion < nMaxVers1) ||
+ nVersion >= nMinVers2;
+}
+
+inline BOOL Sw3IoImp::IsVersion( USHORT nMinVers1, USHORT nMaxVers1,
+ USHORT nMinVers2, USHORT nMaxVers2 ) const
+{
+ return (nVersion >= nMinVers1 && nVersion < nMaxVers1) ||
+ (nVersion >= nMinVers2 && nVersion < nMaxVers2);
+}
+
+#ifndef DBG_UTIL
+inline BOOL Sw3IoImp::IsSw40Export() const
+{
+ return pRoot->GetVersion() == SOFFICE_FILEFORMAT_40;
+}
+
+inline BOOL Sw3IoImp::IsSw31Or40Export() const
+{
+ return pRoot->GetVersion() <= SOFFICE_FILEFORMAT_40;
+}
+#endif
+
+inline SvStream& Sw3IoImp::InString( SvStream& rStrm, String& rStr )
+{
+ return rStrm.ReadByteString( rStr, eSrcSet );
+}
+
+inline SvStream& Sw3IoImp::OutString( SvStream& rStrm, const String& rStr )
+{
+ return rStrm.WriteByteString( rStr, eSrcSet );
+}
+
+void lcl_sw3io__ConvertNumLRSpace( SwTxtNode& rTxtNd, const SwNumRule& rNumRule,
+ BYTE nLevel, BOOL bTabStop );
+void lcl_sw3io__ConvertNumTabStop( SwTxtNode& rTxtNd, long nOffset,
+ BOOL bDeep );
+void lcl_sw3io__ConvertNumTabStop( SvxTabStopItem& rTStop, long nOffset );
+
+void lcl_sw3io__ConvertMarkToOutline( String& rURL );
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw3marks.hxx b/binfilter/bf_sw/source/core/sw3io/sw3marks.hxx
new file mode 100644
index 000000000000..84448063e559
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw3marks.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW3MARKS_HXX
+#define _SW3MARKS_HXX
+
+#include <tools/solar.h>
+#include <bf_svtools/cntnrsrt.hxx>
+namespace binfilter {
+
+enum Sw3MarkType {
+ SW3_TOX_POINT, SW3_TOX_MARK,
+ SW3_BOOK_POINT, SW3_BOOK_MARK,
+ SW3_REDLINE_START, SW3_REDLINE_END,
+ SW3_MARKTYPE_END
+};
+
+class Sw3Mark
+{
+ friend int sw3mark_compare( const Sw3Mark& r1, const Sw3Mark& r2 );
+
+ Sw3MarkType eType; // Art des Eintrags
+ ULONG nNodePos; // Node-Index
+ xub_StrLen nNodeOff; // Position-Index
+ USHORT nId; // ID des Eintrags
+
+public:
+
+ Sw3Mark() : eType(SW3_TOX_POINT), nNodePos(0),nNodeOff(0), nId(0) {}
+ Sw3Mark( Sw3Mark& r ) : eType(r.eType), nNodePos(r.nNodePos),
+ nNodeOff(r.nNodeOff), nId(r.nId) {}
+
+ Sw3MarkType GetType() const { return eType; }
+ ULONG GetNodePos() const { return nNodePos; }
+ xub_StrLen GetNodeOff() const { return nNodeOff; }
+ USHORT GetId() const { return nId; }
+
+ void SetType( Sw3MarkType nSet ){ eType = nSet; }
+ void SetNodePos( ULONG nSet ) { nNodePos = nSet; }
+ void SetNodeOff( xub_StrLen nSet ) { nNodeOff = nSet; }
+ void SetId( USHORT nSet ) { nId = nSet; }
+};
+
+DECLARE_CONTAINER_SORT_DEL( Sw3Marks, Sw3Mark )
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx b/binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx
new file mode 100644
index 000000000000..df69182dd8c0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_crypter.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <string.h>
+#include <tools/string.hxx>
+
+#include <crypter.hxx>
+
+namespace binfilter {
+
+
+
+
+Crypter::Crypter( const ByteString& r )
+{
+ // Dies sind Randomwerte, die konstant zur Verschluesselung
+ // des Passworts verwendet werden. Durch die Verwendung eines
+ // verschluesselten Passworts wird vermieden, dass das Passwort
+ // im RAM gehalten wird.
+ static const BYTE cEncode[] =
+ { 0xAB, 0x9E, 0x43, 0x05, 0x38, 0x12, 0x4d, 0x44,
+ 0xD5, 0x7e, 0xe3, 0x84, 0x98, 0x23, 0x3f, 0xba };
+
+ xub_StrLen nLen = r.Len();
+ if( nLen > PASSWDLEN ) nLen = PASSWDLEN;
+ ByteString aPasswd( r );
+ if( nLen > PASSWDLEN )
+ aPasswd.Erase( nLen );
+ else
+ aPasswd.Expand( PASSWDLEN, ' ' );
+ memcpy( cPasswd, cEncode, PASSWDLEN );
+ Encrypt( aPasswd );
+ memcpy( cPasswd, aPasswd.GetBuffer(), PASSWDLEN );
+}
+
+
+
+void Crypter::Encrypt( ByteString& r ) const
+{
+ xub_StrLen nLen = r.Len();
+ if( !nLen )
+ return ;
+
+ xub_StrLen nCryptPtr = 0;
+ BYTE cBuf[ PASSWDLEN ];
+ memcpy( cBuf, cPasswd, PASSWDLEN );
+ BYTE* pSrc = (BYTE*)r.GetBufferAccess();
+ BYTE* p = cBuf;
+
+ while( nLen-- )
+ {
+ *pSrc = *pSrc ^ ( *p ^ (BYTE) ( cBuf[ 0 ] * nCryptPtr ) );
+ *p += ( nCryptPtr < (PASSWDLEN-1) ) ? *(p+1) : cBuf[ 0 ];
+ if( !*p ) *p += 1;
+ p++;
+ if( ++nCryptPtr >= PASSWDLEN ) nCryptPtr = 0, p = cBuf;
+ pSrc++;
+ }
+}
+
+
+
+void Crypter::Decrypt( ByteString& r ) const
+{
+ Encrypt( r );
+}
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3attr.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3attr.cxx
new file mode 100644
index 000000000000..11650f8f72a8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3attr.cxx
@@ -0,0 +1,1125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+
+
+#include <paratr.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <fmturl.hxx>
+#include <fmtlsplt.hxx>
+#include <fmteiro.hxx>
+#include <hfspacingitem.hxx>
+#include <fmthbsh.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfordr.hxx>
+#include <fmtclds.hxx>
+#include <poolfmt.hxx>
+#include <fmtline.hxx>
+#include <sw3imp.hxx>
+#include <charfmt.hxx>
+#include <grfatr.hxx>
+#include <cellatr.hxx>
+#include <flyfrm.hxx>
+#include <fmtftntx.hxx>
+#include <fmtclbl.hxx>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+////////////////////////////// Frame-Attribute ////////////////////////////
+
+
+/*N*/ USHORT SwFmtSurround::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtSurround: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? 0 :
+/*N*/ (SOFFICE_FILEFORMAT_40==nFFVer ? 4 : 5);
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwFmtSurround::Create( SvStream& rStrm, USHORT nVrs ) const
+/*N*/ {
+/*N*/ BYTE nType, bGold = 0, bAnch=0, bCont=0, bOutside = 0;
+/*N*/ rStrm >> nType;
+/*N*/ if ( nVrs < 5 )
+/*N*/ rStrm >> bGold;
+/*N*/ if ( nVrs > 1 )
+/*N*/ rStrm >> bAnch;
+/*N*/ if ( nVrs > 2 )
+/*N*/ rStrm >> bCont;
+/*N*/ if ( nVrs > 3 )
+/*N*/ rStrm >> bOutside;
+/*N*/
+/*N*/ SwFmtSurround *pRet = new SwFmtSurround( (SwSurround) nType );
+/*N*/ if( bGold && SURROUND_NONE != (SwSurround)nType &&
+/*N*/ SURROUND_THROUGHT != (SwSurround)nType )
+/*N*/ pRet->SetSurround( SURROUND_IDEAL );
+/*N*/ pRet->SetAnchorOnly( BOOL(bAnch) );
+/*N*/ pRet->SetContour( BOOL(bCont) );
+/*N*/ pRet->SetOutside( BOOL(bOutside) );
+/*N*/ return pRet;
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtSurround::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ if ( nIVer < 5 )
+/*N*/ {
+/*N*/ SwSurround eType = GetSurround();
+/*N*/ BYTE bGold = 0;
+/*N*/ if( SURROUND_IDEAL == eType )
+/*N*/ {
+/*N*/ eType = SURROUND_PARALLEL;
+/*N*/ bGold = 1;
+/*N*/ }
+/*N*/ rStrm << (BYTE) eType
+/*N*/ << (BYTE) bGold;
+/*N*/ }
+/*N*/ else
+/*N*/ rStrm << (BYTE) GetSurround();
+/*N*/ if( nIVer > 1 )
+/*N*/ rStrm << (BYTE) IsAnchorOnly();
+/*N*/ if( nIVer > 2 )
+/*N*/ rStrm << (BYTE) IsContour();
+/*N*/ if( nIVer > 3 )
+/*N*/ rStrm << (BYTE) IsOutside();
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ USHORT SwFmtVertOrient::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtHoriOrient: Gibt es ein neues Fileformat?" );
+/*N*/ return ( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ) ? 0 : IVER_VERTORIENT_REL;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtVertOrient::Create( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ long nPos;
+/*N*/ BYTE nOrient, nRelation;
+/*N*/ rStrm >> nPos >> nOrient >> nRelation;
+/*N*/
+/*N*/ // fix #48690#: In 4.0-Doks wurde bei VERT_NONE die Relation nicht
+/*N*/ // beachtet, aber wie FRAME behandelt. Das Attribut enthielt aber PRTAREA
+/*N*/ if( VERT_NONE == (SwVertOrient)nOrient && nIVer < IVER_VERTORIENT_REL )
+/*N*/ nRelation = FRAME;
+/*N*/
+/*N*/ return new SwFmtVertOrient( (SwTwips) nPos, (SwVertOrient) nOrient,
+/*N*/ (SwRelationOrient) nRelation );
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtVertOrient::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/
+/*N*/ SwTwips nPos = GetPos();
+/*N*/
+/*N*/ if( pIo && pIo->IsSw31Export() && pIo->pExportInfo &&
+/*N*/ pIo->pExportInfo->bFlyFrmFmt )
+/*N*/ {
+/*N*/ const SfxItemSet *pItemSet = pIo->pExportInfo->pItemSet;
+/*N*/ if( pItemSet )
+/*N*/ {
+/*N*/ const SvxULSpaceItem& rULSpace =
+/*N*/ (const SvxULSpaceItem&)pItemSet->Get( RES_UL_SPACE );
+/*N*/
+/*N*/ nPos = GetPosConvertedToSw31( &rULSpace );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ rStrm << (long) nPos
+/*N*/ << (BYTE) GetVertOrient()
+/*N*/ << (BYTE) GetRelationOrient();
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ USHORT SwFmtHoriOrient::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtHoriOrient: Gibt es ein neues Fileformat?" );
+/*N*/ return ( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ) ? 0 : IVER_HORIORIENT_REL;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtHoriOrient::Create( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ long nPos;
+/*N*/ BYTE nOrient, nRelation, bToggle = 0, bGrf = 0;
+/*N*/ rStrm >> nPos >> nOrient >> nRelation;
+/*N*/
+/*N*/ if( nIVer >= IVER_HORIORIENT_TOGGLE )
+/*N*/ rStrm >> bToggle;
+/*N*/
+/*N*/ // fix #48690#: In 4.0-Doks wurde bei HORI_NONE die Relation nicht
+/*N*/ // beachtet, aber wie FRAME behandelt. Das Attribut enthielt aber PRTAREA
+/*N*/ if( HORI_NONE == (SwHoriOrient)nOrient && nIVer < IVER_HORIORIENT_REL )
+/*N*/ nRelation = FRAME;
+/*N*/
+/*N*/ return new SwFmtHoriOrient
+/*N*/ ( (SwTwips) nPos, (SwHoriOrient) nOrient, (SwRelationOrient) nRelation,
+/*N*/ BOOL( bToggle ) );
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtHoriOrient::Store( SvStream& rStrm, USHORT nVersion ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/
+/*N*/ SwTwips nPos = GetPos();
+/*N*/
+/*N*/ if( pIo && pIo->IsSw31Export() && pIo->pExportInfo &&
+/*N*/ pIo->pExportInfo->bFlyFrmFmt )
+/*N*/ {
+/*N*/ const SfxItemSet *pItemSet = pIo->pExportInfo->pItemSet;
+/*N*/ if( pItemSet )
+/*N*/ {
+/*N*/ const SvxLRSpaceItem& rLRSpace =
+/*N*/ (const SvxLRSpaceItem&)pItemSet->Get( RES_LR_SPACE );
+/*N*/
+/*N*/ nPos = GetPosConvertedToSw31( &rLRSpace );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nVersion >= IVER_HORIORIENT_TOGGLE )
+/*N*/ {
+/*N*/ rStrm << (long) nPos
+/*N*/ << (BYTE) GetHoriOrient()
+/*N*/ << (BYTE) GetRelationOrient()
+/*N*/ << (BYTE) IsPosToggle();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwHoriOrient eHori = GetHoriOrient();
+/*N*/ SwRelationOrient eRel = GetRelationOrient();
+/*N*/ if( eRel > PRTAREA )
+/*N*/ {
+/*?*/ if( !(pIo && pIo->pExportInfo && pIo->pExportInfo->pFlyFrm &&
+/*?*/ pIo->pExportInfo->pFlyFrm->ConvertHoriTo40( eHori, eRel, nPos ) ) )
+/*?*/ {
+/*?*/ switch ( eRel )
+/*?*/ {
+/*?*/ case REL_PG_LEFT: eRel = FRAME; eHori = HORI_LEFT; break;
+/*?*/ case REL_PG_RIGHT: eRel = FRAME; break;
+/*?*/ case REL_FRM_LEFT: eRel = PRTAREA; break;
+/*?*/ case REL_FRM_RIGHT: eRel = PRTAREA; break;
+/*?*/ case REL_PG_PRTAREA: eRel = PRTAREA; break;
+/*?*/ default: eRel = FRAME; break;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ rStrm << (long) nPos
+/*N*/ << (BYTE) eHori;
+/*N*/ rStrm << (BYTE) eRel;
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ USHORT SwFmtFrmSize::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtFrmSize: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? 0 : 2;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwFmtFrmSize::Create( SvStream& rStrm, USHORT nVersion ) const
+/*N*/ {
+/*N*/ BYTE nSizeType, nWidthPercent = 0, nHeightPercent = 0;
+/*N*/ INT32 nWidth, nHeight;
+/*N*/ rStrm >> nSizeType >> nWidth >> nHeight;
+/*N*/
+/*N*/ if ( nVersion > 1 )
+/*N*/ rStrm >> nWidthPercent >> nHeightPercent;
+/*N*/
+/*N*/ SwFmtFrmSize *pRet = new SwFmtFrmSize( (SwFrmSize) nSizeType, nWidth, nHeight );
+/*N*/ pRet->SetWidthPercent ( nWidthPercent );
+/*N*/ pRet->SetHeightPercent( nHeightPercent );
+/*N*/ return pRet;
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtFrmSize::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/
+/*N*/ Size aSz( GetSize() );
+/*N*/ if( pIo && pIo->IsSw31Export() && pIo->pExportInfo &&
+/*N*/ pIo->pExportInfo->bFlyFrmFmt )
+/*N*/ {
+/*N*/ const SfxItemSet *pItemSet = pIo->pExportInfo->pItemSet;
+/*N*/ if( pItemSet )
+/*N*/ {
+/*N*/ const SvxLRSpaceItem& rLRSpace =
+/*N*/ (const SvxLRSpaceItem&)pItemSet->Get( RES_LR_SPACE );
+/*N*/ const SvxULSpaceItem& rULSpace =
+/*N*/ (const SvxULSpaceItem&)pItemSet->Get( RES_UL_SPACE );
+/*N*/
+/*N*/ aSz = GetSizeConvertedToSw31( &rLRSpace, &rULSpace );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ rStrm << (BYTE) GetSizeType()
+/*N*/ << (INT32) aSz.Width()
+/*N*/ << (INT32) aSz.Height();
+/*N*/
+/*N*/ if( nIVer > 1 )
+/*N*/ {
+/*N*/ rStrm << (BYTE) GetWidthPercent()
+/*N*/ << (BYTE) GetHeightPercent();
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwFmtFillOrder::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ BYTE nFillOrder;
+/*N*/ rStrm >> nFillOrder;
+/*N*/ return new SwFmtFillOrder( (SwFillOrder) nFillOrder );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ SvStream& SwFmtFillOrder::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ rStrm << (BYTE) GetFillOrder();
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwFmtCol::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ // Die Longs muessen runtergerechnet werden
+/*N*/ BYTE nLineAdj, bOrtho, nLineHeight, nPenStyle;
+/*N*/ INT16 nGutterWidth, nPenWidth;
+/*N*/ UINT16 nWishWidth, nPenRed, nPenGreen, nPenBlue;
+/*N*/ rStrm >> nLineAdj
+/*N*/ >> bOrtho
+/*N*/ >> nLineHeight
+/*N*/ >> nGutterWidth
+/*N*/ >> nWishWidth
+/*N*/ >> nPenStyle
+/*N*/ >> nPenWidth
+/*N*/ >> nPenRed
+/*N*/ >> nPenGreen
+/*N*/ >> nPenBlue;
+/*N*/ SwFmtCol* p = new SwFmtCol;
+/*N*/ Color aPenColor( nPenRed >> 8, nPenGreen >> 8, nPenBlue >> 8 );
+/*N*/ // Pen aPen( aPenColor, nPenWidth, (PenStyle) nPenStyle );
+/*N*/ INT16 nCol;
+/*N*/ rStrm >> nCol;
+/*N*/ ASSERT( nWishWidth, "Damaged Doc: No WishWidth" );
+/*N*/ if( !nWishWidth )
+/*N*/ {
+/*?*/ nWishWidth = USHRT_MAX;
+/*?*/ if( nCol )
+/*?*/ p->Init( nCol, nGutterWidth, nWishWidth );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ for( short i = 0; i < nCol; i++ )
+/*N*/ {
+/*N*/ UINT16 nWidth, nLeft, nUpper, nRight, nLower;
+/*N*/ rStrm >> nWidth >> nLeft >> nUpper >> nRight >> nLower;
+/*N*/ SwColumn* pCol = new SwColumn;
+/*N*/ pCol->SetWishWidth( nWidth );
+/*N*/ pCol->SetLeft( nLeft );
+/*N*/ pCol->SetUpper( nUpper );
+/*N*/ pCol->SetRight( nRight );
+/*N*/ pCol->SetLower( nLower );
+/*N*/ p->GetColumns().Insert( pCol, i );
+/*N*/ }
+/*N*/ }
+/*N*/ p->SetLineWidth( nPenWidth );
+/*N*/ p->SetLineColor( aPenColor );
+/*N*/ p->SetWishWidth( nWishWidth );
+/*N*/ p->SetLineHeight( nLineHeight );
+/*N*/ p->SetLineAdj( (SwColLineAdj) nLineAdj );
+/*N*/ // temporaerer Bug Fix
+/*N*/ if( nCol )
+/*N*/ // Wert direkt mit dem Silberhammer einschlagen.
+/*N*/ p->_SetOrtho( (BOOL) bOrtho );
+/*N*/ return p;
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtCol::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/
+/*N*/ rStrm << (BYTE) GetLineAdj()
+/*N*/ << (BYTE) IsOrtho()
+/*N*/ << (BYTE) GetLineHeight()
+/*N*/ << (INT16) GetGutterWidth()
+/*N*/ << (UINT16)GetWishWidth()
+/*N*/ << (BYTE) 0 // rPen.GetStyle() - not available anymore
+/*N*/ << (INT16) GetLineWidth()
+/*N*/ << (UINT16)(GetLineColor().GetRed() << 8 )
+/*N*/ << (UINT16)(GetLineColor().GetGreen() << 8 )
+/*N*/ << (UINT16)(GetLineColor().GetBlue() << 8 )
+/*N*/ ;
+/*N*/ INT16 nCol = GetNumCols();
+/*N*/ rStrm << (INT16) nCol;
+/*N*/ for( short i = 0; i < nCol; i++ )
+/*N*/ {
+/*N*/ const SwColumn* pCol = GetColumns()[ i ];
+/*N*/ rStrm << (UINT16)pCol->GetWishWidth()
+/*N*/ << (INT16) pCol->GetLeft()
+/*N*/ << (INT16) pCol->GetUpper()
+/*N*/ << (INT16) pCol->GetRight()
+/*N*/ << (INT16) pCol->GetLower();
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem * SwFmtURL::Create(SvStream &rStrm, USHORT nIVer) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ ASSERT( pIo, "Reader/Writer not found" );
+/*N*/
+/*N*/ String sURL, sTargetFrameName, sName;
+/*N*/ BOOL bServerMap = FALSE;
+/*N*/
+/*N*/ SwFmtURL *pNew = new SwFmtURL;
+/*N*/
+/*N*/ if( pIo )
+/*N*/ pNew->SetMap( pIo->InImageMap( sURL, sTargetFrameName, bServerMap ) );
+/*N*/ if( nIVer>=1 )
+/*N*/ rStrm.ReadByteString( sName, rStrm.GetStreamCharSet() );
+/*N*/
+/*N*/ // fix #30592#: Boese Falle: Beim setzen einer URL wird eine Image-Map
+/*N*/ // wieder geloescht.
+/*N*/ if( sURL.Len() )
+/*N*/ pNew->SetURL( sURL, bServerMap );
+/*N*/ pNew->SetTargetFrameName( sTargetFrameName );
+/*N*/ pNew->SetName( sName );
+/*N*/ return pNew;
+/*N*/ }
+
+
+/*N*/ SvStream & SwFmtURL::Store( SvStream &rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ ASSERT( nIVer != USHRT_MAX,
+/*N*/ "SwFmtURL: Wer faengt da Version USHRT_MAX nicht ab?" );
+/*N*/
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ ASSERT( pIo, "Reader/Writer not found" );
+/*N*/
+/*N*/ if( pIo )
+/*N*/ pIo->OutImageMap( sURL, sTargetFrameName, pMap, bIsServerMap );
+/*N*/ if( nIVer >= 1 )
+/*N*/ rStrm.WriteByteString( GetName(), rStrm.GetStreamCharSet() );
+/*N*/
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ USHORT SwFmtURL::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtURL: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? USHRT_MAX : 1;
+/*N*/ }
+
+
+SfxPoolItem* SwFmtEditInReadonly::Create(SvStream &rStrm, USHORT) const
+{
+ BYTE n;
+ rStrm >> n;
+ return new SwFmtEditInReadonly( RES_EDIT_IN_READONLY, BOOL(n) );
+}
+
+
+SvStream& SwFmtEditInReadonly::Store(SvStream &rStrm, USHORT ) const
+{
+ rStrm << BYTE(GetValue());
+ return rStrm;
+}
+
+
+/*N*/ USHORT SwFmtEditInReadonly::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtEditInReadonly: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+
+SfxPoolItem* SwFmtLayoutSplit::Create(SvStream &rStrm, USHORT) const
+{
+ BYTE n;
+ rStrm >> n;
+ return new SwFmtLayoutSplit( BOOL(n) );
+}
+
+
+SvStream& SwFmtLayoutSplit::Store(SvStream &rStrm, USHORT ) const
+{
+ rStrm << BYTE(GetValue());
+ return rStrm;
+}
+
+
+/*N*/ USHORT SwFmtLayoutSplit::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtLayoutSplit: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+SvStream& SwFmtFtnEndAtTxtEnd::Store( SvStream & rStrm, USHORT nIVer ) const
+{
+// alt: nur ein BOOL, jetzt 2 enums, 2 Strings, 1 uint16
+ if( 0 == nIVer ) // old - only a boolitem
+ {
+ rStrm << (BYTE)( FTNEND_ATPGORDOCEND == GetValue() ? 0 : 1 );
+ }
+ else
+ {
+ rStrm << (BYTE)GetValue()
+ << (UINT16)nOffset
+ << (UINT16)aFmt.GetNumberingType();
+ rStrm.WriteByteString( sPrefix, rStrm.GetStreamCharSet() );
+ rStrm.WriteByteString( sSuffix, rStrm.GetStreamCharSet() );
+ }
+
+ return rStrm;
+}
+
+SfxPoolItem* SwFmtFtnEndAtTxtEnd::Create( SvStream &rStrm, USHORT nVer ) const
+{
+ SwFmtFtnEndAtTxtEnd* pNew = (SwFmtFtnEndAtTxtEnd*)Clone();
+
+ BYTE nVal;
+ rStrm >> nVal;
+ pNew->SetValue( nVal );
+
+ if( 0 < nVer )
+ {
+ UINT16 nOffset, nFmtType;
+ String sPostfix, sSuffix;
+ rStrm >> nOffset
+ >> nFmtType;
+ rStrm.ReadByteString( sPostfix, rStrm.GetStreamCharSet() );
+ rStrm.ReadByteString( sSuffix, rStrm.GetStreamCharSet() );
+
+ pNew->SetNumType( (SvxExtNumType)nFmtType );
+ pNew->SetOffset( nOffset );
+ pNew->SetPrefix( sPostfix );
+ pNew->SetSuffix( sSuffix );
+ }
+ return pNew;
+}
+
+/*N*/ USHORT SwFmtFtnEndAtTxtEnd::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtFtnEndAtTxtEnd: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ? USHRT_MAX : 1;
+/*N*/ }
+
+SfxPoolItem* SwFmtNoBalancedColumns::Create(SvStream &rStrm, USHORT) const
+{
+ BYTE n;
+ rStrm >> n;
+ return new SwFmtNoBalancedColumns( BOOL(n) );
+}
+
+
+SvStream& SwFmtNoBalancedColumns::Store(SvStream &rStrm, USHORT ) const
+{
+ rStrm << BYTE(GetValue());
+ return rStrm;
+}
+
+
+/*N*/ USHORT SwFmtNoBalancedColumns::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtNoBalancedColumns: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+
+/*M*/ SfxPoolItem* SwHeaderAndFooterEatSpacingItem::Create(SvStream &rStrm, USHORT) const
+/*M*/ {
+/*M*/ ASSERT( sal_False, "SwHeaderAndFooterEatSpacingItem::Create called for old fileformat" )
+/*M*/ BYTE n;
+/*M*/ rStrm >> n;
+/*M*/ return new SwHeaderAndFooterEatSpacingItem( RES_HEADER_FOOTER_EAT_SPACING, BOOL(n) );
+/*M*/ }
+
+
+/*M*/ SvStream& SwHeaderAndFooterEatSpacingItem::Store(SvStream &rStrm, USHORT ) const
+/*M*/ {
+/*M*/ ASSERT( sal_False, "SwHeaderAndFooterEatSpacingItem::Store called for old fileformat" )
+/*M*/ rStrm << BYTE(GetValue());
+/*M*/ return rStrm;
+/*M*/ }
+
+
+/*M*/ USHORT SwHeaderAndFooterEatSpacingItem::GetVersion( USHORT nFFVer ) const
+/*M*/ {
+/*M*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*M*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*M*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*M*/ "SwHeaderAndFooterEatSpacingItem: Gibt es ein neues Fileformat?" );
+/*M*/ return USHRT_MAX;
+/*M*/ }
+
+
+/////////////////////////////// Grafik-Attribute /////////////////////////
+
+
+/*N*/ SfxPoolItem* SwMirrorGrf::Create( SvStream& rStrm, USHORT nIVer) const
+/*N*/ {
+/*N*/ BYTE nState;
+/*N*/ BYTE nToggle = FALSE;
+/*N*/
+/*N*/ rStrm >> nState;
+/*N*/
+/*N*/ if (nIVer > 0)
+/*N*/ rStrm >> nToggle;
+/*N*/
+/*N*/ SwMirrorGrf* pRet = new SwMirrorGrf( nState );
+/*N*/ pRet->SetGrfToggle((BOOL)nToggle);
+/*N*/ return pRet;
+/*N*/ }
+
+
+/*N*/ SvStream& SwMirrorGrf::Store( SvStream& rStrm, USHORT nIVer) const
+/*N*/ {
+/*N*/ rStrm << (BYTE)GetValue();
+/*N*/
+/*N*/ if (nIVer > 0)
+/*N*/ rStrm << (BYTE)bGrfToggle;
+/*N*/
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ USHORT SwMirrorGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtSurround: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_40 < nFFVer ? 1 : 0;
+/*N*/ }
+
+
+/*N*/ USHORT SwCropGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwCropGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return GRFCROP_VERSION_SWDEFAULT;
+/*N*/ }
+
+/*N*/ USHORT SwRotationGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwRotationGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+SfxPoolItem* SwRotationGrf::Create( SvStream & rStrm, USHORT nVer ) const
+{
+ SwRotationGrf* pRet = (SwRotationGrf*)SfxUInt16Item::Create( rStrm, nVer );
+ Size aSz;
+ rStrm >> aSz;
+ pRet->SetUnrotatedSize( aSz );
+ return pRet;
+}
+
+SvStream& SwRotationGrf::Store( SvStream & rStrm, USHORT nIVer) const
+{
+ SfxUInt16Item::Store( rStrm, nIVer );
+ rStrm << GetUnrotatedSize();
+ return rStrm;
+}
+
+/*N*/ USHORT SwLuminanceGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwLuminanceGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+/*N*/ USHORT SwContrastGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwContrastGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+/*N*/ USHORT SwChannelGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwChannelGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+/*N*/ USHORT SwGammaGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwChannelGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+SfxPoolItem* SwGammaGrf::Create(SvStream & rStrm, USHORT ) const
+{
+ SwGammaGrf* pRet = (SwGammaGrf*)Clone();
+ double aVal;
+ rStrm >> aVal;
+ pRet->SetValue( aVal );
+ return pRet;
+}
+
+SvStream& SwGammaGrf::Store(SvStream & rStrm, USHORT ) const
+{
+ rStrm << GetValue();
+ return rStrm;
+}
+
+/*N*/ USHORT SwInvertGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwInvertGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+/*N*/ USHORT SwTransparencyGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwInvertGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+/*N*/ USHORT SwDrawModeGrf::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwDrawModeGrf: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+
+
+//////////////////////////////// Text-Attribute ////////////////////////////
+
+
+/*N*/ SfxPoolItem* SwFmtHardBlank::Create( SvStream& rStrm, USHORT nV ) const
+/*N*/ {
+/*N*/ sal_Char cChr = ' ';
+/*N*/ if( nV )
+/*N*/ rStrm >> cChr;
+/*N*/ sal_Unicode c = ByteString::ConvertToUnicode( cChr, rStrm.GetStreamCharSet() );
+/*N*/ return new SwFmtHardBlank( c, FALSE );
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtHardBlank::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ if( nIVer )
+/*N*/ {
+/*N*/ sal_Char c = ByteString::ConvertFromUnicode( GetChar(),
+/*N*/ rStrm.GetStreamCharSet(),
+/*N*/ FALSE );
+/*N*/ if( !c )
+/*N*/ c = ' '; // TODO: unicode: is this sensible?
+/*N*/ rStrm << c;
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ USHORT SwFmtHardBlank::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtHardBlank: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? 0 : 1;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwFmtSoftHyph::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ return new SwFmtSoftHyph;
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtSoftHyph::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ return rStrm;
+/*N*/ }
+
+/////////////////////////////// Absatz-Attribute ///////////////////////////
+
+
+/*N*/ USHORT SwFmtDrop::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtDrop: Gibt es ein neues Fileformat?" );
+/*N*/ return ( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ) ? 0 : DROP_WHOLEWORD;
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtDrop::Create( SvStream& rStrm, USHORT nVer ) const
+/*N*/ {
+/*N*/ UINT16 nLines, nChars, nDistance, nX, nY, nFmt;
+/*N*/ BYTE bWhole = 0;
+/*N*/ rStrm >> nFmt >> nLines >> nChars >> nDistance;
+/*N*/ if( nVer >= DROP_WHOLEWORD )
+/*N*/ rStrm >> bWhole;
+/*N*/ else
+/*N*/ rStrm >> nX >> nY;
+/*N*/ SwFmtDrop* pAttr = new SwFmtDrop;
+/*N*/ pAttr->GetLines() = (BYTE) nLines;
+/*N*/ pAttr->GetChars() = (BYTE) nChars;
+/*N*/ pAttr->GetDistance() = nDistance;
+/*N*/ pAttr->GetWholeWord() = (BOOL) bWhole;
+/*N*/ if( nFmt != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ if( pIo )
+/*N*/ {
+/*N*/ if( pIo->aStringPool.Count() )
+/*N*/ {
+/*N*/ SwCharFmt* pSet = (SwCharFmt*) pIo->FindFmt( nFmt, SWG_CHARFMT );
+/*N*/ if( pSet )
+/*N*/ pAttr->SetCharFmt( pSet );
+/*N*/ }
+/*N*/ else
+/*N*/ pAttr->nReadFmt = nFmt;
+/*N*/ }
+/*N*/ }
+/*N*/ return pAttr;
+/*N*/ }
+
+
+/*N*/ SvStream& SwFmtDrop::Store( SvStream& rStrm, USHORT nVer ) const
+/*N*/ {
+/*N*/ USHORT nFmt = IDX_NO_VALUE;
+/*N*/ USHORT nChars = GetWholeWord() ? 1 : GetChars();
+/*N*/ const SwFmt* pFmt = GetCharFmt();
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ if( pIo )
+/*N*/ nFmt = pIo->aStringPool.Find( pFmt->GetName(),
+/*N*/ pFmt->GetPoolFmtId() );
+/*N*/ }
+/*N*/ rStrm << (UINT16) nFmt
+/*N*/ << (UINT16) GetLines()
+/*N*/ << (UINT16) nChars
+/*N*/ << (UINT16) GetDistance();
+/*N*/ if( nVer >= DROP_WHOLEWORD )
+/*N*/ rStrm << (BYTE) GetWholeWord();
+/*N*/ else
+/*N*/ rStrm << (UINT16) 0 << (UINT16) 0;
+/*N*/ return rStrm;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ SvStream& SwRegisterItem::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ ASSERT( nIVer != USHRT_MAX,
+/*N*/ "SwRegisterItem: Wer faengt da Version USHRT_MAX nicht ab?" );
+/*N*/
+/*N*/ rStrm << (BYTE)GetValue();
+/*N*/ return rStrm;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwRegisterItem::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ BYTE bIsRegister;
+/*N*/ rStrm >> bIsRegister;
+/*N*/ return new SwRegisterItem( BOOL( bIsRegister != 0 ) );
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ USHORT SwRegisterItem::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwRegisterItem: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ // im 3.1 FF nicht speichern
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ SvStream& SwFmtLineNumber::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ ASSERT( nIVer != USHRT_MAX,
+/*N*/ "SwFmtLineNumber: Wer faengt da Version USHRT_MAX nicht ab?" );
+/*N*/
+/*N*/ rStrm << static_cast<sal_uInt32>(nStartValue) << IsCount();
+/*N*/ return rStrm;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwFmtLineNumber::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ SwFmtLineNumber *pTmp = new SwFmtLineNumber;
+/*N*/ sal_uInt32 nTmp; BOOL bTmp;
+/*N*/ rStrm >> nTmp; pTmp->SetStartValue( nTmp );
+/*N*/ rStrm >> bTmp; pTmp->SetCountLines( bTmp );
+/*N*/ return pTmp;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ USHORT SwFmtLineNumber::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtLineNumber: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ // vor 5.0 nicht speichern
+/*N*/ return SOFFICE_FILEFORMAT_40 <= nFFVer ? 0 : USHRT_MAX;
+/*N*/ }
+
+
+
+// -----------------------------------------------------------------------
+
+/*N*/ SvStream& SwNumRuleItem::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ ASSERT( nIVer != USHRT_MAX,
+/*N*/ "SwNumRuleItem: Wer faengt da Version USHRT_MAX nicht ab?" );
+/*N*/
+/*N*/ // Damit wir Pool-NumRules umbenennen koennen, muessen wir die
+/*N*/ // PoolId der NumRule rausfinden und mit speichern.
+/*N*/ UINT16 nPoolId = USHRT_MAX;
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ if( pIo )
+/*N*/ {
+/*N*/ const SwNumRule *pNumRule = pIo->pDoc->FindNumRulePtr( GetValue() );
+/*N*/ if( pNumRule )
+/*N*/ nPoolId = pNumRule->GetPoolFmtId();
+/*N*/ }
+/*N*/
+/*N*/ rStrm.WriteByteString( GetValue(), rStrm.GetStreamCharSet() ) << nPoolId;
+/*N*/ return rStrm;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ SfxPoolItem* SwNumRuleItem::Create( SvStream& rStrm,
+/*N*/ USHORT nIVer ) const
+/*N*/ {
+/*N*/ String sTmp;
+/*N*/ UINT16 nPoolId;
+/*N*/
+/*N*/ rStrm.ReadByteString( sTmp, rStrm.GetStreamCharSet() );
+/*N*/ if( nIVer>0 )
+/*N*/ {
+/*N*/ // Pool-NumRules muessen evtl. noch umbenannt werden.
+/*N*/ rStrm >> nPoolId;
+/*N*/
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ if( pIo && nPoolId >= RES_POOLNUMRULE_BEGIN &&
+/*N*/ nPoolId < RES_POOLNUMRULE_END )
+/*?*/ SwStyleNameMapper::FillUIName( nPoolId, sTmp );
+/*N*/ }
+/*N*/
+/*N*/ return new SwNumRuleItem( sTmp );
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+/*N*/ USHORT SwNumRuleItem::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwNumRuleItem: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ // im 3.1 und 4.0 FF nicht speichern
+/*N*/ // Die FF-Version 0 enthielt keine PoolId.
+/*N*/ return nFFVer <= SOFFICE_FILEFORMAT_40 ? USHRT_MAX : 1;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+
+/*N*/ SfxPoolItem* SwTblBoxNumFormat::Create( SvStream& rStrm, USHORT nVer) const
+/*N*/ {
+/*N*/ BYTE nFlag;
+/*N*/ UINT32 nTmp;
+/*N*/
+/*N*/ rStrm >> nTmp >> nFlag;
+/*N*/
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvNumberFormatter* pN;
+/*N*/ if( pIo && 0 != ( pN = pIo->pDoc->GetNumberFormatter( FALSE ) ) )
+/*N*/ nTmp = pN->GetMergeFmtIndex( nTmp );
+/*N*/
+/*N*/ SwTblBoxNumFormat* pNew = new SwTblBoxNumFormat( nTmp, 0 != nFlag );
+/*N*/ return pNew;
+/*N*/ }
+
+
+/*N*/ SvStream& SwTblBoxNumFormat::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ rStrm << GetValue() << (BYTE)bAuto;
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ USHORT SwTblBoxNumFormat::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwTblBoxNumFormat: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+// -----------------------------------------------------------------------
+
+
+/*N*/ SfxPoolItem* SwTblBoxValue::Create( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ double dVal;
+/*N*/ if( 0 == nIVer )
+/*N*/ {
+/*N*/ sal_Char* dummy;
+/*N*/ ByteString sValue;
+/*N*/ rStrm.ReadByteString( sValue );
+/*N*/ dVal = strtod( sValue.GetBuffer(), &dummy );
+/*N*/ }
+/*N*/ else
+/*N*/ rStrm >> dVal;
+/*N*/
+/*N*/ return new SwTblBoxValue( dVal );
+/*N*/ }
+
+
+/*N*/ SvStream& SwTblBoxValue::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ if( 0 == nIVer )
+/*N*/ {
+/*?*/ ByteString sValue(ByteString::CreateFromDouble(nValue));
+/*?*/ rStrm.WriteByteString( sValue );
+/*N*/ }
+/*N*/ else
+/*N*/ rStrm << nValue;
+/*N*/
+/*N*/ return rStrm;
+/*N*/ }
+
+
+/*N*/ USHORT SwTblBoxValue::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwTblBoxValue: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? USHRT_MAX :
+/*N*/ (SOFFICE_FILEFORMAT_40==nFFVer ? 0 : 1 );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3block.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3block.cxx
new file mode 100644
index 000000000000..78ed7774db6f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3block.cxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <sw3imp.hxx>
+
+#include <swerror.h>
+namespace binfilter {
+
+#define STREAM_STGREAD ( STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE )
+#define STREAM_STGWRITE ( STREAM_READ | STREAM_WRITE | STREAM_SHARE_DENYWRITE )
+
+sal_Char __FAR_DATA N_BLOCKINFO[] = "AutotextInfo";
+
+
+/*************************************************************************
+*
+* Enumeration aller Textbausteine
+*
+*************************************************************************/
+
+// Das Directory enthaelt die Kurz- und Langnamen der Bausteine. Die
+// Bausteine selbst sind unter ihrem Kurznamen in eigenen Streams
+// abgelegt. Die Namen selbst sind nach folgender Konvention aufgebaut:
+// 1. Zeichen: #
+// ! == 0x01
+// / == 0x0F
+// \ == 0x0C
+// : == 0x0A
+// . == 0x0E
+
+
+// Der Fehlercode wird zurueckgeliefert. Das Ende der Liste
+// wird durch einen leeren Short-Namen angezeigt.
+
+
+/*************************************************************************
+*
+* I/O einzelner Textbausteine
+*
+*************************************************************************/
+
+
+////////////////////////////////////////////////////////////////////////////
+
+
+// Textbaustein-Konversionsmode ein/ausschalten
+// Das Flag verhindert das Commit auf die Root nach dem Schreiben
+// eines Textbausteins; daher wird hier committed, wenn das
+// Flag geloescht wird.
+
+
+
+// ggf. eine SvPersist-Instanz einrichten
+
+/*N*/ BOOL Sw3IoImp::CheckPersist()
+/*N*/ {
+/*N*/ // Haben wir schon einen Persist?
+/*N*/ if( pDoc->GetPersist() )
+/*N*/ return TRUE;
+ DBG_BF_ASSERT(0, "STRIP"); return FALSE;//STRIP001 /*?*/ pPersist = new Sw3Persist;
+/*N*/ }
+
+// ggf. eine SvPersist-Instanz freigeben
+
+
+//////////////////////////////////////////////////////////////////////////
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3doc.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3doc.cxx
new file mode 100644
index 000000000000..4392fa0566c1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3doc.cxx
@@ -0,0 +1,770 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx" //Damit "unsere" Attribute angezogen werden.
+
+#include <bf_svtools/sfxecode.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <tools/tenccvt.hxx>
+#include <swmodule.hxx>
+
+#include <fmtcntnt.hxx>
+#include <frmatr.hxx>
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "swrect.hxx"
+#include "swerror.h"
+#include "pam.hxx"
+#include "rootfrm.hxx"
+#include "pagedesc.hxx"
+#include "ndtxt.hxx"
+#include "ndole.hxx"
+#include "sw3imp.hxx"
+namespace binfilter {
+
+
+extern String GetSWGVersion();
+
+// Wird von der GUI-Seite gesetzt, wenn Layouts ignoriert werden sollen
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+void lcl_sw3doc_ChgChartName( SwDoc* pDoc )
+{
+ // bei "alten" Dokumenten muss das an eine Tabelle gebundene
+ // Chart-Object sonderbehandelt werden. Die Verbindung von
+ // Tabelle zum ChartObject erfolgt weiterhin ueber den Namen,
+ // aber der wird nicht mehr im FlyFormat, sondern direkt
+ // beim OLE-Node gespeichert. FlyFrames koennen jetzt benannt
+ // werden (Name steht im FlyFormat!)
+
+ // durch alle Tabellen
+ for( USHORT n = pDoc->GetTblFrmFmts()->Count(); n; )
+ {
+ const String& rTblNm = (*pDoc->GetTblFrmFmts())[ --n ]->GetName();
+ for( USHORT i = pDoc->GetSpzFrmFmts()->Count(); i; )
+ {
+ // und durch alle Flys
+ SwFmt *pFmt = (*pDoc->GetSpzFrmFmts())[ --i ];
+ if( RES_FLYFRMFMT == pFmt->Which() && pFmt->GetName() == rTblNm )
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ SwOLENode* pNd;
+ if( pIdx && 0 != ( pNd =
+ pDoc->GetNodes()[ pIdx->GetIndex() + 1 ]->GetOLENode() ))
+ {
+ pNd->SetChartTblName( rTblNm );
+ pFmt->SetName( pDoc->GetUniqueOLEName() );
+ }
+ }
+ }
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Laden eines Dokumentinhalts. Das kann ein Textbaustein oder ein
+// normales Dokument sein. Die Vorlagen sind bereits eingelesen.
+
+
+/*N*/ void Sw3IoImp::LoadDocContents( SwPaM* pPaM )
+/*N*/ {
+/*N*/ // Wenn ein PaM angegeben ist, wird an einer bestimmten
+/*N*/ // Position eingefuegt, also ist Insert = TRUE
+/*N*/ short nDiff = 0;
+/*N*/ BYTE nInsFirstPara = 0;
+/*N*/ if( pPaM )
+/*N*/ {
+/*?*/ bInsert = TRUE;
+/*?*/ SwTxtNode *pTxtNode=pDoc->GetNodes()[pPaM->GetPoint()->nNode]->GetTxtNode();
+/*?*/ // Ist das ein SwPaM auf einen TextNode?
+/*?*/ if( !pTxtNode )
+/*?*/ {
+/*?*/ // Ist keiner, dann machen wir uns einen
+/*?*/ pTxtNode=pDoc->GetNodes().MakeTxtNode(pPaM->GetPoint()->nNode,
+/*?*/ (SwTxtFmtColl*) pDoc->GetDfltTxtFmtColl() );
+/*?*/ // Da zeigt jetzt auch der StartIdx hin
+/*?*/ nDiff = -1;
+/*?*/ }
+/*?*/ else if( pTxtNode->GetTxt().Len() )
+/*?*/ nInsFirstPara = 1;
+/*N*/ }
+/*N*/
+/*N*/ // aktuelles Passwort retten
+/*N*/ sal_Char cOldPass[ 16 ];
+/*N*/ memcpy( cOldPass, cPasswd, 16 );
+/*N*/ InHeader( TRUE );
+/*N*/ if( nFileFlags & SWGF_BAD_FILE )
+/*N*/ {
+/*?*/ Error( ERR_SWG_READ_ERROR );
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Auf gehts:
+/*N*/ BOOL bNode1 = TRUE;
+/*N*/ BOOL bDone = BOOL( !Good() );
+/*N*/ xub_StrLen nOffset = 0;
+/*N*/ SwNodeIndex aPos( pDoc->GetNodes().GetEndOfContent(), -1 );
+/*N*/ if( pPaM )
+/*?*/ aPos = pPaM->GetPoint()->nNode.GetIndex() + nDiff,
+/*?*/ nOffset = pPaM->GetPoint()->nContent.GetIndex();
+/*N*/ pCurPaM = pPaM;
+/*N*/
+/*N*/ SwDBData aOldData(pDoc->_GetDBDesc());
+/*N*/
+/*N*/ // Normales Lesen?
+/*N*/ while( !bDone )
+/*N*/ {
+/*N*/ BYTE cType = Peek();
+/*N*/ if( !Good() || pStrm->IsEof() )
+/*N*/ bDone = TRUE;
+/*N*/ else switch( cType )
+/*N*/ {
+/*N*/ case SWG_EOF:
+/*N*/ bDone = TRUE; break;
+/*N*/ case SWG_DBNAME:
+/*N*/ // der DatenbankName
+/*N*/ if( bNormal && !bInsert )
+/*N*/ InDBName();
+/*N*/ else if( bInsert &&
+/*N*/ !IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*?*/ // in Versionen ohne mehrfache Datenbanken wird hier
+/*?*/ // der DB-Name gelesen. Warum nicht auch das
+/*?*/ // SQL-Statemement?
+/*?*/ OpenRec( SWG_DBNAME );
+/*?*/
+/*?*/ // TODO: unicode: what about 0xff?
+/*?*/ String sStr;
+/*?*/ InString( *pStrm, sStr );
+/*?*/ SwDBData aData;
+/*?*/ aData.sDataSource = sStr.GetToken(0, DB_DELIM);
+/*?*/ aData.sCommand = sStr.GetToken(1, DB_DELIM);
+/*?*/ pDoc->ChgDBData( aData );
+/*?*/
+/*?*/ ULONG nSaveWarn = nWarn;
+/*?*/ CloseRec( SWG_DBNAME );
+/*?*/ nWarn = nSaveWarn;
+/*N*/ }
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_STRINGPOOL:
+/*N*/ InStringPool( cType, aStringPool );
+/*N*/ break;
+/*N*/ case SWG_PASSWORD:
+ InPasswd(); break;
+/*N*/ case SWG_JOBSETUP:
+/*N*/ if( bNormal && !bInsert ) InJobSetup();
+/*N*/ else SkipRec(); break;
+/*N*/ case SWG_CONFIG:
+/*N*/ SkipRec();
+/*N*/ break;
+/*?*/ case SWG_PGPREVIEWPRTDATA:
+/*?*/ if( bNormal && !bInsert )
+ InPagePreViewPrintData();
+/*?*/ else
+/*?*/ SkipRec();
+/*?*/ break;
+/*N*/
+/*N*/ // case SWG_NUMRULE:
+/*N*/ // Der 4.0-SW kommt hier auch schon mit NumRules
+/*N*/ // zurecht, ignoriert sie aber. Es weiss zwar keiner
+/*N*/ // warum das so ist, aber wir behalten es mal lieber bei.
+/*N*/ case SWG_OUTLINE:
+/*N*/ if( bNormal && !(bInsert || bBlock) )
+/*N*/ {
+/*N*/ // Dieser Record steht nur in der 3.1 und 4.0 hier.
+/*N*/ // Ab der 5.0 steht er in einem eigenen Stream.
+/*N*/ SwNumRule* pRule = InNumRule( cType );
+/*N*/ if( pRule )
+/*N*/ {
+/*N*/ //JP 10.03.96: und wieder alles zurueck
+/*N*/ #if 0
+/*N*/ if( nVersion < SWG_DELETEOLE )
+/*N*/ {
+/*N*/ //JP 18.01.96: Alle Ueberschriften sind normalerweise
+/*N*/ // ohne Kapitelnummer. Darum hier explizit abschalten
+/*N*/ // weil das Default jetzt wieder auf AN ist.
+/*N*/ // und UeberschirftBasis ohne Einrueckung!
+/*N*/ SwTxtFmtColl* pCol = pDoc->GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_HEADLINE_BASE );
+/*N*/ pCol->ResetAttr( RES_LR_SPACE );
+/*N*/
+/*N*/ for( short i = 0; i < MAXLEVEL; i++ )
+/*N*/ {
+/*N*/ if( !pRule->GetNumFmt( i ) )
+/*N*/ {
+/*N*/ SwNumFmt aFmt( pRule->Get( i ) );
+/*N*/ aFmt.eType = NUMBER_NONE;
+/*N*/ pRule->Set( i, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ pDoc->SetOutlineNumRule( *pRule );
+/*N*/ }
+/*N*/ delete pRule;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ SkipRec();
+/*N*/ }
+/*N*/ break;
+/*?*/ case SWG_MACROTBL:
+ if( bNormal ) InMacroTbl(); else SkipRec();
+/*?*/ break;
+/*N*/ case SWG_DICTIONARY:
+/*N*/ if( bNormal && IsVersion( SWG_DESKTOP40 ) )
+/*N*/ InDictionary();
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_FIELDTYPE:
+/*N*/ if( bNormal ) InFieldType(); else SkipRec();
+/*N*/ break;
+/*N*/ case SWG_FLYFRAMES:
+/*N*/ if( bNormal ) InFlyFrames(); else SkipRec();
+/*N*/ break;
+/*N*/ case SWG_FOOTINFO:
+/*N*/ // globale Fussnoten-Info
+/*N*/ if( bNormal && !(bInsert || bBlock) )
+/*N*/ InFtnInfo();
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_ENDNOTEINFO:
+/*N*/ // globale Endnoten-Info
+/*N*/ if( bNormal && !(bInsert || bBlock) )
+/*N*/ InEndNoteInfo();
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_LINENUMBERINFO:
+/*N*/ // Zeilennumer-Info
+/*N*/ if( bNormal && !(bInsert || bBlock) )
+/*N*/ InLineNumberInfo();
+/*N*/ else
+/*N*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_TOXDESCS51:
+/*N*/ if( !IsVersion(SWG_NEWTOX) )
+/*N*/ InTOXs51();
+/*N*/ else
+/*N*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_TOXDESCS:
+/*N*/ ASSERT( IsVersion(SWG_NEWTOX),
+/*N*/ "new tox descs within a old doc" );
+/*N*/ InTOXs();
+/*N*/ break;
+/*N*/ case SWG_BOOKMARKS:
+/*N*/ InBookmarks();
+/*N*/ break;
+/*N*/ case SWG_REDLINES:
+ InRedlines(); //SW50.SDW
+/*?*/ break;
+/*N*/ case SWG_CONTENTS:
+/*N*/ if( bNormal )
+/*N*/ InContents( aPos, nOffset, bNode1, nInsFirstPara );
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ bNode1 = FALSE; nOffset = 0;
+/*N*/ nInsFirstPara = 0;
+/*N*/ break;
+/*N*/ case SWG_DOCSTAT:
+/*N*/ if( bNormal && !bInsert )
+/*N*/ InDocStat();
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_NUMBERFORMATTER:
+/*?*/ InNumberFormatter();
+/*?*/ break;
+/*N*/ case SWG_DOCDUMMIES:
+/*N*/ if( bNormal && !bInsert )
+/*N*/ InDocDummies();
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ case SWG_LAYOUTINFO:
+/*N*/ SkipRec();
+/*N*/ break;
+/*N*/
+/*N*/ #ifdef TEST_HUGE_DOCS
+/*N*/ case SWG_TESTHUGEDOCS:
+/*N*/ InHugeRecord();
+/*N*/ #endif
+/*N*/ default:
+/*N*/ SkipRec();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Insert TOXs if not done this already.
+/*N*/ ConnectPageDescAttrs();
+/*N*/ ConnectTOXs();
+/*N*/
+/*N*/ Cleanup( FALSE );
+/*N*/
+/*N*/ if( !IsVersion(SWG_LONGIDX) && pCurNumRange )
+/*?*/ CloseNumRange40( aPos );
+/*N*/
+/*N*/ if( bInsert && !IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*?*/ pDoc->ChgDBData( aOldData );
+/*N*/
+/*N*/ if( !nRes )
+/*N*/ {
+/*N*/ if( bNormal )
+/*N*/ {
+/*N*/ // Neues Doc gelesen
+/*N*/ if( !bInsert )
+/*N*/ {
+/*N*/ // bei "alten" Dokumenten muss das an eine Tabelle gebundene
+/*N*/ // Chart-Object sonderbehandelt werden. Die Verbindung von
+/*N*/ // Tabelle zum ChartObject erfolgt weiterhin ueber den Namen,
+/*N*/ // aber der wird nicht mehr im FlyFormat, sondern direkt
+/*N*/ // beim OLE-Node gespeichert. FlyFrames koennen jetzt benannt
+/*N*/ // werden (Name steht im FlyFormat!)
+/*N*/ if( nVersion < SWG_OLENAME && pDoc->GetTblFrmFmts()->Count() &&
+/*N*/ pDoc->GetSpzFrmFmts()->Count() )
+ lcl_sw3doc_ChgChartName( pDoc );
+/*N*/
+/*N*/ pDoc->SetLoaded( TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Nachladen von Vorlagen etc.
+/*N*/ // falls wir die OutlineLevel veraendert haben (Vorlagen geladen),
+/*N*/ // dann muss am Doc ein Update auf die neuen Nummern erfolgen !!
+/*?*/ if( !bAdditive && pDoc->GetOutlineNumRule() )
+/*?*/ pDoc->SetOutlineNumRule( *pDoc->GetOutlineNumRule() );
+/*?*/ pDoc->SetModified();
+/*N*/ }
+/*N*/ }
+/*N*/ pDoc->SetNewDoc( FALSE );
+/*N*/ if ( nVersion < SWG_OLEVIS2PAGE )
+/*N*/ {
+/*N*/ //Bei alten Dokumenten schaetzen wir: Wenn die Standardpage
+/*N*/ //Seitenraender von 0 hat, so wirds wohl ein Ole sein.
+/*N*/ //MA: Ole wird jetzt per Browse dargestellt.
+/*?*/ SwPageDesc &rDesc = pDoc->_GetPageDesc( 0 );
+/*?*/ const SvxLRSpaceItem &rLR = rDesc.GetMaster().GetLRSpace();
+/*?*/ if ( !rLR.GetLeft() && !rLR.GetRight() )
+/*?*/ pDoc->SetBrowseMode( TRUE );
+/*N*/ }
+/*N*/ }
+
+
+// Doc-Header
+// SWG_COMMENT Build des Writers (opt.)
+// SWG_STRINGPOOL Stringpool
+// SWG_PASSWORD Passwort fuer Bereiche (opt.)
+// SWG_OUTLINE Outline-Numerierung (nicht bei Textbausteinen)
+// SWG_NUMRULE Default-Numerierung (nicht bei Textbausteinen)
+// SWG_MACROTBL Makro-Tabelle (nicht bei Textbausteinen)
+// SWG_DICTIONARY Woerterbuecher des Onlinespellings
+// SWG_FOOTINFO globale Fuánoten-Infos (nicht bei Textbausteinen)
+// SWG_FLYFRAMES Seitengebundene Frames (nicht bei Textbausteinen)
+// SWG_FIELDTYPES Feldtypen
+// SWG_TOXDESCS Verzeichnisbereiche
+// SWG_BOOKMARKS Bookmarks
+// SWG_CONTENTS Dokumentinhalt
+// SWG_FRAMEINFO Layout-Frames
+// SWG_STRINGPOOL Liste aller Namen von embedded-Grafiken
+// SWG_JOBSETUP Job-Setup (nicht bei Textbausteinen)
+// SWG_EOF Streamende
+
+/*N*/ void Sw3IoImp::SaveDocContents( SwPaM& rPaM, const String* pBlockName )
+/*N*/ {
+/*N*/ if( pBlockName )
+/*?*/ bBlock = TRUE, aBlkName = *pBlockName;
+/*N*/ OutHeader();
+/*N*/ // Alle FlyFrames am Doc sammeln
+/*N*/ CollectFlyFrms( &rPaM );
+/*N*/ aStringPool.Setup( *pDoc, pStrm->GetVersion(), pExportInfo );
+/*N*/ // Ausgabe des Versions-Textes, falls vorhanden
+/*N*/ String aVersion = GetSWGVersion();
+/*N*/ if( aVersion.Len() )
+/*N*/ {
+/*N*/ ByteString sTmp( aVersion, eSrcSet );
+/*N*/ OpenRec( SWG_COMMENT );
+/*N*/ *pStrm << sTmp.GetBuffer();
+/*N*/ CloseRec( SWG_COMMENT );
+/*N*/ }
+/*N*/ // der DatenbankName
+/*N*/ OutDBName();
+/*N*/
+/*N*/ // Der String-Pool
+/*N*/ OutStringPool( SWG_STRINGPOOL, aStringPool );
+/*N*/ if( !bBlock )
+/*N*/ {
+/*N*/ if( !nRes )
+/*N*/ {
+/*N*/ aStat.Reset();
+/*N*/ aStat.nPara = 0; // default ist auf 1
+/*N*/ OutDocStat( TRUE );
+/*N*/ aDefWordDelim = SW_MOD()->GetDocStatWordDelim();
+/*N*/ }
+/*N*/
+/*N*/ // Outline-Numerierung, falls vorhanden
+/*N*/ if( pDoc->GetOutlineNumRule() && IsSw31Or40Export() )
+/*N*/ OutNumRule( SWG_OUTLINE, *pDoc->GetOutlineNumRule() );
+/*N*/
+/*N*/ // globale Fussnoten-Info
+/*N*/ if( !nRes )
+/*N*/ OutFtnInfo();
+/*N*/ if( !nRes && !IsSw31Or40Export() )
+/*N*/ OutEndNoteInfo();
+/*N*/ if( !nRes && !IsSw31Or40Export() )
+/*N*/ OutLineNumberInfo();
+/*N*/ }
+/*N*/
+/*N*/ // Woerterbuecher des Onlinespellings
+/*N*/ if( !nRes && !IsSw31Export() ) OutDictionary();
+/*N*/ // Numberformatter schreiben bei Textbausteinen. Bei normalen
+/*N*/ // Dokumenten erfolgt es schon bei den PageDescs
+/*N*/ if( !nRes && !IsSw31Export() && bBlock ) OutNumberFormatter();
+/*N*/
+/*N*/ // Makro-Tabellen
+/*N*/ if( !nRes ) OutMacroTbl();
+/*N*/ // Nicht-Systemfeldtypen
+/*N*/ if( !nRes ) OutFieldTypes();
+/*N*/ // Verzeichnisbereiche
+/*N*/ if( !nRes )
+/*N*/ {
+/*N*/ OutTOXs51();
+/*N*/ if( !nRes && !IsSw31Or40Export() )
+/*N*/ OutTOXs();
+/*N*/ }
+/*N*/
+/*N*/ // Bookmarks (nicht, wenn ein SW2-TextBlockDoc konvertiert wird)
+/*N*/ // JP 16.10.95: werden jetzt im OutPageDesc geschrieben
+/*N*/ // MIB 11.12.96: es werden jetzt die Bookmarks der Seiten-Vorlagen und
+/*N*/ // im Dok jeweils getrennt in die Streams geschrieben
+/*N*/ if( !nRes && !( nGblFlags & SW3F_CONVBLOCK ) && !IsSw31Export() )
+/*N*/ OutBookmarks( FALSE );
+/*N*/
+/*N*/ // Solange Textbausteine ueber Zwischen-Dokumente geladen und
+/*N*/ // gespeichert werden, kann es dort keine Redlines geben. Also
+/*N*/ // muss man dies nirgendwo abfangen (nicht nur hier nicht).
+/*N*/ if( !nRes && !IsSw31Or40Export() )
+/*N*/ OutRedlines( FALSE );
+/*N*/
+/*N*/ // Einstellungen der PagePreView speichern
+/*N*/ if( !nRes && !bBlock && !IsSw31Or40Export() )
+/*N*/ OutPagePreViewPrintData();
+/*N*/
+/*N*/ // Eine handvoll persistenten Dummy-Member
+/*N*/ if( !nRes && !IsSw31Or40Export() )
+/*N*/ OutDocDummies();
+/*N*/
+/*N*/ // Der Inhalt
+/*N*/ SwPaM* pPaM = &rPaM;
+/*N*/ while( !nRes )
+/*N*/ {
+/*N*/ pCurPaM = pPaM;
+/*N*/ // seitengebundene FlyFrames
+/*N*/ if( !pBlockName ) OutFlyFrames( *pPaM );
+/*N*/ OutContents( pPaM );
+/*N*/ if( (SwPaM*) pPaM->GetNext() != &rPaM )
+/*N*/ {
+/*?*/ pPaM = (SwPaM*) pPaM->GetNext();
+/*N*/ }
+/*N*/ else break;
+/*N*/ }
+/*N*/ // der Job-Setup. Vor dem Layout, damit das Layout bei veraendertem Drucker
+/*N*/ // gleich geeignet invalidiert werden kann.
+/*N*/ if( !bBlock && !nRes )
+/*N*/ OutJobSetup();
+/*N*/
+/*N*/ #ifdef TEST_HUGE_DOCS
+/*N*/ BOOL b = FALSE;
+/*N*/ if( b )
+/*N*/ OutHugeRecord( 1024, 32*1024 );
+/*N*/ #endif
+/*N*/
+/*N*/ ULONG nRecSzPos = 0;
+/*N*/ if( !nRes && HasRecSizes() && !IsSw31Or40Export() )
+ nRecSzPos = OutRecSizes();
+/*N*/
+/*N*/ OpenRec( SWG_EOF );
+/*N*/ CloseRec( SWG_EOF );
+/*N*/ // Ggf. Fehlerflag schreiben
+/*N*/ if( nRes )
+/*N*/ {
+/*?*/ nFileFlags |= SWGF_BAD_FILE;
+/*N*/ }
+/*N*/ // Datei-Flags noch einmal schreiben
+/*N*/ pStrm->Seek( 0L );
+/*N*/ OutHeader( nRecSzPos );
+/*N*/ // Temporaere Namenserweiterungen entfernen
+/*N*/ aStringPool.RemoveExtensions( *pDoc );
+/*N*/ FreeFlyFrms();
+/*N*/ // Die gesammelte Statistik am Doc setzen
+/*N*/ if( !bBlock )
+/*N*/ {
+/*N*/ // Bis das Layout gespeichert wird, die Seiten uebernehmen
+/*N*/ if( pDoc->GetRootFrm() )
+/*N*/ aStat.nPage = pDoc->GetRootFrm()->GetPageNum();
+/*N*/ pDoc->SetDocStat( aStat );
+/*N*/ OutDocStat( FALSE );
+/*N*/ }
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Laden des Doc-Headers.
+
+// BYTE[6] Signatur fuer den harten Patch
+// BYTE 0
+// BYTE Laenge der globalen Daten (z.Zt. 48 oder 112)
+// INT16 Format-Version
+// INT16 Globale Flags
+// INT32 Persistente Flags vom Document
+// 0x0001 == bOleVis2Page, MA 20. Mar. 98 gibt es nicht mehr, wird
+// auf BrowseMode gemappt.
+// INT32 x 3 Dummys
+// BYTE x 16 Passwort
+// BYTE CharSet letzter Save
+// BYTE GUIType letzer Save (Info)
+// INT32 Datum letzter Save (Info)
+// INT32 Uhrzeit letzter Save (Info)
+// BYTE[64] Langer Name des Textbausteins, falls SWGF_BLOCKNAME aktiv
+
+/*N*/ BOOL Sw3IoImp::CheckHeader( sal_Char *sHeader )
+/*N*/ {
+/*N*/ return strcmp( sHeader, SW5HEADER ) == 0 ||
+/*N*/ strcmp( sHeader, SW4HEADER ) == 0 ||
+/*N*/ strcmp( sHeader, SW3HEADER ) == 0;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InHeader( BOOL bReadRecSizes )
+/*N*/ {
+/*N*/ BYTE cLen, cSet, cGUI;
+/*N*/ sal_Char cHdrSign[ 8 ];
+/*N*/ Reset2();
+/*N*/ OutputMode( FALSE );
+/*N*/ pStrm->Seek( 0L );
+/*N*/ if( pStrm->Read( cHdrSign, 7 ) == 7 )
+/*N*/ {
+/*N*/ if( !CheckHeader(cHdrSign) )
+/*N*/ {
+/*N*/ Error( ERR_SW6_NOWRITER_FILE );
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ return;
+/*N*/
+/*N*/ *pStrm >> cLen;
+/*N*/ ULONG nOld = pStrm->Tell();
+/*N*/
+/*N*/ UINT32 nRecSzPos;
+/*N*/ INT32 nDocFlags,
+/*N*/ nDummy;
+/*N*/ BYTE cRedlineMode;
+/*N*/ INT8 nCompatVer,
+/*N*/ nDummy8;
+/*N*/
+/*N*/ *pStrm >> nVersion >> nFileFlags >> nDocFlags >> nRecSzPos >> nDummy
+/*N*/ >> nDummy8 >> nDummy8 >> cRedlineMode >> nCompatVer;
+/*N*/ // Ist die daeti von einem zu neuen SW und laesst sich nicht mehr lesen?
+/*N*/ // Die Kompatibilitaets-Version von aelteren File-Formaten muss
+/*N*/ // natuerlich ignoriert werden.
+/*N*/ if( IsVersion(SWG_MAJORVERSION) && nCompatVer > SWG_CVERSION )
+/*N*/ {
+/*N*/ Error( ERR_SWG_NEW_VERSION ); return; // Datei ist von neuerem SW
+/*N*/ }
+/*N*/ pStrm->Read( cPasswd, 16L );
+/*N*/ *pStrm >> cSet >> cGUI >> nDate >> nTime;
+/*N*/ eSrcSet = GetSOLoadTextEncoding( (rtl_TextEncoding) cSet,
+/*N*/ pStrm->GetVersion() );
+/*N*/ pStrm->SetStreamCharSet( eSrcSet );
+/*N*/ if( nFileFlags & SWGF_BLOCKNAME )
+/*N*/ {
+/*?*/ sal_Char cBuf[ 64 ];
+/*?*/ if( pStrm->Read( cBuf, 64 ) != 64 )
+/*?*/ pStrm->SetError( SVSTREAM_FILEFORMAT_ERROR );
+/*?*/ aBlkName = String( cBuf, eSrcSet );
+/*N*/ }
+/*N*/ ULONG nNew = pStrm->Tell();
+/*N*/ nOld += cLen;
+/*N*/ if( nOld != nNew )
+/*?*/ pStrm->Seek( nOld );
+/*N*/
+/*N*/ #ifdef MAC
+/*N*/ if( pStrm != &pPageStyles && pStrm != &pNumRules )
+/*N*/ #else
+/*N*/ if( pStrm != pPageStyles && pStrm != &pNumRules )
+/*N*/ #endif
+/*N*/ {
+/*N*/ // Flags werden nur gesetzt, wenn der
+/*N*/ // Contents-Stream eingelesen wird.
+/*N*/ if( nFileFlags & SWGF_HAS_PGNUMS )
+/*?*/ pDoc->SetPageNums();
+/*N*/ if( !bInsert )
+/*N*/ {
+/*N*/ if( IsVersion(SWG_OLEVIS2PAGE) )
+/*N*/ pDoc->SetBrowseMode ( 0 != (nDocFlags & 0x0001) ||
+/*N*/ 0 != (nDocFlags & 0x0002) );
+/*N*/
+/*N*/ pDoc->SetHTMLMode( 0 != (nDocFlags & 0x0004) );
+/*N*/ pDoc->SetHeadInBrowse( 0 != (nDocFlags & 0x0008) );
+/*N*/ pDoc->SetFootInBrowse( 0 != (nDocFlags & 0x0010) );
+/*N*/ pDoc->SetGlobalDoc( 0 != (nDocFlags & 0x0020) );
+/*N*/ pDoc->SetGlblDocSaveLinks( 0 != (nDocFlags & 0x0040) );
+/*N*/ pDoc->SetLabelDoc( 0 != (nDocFlags & 0x0080) );
+/*N*/ }
+/*N*/ }
+/*N*/ if( bNormal && !bInsert && IsVersion(SWG_LONGIDX) )
+/*N*/ pDoc->SetRedlineMode_intern( (SwRedlineMode)cRedlineMode );
+/*N*/ if( !CheckPasswd() )
+/*?*/ Error( ERRCODE_SFX_WRONGPASSWORD );
+/*N*/
+/*N*/ // MIB: Das <= fuer das 40-FF ist korrekt, denn es gab eine Weile
+/*N*/ // 4.0-Storages mit 5.0-Streams.
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( !bBlock )
+/*N*/ ASSERT( ( pRoot->GetVersion() == SOFFICE_FILEFORMAT_31 &&
+/*N*/ nVersion >= SWG_MAJORVERSION_30 &&
+/*N*/ nVersion < SWG_MAJORVERSION_40 ) ||
+/*N*/ ( pRoot->GetVersion() == SOFFICE_FILEFORMAT_40 &&
+/*N*/ nVersion >= SWG_MAJORVERSION_40 &&
+/*N*/ nVersion < SWG_MAJORVERSION_50 ) ||
+/*N*/ ( pRoot->GetVersion() == SOFFICE_FILEFORMAT_50 &&
+/*N*/ nVersion >= SWG_MAJORVERSION_50 ),
+/*N*/ "Beim Lesen stimmt die FF-Version am Storage nicht!" );
+/*N*/ #endif
+/*N*/
+/*N*/ if( nRecSzPos!= 0 && bReadRecSizes && !nRes && IsVersion(SWG_RECSIZES) )
+ InRecSizes( nRecSzPos );
+/*N*/ }
+
+
+/*N*/ void Sw3IoImp::OutHeader( ULONG nRecSzPos )
+/*N*/ {
+/*N*/ Reset2();
+/*N*/ nFileFlags |= SWGF_NO_FRAMES;
+/*N*/ if( aBlkName.Len() )
+/*N*/ nFileFlags |= SWGF_BLOCKNAME;
+/*N*/
+/*N*/ INT32 nDocFlags = 0;
+/*N*/ if ( pDoc->IsBrowseMode() )
+/*N*/ nDocFlags |= 0x0002;
+/*N*/ if ( pDoc->IsHTMLMode() )
+/*N*/ nDocFlags |= 0x0004;
+/*N*/ if ( pDoc->IsHeadInBrowse() )
+/*N*/ nDocFlags |= 0x0008;
+/*N*/ if ( pDoc->IsFootInBrowse() )
+/*N*/ nDocFlags |= 0x0010;
+/*N*/ if( pDoc->IsGlobalDoc() )
+/*N*/ nDocFlags |= 0x0020;
+/*N*/ if( pDoc->IsGlblDocSaveLinks() )
+/*N*/ nDocFlags |= 0x0040;
+/*N*/ if( !bBlock && !IsSw31Or40Export() && pDoc->IsLabelDoc() )
+/*N*/ nDocFlags |= 0x0080;
+/*N*/
+/*N*/ BYTE cRedlineMode = 0;
+/*N*/ if( !bBlock && !IsSw31Or40Export() )
+/*N*/ cRedlineMode = (BYTE)pDoc->GetRedlineMode();
+/*N*/
+/*N*/ UINT16 nVers = SWG_VERSION;
+/*N*/ const sal_Char *sHeader = SW5HEADER;
+/*N*/
+/*N*/ switch( pStrm->GetVersion() )
+/*N*/ {
+/*N*/ case SOFFICE_FILEFORMAT_40:
+/*N*/ nVers = SWG_EXPORT40;
+/*N*/ sHeader = SW4HEADER;
+/*N*/ break;
+/*N*/ case SOFFICE_FILEFORMAT_31:
+/*N*/ nVers = SWG_EXPORT31;
+/*N*/ sHeader = SW3HEADER;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( !nRecSzPos || !IsSw31Or40Export(),
+/*N*/ "Lange Records gibt's erst ab der 5.0" );
+/*N*/ ASSERT( GetSOStoreTextEncoding( gsl_getSystemTextEncoding(),
+/*N*/ pStrm->GetVersion() ) == eSrcSet,
+/*N*/ "wrong encoding while writing" );
+/*N*/ ASSERT( pStrm->GetStreamCharSet() == eSrcSet,
+/*N*/ "wrong encoding at stream while writing" );
+/*N*/
+/*N*/ OutputMode( TRUE );
+/*N*/ pStrm->Seek( 0L );
+/*N*/ *pStrm << sHeader
+/*N*/ << (BYTE) 0
+/*N*/ << (BYTE) ( aBlkName.Len() ? 46+64 : 46 ) // Laenge der Daten
+/*N*/ << (UINT16) nVers
+/*N*/ << (UINT16) nFileFlags
+/*N*/ << (INT32) nDocFlags
+/*N*/ << (UINT32) nRecSzPos
+/*N*/ << (INT32) 0
+/*N*/ << (INT8) 0
+/*N*/ << (INT8) 0
+/*N*/ << (BYTE) cRedlineMode
+/*N*/ << (INT8) SWG_CVERSION;
+/*N*/ pStrm->Write( cPasswd, 16 );
+/*N*/ *pStrm << (BYTE) eSrcSet
+/*N*/ << (BYTE) 0 // OLD: eSysType
+/*N*/ << (UINT32) nDate // fuer Passwortcheck wichtig
+/*N*/ << (UINT32) nTime;
+/*N*/ if( aBlkName.Len() )
+/*N*/ {
+/*N*/ // den langen Blocknamen rausschreiben
+/*?*/ ByteString sTmp( aBlkName, eSrcSet );
+/*?*/ sal_Char cBuf[ 64 ];
+/*?*/ sTmp.Erase( 63 );
+/*?*/ memset( cBuf, 0, 64 );
+/*?*/ memcpy( cBuf, sTmp.GetBuffer(), sTmp.Len() );
+/*?*/ pStrm->Write( cBuf, 64 );
+/*N*/ }
+/*N*/ }
+
+void Sw3IoImp::OutRecordSizesPos( ULONG nRecSzPos )
+{
+ ULONG nPos = pStrm->Tell();
+
+ pStrm->Seek( 16UL );
+ *pStrm << (UINT32)nRecSzPos;
+
+ pStrm->Seek( nPos );
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx
new file mode 100644
index 000000000000..557566022b3a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx
@@ -0,0 +1,2964 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdlib.h>
+
+#include <stdio.h>
+
+#include <tools/resid.hxx>
+#include <bf_svtools/macitem.hxx>
+#include <bf_svtools/zformat.hxx>
+#include <bf_svtools/urihelper.hxx>
+#include <bf_so3/linkmgr.hxx>
+
+#ifndef _SVSTDARR_USHORTS_DECL
+#define _SVSTDARR_USHORTS
+#endif
+
+#include <fmtinfmt.hxx>
+#include <fmtfld.hxx>
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "sw3imp.hxx"
+#include "flddat.hxx"
+#include "docufld.hxx"
+#include "chpfld.hxx"
+#include "ddefld.hxx"
+#include "expfld.hxx"
+#include "reffld.hxx"
+#include "usrfld.hxx"
+#include "dbfld.hxx"
+#include "txtfld.hxx"
+#include <authfld.hxx>
+#include "ndtxt.hxx"
+
+#include "poolfmt.hxx" // fuer InSetExpField
+#include "poolfmt.hrc" // fuer InSetExpField
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+#if !defined(UNX) && !defined(MSC) && !defined(PPC) && !defined(CSET) && !defined(WTC) && !defined(__MINGW32__) && !defined(OS2)
+
+#define FIELDFNTAB_SIZE 37
+#if FIELDFNTAB_SIZE != RES_FIELDS_END - RES_FIELDS_BEGIN
+#error Feld-Tabelle ist ungueltigt. Wurden neue Hint-IDs zugefuegt ??
+#endif
+
+#endif
+
+#define SWG_AUTHORITY_ENTRY_LCL 'E'
+
+sal_Char __FAR_DATA sSW3IO_FixedField[] = "FixedExport";
+sal_Char __FAR_DATA sSW3IO_AuthorityField[] = "AuthorityExport";
+/* #108791# */
+sal_Char __FAR_DATA sSW3IO_DropDownField[] = "DropDownExport";
+
+struct OldFormats
+{
+ NfIndexTableOffset eFormatIdx;
+ USHORT nOldFormat;
+};
+
+static OldFormats aOldDateFmt40[] =
+{
+ // Datumsfelder:
+ NF_DATE_SYSTEM_SHORT, DFF_SSYS, // Kurzes Systemdatum
+ NF_DATE_SYSTEM_LONG, DFF_LSYS, // Langes Systemdatum
+ NF_DATE_SYS_DDMMYY, DFF_DMY, // 06.10.64
+ NF_DATE_SYS_DDMMYYYY, DFF_DMYY, // 06.10.1964
+ NF_DATE_SYS_DMMMYY, DFF_DMMY, // 06. Okt 64
+ NF_DATE_SYS_DMMMYYYY, DFF_DMMYY, // 06. Okt 1964
+ NF_DATE_DIN_DMMMMYYYY, DFF_DMMMYY, // 06. Oktober 1964
+ NF_DATE_DIN_DMMMMYYYY, DFF_DMMMY, // 06. Oktober 64
+ NF_DATE_SYS_NNDMMMYY, DFF_DDMMY, // Di, 06. Okt 64
+ NF_DATE_SYS_NNDMMMMYYYY, DFF_DDMMMY, // Di, 06. Oktober 64
+ NF_DATE_SYS_NNDMMMMYYYY, DFF_DDMMMYY, // Di, 06. Oktober 1964
+ NF_DATE_SYS_NNNNDMMMMYYYY, DFF_DDDMMMYY, // Dienstag, 06. Oktober 1964
+ NF_DATE_SYS_NNNNDMMMMYYYY, DFF_DDDMMMY, // Dienstag, 06. Oktober 64
+ NF_DATE_SYS_MMYY, DFF_MY, // 10.64
+ NF_DATE_DIN_MMDD, DFF_MD, // 10-06
+ NF_DATE_DIN_YYMMDD, DFF_YMD, // 64-10-06
+ NF_DATE_DIN_YYYYMMDD, DFF_YYMD, // 1964-10-06
+
+ NF_NUMERIC_START, 0 // Tabellenende
+};
+
+static OldFormats aOldDateFmt30[] =
+{
+ // Datumsfelder:
+ NF_DATE_SYSTEM_SHORT, DFF_SSYS, // Kurzes Systemdatum
+ NF_DATE_SYSTEM_LONG, DFF_LSYS, // Langes Systemdatum
+ NF_DATE_SYS_DDMMYY, DFF_DMY, // 06.10.64
+ NF_DATE_SYS_DDMMYYYY, DFF_DMYY, // 06.10.1964
+ NF_DATE_SYS_DMMMYY, DFF_DMMY, // 06. Okt 64
+ NF_DATE_SYS_DMMMYYYY, 4 /*DFF_DMMYY*/, // 06. Okt 1964
+ NF_DATE_DIN_DMMMMYYYY, 5 /*DFF_DMMMYY*/, // 06. Oktober 1964
+ NF_DATE_DIN_DMMMMYYYY, 5 /*DFF_DMMMY*/, // 06. Oktober 64
+ NF_DATE_SYS_NNDMMMMYYYY, 6 /*DFF_DDMMMYY*/, // Di, 06. Oktober 1964
+ NF_DATE_SYS_NNDMMMYY, 6 /*DFF_DDMMY*/, // Di, 06. Okt 64
+ NF_DATE_SYS_NNDMMMMYYYY, 6 /*DFF_DDMMMY*/, // Di, 06. Oktober 64
+ NF_DATE_SYS_NNNNDMMMMYYYY, 7 /*DFF_DDDMMMYY*/, // Dienstag, 06. Oktober 1964
+ NF_DATE_SYS_NNNNDMMMMYYYY, 7 /*DFF_DDDMMMY*/, // Dienstag, 06. Oktober 64
+ NF_DATE_SYS_MMYY, 2 /*DFF_MY*/, // 10.64
+ NF_DATE_DIN_MMDD, DFF_MD, // 10-06
+ NF_DATE_DIN_YYMMDD, DFF_YMD, // 64-10-06
+ NF_DATE_DIN_YYYYMMDD, DFF_YYMD, // 1964-10-06
+
+ NF_NUMERIC_START, 0 // Tabellenende
+};
+
+static OldFormats aOldTimeFmt[] =
+{
+ // Zeitfelder:
+ NF_TIME_HHMMSS, TF_SYSTEM, // Systemzeit
+ NF_TIME_HHMM, TF_SSMM_24, // 23:25
+ NF_TIME_HHMMAMPM, TF_SSMM_12, // 11:25 PM
+
+ NF_NUMERIC_START, 0 // Tabellenende
+};
+
+static OldFormats aOldGetSetExpFmt40[] =
+{
+ NF_TEXT, VVF_CMD, // Kommando anzeigen
+ NF_TEXT, VVF_INVISIBLE, // unsichtbar
+ NF_PERCENT_INT, VVF_XXP, // 1234%
+ NF_PERCENT_DEC2, VVF_XX_XXP, // 1.234,56%
+ NF_TEXT, VVF_CLEAR, // ???
+
+ NF_NUMBER_SYSTEM, VVF_SYS, // Zahlenformat aus der
+ // Systemeinstellung
+ NF_NUMBER_INT, VVF_X, // 1234
+ NF_NUMBER_DEC2, VVF_X_X, // 1234,5
+ NF_NUMBER_DEC2, VVF_X_XX, // 1245,56
+ NF_NUMBER_1000DEC2, VVF_XX_XX, // 1.234,56
+ NF_NUMBER_1000DEC2, VVF_XX_X, // 1.234,5
+ NF_NUMBER_1000DEC2, VVF_XX_XXX, // 1.234,567
+ NF_CURRENCY_1000DEC2, VVF_SYS_CUR, // W„hrungsformat aus der
+ // Systemeinstellung
+ // (1.234,00 DM)
+ NF_CURRENCY_1000INT, VVF_X_CUR, // 1234 DM
+ NF_CURRENCY_1000DEC2, VVF_XX_XX_CUR, // 1234,56 DM 1234,00 DM
+ NF_CURRENCY_1000DEC2_DASHED, VVF_XX_X0_CUR, // 1234,56 DM 1234,-- DM
+ NF_CURRENCY_1000INT, VVF_CUR_X, // DM 1234
+ NF_CURRENCY_1000DEC2, VVF_CUR_XX_XX, // DM 1234,56 DM 1234,00
+ NF_CURRENCY_1000DEC2_DASHED, VVF_CUR_XX_X0, // DM 1234,56 DM 1234,--
+
+ NF_NUMERIC_START, 0 // Tabellenende
+};
+
+static OldFormats aOldGetSetExpFmt30[] =
+{
+ NF_TEXT, VVF_CMD, // Kommando anzeigen
+ NF_TEXT, VVF_INVISIBLE, // unsichtbar
+ NF_PERCENT_INT, VVF_XXP, // 1234%
+ NF_PERCENT_DEC2, VVF_XX_XXP, // 1.234,56%
+ NF_TEXT, VVF_CLEAR, // ???
+
+ NF_NUMBER_SYSTEM, 0x0020, // Zahlenformat aus der
+ // Systemeinstellung
+ NF_NUMBER_INT, 0x0080, // 1234
+ NF_NUMBER_1000DEC2, 0x0100, // 1.234,56
+ NF_NUMBER_DEC2, 0x0100, // 1234,5
+ NF_NUMBER_DEC2, 0x0100, // 1245,56
+ NF_NUMBER_1000DEC2, 0x0100, // 1.234,5
+ NF_NUMBER_1000DEC2, 0x0100, // 1.234,567
+ NF_CURRENCY_1000DEC2, 0x0200, // W„hrungsformat aus der
+ // Systemeinstellung
+ // (1.234,00 DM)
+ NF_CURRENCY_1000INT, 0x1000, // 1234 DM
+ NF_CURRENCY_1000DEC2, 0x1000, // 1234,56 DM 1234,00 DM
+ NF_CURRENCY_1000DEC2_DASHED, 0x1000, // 1234,56 DM 1234,-- DM
+ NF_CURRENCY_1000INT, 0x1000, // DM 1234
+ NF_CURRENCY_1000DEC2, 0x1000, // DM 1234,56 DM 1234,00
+ NF_CURRENCY_1000DEC2_DASHED, 0x1000, // DM 1234,56 DM 1234,--
+
+ NF_NUMERIC_START, 0 // Tabellenende
+};
+
+/*N*/ void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich,
+/*N*/ USHORT& rSubType, UINT32 &rFmt,
+/*N*/ USHORT nVersion )
+/*N*/ {
+/*N*/ const OldFormats *pOldFmt = 0L;
+/*N*/
+/*N*/ switch( rWhich )
+/*N*/ {
+/*N*/ case RES_DATEFLD:
+/*N*/ case RES_FIXDATEFLD:
+/*N*/ if( nVersion < SWG_NEWFIELDS )
+/*N*/ {
+/*N*/ rSubType = DATEFLD;
+/*N*/ if( RES_FIXDATEFLD == rWhich )
+/*N*/ rSubType |= FIXEDFLD;
+/*N*/ rWhich = RES_DATETIMEFLD;
+/*N*/ pOldFmt = nVersion<SWG_INETBROWSER ? aOldDateFmt30
+/*N*/ : aOldDateFmt40;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TIMEFLD:
+/*?*/ case RES_FIXTIMEFLD:
+/*?*/ if( nVersion < SWG_NEWFIELDS )
+/*?*/ {
+/*?*/ rSubType = TIMEFLD;
+/*?*/ if( RES_FIXTIMEFLD == rWhich )
+/*?*/ rSubType |= FIXEDFLD;
+/*?*/ rWhich = RES_DATETIMEFLD;
+/*?*/ pOldFmt = aOldTimeFmt;
+/*?*/ }
+/*?*/ break;
+/*N*/
+/*N*/ case RES_DBFLD:
+/*N*/ if( nVersion < SWG_NEWFIELDS )
+/*N*/ {
+/*N*/ rSubType = SUB_OWN_FMT;
+/*N*/ pOldFmt = nVersion<SWG_INETBROWSER ? aOldGetSetExpFmt30
+/*N*/ : aOldGetSetExpFmt40;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TABLEFLD:
+/*N*/ case RES_GETEXPFLD:
+/*N*/ case RES_SETEXPFLD:
+/*N*/ case RES_USERFLD:
+/*N*/ if( nVersion < SWG_NEWFIELDS )
+/*N*/ {
+/*N*/ if( rFmt == VVF_INVISIBLE )
+/*N*/ {
+/*N*/ rSubType = SUB_INVISIBLE;
+/*N*/ rFmt = 0;
+/*N*/ }
+/*N*/ else if( rFmt == VVF_CMD )
+/*N*/ {
+/*N*/ rSubType = SUB_CMD;
+/*N*/ rFmt = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Kleiner Hack: Bei Numernkreisen wird das
+/*N*/ // unkonvertierte Format noch benoetigt. Wir merken es
+/*N*/ // uns voruebergehend mal im Subtyp, sofern es
+/*N*/ // ueberhaupt als entsprechendes Format in Frage kommt.
+/*N*/ if( RES_SETEXPFLD==rWhich &&
+/*N*/ rFmt >= (USHORT)SVX_NUM_CHARS_UPPER_LETTER &&
+/*N*/ rFmt <= (USHORT)SVX_NUM_BITMAP )
+/*N*/ {
+/*N*/ rSubType = (USHORT)rFmt;
+/*N*/ }
+/*N*/ pOldFmt = nVersion<SWG_INETBROWSER ? aOldGetSetExpFmt30
+/*N*/ : aOldGetSetExpFmt40;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_DOCINFOFLD:
+/*N*/ if( nVersion < SWG_NEWFIELDS )
+/*N*/ {
+/*N*/ switch( rFmt )
+/*N*/ {
+/*N*/ case RF_AUTHOR: rSubType = DI_SUB_AUTHOR; break;
+/*N*/ case RF_TIME: rSubType = DI_SUB_TIME; break;
+/*N*/ case RF_DATE: rSubType = DI_SUB_DATE; break;
+/*N*/ case RF_ALL: rSubType = DI_SUB_DATE; break;
+/*N*/ }
+/*N*/ rFmt = 0;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pOldFmt )
+/*N*/ {
+/*N*/ SvNumberFormatter *pFormatter = rDoc.GetNumberFormatter();
+/*N*/ USHORT i = 0;
+/*N*/
+/*N*/ while( pOldFmt[i].eFormatIdx != NF_NUMERIC_START ||
+/*N*/ pOldFmt[i].nOldFormat)
+/*N*/ {
+/*N*/ if( rFmt == pOldFmt[i].nOldFormat )
+/*N*/ {
+/*N*/ rFmt = pFormatter->GetFormatIndex(pOldFmt[i].eFormatIdx, LANGUAGE_SYSTEM);
+/*N*/ break;
+/*N*/ }
+/*N*/ i++;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void sw3io_ConvertToOldField( const SwField* pFld, USHORT& rWhich,
+/*N*/ UINT32& rFmt, ULONG nFFVersion )
+/*N*/ {
+/*N*/ const OldFormats *pOldFmt = 0L;
+/*N*/ UINT32 nOldFmt = rFmt;
+/*N*/
+/*N*/ switch( rWhich )
+/*N*/ {
+/*N*/ case RES_DOCINFOFLD:
+/*N*/ if( SOFFICE_FILEFORMAT_40 >= nFFVersion )
+/*N*/ {
+/*N*/ switch (pFld->GetSubType() & 0xff00)
+/*N*/ {
+/*N*/ case DI_SUB_AUTHOR: rFmt = RF_AUTHOR; break;
+/*N*/ case DI_SUB_TIME: rFmt = RF_TIME; break;
+/*N*/ case DI_SUB_DATE: rFmt = RF_DATE; break;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DATETIMEFLD:
+/*N*/ if( SOFFICE_FILEFORMAT_40 >= nFFVersion )
+/*N*/ {
+/*N*/ USHORT nSubType = ((SwDateTimeField*) pFld)->GetSubType();
+/*N*/ switch( nSubType )
+/*N*/ {
+/*N*/ case DATEFLD: rWhich = RES_DATEFLD; break;
+/*N*/ case TIMEFLD: rWhich = RES_TIMEFLD; break;
+/*N*/ case DATEFLD|FIXEDFLD: rWhich = RES_FIXDATEFLD; break;
+/*N*/ case TIMEFLD|FIXEDFLD: rWhich = RES_FIXTIMEFLD; break;
+/*N*/ }
+/*N*/
+/*N*/ if( nSubType & DATEFLD )
+/*N*/ {
+/*N*/ rFmt = DFF_DMY;
+/*N*/ pOldFmt = aOldDateFmt40;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rFmt = TF_SYSTEM;
+/*N*/ pOldFmt = aOldTimeFmt;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DBFLD:
+/*N*/ case RES_TABLEFLD:
+/*N*/ case RES_GETEXPFLD:
+/*N*/ case RES_SETEXPFLD:
+/*N*/ case RES_USERFLD:
+/*N*/ if( SOFFICE_FILEFORMAT_40 >= nFFVersion )
+/*N*/ {
+/*N*/ USHORT nSubType = pFld->GetSubType();
+/*N*/
+/*N*/ if (nSubType & SUB_INVISIBLE)
+/*N*/ rFmt = VVF_INVISIBLE;
+/*N*/ else if (nSubType & SUB_CMD)
+/*N*/ rFmt = VVF_CMD;
+/*N*/ else if( !(GSE_SEQ & nSubType) )
+/*N*/ {
+/*N*/ pOldFmt = aOldGetSetExpFmt40;
+/*N*/ rFmt = VVF_SYS;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_GETREFFLD:
+/*N*/ if( SOFFICE_FILEFORMAT_31 == nFFVersion )
+/*N*/ {
+/*N*/ switch( rFmt )
+/*N*/ {
+/*N*/ case REF_PAGE:
+/*N*/ case REF_CHAPTER:
+/*N*/ case REF_CONTENT:
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ // case REF_UPDOWN:
+/*N*/ // case REF_PAGE_PGDESC:
+/*N*/ rFmt = REF_PAGE;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pOldFmt && nOldFmt )
+/*N*/ {
+/*N*/ USHORT i = 0;
+/*N*/
+/*N*/ SvNumberFormatter *pFormatter = ((SwValueField*)pFld)->GetDoc()->GetNumberFormatter();
+/*N*/ const SvNumberformat* pEntry = pFormatter->GetEntry( nOldFmt );
+/*N*/
+/*N*/ if( pEntry )
+/*N*/ {
+/*N*/ while( pOldFmt[i].eFormatIdx != NF_NUMERIC_START ||
+/*N*/ pOldFmt[i].nOldFormat )
+/*N*/ {
+/*N*/ sal_uInt32 nKey = pFormatter->GetFormatIndex(
+/*N*/ pOldFmt[i].eFormatIdx, pEntry->GetLanguage() );
+/*N*/
+/*N*/ if( nOldFmt == nKey )
+/*N*/ {
+/*N*/ rFmt = pOldFmt[i].nOldFormat;
+/*N*/ break;
+/*N*/ }
+/*N*/ i++;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_sw3io_FillSetExpFieldName( Sw3IoImp& rIo, USHORT nStrId,
+/*N*/ String& rName )
+/*N*/ {
+/*N*/ USHORT nPoolId = rIo.aStringPool.FindPoolId( nStrId );
+/*N*/ USHORT nResId = USHRT_MAX;
+/*N*/ switch( nPoolId )
+/*N*/ {
+/*N*/ case RES_POOLCOLL_LABEL_ABB:
+/*N*/ nResId = STR_POOLCOLL_LABEL_ABB;
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_LABEL_TABLE:
+/*N*/ nResId = STR_POOLCOLL_LABEL_TABLE;
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_LABEL_FRAME:
+/*N*/ nResId = STR_POOLCOLL_LABEL_FRAME;
+/*N*/ break;
+/*N*/ case RES_POOLCOLL_LABEL_DRAWING:
+/*N*/ nResId = STR_POOLCOLL_LABEL_DRAWING;
+/*N*/ break;
+/*N*/ }
+/*N*/ if( nResId != USHRT_MAX )
+/*N*/ rName = SW_RESSTR( nResId );
+/*N*/ else
+/*N*/ rName = rIo.aStringPool.Find( nStrId );
+/*N*/ }
+
+/*N*/ USHORT lcl_sw3io_GetSetExpFieldPoolId( const String& rName )
+/*N*/ {
+/*N*/ if( rName == String( SW_RES(STR_POOLCOLL_LABEL_ABB) ) )
+/*N*/ return RES_POOLCOLL_LABEL_ABB;
+/*N*/ else if( rName == String( SW_RES(STR_POOLCOLL_LABEL_TABLE) ) )
+/*N*/ return RES_POOLCOLL_LABEL_TABLE;
+/*N*/ else if( rName == String( SW_RES(STR_POOLCOLL_LABEL_FRAME) ) )
+/*N*/ return RES_POOLCOLL_LABEL_FRAME;
+/*N*/ else if( rName == String( SW_RES(STR_POOLCOLL_LABEL_DRAWING) ) )
+/*N*/ return RES_POOLCOLL_LABEL_DRAWING;
+/*N*/ else
+/*N*/ return USHRT_MAX;
+/*N*/ }
+
+/* */
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Ausgabe der Feldtypen
+
+/*N*/ SwDBFieldType* lcl_sw3io_InDBFieldType( Sw3IoImp& rIo )
+/*N*/ {
+/*N*/ String aText, aDBName;
+/*N*/
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*?*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aText = rIo.aStringPool.Find( nPoolId );
+/*N*/ if( rIo.IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aDBName = rIo.aStringPool.Find( nPoolId );
+/*N*/ }
+/*N*/ }
+/*N*/ if( !aText.Len() && !aDBName.Len() )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = aDBName.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = aDBName.GetToken(1, DB_DELIM);
+/*N*/ SwDBFieldType aType( rIo.pDoc, aText, aData );
+/*N*/ return (SwDBFieldType*) rIo.pDoc->InsertFldType( aType );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDBFieldType( Sw3IoImp& rIo, SwDBFieldType* pType )
+/*N*/ {
+/*N*/ *rIo.pStrm << (UINT16) rIo.aStringPool.Find( pType->GetColumnName(), USHRT_MAX );
+/*N*/
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ SwDBData aData = pType->GetDBData();
+/*N*/ String sDBName(aData.sDataSource);
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ *rIo.pStrm << (UINT16) rIo.aStringPool.Find( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwUserFieldType* lcl_sw3io_InUserFieldType40( Sw3IoImp& rIo )
+/*N*/ {
+/*N*/ String aName, aContent, aValue;
+/*N*/ UINT16 nType;
+/*N*/
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*?*/ rIo.InString( *rIo.pStrm, aName );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aName = rIo.aStringPool.Find( nPoolId );
+/*N*/ if( !aName.Len() )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ rIo.InString( *rIo.pStrm, aContent );
+/*N*/ rIo.InString( *rIo.pStrm, aValue );
+/*N*/ *rIo.pStrm >> nType;
+/*N*/ SwUserFieldType* p = (SwUserFieldType*) rIo.pDoc->InsertFldType(
+/*N*/ SwUserFieldType( rIo.pDoc, aName ) );
+/*N*/ //JP 07.04.97: beim Einfuegen darf an bestehenden FeldType nichts
+/*N*/ // veraendert werden
+/*N*/ if( rIo.bInsert && p->GetDepends() )
+/*N*/ return p;
+/*N*/
+/*N*/ p->SetContent( aContent );
+/*N*/ sal_Char* dummy;
+/*N*/ ByteString sTmp( aValue, RTL_TEXTENCODING_ASCII_US );
+/*N*/ p->SetValue( strtod( sTmp.GetBuffer(), &dummy ) );
+/*N*/ if( !nType )
+/*N*/ nType = GSE_STRING;
+/*N*/ p->SetType( nType );
+/*N*/ return p;
+/*N*/ }
+
+/*N*/ SwUserFieldType* lcl_sw3io_InUserFieldType( Sw3IoImp& rIo )
+/*N*/ {
+/*N*/ String aName, aContent;
+/*N*/ double dVal;
+/*N*/ UINT16 nType;
+/*N*/
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aName = rIo.aStringPool.Find( nPoolId );
+/*N*/ if( !aName.Len() )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ rIo.InString( *rIo.pStrm, aContent );
+/*N*/ *rIo.pStrm >> dVal >> nType;
+/*N*/ SwUserFieldType* p = (SwUserFieldType*) rIo.pDoc->InsertFldType(
+/*N*/ SwUserFieldType( rIo.pDoc, aName ) );
+/*N*/ //JP 07.04.97: beim Einfuegen darf an bestehenden FeldType nichts
+/*N*/ // veraendert werden
+/*N*/ if( rIo.bInsert && p->GetDepends() )
+/*N*/ return p;
+/*N*/
+/*N*/ p->SetContent( aContent );
+/*N*/ p->SetValue( dVal );
+/*N*/ if( !nType )
+/*N*/ nType = GSE_STRING;
+/*N*/ p->SetType( nType );
+/*N*/ return p;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutUserFieldType40( Sw3IoImp& rIo, SwUserFieldType* pType )
+/*N*/ {
+/*N*/ String aValue(String::CreateFromDouble(pType->GetValue()));
+/*N*/ *rIo.pStrm << (UINT16) rIo.aStringPool.Find( pType->GetName(), USHRT_MAX );
+/*N*/ rIo.OutString( *rIo.pStrm, pType->GetContent() );
+/*N*/ rIo.OutString( *rIo.pStrm, aValue );
+/*N*/ *rIo.pStrm << (UINT16) pType->GetType();
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutUserFieldType( Sw3IoImp& rIo, SwUserFieldType* pType )
+/*N*/ {
+/*N*/ *rIo.pStrm << (UINT16) rIo.aStringPool.Find( pType->GetName(), USHRT_MAX );
+/*N*/ rIo.OutString( *rIo.pStrm, pType->GetContent() );
+/*N*/ *rIo.pStrm << (double)pType->GetValue()
+/*N*/ << (UINT16) pType->GetType();
+/*N*/ }
+
+/* */
+
+/*N*/ SwDDEFieldType* lcl_sw3io_InDDEFieldType( Sw3IoImp& rIo )
+/*N*/ {
+/*N*/ UINT16 nType;
+/*N*/ String aName, aCmd;
+/*N*/
+/*N*/ *rIo.pStrm >> nType;
+/*N*/
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*?*/ rIo.InString( *rIo.pStrm, aName );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aName = rIo.aStringPool.Find( nPoolId );
+/*N*/ if( !aName.Len() )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ ByteString s8;
+/*N*/ rIo.pStrm->ReadByteString( s8 );
+/*N*/ sal_Char cSrch = rIo.nVersion < SWG_DDESEP ? ' ' : ::binfilter::cTokenSeperator;
+/*N*/
+/*N*/ {
+/*N*/ // die ersten beiden Blanks gegen den neuen Trenner austauschen
+/*N*/ xub_StrLen nFnd = s8.Search( cSrch );
+/*N*/ aCmd = String( s8, 0, nFnd, rIo.eSrcSet );
+/*N*/ if( STRING_NOTFOUND != nFnd++ )
+/*N*/ {
+/*N*/ xub_StrLen nFnd2 = s8.Search( cSrch, nFnd );
+/*N*/ ( aCmd += ::binfilter::cTokenSeperator) +=
+/*N*/ String( s8, nFnd, nFnd2 - nFnd, rIo.eSrcSet );
+/*N*/ if( STRING_NOTFOUND != nFnd2++ )
+/*N*/ ( aCmd += ::binfilter::cTokenSeperator) +=
+/*N*/ String( s8, nFnd2, aCmd.Len() - nFnd2, rIo.eSrcSet );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // JP 15.08.00: our dialog have set the wrong format id's
+/*N*/ if( ::binfilter::LINKUPDATE_ALWAYS != nType && ::binfilter::LINKUPDATE_ONCALL != nType )
+/*?*/ nType = ::binfilter::LINKUPDATE_ONCALL;
+/*N*/
+/*N*/ SwDDEFieldType aType( aName, aCmd, nType );
+/*N*/ return (SwDDEFieldType*) rIo.pDoc->InsertFldType( aType );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDDEFieldType( Sw3IoImp& rIo, SwDDEFieldType* pType )
+/*N*/ {
+/*N*/ *rIo.pStrm << (USHORT) pType->GetType()
+/*N*/ << (UINT16) rIo.aStringPool.Find( pType->GetName(), USHRT_MAX );
+/*N*/ ByteString s8 = rIo.ConvertStringNoDelim( pType->GetCmd(),
+/*N*/ ::binfilter::cTokenSeperator, '\xff', rIo.eSrcSet );
+/*N*/ rIo.pStrm->WriteByteString( s8 );
+/*N*/ }
+
+/*N*/ SwSetExpFieldType* lcl_sw3io_InSetExpFieldType( Sw3IoImp& rIo )
+/*N*/ {
+/*N*/ UINT16 nType;
+/*N*/ String aName;
+/*N*/
+/*N*/ *rIo.pStrm >> nType;
+/*N*/
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*?*/ rIo.InString( *rIo.pStrm, aName );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ lcl_sw3io_FillSetExpFieldName( rIo, nPoolId, aName );
+/*N*/ if( !aName.Len() )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ USHORT nFldTypeCount = rIo.pDoc->GetFldTypes()->Count();
+/*N*/ SwSetExpFieldType* pFldType = (SwSetExpFieldType*) rIo.pDoc->
+/*N*/ InsertFldType( SwSetExpFieldType( rIo.pDoc, aName, nType ));
+/*N*/
+/*N*/ if( SWG_SETEXPFLDCHG <= rIo.nVersion && GSE_SEQ & nType )
+/*N*/ {
+/*N*/ BYTE cDelim, nLevel;
+/*N*/ *rIo.pStrm >> cDelim >> nLevel;
+/*N*/
+/*N*/ //JP 17.06.98: nicht setzen, wenn es ein Standard FeldType ist und
+/*N*/ // man am Einfuegen ist.
+/*N*/ if( !rIo.bInsert ||
+/*N*/ nFldTypeCount != rIo.pDoc->GetFldTypes()->Count() )
+/*N*/ {
+/*N*/ pFldType->SetDelimiter( ByteString::ConvertToUnicode( cDelim,
+/*N*/ rIo.eSrcSet));
+/*N*/ pFldType->SetOutlineLvl( nLevel );
+/*N*/ }
+/*N*/ }
+/*N*/ return pFldType;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutSetExpFieldType( Sw3IoImp& rIo, SwSetExpFieldType* pType )
+/*N*/ {
+/*N*/ const String& rNm = pType->GetSetRefName();
+/*N*/
+/*N*/ *rIo.pStrm << (UINT16) pType->GetType()
+/*N*/ << (UINT16) rIo.aStringPool.Find( rNm,
+/*N*/ lcl_sw3io_GetSetExpFieldPoolId( rNm ) );
+/*N*/
+/*N*/ if( !rIo.IsSw31Or40Export() && GSE_SEQ & pType->GetType() )
+/*N*/ {
+/*N*/ sal_Char cDelim = ByteString::ConvertFromUnicode( pType->GetDelimiter(),
+/*N*/ rIo.eSrcSet );
+/*N*/ *rIo.pStrm << (BYTE)cDelim
+/*N*/ << (BYTE)pType->GetOutlineLvl();
+/*N*/ }
+/*N*/ }
+
+SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
+{
+ SwAuthorityFieldType* pFldType = (SwAuthorityFieldType*) rIo.pDoc->
+ InsertFldType( SwAuthorityFieldType(rIo.pDoc) );
+
+ UINT16 nCount, nSortCount;
+ BYTE cPrefix, cSuffix;
+ BYTE cFlags = rIo.OpenFlagRec();
+ *rIo.pStrm >> nCount
+ >> cPrefix
+ >> cSuffix
+ >> nSortCount;
+ rIo.CloseFlagRec();
+ if( 0 == pFldType->GetEntryCount() || (rIo.bNormal && !rIo.bInsert) )
+ {
+ pFldType->SetPreSuffix( ByteString::ConvertToUnicode( cPrefix,
+ rIo.eSrcSet ),
+ ByteString::ConvertToUnicode( cSuffix,
+ rIo.eSrcSet ) );
+ pFldType->SetSequence( (cFlags & 0x10) != 0 );
+ pFldType->SetSortByDocument( (cFlags & 0x20) != 0);
+ }
+
+ ASSERT( !rIo.pAuthorityMap, "authority map is already existing" );
+ if( nCount > 0 )
+ rIo.pAuthorityMap = new SvUShorts;
+
+ USHORT i;
+ for( i=0; i<nCount; i++ )
+ {
+ rIo.OpenRec( SWG_AUTHORITY_ENTRY_LCL );
+
+ SwAuthEntry aEntry;
+
+ while( rIo.BytesLeft() )
+ {
+ UINT16 nPos;
+ String sEntry;
+ *rIo.pStrm >> nPos;
+ rIo.InString( *rIo.pStrm, sEntry );
+
+ aEntry.SetAuthorField( (ToxAuthorityField)nPos, sEntry );
+ }
+
+ USHORT nNewPos = pFldType->AppendField( aEntry );
+ ASSERT( !rIo.bNormal || rIo.bInsert || nNewPos == i,
+ "unexpected authority entry position" );
+ rIo.pAuthorityMap->Insert( nNewPos, rIo.pAuthorityMap->Count() );
+
+ rIo.CloseRec( SWG_AUTHORITY_ENTRY_LCL );
+ }
+ SwTOXSortKey* pSortKeys = nSortCount ? new SwTOXSortKey[nSortCount] : 0;
+ for( i=0; i<nSortCount; i++ )
+ {
+ BYTE cFlag;
+ UINT16 nType;
+ *rIo.pStrm >> cFlag
+ >> nType;
+ pSortKeys[i].bSortAscending = 0 != (cFlag & 0x01);
+ pSortKeys[i].eField = (ToxAuthorityField)nType;
+ }
+ pFldType->SetSortKeys(nSortCount, pSortKeys);
+ delete pSortKeys;
+
+ return pFldType;
+}
+
+/*N*/ void lcl_sw3io_OutAuthorityFieldType( Sw3IoImp& rIo,
+/*N*/ SwAuthorityFieldType *pType )
+/*N*/ {
+/*?*/ BYTE cFlags = 0x06;
+/*?*/ if( pType->IsSequence() )
+/*?*/ cFlags |= 0x10;
+/*?*/ if( pType->IsSortByDocument() )
+/*?*/ cFlags|= 0x20;
+/*?*/
+/*?*/ USHORT nCount = pType->GetEntryCount();
+/*?*/ *rIo.pStrm << cFlags
+/*?*/ << (UINT16)nCount
+/*?*/ << (BYTE)ByteString::ConvertFromUnicode( pType->GetPrefix(),
+/*?*/ rIo.eSrcSet )
+/*?*/ << (BYTE)ByteString::ConvertFromUnicode( pType->GetSuffix(),
+/*?*/ rIo.eSrcSet )
+/*?*/ << (UINT16)pType->GetSortKeyCount();
+/*?*/
+/*?*/ USHORT i;
+/*?*/ for( i=0; i<nCount; i++ )
+/*?*/ {
+/*?*/ const SwAuthEntry *pEntry = pType->GetEntryByPosition( i );
+/*?*/ rIo.OpenRec( SWG_AUTHORITY_ENTRY_LCL );
+/*?*/
+/*?*/ USHORT nPos = 0;
+/*?*/ String sEntry;
+/*?*/ BOOL bHasEntry = pEntry->GetFirstAuthorField( nPos, sEntry );
+/*?*/ while( bHasEntry )
+/*?*/ {
+/*?*/ *rIo.pStrm << (UINT16)nPos;
+/*?*/ rIo.OutString(*rIo.pStrm, sEntry );
+/*?*/ bHasEntry = pEntry->GetNextAuthorField( nPos, sEntry );
+/*?*/ }
+/*?*/
+/*?*/ rIo.CloseRec( SWG_AUTHORITY_ENTRY_LCL );
+/*?*/ }
+/*?*/ for( i=0; i < pType->GetSortKeyCount(); i++ )
+/*?*/ {
+/*?*/ const SwTOXSortKey* pKey = pType->GetSortKey(i);
+/*?*/ *rIo.pStrm << (BYTE)(pKey->bSortAscending ? 0X01 : 0x00)
+/*?*/ << (UINT16)pKey->eField;
+/*?*/ }
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDBField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ pType = 0;
+/*N*/ String aName;
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*?*/ pType = lcl_sw3io_InDBFieldType( rIo );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aName = rIo.aStringPool.Find(nPoolId);
+/*N*/ }
+/*N*/
+/*N*/ String aExpand;
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ BYTE cFlag = 0;
+/*N*/ if( rIo.nVersion >= SWG_SHORTFIELDS )
+/*N*/ *rIo.pStrm >> cFlag;
+/*N*/
+/*N*/ if( rIo.IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*?*/ USHORT nPoolId;
+/*?*/ *rIo.pStrm >> nPoolId;
+/*?*/ String aDBName( rIo.aStringPool.Find( nPoolId ) );
+/*?*/ if (aDBName.Len())
+/*?*/ {
+/*?*/ aDBName += DB_DELIM;
+/*?*/ aDBName += aName;
+/*?*/ aName = aDBName;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( aName.Len() )
+/*N*/ pType = rIo.pDoc->GetFldType( RES_DBFLD, aName);
+/*N*/
+/*N*/ if( !pType )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwDBField* pFld = new SwDBField( (SwDBFieldType *)pType, rFmt );
+/*N*/ pFld->SetSubType(nSubType);
+/*N*/
+/*N*/ if( rIo.nVersion >= SWG_SHORTFIELDS && (0x01 & cFlag) )
+/*N*/ {
+ sal_Char* dummy;
+/*?*/ ByteString sTmp( aExpand, RTL_TEXTENCODING_ASCII_US );
+/*?*/ pFld->ChgValue( strtod( sTmp.GetBuffer(), &dummy ), TRUE );
+/*N*/ }
+/*N*/ else
+/*N*/ pFld->InitContent( aExpand );
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDBField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ pType = 0;
+/*N*/ String aExpand;
+/*N*/ UINT16 nColNamePoolId, nDBNamePoolId;
+/*N*/ BYTE cFlag;
+/*N*/ *rIo.pStrm >> cFlag >> nColNamePoolId >> nDBNamePoolId;
+/*N*/
+/*N*/ String aColName( rIo.aStringPool.Find( nColNamePoolId ) );
+/*N*/ String aDBName( rIo.aStringPool.Find( nDBNamePoolId ) );
+/*N*/ if (aDBName.Len())
+/*N*/ {
+/*N*/ aDBName += DB_DELIM;
+/*N*/ aDBName += aColName;
+/*N*/ aColName = aDBName;
+/*N*/ }
+/*N*/
+/*N*/ if( aColName.Len() )
+/*N*/ pType = rIo.pDoc->GetFldType( RES_DBFLD, aColName );
+/*N*/
+/*N*/ if( !pType )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwDBField* pFld = new SwDBField( (SwDBFieldType *)pType, rFmt );
+/*N*/ pFld->SetSubType(nSubType);
+/*N*/
+/*N*/ if( 0x01 & cFlag )
+/*N*/ {
+/*?*/ double dVal;
+/*?*/ *rIo.pStrm >> dVal;
+/*?*/ pFld->ChgValue( dVal, TRUE );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ String aExpand;
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ pFld->InitContent( aExpand );
+/*N*/ }
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDBField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ BYTE cFlag = 0;
+/*N*/ String sTxt( ((SwDBField *)pFld)->GetOldContent() );
+/*N*/ if( ((SwDBField *)pFld)->IsValidValue() )
+/*N*/ {
+/*?*/ cFlag = 0x01;
+/*?*/ ByteString sValue(ByteString::CreateFromDouble(((SwDBField *)pFld)->GetValue()));
+/*?*/ sTxt.AssignAscii( sValue.GetBuffer() );
+/*N*/ }
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find( ((SwDBFieldType *)pFld->GetTyp())->GetColumnName(), USHRT_MAX );
+/*N*/ rIo.OutString( *rIo.pStrm, sTxt );
+/*N*/ *rIo.pStrm << cFlag;
+/*N*/
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ SwDBData aData = ((SwDBFieldType *)pFld->GetTyp())->GetDBData();
+/*N*/ String sDBName;
+/*N*/ if(aData.sDataSource.getLength() || aData.sCommand.getLength())
+/*N*/ {
+/*?*/ sDBName = aData.sDataSource;
+/*?*/ sDBName += DB_DELIM;
+/*?*/ sDBName += (String)aData.sCommand;
+/*N*/ }
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDBField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ BYTE cFlag = ((SwDBField *)pFld)->IsValidValue() ? 0x01 : 0x00;
+/*N*/ SwDBData aData = ((SwDBFieldType *)pFld->GetTyp())->GetDBData();
+/*N*/ String sDBName;
+/*N*/ if(aData.sDataSource.getLength() || aData.sCommand.getLength())
+/*N*/ {
+/*N*/ sDBName = aData.sDataSource;
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ }
+/*N*/
+/*N*/ *rIo.pStrm << cFlag
+/*N*/ << (UINT16)rIo.aStringPool.Find(
+/*N*/ ((SwDBFieldType *)pFld->GetTyp())->GetColumnName(),
+/*N*/ USHRT_MAX )
+/*N*/ << (UINT16)rIo.aStringPool.Find(
+/*N*/ sDBName,
+/*N*/ IDX_NOCONV_FF );
+/*N*/
+/*N*/ if( ((SwDBField *)pFld)->IsValidValue() )
+/*N*/ {
+/*?*/ *rIo.pStrm << (double)((SwDBField *)pFld)->GetValue();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwDBField *)pFld)->GetOldContent() );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InFileNameField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& rFmt )
+/*N*/ {
+/*N*/ // Das fixe Feld gibt es erst in der 5.1. Da das Fileformat zur 5.0
+/*N*/ // kompatibel geblieben ist und die 5.0 das Fixed-Flag nicht loescht,
+/*N*/ // kann es auch mal in einer aelteren Datei gesetzt sein.
+/*N*/ if( !rIo.IsVersion(SWG_FIXEDFNFLD) && (rFmt & FF_FIXED) != 0 )
+/*?*/ rFmt = (rFmt & ~FF_FIXED);
+/*N*/
+/*N*/ SwFileNameField *pFld =
+/*N*/ new SwFileNameField( (SwFileNameFieldType *)pType );
+/*N*/ if( (rFmt & FF_FIXED) != 0 )
+/*N*/ {
+/*?*/ String aContent;
+/*?*/ rIo.InString( *rIo.pStrm, aContent );
+/*?*/ pFld->SetExpansion( aContent );
+/*N*/ }
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+// Wird for 4.0-Export gar nicht erst aufgerufen!
+/*N*/ void lcl_sw3io_OutFileNameField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ if( ((SwFileNameField *)pFld)->IsFixed() )
+/*?*/ rIo.OutString( *rIo.pStrm, ((SwFileNameField *)pFld)->GetContent() );
+/*N*/ }
+
+/* */
+
+/*N*/ SwField* lcl_sw3io_InDBNameField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ String aDBName;
+/*N*/ if( rIo.IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aDBName = rIo.aStringPool.Find( nPoolId );
+/*N*/ }
+/*N*/
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = aDBName.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = aDBName.GetToken(1, DB_DELIM);
+/*N*/ return new SwDBNameField( (SwDBNameFieldType *)pType, aData );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDBNameField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ SwDBData aData(((SwDBNameField*)pFld)->GetRealDBData());
+/*N*/ String sDBName(aData.sDataSource);
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDateField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ { //SW40.SDW
+/*N*/ SwDateTimeField* pFld =
+/*N*/ new SwDateTimeField( (SwDateTimeFieldType *)pType, DATEFLD );
+/*N*/ pFld->SetSubType(nSubType);
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InTimeField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+ SwDateTimeField* pFld =
+ new SwDateTimeField( (SwDateTimeFieldType*)pType, TIMEFLD );
+ pFld->SetSubType(nSubType);
+
+ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InPageNumberField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& rFmt )
+/*N*/ {
+/*N*/ INT16 nOff;
+/*N*/ UINT16 nSub;
+/*N*/ *rIo.pStrm >> nOff >> nSub;
+/*N*/ String sUserStr;
+/*N*/ if( rIo.nVersion >= SWG_OLENAME )
+/*N*/ {
+/*N*/ rIo.InString( *rIo.pStrm, sUserStr );
+/*N*/ if( rIo.IsVersion( SWG_NEXTPREVPAGE, SWG_EXPORT31 ) &&
+/*N*/ ( PG_NEXT == nSub || PG_PREV == nSub ))
+/*?*/ *rIo.pStrm >> nOff;
+/*N*/ }
+/*N*/
+/*N*/ SwPageNumberField* pFld =
+/*N*/ new SwPageNumberField( (SwPageNumberFieldType*)pType, nSub, rFmt, nOff );
+/*N*/ if( sUserStr.Len() )
+/*?*/ pFld->SetUserString( sUserStr );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InPageNumberField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ INT16 nOff;
+/*N*/ String sUserStr;
+/*N*/ *rIo.pStrm >> nOff;
+/*N*/ rIo.InString( *rIo.pStrm, sUserStr );
+/*N*/
+/*N*/ SwPageNumberField* pFld =
+/*N*/ new SwPageNumberField( (SwPageNumberFieldType*)pType, nSubType,
+/*N*/ rFmt, (short)nOff );
+/*N*/ if( sUserStr.Len() )
+/*?*/ pFld->SetUserString( sUserStr );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutPageNumberField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ INT16 nOff = (INT16)pFld->GetPar2().ToInt32();
+/*N*/ UINT16 nSub = pFld->GetSubType();
+/*N*/
+/*N*/ if( rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ if( PG_NEXT == nSub )
+/*N*/ nOff = 1;
+/*N*/ else if( PG_PREV == nSub )
+/*N*/ nOff = -1;
+/*N*/ }
+/*N*/
+/*N*/ *rIo.pStrm << nOff
+/*N*/ << nSub;
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwPageNumberField*)pFld)->GetUserString() );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutPageNumberField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ // nur Offset, deshalb kein long noetig!
+/*N*/ INT16 nOff = (INT16)pFld->GetPar2().ToInt32();
+/*N*/ *rIo.pStrm << nOff;
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwPageNumberField*)pFld)->GetUserString() );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InUserField40( Sw3IoImp& rIo, SwFieldType *pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ pType = 0;
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*?*/ pType = lcl_sw3io_InUserFieldType40( rIo );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ pType = rIo.pDoc->GetFldType( RES_USERFLD,
+/*N*/ rIo.aStringPool.Find(nPoolId));
+/*N*/ if( !pType )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ }
+/*N*/ SwUserField* pFld = new SwUserField( (SwUserFieldType *)pType );
+/*N*/
+/*N*/ USHORT nType = ((SwUserFieldType *)pType)->GetType();
+/*N*/ nSubType |= nType;
+/*N*/ if( UF_STRING & nType )
+/*N*/ rFmt = 0; // Warum auch immer!
+/*N*/
+/*N*/ pFld->SetSubType(nSubType);
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InUserField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ pType = 0;
+/*N*/
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ pType = rIo.pDoc->GetFldType( RES_USERFLD,
+/*N*/ rIo.aStringPool.Find(nPoolId));
+/*N*/ if( !pType )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwUserField* pFld = new SwUserField( (SwUserFieldType *)pType );
+/*N*/ pFld->SetSubType( nSubType );
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutUserField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find(
+/*N*/ ((SwUserField*)pFld)->GetTyp()->GetName(), USHRT_MAX );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InGetRefField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& rFmt )
+/*N*/ {
+/*N*/ String aName, aExpand;
+/*N*/ UINT16 nFmt16 = 0, nSubType, nSeqNo;
+/*N*/
+/*N*/ rIo.InString( *rIo.pStrm, aName );
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ if( rIo.IsVersion( SWG_FMTGETREFFLD, SWG_EXPORT31 ) )
+/*N*/ {
+/*N*/ *rIo.pStrm >> nFmt16 >> nSubType >> nSeqNo;
+/*N*/ rFmt = nFmt16;
+/*N*/ }
+/*N*/ else if( rIo.IsVersion( SWG_DESKTOP40 ) )
+/*N*/ {
+/*?*/ *rIo.pStrm >> nSubType >> nSeqNo;
+/*N*/ }
+/*N*/ else
+/*N*/ nSubType = nSeqNo = 0;
+/*N*/
+/*N*/ SwGetRefField* pFld = new SwGetRefField( (SwGetRefFieldType*)pType,
+/*N*/ aName, nSubType,
+/*N*/ nSeqNo, rFmt );
+/*N*/ pFld->SetExpand( aExpand );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InGetRefField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ String aName, aExpand;
+/*N*/ UINT16 nFmt = 0, nSeqNo;
+/*N*/
+/*N*/ rIo.InString( *rIo.pStrm, aName );
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ *rIo.pStrm >> nSeqNo;
+/*N*/
+/*N*/ SwGetRefField* pFld = new SwGetRefField( (SwGetRefFieldType*)pType,
+/*N*/ aName, nSubType,
+/*N*/ nSeqNo, nFmt );
+/*N*/ pFld->SetExpand( aExpand );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutGetRefField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwGetRefField*)pFld)->GetSetRefName() );
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->Expand() );
+/*N*/
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ *rIo.pStrm << (UINT16)pFld->GetSubType()
+/*N*/ << (UINT16)((SwGetRefField*)pFld)->GetSeqNo();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutGetRefField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwGetRefField*)pFld)->GetSetRefName() );
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->Expand() );
+/*N*/ *rIo.pStrm << (UINT16)((SwGetRefField*)pFld)->GetSeqNo();
+/*N*/ }
+
+/*N*/ void lcl_sw3io_ChkHiddenExp( String& rCond ) //SW40.SDW
+/*N*/ {
+/*N*/ // die Expression wurde bei 4.0 Export einmal gedreht, beim erneuten
+/*N*/ // Einlesen sollte diese nicht noch mal gedreht werden.
+/*N*/ xub_StrLen nLen = rCond.Len(), nPos = nLen, nCnt = 1;
+/*N*/ if( 3 < nPos-- && ')' == rCond.GetChar( nPos ) &&
+/*N*/ '!' == rCond.GetChar( nPos = 0 ) && '(' == rCond.GetChar( ++nPos ))
+/*N*/ {
+/*N*/ // dann teste mal ob es dann eine komplette Klammerung ist
+/*N*/ --nLen; ++nPos;
+/*N*/ nCnt = 0;
+/*N*/ while( nPos < nLen )
+/*N*/ switch( rCond.GetChar( nPos++ ) )
+/*N*/ {
+/*N*/ case '(': ++nCnt; break;
+/*N*/ case ')': if( !nCnt-- )
+/*N*/ nPos = nLen;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !nCnt )
+/*N*/ rCond = rCond.Copy( 2, rCond.Len() - 3);
+/*N*/ else
+/*N*/ rCond.InsertAscii( "!(", 0 ) += ')';
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InHiddenTxtField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ { //SW40.SDW
+/*N*/ BYTE cFlags;
+/*N*/ USHORT nSubType;
+/*N*/ String aText, aCond;
+/*N*/ *rIo.pStrm >> cFlags;
+/*N*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ rIo.InString( *rIo.pStrm, aCond );
+/*N*/ *rIo.pStrm >> nSubType;
+/*N*/ BOOL bCond = BOOL( ( cFlags & 0x20 ) != 0 );
+/*N*/ BOOL bIsHidden = BOOL( ( cFlags & 0x10 ) != 0 );
+/*N*/
+/*N*/ if( bCond && TYP_CONDTXTFLD != nSubType )
+/*N*/ {
+/*N*/ lcl_sw3io_ChkHiddenExp( aCond );
+/*N*/ bIsHidden = !bIsHidden;
+/*N*/ }
+/*N*/ SwHiddenTxtField* pFld = new SwHiddenTxtField( (SwHiddenTxtFieldType*)pType,
+/*N*/ bCond,
+/*N*/ aEmptyStr, aText,
+/*N*/ bIsHidden, nSubType );
+/*N*/ pFld->SetPar1( aCond );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InHiddenTxtField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ BYTE cFlags;
+/*N*/ String aText, aCond;
+/*N*/ *rIo.pStrm >> cFlags;
+/*N*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ rIo.InString( *rIo.pStrm, aCond );
+/*N*/ BOOL bCond = BOOL( ( cFlags & 0x20 ) != 0 );
+/*N*/
+/*N*/ SwHiddenTxtField* pFld = new SwHiddenTxtField( (SwHiddenTxtFieldType*)pType,
+/*N*/ bCond,
+/*N*/ aEmptyStr, aText,
+/*N*/ BOOL( ( cFlags & 0x10 ) != 0 ), nSubType );
+/*N*/ pFld->SetPar1( aCond );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutHiddenTxtField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ String aText(pFld->GetPar2());
+ BYTE cFlags = ((SwHiddenTxtField*)pFld)->GetValue() ? 0x10 : 0;
+
+ if( ((SwHiddenTxtField*)pFld)->IsValid() )
+ {
+ if( !rIo.IsSw31Export() )
+ {
+ aText = pFld->GetPar2();
+ aText += '|';
+ aText += ((SwHiddenTxtField*)pFld)->GetCntnt();
+ }
+ else
+ {
+ if (((SwHiddenTxtField*)pFld)->GetValue())
+ {
+ aText = ((SwHiddenTxtField*)pFld)->GetPar2().GetToken(0, '|');
+ aText += '|';
+ aText += ((SwHiddenTxtField*)pFld)->GetCntnt();
+ }
+ else
+ {
+ aText = ((SwHiddenTxtField*)pFld)->GetCntnt();
+ aText += '|';
+ aText += pFld->GetPar2().GetToken(1, '|');
+ }
+ }
+ }
+ else
+ aText = pFld->GetPar2();
+
+ if( ((SwHiddenTxtField*)pFld)->IsConditional() )
+ cFlags |= 0x20;
+
+ String sCond( pFld->GetPar1() );
+ USHORT nSubType = pFld->GetSubType();
+ if( 0x20 & cFlags && TYP_CONDTXTFLD != nSubType )
+ {
+ lcl_sw3io_ChkHiddenExp( sCond );
+ if( 0x10 & cFlags )
+ cFlags &= ~0x10;
+ else
+ cFlags |= 0x10;
+ }
+
+ *rIo.pStrm << cFlags;
+ rIo.OutString( *rIo.pStrm, aText ); // text
+ rIo.OutString( *rIo.pStrm, sCond ); // condition
+ *rIo.pStrm << nSubType;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutHiddenTxtField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ String aText(pFld->GetPar2());
+/*N*/ BYTE cFlags = ((SwHiddenTxtField*)pFld)->GetValue() ? 0x10 : 0;
+/*N*/
+/*N*/ if( ((SwHiddenTxtField*)pFld)->IsValid() )
+/*N*/ {
+/*N*/ aText = pFld->GetPar2();
+/*N*/ aText += '|';
+/*N*/ aText += ((SwHiddenTxtField*)pFld)->GetCntnt();
+/*N*/ }
+/*N*/ else
+/*N*/ aText = pFld->GetPar2();
+/*N*/
+/*N*/ if( ((SwHiddenTxtField*)pFld)->IsConditional() )
+/*N*/ cFlags |= 0x20;
+/*N*/ *rIo.pStrm << cFlags;
+/*N*/ rIo.OutString( *rIo.pStrm, aText ); // text
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() ); // condition
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InPostItField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+ INT32 nDate;
+ String aAuthor, aText;
+ *rIo.pStrm >> nDate;
+ rIo.InString( *rIo.pStrm, aAuthor );
+ rIo.InString( *rIo.pStrm, aText );
+ return new SwPostItField( (SwPostItFieldType*)pType, aAuthor, aText, Date( nDate ) );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutPostItField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ Date aDate = ((SwPostItField*)pFld)->GetDate();
+ *rIo.pStrm << (INT32) aDate.GetDate();
+ rIo.OutString( *rIo.pStrm, pFld->GetPar1() ); // Author
+ rIo.OutString( *rIo.pStrm, pFld->GetPar2() ); // Text
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDateTimeField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ double fVal;
+/*N*/
+/*N*/ *rIo.pStrm >> fVal;
+/*N*/
+/*N*/ SwDateTimeField* pFld = new SwDateTimeField( (SwDateTimeFieldType*)pType, nSubType );
+/*N*/ pFld->SetValue( fVal );
+/*N*/
+/*N*/ if (rIo.IsVersion(SWG_DATEOFFSET))
+/*N*/ {
+/*N*/ INT32 nOffset;
+/*N*/
+/*N*/ *rIo.pStrm >> nOffset;
+/*N*/ pFld->SetOffset(nOffset);
+/*N*/ }
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDateTimeField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ *rIo.pStrm << ((SwDateTimeField*)pFld)->GetValue()
+/*N*/ << (INT32)((SwDateTimeField*)pFld)->GetOffset();
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InFixDateField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ INT32 nVal;
+/*N*/ *rIo.pStrm >> nVal;
+/*N*/ SwDateTimeField* pFld = new SwDateTimeField( (SwDateTimeFieldType*)pType, DATEFLD|FIXEDFLD );
+/*N*/ Time aTmpTime;
+/*N*/ Date aTmpDate(nVal);
+/*N*/ DateTime aDT(aTmpDate, aTmpTime);
+/*N*/ pFld->SetDateTime( aDT );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutFixDateField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ *rIo.pStrm << (INT32) ((SwDateTimeField*)pFld)->GetDate(TRUE).GetDate();
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InFixTimeField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+ INT32 nVal;
+ *rIo.pStrm >> nVal;
+ SwDateTimeField* pFld = new SwDateTimeField( (SwDateTimeFieldType*)pType, TIMEFLD|FIXEDFLD );
+ Date aTmpDate;
+ DateTime aDT(aTmpDate, Time(nVal));
+ pFld->SetDateTime( aDT );
+ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutFixTimeField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ *rIo.pStrm << (INT32)((SwDateTimeField*)pFld)->GetTime(TRUE).GetTime();
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InAuthorField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ SwAuthorField *pFld =
+/*N*/ new SwAuthorField( (SwAuthorFieldType*)pType );
+/*N*/
+/*N*/ if( rIo.IsVersion( SWG_FIXEDFLDS ) )
+/*N*/ {
+/*N*/ String aExpand;
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ pFld->SetExpansion( aExpand );
+/*N*/ }
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+// Wird for 4.0-Export gar nicht erst aufgerufen!
+/*N*/ void lcl_sw3io_OutAuthorField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwAuthorField *)pFld)->GetContent() );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InChapterField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ SwChapterField* pFld = new SwChapterField( (SwChapterFieldType*)pType );
+/*N*/ if( rIo.nVersion >= SWG_OLENAME )
+/*N*/ {
+/*N*/ BYTE cLvl;
+/*N*/ *rIo.pStrm >> cLvl;
+/*N*/ if( cLvl >= MAXLEVEL )
+/*?*/ cLvl = MAXLEVEL - 1;
+/*N*/ pFld->SetLevel( cLvl );
+/*N*/ }
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutChapterField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ BYTE cLvl = ((SwChapterField*)pFld)->GetLevel();
+/*N*/ if( rIo.IsSw31Or40Export() && cLvl >= OLD_MAXLEVEL)
+/*N*/ cLvl = OLD_MAXLEVEL - 1;
+/*N*/
+/*N*/ *rIo.pStrm << cLvl;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDocStatField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& rFmt )
+/*N*/ {
+/*N*/ UINT16 nSubType;
+/*N*/ *rIo.pStrm >> nSubType;
+/*N*/ return new SwDocStatField( (SwDocStatFieldType*)pType, nSubType, rFmt );
+/*N*/ }
+/*N*/
+/*N*/ SwField* lcl_sw3io_InDocStatField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ return new SwDocStatField( (SwDocStatFieldType*)pType, nSubType, rFmt );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDocStatField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ *rIo.pStrm << (UINT16) pFld->GetSubType();
+/*N*/ }
+
+// Im 5.0-Format bleibt nix, was geschrieben werden muesste.
+
+/*N*/ SwField* lcl_sw3io_InDDEField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ pType = 0;
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*?*/ pType = lcl_sw3io_InDDEFieldType( rIo );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ pType = rIo.pDoc->GetFldType( RES_DDEFLD,
+/*N*/ rIo.aStringPool.Find(nPoolId));
+/*N*/ if( !pType )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ }
+/*N*/ return new SwDDEField( (SwDDEFieldType*)pType );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDDEField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find( ((SwDDEField*)pFld)->GetTyp()->GetName(), USHRT_MAX );
+/*N*/ rIo.nFileFlags |= SWGF_HAS_DDELNK;
+/*N*/ }
+
+/* */
+
+/*N*/ SwField* lcl_sw3io_InInputField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ { //SW40.SDW
+/*N*/ String aContent, aPrompt;
+/*N*/ UINT16 nSubType;
+/*N*/ rIo.InString( *rIo.pStrm, aContent );
+/*N*/ rIo.InString( *rIo.pStrm, aPrompt );
+/*N*/ *rIo.pStrm >> nSubType;
+/*N*/ return new SwInputField( (SwInputFieldType*)pType, aContent, aPrompt, nSubType );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InInputField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ String aContent, aPrompt;
+/*N*/ rIo.InString( *rIo.pStrm, aContent );
+/*N*/ rIo.InString( *rIo.pStrm, aPrompt );
+/*N*/ return new SwInputField( (SwInputFieldType*)pType, aContent, aPrompt, nSubType );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutInputField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );// Content oder SwUserFieldName
+ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );// PromptText
+ *rIo.pStrm << (UINT16) pFld->GetSubType();
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutInputField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );// Content oder SwUserFieldName
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );// PromptText
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InMacroField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ String aName;
+/*N*/ String aText;
+/*N*/ rIo.InString( *rIo.pStrm, aName );
+/*N*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ return new SwMacroField( (SwMacroFieldType*)pType, aName, aText );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutMacroField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InTblField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ String aFormula, aText;
+/*N*/ UINT16 nSub = 0;
+/*N*/ rIo.InString( *rIo.pStrm, aFormula );
+/*N*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ if( !rIo.IsVersion(SWG_NEWERFIELDS) )
+/*N*/ {
+/*N*/ *rIo.pStrm >> nSub;
+/*N*/ if( !rIo.IsVersion(SWG_NEWFIELDS) )
+/*N*/ nSubType |= nSub;
+/*N*/ }
+/*N*/ SwTblField* pFld = new SwTblField( (SwTblFieldType*)pType,
+/*N*/ aFormula, nSubType );
+/*N*/
+/*N*/
+/*N*/ pFld->ChgExpStr( aText );
+/*N*/ return pFld;
+/*N*/ }
+
+// Die Variable rIo.pCurTbl wird in Sw3IoImp::OutTable()
+// besetzt und enthaelt die zur Zeit ausgegebene Tabelle
+
+/*N*/ void lcl_sw3io_OutTblField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ if( rIo.pCurTbl )
+/*N*/ ((SwTblField*)pFld)->PtrToBoxNm( rIo.pCurTbl );
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwTblField*)pFld)->GetExpStr() );
+/*N*/ if( rIo.IsSw31Or40Export() )
+/*N*/ *rIo.pStrm << (UINT16) ((SwTblField*)pFld)->GetSubType();
+/*N*/ }
+
+/*N*/ SwField *lcl_sw3io_InGetExpField40( Sw3IoImp& rIo, SwFieldType *pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ { //SW40.SDW
+/*N*/ String aText, aExpand;
+/*N*/ UINT16 nSub;
+/*N*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ *rIo.pStrm >> nSub;
+/*N*/
+/*N*/ SwGetExpField* pFld =
+/*N*/ new SwGetExpField( (SwGetExpFieldType *)pType, aText );
+/*N*/ pFld->ChgExpStr( aExpand );
+/*N*/ pFld->SetSubType( nSub | nSubType );
+/*N*/
+/*N*/ if( GSE_STRING & nSub )
+/*N*/ rFmt = 0; // Warum auch immer!
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InGetExpField( Sw3IoImp& rIo, SwFieldType *pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ String aText, aExpand;
+/*N*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/
+/*N*/ SwGetExpField* pFld =
+/*N*/ new SwGetExpField( (SwGetExpFieldType *)pType, aText );
+/*N*/ pFld->ChgExpStr( aExpand );
+/*N*/ pFld->SetSubType( nSubType );
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutGetExpField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ rIo.OutString( *rIo.pStrm, ((SwGetExpField*)pFld)->GetFormula() );
+ rIo.OutString( *rIo.pStrm, ((SwGetExpField*)pFld)->GetExpStr() );
+ *rIo.pStrm << (UINT16) pFld->GetSubType();
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutGetExpField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwGetExpField*)pFld)->GetFormula() );
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwGetExpField*)pFld)->GetExpStr() );
+/*N*/ }
+
+/* */
+
+/*N*/ SwField* lcl_sw3io_InSetExpField40( Sw3IoImp& rIo, SwFieldType *pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ pType = 0;
+/*N*/ if( rIo.nVersion < SWG_SHORTFIELDS )
+/*N*/ pType = lcl_sw3io_InSetExpFieldType( rIo );
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/
+/*N*/ // fix #26064#: Namen der 3 Label-Numernkreise: Hier wird die
+/*N*/ // Pool-Id des dazugehoerigen Formats aus dem Str-Pool geholt
+/*N*/ String aName;
+/*N*/ lcl_sw3io_FillSetExpFieldName( rIo, nPoolId, aName );
+/*N*/
+/*N*/ pType = rIo.pDoc->GetFldType( RES_SETEXPFLD, aName );
+/*N*/ if( !pType )
+/*N*/ {
+/*N*/ rIo.Warning();
+/*N*/ return NULL;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ UINT16 nSeqNo;
+/*N*/ BYTE cFlags;
+/*N*/ String aFormula, aExpand, aPrompt;
+/*N*/ *rIo.pStrm >> cFlags;
+/*N*/ rIo.InString( *rIo.pStrm, aFormula );
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ if( (cFlags & 0x10) && rIo.nVersion >= SWG_SHORTFIELDS )
+/*N*/ rIo.InString( *rIo.pStrm, aPrompt );
+/*N*/ if( cFlags & 0x20 )
+/*N*/ *rIo.pStrm >> nSeqNo;
+/*N*/
+/*N*/ SwSetExpField* pFld =
+/*N*/ new SwSetExpField( (SwSetExpFieldType *)pType, aFormula, rFmt );
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*N*/ {
+/*N*/ pFld->SetInputFlag( TRUE );
+/*N*/ pFld->SetPromptText( aPrompt );
+/*N*/ }
+/*N*/
+/*N*/ USHORT nType = ((SwSetExpFieldType *)pType)->GetType();
+/*N*/ // Hack: fuer Seq-Felder wurde das Original-Format im Subtyp uebergeben,
+/*N*/ // aber nur, wenn es auch als entsprechendes Format in Frage kommt.
+/*N*/ // (SUB_VISIBLE und SUB_CMD sind disjunkt).
+/*N*/ if( nSubType >= (USHORT)SVX_NUM_CHARS_UPPER_LETTER &&
+/*N*/ nSubType <= (USHORT)SVX_NUM_BITMAP )
+/*N*/ {
+/*N*/ if( GSE_SEQ & nType )
+/*N*/ rFmt = nSubType;
+/*N*/ nSubType = 0;
+/*N*/ }
+/*N*/
+/*N*/ nSubType |= nType;
+/*N*/ pFld->SetSubType( nSubType );
+/*N*/
+/*N*/ if( GSE_STRING & nType )
+/*N*/ rFmt = 0; // Warum auch immer!
+/*N*/
+/*N*/ if( GSE_SEQ & nType )
+/*N*/ {
+/*N*/ sal_Char* dummy;
+/*N*/ ByteString sTmp( aExpand, RTL_TEXTENCODING_ASCII_US );
+/*N*/ pFld->SetValue( strtod( sTmp.GetBuffer(), &dummy ) );
+/*N*/
+/*N*/ USHORT n = (USHORT)pFld->GetValue();
+/*N*/
+/*N*/ aExpand = ::binfilter::FormatNumber( n, rFmt );
+/*N*/
+/*N*/ if( cFlags & 0x20 )
+/*N*/ pFld->SetSeqNumber( nSeqNo );
+/*N*/ }
+/*N*/ pFld->ChgExpStr( aExpand );
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InSetExpField( Sw3IoImp& rIo, SwFieldType *pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ pType = 0;
+/*N*/
+/*N*/ BYTE cFlags;
+/*N*/ UINT16 nPoolId, nSeqNo=0, nSeqVal=0;
+/*N*/ String aFormula, aPrompt, aExpand;
+/*N*/ *rIo.pStrm >> cFlags >> nPoolId;
+/*N*/ rIo.InString( *rIo.pStrm, aFormula );
+/*N*/
+/*N*/ // fix #26064#: Namen der 3 Label-Numernkreise: Hier wird die
+/*N*/ // Pool-Id des dazugehoerigen Formats aus dem Str-Pool geholt
+/*N*/ String aName;
+/*N*/ lcl_sw3io_FillSetExpFieldName( rIo, nPoolId, aName );
+/*N*/ pType = rIo.pDoc->GetFldType( RES_SETEXPFLD, aName );
+/*N*/
+/*N*/ if( !pType )
+/*N*/ {
+/*?*/ rIo.Warning();
+/*?*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*?*/ rIo.InString( *rIo.pStrm, aPrompt );
+/*N*/
+/*N*/ if( cFlags & 0x20 )
+/*N*/ *rIo.pStrm >> nSeqVal >> nSeqNo;
+/*N*/
+/*N*/ if( cFlags & 0x40 || !(cFlags & 0x20) )
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/
+/*N*/ SwSetExpField* pFld =
+/*N*/ new SwSetExpField( (SwSetExpFieldType *)pType, aFormula, rFmt );
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*N*/ {
+/*?*/ pFld->SetInputFlag( TRUE );
+/*?*/ pFld->SetPromptText( aPrompt );
+/*N*/ }
+/*N*/
+/*N*/ pFld->SetSubType( nSubType );
+/*N*/
+/*N*/ if( cFlags & 0x20 )
+/*N*/ {
+/*N*/ ASSERT( GSE_SEQ & ((SwSetExpFieldType *)pType)->GetType(),
+/*N*/ "Kein Sequence-Number-Feld" );
+/*N*/
+/*N*/ pFld->SetValue( nSeqVal );
+/*N*/ if( !(cFlags & 0x40) )
+/*N*/ aExpand = ::binfilter::FormatNumber( nSeqVal, rFmt );
+/*N*/
+/*N*/ pFld->SetSeqNumber( nSeqNo );
+/*N*/ }
+/*N*/
+/*N*/ pFld->ChgExpStr( aExpand );
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+
+/*N*/ void lcl_sw3io_OutSetExpField40( Sw3IoImp& rIo, SwField *pFld)
+/*N*/ {
+/*N*/ USHORT nPoolId = USHRT_MAX;
+/*N*/ const String& rName = ((SwSetExpField *)pFld)->GetTyp()->GetName();
+/*N*/ if( GSE_SEQ & ((SwSetExpFieldType *)pFld->GetTyp())->GetType() )
+/*N*/ nPoolId = lcl_sw3io_GetSetExpFieldPoolId( rName );
+/*N*/
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find( rName, nPoolId );
+/*N*/
+/*N*/ BYTE cFlags = ((SwSetExpField *)pFld)->GetInputFlag() ? 0x10 : 0;
+/*N*/ String sStr( ((SwSetExpField *)pFld)->GetExpStr() );
+/*N*/
+/*N*/ if( GSE_SEQ & ((SwSetExpFieldType *)pFld->GetTyp())->GetType() )
+/*N*/ {
+/*N*/ USHORT n = (USHORT)((SwSetExpField*)pFld)->GetValue();
+/*N*/ sStr = ::binfilter::FormatNumber( n, SVX_NUM_ARABIC );
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ cFlags |= 0x20;
+/*N*/ }
+/*N*/
+/*N*/ *rIo.pStrm << cFlags;
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwSetExpField*)pFld)->GetFormula() );
+/*N*/ rIo.OutString( *rIo.pStrm, sStr );
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*?*/ rIo.OutString( *rIo.pStrm, ((SwSetExpField *)pFld)->GetPromptText() );
+/*N*/ if( cFlags & 0x20 )
+/*N*/ *rIo.pStrm << (UINT16)((SwSetExpField *)pFld)->GetSeqNumber();
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutSetExpField( Sw3IoImp& rIo, SwField *pFld )
+/*N*/ {
+/*N*/ USHORT nPoolId = USHRT_MAX;
+/*N*/ BYTE cFlags = ((SwSetExpField *)pFld)->GetInputFlag() ? 0x10 : 0;
+/*N*/
+/*N*/ const String& rName = ((SwSetExpField *)pFld)->GetTyp()->GetName();
+/*N*/ if( ((SwSetExpField *)pFld)->IsSequenceFld() )
+/*N*/ {
+/*N*/ nPoolId = lcl_sw3io_GetSetExpFieldPoolId( rName );
+/*N*/ cFlags |= 0x20;
+/*N*/ if( MAXLEVEL > ((SwSetExpFieldType *)pFld->GetTyp())->GetOutlineLvl() )
+/*N*/ cFlags |= 0x40;
+/*N*/ }
+/*N*/
+/*N*/ *rIo.pStrm << cFlags
+/*N*/ << (UINT16)rIo.aStringPool.Find( rName, nPoolId );
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwSetExpField*)pFld)->GetFormula() );
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwSetExpField *)pFld)->GetPromptText() );
+/*N*/ if( cFlags & 0x20 )
+/*N*/ *rIo.pStrm << (UINT16)((SwSetExpField*)pFld)->GetValue()
+/*N*/ << (UINT16)((SwSetExpField *)pFld)->GetSeqNumber();
+/*N*/
+/*N*/ if( cFlags & 0x40 || !(cFlags & 0x20) )
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwSetExpField *)pFld)->GetExpStr() );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InHiddenParaField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ BYTE bHidden;
+/*N*/ String aCond;
+/*N*/ *rIo.pStrm >> bHidden;
+/*N*/ rIo.InString( *rIo.pStrm, aCond );
+/*N*/ SwHiddenParaField* pFld = new SwHiddenParaField( (SwHiddenParaFieldType*)pType, aCond );
+/*N*/ pFld->SetHidden( (BOOL) bHidden );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutHiddenParaField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ *rIo.pStrm << (BYTE)((SwHiddenParaField*)pFld)->IsHidden();
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDocInfoField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ UINT16 nSub;
+/*N*/ *rIo.pStrm >> nSub;
+/*N*/ nSubType |= nSub;
+/*N*/
+/*N*/ SwDocInfoField *pFld = new SwDocInfoField( (SwDocInfoFieldType*)pType,
+/*N*/ nSubType, rFmt );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDocInfoField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& rFmt )
+/*N*/ {
+/*N*/ BYTE cFlags;
+/*N*/ SwDocInfoField *pFld = new SwDocInfoField( (SwDocInfoFieldType*)pType,
+/*N*/ nSubType, rFmt );
+/*N*/
+/*N*/ String aContent;
+/*N*/ *rIo.pStrm >> cFlags;
+/*N*/ rIo.InString( *rIo.pStrm, aContent );
+/*N*/ pFld->SetExpansion(aContent);
+/*N*/ if( cFlags & 0x01 )
+/*N*/ {
+/*?*/ double dVal;
+/*?*/ *rIo.pStrm >> dVal;
+/*?*/ pFld->SetValue( dVal );
+/*N*/ }
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDocInfoField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ UINT16 nSubType = pFld->GetSubType();
+ nSubType &= 0x00ff;
+
+ *rIo.pStrm << nSubType;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDocInfoField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ BYTE cFlags = 0x00;
+/*N*/ if( ((SwDocInfoField*)pFld)->IsFixed() )
+/*N*/ {
+/*?*/ USHORT nSub = pFld->GetSubType();
+/*?*/ switch( nSub & 0x00ff )
+/*?*/ {
+/*?*/ case DI_EDIT:
+/*?*/ cFlags = 0x01;
+/*?*/ break;
+/*?*/ case DI_CREATE:
+/*?*/ case DI_CHANGE:
+/*?*/ case DI_PRINT:
+/*?*/ switch( nSub & ~(DI_SUB_FIXED|0x00ff) )
+/*?*/ {
+/*?*/ case DI_SUB_TIME:
+/*?*/ case DI_SUB_DATE:
+/*?*/ cFlags = 0x01;
+/*?*/ break;
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ *rIo.pStrm << cFlags;
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->Expand() );
+/*N*/ if( cFlags & 0x01 )
+/*N*/ *rIo.pStrm << ((SwDocInfoField*)pFld)->GetValue();
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InTemplNameField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& rFmt )
+/*N*/ {
+/*N*/ return new SwTemplNameField( (SwTemplNameFieldType*)pType, rFmt );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDBNextSetField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ String aName, aCond, aDBName;
+/*N*/ rIo.InString( *rIo.pStrm, aCond );
+/*N*/ rIo.InString( *rIo.pStrm, aName );
+/*N*/ if( rIo.IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aDBName = rIo.aStringPool.Find( nPoolId );
+/*N*/ }
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = aDBName.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = aDBName.GetToken(1, DB_DELIM);
+/*N*/ return new SwDBNextSetField( (SwDBNextSetFieldType*)pType, aCond, aName, aData );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDBNextSetField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );
+/*N*/
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ SwDBData aData(((SwDBNextSetField*)pFld)->GetRealDBData());
+/*N*/ String sDBName(aData.sDataSource);
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ }
+
+// der 3.1-Writer hat beim Einlesen Condition und Number vertauscht.
+// Deshalb exportieren wir diese beiden Werte vertauscht und lesen sie
+// in der exportierten Version auch verkehrt herum wieder ein.
+
+/*N*/ SwField* lcl_sw3io_InDBNumSetField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ String aNumber, aCond, aDBName;
+/*N*/
+/*N*/ if( rIo.IsVersion( SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*?*/ rIo.InString( *rIo.pStrm, aNumber );
+/*?*/ rIo.InString( *rIo.pStrm, aCond );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rIo.InString( *rIo.pStrm, aCond );
+/*N*/ rIo.InString( *rIo.pStrm, aNumber );
+/*N*/ }
+/*N*/
+/*N*/ if( rIo.IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aDBName = rIo.aStringPool.Find( nPoolId );
+/*N*/ }
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = aDBName.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = aDBName.GetToken(1, DB_DELIM);
+/*N*/ return new SwDBNumSetField( (SwDBNumSetFieldType*)pType, aCond, aNumber, aData );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDBNumSetField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ if( rIo.IsSw31Export() )
+/*N*/ {
+/*?*/ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );
+/*?*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );
+/*N*/ }
+/*N*/
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ SwDBData aData(((SwDBNumSetField*)pFld)->GetRealDBData());
+/*N*/ String sDBName(aData.sDataSource);
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ *rIo.pStrm << (UINT16)rIo.aStringPool.Find( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InDBSetNumberField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ String aDBName;
+/*N*/ INT32 n;
+/*N*/ *rIo.pStrm >> n;
+/*N*/ if( rIo.IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ USHORT nPoolId;
+/*N*/ *rIo.pStrm >> nPoolId;
+/*N*/ aDBName = rIo.aStringPool.Find( nPoolId );
+/*N*/ }
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = aDBName.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = aDBName.GetToken(1, DB_DELIM);
+/*N*/ SwDBSetNumberField* pFld = new SwDBSetNumberField( (SwDBSetNumberFieldType*)pType, aData );
+/*N*/ pFld->SetSetNumber( n );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutDBSetNumberField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ *rIo.pStrm << (INT32) ((SwDBSetNumberField*)pFld)->GetSetNumber();
+/*N*/
+/*N*/ if( !rIo.IsSw31Export() )
+/*N*/ {
+/*N*/ SwDBData aData(((SwDBSetNumberField*)pFld)->GetRealDBData());
+/*N*/ String sDBName(aData.sDataSource);
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ *rIo.pStrm<< (UINT16)rIo.aStringPool.Find( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InExtUserField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ String aData;
+/*N*/ UINT16 nSubType;
+/*N*/ rIo.InString( *rIo.pStrm, aData );
+/*N*/ *rIo.pStrm >> nSubType;
+/*N*/ SwExtUserField* pFld = new SwExtUserField( (SwExtUserFieldType*)pType, nSubType );
+/*N*/ ((SwExtUserFieldType*)pType)->SetData( aData );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InExtUserField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT nSubType, UINT32& )
+/*N*/ {
+/*N*/ String aData;
+/*N*/ rIo.InString( *rIo.pStrm, aData );
+/*N*/
+/*N*/ SwExtUserField* pFld = new SwExtUserField( (SwExtUserFieldType*)pType, nSubType );
+/*N*/ ((SwExtUserFieldType*)pType)->SetData( aData );
+/*N*/
+/*N*/ if( rIo.IsVersion( SWG_FIXEDFLDS ) )
+/*N*/ {
+/*N*/ String aExpand;
+/*N*/ rIo.InString( *rIo.pStrm, aExpand );
+/*N*/ pFld->SetExpansion( aExpand );
+/*N*/ }
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutExtUserField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ SwExtUserFieldType* pType = (SwExtUserFieldType*) pFld->GetTyp();
+/*N*/ rIo.OutString( *rIo.pStrm, pType->GetData() );
+/*N*/ *rIo.pStrm << (UINT16) pFld->GetSubType();
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutExtUserField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ SwExtUserFieldType* pType = (SwExtUserFieldType*) pFld->GetTyp();
+/*N*/ rIo.OutString( *rIo.pStrm, pType->GetData() );
+/*N*/ rIo.OutString( *rIo.pStrm, ((SwExtUserField *)pFld)->GetContent() );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InRefPageSetField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+ INT16 nOffset;
+ BYTE cIsOn;
+ *rIo.pStrm >> nOffset >> cIsOn;
+ return new SwRefPageSetField( (SwRefPageSetFieldType*)pType, nOffset, cIsOn!=0 );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutRefPageSetField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ *rIo.pStrm << (INT16)((SwRefPageSetField*)pFld)->GetOffset()
+ << (BYTE)((SwRefPageSetField*)pFld)->IsOn();
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InRefPageGetField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+ String aString;
+ SwRefPageGetField *pFld = new SwRefPageGetField( (SwRefPageGetFieldType*)pType, 0 );
+ rIo.InString( *rIo.pStrm, aString );
+ pFld->SetText( aString );
+ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutRefPageGetField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ rIo.OutString( *rIo.pStrm, ((SwRefPageGetField*)pFld)->GetText() );
+/*N*/ }
+
+/*N*/ SwField *lcl_sw3io_InINetField31( Sw3IoImp& rIo, SwFieldType *, USHORT, UINT32& )
+/*N*/ {
+/*N*/ ASSERT( !(rIo.pFmtINetFmt || rIo.aINetFldText.Len()),
+/*N*/ "Da sind noch Rest-Infos vom INet-Feld!" );
+/*N*/
+/*N*/ String aURL, aText;
+/*N*/ rIo.InString( *rIo.pStrm, aURL );
+/*N*/ rIo.InString( *rIo.pStrm, rIo.aINetFldText );
+/*N*/
+/*N*/ // JP 10.04.96: aus rel. URLs wieder absolute machen!
+/*N*/ aURL = ::binfilter::StaticBaseUrl::SmartRelToAbs( aURL );
+/*N*/
+/*N*/ String sTarget;
+/*N*/ if( rIo.IsVersion( SWG_TARGETFRAME, SWG_EXPORT31 ) )
+/*N*/ {
+/*N*/ rIo.InString( *rIo.pStrm, sTarget );
+/*N*/ }
+/*N*/
+/*N*/ rIo.pFmtINetFmt = new SwFmtINetFmt( aURL, sTarget );
+/*N*/
+/*N*/ if( rIo.IsVersion( SWG_INETMACROTAB, SWG_EXPORT31 ) )
+/*N*/ {
+/*?*/ USHORT nCnt;
+/*?*/ *rIo.pStrm >> nCnt;
+/*?*/
+/*?*/ while( nCnt-- )
+/*?*/ {
+ USHORT nCurKey;
+/*?*/ String aLibName, aMacName;
+/*?*/ *rIo.pStrm >> nCurKey;
+/*?*/ rIo.InString( *rIo.pStrm, aLibName );
+/*?*/ rIo.InString( *rIo.pStrm, aMacName );
+/*?*/ rIo.pFmtINetFmt->SetMacro( nCurKey, SvxMacro( aMacName, aLibName, STARBASIC ) );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InJumpEditField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+/*N*/ String aText, aHelp;
+/*N*/ rIo.InString( *rIo.pStrm, aText );
+/*N*/ rIo.InString( *rIo.pStrm, aHelp );
+/*N*/ SwJumpEditField *pFld = new SwJumpEditField( (SwJumpEditFieldType*)pType, 0, aText, aHelp );
+/*N*/ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutJumpEditField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+/*N*/ rIo.OutString( *rIo.pStrm, pFld->GetPar2() );
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InScriptField40( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+ String aType, aCode;
+ BYTE cFlags = 0;
+ rIo.InString( *rIo.pStrm, aType );
+ rIo.InString( *rIo.pStrm, aCode );
+
+ // Hier gab es mal eine Version SWG_SCRIPTURLS (0x0121), die jedoch
+ // so gut wie keiner benutuzt hat, erst recht nicht mit Script-Feldern.
+ // Deshalb wurde die geknickt.
+ if( rIo.IsVersion( SWG_NEWFIELDS ) )
+ *rIo.pStrm >> cFlags;
+ else if( aCode.CompareIgnoreCaseToAscii( "// @url: ", 9 ) == COMPARE_EQUAL )
+ {
+ // HACK fuer die 363 (4.0 fixpack 2): Script-Links wurden
+ // als spezieller Kommentar rausgeschrieben, weil es kein Flag zu
+ // Unterscheidung von normalem Code gab.
+ aCode.Erase( 0, 9 );
+ cFlags = 0x01;
+ }
+ if( (cFlags & 0x01) != 0 )
+ aCode = ::binfilter::StaticBaseUrl::SmartRelToAbs( aCode );
+
+ SwScriptField *pFld = new SwScriptField( (SwScriptFieldType*)pType, aType, aCode,
+ (cFlags & 0x01) != 0 );
+ return pFld;
+/*N*/ }
+
+/*N*/ SwField* lcl_sw3io_InScriptField( Sw3IoImp& rIo, SwFieldType* pType,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+ String aType, aCode;
+ BYTE cFlags = 0;
+ rIo.InString( *rIo.pStrm, aType );
+ rIo.InString( *rIo.pStrm, aCode );
+ *rIo.pStrm >> cFlags;
+
+ if( (cFlags & 0x01) != 0 )
+ aCode = ::binfilter::StaticBaseUrl::SmartRelToAbs( aCode );
+
+ SwScriptField *pFld = new SwScriptField( (SwScriptFieldType*)pType, aType, aCode,
+ (cFlags & 0x01) != 0 );
+ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutScriptField40( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ ASSERT( !rIo.IsSw31Export(),
+ "Wer will denn da ein Script-Feld exportieren" );
+
+ BYTE cFlags = ((SwScriptField*)pFld)->IsCodeURL() ? 0x01 : 0x00;
+
+ String aCode;
+ if( ((SwScriptField*)pFld)->IsCodeURL() )
+ {
+ aCode.AssignAscii( "// @url: " );
+ aCode += ::binfilter::StaticBaseUrl::AbsToRel( ((SwScriptField*)pFld)->GetCode() );
+ }
+ else
+ aCode = ((SwScriptField*)pFld)->GetCode();
+
+ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+ rIo.OutString( *rIo.pStrm, aCode );
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutScriptField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ ASSERT( !rIo.IsSw31Export(),
+ "Wer will denn da ein Script-Feld exportieren" );
+
+ BYTE cFlags = ((SwScriptField*)pFld)->IsCodeURL() ? 0x01 : 0x00;
+
+ String aCode;
+ if( ((SwScriptField*)pFld)->IsCodeURL() )
+ aCode = ::binfilter::StaticBaseUrl::AbsToRel( ((SwScriptField*)pFld)->GetCode() );
+ else
+ aCode = ((SwScriptField*)pFld)->GetCode();
+
+ rIo.OutString( *rIo.pStrm, pFld->GetPar1() );
+ rIo.OutString( *rIo.pStrm, aCode );
+ *rIo.pStrm << cFlags;
+/*N*/ }
+
+/* */
+
+/*N*/ SwField* lcl_sw3io_InAuthorityField( Sw3IoImp& rIo, SwFieldType*,
+/*N*/ USHORT, UINT32& )
+/*N*/ {
+ rIo.OpenFlagRec();
+
+ UINT16 nPos;
+ *rIo.pStrm >> nPos;
+
+ rIo.CloseFlagRec();
+
+ if( rIo.pAuthorityMap && nPos < rIo.pAuthorityMap->Count() )
+ nPos = (*rIo.pAuthorityMap)[nPos];
+
+ SwField *pFld = 0;
+ SwFieldType* pType = rIo.pDoc->GetFldType( RES_AUTHORITY, aEmptyStr );
+ ASSERT( pType, "missing authority field type" );
+ if( pType )
+ {
+ long nHandle = ((SwAuthorityFieldType *)pType)->GetHandle( nPos );
+ pFld = new SwAuthorityField( (SwAuthorityFieldType *)pType, nHandle );
+ }
+
+ return pFld;
+/*N*/ }
+
+/*N*/ void lcl_sw3io_OutAuthorityField( Sw3IoImp& rIo, SwField* pFld )
+/*N*/ {
+ BYTE cFlags = 0x02;
+ *rIo.pStrm << cFlags
+ << (UINT16)((SwAuthorityField *)pFld)->GetHandlePosition();
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////////
+// Die Beta-1-Version hatte noch eine eigene Kapselung fuer das Feld.
+// Da dieser Inhalt als Teil eines SWG_ATTRIBUTE-Records vorkommt,ist
+// dies reine Platzverschwendung und wurde geknickt.
+
+#define SWG_FIELD 'y'
+
+typedef SwField *(*Sw3InFieldFn)( Sw3IoImp&, SwFieldType*, USHORT, UINT32& );
+
+static Sw3InFieldFn aInFieldFnTbl40[] =
+{
+ &lcl_sw3io_InDBField40, // RES_DBFLD
+ &lcl_sw3io_InUserField40, // RES_USERFLD
+ &lcl_sw3io_InFileNameField, // RES_FILENAMEFLD
+ &lcl_sw3io_InDBNameField, // RES_DBNAMEFLD
+ &lcl_sw3io_InDateField40, // RES_DATEFLD
+ &lcl_sw3io_InTimeField40, // RES_TIMEFLD
+ &lcl_sw3io_InPageNumberField40,// RES_PAGENUMBERFLD
+ &lcl_sw3io_InAuthorField, // RES_AUTHORFLD
+ &lcl_sw3io_InChapterField, // RES_CHAPTERFLD
+ &lcl_sw3io_InDocStatField40, // RES_DOCSTATFLD
+ &lcl_sw3io_InGetExpField40, // RES_GETEXPFLD
+ &lcl_sw3io_InSetExpField40, // RES_SETEXPFLD
+ &lcl_sw3io_InGetRefField40, // RES_GETREFFLD
+ &lcl_sw3io_InHiddenTxtField40, // RES_HIDDENTXTFLD
+ &lcl_sw3io_InPostItField, // RES_POSTITFLD
+ &lcl_sw3io_InFixDateField40, // RES_FIXDATEFLD
+ &lcl_sw3io_InFixTimeField40, // RES_FIXTIMEFLD
+ 0 , // RES_REGFLD
+ 0 , // RES_VARREGFLD
+ 0 , // RES_SETREFFLD
+ &lcl_sw3io_InInputField40, // RES_INPUTFLD
+ &lcl_sw3io_InMacroField, // RES_MACROFLD
+ &lcl_sw3io_InDDEField, // RES_DDEFLD
+ &lcl_sw3io_InTblField, // RES_TABLEFLD
+ &lcl_sw3io_InHiddenParaField, // RES_HIDDENPARAFLD
+ &lcl_sw3io_InDocInfoField40, // RES_DOCINFOFLD
+ &lcl_sw3io_InTemplNameField, // RES_TEMPLNAMEFLD
+ &lcl_sw3io_InDBNextSetField, // RES_DBNEXTSETFLD
+ &lcl_sw3io_InDBNumSetField, // RES_DBNUMSETFLD
+ &lcl_sw3io_InDBSetNumberField, // RES_DBSETNUMBERFLD
+ &lcl_sw3io_InExtUserField40, // RES_EXTUSERFLD
+ &lcl_sw3io_InRefPageSetField, // RES_REFPAGESETFLD
+ &lcl_sw3io_InRefPageGetField, // RES_REFPAGEGETFLD
+ &lcl_sw3io_InINetField31, // RES_INTERNETFLD
+ &lcl_sw3io_InJumpEditField, // RES_JUMPEDITFLD
+ &lcl_sw3io_InScriptField40, // RES_SCRIPTFLD
+ 0, // RES_DATETIMEFLD
+ 0, // RES_AUTHORITY
+ 0, // RES_COMBINED_CHARS
+ 0 // RES_DROPDOWN #108791#
+};
+
+static Sw3InFieldFn aInFieldFnTbl[] =
+{
+ &lcl_sw3io_InDBField, // RES_DBFLD OK (3.1?)
+ &lcl_sw3io_InUserField, // RES_USERFLD OK (3.1?)
+ &lcl_sw3io_InFileNameField, // RES_FILENAMEFLD unv.
+ &lcl_sw3io_InDBNameField, // RES_DBNAMEFLD unv.
+ 0, // RES_DATEFLD OK (3.1?)
+ 0, // RES_TIMEFLD OK (3.1?)
+ &lcl_sw3io_InPageNumberField, // RES_PAGENUMBERFLD OK (3.1?)
+ &lcl_sw3io_InAuthorField, // RES_AUTHORFLD unv.
+ &lcl_sw3io_InChapterField, // RES_CHAPTERFLD unv.
+ &lcl_sw3io_InDocStatField, // RES_DOCSTATFLD OK
+ &lcl_sw3io_InGetExpField, // RES_GETEXPFLD OK (3.1?)
+ &lcl_sw3io_InSetExpField, // RES_SETEXPFLD OK (3.1?)
+ &lcl_sw3io_InGetRefField, // RES_GETREFFLD OK (3.1?)
+ &lcl_sw3io_InHiddenTxtField, // RES_HIDDENTXTFLD OK
+ &lcl_sw3io_InPostItField, // RES_POSTITFLD unv.
+ 0, // RES_FIXDATEFLD OK (3.1?)
+ 0, // RES_FIXTIMEFLD OK (3.1?)
+ 0, // RES_REGFLD ---
+ 0, // RES_VARREGFLD ---
+ 0, // RES_SETREFFLD ---
+ &lcl_sw3io_InInputField, // RES_INPUTFLD OK
+ &lcl_sw3io_InMacroField, // RES_MACROFLD unv.
+ &lcl_sw3io_InDDEField, // RES_DDEFLD unv.
+ &lcl_sw3io_InTblField, // RES_TABLEFLD OK (3.1?)
+ &lcl_sw3io_InHiddenParaField, // RES_HIDDENPARAFLD unv.
+ &lcl_sw3io_InDocInfoField, // RES_DOCINFOFLD OK
+ &lcl_sw3io_InTemplNameField, // RES_TEMPLNAMEFLD unv.
+ &lcl_sw3io_InDBNextSetField, // RES_DBNEXTSETFLD unv.
+ &lcl_sw3io_InDBNumSetField, // RES_DBNUMSETFLD unv.
+ &lcl_sw3io_InDBSetNumberField, // RES_DBSETNUMBERFLD unv.
+ &lcl_sw3io_InExtUserField, // RES_EXTUSERFLD OK
+ &lcl_sw3io_InRefPageSetField, // RES_REFPAGESETFLD unv.
+ &lcl_sw3io_InRefPageGetField, // RES_REFPAGEGETFLD unv.
+ 0, // RES_INTERNETFLD unv.
+ &lcl_sw3io_InJumpEditField, // RES_JUMPEDITFLD unv.
+ &lcl_sw3io_InScriptField, // RES_SCRIPTFLD OK
+ &lcl_sw3io_InDateTimeField, // RES_DATETIMEFLD OK (3.1?)
+ &lcl_sw3io_InAuthorityField, // RES_AUTHORITY
+ 0, // RES_COMBINED_CHARS
+ 0 // RES_DROPDOWN #108791#
+};
+
+/*N*/ SwField* Sw3IoImp::InField()
+/*N*/ {
+/*N*/ ASSERT( RES_FIELDS_END-RES_FIELDS_BEGIN ==
+/*N*/ sizeof(aInFieldFnTbl) / sizeof(Sw3InFieldFn),
+/*N*/ "Neues Feld? Und tschuess..." );
+/*N*/ ASSERT( RES_FIELDS_END-RES_FIELDS_BEGIN ==
+/*N*/ sizeof(aInFieldFnTbl40) / sizeof(Sw3InFieldFn),
+/*N*/ "Neues Feld? Und tschuess..." );
+/*N*/
+/*N*/ BYTE cType = Peek();
+/*N*/ if( cType == SWG_FIELD )
+/*?*/ OpenRec( cType );
+/*N*/ UINT16 nWhich;
+/*N*/ UINT32 nFldFmt;
+/*N*/ USHORT nSubType = 0;
+/*N*/
+/*N*/ *pStrm >> nWhich;
+/*N*/ if( IsVersion(SWG_NEWERFIELDS) )
+/*N*/ {
+/*N*/ // 5.0
+/*N*/ *pStrm >> nFldFmt >> nSubType;
+/*N*/ }
+/*N*/ else if( IsVersion(SWG_NEWFIELDS) )
+/*N*/ {
+/*N*/ // spaete 4.0 und 5.0 vor Umbau
+/*?*/ *pStrm >> nFldFmt;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // 3.1 und 4.0
+/*N*/ UINT16 nOldFldFmt;
+/*N*/ *pStrm >> nOldFldFmt;
+/*N*/ nFldFmt = nOldFldFmt;
+/*N*/ }
+/*N*/
+/*N*/ nWhich += RES_FIELDS_BEGIN;
+/*N*/
+/*N*/ // Beim Import aelter Dokumente wird jetzt erstmal kraeftig
+/*N*/ // an allem geschraubt.
+/*N*/ UINT16 nRealWhich = nWhich;
+/*N*/ if( !IsVersion(SWG_NEWFIELDS) )
+/*N*/ sw3io_ConvertFromOldField( *pDoc, nRealWhich, nSubType, nFldFmt, nVersion );
+/*N*/
+/*N*/ SwField* pFld = NULL;
+/*N*/ SwFieldType* pType = pDoc->GetSysFldType( (const RES_FIELDS)nRealWhich );
+/*N*/
+/*N*/ Sw3InFieldFn *pFnTbl;
+/*N*/ if( IsVersion(SWG_NEWERFIELDS) )
+/*N*/ pFnTbl = aInFieldFnTbl;
+/*N*/ else
+/*N*/ pFnTbl = aInFieldFnTbl40;
+/*N*/ Sw3InFieldFn pFn =
+/*N*/ (nWhich < RES_FIELDS_END) ? pFnTbl[nWhich-RES_FIELDS_BEGIN] : 0;
+/*N*/
+/*N*/ ASSERT( pFn, "unbekannte Feld-Which-Id" );
+/*N*/ if( pFn )
+/*N*/ pFld = (*pFn)( *this, pType, nSubType, nFldFmt );
+/*N*/ else
+/*?*/ Warning();
+/*N*/
+/*N*/ if( cType == SWG_FIELD )
+/*N*/ CloseRec( cType );
+/*N*/ if( pFld )
+/*N*/ pFld->ChangeFormat( nFldFmt );
+/*N*/
+/*N*/ if( (bOrganizer || bPageDescs) && pFld && pFld->IsFixed() )
+/*N*/ {
+/*?*/ switch( nWhich )
+/*?*/ {
+/*?*/ case RES_DATETIMEFLD:
+/*?*/ ((SwDateTimeField*)pFld)->SetDateTime( DateTime() );
+/*?*/ break;
+/*?*/
+/*?*/ case RES_EXTUSERFLD:
+/*?*/ {
+/*?*/ SwExtUserField* pExtUserFld = (SwExtUserField*)pFld;
+/*?*/ pExtUserFld->SetExpansion( ((SwExtUserFieldType*)pType)->Expand(
+/*?*/ pExtUserFld->GetSubType(),
+/*?*/ pExtUserFld->GetFormat() ) );
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case RES_AUTHORFLD:
+/*?*/ {
+/*?*/ SwAuthorField* pAuthorFld = (SwAuthorField*)pFld;
+/*?*/ pAuthorFld->SetExpansion( ((SwAuthorFieldType*)pType)->Expand(
+/*?*/ pAuthorFld->GetFormat() ) );
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case RES_FILENAMEFLD:
+/*?*/ {
+/*?*/ SwFileNameField* pFileNameFld = (SwFileNameField*)pFld;
+/*?*/ pFileNameFld->SetExpansion( ((SwFileNameFieldType*)pType)->Expand(
+/*?*/ pFileNameFld->GetFormat() ) );
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case RES_DOCINFOFLD:
+/*?*/ {
+/*?*/ SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFld;
+/*?*/ pDocInfFld->SetExpansion( ((SwDocInfoFieldType*)pType)->Expand(
+/*?*/ pDocInfFld->GetSubType(),
+/*?*/ pDocInfFld->GetFormat(),
+/*?*/ pDocInfFld->GetLanguage() ) );
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ return pFld;
+/*N*/ }
+
+typedef void (*Sw3OutFieldFn)( Sw3IoImp&, SwField* );
+
+static Sw3OutFieldFn aOutFieldFnTbl40[] =
+{
+ &lcl_sw3io_OutDBField40, // RES_DBFLD
+ &lcl_sw3io_OutUserField, // RES_USERFLD
+ 0, // RES_FILENAMEFLD
+ &lcl_sw3io_OutDBNameField, // RES_DBNAMEFLD
+ 0, // RES_DATEFLD
+ 0, // RES_TIMEFLD
+ &lcl_sw3io_OutPageNumberField40, // RES_PAGENUMBERFLD
+ 0, // RES_AUTHORFLD
+ &lcl_sw3io_OutChapterField, // RES_CHAPTERFLD
+ &lcl_sw3io_OutDocStatField40, // RES_DOCSTATFLD
+ &lcl_sw3io_OutGetExpField40, // RES_GETEXPFLD
+ &lcl_sw3io_OutSetExpField40, // RES_SETEXPFLD
+ &lcl_sw3io_OutGetRefField40, // RES_GETREFFLD
+ &lcl_sw3io_OutHiddenTxtField40, // RES_HIDDENTXTFLD
+ &lcl_sw3io_OutPostItField, // RES_POSTITFLD
+ &lcl_sw3io_OutFixDateField40, // RES_FIXDATEFLD
+ &lcl_sw3io_OutFixTimeField40, // RES_FIXTIMEFLD
+ 0, // RES_REGFLD
+ 0, // RES_VARREGFLD
+ 0, // RES_SETREFFLD
+ &lcl_sw3io_OutInputField40, // RES_INPUTFLD
+ &lcl_sw3io_OutMacroField, // RES_MACROFLD
+ &lcl_sw3io_OutDDEField, // RES_DDEFLD
+ &lcl_sw3io_OutTblField, // RES_TABLEFLD
+ &lcl_sw3io_OutHiddenParaField, // RES_HIDDENPARAFLD
+ &lcl_sw3io_OutDocInfoField40, // RES_DOCINFOFLD
+ 0, // RES_TEMPLNAMEFLD
+ &lcl_sw3io_OutDBNextSetField, // RES_DBNEXTSETFLD
+ &lcl_sw3io_OutDBNumSetField, // RES_DBNUMSETFLD
+ &lcl_sw3io_OutDBSetNumberField, // RES_DBSETNUMBERFLD
+ &lcl_sw3io_OutExtUserField40, // RES_EXTUSERFLD
+ &lcl_sw3io_OutRefPageSetField, // RES_REFPAGESETFLD
+ &lcl_sw3io_OutRefPageGetField, // RES_REFPAGEGETFLD
+ 0, // RES_INTERNETFLD
+ &lcl_sw3io_OutJumpEditField, // RES_JUMPEDITFLD
+ &lcl_sw3io_OutScriptField40, // RES_SCRIPTFLD
+ 0, // RES_DATETIMEFLD
+ 0, // RES_AUTHORITY
+ 0, // RES_COMBINED_CHARS
+ 0 // RES_DROPDOWN #108791#
+};
+
+static Sw3OutFieldFn aOutFieldFnTbl[] =
+{
+ &lcl_sw3io_OutDBField, // RES_DBFLD
+ &lcl_sw3io_OutUserField, // RES_USERFLD
+ &lcl_sw3io_OutFileNameField, // RES_FILENAMEFLD
+ &lcl_sw3io_OutDBNameField, // RES_DBNAMEFLD
+ 0, // RES_DATEFLD
+ 0, // RES_TIMEFLD
+ &lcl_sw3io_OutPageNumberField, // RES_PAGENUMBERFLD
+ &lcl_sw3io_OutAuthorField, // RES_AUTHORFLD
+ &lcl_sw3io_OutChapterField, // RES_CHAPTERFLD
+ 0, // RES_DOCSTATFLD
+ &lcl_sw3io_OutGetExpField, // RES_GETEXPFLD
+ &lcl_sw3io_OutSetExpField, // RES_SETEXPFLD
+ &lcl_sw3io_OutGetRefField, // RES_GETREFFLD
+ &lcl_sw3io_OutHiddenTxtField, // RES_HIDDENTXTFLD
+ &lcl_sw3io_OutPostItField, // RES_POSTITFLD
+ 0, // RES_FIXDATEFLD
+ 0, // RES_FIXTIMEFLD
+ 0, // RES_REGFLD
+ 0, // RES_VARREGFLD
+ 0, // RES_SETREFFLD
+ &lcl_sw3io_OutInputField, // RES_INPUTFLD
+ &lcl_sw3io_OutMacroField, // RES_MACROFLD
+ &lcl_sw3io_OutDDEField, // RES_DDEFLD
+ &lcl_sw3io_OutTblField, // RES_TABLEFLD
+ &lcl_sw3io_OutHiddenParaField, // RES_HIDDENPARAFLD
+ &lcl_sw3io_OutDocInfoField, // RES_DOCINFOFLD
+ 0, // RES_TEMPLNAMEFLD
+ &lcl_sw3io_OutDBNextSetField, // RES_DBNEXTSETFLD
+ &lcl_sw3io_OutDBNumSetField, // RES_DBNUMSETFLD
+ &lcl_sw3io_OutDBSetNumberField, // RES_DBSETNUMBERFLD
+ &lcl_sw3io_OutExtUserField, // RES_EXTUSERFLD
+ &lcl_sw3io_OutRefPageSetField, // RES_REFPAGESETFLD
+ &lcl_sw3io_OutRefPageGetField, // RES_REFPAGEGETFLD
+ 0, // RES_INTERNETFLD
+ &lcl_sw3io_OutJumpEditField, // RES_JUMPEDITFLD
+ &lcl_sw3io_OutScriptField, // RES_SCRIPTFLD
+ &lcl_sw3io_OutDateTimeField, // RES_DATETIMEFLD
+ &lcl_sw3io_OutAuthorityField, // RES_AUTHORITY
+ 0, // RES_COMBINED_CHARS
+ 0 // RES_DROPDOWN #108791#
+};
+
+
+/*N*/ void lcl_sw3io_OutAnySetExpField40( Sw3IoImp& rIo, const sal_Char *pName,
+/*N*/ const String& rExpand )
+/*N*/ {
+/*N*/ SwSetExpFieldType aType( rIo.pDoc, String::CreateFromAscii(pName),
+/*N*/ GSE_STRING );
+/*N*/ SwSetExpField aFld( &aType, rExpand );
+/*N*/ aFld.ChgExpStr( rExpand );
+/*N*/ *rIo.pStrm << (UINT16) ( RES_SETEXPFLD - RES_FIELDS_BEGIN ); // Which
+/*N*/ *rIo.pStrm << (UINT16) 1; // Format: GSE_STRING
+/*N*/ lcl_sw3io_OutSetExpField40( rIo, &aFld );
+/*N*/ }
+
+/* #108791# */
+/*N*/ void lcl_sw3io_OutAnySetExpField( Sw3IoImp& rIo, const sal_Char *pName,
+/*N*/ const String& rExpand )
+/*N*/ {
+/*N*/ SwSetExpFieldType aType( rIo.pDoc, String::CreateFromAscii(pName),
+/*N*/ GSE_STRING );
+/*N*/ SwSetExpField aFld( &aType, rExpand );
+/*N*/ aFld.ChgExpStr( rExpand );
+/*N*/ *rIo.pStrm << (UINT16) ( RES_SETEXPFLD - RES_FIELDS_BEGIN ) // Which
+/*N*/ << (UINT32) 1 // Format: GSE_STRING
+/*N*/ << (UINT16)aFld.GetSubType();
+/*N*/ lcl_sw3io_OutSetExpField( rIo, &aFld );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutField( const SwFmtFld& rAttr )
+/*N*/ {
+/*N*/ ASSERT( RES_FIELDS_END-RES_FIELDS_BEGIN ==
+/*N*/ sizeof(aOutFieldFnTbl) / sizeof(Sw3OutFieldFn),
+/*N*/ "Neues Feld? Und tschuess..." );
+/*N*/ ASSERT( RES_FIELDS_END-RES_FIELDS_BEGIN ==
+/*N*/ sizeof(aOutFieldFnTbl40) / sizeof(Sw3OutFieldFn),
+/*N*/ "Neues Feld? Und tschuess..." );
+/*N*/
+/*N*/ const SwField* pFld = rAttr.GetFld();
+/*N*/ ASSERT( pFld, "SWG-Writer: SwAttrFld-Hint ohne Inhalt!" );
+/*N*/ if( !pFld )
+/*N*/ return;
+/*N*/
+/*N*/ SwFieldType* pType = pFld->GetTyp();
+/*N*/ if( !pType )
+/*N*/ return;
+/*N*/
+/*N*/ UINT16 nWhich = pType->Which();
+/*N*/ sal_uInt32 nFmt = pFld->GetFormat();
+/*N*/
+/*N*/ if( SOFFICE_FILEFORMAT_40 >= pStrm->GetVersion() )
+/*N*/ {
+/*N*/ const sal_Char *pExportSetExpFld = 0;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_DOCINFOFLD:
+/*N*/ if( ((SwDocInfoField*)pFld)->IsFixed() )
+/*N*/ pExportSetExpFld = sSW3IO_FixedField;
+/*N*/ break;
+/*N*/ case RES_AUTHORFLD:
+/*N*/ if( ((SwAuthorField*)pFld)->IsFixed() )
+/*N*/ pExportSetExpFld = sSW3IO_FixedField;
+/*N*/ break;
+/*N*/ case RES_EXTUSERFLD:
+/*N*/ if( ((SwExtUserField*)pFld)->IsFixed() )
+/*N*/ pExportSetExpFld = sSW3IO_FixedField;
+/*N*/ break;
+/*N*/ case RES_FILENAMEFLD:
+/*N*/ if( ((SwFileNameField*)pFld)->IsFixed() )
+/*N*/ pExportSetExpFld = sSW3IO_FixedField;
+/*N*/ break;
+/*N*/ case RES_AUTHORITY:
+/*N*/ pExportSetExpFld = sSW3IO_AuthorityField;
+/*N*/ break;
+/*N*/
+/*N*/ /* #108791# */
+/*N*/ case RES_DROPDOWN:
+/*N*/ pExportSetExpFld = sSW3IO_DropDownField;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( pExportSetExpFld )
+/*N*/ {
+/*N*/ lcl_sw3io_OutAnySetExpField40( *this, pExportSetExpFld,
+/*N*/ pFld->Expand() );
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Format wandeln
+/*N*/ sw3io_ConvertToOldField( pFld, nWhich, nFmt, pStrm->GetVersion() );
+/*N*/ }
+/*N*/ /* #108791# */
+/*N*/ else if (RES_DROPDOWN == nWhich)
+/*N*/ {
+/*N*/ lcl_sw3io_OutAnySetExpField( *this, sSW3IO_DropDownField,
+/*N*/ pFld->Expand() );
+/*N*/
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // nField koennte von sw3io_GetOldFieldFormat geaendert worden sein
+/*N*/ *pStrm << (UINT16) ( nWhich - RES_FIELDS_BEGIN );
+/*N*/
+/*N*/ if( SOFFICE_FILEFORMAT_40 >= pStrm->GetVersion() )
+/*N*/ {
+/*N*/ *pStrm << (UINT16) nFmt;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ *pStrm << (UINT32) nFmt
+/*N*/ << (UINT16)pFld->GetSubType();
+/*N*/ }
+/*N*/
+/*N*/ Sw3OutFieldFn *pFnTbl;
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ pFnTbl = aOutFieldFnTbl40;
+/*N*/ else
+/*N*/ pFnTbl = aOutFieldFnTbl;
+/*N*/
+/*N*/ Sw3OutFieldFn pFn = pFnTbl[nWhich-RES_FIELDS_BEGIN];
+/*N*/
+/*N*/ if( pFn )
+/*N*/ (*pFn)( *this, (SwField *)pFld );
+/*N*/ }
+
+// Ausgabe aller Feldtypen, die keine Systemtypen sind
+
+
+/*N*/ BOOL lcl_sw3io_HasFixedFields40( Sw3IoImp& rIo, USHORT nWhich )
+/*N*/ {
+/*N*/ SwFieldType* pFldType = rIo.pDoc->GetSysFldType( nWhich );
+/*N*/
+/*N*/ SwClientIter aIter( *pFldType );
+/*N*/ for( SwFmtFld* pFmtFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+/*N*/ pFmtFld;
+/*N*/ pFmtFld = (SwFmtFld*)aIter.Next() )
+/*N*/ {
+/*N*/ const SwField *pFld = pFmtFld->GetFld();
+/*N*/ BOOL bFixed = FALSE;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*?*/ case RES_DOCINFOFLD:
+/*?*/ bFixed = ((SwDocInfoField*)pFld)->IsFixed();
+/*?*/ break;
+/*?*/ case RES_AUTHORFLD:
+/*?*/ bFixed = ((SwAuthorField*)pFld)->IsFixed();
+/*?*/ break;
+/*N*/ case RES_EXTUSERFLD:
+/*N*/ bFixed = ((SwExtUserField*)pFld)->IsFixed();
+/*N*/ break;
+/*?*/ case RES_FILENAMEFLD:
+/*?*/ bFixed = ((SwFileNameField*)pFld)->IsFixed();
+/*N*/ break;
+/*N*/ }
+/*N*/ const SwTxtFld *pTxtFld = pFmtFld->GetTxtFld();
+/*N*/ if( bFixed && pTxtFld && pTxtFld->GetpTxtNode() &&
+/*N*/ pTxtFld->GetpTxtNode()->GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutFieldTypes()
+/*N*/ {
+/*N*/ const SwFldTypes* p = pDoc->GetFldTypes();
+/*N*/ for( USHORT i=INIT_FLDTYPES-INIT_SEQ_FLDTYPES; i<p->Count(); ++i )
+/*N*/ if( !OutFieldType( *(*p)[ i ] ) )
+/*N*/ break;
+/*N*/
+/*N*/ // Fixe DocInfo Author und ExtUser-Felder in SetExpFields wandeln
+/*N*/ String sFixedField( String::CreateFromAscii(sSW3IO_FixedField) );
+/*N*/ if( pStrm->GetVersion() <= SOFFICE_FILEFORMAT_40 &&
+/*N*/ !pDoc->GetFldType( RES_SETEXPFLD, sFixedField ) &&
+/*N*/ ( lcl_sw3io_HasFixedFields40( *this, RES_DOCINFOFLD ) ||
+/*N*/ lcl_sw3io_HasFixedFields40( *this, RES_AUTHORFLD ) ||
+/*N*/ lcl_sw3io_HasFixedFields40( *this, RES_EXTUSERFLD ) ||
+/*N*/ lcl_sw3io_HasFixedFields40( *this, RES_FILENAMEFLD ) ) )
+/*N*/ {
+/*?*/ SwSetExpFieldType aType( pDoc, sFixedField, GSE_STRING );
+/*?*/ OutFieldType( aType );
+/*N*/ }
+/*N*/ {
+/*N*/ /* #108791# */
+/*N*/ String sDropDown( String::CreateFromAscii(sSW3IO_DropDownField) );
+/*N*/ SwSetExpFieldType aType( pDoc, sDropDown, GSE_STRING );
+/*N*/ OutFieldType( aType );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwFieldType* Sw3IoImp::InFieldType()
+/*N*/ {
+/*N*/ BYTE ch;
+/*N*/ SwFieldType* p = NULL;
+/*N*/ OpenRec( SWG_FIELDTYPE );
+/*N*/ *pStrm >> ch;
+/*N*/ ch += RES_FIELDS_BEGIN;
+/*N*/ switch( ch )
+/*N*/ {
+/*N*/ case RES_DBFLD:
+/*N*/ p = lcl_sw3io_InDBFieldType( *this ); break;
+/*N*/ case RES_USERFLD:
+/*N*/ if( IsVersion(SWG_NEWERFIELDS) )
+/*N*/ p = lcl_sw3io_InUserFieldType( *this );
+/*N*/ else
+/*N*/ p = lcl_sw3io_InUserFieldType40( *this );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DDEFLD:
+/*N*/ p = lcl_sw3io_InDDEFieldType( *this ); break;
+/*N*/ case RES_SETEXPFLD:
+/*N*/ p = lcl_sw3io_InSetExpFieldType( *this ); break;
+/*?*/ case RES_AUTHORITY:
+/*?*/ p = lcl_sw3io_InAuthorityFieldType( *this ); break;
+/*?*/ default:
+/*?*/ Warning(); break;
+/*N*/ }
+/*N*/ CloseRec( SWG_FIELDTYPE );
+/*N*/ return p;
+/*N*/ }
+
+// Schreiben eines Feldtyps
+
+
+
+/*N*/ BOOL Sw3IoImp::OutFieldType( const SwFieldType& rType )
+/*N*/ {
+/*N*/ USHORT nFld = rType.Which();
+/*N*/
+/*N*/ if( IsSw31Or40Export() && RES_AUTHORITY == nFld )
+/*N*/ {
+/*N*/ SwSetExpFieldType aType( pDoc,
+/*N*/ String::CreateFromAscii(sSW3IO_AuthorityField),
+/*N*/ GSE_STRING );
+/*N*/ return OutFieldType( aType );
+/*N*/ }
+/*N*/ /* #108791# */
+/*N*/ else if (RES_DROPDOWN == nFld)
+/*N*/ {
+/*N*/ SwSetExpFieldType aType( pDoc,
+/*N*/ String::CreateFromAscii(sSW3IO_DropDownField),
+/*N*/ GSE_STRING );
+/*N*/ return OutFieldType( aType );
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_FIELDTYPE );
+/*N*/
+/*N*/ *pStrm << (BYTE) ( nFld - RES_FIELDS_BEGIN );
+/*N*/
+/*N*/ switch( nFld )
+/*N*/ {
+/*N*/ case RES_DBFLD:
+/*N*/ lcl_sw3io_OutDBFieldType( *this, (SwDBFieldType*) &rType );
+/*N*/ break;
+/*N*/ case RES_USERFLD:
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ lcl_sw3io_OutUserFieldType40( *this, (SwUserFieldType*) &rType );
+/*N*/ else
+/*N*/ lcl_sw3io_OutUserFieldType( *this, (SwUserFieldType*) &rType );
+/*N*/ break;
+/*N*/ case RES_DDEFLD:
+/*N*/ lcl_sw3io_OutDDEFieldType( *this, (SwDDEFieldType*) &rType );
+/*N*/ nFileFlags |= SWGF_HAS_DDELNK;
+/*N*/ break;
+/*N*/ case RES_SETEXPFLD:
+/*N*/ lcl_sw3io_OutSetExpFieldType( *this, (SwSetExpFieldType*) &rType );
+/*N*/ break;
+/*N*/ case RES_AUTHORITY:
+/*N*/ lcl_sw3io_OutAuthorityFieldType( *this,
+/*N*/ (SwAuthorityFieldType *)&rType );
+/*N*/ break;
+/*N*/ default:
+/*N*/ ASSERT( !this, "Unbekannter Feldtyp" );
+/*N*/ CloseRec( SWG_FIELDTYPE );
+/*N*/ Error();
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ CloseRec( SWG_FIELDTYPE );
+/*N*/ return TRUE;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3fmts.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3fmts.cxx
new file mode 100644
index 000000000000..a61a027456dc
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3fmts.cxx
@@ -0,0 +1,1189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+#include <bf_svtools/itemiter.hxx>
+#include <bf_svx/svdmodel.hxx>
+#include <bf_svx/svdpage.hxx>
+
+#include <fmtfsize.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtanchr.hxx>
+#include <fmtcnct.hxx>
+#include <frmatr.hxx>
+#include <swtblfmt.hxx>
+
+// OD 27.06.2003 #108784#
+#include <fmtflcnt.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx>
+#include "swerror.h"
+#include "doc.hxx"
+#include "pagefrm.hxx"
+#include "cntfrm.hxx"
+#include "pam.hxx"
+#include "section.hxx"
+#include "flypos.hxx"
+#include "sw3imp.hxx"
+#include "poolfmt.hxx"
+#include "dcontact.hxx"
+#include "dflyobj.hxx"
+#include "flyfrm.hxx"
+#include "hints.hxx"
+#include "ndnotxt.hxx"
+namespace binfilter {
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Finden eines AttrSets nach Index
+
+SwFmt* lcl_sw3io__GetUserPoolFmt( USHORT nId, const SvPtrarr* pFmtArr )
+{
+ SwFmt* pFmt;
+ for( USHORT n = 0; n < pFmtArr->Count(); ++n )
+ if( nId == (pFmt = (SwFmt*)(*pFmtArr)[n])->GetPoolFmtId() )
+ return pFmt;
+ return 0;
+}
+
+// Whichwerte werden nach Gruppen gespreizt, so dass die einzelnen
+// Gruppen getrennt um neue Attribute erweitert werden koennen.
+
+// Umwandeln eines normalen Whichwertes in einen gespreizten Wert
+
+/*N*/ USHORT lcl_sw3io__ExpandWhich( USHORT nWhich )
+/*N*/ {
+/*N*/ // #95500#: There is no seperate range for box attributes in the file
+/*N*/ // format, but they are treated as graphic attributes!
+/*N*/ // Since we have extended the range of graphic attributes, we have
+/*N*/ // to move them back to RES_GRFATR_ROTATION, because that's where the
+/*N*/ // box attributes reange started in the 5.2..
+/*N*/ if( nWhich >= RES_BOXATR_BEGIN )
+/*N*/ return (nWhich <= RES_BOXATR_VALUE) ? (nWhich - RES_BOXATR_BEGIN + RES_GRFATR_ROTATION - RES_GRFATR_BEGIN + 0x6000) : 0;
+/*N*/ if( nWhich >= RES_GRFATR_BEGIN )
+/*N*/ return (nWhich <= RES_GRFATR_CROPGRF) ? (nWhich - RES_GRFATR_BEGIN + 0x6000) : 0;
+/*N*/ if( nWhich >= RES_FRMATR_BEGIN )
+/*N*/ return (nWhich <= RES_COLUMNBALANCE) ? (nWhich - RES_FRMATR_BEGIN + 0x5000) : 0;
+/*N*/ if( nWhich >= RES_PARATR_BEGIN )
+/*N*/ return (nWhich <= RES_PARATR_NUMRULE) ? (nWhich - RES_PARATR_BEGIN + 0x4000) : 0;
+/*N*/ if( nWhich >= RES_TXTATR_NOEND_BEGIN )
+/*N*/ return (nWhich <= RES_TXTATR_HARDBLANK) ? (nWhich - RES_TXTATR_NOEND_BEGIN + 0x3000) : 0;
+/*N*/ if( nWhich >= RES_TXTATR_WITHEND_BEGIN )
+/*N*/ return (nWhich <= RES_TXTATR_CHARFMT) ? (nWhich - RES_TXTATR_WITHEND_BEGIN + 0x2000) : 0;
+/*N*/ return (nWhich <= RES_CHRATR_BACKGROUND) ? (nWhich - RES_CHRATR_BEGIN + 0x1000) : 0;
+/*N*/ }
+
+// Umwandeln eines gespreizten Whichwertes in den normalen Wert
+
+/*N*/ USHORT lcl_sw3io__CompressWhich( USHORT nWhich, USHORT nVersion )
+/*N*/ {
+/*N*/ if( nWhich >= 0x6000 )
+/*N*/ {
+/*N*/ // #95500#: Files written with the SWG_NEWGRFATTR version have the
+/*N*/ // extended grapic attribute range, but didn't correct it while
+/*N*/ // saving: File before that version didn't have the extended graphic
+/*N*/ // attribute range and need a correction. Files written with later
+/*N*/ // version did correct the range while saving and therfor need a
+/*N*/ // correction while loading, too.that version didn't have the extended graphic
+/*N*/ // attribute range and need a correction. Files written with later
+/*N*/ // version did correct the range while saving and therfor need a
+/*N*/ // correction while loading, too.
+/*N*/
+/*N*/ (nWhich -= 0x6000 ) += RES_GRFATR_BEGIN;
+/*N*/ if( SWG_NEWGRFATTR != nVersion && nWhich > RES_GRFATR_CROPGRF )
+/*N*/ nWhich += RES_GRFATR_END - RES_GRFATR_CROPGRF - 1;
+/*N*/ return nWhich;
+/*N*/ }
+/*N*/ if( nWhich >= 0x5000 )
+/*N*/ return nWhich - 0x5000 + RES_FRMATR_BEGIN;
+/*N*/ if( nWhich >= 0x4000 )
+/*N*/ return nWhich - 0x4000 + RES_PARATR_BEGIN;
+/*N*/ if( nWhich >= 0x3000 )
+/*N*/ return nWhich - 0x3000 + RES_TXTATR_NOEND_BEGIN;
+/*N*/ if( nWhich >= 0x2000 )
+/*N*/ return nWhich - 0x2000 + RES_TXTATR_WITHEND_BEGIN;
+/*N*/ if( nWhich >= 0x1000 )
+/*N*/ return nWhich - 0x1000 + RES_CHRATR_BEGIN;
+/*N*/ // Alte Dokumente vor dem 21.04.95
+/*N*/ return nWhich;
+/*N*/ }
+
+sal_Bool lcl_sw3io_insFtn( const SwTxtNode *pTxtNd )
+{
+ ASSERT( pTxtNd, "There is the text node?" );
+ if( !pTxtNd )
+ return FALSE;
+
+ const SwStartNode *pSttNd = pTxtNd->FindStartNode();
+ while( pSttNd &&
+ (pSttNd->IsTableNode() || pSttNd->IsSectionNode() ||
+ SwTableBoxStartNode == pSttNd->GetStartNodeType() ) )
+ pSttNd = pSttNd->FindStartNode();
+ return !pSttNd || SwNormalStartNode == pSttNd->GetStartNodeType();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Einlesen eines Attributs
+// Falls Bgn und End nicht besetzt sind, wird STRING_LEN zurueckgeliefert.
+// Fall nur Bgn besetzt ist, ist End == Bgn
+
+// BYTE Flags
+// 0x10 - Beginn ist gueltig
+// 0x20 - Ende ist gueltig
+// UINT16 Which
+// UINT16 Attributversion
+// UINT16 Beginn (opt)
+// UINT16 Ende (opt)
+// Attribut
+
+/*N*/ SfxPoolItem* Sw3IoImp::InAttr( xub_StrLen& nBgn, xub_StrLen& nEnd,
+/*N*/ const SwTxtNode *pTxtNd )
+/*N*/ {
+/*N*/ nBgn = nEnd = STRING_LEN;
+/*N*/ OpenRec( SWG_ATTRIBUTE );
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ UINT16 nWhich, nVer;
+/*N*/ *pStrm >> nWhich >> nVer;
+/*N*/ nWhich = lcl_sw3io__CompressWhich( nWhich, nVersion );
+/*N*/ if( cFlags & 0x10 )
+/*N*/ {
+/*N*/ USHORT nBgn16;
+/*N*/ *pStrm >> nBgn16;
+/*N*/ nBgn = nBgn16;
+/*N*/ }
+/*N*/ if( cFlags & 0x20 )
+/*N*/ {
+/*N*/ USHORT nEnd16;
+/*N*/ *pStrm >> nEnd16;
+/*N*/ nEnd = nEnd16;
+/*N*/ }
+/*N*/ else
+/*N*/ nEnd = nBgn;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ SfxPoolItem* pItem = 0;
+/*N*/ // MIB 1.9.97: In der 3.0 geschriebene Crop-Attribute sind inkompatibel,
+/*N*/ // also ignorieren wir sie.
+/*N*/ if( POOLATTR_BEGIN <= nWhich && nWhich < POOLATTR_END &&
+/*N*/ ( nWhich!=RES_GRFATR_CROPGRF || IsVersion(SWG_NONUMLEVEL) ) )
+/*N*/ {
+/*N*/ if( nWhich != RES_TXTATR_FTN ||
+/*N*/ (nFlyLevel == 0 && (!bInsert || lcl_sw3io_insFtn(pTxtNd)) ) )
+/*N*/ {
+/*N*/ const SfxPoolItem& rDflt = pDoc->GetAttrPool().GetDefaultItem( nWhich );
+/*N*/ pItem = rDflt.Create( *pStrm, nVer );
+/*N*/
+/*N*/ // Don't insert charset color items that have the system charset
+/*N*/ // if( RES_CHRATR_CHARSETCOLOR == nWhich &&
+/*N*/ // ((SvxCharSetColorItem *)pItem)->GetCharSet() == eSysSet )
+/*N*/ // {
+/*N*/ // delete pItem;
+/*N*/ // pItem = 0;
+/*N*/ // }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( nFlyLevel == 0, "Fussnoten im Fly sind nicht erlaubt" );
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( SWG_ATTRIBUTE );
+/*N*/ return pItem;
+/*N*/ }
+
+// Schreiben eines Attributs
+
+/*N*/ void Sw3IoImp::OutAttr( const SfxPoolItem& rAttr, xub_StrLen nBgn,
+/*N*/ xub_StrLen nEnd )
+/*N*/ {
+/*N*/ USHORT nWhich = rAttr.Which();
+/*N*/
+/*N*/ // Items, die als Version USHRT_MAX zurueckgeben, wollen nicht
+/*N*/ // geschrieben werden
+/*N*/ long nFFVersion = pStrm->GetVersion();
+/*N*/ ASSERT( IsSw31Export() ? nFFVersion==SOFFICE_FILEFORMAT_31
+/*N*/ : (nFFVersion==SOFFICE_FILEFORMAT_40 ||
+/*N*/ nFFVersion==SOFFICE_FILEFORMAT_50),
+/*N*/ "FF-Version am Stream stimmt nicht" );
+/*N*/ USHORT nIVer = rAttr.GetVersion( (USHORT)nFFVersion );
+/*N*/ if( USHRT_MAX == nIVer )
+/*N*/ return;
+/*N*/
+/*N*/ // Das Zeichen-Hintergrund-Attribut gab es in der 3.1 auch noch nicht
+/*N*/ if( IsSw31Export() && RES_CHRATR_BACKGROUND==nWhich)
+/*N*/ return;
+/*N*/
+/*N*/ // Hints that start behind the maximum string length of version 5.2
+/*N*/ // don't have to be exported.
+/*N*/ if( nBgn != STRING_LEN && nBgn > STRING_MAXLEN52 )
+/*N*/ return;
+/*N*/ if( nEnd != STRING_LEN && nEnd > STRING_MAXLEN52 )
+/*N*/ nEnd = STRING_MAXLEN52;
+/*N*/
+/*N*/ if( nWhich != RES_TXTATR_FTN || nFlyLevel == 0 )
+/*N*/ {
+/*N*/ nWhich = lcl_sw3io__ExpandWhich( nWhich );
+/*N*/ // OD 27.06.2003 #108784# - disable export of drawing frame format in header/footer.
+/*N*/ bool bExport = true;
+/*N*/ {
+/*N*/ if ( RES_TXTATR_FLYCNT == rAttr.Which() )
+/*N*/ {
+/*N*/ bExport = static_cast<const SwFmtFlyCnt&>(rAttr).Sw3ioExportAllowed();
+/*N*/ }
+/*N*/ }
+/*N*/ if( bExport && nWhich )
+/*N*/ {
+/*N*/
+/*N*/ OpenRec( SWG_ATTRIBUTE );
+/*N*/ BYTE cFlags = 0x04; // Which + Version
+/*N*/ if( nBgn != STRING_LEN )
+/*N*/ cFlags += 0x12; // Begin
+/*N*/ if( nEnd != nBgn && nBgn != STRING_LEN )
+/*N*/ cFlags += 0x22; // End
+/*N*/ *pStrm << (BYTE) cFlags
+/*N*/ << (UINT16) nWhich
+/*N*/ << (UINT16) nIVer;
+/*N*/ if( cFlags & 0x10 )
+/*N*/ *pStrm << (UINT16) nBgn;
+/*N*/ if( cFlags & 0x20 )
+/*N*/ *pStrm << (UINT16) nEnd;
+/*N*/ rAttr.Store( *pStrm, nIVer );
+/*N*/ CloseRec( SWG_ATTRIBUTE );
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else
+/*N*/ ASSERT( !this, "Fussnoten im Fly sind nicht erlaubt" );
+/*N*/ #endif
+/*N*/ }
+
+// Einlesen eines AttrSets
+
+/*N*/ void Sw3IoImp::InAttrSet( SwAttrSet& rSet )
+/*N*/ {
+/*N*/ OpenRec( SWG_ATTRSET );
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ xub_StrLen n1, n2;
+/*N*/ SfxPoolItem* pItem = InAttr( n1, n2 );
+/*N*/ if( pItem )
+/*N*/ rSet.Put( *pItem ), delete pItem;
+/*N*/ }
+/*N*/ CloseRec( SWG_ATTRSET );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutAttrSet( const SfxItemSet& rSet, BOOL bSectionFmt )
+/*N*/ {
+/*N*/ if( rSet.Count() )
+/*N*/ {
+/*N*/ // Beim 3.1 Export den aktuellen Attrset merken
+/*N*/ const SfxItemSet *pOldExportItemSet;
+/*N*/ if( pExportInfo )
+/*N*/ {
+/*N*/ pOldExportItemSet = pExportInfo->pItemSet;
+/*N*/ pExportInfo->pItemSet = &rSet;
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_ATTRSET );
+/*N*/ SfxItemIter aIter( rSet );
+/*N*/ const SfxPoolItem* pAttr = aIter.GetCurItem();
+/*N*/ const SfxItemPool *pTmp = SfxItemPool::GetStoringPool();
+/*N*/ SfxItemPool::SetStoringPool( &pDoc->GetAttrPool() );
+/*N*/ for( USHORT i = 0; i < rSet.Count() && Good(); i++ )
+/*N*/ {
+/*N*/ // Header- und Footer- Attribute werden u.U. nicht rausgeschrieben,
+/*N*/ // wenn sie im Leftformat einer Seitenvorlage mit HdrShared
+/*N*/ // oder FtrShared vorliegen. Dann wird nur das Attribut im
+/*N*/ // MAsterformat gespeichert (siehe auch SW3PAGE.CXX, OutPageDesc())
+/*N*/ USHORT nWhich = pAttr->Which();
+/*N*/ BOOL bNoHdr = RES_HEADER == nWhich &&
+/*N*/ ( nGblFlags & SW3F_NOHDRFMT ) != 0;
+/*N*/ BOOL bNoFtr = RES_FOOTER == nWhich &&
+/*N*/ ( nGblFlags & SW3F_NOFTRFMT ) != 0;
+/*N*/ BOOL bNoCntnt = bSectionFmt && RES_CNTNT == nWhich;
+/*N*/ if( !( bNoHdr || bNoFtr || bNoCntnt) )
+/*N*/ OutAttr( *pAttr, STRING_LEN, STRING_LEN );
+/*N*/ pAttr = aIter.NextItem();
+/*N*/ }
+/*N*/ if( IsSw31Export() && pExportInfo && pExportInfo->bFlyFrmFmt )
+/*N*/ {
+/*N*/ // Wenn ein FlyFrm-Format exportiert wird, muss beruecksichtigt
+/*N*/ // werden, dass die Raender jetzt nicht mehr Bestandteil der
+/*N*/ // Rahmengroesse sind. Weil die Vorlagen nicht angepasst werden,
+/*N*/ // wird ggf. hart attributiert
+/*N*/ const SvxLRSpaceItem& rLRSpace =
+/*N*/ (const SvxLRSpaceItem&)rSet.Get( RES_LR_SPACE );
+/*N*/ const SvxULSpaceItem& rULSpace =
+/*N*/ (const SvxULSpaceItem&)rSet.Get( RES_UL_SPACE );
+/*N*/
+/*N*/ if( SFX_ITEM_SET != rSet.GetItemState( RES_FRM_SIZE, FALSE ) )
+/*N*/ {
+/*N*/ const SwFmtFrmSize& rFrmSize =
+/*N*/ (const SwFmtFrmSize&)rSet.Get( RES_FRM_SIZE );
+/*N*/ Size aConvSize(
+/*N*/ rFrmSize.GetSizeConvertedToSw31( &rLRSpace, &rULSpace ) );
+/*N*/
+/*N*/ if( rFrmSize.GetSize() != aConvSize )
+/*N*/ {
+/*?*/ SwFmtFrmSize aFrmSize( rFrmSize );
+/*?*/ aFrmSize.SetSize( aConvSize );
+/*?*/ OutAttr( aFrmSize, STRING_LEN, STRING_LEN );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET != rSet.GetItemState( RES_HORI_ORIENT, FALSE ) )
+/*N*/ {
+/*?*/ const SwFmtHoriOrient rHori =
+/*?*/ (const SwFmtHoriOrient&)rSet.Get( RES_HORI_ORIENT );
+/*?*/
+/*?*/ if( rHori.GetRelationOrient() > PRTAREA ||
+/*?*/ rHori.GetPos() != rHori.GetPosConvertedToSw31( &rLRSpace ) )
+/*?*/ OutAttr( rHori, STRING_LEN, STRING_LEN );
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET != rSet.GetItemState( RES_VERT_ORIENT, FALSE ) )
+/*N*/ {
+/*?*/ const SwFmtVertOrient rVert =
+/*?*/ (const SwFmtVertOrient&)rSet.Get( RES_VERT_ORIENT );
+/*?*/
+/*?*/ SwTwips nConvPos = rVert.GetPosConvertedToSw31( &rULSpace );
+/*?*/ if( rVert.GetPos() != nConvPos )
+/*?*/ {
+/*?*/ SwFmtVertOrient aVert( rVert );
+/*?*/ aVert.SetPos( nConvPos );
+/*?*/ OutAttr( aVert, STRING_LEN, STRING_LEN );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SfxItemPool::SetStoringPool( pTmp );
+/*N*/ CloseRec( SWG_ATTRSET );
+/*N*/
+/*N*/ // Beim 3.1 Export den alten Attrset zuruecksetzen
+/*N*/ if( pExportInfo )
+/*N*/ pExportInfo->pItemSet = pOldExportItemSet;
+/*N*/ }
+/*N*/ }
+
+// Ein Format einlesen
+// Hier wird das Format auch erzeugt, falls es nicht uebergeben wurde.
+
+/*N*/ SwFmt* Sw3IoImp::InFormat( BYTE cKind, SwFmt* pFmt )
+/*N*/ {
+/*N*/ if( !OpenRec( cKind ) )
+/*N*/ {
+/*N*/ CloseRec( SWG_EOF );
+/*N*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ // Ist der Drawing Layer korrekt geladen?
+/*N*/ if( cKind == SWG_SDRFMT && ( nGblFlags & SW3F_NODRAWING ) )
+/*N*/ {
+/*?*/ Warning();
+/*?*/ CloseRec( cKind );
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ if( cKind == SWG_FLYFMT || cKind == SWG_SDRFMT ) nFlyLevel++;
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ BYTE cMoreFlags = 0;
+/*N*/ USHORT nDerived, nPoolId, nStrIdx = IDX_NO_VALUE;
+/*N*/ SdrObject* pSdrObj = NULL;
+/*N*/ *pStrm >> nDerived >> nPoolId;
+/*N*/ // 0x0L - Laenge der Daten
+/*N*/ // 0x10 - Namensindex des Formats folgt
+/*N*/ // 0x20 - SdrObject-Referenz folgt
+/*N*/ if( cFlags & 0x10 )
+/*N*/ *pStrm >> nStrIdx;
+/*N*/ if( cFlags & 0x20 )
+/*N*/ {
+/*N*/ // Sdr-Objekt aus SdrModel auslesen
+/*N*/ UINT32 nObjRef;
+/*N*/ *pStrm >> nObjRef;
+/*N*/ nObjRef += nZOrderOff;
+/*N*/ SdrPage* pPg = pDoc->MakeDrawModel()->GetPage( 0 );
+/*N*/ switch( cKind )
+/*N*/ {
+/*N*/ case SWG_FLYFMT:
+/*N*/ if( ( nVersion < SWG_ZORDER )
+/*N*/ || ( nGblFlags & SW3F_NODRAWING ) )
+/*N*/ {
+/*N*/ pSdrObj = new SwFlyDrawObj;
+/*N*/ pPg->InsertObject( pSdrObj, nObjRef );
+/*N*/ break;
+/*N*/ }
+/*N*/ // sonst kann durchgerauscht werden, da
+/*N*/ // LoadDrawingLayer() die Objekte schon angelegt hat
+/*N*/ case SWG_SDRFMT:
+/*N*/ if( nObjRef >= pPg->GetObjCount() )
+/*N*/ {
+/*?*/ ASSERT( !this, "Ungueltige SdrObject-Nummer" );
+/*?*/ nObjRef = 0;
+/*?*/ Error();
+/*N*/ }
+/*N*/ pSdrObj = pPg->GetObj( nObjRef );
+/*N*/ // All sdr object have to be in the hidden layer initially.
+/*N*/ // They will be moved in the visible one when the layout
+/*N*/ // will be created.
+/*N*/ if( SWG_SDRFMT==cKind )
+/*N*/ pSdrObj->NbcSetLayer( pDoc->GetInvisibleLayerIdByVisibleOne( pSdrObj->GetLayer() ) );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ BOOL bMoreFlags;
+/*N*/ if( IsVersion(SWG_LONGIDX) )
+/*N*/ bMoreFlags = (cFlags & 0x80) != 0;
+/*N*/ else
+/*N*/ bMoreFlags = (cFlags & 0x40) != 0;
+/*N*/
+/*N*/ if( bMoreFlags )
+/*N*/ *pStrm >> cMoreFlags;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ BOOL bReadName;
+/*N*/ if( IsVersion(SWG_LONGIDX) )
+/*N*/ bReadName = (cMoreFlags & 0x20) != 0;
+/*N*/ else
+/*N*/ bReadName = nStrIdx == IDX_NO_VALUE;
+/*N*/
+/*N*/ String aName;
+/*N*/ if( bReadName )
+/*N*/ {
+/*N*/ InString( *pStrm, aName );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aName = aStringPool.Find( nStrIdx );
+/*N*/ }
+/*N*/
+/*N*/ // Line und Box-Formate habe keinen Namen mehr.
+/*N*/ if( !IsVersion(SWG_LONGIDX) && pFmt &&
+/*N*/ ( pFmt->IsA(TYPE(SwTableLineFmt)) || pFmt->IsA(TYPE(SwTableBoxFmt)) ) )
+/*N*/ {
+/*N*/ aName = aEmptyStr;
+/*N*/ }
+/*N*/
+/*N*/ // Format erzeugen
+/*N*/ if( !pFmt )
+/*N*/ {
+/*N*/ switch( cKind )
+/*N*/ {
+/*N*/ case SWG_FREEFMT:
+/*N*/ // Freifliegende Frameformate werden von Headers
+/*N*/ // und Footers verwendet.
+/*N*/ pFmt = new SwFrmFmt( pDoc->GetAttrPool(), aName,
+/*N*/ pDoc->GetDfltFrmFmt() );
+/*N*/ break;
+/*?*/ case SWG_FRAMEFMT:
+/*?*/ if( IDX_NO_VALUE != nPoolId )
+/*?*/ {
+/*?*/ if( IsPoolUserFmt( nPoolId ) )
+/*?*/ {
+/*?*/ // wir suchen uns das richtige Format
+ if( 0 == ( pFmt = lcl_sw3io__GetUserPoolFmt( nPoolId,
+/*?*/ pDoc->GetFrmFmts() )) )
+/*?*/ pFmt = lcl_sw3io__GetUserPoolFmt( nPoolId,
+/*?*/ pDoc->GetSpzFrmFmts() );
+/*?*/ ASSERT( pFmt, "Format not found." );
+/*?*/ }
+/*?*/ else
+/*?*/ pFmt = pDoc->GetFrmFmtFromPool( nPoolId );
+/*?*/ }
+/*?*/ if( !pFmt )
+/*?*/ pFmt = pDoc->MakeFrmFmt( aName,
+/*?*/ (SwFrmFmt*) FindFmt( nDerived, cKind ) );
+/*?*/ else
+/*?*/ pFmt->ResetAllAttr();
+/*?*/
+/*?*/ break;
+/*N*/ case SWG_FLYFMT:
+/*N*/ if( pSdrObj && pSdrObj->GetUserCall() )
+/*N*/ {
+/*N*/ //s.u., und auch bugdoc 28336.sdw beim schliessen nach laden.
+/*?*/ ASSERT( !this, "More than one Format" );
+/*?*/ CloseRec( cKind );
+/*?*/ nFlyLevel--;
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ pFmt = pDoc->MakeFlyFrmFmt( aName,
+/*N*/ (SwFlyFrmFmt*) FindFmt( nDerived, cKind ) );
+/*N*/ if ( pSdrObj )
+/*N*/ new SwFlyDrawContact( (SwFrmFmt*) pFmt, pSdrObj );
+/*N*/ break;
+/*N*/ case SWG_SDRFMT:
+/*N*/ if ( pSdrObj && (pSdrObj->ISA(SwFlyDrawObj) ||
+/*N*/ pSdrObj->GetUserCall()) )
+/*N*/ {
+/*N*/ // Pruefen, ob das Draw-Objekt nicht etwa zu einem
+/*N*/ // Fly-Frame-Format gehoert oder schon verwendet wurde.
+/*N*/ // Kann passieren, weil sich manche Draw-Objekte selber
+/*N*/ // zerstoeren, ohne dass das Format geloescht wird. Leider
+/*N*/ // wurden solche Format bisher auch rausgeschreiben.
+/*N*/ // (bug fix #25354# fuer alte Doks)
+/*?*/ CloseRec( cKind );
+/*?*/ nFlyLevel--;
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ pFmt = pDoc->MakeDrawFrmFmt( aName,
+/*N*/ (SwFrmFmt*) FindFmt( nDerived, cKind ) );
+/*N*/ if( pSdrObj )
+/*N*/ new SwDrawContact( (SwFrmFmt*) pFmt, pSdrObj );
+/*N*/ break;
+/*N*/ case SWG_SECTFMT:
+/*N*/ pFmt = pDoc->MakeSectionFmt(
+/*N*/ (SwSectionFmt*) FindFmt( nDerived, cKind ) );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Fuellen eines vorhandenen Formats
+/*N*/ pFmt->ResetAllAttr();
+/*N*/ if( nDerived != IDX_NO_VALUE )
+/*N*/ pFmt->SetDerivedFrom( FindFmt( nDerived, cKind ) );
+/*N*/ }
+/*N*/
+/*N*/ if( nPoolId != IDX_NO_VALUE )
+/*N*/ pFmt->SetPoolFmtId( nPoolId );
+/*N*/
+/*N*/ if( cMoreFlags & 0x01 )
+/*?*/ pFmt->SetAutoUpdateFmt();
+/*N*/
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ BYTE cSubtype = Peek();
+/*N*/ switch( cSubtype )
+/*N*/ {
+/*N*/ case SWG_ATTRSET:
+/*N*/ InAttrSet( (SwAttrSet&) pFmt->GetAttrSet() );
+/*N*/ ((SwAttrSet&)pFmt->GetAttrSet()).SetModifyAtAttr( pFmt );
+/*N*/
+/*N*/ if( cKind == SWG_FLYFMT &&
+/*N*/ !IsVersion( SWG_URLANDMAP, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ // In 31-FFohne URL-Attribut muss das Attribut noch vom
+/*N*/ // Node in das Format verschoben werden
+/*N*/ SwNoTxtNode *pNd = pDoc->GetNodes()[
+/*N*/ pFmt->GetCntnt().GetCntntIdx()->GetIndex()+1 ]->GetNoTxtNode();
+/*N*/
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if ( pNd && SFX_ITEM_SET == pNd->GetSwAttrSet().
+/*N*/ GetItemState( RES_URL, FALSE, &pItem))
+/*N*/ {
+/*N*/ pFmt->SetAttr( *pItem );
+/*N*/ pNd->ResetAttr( RES_URL );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nVersion < SWG_DESKTOP40 && cKind == SWG_FLYFMT )
+/*N*/ {
+/*N*/ // In SW31-FlyFrm-Formaten muessen ein par Attrs
+/*N*/ // korregiert werden. Sie werden immer gesetzt, da sie
+/*N*/ // in den Vorlagen nicht korregiert wurden.
+/*N*/ const SvxLRSpaceItem& rLRSpace = pFmt->GetLRSpace();
+/*N*/ const SvxULSpaceItem& rULSpace = pFmt->GetULSpace();
+/*N*/
+/*N*/ const SwFmtFrmSize& rFrmSize = pFmt->GetFrmSize();
+/*N*/ Size aConvSize(
+/*N*/ rFrmSize.GetSizeConvertedFromSw31( &rLRSpace,
+/*N*/ &rULSpace ) );
+/*N*/ if( rFrmSize.GetSize() != aConvSize )
+/*N*/ {
+/*?*/ SwFmtFrmSize aFrmSize( rFrmSize );
+/*?*/ aFrmSize.SetSize( aConvSize );
+/*?*/ pFmt->SetAttr( aFrmSize );
+/*N*/ }
+/*N*/
+/*N*/ const SwFmtHoriOrient& rHori = pFmt->GetHoriOrient();
+/*N*/ SwTwips nConvPos =
+/*N*/ rHori.GetPosConvertedFromSw31( &rLRSpace );
+/*N*/ if( rHori.GetPos() != nConvPos )
+/*N*/ {
+/*?*/ SwFmtHoriOrient aHori( rHori );
+/*?*/ aHori.SetPos( nConvPos );
+/*?*/ pFmt->SetAttr( aHori );
+/*N*/ }
+/*N*/
+/*N*/ const SwFmtVertOrient& rVert = pFmt->GetVertOrient();
+/*N*/ nConvPos = rVert.GetPosConvertedFromSw31( &rULSpace );
+/*N*/ if( rVert.GetPos() != nConvPos )
+/*N*/ {
+/*N*/ SwFmtVertOrient aVert( rVert );
+/*N*/ aVert.SetPos( nConvPos );
+/*N*/ pFmt->SetAttr( aVert );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( cKind == SWG_FLYFMT && IsVersion( SWG_LONGIDX ) )
+/*N*/ {
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if( SFX_ITEM_SET == pFmt->GetAttrSet().
+/*N*/ GetItemState( RES_CHAIN, FALSE, &pItem) )
+/*N*/ {
+/*?*/ const SwFmtChain *pChain =
+/*?*/ (const SwFmtChain *)pItem;
+/*?*/
+/*?*/ // Den Next des Prev richtig setzen.
+/*?*/ SwFlyFrmFmt *pFlyFmt = pChain->GetPrev();
+/*?*/ if( pFlyFmt )
+/*?*/ {
+/*?*/ SwFmtChain aChain( pFlyFmt->GetChain() );
+/*?*/ ASSERT( !aChain.GetNext(),
+/*?*/ "Next ist bereits verkettet" );
+/*?*/ aChain.SetNext( (SwFlyFrmFmt *)pFmt );
+/*?*/ pFlyFmt->SetAttr( aChain );
+/*?*/ }
+/*?*/
+/*?*/ // Den Prev des Next richtig setzen.
+/*?*/ pFlyFmt = pChain->GetNext();
+/*?*/ if( pFlyFmt )
+/*?*/ {
+/*?*/ SwFmtChain aChain( pFlyFmt->GetChain() );
+/*?*/ ASSERT( !aChain.GetPrev(),
+/*?*/ "Prev ist bereits verkettet" );
+/*?*/ aChain.SetPrev( (SwFlyFrmFmt *)pFmt );
+/*?*/ pFlyFmt->SetAttr( aChain );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bInsert )
+/*N*/ {
+/*N*/ // das Format hat sich geaendert!
+/*?*/ SwFmtChg aHint( pFmt );
+/*?*/ pFmt->Modify( &aHint, &aHint );
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ SkipRec();
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( cKind );
+/*N*/
+/*N*/ if( cKind == SWG_SDRFMT &&
+/*N*/ !IsVersion( SWG_WRAPDRAWOBJ, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ pFmt->SetAttr( SwFmtSurround( SURROUND_THROUGHT ) );
+/*N*/
+/*N*/ // beim Einfuegen eines Dokuments muessen Rahmen, Grafiken und
+/*N*/ // OLE-Nodes noch einen eindeutigen Namen bekommen
+/*N*/ // This must happen always, because there are lots of documents
+/*N*/ // that contain frames with the same name.
+/*N*/ if( cKind == SWG_FLYFMT )
+/*N*/ {
+/*N*/ const SwNode* pNd =
+/*N*/ pDoc->GetNodes()[ pFmt->GetCntnt().GetCntntIdx()->GetIndex()+1 ];
+/*N*/ BYTE nNdTyp = !pNd->IsNoTxtNode() ? ND_TEXTNODE : pNd->GetNodeType();
+/*N*/
+/*N*/ pFmt->SetName( aEmptyStr );
+/*N*/
+/*N*/ // If the name is not changed, its extension must be kept to be able
+/*N*/ // to load the layout.
+/*N*/ String aSrchName( aName );
+/*N*/ aStringPool.RemoveExtension( aSrchName );
+/*N*/ if( bInsert )
+/*N*/ aName = aSrchName;
+/*N*/
+/*N*/ if( pDoc->FindFlyByName( aSrchName, nNdTyp ) )
+/*N*/ {
+/*?*/ switch( nNdTyp )
+/*?*/ {
+/*?*/ case ND_TEXTNODE:
+/*?*/ aName = pDoc->GetUniqueFrameName();
+/*?*/ break;
+/*?*/ case ND_GRFNODE:
+/*?*/ aName = pDoc->GetUniqueGrfName();
+/*?*/ break;
+/*?*/ case ND_OLENODE:
+/*?*/ aName = pDoc->GetUniqueOLEName();
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pFmt->SetName( aName );
+/*N*/ if( cKind == SWG_FLYFMT || cKind == SWG_SDRFMT )
+/*N*/ nFlyLevel--;
+/*N*/
+/*N*/ // OPT: Cache fuer Formate im StringPool
+/*N*/ if( nStrIdx != IDX_NO_VALUE )
+/*N*/ aStringPool.SetCachedFmt( nStrIdx, pFmt );
+/*N*/ // /OPT: Cache fuer Formate im StringPool
+/*N*/
+/*N*/ return pFmt;
+/*N*/ }
+
+// Ausgabe eines Formats:
+// BYTE Flags
+// 0x10 - Namensindex des Formats folgt
+// 0x20 - SdrObject-Referenz folgt
+// UINT16 String-ID des Parents (IDX_NO_VALUE: Formatname folgt)
+// UINT16 Pool-ID
+// UINT16 String-ID des Formatnamens (opt.)
+// INT32 Z-Order des Drawing-Objekts (opt.)
+// String Name des Formats, falls nicht im Pool gefunden (opt.)
+// SWG_ATTRSET Attribute (opt.)
+
+/*N*/ void Sw3IoImp::OutFormat( BYTE cType, const SwFmt& rFmt )
+/*N*/ {
+/*N*/ // Freifliegende Formate werden immer geschrieben, da sie niemals
+/*N*/ // mehrfach referenziert werden!
+/*N*/ if( cType != SWG_FREEFMT && cType != SWG_SECTFMT && rFmt.IsWritten() )
+/*N*/ return;
+/*N*/
+/*N*/ OpenRec( cType );
+/*N*/ // Von welchem Format isses abgeleitet?
+/*N*/ USHORT nDerived = IDX_NO_VALUE;
+/*N*/ SwFmt* pDerived = rFmt.DerivedFrom();
+/*N*/ if( pDerived && SWG_SECTFMT == cType )
+/*N*/ {
+/*N*/ // The parent format of TOX content sections must not to be stored,
+/*N*/ // because the parent format will not exist if the document is read
+/*N*/ // again. In fact, this format is copied to a newly created one only.
+/*N*/ // The parent format of TOX header sections has not to be stored,
+/*N*/ // because the section is inserted into the newly created TOX content
+/*N*/ // section and that for will be replaced always.
+/*N*/ const SwSectionFmt* pSectFmt = PTR_CAST( SwSectionFmt, &rFmt );
+/*N*/ ASSERT( pSectFmt, "no section format?" );
+/*N*/ if( pSectFmt )
+/*N*/ {
+/*N*/ const SwSection* pSect = pSectFmt->GetSection();
+/*N*/ if( pSect && (TOX_CONTENT_SECTION == pSect->GetType() ||
+/*N*/ TOX_HEADER_SECTION == pSect->GetType()) )
+/*N*/ {
+/*N*/ pDerived = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pDerived )
+/*N*/ {
+/*N*/ if( pDerived->IsDefault() )
+/*N*/ nDerived = IDX_DFLT_VALUE;
+/*N*/ else
+/*N*/ nDerived = aStringPool.Find( pDerived->GetName(),
+/*N*/ pDerived->GetPoolFmtId() );
+/*N*/ }
+/*N*/ // Flag Bits:
+/*N*/ // SW3.1/4.0: Byte 1
+/*N*/ // 0x0L - Laenge der Daten
+/*N*/ // 0x10 - Namensindex des Formats folgt
+/*N*/ // 0x20 - SdrObject-Referenz folgt
+/*N*/ // 0x40 - zusaetzliches Flag-Byte folgt (nur 4.0)
+/*N*/ // SW3.1/40: Byte 2
+/*N*/ // 0x01 - Auto-Update-Fmt (nur 4.0)
+/*N*/ // SW5.0
+/*N*/ // 0x0L - Laenge der Daten
+/*N*/ // 0x10 - Namensindex des Formats folgt
+/*N*/ // 0x20 - SdrObject-Referenz folgt
+/*N*/ // 0x40 - frei (fuer ein haeufig benutztes Flag gedacht)
+/*N*/ // 0x80 - zusaetzliches Flag-Byte folgt
+/*N*/ // SW5.0: Byte 2
+/*N*/ // 0x01 - Auto-Update-Fmt
+/*N*/ // 0x02 - Name des Formats ist als String enthalten
+/*N*/ BYTE cFlags = 0x04; // Derived, PoolId
+/*N*/ BYTE cMoreFlags = 0x00;
+/*N*/
+/*N*/ const SwFlyFrm* pExportFlyFrm = NULL;
+/*N*/
+/*N*/ if( rFmt.IsAutoUpdateFmt() && !IsSw31Export() )
+/*N*/ cMoreFlags += 0x01;
+/*N*/
+/*N*/ ULONG nSdrRef = 0;
+/*N*/ USHORT nStrIdx = IDX_NO_VALUE;
+/*N*/ BOOL bWriteName = FALSE;
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ if( SWG_FRAMEFMT==cType && ( rFmt.IsA(TYPE(SwTableLineFmt)) ||
+/*N*/ rFmt.IsA(TYPE(SwTableBoxFmt)) ) )
+/*N*/ {
+/*N*/ nStrIdx = GetTblLineBoxFmtStrPoolId40( (SwFrmFmt *)&rFmt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nStrIdx = aStringPool.Find( rFmt.GetName(), rFmt.GetPoolFmtId() );
+/*N*/ }
+/*N*/ if( nStrIdx != IDX_NO_VALUE )
+/*N*/ cFlags += 0x12;
+/*N*/ else
+/*N*/ bWriteName = TRUE;
+/*N*/
+/*N*/ if( cMoreFlags != 0 )
+/*N*/ cFlags += 0x41;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( rFmt.GetName().Len() )
+/*N*/ {
+/*N*/ nStrIdx = aStringPool.Find( rFmt.GetName(), rFmt.GetPoolFmtId() );
+/*N*/ if( nStrIdx != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ cFlags += 0x12;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ cMoreFlags += 0x20;
+/*N*/ bWriteName = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( cMoreFlags != 0 )
+/*N*/ cFlags += 0x81;
+/*N*/ }
+/*N*/
+/*N*/ // #72785#: In organizer mode, no drawing layer will be written. That for
+/*N*/ // no sdr object references must be written.
+/*N*/ if( !bOrganizer )
+/*N*/ {
+/*N*/ // Gibt es ein SdrObject?
+/*N*/ // Zur Zeit nur fuer SDR-Formate!!!
+/*N*/ if( cType == SWG_SDRFMT )
+/*N*/ {
+/*N*/ // Schauen, ob es ein SdrObject dafuer gibt
+/*N*/ SwClientIter aIter( (SwFmt&) rFmt );
+/*N*/ if( aIter.First( TYPE(SwDrawContact) ) )
+/*N*/ {
+/*N*/ nSdrRef = ((SwDrawContact*)aIter())->GetMaster()->GetOrdNum();
+/*N*/ cFlags += 0x24;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( cType == SWG_FLYFMT )
+/*N*/ {
+/*N*/ // Schauen, ob es ein SdrObject dafuer gibt
+/*N*/ SwClientIter aIter( (SwFmt&) rFmt );
+/*N*/ if( aIter.First( TYPE( SwFlyFrm) ) )
+/*N*/ {
+/*N*/ pExportFlyFrm = (SwFlyFrm*)aIter();
+/*N*/ nSdrRef = pExportFlyFrm->GetVirtDrawObj()->GetOrdNum();
+/*N*/ cFlags += 0x24;
+/*N*/ }
+/*N*/ else if( aIter.First( TYPE( SwFlyDrawContact) ) )
+/*N*/ {
+/*N*/ // fix #45256#: Wenn Seitenvorlagen eines Doks importiert werden,
+/*N*/ // werden dafuer u.U. Master-Objekte in die Page eingetragen.
+/*N*/ // Wenn diese jetzt noch in der Page stehen, muss dafuer gesorgt
+/*N*/ // werden, dass beim Laden des Dokuments wieder an der gleichen
+/*N*/ // Stelle Master-Objekte angelegt werden, weil sonst die Indizes
+/*N*/ // der Zeichen-Objekte in der Page nicht stimmen.
+/*N*/ const SdrObject *pMaster =
+/*N*/ ((SwFlyDrawContact*)aIter())->GetMaster();
+/*N*/ if( pMaster->GetPage() )
+/*N*/ {
+/*?*/ nSdrRef = pMaster->GetOrdNum();
+/*?*/ cFlags += 0x24;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( (cFlags & 0x20) && pRefSdrObjects )
+/*N*/ {
+/*N*/ size_t nPos = nSdrRef / 8;
+/*N*/ BYTE nByte = 1 << (nSdrRef % 8);
+/*N*/ ASSERT( (pRefSdrObjects[nPos] & nByte) == 0,
+/*N*/ "Zeichen-Object doppelt referenziert" );
+/*N*/
+/*N*/ pRefSdrObjects[nPos] |= nByte;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ USHORT nPoolId = rFmt.GetPoolFmtId();
+/*N*/ // In Colls darf nur das FrmFmt einen PoolId haben
+/*N*/ if( nPoolId == USHRT_MAX )
+/*N*/ nPoolId = IDX_NO_VALUE;
+/*N*/ *pStrm << (BYTE) cFlags
+/*N*/ << (UINT16) nDerived
+/*N*/ << (UINT16) nPoolId;
+/*N*/ if( cFlags & 0x10 )
+/*N*/ *pStrm << (UINT16) nStrIdx;
+/*N*/ if( cFlags & 0x20 )
+/*N*/ *pStrm << (INT32) nSdrRef;
+/*N*/ if( cMoreFlags != 0 )
+/*N*/ *pStrm << (BYTE) cMoreFlags;
+/*N*/
+/*N*/ // Falls der Name nicht im Pool ist, direkt raus damit!
+/*N*/ if( bWriteName )
+/*N*/ OutString( *pStrm, rFmt.GetName() );
+/*N*/
+/*N*/ BOOL bOldExportFlyFrmFmt;
+/*N*/ const SwFlyFrm* pOldExportFlyFrm;
+/*N*/ if( pExportInfo )
+/*N*/ {
+/*N*/ bOldExportFlyFrmFmt = pExportInfo->bFlyFrmFmt;
+/*N*/ pOldExportFlyFrm = pExportInfo->pFlyFrm;
+/*N*/ pExportInfo->bFlyFrmFmt = (cType == SWG_FLYFMT);
+/*N*/ pExportInfo->pFlyFrm = pExportFlyFrm;
+/*N*/ }
+/*N*/ OutAttrSet( rFmt.GetAttrSet(), SWG_SECTFMT == cType );
+/*N*/ if( pExportInfo )
+/*N*/ {
+/*N*/ pExportInfo->bFlyFrmFmt = bOldExportFlyFrmFmt;
+/*N*/ pExportInfo->pFlyFrm = pOldExportFlyFrm;
+/*N*/ }
+/*N*/ CloseRec( cType );
+/*N*/ if( cType != SWG_FREEFMT && cType != SWG_SECTFMT )
+/*N*/ ((SwFmt&)rFmt).SetWritten();
+/*N*/ }
+
+////////////////////////////////////////////////////////////////////////////
+
+// globale FlyFrames
+
+/*N*/ void Sw3IoImp::InFlyFrames()
+/*N*/ {
+/*N*/ BOOL bInsIntoHdrFtrSave = bInsIntoHdrFtr; // In seitengebundenen sind
+/*N*/ bInsIntoHdrFtr = FALSE; // Draw-Objekte immer erlaubt
+/*N*/
+/*N*/ USHORT nPageNumOff = 0;
+/*N*/ if( bInsert ) // im einfuege Modus?
+/*N*/ {
+/*N*/ // dann binde die Seitengebundenen an die akt. Seite + Nummer
+/*N*/ // Dazu stelle erstmal fest, ob es ueberhaupt einen entsprechen
+/*N*/ // Offset gibt.
+/*N*/ SwFrm* pFrm;
+/*?*/ SwCntntNode* pCNd = pDoc->GetNodes()[ pCurPaM->GetPoint()->nNode ]->GetCntntNode();
+/*?*/ if( pCNd && 0 != ( pFrm = pCNd->GetFrm() ))
+/*?*/ nPageNumOff = pFrm->FindPageFrm()->GetPhyPageNum() - 1;
+/*N*/ }
+/*N*/
+/*N*/ USHORT eSave_StartNodeType = eStartNodeType;
+/*N*/ eStartNodeType = SwFlyStartNode;
+/*N*/
+/*N*/ OpenRec( SWG_FLYFRAMES );
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ BYTE cType = Peek();
+/*N*/ if( cType == SWG_FLYFMT || cType == SWG_SDRFMT )
+/*N*/ {
+/*N*/ SwFmt* pFmt = InFormat( cType, NULL );
+/*N*/ ASSERT( !pFmt || FLY_PAGE >= pFmt->GetAnchor().GetAnchorId(),
+/*N*/ "Rahmen ist ungueltig gebunden" );
+/*N*/ if( pFmt && nPageNumOff )
+/*N*/ {
+/*?*/ const SwFmtAnchor& rOld = pFmt->GetAnchor();
+/*?*/ if( FLY_PAGE == rOld.GetAnchorId() )
+/*?*/ {
+/*?*/ pFmt->SetAttr( SwFmtAnchor( FLY_PAGE,
+/*?*/ nPageNumOff + rOld.GetPageNum() ) );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ Error();
+/*N*/ }
+/*N*/ CloseRec( SWG_FLYFRAMES );
+/*N*/ eStartNodeType = eSave_StartNodeType;
+/*N*/ bInsIntoHdrFtr = bInsIntoHdrFtrSave;
+/*N*/ }
+
+// Ausgabe von FlyFrames, die nicht an einem Node kleben
+
+/*N*/ void Sw3IoImp::OutFlyFrames( SwPaM& rPaM )
+/*N*/ {
+/*N*/ if( bSaveAll )
+/*N*/ {
+/*N*/ // Alle Frames: ueber das Array gehen
+/*N*/ const SwSpzFrmFmts* pFlys = pDoc->GetSpzFrmFmts();
+/*N*/ USHORT nArrLen = pFlys->Count();
+/*N*/ if( nArrLen )
+/*N*/ {
+/*N*/ OpenRec( SWG_FLYFRAMES );
+/*N*/ for( USHORT i = 0; i < nArrLen; i++ )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = (*pFlys)[ i ];
+/*N*/ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+/*N*/ switch( rAnchor.GetAnchorId() )
+/*N*/ {
+/*N*/ case FLY_AT_CNTNT:
+/*N*/ case FLY_AUTO_CNTNT:
+/*N*/ case FLY_IN_CNTNT:
+/*N*/ break; // nicht die, die am Node kleben
+/*N*/ case FLY_AT_FLY:
+/*N*/ // Rahmengebunde Rahmen werden als seitengebunde
+/*N*/ // Rahmen ins 3.1/4.0-Format exportiert. Sonst
+/*N*/ // werden sie in der Section exportiert.
+/*?*/ if( SOFFICE_FILEFORMAT_40 < pStrm->GetVersion() )
+/*?*/ break;
+/*N*/ default:
+/*N*/ ASSERT( FLY_PAGE==rAnchor.GetAnchorId() ||
+/*N*/ FLY_AT_FLY==rAnchor.GetAnchorId(),
+/*N*/ "Rahmen ist nicht Seitengebunden" );
+/*N*/ if( !pFmt->IsDefault() )
+/*N*/ {
+/*N*/ BYTE cType = SWG_FLYFMT;
+/*N*/ if( RES_DRAWFRMFMT == pFmt->Which() )
+/*N*/ cType = SWG_SDRFMT;
+/*N*/ OutFormat( cType, *pFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( SWG_FLYFRAMES );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ // Selektion: Frames absammeln
+/*?*/ USHORT nArrLen = pDoc->GetSpzFrmFmts()->Count();
+/*?*/ if( nArrLen > 255 )
+/*?*/ nArrLen = 255;
+/*?*/ SwPosFlyFrms aFlys( (BYTE)nArrLen, 50 );
+/*?*/ pDoc->GetAllFlyFmts( aFlys, &rPaM, TRUE );
+/*?*/ nArrLen = aFlys.Count();
+/*?*/ if( nArrLen )
+/*?*/ {
+/*?*/ OpenRec( SWG_FLYFRAMES );
+/*?*/ for( USHORT i = 0; i < nArrLen; i++ )
+/*?*/ {
+/*?*/ const SwFrmFmt& rFmt = aFlys[ i ]->GetFmt();
+/*?*/ const SwFmtAnchor& rAnchor = rFmt.GetAnchor();
+/*?*/ switch( rAnchor.GetAnchorId() )
+/*?*/ {
+/*?*/ case FLY_AT_CNTNT:
+/*?*/ case FLY_IN_CNTNT:
+/*?*/ case FLY_AUTO_CNTNT:
+/*?*/ break; // nicht die, die am Node kleben
+/*?*/ case FLY_AT_FLY:
+/*?*/ // Rahmengebunde Rahmen werden als seitengebunde
+/*?*/ // Rahmen ins 3.1/4.0-Format exportiert. Sonst
+/*?*/ // werden sie in der Section exportiert.
+/*?*/ if( SOFFICE_FILEFORMAT_40 < pStrm->GetVersion() )
+/*?*/ break;
+/*?*/ default:
+/*?*/ ASSERT( FLY_PAGE==rAnchor.GetAnchorId() ||
+/*?*/ FLY_AT_FLY==rAnchor.GetAnchorId(),
+/*?*/ "Rahmen ist nicht Seitengebunden" );
+/*?*/ if( !rFmt.IsDefault() )
+/*?*/ {
+/*?*/ BYTE cType = SWG_FLYFMT;
+/*?*/ if( RES_DRAWFRMFMT == rFmt.Which() )
+/*?*/ cType = SWG_SDRFMT;
+/*?*/ OutFormat( cType, rFmt );
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ CloseRec( SWG_FLYFRAMES );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+// in FLYPOS.CXX
+
+extern BOOL TstFlyRange( const SwPaM* pPam, const SwIndex& rFlyPos );
+
+/*N*/ void Sw3IoImp::CollectFlyFrms( const SwPaM* pPaM )
+/*N*/ {
+/*N*/ if( !pFlyFrms )
+/*N*/ {
+/*N*/ pFlyFrms = new SwPosFlyFrms;
+/*N*/ SwPosFlyFrm *pFPos = 0;
+/*N*/ const SwPosition* pAPos;
+/*N*/
+/*N*/ // alle absatzgebundenen Flys einsammeln
+/*N*/ for( USHORT n = 0; n < pDoc->GetSpzFrmFmts()->Count(); ++n )
+/*N*/ {
+/*N*/ SwFrmFmt *pFly = (*pDoc->GetSpzFrmFmts())[ n ];
+/*N*/ if( RES_DRAWFRMFMT == pFly->Which() ||
+/*N*/ RES_FLYFRMFMT == pFly->Which() )
+/*N*/ {
+/*N*/ const SwFmtAnchor& rAnchor = pFly->GetAnchor();
+/*N*/ if( ( FLY_AT_CNTNT == rAnchor.GetAnchorId() ||
+/*N*/ FLY_AT_FLY == rAnchor.GetAnchorId() ||
+/*N*/ FLY_AUTO_CNTNT == rAnchor.GetAnchorId() ) &&
+/*N*/ NULL != ( pAPos = rAnchor.GetCntntAnchor()) )
+/*N*/ {
+/*N*/ pFPos = new SwPosFlyFrm( pAPos->nNode, pFly,
+/*N*/ pFlyFrms->Count() );
+/*N*/ pFlyFrms->Insert( pFPos );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( !pFlyFrms->Count() )
+/*N*/ delete pFlyFrms, pFlyFrms = NULL;
+/*N*/ }
+/*N*/ }
+
+// Freigabe der gesammelten FlyFrame-Infos nach dem Schreiben
+
+/*N*/ void Sw3IoImp::FreeFlyFrms()
+/*N*/ {
+/*N*/ if( pFlyFrms )
+/*N*/ {
+/*N*/ for( USHORT i = 0; i < pFlyFrms->Count(); i++ )
+/*N*/ delete (*pFlyFrms)[ i ];
+/*N*/ delete pFlyFrms;
+/*N*/ pFlyFrms = NULL;
+/*N*/ }
+/*N*/ }
+
+// Suchen eines absatzgebundenen Flys. Wenn gefunden, wird der Fly
+// zurueckgeliefert und das Element aus dem Array entfernt.
+
+/*N*/ SwFmt* Sw3IoImp::FindFlyFrm( ULONG nNodeId )
+/*N*/ {
+/*N*/ SwFmt* pFmt = NULL;
+/*N*/ if( pFlyFrms )
+/*N*/ {
+/*N*/ for( USHORT i = 0; i < pFlyFrms->Count(); i++ )
+/*N*/ {
+/*N*/ ULONG nId = (*pFlyFrms)[ i ]->GetNdIndex().GetIndex();
+/*N*/ if( nNodeId == nId )
+/*N*/ {
+/*N*/ pFmt = (SwFmt*) &(*pFlyFrms)[ i ]->GetFmt();
+/*N*/ pFlyFrms->DeleteAndDestroy( i );
+/*N*/ break;
+/*N*/ }
+/*N*/ if( nId > nNodeId )
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return pFmt;
+/*N*/ }
+
+////////////////////////////////////////////////////////////////////////////
+
+
+/* */
+
+
+}
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3gsect.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3gsect.cxx
new file mode 100644
index 000000000000..ecb1d765fb1e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3gsect.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+namespace binfilter {
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx
new file mode 100644
index 000000000000..f2210354b06a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3imp.cxx
@@ -0,0 +1,2681 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <stdio.h>
+
+#include <hintids.hxx>
+
+#if !defined _SVSTDARR_USHORTS_DECL || !defined _SVSTDARR_STRINGSDTOR_DECL
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_USHORTS
+#endif
+#include <bf_svx/fontitem.hxx>
+#include <bf_svtools/style.hxx>
+#include <bf_svx/editeng.hxx>
+#include <bf_svx/svdpool.hxx>
+#include <bf_svx/svdpage.hxx>
+#include <bf_svtools/htmlkywd.hxx>
+#include <bf_sfx2/docinf.hxx>
+#include <tools/tenccvt.hxx>
+
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <fmtfld.hxx>
+#include <charfmt.hxx>
+#include <hints.hxx>
+#include <doctxm.hxx>
+#include <swmodule.hxx>
+#include <dcontact.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <dflyobj.hxx>
+#include <viewopt.hxx>
+#include <sw3io.hxx>
+#include <sw3imp.hxx>
+#include <sw3marks.hxx>
+#include <shellio.hxx>
+#include <pagedesc.hxx>
+#include <mdiexp.hxx>
+#include <poolfmt.hxx>
+#include <crypter.hxx>
+#include <dbfld.hxx>
+#include <expfld.hxx>
+#include <ndole.hxx>
+#include <drawdoc.hxx>
+
+#include <docsh.hxx>
+#include <swfltopt.hxx>
+
+#include <swerror.h>
+#include <statstr.hrc>
+#include <poolfmt.hrc>
+#include <fmtinfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+
+static Sw3IoImp* pCurIosys; // fuer non-poolable Attrs
+
+// Zugriff auf die INI-Datei, um interne Flags zu setzen
+
+#define FLTF_NO_DRAWINGS 0x00000001L
+
+#define MAX_SMALL_RECSIZE 0xfffffeUL
+#define LONG_RECSIZE 0xffffffUL
+
+static sal_uInt32 nFltFlags = 0;
+
+
+sal_Char __FAR_DATA SW3HEADER[] = "SW3HDR"; // 3.0/3.1 Header
+sal_Char __FAR_DATA SW4HEADER[] = "SW4HDR"; // 4.0 Header
+sal_Char __FAR_DATA SW5HEADER[] = "SW5HDR"; // 5.0 Header
+
+// TODOs fuer 6.0-FF
+// - Record-Laengen > 16MB richtig handeln.
+// - while( BytesLeft() )-Schleifen elemenieren
+
+/*N*/ SV_IMPL_PTRARR(Sw3Strings, String*)
+/*N*/ SV_IMPL_VARARR(Sw3ULongs, sal_uInt32)
+/*N*/ SV_IMPL_VARARR(Sw3Bytes, sal_uInt8)
+
+class Sw3RecordSizeTable: private Table
+{
+public:
+ Table::Count;
+ Table::SearchKey;
+ Table::GetObjectKey;
+
+ Sw3RecordSizeTable() :
+ Table()
+ {}
+
+ sal_Bool Insert( ULONG nKey, sal_uInt32 p )
+ {
+ return Table::Insert( nKey, (void*)p );
+ }
+
+ sal_uInt32 GetObject( ULONG nPos ) const
+ {
+ return (sal_uIntPtr)Table::GetObject( nPos );
+ }
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+/* */
+
+/*N*/ Sw3ExportInfo::~Sw3ExportInfo()
+/*N*/ {
+/*N*/ delete pTblLineBoxFmtNames40;
+/*N*/ }
+
+/* */
+
+
+/*N*/ Sw3IoImp::Sw3IoImp( Sw3Io& r )
+/*N*/ : rIo( r ), pDoc( NULL ),
+/*N*/ aDefWordDelim( SW_MOD()->GetDocStatWordDelim() ),
+/*N*/ N_DOC( String::CreateFromAscii( "StarWriterDocument" ) ),
+/*N*/ N_PAGESTYLES( String::CreateFromAscii( "SwPageStyleSheets" ) ),
+/*N*/ N_NUMRULES( String::CreateFromAscii( "SwNumRules" ) ),
+/*N*/ N_DRAWING( String::CreateFromAscii( DRAWING_STREAM_NAME ) ),
+/*N*/ N_PICTURES( String::CreateFromAscii( "EmbeddedPictures" ) ),
+/*N*/ N_BLOCKDIR( String::CreateFromAscii( "DocumentList" ) ),
+/*N*/ sStarSymbol( "StarSymbol", sizeof("StarSymbol")-1, RTL_TEXTENCODING_ASCII_US ),
+/*N*/ sOpenSymbol( "OpenSymbol", sizeof("OpenSymbol")-1, RTL_TEXTENCODING_ASCII_US ),
+/*N*/ sStarBats( "StarBats", sizeof("StarBats")-1, RTL_TEXTENCODING_ASCII_US ),
+/*N*/ sStarMath( "StarMath", sizeof("StarMath")-1, RTL_TEXTENCODING_ASCII_US )
+/*N*/ {
+/*N*/ bNormal = sal_True;
+/*N*/ bTxtColls =
+/*N*/ bCharFmts =
+/*N*/ bFrmFmts =
+/*N*/ bPageDescs =
+/*N*/ bNumRules =
+/*N*/ bAdditive =
+/*N*/ bBlock =
+/*N*/ bSw31Export =
+/*N*/ bOrganizer =
+/*N*/ bInsIntoHdrFtr = sal_False;
+/*N*/ pFlyFrms = NULL;
+/*N*/ pExportInfo = NULL;
+/*N*/ pCrypter = NULL;
+/*N*/ pTOXs = NULL;
+/*N*/ pRedlines = NULL;
+/*N*/ pRedlineMarks = NULL;
+/*N*/ pMarks = NULL;
+/*N*/ pBookmarks = NULL;
+/*N*/ p30OLENodes = NULL;
+/*N*/ pTblLineBoxFmts = NULL;
+/*N*/ pSectionDepths = 0;
+/*N*/ pRecSizes = NULL;
+/*N*/ pAuthorityMap = 0;
+/*N*/ pConvToSymbolFmts = 0;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ pRefSdrObjects = 0;
+/*N*/ #endif
+/*N*/ hBatsFontConv = 0;
+ hMathFontConv = 0;
+/*N*/ Reset();
+/*N*/
+/*N*/ {
+/*N*/ const sal_Char* aNames[1] = { "Writer/SW3Imp" };
+/*N*/ sal_uInt32 aVal[1];
+/*N*/ SwFilterOptions aOpt( 1, aNames, aVal );
+/*N*/ nFltFlags = aVal[ 0 ];
+/*N*/ }
+/*N*/ nCntntBkmkStart = 0;
+/*N*/ nCntntRedlineStart = 0;
+/*N*/ pHiddenDrawObjs = 0;
+/*N*/ }
+
+/*N*/ Sw3IoImp::~Sw3IoImp()
+/*N*/ {
+/*N*/ if( pDoc && !pDoc->RemoveLink() )
+/*N*/ delete pDoc;
+/*N*/ }
+
+/*N*/ Sw3IoImp* Sw3IoImp::GetCurrentIo()
+/*N*/ {
+/*N*/ return pCurIosys;
+/*N*/ }
+
+// Allgemeine Initialisierungen
+
+/*N*/ void Sw3IoImp::Reset()
+/*N*/ {
+/*N*/ Date aDate;
+/*N*/ Time aTime;
+/*N*/ // die folgenden beiden Felder werden auch zum Passwort-Check benutzt
+/*N*/ nDate = aDate.GetDate();
+/*N*/ nTime = aTime.GetTime();
+/*N*/ bInsert =
+/*N*/ bNoDrawings = sal_False;
+/*N*/ bSaveAll = sal_True;
+/*N*/ bSpellAllAgain = bSpellWrongAgain = sal_True;
+/*N*/ nCurBlk = 0;
+/*N*/ nRes = 0;
+/*N*/ nWarn = 0;
+/*N*/ nCurPercent =
+/*N*/ nEndPercent = 0;
+/*N*/ nZOrderOff = 0;
+/*N*/ nHiddenDrawObjs = ULONG_MAX;
+/*N*/ pBlkList = NULL;
+/*N*/ bInsIntoHdrFtr = sal_False;
+/*N*/ bSw31Export = sal_False;
+/*N*/ FreeFlyFrms();
+/*N*/ aBlkName.Erase();
+/*N*/ pStrm = 0; // wg. Assert in IsSw.*Export
+/*N*/ Reset2();
+/*N*/ nGblFlags = SW3F_NODRAWING;
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ delete pRefSdrObjects;
+/*N*/ pRefSdrObjects = 0;
+/*N*/ #endif
+/*N*/ delete pConvToSymbolFmts;
+/*N*/ pConvToSymbolFmts = 0;
+/*N*/ }
+
+// Initialisierung aller Daten vor dem Lesen/Schreiben eines Docs
+
+/*N*/ void Sw3IoImp::Reset2()
+/*N*/ {
+/*N*/ bOut =
+/*N*/ bConvertNoNum = sal_False;
+/*N*/ nCurMark =
+/*N*/ nFlyLevel =
+/*N*/ nFileFlags = 0;
+/*N*/ nSizeDivFac = 1;
+/*N*/ nFlagRecEnd = 0;
+/*N*/ pCurTbl = NULL;
+/*N*/ pCurNumRule = NULL;
+/*N*/ pCurPaM =
+/*N*/ pCurNumRange= NULL;
+/*N*/ eSrcSet = gsl_getSystemTextEncoding();
+/*N*/ if( pStrm )
+/*N*/ eSrcSet = GetSOStoreTextEncoding( eSrcSet, pStrm->GetVersion() );
+/*N*/ else if( pRoot.Is() )
+/*N*/ eSrcSet = GetSOStoreTextEncoding( eSrcSet, pRoot->GetVersion() );
+/*N*/ nVersion = SWG_VERSION;
+/*N*/
+/*N*/ aRecTypes.Remove( 0, aRecTypes.Count() );
+/*N*/ aRecSizes.Remove( 0, aRecSizes.Count() );
+/*N*/ aValPositions.Remove( 0, aValPositions.Count() );
+/*N*/ eStartNodeType = SwNormalStartNode;
+/*N*/
+/*N*/ aINetFldText.Erase();
+/*N*/ pFmtINetFmt = 0;
+/*N*/ bDrawFmtSkipped = sal_False;
+/*N*/
+/*N*/ memset( cPasswd, 0, 16 );
+/*N*/ aStringPool.Clear();
+/*N*/ if( pExportInfo && pExportInfo->pTblLineBoxFmtNames40 )
+/*N*/ {
+/*N*/ delete pExportInfo->pTblLineBoxFmtNames40;
+/*N*/ pExportInfo->pTblLineBoxFmtNames40 = 0;
+/*N*/ }
+/*N*/ // Hier ggf das Passwort neu setzen
+/*N*/ SetPasswd();
+/*N*/
+/*N*/ delete pRecSizes;
+/*N*/ pRecSizes = 0;
+/*N*/
+/*N*/ delete pAuthorityMap;
+/*N*/ pAuthorityMap = 0;
+/*N*/
+/*N*/ delete pSectionDepths;
+/*N*/ pSectionDepths = 0;
+/*N*/
+/*N*/ if( hBatsFontConv )
+/*N*/ {
+/*N*/ DestroyFontToSubsFontConverter( hBatsFontConv );
+/*N*/ hBatsFontConv = 0;
+/*N*/ }
+/*N*/ if( hMathFontConv )
+/*N*/ {
+/*N*/ DestroyFontToSubsFontConverter( hMathFontConv );
+/*N*/ hMathFontConv = 0;
+/*N*/ }
+/*N*/ }
+
+#ifdef DBG_UTIL
+/*N*/ sal_Bool Sw3IoImp::IsSw40Export() const
+/*N*/ {
+/*N*/ ASSERT( !pStrm || pStrm->GetVersion()==pRoot->GetVersion(),
+/*N*/ "Fileformat-Version am Stream stimmt nicht." );
+/*N*/ return pRoot->GetVersion() == SOFFICE_FILEFORMAT_40;
+/*N*/ }
+
+/*N*/ sal_Bool Sw3IoImp::IsSw31Or40Export() const
+/*N*/ {
+/*N*/ ASSERT( !pStrm || pStrm->GetVersion()==pRoot->GetVersion(),
+/*N*/ "Fileformat-Version am Stream stimmt nicht." );
+/*N*/ return pRoot->GetVersion() <= SOFFICE_FILEFORMAT_40;
+/*N*/ }
+#endif
+
+/*N*/ void Sw3IoImp::Error( ULONG nCode )
+/*N*/ {
+/*N*/ nRes = nCode ? nCode : ERR_SWG_FILE_FORMAT_ERROR;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::Warning( ULONG nCode )
+/*N*/ {
+/*N*/ nWarn = nCode ? nCode : WARN_SWG_FEATURES_LOST;
+/*N*/ }
+
+/*************************************************************************
+*
+* Einlese-Optionen
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::SetReadOptions( const SwgReaderOption& rOpt, sal_Bool bOverwrite )
+/*N*/ {
+/*N*/ bTxtColls =
+/*N*/ bCharFmts =
+/*N*/ bFrmFmts =
+/*N*/ bPageDescs =
+/*N*/ bNumRules = sal_False; // fix #27376#: sonst sind alle sal_True
+/*N*/ if( rOpt.IsFrmFmts() )
+/*N*/ bFrmFmts = sal_True;
+/*N*/ if( rOpt.IsTxtFmts() )
+/*N*/ bCharFmts = bTxtColls = sal_True;
+/*N*/ if( rOpt.IsPageDescs() )
+/*N*/ bPageDescs = sal_True;
+/*N*/ if( rOpt.IsNumRules() )
+/*N*/ bNumRules = sal_True;
+/*N*/ bNormal = sal_Bool( !( bTxtColls | bCharFmts | bFrmFmts | bPageDescs | bNumRules ) );
+/*N*/ bAdditive = bNormal ? !bOverwrite : rOpt.IsMerge();
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InsertHiddenDrawObjs()
+/*N*/ {
+/*N*/ if( !pDoc->GetDrawModel() )
+/*N*/ return;
+/*N*/
+/*N*/ const SwSpzFrmFmts* pFlys = pDoc->GetSpzFrmFmts();
+/*N*/ sal_uInt16 nArrLen = pFlys->Count();
+/*N*/
+/*N*/ SdrPage *pPage = pDoc->GetDrawModel()->GetPage( 0 );
+/*N*/ ASSERT( !pHiddenDrawObjs, "hidden obj list exists" );
+/*N*/ delete pHiddenDrawObjs;
+/*N*/ pHiddenDrawObjs = 0;
+/*N*/
+/*N*/ sal_uInt16 nCount = pPage->GetObjCount();
+/*N*/ nHiddenDrawObjs = nCount;
+/*N*/ for( sal_uInt16 i=0; i<nArrLen; i++ )
+/*N*/ {
+/*N*/ const SwFrmFmt* pFmt = (*pFlys)[ i ];
+/*N*/ if( RES_DRAWFRMFMT != pFmt->Which() )
+/*N*/ continue;
+/*N*/
+/*N*/ SwClientIter aIter( *(SwFrmFmt*)pFmt );
+/*N*/ if( aIter.First( TYPE(SwDrawContact) ) )
+/*N*/ {
+/*N*/ SdrObject *pObj = ((SwDrawContact*)aIter())->GetMaster();
+/*N*/
+/*N*/ // Nowadays, all objects have to be in a page, while in earlier
+/*N*/ // version, hidden objects were not in the page.
+/*N*/ ASSERT( pObj->GetPage(), "draw objects have to be in a page" );
+/*N*/ if( !pObj->GetPage() )
+/*N*/ pPage->InsertObject( pObj );
+/*N*/ }
+/*N*/ }
+/*N*/ if( nHiddenDrawObjs == pPage->GetObjCount() )
+/*N*/ nHiddenDrawObjs = ULONG_MAX;
+/*N*/
+/*N*/ for( sal_uInt16 j=0; j<nCount; j++ )
+/*N*/ {
+/*N*/ SdrObject *pObj = pPage->GetObj( j );
+/*N*/
+/*N*/ SdrLayerID nLayerId = pObj->GetLayer();
+/*N*/ if( !pDoc->IsVisibleLayerId( nLayerId ) )
+/*N*/ {
+/*N*/ nLayerId = pDoc->GetVisibleLayerIdByInvisibleOne( nLayerId );
+/*N*/ if( !pHiddenDrawObjs )
+/*N*/ pHiddenDrawObjs = new SwHiddenDrawObjList_Impl;
+/*N*/ pHiddenDrawObjs->push_back( pObj );
+/*N*/ pObj->NbcSetLayer( nLayerId );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::RemoveHiddenDrawObjs()
+/*N*/ {
+/*N*/ if( pHiddenDrawObjs )
+/*N*/ {
+/*N*/ if( pDoc->GetDrawModel() )
+/*N*/ {
+/*N*/ SdrPage *pPage = pDoc->GetDrawModel()->GetPage( 0 );
+/*N*/ SwHiddenDrawObjList_Impl::const_iterator aIter = pHiddenDrawObjs->begin();
+/*N*/ while( aIter != pHiddenDrawObjs->end() )
+/*N*/ {
+/*N*/ SdrObject *pObj = *aIter;
+/*N*/ SdrLayerID nLayerId = pObj->GetLayer();
+/*N*/ nLayerId = pDoc->GetInvisibleLayerIdByVisibleOne( nLayerId );
+/*N*/ pObj->NbcSetLayer( nLayerId );
+/*N*/ ++aIter;
+/*N*/ }
+/*N*/ }
+/*N*/ delete pHiddenDrawObjs;
+/*N*/ pHiddenDrawObjs = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( ULONG_MAX != nHiddenDrawObjs )
+/*N*/ {
+/*N*/ if( pDoc->GetDrawModel() )
+/*N*/ {
+/*N*/ SdrPage *pPage = pDoc->GetDrawModel()->GetPage( 0 );
+/*N*/ sal_uInt32 nPos = pPage->GetObjCount();
+/*N*/ while( nPos > nHiddenDrawObjs )
+/*N*/ pPage->RemoveObject( --nPos );
+/*N*/ }
+/*N*/
+/*N*/ nHiddenDrawObjs = ULONG_MAX;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+*
+* Stream-Verwaltung
+*
+*************************************************************************/
+
+// Does the drawing layer contain some objects or forms?
+
+/*N*/ sal_Bool lcl_sw3io_doesDrawingLayerNeedSaving( SwDoc& rDoc )
+/*N*/ {
+/*N*/ if( !rDoc.GetDrawModel() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ const SdrPage *pPage = rDoc.GetDrawModel()->GetPage( 0 );
+/*N*/ for ( sal_uInt32 i = 0; i < pPage->GetObjCount(); i++ )
+/*N*/ {
+/*N*/ SdrObject *pObj = pPage->GetObj( i );
+/*N*/ if ( !pObj->IsWriterFlyFrame() &&
+/*N*/ !pObj->ISA(SwFlyDrawObj) )
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/
+/*N*/ SwDocShell *pDocSh = rDoc.GetDocShell();
+/*N*/ if( !pDocSh )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ Reference< drawing::XDrawPageSupplier > xDPSupp( pDocSh->GetBaseModel(),
+/*N*/ UNO_QUERY );
+/*N*/ ASSERT( xDPSupp.is(), "XDrawPageSupplier missing" );
+/*N*/
+/*N*/ Reference< drawing::XDrawPage > xDrawPage = xDPSupp->getDrawPage();
+/*N*/ ASSERT( xDrawPage.is(), "XDrawPage missing" );
+/*N*/ if( !xDrawPage.is() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ Reference< form::XFormsSupplier > xFormsSupplier( xDrawPage, UNO_QUERY );
+/*N*/ ASSERT( xFormsSupplier.is(), "XFormsSupplier missing" );
+/*N*/
+/*N*/ Reference< container::XNameContainer > xForms = xFormsSupplier->getForms();
+/*N*/ ASSERT( xForms.is(), "XForms missing" );
+/*N*/
+/*N*/ return xForms->hasElements();
+/*N*/ }
+
+// Alle Streams neu oeffnen. Der Root-Storage ist bereits gesetzt.
+// Der Storage fuer die Grafiken wird in In/OutGrfNode() geoeffnet.
+// Das Element StarWriterDocument kann entweder ein Storage oder
+// ein Stream sein.
+// Der Drawing Layer-Stream wird nur dann geoeffnet, wenn der Stream
+// da ist (beim Lesen) oder wenn der Layer Zeichenobjekte enthaelt
+// (Schreiben). Beim Schreiben wird er, falls vorhanden und nicht
+// verwendet, weggeputzt!
+
+/*N*/ sal_Bool Sw3IoImp::OpenStreams( sal_Bool bRdWr, sal_Bool bUseDrawStream )
+/*N*/ {
+/*N*/ sal_uInt16 nMode = STREAM_READ | STREAM_SHARE_DENYWRITE;
+/*N*/ if( bRdWr )
+/*N*/ nMode |= STREAM_WRITE;
+/*N*/ else
+/*N*/ nMode |= STREAM_NOCREATE;
+/*N*/ Reset();
+/*N*/
+/*N*/ pCurIosys = this;
+/*N*/
+/*N*/ if( !pRoot.Is() || pRoot->GetError() != SVSTREAM_OK )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // Der Doc-Teil kann Storage oder Stream sein!
+/*N*/ // Der DocStream fehlt natuerlich auch bei Textbausteinen
+/*N*/ if( !bBlock )
+/*N*/ {
+/*N*/ ASSERT( !pRoot->IsContained( N_DOC ) || pRoot->IsStream( N_DOC ), "Beta1-Docs werden nicht unterstuetzt" );
+/*N*/ if( pRoot->IsStorage( N_DOC ) )
+/*N*/ {
+/*N*/ nRes = ERR_SWG_READ_ERROR;
+/*N*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ long nFFVersion = pRoot->GetVersion();
+/*N*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_31 ||
+/*N*/ nFFVersion == SOFFICE_FILEFORMAT_40 ||
+/*N*/ nFFVersion == SOFFICE_FILEFORMAT_50,
+/*N*/ "Am Root-Storage ist keine FF-Version gesetzt!" );
+/*N*/
+/*N*/ // Solange wie noch ein Flag fuer den 3.1-Export haben, muessen wir
+/*N*/ // es auch noch setzen. Der Sw3Writer macht das nicht mehr fuer uns.
+/*N*/ if( bRdWr && nFFVersion == SOFFICE_FILEFORMAT_31 )
+/*N*/ SetSw31Export( sal_True );
+/*N*/
+/*N*/ // Wenn eine 3.1-Clipboard-ID gesetzt ist, die Fileformat-Version
+/*N*/ // auf 3.1 setzten.
+/*N*/ if( SOT_FORMATSTR_ID_STARWRITER_30 == pRoot->GetFormat() &&
+/*N*/ nFFVersion != SOFFICE_FILEFORMAT_31 )
+/*N*/ {
+/*?*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_31,
+/*?*/ "Fileformat-Version auf 3.1 umgesetzt" );
+/*?*/ pRoot->SetVersion( SOFFICE_FILEFORMAT_31 );
+/*?*/ nFFVersion = SOFFICE_FILEFORMAT_31;
+/*N*/ }
+/*N*/ else if( ( SOT_FORMATSTR_ID_STARWRITER_40 == pRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERGLOB_40 == pRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERWEB_40 == pRoot->GetFormat() ) &&
+/*N*/ nFFVersion != SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*?*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_40,
+/*?*/ "Fileformat-Version auf 4.0 umgesetzt" );
+/*?*/ pRoot->SetVersion( SOFFICE_FILEFORMAT_40 );
+/*?*/ nFFVersion = SOFFICE_FILEFORMAT_40;
+/*N*/ }
+/*N*/ else if( ( SOT_FORMATSTR_ID_STARWRITER_50 == pRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERGLOB_50 == pRoot->GetFormat() ||
+/*N*/ SOT_FORMATSTR_ID_STARWRITERWEB_50 == pRoot->GetFormat() ) &&
+/*N*/ nFFVersion != SOFFICE_FILEFORMAT_50 )
+/*N*/ {
+/*?*/ ASSERT( nFFVersion == SOFFICE_FILEFORMAT_50,
+/*?*/ "Fileformat-Version auf 5.0 umgesetzt" );
+/*?*/ pRoot->SetVersion( SOFFICE_FILEFORMAT_50 );
+/*?*/ nFFVersion = SOFFICE_FILEFORMAT_50;
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ // The drawing layer stream will be opened for reading if it exists only
+/*N*/ // and for writing if it contains some (non virtual) objects or forms.
+/*N*/ sal_Bool bDraw = bRdWr && bUseDrawStream && pDoc->GetDrawModel() &&
+/*N*/ lcl_sw3io_doesDrawingLayerNeedSaving( *pDoc );
+/*N*/
+/*N*/ sal_Bool bPresent = pRoot->IsStream( N_DRAWING );
+/*N*/ if( bDraw || ( !bRdWr && bPresent ) )
+/*N*/ {
+/*N*/ if( bRdWr || !( nFltFlags & FLTF_NO_DRAWINGS ) )
+/*N*/ pDrawing = pRoot->OpenStream( N_DRAWING, nMode );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( bPresent && bUseDrawStream )
+/*?*/ pRoot->Remove( N_DRAWING );
+/*N*/ pDrawing.Clear();
+/*N*/ }
+/*N*/
+/*N*/ // Absatzvorlagen
+/*N*/ if( bRdWr || pRoot->IsStream( SfxStyleSheetBasePool::GetStreamName() ) )
+/*N*/ pStyles = pRoot->OpenStream
+/*N*/ ( SfxStyleSheetBasePool::GetStreamName(), nMode );
+/*N*/ else
+/*?*/ pStyles.Clear();
+/*N*/ // Numerierungs-Regeln
+/*N*/ if( nFFVersion > SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*N*/ if( bRdWr || pRoot->IsStream( N_NUMRULES ) )
+/*N*/ pNumRules = pRoot->OpenStream( N_NUMRULES, nMode );
+/*N*/ else
+/*?*/ pNumRules.Clear();
+/*N*/ }
+/*N*/ // Seitenvorlagen
+/*N*/ if( bRdWr || pRoot->IsStream( N_PAGESTYLES ) )
+/*N*/ pPageStyles = pRoot->OpenStream( N_PAGESTYLES, nMode );
+/*N*/ else
+/*?*/ pPageStyles.Clear();
+/*N*/ // Inhalt
+/*N*/ if( bRdWr || pRoot->IsStream( N_DOC ) )
+/*N*/ pContents = pRoot->OpenStream( N_DOC, nMode );
+/*N*/ else
+/*?*/ pContents.Clear();
+/*N*/ if( CheckStreams() )
+/*N*/ {
+/*N*/ // Versions-Nummer vom Storage an die Streams uebernehmen
+/*N*/ // Setting the char set is in fact only required for
+/*N*/ // saving files.
+/*N*/ if( pDrawing.Is() )
+/*N*/ pDrawing->SetVersion( nFFVersion );
+/*N*/
+/*N*/ pStyles->SetVersion( nFFVersion );
+/*N*/ if( pNumRules.Is() )
+/*N*/ {
+/*N*/ pNumRules->SetVersion( nFFVersion );
+/*N*/ pNumRules->SetStreamCharSet( eSrcSet );
+/*N*/ }
+/*N*/
+/*N*/ pPageStyles->SetVersion( nFFVersion );
+/*N*/ pPageStyles->SetStreamCharSet( eSrcSet );
+/*N*/
+/*N*/ pContents->SetVersion( nFFVersion );
+/*N*/ pContents->SetStreamCharSet( eSrcSet );
+/*N*/
+/*N*/ if( bRdWr )
+/*N*/ {
+/*N*/ sal_uInt16 nComprMode = COMPRESSMODE_NONE;
+/*N*/ if( SOFFICE_FILEFORMAT_40 <= pRoot->GetVersion() &&
+/*N*/ pDoc->GetInfo()->IsSaveGraphicsCompressed() )
+/*N*/ nComprMode |= COMPRESSMODE_ZBITMAP;
+/*N*/ if( SOFFICE_FILEFORMAT_40 < pRoot->GetVersion() &&
+/*N*/ pDoc->GetInfo()->IsSaveOriginalGraphics() )
+/*N*/ nComprMode |= COMPRESSMODE_NATIVE;
+/*N*/ if( COMPRESSMODE_NONE != nComprMode )
+/*N*/ {
+/*N*/ if( pDrawing.Is() )
+/*N*/ pDrawing->SetCompressMode( nComprMode );
+/*N*/ pStyles->SetCompressMode( nComprMode );
+/*N*/ if( pNumRules.Is() )
+/*N*/ pNumRules->SetCompressMode( nComprMode );
+/*N*/ pPageStyles->SetCompressMode( nComprMode );
+/*N*/ pContents->SetCompressMode( nComprMode );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Exort-Information anlegen
+/*N*/ delete pExportInfo;
+/*N*/ if( bRdWr && nFFVersion <= SOFFICE_FILEFORMAT_40 )
+/*N*/ pExportInfo = new Sw3ExportInfo;
+/*N*/ // Falls noch keine Marks gesammelt wurden, ist jetzt die Zeit!
+/*N*/ // MIB 11.12.96: Es werden jetzt text::Bookmarks gesammelt, wenn sie
+/*N*/ // benoetigt werden und auch nur noch die, die benoetigt werden.
+/*N*/ // Das ist sauberer!
+/*N*/ // if( !pMarks && bRdWr )
+/*N*/ // CollectMarks( NULL, sal_False );
+/*N*/ bOut = bRdWr;
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ CloseStreams();
+/*?*/ return sal_False;
+/*N*/ }
+/*N*/ }
+
+// Alle offenen Streams freigeben. Die Root bleibt so, wie sie war.
+
+/*N*/ void Sw3IoImp::CloseStreams()
+/*N*/ {
+/*N*/ pCurIosys = NULL;
+/*N*/ pStrm = NULL;
+/*N*/ pContents.Clear();
+/*N*/ pDrawing.Clear();
+/*N*/ pStyles.Clear();
+/*N*/ pPageStyles.Clear();
+/*N*/ pNumRules.Clear();
+/*N*/ // Sicherheitshalber
+/*N*/ pBlkDir.Clear();
+/*N*/ // Nach dem Einlesen alle nicht benutzten Marks loeschen
+/*N*/ // (kann auch nach dem Schreiben passieren, ist egal)
+/*N*/ CleanupMarks();
+/*N*/
+/*N*/ // Brauchen wir nicht mehr
+/*N*/ delete pExportInfo; pExportInfo = NULL;
+/*N*/ delete pTOXs; pTOXs = NULL;
+/*N*/ delete pRedlines; pRedlines = NULL;
+/*N*/ delete pRedlineMarks; pRedlineMarks = NULL;
+/*N*/ delete pMarks; pMarks = NULL;
+/*N*/ delete pBookmarks; pBookmarks = NULL;
+/*N*/ delete p30OLENodes; p30OLENodes = NULL;
+/*N*/ delete pTblLineBoxFmts; pTblLineBoxFmts = NULL;
+/*N*/
+/*N*/ // der Returncode sollte so bleiben, wie er ist
+/*N*/ sal_uInt32 n = nRes;
+/*N*/ Reset();
+/*N*/ nRes = n;
+/*N*/ }
+
+// Sind alle Streams auch da?
+
+/*N*/ sal_Bool Sw3IoImp::CheckStreams()
+/*N*/ {
+/*N*/ sal_uInt16 n = pRoot.Is() && ( pRoot->GetError() == SVSTREAM_OK )
+/*N*/ && pPageStyles.Is() && ( pPageStyles->GetError() == SVSTREAM_OK )
+/*N*/ && pStyles.Is() && ( pStyles->GetError() == SVSTREAM_OK )
+/*N*/ && pContents.Is() && ( pContents->GetError() == SVSTREAM_OK );
+/*N*/ if( n && pRoot->GetVersion() > SOFFICE_FILEFORMAT_40 )
+/*N*/ n = n && pNumRules.Is() && ( pNumRules->GetError() == SVSTREAM_OK );
+/*N*/ return sal_Bool( n );
+/*N*/ }
+
+// Record oeffnen
+
+/*N*/ sal_Bool Sw3IoImp::OpenRec( sal_uInt8 cType )
+/*N*/ {
+/*N*/ sal_Bool bRes = sal_True;
+/*N*/ sal_uInt16 nLvl = aRecTypes.Count();
+/*N*/ ASSERT( nLvl == aRecSizes.Count(), "OpenRec: falscher Level" );
+/*N*/ sal_uInt32 nPos = pStrm->Tell();
+/*N*/ if( bOut )
+/*N*/ {
+/*N*/ if( nLvl >= 31 && (!pRoot.Is() || IsSw31Or40Export()) )
+/*N*/ Error( ERR_SWG_LARGE_DOC_ERROR );
+/*N*/ aRecTypes.Insert( cType, nLvl );
+/*N*/ aRecSizes.Insert( nPos, nLvl );
+/*N*/ *pStrm << (sal_uInt32) 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ sal_uInt32 nVal;
+/*N*/ *pStrm >> nVal;
+/*N*/ sal_uInt8 cRecTyp = (sal_uInt8)nVal;
+/*N*/ aRecTypes.Insert( cRecTyp, nLvl );
+/*N*/ sal_uInt32 nSize = nVal >> 8;
+/*N*/ if( LONG_RECSIZE == nSize && IsVersion( SWG_LONGRECS ) )
+/*N*/ {
+ sal_uInt32 nTmp = GetRecordSize( nPos );
+/*?*/ if( nTmp != SAL_MAX_UINT32 )
+/*?*/ nSize = nTmp;
+/*N*/ }
+/*N*/
+/*N*/ aRecSizes.Insert( nPos + nSize, nLvl );
+/*N*/ if( !nVal || cRecTyp != cType )
+/*N*/ {
+/*N*/ // Bei Fehlern wird ein EOF-Record erzeugt
+/*N*/ // fix #24089#: Ein 0-Record-Header ist in jedem Fall
+/*N*/ // ein Formatfehler und sollte nicht zu einer Endlos-Schleife
+/*N*/ // fuehren
+/*?*/ ASSERT( nVal, "OpenRec: Record-Header ist 0" );
+/*?*/ ASSERT( cRecTyp == cType,
+/*?*/ "OpenRec: Falscher Block-Header" );
+/*?*/ Error();
+/*?*/ aRecTypes[nLvl] = SWG_EOF;
+/*?*/ aRecSizes[nLvl] = pStrm->Tell();
+/*?*/ bRes = sal_False;
+/*N*/ }
+/*N*/ if( pStrm->GetErrorCode() != SVSTREAM_OK || pStrm->IsEof() )
+/*N*/ {
+/*?*/ if( pStrm->GetErrorCode() != SVSTREAM_OK &&
+/*?*/ IsWarning(pStrm->GetErrorCode()) )
+/*?*/ {
+/*?*/ Warning( pStrm->GetErrorCode() );
+/*?*/ pStrm->ResetError();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // Bei Fehlern wird ein EOF-Record erzeugt
+/*?*/ Error( ERR_SWG_READ_ERROR );
+/*?*/ aRecTypes[nLvl] = SWG_EOF;
+/*?*/ aRecSizes[nLvl] = pStrm->Tell();
+/*?*/ bRes = sal_False;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return bRes;
+/*N*/ }
+
+// Record schliessen
+
+/*N*/ void Sw3IoImp::CloseRec( sal_uInt8 cType )
+/*N*/ {
+/*N*/ sal_uInt16 nLvl = aRecTypes.Count();
+/*N*/ ASSERT( nLvl == aRecSizes.Count(), "CloseRec: falscher Level" );
+/*N*/ ASSERT( nLvl, "CloseRec: keine Schachtelung" );
+/*N*/ if( nLvl )
+/*N*/ {
+/*N*/ nLvl--;
+/*N*/ ASSERT( cType == aRecTypes[nLvl],
+/*N*/ "CloseRec: Falscher Block-Header" );
+/*N*/ sal_uInt32 nPos = pStrm->Tell();
+/*N*/ if( bOut )
+/*N*/ {
+/*N*/ sal_uInt32 nBgn = aRecSizes[nLvl];
+/*N*/ pStrm->Seek( nBgn );
+/*N*/ sal_uInt32 nSize = nPos - nBgn;
+/*N*/ if( nSize > MAX_SMALL_RECSIZE )
+/*N*/ {
+/*?*/ if( !pRoot.Is() || IsSw31Or40Export() )
+/*?*/ {
+/*?*/ Error( ERR_SWG_LARGE_DOC_ERROR );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+ InsertRecordSize( nBgn, nSize );
+/*?*/ nSize = LONG_RECSIZE;
+/*?*/ }
+/*N*/ }
+/*N*/ sal_uInt32 nVal = ( nSize << 8 ) | aRecTypes[nLvl];
+/*N*/ *pStrm << nVal;
+/*N*/ pStrm->Seek( nPos );
+/*N*/ if( pStrm->GetError() != SVSTREAM_OK )
+/*?*/ Error( ERR_SWG_WRITE_ERROR );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ sal_uInt32 n = aRecSizes[nLvl];
+/*N*/ ASSERT( n >= nPos, "CloseRec: zu viele Daten gelesen" );
+/*N*/ if( n != nPos )
+/*N*/ {
+/*?*/ pStrm->Seek( n );
+/*?*/ if( n < nPos )
+/*?*/ Error();
+/*?*/ else
+/*?*/ Warning();
+/*N*/ }
+/*N*/ if( pStrm->GetErrorCode() != SVSTREAM_OK )
+/*N*/ {
+/*?*/ if( IsWarning(pStrm->GetErrorCode()) )
+/*?*/ {
+/*?*/ Warning( pStrm->GetErrorCode() );
+/*?*/ pStrm->ResetError();
+/*?*/ }
+/*?*/ else
+/*?*/ Error( ERR_SWG_READ_ERROR );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ aRecTypes.Remove( nLvl, 1 );
+/*N*/ aRecSizes.Remove( nLvl, 1 );
+/*N*/ }
+/*N*/ }
+
+void Sw3IoImp::InsertRecordSize( sal_uInt32 nPos, sal_uInt32 nSize )
+{
+ if( !pRecSizes )
+ pRecSizes = new Sw3RecordSizeTable;
+
+ pRecSizes->Insert( nPos, nSize );
+}
+
+sal_uInt32 Sw3IoImp::GetRecordSize( sal_uInt32 nPos )
+{
+ sal_uInt32 nRet = SAL_MAX_UINT32;
+ ULONG nTablePos;
+
+ if( pRecSizes &&
+ TABLE_ENTRY_NOTFOUND != pRecSizes->SearchKey( nPos, &nTablePos ) )
+ {
+ nRet = pRecSizes->GetObject( nTablePos );
+ }
+ ASSERT( nRet != SAL_MAX_UINT32, "Record-Size nicht gefunden" );
+
+ return nRet;
+}
+
+void Sw3IoImp::FlushRecSizes()
+{
+ delete pRecSizes;
+ pRecSizes = 0;
+}
+
+// Zurueckliefern, wie viele Bytes ein Record noch enthaelt
+
+/*N*/ ULONG Sw3IoImp::BytesLeft()
+/*N*/ {
+/*N*/ sal_uInt16 nLvl = aRecSizes.Count();
+/*N*/ ULONG n = 0;
+/*N*/ if( nLvl && !nRes )
+/*N*/ {
+/*N*/ sal_uInt32 nEndPos = aRecSizes[ nLvl-1 ];
+/*N*/ ULONG nPos = pStrm->Tell();
+/*N*/ if( nEndPos > nPos )
+/*N*/ n = nEndPos - nPos;
+/*N*/ }
+/*N*/
+/*N*/ return n;
+/*N*/ }
+
+// was gibt es als naechstes?
+
+/*N*/ sal_uInt8 Sw3IoImp::Peek()
+/*N*/ {
+/*N*/ sal_uInt8 c = SWG_EOF;
+/*N*/ if( !nRes )
+/*N*/ {
+/*N*/ sal_uInt32 nPos = pStrm->Tell();
+/*N*/ *pStrm >> c;
+/*N*/ pStrm->Seek( nPos );
+/*N*/ if( pStrm->GetErrorCode() != SVSTREAM_OK )
+/*N*/ {
+/*?*/ if( IsWarning(pStrm->GetErrorCode()) )
+/*?*/ {
+/*?*/ Warning( pStrm->GetErrorCode() );
+/*?*/ pStrm->ResetError();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ Error( ERR_SWG_READ_ERROR );
+/*?*/ c = SWG_EOF;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return c;
+/*N*/ }
+
+// Den aktuellen Record ueberspringen
+
+/*N*/ void Sw3IoImp::SkipRec()
+/*N*/ {
+/*N*/ sal_uInt8 c = Peek();
+/*N*/ OpenRec( c );
+/*N*/ pStrm->Seek( aRecSizes[aRecSizes.Count()-1] );
+/*N*/ CloseRec( c );
+/*N*/ }
+
+void Sw3IoImp::InRecSizes( ULONG nRecPos )
+{
+ ASSERT( !pRecSizes, "RecSize-Tabelle existiert noch" );
+ ASSERT( nRecPos, "Keine Position der RecSize-Tabelle" );
+
+ if( nRecPos )
+ {
+ pRecSizes = new Sw3RecordSizeTable;
+
+ // Wenn der Stream vor dem Record steht, wird der Record
+ // normal gelesen. Sonst wird erstmal zu ihm geseekt und
+ // nach dem Lesen wieder am die aktuelle Stelle zurueck.
+ ULONG nOldPos = pStrm->Tell();
+ if( nOldPos != nRecPos )
+ pStrm->Seek( nRecPos );
+
+ sal_uInt32 nCount, nPos, nSize;
+ OpenRec( SWG_RECSIZES );
+ OpenFlagRec();
+ *pStrm >> nCount;
+ CloseFlagRec();
+
+ for( sal_uInt32 i=0; i < nCount; i++ )
+ {
+ *pStrm >> nPos >> nSize;
+ pRecSizes->Insert( nPos, nSize );
+ }
+
+ CloseRec( SWG_RECSIZES );
+
+ if( nOldPos != nRecPos )
+ pStrm->Seek( nOldPos );
+ }
+}
+
+ULONG Sw3IoImp::OutRecSizes()
+{
+ ULONG nRecPos = 0;
+ if( pRecSizes )
+ {
+ sal_uInt32 nCount = pRecSizes->Count();
+ ASSERT( nCount, "RecSize-Tabelle ist leer" );
+
+ if( (nCount*8 + 4) > MAX_SMALL_RECSIZE )
+ {
+ // Der Record darf kein langer sein, sonst haben wir ein
+ // Problem ...
+ Error( ERR_SWG_LARGE_DOC_ERROR );
+ }
+ else
+ {
+ nRecPos = pStrm->Tell();
+ OpenRec( SWG_RECSIZES );
+
+ *pStrm << (sal_uInt8)0x04 << (sal_uInt32)nCount;
+
+ for( sal_uInt32 i=0; i < nCount; i++ )
+ {
+ *pStrm << (sal_uInt32)pRecSizes->GetObjectKey( i )
+ << (sal_uInt32)pRecSizes->GetObject( i );
+ }
+
+ CloseRec( SWG_RECSIZES );
+ }
+ }
+
+ return nRecPos;
+}
+
+// Ein Flag-Byte enthaelt immer die Anzahl Daten im unteren Nybble.
+// Hier wird das Flagbyte mit der aktuellen Position ausgewertet.
+
+/*N*/ sal_uInt8 Sw3IoImp::OpenFlagRec()
+/*N*/ {
+/*N*/ sal_uInt8 cFlags;
+/*N*/ *pStrm >> cFlags;
+/*N*/ nFlagRecEnd = pStrm->Tell() + ( cFlags & 0x0F );
+/*N*/ return cFlags;
+/*N*/ }
+
+// Die folgende Routine fuehrt einen Skip durch, falls noch nicht
+// alle Daten gelesen wurden.
+
+/*N*/ void Sw3IoImp::CloseFlagRec()
+/*N*/ {
+/*N*/ ASSERT( pStrm->Tell() <= nFlagRecEnd, "Zu viele Binaerdaten gelesen" );
+/*N*/ if( pStrm->Tell() != nFlagRecEnd )
+/*N*/ Warning(),
+/*?*/ pStrm->Seek( nFlagRecEnd );
+/*N*/ }
+
+// Merken der Position fuer einen 16-Bit-Wert, der spaeter dort eingefuegt wird
+// Der Parameter ist nur Dokumentation
+
+/*N*/ void Sw3IoImp::OpenValuePos16( sal_uInt16 )
+/*N*/ {
+/*N*/ sal_uInt16 nLvl = aValPositions.Count();
+/*N*/ if( nLvl >= 31 && IsSw31Or40Export() )
+/*N*/ Error( ERR_SWG_LARGE_DOC_ERROR );
+/*N*/ aValPositions.Insert( pStrm->Tell(), nLvl );
+/*N*/ *pStrm << (sal_uInt16) 0;
+/*N*/ }
+
+// Einfuegen eines 16-Bit-Werts an der obersten Stack-Position
+
+/*N*/ void Sw3IoImp::CloseValuePos16( sal_uInt16 nVal )
+/*N*/ {
+/*N*/ sal_uInt16 nLvl = aValPositions.Count();
+/*N*/ ASSERT( nLvl, "Unterlauf ValuePos-Stack" );
+/*N*/ if( nLvl )
+/*N*/ {
+/*N*/ nLvl--;
+/*N*/ sal_uInt32 nPos = pStrm->Tell();
+/*N*/ pStrm->Seek( aValPositions[nLvl] );
+/*N*/ aValPositions.Remove( nLvl, 1 );
+/*N*/ *pStrm << nVal;
+/*N*/ pStrm->Seek( nPos );
+/*N*/ }
+/*N*/ }
+
+// Merken der Position fuer einen 32-Bit-Wert, der spaeter dort eingefuegt wird
+// Der Parameter ist nur Dokumentation
+
+/*N*/ void Sw3IoImp::OpenValuePos32( sal_uInt32 )
+/*N*/ {
+/*N*/ sal_uInt16 nLvl = aValPositions.Count();
+/*N*/ if( nLvl >= 31 && IsSw31Or40Export() )
+/*N*/ Error( ERR_SWG_LARGE_DOC_ERROR );
+/*N*/ aValPositions.Insert( pStrm->Tell(), nLvl );
+/*N*/ *pStrm << (sal_uInt32) 0;
+/*N*/ }
+
+// Einfuegen eines 32-Bit-Werts an der obersten Stack-Position
+
+/*N*/ void Sw3IoImp::CloseValuePos32( sal_uInt32 nVal )
+/*N*/ {
+/*N*/ sal_uInt16 nLvl = aValPositions.Count();
+/*N*/ ASSERT( nLvl, "Unterlauf ValuePos-Stack" );
+/*N*/ if( nLvl )
+/*N*/ {
+/*N*/ nLvl--;
+/*N*/ sal_uInt32 nPos = pStrm->Tell();
+/*N*/ pStrm->Seek( aValPositions[nLvl] );
+/*N*/ aValPositions.Remove( nLvl, 1 );
+/*N*/ *pStrm << nVal;
+/*N*/ pStrm->Seek( nPos );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::CheckIoError( SvStream* p )
+/*N*/ {
+/*N*/ const sal_uInt32 nErr = p->GetErrorCode();
+/*N*/ if( nErr != SVSTREAM_OK )
+/*N*/ {
+/*?*/ if( IsWarning(nErr) )
+/*?*/ {
+/*?*/ nWarn = p->GetErrorCode();
+/*?*/ p->ResetError();
+/*?*/ }
+/*?*/ else if( nErr == SVSTREAM_DISK_FULL )
+/*?*/ nRes = ERR_W4W_WRITE_FULL;
+/*?*/ else
+/*?*/ nRes = bOut ? ERR_SWG_WRITE_ERROR : ERR_SWG_READ_ERROR;
+/*N*/ }
+/*N*/ }
+
+// Komprimiertes Speichern von sal_uInt32. Das Speichern erfolgt aehnlich wie
+// im UTF-Zeichensatz:
+//
+// von bis bytes start byte (binaer)
+// ----------------------------------------------------
+// 0x0000 0000 0x0000 007f 1 0x0xxx xxxx
+// 0x0000 0080 0x0000 3fff 2 0x10xx xxxx
+// 0x0000 4000 0x001f ffff 3 0x110x xxxx
+// 0x0020 0000 0x0fff ffff 4 0x1110 xxxx
+// 0x1000 0000 0xffff ffff 5 0x1111 0??? xxxx xxxx
+//
+// Sofern zwei oder view Bytes gleichzeitig geschrieben werden koennten,
+// werden sie als sal_uInt16 oder sal_uInt32 am Stueck geschrieben.
+// Bei 5 Bytes bleiben die ersten 3 Bits unbenutzt. Sie werden beim
+// Einlesen ignoriert und koennen deshalb spaeter mal fuer etwas anderes
+// benutzt werden.
+
+/*N*/ sal_uInt32 Sw3IoImp::InULong( SvStream& rStrm )
+/*N*/ {
+/*N*/ sal_uInt32 n32;
+/*N*/ sal_uInt16 n16;
+/*N*/ sal_uInt8 n8;
+/*N*/
+/*N*/ rStrm >> n8;
+/*N*/ if( (n8 & 0x80) == 0x00 )
+/*N*/ {
+/*N*/ // 0x0www wwww
+/*N*/ // --> 0x0000 0000 0000 0000 0000 0000 0www wwww
+/*N*/
+/*N*/ n32 = (sal_uInt32)(n8 & 0x7F);
+/*N*/ }
+/*N*/ else if( (n8 & 0xC0) == 0x80 )
+/*N*/ {
+/*N*/ // 0x10xx xxxx wwww wwww
+/*N*/ // --> 0x0000 0000 0000 0000 00xx xxxx wwww wwww
+/*N*/
+/*?*/ n32 = (sal_uInt32)(n8 & 0x3F);
+/*?*/ n32 <<= 8;
+/*?*/
+/*?*/ rStrm >> n8;
+/*?*/ n32 += (sal_uInt32)n8;
+/*?*/ }
+/*?*/ else if( (n8 & 0xE0) == 0xC0 )
+/*?*/ {
+/*?*/ // 0x110y yyyy wwww wwww xxxx xxxx
+/*?*/ // --> 0x0000 0000 000y yyyy xxxx xxxx wwww wwww
+/*?*/
+/*?*/ n32 = (sal_uInt32)(n8 & 0x1F);
+/*?*/ n32 <<= 16;
+/*?*/
+/*?*/ rStrm >> n16;
+/*?*/ n32 += (sal_uInt32)n16;
+/*?*/ }
+/*?*/ else if( (n8 & 0xF0) == 0xE0 )
+/*?*/ {
+/*?*/ // 0x1110 zzzz yyyy yyyy wwww wwww xxxx xxxx
+/*?*/ // --> 0x0000 zzzz yyyy yyyy xxxx xxxx wwww wwww
+/*?*/
+/*?*/ n32 = (sal_uInt32)(n8 & 0x0F);
+/*?*/ n32 <<= 8;
+/*?*/
+/*?*/ rStrm >> n8;
+/*?*/ n32 += (sal_uInt32)n8;
+/*?*/ n32 <<= 16;
+/*?*/
+/*?*/ rStrm >> n16;
+/*?*/ n32 += (sal_uInt32)n16;
+/*?*/ }
+/*?*/ else if( (n8 & 0xF8) == 0xF0 )
+/*?*/ {
+/*?*/ // 0x1111 0??? wwww wwww xxxx xxxx yyyy yyyy zzzz zzzz
+/*?*/ // --> zzzz zzzz yyyy yyyy xxxx xxxx wwww wwww
+/*?*/ rStrm >> n32;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // Error( ERR_SWG_READ_ERROR );
+/*?*/ n32 = 0xABADCAFE;
+/*N*/ }
+/*N*/
+/*N*/ return (sal_uInt32)n32;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutULong( SvStream& rStrm, sal_uInt32 n32 )
+/*N*/ {
+/*N*/ if( n32 < 0x00000080 )
+/*N*/ {
+/*N*/ // 0w0000 0000 0000 0000 0000 0000 0www wwww
+/*N*/ // -> 0w0www wwww
+/*N*/
+/*N*/ rStrm << (sal_uInt8)n32;
+/*N*/ }
+/*N*/ else if( n32 < 0x00004000 )
+/*N*/ {
+/*N*/ // 0x0000 0000 0000 0000 00xx xxxx wwww wwww
+/*N*/ // --> 0x10xx xxxx wwww wwww
+/*N*/
+/*?*/ n32 |= 0x00008000;
+/*?*/ rStrm << (sal_uInt8)(n32 >> 8);
+/*?*/ rStrm << (sal_uInt8)n32;
+/*?*/ }
+/*?*/ else if( n32 < 0x00200000 )
+/*?*/ {
+/*?*/ // 0x110y yyyy xxxx xxxx wwww wwww
+/*?*/ // --> 0x0000 0000 000y yyyy wwww wwww xxxx xxxx
+/*?*/
+/*?*/ n32 |= 0x00C00000;
+/*?*/ rStrm << (sal_uInt8)(n32 >> 16);
+/*?*/ rStrm << (sal_uInt16)n32;
+/*?*/ }
+/*?*/ else if( n32 < 0x10000000 )
+/*?*/ {
+/*?*/ // 0x1110 zzzz yyyy yyyy xxxx xxxx wwww wwww
+/*?*/ // --> 0x0000 zzzz yyyy yyyy wwww wwww xxxx xxxx
+/*?*/
+/*?*/ n32 |= 0xE0000000;
+/*?*/ rStrm << (sal_uInt8)(n32 >> 24);
+/*?*/ rStrm << (sal_uInt8)(n32 >> 16);
+/*?*/ rStrm << (sal_uInt16)n32;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // zzzz zzzz yyyy yyyy xxxx xxxx wwww wwww
+/*?*/ // --> 0x1111 00000 wwww wwww xxxx xxxx yyyy yyyy zzzz zzzz
+/*?*/
+/*?*/ rStrm << (sal_uInt8)0xF0;
+/*?*/ rStrm << (sal_uInt32)n32;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+*
+* Prozentanzeige
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::OpenPercentBar( sal_uInt32 n1, sal_uInt32 n2 )
+/*N*/ {
+/*N*/ if( !bBlock )
+/*N*/ {
+/*N*/ nCurPercent = n1;
+/*N*/ nEndPercent = n2;
+/*N*/ ::binfilter::StartProgress( bOut ? STR_STATSTR_SWGWRITE : STR_STATSTR_SWGREAD,
+/*N*/ n1, n2, pDoc->GetDocShell() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ void Sw3IoImp::ClosePercentBar()
+/*N*/ {
+/*N*/ if( !bBlock )
+/*N*/ ::binfilter::EndProgress( pDoc->GetDocShell() );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::SetPercentBar( sal_uInt32 n )
+/*N*/ {
+/*N*/ //ASSERT( pStrm!=pContents || (n-nCurPercent)<1024, "SetPercentBar zu lange nicht mehr aufgerufen!" );
+/*N*/ if( !bBlock && (pStrm == &pContents ) && // nicht fuer SwPageStyles
+/*N*/ ( n > nCurPercent ) && ( n <= nEndPercent ) )
+/*N*/ ::binfilter::SetProgressState( nCurPercent = n, pDoc->GetDocShell() );
+/*N*/ }
+
+/*************************************************************************
+*
+* Drawing Layer
+*
+*************************************************************************/
+
+#define SIGN_FRMIDS 0x444D
+
+/*N*/ void Sw3IoImp::LoadDrawingLayer()
+/*N*/ {
+/*N*/ if( !pDrawing.Is() || ( nFltFlags & FLTF_NO_DRAWINGS )
+/*N*/ #ifdef DBG_UTIL
+/*N*/ || SwViewOption::IsTest9()
+/*N*/ #endif
+/*N*/ )
+/*N*/ {
+/*N*/ // gar kein Drawing-Stream da!
+/*N*/ // nGblFlags |= SW3F_NODRAWING;
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Wenn der erste Stream gelesen wird, kann es noch keine RecSizes geben
+/*N*/ ASSERT( !HasRecSizes(), "Hier darf es noch keine RecSizes geben" );
+/*N*/ if( HasRecSizes() )
+ FlushRecSizes();
+/*N*/
+/*N*/ pDrawing->Seek( 0L );
+/*N*/ pDrawing->SetBufferSize( SW3_BSR_DRAWING );
+/*N*/ SdrModel* pModel = NULL;
+/*N*/ if( bInsert )
+/*N*/ {
+/*N*/ //!!Diesen Code parallel zum Code fuer die Pools im docnew.cxx
+/*N*/ //pflegen.
+/*?*/ SfxItemPool *pAttrPool = new SfxItemPool(
+/*?*/ String::CreateFromAscii("SWG"),
+/*?*/ POOLATTR_BEGIN, POOLATTR_END-1,
+/*?*/ aSlotTab, aAttrTab );
+/*?*/ SfxItemPool *pSdrPool = new SdrItemPool( pAttrPool );
+/*?*/ SfxItemPool *pEEgPool = EditEngine::CreatePool();
+/*?*/ pSdrPool->SetSecondaryPool( pEEgPool );
+/*?*/ pAttrPool->FreezeIdRanges();
+/*?*/ SdrModel* pInsModel = new SwDrawDocument( pAttrPool, pDoc->GetDocShell() );
+/*?*/ pSdrPool->Load( *pDrawing );
+/*?*/ if( pDrawing->GetError() == SVSTREAM_OK )
+/*?*/ *pDrawing >> *pInsModel;
+/*?*/ if( pDrawing->GetError() == SVSTREAM_OK )
+/*?*/ {
+/*?*/ pModel = pDoc->MakeDrawModel();
+/*?*/ // Objekte werden vor die aktuellen Objekte eingefuegt
+/*?*/ SdrPage* pInsPage = pInsModel->GetPage( 0 );
+/*?*/ SdrPage* pPage = pModel->GetPage( 0 );
+/*?*/ pPage->RecalcObjOrdNums();
+/*?*/ nZOrderOff = pPage->GetObjCount();
+/*?*/
+/*?*/ for( sal_uInt32 n = pInsPage->GetObjCount(); n--; )
+/*?*/ {
+/*?*/ SdrObject* pObj = pInsPage->RemoveObject( 0 );
+/*?*/ if( pObj )
+/*?*/ pPage->InsertObject( pObj );
+/*?*/ else
+/*?*/ ASSERT( !this, "wo ist das DrawObject?" );
+/*?*/ }
+/*?*/ }
+/*?*/ delete pInsModel;
+/*?*/ pSdrPool->Delete();
+/*?*/ pAttrPool->SetSecondaryPool(0);
+/*?*/ pSdrPool->SetSecondaryPool(0);
+/*?*/ delete pAttrPool;
+/*?*/ delete pSdrPool;
+/*?*/ delete pEEgPool;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pModel = pDoc->MakeDrawModel();
+/*N*/ SfxItemPool *pDrawPool = pModel->GetItemPool().GetSecondaryPool();
+/*N*/ ASSERT( pDrawPool, "DrawPool not found" );
+/*N*/ pDrawPool->Load( *pDrawing );
+/*N*/ if( pDrawing->GetError() == SVSTREAM_OK )
+/*N*/ {
+/*N*/ *pDrawing >> *pModel;
+/*N*/ // for Bug 73110 - decrement all item refcounts
+/*N*/ pDrawPool->LoadCompleted();
+/*N*/ }
+/*N*/ }
+/*N*/ if( pDrawing->GetError() != SVSTREAM_OK )
+/*N*/ {
+/*N*/ // Wenn der doofe Drawing Layer mal wieder Probleme gemacht hat,
+/*N*/ // einfach keine Zeichenobjekte laden!
+/*?*/ pDoc->InitDrawModel();
+/*?*/ // Keinen Fehler setzen, sondern Dokument weiter bearbeiten,
+/*?*/ // um so viel wie moeglich vom Dok zu retten.
+/*?*/ bNoDrawings = sal_True;
+/*?*/ pDrawing->SetBufferSize( 0 );
+/*?*/ return;
+/*N*/ }
+/*N*/ else
+/*N*/ // Der Drawing Layer ist jetzt verfuegbar
+/*N*/ nGblFlags &= ~SW3F_NODRAWING;
+/*N*/ // Zu guter Letzt muss noch fuer jeden frame::Frame ein FlyDraw-Objekt
+/*N*/ // angelegt werden, damit die Z-Order der Zeichenobjekte wieder
+/*N*/ // stimmt.
+/*N*/ sal_uInt16 nSign = 0, nFrmIds = 0;
+/*N*/ *pDrawing >> nSign >> nFrmIds;
+/*N*/ if( nSign == SIGN_FRMIDS )
+/*N*/ {
+/*N*/ pModel = pDoc->MakeDrawModel();
+/*N*/ SdrPage* pPage = pModel->GetPage( 0 );
+/*N*/ for( sal_uInt16 i = 0; i < nFrmIds; i++ )
+/*N*/ {
+/*N*/ sal_uInt32 nFrmPos;
+/*N*/ *pDrawing >> nFrmPos;
+/*N*/ if( pDrawing->GetError() != SVSTREAM_OK || pDrawing->IsEof() )
+/*N*/ {
+/*N*/ Error( ERR_SWG_READ_ERROR );
+/*N*/ break;
+/*N*/ }
+/*N*/ pPage->InsertObject( new SwFlyDrawObj, nFrmPos + nZOrderOff );
+/*N*/ }
+/*N*/ }
+/*N*/ nHiddenDrawObjs = ULONG_MAX;
+/*N*/ if( !nRes && SOFFICE_FILEFORMAT_50 <= pDrawing->GetVersion() )
+/*N*/ {
+/*N*/ sal_uInt32 n;
+/*N*/ *pDrawing >> n;
+// Nowadays all objects remain in the page, but might be in different layers
+// if( !pDrawing->IsEof() && pModel )
+// {
+// sal_uInt32 nCount = pModel->GetPage( 0 )->GetObjCount();
+// if( n <= nCount )
+// nHiddenDrawObjs = nCount - n;
+// }
+/*N*/ }
+/*N*/
+/*N*/ CheckIoError( pDrawing );
+/*N*/ pDrawing->SetBufferSize( 0 );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::SaveDrawingLayer()
+/*N*/ {
+/*N*/ // Wenn kein Stream da ist, gibt es im Layer nix zu saven.
+/*N*/ if( !pDrawing.Is() )
+/*N*/ return;
+/*N*/
+/*N*/ if( HasRecSizes() ) // sicher ist sicher
+/*?*/ FlushRecSizes();
+/*N*/
+/*N*/ pDrawing->SetSize( 0L );
+/*N*/ // Stream weg, wenn wir kein OLE-Objekt sind
+/*N*/ //if( pRoot->IsRoot() )
+/*N*/ // pRoot->Commit();
+/*N*/ pDrawing->SetBufferSize( SW3_BSW_DRAWING );
+/*N*/
+/*N*/ // Den Pool nicht vergessen...
+/*N*/ SdrModel* pModel = pDoc->GetDrawModel();
+/*N*/ ASSERT( pModel, "SaveDrawingLayer without DrawModel" );
+/*N*/ //Auf die Korrektheit der OrdNums sind wir schon angewiesen.
+/*N*/ pModel->GetPage( 0 )->RecalcObjOrdNums();
+/*N*/
+/*N*/ //-/ pModel->PrepareStore();
+/*N*/ pModel->PreSave();
+/*N*/
+/*N*/ SfxItemPool *pDrawIPool = pModel->GetItemPool().GetSecondaryPool();
+/*N*/ ASSERT( pDrawIPool, "DrawPool not found" );
+/*N*/
+/*N*/ // Die FF-Version muss an einem Master-Pool stehen
+/*N*/ long nFFVersion = pDrawing->GetVersion();
+/*N*/ long nOldFFVersion = pModel->GetItemPool().GetFileFormatVersion();
+/*N*/ ASSERT( IsSw31Export() ? nFFVersion==SOFFICE_FILEFORMAT_31
+/*N*/ : (nFFVersion==SOFFICE_FILEFORMAT_40 ||
+/*N*/ nFFVersion==SOFFICE_FILEFORMAT_50),
+/*N*/ "FF-Version am Drawing-Layer-Stream stimmt nicht" );
+/*N*/ pModel->GetItemPool().SetFileFormatVersion( (sal_uInt16)nFFVersion );
+/*N*/
+/*N*/ pDrawIPool->Store( *pDrawing );
+/*N*/ *pDrawing << *pModel;
+/*N*/
+/*N*/ pModel->GetItemPool().SetFileFormatVersion( nOldFFVersion );
+/*N*/
+/*N*/
+/*N*/ // Nun noch die Liste der frame::Frame-Z-IDs
+/*N*/ sal_uInt16 nFrmIds = 0;
+/*N*/ sal_uInt32 nIdPos = 0;
+/*N*/ SdrPage* pPage = pModel->GetPage( 0 );
+/*N*/ for ( sal_uInt32 i = 0; i < pPage->GetObjCount(); i++ )
+/*N*/ {
+/*N*/ SdrObject *pObj = pPage->GetObj( i );
+/*N*/ // fix #45256#: Auch die Indizes von Master-Objekten muessen
+/*N*/ // exportiert werden, weil sonst die Indizes der anderen Objekte
+/*N*/ // beim Laden nicht mehr stimmen.
+/*N*/ if ( pObj->IsWriterFlyFrame() || pObj->ISA(SwFlyDrawObj) )
+/*N*/ {
+/*N*/ if( !nFrmIds )
+/*N*/ {
+/*N*/ *pDrawing << (sal_uInt16) SIGN_FRMIDS;
+/*N*/ nIdPos = pDrawing->Tell();
+/*N*/ *pDrawing << (sal_uInt16) nFrmIds;
+/*N*/ }
+/*N*/ *pDrawing << (sal_uInt32) i;
+/*N*/ nFrmIds++;
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ {
+/*N*/ size_t nArrSz = pPage->GetObjCount() / 8;
+/*N*/ if( (pPage->GetObjCount() % 8) > 0 )
+/*N*/ nArrSz++;
+/*N*/ pRefSdrObjects = new sal_uInt8[nArrSz];
+/*N*/ while( nArrSz )
+/*N*/ pRefSdrObjects[--nArrSz] = 0;
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if( nFrmIds )
+/*N*/ {
+/*N*/ sal_uInt32 nPos = pDrawing->Tell();
+/*N*/ pDrawing->Seek( nIdPos );
+/*N*/ *pDrawing << (sal_uInt16) nFrmIds;
+/*N*/ pDrawing->Seek( nPos );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ *pDrawing << (sal_uInt16)0 << (sal_uInt16)0;
+/*N*/ }
+/*N*/ if( !IsSw31Or40Export() )
+/*N*/ {
+/*N*/ *pDrawing << 0; // was nHiddenDrawObjs!!!
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( !pModel->GetStyleSheetPool(), "SdrModel hat StyleSheet-Pool" );
+/*N*/ pDrawing->Commit();
+/*N*/ CheckIoError( pDrawing );
+/*N*/ pDrawing->SetBufferSize( 0 );
+/*N*/
+/*N*/ pModel->PostSave();
+/*N*/ }
+
+/*************************************************************************
+*
+* Seitenvorlagen
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::LoadPageStyles()
+/*N*/ {
+/*N*/ pPageStyles->Seek( 0L );
+/*N*/ pPageStyles->SetBufferSize( SW3_BSR_PAGESTYLES );
+/*N*/ SvStream* pOld = pStrm;
+/*N*/ pStrm = pPageStyles;
+/*N*/ if( !nRes )
+/*N*/ InPageDescs();
+/*N*/ pStrm = pOld;
+/*N*/ CheckIoError( pPageStyles );
+/*N*/ pPageStyles->SetBufferSize( 0 );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::SavePageStyles( sal_Bool bUsed )
+/*N*/ {
+/*N*/ // Falls der Stream existiert, muessen die dazugehoerigen Grafiken
+/*N*/ // geloescht werden.
+/*N*/ SvStream* pOld = pStrm;
+/*N*/ pStrm = pPageStyles;
+/*N*/ pPageStyles->SetSize( 0L );
+/*N*/ // Stream weg, wenn wir kein OLE-Objekt sind
+/*N*/ //if( pRoot->IsRoot() )
+/*N*/ // pRoot->Commit();
+/*N*/ pPageStyles->SetBufferSize( SW3_BSW_PAGESTYLES );
+/*N*/ OutPageDescs( bUsed );
+/*N*/
+/*N*/ sal_uInt32 nRecSzPos = 0;
+/*N*/ if( !nRes && HasRecSizes() && !IsSw31Or40Export() )
+/*?*/ nRecSzPos = OutRecSizes();
+/*N*/
+/*N*/ OpenRec( SWG_EOF );
+/*N*/ CloseRec( SWG_EOF );
+/*N*/
+/*N*/ if( nRecSzPos )
+/*?*/ OutRecordSizesPos( nRecSzPos );
+/*N*/
+/*N*/ pStrm = pOld;
+/*N*/ pPageStyles->Commit();
+/*N*/ CheckIoError( pPageStyles );
+/*N*/ pPageStyles->SetBufferSize( 0 );
+/*N*/ }
+
+/*************************************************************************
+*
+* Numerierungs-Regeln
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::LoadNumRules()
+/*N*/ {
+/*N*/ if( !pNumRules.Is() )
+/*N*/ return;
+/*N*/
+/*N*/ pNumRules->Seek( 0L );
+/*N*/ pNumRules->SetBufferSize( SW3_BSR_NUMRULES );
+/*N*/ SvStream* pOld = pStrm;
+/*N*/ pStrm = pNumRules;
+/*N*/ if( !nRes )
+/*N*/ InNumRules();
+/*N*/ pStrm = pOld;
+/*N*/ CheckIoError( pNumRules );
+/*N*/ pNumRules->SetBufferSize( 0 );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::SaveNumRules( sal_Bool bUsed )
+/*N*/ {
+/*N*/ if( !pNumRules.Is() )
+/*N*/ return;
+/*N*/
+/*N*/ SvStream* pOld = pStrm;
+/*N*/ pStrm = pNumRules;
+/*N*/ pNumRules->SetSize( 0L );
+/*N*/ pNumRules->SetBufferSize( SW3_BSW_NUMRULES );
+/*N*/ OutNumRules( bUsed );
+/*N*/
+/*N*/ sal_uInt32 nRecSzPos = 0;
+/*N*/ if( !nRes && HasRecSizes() && !IsSw31Or40Export() )
+/*?*/ nRecSzPos = OutRecSizes();
+/*N*/
+/*N*/ OpenRec( SWG_EOF );
+/*N*/ CloseRec( SWG_EOF );
+/*N*/
+/*N*/ if( nRecSzPos )
+/*?*/ OutRecordSizesPos( nRecSzPos );
+/*N*/
+/*N*/ pStrm = pOld;
+/*N*/ pNumRules->Commit();
+/*N*/ CheckIoError( pNumRules );
+/*N*/ pNumRules->SetBufferSize( 0 );
+/*N*/ }
+
+/*************************************************************************
+*
+* Inhaltlicher Teil
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::LoadContents( SwPaM* pPaM )
+/*N*/ {
+/*N*/ pContents->Seek( 0L );
+/*N*/ pContents->SetBufferSize( SW3_BSR_CONTENTS );
+/*N*/ pStrm = pContents;
+/*N*/ LoadDocContents( pPaM );
+/*N*/ pStrm = NULL;
+/*N*/ CheckIoError( pContents );
+/*N*/ pContents->SetBufferSize( 0 );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::SaveContents( SwPaM& rPaM, const String* pBlkName )
+/*N*/ {
+/*N*/ pStrm = pContents;
+/*N*/ pContents->SetSize( 0L );
+/*N*/ // Stream weg, wenn wir kein OLE-Objekt sind
+/*N*/ //if( pRoot->IsRoot() )
+/*N*/ // pRoot->Commit();
+/*N*/ pContents->SetBufferSize( SW3_BSW_CONTENTS );
+/*N*/ SaveDocContents( rPaM, pBlkName );
+/*N*/ pStrm = NULL;
+/*N*/ pContents->Commit();
+/*N*/ CheckIoError( pContents );
+/*N*/ pContents->SetBufferSize( 0 );
+/*N*/ }
+
+/*************************************************************************
+*
+* String-Pool
+*
+*************************************************************************/
+
+#define EXT_SEPARATOR ((sal_Unicode) 0x0A)
+
+/*N*/ Sw3StringPool::Sw3StringPool()
+/*N*/ {
+/*N*/ bFixed = sal_False;
+/*N*/ }
+
+const int RES_POOLCOLL_HTML_LISTING_40 = 0x3002;
+const int RES_POOLCOLL_HTML_XMP_40 = 0x3003;
+const int RES_POOLCOLL_HTML_HR_40 = 0x3004;
+const int RES_POOLCOLL_HTML_H6_40 = 0x3005;
+const int RES_POOLCOLL_HTML_DD_40 = 0x3006;
+const int RES_POOLCOLL_HTML_DT_40 = 0x3007;
+
+/*N*/ sal_uInt16 Sw3StringPool::ConvertFromOldPoolId( sal_uInt16 nId, sal_uInt16 nVersion )
+/*N*/ {
+/*N*/ if( nVersion < SWG_HTMLCOLLCHG )
+/*N*/ {
+/*N*/ // - H6 wurde entfernt und muss durch Ueberschrift 6 ersetzt werden.
+/*N*/ // - LISTING unx XMP wurden ebenfalls entfernt. Fuer sie muessen
+/*N*/ // Benutzer-Vorlagen angelegt werden
+/*N*/ // - HR, DT und DD sind nach vorne gerueckt.
+/*N*/ switch( nId )
+/*N*/ {
+/*N*/ case RES_POOLCOLL_HTML_LISTING_40:
+/*?*/ case RES_POOLCOLL_HTML_XMP_40:
+/*?*/ nId |= USER_FMT;
+/*?*/ break;
+/*?*/
+/*?*/ case RES_POOLCOLL_HTML_HR_40: nId = RES_POOLCOLL_HTML_HR; break;
+/*?*/ case RES_POOLCOLL_HTML_H6_40: nId = RES_POOLCOLL_HEADLINE6; break;
+/*?*/ case RES_POOLCOLL_HTML_DD_40: nId = RES_POOLCOLL_HTML_DD; break;
+/*?*/ case RES_POOLCOLL_HTML_DT_40: nId = RES_POOLCOLL_HTML_DT; break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return nId;
+/*N*/ }
+
+/*N*/ sal_uInt16 Sw3StringPool::ConvertToOldPoolId( sal_uInt16 nId, sal_uInt32 nFFVersion )
+/*N*/ {
+/*N*/ if( nFFVersion <= SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*N*/ // H6, LISTUNG undx XMP wurden entfernt.
+/*N*/ // HR, DT und DD sind nach vorne gerueckt.
+/*N*/ switch( nId )
+/*N*/ {
+/*?*/ case RES_POOLCOLL_HTML_HR: nId = RES_POOLCOLL_HTML_HR_40; break;
+/*?*/ case RES_POOLCOLL_HEADLINE6:nId = RES_POOLCOLL_HTML_H6_40; break;
+/*?*/ case RES_POOLCOLL_HTML_DD: nId = RES_POOLCOLL_HTML_DD_40; break;
+/*?*/ case RES_POOLCOLL_HTML_DT: nId = RES_POOLCOLL_HTML_DT_40; break;
+/*N*/
+/*N*/ //JP 05.05.98: im 3.1/4.0 war ein Bug im sw3style bei der Abfrage
+/*N*/ // ob die PoolID einer Zeichenvorlage eine Benutzer-
+/*N*/ // definierte ID ist. Alles zwischen
+/*N*/ // RES_POOLCHR_NORMAL_END und RES_POOLCHR_HTML_BEGIN
+/*N*/ // werden als gueltig erkannt, was falsch ist.
+/*N*/ default:
+/*N*/ if( ( RES_POOLCHR_TOXJUMP < nId && nId < RES_POOLCHR_NORMAL_END )
+/*N*/ ||( RES_POOLFRM_WATERSIGN < nId && nId < RES_POOLFRM_END )
+/*N*/ ||( RES_POOLPAGE_HTML < nId && nId < RES_POOLPAGE_END ) )
+/*N*/ nId = USHRT_MAX;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return nId;
+/*N*/ }
+
+
+// Sammeln der Strings am Doc. Es werden alle Strings aus benannten
+// Formaten, Collections und PageDescs gesammelt. Weiter wird allen
+// Auto-Frameformaten eine Extension im Namen verpaát, weil die Namen
+// nicht eindeutig sind.
+
+/*N*/ void Sw3StringPool::Setup( SwDoc& rDoc, long nFFVersion,
+/*N*/ Sw3ExportInfo *pExportInfo )
+/*N*/ {
+/*N*/ Clear();
+/*N*/ nExpFFVersion = nFFVersion;
+/*N*/
+/*N*/ // Das Written-Flag wird gleich mit geknackt!
+/*N*/ // Das ist wichtig, da Formate (theoretisch) in verschiedenen
+/*N*/ // Streams landen koennen.
+/*N*/ SwMsgPoolItem aMsgHint( RES_RESET_FMTWRITTEN );
+/*N*/ rDoc.GetDfltFrmFmt()->Modify( &aMsgHint, &aMsgHint );
+/*N*/
+/*N*/ bFixed = sal_False;
+/*N*/ // Defaultformate:
+/*N*/ Setup( rDoc, *rDoc.GetDfltFrmFmt() );
+/*N*/ Setup( rDoc, *rDoc.GetDfltCharFmt() );
+/*N*/ // Text-Collections
+/*N*/ sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->Count();
+ sal_uInt16 n=0;
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ Setup( rDoc, *(*rDoc.GetTxtFmtColls())[ n ] );
+/*N*/ // benannte Zeichen- und Rahmenvorlagen
+/*N*/ nArrLen = rDoc.GetCharFmts()->Count();
+/*N*/ // Element 0 ist das Default-Format!
+/*N*/ for( n = 1; n < nArrLen; n++ )
+/*N*/ Setup( rDoc, *(*rDoc.GetCharFmts())[ n ] );
+/*N*/ nArrLen = rDoc.GetFrmFmts()->Count();
+/*N*/ // Element 0 ist das Default-Format!
+/*N*/ for( n = 1; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ const SwFmt& rFmt = *(*rDoc.GetFrmFmts())[ n ];
+/*N*/ // Autoformate in dieser Liste muessen mit einer
+/*N*/ // Extension versehen werden!
+/*N*/ sal_uInt16 nFmtId = 0;
+/*N*/ const String& rName = rFmt.GetName();
+/*N*/ // TODO: unicode: correct?
+/*N*/ if( rFmt.IsAuto() ) // Autoformat
+/*N*/ nFmtId = Count()+1; //++nId;
+/*N*/ Setup( rDoc, rFmt, nFmtId );
+/*N*/ }
+/*N*/ nArrLen = rDoc.GetSpzFrmFmts()->Count();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ Setup( rDoc, *(*rDoc.GetSpzFrmFmts())[ n ], Count()+1 /*++nId*/ );
+/*N*/ // Auch hier muss eine Extension mit ran
+/*N*/ nArrLen = rDoc.GetTblFrmFmts()->Count();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ Setup( rDoc, *(*rDoc.GetTblFrmFmts())[ n ], Count()+1 /*++nId*/ );
+/*N*/ nArrLen = rDoc.GetSections().Count();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ Setup( rDoc, *rDoc.GetSections()[ n ], Count()+1 /*++nId*/ );
+/*N*/ // Seitenvorlagen
+/*N*/ nArrLen = rDoc.GetPageDescCnt();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ const SwPageDesc& rPg = rDoc.GetPageDesc( n );
+/*N*/ Add( rPg.GetName(), rPg.GetPoolFmtId() );
+/*N*/ }
+/*N*/
+/*N*/ if( nExpFFVersion <= SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*N*/ Add( String::CreateFromAscii(sSW3IO_FixedField), USHRT_MAX );
+/*N*/ Add( String::CreateFromAscii(sSW3IO_AuthorityField), USHRT_MAX );
+/*N*/ }
+/*N*/ /* #108791# */
+/*N*/ Add( String::CreateFromAscii(sSW3IO_DropDownField), USHRT_MAX );
+/*N*/
+/*N*/ // fix #26064#: Namen der 3 Label Numernkreise: Hier wird zusaetzlich
+/*N*/ // noch die Pool-Id des dazugehoerigen Formats gespeichert
+/*N*/ {
+/*N*/ String aAbb( SW_RES(STR_POOLCOLL_LABEL_ABB) );
+/*N*/ String aTable( SW_RES(STR_POOLCOLL_LABEL_TABLE) );
+/*N*/ String aFrame( SW_RES(STR_POOLCOLL_LABEL_FRAME) );
+/*N*/ String aDrawing( SW_RES(STR_POOLCOLL_LABEL_DRAWING) );
+/*N*/
+/*N*/ for( n = 0; n < INIT_FLDTYPES; n++ )
+/*N*/ {
+/*N*/ SwFieldType *pFldType = (*rDoc.GetFldTypes())[n];
+/*N*/ switch (pFldType->Which())
+/*N*/ {
+/*N*/ case RES_SETEXPFLD:
+/*N*/ {
+/*N*/ if( GSE_SEQ & ((const SwSetExpFieldType *)pFldType)->GetType() )
+/*N*/ {
+/*N*/ sal_uInt16 nPoolId = USHRT_MAX;
+/*N*/ const String& rName = pFldType->GetName();
+/*N*/ if( aAbb == rName )
+/*N*/ nPoolId = RES_POOLCOLL_LABEL_ABB;
+/*N*/ else if( aTable == rName )
+/*N*/ nPoolId = RES_POOLCOLL_LABEL_TABLE;
+/*N*/ else if( aFrame == rName )
+/*N*/ nPoolId = RES_POOLCOLL_LABEL_FRAME;
+/*N*/ else if( aDrawing == rName )
+/*N*/ nPoolId = RES_POOLCOLL_LABEL_DRAWING;
+/*N*/
+/*N*/ Add( rName, nPoolId );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DBSETNUMBERFLD:
+/*N*/ case RES_DBNUMSETFLD:
+/*N*/ case RES_DBNEXTSETFLD:
+/*N*/ case RES_DBNAMEFLD:
+/*N*/ if( nExpFFVersion > SOFFICE_FILEFORMAT_31 )
+/*N*/ {
+/*N*/ SwClientIter aIter( *pFldType );
+/*N*/
+/*N*/ for( SwFmtFld* pFmtFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) );
+/*N*/ pFmtFld; pFmtFld = (SwFmtFld*)aIter.Next() )
+/*N*/ {
+/*N*/ if( pFmtFld->GetTxtFld() )
+/*N*/ {
+/*N*/ SwDBNameInfField* pFld = (SwDBNameInfField *)pFmtFld->GetFld();
+/*N*/ SwDBData aData(pFld->GetRealDBData());
+/*N*/ String sDBName(aData.sDataSource);
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ Add( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ }
+/*N*/ // Namen benutzerdefinierter Felder
+/*N*/ nArrLen = rDoc.GetFldTypes()->Count();
+/*N*/ if( nArrLen > INIT_FLDTYPES )
+/*N*/ {
+/*N*/ for( n = INIT_FLDTYPES; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ SwFieldType *pFldType = (*rDoc.GetFldTypes())[n];
+/*N*/
+/*N*/ switch (pFldType->Which())
+/*N*/ {
+/*N*/ case RES_DBFLD:
+/*N*/ Add( ((SwDBFieldType*)pFldType)->GetColumnName(), USHRT_MAX );
+/*N*/ if( nExpFFVersion > SOFFICE_FILEFORMAT_31 )
+/*N*/ {
+/*N*/ SwDBData aData(((SwDBFieldType*)pFldType)->GetDBData());
+/*N*/ String sDBName(aData.sDataSource);
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ Add( sDBName, IDX_NOCONV_FF );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ Add( pFldType->GetName(), USHRT_MAX );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Ab dem 5.0-FF stehen auch die Benutzer-definierten Verzeichnisnamen
+/*N*/ // im String-Pool
+/*N*/ if( nExpFFVersion > SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*N*/ const SwSectionFmts& rSectFmts = rDoc.GetSections();
+/*N*/ for( sal_uInt16 n = rSectFmts.Count(); n; )
+/*N*/ {
+/*N*/ const SwTOXType* pType;
+/*N*/ const SwTOXBaseSection *pTOXBaseSect;
+/*N*/ const SwSectionFmt* pSectFmt = rSectFmts[ --n ];
+/*N*/ const SwSection* pSect = pSectFmt->GetSection();
+/*N*/ if( pSect && TOX_CONTENT_SECTION == pSect->GetType() &&
+/*N*/ pSect->GetFmt() && pSectFmt->GetSectionNode() &&
+/*N*/ 0 != (pTOXBaseSect = PTR_CAST( SwTOXBaseSection, pSect )) &&
+/*N*/ 0 != (pType = pTOXBaseSect->GetTOXType()) )
+/*N*/ {
+/*N*/ // All types above TOX_USER are new in version 5.2. That for,
+/*N*/ // their names must be added to the string pool.
+/*N*/ if( pType->GetType() >= TOX_ILLUSTRATIONS ||
+/*N*/ pType->GetTypeName() !=
+/*N*/ SwTOXBase::GetTOXName(pType->GetType()) )
+/*N*/ {
+/*?*/ Add( pType->GetTypeName(), USHRT_MAX );
+/*N*/ }
+/*N*/ // Add template names
+/*N*/ const SwForm& rForm = pTOXBaseSect->GetTOXForm();
+ sal_uInt16 i=0;
+/*N*/ for( i = 0; i < rForm.GetFormMax(); i++ )
+/*N*/ {
+/*N*/ const String& rCollNm = rForm.GetTemplate( i );
+/*N*/ if( rCollNm.Len() )
+/*N*/ SetupTxtCollByName( rDoc, rCollNm );
+/*N*/ }
+/*N*/ // Add text style names used in patterns
+/*N*/ for( i = 0; i < rForm.GetFormMax(); i++ )
+/*N*/ {
+/*N*/ const String& rPattern = rForm.GetPattern(i);
+/*N*/ if( rPattern.Len() )
+/*N*/ {
+/*N*/ SwFormTokenEnumerator aEnum( rPattern );
+/*N*/ while( aEnum.HasNextToken() )
+/*N*/ {
+/*N*/ SwFormToken aToken( aEnum.GetNextToken() );
+/*N*/ if( aToken.sCharStyleName.Len() )
+/*?*/ Add( aToken.sCharStyleName, aToken.nPoolId );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Add style names
+/*N*/ for( i=0; i<MAXLEVEL; i++ )
+/*N*/ {
+/*N*/ const String& rStyleNames = pTOXBaseSect->GetStyleNames(i);
+/*N*/ if( rStyleNames.Len() )
+/*N*/ {
+/*?*/ xub_StrLen nStrPos = 0;
+/*?*/ while( nStrPos != STRING_NOTFOUND )
+/*?*/ {
+/*?*/ String aName = rStyleNames.GetToken( 0,
+/*?*/ TOX_STYLE_DELIMITER, nStrPos );
+/*?*/ ASSERT( aName.Len(), "empty style name" );
+/*?*/ if( aName.Len() )
+/*?*/ SetupTxtCollByName( rDoc, aName );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Add text coll names used if new indices are converted to
+/*N*/ // user indices
+/*N*/ sal_uInt16 nPoolId = USHRT_MAX;
+/*N*/ switch( pType->GetType() )
+/*N*/ {
+/*?*/ case TOX_ILLUSTRATIONS:
+/*?*/ nPoolId = RES_POOLCOLL_LABEL_ABB;
+/*?*/ break;
+/*?*/ case TOX_OBJECTS:
+/*?*/ nPoolId = RES_POOLCOLL_LABEL_FRAME;
+/*?*/ break;
+/*?*/ case TOX_TABLES:
+/*?*/ nPoolId = RES_POOLCOLL_LABEL_TABLE;
+/*?*/ break;
+/*N*/ }
+/*N*/ if( USHRT_MAX != nPoolId )
+/*N*/ {
+/*?*/ String aName;
+/*?*/ SwStyleNameMapper::FillUIName( nPoolId, aName );
+/*?*/ Add( aName, nPoolId );
+/*N*/ }
+/*N*/ const String& rMainStyle =
+/*N*/ pTOXBaseSect->GetMainEntryCharStyle();
+/*N*/ if( rMainStyle.Len() )
+/*N*/ {
+/*?*/ sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( rMainStyle,
+/*?*/ GET_POOLID_CHRFMT );
+/*N*/ Add( rMainStyle, nPoolId );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SwTOXMark* pItem;
+/*N*/ nArrLen = nExpFFVersion > SOFFICE_FILEFORMAT_40
+/*N*/ ? rDoc.GetAttrPool().GetItemCount( RES_TXTATR_TOXMARK )
+/*N*/ : 0;
+/*N*/ for( n = 0; n < nArrLen; ++n )
+/*N*/ {
+/*N*/ pItem = (const SwTOXMark*)rDoc.GetAttrPool().GetItem( RES_TXTATR_TOXMARK, n );
+/*N*/ if( pItem )
+/*N*/ {
+/*N*/ const SwTOXType* pType = pItem->GetTOXType();
+/*N*/ if( pType && pType->GetTypeName() !=
+/*N*/ SwTOXBase::GetTOXName(pType->GetType()) )
+/*N*/ {
+/*?*/ Add( pType->GetTypeName(), USHRT_MAX );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SwFmtINetFmt* pINetFmt;
+/*N*/ nArrLen = nExpFFVersion > SOFFICE_FILEFORMAT_31
+/*N*/ ? rDoc.GetAttrPool().GetItemCount( RES_TXTATR_INETFMT )
+/*N*/ : 0;
+/*N*/ for( n = 0; n < nArrLen; ++n )
+/*N*/ {
+/*N*/ pINetFmt = (const SwFmtINetFmt*)rDoc.GetAttrPool().GetItem( RES_TXTATR_INETFMT, n );
+/*N*/ if( pINetFmt )
+/*N*/ {
+/*N*/ if( pINetFmt->GetINetFmt().Len() )
+/*?*/ Add( pINetFmt->GetINetFmt(), pINetFmt->GetINetFmtId() );
+/*N*/ if( pINetFmt->GetVisitedFmt().Len() )
+/*?*/ Add( pINetFmt->GetVisitedFmt(), pINetFmt->GetVisitedFmtId() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Seit der 5.0 gibt es Redlines. Die Autoren stehen dann im String-Pool
+/*N*/ if( nExpFFVersion > SOFFICE_FILEFORMAT_40 )
+/*N*/ SetupRedlines( rDoc );
+/*N*/
+/*N*/ // Beim 3.1/4.0-Export standen die Tabellen-Line/Box-Formate noch
+/*N*/ // im FrmFmt-Array und wurden ueber den String-Pool dort eingetragen.
+/*N*/ // Deshalb muessen sie jetzt auch dort eingetragen werden. Die
+/*N*/ // Umbennenerei erfolgt allerdings nicht mehr im Format. Stattdessen
+/*N*/ // wird der (erweiterte) Name in einem Array gemerkt und ueber dieses
+/*N*/ // ermittelt.
+/*N*/ if( nExpFFVersion <= SOFFICE_FILEFORMAT_40 && pExportInfo &&
+/*N*/ pExportInfo->pTblLineBoxFmts40 )
+/*N*/ {
+/*N*/ if( !pExportInfo->pTblLineBoxFmtNames40 )
+/*N*/ pExportInfo->pTblLineBoxFmtNames40 = new SvStringsDtor;
+/*N*/
+/*N*/ SvStringsDtor *pNames = pExportInfo->pTblLineBoxFmtNames40;
+/*N*/ if( pNames->Count() )
+/*?*/ pNames->DeleteAndDestroy( 0, pNames->Count() );
+/*N*/
+/*N*/ Sw3FrmFmts *pFmts = pExportInfo->pTblLineBoxFmts40;
+/*N*/ sal_uInt16 nArrLen = pFmts->Count();
+/*N*/ for( n=0; n<nArrLen; n++ )
+/*N*/ {
+/*N*/ // TODO: unicode: currect?
+/*N*/ String * pName = new String( (*pFmts)[n]->GetName() );
+/*N*/ (*pName += EXT_SEPARATOR) += String::CreateFromInt32( Count()+1 );
+/*N*/ Add( *pName, (*pFmts)[n]->GetPoolFmtId() );
+/*N*/ pNames->Insert( pName, pNames->Count() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Und danach darf nix mehr in den Pool hinein!
+/*N*/ bFixed = sal_True;
+/*N*/ }
+
+/*N*/ void Sw3StringPool::SetupForNumRules( SwDoc& rDoc, long nFFVersion )
+/*N*/ {
+/*N*/ Clear();
+/*N*/ nExpFFVersion = nFFVersion;
+/*N*/ bFixed = sal_False;
+/*N*/
+/*N*/ // Die Namen von Zeichenvorlagen werden benoetigt, weil in den
+/*N*/ // Numerierungen auuf sie verwiesen werden kann.
+/*N*/ sal_uInt16 nArrLen = rDoc.GetCharFmts()->Count();
+/*N*/ // Element 0 ist das Default-Format!
+ sal_uInt16 n;
+/*N*/ for( n = 1; n < nArrLen; n++ )
+/*N*/ Setup( rDoc, *(*rDoc.GetCharFmts())[ n ] );
+/*N*/
+/*N*/ // Die Namen der Numerierungen werden sowieso benoetigt.
+/*N*/ nArrLen = rDoc.GetNumRuleTbl().Count();
+/*N*/ for( n=0; n<nArrLen; n++ )
+/*N*/ {
+/*N*/ const SwNumRule *pNumRule = rDoc.GetNumRuleTbl()[n];
+/*N*/ Add( pNumRule->GetName(), pNumRule->GetPoolFmtId() );
+/*N*/ }
+/*N*/
+/*N*/ // Und die Outline-Numerierung hat auch einen Namen.
+/*N*/ const SwNumRule *pOutline = rDoc.GetOutlineNumRule();
+/*N*/ if( pOutline )
+/*N*/ Add( pOutline->GetName(), pOutline->GetPoolFmtId() );
+/*N*/
+/*N*/ // Und danach darf nix mehr in den Pool hinein!
+/*N*/ bFixed = sal_True;
+/*N*/ }
+
+// Entfernen der Autoformat-Extension nach dem Laden/Speichern
+// Dies ist ein Hash und eine Zahl, mit der Autoformate im
+// FrmFmt-Array des Docs erweitert wurden.
+
+/*N*/ void Sw3StringPool::RemoveExtensions( SwDoc& rDoc )
+/*N*/ {
+/*N*/ sal_uInt16 nArrLen = rDoc.GetFrmFmts()->Count();
+/*N*/ // Element 0 ist das Default-Format!
+ sal_uInt16 n;
+/*N*/ for( n = 1; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ SwFmt& rFmt = (SwFmt&) *(*rDoc.GetFrmFmts())[ n ];
+/*N*/ RemoveExtension( rFmt );
+/*N*/ }
+/*N*/ nArrLen = rDoc.GetSpzFrmFmts()->Count();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ SwFmt& rFmt = (SwFmt&) *(*rDoc.GetSpzFrmFmts())[ n ];
+/*N*/ RemoveExtension( rFmt );
+/*N*/ }
+/*N*/ nArrLen = rDoc.GetTblFrmFmts()->Count();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ SwFmt& rFmt = (SwFmt&) *(*rDoc.GetTblFrmFmts())[ n ];
+/*N*/ RemoveExtension( rFmt );
+/*N*/ }
+/*N*/ nArrLen = rDoc.GetSections().Count();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ SwFmt& rFmt = (SwFmt&) *rDoc.GetSections()[ n ];
+/*N*/ RemoveExtension( rFmt );
+/*N*/ }
+/*N*/ }
+
+// Entfernen der Autoformat-Extension nach dem Laden/Speichern
+// Dies ist ein Hash und eine Zahl, mit der Autoformate im
+// FrmFmt-Array des Docs erweitert wurden.
+
+/*N*/ void Sw3StringPool::RemoveExtension( SwFmt& rFmt )
+/*N*/ {
+/*N*/ String aName( rFmt.GetName() );
+/*N*/ RemoveExtension( aName );
+/*N*/ // Kein SetName() wg. Assert
+/*N*/ (String&)rFmt.GetName() = aName;
+/*N*/ }
+
+/*N*/ void Sw3StringPool::RemoveExtension( String& rName )
+/*N*/ {
+/*N*/ xub_StrLen nOff = rName.Search( EXT_SEPARATOR );
+/*N*/ if( nOff != STRING_NOTFOUND )
+/*N*/ rName.Erase( nOff );
+/*N*/ }
+
+// Eintragen der Strings eines Formats
+// Falls nId angegeben ist, wird diese Zahl mit einem Hash an den Namen
+// angefuegt, um eine Eindeutigkeit zu gewaehrleisten.
+
+/*N*/ void Sw3StringPool::Setup( SwDoc& rDoc, const SwFmt& rFmt, sal_uInt16 nId )
+/*N*/ {
+/*N*/ // Das Written-Flag wird gleich mit geknackt!
+/*N*/ // Das ist wichtig, da Formate (theoretisch) in verschiedenen
+/*N*/ // Streams landen koennen.
+/*N*/ ASSERT( !rFmt.IsWritten(), "Written-Flag am Format ist gesetzt" );
+/*N*/ // ((SwFmt&)rFmt).ResetWritten();
+/*N*/
+/*N*/ String aName( rFmt.GetName() );
+/*N*/ if( nId )
+/*N*/ {
+/*N*/ ASSERT( nId==Count()+1, "id ungleich String-Pool-Pos" );
+/*N*/ aName += EXT_SEPARATOR, aName += String::CreateFromInt32(nId);
+/*N*/ // Kein SetName() wg. Assert
+/*N*/ (String&)((SwFmt&)rFmt).GetName() = aName;
+/*N*/ }
+/*N*/ Add( aName, rFmt.GetPoolFmtId(), nId!=0 );
+/*N*/ if( rFmt.GetPoolHlpFileId() != UCHAR_MAX )
+/*N*/ {
+/*?*/ String* pId = rDoc.GetDocPattern( rFmt.GetPoolHlpFileId() );
+/*?*/ if( pId )
+/*?*/ Add( *pId, 0 );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3StringPool::SetupTxtCollByName( SwDoc& rDoc, const String& rName )
+/*N*/ {
+/*N*/ if( !rName.Len() )
+/*N*/ return;
+/*N*/
+/*N*/ const SwTxtFmtColl *pColl = rDoc.FindTxtFmtCollByName( rName );
+/*N*/ sal_uInt16 nPoolId = pColl ? pColl->GetPoolFmtId()
+/*N*/ : SwStyleNameMapper::GetPoolIdFromUIName( rName, GET_POOLID_TXTCOLL );
+/*N*/ Add( rName, nPoolId );
+/*N*/ }
+
+/*N*/ sal_uInt16 Sw3StringPool::Add( const String& r, sal_uInt16 n, sal_Bool bDontSearch )
+/*N*/ {
+/*N*/ sal_uInt16 i = bDontSearch ? aPool.Count() : 0;
+/*N*/
+/*N*/ ASSERT( nExpFFVersion, "String-Pool: FF-Version nicht gesetzt" );
+/*N*/ if( nExpFFVersion <= SOFFICE_FILEFORMAT_40 && n && n<IDX_SPEC_VALUE )
+/*N*/ n = ConvertToOldPoolId( n, nExpFFVersion );
+/*N*/
+/*N*/ for( ; i < aPool.Count(); i++ )
+/*N*/ {
+/*N*/ const Sw3String* p3Str = aPool.GetObject( i );
+/*N*/ if( n == p3Str->GetPoolId() && r == *p3Str )
+/*N*/ return i;
+/*N*/ }
+/*N*/ if( !bFixed )
+/*N*/ {
+/*N*/ Sw3String* p = new Sw3String( r, n );
+/*N*/ aPool.Insert( p, i );
+/*N*/ return i;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( !bFixed, "String nicht im Pool eingetragen" );
+/*?*/ return IDX_NO_VALUE;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ sal_uInt16 Sw3StringPool::Find( const String& r, sal_uInt16 nPoolId )
+/*N*/ {
+/*N*/ ASSERT( nExpFFVersion, "String-Pool: FF-Version nicht gesetzt" );
+/*N*/ if( nExpFFVersion <= SOFFICE_FILEFORMAT_40 && nPoolId && nPoolId<IDX_SPEC_VALUE )
+/*N*/ nPoolId = ConvertToOldPoolId( nPoolId, nExpFFVersion );
+/*N*/
+/*N*/ xub_StrLen nOff = r.Search( EXT_SEPARATOR );
+/*N*/ if( nOff != STRING_NOTFOUND )
+/*N*/ {
+/*N*/ xub_StrLen nPos = (xub_StrLen)r.Copy(nOff+1).ToInt32() - 1;
+/*N*/ if( nPos<aPool.Count() )
+/*N*/ {
+/*N*/ const Sw3String* p3Str = aPool.GetObject( nPos );
+/*N*/ if( nPoolId == p3Str->GetPoolId() && r==*p3Str )
+/*N*/ return nPos;
+/*N*/ }
+/*N*/ ASSERT( !this, "String-Pool-Position ungueltig" );
+/*N*/ }
+/*N*/
+/*N*/ xub_StrLen nLen = r.Len();
+/*N*/ for( sal_uInt16 i = 0; i < aPool.Count(); i++ )
+/*N*/ {
+/*N*/ const Sw3String* p3Str = aPool.GetObject( i );
+/*N*/ if( nPoolId == p3Str->GetPoolId() && nLen==p3Str->Len() )
+/*N*/ {
+/*N*/ xub_StrLen n = nLen;
+/*N*/ sal_Bool bFound = sal_True;
+/*N*/ while( bFound && n )
+/*N*/ {
+/*N*/ n--;
+/*N*/ if( r.GetChar(n) != p3Str->GetChar(n) )
+/*N*/ {
+/*N*/ bFound = sal_False;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bFound )
+/*N*/ return i;
+/*N*/ }
+/*N*/ }
+/*N*/ return IDX_NO_VALUE;
+/*N*/ }
+
+/*N*/ const String& Sw3StringPool::Find( sal_uInt16 i )
+/*N*/ {
+/*N*/ if( i < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ if( i < aPool.Count() )
+/*N*/ return *aPool.GetObject( i );
+/*N*/ ASSERT( !this, "String-Index nicht im Stringpool" );
+/*N*/ }
+/*N*/ return aEmpty;
+/*N*/ }
+
+/*N*/ sal_uInt16 Sw3StringPool::FindPoolId( sal_uInt16 i )
+/*N*/ {
+/*N*/ if( i < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ if( i < aPool.Count() )
+/*N*/ return aPool.GetObject( i )->GetPoolId();
+/*N*/ ASSERT( !this, "String-Index nicht im Stringpool" );
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+// OPT: Cache fuer Formate im StringPool
+
+/*N*/ void Sw3StringPool::SetCachedFmt( sal_uInt16 i, SwFmt *pFmt )
+/*N*/ {
+/*N*/ ASSERT( i < IDX_SPEC_VALUE && i < aPool.Count(),
+/*N*/ "SetCachedFmt fuer ungueltigen Index" );
+/*N*/ if( i < IDX_SPEC_VALUE && i < aPool.Count() )
+/*N*/ aPool.GetObject( i )->SetCachedFmt( pFmt );
+/*N*/ }
+
+
+
+/*N*/ SwFmt *Sw3StringPool::FindCachedFmt( sal_uInt16 i ) const
+/*N*/ {
+/*N*/ if( i < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ if( i < aPool.Count() )
+/*N*/ return aPool.GetObject( i )->GetCachedFmt();
+/*N*/ ASSERT( !this, "String-Index nicht im Stringpool" );
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+// /OPT: Cache fuer Formate im StringPool
+
+
+// Laderoutine fuer Dokumente bis 134g
+
+void Sw3StringPool::LoadOld( SvStream& r )
+{
+ aPool.DeleteAndDestroy( 0, aPool.Count() );
+ sal_uInt16 n;
+ String s;
+ r >> n;
+ // Dieser schlimme Hack ist notwendig, da ich vergessen habe,
+ // den Zeichensatz im Record zu speichern. Und kein Flag-Byte da!
+ // Dieser Hack arbeitet gut, wenn das LSByte der Anzahl Strings != 0
+ // ist, was bis heute (10.04.95) der Fall ist.
+ rtl_TextEncoding eSrcEnc = r.GetStreamCharSet();
+ if( n >= 256 )
+ {
+ sal_uInt8 cCharSet, cDummyFlags;
+ r.SeekRel( -2L );
+ r >> cDummyFlags >> cCharSet >> n;
+ eSrcEnc = (rtl_TextEncoding)cCharSet;
+ }
+ while( n-- )
+ {
+ r.ReadByteString( s, eSrcEnc );
+ Sw3String* p = new Sw3String( s, 0 );
+ aPool.Insert( p, aPool.Count() );
+ }
+ bFixed = sal_True;
+}
+
+/*N*/ void Sw3StringPool::Load( SvStream& r, sal_uInt16 nSVersion )
+/*N*/ {
+/*N*/ aPool.DeleteAndDestroy( 0, aPool.Count() );
+/*N*/ sal_uInt8 cSet;
+/*N*/ sal_uInt16 n;
+/*N*/ String s;
+/*N*/ r >> cSet >> n;
+/*N*/
+/*N*/ // MIB 8.4.97: Datenbank-Felder enthalten ein 0xff, das auf keinen
+/*N*/ // Fall mit konvertiert werden darf. Wir erkennen sie am Wert
+/*N*/ // IDX_NOCONV_FF.
+/*N*/ rtl_TextEncoding eSrcEnc = GetSOLoadTextEncoding( (rtl_TextEncoding)cSet,
+/*N*/ r.GetVersion() );
+/*N*/ while( n-- )
+/*N*/ {
+/*N*/ sal_uInt16 nId;
+/*N*/ ByteString s8;
+/*N*/ r >> nId;
+/*N*/ r.ReadByteString( s8 );
+/*N*/ if( nId == IDX_NOCONV_FF )
+/*N*/ s = Sw3IoImp::ConvertStringNoDbDelim( s8, eSrcEnc );
+/*N*/ else
+/*N*/ s = String( s8, eSrcEnc );
+/*N*/
+/*N*/ // Ggf. alte Pool-Ids auf neue mappen.
+/*N*/ if( nSVersion < SWG_HTMLCOLLCHG && nId && nId < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ // Die ehemaligen Listing und XMP-Vorlagen werden umbenannt,
+/*N*/ // damit sie beim Export wiedergefunden werden.
+/*N*/ switch( nId )
+/*N*/ {
+/*?*/ case RES_POOLCOLL_HTML_LISTING_40:
+/*?*/ s.AssignAscii( sHTML_listing );
+/*?*/ break;
+/*?*/ case RES_POOLCOLL_HTML_XMP_40:
+/*?*/ s.AssignAscii( sHTML_xmp );
+/*?*/ break;
+/*N*/ }
+/*N*/ nId = ConvertFromOldPoolId( nId, nSVersion );
+/*N*/ }
+/*N*/
+/*N*/ // Id und ist PoolFormat ?
+/*N*/ if( nId && !(USER_FMT & nId))
+/*N*/ SwStyleNameMapper::FillUIName( nId, s ); // dann String vom Pool erfragen
+/*N*/
+/*N*/ Sw3String* p = new Sw3String( s, nId );
+/*N*/ aPool.Insert( p, aPool.Count() );
+/*N*/ }
+/*N*/ bFixed = sal_True;
+/*N*/ }
+
+/*N*/ void Sw3StringPool::Store( SvStream& r )
+/*N*/ {
+/*N*/ ASSERT( nExpFFVersion==r.GetVersion(),
+/*N*/ "Sw3StringPool::Store: FF-Version am Stream stimmt nicht" );
+/*N*/ rtl_TextEncoding eSrcEnc = r.GetStreamCharSet();
+/*N*/ sal_uInt16 n = aPool.Count();
+/*N*/ r << (sal_uInt8) eSrcEnc
+/*N*/ << (sal_uInt16) n;
+/*N*/ for( sal_uInt16 i = 0; i < n; i++ )
+/*N*/ {
+/*N*/ Sw3String* p = aPool.GetObject( i );
+/*N*/ sal_uInt16 nId = (sal_uInt16) p->GetPoolId();
+/*N*/ r << nId;
+/*N*/ if( nId == IDX_NOCONV_FF )
+/*N*/ r.WriteByteString( Sw3IoImp::ConvertStringNoDbDelim(
+/*N*/ (const String&)*p, eSrcEnc ) );
+/*N*/ else
+/*N*/ r.WriteByteString( (const String&)*p, eSrcEnc );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3StringPool::Clear()
+/*N*/ {
+/*N*/ aPool.DeleteAndDestroy( 0, aPool.Count() );
+/*N*/ nExpFFVersion = 0; // um ungesetzte Version zu erkennen!
+/*N*/ }
+
+/*N*/ ByteString Sw3IoImp::ConvertStringNoDbDelim( const String& rStr,
+/*N*/ rtl_TextEncoding eSource )
+/*N*/ {
+/*N*/ return ConvertStringNoDelim( rStr, DB_DELIM, '\xff', eSource );
+/*N*/ }
+/*N*/
+/*N*/ String Sw3IoImp::ConvertStringNoDbDelim( const ByteString& rStr,
+/*N*/ rtl_TextEncoding eSource )
+/*N*/ {
+/*N*/ return ConvertStringNoDelim( rStr, '\xff', DB_DELIM, eSource );
+/*N*/ }
+
+/*N*/ ByteString Sw3IoImp::ConvertStringNoDelim( const String& rStr,
+/*N*/ sal_Unicode cSrcDelim,
+/*N*/ sal_Char cDelim,
+/*N*/ rtl_TextEncoding eSource )
+/*N*/ {
+/*N*/ ByteString sDest;
+/*N*/ xub_StrLen nStart = 0;
+/*N*/ xub_StrLen nPos = 0;
+/*N*/ do
+/*N*/ {
+/*N*/ nPos = rStr.Search( cSrcDelim, nStart );
+/*N*/ if( STRING_NOTFOUND == nPos )
+/*N*/ nPos = rStr.Len();
+/*N*/
+/*N*/ if( nStart > 0 )
+/*N*/ sDest += cDelim;
+/*N*/
+/*N*/ if( nPos > nStart )
+/*N*/ sDest += ByteString( rStr.Copy( nStart, nPos-nStart ), eSource );
+/*N*/ nStart = nPos+1;
+/*N*/ }
+/*N*/ while( nPos < rStr.Len() );
+/*N*/
+/*N*/ return sDest;
+/*N*/ }
+
+/*N*/ String Sw3IoImp::ConvertStringNoDelim( const ByteString& rStr,
+/*N*/ sal_Char cSrcDelim,
+/*N*/ sal_Unicode cDelim,
+/*N*/ rtl_TextEncoding eSource )
+/*N*/ {
+/*N*/ String sDest;
+/*N*/ xub_StrLen nStart = 0;
+/*N*/ xub_StrLen nPos = 0;
+/*N*/ do
+/*N*/ {
+/*N*/ nPos = rStr.Search( cSrcDelim, nStart );
+/*N*/ if( STRING_NOTFOUND == nPos )
+/*N*/ nPos = rStr.Len();
+/*N*/
+/*N*/ if( nStart > 0 )
+/*N*/ sDest += cDelim;
+/*N*/
+/*N*/ if( nPos > nStart )
+/*N*/ sDest += String( rStr.Copy( nStart, nPos-nStart ), eSource );
+/*N*/ nStart = nPos+1;
+/*N*/ }
+/*N*/ while( nPos < rStr.Len() );
+/*N*/
+/*N*/ return sDest;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::ChangeFontItemCharSet()
+/*N*/ {
+/*N*/ rtl_TextEncoding eSysEnc = gsl_getSystemTextEncoding();
+/*N*/ sal_uInt16 nMaxItems = pDoc->GetAttrPool().GetItemCount( RES_CHRATR_FONT );
+/*N*/ SvxFontItem *pItem;
+/*N*/ for( sal_uInt16 i=0; i<nMaxItems; i++ )
+/*N*/ {
+/*N*/ pItem = (SvxFontItem *)pDoc->GetAttrPool().GetItem( RES_CHRATR_FONT, i );
+/*N*/ if( pItem && pItem->GetCharSet() == eSrcSet )
+/*N*/ pItem->GetCharSet() = eSysEnc;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::ConvertFmtsToStarSymbol()
+/*N*/ {
+/*N*/ if( pConvToSymbolFmts && pConvToSymbolFmts->Count() )
+/*N*/ {
+/*N*/ const Font& rSymbolFont = SwNumRule::GetDefBulletFont();
+/*N*/ SvxFontItem aFontItem( rSymbolFont.GetFamily(), rSymbolFont.GetName(),
+/*N*/ rSymbolFont.GetStyleName(),
+/*N*/ rSymbolFont.GetPitch(),
+/*N*/ rSymbolFont.GetCharSet() );
+/*N*/ for( USHORT i=0; i < pConvToSymbolFmts->Count(); i++ )
+/*N*/ {
+/*N*/ if( (SW3IO_CONV_TO_SYMBOL & pConvToSymbolFmts->GetFlags(i)) != 0 )
+/*N*/ pConvToSymbolFmts->GetFmt(i)->SetAttr( aFontItem );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+*
+* Cleanup nach dem Laden
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::Cleanup( sal_Bool bConnectPageDescs )
+/*N*/ {
+/*N*/ // Expr-Felder in Shared-Formaten?
+/*N*/ // if( nGblFlags & SW3F_UPDEXPR )
+/*N*/ // pDoc->SetUpdateExpFldStat();
+/*N*/ // Offene Seitenbeschreibungen in Formaten aufloesen
+/*N*/ // (falls noch nicht geschehen)
+/*N*/ if( bConnectPageDescs )
+/*?*/ ConnectPageDescAttrs();
+/*N*/ // Temporaere Namenserweiterungen entfernen
+/*N*/ aStringPool.RemoveExtensions( *pDoc );
+/*N*/
+/*N*/ rtl_TextEncoding eSysEnc = gsl_getSystemTextEncoding();
+/*N*/ if( eSysEnc != eSrcSet )
+/*N*/ {
+/*N*/ // Bug 9714: Der CharSet an den Fonts muss geaendert werden, wenn
+/*N*/ // es der globale CharSet ist
+/*N*/ ChangeFontItemCharSet();
+/*N*/
+/*N*/ SvxFontItem *pItem = (SvxFontItem*) pDoc->GetAttrPool().GetPoolDefaultItem(RES_CHRATR_FONT);
+/*N*/ if( pItem && pItem->GetCharSet() == eSrcSet )
+/*N*/ pItem->GetCharSet() = eSysEnc;
+/*N*/ }
+/*N*/ ConvertFmtsToStarSymbol();
+/*N*/
+/*N*/ // Unbenutzte SwDrawFlyObjs aus dem Drawing Layer entfernen
+/*N*/ // Dies sind vor allem jene, die vor dem Speichern in den
+/*N*/ // Seitenkoepfen auftraten
+/*N*/ if ( pDoc->GetDrawModel() )
+/*N*/ {
+/*N*/ // if( nHiddenDrawObjs != ULONG_MAX )
+/*N*/ // RemoveHiddenDrawObjs();
+/*N*/ SdrPage* pPage = pDoc->GetDrawModel()->GetPage( 0 );
+/*N*/ sal_uInt32 i = 0;
+/*N*/ while( i < pPage->GetObjCount() )
+/*N*/ {
+/*N*/ SdrObject *pObj = pPage->GetObj( i );
+/*N*/ if ( !pObj->GetUserCall() )
+/*N*/ {
+/*?*/ pPage->RemoveObject( i );
+/*?*/ delete pObj;
+/*N*/ }
+/*N*/ else
+/*N*/ i++;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //if( nVersion < SWG_DBTABLE )
+/*N*/ if( !IsVersion( SWG_DBTABLE, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ pDoc->SetInitDBFields(sal_True);
+/*N*/
+/*N*/ // Unbenutzte DB-Feldtypen loeschen
+/*N*/ const SwFldTypes *pFldTypes = pDoc->GetFldTypes();
+/*N*/ sal_uInt16 i = INIT_FLDTYPES;
+/*N*/
+/*N*/ SwFieldType* pFnd;
+/*N*/
+/*N*/ while (i < pFldTypes->Count())
+/*N*/ {
+/*N*/ if (RES_DBFLD == (pFnd = pFldTypes->GetObject(i))->Which() &&
+/*N*/ ((SwDBFieldType*)pFnd)->GetRefCount() <= 0)
+/*N*/ {
+/*?*/ pDoc->RemoveFldType(i);
+/*N*/ }
+/*N*/ else
+/*N*/ i++;
+/*N*/ }
+/*N*/
+/*N*/ // Unbenutzte automatische NumRules loeschen.
+/*N*/ // Kann hier geschehen, denn der NumRules-Stream wird nur bei normalen
+/*N*/ // Dokumenten und beim Laden von NumRules und beim Laden von
+/*N*/ // Seiten-Vorlagen gelesen. Beim normalen Laden und Laden von
+/*N*/ // Seiten-Vorlagen wird Cleanup gerufen. Beim Laden von NumRules zwar
+/*N*/ // nicht, da werden aber auch keine automatischen NumRules eingelesen.
+/*N*/ // Wenn Vorlagen ueber den Organizer geladen werden, duerfen unbenutzte
+/*N*/ // Vorlagen allerdings nicht geloescht werden, denn sie koennten aus
+/*N*/ // dem Content-Stream kommen und der wird dann weder geladen noch
+/*N*/ // gespeichert.
+/*N*/ while( aNumRuleInfos.Count() )
+/*N*/ {
+/*N*/ Sw3NumRuleInfo *pInfo = aNumRuleInfos[0];
+/*N*/ if( !bOrganizer && !pInfo->IsUsed() )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ sal_uInt16 nCount = pDoc->GetNumRuleTbl().Count();
+/*N*/ #endif
+/*N*/ pDoc->DelNumRule( pInfo->GetNewName() );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ASSERT( pDoc->GetNumRuleTbl().Count() == nCount-1,
+/*N*/ "unbenutzte NumRule wurde nicht geloescht" );
+/*N*/ #endif
+/*N*/ }
+/*N*/
+/*N*/ aNumRuleInfos.Remove( (sal_uInt16)0, 1 );
+/*N*/ delete pInfo;
+/*N*/ }
+/*N*/
+/*N*/ CleanupRedlines();
+/*N*/ }
+
+/*************************************************************************
+*
+* Passwortroutinen
+*
+*************************************************************************/
+
+// Testen des an der Root gesetzten Passwortes
+// Der erforderliche Header ist bereits eingelesen
+
+/*N*/ sal_Bool Sw3IoImp::CheckPasswd()
+/*N*/ {
+/*N*/ if( pCrypter )
+/*N*/ {
+/*?*/ sal_Char buf[ 17 ];
+/*?*/ snprintf( buf, sizeof(buf), "%08lx%08lx", nDate, nTime );
+/*?*/ ByteString aTest( buf );
+/*?*/ pCrypter->Encrypt( aTest );
+/*?*/ return sal_Bool( !memcmp( cPasswd, aTest.GetBuffer(), PASSWDLEN ) );
+/*N*/ }
+/*N*/ else
+/*N*/ return sal_Bool( ( nFileFlags & SWGF_HAS_PASSWD ) == 0 );
+/*N*/ }
+
+// Setzen des Passwortes in der Root.
+
+/*N*/ void Sw3IoImp::SetPasswd()
+/*N*/ {
+/*N*/ delete pCrypter; pCrypter = NULL;
+/*N*/ if( pRoot && pRoot->GetKey().Len() )
+/*N*/ {
+/*?*/ pCrypter = new Crypter( pRoot->GetKey() );
+/*?*/ sal_Char buf[ 17 ];
+/*?*/ snprintf( buf, sizeof(buf), "%08lx%08lx", nDate, nTime );
+/*?*/ ByteString aTest( buf );
+/*?*/ pCrypter->Encrypt( aTest );
+/*?*/ memcpy( cPasswd, aTest.GetBuffer(), aTest.Len() );
+/*?*/ nFileFlags|= SWGF_HAS_PASSWD;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+*
+* unbenutzte Objekte aus 3.0-Storages entfernen
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::RemoveUnusedObjects()
+/*N*/ {
+/*N*/ ASSERT( nVersion<=SWG_SHORTFIELDS && bNormal && !bInsert,
+/*N*/ "ungueltiger Aufruf von RomoveUnusedObjects" );
+/*N*/
+/*N*/ if( pDoc->GetPersist()->GetObjectList() )
+/*N*/ {
+/*N*/ SvPersistRef rpDoc( pDoc->GetPersist() );
+/*N*/ SvInfoObject* pIO = NULL;
+/*N*/ String aObjName;
+/*N*/
+/*N*/ // alle Objekte in SvPersist betrachten
+/*N*/ for( sal_uInt32 i=0; i < rpDoc->GetObjectList()->Count(); i++ )
+/*N*/ {
+/*?*/ pIO = rpDoc->GetObjectList()->GetObject(i);
+/*?*/ aObjName = pIO->GetObjName();
+/*?*/ if( aObjName.CompareToAscii("Obj",3)==COMPARE_EQUAL ||
+/*?*/ aObjName.CompareToAscii("StarObj",7)==COMPARE_EQUAL )
+/*?*/ {
+/*?*/ // wenn kein OLE-Node dazu existiert: Objekt loeschen
+/*?*/ if( p30OLENodes )
+/*?*/ for( sal_uInt16 j=0; j<p30OLENodes->Count(); j++ )
+/*?*/ {
+/*?*/ if( aObjName==((*p30OLENodes)[j])->GetOLEObj().GetName() )
+/*?*/ {
+/*?*/ pIO = NULL;
+/*?*/ p30OLENodes->Remove(j);
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ if( pIO )
+/*?*/ {
+/*?*/ rpDoc->Remove(aObjName);
+/*?*/ i--; // das aktuelle Object fehlt ja jetzt
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+#ifdef TEST_HUGE_DOCS
+
+#endif
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3io.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3io.cxx
new file mode 100644
index 000000000000..ecf47ce37e4d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3io.cxx
@@ -0,0 +1,385 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#include <stdio.h>
+#define _SVSTDARR_USHORTS
+#include <bf_svtools/zforlist.hxx>
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <errhdl.hxx>
+
+#include "pam.hxx"
+#include "rootfrm.hxx"
+#include "swerror.h"
+#include "sw3io.hxx"
+#include "sw3imp.hxx"
+#include "ndgrf.hxx"
+namespace binfilter {
+
+
+/*N*/ Sw3Io::Sw3Io( SwDoc& r )
+/*N*/ {
+/*N*/ pImp = new Sw3IoImp( *this );
+/*N*/ pImp->pDoc = &r;
+/*N*/ r.AddLink();
+/*N*/ }
+
+
+/*N*/ Sw3Io::~Sw3Io()
+/*N*/ {
+/*N*/ delete pImp;
+/*N*/ }
+
+
+/*N*/ ULONG Sw3Io::Load( SvStorage* pStor, SwPaM* pPaM )
+/*N*/ {
+/*N*/ // Wenn ein PaM angegeben ist, wird eingefuegt!
+/*N*/ // Beim Einfuegen werden vorhandene Vorlagen nicht uebergeplaettet
+/*N*/ pImp->pOldRoot = pImp->pRoot;
+/*N*/ pImp->pRoot = pStor;
+/*N*/ BOOL bGood = pImp->OpenStreams( FALSE );
+/*N*/ // Wenn die Streams nicht alle da sind, ist es KEIN FEHLER,
+/*N*/ // da ein OLE-Container u.U. nicht voll ist.
+/*N*/ if( !bGood )
+/*N*/ {
+/*?*/ pImp->pRoot = pImp->pOldRoot;
+/*?*/ pImp->pOldRoot.Clear();
+/*?*/ return pImp->nRes;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( pPaM )
+/*N*/ {
+/*?*/ pImp->bInsert = TRUE;
+/*?*/ pImp->bInsIntoHdrFtr = pImp->pDoc->IsInHeaderFooter(
+/*N*/ pPaM->GetPoint()->nNode );
+/*N*/ }
+/*N*/ else
+/*N*/ pImp->bInsert = pImp->bInsIntoHdrFtr = FALSE;
+/*N*/
+/*N*/ if( pImp->bNormal ) // nur setzen wenn normal gelesen wird,
+/*N*/ pImp->bAdditive = pImp->bInsert;// sonst ist es schon gueltig
+/*N*/
+/*N*/ pImp->OutputMode( FALSE );
+/*N*/ // Man nehme die Doc-Groesse
+/*N*/ pImp->pContents->Seek( STREAM_SEEK_TO_END );
+/*N*/ ULONG nSize = pImp->pContents->Tell();
+/*N*/ pImp->pContents->Seek( 0L );
+/*N*/ pImp->OpenPercentBar( 0L, nSize );
+/*N*/ if( pImp->bNormal )
+/*N*/ pImp->LoadDrawingLayer();
+/*N*/ if( ( pImp->bNormal || pImp->bTxtColls || pImp->bCharFmts || pImp->bFrmFmts ) && !pImp->nRes )
+/*N*/ pImp->LoadStyleSheets( BOOL( !pImp->bAdditive ) );
+/*N*/ if( ( pImp->bNormal || pImp->bNumRules || pImp->bPageDescs ) && !pImp->nRes )
+/*N*/ pImp->LoadNumRules();
+/*N*/ if( ( pImp->bNormal || pImp->bPageDescs ) && !pImp->nRes )
+/*N*/ pImp->LoadPageStyles();
+/*N*/ if( pImp->bNormal && !pImp->nRes )
+/*N*/ pImp->LoadContents( pPaM );
+/*N*/ pImp->ClosePercentBar();
+/*N*/
+/*N*/ //Benachrichtigungen fuer OLE-Objekte
+/*N*/ if ( pImp->bInsert ) //Eingefuege wurden markiert
+/*?*/ pImp->pDoc->PrtOLENotify( FALSE );
+/*N*/ else if ( pImp->pDoc->IsOLEPrtNotifyPending() ||//Drucker geaendert
+/*N*/ pImp->nVersion < SWG_OLEPRTNOTIFY ) //Ruecksicht auf Math, dass
+/*N*/ //sowieso Hautpanwender ist.
+/*N*/ {
+/*N*/ pImp->pDoc->PrtOLENotify( TRUE );
+/*N*/ }
+/*N*/
+/*N*/ // unbenutzte OLE-Objekte l”schen, falls ein 3.0-Dok
+/*N*/ // geladen wird
+/*N*/ if( pImp->nVersion<=SWG_SHORTFIELDS &&
+/*N*/ pImp->bNormal && !pImp->bBlock && !pImp->bInsert && !pImp->nRes )
+/*N*/ pImp->RemoveUnusedObjects();
+/*N*/
+/*N*/ if( pImp->nRes )
+/*?*/ pImp->nRes |= ERRCODE_CLASS_READ;
+/*N*/ else if( pImp->bNoDrawings )
+/*?*/ pImp->nRes = WARN_SWG_NO_DRAWINGS;
+/*N*/ else if( pImp->nWarn )
+/*?*/ pImp->nRes = pImp->nWarn | ERRCODE_CLASS_READ;
+/*N*/
+/*N*/ pImp->CloseStreams();
+/*N*/ if( pPaM || pImp->bBlock )
+/*?*/ pImp->pRoot = pImp->pOldRoot, pImp->pOldRoot.Clear();
+/*N*/
+/*N*/ SvNumberFormatter* pN;
+/*N*/ if( pImp->bInsert &&
+/*N*/ 0 != ( pN = pImp->pDoc->GetNumberFormatter( FALSE ) ))
+/*?*/ pN->ClearMergeTable();
+/*N*/ }
+/*N*/ return pImp->nRes;
+/*N*/ }
+
+
+/*N*/ ULONG Sw3Io::Save( SwPaM* pPaM, BOOL bSaveAll )
+/*N*/ {
+/*N*/ if( !pImp->pRoot.Is() )
+/*?*/ pImp->pRoot = pImp->pDoc->GetPersist()->GetStorage();
+/*N*/
+/*N*/ if( pImp->bNormal && pImp->IsSw31Or40Export() &&
+/*N*/ pImp->pDoc->GetNodes().GetEndOfContent().GetIndex() > 65200 )
+/*N*/ {
+/*N*/ // Das Dokument ist zu gross, um vom SW3.1/4.0 gelesen zu werden.
+/*?*/ return ERR_SWG_LARGE_DOC_ERROR;
+/*N*/ }
+/*N*/
+/*N*/ ULONG nHiddenDraws = ULONG_MAX;
+/*N*/ if( pImp->bNormal )
+/*N*/ {
+/*N*/ pImp->InsertHiddenDrawObjs();
+/*N*/ nHiddenDraws = pImp->nHiddenDrawObjs;
+/*N*/ }
+/*N*/ BOOL bGood = pImp->OpenStreams( TRUE );
+/*N*/ ASSERT( bGood, "Es fehlen leider ein paar Streams!" );
+/*N*/ pImp->nHiddenDrawObjs = nHiddenDraws; // OpenStreams loescht den Member!
+/*N*/ if( !bGood )
+/*N*/ {
+/*?*/ pImp->RemoveHiddenDrawObjs();
+/*?*/ return ERR_SWG_WRITE_ERROR;
+/*N*/ }
+/*N*/
+/*N*/ // Bookmarks sammeln: Wenn kein Inhalt geschrieben wird, nur die
+/*N*/ // in Seitenvorlagen
+/*N*/ if( pImp->bNormal || pImp->bPageDescs )
+/*N*/ {
+/*N*/ pImp->CollectMarks( pPaM, !pImp->bNormal );
+/*N*/ if( !pImp->IsSw31Or40Export() )
+/*N*/ pImp->CollectRedlines( pPaM, !pImp->bNormal );
+/*N*/ else
+/*N*/ pImp->CollectTblLineBoxFmts40();
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ pImp->bSaveAll = bSaveAll;
+/*N*/ BOOL bNewPaM = BOOL( pPaM == NULL );
+/*N*/ if( bNewPaM )
+/*N*/ {
+/*?*/ pImp->bSaveAll = TRUE;
+/*?*/ pPaM = new SwPaM( pImp->pDoc->GetNodes().GetEndOfContent() );
+/*?*/ pPaM->Move( fnMoveForward, fnGoDoc );
+/*?*/ pPaM->SetMark();
+/*?*/ pPaM->Move( fnMoveBackward, fnGoDoc );
+/*N*/ }
+/*N*/ // Den Doc-Hauptbereich als Mass der Dinge beim Speichern nehmen
+/*N*/ ULONG n1 = pImp->pDoc->GetNodes().GetEndOfExtras().GetIndex();
+/*N*/ ULONG n2 = pImp->pDoc->GetNodes().GetEndOfContent().GetIndex();
+/*N*/ USHORT nPages = pImp->pDoc->GetRootFrm() ?
+/*N*/ pImp->pDoc->GetRootFrm()->GetPageNum() : 0;
+/*N*/ // Wir nehmen einfach 10 Nodes/Page an
+/*N*/ n2 += nPages * 10;
+/*N*/ pImp->OpenPercentBar( n1, n2 );
+/*N*/ if( pImp->bNormal || pImp->bTxtColls )
+/*N*/ {
+/*N*/ // Stringpool fuellen, Namen im Doc erweitern
+/*N*/ pImp->aStringPool.Setup( *pImp->pDoc, pImp->pRoot->GetVersion(),
+/*N*/ pImp->pExportInfo );
+/*N*/ pImp->SaveStyleSheets( FALSE );
+/*N*/ // Temporaere Namenserweiterungen entfernen
+/*N*/ pImp->aStringPool.RemoveExtensions( *pImp->pDoc );
+/*N*/ }
+/*N*/ if( ( pImp->bNormal || pImp->bNumRules ) && !pImp->nRes )
+/*N*/ pImp->SaveNumRules();
+/*N*/ if( ( pImp->bNormal || pImp->bPageDescs ) && !pImp->nRes )
+/*N*/ pImp->SavePageStyles();
+/*N*/ if( pImp->bNormal && !pImp->nRes )
+/*N*/ pImp->SaveDrawingLayer();
+/*N*/ if( pImp->bNormal && !pImp->nRes )
+/*N*/ pImp->SaveContents( *pPaM );
+/*N*/ if( bNewPaM )
+/*N*/ delete pPaM;
+/*N*/
+/*N*/ pImp->RemoveHiddenDrawObjs();
+/*N*/
+/*N*/ if( pImp->nRes )
+/*N*/ pImp->nRes |= ERRCODE_CLASS_WRITE;
+/*N*/ else if( pImp->nWarn )
+/*N*/ pImp->nRes = pImp->nWarn | ERRCODE_CLASS_WRITE;
+/*N*/
+/*N*/ //pImp->pRoot->Commit();
+/*N*/
+/*N*/ ULONG nErr = pImp->pRoot->GetError();
+/*N*/ if( nErr == SVSTREAM_DISK_FULL )
+/*N*/ pImp->nRes = ERR_W4W_WRITE_FULL;
+/*N*/ else if( nErr != SVSTREAM_OK )
+/*N*/ {
+/*N*/ if ( nErr == ERRCODE_IO_NOTSTORABLEINBINARYFORMAT )
+/*N*/ pImp->nRes = nErr;
+/*N*/ else
+/*N*/ pImp->nRes = ERR_SWG_WRITE_ERROR;
+/*N*/ }
+/*N*/
+/*N*/ pImp->ClosePercentBar();
+/*N*/ pImp->CloseStreams();
+/*N*/
+/*N*/ return pImp->nRes;
+/*N*/ }
+
+
+// Speichern in einen frischen Storage.
+
+/*N*/ ULONG Sw3Io::SaveAs( SvStorage* pStor, SwPaM* pPaM, BOOL bSaveAll )
+/*N*/ {
+/*N*/ pImp->pOldRoot = pImp->pRoot;
+/*N*/ pImp->pRoot = pStor;
+/*N*/ ULONG nRet = Save( pPaM, bSaveAll );
+/*N*/ pImp->pRoot = pImp->pOldRoot;
+/*N*/ pImp->pOldRoot.Clear();
+/*N*/ return nRet;
+/*N*/ }
+
+
+/*N*/ void Sw3Io::HandsOff()
+/*N*/ {
+/*N*/ pImp->pRoot.Clear();
+/*N*/ }
+
+// Ende eines Save/SaveAs/HandsOff.
+// Falls der Storage gewechselt hat, muessen die Streams
+// neu geoeffnet werden.
+
+
+/*N*/ BOOL Sw3Io::SaveCompleted( SvStorage* pNew )
+/*N*/ {
+/*N*/ BOOL bClearNm = !pNew || pNew == pImp->pRoot;
+/*N*/
+/*N*/ if( pNew )
+/*N*/ pImp->pRoot = pNew;
+/*N*/ else
+/*?*/ pImp->pRoot = pImp->pDoc->GetDocStorage();
+/*N*/
+/*N*/ // Hier muss noch ueber die Grafiknodes iteriert werden, um
+/*N*/ // ihnen zu sagen, wie ihr neuer Streamname lautet!
+/*N*/ // Da Grafiken Flys sind, liegen die Nodes im Autotext-Bereich
+/*N*/ SwNodes& rNds = pImp->pDoc->GetNodes();
+/*N*/ ULONG nEnd = rNds.GetEndOfAutotext().GetIndex();
+/*N*/ for( ULONG nIdx = rNds.GetEndOfInserts().GetIndex() + 1; nIdx < nEnd; ++nIdx)
+/*N*/ {
+/*N*/ SwGrfNode* pNd = rNds[ nIdx ]->GetGrfNode();
+/*N*/ if( pNd )
+/*N*/ pNd->SaveCompleted( bClearNm );
+/*N*/ }
+/*N*/
+/*N*/ return TRUE;
+/*N*/ }
+
+
+/*N*/ SvStorage* Sw3Io::GetStorage()
+/*N*/ {
+/*N*/ if( !pImp->pRoot.Is() )
+/*N*/ pImp->pRoot = pImp->pDoc->GetPersist()->GetStorage();
+/*N*/ return &pImp->pRoot;
+/*N*/ }
+
+
+/*N*/ void Sw3Io::SetReadOptions( const SwgReaderOption& rOpt, BOOL bOverwrite )
+/*N*/ {
+/*N*/ pImp->SetReadOptions( rOpt, bOverwrite );
+/*N*/ }
+
+
+/*N*/ ULONG Sw3Io::SaveStyles()
+/*N*/ {
+/*N*/ BOOL bGood = pImp->OpenStreams( TRUE, FALSE );
+/*N*/ ASSERT( bGood, "Es fehlen leider ein paar Streams!" );
+/*N*/ if( !bGood )
+/*N*/ return pImp->nRes = ERR_SWG_WRITE_ERROR;
+/*N*/
+/*N*/ pImp->bOrganizer = TRUE;
+/*N*/
+/*N*/ // Nur Bookmarks aus Seiten-Vorlagen sammeln
+/*N*/ pImp->CollectMarks( NULL, TRUE );
+/*N*/ if( !pImp->IsSw31Or40Export() )
+/*N*/ pImp->CollectRedlines( NULL, TRUE );
+/*N*/ else
+/*N*/ pImp->CollectTblLineBoxFmts40();
+/*N*/
+/*N*/ // Stringpool fuellen, Namen im Doc erweitern
+/*N*/ pImp->aStringPool.Setup( *pImp->pDoc, pImp->pRoot->GetVersion(),
+/*N*/ pImp->pExportInfo );
+/*N*/ pImp->SaveStyleSheets( FALSE );
+/*N*/ // Temporaere Namenserweiterungen entfernen
+/*N*/ pImp->aStringPool.RemoveExtensions( *pImp->pDoc );
+/*N*/ pImp->SaveNumRules( FALSE );
+/*N*/ pImp->SavePageStyles();
+/*N*/ pImp->CloseStreams();
+/*N*/
+/*N*/ pImp->bOrganizer = FALSE;
+/*N*/
+/*N*/ if( pImp->nRes )
+/*N*/ pImp->nRes |= ERRCODE_CLASS_WRITE;
+/*N*/ else if( pImp->nWarn )
+/*N*/ pImp->nRes = pImp->nWarn | ERRCODE_CLASS_WRITE;
+/*N*/ return pImp->nRes;
+/*N*/ }
+
+// Erzeugen eines eindeutigen Stream-Namens in einem Storage
+
+
+/*N*/ String Sw3Io::UniqueName( SvStorage* pStg, const sal_Char* p )
+/*N*/ {
+/*N*/ String aName;
+/*N*/ sal_Char cBuf[ 32 ];
+/*N*/
+/*N*/ // Man nehme die Adresse von cBuf auf dem Stack als Anfangswert
+/*N*/ // aber nur ein einziges mal (bug fix 20976)
+/*N*/ #ifdef SINIX
+/*N*/ static ULONG nId = 0;
+/*N*/ if ( ! nId )
+/*N*/ nId = (ULONG) cBuf;
+/*N*/ #else
+/*N*/ static ULONG nId = (ULONG) cBuf;
+/*N*/ #endif
+/*N*/
+/*N*/ nId++;
+/*N*/ for( ;; )
+/*N*/ {
+/*N*/ snprintf( cBuf, sizeof(cBuf), "%s%08lX", p, nId );
+/*N*/ aName.AssignAscii( cBuf );
+/*N*/ if( !pStg->IsContained( aName ) )
+/*N*/ break;
+/*N*/ nId++;
+/*N*/ }
+/*N*/ return aName;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3misc.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3misc.cxx
new file mode 100644
index 000000000000..590ec5ee0736
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3misc.cxx
@@ -0,0 +1,2810 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#define _ZFORLIST_DECLARE_TABLE
+
+#include <hintids.hxx>
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svtools/urihelper.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <bf_sfx2/docinf.hxx>
+
+#include <stdio.h>
+
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/linguistic2/XDictionaryList.hpp>
+#include <com/sun/star/linguistic2/XDictionary1.hpp>
+
+#include <bf_svtools/zforlist.hxx>
+#include <bf_svx/svxids.hrc>
+#include <bf_svx/svdmodel.hxx>
+
+#include <docsh.hxx>
+#include <charfmt.hxx>
+
+#include <errhdl.hxx>
+
+#include <lineinfo.hxx>
+#include <pvprtdat.hxx>
+#include <linkenum.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pam.hxx>
+#include <sw3imp.hxx>
+#include <sw3marks.hxx>
+#include <pagedesc.hxx>
+#include <bookmrk.hxx>
+#include <poolfmt.hxx>
+#include <doctxm.hxx>
+#include <dbmgr.hxx>
+#include <swtblfmt.hxx>
+#include <fldupde.hxx>
+#include <fldbas.hxx>
+#include <ndtxt.hxx>
+
+#include <cmdid.h>
+#include <swerror.h>
+#include <SwStyleNameMapper.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::linguistic2;
+
+#define URL_DECODE \
+ , INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS
+
+//#define TEST_FMTCHACHE
+
+// local record of SWG_TOX
+#define SWG_FORMPATTERN_LCL 'P'
+
+// local record of SWG_FORMPATTERN_LCL
+#define SWG_FORMTOKEN_LCL 'D'
+
+class Sw3TOXBase : public SwTOXBase
+{
+ SwNodeIndex *pStartNodeIdx;
+ SwNodeIndex *pEndNodeIdx;
+
+ SwSectionFmt *pSectFmt;
+ SwSectionFmt *pTitleSectFmt;
+
+ sal_uInt32 nTitleLen;
+ sal_uInt16 nStrIdx;
+
+public:
+
+ Sw3TOXBase( const SwTOXType* pTyp, const SwForm& rForm,
+ sal_uInt16 nCreaType, const String& rTitle ) :
+ SwTOXBase( pTyp, rForm, nCreaType, rTitle ),
+ pStartNodeIdx( 0 ), pEndNodeIdx( 0 ),
+ pSectFmt( 0 ), pTitleSectFmt( 0 ),
+ nTitleLen( 0 ), nStrIdx( IDX_NO_VALUE )
+ {}
+
+ ~Sw3TOXBase();
+
+ const SwNodeIndex *GetStartNodeIdx() const { return pStartNodeIdx; }
+ const SwNodeIndex *GetEndNodeIdx() const { return pEndNodeIdx; }
+ void SetNodeIdx( const SwNodeIndex& rNodeIdx );
+
+ SwSectionFmt *GetSectFmt() const { return pSectFmt; }
+ void SetSectFmt( SwSectionFmt *pFmt ) { pSectFmt = pFmt; }
+
+ SwSectionFmt *GetTitleSectFmt() const { return pTitleSectFmt; }
+ void SetTitleSectFmt( SwSectionFmt *pFmt ) { pTitleSectFmt = pFmt; }
+
+ sal_uInt32 GetTitleLen() const { return nTitleLen; }
+ void SetTitleLen( sal_uInt32 n ) { nTitleLen = n; }
+
+ sal_uInt16 GetSectFmtStrIdx() const { return nStrIdx; }
+ void SetSectFmtStrIdx( sal_uInt16 n ) { nStrIdx = n; }
+};
+
+/*N*/ SV_IMPL_PTRARR(Sw3TOXs,Sw3TOXBase*)
+
+/*N*/ void Sw3TOXBase::SetNodeIdx( const SwNodeIndex& rNodeIdx )
+/*N*/ {
+/*N*/ SwNodeIndex *pNdIdx = new SwNodeIndex( rNodeIdx );
+/*N*/ if( pStartNodeIdx )
+/*N*/ {
+/*N*/ ASSERT( !pEndNodeIdx, "more than two TOX indexes" );
+/*N*/ if( !pEndNodeIdx )
+/*N*/ {
+/*N*/ if( rNodeIdx.GetIndex() < pStartNodeIdx->GetIndex() )
+/*N*/ {
+/*?*/ pEndNodeIdx = pStartNodeIdx;
+/*?*/ pStartNodeIdx = pNdIdx;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pEndNodeIdx = pNdIdx;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pStartNodeIdx = pNdIdx;
+/*N*/ }
+/*N*/ }
+
+/*N*/ Sw3TOXBase::~Sw3TOXBase()
+/*N*/ {
+/*N*/ delete pStartNodeIdx;
+/*N*/ delete pEndNodeIdx;
+/*N*/
+/*N*/ // Section formats must not be deleted by delete.
+/*N*/ SwDoc *pDoc = 0;
+/*N*/ if( pTitleSectFmt )
+/*N*/ {
+/*?*/ pDoc = pTitleSectFmt->GetDoc();
+/*?*/ pDoc->DelSectionFmt( pTitleSectFmt, sal_False );
+/*N*/ }
+/*N*/ if( pSectFmt )
+/*N*/ {
+/*?*/ if( !pDoc )
+/*?*/ pDoc = pSectFmt->GetDoc();
+/*?*/ pDoc->DelSectionFmt( pSectFmt, sal_False );
+/*N*/ }
+/*N*/ }
+
+// Finden eines Formats nach Namen
+
+/*N*/ SwFmt* Sw3IoImp::FindFmt( sal_uInt16 nIdx, sal_uInt8 cKind )
+/*N*/ {
+/*N*/ SwFmt* pFmt = NULL;
+/*N*/ switch( nIdx )
+/*N*/ {
+/*N*/ case IDX_NO_VALUE:
+/*N*/ return NULL; // Direkter Abbruch, kein Assert
+/*N*/ case IDX_DFLT_VALUE:
+/*N*/ switch( cKind )
+/*N*/ {
+/*N*/ case SWG_FLYFMT:
+/*N*/ case SWG_SDRFMT:
+/*N*/ case SWG_FREEFMT:
+/*N*/ case SWG_FRAMEFMT:
+/*N*/ pFmt = pDoc->GetDfltFrmFmt(); break;
+/*?*/ case SWG_CHARFMT:
+/*?*/ pFmt = pDoc->GetDfltCharFmt(); break;
+/*?*/ case SWG_GRFFMT:
+/*?*/ pFmt = (SwFmt*) pDoc->GetDfltGrfFmtColl(); break;
+/*N*/ case SWG_SECTFMT:
+/*N*/ case 0:
+/*N*/ return NULL; // Direkter Abbruch, kein Assert
+/*N*/ } break;
+/*N*/ default:
+/*N*/ // Holen des Namens und suchen im Doc
+/*N*/
+/*N*/ // OPT: Cache fuer Formate im StringPool
+/*N*/ if( nIdx < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ pFmt = aStringPool.FindCachedFmt( nIdx );
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ #ifdef TEST_FMTCHACHE
+/*N*/ ASSERT( FindNamedFmt( nIdx, cKind ) == pFmt,
+/*N*/ "Format-Cache liefert falsches Ergebnis" );
+/*N*/ #endif
+/*N*/ return pFmt;
+/*N*/ }
+/*N*/ }
+/*N*/ // /OPT: Cache fuer Formate im StringPool
+/*N*/
+/*N*/ pFmt = FindNamedFmt( nIdx, cKind );
+/*N*/ }
+/*N*/ ASSERT( pFmt, "Format-ID unbekannt" );
+/*N*/ return pFmt;
+/*N*/ }
+
+// Suchen eines (benannten) Formats am Dokument
+
+/*N*/ SwFmt* Sw3IoImp::FindNamedFmt( sal_uInt16 nIdx, sal_uInt8 cKind )
+/*N*/ {
+/*N*/ if( nIdx < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ SwFmt* pFmt;
+/*N*/ const String& rName = aStringPool.Find( nIdx );
+/*N*/ sal_uInt16 n, nArrLen;
+/*N*/ if( cKind == SWG_CHARFMT )
+/*N*/ {
+/*N*/ nArrLen = pDoc->GetCharFmts()->Count();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ pFmt = (SwFmt*) (*pDoc->GetCharFmts())[ n ];
+/*N*/ if( pFmt->GetName() == rName )
+/*N*/ {
+/*N*/ // OPT: Cache fuer Formate im StringPool
+/*N*/ aStringPool.SetCachedFmt( nIdx, pFmt );
+/*N*/ // /OPT: Cache fuer Formate im StringPool
+/*N*/ return pFmt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if( cKind == SWG_SECTFMT )
+/*N*/ {
+/*?*/ nArrLen = pDoc->GetSections().Count();
+/*?*/ for( n = 0; n < nArrLen; n++ )
+/*?*/ {
+/*?*/ pFmt = pDoc->GetSections()[ n ];
+/*?*/ if( pFmt->GetName() == rName )
+/*?*/ {
+/*?*/ // OPT: Cache fuer Formate im StringPool
+/*?*/ aStringPool.SetCachedFmt( nIdx, pFmt );
+/*?*/ // /OPT: Cache fuer Formate im StringPool
+/*?*/ return pFmt;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nArrLen = pDoc->GetFrmFmts()->Count();
+/*N*/ const SwFrmFmts *pFrmFmts = pDoc->GetFrmFmts();
+/*N*/ for( n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ pFmt = (SwFmt*) (*pFrmFmts)[ n ];
+/*N*/ if( pFmt->GetName() == rName )
+/*N*/ {
+/*N*/ // OPT: Cache fuer Formate im StringPool
+/*N*/ aStringPool.SetCachedFmt( nIdx, pFmt );
+/*N*/ // /OPT: Cache fuer Formate im StringPool
+/*N*/ return pFmt;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*?*/ if( 0 != ( pFmt = pDoc->FindSpzFrmFmtByName( rName )) ||
+/*?*/ 0 != ( pFmt = pDoc->FindTblFmtByName( rName )) )
+/*?*/ return pFmt;
+/*?*/ }
+/*?*/ // Vielleicht koennen wir uns eines machen?
+/*?*/ sal_uInt16 nPoolId = aStringPool.FindPoolId( nIdx );
+/*?*/ if( !IsPoolUserFmt( nPoolId ) ) // fix 20976
+/*?*/ {
+/*?*/ pFmt = pDoc->GetFmtFromPool( nPoolId );
+/*?*/ if( pFmt )
+/*?*/ return pFmt;
+/*?*/ }
+/*?*/ }
+/*?*/ ASSERT( !this, "Benanntes Format nicht gefunden" );
+/*?*/ // Falls ueber den Organizer, die Styles veraendert wurden, kein Fehler
+/*?*/ // melden, sonder auf Standard zurueck fallen
+/*?*/ // Error();
+/*?*/ Warning();
+/*?*/ if( cKind == SWG_CHARFMT )
+/*?*/ return pDoc->GetDfltCharFmt();
+/*?*/ else if( cKind==SWG_FRAMEFMT || cKind==SWG_FLYFMT )
+/*?*/ return pDoc->GetFmtFromPool( RES_POOLFRM_FRAME );
+/*?*/ else if( cKind==SWG_SDRFMT )
+/*?*/ return pDoc->GetDfltFrmFmt();
+/*?*/
+/*?*/ Error(); // alle anderen erzeugen einen Fehler
+/*?*/ return NULL;
+/*N*/ }
+
+// Suchen einer TextColl am Dokument
+/*N*/ SwTxtFmtColl* Sw3IoImp::FindTxtColl( sal_uInt16 nIdx )
+/*N*/ {
+/*N*/ if( nIdx < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ const String& rName = aStringPool.Find( nIdx );
+/*N*/ sal_uInt16 nArrLen = pDoc->GetTxtFmtColls()->Count();
+/*N*/ for( sal_uInt16 n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ SwTxtFmtColl* pColl = (SwTxtFmtColl*) (*pDoc->GetTxtFmtColls())[ n ];
+/*N*/ if( pColl->GetName() == rName )
+/*N*/ return pColl;
+/*N*/ }
+/*N*/ // Vielleicht koennen wir uns eines machen?
+/*?*/ sal_uInt16 nPoolId = aStringPool.FindPoolId( nIdx );
+/*?*/ if( nPoolId && !IsPoolUserFmt( nPoolId ) )
+/*?*/ {
+/*?*/ SwTxtFmtColl* pColl = pDoc->GetTxtCollFromPool( nPoolId );
+/*?*/ if( pColl )
+/*?*/ return pColl;
+/*?*/ }
+/*?*/ // Werden nur Seitenvorlagen eingelesen, wird still auf StdColl gemapt
+/*?*/ // in diesem Fall lesen wir naemlich gerade einen Header/Footer ein,
+/*?*/ // und der hat vielleicht eine unbekannte Absatzvorlage
+/*?*/ if( bPageDescs && !bTxtColls )
+/*?*/ return pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+/*?*/ ASSERT( !this, "TextColl nicht gefunden" );
+/*?*/
+/*?*/ // Falls ueber den Organizer, die Styles veraendert wurden, kein Fehler
+/*?*/ // melden, sonder auf Standard zurueck fallen
+/*?*/ // Error();
+/*?*/ Warning();
+/*?*/ }
+/*?*/ return pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+/*N*/ }
+
+// Suchen einer Seitenvorlage am Dokument
+
+/*N*/ SwPageDesc* Sw3IoImp::FindPageDesc( sal_uInt16 nIdx )
+/*N*/ {
+/*N*/ if( nIdx < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ const String& rName = aStringPool.Find( nIdx );
+/*N*/ sal_uInt16 nArrLen = pDoc->GetPageDescCnt();
+/*N*/ for( sal_uInt16 n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ const SwPageDesc& rPg = pDoc->GetPageDesc( n );
+/*N*/ if( rPg.GetName() == rName )
+/*N*/ return (SwPageDesc*) &rPg;
+/*N*/ }
+/*N*/ // Vielleicht koennen wir uns eines machen?
+/*?*/ sal_uInt16 nPoolId = aStringPool.FindPoolId( nIdx );
+/*?*/ if( nPoolId )
+/*?*/ {
+/*?*/ SwPageDesc* p = pDoc->GetPageDescFromPool( nPoolId );
+/*?*/ if( p )
+/*?*/ return p;
+/*?*/ }
+/*?*/ ASSERT( !this, "PageDesc nicht gefunden" );
+/*?*/ // Falls ueber den Organizer, die Styles veraendert wurden, kein Fehler
+/*?*/ // melden, sonder auf Standard zurueck fallen
+/*?*/ // Error();
+/*?*/ Warning();
+/*?*/ }
+/*?*/ return (SwPageDesc*) &pDoc->GetPageDesc( 0 );
+/*N*/ }
+
+//////////////////////////////////////////////////////////////////////////
+
+// Makros
+
+void Sw3IoImp::InMacroTbl()
+{
+ OpenRec( SWG_MACROTBL );
+ while( BytesLeft() )
+ {
+ OpenRec( SWG_MACRO );
+ sal_uInt16 nKey, nScriptType = STARBASIC;
+ String aLib, aMac;
+ *pStrm >> nKey;
+ InString( *pStrm, aLib );
+ InString( *pStrm, aMac );
+
+ if( SWG_SVXMACROS <= nVersion )
+ *pStrm >> nScriptType;
+ pDoc->SetGlobalMacro( nKey, SvxMacro( aMac, aLib,
+ (ScriptType)nScriptType ) );
+ CloseRec( SWG_MACRO );
+ }
+ CloseRec( SWG_MACROTBL );
+}
+
+/*N*/ void Sw3IoImp::OutMacroTbl()
+/*N*/ {
+/*N*/ const SvxMacroTableDtor& rTbl = pDoc->GetMacroTable();
+/*N*/ SvxMacro* pMac = ((SvxMacroTableDtor&) rTbl).First();
+/*N*/ if( !pMac )
+/*N*/ return;
+/*N*/
+/*?*/ ASSERT( SOFFICE_FILEFORMAT_31 == pStrm->GetVersion() ||
+/*?*/ SOFFICE_FILEFORMAT_40 == pStrm->GetVersion() ||
+/*?*/ SOFFICE_FILEFORMAT_50 == pStrm->GetVersion(),
+/*?*/ "Macro-Table: Gibt es ein neues Fileformat?" );
+/*?*/ if( SOFFICE_FILEFORMAT_31 == pStrm->GetVersion() )
+/*?*/ {
+/*?*/ // suche das erste StarBasicMacro!
+/*?*/ while( pMac && STARBASIC != pMac->GetScriptType() )
+/*?*/ pMac = ((SvxMacroTableDtor&) rTbl).Next();
+/*?*/ if( !pMac )
+/*?*/ return ;
+/*?*/ }
+/*?*/
+/*?*/ OpenRec( SWG_MACROTBL );
+/*?*/ while( pMac && Good() )
+/*?*/ {
+/*?*/ OpenRec( SWG_MACRO );
+/*?*/ *pStrm << (sal_uInt16) rTbl.GetCurKey();
+/*?*/ OutString( *pStrm, pMac->GetLibName() );
+/*?*/ OutString( *pStrm, pMac->GetMacName() );
+/*?*/
+/*?*/ if( SOFFICE_FILEFORMAT_31 == pStrm->GetVersion() )
+/*?*/ {
+/*?*/ do {
+/*?*/ pMac = ((SvxMacroTableDtor&) rTbl).Next();
+/*?*/ } while( pMac && STARBASIC != pMac->GetScriptType() );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ *pStrm << (sal_uInt16)pMac->GetScriptType();
+/*?*/ pMac = ((SvxMacroTableDtor&) rTbl).Next();
+/*?*/ }
+/*?*/
+/*?*/ CloseRec( SWG_MACRO );
+/*?*/ }
+/*?*/ CloseRec( SWG_MACROTBL );
+/*N*/ }
+
+/*************************************************************************
+*
+* Job Setup
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::InJobSetup()
+/*N*/ {
+/*N*/ OpenRec( SWG_JOBSETUP );
+/*N*/ OpenFlagRec();
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ //JP 13.10.95: laut Changes-Mail von MI
+/*N*/ static sal_uInt16 __READONLY_DATA nRange[] =
+/*N*/ {
+/*N*/ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+/*N*/ SID_HTML_MODE, SID_HTML_MODE,
+/*N*/ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+/*N*/ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+/*N*/ 0
+/*N*/ };
+/*N*/ SfxItemSet *pItemSet = new SfxItemSet( pDoc->GetAttrPool(), nRange );
+/*N*/ SfxPrinter *pPrinter = SfxPrinter::Create( *pStrm, pItemSet );
+/*N*/
+/*N*/ if ( !IsVersion(SWG_VIRTUAL_DEVICE) )
+/*N*/ pDoc->_SetUseVirtualDevice( sal_False );
+/*N*/ pDoc->_SetPrt( pPrinter );
+/*N*/
+/*N*/ if ( !pPrinter->IsOriginal() )
+/*N*/ {
+/*N*/ pDoc->GetDocShell()->UpdateFontList();
+/*N*/ if ( pDoc->pDrawModel )
+/*N*/ pDoc->pDrawModel->SetRefDevice( pPrinter );
+/*N*/
+/*N*/ pDoc->SetOLEPrtNotifyPending( sal_True );
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_JOBSETUP );
+/*N*/ }
+
+// Neu fuer OS/2: Wenn das Job-Setup keine Daten enthaelt, dann wird das
+// Job-Setup nicht rausgeschrieben.
+
+/*N*/ void Sw3IoImp::OutJobSetup()
+/*N*/ {
+/*N*/ SfxPrinter* pPrt = pDoc->GetPrt();
+/*N*/ if( pPrt )
+/*N*/ {
+/*N*/ OpenRec( SWG_JOBSETUP );
+/*N*/ sal_uInt8 cFlags = 0x00;
+/*N*/ *pStrm << cFlags;
+/*N*/ pPrt->Store( *pStrm );
+/*N*/ CloseRec( SWG_JOBSETUP );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+*
+* Stringpool (ab Version 2)
+*
+*************************************************************************/
+
+/*N*/ void Sw3IoImp::InStringPool( sal_uInt8 cType, Sw3StringPool& rPool )
+/*N*/ {
+/*N*/ OpenRec( cType );
+/*N*/ if( nVersion < SWG_POOLIDS )
+ rPool.LoadOld( *pStrm );
+/*N*/ else
+/*N*/ rPool.Load( *pStrm, nVersion );
+/*N*/ CloseRec( cType );
+/*N*/ if( pStrm->GetError() != SVSTREAM_OK )
+/*N*/ Error( ERR_SWG_READ_ERROR );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutStringPool( sal_uInt8 cType, Sw3StringPool& rPool )
+/*N*/ {
+/*N*/ OpenRec( cType );
+/*N*/ rPool.Store( *pStrm );
+/*N*/ CloseRec( cType );
+/*N*/ }
+
+void Sw3IoImp::InPasswd()
+{
+ OpenRec( SWG_PASSWORD );
+ if( nVersion >= SWG_CRYPT )
+ {
+ sal_uInt8 cType;
+ ByteString aPasswd;
+ *pStrm >> cType;
+ // TODO: unicode: It seems that we had a bug here, because the
+ // password was converted from the source to the system encoding
+ // before it was decrypted. We now decrypt it first.
+ pStrm->ReadByteString( aPasswd );
+ /*
+ // Datum und Uhrzeit als Passwort fuers Passwort nehmen
+ sal_Char buf[ 17 ];
+ snprintf( buf, sizeof(buf), "%08lx%08lx", nDate, nTime );
+ Crypter( buf ).Decrypt( aPasswd );
+ switch( cType )
+ {
+ case 1:
+ {
+ ::com::sun::star::uno::Sequence <sal_Int8> aPWD;
+ SvPasswordHelper::GetHashPassword( aPWD,
+ String( aPasswd, eSrcSet ));
+ pDoc->ChgSectionPasswd( aPWD );
+ break;
+ }
+ }*/
+ }
+ CloseRec( SWG_PASSWORD );
+}
+
+/*N*/ int sw3mark_compare( const Sw3Mark& r1, const Sw3Mark& r2 )
+/*N*/ {
+/*N*/ int nRet = 0;
+/*N*/ if( r1.nNodePos < r2.nNodePos )
+/*N*/ nRet = -1;
+/*N*/ else if( r1.nNodePos > r2.nNodePos )
+/*N*/ nRet = 1;
+/*N*/ else if( r1.nNodeOff < r2.nNodeOff )
+/*N*/ nRet = -1;
+/*N*/ else if( r1.nNodeOff > r2.nNodeOff )
+/*N*/ nRet = 1;
+/*N*/ else if( r1.nId < r2.nId )
+/*N*/ nRet = -1;
+/*N*/ else if( r1.nId > r2.nId || r1.eType != r2.eType )
+/*N*/ nRet = 1;
+/*N*/
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ IMPL_CONTAINER_SORT( Sw3Marks, Sw3Mark, sw3mark_compare )
+
+extern sal_Bool lcl_sw3io_isTOXHeaderSection( const SwStartNode& rSttNd );
+/*N*/ void Sw3IoImp::CollectMarks( SwPaM* pPaM, sal_Bool bPageOnly )
+/*N*/ {
+/*N*/ sal_uInt32 nEndOfIcons = pDoc->GetNodes().GetEndOfExtras().GetIndex();
+/*N*/
+/*N*/ // Bereich bestimmen
+/*N*/ sal_uInt32 nStart, nEnd;
+/*N*/ if( !bSaveAll && pPaM )
+/*?*/ nStart = pPaM->GetPoint()->nNode.GetIndex(),
+/*?*/ nEnd = pPaM->GetMark()->nNode.GetIndex();
+/*N*/ else
+/*N*/ nStart = 0,
+/*N*/ nEnd = pDoc->GetNodes().GetEndOfContent().GetIndex();
+/*N*/ if( nStart > nEnd )
+/*N*/ {
+/*N*/ // Start muss kleiner als Ende sein
+/*N*/ sal_uInt32 n = nStart; nStart = nEnd; nEnd = n;
+/*N*/ }
+/*N*/ // Array anlegen
+/*N*/ delete pMarks;
+/*N*/ pMarks = 0;
+/*N*/
+/*N*/ delete pBookmarks;
+/*N*/ pBookmarks = new Sw3Bookmarks;
+/*N*/ nCntntBkmkStart = 0;
+/*N*/
+/*N*/ Sw3Mark aMark;
+/*N*/ // text::Bookmarks absammeln (nicht, wenn Konversion SW2-Textbausteine auf SW3)
+/*N*/ if( !( nGblFlags & SW3F_CONVBLOCK ) )
+/*N*/ {
+/*N*/ //JP 23.09.95: wenn Selektion geschrieben wird, dann auch alle aus
+/*N*/ // den Sonderbereichen mit nehmen!!
+/*N*/ const SwBookmarks& rMarks = pDoc->GetBookmarks();
+/*N*/ sal_uInt16 nArrLen = rMarks.Count();
+/*N*/
+/*N*/ for( sal_uInt16 n = 0; n < nArrLen; ++n )
+/*N*/ {
+/*N*/ SwBookmark* pMark = rMarks.GetObject( n );
+/*N*/ if( !pMark->IsBookMark() )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwPosition& rPos1 = pMark->GetPos();
+/*N*/ const SwPosition* pPos2 = pMark->GetOtherPos();
+/*N*/ if( rPos1.nContent.GetIndex() > STRING_MAXLEN52 &&
+/*N*/ ( !pPos2 ||
+/*N*/ (rPos1.nNode.GetIndex() == pPos2->nNode.GetIndex() &&
+/*N*/ pPos2->nContent.GetIndex() > STRING_MAXLEN52) ) )
+/*N*/ continue;
+/*N*/
+/*N*/ if( pDoc->IsInHeaderFooter( rPos1.nNode ) )
+/*N*/ {
+/*?*/ pBookmarks->Insert( pMark, nCntntBkmkStart );
+/*?*/ nCntntBkmkStart++;
+/*N*/ }
+/*N*/ else if( !bPageOnly )
+/*N*/ {
+/*N*/ pBookmarks->Insert( pMark, pBookmarks->Count() );
+/*N*/ }
+/*N*/ }
+/*N*/ nArrLen = pBookmarks->Count();
+/*N*/ if( nArrLen )
+/*N*/ {
+/*N*/ pMarks = new Sw3Marks( nArrLen + nArrLen / 4, nArrLen / 4 );
+/*N*/
+/*N*/ if( pPaM )
+/*N*/ {
+/*N*/ for( sal_uInt16 n = 0; n < nArrLen; ++n )
+/*N*/ {
+/*N*/ const SwBookmark* pMark = pBookmarks->GetObject( n );
+/*N*/ ASSERT( pMark->IsBookMark(),
+/*N*/ "Wo kommt da die Nicht text::Bookmark her?" );
+/*N*/
+/*N*/ if( !IsSw31Export() && n >= nCntntBkmkStart )
+/*N*/ aMark.SetId( n - nCntntBkmkStart );
+/*N*/ else
+/*N*/ aMark.SetId( n );
+/*N*/ const SwPosition* pPos1 = &pMark->GetPos();
+/*N*/ const SwPosition* pPos2 = pMark->GetOtherPos();
+/*N*/ ASSERT( pPos1->nNode.GetNode().IsTxtNode(),
+/*N*/ "Bookmark position outside text node" );
+/*N*/ aMark.SetNodePos( pPos1->nNode.GetIndex() );
+/*N*/ if( aMark.GetNodePos() < nEndOfIcons ||
+/*N*/ ( aMark.GetNodePos() >= nStart && aMark.GetNodePos() <= nEnd ))
+/*N*/ {
+/*N*/ aMark.SetNodeOff( pPos1->nContent.GetIndex() );
+/*N*/ aMark.SetType( SW3_BOOK_POINT );
+/*N*/ pMarks->Insert( new Sw3Mark(aMark) );
+/*N*/ }
+/*N*/ if( pPos2 )
+/*N*/ {
+/*?*/ ASSERT( pPos2->nNode.GetNode().IsTxtNode(),
+/*?*/ "Other bookmark position outside text node" );
+/*?*/ aMark.SetNodePos( pPos2->nNode.GetIndex() );
+/*?*/ if( aMark.GetNodePos() < nEndOfIcons ||
+/*?*/ ( aMark.GetNodePos() >= nStart && aMark.GetNodePos() <= nEnd ))
+/*?*/ {
+/*?*/ aMark.SetNodeOff( pPos2->nContent.GetIndex() );
+/*?*/ aMark.SetType( SW3_BOOK_MARK );
+/*?*/ pMarks->Insert( new Sw3Mark(aMark) );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ for( sal_uInt16 n = 0; n < nArrLen; ++n )
+/*?*/ {
+/*?*/ const SwBookmark* pMark = pBookmarks->GetObject( n );
+/*?*/ ASSERT( pMark->IsBookMark(),
+/*?*/ "Wo kommt da die Nicht Bookmark her?" );
+/*?*/
+/*?*/ if( !IsSw31Export() && n >= nCntntBkmkStart )
+/*?*/ aMark.SetId( n - nCntntBkmkStart );
+/*?*/ else
+/*?*/ aMark.SetId( n );
+/*?*/
+/*?*/ const SwPosition* pPos = &pMark->GetPos();
+/*?*/ ASSERT( pPos->nNode.GetNode().IsTxtNode(),
+/*?*/ "Bookmark position outside text node" );
+/*?*/
+/*?*/ aMark.SetNodePos( pPos->nNode.GetIndex() );
+/*?*/ aMark.SetNodeOff( pPos->nContent.GetIndex() );
+/*?*/ aMark.SetType( SW3_BOOK_POINT );
+/*?*/ pMarks->Insert( new Sw3Mark(aMark) );
+/*?*/
+/*?*/ pPos = pMark->GetOtherPos();
+/*?*/ if( pPos )
+/*?*/ {
+/*?*/ ASSERT( pPos->nNode.GetNode().IsTxtNode(),
+/*?*/ "Other bookmark position outside text node" );
+/*?*/ aMark.SetNodePos( pPos->nNode.GetIndex() );
+/*?*/ aMark.SetNodeOff( pPos->nContent.GetIndex() );
+/*?*/ aMark.SetType( SW3_BOOK_MARK );
+/*?*/ pMarks->Insert( new Sw3Mark(aMark) );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Collect TOX sections. To be compatible with the 5.0 file format and
+/*N*/ // earlier file format versions, TOX section are not exported directly.
+/*N*/ // Instead of this, the start and end positions of this sections is
+/*N*/ // exported.
+/*N*/ // MIB 01.09.97: wenn Selektion geschrieben wird, dann auch alle aus
+/*N*/ // den Sonderbereichen mit nehmen (##)
+/*N*/
+/*N*/ aMark.SetId( 0 );
+/*N*/ const SwSectionFmts& rSectFmts = pDoc->GetSections();
+/*N*/
+/*N*/ for( sal_uInt16 i=0; i < rSectFmts.Count(); i++ )
+/*N*/ {
+/*N*/ const SwSectionFmt* pSectFmt = rSectFmts[i];
+/*N*/
+/*N*/ // Skip TOXs that are somehow incomplete.
+/*N*/ const SwSection* pSect = pSectFmt->GetSection();
+/*N*/ if( !pSect || TOX_CONTENT_SECTION != pSect->GetType() )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwSectionNode *pSectNd = pSectFmt->GetSectionNode();
+/*N*/ if( !pSectNd )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwTOXBaseSection *pTOXBaseSect =
+/*N*/ PTR_CAST( SwTOXBaseSection, pSect );
+/*N*/ if( !pTOXBaseSect || !pTOXBaseSect->GetTOXType() )
+/*N*/ continue;
+/*N*/
+/*N*/ ULONG nStartIdx = pSectNd->GetIndex();
+/*N*/ ULONG nEndIdx = pSectNd->EndOfSectionIndex();
+/*N*/
+/*N*/ // Skip TOXs that are not contained within the saved area completely.
+/*N*/ if( nStart >= nEndOfIcons && (nStartIdx < nStart || nEndIdx > nEnd) )
+/*N*/ continue;
+/*N*/
+/*N*/ if( !pMarks )
+/*N*/ pMarks = new Sw3Marks( 16, 4 );
+/*N*/
+/*N*/ // The start pos is the first section node. If this is the start node
+/*N*/ // of a TOX header section that starts with a text node, the start pos
+/*N*/ // is the second node. See Sw3IoImp::OutSection in sw3sect.cxx.
+/*N*/ nStartIdx++;
+/*N*/ const SwStartNode *pSttNd = pDoc->GetNodes()[nStartIdx]->GetStartNode();
+/*N*/ if( pSttNd && lcl_sw3io_isTOXHeaderSection( *pSttNd ) &&
+/*N*/ pDoc->GetNodes()[nStartIdx+1]->IsTxtNode() ) // could be a start nd
+/*N*/ nStartIdx++;
+/*N*/
+/*N*/ aMark.SetNodePos( nStartIdx );
+/*N*/ aMark.SetNodeOff( 0 );
+/*N*/ aMark.SetType( SW3_TOX_POINT );
+/*N*/ pMarks->Insert( new Sw3Mark(aMark) );
+/*N*/
+/*N*/ // The end pos is the last but one section node. If this is the end
+/*N*/ // node of a TOX header section that ends with a text node, the end
+/*N*/ // pos is the last but two node. See Sw3IoImp::OutSection in
+/*N*/ // sw3sect.cxx.
+/*N*/ nEndIdx--;
+/*N*/ const SwEndNode *pEndNd = pDoc->GetNodes()[nEndIdx]->GetEndNode();
+/*N*/ if( pEndNd &&
+/*N*/ lcl_sw3io_isTOXHeaderSection( *pEndNd->StartOfSectionNode() ) &&
+/*N*/ pDoc->GetNodes()[nEndIdx-1]->IsTxtNode() ) // could be an end node
+/*N*/ nEndIdx--;
+/*N*/
+/*N*/ aMark.SetNodePos( nEndIdx );
+/*N*/
+/*N*/ const SwTxtNode *pTxtNd = pDoc->GetNodes()[nEndIdx]->GetTxtNode();
+/*N*/ xub_StrLen nCntntIdx = pTxtNd ? pTxtNd->Len() : 0;
+/*N*/ aMark.SetNodeOff( nCntntIdx );
+/*N*/ aMark.SetType( SW3_TOX_MARK );
+/*N*/ pMarks->Insert( new Sw3Mark(aMark) );
+/*N*/
+/*N*/ aMark.SetId( aMark.GetId() + 1 );
+/*N*/ }
+/*N*/
+/*N*/ // Ist was da?
+/*N*/ if( !pBookmarks->Count() )
+/*N*/ delete pBookmarks, pBookmarks = NULL;
+/*N*/ ASSERT( !pMarks || pMarks->Count(),
+/*N*/ "Marks-Array haette nicht angelegt werden muessen" );
+/*N*/ if( pMarks && !pMarks->Count() )
+/*?*/ delete pMarks, pMarks = NULL;
+/*N*/ }
+
+// Eine Mark einlesen
+
+/*N*/ void Sw3IoImp::InNodeMark( const SwNodeIndex& rPos, xub_StrLen nCntntOff )
+/*N*/ {
+/*N*/ OpenRec( SWG_MARK );
+/*N*/ sal_uInt8 cType;
+/*N*/ sal_uInt16 nId, nOff;
+/*N*/ *pStrm >> cType >> nId >> nOff;
+/*N*/ CloseRec( SWG_MARK );
+/*N*/
+/*N*/ SwIndex aOff( rPos.GetNode().GetCntntNode(), nCntntOff + nOff );
+/*N*/ if( cType < SW3_BOOK_POINT )
+/*N*/ {
+/*N*/ ASSERT( pTOXs && nId < pTOXs->Count(), "invalid TOX id" );
+/*N*/ if( pTOXs && nId < pTOXs->Count() )
+/*N*/ pTOXs->GetObject( nId )->SetNodeIdx( rPos );
+/*N*/ }
+/*N*/ else if( cType < SW3_REDLINE_START)
+/*N*/ {
+/*N*/ SwBookmark* pBook = 0;
+/*N*/ if( pBookmarks && nId < pBookmarks->Count() )
+/*N*/ pBook = pBookmarks->GetObject( nId );
+/*N*/ ASSERT( pBook, "Ungueltige text::Bookmark-ID" );
+/*N*/
+/*N*/ if( pBook )
+/*N*/ {
+/*N*/ switch( cType )
+/*N*/ {
+/*N*/ case SW3_BOOK_POINT:
+/*N*/ {
+/*N*/ delete pBook->pPos1;
+/*N*/ pBook->pPos1 = new SwPosition( rPos, aOff );
+/*N*/
+/*N*/ // Da dies die Sort Order durcheinander bringt,
+/*N*/ // die text::Bookmark neu einsortieren!
+/*N*/ SwBookmarks& rMarks = (SwBookmarks&) pDoc->GetBookmarks();
+/*N*/
+/*N*/ // JP 19.07.95: das Suchen machen wir ueber den Pointer!!
+/*N*/ // ansonsten muss es vorm setzen der neue
+/*N*/ // Position erfolgen !! (SortArray!!!!!)
+/*N*/ const SwBookmarkPtr* ppMarks = rMarks.GetData();
+/*N*/ for( sal_uInt16 nCnt = rMarks.Count(); nCnt; --nCnt, ++ppMarks )
+/*N*/ if( *ppMarks == pBook )
+/*N*/ {
+/*N*/ rMarks.Remove( rMarks.Count() - nCnt );
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ rMarks.Insert( pBook );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SW3_BOOK_MARK:
+/*?*/ delete pBook->pPos2;
+/*?*/ pBook->pPos2 = new SwPosition( rPos, aOff );
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ Warning();
+/*N*/ }
+/*N*/ }
+
+// Die Marks eines Nodes schreiben
+
+/*N*/ void Sw3IoImp::OutNodeMarks( ULONG nIdx )
+/*N*/ {
+/*N*/ if(pMarks )
+/*N*/ {
+/*N*/ for( sal_uInt16 nPos = 0; nPos < pMarks->Count(); ++nPos )
+/*N*/ {
+/*N*/ Sw3Mark *pMark = (*pMarks)[ nPos ];
+/*N*/ if( pMark->GetNodePos() == nIdx )
+/*N*/ {
+/*N*/ OpenRec( SWG_MARK );
+/*N*/ xub_StrLen nOffs = pMark->GetNodeOff();
+/*N*/ if( nOffs > STRING_MAXLEN52 )
+/*N*/ nOffs = STRING_MAXLEN52;
+/*N*/ *pStrm << (sal_uInt8) pMark->GetType()
+/*N*/ << (sal_uInt16) pMark->GetId()
+/*N*/ << (sal_uInt16) nOffs;
+/*N*/ CloseRec( SWG_MARK );
+/*N*/ pMarks->Remove( nPos-- );
+/*N*/ delete pMark;
+/*N*/ if( !pMarks->Count() )
+/*N*/ {
+/*N*/ delete pMarks;
+/*N*/ pMarks = NULL;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pMark->GetNodePos() > nIdx )
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+// text::Bookmark einlesen
+
+/*N*/ void Sw3IoImp::InBookmarks()
+/*N*/ {
+/*N*/ ASSERT( !pBookmarks || IsVersion(SWG_SVXMACROS),
+/*N*/ "Frueher standen text::Bookmarks doch nur in einem Stream???" )
+/*N*/ if( pBookmarks )
+/*N*/ {
+/*?*/ delete pBookmarks;
+/*?*/ pBookmarks = 0;
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_BOOKMARKS );
+/*N*/ // Die Mark erst einmal an den Anfang setzen
+/*N*/ SwPaM aPaM( pDoc->GetNodes().GetEndOfPostIts() );
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ String aShortName, aName;
+/*N*/ OpenRec( SWG_BOOKMARK );
+/*N*/ InString( *pStrm, aShortName );
+/*N*/ InString( *pStrm, aName );
+/*N*/ OpenFlagRec();
+/*N*/ sal_uInt16 nOffset, nKey, nMod;
+/*N*/ *pStrm >> nOffset >> nKey >> nMod;
+/*N*/ CloseFlagRec();
+/*N*/ SwBookmarkPtr pMark = NULL;
+/*N*/
+/*N*/ // Gibt es die Marke bereits (tw. fix 23304) ?
+/*N*/ if( bInsert && pDoc->FindBookmark( aName ) != USHRT_MAX )
+/*?*/ pDoc->MakeUniqueBookmarkName( aName );
+/*N*/
+/*N*/ pMark = pDoc->MakeBookmark( aPaM, KeyCode( nKey, nMod ),
+/*N*/ aName, aShortName );
+/*N*/ if( pMark )
+/*N*/ {
+/*N*/ // JP 10.12.96: die Macros an den text::Bookmarks koennen von der
+/*N*/ // UI nirgends gesetzt/angefragt werden. Darum
+/*N*/ // werden sie auch nicht um den ScriptType erweitert!
+/*N*/ String aMac, aLib;
+/*N*/
+/*N*/ InString( *pStrm, aMac );
+/*N*/ InString( *pStrm, aLib );
+/*N*/ SvxMacro aStart( aMac, aLib, STARBASIC );
+/*N*/ pMark->SetStartMacro( aStart );
+/*N*/
+/*N*/ InString( *pStrm, aMac );
+/*N*/ InString( *pStrm, aLib );
+/*N*/ SvxMacro aEnd( aMac, aLib, STARBASIC );
+/*N*/ pMark->SetEndMacro( aEnd );
+/*N*/ }
+/*N*/ CloseRec( SWG_BOOKMARK );
+/*N*/ // Und fuer die Mark-Records merken. NULL bedeutet, dass
+/*N*/ // die text::Bookmark eine Dublette war und fortfaellt.
+/*N*/ if( !pBookmarks )
+/*N*/ pBookmarks = new Sw3Bookmarks;
+/*N*/ pBookmarks->Insert( pMark, pBookmarks->Count() );
+/*N*/ }
+/*N*/ CloseRec( SWG_BOOKMARKS );
+/*N*/ }
+
+// String Kurzname
+// String voller Name
+// sal_uInt8 Flags
+// sal_uInt16 Offset
+// sal_uInt16 KeyCode
+// sal_uInt16 Modifier
+// String Name des Startmakros
+// String Lib des Startmakros
+// String Name des Endmakros
+// String Lib des Endmakros
+
+/*N*/ void Sw3IoImp::OutBookmarks( sal_Bool bPageStyles )
+/*N*/ {
+/*N*/ ASSERT( bPageStyles || !IsSw31Export(),
+/*N*/ "Beim 3.1-Export kommen keine text::Bookmarks in den Contents-Stream" );
+/*N*/
+/*N*/ short nArrLen = pBookmarks ? pBookmarks->Count() : 0;
+/*N*/ if( nArrLen && bPageStyles && !IsSw31Export() )
+/*N*/ {
+/*N*/ ASSERT( nCntntBkmkStart <= nArrLen,
+/*N*/ "Mehr text::Bookmarks in Page-Styles als ueberhaupt vorhanden?" );
+/*N*/ nArrLen = nCntntBkmkStart;
+/*N*/ nCntntBkmkStart = 0;
+/*N*/ }
+/*N*/ ASSERT( IsSw31Export() || nCntntBkmkStart==0,
+/*N*/ "Wieso sind da noch text::Bookmarks aus Seitenvorlagen?" );
+/*N*/
+/*N*/ if( nArrLen )
+/*N*/ {
+/*N*/ OpenRec( SWG_BOOKMARKS );
+/*N*/ for( int i = 0; i < nArrLen; i++ )
+/*N*/ {
+/*N*/ SwBookmark& rMark = (SwBookmark&) *(*pBookmarks)[i];
+/*N*/ ASSERT( rMark.IsBookMark(),
+/*N*/ "Wo kommt da die Nicht text::Bookmark her?" )
+/*N*/
+/*N*/ const SvxMacro& rStt = rMark.GetStartMacro();
+/*N*/ const SvxMacro& rEnd = rMark.GetEndMacro();
+/*N*/ OpenRec( SWG_BOOKMARK );
+/*N*/ OutString( *pStrm, rMark.GetShortName() );
+/*N*/ OutString( *pStrm, rMark.GetName() );
+/*N*/ *pStrm << (BYTE) 0x06
+/*N*/ << (sal_uInt16) 0 // frueher: Position, jetzt frei
+/*N*/ << (sal_uInt16) rMark.GetKeyCode().GetCode()
+/*N*/ << (sal_uInt16) rMark.GetKeyCode().GetModifier();
+/*N*/ // JP 10.12.96: die Macros an den text::Bookmarks koennen
+/*N*/ // von der UI nirgends gesetzt/abgefragt
+/*N*/ // werden. Darum werden sie auch nicht
+/*N*/ // um den ScriptType erweitert!
+/*N*/ OutString( *pStrm, rStt.GetMacName() );
+/*N*/ OutString( *pStrm, rStt.GetLibName() );
+/*N*/ OutString( *pStrm, rEnd.GetMacName() );
+/*N*/ OutString( *pStrm, rEnd.GetLibName() );
+/*N*/ CloseRec( SWG_BOOKMARK );
+/*N*/ }
+/*N*/ CloseRec( SWG_BOOKMARKS );
+/*N*/
+/*N*/ // Wenn die text::Bookmarks fuer Page-Styles geschrienen sind, werden
+/*N*/ // sie geloescht
+/*N*/ if( bPageStyles && !IsSw31Export() )
+/*?*/ pBookmarks->Remove( 0, nArrLen );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InTOXs51()
+/*N*/ {
+/*N*/ OpenRec( SWG_TOXDESCS51 );
+/*N*/
+/*N*/ // Die Mark erst einmal an den Anfang setzen
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ OpenRec( SWG_TOXDESC );
+/*N*/ String aTypeName, aTitle;
+/*N*/ sal_uInt16 nStrIdx = IDX_NO_VALUE;
+/*N*/ if( IsVersion( SWG_LONGIDX ) )
+/*N*/ *pStrm >> nStrIdx;
+/*N*/ else
+/*N*/ InString( *pStrm, aTypeName );
+/*N*/
+/*N*/ InString( *pStrm, aTitle );
+/*N*/ sal_uInt8 cFlags = OpenFlagRec();
+/*N*/ sal_Int16 nCreateType;
+/*N*/ sal_uInt16 nFirstTabPos = 0;
+/*N*/ BYTE cType;
+/*N*/ *pStrm >> nCreateType
+/*N*/ >> cType;
+/*N*/
+/*N*/ if( IsVersion(SWG_TOXTABS) && (cFlags & 0x10) != 0 )
+/*?*/ *pStrm >> nFirstTabPos;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ TOXTypes eTOXType = (TOXTypes) cType;
+/*N*/
+/*N*/ // Wenn keine Name da ist, dann handelt es sich um
+/*N*/ // das Standard-Verzeichnis des entsprechenden Typs. Der
+/*N*/ // (internationalisierte) Name wird dann gesetzt.
+/*N*/ if( IDX_NO_VALUE != nStrIdx )
+/*?*/ aTypeName = aStringPool.Find( nStrIdx );
+/*N*/ else if( !aTypeName.Len() )
+/*N*/ aTypeName = SwTOXBase::GetTOXName( eTOXType );
+/*N*/
+/*N*/ // nach dem TOXType suchen
+/*N*/ sal_uInt16 nTOXType = pDoc->GetTOXTypeCount( eTOXType );
+/*N*/ const SwTOXType* pTOXType = NULL;
+/*N*/ for( sal_uInt16 n = 0; n < nTOXType; n++ )
+/*N*/ {
+/*N*/ const SwTOXType* p = pDoc->GetTOXType( eTOXType, n );
+/*N*/ if( p->GetTypeName() == aTypeName )
+/*N*/ {
+/*N*/ pTOXType = p; break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Falls nicht vorhanden, am Dokument einfuegen
+/*N*/ if( !pTOXType )
+/*N*/ {
+/*N*/ pDoc->InsertTOXType( SwTOXType ( eTOXType, aTypeName ) );
+/*N*/ pTOXType = pDoc->GetTOXType( eTOXType, nTOXType );
+/*N*/ }
+/*N*/ // Die SwForm einlesen
+/*N*/ SwForm aForm( cType );
+/*N*/
+/*N*/ sal_Bool bSetTabs = IsVersion(SWG_TOXTABS);
+/*N*/ aForm.SetGenerateTabPos( bSetTabs && (cFlags & 0x20) != 0 );
+/*N*/ aForm.SetRelTabPos( bSetTabs && (cFlags & 0x40) != 0 );
+/*N*/
+/*N*/ sal_uInt8 nPat, nTmpl;
+/*N*/ *pStrm >> nPat;
+ sal_uInt16 i=0;
+/*N*/ for( i = 0; Good() && i < nPat; i++ )
+/*N*/ {
+/*N*/ String aText;
+/*N*/ InString( *pStrm, aText );
+/*N*/ if( i < aForm.GetFormMax() )
+/*N*/ {
+/*N*/ if( aText.Len() )
+/*N*/ aText = SwForm::ConvertPatternFrom51(aText, eTOXType);
+/*N*/ aForm.SetPattern( i, aText );
+/*N*/ }
+/*N*/ else if( IsVersion(SWG_LONGIDX) ||
+/*N*/ TOX_INDEX != eTOXType ||
+/*N*/ i != OLD_MAXLEVEL )
+/*N*/ {
+/*N*/ // In aelteren Versionen wurden bei Stichwort-
+/*N*/ // Verzeichnissen ein Eintrag zu viel geschrieben.
+/*?*/ Warning();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ *pStrm >> nTmpl;
+/*N*/ for( i = 0; Good() && i < nTmpl; i++ )
+/*N*/ {
+/*N*/ sal_uInt16 nStrIdx;
+/*N*/ *pStrm >> nStrIdx;
+/*N*/ if( i < aForm.GetFormMax() )
+/*N*/ {
+/*N*/ String sNm( aStringPool.Find( nStrIdx ) );
+/*N*/ if( !sNm.Len() )
+/*N*/ {
+/*N*/ // Bug 37672: falls keiner gefunden wird, nehme
+/*N*/ // die defaults
+/*N*/ sal_uInt16 nPoolIdOffset = 0;
+/*N*/ switch( cType )
+/*N*/ {
+/*N*/ case TOX_INDEX:
+/*N*/ nPoolIdOffset = RES_POOLCOLL_TOX_IDXH -
+/*N*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*N*/ break;
+/*N*/ case TOX_CONTENT:
+/*N*/ if( 6 > i )
+/*N*/ nPoolIdOffset = RES_POOLCOLL_TOX_CNTNTH -
+/*N*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*N*/ else
+/*N*/ nPoolIdOffset = RES_POOLCOLL_TOX_CNTNT6 - 6 -
+/*N*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*N*/ break;
+/*N*/ case TOX_USER:
+/*N*/ nPoolIdOffset = RES_POOLCOLL_TOX_USERH -
+/*N*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ sNm = *SwStyleNameMapper::GetRegisterUINameArray()[ nPoolIdOffset + i ];
+/*N*/ }
+/*N*/ aForm.SetTemplate( i, sNm );
+/*N*/ }
+/*N*/ else if( IsVersion(SWG_LONGIDX) ||
+/*N*/ TOX_INDEX != eTOXType ||
+/*N*/ i != OLD_MAXLEVEL )
+/*N*/ {
+/*N*/ Warning();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ // SetFirstTabPos modifies the patterns
+/*N*/ // TODO:.is code that OK?
+/*N*/ if( bSetTabs && (cFlags & 0x10) != 0 )
+/*?*/ aForm.SetFirstTabPos( nFirstTabPos );
+/*N*/ else
+/*N*/ //fill tab stop positions into the patterns
+/*N*/ aForm.AdjustTabStops(*pDoc);
+/*N*/
+/*N*/ sal_uInt16 nInf;
+/*N*/ *pStrm >> nInf;
+/*N*/ Sw3TOXBase *pTOX = new Sw3TOXBase( pTOXType, aForm, nCreateType,
+/*N*/ aTitle );
+/*N*/ switch( cType )
+/*N*/ {
+/*N*/ case TOX_INDEX:
+/*N*/ pTOX->SetOptions( nInf );
+/*N*/ break;
+/*N*/ case TOX_CONTENT:
+/*N*/ if( nInf > MAXLEVEL )
+/*N*/ nInf = MAXLEVEL;
+/*N*/ pTOX->SetLevel( nInf );
+/*N*/ break;
+/*N*/ case TOX_USER:
+/*N*/ {
+/*N*/ String sNm( aStringPool.Find( nInf ) );
+/*N*/ if( !sNm.Len() )
+/*N*/ // Bug 37672: falls keiner gefunden wird, nehme
+/*N*/ // irgendeinen, also Abbildung
+/*N*/ sNm = *SwStyleNameMapper::GetExtraUINameArray()[ RES_POOLCOLL_LABEL_ABB
+/*N*/ - RES_POOLCOLL_EXTRA_BEGIN ];
+/*N*/ // TODO: Does SetTemplateName what it should do?
+/*N*/ pTOX->SetTemplateName( sNm );
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_TOXDESC );
+/*N*/ if( !Good() )
+/*N*/ break;
+/*N*/
+/*N*/ if( !pTOXs )
+/*N*/ pTOXs = new Sw3TOXs;
+/*N*/ pTOXs->C40_INSERT( Sw3TOXBase, pTOX, pTOXs->Count() );
+/*N*/ }
+/*N*/ CloseRec( SWG_TOXDESCS51 );
+/*N*/ }
+
+
+/*N*/ void Sw3IoImp::OutTOXs51()
+/*N*/ {
+/*N*/ const SwSectionFmts& rSectFmts = pDoc->GetSections();
+/*N*/
+/*N*/ sal_Bool bTOXs = sal_False;
+/*N*/ for( sal_uInt16 nFmt=0; nFmt<rSectFmts.Count(); nFmt++ )
+/*N*/ {
+/*N*/ const SwSectionFmt* pSectFmt = rSectFmts[nFmt];
+/*N*/
+/*N*/ // Skip TOXs that are somehow incomplete.
+/*N*/ const SwSection* pSect = pSectFmt->GetSection();
+/*N*/ if( !pSect || TOX_CONTENT_SECTION != pSect->GetType() )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwSectionNode *pSectNd = pSectFmt->GetSectionNode();
+/*N*/ if( !pSectNd )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwTOXBaseSection *pTOXBaseSect =
+/*N*/ PTR_CAST( SwTOXBaseSection, pSect );
+/*N*/ if( !pTOXBaseSect )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwTOXType* pType = pTOXBaseSect->GetTOXType();
+/*N*/ if( !pType )
+/*N*/ continue;
+/*N*/
+/*N*/ if( !bTOXs )
+/*N*/ {
+/*N*/ OpenRec( SWG_TOXDESCS51 );
+/*N*/ bTOXs = sal_True;
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_TOXDESC );
+/*N*/
+/*N*/ // If it is one of the predefined indexes, its name isn't exported.
+/*N*/ // This way, the index is found in foreign version, too.
+/*N*/ TOXTypes eType = pType->GetType();
+/*N*/ TOXTypes eOldType = eType >= TOX_ILLUSTRATIONS ? TOX_USER : eType;
+/*N*/ const String& rTypeName = pType->GetTypeName();
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ OutString( *pStrm, rTypeName );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // All types above TOX_USER are new in version 5.2. That for,
+/*N*/ // their names must be written.
+/*N*/ sal_uInt16 nStrIdx =
+/*N*/ ( eType >= TOX_ILLUSTRATIONS ||
+/*N*/ rTypeName != SwTOXBase::GetTOXName(eType) )
+/*N*/ ? aStringPool.Find( rTypeName, USHRT_MAX )
+/*N*/ : IDX_NO_VALUE;
+/*N*/ *pStrm << nStrIdx;
+/*N*/ }
+/*N*/
+/*N*/ OutString( *pStrm, pTOXBaseSect->GetTitle() );
+/*N*/
+/*N*/ const SwForm& rFrm = pTOXBaseSect->GetTOXForm();
+/*N*/
+/*N*/ sal_uInt8 cFlags = 0x03; // Anzahl Datenbytes
+/*N*/ if( !IsSw31Or40Export() )
+/*N*/ {
+/*N*/ if( rFrm.IsFirstTabPosFlag() )
+/*N*/ cFlags += 0x12;
+/*N*/ if( rFrm.IsGenerateTabPos() )
+/*N*/ cFlags += 0x20;
+/*N*/ if( rFrm.IsRelTabPos() )
+/*N*/ cFlags += 0x40;
+/*N*/ }
+/*N*/
+/*N*/ // TODO: Must some flags be masked out?
+/*N*/ sal_uInt16 nCreateType = pTOXBaseSect->GetCreateType();
+/*N*/ if( eType >= TOX_ILLUSTRATIONS )
+/*N*/ nCreateType |= TOX_TEMPLATE;
+/*N*/ *pStrm << (sal_uInt8) cFlags
+/*N*/ << (sal_Int16) nCreateType
+/*N*/ << (BYTE) eOldType;
+/*N*/ if( (cFlags & 0x10) != 0 )
+/*N*/ *pStrm << (sal_uInt16)rFrm.GetFirstTabPos();
+/*N*/
+/*N*/ // Die SwForm ausgeben
+/*N*/ // Zaehlen der Patterns und Templates
+/*N*/ sal_uInt16 nPat = 0, nTmpl = 0;
+/*N*/ sal_uInt16 nCount = rFrm.GetFormMax();
+/*N*/ if( IsSw31Or40Export() && nCount > OLD_MAXLEVEL+1 )
+/*N*/ nCount = OLD_MAXLEVEL+1;
+/*N*/ else if( TOX_AUTHORITIES == eType && nCount > MAXLEVEL+1 )
+/*N*/ nCount = MAXLEVEL+1;
+/*N*/
+ sal_uInt16 i=0;
+/*N*/ for( i = nCount; i > 0; i-- )
+/*N*/ {
+/*N*/ if( rFrm.GetPattern( i - 1 ).Len() )
+/*N*/ {
+/*N*/ nPat = i; break;
+/*N*/ }
+/*N*/ }
+/*N*/ for( i = nCount; i > 0; i-- )
+/*N*/ {
+/*N*/ if( rFrm.GetTemplate( i - 1 ).Len() )
+/*N*/ {
+/*N*/ nTmpl = i; break;
+/*N*/ }
+/*N*/ }
+/*N*/ // und die Strings der form ausgeben
+/*N*/ *pStrm << (BYTE) nPat;
+/*N*/ for( i = 0; i < nPat; i++ )
+/*N*/ {
+/*N*/ String aPattern( rFrm.GetPattern(i) );
+/*N*/ if( aPattern.Len() )
+/*N*/ aPattern = SwForm::ConvertPatternTo51( aPattern );
+/*N*/ if( IsSw31Or40Export() && TOX_CONTENT == eType && aPattern.Len() )
+/*N*/ {
+/*N*/ xub_StrLen nENPos =
+/*N*/ aPattern.SearchAscii( SwForm::aFormEntryNum );
+/*N*/ xub_StrLen nETPos =
+/*N*/ aPattern.SearchAscii( SwForm::aFormEntryTxt );
+/*N*/ xub_StrLen nStart = 0, nLen = 0;
+/*N*/
+/*N*/ if( nENPos != STRING_NOTFOUND &&
+/*N*/ (STRING_NOTFOUND == nETPos || nENPos < nETPos) )
+/*N*/ {
+/*N*/ nStart = nENPos;
+/*N*/ nLen = STRING_NOTFOUND == nETPos
+/*N*/ ? SwForm::nFormEntryNumLen
+/*N*/ : (nETPos - nENPos) + SwForm::nFormEntryTxtLen;
+/*N*/ }
+/*N*/ else if( nETPos != STRING_NOTFOUND &&
+/*N*/ (STRING_NOTFOUND == nENPos || nETPos < nENPos) )
+/*N*/ {
+/*N*/ nStart = nETPos;
+/*N*/ nLen = STRING_NOTFOUND == nENPos
+/*N*/ ? SwForm::nFormEntryTxtLen
+/*N*/ : (nENPos - nETPos) + SwForm::nFormEntryNumLen;
+/*N*/ }
+/*N*/
+/*N*/ if( nLen > 0 )
+/*N*/ {
+/*N*/ aPattern.Erase( nStart, nLen );
+/*N*/ aPattern.InsertAscii( SwForm::aFormEntry, nStart );
+/*N*/ }
+/*N*/ }
+/*N*/ OutString( *pStrm, aPattern );
+/*N*/ }
+/*N*/ *pStrm << (BYTE) nTmpl;
+/*N*/ for( i = 0; i < nTmpl; i++ )
+/*N*/ {
+/*N*/ const String& rCollNm = rFrm.GetTemplate( i );
+/*N*/ const SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollNm );
+/*N*/ sal_uInt16 nPId = pColl ? pColl->GetPoolFmtId()
+/*N*/ : SwStyleNameMapper::GetPoolIdFromUIName( rCollNm,GET_POOLID_TXTCOLL );
+/*N*/ *pStrm << (sal_uInt16) aStringPool.Find( rCollNm, nPId );
+/*N*/ }
+/*N*/ // Zuletzt noch die Spezial-Variablen
+/*N*/ sal_uInt16 nInf = 0;
+/*N*/ switch( (int) pType->GetType() )
+/*N*/ {
+/*N*/ case TOX_INDEX:
+/*N*/ // TODO: Must some flags be masked out?
+/*N*/ nInf = pTOXBaseSect->GetOptions();
+/*N*/ break;
+/*N*/ case TOX_CONTENT:
+/*N*/ nInf = pTOXBaseSect->GetLevel();
+/*N*/ if( IsSw31Or40Export() && nInf > OLD_MAXLEVEL )
+/*N*/ nInf = OLD_MAXLEVEL;
+/*N*/ break;
+/*N*/ case TOX_ILLUSTRATIONS:
+/*N*/ case TOX_OBJECTS:
+/*N*/ case TOX_TABLES:
+/*N*/ {
+/*N*/ sal_uInt16 nPoolId;
+/*N*/ switch( pType->GetType() )
+/*N*/ {
+/*?*/ case TOX_ILLUSTRATIONS:
+/*?*/ nPoolId = RES_POOLCOLL_LABEL_ABB;
+/*?*/ break;
+/*?*/ case TOX_OBJECTS:
+/*?*/ nPoolId = RES_POOLCOLL_LABEL_FRAME;
+/*?*/ break;
+/*?*/ case TOX_TABLES:
+/*?*/ nPoolId = RES_POOLCOLL_LABEL_TABLE;
+/*?*/ break;
+/*N*/ }
+/*N*/ String aName;
+/*N*/ SwStyleNameMapper::FillUIName( nPoolId, aName );
+/*N*/ nInf = aStringPool.Find( aName, nPoolId );
+/*N*/ }
+/*N*/ break;
+/*N*/ case TOX_USER:
+/*N*/ case TOX_AUTHORITIES:
+/*N*/ default:
+/*N*/ {
+/*N*/ const String sCollNm = pTOXBaseSect->GetTemplateName();
+/*N*/ if( sCollNm.Len() )
+/*N*/ {
+/*N*/ const SwTxtFmtColl* pColl =
+/*N*/ pDoc->FindTxtFmtCollByName( sCollNm );
+/*N*/ sal_uInt16 nPId = pColl ? pColl->GetPoolFmtId()
+/*N*/ : SwStyleNameMapper::GetPoolIdFromUIName( sCollNm,
+/*N*/ GET_POOLID_TXTCOLL );
+/*N*/ nInf = aStringPool.Find( sCollNm, nPId );
+/*N*/ }
+/*N*/ else
+/*N*/ nInf = IDX_NO_VALUE;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ *pStrm << (sal_uInt16) nInf;
+/*N*/
+/*N*/ CloseRec( SWG_TOXDESC );
+/*N*/ }
+/*N*/
+/*N*/ if( bTOXs )
+/*N*/ CloseRec( SWG_TOXDESCS51 );
+/*N*/ }
+
+extern void lcl_sw3io_FillSetExpFieldName( Sw3IoImp& rIo, sal_uInt16 nStrId,
+ String& rName );
+
+/*N*/ void Sw3IoImp::InTOXs()
+/*N*/ {
+/*N*/ OpenRec( SWG_TOXDESCS );
+/*N*/ // Die Mark erst einmal an den Anfang setzen
+/*N*/ SwPosition aPos( pDoc->GetNodes().GetEndOfPostIts() );
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ OpenRec( SWG_TOXDESC );
+/*N*/
+/*N*/ sal_uInt8 cFlags = OpenFlagRec();
+/*N*/
+/*N*/ sal_uInt16 nType, nCreateType, nCaptionDisplay, nStrIdx, nSeqStrIdx, nData;
+/*N*/ sal_uInt16 nOLEOptions = 0;
+/*N*/ sal_uInt8 cFormFlags;
+/*N*/
+/*N*/ String aTitle, aName, aDummy;
+/*N*/
+/*N*/ *pStrm >> nType
+/*N*/ >> nCreateType
+/*N*/ >> nCaptionDisplay
+/*N*/ >> nStrIdx
+/*N*/ >> nSeqStrIdx
+/*N*/ >> nData
+/*N*/ >> cFormFlags;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ sal_uInt16 nMainStyleIdx = IDX_NO_VALUE;
+/*N*/ InString( *pStrm, aName );
+/*N*/ InString( *pStrm, aTitle );
+/*N*/ if( nVersion < SWG_NEWTOX2 )
+/*N*/ InString( *pStrm, aDummy ); // was AutoMarkURL
+/*N*/ if( IsVersion(SWG_NEWTOX2) )
+/*N*/ {
+/*N*/ *pStrm >> nOLEOptions
+/*N*/ >> nMainStyleIdx;
+/*N*/ }
+/*N*/
+/*N*/ TOXTypes eTOXType = (TOXTypes)nType;
+/*N*/ String aTypeName;
+/*N*/ if( IDX_NO_VALUE != nStrIdx )
+/*?*/ aTypeName = aStringPool.Find( nStrIdx );
+/*N*/ else
+/*N*/ aTypeName = SwTOXBase::GetTOXName( eTOXType );
+/*N*/
+/*N*/ // Search TOX type
+/*N*/ sal_uInt16 nTOXTypes = pDoc->GetTOXTypeCount( eTOXType );
+/*N*/ const SwTOXType* pTOXType = NULL;
+ sal_uInt16 i=0;
+/*N*/ for( i=0; i<nTOXTypes; i++ )
+/*N*/ {
+/*N*/ const SwTOXType* pTmp = pDoc->GetTOXType( eTOXType, i );
+/*N*/ if( pTmp->GetTypeName() == aTypeName )
+/*N*/ {
+/*N*/ pTOXType = pTmp;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // If the TOX type could not be found, it is inserted now.
+/*N*/ if( !pTOXType )
+/*N*/ {
+/*?*/ pDoc->InsertTOXType( SwTOXType ( eTOXType, aTypeName ) );
+/*?*/ pTOXType = pDoc->GetTOXType( eTOXType, nTOXTypes );
+/*N*/ }
+/*N*/
+/*N*/ // form patterns
+/*N*/ SwForm aForm( eTOXType );
+/*N*/
+/*N*/ aForm.SetGenerateTabPos( (cFormFlags & 0x01) != 0 );
+/*N*/ aForm.SetRelTabPos( (cFormFlags & 0x02) != 0 );
+/*N*/ aForm.SetCommaSeparated( (cFormFlags & 0x04) != 0 );
+/*N*/
+/*N*/ sal_uInt8 nPatterns;
+/*N*/ *pStrm >> nPatterns;
+/*N*/ for( i = 0; Good() && i < nPatterns; i++ )
+/*N*/ {
+/*N*/ OpenRec( SWG_FORMPATTERN_LCL );
+/*N*/
+/*N*/ sal_uInt8 nLevel;
+/*N*/ sal_uInt16 nTokens;
+/*N*/
+/*N*/ OpenFlagRec();
+/*N*/ *pStrm >> nLevel
+/*N*/ >> nTokens;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ if( nLevel < aForm.GetFormMax() )
+/*N*/ {
+/*N*/ String aPattern;
+/*N*/ for( sal_uInt16 j=0; Good() && j < nTokens; j++ )
+/*N*/ {
+/*N*/ OpenRec( SWG_FORMTOKEN_LCL );
+/*N*/
+/*N*/ sal_uInt16 nType, nStrIdx;
+/*N*/
+/*N*/ OpenFlagRec();
+/*N*/ *pStrm >> nType
+/*N*/ >> nStrIdx;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ if( nType < TOKEN_END )
+/*N*/ {
+/*N*/ //#92986# some older versions created a
+/*N*/ //wrong content index entry definition
+/*N*/ if(TOKEN_ENTRY == nType && eTOXType == TOX_CONTENT)
+/*N*/ nType = TOKEN_ENTRY_TEXT;
+/*N*/ SwFormToken aToken( (FormTokenType)nType );
+/*N*/ if( IDX_NO_VALUE != nStrIdx )
+/*N*/ {
+/*?*/ aToken.sCharStyleName = aStringPool.Find( nStrIdx );
+/*?*/ aToken.nPoolId = aStringPool.FindPoolId( nStrIdx );
+/*N*/ }
+/*N*/ switch( aToken.eTokenType )
+/*N*/ {
+/*N*/ case TOKEN_TAB_STOP:
+/*N*/ {
+/*N*/ sal_Int32 nTabStopPosition;
+/*N*/ sal_uInt16 nTabAlign;
+/*N*/ *pStrm >> nTabStopPosition
+/*N*/ >> nTabAlign;
+/*N*/ aToken.nTabStopPosition = nTabStopPosition;
+/*N*/ aToken.eTabAlign = nTabAlign;
+/*N*/ if( IsVersion(SWG_TOXTABCHAR) )
+/*N*/ {
+/*N*/ sal_uInt8 cFillChar;
+/*N*/ *pStrm >> cFillChar;
+/*N*/ aToken.cTabFillChar =
+/*N*/ ByteString::ConvertToUnicode( cFillChar,
+/*N*/ eSrcSet );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*?*/ case TOKEN_CHAPTER_INFO:
+/*?*/ {
+/*?*/ sal_uInt16 nChapterFormat;
+/*?*/ *pStrm >> nChapterFormat;
+/*?*/ aToken.nChapterFormat = nChapterFormat;
+/*?*/ }
+/*?*/ break;
+/*?*/ case TOKEN_TEXT:
+/*?*/ InString( *pStrm, aToken.sText );
+/*?*/ break;
+/*?*/ case TOKEN_AUTHORITY:
+/*?*/ {
+/*?*/ sal_uInt16 nAuthorityField;
+/*?*/ *pStrm >> nAuthorityField;
+/*?*/ aToken.nAuthorityField = nAuthorityField;
+/*?*/ }
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ aPattern += aToken.GetString();
+/*N*/ }
+/*N*/ else
+/*?*/ Warning();
+/*N*/
+/*N*/ CloseRec( SWG_FORMTOKEN_LCL );
+/*N*/ }
+/*N*/
+/*N*/ aForm.SetPattern( nLevel, aPattern );
+/*N*/ }
+/*N*/ else
+/*?*/ Warning();
+/*N*/
+/*N*/ CloseRec( SWG_FORMPATTERN_LCL );
+/*N*/ }
+/*N*/
+/*N*/ sal_uInt8 nTemplates;
+/*N*/ *pStrm >> nTemplates;
+/*N*/ for( i = 0; Good() && i < nTemplates; i++ )
+/*N*/ {
+/*N*/ sal_uInt16 nStrIdx;
+/*N*/ *pStrm >> nStrIdx;
+/*N*/ if( i < aForm.GetFormMax() )
+/*N*/ {
+/*N*/ String sNm( aStringPool.Find( nStrIdx ) );
+/*N*/ ASSERT( sNm.Len(), "Template name not found" );
+/*N*/ if( !sNm.Len() )
+/*N*/ {
+/*N*/ // #37672#: if the style has not been found, use the default
+/*?*/ sal_uInt16 nPoolIdOffset = 0;
+/*?*/ sal_uInt16 nOffs = i;
+/*?*/ switch( eTOXType )
+/*?*/ {
+/*?*/ case TOX_INDEX:
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_IDXH -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ break;
+/*?*/ case TOX_CONTENT:
+/*?*/ if( 6 > i )
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_CNTNTH -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ else
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_CNTNT6 - 6 -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ break;
+/*?*/ case TOX_USER:
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_USERH -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ break;
+/*?*/ case TOX_ILLUSTRATIONS:
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_ILLUSH -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ break;
+/*?*/ case TOX_OBJECTS:
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_OBJECTH -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ break;
+/*?*/ case TOX_TABLES:
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_TABLESH -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ break;
+/*?*/ case TOX_AUTHORITIES:
+/*?*/ // There is one text collection for all levels only!
+/*?*/ nPoolIdOffset = RES_POOLCOLL_TOX_AUTHORITIESH -
+/*?*/ RES_POOLCOLL_REGISTER_BEGIN;
+/*?*/ if( nOffs > 1 )
+/*?*/ nOffs = 1;
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*?*/ sNm = *SwStyleNameMapper::GetRegisterUINameArray()[ nPoolIdOffset + nOffs ];
+/*N*/ }
+/*N*/ aForm.SetTemplate( i, sNm );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ Warning();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ Sw3TOXBase *pTOX = new Sw3TOXBase( pTOXType, aForm, nCreateType,
+/*N*/ aTitle );
+/*N*/ pTOX->SetTOXName( aName );
+/*N*/ pTOX->SetCaptionDisplay( (SwCaptionDisplay)nCaptionDisplay );
+/*N*/ pTOX->SetOLEOptions( nOLEOptions );
+/*N*/
+/*N*/ pTOX->SetProtected( (cFlags & 0x10) != 0 );
+/*N*/ pTOX->SetFromChapter( (cFlags & 0x20) != 0 );
+/*N*/ pTOX->SetFromObjectNames( (cFlags & 0x40) != 0 );
+/*N*/ pTOX->SetLevelFromChapter( (cFlags & 0x80) != 0 );
+/*N*/ if( IDX_NO_VALUE != nMainStyleIdx )
+/*?*/ pTOX->SetMainEntryCharStyle( aStringPool.Find( nMainStyleIdx ) );
+/*N*/ if( IDX_NO_VALUE != nSeqStrIdx )
+/*N*/ {
+/*?*/ String aSequenceName;
+/*?*/ lcl_sw3io_FillSetExpFieldName( *this, nSeqStrIdx, aSequenceName );
+/*?*/ pTOX->SetSequenceName( aSequenceName );
+/*N*/ }
+/*N*/
+/*N*/ if( TOX_INDEX == eTOXType )
+/*N*/ pTOX->SetOptions( nData );
+/*N*/ else
+/*N*/ {
+/*N*/ if( nData > MAXLEVEL )
+/*N*/ nData = MAXLEVEL;
+/*N*/ pTOX->SetLevel( nData );
+/*N*/ }
+/*N*/
+/*N*/ sal_uInt8 nStyleNames;
+/*N*/ *pStrm >> nStyleNames;
+/*N*/ for( i=0; i < nStyleNames; i++ )
+/*N*/ {
+/*?*/ sal_uInt8 nLevel;
+/*?*/ sal_uInt16 nCount;
+/*?*/ *pStrm >> nLevel
+/*?*/ >> nCount;
+/*?*/
+/*?*/ String aStyleNames;
+/*?*/ for( sal_uInt16 j=0; j<nCount; j++ )
+/*?*/ {
+/*?*/ String aName;
+/*?*/ *pStrm >> nStrIdx;
+/*?*/ if( IDX_NO_VALUE != nStrIdx )
+/*?*/ {
+/*?*/ aName = aStringPool.Find( nStrIdx );
+/*?*/
+/*?*/ if( aStyleNames.Len() )
+/*?*/ aStyleNames += TOX_STYLE_DELIMITER;
+/*?*/ aStyleNames += aName;
+/*?*/ }
+/*?*/ }
+/*?*/ if( nLevel < aForm.GetFormMax() )
+/*?*/ pTOX->SetStyleNames( aStyleNames, nLevel );
+/*?*/ else
+/*?*/ Warning();
+/*N*/ }
+/*N*/
+/*N*/ // #37672#: every user index must have a style name.
+/*N*/ if( TOX_USER == eTOXType && !pTOX->GetStyleNames(0).Len() )
+/*N*/ {
+/*N*/ String aName = *SwStyleNameMapper::GetExtraUINameArray()[ RES_POOLCOLL_LABEL_ABB
+/*N*/ - RES_POOLCOLL_EXTRA_BEGIN ];
+/*?*/ pTOX->SetStyleNames( aName, 0 );
+/*N*/ }
+/*N*/
+/*N*/ cFlags = OpenFlagRec();
+/*N*/ sal_uInt16 nSectStrIdx;
+/*N*/ *pStrm >> nSectStrIdx;
+/*N*/ pTOX->SetSectFmtStrIdx( nSectStrIdx );
+/*N*/ if( (cFlags & 0x10) != 0 )
+/*N*/ {
+/*N*/ sal_uInt32 nTitleLen;
+/*N*/ *pStrm >> nTitleLen;
+/*N*/ pTOX->SetTitleLen( nTitleLen );
+/*N*/ }
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ if( SWG_SECTFMT == Peek() )
+/*N*/ pTOX->SetSectFmt( (SwSectionFmt*)InFormat( SWG_SECTFMT, NULL ) );
+/*N*/
+/*N*/ if( (cFlags & 0x10) != 0 && SWG_SECTFMT == Peek() )
+/*N*/ pTOX->SetTitleSectFmt( (SwSectionFmt*)InFormat(SWG_SECTFMT,NULL) );
+/*N*/
+/*N*/ CloseRec( SWG_TOXDESC );
+/*N*/
+/*N*/ if( !Good() )
+/*N*/ break;
+/*N*/
+/*N*/ if( !pTOXs )
+/*N*/ pTOXs = new Sw3TOXs;
+/*N*/ pTOXs->C40_INSERT( Sw3TOXBase, pTOX, pTOXs->Count() );
+/*N*/ }
+/*N*/ CloseRec( SWG_TOXDESCS );
+/*N*/ }
+
+extern sal_uInt16 lcl_sw3io_GetSetExpFieldPoolId( const String& rName );
+
+/*N*/ void Sw3IoImp::OutTOXs()
+/*N*/ {
+/*N*/ const SwSectionFmts& rSectFmts = pDoc->GetSections();
+/*N*/
+/*N*/ sal_Bool bTOXs = sal_False;
+/*N*/ for( sal_uInt16 nFmt=0; nFmt<rSectFmts.Count(); nFmt++ )
+/*N*/ {
+/*N*/ const SwSectionFmt* pSectFmt = rSectFmts[nFmt];
+/*N*/
+/*N*/ // Skip TOXs that are somehow incomplete.
+/*N*/ const SwSection* pSect = pSectFmt->GetSection();
+/*N*/ if( !pSect || TOX_CONTENT_SECTION != pSect->GetType() )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwSectionNode *pSectNd = pSectFmt->GetSectionNode();
+/*N*/ if( !pSectNd )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwTOXBaseSection *pTOXBaseSect =
+/*N*/ PTR_CAST( SwTOXBaseSection, pSect );
+/*N*/ if( !pTOXBaseSect )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwTOXType* pType = pTOXBaseSect->GetTOXType();
+/*N*/ if( !pType )
+/*N*/ continue;
+/*N*/
+/*N*/ if( !bTOXs )
+/*N*/ {
+/*N*/ OpenRec( SWG_TOXDESCS );
+/*N*/ bTOXs = sal_True;
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_TOXDESC );
+/*N*/
+/*N*/
+/*N*/ sal_uInt8 cFlags = 0x0d; // Anzahl Datenbytes
+/*N*/ if( pTOXBaseSect->IsProtected() )
+/*N*/ cFlags += 0x10;
+/*N*/ if( pTOXBaseSect->IsFromChapter() )
+/*N*/ cFlags += 0x20;
+/*N*/ if( pTOXBaseSect->IsFromObjectNames() )
+/*N*/ cFlags += 0x40;
+/*N*/ if( pTOXBaseSect->IsLevelFromChapter() )
+/*N*/ cFlags += 0x80;
+/*N*/
+/*N*/ TOXTypes eType = pType->GetType();
+/*N*/
+/*N*/ const SwForm& rForm = pTOXBaseSect->GetTOXForm();
+/*N*/ sal_uInt8 cFormFlags = 0x00;
+/*N*/ if( rForm.IsGenerateTabPos() )
+/*N*/ cFormFlags += 0x01;
+/*N*/ if( rForm.IsRelTabPos() )
+/*N*/ cFormFlags += 0x02;
+/*N*/ if( rForm.IsCommaSeparated() )
+/*N*/ cFormFlags += 0x04;
+/*N*/
+/*N*/ sal_uInt16 nSeqStrIdx = IDX_NO_VALUE;
+/*N*/ const String& rSequenceName = pTOXBaseSect->GetSequenceName();
+/*N*/ if( rSequenceName.Len() )
+/*N*/ {
+/*?*/ SwFieldType *pFldType =
+/*?*/ pDoc->GetFldType( RES_SETEXPFLD, rSequenceName );
+/*?*/ ASSERT( pFldType, "sequence field type not found" );
+/*?*/ if( pFldType )
+/*?*/ {
+/*?*/ sal_uInt16 nPoolId = lcl_sw3io_GetSetExpFieldPoolId(rSequenceName);
+/*?*/ nSeqStrIdx = aStringPool.Find( rSequenceName, nPoolId );
+/*?*/ ASSERT( IDX_NO_VALUE != nSeqStrIdx,
+/*?*/ "no string pool entry found for sequence field" );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // If it is one of the predefined indexes, its name isn't exported.
+/*N*/ // This way, the index is found in foreign version, too.
+/*N*/ const String& rTypeName = pType->GetTypeName();
+/*N*/ sal_uInt16 nStrIdx = rTypeName != SwTOXBase::GetTOXName(eType)
+/*N*/ ? aStringPool.Find( rTypeName, USHRT_MAX )
+/*N*/ : IDX_NO_VALUE;
+/*N*/
+/*N*/ // Options or Level;
+/*N*/ sal_uInt16 nData = 0;
+/*N*/ if( TOX_INDEX == eType )
+/*N*/ nData = pTOXBaseSect->GetOptions();
+/*N*/ else
+/*N*/ nData = pTOXBaseSect->GetLevel();
+/*N*/
+/*N*/ *pStrm << cFlags
+/*N*/ << (sal_uInt16) eType
+/*N*/ << (sal_uInt16) pTOXBaseSect->GetCreateType()
+/*N*/ << (sal_uInt16) pTOXBaseSect->GetCaptionDisplay()
+/*N*/ << nStrIdx
+/*N*/ << nSeqStrIdx
+/*N*/ << nData
+/*N*/ << cFormFlags;
+/*N*/
+/*N*/ sal_uInt16 nMainStyleIdx = IDX_NO_VALUE;
+/*N*/ const String& rMainStyle = pTOXBaseSect->GetMainEntryCharStyle();
+/*N*/ if( rMainStyle.Len() )
+/*N*/ {
+/*?*/ sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( rMainStyle, GET_POOLID_CHRFMT );
+/*?*/ nMainStyleIdx = aStringPool.Find( rMainStyle, nPoolId );
+/*N*/ }
+/*N*/
+/*N*/ OutString( *pStrm, pTOXBaseSect->GetTOXName() );
+/*N*/ OutString( *pStrm, pTOXBaseSect->GetTitle() );
+/*N*/ *pStrm << (sal_uInt16) pTOXBaseSect->GetOLEOptions()
+/*N*/ << (sal_uInt16) nMainStyleIdx;
+/*N*/
+/*N*/ // form patterns
+/*N*/ sal_uInt8 nPatterns = 0, i;
+/*N*/ for( i = (sal_uInt8)rForm.GetFormMax(); i > 0; i-- )
+/*N*/ {
+/*N*/ if( rForm.GetPattern( i-1 ).Len() )
+/*N*/ {
+/*N*/ nPatterns = i;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ *pStrm << (sal_uInt8)nPatterns;
+/*N*/ for( i = 0; i < nPatterns; i++ )
+/*N*/ {
+/*N*/ OpenRec( SWG_FORMPATTERN_LCL );
+/*N*/ *pStrm << (sal_uInt8)0x03 // flag byte
+/*N*/ << (sal_uInt8)i;
+/*N*/
+/*N*/ sal_uInt16 nToken = 0;
+/*N*/ const String& rPattern = rForm.GetPattern( i );
+/*N*/ if( rPattern.Len() )
+/*N*/ {
+/*N*/ OpenValuePos16( nToken );
+/*N*/
+/*N*/ SwFormTokenEnumerator aEnum( rPattern );
+/*N*/ while( aEnum.HasNextToken() )
+/*N*/ {
+/*N*/ SwFormToken aToken( aEnum.GetNextToken() );
+/*N*/
+/*N*/ OpenRec( SWG_FORMTOKEN_LCL );
+/*N*/ sal_uInt16 nStrIdx = IDX_NO_VALUE;
+/*N*/ if( aToken.sCharStyleName.Len() )
+/*N*/ nStrIdx = aStringPool.Find( aToken.sCharStyleName,
+/*N*/ aToken.nPoolId );
+/*N*/ *pStrm << (sal_uInt8)0x04
+/*N*/ << (sal_uInt16)aToken.eTokenType
+/*N*/ << nStrIdx;
+/*N*/ switch( aToken.eTokenType )
+/*N*/ {
+/*N*/ case TOKEN_TAB_STOP:
+/*N*/ *pStrm << (sal_Int32)aToken.nTabStopPosition
+/*N*/ << (sal_uInt16)aToken.eTabAlign
+/*N*/ << (sal_uInt8)aToken.cTabFillChar;
+/*N*/ break;
+/*?*/ case TOKEN_CHAPTER_INFO:
+/*?*/ *pStrm << (sal_uInt16)aToken.nChapterFormat;
+/*?*/ break;
+/*?*/ case TOKEN_TEXT:
+/*?*/ OutString( *pStrm, aToken.sText );
+/*?*/ break;
+/*?*/ case TOKEN_AUTHORITY:
+/*?*/ *pStrm << (sal_uInt16)aToken.nAuthorityField;
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_FORMTOKEN_LCL );
+/*N*/
+/*N*/ nToken++;
+/*N*/ }
+/*N*/
+/*N*/ CloseValuePos16( nToken );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ *pStrm << (sal_uInt16)0;
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_FORMPATTERN_LCL );
+/*N*/ }
+/*N*/
+/*N*/ // form templates
+/*N*/ sal_uInt8 nTemplates = 0;
+/*N*/ for( i = (sal_uInt8)rForm.GetFormMax(); i > 0; i-- )
+/*N*/ {
+/*N*/ if( rForm.GetTemplate( i-1 ).Len() )
+/*N*/ {
+/*N*/ nTemplates = i;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ *pStrm << (sal_uInt8) nTemplates;
+/*N*/ for( i = 0; i < nTemplates; i++ )
+/*N*/ {
+/*N*/ const String& rCollNm = rForm.GetTemplate( i );
+/*N*/ const SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollNm );
+/*N*/ sal_uInt16 nPId = pColl ? pColl->GetPoolFmtId()
+/*N*/ : SwStyleNameMapper::GetPoolIdFromUIName( rCollNm,GET_POOLID_TXTCOLL );
+/*N*/ *pStrm << (sal_uInt16) aStringPool.Find( rCollNm, nPId );
+/*N*/ }
+/*N*/
+/*N*/ // style names
+/*N*/ sal_uInt8 nStyleNames = 0;
+/*N*/ for( i=0; i<MAXLEVEL; i++ )
+/*N*/ {
+/*N*/ if( pTOXBaseSect->GetStyleNames(i).Len() )
+/*N*/ nStyleNames++;
+/*N*/ }
+/*N*/
+/*N*/ *pStrm << nStyleNames;
+/*N*/
+/*N*/ for( i=0; i<MAXLEVEL; i++ )
+/*N*/ {
+/*N*/ const String& rStyleNames = pTOXBaseSect->GetStyleNames(i);
+/*N*/ if( rStyleNames.Len() )
+/*N*/ {
+/*?*/ *pStrm << (sal_uInt8)i
+/*?*/ << (sal_uInt16)rStyleNames.GetTokenCount(
+/*?*/ TOX_STYLE_DELIMITER );
+/*?*/
+/*?*/ xub_StrLen nStrPos = 0;
+/*?*/ while( nStrPos != STRING_NOTFOUND )
+/*?*/ {
+/*?*/ String aName =
+/*?*/ rStyleNames.GetToken( 0, TOX_STYLE_DELIMITER, nStrPos );
+/*?*/ ASSERT( aName.Len(), "empty style name" );
+/*?*/ sal_uInt16 nStrIdx = IDX_NO_VALUE;
+/*?*/ if( aName.Len() )
+/*?*/ {
+/*?*/ const SwTxtFmtColl *pColl =
+/*?*/ pDoc->FindTxtFmtCollByName( aName );
+/*?*/ sal_uInt16 nPoolId = pColl
+/*?*/ ? pColl->GetPoolFmtId()
+/*?*/ : SwStyleNameMapper::GetPoolIdFromUIName( aName, GET_POOLID_TXTCOLL );
+/*?*/ nStrIdx = aStringPool.Find( aName, nPoolId );
+/*?*/ }
+/*?*/
+/*N*/ *pStrm << nStrIdx;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // the following stuff is required to export the TOX sections as
+/*N*/ // TOX range.
+/*N*/ cFlags = 0x02;
+/*N*/ sal_uInt32 nTitleLen = 0UL;
+/*N*/ sal_uInt16 nSectStrIdx = aStringPool.Find( pSectFmt->GetName(),
+/*N*/ pSectFmt->GetPoolFmtId() );
+/*N*/ const SwSectionFmt *pTitleSectFmt = 0;
+/*N*/
+/*N*/ ULONG nNextNdIdx = pSectNd->GetIndex() + 1;
+/*N*/ const SwSectionNode *pNextSectNd =
+/*N*/ pDoc->GetNodes()[nNextNdIdx]->GetSectionNode();
+/*N*/ if( pNextSectNd &&
+/*N*/ TOX_HEADER_SECTION == pNextSectNd->GetSection().GetType() )
+/*N*/ {
+/*N*/ cFlags += 0x14;
+/*N*/ nTitleLen = pNextSectNd->EndOfSectionIndex() - nNextNdIdx - 1;
+/*N*/ pTitleSectFmt = pNextSectNd->GetSection().GetFmt();
+/*N*/ }
+/*N*/
+/*N*/ *pStrm << cFlags
+/*N*/ << nSectStrIdx;
+/*N*/ if( pTitleSectFmt )
+/*N*/ *pStrm << nTitleLen;
+/*N*/
+/*N*/ OutFormat( SWG_SECTFMT, *pSectFmt );
+/*N*/ if( pTitleSectFmt )
+/*N*/ OutFormat( SWG_SECTFMT, *pTitleSectFmt );
+/*N*/
+/*N*/ CloseRec( SWG_TOXDESC );
+/*N*/ }
+/*N*/
+/*N*/ if( bTOXs )
+/*N*/ CloseRec( SWG_TOXDESCS );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::ConnectTOXs()
+/*N*/ {
+/*N*/ if( pTOXs )
+/*N*/ {
+/*N*/ for( sal_uInt16 i=0; i < pTOXs->Count(); i++ )
+/*N*/ {
+/*N*/ // #67763# If, for some reason, a TOX's point or mark have not been
+/*N*/ // read, the TOX has to be skipped.
+/*N*/ Sw3TOXBase *pTOX = (*pTOXs)[i];
+/*N*/ ASSERT( pTOX->GetStartNodeIdx() && pTOX->GetEndNodeIdx(),
+/*N*/ "missing TOX index" );
+/*N*/ if( !(pTOX->GetStartNodeIdx() && pTOX->GetEndNodeIdx()) )
+/*N*/ continue;
+/*N*/
+/*N*/ ASSERT( pTOX->GetStartNodeIdx()->GetIndex() <=
+/*N*/ pTOX->GetEndNodeIdx()->GetIndex(),
+/*N*/ "wrong TOX index order" );
+/*N*/ if( pTOX->GetStartNodeIdx()->GetIndex() >
+/*N*/ pTOX->GetEndNodeIdx()->GetIndex() )
+/*N*/ continue;
+/*N*/
+/*N*/ // Ensure that start and end indices are within the same section.
+/*N*/ // The indices are at content nodes, because they are read at
+/*N*/ // text nodes only.
+/*N*/ if( pTOX->GetStartNodeIdx()->GetNode().FindStartNode() !=
+/*N*/ pTOX->GetEndNodeIdx()->GetNode().FindStartNode() )
+/*N*/ {
+/*N*/ ASSERT( !this, "TOX indices are not within the same section" );
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ // Make TOX name unique.
+/*N*/ const String& rTOXName = pTOX->GetTOXName();
+/*N*/ if( !rTOXName.Len() || bInsert )
+/*N*/ {
+/*N*/ const String *pOldTOXName = rTOXName.Len() ? &rTOXName : 0;
+/*N*/ String aTOXName(
+/*N*/ pDoc->GetUniqueTOXBaseName( *pTOX->GetTOXType(),
+/*N*/ pOldTOXName ) );
+/*N*/ pTOX->SetTOXName( aTOXName );
+/*N*/ }
+/*N*/
+/*N*/ // Insert tox. This inserts a section that has the name of the
+/*N*/ // tox type.
+/*N*/ sal_uInt32 nStartNdIdx = pTOX->GetStartNodeIdx()->GetIndex();
+/*N*/ sal_uInt32 nEndNdIdx = pTOX->GetEndNodeIdx()->GetIndex();
+/*N*/ const SwTOXBaseSection *pSect =
+/*N*/ pDoc->InsertTableOf( nStartNdIdx, nEndNdIdx, *pTOX );
+/*N*/ ASSERT( pSect, "insertion of TOX failed" );
+/*N*/ if( !pSect )
+/*N*/ continue;
+/*N*/
+/*N*/ ASSERT( pSect->GetName() == pTOX->GetTOXName(),
+/*N*/ "tox has wrong name" );
+/*N*/ ASSERT( pSect->GetFmt()->GetSectionNode()->GetIndex() ==
+/*N*/ nStartNdIdx,
+/*N*/ "unexpected tox section start position" );
+/*N*/
+/*N*/ // Copy section format attributes to the new section format.
+/*N*/ // In addition, the section format has to be renamed, because
+/*N*/ // loading the layout requires the frame have the original name.
+/*N*/ SwSectionFmt *pTOXSectFmt = pTOX->GetSectFmt();
+/*N*/ if( pTOXSectFmt )
+/*N*/ {
+/*N*/ SwSectionFmt *pSectFmt = pSect->GetFmt();
+/*N*/ const String& rName = pTOXSectFmt->GetName();
+/*N*/ pSectFmt->SetName( rName );
+/*N*/ pSectFmt->SetAttr( pTOXSectFmt->GetAttrSet() );
+/*N*/
+/*N*/ // If the format has been cached already, the cache entry has
+/*N*/ // to be replaced, too.
+/*N*/ sal_uInt16 nStrIdx = pTOX->GetSectFmtStrIdx();
+/*N*/ ASSERT( IDX_NO_VALUE != nStrIdx, "string pool index missing" );
+/*N*/ if( IDX_NO_VALUE != nStrIdx )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ SwFmt *pTmp = aStringPool.FindCachedFmt( nStrIdx );
+/*N*/ ASSERT( !pTmp || pTmp == (SwFmt *)pTOXSectFmt,
+/*N*/ "wrong format cached?" );
+/*N*/
+/*N*/ #endif
+/*N*/ aStringPool.SetCachedFmt( nStrIdx, pSectFmt );
+/*N*/ }
+/*N*/
+/*N*/ // The loaded format isn't required any longer.
+/*N*/ pDoc->DelSectionFmt( pTOXSectFmt, sal_False );
+/*N*/ pTOX->SetSectFmt( 0 );
+/*N*/ }
+/*N*/
+/*N*/ sal_uInt32 nTitleLen = pTOX->GetTitleLen();
+/*N*/ ASSERT( !nTitleLen || pTOX->GetTitleSectFmt(),
+/*N*/ "missing tox title section format" );
+/*N*/ if( nTitleLen > 0 && pTOX->GetTitleSectFmt() )
+/*N*/ {
+/*N*/ SwNodeIndex aEndNdIdx( *pTOX->GetStartNodeIdx(), nTitleLen-1 );
+/*N*/
+/*N*/ ASSERT( pTOX->GetStartNodeIdx()->GetNode().IsCntntNode(),
+/*N*/ "tox title section start is not a content node" );
+/*N*/ ASSERT( aEndNdIdx.GetNode().IsCntntNode(),
+/*N*/ "tox title section end is not a content node" );
+/*N*/ ASSERT( pTOX->GetStartNodeIdx()->GetIndex() <=
+/*N*/ aEndNdIdx.GetIndex(),
+/*N*/ "invalid TOX title section end" );
+/*N*/
+/*N*/ // insert title section
+/*N*/ if( pTOX->GetStartNodeIdx()->GetNode().IsCntntNode() &&
+/*N*/ aEndNdIdx.GetNode().IsCntntNode() &&
+/*N*/ pTOX->GetStartNodeIdx()->GetIndex()<=aEndNdIdx.GetIndex() )
+/*N*/ {
+/*N*/ String aSectName( pTOX->GetTOXName() );
+/*N*/ aSectName.AppendAscii( "_Head" );
+/*N*/ SwSection aSection( TOX_HEADER_SECTION, aSectName );
+/*N*/
+/*N*/ pDoc->GetNodes().InsertSection( *pTOX->GetStartNodeIdx(),
+/*N*/ *pTOX->GetTitleSectFmt(), aSection, &aEndNdIdx,
+/*N*/ sal_False );
+/*N*/
+/*N*/ // The section format's owner now is the section
+/*N*/ pTOX->SetTitleSectFmt( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ delete pTOXs;
+/*N*/ pTOXs = 0;
+/*N*/ }
+/*N*/ }
+
+// Nicht benutzte Markierungen loeschen
+
+/*N*/ void Sw3IoImp::CleanupMarks()
+/*N*/ {
+/*N*/ sal_uInt16 i = 0;
+/*N*/ const SwBookmarks& rMarks = pDoc->GetBookmarks();
+/*N*/ while( i < rMarks.Count() )
+/*N*/ {
+/*N*/ const SwBookmark* pMark = rMarks.GetObject( i );
+/*N*/ if( &pMark->pPos1->nNode.GetNode() == &pDoc->GetNodes().GetEndOfPostIts() )
+/*?*/ pDoc->DelBookmark( i );
+/*N*/ else
+/*N*/ i++;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InDBName()
+/*N*/ {
+/*N*/ ByteString sStr8;
+/*N*/ String sStr, sSQL;
+/*N*/ SwDBData aData;
+/*N*/ OpenRec( SWG_DBNAME );
+/*N*/
+/*N*/ // MIB 9.4.97: Die Datenbanknamen koennen 0xff enthalten und muessen
+/*N*/ // deshalb von Hand konvertiert werden.
+/*N*/ pStrm->ReadByteString( sStr8 );
+/*N*/ sStr = ConvertStringNoDbDelim( sStr8, eSrcSet );
+/*N*/ aData.sDataSource = sStr.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = sStr.GetToken(1, DB_DELIM);
+/*N*/
+/*N*/ if( IsVersion( SWG_NONUMLEVEL, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ InString( *pStrm, sSQL );
+/*N*/ }
+/*N*/ if( IsVersion( SWG_TARGETFRAME, SWG_EXPORT31 ) )
+/*N*/ {
+/*N*/ // Von der Version SWG_TARGETFRAME bis zur Version SWG_REGISTER
+/*N*/ // stand hier der Default-Target-Frame.
+/*N*/ // Seit der Version SWG_REGISTER steht hier der Tabellenname.
+/*N*/ // Dazwischen wurde ein Leerstring geschrieben.
+/*?*/ String aTableName;
+/*?*/ InString( *pStrm, aTableName );
+/*?*/
+/*?*/ if( nVersion < SWG_REGISTER )
+/*?*/ {
+/*?*/ SfxDocumentInfo aInfo( *pDoc->GetInfo() );
+/*?*/ aInfo.SetDefaultTarget( aTableName );
+/*?*/ pDoc->SetInfo( aInfo );
+/*?*/ }
+/*?*/ else if( nVersion >= SWG_DBTABLE )
+/*?*/ {
+/*?*/ aData.sCommand = aTableName;
+/*?*/ }
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ // Die folgende Tabelle der Datenbanknamen wird schon seit der
+/*N*/ // Version SWG_USEDDB geschrieben, aber nur fuer Doks seit SWG_DBTABLE
+/*N*/ // gelesen, da vorher kein Datenabnkname enthalten war. Auch der
+/*N*/ // DB-Name des Doks ist erst seit dieser Version gueltig. Die
+/*N*/ // Anzahl der Datenbanken lesen wir aber trotzdem, denn sie
+/*N*/ // koennte 0 sein. Dann verliert man keine Informationen und muss
+/*N*/ // auch keine Warnung hierzu bekommen.
+/*N*/ if( IsVersion( SWG_USEDDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ if( sSQL.Len() && nVersion >= SWG_DBTABLE )
+/*N*/ {
+/*?*/ aData.sCommand = sSQL;
+/*?*/ aData.nCommandType = sdb::CommandType::COMMAND;
+/*N*/ }
+/*N*/
+/*N*/ sal_uInt16 nCount;
+/*N*/ *pStrm >> nCount;
+/*N*/ if( nCount>0 && nVersion >= SWG_DBTABLE )
+/*N*/ {
+/*N*/ // MIB 9.4.97: Die Datenbanknamen koennen 0xff enthalten und
+/*N*/ // muessen deshalb von Hand konvertiert werden.
+/*N*/ String sDBName;
+/*N*/ sal_Int32 nSelStart, nSelEnd;
+/*N*/
+/*N*/ SwNewDBMgr& rDBMgr = *pDoc->GetNewDBMgr();
+/*N*/ for( sal_uInt16 i = 0; i < nCount; i++ )
+/*N*/ {
+/*N*/ pStrm->ReadByteString( sStr8 );
+/*N*/ *pStrm >> nSelStart
+/*N*/ >> nSelEnd;
+/*N*/ sDBName = ConvertStringNoDbDelim( sStr8, eSrcSet );
+/*N*/
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = sDBName.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = sDBName.GetToken(1, DB_DELIM);
+/*N*/ aData.nCommandType = -1;
+/*N*/ rDBMgr.AddDSData(aData, nSelStart, nSelEnd );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // sonst zumindest irgendeinen Namen setzen
+/*N*/ aData = pDoc->GetNewDBMgr()->GetAddressDBName();
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_DBNAME );
+/*N*/ pDoc->ChgDBData( aData );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutDBName()
+/*N*/ {
+/*N*/ // Erstmal alle verwendeten Datenbanken holen
+/*N*/ SvStringsDtor aDBNameList;
+/*N*/ pDoc->GetAllUsedDB(aDBNameList);
+/*N*/ sal_uInt16 nCount = aDBNameList.Count();
+/*N*/
+/*N*/ OpenRec( SWG_DBNAME );
+/*N*/
+/*N*/ if( IsSw31Export() )
+/*N*/ {
+/*N*/ // Datenbanknamen und das SQL-Statement holen
+/*N*/ String sDBDesc, sDBName;
+/*N*/ if( nCount==1 && pDoc->GetNewDBMgr() )
+/*N*/ {
+/*N*/ sDBDesc = *aDBNameList.GetObject(0);
+/*N*/ sDBName = sDBDesc;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwDBData aData = pDoc->_GetDBDesc();
+/*N*/ sDBName = aData.sDataSource;
+/*N*/ sDBName += DB_DELIM;
+/*N*/ sDBName += (String)aData.sCommand;
+/*N*/ }
+/*N*/
+/*N*/ OutString( *pStrm, sDBName.GetToken( 0, DB_DELIM ) );
+/*N*/
+/*N*/ String aTmpStr;
+/*N*/ xub_StrLen nPos = 0;
+/*N*/ if( ( nPos = sDBDesc.Search(';') ) != STRING_NOTFOUND )
+/*?*/ aTmpStr = sDBDesc.Copy( nPos + 1 );
+/*N*/ OutString( *pStrm, aTmpStr );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Die Datenbank-Beschreibung koennen wir im 4.0 FF auf einen Schlag
+/*N*/ // rausschreiben
+/*N*/ SwDBData aData = pDoc->_GetDBDesc();
+/*N*/ String sTmpDBName = aData.sDataSource;
+/*N*/ sTmpDBName += DB_DELIM;
+/*N*/ sTmpDBName += (String)aData.sCommand;
+/*N*/ ByteString s8 = ConvertStringNoDbDelim( sTmpDBName, eSrcSet );
+/*N*/ pStrm->WriteByteString( s8 );
+/*N*/
+/*N*/ // Datenbankname, SQL-Statement und aktuelle Selektion abspeichern
+/*N*/ long nSelStart, nSelEnd;
+/*N*/
+/*N*/ *pStrm << nCount;
+/*N*/
+/*N*/ SwNewDBMgr& rDBMgr = *pDoc->GetNewDBMgr();
+/*N*/ for (sal_uInt16 i = 0; i < nCount; i++)
+/*N*/ {
+/*N*/ String sDesc(*aDBNameList.GetObject(i));
+/*N*/ ByteString s8 = ConvertStringNoDbDelim( sDesc, eSrcSet );
+/*N*/ pStrm->WriteByteString( s8 );
+/*N*/
+/*N*/ SwDBData aData;
+/*N*/ aData.sDataSource = sDesc.GetToken(0, DB_DELIM);
+/*N*/ aData.sCommand = sDesc.GetToken(1, DB_DELIM);
+/*N*/ aData.nCommandType = -1;
+/*N*/ rDBMgr.GetDSSelection(aData, nSelStart, nSelEnd);
+/*N*/
+/*N*/ *pStrm << (sal_Int32)nSelStart
+/*N*/ << (sal_Int32)nSelEnd;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_DBNAME );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InDocStat()
+/*N*/ {
+/*N*/ OpenRec( SWG_DOCSTAT );
+/*N*/ SwDocStat aDocStat;
+/*N*/ BYTE c;
+/*N*/ *pStrm >> aDocStat.nTbl
+/*N*/ >> aDocStat.nGrf
+/*N*/ >> aDocStat.nOLE;
+/*N*/
+/*N*/ if( IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ sal_uInt32 nPage, nPara;
+/*N*/ *pStrm >> nPage
+/*N*/ >> nPara;
+/*N*/
+/*N*/ aDocStat.nPage = nPage;
+/*N*/ aDocStat.nPara = nPara;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ sal_uInt16 nPage, nPara;
+/*N*/ *pStrm >> nPage
+/*N*/ >> nPara;
+/*N*/
+/*N*/ aDocStat.nPage = nPage;
+/*N*/ aDocStat.nPara = nPara;
+/*N*/ }
+/*N*/
+/*N*/ sal_uInt32 w;
+/*N*/ *pStrm >> w;
+/*N*/ aDocStat.nWord = w;
+/*N*/ *pStrm >> w;
+/*N*/ aDocStat.nChar = w;
+/*N*/ *pStrm >> c;
+/*N*/
+/*N*/ aDocStat.bModified = c;
+/*N*/
+/*N*/ CloseRec( SWG_DOCSTAT );
+/*N*/ pDoc->SetDocStat( aDocStat );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutDocStat( sal_Bool bFirst )
+/*N*/ {
+/*N*/ sal_uInt32 nAktPos;
+/*N*/ if( bFirst )
+/*N*/ {
+/*N*/ OpenRec( SWG_DOCSTAT );
+/*N*/ nStatStart = pStrm->Tell();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nAktPos = pStrm->Tell();
+/*N*/ pStrm->Seek( nStatStart );
+/*N*/ }
+/*N*/
+/*N*/ const SwDocStat& rDocStat = pDoc->GetDocStat();
+/*N*/ *pStrm << (sal_uInt16)rDocStat.nTbl
+/*N*/ << (sal_uInt16)rDocStat.nGrf
+/*N*/ << (sal_uInt16)rDocStat.nOLE;
+/*N*/
+/*N*/ if( pStrm->GetVersion() <= SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*N*/ *pStrm << (sal_uInt16)rDocStat.nPage
+/*N*/ << (sal_uInt16)rDocStat.nPara;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Die Longs duerfen hier nicht komprimiert geschrieben werden,
+/*N*/ // weil sich dann die Laenge der Dok-Info beim zweiten Schreiben
+/*N*/ // gegenueber dem ersten Schreiben aendern kann.
+/*N*/ *pStrm << (sal_uInt32)rDocStat.nPage
+/*N*/ << (sal_uInt32)rDocStat.nPara;
+/*N*/ }
+/*N*/
+/*N*/ *pStrm << (sal_uInt32)rDocStat.nWord
+/*N*/ << (sal_uInt32)rDocStat.nChar
+/*N*/ << (BYTE)rDocStat.bModified;
+/*N*/
+/*N*/ if( bFirst )
+/*N*/ CloseRec( SWG_DOCSTAT );
+/*N*/ else
+/*N*/ pStrm->Seek( nAktPos );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InDictionary()
+/*N*/ {
+/*N*/ Reference< XDictionaryList > xDicList( ::binfilter::GetDictionaryList() );
+/*N*/ Sequence< Reference< XDictionary > > aDics;
+/*N*/ if( xDicList.is() )
+/*N*/ aDics = xDicList->getDictionaries();
+/*N*/ const Reference< XDictionary > *pDic = aDics.getConstArray();
+/*N*/
+/*N*/ bSpellAllAgain = bSpellWrongAgain = sal_True;
+/*N*/
+/*N*/ sal_uInt16 i, nDicCount = (sal_uInt16)aDics.getLength();
+/*N*/
+/*N*/ sal_Bool *pChecked = nDicCount > 0 ? new sal_Bool[nDicCount] : 0;
+/*N*/ for( i = 0; i < nDicCount; i++ )
+/*N*/ pChecked[ i ] = !pDic[i]->isActive();
+/*N*/
+/*N*/ OpenRec( SWG_DICTIONARY );
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ String aStr;
+/*N*/ sal_uInt16 nLanguage;
+/*N*/ sal_uInt16 nCount;
+/*N*/ BYTE c;
+/*N*/ sal_Bool bNeg;
+/*N*/ InString( *pStrm, aStr );
+/*N*/ *pStrm >> nLanguage
+/*N*/ >> nCount
+/*N*/ >> c;
+/*N*/ bNeg = c;
+/*N*/ sal_Bool bFound = sal_False;
+/*N*/ for( i = 0; !bFound && ( i < nDicCount ); i++ )
+/*N*/ {
+/*N*/ Reference< XDictionary1 > xDic( pDic[i], UNO_QUERY );
+/*N*/ if( xDic.is() && xDic->isActive() )
+/*N*/ bFound = ( aStr == String(xDic->getName()) &&
+/*N*/ nLanguage == xDic->getLanguage() &&
+/*N*/ bNeg == (xDic->getDictionaryType()
+/*N*/ == DictionaryType_NEGATIVE) );
+/*N*/ }
+/*N*/ if( bFound )
+/*N*/ {
+/*N*/ ASSERT( pChecked, "Sw3IoImp::InDictonary: pChecked == 0" );
+/*N*/ sal_uInt16 nCnt = pDic[--i]->getCount();
+/*N*/ pChecked[ i ] = sal_True;
+/*N*/ if( nCnt != nCount )
+/*N*/ {
+/*N*/ if( bNeg || nCnt < nCount )
+/*N*/ bSpellAllAgain = sal_True;
+/*N*/ else
+/*N*/ bSpellWrongAgain = sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( bNeg )
+/*N*/ bSpellWrongAgain = sal_True;
+/*N*/ else
+/*N*/ bSpellAllAgain = sal_True;
+/*N*/ }
+/*N*/ CloseRec( SWG_DICTIONARY );
+/*N*/
+/*N*/ for( i = 0; i < nDicCount; i++ )
+/*N*/ {
+/*N*/ if( !pChecked[ i ] )
+/*N*/ {
+/*N*/ if( pDic[i]->getDictionaryType() == DictionaryType_NEGATIVE )
+/*N*/ bSpellAllAgain = sal_True;
+/*N*/ else
+/*N*/ bSpellWrongAgain =sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ delete[] pChecked;
+/*N*/
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutDictionary()
+/*N*/ {
+/*N*/ OpenRec( SWG_DICTIONARY );
+/*N*/
+/*N*/ Reference< XDictionaryList > xDicList( ::binfilter::GetDictionaryList() );
+/*N*/ Sequence< Reference< XDictionary > > aDics;
+/*N*/ if( xDicList.is() )
+/*N*/ aDics = xDicList->getDictionaries();
+/*N*/ const Reference< XDictionary > *pDic = aDics.getConstArray();
+/*N*/
+/*N*/ sal_uInt16 i, nDicCount = (sal_uInt16)aDics.getLength();
+/*N*/ for( i = 0; i < nDicCount; i++ )
+/*N*/ {
+/*N*/ Reference< XDictionary1 > xDic( pDic[i], UNO_QUERY );
+/*N*/ if( xDic.is() && xDic->isActive() )
+/*N*/ {
+/*N*/ const String aStr( xDic->getName() );
+/*N*/ sal_uInt16 nActLanguage = xDic->getLanguage();
+/*N*/ sal_uInt16 nCount = xDic->getCount();
+/*N*/ sal_Bool bNeg = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
+/*N*/ OutString( *pStrm, aStr );
+/*N*/ *pStrm << (sal_uInt16)nActLanguage
+/*N*/ << (sal_uInt16)nCount
+/*N*/ << (BYTE)bNeg;
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( SWG_DICTIONARY );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutNumberFormatter()
+/*N*/ {
+/*N*/ SvNumberFormatter* pN = pDoc->GetNumberFormatter( sal_False );
+/*N*/ if( pN )
+/*N*/ {
+/*N*/ OpenRec( SWG_NUMBERFORMATTER );
+/*N*/ pN->Save( *pStrm );
+/*N*/ CloseRec( SWG_NUMBERFORMATTER );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InNumberFormatter()
+/*N*/ {
+/*N*/ OpenRec( SWG_NUMBERFORMATTER );
+/*N*/
+/*N*/ if( bInsert || bOrganizer )
+/*N*/ {
+/*?*/ Reference< XMultiServiceFactory > xMSF = ::legacy_binfilters::getLegacyProcessServiceFactory();
+/*?*/ SvNumberFormatter* pN = new SvNumberFormatter( xMSF, LANGUAGE_SYSTEM );
+/*?*/ pN->Load( *pStrm );
+/*?*/ pDoc->GetNumberFormatter( sal_True )->MergeFormatter( *pN );
+/*?*/ delete pN;
+/*N*/ }
+/*N*/ else
+/*N*/ pDoc->GetNumberFormatter( sal_True )->Load( *pStrm );
+/*N*/
+/*N*/ CloseRec( SWG_NUMBERFORMATTER );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InLineNumberInfo()
+/*N*/ {
+/*N*/ OpenRec( SWG_LINENUMBERINFO );
+/*N*/
+/*N*/ sal_uInt8 nType, nPos;
+/*N*/ sal_uInt16 nChrIdx, nPosFromLeft, nCountBy, nDividerCountBy;
+/*N*/ String sDivider;
+/*N*/
+/*N*/ sal_uInt8 cFlags = OpenFlagRec();
+/*N*/ *pStrm >> nType
+/*N*/ >> nPos
+/*N*/ >> nChrIdx
+/*N*/ >> nPosFromLeft
+/*N*/ >> nCountBy
+/*N*/ >> nDividerCountBy;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ InString( *pStrm, sDivider );
+/*N*/
+/*N*/ SwLineNumberInfo aInfo;
+/*N*/
+/*N*/ aInfo.SetPaintLineNumbers( (cFlags & 0x10 ) != 0 );
+/*N*/ aInfo.SetCountBlankLines( (cFlags & 0x20 ) != 0 );
+/*N*/ aInfo.SetCountInFlys( (cFlags & 0x40 ) != 0 );
+/*N*/ aInfo.SetRestartEachPage( (cFlags & 0x80 ) != 0 );
+/*N*/ aInfo.SetPos( (LineNumberPosition)nPos );
+/*N*/
+/*N*/ SvxNumberType aNumType;
+/*N*/ aNumType.SetNumberingType((sal_Int16)nType);
+/*N*/ aInfo.SetNumType( aNumType );
+/*N*/
+/*N*/ if( nChrIdx != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ SwCharFmt *pChrFmt = (SwCharFmt *)FindFmt( nChrIdx, SWG_CHARFMT );
+/*N*/ if( pChrFmt )
+/*N*/ aInfo.SetCharFmt( pChrFmt );
+/*N*/ }
+/*N*/ aInfo.SetPosFromLeft( nPosFromLeft );
+/*N*/ aInfo.SetCountBy( nCountBy );
+/*N*/ aInfo.SetDividerCountBy( nDividerCountBy );
+/*N*/ aInfo.SetDivider( sDivider );
+/*N*/
+/*N*/ pDoc->SetLineNumberInfo( aInfo );
+/*N*/
+/*N*/ CloseRec( SWG_LINENUMBERINFO );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutLineNumberInfo()
+/*N*/ {
+/*N*/ OpenRec( SWG_LINENUMBERINFO );
+/*N*/
+/*N*/ const SwLineNumberInfo& rInfo = pDoc->GetLineNumberInfo();
+/*N*/
+/*N*/ sal_uInt8 cFlags = 0x0a;
+/*N*/ if( rInfo.IsPaintLineNumbers() )
+/*N*/ cFlags += 0x10;
+/*N*/ if( rInfo.IsCountBlankLines() )
+/*N*/ cFlags += 0x20;
+/*N*/ if( rInfo.IsCountInFlys() )
+/*N*/ cFlags += 0x40;
+/*N*/ if( rInfo.IsRestartEachPage() )
+/*N*/ cFlags += 0x80;
+/*N*/
+/*N*/ const SwCharFmt *pCharFmt = (const SwCharFmt *)rInfo.GetRegisteredIn();
+/*N*/ sal_uInt16 nChrIdx = pCharFmt ? aStringPool.Find( pCharFmt->GetName(),
+/*N*/ pCharFmt->GetPoolFmtId() )
+/*N*/ : IDX_NO_VALUE;
+/*N*/
+/*N*/ *pStrm << cFlags
+/*N*/ << (sal_uInt8) rInfo.GetNumType().GetNumberingType()
+/*N*/ << (sal_uInt8) rInfo.GetPos()
+/*N*/ << (sal_uInt16) nChrIdx
+/*N*/ << (sal_uInt16) rInfo.GetPosFromLeft()
+/*N*/ << (sal_uInt16) rInfo.GetCountBy()
+/*N*/ << (sal_uInt16) rInfo.GetDividerCountBy();
+/*N*/ OutString( *pStrm, rInfo.GetDivider() );
+/*N*/
+/*N*/ CloseRec( SWG_LINENUMBERINFO );
+/*N*/ }
+
+
+/*N*/ void Sw3IoImp::InDocDummies()
+/*N*/ {
+/*N*/ OpenRec( SWG_DOCDUMMIES );
+/*N*/
+/*N*/ sal_uInt32 n1, n2;
+/*N*/ sal_uInt8 n3, n4;
+/*N*/ String sAutoMarkURL, s2;
+/*N*/
+/*N*/ *pStrm >> n1 >> n2 >> n3 >> n4;
+/*N*/ InString( *pStrm, sAutoMarkURL );
+/*N*/ InString( *pStrm, s2 );
+/*N*/
+/*N*/ // Das 0. und 1. Bit ist der Link Update-Mode
+/*N*/ sal_uInt16 nUpdMode = MANUAL;
+/*N*/ switch( n3 & 0x03 )
+/*N*/ {
+/*N*/ case 1: nUpdMode = NEVER; break;
+/*N*/ case 2: nUpdMode = AUTOMATIC; break;
+/*N*/ case 3: nUpdMode = GLOBALSETTING; break;
+/*N*/ }
+/*N*/ pDoc->SetLinkUpdMode( nUpdMode );
+/*N*/
+/*N*/ // das 2. Bit verbleibt im Byte-Dummy1
+/*N*/
+/*N*/ // das 3. und 4. Bit ist der Field Update-Mode
+/*N*/ nUpdMode = AUTOUPD_OFF;
+/*N*/ switch( (n3 & 0x18) >> 3 )
+/*N*/ {
+/*N*/ case 0: nUpdMode = AUTOUPD_OFF; break;
+/*N*/ case 1: nUpdMode = AUTOUPD_FIELD_ONLY; break;
+/*N*/ case 2: nUpdMode = AUTOUPD_FIELD_AND_CHARTS; break;
+/*N*/ case 3: nUpdMode = AUTOUPD_GLOBALSETTING; break;
+/*N*/ }
+/*N*/ pDoc->SetFldUpdateFlags( nUpdMode );
+/*N*/
+/*N*/ // Achtung: Das drittunterste Bit 0x04 wird jetzt benutzt
+/*N*/ // als Flag, ob Absatzabstaende addiert oder maximiert werden
+/*N*/ // 0x20 - makes the same at start of doc an at page starts behind page breaks
+/*N*/ n3 &= 0xE4;
+/*N*/
+/*N*/ pDoc->SetULongDummy1( n1 );
+/*N*/ pDoc->SetULongDummy2( n2 );
+/*N*/ pDoc->SetByteDummy1( n3 );
+/*N*/ pDoc->SetByteDummy2( n4 );
+/*N*/ if( sAutoMarkURL.Len() )
+/*?*/ sAutoMarkURL = ::binfilter::StaticBaseUrl::SmartRelToAbs( sAutoMarkURL );
+/*N*/ pDoc->SetTOIAutoMarkURL( sAutoMarkURL );
+/*N*/ pDoc->SetStringDummy2( s2 );
+/*N*/
+/*N*/ CloseRec( SWG_DOCDUMMIES );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutDocDummies()
+/*N*/ {
+/*N*/ OpenRec( SWG_DOCDUMMIES );
+/*N*/
+/*N*/ sal_uInt8 n3 = (sal_uInt8)pDoc->GetByteDummy1();
+/*N*/ // Achtung: Das drittunterste Bit 0x04 wird jetzt benutzt
+/*N*/ // als Flag, ob Absatzabstaende addiert oder maximiert werden
+/*N*/ // 0x20 - makes the same at start of doc an at page starts behind page breaks
+/*N*/ ASSERT( (n3 & 0x03) == 0, "Sw3IoImp::OutDocDummies: byte1 falsch" );
+/*N*/ n3 &= 0xfc;
+/*N*/
+/*N*/ // Der Link-Update-Mode muss noch etwas konvertiert werden, damit
+/*N*/ // der Default-Wert in den Dummies (0) einem MANUAL (1) entspricht
+/*N*/ switch( pDoc->_GetLinkUpdMode() )
+/*N*/ {
+/*N*/ case MANUAL: break;
+/*N*/ case NEVER: n3 |= 0x01; break;
+/*N*/ case AUTOMATIC: n3 |= 0x02; break;
+/*N*/ case GLOBALSETTING: n3 |= 0x03; break;
+/*N*/ default:
+/*N*/ ASSERT( !this, "Sw3IoImp::OutDocDummies: Wert von LinkUpdMode unbek." );
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ // Der Feld-Update-Mode muss noch etwas konvertiert werden, damit
+/*N*/ // der Default-Wert in den Dummies (0) einem OFF entspricht
+/*N*/ switch( pDoc->_GetFldUpdateFlags() )
+/*N*/ {
+/*N*/ case AUTOUPD_OFF: break;
+/*N*/ case AUTOUPD_FIELD_ONLY: n3 |= ( 0x01 << 3); break;
+/*N*/ case AUTOUPD_FIELD_AND_CHARTS: n3 |= ( 0x02 << 3); break;
+/*N*/ case AUTOUPD_GLOBALSETTING: n3 |= ( 0x03 << 3); break;
+/*N*/ default:
+/*N*/ ASSERT( !this, "Sw3IoImp::OutDocDummies: Wert von FieldUpdMode unbek." );
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ String sAutoMarkURL( pDoc->GetTOIAutoMarkURL() );
+/*N*/ if( sAutoMarkURL.Len() )
+/*?*/ sAutoMarkURL = ::binfilter::StaticBaseUrl::AbsToRel( sAutoMarkURL URL_DECODE );
+/*N*/ *pStrm << (sal_uInt32)pDoc->GetULongDummy1()
+/*N*/ << (sal_uInt32)pDoc->GetULongDummy2()
+/*N*/ << n3
+/*N*/ << (sal_uInt8)pDoc->GetByteDummy2();
+/*N*/ OutString( *pStrm, sAutoMarkURL );
+/*N*/ OutString( *pStrm, pDoc->GetStringDummy2() );
+/*N*/
+/*N*/ CloseRec( SWG_DOCDUMMIES );
+/*N*/ }
+
+void Sw3IoImp::InPagePreViewPrintData()
+{
+ OpenRec( SWG_PGPREVIEWPRTDATA );
+
+ sal_uInt8 cFlags;
+ sal_uInt8 nRow, nCol;
+ sal_uInt32 nLeftSpace, nRightSpace, nTopSpace, nBottomSpace,
+ nHorzSpace, nVertSpace;
+
+ *pStrm >> cFlags
+ >> nRow
+ >> nCol
+ >> nLeftSpace
+ >> nRightSpace
+ >> nTopSpace
+ >> nBottomSpace
+ >> nHorzSpace
+ >> nVertSpace
+ ;
+ CloseRec( SWG_PGPREVIEWPRTDATA );
+
+ SwPagePreViewPrtData aData;
+ aData.SetLeftSpace( nLeftSpace );
+ aData.SetRightSpace( nRightSpace );
+ aData.SetTopSpace( nTopSpace );
+ aData.SetBottomSpace( nBottomSpace );
+ aData.SetHorzSpace( nHorzSpace );
+ aData.SetVertSpace( nVertSpace );
+ aData.SetRow( nRow );
+ aData.SetCol( nCol );
+ aData.SetLandscape( 0 != ( cFlags & 0x01 ) );
+ aData.SetStretch( 0 != ( cFlags & 0x02 ) );
+ pDoc->SetPreViewPrtData( &aData );
+}
+
+/*N*/ void Sw3IoImp::OutPagePreViewPrintData()
+/*N*/ {
+/*N*/ // Wenn keine Daten gesetzt oder keine gueltige Zeile/Spalte
+/*N*/ // gesetzt sind, so braucht es auch nicht geschrieben werden.
+/*N*/ const SwPagePreViewPrtData* pPPVPD = pDoc->GetPreViewPrtData();
+/*N*/ if( !pPPVPD || !pPPVPD->GetCol() || !pPPVPD->GetRow() )
+/*N*/ return;
+/*N*/
+/*?*/ OpenRec( SWG_PGPREVIEWPRTDATA );
+/*?*/
+/*?*/ sal_uInt8 cFlags = 0;
+/*?*/ if( pPPVPD->GetLandscape() )
+/*?*/ cFlags += 0x01;
+/*?*/ if( pPPVPD->GetStretch() )
+/*?*/ cFlags += 0x02;
+/*?*/
+/*?*/ *pStrm << cFlags
+/*?*/ << pPPVPD->GetRow()
+/*?*/ << pPPVPD->GetCol()
+/*?*/ << (sal_uInt32)pPPVPD->GetLeftSpace()
+/*?*/ << (sal_uInt32)pPPVPD->GetRightSpace()
+/*?*/ << (sal_uInt32)pPPVPD->GetTopSpace()
+/*?*/ << (sal_uInt32)pPPVPD->GetBottomSpace()
+/*?*/ << (sal_uInt32)pPPVPD->GetHorzSpace()
+/*?*/ << (sal_uInt32)pPPVPD->GetVertSpace()
+/*?*/ ;
+/*?*/ CloseRec( SWG_PGPREVIEWPRTDATA );
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx
new file mode 100644
index 000000000000..896f4dfa290e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3nodes.cxx
@@ -0,0 +1,2794 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#if !(defined _SVSTDARR_STRINGS_DECL && defined _SVSTDARR_BYTESTRINGS_DECL && \
+ defined _SVSTDARR_USHORTS_DECL && defined _SVSTDARR_XUB_STRLEN_DECL && \
+ defined _SVSTDARR_BOOLS_DECL)
+#define _SVSTDARR_STRINGS
+#define _SVSTDARR_BYTESTRINGS
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_XUB_STRLEN
+#define _SVSTDARR_BOOLS
+#endif
+
+#include <bf_svtools/imap.hxx>
+#include <bf_svtools/urihelper.hxx>
+#include <bf_svx/fontitem.hxx>
+#include <bf_svx/cscoitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <pam.hxx>
+#include <fmtanchr.hxx>
+#include <txtftn.hxx>
+#include <fmturl.hxx>
+#include <fchrfmt.hxx>
+#include <fmtftn.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtfld.hxx>
+#include <fmtinfmt.hxx>
+#include <txtflcnt.hxx>
+#include <charatr.hxx>
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include <paratr.hxx>
+#include <poolfmt.hxx>
+#include <sw3io.hxx>
+#include <sw3imp.hxx>
+#include <ndtxt.hxx>
+#include <ndgrf.hxx>
+#include <ndole.hxx>
+#include <crypter.hxx>
+#include <wrong.hxx>
+#include <tox.hxx>
+#include <fmthbsh.hxx>
+// OD 27.06.2003 #108784#
+
+// Export
+#include <fldbas.hxx>
+#include <frmatr.hxx>
+
+#include <swerror.h>
+#include <SwStyleNameMapper.hxx>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+#define URL_DECODE \
+ , INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS
+
+/*N*/ SV_IMPL_PTRARR_SORT(Sw3SortFmts,SwFmtPtr)
+
+////////////////////////////////////////////////////////////////////////////
+
+// Vorbereitung des Exports eines Text-Nodes in das Sw31 File-Format
+// (dazu muessen SwFmtInetFmt-Hints in Felder umgewandelt werden)
+// Idee:
+// Die Start- und End-Positionen aller Hints werden in zwei USHORT-Arrays
+// gespeichert, die SfxPoolItems der Hints in einem dritten. Diese
+// "Hint"-Arrays werden entsprechend aufbereitet und dann statt der
+// Original-Hints ausgegeben.
+//
+// Wie wird aufbereitet?
+// Die "Hints" werden zunaechst in die Arrays kopiert. dabei werden
+// - Schachtelungen von SwFmtINetFmt-Hints aufgeloest.
+// - leere SwFmtINetFmt-Hints "entfernt"
+// - Hints innerhalb von SwFmtINetFmt-Hints "entfernt"
+//
+// Danach werden die Texte der SwFmtINetFmt-Hints extrahiert und der
+// Text des Nodes sowie die Htnt-Psotionen an die Verwendung von Feldern
+// angepasst.
+
+SV_DECL_PTRARR(SfxPoolItems,SfxPoolItem * ,16,16)
+struct Sw3ExportTxtAttrs
+{
+ SvXub_StrLens aItemStarts; // Start-Pos der Hints
+ SvXub_StrLens aItemEnds; // End-Pos der Hints
+ SfxPoolItems aItems; // Items der Hints
+ SvByteStrings aINetFmtTexts; // Texte der SwFmtINetFmt-Hints
+
+ ByteString aText; // Node-Text
+
+ USHORT nDrawFrmFmts; // Anzahl zeichengeb. Zeichen-Objekte
+
+ Sw3ExportTxtAttrs() : nDrawFrmFmts( 0 ) {}
+};
+
+class SwInsHardBlankSoftHyph
+{
+ SvXub_StrLens aItemStarts; // Start-Pos der Hints
+ SfxPoolItems aItems; // Items der Hints
+public:
+ SwInsHardBlankSoftHyph() {}
+ ~SwInsHardBlankSoftHyph();
+ void AddItem( xub_StrLen nPos, sal_Unicode c );
+ void ChangePos( xub_StrLen nHtEnd, xub_StrLen nOffs );
+ void OutAttr( Sw3IoImp& rIo, xub_StrLen nStt, xub_StrLen nEnd );
+};
+
+
+////////////////////////////////////////////////////////////////////////////
+
+// Ausgabe von FlyFrames, die an einem Node kleben
+
+/*N*/ void Sw3IoImp::OutNodeFlyFrames( ULONG nNodeId )
+/*N*/ {
+/*N*/ // FlyFrames duerfen Tabellen enthalten, koennen also Tabelle in Tabelle
+/*N*/ // simulieren
+/*N*/ SwTable* pSave = pCurTbl; pCurTbl = NULL;
+/*N*/ SwFmt* pFly;
+/*N*/ while( ( pFly = FindFlyFrm( nNodeId ) ) != NULL )
+/*N*/ {
+/*N*/ if( !pFly->IsDefault() )
+/*N*/ {
+/*N*/ BYTE cType = SWG_FLYFMT;
+/*N*/ // OD 27.06.2003 #108784# - do *not* export drawing objects in header/footer
+/*N*/ bool bExport = true;
+/*N*/ if( RES_DRAWFRMFMT == pFly->Which() )
+/*N*/ {
+/*N*/ cType = SWG_SDRFMT;
+/*N*/ SwFrmFmt* pDrawFrmFmt = static_cast<SwFrmFmt*>(pFly);
+/*N*/ const SwFmtAnchor& rFmtAnchor = pDrawFrmFmt->GetAnchor();
+/*N*/ if ( rFmtAnchor.GetAnchorId() != FLY_PAGE &&
+/*N*/ pDrawFrmFmt->GetDoc()->IsInHeaderFooter( rFmtAnchor.GetCntntAnchor()->nNode ) )
+/*N*/ {
+/*N*/ bExport = false;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bExport )
+/*N*/ {
+/*N*/ OutFormat( cType, *pFly );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pCurTbl = pSave;
+/*N*/ }
+
+// zeichengebundene Zeichen-Objekte absatzgebunden exportieren
+void Sw3IoImp::ExportNodeDrawFrmFmts( const SwTxtNode& rNd, xub_StrLen nStart,
+ xub_StrLen nEnd, USHORT nCount )
+{
+ ASSERT( pExportInfo, "Wo sind die Export-Informationen???" );
+ if( !pExportInfo || !nCount )
+ return;
+
+ pExportInfo->bDrwFrmFmt31 = TRUE;
+
+ USHORT nCntAttr = rNd.HasHints() ? rNd.GetSwpHints().Count() : 0;
+ USHORT nExported = 0;
+ for( USHORT n = 0; n < nCntAttr && nExported < nCount; n++ )
+ {
+ const SwTxtAttr* pHt = rNd.GetSwpHints()[ n ];
+ BOOL bHtEnd = BOOL( pHt->GetEnd() != NULL );
+ xub_StrLen nHtStart = *pHt->GetStart();
+
+ if( !bHtEnd && nHtStart >= nStart && nHtStart < nEnd &&
+ RES_TXTATR_FLYCNT==pHt->GetAttr().Which() )
+ {
+ const SwFmtFlyCnt& rFlyCnt = (const SwFmtFlyCnt&)pHt->GetAttr();
+ const SwFmt *pFmt = rFlyCnt.GetFrmFmt();
+ if( RES_DRAWFRMFMT == pFmt->Which() )
+ {
+ OutFormat( SWG_SDRFMT, *pFmt );
+ nExported++;
+ }
+ }
+ }
+
+ pExportInfo->bDrwFrmFmt31 = FALSE;
+}
+
+/*N*/ sal_Char Sw3IoImp::ConvStarSymbolCharToStarBats( sal_Unicode c )
+/*N*/ {
+/*N*/ if( !hBatsFontConv )
+/*N*/ {
+/*N*/ hBatsFontConv = CreateFontToSubsFontConverter( sStarSymbol,
+/*N*/ FONTTOSUBSFONT_EXPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+/*N*/ ASSERT( hBatsFontConv, "Got no symbol font converter" );
+/*N*/ }
+/*N*/ if( hBatsFontConv )
+/*N*/ {
+/*N*/ c = ConvertFontToSubsFontChar( hBatsFontConv, c );
+/*N*/ }
+/*N*/
+/*N*/ return (sal_Char)c;
+/*N*/ }
+
+/*N*/ sal_Unicode Sw3IoImp::ConvStarBatsCharToStarSymbol( sal_Char c )
+/*N*/ {
+/*N*/ sal_Unicode cNew = (sal_Unicode)(sal_uChar)c;
+/*N*/ if( !hBatsFontConv )
+/*N*/ {
+/*N*/ hBatsFontConv = CreateFontToSubsFontConverter( sStarBats,
+/*N*/ FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+/*N*/ ASSERT( hBatsFontConv, "Got no symbol font converter" );
+/*N*/ }
+/*N*/ if( hBatsFontConv )
+/*N*/ {
+/*N*/ cNew = ConvertFontToSubsFontChar( hBatsFontConv, (sal_Unicode)(sal_uChar)c + 0xf000 );
+/*N*/ }
+/*N*/
+/*N*/ return cNew;
+/*N*/ }
+
+sal_Unicode Sw3IoImp::ConvStarMathCharToStarSymbol( sal_Char c )
+{
+ sal_Unicode cNew = c;
+ if( !hMathFontConv )
+ {
+ hMathFontConv = CreateFontToSubsFontConverter( sStarMath,
+ FONTTOSUBSFONT_IMPORT|FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS );
+ ASSERT( hMathFontConv, "Got no symbol font converter" );
+ }
+ if( hMathFontConv )
+ {
+ cNew = ConvertFontToSubsFontChar( hMathFontConv, (sal_Unicode)(sal_uChar)c + 0xf000 );
+ }
+
+ return cNew;
+}
+
+/*N*/ sal_Bool lcl_sw3io_isStarSymbolFontItem( const SvxFontItem& rFontItem )
+/*N*/ {
+/*N*/ return ( rFontItem.GetFamilyName().EqualsAscii( "StarSymbol", 0, sizeof("StarSymbol")-1 ) ||
+/*N*/ rFontItem.GetFamilyName().EqualsAscii( "OpenSymbol", 0, sizeof("OpenSymbol")-1 ) );
+/*N*/ }
+
+// Hilfsroutine fuer ConvertText: Suche nach dem naechsten Hint,
+// der eine Konversion verbietet. Zur Zeit sind dies Hints, die entweder
+// direkt oder indirekt auf einen Font mit CHARSET_SYMBOL hinweisen.
+/*N*/ const SvxFontItem *lcl_sw3io_getNextFontHint( const SwpHints* pHints, USHORT& rHint,
+/*N*/ xub_StrLen& rStart, xub_StrLen& rEnd,
+/*N*/ sal_Bool& rIsMathOrBatsFontItem,
+/*N*/ Sw3Fmts *pConvToSymbolFmts,
+/*N*/ const SvxFontItem& rStarBatsItem,
+/*N*/ const SvxFontItem& rStarMathItem )
+/*N*/ {
+/*N*/ rStart = rEnd = (xub_StrLen)-1;
+/*N*/ rIsMathOrBatsFontItem = sal_False;
+/*N*/
+/*N*/ if( !pHints )
+/*N*/ return 0;
+/*N*/
+/*N*/ const SvxFontItem *pFontItem = 0;
+/*N*/ while( rHint < pHints->Count() )
+/*N*/ {
+/*N*/ const SwTxtAttr* pHnt = (*pHints) [rHint++];
+/*N*/ if( pHnt->Which() == RES_CHRATR_FONT )
+/*N*/ {
+/*N*/ rStart = *pHnt->GetStart();
+/*N*/ rEnd = *pHnt->GetEnd();
+/*N*/ pFontItem = &pHnt->GetFont();
+/*N*/ rIsMathOrBatsFontItem =
+/*N*/ RTL_TEXTENCODING_SYMBOL == pFontItem->GetCharSet() &&
+/*N*/ ( pFontItem->GetFamilyName().EqualsIgnoreCaseAscii( "StarBats", 0, sizeof("StarBats")-1 ) ||
+/*N*/ pFontItem->GetFamilyName().EqualsIgnoreCaseAscii( "StarMath", 0, sizeof("StarMath")-1 ) );
+/*N*/ break;
+/*N*/ }
+/*N*/ // Gibt es einen CharFormat-Hint mit einem Symbol-Font?
+/*N*/ else if( pHnt->Which() == RES_TXTATR_CHARFMT )
+/*N*/ {
+/*N*/ SwCharFmt* pFmt = pHnt->GetCharFmt().GetCharFmt();
+/*N*/ if( pFmt->GetAttrSet().GetItemState( RES_CHRATR_FONT, FALSE )
+/*N*/ == SFX_ITEM_SET )
+/*N*/ {
+/*N*/ rStart = *pHnt->GetStart();
+/*N*/ rEnd = *pHnt->GetEnd();
+/*N*/ pFontItem = &pFmt->GetFont();
+/*N*/ if( pConvToSymbolFmts &&
+/*N*/ lcl_sw3io_isStarSymbolFontItem( *pFontItem ) )
+/*N*/ {
+/*?*/ BYTE nFlags = pConvToSymbolFmts->GetFlags( pFmt );
+/*?*/ if( (SW3IO_CONV_FROM_BATS & nFlags) != 0 )
+/*?*/ pFontItem = &rStarBatsItem;
+/*?*/ else if( (SW3IO_CONV_FROM_MATH & nFlags) != 0 )
+/*?*/ pFontItem = &rStarMathItem;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return pFontItem;
+/*N*/ }
+
+// Text Node konvertieren
+// Wird aufgerufen, wenn sich die Systeme unterscheiden. Der Text wird
+// vom einen in den anderen Zeichensatz konvertiert. Nicht konvertierbare
+// Zeichen werden farblich unterlegt; Hints mit CHARSET_SYMBOL-Zeichensaetzen
+// werden uebersprungen
+
+/*N*/ const SwTxtAttr* lcl_sw3io_hasTxtAttr( const SwpHints *pHints, xub_StrLen nIdx )
+/*N*/ {
+/*N*/ const SwTxtAttr* pRet = 0;
+/*N*/ if( pHints )
+/*N*/ {
+/*N*/ USHORT nHints = pHints->Count();
+/*N*/ for( USHORT i = 0; i < nHints; i++ )
+/*N*/ {
+/*N*/ const SwTxtAttr *pPos = (*pHints)[i];
+/*N*/ const xub_StrLen nStart = *pPos->GetStart();
+/*N*/ if( nIdx == nStart && !pPos->GetEnd() )
+/*N*/ {
+/*N*/ pRet = pPos;
+/*N*/ break;
+/*N*/ }
+/*N*/ if( nStart > nIdx )
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ sal_Bool Sw3IoImp::ConvertText( ByteString& rText8, String& rText,
+/*N*/ xub_StrLen nStart, xub_StrLen nEnd,
+/*N*/ xub_StrLen nOffset, const SwTxtNode& rNd,
+/*N*/ rtl_TextEncoding eEnc,
+/*N*/ const SvxFontItem& rFontItem,
+/*N*/ SwInsHardBlankSoftHyph* pHBSH, BOOL bTo8 )
+/*N*/ {
+/*N*/ sal_Bool bRet = sal_False;
+/*N*/ const SwpHints *pHints = rNd.GetpSwpHints();
+/*N*/ if( bTo8 )
+/*N*/ {
+/*N*/ sal_Bool bToBats = lcl_sw3io_isStarSymbolFontItem( rFontItem );
+/*N*/ bRet = bToBats;
+/*N*/ if( bToBats || RTL_TEXTENCODING_SYMBOL == rFontItem.GetCharSet() )
+/*N*/ {
+/*N*/ for( xub_StrLen nPos = nStart; nPos < nEnd; nPos++ )
+/*N*/ {
+/*N*/ sal_Unicode c = rText.GetChar( nPos );
+/*N*/ switch ( c )
+/*N*/ {
+/*N*/ case CHAR_HARDBLANK:
+/*N*/ case CHAR_HARDHYPHEN:
+/*?*/ case CHAR_SOFTHYPHEN:
+/*?*/ if( pHBSH )
+/*?*/ {
+/*?*/ pHBSH->AddItem( nPos, c );
+/*?*/ c = '\xff';
+/*?*/ }
+/*?*/ break;
+/*N*/
+/*N*/ case CH_TXTATR_BREAKWORD:
+/*N*/ case CH_TXTATR_INWORD:
+/*N*/ if( lcl_sw3io_hasTxtAttr( pHints, nPos+nOffset ) )
+/*N*/ c = '\xff';
+/*N*/ break;
+/*N*/ }
+/*N*/ if( bToBats )
+/*N*/ rText8 += ConvStarSymbolCharToStarBats( c );
+/*N*/ else
+/*N*/ rText8 += (sal_Char)c;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ xub_StrLen nCopy = nStart;
+/*N*/ for( xub_StrLen nPos = nStart; nPos < nEnd; nPos++ )
+/*N*/ {
+/*N*/ sal_Unicode c = rText.GetChar( nPos );
+/*N*/ BOOL bToFF = FALSE;
+/*N*/ switch ( c )
+/*N*/ {
+/*N*/ case CHAR_HARDBLANK:
+/*N*/ case CHAR_HARDHYPHEN:
+/*N*/ case CHAR_SOFTHYPHEN:
+/*N*/ if( pHBSH )
+/*N*/ {
+/*N*/ pHBSH->AddItem( nPos, c );
+/*N*/ bToFF = TRUE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case CH_TXTATR_BREAKWORD:
+/*N*/ case CH_TXTATR_INWORD:
+/*N*/ bToFF = 0 != lcl_sw3io_hasTxtAttr( pHints, nPos+nOffset );
+/*N*/ break;
+/*N*/ }
+/*N*/ if( bToFF )
+/*N*/ {
+/*N*/ if( nCopy < nPos )
+/*N*/ rText8 += ByteString( rText.Copy(nCopy,nPos-nCopy),
+/*N*/ eEnc );
+/*N*/ rText8 += '\xff';
+/*N*/ nCopy = nPos + 1;
+/*N*/ }
+/*N*/ }
+/*N*/ if( nCopy < nEnd )
+/*N*/ rText8 += ByteString( rText.Copy(nCopy,nEnd-nCopy), eEnc );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwTxtAttr* pTAttr;
+/*N*/ if( RTL_TEXTENCODING_SYMBOL == rFontItem.GetCharSet() )
+/*N*/ {
+/*N*/ sal_Bool bBatsToSymbol =
+/*N*/ rFontItem.GetFamilyName().EqualsIgnoreCaseAscii( sStarBats );
+/*N*/ sal_Bool bMathToSymbol =
+/*N*/ rFontItem.GetFamilyName().EqualsIgnoreCaseAscii( sStarMath );
+/*N*/ bRet = bBatsToSymbol || bMathToSymbol;
+/*N*/ for( xub_StrLen nPos = nStart; nPos < nEnd; nPos++ )
+/*N*/ {
+/*N*/ sal_Char c = rText8.GetChar( nPos );
+/*N*/ if( '\xff' == c && 0 != (pTAttr =
+/*N*/ lcl_sw3io_hasTxtAttr( pHints, nPos+nOffset )) )
+/*N*/ rText += GetCharOfTxtAttr( *pTAttr );
+/*N*/ else if( bBatsToSymbol )
+/*N*/ rText += ConvStarBatsCharToStarSymbol( c );
+/*N*/ else if( bMathToSymbol )
+ rText += ConvStarMathCharToStarSymbol( c );
+/*N*/ else
+/*N*/ rText += ByteString::ConvertToUnicode( c,
+/*N*/ RTL_TEXTENCODING_SYMBOL );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ xub_StrLen nCopy = nStart;
+/*N*/ for( xub_StrLen nPos = nStart; nPos < nEnd; nPos++ )
+/*N*/ {
+/*N*/ sal_Char c = rText8.GetChar( nPos );
+/*N*/ sal_Unicode cNew;
+/*N*/ if( '\xff' == c )
+/*N*/ {
+/*N*/ if( 0 != ( pTAttr = lcl_sw3io_hasTxtAttr(
+/*N*/ pHints, nPos+nOffset )) ||
+/*N*/ CHAR_HARDBLANK ==
+/*N*/ ( cNew = rNd.GetTxt().GetChar( nPos+nOffset )) ||
+/*N*/ CHAR_HARDHYPHEN == cNew || CHAR_SOFTHYPHEN == cNew )
+/*N*/ {
+/*N*/ if( nCopy < nPos )
+/*N*/ rText += String( rText8.Copy(nCopy,nPos-nCopy), eEnc );
+/*N*/ if( pTAttr )
+/*N*/ rText += GetCharOfTxtAttr( *pTAttr );
+/*N*/ else
+/*N*/ rText += cNew;
+/*N*/ nCopy = nPos + 1;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( CHAR_SOFTHYPHEN ==rNd.GetTxt().GetChar( nPos+nOffset ) )
+/*N*/ {
+/*N*/ // The original charcter has been converted into a soft
+/*N*/ // hyphen, but there was no text attribute at this position.
+/*N*/ // We then have to replace the soft hyphen with a hard one.
+/*N*/ // The check is based on the source char set and not on
+/*N*/ // the actual one. The assumption is here that there is
+/*N*/ // no difference in the position of the soft hyphen.
+/*N*/ // However, to not accidentially do a wrong conversion
+/*N*/ // we check this again. The only mistake we might make
+/*N*/ // if the assumption is wrong is to not convert a soft
+/*N*/ // hyphen.
+/*N*/ if( eEnc == eSrcSet ||
+/*N*/ CHAR_SOFTHYPHEN == ByteString::ConvertToUnicode( c, eEnc ) )
+/*N*/ {
+/*N*/ if( nCopy < nPos )
+/*N*/ rText += String( rText8.Copy(nCopy,nPos-nCopy), eEnc );
+/*N*/ rText += '-';
+/*N*/ nCopy = nPos + 1;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( nCopy < nEnd )
+/*N*/ rText += String( rText8.Copy( nCopy, nEnd-nCopy ), eEnc );
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+typedef const SvxFontItem *SvxFontItemPtr;
+SV_DECL_PTRARR( SvxFontItems, SvxFontItemPtr, 5, 5 )//STRIP008 ;
+
+typedef SwTxtAttr *SwTxtAttrPtr;
+SV_DECL_PTRARR( SwTxtAttrs, SwTxtAttrPtr, 5, 5 )//STRIP008 ;
+
+/*N*/ void Sw3IoImp::ConvertText( ByteString& rText8, String& rText,
+/*N*/ xub_StrLen nOffset, SwTxtNode& rNd,
+/*N*/ rtl_TextEncoding eEnc, const SvxFontItem& rFontItem,
+/*N*/ SwInsHardBlankSoftHyph* pHBSH, BOOL bTo8 )
+/*N*/
+/*N*/ {
+/*N*/ SvxFontItems aFontItemStack;
+/*N*/ SvXub_StrLens aEndPosStack;
+/*N*/ SwTxtAttrs aDeleteFontTxtAttrs;
+/*N*/ SvXub_StrLens aInsertSymbolFontStartPoss;
+/*N*/ SvXub_StrLens aInsertSymbolFontEndPoss;
+/*N*/
+/*N*/ SvxFontItem aStarBatsItem( FAMILY_DONTKNOW, sStarBats, aEmptyStr,
+/*N*/ PITCH_DONTKNOW, RTL_TEXTENCODING_SYMBOL );
+/*N*/ SvxFontItem aStarMathItem( FAMILY_DONTKNOW, sStarMath, aEmptyStr,
+/*N*/ PITCH_DONTKNOW, RTL_TEXTENCODING_SYMBOL );
+/*N*/
+/*N*/ SwpHints *pHints = rNd.GetpSwpHints();
+/*N*/ // find next
+/*N*/ xub_StrLen nFntStart = (xub_StrLen)-1, nFntEnd = 0;
+/*N*/ USHORT nHint = 0;
+/*N*/ const SvxFontItem *pFontItem = &rFontItem;
+/*N*/ sal_Bool bIsBatsOrMathFontItem;
+/*N*/ const SvxFontItem *pNewFontItem =
+/*N*/ lcl_sw3io_getNextFontHint( pHints, nHint, nFntStart,
+/*N*/ nFntEnd, bIsBatsOrMathFontItem,
+/*N*/ pConvToSymbolFmts, aStarBatsItem,
+/*N*/ aStarMathItem );
+/*N*/ if( !bTo8 && pNewFontItem && bIsBatsOrMathFontItem )
+/*N*/ aDeleteFontTxtAttrs.Insert( pHints->GetHt( nHint-1), aDeleteFontTxtAttrs.Count() );
+/*N*/ xub_StrLen nLen = nOffset + (bTo8 ? rText.Len() : rText8.Len() );
+/*N*/ xub_StrLen nCopy = nOffset;
+ xub_StrLen nPos=0;
+/*N*/ for( nPos = 0; nPos < nLen; nPos++ )
+/*N*/ {
+/*N*/ if( aEndPosStack.Count() &&
+/*N*/ nPos == aEndPosStack[aEndPosStack.Count()-1] )
+/*N*/ {
+/*N*/ if( nPos > nCopy )
+/*N*/ {
+/*N*/ sal_Bool bSymConv = ConvertText( rText8, rText, nCopy, nPos,
+/*N*/ nOffset, rNd, eEnc,
+/*N*/ *pFontItem, pHBSH, bTo8 );
+/*N*/ if( bSymConv && !bTo8 )
+/*N*/ {
+/*N*/ aInsertSymbolFontStartPoss.Insert( nCopy,
+/*N*/ aInsertSymbolFontStartPoss.Count() );
+/*N*/ aInsertSymbolFontEndPoss.Insert( nPos,
+/*N*/ aInsertSymbolFontEndPoss.Count() );
+/*N*/ }
+/*N*/ nCopy = nPos;
+/*N*/ }
+/*N*/ pFontItem = aFontItemStack[ aFontItemStack.Count()-1 ];
+/*N*/ aFontItemStack.Remove( aFontItemStack.Count()-1 );
+/*N*/ aEndPosStack.Remove( aEndPosStack.Count()-1 );
+/*N*/ }
+/*N*/ while( (xub_StrLen)-1 != nFntStart && nPos == nFntStart )
+/*N*/ {
+/*N*/ if( nPos > nCopy )
+/*N*/ {
+/*N*/ sal_Bool bSymConv = ConvertText( rText8, rText, nCopy, nPos,
+/*N*/ nOffset, rNd,eEnc, *pFontItem,
+/*N*/ pHBSH, bTo8 );
+/*N*/ if( bSymConv && !bTo8 )
+/*N*/ {
+/*?*/ aInsertSymbolFontStartPoss.Insert( nCopy,
+/*?*/ aInsertSymbolFontStartPoss.Count() );
+/*?*/ aInsertSymbolFontEndPoss.Insert( nPos,
+/*?*/ aInsertSymbolFontEndPoss.Count() );
+/*N*/ }
+/*N*/ nCopy = nPos;
+/*N*/ }
+/*N*/ aEndPosStack.Insert( nFntEnd, aEndPosStack.Count() );
+/*N*/ aFontItemStack.Insert( pFontItem, aFontItemStack.Count() );
+/*N*/ pFontItem = pNewFontItem;
+/*N*/ pNewFontItem = lcl_sw3io_getNextFontHint( pHints, nHint, nFntStart,
+/*N*/ nFntEnd, bIsBatsOrMathFontItem,
+/*N*/ pConvToSymbolFmts, aStarBatsItem,
+/*N*/ aStarMathItem);
+/*N*/ if( !bTo8 && pNewFontItem && bIsBatsOrMathFontItem )
+/*N*/ aDeleteFontTxtAttrs.Insert( pHints->GetHt( nHint-1 ), aDeleteFontTxtAttrs.Count() );
+/*N*/ }
+/*N*/ }
+/*N*/ if( nLen > nCopy )
+/*N*/ {
+/*N*/ sal_Bool bSymConv = ConvertText( rText8, rText, nCopy, nLen, nOffset,
+/*N*/ rNd, eEnc, *pFontItem, pHBSH, bTo8 );
+/*N*/ if( bSymConv && !bTo8 )
+/*N*/ {
+/*N*/ aInsertSymbolFontStartPoss.Insert( nCopy,
+/*N*/ aInsertSymbolFontStartPoss.Count() );
+/*N*/ aInsertSymbolFontEndPoss.Insert( nPos,
+/*N*/ aInsertSymbolFontEndPoss.Count() );
+/*N*/ }
+/*N*/ }
+/*N*/ while( aDeleteFontTxtAttrs.Count() )
+/*N*/ {
+/*N*/ SwTxtAttr *pAttr = aDeleteFontTxtAttrs[0];
+/*N*/ aDeleteFontTxtAttrs.Remove( 0 );
+/*N*/ rNd.Delete( pAttr );
+/*N*/ }
+/*N*/ if( aInsertSymbolFontStartPoss.Count() )
+/*N*/ {
+/*N*/ const Font& rSymbolFont = SwNumRule::GetDefBulletFont();
+/*N*/ SvxFontItem aFontItem( rSymbolFont.GetFamily(), rSymbolFont.GetName(),
+/*N*/ rSymbolFont.GetStyleName(),
+/*N*/ rSymbolFont.GetPitch(),
+/*N*/ rSymbolFont.GetCharSet() );
+/*N*/ for( USHORT i=0; i < aInsertSymbolFontStartPoss.Count(); i++ )
+/*N*/ {
+/*N*/ rNd.Insert( aFontItem, aInsertSymbolFontStartPoss[i],
+/*N*/ aInsertSymbolFontEndPoss[i] );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::ConvertText( SwTxtNode& rNd, const ByteString& rText8,
+/*N*/ xub_StrLen nOffset,
+/*N*/ SvUShorts *pEncs, SvXub_StrLens *pPoss )
+/*N*/ {
+/*N*/ if( !rText8.Len() )
+/*N*/ return;
+/*N*/
+/*N*/ const SvxFontItem& rFont = rNd.GetSwAttrSet().GetFont();
+/*N*/ BOOL bNdSym = rFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL;
+/*N*/
+/*N*/ String& rNdText = (String &)rNd.GetTxt();
+/*N*/ String aText;
+/*N*/ ByteString aText8( rText8 );
+/*N*/ SvxFontItem aFontItem( rFont );
+/*N*/ if( pConvToSymbolFmts &&
+/*N*/ lcl_sw3io_isStarSymbolFontItem( aFontItem ) )
+/*N*/ {
+/*?*/ BYTE nFlags = pConvToSymbolFmts->GetFlags( rNd.GetFmtColl() );
+/*?*/ if( (SW3IO_CONV_FROM_BATS & nFlags) != 0 )
+/*?*/ {
+/*?*/ aFontItem.GetFamilyName() = sStarBats;
+/*?*/ aFontItem.GetCharSet() = RTL_TEXTENCODING_SYMBOL;
+/*?*/ }
+/*?*/ else if( (SW3IO_CONV_FROM_MATH & nFlags) != 0 )
+/*?*/ {
+/*?*/ aFontItem.GetFamilyName() = sStarMath;
+/*?*/ aFontItem.GetCharSet() = RTL_TEXTENCODING_SYMBOL;
+/*?*/ }
+/*N*/ }
+/*N*/ ConvertText( aText8, aText, nOffset, rNd,
+/*N*/ eSrcSet, aFontItem, 0, FALSE );
+/*N*/ rNdText.Replace( nOffset, aText.Len(), aText );
+/*N*/ if( bNdSym &&
+/*N*/ SFX_ITEM_SET == rNd.GetSwAttrSet().GetItemState( RES_CHRATR_FONT,
+/*N*/ sal_False ) &&
+/*N*/ ( rFont.GetFamilyName().EqualsIgnoreCaseAscii( sStarBats ) ||
+/*N*/ rFont.GetFamilyName().EqualsIgnoreCaseAscii( sStarMath ) ) )
+/*N*/ {
+/*?*/ const Font& rSymbolFont = SwNumRule::GetDefBulletFont();
+/*?*/ SvxFontItem aFontItem( rSymbolFont.GetFamily(),
+/*?*/ rSymbolFont.GetName(),
+/*?*/ rSymbolFont.GetStyleName(),
+/*?*/ rSymbolFont.GetPitch(),
+/*?*/ rSymbolFont.GetCharSet() );
+/*?*/ ((SwCntntNode&)rNd).SetAttr( aFontItem );
+/*N*/ }
+/*N*/
+/*N*/ if( pEncs )
+/*N*/ {
+/*?*/ for( USHORT i=0; i < pEncs->Count(); i++ )
+/*?*/ {
+/*?*/ xub_StrLen nStart = (*pPoss)[2*i];
+/*?*/ String aTmp( rText8.Copy( nStart - nOffset,
+/*?*/ (*pPoss)[2*i+1] - nStart ),
+/*?*/ (rtl_TextEncoding)(*pEncs)[i] );
+/*?*/ rNdText.Replace( nStart, aTmp.Len(), aTmp );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+// Text Node einlesen
+// Falls kein Node angegeben ist, wird ein neuer Node an der angegebenen
+// Position erzeugt.
+// nInsFirstPara - beim Document einfuegen, muss der erste Absatz
+// sonderbehandelt werden (Absatz Attribute!)
+
+/*N*/ void Sw3IoImp::InTxtNode( SwTxtNode* pNd, SwNodeIndex& rPos, xub_StrLen nOffset,
+/*N*/ BYTE nInsFirstPara )
+/*N*/ {
+/*N*/ SwTxtNode *pOldNd = pNd && pNd->GetDepends() ? pNd : 0;
+/*N*/
+/*N*/ SvStringsDtor *pINetFldTexts = 0; // Texte aus Internet-Feldern
+/*N*/ SvXub_StrLens *pINetFldPoss = 0; // Positionen der Internet-Felder
+/*N*/
+/*N*/ SvXub_StrLens *pErasePoss = 0; // Positionen der Draw-Formate
+/*N*/
+/*N*/ SvUShorts *pCharSetColorEncs = 0;
+/*N*/ SvXub_StrLens *pCharSetColorPoss = 0; //
+/*N*/
+/*N*/ OpenRec( SWG_TEXTNODE );
+/*N*/ BYTE cNumLevel = NO_NUMBERING;
+/*N*/ USHORT nColl = IDX_DFLT_VALUE, nCondColl = IDX_DFLT_VALUE;
+/*N*/ SwWrongList *pWrong = 0;
+/*N*/ // 0x0L: Laenge der Daten
+/*N*/ // 0x10: Numerierung folgt
+/*N*/ // 0x20: Wrong-Liste ist nicht dirty
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ *pStrm >> nColl;
+/*N*/ if( !IsVersion(SWG_LONGIDX) && (cFlags & 0x10) )
+/*N*/ {
+/*N*/ *pStrm >> cNumLevel;
+/*N*/ // Im SW31-format wurde fuer nicht numerierte
+/*N*/ // Absaetzte noch ein NO_NUMLEVEL mit rausgeschrieben.
+/*N*/ if( NO_NUM == cNumLevel &&
+/*N*/ IsVersion( SWG_NONUMLEVEL, SWG_DESKTOP40 ) &&
+/*N*/ pStrm->Tell() != nFlagRecEnd ) // wenn noch Daten da sind
+/*?*/ *pStrm >> cNumLevel; // NO_NUM -> NO_NUMLEVEL
+/*N*/
+/*N*/ // Wenn ein NO_NUM gelesen wurde muss es noch in ein NO_NUMLEVEL
+/*N*/ // umgewandelt werden.
+/*N*/ bConvertNoNum |= (NO_NUM == cNumLevel);
+/*N*/ }
+/*N*/
+/*N*/ if( IsVersion( SWG_CONDCOLLS, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ // bedingte Vorlagen gibt es nicht im 31-Export-Format
+/*N*/ *pStrm >> nCondColl;
+/*N*/ if( IDX_DFLT_VALUE != nCondColl )
+/*N*/ {
+/*N*/ // es ist eine gesetzt, dieses ist die bedingte Vorlage
+/*N*/ USHORT nTmp = nCondColl;
+/*N*/ nCondColl = nColl;
+/*N*/ nColl = nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseFlagRec();
+/*N*/ SwTxtFmtColl* pColl = FindTxtColl( nColl );
+/*N*/
+/*N*/ // JP 07.08.00: set never the default text format collection on a node
+/*N*/ if( pColl == pDoc->GetDfltTxtFmtColl() )
+/*?*/ pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+/*N*/
+/*N*/ // Der Text des Nodes darf nicht einfach so konvertiert werden!
+/*N*/ ByteString aText8;
+/*N*/ pStrm->ReadByteString( aText8 );
+/*N*/ if( pCrypter )
+ pCrypter->Decrypt( aText8 );
+/*N*/ String aText( aText8, eSrcSet );
+/*N*/ if( !pNd )
+/*N*/ {
+/*N*/ pNd = pDoc->GetNodes().MakeTxtNode( rPos, pColl );
+/*N*/ rPos--;
+/*N*/ (String&) pNd->GetTxt() = aText;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !nInsFirstPara )
+/*N*/ pNd->ChgFmtColl( pColl );
+/*N*/ SwIndex aOff( pNd, nOffset );
+/*N*/ pNd->Insert( aText, aOff );
+/*N*/ }
+/*N*/
+/*N*/ // Der Offset kann wegen Einf. von nicht sichtbaren Redlines auch
+/*N*/ // negativ werden. Das darf aber auch ausser weiteren Redlines nichts
+/*N*/ // mehr kommen.
+/*N*/ INT32 nOffsetL = nOffset;
+/*N*/
+/*N*/ BOOL bConverted = FALSE;
+/*N*/
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ BYTE cType = Peek();
+/*N*/ switch( cType )
+/*N*/ {
+/*N*/ case SWG_ATTRSET:
+/*N*/ if( nInsFirstPara )
+/*N*/ {
+/*?*/ SwAttrSet aTmpSet( pDoc->GetAttrPool(),
+/*?*/ RES_CHRATR_BEGIN, RES_CHRATR_END - 1 );
+/*?*/ InAttrSet( aTmpSet );
+/*?*/ if( aTmpSet.Count() )
+/*?*/ {
+/*?*/ ASSERT( nOffsetL>=0,
+/*?*/ "Offset darf hier nicht negativ sein" );
+/*?*/ if( 2 == nInsFirstPara )
+/*?*/ pNd->SetAttr( aTmpSet, 0, aText.Len() );
+/*?*/ else
+/*?*/ pNd->SetAttr( aTmpSet, (xub_StrLen)nOffsetL,
+/*?*/ pNd->GetTxt().Len() );
+/*?*/
+/*?*/ if( pNd->GetpSwAttrSet() )
+/*?*/ pNd->GetpSwAttrSet()->SetModifyAtAttr( pNd );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pOldNd )
+/*N*/ {
+/*?*/ SwAttrSet aTmpSet( pDoc->GetAttrPool(), aTxtNodeSetRange );
+/*?*/ InAttrSet( aTmpSet );
+/*?*/ if( aTmpSet.Count() )
+/*?*/ {
+/*?*/ pNd->SwCntntNode::SetAttr( aTmpSet );
+/*?*/
+/*?*/ if( pNd->GetpSwAttrSet() )
+/*?*/ pNd->GetpSwAttrSet()->SetModifyAtAttr( pNd );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pNd->GetpSwAttrSet() )
+/*N*/ ((SwCntntNode*) pNd)->NewAttrSet( pDoc->GetAttrPool() );
+/*N*/ InAttrSet( *pNd->GetpSwAttrSet() );
+/*N*/ pNd->GetpSwAttrSet()->SetModifyAtAttr( pNd );
+/*N*/ }
+/*N*/ break;
+/*N*/ case SWG_SDRFMT:
+/*N*/ // Keine Draw-Formate in Kopf oder Fusszeilen einfuegen oder
+/*N*/ // wenn kein Drawing-Layer da ist!
+/*N*/ if( (nGblFlags & SW3F_NODRAWING) || bInsIntoHdrFtr )
+/*N*/ {
+/*?*/ SkipRec(); break;
+/*N*/ } // sonst weiter:
+/*N*/ case SWG_FLYFMT:
+/*N*/ {
+/*N*/ // Absatzgebundener oder Rahmengebundener FlyFrame
+/*N*/ USHORT eSave_StartNodeType = eStartNodeType;
+/*N*/ eStartNodeType = SwFlyStartNode;
+/*N*/ SwFrmFmt* pFmt = (SwFrmFmt*) InFormat( cType, NULL );
+/*N*/ eStartNodeType = eSave_StartNodeType;
+/*N*/
+/*N*/ if( !pFmt )
+/*N*/ break;
+/*N*/
+/*N*/ // Anker darin versenken
+/*N*/ SwFmtAnchor aAnchor( pFmt->GetAnchor() );
+/*N*/ if( FLY_AT_CNTNT==aAnchor.GetAnchorId() ||
+/*N*/ FLY_IN_CNTNT==aAnchor.GetAnchorId() )
+/*N*/ {
+/*N*/ // Absatzgebunende Rahmen: Die Abfrage auf FLY_IN_CNTNT
+/*N*/ // ist drinne, weil der SW31-Export sowas dummerweise
+/*N*/ // mal exportiert hat...
+/*N*/ aAnchor.SetType( FLY_AT_CNTNT );
+/*N*/ SwPosition aPos( rPos );
+/*N*/ aAnchor.SetAnchor( &aPos );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Dies sollte bisher nur ein rahmengebundener Rahmen
+/*N*/ // sein, koennte aber auch mal was anderes werden. Es
+/*N*/ // bleibt dann auf jeden Fall auch di Cntnt-Position
+/*N*/ // erhalten.
+/*?*/ SwPosition aPos( rPos, SwIndex(pNd,aAnchor.GetPageNum()) );
+/*?*/ aAnchor.SetAnchor( &aPos );
+/*N*/ }
+/*N*/ aAnchor.SetPageNum( 0 );
+/*N*/ pFmt->SetAttr( aAnchor );
+/*N*/ // Layout-Frames im Insert Mode fuer absatzgebundene
+/*N*/ // Flys erzeugen
+/*N*/ if( bInsert && !nRes ) pFmt->MakeFrms();
+/*N*/ break;
+/*N*/ }
+/*N*/ case SWG_ATTRIBUTE:
+/*N*/ ASSERT( nOffsetL>=0, "Offset darf hier nicht negativ sein" );
+/*N*/ InTxtAttr( *pNd, aText8, (xub_StrLen)nOffsetL, &pINetFldTexts,
+/*N*/ &pINetFldPoss, &pErasePoss,
+/*N*/ &pCharSetColorEncs, &pCharSetColorPoss );
+/*N*/ break;
+/*N*/ case SWG_NUMRULE:
+/*N*/ // NumRules gibt es an dieser Stelle nur im 3.1 und 4.0
+/*N*/ // Fileformat. Seit dem 5.0-Filformat werden sie in einem
+/*N*/ // eigenen Stream bzw. am Dok-Anfang gespeichert.
+/*N*/ OpenNumRange40( rPos );
+/*N*/ break;
+/*N*/ case SWG_NODENUM:
+/*N*/ // Den NodeNum-Record gibt es seit der 5.0
+/*N*/ {
+/*N*/ SwNodeNum aNodeNum;
+/*N*/ InNodeNum( aNodeNum );
+/*N*/ pNd->UpdateNum( aNodeNum );
+/*N*/ }
+/*N*/ break;
+/*N*/ case SWG_MARK:
+/*N*/ ASSERT( nOffsetL>=0, "Offset darf hier nicht negativ sein" );
+/*N*/ InNodeMark( rPos, (xub_StrLen)nOffsetL );
+/*N*/ break;
+/*N*/
+/*N*/ case SWG_NODEREDLINE:
+/*N*/ // nOffsetL ist Referenz-Parameter.
+/*N*/ // nOffsetL kann jetzt negativ werden!
+/*N*/ // The text has to be converted before any redlines are
+/*N*/ // inserted. Otherwise, the content positions will not match
+/*N*/ // the indices within the 8-Bit-Text.
+/*N*/ /*?*/ if( !bConverted ) // SW50.SDW
+/*N*/ /*?*/ {
+/*N*/ /*?*/ ConvertText( *pNd, aText8, (xub_StrLen)nOffsetL,
+/*N*/ /*?*/ pCharSetColorEncs, pCharSetColorPoss );
+/*N*/ /*?*/ bConverted = TRUE;
+/*N*/ /*?*/ }
+/*N*/ /*?*/ InNodeRedline( rPos, nOffsetL );
+/*?*/ break;
+/*N*/
+/*N*/ case SWG_WRONGLIST:
+/*N*/ {
+/*N*/ if( IsVersion( SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ OpenRec( SWG_WRONGLIST );
+/*N*/ pWrong = new SwWrongList;
+/*N*/ UINT16 nBeginInv, nEndInv, nCount;
+/*N*/ OpenFlagRec();
+/*N*/ *pStrm >> nBeginInv >> nEndInv;
+/*N*/ CloseFlagRec();
+/*N*/ pWrong->SetInvalid( (xub_StrLen)nBeginInv,
+/*N*/ (xub_StrLen)nEndInv );
+/*N*/ *pStrm >> nCount;
+/*N*/ for( USHORT i=0; Good() && i<nCount; i++ )
+/*N*/ {
+/*N*/ UINT32 nWrong;
+/*N*/ *pStrm >> nWrong;
+/*N*/ xub_StrLen nPos = (xub_StrLen)nWrong;
+/*N*/ xub_StrLen nLen = (xub_StrLen)(0xFFFF & (nWrong >> 16));
+/*N*/ pWrong->Insert( nPos, nLen, pWrong->Count() );
+/*N*/ }
+/*N*/ if( bSpellAllAgain )
+/*N*/ pWrong->SetInvalid( 0, STRING_MAXLEN );
+/*N*/ if( bSpellWrongAgain )
+/*N*/ pWrong->InvalidateWrong();
+/*N*/ CloseRec( SWG_WRONGLIST );
+/*N*/ }
+/*N*/ else
+/*N*/ SkipRec();
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*?*/ SkipRec();
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( SWG_TEXTNODE );
+/*N*/
+/*N*/ // Eventuell den Text konvertieren
+/*N*/ if( !bConverted )
+/*N*/ ConvertText( *pNd, aText8, (xub_StrLen)nOffsetL,
+/*N*/ pCharSetColorEncs, pCharSetColorPoss );
+/*N*/
+/*N*/ // Numerierung uebernehmen
+/*N*/ if( !IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ if( cNumLevel != NO_NUMBERING )
+/*N*/ {
+/*N*/ // MAXLEVEL war im 3.1/4.0-SW 5 und kann sich nichr mehr aendern,
+/*N*/ // deshalb baruchen wir es nicht zu beachten.
+/*N*/ #if 0
+/*N*/ if( cNumLevel != NO_NUM && GetRealLevel(cNumLevel) >= MAXLEVEL )
+/*N*/ {
+/*N*/ // die Numerierungs-Ebene ist zu hoch => die hoecht moegliche
+/*N*/ // setzen
+/*N*/ BYTE cTmp = MAXLEVEL-1;
+/*N*/ if( cNumLevel & NO_NUMLEVEL )
+/*N*/ cTmp |= NO_NUMLEVEL;
+/*N*/ cNumLevel = cTmp;
+/*N*/ }
+/*N*/ #endif
+/*N*/ pNd->UpdateNum( SwNodeNum( cNumLevel ) );
+/*N*/ }
+/*N*/ else
+/*N*/ CloseNumRange40( rPos );
+/*N*/ }
+/*N*/
+/*N*/ const SwNodeNum *pNdNum = pNd->GetNum();
+/*N*/ const SwAttrSet *pAttrSet = pNd->GetpSwAttrSet();
+/*N*/ if( pNdNum && IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ if( pAttrSet )
+/*N*/ {
+/*N*/ // Wenn der Absatz numeriert ist, muss die zugehoerige Numerierung
+/*N*/ // noch als benutzt markiert werden bzw. eine automatische
+/*N*/ // Numerierung beim Einfuegen umbenannt werden. Da automatische
+/*N*/ // Numerierungen nicht in Vorlagen vorkommen koennen, gehen
+/*N*/ // wir hier ueber das Attribut im Node-AttrSet und damit direkt
+/*N*/ // an unser Namens-Array.
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_PARATR_NUMRULE,
+/*N*/ FALSE, &pItem ) )
+/*N*/ {
+/*N*/ const String& rName = ((const SwNumRuleItem*)pItem)->GetValue();
+/*N*/ if( rName.Len() )
+/*N*/ {
+/*N*/ Sw3NumRuleInfo aTmp( rName );
+/*N*/ USHORT nPos;
+/*N*/ if( aNumRuleInfos.Seek_Entry( &aTmp, &nPos ) )
+/*N*/ {
+/*N*/ Sw3NumRuleInfo *pInfo = aNumRuleInfos[nPos];
+/*N*/ if( !bNormal || bInsert )
+/*N*/ {
+/*N*/ // Beim Einfuegen oder Laden von Seitenvorlagen
+/*N*/ // muss das Item evtl. noch an den geaenderten Namen
+/*N*/ // der Seiten-Vorlage angepasst werden.
+/*?*/ pInfo->SetUsed();
+/*?*/ if( rName != pInfo->GetNewName() )
+/*?*/ {
+/*?*/ ((SwCntntNode *)pNd)
+/*?*/ ->SetAttr( SwNumRuleItem(pInfo->GetNewName()) );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Die entsprechende NumRule wird benutzt und braucht
+/*N*/ // nicht mehr geloescht zu werden. Also raus aus
+/*N*/ // dem Array damit.
+/*N*/ aNumRuleInfos.Remove( nPos, 1 );
+/*N*/ delete pInfo;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ SwNodeNum aNodeNum( NO_NUMBERING );
+/*?*/ pNd->UpdateNum( aNodeNum );
+/*?*/ pNdNum = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bPageDescs && !bNumRules )
+/*N*/ {
+/*N*/ // Wenn Seiten-Vorlagen aber keine Numerierungs-Vorlagen
+/*N*/ // geladen werden, dann muessen wir sicherstellen, dass
+/*N*/ // die Numerierungs-Vorlage auch existiert.
+/*?*/ const SfxPoolItem* pItem =
+/*?*/ pNd->GetNoCondAttr( RES_PARATR_NUMRULE, TRUE );
+/*?*/ if( pItem && ((SwNumRuleItem*)pItem)->GetValue().Len() &&
+/*?*/ !pDoc->FindNumRulePtr( ((SwNumRuleItem*)pItem)->GetValue() ) )
+/*?*/ {
+/*?*/ const String& rName = ((SwNumRuleItem*)pItem)->GetValue();
+/*?*/ USHORT nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( rName, GET_POOLID_NUMRULE );
+/*?*/ if( nPoolId != USHRT_MAX )
+/*?*/ pDoc->GetNumRuleFromPool( nPoolId );
+/*?*/ else
+/*?*/ pDoc->MakeNumRule( rName );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ // Wenn der Absatz ein LRSpace-Item enthaelt und in der Kapitel-Numerierung
+/*N*/ // ist muss das LRSpace-Item noch angepasst werden. Relative Werte
+/*N*/ // koennen dabei nicht vorkommen.
+/*N*/ const SwNumRule *pOutline = pDoc->GetOutlineNumRule();
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if( pAttrSet && (!pNdNum || NO_NUMBERING != pNdNum->GetLevel()) &&
+/*N*/ NO_NUMBERING != pColl->GetOutlineLevel() &&
+/*N*/ pOutline && nVersion != SWG_NUMRELSPACE )
+/*N*/ {
+/*N*/ const SwNumFmt& rNumFmt = pOutline->Get(
+/*N*/ GetRealLevel(((const SwTxtFmtColl*)pColl)->GetOutlineLevel()) );
+/*N*/ USHORT nNumLSpace = rNumFmt.GetAbsLSpace();
+/*N*/
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_LR_SPACE, FALSE,
+/*N*/ &pItem ) )
+/*N*/ {
+/*N*/ const SvxLRSpaceItem *pParaLRSpace =
+/*N*/ (const SvxLRSpaceItem *)pItem;
+/*N*/
+/*N*/ USHORT nWishLSpace = (USHORT)pParaLRSpace->GetTxtLeft();
+/*N*/ USHORT nNewLSpace =
+/*N*/ nWishLSpace > nNumLSpace ? nWishLSpace-nNumLSpace : 0U;
+/*N*/
+/*N*/ const SvxLRSpaceItem& rCollLRSpace = pColl->GetLRSpace();
+/*N*/ if( nNewLSpace == rCollLRSpace.GetTxtLeft() &&
+/*N*/ pParaLRSpace->GetRight() == rCollLRSpace.GetRight() &&
+/*N*/ pParaLRSpace->GetTxtFirstLineOfst() ==
+/*N*/ rCollLRSpace.GetTxtFirstLineOfst() )
+/*N*/ {
+/*N*/ pNd->ResetAttr( RES_LR_SPACE );
+/*N*/ }
+/*N*/ else if( nNewLSpace != pParaLRSpace->GetTxtLeft() )
+/*N*/ {
+/*?*/ SvxLRSpaceItem aLRSpace( *pParaLRSpace );
+/*?*/ short nFirst = aLRSpace.GetTxtFirstLineOfst();
+/*?*/ if( nFirst < 0 && (USHORT)-nFirst > nNewLSpace )
+/*?*/ aLRSpace.SetTxtFirstLineOfst( -(short)nNewLSpace );
+/*?*/ aLRSpace.SetTxtLeft( nNewLSpace );
+/*?*/ ((SwCntntNode *)pNd)->SetAttr( aLRSpace );
+/*N*/ }
+/*N*/
+/*N*/ if( !IsVersion(SWG_NUMRELSPACE) && nWishLSpace != nNewLSpace )
+/*N*/ lcl_sw3io__ConvertNumTabStop( *pNd, (long)nWishLSpace -
+/*N*/ (long)nNewLSpace, FALSE );
+/*N*/ }
+/*N*/ else if( nNumLSpace > 0 && !IsVersion(SWG_NUMRELSPACE) )
+/*N*/ {
+/*N*/ lcl_sw3io__ConvertNumTabStop( *pNd, nNumLSpace, FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/
+/*N*/ if( pINetFldTexts )
+/*N*/ {
+/*N*/ ASSERT( pINetFldPoss, "INet-Feld-Texte ohne Positionen???" );
+/*N*/
+/*N*/ // Es mussen noch Texte von Internet-Feldern eingefuegt werden
+/*N*/
+/*N*/ INT32 nOffset2 = 0; // Verschiebung durch die Felder selbst
+/*N*/
+/*N*/ for( USHORT i=0; i<pINetFldTexts->Count(); i++ )
+/*N*/ {
+/*N*/ const String &rStr = *(*pINetFldTexts)[i];
+/*N*/
+/*N*/ // den Text hinter dem 0xff vom Feld einfuegen
+/*N*/ xub_StrLen nPos = xub_StrLen( nOffset2 + nOffset +
+/*N*/ (*pINetFldPoss)[i] + 1 );
+/*N*/ SwIndex aOff( pNd, nPos );
+/*N*/
+/*N*/ if( rStr.Len() )
+/*N*/ {
+/*N*/ pNd->Insert( rStr, aOff );
+/*N*/ }
+/*N*/
+/*N*/ // und das 0xff loeschen
+/*N*/ aOff.Assign( pNd, nPos-1 );
+/*N*/ pNd->Erase( aOff, 1 );
+/*N*/
+/*N*/ // und den Offset korrigieren
+/*N*/ nOffset2 += rStr.Len();
+/*N*/ nOffset2--;
+/*N*/ }
+/*N*/
+/*N*/ // die Wrong-Liste ist jetzt ungueltig
+/*N*/ delete pWrong;
+/*N*/ pWrong = 0;
+/*N*/ cFlags &= 0xdf;
+/*N*/
+/*N*/ // und die Array loeschen
+/*N*/ delete pINetFldTexts;
+/*N*/ delete pINetFldPoss;
+/*N*/ }
+/*N*/
+/*N*/ if( pErasePoss )
+/*N*/ {
+/*N*/ // Es mussen noch 0xff-Zeichen aus dem Node geloescht werden
+/*?*/ USHORT i = pErasePoss->Count();
+/*?*/ while( i )
+/*?*/ {
+/*?*/ xub_StrLen nPos = (*pErasePoss)[--i];
+/*?*/
+/*?*/ ASSERT( CH_TXTATR_BREAKWORD == pNd->GetTxt().GetChar( nPos ) ||
+/*?*/ CH_TXTATR_INWORD == pNd->GetTxt().GetChar( nPos ),
+/*?*/ "Es sollten nur 0xff geloescht werden" );
+/*?*/
+/*?*/ SwIndex aOff( pNd, nPos );
+/*?*/ pNd->Erase( aOff, 1 );
+/*?*/ }
+/*?*/
+/*?*/
+/*?*/ // die Wrong-Liste ist jetzt ungueltig
+/*?*/ delete pWrong;
+/*?*/ pWrong = 0;
+/*?*/ cFlags &= 0xdf;
+/*?*/
+/*?*/ delete pErasePoss;
+/*N*/ }
+/*N*/
+/*N*/ // Wrong-Liste uebernehmen
+/*N*/ // ACHTUNG: dirty-bit wird invers gespeichert weil in alten Doks 0 steht
+/*N*/ BOOL bWrongDirty = ( ( cFlags & 0x20 ) == 0 ) ||
+/*N*/ nVersion < SWG_DESKTOP40 ||
+/*N*/ bSpellAllAgain || bSpellWrongAgain;
+/*N*/ pNd->SetWrongDirty( bWrongDirty );
+/*N*/ pNd->SetWrong( pWrong );
+/*N*/
+/*N*/ // Condition-Collections setzen:
+/*N*/ if( IDX_DFLT_VALUE != nCondColl )
+/*N*/ {
+/*?*/ if( bInsert )
+/*?*/ {
+/*?*/ // dann muss die richtige Collection neu bestimmt werden!
+/*?*/ pNd->ChkCondColl();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ SwTxtFmtColl* pCColl = FindTxtColl( nCondColl );
+/*?*/ pNd->SetCondFmtColl( pCColl );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( pNdNum && NO_NUMBERING != pNdNum->GetLevel() &&
+/*N*/ IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ // In Dokumenten, in denen der Einzug einer Numerierung noch
+/*N*/ // absolut war, muss der Absatz-Einzug noch angepasst werden.
+/*N*/ // Weil man dazu die bedingte Vorlage braucht, darf das erst
+/*N*/ // hier geschehen.
+/*N*/ const SwNumRule *pNumRule = pNd->GetNumRule();
+/*N*/ if( pNumRule )
+/*N*/ lcl_sw3io__ConvertNumLRSpace( *pNd, *pNumRule,
+/*N*/ pNdNum->GetLevel(),
+/*N*/ !IsVersion(SWG_NUMRELSPACE) );
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ rPos++;
+/*N*/ }
+
+// Zaehlen der Worte eines Nodes
+//!! Wird auch vom SW2-Reader benutzt!!
+
+/*N*/ void sw3io_countwords( const String& rDelimWrd, const String& rStr,
+/*N*/ ULONG &rWords, ULONG &rChars )
+/*N*/ {
+/*N*/ FASTBOOL bInWord = FALSE;
+/*N*/ USHORT nSpChars = 0;
+/*N*/
+/*N*/ for( xub_StrLen nPos = 0; nPos < rStr.Len(); nPos++ )
+/*N*/ {
+/*N*/ sal_Unicode c = rStr.GetChar( nPos );
+/*N*/ switch( c )
+/*N*/ {
+/*N*/ case CH_TXTATR_BREAKWORD:
+/*N*/ case CH_TXTATR_INWORD:
+/*N*/ ++nSpChars;
+/*N*/ break;
+/*N*/
+/*N*/ case 0x0A:
+/*N*/ ++nSpChars;
+/*N*/ if ( bInWord )
+/*N*/ {
+/*N*/ rWords++;
+/*N*/ bInWord = FALSE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ if( rDelimWrd.Search( c ) == STRING_NOTFOUND )
+/*N*/ bInWord = TRUE;
+/*N*/ else if ( bInWord )
+/*N*/ {
+/*N*/ rWords++;
+/*N*/ bInWord = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bInWord )
+/*N*/ rWords++;
+/*N*/ rChars += rStr.Len() - nSpChars;
+/*N*/ }
+
+/*N*/ SwInsHardBlankSoftHyph::~SwInsHardBlankSoftHyph()
+/*N*/ {
+/*N*/ for( USHORT n = 0, nCnt = aItems.Count(); n < nCnt; ++n )
+/*N*/ delete aItems[ n ];
+/*N*/ }
+/*N*/ void SwInsHardBlankSoftHyph::AddItem( xub_StrLen nPos, sal_Unicode c )
+/*N*/ {
+/*N*/ SfxPoolItem* pItem = 0;
+/*N*/ switch ( c )
+/*N*/ {
+/*N*/ case CHAR_HARDBLANK: pItem = new SwFmtHardBlank( ' ', FALSE ); break;
+/*?*/ case CHAR_HARDHYPHEN: pItem = new SwFmtHardBlank( '-', FALSE ); break;
+/*N*/ case CHAR_SOFTHYPHEN: pItem = new SwFmtSoftHyph; break;
+/*N*/ }
+/*N*/ if( pItem )
+/*N*/ {
+/*N*/ USHORT nInsPos = aItemStarts.Count();
+/*N*/ aItemStarts.Insert( nPos, nInsPos );
+/*N*/ aItems.C40_INSERT( SfxPoolItem, pItem, nInsPos );
+/*N*/ }
+/*N*/ }
+/*N*/ void SwInsHardBlankSoftHyph::ChangePos( xub_StrLen nHtEnd, xub_StrLen nOffs )
+/*N*/ {
+/*N*/ for( USHORT n = 0, nCnt = aItemStarts.Count(); n < nCnt; ++n )
+/*N*/ {
+/*?*/ xub_StrLen& rStt = aItemStarts[ n ];
+/*?*/ if( rStt >= nHtEnd )
+/*?*/ rStt -= nOffs;
+/*N*/ }
+/*N*/ }
+/*N*/ void SwInsHardBlankSoftHyph::OutAttr( Sw3IoImp& rIo, xub_StrLen nStt,
+/*N*/ xub_StrLen nEnd )
+/*N*/ {
+/*N*/ for( USHORT n = 0, nCnt = aItemStarts.Count(); n < nCnt; ++n )
+/*N*/ {
+/*N*/ xub_StrLen nHtStt = aItemStarts[ n ];
+/*N*/ if( nHtStt >= nStt && nHtStt < nEnd )
+/*N*/ {
+/*N*/ nHtStt -= nStt;
+/*N*/ const SfxPoolItem* pAttr = aItems[ n ];
+/*N*/ rIo.OutAttr( *pAttr, nHtStt, nHtStt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ Sw3ExportTxtAttrs *Sw3IoImp::ExportTxtNode( const SwTxtNode& rNd,
+/*N*/ xub_StrLen nStart, xub_StrLen nEnd,
+/*N*/ rtl_TextEncoding eEnc,
+/*N*/ SwInsHardBlankSoftHyph& rHBSH )
+/*N*/ {
+/*N*/ USHORT nCntAttr = rNd.HasHints() ? rNd.GetSwpHints().Count() : 0;
+/*N*/ if( !nCntAttr )
+/*N*/ return 0;
+/*N*/
+/*N*/ // Erstmal nachschauen, ob es ueberhaupt Hints gibt, die einen Export
+/*N*/ // erfordern. Der zusaetzliche Schleifendurchlauf sollte sich in den
+/*N*/ // meisten Faellen lohnen, weil keine Arrays gewartet werden muessen.
+/*N*/ USHORT n;
+/*N*/ BOOL bExport = FALSE;
+/*N*/ for( n = 0; !bExport && n < nCntAttr; n++ )
+/*N*/ {
+/*N*/ const SwTxtAttr* pHt = rNd.GetSwpHints()[n];
+/*N*/ BOOL bHtEnd = BOOL( pHt->GetEnd() != NULL );
+/*N*/ xub_StrLen nHtStart = *pHt->GetStart();
+/*N*/ xub_StrLen nHtEnd = *pHt->GetAnyEnd();
+/*N*/
+/*N*/ if( (bHtEnd && nHtEnd > nStart && nHtStart < nEnd) ||
+/*N*/ (!bHtEnd && nHtStart >= nStart && nHtStart < nEnd ) )
+/*N*/ {
+/*N*/ switch( pHt->GetAttr().Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_INETFMT:
+/*N*/ // SwFmtINetFmt-Attribute werden als Felder exportiert
+/*N*/ bExport = TRUE;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_FIELD:
+/*N*/ {
+/*N*/ // alle neuen Felder (ab Script-Feld) werden ignoriert
+/*N*/ const SwFmtFld& rFmtFld =
+/*N*/ (const SwFmtFld&)pHt->GetAttr();
+/*N*/ bExport = rFmtFld.GetFld()->Which() >= RES_SCRIPTFLD;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_FLYCNT:
+/*N*/ {
+/*N*/ // zeichengebunde Draw-Formate werden absatz-gebunden
+/*N*/ const SwFmtFlyCnt& rFlyCnt =
+/*N*/ (const SwFmtFlyCnt&)pHt->GetAttr();
+/*N*/ bExport = RES_DRAWFRMFMT == rFlyCnt.GetFrmFmt()->Which();
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !bExport )
+/*N*/ return 0;
+/*N*/
+/*N*/ Sw3ExportTxtAttrs *pInfo = new Sw3ExportTxtAttrs;
+/*N*/ xub_StrLen nINetFmtStart = 0, nINetFmtEnd = 0;
+/*N*/ for( n = 0; n < nCntAttr; n++ )
+/*N*/ {
+/*N*/ const SwTxtAttr* pHt = rNd.GetSwpHints()[n];
+/*N*/ BOOL bHtEnd = BOOL( pHt->GetEnd() != NULL );
+/*N*/ xub_StrLen nHtStart = *pHt->GetStart();
+/*N*/ xub_StrLen nHtEnd = *pHt->GetAnyEnd();
+/*N*/
+/*N*/ if( (bHtEnd && nHtEnd > nStart && nHtStart < nEnd) ||
+/*N*/ (!bHtEnd && nHtStart >= nStart && nHtStart < nEnd) )
+/*N*/ {
+/*N*/ // Der Hint liegt zumindest teilweise im Text
+/*N*/ const SfxPoolItem& rAttr = pHt->GetAttr();
+/*N*/ BOOL bInsert = FALSE, bSplit = FALSE;
+/*N*/
+/*N*/ USHORT nWhich = rAttr.Which();
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_TXTATR_INETFMT:
+/*N*/ // leere SwFmtINetFmt-Hint koennen und muessen ignoriert
+/*N*/ // werden
+/*N*/ if( nHtStart != nHtEnd )
+/*N*/ {
+/*N*/ if( nHtStart >= nINetFmtEnd )
+/*N*/ {
+/*N*/ // das SwFmtINetFmt ist auf dem Top-Level
+/*N*/ nINetFmtStart = nHtStart;
+/*N*/ nINetFmtEnd = nHtEnd;
+/*N*/ bInsert = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // die SwFmtINetFmt-Attribute sind geschachtelt,
+/*N*/ // das auessere muss gesplittet werden
+/*N*/ ASSERT( nHtEnd <= nINetFmtEnd,
+/*N*/ "Seit wann koennen sich gleiche Attribute ueberlappen?" );
+/*N*/ bSplit = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ // laut AMA werden alle anderen Attribute an den Grenzen
+/*N*/ // von SwFmtINetFmt-Attributen aufgespannt. Wenn das mal
+/*N*/ // doch nicht der Fall ist, gibt's einen
+/*N*/ ASSERT( nHtStart >= nINetFmtEnd || nHtEnd <= nINetFmtEnd,
+/*N*/ "Ein Attribut ueberlappt sich mit einen SwFmtINetFmt" );
+/*N*/
+/*N*/ // Attribute im inneren eines SwFmtINetFmt werden ignoriert,
+/*N*/ // es sein denn, die spannen genau den Bereich des
+/*N*/ // SwFmtINetFmts auf
+/*N*/ if( nHtStart >= nINetFmtEnd ||
+/*N*/ (nHtStart == nINetFmtStart && nHtEnd == nINetFmtEnd) )
+/*N*/ {
+/*N*/ // das Attribut beginnt erst hinter einen SwFmtINetFmt
+/*N*/ // oder spannt exakt den gleichen Bereich auf
+/*N*/ bInsert = TRUE;
+/*N*/ }
+/*N*/ else if( RES_TXTATR_NOEND_BEGIN <= nWhich &&
+/*N*/ RES_TXTATR_NOEND_END > nWhich )
+/*N*/ {
+/*N*/ // ein Hint ohne Ende muss auch immer eingefuegt werden
+/*N*/ bSplit = TRUE;
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( bInsert )
+/*N*/ {
+/*N*/ // das Item als letztes an seiner Start-Position beginnen,
+/*N*/ // aber in jedem Fall vor einem SwFmtINetFmt
+/*N*/ USHORT nAPos = pInfo->aItemStarts.Count();
+/*N*/ while( nAPos > 0 &&
+/*N*/ ( (pInfo->aItemStarts[nAPos-1] > nHtStart) ||
+/*N*/ (pInfo->aItemStarts[nAPos-1] == nHtStart &&
+/*N*/ RES_TXTATR_INETFMT==pInfo->aItems[nAPos-1]->Which()) ) )
+/*N*/ nAPos--;
+/*N*/
+/*N*/ pInfo->aItemStarts.Insert( nHtStart, nAPos );
+/*N*/ pInfo->aItemEnds.Insert( nHtEnd, nAPos );
+/*N*/ const SfxPoolItem *pItem = &rAttr;
+/*N*/ pInfo->aItems.C40_INSERT( SfxPoolItem, pItem, nAPos );
+/*N*/ }
+/*N*/ else if( bSplit )
+/*N*/ {
+/*N*/ // Ein anderes SwFmtINetFmt splitten. Dazu muss zunaechst
+/*N*/ // das umgebende gesucht werden.
+/*?*/ USHORT nAPos = pInfo->aItemStarts.Count();
+/*?*/ while( nAPos > 0 && pInfo->aItemStarts[nAPos-1] > nHtStart )
+/*?*/ nAPos--;
+/*?*/
+/*?*/ // es muss ein Attribut geben, das zuvor geoffent wurde
+/*?*/ ASSERT( nAPos, "kein Attribut gefunden" );
+/*?*/ if( !nAPos )
+/*?*/ continue;
+/*?*/ nAPos--;
+/*?*/
+/*?*/ // Das unmittlabr vor der aktuellen Position geoffente
+/*?*/ // Attribut kann auch ein Text-Attribut ohen Ende sein
+/*?*/ const SfxPoolItem *pLastItem = pInfo->aItems[nAPos];
+/*?*/ if( RES_TXTATR_NOEND_BEGIN <= pLastItem->Which() &&
+/*?*/ RES_TXTATR_NOEND_END > pLastItem->Which())
+/*?*/ {
+/*?*/ ASSERT( bHtEnd, "zwei Hints ohne Ende an gleicher Pos.?" );
+/*?*/ // es muss dann aber an der aktuellen Position beginnen
+/*?*/ ASSERT( pInfo->aItemStarts[nAPos]==nHtStart,
+/*?*/ "Text-Attribut ohne Ende an falscher Position" );
+/*?*/ if( pInfo->aItemStarts[nAPos]==nHtStart )
+/*?*/ continue;
+/*?*/
+/*?*/ // das Feld ein Zeichen spater beginnen
+/*?*/ nHtStart++;
+/*?*/ if( nHtStart-nHtEnd == 0 )
+/*?*/ continue;
+/*?*/
+/*?*/ nAPos++;
+/*?*/ ASSERT( nAPos<pInfo->aItems.Count(),
+/*?*/ "Wo ist das SwFmtINetFmt geblieben?" );
+/*?*/ pLastItem = pInfo->aItems[nAPos];
+/*?*/ }
+/*?*/
+/*?*/ // muss ein SwFmtINetFmt-Attribut sein!
+/*?*/ xub_StrLen nLastEnd = pInfo->aItemEnds[nAPos];
+/*?*/ ASSERT( RES_TXTATR_INETFMT==pLastItem->Which(),
+/*?*/ "das umgebende Item muesste ein SwFmtINetFmt sein!!" );
+/*?*/ if( !RES_TXTATR_INETFMT==pLastItem->Which() )
+/*?*/ continue;
+/*?*/
+/*?*/ // das bisherige Attribut vorzeitig beenden, wenn es dann
+/*?*/ // nicht leer ist und sonst loeschen.
+/*?*/ if( pInfo->aItemStarts[nAPos] < nHtStart )
+/*?*/ {
+/*?*/ pInfo->aItemEnds[nAPos] = nHtStart;
+/*?*/ nAPos++;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pInfo->aItemStarts.Remove( nAPos, 1 );
+/*?*/ pInfo->aItemEnds.Remove( nAPos, 1 );
+/*?*/ pInfo->aItems.Remove( nAPos, 1 );
+/*?*/ }
+/*?*/
+/*?*/ // jetzt fuegen wir das neue Attribut ein
+/*?*/ pInfo->aItemStarts.Insert( nHtStart, nAPos );
+/*?*/ pInfo->aItemEnds.Insert( nHtEnd, nAPos );
+/*?*/ const SfxPoolItem *pItem = &rAttr;
+/*?*/ pInfo->aItems.C40_INSERT( SfxPoolItem, pItem, nAPos );
+/*?*/ nAPos++;
+/*?*/
+/*?*/ // und noch den Rest von dem alten Attribut, wenn er nicht
+/*?*/ // leer ist
+/*?*/ if( !bHtEnd )
+/*?*/ nHtEnd++;
+/*?*/ if( nHtEnd < nLastEnd )
+/*?*/ {
+/*?*/ pInfo->aItemStarts.Insert( nHtEnd, nAPos );
+/*?*/ pInfo->aItemEnds.Insert( nLastEnd, nAPos );
+/*?*/ pInfo->aItems.C40_INSERT( SfxPoolItem, pLastItem, nAPos );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // jetzt muessen noch der Text und die Positionen der Hints angepasst
+/*N*/ // werden
+/*N*/ String aText( rNd.GetTxt() );
+/*N*/ const SvxFontItem& rFont = rNd.GetSwAttrSet().GetFont();
+/*N*/ ConvertText( pInfo->aText, aText, 0, (SwTxtNode& )rNd, eEnc,
+/*N*/ rFont,
+/*N*/ &rHBSH, TRUE );
+/*N*/ for( USHORT nAPos=0; nAPos<pInfo->aItems.Count(); nAPos++ )
+/*N*/ {
+/*N*/ const SfxPoolItem *pAttr = pInfo->aItems[nAPos];
+/*N*/ xub_StrLen nHtStart = pInfo->aItemStarts[nAPos];
+/*N*/ xub_StrLen nHtEnd = pInfo->aItemEnds[nAPos];
+/*N*/ xub_StrLen nOffs = 0;
+/*N*/ BOOL bRemoveTxtAttr = FALSE;
+/*N*/ switch( pAttr->Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_INETFMT:
+/*N*/ // wieviel muss gelosecht werden ?
+/*N*/ nOffs = (nHtEnd - nHtStart) - 1;
+/*N*/
+/*N*/ // den Text ses SwFmtINetFmt merken
+/*N*/ pInfo->aINetFmtTexts.Insert(
+/*N*/ new ByteString( pInfo->aText.Copy( nHtStart, nOffs+1 ) ),
+/*N*/ pInfo->aINetFmtTexts.Count() );
+/*N*/
+/*N*/ // und noch den auszugebenden Text anpassen
+/*N*/ pInfo->aText.SetChar( nHtStart, '\xff' );
+/*N*/ nHtStart++;
+/*N*/ break;
+/*N*/
+/*?*/ case RES_TXTATR_FIELD:
+/*?*/ {
+/*?*/ const SwFmtFld *pFmtFld =
+/*?*/ (const SwFmtFld *)pAttr;
+/*?*/ if( pFmtFld->GetFld()->Which() >= RES_SCRIPTFLD )
+/*?*/ bRemoveTxtAttr = TRUE;
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case RES_TXTATR_FLYCNT:
+/*?*/ {
+/*?*/ const SwFmtFlyCnt *pFlyCnt = (const SwFmtFlyCnt *)pAttr;
+/*?*/ if( RES_DRAWFRMFMT == pFlyCnt->GetFrmFmt()->Which() )
+/*?*/ {
+/*?*/ bRemoveTxtAttr = TRUE;
+/*?*/ pInfo->nDrawFrmFmts++;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( bRemoveTxtAttr )
+/*N*/ {
+/*?*/ nOffs = 1;
+/*?*/ nHtEnd += 1;
+/*?*/ pInfo->aItemStarts.Remove( nAPos, 1 );
+/*?*/ pInfo->aItemEnds.Remove( nAPos, 1 );
+/*?*/ pInfo->aItems.Remove( nAPos, 1 );
+/*?*/ nAPos--; // nicht schoen, aber wirksam
+/*N*/ }
+/*N*/
+/*N*/ // die Start- und Ende-Positionen korregieren
+/*N*/ if( nOffs )
+/*N*/ {
+/*N*/ for( USHORT i=0; i<pInfo->aItems.Count(); i++ )
+/*N*/ {
+/*N*/ if( pInfo->aItemStarts[i] >= nHtEnd )
+/*N*/ pInfo->aItemStarts[i] -= nOffs;
+/*N*/ if( pInfo->aItemEnds[i] >= nHtEnd )
+/*N*/ pInfo->aItemEnds[i] -= nOffs;
+/*N*/ }
+/*N*/
+/*N*/ rHBSH.ChangePos( nHtEnd, nOffs );
+/*N*/ pInfo->aText.Erase( nHtStart, nOffs );
+/*N*/
+/*N*/ if( nEnd != STRING_LEN )
+/*N*/ nEnd -= nOffs;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nEnd == STRING_LEN || nEnd < nStart )
+/*N*/ nEnd = pInfo->aText.Len();
+/*N*/ else if ( nEnd != pInfo->aText.Len() )
+/*?*/ pInfo->aText.Erase( nEnd );
+/*N*/ if( nStart )
+/*?*/ pInfo->aText.Erase( 0, nStart );
+/*N*/
+/*N*/ return pInfo;
+/*N*/ }
+
+
+/*N*/ void lcl_sw3io__ConvertNumTabStop( const SwCntntNode& rCNd, long nOffset,
+/*N*/ SfxItemSet& rItemSet )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == rCNd.GetSwAttrSet().GetItemState(
+/*N*/ RES_PARATR_TABSTOP, TRUE, &pItem ))
+/*N*/ {
+/*N*/ SvxTabStopItem aTStop( *(SvxTabStopItem*)pItem );
+/*N*/ lcl_sw3io__ConvertNumTabStop( aTStop, nOffset );
+/*N*/ rItemSet.Put( aTStop );
+/*N*/ }
+/*N*/ }
+
+// Text Node:
+// BYTE Flags
+// 0x10 - mit Numerierung
+// 0x20 - Wrong-Liste ist nicht dirty
+// UINT16 String-Index der Absatzvorlage
+// BYTE Numerierungs-Level (opt.)
+// String Text
+// SWG_ATTRSET eigene Attribute (opt.)
+// SWG_FLYFMT FlyFrame (opt).
+// SWG_SDRFMT Drawing-Objekt (opt).
+// SWG_TEXTATTR harte Attribute (opt, mehrfach).
+// SWG_WRONGLIST Liste falscher Worte (opt)
+
+/*N*/ void Sw3IoImp::OutTxtNode
+/*N*/ ( SwCntntNode & rNode, xub_StrLen nStart, xub_StrLen nEnd, ULONG nPosIdx )
+/*N*/ {
+/*N*/ SwTxtNode *pNd = &((SwTxtNode&) rNode );
+/*N*/ const SwFmtColl* pColl = &pNd->GetAnyFmtColl();
+/*N*/ ASSERT( pColl != pDoc->GetDfltTxtFmtColl(),
+/*N*/ "the default text format collection isn't allowed on a node" );
+/*N*/ BOOL bNewNumRule = FALSE;
+/*N*/ // 0x0L: Laenge der Daten
+/*N*/ // 0x10: Numerierung folgt (nur 3.1/4.0)
+/*N*/ // 0x20: Wrong-Liste ist nicht dirty
+/*N*/ BYTE cFlags = IsSw31Export() ? 0x02 : 0x04; // CollIdx & CondCollIdx
+/*N*/ USHORT nColl = aStringPool.Add( pColl->GetName(),
+/*N*/ pColl->GetPoolFmtId() );
+/*N*/ BYTE cNumLevel = NO_NUMBERING;
+/*N*/
+/*N*/ // Numerierungsregel fuer 3.1/4.0-Export ermitteln
+/*N*/ const SwNodeNum *pNdNum = pNd->GetNum();
+/*N*/ #ifdef DBG_UTIL
+/*N*/ {
+/*N*/ const SwNumRule* pNumRule = pNd->GetNumRule();
+/*N*/ ASSERT( pNumRule ? pNdNum!=0 : TRUE,
+/*N*/ "Node hat NumRule aber kein NodeNum" );
+/*N*/ ASSERT( pNdNum ? pNumRule!=0 : TRUE,
+/*N*/ "Node hat NodeNum aber keine NumRule" );
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ SfxItemSet *pExportAttrSet = 0;
+/*N*/ const SfxItemSet *pAttrSet = rNode.GetpSwAttrSet();
+/*N*/
+/*N*/ if( pNdNum && pNdNum->GetLevel() != NO_NUMBERING )
+/*N*/ {
+/*N*/ const SwNumRule* pNumRule = pNd->GetNumRule();
+/*N*/ if( pNumRule )
+/*N*/ {
+/*N*/ cNumLevel = pNdNum->GetLevel();
+/*N*/ BYTE cRealLevel = GetRealLevel( cNumLevel );
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ if( cRealLevel >= OLD_MAXLEVEL )
+/*N*/ {
+/*N*/ // Die Numerierungs-Ebene ist zu hoch => die
+/*N*/ // hoechst moegliche setzen
+/*N*/ BYTE cTmp = OLD_MAXLEVEL-1;
+/*N*/ if( cNumLevel & NO_NUMLEVEL )
+/*N*/ cTmp |= NO_NUMLEVEL;
+/*N*/ cNumLevel = cTmp;
+/*N*/ }
+/*N*/ if( IsSw31Export() )
+/*N*/ cFlags += NO_NUMLEVEL & cNumLevel ? 0x12 : 0x11;
+/*N*/ else
+/*N*/ cFlags += 0x11;
+/*N*/ if( pNumRule != pCurNumRule )
+/*N*/ {
+/*N*/ // Dann vor dem betroffenen Node ausgeben
+/*N*/ pCurNumRule = (SwNumRule *)pNumRule;
+/*N*/
+/*N*/ //JP 06.10.95: falls SH mal wieder mit der Numerierung
+/*N*/ //durcheinander kommt
+/*N*/ // bNewNumRule = TRUE;
+/*N*/ bNewNumRule = 0 != pCurNumRule;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ // Den Erstzeilen-Einzug immer aus der NumRule uebernehmen
+/*N*/ // und als linken Einzug die Summe aus Absatz- und
+/*N*/ // NumRule-Einzug schreiben.
+/*N*/ const SwNumFmt& rNumFmt = pNumRule->Get( cRealLevel );
+/*N*/ const SvxLRSpaceItem& rLRSpace =
+/*N*/ (const SvxLRSpaceItem&)rNode.GetAttr(RES_LR_SPACE);
+/*N*/
+/*N*/ USHORT nLeft = rNumFmt.GetAbsLSpace();
+/*N*/ USHORT nOldLeft = (USHORT)rLRSpace.GetTxtLeft();
+/*N*/ if( !pNumRule->IsAbsSpaces() )
+/*N*/ nLeft += (USHORT)rLRSpace.GetTxtLeft();
+/*N*/ short nFirstLineOffset =
+/*N*/ (cNumLevel & NO_NUMLEVEL)==0 ? rNumFmt.GetFirstLineOffset() : 0;
+/*N*/ if( nLeft != rLRSpace.GetTxtLeft() ||
+/*N*/ nFirstLineOffset != rLRSpace.GetTxtFirstLineOfst() )
+/*N*/ {
+/*N*/ if( pAttrSet )
+/*N*/ pExportAttrSet = new SfxItemSet( *pAttrSet );
+/*N*/ else
+/*?*/ pExportAttrSet = new SfxItemSet( pDoc->GetAttrPool(),
+/*?*/ pColl->GetAttrSet().GetRanges() );
+/*N*/ pAttrSet = pExportAttrSet;
+/*N*/ SvxLRSpaceItem aLRSpace( rLRSpace );
+/*N*/ aLRSpace.SetTxtFirstLineOfst( nFirstLineOffset );
+/*N*/ aLRSpace.SetTxtLeft( nLeft );
+/*N*/
+/*N*/ pExportAttrSet->Put( aLRSpace );
+/*N*/
+/*N*/ if( IsSw31Or40Export() && nOldLeft != nLeft )
+/*N*/ lcl_sw3io__ConvertNumTabStop( rNode,
+/*N*/ (long)nOldLeft - (long)nLeft,
+/*N*/ *pExportAttrSet );
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ else if( IsSw31Or40Export() )
+/*N*/ pCurNumRule = NULL;
+/*N*/
+/*N*/ }
+/*N*/ else if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ pCurNumRule = NULL;
+/*N*/ }
+/*N*/
+/*N*/ // Wrong-List-Dirty-Flag (wird wegen alter doks invers gespeichert)
+/*N*/ if( !IsSw31Export() && !rNode.IsWrongDirty() )
+/*N*/ cFlags += 0x20;
+/*N*/
+/*N*/ OpenRec( SWG_TEXTNODE );
+/*N*/ *pStrm << cFlags << nColl;
+/*N*/ if( IsSw31Or40Export() && (cFlags & 0x10) )
+/*N*/ {
+/*N*/ // Frueher wurde hier fuer NO_NUMLEVEL noch ein NO_NUM
+/*N*/ // rausgeschrieben. Ist jetzt nicht mehr noetig.
+/*N*/ //if( NO_NUMLEVEL & cNumLevel )
+/*N*/ // *pStrm << (BYTE)NO_NUM << cNumLevel;
+/*N*/ //else
+/*N*/ if( IsSw31Export() && (NO_NUMLEVEL & cNumLevel) )
+/*?*/ *pStrm << (BYTE)NO_NUM << cNumLevel;
+/*N*/ else
+/*N*/ *pStrm << cNumLevel;
+/*N*/ }
+/*N*/
+/*N*/ // bedingte Vorlagen nicht beim SW31-Export rausschreiben
+/*N*/ if( !IsSw31Export() )
+/*N*/ {
+/*N*/ USHORT nCondColl = IDX_DFLT_VALUE;
+/*N*/ if( pNd->GetCondFmtColl() )
+/*N*/ {
+/*N*/ // dann die bedingte Vorlage schreiben!!
+/*?*/ pColl = pNd->GetFmtColl();
+/*?*/ nCondColl =
+/*?*/ aStringPool.Add( pColl->GetName(), pColl->GetPoolFmtId() );
+/*N*/ }
+/*N*/ *pStrm << nCondColl;
+/*N*/ }
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ // Wenn der Absatz ein LRSpace-Item enthaelt und in der Kapitel-Numerierung
+/*N*/ // ist muss das LRSpace-Item noch angepasst werden. Relative Werte
+/*N*/ // koennen dabei nicht vorkommen. Der Ertzeilen-Einzug geht verloren.
+/*N*/ const SwNumRule *pOutline = pDoc->GetOutlineNumRule();
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if( pAttrSet && (!pNdNum || NO_NUMBERING == pNdNum->GetLevel()) &&
+/*N*/ NO_NUMBERING != ((const SwTxtFmtColl *)pColl)->GetOutlineLevel() &&
+/*N*/ SFX_ITEM_SET == pAttrSet->GetItemState( RES_LR_SPACE, FALSE, &pItem ) &&
+/*N*/ pOutline )
+/*N*/ {
+/*?*/ const SvxLRSpaceItem *pParaLRSpace = (const SvxLRSpaceItem *)pItem;
+/*?*/
+/*?*/ const SwNumFmt& rNumFmt = pOutline->Get(
+/*?*/ GetRealLevel(((const SwTxtFmtColl *)pColl)->GetOutlineLevel()) );
+/*?*/ USHORT nLSpace = (USHORT)pParaLRSpace->GetTxtLeft();
+/*?*/ USHORT nOldLSpace = nLSpace;
+/*?*/ if( pOutline->IsAbsSpaces() )
+/*?*/ nLSpace = rNumFmt.GetAbsLSpace();
+/*?*/ else
+/*?*/ nLSpace += rNumFmt.GetAbsLSpace();
+/*?*/
+/*?*/ if( nLSpace != pParaLRSpace->GetTxtLeft() ||
+/*?*/ rNumFmt.GetFirstLineOffset()!=pParaLRSpace->GetTxtFirstLineOfst() )
+/*?*/ {
+/*?*/ if( !pExportAttrSet )
+/*?*/ {
+/*?*/ pExportAttrSet = new SfxItemSet( *pAttrSet );
+/*?*/ pAttrSet = pExportAttrSet;
+/*?*/ }
+/*?*/
+/*?*/ SvxLRSpaceItem aLRSpace( *pParaLRSpace );
+/*?*/ aLRSpace.SetTxtFirstLineOfst( rNumFmt.GetFirstLineOffset());
+/*?*/ aLRSpace.SetTxtLeft( nLSpace );
+/*?*/ pExportAttrSet->Put( aLRSpace );
+/*?*/
+/*?*/ if( IsSw31Or40Export() && nOldLSpace != nLSpace )
+/*?*/ lcl_sw3io__ConvertNumTabStop( rNode,
+/*?*/ (long)nOldLSpace - (long)nLSpace,
+/*?*/ *pExportAttrSet );
+/*?*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if( (nEnd == STRING_LEN ? pNd->GetTxt().Len() : nEnd) > STRING_MAXLEN52 )
+/*N*/ nEnd = STRING_MAXLEN52;
+/*N*/
+/*N*/ SwInsHardBlankSoftHyph aHBSH;
+/*N*/
+/*N*/ String aText;
+/*N*/ Sw3ExportTxtAttrs *pExpInfo = IsSw31Export()
+/*N*/ ? ExportTxtNode( *pNd, nStart, nEnd, eSrcSet, aHBSH )
+/*N*/ : 0;
+/*N*/
+/*N*/ ByteString aText8;
+/*N*/ if( !pExpInfo )
+/*N*/ {
+/*N*/ aText = pNd->GetTxt();
+/*N*/ if( nEnd == STRING_LEN || nEnd < nStart )
+/*N*/ nEnd = aText.Len();
+/*N*/ else if ( nEnd != aText.Len() )
+/*?*/ aText.Erase( nEnd );
+/*N*/ if( nStart )
+/*?*/ aText.Erase( 0, nStart );
+/*N*/ const SvxFontItem& rFont = pNd->GetSwAttrSet().GetFont();
+/*N*/ ConvertText( aText8, aText, nStart, *pNd, eSrcSet,
+/*N*/ rFont, &aHBSH, TRUE );
+/*N*/ }
+/*N*/ else
+/*N*/ aText8 = pExpInfo->aText;
+/*N*/
+/*N*/ if( aText.Len() )
+/*N*/ sw3io_countwords( aDefWordDelim, aText, aStat.nWord, aStat.nChar );
+/*N*/
+/*N*/ if( aText8.Len() && pCrypter )
+ pCrypter->Encrypt( aText8 );
+/*N*/ pStrm->WriteByteString( aText8 );
+/*N*/ aStat.nPara++;
+/*N*/
+/*N*/ if( pAttrSet )
+/*N*/ OutAttrSet( *pAttrSet );
+/*N*/ delete pExportAttrSet;
+/*N*/ pAttrSet = pExportAttrSet = 0;
+/*N*/ OutNodeMarks( nPosIdx );
+/*N*/
+/*N*/ // die absatzgebunden Rahmen schreiben und beim SW31-Export ggf. auch
+/*N*/ // noch die zeichengebunden Zeichen-Objekte als abstzgebundene Objekte
+/*N*/ OutNodeFlyFrames( nPosIdx );
+/*N*/ if( pExpInfo && pExpInfo->nDrawFrmFmts )
+ ExportNodeDrawFrmFmts( *pNd, nStart, nEnd, pExpInfo->nDrawFrmFmts );
+/*N*/
+/*N*/ // Beim SW31-Export evtl. die "umgebauten" Hints ausgeben, sonst die
+/*N*/ // Original-Hints
+/*N*/ if( pExpInfo )
+/*N*/ ExportTxtAttrs( pExpInfo, nStart, nEnd );
+/*N*/ else if( ((SwTxtNode&)rNode).HasHints() )
+/*N*/ OutTxtAttrs( *pNd, nStart, nEnd );
+/*N*/ aHBSH.OutAttr( *this, nStart, nEnd );
+/*N*/
+/*N*/ // Evtl. noch die neue Numerierungsregel (3.1/4.0) oder die
+/*N*/ // SwNodeNum-Struktor (5.0 ff) ausgeben
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ if( bNewNumRule )
+/*N*/ OutNumRule( SWG_NUMRULE, *pCurNumRule );
+/*N*/ }
+/*N*/ else if( pNdNum )
+/*N*/ {
+/*N*/ OutNodeNum( *pNdNum );
+/*N*/ }
+/*N*/
+/*N*/ // Eventuell noch die Wrong-Liste
+/*N*/ const SwWrongList* pWrong = pNd->GetWrong();
+/*N*/ if( !IsSw31Export() && pWrong )
+/*N*/ {
+/*N*/ OpenRec( SWG_WRONGLIST );
+/*N*/
+/*N*/ // der Header
+/*N*/ cFlags = 0x04; // 4 Bytes Daten
+/*N*/ xub_StrLen nBegin = pWrong->GetBeginInv();
+/*N*/ if( nBegin > STRING_MAXLEN52 )
+/*N*/ nBegin = STRING_MAXLEN52;
+/*N*/
+/*N*/ xub_StrLen nEnd = pWrong->GetEndInv();
+/*N*/ if( nEnd > STRING_MAXLEN52 )
+/*N*/ nEnd = STRING_MAXLEN52;
+/*N*/
+/*N*/ *pStrm << cFlags
+/*N*/ << (UINT16)nBegin
+/*N*/ << (UINT16)nEnd;
+/*N*/
+/*N*/ // nun die eigentliche Liste
+/*N*/ OpenValuePos16( 0 );
+/*N*/ USHORT nCount = pWrong->Count();
+/*N*/ for( USHORT i=0; i<nCount; i++ )
+/*N*/ {
+/*N*/ xub_StrLen nIdx = pWrong->Pos( i );
+/*N*/ if( nIdx < STRING_MAXLEN52 )
+/*N*/ {
+/*N*/ xub_StrLen nLen = pWrong->Len( i );
+/*N*/ if( nIdx + nLen > STRING_MAXLEN52 )
+/*N*/ nLen = STRING_MAXLEN52 - nIdx;
+/*N*/ UINT32 n = nIdx + (nLen << 16);
+/*N*/ *pStrm << n;
+/*N*/ }
+/*N*/ }
+/*N*/ CloseValuePos16( nCount );
+/*N*/ CloseRec( SWG_WRONGLIST );
+/*N*/ }
+/*N*/
+/*N*/ if( !IsSw31Or40Export() )
+/*N*/ {
+/*N*/ // Redline-Markierungen rausschreiben. Muss wegen geloeschter
+/*N*/ // Redlines immer als letztes passieren, weil beim Einfuegen
+/*N*/ // eines solechen Doks Attribute schon gesetzt sein muessen!
+/*N*/ OutNodeRedlines( nPosIdx );
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_TEXTNODE );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutEmptyTxtNode( ULONG nNodeIdx, BOOL bNodeMarks )
+/*N*/ {
+/*N*/ // 0x0L: length of data
+/*N*/ // 0x20: wrong list is valid
+/*N*/ BYTE cFlags = 0x24; // CollIdx & CondCollIdx
+/*N*/ USHORT nColl = aStringPool.Add( *SwStyleNameMapper::GetTextUINameArray()
+/*N*/ [ RES_POOLCOLL_STANDARD - RES_POOLCOLL_TEXT_BEGIN ],
+/*N*/ RES_POOLCOLL_STANDARD );
+/*N*/
+/*N*/ OpenRec( SWG_TEXTNODE );
+/*N*/ *pStrm << cFlags << nColl << IDX_DFLT_VALUE;
+/*N*/ OutString( *pStrm, aEmptyStr );
+/*N*/
+/*N*/ if( bNodeMarks )
+/*?*/ OutNodeMarks( nNodeIdx );
+/*N*/
+/*N*/ aStat.nPara++;
+/*N*/ CloseRec( SWG_TEXTNODE );
+/*N*/ }
+
+// nOffset ist ungleich Null, wenn innerhalb eines Nodes eingefuegt werden
+// soll. Dann ist nOffset die Start-Position des Textes.
+
+/*N*/ void Sw3IoImp::InTxtAttr( SwTxtNode& rNd, const ByteString& rText8,
+/*N*/ xub_StrLen nOffset,
+/*N*/ SvStringsDtor **pINetFldTexts,
+/*N*/ SvXub_StrLens **pINetFldPoss,
+/*N*/ SvXub_StrLens **pErasePoss,
+/*N*/ SvUShorts **pCharSetColorEncs,
+/*N*/ SvXub_StrLens **pCharSetColorPoss )
+/*N*/ {
+/*N*/ // Dieser Record kann auch leer sein
+/*N*/ // (bei teilweisem Speichern eines Nodes, z.B.)
+/*N*/ xub_StrLen nLen = rNd.GetTxt().Len();
+/*N*/ if( nLen ) nLen --;
+/*N*/ xub_StrLen nStart, nEnd;
+/*N*/ SfxPoolItem* pItem = InAttr( nStart, nEnd, &rNd );
+/*N*/ if( !pItem )
+/*N*/ {
+/*N*/ if( bDrawFmtSkipped )
+/*N*/ {
+/*N*/ ASSERT( bInsIntoHdrFtr,
+/*?*/ "Draw-Formate durften nur in Kopf-/Fusszeilen geloecht werden" );
+/*?*/ ASSERT( CH_TXTATR_BREAKWORD == rNd.GetTxt().GetChar(nStart) ||
+/*?*/ CH_TXTATR_INWORD == rNd.GetTxt().GetChar(nStart),
+/*?*/ "Wo ist das 0xff des Draw-Formats?" );
+/*?*/
+/*?*/ if( !(*pErasePoss) )
+/*?*/ *pErasePoss = new SvXub_StrLens;
+/*?*/ (*pErasePoss)->Insert( nStart, (*pErasePoss)->Count() );
+/*?*/
+/*?*/ bDrawFmtSkipped = FALSE;
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ if( !pFmtINetFmt )
+/*N*/ return;
+/*N*/
+/*N*/ // Es wurde ein INetFlield gelesen und in einen INet-Attribut
+/*N*/ // umgewandelt
+/*N*/
+/*N*/ // Text und Position merken
+/*N*/ if( !(*pINetFldTexts) )
+/*N*/ *pINetFldTexts = new SvStringsDtor;
+/*N*/ (*pINetFldTexts)->Insert( new String( aINetFldText ),
+/*N*/ (*pINetFldTexts)->Count() );
+/*N*/ if( !(*pINetFldPoss) )
+/*N*/ *pINetFldPoss = new SvXub_StrLens;
+/*N*/ (*pINetFldPoss)->Insert( nStart, (*pINetFldPoss)->Count() );
+/*N*/
+/*N*/ if( aINetFldText.Len() )
+/*N*/ {
+/*N*/ // ggf. das Attribut ueber dem =xff aufspannen
+/*N*/ // das Item wird ann unten geloescht
+/*N*/ pItem = pFmtINetFmt;
+/*N*/ nEnd++;
+/*N*/ aINetFldText.Erase();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // leere Felder nicht einfuegen
+/*N*/ delete pFmtINetFmt;
+/*N*/ }
+/*N*/
+/*N*/ pFmtINetFmt = 0;
+/*N*/
+/*N*/ if( !pItem )
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ if( nEnd < nStart ) nEnd = nLen;
+/*N*/ nStart += nOffset;
+/*N*/ nEnd += nOffset;
+/*N*/ USHORT nWhich = pItem->Which();
+/*N*/ if( nWhich == RES_TXTATR_FTN )
+/*N*/ {
+/*N*/ //JP 02.12.96:
+/*N*/ // Das Fussnoten-Attribut liest seine Section "auf der Wiese" ein
+/*N*/ // und erzeugt auch ihr TextAttribut (weil an dem noch weitere
+/*N*/ // Informationen gesetzt werden muessen - Referenznummer)
+/*N*/ SwTxtFtn& rFtn = *((SwFmtFtn*)pItem)->GetTxtFtn();
+/*N*/ *rFtn.GetStart() = nStart;
+/*N*/ rNd.Insert( &rFtn, SETATTR_NOTXTATRCHR );
+/*N*/ return ;
+/*N*/ }
+/*N*/ else if( RES_CHRATR_CHARSETCOLOR == nWhich )
+/*N*/ {
+/*?*/ if( !(*pCharSetColorEncs) )
+/*?*/ *pCharSetColorEncs = new SvUShorts;
+/*?*/ (*pCharSetColorEncs)->Insert(
+/*?*/ ((const SvxCharSetColorItem *)pItem)->GetCharSet(),
+/*?*/ (*pCharSetColorEncs)->Count() );
+/*?*/
+/*?*/ if( !(*pCharSetColorPoss) )
+/*?*/ *pCharSetColorPoss = new SvXub_StrLens;
+/*?*/ (*pCharSetColorPoss)->Insert( nStart, (*pCharSetColorPoss)->Count() );
+/*?*/ (*pCharSetColorPoss)->Insert( nEnd, (*pCharSetColorPoss)->Count() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Bug 31560: mehrere TOX-Marks ohne Ende an der gleichen Position!
+/*N*/ if( nStart == nEnd && (( RES_TXTATR_TOXMARK == nWhich &&
+/*N*/ ((SwTOXMark*)pItem)->IsAlternativeText() ) ||
+/*N*/ ( RES_TXTATR_NOEND_BEGIN <= nWhich && nWhich < RES_TXTATR_NOEND_END )))
+/*N*/ {
+/*N*/ // teste doch mal ob das Zeichen am der Position steht und on
+/*N*/ // an der Position nicht schon ein Attribut ohne Ende gesetzt ist!
+/*N*/ if( '\xff' != rText8.GetChar(nStart-nOffset) )
+/*N*/ {
+/*N*/ nWhich = 0;
+/*N*/ ASSERT( !this, "TextAttribut ohne Ende ohne 0xFF" );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ sal_Unicode cReplace = 0;
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_TXTATR_TOXMARK:
+/*N*/ {
+/*N*/ // pruefe mal auf doppelte:
+/*N*/ SwTxtAttr* pAttr = rNd.GetTxtAttr( nStart, nWhich );
+/*N*/ if( pAttr )
+/*N*/ {
+/*N*/ nWhich = 0;
+/*N*/ ASSERT( !this, "TOXMark ohne Ende doppelt" );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_TXTATR_SOFTHYPH:
+/*N*/ // set the unicode character into the node text
+/*N*/ cReplace = CHAR_SOFTHYPHEN;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_HARDBLANK:
+/*N*/ cReplace = ((SwFmtHardBlank*)pItem)->GetChar();
+/*N*/ if( ' ' == cReplace )
+/*N*/ cReplace = CHAR_HARDBLANK;
+/*N*/ else if( '-' == cReplace )
+/*N*/ cReplace = CHAR_HARDHYPHEN;
+/*N*/ else
+/*N*/ cReplace = 0;
+/*N*/ break;
+/*N*/ }
+/*N*/ if( cReplace )
+/*N*/ {
+/*N*/ rNd.Replace( SwIndex( &rNd, nStart ), cReplace );
+/*N*/ nWhich = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nWhich )
+/*N*/ {
+/*N*/ SwTxtAttr* pAttr = rNd.Insert( *pItem, nStart, nEnd, SETATTR_NOTXTATRCHR );
+/*N*/ // Sonderbehandlung fuer einige Text-Attribute:
+/*N*/ if( pAttr && RES_TXTATR_FLYCNT == nWhich )
+/*N*/ // ein zeichengebundener FlyFrm muss noch verankert werden
+/*N*/ ((SwTxtFlyCnt*) pAttr)->SetAnchor( &rNd );
+/*N*/ }
+/*N*/ }
+/*N*/ delete pItem;
+/*N*/ }
+
+// Schreiben aller harten Attributierungen
+
+/*N*/ void Sw3IoImp::OutTxtAttrs( const SwTxtNode& rNd, xub_StrLen nStart,
+/*N*/ xub_StrLen nEnd )
+/*N*/ {
+/*N*/ USHORT nCntAttr = rNd.HasHints() ? rNd.GetSwpHints().Count() : 0;
+/*N*/ if( nCntAttr )
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < nCntAttr; n++ )
+/*N*/ {
+/*N*/ const SwTxtAttr* pHt = rNd.GetSwpHints()[ n ];
+/*N*/ BOOL bHtEnd = BOOL( pHt->GetEnd() != NULL );
+/*N*/ xub_StrLen nHtStart = *pHt->GetStart();
+/*N*/ xub_StrLen nHtEnd = *pHt->GetAnyEnd();
+/*N*/
+/*N*/ // MIB 11.11.96: Der Bereich des Hints muss sich nur irgendwie
+/*N*/ // mit dem auszugenden Bereich ueberschneiden
+/*N*/ if( (bHtEnd && nHtEnd > nStart && nHtStart < nEnd) ||
+/*N*/ (!bHtEnd && nHtStart >= nStart && nHtStart < nEnd ) )
+/*N*/ {
+/*N*/ // Der Hint liegt zumindest teilweise im Text, also
+/*N*/ // Start und Ende korrigieren und Hint ausgeben
+/*N*/ nHtStart = ( nHtStart < nStart ) ? 0 : ( nHtStart - nStart );
+/*N*/ nHtEnd = ( nHtEnd > nEnd ? nEnd : nHtEnd ) - nStart;
+/*N*/ const SfxPoolItem& rAttr = pHt->GetAttr();
+/*N*/ OutAttr( rAttr, nHtStart, nHtEnd );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::ExportTxtAttrs( const Sw3ExportTxtAttrs* pInfo,
+/*N*/ xub_StrLen nStart, xub_StrLen nEnd )
+/*N*/ {
+/*N*/ USHORT nINetFmtCnt = 0;
+/*N*/ for( USHORT n = 0; n < pInfo->aItems.Count(); n++ )
+/*N*/ {
+/*N*/ xub_StrLen nHtStart = pInfo->aItemStarts[n];
+/*N*/ xub_StrLen nHtEnd = pInfo->aItemEnds[n];;
+/*N*/
+/*N*/ // Der Hint liegt zumindest teilweise im Text, also
+/*N*/ // Start und Ende korrigieren und Hint ausgeben
+/*N*/ nHtStart = ( nHtStart < nStart ) ? 0 : ( nHtStart - nStart );
+/*N*/ nHtEnd = ( nHtEnd > nEnd ? nEnd : nHtEnd ) - nStart;
+/*N*/ const SfxPoolItem* pAttr = pInfo->aItems[n];
+/*N*/ if( RES_TXTATR_INETFMT==pAttr->Which() )
+/*N*/ {
+/*N*/ // ein SwFmtINetFmtNet muss bei SW31-Export zum Feld werden
+/*N*/
+/*N*/ // Start OutAttr()
+/*N*/ OpenRec( SWG_ATTRIBUTE );
+/*N*/ BYTE cFlags = 0x04; // Which + Version
+/*N*/ cFlags += 0x12; // Begin
+/*N*/ USHORT nWhich = RES_TXTATR_FIELD - RES_TXTATR_NOEND_BEGIN + 0x3000;
+/*N*/ *pStrm << (BYTE) cFlags
+/*N*/ << (UINT16) nWhich
+/*N*/ << (UINT16) 0 // rAttr.GetVersion();
+/*N*/ << (UINT16)nHtStart;
+/*N*/
+/*N*/ // Start SwFmtFld::Store()
+/*N*/
+/*N*/ // Start OutField()
+/*N*/ *pStrm << (INT16) ( RES_INTERNETFLD - RES_FIELDS_BEGIN )
+/*N*/ << (INT16) 0;
+/*N*/
+/*N*/ // Start lcl_sw3io_OutINetField()
+/*N*/ OutString( *pStrm, ::binfilter::StaticBaseUrl::AbsToRel(
+/*N*/ ((const SwFmtINetFmt *)pAttr)->GetValue() URL_DECODE ) );
+/*N*/ pStrm->WriteByteString( *pInfo->aINetFmtTexts[nINetFmtCnt] );
+/*N*/ // Ende lcl_sw3io_OutINetField()
+/*N*/
+/*N*/ // Ende OutField()
+/*N*/
+/*N*/ // Ende SwFmtFld::Store()
+/*N*/
+/*N*/ CloseRec( SWG_ATTRIBUTE );
+/*N*/ // Ende OutAttr()
+/*N*/
+/*N*/ nINetFmtCnt++;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ OutAttr( *pAttr, nHtStart, nHtEnd );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+// Die Formate von Grafik- und OLE-Nodes muessen nicht registriert
+// werden; die Layout-Frames erhalten ja eine Node-Referenz.
+
+//#define SWG_GRAPHIC_EXT 'X' jetzt SWG_IMAGEMAP
+
+/*N*/ void Sw3IoImp::InGrfNode( SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ Graphic aGrf;
+/*N*/ Graphic* pGrf = &aGrf;
+/*N*/ String aGrfName, aFltName, aStrmName, aURL, aTarget, aAltText;
+/*N*/ ImageMap *pImgMap = 0;
+/*N*/ PolyPolygon *pContour = 0;
+/*N*/ OpenRec( SWG_GRFNODE );
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ CloseFlagRec();
+/*N*/ BOOL bLink = BOOL( ( cFlags & 0x10 ) == 0 );
+/*N*/ BOOL bEmptyGrf = BOOL( cFlags & 0x20 );
+/*N*/ BOOL bIsServerMap = BOOL( (cFlags & 0x40) != 0 );
+/*N*/
+/*N*/ InString( *pStrm, aGrfName );
+/*N*/ InString( *pStrm, aFltName );
+/*N*/
+/*N*/ if( IsVersion( SWG_DESKTOP40 ) )
+/*N*/ InString( *pStrm, aAltText );
+/*N*/
+/*N*/ aStrmName = aGrfName;
+/*N*/ SwAttrSet aSet( pDoc->GetAttrPool(), aNoTxtNodeSetRange );
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ BYTE cType = Peek();
+/*N*/ switch( cType )
+/*N*/ {
+/*N*/ case SWG_ATTRSET:
+/*N*/ InAttrSet( aSet );
+/*N*/ break;
+/*N*/ case SWG_IMAGEMAP:
+/*N*/ {
+/*N*/ BOOL bDummy; // IsURL-Map-Flag wird im Node selbst gesp.
+/*N*/ pImgMap = InImageMap( aURL, aTarget, bDummy );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case SWG_CONTOUR:
+ pContour = InContour();
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*?*/ SkipRec();
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( SWG_GRFNODE );
+/*N*/ if( CheckPersist() )
+/*N*/ {
+/*N*/ // Muss die Grafik noch geladen werden?
+/*N*/ if( !bEmptyGrf )
+/*N*/ {
+/*N*/ if( bLink )
+/*N*/ {
+/*N*/ pGrf = 0;
+/*N*/ if( aGrfName.Len() )
+/*N*/ aGrfName = ::binfilter::StaticBaseUrl::RelToAbs( aGrfName );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SvStorageRef pPicStg = pRoot->OpenStorage( N_PICTURES,
+/*N*/ STREAM_READ | STREAM_SHARE_DENYWRITE, 0 );
+/*N*/ SvStorageStreamRef pPicStrm;
+/*N*/ if( pPicStg.Is() )
+/*N*/ pPicStrm = pPicStg->OpenStream
+/*N*/ ( aGrfName, STREAM_READ | STREAM_SHARE_DENYWRITE );
+/*N*/ aGrfName.Erase(); // Ist ja gar kein Grafikname!
+/*N*/ ASSERT( pPicStrm.Is() && pPicStrm->GetError() == SVSTREAM_OK, "Grafik nicht gefunden" );
+/*N*/ if( pPicStrm.Is() && pPicStrm->GetError() == SVSTREAM_OK )
+/*N*/ {
+/*N*/ // Wenn kein DocFileName gesetzt ist, wird eine TmpFile
+/*N*/ // erzeugt, was wir im Moment nicht wollen!
+/*N*/ pPicStrm->SetVersion( pRoot->GetVersion() );
+/*N*/ String aDummy( String::CreateFromAscii("file:///Dummy") );
+/*N*/ aGrf.SetDocFileName( aDummy, 0L );
+/*N*/ BOOL bSwapOut = BOOL( !bInsert );
+/*N*/ // Beim SW3.1-Import verliern wir unserden Dok-Storage,
+/*N*/ // also darf die Grafik nicht rausgeswappt werden.
+/*N*/ // MIB 3.9.98: Ausserdem muessen Grafiken immer beim
+/*N*/ // LoadStyles reingeswappt werden, weil dann der Storage
+/*N*/ // aus dem geladen wird nicht unbedingt der Doc-Storage
+/*N*/ // sein muss. Das ist zum Beispiel beim Aktualisieren von
+/*N*/ // Vorlagen aus einer Dokument-Vorlage der Fall (#55896#)
+/*N*/ // Aufgrund eines Hackks im Organizer stimmt dort der
+/*N*/ // Dok-Storage uebrigens ...
+/*N*/ if( bBlock || bOrganizer || nVersion < SWG_MAJORVERSION )
+/*N*/ bSwapOut = FALSE;
+/*N*/ aGrf.ReadEmbedded( *pPicStrm, bSwapOut );
+/*N*/ aDummy.Erase();
+/*N*/ aGrf.SetDocFileName( aDummy, 0L );
+/*N*/ if( pPicStrm->GetError() != SVSTREAM_OK )
+/*N*/ Error( ERR_SWG_READ_ERROR );
+/*N*/ }
+/*N*/ else
+/*N*/ Warning( WARN_SWG_POOR_LOAD );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !nRes )
+/*N*/ {
+/*N*/ if( !IsVersion( SWG_URLANDMAP, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ // bei importierten Dateien muss ggf noch die URL in das
+/*N*/ // Format gestopft werden
+/*N*/ SwFmtURL aFmtURL;
+/*N*/ aFmtURL.SetURL( aURL, bIsServerMap );
+/*N*/ aFmtURL.SetTargetFrameName( aTarget );
+/*N*/ if( pImgMap )
+/*?*/ aFmtURL.SetMap( pImgMap );
+/*N*/ aSet.Put( aFmtURL );
+/*N*/ }
+/*N*/ SwGrfNode* pNd = pDoc->GetNodes().MakeGrfNode( rPos,
+/*N*/ aGrfName, aFltName, pGrf,
+/*N*/ (SwGrfFmtColl*) pDoc->GetDfltGrfFmtColl(),
+/*N*/ &aSet, bLink );
+/*N*/ if( !bLink && !bBlock && !bInsert && !bOrganizer )
+/*N*/ pNd->SetStreamName( aStrmName );
+/*N*/ pNd->SetAlternateText( aAltText );
+/*N*/ pNd->SetContour( pContour );
+/*N*/ }
+/*N*/ }
+/*N*/ delete pImgMap;
+/*N*/ delete pContour;
+/*N*/ }
+
+// Ausgabe eines Grafik-Nodes
+
+/*N*/ void Sw3IoImp::OutGrfNode( const SwNoTxtNode& rNode )
+/*N*/ {
+/*N*/ if( CheckPersist() )
+/*N*/ {
+/*N*/ SwGrfNode& rGrf = (SwGrfNode&) rNode;
+/*N*/
+/*N*/ String aName, sFilterNm;
+/*N*/ BYTE cFlags = 0x00;
+/*N*/ if( !rGrf.IsGrfLink() ) // gelinkte Graphic
+/*N*/ {
+/*N*/ cFlags = 0x10;
+/*N*/ if( GRAPHIC_NONE == rGrf.GetGrf().GetType() )
+/*N*/ cFlags |= 0x20;
+/*N*/ else
+/*N*/ {
+/*N*/ // Falls die Grafik bereits im Storage ist, ist der Stream-Name
+/*N*/ // gesetzt. Dann brauchen wir sie nicht mehr zu speichern.
+/*N*/ // oder es ist ein SaveAs, dann auf jedenfall kopieren
+/*N*/ if( !rGrf.StoreGraphics( pRoot ) )
+/*N*/ {
+/*N*/ Warning( WARN_SWG_POOR_LOAD );
+/*N*/ cFlags |= 0x20; // dann als leere Grf kennzeichnen!
+/*N*/ // Error( ERR_SWG_WRITE_ERROR );
+/*N*/ }
+/*N*/ // Den Namen merken
+/*N*/ else
+/*N*/ aName = rGrf.GetStreamName();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nFileFlags |= SWGF_HAS_GRFLNK;
+/*N*/ rGrf.GetFileFilterNms( &aName, &sFilterNm );
+/*N*/ aName = ::binfilter::StaticBaseUrl::AbsToRel( aName );
+/*N*/ }
+/*N*/
+/*N*/ // Beim 31-Export muss die URL noch am Node gespeichert werden
+/*N*/ const SfxPoolItem *pURLItem = 0;
+/*N*/ if( IsSw31Export() &&
+/*N*/ SFX_ITEM_SET == rNode.GetFlyFmt()->GetAttrSet().
+/*N*/ GetItemState( RES_URL, FALSE, &pURLItem ) )
+/*N*/ {
+/*N*/ if ( ((SwFmtURL*)pURLItem)->IsServerMap() )
+/*N*/ cFlags |= 0x40;
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_GRFNODE );
+/*N*/ *pStrm << cFlags;
+/*N*/ OutString( *pStrm, aName );
+/*N*/ OutString( *pStrm, sFilterNm );
+/*N*/ if( !IsSw31Export() )
+/*N*/ OutString( *pStrm, rGrf.GetAlternateText() );
+/*N*/ if( rNode.GetpSwAttrSet() )
+/*N*/ OutAttrSet( *rNode.GetpSwAttrSet() );
+/*N*/
+/*N*/ if( pURLItem )
+/*N*/ {
+/*N*/ const String& rURL = ((SwFmtURL*)pURLItem)->GetURL();
+/*N*/ const String& rTarget = ((SwFmtURL*)pURLItem)->GetTargetFrameName();
+/*N*/ const ImageMap *pIMap = ((SwFmtURL*)pURLItem)->GetMap();
+/*N*/ if( rURL.Len() || rTarget.Len() || pIMap || (cFlags & 0x40) )
+/*N*/ OutImageMap( rURL, rTarget, pIMap, (cFlags & 0x40) );
+/*N*/ }
+/*N*/
+/*N*/ // wegen der while( BytesLeft() )-Schleife beim Einlesen brauchen
+/*N*/ // wir hier einen eigenen Record, der aber auch fuer andere Sachen
+/*N*/ // verwendet werden kann und sollte
+/*N*/ if( !IsSw31Export() && rNode.HasContour() )
+ OutContour( *rNode.HasContour() );
+/*N*/
+/*N*/ CloseRec( SWG_GRFNODE );
+/*N*/ aStat.nGrf++;
+/*N*/ }
+/*N*/ }
+
+// Einlesen eines OLE-Nodes
+
+/*N*/ void Sw3IoImp::InOLENode( SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ SwOLENode* pOLENd = 0;
+/*N*/ SwNoTxtNode* pNoTxtNd = 0;
+/*N*/ String aObjName, aAltText;
+/*N*/
+/*N*/ OpenRec( SWG_OLENODE );
+/*N*/ InString( *pStrm, aObjName );
+/*N*/
+/*N*/ if( IsVersion( SWG_DESKTOP40 ) )
+/*N*/ InString( *pStrm, aAltText );
+/*N*/
+/*N*/ // change the StarImageObj to a graphic
+/*N*/ SvPersistRef xSrcDoc( new SvPersist() );
+/*N*/ SvInfoObjectRef xObjInfo;
+/*N*/ if( xSrcDoc->DoOwnerLoad( pRoot ) && xSrcDoc->GetObjectList() )
+/*N*/ {
+/*N*/ // Suche die richtige Info
+/*N*/ xObjInfo = xSrcDoc->Find( aObjName );
+/*N*/ ASSERT( xObjInfo.Is(), "Keine Objektinfo zum Einfuegen gefunden" );
+/*N*/ }
+/*N*/
+/*N*/ if( xObjInfo.Is() )
+/*N*/ {
+/*N*/ SvStorageRef xSimStg( pRoot->OpenStorage(
+/*N*/ xObjInfo->GetStorageName() ) );
+/*N*/ String aStmName;
+/*N*/ if( xSimStg.Is() && (
+/*N*/ xSimStg->IsStream( aStmName = String(
+/*N*/ RTL_CONSTASCII_USTRINGPARAM( "StarImageDocument" )) ) ||
+/*N*/ xSimStg->IsStream( aStmName = String(
+/*N*/ RTL_CONSTASCII_USTRINGPARAM( "StarImageDocument 4.0" ))) ))
+/*N*/ {
+/*N*/ SvStorageStreamRef xSimStm( xSimStg->OpenStream( aStmName ) );
+/*N*/
+/*N*/ if( xSimStm.Is() && !xSimStm->GetError() )
+/*N*/ {
+/*N*/ Graphic aGraphic;
+/*N*/ xSimStm->SetBufferSize( 32768 );
+/*N*/ xSimStm->SetKey( xSimStg->GetKey() );
+/*N*/ *xSimStm >> aGraphic;
+/*N*/ xSimStm->SetBufferSize( 0 );
+/*N*/
+/*N*/ pNoTxtNd = pDoc->GetNodes().MakeGrfNode( rPos, aEmptyStr,
+/*N*/ aEmptyStr, &aGraphic,
+/*N*/ (SwGrfFmtColl*) pDoc->GetDfltGrfFmtColl() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !pNoTxtNd && CheckPersist() )
+/*N*/ {
+/*N*/ // Im Insert Mode muss das OLE-Objekt in den Ziel-Storage kopiert werden
+/*N*/ if( bInsert && xObjInfo.Is() )
+/*N*/ {
+/*?*/ SvPersistRef rpDstDoc( pDoc->GetPersist() );
+/*?*/
+/*?*/ String aStgName( xObjInfo->GetStorageName() );
+/*?*/ SvStorageRef rpDst( pDoc->GetPersist()->GetStorage() );
+/*?*/ // Sind Objektname und Storagename eindeutig?
+/*?*/ if( rpDstDoc->GetObjectList() )
+/*?*/ for( ULONG i = 0; i < rpDstDoc->GetObjectList()->Count(); i++ )
+/*?*/ {
+/*?*/ SvInfoObject* pTst = rpDstDoc->GetObjectList()->GetObject(i);
+/*?*/ // TODO: unicode: is this correct?
+/*?*/ if( aObjName.EqualsIgnoreCaseAscii( pTst->GetObjName() ))
+/*?*/ aObjName = Sw3Io::UniqueName( rpDst, "Obj" );
+/*?*/ // TODO: unicode: is this correct?
+/*?*/ if( aStgName.EqualsIgnoreCaseAscii( pTst->GetStorageName() ) )
+/*?*/ aStgName = Sw3Io::UniqueName( rpDst, "Obj" );
+/*?*/ }
+/*?*/ if( !rpDstDoc->Copy( aObjName, aStgName, &xObjInfo, xSrcDoc ) )
+/*?*/ {
+/*?*/ Error( ERR_SWG_READ_ERROR );
+/*?*/ return;
+/*?*/ }
+/*N*/ }
+/*N*/ pNoTxtNd = pOLENd = pDoc->GetNodes().MakeOLENode( rPos, aObjName,
+/*N*/ (SwGrfFmtColl*) pDoc->GetDfltGrfFmtColl() );
+/*N*/ }
+/*N*/
+/*N*/ if( pNoTxtNd )
+/*N*/ {
+/*N*/ pNoTxtNd->SetAlternateText( aAltText );
+/*N*/
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ BYTE cType = Peek();
+/*N*/ switch( cType )
+/*N*/ {
+/*?*/ case SWG_ATTRSET:
+/*?*/ if( !pNoTxtNd->GetpSwAttrSet() )
+/*?*/ ((SwCntntNode*) pNoTxtNd)->NewAttrSet( pDoc->GetAttrPool() );
+/*?*/ InAttrSet( *pNoTxtNd->GetpSwAttrSet() );
+/*?*/ pNoTxtNd->GetpSwAttrSet()->SetModifyAtAttr( pNoTxtNd );
+/*?*/ break;
+/*N*/
+/*N*/ case SW_OLE_CHARTNAME:
+/*N*/ if( pOLENd )
+/*N*/ {
+/*N*/ String sStr;
+/*N*/ OpenRec( SW_OLE_CHARTNAME );
+/*N*/ InString( *pStrm, sStr );
+/*N*/ CloseRec( SW_OLE_CHARTNAME );
+/*N*/ pOLENd->SetChartTblName( sStr );
+/*N*/ }
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/
+/*?*/ case SWG_IMAGEMAP:
+/*?*/ {
+/*?*/ String aURL, aTarget;
+/*?*/ BOOL bIsServerMap = FALSE;
+/*?*/ ImageMap *pImgMap = InImageMap( aURL, aTarget, bIsServerMap);
+/*?*/ SwFmtURL aFmtURL;
+/*?*/ aFmtURL.SetURL( aURL, bIsServerMap );
+/*?*/ aFmtURL.SetTargetFrameName( aTarget );
+/*?*/ if ( pImgMap )
+/*?*/ {
+/*?*/ aFmtURL.SetMap( pImgMap );
+/*?*/ delete pImgMap;
+/*?*/ }
+/*?*/ pNoTxtNd->SetAttr( aFmtURL );
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case SWG_CONTOUR:
+/*?*/ if( pOLENd )
+/*?*/ {
+ PolyPolygon *pContour = InContour();
+ /*?*/ pOLENd->SetContour( pContour );
+ /*?*/ delete pContour;
+/*?*/ }
+/*?*/ else
+/*?*/ SkipRec();
+/*?*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ SkipRec();
+/*N*/ }
+/*N*/ }
+/*N*/ // falls ein 3.0-Dokument gelesen wird: Node merken
+/*N*/ if( pOLENd )
+/*N*/ {
+/*N*/ if( bNormal && !bInsert && !bBlock && nVersion<=SWG_SHORTFIELDS )
+/*N*/ {
+/*?*/ if( !p30OLENodes )
+/*?*/ p30OLENodes = new SwOLENodes;
+/*?*/
+/*?*/ p30OLENodes->Insert( pOLENd, p30OLENodes->Count() );
+/*N*/ }
+/*N*/
+/*N*/ if( bInsert )
+/*?*/ pOLENd->SetOLESizeInvalid( TRUE ); //wg. Druckerwechsel
+/*N*/ }
+/*N*/ }
+/*N*/ if( !xObjInfo.Is() )
+/*?*/ Warning( WARN_SWG_POOR_LOAD );
+/*N*/
+/*N*/ CloseRec( SWG_OLENODE );
+/*N*/ }
+
+// Ausgabe eines OLE-Nodes
+
+/*N*/ void Sw3IoImp::OutOLENode( const SwNoTxtNode& rNd )
+/*N*/ {
+/*N*/ if( CheckPersist() )
+/*N*/ {
+/*N*/ OpenRec( SWG_OLENODE );
+/*N*/ SwOLENode& rNode = (SwOLENode&) rNd;
+/*N*/ SwOLEObj& rObj = rNode.GetOLEObj();
+/*N*/
+/*N*/ String aName( rObj.GetName() );
+/*N*/ OutString( *pStrm, aName );
+/*N*/ if( !IsSw31Export() )
+/*?*/ OutString( *pStrm, rNode.GetAlternateText() );
+/*N*/ if( rNode.GetpSwAttrSet() )
+/*N*/ OutAttrSet( *rNode.GetpSwAttrSet() );
+/*N*/
+/*N*/ if( rNode.GetChartTblName().Len() )
+/*N*/ {
+/*N*/ OpenRec( SW_OLE_CHARTNAME );
+/*N*/ OutString( *pStrm, rNode.GetChartTblName() );
+/*N*/ CloseRec( SW_OLE_CHARTNAME );
+/*N*/ }
+/*N*/
+/*N*/ if( !IsSw31Export() && rNode.HasContour() )
+ OutContour( *rNode.HasContour() );
+/*N*/
+/*N*/ CloseRec( SWG_OLENODE );
+/*N*/ aStat.nOLE++;
+/*N*/ }
+/*N*/ }
+
+
+// Einlesen eines Text-Wiederholungs-Nodes
+
+/*N*/ void Sw3IoImp::InRepTxtNode( SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ UINT32 nRepetitions;
+/*N*/
+/*N*/ OpenRec( SWG_REPTEXTNODE );
+/*N*/ *pStrm >> nRepetitions;
+/*N*/
+/*N*/ rPos--;
+/*N*/ SwTxtNode *pNode = pDoc->GetNodes()[rPos]->GetTxtNode();
+/*N*/ rPos++;
+/*N*/
+/*N*/ for( ULONG i=0; i<nRepetitions; i++ )
+/*N*/ pNode->MakeCopy( pDoc, rPos );
+/*N*/
+/*N*/ CloseRec( SWG_REPTEXTNODE );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ // Ausgabe eines Text-Wiederholungs-Nodes
+/*N*/
+/*N*/ void Sw3IoImp::OutRepTxtNode( ULONG nRepetitions )
+/*N*/ {
+/*N*/ OpenRec( SWG_REPTEXTNODE );
+/*N*/ *pStrm << (UINT32)nRepetitions;
+/*N*/ CloseRec( SWG_REPTEXTNODE );
+/*N*/ }
+
+// Der Image-Map-Record war frueher ein SWG_GRAPHIC_EXT-Record.
+// Deshalb enthaelt er immer der URL fuer eine Server-seitige
+// Image-Map und kein ismap-Flag! Aus dem gleichen Grund wird die
+// URL fuer eine Client-seitige Image-Map ueber ein Falg gesteuert.
+// damit alte Writer-Version keine Warnung ausgeben, wenn der String
+// leer ist.
+
+/*N*/ ImageMap *Sw3IoImp::InImageMap( String& rURL, String& rTarget, BOOL& rIsMap )
+/*N*/ {
+/*N*/ OpenRec( SWG_IMAGEMAP );
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ rIsMap = BOOL( (cFlags & 0x10) != 0 );
+/*N*/
+/*N*/ InString( *pStrm, rURL );
+/*N*/ if( rURL.Len() )
+/*N*/ rURL = ::binfilter::StaticBaseUrl::SmartRelToAbs( rURL );
+/*N*/
+/*N*/ // bis hier hatten wir frueher einen SWG_GRAPHIC_EXT-Record!
+/*N*/ if( IsVersion( SWG_TARGETFRAME, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ String sDummy;
+/*N*/ InString( *pStrm, rTarget );
+/*N*/ InString( *pStrm, sDummy );
+/*N*/ }
+/*N*/
+/*N*/ ImageMap *pIMap = 0;
+/*N*/ if( cFlags & 0x20 )
+/*N*/ {
+/*?*/ pIMap = new ImageMap;
+/*?*/ pIMap->Read(
+ *pStrm,
+ ::binfilter::StaticBaseUrl::GetBaseURL(INetURLObject::NO_DECODE));
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_IMAGEMAP );
+/*N*/
+/*N*/ return pIMap; // muss ggf. vom Aufrufer geloescht werden!
+/*N*/ }
+
+/*N*/ void lcl_sw3io__ConvertMarkToOutline( String& rURL )
+/*N*/ {
+/*N*/ if( rURL.Len() && '#' == rURL.GetChar( 0 ) )
+/*N*/ {
+/*N*/ String sCmp, sMark( INetURLObject::decode( rURL, INET_HEX_ESCAPE,
+/*N*/ INetURLObject::DECODE_WITH_CHARSET,
+/*N*/ RTL_TEXTENCODING_UTF8 ));
+/*N*/ xub_StrLen nPos = sMark.SearchBackward( cMarkSeperator );
+/*N*/ if( STRING_NOTFOUND != nPos &&
+/*N*/ ( sCmp = sMark.Copy( nPos + 1 ) ).EraseAllChars().Len() &&
+/*N*/ COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToOutline ) )
+/*N*/ {
+/*N*/ rURL = '#';
+/*N*/ rURL += String(INetURLObject::createFragment( sMark.Copy( 1, nPos-1 ) ));
+/*N*/ rURL += cMarkSeperator;
+/*N*/ rURL.AppendAscii( pMarkToOutline );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutImageMap( const String& rURL, const String& rTarget,
+/*N*/ const ImageMap *pIMap, BOOL bIsServerMap )
+/*N*/ {
+/*N*/ // Dieser Record ist fuer den 31-Export ein SWG_GRAPHIC_EXT und
+/*N*/ // enthaelt dann nur eine URL
+/*N*/ OpenRec( SWG_IMAGEMAP );
+/*N*/ BYTE cFlags = 0x00;
+/*N*/ if( !IsSw31Export() && bIsServerMap )
+/*N*/ cFlags += 0x10; // es ist eine Image-Map
+/*N*/ if( !IsSw31Export() && pIMap )
+/*N*/ cFlags += 0x20; // es folgt eine Image-Map
+/*N*/
+/*N*/ *pStrm << cFlags;
+/*N*/
+/*N*/ // Unabhaengigkeit von der AbsToRel-Schnittstelle sicherstellen!
+/*N*/ String aURL( rURL );
+/*N*/ if( aURL.Len() )
+/*N*/ {
+/*N*/ lcl_sw3io__ConvertMarkToOutline( aURL );
+/*N*/ aURL = ::binfilter::StaticBaseUrl::AbsToRel( aURL URL_DECODE);
+/*N*/ }
+/*N*/ OutString( *pStrm, aURL );
+/*N*/
+/*N*/ // bis hier hatten wir frueher einen SWG_GRAPHIC_EXT-Record!
+/*N*/
+/*N*/ if( !IsSw31Export() )
+/*N*/ {
+/*N*/ OutString( *pStrm, rTarget );
+/*N*/ OutString( *pStrm, aEmptyStr );
+/*N*/
+/*N*/ if( pIMap )
+/*?*/ pIMap->Write(
+ *pStrm,
+ ::binfilter::StaticBaseUrl::GetBaseURL(INetURLObject::NO_DECODE));
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_IMAGEMAP );
+/*N*/ }
+
+ PolyPolygon *Sw3IoImp::InContour()
+ {
+ PolyPolygon *pContour = 0;
+
+ OpenRec( SWG_CONTOUR );
+ BYTE cFlags = OpenFlagRec();
+ CloseFlagRec();
+
+ if( (cFlags & 0x10) != 0 )
+ {
+ pContour = new PolyPolygon;
+ *pStrm >> *pContour;
+ }
+
+ CloseRec( SWG_CONTOUR );
+
+ return pContour;
+ }
+
+void Sw3IoImp::OutContour( const PolyPolygon& rPoly )
+{
+ OpenRec( SWG_CONTOUR );
+
+ BYTE cFlags = 0x10; // es folgt ein Contour Poly-Polygon
+ *pStrm << cFlags;
+
+ // das Contour-PolyPolygon rausschreiben
+ *pStrm << rPoly;
+
+ CloseRec( SWG_CONTOUR );
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx
new file mode 100644
index 000000000000..afce09df2372
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx
@@ -0,0 +1,1129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVSTDARR_USHORTS
+#include <bf_svtools/macitem.hxx>
+#include <bf_svtools/urihelper.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <errhdl.hxx>
+#include <swtable.hxx>
+
+#include <errhdl.hxx>
+
+#include <pam.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <fmtfld.hxx>
+#include <fmtanchr.hxx>
+#include <fmthdft.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtfsize.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtrfmrk.hxx>
+#include <fchrfmt.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtcnct.hxx>
+#include <charfmt.hxx>
+#include <ftninfo.hxx>
+#include <sw3imp.hxx>
+#include <cellatr.hxx>
+#include <tox.hxx>
+#include <pagedesc.hxx>
+#include <fmtruby.hxx>
+#include <tgrditem.hxx>
+
+#include <error.h>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+
+#define URL_DECODE \
+ , INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS
+
+
+// Diese Datei hat einige Besonderheiten:
+// Die aktuelle Sw3IoImp-Instanz wird ueber Sw3IoImp::GetCurrentIo()
+// angefordert. Da diese die Variable pStrm mit dem aktuellen I/O-
+// Stream besetzt hat, muss dieser auf den uebergebenen Stream umgesetzt
+// werden. Dabei wird angenommen, dass alle uebergebenen Streams
+// SvStorageStreams sind.
+
+////////////////////////////// Frame-Attribute ////////////////////////////
+
+/*N*/ SfxPoolItem* SwFmtAnchor::Create( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ BYTE cType;
+/*N*/ USHORT nIndex;
+/*N*/ rStrm >> cType;
+/*N*/ if( nIVer < IVER_FMTANCHOR_LONGIDX )
+/*N*/ {
+/*N*/ rStrm >> nIndex;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ UINT32 nIndex32 = Sw3IoImp::InULong( rStrm );
+/*N*/ ASSERT( nIndex32 <= USHRT_MAX,
+/*N*/ "SwFmtAnchor: Index/Seitenzahl > USHRT_MAX" );
+/*N*/ nIndex = (USHORT)nIndex32;
+/*N*/ }
+/*N*/ // Dieser Anker ist fuer FLY_AT_CNTNT und FLY_IN_CNTNT
+/*N*/ // unvollstaendig und muss noch angepasst werden. Dies
+/*N*/ // geschieht nach dem Einlesen des FrmFmts in InTxtNode().
+/*N*/ return new SwFmtAnchor( (RndStdIds) cType, nIndex );
+/*N*/ }
+
+/*N*/ SvStream& SwFmtAnchor::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ const SwPosition* pPos = GetCntntAnchor();
+/*N*/ // Der Index hat das Offset fuer FLY_AT_CNTNT und FLY_IN_CNTNT,
+/*N*/ // sonst die Seitennummer.
+/*N*/ if( nIVer < IVER_FMTANCHOR_LONGIDX )
+/*N*/ {
+/*N*/ // Nur 3.1/4.0-Export
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_40 >= rStrm.GetVersion(),
+/*N*/ "SwFmtAnchor:: FF-Version und Item-Version passen nicht" );
+/*N*/
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/
+/*N*/ if( pIo->IsSw31Export() && pIo->pExportInfo &&
+/*N*/ pIo->pExportInfo->bDrwFrmFmt31 &&
+/*N*/ FLY_IN_CNTNT==GetAnchorId() )
+/*N*/ {
+/*N*/ // Statt der 0 koennte man auch den Node-Index rausschreiben, aber
+/*N*/ // wozu, wenn der eh gleich neu gesetzt wird?
+/*?*/ rStrm << (BYTE) FLY_AT_CNTNT // Igitt, war mal FLY_IN_CNTNT
+/*?*/ << (USHORT) 0;
+/*N*/ }
+/*N*/ else if( FLY_AT_FLY == GetAnchorId() ||
+/*N*/ FLY_AUTO_CNTNT == GetAnchorId() )
+/*N*/ {
+/*?*/ BYTE nAnchorId = GetAnchorId();
+/*?*/ USHORT nIndex;
+/*?*/ if( FLY_AT_FLY == nAnchorId )
+/*?*/ {
+/*?*/ nAnchorId = FLY_PAGE;
+/*?*/ SwNodeIndex aIdx( pPos->nNode );
+/*?*/ const SwNodes& rNds = aIdx.GetNodes();
+/*?*/ const SwCntntNode* pCNd = rNds.GoNext( &aIdx );
+/*?*/ const SwCntntFrm* pFrm;
+/*?*/ if( pCNd && 0 != ( pFrm = pCNd->GetFrm() ))
+/*?*/ nIndex = pFrm->FindPageFrm()->GetPhyPageNum();
+/*?*/ else
+/*?*/ nIndex = 1;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nAnchorId = FLY_AT_CNTNT;
+/*?*/ xub_StrLen nCntntIdx = pPos->nContent.GetIndex();
+/*?*/ nIndex = nCntntIdx <= STRING_MAXLEN52 ? nCntntIdx
+/*?*/ : STRING_MAXLEN52;
+/*?*/ }
+/*?*/ rStrm << (BYTE) nAnchorId
+/*?*/ << (USHORT) nIndex;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nIndex;
+/*N*/ if( pPos )
+/*N*/ {
+/*N*/ xub_StrLen nCntntIdx = pPos->nContent.GetIndex();
+/*N*/ nIndex = nCntntIdx <= STRING_MAXLEN52 ? nCntntIdx
+/*N*/ : STRING_MAXLEN52;
+/*N*/ }
+/*N*/ else
+/*N*/ nIndex = GetPageNum();
+/*N*/ rStrm << (BYTE) GetAnchorId()
+/*N*/ << (USHORT) nIndex;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_40 < rStrm.GetVersion(),
+/*N*/ "SwFmtAnchor:: FF-Version und Item-Version passen nicht" );
+/*N*/ ULONG nIndex = pPos ? pPos->nContent.GetIndex() : GetPageNum();
+/*N*/ if( nIndex > STRING_MAXLEN52 )
+/*N*/ nIndex = STRING_MAXLEN52;
+/*N*/ rStrm << (BYTE) GetAnchorId();
+/*N*/ Sw3IoImp::OutULong( rStrm, nIndex );
+/*N*/ }
+/*N*/
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ USHORT SwFmtAnchor::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtAnchor: Gibt es ein neues Fileformat?" );
+/*N*/ return ( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ) ? 0 : IVER_FMTANCHOR_LONGIDX;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtHeader::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ BYTE bActive;
+/*N*/ rStrm >> bActive;
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/
+/*N*/ USHORT eSave_StartNodeType = pIo->eStartNodeType;
+/*N*/ pIo->eStartNodeType = SwHeaderStartNode;
+/*N*/
+/*N*/ SwFmtHeader* pAttr = NULL;
+/*N*/ if( pIo->Peek() == SWG_FREEFMT )
+/*N*/ {
+/*N*/ SwFrmFmt* pFmt = (SwFrmFmt*) pIo->InFormat( SWG_FREEFMT, NULL );
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ pAttr = new SwFmtHeader( pFmt );
+/*N*/ pAttr->SetActive( BOOL( bActive ) );
+/*N*/ }
+/*N*/ else
+/*?*/ pIo->Error();
+/*N*/ }
+/*N*/ // Ohne Format ist das Attribut immer inaktiv!
+/*N*/ else pAttr = new SwFmtHeader( BOOL( FALSE ) );
+/*N*/ pIo->pStrm = p;
+/*N*/ pIo->eStartNodeType = eSave_StartNodeType;
+/*N*/
+/*N*/ return pAttr;
+/*N*/ }
+
+/*N*/ SvStream& SwFmtHeader::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ rStrm << (BYTE) IsActive();
+/*N*/ const SwFrmFmt* pFmt = GetHeaderFmt();
+/*N*/ ASSERT( !IsActive() || pFmt, "Aktiver Header ohne Format" );
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ pIo->OutFormat( SWG_FREEFMT, *pFmt );
+/*N*/ pIo->pStrm = p;
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtFooter::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ BYTE bActive;
+/*N*/ rStrm >> bActive;
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/
+/*N*/ USHORT eSave_StartNodeType = pIo->eStartNodeType;
+/*N*/ pIo->eStartNodeType = SwFooterStartNode;
+/*N*/
+/*N*/ SwFmtFooter* pAttr = NULL;
+/*N*/ if( pIo->Peek() == SWG_FREEFMT )
+/*N*/ {
+/*N*/ SwFrmFmt* pFmt = (SwFrmFmt*) pIo->InFormat( SWG_FREEFMT, NULL );
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ // --> FME 2005-01-18 #b6218408#
+/*N*/ // Emulate 5.2 footer size bug:
+/*N*/ if ( pIo->IsVersion( SWG_MAJORVERSION_50 ) )
+/*N*/ {
+/*N*/ SwFmtFrmSize aSize = pFmt->GetFrmSize( FALSE );
+/*N*/ if ( ATT_MIN_SIZE == aSize.GetSizeType() )
+/*N*/ {
+/*N*/ aSize.SetHeight( 0 );
+/*N*/ pFmt->SetAttr( aSize );
+/*N*/ }
+/*N*/ }
+/*N*/ // <--
+/*N*/ pAttr = new SwFmtFooter( pFmt );
+/*N*/ pAttr->SetActive( BOOL( bActive ) );
+/*N*/ }
+/*N*/ else
+/*?*/ pIo->Error();
+/*N*/ }
+/*N*/ // Ohne Format ist das Attribut immer inaktiv!
+/*N*/ else pAttr = new SwFmtFooter( BOOL( FALSE ) );
+/*N*/ pIo->pStrm = p;
+/*N*/ pIo->eStartNodeType = eSave_StartNodeType;
+/*N*/
+/*N*/ return pAttr;
+/*N*/ }
+
+/*N*/ SvStream& SwFmtFooter::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ rStrm << (BYTE) IsActive();
+/*N*/ const SwFrmFmt* pFmt = GetFooterFmt();
+/*N*/ ASSERT( !IsActive() || pFmt, "Aktiver Footer ohne Format" );
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ pIo->OutFormat( SWG_FREEFMT, *pFmt );
+/*N*/ pIo->pStrm = p;
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtCntnt::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ if( pIo->bInsert )
+/*N*/ {
+/*?*/ if( !pIo->pSectionDepths )
+/*?*/ pIo->pSectionDepths = new SvUShorts;
+/*?*/ pIo->pSectionDepths->Insert( (USHORT)0U, pIo->pSectionDepths->Count() );
+/*N*/ }
+/*N*/ SwStartNode* pSttNd = &pIo->InContents();
+/*N*/ if( pIo->bInsert )
+/*N*/ {
+/*?*/ ASSERT( pIo->pSectionDepths, "There is the section depth stack?" );
+/*?*/ ASSERT( pIo->pSectionDepths->Count() > 0U,
+/*?*/ "section depth stack is empty" );
+/*?*/ pIo->pSectionDepths->Remove( pIo->pSectionDepths->Count() - 1U );
+/*N*/ }
+/*N*/ pIo->pStrm = p;
+/*N*/ return new SwFmtCntnt( pSttNd );
+/*N*/ }
+
+/*N*/ SvStream& SwFmtCntnt::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ pIo->OutContents( *GetCntntIdx() );
+/*N*/ pIo->pStrm = p;
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtPageDesc::Create( SvStream& rStrm, USHORT nVersion ) const
+/*N*/ {
+/*N*/ // Hier wird nur der Name im Attribut gesetzt. Spaeter wird
+/*N*/ // mit ConnectPageDescAttrs() die eigentliche Verbindung
+/*N*/ // hergestellt.
+/*N*/ BYTE bAuto;
+/*N*/ UINT16 nOff, nIdx;
+/*N*/ if( nVersion < IVER_FMTPAGEDESC_LONGPAGE )
+/*N*/ {
+/*N*/ if( nVersion < IVER_FMTPAGEDESC_NOAUTO )
+/*N*/ rStrm >> bAuto;
+/*N*/ rStrm >> nOff >> nIdx;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ULONG nOff32 = Sw3IoImp::InULong( rStrm );
+/*N*/ ASSERT( nOff32 <= USHRT_MAX, "SwFmtPageDesc: Seitenzahl > USHRT_MAX" );
+/*N*/ nOff = (USHORT)nOff32;
+/*N*/ rStrm >> nIdx;
+/*N*/ }
+/*N*/ SwFmtPageDesc* pAttr = new SwFmtPageDesc( 0 );
+/*N*/ pAttr->SetNumOffset( nOff );
+/*N*/ pAttr->SetDescNameIdx( nIdx );
+/*N*/ return pAttr;
+/*N*/ }
+
+/*N*/ USHORT SwFmtPageDesc::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtPageDesc: Gibt es ein neues Fileformat?" );
+/*N*/ return ( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ) ? 0 : IVER_FMTPAGEDESC_LONGPAGE;
+/*N*/ }
+
+/*N*/ SvStream& SwFmtPageDesc::Store( SvStream& rStrm, USHORT nVersion) const
+/*N*/ {
+/*N*/ ASSERT( IVER_FMTPAGEDESC_NOAUTO != nVersion,
+/*N*/ "SwFmtPageDesc: Export der Item-Version wird nicht unterstuetzt" );
+/*N*/
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ const SwPageDesc* pDesc = GetPageDesc();
+/*N*/ USHORT nIdx = IDX_NO_VALUE;
+/*N*/ if( pDesc )
+/*N*/ nIdx = pIo->aStringPool.Find( pDesc->GetName(), pDesc->GetPoolFmtId() );
+/*N*/ USHORT nOff = GetNumOffset();
+/*N*/ // Eventuell das Header-Bit setzen, dass Seitennummern vorkommen
+/*N*/ if( nOff )
+/*N*/ pIo->nFileFlags |= SWGF_HAS_PGNUMS;
+/*N*/
+/*N*/ if( nVersion < IVER_FMTPAGEDESC_LONGPAGE )
+/*N*/ {
+/*N*/ rStrm << (BYTE) 0x01 // nicht mehr bei IVER_..._NOAUTO
+/*N*/ << (UINT16) nOff
+/*N*/ << (UINT16) nIdx;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Sw3IoImp::OutULong( rStrm, nOff );
+/*N*/ rStrm << (UINT16) nIdx;
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtFlyCnt::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/
+/*N*/ USHORT eSave_StartNodeType = pIo->eStartNodeType;
+/*N*/ pIo->eStartNodeType = SwFlyStartNode;
+/*N*/
+/*N*/ SwFrmFmt* pTmpFmt = NULL;
+/*N*/ BYTE cKind = pIo->Peek();
+/*N*/ if( SWG_SDRFMT==cKind )
+/*N*/ {
+/*N*/ if( pIo->bInsIntoHdrFtr )
+/*N*/ {
+/*?*/ pIo->SkipRec();
+/*?*/ pIo->bDrawFmtSkipped = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pTmpFmt = (SwFrmFmt*) pIo->InFormat( SWG_SDRFMT, NULL );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pTmpFmt = (SwFrmFmt*) pIo->InFormat( SWG_FLYFMT, NULL );
+/*N*/ }
+/*N*/
+/*N*/ pIo->pStrm = p;
+/*N*/ pIo->eStartNodeType = eSave_StartNodeType;
+/*N*/
+/*N*/ if( pTmpFmt )
+/*N*/ return new SwFmtFlyCnt( pTmpFmt );
+/*N*/
+/*?*/ if( !pIo->bInsIntoHdrFtr || SWG_SDRFMT!=cKind )
+/*?*/ pIo->Error();
+/*?*/ return NULL;
+/*N*/ }
+
+// OD 27.06.2003 #108784# - method to determine, if frame format is allowed
+// to be exported in SW3IO.
+// Drawing frame formats aren't allowed to be exported.
+bool SwFmtFlyCnt::Sw3ioExportAllowed() const
+{
+ bool bSw3ioExportAllowed = true;
+
+ if ( RES_DRAWFRMFMT == pFmt->Which() )
+ {
+ const SwFmtAnchor& rFmtAnchor = pFmt->GetAnchor();
+ if ( rFmtAnchor.GetAnchorId() != FLY_PAGE &&
+ pFmt->GetDoc()->IsInHeaderFooter( rFmtAnchor.GetCntntAnchor()->nNode ) )
+ {
+ bSw3ioExportAllowed = false;
+ }
+ }
+
+ return bSw3ioExportAllowed;
+}
+
+/*N*/ SvStream& SwFmtFlyCnt::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ SwFrmFmt* pFmt = GetFrmFmt();
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ if( RES_DRAWFRMFMT == pFmt->Which() )
+/*N*/ pIo->OutFormat( SWG_SDRFMT, *pFmt );
+/*N*/ else
+/*N*/ pIo->OutFormat( SWG_FLYFMT, *pFmt );
+/*N*/ pIo->pStrm = p;
+/*N*/ }
+/*N*/ return rStrm;
+/*N*/ }
+
+//////////////////////////////// Text-Attribute ////////////////////////////
+
+/*N*/ SfxPoolItem* SwFmtRefMark::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ String aName;
+/*N*/ rStrm.ReadByteString( aName, rStrm.GetStreamCharSet() );
+/*N*/ return new SwFmtRefMark( aName );
+/*N*/ }
+
+/*N*/ SvStream& SwFmtRefMark::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ return rStrm.WriteByteString( GetRefName(), rStrm.GetStreamCharSet() );
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtCharFmt::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ UINT16 nIdx;
+/*N*/ rStrm >> nIdx;
+/*N*/ if( nIdx == IDX_NO_VALUE )
+/*N*/ return NULL;
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SwCharFmt* pChFmt = (SwCharFmt*) pIo->FindFmt( nIdx, SWG_CHARFMT );
+/*N*/ return new SwFmtCharFmt( pChFmt );
+/*N*/ }
+
+/*N*/ SvStream& SwFmtCharFmt::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SwCharFmt* pFmt = (SwCharFmt*) GetRegisteredIn();
+/*N*/ return rStrm << (UINT16) pIo->aStringPool.Find( pFmt->GetName(),
+/*N*/ pFmt->GetPoolFmtId() );
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwFmtINetFmt::Create( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ UINT16 nId1, nId2;
+/*N*/ String aURL, aTarget;
+/*N*/ rStrm.ReadByteString( aURL, rStrm.GetStreamCharSet() );
+/*N*/ rStrm.ReadByteString( aTarget, rStrm.GetStreamCharSet() );
+/*N*/ rStrm >> nId1 >> nId2;
+/*N*/
+/*N*/ aURL = ::binfilter::StaticBaseUrl::SmartRelToAbs( aURL );
+/*N*/ SwFmtINetFmt *pNew = new SwFmtINetFmt( aURL, aTarget );
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ if( nId1 != IDX_NO_VALUE )
+/*N*/ {
+/*?*/ SwCharFmt* pChFmt = (SwCharFmt*) pIo->FindFmt( nId1, SWG_CHARFMT );
+/*?*/ if( pChFmt )
+/*?*/ {
+/*?*/ pNew->aINetFmt = pChFmt->GetName();
+/*?*/ pNew->nINetId = pChFmt->GetPoolFmtId();
+/*?*/ }
+/*N*/ }
+/*N*/ if( nId2 != IDX_NO_VALUE )
+/*N*/ {
+/*?*/ SwCharFmt* pChFmt = (SwCharFmt*) pIo->FindFmt( nId2, SWG_CHARFMT );
+/*?*/ if( pChFmt )
+/*?*/ {
+/*?*/ pNew->aVisitedFmt = pChFmt->GetName();
+/*?*/ pNew->nVisitedId = pChFmt->GetPoolFmtId();
+/*?*/ }
+/*N*/ }
+/*N*/ USHORT nCnt;
+/*N*/ rStrm >> nCnt;
+/*N*/ while( nCnt-- )
+/*N*/ {
+/*N #i27164#*/ USHORT nCurKey;
+/*N #i27164#*/ String aLibName, aMacName;
+/*N #i27164#*/ rStrm >> nCurKey;
+/*N #i27164#*/ rStrm.ReadByteString( aLibName, rStrm.GetStreamCharSet() );
+/*N #i27164#*/ rStrm.ReadByteString( aMacName, rStrm.GetStreamCharSet() );
+/*N #i27164#*/ pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName, STARBASIC ) );
+/*N*/ }
+/*N*/ if( nIVer >= 1 )
+/*N*/ {
+/*N*/ String aName;
+/*N*/ rStrm.ReadByteString( aName, rStrm.GetStreamCharSet() );;
+/*N*/ pNew->SetName( aName );
+/*N*/ }
+/*N*/ if( nIVer >= 2 )
+/*N*/ {
+/*N*/ rStrm >> nCnt;
+/*N*/ while( nCnt-- )
+/*N*/ {
+/*N #i27164#*/ USHORT nCurKey, nScriptType;
+/*N #i27164#*/ String aLibName, aMacName;
+/*N #i27164#*/ rStrm >> nCurKey;
+/*N #i27164#*/ rStrm.ReadByteString( aLibName, rStrm.GetStreamCharSet() );
+/*N #i27164#*/ rStrm.ReadByteString( aMacName, rStrm.GetStreamCharSet() );
+/*N #i27164#*/ rStrm >> nScriptType;
+/*N #i27164#*/ pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName,
+/*N #i27164#*/ (ScriptType)nScriptType ) );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return pNew;
+/*N*/ }
+
+/*N*/ SvStream& SwFmtINetFmt::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ ASSERT( nIVer != USHRT_MAX,
+/*N*/ "SwFmtINetFmt: Wer faengt da Version USHRT_MAX nicht ab?" );
+/*N*/
+/*N*/ UINT16 nId1 = IDX_NO_VALUE;
+/*N*/ UINT16 nId2 = IDX_NO_VALUE;
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ if( aINetFmt.Len() )
+/*?*/ nId1 = (UINT16) pIo->aStringPool.Find( aINetFmt, nINetId );
+/*N*/ if( aVisitedFmt.Len() )
+/*?*/ nId2 = (UINT16) pIo->aStringPool.Find( aVisitedFmt, nVisitedId );
+/*N*/ String aURL( GetValue() );
+/*N*/ lcl_sw3io__ConvertMarkToOutline( aURL );
+/*N*/ rStrm.WriteByteString( ::binfilter::StaticBaseUrl::AbsToRel( aURL URL_DECODE ),
+/*N*/ rStrm.GetStreamCharSet() );
+/*N*/ rStrm.WriteByteString( aTargetFrame, rStrm.GetStreamCharSet() );
+/*N*/ rStrm << nId1 << nId2;
+/*N*/
+/*N*/ USHORT nCnt = pMacroTbl ? (USHORT)pMacroTbl->Count() : 0, nMax = nCnt;
+/*N*/ if( nCnt )
+/*N*/ {
+/*?*/ for( SvxMacro* pMac = pMacroTbl->First(); pMac; pMac = pMacroTbl->Next() )
+/*?*/ if( STARBASIC != pMac->GetScriptType() )
+/*?*/ --nCnt;
+/*N*/ }
+/*N*/
+/*N*/ rStrm << nCnt;
+/*N*/
+/*N*/ if( nCnt )
+/*N*/ {
+/*N*/ // erstmal nur die BasicMacros schreiben, die konnte der 3. noch
+/*?*/ for( SvxMacro* pMac = pMacroTbl->First(); pMac; pMac = pMacroTbl->Next() )
+/*?*/ if( STARBASIC == pMac->GetScriptType() )
+/*?*/ {
+/*?*/ rStrm << (USHORT)pMacroTbl->GetCurKey();
+/*?*/ rStrm.WriteByteString( pMac->GetLibName(),
+/*?*/ rStrm.GetStreamCharSet() );
+/*?*/ rStrm.WriteByteString( pMac->GetMacName(),
+/*?*/ rStrm.GetStreamCharSet() );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nIVer >= 1 )
+/*N*/ rStrm.WriteByteString( GetName(), rStrm.GetStreamCharSet() );
+/*N*/
+/*N*/ if( nIVer >= 2 )
+/*N*/ {
+/*N*/ // ab der 4.0 ( nach Technical Beta ) kennen wir auch JavaScript
+/*N*/ // also noch alle JavaScript-Macros schreiben
+/*N*/ nCnt = nMax - nCnt;
+/*N*/ rStrm << nCnt;
+/*N*/
+/*N*/ if( nCnt )
+/*N*/ {
+/*?*/ for( SvxMacro* pMac = pMacroTbl->First(); pMac; pMac = pMacroTbl->Next() )
+/*?*/ if( STARBASIC != pMac->GetScriptType() )
+/*?*/ {
+/*?*/ rStrm << (USHORT)pMacroTbl->GetCurKey();
+/*?*/ rStrm.WriteByteString( pMac->GetLibName(),
+/*?*/ rStrm.GetStreamCharSet() );
+/*?*/ rStrm.WriteByteString( pMac->GetMacName(),
+/*?*/ rStrm.GetStreamCharSet() );
+/*?*/ rStrm << (USHORT)pMac->GetScriptType();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ USHORT SwFmtINetFmt::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtINetFmr: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? USHRT_MAX : 2;
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwFmtFtn::Create( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ String aNumber;
+/*N*/ UINT16 nNumber;
+/*N*/ rStrm >> nNumber;
+/*N*/ rStrm.ReadByteString( aNumber, rStrm.GetStreamCharSet() );
+/*N*/
+/*N*/ // Die Section fuer den Text erzeugen
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SwNodes& rNodes = pIo->pDoc->GetNodes();
+/*N*/ SwNodeIndex aStart( rNodes.GetEndOfInserts() );
+/*N*/ #if 0
+/*N*/ SwStartNode* pSttNd = rNodes.MakeTextSection( aStart, SwFootnoteStartNode,
+/*N*/ pIo->FindTxtColl( IDX_DFLT_VALUE ) );
+/*N*/ aStart = *pSttNd;
+/*N*/ #endif
+/*N*/ SwStartNode* pSttNd = rNodes.MakeEmptySection( aStart,SwFootnoteStartNode );
+/*N*/ aStart = *pSttNd->EndOfSectionNode();
+/*N*/
+/*N*/ if( pIo->bInsert )
+/*N*/ {
+/*?*/ if( !pIo->pSectionDepths )
+/*?*/ pIo->pSectionDepths = new SvUShorts;
+/*?*/ pIo->pSectionDepths->Insert( (USHORT)0U, pIo->pSectionDepths->Count() );
+/*N*/ }
+/*N*/ // pIo->InContents( aStart );
+/*N*/ pIo->InContents( aStart, 0, FALSE );
+/*N*/ if( pIo->bInsert )
+/*N*/ {
+/*?*/ ASSERT( pIo->pSectionDepths, "There is the section depth stack?" );
+/*?*/ ASSERT( pIo->pSectionDepths->Count() > 0U,
+/*?*/ "section depth stack is empty" );
+/*?*/ pIo->pSectionDepths->Remove( pIo->pSectionDepths->Count() - 1U );
+/*N*/ }
+/*N*/
+/*N*/ // die Seq-Nummer einlesen - fuer die Querverweise auf Fussnoten
+/*N*/ USHORT nSeqNo;
+/*N*/ BOOL bEndNote = FALSE;
+/*N*/ if( 1 <= nIVer )
+/*N*/ {
+/*N*/ rStrm >> nSeqNo;
+/*N*/ }
+/*N*/ if( 2 <= nIVer )
+/*N*/ {
+/*N*/ BYTE nFlags;
+/*N*/ rStrm >> nFlags;
+/*N*/ bEndNote = (nFlags & 0x01) != 0;
+/*N*/ }
+/*N*/
+/*N*/ SwFmtFtn aFtn( bEndNote );
+/*N*/ aFtn.SetNumStr( aNumber );
+/*N*/ aFtn.SetNumber( nNumber );
+/*N*/
+/*N*/ // Das Fussnoten-Attribut liest seine Section "auf der Wiese" ein.
+/*N*/ // Hier muss also der Start errechnet und eingetragen werden.
+/*N*/ SwFmtFtn& rNew = (SwFmtFtn&)pIo->pDoc->GetAttrPool().Put( aFtn );
+/*N*/ SwTxtFtn* pAttr = new SwTxtFtn( rNew, 0 );
+/*N*/ aStart = *pSttNd;
+/*N*/ pAttr->SetStartNode( &aStart );
+/*N*/ if( 1 <= nIVer )
+/*N*/ pAttr->SetSeqNo( nSeqNo );
+/*N*/
+/*N*/ return &rNew;
+/*N*/ }
+
+/*N*/ SvStream& SwFmtFtn::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/
+/*N*/ rStrm << (UINT16) GetNumber();
+/*N*/
+/*N*/ if( nIVer < 2 && IsEndNote() )
+/*N*/ {
+/*N*/ // Im SW 4.0 gab es noch keine End-Noten, also
+/*?*/ String aNumStr( '*' );
+/*?*/ if( GetNumStr().Len() )
+/*?*/ aNumStr += GetNumStr();
+/*?*/ else
+/*?*/ {
+/*?*/ if( pIo )
+/*?*/ aNumStr += pIo->pDoc->GetEndNoteInfo().aFmt.
+/*?*/ GetNumStr( GetNumber() );
+/*?*/ else
+/*?*/ aNumStr += String::CreateFromInt32( GetNumber() );
+/*?*/ }
+/*?*/ rStrm.WriteByteString( aNumStr, rStrm.GetStreamCharSet() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rStrm.WriteByteString( GetNumStr(), rStrm.GetStreamCharSet() );
+/*N*/ }
+/*N*/
+/*N*/ SwNodeIndex* pStart = GetTxtFtn()->GetStartNode();
+/*N*/ if( pStart )
+/*N*/ {
+/*N*/ ASSERT( pIo, "SwFmtFtn: kein Sw3Io" );
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ pIo->OutContents( *pStart );
+/*N*/ pIo->pStrm = p;
+/*N*/ }
+/*N*/ if( 1 <= nIVer )
+/*N*/ rStrm << (USHORT)pTxtAttr->GetSeqRefNo();
+/*N*/ if( 2 <= nIVer )
+/*N*/ rStrm << (BYTE)(IsEndNote() ? 0x01 : 0x00);
+/*N*/
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ USHORT SwFmtFtn::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtINetFmr: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31 == nFFVer ? 0 :
+/*N*/ (SOFFICE_FILEFORMAT_40 == nFFVer ? 1 : 2);
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwFmtFld::Create( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ SwField* pFld = pIo->InField();
+/*N*/ pIo->pStrm = p;
+/*N*/ if( !pFld )
+/*N*/ return NULL;
+/*N*/
+/*N*/ SwFmtFld* pAttr = new SwFmtFld;
+/*N*/ pAttr->pField = pFld;
+/*N*/ return pAttr;
+/*N*/ }
+
+/*N*/ SvStream& SwFmtFld::Store( SvStream& rStrm, USHORT ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ SvStream* p = pIo->pStrm;
+/*N*/ pIo->pStrm = (SvStorageStream*) &rStrm;
+/*N*/ pIo->OutField( *this );
+/*N*/ pIo->pStrm = p;
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ SfxPoolItem* SwTOXMark::Create( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ BYTE cType;
+/*N*/ UINT16 nLevel, nStrIdx = IDX_NO_VALUE;
+/*N*/ String aTypeName, aAltText, aPrimKey, aSecKey;
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/ rStrm >> cType
+/*N*/ >> nLevel;
+/*N*/
+/*N*/ if( nIVer < IVER_TOXMARK_STRPOOL )
+/*N*/ rStrm.ReadByteString( aTypeName, rStrm.GetStreamCharSet() );
+/*N*/ else
+/*N*/ rStrm >> nStrIdx;
+/*N*/
+/*N*/ rStrm.ReadByteString( aAltText, rStrm.GetStreamCharSet() );
+/*N*/ rStrm.ReadByteString( aPrimKey, rStrm.GetStreamCharSet() );
+/*N*/ rStrm.ReadByteString( aSecKey, rStrm.GetStreamCharSet() );
+/*N*/
+/*N*/ BYTE cFlags = 0;
+/*N*/ // With the 5.2, there are new tox types.
+/*N*/ if( nIVer >= IVER_TOXMARK_NEWTOX )
+/*N*/ {
+/*N*/ rStrm >> cType >> nStrIdx >> cFlags;
+/*N*/ }
+/*N*/
+/*N*/ TOXTypes eType = (TOXTypes)cType;
+/*N*/ if( nIVer >= IVER_TOXMARK_STRPOOL )
+/*N*/ {
+/*N*/ if( nStrIdx != IDX_NO_VALUE )
+/*?*/ aTypeName = pIo->aStringPool.Find( nStrIdx );
+/*N*/ else
+/*N*/ aTypeName = SwTOXBase::GetTOXName( eType );
+/*N*/ }
+/*N*/
+/*N*/ // Search tox type
+/*N*/ const SwTOXType *pType = NULL;
+/*N*/ USHORT n = pIo->pDoc->GetTOXTypeCount( eType );
+/*N*/ for( USHORT i = 0; i < n; i++ )
+/*N*/ {
+/*N*/ const SwTOXType *pTmp = pIo->pDoc->GetTOXType( eType, i );
+/*N*/ if( pTmp && pTmp->GetTypeName() == aTypeName )
+/*N*/ {
+/*N*/ pType = pTmp;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // If the tox type is unknown, a new one is created.
+/*N*/ if( !pType )
+/*N*/ {
+/*N*/ pIo->pDoc->InsertTOXType( SwTOXType( eType, aTypeName ) );
+/*N*/ pType = pIo->pDoc->GetTOXType( eType, n );
+/*N*/ }
+/*N*/ ASSERT( pType, "unknown tox type" );
+/*N*/ if( !pType )
+/*N*/ {
+/*?*/ pIo->Error();
+/*N*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwTOXMark* pMark = new SwTOXMark( pType );
+/*N*/ pMark->SetAlternativeText( aAltText );
+/*N*/ switch( eType )
+/*N*/ {
+/*N*/ case TOX_INDEX:
+/*N*/ if( aPrimKey.Len() )
+/*N*/ pMark->SetPrimaryKey( aPrimKey );
+/*N*/ if( aSecKey.Len() )
+/*?*/ pMark->SetSecondaryKey( aSecKey );
+/*N*/ break;
+/*N*/ case TOX_USER:
+/*N*/ case TOX_CONTENT:
+/*N*/ case TOX_ILLUSTRATIONS:
+/*N*/ case TOX_OBJECTS:
+/*N*/ case TOX_TABLES:
+/*N*/ case TOX_AUTHORITIES:
+/*N*/ pMark->SetLevel( nLevel );
+/*N*/ break;
+/*N*/ default:
+/*?*/ pIo->Error();
+/*?*/ delete pMark;
+/*?*/ return 0;
+/*N*/ }
+/*N*/
+/*N*/ pMark->SetAutoGenerated( 0 != (cFlags & 0x01) );
+/*N*/ pMark->SetMainEntry( 0 != (cFlags & 0x02) );
+/*N*/
+/*N*/ return pMark;
+/*N*/ }
+
+/*N*/ SvStream& SwTOXMark::Store( SvStream& rStrm, USHORT nIVer ) const
+/*N*/ {
+/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+/*N*/
+/*N*/ // Types greater or equal than TOX_ILLUSTRATIONS are new with versuion
+/*N*/ // 5.2. That for, they must be mapped to a TOX_USER for the 5.1, but their
+/*N*/ // original type has to be written, too. Some attention must be kept to
+/*N*/ // the name as well, because if it is the tox types default name, it
+/*N*/ // must be written for the 5.1 but it has not to be seen by< the 5.2.
+/*N*/ TOXTypes eType = GetTOXType()->GetType();
+/*N*/ TOXTypes eOldType = eType >= TOX_ILLUSTRATIONS ? TOX_USER : eType;
+/*N*/ rStrm << (BYTE) eOldType
+/*N*/ << (UINT16) nLevel;
+/*N*/
+/*N*/ const String& rTypeName = GetTOXType()->GetTypeName();
+/*N*/ if( nIVer < IVER_TOXMARK_STRPOOL )
+/*N*/ {
+/*N*/ // Nur 3.1/4.0-Export
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_40 >= rStrm.GetVersion(),
+/*N*/ "SwToxMark: FF-Version und Item-Version passen nicht" );
+/*N*/ rStrm.WriteByteString( rTypeName, rStrm.GetStreamCharSet() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Nur 5.0 und folgende
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_40 < rStrm.GetVersion(),
+/*N*/ "SwToxMark: FF-Version und Item-Version passen nicht" );
+/*N*/ UINT16 nStrIdx =
+/*N*/ ( eType >= TOX_ILLUSTRATIONS ||
+/*N*/ rTypeName != SwTOXBase::GetTOXName(eType) )
+/*N*/ ? pIo->aStringPool.Find( rTypeName, USHRT_MAX )
+/*N*/ : IDX_NO_VALUE;
+/*N*/ rStrm << nStrIdx;
+/*N*/ }
+/*N*/ rStrm.WriteByteString( GetAlternativeText(), rStrm.GetStreamCharSet() );
+/*N*/ rStrm.WriteByteString( aPrimaryKey, rStrm.GetStreamCharSet() );
+/*N*/ rStrm.WriteByteString( aSecondaryKey, rStrm.GetStreamCharSet() );
+/*N*/ if( nIVer >= IVER_TOXMARK_NEWTOX )
+/*N*/ {
+/*N*/ BYTE cFlags = 0;
+/*N*/ if( IsAutoGenerated() )
+/*N*/ cFlags |= 0x01;
+/*N*/ if( IsMainEntry() )
+/*N*/ cFlags |= 0x02;
+/*N*/ UINT16 nStrIdx = rTypeName != SwTOXBase::GetTOXName(eType)
+/*N*/ ? pIo->aStringPool.Find( rTypeName, USHRT_MAX )
+/*N*/ : IDX_NO_VALUE;
+/*N*/ rStrm << (BYTE)eType << nStrIdx << cFlags;
+/*N*/ }
+/*N*/
+/*N*/ return rStrm;
+/*N*/ }
+
+/*N*/ USHORT SwTOXMark::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwTOXMark: Gibt es ein neues Fileformat?" );
+/*N*/ return ( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ) ? 0 : IVER_TOXMARK_NEWTOX;
+/*N*/ }
+
+SfxPoolItem* SwFmtRuby::Create(SvStream & rStrm, USHORT nVer) const
+{
+ String sRubyTxt;
+ SwFmtRuby* pRet = new SwFmtRuby( sRubyTxt );
+
+ BOOL bVal;
+ rStrm >> bVal;
+
+ return pRet;
+}
+
+SvStream& SwFmtRuby::Store( SvStream & rStrm, USHORT nIVer ) const
+{
+ BOOL bVal = 0;
+ rStrm << bVal;
+
+ ASSERT( FALSE, "Ruby atribute stored in old format" )
+
+ return rStrm;
+}
+
+/*N*/ USHORT SwFmtRuby::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtRuby: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+
+SfxPoolItem* SwTblBoxFormula::Create( SvStream & rStrm, USHORT ) const
+{
+ String sStr;
+ rStrm.ReadByteString( sStr, rStrm.GetStreamCharSet() );
+ return new SwTblBoxFormula( sStr );
+}
+
+SvStream& SwTblBoxFormula::Store( SvStream & rStrm, USHORT ) const
+{
+ if( EXTRNL_NAME != GetNameType() && pDefinedIn )
+ {
+ const SwTableNode* pTblNd;
+ const SwTableBox* pBox = (SwTableBox*)GetTableBox();
+ if( pBox && pBox->GetSttNd() &&
+ 0 != ( pTblNd = pBox->GetSttNd()->FindTableNode() ))
+ {
+ ((SwTblBoxFormula*)this)->PtrToBoxNm( &pTblNd->GetTable() );
+ }
+ }
+ return rStrm.WriteByteString( GetFormula(), rStrm.GetStreamCharSet() );
+}
+
+/*N*/ USHORT SwTblBoxFormula::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwTblBoxFormula: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_31==nFFVer ? USHRT_MAX : 0;
+/*N*/ }
+
+SfxPoolItem* SwFmtChain::Create(SvStream& rStrm, USHORT nIVer) const
+{
+ SwFmtChain *pChain = new SwFmtChain;
+
+ UINT16 nPrevIdx, nNextIdx;
+ if( nIVer>0 )
+ {
+ rStrm >> nPrevIdx
+ >> nNextIdx;
+
+ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+ ASSERT( pIo || nPrevIdx != IDX_NO_VALUE || nNextIdx != IDX_NO_VALUE,
+ "SwFmtChain: kein sw3io: Verkettung nicht moeglich" );
+ if( pIo )
+ {
+ // Wenn hier ein Format schon gelesen wurde, erfolgt die
+ // Verkettung hier in der einen Richtung und in InFormat
+ // in der anderen Richtung.
+ // Wenn das Format noch nicht gefunden wurde, erfolgt die
+ // Verkettung wenn das Ziel-Format gelesen wird.
+ if( nPrevIdx != IDX_NO_VALUE )
+ {
+ SwFlyFrmFmt *pPrevFlyFmt =
+ (SwFlyFrmFmt *)pIo->aStringPool.FindCachedFmt( nPrevIdx );
+ ASSERT( pIo->bInsert ||
+ (SwFlyFrmFmt *)pIo->pDoc->FindSpzFrmFmtByName(
+ pIo->aStringPool.Find( nPrevIdx ) ) == pPrevFlyFmt,
+ "falsches Prev-Format gechached?" );
+ pChain->SetPrev( pPrevFlyFmt );
+ }
+ if( nNextIdx != IDX_NO_VALUE )
+ {
+ SwFlyFrmFmt *pNextFlyFmt =
+ (SwFlyFrmFmt *)pIo->aStringPool.FindCachedFmt( nNextIdx );
+ ASSERT( pIo->bInsert ||
+ (SwFlyFrmFmt *)pIo->pDoc->FindSpzFrmFmtByName(
+ pIo->aStringPool.Find( nNextIdx ) ) == pNextFlyFmt,
+ "falsches Prev-Format gechached?" );
+ pChain->SetNext( pNextFlyFmt );
+ }
+ }
+ }
+
+ return pChain;
+}
+
+/*N*/ SvStream& SwFmtChain::Store(SvStream &rStrm, USHORT nIVer) const
+/*N*/ {
+ ASSERT( nIVer != USHRT_MAX,
+ "SwFmtChain: Wer faengt da Version USHRT_MAX nicht ab?" );
+
+ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
+ USHORT nPrevIdx = IDX_NO_VALUE, nNextIdx = IDX_NO_VALUE;
+ if( pIo )
+ {
+ if( GetPrev() )
+ {
+ nPrevIdx = pIo->aStringPool.Find( GetPrev()->GetName(),
+ GetPrev()->GetPoolFmtId() );
+ }
+ if( GetNext() )
+ {
+ nNextIdx = pIo->aStringPool.Find( GetNext()->GetName(),
+ GetNext()->GetPoolFmtId() );
+ }
+ }
+
+ rStrm << (UINT16)nPrevIdx
+ << (UINT16)nNextIdx;
+
+ return rStrm;
+/*N*/ }
+
+/*N*/ USHORT SwFmtChain::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwFmtChain: Gibt es ein neues Fileformat?" );
+/*N*/ return SOFFICE_FILEFORMAT_40 < nFFVer ? 1 : USHRT_MAX;
+/*N*/ }
+
+SfxPoolItem* SwTextGridItem::Create(SvStream& rStrm, USHORT nIVer) const
+{
+ SwTextGridItem* pRet = new SwTextGridItem;
+ BOOL bVal;
+ rStrm >> bVal;
+
+ return pRet;
+}
+
+SvStream& SwTextGridItem::Store( SvStream & rStrm, USHORT nIVer ) const
+{
+ BOOL bVal = 0;
+ rStrm << bVal;
+
+ return rStrm;
+}
+
+/*N*/ USHORT SwTextGridItem::GetVersion( USHORT nFFVer ) const
+/*N*/ {
+/*N*/ ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_40==nFFVer ||
+/*N*/ SOFFICE_FILEFORMAT_50==nFFVer,
+/*N*/ "SwTextGridItem: Gibt es ein neues Fileformat?" );
+/*N*/
+/*N*/ return USHRT_MAX;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3num.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3num.cxx
new file mode 100644
index 000000000000..f08e7b30a13d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3num.cxx
@@ -0,0 +1,1498 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "swerror.h"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <errhdl.hxx>
+
+#include "pam.hxx"
+#include "ndtxt.hxx"
+
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+
+#include <vcl/font.hxx>
+#include <tools/tenccvt.hxx>
+
+#include <fmtornt.hxx>
+#include <charfmt.hxx>
+#include <poolfmt.hxx>
+#include <frmatr.hxx>
+
+#include "sw3imp.hxx"
+#include "ftninfo.hxx"
+#include "pagedesc.hxx"
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+////////////////////////////////////////////////////////////////////////////
+
+/*N*/ SV_IMPL_OP_PTRARR_SORT(Sw3NumRuleInfos, Sw3NumRuleInfoPtr)
+
+// Konvertierung BYTE/BOOL von SwNumFmt::GetUpperLever fuer SW3.1/4.0
+/*N*/ BOOL lcl_sw3io__IsInclUpperLevel( BYTE nUpperLevel )
+/*N*/ {
+/*N*/ return 1 < nUpperLevel;
+/*N*/ }
+/*N*/
+/*N*/ BYTE lcl_sw3io__GetIncludeUpperLevel( BOOL bInclUpperLevel )
+/*N*/ {
+/*N*/ return bInclUpperLevel ? MAXLEVEL : 1;
+/*N*/ }
+
+// Numerierungs-Format einlesen
+/*N*/ void Sw3IoImp::InNumFmt( SwNumFmt& rFmt )
+/*N*/ {
+/*N*/ // Flags:
+/*N*/ // 0x10 - Bullet-Font gueltig
+/*N*/ BYTE cFlags, eType, eNumAdjust;
+/*N*/ sal_Char cBullet8;
+/*N*/ USHORT nFmt, nStart;
+/*N*/ String aFontName, aFontStyle, sPrefix, sPostfix;
+/*N*/ BYTE eFamily, ePitch, eCharSet;
+/*N*/ INT32 nLSpace, nFirstLineOffset;
+/*N*/ BYTE nUpperLevel;
+/*N*/ OpenRec( SWG_NUMFMT );
+/*N*/ InString( *pStrm, sPrefix );
+/*N*/ InString( *pStrm, sPostfix );
+/*N*/ InString( *pStrm, aFontName );
+/*N*/ InString( *pStrm, aFontStyle );
+/*N*/ *pStrm >> nFmt
+/*N*/ >> eType
+/*N*/ >> cBullet8;
+/*N*/
+/*N*/ // nUpperLevel war bis zur 5.0 nur ein Flag.
+/*N*/ if( IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ *pStrm >> nUpperLevel;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ BYTE bInclUpperLevel;
+/*N*/ *pStrm >> bInclUpperLevel;
+/*N*/ nUpperLevel = lcl_sw3io__GetIncludeUpperLevel( bInclUpperLevel );
+/*N*/ }
+/*N*/
+/*N*/ *pStrm >> nStart
+/*N*/ >> eNumAdjust
+/*N*/ >> nLSpace
+/*N*/ >> nFirstLineOffset
+/*N*/ >> eFamily
+/*N*/ >> ePitch
+/*N*/ >> eCharSet;
+/*N*/ if(RTL_TEXTENCODING_DONTKNOW== eCharSet)
+/*N*/ eCharSet = RTL_TEXTENCODING_SYMBOL;
+/*N*/ else if( RTL_TEXTENCODING_SYMBOL != eCharSet )
+/*N*/ eCharSet = GetSOLoadTextEncoding( rtl_TextEncoding( eCharSet ),
+/*?*/ pStrm->GetVersion() );
+/*N*/ cFlags = OpenFlagRec();
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ sal_Bool bBatsToSymbol = sal_False;
+/*N*/ sal_Bool bMathToSymbol = sal_False;
+/*N*/ if( (cFlags & 0x10) != 0 && RTL_TEXTENCODING_SYMBOL == eCharSet )
+/*N*/ {
+/*N*/ if( aFontName.EqualsIgnoreCaseAscii( sStarBats ) )
+/*N*/ bBatsToSymbol = sal_True;
+/*N*/ else if( aFontName.EqualsIgnoreCaseAscii( sStarMath ) )
+/*N*/ bMathToSymbol = sal_True;
+/*N*/ }
+/*N*/
+/*N*/ rFmt.SetNumberingType((sal_Int16)eType );
+/*N*/ if( bBatsToSymbol )
+/*N*/ rFmt.SetBulletChar( ConvStarBatsCharToStarSymbol( cBullet8 ) );
+/*N*/ else if( bMathToSymbol )
+ rFmt.SetBulletChar( ConvStarMathCharToStarSymbol( cBullet8 ) );
+/*N*/ else
+/*N*/ rFmt.SetBulletChar( ByteString::ConvertToUnicode( cBullet8, eCharSet ) );
+/*N*/ rFmt.SetIncludeUpperLevels( nUpperLevel );
+/*N*/ rFmt.SetStart( nStart );
+/*N*/ rFmt.SetNumAdjust( SvxAdjust( eNumAdjust ));
+/*N*/ rFmt.SetAbsLSpace( (USHORT)nLSpace );
+/*N*/ rFmt.SetFirstLineOffset( (short)nFirstLineOffset );
+/*N*/ rFmt.SetSuffix( sPostfix );
+/*N*/ rFmt.SetPrefix( sPrefix );
+/*N*/
+/*N*/ // Nur im spaeten 3.1-Format steht hier die Zeichen-Vorlage,
+/*N*/ // ab dem 4.0-Format steht sie dann wieder oeben.
+/*N*/ if( IsVersion( SWG_NEWNUMRULE, SWG_EXPORT31 ) )
+/*N*/ {
+/*?*/ *pStrm >> nFmt;
+/*N*/ }
+/*N*/
+/*N*/ // erst das Format setzen
+/*N*/ if( nFmt != IDX_NO_VALUE )
+/*N*/ rFmt.SetCharFmt( (SwCharFmt*) FindFmt( nFmt, SWG_CHARFMT ) );
+/*N*/
+/*N*/ // Relative Abstaende gab es in spaeten 3.1- und im 4.0-Format, aber
+/*N*/ // nicht mehr im 5.0 Format.
+/*N*/ if( IsVersion( SWG_NEWNUMRULE, SWG_EXPORT31, SWG_DESKTOP40, SWG_LONGIDX ) )
+/*N*/ {
+/*N*/ BYTE bRelSpace;
+/*N*/ INT32 nRelLSpace;
+/*N*/
+/*N*/ *pStrm >> bRelSpace
+/*N*/ >> nRelLSpace;
+/*N*/ }
+/*N*/
+/*N*/ // Den Rest gibt es in spaeten 3.1-Formaten und seit dem 4.0-Format
+/*N*/ if( IsVersion( SWG_NEWNUMRULE, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ {
+/*N*/ USHORT nTextOffset;
+/*N*/ *pStrm >> nTextOffset;
+/*N*/
+/*N*/ rFmt.SetCharTextDistance( nTextOffset );
+/*N*/
+/*N*/ if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
+/*N*/ {
+/*?*/ BYTE cF;
+/*?*/ Size aSz;
+/*?*/
+/*?*/ *pStrm >> aSz.Width() >> aSz.Height();
+/*?*/
+/*?*/ *pStrm >> cF;
+/*?*/ if( cF )
+/*?*/ {
+/*?*/ SvxBrushItem* pBrush = 0;
+/*?*/ SwFmtVertOrient* pVOrient = 0;
+/*?*/ USHORT nVer;
+/*?*/
+/*?*/ if( cF & 1 )
+/*?*/ {
+/*?*/ *pStrm >> nVer;
+/*?*/ pBrush = (SvxBrushItem*)GetDfltAttr( RES_BACKGROUND )
+/*?*/ ->Create( *pStrm, nVer );
+/*?*/ }
+/*?*/
+/*?*/ if( cF & 2 )
+/*?*/ {
+/*?*/ *pStrm >> nVer;
+/*?*/ pVOrient = (SwFmtVertOrient*)GetDfltAttr( RES_VERT_ORIENT )
+/*?*/ ->Create( *pStrm, nVer );
+/*?*/ }
+/*?*/ SvxFrameVertOrient eOrient = SVX_VERT_NONE;
+/*?*/ if(pVOrient)
+/*?*/ eOrient = (SvxFrameVertOrient)pVOrient->GetVertOrient();
+/*?*/ rFmt.SetGraphicBrush( pBrush, &aSz, pVOrient ? &eOrient : 0);
+/*?*/
+/*?*/ // Ggf. Grafik holen, damit nicht neu numeriert wird,
+/*?*/ // wenn die Grafik (spaeter) geladen wird.
+/*?*/ //if( pBrush && rFmt.GetCharFmt() )
+/*?*/ // rFmt.GetGraphic();
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*N*/ {
+/*N*/ Font aFont;
+/*N*/ aFont.SetName( aFontName );
+/*N*/ aFont.SetStyleName( aFontStyle );
+/*N*/ aFont.SetFamily( FontFamily( eFamily ) );
+/*N*/ aFont.SetPitch( FontPitch( ePitch ) );
+/*N*/ aFont.SetCharSet( eCharSet );
+/*N*/ if( bMathToSymbol || bBatsToSymbol )
+/*N*/ {
+/*N*/ aFont = SwNumRule::GetDefBulletFont();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ aFont.SetName( aFontName );
+/*?*/ aFont.SetStyleName( aFontStyle );
+/*?*/ aFont.SetFamily( FontFamily( eFamily ) );
+/*?*/ aFont.SetPitch( FontPitch( ePitch ) );
+/*?*/ aFont.SetCharSet( rtl_TextEncoding( eCharSet ) );
+/*?*/ aFont.SetCharSet(
+/*?*/ GetSOLoadTextEncoding( rtl_TextEncoding( eCharSet ),
+/*?*/ pStrm->GetVersion() ) );
+/*N*/ }
+/*N*/ // muss sein...
+/*N*/ aFont.SetTransparent( TRUE );
+/*N*/ rFmt.SetBulletFont( &aFont );
+/*N*/
+/*N*/ // JP 13.10.95: kleiner BugFix fuer vordefinierte benannte NumRules
+/*N*/ // aus der Configuration: diese lasen Bullet Fonts nicht
+/*N*/ // richtig ein - Prefix/PostFixString koennen dadurch
+/*N*/ // ungueltig sein. AMA kommt damit leicht durcheinander
+/*N*/ if( sPrefix.Len() > 50 ) // Max-Length vom Dialog
+/*?*/ rFmt.SetPrefix( aEmptyStr );
+/*N*/ if( sPostfix.Len() > 50 ) // Max-Length vom Dialog
+/*?*/ rFmt.SetSuffix( aEmptyStr );
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_NUMFMT );
+/*N*/ }
+
+// Numerierungs-Format ausgeben
+
+
+/*N*/ void Sw3IoImp::OutNumFmt( const SwNumFmt& rFmt, USHORT nPrvAbsLSpace )
+/*N*/ {
+/*N*/ USHORT nFmt = IDX_NO_VALUE;
+/*N*/
+/*N*/ // Wegen eines Bugs in alten Readern, wird die Zeichen-Vorlage erst
+/*N*/ // im 4.0-Format hier geschrieben
+/*N*/ const SwCharFmt* pCharFmt = rFmt.GetCharFmt();
+/*N*/ if( !IsSw31Export() && pCharFmt )
+/*N*/ nFmt = aStringPool.Add( pCharFmt->GetName(), pCharFmt->GetPoolFmtId() );
+/*N*/
+/*N*/ const Font* pFont = rFmt.GetBulletFont();
+/*N*/ String aFontName, aFontStyle;
+/*N*/ BYTE cFamily = 0, cPitch = 0;
+/*N*/ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+/*N*/ BYTE cFlags = 0;
+/*N*/ sal_Bool bToBats = sal_False;
+/*N*/ if( pFont )
+/*N*/ {
+/*N*/ cFlags |= 0x10;
+/*N*/ cFamily = (BYTE) pFont->GetFamily();
+/*N*/ cPitch = (BYTE) pFont->GetPitch();
+/*N*/ aFontName = pFont->GetName();
+/*N*/ bToBats =
+/*N*/ aFontName == sStarSymbol || aFontName == sOpenSymbol;
+/*N*/ if( bToBats )
+/*N*/ aFontName = sStarBats;
+/*N*/ aFontStyle = pFont->GetStyleName();
+/*N*/
+/*N*/ eEnc = (bToBats ? RTL_TEXTENCODING_SYMBOL
+/*N*/ : GetSOStoreTextEncoding( pFont->GetCharSet(),
+/*N*/ pStrm->GetVersion() ) );
+/*N*/ }
+/*N*/
+/*N*/ sal_Int16 eType = rFmt.GetNumberingType();
+/*N*/ if( SVX_NUM_BITMAP == eType && IsSw31Export() )
+/*N*/ eType = SVX_NUM_CHAR_SPECIAL;
+/*N*/
+/*N*/ sal_Char cBullet;
+/*N*/ if( bToBats )
+/*N*/ cBullet = ConvStarSymbolCharToStarBats( rFmt.GetBulletChar() );
+/*N*/ else
+/*N*/ cBullet = ByteString::ConvertFromUnicode( rFmt.GetBulletChar(),
+/*N*/ ((pFont && RTL_TEXTENCODING_DONTKNOW != pFont->GetCharSet())
+/*N*/ ? eEnc
+/*N*/ : eSrcSet ), FALSE);
+/*N*/ if( !cBullet )
+/*N*/ cBullet = ByteString::ConvertFromUnicode( rFmt.GetBulletChar(),
+/*N*/ RTL_TEXTENCODING_SYMBOL );
+/*N*/ OpenRec( SWG_NUMFMT );
+/*N*/ OutString( *pStrm, rFmt.GetPrefix() );
+/*N*/ OutString( *pStrm, rFmt.GetSuffix() );
+/*N*/ OutString( *pStrm, aFontName );
+/*N*/ OutString( *pStrm, aFontStyle );
+/*N*/ *pStrm << (UINT16) nFmt
+/*N*/ << (BYTE) eType
+/*N*/ << cBullet;
+/*N*/
+/*N*/ // GetIncludeUpperLevel war bis zur 4.0 (inkl) nur ein Flag
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ *pStrm << (BYTE)lcl_sw3io__IsInclUpperLevel( rFmt.GetIncludeUpperLevels() );
+/*N*/ else
+/*N*/ *pStrm << (BYTE)rFmt.GetIncludeUpperLevels();
+/*N*/
+/*N*/ *pStrm << (UINT16) rFmt.GetStart()
+/*N*/ << (BYTE) rFmt.GetNumAdjust()
+/*N*/ << (INT32) rFmt.GetAbsLSpace()
+/*N*/ << (INT32) rFmt.GetFirstLineOffset()
+/*N*/ << (BYTE) cFamily
+/*N*/ << (BYTE) cPitch
+/*N*/ << (BYTE) eEnc
+/*N*/ << (BYTE) cFlags;
+/*N*/
+/*N*/ // MIB 13.11.96: im 4.0-Format wird die Zeichen-Vorlage an der alten
+/*N*/ // Position geschrieben.
+/*N*/ // *pStrm << (UINT16) nFmt
+/*N*/
+/*N*/ // Im 4.0-Format gab es mal relative Werte fuer den Abstand.
+/*N*/ // Im 3.1-Format noch nicht um im 5.0 nicht mehr.
+/*N*/ if( IsSw40Export() )
+/*N*/ {
+/*N*/ *pStrm << (BYTE) FALSE
+/*N*/ << (INT32) (rFmt.GetAbsLSpace() - nPrvAbsLSpace);
+/*N*/ }
+/*N*/
+/*N*/ // Den Rest gibt es seit der 4.0
+/*N*/ if( !IsSw31Export() )
+/*N*/ {
+/*N*/ *pStrm << (UINT16) rFmt.GetCharTextDistance();
+/*N*/
+/*N*/ if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
+/*N*/ {
+/*?*/ *pStrm << (INT32)rFmt.GetGraphicSize().Width()
+/*?*/ << (INT32)rFmt.GetGraphicSize().Height();
+/*?*/ BYTE cFlg = ( 0 != rFmt.GetBrush() ? 1 : 0 ) +
+/*?*/ ( 0 != rFmt.GetGraphicOrientation() ? 2 : 0 );
+/*?*/ *pStrm << cFlg;
+/*?*/
+/*?*/ if( rFmt.GetBrush() )
+/*?*/ {
+/*?*/ USHORT nVersion = rFmt.GetBrush()->GetVersion( (USHORT)pStrm->GetVersion() );
+/*?*/ *pStrm << nVersion;
+/*?*/ rFmt.GetBrush()->Store( *pStrm, nVersion );
+/*?*/ }
+/*?*/ if( rFmt.GetGraphicOrientation() )
+/*?*/ {
+/*?*/ USHORT nVersion = rFmt.GetGraphicOrientation()->GetVersion( (USHORT)pStrm->GetVersion() );
+/*?*/ *pStrm << nVersion;
+/*?*/ rFmt.GetGraphicOrientation()->Store( *pStrm, nVersion );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_NUMFMT );
+/*N*/ }
+
+// Numerierungs-Regelwerk einlesen
+
+
+/*N*/ SwNumRule* Sw3IoImp::InNumRule( BYTE cType )
+/*N*/ {
+/*N*/ BYTE eType, nFmt, cFmt[ MAXLEVEL ];
+/*N*/ OpenRec( cType );
+/*N*/
+/*N*/ // Den Flag-Record und Pool-Ids gibt's erst seit der 5.0. Anderenfalls
+/*N*/ // ist das Invalid-Flag immer zu setzen.
+/*N*/ USHORT nStrIdx = IDX_NO_VALUE, nPoolId = USHRT_MAX, nPoolHelpId;
+/*N*/ BYTE cFlags = 0x20, nPoolHlpFileId;
+/*N*/ if( IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ cFlags = OpenFlagRec();
+/*N*/
+/*N*/ *pStrm >> nStrIdx;
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*N*/ {
+/*N*/ *pStrm >> nPoolId
+/*N*/ >> nPoolHelpId
+/*N*/ >> nPoolHlpFileId;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ *pStrm >> eType;
+/*N*/
+/*N*/ if( IsVersion(SWG_LONGIDX) )
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ *pStrm >> nFmt;
+/*N*/
+/*N*/ // C 8.0 bug:
+/*N*/ SwNumRuleType eTemp = (SwNumRuleType) eType;
+/*N*/ String aName;
+/*N*/ if( (cFlags & 0x10) != 0 &&
+/*N*/ nPoolId >= RES_POOLNUMRULE_BEGIN &&
+/*N*/ nPoolId < RES_POOLNUMRULE_END )
+/*N*/ {
+/*N*/ // Name der Pool-Vorlage vom Dok holen.
+/*N*/ SwStyleNameMapper::FillUIName( nPoolId, aName );
+/*N*/ }
+/*N*/ else if( nStrIdx != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ aName = aStringPool.Find( nStrIdx );
+/*N*/
+/*N*/ // NumRule ist in jedem Fall Benutzer-Definiert.
+/*N*/ nPoolId = USHRT_MAX;
+/*N*/ }
+/*N*/ else if( SWG_OUTLINE == cType )
+/*N*/ aName.AssignAscii( SwNumRule::GetOutlineRuleName() );
+/*N*/ else
+/*N*/ aName = pDoc->GetUniqueNumRuleName();
+/*N*/
+/*N*/ SwNumRule* pRule = new SwNumRule( aName, eTemp, (cFlags & 0x10)==0 );
+/*N*/
+/*N*/ if( (cFlags & 0x10) != 0 )
+/*N*/ {
+/*N*/ pRule->SetPoolFmtId( nPoolId );
+/*N*/ pRule->SetPoolHelpId( nPoolHelpId );
+/*N*/ pRule->SetPoolHlpFileId( nPoolHlpFileId );
+/*N*/ }
+/*N*/ pRule->SetInvalidRule( (cFlags & 0x20) != 0 || !bNormal || bInsert );
+/*N*/ pRule->SetContinusNum( (cFlags & 0x40) != 0 );
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ pRule->SetAbsSpaces( IsVersion(SWG_NUMRELSPACE) && (cFlags & 0x80) != 0 );
+/*N*/ #endif
+/*N*/
+/*N*/ // in Zukunft koennten auch mal mehr als MAXLEVEL Formate geschrieben
+/*N*/ // werden, wir kennen aber maximal MAXLEVEL Formate davon
+/*N*/ BYTE nKnownFmt = nFmt > MAXLEVEL ? MAXLEVEL : nFmt;
+/*N*/ BYTE nRead = 0;
+/*N*/
+ int i=0;
+/*N*/ for( i = 0; i < nKnownFmt; i++ )
+/*N*/ {
+/*N*/ BYTE nFmtLvl;
+/*N*/ *pStrm >> nFmtLvl;
+/*N*/ nRead++;
+/*N*/
+/*N*/ if( nFmtLvl < MAXLEVEL )
+/*N*/ {
+/*N*/ cFmt[ i ] = nFmtLvl;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // wenn das Format zu einer Ebene gehoert, die wir nicht kennen
+/*N*/ // muessen wir dieses und alle Formate hiernach ignorieren.
+/*N*/ nKnownFmt = i;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // noch nicht gelesene Format-Nummern ueberlesen
+/*N*/ for( i=nRead; i<nFmt; i++ )
+/*N*/ {
+/*N*/ BYTE nFmtLvl;
+/*?*/ *pStrm >> nFmtLvl;
+/*N*/ }
+/*N*/
+/*N*/ for( i = 0; Good() && i < nKnownFmt; i++ )
+/*N*/ {
+/*N*/ SwNumFmt aFmt;
+/*N*/ InNumFmt( aFmt );
+/*N*/ if( SWG_OUTLINE == cType && !IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ // In der 3.1/4.0 wurden diese Werte ignoriert
+/*N*/ aFmt.SetAbsLSpace( 0U );
+/*N*/ aFmt.SetFirstLineOffset( 0 );
+/*N*/ }
+/*N*/
+/*N*/ pRule->Set( (USHORT) cFmt[ i ], aFmt );
+/*N*/ }
+/*N*/
+/*N*/ // falls es nicht unterstuetzte Formate koennte man sie ueberlesen.
+/*N*/ // Da danach aber nicht sinnvolles kommt, lassen wir das erstmal
+/*N*/ #if 0
+/*N*/ for( i = nKnownFmt; Good() && i < nFmt; i++ )
+/*N*/ SkipRec();
+/*N*/ #endif
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( SWG_OUTLINE == cType && !IsVersion(SWG_NUMRELSPACE) )
+/*N*/ {
+/*N*/ // In 3.1-/4.0-Doks muss die Outline-Numerierung noch an
+/*N*/ // die Vorlagen angepasst werden und anschliessend noch das
+/*N*/ // LRSpace-Item in der Vorlage geloescht werden.
+/*N*/
+/*N*/ const SwTxtFmtColls *pColls = pDoc->GetTxtFmtColls();
+/*N*/ USHORT nArrLen = pColls->Count();
+/*N*/ for( USHORT i=0; i<nArrLen; i++ )
+/*N*/ {
+/*N*/ SwTxtFmtColl* pColl = (*pColls)[i];
+/*N*/ BYTE nLevel = pColl->GetOutlineLevel();
+/*N*/ if( NO_NUMBERING != nLevel )
+/*N*/ {
+/*N*/ nLevel = GetRealLevel( nLevel );
+/*N*/ const SvxLRSpaceItem& rLRSpace = pColl->GetLRSpace();
+/*N*/ sal_Int32 nOldLSpace = rLRSpace.GetTxtLeft();
+/*N*/ const SwNumFmt& rNumFmt = pRule->Get( nLevel );
+/*N*/ if( IsVersion(SWG_NEWFIELDS) || rLRSpace.GetPropLeft() == 100U )
+/*N*/ {
+/*N*/ // absoluter linker Absatz-Einzug oder 5.0-Dok (dort
+/*N*/ // wurde der relative Wert nicht beachtet)
+/*N*/
+/*N*/ // In 3.1- und 4.0-Dokumenten den linken und
+/*N*/ // Ertzeilen-Einzug in die NumRule uebernehmen. In
+/*N*/ // 5.0-Dokumenten steht er dort schon.
+/*N*/ if( !IsVersion(SWG_NEWFIELDS) &&
+/*N*/ (rNumFmt.GetAbsLSpace() != rLRSpace.GetTxtLeft() ||
+/*N*/ rNumFmt.GetFirstLineOffset() !=
+/*N*/ rLRSpace.GetTxtFirstLineOfst()) )
+/*N*/ {
+/*N*/ SwNumFmt aNumFmt( rNumFmt );
+/*N*/ aNumFmt.SetAbsLSpace( (USHORT)rLRSpace.GetTxtLeft() );
+/*N*/ aNumFmt.SetFirstLineOffset(
+/*N*/ rLRSpace.GetTxtFirstLineOfst() );
+/*N*/ pRule->Set( nLevel, aNumFmt );
+/*N*/ }
+/*N*/
+/*N*/ // Den linken-Einzug in der Vorlage auf 0 setzen, damit
+/*N*/ // er nicht doppelt gezaehlt wird. Wenn das
+/*N*/ SvxLRSpaceItem aLRSpace( rLRSpace );
+/*N*/ aLRSpace.SetTxtFirstLineOfst( 0 );
+/*N*/ aLRSpace.SetTxtLeft( 0U );
+/*N*/ SwFmt *pParFmt = pColl->DerivedFrom();
+/*N*/ if( pParFmt && pParFmt->GetLRSpace() == aLRSpace )
+/*N*/ pColl->ResetAttr( RES_LR_SPACE );
+/*N*/ else if( aLRSpace != rLRSpace )
+/*N*/ pColl->SetAttr( aLRSpace );
+/*N*/ if( nOldLSpace != 0 )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pColl->GetAttrSet().GetItemState(
+/*N*/ RES_PARATR_TABSTOP, TRUE, &pItem ))
+/*N*/ {
+/*N*/ SvxTabStopItem aTStop( *(SvxTabStopItem*)pItem );
+/*N*/ lcl_sw3io__ConvertNumTabStop( aTStop, nOldLSpace );
+/*N*/ pColl->SetAttr( aTStop );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // relativer linker Absatz-Einzug in 3.1- oder 4.0-Dok
+/*N*/
+/*N*/ // Die Vorlage nicht aendern sondern stattdessen
+/*N*/ // den linken Abstand und den Erstzeilen-Einzug
+/*N*/ // in der NumRule auf 0 setzen. Da der Erstzeilen-Einzug
+/*N*/ // der Vorlage nicht ausgewertet wird, geht er verloren.
+/*?*/ if( rNumFmt.GetAbsLSpace() != 0U ||
+/*?*/ rNumFmt.GetFirstLineOffset() != 0 )
+/*?*/ {
+/*?*/ SwNumFmt aNumFmt( rNumFmt );
+/*?*/ aNumFmt.SetAbsLSpace( 0U );
+/*?*/ aNumFmt.SetFirstLineOffset( 0 );
+/*?*/ pRule->Set( nLevel, aNumFmt );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #else
+/*N*/ if( SWG_OUTLINE == cType && !IsVersion(SWG_NEWFIELDS) )
+/*N*/ {
+/*N*/ // In 3.1-/4.0-Doks muss die Outline-Numerierung noch an
+/*N*/ // die Vorlagen angepasst werden und anschliessend noch das
+/*N*/ // LRSpace-Item in der Vorlage gloescht werden.
+/*N*/
+/*N*/ const SwTxtFmtColls *pColls = pDoc->GetTxtFmtColls();
+/*N*/ USHORT nArrLen = pColls->Count();
+/*N*/ for( USHORT i=0; i<nArrLen; i++ )
+/*N*/ {
+/*N*/ SwTxtFmtColl* pColl = (*pColls)[i];
+/*N*/ BYTE nLevel = pColl->GetOutlineLevel();
+/*N*/ if( NO_NUMBERING != nLevel &&
+/*N*/ GetRealLevel(nLevel) < MAXLEVEL )
+/*N*/ {
+/*N*/ const SwNumFmt& rFmt = pRule->Get( GetRealLevel(nLevel) );
+/*N*/ const SvxLRSpaceItem& rLRSpace = pColl->GetLRSpace();
+/*N*/ if( rFmt.GetAbsLSpace() != rLRSpace.GetTxtLeft() ||
+/*N*/ rFmt.GetFirstLineOffset() != rLRSpace.GetTxtFirstLineOfst())
+/*N*/ {
+/*N*/ SwNumFmt aFmt( rFmt );
+/*N*/ aFmt.SetAbsLSpace( rLRSpace.GetTxtLeft() );
+/*N*/ aFmt.SetFirstLineOffset( rLRSpace.GetTxtFirstLineOfst() );
+/*N*/ pRule->Set( nLevel, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ CloseRec( cType );
+/*N*/ if( !Good() )
+/*?*/ delete pRule, pRule = NULL;
+/*N*/ return pRule;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InOutlineExt()
+/*N*/ {
+/*N*/ OpenRec( SWG_OUTLINEEXT );
+/*N*/
+/*N*/ BYTE nFmts;
+/*N*/ OpenFlagRec();
+/*N*/ *pStrm >> nFmts;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ const SwNumRule *pOutline = pDoc->GetOutlineNumRule();
+/*N*/ ASSERT( pOutline, "Wo ist die Outline-NumRule?" );
+/*N*/
+/*N*/ // Hier stehen jetzt die Original-linken-Abstaende der Outline-NumRule.
+/*N*/ for( BYTE i=0; i<nFmts; i++ )
+/*N*/ {
+/*N*/ BYTE nLevel;
+/*N*/ UINT16 nAbsLSpace;
+/*N*/
+/*N*/ *pStrm >> nLevel >> nAbsLSpace;
+/*N*/
+/*N*/ if( pOutline && nLevel < MAXLEVEL )
+/*N*/ {
+/*N*/ ASSERT( pOutline->GetNumFmt(nLevel), "Format nicht gesetzt?" );
+/*N*/ short nFirstLineOffset = pOutline->Get(nLevel).GetFirstLineOffset();
+/*N*/ pDoc->SetOutlineLSpace( nLevel, nFirstLineOffset, nAbsLSpace );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_OUTLINEEXT );
+/*N*/ }
+
+// Numerierungs-Regelwerk ausgeben
+
+typedef const SwTxtFmtColl *Sw3TxtFmtCollPtrConst;
+
+/*N*/ void Sw3IoImp::OutNumRule( BYTE cType, const SwNumRule& rRule )
+/*N*/ {
+/*N*/ OpenRec( cType );
+/*N*/
+/*N*/ // Ein-Flag-Record mit Pool-Ids gibt's seit der 5.0
+/*N*/ // 0x10: keine automatische Vorlage
+/*N*/ // 0x02: invalid Rule
+/*N*/ // 0x40: continus Num
+/*N*/ BYTE cFlags = 0x03;
+/*N*/ if( !IsSw31Or40Export() )
+/*N*/ {
+/*N*/ // Nur nicht-automatische Numerierungs-Regeln haben Pool-Ids
+/*N*/ if( cType != SWG_OUTLINE && !rRule.IsAutoRule() )
+/*N*/ cFlags += 0x15;
+/*N*/
+/*N*/ if( rRule.IsInvalidRule() )
+/*N*/ cFlags += 0x20;
+/*N*/
+/*N*/ if( rRule.IsContinusNum() )
+/*N*/ cFlags += 0x40;
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( rRule.IsAbsSpaces() )
+/*N*/ cFlags += 0x80;
+/*N*/ #endif
+/*N*/
+/*N*/ *pStrm << (BYTE)cFlags
+/*N*/ << (UINT16)aStringPool.Find( rRule.GetName(),
+/*N*/ rRule.GetPoolFmtId() );
+/*N*/
+/*N*/ if( cFlags & 0x10 )
+/*N*/ {
+/*N*/ *pStrm << (UINT16) rRule.GetPoolFmtId()
+/*N*/ << (UINT16) rRule.GetPoolHelpId()
+/*N*/ << (BYTE) rRule.GetPoolHlpFileId();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Der Rule Type steht im 5.0-Format noch im Flag-Record, auch wenn
+/*N*/ // es nicht so aussieht.
+/*N*/ *pStrm << (BYTE)rRule.GetRuleType();
+/*N*/
+/*N*/ // Tabelle der definierten Formate aufbauen
+/*N*/ USHORT nMaxLevel = IsSw31Or40Export() ? OLD_MAXLEVEL : MAXLEVEL;
+/*N*/ short nFmt = 0;
+ USHORT i=0;
+/*N*/ for( i = 0; i < nMaxLevel; i++ )
+/*N*/ {
+/*N*/ const SwNumFmt* pFmt = rRule.GetNumFmt( i );
+/*N*/ if( pFmt ) nFmt++;
+/*N*/ }
+/*N*/ *pStrm << (BYTE) nFmt;
+/*N*/ for( i = 0; i < nMaxLevel; i++ )
+/*N*/ {
+/*N*/ const SwNumFmt* pFmt = rRule.GetNumFmt( i );
+/*N*/ if( pFmt )
+/*N*/ *pStrm << (BYTE) i;
+/*N*/ }
+/*N*/
+/*N*/ BOOL bOutline = SWG_OUTLINE == cType;
+/*N*/ Sw3TxtFmtCollPtrConst* ppTxtColls = 0;
+/*N*/ if( bOutline && nFmt && !rRule.IsAbsSpaces() && !IsSw31Or40Export() )
+/*N*/ {
+/*N*/ const SwTxtFmtColls& rColls = *pDoc->GetTxtFmtColls();
+/*N*/ for( i=0; i<rColls.Count(); i++ )
+/*N*/ {
+/*N*/ const SwTxtFmtColl *pColl = rColls[i];
+/*N*/ BYTE nLevel = pColl->GetOutlineLevel();
+/*N*/ if( NO_NUMBERING != nLevel )
+/*N*/ {
+/*N*/ nLevel = GetRealLevel(nLevel);
+/*N*/ if( nLevel < nMaxLevel )
+/*N*/ {
+/*N*/ if(!ppTxtColls)
+/*N*/ {
+/*N*/ ppTxtColls = new Sw3TxtFmtCollPtrConst[MAXLEVEL];
+/*N*/ for( USHORT j=0; j < MAXLEVEL; j++ )
+/*N*/ ppTxtColls[j] = 0;
+/*N*/ }
+/*N*/
+/*N*/ ppTxtColls[nLevel] = pColl;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Formate ausgeben
+/*N*/ BOOL bFirst = TRUE;
+/*N*/ USHORT nPrvAbsLSpace = 0;
+/*N*/ BYTE nAbsLSpaceChanged = 0;
+/*N*/ for( i = 0; i < nMaxLevel; i++ )
+/*N*/ {
+/*N*/ const SwNumFmt* pFmt = rRule.GetNumFmt( i );
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ BOOL bOutFmt = TRUE;
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( ppTxtColls && ppTxtColls[i] != 0 )
+/*N*/ {
+/*N*/ // Im 5.0-Format wird der linke Abstand der Vorlage auf
+/*N*/ // den Wert der NumRule addiert und der Original-Wert
+/*N*/ // getrennt gespeichert.
+/*N*/ ASSERT( !IsSw31Or40Export(), "Doch 3.1/4.0-Export?" );
+/*N*/ ASSERT( !rRule.IsAbsSpaces(), "Doch absolute Abstaende?" );
+/*N*/ ASSERT( bOutline, "Doch keine Kapitel-Numerierung?" );
+/*N*/ const SvxLRSpaceItem& rLRSpace = ppTxtColls[i]->GetLRSpace();
+/*N*/ if( rLRSpace.GetTxtLeft() > 0 )
+/*N*/ {
+/*N*/ SwNumFmt aFmt( *pFmt );
+/*N*/ aFmt.SetAbsLSpace( (USHORT)(aFmt.GetAbsLSpace() +
+/*N*/ rLRSpace.GetTxtLeft()) );
+/*N*/ USHORT nTmp = bFirst ? aFmt.GetAbsLSpace() : nPrvAbsLSpace;
+/*N*/ OutNumFmt( aFmt, nTmp );
+/*N*/ nPrvAbsLSpace = aFmt.GetAbsLSpace();
+/*N*/
+/*N*/ bOutFmt = FALSE;
+/*N*/ nAbsLSpaceChanged++;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ppTxtColls[i] = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( bOutline && IsSw31Or40Export() &&
+/*N*/ (pFmt->GetAbsLSpace() > 0U ||
+/*N*/ pFmt->GetFirstLineOffset() != 0) )
+/*N*/ {
+/*N*/ // Im 3.1- oder 4.0-Format gab es noch keinen linken Abstand
+/*N*/ // und keinen Erstzeilen-Einzug. Er wird ggf. bei den Vorlagen
+/*N*/ // exportiert.
+/*N*/ SwNumFmt aFmt( *pFmt );
+/*N*/ aFmt.SetAbsLSpace( 0U );
+/*N*/ aFmt.SetFirstLineOffset( 0 );
+/*N*/ USHORT nTmp = bFirst ? aFmt.GetAbsLSpace() : nPrvAbsLSpace;
+/*N*/ OutNumFmt( aFmt, nTmp );
+/*N*/ nPrvAbsLSpace = aFmt.GetAbsLSpace();
+/*N*/
+/*N*/ bOutFmt = FALSE;
+/*N*/ }
+/*N*/ #endif
+/*N*/ if( bOutFmt )
+/*N*/ {
+/*N*/ USHORT nTmp = bFirst ? pFmt->GetAbsLSpace() : nPrvAbsLSpace;
+/*N*/ OutNumFmt( *pFmt, nTmp );
+/*N*/ nPrvAbsLSpace = pFmt->GetAbsLSpace();
+/*N*/ }
+/*N*/ bFirst = FALSE;
+/*N*/ }
+/*N*/ else if( ppTxtColls )
+/*N*/ ppTxtColls[i] = 0;
+/*N*/ }
+/*N*/ CloseRec( cType );
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( ppTxtColls && nAbsLSpaceChanged > 0 )
+/*N*/ {
+/*N*/ ASSERT( !IsSw31Or40Export(), "Doch 3.1/4.0-Export?" );
+/*N*/ ASSERT( !rRule.IsAbsSpaces(), "Doch absolute Abstaende?" );
+/*N*/
+/*N*/ OpenRec( SWG_OUTLINEEXT );
+/*N*/ *pStrm << (BYTE)0x01
+/*N*/ << (BYTE)nAbsLSpaceChanged;
+/*N*/
+/*N*/ for( BYTE j=0; j < MAXLEVEL; j++ )
+/*N*/ {
+/*N*/ if( ppTxtColls[j] )
+/*N*/ *pStrm << (BYTE)j << (UINT16)rRule.Get(j).GetAbsLSpace();
+/*N*/ }
+/*N*/ CloseRec( SWG_OUTLINEEXT );
+/*N*/ }
+/*N*/
+/*N*/ delete[] ppTxtColls;
+/*N*/ #endif
+/*N*/ }
+
+// Numerierungs-Regelwerk einlesen
+
+void lcl_sw3io__copyNumRule( const SwNumRule& rSrc, SwNumRule& rDst )
+{
+ rDst.SetRuleType( rSrc.GetRuleType() );
+ rDst.SetPoolHelpId( rSrc.GetPoolHelpId() );
+ rDst.SetPoolHlpFileId( rSrc.GetPoolHlpFileId() );
+ rDst.SetContinusNum( rSrc.IsContinusNum() );
+
+ ASSERT( rDst.GetPoolFmtId() == rSrc.GetPoolFmtId(),
+ "NumRule-PoolIds sind unterschiedlich" );
+ ASSERT( rDst.IsAutoRule() == rSrc.IsAutoRule(),
+ "NumRule-Auto-Flags sind unterschiedlich" );
+ ASSERT( rDst.GetName() == rSrc.GetName(),
+ "NumRule-Namen sind unterschiedlich" );
+
+ rDst.SetInvalidRule( TRUE );
+}
+
+
+/*N*/ void Sw3IoImp::InNumRules()
+/*N*/ {
+/*N*/ InHeader( TRUE );
+/*N*/ if( !Good() )
+/*N*/ return;
+/*N*/
+/*N*/ InStringPool( SWG_STRINGPOOL, aStringPool );
+/*N*/
+/*N*/ SwNumRule* pRule;
+/*N*/ BOOL bDone = FALSE;
+/*N*/ while( !bDone )
+/*N*/ {
+/*N*/ BYTE cType = Peek();
+/*N*/ if( !Good() || pStrm->IsEof() )
+/*N*/ bDone = TRUE;
+/*N*/ else switch( cType )
+/*N*/ {
+/*N*/ case SWG_EOF:
+/*N*/ bDone = TRUE;
+/*N*/ break;
+/*N*/
+/*N*/ case SWG_NUMRULE:
+/*N*/ pRule = InNumRule( cType );
+/*N*/ if( pRule )
+/*N*/ {
+/*N*/ BOOL bInsertRule = FALSE;
+/*N*/ if( pRule->IsAutoRule() )
+/*N*/ {
+/*N*/ // Automatische Rules werden nur beim normalen
+/*N*/ // Laden und Laden von Seitenvorlagen eingelesen,
+/*N*/ // aber nicht, wenn nur Num-Vorl. gelesen werden.
+/*N*/ if( bNormal || bPageDescs )
+/*N*/ {
+/*N*/ bInsertRule = TRUE;
+/*N*/
+/*N*/ // Auto-NumRule ggf. umbenennen, wenn es sie
+/*N*/ // schon gibt und ausserdem den Namen merken,
+/*N*/ // damit unbenutzte Rules entfernt werden
+/*N*/ // koennen.
+/*N*/ String aOldName( pRule->GetName() );
+/*N*/ // Nur wenn Vorlagen geladen werden (!bNormal)
+/*N*/ // oder im Einfuege-Modus (bInsert) kann es die
+/*N*/ // NumRule schon geben.
+/*N*/ if( !bNormal || bInsert )
+/*N*/ {
+/*N*/ pRule->SetName(
+/*?*/ pDoc->GetUniqueNumRuleName( &aOldName ) );
+/*N*/ }
+/*N*/ aNumRuleInfos.Insert(
+/*N*/ new Sw3NumRuleInfo( aOldName, pRule->GetName() ) );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Nicht-automatische Vorlagen werden nur eingefuegt,
+/*N*/ // wenn normale Dokumente oder Num-Vorl. geladen
+/*N*/ // werden, nicht aber, wenn nur Seiten-Vorlagen
+/*N*/ // geladen werden.
+/*N*/ // Beim Einfuegen oder Num-Vorlagen-Laden ohne
+/*N*/ // ueberschreiben die NumRule nur einfuegen, wenn
+/*N*/ // es sie noch nicht gibt. (bAdditive ist TRUE
+/*N*/ // wenn eingefuegt wird) und sonst nur invalidieren.
+/*N*/ if( ( bNormal || bNumRules ) )
+/*N*/ {
+/*N*/ if( bAdditive )
+/*N*/ {
+/*?*/ SwNumRule *pDocRule =
+/*?*/ pDoc->FindNumRulePtr( pRule->GetName() );
+/*?*/ if( pDocRule )
+/*?*/ pDocRule->SetInvalidRule( TRUE );
+/*?*/ else
+/*?*/ bInsertRule = TRUE;
+/*N*/ }
+/*N*/ else if( bNumRules )
+/*N*/ {
+/*?*/ SwNumRule *pDocRule =
+/*?*/ pDoc->FindNumRulePtr( pRule->GetName() );
+/*?*/ if( pDocRule )
+/*?*/ {
+ pDoc->ChgNumRuleFmts( *pRule );
+/*?*/ lcl_sw3io__copyNumRule( *pRule, *pDocRule );
+/*?*/ }
+/*?*/ else
+/*?*/ bInsertRule = TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bInsertRule = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bInsertRule )
+/*N*/ {
+/*N*/ ASSERT( !pDoc->FindNumRulePtr( pRule->GetName() ),
+/*N*/ "NumRule existiert bereits" );
+/*N*/ pDoc->MakeNumRule( pRule->GetName(), pRule );
+/*N*/ }
+/*N*/ delete pRule;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case SWG_OUTLINE:
+/*N*/ if( bNormal && !bInsert )
+/*N*/ {
+/*N*/ pRule = InNumRule( cType );
+/*N*/ if( pRule )
+/*N*/ {
+/*N*/ #if 0
+/*N*/ if( nVersion < SWG_DELETEOLE )
+/*N*/ {
+/*N*/ //JP 18.01.96: Alle Ueberschriften sind normalerweise
+/*N*/ // ohne Kapitelnummer. Darum hier explizit abschalten
+/*N*/ // weil das Default jetzt wieder auf AN ist.
+/*N*/ // und UeberschirftBasis ohne Einrueckung!
+/*N*/ SwTxtFmtColl* pCol = pDoc->GetTxtCollFromPool(
+/*N*/ RES_POOLCOLL_HEADLINE_BASE );
+/*N*/ pCol->ResetAttr( RES_LR_SPACE );
+/*N*/
+/*N*/ for( short i = 0; i < MAXLEVEL; i++ )
+/*N*/ {
+/*N*/ if( !pRule->GetNumFmt( i ) )
+/*N*/ {
+/*N*/ SwNumFmt aFmt( pRule->Get( i ) );
+/*N*/ aFmt.eType = NUMBER_NONE;
+/*N*/ pRule->Set( i, aFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ pDoc->SetOutlineNumRule( *pRule );
+/*N*/ }
+/*N*/ delete pRule;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ SkipRec();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ case SWG_OUTLINEEXT:
+/*N*/ if( bNormal && !bInsert )
+/*N*/ InOutlineExt();
+/*N*/ else
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ #endif
+/*N*/ #ifdef TEST_HUGE_DOCS
+/*N*/ case SWG_TESTHUGEDOCS:
+/*N*/ InHugeRecord();
+/*N*/ #endif
+/*N*/
+/*N*/ default:
+/*?*/ SkipRec();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+// Numerierungs-Regelwerk ausgeben
+
+/*N*/ void Sw3IoImp::OutNumRules( BOOL bUsed )
+/*N*/ {
+/*N*/ OutHeader();
+/*N*/
+/*N*/ // Stringpool (nur mit den wirklioch benoetigten) Namen fuellen.
+/*N*/ aStringPool.SetupForNumRules( *pDoc, pStrm->GetVersion() );
+/*N*/ OutStringPool( SWG_STRINGPOOL, aStringPool );
+/*N*/
+/*N*/ // Die Outline-Numerierung schreiben
+/*N*/ if( pDoc->GetOutlineNumRule() )
+/*N*/ OutNumRule( SWG_OUTLINE, *pDoc->GetOutlineNumRule() );
+/*N*/
+/*N*/ // Und alle Numerierungen schreiben
+/*N*/ USHORT nArrLen = pDoc->GetNumRuleTbl().Count();
+/*N*/ for( USHORT n=0; n<nArrLen; n++ )
+/*N*/ {
+/*N*/ const SwNumRule *pNumRule = pDoc->GetNumRuleTbl()[n];
+/*N*/ if( !bUsed || pDoc->IsUsed( *pNumRule ) )
+/*N*/ OutNumRule( SWG_NUMRULE, *pNumRule );
+/*N*/ }
+/*N*/
+/*N*/ #ifdef TEST_HUGE_DOCS
+/*N*/ BOOL b = FALSE;
+/*N*/ if( b )
+/*N*/ OutHugeRecord( 1024, 32*1024 );
+/*N*/ #endif
+/*N*/ }
+
+// Absatz-Numerierung einlesen (seit 5.0)
+
+/*N*/ void Sw3IoImp::InNodeNum( SwNodeNum& rNodeNum )
+/*N*/ {
+/*N*/ OpenRec( SWG_NODENUM );
+/*N*/
+/*N*/ BYTE nLevel;
+/*N*/ UINT16 nSetValue;
+/*N*/
+/*N*/ // 0x10: Start-Flag ist gesetzt.
+/*N*/ // 0x20: Start-Wert ist vorhanden.
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/
+/*N*/ *pStrm >> nLevel;
+/*N*/ if( (cFlags & 0x20) != 0 )
+/*N*/ *pStrm >> nSetValue;
+/*N*/
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ BYTE nRealLevel = 0;
+/*N*/ if( nLevel != NO_NUMBERING )
+/*N*/ {
+/*N*/ nRealLevel = GetRealLevel(nLevel);
+/*N*/ if( nRealLevel >= MAXLEVEL )
+/*N*/ {
+/*?*/ BYTE cTmp = MAXLEVEL-1;
+/*?*/ if( nLevel & NO_NUMLEVEL )
+/*?*/ cTmp |= NO_NUMLEVEL;
+/*?*/ nLevel = cTmp;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ rNodeNum.SetLevel( nLevel );
+/*N*/ rNodeNum.SetStart( (cFlags & 0x10)!=0 );
+/*N*/ if( (cFlags & 0x20) != 0 )
+/*N*/ rNodeNum.SetSetValue( nSetValue );
+/*N*/
+/*N*/ if( nLevel != NO_NUMBERING )
+/*N*/ {
+/*N*/ USHORT *pLevelVal = rNodeNum.GetLevelVal();
+/*N*/ UINT16 nVal;
+/*N*/ for( BYTE i=0; i<=nRealLevel; i++ )
+/*N*/ {
+/*N*/ *pStrm >> nVal;
+/*N*/ if( i < MAXLEVEL )
+/*N*/ pLevelVal[i] = nVal;
+/*N*/ else
+/*?*/ Warning();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_NODENUM );
+/*N*/ }
+
+// Absatz-Numerierung ausgeben (seit 5.0)
+
+/*N*/ void Sw3IoImp::OutNodeNum( const SwNodeNum& rNodeNum )
+/*N*/ {
+/*N*/ OpenRec( SWG_NODENUM );
+/*N*/
+/*N*/ BYTE nLevel = rNodeNum.GetLevel();
+/*N*/
+/*N*/ // 0x10: Start-Flag ist gesetzt.
+/*N*/ // 0x20: Start-Wert ist vorhanden.
+/*N*/ BYTE cFlags = rNodeNum.IsStart() ? 0x11 : 0x01;
+/*N*/ if( rNodeNum.GetSetValue() != USHRT_MAX )
+/*N*/ cFlags += 0x22;
+/*N*/
+/*N*/ *pStrm << (BYTE) cFlags
+/*N*/ << (BYTE) nLevel;
+/*N*/ if( (cFlags & 0x20) != 0 )
+/*N*/ *pStrm << (UINT16)rNodeNum.GetSetValue();
+/*N*/
+/*N*/ if( nLevel != NO_NUMBERING )
+/*N*/ {
+/*N*/ BYTE nRealLevel = GetRealLevel( nLevel );
+/*N*/ const USHORT *pLevelVal = rNodeNum.GetLevelVal();
+/*N*/ for( BYTE i=0; i<=nRealLevel; i++ )
+/*N*/ {
+/*N*/ *pStrm << (UINT16)pLevelVal[i];
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_NODENUM );
+/*N*/ }
+
+
+// globale Fussnoten-Info einlesen
+
+/*N*/ void Sw3IoImp::InEndNoteInfo( SwEndNoteInfo &rENInf )
+/*N*/ {
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ BYTE eType;
+/*N*/ UINT16 nPageIdx, nCollIdx, nFtnOffset = 0,
+/*N*/ nChrIdx = IDX_NO_VALUE, nAnchorChrIdx = IDX_NO_VALUE;
+/*N*/ String sPrefix, sSuffix;
+/*N*/ *pStrm >> eType >> nPageIdx >> nCollIdx >> nFtnOffset;
+/*N*/ if( IsVersion(SWG_HTMLCOLLCHG) )
+/*N*/ *pStrm >> nChrIdx;
+/*N*/ if( IsVersion( SWG_FTNANCHORFMT ) && ( 0x10 & cFlags ))
+/*N*/ *pStrm >> nAnchorChrIdx;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ if( IsVersion(SWG_HTMLCOLLCHG) )
+/*N*/ {
+/*N*/ InString( *pStrm, sPrefix );
+/*N*/ InString( *pStrm, sSuffix );
+/*N*/ }
+/*N*/
+/*N*/ if( nCollIdx != IDX_NO_VALUE )
+/*N*/ {
+/*?*/ SwTxtFmtColl* pColl = FindTxtColl( nCollIdx );
+/*?*/ if( pColl )
+/*?*/ rENInf.SetFtnTxtColl( *pColl );
+/*N*/ }
+/*N*/ // PageDesc suchen
+/*N*/ if( nPageIdx < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ SwPageDesc *pPageDesc = FindPageDesc( nPageIdx );
+/*N*/ if( pPageDesc )
+/*N*/ rENInf.ChgPageDesc( pPageDesc );
+/*N*/ }
+/*N*/ if( nChrIdx != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ SwCharFmt *pChrFmt = (SwCharFmt *)FindFmt( nChrIdx, SWG_CHARFMT );
+/*N*/ if( pChrFmt )
+/*N*/ rENInf.SetCharFmt( pChrFmt );
+/*N*/ }
+/*N*/ if( nAnchorChrIdx != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ SwCharFmt *pChrFmt = (SwCharFmt *)FindFmt( nAnchorChrIdx, SWG_CHARFMT );
+/*N*/ if( pChrFmt )
+/*N*/ rENInf.SetAnchorCharFmt( pChrFmt );
+/*N*/ }
+/*N*/ rENInf.aFmt.SetNumberingType(eType);
+/*N*/ rENInf.nFtnOffset = nFtnOffset;
+/*N*/ rENInf.SetPrefix( sPrefix );
+/*N*/ rENInf.SetSuffix( sSuffix );
+/*N*/ }
+
+
+// globale Fussnoten-Info ausgeben
+
+/*N*/ void Sw3IoImp::OutEndNoteInfo( const SwEndNoteInfo &rENInf )
+/*N*/ {
+/*N*/ SwTxtFmtColl* pColl = rENInf.GetFtnTxtColl();
+/*N*/ USHORT nCollIdx = pColl ? aStringPool.Add( pColl->GetName(),
+/*N*/ pColl->GetPoolFmtId() )
+/*N*/ : IDX_NO_VALUE;
+/*N*/
+/*N*/ const SwPageDesc *pDesc = (const SwPageDesc *)rENInf.GetPageDescDep()
+/*N*/ ->GetRegisteredIn();
+/*N*/ USHORT nPageIdx = pDesc ? aStringPool.Find( pDesc->GetName(),
+/*N*/ pDesc->GetPoolFmtId() )
+/*N*/ : IDX_NO_VALUE;
+/*N*/
+/*N*/ const SwCharFmt *pCharFmt = (const SwCharFmt *)rENInf.GetCharFmtDep()
+/*N*/ ->GetRegisteredIn();
+/*N*/ USHORT nChrIdx = pCharFmt ? aStringPool.Find( pCharFmt->GetName(),
+/*N*/ pCharFmt->GetPoolFmtId() )
+/*N*/ : IDX_NO_VALUE;
+/*N*/
+/*N*/ BYTE nFlags = 0x09; // 9 bytes of data
+/*N*/ pCharFmt = (const SwCharFmt *)rENInf.GetAnchorCharFmtDep()->GetRegisteredIn();
+/*N*/ USHORT nAnchorChrIdx = pCharFmt ? aStringPool.Find( pCharFmt->GetName(),
+/*N*/ pCharFmt->GetPoolFmtId() )
+/*N*/ : IDX_NO_VALUE;
+/*N*/ if( IDX_NO_VALUE != nAnchorChrIdx && nAnchorChrIdx !=
+/*N*/ ( rENInf.IsEndNoteInfo() ? RES_POOLCHR_FOOTNOTE_ANCHOR
+/*N*/ : RES_POOLCHR_ENDNOTE_ANCHOR ))
+/*N*/ nFlags += 0x12;
+/*N*/
+/*N*/ *pStrm << nFlags
+/*N*/ << (BYTE) rENInf.aFmt.GetNumberingType()
+/*N*/ << (UINT16) nPageIdx
+/*N*/ << (UINT16) nCollIdx
+/*N*/ << (UINT16) rENInf.nFtnOffset
+/*N*/ << (UINT16) nChrIdx;
+/*N*/
+/*N*/ if( 0x10 & nFlags )
+/*N*/ *pStrm << (UINT16) nAnchorChrIdx;
+/*N*/
+/*N*/ OutString( *pStrm, rENInf.GetPrefix() );
+/*N*/ OutString( *pStrm, rENInf.GetSuffix() );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InEndNoteInfo()
+/*N*/ {
+/*N*/ OpenRec( SWG_ENDNOTEINFO );
+/*N*/ SwEndNoteInfo aENInf( pDoc->GetEndNoteInfo() );
+/*N*/ InEndNoteInfo( aENInf );
+/*N*/ pDoc->SetEndNoteInfo( aENInf );
+/*N*/ CloseRec( SWG_ENDNOTEINFO );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ void Sw3IoImp::OutEndNoteInfo()
+/*N*/ {
+/*N*/ OpenRec( SWG_ENDNOTEINFO );
+/*N*/ OutEndNoteInfo( pDoc->GetEndNoteInfo() );
+/*N*/ CloseRec( SWG_ENDNOTEINFO );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InFtnInfo()
+/*N*/ {
+/*N*/ if( !IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ InFtnInfo40();
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_FOOTINFO );
+/*N*/ SwFtnInfo aFtn( pDoc->GetFtnInfo() );
+/*N*/ InEndNoteInfo( aFtn );
+/*N*/
+/*N*/ OpenFlagRec();
+/*N*/ BYTE ePos, eNum;
+/*N*/ *pStrm >> ePos
+/*N*/ >> eNum;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ InString( *pStrm, aFtn.aQuoVadis );
+/*N*/ InString( *pStrm, aFtn.aErgoSum );
+/*N*/
+/*N*/ aFtn.ePos = (SwFtnPos) ePos;
+/*N*/ aFtn.eNum = (SwFtnNum) eNum;
+/*N*/
+/*N*/ //#91003# don't allow counting of footnotes by chapter and end-of-document position
+/*N*/ if(FTNPOS_CHAPTER == aFtn.ePos && FTNNUM_CHAPTER == aFtn.eNum)
+/*N*/ aFtn.eNum = FTNNUM_DOC;
+/*N*/ pDoc->SetFtnInfo( aFtn );
+/*N*/ CloseRec( SWG_FOOTINFO );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutFtnInfo()
+/*N*/ {
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ OutFtnInfo40();
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ const SwFtnInfo& rFtn = pDoc->GetFtnInfo();
+/*N*/
+/*N*/ OpenRec( SWG_FOOTINFO );
+/*N*/ OutEndNoteInfo( rFtn );
+/*N*/ *pStrm << (BYTE)0x02
+/*N*/ << (BYTE) rFtn.ePos
+/*N*/ << (BYTE) rFtn.eNum;
+/*N*/ OutString( *pStrm, rFtn.aQuoVadis );
+/*N*/ OutString( *pStrm, rFtn.aErgoSum );
+/*N*/ CloseRec( SWG_FOOTINFO );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InFtnInfo40()
+/*N*/ {
+/*N*/ OpenRec( SWG_FOOTINFO );
+/*N*/ SwFtnInfo aFtn( pDoc->GetFtnInfo() );
+/*N*/ InString( *pStrm, aFtn.aQuoVadis );
+/*N*/ InString( *pStrm, aFtn.aErgoSum );
+/*N*/ OpenFlagRec();
+/*N*/ BYTE ePos, eNum, eType;
+/*N*/ UINT16 nPageIdx, nCollIdx, nFtnOffset = 0;
+/*N*/ *pStrm >> ePos >> eNum >> eType >> nPageIdx >> nCollIdx;
+/*N*/ if( nVersion>SWG_DELETEOLE )
+/*N*/ *pStrm >> nFtnOffset;
+/*N*/ CloseFlagRec();
+/*N*/ if( nCollIdx != IDX_NO_VALUE )
+/*N*/ {
+/*?*/ SwTxtFmtColl* pColl = FindTxtColl( nCollIdx );
+/*?*/ if( pColl )
+/*?*/ aFtn.SetFtnTxtColl( *pColl );
+/*N*/ }
+/*N*/ // PageDesc suchen
+/*N*/ if( nPageIdx < IDX_SPEC_VALUE )
+/*N*/ {
+/*N*/ SwPageDesc *pPageDesc = FindPageDesc( nPageIdx );
+/*N*/ if( pPageDesc )
+/*N*/ aFtn.ChgPageDesc( pPageDesc );
+/*N*/ }
+/*N*/ aFtn.ePos = (SwFtnPos) ePos;
+/*N*/ aFtn.eNum = (SwFtnNum) eNum;
+/*N*/ aFtn.aFmt.SetNumberingType(eType);
+/*N*/ aFtn.nFtnOffset = nFtnOffset;
+/*N*/ pDoc->SetFtnInfo( aFtn );
+/*N*/ CloseRec( SWG_FOOTINFO );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutFtnInfo40()
+/*N*/ {
+/*N*/ const SwFtnInfo& rFtn = pDoc->GetFtnInfo();
+/*N*/ SwTxtFmtColl* pColl = rFtn.GetFtnTxtColl();
+/*N*/ USHORT nCollIdx = pColl ? aStringPool.Add( pColl->GetName(),
+/*N*/ pColl->GetPoolFmtId() )
+/*N*/ : IDX_NO_VALUE;
+/*N*/ const SwPageDesc *pDesc = (const SwPageDesc *)rFtn.GetPageDescDep()
+/*N*/ ->GetRegisteredIn();
+/*N*/ USHORT nPageIdx = pDesc ? aStringPool.Find( pDesc->GetName(),
+/*N*/ pDesc->GetPoolFmtId() )
+/*N*/ : IDX_NO_VALUE;
+/*N*/ OpenRec( SWG_FOOTINFO );
+/*N*/ OutString( *pStrm, rFtn.aQuoVadis );
+/*N*/ OutString( *pStrm, rFtn.aErgoSum );
+/*N*/ *pStrm << (BYTE) 0x09 // 9 bytes of data
+/*N*/ << (BYTE) rFtn.ePos
+/*N*/ << (BYTE) rFtn.eNum
+/*N*/ << (BYTE) rFtn.aFmt.GetNumberingType()
+/*N*/ << (UINT16) nPageIdx
+/*N*/ << (UINT16) nCollIdx
+/*N*/ << (UINT16) rFtn.nFtnOffset;
+/*N*/ CloseRec( SWG_FOOTINFO );
+/*N*/ }
+
+// Oeffnen eines Numerierungsregel-Bereichs
+
+
+/*N*/ void Sw3IoImp::OpenNumRange40( const SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ CloseNumRange40( rPos );
+/*N*/ pCurNumRange = new SwPaM( rPos );
+/*N*/ pCurNumRange->SetMark();
+/*N*/ pCurNumRule = InNumRule( SWG_NUMRULE );
+/*N*/ }
+
+// Schliessen eines Numerierungsregel-Bereichs
+// Der Index zeigt auf den Node HINTER dem letzten zu numerierenden Node!
+
+
+/*N*/ void Sw3IoImp::CloseNumRange40( const SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ if( pCurNumRange )
+/*N*/ {
+/*N*/ SwNodeIndex& rNodePos = pCurNumRange->GetPoint()->nNode;
+/*N*/ rNodePos = rPos.GetIndex() - 1;
+/*N*/ SwCntntNode* pCntNd =
+/*N*/ pDoc->GetNodes()[ rNodePos ]->GetCntntNode();
+/*N*/ if( !pCntNd )
+/*?*/ pCntNd = pDoc->GetNodes().GoPrevious( &rNodePos );
+/*N*/ pCurNumRange->GetPoint()->nContent.Assign( pCntNd, 0 );
+/*N*/ pCurNumRange->GetMark()->nContent.Assign
+/*N*/ ( pCurNumRange->GetMark()->nNode.GetNode().GetCntntNode(), 0 );
+/*N*/ pDoc->SetNumRule( *pCurNumRange, *pCurNumRule );
+/*N*/
+/*N*/ // Es wurde ein NO_NUM in der aktuellen Numerierung eingelesen.
+/*N*/ // Das muss jetzt noch in ein NO_NUMLEVEL umgewandelt werden.
+/*N*/ BYTE nPrevLevel = 0;
+/*N*/ for( ULONG n = pCurNumRange->GetMark()->nNode.GetIndex(),
+/*N*/ nEnd = rPos.GetIndex(); n < nEnd; ++n )
+/*N*/ {
+/*N*/ SwTxtNode* pTxtNd = pDoc->GetNodes()[n]->GetTxtNode();
+/*N*/ if( pTxtNd && pTxtNd->GetNum() )
+/*N*/ {
+/*N*/ SwNodeNum* pNum = (SwNodeNum*)pTxtNd->GetNum();
+/*N*/ if( bConvertNoNum )
+/*N*/ {
+/*?*/ if( NO_NUM == pNum->GetLevel() )
+/*?*/ pNum->SetLevel( nPrevLevel | NO_NUMLEVEL );
+/*?*/ else
+/*?*/ nPrevLevel = GetRealLevel( pNum->GetLevel() );
+/*N*/ }
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ lcl_sw3io__ConvertNumLRSpace( *pTxtNd, *pCurNumRule,
+/*N*/ pNum->GetLevel(), TRUE );
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ delete pCurNumRange, pCurNumRange = 0;
+/*N*/ delete pCurNumRule, pCurNumRule = 0;
+/*N*/ bConvertNoNum = FALSE;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_sw3io__ConvertNumTabStop( SvxTabStopItem& rTStop, long nOffset )
+/*N*/ {
+/*N*/ for( USHORT n = 0; n < rTStop.Count(); ++n )
+/*N*/ {
+/*N*/ SvxTabStop& rTab = (SvxTabStop&)rTStop[ n ];
+/*N*/ if( SVX_TAB_ADJUST_DEFAULT != rTab.GetAdjustment() &&
+/*N*/ rTab.GetTabPos() )
+/*N*/ {
+/*?*/ rTab.GetTabPos() += nOffset;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_sw3io__ConvertNumTabStop( SwTxtNode& rTxtNd, long nOffset,
+/*N*/ BOOL bDeep )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == rTxtNd.GetSwAttrSet().GetItemState( RES_PARATR_TABSTOP,
+/*N*/ bDeep, &pItem ) )
+/*N*/ {
+/*N*/ SvxTabStopItem aTStop( *(SvxTabStopItem*)pItem );
+/*N*/ lcl_sw3io__ConvertNumTabStop( aTStop, nOffset );
+/*N*/ rTxtNd.SwCntntNode::SetAttr( aTStop );
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_sw3io__ConvertNumLRSpace( SwTxtNode& rTxtNd, const SwNumRule& rNumRule,
+/*N*/ BYTE nLevel, BOOL bTabStop )
+/*N*/ {
+/*N*/ if( nLevel == NO_NUMBERING )
+/*N*/ return;
+/*N*/
+/*N*/ nLevel = GetRealLevel( nLevel );
+/*N*/ USHORT nNumLSpace = rNumRule.Get( nLevel ).GetAbsLSpace();
+/*N*/
+/*N*/ // Wenn im Absatz der Einzug eingestellt ist, dann will
+/*N*/ // man den wieder Erreichen, sonst den der NumRule.
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ const SvxLRSpaceItem *pParaLRSpace = 0;
+/*N*/ const SwAttrSet *pAttrSet = rTxtNd.GetpSwAttrSet();
+/*N*/ if( pAttrSet &&
+/*N*/ SFX_ITEM_SET == pAttrSet->GetItemState( RES_LR_SPACE, FALSE, &pItem ) )
+/*N*/ pParaLRSpace = (const SvxLRSpaceItem *)pItem;
+/*N*/ USHORT nWishLSpace = pParaLRSpace ? pParaLRSpace->GetTxtLeft() : nNumLSpace;
+/*N*/
+/*N*/ // Dazu muss man den folgenden Wert im Absatz einstellen
+/*N*/ const SvxLRSpaceItem& rCollLRSpace = rTxtNd.GetAnyFmtColl().GetLRSpace();
+/*N*/ USHORT nOldLSpace = pParaLRSpace ? pParaLRSpace->GetTxtLeft()
+/*N*/ : rCollLRSpace.GetTxtLeft();
+/*N*/ USHORT nNewLSpace;
+/*N*/ if( rNumRule.IsAbsSpaces() )
+/*?*/ nNewLSpace = rCollLRSpace.GetTxtLeft();
+/*N*/ else
+/*N*/ nNewLSpace = nWishLSpace > nNumLSpace ? nWishLSpace - nNumLSpace : 0U;
+/*N*/
+/*N*/ // Wenn der neue Wert zufaellig der der Vorlage ist und der
+/*N*/ // rechte Einzug auch mit dem der Vorlage ueberseinstimmt,
+/*N*/ // dann braucht bzw. darf man das Absatz-Attribut nicht
+/*N*/ // setzen, sonst muss man es setzen.
+/*N*/ if( nNewLSpace == rCollLRSpace.GetTxtLeft() &&
+/*N*/ (!pParaLRSpace || pParaLRSpace->GetRight() == rCollLRSpace.GetRight()) )
+/*N*/ {
+/*N*/ if( pParaLRSpace )
+/*N*/ rTxtNd.ResetAttr( RES_LR_SPACE );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pParaLRSpace )
+/*N*/ pParaLRSpace = &rCollLRSpace;
+/*N*/ SvxLRSpaceItem aLRSpace( *pParaLRSpace );
+/*N*/ short nFirst = aLRSpace.GetTxtFirstLineOfst();
+/*N*/ if( nFirst < 0 && (USHORT)-nFirst > nNewLSpace )
+/*N*/ aLRSpace.SetTxtFirstLineOfst( -(short)nNewLSpace );
+/*N*/ aLRSpace.SetTxtLeft( nNewLSpace );
+/*N*/ ((SwCntntNode&)rTxtNd).SetAttr( aLRSpace );
+/*N*/ }
+/*N*/
+/*N*/ if( bTabStop && nOldLSpace != nNewLSpace )
+/*N*/ lcl_sw3io__ConvertNumTabStop( rTxtNd,
+/*N*/ (long)nOldLSpace - (long)nNewLSpace,
+/*N*/ TRUE );
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3page.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3page.cxx
new file mode 100644
index 000000000000..344d5e037145
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3page.cxx
@@ -0,0 +1,600 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "swerror.h"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <tools/tenccvt.hxx>
+
+#include <errhdl.hxx>
+
+#include <fmtcol.hxx>
+
+#include <fmthdft.hxx>
+#include <fmtpdsc.hxx>
+#include <hints.hxx>
+#include "sw3imp.hxx"
+#include "pagedesc.hxx"
+#include "poolfmt.hxx"
+namespace binfilter {
+
+
+////////////////////////////////////////////////////////////////////////////
+
+// Fussnoten-Info einlesen
+
+/*N*/ void Sw3IoImp::InPageFtnInfo( SwPageFtnInfo& rFtn )
+/*N*/ {
+/*N*/ INT32 nHeight, nTopDist, nBottomDist, nNum, nDenom;
+/*N*/ INT16 nAdjust, nPenWidth;
+/*N*/ Color aPenColor;
+/*N*/ BYTE cType = Peek();
+/*N*/ if( cType == SWG_FOOTINFO || cType == SWG_PAGEFOOTINFO )
+/*N*/ {
+/*N*/ OpenRec( cType );
+/*N*/ *pStrm >> nHeight
+/*N*/ >> nTopDist
+/*N*/ >> nBottomDist
+/*N*/ >> nAdjust
+/*N*/ >> nNum >> nDenom
+/*N*/ >> nPenWidth
+/*N*/ >> aPenColor;
+/*N*/ CloseRec( cType );
+/*N*/ rFtn.SetHeight( (SwTwips) nHeight );
+/*N*/ rFtn.SetTopDist( (SwTwips) nTopDist );
+/*N*/ rFtn.SetBottomDist( (SwTwips) nBottomDist );
+/*N*/ rFtn.SetAdj( (SwFtnAdj) nAdjust );
+/*N*/ Fraction f( nNum, nDenom );
+/*N*/ rFtn.SetWidth( f );
+/*N*/ rFtn.SetLineColor( aPenColor );
+/*N*/ rFtn.SetLineWidth( nPenWidth );
+/*N*/ }
+/*N*/ else
+/*N*/ Error();
+/*N*/ }
+
+// Fussnoten-Info ausgeben
+
+/*N*/ void Sw3IoImp::OutPageFtnInfo( const SwPageFtnInfo& rFtn )
+/*N*/ {
+/*N*/ OpenRec( SWG_PAGEFOOTINFO );
+/*N*/ *pStrm << (INT32) rFtn.GetHeight()
+/*N*/ << (INT32) rFtn.GetTopDist()
+/*N*/ << (INT32) rFtn.GetBottomDist()
+/*N*/ << (INT16) rFtn.GetAdj()
+/*N*/ << (INT32) rFtn.GetWidth().GetNumerator()
+/*N*/ << (INT32) rFtn.GetWidth().GetDenominator()
+/*N*/ << (INT16) rFtn.GetLineWidth()
+/*N*/ << rFtn.GetLineColor();
+/*N*/ CloseRec( SWG_PAGEFOOTINFO );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::InPageDescs()
+/*N*/ {
+/*N*/ if( Peek() != SWG_STRINGPOOL )
+/*N*/ {
+/*N*/ InHeader( TRUE );
+/*N*/ if( !Good() )
+/*N*/ return;
+/*N*/ }
+/*N*/ else
+/*N*/ nVersion = SWG_FRSTVERSION;
+/*N*/ // Der Stream koennte auch leer sein, falls eine leere Textbaustein-
+/*N*/ // datei eingelesen wird.
+/*N*/ if( Peek() == SWG_STRINGPOOL )
+/*N*/ {
+/*N*/ InStringPool( SWG_STRINGPOOL, aStringPool );
+/*N*/
+/*N*/ while( SWG_FIELDTYPE == Peek() )
+/*N*/ InFieldType();
+/*N*/
+/*N*/ if( SWG_BOOKMARKS == Peek() )
+/*N*/ InBookmarks();
+/*N*/
+/*N*/ if( SWG_REDLINES == Peek() )
+ InRedlines(); //SW50.SDW
+/*N*/
+/*N*/ // ggfs. dem Numberformatter lesen
+/*N*/ if( SWG_NUMBERFORMATTER == Peek() )
+/*N*/ InNumberFormatter();
+/*N*/
+/*N*/ OpenRec( SWG_PAGEDESCS );
+/*N*/ OpenFlagRec();
+/*N*/ USHORT nDesc;
+/*N*/ *pStrm >> nDesc;
+/*N*/ CloseFlagRec();
+/*N*/ if( nDesc > 0 )
+/*N*/ {
+/*N*/ USHORT* pFollows = new USHORT[ nDesc ];
+/*N*/ SwPageDesc** pDescs = new SwPageDesc*[ nDesc ];
+ USHORT i=0;
+/*N*/ for( i = 0; i < nDesc; i++ )
+/*N*/ pDescs[ i ] = InPageDesc( pFollows[ i ] );
+/*N*/ // Follows aufloesen
+/*N*/ for( i = 0; i < nDesc; i++ )
+/*N*/ {
+/*N*/ USHORT nFollow = pFollows[ i ];
+/*N*/ SwPageDesc* pDesc = pDescs[ i ];
+/*N*/ if( pDesc && nFollow < IDX_SPEC_VALUE )
+/*N*/ pDesc->SetFollow( FindPageDesc( nFollow ) );
+/*N*/ }
+/*N*/ delete []pDescs;
+/*N*/ delete []pFollows;
+/*N*/ }
+/*N*/ else if( nDesc )
+/*N*/ Error();
+/*N*/
+/*N*/ #ifdef TEST_HUGE_DOCS
+/*N*/ if( SWG_TESTHUGEDOCS == Peek() )
+/*N*/ InHugeRecord();
+/*N*/ #endif
+/*N*/
+/*N*/ CloseRec( SWG_PAGEDESCS );
+/*N*/
+/*N*/ // Aufraeumen, wenn Seitenvorlagen geladen wurden
+/*N*/ if( bPageDescs )
+/*N*/ {
+/*?*/ SwDBData aOldData(pDoc->_GetDBDesc());
+/*?*/
+/*?*/ // fuer Versionen ohne mehrfache Datenbanken wird jetzt der
+/*?*/ // Datenbankname gelesen.
+/*?*/ // if( !nRes && nVersion < SWG_MULTIDB )
+/*?*/ if( !nRes &&
+/*?*/ !IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
+ SetDBName();
+/*?*/ Cleanup();
+/*?*/
+/*?*/ pDoc->ChgDBData( aOldData );
+/*N*/ }
+/*N*/ else if( bOrganizer )
+/*N*/ {
+/*N*/ //JP 18.08.98: Bug 55115 - PageDescAttribute mit ihren Vorlagen
+/*N*/ // verbinden
+/*?*/ ConnectPageDescAttrs();
+/*?*/ if( gsl_getSystemTextEncoding() != eSrcSet )
+/*?*/ ChangeFontItemCharSet();
+/*?*/
+/*?*/ // Temporaere Namenserweiterungen entfernen
+/*?*/ aStringPool.RemoveExtensions( *pDoc );
+/*?*/ ConvertFmtsToStarSymbol();
+/*N*/ }
+/*N*/ // TODO: unicode: is this required really?
+/*N*/ eSrcSet = GetSOLoadTextEncoding( gsl_getSystemTextEncoding(),
+/*N*/ pStrm->GetVersion() );
+/*N*/ }
+/*N*/ }
+
+void Sw3IoImp::SetDBName()
+{
+ SvStream* pOld = pStrm;
+ pContents->Seek( 0L );
+ pContents->SetBufferSize( SW3_BSR_CONTENTS );
+ pStrm = pContents;
+
+ // Erstmal den Header lesen
+ BYTE cLen, cSet;
+ INT8 nLCompatVer, nDummy8;
+ USHORT nLVersion, nLFileFlags;
+ INT32 nDummy32;
+ sal_Char cHdrSign[ 8 ];
+
+ Reset2();
+ OutputMode( FALSE );
+
+ if( pStrm->Read( cHdrSign, 7 ) != 7 || !CheckHeader(cHdrSign) )
+ {
+ Error( ERR_SW6_NOWRITER_FILE );
+ return;
+ }
+ *pStrm >> cLen;
+
+ // nRecSizesPos braucht hier nicht gelesen zu werden, da die Methode
+ // nicht fuer eine 5.0 ff aufgerufen wird.
+ ULONG nOld = pStrm->Tell();
+ *pStrm >> nLVersion >> nLFileFlags >> nDummy32 >> nDummy32 >> nDummy32
+ >> nDummy8 >> nDummy8 >> nDummy8 >> nLCompatVer;
+ if( nLCompatVer > SWG_CVERSION )
+ {
+ Error( ERR_SWG_NEW_VERSION );
+ return;
+ }
+ if( nLFileFlags & SWGF_BAD_FILE )
+ {
+ Error( ERR_SWG_READ_ERROR );
+ return;
+ }
+
+ pStrm->Read( cPasswd, 16L );
+ *pStrm >> cSet >> nDummy8 >> nDummy32 >> nDummy32;
+ if( nLFileFlags & SWGF_BLOCKNAME )
+ {
+ BYTE cBuf[ 64 ];
+ if( pStrm->Read( cBuf, 64 ) != 64 )
+ pStrm->SetError( SVSTREAM_FILEFORMAT_ERROR );
+ }
+
+ ULONG nNew = pStrm->Tell();
+ nOld += cLen;
+ if( nOld != nNew )
+ pStrm->Seek( nOld );
+
+ BOOL bDone = FALSE;
+
+ // Normales Lesen?
+ while( !bDone )
+ {
+ BYTE cType = Peek();
+ if( !Good() || pStrm->IsEof() )
+ bDone = TRUE;
+ else switch( cType )
+ {
+ case SWG_EOF:
+ bDone = TRUE;
+ break;
+
+ case SWG_DBNAME:
+ {
+ String sDBName;
+ ByteString s8;
+ OpenRec( SWG_DBNAME );
+
+ pStrm->ReadByteString( s8 );
+ rtl_TextEncoding eEnc = GetSOLoadTextEncoding(
+ (rtl_TextEncoding)cSet, pStrm->GetVersion() );
+ sDBName = ConvertStringNoDbDelim( s8, eEnc );
+ SwDBData aData;
+ aData.sDataSource = sDBName.GetToken(0, DB_DELIM);
+ aData.sCommand = sDBName.GetToken(1, DB_DELIM);
+ pDoc->ChgDBData( aData );
+
+ ULONG nSaveWarn = nWarn;
+ CloseRec( SWG_DBNAME );
+ nWarn = nSaveWarn;
+ }
+ break;
+
+ default:
+ SkipRec();
+ }
+ }
+
+ pStrm = pOld;
+ CheckIoError( pContents );
+ pContents->SetBufferSize( 0 );
+}
+
+/*N*/ void Sw3IoImp::OutPageDescs( BOOL bUsed )
+/*N*/ {
+/*N*/ OutHeader();
+/*N*/ CollectFlyFrms( NULL );
+/*N*/ // Stringpool fuellen, Namen im Doc erweitern
+/*N*/ aStringPool.Setup( *pDoc, pStrm->GetVersion(), pExportInfo );
+/*N*/ OutStringPool( SWG_STRINGPOOL, aStringPool );
+/*N*/
+/*N*/ // Nicht-Systemfeldtypen
+/*N*/ if( !nRes ) OutFieldTypes();
+/*N*/
+/*N*/ // Bookmarks (nicht, wenn ein SW2-TextBlockDoc konvertiert wird)
+/*N*/ // Wenn nicht nach 3.1 exportiert wird, werden nur die Bookmarks
+/*N*/ // der Seitenvorlagen geschrieben
+/*N*/ if( !nRes && !( nGblFlags & SW3F_CONVBLOCK ) )
+/*N*/ OutBookmarks( TRUE );
+/*N*/
+/*N*/ if( !nRes && !IsSw31Or40Export() )
+/*N*/ OutRedlines( TRUE );
+/*N*/
+/*N*/ // Numberformatter schreiben bei normalen Dokumenten. Bei Textbausteinen
+/*N*/ // erfolgt es im SaveDocContents
+/*N*/ if( !nRes && !IsSw31Export() && !bBlock )
+/*N*/ OutNumberFormatter();
+/*N*/
+/*N*/ USHORT nArrLen = pDoc->GetPageDescCnt();
+/*N*/ USHORT nCnt = 0;
+/*N*/ if( bUsed )
+/*N*/ {
+/*?*/ for( USHORT n = 0; n < nArrLen; n++ )
+/*?*/ {
+/*?*/ const SwPageDesc& rDesc = pDoc->GetPageDesc( n );
+/*?*/ if( pDoc->IsUsed( rDesc ) )
+/*?*/ nCnt++;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nCnt = nArrLen;
+/*N*/
+/*N*/ OpenRec( SWG_PAGEDESCS );
+/*N*/ *pStrm << (BYTE) 0x02
+/*N*/ << (INT16) nCnt;
+/*N*/ if( bUsed )
+/*N*/ {
+/*?*/ for( USHORT n = 0; n < nArrLen; n++ )
+/*?*/ {
+/*?*/ const SwPageDesc& rDesc = pDoc->GetPageDesc( n );
+/*?*/ if( pDoc->IsUsed( rDesc ) )
+/*?*/ OutPageDesc( rDesc );
+/*?*/ }
+/*N*/ }
+/*N*/ else for( USHORT n = 0; n < nArrLen; n++ )
+/*N*/ OutPageDesc( pDoc->GetPageDesc( n ) );
+/*N*/
+/*N*/ #ifdef TEST_HUGE_DOCS
+/*N*/ BOOL b = FALSE;
+/*N*/ if( b )
+/*N*/ OutHugeRecord( 1024, 32*1024 );
+/*N*/ #endif
+/*N*/
+/*N*/ CloseRec( SWG_PAGEDESCS );
+/*N*/
+/*N*/ // Temporaere Namenserweiterungen entfernen
+/*N*/ aStringPool.RemoveExtensions( *pDoc );
+/*N*/
+/*N*/ // Die Redlines der Seiten-Vorlagen werden jetzt nicht mehr gebraucht
+/*N*/ // und muessen sogar geloescht werden, weil die Indizierung im
+/*N*/ // Content-Bereich wieder mit 0 anfaengt.
+/*N*/ if( pRedlines && nCntntRedlineStart )
+/*N*/ {
+/*?*/ pRedlines->Remove( 0, nCntntRedlineStart );
+/*?*/ nCntntRedlineStart = 0;
+/*N*/ }
+/*N*/ }
+
+// Seitenvorlage einlesen
+
+/*N*/ SwPageDesc* Sw3IoImp::InPageDesc( USHORT& nFollow )
+/*N*/ {
+/*N*/ OpenRec( SWG_PAGEDESC );
+/*N*/ short nUsedOn;
+/*N*/ // 0x10 - Landscape mode
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ USHORT nIdx = 0, nPoolId = 0;
+/*N*/ USHORT nRegCollIdx = IDX_NO_VALUE;
+/*N*/ BYTE nNumType;
+/*N*/ *pStrm >> nIdx >> nFollow >> nPoolId >> nNumType >> nUsedOn;
+/*N*/ if( IsVersion( SWG_REGISTER, SWG_EXPORT31, SWG_DESKTOP40 ) )
+/*N*/ *pStrm >> nRegCollIdx;
+/*N*/ CloseFlagRec();
+/*N*/ if( nRes )
+/*N*/ return NULL;
+/*N*/
+/*N*/ const String& rName = aStringPool.Find( nIdx );
+/*N*/ SwPageDesc* pDesc = NULL;
+/*N*/ // Gibt es diese Vorlage bereits?
+/*N*/ BOOL bPresent = FALSE;
+/*N*/ USHORT nPos=0;
+/*N*/ if( bInsert )
+/*N*/ {
+/*?*/ USHORT nArrLen = pDoc->GetPageDescCnt();
+/*?*/ for( nPos = 0; nPos < nArrLen; nPos++ )
+/*?*/ {
+/*?*/ pDesc = &pDoc->_GetPageDesc( nPos );
+/*?*/ if( pDesc->GetName() == rName )
+/*?*/ {
+/*?*/ bPresent = TRUE; break;
+/*?*/ }
+/*?*/ }
+/*?*/ if( bPresent && bAdditive )
+/*?*/ {
+/*?*/ // Nur hinzufuegen: lass die Vorlage in Ruhe!
+/*?*/ // Dabei geht nichts verloren, also nWarn retten
+/*?*/ ULONG nWarnSave = nWarn;
+/*?*/ CloseRec( SWG_PAGEDESC );
+/*?*/ nWarn = nWarnSave;
+/*?*/ return NULL;
+/*N*/ }
+/*N*/ }
+/*N*/ if( bPresent )
+/*N*/ // Ueberplaetten im Insert Mode: wir brauchen eine Kopie
+/*?*/ pDesc = new SwPageDesc( *pDesc );
+/*N*/ else
+/*N*/ {
+/*N*/ // Sonst bauen wir uns eine
+/*N*/ if( nPoolId != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ // Fehlerfall: unbekannte Poolvorlage -> neu anlegen
+/*N*/ if( RES_POOLPAGE_BEGIN > nPoolId || nPoolId >= RES_POOLPAGE_END )
+/*N*/ {
+/*?*/ ASSERT( !this, "ungueltige Id" );
+/*?*/ nPoolId = IDX_NO_VALUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nPoolId != IDX_NO_VALUE )
+/*N*/ pDesc = pDoc->GetPageDescFromPool( nPoolId );
+/*N*/ else
+/*N*/ pDesc = &pDoc->_GetPageDesc( pDoc->MakePageDesc( rName ) );
+/*N*/ }
+/*N*/
+/*N*/ SvxNumberType aType;
+/*N*/ aType.SetNumberingType(nNumType);
+/*N*/ pDesc->SetNumType( aType );
+/*N*/ pDesc->WriteUseOn( UseOnPage( nUsedOn ) );
+/*N*/ pDesc->SetLandscape( BOOL( ( cFlags & 0x10 ) != 0 ) );
+/*N*/ if( nPoolId != IDX_NO_VALUE )
+/*N*/ pDesc->SetPoolFmtId( nPoolId );
+/*N*/
+/*N*/ if( nRegCollIdx != IDX_NO_VALUE )
+/*N*/ pDesc->SetRegisterFmtColl( FindTxtColl( nRegCollIdx ) );
+/*N*/
+/*N*/ pDesc->ResetAllMasterAttr();
+/*N*/ pDesc->ResetAllLeftAttr();
+/*N*/ // Header und Footer sind Shared-Formate
+/*N*/ nGblFlags |= SW3F_SHAREDFMT;
+/*N*/ short nAttrSet = 0;
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ BYTE cType = Peek();
+/*N*/ switch( cType )
+/*N*/ {
+/*N*/ case SWG_FOOTINFO:
+/*N*/ case SWG_PAGEFOOTINFO:
+/*N*/ InPageFtnInfo( pDesc->GetFtnInfo() ); break;
+/*N*/ case SWG_ATTRSET:
+/*N*/ switch( ++nAttrSet )
+/*N*/ {
+/*N*/ case 1: InAttrSet( (SwAttrSet&) pDesc->GetMaster().GetAttrSet() );
+/*N*/ break;
+/*N*/ case 2: InAttrSet( (SwAttrSet&) pDesc->GetLeft().GetAttrSet() );
+/*N*/ break;
+/*?*/ default: Error(); OpenRec( cType ); CloseRec( cType );
+/*N*/ } break;
+/*N*/ default:
+/*?*/ SkipRec();
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( SWG_PAGEDESC );
+/*N*/ // Hdr/Ftr-Formate umsetzen:
+/*N*/ if( pDesc->IsHeaderShared() )
+/*N*/ {
+/*N*/ const SwFmtHeader& rFmtM = pDesc->GetMaster().GetHeader();
+/*N*/ pDesc->GetLeft().SetAttr( rFmtM );
+/*N*/ }
+/*N*/ if( pDesc->IsFooterShared() )
+/*N*/ {
+/*N*/ const SwFmtFooter& rFmtM = pDesc->GetMaster().GetFooter();
+/*N*/ pDesc->GetLeft().SetAttr( rFmtM );
+/*N*/ }
+/*N*/ nGblFlags &= ~SW3F_SHAREDFMT;
+/*N*/
+/*N*/ if( bPresent )
+/*N*/ {
+/*N*/ // Kopie uebernehmen
+/*?*/ pDoc->ChgPageDesc( nPos, *pDesc );
+/*?*/ delete pDesc;
+/*?*/ pDesc = &pDoc->_GetPageDesc( nPos );
+/*N*/ }
+/*N*/
+/*N*/ return pDesc;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutPageDesc( const SwPageDesc& rPg )
+/*N*/ {
+/*N*/ const SwPageDesc* p;
+/*N*/ // 0x10 - Landscape mode
+/*N*/ BYTE cFlags = IsSw31Export() ? 0x09: 0x0b; // diverse Daten
+/*N*/ if( rPg.GetLandscape() )
+/*N*/ cFlags |= 0x10;
+/*N*/ USHORT nIdx, nFollow = IDX_NO_VALUE, nPoolId = rPg.GetPoolFmtId();
+/*N*/ USHORT nRegCollIdx = IDX_NO_VALUE;
+/*N*/ nIdx = aStringPool.Add( rPg.GetName(), nPoolId );
+/*N*/ p = rPg.GetFollow();
+/*N*/ if( p )
+/*N*/ nFollow = aStringPool.Add( p->GetName(), p->GetPoolFmtId() );
+/*N*/
+/*N*/ const SwTxtFmtColl *pRegFmtColl = rPg.GetRegisterFmtColl();
+/*N*/ if( pRegFmtColl )
+/*N*/ nRegCollIdx = aStringPool.Add( pRegFmtColl->GetName(),
+/*N*/ pRegFmtColl->GetPoolFmtId() );
+/*N*/
+/*N*/
+/*N*/ OpenRec( SWG_PAGEDESC );
+/*N*/ *pStrm << (BYTE) cFlags
+/*N*/ << (UINT16) nIdx
+/*N*/ << (UINT16) nFollow
+/*N*/ << (UINT16) nPoolId
+/*N*/ << (BYTE) rPg.GetNumType().GetNumberingType()
+/*N*/ << (UINT16) rPg.ReadUseOn();
+/*N*/ if( !IsSw31Export() )
+/*N*/ *pStrm << (UINT16) nRegCollIdx;
+/*N*/
+/*N*/ OutPageFtnInfo( rPg.GetFtnInfo() );
+/*N*/ // Formate (evtl. mit Unterdrueckung von Hdr/Ftr-Formaten)
+/*N*/ // Diese Unterdrueckung wird auch in den Attr-Schreiberoutinen
+/*N*/ // verwendet!
+/*N*/ OutAttrSet( rPg.GetMaster().GetAttrSet() );
+/*N*/ USHORT nOldFlags = nGblFlags;
+/*N*/ if( rPg.IsHeaderShared() ) nGblFlags |= SW3F_NOHDRFMT;
+/*N*/ if( rPg.IsFooterShared() ) nGblFlags |= SW3F_NOFTRFMT;
+/*N*/ OutAttrSet( rPg.GetLeft().GetAttrSet() );
+/*N*/ nGblFlags = nOldFlags;
+/*N*/ CloseRec( SWG_PAGEDESC );
+/*N*/ }
+
+// PageDesc-Attribute koennen in einer Absatzvorlage vorkommen; diese
+// werden vor den Seitenvorlagen eingelesen, so dass eine Vorwaerts-
+// Referenz entsteht. Die Einleseroutine legt den Stringpool-Index
+// des Vorlagennamens im Attribut ab. Nach dem Einlesen muss die Vorlage
+// dann noch verbunden werden.
+
+// Aufloesen aller Seitenbeschreibungs-Attribute
+// Die Attribute werden aus dem Pool entnommen und die
+// korrekten Seitenvorlagen werden eingetragen.
+
+/*N*/ void Sw3IoImp::ConnectPageDescAttrs()
+/*N*/ {
+/*N*/ SfxItemPool& rPool = pDoc->GetAttrPool();
+/*N*/ USHORT nArrLen = rPool.GetItemCount( RES_PAGEDESC );
+/*N*/ for( USHORT n = 0; n < nArrLen; n++ )
+/*N*/ {
+/*N*/ SwFmtPageDesc* pAttr =
+/*N*/ (SwFmtPageDesc*) rPool.GetItem( RES_PAGEDESC, n );
+/*N*/ if( pAttr && pAttr->GetDescNameIdx() != IDX_NO_VALUE )
+/*N*/ {
+/*N*/ SwPageDesc* pDesc = FindPageDesc( pAttr->GetDescNameIdx() );
+/*N*/ pAttr->SetDescNameIdx( IDX_NO_VALUE );
+/*N*/ ASSERT( pDesc, "Unbekannte Seitenvorlage fuer PageDesc-Attribut" );
+/*N*/ if( pDesc )
+/*N*/ {
+/*N*/ pDesc->Add( pAttr );
+/*N*/ if( bInsert && pAttr->GetDefinedIn() )
+/*N*/ {
+/*N*/ // dann sollte das Layout auch etwas davon mitbekommen.
+/*N*/ if( pAttr->GetDefinedIn()->ISA( SwTxtFmtColl ) )
+/*N*/ {
+/*N*/ const SwTxtFmtColl *pColl =
+/*N*/ static_cast< const SwTxtFmtColl * >( pAttr->GetDefinedIn() );
+/*N*/ SwAttrSet aChgSet( *pColl->GetAttrSet().GetPool(), RES_PAGEDESC, RES_PAGEDESC );
+/*N*/ aChgSet.Put( *pAttr );
+/*N*/ SwAttrSetChg aOld( pColl->GetAttrSet(), aChgSet );
+/*N*/ SwAttrSetChg aNew( pColl->GetAttrSet(), aChgSet );
+/*N*/
+/*N*/ const_cast < SwTxtFmtColl *>( pColl )->Modify( &aOld, &aNew );
+/*N*/
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ ((SwModify*)pAttr->GetDefinedIn())->SwModify::Modify( pAttr, pAttr );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3redln.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3redln.cxx
new file mode 100644
index 000000000000..b0a286b72ef9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3redln.cxx
@@ -0,0 +1,786 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#ifndef _DOC_HXX //autogen
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#endif
+
+#include <errhdl.hxx>
+
+#include <redline.hxx>
+
+
+#include "sw3marks.hxx"
+#include "sw3imp.hxx"
+namespace binfilter {
+
+
+// lokaler Record in SWG_REDLINES
+#define SWG_REDLINE_LCL 'R'
+
+// lokaler Record in SWG_REDLINE
+#define SWG_REDLINEDATA_LCL 'D'
+
+/*N*/ void Sw3StringPool::SetupRedlines( SwDoc& rDoc )
+/*N*/ {
+/*N*/ const SwRedlineTbl& rRedlines = rDoc.GetRedlineTbl();
+/*N*/ for( USHORT i=0; i<rRedlines.Count(); i++ )
+/*N*/ {
+/*?*/ const SwRedline *pRedline = rRedlines[i];
+ for( USHORT j=0; j<pRedline->GetStackCount(); j++ )
+ Add( pRedline->GetAuthorString(j), USHRT_MAX );
+/*N*/ }
+/*N*/ }
+
+/* */
+
+// REDLINE:
+// BYTE Flags
+// 0x10 - visisble Flags
+// UINT16 Anzahl REDLINEDATA
+// REDLINEDTA*
+//
+// REDLINEDATA:
+// BYTE Flags
+// BYTE Redline-Typ
+// UINT16 String-Pool-Index des Autors
+// UINT32 Datum
+// UINT32 Uhrzeit
+// String Kommentar
+
+/*N*/ void Sw3IoImp::InRedline() //SW50.SDW
+/*N*/ {
+/*N*/ OpenRec( SWG_REDLINE_LCL );
+/*N*/
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/
+/*N*/ UINT16 nCount;
+/*N*/ *pStrm >> nCount;
+/*N*/
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ SwRedlineData *pData = 0;
+/*N*/ for( USHORT i=0; i<nCount; i++ )
+/*N*/ {
+/*N*/ OpenRec( SWG_REDLINEDATA_LCL );
+/*N*/
+/*N*/ BYTE cDFlags = OpenFlagRec();
+/*N*/
+/*N*/ BYTE cType;
+/*N*/ UINT16 nStrIdx;
+/*N*/
+/*N*/ *pStrm >> cType
+/*N*/ >> nStrIdx;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ UINT32 nDate, nTime;
+/*N*/ String aComment;
+/*N*/ *pStrm >> nDate
+/*N*/ >> nTime;
+/*N*/ InString( *pStrm, aComment );
+/*N*/
+/*N*/ // Das oberste Element des Stack wurde als letztes geschrieben.
+/*N*/ USHORT nAuthorIdx;
+/*N*/ if( bNormal && !bInsert )
+/*N*/ nAuthorIdx = pDoc->InsertRedlineAuthor(aStringPool.Find(nStrIdx));
+/*N*/ else
+/*N*/ nAuthorIdx = pDoc->GetRedlineAuthor();
+/*N*/
+/*N*/ pData = new SwRedlineData( (SwRedlineType)cType, nAuthorIdx,
+/*N*/ DateTime( nDate, nTime ), aComment,
+/*N*/ pData );
+/*N*/
+/*N*/ CloseRec( SWG_REDLINEDATA_LCL );
+/*N*/ }
+/*N*/
+/*N*/ // Der PaM ist erstmal egal und wird erst spaeter gesetzt
+/*N*/ SwPosition aDummyPos( pDoc->GetNodes().GetEndOfExtras() );
+/*N*/ BOOL bVisible = (cFlags & 0x10) != 0;
+/*N*/ SwRedline *pRedline =
+/*N*/ new SwRedline( pData, aDummyPos, (cFlags & 0x10) != 0,
+/*N*/ (cFlags & 0x20) != 0, (cFlags & 0x40) != 0 );
+/*N*/
+/*N*/ // Weil der PaM noch nicht gueltig ist, merken wir uns die Redline
+/*N*/ // erstmal so und fuegen sie erst spaeter in das Dokument ein.
+/*N*/ if( !pRedlines )
+/*N*/ pRedlines = new Sw3Redlines;
+/*N*/ pRedlines->Insert( pRedline, pRedlines->Count() );
+/*N*/
+/*N*/ CloseRec( SWG_REDLINE_LCL );
+/*N*/ }
+
+
+void Sw3IoImp::OutRedline( const SwRedline& rRedline )
+{
+ ASSERT( !IsSw31Or40Export(), "Redlines werden nicht exportiert!" );
+
+ OpenRec( SWG_REDLINE_LCL );
+
+ BYTE cFlags = 0x02; // Count
+
+ if( rRedline.IsVisible() )
+ cFlags += 0x10;
+ if( rRedline.IsDelLastPara() )
+ cFlags += 0x20;
+ if( rRedline.IsLastParaDelete() )
+ cFlags += 0x40;
+
+ USHORT i = rRedline.GetStackCount();
+
+ *pStrm << (BYTE) cFlags
+ << (UINT16)i;
+
+ // Die Redline-Data-Objekte werden von hinten nach vorne geschrieben,
+ // das macht das Verketten beim Einlesen leichter.
+ while( i )
+ {
+ i--;
+
+ OpenRec( SWG_REDLINEDATA_LCL );
+
+ cFlags = 0x03; // Type + StrPool-Index des Autors
+ UINT16 nStrIdx = aStringPool.Find( rRedline.GetAuthorString(i),
+ USHRT_MAX );
+ *pStrm << (BYTE) cFlags
+ << (BYTE) rRedline.GetType( i )
+ << (UINT16)nStrIdx;
+
+ const DateTime& rDateTime = rRedline.GetTimeStamp( i );
+ *pStrm << (UINT32)rDateTime.GetDate()
+ << (UINT32)rDateTime.GetTime();
+ OutString( *pStrm, rRedline.GetComment( i ) );
+
+ CloseRec( SWG_REDLINEDATA_LCL );
+ }
+
+ CloseRec( SWG_REDLINE_LCL );
+}
+
+/* */
+
+// REDLINES:
+// REDLINE*
+
+/*N*/ void Sw3IoImp::InRedlines() //SW50.SDW
+/*N*/ {
+/*N*/ if( pRedlines )
+/*N*/ {
+/*N*/ delete pRedlines;
+/*N*/ pRedlines = 0;
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_REDLINES );
+/*N*/
+/*N*/ while( BytesLeft() )
+/*N*/ InRedline();
+/*N*/
+/*N*/ CloseRec( SWG_REDLINES );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutRedlines( BOOL bPageStyles )
+/*N*/ {
+/*N*/ ASSERT( !IsSw31Or40Export(), "Redlines werden nicht exportiert!" );
+/*N*/
+/*N*/ if( !pRedlines )
+/*N*/ return;
+/*N*/
+/*?*/ ASSERT( !bBlock, "In Textbausteinen darf es keine Redlines geben!" );
+/*?*/
+/*?*/ USHORT nArrLen = pRedlines->Count();
+/*?*/ if( nArrLen && bPageStyles )
+/*?*/ {
+/*?*/ ASSERT( nCntntRedlineStart <= nArrLen,
+/*?*/ "Mehr Redlines in Page-Styles als ueberhaupt vorhanden?" );
+/*?*/ nArrLen = nCntntRedlineStart;
+/*?*/ }
+/*?*/ ASSERT( bPageStyles || nCntntRedlineStart==0,
+/*?*/ "Wieso sind da noch Bookmarks aus Seitenvorlagen?" );
+/*?*/ if( !nArrLen )
+/*?*/ return;
+/*?*/
+/*?*/ OpenRec( SWG_REDLINES );
+/*?*/
+/*?*/ for( USHORT i = 0; i < nArrLen; i++ )
+ OutRedline( *(*pRedlines)[i] );
+/*?*/
+/*?*/ CloseRec( SWG_REDLINES );
+/*N*/
+/*N*/ // Die Redlines eines Page-Styles muessen noch geloescht werden. Das
+/*N*/ // darf aber noch nicht hier passieren, weil wir die Redlines noch
+/*N*/ // beim rausschreiben der Markierungen brauchen.
+/*N*/ }
+
+/* */
+
+xub_StrLen lcl_sw3io_getNodeOff( const SwNodeIndex& rNdIdx, xub_StrLen nCntntIdx )
+{
+ // Hier tricksen wir ein wenig: Da Redlines auch auf Start- oder
+ // Endnodes anfangen koennen, muessen wir die Positionen auch dann
+ // Speichern, wenn Sections gespeichert werden. Um zu Unterscheiden,
+ // ob der Start- oder der Endnode gemeint ist, nutzen wir die dann
+ // unbenutzte Content-Position.
+ const SwNode& rNode = rNdIdx.GetNode();
+ if( rNode.IsCntntNode() )
+ {
+ if( nCntntIdx > STRING_MAXLEN52 )
+ return STRING_MAXLEN52;
+ else
+ return nCntntIdx;
+ }
+
+ if( rNode.IsStartNode() )
+ return 0;
+
+ ASSERT( rNode.IsEndNode(), "Was ist denn das fuer ein Node?" );
+ return USHRT_MAX;
+}
+
+/*N*/ void Sw3IoImp::CollectRedlines( SwPaM* pPaM, BOOL bPageOnly )
+/*N*/ {
+/*N*/ ASSERT( !IsSw31Or40Export(), "Redlines werden nicht exportiert!" );
+/*N*/
+/*N*/ delete pRedlines;
+/*N*/ pRedlines = new Sw3Redlines;
+/*N*/ nCntntRedlineStart = 0;
+/*N*/
+/*N*/ const SwPosition *pPaMStart = pPaM ? pPaM->Start() : 0;
+/*N*/ const SwPosition *pPaMEnd = pPaM ? pPaM->End() : 0;
+/*N*/ ULONG nEndOfExtras = pDoc->GetNodes().GetEndOfExtras().GetIndex();
+/*N*/
+/*N*/ const SwRedlineTbl& rRedlines = pDoc->GetRedlineTbl();
+ USHORT i=0;
+/*N*/ for( i=0; i<rRedlines.Count(); i++ )
+/*N*/ {
+/*?*/ SwRedline *pRedline = rRedlines[i];
+/*?*/ const SwPosition *pPos = pRedline->Start();
+/*?*/ const SwPosition *pEndPos = pRedline->End();
+/*?*/ if( !pRedline->GetContentIdx() && *pPos == *pEndPos )
+/*?*/ {
+/*?*/ // "Leere" Redlines werden nicht gespeichert!
+/*?*/ ASSERT( !this, "Redline in leer" );
+/*?*/ continue;
+/*?*/ }
+/*?*/
+/*?*/ // If the redline is within one node and starts behind the
+/*?*/ // last position that is possible within the 5.2 version,
+/*?*/ // it will be ignored.
+/*?*/ if( pPos->nContent.GetIndex() > STRING_MAXLEN52 &&
+/*?*/ pPos->nNode.GetIndex() == pEndPos->nNode.GetIndex() &&
+/*?*/ pEndPos->nContent.GetIndex() > STRING_MAXLEN52 )
+/*?*/ continue;
+/*?*/
+/*?*/ if( pDoc->IsInHeaderFooter( pPos->nNode ) )
+/*?*/ {
+/*?*/ pRedlines->Insert( pRedline, nCntntRedlineStart );
+/*?*/ nCntntRedlineStart++;
+/*?*/ }
+/*?*/ else if( !bPageOnly )
+/*?*/ {
+/*?*/ // Bei gegebenen PaM alle Redlines mitnehmen, die in
+/*?*/ // Sonderbereichen liegen oder ganz oder teilweise im PaM.
+/*?*/ const SwPosition *pStart = pRedline->Start();
+/*?*/ SwComparePosition eCmp =
+/*?*/ bSaveAll || !pPaM || pStart->nNode.GetIndex() <= nEndOfExtras
+/*?*/ ? POS_INSIDE
+/*?*/ : ComparePosition( *pStart, *pRedline->End(),
+/*?*/ *pPaMStart, *pPaMEnd );
+/*?*/ if( POS_BEFORE != eCmp && POS_BEHIND != eCmp &&
+/*?*/ POS_COLLIDE_END != eCmp && POS_COLLIDE_START != eCmp )
+/*?*/ pRedlines->Insert( pRedline, pRedlines->Count() );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !pRedlines->Count() )
+/*N*/ {
+/*N*/ // Keine Redlines? Dann nicht weiter.
+/*N*/ delete pRedlines;
+/*N*/ pRedlines = 0;
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*?*/ ASSERT( !bBlock, "In Textbausteinen darf es keine Redlines geben!" );
+/*?*/
+/*?*/ Sw3Mark aMark;
+/*?*/ USHORT nArrLen = pRedlines->Count();
+/*?*/
+/*?*/ if( !pRedlineMarks )
+/*?*/ pRedlineMarks = new Sw3Marks( 2*nArrLen, 2 );
+/*?*/
+/*?*/ for( i = 0; i < nArrLen; i++ )
+ {
+/*?*/ const SwRedline* pRedline = pRedlines->GetObject( i );
+/*?*/
+/*?*/ if( i >= nCntntRedlineStart )
+/*?*/ aMark.SetId( i - nCntntRedlineStart );
+/*?*/ else
+/*?*/ aMark.SetId( i );
+/*?*/
+/*?*/ // Bei gegebenen Redlines die Positionen auf den PaM reduzieren
+/*?*/ const SwPosition *pStart = pRedline->Start();
+/*?*/ const SwPosition *pEnd = pRedline->End();
+/*?*/ SwComparePosition eCmp =
+/*?*/ bSaveAll || !pPaM || pStart->nNode.GetIndex() <= nEndOfExtras
+/*?*/ ? POS_INSIDE
+/*?*/ : ComparePosition( *pStart, *pEnd, *pPaMStart, *pPaMEnd );
+/*?*/
+/*?*/ ASSERT( POS_BEFORE != eCmp && POS_BEHIND != eCmp &&
+/*?*/ POS_COLLIDE_END != eCmp && POS_COLLIDE_START != eCmp,
+/*?*/ "Redline mit ungeultigem Bereich" );
+/*?*/
+/*?*/ if( POS_OUTSIDE == eCmp || POS_OVERLAP_BEFORE == eCmp )
+/*?*/ pStart = pPaMStart;
+/*?*/ if( POS_OUTSIDE == eCmp || POS_OVERLAP_BEHIND == eCmp )
+/*?*/ pEnd = pPaMEnd;
+/*?*/
+/*?*/ aMark.SetType( SW3_REDLINE_START );
+/*?*/ aMark.SetNodePos( pStart->nNode.GetIndex() );
+/*?*/ aMark.SetNodeOff( lcl_sw3io_getNodeOff( pStart->nNode,
+/*?*/ pStart->nContent.GetIndex() ) );
+/*?*/ pRedlineMarks->Insert( new Sw3Mark(aMark) );
+/*?*/
+/*?*/ if( pRedline->HasMark() )
+/*?*/ {
+/*?*/ // Wenn der PaM ein Mark besitzt, dann End die jeweils
+/*?*/ // andere Position.
+/*?*/ aMark.SetType( SW3_REDLINE_END );
+/*?*/ aMark.SetNodePos( pEnd->nNode.GetIndex() );
+/*?*/ aMark.SetNodeOff( lcl_sw3io_getNodeOff( pEnd->nNode,
+/*?*/ pEnd->nContent.GetIndex() ) );
+/*?*/ pRedlineMarks->Insert( new Sw3Mark(aMark) );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+
+/* */
+
+// NODEREDLINE:
+// BYTE Flags
+// 0x01 - End-Position einer Redline, sonst Start-Positiom
+// 0x02 - Redline besitzt Section
+// UINT16 Id der Redline (Array-Position)
+// UINT16 Content-Position bzw. USHRT_MAX, wenn die Psoition dem zu
+// einem Start-Node gehoerenden ENd-Node bezeichnet.
+// CONTENT? Section (optional)
+
+/*N*/ void Sw3IoImp::InNodeRedline( const SwNodeIndex& rNodeIdx, INT32& nCntntOff, //SW50.SDW
+/*N*/ BYTE nInsFirstPara )
+/*N*/ {
+/*N*/ OpenRec( SWG_NODEREDLINE );
+/*N*/
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ UINT16 nId, nNodeOff;
+/*N*/ *pStrm >> nId >> nNodeOff;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ ASSERT( pRedlines && nId < pRedlines->Count(), "Ungueltige Redline-Id" );
+/*N*/ if( !pRedlines || nId >= pRedlines->Count() )
+/*N*/ {
+/*N*/ Error();
+/*N*/ CloseRec( SWG_NODEREDLINE );
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ SwRedline *pRedline = (*pRedlines)[nId];
+/*N*/ SwRedlineType eType = pRedline ? pRedline->GetType() : REDLINE_FLAG_MASK;
+/*N*/ if( REDLINE_INSERT != eType && REDLINE_DELETE != eType &&
+/*N*/ REDLINE_FORMAT != eType )
+/*N*/ {
+/*N*/ // Unbekannter oder noch nicht implementierter Redline-Typ:
+/*N*/ // Da ist es besser, wir ignorieren sie, denn wir koennen ja
+/*N*/ // sowieso nichts damit anfangen.
+/*N*/ ASSERT( !pRedline, "nicht implementierter Redline-Typ" );
+/*N*/ Warning();
+/*N*/ CloseRec( SWG_NODEREDLINE );
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Position setzen
+/*N*/ SwPosition *pPos;
+/*N*/ if( 0x10 & cFlags )
+/*N*/ {
+/*N*/ // bei End-Positionen Mark setzen
+/*N*/ pRedline->SetMark();
+/*N*/ pPos = pRedline->GetMark();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // sonst Point
+/*N*/ pPos = pRedline->GetPoint();
+/*N*/ }
+/*N*/
+/*N*/ SwNode& rNode = rNodeIdx.GetNode();
+/*N*/
+/*N*/ // Beim Einfuegen in den ersten Absatz sollten wir eine Content-Node
+/*N*/ // haben, in den wir an der uebergeben Position einfuegen.
+/*N*/ if( nInsFirstPara )
+/*N*/ {
+/*N*/ ASSERT( rNode.IsCntntNode(), "Content-Node beim Einf. erwartet" );
+/*N*/ ASSERT( USHRT_MAX==nNodeOff, "End-Node-Position beim Einf. erwartet" );
+/*N*/ nNodeOff = 0; // Im IsCntntNode-Zweig gibts so die richtige Pos.
+/*N*/ }
+/*N*/
+/*N*/ sal_Bool bInvalid = sal_False;
+/*N*/ // Positionen koennen auch auf Start- oder End-Nodes fallen.
+/*N*/ if( rNode.IsCntntNode() )
+/*N*/ {
+/*N*/ pPos->nNode = rNodeIdx;
+/*N*/ xub_StrLen nLen = rNode.GetCntntNode()->Len();
+/*N*/ xub_StrLen nIdx = static_cast< xub_StrLen >( nNodeOff+nCntntOff );
+/*N*/ ASSERT( nIdx>=0 && nIdx<=nLen, "ungueltiger Cntnt-Offset" );
+/*N*/ if( nIdx<0 || nIdx > nLen )
+/*N*/ {
+/*N*/ bInvalid = sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pPos->nContent.Assign( rNode.GetCntntNode(), nIdx );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( rNode.IsStartNode(), "Start-Node erwartet" );
+/*N*/ if( USHRT_MAX==nNodeOff )
+/*N*/ {
+/*N*/ pPos->nNode = rNode.EndOfSectionIndex();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pPos->nNode = rNodeIdx;
+/*N*/
+/*N*/ ASSERT( 0==nNodeOff,
+/*N*/ "ungeueltige Content-Position fuer Start-Node" );
+/*N*/ if( 0 != nNodeOff )
+/*N*/ Warning();
+/*N*/ }
+/*N*/ pPos->nContent.Assign( 0, 0 );
+/*N*/ }
+/*N*/
+/*N*/ if( cFlags & 0x20 )
+/*N*/ {
+/*N*/ if( (bNormal && bInsert) || bPageDescs )
+/*N*/ {
+/*N*/ if( REDLINE_INSERT == eType )
+/*N*/ {
+/*N*/ // Ein einefuegter Text wird nicht angezeigt. Dann muss der
+/*N*/ // eingefuegt Text an der entsprechenden Position eingfuegt
+/*N*/ // werden.
+/*N*/ if( !nInsFirstPara && !pPos->nNode.GetNode().IsCntntNode() &&
+/*N*/ pRedline->IsDelLastPara() )
+/*N*/ {
+/*N*/ // Wenn das DelLastPara-Flag gsetzt ist, wird
+/*N*/ // versucht in den Absatz davor einzufuegen, denn
+/*N*/ // der soll ja geloescht werden.
+/*N*/ pPos->nNode--;
+/*N*/ SwCntntNode *pCNd = pPos->nNode.GetNode().GetCntntNode();
+/*N*/ ASSERT( pCNd, "Kein Content-Node trotz DelLastPara" );
+/*N*/ if( pCNd )
+/*N*/ pPos->nContent.Assign( pCNd, pCNd->Len() );
+/*N*/ else
+/*N*/ pPos->nNode++;
+/*N*/ }
+/*N*/ const SwNode& rNewNode = pPos->nNode.GetNode();
+/*N*/ if( rNewNode.IsCntntNode() )
+/*N*/ {
+/*N*/ xub_StrLen nCntntIdx = pPos->nContent.GetIndex();
+/*N*/
+/*N*/ InContents( pPos->nNode, nCntntIdx );
+/*N*/
+/*N*/ // Den Offset noch an die Verschiebung der
+/*N*/ // Content-Position anpassen.
+/*N*/ nCntntOff += pPos->nContent.GetIndex();
+/*N*/ nCntntOff -= nCntntIdx;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ InContents( pPos->nNode, 0, FALSE, 0, TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ SkipRec();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwNodeIndex aStart( pDoc->GetNodes().GetEndOfRedlines() );
+/*N*/ SwStartNode* pSttNd =
+/*N*/ pDoc->GetNodes().MakeEmptySection( aStart,SwNormalStartNode );
+/*N*/ aStart = *pSttNd->EndOfSectionNode();
+/*N*/ InContents( aStart, 0, FALSE );
+/*N*/ aStart = pSttNd->GetIndex();
+/*N*/ pRedline->SetContentIdx( &aStart );
+/*N*/ if( pSttNd->EndOfSectionIndex() - aStart.GetIndex() == 1 )
+/*N*/ bInvalid = sal_True;
+/*N*/ ASSERT( !bInvalid, "empty redline section imported" );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SwRedlineTbl& rRedlineTbl = pDoc->GetRedlineTbl();
+/*N*/ if( !bInvalid )
+/*N*/ {
+/*N*/ // Check for nested redlines.
+/*N*/ sal_Bool bHasMark = pRedline->HasMark() &&
+/*N*/ *pRedline->GetPoint() != *pRedline->GetMark();
+/*N*/ const SwPosition *pStt = bHasMark ? pRedline->Start() : 0;
+/*N*/ const SwPosition *pEnd = bHasMark ? pRedline->End() : 0;
+/*N*/ sal_uInt16 nCount = rRedlineTbl.Count();
+/*N*/ for( sal_uInt16 i=0; !bInvalid && i<nCount; i++ )
+/*N*/ {
+/*N*/ const SwRedline *pTest = rRedlineTbl[i];
+/*N*/ if( pTest != pRedline )
+/*N*/ {
+/*N*/
+/*N*/ // Is the ineew position is inside an existing
+/*N*/ // redline then it is invalid.
+/*N*/ const SwPosition *pTestStt = pTest->Start();
+/*N*/ const SwPosition *pTestEnd = pTest->HasMark() ? pTest->End() : 0;
+/*N*/ bInvalid = pTestEnd != 0 && *pPos > *pTestStt && *pPos < *pTestEnd;
+/*N*/
+/*N*/ // If the start or end of and existing redline is inside the
+/*N*/ // redline then the new redline is invalid as well;
+/*N*/ if( !bInvalid && bHasMark )
+/*N*/ bInvalid = *pTestStt > *pStt && *pTestStt < *pEnd;
+/*N*/ if( !bInvalid && bHasMark && pTestEnd != 0 )
+/*N*/ bInvalid = *pTestEnd > *pStt && *pTestEnd < *pEnd;
+/*N*/
+/*N*/ ASSERT( !bInvalid, "overlapping redline" );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bNormal && !bInsert )
+/*N*/ {
+/*N*/ if( (0x10 & cFlags) == 0 )
+/*N*/ {
+/*N*/ // Die Redline darf jetzt eingefuegt werden. Das Redline-Objekt
+/*N*/ // geht in den Besitz des Dokuments ueber.
+/*N*/
+/*N*/ if( !bInvalid )
+/*N*/ bInvalid = !const_cast< SwRedlineTbl& >(rRedlineTbl).Insert(
+/*N*/ pRedline, (BOOL)FALSE );
+/*N*/ }
+/*N*/ else if (bInvalid )
+/*N*/ {
+/*N*/ // The redline is is inserted already and has to be removed from the
+/*N*/ // table;
+/*N*/
+/*N*/ sal_uInt16 nPos = rRedlineTbl.GetPos( pRedline );
+/*N*/ ASSERT( USHRT_MAX != nPos, "inserted invalid redline not found" );
+/*N*/ if( USHRT_MAX != nPos )
+/*N*/ const_cast< SwRedlineTbl& >(rRedlineTbl).Remove( nPos );
+/*N*/ }
+/*N*/
+/*N*/ if( bInvalid )
+/*N*/ {
+/*N*/ // JP 18.5.2001: Bug 87222 - then delete this invalid redline
+/*N*/ delete pRedline;
+/*N*/ pRedlines->Replace( 0, nId );
+/*N*/ Warning();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_NODEREDLINE );
+/*N*/ }
+
+/*N*/ void Sw3IoImp::OutNodeRedlines( ULONG nIdx )
+/*N*/ {
+/*N*/ ASSERT( !IsSw31Or40Export(), "Redlines werden nicht exportiert!" );
+/*N*/
+/*N*/ if( pRedlineMarks )
+/*N*/ {
+/*?*/ for( USHORT nPos = 0; nPos < pRedlineMarks->Count(); ++nPos )
+/*?*/ {
+/*?*/ Sw3Mark *pMark = (*pRedlineMarks)[ nPos ];
+/*?*/ if( pMark->GetNodePos() == nIdx )
+/*?*/ {
+/*?*/ ASSERT( pMark->GetId() < pRedlines->Count(),
+/*?*/ "ungeuletige Redline-Id" );
+/*?*/ Sw3MarkType eMarkType = pMark->GetType();
+/*?*/ SwRedline *pRedline = (*pRedlines)[pMark->GetId()];
+/*?*/ const SwNodeIndex *pContentIdx = pRedline->GetContentIdx();
+/*?*/
+/*?*/ OpenRec( SWG_NODEREDLINE );
+/*?*/
+/*?*/ BYTE cFlags = 0x04;
+/*?*/ if( SW3_REDLINE_END == eMarkType )
+/*?*/ cFlags |= 0x10;
+/*?*/ else if( pContentIdx )
+/*?*/ cFlags |= 0x20;
+/*?*/
+/*?*/ xub_StrLen nOffs = pMark->GetNodeOff();
+/*?*/ if( pDoc->GetNodes()[nIdx]->IsCntntNode() &&
+/*?*/ nOffs > STRING_MAXLEN52 )
+/*?*/ nOffs = STRING_MAXLEN52;
+/*?*/ *pStrm << (BYTE) cFlags
+/*?*/ << (UINT16)pMark->GetId()
+/*?*/ << (UINT16)nOffs;
+/*?*/
+/*?*/ if( pContentIdx )
+/*?*/ {
+/*?*/ ASSERT( pContentIdx->GetNode().EndOfSectionIndex() -
+/*?*/ pContentIdx->GetIndex(),
+/*?*/ "empty redline section exported" );
+/*?*/ OutContents( *pContentIdx );
+/*?*/ }
+/*?*/
+/*?*/ CloseRec( SWG_NODEREDLINE );
+/*?*/
+/*?*/ pRedlineMarks->Remove( nPos-- );
+/*?*/ delete pMark;
+/*?*/ if( !pRedlineMarks->Count() )
+/*?*/ {
+/*?*/ delete pRedlineMarks;
+/*?*/ pRedlineMarks = NULL;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ else if( pMark->GetNodePos() > nIdx )
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+ /* */
+/*N*/ namespace
+/*N*/ {
+/*N*/ void CorrRedline( SwRedline& rRedline,
+/*N*/ const SwPosition& rOldPos,
+/*N*/ const SwPosition& rNewPos )
+/*N*/ {
+/*N*/ sal_uInt32 nOldNodeIdx = rOldPos.nNode.GetIndex();
+/*N*/ if( rRedline.GetPoint()->nNode.GetIndex() == nOldNodeIdx )
+/*N*/ {
+/*N*/ xub_StrLen nOffset = rRedline.GetPoint()->nContent.GetIndex() -
+/*N*/ rOldPos.nContent.GetIndex();
+/*N*/ rRedline.GetPoint()->nNode = rNewPos.nNode;
+/*N*/ rRedline.GetPoint()->nContent.Assign(
+/*N*/ rNewPos.nNode.GetNode().GetCntntNode(),
+/*N*/ rNewPos.nContent.GetIndex() + nOffset );
+/*N*/ }
+/*N*/ if( rRedline.GetMark()->nNode.GetIndex() == nOldNodeIdx )
+/*N*/ {
+/*N*/ xub_StrLen nOffset = rRedline.GetMark()->nContent.GetIndex() -
+/*N*/ rOldPos.nContent.GetIndex();
+/*N*/ rRedline.GetMark()->nNode = rNewPos.nNode;
+/*N*/ rRedline.GetMark()->nContent.Assign(
+/*N*/ rNewPos.nNode.GetNode().GetCntntNode(),
+/*N*/ rNewPos.nContent.GetIndex() + nOffset );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ void Sw3IoImp::CleanupRedlines()
+/*N*/ {
+/*N*/ if( !pRedlines || !pRedlines->Count() )
+/*N*/ return;
+/*N*/
+/*N*/ // Bisher muss hier nur was beim Einfugen und Laden von Seiten-Vorlagen
+/*N*/ // passieren.
+/*N*/ if( (bNormal && bInsert) || bPageDescs )
+/*N*/ {
+/*N*/ // Alle geloeschten-Redlines, die angezeigt werden, muessen noch
+/*N*/ // geloescht werden.
+/*N*/
+/*N*/ // In a first step, delete the redline objects that are not deletions.
+/*N*/ sal_uInt16 i=0;
+/*N*/ while( i < pRedlines->Count() )
+/*N*/ {
+/*N*/ SwRedline *pRedline = (*pRedlines)[i];
+/*N*/ if( pRedline )
+/*N*/ {
+/*N*/ if( REDLINE_DELETE != pRedline->GetType() ||
+/*N*/ pRedline->GetContentIdx() != 0 )
+/*N*/ {
+/*N*/ delete pRedline;
+/*N*/ pRedlines->Remove( i );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ++i;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pRedlines->Remove( i );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // now process the remaining redlines
+/*N*/ sal_uInt16 nCount = pRedlines->Count();
+/*N*/ for( i=0; i<nCount; ++i )
+/*N*/ {
+/*N*/ SwRedline *pRedline = (*pRedlines)[i];
+/*N*/ ASSERT( REDLINE_DELETE == pRedline->GetType() &&
+/*N*/ !pRedline->GetContentIdx(), "wrong redline type" );
+/*N*/ SwRedlineMode eOld = pDoc->GetRedlineMode();
+/*N*/ pDoc->SetRedlineMode_intern( eOld & ~(REDLINE_ON | REDLINE_IGNORE) );
+/*N*/ {
+/*N*/ // If the end node of the redline is deleted (and not joined
+/*N*/ // with the next one), then we have to make sure that none of
+/*N*/ // the remaining redlines starts in that node.
+/*N*/ // The end node of the redline is deleted if the PaM's point
+/*N*/ // or if it is the PaM mark, but in this later case, the whole
+/*N*/ // last node has to be selected.
+/*N*/ const SwPosition& rPointPos = *pRedline->GetPoint();
+/*N*/ const SwPosition& rMarkPos = *pRedline->GetMark();
+/*N*/ if( rPointPos.nNode.GetNode().IsCntntNode() &&
+/*N*/ rMarkPos.nNode.GetNode().IsCntntNode() &&
+/*N*/ ( rPointPos.nNode.GetIndex() > rMarkPos.nNode.GetIndex() ||
+/*N*/ (rMarkPos.nNode.GetIndex() > rPointPos.nNode.GetIndex() &&
+/*N*/ rMarkPos.nContent.GetIndex() == rMarkPos.nNode.GetNode().GetCntntNode()->Len()) ) )
+/*N*/ {
+/*N*/ for( sal_uInt16 j= i+1; j < nCount; ++j )
+/*N*/ {
+/*N*/ SwRedline *pTestRedline = (*pRedlines)[j];
+/*N*/ CorrRedline( *pTestRedline, *pRedline->End(),
+/*N*/ *pRedline->Start() );
+/*N*/ }
+/*N*/ }
+/*N*/ pDoc->DeleteAndJoin( *pRedline );
+/*N*/ pDoc->SetRedlineMode_intern( eOld );
+/*N*/ }
+/*N*/ delete pRedline;
+/*N*/ }
+/*N*/ // Das Array wird zwar auch im CloseStreams geloscht, da wir
+/*N*/ // die Objekte aber schon geloescht haben, ist es besser, das
+/*N*/ // Array gleich zu loeschen.
+/*N*/ pRedlines->Remove( 0, pRedlines->Count() );
+/*N*/ delete pRedlines; pRedlines = 0;
+/*N*/ }
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3sectn.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3sectn.cxx
new file mode 100644
index 000000000000..aa37b56462a2
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3sectn.cxx
@@ -0,0 +1,931 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <bf_svtools/urihelper.hxx>
+#ifndef _SVSTDARR_USHORTS_DECL
+#define _SVSTDARR_USHORTS
+#endif
+#include <bf_so3/linkmgr.hxx>
+
+#include <fmtanchr.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <pam.hxx>
+#include <sw3imp.hxx>
+#include <sw3marks.hxx>
+#include <section.hxx>
+#include <ndtxt.hxx>
+#include <ndnotxt.hxx>
+#include <flypos.hxx>
+#include <swerror.h>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Wird ein Text in einen Absatz eingefuegt, wird der erste Absatz an den
+// ersten Teil angefuegt, ohne die Formate zu uebernehmen. Alle anderen
+// Absaetze uebernehmen die Formate, was auch den Rest des alten Absatzes
+// betrifft.
+// Die Position rPos wird weitergefuehrt. Der uebergebene Offset ist
+// ein Offset in einen TextNode, der an InTxtNode() uebergeben wird.
+// Falls bNode1 FALSE ist, wird ein evtl. vorhandener leerer Node nicht
+// gefuellt. Dadurch laesst sich diese Methode fuer mehrere Contents
+// verwenden.
+
+/*N*/ void Sw3IoImp::InContents( SwNodeIndex& rPos, xub_StrLen nOffset, BOOL bNode1,
+/*N*/ BYTE nInsFirstPara, BOOL bDontMove )
+/*N*/ {
+/*N*/ OpenRec( SWG_CONTENTS );
+/*N*/
+/*N*/ // Der aktuelle NumRange eines 3.1/40-Files muss gerettet werden, falls
+/*N*/ // eine Section innerhalb einer Section gelesen wird (z.B. Flys)
+/*N*/ SwNumRule* pOld40Rule;
+/*N*/ SwPaM* pOld40Range;
+/*N*/ BOOL bOldConvertNoNum;
+/*N*/ if( !IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ pOld40Rule = pCurNumRule;
+/*N*/ pOld40Range = pCurNumRange;
+/*N*/ bOldConvertNoNum = bConvertNoNum;
+/*N*/ pCurNumRange = NULL;
+/*N*/ pCurNumRule = NULL;
+/*N*/ bConvertNoNum = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ // fuer die Sonderbehandlung des ersten/letzten Node beim "Datei/Einfuegen"
+/*N*/ BYTE nSaveInsFirstPara = nInsFirstPara;
+/*N*/
+/*N*/ // Bei einem echten Insert muss der aktuelle Node gesplittet werden,
+/*N*/ // Falls mehr als 1 Node eingelesen wird.
+/*N*/ BOOL bSplit = FALSE;
+/*N*/ SwTxtNode* pLast = NULL;
+/*N*/ const SwStartNode *pSttNd, *pSectSttNd = 0;
+/*N*/ SwNode* pStart = pDoc->GetNodes()[ rPos ];
+/*N*/ if( pStart->GetStartNode() && !bDontMove )
+/*N*/ {
+/*N*/ pSttNd = (const SwStartNode *)pStart;
+/*N*/ pSectSttNd = pSttNd;
+/*N*/
+/*N*/ // Index zeigt auf StartNode. In Contents-Bereich reingehen
+/*N*/ // und den ersten TextNode nehmen
+/*N*/ rPos++;
+/*N*/ pStart = pDoc->GetNodes()[ rPos ];
+/*N*/ }
+/*N*/ else
+/*N*/ pSttNd = pStart->FindStartNode();
+/*N*/
+/*N*/ SwTxtNode* pNd = bNode1 ? pStart->GetTxtNode() : NULL;
+/*N*/ SwTxtNode* pNd1 = pNd;
+/*N*/ ASSERT( !nInsFirstPara || pNd, "Einfuegen in Nicht-Content-Node?" );
+/*N*/ SwPosition *pEndPos = 0;
+/*N*/ if( nInsFirstPara && pNd )
+/*N*/ {
+/*?*/ SwIndex aTmp( pNd, nOffset );
+/*?*/ pEndPos = new SwPosition( rPos, aTmp );
+/*N*/ }
+/*N*/
+/*N*/ UINT32 nNodes;
+/*N*/ if( IsVersion(SWG_LAYFRAMES) )
+/*N*/ OpenFlagRec();
+/*N*/ if( IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ *pStrm >> nNodes;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ UINT16 nNodes16, nSectIdDummy;
+/*N*/ if( IsVersion(SWG_LAYFRAMES) )
+/*N*/ *pStrm >> nSectIdDummy;
+/*N*/ *pStrm >> nNodes16;
+/*N*/ nNodes = nNodes16;
+/*N*/ }
+/*N*/ if( IsVersion(SWG_LAYFRAMES) )
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ ULONG i = 0;
+/*N*/ while( BytesLeft() )
+/*N*/ {
+/*N*/ SetPercentBar( pStrm->Tell() );
+/*N*/ BYTE cType = Peek();
+/*N*/ i++;
+/*N*/ switch( cType )
+/*N*/ {
+/*N*/ case SWG_TEXTNODE:
+/*N*/ // Der Node muss gesplittet werden,
+/*N*/ // wenn mehrere Nodes inserted werden
+/*N*/ if( !bSplit && bInsert && nNodes > 1 )
+/*N*/ {
+/*?*/ if( pNd )
+/*?*/ {
+/*?*/ // natuerlich nur TextNodes splitten
+/*?*/ SwPosition aSplitPos( rPos, SwIndex( pNd, nOffset ) );
+/*?*/ pDoc->SplitNode( aSplitPos );
+/*?*/ pLast = pNd;
+/*?*/ rPos--;
+/*?*/ pNd = pDoc->GetNodes()[ rPos ]->GetTxtNode();
+/*?*/ bSplit = TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ else if( i == nNodes && pLast )
+/*N*/ {
+/*N*/ // der letzte Node: nimm evtl. den gesplitteten
+/*?*/ pNd = pLast;
+/*?*/ if( nSaveInsFirstPara && pNd && pNd->GetTxt().Len() )
+/*?*/ nInsFirstPara = 2;
+/*N*/ }
+/*N*/ InTxtNode( pNd, rPos, nOffset, nInsFirstPara );
+/*N*/ pNd = pNd1 = NULL; nOffset = 0;
+/*N*/ nInsFirstPara = 0;
+/*N*/ break;
+/*N*/ case SWG_GRFNODE:
+/*N*/ InGrfNode( rPos );
+/*N*/ nInsFirstPara = 0;
+/*N*/ break;
+/*N*/ case SWG_OLENODE:
+/*N*/ InOLENode( rPos );
+/*N*/ nInsFirstPara = 0;
+/*N*/ break;
+/*N*/ case SWG_TABLE:
+/*N*/ // JP 20.05.94: Dok. einfuegen: wird als 1.Node eine
+/*N*/ // Tabelle eingefuegt, dann immer splitten !!
+/*N*/ nInsFirstPara = 0;
+/*N*/ if( 1 == i && bInsert && pNd )
+/*N*/ {
+/*?*/ SwPosition aSplitPos( rPos, SwIndex( pNd, nOffset ) );
+/*?*/ pDoc->SplitNode( aSplitPos );
+/*?*/ nOffset = 0; // mit dem Offset hat sichs erledigt!
+/*N*/ }
+/*N*/ InTable( rPos );
+/*N*/ break;
+/*N*/ case SWG_SECTION:
+/*N*/ // JP 20.05.94: Dok. einfuegen: wird als 1.Node eine
+/*N*/ // Section eingefuegt, dann immer splitten !!
+/*N*/ nInsFirstPara = 0;
+/*N*/ if( 1 == i && bInsert && pNd )
+/*N*/ {
+/*?*/ SwPosition aSplitPos( rPos, SwIndex( pNd, nOffset ) );
+/*?*/ pDoc->SplitNode( aSplitPos );
+/*?*/ nOffset = 0; // mit dem Offset hat sichs erledigt!
+/*N*/ }
+/*N*/ InSection( rPos );
+/*N*/ break;
+/*N*/ case SWG_REPTEXTNODE:
+/*N*/ // keine Spezialbehandlung fuer 1. und letzten Node neoetig,
+/*N*/ // weil der erste und letzte Knoten eines gespeicherten
+/*N*/ // Doks nie ein RepTextNode ist.
+/*N*/ // MIB 21.7.97: Irrtum: Beim Einfuegen von Tabellen wird
+/*N*/ // auch immer gesplittet.
+/*N*/ {
+/*N*/ BOOL bJoin = pLast && i==nNodes;
+/*N*/ InRepTxtNode( rPos );
+/*N*/ if( bJoin )
+/*N*/ {
+/*?*/ rPos--;
+/*?*/ SwTxtNode* pTxtNode = rPos.GetNode().GetTxtNode();
+/*?*/ if( pTxtNode && pTxtNode->CanJoinNext() )
+/*?*/ pTxtNode->JoinNext();
+/*?*/ rPos++;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case SWG_SDRFMT:
+/*N*/ // Keine Draw-Formate in Kopf oder Fusszeilen einfuegen oder
+/*N*/ // wenn kein Drawing-Layer da ist!
+/*?*/ if( (nGblFlags & SW3F_NODRAWING) || bInsIntoHdrFtr )
+/*?*/ {
+/*?*/ i--; // War gar kein Node
+/*?*/ SkipRec();
+/*?*/ break;
+/*?*/ } // sonst weiter:
+/*?*/ case SWG_FLYFMT:
+/*?*/ {
+/*?*/ // Was auch immer jetzt passiert, einen Node lesen wir
+/*?*/ // nicht ein.
+/*?*/ i--;
+/*?*/
+/*?*/ if( SwFlyStartNode != pSttNd->GetStartNodeType() )
+/*?*/ {
+/*?*/ ASSERT( !this,
+/*?*/ "Verankerung an Frames ist nur fuer Fly-Frames implementiert" );
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*?*/ // Rahmengebundener FlyFrame
+/*?*/ USHORT eSave_StartNodeType = eStartNodeType;
+/*?*/ eStartNodeType = SwFlyStartNode;
+/*?*/ SwFrmFmt* pFmt = (SwFrmFmt*) InFormat( cType, NULL );
+/*?*/ eStartNodeType = eSave_StartNodeType;
+/*?*/
+/*?*/ if( !pFmt )
+/*?*/ break;
+/*?*/
+/*?*/ // Anker darin versenken
+/*?*/ SwFmtAnchor aAnchor( pFmt->GetAnchor() );
+/*?*/ SwPosition aPos( *pSttNd );
+/*?*/ aAnchor.SetAnchor( &aPos );
+/*?*/ pFmt->SetAttr( aAnchor );
+/*?*/
+/*?*/ // Layout-Frames im Insert Mode fuer absatzgebundene
+/*?*/ // Flys erzeugen
+/*?*/ if( bInsert && !nRes )
+/*?*/ pFmt->MakeFrms();
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ case SWG_NODEREDLINE:
+/*?*/ {
+/*N*/ /*?*/ i--; //SW50.SDW
+/*N*/ /*?*/ if( nSaveInsFirstPara )
+/*N*/ /*?*/ {
+/*N*/ /*?*/ // Hier kann es nur einen End-Index geben. Der
+/*N*/ /*?*/ // entspricht dann der Einfuege-Position.
+/*N*/ /*?*/ INT32 nOffs = pEndPos->nContent.GetIndex();
+/*N*/ /*?*/ InNodeRedline( pEndPos->nNode, nOffs, nSaveInsFirstPara );
+/*N*/ /*?*/ }
+/*N*/ /*?*/ else
+/*N*/ /*?*/ {
+/*N*/ /*?*/ SwNodeIndex aIdx( *pSttNd );
+/*N*/ /*?*/ INT32 nDummy = 0;
+/*N*/ /*?*/ InNodeRedline( aIdx, nDummy );
+/*N*/ /*?*/ }
+/*?*/ }
+/*?*/ break;
+/*?*/
+/*?*/ default:
+/*?*/ // MIB 15.4.97: Wenn wir diesen Record ueberspringen, dann
+/*?*/ // fuegen wir auch keinen Node ein. Dann sollten wir
+/*?*/ // vielleicht auch den Node-Zaehler wir eins runterzaehlen,
+/*?*/ // weil sonst doch das ein oder andere schiefgehen kann.
+/*?*/ i--;
+/*?*/ SkipRec();
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ CloseRec( SWG_CONTENTS );
+/*N*/ if( !IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ CloseNumRange40( rPos );
+/*N*/ pCurNumRange = pOld40Range;
+/*N*/ pCurNumRule = pOld40Rule;
+/*N*/ bConvertNoNum = bOldConvertNoNum;
+/*N*/ }
+/*N*/
+/*N*/ // MIB 8.9.97: Wenn man eine Section fuellt, sollte man eigentlich nie
+/*N*/ // auf einem End-Node stehen koennen, der nicht zur eigenen Section
+/*N*/ // gehoert. Fuer den Fall, dass man keine Section laed und trotzdem
+/*N*/ // auf einem End-Node steht, lassen wir den Code erstmal drinne, aber
+/*N*/ // es ist doc recht fraglich, wozu er da ist.
+/*N*/ SwEndNode *pEndNd = pDoc->GetNodes()[ rPos ]->GetEndNode();
+/*N*/ ASSERT( !pEndNd || !pSectSttNd || pEndNd->FindStartNode()==pSectSttNd,
+/*N*/ "PaM steht auf EndNode, der nicht zur Section gehoert." );
+/*N*/ if( pEndNd && !pSectSttNd &&
+/*N*/ pEndNd != &pDoc->GetNodes().GetEndOfContent())
+/*N*/ {
+/*N*/ rPos++;
+/*N*/ }
+/*N*/
+/*N*/ // Eine Tabelle und eine Section koennen u.U. alleine
+/*N*/ // in einer Textsection existieren, d.h. es muss ggf.
+/*N*/ // der ueberfluessige Node entfernt werden!
+/*N*/ if( pNd1 && !nRes )
+/*N*/ {
+/*?*/ SwNodeIndex aPos( *pNd1 );
+/*?*/ // MIB 8.9.97: Mit dieser Abrage wird sichergestellt, dass beim
+/*?*/ // Einfuegen nie der Absatz geloscht wird, in den eingefuegt wird.
+/*?*/ if( !pCurPaM ||
+/*?*/ pCurPaM->GetPoint()->nNode != aPos )
+/*?*/ {
+/*?*/ pDoc->GetNodes().Delete( aPos );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Die aktuelle Position ggf. hinter die Section stellen,
+/*N*/ // die gerade eingelesen wurde.
+/*N*/ if( pSectSttNd )
+/*N*/ rPos = pSectSttNd->EndOfSectionIndex() + 1;
+/*N*/
+/*N*/ delete pEndPos;
+/*N*/ }
+
+// Einfuegen einer nicht vorhandenen Contents-Section. Die Section
+// wird am Textende eingefuegt und der numerische Index des StartNodes
+// zurueckgeliefert.
+
+/*N*/ SwStartNode& Sw3IoImp::InContents()
+/*N*/ {
+/*N*/ // Anlegen einer Section mit einem TextNode
+/*N*/ #if 0
+/*N*/ SwStartNode* pSttNd = pDoc->GetNodes().MakeTextSection(
+/*N*/ pDoc->GetNodes().EndOfAutotext,
+/*N*/ (SwStartNodeType)eStartNodeType,
+/*N*/ (SwTxtFmtColl*) pDoc->GetDfltTxtFmtColl() );
+/*N*/ SwIndex aStart( pSttNd->GetMyIndex() );
+/*N*/ InContents( aStart );
+/*N*/ #endif
+/*N*/ // OPT: Section leer anlegen
+/*N*/ SwNodeIndex aStart( pDoc->GetNodes().GetEndOfAutotext() );
+/*N*/ SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection( aStart,
+/*N*/ (SwStartNodeType)eStartNodeType );
+/*N*/ aStart = *pSttNd->EndOfSectionNode();
+/*N*/
+/*N*/ InContents( aStart, 0, FALSE );
+/*N*/ // /OPT: Section leer anlegen
+/*N*/
+/*N*/ return *pSttNd;
+/*N*/ }
+
+// Einen Basis-Contents-Bereich des Dokuments ausgeben
+
+// Der PaM zeigt (was er ja muss) immer auf einen Cntnt-Node. Somit
+// muss noch getestet werden, ob dieser am Tabellenanfang liegt. In
+// diesem Fall wird die Tabelle ausgegeben. Auch, wenn am Anfang eine
+// Section liegt, muss dies gesondert behandelt werden!
+
+/*N*/ void Sw3IoImp::OutContents( SwPaM* pPaM )
+/*N*/ {
+/*N*/ // Gespeichert wird immer von Point bis Mark
+/*N*/ if( *pPaM->GetPoint() > *pPaM->GetMark() )
+/*N*/ pPaM->Exchange();
+/*N*/ // gebe alle Bereiche des Pams in das File aus.
+/*N*/ ULONG nCurNode = pPaM->GetPoint()->nNode.GetIndex();
+/*N*/ ULONG nEndNode = pPaM->GetMark()->nNode.GetIndex();
+/*N*/ xub_StrLen nCurPos = pPaM->GetPoint()->nContent.GetIndex();
+/*N*/ xub_StrLen nEndPos = STRING_LEN;
+/*N*/ SwNode* pNd1 = pDoc->GetNodes()[ nCurNode ];
+/*N*/
+/*N*/ // Is the node contained in a table?
+/*N*/ const SwTableNode* pTbl = pNd1->FindTableNode();
+/*N*/ if( pTbl )
+/*N*/ nCurNode = pTbl->GetIndex();
+/*N*/
+/*N*/ // Step out of sections, in fact to the start node of the first
+/*N*/ // section.
+/*N*/ // #67503#: This must be done if the first text node is contained in
+/*N*/ // a table, too.
+/*N*/ do
+/*N*/ {
+/*N*/ pNd1 = pDoc->GetNodes()[ --nCurNode ]->GetSectionNode();
+/*N*/ } while( pNd1 );
+/*N*/ nCurNode++;
+/*N*/
+/*N*/ // Dieses OutContents schreibt den Top-Level
+/*N*/ OutContents( nCurNode, nEndNode, nCurPos, nEndPos, TRUE );
+/*N*/ }
+
+// Ausgabe einer kompletten Contents-Section
+// Der uebergebene Index zeigt auf den StartNode
+
+/*N*/ void Sw3IoImp::OutContents( const SwNodeIndex& rStart )
+/*N*/ {
+/*N*/ // Der Index zeigt auf den Start-Node, also muessen wir einen
+/*N*/ // bauen, der auf den naechsten Node zeigt
+/*N*/ SwStartNode* pStt = pDoc->GetNodes()[ rStart ]->GetStartNode();
+/*N*/ ASSERT( pStt, "StartNode nicht gefunden" );
+/*N*/ if( pStt )
+/*N*/ {
+/*N*/ // Hole vom Node und vom letzten Node die Position in der Section
+/*N*/ ULONG nStt = rStart.GetIndex();
+/*N*/ ULONG nEnd = pStt->EndOfSectionIndex()-1;
+/*N*/ // kein Bereich also kein gueltiger Node
+/*N*/ if( nStt <= nEnd )
+/*N*/ OutContents( nStt, nEnd, 0, STRING_LEN );
+/*N*/ }
+/*N*/ }
+
+// Besitzt ein Text-Knoten Markierungen oder FlyFrames?
+/*N*/ BOOL lcl_sw3sectn_NodeHasFlyOrMark( Sw3IoImp& rIo, ULONG nIdx )
+/*N*/ {
+/*N*/ USHORT nPos;
+/*N*/
+/*N*/ if( rIo.pMarks )
+/*N*/ for( nPos = 0; nPos < rIo.pMarks->Count(); ++nPos )
+/*N*/ {
+/*N*/ const Sw3Mark *pMark = (*rIo.pMarks)[ nPos ];
+/*N*/ if( pMark->GetNodePos() == nIdx )
+/*N*/ return TRUE;
+/*N*/ else if( pMark->GetNodePos() > nIdx )
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( rIo.pFlyFrms )
+/*N*/ for( nPos = 0; nPos < rIo.pFlyFrms->Count(); nPos++ )
+/*N*/ {
+/*N*/ ULONG nIdFly = (*rIo.pFlyFrms)[nPos]->GetNdIndex().GetIndex();
+/*N*/ if( nIdFly == nIdx )
+/*N*/ return TRUE;
+/*N*/ else if( nIdFly > nIdx )
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ return FALSE;
+/*N*/ }
+
+
+// Ausgabe eines fest definierten Doc-Bereichs.
+// Der Offset wird beim ersten TextNode angewandt.
+
+/*N*/ void Sw3IoImp::OutContents
+/*N*/ ( ULONG nCurNode, ULONG nEndNode, xub_StrLen nCurPos, xub_StrLen nEndPos,
+/*N*/ BOOL bTopLevel )
+/*N*/ {
+/*N*/ // Die aktuelle NumRuke muss gerettet werden, falls ein 3.1/40-Export
+/*N*/ // stattfindet und eine Sectioninnerhalb einer Section geschrieben
+/*N*/ // wird (z.B. Flys)
+/*N*/ SwNumRule* pOld40Rule;
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ pOld40Rule = pCurNumRule;
+/*N*/ pCurNumRule = NULL;
+/*N*/ }
+/*N*/
+/*N*/ BOOL bOldExportFlyFrmFmt;
+/*N*/ const SwFlyFrm* pOldExportFlyFrm;
+/*N*/ if( pExportInfo )
+/*N*/ {
+/*N*/ bOldExportFlyFrmFmt = pExportInfo->bFlyFrmFmt;
+/*N*/ pOldExportFlyFrm = pExportInfo->pFlyFrm;
+/*N*/ pExportInfo->bFlyFrmFmt = FALSE;
+/*N*/ pExportInfo->pFlyFrm = NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwStartNode* pStt = pDoc->GetNodes()[ nCurNode ]->GetStartNode();
+/*N*/ if( pStt && pStt->GetNodeType() == ND_STARTNODE )
+/*N*/ nCurNode++; // StartNode nicht speichern, TblNode/SectionNode wohl
+/*N*/ else
+/*N*/ pStt = pDoc->GetNodes()[ nCurNode ]->FindStartNode();
+/*N*/ OpenRec( SWG_CONTENTS );
+/*N*/ *pStrm << (BYTE) 0x04; // 4 Byte Daten, aber unterschiedliche
+/*N*/
+/*N*/ ULONG nNodes = 0;
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ *pStrm << (UINT16) IDX_NO_VALUE; // war mal Section-Id (siehe Tbl)
+/*N*/ OpenValuePos16( (UINT16)nNodes );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ OpenValuePos32( nNodes );
+/*N*/ }
+/*N*/
+/*N*/ nNodes = OutNodes( nCurNode, nEndNode, nCurPos, nEndPos, bTopLevel );
+/*N*/
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ CloseValuePos16( (UINT16)nNodes );
+/*N*/ else
+/*N*/ CloseValuePos32( nNodes );
+/*N*/
+/*N*/ // Jetzt noch an den Start-Node der Section (Rahmen)gebundenen
+/*N*/ // Rahmen und Redlines rausschreiben.
+/*N*/ if( !IsSw31Or40Export() )
+/*N*/ {
+/*N*/ OutNodeFlyFrames( pStt->GetIndex() );
+/*N*/ OutNodeRedlines( pStt->GetIndex() );
+/*N*/ OutNodeRedlines( pStt->EndOfSectionIndex() );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ CloseRec( SWG_CONTENTS );
+/*N*/
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ pCurNumRule = pOld40Rule;
+/*N*/
+/*N*/ if( pExportInfo )
+/*N*/ {
+/*N*/ pExportInfo->bFlyFrmFmt = bOldExportFlyFrmFmt;
+/*N*/ pExportInfo->pFlyFrm = pOldExportFlyFrm;
+/*N*/ }
+/*N*/ }
+
+/*N*/ ULONG Sw3IoImp::OutNodes( ULONG nCurNode, ULONG nEndNode,
+/*N*/ xub_StrLen nCurPos, xub_StrLen nEndPos,
+/*N*/ BOOL bTopLevel )
+/*N*/ {
+/*N*/ ULONG nNodes = 0;
+/*N*/
+/*N*/ ULONG nWords, nChars;
+/*N*/ ULONG nRepNodesToWrite = 0;
+/*N*/ SwTxtNode *pLastNode = NULL;
+/*N*/ BOOL bFirstNode = bTopLevel;
+/*N*/
+/*N*/ while( nCurNode <= nEndNode && Good() )
+/*N*/ {
+/*N*/ SetPercentBar( nCurNode );
+/*N*/ SwNode* pNd = pDoc->GetNodes()[ nCurNode ];
+/*N*/
+/*N*/ BYTE nNodeType = pNd->GetNodeType();
+/*N*/
+/*N*/ if( nNodeType==ND_TEXTNODE )
+/*N*/ {
+/*N*/ // Ist der Knoten einer Wiederholung des vorherigen?
+/*N*/ // NIE(!!!) wenn dies der letzte zu speichernde Knoten des
+/*N*/ // Top-Levels ist, weil dies beim Einfuegen des Doks Probleme
+/*N*/ // bereiten kann.
+/*N*/ SwTxtNode *pTxtNd = pNd->GetTxtNode();
+/*N*/ if( pLastNode &&
+/*N*/ (!bTopLevel || nCurNode!=nEndNode) &&
+/*N*/ pLastNode->GetFmtColl() == pTxtNd->GetFmtColl() &&
+/*N*/ pLastNode->GetCondFmtColl() == pTxtNd->GetCondFmtColl() &&
+/*N*/ ( ( 0 == pLastNode->GetNum() &&
+/*N*/ 0 == pTxtNd->GetNum() ) ||
+/*N*/ ( pLastNode->GetNum() && pTxtNd->GetNum() &&
+/*N*/ ( pLastNode->GetNum()->GetLevel() ==
+/*N*/ pTxtNd->GetNum()->GetLevel() ) ) ) &&
+/*N*/ !pTxtNd->HasHints() &&
+/*N*/ !pTxtNd->GetpSwAttrSet() &&
+/*N*/ pLastNode->GetTxt().Len() == pTxtNd->GetTxt().Len() &&
+/*N*/ pLastNode->GetTxt() == pTxtNd->GetTxt() &&
+/*N*/ !lcl_sw3sectn_NodeHasFlyOrMark( *this, nCurNode ) )
+/*N*/ {
+/*N*/ nRepNodesToWrite++;
+/*N*/ nCurNode++;
+/*N*/ continue;
+/*N*/ }
+/*N*/ // Den ersten Knoeten des Top-Levels duerfen wir nie als
+/*N*/ // Ausgangsbasis einer Wiederholung benutzen, sonst gibt's beim
+/*N*/ // Einfuegen des Doks in ein anderes Probleme, weil der
+/*N*/ // Knoten kopiert wird.
+/*N*/ if( !bFirstNode &&
+/*N*/ !pTxtNd->HasHints() &&
+/*N*/ !pTxtNd->GetpSwAttrSet() &&
+/*N*/ !lcl_sw3sectn_NodeHasFlyOrMark( *this, nCurNode ) )
+/*N*/ pLastNode = pTxtNd;
+/*N*/ else
+/*N*/ pLastNode = NULL;
+/*N*/ }
+/*N*/ else
+/*N*/ pLastNode = NULL;
+/*N*/
+/*N*/ bFirstNode = FALSE;
+/*N*/
+/*N*/ if( nRepNodesToWrite>0 )
+/*N*/ {
+/*N*/ OutRepTxtNode( nRepNodesToWrite );
+/*N*/ aStat.nPara += nRepNodesToWrite;
+/*N*/ aStat.nWord += nRepNodesToWrite*(aStat.nWord-nWords);
+/*N*/ aStat.nChar += nRepNodesToWrite*(aStat.nChar-nChars);
+/*N*/ nRepNodesToWrite = 0;
+/*N*/ nNodes++;
+/*N*/ }
+/*N*/
+/*N*/ switch( (int)nNodeType )
+/*N*/ {
+/*N*/ case ND_SECTIONNODE:
+/*N*/ nNodes += OutSection( *pNd->GetSectionNode() );
+/*N*/ nCurNode = pNd->GetSectionNode()->EndOfSectionIndex() + 1;
+/*N*/ break;
+/*N*/ case ND_TABLENODE:
+/*N*/ OutTable( *pNd->GetTableNode() );
+/*N*/ nCurNode = pNd->GetTableNode()->EndOfSectionIndex() + 1;
+/*N*/ break;
+/*N*/ case ND_TEXTNODE:
+/*N*/ nWords = aStat.nWord;
+/*N*/ nChars = aStat.nChar;
+/*N*/ OutTxtNode( *pNd->GetTxtNode(), nCurPos, nEndPos, nCurNode );
+/*N*/ nCurPos = 0; nCurNode++;
+/*N*/ break;
+/*N*/ case ND_GRFNODE:
+/*N*/ OutGrfNode( *pNd->GetNoTxtNode() );
+/*N*/ nCurPos = 0; nCurNode++;
+/*N*/ break;
+/*N*/ case ND_OLENODE:
+/*N*/ OutOLENode( *pNd->GetNoTxtNode() );
+/*N*/ nCurPos = 0; nCurNode++;
+/*N*/ break;
+/*?*/ case ND_ENDNODE:
+/*?*/ // Das kann der Teil einer Section sein,
+/*?*/ // kann einfach ignoriert werden
+/*?*/ nNodes--; nCurNode++; break;
+/*?*/ default:
+/*?*/ ASSERT( !this, "Node kann nicht gespeichert werden" );
+/*?*/ Error( ERR_SWG_WRITE_ERROR );
+/*?*/ nCurNode = nEndNode;
+/*N*/ }
+/*N*/ nNodes++;
+/*N*/ }
+/*N*/
+/*N*/ // falls der letzte Knoten eine Wiederholung ist:
+/*N*/ if( nRepNodesToWrite>0 && Good() )
+/*N*/ {
+/*?*/ OutRepTxtNode( nRepNodesToWrite );
+/*?*/ aStat.nPara += nRepNodesToWrite;
+/*?*/ aStat.nWord += nRepNodesToWrite*(aStat.nWord-nWords);
+/*?*/ aStat.nChar += nRepNodesToWrite*(aStat.nChar-nChars);
+/*?*/ nRepNodesToWrite = 0;
+/*?*/ nNodes++;
+/*N*/ }
+/*N*/
+/*N*/ return nNodes;
+/*N*/ }
+
+// Einlesen einer "echten" Section innerhalb eines Content-Bereichs
+// Auch hier wird der uebergebene Index weitergefuehrt.
+
+/*N*/ void Sw3IoImp::InSection( SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ OpenRec( SWG_SECTION );
+/*N*/ String aName, aCond;
+/*N*/ InString( *pStrm, aName );
+/*N*/ InString( *pStrm, aCond );
+/*N*/ // 0x10 - hidden
+/*N*/ // 0x20 - protected
+/*N*/ // 0x40 - !conditional hidden (gedreht, fuers Einlesen von alten Docs)
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ UINT16 nType;
+/*N*/ *pStrm >> nType;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ // beim Insert vom Doc einen eindeutigen Namen erzeugen
+/*N*/ if( bInsert )
+/*N*/ {
+/*?*/ aName = pDoc->GetUniqueSectionName( &aName );
+/*?*/ if( !pSectionDepths )
+/*?*/ pSectionDepths = new SvUShorts;
+/*?*/ if( 0 == pSectionDepths->Count() )
+/*?*/ {
+/*?*/ pSectionDepths->Insert( 1U, 0U );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ (*pSectionDepths)[pSectionDepths->Count()-1]++;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ SwSection aSect( (SectionType) nType, aName );
+/*N*/ SwSectionFmt* pFmt = (SwSectionFmt*) InFormat( SWG_SECTFMT, NULL );
+/*N*/ ULONG n = rPos.GetIndex();
+/*N*/
+/*N*/ SwNodeIndex aTmpIdx( pDoc->GetNodes().GetEndOfContent() );
+/*N*/ SwSectionNode* pSectNd =
+/*N*/ pDoc->GetNodes().InsertSection( rPos, *pFmt, aSect, &aTmpIdx, FALSE );
+/*N*/
+/*N*/ SwSection& rNdSection = pSectNd->GetSection();
+/*N*/
+/*N*/ rPos = n;
+/*N*/ InContents( rPos );
+/*N*/
+/*N*/ // Link-Filenamen einlesen
+/*N*/ if( nVersion >= SWG_FLYWRAPCHGD )
+/*N*/ {
+/*N*/ String aLinkFileName;
+/*N*/ ByteString s8;
+/*N*/
+/*N*/ pStrm->ReadByteString( s8 );
+/*N*/ aLinkFileName = ConvertStringNoDelim( s8, '\xff', ::binfilter::cTokenSeperator,
+/*N*/ eSrcSet );
+/*N*/
+/*N*/ if( aLinkFileName.Len() && FILE_LINK_SECTION == nType )
+/*N*/ {
+/*N*/ xub_StrLen nTokenPos = aLinkFileName.Search( ::binfilter::cTokenSeperator );
+/*N*/ if( STRING_NOTFOUND != nTokenPos && nTokenPos )
+/*N*/ {
+/*N*/ String sURL( aLinkFileName.Copy( 0, nTokenPos ) );
+/*N*/ aLinkFileName.Erase( 0, nTokenPos );
+/*N*/ aLinkFileName.Insert( ::binfilter::StaticBaseUrl::SmartRelToAbs( sURL ), 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ rNdSection.SetLinkFileName( aLinkFileName );
+/*N*/ }
+/*N*/
+/*N*/ rNdSection.SetCondition( aCond );
+/*N*/ if( cFlags & 0x10 )
+/*?*/ rNdSection.SetHidden();
+/*N*/ if( cFlags & 0x20 )
+/*N*/ rNdSection.SetProtect();
+/*N*/ if( cFlags & 0x40 )
+/*?*/ rNdSection.SetCondHidden( FALSE );
+/*N*/ if( cFlags & 0x80 )
+/*?*/ rNdSection.SetConnectFlag( FALSE );
+/*N*/
+/*N*/ // ggf. Link neu verbinden aber nicht updaten
+/*N*/ if( pSectNd->GetSection().IsLinkType() )
+/*N*/ pSectNd->GetSection().CreateLink( CREATE_CONNECT );
+/*N*/
+/*N*/ // create frames
+/*N*/ if( bInsert )
+/*N*/ {
+/*?*/ (*pSectionDepths)[pSectionDepths->Count()-1]--;
+/*?*/ if( 0 == (*pSectionDepths)[pSectionDepths->Count()-1] )
+/*?*/ {
+/*?*/ SwSectionFmt *pSFmt = rNdSection.GetFmt();
+/*?*/ pSFmt->DelFrms();
+/*?*/ pSFmt->MakeFrms();
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_SECTION );
+/*N*/ }
+
+/*N*/ BOOL lcl_sw3io_isTOXHeaderSection( const SwStartNode& rSttNd )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/
+/*N*/ const SwSectionNode *pSectNd = rSttNd.GetSectionNode();
+/*N*/ if( pSectNd &&
+/*N*/ TOX_HEADER_SECTION == pSectNd->GetSection().GetType() )
+/*N*/ {
+/*N*/ bRet = TRUE;
+/*N*/ }
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ ULONG Sw3IoImp::OutTOXSection( const SwSectionNode& rNd )
+/*N*/ {
+/*N*/ const SwSection& rSect = rNd.GetSection();
+/*N*/
+/*N*/ ASSERT( TOX_HEADER_SECTION == rSect.GetType() ||
+/*N*/ TOX_CONTENT_SECTION == rSect.GetType(),
+/*N*/ "Not a TOX section" );
+/*N*/
+/*N*/ ULONG nStt = rNd.GetIndex() + 1;
+/*N*/ ULONG nEnd = rNd.EndOfSectionIndex()-1;
+/*N*/
+/*N*/ if( nStt > nEnd )
+/*N*/ return 0;
+/*N*/
+/*N*/ ULONG nNodes = 0;
+/*N*/
+/*N*/ // If a tox content section starts with a start node or ends with
+/*N*/ // an end node that doesn't belong to a tox header section, an
+/*N*/ // additional text node has to be inserted.
+/*N*/
+/*N*/ // +-- tox c +-- tox c +-- tox c +-- tox c
+/*N*/ // *| text *|+- stt |+- tox h *|+- tox h
+/*N*/ // | || *|| text ||+ stt
+/*N*/ //
+/*N*/ // | || *|| text ||+ end
+/*N*/ // *| text *|+- end |+- tox h *|+- tox h
+/*N*/ // +-- tox c +-- tox c +-- tox c +-- tox c
+/*N*/ //
+/*N*/ // node before: no yes no yes
+/*N*/ // node behind: no yes no yes
+/*N*/ //
+/*N*/ // The * indicate the position of the tox marks
+/*N*/
+/*N*/ if( TOX_CONTENT_SECTION == rSect.GetType() )
+/*N*/ {
+/*N*/ const SwStartNode *pSttNd = pDoc->GetNodes()[nStt]->GetStartNode();
+/*N*/ if( pSttNd && ( !lcl_sw3io_isTOXHeaderSection( *pSttNd ) ||
+/*N*/ !pDoc->GetNodes()[nStt+1]->IsTxtNode() ) )
+/*N*/ {
+/*?*/ OutEmptyTxtNode( nStt, TRUE );
+/*?*/ nNodes++;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ nNodes += OutNodes( nStt, nEnd, 0, STRING_LEN, FALSE );
+/*N*/
+/*N*/ if( TOX_CONTENT_SECTION == rSect.GetType() )
+/*N*/ {
+/*N*/ const SwEndNode *pEndNd = pDoc->GetNodes()[nEnd]->GetEndNode();
+/*N*/ if( pEndNd &&
+/*N*/ ( !lcl_sw3io_isTOXHeaderSection(*pEndNd->StartOfSectionNode()) ||
+/*N*/ !pDoc->GetNodes()[nEnd-1]->IsTxtNode() ) )
+/*N*/ {
+/*?*/ OutEmptyTxtNode( nEnd, TRUE );
+/*?*/ nNodes++;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // The sections start node is counted by OutNodes, but it hasn't been
+/*N*/ // written. That for, the number of nodes must be reduced by one.
+/*N*/ ASSERT( nNodes > 0, "empty TOX section?" );
+/*N*/ return nNodes - 1;
+/*N*/ }
+
+/*N*/ ULONG Sw3IoImp::OutSection( const SwSectionNode& rNd )
+/*N*/ {
+/*N*/ const SwSection& rSect = rNd.GetSection();
+/*N*/
+/*N*/ if( TOX_HEADER_SECTION == rSect.GetType() ||
+/*N*/ TOX_CONTENT_SECTION == rSect.GetType() )
+/*N*/ {
+/*N*/ return OutTOXSection( rNd );
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_SECTION );
+/*N*/ OutString( *pStrm, rSect.GetName() );
+/*N*/ OutString( *pStrm, rSect.GetCondition() );
+/*N*/ // 0x02 - 2 Bytes Daten (Typ)
+/*N*/ // 0x10 - hidden
+/*N*/ // 0x20 - protected
+/*N*/ // 0x40 - !conditional hidden (gedreht, fuers Einlesen von alten Docs)
+/*N*/ BYTE cFlags = 0x02;
+/*N*/ if( rSect.IsHidden() )
+/*N*/ cFlags |= 0x10;
+/*N*/ if( rSect.IsProtect() )
+/*N*/ cFlags |= 0x20;
+/*N*/ if( !rSect.IsCondHidden() )
+/*N*/ cFlags |= 0x40;
+/*N*/ if( !rSect.IsConnectFlag() )
+/*N*/ cFlags |= 0x80;
+/*N*/ *pStrm << (BYTE) cFlags
+/*N*/ << (UINT16) rSect.GetType();
+/*N*/
+/*N*/ SwSectionFmt* pFmt = rSect.GetFmt();
+/*N*/ OutFormat( SWG_SECTFMT, *rSect.GetFmt() );
+/*N*/
+/*N*/ // Hier einen auf den StartNode draufzaehlen, sonst wird
+/*N*/ // der Bereich rekursiv gespeichert!
+/*N*/ ULONG nStt = rNd.GetIndex() + 1;
+/*N*/ ULONG nEnd = rNd.EndOfSectionIndex()-1;
+/*N*/ // kein Bereich also kein gueltiger Node
+/*N*/ if( nStt <= nEnd )
+/*N*/ {
+/*N*/ if( !IsSw31Export() &&
+/*N*/ pDoc->IsGlobalDoc() && !pDoc->IsGlblDocSaveLinks() &&
+/*N*/ pFmt->GetGlobalDocSection() )
+/*N*/ {
+/*N*/ // nur eine Section mit einem DummyTextNode speichern!
+/*N*/ OpenRec( SWG_CONTENTS );
+/*N*/ *pStrm << (BYTE) 0x04; // 4 Byte Daten
+/*N*/
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*?*/ *pStrm << (UINT16) IDX_NO_VALUE; // war mal Section-Id
+/*?*/ OpenValuePos16( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ OpenValuePos32( 0 );
+/*N*/ }
+/*N*/
+/*N*/ // leeren TextNode schreiben
+/*N*/ OutEmptyTxtNode();
+/*N*/
+/*N*/ if( IsSw31Or40Export() )
+/*?*/ CloseValuePos16( 1 );
+/*N*/ else
+/*N*/ CloseValuePos32( 1 );
+/*N*/
+/*N*/ CloseRec( SWG_CONTENTS );
+/*N*/ }
+/*N*/ else
+/*N*/ OutContents( nStt, nEnd, 0, STRING_LEN );
+/*N*/ }
+/*N*/ // Link-Filenamen schreiben
+/*N*/ String aLinkFileName( rSect.GetLinkFileName() );
+/*N*/ if( aLinkFileName.Len() && FILE_LINK_SECTION == rSect.GetType() )
+/*N*/ {
+/*N*/ xub_StrLen nTokenPos = aLinkFileName.Search( ::binfilter::cTokenSeperator );
+/*N*/ if( STRING_NOTFOUND != nTokenPos && nTokenPos )
+/*N*/ {
+/*N*/ String sURL( aLinkFileName.Copy( 0, nTokenPos ) );
+/*N*/ aLinkFileName.Erase( 0, nTokenPos );
+/*N*/ aLinkFileName.Insert( ::binfilter::StaticBaseUrl::AbsToRel( sURL ), 0 );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ ByteString s8 = ConvertStringNoDelim( aLinkFileName, ::binfilter::cTokenSeperator,
+/*N*/ '\xff', eSrcSet );
+/*N*/ pStrm->WriteByteString( s8 );
+/*N*/
+/*N*/ CloseRec( SWG_SECTION );
+/*N*/
+/*N*/ return 0;
+/*N*/ }
+
+// NEXT: sw3sectn_0a
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3style.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3style.cxx
new file mode 100644
index 000000000000..db9877288d9f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3style.cxx
@@ -0,0 +1,1257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// Diese Implementation geht davon aus, dass der Pool nur temporaer
+// verwendet wird, d.h. der ctor macht einen Snapshot der Vorlagen am Doc.
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "swerror.h"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "hintids.hxx" //Damit "unsere" Attribute angezogen werden.
+
+#include <bf_svx/fontitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+#include <bf_svtools/style.hxx>
+#include <bf_svtools/htmlkywd.hxx>
+
+
+#include <errhdl.hxx>
+
+#include <fmtcol.hxx>
+
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include "sw3imp.hxx"
+#include "poolfmt.hxx"
+#include "hints.hxx"
+#include "paratr.hxx"
+#include "frmatr.hxx"
+#include "numrule.hxx"
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+#define SWG_CONDSTYLES_BUG 1 //Versionsnummern fuer die StyleSheets
+#define SWG_CONDSTYLES 2 //Versionsnummern fuer die StyleSheets
+#define SWG_CHARFMTOFFSET 3 //Versionsnummern fuer die StyleSheets
+#define SWG_AUTOUPDATE_FLAG 4 // zusaetzliches Flag-Byte
+#define SWG_TEN_HEADLINES 5 // HTML-H6-Vorlage mappen
+#define SWG_NUM_RELSPACE 6 // Numerierung mit rel. Abstaenden
+
+#ifdef NUM_RELSPACE
+#define SWG_STYLE_VERSION (SWG_NUM_RELSPACE)
+#else
+#define SWG_STYLE_VERSION (SWG_TEN_HEADLINES)
+#endif
+
+///////////////////////////////////////////////////////////////////////////
+
+//FEATURE::CONDCOLL
+struct SwStyleCondColl
+{
+ UINT32 nCondition, nSubCondition;
+ String sColl;
+
+ SwStyleCondColl()
+ : nCondition( 0 ), nSubCondition( 0 )
+ {}
+ SwStyleCondColl( const String& rColl, UINT32 nCond, UINT32 nSubCond )
+ : nCondition( nCond ),
+ nSubCondition( nSubCond ),
+ sColl( rColl )
+ {}
+ SwStyleCondColl( const SwStyleCondColl& rCopy )
+ : nCondition( rCopy.nCondition ),
+ nSubCondition( rCopy.nSubCondition ),
+ sColl( rCopy.sColl )
+ {}
+};
+typedef SwStyleCondColl* SwStyleCondCollPtr;
+SV_DECL_PTRARR_DEL( SwStyleCondColls, SwStyleCondCollPtr, 0, 5 )//STRIP008 ;
+//FEATURE::CONDCOLL
+
+class SwStyleSheetPool;
+
+// Unsere Ableitungen der Klassen SfxStyleSheetBase und SfxStyleSheetBasePool
+
+class SwStyleSheet : public SfxStyleSheetBase {
+ friend class SwStyleSheetPool;
+ SfxItemSet aSet; // Set fuer Load/Store
+ SwDoc& rDoc; // Dokument
+ SwFmt* pFmt; // zugehoeriges Format
+ long nVersion; // Export: FF-Version
+ // Import: Vorlagen-Version
+ USHORT nId; // PoolId
+ BYTE nLevel; // Outline-Level
+ BYTE cFlags; // diverse Flags (0x01 == AutoUpdate)
+ BOOL bNew : 1; // TRUE: neu eingelesen/erzeugt
+ SwStyleCondColls* pCondColls; // != 0 -> CondColl - Tabelle der Conditions
+ SvxLRSpaceItem *pNumLRSpace; // Original-LRSpace-Item bei Kapitel-Num.
+private:
+ SwStyleSheet( const String&, SwStyleSheetPool&, SfxStyleFamily eFam,
+ USHORT nMask );
+ virtual SfxItemSet& GetItemSet();
+public:
+ virtual ~SwStyleSheet();
+ SwDoc& GetDoc() { return rDoc; }
+ SwFmt* GetFmt() { return pFmt; }
+ SwTxtFmtColl* GetColl();
+ BYTE GetNumLevel() const { return nLevel; }
+ void ConnectParent( const String& );
+ void ConnectFollow( const String& );
+ virtual void Load( SvStream&, USHORT );
+ virtual void Store( SvStream& );
+ virtual USHORT GetVersion() const;
+
+ // fuers Rename - Vorlagen muessen noch nicht im Pool umbenannt sein,
+ // die normale Set-Methoden suchen aber danach und setzen
+ // nur um, wenn sie die Vorlage gefunden haben.
+ void SetNewName( const String& rName ) { aName = rName; }
+ void SetNewParent( const String& rName ) { aParent = rName; }
+ void SetNewFollow( const String& rName ) { aFollow = rName; }
+};
+
+class SwStyleSheetPool : public SfxStyleSheetBasePool {
+ friend class SwStyleSheet;
+ SwDoc& rDoc; // Dokument
+ Sw3Fmts* pConvToSymbolFmts;
+ long nExpFFVersion; // FF-Version fuer Export
+ virtual SfxStyleSheetBase* Create( const String&, SfxStyleFamily, USHORT nMask);
+ void Add( const SwFmt& rFmt, SfxStyleFamily eFam );
+ void CopyFromDoc( BOOL bUsed );
+ void CopyToDoc( BOOL bOverwrite, USHORT eMask );
+ void Rename( const String&, const String&, SfxStyleFamily );
+ SwStyleSheet *FindByPoolId( USHORT nPoolId );
+public:
+ SwStyleSheetPool( SwDoc&, SfxItemPool&, long nFFVersion, Sw3Fmts *pConvFmts );
+ virtual ~SwStyleSheetPool();
+ BOOL Load( SvStream&, BOOL, USHORT eMask );
+ BOOL Store( SvStream&, BOOL );
+};
+
+
+
+
+/*N*/ SV_IMPL_PTRARR( SwStyleCondColls, SwStyleCondCollPtr )
+
+///////////////////////////////////////////////////////////////////////////
+// lokale Hilfsroutinen //
+///////////////////////////////////////////////////////////////////////////
+
+// Suche eines Formats anhand der Family-Bits
+
+/*N*/ SwFmt* lcl_sw3io__FindFmt( SwDoc& rDoc, const String& rName, USHORT nFamily )
+/*N*/ {
+/*N*/ if( nFamily & SFX_STYLE_FAMILY_PARA )
+/*N*/ return rDoc.FindTxtFmtCollByName( rName );
+/*N*/ else if( nFamily & SFX_STYLE_FAMILY_FRAME )
+/*N*/ return rDoc.FindFrmFmtByName( rName );
+/*N*/ else if( nFamily & SFX_STYLE_FAMILY_CHAR )
+/*N*/ return rDoc.FindCharFmtByName( rName );
+/*N*/
+/*N*/ DBG_ASSERT( nFamily || !nFamily, "Unbekannte Style-Familie" );
+/*N*/ return NULL;
+/*N*/ }
+
+////////////////////////////////////////////////////////////////////////////
+
+/*N*/ SwStyleSheet::SwStyleSheet( const String& rName, SwStyleSheetPool& rPool,
+/*N*/ SfxStyleFamily eFam, USHORT nMask )
+/*N*/ : SfxStyleSheetBase( rName, rPool, eFam, nMask ),
+/*N*/ rDoc( rPool.rDoc ), aSet( rPool.rPool,
+/*N*/ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+/*N*/ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+/*N*/ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+/*N*/ 0 ),
+/*N*/ cFlags( 0 ),
+/*N*/ pCondColls( 0 ),
+/*N*/ pNumLRSpace( 0 )
+/*N*/ {
+/*N*/ nId = 0xFFFF;
+/*N*/ nHelpId = UCHAR_MAX;
+/*N*/ nLevel = NO_NUMBERING;
+/*N*/ pFmt = NULL;
+/*N*/ bNew = FALSE;
+/*N*/ nVersion = 0;
+/*N*/ }
+
+/*N*/ __EXPORT SwStyleSheet::~SwStyleSheet()
+/*N*/ {
+/*N*/ // wird von SFX-DLL gerufen!
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ delete pCondColls;
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ delete pNumLRSpace;
+/*N*/ }
+
+/*N*/ SwTxtFmtColl* SwStyleSheet::GetColl()
+/*N*/ {
+/*N*/ return ( nFamily & SFX_STYLE_FAMILY_PARA )
+/*N*/ ? (SwTxtFmtColl*) pFmt : NULL;
+/*N*/ }
+
+
+/*N*/ void __EXPORT SwStyleSheet::Load( SvStream& r, USHORT nVer )
+/*N*/ {
+/*N*/ nVersion = nVer; // Version wird noch gebraucht
+/*N*/
+/*N*/ r >> nId >> nLevel;
+/*N*/
+/*N*/ // Numerierungs-Ebende weglassen, wenn sie nicht unterstuetzt wird
+/*N*/ if( nLevel != NO_NUMBERING && GetRealLevel(nLevel) >= MAXLEVEL )
+/*N*/ nLevel = NO_NUMBERING;
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ if( SWG_CONDSTYLES_BUG <= nVer )
+/*N*/ {
+/*N*/ //JP 31.10.96: Bug vom TemplateDialog beheben. Es wurde eine falsche
+/*N*/ // PoolId (1) fuer die Textkoerpervorlage verwendet
+/*N*/ if( SWG_CONDSTYLES_BUG == nVer && SFX_STYLE_FAMILY_PARA == nFamily
+/*N*/ && 1 == nId )
+/*N*/ {
+/*N*/ nId = RES_POOLCOLL_TEXT;
+/*N*/ }
+/*N*/
+/*N*/ // ConditionStyleSheets ??
+/*N*/ UINT16 nTmp;
+/*N*/ r >> nTmp;
+/*N*/ if( 1 == nTmp )
+/*N*/ {
+/*N*/ r >> nTmp; // Anzahl:
+/*N*/ pCondColls = new SwStyleCondColls( nTmp < 255 ? nTmp : 255, 5 );
+/*N*/ for( USHORT n = 0; n < nTmp; ++n )
+/*N*/ {
+/*?*/ SwStyleCondColl* pNew = new SwStyleCondColl;
+/*?*/ r.ReadByteString( pNew->sColl, r.GetStreamCharSet() );
+/*?*/ r >> pNew->nCondition;
+/*?*/
+/*?*/ if( USRFLD_EXPRESSION & pNew->nCondition )
+/*?*/ {
+/*?*/ ASSERT( !this, "noch nicht implementiert" );
+/*?*/ String s;
+/*?*/ r.ReadByteString( s, r.GetStreamCharSet() );
+/*?*/ }
+/*?*/ else
+/*?*/ r >> pNew->nSubCondition;
+/*?*/ pCondColls->Insert( pNew, n );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ // Zusaetzliches Flag-Byte laden
+/*N*/ if( SWG_AUTOUPDATE_FLAG <= nVer )
+/*N*/ {
+/*N*/ r >> cFlags;
+/*N*/ }
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( SWG_NUM_RELSPACE >= nVer && (cFlags & 0x02) != 0 )
+/*N*/ {
+/*N*/ UINT32 nLen;
+/*N*/ r >> nLen;
+/*N*/ if( nLen > 0 )
+/*N*/ {
+/*?*/ ULONG nPos = r.Tell();
+/*?*/ UINT16 nIVer;
+/*?*/ r >> nIVer;
+/*?*/ const SfxPoolItem& rDflt =
+/*?*/ GetItemSet().GetPool()->GetDefaultItem( RES_LR_SPACE );
+/*?*/ SfxPoolItem *pItem = rDflt.Create( r, nIVer );
+/*?*/ GetItemSet().Put( *pItem );
+/*?*/ delete pItem;
+/*?*/ nPos += nLen;
+/*?*/ if( r.Tell() != nPos )
+/*?*/ r.Seek( nPos );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ GetItemSet().ClearItem( RES_LR_SPACE );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ // JP 11.12.96: die Zeichenvorlagen wurden um die HTML-Vorlagen erweitert,
+/*N*/ // aber ohne ein wenig Platz zu lassen. Das wurde spaeter nachgepflegt.
+/*N*/ if( SWG_CONDSTYLES == nVer && SFX_STYLE_FAMILY_CHAR == nFamily &&
+/*N*/ RES_POOLCHR_JUMPEDIT < nId )
+/*N*/ {
+/*N*/ // dann den akt. Offset drauf addieren
+/*N*/ nId = RES_POOLCHR_HTML_BEGIN + ( nId - RES_POOLCHR_JUMPEDIT ) - 1;
+/*N*/ }
+/*N*/ // In der 5.0 gibt es 10 Ueberschrift-Vorlagen. Die alte HTML-H6-Vorlage
+/*N*/ // wird deshalb auf die neue Ueberschrift 6 gemappt.
+/*N*/ if( SWG_TEN_HEADLINES > nVer )
+/*N*/ nId = Sw3StringPool::ConvertFromOldPoolId( nId, SWG_LONGIDX );
+/*N*/ }
+
+/*N*/ void __EXPORT SwStyleSheet::Store( SvStream& r )
+/*N*/ {
+/*N*/ ASSERT( nVersion == r.GetVersion(),
+/*N*/ "SwStyleSheet::Store: FF-Version != Stream-FF-Version" );
+/*N*/
+/*N*/ r << nId;
+/*N*/ if( r.GetVersion() <= SOFFICE_FILEFORMAT_40 &&
+/*N*/ nLevel != NO_NUMBERING && nLevel >= OLD_MAXLEVEL )
+/*N*/ {
+/*N*/ nLevel = NO_NUMBERING;
+/*N*/ }
+/*N*/ r << nLevel;
+/*N*/
+/*N*/ if( nVersion > SOFFICE_FILEFORMAT_31 )
+/*N*/ {
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ UINT16 nType = RES_CONDTXTFMTCOLL == pFmt->Which() ? 1 : 0;
+/*N*/ r << nType;
+/*N*/ if( nType )
+/*N*/ {
+/*N*/ // Tabelle der ConditionTypes und der Vorlagen ausgeben:
+/*N*/ const SwFmtCollConditions& rCColls = ((SwConditionTxtFmtColl*)pFmt)->
+/*N*/ GetCondColls();
+/*N*/ r << (UINT16)rCColls.Count();
+/*N*/ for( USHORT n = 0; n < rCColls.Count(); ++n )
+/*N*/ {
+/*?*/ const SwCollCondition& rCColl = *rCColls[ n ];
+/*?*/ r.WriteByteString( rCColl.GetTxtFmtColl()->GetName(),
+/*?*/ r.GetStreamCharSet() );
+/*?*/ r << (UINT32) rCColl.GetCondition();
+/*?*/
+/*?*/ if( USRFLD_EXPRESSION & rCColl.GetCondition() )
+/*?*/ {
+/*?*/ String s( *rCColl.GetFldExpression() );
+/*?*/ r.WriteByteString( s, r.GetStreamCharSet() );
+/*?*/ }
+/*?*/ else
+/*?*/ r << (UINT32) rCColl.GetSubCondition();
+/*N*/ }
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/
+/*N*/ // zusaetzliches Flag-Byte speichern
+/*N*/ r << cFlags;
+/*N*/
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( nVersion > SOFFICE_FILEFORMAT_40 && (cFlags & 0x02) != 0 )
+/*N*/ {
+/*N*/ r << (UINT32)0;
+/*N*/ if( pNumLRSpace )
+/*N*/ {
+/*?*/ USHORT nIVer = pNumLRSpace->GetVersion( (USHORT)nVersion );
+/*?*/ if( nIVer != USHRT_MAX )
+/*?*/ {
+/*?*/ ULONG nPos = r.Tell();
+/*?*/ r << (UINT16)nIVer;
+/*?*/ pNumLRSpace->Store( r, nIVer );
+/*?*/
+/*?*/ ULONG nNewPos = r.Tell();
+/*?*/ r.Seek( nPos-4UL );
+/*?*/ r << (UINT32)(nNewPos - nPos);
+/*?*/ r.Seek( nNewPos );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+
+//FEATURE::CONDCOLL
+/*N*/ USHORT __EXPORT SwStyleSheet::GetVersion() const
+/*N*/ {
+/*N*/ ASSERT( nVersion,
+/*N*/ "SwStyleSheet::GetVersion: Fileformat-Version nicht gesetzt" );
+/*N*/ switch( nVersion )
+/*N*/ {
+/*N*/ case SOFFICE_FILEFORMAT_31:
+/*N*/ return 0;
+/*N*/ case SOFFICE_FILEFORMAT_40:
+/*N*/ return SWG_AUTOUPDATE_FLAG;
+/*N*/ }
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ return SWG_NUM_RELSPACE;
+/*N*/ #else
+/*N*/ return SWG_TEN_HEADLINES;
+/*N*/ #endif
+/*N*/ }
+//FEATURE::CONDCOLL
+
+/*N*/ SfxItemSet& __EXPORT SwStyleSheet::GetItemSet()
+/*N*/ {
+/*N*/ return aSet;
+/*N*/ }
+
+// Setzen des Parents: Wenn kein Parent angegeben ist, wird der Default
+// gesetzt
+
+/*N*/ void SwStyleSheet::ConnectParent( const String& rName )
+/*N*/ {
+/*N*/ SwFmt* pParent = NULL;
+/*N*/ if( rName.Len() )
+/*N*/ pParent = lcl_sw3io__FindFmt( rDoc, rName, nFamily );
+/*N*/ else switch( nFamily )
+/*N*/ {
+/*N*/ case SFX_STYLE_FAMILY_CHAR:
+/*N*/ pParent = (*rDoc.GetCharFmts())[ 0 ]; break;
+/*N*/ case SFX_STYLE_FAMILY_FRAME:
+/*N*/ pParent = (*rDoc.GetFrmFmts())[ 0 ]; break;
+/*N*/ case SFX_STYLE_FAMILY_PARA:
+/*N*/ pParent = (*rDoc.GetTxtFmtColls())[ 0 ]; break;
+/*N*/ }
+/*N*/ if( pParent )
+/*N*/ pFmt->SetDerivedFrom( pParent );
+/*N*/ else
+/*N*/ ASSERT( !this, "Parent nicht gefunden" );
+/*N*/ }
+
+// Setzen des Follows
+
+/*N*/ void SwStyleSheet::ConnectFollow( const String& rName )
+/*N*/ {
+/*N*/ if( nFamily == SFX_STYLE_FAMILY_PARA )
+/*N*/ {
+/*N*/ SwTxtFmtColl* pFollow;
+/*N*/ if( rName.Len() )
+/*N*/ pFollow = rDoc.FindTxtFmtCollByName( rName );
+/*N*/ else
+/*?*/ pFollow = rDoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+/*N*/ if( pFollow )
+/*N*/ GetColl()->SetNextTxtFmtColl( *pFollow );
+/*N*/ else
+/*N*/ ASSERT( !this, "Follow nicht gefunden" );
+/*N*/ }
+/*N*/ }
+
+////////////////////////////////////////////////////////////////////////////
+
+// der nachfolgende ctor ist potentiell crashgefaehrlich, da die
+// Sfx-Implementation den Pool als Referenz haelt.
+
+/*N*/ SwStyleSheetPool::SwStyleSheetPool( SwDoc& r, SfxItemPool& rp, long nFFVersion,
+/*N*/ Sw3Fmts *pConvFmts )
+/*N*/ : SfxStyleSheetBasePool( rp ), rDoc( r ),
+/*N*/ nExpFFVersion( nFFVersion ),
+/*N*/ pConvToSymbolFmts( pConvFmts )
+/*N*/ {}
+
+/*N*/ __EXPORT SwStyleSheetPool::~SwStyleSheetPool()
+/*N*/ {
+/*N*/ // wird von SFX-DLL gerufen!
+/*N*/ }
+
+// Laden und Speichern eines Pools
+
+/*N*/ BOOL SwStyleSheetPool::Load( SvStream& s, BOOL bOverWrite, USHORT eMask )
+/*N*/ {
+/*N*/ // Der Stream koennte auch leer sein, wenn eine neue Textbausteindatei
+/*N*/ // eingelesen wird.
+/*N*/ BOOL bRes = TRUE;
+/*N*/ USHORT n;
+/*N*/ s.Seek( 0L );
+/*N*/ s >> n;
+/*N*/ if( s.GetError() != SVSTREAM_OK )
+/*N*/ bRes = FALSE;
+/*N*/ if( !s.IsEof() )
+/*N*/ {
+/*N*/ s.Seek( 0L );
+/*N*/ rPool.Load( s );
+/*N*/ if( s.GetError() != SVSTREAM_OK )
+/*N*/ bRes = FALSE;
+/*N*/ bRes = SfxStyleSheetBasePool::Load( s );
+/*N*/ SetSearchMask( SFX_STYLE_FAMILY_ALL );
+/*N*/ if( bRes )
+/*N*/ CopyToDoc( bOverWrite, eMask );
+/*N*/ }
+/*N*/ return bRes;
+/*N*/ }
+
+const int RES_POOLCOLL_HTML_LISTING_40_USER = 0x3002 | USER_FMT;
+const int RES_POOLCOLL_HTML_XMP_40_USER = 0x3003 | USER_FMT;
+
+/*N*/ BOOL SwStyleSheetPool::Store( SvStream& s, BOOL bUsed )
+/*N*/ {
+/*N*/ ASSERT( nExpFFVersion == s.GetVersion(),
+/*N*/ "SwStyleSheetPool::Store: FF-Version != Stream-FF-Version" );
+/*N*/
+/*N*/ CopyFromDoc( bUsed );
+/*N*/ SetSearchMask( SFX_STYLE_FAMILY_ALL );
+/*N*/
+/*N*/ rPool.SetFileFormatVersion( (USHORT)nExpFFVersion );
+/*N*/
+/*N*/ //JP 11.06.97: laut ChangesMail muss das vorm Speichern gesetzt werden.
+/*N*/ if( SOFFICE_FILEFORMAT_31 == nExpFFVersion )
+/*N*/ rPool.SetStoringRange( 1, 60 );
+/*N*/
+/*N*/ rPool.Store( s );
+/*N*/
+/*N*/ return SfxStyleSheetBasePool::Store( s, bUsed );
+/*N*/ }
+
+// Auffuellen eines Pools mit allen am Doc definierten Vorlagen
+
+/*N*/ void SwStyleSheetPool::CopyFromDoc( BOOL bUsed )
+/*N*/ {
+/*N*/ Clear();
+/*N*/ // Uebernahme der benannten Formate
+/*N*/ // Die Defaultvorlagen werden nicht uebernommen
+/*N*/ // Zeichenvorlagen: alle uebernehmen
+/*N*/ // Rahmenvorlagen: nur die Nicht-Auto-Vorlagen uebernehmen
+/*N*/ const SwFmt* pFmt;
+/*N*/ USHORT nArrLen = rDoc.GetCharFmts()->Count();
+ USHORT i=0;
+/*N*/ for( i = 0; i < nArrLen; i++ )
+/*N*/ {
+/*N*/ pFmt = (*rDoc.GetCharFmts())[ i ];
+/*N*/ if( ( !bUsed || rDoc.IsUsed( *pFmt ) ) && !pFmt->IsDefault() )
+/*N*/ Add( *pFmt, SFX_STYLE_FAMILY_CHAR );
+/*N*/ }
+/*N*/ nArrLen = rDoc.GetFrmFmts()->Count();
+/*N*/ for( i = 0; i < nArrLen; i++ )
+/*N*/ {
+/*N*/ pFmt = (*rDoc.GetFrmFmts())[ i ];
+/*N*/ if( ( !bUsed || rDoc.IsUsed( *pFmt ) )
+/*N*/ && !pFmt->IsDefault() && !pFmt->IsAuto() )
+/*N*/ Add( *pFmt, SFX_STYLE_FAMILY_FRAME );
+/*N*/ }
+/*N*/ // Uebernahme der Absatzvorlagen
+/*N*/ nArrLen = rDoc.GetTxtFmtColls()->Count();
+/*N*/ for( i = 0; i < nArrLen; i++ )
+/*N*/ {
+/*N*/ const SwTxtFmtColl* pColl = (*rDoc.GetTxtFmtColls())[ i ];
+/*N*/ if( ( !bUsed || rDoc.IsUsed( *pColl ) ) && !pColl->IsDefault() )
+/*N*/ Add( *pColl, SFX_STYLE_FAMILY_PARA );
+/*N*/ }
+/*N*/ if( bUsed )
+/*N*/ {
+/*N*/ //JP 30.03.99: falls die Follows nicht angewendet werden, so muessen
+/*N*/ // sie doch kopiert werden!
+/*?*/ for( i = 0; i < nArrLen; i++ )
+/*?*/ {
+/*?*/ const SwTxtFmtColl* pColl = (*rDoc.GetTxtFmtColls())[ i ];
+/*?*/ if( pColl != &pColl->GetNextTxtFmtColl() &&
+/*?*/ !Find( pColl->GetNextTxtFmtColl().GetName(),
+/*?*/ SFX_STYLE_FAMILY_PARA ))
+/*?*/ Add( pColl->GetNextTxtFmtColl(), SFX_STYLE_FAMILY_PARA );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+// Hinzufuegen eines neuen StyleSheets.
+// Es muss mind. ein Bit in der Maske gesetzt werden, da die Suchroutinen
+// der Basisklasse ein AND auf die Maske machen!
+// Der Set wird auch temporaer kopiert.
+
+#define DUMMYBITS 0x0001
+
+/*N*/ void SwStyleSheetPool::Add( const SwFmt& rFmt, SfxStyleFamily eFam )
+/*N*/ {
+/*N*/ SwStyleSheet& r = (SwStyleSheet&) Make( rFmt.GetName(), eFam, DUMMYBITS );
+/*N*/
+/*N*/ // SW31-Export oder nicht
+/*N*/ r.nVersion = nExpFFVersion;
+/*N*/
+/*N*/ // ItemSet
+/*N*/ r.GetItemSet().Put( rFmt.GetAttrSet() );
+/*N*/
+/*N*/ // es muss natuerlich der Pointer vom kopierten geschrieben werden !!!
+/*N*/ r.pSet = &r.GetItemSet();
+/*N*/ r.bMySet = FALSE;
+/*N*/
+/*N*/ // Members setzen
+/*N*/ ASSERT( nExpFFVersion, "SwStylePool::Add: FF-Version ist nicht gesetzt" );
+/*N*/ if( nExpFFVersion <= SOFFICE_FILEFORMAT_40 )
+/*N*/ r.nId = Sw3StringPool::ConvertToOldPoolId( rFmt.GetPoolFmtId(),
+/*N*/ nExpFFVersion );
+/*N*/ else
+/*N*/ r.nId = rFmt.GetPoolFmtId();
+/*N*/ r.pFmt = (SwFmt*) &rFmt;
+/*N*/ if( r.nId & USER_FMT )
+/*N*/ r.nMask |= SFXSTYLEBIT_USERDEF;
+/*N*/ if( rDoc.IsUsed( rFmt ) )
+/*N*/ r.nMask |= SFXSTYLEBIT_USED;
+/*N*/ if( rFmt.GetPoolHlpFileId() != UCHAR_MAX )
+/*?*/ r.aHelpFile = *rDoc.GetDocPattern( rFmt.GetPoolHlpFileId() );
+/*N*/ r.nHelpId = rFmt.GetPoolHelpId();
+/*N*/ if( rFmt.IsAutoUpdateFmt() )
+/*N*/ r.cFlags |= 0x01;
+/*N*/
+/*N*/ // Parent und Follow
+/*N*/ SwFmt* pFmt = rFmt.DerivedFrom();
+/*N*/ // Parent-Namen nur uebernehmen, wenn kein Default
+/*N*/ if( pFmt && !pFmt->IsDefault() )
+/*N*/ r.aParent = rFmt.DerivedFrom()->GetName();
+/*N*/ if( r.nFamily & SFX_STYLE_FAMILY_PARA )
+/*N*/ {
+/*N*/ r.nLevel = r.GetColl()->GetOutlineLevel();
+/*N*/ #ifdef NUM_RELSPACE
+/*N*/ if( NO_NUMBERING != r.nLevel )
+/*N*/ {
+/*N*/ // Beim Export in das 3.1- oder 4.0-Format wird die Vorlage noch
+/*N*/ // an die Outline Numerierung angepasst. Der linke Einzug wird
+/*N*/ // aber nur veraendert, wenn er nicht relativ ist.
+/*N*/ // Beim Schreiben des 5.0/5.1-Formats werden die Einzuege immer
+/*N*/ // veraendert und das Original-Item gemerkt.
+/*N*/ // Beim 3.1- und 4.0-Export werden auch Vorlagen angepasst, deren
+/*N*/ // Outline-Level >= 5 ist.
+/*N*/ const SwNumRule *pOutline = rDoc.GetOutlineNumRule();
+/*N*/ BYTE nLevel = GetRealLevel( r.nLevel );
+/*N*/ if( pOutline )
+/*N*/ {
+/*N*/ const SwNumFmt& rNumFmt = pOutline->Get( nLevel );
+/*N*/ const SvxLRSpaceItem& rLRSpace = rFmt.GetLRSpace();
+/*N*/ USHORT nOldLSpace = rLRSpace.GetTxtLeft();
+/*N*/ USHORT nLSpace = rLRSpace.GetTxtLeft();
+/*N*/ BOOL bNonProp = FALSE;
+/*N*/ if( rLRSpace.GetPropLeft() == 100U ||
+/*N*/ nExpFFVersion > SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*N*/ if( pOutline->IsAbsSpaces() )
+/*?*/ nLSpace = rNumFmt.GetAbsLSpace();
+/*N*/ else
+/*N*/ nLSpace += rNumFmt.GetAbsLSpace();
+/*N*/ bNonProp = TRUE;
+/*N*/ }
+/*N*/ if( nLSpace != rLRSpace.GetTxtLeft() ||
+/*N*/ rNumFmt.GetFirstLineOffset() !=
+/*N*/ rLRSpace.GetTxtFirstLineOfst() )
+/*N*/ {
+/*N*/ if( nExpFFVersion > SOFFICE_FILEFORMAT_40 )
+/*N*/ {
+/*N*/ r.cFlags |= 0x02;
+/*N*/ if( SFX_ITEM_SET == r.GetItemSet().
+/*N*/ GetItemState( RES_LR_SPACE, FALSE ) )
+/*N*/ {
+/*?*/ r.pNumLRSpace = new SvxLRSpaceItem( rLRSpace );
+/*N*/ }
+/*N*/ }
+/*N*/ SvxLRSpaceItem aLRSpace( rLRSpace );
+/*N*/ aLRSpace.SetTxtFirstLineOfst(
+/*N*/ rNumFmt.GetFirstLineOffset() );
+/*N*/ if( bNonProp )
+/*N*/ aLRSpace.SetTxtLeft( nLSpace );
+/*N*/ r.GetItemSet().Put( aLRSpace );
+/*N*/
+/*N*/ if( nExpFFVersion <= SOFFICE_FILEFORMAT_40 &&
+/*N*/ nLSpace != nOldLSpace )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == rFmt.GetAttrSet().GetItemState(
+/*N*/ RES_PARATR_TABSTOP, TRUE, &pItem ))
+/*N*/ {
+/*N*/ SvxTabStopItem aTStop( *(SvxTabStopItem*)pItem );
+/*N*/ lcl_sw3io__ConvertNumTabStop( aTStop,
+/*N*/ (long)nOldLSpace - (long)nLSpace );
+/*N*/ r.GetItemSet().Put( aTStop );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ const SwTxtFmtColl& rFollow = r.GetColl()->GetNextTxtFmtColl();
+/*N*/ if( !rFollow.IsDefault() )
+/*N*/ r.aFollow = rFollow.GetName();
+/*N*/ }
+/*N*/
+/*N*/ }
+
+// Kopieren aller StyleSheets in das Doc
+// Ggf. werden die StyleSheets neu erzeugt
+
+sal_Bool lcl_sw3io_isStarSymbolFontItem( const SvxFontItem& rFontItem );
+extern sal_Char const SW_CONSTASCII_DECL( sHTML_xmp, "XMP" );
+extern sal_Char const SW_CONSTASCII_DECL( sHTML_listing, "LISTING" );
+
+sal_Char const SW_CONSTASCII_DEF( sHTML_xmp, "XMP" );
+sal_Char const SW_CONSTASCII_DEF( sHTML_listing, "LISTING" );
+
+/*N*/ void SwStyleSheetPool::CopyToDoc( BOOL bOverwrite, USHORT eMask )
+/*N*/ {
+/*N*/ SwFmt* pFmt;
+ SwStyleSheet* p;
+/*N*/ for( p = (SwStyleSheet*) aStyles.First(); p;
+/*N*/ p = (SwStyleSheet*) aStyles.Next() )
+/*N*/ {
+/*N*/ if( !p->pFmt && (eMask & p->nFamily) )
+/*N*/ {
+/*N*/ BOOL bNewFmt = FALSE;
+/*N*/
+/*N*/ if( p->nVersion < SWG_TEN_HEADLINES &&
+/*N*/ p->nFamily & SFX_STYLE_FAMILY_PARA &&
+/*N*/ (RES_POOLCOLL_HTML_LISTING_40_USER == p->nId ||
+/*N*/ RES_POOLCOLL_HTML_XMP_40_USER == p->nId) )
+/*N*/ {
+/*?*/ // Listing und XMP werden umbenannt, aber nur, wenn
+/*?*/ // sie nicht schon im Pool vorhanden sind
+/*?*/ String aNewName( String::CreateFromAscii(
+/*?*/ RES_POOLCOLL_HTML_XMP_40_USER == p->nId
+/*?*/ ? sHTML_xmp
+/*?*/ : sHTML_listing ) );
+/*?*/ BOOL bPresent = Find( aNewName, p->nFamily ) != 0;
+/*?*/
+/*?*/ // Umbennnen. Das muss auch sein, wenn eine Vorlage
+/*?*/ // mit dem neuen Namen existiert, damit die abgeleiteten
+/*?*/ // und Folgevorlagen umgehaengt wenrden.
+/*?*/ Rename( p->GetName(), aNewName, p->nFamily );
+/*?*/ aStyles.First();
+/*?*/
+/*?*/ if( bPresent )
+/*?*/ {
+/*?*/ // Vorlage von nun an ignorieren
+/*?*/ p->nFamily = (SfxStyleFamily)0;
+/*?*/ continue;
+/*?*/ }
+/*?*/
+/*?*/ // Benutzter-Vorlage ohne ID daraus machen.
+/*?*/ p->nId |= (USHRT_MAX &
+/*?*/ ~(COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID));
+/*?*/ p->nMask |= SFXSTYLEBIT_USERDEF;
+/*N*/ }
+/*N*/
+/*N*/ pFmt = lcl_sw3io__FindFmt( rDoc, p->GetName(), p->nFamily );
+/*N*/ if( !pFmt )
+/*N*/ {
+/*N*/ bNewFmt = TRUE;
+/*N*/ BOOL bIsUserDefined = p->IsUserDefined();
+/*N*/ if( !bIsUserDefined )
+/*N*/ {
+/*N*/ //JP 31.01.96:
+/*N*/ // dann teste mal ob die Ids im aktuellen PoolId-
+/*N*/ // Bereich sind. Wenn nicht, dann muss sie als
+/*N*/ // BenutzerVorlage angelegt werden!!!!!!!
+/*N*/ USHORT nId = p->nId;
+/*N*/ if( p->nFamily & SFX_STYLE_FAMILY_CHAR )
+/*N*/ bIsUserDefined = !(
+/*N*/ (RES_POOLCHR_NORMAL_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCHR_NORMAL_END) ||
+/*N*/ (RES_POOLCHR_HTML_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCHR_HTML_END));
+/*N*/ else if( p->nFamily & SFX_STYLE_FAMILY_FRAME )
+/*N*/ bIsUserDefined = RES_POOLFRM_BEGIN > nId ||
+/*N*/ nId >= RES_POOLFRM_END;
+/*N*/ else
+/*N*/ bIsUserDefined = !(
+/*N*/ (RES_POOLCOLL_TEXT_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCOLL_TEXT_END) ||
+/*N*/ (RES_POOLCOLL_LISTS_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCOLL_LISTS_END) ||
+/*N*/ (RES_POOLCOLL_EXTRA_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCOLL_EXTRA_END) ||
+/*N*/ (RES_POOLCOLL_REGISTER_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCOLL_REGISTER_END) ||
+/*N*/ (RES_POOLCOLL_DOC_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCOLL_DOC_END) ||
+/*N*/ (RES_POOLCOLL_HTML_BEGIN <= nId &&
+/*N*/ nId < RES_POOLCOLL_HTML_END));
+/*N*/
+/*N*/ // es war eine Poolvorlage die wir aber noch nicht kennen
+/*N*/ if( bIsUserDefined )
+/*N*/ {
+/*N*/ p->nId |= (USHRT_MAX &
+/*N*/ ~(COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID));
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Die Vorlage ist Benutzer-definiert, aber
+/*N*/ // vielleicht gibt es ja mitlerweile eine
+/*N*/ // Pool-Vorlage mit dem gleichen Namen.
+/*N*/ // Dann nehmen wir die Pool-Vorlage
+/*N*/ // statt der Benutzer-Vorlage, aber auch nur
+/*N*/ // dann, wenn die Pool-Vorlage nicht auch noch
+/*N*/ // eingelesen wird. Ist das der Fall, wird
+/*N*/ // die Benutzer-Vorlage ignoriert.
+/*N*/ SwGetPoolIdFromName eNameType;
+/*N*/ if( p->nFamily & SFX_STYLE_FAMILY_CHAR )
+/*N*/ eNameType = GET_POOLID_CHRFMT;
+/*N*/ else if( p->nFamily & SFX_STYLE_FAMILY_FRAME )
+/*N*/ eNameType = GET_POOLID_FRMFMT;
+/*N*/ else
+/*N*/ eNameType = GET_POOLID_TXTCOLL;
+/*N*/ USHORT nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( p->GetName(),
+/*N*/ eNameType );
+/*N*/ if( nPoolId != USHRT_MAX )
+/*N*/ {
+/*N*/ if( FindByPoolId( nPoolId ) )
+/*N*/ {
+/*N*/ // Vorlage von nun an ignorieren
+/*?*/ p->nFamily = (SfxStyleFamily)0;
+/*?*/ continue;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bIsUserDefined = FALSE;
+/*N*/ p->nId = nPoolId;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ if( bIsUserDefined )
+/*N*/ {
+/*N*/ // Benutzerdefinierte Formate werden am Doc neu eingerichtet.
+/*N*/ // PageDescs werden z.Zt. noch nicht hier gepflegt!
+/*N*/ if( p->nFamily & SFX_STYLE_FAMILY_CHAR )
+/*N*/ {
+/*N*/ pFmt = rDoc.MakeCharFmt( p->GetName(), NULL );
+/*N*/ pFmt->SetAuto( FALSE );
+/*N*/ }
+/*N*/ else if( p->nFamily & SFX_STYLE_FAMILY_FRAME )
+/*N*/ {
+/*N*/ pFmt = rDoc.MakeFrmFmt( p->GetName(), NULL );
+/*N*/ pFmt->SetAuto( FALSE );
+/*N*/ }
+/*N*/ else if( p->pCondColls )
+/*N*/ {
+/*NBFF*/ SwTxtFmtColl* pDer = (*rDoc.GetTxtFmtColls())[ 0 ];
+/*NBFF*/ pFmt = rDoc.MakeCondTxtFmtColl( p->GetName(), pDer );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwTxtFmtColl* pDer = (*rDoc.GetTxtFmtColls())[ 0 ];
+/*N*/ pFmt = rDoc.MakeTxtFmtColl( p->GetName(), pDer );
+/*N*/ }
+/*N*/
+/*N*/ // Bei benutzerdefinierten Vorlagen werden die Help-Ids
+/*N*/ // im Doc gesetzt.
+/*N*/ pFmt->SetPoolFmtId( p->nId );
+/*N*/ if( p->aHelpFile.Len() )
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 /*?*/ pFmt->SetPoolHlpFileId
+/*N*/ pFmt->SetPoolHelpId( (USHORT)p->nHelpId );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Poolformate werden am Doc angefordert.
+/*N*/ // PageDescs werden z.Zt. noch nicht hier gepflegt!
+/*N*/ if( p->nFamily & SFX_STYLE_FAMILY_CHAR )
+/*N*/ {
+/*N*/ USHORT nStyleCnt = rDoc.GetCharFmts()->Count();
+/*N*/ pFmt = rDoc.GetCharFmtFromPool( p->nId );
+/*N*/ bNewFmt = nStyleCnt != rDoc.GetCharFmts()->Count();
+/*N*/ }
+/*N*/ else if( p->nFamily & SFX_STYLE_FAMILY_FRAME )
+/*N*/ {
+/*N*/ USHORT nStyleCnt = rDoc.GetFrmFmts()->Count();
+/*N*/ pFmt = rDoc.GetFrmFmtFromPool( p->nId );
+/*N*/ bNewFmt = nStyleCnt != rDoc.GetFrmFmts()->Count();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nStyleCnt = rDoc.GetTxtFmtColls()->Count();
+/*N*/ pFmt = rDoc.GetTxtCollFromPool( p->nId );
+/*N*/ bNewFmt = nStyleCnt != rDoc.GetTxtFmtColls()->Count();
+/*N*/ }
+/*N*/ // Hier werden die Help-Ids aus der Vorlage uebernommen!
+/*N*/ if( pFmt->GetPoolHlpFileId() != UCHAR_MAX )
+/*?*/ p->aHelpFile = *rDoc.GetDocPattern( pFmt->GetPoolHlpFileId() );
+/*N*/ p->nHelpId = pFmt->GetPoolHelpId();
+/*N*/
+/*N*/ // MIB 27.11.96: "kleine" Optimierung: Nichts umbenennen,
+/*N*/ // wo nichts umzubenennen ist.
+/*N*/ if( p->GetName() != pFmt->GetName() )
+/*N*/ {
+/*N*/ Rename( p->GetName(), pFmt->GetName(), p->GetFamily() );
+/*N*/ // Da Rename() selbst eine Schleife hat, muss von
+/*N*/ // vorne gearbeitet werden.
+/*N*/ aStyles.First();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if( p->IsUserDefined() )
+/*N*/ {
+/*N*/ // Wenn aus dem selben Dokument eine Pool-Vorlage
+/*N*/ // mit gleichem Namen gelesen wurde, dann wird die
+/*N*/ // Benutzer-Vorlage ignoriert.
+/*?*/ USHORT nPoolId = pFmt->GetPoolFmtId();
+/*?*/ SwStyleSheet *pTmp;
+/*?*/ if( nPoolId != p->nId && (nPoolId & USER_FMT) == 0 &&
+/*?*/ (pTmp = FindByPoolId( nPoolId )) != 0 &&
+/*?*/ pTmp->pFmt == pFmt )
+/*?*/ {
+/*?*/ // Vorlage von nun an ignorieren
+/*?*/ p->nFamily = (SfxStyleFamily)0;
+/*?*/ continue;
+/*?*/ }
+/*N*/ }
+/*N*/ p->pFmt = pFmt;
+/*N*/ /* Attribute nur uebernehmen, wenn bOverwrite TRUE ist */
+/*N*/ if( bOverwrite || bNewFmt )
+/*N*/ {
+/*N*/ p->bNew = TRUE;
+/*N*/ pFmt->ResetAllAttr(); // die neue Vorlage kann auch weniger
+/*N*/ // Attribute enthalten
+/*N*/ ((SwAttrSet&) pFmt->GetAttrSet()).Put( p->GetItemSet() );
+/*N*/ SwTxtFmtColl* pColl = p->GetColl();
+/*N*/ if( pColl )
+/*N*/ {
+/*N*/ ((SwAttrSet&) pColl->GetAttrSet()).SetModifyAtAttr( pColl );
+/*N*/
+/*N*/ // Bei Einfuegen von Vorlagen muss ggf. der Outline-Level
+/*N*/ // geloescht werden, wenn bereits eine Vorlage mit diesem
+/*N*/ // Level existiert.
+/*N*/
+/*N*/ BYTE nLevel = p->GetNumLevel();
+/*N*/ if( !bOverwrite && nLevel != NO_NUMBERING )
+/*N*/ {
+/*?*/ BYTE nRealLevel = GetRealLevel(nLevel);
+/*?*/ USHORT nArrLen = rDoc.GetTxtFmtColls()->Count();
+/*?*/ for( USHORT i=0; i<nArrLen; i++ )
+/*?*/ {
+/*?*/ SwTxtFmtColl* pCur =
+/*?*/ (*rDoc.GetTxtFmtColls())[i];
+/*?*/ BYTE nCurLevel = pCur->GetOutlineLevel();
+/*?*/ if( nCurLevel != NO_NUMBERING &&
+/*?*/ GetRealLevel(nCurLevel) == nRealLevel )
+/*?*/ {
+/*?*/ if( pColl != pCur )
+/*?*/ nLevel = NO_NUMBERING;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ pColl->SetOutlineLevel( nLevel );
+/*N*/ }
+/*N*/ pFmt->SetAutoUpdateFmt( (p->cFlags & 0x01) != 0 );
+/*N*/ }
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if( SFX_ITEM_SET == p->GetItemSet().GetItemState(
+/*N*/ RES_CHRATR_FONT, sal_False, &pItem ) &&
+/*N*/ RTL_TEXTENCODING_SYMBOL ==
+/*N*/ ((const SvxFontItem *)pItem)->GetCharSet() )
+/*N*/ {
+/*N*/ BOOL bBats = ((const SvxFontItem *)pItem)->GetFamilyName().EqualsIgnoreCaseAscii( "StarBats", 0, sizeof("StarBats")-1 );
+/*N*/ BOOL bMath = ((const SvxFontItem *)pItem)->GetFamilyName().EqualsIgnoreCaseAscii( "StarMath", 0, sizeof("StarMath")-1 );
+/*N*/
+/*N*/ if( bBats || bMath )
+/*N*/ {
+/*N*/ if( p->bNew )
+/*N*/ {
+/*N*/ // Allways convert font to StarSymbol
+/*N*/ pConvToSymbolFmts ->Insert( pFmt, SW3IO_CONV_TO_SYMBOL );
+/*N*/ }
+/*?*/ else if( SFX_ITEM_SET == pFmt->GetAttrSet().GetItemState(
+/*?*/ RES_CHRATR_FONT, sal_True, &pItem ) &&
+/*?*/ lcl_sw3io_isStarSymbolFontItem( *(const SvxFontItem *)pItem ) )
+/*?*/ {
+/*?*/ pConvToSymbolFmts ->Insert( pFmt, bBats ? SW3IO_CONV_FROM_BATS : SW3IO_CONV_FROM_MATH );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Nun sind alle Vorlagen drin, sie koennen also verbunden werden
+/*N*/ for( p = (SwStyleSheet*) aStyles.First(); p;
+/*N*/ p = (SwStyleSheet*) aStyles.Next() )
+/*N*/ {
+/*N*/ if( p->bNew )
+/*N*/ {
+/*N*/ p->ConnectParent( p->GetParent() );
+/*N*/ p->ConnectFollow( p->GetFollow() );
+/*N*/ // das Format hat sich geaendert!
+/*N*/ SwFmtChg aHint( p->pFmt );
+/*N*/ p->pFmt->Modify( &aHint, &aHint );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ // dann koennen auch alle bedingten Vorlagen verbunden werden
+/*N*/ for( p = (SwStyleSheet*) aStyles.First(); p;
+/*N*/ p = (SwStyleSheet*) aStyles.Next() )
+/*N*/ {
+/*N*/ if( p->bNew && p->pCondColls )
+/*N*/ for( USHORT n = 0; n < p->pCondColls->Count(); ++n )
+/*N*/ {
+/*?*/ SwStyleCondColl* pCColl = (*p->pCondColls)[n];
+/*?*/ SwTxtFmtColl* pDColl = rDoc.FindTxtFmtCollByName( pCColl->sColl );
+/*?*/ if( pDColl )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ((SwConditionTxtFmtColl*)p->pFmt)->InsertCondition(
+/*?*/ }
+/*?*/ else
+/*?*/ ASSERT( !this, "Collection nicht gefunden" );
+/*N*/ }
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ }
+
+////////////////////////////////////////////////////////////////////////////
+
+// Faktorei
+
+/*N*/ SfxStyleSheetBase* __EXPORT SwStyleSheetPool::Create( const String& rName,
+/*N*/ SfxStyleFamily eFam, USHORT nMask)
+/*N*/ {
+/*N*/ return new SwStyleSheet( rName, *this, eFam, nMask);
+/*N*/ }
+
+
+// Umbenennen eines bestimmten Strings innerhalb einer Family
+
+/*N*/ void SwStyleSheetPool::Rename
+/*N*/ ( const String& rOld, const String& rNew, SfxStyleFamily eFam )
+/*N*/ {
+/*N*/ // da mit Referenzen gearbeitet wird, muss der Name zwischen-
+/*N*/ // gelagert werden!
+/*N*/ String aOld( rOld );
+/*N*/ for( SwStyleSheet* p = (SwStyleSheet*) aStyles.First(); p;
+/*N*/ p = (SwStyleSheet*) aStyles.Next() )
+/*N*/ {
+/*N*/ if( p->GetFamily() == eFam )
+/*N*/ {
+/*N*/ if( p->GetName() == aOld )
+/*N*/ p->SetNewName( rNew );
+/*N*/ if( p->GetParent() == aOld )
+/*N*/ p->SetNewParent( rNew );
+/*N*/ if( p->GetFollow() == aOld )
+/*N*/ p->SetNewFollow( rNew );
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ if( p->pCondColls )
+/*N*/ {
+/*?*/ SwStyleCondColl* pCColl;
+/*?*/ for( USHORT n = 0; n < p->pCondColls->Count(); ++n )
+/*?*/ if( ( pCColl = (*p->pCondColls)[n] )->sColl == aOld )
+/*?*/ pCColl->sColl = rNew;
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwStyleSheet *SwStyleSheetPool::FindByPoolId( USHORT nPoolId )
+/*N*/ {
+/*N*/ SwStyleSheet *pS = 0;
+/*N*/ ULONG nCount = aStyles.Count();
+/*N*/ for( ULONG i=0; i<nCount; i++ )
+/*N*/ {
+/*N*/ SwStyleSheet *p = (SwStyleSheet *)aStyles.GetObject( i );
+/*N*/ if( p->nId == nPoolId )
+/*N*/ {
+/*?*/ pS = p;
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return pS;
+/*N*/ }
+
+///////////////////////////////////////////////////////////////////////////
+
+// Laden und speichern aller StyleSheets
+// Der Code liegt hier, um ein HXX fuer den lokalen Pool einzusparen
+
+/*N*/ void Sw3IoImp::LoadStyleSheets( BOOL bNew )
+/*N*/ {
+/*N*/ ASSERT( !HasRecSizes(), "Hier darf es noch keine RecSizes geben" );
+/*N*/ // Bisher wurde allenfalls der Drawing-Layer gelesen. Deshalb
+/*N*/ // kann es hier noch gar keine RecSizes geben. Besser ist aber besser ...
+/*N*/ if( HasRecSizes() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ FlushRecSizes();
+/*N*/
+/*N*/ SfxItemPool *pTmp = pDoc->GetAttrPool().GetSecondaryPool();
+/*N*/ pDoc->GetAttrPool().SetSecondaryPool( 0 );
+/*N*/ SfxItemPool* pPool = pDoc->GetAttrPool().Clone();
+/*N*/ pDoc->GetAttrPool().SetSecondaryPool( pTmp );
+/*N*/
+/*N*/ ASSERT( !pConvToSymbolFmts, "ConvToSymbol array exists" );
+/*N*/ pConvToSymbolFmts = new Sw3Fmts;
+/*N*/ SwStyleSheetPool* p = new SwStyleSheetPool( *pDoc, *pPool, 0, pConvToSymbolFmts );
+/*N*/ pStyles->SetBufferSize( SW3_BSR_STYLES );
+/*N*/ pStrm = pStyles;
+/*N*/ USHORT eMask = bNormal ? SFX_STYLE_FAMILY_ALL : 0;
+/*N*/ if( !bNormal )
+/*N*/ {
+/*?*/ if( bFrmFmts )
+/*?*/ eMask |= SFX_STYLE_FAMILY_FRAME;
+/*?*/ if( bTxtColls )
+/*?*/ eMask |= SFX_STYLE_FAMILY_PARA;
+/*?*/ if( bCharFmts )
+/*?*/ eMask |= SFX_STYLE_FAMILY_CHAR;
+/*N*/ }
+/*N*/
+/*N*/ nRes = p->Load( *pStyles, bNew, eMask ) ? 0 : ERR_SWG_READ_ERROR;
+/*N*/ pStyles->SetBufferSize( 0 );
+/*N*/
+/*N*/ // JP 09.06.95: die Pool-Defaults muessen beim normalen Einlesen
+/*N*/ // aus temp Pool mitgenommen werden !!
+/*N*/ if( !nRes && !bInsert )
+/*N*/ {
+/*N*/ const SfxPoolItem* pCpyItem;
+/*N*/ for( USHORT nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh )
+/*N*/ if( 0 != ( pCpyItem = pPool->GetPoolDefaultItem( nWh ) ) )
+/*N*/ pDoc->GetAttrPool().SetPoolDefaultItem( *pCpyItem );
+/*N*/ }
+/*N*/
+/*N*/ // alle Attribute, die auf irgendwelche Vorlagen verweisen hier verbinden
+/*N*/ // (Attribute: DropCaps)
+/*N*/ {
+/*N*/ BOOL bReadStrPool = FALSE;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ USHORT nMaxItems = pDoc->GetAttrPool().GetItemCount( RES_PARATR_DROP );
+/*N*/
+/*N*/ for( USHORT n = 0; n < nMaxItems; ++n )
+/*N*/ if( 0 != (pItem = pDoc->GetAttrPool().GetItem( RES_PARATR_DROP, n ) )
+/*N*/ && USHRT_MAX != ((SwFmtDrop*)pItem)->GetReadFmt() )
+/*N*/ {
+/*?*/ if( !bReadStrPool )
+/*?*/ {
+/*?*/ bReadStrPool = TRUE;
+/*?*/ if( pPageStyles.Is() )
+/*?*/ {
+/*?*/ pPageStyles->Seek( 0L );
+/*?*/ pPageStyles->SetBufferSize( SW3_BSR_PAGESTYLES );
+/*?*/ SvStream* pOld = pStrm;
+/*?*/ pStrm = pPageStyles;
+/*?*/ if( !nRes )
+/*?*/ {
+/*?*/ if( Peek() != SWG_STRINGPOOL )
+/*?*/ InHeader( TRUE );
+/*?*/ if( Good() && Peek() == SWG_STRINGPOOL )
+/*?*/ InStringPool( SWG_STRINGPOOL, aStringPool );
+/*?*/ }
+/*?*/ pStrm = pOld;
+/*?*/ CheckIoError( pPageStyles );
+/*?*/ pPageStyles->SetBufferSize( 0 );
+/*?*/ }
+/*?*/ }
+/*?*/ ((SwFmtDrop*)pItem)->SetCharFmt( (SwCharFmt*) FindFmt(
+/*?*/ ((SwFmtDrop*)pItem)->GetReadFmt(), SWG_CHARFMT ) );
+/*N*/ }
+/*N*/
+/*N*/ // fix #41308#: Wenn nur Vorlagen geladen werden, muessen die
+/*N*/ // Font-Items noch den richten Charset verpasst bekommen. Es sei
+/*N*/ // denn, es werden auch Seitenvorlagen geladen. Dann passiert das
+/*N*/ // automatisch im Cleanup
+/*N*/ if( !bNormal && !bPageDescs )
+/*N*/ {
+/*?*/ BOOL bSrcSetValid = bReadStrPool;
+/*?*/ if( !bSrcSetValid && pPageStyles.Is() )
+/*?*/ {
+/*?*/ pPageStyles->Seek( 0L );
+/*?*/ pPageStyles->SetBufferSize( SW3_BSR_PAGESTYLES );
+/*?*/ SvStream* pOld = pStrm;
+/*?*/ pStrm = pPageStyles;
+/*?*/ if( !nRes && Peek() != SWG_STRINGPOOL )
+/*?*/ {
+/*?*/ InHeader(); // RecSizes brauchen hier nicht gelesen zu
+/*?*/ // werden, weil keine Records gelesen werden.
+/*?*/ bSrcSetValid = Good();
+/*?*/ }
+/*?*/ pStrm = pOld;
+/*?*/ CheckIoError( pPageStyles );
+/*?*/ pPageStyles->SetBufferSize( 0 );
+/*?*/ }
+/*?*/
+/*?*/ if( bSrcSetValid )
+/*?*/ ChangeFontItemCharSet();
+/*?*/ ConvertFmtsToStarSymbol();
+/*N*/ }
+/*N*/
+/*N*/ if( bReadStrPool )
+/*?*/ aStringPool.Clear();
+/*N*/ }
+/*N*/
+/*N*/ #ifndef NUM_RELSPACE
+/*?*/ // JP 14.09.98: Bug 55957 - die Vorlagen muessen dann aber
+/*?*/ // auch die OutlineRule aktualisieren
+/*?*/ if( !bNormal && bTxtColls )
+/*?*/ {
+/*?*/ const SwTxtFmtColls& rColls = *pDoc->GetTxtFmtColls();
+/*?*/ const SwTxtFmtColl* pColl;
+/*?*/ SwNumRule* pOutlRule = (SwNumRule*)pDoc->GetOutlineNumRule();
+/*?*/ BYTE nLevel;
+/*?*/ for( USHORT n = rColls.Count(); n; )
+/*?*/ if( MAXLEVEL > ( nLevel = GetRealLevel(
+/*?*/ ( pColl = rColls[ --n ])->GetOutlineLevel() )) )
+/*?*/ {
+/*?*/ const SvxLRSpaceItem& rLR = pColl->GetLRSpace();
+/*?*/ const SwNumFmt& rNFmt = pOutlRule->Get( nLevel );
+/*?*/ SwNumFmt aTmp( rNFmt );
+/*?*/
+/*?*/ // ohne Nummer immer ohne FirstLineOffset!!!!
+/*?*/ if( pColl->GetOutlineLevel() & NO_NUMLEVEL )
+/*?*/ aTmp.SetFirstLineOffset( 0 );
+/*?*/ else
+/*?*/ aTmp.SetFirstLineOffset( rLR.GetTxtFirstLineOfst() );
+/*?*/
+/*?*/ aTmp.SetAbsLSpace( rLR.GetTxtLeft() );
+/*?*/ if( aTmp != rNFmt )
+/*?*/ pOutlRule->Set( nLevel, aTmp );
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ //JP 21.07.98: Bug 53390
+/*?*/ if( !bNormal && !bAdditive && bTxtColls )
+/*?*/ {
+/*?*/ pDoc->SetOutlineNumRule( *pDoc->GetOutlineNumRule() );
+/*?*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ delete p;
+/*N*/ delete pPool;
+/*N*/ if( !pConvToSymbolFmts->Count() )
+/*N*/ {
+/*N*/ delete pConvToSymbolFmts;
+/*N*/ pConvToSymbolFmts = 0;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void Sw3IoImp::SaveStyleSheets( BOOL bUsed )
+/*N*/ {
+/*N*/ ASSERT( !HasRecSizes(), "Hier darf es noch keine RecSizes geben" );
+/*N*/ // Bisher wurde allenfalls der Drawing-Layer gespeichert. Deshalb
+/*N*/ // kann es hier noch gar keine RecSizes geben. Besser ist aber besser ...
+/*N*/ if( HasRecSizes() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ FlushRecSizes();
+/*N*/
+/*N*/ SfxItemPool *pTmp = pDoc->GetAttrPool().GetSecondaryPool();
+/*N*/ pDoc->GetAttrPool().SetSecondaryPool( 0 );
+/*N*/ SfxItemPool* pPool = pDoc->GetAttrPool().Clone();
+/*N*/ pDoc->GetAttrPool().SetSecondaryPool( pTmp );
+/*N*/
+/*N*/ pStyles->Seek( 0L );
+/*N*/ pStyles->SetSize( 0L );
+/*N*/ pStyles->SetBufferSize( SW3_BSW_STYLES );
+/*N*/ pStrm = pStyles;
+/*N*/ SwStyleSheetPool* p = new SwStyleSheetPool( *pDoc, *pPool,
+/*N*/ pStrm->GetVersion(), 0 );
+/*N*/ nRes = p->Store( *pStyles, bUsed ) ? 0 : ERR_SWG_WRITE_ERROR;
+/*N*/ pStyles->SetBufferSize( 0 );
+/*N*/ pStyles->Commit();
+/*N*/ delete p;
+/*N*/ delete pPool;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3table.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3table.cxx
new file mode 100644
index 000000000000..f5ce4b6651cb
--- /dev/null
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3table.cxx
@@ -0,0 +1,698 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "swerror.h"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <fmtfsize.hxx>
+
+#include <errhdl.hxx>
+
+#define _SVSTDARR_STRINGSDTOR
+#include "sw3imp.hxx"
+#include "ddefld.hxx"
+#include "swddetbl.hxx"
+#include "swtblfmt.hxx"
+#include "ndindex.hxx"
+namespace binfilter {
+
+
+#ifdef DBG_UTIL
+static ULONG nCntntBox = 0;
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Das Attribut darf im Prinzip nicht > 65535 werden, da sonst MAs
+// Rechenroutinen baden gehen. Da einige alte Tabellen groessere Werte
+// enthalten, setzt InTable() ggf. einen Divisionsfaktor, um den
+// die gelesenen Werte heruntergeteilt werden. Normalerweise ist er 1.
+
+
+/*N*/ void lcl_sw3io_AdjustFrmSize( SwFrmFmt* pFmt, long nAdj )
+/*N*/ {
+/*N*/ if( pFmt && nAdj > 1
+/*N*/ && pFmt->GetAttrSet().GetItemState( RES_FRM_SIZE, FALSE ) == SFX_ITEM_SET )
+/*N*/ {
+/*?*/ SwFmtFrmSize aSz( pFmt->GetFrmSize() );
+/*?*/ aSz.SetWidth( aSz.GetWidth() / nAdj );
+/*?*/ aSz.SetHeight( aSz.GetHeight() / nAdj );
+/*?*/ pFmt->SetAttr( aSz );
+/*N*/ }
+/*N*/ }
+
+/* */
+
+// Line- und Box-Formate fuer den 3.1-/4.0-Export sammeln
+
+BOOL lcl_sw3io_CollectLineFmts( const SwTableLine*& rpLine, void* pPara );
+
+/*N*/ BOOL lcl_sw3io_CollectBoxFmts( const SwTableBox*& rpBox, void* pPara )
+/*N*/ {
+/*N*/ Sw3FrmFmts *pFrmFmts = (Sw3FrmFmts *)pPara;
+/*N*/ if( USHRT_MAX == pFrmFmts->GetPos( rpBox->GetFrmFmt() ) )
+/*N*/ pFrmFmts->Insert( rpBox->GetFrmFmt(), pFrmFmts->Count() );
+/*N*/
+/*N*/ if( rpBox->GetTabLines().Count() )
+/*N*/ ((SwTableBox *)rpBox)->GetTabLines()
+/*N*/ .ForEach( &lcl_sw3io_CollectLineFmts, pPara );
+/*N*/
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ BOOL lcl_sw3io_CollectLineFmts( const SwTableLine*& rpLine, void* pPara )
+/*N*/ {
+/*N*/ Sw3FrmFmts *pFrmFmts = (Sw3FrmFmts *)pPara;
+/*N*/ if( USHRT_MAX == pFrmFmts->GetPos( rpLine->GetFrmFmt() ) )
+/*N*/ pFrmFmts->Insert( rpLine->GetFrmFmt(), pFrmFmts->Count() );
+/*N*/
+/*N*/ ((SwTableLine *)rpLine)->GetTabBoxes()
+/*N*/ .ForEach( &lcl_sw3io_CollectBoxFmts, pPara );
+/*N*/
+/*N*/ return TRUE;
+/*N*/ }
+
+/*N*/ void Sw3IoImp::CollectTblLineBoxFmts40()
+/*N*/ {
+/*N*/ ASSERT( pExportInfo, "Wo ist die Export-Info?" );
+/*N*/ for( USHORT i=0; i<pDoc->GetTblFrmFmts()->Count(); i++ )
+/*N*/ {
+/*N*/ SwClientIter aIter( *(*pDoc->GetTblFrmFmts())[i] );
+/*N*/ SwTable *pTable = (SwTable *)aIter.First( TYPE(SwTable) );
+/*N*/ ASSERT( pTable, "Tabellen-Format ohne Tabelle" );
+/*N*/ if( !pTable )
+/*N*/ continue;
+/*N*/
+/*N*/ if( !pExportInfo->pTblLineBoxFmts40 )
+/*N*/ pExportInfo->pTblLineBoxFmts40 = new Sw3FrmFmts;
+/*N*/ pTable->GetTabLines().ForEach( &lcl_sw3io_CollectLineFmts,
+/*N*/ pExportInfo->pTblLineBoxFmts40 );
+/*N*/ }
+/*N*/ }
+
+/* */
+
+/*N*/ void Sw3IoImp::AddTblLineBoxFmt( SwFrmFmt *pFmt )
+/*N*/ {
+/*N*/ if( !pTblLineBoxFmts )
+/*N*/ pTblLineBoxFmts = new Sw3FrmFmts;
+/*N*/
+/*N*/ pTblLineBoxFmts->Insert( pFmt, pTblLineBoxFmts->Count() );
+/*N*/ }
+
+/*N*/ USHORT Sw3IoImp::GetTblLineBoxFmtId( SwFrmFmt *pFmt )
+/*N*/ {
+/*N*/ USHORT nIdx = pTblLineBoxFmts ? pTblLineBoxFmts->GetPos( pFmt )
+/*N*/ : USHRT_MAX;
+/*N*/ ASSERT( USHRT_MAX != nIdx, "Tabellen-Line/-Box-Format nicht gefunden" );
+/*N*/ if( USHRT_MAX == nIdx )
+/*N*/ Error();
+/*N*/
+/*N*/ return nIdx;
+/*N*/ }
+/*N*/
+/*N*/ USHORT Sw3IoImp::GetTblLineBoxFmtStrPoolId40( SwFrmFmt *pFmt )
+/*N*/ {
+/*N*/ ASSERT( pExportInfo, "Wo ist die Export-Info?" );
+/*N*/ USHORT nPos = pExportInfo->pTblLineBoxFmts40
+/*N*/ ? pExportInfo->pTblLineBoxFmts40->GetPos( pFmt )
+/*N*/ : USHRT_MAX;
+/*N*/ ASSERT( USHRT_MAX != nPos, "Tabellen-Line/-Box-Format nicht gefunden" );
+/*N*/ if( USHRT_MAX == nPos )
+/*N*/ Error();
+/*N*/
+/*N*/ return aStringPool.Find( *((*pExportInfo->pTblLineBoxFmtNames40)[nPos]),
+/*N*/ pFmt->GetPoolFmtId() );
+/*N*/ }
+/*N*/
+/*N*/ SwFrmFmt *Sw3IoImp::GetTblLineBoxFmt( USHORT nIdx )
+/*N*/ {
+/*N*/ ASSERT( pTblLineBoxFmts && nIdx < pTblLineBoxFmts->Count(),
+/*N*/ "Tabellen-Line/-Box-Format nicht gefunden" );
+/*N*/ if( pTblLineBoxFmts && nIdx < pTblLineBoxFmts->Count() )
+/*N*/ return (*pTblLineBoxFmts)[nIdx];
+/*N*/
+/*N*/ return 0;
+/*N*/ }
+
+// Lesen einer Tabelle
+// Der uebergebene Index zeigt anschliessend hinter die Tabelle
+// Flag-Byte
+// 0x10 - Modified
+// 0x20 - HeadLineRepeat
+// Anzahl Boxes
+// Tabellen-Section-ID
+// SWG_FRAMEFMT
+// SWG_FIELDTYPE bei DDE-Tabelle
+// x-mal SWG_TABLELINE
+
+
+/*N*/ void Sw3IoImp::InTable( SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ Sw3FrmFmts *pOldTblLineBoxFmts = pTblLineBoxFmts;
+/*N*/ pTblLineBoxFmts = 0;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ULONG nOldCntntBox = nCntntBox;
+/*N*/ #endif
+/*N*/
+/*N*/
+/*N*/ // Bei einer Tabelle hoert eine 3.1-/4.0-Numerierung auf!
+/*N*/ if( !IsVersion(SWG_LONGIDX) )
+/*N*/ CloseNumRange40( rPos );
+/*N*/
+/*N*/ OpenRec( SWG_TABLE );
+/*N*/ // Tabelle in Tabelle einfuegen wird nicht gemacht
+/*N*/ if( !bInsert || !pDoc->IsIdxInTbl( rPos ) )
+/*N*/ {
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ UINT16 nBoxes, nTblIdDummy;
+/*N*/ BYTE cChgMode;
+/*N*/ *pStrm >> nBoxes;
+/*N*/ if( IsVersion(SWG_LAYFRAMES,SWG_LONGIDX) )
+/*N*/ *pStrm >> nTblIdDummy;
+/*N*/ if( nVersion >= SWG_TBLCHGMODE )
+/*N*/ *pStrm >> cChgMode;
+/*N*/ CloseFlagRec();
+/*N*/ //JP 16.02.99: ueberfluessiges Flag
+/*N*/ // BOOL bModified = BOOL( ( cFlags & 0x10 ) != 0 );
+/*N*/ BOOL bHdRepeat = BOOL( ( cFlags & 0x20 ) != 0 );
+/*N*/ // Die Strukturen im Nodes-Array erzeugen
+/*N*/ // Erzeugen von:
+/*N*/ // TableNode..StartNode..TxtNode..EndNode.. (weitere Boxes) ..EndNode
+/*N*/ SwTableNode* pNd = pDoc->GetNodes().InsertTable( rPos, nBoxes,
+/*N*/ (SwTxtFmtColl*) pDoc->GetDfltTxtFmtColl() );
+/*N*/ if( pNd )
+/*N*/ {
+/*N*/ rPos = *pNd;
+/*N*/ SwTable* pTbl = &pNd->GetTable();
+/*N*/ //JP 16.02.99: ueberfluessiges Flag
+/*N*/ // if( bModified )
+/*N*/ // pTbl->SetModified();
+/*N*/ pTbl->SetHeadlineRepeat( bHdRepeat );
+/*N*/ if( nVersion >= SWG_TBLCHGMODE )
+/*N*/ pTbl->SetTblChgMode( (TblChgMode)cChgMode );
+/*N*/
+/*N*/ // Das Frame-Format der Tabelle einlesen
+/*N*/ SwFrmFmt* pFmt = pDoc->MakeTblFrmFmt( aEmptyStr, 0 );
+/*N*/ if( Peek() == SWG_FRAMEFMT )
+/*N*/ InFormat( SWG_FRAMEFMT, pFmt );
+/*N*/ // Da einige FRMSIZE-Attribute zu grosse Werte enthalten,
+/*N*/ // muessen die Werte heruntergeteilt werden.
+/*N*/ nSizeDivFac = 1;
+/*N*/ if( pFmt->GetAttrSet().GetItemState( RES_FRM_SIZE, FALSE )
+/*N*/ == SFX_ITEM_SET )
+/*N*/ {
+/*N*/ const SwFmtFrmSize &rSz = pFmt->GetFrmSize();
+/*N*/ if ( rSz.GetHeight() > 65535L || rSz.GetWidth() > 65535L )
+/*N*/ {
+/*?*/ SwFmtFrmSize aSz( rSz );
+/*?*/ SwTwips h = aSz.GetHeight();
+/*?*/ SwTwips w = aSz.GetWidth();
+/*?*/ while( h > 65535L || w > 65535L )
+/*?*/ w /= 2, h /= 2, nSizeDivFac *= 2;
+/*?*/ aSz.SetWidth( w );
+/*?*/ aSz.SetHeight( h );
+/*?*/ pFmt->SetAttr( aSz );
+/*N*/ }
+/*N*/ }
+/*N*/ // Falls wir im Insert-Mode sind, muss der Name der Tabelle
+/*N*/ // auf Eindeutigkeit ueberprueft werden
+/*N*/ if( bInsert )
+/*N*/ {
+/*?*/ String aName( pFmt->GetName() );
+/*?*/ Sw3StringPool::RemoveExtension( aName );
+/*?*/ pFmt->SetName( aEmptyStr );
+/*?*/ if( pDoc->FindTblFmtByName( aName ) )
+/*?*/ pFmt->SetName( pDoc->GetUniqueTblName() );
+/*?*/ else
+/*?*/ pFmt->SetName( aName );
+/*N*/ }
+/*N*/ pFmt->Add( pTbl );
+/*N*/ // Ist es eine DDE-Tabelle?
+/*N*/ SwDDEFieldType* pDDEFldType = 0;
+/*N*/ if( Peek() == SWG_FIELDTYPE )
+/*?*/ pDDEFldType = (SwDDEFieldType*) InFieldType();
+/*N*/
+/*N*/ // Vordefinierte Layout-Frames loeschen
+/*N*/ // beim Einfuegen stoeren diese zur Zeit
+/*N*/ if( bInsert ) pNd->DelFrms();
+/*N*/
+/*N*/ // Redlines am Start- oder End-Node einlesen
+/*N*/ while( Peek() == SWG_NODEREDLINE )
+/*N*/ {
+/*N*/ /*?*/ INT32 nDummy=0; //SW50.SDW
+/*N*/ InNodeRedline( rPos, nDummy );
+/*N*/ }
+/*N*/
+/*N*/ // Die einzelnen Zeilen einlesen
+/*N*/ // aIdx zeigt auf den Startnode der ersten Box
+/*N*/ rPos = *pNd; rPos++;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ nCntntBox = 0;
+/*N*/ #endif
+/*N*/ USHORT nLine = 0;
+/*N*/ while( BytesLeft() )
+/*N*/ InTableLine( pTbl->GetTabLines(), NULL, nLine++, rPos );
+/*N*/ rPos = pNd->EndOfSectionIndex()+1;
+/*N*/
+/*N*/ ASSERT( nCntntBox == nBoxes ,
+/*N*/ "Anzahl der Boxen stimmt nicht mit den gelesenen ueberein" );
+/*N*/
+/*N*/ if( pDDEFldType && !pNd->GetTable().IsTblComplex() )
+/*N*/ {
+/*N*/ //DDETabelle, dann tausche am Node den Tabellen-Pointer aus
+ SwDDETable* pNewTable = new SwDDETable( pNd->GetTable(),
+/*N*/ pDDEFldType );
+/*?*/ pNd->SetNewTable( pNewTable, FALSE );
+/*N*/ }
+/*N*/
+/*N*/ // Layout-Frames wieder erzeugen, falls eingefuegt
+/*N*/ // und falls (MA #$.!) die Tbl nicht im FlyFrm ist
+/*N*/ if( bInsert && !nFlyLevel )
+/*N*/ {
+/*?*/ SwNodeIndex aIdx( *pNd->EndOfSectionNode() );
+/*?*/ pDoc->GetNodes().GoNext( &aIdx );
+/*?*/ pNd->MakeFrms( &aIdx );
+/*N*/ }
+/*N*/ }
+/*N*/ else Error(); // kein TblNode
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ CloseRec( SWG_TABLE );
+/*N*/ // Den Divisionsfaktor fur FRMSIZE wieder zuruecksetzen
+/*N*/ nSizeDivFac = 1;
+/*N*/
+/*N*/ delete pTblLineBoxFmts;
+/*N*/ pTblLineBoxFmts = pOldTblLineBoxFmts;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ nCntntBox = nOldCntntBox;
+/*N*/ #endif
+/*N*/ }
+
+// Schreiben einer Tabelle
+
+
+/*N*/ void Sw3IoImp::OutTable( const SwTableNode& rNd )
+/*N*/ {
+/*N*/ Sw3FrmFmts *pOldTblLineBoxFmts = pTblLineBoxFmts;
+/*N*/ pTblLineBoxFmts = 0;
+/*N*/
+/*N*/ const SwTable& rTbl = rNd.GetTable();
+/*N*/ const SwTableLines& rLines = rTbl.GetTabLines();
+/*N*/ USHORT nLines = rLines.Count();
+/*N*/ SwTable* pOldTbl = pCurTbl;
+/*N*/ pCurTbl = (SwTable*) &rTbl;
+/*N*/ // 0x04 - Anzahl Boxes, Tabellen-ID
+/*N*/ // 0x10 - Modified
+/*N*/ // 0x20 - HeadLineRepeat
+/*N*/ BYTE cFlags;
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ cFlags = IsSw31Export() ? 0x04 : 0x05;
+/*N*/ else
+/*N*/ cFlags = 0x03;
+/*N*/ UINT16 nBoxes = 0;
+/*N*/ //JP 16.02.99: ueberflussiges Flag
+/*N*/ // if( rTbl.IsModified() )
+/*N*/ // cFlags |= 0x10;
+/*N*/ if( rTbl.IsHeadlineRepeat() )
+/*N*/ cFlags |= 0x20;
+/*N*/ OpenRec( SWG_TABLE );
+/*N*/ *pStrm << (BYTE) cFlags;
+/*N*/ OpenValuePos16( nBoxes );
+/*N*/
+/*N*/ // Im 3.1/4.0-Format stand hier der Index der Section. Bei IDX_NO_VALUE
+/*N*/ // wurde sie beim Laden nicht registriert.
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ *pStrm << (UINT16)IDX_NO_VALUE;
+/*N*/ if( !IsSw31Export() )
+/*N*/ *pStrm << (BYTE)rTbl.GetTblChgMode();
+/*N*/ OutFormat( SWG_FRAMEFMT, *rTbl.GetFrmFmt() );
+/*N*/ // DDE-Tabelle? Dann den DDE-Feldtyp speichern
+/*N*/ if( IS_TYPE(SwDDETable, &rTbl) )
+/*N*/ {
+/*?*/ SwDDETable* pDDE = (SwDDETable*) &rTbl;
+/*?*/ OutFieldType( *pDDE->GetDDEFldType() );
+/*N*/ }
+/*N*/ if( !IsSw31Or40Export() )
+/*N*/ {
+/*N*/ OutNodeRedlines( rNd.GetIndex() );
+/*N*/ OutNodeRedlines( rNd.EndOfSectionIndex() );
+/*N*/ }
+/*N*/
+/*N*/ for( USHORT i = 0; i < nLines && Good(); i++ )
+/*N*/ nBoxes += OutTableLine( *(rLines[ i ]) );
+/*N*/ CloseValuePos16( nBoxes );
+/*N*/ CloseRec( SWG_TABLE );
+/*N*/ pCurTbl = pOldTbl;
+/*N*/ aStat.nTbl++;
+/*N*/
+/*N*/ delete pTblLineBoxFmts;
+/*N*/ pTblLineBoxFmts = pOldTblLineBoxFmts;
+/*N*/ }
+
+/* */
+
+
+// Einlesen einer Zeile
+// Flag-Byte (0)
+// 0x10 - schon immer unbenutzt. Zur Zeit nicht benutzt,
+// damit die anderen Flags wie bei Boxen sind.
+// 0x20 - FrmFmtId ist vorhanden (seit SW5)
+// 0x40 - FrmFmt ist geshared (seit SW5)
+// String-ID des Frameformats
+// Anzahl Boxes
+// SWG_FRAMEFMT (optional)
+// x-mal SWG_TABLEBOX
+
+
+/*N*/ void Sw3IoImp::InTableLine
+/*N*/ ( SwTableLines& rLines, SwTableBox* pUpper, USHORT nPos, SwNodeIndex& rPos )
+/*N*/ {
+/*N*/ OpenRec( SWG_TABLELINE );
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ UINT16 nBoxes, nFmtId = IDX_NO_VALUE;
+/*N*/ if( !IsVersion(SWG_LONGIDX) || (cFlags & 0x20) != 0 )
+/*N*/ *pStrm >> nFmtId;
+/*N*/ *pStrm >> nBoxes;
+/*N*/ CloseFlagRec();
+/*N*/ SwTableLineFmt* pFmt = 0;
+/*N*/ if( Peek() == SWG_FRAMEFMT )
+/*N*/ {
+/*N*/ pFmt = (SwTableLineFmt*) InFormat( SWG_FRAMEFMT, pDoc->MakeTableLineFmt() );
+/*N*/ lcl_sw3io_AdjustFrmSize( pFmt, nSizeDivFac );
+/*N*/ if( (cFlags & 0x40) != 0 )
+/*N*/ AddTblLineBoxFmt( pFmt );
+/*N*/ }
+/*N*/ else if( (cFlags & 0x20) != 0 )
+/*N*/ {
+/*N*/ pFmt = (SwTableLineFmt *)GetTblLineBoxFmt( nFmtId );
+/*N*/ }
+/*N*/ else if( !IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ // Ja, das funktioniert. Das Format steht zwar in keinem
+/*N*/ // Array mehr, aber es ist im String-Pool gecached.
+/*N*/ pFmt = (SwTableLineFmt *)FindFmt( nFmtId, SWG_FRAMEFMT );
+/*N*/ }
+/*N*/
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ // Default-Werte setzen:
+/*N*/ SwTableLine* pLine = new SwTableLine( pFmt, nBoxes, pUpper );
+/*N*/ rLines.C40_INSERT( SwTableLine, pLine, nPos );
+/*N*/ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+/*N*/ USHORT nBox = 0;
+/*N*/ while( BytesLeft() )
+/*N*/ InTableBox( rBoxes, nBox++, pLine, rPos );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( pFmt, "Line-Format fehlt" );
+/*N*/ Error(); // kein FrameFmt
+/*N*/ }
+/*N*/
+/*N*/ CloseRec( SWG_TABLELINE );
+/*N*/ }
+/*N*/
+/*N*/ BOOL lcl_sw3io_IsLineFmtShared( SwFrmFmt& rFmt, const SwTableLine& rLine )
+/*N*/ {
+/*N*/ SwClientIter aIter( rFmt );
+/*N*/
+/*N*/ SwClient* pLast;
+/*N*/
+/*N*/ for( pLast = aIter.First( TYPE( SwTableLine ));
+/*N*/ pLast && pLast == (SwClient *)&rLine;
+/*N*/ pLast = aIter.Next() )
+/*N*/ ;
+/*N*/
+/*N*/ return pLast != 0;
+/*N*/ }
+
+// Schreiben einer Tabellenzeile. Red Returnwert ist die Summe
+// aller in der Zeile enthaltenen Zellen.
+
+/*N*/ USHORT Sw3IoImp::OutTableLine( const SwTableLine& rLine )
+/*N*/ {
+/*N*/ USHORT nTotalBoxes = 0;
+/*N*/ const SwTableBoxes& rBoxes = rLine.GetTabBoxes();
+/*N*/ UINT16 nBoxes = rBoxes.Count();
+/*N*/
+/*N*/ // 0x10: Format-Id ist enthalten (nur SW5)
+/*N*/ // 0x20: Format ist geshared (nur SW5)
+/*N*/ BYTE cFlags;
+/*N*/
+/*N*/ SwFrmFmt* pFmt = rLine.GetFrmFmt();
+/*N*/ UINT16 nFmtId;
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ cFlags = 0x04; // keine Flags, Fmt-Id, Anzahl Boxen
+/*N*/ nFmtId = GetTblLineBoxFmtStrPoolId40( pFmt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ cFlags = 0x02; // Anzahl Boxen
+/*N*/ if( lcl_sw3io_IsLineFmtShared( *pFmt, rLine ) )
+/*N*/ {
+/*N*/ cFlags += 0x40; // Shared-Flag
+/*N*/ if( pFmt->IsWritten() )
+/*N*/ {
+/*N*/ cFlags += 0x22; // FmtId-Flag + FmtId
+/*N*/ nFmtId = GetTblLineBoxFmtId( pFmt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ AddTblLineBoxFmt( pFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ OpenRec( SWG_TABLELINE );
+/*N*/ *pStrm << (BYTE) cFlags;
+/*N*/ if( IsSw31Or40Export() || (cFlags & 0x20) != 0 )
+/*N*/ *pStrm << nFmtId;
+/*N*/
+/*N*/ *pStrm << nBoxes;
+/*N*/
+/*N*/ // OutFormat schreibt nur noch nicht geschriebene Formate raus,
+/*N*/ // deshalb muss das hier nicht ueberprueft werden.
+/*N*/ OutFormat( SWG_FRAMEFMT, *pFmt );
+/*N*/
+/*N*/ for( USHORT i = 0; i < nBoxes && Good(); i++ )
+/*N*/ nTotalBoxes += OutTableBox( *( rBoxes[ i ]) );
+/*N*/ CloseRec( SWG_TABLELINE );
+/*N*/ return nTotalBoxes;
+/*N*/
+/*N*/ }
+
+/* */
+
+
+// Einlesen einer Zelle
+// BYTE Flag-Byte
+// 0x10 - Zelle enthaelt weitere Zeilen
+// 0x20 - Zellen enthaelt leeren Contentbereich (nie exportiert)
+// 0x20 - FrmFmtId ist vorhanden (seit SW5)
+// 0x40 - FrmFmt ist geshared (seit SW5)
+// UINT16 String-ID des Frameformats
+// UINT16 Anzahl Zeilen oder Section-ID (opt)
+// SWG_FRAMEFMT (optional)
+// SWG_CONTENTS Inhalt oder
+// SWG_TABLELINE (optional, mehrfach)
+
+
+/*N*/ void Sw3IoImp::InTableBox
+/*N*/ (SwTableBoxes& rBoxes, USHORT nPos, // Array und Index
+/*N*/ SwTableLine* pUpper, // uebergeordnete Zeile
+/*N*/ SwNodeIndex& rPos ) // Start-Index der Section
+/*N*/ {
+/*N*/ OpenRec( SWG_TABLEBOX );
+/*N*/ BYTE cFlags = OpenFlagRec();
+/*N*/ UINT16 nFmtId = IDX_NO_VALUE, nLines = 0;
+/*N*/ if( !IsVersion(SWG_LONGIDX) || (cFlags & 0x20) != 0 )
+/*N*/ *pStrm >> nFmtId;
+/*N*/ if( cFlags & 0x10 )
+/*N*/ *pStrm >> nLines;
+/*N*/ CloseFlagRec();
+/*N*/
+/*N*/ // Frame-Format evtl. einlesen
+/*N*/ SwTableBoxFmt* pFmt = NULL;
+/*N*/ if( Peek() == SWG_FRAMEFMT )
+/*N*/ {
+/*N*/ pFmt = (SwTableBoxFmt*) InFormat( SWG_FRAMEFMT, pDoc->MakeTableBoxFmt() );
+/*N*/ lcl_sw3io_AdjustFrmSize( pFmt, nSizeDivFac );
+/*N*/ if( (cFlags & 0x40) != 0 )
+/*N*/ AddTblLineBoxFmt( pFmt );
+/*N*/ }
+/*N*/ else if( (cFlags & 0x20) != 0 )
+/*N*/ {
+/*N*/ ASSERT( IsVersion(SWG_LONGIDX), "0x20 doch schon frueher benutzt?" );
+/*N*/ pFmt = (SwTableBoxFmt *)GetTblLineBoxFmt( nFmtId );
+/*N*/ }
+/*N*/ else if( !IsVersion(SWG_LONGIDX) )
+/*N*/ {
+/*N*/ // Ja, das funktioniert. Das Format steht zwar in keinem
+/*N*/ // Array mehr, aber es ist im String-Pool gecached.
+/*N*/ pFmt = (SwTableBoxFmt *)FindFmt( nFmtId, SWG_FRAMEFMT );
+/*N*/ }
+/*N*/
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ SwTableBox* pBox;
+/*N*/ if( Peek() == SWG_CONTENTS )
+/*N*/ {
+/*N*/ pBox = new SwTableBox( pFmt, rPos, pUpper );
+/*N*/ InContents( rPos );
+/*N*/
+/*N*/ // JP 12.09.97 - Bug 41223:
+/*N*/ // falls an der International Einstellung gedreht wurde, so muss
+/*N*/ // jetzt die entsprechende Aktualisierung erfolgen.
+/*N*/ pBox->ChgByLanguageSystem();
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ++nCntntBox;
+/*N*/ #endif
+/*N*/ }
+/*N*/ else
+/*N*/ pBox = new SwTableBox( pFmt, nLines, pUpper );
+/*N*/ rBoxes.C40_INSERT( SwTableBox, pBox, nPos );
+/*N*/ USHORT nBoxPos = 0;
+/*N*/ if( !BytesLeft() )
+/*N*/ {
+/*N*/ // JP 05.05.97: Bug 39569 - Zelle ohne StartNode und ohne Lines
+/*N*/ if( !pBox->GetSttNd() )
+/*N*/ {
+/*?*/ //JP 19.06.98: erst die neue Box erzeugen, damit diese sich
+/*?*/ // als abhaengig ins Format eintraegt; sonst wird
+/*?*/ // das Format im BoxDTOR geloescht !!!
+/*?*/ SwTableBox* pNewBox = new SwTableBox( pFmt, rPos, pUpper );
+/*?*/ rBoxes.C40_REPLACE( SwTableBox, pNewBox, nPos );
+/*?*/ delete pBox;
+/*?*/ pBox = pNewBox;
+/*?*/ rPos = pBox->GetSttNd()->EndOfSectionIndex() + 1;
+/*?*/ #ifdef DBG_UTIL
+/*?*/ ASSERT( !this, "Tabellenzelle ohne Lines und ohne Content" );
+/*?*/ ++nCntntBox;
+/*?*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ while( BytesLeft() )
+/*N*/ InTableLine( pBox->GetTabLines(), pBox, nBoxPos++, rPos );
+/*N*/
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( pFmt, "Box-Format fehlt" );
+/*N*/ Error(); // kein FrmFmt
+/*N*/ }
+/*N*/ CloseRec( SWG_TABLEBOX );
+/*N*/ }
+
+/*N*/ BOOL lcl_sw3io_IsBoxFmtShared( SwFrmFmt& rFmt, const SwTableBox& rBox )
+/*N*/ {
+/*N*/ SwClientIter aIter( rFmt );
+/*N*/
+/*N*/ SwClient* pLast;
+/*N*/
+/*N*/ for( pLast = aIter.First( TYPE( SwTableBox ));
+/*N*/ pLast && pLast == (SwClient *)&rBox;
+/*N*/ pLast = aIter.Next() )
+/*N*/ ;
+/*N*/
+/*N*/ return pLast != 0;
+/*N*/ }
+/*N*/
+/*N*/ USHORT Sw3IoImp::OutTableBox( const SwTableBox& rBox )
+/*N*/ {
+/*N*/ const SwTableLines& rLines = rBox.GetTabLines();
+/*N*/ USHORT nLines = rLines.Count();
+/*N*/ USHORT nTotalBoxes = 0;
+/*N*/
+/*N*/ BYTE cFlags;
+/*N*/
+/*N*/ UINT16 nFmtId;
+/*N*/ SwFrmFmt* pFmt = rBox.GetFrmFmt();
+/*N*/ if( IsSw31Or40Export() )
+/*N*/ {
+/*N*/ cFlags = 0x02; // keine Flags, FmtId
+/*N*/ nFmtId = GetTblLineBoxFmtStrPoolId40( pFmt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ cFlags = 0x00; // keine Flags, keine Daten
+/*N*/ if( lcl_sw3io_IsBoxFmtShared( *pFmt, rBox ) )
+/*N*/ {
+/*N*/ cFlags += 0x40; // Format ist geshared
+/*N*/ if( pFmt->IsWritten() )
+/*N*/ {
+/*N*/ cFlags += 0x22; // FmtId-Flag + FmtId
+/*N*/ nFmtId = GetTblLineBoxFmtId( pFmt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ AddTblLineBoxFmt( pFmt );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nLines )
+/*N*/ cFlags += 0x12;
+/*N*/ OpenRec( SWG_TABLEBOX );
+/*N*/ *pStrm << (BYTE) cFlags;
+/*N*/ if( IsSw31Or40Export() || (cFlags & 0x20) != 0 )
+/*N*/ *pStrm << (UINT16) nFmtId;
+/*N*/ if( cFlags & 0x10 )
+/*N*/ *pStrm << (UINT16) nLines;
+/*N*/ OutFormat( SWG_FRAMEFMT, *pFmt );
+/*N*/ if( rBox.GetSttNd() )
+/*N*/ // Inhalt ausgeben
+/*N*/ OutContents( SwNodeIndex( *rBox.GetSttNd() ) );
+/*N*/ if( nLines )
+/*N*/ {
+/*N*/ // Falls Zeilen vorhanden, diese ausgeben
+/*N*/ for( USHORT i = 0; i < nLines; i++)
+/*N*/ nTotalBoxes += OutTableLine( *( rLines[ i ]) );
+/*N*/ }
+/*N*/ else
+/*N*/ nTotalBoxes++;
+/*N*/ CloseRec( SWG_TABLEBOX );
+/*N*/ return nTotalBoxes;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/frmids.hxx b/binfilter/bf_sw/source/core/swg/frmids.hxx
new file mode 100644
index 000000000000..d2588f525cf9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/frmids.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FRMIDS_HXX
+#define _FRMIDS_HXX
+
+// Aktuelle Version:
+namespace binfilter {
+
+#define FRMVER_NEWFLY 0x0002 // Neue Ablage der absatzgebundenen Flys
+#define FRMVER_EXTINFO 0x0003 // Optionales Extended-Info-Byte
+#define FRMVER_NEWALIGN 0x0004 // Alignment wurde Layoutseitig geaendert
+ // es muss geeignet invalidiert werden.
+
+#define FRM_VERSION 0x0004
+
+// ID-Byte als 1. Byte:
+
+#define FRMID_ROOT 'R' // Root-Frame
+#define FRMID_PAGE 'P' // Seite
+#define FRMID_HEADER 'H' // Kopfzeilen
+#define FRMID_FOOTER 'F' // Fusszeilen
+#define FRMID_BODY 'B' // Arbeitsbereich
+#define FRMID_FTNCONT 'C' // Fussnoten-Container
+#define FRMID_FTN 'N' // Fussnote
+#define FRMID_TEXT 'X' // Text-Frame
+#define FRMID_GRAPHICS 'G' // Grafik-Frame
+#define FRMID_OLE 'O' // OLE-Frame (reserviert)
+#define FRMID_ATCNTNT 'A' // am Inhalt gebundener Rahmen
+#define FRMID_INCNTNT 'I' // im Inhalt gebundener Rahmen
+#define FRMID_FLYLAY 'L' // Seiten/spaltengebundener Rahmen
+#define FRMID_COLUMN 'M' // Spalten-Frame
+#define FRMID_TABLE 'T' // Tabellen-Frame
+#define FRMID_TABROW 'r' // Tabellen-Zeile
+#define FRMID_TABCELL 'c' // Tabellen-Zelle
+
+// Flag-Bits im 2. Byte:
+
+#define FRMF_PRINT 0x01 // Frame hat eigenen Print-Rahmen
+#define FRMF_HASFLY 0x02 // Frame hat FlyFrames
+#define FRMF_HASLOWER 0x04 // Frame hat Lower Frames
+#define FRMF_HASFOLLOW 0x08 // Frame *hat* Follow-Frames
+#define FRMF_ISFOLLOW 0x10 // Frame *ist* Follow-Frame
+#define FRMF_SECTID1 0x20 // Section-ID ist einstellig
+#define FRMF_NODEID1 0x40 // Node-ID ist einstellig
+#define FRMF_HASID 0x80 // Frame hat eigenen ID
+
+// Zusatz-Bit, vom Reader in nFrmFlags zu setzen
+
+#define FRMF_INVALID 0x8000 // Frames ungueltig setzen
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/makefile.mk b/binfilter/bf_sw/source/core/swg/makefile.mk
new file mode 100644
index 000000000000..5f6898bdc501
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/makefile.mk
@@ -0,0 +1,73 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_swg
+
+NO_HIDS=TRUE
+
+AUTOSEG=true
+#ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_rdcont.obj \
+ $(SLO)$/sw_rdflds.obj \
+ $(SLO)$/sw_rdfmts.obj \
+ $(SLO)$/sw_rdhnt.obj \
+ $(SLO)$/sw_rdmisc.obj \
+ $(SLO)$/sw_rdnds.obj \
+ $(SLO)$/sw_rdnum.obj \
+ $(SLO)$/sw_rdpage.obj \
+ $(SLO)$/sw_rdswg.obj \
+ $(SLO)$/sw_rdtox.obj \
+ $(SLO)$/sw_swgpar.obj \
+ $(SLO)$/sw_swgstr.obj \
+ $(SLO)$/sw_SwXMLSectionList.obj
+
+EXCEPTIONSFILES = \
+ $(SLO)$/sw_SwXMLSectionList.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/binfilter/bf_sw/source/core/swg/oldhntid.hxx b/binfilter/bf_sw/source/core/swg/oldhntid.hxx
new file mode 100644
index 000000000000..85bce76d65c1
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/oldhntid.hxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef _OLDHNTID_HXX
+#define _OLDHNTID_HXX
+namespace binfilter {
+// ID-s fuer die Formate
+
+enum OLDRES_FMT
+{
+OLDRES_FMT_BEGIN = 1, // HIER GEHT'S LOS !!!
+OLDRES_CHRFMT = OLDRES_FMT_BEGIN,
+// Id fuer den Text ( fuer die Text-Attribute ), CheckWhich()
+OLDRES_CHRTEXT,
+OLDRES_PARFMT,
+OLDRES_FRMFMT,
+OLDRES_FLYFRMFMT,
+OLDRES_GRFFMT,
+OLDRES_FMT_END
+};
+
+// Bereiche fuer die Id's der einzelnen Format-Attribute
+// die Which-Werte fuer die Charakter-Format Attribute
+enum OLDRES_CHRATR
+{
+OLDRES_CHRATR_BEGIN = OLDRES_FMT_END,
+OLDRES_CHRATR_CASEMAP = OLDRES_CHRATR_BEGIN,
+OLDRES_CHRATR_CHARWIDTH,
+OLDRES_CHRATR_COLOR,
+OLDRES_CHRATR_CONTOUR,
+OLDRES_CHRATR_CROSSEDOUT,
+OLDRES_CHRATR_ESCAPEMENT,
+OLDRES_CHRATR_FONT,
+OLDRES_CHRATR_FONTSIZE,
+OLDRES_CHRATR_INVERTED,
+OLDRES_CHRATR_KERNING,
+OLDRES_CHRATR_LANGUAGE,
+OLDRES_CHRATR_MIRRORED,
+OLDRES_CHRATR_POSTURE,
+OLDRES_CHRATR_PROPORTIONALFONTSIZE,
+OLDRES_CHRATR_SHADOWED,
+OLDRES_CHRATR_UNDERLINE,
+OLDRES_CHRATR_WEIGHT,
+OLDRES_CHRATR_WRITINGDIRECTION,
+OLDRES_CHRATR_FIELD,
+OLDRES_CHRATR_NOLINEBREAK,
+OLDRES_CHRATR_NOHYPHEN,
+OLDRES_CHRATR_SOFTHYPH,
+OLDRES_CHRATR_FTN,
+OLDRES_CHRATR_HARDBLANK,
+OLDRES_CHRATR_END
+};
+
+// die Which-Werte fuer die Charakter-Text Attribute
+// (diese wirken sich direkt auf den Font aus !!)
+enum OLDFONT_TXTATR
+{
+OLDRES_TXTATR_BEGIN = OLDRES_CHRATR_END,
+OLDFONT_TXTATR_BEGIN = OLDRES_TXTATR_BEGIN,
+OLDRES_TXTATR_CHARWIDTH = OLDFONT_TXTATR_BEGIN,
+OLDRES_TXTATR_COLOR,
+OLDRES_TXTATR_CONTOUR,
+OLDRES_TXTATR_CROSSEDOUT,
+OLDRES_TXTATR_FONT,
+OLDRES_TXTATR_FONTSIZE,
+OLDRES_TXTATR_INVERTED,
+OLDRES_TXTATR_LANGUAGE,
+OLDRES_TXTATR_MIRRORED,
+OLDRES_TXTATR_POSTURE,
+OLDRES_TXTATR_PROPORTIONALFONTSIZE,
+OLDRES_TXTATR_SHADOWED,
+OLDRES_TXTATR_UNDERLINE,
+OLDRES_TXTATR_WEIGHT,
+OLDRES_TXTATR_CHARFMT,
+OLDFONT_TXTATR_END
+};
+
+// diese Text-Attribute wirken sich !nicht! auf den Font aus!
+enum OLDETC_TXTATR
+{
+OLDETC_TXTATR_BEGIN = OLDFONT_TXTATR_END,
+OLDRES_TXTATR_WRITINGDIRECTION = OLDETC_TXTATR_BEGIN,
+OLDRES_TXTATR_KERNING,
+OLDRES_TXTATR_NOLINEBREAK,
+OLDRES_TXTATR_NOHYPHEN,
+OLDRES_TXTATR_INSERTED,
+OLDRES_TXTATR_DELETED,
+OLDRES_TXTATR_ESCAPEMENT,
+OLDRES_TXTATR_CASEMAP,
+OLDRES_TXTATR_FIELD,
+OLDRES_TXTATR_FLYCNT,
+OLDRES_TXTATR_TOXMARK,
+OLDRES_TXTATR_SOFTHYPH,
+OLDRES_TXTATR_FTN,
+OLDRES_TXTATR_HARDBLANK,
+OLDRES_TXTATR_REFMARK,
+OLDETC_TXTATR_END,
+OLDRES_TXTATR_END = OLDETC_TXTATR_END
+};
+
+enum OLDRES_PARATR
+{
+OLDRES_PARATR_BEGIN = OLDRES_TXTATR_END,
+OLDRES_PARATR_LINESPACING = OLDRES_PARATR_BEGIN,
+OLDRES_PARATR_FIRSTLINEOFFSET,
+OLDRES_PARATR_ADJUST,
+OLDRES_PARATR_SPLIT,
+OLDRES_PARATR_WIDOWS,
+OLDRES_PARATR_ORPHANS,
+OLDRES_PARATR_TABSTOP,
+OLDRES_PARATR_HYPHENZONE,
+OLDRES_PARATR_DROP,
+OLDRES_PARATR_END
+};
+
+
+// Id's fuer die Text Additives
+enum OLDRES_ADD
+{
+OLDRES_ADD_BEGIN = OLDRES_PARATR_END,
+UNUSED_OLDRES_ADD_POSTIT = OLDRES_ADD_BEGIN,
+OLDRES_ADD_INSERTS,
+OLDRES_ADD_AUTOTEXT,
+OLDRES_ADD_OTHERCONTENT,
+OLDRES_ADD_END
+};
+
+enum OLDRES_FRMATR
+{
+OLDRES_FRMATR_BEGIN = OLDRES_ADD_END,
+OLDRES_FILL_ORDER = OLDRES_FRMATR_BEGIN,
+OLDRES_FRM_SIZE,
+OLDRES_PAGE_BREAK,
+OLDRES_SEL_PAGE,
+OLDRES_PAPER_TRAY,
+OLDRES_FRM_RNDREQUEST,
+OLDRES_FRM_RNDSUPPLY,
+OLDRES_LR_SPACE,
+OLDRES_UL_SPACE,
+OLDRES_CNTNT,
+OLDRES_HEADER,
+OLDRES_FOOTER,
+OLDRES_FLY_PRINT,
+OLDRES_FLY_OPAQUE,
+OLDRES_FLY_PROTECT,
+OLDRES_FLY_MAINCNTNT,
+OLDRES_FLY_VERT_ORIENT,
+OLDRES_FLY_HORI_ORIENT,
+OLDRES_FLY_GENERIC,
+OLDRES_FLY_ANCHOR,
+OLDRES_BACKGROUND,
+OLDRES_BOX,
+OLDRES_SHADOW,
+OLDRES_PAGEDESC,
+OLDRES_FRMMACRO,
+OLDRES_COL_BREAK,
+OLDRES_COL,
+OLDRES_FRMATR_END
+};
+
+enum OLDRES_GRFATR
+{
+OLDRES_GRFATR_BEGIN = OLDRES_FRMATR_END,
+OLDRES_GRFATR_GRFSIZE = OLDRES_GRFATR_BEGIN,
+OLDRES_GRFATR_MIRRORGRF,
+OLDRES_GRFATR_GRFOFFSET,
+OLDRES_GRFATR_ALIGNGRF,
+OLDRES_GRFATR_CROPGRF,
+OLDRES_GRFATR_END
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/rdswg.hxx b/binfilter/bf_sw/source/core/swg/rdswg.hxx
new file mode 100644
index 000000000000..90637e2169ce
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/rdswg.hxx
@@ -0,0 +1,332 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _RDSWG_HXX
+#define _RDSWG_HXX
+
+#include <vcl/prntypes.hxx>
+
+#include <bf_svtools/svarray.hxx>
+#include <swgstr.hxx>
+#include <swgids.hxx>
+class Brush;
+class Color;
+class Pen;
+namespace binfilter {
+class SfxItemSet;
+
+class SwRect;
+class SwPaM;
+class SwDoc;
+class SwFrm;
+class SwFmt;
+class SwAttrSet;
+class SwNumFmt;
+class SwNumRule;
+class SwPageDesc;
+class SwPageFtnInfo;
+class SwNode;
+class SwCntntNode;
+class SwTxtNode;
+class SwTOXBase;
+class SwNodeIndex;
+class SwTable;
+class SwTableBox;
+class SwTableBoxes;
+class SwTableLine;
+class SwTableLines;
+class SwField;
+class SwFieldType;
+class SwpHints;
+
+
+class SwBlockNames;
+class SwStartNode;
+
+class SfxDocumentInfo;
+
+struct FmtInfo { // Format-Deskriptor:
+ union {
+ SfxItemSet* pSet; // AttrSet oder
+ SwFmt* pFmt; // Format
+ };
+ BYTE cFmt; // Bitflags
+};
+
+#define FINFO_FORMAT 0x01 // Eintrag ist Format
+#define FINFO_LOCAL 0x02 // Eintrag ist lokal
+
+struct TxtCollInfo { // Textcollection-Info:
+ USHORT nDerived; // Abhaengigkeit
+ USHORT nFollow; // Folgeindex
+};
+
+struct PageDescInfo { // Seitenbeschreibungs-Info:
+ USHORT nPoolId; // Pool-ID
+ USHORT nActualIdx; // der tatsaechliche Index
+ USHORT nFollow; // Folgeindex
+};
+
+struct NumRuleInfo { // Numerierungs-Regeln:
+ SwNumRule* pNumRule; // dazugehoerige Regel
+ SwTxtNode* pBgn, *pEnd; // Anfang + Ende im Nodes-Array
+};
+
+struct FrmInfo { // Frame-ID-Info:
+ SwFrm* pFrm; // der Frame
+ USHORT nId; // und sein ID
+};
+
+struct LanguageInfo { // Sprach-Info:
+ USHORT nLanguage; // Sprache
+ BOOL bSupported; // TRUE, wenn unterstuetzt
+};
+
+class PageDescLink : public String{ // Verknuepfung Format mit Seite
+public:
+ PageDescLink* pLink; // Link zum naechsten
+ USHORT nOffset; // Offset
+ union {
+ SwAttrSet* pSet; // AttrSet oder
+ SwFmt* pFmt; // Format
+ };
+ BYTE cFmt; // TRUE: Ptr ist Format
+ PageDescLink( const String& s, USHORT n ) : String( s )
+ { pLink = NULL; pSet = NULL; cFmt = FALSE; nOffset = n; }
+};
+
+struct SectionInfo { // Section-Info:
+ USHORT nId; // Section ID
+ SwNode* pNode1; // StartNode
+};
+
+typedef const SwTable *SwgSwTablePtr;
+SV_DECL_PTRARR(SwgTables,SwgSwTablePtr,4,4)
+
+ class SwSwgReader
+ {
+ friend class Sw2TextBlocks;
+
+ private:
+ ULONG nErrno; // Fehlernummer
+ SwPaM* pPaM; // WriterG-Einfuegepos
+ long nDocStart; // Beginn des Dokuments
+ long nRecStart; // Beginn der Records im Dokument
+ long nNextDoc; // Offset des naechsten Dokuments
+ FrmInfo* pFrms; // Frame-ID-Infos
+ FmtInfo* pFmts; // Format-Infos
+ TxtCollInfo* pCollIdx; // Collection Index translation table
+ PageDescInfo* pLayIdx; // Layout Index translation table
+ PageDescLink* pPageLinks; // Format-Seiten-Links
+ NumRuleInfo* pRules; // Num-Regelwerk
+ SectionInfo* pSects; // Sections
+ SectionInfo* pLastSect; // letzte Section
+ LanguageInfo* pLanguages; // Sprachen
+ const ByteString* pNdOrigTxt; // original text of the textnode
+
+ USHORT nColl, nLay; // Anzahl Collections, Seitenlayouts
+ USHORT nRules; // Anzahl Regeln
+ USHORT nNamedFmt; // Anzahl benannte Formate (fuer Textbausteine)
+ USHORT nFrm, nFrmSize; // Anzahl Frame-IDs, Tabellengroesse
+ USHORT nSect, nSectSize; // Anzahl Sections, Tabellengroesse
+ USHORT nTbl, nTblSize; // Anzahl Tabellen, Tabellengroesse
+ USHORT nLang, nLangSize; // Anzahl Sprachen, Tabellengroesse
+ USHORT nOptions; // Lese-Optionen
+ USHORT nHelpFileId; // Hilfe-ID fuer Vorlagen-Templates
+ USHORT nFlyLevel; // != 0: FlyFmt wird eingelesen
+ USHORT nFlagBits; // temp fuer PageDesc: Bits aus Format
+ USHORT nFmtLvl; // Rekursionstiefe fuer InFormat()
+ USHORT nTblBoxLvl; // Rekursionstiefe fuer InFormat in InTableBox()
+
+ SfxDocumentInfo* pInfo;
+ String aFileName; // Name vom Eingabe-Stream
+ SwgTables *pTables;
+
+ // gc25: swistream besitzt privaten Copy-CTOR
+ SwSwgReader( const SwSwgReader & );
+
+ BOOL LoadDocInfo( SfxDocumentInfo& );
+
+ short LayoutIdx( short n );
+ void UpdateRuleRange( USHORT nIdx, SwTxtNode* pNd );
+ void ResolvePageDescLinks();
+ String ParseText();
+ // void ConvertLineTerminators( String&, GUIType );
+ void LoadHeader();
+
+ void InTxtFmtColls();
+ void InTxtFmtColl( short nIdx );
+
+ void InPageDescs();
+ void InPageDesc( short nIdx );
+ void InPageFtnInfo( SwPageFtnInfo& rFtn );
+
+ void InTextHints( SwTxtNode& rNd, xub_StrLen nOffset );
+ void InNodeBookmark( SwNodeIndex& rPos );
+ USHORT GetNextSymbolFontHint( SwpHints*, USHORT, xub_StrLen&, xub_StrLen& );
+ USHORT GetNextCharsetColorHint( SwpHints*, USHORT, xub_StrLen&,
+ xub_StrLen&, rtl_TextEncoding,
+ rtl_TextEncoding&);
+ void ConvertText( SwTxtNode& rNd, rtl_TextEncoding eSrc );
+ void SetAttrSet( SwCntntNode& rNd, USHORT nId );
+ void InTxtNodeAttrs( SwTxtNode& rNd, USHORT nWhich1, USHORT nWhich2 );
+ void FillTxtNode( SwTxtNode* pNd, SwNodeIndex& rPos, xub_StrLen nOffset, USHORT=0);
+ void FillString( String& );
+ void InGrfNode( SwNodeIndex& rPos );
+ void InOleNode( SwNodeIndex& rPos );
+
+ SwTOXBase* InTOXBase();
+ void InTOXContents( SwNodeIndex& rPos, SwTxtNode* );
+ void InTOX( SwNodeIndex& rPos, SwTxtNode* );
+
+ void InContents( BOOL bNode1 = TRUE, BOOL bBlock = FALSE, USHORT=0 );
+ String InContentsText( BOOL = TRUE );
+ void ScanContents( SwBlockNames* );
+
+ void InFlyFrames( const SwNodeIndex* pNdIdx );
+ void InFlyFrame( const SwNodeIndex* pNdIdx );
+
+ void InDfltFmts();
+ void InNamedFmts( USHORT );
+ void ClearFmtIds();
+
+ void InTableBox( SwTableBoxes&, int, SwTableLine*, SwNodeIndex&,
+ const SwTable *pTable=0 );
+ void InTableLine( SwTableLines&, SwTableBox*, int, SwNodeIndex&,
+ const SwTable *pTable=0 );
+ void InTable( SwNodeIndex& rPos );
+
+ void InNumFmt( SwNumFmt& rFmt );
+ SwNumRule* InNumRule();
+ void InOutlineRule();
+ void InTxtNumRule();
+ void InFtnInfo();
+
+ void InGlobalMacroTbl();
+ void InJobSetup();
+ void InDocInfo();
+ void InStaticDocInfo( SfxDocumentInfo& );
+ void InDynamicDocInfo( SfxDocumentInfo& );
+ void InComment();
+
+ void InLayoutFrames();
+
+ USHORT InHint( SfxItemSet& );
+ USHORT InHint( SwTxtNode&, xub_StrLen, xub_StrLen );
+
+ void InFieldTypes();
+ SwFieldType* InFieldType();
+
+ BOOL CopyRecord( SvStream* );
+
+ public:
+ SwDoc* pDoc; // WriterG-Dokumentzugriff
+ BOOL bNew; // Darf es was neues sein?
+ xub_StrLen nCntntCol; // Spalte fuer Rahmen im Node (RES_FLY_ANCHOR)
+ USHORT nPage1; // Start-Seite bei Einfuegen (RES_FLY_ANCHOR)
+ swistream r; // Input-Stream
+ // SvStream r; // Input-Stream
+ DocHeader aHdr; // Dokument-Header
+ FileHeader aFile; // Datei-Header
+ USHORT nStatus; // Status-Flags:
+
+ #define SWGSTAT_SHAREDFMT 0x0001 // Shared Fmt wird eingelesen
+ #define SWGSTAT_UPDATEEXPR 0x0002 // ExprFields-Update noetig
+ #define SWGSTAT_NO_BOOKMARKS 0x0004 // Bookmarks ueberlesen
+ #define SWGSTAT_LOCALFMTS 0x0008 // lokale Formate
+ #define SWGSTAT_CONVBLOCKS 0x0010 // Konversion von Textbausteinen
+
+ // Ablage-Variable fuer Lesen von Layout-Frames
+ USHORT nFrmFlags; // Layout-Frame-Flags
+ SwFrm* pUpper; // Upper Layout-Frame
+ SwFrm* pMaster; // Master Layout-Frame
+ USHORT eStartNodeType; // fuers erzeugen von StartNodes
+ // Fly/Footer/Header!
+
+ SwSwgReader( SwDoc *pSwDoc, const SwPaM* pSwPaM, SvStream& rStream,
+ const String& rFileName, BOOL bNewDoc );
+ ~SwSwgReader();
+ ULONG GetError() { return nErrno; }
+
+ const SfxDocumentInfo& GetDocInfo() { return *pInfo; }
+
+ void LoadFileHeader();
+ ULONG Read( USHORT nOptions );
+ ULONG Scan( SwBlockNames* );
+ BOOL CheckPasswd( const String& );
+
+ void RegisterFmt( SwFmt& rFmt, const SwTable *pTable=0 );
+ void RegisterAttrSet( SfxItemSet* pSet, USHORT nIdx );
+ void ReleaseAttrSets();
+ void ReRegisterFmt( const SwFmt& rFmtOld, const SwFmt& rFmtNew,
+ const SwTable *pTable=0 );
+ SwFmt* FindFmt( USHORT nIdx, BYTE cType );
+ SfxItemSet* FindAttrSet( USHORT nIdx );
+ SwFmt* InFormat( SwFmt* pFmt = NULL, USHORT* pParentId = 0 );
+ USHORT InAttrSet( SwAttrSet& rSet );
+ USHORT InAttrSet( SwCntntNode& rNd );
+ void FillAttrSet( SwAttrSet& rSet, USHORT nId );
+ BOOL TestPoolFmt( SwFmt&, int );
+
+ void RegisterFrmId( SwFrm& rFrm, USHORT nId );
+ SwFrm* FindFrmId( USHORT nId );
+
+ void RegisterTable( USHORT nIdx, const SwTable *pTable );
+ const SwTable *FindTable( USHORT nIdx );
+
+ USHORT RegisterSection( const SwNodeIndex& rStart, USHORT nId );
+
+ SwNode* InNodeId();
+ SwFrm* InFrame();
+ void InFrmRect( SwRect&, SwRect* );
+
+ SwPageDesc& FindPageDesc( USHORT nIdx );
+
+ // Methoden fuer Hints:
+ void Error( ULONG = 0 );
+ void AddPageDescLink( const String&, USHORT nOff );
+ String GetText( BOOL bReq = TRUE );
+ ByteString GetAsciiText( BOOL bReq = TRUE );
+ SwField* InField();
+ SwStartNode* InSection();
+ void FillSection( SwNodeIndex& rPos );
+ void InTextBlock( long );
+ Color InColor();
+ void InPen(USHORT& nWidth, Color& rCol);
+ Color InBrush();
+
+ void SetReadTxt( const ByteString* pTxt ) { pNdOrigTxt = pTxt; }
+ const ByteString* GetReadTxt() const { return pNdOrigTxt; }
+
+ BOOL IsTableBoxFrmFmt() { return BOOL( nFmtLvl == (nTblBoxLvl+1) ); }
+ };
+
+
+} //namespace binfilter
+#endif // _RDSWG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_SwXMLSectionList.cxx b/binfilter/bf_sw/source/core/swg/sw_SwXMLSectionList.cxx
new file mode 100644
index 000000000000..995b19bba002
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_SwXMLSectionList.cxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_STRINGS
+#include <bf_svtools/svstdarr.hxx>
+#include <SwXMLSectionList.hxx>
+#include <bf_xmloff/xmltoken.hxx>
+#include <bf_xmloff/nmspmap.hxx>
+#include <bf_xmloff/xmlnmspe.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::rtl;
+using namespace ::binfilter::xmloff::token;
+#include <tools/debug.hxx> //STRIP001
+namespace binfilter {
+sal_Char __READONLY_DATA sXML_np__block_list[] = "_block-list";
+
+// #110680#
+/*N*/ SwXMLSectionList::SwXMLSectionList(
+/*N*/ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
+/*N*/ SvStrings & rNewSectionList)
+/*N*/ : SvXMLImport( xServiceFactory ),
+/*N*/ rSectionList ( rNewSectionList )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 GetNamespaceMap().Add( OUString ( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__block_list ) ),
+/*N*/ }
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdcont.cxx b/binfilter/bf_sw/source/core/swg/sw_rdcont.cxx
new file mode 100644
index 000000000000..d0b76d28a791
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdcont.cxx
@@ -0,0 +1,662 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <errhdl.hxx>
+
+#include "pam.hxx"
+
+#include <fmtfsize.hxx>
+#include "rdswg.hxx"
+#include "swgpar.hxx"
+#include "ndtxt.hxx"
+#include "bookmrk.hxx"
+#include "swtable.hxx"
+#include "mdiexp.hxx" // Progress
+#include "swddetbl.hxx"
+#include "swtblfmt.hxx"
+namespace binfilter {
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Achtung: Jede Routine nimmt an, dass der Record-Header bereits eingelesen
+// ist. Sie arbeitet den Record so weit ab wie moeglich und schliesst den
+// Vorgang mit end() ab.
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Contents-Teil
+
+// Wird ein Text in einen Absatz eingefuegt, wird der erste Absatz an den
+// ersten Teil angefuegt, ohne die Formate zu uebernehmen. Alle anderen
+// Absaetze uebernehmen die Formate, was auch den Rest des alten Absatzes
+// betrifft.
+// Falls bNode1 FALSE ist, wird ein evtl. vorhandener leerer Node nicht
+// gefuellt. Dadurch laesst sich diese Methode fuer mehrere Contents
+// verwenden.
+// Falls bBlock TRUE ist, handelt es sich um das Einlesen eies Textblock-
+// Inhalts. Hier gibt es keinen Section-ID und auch keine Registrierrung
+// der Section!
+// nInsFirstPara - beim Document einfuegen, muss der erste Absatz
+// sonderbehandelt werden (Absatz Attribute!)
+
+typedef SwTableBox* SwTableBoxPtr;
+
+void SwSwgReader::InContents( BOOL bNode1, BOOL bBlock, USHORT nInsFirstPara )
+{
+ USHORT nNodes, nId = IDX_NO_VALUE;
+ USHORT nOldStatus = nStatus;
+ // Beim Einlesen eines TB keine Bookmarks einlesen!
+ // Auch sollen alle Autoformate (AttrSets) wiederverwendbar sein!
+ if( bBlock )
+ {
+ ReleaseAttrSets();
+ nStatus |= SWGSTAT_NO_BOOKMARKS | SWGSTAT_LOCALFMTS;
+ }
+ if( !bBlock )
+ r >> nId;
+ r >> nNodes;
+ r.next();
+
+ // fuer die Sonderbehandlung des ersten/letzten Node beim "Datei/Einfuegen"
+ USHORT nSaveInsFirstPara = nInsFirstPara;
+
+ // Bei einem echten Insert muss der aktuelle Node gesplittet werden,
+ // Falls mehr als 1 Node eingelesen wird.
+ BOOL bIns = BOOL( !bNew );
+ BOOL bSplit = FALSE;
+ SwTxtNode* pLast = NULL;
+ SwNodeIndex aPos( pPaM->GetPoint()->nNode );
+ xub_StrLen nOffset = pPaM->GetPoint()->nContent.GetIndex();
+ SwNode* pStart = pDoc->GetNodes()[ aPos ];
+ SwTxtNode* pNd = bNode1 ? pStart->GetTxtNode() : NULL;
+ if( !bBlock )
+ {
+ RegisterSection( SwNodeIndex( *pStart->StartOfSectionNode() ), nId );
+ }
+ for( USHORT i = 1; i <= nNodes && r.good(); i++)
+ {
+ ::binfilter::SetProgressState( r.tell(), pDoc->GetDocShell() );
+
+ switch( r.cur() )
+ {
+ case SWG_TEXTNODE:
+ // Der Node muss gesplittet werden,
+ // wenn mehrere Nodes inserted werden
+ if( !bSplit && bIns && nNodes > 1 )
+ {
+ if( pNd )
+ {
+ // natuerlich nur TextNodes splitten
+ SwPosition aSplitPos( aPos, SwIndex( pNd, nOffset ) );
+ pDoc->SplitNode( aSplitPos );
+ pLast = pNd;
+ aPos--;
+ pNd = pDoc->GetNodes()[ aPos ]->GetTxtNode();
+ bSplit = TRUE;
+ }
+ }
+ else if( i == nNodes && pLast )
+ {
+ // der letzte Node: nimm evtl. den gesplitteten
+ pNd = pLast;
+ if( nSaveInsFirstPara && pNd && pNd->GetTxt().Len() )
+ nInsFirstPara = 2;
+ }
+ FillTxtNode( pNd, aPos, nOffset, nInsFirstPara );
+ pNd = NULL; nOffset = 0;
+ nInsFirstPara = 0;
+ break;
+ case SWG_GRFNODE:
+ InGrfNode( aPos );
+ nInsFirstPara = 0;
+ goto chknode;
+ case SWG_OLENODE:
+ InOleNode( aPos );
+ // Falls ein TxtNode am Anfang war, weg damit!
+ nInsFirstPara = 0;
+ chknode:
+ if( pNd )
+ pDoc->GetNodes().Delete( aPos );
+ pNd = NULL;
+ break;
+ case SWG_TABLE: {
+ // JP 20.05.94: Dok. einfuegen: wird als 1.Node eine
+ // Tabelle eingefuegt, dann immer splitten !!
+ nInsFirstPara = 0;
+ if( 1 == i && bIns )
+ {
+ SwPosition aSplitPos( aPos, SwIndex( pNd, nOffset ) );
+ pDoc->SplitNode( aSplitPos );
+ nOffset = 0; // mit dem Offset hat sichs erledigt!
+ }
+ InTable( aPos );
+ if( i != 1 ) pNd = NULL;
+ } break;
+ case SWG_TOXGROUP:
+ InTOX( aPos, pNd );
+ pNd = NULL;
+ break;
+ case SWG_TEXTBLOCK: {
+ BYTE cFlag;
+ r >> cFlag;
+ if( !cFlag ) r.skipnext();
+ else {
+ // TODO: unicode: check for 8 bit encoding
+ BYTE eCharSet = (BYTE) gsl_getSystemTextEncoding();
+ if( cFlag & 0x02 )
+ r >> eCharSet;
+ BYTE eSave = aHdr.cCodeSet;
+ aHdr.cCodeSet = eCharSet;
+ GetText();
+ GetText();
+ InContents( bNode1, TRUE );
+ aHdr.cCodeSet = eSave;
+ bNode1 = FALSE;
+ }
+ } break;
+ case SWG_COMMENT:
+ // Reste von TextBlocks
+ r.skipnext(); break;
+ case SWG_EOF:
+ // sicherheitshalber
+ r.undonext(); i = nNodes = 9999; break;
+ default:
+ // unbekannte Nodes
+ Error(); r.skipnext();
+ }
+ }
+ nStatus = nOldStatus;
+}
+
+// Einlesen des puren Textes eines Content-Bereichs
+
+String SwSwgReader::InContentsText( BOOL bBlock )
+{
+ USHORT nNodes, nId;
+ String aText;
+ if( !bBlock )
+ r >> nId;
+ r >> nNodes;
+ r.next();
+ for( USHORT i = 1; i <= nNodes && r.good(); i++)
+ {
+ switch( r.cur() )
+ {
+ case SWG_TEXTNODE:
+ FillString( aText );
+ break;
+ case SWG_TABLE: // Zur Zeit keine Tabellen
+ case SWG_GRFNODE:
+ case SWG_OLENODE:
+ case SWG_TOXGROUP:
+ case SWG_COMMENT:
+ r.skipnext(); break;
+ case SWG_TEXTBLOCK: {
+ BYTE cFlag;
+ r >> cFlag;
+ if( !cFlag ) r.skipnext();
+ else {
+ // TODO: unicode: check for 8 bit encoding
+ BYTE eCharSet = (BYTE) gsl_getSystemTextEncoding();
+ if( cFlag & 0x02 )
+ r >> eCharSet;
+ BYTE eSave = aHdr.cCodeSet;
+ aHdr.cCodeSet = eCharSet;
+ GetText();
+ GetText();
+ String aBlock = InContentsText( TRUE );
+ if( aText.Len() ) aText += ' ';
+ aText += aBlock;
+ aHdr.cCodeSet = eSave;
+ }
+ } break;
+ default:
+ // unbekannte Nodes
+ Error(); r.skipnext();
+ }
+ }
+ return aText;
+}
+
+// Einfuegen einer nicht vorhandenen Contents-Section
+
+SwStartNode* SwSwgReader::InSection()
+{
+ // Anlegen einer Section mit einem TextNode
+ SwNodeIndex aStart( pDoc->GetNodes().GetEndOfAutotext() );
+ SwStartNode* pSttNd = pDoc->GetNodes().MakeTextSection( aStart,
+ (SwStartNodeType)eStartNodeType,
+ (SwTxtFmtColl*) pDoc->GetDfltTxtFmtColl() );
+ aStart = *pSttNd;
+ FillSection( aStart );
+ return pSttNd;
+}
+
+// Fuellen einer vorhandenen Contents-Section
+// Die Position zeigt auf den StartNode
+// Der SwIndex zeigt hinterher auf den EndNode
+
+void SwSwgReader::FillSection( SwNodeIndex& rPos )
+{
+ if( r.next() != SWG_CONTENTS )
+ {
+ Error();
+ rPos = rPos.GetIndex() + 3; // skip section
+ return;
+ }
+ // die Anzahl Nodes einlesen
+ USHORT nId, nNodes;
+ r >> nId >> nNodes;
+ RegisterSection( rPos, nId );
+ rPos++;
+ SwCntntNode* pNode = pDoc->GetNodes()[ rPos ]->GetCntntNode();
+ r.next();
+ for( USHORT i = 1; i <= nNodes && r.good(); i++)
+ {
+ ::binfilter::SetProgressState( r.tell(), pDoc->GetDocShell() );
+ switch( r.cur() )
+ {
+ case SWG_TEXTNODE:
+ FillTxtNode( (SwTxtNode*) pNode, rPos, 0 );
+ pNode = NULL;
+ break;
+ case SWG_GRFNODE:
+ InGrfNode( rPos );
+ break;
+ case SWG_OLENODE:
+ InOleNode( rPos );
+ break;
+ case SWG_TABLE:
+ InTable( rPos );
+ break;
+ case SWG_COMMENT:
+ // Reste von TextBlocks
+ r.skipnext(); break;
+ default:
+ // unbekannte Nodes
+ Error(); r.skipnext();
+ }
+ }
+ // Ueber den EndNode skippen
+ rPos++;
+
+ // Eine Tabelle und eine Section koennen u.U. alleine
+ // in einer Textsection existieren, d.h. es muss ggf.
+ // der ueberfluessige Node entfernt werden!
+ if( pNode && r.good() )
+ {
+ // Falls der aktuelle PaM auf diesen Node zeigt, den PaM
+ // knallhart wegschieben. Ist erlaubt laut JP!
+ if( pPaM )
+ {
+ if( pPaM->GetBound( TRUE ).nContent.GetIdxReg() == pNode )
+ pPaM->GetBound( TRUE ).nContent.Assign( 0, 0 );
+ if( pPaM->GetBound( FALSE ).nContent.GetIdxReg() == pNode )
+ pPaM->GetBound( FALSE ).nContent.Assign( 0, 0 );
+ }
+ pDoc->GetNodes().Delete( SwNodeIndex( *pNode ) );
+ }
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Tabellen
+
+// Zeilen und Boxen duerfen keine Rueckwaertsreferenz in andere
+// Tabellen enthalten, also: Fixen!
+
+static long nFrmSizeAdj = 1; // Divisionsfaktor fuer FrmSize
+
+// Das Attribut darf im Prinzip nicht > 65535 werden, da sonst MAs
+// Rechenroutinen baden gehen. Da einige alte Tabellen groessere Werte
+// enthalten, setzt InTable() ggf. einen Divisionsfaktor, um den
+// die gelesenen Werte heruntergeteilt werden. Normalerweise ist er 1.
+
+static void AdjustFrmSize( SwFrmFmt* pFmt )
+{
+ if( pFmt && nFrmSizeAdj > 1
+ && pFmt->GetAttrSet().GetItemState( RES_FRM_SIZE, FALSE ) == SFX_ITEM_SET )
+ {
+ SwFmtFrmSize aSz( pFmt->GetFrmSize() );
+ if( aSz.GetSizeType() == ATT_VAR_SIZE )
+ {
+ aSz.SetWidth( aSz.GetWidth() / nFrmSizeAdj );
+ aSz.SetHeight( aSz.GetHeight() / nFrmSizeAdj );
+ pFmt->SetAttr( aSz );
+ }
+ }
+}
+
+// Das uebergebene Array ist erst mal leer.
+// Der Index zeigt auf den naechsten freien StartNode und wird
+// auf den wiederum naechsten vorgeschoben.
+
+void SwSwgReader::InTableBox
+ (SwTableBoxes& rBoxes, int idx, // Array und Index
+ SwTableLine* pUpper, // uebergeordnete Zeile
+ SwNodeIndex& rPos,
+ const SwTable *pTable ) // Start-Index der Section
+{
+ short nFrmFmt, nLines;
+ r >> nFrmFmt >> nLines;
+ // Frame-Format evtl. einlesen
+ SwTableBoxFmt* pFmt = NULL;
+ r.next();
+ while( r.cur() == SWG_FRAMEFMT && r.good() )
+ {
+ // Das Attribut SwFmtFrmSize benoetigt diese Werte, um
+ // seine Werte umzudrehen
+ USHORT nOldLvl = nTblBoxLvl;
+ nTblBoxLvl = nFmtLvl;
+ pFmt = (SwTableBoxFmt*) InFormat( pDoc->MakeTableBoxFmt() );
+ RegisterFmt( *pFmt, pTable );
+ AdjustFrmSize( pFmt );
+ nTblBoxLvl = nOldLvl;
+ }
+ // Frame-Format raussuchen
+ if( !pFmt )
+ {
+ pFmt = (SwTableBoxFmt*) FindFmt( nFrmFmt, SWG_FRAMEFMT );
+ if( !pFmt )
+ {
+ Error(); return;
+ }
+ if( pTable != FindTable( nFrmFmt ) )
+ {
+ // es MUSS ein neues Format angelegt werden!
+ SwTableBoxFmt* pNew = pDoc->MakeTableBoxFmt();
+ // Attribute hart hineinkopieren
+ ((SfxItemSet&)pNew->GetAttrSet()).Put( pFmt->GetAttrSet() );
+ pNew->nFmtId = nFrmFmt;
+ ReRegisterFmt( *pFmt, *pNew, pTable );
+ pFmt = pNew;
+ AdjustFrmSize( pFmt );
+ aFile.nFlags |= SWGF_NO_FRAMES;
+ }
+ }
+ SwTableBoxPtr pBox;
+ if( r.cur() == SWG_CONTENTS )
+ {
+ r.undonext();
+ pBox = new SwTableBox( pFmt, rPos, pUpper );
+ long nSaveFrmSizeAdj = nFrmSizeAdj; // Tabellen in FlyFrames
+ FillSection( rPos );
+ nFrmSizeAdj = nSaveFrmSizeAdj; // zerstoeren nFrmSizeAdj!
+ } else
+ pBox = new SwTableBox( pFmt, nLines, pUpper );
+ rBoxes.C40_INSERT( SwTableBox, pBox, (USHORT)idx );
+ while( r.cur() == SWG_COMMENT || r.cur() == SWG_DATA ) r.skipnext();
+ // Falls Zeilen vorhanden, diese ausgeben
+ for( int i = 0; i < nLines && r.good(); i++)
+ {
+ if( r.cur() != SWG_TABLELINE )
+ {
+ Error(); return;
+ }
+ InTableLine( pBox->GetTabLines(), pBox, i, rPos, pTable );
+ }
+}
+
+// Einlesen einer Zeile
+
+void SwSwgReader::InTableLine
+ ( SwTableLines& rLines, SwTableBoxPtr pUpper, int idx, SwNodeIndex& rPos,
+ const SwTable *pTable )
+{
+ short nFrmFmt, nBoxes;
+ r >> nFrmFmt >> nBoxes;
+ r.next();
+ SwTableLineFmt* pFmt = NULL;
+ // Frame-Format evtl. einlesen
+ while( r.cur() == SWG_FRAMEFMT && r.good() )
+ {
+ pFmt = (SwTableLineFmt*) InFormat( pDoc->MakeTableLineFmt() );
+ RegisterFmt( *pFmt, pTable );
+// AdjustFrmSize( pFmt );
+ }
+ // Frame-Format raussuchen
+ // Frame-Format raussuchen
+ if( !pFmt )
+ {
+ pFmt = (SwTableLineFmt*) FindFmt( nFrmFmt, SWG_FRAMEFMT );
+ if( !pFmt )
+ {
+ Error(); return;
+ }
+ if( pTable != FindTable( nFrmFmt ) )
+ {
+ // es MUSS ein neues Format angelegt werden!
+ SwTableLineFmt* pNew = pDoc->MakeTableLineFmt();
+ // Attribute hart hineinkopieren
+ ((SfxItemSet&)pNew->GetAttrSet()).Put( pFmt->GetAttrSet() );
+ pNew->nFmtId = nFrmFmt;
+ ReRegisterFmt( *pFmt, *pNew, pTable );
+ AdjustFrmSize( pFmt );
+ pFmt = pNew;
+ aFile.nFlags |= SWGF_NO_FRAMES;
+ }
+ }
+ // Default-Werte setzen:
+ SwTableLine* pLine = new SwTableLine( pFmt, nBoxes, pUpper);
+ rLines.C40_INSERT( SwTableLine, pLine, (USHORT) idx );
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ while( r.cur() == SWG_COMMENT || r.cur() == SWG_DATA ) r.skipnext();
+ // Und nun die einzelnen Zellen:
+ for (int i = 0; i < nBoxes && r.good(); i++ )
+ {
+ if( r.cur() != SWG_TABLEBOX )
+ {
+ Error(); return;
+ }
+ InTableBox( rBoxes, i, pLine, rPos, pTable );
+ }
+
+}
+
+// rPos zeigt anschliessend hinter die Tabelle
+
+void SwSwgReader::InTable( SwNodeIndex& rPos )
+{
+ if( !bNew && pDoc->IsIdxInTbl( rPos ) )
+ {
+ r.skipnext(); return;
+ }
+ BYTE cFlags;
+ USHORT nLines, nBoxes;
+ r >> cFlags >> nLines >> nBoxes;
+//JP 16.02.99: ueberfluessiges Flag
+// BOOL bModified = BOOL( ( cFlags & 0x01 ) != 0 );
+ BOOL bHdRepeat = BOOL( ( cFlags & 0x02 ) != 0 );
+ // Die Strukturen im Nodes-Array erzeugen
+ // Erzeugen von:
+ // TableNode..StartNode..TxtNode..EndNode.. (weitere Boxes) ..EndNode
+ SwTableNode* pNd = pDoc->GetNodes().InsertTable( rPos, nBoxes,
+ (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
+ if( !pNd )
+ {
+ r.skip(); Error(); return;
+ }
+ rPos = *pNd;
+ SwTable* pTbl = &pNd->GetTable();
+//JP 16.02.99: ueberfluessiges Flag
+// if( bModified )
+// pTbl->SetModified();
+ pTbl->SetHeadlineRepeat( bHdRepeat );
+ // Das Frame-Format der Tabelle einlesen
+ USHORT nFrmFmt;
+ r >> nFrmFmt;
+ r.next();
+ SwFrmFmt* pFmt = pDoc->MakeTblFrmFmt( pDoc->GetUniqueTblName(),
+ pDoc->GetDfltFrmFmt() );
+ if( aHdr.nVersion >= SWG_VER_LCLFMT )
+ {
+ while( r.cur() == SWG_FRAMEFMT && r.good() )
+ {
+ InFormat( pFmt );
+ RegisterFmt( *pFmt, pTbl );
+ nFrmFmt = IDX_NO_VALUE;
+ }
+ }
+ // Wenn ein Frame-Fmt angegeben wurde, muss ein neues erzeugt werden.
+ BOOL bGetTblSize = FALSE;
+
+ if( nFrmFmt != IDX_NO_VALUE )
+ {
+ SwFrmFmt* pLastFmt = (SwFrmFmt*) FindFmt( nFrmFmt, SWG_FRAMEFMT );
+ if( !pLastFmt )
+ {
+//JP 25.03.97: Bug ## - wenn keine TabellenAttribute gefunden werden
+// dann setze die DefaultSize fuer eine Tabelle.
+// Error(); return;
+ // die Tabelle bekommt erstmal USHRT_MAX als default Size
+ // die richtige Size wird am Ende von der 1. Line besorgt
+ pFmt->SetAttr( SwFmtFrmSize( ATT_VAR_SIZE, USHRT_MAX ));
+ bGetTblSize = TRUE;
+ }
+ else
+ {
+ // Attribute hart hineinkopieren
+ ((SfxItemSet&)pFmt->GetAttrSet()).Put( pLastFmt->GetAttrSet() );
+ pFmt->nFmtId = nFrmFmt;
+ ReRegisterFmt( *pLastFmt, *pFmt, pTbl );
+ aFile.nFlags |= SWGF_NO_FRAMES;
+ }
+ }
+ // Da einige FRMSIZE-Attribute zu grosse Werte enthalten,
+ // muessen die Werte heruntergeteilt werden.
+ nFrmSizeAdj = 1;
+ if( SFX_ITEM_SET == pFmt->GetAttrSet().GetItemState(RES_FRM_SIZE, FALSE ))
+ {
+ SwFmtFrmSize aSz( pFmt->GetFrmSize() );
+ SwTwips h = aSz.GetHeight();
+ SwTwips w = aSz.GetWidth();
+ while( h > 65535L || w > 65535L )
+ w /= 2, h /= 2, nFrmSizeAdj *= 2;
+ aSz.SetWidth( w );
+ aSz.SetHeight( h );
+ pFmt->SetAttr( aSz );
+ }
+ pFmt->Add( pTbl );
+
+ // Ist es eine DDE-Tabelle?
+ SwDDEFieldType* pDDE = 0;
+ if( r.cur() == SWG_FIELDTYPES )
+ {
+ pDDE = (SwDDEFieldType*) InFieldType();
+ r.next();
+ }
+ // Vordefinierte Layout-Frames loeschen
+ // beim Einfuegen stoeren diese zur Zeit
+ if( !bNew ) pNd->DelFrms();
+ // Die einzelnen Zeilen einlesen
+ // aIdx zeigt auf den Startnode der ersten Box
+ rPos = pNd->GetIndex() + 1;
+
+ while( r.cur() == SWG_COMMENT || r.cur() == SWG_DATA ) r.skipnext();
+ SwTableLines& rLines = pTbl->GetTabLines();
+ for (USHORT i = 0; i < nLines && r.good(); i++ )
+ {
+ if( r.cur() != SWG_TABLELINE )
+ {
+ Error(); return;
+ }
+ InTableLine( rLines, NULL, i, rPos, pTbl );
+ }
+
+ if( bGetTblSize )
+ {
+ SwTwips nAktSize = 0;
+ const SwTableBoxes& rBoxes = rLines[ 0 ]->GetTabBoxes();
+ for( USHORT n = rBoxes.Count(); n; )
+ nAktSize += rBoxes[ --n ]->GetFrmFmt()->GetFrmSize().GetWidth();
+
+ //
+ pFmt->LockModify();
+ pFmt->SetAttr( SwFmtFrmSize( ATT_VAR_SIZE, nAktSize ));
+ pFmt->UnlockModify();
+ }
+
+ rPos = pNd->EndOfSectionIndex()+1;
+ if( pDDE )
+ {
+ // tauschen am Node den Tabellen-Pointer aus
+ SwDDETable* pNewTable = new SwDDETable( pNd->GetTable(),
+ (SwDDEFieldType*) pDDE );
+ pNd->SetNewTable( pNewTable, FALSE );
+ }
+
+ // Layout-Frames wieder erzeugen, falls eingefuegt
+ // und falls (MA #$.!) die Tbl nicht im FlyFrm ist
+ if( !bNew && !nFlyLevel && !(SWGRD_FORCE & nOptions) )
+ {
+ SwNodeIndex aIdx( *pNd->EndOfSectionNode() );
+ pDoc->GetNodes().GoNext( &aIdx );
+ pNd->MakeFrms( &aIdx );
+ }
+ nFrmSizeAdj = 1;
+}
+
+
+// Registrieren einer Section. Der SwIndex zeigt auf den StartNode.
+
+USHORT SwSwgReader::RegisterSection( const SwNodeIndex& rIdx, USHORT nId )
+{
+ SectionInfo* p;
+ if( nSect == nSectSize )
+ {
+ // kein Platz mehr: um 128 erweitern
+ p = new SectionInfo [ nSectSize + 128 ];
+ memcpy( p, pSects, nSectSize * sizeof( SectionInfo ) );
+ delete pSects;
+ pSects = p;
+ nSectSize += 128;
+ }
+ p = &pSects[ nSect ];
+ p->nId = ( nId == IDX_NO_VALUE ) ? nSect : nId;
+ // Nimm den ersten Node hinter dem StartNode.
+ // Dadurch laesst sich StartOfSection() anwenden.
+ p->pNode1 = pDoc->GetNodes()[ rIdx.GetIndex() + 1 ];
+ nSect++;
+ return p->nId;
+
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdflds.cxx b/binfilter/bf_sw/source/core/swg/sw_rdflds.cxx
new file mode 100644
index 000000000000..4db68bbdbf5f
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdflds.cxx
@@ -0,0 +1,775 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+
+#include <stdlib.h> // strtod()
+
+#include <bf_so3/linkmgr.hxx>
+#include <tools/datetime.hxx>
+
+#include "doc.hxx"
+#include "rdswg.hxx"
+#include "fldbas.hxx"
+#include "docufld.hxx"
+#include "chpfld.hxx"
+#include "ddefld.hxx"
+#include "expfld.hxx"
+#include "reffld.hxx"
+#include "usrfld.hxx"
+#include "dbfld.hxx"
+#include "flddat.hxx"
+#include "numrule.hxx"
+namespace binfilter {
+
+static UINT32 nNewFldFmt; // Aktueller Format-Wert
+
+
+static SwDBFieldType* In_SwDBFieldType( SwSwgReader& rPar )
+{
+ // MS: An den Typen DBName und FeldName uebergeben
+ SwDBFieldType aType( rPar.pDoc, rPar.GetText(), rPar.pDoc->GetDBData() );
+ // altes Expand wegwerfen
+ if( rPar.aHdr.nVersion < SWG_VER_POOLIDS )
+ rPar.GetText( FALSE );
+
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !aType.GetName().Len() )
+ return 0;
+
+ return (SwDBFieldType*) rPar.pDoc->InsertFldType( aType );
+}
+
+static SwUserFieldType* In_SwUserFieldType( SwSwgReader& rPar )
+{
+ SwUserFieldType aType( rPar.pDoc, rPar.GetText() );
+ aType.SetContent( rPar.GetText() );
+
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !aType.GetName().Len() )
+ return 0;
+
+ SwUserFieldType* p = (SwUserFieldType*) rPar.pDoc->InsertFldType( aType );
+
+ sal_Char* dummy;
+ ByteString aVal = rPar.GetAsciiText();
+
+ USHORT nType;
+ if( rPar.aHdr.nVersion >= SWG_VER_POOLIDS )
+ rPar.r >> nType;
+
+ if( !rPar.bNew && p->GetDepends() )
+ return p;
+
+ p->SetValue( strtod( aVal.GetBuffer(), &dummy ) );
+
+ if( rPar.aHdr.nVersion >= SWG_VER_POOLIDS )
+ {
+ // hot fix
+ if( !nType )
+ nType = GSE_STRING;
+ }
+ else
+ {
+ nType = (USHORT)nNewFldFmt & 3;
+ nNewFldFmt &= ~3;
+
+ // Anfuehrungsstriche alter Vars wegschmeissen
+ String aTmp(aType.GetContent());
+ if(nType & GSE_STRING)
+ {
+ aTmp = aTmp.Copy(1, aTmp.Len() - 2);
+ p->SetContent(aTmp);
+ }
+ }
+ p->SetType( nType );
+ return p;
+}
+
+/* MS: Diese Felder gibt es nicht mehr
+
+static SwRegFieldType* In_SwRegFieldType( SwSwgReader& rPar )
+{
+ BYTE nCount;
+ long nEditTime;
+ rPar.r.long4();
+ rPar.r >> nCount;
+ aType.aTitle = rPar.GetText();
+ rPar.r >> nEditTime;
+ SwRegFieldType aType;
+ aType.aEditTime.SetTime( nEditTime );
+ for( BYTE i = 0; ( i < nCount ) && rPar.r.good(); i++ )
+ {
+ aType.aInfo[ i ].aAuthor = rPar.GetText();
+ ULONG nDate;
+ long nTime;
+ rPar.r >> nDate >> nTime;
+ aType.aInfo[ i ].aDateTime.SetDate( nDate );
+ aType.aInfo[ i ].aDateTime.SetTime( nTime );
+ }
+ rPar.r.long3();
+ return (SwRegFieldType*) rPar.pDoc->InsertFldType( aType );
+}
+
+
+static SwVarRegFieldType* In_SwVarRegFieldType( SwSwgReader& rPar )
+{
+ USHORT nType;
+ rPar.r >> nType;
+ SwVarRegFieldType aType( rPar.GetText(), nType );
+ aType.SetValue( rPar.GetText() );
+ return (SwVarRegFieldType*) rPar.pDoc->InsertFldType( aType );
+}
+
+End Of Comment MS: */
+
+static SwDDEFieldType* In_SwDDEFieldType( SwSwgReader& rPar )
+{
+ USHORT nType;
+ rPar.r >> nType;
+ String aName( rPar.GetText() );
+ String aCmd( rPar.GetText() );
+ if( !nType )
+ nType = ::binfilter::LINKUPDATE_ONCALL;
+ else
+ nType = ::binfilter::LINKUPDATE_ALWAYS;
+
+ // die ersten beiden Blanks gegen den neuen Trenner austauschen
+ xub_StrLen nFnd = aCmd.Search( ' ' );
+ if( STRING_NOTFOUND != nFnd )
+ aCmd.SetChar( nFnd, ::binfilter::cTokenSeperator );
+ nFnd = aCmd.Search( ' ', nFnd );
+ if( STRING_NOTFOUND != nFnd )
+ aCmd.SetChar( nFnd, ::binfilter::cTokenSeperator );
+
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !aName.Len() || !aCmd.Len() )
+ return 0;
+
+ SwDDEFieldType aType( aName, aCmd, nType );
+ return (SwDDEFieldType*) rPar.pDoc->InsertFldType( aType );
+}
+
+static SwSetExpFieldType* In_SwSetExpFieldType( SwSwgReader& rPar )
+{
+ USHORT nType;
+ rPar.r >> nType;
+ String aName( rPar.GetText() );
+
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !aName.Len() )
+ return 0;
+
+ SwSetExpFieldType aType( rPar.pDoc, aName, nType );
+ return (SwSetExpFieldType*) rPar.pDoc->InsertFldType( aType );
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+static SwField* In_SwDBField( SwSwgReader& rPar, SwDBFieldType* pType, USHORT nSub )
+{
+ pType = In_SwDBFieldType( rPar );
+
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !pType )
+ return 0;
+
+ SwDBField* pFld = new SwDBField( pType );
+ pFld->SetSubType(nSub);
+ if( rPar.aHdr.nVersion >= SWG_VER_POOLIDS )
+ { // Expansion laden
+ pFld->InitContent(rPar.GetText( FALSE ));
+ }
+ return pFld;
+}
+
+static SwField* In_SwUserField( SwSwgReader& rPar, SwUserFieldType* pType,
+ USHORT nSub )
+{
+ pType = In_SwUserFieldType( rPar );
+
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !pType )
+ return 0;
+
+ return new SwUserField( pType, nSub ); // MS: Hier kann auch das Format mit
+ // uebergeben werden
+ if( UF_STRING & pType->GetType() )
+ nNewFldFmt = 0; // Warum auch immer!
+
+}
+
+static SwField* In_SwFileNameField( SwSwgReader&, SwFileNameFieldType* pType )
+{
+ return new SwFileNameField( pType );
+}
+
+static SwField* In_SwDBNameField( SwSwgReader& rPar, SwDBNameFieldType* pType )
+{
+ return new SwDBNameField( pType, rPar.pDoc->GetDBData() );
+}
+
+static SwField* In_SwDateField( SwSwgReader&, SwDateTimeFieldType* pType )
+{
+ return new SwDateTimeField( pType, DATEFLD );
+}
+
+static SwField* In_SwTimeField( SwSwgReader&, SwDateTimeFieldType* pType )
+{
+ return new SwDateTimeField( pType, TIMEFLD );
+}
+
+static SwField* In_SwPageNumberField( SwSwgReader& rPar, SwPageNumberFieldType* pType )
+{
+ USHORT nOff = 0;
+ USHORT nSub = PG_RANDOM;
+ if( rPar.aHdr.nVersion >= SWG_VER_POOLIDS )
+ { rPar.r >> nOff;
+ rPar.r >> nSub;
+ }
+ return new SwPageNumberField( pType, nSub, nNewFldFmt, nOff );
+}
+
+static SwField* In_SwAuthorField( SwSwgReader&, SwAuthorFieldType* pType )
+{
+ return new SwAuthorField( pType );
+}
+
+static SwField* In_SwChapterField( SwSwgReader&, SwChapterFieldType* pType )
+{
+ return new SwChapterField( pType );
+}
+
+static SwField* In_SwDocStatField( SwSwgReader& rPar, SwDocStatFieldType* pType )
+{
+ USHORT nSubType = 0;
+ if( rPar.aHdr.nVersion < SWG_VER_POOLIDS )
+ {
+ // Im Format stand der Subtyp:
+ nSubType = (USHORT)nNewFldFmt;
+ nNewFldFmt = SVX_NUM_ARABIC;
+ } else rPar.r >> nSubType;
+ return new SwDocStatField( pType, nSubType, nNewFldFmt );
+}
+
+static SwField* In_SwHiddenTxtField( SwSwgReader& rPar, SwHiddenTxtFieldType* pType )
+{
+ BYTE cFlags;
+ USHORT nSubType = TYP_HIDDENTXTFLD;
+ rPar.r >> cFlags;
+ String aText( rPar.GetText() );
+ String aCond;
+ aCond = rPar.GetText();
+ if( rPar.aHdr.nVersion >= SWG_VER_FRAMES3 )
+ rPar.r >> nSubType;
+ BOOL bCond = BOOL( ( cFlags & 0x02 ) != 0 );
+ BOOL bIsHidden = BOOL( ( cFlags & 0x01 ) != 0 );
+
+ if( rPar.aHdr.nVersion < SWG_VER_POOLIDS )
+ bCond = BOOL( !bCond );
+
+ if( bCond && TYP_CONDTXTFLD != nSubType )
+ {
+// steht im sw3field.cxx
+extern void lcl_sw3io_ChkHiddenExp( String& );
+ lcl_sw3io_ChkHiddenExp( aCond );
+ bIsHidden = !bIsHidden;
+ }
+
+ SwHiddenTxtField* pFld = new SwHiddenTxtField( pType,
+ bCond,
+ aEmptyStr, aText,
+ bIsHidden, nSubType );
+ pFld->SetPar1( aCond );
+ return pFld;
+}
+
+static SwField* In_SwGetRefField( SwSwgReader& rPar, SwGetRefFieldType* pType )
+{
+ String aName( rPar.GetText() );
+ String aText( rPar.GetText( FALSE ) );
+ SwGetRefField* pFld = new SwGetRefField( pType, aName, 0, 0, 0 );
+ if( aText.Len() )
+ pFld->SetExpand( aText );
+ return pFld;
+}
+
+static SwField* In_SwPostItField( SwSwgReader& rPar, SwPostItFieldType* pType )
+{
+ ULONG nDate;
+ rPar.r.long4();
+ rPar.r >> nDate;
+ rPar.r.long3();
+ String aAuthor( rPar.GetText() );
+ String aText( rPar.GetText() );
+ return new SwPostItField( pType, aAuthor, aText, Date( nDate ) );
+}
+
+static SwField* In_SwFixDateField( SwSwgReader& rPar, SwDateTimeFieldType* pType )
+{
+ long nVal;
+ rPar.r.long4();
+ rPar.r >> nVal;
+ rPar.r.long3();
+ SwDateTimeField* pFld = new SwDateTimeField( pType, DATEFLD|FIXEDFLD );
+ Time aTmpTime;
+ Date aTmpDate(nVal);
+ DateTime aDT(aTmpDate, aTmpTime);
+ pFld->SetDateTime( aDT );
+ return pFld;
+}
+
+static SwField* In_SwFixTimeField( SwSwgReader& rPar, SwDateTimeFieldType* pType )
+{
+ long nVal;
+ rPar.r.long4();
+ rPar.r >> nVal;
+ rPar.r.long3();
+ SwDateTimeField* pFld = new SwDateTimeField( pType );
+ Date aTmpDate;
+ DateTime aDT(aTmpDate, Time(nVal));
+ pFld->SetDateTime( aDT );
+ return pFld;
+}
+
+/* MS: RegFields werden nicht mehr gebraucht
+
+static SwField* In_SwRegField( SwSwgReader& rPar, SwRegFieldType* pType )
+{
+ pType = In_SwRegFieldType( rPar );
+ if( !pType ) return NULL;
+ USHORT nType;
+ rPar.r >> nType;
+ return new SwRegField( pType, nType );
+}
+
+static SwField* In_SwVarRegField( SwSwgReader& rPar, SwVarRegFieldType* pType )
+{
+ pType = In_SwVarRegFieldType( rPar );
+ return new SwVarRegField( pType );
+}
+*/
+
+static SwField* In_SwDDEField( SwSwgReader& rPar, SwDDEFieldType* pType )
+{
+ pType = In_SwDDEFieldType( rPar );
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !pType )
+ return 0;
+ return new SwDDEField( pType );
+}
+
+static SwField* In_SwInputField( SwSwgReader& rPar, SwInputFieldType* pType )
+{
+ SwInputField* pFld = new SwInputField( pType, aEmptyStr, aEmptyStr );
+ // Prompt
+ pFld->SetPar2( rPar.GetText() );
+ // Content
+ pFld->SetPar1( rPar.GetText() );
+ USHORT nSubType;
+
+ if( rPar.aHdr.nVersion < SWG_VER_POOLIDS )
+ { // Im Format stand der Subtyp:
+ nSubType = (USHORT)nNewFldFmt & 0x03;
+ nNewFldFmt = 0;
+ }
+ else
+ rPar.r >> nSubType;
+ pFld->SetSubType( nSubType );
+ return pFld;
+}
+
+static SwField* In_SwMacroField( SwSwgReader& rPar, SwMacroFieldType* pType )
+{
+ String aName;
+ String aText;
+ if( rPar.aHdr.nVersion < SWG_VER_POOLIDS ) {
+ aName = rPar.GetText();
+ String aLib( rPar.GetText() );
+ String aTmp(aLib);
+ aTmp += ':';
+ aTmp += aName;
+ aName = aTmp;
+ } else {
+ aName = rPar.GetText();
+ aText = rPar.GetText();
+ }
+ return new SwMacroField( pType, aName, aText );
+}
+
+static SwField* In_SwTblField( SwSwgReader& rPar, SwTblFieldType* pType, USHORT nSub )
+{
+ BYTE bInTbl; // wird ignoriert
+ rPar.r >> bInTbl;
+ String aFormel = rPar.GetText();
+ String aTxt = rPar.GetText( FALSE );
+ SwTblField* pFld = new SwTblField( pType, aFormel );
+ pFld->SetSubType(nSub);
+ if( !bInTbl && aTxt.Len() )
+ pFld->ChgExpStr( aTxt );
+ return pFld;
+}
+
+static SwField* In_SwGetExpField( SwSwgReader& rPar, SwGetExpFieldType* pType, USHORT nSub )
+{
+ SwGetExpField* p = new SwGetExpField( pType, rPar.GetText() );
+ USHORT nSubType = GSE_EXPR;
+ if( rPar.aHdr.nVersion >= SWG_VER_POOLIDS )
+ {
+ String s = rPar.GetText();
+ p->ChgExpStr( s );
+ if( rPar.aHdr.nVersion >= SWG_VER_GETEXP )
+ rPar.r >> nSubType;
+ }
+ else
+ { nSubType = (USHORT)nNewFldFmt & 3;
+ nNewFldFmt &= ~3;
+ }
+ p->SetSubType(nSubType|nSub);
+ if( GSE_STRING & nSubType )
+ nNewFldFmt = 0;
+
+ // Falls sich das Feld in einem Shared-Format befindet,
+ // mus es nach dem Lesen ge-updated werden
+// if( rPar.nStatus & SWGSTAT_SHAREDFMT )
+// rPar.nStatus |= SWGSTAT_UPDATEEXPR;
+ return p;
+}
+
+static SwField* In_SwSetExpField( SwSwgReader& rPar, SwSetExpFieldType* pType, USHORT nSub )
+{
+ pType = In_SwSetExpFieldType( rPar );
+ //JP 13.02.96: Bug 25321 - Felder ohne Namen nie einlesen
+ if( !pType )
+ return 0;
+ BYTE cFlags;
+ rPar.r >> cFlags;
+ String aFrml( rPar.GetText() );
+ SwSetExpField* pFld = new SwSetExpField( pType, aFrml, pType->GetType());
+ if( cFlags & 0x02 )
+ pFld->ChgExpStr( rPar.GetText() );
+ if( cFlags & 0x01 )
+ pFld->SetInputFlag(TRUE);
+
+ if( rPar.aHdr.nVersion < SWG_VER_POOLIDS )
+ {
+ USHORT nSubType = (USHORT)nNewFldFmt & 3;
+ nNewFldFmt &= ~3;
+ pFld->SetSubType( nSubType | (cFlags & 1 ) );
+
+ // bei alten Vars Anfuehrungsstriche entfernen
+ if(nSubType & GSE_STRING)
+ {
+ aFrml = aFrml.Copy(1, aFrml.Len() - 2);
+ pFld->ChgExpStr( aFrml );
+ pFld->SetPar2( aFrml );
+ }
+ }
+
+ aFrml = pFld->GetExpStr();
+// pFld->SetValue( strtod( (const sal_Char*)aFrml, &dummy ) );
+ // TODO: unicode: is this correct?
+ pFld->SetValue( aFrml.ToDouble() );
+
+ // Hack: fuer Seq-Felder wurde das Original-Format im Subtyp uebergeben,
+ // aber nur, wenn es auch als entsprechendes Format in Frage kommt.
+ // (SUB_VISIBLE und SUB_CMD sind disjunkt).
+ USHORT nSubType = ((SwSetExpField *)pFld)->GetSubType();
+ if( nSub >= (USHORT)SVX_NUM_CHARS_UPPER_LETTER &&
+ nSub <= (USHORT)SVX_NUM_BITMAP )
+ {
+ if( GSE_SEQ & nSubType )
+ nNewFldFmt = nSub;
+ nSub = 0;
+ }
+ nSubType |= nSub;
+ pFld->SetSubType( nSubType );
+ if( GSE_STRING & nSubType )
+ nNewFldFmt = 0; // Warum auch immer
+
+ // neue Felder: Subtyp bereits im Feldtyp!
+ // Falls sich das Feld in einem Shared-Format befindet,
+ // mus es nach dem Lesen ge-updated werden
+// if( rPar.nStatus & SWGSTAT_SHAREDFMT )
+// rPar.nStatus |= SWGSTAT_UPDATEEXPR;
+ return pFld;
+}
+
+static SwField* In_SwHiddenParaField( SwSwgReader& rPar, SwHiddenParaFieldType* pType )
+{
+ BYTE bHidden;
+ rPar.r >> bHidden;
+ String aCond( rPar.GetText() );
+ SwHiddenParaField* pFld = new SwHiddenParaField( pType, aCond );
+ pFld->SetHidden( (BOOL) bHidden );
+ return pFld;
+}
+
+static SwField* In_SwDocInfoField( SwSwgReader& rPar, SwDocInfoFieldType* pType,
+ USHORT nSubType )
+{
+ BYTE nType;
+ rPar.r >> nType;
+ return new SwDocInfoField( pType, (USHORT)nType | nSubType );
+}
+
+static SwField* In_SwTemplNameField( SwSwgReader& rPar, SwTemplNameFieldType* pType )
+{
+ return new SwTemplNameField( pType, nNewFldFmt );
+}
+
+static SwField* In_SwDBNextSetField( SwSwgReader& rPar, SwDBNextSetFieldType* pType )
+{
+ String aCond(rPar.GetText());
+ String aName(rPar.GetText());
+ return new SwDBNextSetField( pType, aCond, aName, rPar.pDoc->GetDBData() );
+}
+
+static SwField* In_SwDBNumSetField( SwSwgReader& rPar, SwDBNumSetFieldType* pType )
+{
+ String aCond(rPar.GetText());
+ String aPar2(rPar.GetText());
+ return new SwDBNumSetField( pType, aCond, aPar2, rPar.pDoc->GetDBData());
+}
+
+static SwField* In_SwDBSetNumberField( SwSwgReader& rPar, SwDBSetNumberFieldType* pType )
+{
+ SwDBSetNumberField* pFld = new SwDBSetNumberField( pType, rPar.pDoc->GetDBData() );
+ if( rPar.aHdr.nVersion >= SWG_VER_FRAMES3 )
+ {
+ long n;
+ rPar.r.long4();
+ rPar.r >> n;
+ rPar.r.long3();
+ pFld->SetSetNumber( n );
+ }
+ return pFld;
+}
+
+static SwField* In_SwExtUserField( SwSwgReader& rPar, SwExtUserFieldType* pType )
+{
+ String aData = rPar.GetText();
+ USHORT nSubType;
+ rPar.r >> nSubType;
+
+ SwExtUserField* pFld = new SwExtUserField( pType, nSubType );
+ pType->SetData( aData );
+ return pFld;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+extern void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich,
+ USHORT& rSubType, UINT32 &rFmt,
+ USHORT nVersion );
+
+SwField* SwSwgReader::InField()
+{
+ long endfld = r.getskip();
+ short nFld;
+ USHORT nOldFldFmt;
+ USHORT nSubType = 0;
+
+ r >> nFld >> nOldFldFmt;
+ nNewFldFmt = nOldFldFmt;
+
+ if( nFld == -1 )
+ {
+ // war unbekanntes Feld, ignorieren
+ r.skip(); return NULL;
+ }
+ nFld += RES_FIELDS_BEGIN;
+
+ UINT16 nRealWhich = nFld;
+ sw3io_ConvertFromOldField( *pDoc, nRealWhich, nSubType, nNewFldFmt, 0 );
+
+ SwField* pFld = NULL;
+ SwFieldType* pType = pDoc->GetSysFldType( (const RES_FIELDS) nRealWhich );
+ switch( nFld )
+ {
+ case RES_DBFLD:
+ pFld = In_SwDBField( *this, NULL, nSubType );
+ break;
+ case RES_USERFLD:
+ pFld = In_SwUserField( *this, NULL, nSubType );
+ break;
+ case RES_FILENAMEFLD:
+ pFld = In_SwFileNameField( *this, (SwFileNameFieldType*) pType );
+ break;
+ case RES_DBNAMEFLD:
+ pFld = In_SwDBNameField( *this, (SwDBNameFieldType*) pType );
+ break;
+ case RES_DATEFLD:
+ pFld = In_SwDateField( *this, (SwDateTimeFieldType*) pType );
+ break;
+ case RES_TIMEFLD:
+ pFld = In_SwTimeField( *this, (SwDateTimeFieldType*) pType );
+ break;
+ case RES_PAGENUMBERFLD:
+ pFld = In_SwPageNumberField( *this, (SwPageNumberFieldType*) pType );
+ break;
+ case RES_AUTHORFLD:
+ pFld = In_SwAuthorField( *this, (SwAuthorFieldType*) pType );
+ break;
+ case RES_CHAPTERFLD:
+ pFld = In_SwChapterField( *this, (SwChapterFieldType*) pType );
+ break;
+ case RES_DOCSTATFLD:
+ pFld = In_SwDocStatField( *this, (SwDocStatFieldType*) pType );
+ break;
+ case RES_GETREFFLD:
+ pFld = In_SwGetRefField( *this, (SwGetRefFieldType*) pType );
+ break;
+ case RES_HIDDENTXTFLD:
+ pFld = In_SwHiddenTxtField( *this, (SwHiddenTxtFieldType*) pType );
+ break;
+ case RES_POSTITFLD:
+ pFld = In_SwPostItField( *this, (SwPostItFieldType*) pType );
+ break;
+ case RES_FIXDATEFLD:
+ pFld = In_SwFixDateField( *this, (SwDateTimeFieldType*) pType );
+ break;
+ case RES_FIXTIMEFLD:
+ pFld = In_SwFixTimeField( *this, (SwDateTimeFieldType*) pType );
+ break;
+ /*
+ MS: gibst nicht mehr
+
+ case RES_REGFLD:
+ pFld = In_SwRegField( *this, NULL );
+ break;
+ case RES_VARREGFLD:
+ pFld = In_SwVarRegField( *this, NULL );
+ break;
+ */
+ case RES_DDEFLD:
+ pFld = In_SwDDEField( *this, NULL );
+ break;
+ case RES_INPUTFLD:
+ pFld = In_SwInputField( *this, (SwInputFieldType*) pType );
+ break;
+ case RES_MACROFLD:
+ pFld = In_SwMacroField( *this, (SwMacroFieldType*) pType );
+ break;
+ case RES_TABLEFLD:
+ pFld = In_SwTblField( *this, (SwTblFieldType*) pType, nSubType );
+ break;
+ case RES_GETEXPFLD:
+ pFld = In_SwGetExpField( *this, (SwGetExpFieldType*) pType, nSubType );
+ break;
+ case RES_SETEXPFLD:
+ pFld = In_SwSetExpField( *this, NULL, nSubType );
+ break;
+ case RES_HIDDENPARAFLD:
+ pFld = In_SwHiddenParaField( *this, (SwHiddenParaFieldType*) pType );
+ break;
+ case RES_DOCINFOFLD:
+ pFld = In_SwDocInfoField( *this, (SwDocInfoFieldType*) pType, nSubType );
+ break;
+ case RES_TEMPLNAMEFLD:
+ pFld = In_SwTemplNameField( *this, (SwTemplNameFieldType*) pType );
+ break;
+ case RES_DBNEXTSETFLD:
+ pFld = In_SwDBNextSetField( *this, (SwDBNextSetFieldType*) pType );
+ break;
+ case RES_DBNUMSETFLD:
+ pFld = In_SwDBNumSetField( *this, (SwDBNumSetFieldType*) pType );
+ break;
+ case RES_DBSETNUMBERFLD:
+ pFld = In_SwDBSetNumberField( *this, (SwDBSetNumberFieldType*) pType );
+ break;
+ case RES_EXTUSERFLD:
+ pFld = In_SwExtUserField( *this, (SwExtUserFieldType*) pType );
+ break;
+ }
+ r.skip( endfld );
+
+ if( !r )
+ delete pFld, pFld = NULL;
+ if( pFld )
+ pFld->ChangeFormat( nNewFldFmt );
+ return pFld;
+}
+
+// Einlesen aller Feldtypen, die keine Systemtypen sind
+
+void SwSwgReader::InFieldTypes()
+{
+ USHORT nFields;
+ r >> nFields;
+ for( USHORT i = 0; i < nFields && r.good(); i++ )
+ {
+ if( aHdr.nVersion >= SWG_VER_POOLIDS )
+ {
+ if( r.next() != SWG_DATA )
+ {
+ Error(); break;
+ }
+ long nextrec = r.getskip();
+ InFieldType();
+ r.skip( nextrec );
+ } else InFieldType();
+ }
+ if( r.good() )
+ r.next();
+}
+
+SwFieldType* SwSwgReader::InFieldType()
+{
+ BYTE ch;
+ SwFieldType* p = NULL;
+ r >> ch;
+ ch += RES_FIELDS_BEGIN;
+ switch( ch )
+ {
+ case RES_DBFLD:
+ p = In_SwDBFieldType( *this ); break;
+ case RES_USERFLD:
+ p = In_SwUserFieldType( *this ); break;
+ /*
+ MS: Gibts nicht mehr
+
+ case RES_REGFLD:
+ p = In_SwRegFieldType( *this ); break;
+ case RES_VARREGFLD:
+ p = In_SwVarRegFieldType( *this ); break;
+ */
+ case RES_DDEFLD:
+ p = In_SwDDEFieldType( *this ); break;
+ case RES_SETEXPFLD:
+ p = In_SwSetExpFieldType( *this ); break;
+ }
+ return p;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdfmts.cxx b/binfilter/bf_sw/source/core/swg/sw_rdfmts.cxx
new file mode 100644
index 000000000000..1cbf2b1afe72
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdfmts.cxx
@@ -0,0 +1,1096 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#include <bf_svtools/svstdarr.hxx>
+#endif
+#include <bf_svtools/itemiter.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+
+#include <fmtfsize.hxx>
+
+#include <horiornt.hxx>
+
+#include <fmtornt.hxx>
+#include <frmatr.hxx>
+
+#include <errhdl.hxx>
+
+#include <node.hxx>
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include <numrule.hxx>
+#include "doc.hxx"
+#include "docary.hxx"
+#include "rdswg.hxx"
+#include "swgpar.hxx" // SWGRD_xxx-Flags
+#include "poolfmt.hxx"
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+// Maximale Anzahl verarbeitbarer Formate
+
+#define MAXFMTS (USHORT) ( 65000L / sizeof( FmtInfo ) )
+
+// Diese Klasse steht als leerer Format-Container zur Verfuegung,
+// der beliebig gefuellt werden kann.
+
+class SwFmtContainer : public SwFmt
+{
+public:
+ SwFmtContainer( SwDoc& rDoc )
+ : SwFmt( rDoc.GetAttrPool(), String(), RES_CHRATR_BEGIN, RES_GRFATR_END,
+ 0, 0 )
+ {}
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Achtung: Jede Routine nimmt an, dass der Record-Header bereits eingelesen
+// ist. Sie arbeitet den Record so weit ab wie moeglich und schliesst den
+// Vorgang mit end() ab.
+
+//////////////////////////////////////////////////////////////////////////////
+
+static SwFmt* _GetUserPoolFmt( USHORT nId, const SvPtrarr* pFmtArr );
+
+// Formatbeschreibungen
+
+// Einlesen eines AttrSets
+// Dies war frueher mal ein AutoFormat und ist als solches in der
+// Datei abgelegt. Die Autoformat-Hierarchien werden hier entsprechend
+// aufgeloest. Die Attribute werden als SwAttrs-Array registriert.
+// Returnwert: das Format-ID des AttrSets
+
+USHORT SwSwgReader::InAttrSet( SwAttrSet& rSet )
+{
+ // Format einlesen
+ USHORT nFmtId, nDerived;
+ if( aHdr.nVersion >= SWG_VER_COMPAT )
+ {
+ if( r.next() != SWG_DATA ) Error();
+ else r >> nDerived >> nFmtId;
+ r.skipnext(); // Rest kann weg
+ r.skip(); // Name kann weg
+ }
+ else
+ {
+ BYTE cFlags;
+ r >> nDerived >> nFmtId;
+ r.next(); r.skip(); // Name kann weg
+ r >> cFlags;
+ }
+ // Attribute einlesen
+ SfxItemSet* pSet = rSet.Clone( FALSE );
+ if( r.next() == SWG_COMMENT ) r.skipnext();
+ if( r.cur() == SWG_FMTHINTS )
+ {
+ UINT16 nHt;
+ r >> nHt;
+// else
+ {
+ r.next();
+ for( USHORT i = 0; i < nHt && r.good(); i++ )
+ {
+ InHint( *pSet );
+ r.next();
+ }
+ }
+ }
+ if( ( nDerived & IDX_TYPEMASK ) == IDX_NAMEDFMT )
+ nDerived = IDX_DFLT_VALUE;
+ const SfxItemSet* pParent =
+ ( nDerived == IDX_DFLT_VALUE || nDerived == IDX_NO_VALUE )
+ ? NULL : FindAttrSet( nDerived );
+ pSet->SetParent( pParent );
+ rSet.Put( *pSet );
+ RegisterAttrSet( pSet, nFmtId );
+ if( pParent )
+ FillAttrSet( rSet, nDerived );
+ return nFmtId;
+}
+
+void SwSwgReader::FillAttrSet( SwAttrSet& rSet, USHORT nFmtId )
+{
+ const SfxItemSet* pParent =
+ ( nFmtId == IDX_DFLT_VALUE || nFmtId == IDX_NO_VALUE )
+ ? NULL : FindAttrSet( nFmtId );
+ // Das uebergebene AttrSet wird mit allen Attributen gefuellt
+ while( pParent )
+ {
+ if( pParent->Count() )
+ {
+ SfxItemIter aIter( *pParent );
+ const SfxPoolItem* pAttr = aIter.GetCurItem();
+ for( USHORT i = 0; i < pParent->Count(); i++ )
+ {
+ // nur setzen, wenn nicht frisch eingelesen!
+ if( rSet.GetItemState( pAttr->Which(), FALSE ) != SFX_ITEM_SET )
+ rSet.Put( *pAttr );
+ pAttr = aIter.NextItem();
+ }
+ }
+ pParent = pParent->GetParent();
+ }
+}
+
+// Einlesen des Attribut-Sets eines CntntNodes
+
+USHORT SwSwgReader::InAttrSet( SwCntntNode& rNd )
+{
+ USHORT nFmtId;
+ if( rNd.GetDepends() )
+ {
+ SwAttrSet aTmpSet( pDoc->GetAttrPool(), aTxtNodeSetRange );
+ nFmtId = InAttrSet( aTmpSet );
+ if( aTmpSet.Count() )
+ rNd.SetAttr( aTmpSet );
+ }
+ else
+ {
+ if( !rNd.GetpSwAttrSet() )
+ rNd.NewAttrSet( pDoc->GetAttrPool() );
+ nFmtId = InAttrSet( *rNd.GetpSwAttrSet() );
+ }
+ return nFmtId;
+}
+
+// Ein Format einlesen
+// Hier wird das Format auch erzeugt.
+// Wird auch von Hints verwendet!
+
+SwFmt* SwSwgReader::InFormat( SwFmt* pFmt, USHORT* pParentId )
+{
+ BYTE cFmtKind = r.cur();
+ r.getskip();
+ BYTE nHelpFid = (BYTE) nHelpFileId;
+ USHORT nHelpId = USHRT_MAX;
+ BYTE cFlags;
+ USHORT nFmtId;
+ if( cFmtKind == SWG_FLYFMT ) nFlyLevel++;
+ nFmtLvl++;
+
+ String aName( String::CreateFromAscii("dummy") );
+ USHORT nDerived, nPoolId = IDX_NO_VALUE;
+ if( aHdr.nVersion >= SWG_VER_COMPAT )
+ {
+ if( r.next() != SWG_DATA ) Error();
+ else r >> nDerived >> nFmtId >> nPoolId;
+ // Korrektur fuer aeltere Pool-Ids:
+ if( aHdr.nVersion <= SWG_VER_FRAMES3 ) nPoolId = IDX_NO_VALUE;
+ else if( nPoolId < IDX_SPECIAL )
+ // USER-Feld verkleinern
+ nPoolId &= 0xBFFF;
+ // Flag Bits:
+ // 0x01 - Autoformat (tot)
+ // 0x02 - Breakformat (tot)
+ // 0x04 - Help ID folgt
+ // 0x08 - Pattern-Name fuer Help folgt
+ // 0x10 - Format-ID folgt, das bereits den Pattern-Namen hat
+ r >> cFlags;
+ if( cFlags & 0x04 )
+ {
+ BYTE n;
+ r >> n;
+ nHelpId = (UCHAR_MAX == n ? USHRT_MAX : (USHORT)n);
+ }
+ if( cFlags & 0x08 )
+ {
+ String aPattern = GetText();
+ if( aPattern.Len() )
+ nHelpFid = (BYTE) pDoc->SetDocPattern( aPattern );
+ }
+ if( cFlags & 0x10 )
+ {
+ USHORT nHelpFmt;
+ r >> nHelpFmt;
+ SwFmt* pHelpFmt = FindFmt( nHelpFmt, 0 );
+ if( pHelpFmt )
+ nHelpFid = pHelpFmt->GetPoolHlpFileId();
+ }
+ r.skip();
+ aName = GetText();
+ }
+ else
+ {
+ r >> nDerived >> nFmtId;
+ aName = GetText();
+ r >> cFlags;
+ }
+ // Freundlicherweise treten wir hier 1 Bit an ST ab, der es
+ // im PageDesc benoetigt (Version 1.x)
+ nFlagBits = cFlags >> 4;
+
+ // Format erzeugen
+ if( !pFmt ) {
+ switch( cFmtKind )
+ {
+ case SWG_FREEFMT:
+ // Freifliegende Frameformate werden von Headers
+ // und Footers verwendet.
+ pFmt = new SwFrmFmt( pDoc->GetAttrPool(), aName,
+ pDoc->GetDfltFrmFmt() );
+ break;
+ case SWG_FRAMEFMT:
+ if( IDX_NO_VALUE != nPoolId )
+ {
+ if( IsPoolUserFmt( nPoolId ) )
+ {
+ // wir suchen uns das richtige Format
+ if( 0 == ( pFmt = _GetUserPoolFmt( nPoolId,
+ pDoc->GetFrmFmts() )) )
+ pFmt = _GetUserPoolFmt( nPoolId,
+ pDoc->GetSpzFrmFmts() );
+ ASSERT( pFmt, "Format not found." );
+ }
+ else
+ pFmt = pDoc->GetFrmFmtFromPool( nPoolId );
+ }
+ if( !pFmt )
+ {
+ if( IDX_DFLT_VALUE != nDerived && pParentId )
+ {
+ *pParentId = nDerived & ~IDX_TYPEMASK;
+ SwFmt* pParent = 0;
+ if( pFmts && pFmts[ *pParentId ].cFmt & FINFO_FORMAT )
+ pParent = pFmts[ *pParentId ].pFmt;
+ pFmt = pDoc->MakeFrmFmt( aName, (SwFrmFmt*)pParent );
+ if( pParent )
+ *pParentId = USHRT_MAX;
+ }
+ else
+ pFmt = pDoc->MakeFrmFmt( aName,
+ (SwFrmFmt*)FindFmt( nDerived, cFmtKind ));
+ }
+ else
+ pFmt->ResetAllAttr();
+ break;
+ case SWG_CHARFMT:
+ if( IDX_NO_VALUE != nPoolId )
+ {
+ if( IsPoolUserFmt( nPoolId ) )
+ // wir suchen uns das richtige Format
+ pFmt = _GetUserPoolFmt( nPoolId, pDoc->GetCharFmts());
+ else
+ pFmt = pDoc->GetCharFmtFromPool( nPoolId );
+ }
+ if( !pFmt )
+ {
+ if( IDX_DFLT_VALUE != nDerived && pParentId )
+ {
+ *pParentId = nDerived & ~IDX_TYPEMASK;
+ SwFmt* pParent = 0;
+ if( pFmts && pFmts[ *pParentId ].cFmt & FINFO_FORMAT )
+ pParent = pFmts[ *pParentId ].pFmt;
+ pFmt = pDoc->MakeCharFmt( aName, (SwCharFmt*)pParent );
+ if( pParent )
+ *pParentId = USHRT_MAX;
+ }
+ else
+ pFmt = pDoc->MakeCharFmt( aName,
+ (SwCharFmt*) FindFmt( nDerived, cFmtKind ) );
+ }
+ else
+ pFmt->ResetAllAttr();
+ break;
+ case SWG_FLYFMT:
+ pFmt = pDoc->MakeFlyFrmFmt( aName,
+ (SwFlyFrmFmt*) FindFmt( nDerived, cFmtKind ) );
+ break;
+ }
+ } else if( nDerived != IDX_NO_VALUE )
+ pFmt->SetDerivedFrom( FindFmt( nDerived, cFmtKind ) );
+
+ pFmt->nFmtId = nFmtId;
+ pFmt->SetPoolHelpId( nHelpId );
+ pFmt->SetPoolHlpFileId( nHelpFid );
+ pFmt->SetAuto( BOOL( ( cFlags & 0x01 ) != 0 ) );
+ if( nPoolId != IDX_NO_VALUE ) pFmt->SetPoolFmtId( nPoolId );
+
+ if( r.next() == SWG_COMMENT ) r.skipnext();
+ if( r.cur() == SWG_FMTHINTS )
+ {
+ SwAttrSet aSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_GRFATR_END );
+ short nHt;
+ r >> nHt;
+ if( nHt < 0 ) Error(), r.skipnext();
+ else {
+ r.next();
+ for( int i = 0; i < nHt && r.good(); i++ )
+ {
+ InHint( aSet );
+ r.next();
+ // Wurde ein PageDesc-Attr gelesen? Dann das Format
+ // im PageDescLink noch nachtragen!
+ if( pPageLinks && !pPageLinks->pFmt )
+ {
+ pPageLinks->pFmt = pFmt;
+ pPageLinks->cFmt = TRUE;
+ }
+ }
+ }
+ pFmt->SetAttr( aSet );
+ }
+
+ if( cFmtKind == SWG_FLYFMT )
+ {
+ nFlyLevel--;
+ // Hot fix: Umsetzen des Attributes ATT_VAR_SIZE in ATT_MIN_SIZE
+ // im Hint SwFmtFrmSize innerhalb von FlyFrames
+ // MIB 18.11.96: und ausserdem noch die Groesse und Position
+ // an die neuen Abstaende nach aussen anpassen
+ SwFrmFmt* pFrmFmt = (SwFrmFmt*) pFmt;
+
+ const SvxLRSpaceItem& rLRSpace = pFrmFmt->GetLRSpace();
+ const SvxULSpaceItem& rULSpace = pFrmFmt->GetULSpace();
+
+ const SwFmtFrmSize& rFrmSize = pFmt->GetFrmSize();
+ Size aConvSize(
+ rFrmSize.GetSizeConvertedFromSw31( &rLRSpace,
+ &rULSpace ) );
+
+ if( rFrmSize.GetSize() != aConvSize ||
+ rFrmSize.GetSizeType() == ATT_VAR_SIZE )
+ {
+ SwFmtFrmSize aFrmSize( rFrmSize );
+ aFrmSize.SetSize( aConvSize );
+ if( aFrmSize.GetSizeType() == ATT_VAR_SIZE )
+ aFrmSize.SetSizeType( ATT_MIN_SIZE );
+
+ pFrmFmt->SetAttr( aFrmSize );
+ }
+
+ const SwFmtHoriOrient& rHori = pFmt->GetHoriOrient();
+ SwTwips nConvPos =
+ rHori.GetPosConvertedFromSw31( &rLRSpace );
+ if( rHori.GetPos() != nConvPos )
+ {
+ SwFmtHoriOrient aHori( rHori );
+ aHori.SetPos( nConvPos );
+ pFrmFmt->SetAttr( aHori );
+ }
+
+ const SwFmtVertOrient& rVert = pFmt->GetVertOrient();
+ nConvPos = rVert.GetPosConvertedFromSw31( &rULSpace );
+ if( rVert.GetPos() != nConvPos )
+ {
+ SwFmtVertOrient aVert( rVert );
+ aVert.SetPos( nConvPos );
+ pFrmFmt->SetAttr( aVert );
+ }
+ }
+ nFmtLvl--;
+ return pFmt;
+}
+
+// Testen, ob ein Format einen Pool-Formatnamen hat.Dies fuehrt bei alten
+// Dokumenten dazu, dass das Pool-ID gesetzt wird.
+
+BOOL SwSwgReader::TestPoolFmt( SwFmt& rFmt, int eFlags )
+{
+ USHORT nPoolId = rFmt.GetPoolFmtId();
+ if( aHdr.nVersion <= SWG_VER_FRAMES3 && nPoolId == IDX_NO_VALUE )
+ {
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( rFmt.GetName(),
+ (SwGetPoolIdFromName)eFlags );
+ if( nPoolId != USHRT_MAX ) {
+ rFmt.SetPoolFmtId( nPoolId );
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// Suchen eines benannten Frame- oder Zeichenformats
+// Falls ein gleichnamiges Format existiert wie das uebergebene,
+// wird dieser Ptr zurueckgeliefert, sonst NULL,
+
+static SwFmt* _findframefmt( const SwDoc* pDoc, const SwFmt* pFmt )
+{
+ USHORT nArrLen = pDoc->GetFrmFmts()->Count();
+ for( USHORT j = 0; j < nArrLen; j++ )
+ {
+ SwFmt* pFmt2 = (*pDoc->GetFrmFmts())[ j ];
+ if( ( pFmt != pFmt2 )
+ && ( pFmt->GetName() == pFmt2->GetName() ) )
+ return pFmt2;
+ }
+ return NULL;
+
+}
+
+
+static SwFmt* _findcharfmt( const SwDoc* pDoc, const SwFmt* pFmt )
+{
+ USHORT nArrLen = pDoc->GetCharFmts()->Count();
+ for( USHORT j = 0; j < nArrLen; j++ )
+ {
+ SwFmt* pFmt2 = (*pDoc->GetCharFmts())[ j ];
+ if( ( pFmt != pFmt2 )
+ && ( pFmt->GetName() == pFmt2->GetName() ) )
+ return pFmt2;
+ }
+ return NULL;
+
+}
+
+// Eine Text-Collection einlesen
+
+void lcl_sw3io__ConvertNumTabStop( SvxTabStopItem& rTStop, long nOffset );
+
+void SwSwgReader::InTxtFmtColl( short nIdx )
+{
+ BOOL bForceRead = BOOL( ( nOptions != SWGRD_NORMAL )
+ && ( nOptions & SWGRD_PARAFMTS )
+ && ( nOptions & SWGRD_FORCE ) );
+ long skipit = r.getskip();
+ SwTxtFmtColl* pColl = NULL;
+ BYTE nLevel;
+ USHORT nDerived = IDX_NO_VALUE, nFollow = IDX_NO_VALUE;
+ USHORT nCharRef = IDX_NO_VALUE, nPoolId = IDX_NO_VALUE;
+ String aName;
+ if( aHdr.nVersion >= SWG_VER_COMPAT )
+ {
+ if( r.next() != SWG_DATA )
+ {
+ Error(); return;
+ }
+ r >> nLevel >> nDerived >> nFollow >> nCharRef >> nPoolId;
+ // Korrektur fuer aeltere Pool-Ids:
+ if( aHdr.nVersion <= SWG_VER_FRAMES3 ) nPoolId = IDX_DFLT_VALUE;
+ else if( nPoolId < IDX_SPECIAL )
+ // USER-Feld verkleinern
+ nPoolId &= 0xBFFF;
+ r.skip();
+ aName = GetText();
+ } else {
+ r >> nLevel;
+ aName = GetText();
+ r >> nDerived >> nFollow;
+ if( aHdr.nVersion >= SWG_VER_COLLREF )
+ r >> nCharRef;
+ }
+
+ // Fehler: Unbenannte Vorlage; Defaultnamen vergeben
+ if( !aName.Len() )
+ {
+ static short n = 1;
+ aName.AssignAscii( "NoName" );
+ aName += String::CreateFromInt32( n++ );
+ }
+
+ // Gibt es diese Coll bereits?
+ USHORT nArrLen = pDoc->GetTxtFmtColls()->Count();
+ USHORT n;
+ // Erste Runde: Ist bei alten Dokumenten der Name ein Poolformatname?
+ if( aHdr.nVersion < SWG_VER_COMPAT || nPoolId == IDX_DFLT_VALUE )
+ {
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, GET_POOLID_TXTCOLL );
+ if( nPoolId == USHRT_MAX ) nPoolId = IDX_NO_VALUE;
+ }
+ // Zweite Runde: Nach dem Pool-ID suchen ( falls definiert! )
+ if( nPoolId != IDX_NO_VALUE && !IsPoolUserFmt( nPoolId ))
+ for( n = 0; n < nArrLen; n++ )
+ {
+ SwTxtFmtColl* pCur = (*pDoc->GetTxtFmtColls())[ n ];
+ if( pCur->GetPoolFmtId() == nPoolId )
+ {
+ pColl = pCur;
+ break;
+ }
+ }
+ // Dritte Runde: Pool-Vorlage anfordern, falls moeglich
+ if( !pColl && nPoolId != IDX_NO_VALUE && !IsPoolUserFmt( nPoolId ))
+ {
+ pColl = pDoc->GetTxtCollFromPool( nPoolId );
+ ASSERT( pColl, "Keine TxtColl fuer PoolId gefunden" );
+ if( !pColl )
+ nPoolId = IDX_NO_VALUE;
+ }
+ // Vierte Runde: Ueber den Namen suchen
+ if( !pColl )
+ for( n = 0; n < nArrLen; n++ )
+ {
+ SwTxtFmtColl* pCur = (*pDoc->GetTxtFmtColls())[ n ];
+ if( pCur->GetName() == aName )
+ pColl = pCur;
+ // Bei Einfuegen von Vorlagen muss ggf. der Outline-Level geloescht
+ // werden, wenn bereits eine Vorlage mit diesem Level existiert.
+ if( pCur->GetOutlineLevel() == nLevel )
+ nLevel = NO_NUMBERING;
+ }
+
+ // Falls es sie gibt, muessen die Formate neu erstellt werden.
+ // In Insert Mode darf die Coll jedoch nicht veraendert werden!
+
+ if( !pColl || ( nPoolId != IDX_NO_VALUE ) )
+ {
+ if( !pColl )
+ {
+ SwTxtFmtColl* pDer = (*pDoc->GetTxtFmtColls())[ 0 ];
+ pColl = pDoc->MakeTxtFmtColl( aName, pDer );
+ }
+ pCollIdx[ nIdx ].nDerived = nDerived | IDX_COLLECTION;
+ pCollIdx[ nIdx ].nFollow = nFollow | IDX_COLLECTION;
+ }
+ else
+ {
+ // Soll die Collection dennoch glesen werden?
+ // Durch einen OT-Bug kommt es vor, dass eine Coll mehrfach
+ // vorhanden ist. Wenn dies der Fall ist, nicht einlesen.
+ BOOL bRead = bForceRead;
+ // Die vorhandene Standardvorlage wird bei neuem Doc immer
+ // uebergeplaettet.
+ if( bNew && ( nIdx == 1 ) ) bRead = TRUE;
+ if( !bRead )
+ {
+ // Also doch nicht einlesen
+ pCollIdx[ nIdx ].nDerived =
+ pCollIdx[ nIdx ].nFollow = IDX_NO_VALUE;
+ pColl->nFmtId = IDX_COLLECTION + nIdx;
+ RegisterFmt( *pColl );
+ r.skip( skipit ); r.next(); return;
+ }
+ }
+
+ pColl->nFmtId = IDX_COLLECTION + nIdx;
+ pColl->SetOutlineLevel( nLevel );
+
+ BOOL bDone = FALSE;
+ pColl->ResetAllAttr();
+ // HACK: So lange es die Referenz nicht gibt, wird das benannte
+ // Format in das eigene CharFmt kopiert. Muss hier geschehen,
+ // da Set() den Inhalt loescht.
+ if( nCharRef != IDX_NO_VALUE )
+ {
+ SwCharFmt* pCfmt = (SwCharFmt*) FindFmt( nCharRef, SWG_CHARFMT );
+ if( pCfmt && !pCfmt->IsDefault() )
+ {
+ SfxItemSet& rColl = (SfxItemSet&) pColl->GetAttrSet();
+ rColl.Set( pCfmt->GetAttrSet() );
+ }
+ }
+ r.next();
+ while( !bDone ) {
+ switch( r.cur() ) {
+ case SWG_FRAMEFMT:
+ case SWG_PARAFMT:
+ case SWG_CHARFMT:
+ // Bei CharFmts an den Hot fix denken, dass bei
+ // Namensgleichheit mit einem benannten Format
+ // kein Format gelesen, sondern statt dessen das
+ // benannte Format angebunden wird!
+ InFormat( pColl );
+ break;
+ case SWG_COMMENT:
+ if( r.tell() < skipit ) r.skipnext();
+ default:
+ bDone = TRUE;
+ }
+ }
+ if( nPoolId != IDX_NO_VALUE )
+ pColl->SetPoolFmtId( nPoolId );
+
+ const SwNumRule *pOutline = pDoc->GetOutlineNumRule();
+ if( nLevel < MAXLEVEL && pOutline )
+ {
+ const SwNumFmt& rFmt = pOutline->Get( nLevel );
+ const SvxLRSpaceItem& rLRSpace = pColl->GetLRSpace();
+ if( rFmt.GetAbsLSpace() != rLRSpace.GetTxtLeft() ||
+ rFmt.GetFirstLineOffset() != rLRSpace.GetTxtFirstLineOfst() )
+ {
+ SwNumFmt aFmt( rFmt );
+ aFmt.SetAbsLSpace( rLRSpace.GetTxtLeft() );
+ aFmt.SetFirstLineOffset( rLRSpace.GetTxtFirstLineOfst() );
+
+ SwNumRule aOutline( *pOutline );
+ aOutline.Set( nLevel, aFmt );
+ pDoc->SetOutlineNumRule( aOutline );
+ }
+
+#ifdef NUM_RELSPACE
+ // Den linken-Einzug in der Vorlage auf 0 setzen, damit
+ // er nicht doppelt gezaehlt wird. Wenn das
+ SvxLRSpaceItem aLRSpace( rLRSpace );
+ USHORT nOldLSpace = rLRSpace.GetTxtLeft();
+ aLRSpace.SetTxtFirstLineOfst( 0 );
+ aLRSpace.SetTxtLeft( 0U );
+ SwFmt *pParFmt = pColl->DerivedFrom();
+ if( pParFmt && pParFmt->GetLRSpace() == aLRSpace )
+ pColl->ResetAttr( RES_LR_SPACE );
+ else if( aLRSpace != rLRSpace )
+ pColl->SetAttr( aLRSpace );
+ if( nOldLSpace != 0 )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pColl->GetAttrSet().GetItemState(
+ RES_PARATR_TABSTOP, TRUE, &pItem ))
+ {
+ SvxTabStopItem aTStop( *(SvxTabStopItem*)pItem );
+ lcl_sw3io__ConvertNumTabStop( aTStop, nOldLSpace );
+ pColl->SetAttr( aTStop );
+ }
+ }
+#endif
+ }
+ RegisterFmt( *pColl );
+}
+
+// Alle Collections einlesen
+
+
+void SwSwgReader::InTxtFmtColls()
+{
+ USHORT i;
+ r >> nColl;
+ if( nColl ) {
+ // Format-Indextabelle erzeugen
+ TxtCollInfo* p =
+ pCollIdx = new TxtCollInfo[ nColl + 1 ];
+ for( i = 0; i <= nColl; i++, p++ )
+ {
+ p->nDerived =
+ p->nFollow = IDX_NO_VALUE;
+ }
+ r.next();
+ for( i = 1; i <= nColl && r.good(); i++ )
+ InTxtFmtColl( i );
+ p = pCollIdx + 1;
+ for( i = 1; i <= nColl && r.good(); i++, p++ )
+ {
+ SwTxtFmtColl* pCur = (SwTxtFmtColl*) FindFmt( IDX_COLLECTION + i, 0 );
+ if( pCur )
+ {
+ // Derived setzen
+ USHORT nIdx = p->nDerived;
+ if( nIdx != IDX_NO_VALUE )
+ {
+ // dann ist die Coll abhaengig
+ SwTxtFmtColl* pParent = (SwTxtFmtColl*) FindFmt( nIdx, 0 );
+ pCur->SetDerivedFrom( pParent );
+ }
+ // Next setzen
+ nIdx = p->nFollow;
+ if( nIdx != IDX_NO_VALUE )
+ {
+ SwTxtFmtColl* pNext = (SwTxtFmtColl*) FindFmt( nIdx, 0 );
+ pCur->SetNextTxtFmtColl( *pNext );
+ }
+ }
+ }
+ } else r.next();
+
+}
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Einlesen der Default- und Autoformate
+
+
+void SwSwgReader::InDfltFmts()
+{
+ if( !bNew )
+ {
+ // Einfuegen: Defaultformate lassen!
+ r.skipnext();
+ return;
+ }
+ r.next();
+ BOOL bDone = FALSE;
+ while( !bDone && r.good() )
+ {
+ switch( r.cur() )
+ {
+ case SWG_FRAMEFMT:
+ case SWG_CHARFMT:
+ case SWG_PARAFMT:
+ case SWG_GRFFMT:
+ {
+ SwFmtContainer aContainer( *pDoc );
+ InFormat( &aContainer );
+ if( aContainer.GetAttrSet().Count() )
+ {
+ SfxItemIter aIter( aContainer.GetAttrSet() );
+ while( TRUE )
+ {
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ pDoc->GetAttrPool().SetPoolDefaultItem( *pItem );
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ }
+ }
+ break;
+
+ default:
+ bDone = TRUE;
+ }
+ }
+}
+
+// Einlesen der benannten Formate.
+
+// Die Optionen lassen eine gezielte Auswahl zu.
+
+
+void SwSwgReader::InNamedFmts( USHORT nOptions )
+{
+ SvPtrarr aFmtArr; //JP 29.09.95: sind die Parents noch nicht eingelesen
+ SvUShorts aIdArr; // dann am Ende alle Verbinden
+
+ USHORT i, n;
+ r >> n;
+ nNamedFmt = 0;
+ r.next();
+ for( i = 0; i < n && r.good(); i++ )
+ {
+ BYTE cType = r.cur();
+ if( cType < SWG_LEFTFMT || cType > SWG_GRFFMT )
+ {
+ Error(); break;
+ }
+ // das geht hier OK, da das Format in jedem Fall gefuellt wird,
+ // wenn es durch Text benoetigt werden sollte.
+ SwFmt* pFmt = NULL;
+ SwFmt* pFmt2;
+ USHORT nParentId = USHRT_MAX;
+ switch( cType )
+ {
+ case SWG_CHARFMT:
+ if( nOptions & SWGRD_CHARFMTS )
+ {
+ pFmt = InFormat( NULL, &nParentId );
+ TestPoolFmt( *pFmt, GET_POOLID_CHRFMT );
+ pFmt2 = _findcharfmt( pDoc, pFmt );
+ if( pFmt2 )
+ {
+ // Format bereits dem Namen nach drin
+ // Entweder ueberbuegeln oder vergessen
+ if( nOptions & SWGRD_FORCE )
+ *pFmt2 = *pFmt;
+
+ // Registrierung umsetzen !!
+ ReRegisterFmt( *pFmt, *pFmt2 );
+ pDoc->DelCharFmt( (SwCharFmt*) pFmt );
+ pFmt = pFmt2;
+ break;
+ }
+ else
+ {
+ RegisterFmt( *pFmt );
+ if( USHRT_MAX != nParentId )
+ {
+ // muss am Ende den richtigen Parent bekommen!
+ void* pPtr = pFmt;
+ aFmtArr.Insert( pPtr, aFmtArr.Count() );
+ aIdArr.Insert( nParentId, aIdArr.Count() );
+ }
+ }
+ }
+ else r.skipnext();
+ break;
+ case SWG_FRAMEFMT:
+ if( nOptions & SWGRD_FRAMEFMTS )
+ {
+ pFmt = InFormat( NULL, &nParentId );
+ TestPoolFmt( *pFmt, GET_POOLID_FRMFMT );
+ pFmt2 = _findframefmt( pDoc, pFmt );
+ if( pFmt2 )
+ {
+ // Format bereits dem Namen nach drin,
+ // Entweder ueberbuegeln oder vergessen
+ if( nOptions & SWGRD_FORCE )
+ *pFmt2 = *pFmt;
+
+ // Registrierung umsetzen !!
+ ReRegisterFmt( *pFmt, *pFmt2 );
+ pDoc->DelFrmFmt( (SwFrmFmt*) pFmt );
+ pFmt = pFmt2;
+ break;
+ }
+ else
+ {
+ RegisterFmt( *pFmt );
+ if( USHRT_MAX != nParentId )
+ {
+ // muss am Ende den richtigen Parent bekommen!
+ void* pPtr = pFmt;
+ aFmtArr.Insert( pPtr, aFmtArr.Count() );
+ aIdArr.Insert( nParentId, aIdArr.Count() );
+ }
+ }
+ }
+ else r.skipnext();
+ break;
+ default:
+ r.skipnext();
+ }
+ if( pFmt )
+ nNamedFmt++;
+ }
+
+ if( pFmts )
+ for( i = aFmtArr.Count(); i; )
+ {
+ SwFmt* pFmt = (SwFmt*)aFmtArr[ --i ];
+ SwFmt* pParent;
+ if( pFmts[ n = aIdArr[ i ] ].cFmt & FINFO_FORMAT )
+ pParent = pFmts[ n ].pFmt;
+ else if( RES_CHRFMT == pFmt->Which() )
+ pParent = pDoc->GetDfltCharFmt();
+ else
+ pParent = pDoc->GetDfltFrmFmt();
+
+ pFmt->SetDerivedFrom( pParent );
+ }
+}
+
+// Registrieren eines Formats
+// Das Format wird mit seinem Wert in der Tabelle registriert.
+// Die Collection-Formate wwerden an das Ende der Tabelle gehaengt, da
+// die Format-ID sich mit den anderen IDs ueberschneiden.
+
+void SwSwgReader::RegisterFmt( SwFmt& rFmt, const SwTable *pTable )
+{
+ USHORT nIdx = rFmt.nFmtId;
+ if( nIdx == IDX_NO_VALUE || nIdx == IDX_DFLT_VALUE )
+ return;
+ // Collection-Index?
+ if( ( nIdx & IDX_TYPEMASK ) == IDX_COLLECTION )
+ nIdx = MAXFMTS - 1 - ( nIdx & ~IDX_TYPEMASK );
+ else
+ nIdx &= ~IDX_TYPEMASK;
+ // Array eingerichtet?
+ if( !pFmts ) {
+ pFmts = new FmtInfo[ MAXFMTS ];
+ memset( pFmts, 0, MAXFMTS * sizeof( FmtInfo ) );
+ }
+ // Bereits registriert?
+ ASSERT( pFmts[ nIdx ].pFmt == 0, "Format bereits registriert!" );
+
+ pFmts[ nIdx ].pFmt = &rFmt;
+ pFmts[ nIdx ].cFmt = FINFO_FORMAT;
+ if( nStatus & SWGSTAT_LOCALFMTS )
+ pFmts[ nIdx ].cFmt |= FINFO_LOCAL;
+
+ if( pTable )
+ RegisterTable( nIdx, pTable );
+}
+
+// Registrieren eines AttrSets
+// Ein AttrSet wird u.U. mehrfach registeriert, da es die Rolle
+// der drei Autoformate am Node uebernommen hat.
+
+void SwSwgReader::RegisterAttrSet( SfxItemSet* pSet, USHORT nIdx )
+{
+ if( nIdx == IDX_NO_VALUE || nIdx == IDX_DFLT_VALUE )
+ return;
+ // Array eingerichtet?
+ if( !pFmts ) {
+ pFmts = new FmtInfo[ MAXFMTS ];
+ memset( pFmts, 0, MAXFMTS * sizeof( FmtInfo ) );
+ }
+ // Bereits registriert?
+ ASSERT( pFmts[ nIdx ].pSet == 0, "AttrSet bereits registriert!" );
+ pFmts[ nIdx ].pSet = pSet;
+ pFmts[ nIdx ].cFmt = 0;
+ if( nStatus & SWGSTAT_LOCALFMTS )
+ pFmts[ nIdx ].cFmt |= FINFO_LOCAL;
+}
+
+// Freigabe aller Autoformate (AttrSets) vor dem Einlesen
+// eines neuen Textbausteins (da die Autoformat-Nummern neu vergeben
+// werden koennen)
+
+void SwSwgReader::ReleaseAttrSets()
+{
+ FmtInfo* p = pFmts;
+ if( p )
+ {
+ for( USHORT i = 0; i < MAXFMTS; i++, p++ )
+ {
+ if( p->cFmt & FINFO_LOCAL )
+ {
+ if( ! (p->cFmt & FINFO_FORMAT) )
+ delete p->pSet;
+ p->pSet = NULL;
+ p->cFmt = 0;
+ }
+ }
+ }
+ delete pTables; pTables = 0;
+}
+
+// Finden eines Formats nach Index
+
+SwFmt* SwSwgReader::FindFmt( USHORT nIdx, BYTE cKind )
+{
+ SwFmt* pFmt = NULL;
+ switch( nIdx )
+ {
+ case IDX_NO_VALUE:
+ return NULL; // Direkter Abbruch, kein Assert
+ case IDX_COLUMN:
+ pFmt = pDoc->GetColumnContFmt(); break;
+ case IDX_EMPTYPAGE:
+ pFmt = pDoc->GetEmptyPageFmt(); break;
+ case IDX_DFLT_VALUE:
+ switch( cKind )
+ {
+ case SWG_MASTERFMT:
+ case SWG_LEFTFMT:
+ case SWG_FLYFMT:
+ case SWG_FREEFMT:
+ case SWG_FRAMEFMT:
+ pFmt = pDoc->GetDfltFrmFmt(); break;
+ case SWG_CHARFMT:
+ case SWG_PARAFMT:
+ pFmt = pDoc->GetDfltCharFmt(); break;
+ case SWG_GRFFMT:
+ pFmt = (SwFmt*) pDoc->GetDfltGrfFmtColl(); break;
+ case 0:
+ return NULL; // Direkter Abbruch, kein Assert
+ } break;
+ default:
+ // Collection-Index?
+ if( ( nIdx & IDX_TYPEMASK ) == IDX_COLLECTION )
+ nIdx = MAXFMTS - 1 - ( nIdx & ~IDX_TYPEMASK );
+ else
+ nIdx &= ~IDX_TYPEMASK;
+ if( pFmts && pFmts[ nIdx ].cFmt & FINFO_FORMAT )
+ pFmt = pFmts[ nIdx ].pFmt;
+ }
+ ASSERT( pFmt, "Format-ID unbekannt" );
+ return pFmt;
+}
+
+// Finden eines AttrSets nach Index
+
+SfxItemSet* SwSwgReader::FindAttrSet( USHORT nIdx )
+{
+ // Standard-Werte
+ if( nIdx == IDX_NO_VALUE || nIdx == IDX_DFLT_VALUE )
+ return NULL;
+ // Nicht von Autofmt abgeleitet?
+ // dann gibt es keine Ableitung
+ if( ( nIdx & IDX_TYPEMASK ) != IDX_AUTOFMT )
+ return NULL;
+ nIdx &= ~IDX_TYPEMASK;
+ SfxItemSet* pSet = NULL;
+ if( pFmts && !( pFmts[ nIdx ].cFmt & FINFO_FORMAT ) )
+ pSet = pFmts[ nIdx ].pSet;
+ ASSERT( pSet, "Format-ID (AttrSet) unbekannt" );
+ return pSet;
+}
+
+static SwFmt* _GetUserPoolFmt( USHORT nId, const SvPtrarr* pFmtArr )
+{
+ SwFmt* pFmt;
+ for( USHORT n = 0; n < pFmtArr->Count(); ++n )
+ if( nId == (pFmt = (SwFmt*)(*pFmtArr)[n])->GetPoolFmtId() )
+ return pFmt;
+ return 0;
+}
+
+// Re-Registrierung eines Formats mit neuem Index
+// wird bei shared Hdr/Ftr-Formaten in InPageDesc() verwendet
+// Der Eintrag fuer pFmtOld wird auf pFmtNew gesetzt, so dass spaetere
+// Referenzen auf den Index pFmtNew liefern
+
+void SwSwgReader::ReRegisterFmt( const SwFmt& rFmtOld, const SwFmt& rFmtNew,
+ const SwTable *pTable)
+{
+ USHORT nIdx = rFmtOld.nFmtId;
+ if( !nIdx )
+ nIdx = rFmtNew.nFmtId;
+ ((SwFmt&)rFmtNew).nFmtId = nIdx;
+ ASSERT( nIdx, "Format nicht registriert" );
+ nIdx &= ~IDX_TYPEMASK;
+ ASSERT( !( pFmts[ nIdx ].cFmt & FINFO_FORMAT ) ||
+ !pFmts[ nIdx ].pSet ||
+ pFmts[ nIdx ].pFmt == (SwFmt*) &rFmtNew ||
+ (pTable && pTable != FindTable(nIdx)),
+ "Bereits ein AttrSet definiert!" );
+ pFmts[ nIdx ].pFmt = (SwFmt*) &rFmtNew;
+ pFmts[ nIdx ].cFmt = FINFO_FORMAT;
+ if( nStatus & SWGSTAT_LOCALFMTS )
+ pFmts[ nIdx ].cFmt |= FINFO_LOCAL;
+
+ if( pTable )
+ RegisterTable( nIdx, pTable );
+}
+
+// Entfernen aller Format-IDs, damit der Writer nicht
+// durcheinander kommt (er vergibt neue IDs)
+
+void SwSwgReader::ClearFmtIds()
+{
+ FmtInfo* p = pFmts;
+ for( USHORT i = 0; i < MAXFMTS; i++, p++ )
+ {
+ if( p->cFmt & FINFO_FORMAT )
+ p->pFmt->nFmtId = 0;
+ else
+ delete p->pSet, p->pSet = NULL;
+ }
+ delete pTables; pTables = 0;
+}
+
+void SwSwgReader::RegisterTable( USHORT nIdx, const SwTable *pTable )
+{
+ if( !pTables )
+ pTables = new SwgTables;
+ while( pTables->Count() <= nIdx )
+ pTables->Insert( (const SwTable *)0, pTables->Count() );
+ pTables->Replace( pTable, nIdx );
+}
+
+const SwTable *SwSwgReader::FindTable( USHORT nIdx )
+{
+ const SwTable *pRet = 0;
+ if( pTables && nIdx < pTables->Count() )
+ pRet = (*pTables)[nIdx];
+
+ return pRet;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdhnt.cxx b/binfilter/bf_sw/source/core/swg/sw_rdhnt.cxx
new file mode 100644
index 000000000000..e3650e633e4c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdhnt.cxx
@@ -0,0 +1,1351 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+
+#include <hintids.hxx>
+
+#include <bf_svx/paperinf.hxx>
+#include <bf_svtools/macitem.hxx>
+#include <bf_svx/wrlmitem.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/protitem.hxx>
+#include <bf_svx/opaqitem.hxx>
+#include <bf_svx/prntitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/pbinitem.hxx>
+#include <bf_svx/brkitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/udlnitem.hxx>
+#include <bf_svx/hyznitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+#include <bf_svx/orphitem.hxx>
+#include <bf_svx/widwitem.hxx>
+#include <bf_svx/spltitem.hxx>
+#include <bf_svx/adjitem.hxx>
+#include <bf_svx/lspcitem.hxx>
+#include <bf_svx/nhypitem.hxx>
+#include <bf_svx/prszitem.hxx>
+#include <bf_svx/fhgtitem.hxx>
+#include <bf_svx/escpitem.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/cmapitem.hxx>
+#include <bf_svx/crsditem.hxx>
+#include <bf_svx/kernitem.hxx>
+#include <bf_svx/cntritem.hxx>
+#include <bf_svx/shdditem.hxx>
+#include <bf_svx/cscoitem.hxx>
+#include <bf_svx/wghtitem.hxx>
+#include <bf_svx/postitem.hxx>
+#include <bf_svx/fontitem.hxx>
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <swtypes.hxx> //fuer MIN_BORDER_DIST
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx>
+#include <paratr.hxx>
+#include <fldbas.hxx>
+#include <fmthbsh.hxx>
+#include <fmtrfmrk.hxx>
+#include <fmtfld.hxx>
+#include <fmtflcnt.hxx>
+#include <fchrfmt.hxx>
+#include <fmtftn.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtclds.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfordr.hxx>
+#include <fmthdft.hxx>
+#include <fmtcntnt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtsrnd.hxx>
+#include <rdswg.hxx>
+#include <pagedesc.hxx>
+#include <grfatr.hxx>
+#include <oldhntid.hxx>
+#include <swgids.hxx>
+#include <tox.hxx>
+namespace binfilter {
+
+
+
+//////////////////////////////// CHRATR.HXX ////////////////////////////////
+
+static USHORT InSWG_SwFont
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ long nNext = rPar.r.getskip();
+ BYTE eFamily, eFontPitch, eFontCharSet;
+ rPar.r >> eFamily
+ >> eFontPitch
+ >> eFontCharSet;
+ String aName = rPar.GetText( FALSE );
+ String aStyle;
+ if( rPar.r.tell() < nNext )
+ aStyle = rPar.GetText( FALSE );
+
+ // irgendwann wandelte sich der StarBats vom ANSI- zum SYMBOL-Font
+ if( SWG_VER_COMPAT >= rPar.aHdr.nVersion &&
+ RTL_TEXTENCODING_SYMBOL !=
+ eFontCharSet && aName.EqualsAscii( "StarBats" ) )
+ eFontCharSet = RTL_TEXTENCODING_SYMBOL;
+ SvxFontItem aAttr
+ ( (FontFamily) eFamily, aName, aStyle,
+ (FontPitch) eFontPitch,
+ (rtl_TextEncoding) eFontCharSet );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SvxPostureItem
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE nPosture;
+ rPar.r >> nPosture;
+ // backxxx war nie drin und wird nie drin sein!
+ if( nPosture == 2 || nPosture == 4 ) return 0;
+ if( nPosture > 1 ) nPosture = 2;
+ SvxPostureItem aAttr( (const FontItalic) nPosture );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SvxWeightItem
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE nWeight;
+ rPar.r >> nWeight;
+ nWeight = ( nWeight <= 4 ) ? WEIGHT_NORMAL : WEIGHT_BOLD;
+ SvxWeightItem aAttr( (const FontWeight) nWeight );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwShadowed
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE nState;
+ rPar.r >> nState;
+ SvxShadowedItem aAttr( nState );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwContour
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE nState;
+ rPar.r >> nState;
+ SvxContourItem aAttr( nState );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwKerning
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE nState; // ignored
+ long frKernZ, frKernN;
+ rPar.r >> nState >> frKernZ >> frKernN;
+ // Alt = Punkte, neu = Twips
+ short nKern = nState ? (short) (frKernZ * 20 / frKernN ) : 0;
+ SvxKerningItem aAttr( nKern );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwCrossedOut
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE chCross, bCrossOutSpaces, nState;
+ rPar.r >> chCross >> bCrossOutSpaces >> nState;
+ SvxCrossedOutItem aAttr( (FontStrikeout) nState );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ if( bCrossOutSpaces ) {
+ SvxWordLineModeItem aMode( FALSE );
+ if( pSet ) pSet->Put( aMode );
+ else pNd->Insert( aMode, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ }
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SvxCaseMapItem
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE nCaseMap;
+ rPar.r >> nCaseMap;
+ SvxCaseMapItem aAttr( (const SvxCaseMap) nCaseMap );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwUnderline
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE nState, bUnderlineSpaces;
+ rPar.r >> nState >> bUnderlineSpaces;
+ SvxUnderlineItem aAttr( (FontUnderline) nState );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ if( bUnderlineSpaces ) {
+ SvxWordLineModeItem aMode( FALSE );
+ if( pSet ) pSet->Put( aMode );
+ else pNd->Insert( aMode, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ }
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwLanguage
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ USHORT nLanguage;
+ rPar.r >> nLanguage;
+ if( !nLanguage )
+ nLanguage = LANGUAGE_SYSTEM;
+ else if( nLanguage == 0x400 )
+ nLanguage = LANGUAGE_DONTKNOW;
+// else
+// rPar.TestLanguage( nLanguage );
+ SvxLanguageItem aAttr( (LanguageType) nLanguage );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwEscapement
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE eEscape;
+ long frEscapementZ, frEscapementN, frProportionZ, frProportionN;
+ rPar.r >> eEscape >> frEscapementZ >> frEscapementN
+ >> frProportionZ >> frProportionN;
+ short nEsc = (short) ( frEscapementZ * 100 / frEscapementN );
+ short nProp = (short) ( frProportionZ * 100 / frProportionN );
+ switch( eEscape) {
+ case SVX_ESCAPEMENT_OFF:
+ nEsc = 0; nProp = 100; break;
+ case SVX_ESCAPEMENT_SUBSCRIPT:
+ nEsc = -nEsc; break;
+ }
+ SvxEscapementItem aAttr( nEsc, (BYTE) nProp );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwSize
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ long nSize;
+ rPar.r >> nSize;
+ SvxFontHeightItem aAttr( (USHORT) nSize );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwPropSize
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ long frPropSizeZ, frPropSizeN;
+ rPar.r >> frPropSizeZ >> frPropSizeN;
+ USHORT nFrac = (USHORT) ( frPropSizeZ * 100 / frPropSizeN );
+ SvxPropSizeItem aAttr( nFrac, ITEMID_PROPSIZE );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwColor
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ USHORT red, green, blue;
+ rPar.r >> red >> green >> blue;
+ if( rPar.r.size() )
+ {
+ // Es ist noch etwas da, also ist es ein CharSetColor-Attribut
+ BYTE cSet;
+ rPar.r >> cSet;
+ Color aColor( red, green, blue );
+ SvxCharSetColorItem aAttr( aColor, (rtl_TextEncoding) cSet );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+ }
+ else
+ {
+ SvxColorItem aAttr( Color( red, green, blue ) );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+ }
+}
+
+static USHORT InSWG_SwNoHyphenHere
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ BYTE bOn;
+ rPar.r >> bOn;
+ SvxNoHyphenItem aAttr;
+ aAttr.SetValue( (BOOL) bOn );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwSoftHyphen
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ if( !pSet )
+ pNd->Insert( CHAR_SOFTHYPHEN, SwIndex( pNd, nBgn ));
+ return 0;
+}
+
+static USHORT InSWG_SwHardBlank
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ if( !pSet )
+ pNd->Insert( CHAR_HARDBLANK, SwIndex( pNd, nBgn ));
+ return 0;
+}
+
+static USHORT InSWG_SwRefMark
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ USHORT nMark; // wird ignoriert
+ rPar.r >> nMark;
+ String aName = rPar.GetText( FALSE );
+ if( pSet ) return 0;
+ SwFmtRefMark aFmtAttr( aName );
+ pNd->Insert( aFmtAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aFmtAttr.Which();
+}
+
+static USHORT InSWG_SwField
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ if( !rPar.r.size() ) return 0;
+ SwField* pFld = rPar.InField();
+ if( !pFld ) return 0;
+ SwFmtFld aAttr( *pFld );
+ delete pFld;
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFlyCnt
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ if( pSet )
+ return 0;
+ if( rPar.r.peek() != SWG_FLYFMT )
+ return 0;
+
+ USHORT eSave_StartNodeType = rPar.eStartNodeType;
+ rPar.eStartNodeType = SwFlyStartNode;
+
+ rPar.r.next();
+ SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*) rPar.InFormat( NULL );
+ SwFmtFlyCnt aAttr( pFmt );
+ rPar.eStartNodeType = eSave_StartNodeType;
+
+ if( pSet )
+ pSet->Put( aAttr );
+ else
+ pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwTOXMark
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ if( pSet ) return 0;
+ // Flags:
+ // 0x01 - hat eigenen Verz.-Namen
+ // 0x02 - hat alternate Text
+ // 0x04 - hat Primaeren Key
+ // 0x08 - hat Sekundaeren Key
+ BYTE nType, bFlags;
+ const SwTOXType* pType = NULL;
+ rPar.r >> nType >> bFlags;
+ TOXTypes eType = (TOXTypes) nType;
+ if( bFlags & 0x01 )
+ {
+ String aName( rPar.GetText( FALSE ) );
+ USHORT n = rPar.pDoc->GetTOXTypeCount( eType );
+ // Entsprechenden TOXtype suchen
+ for( USHORT i = 0; i < n; i++ )
+ {
+ pType = rPar.pDoc->GetTOXType( eType, i );
+ if( pType && pType->GetTypeName() == aName )
+ break;
+ pType = NULL;
+ }
+ // neu registrieren, falls noch nicht vorhanden
+ if( !pType )
+ {
+ rPar.pDoc->InsertTOXType( SwTOXType( eType, aName ) );
+ pType = rPar.pDoc->GetTOXType( eType, n );
+ }
+ }
+ else
+ pType = rPar.pDoc->GetTOXType( eType, 0 );
+ if( pType )
+ {
+ SwTOXMark aMark( pType );
+ if( bFlags & 0x02 )
+ aMark.SetAlternativeText( rPar.GetText( FALSE ) );
+ switch( nType )
+ {
+ case TOX_INDEX:
+ if( bFlags & 0x04 )
+ aMark.SetPrimaryKey( rPar.GetText( FALSE ) );
+
+ if( bFlags & 0x08 )
+ aMark.SetSecondaryKey( rPar.GetText( FALSE ) );
+
+ break;
+ case TOX_USER:
+ case TOX_CONTENT: {
+ USHORT nLevel;
+ rPar.r >> nLevel;
+ aMark.SetLevel( nLevel );
+ } break;
+ default:
+ rPar.Error(); return 0;
+ }
+ // TOXMark mit Alternativtext aber ohne 0xff. Sowas konnte man
+ // ueber die UI zwar erstellen, weil's aber ein Bug ist werden
+ // die jetzt ignoriert.
+ if( !aMark.IsAlternativeText() ||
+ (rPar.GetReadTxt() && rPar.GetReadTxt()->Len() >= nBgn &&
+ '\xff' == rPar.GetReadTxt()->GetChar(nBgn) ))
+ {
+ // Bug 31560: several txo marks w/o end at the same position
+ if( aMark.IsAlternativeText() &&
+ pNd->GetTxtAttr( nBgn, aMark.Which() ) )
+ {
+ ASSERT( !aMark.IsAlternativeText(),
+ "several TOXMark without end at same position" );
+ return 0;
+ }
+
+ pNd->Insert( aMark, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ }
+ return aMark.Which();
+ }
+ rPar.Error(); return 0;
+}
+
+static USHORT InSWG_SwCharFmt
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ USHORT nIdx;
+ rPar.r >> nIdx;
+ if( (nIdx == IDX_NO_VALUE) ||
+ ((nIdx&IDX_TYPEMASK) == IDX_COLLECTION) ) // bug fix #24427#
+ return 0;
+ SwCharFmt* pChFmt = (SwCharFmt*) rPar.FindFmt( nIdx, SWG_CHARFMT );
+ SwFmtCharFmt aAttr( pChFmt );
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFtn
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode* pNd, xub_StrLen nBgn, xub_StrLen nEnd )
+{
+ if( pSet ) return 0;
+ String aNumber = rPar.GetText( FALSE );
+ USHORT nNumber;
+ rPar.r >> nNumber;
+ SwFmtFtn aAttr;
+ aAttr.SetNumStr( aNumber );
+ aAttr.SetNumber( nNumber );
+ // Der Footnote-Hint ist somewhat special. Er erhaelt
+ // eine Section, wenn er in den TextNode eingefuegt wird (Brech!)
+ // Daher muss der Text getrennt geparst werden (in FillTxtNode())
+ if( pSet ) pSet->Put( aAttr );
+ else pNd->Insert( aAttr, nBgn, nEnd, SETATTR_NOTXTATRCHR );
+ return aAttr.Which();
+}
+
+///////////////////////////// PARATR.HXX ///////////////////////////////////
+
+static USHORT InSWG_SwLineSpacing
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long frPropLineSpaceZ, frPropLineSpaceN;
+ sal_Char nLineSpaceRule, nInterLineSpaceRule;
+ short nInterLineSpace, nLineHeight;
+ rPar.r >> frPropLineSpaceZ >> frPropLineSpaceN
+ >> nLineSpaceRule >> nInterLineSpaceRule
+ >> nInterLineSpace >> nLineHeight;
+ short nFrac = (short) ( frPropLineSpaceZ * 100 / frPropLineSpaceN );
+ SvxLineSpacingItem aAttr( nLineHeight );
+ aAttr.SetInterLineSpace( nInterLineSpace );
+ aAttr.SetPropLineSpace( (BYTE)nFrac );
+ aAttr.GetLineSpaceRule() = (SvxLineSpace) nLineSpaceRule;
+ aAttr.GetInterLineSpaceRule() = (SvxInterLineSpace) nInterLineSpaceRule;
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwAdjust
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ sal_Char eAdjustment;
+ rPar.r >> eAdjustment;
+ SvxAdjustItem aAttr( (SvxAdjust) eAdjustment );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwSplit
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ sal_Char bSplit;
+ rPar.r >> bSplit;
+ SvxFmtSplitItem aAttr( (BOOL) bSplit );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwWidows
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long nTwips;
+ short nLines;
+ rPar.r >> nLines >> nTwips;
+ SvxWidowsItem aAttr( (BYTE) nLines );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwOrphans
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long nTwips;
+ short nLines;
+ rPar.r >> nLines >> nTwips;
+ SvxOrphansItem aAttr( (BYTE) nLines );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwTabStop
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ short nTabs;
+ rPar.r >> nTabs;
+ SvxTabStopItem aAttr( 0, 0 );
+ for( int i = 0; i < nTabs; i++ )
+ {
+ long nPos;
+ BYTE eAdjust, cDecimal, cFill;
+ rPar.r >> nPos >> eAdjust >> cDecimal >> cFill;
+ if( !i || SVX_TAB_ADJUST_DEFAULT != eAdjust )
+ aAttr.Insert( SvxTabStop
+ ( (SwTwips) nPos, (SvxTabAdjust) eAdjust, cDecimal, cFill ) );
+ }
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwHyphenZone
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE bHyphen, bHyphenPageEnd;
+ USHORT nMinLead, nMinTrail, nMaxHyphens;
+ rPar.r >> bHyphen >> bHyphenPageEnd >> nMinLead >> nMinTrail >> nMaxHyphens;
+ SvxHyphenZoneItem aAttr;
+ aAttr.SetHyphen( BOOL( bHyphen != 0 ) );
+ aAttr.SetPageEnd( BOOL( bHyphenPageEnd != 0 ) );
+ aAttr.GetMinLead() = (BYTE) nMinLead;
+ aAttr.GetMinTrail() = (BYTE) nMinTrail;
+ aAttr.GetMaxHyphens() = (BYTE) nMaxHyphens;
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwDropCaps
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ USHORT nLines, nChars, nDistance, nX, nY, nFmt;
+ rPar.r >> nLines >> nChars >> nDistance >> nX >> nY >> nFmt;
+ SwFmtDrop aAttr;
+ aAttr.GetLines() = (BYTE) nLines;
+ aAttr.GetChars() = (BYTE) nChars;
+ aAttr.GetDistance() = nDistance;
+ aAttr.GetWholeWord() = FALSE;
+ if( nFmt != IDX_NO_VALUE )
+ {
+ SwCharFmt* pSet = (SwCharFmt*) rPar.FindFmt( nFmt, SWG_CHARFMT );
+ aAttr.SetCharFmt( pSet );
+ }
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+/////////////////////////////// FRMATR.HXX ///////////////////////////////
+
+static USHORT InSWG_SwBox
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ short nDistance;
+ rPar.r >> nDistance;
+ SvxBoxItem aAttr;
+ aAttr.SetDistance( nDistance );
+
+ BOOL bDone = FALSE;
+ while( !bDone )
+ {
+ BYTE ch = rPar.r.next();
+ switch( ch )
+ {
+ case SWG_TOP:
+ case SWG_LEFT:
+ case SWG_RIGHT:
+ case SWG_BOTTOM:break;
+ default: bDone = TRUE;
+ }
+ if( !bDone )
+ {
+ USHORT red, green, blue;
+ short nOutline, nInline, nDistance;
+ rPar.r >> red >> green >> blue;
+ rPar.r >> nOutline >> nInline >> nDistance;
+ Color aClr( red, green, blue );
+ SvxBorderLine aBorder( &aClr, nOutline, nInline, nDistance );
+ switch( ch )
+ {
+ case SWG_TOP: aAttr.SetLine( &aBorder, BOX_LINE_TOP ); break;
+ case SWG_LEFT: aAttr.SetLine( &aBorder, BOX_LINE_LEFT ); break;
+ case SWG_RIGHT: aAttr.SetLine( &aBorder, BOX_LINE_RIGHT ); break;
+ case SWG_BOTTOM: aAttr.SetLine( &aBorder, BOX_LINE_BOTTOM ); break;
+ }
+ }
+ }
+ if ( rPar.aHdr.nVersion < SWG_VER_NEWALIGN )
+ {
+ //Wenn mindestens eine Line gesetzt wurde, so wird jetzt ein minimaler
+ //Abstand eingetragen.
+ if ( (aAttr.GetTop() || aAttr.GetLeft() ||
+ aAttr.GetBottom() || aAttr.GetRight() ) &&
+ nDistance < MIN_BORDER_DIST)
+ {
+ aAttr.SetDistance( MIN_BORDER_DIST );
+ }
+ }
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtShadow
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE cLoc;
+ USHORT nWidth;
+ rPar.r >> cLoc >> nWidth;
+ Color aCol( rPar.InBrush() );
+ SvxShadowItem aAttr( RES_SHADOW, &aCol, nWidth, (SvxShadowLocation) cLoc );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtPageDesc
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ // Dieser Hint kann bereits eingelesen werden, ehe die
+ // Seitenbeschreibungen drin sind. Also, bitte erst mal speichern!
+ // Das benoetigte Set muss leider "per Hand" nachgetragen werden
+ // (siehe rdfmts.cxx)
+
+ // Komischerweise gibt es immer noch leere PageDesc-Hints:
+ if( !rPar.r.size() )
+ {
+ SwFmtPageDesc aAttr( NULL );
+ pSet->Put( aAttr );
+ }
+ else
+ {
+ String aName( rPar.GetText( FALSE ) );
+ USHORT nOff = 0;
+ rPar.r >> nOff;
+ if( aName.Len() )
+ rPar.AddPageDescLink( aName, nOff );
+ //JP 29.05.00: set always the hint into the AttrSet, because in
+ // InsertMode the NodeAttrSet for PageDescLink only created
+ // if there Attributes exists.
+ SwFmtPageDesc aAttr( NULL );
+ pSet->Put( aAttr );
+ }
+ return 0;
+}
+
+static USHORT InSWG_SwFmtMacro
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ if( rPar.r.peek() != SWG_MACROTBL )
+ return 0;
+ rPar.r.next();
+ SvxMacroItem aAttr( RES_FRMMACRO );
+ short nMacro;
+ rPar.r >> nMacro;
+ for( short i = 0; i < nMacro; i++ )
+ {
+ USHORT nEvent;
+ rPar.r >> nEvent;
+ String aLib = rPar.GetText();
+ String aMac = rPar.GetText();
+ aAttr.SetMacro( nEvent, SvxMacro( aMac, aLib, STARBASIC ) );
+ }
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtCol
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ // Die Longs muessen runtergerechnet werden
+ sal_Char nLineAdj, bOrtho;
+ short nGutterWidth;
+ long nHeightNum, nHeightDenom, nWishWidth;
+ rPar.r.long4();
+ rPar.r >> nLineAdj
+ >> bOrtho
+ >> nGutterWidth
+ >> nWishWidth
+ >> nHeightNum
+ >> nHeightDenom;
+ USHORT nMax = ( nWishWidth == LONG_MAX )
+ ? USHRT_MAX
+ : (USHORT) nWishWidth;
+ ASSERT( nWishWidth == LONG_MAX || nWishWidth <= 65535L, "WishWidth zu gross" );
+ long nFactor = nWishWidth / nMax;
+ SwFmtCol aAttr;
+ USHORT nLineWidth;
+ Color aLineColor;
+ rPar.InPen(nLineWidth, aLineColor);
+ USHORT nCol;
+ rPar.r >> nCol;
+ if( nCol )
+ {
+ for( USHORT i = 0; i < nCol; i++ )
+ {
+ long nWishWidth;
+ USHORT nLeft, nUpper, nRight, nLower;
+ rPar.r >> nWishWidth >> nLeft >> nUpper >> nRight >> nLower;
+ SwColumn* pCol = new SwColumn;
+ pCol->SetWishWidth( (USHORT) ( nWishWidth / nFactor ) );
+ pCol->SetLeft( nLeft );
+ pCol->SetUpper( nUpper );
+ pCol->SetRight( nRight );
+ pCol->SetLower( nLower );
+ aAttr.GetColumns().Insert( pCol, i );
+ }
+ }
+ aAttr.SetLineColor( aLineColor );
+ aAttr.SetLineWidth( nLineWidth );
+ aAttr.SetWishWidth( (USHORT) nWishWidth );
+ aAttr.SetLineHeight( (BYTE) ( nHeightNum * 100 / nHeightDenom ) );
+ aAttr.SetLineAdj( (SwColLineAdj) nLineAdj );
+ // temporaerer Bug Fix
+ if( nCol )
+ // Wert direkt mit dem Silberhammer einschlagen.
+ aAttr._SetOrtho( (BOOL) bOrtho );
+ rPar.r.long3();
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtFrmSize
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE nSizeType;
+ long nWidth, nHeight;
+ rPar.r >> nSizeType;
+ rPar.r.long4();
+ rPar.r >> nWidth >> nHeight;
+ rPar.r.long3();
+ if( rPar.IsTableBoxFrmFmt() )
+ {
+ // FrmSize-Attribut in TableBoxes: umdrehen!
+ long n = nWidth;
+ nWidth = nHeight;
+ nHeight = n;
+ }
+ else if( nSizeType == ATT_FIX_SIZE
+ && nWidth == LONG_MAX
+ && nHeight == LONG_MAX )
+ {
+ // Uninitialisertes FrmSize-Attribut: setze auf DIN A4
+ Size aSzA4 = SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 );
+ nWidth = aSzA4.Width();
+ nHeight = aSzA4.Height();
+ }
+
+ SwFmtFrmSize aAttr( (SwFrmSize) nSizeType, nWidth, nHeight );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtFillOrder
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE nFillOrder;
+ rPar.r >> nFillOrder;
+ SwFmtFillOrder aAttr( (SwFillOrder) nFillOrder );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwPageBreak
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE nBreak, nIsAuto;
+ rPar.r >> nBreak >> nIsAuto;
+ if( nBreak != (SvxBreak) SVX_BREAK_NONE )
+ nBreak += (SvxBreak) SVX_BREAK_COLUMN_BOTH;
+ SvxFmtBreakItem aAttr( (SvxBreak) nBreak );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwColBreak
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE nBreak, nIsAuto;
+ rPar.r >> nBreak >> nIsAuto;
+ SvxFmtBreakItem aAttr( (SvxBreak) nBreak );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtPaperBin
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ short nTray;
+ rPar.r >> nTray;
+ SvxPaperBinItem aAttr( RES_PAPER_BIN, (BYTE) nTray );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwLRSpace
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long left, right, firstline;
+ rPar.r >> left >> right >> firstline;
+ SvxLRSpaceItem aAttr;
+ aAttr.SetTxtLeft( (USHORT) left );
+ aAttr.SetRight( (USHORT) right );
+ aAttr.SetTxtFirstLineOfst( USHORT(firstline) );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwULSpace
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long upper, lower;
+ rPar.r >> upper >> lower;
+ SvxULSpaceItem aAttr;
+ aAttr.SetUpper( (USHORT) upper );
+ aAttr.SetLower( (USHORT) lower );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtHeader
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE bActive;
+ SwFrmFmt* pFmt = NULL;
+ rPar.r >> bActive;
+ if( rPar.r.peek() == SWG_FREEFMT )
+ {
+ USHORT eSave_StartNodeType = rPar.eStartNodeType;
+ rPar.eStartNodeType = SwHeaderStartNode;
+
+ rPar.r.next();
+ pFmt = (SwFrmFmt*) rPar.InFormat( NULL );
+ rPar.RegisterFmt( *pFmt );
+ SwFmtHeader aAttr( pFmt );
+ aAttr.SetActive( BOOL( bActive ) );
+ pSet->Put( aAttr );
+ rPar.eStartNodeType = eSave_StartNodeType;
+
+ return aAttr.Which();
+ }
+ else
+ {
+ SwFmtHeader aAttr( BOOL( bActive != 0 ) );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+ }
+}
+
+static USHORT InSWG_SwFmtFooter
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE bActive;
+ SwFrmFmt* pFmt = NULL;
+ rPar.r >> bActive;
+ if( rPar.r.peek() == SWG_FREEFMT )
+ {
+ USHORT eSave_StartNodeType = rPar.eStartNodeType;
+ rPar.eStartNodeType = SwFooterStartNode;
+
+ rPar.r.next();
+ pFmt = (SwFrmFmt*) rPar.InFormat( NULL );
+ rPar.RegisterFmt( *pFmt );
+ SwFmtFooter aAttr( pFmt );
+ aAttr.SetActive( BOOL( bActive != 0 ) );
+ pSet->Put( aAttr );
+ rPar.eStartNodeType = eSave_StartNodeType;
+
+ return aAttr.Which();
+ }
+ else
+ {
+ SwFmtFooter aAttr( BOOL( bActive != 0 ) );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+ }
+}
+
+static USHORT InSWG_SwFmtCntnt
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ SwFmtCntnt aAttr( rPar.InSection() );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtPrint
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE bActive;
+ rPar.r >> bActive;
+ SvxPrintItem aAttr( RES_PRINT, BOOL (bActive != 0 ) );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtOpaque
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE bActive;
+ rPar.r >> bActive;
+ SvxOpaqueItem aAttr( RES_OPAQUE, BOOL( bActive != 0 ) );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtProtect
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE bProtFrame, bProtCntnt;
+ rPar.r >> bProtFrame >> bProtCntnt;
+ SvxProtectItem aAttr;
+ aAttr.SetPosProtect( BOOL( bProtFrame != 0 ) );
+ aAttr.SetSizeProtect( BOOL( bProtFrame != 0 ) );
+ aAttr.SetCntntProtect( BOOL( bProtCntnt != 0 ) );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtSurround
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE nType, bGold;
+ rPar.r >> nType >> bGold;
+ SwFmtSurround aAttr( (SwSurround) nType );
+ if( bGold )
+ aAttr.SetSurround( SURROUND_IDEAL );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtVertOrient
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long nPos;
+ BYTE nOrient, nRelation;
+ rPar.r >> nPos >> nOrient >> nRelation;
+ if( VERT_NONE == (SwVertOrient)nOrient )
+ nRelation = FRAME;
+ SwFmtVertOrient aAttr( (SwTwips) nPos, (SwVertOrient) nOrient,
+ (SwRelationOrient) nRelation );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtHoriOrient
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long nPos;
+ BYTE nOrient, nRelation;
+ BYTE nAnchor;
+ short nColumn;
+ rPar.r >> nPos >> nOrient >> nRelation;
+ rPar.r >> nAnchor >> nColumn;
+ if( HORI_NONE == (SwHoriOrient)nOrient )
+ nRelation = FRAME;
+ SwFmtHoriOrient aAttr
+ ( (SwTwips) nPos, (SwHoriOrient) nOrient, (SwRelationOrient) nRelation );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtAnchor
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE cType;
+ USHORT nPage, nCol, nCntnt;
+ rPar.r >> cType >> nPage >> nCol >> nCntnt;
+ // auf globale Variable zuweisen:
+ rPar.nCntntCol = (xub_StrLen)nCntnt;
+
+ //RndId -> AnchorId mappen weil derzeit noch altes Attributformat
+ //gelesen und geschrieben wird.
+ switch ( cType )
+ {
+ case 1: cType = FLY_PAGE; break;
+ case 14: cType = FLY_AT_CNTNT; break;
+ case 15: cType = FLY_IN_CNTNT; break;
+ default: ASSERT( FALSE, "ungueltige AnchorId." );
+ }
+
+ SwFmtAnchor aAttr( (RndStdIds) cType, nPage + rPar.nPage1 );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwFmtBackground
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE bActive;
+ rPar.r >> bActive;
+ Color aCol = rPar.InBrush();
+ SvxBrushItem aAttr( aCol, RES_BACKGROUND );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+/////////////////////////////// GRFATR.HXX /////////////////////////////////
+
+static USHORT InSWG_SwMirrorGrf
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ BYTE nState;
+ rPar.r >> nState;
+ SwMirrorGrf aAttr( nState );
+ pSet->Put( aAttr );
+ return aAttr.Which();
+}
+
+static USHORT InSWG_SwCropGrf
+( SwSwgReader& rPar, SfxItemSet* pSet, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ long top, left, right, bottom;
+ rPar.r >> top >> left >> right >> bottom;
+ SwCropGrf aCrop( -left, -right, -top, -bottom );
+ pSet->Put( aCrop );
+ return aCrop.Which();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+xub_StrLen InSWG_Nothing( SwSwgReader&, SfxItemSet*, SwTxtNode*, xub_StrLen, xub_StrLen )
+{
+ return 0;
+}
+
+typedef USHORT ( *SwHintFn )( SwSwgReader&, SfxItemSet*, SwTxtNode*, xub_StrLen, xub_StrLen );
+
+SwHintFn __READONLY_DATA aChrInAttrs[] =
+{
+/* OLDRES_CHRATR_CASEMAP */ InSWG_SvxCaseMapItem,
+/* OLDRES_CHRATR_CHARWIDTH */ InSWG_Nothing,
+/* OLDRES_CHRATR_COLOR */ InSWG_SwColor,
+/* OLDRES_CHRATR_CONTOUR */ InSWG_SwContour,
+/* OLDRES_CHRATR_CROSSEDOUT */ InSWG_SwCrossedOut,
+/* OLDRES_CHRATR_ESCAPEMENT */ InSWG_SwEscapement,
+/* OLDRES_CHRATR_FONT */ InSWG_SwFont,
+/* OLDRES_CHRATR_FONTSIZE */ InSWG_SwSize,
+/* OLDRES_CHRATR_INVERTED */ InSWG_Nothing,
+/* OLDRES_CHRATR_KERNING */ InSWG_SwKerning,
+/* OLDRES_CHRATR_LANGUAGE */ InSWG_SwLanguage,
+/* OLDRES_CHRATR_MIRRORED */ InSWG_Nothing,
+/* OLDRES_CHRATR_POSTURE */ InSWG_SvxPostureItem,
+/* OLDRES_CHRATR_PROPORTIONALFONTSIZE*/ InSWG_SwPropSize,
+/* OLDRES_CHRATR_SHADOWED */ InSWG_SwShadowed,
+/* OLDRES_CHRATR_UNDERLINE */ InSWG_SwUnderline,
+/* OLDRES_CHRATR_WEIGHT */ InSWG_SvxWeightItem,
+/* OLDRES_CHRATR_WRITINGDIRECTION */ InSWG_Nothing,
+/* OLDRES_CHRATR_FIELD */ InSWG_SwField,
+/* OLDRES_CHRATR_NOLINEBREAK */ InSWG_Nothing,
+/* OLDRES_CHRATR_NOHYPHEN */ InSWG_SwNoHyphenHere,
+/* OLDRES_CHRATR_SOFTHYPH */ InSWG_SwSoftHyphen,
+/* OLDRES_CHRATR_FTN */ InSWG_SwFtn,
+/* OLDRES_CHRATR_HARDBLANK */ InSWG_SwHardBlank,
+};
+
+SwHintFn __READONLY_DATA aFontInAttrs[] =
+{
+/* OLDRES_TXTATR_CHARWIDTH */ InSWG_Nothing,
+/* OLDRES_TXTATR_COLOR */ InSWG_SwColor,
+/* OLDRES_TXTATR_CONTOUR */ InSWG_SwContour,
+/* OLDRES_TXTATR_CROSSEDOUT */ InSWG_SwCrossedOut,
+/* OLDRES_TXTATR_FONT */ InSWG_SwFont,
+/* OLDRES_TXTATR_FONTSIZE */ InSWG_SwSize,
+/* OLDRES_TXTATR_INVERTED */ InSWG_Nothing,
+/* OLDRES_TXTATR_LANGUAGE */ InSWG_SwLanguage,
+/* OLDRES_TXTATR_MIRRORED */ InSWG_Nothing,
+/* OLDRES_TXTATR_POSTURE */ InSWG_SvxPostureItem,
+/* OLDRES_TXTATR_PROPORTIONALFONTSIZE*/ InSWG_SwPropSize,
+/* OLDRES_TXTATR_SHADOWED */ InSWG_SwShadowed,
+/* OLDRES_TXTATR_UNDERLINE */ InSWG_SwUnderline,
+/* OLDRES_TXTATR_WEIGHT */ InSWG_SvxWeightItem,
+/* OLDRES_TXTATR_CHARFMT */ InSWG_SwCharFmt,
+};
+
+SwHintFn __READONLY_DATA aEtcInAttrs[] =
+{
+/* OLDRES_TXTATR_WRITINGDIRECTION */ InSWG_Nothing,
+/* OLDRES_TXTATR_KERNING */ InSWG_SwKerning,
+/* OLDRES_TXTATR_NOLINEBREAK */ InSWG_Nothing,
+/* OLDRES_TXTATR_NOHYPHEN */ InSWG_SwNoHyphenHere,
+/* OLDRES_TXTATR_INSERTED */ InSWG_Nothing,
+/* OLDRES_TXTATR_DELETED */ InSWG_Nothing,
+/* OLDRES_TXTATR_ESCAPEMENT */ InSWG_SwEscapement,
+/* OLDRES_TXTATR_CASEMAP */ InSWG_SvxCaseMapItem,
+/* OLDRES_TXTATR_FIELD */ InSWG_SwField,
+/* OLDRES_TXTATR_FLYCNT */ InSWG_SwFlyCnt,
+/* OLDRES_TXTATR_TOXMARK */ InSWG_SwTOXMark,
+/* OLDRES_TXTATR_SOFTHYPH */ InSWG_SwSoftHyphen,
+/* OLDRES_TXTATR_FTN */ InSWG_SwFtn,
+/* OLDRES_TXTATR_HARDBLANK */ InSWG_SwHardBlank,
+/* OLDRES_TXTATR_REFMARK */ InSWG_SwRefMark,
+};
+
+
+static SwHintFn __READONLY_DATA aParInAttrs[] =
+{
+/* OLDRES_PARATR_LINESPACING */ InSWG_SwLineSpacing,
+/* OLDRES_PARATR_FIRSTLINEOFFSET */ InSWG_Nothing, // nicht mehr da
+/* OLDRES_PARATR_ADJUST */ InSWG_SwAdjust,
+/* OLDRES_PARATR_SPLIT */ InSWG_SwSplit,
+/* OLDRES_PARATR_WIDOWS */ InSWG_SwWidows,
+/* OLDRES_PARATR_ORPHANS */ InSWG_SwOrphans,
+/* OLDRES_PARATR_TABSTOP */ InSWG_SwTabStop,
+/* OLDRES_PARATR_HYPHENZONE */ InSWG_SwHyphenZone,
+/* OLDRES_PARATR_DROP */ InSWG_SwDropCaps,
+};
+
+static SwHintFn __READONLY_DATA aAddInAttrs[] =
+{
+/* OLDRES_ADD_POSTIT */ InSWG_Nothing,
+/* OLDRES_ADD_INSERTS */ InSWG_Nothing,
+/* OLDRES_ADD_AUTOTEXT */ InSWG_Nothing,
+/* OLDRES_ADD_OTHERCONTENT */ InSWG_Nothing,
+};
+
+static SwHintFn __READONLY_DATA aFrmInAttrs[] =
+{
+/* OLDRES_FILL_ORDER */ InSWG_SwFmtFillOrder,
+/* OLDRES_FRM_SIZE */ InSWG_SwFmtFrmSize,
+/* OLDRES_PAGE_BREAK */ InSWG_SwPageBreak,
+/* OLDRES_SEL_PAGE */ InSWG_Nothing,
+/* OLDRES_PAPER_TRAY */ InSWG_SwFmtPaperBin,
+/* OLDRES_FRM_RNDREQUEST */ InSWG_Nothing,
+/* OLDRES_FRM_RNDSUPPLY */ InSWG_Nothing,
+/* OLDRES_LR_SPACE */ InSWG_SwLRSpace,
+/* OLDRES_UL_SPACE */ InSWG_SwULSpace,
+/* OLDRES_CNTNT */ InSWG_SwFmtCntnt,
+/* OLDRES_HEADER */ InSWG_SwFmtHeader,
+/* OLDRES_FOOTER */ InSWG_SwFmtFooter,
+/* OLDRES_FLY_PRINT */ InSWG_SwFmtPrint,
+/* OLDRES_FLY_OPAQUE */ InSWG_SwFmtOpaque,
+/* OLDRES_FLY_PROTECT */ InSWG_SwFmtProtect,
+/* OLDRES_FLY_MAINCNTNT */ InSWG_SwFmtSurround,
+/* OLDRES_FLY_VERT_ORIENT */ InSWG_SwFmtVertOrient,
+/* OLDRES_FLY_HORI_ORIENT */ InSWG_SwFmtHoriOrient,
+/* OLDRES_FLY_GENERIC */ InSWG_Nothing,
+/* OLDRES_FLY_ANCHOR */ InSWG_SwFmtAnchor,
+/* OLDRES_BACKGROUND */ InSWG_SwFmtBackground,
+/* OLDRES_BOX */ InSWG_SwBox,
+/* OLDRES_SHADOW */ InSWG_SwFmtShadow,
+/* OLDRES_PAGEDESC */ InSWG_SwFmtPageDesc,
+/* OLDRES_FRMMACRO */ InSWG_SwFmtMacro,
+/* OLDRES_COL_BREAK */ InSWG_SwColBreak,
+/* OLDRES_COL */ InSWG_SwFmtCol
+};
+
+static SwHintFn __READONLY_DATA aGrfInAttrs[] =
+{
+/* OLDRES_GRFATR_GRFSIZE */ InSWG_Nothing,
+/* OLDRES_GRFATR_MIRRORGRF */ InSWG_SwMirrorGrf,
+/* OLDRES_GRFATR_GRFOFFSET */ InSWG_Nothing,
+/* OLDRES_GRFATR_ALIGNGRF */ InSWG_Nothing,
+/* OLDRES_GRFATR_CROPGRF */ InSWG_SwCropGrf
+};
+
+#if defined GCC || defined HPUX
+struct HintFns
+#else
+static struct HintFns
+#endif
+{
+ const SwHintFn* pHintTab;
+ short nHintId1;
+}
+#if defined GCC || defined HPUX
+;
+static __READONLY_DATA HintFns aHintFns[] =
+#else
+__READONLY_DATA aHintFns[] =
+#endif
+{
+ { aChrInAttrs, OLDRES_CHRATR_BEGIN },
+ { aFontInAttrs, OLDFONT_TXTATR_BEGIN},
+ { aEtcInAttrs, OLDETC_TXTATR_BEGIN },
+ { aParInAttrs, OLDRES_PARATR_BEGIN },
+ { aAddInAttrs, OLDRES_ADD_BEGIN },
+ { aFrmInAttrs, OLDRES_FRMATR_BEGIN },
+ { aGrfInAttrs, OLDRES_GRFATR_BEGIN }
+
+};
+
+static USHORT __READONLY_DATA nAttrSizes[] =
+{
+ OLDRES_CHRATR_END + 1 - OLDRES_CHRATR_BEGIN,
+ OLDFONT_TXTATR_END - OLDFONT_TXTATR_BEGIN,
+ OLDETC_TXTATR_END - OLDETC_TXTATR_BEGIN,
+ OLDRES_PARATR_END - OLDRES_PARATR_BEGIN,
+ OLDRES_ADD_END - OLDRES_ADD_BEGIN,
+ OLDRES_FRMATR_END - OLDRES_FRMATR_BEGIN,
+ OLDRES_GRFATR_END - OLDRES_GRFATR_BEGIN
+};
+
+// Einlesen eines Format-Hints in ein Format
+// Der Returnwert ist das Which-ID des eingelesenen Hints oder 0
+
+USHORT SwSwgReader::InHint( SfxItemSet& rSet )
+{
+ USHORT nId = r.cur();
+ long nextrec = r.getskip();
+ SwHintFn pFn = NULL;
+
+ for( short i = 6; i >= 0; i-- )
+ {
+ USHORT id1 = aHdr.cAttrTab[ i ];
+ if( nId >= id1 )
+ {
+ nId -= id1;
+ // Ausserhalb des Bereiches?
+ if( nId >= aHdr.cAttrSiz[ i ] ) {
+ Error(); return 0;
+ }
+ // Interpretierbar?
+ if( nId < nAttrSizes[ i ] )
+ pFn = aHintFns[ i ].pHintTab[ nId ];
+ break;
+ }
+ }
+ USHORT nWhich = 0;
+ if( pFn )
+ nWhich = (*pFn) ( *this, &rSet, NULL, 0, 0 );
+ // Vorsicht! Der Fussnoten-Hint ist erst zum Teil geparst!!
+ if( nWhich != RES_TXTATR_FTN )
+ r.skip( nextrec );
+ return nWhich;
+}
+
+// Einen Text-Hint einlesen und anfuegen. Der Which-ID oder
+// 0 wird returned.
+
+USHORT SwSwgReader::InHint( SwTxtNode& rNd, xub_StrLen nBeg, xub_StrLen nEnd )
+{
+ USHORT nId = r.cur();
+ long nextrec = r.getskip();
+ SwHintFn pFn = NULL;
+
+ for( short i = 6; i >= 0; i-- )
+ {
+ USHORT id1 = aHdr.cAttrTab[ i ];
+ if( nId >= id1 )
+ {
+ nId -= id1;
+ // Ausserhalb des Bereiches?
+ if( nId >= aHdr.cAttrSiz[ i ] ) {
+ Error(); return 0;
+ }
+ // Interpretierbar?
+ if( nId < nAttrSizes[ i ] )
+ pFn = aHintFns[ i ].pHintTab[ nId ];
+ break;
+ }
+ }
+ USHORT nWhich = 0;
+ if( pFn )
+ nWhich = (*pFn) ( *this, NULL, &rNd, nBeg, nEnd );
+ // Vorsicht! Der Fussnoten-Hint ist erst zum Teil geparst!!
+ if( nWhich != RES_TXTATR_FTN )
+ r.skip( nextrec );
+ return nWhich;
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdmisc.cxx b/binfilter/bf_sw/source/core/swg/sw_rdmisc.cxx
new file mode 100644
index 000000000000..9adcfaec90c5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdmisc.cxx
@@ -0,0 +1,509 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <tools/color.hxx>
+#include <vcl/jobset.hxx>
+#include <bf_sfx2/docinf.hxx>
+#include <bf_svtools/macitem.hxx>
+
+#include <fmtanchr.hxx>
+#include <frmfmt.hxx>
+#include <docstat.hxx>
+#include <ftninfo.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pam.hxx>
+#include <swtypes.hxx>
+#include <rdswg.hxx>
+#include <swgpar.hxx> // SWGRD_xxx-Flags
+#include <frmids.hxx>
+#include <flypos.hxx>
+#include <ndtxt.hxx> // Zeichen-Konversion
+namespace binfilter {
+
+//using namespace ::com::sun::star;
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Achtung: Jede Routine nimmt an, dass der Record-Header bereits eingelesen
+// ist. Sie arbeitet den Record so weit ab wie moeglich und schliesst den
+// Vorgang mit end() ab.
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+// FlyFrames
+
+// Ein FlyFrame ist ein normales Frame-Format. Die Hints RES_CNTNT und
+// RES_FLY_ANCHOR muessen allerdings noch verbunden werden. Wenn der
+// ANCHOR-Hint eingelesen wird, wird die globale Variable nCntntCol
+// besetzt.
+
+ void SwSwgReader::InFlyFrame( const SwNodeIndex* pNdIdx )
+ {
+ BOOL bAtCnt = FALSE;
+
+ nCntntCol = 0;
+ if( r.cur() != SWG_FLYFMT )
+ {
+ Error();
+ return;
+ }
+
+ USHORT eSave_StartNodeType = eStartNodeType;
+ eStartNodeType = SwFlyStartNode;
+
+ SwFrmFmt* pFmt = (SwFrmFmt*) InFormat( NULL );
+ RegisterFmt( *pFmt );
+ if( pNdIdx )
+ {
+ // Content und Anchor miteinander verbinden, wenn Node angegeben ist
+ SwFmtAnchor aAnchor = pFmt->GetAnchor();
+ USHORT nId = aAnchor.GetAnchorId();
+ switch( nId )
+ {
+ case FLY_AT_CNTNT:
+ bAtCnt = TRUE;
+ case FLY_IN_CNTNT:
+ {
+ SwCntntNode *pNode = pDoc->GetNodes() [ *pNdIdx ]->GetCntntNode();
+ if( pNode )
+ {
+ SwPosition aPos( *pNdIdx, SwIndex( pNode, nCntntCol ) );
+ aAnchor.SetAnchor( &aPos );
+ pFmt->SetAttr( aAnchor );
+ }
+ // Layout-Frames im Insert Mode fuer absatzgebundene
+ // Flys erzeugen
+ if( !bNew && bAtCnt )
+ pFmt->MakeFrms();
+ }
+ break;
+ }
+ }
+ //JP 01.04.97: wird nach dem Lesen durchs SwReader::Read eindeutig gemacht!
+ if( pFmt->GetName().EqualsAscii("Fly") )
+ pFmt->SetName( aEmptyStr );
+
+ eStartNodeType = eSave_StartNodeType;
+ }
+
+ void SwSwgReader::InFlyFrames( const SwNodeIndex* pNdIdx )
+ {
+ USHORT nFrm;
+ r >> nFrm;
+ r.next();
+ for( USHORT i = 0; i < nFrm && r.good(); i++)
+ InFlyFrame( pNdIdx );
+
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Makros
+
+
+ void SwSwgReader::InGlobalMacroTbl()
+ {
+ short nMacro;
+ r >> nMacro;
+ for( short i = 0; i < nMacro; i++ )
+ {
+ USHORT nEvent;
+ r >> nEvent;
+ String aLib = GetText();
+ String aMac = GetText();
+ pDoc->SetGlobalMacro( nEvent, SvxMacro( aMac, aLib, STARBASIC ) );
+ }
+ r.next();
+
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Job-Setup
+
+ void SwSwgReader::InJobSetup()
+ {
+ BYTE recid = r.cur();
+ // Der alte Job-Setup ist nicht mehr zu erstellen.
+ if( recid == SWG_JOBSETUP )
+ r.skipnext();
+ else
+ {
+ JobSetup aJobSetup;
+ BOOL bDfltPrn = FALSE;
+ r.Strm() >> bDfltPrn >> aJobSetup;
+
+ pDoc->SetJobsetup( aJobSetup );
+ //JP 25.04.95: das Flag gibts nicht mehr:
+ // pDoc->UseDfltPrt( (BOOL)bDfltPrn );
+ r.skipnext();
+ }
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Dokument-Info
+
+ void SwSwgReader::InDocInfo()
+ {
+ while( r.good() )
+ {
+ switch( r.next() )
+ {
+ case SWGINF_DBNAME:
+ {
+ String aName = ParseText();
+ if( bNew )
+ {
+ if( aName.EqualsIgnoreCaseAscii( "ADRESSEN" ) )
+ aName.AssignAscii( "Address" );
+ SwDBData aData;
+ aData.sDataSource = aName;
+ pDoc->ChgDBData( aData );
+ }
+ }
+ break;
+ case SWGINF_DOCSTAT:
+ if( bNew )
+ {
+ USHORT nPage, nPara;
+ SwDocStat aStat;
+ r >> aStat.nTbl >> aStat.nGrf >> aStat.nOLE
+ >> nPage >> nPara >> aStat.nWord
+ >> aStat.nChar;
+ aStat.nPage = nPage;
+ aStat.nPara = nPara;
+ aStat.bModified = FALSE;
+ aStat.pInternStat = NULL;
+ pDoc->SetDocStat( aStat );
+ break;
+ } else r.skip(); // wird bei Einfuegen ignoriert
+ break;
+ case SWGINF_END:
+ return;
+ case SWGINF_LAYOUTPR: {
+ //JP 25.04.95: SetLayoutPrtName gibts nicht mehr
+ ParseText();
+ } break;
+ default:
+ // wird ignoriert
+ r.skip();
+ }
+ }
+
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+ Color SwSwgReader::InColor()
+ {
+ USHORT red, green, blue;
+ r >> red >> green >> blue;
+ Color aClr( BYTE(red >> 8), BYTE(green >> 8), BYTE( blue >> 8) );
+ return aClr;
+
+ }
+
+
+ void SwSwgReader::InPen(USHORT& nWidth, Color& rCol)
+ {
+ BYTE cStyle;
+ r >> cStyle >> nWidth;
+ rCol = InColor();
+ }
+
+
+ Color SwSwgReader::InBrush()
+ {
+ BYTE cStyle, cTransparent;
+ r >> cStyle >> cTransparent;
+
+ // Brush aBr( (BrushStyle) cStyle );
+ // aBr.SetTransparent( BOOL( cTransparent ) );
+ // aBr.SetColor( InColor() );
+ Color aCol(InColor());
+ Color aTmpFillColor(InColor());
+
+ return aCol;
+
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+
+
+ void SwSwgReader::InFtnInfo()
+ {
+ SwFtnInfo aFtn;
+ aFtn = pDoc->GetFtnInfo();
+ aFtn.aQuoVadis = GetText();
+ aFtn.aErgoSum = GetText();
+ //Ab der 3.0 sind nur noch max. 30 Zeichen erlaubt.
+ aFtn.aQuoVadis.Erase( 30 );
+ aFtn.aErgoSum. Erase( 30 );
+
+ BYTE ePos, eNum, eType;
+ USHORT nDesc, nCollIdx;
+ if( ( aHdr.nVersion >= SWG_VER_COMPAT ) && ( r.next() != SWG_DATA ) )
+ {
+ Error(); return;
+ }
+ r >> ePos >> eNum >> eType >> nDesc;
+ if( aHdr.nVersion >= SWG_VER_COMPAT )
+ {
+ r >> nCollIdx;
+ r.skip();
+ if( nCollIdx != IDX_NO_VALUE )
+ {
+ nCollIdx |= IDX_COLLECTION;
+ SwTxtFmtColl* pColl = (SwTxtFmtColl*) FindFmt( nCollIdx, 0 );
+ if( pColl )
+ aFtn.SetFtnTxtColl( *pColl );
+ }
+ }
+ if( nLay )
+ nLay = pLayIdx[ nDesc ].nActualIdx;
+ aFtn.ChgPageDesc( (SwPageDesc*)&pDoc->GetPageDesc( nLay ) );
+
+ aFtn.ePos = (SwFtnPos) ePos;
+ aFtn.eNum = (SwFtnNum) eNum;
+ aFtn.aFmt.SetNumberingType(eType);
+ pDoc->SetFtnInfo( aFtn );
+ r.next();
+ }
+
+// Aufdroeseln des Comment-Records fuer kuenftige Erweiterungen
+
+ void SwSwgReader::InComment()
+ {
+ BYTE cType;
+ USHORT nVal;
+ r >> cType;
+ switch( cType ) {
+ case SWG_XFTNCOLL: {
+ // Fussnoten-Erweiterung: Nummer der TxtColl
+ r >> nVal;
+ nVal &= IDX_COLLECTION;
+ SwTxtFmtColl* pColl = (SwTxtFmtColl*) FindFmt( nVal, 0 );
+ if( pColl )
+ {
+ SwFtnInfo aFtn;
+ aFtn = pDoc->GetFtnInfo();
+ aFtn.SetFtnTxtColl( *pColl );
+ pDoc->SetFtnInfo( aFtn );
+ }
+ } break;
+ default:
+ r.skip();
+ }
+ r.next();
+ }
+
+///////////////////////////////////////////////////////////////////////////
+
+// Einlesen der statischen DocInfo
+
+ static void InSfxStamp( swistream& r, SfxStamp& rStamp,
+ rtl_TextEncoding eCharSet )
+ {
+ r.long4();
+ long nDate, nTime;
+ sal_Char buf[ 32 ];
+ r >> nDate >> nTime;
+ r.get( buf, 32 );
+ r.long3();
+ Date d( nDate );
+ Time t( nTime );
+ String aName( buf, eCharSet );
+ rStamp.SetTime( DateTime( d, t ) );
+ rStamp.SetName( aName );
+ }
+
+ static void InSfxDocString
+ ( swistream& r, String& rText, short nLen, rtl_TextEncoding eCharSet )
+ {
+ sal_Char buf[ 256 ];
+ r.get( buf, nLen );
+ String sTmp( buf, eCharSet );
+ rText = sTmp;
+ }
+
+ void SwSwgReader::InStaticDocInfo( SfxDocumentInfo& rInfo )
+ {
+ long pos;
+ USHORT n, i;
+ BYTE cGUIType, cCharSet;
+ // TODO: unicode: is this correct?
+ rtl_TextEncoding eCharSet = gsl_getSystemTextEncoding();
+ SfxStamp aStamp;
+ String aText;
+
+ while( r.good() )
+ {
+ switch( r.next() )
+ {
+ case SWGINF_END:
+ return;
+ case SWGINF_SAVEINFO:
+ pos = r.tell();
+ r.skip();
+ if( r.peek() == SWGINF_EXTINFO )
+ {
+ r.next();
+ r >> cGUIType
+ >> cCharSet;
+ eCharSet = (rtl_TextEncoding) cCharSet;
+ }
+ r.seek( pos );
+ InSfxStamp( r, aStamp, eCharSet );
+ rInfo.SetCreated( aStamp );
+ InSfxStamp( r, aStamp, eCharSet );
+ rInfo.SetChanged( aStamp );
+ InSfxStamp( r, aStamp, eCharSet );
+ rInfo.SetPrinted( aStamp );
+ // SwSwgInfo-Felder II: Titel, Autor etc
+ InSfxDocString( r, aText, 64, eCharSet );
+ rInfo.SetTitle( aText );
+ InSfxDocString( r, aText, 64, eCharSet );
+ rInfo.SetTheme( aText );
+ InSfxDocString( r, aText, 256, eCharSet );
+ rInfo.SetComment( aText );
+ InSfxDocString( r, aText, 128, eCharSet );
+ rInfo.SetKeywords( aText );
+ // SwSwgInfo-Felder III: User-Keys
+ r >> n;
+ for( i = 0; i < n; i++ )
+ {
+ String aKeys;
+ InSfxDocString( r, aText, 20, eCharSet );
+ InSfxDocString( r, aKeys, 20, eCharSet );
+ SfxDocUserKey aKey( aText, aKeys );
+ rInfo.SetUserKey( aKey, i );
+ }
+ break;
+ default:
+ // wird ignoriert
+ r.skip();
+ }
+ }
+
+ }
+
+ void SwSwgReader::InDynamicDocInfo( SfxDocumentInfo& rInfo )
+ {
+ // Record suchen:
+ if( r.next() == SWG_DOCUMENT )
+ {
+ r.skip();
+ if( r.peek() == SWG_DYNDOCINFO )
+ {
+ r.next();
+ long nextrec = r.getskip();
+ long pos, d, t;
+ BYTE cFlags = 0;
+ while( r.tell() < nextrec && r.good() )
+ {
+ String aText;
+ switch( r.next() )
+ {
+ case SWGINF_TEMPLATE:
+ pos = r.getskip();
+ aText = GetText();
+ r.long4();
+ r >> d >> t;
+ r.long3();
+ if( r.tell() < pos ) r >> cFlags;
+ rInfo.SetTemplateDate( DateTime( Date( d ), Time( t ) ) );
+ rInfo.SetTemplateName( aText );
+ rInfo.SetTemplateFileName( aFileName );
+ rInfo.SetQueryLoadTemplate( BOOL( ( cFlags & 0x01 ) != 0 ) );
+ r.skip( pos ); break;
+ default:
+ r.skip();
+ }
+ }
+ }
+ }
+ }
+
+ BOOL SwSwgReader::LoadDocInfo( SfxDocumentInfo& rInfo )
+ {
+ FileHeader aFile;
+ long pos0 = r.tell();
+
+ memset( &aFile, 0, sizeof aFile );
+ r.get( &aFile, 4 );
+ // Die Signatur sollte schon stimmen!!!
+ // Aber bitte nur die ersten drei Zeichen, um nicht abwaertskompatible
+ // Versionen erkennen zu koennen.
+ if( memcmp( ( const void*) &aFile.nSignature, SWG_SIGNATURE, 3 ) )
+ return FALSE;
+ r.long4();
+ r >> aFile.nVersion
+ >> aFile.nFlags
+ >> aFile.nFree1
+ >> aFile.nDocInfo;
+ r.get( aFile.cPasswd, 16 );
+ r.long3();
+ // rInfo.SetPasswd( BOOL( ( aFile.nFlags & SWGF_HAS_PASSWD ) != 0 ) );
+ rInfo.SetPortableGraphics( BOOL( ( aFile.nFlags & SWGF_PORT_GRAF ) != 0 ) );
+
+ // Passwort in Stream eintragen
+ if( aFile.nFlags & SWGF_HAS_PASSWD )
+ r.copypasswd( aFile.cPasswd );
+ // Die statische DocInfo lesen
+ // Hot fix fuer Bug #4955 (Textbausteine mit geloeschten Bereichen)
+ if( !aFile.nDocInfo ) aFile.nDocInfo = 0x5B;
+ if( aFile.nVersion >= SWG_VER_FMTNAME )
+ {
+ r.seek( aFile.nDocInfo - 4 );
+ InStaticDocInfo( rInfo );
+ }
+ if( aFile.nVersion >= SWG_VER_DOCINFO )
+ {
+ r.seek( pos0 + 32 /* sizeof( FileHeader ) in Datei */ );
+ InDynamicDocInfo( rInfo );
+ r.seek( pos0 );
+ }
+ return BOOL( r.good() );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdnds.cxx b/binfilter/bf_sw/source/core/swg/sw_rdnds.cxx
new file mode 100644
index 000000000000..3a0f0e074d52
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdnds.cxx
@@ -0,0 +1,771 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_so3/persist.hxx>
+#include <bf_so3/embobj.hxx>
+#include <bf_svtools/urihelper.hxx>
+#include <bf_svx/fontitem.hxx>
+#include <bf_svx/cscoitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+
+#include <txtftn.hxx>
+#include <fchrfmt.hxx>
+#include <charatr.hxx>
+#include <charfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <pam.hxx>
+#include <rdswg.hxx>
+#include <sw3io.hxx>
+#include <ndtxt.hxx>
+#include <ndgrf.hxx>
+#include <ndole.hxx>
+#include <frmatr.hxx>
+#include <flypos.hxx>
+#include <bookmrk.hxx>
+#include <swgpar.hxx>
+#include <swerror.h>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Achtung: Jede Routine nimmt an, dass der Record-Header bereits eingelesen
+// ist. Sie arbeitet den Record so weit ab wie moeglich und schliesst den
+// Vorgang mit end() ab.
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Text-Hints
+// nOffset ist ungleich Null, wenn innerhalb eines Nodes eingefuegt werden
+// soll. Dann ist nOffset die Start-Position des Textes.
+
+ void SwSwgReader::InTextHints( SwTxtNode& rNd, xub_StrLen nOffset )
+ {
+ // Dieser Record kann auch leer sein
+ // (bei teilweisem Speichern eines Nodes, z.B.)
+ short nHt;
+ r >> nHt;
+ if( nHt < 0 )
+ {
+ Error(); r.skipnext(); return;
+ }
+ xub_StrLen nLen = rNd.GetTxt().Len();
+ if( nLen ) nLen --;
+ for( int i = 0; i < nHt; i++ ) {
+ USHORT nOldStart, nOldEnd;
+ r >> nOldStart >> nOldEnd;
+ r.next();
+ xub_StrLen nStart = nOldStart + nOffset;
+ xub_StrLen nEnd = nOldEnd + nOffset;
+ if( nOldEnd < nOldStart ) nEnd = nLen;
+ USHORT nWhich = InHint( rNd, nStart, nEnd );
+ if( nWhich == RES_TXTATR_FTN )
+ {
+ // Der Footnote-Hint ist somewhat special. Er erhaelt
+ // eine Section, wenn er in den TextNode eingefuegt wird.
+ // Daher muss der Text getrennt geparst werden
+ SwTxtFtn* pFtn = (SwTxtFtn*) rNd.GetTxtAttr( nStart, nWhich );
+ SwNodeIndex aIdx( *pFtn->GetStartNode() );
+ FillSection( aIdx );
+ // den zuletzt eingelesenen Record zuruecksetzen
+ r.undonext();
+ }
+ }
+ r.next();
+ }
+
+// Bookmarks:
+
+ void SwSwgReader::InNodeBookmark( SwNodeIndex& rPos )
+ {
+ BYTE cFlags = 0;
+ // Flag-Byte: 0x01 = Startmakro, 0x02 = Endmakro
+ r >> cFlags;
+ String aName = GetText();
+ String aShort = GetText();
+ if( !r )
+ return; // must have
+ USHORT nOffset, nKey, nMod;
+ r >> nOffset >> nKey >> nMod;
+ const SwBookmarks& rMarks = pDoc->GetBookmarks();
+ short nArrLen = rMarks.Count();
+ SwPaM aPaM( rPos.GetNode(), (xub_StrLen)nOffset );
+ pDoc->MakeBookmark( aPaM, KeyCode( nKey, nMod ), aName, aShort );
+ if( cFlags )
+ {
+ SwBookmark* pMark = rMarks[ nArrLen ];
+ if( cFlags & 0x01 )
+ {
+ String aMac = GetText();
+ String aLib = GetText();
+ SvxMacro aStart( aMac, aLib, STARBASIC );
+ pMark->SetStartMacro( aStart );
+ }
+ if( cFlags & 0x02 )
+ {
+ String aMac = GetText();
+ String aLib = GetText();
+ SvxMacro aEnd( aMac, aLib, STARBASIC );
+ pMark->SetEndMacro( aEnd );
+ }
+ }
+
+ r.next();
+ }
+
+// Hilfsroutine fuer ConvertText: Suche nach dem naechsten Hint,
+// der eine Konversion verbietet. Zur Zeit sind dies Hints, die entweder
+// direkt oder indirekt auf einen Font mit CHARSET_SYMBOL hinweisen.
+
+ USHORT SwSwgReader::GetNextSymbolFontHint
+ ( SwpHints* pHints, USHORT idx, xub_StrLen& start, xub_StrLen& end )
+ {
+ if( !pHints ) return 0;
+ for( ; idx < pHints->Count(); idx++ )
+ {
+ const SwTxtAttr* pHnt = (*pHints) [ idx ];
+ if( pHnt->Which() == RES_CHRATR_FONT )
+ {
+ if( pHnt->GetFont().GetCharSet() == RTL_TEXTENCODING_SYMBOL )
+ {
+ start = *pHnt->GetStart();
+ end = *pHnt->GetEnd() - 1;
+ break;
+ }
+ }
+ // Gibt es einen CharFormat-Hint mit einem Symbol-Font?
+ if( pHnt->Which() == RES_TXTATR_CHARFMT )
+ {
+ SwCharFmt* pFmt = pHnt->GetCharFmt().GetCharFmt();
+ if( pFmt->GetAttrSet().GetItemState( RES_CHRATR_FONT, FALSE )
+ == SFX_ITEM_SET )
+ {
+ const SvxFontItem& rAttr = pFmt->GetFont();
+ if( rAttr.GetCharSet() == RTL_TEXTENCODING_SYMBOL )
+ {
+ start = *pHnt->GetStart();
+ end = *pHnt->GetEnd();
+ break;
+ }
+ }
+ }
+ }
+ return idx;
+ }
+
+ USHORT SwSwgReader::GetNextCharsetColorHint
+ ( SwpHints* pHints, USHORT idx, xub_StrLen& start, xub_StrLen& end,
+ rtl_TextEncoding eDfltEnc, rtl_TextEncoding& rEnc )
+ {
+ rEnc = eDfltEnc;
+
+ if( !pHints ) return 0;
+ for( ; idx < pHints->Count(); idx++ )
+ {
+ const SwTxtAttr* pHnt = (*pHints) [ idx ];
+ if( pHnt->Which() == RES_CHRATR_CHARSETCOLOR )
+ {
+ if( pHnt->GetCharSetColor().GetCharSet() != eDfltEnc )
+ {
+ rEnc = pHnt->GetCharSetColor().GetCharSet();
+ start = *pHnt->GetStart();
+ end = *pHnt->GetEnd() - 1;
+ break;
+ }
+ }
+ }
+ return idx;
+ }
+// Text Node konvertieren
+// Wird aufgerufen, wenn sich die Systeme unterscheiden. Der Text wird
+// vom einen in den anderen Zeichensatz konvertiert. Nicht konvertierbare
+// Zeichen werden farblich unterlegt; Hints mit CHARSET_SYMBOL-Zeichensaetzen
+// werden uebersprungen
+
+ void SwSwgReader::ConvertText( SwTxtNode& rNd, rtl_TextEncoding eSrc )
+ {
+ const ByteString* pText = GetReadTxt();
+ xub_StrLen nLength;
+ if( !pText || 0 == ( nLength = pText->Len() ) )
+ return;
+
+ // Variablen fuer das Hint-Array
+ USHORT hntidx = 0;
+ xub_StrLen symfrom = (xub_StrLen)-1, symto = 0;
+ SwpHints* pHints = rNd.GetpSwpHints();
+ USHORT hntsiz = pHints ? pHints->Count() : 0;
+ String& rNdText = (String &)rNd.GetTxt();
+
+ const SvxFontItem& rFont = rNd.GetSwAttrSet().GetFont();
+ BOOL bNdSym = rFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL;
+
+ // Step 1: Replace all characters that are symbol font.
+ hntidx = GetNextSymbolFontHint( pHints, hntidx, symfrom, symto );
+ xub_StrLen pos;
+ for( pos = 0; pos < nLength; pos++ )
+ {
+ sal_Unicode cNew = 0;
+ // Eventuell neuen Font-Hint suchen
+ if( symfrom != (xub_StrLen)-1 && symto < pos )
+ {
+ symfrom = (xub_StrLen)-1;
+ hntidx = GetNextSymbolFontHint( pHints, hntidx, symfrom, symto );
+ }
+ sal_Char ch = pText->GetChar( pos );
+ // Darf das Zeichen konvertiert werden?
+ if( '\xff' == ch )
+ {
+ // Sonderzeichen: liegt dort ein Hint ohne Ende-Index?
+ for( USHORT i = 0; i < hntsiz; ++i )
+ {
+ const SwTxtAttr *pPos = (*pHints)[ i ];
+ const xub_StrLen nStart = *pPos->GetStart();
+ if( pos == nStart && !pPos->GetEnd() )
+ {
+ // Wenn ja, dann darf ch nicht konvertiert werden!
+ ch = 0;
+ cNew = GetCharOfTxtAttr( *pPos );
+ break;
+ }
+ if( nStart > pos ) break;
+ }
+ }
+ if( ch == '\t' || ch == '\n' ) ch = 0;
+ // Testen, ob man sich im verbotenen Bereich befindet:
+ if( ch )
+ {
+ if( bNdSym || (symfrom != (xub_StrLen)-1 &&
+ pos >= symfrom && pos < symto) )
+ {
+ // TODO: unicode: What happens with symbol characters?
+ // cNew = String::ConvertToUnicode( ch, eSrc );
+ cNew = (sal_Unicode)ch;
+ }
+ }
+ if( cNew )
+ rNdText.SetChar( pos, cNew );
+ }
+
+ // Step 2: Replace all characters that have a charset color attribute set
+ rtl_TextEncoding eEnc = eSrc;
+ hntidx = GetNextCharsetColorHint( pHints, hntidx, symfrom, symto,
+ eSrc, eEnc);
+
+ for( pos = 0; pos < nLength; pos++ )
+ {
+ // Eventuell neuen Font-Hint suchen
+ if( symfrom != (xub_StrLen)-1 && symto < pos )
+ {
+ symfrom = (xub_StrLen)-1;
+ hntidx = GetNextCharsetColorHint( pHints, hntidx, symfrom, symto,
+ eSrc, eEnc );
+ }
+ sal_Char ch = pText->GetChar( pos );
+ // Darf das Zeichen konvertiert werden?
+ if( '\xff' == ch )
+ {
+ // Sonderzeichen: liegt dort ein Hint ohne Ende-Index?
+ for( USHORT i = 0; i < hntsiz; ++i )
+ {
+ const SwTxtAttr *pPos = (*pHints)[ i ];
+ const xub_StrLen nStart = *pPos->GetStart();
+ if( pos == nStart && !pPos->GetEnd() )
+ {
+ // Wenn ja, dann darf ch nicht konvertiert werden!
+ ch = 0;
+ break;
+ }
+ if( nStart > pos ) break;
+ }
+ }
+ if( ch == '\t' || ch == '\n' ) ch = 0;
+ // Testen, ob man sich im verbotenen Bereich befindet:
+ if( ch && (symfrom != (xub_StrLen)-1 &&
+ pos >= symfrom && pos < symto) )
+ {
+ sal_Unicode cNew = ByteString::ConvertToUnicode( ch, eEnc );
+ if( cNew )
+ rNdText.SetChar( pos, cNew );
+ }
+ }
+ }
+
+// Attributsack mit einem anderen Sack fuellen. Dies ist der Fall,
+// wenn auf Autoformate eines anderen Nodes Bezug genommen wird.
+
+ void SwSwgReader::SetAttrSet( SwCntntNode& rNd, USHORT nIdx )
+ {
+ if( !rNd.GetpSwAttrSet() )
+ rNd.NewAttrSet( pDoc->GetAttrPool() );
+ FillAttrSet( *rNd.GetpSwAttrSet(), nIdx );
+ }
+
+// all textattributes can ask for here textcharacter. But in the node is the
+// converted text, were they don't found the right characters. So they need
+// a access to the original text, which will be done by this class. The read
+// can be called recursiv!!
+ class _SetOrigTextAtReader
+ {
+ ByteString sReadTxt;
+ const ByteString* pOldTxt;
+ SwSwgReader& rRdr;
+
+ public:
+ _SetOrigTextAtReader( SwSwgReader& rR, xub_StrLen nOffset )
+ : rRdr( rR )
+ {
+ if( nOffset )
+ sReadTxt.Expand( nOffset );
+ pOldTxt = rRdr.GetReadTxt();
+ rRdr.SetReadTxt( &sReadTxt );
+ }
+
+ ~_SetOrigTextAtReader()
+ {
+ rRdr.SetReadTxt( pOldTxt );
+ }
+
+ void AppendText( const ByteString& rTxt ) { sReadTxt += rTxt; }
+ const ByteString& GetReadText() const { return sReadTxt; }
+ };
+
+
+// Text Node einlesen
+// Falls kein Node angegeben ist, wird ein neuer Node an der angegebenen
+// Position erzeugt.
+ void lcl_sw3io__ConvertNumTabStop( SwTxtNode& rTxtNd, long nOffset,
+ BOOL bDeep );
+ void SwSwgReader::FillTxtNode( SwTxtNode* pNd, SwNodeIndex& rPos,
+ xub_StrLen nOffset, USHORT nInsFirstPara )
+ {
+ long nextrec = r.getskip();
+
+ // Flags-Aufbau:
+ // Bit 0x01 - hat Collection-Wert
+ // Bit 0x02 - hat eigenes Frameformat
+ // Bit 0x04 - hat eigenes Zeichenformat
+ // Bit 0x08 - hat eigenes Absatzformat
+ // Bit 0x10 - hat Numerierung
+
+ BYTE cFlags = 0, cNumLevel = NO_NUMBERING;
+ USHORT nNumRule = IDX_NO_VALUE;
+ USHORT nColl = 0,
+ nAutoFrm = IDX_NO_VALUE,
+ nAutoChar = IDX_NO_VALUE,
+ nAutoPara = IDX_NO_VALUE;
+
+ r >> cFlags;
+ if( cFlags & 0x01 ) r >> nColl;
+ if( cFlags & 0x02 ) r >> nAutoFrm;
+ if( cFlags & 0x04 ) r >> nAutoChar;
+ if( cFlags & 0x08 ) r >> nAutoPara;
+ if( cFlags & 0x10 ) r >> cNumLevel >> nNumRule;
+
+ // Werden nur Seitenvorlagen eingelesen, muss die Collection
+ // immer 0 sein, da andere Coll-Idxe immer falsch sind
+ if( ( nOptions != SWGRD_NORMAL ) && !( nOptions & SWGRD_PARAFMTS ) )
+ nColl = 0;
+ SwTxtFmtColl* pColl = (SwTxtFmtColl*) FindFmt( nColl | IDX_COLLECTION, 0 );
+ if( !pColl )
+ pColl = (SwTxtFmtColl*) FindFmt( IDX_COLLECTION + 0, 0 );
+
+ BOOL bDone = FALSE;
+
+ // Ggf. den Node neu einrichten
+ BOOL bNewNd = FALSE;
+ if( !pNd )
+ {
+ pNd = pDoc->GetNodes().MakeTxtNode( rPos, pColl );
+ rPos--;
+ nOffset = 0;
+ bNewNd = TRUE;
+ }
+ else if( !nInsFirstPara )
+ pNd->ChgFmtColl( pColl );
+
+ _SetOrigTextAtReader aOrigTxtAtReader( *this, nOffset );
+
+ SwAttrSet aTmpSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END - 1 );
+
+ r.next();
+ while( !bDone && ( r.tell() < nextrec ) ) switch( r.cur() )
+ {
+ case SWG_COMMENT:
+ if( r.tell() >= nextrec )
+ bDone = TRUE;
+ else
+ r.skipnext();
+ break;
+ case SWG_FRAMEFMT:
+ if( nInsFirstPara )
+ {
+ r.skipnext();
+ nAutoFrm = IDX_NO_VALUE;
+ }
+ else
+ {
+ if( InAttrSet( *pNd ) == nAutoFrm ) nAutoFrm = IDX_NO_VALUE;
+ // Wurde ein PageDesc-Attr gelesen? Dann das AttrSet des Nodes
+ // im PageDescLink noch nachtragen!
+ if( pPageLinks && !pPageLinks->pSet )
+ {
+ pPageLinks->pSet = pNd->GetpSwAttrSet();
+ pPageLinks->cFmt = FALSE;
+ }
+ }
+ break;
+ case SWG_CHARFMT:
+ if( nInsFirstPara )
+ {
+ if( InAttrSet( aTmpSet ) == nAutoChar )
+ nAutoChar = IDX_NO_VALUE;
+ }
+ else if( InAttrSet( *pNd ) == nAutoChar )
+ nAutoChar = IDX_NO_VALUE;
+ break;
+ case SWG_PARAFMT:
+ if( nInsFirstPara )
+ {
+ r.skipnext();
+ nAutoPara = IDX_NO_VALUE;
+ }
+ else
+ if( InAttrSet( *pNd ) == nAutoPara ) nAutoPara = IDX_NO_VALUE;
+ break;
+ case SWG_TEXT:
+ {
+ ByteString aTxt( r.text() ); // Hier nicht konvertieren!
+ aOrigTxtAtReader.AppendText( aTxt );
+ // The conversion that takes place may lead to wrong results.
+ // This will be fixed in ConvertText.
+ String aText( aTxt, aHdr.cCodeSet );
+ r.next();
+ if( bNewNd )
+ (String&) pNd->GetTxt() = aText;
+ else {
+ SwIndex aOff( pNd, nOffset );
+ pNd->Insert( aText, aOff );
+ }
+ }
+ break;
+ case SWG_TEXTHINTS:
+ InTextHints( *pNd, nOffset );
+ break;
+ case SWG_FLYFMT:
+ InFlyFrame( &rPos );
+ break;
+ case SWG_BOOKMARK:
+ if( !( nStatus & SWGSTAT_NO_BOOKMARKS ) )
+ InNodeBookmark( rPos );
+ else
+ r.skipnext();
+ break;
+ case SWG_OUTLINE:
+ // alter Numerierungs-Record, jetzt nicht mehr da!
+ r.skipnext();
+ break;
+ default:
+ bDone = TRUE;
+ }
+
+ if( aTmpSet.Count() )
+ {
+ if( 2 == nInsFirstPara )
+ pNd->SetAttr( aTmpSet, 0, GetReadTxt()->Len() - nOffset );
+ else
+ pNd->SetAttr( aTmpSet, nOffset, pNd->GetTxt().Len() );
+ }
+
+ // Wird noch auf Autoformate Bezug genommen?
+ if( nAutoFrm != IDX_NO_VALUE )
+ SetAttrSet( *pNd, nAutoFrm );
+ if( nAutoChar != IDX_NO_VALUE )
+ SetAttrSet( *pNd, nAutoChar );
+ if( nAutoPara != IDX_NO_VALUE )
+ SetAttrSet( *pNd, nAutoPara );
+
+ // Numerierung uebernehmen
+ if( cNumLevel != NO_NUMBERING )
+ {
+ if( nNumRule != IDX_NO_VALUE )
+ UpdateRuleRange( nNumRule, pNd );
+ pNd->UpdateNum( SwNodeNum( cNumLevel ));
+ }
+ #ifdef NUM_RELSPACE
+ else if( pNd->GetpSwAttrSet() &&
+ NO_NUMBERING != pColl->GetOutlineLevel() &&
+ pDoc->GetOutlineNumRule() )
+ {
+ const SwNumRule *pOutline = pDoc->GetOutlineNumRule();
+ const SfxPoolItem *pItem;
+
+ const SwNumFmt& rNumFmt = pOutline->Get(
+ GetRealLevel(((const SwTxtFmtColl*)pColl)->GetOutlineLevel()) );
+ USHORT nNumLSpace = rNumFmt.GetAbsLSpace();
+
+ if( SFX_ITEM_SET == pNd->GetpSwAttrSet()->GetItemState( RES_LR_SPACE,
+ FALSE,
+ &pItem ) )
+ {
+ const SvxLRSpaceItem *pParaLRSpace =
+ (const SvxLRSpaceItem *)pItem;
+
+ USHORT nWishLSpace = pParaLRSpace->GetTxtLeft();
+ USHORT nNewLSpace =
+ nWishLSpace > nNumLSpace ? nWishLSpace-nNumLSpace : 0U;
+
+ const SvxLRSpaceItem& rCollLRSpace = pColl->GetLRSpace();
+ if( nNewLSpace == rCollLRSpace.GetTxtLeft() &&
+ pParaLRSpace->GetRight() == rCollLRSpace.GetRight() &&
+ pParaLRSpace->GetTxtFirstLineOfst() ==
+ rCollLRSpace.GetTxtFirstLineOfst() )
+ {
+ pNd->ResetAttr( RES_LR_SPACE );
+ }
+ else if( nNewLSpace != pParaLRSpace->GetTxtLeft() )
+ {
+ SvxLRSpaceItem aLRSpace( *pParaLRSpace );
+ short nFirst = aLRSpace.GetTxtFirstLineOfst();
+ if( nFirst < 0 && (USHORT)-nFirst > nNewLSpace )
+ aLRSpace.SetTxtFirstLineOfst( -(short)nNewLSpace );
+ aLRSpace.SetTxtLeft( nNewLSpace );
+ ((SwCntntNode *)pNd)->SetAttr( aLRSpace );
+ }
+
+ if( nWishLSpace != nNewLSpace )
+ lcl_sw3io__ConvertNumTabStop( *pNd, (long)nWishLSpace -
+ (long)nNewLSpace, FALSE );
+ }
+ else if( nNumLSpace > 0 )
+ {
+ lcl_sw3io__ConvertNumTabStop( *pNd, nNumLSpace, FALSE );
+ }
+ }
+ #endif
+
+ // Eventuell den Text konvertieren
+ ConvertText( *pNd, (rtl_TextEncoding)aHdr.cCodeSet );
+ rPos++;
+ }
+
+// Einlesen des puren Textes eines TextNodes. Der Text wird an den vorhandenen
+// Text im String angefuegt.
+
+ void SwSwgReader::FillString( String& rText )
+ {
+ // Flags-Aufbau:
+ // Bit 0x01 - hat Collection-Wert
+ // Bit 0x02 - hat eigenes Frameformat
+ // Bit 0x04 - hat eigenes Zeichenformat
+ // Bit 0x08 - hat eigenes Absatzformat
+ // Bit 0x10 - hat Numerierung
+
+ BYTE cFlags = 0;
+ USHORT nDummyBytes = 0;
+ String aTxt;
+ long nextrec = r.getskip();
+
+ r >> cFlags;
+ if( cFlags & 0x01 ) nDummyBytes += 2;
+ if( cFlags & 0x02 ) nDummyBytes += 2;
+ if( cFlags & 0x04 ) nDummyBytes += 2;
+ if( cFlags & 0x08 ) nDummyBytes += 2;
+ if( cFlags & 0x10 ) nDummyBytes += 3;
+
+ BOOL bDone = FALSE;
+ r.seek( r.tell() + nDummyBytes );
+ r.next();
+ while( !bDone ) switch( r.cur() )
+ {
+ case SWG_PARAFMT:
+ case SWG_CHARFMT:
+ case SWG_FRAMEFMT:
+ case SWG_TEXTHINTS:
+ case SWG_FLYFMT:
+ case SWG_BOOKMARK:
+ case SWG_OUTLINE:
+ r.skipnext(); break;
+ case SWG_COMMENT:
+ if( r.tell() >= nextrec ) bDone = TRUE;
+ else r.skipnext(); break;
+ case SWG_TEXT:
+ aTxt = ParseText();
+ if( rText.Len() ) rText += ' ';
+ rText += aTxt;
+ r.next();
+ break;
+ default:
+ bDone = TRUE;
+ }
+ }
+
+// Die Formate von Grafik- und OLE-Nodes muessen nicht registriert
+// werden; die Layout-Frames erhalten ja eine Node-Referenz.
+
+ void SwSwgReader::InGrfNode( SwNodeIndex& rPos )
+ {
+ Graphic aGrf;
+ Graphic* pGrf = &aGrf;
+ String aGrfName, aFltName;
+ USHORT nFrmFmt = IDX_NO_VALUE;
+ USHORT nGrfFmt = IDX_NO_VALUE;
+ long nextrec = r.getskip();
+
+ r >> nFrmFmt >> nGrfFmt;
+ r.next();
+ BOOL bLink = FALSE;
+ BOOL bDone = FALSE;
+ SwAttrSet aSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_GRFATR_END );
+ while( !bDone ) switch( r.cur() )
+ {
+ case SWG_FRAMEFMT:
+ case SWG_GRFFMT:
+ InAttrSet( aSet );
+ break;
+ case SWG_GRAPHIC: {
+ long pos = r.getskip();
+ aGrfName = GetText();
+ aFltName = GetText();
+ if( !aGrfName.Len() )
+ {
+ long nPos = r.tell();
+ if( nPos < pos )
+ {
+ // Immer sofort einlesen (kann spaeter rausgeswapt werden)
+ if( aHdr.nVersion >= SWG_VER_PORTGRF )
+ aGrf.ReadEmbedded( r.Strm(), FALSE );
+ else
+ r.Strm() >> aGrf;
+ }
+ }
+ else
+ {
+ pGrf = NULL, bLink = TRUE;
+ aGrfName = ::binfilter::StaticBaseUrl::SmartRelToAbs( aGrfName );
+ }
+ r.skip( pos );
+ r.next();
+ if( r.good() ) break;
+ }
+ case SWG_COMMENT:
+ case SWG_DATA:
+ if( r.tell() >= nextrec ) bDone = TRUE;
+ else r.skipnext(); break;
+ default:
+ bDone = TRUE;
+ }
+
+ if( r.good() )
+ pDoc->GetNodes().MakeGrfNode( rPos,
+ aGrfName, aFltName, pGrf,
+ (SwGrfFmtColl*) pDoc->GetDfltGrfFmtColl(),
+ &aSet, bLink );
+ else
+ Error( ERR_SWG_READ_ERROR );
+
+ }
+
+// OLE-Node:
+
+ void SwSwgReader::InOleNode( SwNodeIndex& rPos )
+ {
+ USHORT nFrmFmt = IDX_NO_VALUE;
+ USHORT nGrfFmt = IDX_NO_VALUE;
+ long nextrec = r.getskip();
+
+ r >> nFrmFmt >> nGrfFmt;
+ r.next();
+ SwAttrSet aSet( pDoc->GetAttrPool(), RES_CHRATR_BEGIN, RES_GRFATR_END );
+ String aObjName;
+ BOOL bDone = FALSE;
+ while( !bDone ) switch( r.cur() )
+ {
+ case SWG_FRAMEFMT:
+ case SWG_GRFFMT:
+ InAttrSet( aSet );
+ break;
+ case SWG_OLE:
+ {
+ SvStorage* pStg = pDoc->GetPersist()->GetStorage();
+ aObjName = Sw3Io::UniqueName( pStg, "StarObj" );
+ ULONG nStart = r.Strm().Tell();
+ if( !SvEmbeddedObject::InsertStarObject
+ ( aObjName, aObjName, r.Strm(), pDoc->GetPersist() ) )
+ {
+ // Vielleicht geht es ja als Grafik...
+ GDIMetaFile aMtf;
+ r.Strm().Seek( nStart );
+ if( SvEmbeddedObject::LoadStarObjectPicture( r.Strm(), aMtf ) )
+ {
+ r.Strm().ResetError();
+ aObjName.Erase();
+ Graphic aGrf( aMtf );
+ pDoc->GetNodes().MakeGrfNode( rPos,
+ aObjName, aObjName, &aGrf,
+ (SwGrfFmtColl*) pDoc->GetDfltGrfFmtColl(),
+ &aSet, FALSE );
+ nErrno = WARN_SWG_OLE | WARN_SW_READ_BASE;
+ return;
+ }
+ else
+ Error( ERR_SWG_READ_ERROR );
+ }
+ r.skipnext(); break;
+ }
+ case SWG_COMMENT:
+ case SWG_DATA:
+ if( r.tell() >= nextrec ) bDone = TRUE;
+ else r.skipnext(); break;
+ default:
+ bDone = TRUE;
+ }
+ if ( !r )
+ {
+ Error( ERR_SWG_READ_ERROR );
+ }
+ else
+ pDoc->GetNodes().MakeOLENode( rPos, aObjName,
+ (SwGrfFmtColl*) pDoc->GetDfltGrfFmtColl(),
+ &aSet );
+ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdnum.cxx b/binfilter/bf_sw/source/core/swg/sw_rdnum.cxx
new file mode 100644
index 000000000000..c19c31dc7a16
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdnum.cxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/lrspitem.hxx>
+#include <vcl/font.hxx>
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <errhdl.hxx>
+
+#include "pam.hxx"
+#include "rdswg.hxx"
+#include "ndtxt.hxx"
+#include "numrule.hxx"
+#include "poolfmt.hxx"
+namespace binfilter {
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Achtung: Jede Routine nimmt an, dass der Record-Header bereits eingelesen
+// ist. Sie arbeitet den Record so weit ab wie moeglich und schliesst den
+// Vorgang mit end() ab.
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Numerierungs-Format
+extern BYTE lcl_sw3io__GetIncludeUpperLevel( BOOL bInclUpperLevel );
+
+void SwSwgReader::InNumFmt( SwNumFmt& rFmt )
+{
+ // Flags:
+ // 0x01 - Praefix-String vorhanden
+ // 0x02 - Postfix-String vorhanden
+ // 0x04 - Bullet-Font vorhanden
+ sal_Char bFlags, eType, cBullet, bInclUpperLevel, eNumAdjust;
+ USHORT nFmt, nStart;
+ String aFontName;
+ sal_Char eFamily, ePitch, eCharSet = RTL_TEXTENCODING_SYMBOL;
+ long nLSpace, nFirstLineOffset;
+ if( aHdr.nVersion >= SWG_VER_COMPAT )
+ {
+ rFmt.SetPrefix( GetText() );
+ rFmt.SetSuffix( GetText() );
+ aFontName = GetText();
+ BOOL bOk = TRUE;
+ if( r.next() != SWG_DATA ) bOk = FALSE, Error();
+ r >> bFlags
+ >> nFmt
+ >> eType
+ >> cBullet
+ >> bInclUpperLevel
+ >> nStart
+ >> eNumAdjust
+ >> nLSpace
+ >> nFirstLineOffset
+ >> eFamily
+ >> ePitch
+ >> eCharSet;
+ if( bOk ) r.skip();
+ } else {
+ r >> bFlags
+ >> nFmt
+ >> eType
+ >> cBullet
+ >> bInclUpperLevel
+ >> nStart
+ >> eNumAdjust
+ >> nLSpace
+ >> nFirstLineOffset;
+ if( bFlags & 0x01 )
+ rFmt.SetPrefix( GetText() );
+ if( bFlags & 0x02 )
+ rFmt.SetSuffix( GetText() );
+ if( bFlags & 0x04 )
+ {
+ aFontName = GetText();
+ r >> eFamily >> ePitch >> eCharSet;
+ }
+ }
+ if( RTL_TEXTENCODING_DONTKNOW == eCharSet )
+ eCharSet = RTL_TEXTENCODING_SYMBOL;
+ sal_Unicode cBull = ByteString::ConvertToUnicode( cBullet, eCharSet );
+ if( !cBull )
+ cBull = cBulletChar;
+ rFmt.SetNumberingType( eType );
+ rFmt.SetBulletChar( cBull );
+ rFmt.SetIncludeUpperLevels( lcl_sw3io__GetIncludeUpperLevel(bInclUpperLevel) );
+ rFmt.SetStart( nStart );
+ rFmt.SetNumAdjust( SvxAdjust( eNumAdjust ) );
+ rFmt.SetAbsLSpace( (USHORT)nLSpace );
+ rFmt.SetFirstLineOffset( (short)nFirstLineOffset );
+ if( bFlags & 0x04 )
+ {
+ Font aFont;
+ aFont.SetName( aFontName );
+ aFont.SetFamily( FontFamily( eFamily ) );
+ aFont.SetPitch( FontPitch( ePitch ) );
+ aFont.SetCharSet( rtl_TextEncoding( eCharSet ) );
+ rFmt.SetBulletFont( &aFont );
+ }
+ r.next();
+}
+
+// Numerierungs-Regel
+
+SwNumRule* SwSwgReader::InNumRule()
+{
+ sal_Char eType, nFmt, cFmt[ MAXLEVEL ];
+ r >> eType >> nFmt;
+ // C 8.0 bug:
+ SwNumRuleType eTemp = (SwNumRuleType) eType;
+ SwNumRule* pRule = new SwNumRule( pDoc->GetUniqueNumRuleName(), eTemp );
+ int i;
+ for( i = 0; i < nFmt; i++ )
+ r >> cFmt[ i ];
+ r.next();
+ for( i = 0; r.good() && i < nFmt; i++ )
+ {
+ SwNumFmt aFmt;
+ if( r.cur() != SWG_NUMFMT )
+ {
+ Error(); delete pRule; return NULL;
+ }
+ aFmt.SetBulletFont( NULL );
+ InNumFmt( aFmt );
+ if( !r )
+ {
+ delete pRule; return NULL;
+ }
+ pRule->Set( (USHORT) cFmt[ i ], aFmt );
+ }
+ if( pRule )
+ {
+ if( aHdr.nVersion < SWG_VER_POOLID3 )
+ {
+ static short __READONLY_DATA aOldFI[ 5 ] = { -227, -397, -567, -737, -936 };
+ static short __READONLY_DATA aOldLft[ 5 ] = { 567, 964, 1474, 567*4, 3204 };
+
+ // Alte Dokumente: Fehlende Formate nachtragen
+ for( i = 0; i < MAXLEVEL; i++ )
+ if( !pRule->GetNumFmt( i ) )
+ {
+ SwNumFmt aFmt( pRule->Get( i ) );
+ aFmt.SetIncludeUpperLevels( MAXLEVEL );
+ aFmt.SetAbsLSpace( aOldLft[ i ] );
+ aFmt.SetFirstLineOffset( aOldFI[ i ] );
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ if( i )
+ aFmt.SetSuffix( aEmptyStr );
+ pRule->Set( i, aFmt );
+ }
+ }
+ }
+ return pRule;
+}
+
+// Outline-Numerierung
+
+
+void SwSwgReader::InOutlineRule()
+{
+ SwNumRule* pRule = InNumRule();
+ if( pRule )
+ {
+ pRule->SetName( String::CreateFromAscii(
+ SwNumRule::GetOutlineRuleName() ) );
+ if( aHdr.nVersion < SWG_VER_POOLIDS )
+ {
+ // Alte Dokumente: Fehlende Formate nachtragen
+ for( short i = 0; i < MAXLEVEL; i++ )
+ {
+ if( !pRule->GetNumFmt( i ) )
+ {
+ SwNumFmt aFmt( pRule->Get( i ) );
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ pRule->Set( i, aFmt );
+ }
+ }
+ }
+ pDoc->SetOutlineNumRule( *pRule );
+ delete pRule;
+ }
+}
+
+
+// Numerierungs-Regelwerk
+// Dieses Regelwerk wird nach dem Einlesen der Nodes eingelesen.
+// Zu diesem Zeitpunkt sollte das Index-Array pRules bereits mit den
+// gueltigen Bereichen fuer die Regeln gefuellt sein
+
+// (siehe SwSwgReader::UpdateRuleRange())
+
+void lcl_sw3io__ConvertNumLRSpace( SwTxtNode& rTxtNd, const SwNumRule& rNumRule,
+ BYTE nLevel, BOOL bTabStop );
+
+void SwSwgReader::InTxtNumRule()
+{
+ USHORT n;
+ r >> n;
+ if( n != nRules )
+ {
+ Error(); return;
+ }
+ r.next();
+ for( USHORT i = 0; i < n; i++ )
+ {
+ SwTxtNode* pBgn = pRules[ i ].pBgn;
+ SwTxtNode* pEnd = pRules[ i ].pEnd;
+ if( r.cur() != SWG_NUMRULE || !pBgn )
+ {
+ Error(); return;
+ }
+ // Rules einlesen
+ SwNumRule* pRule = InNumRule();
+ if( !pRule ) break;
+
+ SwPaM aPaM( *pBgn, 0, *pEnd, 0 );
+ SwNodeIndex aBgnIdx( *pBgn );
+ const SwNodeIndex& rEndIdx = aPaM.GetPoint()->nNode;
+ // jetzt noch die Nodes mit den Rules verbinden
+ BYTE nPrevLevel = 0;
+ do {
+ SwTxtNode* pNd = aBgnIdx.GetNode().GetTxtNode();
+ if( pNd )
+ {
+ if( pNd->GetNum() )
+ {
+ SwNodeNum *pNum = (SwNodeNum*) pNd->GetNum();
+
+ //JP 19.03.96: NO_NUM gibt es nicht mehr, dafuer gibts
+ // jetzt NO_NUMLEVEL
+ if( NO_NUM == pNum->GetLevel() )
+ pNum->SetLevel( nPrevLevel | NO_NUMLEVEL );
+ else
+ nPrevLevel = pNum->GetLevel();
+#ifdef NUM_RELSPACE
+ lcl_sw3io__ConvertNumLRSpace( *pNd, *pRule,
+ pNum->GetLevel(), TRUE );
+#endif
+ }
+ else
+ {
+ // Hot fix bei Loechern im Bereich:
+ pNd->UpdateNum( SwNodeNum( nPrevLevel | NO_NUMLEVEL ) );
+ ASSERT( FALSE, "SW/G-Reader: Luecke im NumRule-Bereich!" );
+ }
+ }
+ else
+ {
+ Error(); break;
+ }
+ aBgnIdx += 1;
+ } while( aBgnIdx.GetIndex() <= rEndIdx.GetIndex() );
+
+ pDoc->SetNumRule( aPaM, *pRule );
+ delete pRule;
+ }
+}
+
+// Update des Bereichs einer Numerierungsregel
+
+void SwSwgReader::UpdateRuleRange( USHORT nIdx, SwTxtNode* pNd )
+{
+ // Evtl. den Puffer fuer die NumRules-Bereiche einrichten
+ if( !pRules && aHdr.nNumRules )
+ {
+ nRules = aHdr.nNumRules;
+ pRules = new NumRuleInfo[ nRules ];
+ for( USHORT i = 0; i < nRules; i++ )
+ pRules[ i ].pBgn =
+ pRules[ i ].pEnd = NULL;
+ }
+ if( nIdx >= nRules ) return;
+ // Node-Nummer fuer PaM-SRange updaten:
+ NumRuleInfo* p = &pRules[ nIdx ];
+ if( !p->pBgn )
+ p->pBgn = p->pEnd = pNd;
+ else
+ p->pEnd = pNd;
+}
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdpage.cxx b/binfilter/bf_sw/source/core/swg/sw_rdpage.cxx
new file mode 100644
index 000000000000..4f2777bd240c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdpage.cxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+
+#include <fmtpdsc.hxx>
+#include <fmthdft.hxx>
+
+#include "rdswg.hxx"
+#include "pagedesc.hxx"
+#include "swgpar.hxx" // SWGRD_XXX
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Achtung: Jede Routine nimmt an, dass der Record-Header bereits eingelesen
+// ist. Sie arbeitet den Record so weit ab wie moeglich und schliesst den
+// Vorgang mit end() ab.
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Hinzufuegen eines neuen PageDesc-Links
+
+void SwSwgReader::AddPageDescLink( const String& rName, USHORT nOff )
+{
+ // Eventuell das Flag-Bit setzen,
+ // dass Seitennummern vorkommen
+ // Dies wird fuer aeltere Docs benoetigt
+ if( nOff & 0x7FFF )
+ aFile.nFlags |= SWGF_HAS_PGNUMS,
+ pDoc->SetPageNums();
+ PageDescLink* p = new PageDescLink( rName, nOff );
+ p->pLink = pPageLinks;
+ pPageLinks = p;
+
+}
+
+// Aufloesen aller Seitenbeschreibungs-Links
+
+void SwSwgReader::ResolvePageDescLinks()
+{
+ while( pPageLinks )
+ {
+ PageDescLink* p = pPageLinks;
+ pPageLinks = p->pLink;
+ USHORT nArrLen = pDoc->GetPageDescCnt();
+ USHORT i;
+ for( i = 0; i < nArrLen; i++)
+ {
+ const SwPageDesc& rDesc = pDoc->GetPageDesc( i );
+ if( rDesc.GetName() == String( *p ) )
+ break;
+ }
+ // falls nicht da, Standardlayout nehmen
+ if( i == nArrLen ) i = 0;
+ // Bit 0x8000 im Offset besagt, dass bAuto zu setzen ist
+ SwFmtPageDesc aAttr( &pDoc->GetPageDesc( i ) );
+ aAttr.SetNumOffset( p->nOffset & 0x7FFF );
+ if( p->cFmt )
+ p->pFmt->SetAttr( aAttr );
+ else
+ p->pSet->Put( aAttr );
+ delete p;
+ }
+}
+
+// Suchen einer Seitenbeschreibung
+
+SwPageDesc& SwSwgReader::FindPageDesc( USHORT nIdx )
+{
+ PageDescInfo* pDescs = &pLayIdx[ nIdx ];
+ return pDoc->_GetPageDesc( pDescs->nActualIdx );
+
+}
+
+// Fussnoten-Info
+
+void SwSwgReader::InPageFtnInfo( SwPageFtnInfo& rFtn )
+{
+ long nHeight, nTopDist, nBottomDist, nNum, nDenom;
+ short nAdjust, nPenWidth;
+ r >> nHeight
+ >> nTopDist
+ >> nBottomDist
+ >> nAdjust
+ >> nNum >> nDenom
+ >> nPenWidth;
+ Color aPenColor = InColor();
+ rFtn.SetHeight( (SwTwips) nHeight );
+ rFtn.SetTopDist( (SwTwips) nTopDist );
+ rFtn.SetBottomDist( (SwTwips) nBottomDist );
+ rFtn.SetAdj( (SwFtnAdj) nAdjust );
+ Fraction f( nNum, nDenom );
+ rFtn.SetWidth( f );
+ rFtn.SetLineColor(aPenColor );
+ rFtn.SetLineWidth(nPenWidth );
+ r.next();
+}
+
+// Seiten-Deskriptor
+
+#define FORCEREAD ( SWGRD_PAGEFMTS & SWGRD_FORCE )
+
+void SwSwgReader::InPageDesc( short nIdx )
+{
+ long nextrec = r.getskip();
+ short nFollow, nUsedOn;
+ BYTE bHdrShare, bFtrShare, bLandscape = FALSE;
+ USHORT nPoolId = IDX_NO_VALUE;
+ sal_Char nNumType;
+ String aName;
+
+ if( !r ) return;
+
+ aName = GetText( FALSE );
+ if( ( aHdr.nVersion >= SWG_VER_COMPAT ) && ( r.next() != SWG_DATA ) )
+ {
+ Error(); return;
+ }
+ r >> nFollow >> nNumType >> nUsedOn >> bHdrShare >> bFtrShare;
+ if( aHdr.nVersion >= SWG_VER_COMPAT )
+ {
+ BYTE cFlags;
+ r >> cFlags;
+ if( aHdr.nVersion >= SWG_VER_POOLIDS )
+ r >> nPoolId;
+ // Korrektur fuer aeltere Dokumente
+ if( aHdr.nVersion <= SWG_VER_FRAMES3 )
+ {
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, GET_POOLID_PAGEDESC );
+ if( nPoolId == USHRT_MAX ) nPoolId = IDX_NO_VALUE;
+ }
+ else if( nPoolId < IDX_SPECIAL )
+ // USER-Feld verkleinern
+ nPoolId &= 0xBFFF;
+ r.skip();
+ bLandscape = BOOL( ( cFlags & 0x01 ) != 0 );
+ }
+
+ PageDescInfo* pDescs = pLayIdx;
+ // Ist es eine Poolvorlage und ist diese evtl. bereits eingelesen?
+ // Dann das Pool-ID loeschen
+ if( nPoolId != IDX_NO_VALUE )
+ for( USHORT i = 0; i < nLay; i++, pDescs++ )
+ {
+ if( pDescs->nPoolId == nPoolId )
+ {
+ nPoolId = IDX_NO_VALUE; break;
+ }
+ }
+ pDescs = &pLayIdx[ nIdx ];
+ SwPageDesc* pDesc = NULL;
+ // Ist bei alten Dokumenten der Name ein Poolformatname?
+ if( aHdr.nVersion < SWG_VER_COMPAT )
+ {
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, GET_POOLID_PAGEDESC );
+ if( nPoolId == USHRT_MAX ) nPoolId = IDX_NO_VALUE;
+ }
+ if( nPoolId != IDX_NO_VALUE )
+ {
+ // Es ist eine Pool-Beschreibung. Falls eingefuegt wird,
+ // dann bitte diese Beschreibung verwenden und nix weiter machen
+ if( ( nOptions & FORCEREAD ) != FORCEREAD ) {
+ // Ist sie ueberhaupt da?
+ USHORT nArrLen = pDoc->GetPageDescCnt();
+ USHORT n;
+ for( n = 0; n < nArrLen; n++ )
+ {
+ pDesc = &pDoc->_GetPageDesc( n );
+ if( pDesc->GetPoolFmtId() == nPoolId )
+ {
+ nIdx = n; break;
+ }
+ }
+ if( n < nArrLen )
+ {
+ r.skip( nextrec ); r.next();
+ pDescs->nPoolId = nPoolId;
+ pDescs->nActualIdx = nIdx;
+ pDescs->nFollow = nFollow;
+ // Formate muessen nicht registriert werden,
+ // da Frames nie geladen werden, wenn es sich um das
+ // Einfuegen von Text handelt
+ return;
+ } else pDesc = NULL;
+ } else {
+ // Neues Dokument: PageDesc anfordern und Index finden
+ pDesc = pDoc->GetPageDescFromPool( nPoolId );
+ USHORT nArrLen = pDoc->GetPageDescCnt();
+ USHORT n;
+ for( n = 0; n < nArrLen; n++ )
+ {
+ if( &pDoc->GetPageDesc( n ) == pDesc )
+ {
+ nIdx = n; break;
+ }
+ }
+ ASSERT( n < nArrLen, "Pool-PageDesc nicht gefunden" );
+ }
+ } else {
+ // Keine Poolvorlage:
+ // Gibt es diese Beschreibung bereits?
+ USHORT nArrLen = pDoc->GetPageDescCnt();
+ for( USHORT n = 0; n < nArrLen; n++ )
+ {
+ SwPageDesc& rCur = pDoc->_GetPageDesc( n );
+ if( rCur.GetName() == aName )
+ {
+ // Ueberplaetten von Vorlagen?
+ // Dank eines Bugs von OT koennen Vorlagen mehrfach in
+ // einem Doc vorkommen. Da Seitenvorlagen "by name"
+ // referenziert werden, ist dies fuer den Textteil OK.
+ // Nur die Layout-Infos koennen u.U. baden gehen.
+ if( ( bNew && nIdx != 0 )
+ || ( ( nOptions & FORCEREAD ) != FORCEREAD ) )
+ {
+ // Dann den Index eintragen und abbrechen
+ r.skip( nextrec ); r.next();
+ pDescs->nPoolId = nPoolId;
+ pDescs->nActualIdx = n;
+ pDescs->nFollow = nFollow;
+ // Formate muessen nicht registriert werden,
+ // da Frames nie geladen werden, wenn es sich um das
+ // Einfuegen von Text handelt
+ return;
+ } else {
+ nIdx = n;
+ pDesc = &rCur;
+ break;
+ }
+ }
+ }
+ }
+ if( !pDesc )
+ {
+ nIdx = pDoc->MakePageDesc( aName );
+ pDesc = &pDoc->_GetPageDesc( nIdx );
+ }
+ pDescs->nPoolId = nPoolId;
+ pDescs->nActualIdx = nIdx;
+ pDescs->nFollow = nFollow;
+ SvxNumberType aType;
+ aType.SetNumberingType(nNumType);
+ pDesc->SetNumType( aType );
+// Steckt im UseOn drin
+// pDesc->ChgHeaderShare( BOOL( bHdrShare ) );
+// pDesc->ChgFooterShare( BOOL( bFtrShare ) );
+ pDesc->WriteUseOn( UseOnPage( nUsedOn ) );
+
+ BOOL bDone = FALSE;
+ pDesc->ResetAllMasterAttr();
+ pDesc->ResetAllLeftAttr();
+ r.next();
+ // Header und Footer sind Shared-Formate
+ nStatus |= SWGSTAT_SHAREDFMT;
+ while( !bDone )
+ switch( r.cur() ) {
+ case SWG_FOOTINFO:
+ // Vorsicht: SWG_FOOTINFO kann auch auf dem TopLevel
+ // vorkommen!
+ if( r.tell() > nextrec ) bDone = TRUE;
+ else InPageFtnInfo( pDesc->GetFtnInfo() ); break;
+ case SWG_MASTERFMT:
+ InFormat( &pDesc->GetMaster() );
+ RegisterFmt( pDesc->GetMaster() );
+ break;
+ case SWG_LEFTFMT:
+ InFormat( &pDesc->GetLeft() );
+ RegisterFmt( pDesc->GetLeft() );
+ break;
+ case SWG_JOBSETUP:
+ case SWG_COMMENT:
+ r.skipnext(); break;
+ default:
+ bDone = TRUE;
+ }
+ nStatus &= ~SWGSTAT_SHAREDFMT;
+
+ // ST special: 1 Bit des Masterfmts wird fuer Landscape verwendet!
+ // Dies auch nur bis Version 1.x!
+ if( aHdr.nVersion < SWG_VER_COMPAT )
+ bLandscape = BOOL( nFlagBits & 0x01 );
+ pDesc->SetLandscape( bLandscape );
+ if( nPoolId != IDX_NO_VALUE )
+ pDesc->SetPoolFmtId( nPoolId );
+
+ // Hdr/Ftr-Formate umsetzen:
+ // Gleichzeitig muessen (bei aelteren Dateien) die vorher
+ // eingelesenen Left-Hdr/Ftr-Formate neu registriert werden,
+ // damit die Frame-Leseroutinen den rechten Bezug haben.
+ // Die erste Frame-Version darf gar nicht mehr laden, da die Content-
+ // Section des ueberbratenen Formats verschwindet!
+ if( pDesc->IsHeaderShared() )
+ {
+ const SwFmtHeader& rFmtM = pDesc->GetMaster().GetHeader();
+ const SwFmtHeader& rFmtL = pDesc->GetLeft().GetHeader();
+ const SwFmt* pFmt1 = rFmtL.GetHeaderFmt();
+ const SwFmt* pFmt2 = rFmtM.GetHeaderFmt();
+ if( pFmt1 && pFmt2 )
+ ReRegisterFmt( *pFmt1, *pFmt2 );
+ pDesc->GetLeft().SetAttr( rFmtM );
+ }
+ if( pDesc->IsFooterShared() )
+ {
+ const SwFmtFooter& rFmtM = pDesc->GetMaster().GetFooter();
+ const SwFmtFooter& rFmtL = pDesc->GetLeft().GetFooter();
+ const SwFmt* pFmt1 = rFmtL.GetFooterFmt();
+ const SwFmt* pFmt2 = rFmtM.GetFooterFmt();
+ if( pFmt1 && pFmt2 )
+ ReRegisterFmt( *pFmt1, *pFmt2 );
+ pDesc->GetLeft().SetAttr( rFmtM );
+ }
+}
+
+
+void SwSwgReader::InPageDescs()
+{
+ USHORT nDesc;
+ r >> nDesc;
+ r.next();
+ if( nDesc > 0 )
+ {
+ nLay = nDesc;
+ PageDescInfo* p =
+ pLayIdx = new PageDescInfo[ nDesc ];
+ // einlesen
+ USHORT i;
+ for( i = 0; i < nDesc && r.good(); i++, p++ )
+ {
+ p->nActualIdx = 0;
+ p->nPoolId =
+ p->nFollow = IDX_NO_VALUE;
+ }
+ for( i = 0; i < nDesc && r.good(); i++ )
+ InPageDesc( i );
+ // Follows aufloesen
+ p = pLayIdx;
+ for( i = 0; i < nDesc; i++, p++ )
+ {
+ if( p->nFollow != IDX_NO_VALUE )
+ {
+ SwPageDesc& rDesc = pDoc->_GetPageDesc( p->nActualIdx );
+ rDesc.SetFollow
+ ( &pDoc->GetPageDesc( LayoutIdx( p->nFollow ) ) );
+ }
+ }
+ }
+ else Error();
+}
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdswg.cxx b/binfilter/bf_sw/source/core/swg/sw_rdswg.cxx
new file mode 100644
index 000000000000..427642030211
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdswg.cxx
@@ -0,0 +1,606 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+#include <bf_sfx2/docinf.hxx>
+#include <bf_svx/fontitem.hxx>
+
+#include <fmtpdsc.hxx>
+#include <rdswg.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx> // Zeichen-Konversion
+#include <pagedesc.hxx>
+#include <swgpar.hxx> // SWGRD_xxx-Flags
+#include <frmids.hxx>
+#include <mdiexp.hxx> // Progress
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pam.hxx>
+#include <poolfmt.hxx>
+
+#include <swerror.h>
+#include <statstr.hrc>
+namespace binfilter {
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+// CodeSet-Konvertierung ab Version 22:
+
+//////////////////////////////////////////////////////////////////////////////
+
+ SwSwgReader::SwSwgReader
+ ( SwDoc *pSwDoc, const SwPaM* pSwPaM, SvStream& rStream,
+ const String& rFileName, BOOL bNewDoc )
+ : pDoc( pSwDoc ), r( rStream ), aFileName( rFileName ), bNew(bNewDoc),
+ pNdOrigTxt( 0 )
+ {
+ nCntntCol = 0;
+ nErrno = 0;
+ pCollIdx = NULL;
+ pLayIdx = NULL;
+ pFmts = NULL;
+ pPageLinks = NULL;
+ pRules = NULL;
+ pFrms = NULL;
+ pSects = NULL;
+ pLastSect = NULL;
+ pLanguages = NULL;
+ pTables = NULL;
+ nColl =
+ nLay =
+ nNamedFmt =
+ nFrm =
+ nFrmSize =
+ nSect =
+ nSectSize =
+ nTbl =
+ nTblSize =
+ nRules =
+ nLang =
+ nLangSize =
+ nFmtLvl =
+ nStatus = 0;
+ nTblBoxLvl = -1;
+ nDocStart = r.tell();
+ nOptions =
+ nFrmFlags =
+ nFlyLevel =
+ nPage1 =
+ nFlagBits = 0;
+ nHelpFileId= UCHAR_MAX;
+ nNextDoc = 0;
+ pPaM = NULL;
+ pUpper = NULL;
+ pMaster = NULL;
+ pInfo = new SfxDocumentInfo;
+
+ eStartNodeType = SwNormalStartNode;
+
+ if( pSwPaM )
+ {
+ pPaM = new SwPaM( *pSwPaM->GetPoint() );
+ SwTxtNode *pTxtNode = pPaM->GetNode()->GetTxtNode();
+
+ // Ist das ein SwPaM auf einen TextNode?
+ if( !pTxtNode )
+ {
+ // Ist keiner, dann machen wir uns einen
+ pTxtNode=pDoc->GetNodes().MakeTxtNode(pPaM->GetPoint()->nNode,
+ (SwTxtFmtColl*) pDoc->GetDfltTxtFmtColl() );
+ // Da zeigt jetzt auch der StartIdx hin
+ pPaM->GetPoint()->nNode-=1;
+ }
+ if( !bNewDoc ) nPage1 = pPaM->GetPageNum() - 1;
+ }
+ }
+
+ SwSwgReader::~SwSwgReader()
+ {
+ while( pPageLinks )
+ {
+ PageDescLink* p = pPageLinks->pLink;
+ delete pPageLinks;
+ pPageLinks = p;
+ }
+ delete pInfo;
+ delete pFmts;
+ delete pFrms;
+ delete pCollIdx;
+ delete pLayIdx;
+ delete pRules;
+ delete pSects;
+ delete pLanguages;
+ delete pPaM;
+ delete pTables;
+ }
+
+BOOL SwSwgReader::CheckPasswd( const String& rPass )
+{
+ return r.setpasswd( rPass ) &&
+ BOOL( memcmp( aFile.cPasswd, r.getpasswd(), PASSWDLEN ) == 0 );
+}
+
+ void SwSwgReader::Error( ULONG nCode )
+ {
+ ASSERT( !this, "Formatfehler in Datei entdeckt" );
+ nErrno = nCode ? (nCode | ERROR_SW_READ_BASE ) : ERR_SWG_FILE_FORMAT_ERROR;
+ r.setbad();
+ }
+
+ short SwSwgReader::LayoutIdx( short n )
+ {
+ return( pLayIdx && (USHORT) n < nLay ) ? pLayIdx[ n ].nActualIdx : 0;
+ }
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Laden des Dateikopfes
+// Vor Version 0x0011 wird nur die Signatur gelesen.
+
+ void SwSwgReader::LoadFileHeader()
+ {
+ memset( &aFile, 0, sizeof aFile );
+ r.seek ( 0 );
+ r.get( &aFile.nSignature, 4 );
+ // Eine Textbausteindatei darf auch leer sein
+ if( r.eof() )
+ {
+ // in diesem Fall den Header initialisieren
+ memset( &aFile, 0, sizeof aFile );
+ memcpy( &aFile.nSignature, SWG_SIGNATURE, 4 );
+ aFile.nVersion = SWG_VERSION;
+ return;
+ }
+ // Die Signatur sollte schon stimmen!!!
+ // Aber bittte nur die ersten drei Zeichen, um nicht abwaertskompatible
+ // Versionen erkennen zu koennen.
+ else if( memcmp( ( const void*) &aFile.nSignature, SWG_SIGNATURE, 3 ) )
+ {
+ Error(); return;
+ }
+
+ r.long4();
+ r >> aFile.nVersion
+ >> aFile.nFlags
+ >> aFile.nFree1
+ >> aFile.nDocInfo;
+ r.get( aFile.cPasswd, 16 );
+ r.long3();
+ // Passwort in Stream eintragen
+ if( aFile.nFlags & SWGF_HAS_PASSWD )
+ r.copypasswd( aFile.cPasswd );
+ //MA Erstmal abklemmen!!!!!!!!!!!!!!!!!!!!!!
+ //JP 12.09.96: Bug 31264 - zum PageDesc Abpruefen brauchen wir das Flag aber
+ //MIB: there is no flag to not load the layout any longer, it is loaded always.
+ // aFile.nFlags |= SWGF_NO_FRAMES;
+ r.seek ( 0 );
+ LoadDocInfo( *pInfo );
+ r.seek ( 0x20 );
+ if( pDoc )
+ {
+ if( aFile.nFlags & SWGF_HAS_PGNUMS ) pDoc->SetPageNums();
+ }
+ }
+
+// Laden der Header-Informationen
+// Ab Version 0x0011 ist der Header Bestandtail eines SWG_DOCUMENT-Records.
+// Die Position zeigt auf den Beginn der Infos, also entweder hinter die
+// Version (s.o.) oder auf den Beginn des SWG_DOCUMENT-Records.
+
+ void SwSwgReader::LoadHeader()
+ {
+ memset( &aHdr, 0, sizeof aHdr );
+ r.next();
+ // Evtl. den Dynamischen DocInfo-Record auch skippen
+ nNextDoc = r.getskip();
+ // Achtung: Es gibt tatsaechlich Docs, die hier was unsinniges haben!
+ long siz = r.filesize();
+ if( nNextDoc < 0 || nNextDoc > siz )
+ nNextDoc = siz;
+ r.skip();
+ if( r.next() == SWG_DYNDOCINFO )
+ nNextDoc = r.getskip();
+ r.seek( nDocStart );
+ r.next();
+ r >> aHdr.nFlags
+ >> aHdr.nVersion;
+ r.get( aHdr.cAttrTab, 8 );
+ r.get( aHdr.cAttrSiz, 8 );
+ r.long4();
+ r >> aHdr.cCodeSet
+ >> aHdr.nNumRules
+ >> aHdr.nDocVersion
+ >> aHdr.cGUIType
+ >> aHdr.cReserved[ 0 ]
+ >> aHdr.cReserved[ 1 ]
+ >> aHdr.cReserved[ 2 ]
+ >> aHdr.nDocInfoOffset
+ >> aHdr.nLayoutOffset
+ >> aHdr.nDate
+ >> aHdr.nTime;
+ r.long3();
+ if( aHdr.nDocInfoOffset ) aHdr.nDocInfoOffset += nDocStart;
+ if( aHdr.nLayoutOffset ) aHdr.nLayoutOffset += nDocStart;
+ nRecStart = r.tell();
+
+ // Hot fix fuer Tesxtbausteine, wo der DocInfo-Ptr im Dateikopf
+ // verlorengegangen ist (Bugid 4955): Ptr aus Dokument-Hdr
+ // restaurieren
+ if( !aFile.nDocInfo ) aFile.nDocInfo = aHdr.nDocInfoOffset + 8;
+ }
+
+// Einlesen eines Strings mit Check und Konvertierung
+
+ String SwSwgReader::GetText( BOOL bReq )
+ {
+ String aRes;
+ if( r.next() != SWG_TEXT )
+ {
+ if( bReq )
+ Error();
+ else
+ r.undonext();
+ } else
+ aRes = ParseText();
+ return aRes;
+ }
+
+ByteString SwSwgReader::GetAsciiText( BOOL bReq )
+{
+ ByteString aRes;
+ if( r.next() != SWG_TEXT )
+ {
+ if( bReq )
+ Error();
+ else
+ r.undonext();
+ } else
+ aRes = r.text();
+ return aRes;
+}
+
+// Einlesen und Konvertierung eines Strings in den Native-Zeichensatz
+// Der Record-Header SWG_TEXT ist bereits eingelesen
+
+ String SwSwgReader::ParseText()
+ {
+ String aOrig( r.text(), (rtl_TextEncoding)aHdr.cCodeSet );
+ return aOrig;
+ }
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+ void _ReadFrm_Rect( swistream& r )
+ {
+ BYTE sizes;
+ r >> sizes;
+ int nSkip = 0;
+ for( USHORT i = 0; i < 4; i++, sizes <<= 2 )
+ {
+ switch( sizes & 0xC0 )
+ {
+ case 0x40:
+ nSkip += 2;
+ break;
+ case 0x80:
+ nSkip += 3;
+ break;
+ case 0xC0:
+ nSkip += 4;
+ break;
+ }
+ }
+ r.seek( r.tell() + nSkip );
+ }
+
+ void _ReadFrm_LayFrm( swistream& r, USHORT nVersion )
+ {
+ BYTE nB, nFrmFlag;
+ USHORT nU;
+
+ // Byte vom Frm
+ r >> nFrmFlag >> nB;
+ if( nVersion >= FRMVER_EXTINFO && ( nB & 0x80 ) )
+ r >> nB;
+ if( nVersion >= FRMVER_EXTINFO )
+ // Eventuelle Zusatz-Bits entfernen
+ while( nB & 0x80 ) r >> nB;
+
+ // Frame-Rect einlesen (mit Addieren des Upper-Starts, falls vorhanden)
+ _ReadFrm_Rect( r );
+ if( nFrmFlag & FRMF_PRINT )
+ _ReadFrm_Rect( r );
+
+ // Dann Frame-ID eintragen
+ // Version 1 hatte FRMF_HASID nicht bei FRMF_HASFOLLOW gesetzt
+ if( nFrmFlag & ( FRMF_HASFOLLOW | FRMF_HASID ) )
+ r >> nU;
+ if( nFrmFlag & FRMF_ISFOLLOW )
+ r >> nU;
+
+ // Byte vom LayoutFrm
+ r >> nU;
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Der Returnwert ist der errno-Fehlercode
+
+ ULONG SwSwgReader::Read( USHORT nOpt )
+ {
+ nOptions = nOpt;
+ if( !pPaM
+ || ( aFile.nVersion < SWG_VER_PORTGRF )
+ || ( aFile.nFlags & SWGF_BAD_FILE ) )
+ return ERR_SWG_READ_ERROR;
+
+ nDocStart = r.tell();
+
+ nErrno = 0;
+ USHORT nInsFirstPara = 0;
+ {
+ SwTxtNode *pTxtNode=pDoc->GetNodes()[pPaM->GetPoint()->nNode]->GetTxtNode();
+ // Ist das ein SwPaM auf einen TextNode?
+ if( pTxtNode && pTxtNode->GetTxt().Len() )
+ nInsFirstPara = 1;
+ }
+
+ LoadHeader();
+
+ // Den Vorlagen-Namen aus der DocInfo am Doc registrieren,
+ // falls ueberhaupt einer da ist
+ if( pInfo->GetTemplateName().Len() )
+ nHelpFileId = pDoc->SetDocPattern( pInfo->GetTemplateName() );
+
+ // Es wird angenommen, dass das Layout 5% der Ladezeit belegt.
+ long nEnd = aHdr.nLayoutOffset ? aHdr.nLayoutOffset : nNextDoc;
+ nEnd = ( nEnd * 105 ) / 100;
+
+ // Default-Collection registrieren
+ SwTxtFmtColl* pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+ pColl->nFmtId = IDX_COLLECTION + 0;
+ RegisterFmt( *pColl );
+
+ // Erst einmal die Link-Optionen weg
+ nOptions &= 0xF0FF;
+
+ // Auf gehts:
+ BOOL bDone = FALSE;
+ BOOL bNode1 = TRUE;
+ r.next();
+ while( !bDone && r.good() && !IsError( nErrno ) && ( r.tell() < nNextDoc ) )
+ {
+ BYTE ch = r.cur();
+ switch( (int) ch ) {
+ case SWG_EOF:
+ if( ( nOptions == SWGRD_NORMAL )
+ && ( r.next() == (BYTE) SWG_DOCINFO ) )
+ InDocInfo();
+ bDone = TRUE; break;
+ case SWG_DOCINFO:
+ InDocInfo(); r.next(); break;
+ case SWG_NAMEDFMTS:
+ InNamedFmts( nOptions );
+ break;
+ case SWG_JOBSETUP:
+ case SWG_NEWJOBSETUP:
+ if( nOptions == SWGRD_NORMAL ) InJobSetup();
+ else r.skipnext();
+ break;
+ case SWG_OUTLINE:
+ if( nOptions == SWGRD_NORMAL )
+ InOutlineRule();
+ else r.skipnext();
+ break;
+ case SWG_NUMRULES:
+ if( nOptions == SWGRD_NORMAL )
+ InTxtNumRule();
+ else r.skipnext();
+ break;
+ case SWG_MACROTBL:
+ if( nOptions & SWGRD_MACROS )
+ {
+ InGlobalMacroTbl();
+ if( nOptions == SWGRD_MACROS ) bDone = TRUE;
+ } else r.skipnext();
+ break;
+ case SWG_LAYOUT:
+ if( nOptions & SWGRD_PAGEFMTS )
+ {
+ InPageDescs();
+ if( nOptions == SWGRD_PAGEFMTS ) bDone = TRUE;
+ } else r.skipnext();
+ break;
+ case SWG_DFLTFMTS:
+ if( nOptions & SWGRD_PARAFMTS ) InDfltFmts();
+ else r.skipnext();
+ break;
+ case SWG_FIELDTYPES:
+ if( nOptions == SWGRD_NORMAL ) InFieldTypes();
+ else r.skipnext();
+ break;
+ case SWG_COLLECTIONS:
+ if( nOptions & SWGRD_PARAFMTS ) InTxtFmtColls();
+ else r.skipnext();
+ break;
+ case SWG_FLYFRAMES:
+ if( nOptions == SWGRD_NORMAL ) InFlyFrames( NULL );
+ else r.skipnext();
+ break;
+ case SWG_FOOTINFO:
+ // globale Fussnoten-Info
+ if( nOptions == SWGRD_NORMAL ) InFtnInfo();
+ else r.skipnext();
+ break;
+ case SWG_CONTENTS:
+ if( nOptions == SWGRD_NORMAL )
+ InContents( bNode1, FALSE, nInsFirstPara );
+ else
+ r.skipnext();
+ nInsFirstPara = 0; bNode1 = FALSE;
+ break;
+ case SWG_FRAMES:
+
+ if( !( aFile.nFlags & SWGF_NO_FRAMES )
+ && bNew && ( nOptions == SWGRD_NORMAL ) )
+ {
+ // Offene Seitenbeschreibungen in Formaten aufloesen
+ // (falls noch nicht geschehen)
+ ResolvePageDescLinks();
+
+ // Teste ob das Layout auf der 1. Seite einen anderen
+ // PageDesc definiert hat das Doc. Dann nehme den aus
+ // dem Layout! Bug 31264
+ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 1 );
+ SwCntntNode* pCNd = pDoc->GetNodes().GoNext( &aIdx );
+ if( pCNd && SFX_ITEM_SET != pCNd->GetSwAttrSet().
+ GetItemState(RES_PAGEDESC) && !pCNd->FindTableNode())
+ {
+ // es ist keiner gesetzt, dann muss das Layout auch
+ // der Meinung sein, den Standard zu benutzen!
+ USHORT nVersion;
+ r >> nVersion;
+ if( nVersion >= FRMVER_NEWFLY )
+ {
+ USHORT nU;
+ BYTE nId;
+ r >> nId;
+ if( FRMID_ROOT == nId )
+ {
+ _ReadFrm_LayFrm( r, nVersion );
+ r >> nId
+ >> nU; // in nU sollte die Seiten stehen!
+ if( nU )
+ {
+ r >> nId;
+ if( FRMID_PAGE == nId )
+ {
+ _ReadFrm_LayFrm( r, nVersion );
+ r >> nId >> nU;
+ // in nU steht der gesuchte PageDesc!
+ SwPageDesc* pDesc = &FindPageDesc( nU );
+ if( pDesc && pDesc != &pDoc->_GetPageDesc( 0 ) )
+ {
+ // dann am Node setzen!!
+ pCNd->SetAttr( SwFmtPageDesc( pDesc ) );
+ ASSERT( !this, "LayoutPageDesc am Doc setzen" );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ r.skipnext();
+ break;
+ case SWG_COMMENT:
+ InComment(); break;
+ default:
+ r.skipnext();
+ }
+ }
+
+ // Offene Seitenbeschreibungen in Formaten aufloesen
+ // (falls noch nicht geschehen)
+ ResolvePageDescLinks();
+ // Bug 9714: Der CharSet an den Fonts muss geaendert werden, wenn
+ // es der globale CharSet ist
+ USHORT nMaxItems = pDoc->GetAttrPool().GetItemCount( RES_CHRATR_FONT );
+ rtl_TextEncoding eSysCharSet = gsl_getSystemTextEncoding();
+ SvxFontItem* pItem;
+ for( USHORT n = 0; n < nMaxItems; ++n )
+ {
+ pItem = (SvxFontItem*) pDoc->GetAttrPool().GetItem( RES_CHRATR_FONT, n );
+ if( pItem && pItem->GetCharSet() == (rtl_TextEncoding)aHdr.cCodeSet )
+ pItem->GetCharSet() = eSysCharSet;
+ }
+ ClearFmtIds();
+ if( !IsError( nErrno ) )
+ {
+ pDoc->SetGlossDoc( BOOL( ( aFile.nFlags & SWGF_HAS_BLOCKS ) != 0 ) );
+ if( aFile.nVersion > SWG_VERSION )
+ nErrno = WARN_SWG_FEATURES_LOST | WARN_SW_READ_BASE;
+ }
+
+//STRIP001 EndProgress( pDoc->GetDocShell() );
+
+ // Expr-Felder in Shared-Formaten?
+ // if( nStatus & SWGSTAT_UPDATEEXPR )
+ // pDoc->SetUpdateExpFldStat();
+ if( !IsError( nErrno ))
+ {
+ if( nOptions == SWGRD_NORMAL )
+ {
+ // Neues Doc gelesen
+ if( bNew )
+ pDoc->SetLoaded( TRUE );
+ }
+ else
+ {
+ // Nachladen von Vorlagen etc.
+
+ // falls wir die OutlineLevel veraendert haben (Volagen geladen),
+ // dann muss am Doc ein Update auf die neuen Nummern erfolgen !!
+ if( (SWGRD_FORCE & nOptions) && pDoc->GetOutlineNumRule() )
+ pDoc->SetOutlineNumRule( *pDoc->GetOutlineNumRule() );
+
+ pDoc->SetModified();
+ }
+ }
+ if( bNew )
+ pDoc->SetInfo( *pInfo );
+ pDoc->SetNewDoc( FALSE );
+ return nErrno;
+ }
+
+// Einlesen einer Textblock-Datei
+// Hier wird alles ausser dem Inhalt eingelesen.
+// Der Inhalt wird nach SWG_TEXTBLOCK-Records durchsucht.
+// Dabei werden in allen Textbloecken die Referenzzaehler fuer Formate
+// inkrementiert.
+
+// Ansonsten ist die Funktion analog zu Read().
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_rdtox.cxx b/binfilter/bf_sw/source/core/swg/sw_rdtox.cxx
new file mode 100644
index 000000000000..881534b49de4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_rdtox.cxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <pam.hxx>
+#include <rdswg.hxx>
+#include <doctxm.hxx>
+#include <swerror.h>
+#include <poolfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+// Achtung: Jede Routine nimmt an, dass der Record-Header bereits eingelesen
+// ist. Sie arbeitet den Record so weit ab wie moeglich und schliesst den
+// Vorgang mit end() ab.
+
+//////////////////////////////////////////////////////////////////////////////
+
+SwTOXBase* SwSwgReader::InTOXBase()
+{
+ // Den TOXtype einlesen
+ BYTE eType;
+ r >> eType;
+ String aName( GetText() );
+ if( !r ) return NULL;
+ TOXTypes eTOXType = (TOXTypes) eType;
+ // nach dem TOXType suchen
+ USHORT nTOXType = pDoc->GetTOXTypeCount( eTOXType );
+ const SwTOXType* pTOXType = NULL;
+ for( USHORT n = 0; n < nTOXType; n++ )
+ {
+ const SwTOXType* p = pDoc->GetTOXType( eTOXType, n );
+ if( p->GetTypeName() == aName )
+ {
+ pTOXType = p; break;
+ }
+ }
+ // Falls nicht vorhanden, am Dokument einfuegen
+ if( !pTOXType )
+ {
+ pDoc->InsertTOXType( SwTOXType ( eTOXType, aName ) );
+ pTOXType = pDoc->GetTOXType( eTOXType, nTOXType );
+ }
+ // jetzt muss er da sein!
+ if( !pTOXType )
+ {
+ Error(); return NULL;
+ }
+ // Die Variablen einlesen
+ USHORT nCreaType;
+ r >> nCreaType;
+ String aTitle( GetText() );
+ if( !r ) return NULL;
+ // Die SwForm einlesen
+ BYTE nPat, nTmpl;
+ r >> nPat >> nTmpl;
+ SwForm aForm(eType);
+ if( nPat )
+ {
+ for( USHORT i = 0; i < nPat; i++ )
+ {
+ String aText( GetText() );
+ if ( !r ) return NULL;
+ if( aText.Len() )
+ aText = SwForm::ConvertPatternFrom51( aText, eTOXType );
+ if( i < aForm.GetFormMax() )
+ aForm.SetPattern( i, aText );
+ }
+ }
+ if( nTmpl )
+ {
+ for( USHORT i = 0; i < nTmpl; i++ )
+ {
+ String aText( GetText() );
+ if ( !r ) return NULL;
+ if( i < aForm.GetFormMax() )
+ {
+ if( !aText.Len() )
+ {
+ // Bug 37672: falls keiner gefunden wird, nehme
+ // die defaults
+ USHORT nPoolIdOffset = 0;
+ switch( eType )
+ {
+ case TOX_INDEX:
+ nPoolIdOffset = RES_POOLCOLL_TOX_IDXH -
+ RES_POOLCOLL_REGISTER_BEGIN;
+ break;
+ case TOX_CONTENT:
+ if( 6 > i )
+ nPoolIdOffset = RES_POOLCOLL_TOX_CNTNTH -
+ RES_POOLCOLL_REGISTER_BEGIN;
+ else
+ nPoolIdOffset = RES_POOLCOLL_TOX_CNTNT6 - 6 -
+ RES_POOLCOLL_REGISTER_BEGIN;
+ break;
+ case TOX_USER:
+ nPoolIdOffset = RES_POOLCOLL_TOX_USERH -
+ RES_POOLCOLL_REGISTER_BEGIN;
+ break;
+ }
+
+ aText = *SwStyleNameMapper::GetRegisterUINameArray()[ nPoolIdOffset + i ];
+ }
+ aForm.SetTemplate( i, aText );
+ }
+ }
+ }
+
+ //fill tab stop positions into the patterns
+ aForm.AdjustTabStops(*pDoc);
+
+ SwTOXBase* pBase = new SwTOXBase( pTOXType, aForm, nCreaType, aTitle );
+ pBase->SetTOXName( pDoc->GetUniqueTOXBaseName( *pTOXType ) );
+ // Zuletzt noch die Spezial-Variablen
+ switch( eType )
+ {
+ case TOX_INDEX: {
+ USHORT nOptions;
+ r >> nOptions;
+ pBase->SetOptions( nOptions );
+ } break;
+ case TOX_CONTENT: {
+ USHORT nLevel;
+ r >> nLevel;
+ pBase->SetLevel( nLevel );
+ } break;
+ case TOX_USER:
+ aName = GetText();
+ pBase->SetTemplateName( aName );
+ break;
+ }
+ if( !r )
+ {
+ delete pBase; return NULL;
+ }
+ return pBase;
+}
+
+// Verzeichnis-Block
+
+void SwSwgReader::InTOX( SwNodeIndex& rPos, SwTxtNode* pNd )
+{
+ if( r.next() != SWG_TOXDESC )
+ Error();
+ else
+ {
+ long nSkip = 0;
+ if( aHdr.nVersion >= SWG_VER_TOXDATA ) {
+ if( r.next() != SWG_DATA ) {
+ Error(); return;
+ }
+ nSkip = r.getskip();
+ }
+ SwTOXBase* pBase = InTOXBase();
+ if( !pBase ) return;
+ BOOL bInLastNode = FALSE;
+ USHORT nOff1 = 0, nOff2 = 0;
+ if( nSkip ) {
+ // Neu ab Version 2.06: Anfangs- und Endbereich
+ // Des TOX-Bereichs einlesen
+ r >> bInLastNode >> nOff1 >> nOff2;
+ r.skip( nSkip );
+ }
+
+ r.next();
+ ULONG nStart = rPos.GetIndex();
+ // Im Gegensatz zu einer Section wird dieser Text nicht als eigene
+ // Section, sondern als ganz normaler Text verstanden.
+ USHORT nNodes;
+ r >> nNodes;
+ r.next();
+ for( USHORT i = 1; i <= nNodes && r.good(); i++)
+ {
+ switch( r.cur() )
+ {
+ case SWG_TEXTNODE:
+ FillTxtNode( pNd, rPos, 0 );
+ break;
+ case SWG_GRFNODE:
+ InGrfNode( rPos );
+ break;
+ case SWG_OLENODE:
+ InOleNode( rPos );
+ break;
+ case SWG_TABLE:
+ InTable( rPos );
+ break;
+ default:
+ // unbekannte Nodes
+ r.skipnext();
+ }
+ pNd = NULL;
+ }
+ // Den TOX aufspannen, falls da was ist
+ // der PaM steht jetzt auf dem letzten eingelesenen Node
+ BOOL bRes = TRUE;
+ ULONG nEnd = rPos.GetIndex() - 1;
+ if( bInLastNode ) nStart--;
+ if( nStart <= nEnd )
+ bRes = 0 != pDoc->InsertTableOf( nStart, nEnd, *pBase );
+ delete pBase;
+ if( !bRes && !bNew )
+ Error( ERR_SWG_INTERNAL_ERROR );
+ }
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_swgpar.cxx b/binfilter/bf_sw/source/core/swg/sw_swgpar.cxx
new file mode 100644
index 000000000000..d03b7cec0ec8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_swgpar.cxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "swtypes.hxx"
+
+#include "rdswg.hxx"
+#include "swgpar.hxx"
+namespace binfilter {
+
+/////////////////////////////////////////////////////////////////////////
+
+SwSwgParser::SwSwgParser( SwDoc *pSwDoc, const SwPaM* pSwPaM,
+ SvStream *pIstream, const String& rFileName, BOOL bNewDoc )
+{
+ pRdr = new SwSwgReader( pSwDoc, pSwPaM, *pIstream, rFileName, bNewDoc );
+ pRdr->LoadFileHeader();
+}
+
+SwSwgParser::SwSwgParser( SvStream *pIstream )
+{
+ pRdr = new SwSwgReader( NULL, NULL, *pIstream, aEmptyStr, TRUE );
+ pRdr->LoadFileHeader();
+}
+
+SwSwgParser::~SwSwgParser()
+{
+ delete pRdr;
+}
+
+
+ULONG SwSwgParser::CallParser( USHORT nOptions )
+{
+ return pRdr->Read( nOptions );
+}
+
+BOOL SwSwgParser::NeedsPasswd()
+{
+ return pRdr->GetError()
+ ? FALSE
+ : BOOL( ( pRdr->aFile.nFlags & SWGF_HAS_PASSWD ) != 0 );
+}
+
+BOOL SwSwgParser::CheckPasswd( const String& rStr )
+{
+ return pRdr->GetError() ? FALSE : pRdr->CheckPasswd( rStr );
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/sw_swgstr.cxx b/binfilter/bf_sw/source/core/swg/sw_swgstr.cxx
new file mode 100644
index 000000000000..bd3fcee240a5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/sw_swgstr.cxx
@@ -0,0 +1,256 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <string.h>
+// auto strip #include "segmentc.hxx"
+
+#include "swgstr.hxx"
+#include "swgids.hxx"
+namespace binfilter {
+
+#define BUFSIZE 4096 // Groesse des Datenpuffers
+
+/////////////////////////// class swstream ////////////////////////////////
+
+// Diese Klasse stellt nur die Passwort-Funktionalitaet zur Verfuegung.
+
+ swcrypter::swcrypter()
+ {
+ bPasswd = FALSE;
+ memset( cPasswd, 0, PASSWDLEN );
+ }
+
+ BOOL swcrypter::setpasswd( const String& rP )
+ {
+ // Dies sind Randomwerte, die konstant zur Verschluesselung
+ // des Passworts verwendet werden.
+ static BYTE __READONLY_DATA cEncode[] =
+ { 0xAB, 0x9E, 0x43, 0x05, 0x38, 0x12, 0x4d, 0x44,
+ 0xD5, 0x7e, 0xe3, 0x84, 0x98, 0x23, 0x3f, 0xba };
+
+ bPasswd = TRUE;
+ xub_StrLen len = rP.Len();
+ if( len > PASSWDLEN ) len = PASSWDLEN;
+ memcpy( cPasswd, cEncode, PASSWDLEN );
+ sal_Char cBuf[ PASSWDLEN ];
+ memset( cBuf, ' ', PASSWDLEN );
+ // before unicode: memcpy( cBuf, p, len );
+ for( xub_StrLen i=0; i < len; i++ )
+ {
+ sal_Unicode c = rP.GetChar( i );
+ if( c > 255 )
+ return FALSE;
+ cBuf[i] = (sal_Char)c;
+ }
+ encode( cBuf, PASSWDLEN );
+ memcpy( cPasswd, cBuf, PASSWDLEN );
+
+ return TRUE;
+ }
+
+ void swcrypter::copypasswd( const sal_Char* p )
+ {
+ memcpy( cPasswd, p, PASSWDLEN );
+ bPasswd = TRUE;
+ }
+
+ void swcrypter::encode( sal_Char* pSrc, USHORT nLen )
+ {
+ USHORT nCryptPtr = 0;
+ BYTE cBuf[ PASSWDLEN ];
+ memcpy( cBuf, cPasswd, PASSWDLEN );
+ BYTE* p = cBuf;
+
+ while( nLen-- )
+ {
+ *pSrc = *pSrc ^ ( *p ^ (BYTE) ( cBuf[ 0 ] * nCryptPtr ) );
+ *p += ( nCryptPtr < (PASSWDLEN-1) ) ? *(p+1) : cBuf[ 0 ];
+ if( !*p ) *p += 1;
+ p++;
+ if( ++nCryptPtr >= PASSWDLEN ) nCryptPtr = 0, p = cBuf;
+ pSrc++;
+ }
+ }
+
+/////////////////////////// class swstreambase /////////////////////////////
+
+// Diese Klasse stellt einen dynamischen Puffer zur Verfuegung,
+// der fuer das Einlesen von Texten verwendet wird.
+
+swstreambase::swstreambase( SvStream& r ) : pStrm( &r )
+{
+ pStrm->SetBufferSize( BUFSIZE );
+ pStrm->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+ pBuf = new sal_Char [128];
+ nBuflen = 128;
+ nLong = 3;
+ bTempStrm = FALSE;
+}
+
+swstreambase::~swstreambase()
+{
+ delete pBuf;
+ if( bTempStrm ) delete pStrm;
+}
+
+void swstreambase::checkbuf( USHORT n )
+{
+ if( n > nBuflen ) {
+ n = ( ( n + 127 ) / 128 ) * 128;
+ if( n == 0 ) n = 0xFFFF;
+ delete pBuf;
+ pBuf = new sal_Char[ n ];
+ nBuflen = n;
+ }
+}
+
+BYTE swstreambase::get()
+{
+ BYTE c = 0;
+ pStrm->Read( (sal_Char*) &c, 1 );
+ return c;
+}
+
+void swstreambase::setbad()
+{
+ pStrm->SetError( SVSTREAM_GENERALERROR );
+}
+
+long swstreambase::filesize()
+{
+ long cur = pStrm->Tell();
+ long siz = pStrm->Seek( STREAM_SEEK_TO_END );
+ pStrm->Seek( cur );
+ return siz;
+}
+
+// E/A fuer longs als 3-Byte-Zahlen
+
+swstreambase& swstreambase::operator>>( long& n )
+{
+ BYTE c[ 4 ];
+ pStrm->Read( (sal_Char*) &c, nLong );
+ n = c[ 0 ]
+ + (long) (USHORT) ( c[ 1 ] << 8 )
+ + ( (long) c[ 2 ] << 16 );
+ if( nLong == 4 )
+ {
+ n += (long) c[ 3 ] << 24;
+ if ( ( sizeof( long ) > 4 ) && ( c[ 3 ] & 0x80 ) )
+ // Vorzeichenerweiterung!
+ n |= ~0xFFFFFFFFL;
+ } else if( c[ 2 ] & 0x80 )
+ // Vorzeichenerweiterung!
+ n |= ~0xFFFFFFL;
+ return *this;
+}
+
+//////////////////////////// class swistream ///////////////////////////////
+
+swistream::swistream( SvStream& r ) : swstreambase( r )
+{
+ nOffset = 0;
+ cType = SWG_EOF;
+}
+
+long swistream::size()
+{
+ return nOffset - pStrm->Tell();
+}
+
+sal_Char* swistream::text()
+{
+ BOOL bSkip = FALSE;
+ // der String ohne 0, Laenge ist im Offset (von SWG_TEXT)
+ long len = size();
+ // Sicherheitshalber kuerzen
+ if( len > 0xFFF0L ) len = 0xFFF0L, bSkip = TRUE;
+ // Eventuell den Puffer vergroessern
+ checkbuf( (USHORT) len + 1 );
+ pStrm->Read( pBuf, (USHORT) len );
+ if( bPasswd )
+ encode( pBuf, (USHORT) len );
+ pBuf[ (USHORT) len ] = 0;
+ if( bSkip ) skip();
+ return pBuf;
+}
+
+BYTE swistream::peek()
+{
+ BYTE ch = get();
+ pStrm->SeekRel( -1 );
+ return ch;
+}
+
+BYTE swistream::next()
+{
+ long pos = pStrm->Tell();
+ short n = nLong; nLong = 3;
+ cType = get();
+ long val;
+ swstreambase::operator>>( val );
+ // Man achte darauf: Dieser Wert ist immer positiv,
+ // es findet keine VZ-Erweiterung statt!
+ val &= 0x00FFFFFFL;
+ if( good() ) nOffset = val + pos;
+ nLong = n;
+ return cType;
+}
+
+void swistream::undonext()
+{
+ // der Read-Pointer wird um 4 Bytes zurueckversetzt
+ long pos = pStrm->Tell();
+ if( pos >= 4 )
+ {
+ pStrm->Seek( pos - 4 );
+ nOffset = -1; // damit skip() klappt
+ }
+}
+
+void swistream::skip( long posn )
+{
+ if( posn == -1L ) posn = nOffset;
+ if( posn != -1L ) pStrm->Seek( posn );
+}
+
+BYTE swistream::skipnext()
+{
+ pStrm->Seek( nOffset );
+ return next();
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/swg/swgids.hxx b/binfilter/bf_sw/source/core/swg/swgids.hxx
new file mode 100644
index 000000000000..b4ec302aaf74
--- /dev/null
+++ b/binfilter/bf_sw/source/core/swg/swgids.hxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SWGIDS_HXX
+#define _SWGIDS_HXX
+
+#include <tools/solar.h>
+namespace binfilter {
+
+struct FileHeader {
+ long nSignature; // Signatur: "SWG1"
+ USHORT nVersion; // Versionsnummer der Datei
+ USHORT nFlags; // Flags (s.u.)
+ long nFree1; // 1. freier Textblock (meist 0)
+ long nDocInfo; // Offset der statischen DocInfo
+ sal_Char cPasswd[ 16 ]; // Passwort, falls vorhanden
+ // in SWGINF_EXTINFO:
+// BYTE cGUIType; // aktuell verwendetes GUI
+// BYTE cCharSet; // aktuell verwendeter Zeichensatz
+};
+
+#define SWGF_NO_FRAMES 0x0001 // keine Layout-Frames einlesen
+#define SWGF_HAS_BLOCKS 0x0002 // Datei enthaelt Textbausteine
+#define SWGF_HAS_VERS 0x0004 // Datei enthaelt mehrere Versionen
+#define SWGF_HAS_PASSWD 0x0008 // Datei ist passwortgeschuetzt
+#define SWGF_HAS_GRFLNK 0x0010 // Datei enthaelt Grafik-Links
+#define SWGF_HAS_DDELNK 0x0020 // Datei enthaelt DDE-Links
+#define SWGF_HAS_OLELNK 0x0040 // Datei enthaelt OLE-Links
+#define SWGF_PORT_GRAF 0x0080 // Grafiken sollen portabel sein
+#define SWGF_HAS_PGNUMS 0x0100 // Datei hat Seitennummern
+#define SWGF_FIX_FMTS 0x4000 // Nicht alle Formate gespeichert
+#define SWGF_BAD_FILE 0x8000 // Fehler beim Schreiben
+
+// Header-Record im Doc-Record
+
+struct DocHeader { // Dokument-Header:
+ USHORT nFlags; // Dokument-Flags
+ USHORT nVersion; // aktuelle Version
+ BYTE cAttrTab [8]; // Start-IDs der Attribute
+ BYTE cAttrSiz [8]; // Laengen der Attribut-Gruppen
+ BYTE cCodeSet; // Zeichensatz des Systems
+ USHORT nNumRules; // Anzahl Numerierungs-Regeln
+ long nDocVersion; // externe Versionsnummer
+ BYTE cGUIType; // Verwendetes System
+ BYTE cReserved[ 3 ]; // reserviert
+ long nDocInfoOffset; // Offset der Dokument-Infos
+ long nLayoutOffset; // Offset der Layout-Frames
+ long nDate, nTime; // neu: Datum, Uhrzeit der Speicherung
+};
+
+enum DocFlags { // Dokument-Flags:
+ DOCF_NAMEDFMTS = 0x0001, // hat Einzel-Formatvorlagen
+ DOCF_FMTCOLLS = 0x0002, // hat Format-Collections
+ DOCF_NUMRULES = 0x0004, // hat Numerierungs-Regeln
+ DOCF_CONTENTS = 0x0008, // hat Inhalt
+ DOCF_DOCINFO = 0x0010 // hat Dokument-Info
+};
+
+enum AttrIdx { // Indexe von cAttrTab[]
+ ATTR_CHR1 = 0, // 1. Attribut RES_CHRATR
+ ATTR_FONT1, // 1. Attribut FONT_TXTATR
+ ATTR_TEXT1, // 1. Attribut ETC_TXTATR
+ ATTR_PAR1, // 1. Attribut RES_PARATR
+ ATTR_ADD1, // 1. Attribut RES_ADDATR
+ ATTR_FRM1, // 1. Attribut RES_FRMATR
+ ATTR_GRF1 // 1. Attribut RES_GRFATR
+};
+
+#define SWG_SIGN1 "SWG1" // Alte Signatur vor 2.0
+#define SWG_SIGNATURE "SWG2" // Datei-Signatur
+
+ // Der Reader braucht diese IDs noch
+#define SWG_VERSION1 0x0007 // 1. kompatible Version
+#define SWG_VER_LRSPACE 0x000A // Aenderung LRSpace und FirstLineOffset
+#define SWG_VER_NUM 0x000C // Numerierung, Flags in TxtNode
+#define SWG_VER_FIELD 0x000E // Feldnummern mit Offset=0
+#define SWG_VER_FRMSIZE 0x000F // Hint FrmSize mit 4 Byte-Longs
+#define SWG_VER_OLDHDR 0x0010 // alter Dateikopf
+#define SWG_VER_FMTCOL 0x0012 // neue Form des FmtCol-Hints
+#define SWG_VER_KERNING 0x0013 // neue Form des Kerning-Hints
+#define SWG_VER_FRAMES 0x0015 // Tabellenformat als Index, Layoutframes
+#define SWG_VER_ST 0x0016 // STs Wunsch nach besserem JobSetup
+#define SWG_VER_LCLFMT 0x0017 // Autoformate local im Content/Textblock
+#define SWG_VER_HIDPARA 0x0018 // neues Feld HiddenPara, Wert bei UserFld
+#define SWG_VER_BOOKMAC 0x0019 // Makros an Bookmarks
+#define SWG_VER_STAMP 0x001A // Time Stamp im Doc-Header
+#define SWG_VER_FMTNAME 0x001B // alle Formate mit Namen
+#define SWG_VER_BETA3 0x001C // offizielle Betaversion 3
+#define SWG_VER_PORTGRF 0x001D // Portable Grafiken
+#define SWG_VER_PRODUCT 0x0100 // Produktversion
+#define SWG_VER_COLLREF 0x0101 // Collections. Referenzen auf ben. Fmts
+#define SWG_VER_COMPAT 0x0200 // Besser rueckwaertskompatible Version
+#define SWG_VER_POOLIDS 0x0201 // Neues PoolId-Handling
+#define SWG_VER_DOCINFO 0x0202 // eigene SwSwgInfo-Klasse
+#define SWG_VER_NPOOLIDS 0x0203 // neue Pool-Id's, noch abs. lesen/speichern
+#define SWG_VER_FRAMES3 0x0204 // Frame-Infos Version 3
+#define SWG_VER_POOLID3 0x0205 // Pool-Ids, der dritte Versuch!
+#define SWG_VER_TOXDATA 0x0206 // SWG_DATA-Kapselung im TOX-Record
+#define SWG_VER_GETEXP 0x0207 // neuer Parameter in GetExp-Feld
+#define SWG_VER_TBLSIZE 0x0208 // FrmSize von Tbl von LONG_MAX nach USHRT_MAX
+ // FrmSize der Boxen entsprechend anpassen.
+#define SWG_VER_NEWALIGN 0x0209 // Alignment wurde Layoutseitig verandert.
+ // SwFmtBox alter Versionen bekommt eine
+ // minimale Distance verpasst.
+#define SWG_VER_NEWJOB 0x020A // SWG_NEWJOBSETUP
+#define SWG_VER_POOLID2 0x020B // Bitverschiebungen im Pool-ID
+
+#define SWG_VERSION 0x020B // aktuelle Version
+
+ // Kennungen fuer Dokument-Info:
+#define SWGINF_END 0x00 // Ende der Informationen
+#define SWGINF_DBNAME 0x02 // Datenbankname
+#define SWGINF_AUTHOR 0x03 // Autor
+#define SWGINF_DOCSTAT 0x04 // Statistiken
+#define SWGINF_SAVEINFO 0x05 // Save-Infoblock
+#define SWGINF_EXTINFO 0x06 // Extended Infos
+#define SWGINF_LAYOUTPR 0x07 // Drucker fuer Layout
+ // Im dynamischen Teil am Dateiende:
+#define SWGINF_TEMPLATE 0x08 // Template-Infos
+#define SWGINF_ADDRINFO 0x09 // Adressaten-Eintrag
+
+ // Indexwerte fuer Formate:
+#define IDX_NO_VALUE (USHORT) 0xFFFF // Indexwert nicht belegt
+#define IDX_DFLT_VALUE (USHORT) 0xFFFE // Index zeigt auf Defaultwert
+#define IDX_COLUMN (USHORT) 0xFFFD // Default-Spalten-Frameformat
+#define IDX_EMPTYPAGE (USHORT) 0xFFFC // Default-Format leere Seite
+#define IDX_SPECIAL (USHORT) 0xFFF0 // Beginn Spezialformate
+#define IDX_TYPEMASK (USHORT) 0xE000 // Typmaske fuer Formate
+#define IDX_AUTOFMT (USHORT) 0x0000 // Autoformat
+#define IDX_FLYFMT (USHORT) 0x2000 // FlyFormat
+#define IDX_NAMEDFMT (USHORT) 0x4000 // benanntes Format
+#define IDX_FLOATFMT (USHORT) 0x6000 // freies Header/Footer-Format
+#define IDX_COLLECTION (USHORT) 0x8000 // Format-Collection
+#define IDX_MASTERFMT (USHORT) 0xA000 // Seitendeskriptor-Masterfmt
+#define IDX_LEFTFMT (USHORT) 0xC000 // Seitendeskriptor-Leftfmt
+
+#define SWG_GRFATR1 0xF0 // 1. RES_GRFATR (max 16)
+#define SWG_FRMATR1 0xD0 // 1. RES_FRMATR (max 32)
+#define SWG_ADDATR1 0xC0 // 1. RES_ADDATR (max 16)
+#define SWG_PARATR1 0xA0 // 1. RES_PARATR (max 32)
+#define SWG_TEXTATR1 0x80 // 1. ETC_TXTATR (max 32)
+#define SWG_FONTATR1 0x60 // 1. FONT_TXTATR (max 32)
+#define SWG_CHRATR1 0x40 // 1. RES_CHRATR (max 32)
+
+#ifndef SW3_NEW_FORMAT
+
+#define SWG_MAXGLOBAL 0x3F // Maximalwert fuer globale Records
+
+#define SWG_STRINGPOOL 0x39 // String-Pool
+#define SWG_SDRFMT 0x38 // SdrObject-Frameformat
+#define SWG_OLEVISRECT 0x37 // OLE2 VisRectangle
+ // Alte SWG2-IDs:
+#define SWG_NEWJOBSETUP 0x36 // neue JobSetup-Daten mit Stream-Operator
+#define SWG_DYNDOCINFO 0x35 // DocInfo am Dateiende
+#define SWG_DATA 0x34 // Wrapper fuer binaere Daten
+#define SWG_FIELDTYPES 0x33 // Nicht-Systemfeldtypen
+#define SWG_TEXTBLOCK 0x32 // Textblock
+#define SWG_NAMEDFMTS 0x31 // benannte Formate
+#define SWG_DOCUMENT 0x30 // Dokument-Beginn
+#define SWG_FRAMES 0x2F // Layout-Frames
+#define SWG_MACROTBL 0x2E // Makro-Tabelle
+
+#define SWG_TOXGROUP 0x2D // Verzeichnis-Gruppe
+#define SWG_TOXDESC 0x2C // Verzeichnis-Descriptor
+
+#define SWG_NUMRULE 0x2B // Numerierungs-Regelwerk
+#define SWG_NUMFMT 0x2A // Numerierungs-Format
+#define SWG_NUMRULES 0x29 // Numerierungs-Regeln im Text
+#define SWG_OUTLINE 0x28 // Outline-Numerierung
+
+#define SWG_DOCINFO 0x27 // Dokument-Info
+
+#define SWG_TABLEBOX 0x26 // Tabellen-Zelle
+#define SWG_TABLELINE 0x25 // Tabellen-Zeile
+#define SWG_TABLE 0x24 // Tabelle
+
+#define SWG_BOTTOM 0x23 // unterer Rand
+#define SWG_RIGHT 0x22 // rechter Rand
+#define SWG_LEFT 0x21 // linker Rand
+#define SWG_TOP 0x20 // oberer Rand
+#define SWG_BOOKMARK 0x1F // Bookmark
+#define SWG_OLE 0x1E // OLE-Objekt
+#define SWG_GRAPHIC 0x1D // Grafik-Objekt
+#define SWG_FMTHINTS 0x1C // Liste von Formathints
+#define SWG_TEXTHINTS 0x1B // Liste von Texthints
+#define SWG_TEXT 0x1A // Textblock
+#define SWG_LAYOUT 0x19 // Layoutbeschreibung
+#define SWG_FOOTINFO 0x18 // Layout-Fussnoten-Info
+#define SWG_JOBSETUP 0x17 // JobSetup-Daten
+#define SWG_TXTCOLL 0x16 // Text-Format-Collection
+#define SWG_COLLNEXT 0x15 // TextCollection-Folgeliste (alt)
+#define SWG_COLLDERIVED 0x14 // TextCollection-Abhaengigkeiten (alt)
+#define SWG_COLLECTIONS 0x13 // Tabelle der Formate
+#define SWG_PAGEDESC 0x12 // Layout-Seitenbeschreibung
+
+#define SWG_OLENODE 0x11 // OLE-Node
+#define SWG_GRFNODE 0x10 // Grafik-Node
+#define SWG_TEXTNODE 0x0F // Textnode
+
+#define SWG_FREEFMT 0x0E // Frameformat ohne Doc-Anbindung
+#define SWG_GRFFMT 0x0D // Grafik-Formatbeschreibung
+#define SWG_FLYFMT 0x0C // FlyFrame-Formatbeschreibung
+#define SWG_FRAMEFMT 0x0B // Frame-Formatbeschreibung
+#define SWG_CHARFMT 0x0A // Zeichen-Formatbeschreibung
+#define SWG_PARAFMT 0x09 // Absatz-Formatbeschreibung
+#define SWG_MASTERFMT 0x08 // Layout-Masterformat
+#define SWG_LEFTFMT 0x07 // Layout-Format linke Seite
+
+#define SWG_AUTOFMTS 0x06 // Auto-Formate
+#define SWG_DFLTFMTS 0x05 // Default-Formate
+#define SWG_CONTENTS 0x04 // Textteil
+#define SWG_LAYOUTS 0x03 // Layout-Teil
+#define SWG_FLYFRAMES 0x02 // FlyFrames
+#define SWG_COMMENT 0x01 // Kommentare
+
+#define SWG_EOF 0x00 // EOF-Markierung
+
+// Der SWG_COMMENT-Record wird ab sofort erweitert, um rueckwaertskompatibel
+// neue Records einfuehren zu koennen. Da zur Zeit Comment-Records mit Strings
+// (SW/G-Version) existieren, ist das erste Zeichen 00H; danach folgt der
+// erweiterte Record-Typ, der unten definiert ist.
+
+#define SWG_XFTNCOLL 0x01 // Collection fuer Fussnoten
+
+#endif
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/guess.hxx b/binfilter/bf_sw/source/core/text/guess.hxx
new file mode 100644
index 000000000000..143da7d16dbf
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/guess.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GUESS_HXX
+#define _GUESS_HXX
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+
+#include "txttypes.hxx"
+#include "breakit.hxx"
+#include "porrst.hxx" // SwHangingPortion
+namespace binfilter {
+
+class SwTxtSizeInfo;
+class SwTxtFormatInfo;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::linguistic2;
+
+/*************************************************************************
+ * class SwTxtGuess
+ *************************************************************************/
+
+class SwTxtGuess
+{
+ uno::Reference< XHyphenatedWord > xHyphWord;
+ SwHangingPortion *pHanging; // for hanging punctuation
+ xub_StrLen nCutPos; // this character doesn't fit
+ xub_StrLen nBreakStart; // start index of word containing line break
+ xub_StrLen nBreakPos; // start index of break position
+ xub_StrLen nFieldDiff; // absolut positions can be wrong if we
+ // a field in the text has been expanded
+ KSHORT nBreakWidth; // width of the broken portion
+public:
+ inline SwTxtGuess(): pHanging( NULL ), nCutPos(0), nBreakStart(0),
+ nBreakPos(0), nFieldDiff(0), nBreakWidth(0)
+ { }
+ ~SwTxtGuess() { delete pHanging; }
+
+ // true, if current portion still fits to current line
+ sal_Bool Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
+ const KSHORT nHeight );
+ sal_Bool AlternativeSpelling( const SwTxtFormatInfo &rInf, const xub_StrLen nPos );
+
+ inline SwHangingPortion* GetHangingPortion() const { return pHanging; }
+ inline void ClearHangingPortion() { pHanging = NULL; }
+ inline KSHORT BreakWidth() const { return nBreakWidth; }
+ inline xub_StrLen CutPos() const { return nCutPos; }
+ inline xub_StrLen BreakStart() const { return nBreakStart; }
+ inline xub_StrLen BreakPos() const {return nBreakPos; }
+ inline xub_StrLen FieldDiff() const {return nFieldDiff; }
+ inline uno::Reference< XHyphenatedWord > HyphWord() const
+ { return xHyphWord; }
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/inftxt.hxx b/binfilter/bf_sw/source/core/text/inftxt.hxx
new file mode 100644
index 000000000000..2313e74d1bf6
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/inftxt.hxx
@@ -0,0 +1,859 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _INFTXT_HXX
+#define _INFTXT_HXX
+
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <tools/table.hxx>
+
+#include "swtypes.hxx"
+#include "txttypes.hxx"
+#include "swrect.hxx"
+
+#include "txtfly.hxx"
+#include "swfont.hxx"
+#include "porlay.hxx"
+#include "txtfrm.hxx"
+#include "ndtxt.hxx"
+#include "txttypes.hxx"
+
+#include <bf_svx/paravertalignitem.hxx>
+class Font;
+class OutputDevice;
+namespace binfilter {
+
+
+class SvxBrushItem;
+class SvxLineSpacingItem;
+class SvxTabStop;
+class SvxTabStopItem;
+class SwAttrSet;
+class SwField;
+class SwFldPortion;
+class SwFlyPortion;
+class SwFmtDrop;
+class SwFtnPortion;
+class SwLineHeightRule;
+class SwLineLayout;
+class SwLinePortion;
+class SwLineSpaceRule;
+class SwParaPortion;
+class SwTabPortion;
+class SwTxtFrm;
+class SwTxtSizeInfo;
+class SwViewOption;
+class ViewShell;
+class SwTxtFtn;
+class SwAttrIter;
+struct SwMultiCreator;
+
+#ifdef BIDI
+class SwMultiPortion;
+#endif
+
+/* Minimum: Prozentwert fuers kernen */
+#define MINKERNPERCENT 5
+#define ARROW_WIDTH 200
+#define DIR_LEFT2RIGHT 0
+#define DIR_BOTTOM2TOP 1
+#define DIR_RIGHT2LEFT 2
+#define DIR_TOP2BOTTOM 3
+
+#ifdef DBG_UTIL
+#define OPTCALM( rInf ) (rInf).IsOptCalm()
+#define OPTLOW( rInf ) (rInf).IsOptLow()
+#define OPTDBG( rInf ) (rInf).IsOptDbg()
+#else
+#define OPTCALM( rInf ) sal_True
+#define OPTLOW( rInf ) sal_False
+#define OPTDBG( rInf ) sal_False
+#endif
+
+/*************************************************************************
+ * class SwLineInfo
+ *************************************************************************/
+
+// Beruecksichtigt das Attribut LineSpace bei der Hoehen/Ascentberechnung.
+
+class SwLineInfo
+{
+ friend class SwTxtIter;
+
+ const SvxTabStopItem *pRuler;
+ const SvxLineSpacingItem *pSpace;
+ USHORT nVertAlign;
+ KSHORT nDefTabStop;
+ void CtorInit( const SwAttrSet& rAttrSet );
+ inline SwLineInfo() {}
+public:
+ inline SwLineInfo( const SwAttrSet& rAttrSet )
+ { CtorInit( rAttrSet ); }
+ // Liefert den Tabstop, der auf LinePos folgt, oder 0.
+ const SvxTabStop *GetTabStop( const SwTwips nLinePos,
+ const SwTwips nLeft,
+ const SwTwips nRight ) const;
+ inline const SvxLineSpacingItem *GetLineSpacing() const { return pSpace; }
+ inline KSHORT GetDefTabStop() const { return nDefTabStop; }
+ inline void SetDefTabStop( KSHORT nNew ) const
+ { ( (SwLineInfo*)this )->nDefTabStop = nNew; }
+
+ // vertical alignment
+ inline USHORT GetVertAlign() const { return nVertAlign; }
+#ifdef BIDI
+ inline sal_Bool HasSpecialAlign( sal_Bool bVert ) const
+ { return bVert ?
+ ( SvxParaVertAlignItem::BASELINE != nVertAlign ) :
+ ( SvxParaVertAlignItem::BASELINE != nVertAlign &&
+ SvxParaVertAlignItem::AUTOMATIC != nVertAlign ); }
+#else
+ inline sal_Bool HasSpecialAlign() const
+ { return SvxParaVertAlignItem::BASELINE != nVertAlign ||
+ SvxParaVertAlignItem::AUTOMATIC != nVertAlign; }
+#endif
+
+// friend ostream &operator<<( ostream &rOS, const SwLineInfo &rInf );
+ friend SvStream &operator<<( SvStream &rOS, const SwLineInfo &rInf );
+};
+
+/*************************************************************************
+ * class SwTxtInfo
+ *************************************************************************/
+
+class SwTxtInfo
+{
+ // Implementation in txthyph.cxx
+ friend void SetParaPortion( SwTxtInfo *pInf, SwParaPortion *pRoot );
+ SwParaPortion *pPara;
+ xub_StrLen nTxtStart; // TxtOfst bei Follows
+
+protected:
+ inline SwTxtInfo() { }
+public:
+ void CtorInit( SwTxtFrm *pFrm );
+ SwTxtInfo( const SwTxtInfo &rInf );
+ inline SwTxtInfo( SwTxtFrm *pFrm ) { CtorInit( pFrm ); }
+ inline SwParaPortion *GetParaPortion() { return pPara; }
+ inline const SwParaPortion *GetParaPortion() const { return pPara; }
+ inline xub_StrLen GetTxtStart() const { return nTxtStart; }
+
+ friend SvStream &operator<<( SvStream &rOS, const SwTxtInfo &rInf );
+};
+
+/*************************************************************************
+ * class SwTxtSizeInfo
+ *************************************************************************/
+
+DECLARE_TABLE( SwTxtPortionTable, sal_IntPtr )
+
+class SwTxtSizeInfo : public SwTxtInfo
+{
+protected:
+ // during formatting, a small database is built, mapping portion pointers
+ // to their maximum size (used for kana compression)
+ SwTxtPortionTable aMaxWidth;
+ // for each line, an array of compression values is calculated
+ // this array is passed over to the info structure
+ SvUShorts* pKanaComp;
+
+ ViewShell *pVsh;
+
+ // pOut is the output device, pRef is the device used for formatting
+ OutputDevice *pOut;
+ OutputDevice *pRef;
+
+ SwFont *pFnt;
+ SwUnderlineFont *pUnderFnt; // Font for underlining
+ SwTxtFrm *pFrm;
+ const SwViewOption *pOpt;
+ const XubString *pTxt;
+ xub_StrLen nIdx, nLen;
+ USHORT nKanaIdx;
+ sal_Bool bOnWin : 1;
+ sal_Bool bNotEOL : 1;
+ sal_Bool bURLNotify : 1;
+ sal_Bool bStopUnderFlow : 1;// Underflow gestoppt z.B. von einer FlyPortion
+ sal_Bool bArrowDone : 1; // Pfeil nach links bei gescrollten Absaetzen
+ sal_Bool bFtnInside : 1; // the current line contains a footnote
+ sal_Bool bMulti : 1; // inside a multiportion
+ sal_Bool bFirstMulti : 1; // this flag is used for two purposes:
+ // - the multiportion is the first lineportion
+ // - indicates, if we are currently in second
+ // line of multi portion
+ sal_Bool bRuby : 1; // during the formatting of a phonetic line
+ sal_Bool bHanging : 1; // formatting of hanging punctuation allowed
+ sal_Bool bScriptSpace : 1; // space between different scripts (Asian/Latin)
+ sal_Bool bForbiddenChars : 1; // Forbidden start/endline characters
+#ifdef VERTICAL_LAYOUT
+ sal_Bool bSnapToGrid : 1; // paragraph snaps to grid
+#endif
+ sal_uInt8 nDirection : 2; // writing direction: 0/90/180/270 degree
+
+protected:
+ void CtorInit( SwTxtFrm *pFrm, SwFont *pFnt = 0,
+ const xub_StrLen nIdx = 0,
+ const xub_StrLen nLen = STRING_LEN );
+ SwTxtSizeInfo() {}
+public:
+ SwTxtSizeInfo( const SwTxtSizeInfo &rInf );
+ SwTxtSizeInfo( const SwTxtSizeInfo &rInf, const XubString &rTxt,
+ const xub_StrLen nIdx = 0,
+ const xub_StrLen nLen = STRING_LEN );
+
+ inline SwTxtSizeInfo( SwTxtFrm *_pFrm, SwFont *_pFnt = 0,
+ const xub_StrLen _nIdx = 0,
+ const xub_StrLen _nLen = STRING_LEN )
+ { CtorInit( _pFrm, _pFnt, _nIdx, _nLen ); }
+
+ // GetMultiAttr returns the text attribute of the multiportion,
+ // if rPos is inside any multi-line part.
+ // rPos will set to the end of the multi-line part.
+#ifdef BIDI
+ SwMultiCreator* GetMultiCreator( xub_StrLen &rPos, SwMultiPortion* pM ) const;
+#else
+ SwMultiCreator* GetMultiCreator( xub_StrLen &rPos ) const;
+#endif
+
+ inline sal_Bool OnWin() const { return bOnWin; }
+ inline void SetOnWin( const sal_Bool bNew ) { bOnWin = bNew; }
+ inline sal_Bool NotEOL() const { return bNotEOL; }
+ inline void SetNotEOL( const sal_Bool bNew ) { bNotEOL = bNew; }
+ inline sal_Bool URLNotify() const { return bURLNotify; }
+ inline void SetURLNotify( const sal_Bool bNew ) { bURLNotify = bNew; }
+ inline sal_Bool StopUnderFlow() const { return bStopUnderFlow; }
+ inline void SetStopUnderFlow( const sal_Bool bNew ) { bStopUnderFlow = bNew; }
+ inline sal_Bool IsFtnInside() const { return bFtnInside; }
+ inline void SetFtnInside( const sal_Bool bNew ) { bFtnInside = bNew; }
+ inline sal_Bool IsMulti() const { return bMulti; }
+ inline void SetMulti( const sal_Bool bNew ) { bMulti = bNew; }
+ inline sal_Bool IsFirstMulti() const { return bFirstMulti; }
+ inline void SetFirstMulti( const sal_Bool bNew ) { bFirstMulti = bNew; }
+ inline sal_Bool IsRuby() const { return bRuby; }
+ inline void SetRuby( const sal_Bool bNew ) { bRuby = bNew; }
+ inline sal_Bool IsHanging() const { return bHanging; }
+ inline void SetHanging( const sal_Bool bNew ) { bHanging = bNew; }
+ inline sal_Bool HasScriptSpace() const { return bScriptSpace; }
+ inline void SetScriptSpace( const sal_Bool bNew ) { bScriptSpace = bNew; }
+ inline sal_Bool HasForbiddenChars() const { return bForbiddenChars; }
+ inline void SetForbiddenChars( const sal_Bool bN ) { bForbiddenChars = bN; }
+#ifdef VERTICAL_LAYOUT
+ inline sal_Bool SnapToGrid() const { return bSnapToGrid; }
+ inline void SetSnapToGrid( const sal_Bool bN ) { bSnapToGrid = bN; }
+#endif
+ inline sal_uInt8 GetDirection() const { return nDirection; }
+ inline void SetDirection( const sal_uInt8 nNew ) { nDirection = nNew; }
+ inline sal_Bool IsRotated() const { return 0 != ( 1 & nDirection ); }
+
+ inline ViewShell *GetVsh() { return pVsh; }
+ inline const ViewShell *GetVsh() const { return pVsh; }
+
+ inline OutputDevice *GetOut() { return pOut; }
+ inline const OutputDevice *GetOut() const { return pOut; }
+ inline void SetOut( OutputDevice* pNewOut ) { pOut = pNewOut; }
+
+ inline OutputDevice *GetRefDev() { return pRef; }
+ inline const OutputDevice *GetRefDev() const { return pRef; }
+
+ inline SwFont *GetFont() { return pFnt; }
+ inline const SwFont *GetFont() const { return pFnt; }
+ inline void SetFont( SwFont *pNew ) { pFnt = pNew; }
+ void SelectFont();
+ inline void SetUnderFnt( SwUnderlineFont* pNew ) { pUnderFnt = pNew; }
+ inline SwUnderlineFont* GetUnderFnt() const { return pUnderFnt; }
+
+ inline const SwViewOption &GetOpt() const { return *pOpt; }
+ inline const XubString &GetTxt() const { return *pTxt; }
+ inline xub_Unicode GetChar( const xub_StrLen nPos ) const
+ { return pTxt->GetChar( nPos ); }
+
+ inline KSHORT GetTxtHeight() const;
+
+ //
+ // GetTxtSize
+ //
+ SwPosSize GetTxtSize( OutputDevice *pOut, const SwScriptInfo* pSI,
+ const XubString& rTxt, const xub_StrLen nIdx,
+ const xub_StrLen nLen, const USHORT nComp ) const;
+ SwPosSize GetTxtSize() const;
+ void GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx,
+ const xub_StrLen nLen, const USHORT nComp,
+ USHORT& nMinSize, USHORT& nMaxSizeDiff ) const;
+ inline SwPosSize GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx,
+ const xub_StrLen nLen, const USHORT nComp ) const;
+ inline SwPosSize GetTxtSize( const XubString &rTxt ) const;
+
+ //
+ // GetTxtBreak
+ //
+ xub_StrLen GetTxtBreak( const long nLineWidth,
+ const xub_StrLen nMaxLen,
+ const USHORT nComp ) const;
+ xub_StrLen GetTxtBreak( const long nLineWidth,
+ const xub_StrLen nMaxLen,
+ const USHORT nComp,
+ xub_StrLen& rExtraCharPos ) const;
+
+ inline KSHORT GetAscent() const;
+
+ inline xub_StrLen GetIdx() const { return nIdx; }
+ inline void SetIdx( const xub_StrLen nNew ) { nIdx = nNew; }
+ inline xub_StrLen GetLen() const { return nLen; }
+ inline void SetLen( const xub_StrLen nNew ) { nLen = nNew; }
+ inline void SetTxt( const XubString &rNew ){ pTxt = &rNew; }
+
+ friend SvStream &operator<<( SvStream &rOS, const SwTxtSizeInfo &rInf );
+
+// 7780: Keine Bullets beim Symbol-Zeichensatz!
+ inline sal_Bool IsNoSymbol() const
+ { return RTL_TEXTENCODING_SYMBOL != pFnt->GetCharSet( pFnt->GetActual() ); }
+
+
+ // Home is where Your heart is...
+ inline SwTxtFrm *GetTxtFrm() { return pFrm; }
+ inline const SwTxtFrm *GetTxtFrm() const { return pFrm; }
+
+ inline sal_Bool HasHint( xub_StrLen nPos ) const
+ { return _HasHint( pFrm->GetTxtNode(), nPos ); }
+ static sal_Bool _HasHint( const SwTxtNode* pTxtNode, xub_StrLen nPos );
+
+ inline SwDoc* GetDoc() const { return pFrm->GetNode()->GetDoc(); };
+
+ //
+ // If Kana Compression is enabled, a minimum and maximum portion width
+ // is calculated. We format lines with minimal size and share remaining
+ // space among compressed kanas.
+ // During formatting, the maximum values of compressable portions are
+ // stored in aMaxWidth and discarded after a line has been formatted.
+ inline void SetMaxWidthDiff( ULONG nKey, USHORT nVal )
+ {
+ aMaxWidth.Insert( nKey, nVal );
+ };
+ inline USHORT GetMaxWidthDiff( ULONG nKey )
+ {
+ return (USHORT)aMaxWidth.Get( nKey );
+ };
+ inline void ResetMaxWidthDiff()
+ {
+ aMaxWidth.Clear();
+ };
+ inline sal_Bool CompressLine()
+ {
+ return (sal_Bool)aMaxWidth.Count();
+ };
+
+ //
+ // Feature: Kana Compression
+ //
+ inline MSHORT GetKanaIdx() const { return nKanaIdx; }
+ inline void ResetKanaIdx(){ nKanaIdx = 0; }
+ inline void SetKanaIdx( MSHORT nNew ) { nKanaIdx = nNew; }
+ inline void IncKanaIdx() { ++nKanaIdx; }
+ inline void SetKanaComp( SvUShorts *pNew ){ pKanaComp = pNew; }
+ inline SvUShorts* GetpKanaComp() const { return pKanaComp; }
+ inline USHORT GetKanaComp() const
+ { return ( pKanaComp && nKanaIdx < pKanaComp->Count() )
+ ? (*pKanaComp)[nKanaIdx] : 0; }
+
+#ifdef DBG_UTIL
+#endif
+};
+
+/*************************************************************************
+ * class SwTxtPaintInfo
+ *************************************************************************/
+
+class SwTxtPaintInfo : public SwTxtSizeInfo
+{
+ SwWrongList *pWrongList;
+ SvShorts *pSpaceAdd;
+ const SvxBrushItem *pBrushItem; // Fuer den Hintergrund
+ SwRect aItemRect; // ebenfalls fuer den Hintergrund
+ SwTxtFly aTxtFly; // FlyFrm-Berechnung
+ Point aPos; // Ausgabeposition
+ SwRect aPaintRect; // Original Ausgaberechteck (aus Layout-Paint)
+
+ MSHORT nSpaceIdx;
+
+ SwTxtPaintInfo &operator=(const SwTxtPaintInfo&);
+
+protected:
+#ifndef DBG_UTIL
+ SwTxtPaintInfo() { pFrm = 0; pWrongList = 0; pSpaceAdd = 0; pBrushItem = 0;}
+#else
+ SwTxtPaintInfo() { pFrm = 0; pWrongList = 0; pSpaceAdd = 0;
+ pBrushItem = ((SvxBrushItem*)-1);}
+#endif
+public:
+ SwTxtPaintInfo( const SwTxtPaintInfo &rInf );
+
+ void CtorInit( SwTxtFrm *pFrame, const SwRect &rPaint );
+
+ void SetBack( const SvxBrushItem *pItem,
+ const SwRect &rRect ) { pBrushItem = pItem; aItemRect = rRect;}
+ const SvxBrushItem *GetBrushItem() const { return pBrushItem; }
+ const SwRect &GetBrushRect() const { return aItemRect; }
+
+ inline SwTxtPaintInfo( SwTxtFrm *pFrame, const SwRect &rPaint )
+ { CtorInit( pFrame, rPaint ); }
+
+ inline SwTwips X() const { return aPos.X(); }
+ inline void X( const long nNew ) { aPos.X() = nNew; }
+ inline SwTwips Y() const { return aPos.Y(); }
+ inline void Y( const SwTwips nNew ) { aPos.Y() = nNew; }
+
+ inline SwTxtFly *GetTxtFly() { return &aTxtFly; }
+ inline const SwTxtFly *GetTxtFly() const { return &aTxtFly; }
+ inline void DrawText( const XubString &rText, const SwLinePortion &rPor,
+ const xub_StrLen nIdx = 0,
+ const xub_StrLen nLen = STRING_LEN,
+ const sal_Bool bKern = sal_False) const;
+ inline void DrawText( const SwLinePortion &rPor, const xub_StrLen nLen,
+ const sal_Bool bKern = sal_False ) const;
+ inline void DrawWrongText( const SwLinePortion &rPor, const xub_StrLen nLen,
+ const sal_Bool bKern = sal_False ) const;
+#ifdef VERTICAL_LAYOUT
+#endif
+
+
+ inline SwTwips GetPaintOfst() const;
+ inline void SetPaintOfst( const SwTwips nNew );
+ inline const Point &GetPos() const { return aPos; }
+ inline void SetPos( const Point &rNew ) { aPos = rNew; }
+
+ inline const SwRect &GetPaintRect() const { return aPaintRect; }
+ inline void SetPaintRect( const SwRect &rNew ) { aPaintRect = rNew; }
+
+ friend SvStream &operator<<( SvStream &rOS, const SwTxtPaintInfo &rInf );
+
+ inline MSHORT GetSpaceIdx() const { return nSpaceIdx; }
+ inline void ResetSpaceIdx(){nSpaceIdx = 0; }
+ inline void SetSpaceIdx( MSHORT nNew ) { nSpaceIdx = nNew; }
+ inline void IncSpaceIdx() { ++nSpaceIdx; }
+ inline void SetSpaceAdd( SvShorts *pNew ){ pSpaceAdd = pNew; }
+ inline SvShorts* GetpSpaceAdd() const { return pSpaceAdd; }
+ inline short GetSpaceAdd() const
+ { return ( pSpaceAdd && nSpaceIdx < pSpaceAdd->Count() )
+ ? (*pSpaceAdd)[nSpaceIdx] : 0; }
+
+ inline void SetWrongList( SwWrongList *pNew ){ pWrongList = pNew; }
+ inline SwWrongList* GetpWrongList() const { return pWrongList; }
+
+};
+
+/*************************************************************************
+ * class SwTxtFormatInfo
+ *************************************************************************/
+
+class SwTxtFormatInfo : public SwTxtPaintInfo
+{
+ // temporary arguments for hyphenation
+ ::com::sun::star::beans::PropertyValues aHyphVals;
+
+ SwLineLayout *pRoot; // die Root der aktuellen Zeile (pCurr)
+ SwLinePortion *pLast; // die letzte Portion
+ SwFlyPortion *pFly; // die nachfolgende FlyPortion
+ SwFldPortion *pLastFld; // umgebrochenes Feld
+ SwLinePortion *pUnderFlow; // Unterlaufsituation: letzte Portion
+ SwLinePortion *pRest; // Rest ist der Beginn der naechsten Zeile
+
+ SwTabPortion *pLastTab; // die _letzte_ TabPortion
+
+ xub_StrLen nSoftHyphPos; // SoftHyphPos fuer Hyphenate
+ xub_StrLen nHyphStart; // TxtPos, an der die interakt.Tr.z.Z. steht
+ xub_StrLen nHyphWrdStart; // gefundene Wort-Position
+ xub_StrLen nHyphWrdLen; // gefundene Wort-Laenge
+ xub_StrLen nLineStart; // aktueller Zeilenbeginn im rTxt
+ xub_StrLen nUnderScorePos; // enlarge repaint if underscore has been found
+ KSHORT nLeft; // linker Rand
+ KSHORT nRight; // rechter Rand
+ KSHORT nFirst; // EZE
+ KSHORT nRealWidth; // "echte" Zeilenbreite
+ KSHORT nWidth; // "virtuelle" Zeilenbreite
+ KSHORT nLineHeight; // endgueltige Hoehe nach CalcLine
+ KSHORT nLineNettoHeight; // line height without spacing
+ KSHORT nForcedLeftMargin; // Verschiebung des linken Rands wg. Rahmen
+
+ INT16 nMinLeading; // minimum number of chars before hyphenation point
+ INT16 nMinTrailing; // minimum number of chars after hyphenation point
+ INT16 nMinWordLength; // minimum length of word to be hyphenated
+
+ sal_Bool bFull : 1; // Zeile ist voll
+ sal_Bool bFtnDone : 1; // Ftn bereits formatiert
+ sal_Bool bErgoDone : 1; // ErgoDone bereits formatiert
+ sal_Bool bNumDone : 1; // bNumDone bereits formatiert
+ sal_Bool bStop : 1; // Sofort abbrechen, Zeile verwerfen.
+ sal_Bool bNewLine : 1; // Noch eine weitere Zeile formatieren.
+ sal_Bool bShift : 1; // Positionsaend.: Repaint bis auf Weiteres
+ sal_Bool bUnderFlow : 1; // Kontext: UnderFlow() ?
+ sal_Bool bInterHyph: 1; // interaktive Trennung ?
+ sal_Bool bAutoHyph : 1; // automatische Trennung ?
+ sal_Bool bDropInit : 1; // DropWidth einstellen.
+ sal_Bool bQuick : 1; // FormatQuick()
+ sal_Bool bNoEndHyph : 1; // Trennung am Zeilenende abgeschaltet wg. MaxHyphens
+ sal_Bool bNoMidHyph : 1; // Trennung vor Flies abgeschaltet wg. MaxHyphens
+ sal_Bool bIgnoreFly: 1; // FitToContent ignoriert Flies
+ sal_Bool bFakeLineStart: 1; // String has been replaced by field portion
+ // info structure only pretends that we are at
+ // the beginning of a line
+
+ xub_Unicode cTabDecimal; // das _aktuelle_ Dezimalzeichen
+ xub_Unicode cHookChar; // fuer Tabs in Feldern etc.
+ sal_uInt8 nMaxHyph; // max. Zeilenanz. aufeinanderfolg. Trenn.
+ sal_Bool bTestFormat; // Testformatierung aus WouldFit, keine Benachrichtigungen etc.
+
+ // Hyphenating ...
+ sal_Bool InitHyph( const sal_Bool bAuto = sal_False );
+ sal_Bool _CheckFtnPortion( SwLineLayout* pCurr );
+
+public:
+ void CtorInit( SwTxtFrm *pFrm, const sal_Bool bInterHyph = sal_False,
+ const sal_Bool bQuick = sal_False, const sal_Bool bTst = sal_False );
+ inline SwTxtFormatInfo(SwTxtFrm *pFrame,const sal_Bool _bInterHyph=sal_False,
+ const sal_Bool _bQuick = sal_False, const sal_Bool bTst = sal_False )
+ { CtorInit( pFrame, _bInterHyph, _bQuick, bTst ); }
+
+ // For the formatting inside a double line in a line (multi-line portion)
+ // we need a modified text-format-info:
+
+ inline KSHORT Width() const { return nWidth; }
+ inline void Width( const KSHORT nNew ) { nWidth = nNew; }
+ void Init();
+
+ // liefert die erste veraenderte Position im Absatz zurueck
+ inline xub_StrLen GetReformatStart() const;
+
+ // Raender
+ inline KSHORT Left() const { return nLeft; }
+ inline void Left( const KSHORT nNew ) { nLeft = nNew; }
+ inline KSHORT Right() const { return nRight; }
+ inline void Right( const KSHORT nNew ) { nRight = nNew; }
+ inline KSHORT First() const { return nFirst; }
+ inline void First( const KSHORT nNew ) { nFirst = nNew; }
+ inline KSHORT CurrLeft() const { return (nLineStart ? nLeft : nFirst); }
+ inline KSHORT RealWidth() const { return nRealWidth; }
+ inline void RealWidth( const KSHORT nNew ) { nRealWidth = nNew; }
+ inline KSHORT ForcedLeftMargin() const { return nForcedLeftMargin; }
+ inline void ForcedLeftMargin( const KSHORT nN ) { nForcedLeftMargin = nN; }
+
+ inline sal_uInt8 &MaxHyph() { return nMaxHyph; }
+ inline const sal_uInt8 &MaxHyph() const { return nMaxHyph; }
+
+ inline SwLineLayout *GetRoot() { return pRoot; }
+ inline const SwLineLayout *GetRoot() const { return pRoot; }
+
+ inline void SetRoot( SwLineLayout *pNew ) { pRoot = pNew; }
+ inline SwLinePortion *GetLast() { return pLast; }
+ inline void SetLast( SwLinePortion *pNewLast ) { pLast = pNewLast; }
+ inline sal_Bool IsFull() const { return bFull; }
+ inline void SetFull( const sal_Bool bNew ) { bFull = bNew; }
+ inline sal_Bool IsHyphForbud() const
+ { return pFly ? bNoMidHyph : bNoEndHyph; }
+ inline void SetHyphForbud( const sal_Bool bNew )
+ { if ( pFly ) bNoMidHyph = bNew; else bNoEndHyph = bNew; }
+ inline void ChkNoHyph( const sal_uInt8 bEnd, const sal_uInt8 bMid )
+ { bNoEndHyph = (nMaxHyph && bEnd >= nMaxHyph);
+ bNoMidHyph = (nMaxHyph && bMid >= nMaxHyph); }
+ inline sal_Bool IsIgnoreFly() const { return bIgnoreFly; }
+ inline void SetIgnoreFly( const sal_Bool bNew ) { bIgnoreFly = bNew; }
+ inline sal_Bool IsFakeLineStart() const { return bFakeLineStart; }
+ inline void SetFakeLineStart( const sal_Bool bNew ) { bFakeLineStart = bNew; }
+ inline sal_Bool IsStop() const { return bStop; }
+ inline void SetStop( const sal_Bool bNew ) { bStop = bNew; }
+ inline SwLinePortion *GetRest() { return pRest; }
+ inline void SetRest( SwLinePortion *pNewRest ) { pRest = pNewRest; }
+ inline sal_Bool IsNewLine() const { return bNewLine; }
+ inline void SetNewLine( const sal_Bool bNew ) { bNewLine = bNew; }
+ inline sal_Bool IsShift() const { return bShift; }
+ inline void SetShift( const sal_Bool bNew ) { bShift = bNew; }
+ inline sal_Bool IsInterHyph() const { return bInterHyph; }
+ inline sal_Bool IsAutoHyph() const { return bAutoHyph; }
+ inline sal_Bool IsUnderFlow() const { return bUnderFlow; }
+ inline void ClrUnderFlow() { bUnderFlow = sal_False; }
+ inline sal_Bool IsDropInit() const { return bDropInit; }
+ inline void SetDropInit( const sal_Bool bNew ) { bDropInit = bNew; }
+ inline sal_Bool IsQuick() const { return bQuick; }
+ inline sal_Bool IsTest() const { return bTestFormat; }
+
+ inline xub_StrLen GetLineStart() const { return nLineStart; }
+ inline void SetLineStart( const xub_StrLen nNew ) { nLineStart = nNew; }
+
+ // these are used during fly calculation
+ inline KSHORT GetLineHeight() const { return nLineHeight; }
+ inline void SetLineHeight( const KSHORT nNew ) { nLineHeight = nNew; }
+ inline KSHORT GetLineNettoHeight() const { return nLineNettoHeight; }
+ inline void SetLineNettoHeight( const KSHORT nNew ) { nLineNettoHeight = nNew; }
+
+ inline const SwLinePortion *GetUnderFlow() const { return pUnderFlow; }
+ inline SwLinePortion *GetUnderFlow() { return pUnderFlow; }
+ inline void SetUnderFlow( SwLinePortion *pNew )
+ { pUnderFlow = pNew; bUnderFlow = sal_True; }
+ inline xub_StrLen GetSoftHyphPos() const { return nSoftHyphPos; }
+ inline void SetSoftHyphPos( const xub_StrLen nNew ) { nSoftHyphPos = nNew; }
+
+ inline void SetParaFtn();
+
+ // FlyFrms
+ inline SwFlyPortion *GetFly() { return pFly; }
+ inline void SetFly( SwFlyPortion *pNew ) { pFly = pNew; }
+
+ inline const SwAttrSet& GetCharAttr() const;
+
+ // Tabs
+ inline SwTabPortion *GetLastTab() { return pLastTab; }
+ inline void SetLastTab( SwTabPortion *pNew ) { pLastTab = pNew; }
+ inline xub_Unicode GetTabDecimal() const { return cTabDecimal; }
+ inline void SetTabDecimal( const xub_Unicode cNew ) { cTabDecimal = cNew;}
+
+ // Last*
+ inline SwFldPortion *GetLastFld() { return pLastFld; }
+ inline void SetLastFld( SwFldPortion *pNew ) { pLastFld = pNew; }
+
+ inline void ClearHookChar() { cHookChar = 0; }
+ inline void SetHookChar( const xub_Unicode cNew ) { cHookChar = cNew; }
+ inline xub_Unicode GetHookChar() const { return cHookChar; }
+
+ // Done-Flags
+ inline sal_Bool IsFtnDone() const { return bFtnDone; }
+ inline void SetFtnDone( const sal_Bool bNew ) { bFtnDone = bNew; }
+ inline sal_Bool IsErgoDone() const { return bErgoDone; }
+ inline void SetErgoDone( const sal_Bool bNew ) { bErgoDone = bNew; }
+ inline sal_Bool IsNumDone() const { return bNumDone; }
+ inline void SetNumDone( const sal_Bool bNew ) { bNumDone = bNew; }
+ inline sal_Bool IsArrowDone() const { return bArrowDone; }
+ inline void SetArrowDone( const sal_Bool bNew ) { bArrowDone = bNew; }
+
+ // Fuer SwTxtPortion::Hyphenate
+ inline sal_Bool IsSoftHyph( const xub_StrLen nPos ) const;
+ sal_Bool ChgHyph( const sal_Bool bNew );
+
+ // Soll die Trennhilfe angeschmissen werden?
+ sal_Bool IsHyphenate() const;
+ inline void SetHyphStart( const xub_StrLen nNew ) { nHyphStart = nNew; }
+ inline xub_StrLen GetHyphStart() const { return nHyphStart; }
+ inline void SetHyphWrdStart( const xub_StrLen nNew ) { nHyphWrdStart = nNew; }
+ inline xub_StrLen GetHyphWrdStart() const { return nHyphWrdStart; }
+ inline void SetHyphWrdLen( const xub_StrLen nNew ) { nHyphWrdLen = nNew; }
+ inline xub_StrLen GetHyphWrdLen() const { return nHyphWrdLen; }
+ inline xub_StrLen GetUnderScorePos() const { return nUnderScorePos; }
+ inline void SetUnderScorePos( xub_StrLen nNew ) { nUnderScorePos = nNew; }
+
+ // ruft HyphenateWord() des Hyphenators
+ const ::com::sun::star::beans::PropertyValues &
+ GetHyphValues() const;
+
+ sal_Bool CheckFtnPortion( SwLineLayout* pCurr )
+ { return IsFtnInside() && _CheckFtnPortion( pCurr ); }
+
+ // Dropcaps vom SwTxtFormatter::CTOR gerufen.
+ const SwFmtDrop *GetDropFmt() const;
+
+ // setzt die FormatInfo wieder in den Anfangszustand
+ void Reset( const SwTxtFrm *pFrame); // , const sal_Bool bAll );
+
+ // Sets the last SwKernPortion as pLast, if it is followed by empty portions
+ BOOL LastKernPortion();
+
+ // Sucht ab nIdx bis nEnd nach Tabs, TabDec, TXTATR und BRK.
+ // Return: gefundene Position, setzt ggf. cHookChar
+ xub_StrLen ScanPortionEnd( const xub_StrLen nStart, const xub_StrLen nEnd );
+
+// friend ostream &operator<<( ostream &rOS, const SwTxtFormatInfo &rInf );
+ friend SvStream &operator<<( SvStream &rOS, const SwTxtFormatInfo &rInf );
+};
+
+/*************************************************************************
+ * class SwTxtSlot
+ *************************************************************************/
+
+// Fuer die Textersetzung und Restaurierung der SwTxtSizeInfo.
+// Die Art und Weise ist etwas kriminell, rInf ist const und wird
+// trotzdem veraendert. Da rInf im DTOR wieder restauriert wird,
+// ist dies zulaessig, es handelt sich um ein "logisches const".
+// Die beiden Klassen SwTxtSlot und SwTxtSlotLen sind Zwillinge, sie
+// unterscheiden sich nur im Ctor in der Zuweisung der Textlaenge
+// an pInf. Aenderungen muessen in beiden gepflegt werden!
+
+class SwTxtSlot
+{
+ const XubString *pOldTxt;
+ XubString aTxt;
+ xub_StrLen nIdx;
+ xub_StrLen nLen;
+ sal_Bool bOn;
+protected:
+ SwTxtSizeInfo *pInf;
+public:
+ SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor );
+ ~SwTxtSlot();
+ inline sal_Bool IsOn() const { return bOn; }
+};
+
+class SwTxtSlotLen
+{
+ const XubString *pOldTxt;
+ XubString aTxt;
+ xub_StrLen nIdx;
+ xub_StrLen nLen;
+ sal_Bool bOn;
+protected:
+ SwTxtSizeInfo *pInf;
+public:
+ // Der Ersetzungstring kommt wahlweise aus der Portion via GetExpText()
+ // oder aus dem char Pointer pCh, wenn dieser ungleich NULL ist.
+ SwTxtSlotLen( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor,
+ const sal_Char *pCh = NULL );
+ ~SwTxtSlotLen();
+ inline sal_Bool IsOn() const { return bOn; }
+};
+
+/*************************************************************************
+ * class SwFontSave
+ *************************************************************************/
+
+class SwFontSave
+{
+ SwTxtSizeInfo *pInf;
+ SwFont *pFnt;
+ SwAttrIter *pIter;
+public:
+ SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pFnt,
+ SwAttrIter* pItr = NULL );
+ ~SwFontSave();
+};
+
+/*************************************************************************
+ * class SwDefFontSave
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwFtnSave
+ *************************************************************************/
+
+class SwFtnSave
+{
+ SwTxtSizeInfo *pInf;
+ SwFont *pFnt;
+ SwFont *pOld;
+public:
+ SwFtnSave( const SwTxtSizeInfo &rInf, const SwTxtFtn *pTxtFtn );
+ ~SwFtnSave();
+};
+
+/*************************************************************************
+ * Inline-Implementierungen SwTxtSizeInfo
+ *************************************************************************/
+
+inline KSHORT SwTxtSizeInfo::GetAscent() const
+{
+ return ((SwFont*)GetFont())->GetAscent( pVsh, GetOut() );
+}
+
+inline KSHORT SwTxtSizeInfo::GetTxtHeight() const
+{
+ return ((SwFont*)GetFont())->GetHeight( pVsh, GetOut() );
+}
+
+inline SwPosSize SwTxtSizeInfo::GetTxtSize( const XubString &rTxt ) const
+{
+ return GetTxtSize( pOut, 0, rTxt, 0, rTxt.Len(), 0 );
+}
+
+inline SwPosSize SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI,
+ const xub_StrLen nNewIdx,
+ const xub_StrLen nNewLen,
+ const USHORT nCompress ) const
+{
+ return GetTxtSize( pOut, pSI, *pTxt, nNewIdx, nNewLen, nCompress );
+}
+
+/*************************************************************************
+ * Inline-Implementierungen SwTxtPaintInfo
+ *************************************************************************/
+
+inline SwTwips SwTxtPaintInfo::GetPaintOfst() const
+{
+ return GetParaPortion()->GetRepaint()->GetOfst();
+}
+
+inline void SwTxtPaintInfo::SetPaintOfst( const SwTwips nNew )
+{
+ GetParaPortion()->GetRepaint()->SetOfst( nNew );
+}
+
+
+inline void SwTxtPaintInfo::DrawText( const XubString&,
+ const SwLinePortion&,
+ const xub_StrLen , const xub_StrLen,
+ const sal_Bool ) const
+{
+ DBG_BF_ASSERT(0, "STRIP");
+}
+
+inline void SwTxtPaintInfo::DrawText( const SwLinePortion&,
+ const xub_StrLen, const sal_Bool ) const
+{
+ DBG_BF_ASSERT(0, "STRIP");
+}
+
+inline void SwTxtPaintInfo::DrawWrongText( const SwLinePortion&,
+ const xub_StrLen, const sal_Bool ) const
+{
+ DBG_BF_ASSERT(0, "STRIP");
+}
+
+/*************************************************************************
+ * Inline-Implementierungen SwTxtFormatInfo
+ *************************************************************************/
+
+inline xub_StrLen SwTxtFormatInfo::GetReformatStart() const
+{
+ return GetParaPortion()->GetReformat()->Start();
+}
+
+inline const SwAttrSet& SwTxtFormatInfo::GetCharAttr() const
+{
+ return GetTxtFrm()->GetTxtNode()->GetSwAttrSet();
+}
+
+inline void SwTxtFormatInfo::SetParaFtn()
+{
+ GetTxtFrm()->SetFtn( sal_True );
+}
+
+inline sal_Bool SwTxtFormatInfo::IsSoftHyph( const xub_StrLen nPos ) const
+{
+ return CHAR_SOFTHYPHEN == GetTxtFrm()->GetTxtNode()->GetTxt().GetChar(nPos);
+}
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/itratr.hxx b/binfilter/bf_sw/source/core/text/itratr.hxx
new file mode 100644
index 000000000000..4f58e38cbab7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/itratr.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ITRATR_HXX
+#define _ITRATR_HXX
+
+
+#include <tools/solar.h>
+#include <atrhndl.hxx>
+
+#include "txttypes.hxx"
+#include "swfont.hxx"
+#include "porlay.hxx"
+
+#define _SVSTDARR_XUB_STRLEN
+#define _SVSTDARR_USHORTS
+#include <bf_svtools/svstdarr.hxx>
+class OutputDevice;
+namespace binfilter {
+
+
+class SwFont;
+class SwpHints;
+class SwTxtAttr;
+class SwAttrSet;
+class SwTxtNode;
+class SwRedlineItr;
+class ViewShell;
+
+#ifdef VERTICAL_LAYOUT
+class SwTxtFrm;
+#endif
+
+/*************************************************************************
+ * class SwAttrIter
+ *************************************************************************/
+
+class SwAttrIter
+{
+ friend class SwFontSave;
+protected:
+
+ SwAttrHandler aAttrHandler;
+ ViewShell *pShell;
+ SwFont *pFnt;
+ SwpHints *pHints;
+ const SwAttrSet* pAttrSet; // das Char-Attribut-Set
+ SwScriptInfo* pScriptInfo;
+
+private:
+ OutputDevice *pLastOut;
+ MSHORT nChgCnt;
+ SwRedlineItr *pRedln;
+ xub_StrLen nStartIndex, nEndIndex, nPos;
+ BYTE nPropFont;
+ void SeekFwd( const xub_StrLen nPos );
+ inline void SetFnt( SwFont* pNew ) { pFnt = pNew; }
+ const void* aMagicNo[ SW_SCRIPTS ];
+ MSHORT aFntIdx[ SW_SCRIPTS ];
+
+protected:
+ void Chg( SwTxtAttr *pHt );
+ void Rst( SwTxtAttr *pHt );
+#ifdef VERTICAL_LAYOUT
+ void CtorInit( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm = 0 );
+#else
+ void CtorInit( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf );
+#endif
+ inline SwAttrIter()
+ : pFnt(0), pLastOut(0), nChgCnt(0), nPropFont(0), pShell(0), pRedln(0){}
+
+public:
+ // Konstruktor, Destruktor
+ inline SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf )
+ : pFnt(0), pLastOut(0), nChgCnt(0), nPropFont(0), pShell(0), pRedln(0)
+ { CtorInit( rTxtNode, rScrInf ); }
+
+ virtual ~SwAttrIter();
+
+ inline SwRedlineItr *GetRedln() { return pRedln; }
+ // Liefert im Parameter die Position des naechsten Wechsels vor oder an
+ // der uebergebenen Characterposition zurueck. Liefert sal_False, wenn vor
+ // oder an dieser Position kein Wechsel mehr erfolgt, sal_True sonst.
+ xub_StrLen GetNextAttr( ) const;
+ // Macht die an der Characterposition i gueltigen Attribute im
+ // logischen Font wirksam.
+ sal_Bool Seek( const xub_StrLen nPos );
+ // Bastelt den Font an der gew. Position via Seek und fragt ihn,
+ // ob er ein Symbolfont ist.
+ sal_Bool IsSymbol( const xub_StrLen nPos );
+
+ // Fuehrt ChgPhysFnt aus, wenn Seek() sal_True zurueckliefert.
+ sal_Bool SeekAndChg( const xub_StrLen nPos, OutputDevice *pOut );
+ sal_Bool SeekStartAndChg( OutputDevice *pOut, const sal_Bool bParaFont = sal_False );
+
+ // Gibt es ueberhaupt Attributwechsel ?
+ inline sal_Bool HasHints() const { return 0 != pHints; }
+
+ // liefert fuer eine Position das Attribut
+ SwTxtAttr *GetAttr( const xub_StrLen nPos ) const;
+
+ inline const SwAttrSet* GetAttrSet() const { return pAttrSet; }
+
+ inline const SwpHints *GetHints() const { return pHints; }
+
+ inline SwFont *GetFnt() { return pFnt; }
+ inline const SwFont *GetFnt() const { return pFnt; }
+
+ inline BYTE GetPropFont() const { return nPropFont; }
+ inline void SetPropFont( const BYTE nNew ) { nPropFont = nNew; }
+
+ inline SwAttrHandler& GetAttrHandler() { return aAttrHandler; }
+};
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/itrform2.hxx b/binfilter/bf_sw/source/core/text/itrform2.hxx
new file mode 100644
index 000000000000..a104222b314e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/itrform2.hxx
@@ -0,0 +1,214 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ITRFORM2_HXX
+#define _ITRFORM2_HXX
+
+#include "itrpaint.hxx"
+class SvLongs;
+namespace binfilter {
+
+class SwFlyCntPortion;
+class SwInterHyphInfo;
+class SwDropPortion;
+class SwFmtDrop;
+class SwDrawObjs;
+class SwTxtAttr;
+class SwNumberPortion;
+class SwErgoSumPortion;
+class SwExpandPortion;
+class SwMultiPortion;
+
+
+/*************************************************************************
+ * class SwTxtFormatter
+ *************************************************************************/
+
+class SwTxtFormatter : public SwTxtPainter
+{
+ const SwFmtDrop *pDropFmt;
+ SwMultiPortion* pMulti; // during formatting a multi-portion
+ sal_uInt8 nCntEndHyph; // zaehlt aufeinanderfolgende Hyphens am Zeilenende
+ sal_uInt8 nCntMidHyph; // zaehlt aufeinanderfolgende Hyphens vor Flies
+ xub_StrLen nLeftScanIdx; // for increasing performance during
+ xub_StrLen nRightScanIdx; // scanning for portion ends
+ sal_Bool bOnceMore : 1; // noch 'ne Runde?
+ sal_Bool bFlyInCntBase : 1; // Base-Referenz der zeichengeb. Rahmen setzen
+ sal_Bool bChanges : 1; // Flag, fuer die Berechnung des Repaint-Rechtecks
+ sal_Bool bTruncLines : 1; // Flag, Repaint-Rechtecks ggf. erweitern
+ sal_Bool bUnclipped : 1; // Flag, ob Repaint groesser als feste Zeilenhoehe
+ SwLinePortion *NewPortion( SwTxtFormatInfo &rInf );
+ SwTxtPortion *NewTxtPortion( SwTxtFormatInfo &rInf );
+ SwLinePortion *NewExtraPortion( SwTxtFormatInfo &rInf );
+ SwTabPortion *NewTabPortion( SwTxtFormatInfo &rInf ) const;
+ SwNumberPortion *NewNumberPortion( SwTxtFormatInfo &rInf ) const;
+ SwDropPortion *NewDropPortion( SwTxtFormatInfo &rInf );
+ SwNumberPortion *NewFtnNumPortion( SwTxtFormatInfo &rInf ) const;
+ SwErgoSumPortion *NewErgoSumPortion( SwTxtFormatInfo &rInf ) const;
+ SwExpandPortion *NewFldPortion( SwTxtFormatInfo &rInf,
+ const SwTxtAttr *pHt ) const;
+ SwFtnPortion *NewFtnPortion( SwTxtFormatInfo &rInf, SwTxtAttr *pHt );
+ SwFlyCntPortion *NewFlyCntPortion( SwTxtFormatInfo &rInf,
+ SwTxtAttr *pHt ) const;
+ SwLinePortion *WhichFirstPortion( SwTxtFormatInfo &rInf );
+ SwTxtPortion *WhichTxtPor( SwTxtFormatInfo &rInf ) const;
+
+ // Das Herzstueck der Formatierung
+ void BuildPortions( SwTxtFormatInfo &rInf );
+
+ // Berechnung des emulierten rechten Rands
+ void CalcFlyWidth( SwTxtFormatInfo &rInf );
+
+ // wird von SwTxtFormatter wegen UpdatePos ueberladen
+ void CalcAdjustLine( SwLineLayout *pCurr );
+
+ // consideres line spacing attributes
+ void CalcRealHeight( sal_Bool bNewLine = sal_False );
+
+ // uebertraegt die Daten nach rInf
+ void FeedInf( SwTxtFormatInfo &rInf ) const;
+
+ // behandelt die Unterlaufsituationen
+ SwLinePortion *UnderFlow( SwTxtFormatInfo &rInf );
+
+ // errechnet den Ascent und die Hoehe aus der Fontmetric
+ void CalcAscent( SwTxtFormatInfo &rInf, SwLinePortion *pPor );
+
+ // determines, if a optimized repaint rectange is allowed
+ sal_Bool AllowRepaintOpt() const;
+
+ // calculates and sets the optimized repaint offset
+ long CalcOptRepaint( xub_StrLen nOldLineEnd, const SvLongs* pFlyStart );
+
+ // wird von FormatLine gerufen.
+ void FormatReset( SwTxtFormatInfo &rInf );
+
+ // durch das Adjustment aendert sich die Position der Portions
+ void UpdatePos( SwLineLayout *pCurr, Point aStart, xub_StrLen nStartIdx,
+ sal_Bool bAllWays = sal_False ) const;
+
+ // Setze alle FlyInCntFrms auf die uebergebene BaseLine
+ void AlignFlyInCntBase( long nBaseLine ) const;
+
+ // Unterlaufbedingungen bei Flys
+ sal_Bool ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const;
+
+ // Portion einfuegen.
+ void InsertPortion( SwTxtFormatInfo &rInf, SwLinePortion *pPor ) const;
+
+ // schaetzt die Hoehe fuer die DropPortion
+ void GuessDropHeight( const MSHORT nLines );
+
+public:
+ // errechnet die Hoehe fuer die DropPortion
+ void CalcDropHeight( const MSHORT nLines );
+
+ // errechnet den Bottom des Absatzes, beruecksichtigt an diesem verankerte
+ // Objekte mit Umlauf 1. Absatz.
+ SwTwips CalcBottomLine() const;
+
+ // Beruecksichtigt zeichengebundene Objekte bei der Repaintrechteck-
+ // berechnung in Zeilen mit fester Zeilenhoehe
+ void CalcUnclipped( SwTwips& rTop, SwTwips& rBottom );
+
+ // u.a. fuer DropCaps
+ sal_Bool CalcOnceMore();
+
+ void CtorInit( SwTxtFrm *pFrm, SwTxtFormatInfo *pInf );
+ inline SwTxtFormatter( SwTxtFrm *pFrm, SwTxtFormatInfo *pInf )
+ { CtorInit( pFrm, pInf ); }
+ ~SwTxtFormatter();
+
+ xub_StrLen FormatLine( const xub_StrLen nStart );
+
+ void RecalcRealHeight();
+
+ // Wir formatieren eine Zeile fuer die interaktive Trennung
+
+ // Spezialmethode fuer QuoVadis-Texte
+ // nErgo ist die Seitennummer der ErgoSum-Ftn
+ // Bei 0 ist es noch unklar.
+ xub_StrLen FormatQuoVadis( const xub_StrLen nStart );
+
+ // Die Notbremse: Formatierung abbrechen, Zeile verwerfen.
+ inline sal_Bool IsStop() const { return GetInfo().IsStop(); }
+
+ // Das Gegenstueck: Formatierung unbedingt fortsetzen.
+ inline sal_Bool IsNewLine() const { return GetInfo().IsNewLine(); }
+
+ // FormatQuick(); auffrischen von Formatinformationen
+ inline sal_Bool IsQuick() const { return GetInfo().IsQuick(); }
+
+ // erzeugt ggfs. ein SwLineLayout, dass Ftn/Fly--Oszillation unterbindet.
+
+ // SwTxtIter-Funktionalitaet
+ void Insert( SwLineLayout *pLine );
+
+ // die noch verbleibende Hoehe bis zum Seitenrand
+
+ // Wie breit waerest Du ohne rechte Begrenzungen (Flys etc.)?
+
+ SwLinePortion* MakeRestPortion(const SwLineLayout* pLine, xub_StrLen nPos);
+
+ inline const SwFmtDrop *GetDropFmt() const { return pDropFmt; }
+ inline void ClearDropFmt() { pDropFmt = 0; }
+
+ inline SwMultiPortion *GetMulti() const { return pMulti; }
+
+ inline sal_Bool IsOnceMore() const { return bOnceMore; }
+ inline void SetOnceMore( sal_Bool bNew ) { bOnceMore = bNew; }
+
+ inline sal_Bool HasChanges() const { return bChanges; }
+ inline void SetChanges() { bChanges = sal_True; }
+
+ inline sal_Bool HasTruncLines() const { return bTruncLines; }
+ inline void SetTruncLines( sal_Bool bNew ) { bTruncLines = bNew; }
+
+ inline sal_Bool IsUnclipped() const { return bUnclipped; }
+ inline void SetUnclipped( sal_Bool bNew ) { bUnclipped = bNew; }
+
+ inline sal_Bool IsFlyInCntBase() const { return bFlyInCntBase; }
+ inline void SetFlyInCntBase( sal_Bool bNew = sal_True ){ bFlyInCntBase = bNew; }
+
+ inline SwTxtFormatInfo &GetInfo()
+ { return (SwTxtFormatInfo&)SwTxtIter::GetInfo(); }
+ inline const SwTxtFormatInfo &GetInfo() const
+ { return (const SwTxtFormatInfo&)SwTxtIter::GetInfo(); }
+
+ inline void InitCntHyph() { CntHyphens( nCntEndHyph, nCntMidHyph ); }
+ inline const sal_uInt8 &CntEndHyph() const { return nCntEndHyph; }
+ inline const sal_uInt8 &CntMidHyph() const { return nCntMidHyph; }
+ inline sal_uInt8 &CntEndHyph() { return nCntEndHyph; }
+ inline sal_uInt8 &CntMidHyph() { return nCntMidHyph; }
+};
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/itrpaint.hxx b/binfilter/bf_sw/source/core/text/itrpaint.hxx
new file mode 100644
index 000000000000..ba0fecb3f8f6
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/itrpaint.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ITRPAINT_HXX
+#define _ITRPAINT_HXX
+
+#include "itrtxt.hxx"
+namespace binfilter {
+
+class SwSaveClip; // SwTxtPainter
+class SwMultiPortion;
+
+/*************************************************************************
+ * class SwTxtPainter
+ *************************************************************************/
+
+class SwTxtPainter : public SwTxtCursor
+{
+ sal_Bool bPaintDrop;
+
+protected:
+ void CtorInit( SwTxtFrm *pFrm, SwTxtPaintInfo *pInf );
+ inline SwTxtPainter() { }
+public:
+ inline SwTxtPainter( SwTxtFrm *pFrm, SwTxtPaintInfo *pInf )
+ { CtorInit( pFrm, pInf ); }
+ // if PaintMultiPortion is called recursively, we have to pass the
+ // surrounding SwBidiPortion
+ inline void SetPaintDrop( const sal_Bool bNew ) { bPaintDrop = bNew; }
+ inline int IsPaintDrop() const { return bPaintDrop; }
+ inline SwTxtPaintInfo &GetInfo()
+ { return (SwTxtPaintInfo&)SwTxtIter::GetInfo(); }
+ inline const SwTxtPaintInfo &GetInfo() const
+ { return (const SwTxtPaintInfo&)SwTxtIter::GetInfo(); }
+};
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/itrtxt.hxx b/binfilter/bf_sw/source/core/text/itrtxt.hxx
new file mode 100644
index 000000000000..8d8847dbe6c2
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/itrtxt.hxx
@@ -0,0 +1,358 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ITRTXT_HXX
+#define _ITRTXT_HXX
+
+#include "swtypes.hxx"
+#include "itratr.hxx"
+#include "inftxt.hxx"
+namespace binfilter {
+
+class SwTxtFrm;
+struct SwPosition;
+struct SwCrsrMoveState;
+class SwMarginPortion;
+class SwFlyPortion;
+
+/*************************************************************************
+ * class SwTxtIter
+ *************************************************************************/
+
+class SwTxtIter : public SwAttrIter
+{
+protected:
+ SwLineInfo aLineInf;
+#ifndef VERTICAL_LAYOUT
+ Point aTopLeft; // erste Ausgabeposition
+#endif
+ SwTxtFrm *pFrm;
+ SwTxtInfo *pInf;
+ SwLineLayout *pCurr;
+ SwLineLayout *pPrev;
+#ifdef VERTICAL_LAYOUT
+ SwTwips nFrameStart;
+#endif
+ SwTwips nY;
+ SwTwips nRegStart; // Anfangsposition (Y) des Registers
+ xub_StrLen nStart; // Start im Textstring, Ende = pCurr->GetLen()
+ KSHORT nRegDiff; // Zeilenabstand des Registers
+ MSHORT nLineNr; // Zeilennummer
+ sal_Bool bPrev : 1;
+ sal_Bool bRegisterOn : 1; // Registerhaltigkeit
+ sal_Bool bOneBlock : 1; // Blocksatz: Einzelwoerter austreiben
+ sal_Bool bLastBlock : 1; // Blocksatz: Auch die letzte Zeile
+ sal_Bool bLastCenter : 1; // Blocksatz: Letzte Zeile zentrieren
+
+ SwLineLayout *_GetPrev();
+
+ // Zuruecksetzen in die erste Zeile.
+ void Init();
+ void CtorInit( SwTxtFrm *pFrm, SwTxtInfo *pInf );
+ inline SwTxtIter() { }
+
+public:
+ inline SwTxtIter( SwTxtFrm *pFrm, SwTxtInfo *pInf )
+ { CtorInit( pFrm, pInf ); }
+ inline const SwLineLayout *GetCurr() const { return pCurr; } // niemals 0!
+ inline const SwLineLayout *GetNext() const { return pCurr->GetNext(); }
+ const SwLineLayout *GetPrev();
+ inline xub_StrLen GetLength() const { return pCurr->GetLen(); }
+ inline MSHORT GetLineNr() const { return nLineNr; }
+ inline xub_StrLen GetStart() const { return nStart; }
+ inline xub_StrLen GetEnd() const { return GetStart() + GetLength(); }
+ inline SwTwips Y() const { return nY; }
+
+ inline SwTwips RegStart() const { return nRegStart; }
+ inline KSHORT RegDiff() const { return nRegDiff; }
+ inline sal_Bool IsRegisterOn() const { return bRegisterOn; }
+
+ inline SwTxtInfo &GetInfo() { return *pInf; }
+ inline const SwTxtInfo &GetInfo() const { return *pInf; }
+
+ inline void Top() { Init(); }
+ void Bottom();
+ const SwLineLayout *Next();
+ const SwLineLayout *Prev();
+
+ // Ueberspringt die Dummyzeilen der FlyFrms
+ const SwLineLayout *NextLine();
+ const SwLineLayout *PrevLine();
+ const SwLineLayout *GetNextLine() const;
+ const SwLineLayout *GetPrevLine();
+
+ void CharToLine( const xub_StrLen );
+ const SwLineLayout *TwipsToLine(const SwTwips);
+
+ // schneidet ab pCurr alle ab.
+ void TruncLines( sal_Bool bNoteFollow = sal_False );
+
+ inline KSHORT GetLineHeight() const { return pCurr->GetRealHeight(); }
+ void CalcAscentAndHeight( KSHORT &rAscent, KSHORT &rHeight ) const;
+
+ // 5298, viel Aerger durch die Abfrage auf pCurr == pPara
+ inline sal_Bool IsFirstTxtLine() const
+ { return nStart == GetInfo().GetTxtStart() &&
+ !( pCurr->IsDummy() && GetNextLine() ); }
+
+ // Als Ersatz fuer das alte IsFirstLine()
+ inline sal_Bool IsParaLine() const
+ { return pCurr == pInf->GetParaPortion(); }
+
+ const SwLineInfo &GetLineInfo() const { return aLineInf; }
+#ifdef VERTICAL_LAYOUT
+ inline SwTwips GetFirstPos() const { return nFrameStart; }
+#else
+ inline const Point &GetFirstPos() const { return aTopLeft; }
+#endif
+
+ inline sal_Bool SeekAndChg( SwTxtSizeInfo &rInf );
+ inline sal_Bool SeekAndChgBefore( SwTxtSizeInfo &rInf );
+ inline sal_Bool SeekStartAndChg( SwTxtSizeInfo &rInf, const sal_Bool bPara=sal_False );
+
+ inline SwTxtFrm *GetTxtFrm() { return pFrm; }
+ inline const SwTxtFrm *GetTxtFrm() const { return pFrm; }
+
+ // zaehlt aufeinanderfolgende Trennungen, um MaxHyphens einzuhalten
+ void CntHyphens( sal_uInt8 &nEndCnt, sal_uInt8 &nMidCnt) const;
+};
+
+/*************************************************************************
+ * class SwTxtMargin
+ *************************************************************************/
+
+class SwTxtMargin : public SwTxtIter
+{
+private:
+ SwTwips nLeft;
+ SwTwips nRight;
+ SwTwips nFirst;
+ KSHORT nDropLeft;
+ KSHORT nDropHeight;
+ KSHORT nDropDescent;
+ MSHORT nDropLines;
+ MSHORT nAdjust;
+
+protected:
+ // fuer FormatQuoVadis
+ inline void Right( const SwTwips nNew ) { nRight = nNew; }
+ // fuer CalcFlyAdjust
+ inline void SetDropLeft( const KSHORT nNew ) { nDropLeft = nNew; }
+
+ void CtorInit( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf );
+ inline SwTxtMargin() { }
+public:
+ inline SwTxtMargin( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf )
+ { CtorInit( pFrm, pInf ); }
+ inline SwTwips GetLeftMargin() const;
+ inline SwTwips Left() const;
+ inline SwTwips Right() const { return nRight; }
+ inline SwTwips FirstLeft() const { return nFirst; }
+ inline SwTwips CurrWidth() const { return pCurr->PrtWidth(); }
+ SwTwips GetLineStart() const;
+ inline SwTwips GetLineEnd() const { return GetLineStart() + CurrWidth(); }
+ inline Point GetTopLeft() const { return Point( GetLineStart(), Y() ); }
+ inline sal_Bool IsOneBlock() const { return bOneBlock; }
+ inline sal_Bool IsLastBlock() const { return bLastBlock; }
+ inline sal_Bool IsLastCenter() const { return bLastCenter; }
+ inline MSHORT GetAdjust() const { return nAdjust; }
+#ifndef BIDI
+ inline void SetAdjust( const MSHORT nNew ) { nAdjust = nNew; }
+#endif
+ inline KSHORT GetLineWidth() const
+ { return KSHORT( Right() - GetLeftMargin() + 1 ); }
+ inline SwTwips GetLeftMin() const { return nFirst < nLeft ? nFirst : nLeft; }
+ inline sal_Bool HasNegFirst() const { return nFirst < nLeft; }
+
+ // DropCaps
+ inline MSHORT GetDropLines() const { return nDropLines; }
+ inline void SetDropLines( const MSHORT nNew ) { nDropLines = nNew; }
+ inline KSHORT GetDropLeft() const { return nDropLeft; }
+ inline KSHORT GetDropHeight() const { return nDropHeight; }
+ inline void SetDropHeight( const KSHORT nNew ) { nDropHeight = nNew; }
+ inline KSHORT GetDropDescent() const { return nDropDescent; }
+ inline void SetDropDescent( const KSHORT nNew ) { nDropDescent = nNew; }
+ void DropInit();
+
+ // liefert TxtPos fuer Start und Ende der aktuellen Zeile ohne whitespaces
+ // In frminf.cxx implementiert.
+
+ inline SwTxtSizeInfo &GetInfo()
+ { return (SwTxtSizeInfo&)SwTxtIter::GetInfo(); }
+ inline const SwTxtSizeInfo &GetInfo() const
+ { return (const SwTxtSizeInfo&)SwTxtIter::GetInfo(); }
+
+};
+
+
+/*************************************************************************
+ * class SwTxtAdjuster
+ *************************************************************************/
+
+class SwTxtAdjuster : public SwTxtMargin
+{
+ // Gleicht die Portions aus, wenn Adjustment und FlyFrms vorliegen.
+ void CalcFlyAdjust( SwLineLayout *pCurr );
+
+ // ruft SplitGlues und CalcBlockAdjust
+ void FormatBlock( );
+
+ // Erstellt bei kurzen Zeilen die Glue-Kette.
+ SwMarginPortion* CalcRightMargin( SwLineLayout *pCurr, SwTwips nReal = 0 );
+
+ // Berechnung des Adjustments (FlyPortions)
+ SwFlyPortion *CalcFlyPortion( const long nRealWidth,
+ const SwRect &rCurrRect );
+
+protected:
+ inline SwTxtAdjuster() { }
+ // spannt beim Blocksatz die Glues auf.
+ void CalcNewBlock( SwLineLayout *pCurr, const SwLinePortion *pStopAt,
+ SwTwips nReal = 0 );
+public:
+ inline SwTxtAdjuster( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf )
+ { SwTxtMargin::CtorInit( pFrm, pInf ); }
+
+ // wird von SwTxtFormatter wegen UpdatePos ueberladen
+ void CalcAdjLine( SwLineLayout *pCurr );
+
+ // sorgt fuer das nachtraegliche adjustieren
+ inline void GetAdjusted() const
+ {
+ if( pCurr->IsFormatAdj() )
+ ((SwTxtAdjuster*)this)->CalcAdjLine( pCurr );
+ }
+
+ // DropCaps-Extrawurst
+ void CalcDropRepaint();
+};
+
+/*************************************************************************
+ * class SwTxtCursor
+ *************************************************************************/
+
+class SwTxtCursor : public SwTxtAdjuster
+{
+ // A small helper-class to save SwTxtCursor member, manipulate them
+ // and to restore them
+
+ // 1170: Mehrdeutigkeiten
+ static sal_Bool bRightMargin;
+ void _GetCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* );
+protected:
+ void CtorInit( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf );
+ inline SwTxtCursor() { }
+public:
+ inline SwTxtCursor( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf )
+ { CtorInit( pFrm, pInf ); }
+ sal_Bool GetCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* = 0,
+ const long nMax = 0 );
+ sal_Bool GetEndCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* = 0,//STRIP001 sal_Bool GetEndCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* = 0,
+ const long nMax = 0 ){DBG_BF_ASSERT(0, "STRIP"); return FALSE;} ;//STRIP001 const long nMax = 0 );
+ xub_StrLen GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
+ const MSHORT nChgNode, const SwCrsrMoveState* = 0 ) const;
+ // 1170: beruecksichtigt Mehrdeutigkeiten; Implementierung s.u.
+ const SwLineLayout *CharCrsrToLine( const xub_StrLen nPos );
+
+ // calculates baseline for portion rPor
+ // bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE
+#ifdef VERTICAL_LAYOUT
+ USHORT AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
+ USHORT nPorHeight = 0, USHORT nAscent = 0,
+ const sal_Bool bAutoToCentered = sal_False ) const;
+#else
+ USHORT AdjustBaseLine( const SwLineLayout& rLine,
+ const USHORT nPorHeight,
+ const USHORT nPorAscent,
+ const sal_Bool bAutoToCentered = sal_False ) const;
+
+ inline USHORT AdjustBaseLine( const SwLineLayout& rLine,
+ const SwLinePortion& rPor,
+ const sal_Bool bAutoToCentered = sal_False ) const
+ { return AdjustBaseLine( rLine, rPor.Height(),
+ rPor.GetAscent(), bAutoToCentered ); };
+#endif
+
+ static inline void SetRightMargin( const sal_Bool bNew ){ bRightMargin = bNew; }
+ static inline sal_Bool IsRightMargin() { return bRightMargin; }
+};
+
+/*************************************************************************
+ * SwHookOut
+ *
+ * Change current output device to printer, this has to be done before
+ * formatting.
+ *************************************************************************/
+
+class SwHookOut
+{
+ SwTxtSizeInfo* pInf;
+ OutputDevice* pOut;
+ sal_Bool bOnWin;
+public:
+ SwHookOut( SwTxtSizeInfo& rInfo );
+ ~SwHookOut();
+};
+
+/*************************************************************************
+ * Inline-Implementierungen
+ *************************************************************************/
+
+inline sal_Bool SwTxtIter::SeekAndChg( SwTxtSizeInfo &rInf )
+{
+ return SwAttrIter::SeekAndChg( rInf.GetIdx(), rInf.GetOut() );
+}
+
+inline sal_Bool SwTxtIter::SeekAndChgBefore( SwTxtSizeInfo &rInf )
+{
+ if ( rInf.GetIdx() )
+ return SwAttrIter::SeekAndChg( rInf.GetIdx()-1, rInf.GetOut() );
+ else
+ return SwAttrIter::SeekAndChg( rInf.GetIdx(), rInf.GetOut() );
+}
+
+inline sal_Bool SwTxtIter::SeekStartAndChg( SwTxtSizeInfo &rInf, const sal_Bool bPara )
+{
+ return SwAttrIter::SeekStartAndChg( rInf.GetOut(), bPara );
+}
+
+inline SwTwips SwTxtMargin::GetLeftMargin() const
+{
+ return IsFirstTxtLine() ? nFirst : Left();
+}
+
+inline SwTwips SwTxtMargin::Left() const
+{
+ return (nDropLines >= nLineNr && 1 != nLineNr) ? nFirst + nDropLeft : nLeft;
+}
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/makefile.mk b/binfilter/bf_sw/source/core/text/makefile.mk
new file mode 100644
index 000000000000..f60682ce4bb6
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/makefile.mk
@@ -0,0 +1,111 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_text
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+.IF "$(GUI)"!="OS2"
+INCEXT=s:\solar\inc\hm
+.ENDIF
+
+.IF "$(mydebug)" != ""
+CDEFS+=-Dmydebug
+.ENDIF
+
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_atrstck.obj \
+ $(SLO)$/sw_frmcrsr.obj \
+ $(SLO)$/sw_frmform.obj \
+ $(SLO)$/sw_frmpaint.obj \
+ $(SLO)$/sw_guess.obj \
+ $(SLO)$/sw_inftxt.obj \
+ $(SLO)$/sw_itradj.obj \
+ $(SLO)$/sw_itratr.obj \
+ $(SLO)$/sw_itrcrsr.obj \
+ $(SLO)$/sw_itrform2.obj \
+ $(SLO)$/sw_itrpaint.obj \
+ $(SLO)$/sw_itrtxt.obj \
+ $(SLO)$/sw_porexp.obj \
+ $(SLO)$/sw_porfld.obj \
+ $(SLO)$/sw_porfly.obj \
+ $(SLO)$/sw_porglue.obj \
+ $(SLO)$/sw_porlay.obj \
+ $(SLO)$/sw_porlin.obj \
+ $(SLO)$/sw_pormulti.obj \
+ $(SLO)$/sw_porrst.obj \
+ $(SLO)$/sw_portox.obj \
+ $(SLO)$/sw_portxt.obj \
+ $(SLO)$/sw_redlnitr.obj \
+ $(SLO)$/sw_txtcache.obj \
+ $(SLO)$/sw_txtdrop.obj \
+ $(SLO)$/sw_txtfld.obj \
+ $(SLO)$/sw_txtfly.obj \
+ $(SLO)$/sw_txtfrm.obj \
+ $(SLO)$/sw_txtftn.obj \
+ $(SLO)$/sw_txthyph.obj \
+ $(SLO)$/sw_txtinit.obj \
+ $(SLO)$/sw_txttab.obj \
+ $(SLO)$/sw_widorp.obj \
+ $(SLO)$/sw_blink.obj \
+ $(SLO)$/sw_noteurl.obj \
+ $(SLO)$/sw_wrong.obj
+
+.IF "$(dbgutil)" != ""
+SLOFILES += \
+ $(SLO)$/sw_txtio.obj
+.ENDIF
+
+.IF "$(CPUNAME)" == "SPARC"
+.IF "$(OS)" == "NETBSD"
+NOOPTFILES = \
+ $(SLO)$/sw_txtftn.obj
+.ENDIF
+.ENDIF
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/text/pordrop.hxx b/binfilter/bf_sw/source/core/text/pordrop.hxx
new file mode 100644
index 000000000000..3d5c58e412e3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/pordrop.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORDROP_HXX
+#define _PORDROP_HXX
+
+#include "portxt.hxx"
+namespace binfilter {
+
+class SwFont;
+
+/*************************************************************************
+ * class SwDropPortionPart
+ *
+ * A drop portion can consist of one or more parts in order to allow
+ * attribute changes inside them.
+ *************************************************************************/
+
+class SwDropPortionPart
+{
+ SwDropPortionPart* pFollow;
+ SwFont* pFnt;
+ xub_StrLen nLen;
+ USHORT nWidth;
+
+public:
+ SwDropPortionPart( SwFont& rFont, const xub_StrLen nL )
+ : pFollow( 0 ), pFnt( &rFont ), nLen( nL ), nWidth( 0 ) {};
+ ~SwDropPortionPart();
+
+ inline SwDropPortionPart* GetFollow() const { return pFollow; };
+ inline void SetFollow( SwDropPortionPart* pNew ) { pFollow = pNew; };
+ inline SwFont& GetFont() const { return *pFnt; }
+ inline xub_StrLen GetLen() const { return nLen; }
+ inline USHORT GetWidth() const { return nWidth; }
+ inline void SetWidth( USHORT nNew ) { nWidth = nNew; }
+};
+
+/*************************************************************************
+ * class SwDropPortion
+ *************************************************************************/
+
+class SwDropPortion : public SwTxtPortion
+{
+ SwDropPortionPart* pPart; // due to script / attribute changes
+ MSHORT nLines; // Anzahl der Zeilen
+ KSHORT nDropHeight; // Hoehe
+ KSHORT nDropDescent; // Abstand zur naechsten Zeile
+ KSHORT nDistance; // Abstand zum Text
+ KSHORT nFix; // Fixposition
+ short nX; // X-PaintOffset
+ short nY; // Y-Offset
+
+ inline void Fix( const KSHORT nNew ) { nFix = nNew; }
+public:
+ SwDropPortion( const MSHORT nLineCnt,
+ const KSHORT nDropHeight,
+ const KSHORT nDropDescent,
+ const KSHORT nDistance );
+ virtual ~SwDropPortion();
+
+
+ inline MSHORT GetLines() const { return nLines; }
+ inline KSHORT GetDistance() const { return nDistance; }
+ inline KSHORT GetDropHeight() const { return nDropHeight; }
+ inline KSHORT GetDropDescent() const { return nDropDescent; }
+ inline KSHORT GetDropLeft() const { return Width() + nFix; }
+
+ inline SwDropPortionPart* GetPart() const { return pPart; }
+ inline void SetPart( SwDropPortionPart* pNew ) { pPart = pNew; }
+
+ inline void SetY( short nNew ) { nY = nNew; }
+
+ inline SwFont* GetFnt() { return pPart ? &pPart->GetFont() : NULL; }
+
+ static void DeleteDropCapCache();
+
+ OUTPUT_OPERATOR
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porexp.hxx b/binfilter/bf_sw/source/core/text/porexp.hxx
new file mode 100644
index 000000000000..9db325ab3126
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porexp.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _POREXP_HXX
+#define _POREXP_HXX
+
+#include "portxt.hxx"
+namespace binfilter {
+
+/*************************************************************************
+ * class SwExpandPortion
+ *************************************************************************/
+
+class SwExpandPortion : public SwTxtPortion
+{
+public:
+ inline SwExpandPortion() { SetWhichPor( POR_EXP ); }
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+
+/*************************************************************************
+ * class SwBlankPortion
+ *************************************************************************/
+
+class SwBlankPortion : public SwExpandPortion
+{
+ xub_Unicode cChar;
+ BOOL bMulti; // For multiportion brackets
+public:
+ inline SwBlankPortion( xub_Unicode cCh, BOOL bMult = sal_False )
+ : cChar( cCh ), bMulti( bMult )
+ { cChar = cCh; SetLen(1); SetWhichPor( POR_BLANK ); }
+
+ BOOL IsMulti() const { return bMulti; }
+ void SetMulti( BOOL bNew ) { bMulti = bNew; }
+
+ virtual SwLinePortion *Compress();
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ MSHORT MayUnderFlow( const SwTxtFormatInfo &rInf, xub_StrLen nIdx,
+ sal_Bool bUnderFlow ) const;
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwPostItsPortion
+ *************************************************************************/
+
+class SwPostItsPortion : public SwExpandPortion
+{
+public:
+ SwPostItsPortion( sal_Bool bScrpt ){DBG_BF_ASSERT(0, "STRIP");}; //STRIP001 //STRIP001 SwPostItsPortion( sal_Bool bScrpt );
+ OUTPUT_OPERATOR
+};
+
+
+CLASSIO( SwExpandPortion )
+CLASSIO( SwBlankPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porfld.hxx b/binfilter/bf_sw/source/core/text/porfld.hxx
new file mode 100644
index 000000000000..b912a8fea194
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porfld.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORFLD_HXX
+#define _PORFLD_HXX
+
+#include "swtypes.hxx"
+#include "porexp.hxx"
+#include <fmtornt.hxx>
+namespace binfilter {
+
+class SwFont;
+class SvxBrushItem;
+class SwFmtVertOrient;
+class SwFrm;
+
+/*************************************************************************
+ * class SwFldPortion
+ *************************************************************************/
+
+class SwFldPortion : public SwExpandPortion
+{
+ friend class SwTxtFormatter;
+protected:
+ XubString aExpand; // das expandierte Feld
+ SwFont *pFnt; // Fuer mehrzeilige Felder
+ xub_StrLen nNextOffset; // Offset des Follows im Originalstring
+ KSHORT nViewWidth; // Screenbreite fuer leere Felder
+ sal_Bool bFollow : 1; // 2. oder weiterer Teil eines Feldes
+ sal_Bool bLeft : 1; // wird von SwNumberPortion benutzt
+ sal_Bool bHide : 1; // wird von SwNumberPortion benutzt
+ sal_Bool bCenter : 1; // wird von SwNumberPortion benutzt
+ sal_Bool bHasFollow : 1; // geht in der naechsten Zeile weiter
+ sal_Bool bAnimated : 1; // wird von SwGrfNumPortion benutzt
+ sal_Bool bNoPaint : 1; // wird von SwGrfNumPortion benutzt
+ sal_Bool bReplace : 1; // wird von SwGrfNumPortion benutzt
+
+ inline void SetFont( SwFont *pNew ) { pFnt = pNew; }
+ inline const SwFont *GetFont() const { return pFnt; }
+ BYTE ScriptChange( const SwTxtSizeInfo &rInf, xub_StrLen& rFull );
+public:
+ SwFldPortion( const SwFldPortion& rFld );
+ SwFldPortion( const XubString &rExpand, SwFont *pFnt = 0 );
+ ~SwFldPortion();
+
+ void TakeNextOffset( const SwFldPortion* pFld );
+ void CheckScript( const SwTxtSizeInfo &rInf );
+ inline sal_Bool HasFont() const { return 0 != pFnt; }
+
+ inline const XubString &GetExp() const { return aExpand; }
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+
+ // leere Felder sind auch erlaubt
+ virtual SwLinePortion *Compress();
+
+
+ inline sal_Bool IsFollow() const { return bFollow; }
+ inline void SetFollow( sal_Bool bNew ) { bFollow = bNew; }
+
+ inline sal_Bool IsLeft() const { return bLeft; }
+ inline void SetLeft( sal_Bool bNew ) { bLeft = bNew; }
+
+ inline sal_Bool IsHide() const { return bHide; }
+ inline void SetHide( sal_Bool bNew ) { bHide = bNew; }
+
+ inline sal_Bool IsCenter() const { return bCenter; }
+ inline void SetCenter( sal_Bool bNew ) { bCenter = bNew; }
+
+ inline sal_Bool HasFollow() const { return bHasFollow; }
+ inline void SetHasFollow( sal_Bool bNew ) { bHasFollow = bNew; }
+
+ inline xub_StrLen GetNextOffset() const { return nNextOffset; }
+ inline void SetNextOffset( xub_StrLen nNew ) { nNextOffset = nNew; }
+
+ // Felder-Cloner fuer SplitGlue
+ virtual SwFldPortion *Clone( const XubString &rExpand ) const;
+
+ // Extra-GetTxtSize wegen pFnt
+ virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwHiddenPortion
+ *************************************************************************/
+// Unterscheidung nur fuer's Painten/verstecken.
+
+class SwHiddenPortion : public SwFldPortion
+{
+public:
+ inline SwHiddenPortion( const XubString &rExpand, SwFont *pFnt = 0 )
+ : SwFldPortion( rExpand, pFnt )
+ { SetLen(1); SetWhichPor( POR_HIDDEN ); }
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+
+ // Felder-Cloner fuer SplitGlue
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwNumberPortion
+ *************************************************************************/
+
+class SwNumberPortion : public SwFldPortion
+{
+protected:
+ KSHORT nFixWidth; // vgl. Glues
+ KSHORT nMinDist; // minimaler Abstand zum Text
+public:
+ SwNumberPortion( const XubString &rExpand, SwFont *pFnt,
+ const sal_Bool bLeft, const sal_Bool bCenter, const KSHORT nMinDst );
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+
+ // Felder-Cloner fuer SplitGlue
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwBulletPortion
+ *************************************************************************/
+
+class SwBulletPortion : public SwNumberPortion
+{
+public:
+ SwBulletPortion( const xub_Unicode cCh, SwFont *pFnt, const sal_Bool bLeft,
+ const sal_Bool bCenter, const KSHORT nMinDst );
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwBmpBulletPortion
+ *************************************************************************/
+
+class SwGrfNumPortion : public SwNumberPortion
+{
+public:
+SwGrfNumPortion( SwFrm *pFrm, const SvxBrushItem* pGrfBrush,//STRIP001 SwGrfNumPortion( SwFrm *pFrm, const SvxBrushItem* pGrfBrush,
+const SwFmtVertOrient* pGrfOrient, const Size& rGrfSize,//STRIP001 const SwFmtVertOrient* pGrfOrient, const Size& rGrfSize,
+const sal_Bool bLeft, const sal_Bool bCenter, const KSHORT nMinDst ):SwNumberPortion( aEmptyStr, NULL, bLeft, bCenter, nMinDst ){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 const sal_Bool bLeft, const sal_Bool bCenter, const KSHORT nMinDst );
+void SetBase( long nLnAscent, long nLnDescent,//STRIP001 void SetBase( long nLnAscent, long nLnDescent,
+long nFlyAscent, long nFlyDescent ){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 long nFlyAscent, long nFlyDescent );
+ OUTPUT_OPERATOR
+};
+
+CLASSIO( SwHiddenPortion )
+CLASSIO( SwNumberPortion )
+CLASSIO( SwBulletPortion )
+CLASSIO( SwGrfNumPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porfly.hxx b/binfilter/bf_sw/source/core/text/porfly.hxx
new file mode 100644
index 000000000000..af4900d3da27
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porfly.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORFLY_HXX
+#define _PORFLY_HXX
+
+#include "porglue.hxx"
+namespace binfilter {
+
+class SwDrawContact;
+class SwFrmFmt;
+class SwFlyInCntFrm;
+class SwTxtFrm;
+struct SwCrsrMoveState;
+
+/*************************************************************************
+ * class SwFlyPortion
+ *************************************************************************/
+
+class SwFlyPortion : public SwFixPortion
+{
+ KSHORT nBlankWidth;
+public:
+ inline SwFlyPortion( const SwRect &rFlyRect )
+ : SwFixPortion(rFlyRect), nBlankWidth( 0 ) { SetWhichPor( POR_FLY ); }
+ inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
+ inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const{DBG_BF_ASSERT(0, "STRIP");} //STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwFlyCntPortion
+ *************************************************************************/
+
+#define SETBASE_NOFLAG 0
+#define SETBASE_QUICK 1
+#define SETBASE_ULSPACE 2
+#define SETBASE_INIT 4
+#define SETBASE_ROTATE 8
+#define SETBASE_REVERSE 16
+#ifdef BIDI
+#define SETBASE_BIDI 32
+#endif
+
+class SwFlyCntPortion : public SwLinePortion
+{
+ void *pContact; // bDraw ? DrawContact : FlyInCntFrm
+ Point aRef; // Relativ zu diesem Point wird die AbsPos berechnet.
+ sal_Bool bDraw : 1; // DrawContact?
+ sal_Bool bMax : 1; // Zeilenausrichtung und Hoehe == Zeilenhoehe
+ sal_uInt8 nAlign : 3; // Zeilenausrichtung? Nein, oben, mitte, unten
+
+public:
+ SwFlyCntPortion( const SwTxtFrm& rFrm, SwFlyInCntFrm *pFly,
+ const Point &rBase, long nAscent, long nDescent,
+ long nFlyAsc, long nFlyDesc, sal_uInt8 nFlags );
+ SwFlyCntPortion( const SwTxtFrm& rFrm, SwDrawContact *pDrawContact,
+ const Point &rBase, long nAscent, long nDescent,
+ long nFlyAsc, long nFlyDesc, sal_uInt8 nFlags );
+ inline const Point& GetRefPoint() const { return aRef; }
+ inline SwFlyInCntFrm *GetFlyFrm() { return (SwFlyInCntFrm*)pContact; }
+ inline const SwFlyInCntFrm *GetFlyFrm() const
+ { return (SwFlyInCntFrm*)pContact; }
+ inline SwDrawContact *GetDrawContact() { return (SwDrawContact*)pContact; }
+ inline const SwDrawContact* GetDrawContact() const
+ { return (SwDrawContact*)pContact; }
+ inline sal_Bool IsDraw() const { return bDraw; }
+ inline sal_Bool IsMax() const { return bMax; }
+ inline sal_uInt8 GetAlign() const { return nAlign; }
+ inline void SetAlign( sal_uInt8 nNew ) { nAlign = nNew; }
+ inline void SetMax( sal_Bool bNew ) { bMax = bNew; }
+ void SetBase( const SwTxtFrm& rFrm, const Point &rBase,
+ long nLnAscent, long nLnDescent, long nFlyAscent,
+ long nFlyDescent, sal_uInt8 nFlags );
+ const SwFrmFmt *GetFrmFmt() const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const{DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ OUTPUT_OPERATOR
+};
+
+CLASSIO( SwFlyPortion )
+CLASSIO( SwFlyCntPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porftn.hxx b/binfilter/bf_sw/source/core/text/porftn.hxx
new file mode 100644
index 000000000000..c4867539567c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porftn.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORFTN_HXX
+#define _PORFTN_HXX
+
+#include "porfld.hxx"
+namespace binfilter {
+
+class SwTxtFrm;
+class SwTxtFtn;
+
+/*************************************************************************
+ * class SwFtnPortion
+ *************************************************************************/
+
+class SwFtnPortion : public SwFldPortion
+{
+ SwTxtFrm *pFrm; // um im Dtor RemoveFtn rufen zu koennen.
+ SwTxtFtn *pFtn;
+ KSHORT nOrigHeight;
+public:
+ SwFtnPortion( const XubString &rExpand, SwTxtFrm *pFrm, SwTxtFtn *pFtn,
+ KSHORT nOrig = KSHRT_MAX );
+ inline KSHORT& Orig() { return nOrigHeight; }
+
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+ virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+
+ const SwTxtFtn* GetTxtFtn() const { return pFtn; };
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwFtnNumPortion
+ *************************************************************************/
+
+class SwFtnNumPortion : public SwNumberPortion
+{
+public:
+ inline SwFtnNumPortion( const XubString &rExpand, SwFont *pFnt )
+ : SwNumberPortion( rExpand, pFnt, sal_True, sal_False, 0 )
+ { SetWhichPor( POR_FTNNUM ); }
+ sal_Bool DiffFont( SwFont* pFont );
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwQuoVadisPortion
+ *************************************************************************/
+
+class SwQuoVadisPortion : public SwFldPortion
+{
+public:
+ SwQuoVadisPortion( const XubString &rExp, const XubString& rStr ): SwFldPortion( rExp ){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 SwQuoVadisPortion( const XubString &rExp, const XubString& rStr );
+
+ // Felder-Cloner fuer SplitGlue
+
+ // Accessibility: pass information about this portion to the PortionHandler
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwErgoSumPortion
+ *************************************************************************/
+
+class SwErgoSumPortion : public SwFldPortion
+{
+public:
+SwErgoSumPortion( const XubString &rExp, const XubString& rStr ):SwFldPortion( rExp ){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 SwErgoSumPortion( const XubString &rExp, const XubString& rStr );
+ OUTPUT_OPERATOR
+};
+
+CLASSIO( SwFtnPortion )
+CLASSIO( SwFtnNumPortion )
+CLASSIO( SwQuoVadisPortion )
+CLASSIO( SwErgoSumPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porglue.hxx b/binfilter/bf_sw/source/core/text/porglue.hxx
new file mode 100644
index 000000000000..735c74004496
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porglue.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORGLUE_HXX
+#define _PORGLUE_HXX
+
+#include "porlin.hxx"
+
+namespace binfilter {
+
+class SwRect;
+class SwLineLayout;
+struct SwPosition;
+
+/*************************************************************************
+ * class SwGluePortion
+ *************************************************************************/
+
+class SwGluePortion : public SwLinePortion
+{
+private:
+ KSHORT nFixWidth;
+public:
+ SwGluePortion( const KSHORT nInitFixWidth );
+
+ void Join( SwGluePortion *pVictim );
+
+ inline short GetPrtGlue() const;
+ inline KSHORT GetFixWidth() const { return nFixWidth; }
+ inline void SetFixWidth( const KSHORT nNew ) { nFixWidth = nNew; }
+ void MoveGlue( SwGluePortion *pTarget, const short nPrtGlue );
+ inline void MoveAllGlue( SwGluePortion *pTarget );
+ inline void MoveHalfGlue( SwGluePortion *pTarget );
+ inline void AdjFixWidth();
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const{DBG_BF_ASSERT(0, "STRIP");};//STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwFixPortion
+ *************************************************************************/
+
+class SwFixPortion : public SwGluePortion
+{
+ KSHORT nFix; // der Width-Offset in der Zeile
+public:
+ SwFixPortion( const SwRect &rFlyRect );
+ SwFixPortion( const KSHORT nFixWidth, const KSHORT nFixPos );
+ inline void Fix( const KSHORT nNewFix ) { nFix = nNewFix; }
+ inline KSHORT Fix() const { return nFix; }
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwMarginPortion
+ *************************************************************************/
+
+class SwMarginPortion : public SwGluePortion
+{
+public:
+ SwMarginPortion( const KSHORT nFixWidth );
+ void AdjustRight( const SwLineLayout* pCurr );
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * inline SwGluePortion::GetPrtGlue()
+ *************************************************************************/
+
+inline short SwGluePortion::GetPrtGlue() const
+{ return Width() - nFixWidth; }
+
+/*************************************************************************
+ * inline SwGluePortion::AdjFixWidth()
+ * Die FixWidth darf niemals groesser sein als die Gesamtbreite !
+ *************************************************************************/
+
+inline void SwGluePortion::AdjFixWidth()
+{
+ if( nFixWidth > PrtWidth() )
+ nFixWidth = PrtWidth();
+}
+
+/*************************************************************************
+ * inline SwGluePortion::MoveGlue()
+ *************************************************************************/
+
+inline void SwGluePortion::MoveAllGlue( SwGluePortion *pTarget )
+{
+ MoveGlue( pTarget, GetPrtGlue() );
+}
+
+/*************************************************************************
+ * inline SwGluePortion::MoveHalfGlue()
+ *************************************************************************/
+
+inline void SwGluePortion::MoveHalfGlue( SwGluePortion *pTarget )
+{
+ MoveGlue( pTarget, GetPrtGlue() / 2 );
+}
+
+CLASSIO( SwGluePortion )
+CLASSIO( SwFixPortion )
+CLASSIO( SwMarginPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porhyph.hxx b/binfilter/bf_sw/source/core/text/porhyph.hxx
new file mode 100644
index 000000000000..931f93fbfde0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porhyph.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORHYPH_HXX
+#define _PORHYPH_HXX
+
+#include "porexp.hxx"
+namespace binfilter {
+
+/*************************************************************************
+ * class SwHyphPortion
+ *************************************************************************/
+
+class SwHyphPortion : public SwExpandPortion
+{
+public:
+ inline SwHyphPortion( ) { SetWhichPor( POR_HYPH ); }
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwHyphStrPortion
+ *************************************************************************/
+
+class SwHyphStrPortion : public SwHyphPortion
+{
+ XubString aExpand;
+public:
+ inline SwHyphStrPortion( const XubString &rStr );
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwSoftHyphPortion
+ *************************************************************************/
+
+class SwSoftHyphPortion : public SwHyphPortion
+{
+ sal_Bool bExpand;
+ KSHORT nViewWidth;
+ KSHORT nHyphWidth;
+
+public:
+ SwSoftHyphPortion();
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+ virtual SwLinePortion *Compress();
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ virtual void FormatEOL( SwTxtFormatInfo &rInf );
+ inline void SetExpand( const sal_Bool bNew ) { bExpand = bNew; }
+ sal_Bool IsExpand() const { return bExpand; }
+
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwSoftHyphStrPortion
+ *************************************************************************/
+
+CLASSIO( SwHyphPortion )
+CLASSIO( SwHyphStrPortion )
+CLASSIO( SwSoftHyphPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porlay.hxx b/binfilter/bf_sw/source/core/text/porlay.hxx
new file mode 100644
index 000000000000..67ef2e5b8d50
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porlay.hxx
@@ -0,0 +1,373 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORLAY_HXX
+#define _PORLAY_HXX
+
+#include <tools/string.hxx>
+#include <tools/fract.hxx>
+#include <drawfont.hxx>
+
+#include "swrect.hxx" // SwRepaint
+#include "portxt.hxx"
+#include "swfont.hxx"
+class SvStream;
+namespace binfilter {
+
+class SwMarginPortion;
+class SwDropPortion;
+
+class SwTxtFormatter;
+
+/*************************************************************************
+ * class SwCharRange
+ *************************************************************************/
+
+class SwCharRange
+{
+ xub_StrLen nStart, nLen;
+public:
+ inline SwCharRange( const xub_StrLen nInitStart = 0,
+ const xub_StrLen nInitLen = 0): nStart( nInitStart ), nLen(nInitLen) {}
+ inline xub_StrLen &Start() { return nStart; }
+ inline const xub_StrLen &Start() const { return nStart; }
+ inline void LeftMove( xub_StrLen nNew )
+ { if ( nNew < nStart ) { nLen += nStart-nNew; nStart = nNew; } }
+ inline xub_StrLen End() const
+ { return nStart + nLen; }
+ inline xub_StrLen &Len() { return nLen; }
+ inline const xub_StrLen &Len() const { return nLen; }
+ inline sal_Bool operator<(const SwCharRange &rRange) const
+ { return nStart < rRange.nStart; }
+ inline sal_Bool operator>(const SwCharRange &rRange) const
+ { return nStart + nLen > rRange.nStart + rRange.nLen; }
+ inline sal_Bool operator!=(const SwCharRange &rRange) const
+ { return *this < rRange || *this > rRange; }
+ SwCharRange &operator+=(const SwCharRange &rRange);
+};
+
+/*************************************************************************
+ * class SwRepaint
+ *************************************************************************/
+
+// SwRepaint ist ein dokumentglobales SwRect mit einem nOfst der angibt,
+// ab wo in der ersten Zeile gepaintet werden soll
+// und einem nRightOfst, der den rechten Rand bestimmt
+class SwRepaint : public SwRect
+{
+ SwTwips nOfst;
+ SwTwips nRightOfst;
+public:
+ SwRepaint() : SwRect(), nOfst( 0 ), nRightOfst( 0 ) {}
+ SwRepaint( const SwRepaint& rRep ) : SwRect( rRep ), nOfst( rRep.nOfst ),
+ nRightOfst( rRep.nRightOfst ) {}
+
+ SwTwips GetOfst() const { return nOfst; }
+ void SetOfst( const SwTwips nNew ) { nOfst = nNew; }
+ SwTwips GetRightOfst() const { return nRightOfst; }
+ void SetRightOfst( const SwTwips nNew ) { nRightOfst = nNew; }
+};
+
+/*************************************************************************
+ * class SwLineLayout
+ *************************************************************************/
+
+class SwLineLayout : public SwTxtPortion
+{
+private:
+ SwLineLayout *pNext;// Die naechste Zeile.
+ SvShorts* pSpaceAdd;// Fuer den Blocksatz
+ SvUShorts* pKanaComp;
+ KSHORT nRealHeight; // Die aus Zeilenabstand/Register resultierende Hoehe
+ sal_Bool bFormatAdj : 1;
+ sal_Bool bDummy : 1;
+ sal_Bool bFntChg : 1;
+ sal_Bool bEndHyph : 1;
+ sal_Bool bMidHyph : 1;
+ sal_Bool bTab : 1;
+ sal_Bool bFly : 1;
+ sal_Bool bRest : 1;
+ sal_Bool bBlinking : 1;
+ sal_Bool bClipping : 1; // Clipping erforderlich wg. exakter Zeilenhoehe
+ sal_Bool bContent : 1; // enthaelt Text, fuer Zeilennumerierung
+ sal_Bool bRedline : 1; // enthaelt Redlining
+ sal_Bool bForcedLeftMargin : 1; // vom Fly verschobener linker Einzug
+ sal_Bool bHanging : 1; // contents a hanging portion in the margin
+ sal_Bool bUnderscore : 1;
+
+ SwTwips _GetHangingMargin() const;
+
+public:
+ // von SwLinePortion
+ virtual SwLinePortion *Insert( SwLinePortion *pPortion );
+ inline SwLinePortion *GetFirstPortion() const;
+
+ // Flags
+ inline void ResetFlags();
+ inline void SetFormatAdj( const sal_Bool bNew ) { bFormatAdj = bNew; }
+ inline sal_Bool IsFormatAdj() const { return bFormatAdj; }
+ inline void SetFntChg( const sal_Bool bNew ) { bFntChg = bNew; }
+ inline sal_Bool IsFntChg() const { return bFntChg; }
+ inline void SetEndHyph( const sal_Bool bNew ) { bEndHyph = bNew; }
+ inline sal_Bool IsEndHyph() const { return bEndHyph; }
+ inline void SetMidHyph( const sal_Bool bNew ) { bMidHyph = bNew; }
+ inline sal_Bool IsMidHyph() const { return bMidHyph; }
+ inline void SetTab( const sal_Bool bNew ) { bTab = bNew; }
+ inline sal_Bool IsTab() const { return bTab; }
+ inline void SetFly( const sal_Bool bNew ) { bFly = bNew; }
+ inline sal_Bool IsFly() const { return bFly; }
+ inline void SetRest( const sal_Bool bNew ) { bRest = bNew; }
+ inline sal_Bool IsRest() const { return bRest; }
+ inline void SetBlinking( const sal_Bool bNew = sal_True ) { bBlinking = bNew; }
+ inline sal_Bool IsBlinking() const { return bBlinking; }
+ inline void SetCntnt( const sal_Bool bNew = sal_True ) { bContent = bNew; }
+ inline sal_Bool HasCntnt() const { return bContent; }
+ inline void SetRedline( const sal_Bool bNew = sal_True ) { bRedline = bNew; }
+ inline sal_Bool HasRedline() const { return bRedline; }
+ inline void SetForcedLeftMargin( const sal_Bool bNew = sal_True ) { bForcedLeftMargin = bNew; }
+ inline sal_Bool HasForcedLeftMargin() const { return bForcedLeftMargin; }
+ inline void SetHanging( const sal_Bool bNew = sal_True ) { bHanging = bNew; }
+ inline sal_Bool IsHanging() const { return bHanging; }
+ inline void SetUnderscore( const sal_Bool bNew = sal_True ) { bUnderscore = bNew; }
+ inline sal_Bool HasUnderscore() const { return bUnderscore; }
+
+ // Beruecksichtigung von Dummyleerzeilen
+ // 4147, 8221:
+ inline void SetDummy( const sal_Bool bNew ) { bDummy = bNew; }
+ inline sal_Bool IsDummy() const { return bDummy; }
+
+ inline void SetClipping( const sal_Bool bNew ) { bClipping = bNew; }
+ inline sal_Bool IsClipping() const { return bClipping; }
+
+ inline SwLineLayout();
+ virtual ~SwLineLayout();
+
+ inline SwLineLayout *GetNext() { return pNext; }
+ inline const SwLineLayout *GetNext() const { return pNext; }
+ inline void SetNext( SwLineLayout *pNew ) { pNext = pNew; }
+
+ void Init( SwLinePortion *pNextPortion = NULL);
+
+ // Sammelt die Daten fuer die Zeile.
+ void CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf );
+
+ inline void SetRealHeight( KSHORT nNew ) { nRealHeight = nNew; }
+ inline KSHORT GetRealHeight() const { return nRealHeight; }
+
+ // Erstellt bei kurzen Zeilen die Glue-Kette.
+ SwMarginPortion *CalcLeftMargin();
+
+ inline SwTwips GetHangingMargin() const
+ { return _GetHangingMargin(); }
+
+ // fuer die Sonderbehandlung bei leeren Zeilen
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+
+ inline sal_Bool IsNoSpaceAdd() { return pSpaceAdd == NULL; }
+ inline void InitSpaceAdd()
+ { if ( !pSpaceAdd ) CreateSpaceAdd(); else (*pSpaceAdd)[0] = 0; }
+ inline void SetKanaComp( SvUShorts* pNew ){ pKanaComp = pNew; }
+ inline void FinishSpaceAdd() { delete pSpaceAdd; pSpaceAdd = NULL; }
+ inline void FinishKanaComp() { delete pKanaComp; pKanaComp = NULL; }
+ inline SvShorts* GetpSpaceAdd() const { return pSpaceAdd; }
+ inline SvShorts& GetSpaceAdd() { return *pSpaceAdd; }
+ inline SvUShorts* GetpKanaComp() const { return pKanaComp; }
+ inline SvUShorts& GetKanaComp() { return *pKanaComp; }
+
+ void CreateSpaceAdd( const short nInit = 0 );
+
+#ifdef DBG_UTIL
+ void DebugPortions( SvStream &rOs, const XubString &rTxt,
+ const xub_StrLen nStart ); //$ ostream
+#endif
+
+ OUTPUT_OPERATOR
+ DECL_FIXEDMEMPOOL_NEWDEL(SwLineLayout)
+};
+
+class SwParaPortion : public SwLineLayout
+{
+ // neu zu paintender Bereich
+ SwRepaint aRepaint;
+ // neu zu formatierender Bereich
+ SwCharRange aReformat;
+ SwScriptInfo aScriptInfo;
+// Fraction aZoom;
+ long nDelta;
+
+ // Wenn ein SwTxtFrm gelocked ist, werden keine Veraenderungen an den
+ // Formatierungsdaten (unter pLine) vorgenommen (vgl. ORPHANS)
+ sal_Bool bFlys : 1; // Ueberlappen Flys ?
+ sal_Bool bPrep : 1; // PREP_*
+ sal_Bool bPrepWidows : 1; // PREP_WIDOWS
+ sal_Bool bPrepAdjust : 1; // PREP_ADJUST_FRM
+ sal_Bool bPrepMustFit : 1; // PREP_MUST_FIT
+ sal_Bool bFollowField : 1; // Es steht noch ein Feldrest fuer den Follow an.
+
+ sal_Bool bFixLineHeight : 1; // Feste Zeilenhoehe
+ sal_Bool bFtnNum : 1; // contents a footnotenumberportion
+ sal_Bool bMargin : 1; // contents a hanging punctuation in the margin
+
+ sal_Bool bFlag00 : 1; //
+ sal_Bool bFlag11 : 1; //
+ sal_Bool bFlag12 : 1; //
+ sal_Bool bFlag13 : 1; //
+ sal_Bool bFlag14 : 1; //
+ sal_Bool bFlag15 : 1; //
+ sal_Bool bFlag16 : 1; //
+
+public:
+ SwParaPortion();
+
+ // setzt alle Formatinformationen zurueck (ausser bFlys wg. 9916)
+ inline void FormatReset();
+
+ // Setzt die Flags zurueck
+ inline void ResetPreps();
+
+ // Get/Set-Methoden
+ inline SwRepaint *GetRepaint() { return &aRepaint; }
+ inline const SwRepaint *GetRepaint() const { return &aRepaint; }
+ inline SwCharRange *GetReformat() { return &aReformat; }
+ inline const SwCharRange *GetReformat() const { return &aReformat; }
+ inline long *GetDelta() { return &nDelta; }
+ inline const long *GetDelta() const { return &nDelta; }
+ inline SwScriptInfo& GetScriptInfo() { return aScriptInfo; }
+ inline const SwScriptInfo& GetScriptInfo() const { return aScriptInfo; }
+
+ // fuer SwTxtFrm::Format: liefert die aktuelle Laenge des Absatzes
+ xub_StrLen GetParLen() const;
+
+ // fuer Prepare()
+ sal_Bool UpdateQuoVadis( const XubString &rQuo );
+
+ // Flags
+ inline void SetFly( const sal_Bool bNew = sal_True ) { bFlys = bNew; }
+ inline sal_Bool HasFly() const { return bFlys; }
+
+ // Preps
+ inline void SetPrep( const sal_Bool bNew = sal_True ) { bPrep = bNew; }
+ inline sal_Bool IsPrep() const { return bPrep; }
+ inline void SetPrepWidows( const sal_Bool bNew = sal_True ) { bPrepWidows = bNew; }
+ inline sal_Bool IsPrepWidows() const { return bPrepWidows; }
+ inline void SetPrepMustFit( const sal_Bool bNew = sal_True ) { bPrepMustFit = bNew; }
+ inline sal_Bool IsPrepMustFit() const { return bPrepMustFit; }
+ inline void SetPrepAdjust( const sal_Bool bNew = sal_True ) { bPrepAdjust = bNew; }
+ inline sal_Bool IsPrepAdjust() const { return bPrepAdjust; }
+ inline void SetFollowField( const sal_Bool bNew = sal_True ) { bFollowField = bNew; }
+ inline sal_Bool IsFollowField() const { return bFollowField; }
+ inline void SetFixLineHeight( const sal_Bool bNew = sal_True ) { bFixLineHeight = bNew; }
+ inline sal_Bool IsFixLineHeight() const { return bFixLineHeight; }
+
+ inline void SetFtnNum( const sal_Bool bNew = sal_True ) { bFtnNum = bNew; }
+ inline sal_Bool IsFtnNum() const { return bFtnNum; }
+ inline void SetMargin( const sal_Bool bNew = sal_True ) { bMargin = bNew; }
+ inline sal_Bool IsMargin() const { return bMargin; }
+ inline void SetFlag00( const sal_Bool bNew = sal_True ) { bFlag00 = bNew; }
+ inline sal_Bool IsFlag00() const { return bFlag00; }
+ inline void SetFlag11( const sal_Bool bNew = sal_True ) { bFlag11 = bNew; }
+ inline sal_Bool IsFlag11() const { return bFlag11; }
+ inline void SetFlag12( const sal_Bool bNew = sal_True ) { bFlag12 = bNew; }
+ inline sal_Bool IsFlag12() const { return bFlag12; }
+ inline void SetFlag13( const sal_Bool bNew = sal_True ) { bFlag13 = bNew; }
+ inline sal_Bool IsFlag13() const { return bFlag13; }
+ inline void SetFlag14( const sal_Bool bNew = sal_True ) { bFlag14 = bNew; }
+ inline sal_Bool IsFlag14() const { return bFlag14; }
+ inline void SetFlag15( const sal_Bool bNew = sal_True ) { bFlag15 = bNew; }
+ inline sal_Bool IsFlag15() const { return bFlag15; }
+ inline void SetFlag16( const sal_Bool bNew = sal_True ) { bFlag16 = bNew; }
+ inline sal_Bool IsFlag16() const { return bFlag16; }
+
+ // schneller, hoeher, weiter: Read/Write-Methoden fuer den SWG-Filter
+ SvStream &ReadSwg ( SvStream& rStream ); //$ istream
+ SvStream &WriteSwg( SvStream& rStream ); //$ ostream
+
+ // nErgo in der QuoVadisPortion setzen
+
+ const SwDropPortion *FindDropPortion() const;
+
+ OUTPUT_OPERATOR
+ DECL_FIXEDMEMPOOL_NEWDEL(SwParaPortion)
+};
+
+/*************************************************************************
+ * Inline-Implementierungen
+ *************************************************************************/
+
+inline void SwLineLayout::ResetFlags()
+{
+ bFormatAdj = bDummy = bFntChg = bTab = bEndHyph = bMidHyph = bFly
+ = bRest = bBlinking = bClipping = bContent = bRedline
+ = bForcedLeftMargin = bHanging = sal_False;
+}
+
+inline SwLineLayout::SwLineLayout()
+ : pNext( 0 ), nRealHeight( 0 ), pSpaceAdd( 0 ), pKanaComp( 0 ),
+ bUnderscore( sal_False )
+{
+ ResetFlags();
+ SetWhichPor( POR_LAY );
+}
+
+inline void SwParaPortion::ResetPreps()
+{
+ bPrep = bPrepWidows = bPrepAdjust = bPrepMustFit = sal_False;
+}
+
+inline void SwParaPortion::FormatReset()
+{
+ nDelta = 0;
+ aReformat = SwCharRange( 0, STRING_LEN );
+// AMA 9916: bFlys muss in SwTxtFrm::_Format() erhalten bleiben, damit
+// leere Absaetze, die Rahmen ohne Umfluss ausweichen mussten, sich
+// neu formatieren, wenn der Rahmen aus dem Bereich verschwindet.
+// bFlys = sal_False;
+ ResetPreps();
+ bFollowField = bFixLineHeight = bMargin = sal_False;
+}
+
+#ifdef UNX
+// C30 ist mit dem ternaeren Ausdruck ueberfordert.
+inline SwLinePortion *SwLineLayout::GetFirstPortion() const
+{
+ register SwLinePortion *pTmp = pPortion;
+ if ( !pPortion )
+ pTmp = (SwLinePortion*)this;
+ return( pTmp );
+}
+#else
+inline SwLinePortion *SwLineLayout::GetFirstPortion() const
+{ return( pPortion ? pPortion : (SwLinePortion*)this ); }
+#endif
+
+CLASSIO( SwLineLayout )
+CLASSIO( SwParaPortion )
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porlin.hxx b/binfilter/bf_sw/source/core/text/porlin.hxx
new file mode 100644
index 000000000000..b448b4c62f1c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porlin.hxx
@@ -0,0 +1,248 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORLIN_HXX
+#define _PORLIN_HXX
+
+#include "possiz.hxx" // SwPosSize
+class XubString;
+namespace binfilter {
+
+
+class SwTxtSizeInfo;
+class SwTxtPaintInfo;
+class SwTxtFormatInfo;
+class SwPortionHandler;
+
+// Die Ausgabeoperatoren der Portions sind virtuelle Methoden der Portion.
+// Das CLASSIO-Makro implementiert die 'freischwebende' Funktion.
+// Auf diese Weise erhaelt man beide Vorteile: virtuelle Ausgabeoperatoren
+// und allgemeine Verwendbarkeit.
+#ifdef DBG_UTIL
+#define OUTPUT_OPERATOR virtual SvStream &operator<<( SvStream & aOs ) const;
+#else
+#define OUTPUT_OPERATOR
+#endif
+
+// Portiongruppen
+#define PORGRP_TXT 0x8000
+#define PORGRP_EXP 0x4000
+#define PORGRP_FLD 0x2000
+#define PORGRP_HYPH 0x1000
+#define PORGRP_NUMBER 0x0800
+#define PORGRP_GLUE 0x0400
+#define PORGRP_FIX 0x0200
+#define PORGRP_TAB 0x0100
+#define PORGRP_NOTRECY 0x0080
+// kleine Spezialgruppen
+#define PORGRP_FIXMARG 0x0040
+//#define PORGRP_? 0x0020
+#define PORGRP_TABNOTLFT 0x0010
+#define PORGRP_TOXREF 0x0008
+
+/*************************************************************************
+ * class SwLinePortion
+ *************************************************************************/
+
+class SwLinePortion: public SwPosSize
+{
+protected:
+ // Hier gibt es Bereiche mit unterschiedlichen Attributen.
+ SwLinePortion *pPortion;
+ // Anzahl der Zeichen und Spaces auf der Zeile
+ xub_StrLen nLineLength;
+ KSHORT nAscent; // Maximaler Ascender
+
+ SwLinePortion();
+private:
+ MSHORT nWhichPor; // Who's who?
+
+ void _Truncate();
+
+public:
+ inline SwLinePortion(const SwLinePortion &rPortion);
+ virtual ~SwLinePortion();
+
+ // Zugriffsmethoden
+ inline SwLinePortion *GetPortion() const { return( pPortion ); }
+ inline SwLinePortion &operator=(const SwLinePortion &rPortion);
+ inline sal_Bool operator==( const SwLinePortion &rPortion ) const;
+ inline xub_StrLen GetLen() const { return nLineLength; }
+ inline void SetLen( const xub_StrLen nLen ) { nLineLength = nLen; }
+ inline void SetPortion( SwLinePortion *pNew ){ pPortion = pNew; }
+ inline KSHORT &GetAscent() { return nAscent; }
+ inline KSHORT GetAscent() const { return nAscent; }
+ inline void SetAscent( const KSHORT nNewAsc ) { nAscent = nNewAsc; }
+ inline void PrtWidth( KSHORT nNewWidth ) { Width( nNewWidth ); }
+ inline KSHORT PrtWidth() const { return Width(); }
+ inline void AddPrtWidth( const KSHORT nNew ) { Width( Width() + nNew ); }
+ inline void SubPrtWidth( const KSHORT nNew ) { Width( Width() - nNew ); }
+
+ inline const SwPosSize &PrtSize() const { return *this; }
+
+ // Einfuegeoperationen:
+ virtual SwLinePortion *Insert( SwLinePortion *pPortion );
+ virtual SwLinePortion *Append( SwLinePortion *pPortion );
+ SwLinePortion *Cut( SwLinePortion *pVictim );
+ inline void Truncate();
+
+ // liefert 0 zurueck, wenn keine Nutzdaten enthalten sind.
+ virtual SwLinePortion *Compress();
+
+ inline void SetWhichPor( const MSHORT nNew ) { nWhichPor = nNew; }
+ inline MSHORT GetWhichPor( ) const { return nWhichPor; }
+
+// Gruppenabfragen:
+ inline sal_Bool InTxtGrp( ) const { return nWhichPor & PORGRP_TXT ? sal_True : sal_False; }
+ inline sal_Bool InGlueGrp( ) const { return nWhichPor & PORGRP_GLUE ? sal_True : sal_False;}
+ inline sal_Bool InTabGrp( ) const { return nWhichPor & PORGRP_TAB ? sal_True : sal_False; }
+ inline sal_Bool InHyphGrp( ) const { return nWhichPor & PORGRP_HYPH ? sal_True : sal_False;}
+ inline sal_Bool InNumberGrp( )const { return nWhichPor & PORGRP_NUMBER ? sal_True : sal_False;}
+ inline sal_Bool InFixGrp( ) const { return nWhichPor & PORGRP_FIX ? sal_True : sal_False; }
+ inline sal_Bool InFldGrp( ) const { return nWhichPor & PORGRP_FLD ? sal_True : sal_False; }
+ inline sal_Bool InToxRefGrp( ) const { return nWhichPor & PORGRP_TOXREF ? sal_True : sal_False; }
+ inline sal_Bool InToxRefOrFldGrp( ) const { return nWhichPor &
+ ( PORGRP_FLD | PORGRP_TOXREF ) ? sal_True : sal_False; }
+ inline sal_Bool InExpGrp( ) const { return nWhichPor & PORGRP_EXP ? sal_True : sal_False; }
+ inline sal_Bool InTabnLftGrp( ) const
+ { return nWhichPor & PORGRP_TABNOTLFT ? sal_True : sal_False; }
+ inline sal_Bool InFixMargGrp( )const
+ { return nWhichPor & PORGRP_FIXMARG ? sal_True : sal_False; }
+ inline sal_Bool InSpaceGrp( )const
+ { return InTxtGrp() || IsMultiPortion(); }
+// Individuelle Abfragen:
+ inline sal_Bool IsGrfNumPortion( )const{ return nWhichPor == POR_GRFNUM; }
+ inline sal_Bool IsFlyCntPortion( )const{ return nWhichPor == POR_FLYCNT; }
+ inline sal_Bool IsBlankPortion( ) const{ return nWhichPor == POR_BLANK; }
+ inline sal_Bool IsBreakPortion( ) const{ return nWhichPor == POR_BRK; }
+ inline sal_Bool IsErgoSumPortion()const{ return nWhichPor == POR_ERGOSUM;}
+ inline sal_Bool IsQuoVadisPortion()const{ return nWhichPor==POR_QUOVADIS;}
+ inline sal_Bool IsTabCntPortion( )const{ return nWhichPor==POR_TABCENTER;}
+ inline sal_Bool IsTabLeftPortion()const{ return nWhichPor == POR_TABLEFT;}
+ inline sal_Bool IsFtnNumPortion( )const{ return nWhichPor == POR_FTNNUM; }
+ inline sal_Bool IsFtnPortion( ) const{ return nWhichPor == POR_FTN; }
+ inline sal_Bool IsTmpEndPortion( )const{ return nWhichPor == POR_TMPEND; }
+ inline sal_Bool IsDropPortion( ) const{ return nWhichPor == POR_DROP; }
+ inline sal_Bool IsLayPortion( ) const{ return nWhichPor == POR_LAY; }
+ inline sal_Bool IsParaPortion( ) const{ return nWhichPor == POR_PARA; }
+ inline sal_Bool IsMarginPortion( )const{ return nWhichPor == POR_MARGIN; }
+ inline sal_Bool IsFlyPortion( ) const{ return nWhichPor == POR_FLY; }
+ inline sal_Bool IsHolePortion( ) const{ return nWhichPor == POR_HOLE; }
+ inline sal_Bool IsSoftHyphPortion()const{ return nWhichPor==POR_SOFTHYPH;}
+ inline sal_Bool IsPostItsPortion()const{ return nWhichPor == POR_POSTITS;}
+ inline sal_Bool IsCombinedPortion()const{ return nWhichPor==POR_COMBINED;}
+ inline sal_Bool IsTextPortion( ) const{ return nWhichPor == POR_TXT; }
+ inline sal_Bool IsURLPortion( ) const{ return nWhichPor == POR_URL; }
+ inline sal_Bool IsHangingPortion( ) const{ return nWhichPor == POR_HNG; }
+ inline sal_Bool IsKernPortion( ) const{ return nWhichPor == POR_KERN; }
+ inline sal_Bool IsArrowPortion( ) const{ return nWhichPor == POR_ARROW; }
+ inline sal_Bool IsMultiPortion( ) const{ return nWhichPor == POR_MULTI; }
+
+ // Positionierung
+ SwLinePortion *FindPrevPortion( const SwLinePortion *pRoot );
+ SwLinePortion *FindLastPortion();
+
+ virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
+ void CalcTxtSize( const SwTxtSizeInfo &rInfo );
+
+ // Ausgabe
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const = 0;
+
+#ifdef DBG_UTIL
+#endif
+
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ // wird fuer die letzte Portion der Zeile extra gerufen
+ virtual void FormatEOL( SwTxtFormatInfo &rInf );
+ void Move( SwTxtPaintInfo &rInf );
+
+ // Fuer SwTxtSlot
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+
+ // fuer SwFldPortion, SwSoftHyphPortion
+
+ // for text- and multi-portions
+ virtual long CalcSpacing( short nSpaceAdd, const SwTxtSizeInfo &rInf ) const;
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+
+/*************************************************************************
+ * inline - Implementations
+ *************************************************************************/
+
+inline SwLinePortion &SwLinePortion::operator=(const SwLinePortion &rPortion)
+{
+ *(SwPosSize*)this = rPortion;
+ nLineLength = rPortion.nLineLength;
+ nAscent = rPortion.nAscent;
+ nWhichPor = rPortion.nWhichPor;
+ return *this;
+}
+
+inline sal_Bool SwLinePortion::operator==(const SwLinePortion &rPortion ) const
+{
+ return( *(SwPosSize*)this == rPortion &&
+ nLineLength == rPortion.GetLen() &&
+ nAscent == rPortion.GetAscent() );
+}
+
+inline SwLinePortion::SwLinePortion(const SwLinePortion &rPortion) :
+ SwPosSize( rPortion ),
+ pPortion( 0 ),
+ nLineLength( rPortion.nLineLength ),
+ nAscent( rPortion.nAscent ),
+ nWhichPor( rPortion.nWhichPor )
+{
+}
+
+inline void SwLinePortion::Truncate()
+{
+ if ( pPortion )
+ _Truncate();
+}
+
+
+//$ ostream
+#ifdef DBGTXT
+#define CLASSIO( class ) \
+ inline SvStream &operator<<( SvStream &rOs, const class &rClass ) {\
+ return rClass.operator<<( rOs );\
+ }
+#else
+#define CLASSIO( class )
+#endif
+
+CLASSIO( SwLinePortion )
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/pormulti.hxx b/binfilter/bf_sw/source/core/text/pormulti.hxx
new file mode 100644
index 000000000000..0454ca30b940
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/pormulti.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PORMULTI_HXX
+#define _PORMULTI_HXX
+
+#include "porlay.hxx"
+#include "porexp.hxx"
+namespace binfilter {
+
+class SfxPoolItem;
+class SwTxtFormatInfo;
+class SwFldPortion;
+class SwTxtCursor;
+class SwLineLayout;
+class SwBlankPortion;
+class SwTxtPaintInfo;
+class SwTxtAttr;
+
+class SwFont;
+
+/*-----------------02.02.01 15:01-------------------
+ * SwMultiCreator is a small structur to create a multiportion.
+ * It contains the kind of multiportion and a textattribute
+ * or a poolitem.
+ * The GetMultiCreator-function fills this structur and
+ * the Ctor of the SwMultiPortion uses it.
+ * --------------------------------------------------*/
+
+#define SW_MC_DOUBLE 0
+#define SW_MC_RUBY 1
+#define SW_MC_ROTATE 2
+#ifdef BIDI
+#define SW_MC_BIDI 3
+#endif
+
+struct SwMultiCreator
+{
+ const SwTxtAttr* pAttr;
+ const SfxPoolItem* pItem;
+ BYTE nId;
+#ifdef BIDI
+ BYTE nLevel;
+#endif
+};
+
+/*-----------------25.10.00 16:19-------------------
+ * A two-line-portion (SwMultiPortion) could have surrounding brackets,
+ * in this case the structur SwBracket will be used.
+ * --------------------------------------------------*/
+
+struct SwBracket
+{
+ xub_StrLen nStart; // Start of text attribute determins the font
+ KSHORT nAscent; // Ascent of the brackets
+ KSHORT nHeight; // Height of them
+ KSHORT nPreWidth; // Width of the opening bracket
+ KSHORT nPostWidth; // Width of the closing bracket
+ sal_Unicode cPre; // Initial character, e.g. '('
+ sal_Unicode cPost; // Final character, e.g. ')'
+ BYTE nPreScript; // Script of the initial character
+ BYTE nPostScript; // Script of the final character
+};
+
+/*-----------------16.10.00 12:45-------------------
+ * The SwMultiPortion is line portion inside a line portion,
+ * it's a group of portions,
+ * e.g. a double line portion in a line
+ * or phonetics (ruby)
+ * or combined characters
+ * or a rotated portion.
+ * --------------------------------------------------*/
+
+class SwMultiPortion : public SwLinePortion
+{
+ SwLineLayout aRoot; // One or more lines
+ SwFldPortion *pFldRest; // Field rest from the previous line
+ sal_Bool bTab1 :1; // First line tabulator
+ sal_Bool bTab2 :1; // Second line includes tabulator
+ sal_Bool bDouble :1; // Double line
+ sal_Bool bRuby :1; // Phonetics
+ #ifdef BIDI
+ sal_Bool bBidi :1;
+ #endif
+ sal_Bool bTop :1; // Phonetic position
+ sal_Bool bFormatted :1; // Already formatted
+ sal_Bool bFollowFld :1; // Field follow inside
+ sal_uInt8 nDirection:2; // Direction (0/90/180/270 degrees)
+ sal_Bool bFlyInCntnt:1; // Fly as character inside
+protected:
+SwMultiPortion( xub_StrLen nEnd ) : pFldRest( 0 ), bTab1( sal_False ),
+ #ifdef BIDI
+ bTab2( sal_False ), bDouble( sal_False ), bRuby( sal_False ),
+ bBidi( sal_False ), bFormatted( sal_False ), bFollowFld( sal_False ),
+ nDirection( 0 ), bFlyInCntnt( sal_False )
+ #else
+ bTab2( sal_False ), bDouble( sal_False ), bRuby( sal_False ),
+ bFormatted( sal_False ), bFollowFld( sal_False ), nDirection( 0 ),
+ bFlyInCntnt( sal_False )
+ #endif
+ { SetWhichPor( POR_MULTI ); SetLen( nEnd ); }
+public:
+ const SwLineLayout& GetRoot() const { return aRoot; }
+ SwLineLayout& GetRoot() { return aRoot; }
+ inline sal_Bool HasTabulator() const{DBG_BF_ASSERT(0, "STRIP"); return FALSE;} //STRIP001 inline sal_Bool HasTabulator() const { return bTab1 || bTab2; }
+ inline sal_Bool IsFollowFld() const { return bFollowFld; }
+ inline sal_Bool HasFlyInCntnt() const { return bFlyInCntnt; }
+ inline sal_Bool IsDouble() const{DBG_BF_ASSERT(0, "STRIP"); return FALSE;} //STRIP001 inline sal_Bool IsDouble() const { return bDouble; }
+#ifdef BIDI
+ inline sal_Bool IsBidi() const { return bBidi; }
+#endif
+ inline sal_Bool HasRotation() const { return 0 != (1 & nDirection); }
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * inline - Implementations
+ *************************************************************************/
+
+#ifndef BIDI
+inline sal_Bool SwMultiPortion::ChgSpaceAdd(SwLineLayout* pCurr,short nSpaceAdd)
+ { return IsDouble() ? ((SwDoubleLinePortion*)this)->ChangeSpaceAdd( pCurr,
+ nSpaceAdd ) : sal_False; }
+#endif
+
+
+CLASSIO( SwMultiPortion )
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porref.hxx b/binfilter/bf_sw/source/core/text/porref.hxx
new file mode 100644
index 000000000000..651af117cab3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porref.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORREF_HXX
+#define _PORREF_HXX
+
+#include "portxt.hxx"
+namespace binfilter {
+
+/*************************************************************************
+ * class SwRefPortion
+ *************************************************************************/
+
+class SwRefPortion : public SwTxtPortion
+{
+public:
+ inline SwRefPortion(){ SetWhichPor( POR_REF ); }
+//STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwIsoRefPortion
+ *************************************************************************/
+
+class SwIsoRefPortion : public SwRefPortion
+{
+//STRIP001 KSHORT nViewWidth;
+//STRIP001
+public:
+ SwIsoRefPortion(){DBG_BF_ASSERT(0, "STRIP");}; //STRIP001 //STRIP001 SwIsoRefPortion();
+//STRIP001 virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+//STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+//STRIP001 virtual SwLinePortion *Compress();
+//STRIP001 virtual KSHORT GetViewWidth( const SwTxtSizeInfo &rInf ) const;
+
+ // Accessibility: pass information about this portion to the PortionHandler
+//STRIP001 virtual void HandlePortion( SwPortionHandler& rPH ) const;
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * inline - Implementations
+ *************************************************************************/
+
+CLASSIO( SwRefPortion )
+//STRIP001 CLASSIO( SwIsoRefPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/porrst.hxx b/binfilter/bf_sw/source/core/text/porrst.hxx
new file mode 100644
index 000000000000..b4a0290d5a19
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/porrst.hxx
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORRST_HXX
+#define _PORRST_HXX
+
+#include <bf_svtools/svarray.hxx>
+
+#include "porlay.hxx"
+#include "porexp.hxx"
+namespace binfilter {
+
+#ifdef VERTICAL_LAYOUT
+#define LINE_BREAK_WIDTH 150
+#define SPECIAL_FONT_HEIGHT 200
+#endif
+
+class SwTxtFormatInfo;
+
+/*************************************************************************
+ * class SwBreakPortion
+ *************************************************************************/
+
+class SwBreakPortion : public SwLinePortion
+{
+#ifdef VERTICAL_LAYOUT
+#else
+ void CalcViewWidth( const SwTxtSizeInfo &rInf );
+#endif
+
+protected:
+#ifndef VERTICAL_LAYOUT
+ KSHORT nViewWidth;
+#endif
+ KSHORT nRestWidth;
+public:
+ SwBreakPortion( const SwLinePortion &rPortion );
+ // liefert 0 zurueck, wenn keine Nutzdaten enthalten sind.
+ virtual SwLinePortion *Compress();
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const{DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ USHORT GetRestWidth() const { return nRestWidth; }
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwKernPortion
+ *************************************************************************/
+
+class SwKernPortion : public SwLinePortion
+{
+ short nKern;
+ sal_Bool bBackground;
+
+#ifdef VERTICAL_LAYOUT
+ sal_Bool bGridKern;
+#endif
+
+public:
+
+#ifdef VERTICAL_LAYOUT
+ // This constructor automatically appends the portion to rPortion
+ // bBG indicates, that the background of the kerning portion has to
+ // be painted, e.g., if the portion if positioned between to fields.
+ // bGridKern indicates, that the kerning portion is used to provide
+ // additional space in grid mode.
+ SwKernPortion( SwLinePortion &rPortion, short nKrn,
+ sal_Bool bBG = sal_False, sal_Bool bGridKern = sal_False );
+
+ // This constructor only sets the height and ascent to the values
+ // of rPortion. It is only used for kerning portions for grid mode
+#else
+ SwKernPortion( SwLinePortion &rPortion, short nKrn,
+ sal_Bool bBG = sal_False );
+#endif
+
+ virtual void FormatEOL( SwTxtFormatInfo &rInf );
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwArrowPortion
+ *************************************************************************/
+
+class SwArrowPortion : public SwLinePortion
+{
+ Point aPos;
+ sal_Bool bLeft;
+public:
+ SwArrowPortion( const SwLinePortion &rPortion );
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ virtual SwLinePortion *Compress();
+#ifndef VERTICAL_LAYOUT
+#endif
+ inline sal_Bool IsLeft() const { return bLeft; }
+ inline const Point& GetPos() const { return aPos; }
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwHangingPortion
+ * The characters which are forbidden at the start of a line like the dot and
+ * other punctuation marks are allowed to display in the margin of the page
+ * by a user option.
+ * The SwHangingPortion is the corresponding textportion to do that.
+ *************************************************************************/
+
+class SwHangingPortion : public SwTxtPortion
+{
+ KSHORT nInnerWidth;
+public:
+ inline SwHangingPortion( SwPosSize aSize ) : nInnerWidth( aSize.Width() )
+ { SetWhichPor( POR_HNG ); SetLen( 1 ); Height( aSize.Height() ); }
+
+ inline KSHORT GetInnerWidth() const { return nInnerWidth; }
+};
+
+
+/*************************************************************************
+ * inline - Implementations
+ *************************************************************************/
+
+CLASSIO( SwBreakPortion )
+CLASSIO( SwEndPortion )
+CLASSIO( SwKernPortion )
+CLASSIO( SwArrowPortion )
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/portab.hxx b/binfilter/bf_sw/source/core/text/portab.hxx
new file mode 100644
index 000000000000..72f9a98a5fec
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/portab.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORTAB_HXX
+#define _PORTAB_HXX
+
+#include "porglue.hxx"
+namespace binfilter {
+
+/*************************************************************************
+ * class SwTabPortion
+ *************************************************************************/
+
+class SwTabPortion : public SwFixPortion
+{
+ const KSHORT nTabPos;
+ const xub_Unicode cFill;
+
+ // Das Format() verzweigt entweder in Pre- oder PostFormat()
+ sal_Bool PreFormat( SwTxtFormatInfo &rInf );
+public:
+ SwTabPortion( const KSHORT nTabPos, const xub_Unicode cFill = '\0' );
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ virtual void FormatEOL( SwTxtFormatInfo &rInf );
+ sal_Bool PostFormat( SwTxtFormatInfo &rInf );
+ inline sal_Bool IsFilled() const { return 0 != cFill; }
+ inline KSHORT GetTabPos() const { return nTabPos; }
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwTabLeftPortion
+ *************************************************************************/
+
+class SwTabLeftPortion : public SwTabPortion
+{
+public:
+ inline SwTabLeftPortion( const KSHORT nTabPos, const xub_Unicode cFill='\0' )
+ : SwTabPortion( nTabPos, cFill )
+ { SetWhichPor( POR_TABLEFT ); }
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwTabRightPortion
+ *************************************************************************/
+
+class SwTabRightPortion : public SwTabPortion
+{
+public:
+ inline SwTabRightPortion( const KSHORT nTabPos, const xub_Unicode cFill='\0' )
+ : SwTabPortion( nTabPos, cFill )
+ { SetWhichPor( POR_TABRIGHT ); }
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwTabCenterPortion
+ *************************************************************************/
+
+class SwTabCenterPortion : public SwTabPortion
+{
+public:
+ inline SwTabCenterPortion( const KSHORT nTabPos, const xub_Unicode cFill='\0' )
+ : SwTabPortion( nTabPos, cFill )
+ { SetWhichPor( POR_TABCENTER ); }
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwTabDecimalPortion
+ *************************************************************************/
+
+class SwTabDecimalPortion : public SwTabPortion
+{
+ const xub_Unicode cTab;
+public:
+ inline SwTabDecimalPortion( const KSHORT nTabPos, const xub_Unicode cTab,
+ const xub_Unicode cFill = '\0' )
+ : SwTabPortion( nTabPos, cFill ), cTab(cTab)
+ { SetWhichPor( POR_TABDECIMAL ); }
+ inline xub_Unicode GetTabDecimal() const { return cTab; }
+ OUTPUT_OPERATOR
+};
+
+CLASSIO( SwTabPortion )
+CLASSIO( SwTabLeftPortion )
+CLASSIO( SwTabRightPortion )
+CLASSIO( SwTabCenterPortion )
+CLASSIO( SwTabDecimalPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/portox.hxx b/binfilter/bf_sw/source/core/text/portox.hxx
new file mode 100644
index 000000000000..bfcbcbe85f64
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/portox.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PORTOX_HXX
+#define _PORTOX_HXX
+
+#include "portxt.hxx"
+
+namespace binfilter {
+
+/*************************************************************************
+ * class SwToxPortion
+ *************************************************************************/
+
+class SwToxPortion : public SwTxtPortion
+{
+public:
+ inline SwToxPortion(){ SetWhichPor( POR_TOX ); }
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * class SwIsoToxPortion
+ *************************************************************************/
+
+class SwIsoToxPortion : public SwToxPortion
+{
+ KSHORT nViewWidth;
+
+public:
+ SwIsoToxPortion();
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ virtual SwLinePortion *Compress();
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+};
+
+/*************************************************************************
+ * inline - Implementations
+ *************************************************************************/
+
+CLASSIO( SwToxPortion )
+CLASSIO( SwIsoToxPortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/portxt.hxx b/binfilter/bf_sw/source/core/text/portxt.hxx
new file mode 100644
index 000000000000..ea28ec5e0d08
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/portxt.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PORTXT_HXX
+#define _PORTXT_HXX
+
+#ifdef GCC
+#include <sys/types.h>
+#else
+#include <new.h> //fuer size_t, FIXEDMEM aus tools
+#endif
+#include <tools/mempool.hxx>
+
+#include "porlin.hxx"
+/*N*/ #include <tools/debug.hxx> //for stripping
+namespace binfilter {
+class SwTxtGuess;
+
+/*************************************************************************
+ * class SwTxtPortion
+ *************************************************************************/
+
+class SwTxtPortion : public SwLinePortion
+{
+ void BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess );
+ void BreakUnderflow( SwTxtFormatInfo &rInf );
+ sal_Bool _Format( SwTxtFormatInfo &rInf );
+
+public:
+ inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
+ SwTxtPortion( const SwLinePortion &rPortion );
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const{DBG_BF_ASSERT(0, "STRIP");}; //STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+ virtual sal_Bool Format( SwTxtFormatInfo &rInf );
+ virtual void FormatEOL( SwTxtFormatInfo &rInf );
+ virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const;
+ virtual sal_Bool GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const;
+
+ // zaehlt die Spaces fuer Blocksatz
+ xub_StrLen GetSpaceCnt( const SwTxtSizeInfo &rInf, xub_StrLen& rCnt ) const;
+
+ sal_Bool CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess );
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTxtPortion)
+};
+
+/*************************************************************************
+ * class SwHolePortion
+ *************************************************************************/
+
+class SwHolePortion : public SwLinePortion
+{
+ KSHORT nBlankWidth;
+public:
+ SwHolePortion( const SwTxtPortion &rPor );
+ inline KSHORT GetBlankWidth( ) const { return nBlankWidth; }
+ inline void SetBlankWidth( const KSHORT nNew ) { nBlankWidth = nNew; }
+ virtual SwLinePortion *Compress();
+ virtual void Paint( const SwTxtPaintInfo &rInf ) const{DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 virtual void Paint( const SwTxtPaintInfo &rInf ) const;
+
+ // Accessibility: pass information about this portion to the PortionHandler
+
+ OUTPUT_OPERATOR
+ DECL_FIXEDMEMPOOL_NEWDEL(SwHolePortion)
+};
+
+CLASSIO( SwTxtPortion )
+CLASSIO( SwHolePortion )
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/possiz.hxx b/binfilter/bf_sw/source/core/text/possiz.hxx
new file mode 100644
index 000000000000..2b03fea578fb
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/possiz.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _POSSIZ_HXX
+#define _POSSIZ_HXX
+
+
+#include <tools/gen.hxx>
+#include "txttypes.hxx"
+namespace binfilter {
+
+// Im Gegensazt zu den SV-Sizes ist die SwPosSize immer positiv
+class SwPosSize
+{
+ KSHORT nWidth;
+ KSHORT nHeight;
+public:
+ inline SwPosSize( const KSHORT nWidth = 0, const KSHORT nHeight = 0 )
+ : nWidth(nWidth), nHeight(nHeight) { }
+ inline SwPosSize( const Size &rSize )
+ : nWidth(KSHORT(rSize.Width())), nHeight(KSHORT(rSize.Height())){ }
+ inline KSHORT Height() const { return nHeight; }
+ inline void Height( const KSHORT nNew ) { nHeight = nNew; }
+ inline KSHORT Width() const { return nWidth; }
+ inline void Width( const KSHORT nNew ) { nWidth = nNew; }
+
+ inline Size SvLSize() const { return Size( nWidth, nHeight ); }
+ inline void SvLSize( const Size &rSize );
+ inline void SvXSize( const Size &rSize );
+ inline sal_Bool operator==( const SwPosSize &rSize ) const;
+ inline SwPosSize &operator=( const SwPosSize &rSize );
+ inline SwPosSize &operator=( const Size &rSize );
+};
+
+inline sal_Bool SwPosSize::operator==(const SwPosSize &rSize ) const
+{
+ return( Height() == rSize.Height() &&
+ Width() == rSize.Width() );
+}
+
+inline SwPosSize &SwPosSize::operator=(const SwPosSize &rSize )
+{
+ nWidth = rSize.Width();
+ nHeight = rSize.Height();
+ return *this;
+}
+
+inline void SwPosSize::SvLSize( const Size &rSize )
+{
+ nWidth = KSHORT(rSize.Width());
+ nHeight = KSHORT(rSize.Height());
+}
+
+inline void SwPosSize::SvXSize( const Size &rSize )
+{
+ nHeight = KSHORT(rSize.Width());
+ nWidth = KSHORT(rSize.Height());
+}
+
+inline SwPosSize &SwPosSize::operator=( const Size &rSize )
+{
+ nWidth = KSHORT(rSize.Width());
+ nHeight = KSHORT(rSize.Height());
+ return *this;
+}
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/redlnitr.hxx b/binfilter/bf_sw/source/core/text/redlnitr.hxx
new file mode 100644
index 000000000000..e9848c80a816
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/redlnitr.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _REDLNITR_HXX
+#define _REDLNITR_HXX
+
+#include "ndhints.hxx"
+#include "redlenum.hxx" // SwRedlineType
+#include "swfont.hxx"
+#ifndef _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTS
+#include <bf_svtools/svstdarr.hxx>
+#endif
+namespace binfilter {
+class SfxItemSet;
+
+class SwTxtNode;
+class SwDoc;
+
+class SwAttrHandler;
+
+class SwExtend
+{
+ SwFont *pFnt;
+ const SvUShorts &rArr; // XAMA: Array of xub_StrLen
+ xub_StrLen nStart;
+ xub_StrLen nPos;
+ xub_StrLen nEnd;
+ sal_Bool _Leave( SwFont& rFnt, xub_StrLen nNew );
+ sal_Bool Inside() const { return ( nPos >= nStart && nPos < nEnd ); }
+ void ActualizeFont( SwFont &rFnt, xub_StrLen nAttr );
+public:
+ SwExtend( const SvUShorts &rA, xub_StrLen nSt ) : rArr( rA ), pFnt(0),
+ nStart( nSt ), nPos( STRING_LEN ), nEnd( nStart + rA.Count() ) {}
+ ~SwExtend() { delete pFnt; }
+ sal_Bool IsOn() const { return pFnt != 0; }
+ void Reset() { if( pFnt ) { delete pFnt; pFnt = NULL; } nPos = STRING_LEN; }
+ sal_Bool Leave( SwFont& rFnt, xub_StrLen nNew )
+ { if( pFnt ) return _Leave( rFnt, nNew ); return sal_False; }
+ short Enter( SwFont& rFnt, xub_StrLen nNew );
+ xub_StrLen Next( xub_StrLen nNext );
+ SwFont* GetFont() { return pFnt; }
+ void UpdateFont( SwFont &rFnt ) { ActualizeFont( rFnt, rArr[ nPos - nStart ] ); }
+};
+
+class SwRedlineItr
+{
+ SwExtend *pExt;
+ sal_Bool bOn;
+public:
+SwRedlineItr( const SwTxtNode& rTxtNd, SwFont& rFnt, SwAttrHandler& rAH,//STRIP001 SwRedlineItr( const SwTxtNode& rTxtNd, SwFont& rFnt, SwAttrHandler& rAH,
+xub_StrLen nRedlPos, sal_Bool bShw, const SvUShorts *pArr = 0,//STRIP001 xub_StrLen nRedlPos, sal_Bool bShw, const SvUShorts *pArr = 0,
+xub_StrLen nStart = STRING_LEN ){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 xub_StrLen nStart = STRING_LEN );
+ inline sal_Bool IsOn() const { return bOn || ( pExt && pExt->IsOn() ); }
+ sal_Bool CheckLine( xub_StrLen nChkStart, xub_StrLen nChkEnd ){DBG_BF_ASSERT(0, "STRIP"); return FALSE;} //STRIP001 sal_Bool CheckLine( xub_StrLen nChkStart, xub_StrLen nChkEnd );
+ inline sal_Bool ExtOn() { if( pExt ) return pExt->IsOn(); return sal_False; }
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_atrstck.cxx b/binfilter/bf_sw/source/core/text/sw_atrstck.cxx
new file mode 100644
index 000000000000..91eeaec8fbaf
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_atrstck.cxx
@@ -0,0 +1,729 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <atrhndl.hxx>
+#include <bf_svtools/itemiter.hxx>
+#include <bf_svx/cmapitem.hxx>
+#include <bf_svx/colritem.hxx>
+#include <bf_svx/cntritem.hxx>
+#include <bf_svx/crsditem.hxx>
+#include <bf_svx/escpitem.hxx>
+#include <bf_svx/fontitem.hxx>
+#include <bf_svx/fhgtitem.hxx>
+#include <bf_svx/kernitem.hxx>
+#include <bf_svx/charreliefitem.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/postitem.hxx>
+#include <bf_svx/shdditem.hxx>
+#include <bf_svx/udlnitem.hxx>
+#include <bf_svx/wghtitem.hxx>
+#include <bf_svx/wrlmitem.hxx>
+#include <bf_svx/akrnitem.hxx>
+#include <bf_svx/blnkitem.hxx>
+#include <bf_svx/charrotateitem.hxx>
+#include <bf_svx/emphitem.hxx>
+#include <bf_svx/charscaleitem.hxx>
+#include <bf_svx/twolinesitem.hxx>
+#include <charfmt.hxx>
+#include <fchrfmt.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <txtinet.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <viewsh.hxx> // ViewShell
+#include <viewopt.hxx> // SwViewOptions
+namespace binfilter {
+
+#define STACK_INCREMENT 4
+
+/*************************************************************************
+ * Attribute to Stack Mapping
+ *
+ * Attributes applied to a text are pushed on different stacks. For each
+ * stack, the top most attribute on the stack is valid. Because some
+ * kinds of attributes have to be pushed to the same stacks we map their
+ * ids to stack ids
+ * Attention: The first NUM_DEFAULT_VALUES ( defined in swfntcch.hxx == 34 )
+ * are stored in the defaultitem-cache, if you add one, you have to increase
+ * NUM_DEFAULT_VALUES.
+ *************************************************************************/
+
+const BYTE StackPos[ RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN + 1 ] = {
+ 0, // // 0
+ 1, // RES_CHRATR_CASEMAP = RES_CHRATR_BEGIN // 1
+ 0, // RES_CHRATR_CHARSETCOLOR, // 2
+ 2, // RES_CHRATR_COLOR, // 3
+ 3, // RES_CHRATR_CONTOUR, // 4
+ 4, // RES_CHRATR_CROSSEDOUT, // 5
+ 5, // RES_CHRATR_ESCAPEMENT, // 6
+ 6, // RES_CHRATR_FONT, // 7
+ 7, // RES_CHRATR_FONTSIZE, // 8
+ 8, // RES_CHRATR_KERNING, // 9
+ 9, // RES_CHRATR_LANGUAGE, // 10
+ 10, // RES_CHRATR_POSTURE, // 11
+ 0, // RES_CHRATR_PROPORTIONALFONTSIZE, // 12
+ 11, // RES_CHRATR_SHADOWED, // 13
+ 12, // RES_CHRATR_UNDERLINE, // 14
+ 13, // RES_CHRATR_WEIGHT, // 15
+ 14, // RES_CHRATR_WORDLINEMODE, // 16
+ 15, // RES_CHRATR_AUTOKERN, // 17
+ 16, // RES_CHRATR_BLINK, // 18
+ 17, // RES_CHRATR_NOHYPHEN, // 19
+ 0, // RES_CHRATR_NOLINEBREAK, // 20
+ 18, // RES_CHRATR_BACKGROUND, // 21
+ 19, // RES_CHRATR_CJK_FONT, // 22
+ 20, // RES_CHRATR_CJK_FONTSIZE, // 23
+ 21, // RES_CHRATR_CJK_LANGUAGE, // 24
+ 22, // RES_CHRATR_CJK_POSTURE, // 25
+ 23, // RES_CHRATR_CJK_WEIGHT, // 26
+ 24, // RES_CHRATR_CTL_FONT, // 27
+ 25, // RES_CHRATR_CTL_FONTSIZE, // 28
+ 26, // RES_CHRATR_CTL_LANGUAGE, // 29
+ 27, // RES_CHRATR_CTL_POSTURE, // 30
+ 28, // RES_CHRATR_CTL_WEIGHT, // 31
+ 29, // RES_CHRATR_ROTATE, // 32
+ 30, // RES_CHRATR_EMPHASIS_MARK, // 33
+ 31, // RES_CHRATR_TWO_LINES, // 34
+ 32, // RES_CHRATR_SCALEW, // 35
+ 33, // RES_CHRATR_RELIEF, // 36
+ 0, // RES_CHRATR_DUMMY1, // 37
+ 0, // RES_TXTATR_INETFMT // 38
+ 0, // RES_TXTATR_DUMMY4, // 39
+ 34, // RES_TXTATR_REFMARK, // 40
+ 35, // RES_TXTATR_TOXMARK, // 41
+ 0, // RES_TXTATR_CHARFMT, // 42
+ 0, // RES_TXTATR_DUMMY5, // 43
+ 36, // RES_TXTATR_CJK_RUBY, // 44
+ 0, // RES_TXTATR_UNKNOWN_CONTAINER, // 45
+ 0, // RES_TXTATR_DUMMY6, // 46
+ 0 // RES_TXTATR_DUMMY7, // 47
+};
+
+/*************************************************************************
+ * lcl_GetItem
+ * extracts pool item of type nWhich from rAttr
+ *************************************************************************/
+
+
+/*************************************************************************
+ * lcl_ChgHyperLinkColor
+ * returns if the color attribute has to be changed for hyperlinks
+ *************************************************************************/
+
+/*M*/ sal_Bool lcl_ChgHyperLinkColor( const SwTxtAttr& rAttr,
+/*M*/ const SfxPoolItem& rItem,
+/*M*/ const ViewShell* pShell )
+/*M*/ {
+/*M*/ return pShell && pShell->GetWin() &&
+/*M*/ ! pShell->GetViewOptions()->IsPagePreview() &&
+/*M*/ RES_TXTATR_INETFMT == rAttr.Which() &&
+/*M*/ RES_CHRATR_COLOR == rItem.Which() &&
+/*M*/ ( ((SwTxtINetFmt&)rAttr).IsVisited() && SwViewOption::IsVisitedLinks() ||
+/*M*/ ! ((SwTxtINetFmt&)rAttr).IsVisited() && SwViewOption::IsLinks() );
+/*M*/ }
+
+
+/*************************************************************************
+ * SwAttrHandler::SwAttrStack::SwAttrStack()
+ *************************************************************************/
+
+/*N*/ inline SwAttrHandler::SwAttrStack::SwAttrStack()
+/*N*/ : nCount( 0 ), nSize( INITIAL_NUM_ATTR )
+/*N*/ {
+/*N*/ pArray = pInitialArray;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::SwAttrStack::Insert()
+ *************************************************************************/
+
+/*N*/ void SwAttrHandler::SwAttrStack::Insert( const SwTxtAttr& rAttr, const USHORT nPos )
+/*N*/ {
+/*N*/ // do we still have enough space?
+/*N*/ if ( nCount >= nSize )
+/*N*/ {
+/*?*/ // we are still in our initial array
+/*?*/ if ( INITIAL_NUM_ATTR == nSize )
+/*?*/ {
+/*?*/ nSize += STACK_INCREMENT;
+/*?*/ pArray = new SwTxtAttr*[ nSize ];
+/*?*/ // copy from pInitArray to new Array
+/*?*/ memcpy( pArray, pInitialArray,
+/*?*/ INITIAL_NUM_ATTR * sizeof(SwTxtAttr*)
+/*?*/ );
+/*?*/ }
+/*?*/ // we are in new memory
+/*?*/ else
+/*?*/ {
+/*?*/ nSize += STACK_INCREMENT;
+/*?*/ SwTxtAttr** pTmpArray = new SwTxtAttr*[ nSize ];
+/*?*/ // copy from pArray to new Array
+/*?*/ memcpy( pTmpArray, pArray, nCount * sizeof(SwTxtAttr*) );
+/*?*/ // free old array
+/*?*/ delete [] pArray;
+/*?*/ pArray = pTmpArray;
+/*?*/ }
+/*?*/ }
+/*N*/
+/*N*/ ASSERT( nPos <= nCount, "wrong position for insert operation");
+/*N*/
+/*N*/ if ( nPos < nCount )
+/*N*/ memmove( pArray + nPos + 1, pArray + nPos,
+/*N*/ ( nCount - nPos ) * sizeof(SwTxtAttr*)
+/*N*/ );
+/*N*/ pArray[ nPos ] = (SwTxtAttr*)&rAttr;
+/*N*/
+/*N*/ nCount++;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::SwAttrStack::Remove()
+ *************************************************************************/
+
+/*N*/ void SwAttrHandler::SwAttrStack::Remove( const SwTxtAttr& rAttr )
+/*N*/ {
+/*N*/ USHORT nPos = Pos( rAttr );
+/*N*/ if ( nPos < nCount )
+/*N*/ {
+/*N*/ memmove( pArray + nPos, pArray + nPos + 1,
+/*N*/ ( nCount - 1 - nPos ) * sizeof(SwTxtAttr*)
+/*N*/ );
+/*N*/ nCount--;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::SwAttrStack::Top()
+ *************************************************************************/
+
+/*N*/ const SwTxtAttr* SwAttrHandler::SwAttrStack::Top() const
+/*N*/ {
+/*N*/ return nCount ? pArray[ nCount - 1 ] : 0;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::SwAttrStack::Pos()
+ *************************************************************************/
+
+/*N*/ USHORT SwAttrHandler::SwAttrStack::Pos( const SwTxtAttr& rAttr ) const
+/*N*/ {
+/*N*/ if ( ! nCount )
+/*N*/ // empty stack
+/*?*/ return USHRT_MAX;
+/*N*/
+/*N*/ for ( USHORT nIdx = nCount; nIdx > 0; )
+/*N*/ {
+/*N*/ if ( &rAttr == pArray[ --nIdx ] )
+/*N*/ return nIdx;
+/*N*/ }
+/*N*/
+/*N*/ // element not found
+/*N*/ return USHRT_MAX;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::SwAttrHandler()
+ *************************************************************************/
+
+/*M*/ SwAttrHandler::SwAttrHandler() : pShell( 0 ), pFnt( 0 ), bVertLayout( sal_False )
+/*M*/
+/*N*/ {
+/*N*/ memset( pDefaultArray, 0, NUM_DEFAULT_VALUES * sizeof(SfxPoolItem*) );
+/*N*/ }
+
+/*N*/ SwAttrHandler::~SwAttrHandler()
+/*N*/ {
+/*N*/ delete pFnt;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::Init()
+ *************************************************************************/
+
+
+/*M*/ void SwAttrHandler::Init( const SfxPoolItem** pPoolItem, const SwAttrSet* pAS,
+/*M*/ const SwDoc& rDoc, const ViewShell* pSh,
+/*M*/ SwFont& rFnt, sal_Bool bVL )
+/*M*/ {
+/*M*/ // initialize default array
+/*M*/ memcpy( pDefaultArray, pPoolItem,
+/*M*/ NUM_DEFAULT_VALUES * sizeof(SfxPoolItem*) );
+/*M*/
+/*M*/ pDoc = &rDoc;
+/*M*/ pShell = pSh;
+/*M*/
+/*M*/ // do we have to apply additional paragraph attributes?
+/*M*/ bVertLayout = bVL;
+/*M*/
+/*M*/ if ( pAS && pAS->Count() )
+/*M*/ {
+/*M*/ SfxItemIter aIter( *pAS );
+/*M*/ register USHORT nWhich;
+/*M*/ const SfxPoolItem* pItem = aIter.GetCurItem();
+/*M*/ while( TRUE )
+/*M*/ {
+/*M*/ nWhich = pItem->Which();
+/*M*/ if( RES_CHRATR_BEGIN <= nWhich && RES_CHRATR_END > nWhich )
+/*M*/ {
+/*M*/ pDefaultArray[ StackPos[ nWhich ] ] = pItem;
+/*M*/ FontChg( *pItem, rFnt, sal_True );
+/*M*/ }
+/*M*/
+/*M*/ if( aIter.IsAtEnd() )
+/*M*/ break;
+/*M*/
+/*M*/ pItem = aIter.NextItem();
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // It is possible, that Init is called more than once, e.g., in a
+/*M*/ // SwTxtFrm::FormatOnceMore situation.
+/*M*/ delete pFnt;
+/*M*/ pFnt = new SwFont( rFnt );
+/*M*/ }
+
+/*N*/ void SwAttrHandler::Reset( )
+/*N*/ {
+/*N*/ for ( USHORT i = 0; i < NUM_ATTRIBUTE_STACKS; i++ )
+/*N*/ aAttrStack[ i ].Reset();
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::PushAndChg()
+ *************************************************************************/
+
+/*M*/ void SwAttrHandler::PushAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
+/*M*/ {
+/*M*/ // these special attributes in fact represent a collection of attributes
+/*M*/ // they have to be pushed to each stack they belong to
+/*M*/ if ( RES_TXTATR_INETFMT == rAttr.Which() ||
+/*M*/ RES_TXTATR_CHARFMT == rAttr.Which() )
+/*M*/ {
+/*M*/ SwCharFmt* pFmt;
+/*M*/ if( RES_TXTATR_INETFMT == rAttr.Which() )
+/*M*/ pFmt = ((SwTxtINetFmt&)rAttr).GetCharFmt();
+/*M*/ else
+/*M*/ pFmt = rAttr.GetCharFmt().GetCharFmt();
+/*M*/
+/*M*/ if ( !pFmt )
+/*M*/ return;
+/*M*/
+/*M*/ for ( USHORT i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
+/*M*/ {
+/*M*/ const SfxPoolItem* pItem;
+/*M*/ BOOL bRet = SFX_ITEM_SET ==
+/*M*/ pFmt->GetItemState( i, TRUE, &pItem );
+/*M*/ if ( bRet )
+/*M*/ {
+/*M*/ // we push rAttr onto the appropriate stack
+/*M*/ if ( Push( rAttr, *pItem , rFnt ) )
+/*M*/ {
+/*M*/ // we let pItem change rFnt
+/*M*/ if ( lcl_ChgHyperLinkColor( rAttr, *pItem, pShell ) )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ // for hyperlinks we still have to evaluate
+/*M*/ // the appearence settings
+/*M*/ }
+/*M*/ else
+/*M*/ FontChg( *pItem, rFnt, sal_True );
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ // this is the usual case, we have a basic attribute, push it onto the
+/*M*/ // stack and change the font
+/*M*/ else
+/*M*/ {
+/*M*/ if ( Push( rAttr, rAttr.GetAttr(), rFnt ) )
+/*M*/ // we let pItem change rFnt
+/*M*/ FontChg( rAttr.GetAttr(), rFnt, sal_True );
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+ * SwAttrHandler::Push()
+ *************************************************************************/
+
+/*M*/ sal_Bool SwAttrHandler::Push( const SwTxtAttr& rAttr, const SfxPoolItem& rItem, SwFont& rFnt )
+/*M*/ {
+/*M*/ ASSERT( rItem.Which() < RES_TXTATR_WITHEND_END ||
+/*M*/ RES_UNKNOWNATR_CONTAINER == rItem.Which() ,
+/*M*/ "I do not want this attribute, nWhich >= RES_TXTATR_WITHEND_END" );
+/*M*/
+/*M*/ // robust
+/*M*/ if ( RES_TXTATR_WITHEND_END <= rItem.Which() ||
+/*M*/ RES_UNKNOWNATR_CONTAINER == rItem.Which() )
+/*M*/ return sal_False;
+/*M*/
+/*M*/ USHORT nStack = StackPos[ rItem.Which() ];
+/*M*/
+/*M*/ // attributes originating from redlining have highest priority
+/*M*/ // second priority are hyperlink attributes, which have a color replacement
+/*M*/ const SwTxtAttr* pTopAttr = aAttrStack[ nStack ].Top();
+/*M*/ if ( ! pTopAttr || rAttr.IsPriorityAttr() ||
+/*M*/ ( ! pTopAttr->IsPriorityAttr() &&
+/*M*/ ! lcl_ChgHyperLinkColor( *pTopAttr, rItem, pShell ) ) )
+/*M*/ {
+/*M*/ aAttrStack[ nStack ].Push( rAttr );
+/*M*/ return sal_True;
+/*M*/ }
+/*M*/
+/*M*/ USHORT nPos = aAttrStack[ nStack ].Count();
+/*M*/ ASSERT( nPos, "empty stack?" );
+/*M*/ aAttrStack[ nStack ].Insert( rAttr, nPos - 1 );
+/*M*/ return sal_False;
+/*M*/ }
+
+/*************************************************************************
+ * SwAttrHandler::PopAndChg()
+ *************************************************************************/
+
+/*N*/ void SwAttrHandler::PopAndChg( const SwTxtAttr& rAttr, SwFont& rFnt )
+/*N*/ {
+/*N*/ // these special attributes in fact represent a collection of attributes
+/*N*/ // they have to be removed from each stack they belong to
+/*N*/ if ( RES_TXTATR_INETFMT == rAttr.Which() ||
+/*N*/ RES_TXTATR_CHARFMT == rAttr.Which() )
+/*N*/ {
+/*N*/ SwCharFmt* pFmt;
+/*N*/ if( RES_TXTATR_INETFMT == rAttr.Which() )
+/*N*/ pFmt = ((SwTxtINetFmt&)rAttr).GetCharFmt();
+/*N*/ else
+/*N*/ pFmt = rAttr.GetCharFmt().GetCharFmt();
+/*N*/
+/*N*/ if ( !pFmt )
+/*N*/ return;
+/*N*/
+/*N*/ for ( USHORT i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ BOOL bRet = SFX_ITEM_SET ==
+/*N*/ pFmt->GetItemState( i, TRUE, &pItem );
+/*N*/ if ( bRet )
+/*N*/ {
+/*N*/ // we remove rAttr from the appropriate stack
+/*N*/ USHORT nStackPos = StackPos[ i ];
+/*N*/ aAttrStack[ nStackPos ].Remove( rAttr );
+/*N*/ // reset font according to attribute on top of stack
+/*N*/ // or default value
+/*N*/ ActivateTop( rFnt, i );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // this is the usual case, we have a basic attribute, remove it from the
+/*N*/ // stack and reset the font
+/*N*/ else if ( RES_UNKNOWNATR_CONTAINER != rAttr.Which() )
+/*N*/ {
+/*N*/ aAttrStack[ StackPos[ rAttr.Which() ] ].Remove( rAttr );
+/*N*/ // reset font according to attribute on top of stack
+/*N*/ // or default value
+/*N*/ ActivateTop( rFnt, rAttr.Which() );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrHandler::Pop()
+ *
+ * only used during redlining
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwAttrHandler::ActivateTop()
+ *************************************************************************/
+/*M*/ void SwAttrHandler::ActivateTop( SwFont& rFnt, const USHORT nAttr )
+/*M*/ {
+/*M*/ ASSERT( nAttr < RES_TXTATR_WITHEND_END,
+/*M*/ "I cannot activate this attribute, nWhich >= RES_TXTATR_WITHEND_END" );
+/*M*/
+/*M*/ const USHORT nStackPos = StackPos[ nAttr ];
+/*M*/ const SwTxtAttr* pTopAt = aAttrStack[ nStackPos ].Top();
+/*M*/ if ( pTopAt )
+/*M*/ {
+/*M*/ // check if top attribute is collection of attributes
+/*M*/ if ( RES_TXTATR_INETFMT == pTopAt->Which() ||
+/*M*/ RES_TXTATR_CHARFMT == pTopAt->Which() )
+/*M*/ {
+/*M*/ SwCharFmt* pFmtNext;
+/*M*/ if( RES_TXTATR_INETFMT == pTopAt->Which() )
+/*M*/ pFmtNext = ((SwTxtINetFmt*)pTopAt)->GetCharFmt();
+/*M*/ else
+/*M*/ pFmtNext = pTopAt->GetCharFmt().GetCharFmt();
+/*M*/
+/*M*/ const SfxPoolItem* pItemNext;
+/*M*/ pFmtNext->GetItemState( nAttr, TRUE, &pItemNext );
+/*M*/
+/*M*/ if ( lcl_ChgHyperLinkColor( *pTopAt, *pItemNext, pShell ) )
+/*M*/ {
+/*M*/ // for hyperlinks we still have to evaluate
+/*M*/ // the appearence settings
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 Color aColor;
+/*M*/ }
+/*M*/ else
+/*M*/ FontChg( *pItemNext, rFnt, sal_False );
+/*M*/ }
+/*M*/ else
+/*M*/ FontChg( pTopAt->GetAttr(), rFnt, sal_False );
+/*M*/ }
+/*M*/
+/*M*/ // default value has to be set, we only have default values for char attribs
+/*M*/ else if ( nStackPos < NUM_DEFAULT_VALUES )
+/*M*/ FontChg( *pDefaultArray[ nStackPos ], rFnt, sal_False );
+/*M*/
+/*M*/ else if ( RES_TXTATR_REFMARK == nAttr )
+/*M*/ rFnt.GetRef()--;
+/*M*/ else if ( RES_TXTATR_TOXMARK == nAttr )
+/*M*/ rFnt.GetTox()--;
+/*M*/ else if ( RES_TXTATR_CJK_RUBY == nAttr )
+/*M*/ {
+/*M*/ // ruby stack has no more attributes
+/*M*/ // check, if an rotation attribute has to be applied
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 USHORT nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+ * Font Changing Function
+ *
+ * When popping an attribute from the stack, the top mose remaining
+ * attribute in the stack becomes valid. The following function change
+ * a font depending on the stack id.
+ *************************************************************************/
+
+/*M*/ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, sal_Bool bPush )
+/*M*/ {
+/*M*/ switch ( rItem.Which() )
+/*M*/ {
+/*M*/ case RES_CHRATR_CASEMAP :
+/*M*/ rFnt.SetCaseMap( ((SvxCaseMapItem&)rItem).GetCaseMap() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_COLOR :
+/*M*/ rFnt.SetColor( ((SvxColorItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CONTOUR :
+/*M*/ rFnt.SetOutline( ((SvxContourItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CROSSEDOUT :
+/*M*/ rFnt.SetStrikeout( ((SvxCrossedOutItem&)rItem).GetStrikeout() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_ESCAPEMENT :
+/*M*/ rFnt.SetEscapement( ((SvxEscapementItem&)rItem).GetEsc() );
+/*M*/ rFnt.SetProportion( ((SvxEscapementItem&)rItem).GetProp() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_FONT :
+/*M*/ rFnt.SetName( ((SvxFontItem&)rItem).GetFamilyName(), SW_LATIN );
+/*M*/ rFnt.SetStyleName( ((SvxFontItem&)rItem).GetStyleName(), SW_LATIN );
+/*M*/ rFnt.SetFamily( ((SvxFontItem&)rItem).GetFamily(), SW_LATIN );
+/*M*/ rFnt.SetPitch( ((SvxFontItem&)rItem).GetPitch(), SW_LATIN );
+/*M*/ rFnt.SetCharSet( ((SvxFontItem&)rItem).GetCharSet(), SW_LATIN );
+/*M*/ break;
+/*M*/ case RES_CHRATR_FONTSIZE :
+/*M*/ rFnt.SetSize(Size(0,((SvxFontHeightItem&)rItem).GetHeight() ), SW_LATIN );
+/*M*/ break;
+/*M*/ case RES_CHRATR_KERNING :
+/*M*/ rFnt.SetFixKerning( ((SvxKerningItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_LANGUAGE :
+/*M*/ rFnt.SetLanguage( ((SvxLanguageItem&)rItem).GetLanguage(), SW_LATIN );
+/*M*/ break;
+/*M*/ case RES_CHRATR_POSTURE :
+/*M*/ rFnt.SetItalic( ((SvxPostureItem&)rItem).GetPosture(), SW_LATIN );
+/*M*/ break;
+/*M*/ case RES_CHRATR_SHADOWED :
+/*M*/ rFnt.SetShadow( ((SvxShadowedItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_UNDERLINE :
+/*M*/ rFnt.SetUnderline( ((SvxUnderlineItem&)rItem).GetUnderline() );
+/*M*/ rFnt.SetUnderColor( ((SvxUnderlineItem&)rItem).GetColor() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_WEIGHT :
+/*M*/ rFnt.SetWeight( ((SvxWeightItem&)rItem).GetWeight(), SW_LATIN );
+/*M*/ break;
+/*M*/ case RES_CHRATR_WORDLINEMODE :
+/*M*/ rFnt.SetWordLineMode( ((SvxWordLineModeItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_AUTOKERN :
+/*M*/ if( ((SvxAutoKernItem&)rItem).GetValue() )
+/*M*/ rFnt.SetAutoKern( ( !pDoc || !pDoc->IsKernAsianPunctuation() ) ?
+/*M*/ KERNING_FONTSPECIFIC : KERNING_ASIAN );
+/*M*/ else
+/*M*/ rFnt.SetAutoKern( 0 );
+/*M*/ break;
+/*M*/ case RES_CHRATR_BLINK :
+/*M*/ rFnt.SetBlink( ((SvxBlinkItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_BACKGROUND :
+/*M*/ rFnt.SetBackColor(new Color( ((SvxBrushItem&)rItem).GetColor() ) );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CJK_FONT :
+/*M*/ rFnt.SetName( ((SvxFontItem&)rItem).GetFamilyName(), SW_CJK );
+/*M*/ rFnt.SetStyleName( ((SvxFontItem&)rItem).GetStyleName(), SW_CJK );
+/*M*/ rFnt.SetFamily( ((SvxFontItem&)rItem).GetFamily(), SW_CJK );
+/*M*/ rFnt.SetPitch( ((SvxFontItem&)rItem).GetPitch(), SW_CJK );
+/*M*/ rFnt.SetCharSet( ((SvxFontItem&)rItem).GetCharSet(), SW_CJK );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CJK_FONTSIZE :
+/*M*/ rFnt.SetSize(Size( 0, ((SvxFontHeightItem&)rItem).GetHeight()), SW_CJK);
+/*M*/ break;
+/*M*/ case RES_CHRATR_CJK_LANGUAGE :
+/*M*/ rFnt.SetLanguage( ((SvxLanguageItem&)rItem).GetLanguage(), SW_CJK );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CJK_POSTURE :
+/*M*/ rFnt.SetItalic( ((SvxPostureItem&)rItem).GetPosture(), SW_CJK );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CJK_WEIGHT :
+/*M*/ rFnt.SetWeight( ((SvxWeightItem&)rItem).GetWeight(), SW_CJK );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CTL_FONT :
+/*M*/ rFnt.SetName( ((SvxFontItem&)rItem).GetFamilyName(), SW_CTL );
+/*M*/ rFnt.SetStyleName( ((SvxFontItem&)rItem).GetStyleName(), SW_CTL );
+/*M*/ rFnt.SetFamily( ((SvxFontItem&)rItem).GetFamily(), SW_CTL );
+/*M*/ rFnt.SetPitch( ((SvxFontItem&)rItem).GetPitch(), SW_CTL );
+/*M*/ rFnt.SetCharSet( ((SvxFontItem&)rItem).GetCharSet(), SW_CTL );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CTL_FONTSIZE :
+/*M*/ rFnt.SetSize(Size(0, ((SvxFontHeightItem&)rItem).GetHeight() ), SW_CTL);
+/*M*/ break;
+/*M*/ case RES_CHRATR_CTL_LANGUAGE :
+/*M*/ rFnt.SetLanguage( ((SvxLanguageItem&)rItem).GetLanguage(), SW_CTL );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CTL_POSTURE :
+/*M*/ rFnt.SetItalic( ((SvxPostureItem&)rItem).GetPosture(), SW_CTL );
+/*M*/ break;
+/*M*/ case RES_CHRATR_CTL_WEIGHT :
+/*M*/ rFnt.SetWeight( ((SvxWeightItem&)rItem).GetWeight(), SW_CTL );
+/*M*/ break;
+/*M*/ case RES_CHRATR_EMPHASIS_MARK :
+/*M*/ rFnt.SetEmphasisMark(
+/*M*/ ((SvxEmphasisMarkItem&)rItem).GetEmphasisMark()
+/*M*/ );
+/*M*/ break;
+/*M*/ case RES_CHRATR_SCALEW :
+/*M*/ rFnt.SetPropWidth( ((SvxCharScaleWidthItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/ case RES_CHRATR_RELIEF :
+/*M*/ rFnt.SetRelief( (FontRelief)((SvxCharReliefItem&)rItem).GetValue() );
+/*M*/ break;
+/*M*/
+/*M*/ case RES_CHRATR_ROTATE :
+/*M*/ {
+/*M*/ // rotate attribute is applied, when:
+/*M*/ // 1. ruby stack is empty and
+/*M*/ // 2. top of two line stack ( or default attribute )is an
+/*M*/ // deactivated two line attribute
+/*M*/ sal_Bool bRuby = 0 !=
+/*M*/ aAttrStack[ StackPos[ RES_TXTATR_CJK_RUBY ] ].Count();
+/*M*/
+/*M*/ if ( bRuby )
+/*M*/ break;
+/*M*/
+/*M*/ USHORT nTwoLineStack = StackPos[ RES_CHRATR_TWO_LINES ];
+/*M*/ sal_Bool bTwoLineAct = sal_False;
+/*M*/ const SfxPoolItem* pTwoLineItem = 0;
+/*M*/ const SwTxtAttr* pTwoLineAttr = aAttrStack[ nTwoLineStack ].Top();
+/*M*/
+/*M*/ if ( pTwoLineAttr )
+/*M*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pTwoLineItem = lcl_GetItem( *pTwoLineAttr, RES_CHRATR_TWO_LINES );
+/*?*/ bTwoLineAct = ((SvxTwoLinesItem*)pTwoLineItem)->GetValue();
+/*M*/ }
+/*M*/ else
+/*M*/ bTwoLineAct =
+/*M*/ ((SvxTwoLinesItem*)pDefaultArray[ nTwoLineStack ])->GetValue();
+/*M*/
+/*M*/ if ( !bTwoLineAct )
+/*M*/ rFnt.SetVertical( ((SvxCharRotateItem&)rItem).GetValue(),
+/*M*/ bVertLayout );
+/*M*/
+/*M*/ break;
+/*M*/ }
+/*M*/ case RES_CHRATR_TWO_LINES :
+/*M*/ {
+/*M*/ sal_Bool bRuby = 0 !=
+/*M*/ aAttrStack[ StackPos[ RES_TXTATR_CJK_RUBY ] ].Count();
+/*M*/ sal_Bool bTwoLineAct = sal_False;
+/*M*/
+/*M*/ // two line is activated, if
+/*M*/ // 1. no ruby attribute is set and
+/*M*/ // 2. attribute is active
+/*M*/ bTwoLineAct = ((SvxTwoLinesItem&)rItem).GetValue();
+/*M*/
+/*M*/ if ( !bRuby && bTwoLineAct )
+/*M*/ {
+/*M*/ rFnt.SetVertical( 0, bVertLayout );
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ // a deactivating two line attribute is on top of stack,
+/*M*/ // check if rotate attribute has to be enabled
+/*M*/ if ( bRuby )
+/*M*/ break;
+/*M*/
+/*M*/ USHORT nRotateStack = StackPos[ RES_CHRATR_ROTATE ];
+/*M*/ const SfxPoolItem* pRotateItem = 0;
+/*M*/ const SwTxtAttr* pRotateAttr = aAttrStack[ nRotateStack ].Top();
+/*M*/
+/*M*/ if ( pRotateAttr )
+/*M*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pRotateItem = lcl_GetItem( *pRotateAttr, RES_CHRATR_ROTATE );
+/*M*/ }
+/*M*/ else
+/*M*/ rFnt.SetVertical(
+/*M*/ ((SvxCharRotateItem*)pDefaultArray[ nRotateStack ])->GetValue(),
+/*M*/ bVertLayout
+/*M*/ );
+/*M*/ break;
+/*M*/ }
+/*M*/ case RES_TXTATR_CJK_RUBY :
+/*M*/ rFnt.SetVertical( 0, bVertLayout );
+/*M*/ break;
+/*M*/ case RES_TXTATR_REFMARK :
+/*M*/ if ( bPush )
+/*M*/ rFnt.GetRef()++;
+/*M*/ else
+/*M*/ rFnt.GetRef()--;
+/*M*/ break;
+/*M*/ case RES_TXTATR_TOXMARK :
+/*M*/ if ( bPush )
+/*M*/ rFnt.GetTox()++;
+/*M*/ else
+/*M*/ rFnt.GetTox()--;
+/*M*/ break;
+/*M*/ }
+/*M*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_blink.cxx b/binfilter/bf_sw/source/core/text/sw_blink.cxx
new file mode 100644
index 000000000000..ccd868ad8bd0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_blink.cxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include "blink.hxx"
+#include "porlay.hxx" // SwLineLayout
+namespace binfilter {
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_frmcrsr.cxx b/binfilter/bf_sw/source/core/text/sw_frmcrsr.cxx
new file mode 100644
index 000000000000..fc789c0ebbd0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_frmcrsr.cxx
@@ -0,0 +1,634 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+#include "pam.hxx" // SwPosition
+
+#include <horiornt.hxx>
+
+#include "pagefrm.hxx"
+
+
+
+
+
+
+#include <unicode/ubidi.h>
+
+#include "txtcfg.hxx"
+#include "itrtxt.hxx" // SwTxtCursor
+#include "crstate.hxx" // SwTxtCursor
+
+#if OSL_DEBUG_LEVEL > 1
+#endif
+namespace binfilter {
+
+#define MIN_OFFSET_STEP 10
+
+/*
+ * 1170-SurvivalKit: Wie gelangt man hinter das letzte Zeichen der Zeile.
+ * - RightMargin verzichtet auf den Positionsausgleich mit -1
+ * - GetCharRect liefert bei MV_RIGHTMARGIN ein GetEndCharRect
+ * - GetEndCharRect setzt bRightMargin auf sal_True
+ * - SwTxtCursor::bRightMargin wird per CharCrsrToLine auf sal_False gesetzt
+ */
+
+/*************************************************************************
+ * GetAdjFrmAtPos()
+ *************************************************************************/
+
+/*N*/ SwTxtFrm *GetAdjFrmAtPos( SwTxtFrm *pFrm, const SwPosition &rPos,
+/*N*/ const sal_Bool bRightMargin, const sal_Bool bNoScroll = TRUE )
+/*N*/ {
+/*N*/ // 8810: vgl. 1170, RightMargin in der letzten Masterzeile...
+/*N*/ const xub_StrLen nOffset = rPos.nContent.GetIndex();
+/*N*/ SwTxtFrm *pFrmAtPos = pFrm;
+/*N*/ if( !bNoScroll || pFrm->GetFollow() )
+/*N*/ {
+/*N*/ pFrmAtPos = pFrm->GetFrmAtPos( rPos );
+/*N*/ if( nOffset < pFrmAtPos->GetOfst() &&
+/*N*/ !pFrmAtPos->IsFollow() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ xub_StrLen nNew = nOffset;
+/*N*/ }
+/*N*/ }
+/*N*/ while( pFrm != pFrmAtPos )
+/*N*/ {
+/*?*/ pFrm = pFrmAtPos;
+/*?*/ pFrm->GetFormatted();
+/*?*/ pFrmAtPos = (SwTxtFrm*)pFrm->GetFrmAtPos( rPos );
+/*N*/ }
+/*N*/
+/*N*/ if( nOffset && bRightMargin )
+/*N*/ {
+/*N*/ while( pFrmAtPos && pFrmAtPos->GetOfst() == nOffset &&
+/*N*/ pFrmAtPos->IsFollow() )
+/*N*/ {
+/*?*/ pFrmAtPos->GetFormatted();
+/*?*/ pFrmAtPos = pFrmAtPos->FindMaster();
+/*N*/ }
+/*N*/ ASSERT( pFrmAtPos, "+GetCharRect: no frame with my rightmargin" );
+/*N*/ }
+/*N*/ return pFrmAtPos ? pFrmAtPos : pFrm;
+/*N*/ }
+
+
+/*************************************************************************
+ * GetFrmAtOfst(), GetFrmAtPos()
+ *************************************************************************/
+
+/*N*/ SwTxtFrm *SwTxtFrm::GetFrmAtOfst( const xub_StrLen nWhere )
+/*N*/ {
+/*N*/ SwTxtFrm *pRet = this;
+/*N*/ while( pRet->HasFollow() && nWhere >= pRet->GetFollow()->GetOfst() )
+/*?*/ pRet = pRet->GetFollow();
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ SwTxtFrm *SwTxtFrm::GetFrmAtPos( const SwPosition &rPos )
+/*N*/ {
+/*N*/ SwTxtFrm *pFoll = (SwTxtFrm*)this;
+/*N*/ while( pFoll->GetFollow() )
+/*N*/ {
+/*N*/ if( rPos.nContent.GetIndex() > pFoll->GetFollow()->GetOfst() )
+/*N*/ pFoll = pFoll->GetFollow();
+/*N*/ else
+/*N*/ {
+/*N*/ if( rPos.nContent.GetIndex() == pFoll->GetFollow()->GetOfst()
+/*N*/ && !SwTxtCursor::IsRightMargin() )
+/*?*/ pFoll = pFoll->GetFollow();
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return pFoll;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::GetCharRect()
+ *************************************************************************/
+
+/*
+ * GetCharRect() findet die Characterzelle des Characters, dass
+ * durch aPos beschrieben wird. GetCrsrOfst() findet den
+ * umgekehrten Weg: Von einer Dokumentkoordinate zu einem Pam.
+ * Beide sind virtuell in der Framebasisklasse und werden deshalb
+ * immer angezogen.
+ */
+
+/*N*/ sal_Bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
+/*N*/ SwCrsrMoveState *pCMS ) const
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::GetCharRect with swapped frame" );
+/*N*/
+/*N*/ if( IsLocked() || IsHiddenNow() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ //Erstmal den richtigen Frm finden, dabei muss beachtet werden, dass:
+/*N*/ //- die gecachten Informationen verworfen sein koennen (GetPara() == 0)
+/*N*/ //- das ein Follow gemeint sein kann
+/*N*/ //- das die Kette der Follows dynamisch waechst; der in den wir
+/*N*/ // schliesslich gelangen muss aber Formatiert sein.
+/*N*/
+/*N*/ // opt: reading ahead erspart uns ein GetAdjFrmAtPos
+/*N*/ const sal_Bool bRightMargin = pCMS && ( MV_RIGHTMARGIN == pCMS->eState );
+/*N*/ const sal_Bool bNoScroll = pCMS && pCMS->bNoScroll;
+/*N*/ SwTxtFrm *pFrm = GetAdjFrmAtPos( (SwTxtFrm*)this, rPos, bRightMargin,
+/*N*/ bNoScroll );
+/*N*/ pFrm->GetFormatted();
+/*N*/ const SwFrm* pTmpFrm = (SwFrm*)pFrm->GetUpper();
+/*N*/
+/*N*/ SWRECTFN ( pFrm )
+/*N*/ const SwTwips nUpperMaxY = (pTmpFrm->*fnRect->fnGetPrtBottom)();
+/*N*/ const SwTwips nFrmMaxY = (pFrm->*fnRect->fnGetPrtBottom)();
+/*N*/
+/*N*/ // nMaxY is an absolute value
+/*N*/ SwTwips nMaxY = bVert ?
+/*N*/ Max( nFrmMaxY, nUpperMaxY ) :
+/*N*/ Min( nFrmMaxY, nUpperMaxY );
+/*N*/
+/*N*/ sal_Bool bRet = sal_False;
+/*N*/
+/*N*/ if ( pFrm->IsEmpty() || ! (pFrm->Prt().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ Point aPnt1 = pFrm->Frm().Pos() + pFrm->Prt().Pos();
+/*N*/ SwTxtNode* pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+/*N*/ short nFirstOffset;
+/*N*/ pTxtNd->GetFirstLineOfsWithNum( nFirstOffset );
+/*N*/
+/*N*/ Point aPnt2;
+/*N*/ if ( bVert )
+/*N*/ {
+/*?*/ if( nFirstOffset > 0 )
+/*?*/ aPnt1.Y() += nFirstOffset;
+/*?*/
+/*?*/ if ( aPnt1.X() < nMaxY )
+/*?*/ aPnt1.X() = nMaxY;
+/*?*/ aPnt2.X() = aPnt1.X() + pFrm->Prt().Width();
+/*?*/ aPnt2.Y() = aPnt1.Y();
+/*?*/ if( aPnt2.X() < nMaxY )
+/*?*/ aPnt2.X() = nMaxY;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( nFirstOffset > 0 )
+/*N*/ aPnt1.X() += nFirstOffset;
+/*N*/
+/*N*/ if( aPnt1.Y() > nMaxY )
+/*N*/ aPnt1.Y() = nMaxY;
+/*N*/ aPnt2.X() = aPnt1.X();
+/*N*/ aPnt2.Y() = aPnt1.Y() + pFrm->Prt().Height();
+/*N*/ if( aPnt2.Y() > nMaxY )
+/*N*/ aPnt2.Y() = nMaxY;
+/*N*/ }
+/*N*/
+/*N*/ rOrig = SwRect( aPnt1, aPnt2 );
+/*N*/
+/*N*/ if ( pCMS )
+/*N*/ {
+/*N*/ pCMS->aRealHeight.X() = 0;
+/*N*/ pCMS->aRealHeight.Y() = bVert ? -rOrig.Width() : rOrig.Height();
+/*N*/ }
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ if ( pFrm->IsRightToLeft() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pFrm->SwitchLTRtoRTL( rOrig );
+/*N*/ #endif
+/*N*/
+/*N*/ bRet = sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pFrm->HasPara() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ SwFrmSwapper aSwapper( pFrm, sal_True );
+/*N*/ if ( bVert )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nMaxY = pFrm->SwitchVerticalToHorizontal( nMaxY );
+/*N*/
+/*N*/ sal_Bool bGoOn = sal_True;
+/*N*/ xub_StrLen nOffset = rPos.nContent.GetIndex();
+/*N*/ xub_StrLen nNextOfst;
+/*N*/
+/*N*/ do
+/*N*/ {
+/*N*/ {
+/*N*/ SwTxtSizeInfo aInf( pFrm );
+/*N*/ SwTxtCursor aLine( pFrm, &aInf );
+/*N*/ nNextOfst = aLine.GetEnd();
+/*N*/ // Siehe Kommentar in AdjustFrm
+/*N*/ // 1170: das letzte Zeichen der Zeile mitnehmen?
+/*N*/ bRet = bRightMargin ? aLine.GetEndCharRect( &rOrig, nOffset, pCMS, nMaxY )
+/*N*/ : aLine.GetCharRect( &rOrig, nOffset, pCMS, nMaxY );
+/*N*/ }
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ if ( pFrm->IsRightToLeft() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pFrm->SwitchLTRtoRTL( rOrig );
+/*N*/ #endif
+/*N*/ if ( bVert )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pFrm->SwitchHorizontalToVertical( rOrig );
+/*N*/
+/*N*/ if( pFrm->IsUndersized() && pCMS && !pFrm->GetNext() &&
+/*N*/ (rOrig.*fnRect->fnGetBottom)() == nUpperMaxY &&
+/*N*/ pFrm->GetOfst() < nOffset &&
+/*N*/ !pFrm->IsFollow() && !bNoScroll &&
+/*N*/ pFrm->GetTxtNode()->GetTxt().Len() != nNextOfst )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ bGoOn = lcl_ChangeOffset( pFrm, nNextOfst );
+/*N*/ else
+/*N*/ bGoOn = sal_False;
+/*N*/ } while ( bGoOn );
+/*N*/
+/*N*/ if ( pCMS )
+/*N*/ {
+/*N*/ #ifdef BIDI
+/*N*/ if ( pFrm->IsRightToLeft() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ if( pCMS->b2Lines && pCMS->p2Lines)
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if ( bVert )
+/*N*/ {
+/*?*/ if ( pCMS->bRealHeight )
+/*?*/ {
+/*?*/ pCMS->aRealHeight.Y() = -pCMS->aRealHeight.Y();
+/*?*/ if ( pCMS->aRealHeight.Y() < 0 )
+/*?*/ {
+/*?*/ // writing direction is from top to bottom
+/*?*/ pCMS->aRealHeight.X() = ( rOrig.Width() -
+/*?*/ pCMS->aRealHeight.X() +
+/*?*/ pCMS->aRealHeight.Y() );
+/*?*/ }
+/*?*/ }
+/*?*/ if( pCMS->b2Lines && pCMS->p2Lines)
+/*?*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pFrm->SwitchHorizontalToVertical( pCMS->p2Lines->aLine );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/ }
+/*N*/ if( bRet )
+/*N*/ {
+/*N*/ SwPageFrm *pPage = pFrm->FindPageFrm();
+/*N*/ ASSERT( pPage, "Text esaped from page?" );
+/*N*/ const SwTwips nOrigTop = (rOrig.*fnRect->fnGetTop)();
+/*N*/ const SwTwips nPageTop = (pPage->Frm().*fnRect->fnGetTop)();
+/*N*/ const SwTwips nPageBott = (pPage->Frm().*fnRect->fnGetBottom)();
+/*N*/
+/*N*/ // Following situation: if the frame is in an invalid sectionframe,
+/*N*/ // it's possible that the frame is outside the page. If we restrict
+/*N*/ // the cursor position to the page area, we enforce the formatting
+/*N*/ // of the page, of the section frame and the frame himself.
+/*N*/ if( (*fnRect->fnYDiff)( nPageTop, nOrigTop ) > 0 )
+/*N*/ (rOrig.*fnRect->fnSetTop)( nPageTop );
+/*N*/
+/*N*/ if ( (*fnRect->fnYDiff)( nOrigTop, nPageBott ) > 0 )
+/*?*/ (rOrig.*fnRect->fnSetTop)( nPageBott );
+/*N*/ }
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::GetAutoPos()
+ *************************************************************************/
+
+/*
+ * GetAutoPos() findet die Characterzelle des Characters, dass
+ * durch aPos beschrieben wird und wird von autopositionierten Rahmen genutzt.
+ */
+
+/*N*/ sal_Bool SwTxtFrm::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const
+/*N*/ {
+/*N*/ if( IsHiddenNow() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ xub_StrLen nOffset = rPos.nContent.GetIndex();
+/*N*/ SwTxtFrm *pFrm = ((SwTxtFrm*)this)->GetFrmAtOfst( nOffset );
+/*N*/
+/*N*/ pFrm->GetFormatted();
+/*N*/ const SwFrm* pTmpFrm = (SwFrm*)pFrm->GetUpper();
+/*N*/
+/*N*/ SWRECTFN( pTmpFrm )
+/*N*/ SwTwips nUpperMaxY = (pTmpFrm->*fnRect->fnGetPrtBottom)();
+/*N*/
+/*N*/ // nMaxY is in absolute value
+/*N*/ SwTwips nMaxY = bVert ?
+/*N*/ Max( (pFrm->*fnRect->fnGetPrtBottom)(), nUpperMaxY ) :
+/*N*/ Min( (pFrm->*fnRect->fnGetPrtBottom)(), nUpperMaxY );
+/*N*/
+/*N*/ if ( pFrm->IsEmpty() || ! (pFrm->Prt().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ Point aPnt1 = pFrm->Frm().Pos() + pFrm->Prt().Pos();
+/*N*/ Point aPnt2;
+/*N*/ if ( bVert )
+/*N*/ {
+/*?*/ if ( aPnt1.X() < nMaxY )
+/*?*/ aPnt1.X() = nMaxY;
+/*?*/ aPnt2.X() = aPnt1.X() + pFrm->Prt().Width();
+/*?*/ aPnt2.Y() = aPnt1.Y();
+/*?*/ if( aPnt2.X() < nMaxY )
+/*?*/ aPnt2.X() = nMaxY;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*N*/ if( aPnt1.Y() > nMaxY )
+/*N*/ aPnt1.Y() = nMaxY;
+/*N*/ aPnt2.X() = aPnt1.X();
+/*N*/ aPnt2.Y() = aPnt1.Y() + pFrm->Prt().Height();
+/*N*/ if( aPnt2.Y() > nMaxY )
+/*N*/ aPnt2.Y() = nMaxY;
+/*N*/ }
+/*N*/ rOrig = SwRect( aPnt1, aPnt2 );
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+ return FALSE;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::_GetCrsrOfst()
+ *************************************************************************/
+
+// Minimaler Abstand von nichtleeren Zeilen etwas weniger als 2 cm
+#define FILL_MIN_DIST 1100
+
+struct SwFillData
+{
+ SwRect aFrm;
+ const SwCrsrMoveState *pCMS;
+ SwPosition* pPos;
+ const Point& rPoint;
+ SwTwips nLineWidth;
+ sal_Bool bFirstLine : 1;
+ sal_Bool bInner : 1;
+ sal_Bool bColumn : 1;
+ sal_Bool bEmpty : 1;
+ SwFillData( const SwCrsrMoveState *pC, SwPosition* pP, const SwRect& rR,
+ const Point& rPt ) : aFrm( rR ), pCMS( pC ), pPos( pP ), rPoint( rPt ),
+ nLineWidth( 0 ), bFirstLine( sal_True ), bInner( sal_False ), bColumn( sal_False ),
+ bEmpty( sal_True ){}
+ SwFillMode Mode() const { return pCMS->pFill->eMode; }
+ long X() const { return rPoint.X(); }
+ long Y() const { return rPoint.Y(); }
+ long Left() const { return aFrm.Left(); }
+ long Right() const { return aFrm.Right(); }
+ long Bottom() const { return aFrm.Bottom(); }
+ SwRect& Frm() { return aFrm; }
+ SwFillCrsrPos &Fill() const { return *pCMS->pFill; }
+ void SetTab( MSHORT nNew ) { pCMS->pFill->nTabCnt = nNew; }
+ void SetSpace( MSHORT nNew ) { pCMS->pFill->nSpaceCnt = nNew; }
+ void SetOrient( const SwHoriOrient eNew ){ pCMS->pFill->eOrient = eNew; }
+};
+
+/*N*/ sal_Bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
+/*N*/ const sal_Bool bChgFrm, const SwCrsrMoveState* pCMS ) const
+/*N*/ {
+/*N*/ // 8804: _GetCrsrOfst wird vom GetCrsrOfst und GetKeyCrsrOfst gerufen.
+/*N*/ // In keinem Fall nur ein return sal_False.
+/*N*/
+/*N*/ if( IsLocked() || IsHiddenNow() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ ((SwTxtFrm*)this)->GetFormatted();
+/*N*/
+/*N*/ Point aOldPoint( rPoint );
+/*N*/
+/*N*/ if ( IsVertical() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ if ( IsRightToLeft() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 SwitchRTLtoLTR( (Point&)rPoint );
+/*N*/ #endif
+/*N*/
+/*N*/ SwFillData *pFillData = ( pCMS && pCMS->pFill ) ?
+/*N*/ new SwFillData( pCMS, pPos, Frm(), rPoint ) : NULL;
+/*N*/
+/*N*/ if ( IsEmpty() )
+/*N*/ {
+/*N*/ SwTxtNode* pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+/*N*/ pPos->nNode = *pTxtNd;
+/*N*/ pPos->nContent.Assign( pTxtNd, 0 );
+/*N*/ if( pCMS && pCMS->bFieldInfo )
+/*N*/ {
+/*?*/ SwTwips nDiff = rPoint.X() - Frm().Left() - Prt().Left();
+/*?*/ if( nDiff > 50 || nDiff < 0 )
+/*?*/ ((SwCrsrMoveState*)pCMS)->bPosCorr = sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwTxtSizeInfo aInf( (SwTxtFrm*)this );
+/*N*/ SwTxtCursor aLine( ((SwTxtFrm*)this), &aInf );
+/*N*/
+/*N*/ // Siehe Kommentar in AdjustFrm()
+/*N*/ SwTwips nMaxY = Frm().Top() + Prt().Top() + Prt().Height();
+/*N*/ aLine.TwipsToLine( rPoint.Y() );
+/*N*/ while( aLine.Y() + aLine.GetLineHeight() > nMaxY )
+/*N*/ {
+///*?*/ DBG_LOOP;
+/*?*/ if( !aLine.Prev() )
+/*?*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( aLine.GetDropLines() >= aLine.GetLineNr() && 1 != aLine.GetLineNr()
+/*N*/ && rPoint.X() < aLine.FirstLeft() + aLine.GetDropLeft() )
+/*N*/ while( aLine.GetLineNr() > 1 )
+/*N*/ aLine.Prev();
+/*N*/
+/*N*/ xub_StrLen nOffset = aLine.GetCrsrOfst( pPos, rPoint, bChgFrm, pCMS );
+/*N*/
+/*N*/ if( pCMS && pCMS->eState == MV_NONE && aLine.GetEnd() == nOffset )
+/*?*/ ((SwCrsrMoveState*)pCMS)->eState = MV_RIGHTMARGIN;
+/*N*/
+/*N*/ // 6776: pPos ist ein reiner IN-Parameter, der nicht ausgewertet werden darf.
+/*N*/ // Das pIter->GetCrsrOfst returnt aus einer Verschachtelung mit STRING_LEN.
+/*N*/ // Wenn SwTxtIter::GetCrsrOfst von sich aus weitere GetCrsrOfst
+/*N*/ // ruft, so aendert sich nNode der Position. In solchen Faellen
+/*N*/ // darf pPos nicht berechnet werden.
+/*N*/ if( STRING_LEN != nOffset )
+/*N*/ {
+/*N*/ #ifdef USED
+/*N*/ // 8626: bei Up/Down darf diese Zeile nicht verlassen werden.
+/*N*/ if( pCMS && MV_UPDOWN == pCMS->eState )
+/*N*/ {
+/*N*/ const xub_StrLen nEnd = aLine.GetEnd();
+/*N*/ if( nOffset >= nEnd && nEnd )
+/*N*/ {
+/*N*/ // Man muss hinter das letzte Zeichen kommen duerfen?!
+/*N*/ nOffset = nEnd - 1; // UnitUp-Korrektur
+/*N*/ }
+/*N*/ else
+/*N*/ if( nOffset < aLine.GetStart() )
+/*N*/ nOffset = aLine.GetStart(); // UnitDown-Korrektur
+/*N*/ }
+/*N*/ #endif
+/*N*/ SwTxtNode* pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+/*N*/ pPos->nNode = *pTxtNd;
+/*N*/ pPos->nContent.Assign( pTxtNd, nOffset );
+/*N*/ if( pFillData )
+/*N*/ {
+/*N*/ if( pTxtNd->GetTxt().Len() > nOffset ||
+/*N*/ rPoint.Y() < Frm().Top() )
+/*N*/ pFillData->bInner = sal_True;
+/*N*/ pFillData->bFirstLine = aLine.GetLineNr() < 2;
+/*N*/ if( pTxtNd->GetTxt().Len() )
+/*N*/ {
+/*?*/ pFillData->bEmpty = sal_False;
+/*?*/ pFillData->nLineWidth = aLine.GetCurr()->Width();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ sal_Bool bChgFillData = sal_False;
+/*N*/ if( pFillData && FindPageFrm()->Frm().IsInside( aOldPoint ) )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ if ( IsVertical() )
+/*N*/ {
+/*N*/ if ( bChgFillData )
+/*N*/ SwitchHorizontalToVertical( pFillData->Fill().aCrsr.Pos() );
+/*N*/ ((SwTxtFrm*)this)->SwapWidthAndHeight();
+/*N*/ }
+/*N*/
+/*N*/ if ( IsRightToLeft() && bChgFillData )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/
+/*N*/ (Point&)rPoint = aOldPoint;
+/*N*/ delete pFillData;
+/*N*/
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwTxtFrm::GetCrsrOfst()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& rPoint,
+/*N*/ const SwCrsrMoveState* pCMS ) const
+/*N*/ {
+/*N*/ MSHORT nChgFrm = 2;
+/*N*/ if( pCMS )
+/*N*/ {
+/*N*/ if( MV_UPDOWN == pCMS->eState )
+/*N*/ nChgFrm = 0;
+/*N*/ else if( MV_SETONLYTEXT == pCMS->eState ||
+/*N*/ MV_TBLSEL == pCMS->eState )
+/*N*/ nChgFrm = 1;
+/*N*/ }
+/*N*/ return _GetCrsrOfst( pPos, rPoint, nChgFrm != 0, pCMS );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::LeftMargin()
+ *************************************************************************/
+
+/*
+ * Layout-orientierte Cursorbewegungen
+ */
+
+/*
+ * an den Zeilenanfang
+ */
+
+
+/*************************************************************************
+ * SwTxtFrm::RightMargin()
+ *************************************************************************/
+
+/*
+ * An das Zeilenende:Das ist die Position vor dem letzten
+ * Character in der Zeile. Ausnahme: In der letzten Zeile soll
+ * der Cursor auch hinter dem letzten Character stehen koennen,
+ * um Text anhaengen zu koennen.
+ *
+ */
+
+
+/*************************************************************************
+ * SwTxtFrm::_UnitUp()
+ *************************************************************************/
+
+//Die beiden folgenden Methoden versuchen zunaechst den Crsr in die
+//nachste/folgende Zeile zu setzen. Gibt es im Frame keine vorhergehende/
+//folgende Zeile, so wird der Aufruf an die Basisklasse weitergeleitet.
+//Die Horizontale Ausrichtung des Crsr wird hinterher von der CrsrShell
+//vorgenommen.
+
+class SwSetToRightMargin
+{
+ sal_Bool bRight;
+public:
+ inline SwSetToRightMargin() : bRight( sal_False ) { }
+ inline ~SwSetToRightMargin() { SwTxtCursor::SetRightMargin( bRight ); }
+ inline void SetRight( const sal_Bool bNew ) { bRight = bNew; }
+};
+
+
+//
+// Used for Bidi. nPos is the logical position in the string, bLeft indicates
+// if left arrow or right arrow was pressed. The return values are:
+// nPos: the new visual position
+// bLeft: whether the break iterator has to add or subtract from the
+// current position
+
+
+/*************************************************************************
+ * SwTxtFrm::_UnitDown()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwTxtFrm::UnitUp()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwTxtFrm::UnitDown()
+ *************************************************************************/
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_frmform.cxx b/binfilter/bf_sw/source/core/text/sw_frmform.cxx
new file mode 100644
index 000000000000..481b5aab6c63
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_frmform.cxx
@@ -0,0 +1,2088 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/keepitem.hxx>
+#include <bf_svx/hyznitem.hxx>
+
+#include <pagefrm.hxx> // ChangeFtnRef
+#include <dflyobj.hxx> // SwVirtFlyDrawObj
+
+#include <horiornt.hxx>
+
+#include <ftnfrm.hxx> // SwFtnFrm
+#include <paratr.hxx>
+#include <viewopt.hxx> // SwViewOptions
+#include <viewsh.hxx> // ViewShell
+#include <frmatr.hxx>
+#include <flyfrms.hxx>
+#include <frmsh.hxx>
+#include <txtcfg.hxx>
+#include <itrform2.hxx> // SwTxtFormatter
+#include <widorp.hxx> // Widows and Orphans
+#include <txtcache.hxx>
+#include <sectfrm.hxx> // SwSectionFrm
+
+namespace binfilter {
+
+extern FASTBOOL IsInProgress( const SwFlyFrm *pFly );
+
+class FormatLevel
+{
+ static MSHORT nLevel;
+public:
+ inline FormatLevel() { ++nLevel; }
+ inline ~FormatLevel() { --nLevel; }
+ inline MSHORT GetLevel() const { return nLevel; }
+ static sal_Bool LastLevel() { return 10 < nLevel; }
+};
+MSHORT FormatLevel::nLevel = 0;
+
+/*************************************************************************
+ * ValidateTxt/Frm()
+ *************************************************************************/
+
+/*N*/ void ValidateTxt( SwFrm *pFrm ) // Freund vom Frame
+/*N*/ {
+/*N*/ if ( ( ! pFrm->IsVertical() &&
+/*N*/ pFrm->Frm().Width() == pFrm->GetUpper()->Prt().Width() ) ||
+/*N*/ pFrm->IsVertical() &&
+/*N*/ pFrm->Frm().Height() == pFrm->GetUpper()->Prt().Height() )
+/*N*/ pFrm->bValidSize = sal_True;
+/*
+ pFrm->bValidPrtArea = sal_True;
+ //Die Position validieren um nicht unnoetige (Test-)Moves zu provozieren.
+ //Dabei darf allerdings nicht eine tatsaechlich falsche Coordinate
+ //validiert werden.
+ if ( !pFrm->bValidPos )
+ {
+ //Leider muessen wir dazu die korrekte Position berechnen.
+ Point aOld( pFrm->Frm().Pos() );
+ pFrm->MakePos();
+ if ( aOld != pFrm->Pos() )
+ {
+ pFrm->Frm().Pos( aOld );
+ pFrm->bValidPos = sal_False;
+ }
+ }
+*/
+/*N*/ }
+
+/*N*/ void SwTxtFrm::ValidateFrm()
+/*N*/ {
+/*N*/ // Umgebung validieren, um Oszillationen zu verhindern.
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/
+/*M*/ if ( !IsInFly() && !IsInTab() )
+/*N*/ { //Innerhalb eines Flys nur this validieren, der Rest sollte eigentlich
+/*N*/ //nur fuer Fussnoten notwendig sein und die gibt es innerhalb von
+/*N*/ //Flys nicht. Fix fuer 5544
+/*N*/ SwSectionFrm* pSct = FindSctFrm();
+/*N*/ if( pSct )
+/*N*/ {
+/*?*/ if( !pSct->IsColLocked() )
+/*?*/ pSct->ColLock();
+/*?*/ else
+/*?*/ pSct = NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwFrm *pUp = GetUpper();
+/*N*/ pUp->Calc();
+/*N*/ if( pSct )
+/*?*/ pSct->ColUnlock();
+/*N*/ }
+/*N*/ ValidateTxt( this );
+/*N*/
+/*N*/ //MA: mindestens das MustFit-Flag muessen wir retten!
+/*N*/ ASSERT( HasPara(), "ResetPreps(), missing ParaPortion." );
+/*N*/ SwParaPortion *pPara = GetPara();
+/*N*/ const sal_Bool bMustFit = pPara->IsPrepMustFit();
+/*N*/ ResetPreps();
+/*N*/ pPara->SetPrepMustFit( bMustFit );
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/ }
+
+/*************************************************************************
+ * ValidateBodyFrm()
+ *************************************************************************/
+
+// nach einem RemoveFtn muss der BodyFrm und alle innenliegenden kalkuliert
+// werden, damit die DeadLine richtig sitzt.
+// Erst wird nach aussen hin gesucht, beim Rueckweg werden alle kalkuliert.
+
+/*N*/ void _ValidateBodyFrm( SwFrm *pFrm )
+/*N*/ {
+/*N*/ if( pFrm && !pFrm->IsCellFrm() )
+/*N*/ {
+/*N*/ if( !pFrm->IsBodyFrm() && pFrm->GetUpper() )
+/*N*/ _ValidateBodyFrm( pFrm->GetUpper() );
+/*N*/ if( !pFrm->IsSctFrm() )
+/*N*/ pFrm->Calc();
+/*N*/ else
+/*N*/ {
+/*N*/ sal_Bool bOld = ((SwSectionFrm*)pFrm)->IsCntntLocked();
+/*N*/ ((SwSectionFrm*)pFrm)->SetCntntLock( sal_True );
+/*N*/ pFrm->Calc();
+/*N*/ if( !bOld )
+/*N*/ ((SwSectionFrm*)pFrm)->SetCntntLock( sal_False );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwTxtFrm::ValidateBodyFrm()
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/
+/*N*/ //siehe Kommtar in ValidateFrm()
+/*M*/ if ( !IsInFly() && !IsInTab() &&
+/*M*/ !( IsInSct() && FindSctFrm()->Lower()->IsColumnFrm() ) )
+/*N*/ _ValidateBodyFrm( GetUpper() );
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::FindBodyFrm()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFrm::FindBodyFrm()
+ *************************************************************************/
+
+/*N*/ const SwBodyFrm *SwTxtFrm::FindBodyFrm() const
+/*N*/ {
+/*N*/ if ( IsInDocBody() )
+/*N*/ {
+/*N*/ const SwFrm *pFrm = GetUpper();
+/*N*/ while( pFrm && !pFrm->IsBodyFrm() )
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ return (const SwBodyFrm*)pFrm;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::CalcFollow()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::CalcFollow( const xub_StrLen nTxtOfst )
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/
+/*N*/ ASSERT( HasFollow(), "CalcFollow: missing Follow." );
+/*N*/
+/*N*/ SwTxtFrm *pFollow = GetFollow();
+/*N*/
+/*N*/ SwParaPortion *pPara = GetPara();
+/*N*/ sal_Bool bFollowFld = pPara ? pPara->IsFollowField() : sal_False;
+/*N*/
+/*N*/ if( !pFollow->GetOfst() || pFollow->GetOfst() != nTxtOfst ||
+/*N*/ bFollowFld || pFollow->IsFieldFollow() ||
+/*N*/ ( pFollow->IsVertical() && !pFollow->Prt().Width() ) ||
+/*N*/ ( ! pFollow->IsVertical() && !pFollow->Prt().Height() ) )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ const SwFrm *pOldUp = GetUpper();
+/*N*/ #endif
+/*N*/
+/*N*/ SWRECTFN ( this )
+/*N*/ SwTwips nOldBottom = (GetUpper()->Frm().*fnRect->fnGetBottom)();
+/*N*/ SwTwips nMyPos = (Frm().*fnRect->fnGetTop)();
+/*N*/
+/*N*/ const SwPageFrm *pPage = 0;
+/*N*/ sal_Bool bOldInvaCntnt,
+/*N*/ bOldInvaLayout;
+/*N*/ if ( !IsInFly() && GetNext() )
+/*N*/ {
+/*N*/ pPage = FindPageFrm();
+/*N*/ //Minimieren - sprich ggf. zuruecksetzen - der Invalidierungen s.u.
+/*N*/ bOldInvaCntnt = pPage->IsInvalidCntnt();
+/*N*/ bOldInvaLayout = pPage->IsInvalidLayout();
+/*N*/ }
+/*N*/
+/*N*/ pFollow->_SetOfst( nTxtOfst );
+/*N*/ pFollow->SetFieldFollow( bFollowFld );
+/*N*/ if( HasFtn() || pFollow->HasFtn() )
+/*N*/ {
+/*?*/ ValidateFrm();
+/*?*/ ValidateBodyFrm();
+/*?*/ if( pPara )
+/*?*/ {
+/*?*/ *(pPara->GetReformat()) = SwCharRange();
+/*?*/ *(pPara->GetDelta()) = 0;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ //Der Fussnotenbereich darf sich keinesfalls vergrossern.
+/*N*/ SwSaveFtnHeight aSave( FindFtnBossFrm( sal_True ), LONG_MAX );
+/*N*/
+/*N*/ pFollow->CalcFtnFlag();
+/*N*/ if ( !pFollow->GetNext() && !pFollow->HasFtn() )
+/*N*/ nOldBottom = bVert ? 0 : LONG_MAX;
+/*N*/
+/*N*/ while( sal_True )
+/*N*/ {
+/*N*/ if( !FormatLevel::LastLevel() )
+/*N*/ {
+/*N*/ // Weenn der Follow in einem spaltigen Bereich oder einem
+/*N*/ // spaltigen Rahmen steckt, muss zunaechst dieser kalkuliert
+/*N*/ // werden, da das FormatWidthCols() nicht funktioniert, wenn
+/*N*/ // es aus dem MakeAll des _gelockten_ Follows heraus gerufen
+/*N*/ // wird.
+/*N*/ SwSectionFrm* pSct = pFollow->FindSctFrm();
+/*N*/ if( pSct && !pSct->IsAnLower( this ) )
+/*N*/ {
+/*?*/ if( pSct->GetFollow() )
+/*?*/ pSct->SimpleFormat();
+/*?*/ else if( ( pSct->IsVertical() && !pSct->Frm().Width() ) ||
+/*?*/ ( ! pSct->IsVertical() && !pSct->Frm().Height() ) )
+/*?*/ break;
+/*N*/ }
+/*N*/ // OD 14.03.2003 #i11760# - intrinsic format of follow is controlled.
+/*N*/ if ( FollowFormatAllowed() )
+/*N*/ {
+/*N*/ // OD 14.03.2003 #i11760# - no nested format of follows, if
+/*N*/ // text frame is contained in a column frame.
+/*N*/ // Thus, forbid intrinsic format of follow.
+/*N*/ {
+/*N*/ bool bIsFollowInColumn = false;
+/*N*/ SwFrm* pFollowUpper = pFollow->GetUpper();
+/*N*/ while ( pFollowUpper )
+/*N*/ {
+/*N*/ if ( pFollowUpper->IsColumnFrm() )
+/*N*/ {
+/*N*/ bIsFollowInColumn = true;
+/*N*/ break;
+/*N*/ }
+/*N*/ if ( pFollowUpper->IsPageFrm() ||
+/*N*/ pFollowUpper->IsFlyFrm() )
+/*N*/ {
+/*N*/ break;
+/*N*/ }
+/*N*/ pFollowUpper = pFollowUpper->GetUpper();
+/*N*/ }
+/*N*/ if ( bIsFollowInColumn )
+/*N*/ {
+/*N*/ pFollow->ForbidFollowFormat();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pFollow->Calc();
+/*N*/ // Der Follow merkt anhand seiner Frm().Height(), dass was schief
+/*N*/ // gelaufen ist.
+/*N*/ ASSERT( !pFollow->GetPrev(), "SwTxtFrm::CalcFollow: cheesy follow" );
+/*N*/ if( pFollow->GetPrev() )
+/*N*/ {
+/*?*/ pFollow->Prepare( PREP_CLEAR );
+/*?*/ pFollow->Calc();
+/*?*/ ASSERT( !pFollow->GetPrev(), "SwTxtFrm::CalcFollow: very cheesy follow" );
+/*N*/ }
+/*N*/
+/*N*/ // OD 14.03.2003 #i11760# - reset control flag for follow format.
+/*N*/ pFollow->AllowFollowFormat();
+/*N*/ }
+/*N*/
+/*N*/ //Sicherstellen, dass der Follow gepaintet wird.
+/*N*/ pFollow->SetCompletePaint();
+/*N*/ }
+/*N*/
+/*N*/ pPara = GetPara();
+/*N*/ //Solange der Follow wg. Orphans Zeilen angefordert, bekommt er
+/*N*/ //diese und wird erneut formatiert, falls moeglich.
+/*N*/ if( pPara && pPara->IsPrepWidows() )
+/*N*/ CalcPreps();
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( HasFtn() || pFollow->HasFtn() )
+/*N*/ {
+/*?*/ ValidateBodyFrm();
+/*?*/ ValidateFrm();
+/*?*/ if( pPara )
+/*?*/ {
+/*?*/ *(pPara->GetReformat()) = SwCharRange();
+/*?*/ *(pPara->GetDelta()) = 0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( pPage )
+/*N*/ {
+/*N*/ if ( !bOldInvaCntnt )
+/*N*/ pPage->ValidateCntnt();
+/*N*/ if ( !bOldInvaLayout && !IsInSct() )
+/*N*/ pPage->ValidateLayout();
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ASSERT( pOldUp == GetUpper(), "SwTxtFrm::CalcFollow: heavy follow" );
+/*N*/ #endif
+/*N*/
+/*N*/ const long nRemaining =
+/*N*/ - (GetUpper()->Frm().*fnRect->fnBottomDist)( nOldBottom );
+/*N*/ if ( nRemaining > 0 && !GetUpper()->IsSctFrm() &&
+/*N*/ nRemaining != ( bVert ?
+/*N*/ nMyPos - Frm().Right() :
+/*N*/ Frm().Top() - nMyPos ) )
+/*N*/ {
+/*N*/ UNDO_SWAP( this )
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::AdjustFrm()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::AdjustFrm( const SwTwips nChgHght, sal_Bool bHasToFit )
+/*N*/ {
+/*N*/ if( IsUndersized() )
+/*N*/ {
+/*N*/ if( GetOfst() && !IsFollow() ) // ein gescrollter Absatz (undersized)
+/*N*/ return;
+/*N*/ SetUndersized( nChgHght == 0 || bHasToFit );
+/*N*/ }
+/*N*/
+/*N*/ // AdjustFrm is called with a swapped frame during
+/*N*/ // formatting but the frame is not swapped during FormatEmpty
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/ SWRECTFN ( this )
+/*N*/
+/*N*/ // Die Size-Variable des Frames wird durch Grow inkrementiert
+/*N*/ // oder durch Shrink dekrementiert. Wenn die Groesse
+/*N*/ // unveraendert ist, soll nichts passieren!
+/*N*/ if( nChgHght >= 0)
+/*N*/ {
+/*N*/ SwTwips nChgHeight = nChgHght;
+/*N*/ if( nChgHght && !bHasToFit )
+/*N*/ {
+/*N*/ if( IsInFtn() && !IsInSct() )
+/*N*/ {
+/*N*/ SwTwips nReal = Grow( nChgHght PHEIGHT, sal_True );
+/*N*/ if( nReal < nChgHght )
+/*N*/ {
+/*?*/ SwTwips nBot = (*fnRect->fnYInc)( (Frm().*fnRect->fnGetBottom)(),
+/*?*/ nChgHght - nReal );
+/*?*/ SwFrm* pCont = FindFtnFrm()->GetUpper();
+/*?*/
+/*?*/ if( (pCont->Frm().*fnRect->fnBottomDist)( nBot ) > 0 )
+/*?*/ {
+/*?*/ (Frm().*fnRect->fnAddBottom)( nChgHght );
+/*?*/ if( bVert )
+/*?*/ Prt().SSize().Width() += nChgHght;
+/*?*/ else
+/*?*/ Prt().SSize().Height() += nChgHght;
+/*?*/ UNDO_SWAP( this )
+/*?*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ Grow( nChgHght PHEIGHT );
+/*N*/
+/*N*/ if ( IsInFly() )
+/*N*/ {
+/*N*/ //MA 06. May. 93: Wenn einer der Upper ein Fly ist, so ist es
+/*N*/ //sehr wahrscheinlich, dass dieser Fly durch das Grow seine
+/*N*/ //Position veraendert - also muss auch meine Position korrigiert
+/*N*/ //werden (sonst ist die Pruefung s.u. nicht aussagekraeftig).
+/*N*/ //Die Vorgaenger muessen berechnet werden, damit die Position
+/*N*/ //korrekt berechnet werden kann.
+/*N*/ if ( GetPrev() )
+/*N*/ {
+/*N*/ SwFrm *pPre = GetUpper()->Lower();
+/*N*/ do
+/*N*/ { pPre->Calc();
+/*N*/ pPre = pPre->GetNext();
+/*N*/ } while ( pPre && pPre != this );
+/*N*/ }
+/*N*/ const Point aOldPos( Frm().Pos() );
+/*N*/ MakePos();
+/*N*/ if ( aOldPos != Frm().Pos() )
+/*N*/ CalcFlys( sal_True ); //#43679# Fly in Fly in ...
+/*N*/ }
+/*N*/ nChgHeight = 0;
+/*N*/ }
+/*N*/ // Ein Grow() wird von der Layout-Seite immer akzeptiert,
+/*N*/ // also auch, wenn die FixSize des umgebenden Layoutframes
+/*N*/ // dies nicht zulassen sollte. Wir ueberpruefen diesen
+/*N*/ // Fall und korrigieren die Werte.
+/*N*/ // MA 06. May. 93: Der Frm darf allerdings auch im Notfall nicht
+/*N*/ // weiter geschrumpft werden als es seine Groesse zulaesst.
+/*N*/ SwTwips nRstHeight;
+/*N*/ if ( IsVertical() )
+/*N*/ {
+/*?*/ ASSERT( ! IsSwapped(),"Swapped frame while calculating nRstHeight" );
+/*?*/ nRstHeight = Frm().Left() + Frm().Width() -
+/*?*/ ( GetUpper()->Frm().Left() + GetUpper()->Prt().Left() );
+/*N*/ }
+/*N*/ else
+/*N*/ nRstHeight = GetUpper()->Frm().Top()
+/*N*/ + GetUpper()->Prt().Top()
+/*N*/ + GetUpper()->Prt().Height()
+/*N*/ - Frm().Top();
+/*N*/
+/*N*/ //In Tabellenzellen kann ich mir evtl. noch ein wenig dazuholen, weil
+/*N*/ //durch eine vertikale Ausrichtung auch oben noch Raum sein kann.
+/*N*/ if ( IsInTab() )
+/*N*/ {
+/*N*/ long nAdd = (*fnRect->fnYDiff)( (GetUpper()->Lower()->Frm().*fnRect->fnGetTop)(),
+/*N*/ (GetUpper()->*fnRect->fnGetPrtTop)() );
+/*N*/ ASSERT( nAdd >= 0, "Ey" );
+/*N*/ nRstHeight += nAdd;
+/*N*/ }
+/*N*/
+/* ------------------------------------
+ * #50964#: nRstHeight < 0 bedeutet, dass der TxtFrm komplett ausserhalb seines
+ * Upper liegt. Dies kann passieren, wenn er innerhalb eines FlyAtCntFrm liegt, der
+ * durch das Grow() die Seite gewechselt hat. In so einem Fall ist es falsch, der
+ * folgenden Grow-Versuch durchzufuehren. Im Bugfall fuehrte dies sogar zur
+ * Endlosschleife.
+ * -----------------------------------*/
+/*N*/ SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*N*/ SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ if( nRstHeight < nFrmHeight )
+/*N*/ {
+/*N*/ //Kann sein, dass ich die richtige Grosse habe, der Upper aber zu
+/*N*/ //klein ist und der Upper noch Platz schaffen kann.
+/*N*/ if( ( nRstHeight >= 0 || ( IsInFtn() && IsInSct() ) ) && !bHasToFit )
+/*N*/ nRstHeight += GetUpper()->Grow( nFrmHeight - nRstHeight PHEIGHT );
+/*N*/ // In spaltigen Bereichen wollen wir moeglichst nicht zu gross werden, damit
+/*N*/ // nicht ueber GetNextSctLeaf weitere Bereiche angelegt werden. Stattdessen
+/*N*/ // schrumpfen wir und notieren bUndersized, damit FormatWidthCols die richtige
+/*N*/ // Spaltengroesse ermitteln kann.
+/*N*/ if ( nRstHeight < nFrmHeight )
+/*N*/ {
+/*N*/ if( bHasToFit || !IsMoveable() ||
+/*N*/ ( IsInSct() && !FindSctFrm()->MoveAllowed(this) ) )
+/*N*/ {
+/*N*/ SetUndersized( sal_True );
+/*N*/ Shrink( Min( ( nFrmHeight - nRstHeight), nPrtHeight )
+/*N*/ PHEIGHT );
+/*N*/ }
+/*N*/ else
+/*N*/ SetUndersized( sal_False );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( nChgHeight )
+/*N*/ {
+/*?*/ if( nRstHeight - nFrmHeight < nChgHeight )
+/*?*/ nChgHeight = nRstHeight - nFrmHeight;
+/*?*/ if( nChgHeight )
+/*?*/ Grow( nChgHeight );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ Shrink( -nChgHght PHEIGHT );
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::AdjustFollow()
+ *************************************************************************/
+
+/* AdjustFollow erwartet folgende Situation:
+ * Der SwTxtIter steht am unteren Ende des Masters, der Offset wird
+ * im Follow eingestellt.
+ * nOffset haelt den Offset im Textstring, ab dem der Master abschliesst
+ * und der Follow beginnt. Wenn er 0 ist, wird der FolgeFrame geloescht.
+ */
+
+/*N*/ void SwTxtFrm::_AdjustFollow( SwTxtFormatter &rLine,
+/*N*/ const xub_StrLen nOffset, const xub_StrLen nEnd,
+/*N*/ const sal_uInt8 nMode )
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/ // Wir haben den Rest der Textmasse: alle Follows loeschen
+/*N*/ // Sonderfall sind DummyPortions()
+/*N*/ // - special cases are controlled by parameter <nMode>.
+/*N*/ if( HasFollow() && !(nMode & 1) && nOffset == nEnd )
+/*N*/ {
+/*N*/ while( GetFollow() )
+/*N*/ {
+/*N*/ if( ((SwTxtFrm*)GetFollow())->IsLocked() )
+/*N*/ {
+/*?*/ ASSERT( sal_False, "+SwTxtFrm::JoinFrm: Follow ist locked." );
+/*?*/ UNDO_SWAP( this )
+/*?*/ return;
+/*N*/ }
+/*N*/ JoinFrm();
+/*N*/ }
+/*N*/ UNDO_SWAP( this )
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Tanz auf dem Vulkan: Wir formatieren eben schnell noch einmal
+/*N*/ // die letzte Zeile fuer das QuoVadis-Geraffel. Selbstverstaendlich
+/*N*/ // kann sich dadurch auch der Offset verschieben:
+/*N*/ const xub_StrLen nNewOfst = ( IsInFtn() && ( !GetIndNext() || HasFollow() ) ) ?
+/*N*/ rLine.FormatQuoVadis(nOffset) : nOffset;
+/*N*/
+/*N*/ if( !(nMode & 1) )
+/*N*/ {
+/*N*/ // Wir klauen unseren Follows Textmasse, dabei kann es passieren,
+/*N*/ // dass wir einige Follows Joinen muessen.
+/*N*/ while( GetFollow() && GetFollow()->GetFollow() &&
+/*N*/ nNewOfst >= GetFollow()->GetFollow()->GetOfst() )
+/*N*/ {
+///*?*/ DBG_LOOP;
+/*?*/ JoinFrm();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Der Ofst hat sich verschoben.
+/*N*/ if( GetFollow() )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static sal_Bool bTest = sal_False;
+/*N*/ if( !bTest || ( nMode & 1 ) )
+/*N*/ #endif
+/*N*/ if ( nMode )
+/*N*/ GetFollow()->ManipOfst( 0 );
+/*N*/
+/*N*/ if ( CalcFollow( nNewOfst ) ) // CalcFollow erst zum Schluss, dort erfolgt ein SetOfst
+/*N*/ rLine.SetOnceMore( sal_True );
+/*N*/ }
+/*N*/ UNDO_SWAP( this )
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::JoinFrm()
+ *************************************************************************/
+
+/*N*/ SwCntntFrm *SwTxtFrm::JoinFrm()
+/*N*/ {
+/*N*/ ASSERT( GetFollow(), "+SwTxtFrm::JoinFrm: no follow" );
+/*N*/ SwTxtFrm *pFoll = GetFollow();
+/*N*/
+/*N*/ SwTxtFrm *pNxt = pFoll->GetFollow();
+/*N*/
+/*N*/ // Alle Fussnoten des zu zerstoerenden Follows werden auf uns
+/*N*/ // umgehaengt.
+/*N*/ xub_StrLen nStart = pFoll->GetOfst();
+/*N*/ if ( pFoll->HasFtn() )
+/*N*/ {
+/*?*/ const SwpHints *pHints = pFoll->GetTxtNode()->GetpSwpHints();
+/*?*/ if( pHints )
+/*?*/ {
+/*?*/ SwFtnBossFrm *pFtnBoss = 0;
+/*?*/ SwFtnBossFrm *pEndBoss = 0;
+/*?*/ for( MSHORT i = 0; i < pHints->Count(); ++i )
+/*?*/ {
+/*?*/ const SwTxtAttr *pHt = (*pHints)[i];
+/*?*/ if( RES_TXTATR_FTN==pHt->Which() && *pHt->GetStart()>=nStart )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( pHt->GetFtn().IsEndNote() )
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else if ( pFoll->GetValidPrtAreaFlag() ||
+/*N*/ pFoll->GetValidSizeFlag() )
+/*N*/ {
+/*N*/ pFoll->CalcFtnFlag();
+/*N*/ ASSERT( !pFoll->HasFtn(), "Missing FtnFlag." );
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ pFoll->MoveFlyInCnt( this, nStart, STRING_LEN );
+/*N*/ pFoll->SetFtn( FALSE );
+/*N*/ pFoll->Cut();
+/*N*/ delete pFoll;
+/*N*/ pFollow = pNxt;
+/*N*/ return pNxt;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::SplitFrm()
+ *************************************************************************/
+
+/*N*/ SwCntntFrm *SwTxtFrm::SplitFrm( const xub_StrLen nTxtPos )
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/
+/*N*/ // Durch das Paste wird ein Modify() an mich verschickt.
+/*N*/ // Damit meine Daten nicht verschwinden, locke ich mich.
+/*N*/ SwTxtFrmLocker aLock( this );
+/*N*/ SwTxtFrm *pNew = (SwTxtFrm *)(GetTxtNode()->MakeFrm());
+/*N*/ pNew->bIsFollow = sal_True;
+/*N*/
+/*N*/ pNew->SetFollow( GetFollow() );
+/*N*/ SetFollow( pNew );
+/*N*/
+/*N*/ pNew->Paste( GetUpper(), GetNext() );
+/*N*/
+/*N*/ // Wenn durch unsere Aktionen Fussnoten in pNew landen,
+/*N*/ // so muessen sie umgemeldet werden.
+/*N*/ if ( HasFtn() )
+/*N*/ {
+/*?*/ const SwpHints *pHints = GetTxtNode()->GetpSwpHints();
+/*?*/ if( pHints )
+/*?*/ {
+/*?*/ SwFtnBossFrm *pFtnBoss = 0;
+/*?*/ SwFtnBossFrm *pEndBoss = 0;
+/*?*/ for( MSHORT i = 0; i < pHints->Count(); ++i )
+/*?*/ {
+/*?*/ const SwTxtAttr *pHt = (*pHints)[i];
+/*?*/ if( RES_TXTATR_FTN==pHt->Which() && *pHt->GetStart()>=nTxtPos )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( pHt->GetFtn().IsEndNote() )
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else
+/*N*/ {
+/*N*/ CalcFtnFlag( nTxtPos-1 );
+/*N*/ ASSERT( !HasFtn(), "Missing FtnFlag." );
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ MoveFlyInCnt( pNew, nTxtPos, STRING_LEN );
+/*N*/
+/*N*/ // Kein SetOfst oder CalcFollow, weil gleich ohnehin ein AdjustFollow folgt.
+/*N*/ #ifdef USED
+/*N*/ CalcFollow( nNewOfst );
+/*N*/ #endif
+/*N*/
+/*N*/ pNew->ManipOfst( nTxtPos );
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/ return pNew;
+/*N*/ }
+
+
+/*************************************************************************
+ * virtual SwTxtFrm::SetOfst()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::_SetOfst( const xub_StrLen nNewOfst )
+/*N*/ {
+/*N*/ #ifdef DBGTXT
+/*N*/ // Es gibt tatsaechlich einen Sonderfall, in dem ein SetOfst(0)
+/*N*/ // zulaessig ist: bug 3496
+/*N*/ ASSERT( nNewOfst, "!SwTxtFrm::SetOfst: missing JoinFrm()." );
+/*N*/ #endif
+/*N*/
+/*N*/ // Die Invalidierung unseres Follows ist nicht noetig.
+/*N*/ // Wir sind ein Follow, werden gleich formatiert und
+/*N*/ // rufen von dort aus das SetOfst() !
+/*N*/ nOfst = nNewOfst;
+/*N*/ SwParaPortion *pPara = GetPara();
+/*N*/ if( pPara )
+/*N*/ {
+/*N*/ SwCharRange &rReformat = *(pPara->GetReformat());
+/*N*/ rReformat.Start() = 0;
+/*N*/ rReformat.Len() = GetTxt().Len();
+/*N*/ *(pPara->GetDelta()) = rReformat.Len();
+/*N*/ }
+/*N*/ InvalidateSize();
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::CalcPreps
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::CalcPreps()
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(), "SwTxtFrm::CalcPreps with swapped frame" );
+/*N*/ SWRECTFN( this );
+/*N*/
+/*N*/ SwParaPortion *pPara = GetPara();
+/*N*/ if ( !pPara )
+/*N*/ return sal_False;
+/*N*/ sal_Bool bPrep = pPara->IsPrep();
+/*N*/ sal_Bool bPrepWidows = pPara->IsPrepWidows();
+/*N*/ sal_Bool bPrepAdjust = pPara->IsPrepAdjust();
+/*N*/ sal_Bool bPrepMustFit = pPara->IsPrepMustFit();
+/*N*/ ResetPreps();
+/*N*/
+/*N*/ sal_Bool bRet = sal_False;
+/*N*/ if( bPrep && !pPara->GetReformat()->Len() )
+/*N*/ {
+/*N*/ // PREP_WIDOWS bedeutet, dass im Follow die Orphans-Regel
+/*N*/ // zuschlug.
+/*N*/ // Es kann in unguenstigen Faellen vorkommen, dass auch ein
+/*N*/ // PrepAdjust vorliegt (3680)!
+/*N*/ if( bPrepWidows )
+/*N*/ {
+/*N*/ if( !GetFollow() )
+/*N*/ {
+/*?*/ ASSERT( GetFollow(), "+SwTxtFrm::CalcPreps: no credits" );
+/*?*/ return sal_False;
+/*N*/ }
+/*N*/
+/*N*/ // Wir muessen uns auf zwei Faelle einstellen:
+/*N*/ // Wir konnten dem Follow noch ein paar Zeilen abgeben,
+/*N*/ // -> dann muessen wir schrumpfen
+/*N*/ // oder wir muessen auf die naechste Seite
+/*N*/ // -> dann lassen wir unseren Frame zu gross werden.
+/*N*/
+/*N*/ SwTwips nChgHeight = GetParHeight();
+/*N*/ if( nChgHeight >= (Prt().*fnRect->fnGetHeight)() )
+/*N*/ {
+/*N*/ if( bPrepMustFit )
+/*N*/ {
+/*?*/ GetFollow()->SetJustWidow( sal_True );
+/*?*/ GetFollow()->Prepare( PREP_CLEAR );
+/*N*/ }
+/*N*/ else if ( bVert )
+/*N*/ {
+/*?*/ Frm().Width( Frm().Width() + Frm().Left() );
+/*?*/ Prt().Width( Prt().Width() + Frm().Left() );
+/*?*/ Frm().Left( 0 );
+/*?*/ SetWidow( sal_True );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nTmp = LONG_MAX - (Frm().Top()+10000);
+/*N*/ SwTwips nDiff = nTmp - Frm().Height();
+/*N*/ Frm().Height( nTmp );
+/*N*/ Prt().Height( Prt().Height() + nDiff );
+/*N*/ SetWidow( sal_True );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( nChgHeight < (Prt().*fnRect->fnGetHeight)(),
+/*?*/ "+SwTxtFrm::CalcPrep: wanna shrink" );
+/*?*/
+/*?*/ nChgHeight = (Prt().*fnRect->fnGetHeight)() - nChgHeight;
+/*?*/
+/*?*/ GetFollow()->SetJustWidow( sal_True );
+/*?*/ GetFollow()->Prepare( PREP_CLEAR );
+/*?*/ Shrink( nChgHeight PHEIGHT );
+/*?*/ SwRect &rRepaint = *(pPara->GetRepaint());
+/*?*/
+/*?*/ if ( bVert )
+/*?*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ SwRect aRepaint( Frm().Pos() + Prt().Pos(), Prt().SSize() );
+/*?*/ }
+/*?*/ else
+/*?*/ rRepaint.Chg( Frm().Pos() + Prt().Pos(), Prt().SSize() );
+/*?*/
+/*?*/ // 6792: Rrand < LRand und Repaint
+/*?*/ if( 0 >= rRepaint.Width() )
+/*?*/ rRepaint.Width(1);
+/*N*/ }
+/*N*/ bRet = sal_True;
+/*N*/ }
+/*N*/
+/*N*/ else if ( bPrepAdjust )
+/*N*/ {
+/*N*/ if ( HasFtn() )
+/*N*/ {
+/*N*/ if( !CalcPrepFtnAdjust() )
+/*N*/ {
+/*?*/ if( bPrepMustFit )
+/*?*/ {
+/*?*/ SwTxtLineAccess aAccess( this );
+/*?*/ aAccess.GetPara()->SetPrepMustFit( sal_True );
+/*?*/ }
+/*?*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SWAP_IF_NOT_SWAPPED( this )
+/*N*/
+/*N*/ SwTxtFormatInfo aInf( this );
+/*N*/ SwTxtFormatter aLine( this, &aInf );
+/*N*/
+/*N*/ WidowsAndOrphans aFrmBreak( this );
+/*N*/ // Egal was die Attribute meinen, bei MustFit wird
+/*N*/ // der Absatz im Notfall trotzdem gesplittet...
+/*N*/ if( bPrepMustFit )
+/*N*/ {
+/*?*/ aFrmBreak.SetKeep( sal_False );
+/*?*/ aFrmBreak.ClrOrphLines();
+/*N*/ }
+/*N*/ // Bevor wir FormatAdjust aufrufen muessen wir dafuer
+/*N*/ // sorgen, dass die Zeilen, die unten raushaengen
+/*N*/ // auch tatsaechlich abgeschnitten werden.
+/*N*/ sal_Bool bBreak = aFrmBreak.IsBreakNow( aLine );
+/*N*/ bRet = sal_True;
+/*N*/ while( !bBreak && aLine.Next() )
+/*N*/ bBreak = aFrmBreak.IsBreakNow( aLine );
+/*N*/ if( bBreak )
+/*N*/ {
+/*N*/ // Es gibt Komplikationen: wenn TruncLines gerufen wird,
+/*N*/ // veraendern sich ploetzlich die Bedingungen in
+/*N*/ // IsInside, so dass IsBreakNow andere Ergebnisse
+/*N*/ // liefern kann. Aus diesem Grund wird rFrmBreak bekannt
+/*N*/ // gegeben, dass da wo rLine steht, das Ende erreicht
+/*N*/ // ist. Mal sehen, ob's klappt ...
+/*N*/ aLine.TruncLines();
+/*N*/ aFrmBreak.SetRstHeight( aLine );
+/*N*/ FormatAdjust( aLine, aFrmBreak, aInf.GetTxt().Len(), aInf.IsStop() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !GetFollow() )
+/*N*/ {
+/*N*/ FormatAdjust( aLine, aFrmBreak,
+/*N*/ aInf.GetTxt().Len(), aInf.IsStop() );
+/*N*/ }
+/*N*/ else if ( !aFrmBreak.IsKeepAlways() )
+/*N*/ {
+/*N*/ // Siehe Bug: 2320
+/*N*/ // Vor dem Master wird eine Zeile geloescht, der Follow
+/*N*/ // koennte eine Zeile abgeben.
+/*N*/ const SwCharRange aFollowRg( GetFollow()->GetOfst(), 1 );
+/*N*/ *(pPara->GetReformat()) += aFollowRg;
+/*N*/ // Es soll weitergehen!
+/*N*/ bRet = sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/ // Eine letzte Ueberpruefung, falls das FormatAdjust() nichts
+/*N*/ // brachte, muessen wir amputieren.
+/*N*/ if( bPrepMustFit )
+/*N*/ {
+/*?*/ const SwTwips nMust = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*?*/ const SwTwips nIs = (Frm().*fnRect->fnGetBottom)();
+/*?*/
+/*?*/ if( bVert && nIs < nMust )
+/*?*/ {
+/*?*/ Shrink( nMust - nIs );
+/*?*/ if( Prt().Width() < 0 )
+/*?*/ Prt().Width( 0 );
+/*?*/ SetUndersized( sal_True );
+/*?*/ }
+/*?*/ else if ( ! bVert && nIs > nMust )
+/*?*/ {
+/*?*/ Shrink( nIs - nMust );
+/*?*/ if( Prt().Height() < 0 )
+/*?*/ Prt().Height( 0 );
+/*?*/ SetUndersized( sal_True );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ pPara->SetPrepMustFit( bPrepMustFit );
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::FormatAdjust()
+ *************************************************************************/
+
+// Hier werden die Fussnoten und "als Zeichen"-gebundenen Objekte umgehaengt
+#define CHG_OFFSET( pFrm, nNew )\
+ {\
+ if( pFrm->GetOfst() < nNew )\
+ pFrm->MoveFlyInCnt( this, 0, nNew );\
+ else if( pFrm->GetOfst() > nNew )\
+ MoveFlyInCnt( pFrm, nNew, STRING_LEN );\
+ }
+
+/*N*/ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine,
+/*N*/ WidowsAndOrphans &rFrmBreak,
+/*N*/ const xub_StrLen nStrLen,
+/*N*/ const sal_Bool bDummy )
+/*N*/ {
+/*N*/ SWAP_IF_NOT_SWAPPED( this )
+/*N*/
+/*N*/ SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
+/*N*/
+/*N*/ xub_StrLen nEnd = rLine.GetStart();
+/*N*/
+/*N*/ // Wir muessen fuer eindeutige Verhaeltnisse sorgen
+/*N*/ // rFrmBreak.SetRstHeight( rLine );
+/*N*/
+/*N*/ // rLine.GetStart(): die letzte Zeile von rLine,
+/*N*/ // ist bereits die Zeile, die nicht
+/*N*/ // mehr passte. Ihr Anfang ist das Ende des Masters.
+/*N*/ // @@@if( !GetFollow() && nEnd < nStrLen )
+/*N*/ // (nEnd < nStrLen || rFrmBreak.IsBreakNow(rLine));
+/*N*/
+/*N*/ sal_Bool bHasToFit = pPara->IsPrepMustFit();
+/*N*/
+/*N*/ // Das StopFlag wird durch Fussnoten gesetzt,
+/*N*/ // die auf die naechste Seite wollen.
+/*N*/ sal_uInt8 nNew = ( !GetFollow() && nEnd < nStrLen &&
+/*N*/ ( rLine.IsStop() || ( bHasToFit ?
+/*N*/ ( rLine.GetLineNr() > 1 && !rFrmBreak.IsInside( rLine ) )
+/*N*/ : rFrmBreak.IsBreakNow( rLine ) ) ) ) ? 1 : 0;
+/*N*/ if( nNew )
+/*N*/ SplitFrm( nEnd );
+/*N*/
+/*N*/ const SwFrm *pBodyFrm = (const SwFrm*)(FindBodyFrm());
+/*N*/
+/*N*/ const long nBodyHeight = pBodyFrm ? ( IsVertical() ?
+/*N*/ pBodyFrm->Frm().Width() :
+/*N*/ pBodyFrm->Frm().Height() ) : 0;
+/*N*/
+/*N*/ // Wenn die aktuellen Werte berechnet wurden, anzeigen, dass
+/*N*/ // sie jetzt gueltig sind.
+/*N*/ *(pPara->GetReformat()) = SwCharRange();
+/*N*/ sal_Bool bDelta = *pPara->GetDelta() != 0;
+/*N*/ *(pPara->GetDelta()) = 0;
+/*N*/
+/*N*/ if( rLine.IsStop() )
+/*N*/ {
+/*?*/ rLine.TruncLines( sal_True );
+/*?*/ nNew = 1;
+/*N*/ }
+/*N*/
+/*N*/ // FindBreak schneidet die letzte Zeile ab.
+/*N*/ if( !rFrmBreak.FindBreak( this, rLine, bHasToFit ) )
+/*N*/ {
+/*N*/ // Wenn wir bis zum Ende durchformatiert haben, wird nEnd auf das Ende
+/*N*/ // gesetzt. In AdjustFollow wird dadurch ggf. JoinFrm() ausgefuehrt.
+/*N*/ // Ansonsten ist nEnd das Ende der letzten Zeile im Master.
+/*N*/ xub_StrLen nOld = nEnd;
+/*N*/ nEnd = rLine.GetEnd();
+/*N*/ if( GetFollow() )
+/*N*/ {
+/*N*/ if( nNew && nOld < nEnd )
+/*N*/ RemoveFtn( nOld, nEnd - nOld );
+/*N*/ CHG_OFFSET( GetFollow(), nEnd )
+/*N*/ if( !bDelta )
+/*N*/ GetFollow()->ManipOfst( nEnd );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ { // Wenn wir Zeilen abgeben, darf kein Join auf den Folows gerufen werden,
+/*N*/ // im Gegenteil, es muss ggf. sogar ein Follow erzeugt werden.
+/*N*/ // Dies muss auch geschehen, wenn die Textmasse komplett im Master
+/*N*/ // bleibt, denn es könnte ja ein harter Zeilenumbruch noch eine weitere
+/*N*/ // Zeile (ohne Textmassse) notwendig machen!
+/*N*/ nEnd = rLine.GetEnd();
+/*N*/ if( GetFollow() )
+/*N*/ {
+/*N*/ // OD 21.03.2003 #108121# - Another case for not joining the follow:
+/*N*/ // Text frame has no content, but a numbering. Then, do *not* join.
+/*N*/ // Example of this case: When an empty, but numbered paragraph
+/*N*/ // at the end of page is completely displaced by a fly frame.
+/*N*/ // Thus, the text frame introduced a follow by a
+/*N*/ // <SwTxtFrm::SplitFrm(..)> - see below. The follow then shows
+/*N*/ // the numbering and must stay.
+/*N*/ if ( GetFollow()->GetOfst() != nEnd ||
+/*N*/ GetFollow()->IsFieldFollow() ||
+/*N*/ ( nStrLen == 0 &&
+/*N*/ ( GetTxtNode()->GetNum() || GetTxtNode()->GetOutlineNum() ) )
+/*N*/ )
+/*N*/ {
+/*N*/ nNew |= 3;
+/*N*/ }
+/*N*/ CHG_OFFSET( GetFollow(), nEnd )
+/*N*/ GetFollow()->ManipOfst( nEnd );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ // OD 21.03.2003 #108121# - Only split frame, if the frame contains
+/*?*/ // content or contains no content, but has a numbering.
+/*?*/ if ( nStrLen > 0 ||
+/*?*/ ( nStrLen == 0 &&
+/*?*/ ( GetTxtNode()->GetNum() || GetTxtNode()->GetOutlineNum() ) )
+/*?*/ )
+/*?*/ {
+/*?*/ SplitFrm( nEnd );
+/*?*/ nNew |= 3;
+/*?*/ }
+/*N*/ }
+/*N*/ // Wenn sich die Resthoehe geaendert hat, z.B. durch RemoveFtn()
+/*N*/ // dann muessen wir auffuellen, um Oszillationen zu vermeiden!
+/*N*/ if( bDummy && pBodyFrm &&
+/*N*/ nBodyHeight < ( IsVertical() ?
+/*N*/ pBodyFrm->Frm().Width() :
+/*N*/ pBodyFrm->Frm().Height() ) )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ rLine.MakeDummyLine();
+/*N*/ }
+/*N*/
+/*N*/ // In AdjustFrm() stellen wir uns selbst per Grow/Shrink ein,
+/*N*/ // in AdjustFollow() stellen wir unseren FolgeFrame ein.
+/*N*/
+/*N*/ const SwTwips nDocPrtTop = Frm().Top() + Prt().Top();
+/*N*/ const SwTwips nOldHeight = Prt().SSize().Height();
+/*N*/ const SwTwips nChg = rLine.CalcBottomLine() - nDocPrtTop - nOldHeight;
+/*N*/
+/*N*/ // Vertical Formatting:
+/*N*/ // The (rotated) repaint rectangle's x coordinate referes to the frame.
+/*N*/ // If the frame grows (or shirks) the repaint rectangle cannot simply
+/*N*/ // be rotated back after formatting, because we use the upper left point
+/*N*/ // of the frame for rotation. This point changes when growing/shrinking.
+/*N*/ if ( IsVertical() && nChg )
+/*N*/ {
+/*?*/ SwRect &rRepaint = *(pPara->GetRepaint());
+/*?*/ rRepaint.Left( rRepaint.Left() - nChg );
+/*?*/ rRepaint.Width( rRepaint.Width() - nChg );
+/*N*/ }
+/*N*/
+/*N*/ AdjustFrm( nChg, bHasToFit );
+
+/*
+ // FME 16.07.2003 #i16930# - removed this code because it did not
+ // work correctly. In SwCntntFrm::MakeAll, the frame did not move to the
+ // next page, instead the print area was recalculated and
+ // Prepare( PREP_POS_CHGD, (const void*)&bFormatted, FALSE ) invalidated
+ // the other flags => loop
+
+ // OD 04.04.2003 #108446# - handle special case:
+ // If text frame contains no content and just has splitted, because of a
+ // line stop, it has to move forward. To force this forward move without
+ // unnecessary formatting of its footnotes and its follow, especially in
+ // columned sections, adjust frame height to zero (0) and do not perform
+ // the intrinsic format of the follow.
+ // The formating method <SwCntntFrm::MakeAll()> will initiate the move forward.
+ sal_Bool bForcedNoIntrinsicFollowCalc = sal_False;
+ if ( nEnd == 0 &&
+ rLine.IsStop() && HasFollow() && nNew == 1
+ )
+ {
+ AdjustFrm( -Frm().SSize().Height(), bHasToFit );
+ Prt().Pos().Y() = 0;
+ Prt().Height( Frm().Height() );
+ if ( FollowFormatAllowed() )
+ {
+ bForcedNoIntrinsicFollowCalc = sal_True;
+ ForbidFollowFormat();
+ }
+ }
+ else
+ {
+ AdjustFrm( nChg, bHasToFit );
+ }
+ */
+
+/*N*/ if( HasFollow() || IsInFtn() )
+/*N*/ _AdjustFollow( rLine, nEnd, nStrLen, nNew );
+
+ // FME 16.07.2003 #i16930# - removed this code because it did not work
+ // correctly
+ // OD 04.04.2003 #108446# - allow intrinsic format of follow, if above
+ // special case has forbit it.
+/* if ( bForcedNoIntrinsicFollowCalc )
+ {
+ AllowFollowFormat();
+ }
+ */
+
+/*N*/ pPara->SetPrepMustFit( sal_False );
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::FormatLine()
+ *************************************************************************/
+
+// bPrev zeigt an, ob Reformat.Start() wegen Prev() vorgezogen wurde.
+// Man weiss sonst nicht, ob man Repaint weiter einschraenken kann oder nicht.
+
+
+/*N*/ sal_Bool SwTxtFrm::FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev )
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || IsSwapped(),
+/*N*/ "SwTxtFrm::FormatLine( rLine, bPrev) with unswapped frame" );
+/*N*/ SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
+/*N*/ // Nach rLine.FormatLine() haelt nStart den neuen Wert,
+/*N*/ // waehrend in pOldStart der alte Offset gepflegt wird.
+/*N*/ // Ueber diesen Weg soll das nDelta ersetzt werden.
+/*N*/ // *pOldStart += rLine.GetCurr()->GetLen();
+/*N*/ const SwLineLayout *pOldCur = rLine.GetCurr();
+/*N*/ const xub_StrLen nOldLen = pOldCur->GetLen();
+/*N*/ const KSHORT nOldAscent = pOldCur->GetAscent();
+/*N*/ const KSHORT nOldHeight = pOldCur->Height();
+/*N*/ const SwTwips nOldWidth = pOldCur->Width() + pOldCur->GetHangingMargin();
+/*N*/ const sal_Bool bOldHyph = pOldCur->IsEndHyph();
+/*N*/ SwTwips nOldTop = 0;
+/*N*/ SwTwips nOldBottom;
+/*N*/ if( rLine.GetCurr()->IsClipping() )
+/*N*/ rLine.CalcUnclipped( nOldTop, nOldBottom );
+/*N*/
+/*N*/ const xub_StrLen nNewStart = rLine.FormatLine( rLine.GetStart() );
+/*N*/
+/*N*/ ASSERT( Frm().Pos().Y() + Prt().Pos().Y() == rLine.GetFirstPos(),
+/*N*/ "SwTxtFrm::FormatLine: frame leaves orbit." );
+/*N*/ ASSERT( rLine.GetCurr()->Height(),
+/*N*/ "SwTxtFrm::FormatLine: line height is zero" );
+/*N*/
+/*N*/ // Das aktuelle Zeilenumbruchobjekt.
+/*N*/ const SwLineLayout *pNew = rLine.GetCurr();
+/*N*/
+/*N*/ sal_Bool bUnChg = nOldLen == pNew->GetLen() &&
+/*N*/ bOldHyph == pNew->IsEndHyph();
+/*N*/ if ( bUnChg && !bPrev )
+/*N*/ {
+/*N*/ // 6672: Toleranz von SLOPPY_TWIPS (5 Twips); vgl. 6922
+/*N*/ const long nWidthDiff = nOldWidth > pNew->Width()
+/*N*/ ? nOldWidth - pNew->Width()
+/*N*/ : pNew->Width() - nOldWidth;
+/*N*/
+/*N*/ // we only declare a line as unchanged, if its main values have not
+/*N*/ // changed and it is not the last line (!paragraph end symbol!)
+/*N*/ bUnChg = nOldHeight == pNew->Height() &&
+/*N*/ nOldAscent == pNew->GetAscent() &&
+/*N*/ nWidthDiff <= SLOPPY_TWIPS &&
+/*N*/ pOldCur->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ // rRepaint wird berechnet:
+/*N*/ const SwTwips nBottom = rLine.Y() + rLine.GetLineHeight();
+/*N*/ SwRepaint &rRepaint = *(pPara->GetRepaint());
+/*N*/ if( bUnChg && rRepaint.Top() == rLine.Y()
+/*N*/ && (bPrev || nNewStart <= pPara->GetReformat()->Start())
+/*N*/ && ( nNewStart < GetTxtNode()->GetTxt().Len() ) )
+/*N*/ {
+/*N*/ rRepaint.Top( nBottom );
+/*N*/ rRepaint.Height( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( nOldTop )
+/*N*/ {
+/*?*/ if( nOldTop < rRepaint.Top() )
+/*?*/ rRepaint.Top( nOldTop );
+/*?*/ if( !rLine.IsUnclipped() || nOldBottom > rRepaint.Bottom() )
+/*?*/ {
+/*?*/ rRepaint.Bottom( nOldBottom - 1 );
+/*?*/ rLine.SetUnclipped( sal_True );
+/*?*/ }
+/*N*/ }
+/*N*/ if( rLine.GetCurr()->IsClipping() && rLine.IsFlyInCntBase() )
+/*N*/ {
+/*?*/ SwTwips nTmpTop, nTmpBottom;
+/*?*/ rLine.CalcUnclipped( nTmpTop, nTmpBottom );
+/*?*/ if( nTmpTop < rRepaint.Top() )
+/*?*/ rRepaint.Top( nTmpTop );
+/*?*/ if( !rLine.IsUnclipped() || nTmpBottom > rRepaint.Bottom() )
+/*?*/ {
+/*?*/ rRepaint.Bottom( nTmpBottom - 1 );
+/*?*/ rLine.SetUnclipped( sal_True );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !rLine.IsUnclipped() || nBottom > rRepaint.Bottom() )
+/*N*/ {
+/*N*/ rRepaint.Bottom( nBottom - 1 );
+/*N*/ rLine.SetUnclipped( sal_False );
+/*N*/ }
+/*N*/ }
+/*N*/ SwTwips nRght = Max( nOldWidth, pNew->Width() +
+/*N*/ pNew->GetHangingMargin() );
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ const SwViewOption *pOpt = pSh ? pSh->GetViewOptions() : 0;
+/*N*/ if( pOpt && (pOpt->IsParagraph() || pOpt->IsLineBreak()) )
+/*?*/ nRght += ( Max( nOldAscent, pNew->GetAscent() ) );
+/*N*/ else
+/*N*/ nRght += ( Max( nOldAscent, pNew->GetAscent() ) / 4);
+/*N*/ nRght += rLine.GetLeftMargin();
+/*N*/ if( rRepaint.GetOfst() || rRepaint.GetRightOfst() < nRght )
+/*N*/ rRepaint.SetRightOfst( nRght );
+/*N*/
+/*N*/ // Finally we enlarge the repaint rectangle if we found an underscore
+/*N*/ // within our line. 40 Twips should be enough
+/*N*/ const sal_Bool bHasUnderscore =
+/*N*/ ( rLine.GetInfo().GetUnderScorePos() < nNewStart );
+/*N*/ if ( bHasUnderscore || rLine.GetCurr()->HasUnderscore() )
+/*N*/ rRepaint.Bottom( rRepaint.Bottom() + 40 );
+/*N*/
+/*N*/ ((SwLineLayout*)rLine.GetCurr())->SetUnderscore( bHasUnderscore );
+/*N*/ }
+/*N*/ if( !bUnChg )
+/*N*/ rLine.SetChanges();
+/*N*/
+/*N*/ // Die gute, alte nDelta-Berechnung:
+/*N*/ *(pPara->GetDelta()) -= long(pNew->GetLen()) - long(nOldLen);
+/*N*/
+/*N*/ // Stop!
+/*N*/ if( rLine.IsStop() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // Unbedingt noch eine Zeile
+/*N*/ if( rLine.IsNewLine() )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ // bis zum Ende des Strings ?
+/*N*/ if( nNewStart >= GetTxtNode()->GetTxt().Len() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ if( rLine.GetInfo().IsShift() )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ // Ende des Reformats erreicht ?
+/*N*/ const xub_StrLen nEnd = pPara->GetReformat()->Start() +
+/*N*/ pPara->GetReformat()->Len();
+/*N*/
+/*N*/ if( nNewStart <= nEnd )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ return 0 != *(pPara->GetDelta());
+/*N*/
+/*N*/ // Dieser Bereich ist so sensibel, da behalten wir mal die alte Version:
+/*N*/ #ifdef USED
+/*N*/ // nDelta abgearbeitet ?
+/*N*/ if( 0 == *(pPara->GetDelta()) )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // Wenn die Zeilen ausgeglichen sind, ist alles ok.
+/*N*/ if( bUnChg )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ return sal_True;
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::_Format()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
+/*N*/ const sal_Bool bAdjust )
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || IsSwapped(),"SwTxtFrm::_Format with unswapped frame" );
+/*N*/
+/*N*/ SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
+/*N*/ rLine.SetUnclipped( sal_False );
+/*N*/
+/*N*/ // Das war dem C30 zu kompliziert: aString( GetTxt() );
+/*N*/ const XubString &rString = GetTxtNode()->GetTxt();
+/*N*/ const xub_StrLen nStrLen = rString.Len();
+/*N*/
+/*N*/ SwCharRange &rReformat = *(pPara->GetReformat());
+/*N*/ SwRepaint &rRepaint = *(pPara->GetRepaint());
+/*N*/ SwRepaint *pFreeze = NULL;
+/*N*/
+/*N*/ // Aus Performancegruenden wird in Init() rReformat auf STRING_LEN gesetzt.
+/*N*/ // Fuer diesen Fall wird rReformat angepasst.
+/*N*/ if( rReformat.Len() > nStrLen )
+/*N*/ rReformat.Len() = nStrLen;
+/*N*/
+/*N*/ // Optimiert:
+/*N*/ xub_StrLen nEnd = rReformat.Start() + rReformat.Len();
+/*N*/ if( nEnd > nStrLen )
+/*N*/ {
+/*?*/ rReformat.Len() = nStrLen - rReformat.Start();
+/*?*/ nEnd = nStrLen;
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nOldBottom;
+/*N*/ if( GetOfst() && !IsFollow() )
+/*N*/ {
+/*?*/ rLine.Bottom();
+/*?*/ nOldBottom = rLine.Y();
+/*?*/ rLine.Top();
+/*N*/ }
+/*N*/ else
+/*N*/ nOldBottom = 0;
+/*N*/ rLine.CharToLine( rReformat.Start() );
+/*N*/
+/*N*/ // Worte koennen durch Fortfall oder Einfuegen eines Space
+/*N*/ // auf die Zeile vor der editierten hinausgezogen werden,
+/*N*/ // deshalb muss diese ebenfalls formatiert werden.
+/*N*/ // Optimierung: Wenn rReformat erst hinter dem ersten Wort der
+/*N*/ // Zeile beginnt, so kann diese Zeile die vorige nicht mehr beeinflussen.
+/*N*/ // AMA: Leider doch, Textgroessenaenderungen + FlyFrames, die Rueckwirkung
+/*N*/ // kann im Extremfall mehrere Zeilen (Frames!!!) betreffen!
+/*N*/
+/*N*/ sal_Bool bPrev = rLine.GetPrev() &&
+/*N*/ ( FindBrk( rString, rLine.GetStart(),
+/*N*/ rReformat.Start() + 1 ) >= rReformat.Start() ||
+/*N*/ rLine.GetCurr()->IsRest() );
+/*N*/ if( bPrev )
+/*N*/ {
+/*N*/ while( rLine.Prev() )
+/*N*/ if( rLine.GetCurr()->GetLen() && !rLine.GetCurr()->IsRest() )
+/*N*/ {
+/*N*/ if( !rLine.GetStart() )
+/*N*/ rLine.Top(); // damit NumDone nicht durcheinander kommt
+/*N*/ break;
+/*N*/ }
+/*N*/ xub_StrLen nNew = rLine.GetStart() + rLine.GetLength();
+/*N*/ if( nNew )
+/*N*/ {
+/*N*/ --nNew;
+/*N*/ if( CH_BREAK == rString.GetChar( nNew ) )
+/*N*/ {
+/*N*/ ++nNew;
+/*N*/ rLine.Next();
+/*N*/ bPrev = sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/ rReformat.Len() += rReformat.Start() - nNew;
+/*N*/ rReformat.Start() = nNew;
+/*N*/ }
+/*N*/
+/*N*/ rRepaint.SetOfst( 0 );
+/*N*/ rRepaint.SetRightOfst( 0 );
+/*N*/ rRepaint.Chg( Frm().Pos() + Prt().Pos(), Prt().SSize() );
+/*N*/ if( pPara->IsMargin() )
+/*?*/ rRepaint.Width( rRepaint.Width() + pPara->GetHangingMargin() );
+/*N*/ rRepaint.Top( rLine.Y() );
+/*N*/ // 6792: Rrand < LRand und Repaint
+/*N*/ if( 0 >= rRepaint.Width() )
+/*?*/ rRepaint.Width(1);
+/*N*/ WidowsAndOrphans aFrmBreak( this, rInf.IsTest() ? 1 : 0 );
+/*N*/
+/*N*/ // rLine steht jetzt auf der ersten Zeile, die formatiert werden
+/*N*/ // muss. Das Flag bFirst sorgt dafuer, dass nicht Next() gerufen wird.
+/*N*/ // Das ganze sieht verdreht aus, aber es muss sichergestellt werden,
+/*N*/ // dass bei IsBreakNow rLine auf der Zeile zum stehen kommt, die
+/*N*/ // nicht mehr passt.
+/*N*/ sal_Bool bFirst = sal_True;
+/*N*/ sal_Bool bFormat = sal_True;
+/*N*/
+/*N*/ // 5383: Das CharToLine() kann uns auch in den roten Bereich fuehren.
+/*N*/ // In diesem Fall muessen wir zurueckwandern, bis die Zeile, die
+/*N*/ // nicht mehr passt in rLine eingestellt ist. Ansonsten geht Textmasse
+/*N*/ // verloren, weil der Ofst im Follow falsch eingestellt wird.
+/*N*/
+/*N*/ sal_Bool bBreak = ( !pPara->IsPrepMustFit() || rLine.GetLineNr() > 1 )
+/*N*/ && aFrmBreak.IsBreakNow( rLine );
+/*N*/ if( bBreak )
+/*N*/ {
+/*?*/ sal_Bool bPrevDone = 0 != rLine.Prev();
+/*?*/ while( bPrevDone && aFrmBreak.IsBreakNow(rLine) )
+/*?*/ bPrevDone = 0 != rLine.Prev();
+/*?*/ if( bPrevDone )
+/*?*/ {
+/*?*/ aFrmBreak.SetKeep( sal_False );
+/*?*/ rLine.Next();
+/*?*/ }
+/*?*/ rLine.TruncLines();
+/*?*/
+/*?*/ // auf Nummer sicher:
+/*?*/ bBreak = aFrmBreak.IsBreakNow(rLine) &&
+/*?*/ ( !pPara->IsPrepMustFit() || rLine.GetLineNr() > 1 );
+/*N*/ }
+/*N*/
+/* Bedeutung der folgenden Flags:
+ Ist das Watch(End/Mid)Hyph-Flag gesetzt, so muss formatiert werden, wenn
+ eine Trennung am (Zeilenende/Fly) vorliegt, sofern MaxHyph erreicht ist.
+ Das Jump(End/Mid)Flag bedeutet, dass die naechste Zeile, bei der keine
+ Trennung (Zeilenende/Fly) vorliegt, formatiert werden muss, da jetzt
+ umgebrochen werden koennte, was vorher moeglicherweise durch MaxHyph
+ verboten war.
+ Watch(End/Mid)Hyph wird gesetzt, wenn die letzte formatierte Zeile eine
+ Trennstelle erhalten hat, vorher aber keine hatte,
+ Jump(End/Mid)Hyph, wenn eine Trennstelle verschwindet.
+*/
+/*N*/ sal_Bool bJumpEndHyph = sal_False,
+/*N*/ bWatchEndHyph = sal_False,
+/*N*/ bJumpMidHyph = sal_False,
+/*N*/ bWatchMidHyph = sal_False;
+/*N*/
+/*N*/ const SwAttrSet& rAttrSet = GetTxtNode()->GetSwAttrSet();
+/*N*/ sal_Bool bMaxHyph = ( 0 !=
+/*N*/ ( rInf.MaxHyph() = rAttrSet.GetHyphenZone().GetMaxHyphens() ) );
+/*N*/ if ( bMaxHyph )
+/*N*/ rLine.InitCntHyph();
+/*N*/
+/*N*/ if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() )
+/*N*/ {
+/*N*/ const SwLineLayout* pLine;
+/*N*/ {
+/*?*/ SwTxtFrm *pMaster = FindMaster();
+/*?*/ ASSERT( pMaster, "SwTxtFrm::Format: homeless follow" );
+/*?*/ if( !pMaster->HasPara() )
+/*?*/ pMaster->GetFormatted();
+/*?*/ SwTxtSizeInfo aInf( pMaster );
+/*?*/ SwTxtIter aMasterLine( pMaster, &aInf );
+/*?*/ aMasterLine.Bottom();
+/*?*/ pLine = aMasterLine.GetCurr();
+/*?*/ }
+/*?*/ SwLinePortion* pRest =
+/*?*/ rLine.MakeRestPortion( pLine, GetOfst() );
+/*?*/ if( pRest )
+/*?*/ rInf.SetRest( pRest );
+/*?*/ else
+/*?*/ SetFieldFollow( sal_False );
+/*N*/ }
+/*N*/
+/* Zum Abbruchkriterium:
+ * Um zu erkennen, dass eine Zeile nicht mehr auf die Seite passt,
+ * muss sie formatiert werden. Dieser Ueberhang wird z.B. in AdjustFollow
+ * wieder entfernt.
+ * Eine weitere Komplikation: wenn wir der Master sind, so muessen
+ * wir die Zeilen durchgehen, da es ja sein kann, dass eine Zeile
+ * vom Follow in den Master rutschen kann.
+ */
+/*N*/ do
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ if( bFirst )
+/*N*/ bFirst = sal_False;
+/*N*/ else
+/*N*/ {
+/*N*/ if ( bMaxHyph )
+/*N*/ {
+/*N*/ if ( rLine.GetCurr()->IsEndHyph() )
+/*N*/ rLine.CntEndHyph()++;
+/*N*/ else
+/*N*/ rLine.CntEndHyph() = 0;
+/*N*/ if ( rLine.GetCurr()->IsMidHyph() )
+/*N*/ rLine.CntMidHyph()++;
+/*N*/ else
+/*N*/ rLine.CntMidHyph() = 0;
+/*N*/ }
+/*N*/ if( !rLine.Next() )
+/*N*/ {
+/*N*/ if( !bFormat )
+/*N*/ rLine.MakeRestPortion( rLine.GetCurr(), rLine.GetEnd() );
+/*N*/ rLine.Insert( new SwLineLayout() );
+/*N*/ rLine.Next();
+/*N*/ bFormat = sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ if ( !bFormat && bMaxHyph &&
+/*N*/ (bWatchEndHyph || bJumpEndHyph || bWatchMidHyph || bJumpMidHyph) )
+/*N*/ {
+/*N*/ if ( rLine.GetCurr()->IsEndHyph() )
+/*N*/ {
+/*N*/ if ( bWatchEndHyph )
+/*?*/ bFormat = ( rLine.CntEndHyph() == rInf.MaxHyph() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bFormat = bJumpEndHyph;
+/*N*/ bWatchEndHyph = sal_False;
+/*N*/ bJumpEndHyph = sal_False;
+/*N*/ }
+/*N*/ if ( rLine.GetCurr()->IsMidHyph() )
+/*N*/ {
+/*?*/ if ( bWatchMidHyph && !bFormat )
+/*?*/ bFormat = ( rLine.CntEndHyph() == rInf.MaxHyph() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bFormat = bFormat || bJumpMidHyph;
+/*N*/ bWatchMidHyph = sal_False;
+/*N*/ bJumpMidHyph = sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/ if( bFormat )
+/*N*/ {
+/*N*/ sal_Bool bOldEndHyph = rLine.GetCurr()->IsEndHyph();
+/*N*/ sal_Bool bOldMidHyph = rLine.GetCurr()->IsMidHyph();
+/*N*/ bFormat = FormatLine( rLine, bPrev );
+/*N*/ //9334: Es kann nur ein bPrev geben... (???)
+/*N*/ bPrev = sal_False;
+/*N*/ if ( bMaxHyph )
+/*N*/ {
+/*N*/ if ( rLine.GetCurr()->IsEndHyph() != bOldEndHyph )
+/*N*/ {
+/*N*/ bWatchEndHyph = !bOldEndHyph;
+/*N*/ bJumpEndHyph = bOldEndHyph;
+/*N*/ }
+/*N*/ if ( rLine.GetCurr()->IsMidHyph() != bOldMidHyph )
+/*N*/ {
+/*?*/ bWatchMidHyph = !bOldMidHyph;
+/*?*/ bJumpMidHyph = bOldMidHyph;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !rInf.IsNewLine() )
+/*N*/ {
+/*N*/ if( !bFormat )
+/*N*/ bFormat = 0 != rInf.GetRest();
+/*N*/ if( rInf.IsStop() || rInf.GetIdx() >= nStrLen )
+/*N*/ break;
+/*N*/ if( !bFormat && ( !bMaxHyph || ( !bWatchEndHyph &&
+/*N*/ !bJumpEndHyph && !bWatchMidHyph && !bJumpMidHyph ) ) )
+/*N*/ {
+/*N*/ if( GetFollow() )
+/*N*/ {
+/*N*/ while( rLine.Next() )
+/*N*/ ; //Nothing
+/*N*/ pFreeze = new SwRepaint( rRepaint ); // to minimize painting
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ bBreak = aFrmBreak.IsBreakNow(rLine);
+/*N*/ }while( !bBreak );
+/*N*/
+/*N*/ if( pFreeze )
+/*N*/ {
+/*N*/ rRepaint = *pFreeze;
+/*N*/ delete pFreeze;
+/*N*/ }
+/*N*/
+/*N*/ if( !rLine.IsStop() )
+/*N*/ {
+/*N*/ // Wurde aller Text formatiert und gibt es noch weitere
+/*N*/ // Zeilenobjekte, dann sind diese jetzt ueberfluessig,
+/*N*/ // weil der Text kuerzer geworden ist.
+/*N*/ if( rLine.GetStart() + rLine.GetLength() >= nStrLen &&
+/*N*/ rLine.GetCurr()->GetNext() )
+/*N*/ {
+/*N*/ rLine.TruncLines();
+/*N*/ rLine.SetTruncLines( sal_True );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !rInf.IsTest() )
+/*N*/ {
+/*N*/ // Bei OnceMore lohnt sich kein FormatAdjust
+/*N*/ if( bAdjust || !rLine.GetDropFmt() || !rLine.CalcOnceMore() )
+/*N*/ {
+/*N*/ FormatAdjust( rLine, aFrmBreak, nStrLen, rInf.IsStop() );
+/*N*/ }
+/*N*/ if( rRepaint.HasArea() )
+/*N*/ SetRepaint();
+/*N*/ rLine.SetTruncLines( sal_False );
+/*N*/ if( nOldBottom ) // Bei "gescollten" Absaetzen wird
+/*N*/ { // noch ueberprueft, ob durch Schrumpfen
+/*?*/ rLine.Bottom(); // das Scrolling ueberfluessig wurde.
+/*?*/ SwTwips nNewBottom = rLine.Y();
+/*?*/ if( nNewBottom < nOldBottom )
+/*?*/ _SetOfst( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::Format()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || IsSwapped(),
+/*N*/ "A frame is not swapped in SwTxtFrm::FormatOnceMore" );
+/*N*/
+/*N*/ SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
+/*N*/ if( !pPara )
+/*N*/ return;
+/*N*/
+/*N*/ // ggf gegen pPara
+/*N*/ KSHORT nOld = ((const SwTxtMargin&)rLine).GetDropHeight();
+/*N*/ sal_Bool bShrink = sal_False,
+/*N*/ bGrow = sal_False,
+/*N*/ bGoOn = rLine.IsOnceMore();
+/*N*/ sal_uInt8 nGo = 0;
+/*N*/ while( bGoOn )
+/*N*/ {
+/*N*/ #ifdef DBGTXT
+/*N*/ aDbstream << "OnceMore!" << endl;
+/*N*/ #endif
+/*N*/ ++nGo;
+/*N*/ rInf.Init();
+/*N*/ rLine.Top();
+/*N*/ if( !rLine.GetDropFmt() )
+/*N*/ rLine.SetOnceMore( sal_False );
+/*N*/ SwCharRange aRange( 0, rInf.GetTxt().Len() );
+/*N*/ *(pPara->GetReformat()) = aRange;
+/*N*/ _Format( rLine, rInf );
+/*N*/
+/*N*/ bGoOn = rLine.IsOnceMore();
+/*N*/ if( bGoOn )
+/*N*/ {
+/*?*/ const KSHORT nNew = ((const SwTxtMargin&)rLine).GetDropHeight();
+/*?*/ if( nOld == nNew )
+/*?*/ bGoOn = sal_False;
+/*?*/ else
+/*?*/ {
+/*?*/ if( nOld > nNew )
+/*?*/ bShrink = sal_True;
+/*?*/ else
+/*?*/ bGrow = sal_True;
+/*?*/
+/*?*/ if( bShrink == bGrow || 5 < nGo )
+/*?*/ bGoOn = sal_False;
+/*?*/
+/*?*/ nOld = nNew;
+/*?*/ }
+/*?*/
+/*?*/ // 6107: Wenn was schief ging, muss noch einmal formatiert werden.
+/*?*/ if( !bGoOn )
+/*?*/ {
+/*?*/ rInf.CtorInit( this );
+/*?*/ rLine.CtorInit( this, &rInf );
+/*?*/ rLine.SetDropLines( 1 );
+/*?*/ rLine.CalcDropHeight( 1 );
+/*?*/ SwCharRange aRange( 0, rInf.GetTxt().Len() );
+/*?*/ *(pPara->GetReformat()) = aRange;
+/*?*/ _Format( rLine, rInf, sal_True );
+/*?*/ // 8047: Wir painten alles...
+/*?*/ SetCompletePaint();
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::_Format()
+ *************************************************************************/
+
+
+/*N*/ void SwTxtFrm::_Format( SwParaPortion *pPara )
+/*N*/ {
+/*N*/ const xub_StrLen nStrLen = GetTxt().Len();
+/*N*/
+/*N*/ // AMA: Wozu soll das gut sein? Scheint mir zuoft zu einem kompletten
+/*N*/ // Formatieren und Repainten zu fuehren???
+/*N*/ // if ( !(*pPara->GetDelta()) )
+/*N*/ // *(pPara->GetDelta()) = nStrLen;
+/*N*/ // else
+/*N*/ if ( !nStrLen )
+/*N*/ {
+/*N*/ // Leere Zeilen werden nicht lange gequaelt:
+/*N*/ // pPara wird blank geputzt
+/*N*/ // entspricht *pPara = SwParaPortion;
+/*N*/ sal_Bool bMustFit = pPara->IsPrepMustFit();
+/*N*/ pPara->Truncate();
+/*N*/ pPara->FormatReset();
+/*N*/
+/*N*/ // delete pSpaceAdd und pKanaComp
+/*N*/ pPara->FinishSpaceAdd();
+/*N*/ pPara->FinishKanaComp();
+/*N*/ pPara->ResetFlags();
+/*N*/ pPara->SetPrepMustFit( bMustFit );
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( ! IsSwapped(), "A frame is swapped before _Format" );
+/*N*/
+/*N*/ if ( IsVertical() )
+/*?*/ SwapWidthAndHeight();
+/*N*/
+/*N*/ SwTxtFormatInfo aInf( this );
+/*N*/ SwTxtFormatter aLine( this, &aInf );
+/*N*/
+/*N*/ _Format( aLine, aInf );
+/*N*/
+/*N*/ if( aLine.IsOnceMore() )
+/*N*/ FormatOnceMore( aLine, aInf );
+/*N*/
+/*N*/ if ( IsVertical() )
+/*?*/ SwapWidthAndHeight();
+/*N*/
+/*N*/ ASSERT( ! IsSwapped(), "A frame is swapped after _Format" );
+/*N*/
+/*N*/ if( 1 < aLine.GetDropLines() )
+/*N*/ {
+/*N*/ if( SVX_ADJUST_LEFT != aLine.GetAdjust() &&
+/*N*/ SVX_ADJUST_BLOCK != aLine.GetAdjust() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ aLine.CalcDropAdjust();
+/*N*/ }
+/*N*/
+/*N*/ if( aLine.IsPaintDrop() )
+/*N*/ {
+/*N*/ aLine.CalcDropRepaint();
+/*N*/ aLine.SetPaintDrop( sal_False );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::Format()
+ *************************************************************************/
+
+/*
+ * Format berechnet die Groesse des Textframes und ruft, wenn
+ * diese feststeht, Shrink() oder Grow(), um die Framegroesse dem
+ * evtl. veraenderten Platzbedarf anzupassen.
+ */
+
+/*M*/ void SwTxtFrm::Format( const SwBorderAttrs * )
+/*M*/ {
+///*M*/ DBG_LOOP;
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ const XubString aXXX = GetTxtNode()->GetTxt();
+/*M*/ const SwTwips nDbgY = Frm().Top();
+/*M*/ const SwPageFrm *pDbgPage = FindPageFrm();
+/*M*/ const MSHORT nDbgPageNr = pDbgPage->GetPhyPageNum();
+/*M*/ // Um zu gucken, ob es einen Ftn-Bereich gibt.
+/*M*/ const SwFrm *pDbgFtnCont = (const SwFrm*)(FindPageFrm()->FindFtnCont());
+/*M*/
+/*M*/ #ifdef DBG_UTIL
+/*M*/ // nStopAt laesst sich vom CV bearbeiten.
+/*M*/ static MSHORT nStopAt = 0;
+/*M*/ if( nStopAt == GetFrmId() )
+/*M*/ {
+/*M*/ int i = GetFrmId();
+/*M*/ }
+/*M*/ #endif
+/*M*/ #endif
+/*M*/
+/*M*/ #ifdef DEBUG_FTN
+/*M*/ //Fussnote darf nicht auf einer Seite vor ihrer Referenz stehen.
+/*M*/ if( IsInFtn() )
+/*M*/ {
+/*M*/ const SwFtnFrm *pFtn = (SwFtnFrm*)GetUpper();
+/*M*/ const SwPageFrm *pFtnPage = pFtn->GetRef()->FindPageFrm();
+/*M*/ const MSHORT nFtnPageNr = pFtnPage->GetPhyPageNum();
+/*M*/ if( !IsLocked() )
+/*M*/ {
+/*M*/ if( nFtnPageNr > nDbgPageNr )
+/*M*/ {
+/*M*/ SwTxtFrmLocker aLock(this);
+/*M*/ ASSERT( nFtnPageNr <= nDbgPageNr, "!Ftn steht vor der Referenz." );
+/*M*/ MSHORT i = 0;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ #endif
+/*M*/
+/*M*/ MSHORT nRepeat = 0;
+/*M*/
+/*M*/ SWRECTFN( this )
+/*M*/
+/*M*/ do
+/*M*/ {
+/*M*/ // Vom Berichtsautopiloten oder ueber die BASIC-Schnittstelle kommen
+/*M*/ // gelegentlich TxtFrms mit einer Breite <=0.
+/*M*/ if( (Prt().*fnRect->fnGetWidth)() <= 0 )
+/*M*/ {
+/*M*/ // Wenn MustFit gesetzt ist, schrumpfen wir ggf. auf die Unterkante
+/*M*/ // des Uppers, ansonsten nehmen wir einfach eine Standardgroesse
+/*M*/ // von 12 Pt. ein (240 Twip).
+/*M*/ SwTxtLineAccess aAccess( this );
+/*M*/ long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*M*/ if( aAccess.GetPara()->IsPrepMustFit() )
+/*M*/ {
+/*M*/ const SwTwips nLimit = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*M*/ const SwTwips nDiff = - (Frm().*fnRect->fnBottomDist)( nLimit );
+/*M*/ if( nDiff > 0 )
+/*M*/ Shrink( nDiff );
+/*M*/ }
+/*M*/ else if( 240 < nFrmHeight )
+/*M*/ Shrink( nFrmHeight - 240 );
+/*M*/ else if( 240 > nFrmHeight )
+/*M*/ Grow( 240 - nFrmHeight );
+/*M*/ nFrmHeight = (Frm().*fnRect->fnGetHeight)();
+/*M*/
+/*M*/ long nTop = (this->*fnRect->fnGetTopMargin)();
+/*M*/ if( nTop > nFrmHeight )
+/*M*/ (this->*fnRect->fnSetYMargins)( nFrmHeight, 0 );
+/*M*/ else if( (Prt().*fnRect->fnGetHeight)() < 0 )
+/*M*/ (Prt().*fnRect->fnSetHeight)( 0 );
+/*M*/ return;
+/*M*/ }
+/*M*/
+/*M*/ sal_Bool bChkAtCnt = sal_False;
+/*M*/ const xub_StrLen nStrLen = GetTxtNode()->GetTxt().Len();
+/*M*/ if ( nStrLen || !FormatEmpty() )
+/*M*/ {
+/*M*/
+/*M*/ SetEmpty( sal_False );
+/*M*/ // Um nicht durch verschachtelte Formats irritiert zu werden.
+/*M*/ FormatLevel aLevel;
+/*M*/ if( 12 == aLevel.GetLevel() )
+/*M*/ return;
+/*M*/
+/*M*/ // Die Formatinformationen duerfen u.U. nicht veraendert werden.
+/*M*/ if( IsLocked() )
+/*M*/ return;
+/*M*/
+/*M*/ // Waehrend wir formatieren, wollen wir nicht gestoert werden.
+/*M*/ SwTxtFrmLocker aLock(this);
+/*M*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ //MA 25. Jan. 94 Das Flag stimmt sehr haufig beim Eintritt nicht. Das muss
+/*M*/ // bei naechster Gelegenheit geprueft und gefixt werden.
+/*M*/ const sal_Bool bOldFtnFlag = HasFtn();
+/*M*/ CalcFtnFlag();
+/*M*/ if ( bOldFtnFlag != HasFtn() )
+/*M*/ {int bla = 5;}
+/*M*/ #endif
+/*M*/
+/*M*/ // 8708: Vorsicht, das Format() kann auch durch GetFormatted()
+/*M*/ // angestossen werden.
+/*M*/ if( IsHiddenNow() )
+/*M*/ {
+/*M*/ long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
+/*M*/ if( nPrtHeight )
+/*M*/ {
+/*M*/ HideHidden();
+/*M*/ Shrink( nPrtHeight );
+/*M*/ }
+/*M*/ ChgThisLines();
+/*M*/ return;
+/*M*/ }
+/*M*/
+/*M*/ SwTxtLineAccess aAccess( this );
+/*M*/ const sal_Bool bNew = !aAccess.SwTxtLineAccess::IsAvailable();
+/*M*/ sal_Bool bSetOfst = sal_False;
+/*M*/
+/*M*/ if( CalcPreps() )
+/*M*/ ; // nothing
+/*M*/ // Wir returnen, wenn schon formatiert wurde, nicht aber, wenn
+/*M*/ // der TxtFrm gerade erzeugt wurde und ueberhaupt keine Format-
+/*M*/ // informationen vorliegen.
+/*M*/ else if( !bNew && !aAccess.GetPara()->GetReformat()->Len() )
+/*M*/ {
+/*M*/ if( GetTxtNode()->GetSwAttrSet().GetRegister().GetValue() )
+/*M*/ {
+/*M*/ aAccess.GetPara()->SetPrepAdjust( sal_True );
+/*M*/ aAccess.GetPara()->SetPrep( sal_True );
+/*M*/ CalcPreps();
+/*M*/ }
+/*M*/ SetWidow( sal_False );
+/*M*/ }
+/*M*/ else if( ( bSetOfst = ( GetOfst() && GetOfst() > GetTxtNode()->GetTxt().Len() ) ) &&
+/*M*/ IsFollow() )
+/*M*/ {
+/*M*/ SwTxtFrm *pMaster = FindMaster();
+/*M*/ ASSERT( pMaster, "SwTxtFrm::Format: homeless follow" );
+/*M*/ if( pMaster )
+/*M*/ pMaster->Prepare( PREP_FOLLOW_FOLLOWS );
+/*M*/ SwTwips nMaxY = (GetUpper()->*fnRect->fnGetPrtBottom)();
+/*M*/ if( (Frm().*fnRect->fnOverStep)( nMaxY ) )
+/*M*/ (this->*fnRect->fnSetLimit)( nMaxY );
+/*M*/ else if( (Frm().*fnRect->fnBottomDist)( nMaxY ) < 0 )
+/*M*/ (Frm().*fnRect->fnAddBottom)( -(Frm().*fnRect->fnGetHeight)() );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ // bSetOfst here means that we have the "red arrow situation"
+/*M*/ if ( bSetOfst )
+/*M*/ _SetOfst( 0 );
+/*M*/
+/*M*/ const sal_Bool bOrphan = IsWidow();
+/*M*/ const SwFtnBossFrm* pFtnBoss = HasFtn() ? FindFtnBossFrm() : 0;
+/*M*/ SwTwips nFtnHeight;
+/*M*/ if( pFtnBoss )
+/*M*/ {
+/*M*/ const SwFtnContFrm* pCont = pFtnBoss->FindFtnCont();
+/*M*/ nFtnHeight = pCont ? (pCont->Frm().*fnRect->fnGetHeight)() : 0;
+/*M*/ }
+/*M*/ do
+/*M*/ {
+/*M*/ _Format( aAccess.GetPara() );
+/*M*/ if( pFtnBoss && nFtnHeight )
+/*M*/ {
+/*M*/ const SwFtnContFrm* pCont = pFtnBoss->FindFtnCont();
+/*M*/ SwTwips nNewHeight = pCont ? (pCont->Frm().*fnRect->fnGetHeight)() : 0;
+/*M*/ // If we lost some footnotes, we may have more space
+/*M*/ // for our main text, so we have to format again ...
+/*M*/ if( nNewHeight < nFtnHeight )
+/*M*/ nFtnHeight = nNewHeight;
+/*M*/ else
+/*M*/ break;
+/*M*/ }
+/*M*/ else
+/*M*/ break;
+/*M*/ } while ( pFtnBoss );
+/*M*/ if( bOrphan )
+/*M*/ {
+/*M*/ ValidateFrm();
+/*M*/ SetWidow( sal_False );
+/*M*/ }
+/*M*/ bChkAtCnt = sal_True;
+/*M*/ }
+/*M*/ if( IsEmptyMaster() )
+/*M*/ {
+/*M*/ SwFrm* pPre = GetPrev();
+/*M*/ if( pPre && pPre->GetAttrSet()->GetKeep().GetValue() )
+/*M*/ pPre->InvalidatePos();
+/*M*/ }
+/*M*/ }
+/*M*/ MSHORT nMaxRepeat = 2;
+/*M*/ if( bChkAtCnt && nRepeat < nMaxRepeat )
+/*M*/ {
+/*M*/ sal_Bool bRepeat = sal_False;
+/*M*/ MSHORT nRepAdd = 0;
+/*M*/ SwDrawObjs *pObjs;
+/*M*/ SwTxtFrm *pMaster = IsFollow() ? FindMaster() : this;
+/*M*/ if( pMaster && !pMaster->IsFlyLock() )
+/*M*/ {
+/*M*/ if ( 0 != (pObjs = pMaster->GetDrawObjs()) )
+/*M*/ {
+/*M*/ MSHORT nAutoCnt = 0;
+/*M*/ for( MSHORT i = 0; i < pObjs->Count(); ++i )
+/*M*/ {
+/*M*/ SdrObject *pO = (*pObjs)[i];
+/*M*/ if ( pO->IsWriterFlyFrame() )
+/*M*/ {
+/*M*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*M*/ if( pFly->IsAutoPos() && !::binfilter::IsInProgress( pFly ) )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ if( nAutoCnt > 11 )
+/*M*/ nMaxRepeat = nAutoCnt/4;
+/*M*/ }
+/*M*/ }
+/*M*/ if( bRepeat )
+/*M*/ nRepeat += nRepAdd;
+/*M*/ else
+/*M*/ nRepeat = 0;
+/*M*/ }
+/*M*/ else
+/*M*/ nRepeat = 0;
+/*M*/ } while( nRepeat );
+/*M*/
+/*M*/ ChgThisLines();
+/*M*/
+/*N*/ // the PrepMustFit should not survive a Format operation
+/*N*/ SwParaPortion *pPara = GetPara();
+/*N*/ if ( pPara )
+/*N*/ pPara->SetPrepMustFit( sal_False );
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ // Hier ein Instrumentarium, um ungewoehnlichen Master/Follow-Kombinationen,
+/*M*/ // insbesondere bei Fussnoten, auf die Schliche zu kommen
+/*M*/ if( IsFollow() || GetFollow() )
+/*M*/ {
+/*M*/ SwTxtFrm *pTmpFrm = IsFollow() ? FindMaster() : this;
+/*M*/ const SwPageFrm *pTmpPage = pTmpFrm->FindPageFrm();
+/*M*/ MSHORT nPgNr = pTmpPage->GetPhyPageNum();
+/*M*/ MSHORT nLast;
+/*M*/ MSHORT nDummy = 0; // nur zum Breakpoint setzen
+/*M*/ while( pTmpFrm->GetFollow() )
+/*M*/ {
+/*M*/ pTmpFrm = pTmpFrm->GetFollow();
+/*M*/ nLast = nPgNr;
+/*M*/ pTmpPage = pTmpFrm->FindPageFrm();
+/*M*/ nPgNr = pTmpPage->GetPhyPageNum();
+/*M*/ if( nLast > nPgNr )
+/*M*/ ++nDummy; // schon fast eine Assertion wert
+/*M*/ else if( nLast == nPgNr )
+/*M*/ ++nDummy; // bei Spalten voellig normal, aber sonst!?
+/*M*/ else if( nLast < nPgNr - 1 )
+/*M*/ ++nDummy; // kann schon mal temporaer vorkommen
+/*M*/ }
+/*M*/ }
+/*M*/ #endif
+/*N*/
+/*N*/ CalcBaseOfstForFly();
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFrm::FormatQuick()
+ *************************************************************************/
+// 6995:
+// return sal_False: Prepare(), HasPara(), InvalidateRanges(),
+
+/*N*/ sal_Bool SwTxtFrm::FormatQuick()
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),
+/*N*/ "SwTxtFrm::FormatQuick with swapped frame" );
+/*N*/
+///*N*/ DBG_LOOP;
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ const XubString aXXX = GetTxtNode()->GetTxt();
+/*N*/ const SwTwips nDbgY = Frm().Top();
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // nStopAt laesst sich vom CV bearbeiten.
+/*N*/ static MSHORT nStopAt = 0;
+/*N*/ if( nStopAt == GetFrmId() )
+/*N*/ {
+/*?*/ int i = GetFrmId();
+/*N*/ }
+/*N*/ #endif
+/*N*/ #endif
+/*N*/
+/*N*/ if( IsEmpty() && FormatEmpty() )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ // Wir sind sehr waehlerisch:
+/*N*/ if( HasPara() || IsWidow() || IsLocked()
+/*N*/ || !GetValidSizeFlag() ||
+/*N*/ ( ( IsVertical() ? Prt().Width() : Prt().Height() ) && IsHiddenNow() ) )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ SwTxtLineAccess aAccess( this );
+/*N*/ SwParaPortion *pPara = aAccess.GetPara();
+/*N*/ if( !pPara )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ SwFrmSwapper aSwapper( this, sal_True );
+/*N*/
+/*N*/ SwTxtFrmLocker aLock(this);
+/*N*/ SwTxtFormatInfo aInf( this, sal_False, sal_True );
+/*N*/ if( 0 != aInf.MaxHyph() ) // 27483: MaxHyphen beachten!
+/*N*/ return sal_False;
+/*N*/
+/*N*/ SwTxtFormatter aLine( this, &aInf );
+/*N*/
+/*N*/ // DropCaps sind zu kompliziert...
+/*N*/ if( aLine.GetDropFmt() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ xub_StrLen nStart = GetOfst();
+/*N*/ const xub_StrLen nEnd = GetFollow()
+/*N*/ ? GetFollow()->GetOfst() : aInf.GetTxt().Len();
+/*N*/ do
+/*N*/ { //DBG_LOOP;
+/*N*/ nStart = aLine.FormatLine( nStart );
+/*N*/ if( aInf.IsNewLine() || (!aInf.IsStop() && nStart < nEnd) )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ aLine.Insert( new SwLineLayout() );
+/*N*/ } while( aLine.Next() );
+/*N*/
+/*N*/ // Last exit: die Hoehen muessen uebereinstimmen.
+/*N*/ Point aTopLeft( Frm().Pos() );
+/*N*/ aTopLeft += Prt().Pos();
+/*N*/ const SwTwips nNewHeight = aLine.Y() + aLine.GetLineHeight();
+/*N*/ const SwTwips nOldHeight = aTopLeft.Y() + Prt().Height();
+/*N*/ if( nNewHeight != nOldHeight && !IsUndersized() )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*?*/ // Achtung: Durch FormatLevel==12 kann diese Situation auftreten, don't panic!
+/*?*/ // ASSERT( nNewHeight == nOldHeight, "!FormatQuick: rosebud" );
+/*?*/ #endif
+/*?*/ xub_StrLen nStrt = GetOfst();
+/*?*/ _InvalidateRange( SwCharRange( nStrt, nEnd - nStrt) );
+/*?*/ return sal_False;
+/*N*/ }
+/*N*/
+/*N*/ if( pFollow && nStart != ((SwTxtFrm*)pFollow)->GetOfst() )
+/*N*/ return sal_False; // kann z.B. durch Orphans auftreten (35083,35081)
+/*N*/
+/*N*/ // Geschafft, wir sind durch ...
+/*N*/
+/*N*/ // Repaint setzen
+/*N*/ pPara->GetRepaint()->Pos( aTopLeft );
+/*N*/ pPara->GetRepaint()->SSize( Prt().SSize() );
+/*N*/
+/*N*/ // Reformat loeschen
+/*N*/ *(pPara->GetReformat()) = SwCharRange();
+/*N*/ *(pPara->GetDelta()) = 0;
+/*N*/
+/*N*/ return sal_True;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_frmpaint.cxx b/binfilter/bf_sw/source/core/text/sw_frmpaint.cxx
new file mode 100644
index 000000000000..1172d3b9182d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_frmpaint.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+
+#include <pagedesc.hxx> // SwPageDesc
+
+#include <itrpaint.hxx> // SwTxtPainter
+
+#include <horiornt.hxx>
+
+namespace binfilter {
+
+
+// steht im number.cxx
+extern const sal_Char __FAR_DATA sBulletFntName[];
+
+extern FASTBOOL bOneBeepOnly;
+
+sal_Bool bInitFont = sal_True;
+
+#define REDLINE_DISTANCE 567/4
+#define REDLINE_MINDIST 567/10
+
+
+/*************************************************************************
+ * SwExtraPainter::PaintExtra()
+ **************************************************************************/
+
+
+
+
+/*************************************************************************
+ * SwTxtFrm::Paint()
+ *************************************************************************/
+
+/*N*/ SwRect SwTxtFrm::Paint()
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ const SwTwips nDbgY = Frm().Top();
+/*N*/ #endif
+/*N*/
+/*N*/ // finger layout
+/*N*/ ASSERT( GetValidPosFlag(), "+SwTxtFrm::Paint: no Calc()" );
+/*N*/
+/*N*/ SwRect aRet( Prt() );
+/*N*/ if ( IsEmpty() || !HasPara() )
+/*N*/ aRet += Frm().Pos();
+/*N*/ else
+/*N*/ {
+/*N*/ // AMA: Wir liefern jetzt mal das richtige Repaintrechteck zurueck,
+/*N*/ // d.h. als linken Rand den berechneten PaintOfst!
+/*N*/ SwRepaint *pRepaint = GetPara()->GetRepaint();
+/*N*/ long l;
+/*N*/ if( pRepaint->GetOfst() )
+/*N*/ pRepaint->Left( pRepaint->GetOfst() );
+/*N*/
+/*N*/ l = pRepaint->GetRightOfst();
+/*N*/ if( l && ( pRepaint->GetOfst() || l > pRepaint->Right() ) )
+/*N*/ pRepaint->Right( l );
+/*N*/ pRepaint->SetOfst( 0 );
+/*N*/ aRet = *pRepaint;
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ if ( IsRightToLeft() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ SwitchLTRtoRTL( aRet );
+/*N*/ #endif
+/*N*/ if ( IsVertical() )
+/*N*/ SwitchHorizontalToVertical( aRet );
+/*N*/ }
+/*N*/ ResetRepaint();
+/*N*/
+/*N*/ return aRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFrm::Paint()
+ *************************************************************************/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_guess.cxx b/binfilter/bf_sw/source/core/text/sw_guess.cxx
new file mode 100644
index 000000000000..d23547d77649
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_guess.cxx
@@ -0,0 +1,578 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <ctype.h>
+
+#include <tools/shl.hxx> // needed for SW_MOD() macro
+
+#include <swmodule.hxx>
+#include <guess.hxx>
+#include <inftxt.hxx> // SwTxtSizeInfo, SwTxtFormatInfo
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pagefrm.hxx>
+#include <pagedesc.hxx> // SwPageDesc
+#include <tgrditem.hxx>
+
+#include <com/sun/star/i18n/BreakType.hpp>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <unotools/charclass.hxx>
+#include <porfld.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+
+#ifdef VERTICAL_LAYOUT
+#define CH_FULL_BLANK 0x3000
+#endif
+
+/*************************************************************************
+ * SwTxtGuess::Guess
+ *
+ * provides information for line break calculation
+ * returns true if no line break has to be performed
+ * otherwise possible break or hyphenation position is determined
+ *************************************************************************/
+
+/*M*/ sal_Bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
+/*M*/ const KSHORT nPorHeight )
+/*M*/ {
+/*M*/ nCutPos = rInf.GetIdx();
+/*M*/
+/*M*/ // Leere Strings sind immer 0
+/*M*/ if( !rInf.GetLen() || !rInf.GetTxt().Len() )
+/*M*/ return sal_False;
+/*M*/
+/*M*/ ASSERT( rInf.GetIdx() < rInf.GetTxt().Len(),
+/*M*/ "+SwTxtGuess::Guess: invalid SwTxtFormatInfo" );
+/*M*/
+/*M*/ ASSERT( nPorHeight, "+SwTxtGuess::Guess: no height" );
+/*M*/
+/*M*/ USHORT nMinSize;
+/*M*/ USHORT nMaxSizeDiff;
+/*M*/
+/*M*/ const SwScriptInfo& rSI =
+/*M*/ ((SwParaPortion*)rInf.GetParaPortion())->GetScriptInfo();
+/*M*/
+/*M*/ USHORT nMaxComp = ( SW_CJK == rInf.GetFont()->GetActual() ) &&
+/*M*/ rSI.CountCompChg() &&
+/*M*/ ! rInf.IsMulti() &&
+/*M*/ ! rPor.InFldGrp() &&
+/*M*/ ! rPor.IsDropPortion() ?
+/*M*/ 10000 :
+/*M*/ 0 ;
+/*M*/
+/*M*/ SwTwips nLineWidth = rInf.Width() - rInf.X();
+/*M*/ const xub_StrLen nMaxLen = Min( xub_StrLen(rInf.GetTxt().Len() - rInf.GetIdx()),
+/*M*/ rInf.GetLen() );
+/*M*/ // special case: char width > line width
+/*M*/ if( !nMaxLen || !nLineWidth )
+/*M*/ return sal_False;
+/*M*/
+/*M*/ KSHORT nItalic = 0;
+/*M*/ if( ITALIC_NONE != rInf.GetFont()->GetItalic() && !rInf.NotEOL() )
+/*M*/ {
+/*M*/ sal_Bool bAddItalic = sal_True;
+/*M*/
+/*M*/ // do not add extra italic value if we have an active character grid
+/*M*/ if ( rInf.SnapToGrid() )
+/*M*/ {
+/*M*/ GETGRID( rInf.GetTxtFrm()->FindPageFrm() )
+/*M*/ bAddItalic = ! pGrid || GRID_LINES_CHARS != pGrid->GetGridType();
+/*M*/ }
+/*M*/
+/*M*/ #ifdef MAC
+/*M*/ nItalic = bAddItalic ? nPorHeight / 4 : 0;
+/*M*/ #else
+/*M*/ nItalic = bAddItalic ? nPorHeight / 12 : 0;
+/*M*/ #endif
+/*M*/ if( nItalic >= nLineWidth )
+/*M*/ {
+/*M*/ nBreakWidth = nItalic;
+/*M*/ nCutPos = rInf.GetIdx();
+/*M*/ return sal_False;
+/*M*/ }
+/*M*/ else
+/*M*/ nLineWidth -= nItalic;
+/*M*/ }
+/*M*/
+/*M*/ // first check if everything fits to line
+/*M*/ if ( long ( nLineWidth ) * 2 > long ( nMaxLen ) * nPorHeight )
+/*M*/ {
+/*M*/ // call GetTxtSize with maximum compression (for kanas)
+/*M*/ rInf.GetTxtSize( &rSI, rInf.GetIdx(), nMaxLen,
+/*M*/ nMaxComp, nMinSize, nMaxSizeDiff );
+/*M*/
+/*M*/ nBreakWidth = nMinSize;
+/*M*/
+/*M*/ if ( nBreakWidth <= nLineWidth )
+/*M*/ {
+/*M*/ // portion fits to line
+/*M*/ nCutPos = rInf.GetIdx() + nMaxLen - 1;
+/*M*/ if( nItalic && ( nCutPos + 1 ) >= rInf.GetTxt().Len() )
+/*M*/ nBreakWidth += nItalic;
+/*M*/
+/*M*/ // save maximum width for later use
+/*M*/ if ( nMaxSizeDiff )
+/*M*/ rInf.SetMaxWidthDiff( (ULONG)&rPor, nMaxSizeDiff );
+/*M*/
+/*M*/ return sal_True;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ sal_Bool bHyph = rInf.IsHyphenate() && !rInf.IsHyphForbud();
+/*M*/ xub_StrLen nHyphPos = 0;
+/*M*/
+/*M*/ // nCutPos is the first character not fitting to the current line
+/*M*/ // nHyphPos is the first character not fitting to the current line,
+/*M*/ // considering an additional "-" for hyphenation
+/*M*/ if( bHyph )
+/*M*/ {
+/*M*/ nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp, nHyphPos );
+/*M*/
+/*M*/ if ( !nHyphPos && rInf.GetIdx() )
+/*M*/ nHyphPos = rInf.GetIdx() - 1;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp );
+/*M*/
+/*M*/ #ifdef DBG_UTIL
+/*M*/ if ( STRING_LEN != nCutPos )
+/*M*/ {
+/*M*/ rInf.GetTxtSize( &rSI, rInf.GetIdx(), nCutPos - rInf.GetIdx(),
+/*M*/ nMaxComp, nMinSize, nMaxSizeDiff );
+/*M*/ ASSERT( nMinSize <= nLineWidth, "What a Guess!!!" );
+/*M*/ }
+/*M*/ #endif
+/*M*/ }
+/*M*/
+/*M*/ if( nCutPos > rInf.GetIdx() + nMaxLen )
+/*M*/ {
+/*M*/ // second check if everything fits to line
+/*M*/ nCutPos = nBreakPos = rInf.GetIdx() + nMaxLen - 1;
+/*M*/ rInf.GetTxtSize( &rSI, rInf.GetIdx(), nMaxLen, nMaxComp,
+/*M*/ nMinSize, nMaxSizeDiff );
+/*M*/
+/*M*/ nBreakWidth = nMinSize;
+/*M*/
+/*M*/ // Der folgende Vergleich sollte eigenlich immer sal_True ergeben, sonst
+/*M*/ // hat es wohl bei GetTxtBreak einen Pixel-Rundungsfehler gegeben...
+/*M*/ if ( nBreakWidth <= nLineWidth )
+/*M*/ {
+/*M*/ if( nItalic && ( nBreakPos + 1 ) >= rInf.GetTxt().Len() )
+/*M*/ nBreakWidth += nItalic;
+/*M*/
+/*M*/ // save maximum width for later use
+/*M*/ if ( nMaxSizeDiff )
+/*M*/ rInf.SetMaxWidthDiff( (ULONG)&rPor, nMaxSizeDiff );
+/*M*/
+/*M*/ return sal_True;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // we have to trigger an underflow for a footnote portion
+/*M*/ // which does not fit to the current line
+/*M*/ if ( rPor.IsFtnPortion() )
+/*M*/ {
+/*M*/ nBreakPos = rInf.GetIdx();
+/*M*/ nCutPos = rInf.GetLen();
+/*M*/ return sal_False;
+/*M*/ }
+/*M*/
+/*M*/ xub_StrLen nPorLen = 0;
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ // do not call the break iterator nCutPos is a blank
+/*M*/ xub_Unicode cCutChar = rInf.GetTxt().GetChar( nCutPos );
+/*M*/ if( CH_BLANK == cCutChar || CH_FULL_BLANK == cCutChar )
+/*M*/ #else
+/*M*/ if( CH_BLANK == rInf.GetTxt().GetChar( nCutPos ) )
+/*M*/ #endif
+/*M*/ {
+/*M*/ nBreakPos = nCutPos;
+/*M*/ xub_StrLen nX = nBreakPos;
+/*M*/
+/*M*/ // we step back until a non blank character has been found
+/*M*/ // or there is only one more character left
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ while( nX && nBreakPos > rInf.GetLineStart() + 1 &&
+/*M*/ ( CH_BLANK == ( cCutChar = rInf.GetChar( --nX ) ) ||
+/*M*/ CH_FULL_BLANK == cCutChar ) )
+/*M*/ --nBreakPos;
+/*M*/ #else
+/*M*/ while( nX && nBreakPos > rInf.GetLineStart() + 1 &&
+/*M*/ CH_BLANK == rInf.GetChar( --nX ) )
+/*M*/ --nBreakPos;
+/*M*/ #endif
+/*M*/
+/*M*/ if( nBreakPos > rInf.GetIdx() )
+/*M*/ nPorLen = nBreakPos - rInf.GetIdx();
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ while( ++nCutPos < rInf.GetTxt().Len() &&
+/*M*/ ( CH_BLANK == ( cCutChar = rInf.GetChar( nCutPos ) ) ||
+/*M*/ CH_FULL_BLANK == cCutChar ) )
+/*M*/ ; // nothing
+/*M*/ #else
+/*M*/ while( ++nCutPos < rInf.GetTxt().Len() &&
+/*M*/ CH_BLANK == rInf.GetChar( nCutPos ) )
+/*M*/ ; // nothing
+/*M*/ #endif
+/*M*/
+/*M*/ nBreakStart = nCutPos;
+/*M*/ }
+/*M*/ else if( pBreakIt->xBreak.is() )
+/*M*/ {
+/*M*/ // New: We should have a look into the last portion, if it was a
+/*M*/ // field portion. For this, we expand the text of the field portion
+/*M*/ // into our string. If the line break position is inside of before
+/*M*/ // the field portion, we trigger an underflow.
+/*M*/
+/*M*/ xub_StrLen nOldIdx = rInf.GetIdx();
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ xub_Unicode cFldChr = 0;
+/*M*/ #else
+/*M*/ sal_Char cFldChr = 0;
+/*M*/ #endif
+/*M*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ XubString aDebugString;
+/*M*/ #endif
+/*M*/
+/*M*/ // be careful: a field portion can be both: 0x01 (common field)
+/*M*/ // or 0x02 (the follow of a footnode)
+/*M*/ if ( rInf.GetLast() && rInf.GetLast()->InFldGrp() &&
+/*M*/ ! rInf.GetLast()->IsFtnPortion() &&
+/*M*/ rInf.GetIdx() > rInf.GetLineStart() &&
+/*M*/ CH_TXTATR_BREAKWORD ==
+/*M*/ ( cFldChr = rInf.GetTxt().GetChar( rInf.GetIdx() - 1 ) ) )
+/*M*/ {
+/*M*/ SwFldPortion* pFld = (SwFldPortion*)rInf.GetLast();
+/*M*/ XubString aTxt;
+/*M*/ pFld->GetExpTxt( rInf, aTxt );
+/*M*/
+/*M*/ if ( aTxt.Len() )
+/*M*/ {
+/*M*/ nFieldDiff = aTxt.Len() - 1;
+/*M*/ nCutPos += nFieldDiff;
+/*M*/ nHyphPos += nFieldDiff;
+/*M*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ aDebugString = rInf.GetTxt();
+/*M*/ #endif
+/*M*/
+/*M*/ XubString& rOldTxt = (XubString&)rInf.GetTxt();
+/*M*/ rOldTxt.Erase( rInf.GetIdx() - 1, 1 );
+/*M*/ rOldTxt.Insert( aTxt, rInf.GetIdx() - 1 );
+/*M*/ rInf.SetIdx( rInf.GetIdx() + nFieldDiff );
+/*M*/ }
+/*M*/ else
+/*M*/ cFldChr = 0;
+/*M*/ }
+/*M*/
+/*M*/ LineBreakHyphenationOptions aHyphOpt;
+/*M*/ Reference< XHyphenator > xHyph;
+/*M*/ if( bHyph )
+/*M*/ {
+/*M*/ xHyph = ::binfilter::GetHyphenator();
+/*M*/ aHyphOpt = LineBreakHyphenationOptions( xHyph,
+/*M*/ rInf.GetHyphValues(), nHyphPos );
+/*M*/ }
+/*M*/
+/*N*/ // Get Language for break iterator.
+/*N*/ // We have to switch the current language if we have a script
+/*N*/ // change at nCutPos. Otherwise LATIN punctuation would never
+/*N*/ // be allowed to be hanging punctuation.
+/*N*/ // NEVER call GetLang if the string has been modified!!!
+/*N*/ LanguageType aLang = rInf.GetFont()->GetLanguage();
+/*N*/
+/*N*/ // If we are inside a field portion, we use a temporar string which
+/*N*/ // differs from the string at the textnode. Therefore we are not allowed
+/*N*/ // to call the GetLang function.
+/*N*/ if ( nCutPos && ! rPor.InFldGrp() )
+/*N*/ {
+/*N*/ const CharClass& rCC = GetAppCharClass();
+/*N*/
+/*N*/ // step back until a non-punctuation character is reached
+/*N*/ xub_StrLen nLangIndex = nCutPos;
+/*N*/
+/*N*/ // If a field has been expanded right in front of us we do not
+/*N*/ // step further than the beginning of the expanded field
+/*N*/ // (which is the position of the field placeholder in our
+/*N*/ // original string).
+/*N*/ const xub_StrLen nDoNotStepOver = CH_TXTATR_BREAKWORD == cFldChr ?
+/*N*/ rInf.GetIdx() - nFieldDiff - 1:
+/*N*/ 0;
+/*N*/
+/*N*/ while ( nLangIndex > nDoNotStepOver &&
+/*N*/ ! rCC.isLetterNumeric( rInf.GetTxt(), nLangIndex ) )
+/*N*/ --nLangIndex;
+/*N*/
+/*N*/ // last "real" character is not inside our current portion
+/*N*/ // we have to check the script type of the last "real" character
+/*N*/ if ( nLangIndex < rInf.GetIdx() )
+/*N*/ {
+/*N*/ USHORT nScript = pBreakIt->GetRealScriptOfText( rInf.GetTxt(),
+/*N*/ nLangIndex );
+/*N*/ ASSERT( nScript, "Script is not between 1 and 4" );
+/*N*/
+/*N*/ // compare current script with script from last "real" character
+/*N*/ if ( nScript - 1 != rInf.GetFont()->GetActual() )
+/*N*/ aLang = rInf.GetTxtFrm()->GetTxtNode()->GetLang(
+/*N*/ CH_TXTATR_BREAKWORD == cFldChr ?
+/*N*/ nDoNotStepOver :
+/*N*/ nLangIndex, 0, nScript );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*M*/ const ForbiddenCharacters aForbidden(
+/*M*/ *rInf.GetTxtFrm()->GetNode()->GetDoc()->
+/*M*/ GetForbiddenCharacters( aLang, TRUE ));
+/*M*/
+/*M*/ const sal_Bool bAllowHanging = rInf.IsHanging() && ! rInf.IsMulti() &&
+/*M*/ ! rPor.InFldGrp();
+/*M*/
+/*M*/ LineBreakUserOptions aUserOpt(
+/*M*/ aForbidden.beginLine, aForbidden.endLine,
+/*M*/ rInf.HasForbiddenChars(), bAllowHanging, sal_False );
+/*M*/
+/*M*/ // !!! We must have a local copy of the locale, because inside
+/*M*/ // getLineBreak the LinguEventListener can trigger a new formatting,
+/*M*/ // which can corrupt the locale pointer inside pBreakIt.
+/*M*/ const ::com::sun::star::lang::Locale aLocale = pBreakIt->GetLocale( aLang );
+/*M*/
+/*M*/ // determines first possible line break from nRightPos to
+/*M*/ // start index of current line
+/*M*/ LineBreakResults aResult = pBreakIt->xBreak->getLineBreak(
+/*M*/ rInf.GetTxt(), nCutPos, aLocale,
+/*M*/ rInf.GetLineStart(), aHyphOpt, aUserOpt );
+/*M*/
+/*M*/ nBreakPos = (xub_StrLen)aResult.breakIndex;
+/*M*/
+/*M*/ // if we are formatting multi portions we want to allow line breaks
+/*M*/ // at the border between single line and multi line portion
+/*M*/ // we have to be carefull with footnote portions, they always come in
+/*M*/ // with an index 0
+/*M*/ if ( nBreakPos < rInf.GetLineStart() && rInf.IsFirstMulti() &&
+/*M*/ ! rInf.IsFtnInside() )
+/*M*/ nBreakPos = rInf.GetLineStart();
+/*M*/
+/*M*/ nBreakStart = nBreakPos;
+/*M*/
+/*M*/ bHyph = BreakType::HYPHENATION == aResult.breakType;
+/*M*/
+/*M*/ if ( bHyph && nBreakPos != STRING_LEN)
+/*M*/ {
+/*M*/ // found hyphenation position within line
+/*M*/ // nBreakPos is set to the hyphenation position
+/*M*/ xHyphWord = aResult.rHyphenatedWord;
+/*M*/ nBreakPos += xHyphWord->getHyphenationPos() + 1;
+/*M*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ // e.g., Schif-fahrt, referes to our string
+/*M*/ const String aWord = xHyphWord->getWord();
+/*M*/ // e.g., Schiff-fahrt, referes to the word after hyphenation
+/*M*/ const String aHyphenatedWord = xHyphWord->getHyphenatedWord();
+/*M*/ // e.g., Schif-fahrt: 5, referes to our string
+/*M*/ const USHORT nHyphenationPos = xHyphWord->getHyphenationPos();
+/*M*/ // e.g., Schiff-fahrt: 6, referes to the word after hyphenation
+/*M*/ const USHORT nHyphenPos = xHyphWord->getHyphenPos();
+/*M*/ #endif
+/*M*/
+/*M*/ // if not in interactive mode, we have to break behind a soft hyphen
+/*M*/ if ( ! rInf.IsInterHyph() && rInf.GetIdx() )
+/*M*/ {
+/*M*/ const long nSoftHyphPos =
+/*M*/ xHyphWord->getWord().indexOf( CHAR_SOFTHYPHEN );
+/*M*/
+/*M*/ if ( nSoftHyphPos >= 0 &&
+/*M*/ nBreakStart + nSoftHyphPos <= nBreakPos &&
+/*M*/ nBreakPos > rInf.GetLineStart() )
+/*M*/ nBreakPos = rInf.GetIdx() - 1;
+/*M*/ }
+/*M*/
+/*M*/ if( nBreakPos >= rInf.GetIdx() )
+/*M*/ {
+/*M*/ nPorLen = nBreakPos - rInf.GetIdx();
+/*M*/ if( '-' == rInf.GetTxt().GetChar( nBreakPos - 1 ) )
+/*M*/ xHyphWord = NULL;
+/*M*/ }
+/*M*/ }
+/*M*/ else if ( !bHyph && nBreakPos >= rInf.GetLineStart() )
+/*M*/ {
+/*M*/ ASSERT( nBreakPos != STRING_LEN, "we should have found a break pos" );
+/*M*/
+/*M*/ // found break position within line
+/*M*/ xHyphWord = NULL;
+/*M*/
+/*M*/ // check, if break position is soft hyphen and an underflow
+/*M*/ // has to be triggered
+/*M*/ if( nBreakPos > rInf.GetLineStart() && rInf.GetIdx() &&
+/*M*/ CHAR_SOFTHYPHEN == rInf.GetTxt().GetChar( nBreakPos - 1 ) )
+/*M*/ nBreakPos = rInf.GetIdx() - 1;
+/*M*/
+/*M*/ // Delete any blanks at the end of a line, but be careful:
+/*M*/ // If a field has been expanded, we do not want to delete any
+/*M*/ // blanks inside the field portion. This would cause an unwanted
+/*M*/ // underflow
+/*M*/ xub_StrLen nX = nBreakPos;
+/*M*/ #ifdef VERTICAL_LAYOUT
+/*M*/ while( nX > rInf.GetLineStart() &&
+/*M*/ ( CH_TXTATR_BREAKWORD != cFldChr || nX > rInf.GetIdx() ) &&
+/*M*/ ( CH_BLANK == rInf.GetChar( --nX ) ||
+/*M*/ CH_FULL_BLANK == rInf.GetChar( nX ) ) )
+/*M*/ nBreakPos = nX;
+/*M*/ #else
+/*M*/ while( nX > rInf.GetLineStart() &&
+/*M*/ ( CH_TXTATR_BREAKWORD != cFldChr || nX > rInf.GetIdx() ) &&
+/*M*/ CH_BLANK == rInf.GetChar(--nX) )
+/*M*/ nBreakPos = nX;
+/*M*/ #endif
+/*M*/ if( nBreakPos > rInf.GetIdx() )
+/*M*/ nPorLen = nBreakPos - rInf.GetIdx();
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ // no line break found, setting nBreakPos to STRING_LEN
+/*M*/ // causes a break cut
+/*M*/ nBreakPos = STRING_LEN;
+/*M*/ ASSERT( nCutPos >= rInf.GetIdx(), "Deep cut" );
+/*M*/ nPorLen = nCutPos - rInf.GetIdx();
+/*M*/ }
+/*M*/
+/*M*/ if( nBreakPos > nCutPos && nBreakPos != STRING_LEN )
+/*M*/ {
+/*M*/ const xub_StrLen nHangingLen = nBreakPos - nCutPos;
+/*M*/ SwPosSize aTmpSize = rInf.GetTxtSize( &rSI, nCutPos,
+/*M*/ nHangingLen, 0 );
+/*M*/ ASSERT( !pHanging, "A hanging portion is hanging around" );
+/*M*/ pHanging = new SwHangingPortion( aTmpSize );
+/*M*/ pHanging->SetLen( nHangingLen );
+/*M*/ nPorLen = nCutPos - rInf.GetIdx();
+/*M*/ }
+/*M*/
+/*M*/ // If we expanded a field, we must repair the original string.
+/*M*/ // In case we do not trigger an underflow, we correct the nBreakPos
+/*M*/ // value, but we cannot correct the nBreakStart value:
+/*M*/ // If we have found a hyphenation position, nBreakStart can lie before
+/*M*/ // the field.
+/*M*/ if ( CH_TXTATR_BREAKWORD == cFldChr )
+/*M*/ {
+/*M*/ if ( nBreakPos < rInf.GetIdx() )
+/*M*/ nBreakPos = nOldIdx - 1;
+/*M*/ else if ( STRING_LEN != nBreakPos )
+/*M*/ {
+/*M*/ ASSERT( nBreakPos >= nFieldDiff, "I've got field trouble!" );
+/*M*/ nBreakPos -= nFieldDiff;
+/*M*/ }
+/*M*/
+/*M*/ ASSERT( nCutPos >= rInf.GetIdx() && nCutPos >= nFieldDiff,
+/*M*/ "I've got field trouble, part2!" );
+/*M*/ nCutPos -= nFieldDiff;
+/*M*/
+/*M*/ XubString& rOldTxt = (XubString&)rInf.GetTxt();
+/*M*/ rOldTxt.Erase( nOldIdx - 1, nFieldDiff + 1 );
+/*M*/ rOldTxt.Insert( cFldChr, nOldIdx - 1 );
+/*M*/ rInf.SetIdx( nOldIdx );
+/*M*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ ASSERT( aDebugString == rInf.GetTxt(),
+/*M*/ "Somebody, somebody, somebody put something in my string" );
+/*M*/ #endif
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if( nPorLen )
+/*M*/ {
+/*M*/ rInf.GetTxtSize( &rSI, rInf.GetIdx(), nPorLen,
+/*M*/ nMaxComp, nMinSize, nMaxSizeDiff );
+/*M*/
+/*M*/ // save maximum width for later use
+/*M*/ if ( nMaxSizeDiff )
+/*M*/ rInf.SetMaxWidthDiff( (ULONG)&rPor, nMaxSizeDiff );
+/*M*/
+/*M*/ nBreakWidth = nItalic + nMinSize;
+/*M*/ }
+/*M*/ else
+/*M*/ nBreakWidth = 0;
+/*M*/
+/*M*/ if( pHanging )
+/*M*/ nBreakPos = nCutPos;
+/*M*/
+/*M*/ return sal_False;
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtGuess::AlternativeSpelling
+ *************************************************************************/
+
+// returns true if word at position nPos has a diffenrent spelling
+// if hyphenated at this position (old german spelling)
+
+/*N*/ sal_Bool SwTxtGuess::AlternativeSpelling( const SwTxtFormatInfo &rInf,
+/*N*/ const xub_StrLen nPos )
+/*N*/ {
+/*N*/ // get word boundaries
+/*N*/ xub_StrLen nWordLen;
+/*N*/
+/*N*/ Boundary aBound =
+/*N*/ pBreakIt->xBreak->getWordBoundary( rInf.GetTxt(), nPos,
+/*N*/ pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
+/*N*/ WordType::DICTIONARY_WORD, sal_True );
+/*N*/ nBreakStart = (xub_StrLen)aBound.startPos;
+/*N*/ nWordLen = aBound.endPos - nBreakStart;
+/*N*/
+/*N*/ // if everything else fails, we want to cut at nPos
+/*N*/ nCutPos = nPos;
+/*N*/
+/*N*/ XubString aTxt( rInf.GetTxt().Copy( nBreakStart, nWordLen ) );
+/*N*/
+/*N*/ // check, if word has alternative spelling
+/*N*/ Reference< XHyphenator > xHyph( ::binfilter::GetHyphenator() );
+/*N*/ ASSERT( xHyph.is(), "Hyphenator is missing");
+/*N*/ //! subtract 1 since the UNO-interface is 0 based
+/*N*/ xHyphWord = xHyph->queryAlternativeSpelling( OUString(aTxt),
+/*N*/ pBreakIt->GetLocale( rInf.GetFont()->GetLanguage() ),
+/*N*/ nPos - nBreakStart, rInf.GetHyphValues() );
+/*N*/ return xHyphWord.is() && xHyphWord->isAlternativeSpelling();
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_inftxt.cxx b/binfilter/bf_sw/source/core/text/sw_inftxt.cxx
new file mode 100644
index 000000000000..a721a47c7da5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_inftxt.cxx
@@ -0,0 +1,1029 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/uno/Sequence.h>
+
+#include <bf_svtools/linguprops.hxx>
+
+#include <hintids.hxx>
+
+#include <bf_svtools/ctloptions.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <bf_svx/hyznitem.hxx>
+#include <bf_svx/hngpnctitem.hxx>
+#include <bf_svx/scriptspaceitem.hxx>
+#include <bf_svx/pgrditem.hxx>
+#include <breakit.hxx>
+#include <bf_svx/forbiddenruleitem.hxx>
+#include <swmodule.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <tools/shl.hxx>
+#include <viewsh.hxx> // ViewShell
+
+#include <horiornt.hxx>
+
+#include <doc.hxx> // SwDoc
+#include <paratr.hxx> // SwFmtDrop
+#include <inftxt.hxx> // SwTxtInfo
+#include <noteurl.hxx> // SwNoteURL
+#include <porftn.hxx> // SwFtnPortion
+#include <frmsh.hxx>
+#include <itratr.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+#define CHAR_UNDERSCORE ((sal_Unicode)0x005F)
+#define CHAR_LEFT_ARROW ((sal_Unicode)0x25C0)
+#define CHAR_RIGHT_ARROW ((sal_Unicode)0x25B6)
+#define CHAR_TAB ((sal_Unicode)0x2192)
+#define CHAR_TAB_RTL ((sal_Unicode)0x2190)
+#define CHAR_LINEBREAK ((sal_Unicode)0x21B5)
+#define CHAR_LINEBREAK_RTL ((sal_Unicode)0x21B3)
+
+#ifdef BIDI
+#define DRAW_SPECIAL_OPTIONS_CENTER 1
+#define DRAW_SPECIAL_OPTIONS_ROTATE 2
+#endif
+
+// steht im number.cxx
+extern const sal_Char __FAR_DATA sBulletFntName[];
+
+// OD 24.01.2003 #106593# - no longer needed, included in <frmtool.hxx>
+//extern void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh );
+
+#ifdef DBG_UTIL
+// Test2: WYSIWYG++
+// Test4: WYSIWYG debug
+static sal_Bool bDbgLow = sal_False;
+#endif
+
+#ifdef DBG_UTIL
+
+
+#endif
+
+/*************************************************************************
+ * SwLineInfo::SwLineInfo()
+ *************************************************************************/
+
+/*N*/ void SwLineInfo::CtorInit( const SwAttrSet& rAttrSet )
+/*N*/ {
+/*N*/ pRuler = &rAttrSet.GetTabStops();
+/*N*/ pSpace = &rAttrSet.GetLineSpacing();
+/*N*/ nVertAlign = rAttrSet.GetParaVertAlign().GetValue();
+/*N*/ nDefTabStop = MSHRT_MAX;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtInfo::CtorInit()
+ *************************************************************************/
+
+/*N*/ void SwTxtInfo::CtorInit( SwTxtFrm *pFrm )
+/*N*/ {
+/*N*/ pPara = pFrm->GetPara();
+/*N*/ nTxtStart = pFrm->GetOfst();
+/*N*/ if( !pPara )
+/*N*/ {
+/*?*/ ASSERT( pPara, "+SwTxtInfo::CTOR: missing paragraph information" );
+/*?*/ pFrm->Format();
+/*?*/ pPara = pFrm->GetPara();
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwTxtInfo::SwTxtInfo( const SwTxtInfo &rInf )
+/*N*/ : pPara( ((SwTxtInfo&)rInf).GetParaPortion() ),
+/*N*/ nTxtStart( rInf.GetTxtStart() )
+/*N*/ { }
+
+
+#ifdef DBG_UTIL
+/*************************************************************************
+ * ChkOutDev()
+ *************************************************************************/
+
+/*N*/ void ChkOutDev( const SwTxtSizeInfo &rInf )
+/*N*/ {
+/*N*/ if ( !rInf.GetVsh() )
+/*N*/ return;
+/*N*/
+/*N*/ const OutputDevice *pOut = rInf.GetOut();
+/*N*/ const OutputDevice *pWin = rInf.GetVsh()->GetWin();
+/*N*/ const OutputDevice *pRef = rInf.GetRefDev();
+/*N*/ ASSERT( pOut && pRef, "ChkOutDev: invalid output devices" )
+/*N*/ }
+/*N*/ #endif // PRODUCT
+
+
+/*N*/ inline xub_StrLen GetMinLen( const SwTxtSizeInfo &rInf )
+/*N*/ {
+/*N*/ const xub_StrLen nInfLen = rInf.GetIdx() + rInf.GetLen();
+/*N*/ return Min( rInf.GetTxt().Len(), nInfLen );
+/*N*/ }
+
+
+/*N*/ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew )
+/*N*/ : SwTxtInfo( rNew ),
+/*N*/ pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()),
+/*N*/ pVsh(((SwTxtSizeInfo&)rNew).GetVsh()),
+/*N*/ pOut(((SwTxtSizeInfo&)rNew).GetOut()),
+/*N*/ pRef(((SwTxtSizeInfo&)rNew).GetRefDev()),
+/*N*/ pFnt(((SwTxtSizeInfo&)rNew).GetFont()),
+/*N*/ pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()),
+/*N*/ pFrm(rNew.pFrm),
+/*N*/ pOpt(&rNew.GetOpt()),
+/*N*/ pTxt(&rNew.GetTxt()),
+/*N*/ nIdx(rNew.GetIdx()),
+/*N*/ nLen(rNew.GetLen()),
+/*N*/ nKanaIdx( rNew.GetKanaIdx() ),
+/*N*/ bOnWin( rNew.OnWin() ),
+/*N*/ bNotEOL( rNew.NotEOL() ),
+/*N*/ bURLNotify( rNew.URLNotify() ),
+/*N*/ bStopUnderFlow( rNew.StopUnderFlow() ),
+/*N*/ bFtnInside( rNew.IsFtnInside() ),
+/*N*/ bMulti( rNew.IsMulti() ),
+/*N*/ bFirstMulti( rNew.IsFirstMulti() ),
+/*N*/ bRuby( rNew.IsRuby() ),
+/*N*/ bHanging( rNew.IsHanging() ),
+/*N*/ bScriptSpace( rNew.HasScriptSpace() ),
+/*N*/ bForbiddenChars( rNew.HasForbiddenChars() ),
+/*N*/ bSnapToGrid( rNew.SnapToGrid() ),
+/*N*/ nDirection( rNew.GetDirection() )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ChkOutDev( *this );
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ void SwTxtSizeInfo::CtorInit( SwTxtFrm *pFrame, SwFont *pNewFnt,
+/*N*/ const xub_StrLen nNewIdx, const xub_StrLen nNewLen )
+/*N*/ {
+/*N*/ pKanaComp = NULL;
+/*N*/ nKanaIdx = 0;
+/*N*/ pFrm = pFrame;
+/*N*/ SwTxtInfo::CtorInit( pFrm );
+/*N*/ const SwTxtNode *pNd = pFrm->GetTxtNode();
+/*N*/ pVsh = pFrm->GetShell();
+/*N*/
+/*N*/ // Get the output and reference device
+/*N*/ if ( pVsh )
+/*N*/ {
+/*N*/ pOut = pVsh->GetOut();
+/*N*/ pRef = &pVsh->GetRefDev();
+/*N*/ bOnWin = pVsh->GetWin() || OUTDEV_WINDOW == pOut->GetOutDevType();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //Zugriff ueber StarONE, es muss keine Shell existieren oder aktiv sein.
+/*N*/ if ( pNd->GetDoc()->IsBrowseMode() ) //?!?!?!?
+/*N*/ //in Ermangelung eines Besseren kann hier ja wohl nur noch das
+/*N*/ //AppWin genommen werden?
+/*N*/ pOut = GetpApp()->GetDefaultDevice();
+/*N*/ else
+/*N*/ pOut = pNd->GetDoc()->GetPrt(); //Muss es geben (oder sal_True uebergeben?)
+/*N*/ pRef = pOut;
+/*N*/ }
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ChkOutDev( *this );
+/*N*/ #endif
+/*N*/
+/*N*/ // Set default layout mode ( LTR or RTL ).
+/*N*/ if ( pFrm->IsRightToLeft() )
+/*N*/ {
+/*N*/ pOut->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_BIDI_RTL );
+/*N*/ pRef->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG | TEXT_LAYOUT_BIDI_RTL );
+/*N*/ nDirection = DIR_RIGHT2LEFT;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pOut->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG );
+/*N*/ pRef->SetLayoutMode( TEXT_LAYOUT_BIDI_STRONG );
+/*N*/ nDirection = DIR_LEFT2RIGHT;
+/*N*/ }
+/*N*/
+/*N*/ LanguageType eLang;
+/*N*/ const SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
+/*N*/ if ( SvtCTLOptions::NUMERALS_HINDI == rCTLOptions.GetCTLTextNumerals() )
+/*N*/ eLang = LANGUAGE_ARABIC_SAUDI_ARABIA;
+/*N*/ else if ( SvtCTLOptions::NUMERALS_ARABIC == rCTLOptions.GetCTLTextNumerals() )
+/*N*/ eLang = LANGUAGE_ENGLISH;
+/*N*/ else
+/*N*/ eLang = (LanguageType)::binfilter::GetAppLanguage();
+/*N*/
+/*N*/ pOut->SetDigitLanguage( eLang );
+/*N*/ pRef->SetDigitLanguage( eLang );
+/*N*/
+/*N*/ //
+/*N*/ // The Options
+/*N*/ //
+/*N*/ pOpt = pVsh ?
+/*N*/ pVsh->GetViewOptions() :
+/*N*/ SW_MOD()->GetViewOption(pNd->GetDoc()->IsHTMLMode()); //Options vom Module wg. StarONE
+/*N*/
+/*N*/ // bURLNotify wird gesetzt, wenn MakeGraphic dies vorbereitet
+/*N*/ // TODO: Aufdröseln
+/*N*/ bURLNotify = pNoteURL && !bOnWin;
+/*N*/ // bURLNotify = pNoteURL && !bOnWin
+/*N*/ // && (pOut && OUTDEV_PRINTER != pOut->GetOutDevType());
+/*N*/
+/*N*/ SetSnapToGrid( pNd->GetSwAttrSet().GetParaGrid().GetValue() &&
+/*N*/ pFrm->IsInDocBody() );
+/*N*/
+/*N*/ pFnt = pNewFnt;
+/*N*/ pUnderFnt = 0;
+/*N*/ pTxt = &pNd->GetTxt();
+/*N*/
+/*N*/ nIdx = nNewIdx;
+/*N*/ nLen = nNewLen;
+/*N*/ bNotEOL = sal_False;
+/*N*/ bStopUnderFlow = bFtnInside = sal_False;
+/*N*/ bMulti = bFirstMulti = bRuby = bHanging = bScriptSpace =
+/*N*/ bForbiddenChars = sal_False;
+/*N*/ #ifndef BIDI
+/*N*/ nDirection = DIR_LEFT2RIGHT;
+/*N*/ #endif
+/*N*/
+/*N*/ SetLen( GetMinLen( *this ) );
+/*N*/ }
+
+/*N*/ SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const XubString &rTxt,
+/*N*/ const xub_StrLen nIdx, const xub_StrLen nLen )
+/*N*/ : SwTxtInfo( rNew ),
+/*N*/ pKanaComp(((SwTxtSizeInfo&)rNew).GetpKanaComp()),
+/*N*/ pVsh(((SwTxtSizeInfo&)rNew).GetVsh()),
+/*N*/ pOut(((SwTxtSizeInfo&)rNew).GetOut()),
+/*N*/ pRef(((SwTxtSizeInfo&)rNew).GetRefDev()),
+/*N*/ pFnt(((SwTxtSizeInfo&)rNew).GetFont()),
+/*N*/ pUnderFnt(((SwTxtSizeInfo&)rNew).GetUnderFnt()),
+/*N*/ pFrm( rNew.pFrm ),
+/*N*/ pOpt(&rNew.GetOpt()),
+/*N*/ pTxt(&rTxt),
+/*N*/ nIdx(nIdx),
+/*N*/ nLen(nLen),
+/*N*/ nKanaIdx( rNew.GetKanaIdx() ),
+/*N*/ bOnWin( rNew.OnWin() ),
+/*N*/ bNotEOL( rNew.NotEOL() ),
+/*N*/ bURLNotify( rNew.URLNotify() ),
+/*N*/ bStopUnderFlow( rNew.StopUnderFlow() ),
+/*N*/ bFtnInside( rNew.IsFtnInside() ),
+/*N*/ bMulti( rNew.IsMulti() ),
+/*N*/ bFirstMulti( rNew.IsFirstMulti() ),
+/*N*/ bRuby( rNew.IsRuby() ),
+/*N*/ bHanging( rNew.IsHanging() ),
+/*N*/ bScriptSpace( rNew.HasScriptSpace() ),
+/*N*/ bForbiddenChars( rNew.HasForbiddenChars() ),
+/*N*/ bSnapToGrid( rNew.SnapToGrid() ),
+/*N*/ nDirection( rNew.GetDirection() )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ChkOutDev( *this );
+/*N*/ #endif
+/*N*/ SetLen( GetMinLen( *this ) );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSizeInfo::SelectFont()
+ *************************************************************************/
+
+/*N*/ void SwTxtSizeInfo::SelectFont()
+/*N*/ {
+/*N*/ // 8731: Der Weg muss ueber ChgPhysFnt gehen, sonst geraet
+/*N*/ // der FontMetricCache durcheinander. In diesem Fall steht pLastMet
+/*N*/ // auf dem alten Wert.
+/*N*/ // Falsch: GetOut()->SetFont( GetFont()->GetFnt() );
+/*N*/ GetFont()->Invalidate();
+/*N*/ GetFont()->ChgPhysFnt( pVsh, GetOut() );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSizeInfo::NoteAnimation()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtSizeInfo::GetTxtSize()
+ *************************************************************************/
+
+/*N*/ SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev,
+/*N*/ const SwScriptInfo* pSI,
+/*N*/ const XubString& rTxt,
+/*N*/ const xub_StrLen nIdx,
+/*N*/ const xub_StrLen nLen,
+/*N*/ const USHORT nComp ) const
+/*N*/ {
+/*N*/ SwDrawTextInfo aDrawInf( pVsh, *pOutDev, pSI, rTxt, nIdx, nLen );
+/*N*/ aDrawInf.SetFrm( pFrm );
+/*N*/ aDrawInf.SetFont( pFnt );
+/*N*/ aDrawInf.SetSnapToGrid( SnapToGrid() );
+/*N*/ aDrawInf.SetKanaComp( nComp );
+/*N*/ SwPosSize aSize = pFnt->_GetTxtSize( aDrawInf );
+/*N*/ return aSize;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSizeInfo::GetTxtSize()
+ *************************************************************************/
+
+/*N*/ SwPosSize SwTxtSizeInfo::GetTxtSize() const
+/*N*/ {
+/*N*/ const SwScriptInfo& rSI =
+/*N*/ ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
+/*N*/
+/*N*/ // in some cases, compression is not allowed or surpressed for
+/*N*/ // performance reasons
+/*N*/ USHORT nComp =( SW_CJK == GetFont()->GetActual() &&
+/*N*/ rSI.CountCompChg() &&
+/*N*/ ! IsMulti() ) ?
+/*N*/ GetKanaComp() :
+/*N*/ 0 ;
+/*N*/
+/*N*/ SwDrawTextInfo aDrawInf( pVsh, *pOut, &rSI, *pTxt, nIdx, nLen );
+/*N*/ aDrawInf.SetFrm( pFrm );
+/*N*/ aDrawInf.SetFont( pFnt );
+/*N*/ aDrawInf.SetSnapToGrid( SnapToGrid() );
+/*N*/ aDrawInf.SetKanaComp( nComp );
+/*N*/ return pFnt->_GetTxtSize( aDrawInf );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSizeInfo::GetTxtSize()
+ *************************************************************************/
+
+/*N*/ void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const xub_StrLen nIdx,
+/*N*/ const xub_StrLen nLen, const USHORT nComp,
+/*N*/ USHORT& nMinSize, USHORT& nMaxSizeDiff ) const
+/*N*/ {
+/*N*/ SwDrawTextInfo aDrawInf( pVsh, *pOut, pSI, *pTxt, nIdx, nLen );
+/*N*/ aDrawInf.SetFrm( pFrm );
+/*N*/ aDrawInf.SetFont( pFnt );
+/*N*/ aDrawInf.SetSnapToGrid( SnapToGrid() );
+/*N*/ aDrawInf.SetKanaComp( nComp );
+/*N*/ SwPosSize aSize = pFnt->_GetTxtSize( aDrawInf );
+/*N*/ nMaxSizeDiff = (USHORT)aDrawInf.GetKanaDiff();
+/*N*/ nMinSize = aSize.Width();
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSizeInfo::GetTxtBreak()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtSizeInfo::GetTxtBreak()
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
+/*N*/ const xub_StrLen nMaxLen,
+/*N*/ const USHORT nComp ) const
+/*N*/ {
+/*N*/ const SwScriptInfo& rScriptInfo =
+/*N*/ ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
+/*N*/
+/*N*/ ASSERT( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" )
+/*N*/ SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo,
+/*N*/ *pTxt, GetIdx(), nMaxLen );
+/*N*/ aDrawInf.SetFrm( pFrm );
+/*N*/ aDrawInf.SetFont( pFnt );
+/*N*/ aDrawInf.SetSnapToGrid( SnapToGrid() );
+/*N*/ aDrawInf.SetKanaComp( nComp );
+/*N*/ aDrawInf.SetHyphPos( 0 );
+/*N*/
+/*N*/ return pFnt->GetTxtBreak( aDrawInf, nLineWidth );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSizeInfo::GetTxtBreak()
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
+/*N*/ const xub_StrLen nMaxLen,
+/*N*/ const USHORT nComp,
+/*N*/ xub_StrLen& rExtraCharPos ) const
+/*N*/ {
+/*N*/ const SwScriptInfo& rScriptInfo =
+/*N*/ ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
+/*N*/
+/*N*/ ASSERT( pRef == pOut, "GetTxtBreak is supposed to use the RefDev" )
+/*N*/ SwDrawTextInfo aDrawInf( pVsh, *pOut, &rScriptInfo,
+/*N*/ *pTxt, GetIdx(), nMaxLen );
+/*N*/ aDrawInf.SetFrm( pFrm );
+/*N*/ aDrawInf.SetFont( pFnt );
+/*N*/ aDrawInf.SetSnapToGrid( SnapToGrid() );
+/*N*/ aDrawInf.SetKanaComp( nComp );
+/*N*/ aDrawInf.SetHyphPos( &rExtraCharPos );
+/*N*/
+/*N*/ return pFnt->GetTxtBreak( aDrawInf, nLineWidth );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtPaintInfo::CtorInit()
+ *************************************************************************/
+
+/*N*/ void SwTxtPaintInfo::CtorInit( SwTxtFrm *pFrame, const SwRect &rPaint )
+/*N*/ {
+/*N*/ SwTxtSizeInfo::CtorInit( pFrame );
+/*N*/ aTxtFly.CtorInit( pFrame ),
+/*N*/ aPaintRect = rPaint;
+/*N*/ nSpaceIdx = 0;
+/*N*/ pSpaceAdd = NULL;
+/*N*/ pWrongList = NULL;
+/*N*/ #ifndef DBG_UTIL
+/*N*/ pBrushItem = 0;
+/*N*/ #else
+/*N*/ pBrushItem = ((SvxBrushItem*)-1);
+/*N*/ #endif
+/*N*/ }
+
+
+/*N*/ SwTxtPaintInfo::SwTxtPaintInfo( const SwTxtPaintInfo &rInf )
+/*N*/ : SwTxtSizeInfo( rInf ),
+/*N*/ aTxtFly( *rInf.GetTxtFly() ),
+/*N*/ aPos( rInf.GetPos() ),
+/*N*/ aPaintRect( rInf.GetPaintRect() ),
+/*N*/ nSpaceIdx( rInf.GetSpaceIdx() ),
+/*N*/ pSpaceAdd( rInf.GetpSpaceAdd() ),
+/*N*/ pWrongList( rInf.GetpWrongList() ),
+/*N*/ pBrushItem( rInf.GetBrushItem() )
+/*N*/ { }
+
+extern Color aGlobalRetoucheColor;
+
+/*************************************************************************
+ * lcl_IsDarkBackground
+ *
+ * Returns if the current background color is dark.
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::_DrawText()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * lcl_CalcRect()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * lcl_DrawSpecial
+ *
+ * Draws a special portion, e.g., line break portion, tab portion.
+ * rPor - The portion
+ * rRect - The rectangle surrounding the character
+ * pCol - Specify a color for the character
+ * bCenter - Draw the character centered, otherwise left aligned
+ * bRotate - Rotate the character if character rotation is set
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawRect()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawTab()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawLineBreak()
+ *************************************************************************/
+
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawRedArrow()
+ *************************************************************************/
+
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawPostIts()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawBackGround()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::DrawViewOpt()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtPaintInfo::_NotifyURL()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * lcl_InitHyphValues()
+ *************************************************************************/
+
+/*N*/ static void lcl_InitHyphValues( PropertyValues &rVals,
+/*N*/ INT16 nMinLeading, INT16 nMinTrailing )
+/*N*/ {
+/*N*/ INT32 nLen = rVals.getLength();
+/*N*/
+/*N*/ if (0 == nLen) // yet to be initialized?
+/*N*/ {
+/*N*/ rVals.realloc( 2 );
+/*N*/ PropertyValue *pVal = rVals.getArray();
+/*N*/
+/*N*/ pVal[0].Name = C2U( UPN_HYPH_MIN_LEADING );
+/*N*/ pVal[0].Handle = UPH_HYPH_MIN_LEADING;
+/*N*/ pVal[0].Value <<= nMinLeading;
+/*N*/
+/*N*/ pVal[1].Name = C2U( UPN_HYPH_MIN_TRAILING );
+/*N*/ pVal[1].Handle = UPH_HYPH_MIN_TRAILING;
+/*N*/ pVal[1].Value <<= nMinTrailing;
+/*N*/ }
+/*N*/ else if (2 == nLen) // already initialized once?
+/*N*/ {
+/*?*/ PropertyValue *pVal = rVals.getArray();
+/*?*/ pVal[0].Value <<= nMinLeading;
+/*?*/ pVal[1].Value <<= nMinTrailing;
+/*?*/ }
+/*?*/ else
+/*?*/ DBG_ERROR( "unxpected size of sequence" );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatInfo::GetHyphValues()
+ *************************************************************************/
+/*N*/
+/*N*/ const PropertyValues & SwTxtFormatInfo::GetHyphValues() const
+/*N*/ {
+/*N*/ DBG_ASSERT( 2 == aHyphVals.getLength(),
+/*N*/ "hyphenation values not yet initialized" );
+/*N*/ return aHyphVals;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatInfo::InitHyph()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFormatInfo::InitHyph( const sal_Bool bAutoHyph )
+/*N*/ {
+/*N*/ const SwAttrSet& rAttrSet = GetTxtFrm()->GetTxtNode()->GetSwAttrSet();
+/*N*/ SetHanging( rAttrSet.GetHangingPunctuation().GetValue() );
+/*N*/ SetScriptSpace( rAttrSet.GetScriptSpace().GetValue() );
+/*N*/ SetForbiddenChars( rAttrSet.GetForbiddenRule().GetValue() );
+/*N*/ const SvxHyphenZoneItem &rAttr = rAttrSet.GetHyphenZone();
+/*N*/ MaxHyph() = rAttr.GetMaxHyphens();
+/*N*/ sal_Bool bAuto = bAutoHyph || rAttr.IsHyphen();
+/*N*/ if( bAuto || bInterHyph )
+/*N*/ {
+/*N*/ nHyphStart = nHyphWrdStart = STRING_LEN;
+/*N*/ nHyphWrdLen = 0;
+/*N*/
+/*N*/ INT16 nMinLeading = Max(rAttr.GetMinLead(), sal_uInt8(2));
+/*N*/ INT16 nMinTrailing = rAttr.GetMinTrail();
+/*N*/ lcl_InitHyphValues( aHyphVals, nMinLeading, nMinTrailing);
+/*N*/ }
+/*N*/ return bAuto;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatInfo::CtorInit()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatInfo::CtorInit( SwTxtFrm *pNewFrm, const sal_Bool bNewInterHyph,
+/*N*/ const sal_Bool bNewQuick, const sal_Bool bTst )
+/*N*/ {
+/*N*/ SwTxtPaintInfo::CtorInit( pNewFrm, SwRect() );
+/*N*/
+/*N*/ bQuick = bNewQuick;
+/*N*/ bInterHyph = bNewInterHyph;
+/*N*/
+/*N*/ //! needs to be done in this order
+/*N*/ nMinLeading = 2;
+/*N*/ nMinTrailing = 2;
+/*N*/ nMinWordLength = 0;
+/*N*/ bAutoHyph = InitHyph();
+/*N*/
+/*N*/ bIgnoreFly = sal_False;
+/*N*/ bFakeLineStart = sal_False;
+/*N*/ bShift = sal_False;
+/*N*/ bDropInit = sal_False;
+/*N*/ bTestFormat = bTst;
+/*N*/ nLeft = 0;
+/*N*/ nRight = 0;
+/*N*/ nFirst = 0;
+/*N*/ nRealWidth = 0;
+/*N*/ nForcedLeftMargin = 0;
+/*N*/ pRest = 0;
+/*N*/ nLineHeight = 0;
+/*N*/ nLineNettoHeight = 0;
+/*N*/ SetLineStart(0);
+/*N*/ Init();
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatInfo::IsHyphenate()
+ *************************************************************************/
+// Trennen oder nicht trennen, das ist hier die Frage:
+// - in keinem Fall trennen, wenn der Hyphenator ERROR zurueckliefert,
+// oder wenn als Sprache NOLANGUAGE eingestellt ist.
+// - ansonsten immer trennen, wenn interaktive Trennung vorliegt
+// - wenn keine interakt. Trennung, dann nur trennen, wenn im ParaFmt
+// automatische Trennung eingestellt ist.
+
+/*N*/ sal_Bool SwTxtFormatInfo::IsHyphenate() const
+/*N*/ {
+/*N*/ if( !bInterHyph && !bAutoHyph )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ LanguageType eTmp = GetFont()->GetLanguage();
+/*N*/ if( LANGUAGE_DONTKNOW == eTmp || LANGUAGE_NONE == eTmp )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ uno::Reference< XHyphenator > xHyph = ::binfilter::GetHyphenator();
+/*N*/ if (bInterHyph && xHyph.is())
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SvxSpellWrapper::CheckHyphLang( xHyph, eTmp );
+/*N*/
+/*N*/ if( !xHyph.is() || !xHyph->hasLocale( pBreakIt->GetLocale(eTmp) ) )
+/*N*/ return sal_False;
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatInfo::GetDropFmt()
+ *************************************************************************/
+
+// Dropcaps vom SwTxtFormatter::CTOR gerufen.
+/*N*/ const SwFmtDrop *SwTxtFormatInfo::GetDropFmt() const
+/*N*/ {
+/*N*/ const SwFmtDrop *pDrop = &GetTxtFrm()->GetTxtNode()->GetSwAttrSet().GetDrop();
+/*N*/ if( 1 >= pDrop->GetLines() ||
+/*N*/ ( !pDrop->GetChars() && !pDrop->GetWholeWord() ) )
+/*N*/ pDrop = 0;
+/*N*/ return pDrop;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatInfo::Init()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatInfo::Init()
+/*N*/ {
+/*N*/ // Nicht initialisieren: pRest, nLeft, nRight, nFirst, nRealWidth
+/*N*/ X(0);
+/*N*/ bArrowDone = bFull = bFtnDone = bErgoDone = bNumDone = bNoEndHyph =
+/*N*/ bNoMidHyph = bStop = bNewLine = bUnderFlow = sal_False;
+/*N*/
+/*N*/ // generally we do not allow number portions in follows, except...
+/*N*/ if ( GetTxtFrm()->IsFollow() )
+/*N*/ {
+/*N*/ const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster();
+/*N*/ const SwLinePortion* pPara = pMaster->GetPara();
+/*N*/
+/*N*/ // there is a master for this follow and the master does not have
+/*N*/ // any contents (especially it does not have a number portion)
+/*N*/ bNumDone = ! pPara ||
+/*N*/ ! ((SwParaPortion*)pPara)->GetFirstPortion()->IsFlyPortion();
+/*N*/ }
+/*N*/
+/*N*/ pRoot = 0;
+/*N*/ pLast = 0;
+/*N*/ pFly = 0;
+/*N*/ pLastFld = 0;
+/*N*/ pLastTab = 0;
+/*N*/ pUnderFlow = 0;
+/*N*/ cTabDecimal = 0;
+/*N*/ nWidth = nRealWidth;
+/*N*/ nForcedLeftMargin = 0;
+/*N*/ nSoftHyphPos = 0;
+/*N*/ nUnderScorePos = STRING_LEN;
+/*N*/ cHookChar = 0;
+/*N*/ SetIdx(0);
+/*N*/ SetLen( GetTxt().Len() );
+/*N*/ SetPaintOfst(0);
+/*N*/ }
+
+/*-----------------16.10.00 11:39-------------------
+ * There are a few differences between a copy constructor
+ * and the following constructor for multi-line formatting.
+ * The root is the first line inside the multi-portion,
+ * the line start is the actual position in the text,
+ * the line width is the rest width from the surrounding line
+ * and the bMulti and bFirstMulti-flag has to be set correctly.
+ * --------------------------------------------------*/
+
+
+/*************************************************************************
+ * SwTxtFormatInfo::_CheckFtnPortion()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFormatInfo::_CheckFtnPortion( SwLineLayout* pCurr )
+/*N*/ {
+/*N*/ KSHORT nHeight = pCurr->GetRealHeight();
+/*N*/ SwLinePortion *pPor = pCurr->GetPortion();
+/*N*/ sal_Bool bRet = sal_False;
+/*N*/ while( pPor )
+/*N*/ {
+/*N*/ if( pPor->IsFtnPortion() && nHeight > ((SwFtnPortion*)pPor)->Orig() )
+/*N*/ {
+/*?*/ bRet = sal_True;
+/*?*/ SetLineHeight( nHeight );
+/*?*/ SetLineNettoHeight( pCurr->Height() );
+/*?*/ break;
+/*N*/ }
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+
+/*************************************************************************
+ * SwTxtFormatInfo::ScanPortionEnd()
+ *************************************************************************/
+/*N*/ xub_StrLen SwTxtFormatInfo::ScanPortionEnd( const xub_StrLen nStart,
+/*N*/ const xub_StrLen nEnd )
+/*N*/ {
+/*N*/ cHookChar = 0;
+/*N*/ const xub_Unicode cTabDec = GetLastTab() ? (sal_Unicode)GetTabDecimal() : 0;
+/*N*/ xub_StrLen i = nStart;
+/*N*/
+/*N*/ // Removed for i7288. bSkip used to be passed from SwFldPortion::Format
+/*N*/ // as IsFollow(). Therefore more than one special character was not
+/*N*/ // handled correctly at the beginning of follow fields.
+/*N*/ // if ( bSkip && i < nEnd )
+/*N*/ // ++i;
+/*N*/
+/*N*/ for( ; i < nEnd; ++i )
+/*N*/ {
+/*N*/ const xub_Unicode cPos = GetChar( i );
+/*N*/ switch( cPos )
+/*N*/ {
+/*N*/ case CH_TXTATR_BREAKWORD:
+/*N*/ case CH_TXTATR_INWORD:
+/*N*/ if( !HasHint( i ))
+/*N*/ break;
+/*N*/ // no break;
+/*N*/
+/*N*/ case CHAR_SOFTHYPHEN:
+/*N*/ case CHAR_HARDHYPHEN:
+/*N*/ case CHAR_HARDBLANK:
+/*N*/ case CH_TAB:
+/*N*/ case CH_BREAK:
+/*N*/ cHookChar = cPos;
+/*N*/ return i;
+/*N*/
+/*N*/ case CHAR_UNDERSCORE:
+/*N*/ if ( STRING_LEN == nUnderScorePos )
+/*N*/ nUnderScorePos = i;
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ if( cTabDec == cPos )
+/*N*/ {
+/*N*/ ASSERT( cPos, "Unexspected end of string" );
+/*N*/ if( cPos ) // robust
+/*N*/ {
+/*N*/ cHookChar = cPos;
+/*N*/ return i;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return i;
+/*N*/ }
+
+/*N*/ BOOL SwTxtFormatInfo::LastKernPortion()
+/*N*/ {
+/*N*/ if( GetLast() )
+/*N*/ {
+/*N*/ if( GetLast()->IsKernPortion() )
+/*N*/ return TRUE;
+/*N*/ if( GetLast()->Width() || ( GetLast()->GetLen() &&
+/*N*/ !GetLast()->IsHolePortion() ) )
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ SwLinePortion* pPor = GetRoot();
+/*N*/ SwLinePortion *pKern = NULL;
+/*N*/ while( pPor )
+/*N*/ {
+/*N*/ if( pPor->IsKernPortion() )
+/*N*/ pKern = pPor;
+/*N*/ else if( pPor->Width() || ( pPor->GetLen() && !pPor->IsHolePortion() ) )
+/*N*/ pKern = NULL;
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ if( pKern )
+/*N*/ {
+/*?*/ SetLast( pKern );
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+ * class SwTxtSlot
+ *************************************************************************/
+
+/*N*/ SwTxtSlot::SwTxtSlot( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor )
+/*N*/ {
+/*N*/ bOn = pPor->GetExpTxt( *pNew, aTxt );
+/*N*/
+/*N*/ // Der Text wird ausgetauscht...
+/*N*/ if( bOn )
+/*N*/ {
+/*N*/ pInf = (SwTxtSizeInfo*)pNew;
+/*N*/ nIdx = pInf->GetIdx();
+/*N*/ nLen = pInf->GetLen();
+/*N*/ pInf->SetLen( pPor->GetLen() );
+/*N*/ pOldTxt = &(pInf->GetTxt());
+/*N*/ pInf->SetTxt( aTxt );
+/*N*/ pInf->SetIdx( 0 );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSlot::~SwTxtSlot()
+ *************************************************************************/
+
+/*N*/ SwTxtSlot::~SwTxtSlot()
+/*N*/ {
+/*N*/ if( bOn )
+/*N*/ {
+/*N*/ pInf->SetTxt( *pOldTxt );
+/*N*/ pInf->SetIdx( nIdx );
+/*N*/ pInf->SetLen( nLen );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * class SwTxtSlotLen
+ *************************************************************************/
+
+/*N*/ SwTxtSlotLen::SwTxtSlotLen( const SwTxtSizeInfo *pNew, const SwLinePortion *pPor,
+/*N*/ const sal_Char *pCh )
+/*N*/ {
+/*N*/ if( pCh )
+/*N*/ {
+/*?*/ aTxt = XubString( pCh, RTL_TEXTENCODING_MS_1252 );
+/*?*/ bOn = sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ bOn = pPor->GetExpTxt( *pNew, aTxt );
+/*N*/
+/*N*/ // Der Text wird ausgetauscht...
+/*N*/ if( bOn )
+/*N*/ {
+/*N*/ pInf = (SwTxtSizeInfo*)pNew;
+/*N*/ nIdx = pInf->GetIdx();
+/*N*/ nLen = pInf->GetLen();
+/*N*/ pOldTxt = &(pInf->GetTxt());
+/*N*/ pInf->SetTxt( aTxt );
+/*N*/ pInf->SetIdx( 0 );
+/*N*/ pInf->SetLen( pInf->GetTxt().Len() );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtSlotLen::~SwTxtSlotLen()
+ *************************************************************************/
+
+/*N*/ SwTxtSlotLen::~SwTxtSlotLen()
+/*N*/ {
+/*N*/ if( bOn )
+/*N*/ {
+/*N*/ pInf->SetTxt( *pOldTxt );
+/*N*/ pInf->SetIdx( nIdx );
+/*N*/ pInf->SetLen( nLen );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwFontSave::SwFontSave()
+ *************************************************************************/
+
+/*N*/ SwFontSave::SwFontSave( const SwTxtSizeInfo &rInf, SwFont *pNew,
+/*N*/ SwAttrIter* pItr )
+/*N*/ : pFnt( pNew ? ((SwTxtSizeInfo&)rInf).GetFont() : 0 )
+/*N*/ {
+/*N*/ if( pFnt )
+/*N*/ {
+/*N*/ pInf = &((SwTxtSizeInfo&)rInf);
+/*N*/ // In these cases we temporarily switch to the new font:
+/*N*/ // 1. the fonts have a different magic number
+/*N*/ // 2. they have different script types
+/*N*/ // 3. their background colors differ (this is not covered by 1.)
+/*N*/ if( pFnt->DifferentMagic( pNew, pFnt->GetActual() ) ||
+/*N*/ pNew->GetActual() != pFnt->GetActual() ||
+/*N*/ ( ! pNew->GetBackColor() && pFnt->GetBackColor() ) ||
+/*N*/ ( pNew->GetBackColor() && ! pFnt->GetBackColor() ) ||
+/*N*/ ( pNew->GetBackColor() && pFnt->GetBackColor() &&
+/*N*/ ( *pNew->GetBackColor() != *pFnt->GetBackColor() ) ) )
+/*N*/ {
+/*N*/ pNew->SetTransparent( sal_True );
+/*N*/ pNew->SetAlign( ALIGN_BASELINE );
+/*N*/ pInf->SetFont( pNew );
+/*N*/ }
+/*N*/ else
+/*N*/ pFnt = 0;
+/*N*/ pNew->Invalidate();
+/*N*/ pNew->ChgPhysFnt( pInf->GetVsh(), pInf->GetOut() );
+/*N*/ if( pItr && pItr->GetFnt() == pFnt )
+/*N*/ {
+/*?*/ pIter = pItr;
+/*?*/ pIter->SetFnt( pNew );
+/*N*/ }
+/*N*/ else
+/*N*/ pIter = NULL;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwFontSave::~SwFontSave()
+ *************************************************************************/
+
+/*N*/ SwFontSave::~SwFontSave()
+/*N*/ {
+/*N*/ if( pFnt )
+/*N*/ {
+/*N*/ // SwFont zurueckstellen
+/*N*/ pFnt->Invalidate();
+/*N*/ pInf->SetFont( pFnt );
+/*N*/ if( pIter )
+/*N*/ {
+/*?*/ pIter->SetFnt( pFnt );
+/*?*/ pIter->nPos = STRING_LEN;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwDefFontSave::SwDefFontSave()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwDefFontSave::~SwDefFontSave()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFormatInfo::ChgHyph()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFormatInfo::ChgHyph( const sal_Bool bNew )
+/*N*/ {
+/*N*/ const sal_Bool bOld = bAutoHyph;
+/*N*/ if( bAutoHyph != bNew )
+/*N*/ {
+/*N*/ bAutoHyph = bNew;
+/*N*/ InitHyph( bNew );
+/*N*/ // 5744: Sprache am Hyphenator einstellen.
+/*N*/ if( pFnt )
+/*N*/ pFnt->ChgPhysFnt( pVsh, pOut );
+/*N*/ }
+/*N*/ return bOld;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_itradj.cxx b/binfilter/bf_sw/source/core/text/sw_itradj.cxx
new file mode 100644
index 000000000000..894c13aa94c7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_itradj.cxx
@@ -0,0 +1,493 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#if OSL_DEBUG_LEVEL > 1
+# include "ndtxt.hxx" // pSwpHints, Ausgabeoperator
+#endif
+
+#include "itrtxt.hxx"
+#include "porfly.hxx" // CalcFlyAdjust()
+#include "pormulti.hxx"
+
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+namespace binfilter {
+
+#define MIN_TAB_WIDTH 60
+
+/*************************************************************************
+ * SwTxtAdjuster::FormatBlock()
+ *************************************************************************/
+
+/*N*/ void SwTxtAdjuster::FormatBlock( )
+/*N*/ {
+/*N*/ // In der letzten Zeile gibt's keinen Blocksatz.
+/*N*/ // Und bei Tabulatoren aus Tradition auch nicht.
+/*N*/ // 7701: wenn Flys im Spiel sind, geht's weiter
+/*N*/
+/*N*/ const SwLinePortion *pFly = 0;
+/*N*/
+/*N*/ sal_Bool bSkip = !IsLastBlock() &&
+/*N*/ nStart + pCurr->GetLen() >= GetInfo().GetTxt().Len();
+/*N*/
+/*N*/ // ????: mehrzeilige Felder sind fies: wir muessen kontrollieren,
+/*N*/ // ob es noch andere Textportions im Absatz gibt.
+/*N*/ if( bSkip )
+/*N*/ {
+/*N*/ const SwLineLayout *pLay = pCurr->GetNext();
+/*N*/ while( pLay && !pLay->GetLen() )
+/*N*/ {
+/*?*/ const SwLinePortion *pPor = pCurr->GetFirstPortion();
+/*?*/ while( pPor && bSkip )
+/*?*/ {
+/*?*/ if( pPor->InTxtGrp() )
+/*?*/ bSkip = sal_False;
+/*?*/ pPor = pPor->GetPortion();
+/*?*/ }
+/*?*/ pLay = bSkip ? pLay->GetNext() : 0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bSkip )
+/*N*/ {
+/*N*/ if( !GetInfo().GetParaPortion()->HasFly() )
+/*N*/ {
+/*?*/ if( IsLastCenter() )
+/*?*/ CalcFlyAdjust( pCurr );
+/*?*/ pCurr->FinishSpaceAdd();
+/*?*/ return;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwLinePortion *pTmpFly = NULL;
+/*N*/
+/*N*/ // 7701: beim letzten Fly soll Schluss sein
+/*N*/ const SwLinePortion *pPos = pCurr->GetFirstPortion();
+/*N*/ while( pPos )
+/*N*/ {
+/*N*/ // Ich suche jetzt den letzten Fly, hinter dem noch Text ist:
+/*N*/ if( pPos->IsFlyPortion() )
+/*N*/ pTmpFly = pPos; // Ein Fly wurde gefunden
+/*N*/ else if ( pTmpFly && pPos->InTxtGrp() )
+/*N*/ {
+/*N*/ pFly = pTmpFly; // Ein Fly mit nachfolgendem Text!
+/*N*/ pTmpFly = NULL;
+/*N*/ }
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ // 8494: Wenn keiner gefunden wurde, ist sofort Schluss!
+/*N*/ if( !pFly )
+/*N*/ {
+/*N*/ if( IsLastCenter() )
+/*?*/ CalcFlyAdjust( pCurr );
+/*N*/ pCurr->FinishSpaceAdd();
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ const int nOldIdx = GetInfo().GetIdx();
+/*N*/ GetInfo().SetIdx( nStart );
+/*N*/ CalcNewBlock( pCurr, pFly );
+/*N*/ GetInfo().SetIdx( nOldIdx );
+/*N*/ GetInfo().GetParaPortion()->GetRepaint()->SetOfst(0);
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtAdjuster::CalcNewBlock()
+ *
+ * CalcNewBlock() darf erst nach CalcLine() gerufen werden !
+ * Aufgespannt wird immer zwischen zwei RandPortions oder FixPortions
+ * (Tabs und Flys). Dabei werden die Glues gezaehlt und ExpandBlock gerufen.
+ *************************************************************************/
+
+/*N*/ void SwTxtAdjuster::CalcNewBlock( SwLineLayout *pCurr,
+/*N*/ const SwLinePortion *pStopAt, SwTwips nReal )
+/*N*/ {
+/*N*/ ASSERT( GetInfo().IsMulti() || SVX_ADJUST_BLOCK == GetAdjust(),
+/*N*/ "CalcNewBlock: Why?" );
+/*N*/ ASSERT( pCurr->Height(), "SwTxtAdjuster::CalcBlockAdjust: missing CalcLine()" );
+/*N*/
+/*N*/ pCurr->InitSpaceAdd();
+/*N*/ MSHORT nNull = 0;
+/*N*/ xub_StrLen nGluePortion = 0;
+/*N*/ xub_StrLen nCharCnt = 0;
+/*N*/ MSHORT nSpaceIdx = 0;
+/*N*/
+/*N*/ // Nicht vergessen:
+/*N*/ // CalcRightMargin() setzt pCurr->Width() auf die Zeilenbreite !
+/*N*/ CalcRightMargin( pCurr, nReal );
+/*N*/
+/*N*/ SwLinePortion *pPos = pCurr->GetPortion();
+/*N*/
+/*N*/ while( pPos )
+/*N*/ {
+/*N*/ if ( pPos->IsBreakPortion() && !IsLastBlock() )
+/*N*/ {
+/*?*/ pCurr->FinishSpaceAdd();
+/*?*/ break;
+/*N*/ }
+/*N*/ if ( pPos->InTxtGrp() )
+/*N*/ nGluePortion += ((SwTxtPortion*)pPos)->GetSpaceCnt( GetInfo(), nCharCnt );
+/*N*/ else if( pPos->IsMultiPortion() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*N*/ {
+/*N*/
+/*N*/ if( pPos->InGlueGrp() )
+/*N*/ {
+/*N*/ if( pPos->InFixMargGrp() )
+/*N*/ {
+/*N*/ if ( nSpaceIdx == pCurr->GetSpaceAdd().Count() )
+/*N*/ pCurr->GetSpaceAdd().Insert( nNull, nSpaceIdx );
+/*N*/ if( nGluePortion )
+/*N*/ {
+/*N*/ ( pCurr->GetSpaceAdd() )[nSpaceIdx] =
+/*N*/ ( (SwGluePortion*)pPos )->GetPrtGlue() / nGluePortion;
+/*N*/ pPos->Width( ( (SwGluePortion*)pPos )->GetFixWidth() );
+/*N*/ }
+/*N*/ else if ( IsOneBlock() && nCharCnt > 1 )
+/*N*/ {
+/*?*/ ( pCurr->GetSpaceAdd() )[nSpaceIdx] =
+/*?*/ - ( (SwGluePortion*)pPos )->GetPrtGlue() / (nCharCnt-1);
+/*?*/ pPos->Width( ( (SwGluePortion*)pPos )->GetFixWidth() );
+/*N*/ }
+/*N*/ nSpaceIdx++;
+/*N*/ nGluePortion = 0;
+/*N*/ nCharCnt = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ ++nGluePortion;
+/*N*/ }
+/*N*/ GetInfo().SetIdx( GetInfo().GetIdx() + pPos->GetLen() );
+/*N*/ if ( pPos == pStopAt )
+/*N*/ {
+/*?*/ if ( nSpaceIdx == pCurr->GetSpaceAdd().Count() )
+/*?*/ pCurr->GetSpaceAdd().Insert( nNull, nSpaceIdx );
+/*?*/ else
+/*?*/ pCurr->GetSpaceAdd()[nSpaceIdx] = 0;
+/*?*/ break;
+/*N*/ }
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtAdjuster::CalcKanaAdj()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtAdjuster::CalcRightMargin()
+ *************************************************************************/
+
+/*N*/ SwMarginPortion *SwTxtAdjuster::CalcRightMargin( SwLineLayout *pCurr,
+/*N*/ SwTwips nReal )
+/*N*/ {
+/*N*/ long nRealWidth;
+/*N*/ const USHORT nRealHeight = GetLineHeight();
+/*N*/ const USHORT nLineHeight = pCurr->Height();
+/*N*/
+/*N*/ KSHORT nPrtWidth = pCurr->PrtWidth();
+/*N*/ SwLinePortion *pLast = pCurr->FindLastPortion();
+/*N*/
+/*N*/ if( GetInfo().IsMulti() )
+/*N*/ nRealWidth = nReal;
+/*N*/ else
+/*N*/ {
+/*N*/ nRealWidth = GetLineWidth();
+/*N*/ // Fuer jeden FlyFrm, der in den rechten Rand hineinragt,
+/*N*/ // wird eine FlyPortion angelegt.
+/*N*/ const long nLeftMar = GetLeftMargin();
+/*N*/ SwRect aCurrRect( nLeftMar + nPrtWidth, Y() + nRealHeight - nLineHeight,
+/*N*/ nRealWidth - nPrtWidth, nLineHeight );
+/*N*/
+/*N*/ SwFlyPortion *pFly = CalcFlyPortion( nRealWidth, aCurrRect );
+/*N*/ while( pFly && long( nPrtWidth )< nRealWidth )
+/*N*/ {
+/*N*/ pLast->Append( pFly );
+/*N*/ pLast = pFly;
+/*N*/ if( pFly->Fix() > nPrtWidth )
+/*?*/ pFly->Width( ( pFly->Fix() - nPrtWidth) + pFly->Width() + 1);
+/*N*/ nPrtWidth += pFly->Width() + 1;
+/*N*/ aCurrRect.Left( nLeftMar + nPrtWidth );
+/*N*/ pFly = CalcFlyPortion( nRealWidth, aCurrRect );
+/*N*/ }
+/*N*/ if( pFly )
+/*?*/ delete pFly;
+/*N*/ }
+/*N*/
+/*N*/ SwMarginPortion *pRight = new SwMarginPortion( 0 );
+/*N*/ pLast->Append( pRight );
+/*N*/
+/*N*/ if( long( nPrtWidth )< nRealWidth )
+/*N*/ pRight->PrtWidth( KSHORT( nRealWidth - nPrtWidth ) );
+/*N*/
+/*N*/ // pCurr->Width() wird auf die reale Groesse gesetzt,
+/*N*/ // da jetzt die MarginPortions eingehaengt sind.
+/*N*/ // Dieser Trick hat wundersame Auswirkungen.
+/*N*/ // Wenn pCurr->Width() == nRealWidth ist, dann wird das gesamte
+/*N*/ // Adjustment implizit ausgecontert. GetLeftMarginAdjust() und
+/*N*/ // IsBlocksatz() sind der Meinung, sie haetten eine mit Zeichen
+/*N*/ // gefuellte Zeile.
+/*N*/
+/*N*/ pCurr->PrtWidth( KSHORT( nRealWidth ) );
+/*N*/ return pRight;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtAdjuster::CalcFlyAdjust()
+ *************************************************************************/
+
+/*N*/ void SwTxtAdjuster::CalcFlyAdjust( SwLineLayout *pCurr )
+/*N*/ {
+/*N*/ // 1) Es wird ein linker Rand eingefuegt:
+/*N*/ SwMarginPortion *pLeft = pCurr->CalcLeftMargin();
+/*N*/ SwGluePortion *pGlue = pLeft; // die letzte GluePortion
+/*N*/
+/*N*/
+/*N*/ // 2) Es wird ein rechter Rand angehaengt:
+/*N*/ // CalcRightMargin berechnet auch eventuelle Ueberlappungen mit
+/*N*/ // FlyFrms.
+/*N*/ CalcRightMargin( pCurr );
+/*N*/
+/*N*/ SwLinePortion *pPos = pLeft->GetPortion();
+/*N*/ xub_StrLen nLen = 0;
+/*N*/
+/*N*/ // Wenn wir nur eine Zeile vorliegen haben und die Textportion zusammen
+/*N*/ // haengend ist und wenn zentriert wird, dann ...
+/*N*/
+/*N*/ sal_Bool bComplete = 0 == nStart;
+/*N*/ const sal_Bool bTabCompat = GetTxtFrm()->GetNode()->GetDoc()->IsTabCompat();
+/*N*/ sal_Bool bMultiTab = sal_False;
+/*N*/
+/*N*/ while( pPos )
+/*N*/ {
+/*N*/ if ( pPos->IsMultiPortion() && ((SwMultiPortion*)pPos)->HasTabulator() )
+/*N*/ bMultiTab = sal_True;
+/*N*/ else if( pPos->InFixMargGrp() &&
+/*N*/ ( bTabCompat ? ! pPos->InTabGrp() : ! bMultiTab ) )
+/*N*/ {
+/*N*/ // in tab compat mode we do not want to change tab portions
+/*N*/ // in non tab compat mode we do not want to change margins if we
+/*N*/ // found a multi portion with tabs
+/*N*/ if( SVX_ADJUST_RIGHT == GetAdjust() )
+/*N*/ ((SwGluePortion*)pPos)->MoveAllGlue( pGlue );
+/*N*/ else
+/*N*/ {
+/*N*/ // Eine schlaue Idee von MA:
+/*N*/ // Fuer die erste Textportion wird rechtsbuendig eingestellt,
+/*N*/ // fuer die letzte linksbuendig.
+/*N*/
+/*N*/ // Die erste Textportion kriegt den ganzen Glue
+/*N*/ // Aber nur, wenn wir mehr als eine Zeile besitzen.
+/*N*/ if( bComplete && GetInfo().GetTxt().Len() == nLen )
+/*N*/ ((SwGluePortion*)pPos)->MoveHalfGlue( pGlue );
+/*N*/ else
+/*N*/ {
+/*N*/ if ( ! bTabCompat )
+/*N*/ {
+/*N*/ if( pLeft == pGlue )
+/*N*/ {
+/*N*/ // Wenn es nur einen linken und rechten Rand gibt,
+/*N*/ // dann teilen sich die Raender den Glue.
+/*N*/ if( nLen + pPos->GetLen() >= pCurr->GetLen() )
+/*N*/ ((SwGluePortion*)pPos)->MoveHalfGlue( pGlue );
+/*N*/ else
+/*?*/ ((SwGluePortion*)pPos)->MoveAllGlue( pGlue );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Die letzte Textportion behaelt sein Glue
+/*N*/ if( !pPos->IsMarginPortion() )
+/*?*/ ((SwGluePortion*)pPos)->MoveHalfGlue( pGlue );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*?*/ ((SwGluePortion*)pPos)->MoveHalfGlue( pGlue );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pGlue = (SwFlyPortion*)pPos;
+/*N*/ bComplete = sal_False;
+/*N*/ }
+/*N*/ nLen += pPos->GetLen();
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/
+/*N*/ if( ! bTabCompat && ! bMultiTab && SVX_ADJUST_RIGHT == GetAdjust() )
+/*N*/ // portions are moved to the right if possible
+/*N*/ pLeft->AdjustRight( pCurr );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtAdjuster::CalcAdjLine()
+ *************************************************************************/
+
+/*N*/ void SwTxtAdjuster::CalcAdjLine( SwLineLayout *pCurr )
+/*N*/ {
+/*N*/ ASSERT( pCurr->IsFormatAdj(), "CalcAdjLine: Why?" );
+/*N*/
+/*N*/ pCurr->SetFormatAdj(sal_False);
+/*N*/
+/*N*/ SwParaPortion* pPara = GetInfo().GetParaPortion();
+/*N*/
+/*N*/ switch( GetAdjust() )
+/*N*/ {
+/*N*/ case SVX_ADJUST_RIGHT:
+/*N*/ case SVX_ADJUST_CENTER:
+/*N*/ {
+/*N*/ CalcFlyAdjust( pCurr );
+/*N*/ pPara->GetRepaint()->SetOfst( 0 );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SVX_ADJUST_BLOCK:
+/*N*/ {
+/*N*/ // 8311: In Zeilen mit LineBreaks gibt es keinen Blocksatz!
+/*N*/ if( pCurr->GetLen() &&
+/*N*/ CH_BREAK == GetInfo().GetChar( nStart + pCurr->GetLen() - 1 ) &&
+/*N*/ !IsLastBlock() )
+/*N*/ {
+/*N*/ if( IsLastCenter() )
+/*N*/ {
+/*?*/ CalcFlyAdjust( pCurr );
+/*?*/ pPara->GetRepaint()->SetOfst( 0 );
+/*?*/ break;
+/*N*/ }
+/*N*/ return;
+/*N*/ }
+/*N*/ FormatBlock();
+/*N*/ break;
+/*N*/ }
+/*N*/ default : return;
+/*N*/ }
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+ /*
+ if( OPTDBG( *pInf ) )
+ {
+ pCurr->DebugPortions( aDbstream, pInf->GetTxt(), nStart );
+ if( GetHints() )
+ {
+ const SwpHints &rHt = *GetHints();
+ aDbstream << rHt;
+ SwAttrIter::Dump( aDbstream );
+ }
+ }
+ */
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtAdjuster::CalcFlyPortion()
+ *
+ * Die Berechnung hat es in sich: nCurrWidth geibt die Breite _vor_ dem
+ * aufaddieren des Wortes das noch auf die Zeile passt! Aus diesem Grund
+ * stimmt die Breite der FlyPortion auch, wenn die Blockierungssituation
+ * bFirstWord && !WORDFITS eintritt.
+ *************************************************************************/
+
+/*N*/ SwFlyPortion *SwTxtAdjuster::CalcFlyPortion( const long nRealWidth,
+/*N*/ const SwRect &rCurrRect )
+/*N*/ {
+/*N*/ SwTxtFly aTxtFly( GetTxtFrm() );
+/*N*/
+/*N*/ const KSHORT nCurrWidth = pCurr->PrtWidth();
+/*N*/ SwFlyPortion *pFlyPortion = 0;
+/*N*/
+/*N*/ SwRect aLineVert( rCurrRect );
+/*N*/ if ( GetTxtFrm()->IsRightToLeft() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 GetTxtFrm()->SwitchLTRtoRTL( aLineVert );
+/*N*/ if ( GetTxtFrm()->IsVertical() )
+/*?*/ GetTxtFrm()->SwitchHorizontalToVertical( aLineVert );
+/*N*/
+/*N*/ // aFlyRect ist dokumentglobal !
+/*N*/ SwRect aFlyRect( aTxtFly.GetFrm( aLineVert ) );
+/*N*/
+/*N*/ if ( GetTxtFrm()->IsRightToLeft() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 GetTxtFrm()->SwitchRTLtoLTR( aFlyRect );
+/*N*/ if ( GetTxtFrm()->IsVertical() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 GetTxtFrm()->SwitchVerticalToHorizontal( aFlyRect );
+/*N*/
+/*N*/ // Wenn ein Frame ueberlappt, wird eine Portion eroeffnet.
+/*N*/ if( aFlyRect.HasArea() )
+/*N*/ {
+/*N*/ // aLocal ist framelokal
+/*?*/ SwRect aLocal( aFlyRect );
+/*?*/ aLocal.Pos( aLocal.Left() - GetLeftMargin(), aLocal.Top() );
+/*?*/ if( nCurrWidth > aLocal.Left() )
+/*?*/ aLocal.Left( nCurrWidth );
+/*?*/
+/*?*/ // Wenn das Rechteck breiter als die Zeile ist, stutzen
+/*?*/ // wir es ebenfalls zurecht.
+/*?*/ KSHORT nLocalWidth = KSHORT( aLocal.Left() + aLocal.Width() );
+/*?*/ if( nRealWidth < long( nLocalWidth ) )
+/*?*/ aLocal.Width( nRealWidth - aLocal.Left() );
+/*?*/ GetInfo().GetParaPortion()->SetFly( sal_True );
+/*?*/ pFlyPortion = new SwFlyPortion( aLocal );
+/*?*/ pFlyPortion->Height( KSHORT( rCurrRect.Height() ) );
+/*?*/ // Die Width koennte kleiner sein als die FixWidth, daher:
+/*?*/ pFlyPortion->AdjFixWidth();
+/*N*/ }
+/*N*/ return pFlyPortion;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtPainter::_CalcDropAdjust()
+ *************************************************************************/
+
+// 6721: Drops und Adjustment
+// CalcDropAdjust wird ggf. am Ende von Format() gerufen.
+
+
+/*************************************************************************
+ * SwTxtAdjuster::CalcDropRepaint()
+ *************************************************************************/
+
+/*N*/ void SwTxtAdjuster::CalcDropRepaint()
+/*N*/ {
+/*N*/ Top();
+/*N*/ SwRepaint &rRepaint = *GetInfo().GetParaPortion()->GetRepaint();
+/*N*/ if( rRepaint.Top() > Y() )
+/*?*/ rRepaint.Top( Y() );
+/*N*/ for( MSHORT i = 1; i < GetDropLines(); ++i )
+/*N*/ NextLine();
+/*N*/ const SwTwips nBottom = Y() + GetLineHeight() - 1;
+/*N*/ if( rRepaint.Bottom() < nBottom )
+/*?*/ rRepaint.Bottom( nBottom );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_itratr.cxx b/binfilter/bf_sw/source/core/text/sw_itratr.cxx
new file mode 100644
index 000000000000..dfda582f82ba
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_itratr.cxx
@@ -0,0 +1,359 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <horiornt.hxx>
+
+#include <rootfrm.hxx>
+#include <redlnitr.hxx>
+#include <itrtxt.hxx>
+#include <com/sun/star/i18n/ScriptType.hdl>
+namespace binfilter {
+
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star;
+
+extern BYTE WhichFont( xub_StrLen nIdx, const String* pTxt,
+ const SwScriptInfo* pSI );
+
+/*************************************************************************
+ * SwAttrIter::Chg()
+ *************************************************************************/
+
+/*N*/ void SwAttrIter::Chg( SwTxtAttr *pHt )
+/*N*/ {
+/*N*/ ASSERT( pHt && pFnt, "No attribute of font available for change");
+/*N*/ if( pRedln && pRedln->IsOn() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRedln->ChangeTxtAttr( pFnt, *pHt, sal_True );
+/*N*/ else
+/*N*/ aAttrHandler.PushAndChg( *pHt, *pFnt );
+/*N*/ nChgCnt++;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrIter::Rst()
+ *************************************************************************/
+
+/*N*/ void SwAttrIter::Rst( SwTxtAttr *pHt )
+/*N*/ {
+/*N*/ ASSERT( pHt && pFnt, "No attribute of font available for reset");
+/*N*/ // get top from stack after removing pHt
+/*N*/ if( pRedln && pRedln->IsOn() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRedln->ChangeTxtAttr( pFnt, *pHt, sal_False );
+/*N*/ else
+/*N*/ aAttrHandler.PopAndChg( *pHt, *pFnt );
+/*N*/ nChgCnt--;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwAttrIter::~SwAttrIter()
+ *************************************************************************/
+
+/*N*/ SwAttrIter::~SwAttrIter()
+/*N*/ {
+/*N*/ delete pRedln;
+/*N*/ delete pFnt;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrIter::GetAttr()
+ *
+ * Liefert fuer eine Position das Attribut, wenn das Attribut genau auf
+ * der Position nPos liegt und kein EndIndex besitzt.
+ * GetAttr() wird fuer Attribute benoetigt, die die Formatierung beeinflussen
+ * sollen, ohne dabei den Inhalt des Strings zu veraendern. Solche "entarteten"
+ * Attribute sind z.B. Felder (die expandierten Text bereit halten) und
+ * zeilengebundene Frames. Um Mehrdeutigkeiten zwischen verschiedenen
+ * solcher Attribute zu vermeiden, werden beim Anlegen eines Attributs
+ * an der Startposition ein Sonderzeichen in den String einfuegt.
+ * Der Formatierer stoesst auf das Sonderzeichen und holt sich per
+ * GetAttr() das entartete Attribut.
+ *************************************************************************/
+
+/*N*/ SwTxtAttr *SwAttrIter::GetAttr( const xub_StrLen nPos ) const
+/*N*/ {
+/*N*/ if( pHints )
+/*N*/ {
+/*N*/ for( MSHORT i = 0; i < pHints->Count(); ++i )
+/*N*/ {
+/*N*/ SwTxtAttr *pPos = pHints->GetHt(i);
+/*N*/ xub_StrLen nStart = *pPos->GetStart();
+/*N*/ if( nPos < nStart )
+/*N*/ return 0;
+/*N*/ if( nPos == nStart && !pPos->GetEnd() )
+/*N*/ return pPos;
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrIter::SeekAndChg()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwAttrIter::SeekAndChg( const xub_StrLen nNewPos, OutputDevice *pOut )
+/*N*/ {
+/*N*/ sal_Bool bChg = nStartIndex && nNewPos == nPos ? pFnt->IsFntChg() : Seek( nNewPos );
+/*N*/ if ( pLastOut != pOut )
+/*N*/ {
+/*N*/ pLastOut = pOut;
+/*N*/ pFnt->SetFntChg( sal_True );
+/*N*/ bChg = sal_True;
+/*N*/ }
+/*N*/ if( bChg )
+/*N*/ {
+/*N*/ // wenn der Aenderungszaehler auf Null ist, kennen wir die MagicNo
+/*N*/ // des gewuenschten Fonts ...
+/*N*/ if ( !nChgCnt && !nPropFont )
+/*N*/ pFnt->SetMagic( aMagicNo[ pFnt->GetActual() ],
+/*N*/ aFntIdx[ pFnt->GetActual() ], pFnt->GetActual() );
+/*N*/ pFnt->ChgPhysFnt( pShell, pOut );
+/*N*/ }
+/*N*/ return bChg;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwAttrIter::SeekStartAndChg()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwAttrIter::SeekStartAndChg( OutputDevice *pOut, const sal_Bool bParaFont )
+/*N*/ {
+/*N*/ if ( pRedln && pRedln->ExtOn() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRedln->LeaveExtend( *pFnt, 0 );
+/*N*/
+/*N*/ // reset font to its original state
+/*N*/ aAttrHandler.Reset();
+/*N*/ aAttrHandler.ResetFont( *pFnt );
+/*N*/
+/*N*/ nStartIndex = nEndIndex = nPos = nChgCnt = 0;
+/*N*/ if( nPropFont )
+/*?*/ pFnt->SetProportion( nPropFont );
+/*N*/ if( pRedln )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pRedln->Clear( pFnt );
+/*N*/ }
+/*N*/
+/*N*/ if ( pHints && !bParaFont )
+/*N*/ {
+/*N*/ SwTxtAttr *pTxtAttr;
+/*N*/ // Solange wir noch nicht am Ende des StartArrays angekommen sind &&
+/*N*/ // das TextAttribut an Position 0 beginnt ...
+/*?*/ while ( ( nStartIndex < pHints->GetStartCount() ) &&
+/*?*/ !(*(pTxtAttr=pHints->GetStart(nStartIndex))->GetStart()) )
+/*?*/ {
+/*?*/ // oeffne die TextAttribute
+/*?*/ Chg( pTxtAttr );
+/*?*/ nStartIndex++;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ register sal_Bool bChg = pFnt->IsFntChg();
+/*N*/ if ( pLastOut != pOut )
+/*N*/ {
+/*N*/ pLastOut = pOut;
+/*N*/ pFnt->SetFntChg( sal_True );
+/*N*/ bChg = sal_True;
+/*N*/ }
+/*N*/ if( bChg )
+/*N*/ {
+/*N*/ // wenn der Aenderungszaehler auf Null ist, kennen wir die MagicNo
+/*N*/ // des gewuenschten Fonts ...
+/*N*/ if ( !nChgCnt && !nPropFont )
+/*N*/ pFnt->SetMagic( aMagicNo[ pFnt->GetActual() ],
+/*N*/ aFntIdx[ pFnt->GetActual() ], pFnt->GetActual() );
+/*N*/ pFnt->ChgPhysFnt( pShell, pOut );
+/*N*/ }
+/*N*/ return bChg;
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrIter::SeekFwd()
+ *************************************************************************/
+
+// AMA: Neuer AttrIter Nov 94
+
+/*N*/ void SwAttrIter::SeekFwd( const xub_StrLen nNewPos )
+/*N*/ {
+/*N*/ SwTxtAttr *pTxtAttr;
+/*N*/
+/*N*/ if ( nStartIndex ) // wenn ueberhaupt schon Attribute geoeffnet wurden...
+/*N*/ {
+/*N*/ // Schliesse Attr, die z. Z. geoeffnet sind, vor nNewPos+1 aber enden.
+/*N*/
+/*N*/ // Solange wir noch nicht am Ende des EndArrays angekommen sind &&
+/*N*/ // das TextAttribut vor oder an der neuen Position endet ...
+/*N*/ while ( ( nEndIndex < pHints->GetEndCount() ) &&
+/*N*/ (*(pTxtAttr=pHints->GetEnd(nEndIndex))->GetAnyEnd()<=nNewPos))
+/*N*/ {
+/*N*/ // schliesse die TextAttribute, deren StartPos vor
+/*N*/ // oder an der alten nPos lag, die z.Z. geoeffnet sind.
+/*N*/ if (*pTxtAttr->GetStart() <= nPos) Rst( pTxtAttr );
+/*N*/ nEndIndex++;
+/*N*/ }
+/*N*/ }
+/*N*/ else // ueberlies die nicht geoeffneten Enden
+/*N*/ {
+/*N*/ while ( ( nEndIndex < pHints->GetEndCount() ) &&
+/*N*/ (*(pTxtAttr=pHints->GetEnd(nEndIndex))->GetAnyEnd()<=nNewPos))
+/*N*/ {
+/*N*/ nEndIndex++;
+/*N*/ }
+/*N*/ }
+/*N*/ // Solange wir noch nicht am Ende des StartArrays angekommen sind &&
+/*N*/ // das TextAttribut vor oder an der neuen Position beginnt ...
+/*N*/ while ( ( nStartIndex < pHints->GetStartCount() ) &&
+/*N*/ (*(pTxtAttr=pHints->GetStart(nStartIndex))->GetStart()<=nNewPos))
+/*N*/ {
+/*N*/ // oeffne die TextAttribute, deren Ende hinter der neuen Position liegt
+/*N*/ if ( *pTxtAttr->GetAnyEnd() > nNewPos ) Chg( pTxtAttr );
+/*N*/ nStartIndex++;
+/*N*/ }
+/*N*/
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrIter::Seek()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwAttrIter::Seek( const xub_StrLen nNewPos )
+/*N*/ {
+/*N*/ if ( pRedln && pRedln->ExtOn() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRedln->LeaveExtend( *pFnt, nNewPos );
+/*N*/
+/*N*/ if( pHints )
+/*N*/ {
+/*N*/ if( !nNewPos || nNewPos < nPos )
+/*N*/ {
+/*N*/ if( pRedln )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRedln->Clear( NULL );
+/*N*/
+/*N*/ // reset font to its original state
+/*N*/ aAttrHandler.Reset();
+/*N*/ aAttrHandler.ResetFont( *pFnt );
+/*N*/
+/*N*/ if( nPropFont )
+/*?*/ pFnt->SetProportion( nPropFont );
+/*N*/ nStartIndex = nEndIndex = nPos = 0;
+/*N*/ nChgCnt = 0;
+/*N*/
+/*N*/ // Achtung!
+/*N*/ // resetting the font here makes it necessary to apply any
+/*N*/ // changes for extended input directly to the font
+/*N*/ if ( pRedln && pRedln->ExtOn() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pRedln->UpdateExtFont( *pFnt );
+/*N*/ }
+/*N*/ }
+/*N*/ SeekFwd( nNewPos );
+/*N*/ }
+/*N*/
+/*N*/ pFnt->SetActual( WhichFont( nNewPos, 0, pScriptInfo ) );
+/*N*/
+/*N*/ if( pRedln )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nChgCnt += pRedln->Seek( *pFnt, nNewPos, nPos );
+/*N*/ nPos = nNewPos;
+/*N*/
+/*N*/ if( nPropFont )
+/*?*/ pFnt->SetProportion( nPropFont );
+/*N*/
+/*N*/ return pFnt->IsFntChg();
+/*N*/ }
+
+/*************************************************************************
+ * SwAttrIter::GetNextAttr()
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwAttrIter::GetNextAttr( ) const
+/*N*/ {
+/*N*/ xub_StrLen nNext = STRING_LEN;
+/*N*/ if( pHints )
+/*N*/ {
+/*N*/ if (pHints->GetStartCount() > nStartIndex) // Gibt es noch Starts?
+/*N*/ nNext = (*pHints->GetStart(nStartIndex)->GetStart());
+/*N*/ if (pHints->GetEndCount() > nEndIndex) // Gibt es noch Enden?
+/*N*/ {
+/*N*/ xub_StrLen nNextEnd = (*pHints->GetEnd(nEndIndex)->GetAnyEnd());
+/*N*/ if ( nNextEnd<nNext ) nNext = nNextEnd; // Wer ist naeher?
+/*N*/ }
+/*N*/ }
+/*N*/ if( pRedln )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ return pRedln->GetNextRedln( nNext );
+/*N*/ return nNext;
+/*N*/ }
+
+#if OSL_DEBUG_LEVEL > 1
+/*************************************************************************
+ * SwAttrIter::Dump()
+ *************************************************************************/
+
+
+#endif
+
+class SwMinMaxArgs
+{
+public:
+ OutputDevice *pOut;
+ ULONG &rMin;
+ ULONG &rMax;
+ ULONG &rAbsMin;
+ long nRowWidth;
+ long nWordWidth;
+ long nWordAdd;
+ xub_StrLen nNoLineBreak;
+ SwMinMaxArgs( OutputDevice *pOutI, ULONG& rMinI, ULONG &rMaxI, ULONG &rAbsI )
+ : pOut( pOutI ), rMin( rMinI ), rMax( rMaxI ), rAbsMin( rAbsI )
+ { nRowWidth = nWordWidth = nWordAdd = 0; nNoLineBreak = STRING_LEN; }
+ void Minimum( long nNew ) { if( (long)rMin < nNew ) rMin = nNew; }
+ void NewWord() { nWordAdd = nWordWidth = 0; }
+};
+
+
+
+class SwMinMaxNodeArgs
+{
+public:
+ ULONG nMaxWidth; // Summe aller Rahmenbreite
+ long nMinWidth; // Breitester Rahmen
+ long nLeftRest; // noch nicht von Rahmen ueberdeckter Platz im l. Rand
+ long nRightRest; // noch nicht von Rahmen ueberdeckter Platz im r. Rand
+ long nLeftDiff; // Min/Max-Differenz des Rahmens im linken Rand
+ long nRightDiff; // Min/Max-Differenz des Rahmens im rechten Rand
+ ULONG nIndx; // Indexnummer des Nodes
+ void Minimum( long nNew ) { if( nNew > nMinWidth ) nMinWidth = nNew; }
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_itrcrsr.cxx b/binfilter/bf_sw/source/core/text/sw_itrcrsr.cxx
new file mode 100644
index 000000000000..3656ed5b662b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_itrcrsr.cxx
@@ -0,0 +1,1124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "errhdl.hxx"
+#include "paratr.hxx"
+
+#include <horiornt.hxx>
+
+
+#include <bf_svx/adjitem.hxx>
+#include <bf_svx/lspcitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+
+#include <frmatr.hxx>
+
+#ifdef VERTICAL_LAYOUT
+#include <pagedesc.hxx> // SwPageDesc
+#endif
+
+#include "txtcfg.hxx"
+#include "itrtxt.hxx"
+
+#include "porfld.hxx" // SwFldPortion::IsFollow()
+#include "porfly.hxx" // GetFlyCrsrOfst()
+#include "pordrop.hxx"
+#include "crstate.hxx" // SwCrsrMoveState
+#include <pormulti.hxx> // SwMultiPortion
+namespace binfilter {
+
+extern BYTE WhichFont( xub_StrLen nIdx, const String* pTxt,
+ const SwScriptInfo* pSI );
+
+// Nicht reentrant !!!
+// wird in GetCharRect gesetzt und im UnitUp/Down ausgewertet.
+sal_Bool SwTxtCursor::bRightMargin = sal_False;
+
+
+/*************************************************************************
+ * lcl_GetPositionInsideField
+ *
+ * After calculating the position of a character during GetCharRect
+ * this function allows to find the coordinates of a position (defined
+ * in pCMS->pSpecialPos) inside a special portion (e.g., a field)
+ *************************************************************************/
+
+/*************************************************************************
+ * SwTxtMargin::CtorInit()
+ *************************************************************************/
+/*M*/ void SwTxtMargin::CtorInit( SwTxtFrm *pFrm, SwTxtSizeInfo *pNewInf )
+/*M*/ {
+/*M*/ SwTxtIter::CtorInit( pFrm, pNewInf );
+/*M*/
+/*M*/ pInf = pNewInf;
+/*M*/ GetInfo().SetFont( GetFnt() );
+/*M*/ SwTxtNode *pNode = pFrm->GetTxtNode();
+/*M*/
+/*M*/ const SvxLRSpaceItem &rSpace =
+/*M*/ pFrm->GetTxtNode()->GetSwAttrSet().GetLRSpace();
+/*M*/
+/*M*/ #ifdef BIDI
+/*M*/ //
+/*M*/ // Carefully adjust the text formatting ranges.
+/*M*/ //
+/*M*/ const int nLMWithNum = pNode->GetLeftMarginWithNum( sal_True );
+/*M*/ if ( pFrm->IsRightToLeft() )
+/*M*/ nLeft = pFrm->Frm().Left() + pFrm->Prt().Left() + nLMWithNum -
+/*M*/ ( rSpace.GetTxtFirstLineOfst() < 0 ?
+/*M*/ rSpace.GetTxtFirstLineOfst() :
+/*M*/ 0 );
+/*M*/ else
+/*M*/ nLeft = Max( long( rSpace.GetTxtLeft() + nLMWithNum), pFrm->Prt().Left() ) +
+/*M*/ pFrm->Frm().Left();
+/*M*/ #else
+/*M*/ nLeft = Max( long( rSpace.GetTxtLeft() + pNode->GetLeftMarginWithNum(sal_True) ),
+/*M*/ pFrm->Prt().Left() ) +
+/*M*/ pFrm->Frm().Left();
+/*M*/ #endif
+/*M*/
+/*M*/ nRight = pFrm->Frm().Left() + pFrm->Prt().Left() + pFrm->Prt().Width();
+/*M*/
+/*M*/ if( nLeft >= nRight )
+/*M*/ nLeft = pFrm->Prt().Left() + pFrm->Frm().Left();
+/*M*/ if( nLeft >= nRight ) // z.B. bei grossen Absatzeinzuegen in schmalen Tabellenspalten
+/*M*/ nRight = nLeft + 1; // einen goennen wir uns immer
+/*M*/ if( pFrm->IsFollow() && pFrm->GetOfst() )
+/*M*/ nFirst = nLeft;
+/*M*/ else
+/*M*/ {
+/*M*/ short nFLOfst;
+/*M*/ long nFirstLineOfs;
+/*M*/ if( !pNode->GetFirstLineOfsWithNum( nFLOfst ) &&
+/*M*/ rSpace.IsAutoFirst() )
+/*M*/ {
+/*M*/ nFirstLineOfs = GetFnt()->GetSize( GetFnt()->GetActual() ).Height();
+/*M*/ const SvxLineSpacingItem *pSpace = aLineInf.GetLineSpacing();
+/*M*/ if( pSpace )
+/*M*/ {
+/*M*/ switch( pSpace->GetLineSpaceRule() )
+/*M*/ {
+/*M*/ case SVX_LINE_SPACE_AUTO:
+/*M*/ break;
+/*M*/ case SVX_LINE_SPACE_MIN:
+/*M*/ {
+/*M*/ if( nFirstLineOfs < KSHORT( pSpace->GetLineHeight() ) )
+/*M*/ nFirstLineOfs = pSpace->GetLineHeight();
+/*M*/ break;
+/*M*/ }
+/*M*/ case SVX_LINE_SPACE_FIX:
+/*M*/ nFirstLineOfs = pSpace->GetLineHeight();
+/*M*/ break;
+/*M*/ default: ASSERT( sal_False, ": unknown LineSpaceRule" );
+/*M*/ }
+/*M*/ switch( pSpace->GetInterLineSpaceRule() )
+/*M*/ {
+/*M*/ case SVX_INTER_LINE_SPACE_OFF:
+/*M*/ break;
+/*M*/ case SVX_INTER_LINE_SPACE_PROP:
+/*M*/ {
+/*M*/ long nTmp = pSpace->GetPropLineSpace();
+/*M*/ // 50% ist das Minimum, bei 0% schalten wir auf
+/*M*/ // den Defaultwert 100% um ...
+/*M*/ if( nTmp < 50 )
+/*M*/ nTmp = nTmp ? 50 : 100;
+/*M*/
+/*M*/ nTmp *= nFirstLineOfs;
+/*M*/ nTmp /= 100;
+/*M*/ if( !nTmp )
+/*M*/ ++nTmp;
+/*M*/ nFirstLineOfs = (KSHORT)nTmp;
+/*M*/ break;
+/*M*/ }
+/*M*/ case SVX_INTER_LINE_SPACE_FIX:
+/*M*/ {
+/*M*/ nFirstLineOfs += pSpace->GetInterLineSpace();
+/*M*/ break;
+/*M*/ }
+/*M*/ default: ASSERT( sal_False, ": unknown InterLineSpaceRule" );
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ nFirstLineOfs = nFLOfst;
+/*M*/
+/*M*/ #ifdef BIDI
+/*M*/ if ( pFrm->IsRightToLeft() )
+/*M*/ nFirst = nLeft + nFirstLineOfs;
+/*M*/ else
+/*M*/ nFirst = Max( rSpace.GetTxtLeft() + nLMWithNum + nFirstLineOfs,
+/*M*/ pFrm->Prt().Left() ) + pFrm->Frm().Left();
+/*M*/ #else
+/*M*/ nFirst = Max( rSpace.GetTxtLeft() + pNode->GetLeftMarginWithNum( sal_True )
+/*M*/ + nFirstLineOfs, pFrm->Prt().Left() ) + pFrm->Frm().Left();
+/*M*/ #endif
+/*M*/
+/*M*/ if( nFirst >= nRight )
+/*M*/ nFirst = nRight - 1;
+/*M*/ }
+/*M*/ const SvxAdjustItem& rAdjust = pFrm->GetTxtNode()->GetSwAttrSet().GetAdjust();
+/*M*/ nAdjust = rAdjust.GetAdjust();
+/*M*/
+/*M*/ #ifdef BIDI
+/*M*/ // left is left and right is right
+/*M*/ if ( pFrm->IsRightToLeft() )
+/*M*/ {
+/*M*/ if ( SVX_ADJUST_LEFT == nAdjust )
+/*M*/ nAdjust = SVX_ADJUST_RIGHT;
+/*M*/ else if ( SVX_ADJUST_RIGHT == nAdjust )
+/*M*/ nAdjust = SVX_ADJUST_LEFT;
+/*M*/ }
+/*M*/ #endif
+/*M*/
+/*M*/ bOneBlock = rAdjust.GetOneWord() == SVX_ADJUST_BLOCK;
+/*M*/ bLastBlock = rAdjust.GetLastBlock() == SVX_ADJUST_BLOCK;
+/*M*/ bLastCenter = rAdjust.GetLastBlock() == SVX_ADJUST_CENTER;
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ static sal_Bool bOne = sal_False;
+/*M*/ static sal_Bool bLast = sal_False;
+/*M*/ static sal_Bool bCenter = sal_False;
+/*M*/ bOneBlock |= bOne;
+/*M*/ bLastBlock |= bLast;
+/*M*/ bLastCenter |= bCenter;
+/*M*/ #endif
+/*M*/ DropInit();
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtMargin::DropInit()
+ *************************************************************************/
+/*N*/ void SwTxtMargin::DropInit()
+/*N*/ {
+/*N*/ nDropLeft = nDropLines = nDropHeight = nDropDescent = 0;
+/*N*/ const SwParaPortion *pPara = GetInfo().GetParaPortion();
+/*N*/ if( pPara )
+/*N*/ {
+/*N*/ const SwDropPortion *pPorDrop = pPara->FindDropPortion();
+/*N*/ if ( pPorDrop )
+/*N*/ {
+/*N*/ nDropLeft = pPorDrop->GetDropLeft();
+/*N*/ nDropLines = pPorDrop->GetLines();
+/*N*/ nDropHeight = pPorDrop->GetDropHeight();
+/*N*/ nDropDescent = pPorDrop->GetDropDescent();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtMargin::GetLineStart()
+ *************************************************************************/
+
+// Unter Beruecksichtigung des Erstzeileneinzuges und der angebenen Breite.
+/*N*/ SwTwips SwTxtMargin::GetLineStart() const
+/*N*/ {
+/*N*/ SwTwips nRet = GetLeftMargin();
+/*N*/ if( GetAdjust() != SVX_ADJUST_LEFT &&
+/*N*/ !pCurr->GetFirstPortion()->IsMarginPortion() )
+/*N*/ {
+/*N*/ // Wenn die erste Portion ein Margin ist, dann wird das
+/*N*/ // Adjustment durch die Portions ausgedrueckt.
+/*N*/ if( GetAdjust() == SVX_ADJUST_RIGHT )
+/*N*/ nRet = Right() - CurrWidth();
+/*N*/ else if( GetAdjust() == SVX_ADJUST_CENTER )
+/*N*/ nRet += (GetLineWidth() - CurrWidth()) / 2;
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtCursor::CtorInit()
+ *************************************************************************/
+/*N*/ void SwTxtCursor::CtorInit( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf )
+/*N*/ {
+/*N*/ SwTxtMargin::CtorInit( pFrm, pInf );
+/*N*/ // 6096: Vorsicht, die Iteratoren sind abgeleitet!
+/*N*/ // GetInfo().SetOut( GetInfo().GetWin() );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtCursor::GetEndCharRect()
+ *************************************************************************/
+
+// 1170: Antikbug: Shift-Ende vergisst das letzte Zeichen ...
+
+
+/*************************************************************************
+ * void SwTxtCursor::_GetCharRect(..)
+ * internal function, called by SwTxtCursor::GetCharRect() to calculate
+ * the relative character position in the current line.
+ * pOrig referes to x and y coordinates, width and height of the cursor
+ * pCMS is used for restricting the cursor, if there are different font
+ * heights in one line ( first value = offset to y of pOrig, second
+ * value = real height of (shortened) cursor
+ *************************************************************************/
+
+/*N*/ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
+/*N*/ SwCrsrMoveState* pCMS )
+/*N*/ {
+/*N*/ const XubString &rText = GetInfo().GetTxt();
+/*N*/ SwTxtSizeInfo aInf( GetInfo(), rText, nStart );
+/*N*/ if( GetPropFont() )
+/*?*/ aInf.GetFont()->SetProportion( GetPropFont() );
+/*N*/ KSHORT nTmpAscent, nTmpHeight; // Zeilenhoehe
+/*N*/ CalcAscentAndHeight( nTmpAscent, nTmpHeight );
+/*N*/ const Size aCharSize( 1, nTmpHeight );
+/*N*/ const Point aCharPos;
+/*N*/ pOrig->Pos( aCharPos );
+/*N*/ pOrig->SSize( aCharSize );
+/*N*/
+/*N*/ // If we are looking for a position inside a field which covers
+/*N*/ // more than one line we may not skip any "empty portions" at the
+/*N*/ // beginning of a line
+/*N*/ const sal_Bool bInsideFirstField = pCMS && pCMS->pSpecialPos &&
+/*N*/ ( pCMS->pSpecialPos->nLineOfst ||
+/*N*/ SP_EXTEND_RANGE_BEFORE ==
+/*N*/ pCMS->pSpecialPos->nExtendRange );
+/*N*/
+/*N*/ sal_Bool bWidth = pCMS && pCMS->bRealWidth;
+/*N*/ if( !pCurr->GetLen() && !pCurr->Width() )
+/*N*/ {
+/*N*/ if ( pCMS && pCMS->bRealHeight )
+/*N*/ {
+/*N*/ pCMS->aRealHeight.X() = 0;
+/*N*/ pCMS->aRealHeight.Y() = nTmpHeight;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ KSHORT nPorHeight = nTmpHeight;
+/*N*/ KSHORT nPorAscent = nTmpAscent;
+/*N*/ SwTwips nX = 0;
+/*N*/ SwTwips nFirst = 0;
+/*N*/ SwLinePortion *pPor = pCurr->GetFirstPortion();
+/*N*/ SvShorts* pSpaceAdd = pCurr->GetpSpaceAdd();
+/*N*/ SvUShorts* pKanaComp = pCurr->GetpKanaComp();
+/*N*/ MSHORT nSpaceIdx = 0;
+/*N*/ MSHORT nKanaIdx = 0;
+/*N*/ short nSpaceAdd = pSpaceAdd ? (*pSpaceAdd)[0] : 0;
+/*N*/
+/*N*/ sal_Bool bNoTxt = sal_True;
+/*N*/
+/*N*/ // Zuerst werden alle Portions ohne Len am Zeilenanfang uebersprungen.
+/*N*/ // Ausnahme bilden die fiesen Spezialportions aus WhichFirstPortion:
+/*N*/ // Num, ErgoSum, FtnNum, FeldReste
+/*N*/ // 8477: aber auch die einzige Textportion einer leeren Zeile mit
+/*N*/ // Right/Center-Adjustment! Also nicht nur pPor->GetExpandPortion() ...
+/*N*/
+/*N*/ while( pPor && !pPor->GetLen() && ! bInsideFirstField )
+/*N*/ {
+/*N*/ nX += pPor->Width();
+/*N*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nX += pPor->CalcSpacing( nSpaceAdd, aInf );
+/*N*/ if( bNoTxt )
+/*N*/ nFirst = nX;
+/*N*/ // 8670: EndPortions zaehlen hier einmal als TxtPortions.
+/*N*/ if( pPor->InTxtGrp() || pPor->IsBreakPortion() )
+/*N*/ {
+/*N*/ bNoTxt = sal_False;
+/*N*/ nFirst = nX;
+/*N*/ }
+/*N*/ if( pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->HasTabulator() )
+/*N*/ {
+/*?*/ if ( pSpaceAdd )
+/*?*/ {
+/*?*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*?*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*?*/ else
+/*?*/ nSpaceAdd = 0;
+/*?*/ }
+/*?*/
+/*?*/ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+/*?*/ ++nKanaIdx;
+/*N*/ }
+/*N*/ if( pPor->InFixMargGrp() )
+/*N*/ {
+/*N*/ if( pPor->IsMarginPortion() )
+/*N*/ bNoTxt = sal_False;
+/*N*/ else
+/*N*/ {
+/*N*/ // fix margin portion => next SpaceAdd, KanaComp value
+/*N*/ if( pSpaceAdd )
+/*N*/ {
+/*N*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*N*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*N*/ else
+/*N*/ nSpaceAdd = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+/*N*/ ++nKanaIdx;
+/*N*/ }
+/*N*/ }
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/
+/*N*/ if( !pPor )
+/*N*/ {
+/*N*/ // Es sind nur Spezialportions unterwegs.
+/*N*/ nX = nFirst;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pPor->IsMarginPortion() && !pPor->IsPostItsPortion() &&
+/*N*/ (!pPor->InFldGrp() || pPor->GetAscent() ) )
+/*N*/ {
+/*N*/ nPorHeight = pPor->Height();
+/*N*/ nPorAscent = pPor->GetAscent();
+/*N*/ }
+/*N*/ #ifdef BIDI
+/*N*/ while( pPor && !pPor->IsBreakPortion() && ( aInf.GetIdx() < nOfst ||
+/*N*/ ( bWidth && ( pPor->IsKernPortion() || pPor->IsMultiPortion() ) ) ) )
+/*N*/ #else
+/*N*/ while( pPor && !pPor->IsBreakPortion() && ( aInf.GetIdx() < nOfst ||
+/*N*/ ( bWidth && pPor->IsMultiPortion() ) ) )
+/*N*/ #endif
+/*N*/ {
+/*N*/ if( !pPor->IsMarginPortion() && !pPor->IsPostItsPortion() &&
+/*N*/ (!pPor->InFldGrp() || pPor->GetAscent() ) )
+/*N*/ {
+/*N*/ nPorHeight = pPor->Height();
+/*N*/ nPorAscent = pPor->GetAscent();
+/*N*/ }
+/*N*/
+/*N*/ // If we are behind the portion, we add the portion width to
+/*N*/ // nX. Special case: nOfst = aInf.GetIdx() + pPor->GetLen().
+/*N*/ // For common portions (including BidiPortions) we want to add
+/*N*/ // the portion width to nX. For MultiPortions, nExtra = 0,
+/*N*/ // therefore we go to the 'else' branch and start a recursion.
+/*N*/ const BYTE nExtra = pPor->IsMultiPortion() &&
+/*N*/ ! ((SwMultiPortion*)pPor)->IsBidi() &&
+/*N*/ ! bWidth ? 0 : 1;
+/*N*/ if ( aInf.GetIdx() + pPor->GetLen() < nOfst + nExtra )
+/*N*/ {
+/*N*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*N*/ nX += pPor->PrtWidth() +
+/*N*/ else
+/*N*/ {
+/*N*/ if( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() )
+/*N*/ {
+/*N*/ // update to current SpaceAdd, KanaComp values
+/*N*/ if ( pSpaceAdd )
+/*N*/ {
+/*?*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*?*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*?*/ else
+/*?*/ nSpaceAdd = 0;
+/*?*/ }
+/*N*/
+/*N*/ if ( pKanaComp &&
+/*N*/ ( nKanaIdx + 1 ) < pKanaComp->Count()
+/*N*/ )
+/*N*/ ++nKanaIdx;
+/*N*/ }
+/*N*/ if ( !pPor->IsFlyPortion() || ( pPor->GetPortion() &&
+/*N*/ !pPor->GetPortion()->IsMarginPortion() ) )
+/*N*/ nX += pPor->PrtWidth();
+/*N*/ }
+/*N*/ if( pPor->IsMultiPortion() )
+/*N*/ {
+/*N*/ if ( ((SwMultiPortion*)pPor)->HasTabulator() )
+/*N*/ {
+/*?*/ if ( pSpaceAdd )
+/*?*/ {
+/*?*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*?*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*?*/ else
+/*?*/ nSpaceAdd = 0;
+/*?*/ }
+/*?*/
+/*?*/ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+/*?*/ ++nKanaIdx;
+/*N*/ }
+/*N*/
+/*N*/ }
+/*N*/
+/*N*/ aInf.SetIdx( aInf.GetIdx() + pPor->GetLen() );
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pPor->IsMultiPortion() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ #ifdef VERTICAL_LAYOUT
+/*N*/ }
+/*N*/ if ( pPor->PrtWidth() )
+/*N*/ {
+/*N*/ xub_StrLen nOldLen = pPor->GetLen();
+/*N*/ pPor->SetLen( nOfst - aInf.GetIdx() );
+/*N*/ aInf.SetLen( pPor->GetLen() );
+/*N*/ if( nX || !pPor->InNumberGrp() )
+/*N*/ {
+/*N*/ SeekAndChg( aInf );
+/*N*/ const sal_Bool bOldOnWin = aInf.OnWin();
+/*N*/ aInf.SetOnWin( sal_False ); // keine BULLETs!
+/*N*/ SwTwips nTmp = nX;
+/*N*/ aInf.SetKanaComp( pKanaComp );
+/*N*/ aInf.SetKanaIdx( nKanaIdx );
+/*N*/ nX += pPor->GetTxtSize( aInf ).Width();
+/*N*/ aInf.SetOnWin( bOldOnWin );
+/*N*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+/*N*/ nX += pPor->CalcSpacing( nSpaceAdd, aInf );
+/*N*/ if( bWidth )
+/*N*/ {
+/*?*/ pPor->SetLen( pPor->GetLen() + 1 );
+/*?*/ aInf.SetLen( pPor->GetLen() );
+/*?*/ aInf.SetOnWin( sal_False ); // keine BULLETs!
+/*?*/ nTmp += pPor->GetTxtSize( aInf ).Width();
+/*?*/ aInf.SetOnWin( bOldOnWin );
+/*?*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+/*?*/ nTmp += pPor->CalcSpacing(nSpaceAdd, aInf);
+/*?*/ pOrig->Width( nTmp - nX );
+/*N*/ }
+/*N*/ }
+/*N*/ pPor->SetLen( nOldLen );
+/*N*/ }
+/*N*/ bWidth = sal_False;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pPor )
+/*N*/ {
+/*N*/ ASSERT( !pPor->InNumberGrp() || bInsideFirstField, "Number surprise" );
+/*N*/ sal_Bool bEmptyFld = sal_False;
+/*N*/ if( pPor->InFldGrp() && pPor->GetLen() )
+/*N*/ {
+/*N*/ SwFldPortion *pTmp = (SwFldPortion*)pPor;
+/*N*/ while( pTmp->HasFollow() && !pTmp->GetExp().Len() )
+/*N*/ {
+/*?*/ KSHORT nAddX = pTmp->Width();
+/*?*/ SwLinePortion *pNext = pTmp->GetPortion();
+/*?*/ while( pNext && !pNext->InFldGrp() )
+/*?*/ {
+/*?*/ ASSERT( !pNext->GetLen(), "Where's my field follow?" );
+/*?*/ nAddX += pNext->Width();
+/*?*/ pNext = pNext->GetPortion();
+/*?*/ }
+/*?*/ if( !pNext )
+/*?*/ break;
+/*?*/ pTmp = (SwFldPortion*)pNext;
+/*?*/ nPorHeight = pTmp->Height();
+/*?*/ nPorAscent = pTmp->GetAscent();
+/*?*/ nX += nAddX;
+/*?*/ bEmptyFld = sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ // 8513: Felder im Blocksatz, ueberspringen
+/*N*/ while( pPor && !pPor->GetLen() && ! bInsideFirstField &&
+/*N*/ ( pPor->IsFlyPortion() || pPor->IsKernPortion() ||
+/*N*/ pPor->IsBlankPortion() || pPor->InTabGrp() ||
+/*N*/ ( !bEmptyFld && pPor->InFldGrp() ) ) )
+/*N*/ {
+/*?*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+/*?*/ nX += pPor->PrtWidth() +
+/*?*/ pPor->CalcSpacing( nSpaceAdd, aInf );
+/*?*/ else
+/*?*/ {
+/*?*/ if( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() )
+/*?*/ {
+/*?*/ if ( pSpaceAdd )
+/*?*/ {
+/*?*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*?*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*?*/ else
+/*?*/ nSpaceAdd = 0;
+/*?*/ }
+/*?*/
+/*?*/ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+/*?*/ ++nKanaIdx;
+/*?*/ }
+/*?*/ if ( !pPor->IsFlyPortion() || ( pPor->GetPortion() &&
+/*?*/ !pPor->GetPortion()->IsMarginPortion() ) )
+/*?*/ nX += pPor->PrtWidth();
+/*?*/ }
+/*?*/ if( pPor->IsMultiPortion() &&
+/*?*/ ((SwMultiPortion*)pPor)->HasTabulator() )
+/*?*/ {
+/*?*/ if ( pSpaceAdd )
+/*?*/ {
+/*?*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*?*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*?*/ else
+/*?*/ nSpaceAdd = 0;
+/*?*/ }
+/*?*/
+/*?*/ if( pKanaComp && ( nKanaIdx + 1 ) < pKanaComp->Count() )
+/*?*/ ++nKanaIdx;
+/*?*/ }
+/*?*/ if( !pPor->IsFlyPortion() )
+/*?*/ {
+/*?*/ nPorHeight = pPor->Height();
+/*?*/ nPorAscent = pPor->GetAscent();
+/*?*/ }
+/*?*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/
+/*N*/ if( aInf.GetIdx() == nOfst && pPor && pPor->InHyphGrp() &&
+/*N*/ pPor->GetPortion() && pPor->GetPortion()->InFixGrp() )
+/*N*/ {
+/*N*/ // Alle Sonderportions muessen uebersprungen werden
+/*N*/ // Beispiel: zu-[FLY]sammen, 'u' == 19, 's' == 20; Right()
+/*N*/ // Ohne den Ausgleich landen wir vor '-' mit dem
+/*N*/ // Ausgleich vor 's'.
+/*N*/ while( pPor && !pPor->GetLen() )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ nX += pPor->Width();
+/*N*/ if( !pPor->IsMarginPortion() )
+/*N*/ {
+/*N*/ nPorHeight = pPor->Height();
+/*N*/ nPorAscent = pPor->GetAscent();
+/*N*/ }
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ }
+/*N*/ if( pPor && pCMS )
+/*N*/ {
+/*N*/ if( pCMS->bFieldInfo && pPor->InFldGrp() && pPor->Width() )
+/*N*/ pOrig->Width( pPor->Width() );
+/*N*/ if( pPor->IsDropPortion() )
+/*N*/ {
+/*?*/ nPorAscent = ((SwDropPortion*)pPor)->GetDropHeight();
+/*?*/ // The drop height is only calculated, if we have more than
+/*?*/ // one line. Otherwise it is 0.
+/*?*/ if ( ! nPorAscent)
+/*?*/ nPorAscent = pPor->Height();
+/*?*/ nPorHeight = nPorAscent;
+/*?*/ pOrig->Height( nPorHeight +
+/*?*/ ((SwDropPortion*)pPor)->GetDropDescent() );
+/*?*/ if( nTmpHeight < pOrig->Height() )
+/*?*/ {
+/*?*/ nTmpAscent = nPorAscent;
+/*?*/ nTmpHeight = USHORT( pOrig->Height() );
+/*?*/ }
+/*N*/ }
+/*N*/ if( bWidth && pPor->PrtWidth() && pPor->GetLen() &&
+/*N*/ aInf.GetIdx() == nOfst )
+/*N*/ {
+/*?*/ if( !pPor->IsFlyPortion() && pPor->Height() &&
+/*?*/ pPor->GetAscent() )
+/*?*/ {
+/*?*/ nPorHeight = pPor->Height();
+/*?*/ nPorAscent = pPor->GetAscent();
+/*?*/ }
+/*?*/ SwTwips nTmp;
+/*?*/ if( 2 > pPor->GetLen() )
+/*?*/ {
+/*?*/ nTmp = pPor->Width();
+/*?*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+/*?*/ nTmp += pPor->CalcSpacing( nSpaceAdd, aInf );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ const sal_Bool bOldOnWin = aInf.OnWin();
+/*?*/ xub_StrLen nOldLen = pPor->GetLen();
+/*?*/ pPor->SetLen( 1 );
+/*?*/ aInf.SetLen( pPor->GetLen() );
+/*?*/ SeekAndChg( aInf );
+/*?*/ aInf.SetOnWin( sal_False ); // keine BULLETs!
+/*?*/ aInf.SetKanaComp( pKanaComp );
+/*?*/ aInf.SetKanaIdx( nKanaIdx );
+/*?*/ nTmp = pPor->GetTxtSize( aInf ).Width();
+/*?*/ aInf.SetOnWin( bOldOnWin );
+/*?*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+/*?*/ nTmp += pPor->CalcSpacing( nSpaceAdd, aInf );
+/*?*/ pPor->SetLen( nOldLen );
+/*?*/ }
+/*?*/ pOrig->Width( nTmp );
+/*N*/ }
+/*N*/
+/*N*/ // travel inside field portion?
+/*N*/ if ( pCMS->pSpecialPos )
+/*N*/ {
+/*N*/ // apply attributes to font
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ Seek( nOfst );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pOrig->Pos().X() += nX;
+/*N*/
+/*N*/ if ( pCMS && pCMS->bRealHeight )
+/*N*/ {
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ nTmpAscent = AdjustBaseLine( *pCurr, 0, nPorHeight, nPorAscent );
+/*N*/ #else
+/*N*/ nTmpAscent = AdjustBaseLine( *pCurr, nPorHeight, nPorAscent );
+/*N*/ #endif
+/*N*/ if ( nTmpAscent > nPorAscent )
+/*N*/ pCMS->aRealHeight.X() = nTmpAscent - nPorAscent;
+/*N*/ else
+/*N*/ pCMS->aRealHeight.X() = 0;
+/*N*/ ASSERT( nPorHeight, "GetCharRect: Missing Portion-Height" );
+/*N*/ if ( nTmpHeight > nPorHeight )
+/*N*/ pCMS->aRealHeight.Y() = nPorHeight;
+/*N*/ else
+/*N*/ pCMS->aRealHeight.Y() = nTmpHeight;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtCursor::GetCharRect()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
+/*N*/ SwCrsrMoveState* pCMS, const long nMax )
+/*N*/ {
+/*N*/ CharCrsrToLine(nOfst);
+/*N*/
+/*N*/ // Indicates that a position inside a special portion (field, number portion)
+/*N*/ // is requested.
+/*N*/ const sal_Bool bSpecialPos = pCMS && pCMS->pSpecialPos;
+/*N*/ xub_StrLen nFindOfst = nOfst;
+/*N*/
+/*N*/ if ( bSpecialPos )
+/*N*/ {
+/*?*/ xub_StrLen nLineOfst = pCMS->pSpecialPos->nLineOfst;
+/*?*/ BYTE nExtendRange = pCMS->pSpecialPos->nExtendRange;
+/*?*/
+/*?*/ ASSERT( ! nLineOfst || SP_EXTEND_RANGE_BEFORE != nExtendRange,
+/*?*/ "LineOffset AND Number Portion?" )
+/*?*/
+/*?*/ // portions which are behind the string
+/*?*/ if ( SP_EXTEND_RANGE_BEHIND == nExtendRange )
+/*?*/ ++nFindOfst;
+/*?*/
+/*?*/ // skip lines for fields which cover more than one line
+/*?*/ for ( USHORT i = 0; i < pCMS->pSpecialPos->nLineOfst; i++ )
+/*?*/ Next();
+/*N*/ }
+/*N*/
+/*N*/ // Adjustierung ggf. nachholen
+/*N*/ GetAdjusted();
+/*N*/
+/*N*/ const Point aCharPos( GetTopLeft() );
+/*N*/ sal_Bool bRet = sal_True;
+/*N*/
+/*N*/ _GetCharRect( pOrig, nFindOfst, pCMS );
+/*N*/
+/*N*/ const SwTwips nRight = Right() - 12;
+/*N*/
+/*N*/ pOrig->Pos().X() += aCharPos.X();
+/*N*/ pOrig->Pos().Y() += aCharPos.Y();
+/*N*/
+/*N*/ if( pCMS && pCMS->b2Lines && pCMS->p2Lines )
+/*N*/ {
+/*?*/ pCMS->p2Lines->aLine.Pos().X() += aCharPos.X();
+/*?*/ pCMS->p2Lines->aLine.Pos().Y() += aCharPos.Y();
+/*?*/ pCMS->p2Lines->aPortion.Pos().X() += aCharPos.X();
+/*?*/ pCMS->p2Lines->aPortion.Pos().Y() += aCharPos.Y();
+/*N*/ }
+/*N*/
+/*N*/ if( pOrig->Left() > nRight )
+/*?*/ pOrig->Pos().X() = nRight;
+/*N*/
+/*N*/ if( nMax )
+/*N*/ {
+/*N*/
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ if( pOrig->Top() + pOrig->Height() > nMax )
+/*N*/ {
+/*N*/ if( pOrig->Top() > nMax )
+/*N*/ pOrig->Top( nMax );
+/*N*/ pOrig->Height( nMax - pOrig->Top() );
+/*N*/ #else
+/*N*/ if( pOrig->Bottom() > nMax )
+/*N*/ {
+/*N*/ if( pOrig->Top() > nMax )
+/*N*/ pOrig->Top( nMax );
+/*N*/ pOrig->Bottom( nMax );
+/*N*/ #endif
+/*N*/ }
+/*N*/ if ( pCMS && pCMS->bRealHeight && pCMS->aRealHeight.Y() >= 0 )
+/*N*/ {
+/*N*/ long nTmp = pCMS->aRealHeight.X() + pOrig->Top();
+/*N*/ if( nTmp >= nMax )
+/*N*/ {
+/*?*/ pCMS->aRealHeight.X() = nMax - pOrig->Top();
+/*?*/ pCMS->aRealHeight.Y() = 0;
+/*N*/ }
+/*N*/ else if( nTmp + pCMS->aRealHeight.Y() > nMax )
+/*?*/ pCMS->aRealHeight.Y() = nMax - nTmp;
+/*N*/ }
+/*N*/ }
+/*N*/ long nOut = pOrig->Right() - GetTxtFrm()->Frm().Right();
+/*N*/ if( nOut > 0 )
+/*N*/ {
+/*N*/ if( GetTxtFrm()->Frm().Width() < GetTxtFrm()->Prt().Left()
+/*N*/ + GetTxtFrm()->Prt().Width() )
+/*?*/ nOut += GetTxtFrm()->Frm().Width() - GetTxtFrm()->Prt().Left()
+/*?*/ - GetTxtFrm()->Prt().Width();
+/*N*/ if( nOut > 0 )
+/*?*/ pOrig->Pos().X() -= nOut + 10;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtCursor::GetCrsrOfst()
+ *
+ * Return: Offset im String
+ *************************************************************************/
+/*N*/ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
+/*N*/ const MSHORT nChgNode, const SwCrsrMoveState* pCMS ) const
+/*N*/ {
+/*N*/ // Adjustierung ggf. nachholen
+/*N*/ GetAdjusted();
+/*N*/
+/*N*/ const XubString &rText = GetInfo().GetTxt();
+/*N*/ xub_StrLen nOffset = 0;
+/*N*/
+/*N*/ // x ist der horizontale Offset innerhalb der Zeile.
+/*N*/ SwTwips x = rPoint.X();
+/*N*/ CONST SwTwips nLeftMargin = GetLineStart();
+/*N*/ SwTwips nRightMargin = GetLineEnd();
+/*N*/ if( nRightMargin == nLeftMargin )
+/*N*/ nRightMargin += 30;
+/*N*/
+/*N*/ const sal_Bool bLeftOver = x < nLeftMargin;
+/*N*/ if( bLeftOver )
+/*N*/ x = nLeftMargin;
+/*N*/ const sal_Bool bRightOver = x > nRightMargin;
+/*N*/ if( bRightOver )
+/*N*/ x = nRightMargin;
+/*N*/
+/*N*/ sal_Bool bRightAllowed = pCMS && ( pCMS->eState == MV_NONE );
+/*N*/
+/*N*/ // Bis hierher in Dokumentkoordinaten.
+/*N*/ x -= nLeftMargin;
+/*N*/
+/*N*/ KSHORT nX = KSHORT( x );
+/*N*/
+/*N*/ // Wenn es in der Zeile Attributwechsel gibt, den Abschnitt
+/*N*/ // suchen, in dem nX liegt.
+/*N*/ SwLinePortion *pPor = pCurr->GetFirstPortion();
+/*N*/ xub_StrLen nCurrStart = nStart;
+/*N*/ sal_Bool bLastPortion;
+/*N*/ sal_Bool bHolePortion = sal_False;
+/*N*/ sal_Bool bLastHyph = sal_False;
+/*N*/
+/*N*/ SvShorts *pSpaceAdd = pCurr->GetpSpaceAdd();
+/*N*/ SvUShorts *pKanaComp = pCurr->GetpKanaComp();
+/*N*/ xub_StrLen nOldIdx = GetInfo().GetIdx();
+/*N*/ MSHORT nSpaceIdx = 0;
+/*N*/ MSHORT nKanaIdx = 0;
+/*N*/ short nSpaceAdd = pSpaceAdd ? (*pSpaceAdd)[0] : 0;
+/*N*/ short nKanaComp = pKanaComp ? (*pKanaComp)[0] : 0;
+/*N*/
+/*N*/ // nWidth ist die Breite der Zeile, oder die Breite des
+/*N*/ // Abschnitts mit dem Fontwechsel, in dem nX liegt.
+/*N*/
+/*N*/ KSHORT nWidth = pPor->Width();
+/*N*/ if ( pSpaceAdd || pKanaComp )
+/*N*/ {
+/*?*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+/*?*/ {
+/*?*/ ((SwTxtSizeInfo&)GetInfo()).SetIdx( nCurrStart );
+/*?*/ nWidth += USHORT( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) );
+/*?*/ }
+/*?*/ if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
+/*?*/ ( pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->HasTabulator() )
+/*?*/ )
+/*?*/ {
+/*?*/ if ( pSpaceAdd )
+/*?*/ {
+/*?*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*?*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*?*/ else
+/*?*/ nSpaceAdd = 0;
+/*?*/ }
+/*?*/
+/*?*/ if( pKanaComp )
+/*?*/ {
+/*?*/ if ( nKanaIdx + 1 < pKanaComp->Count() )
+/*?*/ nKanaComp = (*pKanaComp)[++nKanaIdx];
+/*?*/ else
+/*?*/ nKanaComp = 0;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ KSHORT nWidth30;
+/*N*/ if ( pPor->IsPostItsPortion() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nWidth30 = 30 + pPor->GetViewWidth( GetInfo() ) / 2;
+/*N*/ else
+/*N*/ nWidth30 = ! nWidth && pPor->GetLen() && pPor->InToxRefOrFldGrp() ?
+/*N*/ 30 :
+/*N*/ nWidth;
+/*N*/
+/*N*/ while(!(bLastPortion = (0 == pPor->GetPortion())) && nWidth30 < nX &&
+/*N*/ !pPor->IsBreakPortion() )
+/*N*/ {
+/*?*/ nX -= nWidth;
+/*?*/ nCurrStart += pPor->GetLen();
+/*?*/ bHolePortion = pPor->IsHolePortion();
+/*?*/ pPor = pPor->GetPortion();
+/*?*/ nWidth = pPor->Width();
+/*?*/ if ( pSpaceAdd || pKanaComp )
+/*?*/ {
+/*?*/ if ( pPor->InSpaceGrp() && nSpaceAdd )
+/*?*/ {
+/*?*/ ((SwTxtSizeInfo&)GetInfo()).SetIdx( nCurrStart );
+/*?*/ nWidth += USHORT( pPor->CalcSpacing( nSpaceAdd, GetInfo() ) );
+/*?*/ }
+/*?*/
+/*?*/ if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
+/*?*/ ( pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->HasTabulator() )
+/*?*/ )
+/*?*/ {
+/*?*/ if ( pSpaceAdd )
+/*?*/ {
+/*?*/ if ( ++nSpaceIdx < pSpaceAdd->Count() )
+/*?*/ nSpaceAdd = (*pSpaceAdd)[nSpaceIdx];
+/*?*/ else
+/*?*/ nSpaceAdd = 0;
+/*?*/ }
+/*?*/
+/*?*/ if ( pKanaComp )
+/*?*/ {
+/*?*/ if( nKanaIdx + 1 < pKanaComp->Count() )
+/*?*/ nKanaComp = (*pKanaComp)[++nKanaIdx];
+/*?*/ else
+/*?*/ nKanaComp = 0;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ if ( pPor->IsPostItsPortion() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nWidth30 = 30 + pPor->GetViewWidth( GetInfo() ) / 2;
+/*?*/ else
+/*?*/ nWidth30 = ! nWidth && pPor->GetLen() && pPor->InToxRefOrFldGrp() ?
+/*?*/ 30 :
+/*?*/ nWidth;
+/*?*/ if( !pPor->IsFlyPortion() && !pPor->IsMarginPortion() )
+/*?*/ bLastHyph = pPor->InHyphGrp();
+/*N*/ }
+/*N*/
+/*N*/ if( nX==nWidth )
+/*N*/ {
+/*N*/ SwLinePortion *pNextPor = pPor->GetPortion();
+/*N*/ while( pNextPor && pNextPor->InFldGrp() && !pNextPor->Width() )
+/*N*/ {
+/*?*/ nCurrStart += pPor->GetLen();
+/*?*/ pPor = pNextPor;
+/*?*/ if( !pPor->IsFlyPortion() && !pPor->IsMarginPortion() )
+/*?*/ bLastHyph = pPor->InHyphGrp();
+/*?*/ pNextPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ ((SwTxtSizeInfo&)GetInfo()).SetIdx( nOldIdx );
+/*N*/
+/*N*/ xub_StrLen nLength = pPor->GetLen();
+/*N*/
+/*N*/ sal_Bool bFieldInfo = pCMS && pCMS->bFieldInfo;
+/*N*/
+/*N*/ if( bFieldInfo && ( nWidth30 < nX || bRightOver || bLeftOver ||
+/*N*/ ( pPor->InNumberGrp() && !pPor->IsFtnNumPortion() ) ||
+/*N*/ ( pPor->IsMarginPortion() && nWidth > nX + 30 ) ) )
+/*?*/ ((SwCrsrMoveState*)pCMS)->bPosCorr = sal_True;
+/*N*/
+/*N*/ // 7684: Wir sind genau auf der HyphPortion angelangt und muessen dafuer
+/*N*/ // sorgen, dass wir in dem String landen.
+/*N*/ // 7993: Wenn die Laenge 0 ist muessen wir raus...
+/*N*/ if( !nLength )
+/*N*/ {
+/*N*/ if( pCMS )
+/*N*/ {
+/*N*/ if( pPor->IsFlyPortion() && bFieldInfo )
+/*?*/ ((SwCrsrMoveState*)pCMS)->bPosCorr = sal_True;
+/*N*/
+/*N*/ if( pPor->IsFtnNumPortion() && !bRightOver && nX )
+/*?*/ ((SwCrsrMoveState*)pCMS)->bFtnNoInfo = sal_True;
+/*N*/ }
+/*N*/ if( !nCurrStart )
+/*N*/ return 0;
+/*N*/
+/*N*/ // 7849, 7816: auf pPor->GetHyphPortion kann nicht verzichtet werden!
+/*N*/ if( bHolePortion || ( !bRightAllowed && bLastHyph ) ||
+/*N*/ ( pPor->IsMarginPortion() && !pPor->GetPortion() &&
+/*N*/ // 46598: In der letzten Zeile eines zentrierten Absatzes wollen
+/*N*/ // wir auch mal hinter dem letzten Zeichen landen.
+/*?*/ nCurrStart < rText.Len() ) )
+/*?*/ --nCurrStart;
+/*N*/ else if( pPor->InFldGrp() && ((SwFldPortion*)pPor)->IsFollow()
+/*N*/ && nWidth > nX )
+/*N*/ {
+/*?*/ if( bFieldInfo )
+/*?*/ --nCurrStart;
+/*?*/ else
+/*?*/ {
+/*?*/ KSHORT nHeight = pPor->Height();
+/*?*/ if ( !nHeight || nHeight > nWidth )
+/*?*/ nHeight = nWidth;
+/*?*/ if( nChgNode && nWidth - nHeight/2 > nX )
+/*?*/ --nCurrStart;
+/*?*/ }
+/*N*/ }
+/*N*/ return nCurrStart;
+/*N*/ }
+/*N*/ if ( 1 == nLength )
+/*N*/ {
+/*?*/ if ( nWidth )
+/*?*/ {
+/*?*/ // Sonst kommen wir nicht mehr in zeichengeb. Rahmen hinein...
+/*?*/ if( !( nChgNode && pPos && pPor->IsFlyCntPortion() ) )
+/*?*/ {
+/*?*/ if ( pPor->InFldGrp() ||
+/*?*/ ( pPor->IsMultiPortion() &&
+/*?*/ ((SwMultiPortion*)pPor)->IsBidi() ) )
+/*?*/ {
+/*?*/ KSHORT nHeight = 0;
+/*?*/ if( !bFieldInfo )
+/*?*/ {
+/*?*/ nHeight = pPor->Height();
+/*?*/ if ( !nHeight || nHeight > nWidth )
+/*?*/ nHeight = nWidth;
+/*?*/ }
+/*?*/ if( nWidth - nHeight/2 <= nX &&
+/*?*/ ( ! pPor->InFldGrp() ||
+/*?*/ !((SwFldPortion*)pPor)->HasFollow() ) )
+/*?*/ ++nCurrStart;
+/*?*/ }
+/*?*/ else if ( ( !pPor->IsFlyPortion() || ( pPor->GetPortion() &&
+/*?*/ !pPor->GetPortion()->IsMarginPortion() &&
+/*?*/ !pPor->GetPortion()->IsHolePortion() ) )
+/*?*/ && ( nWidth/2 < nX ) &&
+/*?*/ ( !bFieldInfo ||
+/*?*/ ( pPor->GetPortion() &&
+/*?*/ pPor->GetPortion()->IsPostItsPortion() ) )
+/*?*/ && ( bRightAllowed || !bLastHyph ))
+/*?*/ ++nCurrStart;
+/*?*/ return nCurrStart;
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ if ( pPor->IsPostItsPortion() || pPor->IsBreakPortion() ||
+/*?*/ pPor->InToxRefGrp() )
+/*?*/ return nCurrStart;
+/*?*/ if ( pPor->InFldGrp() )
+/*?*/ {
+/*?*/ if( bRightOver && !((SwFldPortion*)pPor)->HasFollow() )
+/*?*/ ++nCurrStart;
+/*?*/ return nCurrStart;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bLastPortion && (pCurr->GetNext() || pFrm->GetFollow() ) )
+/*N*/ --nLength;
+/*N*/
+/*N*/ if( nWidth > nX ||
+/*N*/ ( nWidth == nX && pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->IsDouble() ) )
+/*N*/ {
+/*N*/ if( pPor->IsMultiPortion() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ // In a multi-portion we use GetCrsrOfst()-function recursively
+/*N*/ }
+/*N*/ if( pPor->InTxtGrp() )
+/*N*/ {
+/*N*/ BYTE nOldProp;
+/*N*/ if( GetPropFont() )
+/*N*/ {
+/*?*/ ((SwFont*)GetFnt())->SetProportion( GetPropFont() );
+/*?*/ nOldProp = GetFnt()->GetPropr();
+/*N*/ }
+/*N*/ else
+/*N*/ nOldProp = 0;
+/*N*/ {
+/*N*/ SwTxtSizeInfo aSizeInf( GetInfo(), rText, nCurrStart );
+/*N*/ ((SwTxtCursor*)this)->SeekAndChg( aSizeInf );
+/*N*/ SwTxtSlot aDiffTxt( &aSizeInf, ((SwTxtPortion*)pPor) );
+/*N*/ SwFontSave aSave( aSizeInf, pPor->IsDropPortion() ?
+/*N*/ ((SwDropPortion*)pPor)->GetFnt() : NULL );
+/*N*/
+/*N*/ SwParaPortion* pPara = (SwParaPortion*)GetInfo().GetParaPortion();
+/*N*/ ASSERT( pPara, "No paragraph!" );
+/*N*/
+/*N*/ SwDrawTextInfo aDrawInf( aSizeInf.GetVsh(),
+/*N*/ *aSizeInf.GetOut(),
+/*N*/ &pPara->GetScriptInfo(),
+/*N*/ aSizeInf.GetTxt(),
+/*N*/ aSizeInf.GetIdx(),
+/*N*/ pPor->GetLen() );
+/*N*/ aDrawInf.SetOfst( nX );
+/*N*/ aDrawInf.SetSpace( nSpaceAdd );
+/*N*/ aDrawInf.SetFont( aSizeInf.GetFont() );
+/*N*/ aDrawInf.SetFrm( pFrm );
+/*N*/ aDrawInf.SetSnapToGrid( aSizeInf.SnapToGrid() );
+/*N*/ aDrawInf.SetPosMatchesBounds( pCMS && pCMS->bPosMatchesBounds );
+/*N*/
+/*N*/ if ( SW_CJK == aSizeInf.GetFont()->GetActual() &&
+/*N*/ pPara->GetScriptInfo().CountCompChg() &&
+/*N*/ ! pPor->InFldGrp() )
+/*?*/ aDrawInf.SetKanaComp( nKanaComp );
+/*N*/
+/*N*/ nLength = aSizeInf.GetFont()->_GetCrsrOfst( aDrawInf );
+/*N*/
+/*N*/ if ( pCMS )
+/*N*/ ((SwCrsrMoveState*)pCMS)->nCursorBidiLevel =
+/*N*/ aDrawInf.GetCursorBidiLevel();
+/*N*/
+/*N*/ if( bFieldInfo && nLength == pPor->GetLen() &&
+/*N*/ ( ! pPor->GetPortion() ||
+/*N*/ ! pPor->GetPortion()->IsPostItsPortion() ) )
+/*N*/ --nLength;
+/*N*/ }
+/*N*/ if( nOldProp )
+/*?*/ ((SwFont*)GetFnt())->SetProportion( nOldProp );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( nChgNode && pPos && pPor->IsFlyCntPortion()
+/*N*/ && !( (SwFlyCntPortion*)pPor )->IsDraw() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*N*/ {
+/*N*/ }
+/*N*/ }
+/*N*/ nOffset = nCurrStart + nLength;
+/*N*/
+/*N*/ // 7684: Wir sind vor der HyphPortion angelangt und muessen dafuer
+/*N*/ // sorgen, dass wir in dem String landen.
+/*N*/ // Bei Zeilenenden vor FlyFrms muessen ebenso behandelt werden.
+/*N*/
+/*N*/ if( nOffset && pPor->GetLen() == nLength && pPor->GetPortion() &&
+/*N*/ !pPor->GetPortion()->GetLen() && pPor->GetPortion()->InHyphGrp() )
+/*N*/ --nOffset;
+/*N*/
+/*N*/ return nOffset;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_itrform2.cxx b/binfilter/bf_sw/source/core/text/sw_itrform2.cxx
new file mode 100644
index 000000000000..2a974ccbcf2a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_itrform2.cxx
@@ -0,0 +1,1871 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+
+#include <bf_svx/lspcitem.hxx>
+
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+#include <ftninfo.hxx>
+#include <charfmt.hxx>
+#include <bf_svx/charrotateitem.hxx>
+#include <paratr.hxx> // SwFmtDrop
+#include <hintids.hxx> // CH_TXTATR
+#include <txtcfg.hxx>
+#include <itrform2.hxx>
+#include <portab.hxx> // pLastTab->
+#include <porfly.hxx> // CalcFlyWidth
+#include <portox.hxx> // WhichTxtPortion
+#include <porref.hxx> // WhichTxtPortion
+
+#include <horiornt.hxx>
+
+#include <porftn.hxx> // SwFtnPortion
+#include <porhyph.hxx>
+#include <guess.hxx>
+#include <ftnfrm.hxx> // WhichFirstPortion() -> mal Verlagern.
+
+#include <pagefrm.hxx>
+#include <pagedesc.hxx> // SwPageDesc
+#include <tgrditem.hxx>
+
+#include <doc.hxx> // SwDoc
+#include <pormulti.hxx> // SwMultiPortion
+#define _SVSTDARR_LONGS
+#include <bf_svtools/svstdarr.hxx>
+#include <unotools/charclass.hxx>
+
+#if OSL_DEBUG_LEVEL > 1
+#endif
+namespace binfilter {
+
+using namespace ::com::sun::star::i18n;
+extern BYTE WhichFont( xub_StrLen nIdx, const String* pTxt,
+ const SwScriptInfo* pSI );
+
+extern sal_Bool IsUnderlineBreak( const SwLinePortion& rPor, const SwFont& rFnt );
+
+#define MAX_TXTPORLEN 300
+
+/*N*/ inline void ClearFly( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if( rInf.GetFly() )
+/*N*/ {
+/*N*/ delete rInf.GetFly();
+/*N*/ rInf.SetFly(0);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CtorInit()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::CtorInit( SwTxtFrm *pFrm, SwTxtFormatInfo *pNewInf )
+/*N*/ {
+/*N*/ SwTxtPainter::CtorInit( pFrm, pNewInf );
+/*N*/ pInf = pNewInf;
+/*N*/ pDropFmt = GetInfo().GetDropFmt();
+/*N*/ pMulti = NULL;
+/*N*/
+/*N*/ bOnceMore = sal_False;
+/*N*/ bChanges = sal_False;
+/*N*/ bTruncLines = sal_False;
+/*N*/ nCntEndHyph = 0;
+/*N*/ nCntMidHyph = 0;
+/*N*/ nLeftScanIdx = STRING_LEN;
+/*N*/ nRightScanIdx = 0;
+/*N*/
+/*N*/ if( nStart > GetInfo().GetTxt().Len() )
+/*N*/ {
+/*?*/ ASSERT( !this, "+SwTxtFormatter::CTOR: bad offset" );
+/*?*/ nStart = GetInfo().GetTxt().Len();
+/*N*/ }
+/*N*/
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::DTOR
+ *************************************************************************/
+
+/*N*/ SwTxtFormatter::~SwTxtFormatter()
+/*N*/ {
+/*N*/ // Auesserst unwahrscheinlich aber denkbar.
+/*N*/ // z.B.: Feld spaltet sich auf, Widows schlagen zu
+/*N*/ if( GetInfo().GetRest() )
+/*N*/ {
+/*?*/ delete GetInfo().GetRest();
+/*?*/ GetInfo().SetRest(0);
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::Insert()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::Insert( SwLineLayout *pLay )
+/*N*/ {
+/*N*/ // Einfuegen heute mal ausnahmsweise hinter dem aktuellen Element.
+/*N*/ if ( pCurr )
+/*N*/ {
+/*N*/ pLay->SetNext( pCurr->GetNext() );
+/*N*/ pCurr->SetNext( pLay );
+/*N*/ }
+/*N*/ else
+/*N*/ pCurr = pLay;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::GetFrmRstHeight()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFormatter::UnderFlow()
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwTxtFormatter::UnderFlow( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ // Werte sichern und rInf initialisieren.
+/*N*/ SwLinePortion *pUnderFlow = rInf.GetUnderFlow();
+/*N*/ if( !pUnderFlow )
+/*N*/ return 0;
+/*N*/
+/*N*/ // Wir formatieren rueckwaerts, d.h. dass Attributwechsel in der
+/*N*/ // naechsten Zeile durchaus noch einmal drankommen koennen.
+/*N*/ // Zu beobachten in 8081.sdw, wenn man in der ersten Zeile Text eingibt.
+/*N*/
+/*N*/ const xub_StrLen nSoftHyphPos = rInf.GetSoftHyphPos();
+/*N*/ const xub_StrLen nUnderScorePos = rInf.GetUnderScorePos();
+/*N*/
+/*N*/ // 8358, 8359: Flys sichern und auf 0 setzen, sonst GPF
+/*N*/ // 3983: Nicht ClearFly(rInf) !
+/*N*/ SwFlyPortion *pFly = rInf.GetFly();
+/*N*/ rInf.SetFly( 0 );
+/*N*/
+/*N*/ FeedInf( rInf );
+/*N*/ rInf.SetLast( pCurr );
+/*N*/ // pUnderFlow braucht nicht deletet werden, weil es im folgenden
+/*N*/ // Truncate() untergehen wird.
+/*N*/ rInf.SetUnderFlow(0);
+/*N*/ rInf.SetSoftHyphPos( nSoftHyphPos );
+/*N*/ rInf.SetUnderScorePos( nUnderScorePos );
+/*N*/ rInf.SetPaintOfst( GetLeftMargin() );
+/*N*/
+/*N*/ // Wir suchen die Portion mit der Unterlaufposition
+/*N*/ SwLinePortion *pPor = pCurr->GetFirstPortion();
+/*N*/ if( pPor != pUnderFlow )
+/*N*/ {
+/*N*/ // pPrev wird die letzte Portion vor pUnderFlow,
+/*N*/ // die noch eine echte Breite hat.
+/*N*/ // Ausnahme: SoftHyphPortions duerfen dabei natuerlich
+/*N*/ // nicht vergessen werden, obwohl sie keine Breite haben.
+/*N*/ SwLinePortion *pPrev = pPor;
+/*N*/ while( pPor && pPor != pUnderFlow )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ if( !pPor->IsKernPortion() &&
+/*N*/ ( pPor->Width() || pPor->IsSoftHyphPortion() ) )
+/*N*/ {
+/*N*/ while( pPrev != pPor )
+/*N*/ {
+/*N*/ pPrev->Move( rInf );
+/*N*/ rInf.SetLast( pPrev );
+/*N*/ pPrev = pPrev->GetPortion();
+/*N*/ ASSERT( pPrev, "UnderFlow: Loosing control!" );
+/*N*/ };
+/*N*/ }
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ pPor = pPrev;
+/*N*/ if( pPor && // Flies + Initialen werden nicht beim UnderFlow mitgenommen
+/*N*/ ( pPor->IsFlyPortion() || pPor->IsDropPortion() ||
+/*N*/ pPor->IsFlyCntPortion() ) )
+/*N*/ {
+/*N*/ pPor->Move( rInf );
+/*N*/ rInf.SetLast( pPor );
+/*N*/ rInf.SetStopUnderFlow( sal_True );
+/*N*/ pPor = pUnderFlow;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Was? Die Unterlaufsituation ist nicht in der Portion-Kette ?
+/*N*/ ASSERT( pPor, "SwTxtFormatter::UnderFlow: overflow but underflow" );
+/*N*/
+/*N*/ if( rInf.IsFtnInside() && pPor && !rInf.IsQuick() )
+/*N*/ {
+/*?*/ SwLinePortion *pTmp = pPor->GetPortion();
+/*?*/ while( pTmp )
+/*?*/ {
+/*?*/ if( pTmp->IsFtnPortion() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ ((SwFtnPortion*)pTmp)->ClearFtn();
+/*?*/ pTmp = pTmp->GetPortion();
+/*?*/ }
+/*N*/ }
+/*N*/
+ /*-----------------14.12.94 09:45-------------------
+ * 9849: Schnellschuss
+ * --------------------------------------------------*/
+/*N*/ if ( pPor==rInf.GetLast() )
+/*N*/ {
+/*N*/ // Hier landen wir, wenn die UnderFlow-ausloesende Portion sich
+/*N*/ // ueber die ganze Zeile erstreckt, z. B. wenn ein Wort ueber
+/*N*/ // mehrere Zeilen geht und in der zweiten Zeile in einen Fly
+/*N*/ // hineinlaeuft!
+/*?*/ rInf.SetFly( pFly ); // wg. 28300
+/*?*/ pPor->Truncate();
+/*?*/ return pPor; // Reicht das?
+/*N*/ }
+ /*---------------------------------------------------
+ * Ende des Schnellschusses wg. 9849
+ * --------------------------------------------------*/
+/*N*/
+/*N*/ // 4656: X + Width == 0 bei SoftHyph > Zeile ?!
+/*N*/ if( !pPor || !(rInf.X() + pPor->Width()) )
+/*N*/ {
+/*?*/ delete pFly;
+/*?*/ return 0;
+/*N*/ }
+/*N*/
+/*N*/ // Vorbereitungen auf's Format()
+/*N*/ // Wir muessen die Kette hinter pLast abknipsen, weil
+/*N*/ // nach dem Format() ein Insert erfolgt.
+/*N*/ SeekAndChg( rInf );
+/*N*/
+/*N*/ // line width is adjusted, so that pPor does not fit to current
+/*N*/ // line anymore
+/*N*/ rInf.Width( (USHORT)(rInf.X() + (pPor->Width() ? pPor->Width() - 1 : 0)) );
+/*N*/ rInf.SetLen( pPor->GetLen() );
+/*N*/ rInf.SetFull( sal_False );
+/*N*/ if( pFly )
+/*N*/ {
+/*N*/ // Aus folgendem Grund muss die FlyPortion neu berechnet werden:
+/*N*/ // Wenn durch einen grossen Font in der Mitte der Zeile die Grundlinie
+/*N*/ // abgesenkt wird und dadurch eine Ueberlappung mit eine Fly entsteht,
+/*N*/ // so hat die FlyPortion eine falsche Groesse/Fixsize.
+/*N*/ rInf.SetFly( pFly );
+/*N*/ CalcFlyWidth( rInf );
+/*N*/ }
+/*N*/ rInf.GetLast()->SetPortion(0);
+/*N*/
+/*N*/ // Eine Ausnahme bildet das SwLineLayout, dass sich beim
+/*N*/ // ersten Portionwechsel aufspaltet. Hier nun der umgekehrte Weg:
+/*N*/ if( rInf.GetLast() == pCurr )
+/*N*/ {
+/*N*/ if( pPor->InTxtGrp() && !pPor->InExpGrp() )
+/*N*/ {
+/*N*/ MSHORT nOldWhich = pCurr->GetWhichPor();
+/*N*/ *(SwLinePortion*)pCurr = *pPor;
+/*N*/ pCurr->SetPortion( pPor->GetPortion() );
+/*N*/ pCurr->SetWhichPor( nOldWhich );
+/*N*/ pPor->SetPortion( 0 );
+/*N*/ delete pPor;
+/*N*/ pPor = pCurr;
+/*N*/ }
+/*N*/ }
+/*N*/ pPor->Truncate();
+/*N*/ delete rInf.GetRest();
+/*N*/ rInf.SetRest(0);
+/*N*/ return pPor;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::InsertPortion()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::InsertPortion( SwTxtFormatInfo &rInf,
+/*N*/ SwLinePortion *pPor ) const
+/*N*/ {
+/*N*/ // Die neue Portion wird eingefuegt,
+/*N*/ // bei dem LineLayout ist allerdings alles anders...
+/*N*/ if( pPor == pCurr )
+/*N*/ {
+/*N*/ if( pCurr->GetPortion() )
+/*N*/ pPor = pCurr->GetPortion();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwLinePortion *pLast = rInf.GetLast();
+/*N*/ if( pLast->GetPortion() )
+/*N*/ {
+/*?*/ while( pLast->GetPortion() )
+/*?*/ pLast = pLast->GetPortion();
+/*?*/ rInf.SetLast( pLast );
+/*N*/ }
+/*N*/ pLast->Insert( pPor );
+/*N*/
+/*N*/ // Maxima anpassen:
+/*N*/ if( pCurr->Height() < pPor->Height() )
+/*N*/ pCurr->Height( pPor->Height() );
+/*N*/ if( pCurr->GetAscent() < pPor->GetAscent() )
+/*N*/ pCurr->SetAscent( pPor->GetAscent() );
+/*N*/ }
+/*N*/
+/*N*/ // manchmal werden ganze Ketten erzeugt (z.B. durch Hyphenate)
+/*N*/ rInf.SetLast( pPor );
+/*N*/ while( pPor )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ pPor->Move( rInf );
+/*N*/ rInf.SetLast( pPor );
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::BuildPortion()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ ASSERT( rInf.GetTxt().Len() < STRING_LEN,
+/*N*/ "SwTxtFormatter::BuildPortions: bad text length in info" );
+/*N*/
+/*N*/ rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
+/*N*/
+/*N*/ // Erst NewTxtPortion() entscheidet, ob pCurr in pPor landet.
+/*N*/ // Wir muessen in jedem Fall dafuer sorgen, dass der Font eingestellt
+/*N*/ // wird. In CalcAscent geschieht dies automatisch.
+/*N*/ rInf.SetLast( pCurr );
+/*N*/ rInf.ForcedLeftMargin( 0 );
+/*N*/
+/*N*/ ASSERT( pCurr->FindLastPortion() == pCurr, "pLast supposed to equal pCurr" );
+/*N*/
+/*N*/ if( !pCurr->GetAscent() && !pCurr->Height() )
+/*N*/ CalcAscent( rInf, pCurr );
+/*N*/
+/*N*/ SeekAndChg( rInf );
+/*N*/
+/*N*/ // In CalcFlyWidth wird Width() verkuerzt, wenn eine FlyPortion vorliegt.
+/*N*/ ASSERT( !rInf.X() || pMulti, "SwTxtFormatter::BuildPortion X=0?" );
+/*N*/ CalcFlyWidth( rInf );
+/*N*/ SwFlyPortion *pFly = rInf.GetFly();
+/*N*/ if( pFly )
+/*N*/ {
+/*N*/ if ( 0 < pFly->Fix() )
+/*N*/ ClearFly( rInf );
+/*N*/ else
+/*N*/ rInf.SetFull(sal_True);
+/*N*/ }
+/*N*/
+/*N*/ SwLinePortion *pPor = NewPortion( rInf );
+/*N*/
+ // Asian grid stuff
+/*N*/ GETGRID( pFrm->FindPageFrm() )
+/*N*/ const sal_Bool bHasGrid = pGrid && rInf.SnapToGrid() &&
+/*N*/ GRID_LINES_CHARS == pGrid->GetGridType();
+/*N*/
+/*N*/ const USHORT nGridWidth = bHasGrid ?
+/*N*/ pGrid->GetBaseHeight() : 0;
+/*N*/
+/*N*/ // used for grid mode only:
+/*N*/ // the pointer is stored, because after formatting of non-asian text,
+/*N*/ // the width of the kerning portion has to be adjusted
+/*N*/ SwKernPortion* pGridKernPortion = 0;
+/*N*/
+/*N*/ sal_Bool bFull;
+/*N*/ SwTwips nUnderLineStart = 0;
+/*N*/ rInf.Y( Y() );
+/*N*/
+/*N*/ while( pPor && !rInf.IsStop() )
+/*N*/ {
+/*N*/ ASSERT( rInf.GetLen() < STRING_LEN &&
+/*N*/ rInf.GetIdx() <= rInf.GetTxt().Len(),
+/*N*/ "SwTxtFormatter::BuildPortions: bad length in info" );
+///*N*/ DBG_LOOP;
+/*N*/
+/*N*/ // We have to check the script for fields in order to set the
+/*N*/ // correct nActual value for the font.
+/*N*/ if( pPor->InFldGrp() && ! pPor->IsFtnPortion() )
+/*N*/ ((SwFldPortion*)pPor)->CheckScript( rInf );
+/*N*/
+/*N*/ if( ! bHasGrid && rInf.HasScriptSpace() &&
+/*N*/ rInf.GetLast() && rInf.GetLast()->InTxtGrp() &&
+/*N*/ rInf.GetLast()->Width() && !rInf.GetLast()->InNumberGrp() )
+/*N*/ {
+/*N*/ BYTE nNxtActual = rInf.GetFont()->GetActual();
+/*N*/ BYTE nLstActual = nNxtActual;
+/*N*/ USHORT nLstHeight = (USHORT)rInf.GetFont()->GetHeight();
+/*N*/ sal_Bool bAllowBefore = sal_False;
+/*N*/ sal_Bool bAllowBehind = sal_False;
+/*N*/ const CharClass& rCC = GetAppCharClass();
+/*N*/
+/*N*/ // are there any punctuation characters on both sides
+/*N*/ // of the kerning portion?
+/*N*/ if ( pPor->InFldGrp() )
+/*N*/ {
+/*N*/ XubString aAltTxt;
+/*N*/ if ( ((SwFldPortion*)pPor)->GetExpTxt( rInf, aAltTxt ) &&
+/*N*/ aAltTxt.Len() )
+/*N*/ {
+/*N*/ bAllowBehind = rCC.isLetterNumeric( aAltTxt, 0 );
+/*N*/
+/*N*/ const SwFont* pTmpFnt = ((SwFldPortion*)pPor)->GetFont();
+/*N*/ if ( pTmpFnt )
+/*N*/ nNxtActual = pTmpFnt->GetActual();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bAllowBehind = rCC.isLetterNumeric( rInf.GetTxt(), rInf.GetIdx() );
+/*N*/
+/*N*/ const SwLinePortion* pLast = rInf.GetLast();
+/*N*/ if ( bAllowBehind && pLast )
+/*N*/ {
+/*N*/ if ( pLast->InFldGrp() )
+/*N*/ {
+/*N*/ XubString aAltTxt;
+/*N*/ if ( ((SwFldPortion*)pLast)->GetExpTxt( rInf, aAltTxt ) &&
+/*N*/ aAltTxt.Len() )
+/*N*/ {
+/*N*/ bAllowBefore = rCC.isLetterNumeric( aAltTxt, aAltTxt.Len() - 1 );
+/*N*/
+/*N*/ const SwFont* pTmpFnt = ((SwFldPortion*)pLast)->GetFont();
+/*N*/ if ( pTmpFnt )
+/*N*/ {
+/*?*/ nLstActual = pTmpFnt->GetActual();
+/*?*/ nLstHeight = (USHORT)pTmpFnt->GetHeight();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( rInf.GetIdx() )
+/*N*/ {
+/*N*/ bAllowBefore = rCC.isLetterNumeric( rInf.GetTxt(), rInf.GetIdx() - 1 );
+/*N*/ // Note: ScriptType returns values in [1,4]
+/*N*/ if ( bAllowBefore )
+/*N*/ nLstActual = pScriptInfo->ScriptType( rInf.GetIdx() - 1 ) - 1;
+/*N*/ }
+/*N*/
+/*N*/ nLstHeight /= 5;
+/*N*/ // does the kerning portion still fit into the line?
+/*N*/ if( bAllowBefore && ( nLstActual != nNxtActual ) &&
+/*N*/ nLstHeight && rInf.X() + nLstHeight <= rInf.Width() )
+/*N*/ {
+/*?*/ SwKernPortion* pKrn =
+/*?*/ new SwKernPortion( *rInf.GetLast(), nLstHeight,
+/*?*/ pLast->InFldGrp() && pPor->InFldGrp() );
+/*?*/ rInf.GetLast()->SetPortion( NULL );
+/*?*/ InsertPortion( rInf, pKrn );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( bHasGrid && ! pGridKernPortion && ! pMulti )
+/*N*/ {
+/*?*/ // insert a grid kerning portion
+/*?*/ if ( ! pGridKernPortion )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pGridKernPortion = pPor->IsKernPortion() ?
+/*?*/
+/*?*/ // if we have a new GridKernPortion, we initially calculate
+/*?*/ // its size so that its ends on the grid
+/*?*/ const SwPageFrm* pPageFrm = pFrm->FindPageFrm();
+/*?*/ const SwLayoutFrm* pBody = pPageFrm->FindBodyCont();
+/*?*/ SWRECTFN( pPageFrm )
+/*?*/
+/*?*/ const long nGridOrigin = pBody ?
+/*?*/ (pBody->*fnRect->fnGetPrtLeft)() :
+/*?*/ (pPageFrm->*fnRect->fnGetPrtLeft)();
+/*?*/
+/*?*/ SwTwips nStartX = rInf.X() + GetLeftMargin();
+/*?*/ if ( bVert )
+/*?*/ {
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ Point aPoint( nStartX, 0 );
+/*?*/ }
+/*?*/
+/*?*/ const SwTwips nOfst = nStartX - nGridOrigin;
+/*?*/ if ( nOfst )
+/*?*/ {
+/*?*/ const ULONG i = ( nOfst > 0 ) ?
+/*?*/ ( ( nOfst - 1 ) / nGridWidth + 1 ) :
+/*?*/ 0;
+/*?*/ const SwTwips nKernWidth = i * nGridWidth - nOfst;
+/*?*/ const SwTwips nRestWidth = rInf.Width() - rInf.X();
+/*?*/
+/*?*/ if ( nKernWidth <= nRestWidth )
+/*?*/ pGridKernPortion->Width( (USHORT)nKernWidth );
+/*?*/ }
+/*?*/
+/*?*/ if ( pGridKernPortion != pPor )
+/*?*/ InsertPortion( rInf, pGridKernPortion );
+/*N*/ }
+/*N*/
+/*N*/ // the multi-portion has it's own format function
+/*N*/ if( pPor->IsMultiPortion() && ( !pMulti || pMulti->IsBidi() ) )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ bFull = BuildMultiPortion( rInf, *((SwMultiPortion*)pPor) );
+/*N*/ else
+/*N*/ bFull = pPor->Format( rInf );
+/*N*/
+/*N*/ if( rInf.IsRuby() && !rInf.GetRest() )
+/*N*/ bFull = sal_True;
+/*N*/
+/*N*/ // if we are underlined, we store the beginning of this underlined
+/*N*/ // segment for repaint optimization
+/*N*/ if ( UNDERLINE_NONE != pFnt->GetUnderline() && ! nUnderLineStart )
+/*N*/ nUnderLineStart = GetLeftMargin() + rInf.X();
+/*N*/
+/*N*/ if ( pPor->IsFlyPortion() )
+/*N*/ pCurr->SetFly( sal_True );
+/*N*/ // some special cases, where we have to take care for the repaint
+/*N*/ // offset:
+/*N*/ // 1. Underlined portions due to special underline feature
+/*N*/ // 2. Right Tab
+/*N*/ // 3. BidiPortions
+/*N*/ // 4. other Multiportions
+/*N*/ // 5. DropCaps
+/*N*/ // 6. Grid Mode
+/*N*/ else if ( ( ! rInf.GetPaintOfst() || nUnderLineStart < rInf.GetPaintOfst() ) &&
+/*N*/ // 1. Underlined portions
+/*N*/ nUnderLineStart &&
+/*N*/ // reformat is at end of an underlined portion and next portion
+/*N*/ // is not underlined
+/*N*/ ( ( rInf.GetReformatStart() == rInf.GetIdx() &&
+/*N*/ UNDERLINE_NONE == pFnt->GetUnderline()
+/*N*/ ) ||
+/*N*/ // reformat is inside portion and portion is underlined
+/*N*/ ( rInf.GetReformatStart() >= rInf.GetIdx() &&
+/*N*/ rInf.GetReformatStart() <= rInf.GetIdx() + pPor->GetLen() &&
+/*N*/ UNDERLINE_NONE != pFnt->GetUnderline() ) ) )
+/*N*/ rInf.SetPaintOfst( nUnderLineStart );
+/*N*/ else if ( ! rInf.GetPaintOfst() &&
+/*N*/ // 2. Right Tab
+/*N*/ ( ( pPor->InTabGrp() && !pPor->IsTabLeftPortion() ) ||
+/*N*/ // 3. BidiPortions
+/*N*/ ( pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->IsBidi() ) ||
+/*N*/ // 4. Multi Portion and 5. Drop Caps
+/*N*/ ( ( pPor->IsDropPortion() || pPor->IsMultiPortion() ) &&
+/*N*/ rInf.GetReformatStart() >= rInf.GetIdx() &&
+/*N*/ rInf.GetReformatStart() <= rInf.GetIdx() + pPor->GetLen() )
+/*N*/ // 6. Grid Mode
+/*N*/ || ( bHasGrid && SW_CJK != pFnt->GetActual() )
+/*N*/ )
+/*N*/ )
+/*N*/ // we store the beginning of the critical portion as our
+/*N*/ // paint offset
+/*N*/ rInf.SetPaintOfst( GetLeftMargin() + rInf.X() );
+/*N*/
+/*N*/ // under one of these conditions we are allowed to delete the
+/*N*/ // start of the underline portion
+/*N*/ if ( IsUnderlineBreak( *pPor, *pFnt ) )
+/*N*/ nUnderLineStart = 0;
+/*N*/
+/*N*/ if( pPor->IsFlyCntPortion() || ( pPor->IsMultiPortion() &&
+/*N*/ ((SwMultiPortion*)pPor)->HasFlyInCntnt() ) )
+/*N*/ SetFlyInCntBase();
+/*N*/ // 5964: bUnderFlow muss zurueckgesetzt werden, sonst wird beim
+/*N*/ // naechsten Softhyphen wieder umgebrochen!
+/*N*/ if ( !bFull )
+/*N*/ {
+/*N*/ rInf.ClrUnderFlow();
+/*N*/ if( ! bHasGrid && rInf.HasScriptSpace() && pPor->InTxtGrp() &&
+/*N*/ pPor->GetLen() && !pPor->InFldGrp() )
+/*N*/ {
+/*N*/ // The distance between two different scripts is set
+/*N*/ // to 20% of the fontheight.
+/*N*/ xub_StrLen nTmp = rInf.GetIdx() + pPor->GetLen();
+/*N*/ if( nTmp == pScriptInfo->NextScriptChg( nTmp - 1 ) &&
+/*N*/ nTmp != rInf.GetTxt().Len() )
+/*N*/ {
+/*N*/ USHORT nDist = (USHORT)(rInf.GetFont()->GetHeight()/5);
+/*N*/
+/*N*/ if( nDist )
+/*N*/ {
+/*N*/ // we do not want a kerning portion if any end
+/*N*/ // would be a punctuation character
+/*N*/ const CharClass& rCC = GetAppCharClass();
+/*N*/ if ( rCC.isLetterNumeric( rInf.GetTxt(), nTmp - 1 ) &&
+/*N*/ rCC.isLetterNumeric( rInf.GetTxt(), nTmp ) )
+/*N*/ {
+/*N*/ // does the kerning portion still fit into the line?
+/*?*/ if ( rInf.X() + pPor->Width() + nDist <= rInf.Width() )
+/*?*/ new SwKernPortion( *pPor, nDist );
+/*?*/ else
+/*?*/ bFull = sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( bHasGrid && pPor != pGridKernPortion && ! pMulti )
+/*N*/ {
+/*?*/ xub_StrLen nTmp = rInf.GetIdx() + pPor->GetLen();
+/*?*/ const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width();
+/*?*/
+/*?*/ const BYTE nCurrScript = pFnt->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() );
+/*?*/ const BYTE nNextScript = nTmp >= rInf.GetTxt().Len() ?
+/*?*/ SW_CJK :
+/*?*/ WhichFont( nTmp, 0, pScriptInfo );
+/*?*/
+/*?*/ // snap non-asian text to grid if next portion is ASIAN or
+/*?*/ // there are no more portions in this line
+/*?*/ // be careful when handling an underflow event: the gridkernportion
+/*?*/ // could have been deleted
+/*?*/ if ( nRestWidth > 0 && SW_CJK != nCurrScript &&
+/*?*/ ! rInf.IsUnderFlow() && ( bFull || SW_CJK == nNextScript ) )
+/*?*/ {
+/*?*/ ASSERT( pGridKernPortion, "No GridKernPortion available" )
+/*?*/
+/*?*/ // calculate size
+/*?*/ SwLinePortion* pTmpPor = pGridKernPortion->GetPortion();
+/*?*/ USHORT nSumWidth = pPor->Width();
+/*?*/ while ( pTmpPor )
+/*?*/ {
+/*?*/ nSumWidth += pTmpPor->Width();
+/*?*/ pTmpPor = pTmpPor->GetPortion();
+/*?*/ }
+/*?*/
+/*?*/ const USHORT i = nSumWidth ?
+/*?*/ ( nSumWidth - 1 ) / nGridWidth + 1 :
+/*?*/ 0;
+/*?*/ const SwTwips nTmpWidth = i * nGridWidth;
+/*?*/ const SwTwips nKernWidth = Min( (SwTwips)(nTmpWidth - nSumWidth),
+/*?*/ nRestWidth );
+/*?*/ const USHORT nKernWidth_1 = (USHORT)(nKernWidth / 2);
+/*?*/
+/*?*/ ASSERT( nKernWidth <= nRestWidth,
+/*?*/ "Not enough space left for adjusting non-asian text in grid mode" )
+/*?*/
+/*?*/ pGridKernPortion->Width( pGridKernPortion->Width() + nKernWidth_1 );
+/*?*/ rInf.X( rInf.X() + nKernWidth_1 );
+/*?*/
+/*?*/ if ( ! bFull )
+/*?*/ new SwKernPortion( *pPor, (short)(nKernWidth - nKernWidth_1),
+/*?*/ sal_False, sal_True );
+/*?*/
+/*?*/ pGridKernPortion = 0;
+/*?*/ }
+/*?*/ else if ( pPor->IsMultiPortion() || pPor->InFixMargGrp() ||
+/*?*/ pPor->IsFlyCntPortion() || pPor->InNumberGrp() ||
+/*?*/ pPor->InFldGrp() || nCurrScript != nNextScript )
+/*?*/ // next portion should snap to grid
+/*?*/ pGridKernPortion = 0;
+/*N*/ }
+/*N*/
+/*N*/ rInf.SetFull( bFull );
+/*N*/
+/*N*/ // Restportions von mehrzeiligen Feldern haben bisher noch
+/*N*/ // nicht den richtigen Ascent.
+/*N*/ if ( !pPor->GetLen() && !pPor->IsFlyPortion()
+/*N*/ && !pPor->IsGrfNumPortion() && ! pPor->InNumberGrp()
+/*N*/ && !pPor->IsMultiPortion() )
+/*N*/ CalcAscent( rInf, pPor );
+/*N*/
+/*N*/ InsertPortion( rInf, pPor );
+/*N*/ pPor = NewPortion( rInf );
+/*N*/ }
+/*N*/
+/*N*/ if( !rInf.IsStop() )
+/*N*/ {
+/*N*/ // der letzte rechte, zentrierte, dezimale Tab
+/*N*/ SwTabPortion *pLastTab = rInf.GetLastTab();
+/*N*/ if( pLastTab )
+/*N*/ pLastTab->FormatEOL( rInf );
+/*N*/ else if( rInf.GetLast() && rInf.LastKernPortion() )
+/*N*/ rInf.GetLast()->FormatEOL( rInf );
+/*N*/ }
+/*N*/ if( pCurr->GetPortion() && pCurr->GetPortion()->InNumberGrp()
+/*N*/ && ((SwNumberPortion*)pCurr->GetPortion())->IsHide() )
+/*?*/ rInf.SetNumDone( sal_False );
+/*N*/
+/*N*/ // 3260, 3860: Fly auf jeden Fall loeschen!
+/*N*/ ClearFly( rInf );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcAdjustLine()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::CalcAdjustLine( SwLineLayout *pCurr )
+/*N*/ {
+/*N*/ if( SVX_ADJUST_LEFT != GetAdjust() && !pMulti)
+/*N*/ {
+/*N*/ pCurr->SetFormatAdj(sal_True);
+/*N*/ if( IsFlyInCntBase() )
+/*N*/ {
+/*N*/ CalcAdjLine( pCurr );
+/*N*/ // 23348: z.B. bei zentrierten Flys muessen wir den RefPoint
+/*N*/ // auf jeden Fall umsetzen, deshalb bAllWays = sal_True
+/*N*/ UpdatePos( pCurr, GetTopLeft(), GetStart(), sal_True );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcAscent()
+ *************************************************************************/
+
+/*M*/ void SwTxtFormatter::CalcAscent( SwTxtFormatInfo &rInf, SwLinePortion *pPor )
+/*M*/ {
+/*M*/ if ( pPor->InFldGrp() && ((SwFldPortion*)pPor)->GetFont() )
+/*M*/ {
+/*M*/ // Numerierungen + InterNetFlds koennen einen eigenen Font beinhalten,
+/*M*/ // dann ist ihre Groesse unabhaengig von harten Attributierungen.
+/*M*/ SwFont* pFldFnt = ((SwFldPortion*)pPor)->pFnt;
+/*M*/ SwFontSave aSave( rInf, pFldFnt );
+/*M*/ ((SwFldPortion*)pPor)->Height( pFldFnt->GetHeight( rInf.GetVsh(), rInf.GetOut() ) );
+/*M*/ ((SwFldPortion*)pPor)->SetAscent( pFldFnt->GetAscent( rInf.GetVsh(), rInf.GetOut() ) );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ const SwLinePortion *pLast = rInf.GetLast();
+/*M*/ sal_Bool bChg;
+/*M*/
+/*M*/ // Fallunterscheidung: in leeren Zeilen werden die Attribute
+/*M*/ // per SeekStart angeschaltet.
+/*M*/ const sal_Bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
+/*M*/ if ( pPor->IsQuoVadisPortion() )
+/*M*/ bChg = SeekStartAndChg( rInf, sal_True );
+/*M*/ else
+/*M*/ {
+/*M*/ if( bFirstPor )
+/*M*/ {
+/*M*/ if( rInf.GetTxt().Len() )
+/*M*/ {
+/*M*/ if ( pPor->GetLen() || !rInf.GetIdx()
+/*M*/ || ( pCurr != pLast && !pLast->IsFlyPortion() )
+/*M*/ || !pCurr->IsRest() ) // statt !rInf.GetRest()
+/*M*/ bChg = SeekAndChg( rInf );
+/*M*/ else
+/*M*/ bChg = SeekAndChgBefore( rInf );
+/*M*/ }
+/*M*/ else if ( pMulti )
+/*M*/ // do not open attributes starting at 0 in empty multi
+/*M*/ // portions (rotated numbering followed by a footnote
+/*M*/ // can cause trouble, because the footnote attribute
+/*M*/ // starts at 0, but if we open it, the attribute handler
+/*M*/ // cannot handle it.
+/*M*/ bChg = sal_False;
+/*M*/ else
+/*M*/ bChg = SeekStartAndChg( rInf );
+/*M*/ }
+/*M*/ else
+/*M*/ bChg = SeekAndChg( rInf );
+/*M*/ }
+/*M*/ if( bChg || bFirstPor || !pPor->GetAscent()
+/*M*/ || !rInf.GetLast()->InTxtGrp() )
+/*M*/ {
+/*M*/ pPor->SetAscent( rInf.GetAscent() );
+/*M*/ pPor->Height( rInf.GetTxtHeight() );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ pPor->Height( pLast->Height() );
+/*M*/ pPor->SetAscent( pLast->GetAscent() );
+/*M*/ }
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::WhichTxtPor()
+ *************************************************************************/
+
+/*N*/ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const
+/*N*/ {
+/*N*/ SwTxtPortion *pPor = 0;
+/*N*/ if( GetFnt()->IsTox() )
+/*N*/ pPor = new SwToxPortion;
+/*N*/ else
+/*N*/ {
+/*N*/ if( GetFnt()->IsRef() )
+/*N*/ pPor = new SwRefPortion;
+/*N*/ else
+/*N*/ {
+/*N*/ // Erst zum Schluss !
+/*N*/ // Wenn pCurr keine Breite hat, kann sie trotzdem schon Inhalt haben,
+/*N*/ // z.B. bei nicht darstellbaren Zeichen.
+/*N*/ if( !rInf.X() && !pCurr->GetPortion() && !pCurr->GetLen() &&
+/*N*/ !GetFnt()->IsURL() )
+/*N*/ pPor = pCurr;
+/*N*/ else
+/*N*/ {
+/*N*/ pPor = new SwTxtPortion;
+/*N*/ if( GetFnt()->IsURL() )
+/*?*/ pPor->SetWhichPor( POR_URL );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pPor;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewTxtPortion()
+ *************************************************************************/
+// Die Laenge wird ermittelt, folgende Portion-Grenzen sind definiert:
+// 1) Tabs
+// 2) Linebreaks
+// 3) CH_TXTATR_BREAKWORD / CH_TXTATR_INWORD
+// 4) naechster Attributwechsel
+
+/*N*/ SwTxtPortion *SwTxtFormatter::NewTxtPortion( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ // Wenn wir am Zeilenbeginn stehen, nehmen wir pCurr
+/*N*/ // Wenn pCurr nicht von SwTxtPortion abgeleitet ist,
+/*N*/ // muessen wir duplizieren ...
+/*N*/ Seek( rInf.GetIdx() );
+/*N*/ SwTxtPortion *pPor = WhichTxtPor( rInf );
+/*N*/
+/*N*/ // maximal bis zum naechsten Attributwchsel.
+/*N*/ xub_StrLen nNextAttr = GetNextAttr();
+/*N*/ xub_StrLen nNextChg = Min( nNextAttr, rInf.GetTxt().Len() );
+/*N*/
+/*N*/ nNextAttr = pScriptInfo->NextScriptChg( rInf.GetIdx() );
+/*N*/
+/*N*/ xub_StrLen nNextDir = pScriptInfo->NextDirChg( rInf.GetIdx() );
+/*N*/ nNextAttr = Min( nNextAttr, nNextDir );
+/*N*/
+/*N*/ if( nNextChg > nNextAttr )
+/*N*/ nNextChg = nNextAttr;
+/*N*/
+/*N*/ // 7515, 7516, 3470, 6441 : Turbo-Boost
+/*N*/ // Es wird unterstellt, dass die Buchstaben eines Fonts nicht
+/*N*/ // groesser als doppelt so breit wie hoch sind.
+/*N*/ // 7659: Ganz verrueckt: man muss sich auf den Ascent beziehen.
+/*N*/ // Falle: GetSize() enthaelt die Wunschhoehe, die reale Hoehe
+/*N*/ // ergibt sich erst im CalcAscent!
+/*N*/ // 7697: Das Verhaeltnis ist noch krasser: ein Blank im Times
+/*N*/ // New Roman besitzt einen Ascent von 182, eine Hoehe von 200
+/*N*/ // und eine Breite von 53! Daraus folgt, dass eine Zeile mit
+/*N*/ // vielen Blanks falsch eingeschaetzt wird. Wir erhoehen von
+/*N*/ // Faktor 2 auf 8 (wg. negativen Kernings).
+/*N*/
+/*N*/ pPor->SetLen(1);
+/*N*/ CalcAscent( rInf, pPor );
+/*N*/
+/*N*/ const SwFont* pFnt = rInf.GetFont();
+/*N*/ KSHORT nExpect = Min( KSHORT( ((Font *)pFnt)->GetSize().Height() ),
+/*N*/ KSHORT( pPor->GetAscent() ) ) / 8;
+/*N*/ if ( !nExpect )
+/*N*/ nExpect = 1;
+/*N*/ nExpect = (USHORT)(rInf.GetIdx() + ((rInf.Width() - rInf.X()) / nExpect));
+/*N*/ if( nExpect > rInf.GetIdx() && nNextChg > nExpect )
+/*N*/ nNextChg = Min( nExpect, rInf.GetTxt().Len() );
+/*N*/
+/*N*/ // we keep an invariant during method calls:
+/*N*/ // there are no portion ending characters like hard spaces
+/*N*/ // or tabs in [ nLeftScanIdx, nRightScanIdx ]
+/*N*/ if ( nLeftScanIdx <= rInf.GetIdx() && rInf.GetIdx() <= nRightScanIdx )
+/*N*/ {
+/*N*/ if ( nNextChg > nRightScanIdx )
+/*N*/ nNextChg = nRightScanIdx =
+/*N*/ rInf.ScanPortionEnd( nRightScanIdx, nNextChg );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nLeftScanIdx = rInf.GetIdx();
+/*N*/ nNextChg = nRightScanIdx =
+/*N*/ rInf.ScanPortionEnd( rInf.GetIdx(), nNextChg );
+/*N*/ }
+/*N*/
+/*N*/ pPor->SetLen( nNextChg - rInf.GetIdx() );
+/*N*/ rInf.SetLen( pPor->GetLen() );
+/*N*/ return pPor;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFormatter::WhichFirstPortion()
+ *************************************************************************/
+
+/*M*/ SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf)
+/*M*/ {
+/*M*/ SwLinePortion *pPor = 0;
+/*M*/
+/*M*/ if( rInf.GetRest() )
+/*M*/ {
+/*M*/ // 5010: Tabs und Felder
+/*M*/ if( '\0' != rInf.GetHookChar() )
+/*M*/ return 0;
+/*M*/
+/*M*/ pPor = rInf.GetRest();
+/*M*/ if( pPor->IsErgoSumPortion() )
+/*M*/ rInf.SetErgoDone(sal_True);
+/*M*/ else
+/*M*/ if( pPor->IsFtnNumPortion() )
+/*M*/ rInf.SetFtnDone(sal_True);
+/*M*/ else
+/*M*/ if( pPor->InNumberGrp() )
+/*M*/ rInf.SetNumDone(sal_True);
+/*M*/ if( pPor )
+/*M*/ {
+/*M*/ rInf.SetRest(0);
+/*M*/ pCurr->SetRest( sal_True );
+/*M*/ return pPor;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // ???? und ????: im Follow duerfen wir schon stehen,
+/*M*/ // entscheidend ist, ob pFrm->GetOfst() == 0 ist!
+/*M*/ if( rInf.GetIdx() )
+/*M*/ {
+/*M*/ // Nun koennen auch FtnPortions und ErgoSumPortions
+/*M*/ // verlaengert werden.
+/*M*/
+/*M*/ // 1) Die ErgoSumTexte
+/*M*/ if( !rInf.IsErgoDone() )
+/*M*/ {
+/*M*/ if( pFrm->IsInFtn() && !pFrm->GetIndPrev() )
+/*M*/ pPor = (SwLinePortion*)NewErgoSumPortion( rInf );
+/*M*/ rInf.SetErgoDone( sal_True );
+/*M*/ }
+/*M*/ if( !pPor && !rInf.IsArrowDone() )
+/*M*/ {
+/*M*/ if( pFrm->GetOfst() && !pFrm->IsFollow() &&
+/*M*/ rInf.GetIdx() == pFrm->GetOfst() )
+/*M*/ pPor = new SwArrowPortion( *pCurr );
+/*M*/ rInf.SetArrowDone( sal_True );
+/*M*/ }
+/*M*/
+/*M*/ if ( ! pPor && ! pCurr->GetPortion() )
+/*M*/ {
+/*M*/ GETGRID( GetTxtFrm()->FindPageFrm() )
+/*M*/ if ( pGrid )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pPor = new SwKernPortion( *pCurr );
+/*M*/ }
+/*M*/
+/*M*/ // 2) Die Zeilenreste (mehrzeilige Felder)
+/*M*/ if( !pPor )
+/*M*/ {
+/*M*/ pPor = rInf.GetRest();
+/*M*/ // 6922: Nur bei pPor natuerlich.
+/*M*/ if( pPor )
+/*M*/ {
+/*M*/ pCurr->SetRest( sal_True );
+/*M*/ rInf.SetRest(0);
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ // 1) Die Fussnotenzahlen
+/*M*/ if( !rInf.IsFtnDone() )
+/*M*/ {
+/*M*/ ASSERT( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(),
+/*M*/ "Rotated number portion trouble" )
+/*M*/
+/*M*/ sal_Bool bFtnNum = pFrm->IsFtnNumFrm();
+/*M*/ rInf.GetParaPortion()->SetFtnNum( bFtnNum );
+/*M*/ if( bFtnNum )
+/*M*/ pPor = (SwLinePortion*)NewFtnNumPortion( rInf );
+/*M*/ rInf.SetFtnDone( sal_True );
+/*M*/ }
+/*M*/
+/*M*/ // 2) Die ErgoSumTexte gibt es natuerlich auch im TextMaster,
+/*M*/ // entscheidend ist, ob der SwFtnFrm ein Follow ist.
+/*M*/ if( !rInf.IsErgoDone() && !pPor && ! rInf.IsMulti() )
+/*M*/ {
+/*M*/ if( pFrm->IsInFtn() && !pFrm->GetIndPrev() )
+/*M*/ pPor = (SwLinePortion*)NewErgoSumPortion( rInf );
+/*M*/ rInf.SetErgoDone( sal_True );
+/*M*/ }
+/*M*/
+/*M*/ // 3) Die Numerierungen
+/*M*/ if( !rInf.IsNumDone() && !pPor )
+/*M*/ {
+/*M*/ ASSERT( ( ! rInf.IsMulti() && ! pMulti ) || pMulti->HasRotation(),
+/*M*/ "Rotated number portion trouble" )
+/*M*/
+/*M*/ // Wenn wir im Follow stehen, dann natuerlich nicht.
+/*M*/ if( GetTxtFrm()->GetTxtNode()->GetNum() ||
+/*M*/ GetTxtFrm()->GetTxtNode()->GetOutlineNum() )
+/*M*/ pPor = (SwLinePortion*)NewNumberPortion( rInf );
+/*M*/ rInf.SetNumDone( sal_True );
+/*M*/ }
+/*M*/ // 4) Die DropCaps
+/*M*/ if( !pPor && GetDropFmt() && ! rInf.IsMulti() )
+/*M*/ pPor = (SwLinePortion*)NewDropPortion( rInf );
+/*M*/
+/*M*/ if ( ! pPor && ! pCurr->GetPortion() )
+/*M*/ {
+/*M*/ GETGRID( GetTxtFrm()->FindPageFrm() )
+/*M*/ if ( pGrid )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 pPor = new SwKernPortion( *pCurr );
+/*M*/ }
+/*M*/ }
+/*M*/ return pPor;
+/*M*/ }
+
+/*N*/ sal_Bool lcl_OldFieldRest( const SwLineLayout* pCurr )
+/*N*/ {
+/*N*/ if( !pCurr->GetNext() )
+/*N*/ return sal_False;
+/*N*/ const SwLinePortion *pPor = pCurr->GetNext()->GetPortion();
+/*N*/ sal_Bool bRet = sal_False;
+/*N*/ while( pPor && !bRet )
+/*N*/ {
+/*N*/ bRet = (pPor->InFldGrp() && ((SwFldPortion*)pPor)->IsFollow()) ||
+/*N*/ (pPor->IsMultiPortion() && ((SwMultiPortion*)pPor)->IsFollowFld());
+/*N*/ if( !pPor->GetLen() )
+/*N*/ break;
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewPortion()
+ *************************************************************************/
+
+/* NewPortion stellt rInf.nLen ein.
+ * Eine SwTxtPortion wird begrenzt durch ein tab, break, txtatr,
+ * attrwechsel.
+ * Drei Faelle koennen eintreten:
+ * 1) Die Zeile ist voll und der Umbruch wurde nicht emuliert
+ * -> return 0;
+ * 2) Die Zeile ist voll und es wurde ein Umbruch emuliert
+ * -> Breite neu einstellen und return new FlyPortion
+ * 3) Es muss eine neue Portion gebaut werden.
+ * -> CalcFlyWidth emuliert ggf. die Breite und return Portion
+ */
+
+/*M*/ SwLinePortion *SwTxtFormatter::NewPortion( SwTxtFormatInfo &rInf )
+/*M*/ {
+/*M*/ // Underflow hat Vorrang
+/*M*/ rInf.SetStopUnderFlow( sal_False );
+/*M*/ if( rInf.GetUnderFlow() )
+/*M*/ {
+/*M*/ ASSERT( rInf.IsFull(), "SwTxtFormatter::NewPortion: underflow but not full" );
+/*M*/ return UnderFlow( rInf );
+/*M*/ }
+/*M*/
+/*M*/ // Wenn die Zeile voll ist, koennten noch Flys oder
+/*M*/ // UnderFlow-LinePortions warten ...
+/*M*/ if( rInf.IsFull() )
+/*M*/ {
+/*M*/ // ????: LineBreaks und Flys (bug05.sdw)
+/*M*/ // 8450: IsDummy()
+/*M*/ if( rInf.IsNewLine() && (!rInf.GetFly() || !pCurr->IsDummy()) )
+/*M*/ return 0;
+/*M*/
+/*M*/ // Wenn der Text an den Fly gestossen ist, oder wenn
+/*M*/ // der Fly als erstes drankommt, weil er ueber dem linken
+/*M*/ // Rand haengt, wird GetFly() returnt.
+/*M*/ // Wenn IsFull() und kein GetFly() vorhanden ist, gibt's
+/*M*/ // naturgemaesz eine 0.
+/*M*/ if( rInf.GetFly() )
+/*M*/ {
+/*M*/ if( rInf.GetLast()->IsBreakPortion() )
+/*M*/ {
+/*M*/ delete rInf.GetFly();
+/*M*/ rInf.SetFly( 0 );
+/*M*/ }
+/*M*/
+/*M*/ return rInf.GetFly();
+/*M*/ }
+/*M*/ // Ein fieser Sonderfall: ein Rahmen ohne Umlauf kreuzt den
+/*M*/ // Ftn-Bereich. Wir muessen die Ftn-Portion als Zeilenrest
+/*M*/ // bekanntgeben, damit SwTxtFrm::Format nicht abbricht
+/*M*/ // (die Textmasse wurde ja durchformatiert).
+/*M*/ if( rInf.GetRest() )
+/*M*/ rInf.SetNewLine( sal_True );
+/*M*/ else
+/*M*/ {
+/*M*/ // Wenn die naechste Zeile mit einem Rest eines Feldes beginnt,
+/*M*/ // jetzt aber kein Rest mehr anliegt,
+/*M*/ // muss sie auf jeden Fall neu formatiert werden!
+/*M*/ if( lcl_OldFieldRest( GetCurr() ) )
+/*M*/ rInf.SetNewLine( sal_True );
+/*M*/ else
+/*M*/ {
+/*M*/ SwLinePortion *pFirst = WhichFirstPortion( rInf );
+/*M*/ if( pFirst )
+/*M*/ {
+/*M*/ rInf.SetNewLine( sal_True );
+/*M*/ if( pFirst->InNumberGrp() )
+/*M*/ rInf.SetNumDone( sal_False) ;
+/*M*/ delete pFirst;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ return 0;
+/*M*/ }
+/*M*/
+/*M*/ SwLinePortion *pPor = WhichFirstPortion( rInf );
+/*M*/
+/*M*/ if( !pPor )
+/*M*/ {
+/*M*/ if( !pMulti || pMulti->IsBidi() )
+/*M*/ { // We open a multiportion part, if we enter a multi-line part
+/*M*/ // of the paragraph.
+/*M*/ xub_StrLen nEnd = rInf.GetIdx();
+/*M*/ SwMultiCreator* pCreate = rInf.GetMultiCreator( nEnd, pMulti );
+/*M*/ if( pCreate )
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ }
+/*M*/ // 5010: Tabs und Felder
+/*M*/ xub_Unicode cChar = rInf.GetHookChar();
+/*M*/
+/*M*/ if( cChar )
+/*M*/ {
+ /* Wir holen uns nocheinmal cChar, um sicherzustellen, dass das
+ * Tab jetzt wirklich ansteht und nicht auf die naechste Zeile
+ * gewandert ist ( so geschehen hinter Rahmen ).
+ * Wenn allerdings eine FldPortion im Rest wartet, muessen wir
+ * das cChar natuerlich aus dem Feldinhalt holen, z.B. bei
+ * DezimalTabs und Feldern (22615)
+ */
+/*M*/ if( !rInf.GetRest() || !rInf.GetRest()->InFldGrp() )
+/*M*/ cChar = rInf.GetChar( rInf.GetIdx() );
+/*M*/ rInf.SetHookChar(0);
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ if( rInf.GetIdx() >= rInf.GetTxt().Len() )
+/*M*/ {
+/*M*/ rInf.SetFull(sal_True);
+/*M*/ CalcFlyWidth( rInf );
+/*M*/ return pPor;
+/*M*/ }
+/*M*/ cChar = rInf.GetChar( rInf.GetIdx() );
+/*M*/ }
+/*M*/
+/*M*/ switch( cChar )
+/*M*/ {
+/*M*/ case CH_TAB : pPor = NewTabPortion( rInf ); break;
+/*M*/ case CH_BREAK : pPor = new SwBreakPortion( *rInf.GetLast() ); break;
+/*M*/
+/*M*/ case CHAR_SOFTHYPHEN: // soft hyphen
+/*M*/ pPor = new SwSoftHyphPortion; break;
+/*M*/
+/*M*/ case CHAR_HARDBLANK: // no-break space
+/*M*/ pPor = new SwBlankPortion( ' ' ); break;
+/*M*/ case CHAR_HARDHYPHEN: // non-breaking hyphen
+/*M*/ pPor = new SwBlankPortion( '-' ); break;
+/*M*/
+/*M*/ case CH_TXTATR_BREAKWORD:
+/*M*/ case CH_TXTATR_INWORD:
+/*M*/ if( rInf.HasHint( rInf.GetIdx() ) )
+/*M*/ {
+/*M*/ pPor = NewExtraPortion( rInf );
+/*M*/ break;
+/*M*/ }
+/*M*/ // No break
+/*M*/ default :
+/*M*/ {
+/*M*/ if( rInf.GetLastTab() && cChar == rInf.GetTabDecimal() )
+/*M*/ rInf.SetFull( rInf.GetLastTab()->Format( rInf ) );
+/*M*/
+/*M*/ if( rInf.GetRest() )
+/*M*/ {
+/*M*/ if( rInf.IsFull() )
+/*M*/ {
+/*M*/ rInf.SetNewLine(sal_True);
+/*M*/ return 0;
+/*M*/ }
+/*M*/ pPor = rInf.GetRest();
+/*M*/ rInf.SetRest(0);
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ if( rInf.IsFull() )
+/*M*/ return 0;
+/*M*/ pPor = NewTxtPortion( rInf );
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // Wenn eine Portion erzeugt wird, obwohl eine RestPortion ansteht,
+/*M*/ // dann haben wir es mit einem Feld zu tun, das sich aufgesplittet
+/*M*/ // hat, weil z.B. ein Tab enthalten ist.
+/*M*/ if( pPor && rInf.GetRest() )
+/*M*/ pPor->SetLen( 0 );
+/*M*/
+/*M*/ // robust:
+/*M*/ if( !pPor || rInf.IsStop() )
+/*M*/ {
+/*M*/ delete pPor;
+/*M*/ return 0;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // Special portions containing numbers (footnote anchor, footnote number,
+/*M*/ // numbering) can be contained in a rotated portion, if the user
+/*M*/ // choose a rotated character attribute.
+/*M*/ if ( pPor && ! pMulti )
+/*M*/ {
+/*M*/ if ( pPor->IsFtnPortion() )
+/*M*/ {
+/*M*/ const SwTxtFtn* pTxtFtn = ((SwFtnPortion*)pPor)->GetTxtFtn();
+/*M*/
+/*M*/ if ( pTxtFtn )
+/*M*/ {
+/*M*/ SwFmtFtn& rFtn = (SwFmtFtn&)pTxtFtn->GetFtn();
+/*M*/ const SwDoc *pDoc = rInf.GetTxtFrm()->GetNode()->GetDoc();
+/*M*/ const SwEndNoteInfo* pInfo;
+/*M*/ if( rFtn.IsEndNote() )
+/*M*/ pInfo = &pDoc->GetEndNoteInfo();
+/*M*/ else
+/*M*/ pInfo = &pDoc->GetFtnInfo();
+/*M*/ const SwAttrSet& rSet = pInfo->GetAnchorCharFmt((SwDoc&)*pDoc)->GetAttrSet();
+/*M*/
+/*M*/ const SfxPoolItem* pItem;
+/*M*/ USHORT nDir = 0;
+/*M*/ if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_ROTATE,
+/*M*/ sal_True, &pItem ))
+/*M*/ nDir = ((SvxCharRotateItem*)pItem)->GetValue();
+/*M*/
+/*M*/ if ( 0 != nDir )
+/*M*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 delete pPor;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ else if ( pPor->InNumberGrp() )
+/*M*/ {
+/*M*/ const SwFont* pNumFnt = ((SwFldPortion*)pPor)->GetFont();
+/*M*/
+/*M*/ if ( pNumFnt )
+/*M*/ {
+/*N*/ USHORT nDir = pNumFnt->GetOrientation( rInf.GetTxtFrm()->IsVertical() );
+/*M*/ if ( 0 != nDir )
+/*M*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 delete pPor;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // Der Font wird im Outputdevice eingestellt,
+/*M*/ // der Ascent und die Hoehe werden berechnet.
+/*M*/ if( !pPor->GetAscent() && !pPor->Height() )
+/*M*/ CalcAscent( rInf, pPor );
+/*M*/ rInf.SetLen( pPor->GetLen() );
+/*M*/
+/*M*/ // In CalcFlyWidth wird Width() verkuerzt, wenn eine FlyPortion vorliegt.
+/*M*/ CalcFlyWidth( rInf );
+/*M*/
+/*M*/ // Man darf nicht vergessen, dass pCurr als GetLast() vernuenftige
+/*M*/ // Werte bereithalten muss:
+/*M*/ if( !pCurr->Height() )
+/*M*/ {
+/*M*/ ASSERT( pCurr->Height(), "SwTxtFormatter::NewPortion: limbo dance" );
+/*M*/ pCurr->Height( pPor->Height() );
+/*M*/ pCurr->SetAscent( pPor->GetAscent() );
+/*M*/ }
+/*M*/
+/*M*/ ASSERT( !pPor || pPor->Height(),
+/*M*/ "SwTxtFormatter::NewPortion: something went wrong");
+/*M*/ if( pPor->IsPostItsPortion() && rInf.X() >= rInf.Width() && rInf.GetFly() )
+/*M*/ {
+/*M*/ delete pPor;
+/*M*/ pPor = rInf.GetFly();
+/*M*/ }
+/*M*/ return pPor;
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::FormatLine()
+ *************************************************************************/
+
+/*M*/ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStart )
+/*M*/ {
+/*M*/ ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(),
+/*M*/ "SwTxtFormatter::FormatLine( nStart ) with unswapped frame" );
+/*N*/
+/*N*/ // For the formatting routines, we set pOut to the reference device.
+/*N*/ SwHookOut aHook( GetInfo() );
+/*M*/ if( GetInfo().GetLen() < GetInfo().GetTxt().Len() )
+/*M*/ GetInfo().SetLen( GetInfo().GetTxt().Len() );
+/*M*/
+/*M*/ sal_Bool bBuild = sal_True;
+/*M*/ SetFlyInCntBase( sal_False );
+/*M*/ GetInfo().SetLineHeight( 0 );
+/*M*/ GetInfo().SetLineNettoHeight( 0 );
+/*M*/
+/*M*/ // Recycling muss bei geaenderter Zeilenhoehe unterdrueckt werden
+/*M*/ // und auch bei geaendertem Ascent (Absenken der Grundlinie).
+/*M*/ const KSHORT nOldHeight = pCurr->Height();
+/*M*/ const KSHORT nOldAscent = pCurr->GetAscent();
+/*M*/
+/*M*/ pCurr->SetEndHyph( sal_False );
+/*M*/ pCurr->SetMidHyph( sal_False );
+/*M*/
+/*M*/ // fly positioning can make it necessary format a line several times
+/*M*/ // for this, we have to keep a copy of our rest portion
+/*M*/ SwLinePortion* pFld = GetInfo().GetRest();
+/*M*/ SwFldPortion* pSaveFld = 0;
+/*M*/
+/*M*/ if ( pFld && pFld->InFldGrp() && ! pFld->IsFtnPortion() )
+/*M*/ pSaveFld = new SwFldPortion( *((SwFldPortion*)pFld) );
+/*M*/
+/*M*/ // for an optimal repaint rectangle, we want to compare fly portions
+/*M*/ // before and after the BuildPortions call
+/*M*/ const sal_Bool bOptimizeRepaint = AllowRepaintOpt();
+/*M*/ const xub_StrLen nOldLineEnd = nStart + pCurr->GetLen();
+/*M*/ SvLongs* pFlyStart = 0;
+/*M*/
+/*M*/ // these are the conditions for a fly position comparison
+/*M*/ if ( bOptimizeRepaint && pCurr->IsFly() )
+/*M*/ {
+/*M*/ pFlyStart = new SvLongs;
+/*M*/ SwLinePortion* pPor = pCurr->GetFirstPortion();
+/*M*/ long nPOfst = 0;
+/*M*/ USHORT nCnt = 0;
+/*M*/
+/*M*/ while ( pPor )
+/*M*/ {
+/*M*/ if ( pPor->IsFlyPortion() )
+/*M*/ // insert start value of fly portion
+/*M*/ pFlyStart->Insert( nPOfst, nCnt++ );
+/*M*/
+/*M*/ nPOfst += pPor->Width();
+/*M*/ pPor = pPor->GetPortion();
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // Hier folgt bald die Unterlaufpruefung.
+/*M*/ while( bBuild )
+/*M*/ {
+/*M*/ GetInfo().SetFtnInside( sal_False );
+/*M*/
+/*M*/ // These values must not be reset by FormatReset();
+/*M*/ sal_Bool bOldNumDone = GetInfo().IsNumDone();
+/*M*/ sal_Bool bOldArrowDone = GetInfo().IsArrowDone();
+/*M*/ sal_Bool bOldErgoDone = GetInfo().IsErgoDone();
+/*M*/
+/*M*/ // besides other things, this sets the repaint offset to 0
+/*M*/ FormatReset( GetInfo() );
+/*M*/
+/*M*/ GetInfo().SetNumDone( bOldNumDone );
+/*M*/ GetInfo().SetArrowDone( bOldArrowDone );
+/*M*/ GetInfo().SetErgoDone( bOldErgoDone );
+/*M*/
+/*M*/ // build new portions for this line
+/*M*/ BuildPortions( GetInfo() );
+/*M*/
+/*M*/ if( GetInfo().IsStop() )
+/*M*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pCurr->SetLen( 0 );
+/*M*/ }
+/*M*/ else if( GetInfo().IsDropInit() )
+/*M*/ {
+/*M*/ DropInit();
+/*M*/ GetInfo().SetDropInit( sal_False );
+/*M*/ }
+/*M*/
+/*M*/ pCurr->CalcLine( *this, GetInfo() );
+/*M*/ CalcRealHeight( GetInfo().IsNewLine() );
+/*M*/
+/*M*/ if ( IsFlyInCntBase() && !IsQuick() )
+/*M*/ {
+/*M*/ KSHORT nTmpAscent, nTmpHeight;
+/*M*/ CalcAscentAndHeight( nTmpAscent, nTmpHeight );
+/*M*/ AlignFlyInCntBase( Y() + long( nTmpAscent ) );
+/*M*/ pCurr->CalcLine( *this, GetInfo() );
+/*M*/ CalcRealHeight();
+/*M*/ }
+/*M*/
+/*M*/ // bBuild entscheidet, ob noch eine Ehrenrunde gedreht wird
+/*M*/ if ( pCurr->GetRealHeight() <= GetInfo().GetLineHeight() )
+/*M*/ {
+/*M*/ pCurr->SetRealHeight( GetInfo().GetLineHeight() );
+/*M*/ bBuild = sal_False;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ bBuild = ( GetInfo().GetTxtFly()->IsOn() && ChkFlyUnderflow( GetInfo() )
+/*M*/ || GetInfo().CheckFtnPortion( pCurr ) );
+/*M*/ if( bBuild )
+/*M*/ {
+/*M*/ GetInfo().SetNumDone( bOldNumDone );
+/*M*/ GetInfo().ResetMaxWidthDiff();
+/*M*/
+/*M*/ // delete old rest
+/*M*/ if ( GetInfo().GetRest() )
+/*M*/ {
+/*M*/ delete GetInfo().GetRest();
+/*M*/ GetInfo().SetRest( 0 );
+/*M*/ }
+/*M*/
+/*M*/ // set original rest portion
+/*M*/ if ( pSaveFld )
+/*M*/ GetInfo().SetRest( new SwFldPortion( *pSaveFld ) );
+/*M*/
+/*M*/ pCurr->SetLen( 0 );
+/*M*/ pCurr->Width(0);
+/*M*/ pCurr->Truncate();
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // calculate optimal repaint rectangle
+/*M*/ if ( bOptimizeRepaint )
+/*M*/ {
+/*M*/ GetInfo().SetPaintOfst( CalcOptRepaint( nOldLineEnd, pFlyStart ) );
+/*M*/ if ( pFlyStart )
+/*M*/ delete pFlyStart;
+/*M*/ }
+/*M*/ else
+/*M*/ // Special case: We do not allow an optimitation of the repaint
+/*M*/ // area, but during formatting the repaint offset is set to indicate
+/*M*/ // a maximum value for the offset. This value has to be reset:
+/*M*/ GetInfo().SetPaintOfst( 0 );
+/*M*/
+/*M*/ // This corrects the start of the reformat range if something has
+/*M*/ // moved to the next line. Otherwise IsFirstReformat in AllowRepaintOpt
+/*M*/ // will give us a wrong result if we have to reformat another line
+/*M*/ GetInfo().GetParaPortion()->GetReformat()->LeftMove( GetInfo().GetIdx() );
+/*M*/
+/*M*/ // delete master copy of rest portion
+/*M*/ if ( pSaveFld )
+/*M*/ delete pSaveFld;
+/*M*/
+/*M*/ xub_StrLen nNewStart = nStart + pCurr->GetLen();
+/*M*/
+/*M*/ // adjust text if kana compression is enabled
+/*M*/ const SwScriptInfo& rSI = GetInfo().GetParaPortion()->GetScriptInfo();
+/*M*/
+/*M*/ if ( GetInfo().CompressLine() )
+/*M*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 USHORT nRepaintOfst = CalcKanaAdj( pCurr );
+/*M*/ }
+/*M*/
+/*M*/ CalcAdjustLine( pCurr );
+/*M*/
+/*M*/ if( nOldHeight != pCurr->Height() || nOldAscent != pCurr->GetAscent() )
+/*M*/ {
+/*M*/ SetFlyInCntBase();
+/*M*/ GetInfo().SetPaintOfst( 0 ); //geaenderte Zeilenhoehe => kein Recycling
+/*M*/ // alle weiteren Zeilen muessen gepaintet und, wenn Flys im Spiel sind
+/*M*/ // auch formatiert werden.
+/*M*/ GetInfo().SetShift( sal_True );
+/*M*/ }
+/*M*/
+/*M*/ if ( IsFlyInCntBase() && !IsQuick() )
+/*M*/ UpdatePos( pCurr, GetTopLeft(), GetStart() );
+/*M*/
+/*M*/ return nNewStart;
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::RecalcRealHeight()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::RecalcRealHeight()
+/*N*/ {
+/*N*/ sal_Bool bMore = sal_True;
+/*N*/ while(bMore)
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ CalcRealHeight();
+/*N*/ bMore = Next() != 0;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcRealHeight()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::CalcRealHeight( sal_Bool bNewLine )
+/*N*/ {
+/*N*/ KSHORT nLineHeight = pCurr->Height();
+/*N*/ pCurr->SetClipping( sal_False );
+/*N*/
+/*N*/ GETGRID( pFrm->FindPageFrm() )
+/*N*/ if ( pGrid && GetInfo().SnapToGrid() )
+/*N*/ {
+/*?*/ const USHORT nGridWidth = pGrid->GetBaseHeight();
+/*?*/ const USHORT nRubyHeight = pGrid->GetRubyHeight();
+/*?*/ const sal_Bool bRubyTop = ! pGrid->GetRubyTextBelow();
+/*?*/
+/*?*/ USHORT nLineHeight = nGridWidth + nRubyHeight;
+/*?*/ USHORT nLineDist = nLineHeight;
+/*?*/
+/*?*/ while ( pCurr->Height() > nLineHeight )
+/*?*/ nLineHeight += nLineDist;
+/*?*/
+/*?*/ KSHORT nAsc = pCurr->GetAscent() +
+/*?*/ ( bRubyTop ?
+/*?*/ ( nLineHeight - pCurr->Height() + nRubyHeight ) / 2 :
+/*?*/ ( nLineHeight - pCurr->Height() - nRubyHeight ) / 2 );
+/*?*/
+/*?*/ pCurr->Height( nLineHeight );
+/*?*/ pCurr->SetAscent( nAsc );
+/*?*/ pInf->GetParaPortion()->SetFixLineHeight();
+/*?*/
+/*?*/ // we ignore any line spacing options except from ...
+/*?*/ const SvxLineSpacingItem* pSpace = aLineInf.GetLineSpacing();
+/*?*/ if ( ! IsParaLine() && pSpace &&
+/*?*/ SVX_INTER_LINE_SPACE_PROP == pSpace->GetInterLineSpaceRule() )
+/*?*/ {
+/*?*/ ULONG nTmp = pSpace->GetPropLineSpace();
+/*?*/
+/*?*/ if( nTmp < 100 )
+/*?*/ nTmp = 100;
+/*?*/
+/*?*/ nTmp *= nLineHeight;
+/*?*/ nLineHeight = (USHORT)(nTmp / 100);
+/*?*/ }
+/*?*/
+/*?*/ pCurr->SetRealHeight( nLineHeight );
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // Das Dummyflag besitzen Zeilen, die nur Flyportions enthalten, diese
+/*N*/ // sollten kein Register etc. beachten. Dummerweise hat kann es eine leere
+/*N*/ // Zeile am Absatzende geben (bei leeren Abs„tzen oder nach einem
+/*N*/ // Shift-Return), die das Register durchaus beachten soll.
+/*N*/ if( !pCurr->IsDummy() || ( !pCurr->GetNext() &&
+/*N*/ GetStart() >= GetTxtFrm()->GetTxt().Len() && !bNewLine ) )
+/*N*/ {
+/*N*/ const SvxLineSpacingItem *pSpace = aLineInf.GetLineSpacing();
+/*N*/ if( pSpace )
+/*N*/ {
+/*N*/ switch( pSpace->GetLineSpaceRule() )
+/*N*/ {
+/*N*/ case SVX_LINE_SPACE_AUTO:
+/*N*/ break;
+/*N*/ case SVX_LINE_SPACE_MIN:
+/*N*/ {
+/*N*/ if( nLineHeight < KSHORT( pSpace->GetLineHeight() ) )
+/*N*/ nLineHeight = pSpace->GetLineHeight();
+/*N*/ break;
+/*N*/ }
+/*N*/ case SVX_LINE_SPACE_FIX:
+/*N*/ {
+/*?*/ nLineHeight = pSpace->GetLineHeight();
+/*?*/ KSHORT nAsc = ( 4 * nLineHeight ) / 5; // 80%
+/*?*/ if( nAsc < pCurr->GetAscent() ||
+/*?*/ nLineHeight - nAsc < pCurr->Height() - pCurr->GetAscent() )
+/*?*/ pCurr->SetClipping( sal_True );
+/*?*/ pCurr->Height( nLineHeight );
+/*?*/ pCurr->SetAscent( nAsc );
+/*?*/ pInf->GetParaPortion()->SetFixLineHeight();
+/*?*/ }
+/*?*/ break;
+/*?*/ default: ASSERT( sal_False, ": unknown LineSpaceRule" );
+/*N*/ }
+/*N*/ if( !IsParaLine() )
+/*N*/ switch( pSpace->GetInterLineSpaceRule() )
+/*N*/ {
+/*N*/ case SVX_INTER_LINE_SPACE_OFF:
+/*N*/ break;
+/*N*/ case SVX_INTER_LINE_SPACE_PROP:
+/*N*/ {
+/*N*/ long nTmp = pSpace->GetPropLineSpace();
+/*N*/ // 50% ist das Minimum, bei 0% schalten wir auf
+/*N*/ // den Defaultwert 100% um ...
+/*N*/ if( nTmp < 50 )
+/*N*/ nTmp = nTmp ? 50 : 100;
+/*N*/
+/*N*/ nTmp *= nLineHeight;
+/*N*/ nTmp /= 100;
+/*N*/ if( !nTmp )
+/*N*/ ++nTmp;
+/*N*/ nLineHeight = (KSHORT)nTmp;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SVX_INTER_LINE_SPACE_FIX:
+/*N*/ {
+/*?*/ nLineHeight += pSpace->GetInterLineSpace();
+/*?*/ break;
+/*N*/ }
+/*N*/ default: ASSERT( sal_False, ": unknown InterLineSpaceRule" );
+/*N*/ }
+/*N*/ }
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ KSHORT nDummy = nLineHeight + 1;
+/*N*/ #endif
+/*N*/
+/*N*/ if( IsRegisterOn() )
+/*N*/ {
+/*N*/ SwTwips nTmpY = Y() + pCurr->GetAscent() + nLineHeight - pCurr->Height();
+/*N*/ SWRECTFN( pFrm )
+/*N*/ if ( bVert )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nTmpY = pFrm->SwitchHorizontalToVertical( nTmpY );
+/*N*/ nTmpY = (*fnRect->fnYDiff)( nTmpY, RegStart() );
+/*N*/ KSHORT nDiff = KSHORT( nTmpY % RegDiff() );
+/*N*/ if( nDiff )
+/*N*/ nLineHeight += RegDiff() - nDiff;
+/*N*/ }
+/*N*/ }
+/*N*/ pCurr->SetRealHeight( nLineHeight );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::FeedInf()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::FeedInf( SwTxtFormatInfo &rInf ) const
+/*N*/ {
+/*N*/ // 3260, 3860: Fly auf jeden Fall loeschen!
+/*N*/ ClearFly( rInf );
+/*N*/ rInf.Init();
+/*N*/
+/*N*/ rInf.ChkNoHyph( CntEndHyph(), CntMidHyph() );
+/*N*/ rInf.SetRoot( pCurr );
+/*N*/ rInf.SetLineStart( nStart );
+/*N*/ rInf.SetIdx( nStart );
+/*N*/ rInf.Left( KSHORT(Left()) );
+/*N*/ rInf.Right( KSHORT(Right()) );
+/*N*/ rInf.First( short(FirstLeft()) );
+/*N*/ rInf.RealWidth( KSHORT(rInf.Right()) - KSHORT(GetLeftMargin()) );
+/*N*/ rInf.Width( rInf.RealWidth() );
+/*N*/ if( ((SwTxtFormatter*)this)->GetRedln() )
+/*N*/ {
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ ((SwTxtFormatter*)this)->GetRedln()->Clear( ((SwTxtFormatter*)this)->GetFnt() );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::FormatReset()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::FormatReset( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ pCurr->Truncate();
+/*N*/ pCurr->Init();
+/*N*/
+/*N*/ // delete pSpaceAdd und pKanaComp
+/*N*/ pCurr->FinishSpaceAdd();
+/*N*/ pCurr->FinishKanaComp();
+/*N*/ pCurr->ResetFlags();
+/*N*/ FeedInf( rInf );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcOnceMore()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFormatter::CalcOnceMore()
+/*N*/ {
+/*N*/ if( pDropFmt )
+/*N*/ {
+/*N*/ const KSHORT nOldDrop = GetDropHeight();
+/*N*/ CalcDropHeight( pDropFmt->GetLines() );
+/*N*/ bOnceMore = nOldDrop != GetDropHeight();
+/*N*/ }
+/*N*/ else
+/*N*/ bOnceMore = sal_False;
+/*N*/ return bOnceMore;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcBottomLine()
+ *************************************************************************/
+
+/*N*/ SwTwips SwTxtFormatter::CalcBottomLine() const
+/*N*/ {
+/*N*/ SwTwips nRet = Y() + GetLineHeight();
+/*N*/ SwTwips nMin = GetInfo().GetTxtFly()->GetMinBottom();
+/*N*/ if( nMin && ++nMin > nRet )
+/*N*/ {
+/*N*/ SwTwips nDist = pFrm->Frm().Height() - pFrm->Prt().Height()
+/*N*/ - pFrm->Prt().Top();
+/*N*/ if( nRet + nDist < nMin )
+/*N*/ {
+/*N*/ sal_Bool bRepaint = HasTruncLines() &&
+/*N*/ GetInfo().GetParaPortion()->GetRepaint()->Bottom() == nRet-1;
+/*N*/ nRet = nMin - nDist;
+/*N*/ if( bRepaint )
+/*N*/ {
+/*?*/ ((SwRepaint*)GetInfo().GetParaPortion()
+/*?*/ ->GetRepaint())->Bottom( nRet-1 );
+/*?*/ ((SwTxtFormatInfo&)GetInfo()).SetPaintOfst( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::_CalcFitToContent()
+ *
+ * FME: This routine does a limited text formatting under the assumption,
+ * that the line length is USHORT twips. I'm not sure why we do not do
+ * a full text formatting using "FormatLine" or "BuildPortion" here,
+ * similar to SwTxtFormatter::Hyphenate(). If we compare this function
+ * to BuildPortions(), it looks like they used to be very similar
+ * (back in 1995), but BuildPortions() changed and _CalcFitToContent()
+ * did not. So _CalcFitToContent() does not give you exact results,
+ * although the results should be good enought for most situations.
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFormatter::AllowRepaintOpt()
+ *
+ * determines if the calculation of a repaint offset is allowed
+ * otherwise each line is painted from 0 (this is a copy of the beginning
+ * of the former SwTxtFormatter::Recycle() function
+ *************************************************************************/
+/*N*/ sal_Bool SwTxtFormatter::AllowRepaintOpt() const
+/*N*/ {
+/*N*/ // reformat position in front of current line? Only in this case
+/*N*/ // we want to set the repaint offset
+/*N*/ sal_Bool bOptimizeRepaint = nStart < GetInfo().GetReformatStart() &&
+/*N*/ pCurr->GetLen();
+/*N*/
+/*N*/ // a special case is the last line of a block adjusted paragraph:
+/*N*/ if ( bOptimizeRepaint )
+/*N*/ {
+/*N*/ switch( GetAdjust() )
+/*N*/ {
+/*N*/ case SVX_ADJUST_BLOCK:
+/*N*/ {
+/*N*/ if( IsLastBlock() || IsLastCenter() )
+/*?*/ bOptimizeRepaint = sal_False;
+/*N*/ else
+/*N*/ {
+/*N*/ // ????: Blank in der letzten Masterzeile (blocksat.sdw)
+/*N*/ bOptimizeRepaint = 0 == pCurr->GetNext() && !pFrm->GetFollow();
+/*N*/ if ( bOptimizeRepaint )
+/*N*/ {
+/*N*/ SwLinePortion *pPos = pCurr->GetFirstPortion();
+/*N*/ while ( pPos && !pPos->IsFlyPortion() )
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ bOptimizeRepaint = !pPos;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ case SVX_ADJUST_CENTER:
+/*N*/ case SVX_ADJUST_RIGHT:
+/*N*/ bOptimizeRepaint = sal_False;
+/*N*/ break;
+/*N*/ default: ;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Schon wieder ein Sonderfall: unsichtbare SoftHyphs
+/*N*/ const xub_StrLen nReformat = GetInfo().GetReformatStart();
+/*N*/ if( bOptimizeRepaint && STRING_LEN != nReformat )
+/*N*/ {
+/*N*/ const xub_Unicode cCh = GetInfo().GetTxt().GetChar( nReformat );
+/*N*/ bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
+/*N*/ || ! GetInfo().HasHint( nReformat );
+/*N*/ }
+/*N*/
+/*N*/ return bOptimizeRepaint;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcOptRepaint()
+ *
+ * calculates an optimal repaint offset for the current line
+ *************************************************************************/
+/*N*/ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
+/*N*/ const SvLongs* pFlyStart )
+/*N*/ {
+/*N*/ if ( GetInfo().GetIdx() < GetInfo().GetReformatStart() )
+/*N*/ // the reformat position is behind our new line, that means
+/*N*/ // something of our text has moved to the next line
+/*N*/ return 0;
+/*N*/
+/*N*/ xub_StrLen nReformat = Min( GetInfo().GetReformatStart(), nOldLineEnd );
+/*N*/
+/*N*/ // in case we do not have any fly in our line, our repaint position
+/*N*/ // is the changed position - 1
+/*N*/ if ( ! pFlyStart && ! pCurr->IsFly() )
+/*N*/ {
+/*N*/ // this is the maximum repaint offset determined during formatting
+/*N*/ // for example: the beginning of the first right tab stop
+/*N*/ // if this value is 0, this means that we do not have an upper
+/*N*/ // limit for the repaint offset
+/*N*/ const long nFormatRepaint = GetInfo().GetPaintOfst();
+/*N*/
+/*N*/ if ( nReformat < GetInfo().GetLineStart() + 3 )
+/*N*/ return 0;
+/*N*/
+/*N*/ // step back for smoother repaint
+/*N*/ --nReformat;
+/*N*/
+/*N*/ // step back two more characters for complex scripts
+/*N*/ const SwScriptInfo& rSI = GetInfo().GetParaPortion()->GetScriptInfo();
+/*N*/ if ( ScriptType::COMPLEX == rSI.ScriptType( nReformat ) )
+/*N*/ nReformat -= 2;
+/*N*/
+/*N*/ // Weird situation: Our line used to end with a hole portion
+/*N*/ // and we delete some characters at the end of our line. We have
+/*N*/ // to take care for repainting the blanks which are not anymore
+/*N*/ // covered by the hole portion
+/*N*/ while ( nReformat > GetInfo().GetLineStart() &&
+/*N*/ CH_BLANK == GetInfo().GetChar( nReformat ) )
+/*N*/ --nReformat;
+/*N*/
+/*N*/ ASSERT( nReformat < GetInfo().GetIdx(), "Reformat too small for me!" );
+/*N*/ SwRect aRect;
+/*N*/
+/*N*/ // Note: GetChareRect is not const. It definitely changes the
+/*N*/ // bMulti flag. We have to save and resore the old value.
+/*N*/ sal_Bool bOldMulti = GetInfo().IsMulti();
+/*N*/ GetCharRect( &aRect, nReformat );
+/*N*/ GetInfo().SetMulti( bOldMulti );
+/*N*/
+/*N*/ return nFormatRepaint ? Min( aRect.Left(), nFormatRepaint ) :
+/*N*/ aRect.Left();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ // nReformat may be wrong, if something around flys has changed:
+/*?*/ // we compare the former and the new fly positions in this line
+/*?*/ // if anything has changed, we carefully have to adjust the right
+/*?*/ // repaint position
+/*?*/ long nPOfst = 0;
+/*?*/ USHORT nCnt = 0;
+/*?*/ USHORT nX = 0;
+/*?*/ USHORT nIdx = GetInfo().GetLineStart();
+/*?*/ SwLinePortion* pPor = pCurr->GetFirstPortion();
+/*?*/
+/*?*/ while ( pPor )
+/*?*/ {
+/*?*/ if ( pPor->IsFlyPortion() )
+/*?*/ {
+/*?*/ // compare start of fly with former start of fly
+/*?*/ if ( pFlyStart &&
+/*?*/ nCnt < pFlyStart->Count() &&
+/*?*/ nX == (*pFlyStart)[ nCnt ] &&
+/*?*/ nIdx < nReformat
+/*?*/ )
+/*?*/ // found fix position, nothing has changed left from nX
+/*?*/ nPOfst = nX + pPor->Width();
+/*?*/ else
+/*?*/ break;
+/*?*/
+/*?*/ nCnt++;
+/*?*/ }
+/*?*/ nX += pPor->Width();
+/*?*/ nIdx += pPor->GetLen();
+/*?*/ pPor = pPor->GetPortion();
+/*?*/ }
+/*?*/
+/*?*/ return nPOfst + GetLeftMargin();
+/*N*/ }
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_itrpaint.cxx b/binfilter/bf_sw/source/core/text/sw_itrpaint.cxx
new file mode 100644
index 000000000000..fb54f6ba5705
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_itrpaint.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include "txtatr.hxx" // SwINetFmt
+
+
+#include <pagedesc.hxx> // SwPageDesc
+
+#include "itrpaint.hxx"
+#include "pormulti.hxx"
+namespace binfilter {
+
+/*************************************************************************
+ * IsUnderlineBreak
+ *
+ * Returns, if we have an underline breaking situation
+ * Adding some more conditions here means you also have to change them
+ * in SwTxtPainter::CheckSpecialUnderline
+ *************************************************************************/
+/*N*/ sal_Bool IsUnderlineBreak( const SwLinePortion& rPor, const SwFont& rFnt )
+/*N*/ {
+/*N*/ return UNDERLINE_NONE == rFnt.GetUnderline() ||
+/*N*/ rPor.IsFlyPortion() || rPor.IsFlyCntPortion() ||
+/*N*/ rPor.IsBreakPortion() || rPor.IsMarginPortion() ||
+/*N*/ rPor.IsHolePortion() ||
+/*N*/ ( rPor.IsMultiPortion() && ! ((SwMultiPortion&)rPor).IsBidi() ) ||
+/*N*/ rFnt.GetEscapement() < 0 || rFnt.IsWordLineMode() ||
+/*N*/ SVX_CASEMAP_KAPITAELCHEN == rFnt.GetCaseMap();
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtPainter::CtorInit()
+ *************************************************************************/
+/*N*/ void SwTxtPainter::CtorInit( SwTxtFrm *pFrm, SwTxtPaintInfo *pNewInf )
+/*N*/ {
+/*N*/ SwTxtCursor::CtorInit( pFrm, pNewInf );
+/*N*/ pInf = pNewInf;
+/*N*/ SwFont *pFnt = GetFnt();
+/*N*/ GetInfo().SetFont( pFnt );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( ALIGN_BASELINE != pFnt->GetAlign() )
+/*N*/ {
+/*?*/ ASSERT( ALIGN_BASELINE == pFnt->GetAlign(),
+/*?*/ "+SwTxtPainter::CTOR: font alignment revolution" );
+/*?*/ pFnt->SetAlign( ALIGN_BASELINE );
+/*N*/ }
+/*N*/ #endif
+/*N*/ bPaintDrop = sal_False;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtPainter::CalcPaintOfst()
+ *************************************************************************/
+
+/*************************************************************************
+ * SwTxtPainter::DrawTextLine()
+ *
+ * Es gibt zwei Moeglichkeiten bei transparenten Font auszugeben:
+ * 1) DrawRect auf die ganze Zeile und die DrawText hinterher
+ * (objektiv schnell, subjektiv langsam).
+ * 2) Fuer jede Portion ein DrawRect mit anschliessendem DrawText
+ * ausgefuehrt (objektiv langsam, subjektiv schnell).
+ * Da der User in der Regel subjektiv urteilt, wird die 2. Methode
+ * als Default eingestellt.
+ *************************************************************************/
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_itrtxt.cxx b/binfilter/bf_sw/source/core/text/sw_itrtxt.cxx
new file mode 100644
index 000000000000..e3599f007226
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_itrtxt.cxx
@@ -0,0 +1,514 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+
+#include <horiornt.hxx>
+
+#include "paratr.hxx"
+#include "errhdl.hxx"
+
+
+#ifdef VERTICAL_LAYOUT
+#include <pagefrm.hxx>
+#include <pagedesc.hxx> // SwPageDesc
+#include <tgrditem.hxx>
+#endif
+
+#include "txtcfg.hxx"
+#include "itrtxt.hxx"
+namespace binfilter {
+
+#if OSL_DEBUG_LEVEL > 1
+# include "txtfrm.hxx" // GetFrmID,
+#endif
+
+/*************************************************************************
+ * SwTxtIter::CtorInit()
+ *************************************************************************/
+
+/*N*/ void SwTxtIter::CtorInit( SwTxtFrm *pNewFrm, SwTxtInfo *pNewInf )
+/*N*/ {
+/*N*/ #ifdef DBGTXT
+/*N*/ // nStopAt laesst sich vom CV bearbeiten.
+/*N*/ static MSHORT nStopAt = 0;
+/*N*/ if( nStopAt == pNewFrm->GetFrmId() )
+/*N*/ {
+/*N*/ int i = pNewFrm->GetFrmId();
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ SwTxtNode *pNode = pNewFrm->GetTxtNode();
+/*N*/
+/*N*/ ASSERT( pNewFrm->GetPara(), "No paragraph" );
+/*N*/
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ SwAttrIter::CtorInit( *pNode, pNewFrm->GetPara()->GetScriptInfo(), pNewFrm );
+/*N*/ #else
+/*N*/ SwAttrIter::CtorInit( *pNode, pNewFrm->GetPara()->GetScriptInfo() );
+/*N*/ #endif
+/*N*/
+/*N*/ pFrm = pNewFrm;
+/*N*/ pInf = pNewInf;
+/*N*/ aLineInf.CtorInit( pNode->GetSwAttrSet() );
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ nFrameStart = pFrm->Frm().Pos().Y() + pFrm->Prt().Pos().Y();
+/*N*/ #else
+/*N*/ aTopLeft = pFrm->Frm().Pos() + pFrm->Prt().Pos();
+/*N*/ #endif
+/*N*/ SwTxtIter::Init();
+/*N*/ if( pNode->GetSwAttrSet().GetRegister().GetValue() )
+/*N*/ bRegisterOn = pFrm->FillRegister( nRegStart, nRegDiff );
+/*N*/ else
+/*N*/ bRegisterOn = sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::Init()
+ *************************************************************************/
+
+/*N*/ void SwTxtIter::Init()
+/*N*/ {
+/*N*/ pCurr = pInf->GetParaPortion();
+/*N*/ nStart = pInf->GetTxtStart();
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ nY = nFrameStart;
+/*N*/ #else
+/*N*/ nY = aTopLeft.Y();
+/*N*/ #endif
+/*N*/ bPrev = sal_True;
+/*N*/ pPrev = 0;
+/*N*/ nLineNr = 1;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::_GetHeightAndAscent()
+ *************************************************************************/
+
+/*N*/ void SwTxtIter::CalcAscentAndHeight( KSHORT &rAscent, KSHORT &rHeight ) const
+/*N*/ {
+/*N*/ rHeight = GetLineHeight();
+/*N*/ rAscent = pCurr->GetAscent() + rHeight - pCurr->Height();
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::_GetPrev()
+ *************************************************************************/
+
+/*N*/ SwLineLayout *SwTxtIter::_GetPrev()
+/*N*/ {
+/*N*/ pPrev = 0;
+/*N*/ bPrev = sal_True;
+/*N*/ SwLineLayout *pLay = pInf->GetParaPortion();
+/*N*/ if( pCurr == pLay )
+/*N*/ return 0;
+/*N*/ while( pLay->GetNext() != pCurr )
+/*N*/ pLay = pLay->GetNext();
+/*N*/ return pPrev = pLay;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::GetPrev()
+ *************************************************************************/
+
+/*N*/ const SwLineLayout *SwTxtIter::GetPrev()
+/*N*/ {
+/*N*/ if(! bPrev)
+/*?*/ _GetPrev();
+/*N*/ return pPrev;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::Prev()
+ *************************************************************************/
+
+/*N*/ const SwLineLayout *SwTxtIter::Prev()
+/*N*/ {
+/*N*/ if( !bPrev )
+/*N*/ _GetPrev();
+/*N*/ if( pPrev )
+/*N*/ {
+/*N*/ bPrev = sal_False;
+/*N*/ pCurr = pPrev;
+/*N*/ nStart -= pCurr->GetLen();
+/*N*/ nY -= GetLineHeight();
+/*N*/ if( !pCurr->IsDummy() && !(--nLineNr) )
+/*N*/ ++nLineNr;
+/*N*/ return pCurr;
+/*N*/ }
+/*N*/ else
+/*N*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::Next()
+ *************************************************************************/
+
+/*N*/ const SwLineLayout *SwTxtIter::Next()
+/*N*/ {
+/*N*/ if(pCurr->GetNext())
+/*N*/ {
+/*N*/ pPrev = pCurr;
+/*N*/ bPrev = sal_True;
+/*N*/ nStart += pCurr->GetLen();
+/*N*/ nY += GetLineHeight();
+/*N*/ if( pCurr->GetLen() || ( nLineNr>1 && !pCurr->IsDummy() ) )
+/*N*/ ++nLineNr;
+/*N*/ return pCurr = pCurr->GetNext();
+/*N*/ }
+/*N*/ else
+/*N*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::NextLine()
+ *************************************************************************/
+
+/*N*/ const SwLineLayout *SwTxtIter::NextLine()
+/*N*/ {
+/*N*/ const SwLineLayout *pNext = Next();
+/*N*/ while( pNext && pNext->IsDummy() && pNext->GetNext() )
+/*N*/ {
+///*?*/ DBG_LOOP;
+/*?*/ pNext = Next();
+/*N*/ }
+/*N*/ return pNext;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::GetNextLine()
+ *************************************************************************/
+
+/*N*/ const SwLineLayout *SwTxtIter::GetNextLine() const
+/*N*/ {
+/*N*/ const SwLineLayout *pNext = pCurr->GetNext();
+/*N*/ while( pNext && pNext->IsDummy() && pNext->GetNext() )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ pNext = pNext->GetNext();
+/*N*/ }
+/*N*/ return (SwLineLayout*)pNext;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::GetPrevLine()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtIter::PrevLine()
+ *************************************************************************/
+
+/*N*/ const SwLineLayout *SwTxtIter::PrevLine()
+/*N*/ {
+/*N*/ const SwLineLayout *pPrev = Prev();
+/*N*/ if( !pPrev )
+/*N*/ return 0;
+/*N*/
+/*N*/ const SwLineLayout *pLast = pPrev;
+/*N*/ while( pPrev && pPrev->IsDummy() )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ pLast = pPrev;
+/*N*/ pPrev = Prev();
+/*N*/ }
+/*N*/ return (SwLineLayout*)(pPrev ? pPrev : pLast);
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::Bottom()
+ *************************************************************************/
+
+/*N*/ void SwTxtIter::Bottom()
+/*N*/ {
+/*N*/ while( Next() )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::CharToLine()
+ *************************************************************************/
+/*N*/
+/*N*/ void SwTxtIter::CharToLine(const xub_StrLen nChar)
+/*N*/ {
+/*N*/ while( nStart + pCurr->GetLen() <= nChar && Next() )
+/*N*/ ;
+/*N*/ while( nStart > nChar && Prev() )
+/*N*/ ;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::CharCrsrToLine()
+ *************************************************************************/
+
+// 1170: beruecksichtigt Mehrdeutigkeiten:
+/*N*/ const SwLineLayout *SwTxtCursor::CharCrsrToLine( const xub_StrLen nPos )
+/*N*/ {
+/*N*/ CharToLine( nPos );
+/*N*/ if( nPos != nStart )
+/*N*/ bRightMargin = sal_False;
+/*N*/ sal_Bool bPrev = bRightMargin && pCurr->GetLen() && GetPrev() &&
+/*N*/ GetPrev()->GetLen();
+/*N*/ if( bPrev && nPos && CH_BREAK == GetInfo().GetChar( nPos-1 ) )
+/*N*/ bPrev = sal_False;
+/*N*/ return bPrev ? PrevLine() : pCurr;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtCrsr::AdjustBaseLine()
+ *************************************************************************/
+
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ USHORT SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine,
+/*N*/ const SwLinePortion* pPor,
+/*N*/ USHORT nPorHeight, USHORT nPorAscent,
+/*N*/ const sal_Bool bAutoToCentered ) const
+/*N*/ {
+/*N*/ if ( pPor )
+/*N*/ {
+/*?*/ nPorHeight = pPor->Height();
+/*?*/ nPorAscent = pPor->GetAscent();
+/*N*/ }
+/*N*/
+/*N*/ USHORT nOfst = rLine.GetRealHeight() - rLine.Height();
+/*N*/
+/*N*/ GETGRID( pFrm->FindPageFrm() )
+/*N*/ const sal_Bool bHasGrid = pGrid && GetInfo().SnapToGrid();
+/*N*/
+/*N*/ if ( bHasGrid )
+/*N*/ {
+/*?*/ const USHORT nGridWidth = pGrid->GetBaseHeight();
+/*?*/ const USHORT nRubyHeight = pGrid->GetRubyHeight();
+/*?*/ const sal_Bool bRubyTop = ! pGrid->GetRubyTextBelow();
+/*?*/
+/*?*/ if ( GetInfo().IsMulti() )
+/*?*/ // we are inside the GetCharRect recursion for multi portions
+/*?*/ // we center the portion in its surrounding line
+/*?*/ nOfst = ( pCurr->Height() - nPorHeight ) / 2 + nPorAscent;
+/*?*/ else
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ {
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ switch ( GetLineInfo().GetVertAlign() ) {
+/*?*/ case SvxParaVertAlignItem::TOP :
+/*?*/ nOfst += nPorAscent;
+/*?*/ break;
+/*?*/ case SvxParaVertAlignItem::CENTER :
+/*?*/ ASSERT( rLine.Height() >= nPorHeight, "Portion height > Line height");
+/*?*/ nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent;
+/*?*/ break;
+/*?*/ case SvxParaVertAlignItem::BOTTOM :
+/*?*/ nOfst += rLine.Height() - nPorHeight + nPorAscent;
+/*?*/ break;
+/*N*/ case SvxParaVertAlignItem::AUTOMATIC :
+/*N*/ if ( bAutoToCentered || GetInfo().GetTxtFrm()->IsVertical() )
+/*N*/ {
+/*?*/ nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent;
+/*?*/ break;
+/*N*/ }
+/*N*/ case SvxParaVertAlignItem::BASELINE :
+/*N*/ // base line
+/*N*/ nOfst += rLine.GetAscent();
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return nOfst;
+/*N*/ }
+/*N*/ #else
+/*N*/ USHORT SwTxtCursor::AdjustBaseLine( const SwLineLayout& rLine,
+/*N*/ const USHORT nPorHeight,
+/*N*/ const USHORT nPorAscent,
+/*N*/ const sal_Bool bAutoToCentered ) const
+/*N*/ {
+/*N*/ USHORT nOfst = rLine.GetRealHeight() - rLine.Height();
+/*N*/
+/*N*/ switch ( GetLineInfo().GetVertAlign() ) {
+/*N*/ case SvxParaVertAlignItem::TOP :
+/*N*/ nOfst += nPorAscent;
+/*N*/ break;
+/*N*/ case SvxParaVertAlignItem::CENTER :
+/*N*/ ASSERT( rLine.Height() >= nPorHeight, "Portion height > Line height");
+/*N*/ nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent;
+/*N*/ break;
+/*N*/ case SvxParaVertAlignItem::BOTTOM :
+/*N*/ nOfst += rLine.Height() - nPorHeight + nPorAscent;
+/*N*/ break;
+/*N*/ case SvxParaVertAlignItem::AUTOMATIC :
+/*N*/ if ( bAutoToCentered )
+/*N*/ {
+/*N*/ nOfst += ( rLine.Height() - nPorHeight ) / 2 + nPorAscent;
+/*N*/ break;
+/*N*/ }
+/*N*/ case SvxParaVertAlignItem::BASELINE :
+/*N*/ // base line
+/*N*/ nOfst += rLine.GetAscent();
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ return nOfst;
+/*N*/ }
+/*N*/ #endif
+
+/*************************************************************************
+ * SwTxtIter::TwipsToLine()
+ *************************************************************************/
+
+/*N*/ const SwLineLayout *SwTxtIter::TwipsToLine( const SwTwips y)
+/*N*/ {
+/*N*/ while( nY + GetLineHeight() <= y && Next() )
+/*N*/ ;
+/*N*/ while( nY > y && Prev() )
+/*N*/ ;
+/*N*/ return pCurr;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::TruncLines()
+ *************************************************************************/
+
+/*N*/ void SwTxtIter::TruncLines( sal_Bool bNoteFollow )
+/*N*/ {
+/*N*/ SwLineLayout *pDel = pCurr->GetNext();
+/*N*/ const xub_StrLen nEnd = nStart + pCurr->GetLen();
+/*N*/
+/*N*/ if( pDel )
+/*N*/ {
+/*N*/ pCurr->SetNext( 0 );
+/*N*/ if( GetHints() && bNoteFollow )
+/*N*/ {
+/*N*/ GetInfo().GetParaPortion()->SetFollowField( pDel->IsRest() );
+/*N*/
+/*N*/ // bug 88534: wrong positioning of flys
+/*N*/ SwTxtFrm* pFollow = GetTxtFrm()->GetFollow();
+/*N*/ if ( pFollow && ! pFollow->IsLocked() &&
+/*N*/ nEnd == pFollow->GetOfst() )
+/*N*/ {
+/*N*/ xub_StrLen nRangeEnd = nEnd;
+/*N*/ SwLineLayout* pLine = pDel;
+/*N*/
+/*N*/ // determine range to be searched for flys anchored as characters
+/*N*/ while ( pLine )
+/*N*/ {
+/*N*/ nRangeEnd += pLine->GetLen();
+/*N*/ pLine = pLine->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ SwpHints* pHints = GetTxtFrm()->GetTxtNode()->GetpSwpHints();
+/*N*/
+/*N*/ // examine hints in range nEnd - (nEnd + nRangeChar)
+/*N*/ for( USHORT i = 0; i < pHints->Count(); i++ )
+/*N*/ {
+/*N*/ const SwTxtAttr* pHt = pHints->GetHt( i );
+/*N*/ if( RES_TXTATR_FLYCNT == pHt->Which() )
+/*N*/ {
+/*N*/ // check, if hint is in our range
+/*?*/ const USHORT nPos = *pHt->GetStart();
+/*?*/ if ( nEnd <= nPos && nPos < nRangeEnd )
+/*?*/ pFollow->_InvalidateRange(
+/*?*/ SwCharRange( nPos, nPos ), 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ delete pDel;
+/*N*/ }
+/*N*/ if( pCurr->IsDummy() &&
+/*N*/ !pCurr->GetLen() &&
+/*N*/ nStart < GetTxtFrm()->GetTxt().Len() )
+/*N*/ pCurr->SetRealHeight( 1 );
+/*N*/ if( GetHints() )
+/*N*/ pFrm->RemoveFtn( nEnd );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtIter::CntHyphens()
+ *************************************************************************/
+
+/*N*/ void SwTxtIter::CntHyphens( sal_uInt8 &nEndCnt, sal_uInt8 &nMidCnt) const
+/*N*/ {
+/*N*/ nEndCnt = 0;
+/*N*/ nMidCnt = 0;
+/*N*/ if ( bPrev && pPrev && !pPrev->IsEndHyph() && !pPrev->IsMidHyph() )
+/*N*/ return;
+/*N*/ SwLineLayout *pLay = pInf->GetParaPortion();
+/*N*/ if( pCurr == pLay )
+/*N*/ return;
+/*N*/ while( pLay != pCurr )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ if ( pLay->IsEndHyph() )
+/*N*/ nEndCnt++;
+/*N*/ else
+/*N*/ nEndCnt = 0;
+/*N*/ if ( pLay->IsMidHyph() )
+/*N*/ nMidCnt++;
+/*N*/ else
+/*N*/ nMidCnt = 0;
+/*N*/ pLay = pLay->GetNext();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwHookOut
+ *
+ * Change current output device to formatting device, this has to be done before
+ * formatting.
+ *************************************************************************/
+
+/*N*/ SwHookOut::SwHookOut( SwTxtSizeInfo& rInfo ) :
+/*N*/ pInf( &rInfo ),
+/*N*/ pOut( rInfo.GetOut() ),
+/*N*/ bOnWin( rInfo.OnWin() )
+/*N*/ {
+/*N*/ ASSERT( rInfo.GetRefDev(), "No reference device for text formatting" )
+/*N*/
+/*N*/ // set new values
+/*N*/ rInfo.SetOut( rInfo.GetRefDev() );
+/*N*/ rInfo.SetOnWin( sal_False );
+/*N*/ }
+
+/*N*/ SwHookOut::~SwHookOut()
+/*N*/ {
+/*N*/ pInf->SetOut( pOut );
+/*N*/ pInf->SetOnWin( bOnWin );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_noteurl.cxx b/binfilter/bf_sw/source/core/text/sw_noteurl.cxx
new file mode 100644
index 000000000000..372a27a0b6b8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_noteurl.cxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+/*N*/ #ifdef _MSC_VER
+/*N*/ #pragma hdrstop
+/*N*/ #endif
+/*N*/
+/*N*/ #include "swtypes.hxx"
+/*N*/
+/*N*/ #ifndef _SV_OUTDEV_HXX //autogen
+/*N*/ #include <vcl/outdev.hxx>
+/*N*/ #endif
+/*N*/ #ifndef _GOODIES_IMAPRECT_HXX
+/*N*/ #include <bf_svtools/imaprect.hxx>
+/*N*/ #endif
+/*N*/ #ifndef _IMAP_HXX //autogen
+/*N*/ #include <bf_svtools/imap.hxx>
+/*N*/ #endif
+/*N*/
+/*N*/ #include "txttypes.hxx"
+/*N*/ #include "noteurl.hxx"
+/*N*/ namespace binfilter {
+/*N*/ // globale Variable, wird in noteurl.Hxx bekanntgegeben
+/*N*/ SwNoteURL *pNoteURL = NULL;
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_porexp.cxx b/binfilter/bf_sw/source/core/text/sw_porexp.cxx
new file mode 100644
index 000000000000..816255a7f33a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_porexp.cxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <inftxt.hxx>
+#include <porexp.hxx>
+namespace binfilter {
+
+/*************************************************************************
+ * class SwExpandPortion
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwExpandPortion::GetExpTxt()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwExpandPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwExpandPortion::GetTxtSize()
+ *************************************************************************/
+
+/*N*/ SwPosSize SwExpandPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
+/*N*/ {
+/*N*/ SwTxtSlot aDiffTxt( &rInf, this );
+/*N*/ return rInf.GetTxtSize();
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwExpandPortion::Format()
+ *************************************************************************/
+
+// 5010: Exp und Tabs
+
+/*N*/ sal_Bool SwExpandPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ SwTxtSlotLen aDiffTxt( &rInf, this );
+/*N*/ const xub_StrLen nFullLen = rInf.GetLen();
+/*N*/
+/*N*/ // So komisch es aussieht, die Abfrage auf GetLen() muss wegen der
+/*N*/ // ExpandPortions _hinter_ aDiffTxt (vgl. SoftHyphs)
+/*N*/ // sal_False returnen wegen SetFull ...
+/*N*/ if( !nFullLen )
+/*N*/ {
+/*N*/ // nicht Init(), weil wir Hoehe und Ascent brauchen
+/*?*/ Width(0);
+/*?*/ return sal_False;
+/*N*/ }
+/*N*/ return SwTxtPortion::Format( rInf );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwExpandPortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwBlankPortion
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwBlankPortion::Compress() { return this; }
+
+/*************************************************************************
+ * SwBlankPortion::MayUnderFlow()
+ *************************************************************************/
+
+// 5497: Es gibt schon Gemeinheiten auf der Welt...
+// Wenn eine Zeile voll mit HardBlanks ist und diese ueberlaeuft,
+// dann duerfen keine Underflows generiert werden!
+// Komplikationen bei Flys...
+
+/*N*/ MSHORT SwBlankPortion::MayUnderFlow( const SwTxtFormatInfo &rInf,
+/*N*/ xub_StrLen nIdx, sal_Bool bUnderFlow ) const
+/*N*/ {
+/*N*/ if( rInf.StopUnderFlow() )
+/*N*/ return 0;
+/*N*/ const SwLinePortion *pPos = rInf.GetRoot();
+/*N*/ if( pPos->GetPortion() )
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ while( pPos && pPos->IsBlankPortion() )
+/*?*/ pPos = pPos->GetPortion();
+/*N*/ if( !pPos || !rInf.GetIdx() || ( !pPos->GetLen() && pPos == rInf.GetRoot() ) )
+/*N*/ return 0; // Nur noch BlankPortions unterwegs
+/*N*/ // Wenn vor uns ein Blank ist, brauchen wir kein Underflow ausloesen,
+/*N*/ // wenn hinter uns ein Blank ist, brauchen wir kein Underflow weiterreichen
+/*N*/ if( bUnderFlow && CH_BLANK == rInf.GetTxt().GetChar( nIdx + 1) )
+/*N*/ return 0;
+/*N*/ if( nIdx && !((SwTxtFormatInfo&)rInf).GetFly() )
+/*N*/ {
+/*N*/ while( pPos && !pPos->IsFlyPortion() )
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ if( !pPos )
+/*N*/ {
+/*N*/ //Hier wird ueberprueft, ob es in dieser Zeile noch sinnvolle Umbrueche
+/*N*/ //gibt, Blanks oder Felder etc., wenn nicht, kein Underflow.
+/*N*/ //Wenn Flys im Spiel sind, lassen wir das Underflow trotzdem zu.
+/*N*/ xub_StrLen nBlank = nIdx;
+/*N*/ while( --nBlank > rInf.GetLineStart() )
+/*N*/ {
+/*N*/ const xub_Unicode cCh = rInf.GetChar( nBlank );
+/*N*/ if( CH_BLANK == cCh ||
+/*N*/ (( CH_TXTATR_BREAKWORD == cCh || CH_TXTATR_INWORD == cCh )
+/*N*/ && rInf.HasHint( nBlank ) ) )
+/*N*/ break;
+/*N*/ }
+/*N*/ if( nBlank <= rInf.GetLineStart() )
+/*N*/ return 0;
+/*N*/ }
+/*N*/ }
+/*N*/ xub_Unicode cCh;
+/*N*/ if( nIdx < 2 || CH_BLANK == (cCh = rInf.GetChar( nIdx - 1 )) )
+/*N*/ return 1;
+/*N*/ if( CH_BREAK == cCh )
+/*N*/ return 0;
+/*N*/ return 2;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwBlankPortion::FormatEOL()
+ *************************************************************************/
+// Format end of Line
+
+
+/*************************************************************************
+ * virtual SwBlankPortion::Format()
+ *************************************************************************/
+
+// 7771: UnderFlows weiterreichen und selbst ausloesen!
+/*N*/ sal_Bool SwBlankPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ const sal_Bool bFull = rInf.IsUnderFlow() || SwExpandPortion::Format( rInf );
+/*N*/ if( bFull && MayUnderFlow( rInf, rInf.GetIdx(), rInf.IsUnderFlow() ) )
+/*N*/ {
+/*N*/ Truncate();
+/*N*/ rInf.SetUnderFlow( this );
+/*N*/ if( rInf.GetLast()->IsKernPortion() )
+/*?*/ rInf.SetUnderFlow( rInf.GetLast() );
+/*N*/ }
+/*N*/ return bFull;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwBlankPortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwBlankPortion::GetExpTxt()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwBlankPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const
+/*N*/ {
+/*N*/ rTxt = cChar;
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwBlankPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwPostItsPortion
+ *************************************************************************/
+
+
+
+
+/*************************************************************************
+ * virtual SwPostItsPortion::Format()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwPostItsPortion::GetExpTxt()
+ *************************************************************************/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_porfld.cxx b/binfilter/bf_sw/source/core/text/sw_porfld.cxx
new file mode 100644
index 000000000000..fef4bfe1a341
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_porfld.cxx
@@ -0,0 +1,526 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+
+
+#include <viewopt.hxx> // SwViewOptions
+
+#include <horiornt.hxx>
+
+#include <inftxt.hxx>
+#include <breakit.hxx>
+#include <porftn.hxx> // SwFtnPortion
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+/*************************************************************************
+ * class SwFldPortion
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwFldPortion::Compress()
+/*N*/ { return (GetLen() || aExpand.Len() || SwLinePortion::Compress()) ? this : 0; }
+
+/*N*/ SwFldPortion *SwFldPortion::Clone( const XubString &rExpand ) const
+/*N*/ {
+/*N*/ SwFont *pNewFnt;
+/*N*/ if( 0 != ( pNewFnt = pFnt ) )
+/*?*/ pNewFnt = new SwFont( *pFnt );
+/*N*/ SwFldPortion* pClone = new SwFldPortion( rExpand, pNewFnt );
+/*N*/ pClone->SetNextOffset( nNextOffset );
+/*N*/ return pClone;
+/*N*/ }
+
+/*N*/ void SwFldPortion::TakeNextOffset( const SwFldPortion* pFld )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 ASSERT( pFld, "TakeNextOffset: Missing Source" );
+/*N*/ }
+
+/*N*/ SwFldPortion::SwFldPortion( const XubString &rExpand, SwFont *pFnt )
+/*N*/ : aExpand(rExpand), pFnt(pFnt), nViewWidth(0), nNextOffset(0),
+/*N*/ bFollow( sal_False ), bHasFollow( sal_False )
+/*N*/ {
+/*N*/ SetWhichPor( POR_FLD );
+/*N*/ }
+
+/*N*/ SwFldPortion::SwFldPortion( const SwFldPortion& rFld )
+/*N*/ : aExpand( rFld.GetExp() ),
+/*N*/ bCenter( rFld.IsCenter() ),
+/*N*/ bFollow( rFld.IsFollow() ),
+/*N*/ bHasFollow( rFld.HasFollow() ),
+/*N*/ bHide( rFld.IsHide() ),
+/*N*/ bLeft( rFld.IsLeft() ),
+/*N*/ nNextOffset( rFld.GetNextOffset() )
+/*N*/ {
+/*N*/ if ( rFld.HasFont() )
+/*N*/ pFnt = new SwFont( *rFld.GetFont() );
+/*N*/ else
+/*N*/ pFnt = 0;
+/*N*/
+/*N*/ SetWhichPor( POR_FLD );
+/*N*/ }
+
+/*N*/ SwFldPortion::~SwFldPortion()
+/*N*/ {
+/*N*/ delete pFnt;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwFldPortion::GetViewWidth()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwFldPortion::Format()
+ *************************************************************************/
+
+// 8653: in keinem Fall nur SetLen(0);
+
+/*************************************************************************
+ * Hilfsklasse SwFldSlot
+ **************************************************************************/
+
+class SwFldSlot
+{
+ const XubString *pOldTxt;
+ XubString aTxt;
+ xub_StrLen nIdx;
+ xub_StrLen nLen;
+ sal_Bool bOn;
+ SwTxtFormatInfo *pInf;
+public:
+ SwFldSlot( const SwTxtFormatInfo* pNew, const SwFldPortion *pPor );
+ ~SwFldSlot();
+};
+
+/*N*/ SwFldSlot::SwFldSlot( const SwTxtFormatInfo* pNew, const SwFldPortion *pPor )
+/*N*/ {
+/*N*/ bOn = pPor->GetExpTxt( *pNew, aTxt );
+/*N*/
+/*N*/ // Der Text wird ausgetauscht...
+/*N*/ if( bOn )
+/*N*/ {
+/*N*/ pInf = (SwTxtFormatInfo*)pNew;
+/*N*/ nIdx = pInf->GetIdx();
+/*N*/ nLen = pInf->GetLen();
+/*N*/ pOldTxt = &(pInf->GetTxt());
+/*N*/ pInf->SetLen( aTxt.Len() );
+/*N*/ if( pPor->IsFollow() )
+/*N*/ {
+/*N*/ pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() );
+/*N*/ pInf->SetIdx( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ XubString aTmp( aTxt );
+/*N*/ aTxt = *pOldTxt;
+/*N*/ aTxt.Erase( nIdx, 1 );
+/*N*/ aTxt.Insert( aTmp, nIdx );
+/*N*/ }
+/*N*/ pInf->SetTxt( aTxt );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwFldSlot::~SwFldSlot()
+/*N*/ {
+/*N*/ if( bOn )
+/*N*/ {
+/*N*/ pInf->SetTxt( *pOldTxt );
+/*N*/ pInf->SetIdx( nIdx );
+/*N*/ pInf->SetLen( nLen );
+/*N*/ pInf->SetFakeLineStart( sal_False );
+/*N*/ }
+/*N*/ }
+
+/*N*/ BYTE SwFldPortion::ScriptChange( const SwTxtSizeInfo &rInf, xub_StrLen& rFull )
+/*N*/ {
+/*N*/ BYTE nRet = 0;
+/*N*/ const String& rTxt = rInf.GetTxt();
+/*N*/ rFull += rInf.GetIdx();
+/*N*/ if( rFull > rTxt.Len() )
+/*?*/ rFull = rTxt.Len();
+/*N*/ if( rFull && pBreakIt->xBreak.is() )
+/*N*/ {
+/*N*/ BYTE nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual();
+/*N*/ xub_StrLen nChg = rInf.GetIdx();
+/*N*/ USHORT nScript;
+/*N*/ {
+/*N*/ nScript = i18n::ScriptType::LATIN;
+/*N*/ if( nActual )
+/*N*/ nScript = nActual == SW_CJK ? i18n::ScriptType::ASIAN
+/*N*/ : i18n::ScriptType::COMPLEX;
+/*N*/ nChg = (xub_StrLen)pBreakIt->xBreak->endOfScript(rTxt,nChg,nScript);
+/*N*/ }
+/*N*/ if( rFull > nChg )
+/*N*/ {
+/*?*/ nRet = nActual;
+/*?*/ nScript = pBreakIt->xBreak->getScriptType( rTxt, nChg );
+/*?*/ if( i18n::ScriptType::ASIAN == nScript )
+/*?*/ nRet += SW_CJK;
+/*?*/ else if( i18n::ScriptType::COMPLEX == nScript )
+/*?*/ nRet += SW_CTL;
+/*?*/ rFull = nChg;
+/*N*/ }
+/*N*/ }
+/*N*/ rFull -= rInf.GetIdx();
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ void SwFldPortion::CheckScript( const SwTxtSizeInfo &rInf )
+/*N*/ {
+/*N*/ String aTxt;
+/*N*/ if( GetExpTxt( rInf, aTxt ) && aTxt.Len() && pBreakIt->xBreak.is() )
+/*N*/ {
+/*N*/ BYTE nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual();
+/*N*/ USHORT nScript;
+/*N*/ {
+/*N*/ nScript = pBreakIt->xBreak->getScriptType( aTxt, 0 );
+/*N*/ xub_StrLen nChg = 0;
+/*N*/ USHORT nCnt = 0;
+/*N*/ if( i18n::ScriptType::WEAK == nScript )
+/*N*/ {
+/*N*/ nChg =(xub_StrLen)pBreakIt->xBreak->endOfScript(aTxt,0,nScript);
+/*N*/ if( nChg < aTxt.Len() )
+/*?*/ nScript = pBreakIt->xBreak->getScriptType( aTxt, nChg );
+/*N*/ }
+/*N*/ }
+/*N*/ BYTE nTmp;
+/*N*/ switch ( nScript ) {
+/*N*/ case i18n::ScriptType::LATIN : nTmp = SW_LATIN; break;
+/*N*/ case i18n::ScriptType::ASIAN : nTmp = SW_CJK; break;
+/*N*/ case i18n::ScriptType::COMPLEX : nTmp = SW_CTL; break;
+/*N*/ default: nTmp = nActual;
+/*N*/ }
+/*N*/ if( nTmp != nActual )
+/*N*/ {
+/*?*/ if( !pFnt )
+/*?*/ pFnt = new SwFont( *rInf.GetFont() );
+/*?*/ pFnt->SetActual( nTmp );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*M*/ sal_Bool SwFldPortion::Format( SwTxtFormatInfo &rInf )
+/*M*/ {
+/*M*/ // Scope wegen aDiffTxt::DTOR!
+/*M*/ xub_StrLen nRest;
+/*M*/ sal_Bool bFull;
+/*M*/ sal_Bool bEOL = sal_False;
+/*M*/ long nTxtRest = rInf.GetTxt().Len() - rInf.GetIdx();
+/*M*/ {
+/*M*/ SwFldSlot aDiffTxt( &rInf, this );
+/*N*/ SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() );
+/*N*/ aLayoutModeModifier.SetAuto();
+/*N*/
+/*M*/ const xub_StrLen nOldFullLen = rInf.GetLen();
+/*M*/ const MSHORT nFollow = IsFollow() ? 0 : 1;
+/*M*/ xub_StrLen nFullLen;
+/*M*/ // In Numerierungen kennen wir keine Platzhalter, sondern
+/*M*/ // nur "normale" Zeichen.
+/*M*/ if( InNumberGrp() )
+/*M*/ nFullLen = nOldFullLen;
+/*M*/ else
+/*M*/ {
+/*M*/ nFullLen = rInf.ScanPortionEnd( rInf.GetIdx(),
+/*N*/ rInf.GetIdx() + nOldFullLen ) - rInf.GetIdx();
+/*M*/ if( nFullLen && CH_BREAK == aExpand.GetChar( nFullLen - 1 ) )
+/*M*/ --nFullLen;
+/*M*/
+/*M*/ if ( STRING_LEN != rInf.GetUnderScorePos() &&
+/*M*/ rInf.GetUnderScorePos() > rInf.GetIdx() )
+/*M*/ rInf.SetUnderScorePos( rInf.GetIdx() );
+/*M*/ }
+/*M*/ BYTE nScriptChg = ScriptChange( rInf, nFullLen );
+/*M*/ rInf.SetLen( nFullLen );
+/*M*/ if( pFnt )
+/*M*/ pFnt->GoMagic( rInf.GetVsh(), pFnt->GetActual() );
+/*M*/
+/*M*/ SwFontSave aSave( rInf, pFnt );
+/*M*/
+/*M*/ // 8674: Laenge muss 0 sein, bei bFull nach Format ist die Laenge
+/*M*/ // gesetzt und wird in nRest uebertragen. Ansonsten bleibt die
+/*M*/ // Laenge erhalten und wuerde auch in nRest einfliessen!
+/*M*/ SetLen(0);
+/*M*/
+/*M*/ // So komisch es aussieht, die Abfrage auf GetLen() muss wegen der
+/*M*/ // ExpandPortions _hinter_ aDiffTxt (vgl. SoftHyphs)
+/*M*/ // sal_False returnen wegen SetFull ...
+/*M*/ if( !nFullLen )
+/*M*/ {
+/*M*/ // nicht Init(), weil wir Hoehe und Ascent brauchen
+/*M*/ Width(0);
+/*M*/ bFull = rInf.Width() <= rInf.GetPos().X();
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ xub_StrLen nOldLineStart = rInf.GetLineStart();
+/*M*/ if( IsFollow() )
+/*M*/ rInf.SetLineStart( 0 );
+/*M*/ rInf.SetNotEOL( nFullLen == nOldFullLen && nTxtRest > nFollow );
+/*M*/
+/*M*/ // the height depending on the fields font is set,
+/*M*/ // this is required for SwTxtGuess::Guess
+/*M*/ Height( rInf.GetTxtHeight() );
+/*M*/ // If a kerning portion is inserted after our field portion,
+/*M*/ // the ascent and height must be known
+/*M*/ SetAscent( rInf.GetAscent() );
+/*M*/ bFull = SwTxtPortion::Format( rInf );
+/*M*/ rInf.SetNotEOL( sal_False );
+/*M*/ rInf.SetLineStart( nOldLineStart );
+/*M*/ }
+/*M*/ xub_StrLen nTmpLen = GetLen();
+/*M*/ bEOL = !nTmpLen && nFollow && bFull;
+/*M*/ nRest = nOldFullLen - nTmpLen;
+/*M*/
+/*M*/ // Das Zeichen wird in der ersten Portion gehalten.
+/*M*/ // Unbedingt nach Format!
+/*M*/ SetLen( nFollow );
+/*M*/
+/*M*/ if( nRest )
+/*M*/ {
+/*M*/ // aExpand ist noch nicht gekuerzt worden, der neue Ofst
+/*M*/ // ergibt sich durch nRest.
+/*M*/ xub_StrLen nNextOfst = aExpand.Len() - nRest;
+/*M*/
+/*M*/ if ( IsQuoVadisPortion() )
+/*?*/ { DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 nNextOfst += ((SwQuoVadisPortion*)this)->GetContTxt().Len();
+/*M*/
+/*M*/ XubString aNew( aExpand, nNextOfst, STRING_LEN );
+/*M*/ aExpand.Erase( nNextOfst, STRING_LEN );
+/*M*/
+/*M*/ // Trailingspace et al. !
+/*M*/ switch( aNew.GetChar( 0 ))
+/*M*/ {
+/*M*/ case CH_BREAK : bFull = sal_True;
+/*M*/ // kein break;
+/*M*/ case ' ' :
+/*M*/ case CH_TAB :
+/*M*/ case CHAR_HARDHYPHEN: // non-breaking hyphen
+/*N*/ case CHAR_SOFTHYPHEN:
+/*N*/ case CHAR_HARDBLANK:
+/*M*/ {
+/*M*/ aNew.Erase( 0, 1 );
+/*M*/ ++nNextOfst;
+/*M*/ break;
+/*M*/ }
+/*M*/ default: ;
+/*M*/ }
+/*M*/
+/*M*/ if( aNew.Len() || IsQuoVadisPortion() )
+/*M*/ {
+/*M*/ // sal_True, weil es ein FollowFeld ist
+/*M*/ // SwFont *pFont = new SwFont( rInf.GetFont()->GetFnt() );
+/*M*/ SwFldPortion *pFld = Clone( aNew );
+/*M*/ if( !pFld->GetFont() )
+/*M*/ {
+/*M*/ SwFont *pNewFnt = new SwFont( *rInf.GetFont() );
+/*M*/ pFld->SetFont( pNewFnt );
+/*M*/ }
+/*M*/ pFld->SetFollow( sal_True );
+/*M*/ SetHasFollow( sal_True );
+/*M*/ // In nNextOffset steht bei einem neuangelegten Feld zunaechst
+/*M*/ // der Offset, an dem es selbst im Originalstring beginnt.
+/*M*/ // Wenn beim Formatieren ein FollowFeld angelegt wird, wird
+/*M*/ // der Offset dieses FollowFelds in nNextOffset festgehalten.
+/*M*/ nNextOffset += nNextOfst;
+/*M*/ pFld->SetNextOffset( nNextOffset );
+/*M*/ rInf.SetRest( pFld );
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if( bEOL && rInf.GetLast() && !rInf.GetUnderFlow() )
+/*M*/ rInf.GetLast()->FormatEOL( rInf );
+/*M*/ return bFull;
+/*M*/ }
+
+/*************************************************************************
+ * virtual SwFldPortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwFldPortion::GetExpTxt()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwFldPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const
+/*N*/ {
+/*N*/ rTxt = aExpand;
+/*N*/ if( !rTxt.Len() && rInf.OnWin() &&
+/*N*/ !rInf.GetOpt().IsPagePreview() && !rInf.GetOpt().IsReadonly() &&
+/*N*/ SwViewOption::IsFieldShadings() &&
+/*N*/ !HasFollow() )
+/*N*/ rTxt = ' ';
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwFldPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwFldPortion::GetTxtSize()
+ *************************************************************************/
+
+/*N*/ SwPosSize SwFldPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
+/*N*/ {
+/*N*/ SwFontSave aSave( rInf, pFnt );
+/*N*/ SwPosSize aSize( SwExpandPortion::GetTxtSize( rInf ) );
+/*N*/ return aSize;
+/*N*/ }
+
+/*************************************************************************
+ * class SwHiddenPortion
+ *************************************************************************/
+
+/*************************************************************************
+ * virtual SwHiddenPortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwHiddenPortion::GetExpTxt()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwHiddenPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const
+/*N*/ {
+/*N*/ // Nicht auf IsHidden() abfragen !
+/*N*/ return SwFldPortion::GetExpTxt( rInf, rTxt );
+/*N*/ }
+
+/*************************************************************************
+ * class SwNumberPortion
+ *************************************************************************/
+
+/*N*/ SwNumberPortion::SwNumberPortion( const XubString &rExpand, SwFont *pFnt,
+/*N*/ const sal_Bool bLft, const sal_Bool bCntr, const KSHORT nMinDst )
+/*N*/ : SwFldPortion( rExpand, pFnt ), nFixWidth(0), nMinDist( nMinDst )
+/*N*/ {
+/*N*/ SetWhichPor( POR_NUMBER );
+/*N*/ SetLeft( bLft );
+/*N*/ SetHide( sal_False );
+/*N*/ SetCenter( bCntr );
+/*N*/ }
+
+
+
+/*************************************************************************
+ * virtual SwNumberPortion::Format()
+ *************************************************************************/
+
+// 5010: Wir sind in der Lage, mehrzeilige NumFelder anzulegen!
+// 3689: Fies ist, wenn man in der Dialogbox soviel Davor-Text
+// eingibt, bis die Zeile ueberlaeuft.
+// Man muss die Fly-Ausweichmanoever beachten!
+
+/*M*/ sal_Bool SwNumberPortion::Format( SwTxtFormatInfo &rInf )
+/*M*/ {
+/*M*/ SetHide( sal_False );
+/*M*/ const sal_Bool bFull = SwFldPortion::Format( rInf );
+/*M*/ SetLen( 0 );
+/*M*/ // a numbering portion can be contained in a rotated portion!!!
+/*M*/ nFixWidth = rInf.IsMulti() ? Height() : Width();
+/*M*/ rInf.SetNumDone( !rInf.GetRest() );
+/*M*/ if( rInf.IsNumDone() )
+/*M*/ {
+/*M*/ // SetAscent( rInf.GetAscent() );
+/*M*/ ASSERT( Height() && nAscent, "NumberPortions without Height | Ascent" )
+/*M*/
+/*M*/ long nDiff = rInf.Left() - rInf.First() + rInf.ForcedLeftMargin();
+/*M*/ // Ein Vorschlag von Juergen und Volkmar:
+/*M*/ // Der Textteil hinter der Numerierung sollte immer
+/*M*/ // mindestens beim linken Rand beginnen.
+/*M*/ if( nDiff < 0 )
+/*M*/ nDiff = 0;
+/*M*/ else if ( nDiff > rInf.X() )
+/*M*/ nDiff -= rInf.X();
+/*M*/ if( nDiff < nFixWidth + nMinDist )
+/*M*/ nDiff = nFixWidth + nMinDist;
+/*M*/ // 2739: Numerierung weicht Fly aus, kein nDiff in der zweiten Runde
+/*M*/ // fieser Sonderfall: FlyFrm liegt in dem Bereich,
+/*M*/ // den wir uns gerade unter den Nagel reissen wollen.
+/*M*/ // Die NumberPortion wird als verborgen markiert.
+/*M*/ if( nDiff > rInf.Width() )
+/*M*/ {
+/*M*/ nDiff = rInf.Width();
+/*M*/ SetHide( sal_True );
+/*M*/ }
+/*M*/
+/*M*/ // A numbering portion can be inside a SwRotatedPortion. Then the
+/*M*/ // Height has to be changed
+/*M*/ if ( rInf.IsMulti() )
+/*M*/ {
+/*M*/ if ( Height() < nDiff )
+/*M*/ Height( KSHORT( nDiff ) );
+/*M*/ }
+/*M*/ else if( Width() < nDiff )
+/*M*/ Width( KSHORT(nDiff) );
+/*M*/ }
+/*M*/ return bFull;
+/*M*/ }
+
+/* Ein FormatEOL deutet daraufhin, dass der folgende Text
+ * nicht mit auf die Zeile passte. Damit die Numerierung mitwandert,
+ * wird diese NumberPortion verborgen.
+ */
+
+ // This caused trouble with flys anchored as characters.
+ // If one of these is numbered but does not fit to the line,
+ // it calls this function, causing a loop because both the number
+ // portion and the fly portion go to the next line
+// SetHide( sal_True );
+
+/*************************************************************************
+ * virtual SwNumberPortion::Paint()
+ *************************************************************************/
+
+
+
+/*************************************************************************
+ * class SwBulletPortion
+ *************************************************************************/
+
+/*N*/ SwBulletPortion::SwBulletPortion( const xub_Unicode cBullet, SwFont *pFont,
+/*N*/ const sal_Bool bLft, const sal_Bool bCntr, const KSHORT nMinDst )
+/*N*/ : SwNumberPortion( XubString( cBullet ), pFont, bLft, bCntr, nMinDst )
+/*N*/ {
+/*N*/ SetWhichPor( POR_BULLET );
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_porfly.cxx b/binfilter/bf_sw/source/core/text/sw_porfly.cxx
new file mode 100644
index 000000000000..3b08c4fb4c93
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_porfly.cxx
@@ -0,0 +1,639 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "dcontact.hxx" // SwDrawContact
+#include "dflyobj.hxx" // SwVirtFlyDrawObj
+#include <errhdl.hxx>
+
+#include "pam.hxx" // SwPosition
+
+#include <horiornt.hxx>
+
+#include "frmfmt.hxx" // SwFrmFmt
+
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <fmtanchr.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtornt.hxx>
+#include <frmatr.hxx>
+#include "flyfrms.hxx"
+#include "txatbase.hxx" // SwTxtAttr
+#include "porfly.hxx"
+#include "inftxt.hxx" // SwTxtPaintInfo
+namespace binfilter {
+
+/*************************************************************************
+ * class SwFlyPortion
+ *
+ * Wir erwarten ein framelokales SwRect !
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwFlyPortion::Format()
+ *************************************************************************/
+/*N*/ sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ ASSERT( Fix() >= rInf.X(), "SwFlyPortion::Format: rush hour" );
+/*N*/ // 8537: Tabs muessen expandiert werden.
+/*N*/ if( rInf.GetLastTab() )
+/*?*/ ((SwLinePortion*)rInf.GetLastTab())->FormatEOL( rInf );
+/*N*/
+/*N*/ // Der Glue wird aufgespannt.
+/*N*/ rInf.GetLast()->FormatEOL( rInf );
+/*N*/ #ifdef USED
+/*N*/ long nFirstDiff;
+/*N*/
+/*N*/ if( !Fix() )
+/*N*/ {
+/*N*/ nFirstDiff = rInf.Left() - long( rInf.First() );
+/*N*/ if( rInf.GetLineStart() )
+/*N*/ {
+/*N*/ if( nFirstDiff < 0 )
+/*N*/ nFirstDiff = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( nFirstDiff > 0 )
+/*N*/ nFirstDiff = 0;
+/*N*/ else
+/*N*/ nFirstDiff = -nFirstDiff;
+/*N*/ }
+/*N*/ nFirstDiff += rInf.GetTxtFrm()->Prt().Left();
+/*N*/ }
+/*N*/ else
+/*N*/ nFirstDiff = 0;
+/*N*/ PrtWidth( (Fix() - rInf.X()) + PrtWidth() + nFirstDiff );
+/*N*/ #else
+/*N*/ PrtWidth( (Fix() - rInf.X()) + PrtWidth() );
+/*N*/ #endif
+/*N*/ if( !Width() )
+/*N*/ {
+/*N*/ ASSERT( Width(), "+SwFlyPortion::Format: a fly is a fly is a fly" );
+/*N*/ Width(1);
+/*N*/ }
+/*N*/
+/*N*/ // Restaurierung
+/*N*/ rInf.SetFly( 0 );
+/*N*/ rInf.Width( rInf.RealWidth() );
+/*N*/ rInf.GetParaPortion()->SetFly( sal_True );
+/*N*/
+/*N*/ // trailing blank:
+/*N*/ if( rInf.GetIdx() < rInf.GetTxt().Len() && 1 < rInf.GetIdx()
+/*N*/ && !rInf.GetRest()
+/*N*/ && ' ' == rInf.GetChar( rInf.GetIdx() )
+/*N*/ && ' ' != rInf.GetChar( rInf.GetIdx() - 1 )
+/*N*/ && ( !rInf.GetLast() || !rInf.GetLast()->IsBreakPortion() ) )
+/*N*/ {
+/*N*/ SetBlankWidth( rInf.GetTxtSize( ' ' ).Width() );
+/*N*/ SetLen( 1 );
+/*N*/ }
+/*N*/
+/*N*/ const KSHORT nNewWidth = rInf.X() + PrtWidth();
+/*N*/ if( rInf.Width() <= nNewWidth )
+/*N*/ {
+/*N*/ Truncate();
+/*N*/ if( nNewWidth > rInf.Width() )
+/*N*/ {
+/*N*/ PrtWidth( nNewWidth - rInf.Width() );
+/*N*/ SetFixWidth( PrtWidth() );
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwFlyCntPortion::Format()
+ *************************************************************************/
+/*M*/ sal_Bool SwFlyCntPortion::Format( SwTxtFormatInfo &rInf )
+/*M*/ {
+/*M*/ sal_Bool bFull = rInf.Width() < rInf.X() + PrtWidth();
+/*M*/
+/*M*/ if( bFull )
+/*M*/ {
+/*M*/ // 3924: wenn die Zeile voll ist und der zeichengebundene Frame am
+/*M*/ // Anfang der Zeile steht.
+/*M*/ // 5157: nicht wenn einem Fly ausgewichen werden kann!
+/*M*/ // "Begin of line" criteria ( ! rInf.X() ) has to be extended.
+/*M*/ // KerningPortions at beginning of line, e.g., for grid layout
+/*M*/ // must be considered.
+/*M*/ const SwLinePortion* pLastPor = rInf.GetLast();
+/*M*/ const USHORT nLeft = ( pLastPor &&
+/*M*/ ( pLastPor->IsKernPortion() ||
+/*M*/ pLastPor->IsErgoSumPortion() ) ) ?
+/*M*/ pLastPor->Width() :
+/*M*/ 0;
+/*M*/
+/*M*/ if( nLeft == rInf.X() && ! rInf.GetFly() )
+/*M*/ {
+/*M*/ Width( rInf.Width() );
+/*M*/ bFull = sal_False; // Damit Notizen noch in dieser Zeile landen
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ if( !rInf.GetFly() )
+/*M*/ rInf.SetNewLine( sal_True );
+/*M*/ Width(0);
+/*M*/ SetAscent(0);
+/*M*/ SetLen(0);
+/*M*/ if( rInf.GetLast() )
+/*M*/ rInf.GetLast()->FormatEOL( rInf );
+/*M*/
+/*M*/ return bFull;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ rInf.GetParaPortion()->SetFly( sal_True );
+/*M*/ return bFull;
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFrm::MoveFlyInCnt() haengt jetzt die zeichengebundenen Objekte
+ * innerhalb des angegebenen Bereichs um, damit koennen diese vom Master
+ * zum Follow oder umgekehrt wandern.
+ *************************************************************************/
+/*N*/ void SwTxtFrm::MoveFlyInCnt( SwTxtFrm *pNew, xub_StrLen nStart, xub_StrLen nEnd )
+/*N*/ {
+/*N*/ SwDrawObjs *pObjs;
+/*N*/ if ( 0 != (pObjs = GetDrawObjs()) )
+/*N*/ {
+/*N*/ for ( int i = 0; GetDrawObjs() && i < int(pObjs->Count()); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pObjs)[MSHORT(i)];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if( pFly->IsFlyInCntFrm() )
+/*N*/ {
+/*?*/ const SwFmtAnchor &rAnch = pFly->GetFmt()->GetAnchor();
+/*?*/ const SwPosition *pPos = rAnch.GetCntntAnchor();
+/*?*/ xub_StrLen nIdx = pPos->nContent.GetIndex();
+/*?*/ if ( nIdx >= nStart && nEnd > nIdx )
+/*?*/ {
+/*?*/ RemoveFly( pFly );
+/*?*/ pNew->AppendFly( pFly );
+/*?*/ --i;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pO);
+/*N*/ const SwFmtAnchor &rAnch = pContact->GetFmt()->GetAnchor();
+/*N*/ if ( FLY_IN_CNTNT == rAnch.GetAnchorId() )
+/*N*/ {
+/*?*/ const SwPosition *pPos = rAnch.GetCntntAnchor();
+/*?*/ xub_StrLen nIdx = pPos->nContent.GetIndex();
+/*?*/ if ( nIdx >= nStart && nEnd > nIdx )
+/*?*/ {
+/*?*/ RemoveDrawObj( pContact );
+/*?*/ pNew->AppendDrawObj( pContact );
+/*?*/ --i;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::CalcFlyPos()
+ *************************************************************************/
+/*N*/ xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch )
+/*N*/ {
+/*N*/ SwpHints* pHints = GetTxtNode()->GetpSwpHints();
+/*N*/ ASSERT( pHints, "CalcFlyPos: Why me?" );
+/*N*/ if( !pHints )
+/*N*/ return STRING_LEN;
+/*N*/ SwTxtAttr* pFound = NULL;
+/*N*/ for( MSHORT i = 0; i < pHints->Count(); i++)
+/*N*/ {
+/*N*/ SwTxtAttr *pHt = pHints->GetHt( i );
+/*N*/ if( RES_TXTATR_FLYCNT == pHt->Which() )
+/*N*/ {
+/*N*/ SwFrmFmt* pFrmFmt = pHt->GetFlyCnt().GetFrmFmt();
+/*N*/ if( pFrmFmt == pSearch )
+/*N*/ pFound = pHt;
+/*N*/ }
+/*N*/ }
+/*N*/ ASSERT( pHints, "CalcFlyPos: Not Found!" );
+/*N*/ if( !pFound )
+/*N*/ return STRING_LEN;
+/*N*/ return *pFound->GetStart();
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwFlyCntPortion::Paint()
+ *************************************************************************/
+
+/*************************************************************************
+ * SwFlyCntPortion::SwFlyCntPortion()
+ *
+ * Es werden die Masze vom pFly->OutRect() eingestellt.
+ * Es erfolgt ein SetBase() !
+ *************************************************************************/
+/*N*/ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
+/*N*/ SwFlyInCntFrm *pFly, const Point &rBase,
+/*N*/ long nLnAscent, long nLnDescent,
+/*N*/ long nFlyAsc, long nFlyDesc, sal_uInt8 nFlags ) :
+/*N*/ pContact( pFly ),
+/*N*/ bDraw( sal_False ),
+/*N*/ bMax( sal_False ),
+/*N*/ nAlign( 0 )
+/*N*/ {
+/*N*/ ASSERT( pFly, "SwFlyCntPortion::SwFlyCntPortion: no SwFlyInCntFrm!" );
+/*N*/ nLineLength = 1;
+/*N*/ nFlags |= SETBASE_ULSPACE | SETBASE_INIT;
+/*N*/ SetBase( rFrm, rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags );
+/*N*/ SetWhichPor( POR_FLYCNT );
+/*N*/ }
+
+/*N*/ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
+/*N*/ SwDrawContact *pDrawContact, const Point &rBase,
+/*N*/ long nLnAscent, long nLnDescent, long nFlyAsc,
+/*N*/ long nFlyDesc, sal_uInt8 nFlags ) :
+/*N*/ pContact( pDrawContact ),
+/*N*/ bDraw( sal_True ),
+/*N*/ bMax( sal_False ),
+/*N*/ nAlign( 0 )
+/*N*/ {
+/*N*/ ASSERT( pDrawContact, "SwFlyCntPortion::SwFlyCntPortion: no SwDrawContact!" );
+/*N*/ if( !pDrawContact->GetAnchor() )
+/*N*/ {
+/*N*/ if( nFlags & SETBASE_QUICK )
+/*N*/ {
+/*N*/ Point aAnchorPos = pDrawContact->GetMaster()->GetAnchorPos();
+/*N*/ pDrawContact->ConnectToLayout();
+/*N*/ pDrawContact->GetMaster()->SetAnchorPos( aAnchorPos );
+/*N*/ }
+/*N*/ else
+/*N*/ pDrawContact->ConnectToLayout();
+/*N*/ }
+/*N*/ nLineLength = 1;
+/*N*/ nFlags |= SETBASE_ULSPACE | SETBASE_INIT;
+/*N*/
+/*N*/ SetBase( rFrm, rBase, nLnAscent, nLnDescent, nFlyAsc, nFlyDesc, nFlags );
+/*N*/
+/*N*/ SetWhichPor( POR_FLYCNT );
+/*N*/ }
+
+/*N*/ const SwFrmFmt *SwFlyCntPortion::GetFrmFmt() const
+/*N*/ {
+/*N*/ if( bDraw )
+/*N*/ return GetDrawContact()->GetFmt();
+/*N*/ else
+/*N*/ return GetFlyFrm()->GetFmt();
+/*N*/ }
+
+/*************************************************************************
+ * SwFlyCntPortion::SetBase()
+ *
+ * Nach dem Setzen des RefPoints muss der Ascent neu berechnet werden,
+ * da er von der RelPos abhaengt.
+ * pFly->GetRelPos().Y() bezeichnet die relative Position zur Baseline.
+ * Bei 0 liegt der obere Rand des FlyCnt auf der Baseline der Zeile.
+ *************************************************************************/
+
+/*N*/ void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase,
+/*N*/ long nLnAscent, long nLnDescent, long nFlyAsc,
+/*N*/ long nFlyDesc, sal_uInt8 nFlags )
+/*N*/ {
+/*N*/ // Note: rBase is an absolute value
+/*N*/ SWAP_IF_SWAPPED( (&rFrm ) )
+/*N*/ SWRECTFN( (&rFrm ) )
+/*N*/ Point aBase( rBase );
+/*N*/ const SwFrmFmt* pFmt = GetFrmFmt();
+/*N*/ const SwFmtVertOrient &rVert = pFmt->GetVertOrient();
+/*N*/ const SwVertOrient eOri = rVert.GetVertOrient();
+/*N*/ const SvxLRSpaceItem &rLRSpace = pFmt->GetLRSpace();
+/*N*/ const SvxULSpaceItem &rULSpace = pFmt->GetULSpace();
+/*N*/
+/*N*/ //Die vertikale Position wird berechnet, die relative horizontale
+/*N*/ //Position ist stets 0.
+/*N*/
+/*N*/ SdrObject *pSdrObj;
+/*N*/ SwRect aBoundRect;
+/*N*/ long nOldWidth;
+/*N*/ if( bDraw )
+/*N*/ {
+/*N*/ // OD 20.06.2003 #108784# - determine drawing object ('master' or 'virtual')
+/*N*/ // by frame.
+/*N*/ pSdrObj = GetDrawContact()->GetDrawObjectByAnchorFrm( rFrm );
+/*N*/ if ( !pSdrObj )
+/*N*/ {
+/*N*/ ASSERT( false, "SwFlyCntPortion::SetBase(..) - No drawing object found by <GetDrawContact()->GetDrawObjectByAnchorFrm( rFrm )>" );
+/*N*/ pSdrObj = GetDrawContact()->GetMaster();
+/*N*/ }
+/*N*/ aBoundRect = pSdrObj->GetBoundRect();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aBoundRect = GetFlyFrm()->Frm();
+/*N*/ nOldWidth = aBoundRect.Width();
+/*N*/ }
+/*N*/
+/*N*/ nOldWidth = (aBoundRect.*fnRect->fnGetWidth)();
+/*N*/
+/*N*/ long nLRSpaceLeft, nLRSpaceRight, nULSpaceUpper, nULSpaceLower;
+/*N*/ if ( rFrm.IsVertical() )
+/*N*/ {
+/*N*/ // Seems to be easier to do it all the horizontal way
+/*N*/ // So, from now on think horizontal.
+/*N*/ rFrm.SwitchVerticalToHorizontal( aBoundRect );
+/*N*/ rFrm.SwitchVerticalToHorizontal( aBase );
+/*N*/
+/*N*/ // convert the spacing values
+/*N*/ nLRSpaceLeft = rULSpace.GetUpper();
+/*N*/ nLRSpaceRight = rULSpace.GetLower();
+/*N*/ nULSpaceUpper = rLRSpace.GetRight();
+/*N*/ nULSpaceLower = rLRSpace.GetLeft();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if ( rFrm.IsRightToLeft() )
+/*N*/ {
+/*N*/ nLRSpaceLeft = rLRSpace.GetRight();
+/*N*/ nLRSpaceRight = rLRSpace.GetLeft();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nLRSpaceLeft = rLRSpace.GetLeft();
+/*N*/ nLRSpaceRight = rLRSpace.GetRight();
+/*N*/ }
+/*N*/
+/*N*/ nULSpaceUpper = rULSpace.GetUpper();
+/*N*/ nULSpaceLower = rULSpace.GetLower();
+/*N*/ }
+/*N*/
+/*N*/ if( nFlags & SETBASE_ULSPACE )
+/*N*/ aBase.X() += nLRSpaceLeft;
+/*N*/ aBase.Y() += nULSpaceUpper;
+/*N*/
+/*N*/ if( bDraw )
+/*N*/ {
+/*N*/ SwRect aSnapRect = pSdrObj->GetSnapRect();
+/*N*/ if ( rFrm.IsVertical() )
+/*N*/ rFrm.SwitchVerticalToHorizontal( aSnapRect );
+/*N*/
+/*N*/ if( nFlags & SETBASE_ULSPACE )
+/*N*/ aBase.X() += aSnapRect.Left() - aBoundRect.Left();
+/*N*/ aBase.Y() += aSnapRect.Top() - aBoundRect.Top();
+/*N*/ }
+/*N*/
+/*N*/ aBoundRect.Left( aBoundRect.Left() - nLRSpaceLeft );
+/*N*/ aBoundRect.Width( aBoundRect.Width() + nLRSpaceRight );
+/*N*/ aBoundRect.Top( aBoundRect.Top() - nULSpaceUpper );
+/*N*/ aBoundRect.Height( aBoundRect.Height() + nULSpaceLower );
+/*N*/
+/*N*/ SwTwips nBoundHeight = ( nFlags & SETBASE_ROTATE ) ?
+/*N*/ aBoundRect.Width() : aBoundRect.Height();
+/*N*/ SwTwips nRelPos = 0;
+/*N*/ if ( eOri == VERT_NONE )
+/*N*/ nRelPos = rVert.GetPos();
+/*N*/ else
+/*N*/ {
+/*N*/ nRelPos = 0;
+/*N*/ if ( eOri == VERT_CENTER )
+/*N*/ nRelPos -= nBoundHeight / 2;
+/*N*/ else if ( eOri == VERT_TOP )
+/*N*/ nRelPos -= nBoundHeight;
+/*N*/ else if ( eOri == VERT_BOTTOM )
+/*N*/ ;
+/*N*/ else if ( eOri == VERT_CHAR_CENTER )
+/*N*/ nRelPos -= ( nBoundHeight + nLnAscent - nLnDescent ) / 2;
+/*N*/ else if ( eOri == VERT_CHAR_TOP )
+/*N*/ nRelPos -= nLnAscent;
+/*N*/ else if ( eOri == VERT_CHAR_BOTTOM )
+/*N*/ nRelPos += nLnDescent - nBoundHeight;
+/*N*/ else
+/*N*/ {
+/*N*/ if( nBoundHeight >= nFlyAsc + nFlyDesc )
+/*N*/ {
+/*N*/ // wenn ich genauso gross bin wie die Zeile, brauche ich mich
+/*N*/ // nicht an der Zeile nicht weiter ausrichten, ich lasse
+/*N*/ // dann auch den max. Ascent der Zeile zunaechst unveraendert
+/*N*/ nRelPos -= nFlyAsc;
+/*N*/ if ( eOri == VERT_LINE_CENTER )
+/*N*/ SetAlign( 2 );
+/*N*/ else if ( eOri == VERT_LINE_TOP )
+/*N*/ SetAlign( 1 );
+/*N*/ else if ( eOri == VERT_LINE_BOTTOM )
+/*N*/ SetAlign( 3 );
+/*N*/ }
+/*N*/ else if ( eOri == VERT_LINE_CENTER )
+/*N*/ {
+/*N*/ nRelPos -= ( nBoundHeight +nFlyAsc -nFlyDesc ) / 2;
+/*N*/ SetAlign( 2 );
+/*N*/ }
+/*N*/ else if ( eOri == VERT_LINE_TOP )
+/*N*/ {
+/*N*/ nRelPos -= nFlyAsc;
+/*N*/ SetAlign( 1 );
+/*N*/ }
+/*N*/ else if ( eOri == VERT_LINE_BOTTOM )
+/*N*/ {
+/*N*/ nRelPos += nFlyDesc - nBoundHeight;
+/*N*/ SetAlign( 3 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nFlags & SETBASE_INIT && nRelPos < 0 && nFlyAsc < -nRelPos )
+/*N*/ {
+/*N*/ if( nFlags & SETBASE_ROTATE )
+/*N*/ aBase.X() -= nFlyAsc + nRelPos;
+/*N*/ else
+/*N*/ aBase.Y() -= nFlyAsc + nRelPos;
+/*N*/ }
+/*N*/
+/*N*/ if( nFlags & SETBASE_BIDI )
+/*N*/ aBase.X() -= aBoundRect.Width();
+/*N*/
+/*N*/ Point aRelPos;
+/*N*/ if( nFlags & SETBASE_ROTATE )
+/*N*/ {
+/*N*/ if( nFlags & SETBASE_REVERSE )
+/*N*/ aRelPos.X() = -nRelPos - aBoundRect.Width();
+/*N*/ else
+/*N*/ {
+/*N*/ aRelPos.X() = nRelPos;
+/*N*/ aRelPos.Y() = -aBoundRect.Height();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ aRelPos.Y() = nRelPos;
+/*N*/ if( bDraw )
+/*N*/ {
+/*N*/ if( !( nFlags & SETBASE_QUICK ) )
+/*N*/ {
+/*N*/ if( rVert.GetPos() != nRelPos && eOri != VERT_NONE )
+/*N*/ {
+/*N*/ // Das aRelPos wird gepflegt, weil sonst SwDrawContact::_Changed
+/*N*/ // auf die Idee kommen koennte, auf VERT_NONE umzuschalten.
+/*N*/ SwFmtVertOrient aVert( rVert );
+/*N*/ aVert.SetPos( nRelPos );
+/*N*/ ((SwFrmFmt*)pFmt)->LockModify();
+/*N*/ ((SwFrmFmt*)pFmt)->SetAttr( aVert );
+/*N*/ ((SwFrmFmt*)pFmt)->UnlockModify();
+/*N*/ }
+/*N*/ Point aAnchorBase( aBase );
+/*N*/ if ( rFrm.IsRightToLeft() )
+/*N*/ {
+/*N*/ rFrm.SwitchLTRtoRTL( aAnchorBase );
+/*N*/ aAnchorBase.X() -= nOldWidth;
+/*N*/ }
+/*N*/ if ( rFrm.IsVertical() )
+/*N*/ rFrm.SwitchHorizontalToVertical( aAnchorBase );
+/*N*/
+/*N*/ // OD 20.06.2003 #108784# - consider 'virtual' drawing objects
+/*N*/ if ( pSdrObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ SwDrawVirtObj* pDrawVirtObj = static_cast<SwDrawVirtObj*>(pSdrObj);
+/*N*/
+/*N*/ pDrawVirtObj->NbcSetAnchorPos( aAnchorBase );
+/*N*/ pDrawVirtObj->AdjustRelativePosToReference();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // There used to be a ImpSetAnchorPos here. Very dangerous
+/*N*/ // for group object.
+/*N*/ pSdrObj->NbcSetAnchorPos( aAnchorBase );
+/*N*/ // OD 20.06.2003 #108784# - correct movement of 'virtual' drawing
+/*N*/ // objects caused by the <SetAnchorPos(..)> of the 'master' drawing object.
+/*N*/ GetDrawContact()->CorrectRelativePosOfVirtObjs();
+/*N*/ }
+/*N*/
+/*N*/ SwRect aSnapRect = pSdrObj->GetSnapRect();
+/*N*/
+/*N*/ if ( rFrm.IsVertical() )
+/*N*/ rFrm.SwitchVerticalToHorizontal( aSnapRect );
+/*N*/
+/*N*/ Point aDiff;
+/*N*/ if ( rFrm.IsRightToLeft() )
+/*N*/ aDiff = aRelPos + aAnchorBase - aSnapRect.TopLeft();
+/*N*/ else
+/*N*/ aDiff = aRelPos + aBase - aSnapRect.TopLeft();
+/*N*/
+/*N*/ if ( rFrm.IsVertical() )
+/*N*/ aDiff = Point( -aDiff.Y(), aDiff.X() );
+/*N*/
+/*N*/ // OD 20.06.2003 #108784# - consider 'virtual' drawing objects
+/*N*/ if ( !pSdrObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ // #80046# here a Move() is necessary, a NbcMove() is NOT ENOUGH(!)
+/*N*/ pSdrObj->Move( Size( aDiff.X(), aDiff.Y() ) );
+/*N*/ // OD 23.06.2003 #108784# - correct movement of 'virtual' drawing
+/*N*/ // objects caused by the <Move(..)> of the 'master' drawing object
+/*N*/ GetDrawContact()->MoveOffsetOfVirtObjs( Size( -aDiff.X(), -aDiff.Y() ) );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( rFrm.IsVertical() )
+/*N*/ rFrm.SwitchHorizontalToVertical( aBase );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Point aRelAttr;
+/*N*/ if ( rFrm.IsRightToLeft() )
+/*N*/ {
+/*N*/ rFrm.SwitchLTRtoRTL( aBase );
+/*N*/ aBase.X() -= nOldWidth;
+/*N*/ }
+/*N*/ if ( rFrm.IsVertical() )
+/*N*/ {
+/*N*/ rFrm.SwitchHorizontalToVertical( aBase );
+/*N*/ aRelAttr = Point( -nRelPos, 0 );
+/*N*/ aRelPos = Point( -aRelPos.Y(), aRelPos.X() );
+/*N*/ }
+/*N*/ else
+/*N*/ aRelAttr = Point( 0, nRelPos );
+/*N*/
+/*N*/ if ( !(nFlags & SETBASE_QUICK) && (aBase != GetFlyFrm()->GetRefPoint() ||
+/*N*/ aRelAttr != GetFlyFrm()->GetCurRelPos()) )
+/*N*/ {
+/*N*/ GetFlyFrm()->SetRefPoint( aBase, aRelAttr, aRelPos );
+/*N*/ if( nOldWidth != (GetFlyFrm()->Frm().*fnRect->fnGetWidth)() )
+/*N*/ {
+/*N*/ aBoundRect = GetFlyFrm()->Frm();
+/*N*/ aBoundRect.Left( aBoundRect.Left() - rLRSpace.GetLeft() );
+/*N*/ aBoundRect.Width( aBoundRect.Width() + rLRSpace.GetRight() );
+/*N*/ aBoundRect.Top( aBoundRect.Top() - rULSpace.GetUpper() );
+/*N*/ aBoundRect.Height( aBoundRect.Height() + rULSpace.GetLower() );
+/*N*/ }
+/*N*/ }
+/*N*/ ASSERT( (GetFlyFrm()->Frm().*fnRect->fnGetHeight)(),
+/*N*/ "SwFlyCntPortion::SetBase: flyfrm has an invalid height" );
+/*N*/ }
+/*N*/ aRef = aBase;
+/*N*/ if( nFlags & SETBASE_ROTATE )
+/*N*/ SvXSize( aBoundRect.SSize() );
+/*N*/ else
+/*N*/ SvLSize( aBoundRect.SSize() );
+/*N*/ if( Height() )
+/*N*/ {
+/*N*/ if ( nRelPos < 0 )
+/*N*/ {
+/*N*/ nAscent = Abs( int( nRelPos ) );
+/*N*/ if( nAscent > Height() )
+/*N*/ Height( nAscent );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nAscent = 0;
+/*N*/ Height( Height() + int( nRelPos ) );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Height( 1 );
+/*N*/ nAscent = 0;
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( ( &rFrm ) )
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwFlyCntPortion::GetFlyCrsrOfst()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwFlyCntPortion::GetCrsrOfst()
+ *************************************************************************/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_porglue.cxx b/binfilter/bf_sw/source/core/text/sw_porglue.cxx
new file mode 100644
index 000000000000..c041e8ff6548
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_porglue.cxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "paratr.hxx" // pTabStop, ADJ*
+
+
+#include "txtcfg.hxx"
+#include "porlay.hxx" // SwParaPortion, SetFull
+#include "porfly.hxx" // SwParaPortion, SetFull
+namespace binfilter {
+
+/*************************************************************************
+ * class SwGluePortion
+ *************************************************************************/
+
+/*N*/ SwGluePortion::SwGluePortion( const KSHORT nInitFixWidth )
+/*N*/ : nFixWidth( nInitFixWidth )
+/*N*/ {
+/*N*/ PrtWidth( nFixWidth );
+/*N*/ SetWhichPor( POR_GLUE );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwGluePortion::GetCrsrOfst()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwGluePortion::GetTxtSize()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwGluePortion::GetExpTxt()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwGluePortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwGluePortion::MoveGlue()
+ *************************************************************************/
+
+/*N*/ void SwGluePortion::MoveGlue( SwGluePortion *pTarget, const short nPrtGlue )
+/*N*/ {
+/*N*/ short nPrt = Min( nPrtGlue, GetPrtGlue() );
+/*N*/ if( 0 < nPrt )
+/*N*/ {
+/*N*/ pTarget->AddPrtWidth( nPrt );
+/*N*/ SubPrtWidth( nPrt );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * void SwGluePortion::Join()
+ *************************************************************************/
+
+/*N*/ void SwGluePortion::Join( SwGluePortion *pVictim )
+/*N*/ {
+/*N*/ // Die GluePortion wird ausgesogen und weggespuelt ...
+/*N*/ AddPrtWidth( pVictim->PrtWidth() );
+/*N*/ SetLen( pVictim->GetLen() + GetLen() );
+/*N*/ if( Height() < pVictim->Height() )
+/*N*/ Height( pVictim->Height() );
+/*N*/
+/*N*/ AdjFixWidth();
+/*N*/ Cut( pVictim );
+/*N*/ delete pVictim;
+/*N*/ }
+
+/*************************************************************************
+ * class SwFixPortion
+ *************************************************************************/
+
+// Wir erwarten ein framelokales SwRect !
+/*N*/ SwFixPortion::SwFixPortion( const SwRect &rRect )
+/*N*/ :SwGluePortion( KSHORT(rRect.Width()) ), nFix( KSHORT(rRect.Left()) )
+/*N*/ {
+/*N*/ Height( KSHORT(rRect.Height()) );
+/*N*/ SetWhichPor( POR_FIX );
+/*N*/ }
+/*N*/
+/*N*/ SwFixPortion::SwFixPortion(const KSHORT nFixWidth, const KSHORT nFixPos)
+/*N*/ : SwGluePortion(nFixWidth), nFix(nFixPos)
+/*N*/ {
+/*N*/ SetWhichPor( POR_FIX );
+/*N*/ }
+
+/*************************************************************************
+ * class SwMarginPortion
+ *************************************************************************/
+
+/*N*/ SwMarginPortion::SwMarginPortion( const KSHORT nFixWidth )
+/*N*/ :SwGluePortion( nFixWidth )
+/*N*/ {
+/*N*/ SetWhichPor( POR_MARGIN );
+/*N*/ }
+
+/*************************************************************************
+ * SwMarginPortion::AdjustRight()
+ *
+ * In der umschliessenden Schleife werden alle Portions durchsucht,
+ * dabei werden erst die am Ende liegenden GluePortions verarbeitet.
+ * Das Ende wird nach jeder Schleife nach vorne verlegt, bis keine
+ * GluePortions mehr vorhanden sind.
+ * Es werden immer GluePortion-Paare betrachtet (pLeft und pRight),
+ * wobei Textportions zwischen pLeft und pRight hinter pRight verschoben
+ * werden, wenn pRight genuegend Glue besitzt. Bei jeder Verschiebung
+ * wandert ein Teil des Glues von pRight nach pLeft.
+ * Im naechsten Schleifendurchlauf ist pLeft das pRight und das Spiel
+ * beginnt von vorne.
+ *************************************************************************/
+
+/*N*/ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr )
+/*N*/ {
+/*N*/ SwGluePortion *pRight = 0;
+/*N*/ BOOL bNoMove = 0 != pCurr->GetpKanaComp();
+/*N*/ while( pRight != this )
+/*N*/ {
+/*N*/
+/*N*/ // 1) Wir suchen den linken Glue
+/*N*/ SwLinePortion *pPos = (SwLinePortion*)this;
+/*N*/ SwGluePortion *pLeft = 0;
+/*N*/ while( pPos )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ if( pPos->InFixMargGrp() )
+/*N*/ pLeft = (SwGluePortion*)pPos;
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ if( pPos == pRight)
+/*N*/ pPos = 0;
+/*N*/ }
+/*N*/
+/*N*/ // Zwei nebeneinander liegende FlyPortions verschmelzen
+/*N*/ if( pRight && pLeft->GetPortion() == pRight )
+/*N*/ {
+/*?*/ pRight->MoveAllGlue( pLeft );
+/*?*/ pRight = 0;
+/*N*/ }
+/*N*/ KSHORT nRightGlue = pRight && 0 < pRight->GetPrtGlue()
+/*N*/ ? KSHORT(pRight->GetPrtGlue()) : 0;
+/*N*/ // 2) linken und rechten Glue ausgleichen
+/*N*/ // Bei Tabs haengen wir nix um ...
+/*N*/ if( pLeft && nRightGlue && !pRight->InTabGrp() )
+/*N*/ {
+/*?*/ // pPrev ist die Portion, die unmittelbar vor pRight liegt.
+/*?*/ SwLinePortion *pPrev = pRight->FindPrevPortion( pLeft );
+/*?*/
+/*?*/ if ( pRight->IsFlyPortion() && pRight->GetLen() )
+/*?*/ {
+/*?*/ SwFlyPortion *pFly = (SwFlyPortion *)pRight;
+/*?*/ if ( pFly->GetBlankWidth() < nRightGlue )
+/*?*/ {
+/*?*/ // Hier entsteht eine neue TxtPortion, die dass zuvor
+/*?*/ // vom Fly verschluckte Blank reaktiviert.
+/*?*/ nRightGlue -= pFly->GetBlankWidth();
+/*?*/ pFly->SubPrtWidth( pFly->GetBlankWidth() );
+/*?*/ pFly->SetLen( 0 );
+/*?*/ SwTxtPortion *pNewPor = new SwTxtPortion;
+/*?*/ pNewPor->SetLen( 1 );
+/*?*/ pNewPor->Height( pFly->Height() );
+/*?*/ pNewPor->Width( pFly->GetBlankWidth() );
+/*?*/ pFly->Insert( pNewPor );
+/*?*/ }
+/*?*/ else
+/*?*/ pPrev = pLeft;
+/*?*/ }
+/*?*/ while( pPrev != pLeft )
+/*?*/ {
+///*?*/ DBG_LOOP;
+/*?*/
+/*?*/ if( bNoMove || pPrev->PrtWidth() >= nRightGlue ||
+/*?*/ pPrev->InHyphGrp() || pPrev->IsKernPortion() )
+/*?*/ {
+/*?*/ // Die Portion, die vor pRight liegt kann nicht
+/*?*/ // verschoben werden, weil kein Glue mehr vorhanden ist.
+/*?*/ // Wir fuehren die Abbruchbedingung herbei:
+/*?*/ pPrev = pLeft;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nRightGlue -= pPrev->PrtWidth();
+/*?*/ // pPrev wird hinter pRight verschoben.
+/*?*/ // Dazu wird der Gluewert zwischen pRight und pLeft
+/*?*/ // ausgeglichen.
+/*?*/ pRight->MoveGlue( pLeft, short( pPrev->PrtWidth() ) );
+/*?*/ // Jetzt wird die Verkettung gerichtet.
+/*?*/ SwLinePortion *pPrevPrev = pPrev->FindPrevPortion( pLeft );
+/*?*/ pPrevPrev->SetPortion( pRight );
+/*?*/ pPrev->SetPortion( pRight->GetPortion() );
+/*?*/ pRight->SetPortion( pPrev );
+/*?*/ if ( pPrev->GetPortion() && pPrev->InTxtGrp()
+/*?*/ && pPrev->GetPortion()->IsHolePortion() )
+/*?*/ {
+/*?*/ SwHolePortion *pHolePor =
+/*?*/ (SwHolePortion*)pPrev->GetPortion();
+/*?*/ if ( !pHolePor->GetPortion() ||
+/*?*/ !pHolePor->GetPortion()->InFixMargGrp() )
+/*?*/ {
+/*?*/ pPrev->AddPrtWidth( pHolePor->GetBlankWidth() );
+/*?*/ pPrev->SetLen( pPrev->GetLen() + 1 );
+/*?*/ pPrev->SetPortion( pHolePor->GetPortion() );
+/*?*/ delete pHolePor;
+/*?*/ }
+/*?*/ }
+/*?*/ pPrev = pPrevPrev;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ // Wenn es keinen linken Glue mehr gibt, wird die Abbruchbedingung
+/*N*/ // herbeigefuehrt.
+/*N*/ pRight = pLeft ? pLeft : (SwGluePortion*)this;
+/*N*/ }
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_porlay.cxx b/binfilter/bf_sw/source/core/text/sw_porlay.cxx
new file mode 100644
index 000000000000..5306c31e55d3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_porlay.cxx
@@ -0,0 +1,1186 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include "txtcfg.hxx"
+#include "itrform2.hxx"
+#include "redlnitr.hxx" // SwRedlineItr
+#include "porfly.hxx" // SwFlyCntPortion
+#include <porrst.hxx> // SwHangingPortion
+#include <pormulti.hxx> // SwMultiPortion
+#include <breakit.hxx>
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <com/sun/star/i18n/WordType.hdl>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#ifdef BIDI
+#include <paratr.hxx>
+#include <bf_svx/adjitem.hxx>
+#endif
+#include <bf_svx/scripttypeitem.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::i18n::ScriptType;
+
+#ifdef BIDI
+#include <unicode/ubidi.h>
+namespace binfilter {
+
+/*************************************************************************
+ * lcl_IsLigature
+ *
+ * Checks if cCh + cNectCh builds a ligature (used for Kashidas)
+ *************************************************************************/
+
+
+/*************************************************************************
+ * lcl_ConnectToPrev
+ *
+ * Checks if cCh is connectable to cPrevCh (used for Kashidas)
+ *************************************************************************/
+
+
+#endif
+
+
+/*************************************************************************
+ * SwLineLayout::~SwLineLayout()
+ *
+ * class SwLineLayout: Das Layout einer einzelnen Zeile. Dazu
+ * gehoeren vor allen Dingen die Dimension, die Anzahl der
+ * Character und der Wortzwischenraeume in der Zeile.
+ * Zeilenobjekte werden in einem eigenen Pool verwaltet, um zu
+ * erreichen, dass sie im Speicher moeglichst beeinander liegen
+ * (d.h. zusammen gepaged werden und den Speicher nicht
+ * fragmentieren).
+ *************************************************************************/
+
+/*N*/ SwLineLayout::~SwLineLayout()
+/*N*/ {
+/*N*/ Truncate();
+/*N*/ if( GetNext() )
+/*N*/ delete GetNext();
+/*N*/ delete pSpaceAdd;
+/*N*/ if ( pKanaComp )
+/*?*/ delete pKanaComp;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLineLayout::Insert()
+ *************************************************************************/
+
+SwLinePortion *SwLineLayout::Insert( SwLinePortion *pIns )
+/*N*/ {
+/*N*/ // Erster Attributwechsel, Masse und Laengen
+/*N*/ // aus *pCurr in die erste Textportion kopieren.
+/*N*/ if( !pPortion )
+/*N*/ {
+/*N*/ if( GetLen() )
+/*N*/ {
+/*N*/ pPortion = new SwTxtPortion( *(SwLinePortion*)this );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SetPortion( pIns );
+/*N*/ return pIns;
+/*N*/ }
+/*N*/ }
+/*N*/ // mit Skope aufrufen, sonst Rekursion !
+/*N*/ return pPortion->SwLinePortion::Insert( pIns );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLineLayout::Append()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwLineLayout::Format()
+ *************************************************************************/
+
+// fuer die Sonderbehandlung bei leeren Zeilen
+
+/*N*/ sal_Bool SwLineLayout::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if( GetLen() )
+/*N*/ return SwTxtPortion::Format( rInf );
+/*N*/ else
+/*N*/ {
+/*?*/ Height( rInf.GetTxtHeight() );
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwLineLayout::CalcLeftMargin()
+ *
+ * Wir sammeln alle FlyPortions am Anfang der Zeile zu einer MarginPortion.
+ *************************************************************************/
+
+/*N*/ SwMarginPortion *SwLineLayout::CalcLeftMargin()
+/*N*/ {
+/*N*/ SwMarginPortion *pLeft = (GetPortion() && GetPortion()->IsMarginPortion()) ?
+/*N*/ (SwMarginPortion *)GetPortion() : 0;
+/*N*/ if( !GetPortion() )
+/*N*/ SetPortion( new SwTxtPortion( *(SwLinePortion*)this ) );
+/*N*/ if( !pLeft )
+/*N*/ {
+/*N*/ pLeft = new SwMarginPortion( 0 );
+/*N*/ pLeft->SetPortion( GetPortion() );
+/*N*/ SetPortion( pLeft );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ pLeft->Height( 0 );
+/*?*/ pLeft->Width( 0 );
+/*?*/ pLeft->SetLen( 0 );
+/*?*/ pLeft->SetAscent( 0 );
+/*?*/ pLeft->SetPortion( NULL );
+/*?*/ pLeft->SetFixWidth(0);
+/*N*/ }
+/*N*/
+/*N*/ SwLinePortion *pPos = pLeft->GetPortion();
+/*N*/ while( pPos )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ if( pPos->IsFlyPortion() )
+/*N*/ {
+/*N*/ // Die FlyPortion wird ausgesogen ...
+/*N*/ pLeft->Join( (SwGluePortion*)pPos );
+/*N*/ pPos = pLeft->GetPortion();
+/*N*/ if( GetpKanaComp() )
+/*N*/ GetKanaComp().Remove( 0, 1 );
+/*N*/ }
+/*N*/ else
+/*N*/ pPos = 0;
+/*N*/ }
+/*N*/ return pLeft;
+/*N*/ }
+
+/*************************************************************************
+ * SwLineLayout::CreateSpaceAdd()
+ *************************************************************************/
+
+/*N*/ void SwLineLayout::CreateSpaceAdd( const short nInit )
+/*N*/ {
+/*N*/ pSpaceAdd = new SvShorts;
+/*N*/ pSpaceAdd->Insert( nInit, 0 );
+/*N*/ }
+
+/*************************************************************************
+ * SwLineLayout::CalcLine()
+ *
+ * Aus FormatLine() ausgelagert.
+ *************************************************************************/
+
+/*N*/ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ const KSHORT nLineWidth = rInf.RealWidth();
+/*N*/
+/*N*/ KSHORT nFlyAscent;
+/*N*/ KSHORT nFlyHeight;
+/*N*/ KSHORT nFlyDescent;
+/*N*/ sal_Bool bOnlyPostIts = sal_True;
+/*N*/ SetHanging( sal_False );
+/*N*/
+/*N*/ sal_Bool bTmpDummy = ( 0 == GetLen() );
+/*N*/ SwFlyCntPortion* pFlyCnt = 0;
+/*N*/ if( bTmpDummy )
+/*N*/ {
+/*N*/ nFlyAscent = 0;
+/*N*/ nFlyHeight = 0;
+/*N*/ nFlyDescent = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( pPortion )
+/*N*/ {
+/*N*/ SetCntnt( sal_False );
+/*N*/ if( pPortion->IsBreakPortion() )
+/*N*/ {
+/*N*/ SetLen( pPortion->GetLen() );
+/*N*/ if( GetLen() )
+/*N*/ bTmpDummy = sal_False;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Init( GetPortion() );
+/*N*/ SwLinePortion *pPos = pPortion;
+/*N*/ SwLinePortion *pLast = this;
+/*N*/ KSHORT nMaxDescent = 0;
+/*N*/
+/*N*/ // Eine Gruppe ist ein Abschnitt in der Portion-Kette von
+/*N*/ // pCurr oder einer Fix-Portion bis zum Ende bzw. zur naechsten
+/*N*/ // Fix-Portion.
+/*N*/ while( pPos )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ ASSERT( POR_LIN != pPos->GetWhichPor(),
+/*N*/ "SwLineLayout::CalcLine: don't use SwLinePortions !" );
+/*N*/ // Null-Portions werden eliminiert. Sie koennen entstehen,
+/*N*/ // wenn zwei FlyFrms ueberlappen.
+/*N*/ if( !pPos->Compress() )
+/*N*/ {
+/*N*/ // 8110: Hoehe und Ascent nur uebernehmen, wenn sonst in der
+/*N*/ // Zeile nichts mehr los ist.
+/*N*/ if( !pPos->GetPortion() )
+/*N*/ {
+/*N*/ if( !Height() )
+/*N*/ Height( pPos->Height() );
+/*N*/ if( !GetAscent() )
+/*N*/ SetAscent( pPos->GetAscent() );
+/*N*/ }
+/*N*/ delete pLast->Cut( pPos );
+/*N*/ pPos = pLast->GetPortion();
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ // Es gab Attributwechsel: Laengen und Masse aufaddieren;
+/*N*/ // bzw.Maxima bilden.
+/*N*/
+/*N*/ nLineLength += pPos->GetLen();
+/*N*/
+/*N*/ KSHORT nPosHeight = pPos->Height();
+/*N*/ KSHORT nPosAscent = pPos->GetAscent();
+/*N*/ AddPrtWidth( pPos->Width() );
+/*N*/
+/*N*/ ASSERT( nPosHeight >= nPosAscent,
+/*N*/ "SwLineLayout::CalcLine: bad ascent or height" );
+/*N*/ if( pPos->IsHangingPortion() )
+/*N*/ {
+/*?*/ SetHanging( sal_True );
+/*?*/ rInf.GetParaPortion()->SetMargin( sal_True );
+/*N*/ }
+/*N*/
+/*N*/ // Damit ein Paragraphende-Zeichen nicht durch ein Descent zu einer
+/*N*/ // geaenderten Zeilenhoehe und zum Umformatieren fuehrt.
+/*N*/ if ( !pPos->IsBreakPortion() || !Height() )
+/*N*/ {
+/*N*/ bOnlyPostIts &= pPos->IsPostItsPortion();
+/*N*/ if( bTmpDummy && !nLineLength )
+/*N*/ {
+/*N*/ if( pPos->IsFlyPortion() )
+/*N*/ {
+/*N*/ if( nFlyHeight < nPosHeight )
+/*N*/ nFlyHeight = nPosHeight;
+/*N*/ if( nFlyAscent < nPosAscent )
+/*N*/ nFlyAscent = nPosAscent;
+/*N*/ if( nFlyDescent < nPosHeight - nPosAscent )
+/*N*/ nFlyDescent = nPosHeight - nPosAscent;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pPos->InNumberGrp() )
+/*N*/ {
+/*N*/ KSHORT nTmp = rInf.GetFont()->GetAscent(
+/*N*/ rInf.GetVsh(), rInf.GetOut() );
+/*N*/ if( nTmp > nPosAscent )
+/*N*/ {
+/*N*/ nPosHeight += nTmp - nPosAscent;
+/*N*/ nPosAscent = nTmp;
+/*N*/ }
+/*N*/ nTmp = rInf.GetFont()->GetHeight( rInf.GetVsh(),
+/*N*/ rInf.GetOut() );
+/*N*/ if( nTmp > nPosHeight )
+/*N*/ nPosHeight = nTmp;
+/*N*/ }
+/*N*/ Height( nPosHeight );
+/*N*/ nAscent = nPosAscent;
+/*N*/ nMaxDescent = nPosHeight - nPosAscent;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( !pPos->IsFlyPortion() )
+/*N*/ {
+/*N*/ if( Height() < nPosHeight )
+/*N*/ Height( nPosHeight );
+/*N*/ if( pPos->IsFlyCntPortion() || ( pPos->IsMultiPortion()
+/*N*/ && ((SwMultiPortion*)pPos)->HasFlyInCntnt() ) )
+/*N*/ rLine.SetFlyInCntBase();
+/*N*/ if( pPos->IsFlyCntPortion() &&
+/*N*/ ((SwFlyCntPortion*)pPos)->GetAlign() )
+/*N*/ {
+/*N*/ ((SwFlyCntPortion*)pPos)->SetMax( sal_False );
+/*N*/ if( !pFlyCnt || pPos->Height() > pFlyCnt->Height() )
+/*N*/ pFlyCnt = (SwFlyCntPortion*)pPos;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( nAscent < nPosAscent )
+/*N*/ nAscent = nPosAscent;
+/*N*/ if( nMaxDescent < nPosHeight - nPosAscent )
+/*N*/ nMaxDescent = nPosHeight - nPosAscent;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pPos->GetLen() )
+/*N*/ bTmpDummy = sal_False;
+/*N*/ if( !HasCntnt() && !pPos->InNumberGrp() )
+/*N*/ {
+/*N*/ if ( pPos->InExpGrp() )
+/*N*/ {
+/*N*/ XubString aTxt;
+/*N*/ if( pPos->GetExpTxt( rInf, aTxt ) && aTxt.Len() )
+/*N*/ SetCntnt( sal_True );
+/*N*/ }
+/*N*/ else if( ( pPos->InTxtGrp() || pPos->IsMultiPortion() ) &&
+/*N*/ pPos->GetLen() )
+/*N*/ SetCntnt( sal_True );
+/*N*/ }
+/*N*/ bTmpDummy = bTmpDummy && !HasCntnt() &&
+/*N*/ ( !pPos->Width() || pPos->IsFlyPortion() );
+/*N*/
+/*N*/ pLast = pPos;
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ if( pFlyCnt )
+/*N*/ {
+/*N*/ if( pFlyCnt->Height() == Height() )
+/*N*/ {
+/*N*/ pFlyCnt->SetMax( sal_True );
+/*N*/ if( Height() > nMaxDescent + nAscent )
+/*N*/ {
+/*N*/ if( 3 == pFlyCnt->GetAlign() ) // Bottom
+/*?*/ nAscent = Height() - nMaxDescent;
+/*N*/ else if( 2 == pFlyCnt->GetAlign() ) // Center
+/*N*/ nAscent = ( Height() + nAscent - nMaxDescent ) / 2;
+/*N*/ }
+/*N*/ pFlyCnt->SetAscent( nAscent );
+/*N*/ }
+/*N*/ }
+/*N*/ if( bTmpDummy && nFlyHeight )
+/*N*/ {
+/*N*/ nAscent = nFlyAscent;
+/*N*/ if( nFlyDescent > nFlyHeight - nFlyAscent )
+/*?*/ Height( nFlyHeight + nFlyDescent );
+/*N*/ else
+/*N*/ Height( nFlyHeight );
+/*N*/ }
+/*N*/ else if( nMaxDescent > Height() - nAscent )
+/*N*/ Height( nMaxDescent + nAscent );
+/*N*/ if( bOnlyPostIts )
+/*N*/ {
+/*?*/ Height( rInf.GetFont()->GetHeight( rInf.GetVsh(), rInf.GetOut() ) );
+/*?*/ nAscent = rInf.GetFont()->GetAscent( rInf.GetVsh(), rInf.GetOut() );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ SetCntnt( !bTmpDummy );
+/*N*/ // Robust:
+/*N*/ if( nLineWidth < Width() )
+/*N*/ Width( nLineWidth );
+/*N*/ ASSERT( nLineWidth >= Width(), "SwLineLayout::CalcLine: line is bursting" );
+/*N*/ SetDummy( bTmpDummy );
+/*N*/ SetRedline( rLine.GetRedln() &&
+/*N*/ rLine.GetRedln()->CheckLine( rLine.GetStart(), rLine.GetEnd() ) );
+/*N*/ }
+
+/*************************************************************************
+ * class SwCharRange
+ *************************************************************************/
+
+/*N*/ SwCharRange &SwCharRange::operator+=(const SwCharRange &rRange)
+/*N*/ {
+/*N*/ if(0 != rRange.nLen ) {
+/*N*/ if(0 == nLen) {
+/*N*/ nStart = rRange.nStart;
+/*N*/ nLen = rRange.nLen ;
+/*N*/ }
+/*N*/ else {
+/*N*/ if(rRange.nStart + rRange.nLen > nStart + nLen) {
+/*N*/ nLen = rRange.nStart + rRange.nLen - nStart;
+/*N*/ }
+/*N*/ if(rRange.nStart < nStart) {
+/*N*/ nLen += nStart - rRange.nStart;
+/*N*/ nStart = rRange.nStart;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return *this;
+/*N*/ }
+
+/*************************************************************************
+ * WhichFont()
+ *
+ * Converts i18n Script Type (LATIN, ASIAN, COMPLEX, WEAK) to
+ * Sw Script Types (SW_LATIN, SW_CJK, SW_CTL), used to identify the font
+ *************************************************************************/
+
+/*N*/ BYTE WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI )
+/*N*/ {
+/*N*/ ASSERT( pTxt || pSI,"How should I determine the script type?" );
+/*N*/ USHORT nScript;
+/*N*/
+/*N*/ // First we try to use our SwScriptInfo
+/*N*/ if ( pSI )
+/*N*/ nScript = pSI->ScriptType( nIdx );
+/*N*/ else
+/*N*/ // Ok, we have to ask the break iterator
+/*N*/ nScript = pBreakIt->GetRealScriptOfText( *pTxt, nIdx );
+/*N*/
+/*N*/ switch ( nScript ) {
+/*N*/ case i18n::ScriptType::LATIN : return SW_LATIN;
+/*?*/ case i18n::ScriptType::ASIAN : return SW_CJK;
+/*?*/ case i18n::ScriptType::COMPLEX : return SW_CTL;
+/*?*/ }
+/*?*/
+/*?*/ ASSERT( sal_False, "Somebody tells lies about the script type!" );
+/*?*/ return SW_LATIN;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwScriptInfo::InitScriptInfo()
+ *
+ * searches for script changes in rTxt and stores them
+ *************************************************************************/
+
+/*N*/ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
+/*N*/ {
+/*N*/ if( !pBreakIt->xBreak.is() )
+/*N*/ return;
+/*N*/
+/*N*/ xub_StrLen nChg = nInvalidityPos;
+/*N*/
+/*N*/ // STRING_LEN means the data structure is up to date
+/*N*/ nInvalidityPos = STRING_LEN;
+/*N*/
+/*N*/ // this is the default direction
+/*N*/ nDefaultDir = bRTL ? UBIDI_RTL : UBIDI_LTR;
+/*N*/
+/*N*/ // counter for script info arrays
+/*N*/ USHORT nCnt = 0;
+/*N*/ // counter for compression information arrays
+/*N*/ USHORT nCntComp = 0;
+/*N*/ #ifdef BIDI
+/*N*/ // counter for kashida array
+/*N*/ USHORT nCntKash = 0;
+/*N*/ #endif
+/*N*/ BYTE nScript;
+/*N*/
+/*N*/ const String& rTxt = rNode.GetTxt();
+/*N*/
+/*N*/ // compression type
+/*N*/ const SwCharCompressType aCompEnum = rNode.GetDoc()->GetCharCompressType();
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ // justification type
+/*N*/ const sal_Bool bAdjustBlock = SVX_ADJUST_BLOCK ==
+/*N*/ rNode.GetSwAttrSet().GetAdjust().GetAdjust();
+/*N*/ #endif
+/*N*/
+/*N*/
+/*N*/ //
+/*N*/ // FIND INVALID RANGES IN SCRIPT INFO ARRAYS:
+/*N*/ //
+/*N*/
+/*N*/ if( nChg )
+/*N*/ {
+/*N*/ // if change position = 0 we do not use any data from the arrays
+/*N*/ // because by deleting all characters of the first group at the beginning
+/*N*/ // of a paragraph nScript is set to a wrong value
+/*N*/ ASSERT( CountScriptChg(), "Where're my changes of script?" );
+/*N*/ while( nCnt < CountScriptChg() )
+/*N*/ {
+/*N*/ if ( nChg <= GetScriptChg( nCnt ) )
+/*N*/ {
+/*N*/ nScript = GetScriptType( nCnt );
+/*N*/ break;
+/*N*/ }
+/*N*/ else
+/*N*/ nCnt++;
+/*N*/ }
+/*N*/ if( CHARCOMPRESS_NONE != aCompEnum )
+/*N*/ {
+/*N*/ while( nCntComp < CountCompChg() )
+/*N*/ {
+/*N*/ if ( nChg <= GetCompStart( nCntComp ) )
+/*N*/ break;
+/*N*/ else
+/*N*/ nCntComp++;
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef BIDI
+/*N*/ if ( bAdjustBlock )
+/*N*/ {
+/*N*/ while( nCntKash < CountKashida() )
+/*N*/ {
+/*N*/ if ( nChg <= GetKashida( nCntKash ) )
+/*N*/ break;
+/*N*/ else
+/*N*/ nCntKash++;
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ else
+/*N*/ nScript = (BYTE)pBreakIt->xBreak->getScriptType( rTxt, 0 );
+/*N*/
+/*N*/
+/*N*/ //
+/*N*/ // ADJUST nChg VALUE:
+/*N*/ //
+/*N*/
+/*N*/ // by stepping back one position we know that we are inside a group
+/*N*/ // declared as an nScript group
+/*N*/ if ( nChg )
+/*N*/ --nChg;
+/*N*/
+/*N*/ const xub_StrLen nGrpStart = nCnt ? GetScriptChg( nCnt - 1 ) : 0;
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ // we go back in our group until we reach the first character of
+/*N*/ // type nScript
+/*N*/ while ( nChg > nGrpStart &&
+/*N*/ nScript != pBreakIt->xBreak->getScriptType( rTxt, nChg ) )
+/*N*/ --nChg;
+/*N*/ #else
+/*N*/ // we go back in our group until we reach a non-weak character
+/*N*/ while ( nChg > nGrpStart &&
+/*N*/ WEAK == pBreakIt->xBreak->getScriptType( rTxt, nChg ) )
+/*N*/ --nChg;
+/*N*/ #endif
+/*N*/
+/*N*/
+/*N*/ //
+/*N*/ // INVALID DATA FROM THE SCRIPT INFO ARRAYS HAS TO BE DELETED:
+/*N*/ //
+/*N*/
+/*N*/ // remove invalid entries from script information arrays
+/*N*/ const USHORT nScriptRemove = aScriptChg.Count() - nCnt;
+/*N*/ aScriptChg.Remove( nCnt, nScriptRemove );
+/*N*/ aScriptType.Remove( nCnt, nScriptRemove );
+/*N*/
+/*N*/ // get the start of the last compression group
+/*N*/ USHORT nLastCompression = nChg;
+/*N*/ if( nCntComp )
+/*N*/ {
+/*N*/ --nCntComp;
+/*N*/ nLastCompression = GetCompStart( nCntComp );
+/*N*/ if( nChg >= nLastCompression + GetCompLen( nCntComp ) )
+/*N*/ {
+/*N*/ nLastCompression = nChg;
+/*N*/ ++nCntComp;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // remove invalid entries from compression information arrays
+/*N*/ const USHORT nCompRemove = aCompChg.Count() - nCntComp;
+/*N*/ aCompChg.Remove( nCntComp, nCompRemove );
+/*N*/ aCompLen.Remove( nCntComp, nCompRemove );
+/*N*/ aCompType.Remove( nCntComp, nCompRemove );
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ // get the start of the last kashida group
+/*N*/ USHORT nLastKashida = nChg;
+/*N*/ if( nCntKash && i18n::ScriptType::COMPLEX == nScript )
+/*N*/ {
+/*N*/ --nCntKash;
+/*N*/ nLastKashida = GetKashida( nCntKash );
+/*N*/ }
+/*N*/
+/*N*/ // remove invalid entries from kashida array
+/*N*/ aKashida.Remove( nCntKash, aKashida.Count() - nCntKash );
+/*N*/ #endif
+/*N*/
+/*N*/
+/*N*/ //
+/*N*/ // TAKE CARE OF WEAK CHARACTERS: WE MUST FIND AN APPROPRIATE
+/*N*/ // SCRIPT FOR WEAK CHARACTERS AT THE BEGINNING OF A PARAGRAPH
+/*N*/ //
+/*N*/
+/*N*/ if( WEAK == pBreakIt->xBreak->getScriptType( rTxt, nChg ) )
+/*N*/ {
+/*N*/ // If the beginning of the current group is weak, this means that
+/*N*/ // all of the characters in this grounp are weak. We have to assign
+/*N*/ // the scripts to these characters depending on the fonts which are
+/*N*/ // set for these characters to display them.
+/*N*/ xub_StrLen nEnd =
+/*N*/ (xub_StrLen)pBreakIt->xBreak->endOfScript( rTxt, nChg, WEAK );
+/*N*/
+/*N*/ if( nEnd > rTxt.Len() )
+/*N*/ nEnd = rTxt.Len();
+/*N*/
+/*N*/ nScript = (BYTE)GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
+/*N*/
+/*N*/ ASSERT( i18n::ScriptType::LATIN == nScript ||
+/*N*/ i18n::ScriptType::ASIAN == nScript ||
+/*N*/ i18n::ScriptType::COMPLEX == nScript, "Wrong default language" );
+/*N*/
+/*N*/ nChg = nEnd;
+/*N*/ aScriptChg.Insert( nEnd, nCnt );
+/*N*/ aScriptType.Insert( nScript, nCnt++ );
+/*N*/
+/*N*/ // Get next script type or set to weak in order to exit
+/*N*/ nScript = ( nEnd < rTxt.Len() ) ?
+/*N*/ (BYTE)pBreakIt->xBreak->getScriptType( rTxt, nEnd ) :
+/*N*/ (BYTE)WEAK;
+/*N*/ }
+/*N*/
+/*N*/ //
+/*N*/ // UPDATE THE SCRIPT INFO ARRAYS:
+/*N*/ //
+/*N*/
+/*N*/ // if there are only weak characters in paragraph we are finished
+/*N*/ if ( WEAK == nScript )
+/*N*/ return;
+/*N*/
+/*N*/ ASSERT( WEAK != (BYTE)pBreakIt->xBreak->getScriptType( rTxt, nChg ),
+/*N*/ "Oh my god, it's weak again" );
+/*N*/
+/*N*/ do
+/*N*/ {
+/*N*/ ASSERT( i18n::ScriptType::WEAK != nScript,
+/*N*/ "Inserting WEAK into SwScriptInfo structure" );
+/*N*/ ASSERT( STRING_LEN != nChg, "65K? Strange length of script section" );
+/*N*/
+/*N*/ nChg = (xub_StrLen)pBreakIt->xBreak->endOfScript( rTxt, nChg, nScript );
+/*N*/
+/*N*/ if ( nChg > rTxt.Len() )
+/*N*/ nChg = rTxt.Len();
+/*N*/
+/*N*/ aScriptChg.Insert( nChg, nCnt );
+/*N*/ aScriptType.Insert( nScript, nCnt++ );
+/*N*/
+/*N*/ // if current script is asian, we search for compressable characters
+/*N*/ // in this range
+/*N*/ if ( CHARCOMPRESS_NONE != aCompEnum &&
+/*N*/ i18n::ScriptType::ASIAN == nScript )
+/*N*/ {
+/*?*/ BYTE ePrevState = NONE;
+/*?*/ BYTE eState;
+/*?*/ USHORT nPrevChg = nLastCompression;
+/*?*/
+/*?*/ while ( nLastCompression < nChg )
+/*?*/ {
+/*?*/ xub_Unicode cChar = rTxt.GetChar( nLastCompression );
+/*?*/
+/*?*/ // examine current character
+/*?*/ switch ( cChar )
+/*?*/ {
+/*?*/ // Left punctuation found
+/*?*/ case 0x3008: case 0x300A: case 0x300C: case 0x300E:
+/*?*/ case 0x3010: case 0x3014: case 0x3016: case 0x3018:
+/*?*/ case 0x301A: case 0x301D:
+/*?*/ eState = SPECIAL_LEFT;
+/*?*/ break;
+/*?*/ // Right punctuation found
+/*?*/ case 0x3001: case 0x3002: case 0x3009: case 0x300B:
+/*?*/ case 0x300D: case 0x300F: case 0x3011: case 0x3015:
+/*?*/ case 0x3017: case 0x3019: case 0x301B: case 0x301E:
+/*?*/ case 0x301F:
+/*?*/ eState = SPECIAL_RIGHT;
+/*?*/ break;
+/*?*/ default:
+/*?*/ eState = ( 0x3040 <= cChar && 0x3100 > cChar ) ?
+/*?*/ KANA :
+/*?*/ NONE;
+/*?*/ }
+/*?*/
+/*?*/ // insert range of compressable characters
+/*?*/ if( ePrevState != eState )
+/*?*/ {
+/*?*/ if ( ePrevState != NONE )
+/*?*/ {
+/*?*/ // insert start and type
+/*?*/ if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
+/*?*/ ePrevState != KANA )
+/*?*/ {
+/*?*/ aCompChg.Insert( nPrevChg, nCntComp );
+/*?*/ BYTE nTmpType = ePrevState;
+/*?*/ aCompType.Insert( nTmpType, nCntComp );
+/*?*/ aCompLen.Insert( nLastCompression - nPrevChg, nCntComp++ );
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ ePrevState = eState;
+/*?*/ nPrevChg = nLastCompression;
+/*?*/ }
+/*?*/
+/*?*/ nLastCompression++;
+/*?*/ }
+/*?*/
+/*?*/ // we still have to examine last entry
+/*?*/ if ( ePrevState != NONE )
+/*?*/ {
+/*?*/ // insert start and type
+/*?*/ if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
+/*?*/ ePrevState != KANA )
+/*?*/ {
+/*?*/ aCompChg.Insert( nPrevChg, nCntComp );
+/*?*/ BYTE nTmpType = ePrevState;
+/*?*/ aCompType.Insert( nTmpType, nCntComp );
+/*?*/ aCompLen.Insert( nLastCompression - nPrevChg, nCntComp++ );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ #ifdef BIDI
+/*N*/ // we search for connecting opportunities (kashida)
+/*N*/ else if ( bAdjustBlock && i18n::ScriptType::COMPLEX == nScript )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if ( nChg >= rTxt.Len() )
+/*N*/ break;
+/*N*/
+/*N*/ nScript = (BYTE)pBreakIt->xBreak->getScriptType( rTxt, nChg );
+/*N*/ nLastCompression = nChg;
+/*N*/ #ifdef BIDI
+/*N*/ nLastKashida = nChg;
+/*N*/ #endif
+/*N*/
+/*N*/ } while ( TRUE );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // check kashida data
+/*N*/ long nTmpKashidaPos = -1;
+/*N*/ sal_Bool bWrongKash = sal_False;
+/*N*/ for ( USHORT i = 0; i < aKashida.Count(); ++i )
+/*N*/ {
+/*N*/ long nCurrKashidaPos = GetKashida( i );
+/*N*/ if ( nCurrKashidaPos <= nTmpKashidaPos )
+/*N*/ {
+/*N*/ bWrongKash = sal_True;
+/*N*/ break;
+/*N*/ }
+/*N*/ nTmpKashidaPos = nCurrKashidaPos;
+/*N*/ }
+/*N*/ ASSERT( ! bWrongKash, "Kashida array contains wrong data" )
+/*N*/ #endif
+/*N*/
+/*N*/ // remove invalid entries from direction information arrays
+/*N*/ const USHORT nDirRemove = aDirChg.Count();
+/*N*/ aDirChg.Remove( 0, nDirRemove );
+/*N*/ aDirType.Remove( 0, nDirRemove );
+/*N*/
+/*N*/ // Perform Unicode Bidi Algorithm for text direction information
+/*N*/ nCnt = 0;
+/*N*/ sal_Bool bLatin = sal_False;
+/*N*/ sal_Bool bAsian = sal_False;
+/*N*/ sal_Bool bComplex = sal_False;
+/*N*/
+/*N*/ while( nCnt < CountScriptChg() )
+/*N*/ {
+/*N*/ nScript = GetScriptType( nCnt++ );
+/*N*/ switch ( nScript )
+/*N*/ {
+/*N*/ case i18n::ScriptType::LATIN:
+/*N*/ bLatin = sal_True;
+/*N*/ break;
+/*N*/ case i18n::ScriptType::ASIAN:
+/*N*/ bAsian = sal_True;
+/*N*/ break;
+/*N*/ case i18n::ScriptType::COMPLEX:
+/*N*/ bComplex = sal_True;
+/*N*/ break;
+/*N*/ default:
+/*N*/ ASSERT( ! rTxt.Len(), "Wrong script found" )
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // do not call the unicode bidi algorithm if not required
+/*N*/ if ( UBIDI_LTR != nDefaultDir || bComplex )
+/*N*/ UpdateBidiInfo( rTxt );
+/*N*/ }
+
+/*N*/ void SwScriptInfo::UpdateBidiInfo( const String& rTxt )
+/*N*/ {
+/*N*/ // remove invalid entries from direction information arrays
+/*N*/ const USHORT nDirRemove = aDirChg.Count();
+/*N*/ aDirChg.Remove( 0, nDirRemove );
+/*N*/ aDirType.Remove( 0, nDirRemove );
+/*N*/
+/*N*/ //
+/*N*/ // Bidi functions from icu 2.0
+/*N*/ //
+/*N*/ UErrorCode nError = U_ZERO_ERROR;
+/*N*/ UBiDi* pBidi = ubidi_openSized( rTxt.Len(), 0, &nError );
+/*N*/ nError = U_ZERO_ERROR;
+/*N*/
+/*N*/ ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(rTxt.GetBuffer()), rTxt.Len(), // UChar != sal_Unicode in MinGW
+/*N*/ nDefaultDir, NULL, &nError );
+/*N*/ nError = U_ZERO_ERROR;
+/*N*/ long nCount = ubidi_countRuns( pBidi, &nError );
+/*N*/ int32_t nStart = 0;
+/*N*/ int32_t nEnd;
+/*N*/ UBiDiLevel nCurrDir;
+/*N*/ // counter for direction information arrays
+/*N*/ USHORT nCntDir = 0;
+/*N*/
+/*N*/ for ( USHORT nIdx = 0; nIdx < nCount; ++nIdx )
+/*N*/ {
+/*N*/ ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir );
+/*N*/ aDirChg.Insert( (USHORT)nEnd, nCntDir );
+/*N*/ aDirType.Insert( (BYTE)nCurrDir, nCntDir++ );
+/*N*/ nStart = nEnd;
+/*N*/ }
+/*N*/
+/*N*/ ubidi_close( pBidi );
+/*N*/ }
+
+
+/*************************************************************************
+ * SwScriptInfo::NextScriptChg(..)
+ * returns the position of the next character which belongs to another script
+ * than the character of the actual (input) position.
+ * If there's no script change until the end of the paragraph, it will return
+ * STRING_LEN.
+ * Scripts are Asian (Chinese, Japanese, Korean),
+ * Latin ( English etc.)
+ * and Complex ( Hebrew, Arabian )
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwScriptInfo::NextScriptChg( const xub_StrLen nPos ) const
+/*N*/ {
+/*N*/ USHORT nEnd = CountScriptChg();
+/*N*/ for( USHORT nX = 0; nX < nEnd; ++nX )
+/*N*/ {
+/*N*/ if( nPos < GetScriptChg( nX ) )
+/*N*/ return GetScriptChg( nX );
+/*N*/ }
+/*N*/
+/*N*/ return STRING_LEN;
+/*N*/ }
+
+/*************************************************************************
+ * SwScriptInfo::ScriptType(..)
+ * returns the script of the character at the input position
+ *************************************************************************/
+
+/*N*/ BYTE SwScriptInfo::ScriptType( const xub_StrLen nPos ) const
+/*N*/ {
+/*N*/ USHORT nEnd = CountScriptChg();
+/*N*/ for( USHORT nX = 0; nX < nEnd; ++nX )
+/*N*/ {
+/*N*/ if( nPos < GetScriptChg( nX ) )
+/*N*/ return GetScriptType( nX );
+/*N*/ }
+/*N*/
+/*N*/ // the default is the application language script
+/*N*/ return (BYTE)GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
+/*N*/ }
+
+#ifdef BIDI
+
+/*N*/ xub_StrLen SwScriptInfo::NextDirChg( const xub_StrLen nPos,
+/*N*/ const BYTE* pLevel ) const
+/*N*/ {
+/*N*/ BYTE nCurrDir = pLevel ? *pLevel : 62;
+/*N*/ USHORT nEnd = CountDirChg();
+/*N*/ for( USHORT nX = 0; nX < nEnd; ++nX )
+/*N*/ {
+/*N*/ if( nPos < GetDirChg( nX ) &&
+/*N*/ ( nX + 1 == nEnd || GetDirType( nX + 1 ) <= nCurrDir ) )
+/*?*/ return GetDirChg( nX );
+/*N*/ }
+/*N*/
+/*N*/ return STRING_LEN;
+/*N*/ }
+
+/*N*/ BYTE SwScriptInfo::DirType( const xub_StrLen nPos ) const
+/*N*/ {
+/*N*/ USHORT nEnd = CountDirChg();
+/*N*/ for( USHORT nX = 0; nX < nEnd; ++nX )
+/*N*/ {
+/*?*/ if( nPos < GetDirChg( nX ) )
+/*?*/ return GetDirType( nX );
+/*N*/ }
+/*N*/
+/*N*/ return 0;
+/*N*/ }
+
+#endif
+
+/*************************************************************************
+ * SwScriptInfo::CompType(..)
+ * returns the type of the compressed character
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwScriptInfo::HasKana()
+ * returns, if there are compressable kanas or specials
+ * betwenn nStart and nEnd
+ *************************************************************************/
+
+/*N*/ USHORT SwScriptInfo::HasKana( xub_StrLen nStart, const xub_StrLen nLen ) const
+/*N*/ {
+/*N*/ USHORT nCnt = CountCompChg();
+/*N*/ xub_StrLen nEnd = nStart + nLen;
+/*N*/
+/*N*/ for( USHORT nX = 0; nX < nCnt; ++nX )
+/*N*/ {
+/*N*/ xub_StrLen nKanaStart = GetCompStart( nX );
+/*N*/ xub_StrLen nKanaEnd = nKanaStart + GetCompLen( nX );
+/*N*/
+/*N*/ if ( nKanaStart >= nEnd )
+/*N*/ return USHRT_MAX;
+/*N*/
+/*N*/ if ( nStart < nKanaEnd )
+/*N*/ return nX;
+/*N*/ }
+/*N*/
+/*N*/ return USHRT_MAX;
+/*N*/ }
+
+/*************************************************************************
+ * SwScriptInfo::Compress()
+ *************************************************************************/
+
+/*N*/ long SwScriptInfo::Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen nLen,
+/*N*/ const USHORT nCompress, const USHORT nFontHeight,
+/*N*/ Point* pPoint ) const
+/*N*/ {
+/*N*/ ASSERT( nCompress, "Compression without compression?!" );
+/*N*/ ASSERT( nLen, "Compression without text?!" );
+/*N*/ USHORT nCompCount = CountCompChg();
+/*N*/
+/*N*/ // In asian typography, there are full width and half width characters.
+/*N*/ // Full width punctuation characters can be compressed by 50 %
+/*N*/ // to determine this, we compare the font width with 75 % of its height
+/*N*/ USHORT nMinWidth = ( 3 * nFontHeight ) / 4;
+/*N*/
+/*N*/ USHORT nCompIdx = HasKana( nIdx, nLen );
+/*N*/
+/*N*/ if ( USHRT_MAX == nCompIdx )
+/*N*/ return 0;
+/*N*/
+/*N*/ xub_StrLen nChg = GetCompStart( nCompIdx );
+/*N*/ xub_StrLen nCompLen = GetCompLen( nCompIdx );
+/*N*/ USHORT nI = 0;
+/*N*/ nLen += nIdx;
+/*N*/
+/*N*/ if( nChg > nIdx )
+/*N*/ {
+/*N*/ nI = nChg - nIdx;
+/*N*/ nIdx = nChg;
+/*N*/ }
+/*N*/ else if( nIdx < nChg + nCompLen )
+/*N*/ nCompLen -= nIdx - nChg;
+/*N*/
+/*N*/ if( nIdx > nLen || nCompIdx >= nCompCount )
+/*N*/ return 0;
+/*N*/
+/*N*/ long nSub = 0;
+/*N*/ long nLast = nI ? pKernArray[ nI - 1 ] : 0;
+/*N*/ do
+/*N*/ {
+/*N*/ USHORT nType = GetCompType( nCompIdx );
+/*N*/ ASSERT( nType == CompType( nIdx ), "Gimme the right type!" );
+/*N*/ nCompLen += nIdx;
+/*N*/ if( nCompLen > nLen )
+/*N*/ nCompLen = nLen;
+/*N*/
+/*N*/ // are we allowed to compress the character?
+/*N*/ if ( pKernArray[ nI ] - nLast < nMinWidth )
+/*N*/ {
+/*N*/ nIdx++; nI++;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ while( nIdx < nCompLen )
+/*N*/ {
+/*N*/ ASSERT( SwScriptInfo::NONE != nType, "None compression?!" );
+/*N*/
+/*N*/ // nLast is width of current character
+/*N*/ nLast -= pKernArray[ nI ];
+/*N*/
+/*N*/ nLast *= nCompress;
+/*N*/ long nMove = 0;
+/*N*/ if( SwScriptInfo::KANA != nType )
+/*N*/ {
+/*N*/ nLast /= 20000;
+/*N*/ if( pPoint && SwScriptInfo::SPECIAL_LEFT == nType )
+/*N*/ {
+/*N*/ if( nI )
+/*N*/ nMove = nLast;
+/*N*/ else
+/*N*/ {
+/*N*/ pPoint->X() += nLast;
+/*N*/ nLast = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ nLast /= 100000;
+/*N*/ nSub -= nLast;
+/*N*/ nLast = pKernArray[ nI ];
+/*N*/ if( nMove )
+/*N*/ pKernArray[ nI - 1 ] += nMove;
+/*N*/ pKernArray[ nI++ ] -= nSub;
+/*N*/ ++nIdx;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nIdx < nLen )
+/*N*/ {
+/*N*/ xub_StrLen nChg;
+/*N*/ if( ++nCompIdx < nCompCount )
+/*N*/ {
+/*N*/ nChg = GetCompStart( nCompIdx );
+/*N*/ if( nChg > nLen )
+/*N*/ nChg = nLen;
+/*N*/ nCompLen = GetCompLen( nCompIdx );
+/*N*/ }
+/*N*/ else
+/*N*/ nChg = nLen;
+/*N*/ while( nIdx < nChg )
+/*N*/ {
+/*N*/ nLast = pKernArray[ nI ];
+/*N*/ pKernArray[ nI++ ] -= nSub;
+/*N*/ ++nIdx;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/ } while( nIdx < nLen );
+/*N*/ return nSub;
+/*N*/ }
+
+/*************************************************************************
+ * class SwParaPortion
+ *************************************************************************/
+
+/*N*/ SwParaPortion::SwParaPortion()
+/*N*/ {
+/*N*/ FormatReset();
+/*N*/ bFlys = bFtnNum = bMargin = sal_False;
+/*N*/ SetWhichPor( POR_PARA );
+/*N*/ }
+
+/*************************************************************************
+ * SwParaPortion::GetParLen()
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwParaPortion::GetParLen() const
+/*N*/ {
+/*N*/ xub_StrLen nLen = 0;
+/*N*/ const SwLineLayout *pLay = this;
+/*N*/ while( pLay )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ nLen += pLay->GetLen();
+/*N*/ pLay = pLay->GetNext();
+/*N*/ }
+/*N*/ return nLen;
+/*N*/ }
+
+/*************************************************************************
+ * SwParaPortion::FindDropPortion()
+ *************************************************************************/
+
+/*N*/ const SwDropPortion *SwParaPortion::FindDropPortion() const
+/*N*/ {
+/*N*/ const SwLineLayout *pLay = this;
+/*N*/ while( pLay && pLay->IsDummy() )
+/*N*/ pLay = pLay->GetNext();
+/*N*/ while( pLay )
+/*N*/ {
+/*N*/ const SwLinePortion *pPos = pLay->GetPortion();
+/*N*/ while ( pPos && !pPos->GetLen() )
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ if( pPos && pPos->IsDropPortion() )
+/*N*/ return (SwDropPortion *)pPos;
+/*N*/ pLay = pLay->GetLen() ? NULL : pLay->GetNext();
+/*N*/ }
+/*N*/ return NULL;
+/*N*/ }
+
+/*************************************************************************
+ * SwLineLayout::Init()
+ *************************************************************************/
+
+/*N*/ void SwLineLayout::Init( SwLinePortion* pNextPortion )
+/*N*/ {
+/*N*/ Height( 0 );
+/*N*/ Width( 0 );
+/*N*/ SetLen( 0 );
+/*N*/ SetAscent( 0 );
+/*N*/ SetRealHeight( 0 );
+/*N*/ SetPortion( pNextPortion );
+/*N*/ }
+
+/*-----------------16.11.00 11:04-------------------
+ * HangingMargin()
+ * looks for hanging punctuation portions in the paragraph
+ * and return the maximum right offset of them.
+ * If no such portion is found, the Margin/Hanging-flags will be atualized.
+ * --------------------------------------------------*/
+
+/*N*/ SwTwips SwLineLayout::_GetHangingMargin() const
+/*N*/ {
+/*N*/ SwLinePortion* pPor = GetPortion();
+/*N*/ BOOL bFound = sal_False;
+/*N*/ SwTwips nDiff = 0;
+/*N*/ while( pPor)
+/*N*/ {
+/*N*/ if( pPor->IsHangingPortion() )
+/*N*/ {
+/*?*/ nDiff = ((SwHangingPortion*)pPor)->GetInnerWidth() - pPor->Width();
+/*?*/ if( nDiff )
+/*?*/ bFound = sal_True;
+/*N*/ }
+/*N*/ // the last post its portion
+/*N*/ else if ( pPor->IsPostItsPortion() && ! pPor->GetPortion() )
+/*N*/ nDiff = nAscent;
+/*N*/
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ if( !bFound ) // actualize the hanging-flag
+/*N*/ ((SwLineLayout*)this)->SetHanging( sal_False );
+/*N*/ return nDiff;
+/*N*/ }
+
+/*N*/ SwTwips SwTxtFrm::HangingMargin() const
+/*N*/ {
+/*N*/ ASSERT( HasPara(), "Don't call me without a paraportion" );
+/*N*/ if( !GetPara()->IsMargin() )
+/*N*/ return 0;
+/*?*/ const SwLineLayout* pLine = GetPara();
+/*?*/ SwTwips nRet = 0;
+/*?*/ do
+/*?*/ {
+/*?*/ SwTwips nDiff = pLine->GetHangingMargin();
+/*?*/ if( nDiff > nRet )
+/*?*/ nRet = nDiff;
+/*?*/ pLine = pLine->GetNext();
+/*?*/ } while ( pLine );
+/*?*/ if( !nRet ) // actualize the margin-flag
+/*?*/ ((SwParaPortion*)GetPara())->SetMargin( sal_False );
+/*?*/ return nRet;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_porlin.cxx b/binfilter/bf_sw/source/core/text/sw_porlin.cxx
new file mode 100644
index 000000000000..13c6b8344f8e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_porlin.cxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#ifdef BIDI
+#endif
+
+
+#include "txtcfg.hxx"
+#include "pormulti.hxx"
+#include "inftxt.hxx"
+namespace binfilter {
+
+#ifdef DBG_UTIL
+
+/*N*/ sal_Bool ChkChain( SwLinePortion *pStart )
+/*N*/ {
+/*N*/ SwLinePortion *pPor = pStart->GetPortion();
+/*N*/ MSHORT nCount = 0;
+/*N*/ while( pPor )
+/*N*/ {
+/*N*/ ++nCount;
+/*N*/ ASSERT( nCount < 200 && pPor != pStart,
+/*N*/ "ChkChain(): lost in chains" );
+/*N*/ if( nCount >= 200 || pPor == pStart )
+/*N*/ {
+/*N*/ // der Lebensretter
+/*?*/ pPor = pStart->GetPortion();
+/*?*/ pStart->SetPortion(0);
+/*?*/ pPor->Truncate();
+/*?*/ pStart->SetPortion( pPor );
+/*?*/ return sal_False;
+/*N*/ }
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+#endif
+
+#if OSL_DEBUG_LEVEL > 1
+const sal_Char *GetPortionName( const MSHORT nType );
+#endif
+
+/*N*/ SwLinePortion::~SwLinePortion()
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwLinePortion *SwLinePortion::Compress()
+/*N*/ {
+/*N*/ return GetLen() || Width() ? this : 0;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwLinePortion::SwLinePortion( )
+ *************************************************************************/
+
+/*N*/ SwLinePortion::SwLinePortion( ) :
+/*N*/ nLineLength( 0 ),
+/*N*/ nAscent( 0 ),
+/*N*/ pPortion( NULL )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+ * SwLinePortion::PrePaint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwLinePortion::CalcTxtSize()
+ *************************************************************************/
+
+/*N*/ void SwLinePortion::CalcTxtSize( const SwTxtSizeInfo &rInf )
+/*N*/ {
+/*N*/ if( GetLen() == rInf.GetLen() )
+/*N*/ *((SwPosSize*)this) = GetTxtSize( rInf );
+/*N*/ else
+/*N*/ {
+/*?*/ SwTxtSizeInfo aInf( rInf );
+/*?*/ aInf.SetLen( GetLen() );
+/*?*/ *((SwPosSize*)this) = GetTxtSize( aInf );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwLinePortion::Truncate()
+ *
+ * Es werden alle nachfolgenden Portions geloescht.
+ *************************************************************************/
+
+/*N*/ void SwLinePortion::_Truncate()
+/*N*/ {
+/*N*/ SwLinePortion *pPos = pPortion;
+/*N*/ do
+/*N*/ { ASSERT( pPos != this, "SwLinePortion::Truncate: loop" );
+/*N*/ SwLinePortion *pLast = pPos;
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ pLast->SetPortion( 0 );
+/*N*/ delete pLast;
+/*N*/
+/*N*/ } while( pPos );
+/*N*/
+/*N*/ pPortion = 0;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::Insert()
+ *
+ * Es wird immer hinter uns eingefuegt.
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwLinePortion::Insert( SwLinePortion *pIns )
+/*N*/ {
+/*N*/ pIns->FindLastPortion()->SetPortion( pPortion );
+/*N*/ SetPortion( pIns );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ChkChain( this );
+/*N*/ #endif
+/*N*/ return pIns;
+/*N*/ }
+
+/*************************************************************************
+ * SwLinePortion::FindLastPortion()
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwLinePortion::FindLastPortion()
+/*N*/ {
+/*N*/ register SwLinePortion *pPos = this;
+/*N*/ // An das Ende wandern und pLinPortion an den letzten haengen ...
+/*N*/ while( pPos->GetPortion() )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ return pPos;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::Append()
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwLinePortion::Append( SwLinePortion *pIns )
+/*N*/ {
+/*N*/ SwLinePortion *pPos = FindLastPortion();
+/*N*/ pPos->SetPortion( pIns );
+/*N*/ pIns->SetPortion( 0 );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ChkChain( this );
+/*N*/ #endif
+/*N*/ return pIns;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::Cut()
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwLinePortion::Cut( SwLinePortion *pVictim )
+/*N*/ {
+/*N*/ SwLinePortion *pPrev = pVictim->FindPrevPortion( this );
+/*N*/ ASSERT( pPrev, "SwLinePortion::Cut(): can't cut" );
+/*N*/ pPrev->SetPortion( pVictim->GetPortion() );
+/*N*/ pVictim->SetPortion(0);
+/*N*/ return pVictim;
+/*N*/ }
+
+/*************************************************************************
+ * SwLinePortion::FindPrevPortion()
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwLinePortion::FindPrevPortion( const SwLinePortion *pRoot )
+/*N*/ {
+/*N*/ ASSERT( pRoot != this, "SwLinePortion::FindPrevPortion(): invalid root" );
+/*N*/ SwLinePortion *pPos = (SwLinePortion*)pRoot;
+/*N*/ while( pPos->GetPortion() && pPos->GetPortion() != this )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ ASSERT( pPos->GetPortion(),
+/*N*/ "SwLinePortion::FindPrevPortion: blowing in the wind");
+/*N*/ return pPos;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::GetCrsrOfst()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwLinePortion::GetTxtSize()
+ *************************************************************************/
+/*N*/
+/*N*/ SwPosSize SwLinePortion::GetTxtSize( const SwTxtSizeInfo & ) const
+/*N*/ {
+/*N*/ ASSERT( !this, "SwLinePortion::GetTxtSize: don't ask me about sizes, "
+/*N*/ "I'm only a stupid SwLinePortion" );
+/*N*/ return SwPosSize();
+/*N*/ }
+
+#ifdef DBG_UTIL
+
+/*************************************************************************
+ * virtual SwLinePortion::Check()
+ *************************************************************************/
+
+#endif
+
+/*************************************************************************
+ * virtual SwLinePortion::Format()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwLinePortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if( rInf.X() > rInf.Width() )
+/*N*/ {
+/*?*/ Truncate();
+/*?*/ rInf.SetUnderFlow( this );
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/
+/*N*/ register const SwLinePortion *pLast = rInf.GetLast();
+/*N*/ Height( pLast->Height() );
+/*N*/ SetAscent( pLast->GetAscent() );
+/*N*/ const KSHORT nNewWidth = rInf.X() + PrtWidth();
+/*N*/ // Nur Portions mit echter Breite koennen ein sal_True zurueckliefern
+/*N*/ // Notizen beispielsweise setzen niemals bFull==sal_True
+/*N*/ if( rInf.Width() <= nNewWidth && PrtWidth() && ! IsKernPortion() )
+/*N*/ {
+/*?*/ Truncate();
+/*?*/ if( nNewWidth > rInf.Width() )
+/*?*/ PrtWidth( nNewWidth - rInf.Width() );
+/*?*/ rInf.GetLast()->FormatEOL( rInf );
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::FormatEOL()
+ *************************************************************************/
+
+// Format end of line
+
+/*N*/ void SwLinePortion::FormatEOL( SwTxtFormatInfo &rInf )
+/*N*/ { }
+
+/*************************************************************************
+ * SwLinePortion::Move()
+ *************************************************************************/
+
+/*N*/ void SwLinePortion::Move( SwTxtPaintInfo &rInf )
+/*N*/ {
+/*N*/ BOOL bB2T = rInf.GetDirection() == DIR_BOTTOM2TOP;
+/*N*/ #ifdef BIDI
+/*N*/ const BOOL bFrmDir = rInf.GetTxtFrm()->IsRightToLeft();
+/*N*/ BOOL bCounterDir = ( ! bFrmDir && DIR_RIGHT2LEFT == rInf.GetDirection() ) ||
+/*N*/ ( bFrmDir && DIR_LEFT2RIGHT == rInf.GetDirection() );
+/*N*/ #endif
+/*N*/
+/*N*/ if ( InSpaceGrp() && rInf.GetSpaceAdd() )
+/*N*/ {
+/*?*/ SwTwips nTmp = PrtWidth() + CalcSpacing( rInf.GetSpaceAdd(), rInf );
+/*?*/ if( rInf.IsRotated() )
+/*?*/ rInf.Y( rInf.Y() + ( bB2T ? -nTmp : nTmp ) );
+/*?*/ #ifdef BIDI
+/*?*/ else if ( bCounterDir )
+/*?*/ rInf.X( rInf.X() - nTmp );
+/*?*/ #endif
+/*?*/ else
+/*?*/ rInf.X( rInf.X() + nTmp );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( InFixMargGrp() && !IsMarginPortion() )
+/*N*/ {
+/*N*/ rInf.IncSpaceIdx();
+/*N*/ rInf.IncKanaIdx();
+/*N*/ }
+/*N*/ if( rInf.IsRotated() )
+/*?*/ rInf.Y( rInf.Y() + ( bB2T ? -PrtWidth() : PrtWidth() ) );
+/*N*/ #ifdef BIDI
+/*N*/ else if ( bCounterDir )
+/*?*/ rInf.X( rInf.X() - PrtWidth() );
+/*N*/ #endif
+/*N*/ else
+/*N*/ rInf.X( rInf.X() + PrtWidth() );
+/*N*/ }
+/*N*/ if( IsMultiPortion() && ((SwMultiPortion*)this)->HasTabulator() )
+/*?*/ rInf.IncSpaceIdx();
+/*N*/
+/*N*/ rInf.SetIdx( rInf.GetIdx() + GetLen() );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::CalcSpacing()
+ *************************************************************************/
+
+/*N*/ long SwLinePortion::CalcSpacing( short nSpaceAdd, const SwTxtSizeInfo &rInf ) const
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::GetExpTxt()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwLinePortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const
+/*N*/ {
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwLinePortion::HandlePortion()
+ *************************************************************************/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_pormulti.cxx b/binfilter/bf_sw/source/core/text/sw_pormulti.cxx
new file mode 100644
index 000000000000..913aee8e9b45
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_pormulti.cxx
@@ -0,0 +1,840 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <bf_svx/twolinesitem.hxx>
+#include <bf_svx/charrotateitem.hxx>
+
+#ifdef BIDI
+#endif
+
+#include <charfmt.hxx>
+#include <txtinet.hxx>
+#include <fchrfmt.hxx>
+#include <pormulti.hxx> // SwMultiPortion
+#include <itrform2.hxx> // SwTxtFormatter
+
+#include <horiornt.hxx>
+
+#include <porfld.hxx> // SwFldPortion
+namespace binfilter {
+
+using namespace ::com::sun::star;
+extern sal_Bool IsUnderlineBreak( const SwLinePortion& rPor, const SwFont& rFnt );
+extern BYTE WhichFont( xub_StrLen nIdx, const String* pTxt,
+ const SwScriptInfo* pSI );
+
+/*-----------------10.10.00 15:23-------------------
+ * class SwMultiPortion
+ *
+ * A SwMultiPortion is not a simple portion,
+ * it's a container, which contains almost a SwLineLayoutPortion.
+ * This SwLineLayout could be followed by other textportions via pPortion
+ * and by another SwLineLayout via pNext to realize a doubleline portion.
+ * --------------------------------------------------*/
+
+
+
+/*-----------------13.10.00 16:21-------------------
+ * Summarize the internal lines to calculate the (external) size.
+ * The internal line has to calculate first.
+ * --------------------------------------------------*/
+
+
+
+#ifdef BIDI
+#endif
+
+/*************************************************************************
+ * virtual SwMultiPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*-----------------01.11.00 14:21-------------------
+ * SwMultiPortion::ActualizeTabulator()
+ * sets the tabulator-flag, if there's any tabulator-portion inside.
+ * --------------------------------------------------*/
+
+
+/*-----------------16.02.01 12:07-------------------
+ * SwRotatedPortion::SwRotatedPortion(..)
+ * --------------------------------------------------*/
+
+
+
+/*-----------------01.11.00 14:22-------------------
+ * SwDoubleLinePortion::SwDoubleLinePortion(..)
+ * This constructor is for the continuation of a doubleline portion
+ * in the next line.
+ * It takes the same brackets and if the original has no content except
+ * brackets, these will be deleted.
+ * --------------------------------------------------*/
+
+
+/*-----------------01.11.00 14:22-------------------
+ * SwDoubleLinePortion::SwDoubleLinePortion(..)
+ * This constructor uses the textattribut to get the right brackets.
+ * The textattribut could be a 2-line-attribute or a character- or
+ * internetstyle, which contains the 2-line-attribute.
+ * --------------------------------------------------*/
+
+
+
+/*-----------------25.10.00 09:51-------------------
+ * SwMultiPortion::PaintBracket paints the wished bracket,
+ * if the multiportion has surrounding brackets.
+ * The X-position of the SwTxtPaintInfo will be modified:
+ * the open bracket sets position behind itself,
+ * the close bracket in front of itself.
+ * --------------------------------------------------*/
+
+
+/*-----------------25.10.00 16:26-------------------
+ * SwDoubleLinePortion::SetBrackets creates the bracket-structur
+ * and fills it, if not both characters are 0x00.
+ * --------------------------------------------------*/
+
+
+/*-----------------25.10.00 16:29-------------------
+ * SwDoubleLinePortion::FormatBrackets
+ * calculates the size of the brackets => pBracket,
+ * reduces the nMaxWidth-parameter ( minus bracket-width )
+ * and moves the rInf-x-position behind the opening bracket.
+ * --------------------------------------------------*/
+
+
+/*-----------------26.10.00 10:36-------------------
+ * SwDoubleLinePortion::CalcBlanks
+ * calculates the number of blanks in each line and
+ * the difference of the width of the two lines.
+ * These results are used from the text adjustment.
+ * --------------------------------------------------*/
+
+
+
+/*-----------------01.11.00 14:29-------------------
+ * SwDoubleLinePortion::ChangeSpaceAdd(..)
+ * merges the spaces for text adjustment from the inner and outer part.
+ * Inside the doubleline portion the wider line has no spaceadd-array, the
+ * smaller line has such an array to reach width of the wider line.
+ * If the surrounding line has text adjustment and the doubleline portion
+ * contains no tabulator, it is necessary to create/manipulate the inner
+ * space arrays.
+ * --------------------------------------------------*/
+
+/*-----------------01.11.00 14:29-------------------
+ * SwDoubleLinePortion::ResetSpaceAdd(..)
+ * cancels the manipulation from SwDoubleLinePortion::ChangeSpaceAdd(..)
+ * --------------------------------------------------*/
+
+
+#ifdef BIDI
+/*-----------------13.11.00 14:50-------------------
+ * SwRubyPortion::SwRubyPortion(..)
+ * constructs a ruby portion, i.e. an additional text is displayed
+ * beside the main text, e.g. phonetic characters.
+ * --------------------------------------------------*/
+
+
+#endif
+
+/*-----------------13.11.00 14:50-------------------
+ * SwRubyPortion::SwRubyPortion(..)
+ * constructs a ruby portion, i.e. an additional text is displayed
+ * beside the main text, e.g. phonetic characters.
+ * --------------------------------------------------*/
+
+
+/*-----------------13.11.00 14:56-------------------
+ * SwRubyPortion::_Adjust(..)
+ * In ruby portion there are different alignments for
+ * the ruby text and the main text.
+ * Left, right, centered and two possibilities of block adjustment
+ * The block adjustment is realized by spacing between the characteres,
+ * either with a half space or no space in front of the first letter and
+ * a half space at the end of the last letter.
+ * Notice: the smaller line will be manipulated, normally it's the ruby line,
+ * but it could be the main text, too.
+ * If there is a tabulator in smaller line, no adjustment is possible.
+ * --------------------------------------------------*/
+
+
+/*-----------------08.11.00 14:14-------------------
+ * CalcRubyOffset()
+ * has to change the nRubyOffset, if there's a fieldportion
+ * in the phonetic line.
+ * The nRubyOffset is the position in the rubystring, where the
+ * next SwRubyPortion has start the displaying of the phonetics.
+ * --------------------------------------------------*/
+
+
+/*-----------------13.10.00 16:22-------------------
+ * SwTxtSizeInfo::GetMultiCreator(..)
+ * If we (e.g. the position rPos) are inside a two-line-attribute or
+ * a ruby-attribute, the attribute will be returned in a SwMultiCreator-struct,
+ * otherwise the function returns zero.
+ * The rPos parameter is set to the end of the multiportion,
+ * normally this is the end of the attribute,
+ * but sometimes it is the start of another attribute, which finished or
+ * interrupts the first attribute.
+ * E.g. a ruby portion interrupts a 2-line-attribute, a 2-line-attribute
+ * with different brackets interrupts another 2-line-attribute.
+ * --------------------------------------------------*/
+
+/*-----------------13.11.00 15:38-------------------
+ * lcl_Has2Lines(..)
+ * is a little help function for GetMultiCreator(..)
+ * It extracts the 2-line-format from a 2-line-attribute or a character style.
+ * The rValue is set to TRUE, if the 2-line-attribute's value is set and
+ * no 2-line-format reference is passed. If there is a 2-line-format reference,
+ * then the rValue is set only, if the 2-line-attribute's value is set _and_
+ * the 2-line-formats has the same brackets.
+ * --------------------------------------------------*/
+
+/*N*/ sal_Bool lcl_Has2Lines( const SwTxtAttr& rAttr, const SvxTwoLinesItem* &rpRef,
+/*N*/ sal_Bool &rValue )
+/*N*/ {
+/*N*/ if( RES_CHRATR_TWO_LINES == rAttr.Which() )
+/*N*/ {
+/*?*/ rValue = rAttr.Get2Lines().GetValue();
+/*?*/ if( !rpRef )
+/*?*/ rpRef = &rAttr.Get2Lines();
+/*?*/ else if( rAttr.Get2Lines().GetEndBracket() != rpRef->GetEndBracket() ||
+/*?*/ rAttr.Get2Lines().GetStartBracket() != rpRef->GetStartBracket() )
+/*?*/ rValue = sal_False;
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/ SwCharFmt* pFmt = NULL;
+/*N*/ if( RES_TXTATR_INETFMT == rAttr.Which() )
+/*N*/ pFmt = ((SwTxtINetFmt&)rAttr).GetCharFmt();
+/*N*/ else if( RES_TXTATR_CHARFMT == rAttr.Which() )
+/*N*/ pFmt = rAttr.GetCharFmt().GetCharFmt();
+/*N*/ if ( pFmt )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pFmt->GetAttrSet().
+/*N*/ GetItemState( RES_CHRATR_TWO_LINES, TRUE, &pItem ) )
+/*N*/ {
+/*?*/ rValue = ((SvxTwoLinesItem*)pItem)->GetValue();
+/*?*/ if( !rpRef )
+/*?*/ rpRef = (SvxTwoLinesItem*)pItem;
+/*?*/ else if( ((SvxTwoLinesItem*)pItem)->GetEndBracket() !=
+/*?*/ rpRef->GetEndBracket() ||
+/*?*/ ((SvxTwoLinesItem*)pItem)->GetStartBracket() !=
+/*?*/ rpRef->GetStartBracket() )
+/*?*/ rValue = sal_False;
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+/*-----------------16.02.01 16:39-------------------
+ * lcl_HasRotation(..)
+ * is a little help function for GetMultiCreator(..)
+ * It extracts the charrotation from a charrotate-attribute or a character style.
+ * The rValue is set to TRUE, if the charrotate-attribute's value is set and
+ * no charrotate-format reference is passed.
+ * If there is a charrotate-format reference, then the rValue is set only,
+ * if the charrotate-attribute's value is set _and_ identical
+ * to the charrotate-format's value.
+ * --------------------------------------------------*/
+
+/*N*/ sal_Bool lcl_HasRotation( const SwTxtAttr& rAttr,
+/*N*/ const SvxCharRotateItem* &rpRef, sal_Bool &rValue )
+/*N*/ {
+/*N*/ if( RES_CHRATR_ROTATE == rAttr.Which() )
+/*N*/ {
+/*?*/ rValue = 0 != rAttr.GetCharRotate().GetValue();
+/*?*/ if( !rpRef )
+/*?*/ rpRef = &rAttr.GetCharRotate();
+/*?*/ else if( rAttr.GetCharRotate().GetValue() != rpRef->GetValue() )
+/*?*/ rValue = sal_False;
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/ SwCharFmt* pFmt = NULL;
+/*N*/ if( RES_TXTATR_INETFMT == rAttr.Which() )
+/*N*/ pFmt = ((SwTxtINetFmt&)rAttr).GetCharFmt();
+/*N*/ else if( RES_TXTATR_CHARFMT == rAttr.Which() )
+/*N*/ pFmt = rAttr.GetCharFmt().GetCharFmt();
+/*N*/ if ( pFmt )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pFmt->GetAttrSet().
+/*N*/ GetItemState( RES_CHRATR_ROTATE, TRUE, &pItem ) )
+/*N*/ {
+/*?*/ rValue = 0 != ((SvxCharRotateItem*)pItem)->GetValue();
+/*?*/ if( !rpRef )
+/*?*/ rpRef = (SvxCharRotateItem*)pItem;
+/*?*/ else if( ((SvxCharRotateItem*)pItem)->GetValue() !=
+/*?*/ rpRef->GetValue() )
+/*?*/ rValue = sal_False;
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+/*N*/ #ifdef BIDI
+/*N*/ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos,
+/*N*/ SwMultiPortion* pMulti ) const
+/*N*/ #else
+/*N*/ SwMultiCreator* SwTxtSizeInfo::GetMultiCreator( xub_StrLen &rPos ) const
+/*N*/ #endif
+/*N*/ {
+/*N*/ #ifdef BIDI
+/*N*/ SwScriptInfo& rSI = ((SwParaPortion*)GetParaPortion())->GetScriptInfo();
+/*N*/
+/*N*/ // get the last embedding level
+/*N*/ BYTE nCurrLevel;
+/*N*/ if ( pMulti )
+/*N*/ {
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ ASSERT( pMulti->IsBidi(), "Nested MultiPortion is not BidiPortion" )
+/*N*/ }
+/*N*/ else
+/*N*/ // no nested bidi portion required
+/*N*/ nCurrLevel = GetTxtFrm()->IsRightToLeft() ? 1 : 0;
+/*N*/
+/*N*/ // check if there is a field at rPos:
+/*N*/ BYTE nNextLevel = nCurrLevel;
+/*N*/ sal_Bool bFldBidi = sal_False;
+/*N*/
+/*N*/ if ( CH_TXTATR_BREAKWORD == GetChar( rPos ) )
+/*N*/ {
+ bFldBidi = sal_True;
+/*
+ // examining the script of the field text should be sufficient
+ // for 99% of all cases
+ XubString aTxt = GetTxtFrm()->GetTxtNode()->GetExpandTxt( rPos, 1 );
+
+ if ( pBreakIt->xBreak.is() && aTxt.Len() )
+ {
+ sal_Bool bFldDir = ( ::com::sun::star::i18n::ScriptType::COMPLEX ==
+ pBreakIt->GetRealScriptOfText( aTxt, 0 ) );
+ sal_Bool bCurrDir = ( 0 != ( nCurrLevel % 2 ) );
+ if ( bFldDir != bCurrDir )
+ {
+ nNextLevel = nCurrLevel + 1;
+ bFldBidi = sal_True;
+ }
+ }*/
+/*N*/ }
+/*N*/ else
+/*N*/ nNextLevel = rSI.DirType( rPos );
+/*N*/
+/*N*/ if ( GetTxt().Len() != rPos && nNextLevel > nCurrLevel )
+/*N*/ {
+/*?*/ rPos = bFldBidi ? rPos + 1 : rSI.NextDirChg( rPos, &nCurrLevel );
+/*?*/ if ( STRING_LEN == rPos )
+/*?*/ return NULL;
+/*?*/ SwMultiCreator *pRet = new SwMultiCreator;
+/*?*/ pRet->pItem = NULL;
+/*?*/ pRet->pAttr = NULL;
+/*?*/ pRet->nId = SW_MC_BIDI;
+/*?*/ pRet->nLevel = nCurrLevel + 1;
+/*?*/ return pRet;
+/*N*/ }
+/*N*/
+/*N*/ // a bidi portion can only contain other bidi portions
+/*N*/ if ( pMulti )
+/*N*/ return NULL;
+/*N*/ #endif
+/*N*/
+/*N*/ const SvxCharRotateItem* pRotate = NULL;
+/*N*/ const SfxPoolItem* pRotItem;
+/*N*/ if( SFX_ITEM_SET == pFrm->GetTxtNode()->GetSwAttrSet().
+/*N*/ GetItemState( RES_CHRATR_ROTATE, TRUE, &pRotItem ) &&
+/*N*/ ((SvxCharRotateItem*)pRotItem)->GetValue() )
+/*?*/ pRotate = (SvxCharRotateItem*)pRotItem;
+/*N*/ else
+/*N*/ pRotItem = NULL;
+/*N*/ const SvxTwoLinesItem* p2Lines = NULL;
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pFrm->GetTxtNode()->GetSwAttrSet().
+/*N*/ GetItemState( RES_CHRATR_TWO_LINES, TRUE, &pItem ) &&
+/*N*/ ((SvxTwoLinesItem*)pItem)->GetValue() )
+/*N*/ p2Lines = (SvxTwoLinesItem*)pItem;
+/*N*/ else
+/*N*/ pItem = NULL;
+/*N*/
+/*N*/ const SwpHints *pHints = pFrm->GetTxtNode()->GetpSwpHints();
+/*N*/ if( !pHints && !p2Lines && !pRotate )
+/*N*/ return NULL;
+/*N*/ const SwTxtAttr *pRuby = NULL;
+/*N*/ sal_Bool bTwo = sal_False;
+/*N*/ sal_Bool bRot = sal_False;
+/*N*/ USHORT n2Lines = USHRT_MAX;
+/*N*/ USHORT nRotate = USHRT_MAX;
+/*N*/ USHORT nCount = pHints ? pHints->Count() : 0;
+/*N*/ USHORT i;
+/*N*/ for( i = 0; i < nCount; ++i )
+/*N*/ {
+/*N*/ const SwTxtAttr *pTmp = (*pHints)[i];
+/*N*/ xub_StrLen nStart = *pTmp->GetStart();
+/*N*/ if( rPos < nStart )
+/*N*/ break;
+/*N*/ if( *pTmp->GetAnyEnd() > rPos )
+/*N*/ {
+/*N*/ if( RES_TXTATR_CJK_RUBY == pTmp->Which() )
+/*N*/ pRuby = pTmp;
+/*N*/ else
+/*N*/ {
+/*N*/ const SvxCharRotateItem* pRoTmp = NULL;
+/*N*/ if( lcl_HasRotation( *pTmp, pRoTmp, bRot ) )
+/*N*/ {
+/*N*/ nRotate = bRot ? i : nCount;
+/*N*/ pRotate = pRoTmp;
+/*N*/ }
+/*N*/ const SvxTwoLinesItem* p2Tmp = NULL;
+/*N*/ if( lcl_Has2Lines( *pTmp, p2Tmp, bTwo ) )
+/*N*/ {
+/*N*/ n2Lines = bTwo ? i : nCount;
+/*N*/ p2Lines = p2Tmp;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( pRuby )
+/*N*/ { // The winner is ... a ruby attribute and so
+/*N*/ // the end of the multiportion is the end of the ruby attribute.
+/*?*/ rPos = *pRuby->GetEnd();
+/*?*/ SwMultiCreator *pRet = new SwMultiCreator;
+/*?*/ pRet->pItem = NULL;
+/*?*/ pRet->pAttr = pRuby;
+/*?*/ pRet->nId = SW_MC_RUBY;
+/*?*/ #ifdef BIDI
+/*?*/ pRet->nLevel = GetTxtFrm()->IsRightToLeft() ? 1 : 0;
+/*?*/ #endif
+/*?*/ return pRet;
+/*N*/ }
+/*N*/ if( n2Lines < nCount || ( pItem && pItem == p2Lines &&
+/*N*/ rPos < GetTxt().Len() ) )
+/*N*/ { // The winner is a 2-line-attribute,
+/*?*/ // the end of the multiportion depends on the following attributes...
+/*?*/ SwMultiCreator *pRet = new SwMultiCreator;
+/*?*/
+/*?*/ // We note the endpositions of the 2-line attributes in aEnd as stack
+/*?*/ SvXub_StrLens aEnd;
+/*?*/
+/*?*/ // The bOn flag signs the state of the last 2-line attribute in the
+/*?*/ // aEnd-stack, it is compatible with the winner-attribute or
+/*?*/ // it interrupts the other attribute.
+/*?*/ sal_Bool bOn = sal_True;
+/*?*/
+/*?*/ if( n2Lines < nCount )
+/*?*/ {
+/*?*/ pRet->pItem = NULL;
+/*?*/ pRet->pAttr = (*pHints)[n2Lines];
+/*?*/ aEnd.Insert( *pRet->pAttr->GetEnd(), 0 );
+/*?*/ if( pItem )
+/*?*/ {
+/*?*/ aEnd[ 0 ] = GetTxt().Len();
+/*?*/ bOn = ((SvxTwoLinesItem*)pItem)->GetEndBracket() ==
+/*?*/ p2Lines->GetEndBracket() &&
+/*?*/ ((SvxTwoLinesItem*)pItem)->GetStartBracket() ==
+/*?*/ p2Lines->GetStartBracket();
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pRet->pItem = pItem;
+/*?*/ pRet->pAttr = NULL;
+/*?*/ aEnd.Insert( GetTxt().Len(), 0 );
+/*?*/ }
+/*?*/ pRet->nId = SW_MC_DOUBLE;
+/*?*/ #ifdef BIDI
+/*?*/ pRet->nLevel = GetTxtFrm()->IsRightToLeft() ? 1 : 0;
+/*?*/ #endif
+/*?*/
+/*?*/ // n2Lines is the index of the last 2-line-attribute, which contains
+/*?*/ // the actual position.
+/*?*/ i = 0;
+/*?*/ // At this moment we know that at position rPos the "winner"-attribute
+/*?*/ // causes a 2-line-portion. The end of the attribute is the end of the
+/*?*/ // portion, if there's no interrupting attribute.
+/*?*/ // There are two kinds of interruptors:
+/*?*/ // - ruby attributes stops the 2-line-attribute, the end of the
+/*?*/ // multiline is the start of the ruby attribute
+/*?*/ // - 2-line-attributes with value "Off" or with different brackets,
+/*?*/ // these attributes may interrupt the winner, but they could be
+/*?*/ // neutralized by another 2-line-attribute starting at the same
+/*?*/ // position with the same brackets as the winner-attribute.
+/*?*/
+/*?*/ // In the following loop rPos is the critical position and it will be
+/*?*/ // evaluated, if at rPos starts a interrupting or a maintaining
+/*?*/ // continuity attribute.
+/*?*/ while( i < nCount )
+/*?*/ {
+/*?*/ const SwTxtAttr *pTmp = (*pHints)[i++];
+/*?*/ if( *pTmp->GetAnyEnd() <= rPos )
+/*?*/ continue;
+/*?*/ if( rPos < *pTmp->GetStart() )
+/*?*/ {
+/*?*/ // If bOn is FALSE and the next attribute starts later than rPos
+/*?*/ // the winner attribute is interrupted at rPos.
+/*?*/ // If the start of the next atribute is behind the end of
+/*?*/ // the last attribute on the aEnd-stack, this is the endposition
+/*?*/ // on the stack is the end of the 2-line portion.
+/*?*/ if( !bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() )
+/*?*/ break;
+/*?*/ // At this moment, bOn is TRUE and the next attribute starts
+/*?*/ // behind rPos, so we could move rPos to the next startpoint
+/*?*/ rPos = *pTmp->GetStart();
+/*?*/ // We clean up the aEnd-stack, endpositions equal to rPos are
+/*?*/ // superfluous.
+/*?*/ while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= rPos )
+/*?*/ {
+/*?*/ bOn = !bOn;
+/*?*/ aEnd.Remove( aEnd.Count()-1, 1 );
+/*?*/ }
+/*?*/ // If the endstack is empty, we simulate an attribute with
+/*?*/ // state TRUE and endposition rPos
+/*?*/ if( !aEnd.Count() )
+/*?*/ {
+/*?*/ aEnd.Insert( rPos, 0 );
+/*?*/ bOn = sal_True;
+/*?*/ }
+/*?*/ }
+/*?*/ // A ruby attribute stops the 2-line immediately
+/*?*/ if( RES_TXTATR_CJK_RUBY == pTmp->Which() )
+/*?*/ return pRet;
+/*?*/ if( lcl_Has2Lines( *pTmp, p2Lines, bTwo ) )
+/*?*/ { // We have an interesting attribute..
+/*?*/ if( bTwo == bOn )
+/*?*/ { // .. with the same state, so the last attribute could
+/*?*/ // be continued.
+/*?*/ if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() )
+/*?*/ aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+/*?*/ }
+/*?*/ else
+/*?*/ { // .. with a different state.
+/*?*/ bOn = bTwo;
+/*?*/ // If this is smaller than the last on the stack, we put
+/*?*/ // it on the stack. If it has the same endposition, the last
+/*?*/ // could be removed.
+/*?*/ if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() )
+/*?*/ aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() );
+/*?*/ else if( aEnd.Count() > 1 )
+/*?*/ aEnd.Remove( aEnd.Count()-1, 1 );
+/*?*/ else
+/*?*/ aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ if( bOn && aEnd.Count() )
+/*?*/ rPos = aEnd[ aEnd.Count()-1 ];
+/*?*/ return pRet;
+/*N*/ }
+/*N*/ if( nRotate < nCount || ( pRotItem && pRotItem == pRotate &&
+/*N*/ rPos < GetTxt().Len() ) )
+/*N*/ { // The winner is a rotate-attribute,
+/*?*/ // the end of the multiportion depends on the following attributes...
+/*?*/ SwMultiCreator *pRet = new SwMultiCreator;
+/*?*/ pRet->nId = SW_MC_ROTATE;
+/*?*/
+/*?*/ // We note the endpositions of the 2-line attributes in aEnd as stack
+/*?*/ SvXub_StrLens aEnd;
+/*?*/
+/*?*/ // The bOn flag signs the state of the last 2-line attribute in the
+/*?*/ // aEnd-stack, which could interrupts the winning rotation attribute.
+/*?*/ sal_Bool bOn = pItem ? sal_True : sal_False;
+/*?*/ aEnd.Insert( GetTxt().Len(), 0 );
+/*?*/ // n2Lines is the index of the last 2-line-attribute, which contains
+/*?*/ // the actual position.
+/*?*/ i = 0;
+/*?*/ xub_StrLen n2Start = rPos;
+/*?*/ while( i < nCount )
+/*?*/ {
+/*?*/ const SwTxtAttr *pTmp = (*pHints)[i++];
+/*?*/ if( *pTmp->GetAnyEnd() <= n2Start )
+/*?*/ continue;
+/*?*/ if( n2Start < *pTmp->GetStart() )
+/*?*/ {
+/*?*/ if( bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() )
+/*?*/ break;
+/*?*/ n2Start = *pTmp->GetStart();
+/*?*/ while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= n2Start )
+/*?*/ {
+/*?*/ bOn = !bOn;
+/*?*/ aEnd.Remove( aEnd.Count()-1, 1 );
+/*?*/ }
+/*?*/ if( !aEnd.Count() )
+/*?*/ {
+/*?*/ aEnd.Insert( n2Start, 0 );
+/*?*/ bOn = sal_False;
+/*?*/ }
+/*?*/ }
+/*?*/ // A ruby attribute stops immediately
+/*?*/ if( RES_TXTATR_CJK_RUBY == pTmp->Which() )
+/*?*/ {
+/*?*/ bOn = sal_True;
+/*?*/ break;
+/*?*/ }
+/*?*/ p2Lines = NULL;
+/*?*/ if( lcl_Has2Lines( *pTmp, p2Lines, bTwo ) )
+/*?*/ {
+/*?*/ if( bTwo == bOn )
+/*?*/ {
+/*?*/ if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() )
+/*?*/ aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ bOn = bTwo;
+/*?*/ if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() )
+/*?*/ aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() );
+/*?*/ else if( aEnd.Count() > 1 )
+/*?*/ aEnd.Remove( aEnd.Count()-1, 1 );
+/*?*/ else
+/*?*/ aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ if( !bOn && aEnd.Count() )
+/*?*/ n2Start = aEnd[ aEnd.Count()-1 ];
+/*?*/
+/*?*/ if( aEnd.Count() )
+/*?*/ aEnd.Remove( 0, aEnd.Count() );
+/*?*/
+/*?*/ bOn = sal_True;
+/*?*/ if( nRotate < nCount )
+/*?*/ {
+/*?*/ pRet->pItem = NULL;
+/*?*/ pRet->pAttr = (*pHints)[nRotate];
+/*?*/ aEnd.Insert( *pRet->pAttr->GetEnd(), 0 );
+/*?*/ if( pRotItem )
+/*?*/ {
+/*?*/ aEnd[ 0 ] = GetTxt().Len();
+/*?*/ bOn = ((SvxCharRotateItem*)pRotItem)->GetValue() ==
+/*?*/ pRotate->GetValue();
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pRet->pItem = pRotItem;
+/*?*/ pRet->pAttr = NULL;
+/*?*/ aEnd.Insert( GetTxt().Len(), 0 );
+/*?*/ }
+/*?*/ i = 0;
+/*?*/ while( i < nCount )
+/*?*/ {
+/*?*/ const SwTxtAttr *pTmp = (*pHints)[i++];
+/*?*/ if( *pTmp->GetAnyEnd() <= rPos )
+/*?*/ continue;
+/*?*/ if( rPos < *pTmp->GetStart() )
+/*?*/ {
+/*?*/ if( !bOn || aEnd[ aEnd.Count()-1 ] < *pTmp->GetStart() )
+/*?*/ break;
+/*?*/ rPos = *pTmp->GetStart();
+/*?*/ while( aEnd.Count() && aEnd[ aEnd.Count()-1 ] <= rPos )
+/*?*/ {
+/*?*/ bOn = !bOn;
+/*?*/ aEnd.Remove( aEnd.Count()-1, 1 );
+/*?*/ }
+/*?*/ if( !aEnd.Count() )
+/*?*/ {
+/*?*/ aEnd.Insert( rPos, 0 );
+/*?*/ bOn = sal_True;
+/*?*/ }
+/*?*/ }
+/*?*/ if( RES_TXTATR_CJK_RUBY == pTmp->Which() )
+/*?*/ {
+/*?*/ bOn = sal_False;
+/*?*/ break;
+/*?*/ }
+/*?*/ if( lcl_HasRotation( *pTmp, pRotate, bTwo ) )
+/*?*/ {
+/*?*/ if( bTwo == bOn )
+/*?*/ {
+/*?*/ if( aEnd[ aEnd.Count()-1 ] < *pTmp->GetEnd() )
+/*?*/ aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ bOn = bTwo;
+/*?*/ if( aEnd[ aEnd.Count()-1 ] > *pTmp->GetEnd() )
+/*?*/ aEnd.Insert( *pTmp->GetEnd(), aEnd.Count() );
+/*?*/ else if( aEnd.Count() > 1 )
+/*?*/ aEnd.Remove( aEnd.Count()-1, 1 );
+/*?*/ else
+/*?*/ aEnd[ aEnd.Count()-1 ] = *pTmp->GetEnd();
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ if( bOn && aEnd.Count() )
+/*?*/ rPos = aEnd[ aEnd.Count()-1 ];
+/*?*/ if( rPos > n2Start )
+/*?*/ rPos = n2Start;
+/*?*/ return pRet;
+/*N*/ }
+/*N*/ return NULL;
+/*N*/ }
+
+/*-----------------01.11.00 14:52-------------------
+ * SwSpaceManipulator
+ * is a little helper class to manage the spaceadd-arrays of the text adjustment
+ * during a PaintMultiPortion.
+ * The constructor prepares the array for the first line of multiportion,
+ * the SecondLine-function restores the values for the first line and prepares
+ * the second line.
+ * The destructor restores the values of the last manipulation.
+ * --------------------------------------------------*/
+
+
+
+
+
+/*-----------------13.10.00 16:24-------------------
+ * SwTxtPainter::PaintMultiPortion manages the paint for a SwMultiPortion.
+ * External, for the calling function, it seems to be a normal Paint-function,
+ * internal it is like a SwTxtFrm::Paint with multiple DrawTextLines
+ * --------------------------------------------------*/
+
+
+
+/*----------------------------------------------------
+ * lcl_TruncateMultiPortion
+ * If a multi portion completely has to go to the
+ * next line, this function is called to trunctate
+ * the rest of the remaining multi portion
+ * --------------------------------------------------*/
+
+
+/*-----------------------------------------------------------------------------
+ * SwTxtFormatter::BuildMultiPortion
+ * manages the formatting of a SwMultiPortion. External, for the calling
+ * function, it seems to be a normal Format-function, internal it is like a
+ * SwTxtFrm::_Format with multiple BuildPortions
+ *---------------------------------------------------------------------------*/
+
+
+/*-----------------08.11.00 09:29-------------------
+ * SwTxtFormatter::MakeRestPortion(..)
+ * When a fieldportion at the end of line breaks and needs a following
+ * fieldportion in the next line, then the "restportion" of the formatinfo
+ * has to be set. Normally this happens during the formatting of the first
+ * part of the fieldportion.
+ * But sometimes the formatting starts at the line with the following part,
+ * exspecally when the following part is on the next page.
+ * In this case the MakeRestPortion-function has to create the following part.
+ * The first parameter is the line that contains possibly a first part
+ * of a field. When the function finds such field part, it creates the right
+ * restportion. This may be a multiportion, e.g. if the field is surrounded by
+ * a doubleline- or ruby-portion.
+ * The second parameter is the start index of the line.
+ * --------------------------------------------------*/
+
+/*N*/ SwLinePortion* SwTxtFormatter::MakeRestPortion( const SwLineLayout* pLine,
+/*N*/ xub_StrLen nPos )
+/*N*/ {
+/*N*/ if( !nPos )
+/*N*/ return NULL;
+/*N*/ xub_StrLen nMultiPos = nPos - pLine->GetLen();
+/*N*/ const SwMultiPortion *pTmpMulti = NULL;
+/*N*/ const SwMultiPortion *pMulti = NULL;
+/*N*/ const SwLinePortion* pPor = pLine->GetFirstPortion();
+/*N*/ SwFldPortion *pFld = NULL;
+/*N*/ while( pPor )
+/*N*/ {
+/*N*/ if( pPor->GetLen() )
+/*N*/ {
+/*N*/ if( !pMulti )
+/*N*/ {
+/*N*/ nMultiPos += pPor->GetLen();
+/*N*/ pTmpMulti = NULL;
+/*N*/ }
+/*N*/ }
+/*N*/ if( pPor->InFldGrp() )
+/*N*/ {
+/*?*/ if( !pMulti )
+/*?*/ pTmpMulti = NULL;
+/*?*/ pFld = (SwFldPortion*)pPor;
+/*N*/ }
+/*N*/ else if( pPor->IsMultiPortion() )
+/*N*/ {
+/*?*/ #ifdef BIDI
+/*?*/ ASSERT( !pMulti || pMulti->IsBidi(),
+/*?*/ "Nested multiportions are forbidden." );
+/*?*/ #else
+/*?*/ ASSERT( !pMulti, "Nested multiportions are forbidden." );
+/*?*/ #endif
+/*?*/
+/*?*/ pFld = NULL;
+/*?*/ pTmpMulti = (SwMultiPortion*)pPor;
+/*N*/ }
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ // If the last portion is a multi-portion, we enter it
+/*N*/ // and look for a field portion inside.
+/*N*/ // If we are already in a multiportion, we could change to the
+/*N*/ // next line
+/*N*/ if( !pPor && pTmpMulti )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*N*/ {
+/*N*/ }
+/*N*/ if( pFld && !pFld->HasFollow() )
+/*N*/ pFld = NULL;
+/*N*/
+/*N*/ SwLinePortion *pRest = NULL;
+/*N*/ if( pFld )
+/*N*/ {
+/*?*/ const SwTxtAttr *pHint = GetAttr( nPos - 1 );
+/*?*/ if( pHint && pHint->Which() == RES_TXTATR_FIELD )
+/*?*/ {
+/*?*/ pRest = NewFldPortion( GetInfo(), pHint );
+/*?*/ if( pRest->InFldGrp() )
+/*?*/ ((SwFldPortion*)pRest)->TakeNextOffset( pFld );
+/*?*/ else
+/*?*/ {
+/*?*/ delete pRest;
+/*?*/ pRest = NULL;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ if( !pMulti )
+/*N*/ return pRest;
+/*N*/ {DBG_BF_ASSERT(0, "STRIP");}
+/*?*/ return pRest;
+/*N*/ }
+
+
+
+/*-----------------23.10.00 10:47-------------------
+ * SwTxtCursorSave notes the start and current line of a SwTxtCursor,
+ * sets them to the values for GetCrsrOfst inside a multiportion
+ * and restores them in the destructor.
+ * --------------------------------------------------*/
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_porrst.cxx b/binfilter/bf_sw/source/core/text/sw_porrst.cxx
new file mode 100644
index 000000000000..842723d28ddc
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_porrst.cxx
@@ -0,0 +1,381 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/lspcitem.hxx>
+#include <bf_svx/adjitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/pgrditem.hxx>
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <viewsh.hxx> // ViewShell
+#include <viewopt.hxx>
+#include <pagefrm.hxx> // SwPageFrm
+#include <paratr.hxx>
+#include <porrst.hxx>
+#include <inftxt.hxx>
+#include <tgrditem.hxx>
+#include <pagedesc.hxx> // SwPageDesc
+#include <frmsh.hxx>
+#include <frmatr.hxx>
+#include <atrhndl.hxx>
+namespace binfilter {
+
+/*************************************************************************
+ * class SwBreakPortion
+ *************************************************************************/
+/*N*/ SwBreakPortion::SwBreakPortion( const SwLinePortion &rPortion )
+/*N*/ : SwLinePortion( rPortion ), nRestWidth( 0 )
+/*N*/ {
+/*N*/ nLineLength = 1;
+/*N*/ SetWhichPor( POR_BRK );
+/*N*/ }
+
+
+/*N*/ SwLinePortion *SwBreakPortion::Compress()
+/*N*/ { return (GetPortion() && GetPortion()->InTxtGrp() ? 0 : this); }
+
+
+/*************************************************************************
+ * SwBreakPortion::CalcViewWidth()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwBreakPortion::Format()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwBreakPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ nRestWidth = (USHORT)(rInf.Width() - rInf.X());
+/*N*/ register const SwLinePortion *pRoot = rInf.GetRoot();
+/*N*/ Width( 0 );
+/*N*/ Height( pRoot->Height() );
+/*N*/ SetAscent( pRoot->GetAscent() );
+/*N*/ if ( rInf.GetIdx()+1 == rInf.GetTxt().Len() )
+/*N*/ rInf.SetNewLine( sal_True );
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwBreakPortion::HandlePortion()
+ *************************************************************************/
+
+
+
+/*N*/ SwKernPortion::SwKernPortion( SwLinePortion &rPortion, short nKrn,
+/*N*/ sal_Bool bBG, sal_Bool bGK ) :
+/*N*/ nKern( nKrn ), bBackground( bBG ), bGridKern( bGK )
+/*N*/ {
+/*N*/ Height( rPortion.Height() );
+/*N*/ SetAscent( rPortion.GetAscent() );
+/*N*/ nLineLength = 0;
+/*N*/ SetWhichPor( POR_KERN );
+/*N*/ if( nKern > 0 )
+/*N*/ Width( nKern );
+/*N*/ rPortion.Insert( this );
+/*N*/ }
+
+
+/*N*/ void SwKernPortion::Paint( const SwTxtPaintInfo &rInf ) const
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 if( Width() )
+/*N*/ }
+
+/*N*/ void SwKernPortion::FormatEOL( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if ( bGridKern )
+/*N*/ return;
+/*N*/
+/*N*/ if( rInf.GetLast() == this )
+/*N*/ rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
+/*N*/ if( nKern < 0 )
+/*N*/ Width( -nKern );
+/*N*/ else
+/*N*/ Width( 0 );
+/*N*/ rInf.GetLast()->FormatEOL( rInf );
+/*N*/ }
+
+/*N*/ SwArrowPortion::SwArrowPortion( const SwLinePortion &rPortion ) :
+/*N*/ bLeft( sal_True )
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 Height( rPortion.Height() );
+/*N*/ }
+
+/*N*/ void SwArrowPortion::Paint( const SwTxtPaintInfo &rInf ) const
+/*N*/ {
+/*N*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ((SwArrowPortion*)this)->aPos = rInf.GetPos();
+/*N*/ }
+
+/*N*/ SwLinePortion *SwArrowPortion::Compress() { return this; }
+
+/*N*/ SwTwips SwTxtFrm::EmptyHeight() const
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::EmptyHeight with swapped frame" );
+/*N*/
+/*N*/ SwFont *pFnt;
+/*N*/ const SwTxtNode& rTxtNode = *GetTxtNode();
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ if ( rTxtNode.HasSwAttrSet() )
+/*N*/ {
+/*N*/ const SwAttrSet *pAttrSet = &( rTxtNode.GetSwAttrSet() );
+/*N*/ pFnt = new SwFont( pAttrSet, GetTxtNode()->GetDoc() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwFontAccess aFontAccess( &rTxtNode.GetAnyFmtColl(), pSh);
+/*N*/ pFnt = new SwFont( *aFontAccess.Get()->GetFont() );
+/*N*/ pFnt->ChkMagic( pSh, pFnt->GetActual() );
+/*N*/ }
+/*N*/
+/*N*/ if ( IsVertical() )
+/*?*/ pFnt->SetVertical( 2700 );
+/*N*/
+/*N*/ OutputDevice *pOut = pSh ? pSh->GetOut() : 0;
+/*N*/ if ( !pOut || !rTxtNode.GetDoc()->IsBrowseMode() ||
+/*N*/ ( pSh->GetViewOptions()->IsPrtFormat() ) )
+/*N*/ {
+/*N*/ pOut = &rTxtNode.GetDoc()->GetRefDev();
+/*N*/ }
+/*N*/
+/*N*/ const SwDoc* pDoc = rTxtNode.GetDoc();
+ /*N*/ if( ::binfilter::IsShowChanges( pDoc->GetRedlineMode() ) )
+/*N*/ {
+/*N*/ MSHORT nRedlPos = pDoc->GetRedlinePos( rTxtNode );
+/*N*/ if( MSHRT_MAX != nRedlPos )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ SwAttrHandler aAttrHandler;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nRet;
+/*N*/ if( !pOut )
+/*?*/ nRet = IsVertical() ?
+/*?*/ Prt().SSize().Width() + 1 :
+/*?*/ Prt().SSize().Height() + 1;
+/*N*/ else
+/*N*/ {
+/*N*/ pFnt->SetFntChg( sal_True );
+/*N*/ pFnt->ChgPhysFnt( pSh, pOut );
+/*N*/ nRet = pFnt->GetHeight( pSh, pOut );
+/*N*/ }
+/*N*/ delete pFnt;
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::FormatEmpty()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::FormatEmpty()
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::FormatEmpty with swapped frame" );
+/*N*/
+/*N*/ if ( HasFollow() || GetTxtNode()->GetpSwpHints() ||
+/*N*/ 0 != GetTxtNode()->GetNumRule() ||
+/*N*/ 0 != GetTxtNode()->GetOutlineNum() ||
+/*N*/ IsInFtn() || ( HasPara() && GetPara()->IsPrepMustFit() ) )
+/*N*/ return sal_False;
+/*N*/ const SwAttrSet& aSet = GetTxtNode()->GetSwAttrSet();
+/*N*/ #ifdef BIDI
+/*N*/ const USHORT nAdjust = aSet.GetAdjust().GetAdjust();
+/*N*/ if( ( ( ! IsRightToLeft() && ( SVX_ADJUST_LEFT != nAdjust ) ) ||
+/*N*/ ( IsRightToLeft() && ( SVX_ADJUST_RIGHT != nAdjust ) ) ) ||
+/*N*/ aSet.GetRegister().GetValue() )
+/*N*/ #else
+/*N*/ if( SVX_ADJUST_LEFT != aSet.GetAdjust().GetAdjust()
+/*N*/ || aSet.GetRegister().GetValue() )
+/*N*/ #endif
+/*N*/ return sal_False;
+/*N*/ const SvxLineSpacingItem &rSpacing = aSet.GetLineSpacing();
+/*N*/ if( SVX_LINE_SPACE_MIN == rSpacing.GetLineSpaceRule() ||
+/*N*/ SVX_LINE_SPACE_FIX == rSpacing.GetLineSpaceRule() ||
+/*N*/ aSet.GetLRSpace().IsAutoFirst() )
+/*N*/ return sal_False;
+/*N*/ else
+/*N*/ {
+/*N*/ SwTxtFly aTxtFly( this );
+/*N*/ SwRect aRect;
+/*N*/ sal_Bool bFirstFlyCheck = 0 != Prt().Height();
+/*N*/ if ( bFirstFlyCheck &&
+/*N*/ aTxtFly.IsOn() && aTxtFly.IsAnyObj( aRect ) )
+/*N*/ return sal_False;
+/*N*/ else
+/*N*/ {
+/*N*/ SwTwips nHeight = EmptyHeight();
+/*N*/
+/*N*/ if ( GetTxtNode()->GetSwAttrSet().GetParaGrid().GetValue() &&
+/*N*/ IsInDocBody() )
+/*N*/ {
+/*N*/ GETGRID( FindPageFrm() )
+/*N*/ if ( pGrid )
+/*?*/ nHeight = pGrid->GetBaseHeight() + pGrid->GetRubyHeight();
+/*N*/ }
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ const SwTwips nChg = nHeight - (Prt().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ if( !nChg )
+/*N*/ SetUndersized( sal_False );
+/*N*/ AdjustFrm( nChg );
+/*N*/
+/*N*/ if( HasBlinkPor() )
+/*N*/ {
+/*?*/ ClearPara();
+/*?*/ ResetBlinkPor();
+/*N*/ }
+/*N*/ SetCacheIdx( MSHRT_MAX );
+/*N*/ if( !IsEmpty() )
+/*N*/ {
+/*N*/ SetEmpty( sal_True );
+/*N*/ SetCompletePaint();
+/*N*/ }
+/*N*/ if( !bFirstFlyCheck &&
+/*N*/ aTxtFly.IsOn() && aTxtFly.IsAnyObj( aRect ) )
+/*N*/ return sal_False;
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ sal_Bool SwTxtFrm::FillRegister( SwTwips& rRegStart, KSHORT& rRegDiff )
+/*N*/ {
+/*N*/ const SwFrm *pFrm = this;
+/*N*/ rRegDiff = 0;
+/*N*/ while( !( ( FRM_BODY | FRM_FLY )
+/*N*/ & pFrm->GetType() ) && pFrm->GetUpper() )
+/*N*/ pFrm = pFrm->GetUpper();
+/*N*/ if( ( FRM_BODY| FRM_FLY ) & pFrm->GetType() )
+/*N*/ {
+/*N*/ SWRECTFN( pFrm )
+/*N*/ rRegStart = (pFrm->*fnRect->fnGetPrtTop)();
+/*N*/ pFrm = pFrm->FindPageFrm();
+/*N*/ if( pFrm->IsPageFrm() )
+/*N*/ {
+/*N*/ SwPageDesc* pDesc = ((SwPageFrm*)pFrm)->FindPageDesc();
+/*N*/ if( pDesc )
+/*N*/ {
+/*N*/ rRegDiff = pDesc->GetRegHeight();
+/*N*/ if( !rRegDiff )
+/*N*/ {
+/*N*/ const SwTxtFmtColl *pFmt = pDesc->GetRegisterFmtColl();
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ const SvxLineSpacingItem &rSpace = pFmt->GetLineSpacing();
+/*N*/ if( SVX_LINE_SPACE_FIX == rSpace.GetLineSpaceRule() )
+/*N*/ {
+/*?*/ rRegDiff = rSpace.GetLineHeight();
+/*?*/ pDesc->SetRegHeight( rRegDiff );
+/*?*/ pDesc->SetRegAscent( ( 4 * rRegDiff ) / 5 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ViewShell *pSh = GetShell();
+/*N*/ SwFontAccess aFontAccess( pFmt, pSh );
+/*N*/ SwFont aFnt( *aFontAccess.Get()->GetFont() );
+/*N*/ OutputDevice *pOut = 0;
+/*N*/ if( !GetTxtNode()->GetDoc()->IsBrowseMode() ||
+/*N*/ (pSh && pSh->GetViewOptions()->IsPrtFormat()) )
+/*N*/ pOut = &GetTxtNode()->GetDoc()->GetRefDev();
+/*N*/ if( pSh && !pOut )
+/*?*/ pOut = pSh->GetWin();
+/*N*/ if( !pOut )
+/*?*/ pOut = GetpApp()->GetDefaultDevice();
+/*N*/ MapMode aOldMap( pOut->GetMapMode() );
+/*N*/ pOut->SetMapMode( MapMode( MAP_TWIP ) );
+/*N*/ aFnt.ChgFnt( pSh, pOut );
+/*N*/ rRegDiff = aFnt.GetHeight( pSh, pOut );
+/*N*/ KSHORT nNettoHeight = rRegDiff;
+/*N*/ switch( rSpace.GetLineSpaceRule() )
+/*N*/ {
+/*N*/ case SVX_LINE_SPACE_AUTO:
+/*N*/ break;
+/*N*/ case SVX_LINE_SPACE_MIN:
+/*N*/ {
+/*N*/ if( rRegDiff < KSHORT( rSpace.GetLineHeight() ) )
+/*N*/ rRegDiff = rSpace.GetLineHeight();
+/*N*/ break;
+/*N*/ }
+/*N*/ default: ASSERT(
+/*N*/ sal_False, ": unknown LineSpaceRule" );
+/*N*/ }
+/*N*/ switch( rSpace.GetInterLineSpaceRule() )
+/*N*/ {
+/*N*/ case SVX_INTER_LINE_SPACE_OFF:
+/*N*/ break;
+/*?*/ case SVX_INTER_LINE_SPACE_PROP:
+/*?*/ {
+/*?*/ long nTmp = rSpace.GetPropLineSpace();
+/*?*/ if( nTmp < 50 )
+/*?*/ nTmp = nTmp ? 50 : 100;
+/*?*/ nTmp *= rRegDiff;
+/*?*/ nTmp /= 100;
+/*?*/ if( !nTmp )
+/*?*/ ++nTmp;
+/*?*/ rRegDiff = (KSHORT)nTmp;
+/*?*/ nNettoHeight = rRegDiff;
+/*?*/ break;
+/*?*/ }
+/*?*/ case SVX_INTER_LINE_SPACE_FIX:
+/*?*/ {
+/*?*/ rRegDiff += rSpace.GetInterLineSpace();
+/*?*/ nNettoHeight = rRegDiff;
+/*?*/ break;
+/*?*/ }
+/*?*/ default: ASSERT( sal_False, ": unknown InterLineSpaceRule" );
+/*N*/ }
+/*N*/ pDesc->SetRegHeight( rRegDiff );
+/*N*/ pDesc->SetRegAscent( rRegDiff - nNettoHeight +
+/*N*/ aFnt.GetAscent( pSh, pOut ) );
+/*N*/ pOut->SetMapMode( aOldMap );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ const long nTmpDiff = pDesc->GetRegAscent() - rRegDiff;
+/*N*/ if ( bVert )
+/*?*/ rRegStart -= nTmpDiff;
+/*N*/ else
+/*N*/ rRegStart += nTmpDiff;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return ( 0 != rRegDiff );
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_portox.cxx b/binfilter/bf_sw/source/core/text/sw_portox.cxx
new file mode 100644
index 000000000000..bbee93f6a2c3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_portox.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include "portox.hxx"
+namespace binfilter {
+
+/*************************************************************************
+ * virtual SwToxPortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwIsoToxPortion
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwIsoToxPortion::Compress() { return this; }
+/*N*/
+/*N*/ SwIsoToxPortion::SwIsoToxPortion() : nViewWidth(0)
+/*N*/ {
+/*N*/ SetLen(1);
+/*N*/ SetWhichPor( POR_ISOTOX );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwIsoToxPortion::GetViewWidth()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwIsoToxPortion::Format()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwIsoToxPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ const sal_Bool bFull = SwLinePortion::Format( rInf );
+/*N*/ return bFull;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwIsoToxPortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwIsoToxPortion::HandlePortion()
+ *************************************************************************/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_portxt.cxx b/binfilter/bf_sw/source/core/text/sw_portxt.cxx
new file mode 100644
index 000000000000..61ad29f01086
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_portxt.cxx
@@ -0,0 +1,633 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <ctype.h>
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <inftxt.hxx>
+#include <guess.hxx> // SwTxtGuess, Zeilenumbruch
+
+#include <horiornt.hxx>
+
+#include <porfld.hxx> // SwFldPortion
+namespace binfilter {
+
+#if OSL_DEBUG_LEVEL > 1
+const sal_Char *GetLangName( const MSHORT nLang );
+#endif
+
+using namespace ::com::sun::star::i18n::ScriptType;
+
+/*************************************************************************
+ * lcl_AddSpace
+ * Returns for how many characters an extra space has to be added
+ * (for justified alignment).
+ *************************************************************************/
+
+/*N*/ USHORT lcl_AddSpace( const SwTxtSizeInfo &rInf, const XubString* pStr,
+/*N*/ const SwLinePortion& rPor )
+/*N*/ {
+/*N*/ xub_StrLen nPos, nEnd;
+/*N*/ const SwScriptInfo* pSI = 0;
+/*N*/
+/*N*/ if ( pStr )
+/*N*/ {
+/*N*/ // passing a string means we are inside a field
+/*?*/ nPos = 0;
+/*?*/ nEnd = pStr->Len();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nPos = rInf.GetIdx();
+/*N*/ nEnd = rInf.GetIdx() + rPor.GetLen();
+/*N*/ pStr = &rInf.GetTxt();
+/*N*/ pSI = &((SwParaPortion*)rInf.GetParaPortion())->GetScriptInfo();
+/*N*/ }
+/*N*/
+/*N*/ USHORT nCnt = 0;
+/*N*/ BYTE nScript = 0;
+/*N*/
+/*N*/ // If portion consists of Asian characters and language is not
+/*N*/ // Korean, we add extra space to each character.
+/*N*/ // first we get the script type
+/*N*/ if ( pSI )
+/*N*/ nScript = pSI->ScriptType( nPos );
+/*N*/ else if ( pBreakIt->xBreak.is() )
+/*?*/ nScript = (BYTE)pBreakIt->xBreak->getScriptType( *pStr, nPos );
+/*N*/
+/*N*/ // Note: rInf.GetIdx() can differ from nPos,
+/*N*/ // e.g., when rPor is a field portion. nPos referes to the string passed
+/*N*/ // to the function, rInf.GetIdx() referes to the original string.
+/*N*/
+/*N*/ // We try to find out which justification mode is required. This is done by
+/*N*/ // evaluating the script type and the language attribute set for this portion
+/*N*/
+/*N*/ // Asian Justification: Each character get some extra space
+/*N*/ if ( nEnd > nPos && ASIAN == nScript )
+/*N*/ {
+/*N*/ LanguageType aLang =
+/*N*/ rInf.GetTxtFrm()->GetTxtNode()->GetLang( rInf.GetIdx(), 1, nScript );
+/*N*/
+/*N*/ if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang )
+/*N*/ {
+/*N*/ const SwLinePortion* pPor = rPor.GetPortion();
+/*N*/ if ( pPor && pPor->IsKernPortion() )
+/*N*/ pPor = pPor->GetPortion();
+/*N*/
+/*N*/ nCnt += nEnd - nPos;
+/*N*/
+/*N*/ if ( !pPor || pPor->IsHolePortion() || pPor->InFixMargGrp() ||
+/*N*/ pPor->IsBreakPortion() )
+/*N*/ --nCnt;
+/*N*/
+/*N*/ return nCnt;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Thai Justification: Each character cell gets some extra space
+/*N*/ if ( nEnd > nPos && COMPLEX == nScript )
+/*N*/ {
+/*N*/ LanguageType aLang =
+/*N*/ rInf.GetTxtFrm()->GetTxtNode()->GetLang( rInf.GetIdx(), 1, nScript );
+/*N*/
+/*N*/ if ( LANGUAGE_THAI == aLang )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ nCnt = SwScriptInfo::ThaiJustify( *pStr, 0, 0, nPos, nEnd - nPos );
+/*?*/ return nCnt;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ #ifdef BIDI
+/*N*/ // Kashida Justification: Insert Kashidas
+/*N*/ if ( nEnd > nPos && pSI && COMPLEX == nScript )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ LanguageType aLang =
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ // Here starts the good old "Look for blanks and add space to them" part.
+/*N*/ // Note: We do not want to add space to an isolated latin blank in front
+/*N*/ // of some complex characters in RTL environment
+/*N*/ const sal_Bool bDoNotAddSpace =
+/*N*/ LATIN == nScript && ( nEnd == nPos + 1 ) && pSI &&
+/*N*/ ( ::com::sun::star::i18n::ScriptType::COMPLEX ==
+/*N*/ pSI->ScriptType( nPos + 1 ) ) &&
+/*N*/ rInf.GetTxtFrm() && rInf.GetTxtFrm()->IsRightToLeft();
+/*N*/
+/*N*/ if ( bDoNotAddSpace )
+/*N*/ return nCnt;
+/*N*/
+/*N*/ for ( ; nPos < nEnd; ++nPos )
+/*N*/ {
+/*N*/ if( CH_BLANK == pStr->GetChar( nPos ) )
+/*N*/ ++nCnt;
+/*N*/ }
+/*N*/
+/*N*/ // We still have to examine the next character:
+/*N*/ // If the next character is ASIAN and not KOREAN we have
+/*N*/ // to add an extra space
+/*N*/ // nPos referes to the original string, even if a field string has
+/*N*/ // been passed to this function
+/*N*/ nPos = rInf.GetIdx() + rPor.GetLen();
+/*N*/ if ( nPos < rInf.GetTxt().Len() )
+/*N*/ {
+/*N*/ BYTE nNextScript = 0;
+/*N*/ const SwLinePortion* pPor = rPor.GetPortion();
+/*N*/ if ( pPor && pPor->IsKernPortion() )
+/*?*/ pPor = pPor->GetPortion();
+/*N*/
+/*N*/ if ( ! pBreakIt->xBreak.is() || ! pPor || pPor->InFixMargGrp() )
+/*N*/ return nCnt;
+/*N*/
+/*N*/ // next character is inside a field?
+/*N*/ if ( CH_TXTATR_BREAKWORD == rInf.GetChar( nPos ) && pPor->InExpGrp() )
+/*N*/ {
+/*?*/ sal_Bool bOldOnWin = rInf.OnWin();
+/*?*/ ((SwTxtSizeInfo &)rInf).SetOnWin( sal_False );
+/*?*/
+/*?*/ XubString aStr( aEmptyStr );
+/*?*/ pPor->GetExpTxt( rInf, aStr );
+/*?*/ ((SwTxtSizeInfo &)rInf).SetOnWin( bOldOnWin );
+/*?*/
+/*?*/ nNextScript = (BYTE)pBreakIt->xBreak->getScriptType( aStr, 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ nNextScript = (BYTE)pBreakIt->xBreak->getScriptType( rInf.GetTxt(), nPos );
+/*N*/
+/*N*/ if( ASIAN == nNextScript )
+/*N*/ {
+/*?*/ LanguageType aLang =
+/*?*/ rInf.GetTxtFrm()->GetTxtNode()->GetLang( nPos, 1, nNextScript );
+/*?*/
+/*?*/ if ( LANGUAGE_KOREAN != aLang && LANGUAGE_KOREAN_JOHAB != aLang )
+/*?*/ ++nCnt;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return nCnt;
+/*N*/ }
+
+/*************************************************************************
+ * class SwTxtPortion
+ *************************************************************************/
+
+/*N*/ SwTxtPortion::SwTxtPortion( const SwLinePortion &rPortion )
+/*N*/ : SwLinePortion( rPortion )
+/*N*/ {
+/*N*/ SetWhichPor( POR_TXT );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtPortion::BreakCut()
+ *************************************************************************/
+
+/*N*/ void SwTxtPortion::BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess )
+/*N*/ {
+/*N*/ // Das Wort/Zeichen ist groesser als die Zeile
+/*N*/ // Sonderfall Nr.1: Das Wort ist groesser als die Zeile
+/*N*/ // Wir kappen...
+/*N*/ const KSHORT nLineWidth = (KSHORT)(rInf.Width() - rInf.X());
+/*N*/ xub_StrLen nLen = rGuess.CutPos() - rInf.GetIdx();
+/*N*/ if( nLen )
+/*N*/ {
+/*N*/ // special case: guess does not always provide the correct
+/*N*/ // width, only in common cases.
+/*N*/ if ( !rGuess.BreakWidth() )
+/*N*/ {
+/*N*/ rInf.SetLen( nLen );
+/*N*/ SetLen( nLen );
+/*N*/ CalcTxtSize( rInf );
+/*N*/
+/*N*/ // changing these values requires also changing them in
+/*N*/ // guess.cxx
+/*N*/ KSHORT nItalic = 0;
+/*N*/ if( ITALIC_NONE != rInf.GetFont()->GetItalic() && !rInf.NotEOL() )
+/*N*/ {
+/*N*/ #ifdef MAC
+/*N*/ nItalic = Height() / 4;
+/*N*/ #else
+/*N*/ nItalic = Height() / 12;
+/*N*/ #endif
+/*N*/ }
+/*N*/ Width( Width() + nItalic );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Width( rGuess.BreakWidth() );
+/*N*/ SetLen( nLen );
+/*N*/ }
+/*N*/ }
+/*N*/ // special case: first character does not fit to line
+/*N*/ else if ( rGuess.CutPos() == rInf.GetLineStart() )
+/*N*/ {
+/*N*/ SetLen( 1 );
+/*N*/ Width( nLineWidth );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SetLen( 0 );
+/*N*/ Width( 0 );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtPortion::BreakUnderflow()
+ *************************************************************************/
+
+/*N*/ void SwTxtPortion::BreakUnderflow( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ Truncate();
+/*N*/ Height( 0 );
+/*N*/ Width( 0 );
+/*N*/ SetLen( 0 );
+/*N*/ SetAscent( 0 );
+/*N*/ rInf.SetUnderFlow( this );
+/*N*/ }
+
+ /*************************************************************************
+ * SwTxtPortion::_Format()
+ *************************************************************************/
+
+/*N*/ sal_Bool lcl_HasContent( const SwFldPortion& rFld, SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ String aTxt;
+/*N*/ return rFld.GetExpTxt( rInf, aTxt ) && aTxt.Len();
+/*N*/ }
+
+/*M*/ sal_Bool SwTxtPortion::_Format( SwTxtFormatInfo &rInf )
+/*M*/ {
+/*M*/ // 5744: wenn nur der Trennstrich nicht mehr passt,
+/*M*/ // muss trotzdem das Wort umgebrochen werden, ansonsten return sal_True!
+/*M*/ if( rInf.IsUnderFlow() && rInf.GetSoftHyphPos() )
+/*M*/ {
+/*M*/ // soft hyphen portion has triggered an underflow event because
+/*M*/ // of an alternative spelling position
+/*M*/ sal_Bool bFull = sal_False;
+/*M*/ const sal_Bool bHyph = rInf.ChgHyph( sal_True );
+/*M*/ if( rInf.IsHyphenate() )
+/*M*/ {
+/*M*/ SwTxtGuess aGuess;
+/*M*/ // check for alternative spelling left from the soft hyphen
+/*M*/ // this should usually be true but
+/*M*/ aGuess.AlternativeSpelling( rInf, rInf.GetSoftHyphPos() - 1 );
+/*M*/ bFull = CreateHyphen( rInf, aGuess );
+/*M*/ ASSERT( bFull, "Problem with hyphenation!!!" );
+/*M*/ }
+/*M*/ rInf.ChgHyph( bHyph );
+/*M*/ rInf.SetSoftHyphPos( 0 );
+/*M*/ return bFull;
+/*M*/ }
+/*M*/
+/*M*/ SwTxtGuess aGuess;
+/*M*/ const sal_Bool bFull = !aGuess.Guess( *this, rInf, Height() );
+/*M*/
+/*M*/ // these are the possible cases:
+/*M*/ // A Portion fits to current line
+/*M*/ // B Portion does not fit to current line but a possible line break
+/*M*/ // within the portion has been found by the break iterator, 2 subcases
+/*M*/ // B1 break is hyphen
+/*M*/ // B2 break is word end
+/*M*/ // C Portion does not fit to current line and no possible line break
+/*M*/ // has been found by break iterator, 2 subcases:
+/*M*/ // C1 break iterator found a possible line break in portion before us
+/*M*/ // ==> this break is used (underflow)
+/*M*/ // C2 break iterator does not found a possible line break at all:
+/*M*/ // ==> line break
+/*M*/
+/*M*/ // case A: line not yet full
+/*M*/ if ( !bFull )
+/*M*/ {
+/*M*/ Width( aGuess.BreakWidth() );
+/*M*/ // Vorsicht !
+/*M*/ if( !InExpGrp() || InFldGrp() )
+/*M*/ SetLen( rInf.GetLen() );
+/*M*/
+/*M*/ short nKern = rInf.GetFont()->CheckKerning();
+/*M*/ if( nKern > 0 && rInf.Width() < rInf.X() + Width() + nKern )
+/*M*/ {
+/*N*/ nKern = rInf.Width() - rInf.X() - Width() - 1;
+/*M*/ if( nKern < 0 )
+/*M*/ nKern = 0;
+/*M*/ }
+/*M*/ if( nKern )
+/*M*/ new SwKernPortion( *this, nKern );
+/*M*/ }
+/*M*/ // special case: hanging portion
+/*M*/ else if( bFull && aGuess.GetHangingPortion() )
+/*M*/ {
+/*M*/ Width( aGuess.BreakWidth() );
+/*M*/ SetLen( aGuess.BreakPos() - rInf.GetIdx() );
+/*M*/ Insert( aGuess.GetHangingPortion() );
+/*M*/ aGuess.GetHangingPortion()->SetAscent( GetAscent() );
+/*M*/ aGuess.ClearHangingPortion();
+/*M*/ }
+/*M*/ // breakPos >= index
+/*M*/ else if ( aGuess.BreakPos() >= rInf.GetIdx() && aGuess.BreakPos() != STRING_LEN )
+/*M*/ {
+/*M*/ // case B1
+/*N*/ if( aGuess.HyphWord().is() && aGuess.BreakPos() > rInf.GetLineStart()
+/*N*/ && ( aGuess.BreakPos() > rInf.GetIdx() ||
+/*M*/ ( rInf.GetLast() && ! rInf.GetLast()->IsFlyPortion() ) ) )
+/*M*/ {
+/*M*/ CreateHyphen( rInf, aGuess );
+/*M*/ if ( rInf.GetFly() )
+/*M*/ rInf.GetRoot()->SetMidHyph( sal_True );
+/*M*/ else
+/*M*/ rInf.GetRoot()->SetEndHyph( sal_True );
+/*M*/ }
+/*M*/ // case C1
+/*M*/ else if ( IsFtnPortion() && rInf.IsFakeLineStart() )
+/*M*/ BreakUnderflow( rInf );
+/*M*/ // case B2
+/*M*/ else if( rInf.GetIdx() > rInf.GetLineStart() ||
+/*M*/ aGuess.BreakPos() > rInf.GetIdx() ||
+/*M*/ // this is weird: during formatting the follow of a field
+/*M*/ // the values rInf.GetIdx and rInf.GetLineStart are replaced
+/*M*/ // IsFakeLineStart indicates GetIdx > GetLineStart
+/*M*/ rInf.IsFakeLineStart() ||
+/*M*/ rInf.GetFly() ||
+/*M*/ rInf.IsFirstMulti() ||
+/*M*/ ( rInf.GetLast() &&
+/*M*/ ( rInf.GetLast()->IsFlyPortion() ||
+/*M*/ ( rInf.GetLast()->InFldGrp() &&
+/*M*/ ! rInf.GetLast()->InNumberGrp() &&
+/*M*/ ! rInf.GetLast()->IsErgoSumPortion() &&
+/*M*/ lcl_HasContent(*((SwFldPortion*)rInf.GetLast()),rInf ) ) ) ) )
+/*M*/ {
+/*M*/ if ( rInf.X() + aGuess.BreakWidth() <= rInf.Width() )
+/*M*/ Width( aGuess.BreakWidth() );
+/*M*/ else
+/*M*/ // this actually should not happen
+/*M*/ Width( KSHORT(rInf.Width() - rInf.X()) );
+/*M*/
+/*M*/ SetLen( aGuess.BreakPos() - rInf.GetIdx() );
+/*M*/
+/*M*/ ASSERT( aGuess.BreakStart() >= aGuess.FieldDiff(),
+/*M*/ "Trouble with expanded field portions during line break" );
+/*M*/ const xub_StrLen nRealStart = aGuess.BreakStart() - aGuess.FieldDiff();
+/*N*/ if( aGuess.BreakPos() < nRealStart && !InExpGrp() )
+/*M*/ {
+/*M*/ SwHolePortion *pNew = new SwHolePortion( *this );
+/*M*/ pNew->SetLen( nRealStart - aGuess.BreakPos() );
+/*M*/ Insert( pNew );
+/*M*/ }
+/*M*/ }
+/*M*/ else // case C2, last exit
+/*M*/ BreakCut( rInf, aGuess );
+/*M*/ }
+/*M*/ // breakPos < index or no breakpos at all
+/*M*/ else
+/*M*/ {
+/*M*/ sal_Bool bFirstPor = rInf.GetLineStart() == rInf.GetIdx();
+/*M*/ if( aGuess.BreakPos() != STRING_LEN &&
+/*M*/ aGuess.BreakPos() != rInf.GetLineStart() &&
+/*M*/ ( !bFirstPor || rInf.GetFly() || rInf.GetLast()->IsFlyPortion() ||
+/*M*/ rInf.IsFirstMulti() ) &&
+/*M*/ ( !rInf.GetLast()->IsBlankPortion() || ((SwBlankPortion*)
+/*M*/ rInf.GetLast())->MayUnderFlow( rInf, rInf.GetIdx()-1, sal_True )))
+/*M*/ { // case C1 (former BreakUnderflow())
+/*M*/ BreakUnderflow( rInf );
+/*M*/ }
+/*M*/ else
+/*M*/ // case C2, last exit
+/*M*/ BreakCut( rInf, aGuess );
+/*M*/ }
+/*M*/
+/*M*/ return bFull;
+/*M*/ }
+
+/*************************************************************************
+ * virtual SwTxtPortion::Format()
+ *************************************************************************/
+
+
+
+/*N*/ sal_Bool SwTxtPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ const XubString aDbgTxt( rInf.GetTxt().Copy( rInf.GetIdx(), rInf.GetLen() ) );
+/*N*/ #endif
+/*N*/
+/*N*/ if( rInf.X() > rInf.Width() || (!GetLen() && !InExpGrp()) )
+/*N*/ {
+/*N*/ Height( 0 );
+/*N*/ Width( 0 );
+/*N*/ SetLen( 0 );
+/*N*/ SetAscent( 0 );
+/*N*/ SetPortion( NULL ); // ????
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( rInf.RealWidth() || (rInf.X() == rInf.Width()),
+/*N*/ "SwTxtPortion::Format: missing real width" );
+/*N*/ ASSERT( Height(), "SwTxtPortion::Format: missing height" );
+/*N*/
+/*N*/ return _Format( rInf );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwTxtPortion::FormatEOL()
+ *************************************************************************/
+
+// Format end of line
+// 5083: Es kann schon manchmal unguenstige Faelle geben...
+// "vom {Nikolaus}", Nikolaus bricht um "vom " wird im Blocksatz
+// zu "vom" und " ", wobei der Glue expandiert wird, statt in die
+// MarginPortion aufzugehen.
+// rInf.nIdx steht auf dem naechsten Wort, nIdx-1 ist der letzte
+// Buchstabe der Portion.
+
+
+
+/*N*/ void SwTxtPortion::FormatEOL( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ #ifndef USED
+/*N*/ if( ( !GetPortion() || ( GetPortion()->IsKernPortion() &&
+/*N*/ !GetPortion()->GetPortion() ) ) && GetLen() &&
+/*N*/ rInf.GetIdx() < rInf.GetTxt().Len() &&
+/*N*/ 1 < rInf.GetIdx() && ' ' == rInf.GetChar( rInf.GetIdx() - 1 )
+/*N*/ #else
+/*N*/ if( !GetPortion() && 1 < GetLen() &&
+/*N*/ rInf.GetIdx() < rInf.GetTxt().Len() &&
+/*N*/ 1 < rInf.GetIdx() && ' ' == rInf.GetTxt()[xub_StrLen(rInf.GetIdx()-1)]
+/*N*/ && !rInf.GetFly()
+/*N*/ #endif
+/*N*/
+/*N*/ && !rInf.GetLast()->IsHolePortion() )
+/*N*/ {
+/*N*/ // calculate number of blanks
+/*?*/ xub_StrLen nX = rInf.GetIdx() - 1;
+/*?*/ USHORT nHoleLen = 1;
+/*?*/ while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
+/*?*/ nHoleLen++;
+/*?*/
+/*?*/ // Erst uns einstellen und dann Inserten, weil wir ja auch ein
+/*?*/ // SwLineLayout sein koennten.
+/*?*/ KSHORT nBlankSize;
+/*?*/ if( nHoleLen == GetLen() )
+/*?*/ nBlankSize = Width();
+/*?*/ else
+/*?*/ nBlankSize = nHoleLen * rInf.GetTxtSize( ' ' ).Width();
+/*?*/ Width( Width() - nBlankSize );
+/*?*/ rInf.X( rInf.X() - nBlankSize );
+/*?*/ SetLen( GetLen() - nHoleLen );
+/*?*/ SwLinePortion *pHole = new SwHolePortion( *this );
+/*?*/ ( (SwHolePortion *)pHole )->SetBlankWidth( nBlankSize );
+/*?*/ ( (SwHolePortion *)pHole )->SetLen( nHoleLen );
+/*?*/ Insert( pHole );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwTxtPortion::GetCrsrOfst()
+ *************************************************************************/
+
+
+
+
+/*************************************************************************
+ * SwTxtPortion::GetCrsrOfst()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwTxtPortion::GetTxtSize()
+ *************************************************************************/
+// Das GetTxtSize() geht davon aus, dass die eigene Laenge korrekt ist
+
+/*N*/ SwPosSize SwTxtPortion::GetTxtSize( const SwTxtSizeInfo &rInf ) const
+/*N*/ {
+/*N*/ return rInf.GetTxtSize();
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwTxtPortion::Paint()
+ *************************************************************************/
+
+
+
+
+/*************************************************************************
+ * virtual SwTxtPortion::GetExpTxt()
+ *************************************************************************/
+
+
+
+/*N*/ sal_Bool SwTxtPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const
+/*N*/ {
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * xub_StrLen SwTxtPortion::GetSpaceCnt()
+ * long SwTxtPortion::CalcSpacing()
+ * sind fuer den Blocksatz zustaendig und ermitteln die Anzahl der Blanks
+ * und den daraus resultierenden zusaetzlichen Zwischenraum
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwTxtPortion::GetSpaceCnt( const SwTxtSizeInfo &rInf,
+/*N*/ xub_StrLen& rCharCnt ) const
+/*N*/ {
+/*N*/ xub_StrLen nCnt = 0;
+/*N*/ xub_StrLen nPos = 0;
+/*N*/ if ( InExpGrp() )
+/*N*/ {
+/*?*/ if( !IsBlankPortion() && !InNumberGrp() && !IsCombinedPortion() )
+/*?*/ {
+/*?*/ // Bei OnWin() wird anstatt eines Leerstrings gern mal ein Blank
+/*?*/ // zurueckgeliefert, das koennen wir hier aber gar nicht gebrauchen
+/*?*/ sal_Bool bOldOnWin = rInf.OnWin();
+/*?*/ ((SwTxtSizeInfo &)rInf).SetOnWin( sal_False );
+/*?*/
+/*?*/ XubString aStr( aEmptyStr );
+/*?*/ GetExpTxt( rInf, aStr );
+/*?*/ ((SwTxtSizeInfo &)rInf).SetOnWin( bOldOnWin );
+/*?*/
+/*?*/ nCnt += lcl_AddSpace( rInf, &aStr, *this );
+/*?*/ nPos = aStr.Len();
+/*?*/ }
+/*N*/ }
+/*N*/ else if( !IsDropPortion() )
+/*N*/ {
+/*N*/ nCnt += lcl_AddSpace( rInf, 0, *this );
+/*N*/ nPos = GetLen();
+/*N*/ }
+/*N*/ rCharCnt += nPos;
+/*N*/ return nCnt;
+/*N*/ }
+
+
+/*************************************************************************
+ * virtual SwTxtPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwHolePortion
+ *************************************************************************/
+
+
+
+/*N*/ SwHolePortion::SwHolePortion( const SwTxtPortion &rPor )
+/*N*/ : nBlankWidth( 0 )
+/*N*/ {
+/*N*/ SetLen( 1 );
+/*N*/ Height( rPor.Height() );
+/*N*/ SetAscent( rPor.GetAscent() );
+/*N*/ SetWhichPor( POR_HOLE );
+/*N*/ }
+
+/*N*/ SwLinePortion *SwHolePortion::Compress() { return this; }
+
+/*************************************************************************
+ * virtual SwHolePortion::Paint()
+ *************************************************************************/
+
+
+
+
+/*************************************************************************
+ * virtual SwHolePortion::Format()
+ *************************************************************************/
+
+
+
+
+/*************************************************************************
+ * virtual SwHolePortion::HandlePortion()
+ *************************************************************************/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_redlnitr.cxx b/binfilter/bf_sw/source/core/text/sw_redlnitr.cxx
new file mode 100644
index 000000000000..ab555414dcb0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_redlnitr.cxx
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+
+
+#include <errhdl.hxx>
+
+#include <itratr.hxx> // SwAttrIter
+#include <ndtxt.hxx> // SwTxtNode
+
+#include <horiornt.hxx>
+
+#include <doc.hxx> // SwDoc
+#include <frmsh.hxx>
+#include <breakit.hxx>
+
+//////////////////////////
+
+
+
+#include <txtfrm.hxx> // SwTxtFrm
+#include <redlnitr.hxx>
+#include <extinput.hxx>
+
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+extern BYTE WhichFont( xub_StrLen nIdx, const String* pTxt,
+ const SwScriptInfo* pSI );
+
+/*************************************************************************
+ * SwAttrIter::CtorInit()
+ *************************************************************************/
+/*N*/ void SwAttrIter::CtorInit( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm )
+/*N*/ {
+/*N*/ // Beim HTML-Import kann es vorkommen, dass kein Layout existiert.
+/*N*/ SwRootFrm *pRootFrm = rTxtNode.GetDoc()->GetRootFrm();
+/*N*/ pShell = pRootFrm ? pRootFrm->GetShell() : 0;
+/*N*/
+/*N*/ pScriptInfo = &rScrInf;
+/*N*/ pAttrSet = &rTxtNode.GetSwAttrSet();
+/*N*/ pHints = rTxtNode.GetpSwpHints();
+/*N*/
+/*N*/ SwFontAccess aFontAccess( &rTxtNode.GetAnyFmtColl(), pShell );
+/*N*/
+/*N*/ delete pFnt;
+/*N*/ pFnt = new SwFont( *aFontAccess.Get()->GetFont() );
+/*N*/
+/*N*/ // set font to vertical if frame layout is vertical
+/*N*/ sal_Bool bVertLayout = sal_False;
+/*N*/ sal_Bool bRTL = sal_False;
+/*N*/ if ( pFrm )
+/*N*/ {
+/*N*/ if ( pFrm->IsVertical() )
+/*N*/ {
+/*N*/ bVertLayout = sal_True;
+/*N*/ pFnt->SetVertical( pFnt->GetOrientation(), sal_True );
+/*N*/ }
+/*N*/ bRTL = pFrm->IsRightToLeft();
+/*N*/ }
+/*N*/
+/*N*/ // Initialize the default attribute of the attribute handler
+/*N*/ // based on the attribute array cached together with the font.
+/*N*/ // If any further attributes for the paragraph are given in pAttrSet
+/*N*/ // consider them during construction of the default array, and apply
+/*N*/ // them to the font
+/*N*/ aAttrHandler.Init( aFontAccess.Get()->GetDefault(),
+/*N*/ rTxtNode.HasSwAttrSet() ? pAttrSet : 0,
+/*N*/ *rTxtNode.GetDoc(), pShell, *pFnt, bVertLayout );
+/*N*/
+/*N*/ aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = NULL;
+/*N*/
+/*N*/ // determine script changes if not already done for current paragraph
+/*N*/ ASSERT( pScriptInfo, "No script info available");
+/*N*/ if ( pScriptInfo->GetInvalidity() != STRING_LEN )
+/*N*/ pScriptInfo->InitScriptInfo( rTxtNode, bRTL );
+/*N*/
+/*N*/ if ( pBreakIt->xBreak.is() )
+/*N*/ {
+/*N*/ pFnt->SetActual( WhichFont( 0, 0, pScriptInfo ) );
+/*N*/
+/*N*/ xub_StrLen nChg = 0;
+/*N*/ USHORT nCnt = 0;
+/*N*/
+/*N*/ do
+/*N*/ {
+/*N*/ nChg = pScriptInfo->GetScriptChg( nCnt );
+/*N*/ USHORT nScript = pScriptInfo->GetScriptType( nCnt++ );
+/*N*/ BYTE nTmp = 4;
+/*N*/ switch ( nScript ) {
+/*N*/ case i18n::ScriptType::ASIAN :
+/*N*/ if( !aMagicNo[SW_CJK] ) nTmp = SW_CJK; break;
+/*N*/ case i18n::ScriptType::COMPLEX :
+/*N*/ if( !aMagicNo[SW_CTL] ) nTmp = SW_CTL; break;
+/*N*/ default:
+/*N*/ if( !aMagicNo[SW_LATIN ] ) nTmp = SW_LATIN;
+/*N*/ }
+/*N*/ if( nTmp < 4 )
+/*N*/ {
+/*N*/ pFnt->ChkMagic( pShell, nTmp );
+/*N*/ pFnt->GetMagic( aMagicNo[ nTmp ], aFntIdx[ nTmp ], nTmp );
+/*N*/ }
+/*N*/ } while( nChg < rTxtNode.GetTxt().Len() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pFnt->ChkMagic( pShell, SW_LATIN );
+/*N*/ pFnt->GetMagic( aMagicNo[ SW_LATIN ], aFntIdx[ SW_LATIN ], SW_LATIN );
+/*N*/ }
+/*N*/
+/*N*/ nStartIndex = nEndIndex = nPos = nChgCnt = 0;
+/*N*/ nPropFont = 0;
+/*N*/ SwDoc* pDoc = rTxtNode.GetDoc();
+/*N*/
+/*N*/ const SwExtTextInput* pExtInp = pDoc->GetExtTextInput( rTxtNode );
+/*N*/ sal_Bool bShow = ::binfilter::IsShowChanges( pDoc->GetRedlineMode() );
+/*N*/ if( pExtInp || bShow )
+/*N*/ {
+/*N*/ MSHORT nRedlPos = pDoc->GetRedlinePos( rTxtNode );
+/*N*/ if( pExtInp || MSHRT_MAX != nRedlPos )
+/*N*/ {
+/*N*/ const SvUShorts* pArr = 0;
+/*N*/ xub_StrLen nInputStt = 0;
+/*N*/ if( pExtInp )
+/*N*/ {
+/*N*/ pArr = &pExtInp->GetAttrs();
+/*N*/ nInputStt = pExtInp->Start()->nContent.GetIndex();
+/*N*/ Seek( 0 );
+/*N*/ }
+/*N*/
+/*N*/ pRedln = new SwRedlineItr( rTxtNode, *pFnt, aAttrHandler, nRedlPos,
+/*N*/ bShow, pArr, nInputStt );
+/*N*/
+/*N*/ if( pRedln->IsOn() )
+/*N*/ ++nChgCnt;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwRedlineItr - Der Redline-Iterator
+ *
+ * Folgende Informationen/Zustaende gibt es im RedlineIterator:
+ *
+ * nFirst ist der erste Index der RedlineTbl, der mit dem Absatz ueberlappt.
+ *
+ * nAct ist der zur Zeit aktive ( wenn bOn gesetzt ist ) oder der naechste
+ * in Frage kommende Index.
+ * nStart und nEnd geben die Grenzen des Objekts innerhalb des Absatzes an.
+ *
+ * Wenn bOn gesetzt ist, ist der Font entsprechend manipuliert worden.
+ *
+ * Wenn nAct auf MSHRT_MAX gesetzt wurde ( durch Reset() ), so ist zur Zeit
+ * kein Redline aktiv, nStart und nEnd sind invalid.
+ *************************************************************************/
+
+
+
+// Der Return-Wert von SwRedlineItr::Seek gibt an, ob der aktuelle Font
+// veraendert wurde durch Verlassen (-1) oder Betreten eines Bereichs (+1)
+
+
+
+
+
+
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtcache.cxx b/binfilter/bf_sw/source/core/text/sw_txtcache.cxx
new file mode 100644
index 000000000000..67822796b6a3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtcache.cxx
@@ -0,0 +1,244 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "txtcache.hxx"
+#include "txtfrm.hxx"
+#include "porlay.hxx"
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* SwTxtLine::SwTxtLine(), ~SwTxtLine()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 16. Mar. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwTxtLine::SwTxtLine( SwTxtFrm *pFrm, SwParaPortion *pNew ) :
+/*N*/ SwCacheObj( (void*)pFrm ),
+/*N*/ pLine( pNew )
+/*N*/ {
+/*N*/ }
+/*N*/
+/*N*/ SwTxtLine::~SwTxtLine()
+/*N*/ {
+/*N*/ delete pLine;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTxtLineAccess::NewObj()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 16. Mar. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwCacheObj *SwTxtLineAccess::NewObj()
+/*N*/ {
+/*N*/ return new SwTxtLine( (SwTxtFrm*)pOwner );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTxtLineAccess::GetPara()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 16. Mar. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwParaPortion *SwTxtLineAccess::GetPara()
+/*N*/ {
+/*N*/ SwTxtLine *pRet;
+/*N*/ if ( pObj )
+/*N*/ pRet = (SwTxtLine*)pObj;
+/*N*/ else
+/*N*/ {
+/*N*/ pRet = (SwTxtLine*)Get();
+/*N*/ ((SwTxtFrm*)pOwner)->SetCacheIdx( pRet->GetCachePos() );
+/*N*/ }
+/*N*/ if ( !pRet->GetPara() )
+/*N*/ pRet->SetPara( new SwParaPortion );
+/*N*/ return pRet->GetPara();
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwTxtLineAccess::SwTxtLineAccess()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 16. Mar. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwTxtLineAccess::SwTxtLineAccess( const SwTxtFrm *pOwner ) :
+/*N*/ SwCacheAccess( *SwTxtFrm::GetTxtCache(), pOwner, pOwner->GetCacheIdx() )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTxtLineAccess::IsAvailable
+|*
+|* Ersterstellung MA 23. Mar. 94
+|* Letzte Aenderung MA 23. Mar. 94
+|*
+|*************************************************************************/
+
+/*N*/ sal_Bool SwTxtLineAccess::IsAvailable() const
+/*N*/ {
+/*N*/ if ( pObj )
+/*N*/ return ((SwTxtLine*)pObj)->GetPara() != 0;
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTxtFrm::HasPara()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 22. Aug. 94
+|*
+|*************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::_HasPara() const
+/*N*/ {
+/*N*/ SwTxtLine *pTxtLine = (SwTxtLine*)SwTxtFrm::GetTxtCache()->
+/*N*/ Get( this, GetCacheIdx(), sal_False );
+/*N*/ if ( pTxtLine )
+/*N*/ {
+/*N*/ if ( pTxtLine->GetPara() )
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ ((SwTxtFrm*)this)->nCacheIdx = MSHRT_MAX;
+/*N*/
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTxtFrm::GetPara()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 22. Aug. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwParaPortion *SwTxtFrm::GetPara()
+/*N*/ {
+/*N*/ if ( GetCacheIdx() != MSHRT_MAX )
+/*N*/ { SwTxtLine *pLine = (SwTxtLine*)SwTxtFrm::GetTxtCache()->
+/*N*/ Get( this, GetCacheIdx(), sal_False );
+/*N*/ if ( pLine )
+/*N*/ return pLine->GetPara();
+/*N*/ else
+/*N*/ nCacheIdx = MSHRT_MAX;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwTxtFrm::ClearPara()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 22. Aug. 94
+|*
+|*************************************************************************/
+
+/*N*/ void SwTxtFrm::ClearPara()
+/*N*/ {
+/*N*/ ASSERT( !IsLocked(), "+SwTxtFrm::ClearPara: this is locked." );
+/*N*/ if ( !IsLocked() && GetCacheIdx() != MSHRT_MAX )
+/*N*/ {
+/*N*/ SwTxtLine *pTxtLine = (SwTxtLine*)SwTxtFrm::GetTxtCache()->
+/*N*/ Get( this, GetCacheIdx(), sal_False );
+/*N*/ if ( pTxtLine )
+/*N*/ {
+/*N*/ delete pTxtLine->GetPara();
+/*N*/ pTxtLine->SetPara( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ nCacheIdx = MSHRT_MAX;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTxtFrm::SetPara()
+|*
+|* Ersterstellung MA 16. Mar. 94
+|* Letzte Aenderung MA 22. Aug. 94
+|*
+|*************************************************************************/
+
+/*N*/ void SwTxtFrm::SetPara( SwParaPortion *pNew, sal_Bool bDelete )
+/*N*/ {
+/*N*/ if ( GetCacheIdx() != MSHRT_MAX )
+/*N*/ {
+/*N*/ //Nur die Information Auswechseln, das CacheObj bleibt stehen.
+/*N*/ SwTxtLine *pTxtLine = (SwTxtLine*)SwTxtFrm::GetTxtCache()->
+/*N*/ Get( this, GetCacheIdx(), sal_False );
+/*N*/ if ( pTxtLine )
+/*N*/ {
+/*N*/ if( bDelete )
+/*N*/ delete pTxtLine->GetPara();
+/*N*/ pTxtLine->SetPara( pNew );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( !pNew, "+SetPara: Losing SwParaPortion" );
+/*?*/ nCacheIdx = MSHRT_MAX;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( pNew )
+/*N*/ { //Einen neuen einfuegen.
+/*N*/ SwTxtLine *pTxtLine = new SwTxtLine( this, pNew );
+/*N*/ if ( SwTxtFrm::GetTxtCache()->Insert( pTxtLine ) )
+/*N*/ nCacheIdx = pTxtLine->GetCachePos();
+/*N*/ else
+/*N*/ {
+/*?*/ ASSERT( sal_False, "+SetPara: InsertCache failed." );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtdrop.cxx b/binfilter/bf_sw/source/core/text/sw_txtdrop.cxx
new file mode 100644
index 000000000000..d3c8bc39a784
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtdrop.cxx
@@ -0,0 +1,346 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <vcl/metric.hxx>
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+
+#include <paratr.hxx>
+#include <charfmt.hxx>
+#include <viewsh.hxx> // ViewShell
+#include <pordrop.hxx>
+#include <itrform2.hxx>
+#include <breakit.hxx>
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <bf_svx/langitem.hxx>
+#include <charatr.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star;
+
+/*************************************************************************
+ * SwDropPortionPart DTor
+ *************************************************************************/
+
+/*N*/ SwDropPortionPart::~SwDropPortionPart()
+/*N*/ {
+/*N*/ if ( pFollow )
+/*N*/ delete pFollow;
+/*N*/ delete pFnt;
+/*N*/ }
+
+/*************************************************************************
+ * SwDropPortion CTor, DTor
+ *************************************************************************/
+
+/*N*/ SwDropPortion::SwDropPortion( const MSHORT nLineCnt,
+/*N*/ const KSHORT nDropHeight,
+/*N*/ const KSHORT nDropDescent,
+/*N*/ const KSHORT nDistance )
+/*N*/ : pPart( 0 ),
+/*N*/ nLines( nLineCnt ),
+/*N*/ nDropHeight(nDropHeight),
+/*N*/ nDropDescent(nDropDescent),
+/*N*/ nDistance(nDistance),
+/*N*/ nX(0),
+/*N*/ nFix(0)
+/*N*/ {
+/*N*/ SetWhichPor( POR_DROP );
+/*N*/ }
+
+/*N*/ SwDropPortion::~SwDropPortion()
+/*N*/ {
+/*N*/ delete pPart;
+/*N*/ }
+
+/*N*/ sal_Bool SwTxtSizeInfo::_HasHint( const SwTxtNode* pTxtNode, xub_StrLen nPos )
+/*N*/ {
+/*N*/ const SwpHints *pHints = pTxtNode->GetpSwpHints();
+/*N*/ if( !pHints )
+/*N*/ return sal_False;
+/*N*/ for( MSHORT i = 0; i < pHints->Count(); ++i )
+/*N*/ {
+/*N*/ const SwTxtAttr *pPos = (*pHints)[i];
+/*N*/ xub_StrLen nStart = *pPos->GetStart();
+/*N*/ if( nPos < nStart )
+/*N*/ return sal_False;
+/*N*/ if( nPos == nStart && !pPos->GetEnd() )
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtNode::GetDropLen()
+ *
+ * nWishLen = 0 indicates that we want a whole word
+ *************************************************************************/
+
+/*N*/ MSHORT SwTxtNode::GetDropLen( MSHORT nWishLen ) const
+/*N*/ {
+/*N*/ xub_StrLen nEnd = GetTxt().Len();
+/*N*/ if( nWishLen && nWishLen < nEnd )
+/*N*/ nEnd = nWishLen;
+/*N*/
+/*N*/ if ( ! nWishLen && pBreakIt->xBreak.is() )
+/*N*/ {
+/*N*/ // find first word
+/*?*/ const SwAttrSet& rAttrSet = GetSwAttrSet();
+/*?*/ const USHORT nTxtScript = pBreakIt->GetRealScriptOfText( GetTxt(), 0 );
+/*?*/
+/*?*/ LanguageType eLanguage;
+/*?*/
+/*?*/ switch ( nTxtScript )
+/*?*/ {
+/*?*/ case i18n::ScriptType::ASIAN :
+/*?*/ eLanguage = rAttrSet.GetCJKLanguage().GetLanguage();
+/*?*/ break;
+/*?*/ case i18n::ScriptType::COMPLEX :
+/*?*/ eLanguage = rAttrSet.GetCTLLanguage().GetLanguage();
+/*?*/ break;
+/*?*/ default :
+/*?*/ eLanguage = rAttrSet.GetLanguage().GetLanguage();
+/*?*/ break;
+/*?*/ }
+/*?*/
+/*?*/ Boundary aBound =
+/*?*/ pBreakIt->xBreak->getWordBoundary( GetTxt(), 0,
+/*?*/ pBreakIt->GetLocale( eLanguage ), WordType::DICTIONARY_WORD, sal_True );
+/*?*/
+/*?*/ nEnd = (xub_StrLen)aBound.endPos;
+/*N*/ }
+/*N*/
+/*N*/ xub_StrLen i = 0;
+/*N*/ for( ; i < nEnd; ++i )
+/*N*/ {
+/*N*/ xub_Unicode cChar = GetTxt().GetChar( i );
+/*N*/ if( CH_TAB == cChar || CH_BREAK == cChar ||
+/*N*/ (( CH_TXTATR_BREAKWORD == cChar || CH_TXTATR_INWORD == cChar )
+/*N*/ && SwTxtSizeInfo::_HasHint( this, i ) ) )
+/*N*/ break;
+/*N*/ }
+/*N*/ return i;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcDropHeight()
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::CalcDropHeight( const MSHORT nLines )
+/*N*/ {
+/*N*/ const SwLinePortion *const pOldCurr = GetCurr();
+/*N*/ KSHORT nDropHght = 0;
+/*N*/ KSHORT nAscent = 0;
+/*N*/ KSHORT nHeight = 0;
+/*N*/ KSHORT nDropLns = 0;
+/*N*/ sal_Bool bRegisterOld = IsRegisterOn();
+/*N*/ bRegisterOn = sal_False;
+/*N*/
+/*N*/ Top();
+/*N*/
+/*N*/ while( GetCurr()->IsDummy() )
+/*N*/ {
+/*N*/ if ( !Next() )
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ // Wenn wir nur eine Zeile haben returnen wir 0
+/*N*/ if( GetNext() || GetDropLines() == 1 )
+/*N*/ {
+/*N*/ for( ; nDropLns < nLines; nDropLns++ )
+/*N*/ {
+/*N*/ if ( GetCurr()->IsDummy() )
+/*N*/ break;
+/*N*/ else
+/*N*/ {
+/*N*/ CalcAscentAndHeight( nAscent, nHeight );
+/*N*/ nDropHght += nHeight;
+/*N*/ bRegisterOn = bRegisterOld;
+/*N*/ }
+/*N*/ if ( !Next() )
+/*N*/ {
+/*N*/ nDropLns++; // Fix: 11356
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // In der letzten Zeile plumpsen wir auf den Zeilenascent!
+/*N*/ nDropHght -= nHeight;
+/*N*/ nDropHght += nAscent;
+/*N*/ Top();
+/*N*/ }
+/*N*/ bRegisterOn = bRegisterOld;
+/*N*/ SetDropDescent( nHeight - nAscent );
+/*N*/ SetDropHeight( nDropHght );
+/*N*/ SetDropLines( nDropLns );
+/*N*/ // Alte Stelle wiederfinden!
+/*N*/ while( pOldCurr != GetCurr() )
+/*N*/ {
+/*N*/ if( !Next() )
+/*N*/ {
+/*N*/ ASSERT( !this, "SwTxtFormatter::_CalcDropHeight: left Toulouse" );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::GuessDropHeight()
+ *
+ * Wir schaetzen mal, dass die Fonthoehe sich nicht aendert und dass
+ * erst mindestens soviele Zeilen gibt, wie die DropCap-Einstellung angibt.
+ *
+ *************************************************************************/
+
+
+
+/*N*/ void SwTxtFormatter::GuessDropHeight( const MSHORT nLines )
+/*N*/ {
+/*N*/ ASSERT( nLines, "GuessDropHeight: Give me more Lines!" );
+/*N*/ KSHORT nAscent = 0;
+/*N*/ KSHORT nHeight = 0;
+/*N*/ SetDropLines( nLines );
+/*N*/ if ( GetDropLines() > 1 )
+/*N*/ {
+/*N*/ CalcRealHeight();
+/*N*/ CalcAscentAndHeight( nAscent, nHeight );
+/*N*/ }
+/*N*/ SetDropDescent( nHeight - nAscent );
+/*N*/ SetDropHeight( nHeight * nLines - GetDropDescent() );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewDropPortion
+ *************************************************************************/
+
+/*N*/ SwDropPortion *SwTxtFormatter::NewDropPortion( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if( !pDropFmt )
+/*N*/ return 0;
+/*N*/
+/*N*/ xub_StrLen nPorLen = pDropFmt->GetWholeWord() ? 0 : pDropFmt->GetChars();
+/*N*/ nPorLen = pFrm->GetTxtNode()->GetDropLen( nPorLen );
+/*N*/ if( !nPorLen )
+/*N*/ {
+/*?*/ ((SwTxtFormatter*)this)->ClearDropFmt();
+/*?*/ return 0;
+/*N*/ }
+/*N*/
+/*N*/ SwDropPortion *pDropPor = 0;
+/*N*/
+/*N*/ // erste oder zweite Runde?
+/*N*/ if ( !( GetDropHeight() || IsOnceMore() ) )
+/*N*/ {
+/*N*/ if ( GetNext() )
+/*?*/ CalcDropHeight( pDropFmt->GetLines() );
+/*N*/ else
+/*N*/ GuessDropHeight( pDropFmt->GetLines() );
+/*N*/ }
+/*N*/
+/*N*/ // the DropPortion
+/*N*/ if( GetDropHeight() )
+/*?*/ pDropPor = new SwDropPortion( GetDropLines(), GetDropHeight(),
+/*N*/ GetDropDescent(), pDropFmt->GetDistance() );
+/*N*/ else
+/*N*/ pDropPor = new SwDropPortion( 0,0,0,pDropFmt->GetDistance() );
+/*N*/
+/*N*/ pDropPor->SetLen( nPorLen );
+/*N*/
+/*N*/ // If it was not possible to create a proper drop cap portion
+/*N*/ // due to avoiding endless loops. We return a drop cap portion
+/*N*/ // with an empty SwDropCapPart. For these portions the current
+/*N*/ // font is used.
+/*N*/ if ( GetDropLines() < 2 )
+/*N*/ {
+/*?*/ ((SwTxtFormatter*)this)->SetPaintDrop( sal_True );
+/*?*/ return pDropPor;
+/*N*/ }
+/*N*/
+/*N*/ // build DropPortionParts:
+/*N*/ ASSERT( ! rInf.GetIdx(), "Drop Portion not at 0 position!" );
+/*N*/ xub_StrLen nIdx = rInf.GetIdx();
+/*N*/ xub_StrLen nNextChg = 0;
+/*N*/ const SwCharFmt* pFmt = pDropFmt->GetCharFmt();
+/*N*/ SwDropPortionPart* pCurrPart = 0;
+/*N*/
+/*N*/ while ( nNextChg < nPorLen )
+/*N*/ {
+/*N*/ // check for attribute changes and if the portion has to split:
+/*N*/ Seek( nNextChg );
+/*N*/
+/*N*/ // the font is deleted in the destructor of the drop portion part
+/*N*/ SwFont* pTmpFnt = new SwFont( *rInf.GetFont() );
+/*N*/ if ( pFmt )
+/*N*/ {
+/*N*/ const SwAttrSet& rSet = pFmt->GetAttrSet();
+/*N*/ pTmpFnt->SetDiffFnt( &rSet, rInf.GetDoc() );
+/*N*/ }
+/*N*/
+/*N*/ // we do not allow a vertical font for the drop portion
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ pTmpFnt->SetVertical( 0, rInf.GetTxtFrm()->IsVertical() );
+/*N*/ #else
+/*N*/ pTmpFnt->SetVertical( 0 );
+/*N*/ #endif
+/*N*/
+/*N*/ // find next attribute change / script change
+/*N*/ const xub_StrLen nIdx = nNextChg;
+/*N*/ xub_StrLen nNextAttr = Min( GetNextAttr(), rInf.GetTxt().Len() );
+/*N*/ nNextChg = pScriptInfo->NextScriptChg( nIdx );
+/*N*/ if( nNextChg > nNextAttr )
+/*N*/ nNextChg = nNextAttr;
+/*N*/ if ( nNextChg > nPorLen )
+/*N*/ nNextChg = nPorLen;
+/*N*/
+/*N*/ SwDropPortionPart* pPart =
+/*N*/ new SwDropPortionPart( *pTmpFnt, nNextChg - nIdx );
+/*N*/
+/*N*/ if ( ! pCurrPart )
+/*N*/ pDropPor->SetPart( pPart );
+/*N*/ else
+/*?*/ pCurrPart->SetFollow( pPart );
+/*N*/
+/*N*/ pCurrPart = pPart;
+/*N*/ }
+/*N*/
+/*N*/ ((SwTxtFormatter*)this)->SetPaintDrop( sal_True );
+/*N*/ return pDropPor;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtfld.cxx b/binfilter/bf_sw/source/core/text/sw_txtfld.cxx
new file mode 100644
index 000000000000..4c832973e1e0
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtfld.cxx
@@ -0,0 +1,440 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <charfmt.hxx>
+
+#include "viewsh.hxx" // NewFldPortion, GetDoc()
+
+#include <horiornt.hxx>
+
+#include "doc.hxx" // NewFldPortion, GetSysFldType()
+#include "rootfrm.hxx" // Info ueber virt. PageNumber
+#include "pagefrm.hxx" // NewFldPortion, GetVirtPageNum()
+#include "ndtxt.hxx" // NewNumberPortion, pHints->GetNum()
+#include "viewopt.hxx" // SwViewOptions
+#include "flyfrm.hxx" //IsInBody()
+#include "viewimp.hxx"
+
+#include "txtcfg.hxx"
+
+
+#include "porftn.hxx" // NewExtraPortion
+#include "portox.hxx" // NewExtraPortion
+#include "porhyph.hxx" // NewExtraPortion
+#include "porfly.hxx" // NewExtraPortion
+#include "itrform2.hxx" // SwTxtFormatter
+
+#include "chpfld.hxx"
+#include "dbfld.hxx"
+#include "expfld.hxx"
+#include "docufld.hxx"
+#include "pagedesc.hxx" // NewFldPortion, GetNum()
+namespace binfilter {
+
+
+/*************************************************************************
+ * SwTxtFormatter::NewFldPortion()
+ *************************************************************************/
+
+
+/*N*/ sal_Bool lcl_IsInBody( SwFrm *pFrm )
+/*N*/ {
+/*N*/ if ( pFrm->IsInDocBody() )
+/*N*/ return sal_True;
+/*N*/ else
+/*N*/ {
+/*N*/ SwFrm *pTmp = pFrm;
+/*N*/ SwFlyFrm *pFly;
+/*N*/ while ( 0 != (pFly = pTmp->FindFlyFrm()) )
+/*N*/ pTmp = pFly->GetAnchor();
+/*N*/ return pTmp->IsInDocBody();
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
+/*N*/ const SwTxtAttr *pHint ) const
+/*N*/ {
+/*N*/ SwExpandPortion *pRet = NULL;
+/*N*/ SwFrm *pFrame = (SwFrm*)pFrm;
+/*N*/ SwField *pFld = (SwField*)pHint->GetFld().GetFld();
+/*N*/ const sal_Bool bName = rInf.GetOpt().IsFldName();
+/*N*/
+/*N*/ SwCharFmt* pChFmt = 0;
+/*N*/ sal_Bool bNewFlyPor = sal_False,
+/*N*/ bINet = sal_False;
+/*N*/
+/*N*/ // Sprache setzen
+/*N*/ ((SwTxtFormatter*)this)->SeekAndChg( rInf );
+/*N*/ pFld->SetLanguage( GetFnt()->GetLanguage() );
+/*N*/
+/*N*/ ViewShell *pSh = rInf.GetVsh();
+/*N*/
+/*N*/ switch( pFld->GetTyp()->Which() )
+/*N*/ {
+/*N*/ case RES_SCRIPTFLD:
+/*N*/ case RES_POSTITFLD:
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRet = new SwPostItsPortion( RES_SCRIPTFLD == pFld->GetTyp()->Which() );
+/*?*/ break;
+/*?*/
+/*?*/ case RES_COMBINED_CHARS:
+/*?*/ {
+/*?*/ String sStr( pFld->GetCntnt( bName ));
+/*?*/ if( bName )
+/*?*/ pRet = new SwFldPortion( sStr );
+/*?*/ else
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRet = new SwCombinedPortion( sStr );
+/*?*/ }
+/*?*/ break;
+/*N*/
+/*N*/ case RES_HIDDENTXTFLD:
+/*N*/ pRet = new SwHiddenPortion(pFld->GetCntnt( bName ));
+/*N*/ break;
+/*N*/
+/*N*/ case RES_CHAPTERFLD:
+/*N*/ if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
+/*N*/ {
+/*N*/ ((SwChapterField*)pFld)->ChangeExpansion( pFrame,
+/*N*/ &((SwTxtFld*)pHint)->GetTxtNode() );
+/*N*/ }
+/*N*/ pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DOCSTATFLD:
+/*N*/ if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
+/*N*/ ((SwDocStatField*)pFld)->ChangeExpansion( pFrame );
+/*N*/ pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_PAGENUMBERFLD:
+/*N*/ {
+/*N*/ if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
+/*N*/ {
+/*N*/ SwDoc* pDoc = pSh->GetDoc();
+/*N*/ SwPageNumberFieldType *pPageNr = (SwPageNumberFieldType *)
+/*N*/ pFld->GetTyp();
+/*N*/ //??? pDoc->GetSysFldType( RES_PAGENUMBERFLD );
+/*N*/
+/*N*/ // SwPageFrm *pPage = pFrm->FindPageFrm();
+/*N*/ // sal_Bool bVirt = pPage && pPage->GetNext();
+/*N*/ sal_Bool bVirt = pSh->GetLayout()->IsVirtPageNum();
+/*N*/
+/*N*/ MSHORT nVirtNum = pFrame->GetVirtPageNum(),
+/*N*/ nNumPages = pDoc->GetRootFrm()->GetPageNum();
+/*N*/ sal_Int16 nNumFmt = -1;
+/*N*/ if(SVX_NUM_PAGEDESC == pFld->GetFormat())
+/*N*/ nNumFmt = pFrame->FindPageFrm()->GetPageDesc()->GetNumType().GetNumberingType();
+/*N*/
+/*N*/ pPageNr->ChangeExpansion( pDoc, nVirtNum, nNumPages,
+/*N*/ bVirt, nNumFmt > -1 ? &nNumFmt : 0);
+/*N*/ }
+/*N*/ pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+/*N*/ break;
+/*N*/ }
+/*N*/ case RES_GETEXPFLD:
+/*N*/ {
+/*N*/ if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
+/*N*/ {
+/*N*/ SwGetExpField* pExpFld = (SwGetExpField*)pFld;
+ /*N*/ if( !::binfilter::lcl_IsInBody( pFrame ) )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pExpFld->ChgBodyTxtFlag( sal_False );
+/*N*/ }
+/*N*/ else if( !pExpFld->IsInBodyTxt() )
+/*N*/ {
+/*N*/ // war vorher anders, also erst expandieren, dann umsetzen!!
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 pExpFld->ChangeExpansion( *pFrame, *((SwTxtFld*)pHint) );
+/*N*/ }
+/*N*/ }
+/*N*/ pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+/*N*/ break;
+/*N*/ }
+/*N*/ case RES_DBFLD:
+/*N*/ {
+/*N*/ if( !bName )
+/*N*/ {
+/*N*/ SwDBField* pDBFld = (SwDBField*)pFld;
+/*N*/ pDBFld->ChgBodyTxtFlag( ::binfilter::lcl_IsInBody( pFrame ) );
+ /* Solange das ChangeExpansion auskommentiert ist.
+ * Aktualisieren in Kopf/Fuszeilen geht aktuell nicht.
+ if( !::binfilter::lcl_IsInBody( pFrame ) )
+ {
+ pDBFld->ChgBodyTxtFlag( sal_False );
+ pDBFld->ChangeExpansion( pFrame, (SwTxtFld*)pHint );
+ }
+ else if( !pDBFld->IsInBodyTxt() )
+ {
+ // war vorher anders, also erst expandieren, dann umsetzen!!
+ pDBFld->ChangeExpansion( pFrame, (SwTxtFld*)pHint );
+ pDBFld->ChgBodyTxtFlag( sal_True );
+ }
+ */
+/*N*/ }
+/*N*/ pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+/*N*/ break;
+/*N*/ }
+/*?*/ case RES_REFPAGEGETFLD:
+/*?*/ if( !bName && pSh && !pSh->Imp()->IsUpdateExpFlds() )
+ /*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 ((SwRefPageGetField*)pFld)->ChangeExpansion( pFrame, (SwTxtFld*)pHint );
+/*?*/ pRet = new SwFldPortion( pFld->GetCntnt( bName ) );
+/*?*/ break;
+/*N*/
+/*N*/ case RES_JUMPEDITFLD:
+/*N*/ if( !bName )
+/*N*/ pChFmt = ((SwJumpEditField*)pFld)->GetCharFmt();
+/*N*/ bNewFlyPor = sal_True;
+/*N*/ break;
+/*N*/
+/*N*/ default:
+/*N*/ {
+/*N*/ pRet = new SwFldPortion(pFld->GetCntnt( bName ) );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bNewFlyPor )
+/*N*/ {
+/*N*/ SwFont *pTmpFnt = 0;
+/*N*/ if( !bName )
+/*N*/ {
+/*N*/ pTmpFnt = new SwFont( *pFnt );
+/*N*/ if( bINet )
+/*N*/ {
+/*?*/ SwAttrPool* pPool = pChFmt->GetAttrSet().GetPool();
+/*?*/ SfxItemSet aSet( *pPool, RES_CHRATR_BEGIN, RES_CHRATR_END );
+/*?*/ SfxItemSet aTmpSet( aSet );
+/*?*/ pFrm->GetTxtNode()->GetAttr(aSet,rInf.GetIdx(),rInf.GetIdx()+1);
+/*?*/ aTmpSet.Set( pChFmt->GetAttrSet() );
+/*?*/ aTmpSet.Differentiate( aSet );
+/*?*/ if( aTmpSet.Count() )
+/*?*/ pTmpFnt->SetDiffFnt( &aTmpSet, rInf.GetDoc() );
+/*N*/ }
+/*N*/ else
+/*N*/ pTmpFnt->SetDiffFnt( &pChFmt->GetAttrSet(), rInf.GetDoc() );
+/*N*/ }
+/*N*/ pRet = new SwFldPortion( pFld->GetCntnt( bName ), pTmpFnt );
+/*N*/ }
+/*N*/
+/*N*/ return pRet;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFormatter::NewExtraPortion()
+ *************************************************************************/
+
+
+/*N*/ SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ SwTxtAttr *pHint = GetAttr( rInf.GetIdx() );
+/*N*/ SwLinePortion *pRet = 0;
+/*N*/ if( !pHint )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ // aDbstream << "NewExtraPortion: hint not found?" << endl;
+/*N*/ #endif
+/*?*/ pRet = new SwTxtPortion;
+/*?*/ pRet->SetLen( 1 );
+/*?*/ rInf.SetLen( 1 );
+/*?*/ return pRet;
+/*N*/ }
+/*N*/
+/*N*/ switch( pHint->Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_FLYCNT :
+/*N*/ {
+/*N*/ pRet = NewFlyCntPortion( rInf, pHint );
+/*N*/ break;
+/*N*/ }
+/*N*/ case RES_TXTATR_FTN :
+/*N*/ {
+/*N*/ pRet = NewFtnPortion( rInf, pHint );
+/*N*/ break;
+/*N*/ }
+/*?*/ case RES_TXTATR_SOFTHYPH :
+/*?*/ {
+/*?*/ pRet = new SwSoftHyphPortion;
+/*?*/ break;
+/*?*/ }
+/*?*/ case RES_TXTATR_HARDBLANK :
+/*?*/ {
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pRet = new SwBlankPortion( ((SwTxtHardBlank*)pHint)->GetChar() );
+/*?*/ }
+/*N*/ case RES_TXTATR_FIELD :
+/*N*/ {
+/*N*/ pRet = NewFldPortion( rInf, pHint );
+/*N*/ break;
+/*N*/ }
+/*?*/ case RES_TXTATR_REFMARK :
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ {
+/*N*/ case RES_TXTATR_TOXMARK :
+/*N*/ {
+/*N*/ pRet = new SwIsoToxPortion;
+/*N*/ break;
+/*N*/ }
+/*N*/ default: ;
+/*N*/ }
+/*N*/ if( !pRet )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ // aDbstream << "NewExtraPortion: unknown hint" << endl;
+/*N*/ #endif
+/*?*/ const XubString aNothing;
+/*?*/ pRet = new SwFldPortion( aNothing );
+/*?*/ rInf.SetLen( 1 );
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewNumberPortion()
+ *************************************************************************/
+
+
+/*N*/ SwNumberPortion *SwTxtFormatter::NewNumberPortion( SwTxtFormatInfo &rInf ) const
+/*N*/ {
+/*N*/ if( rInf.IsNumDone() || rInf.GetTxtStart() != nStart
+/*N*/ || rInf.GetTxtStart() != rInf.GetIdx() )
+/*N*/ return 0;
+/*N*/
+/*N*/ SwNumberPortion *pRet = 0;
+/*N*/ const SwTxtNode* pTxtNd = GetTxtFrm()->GetTxtNode();
+/*N*/ const SwNumRule* pNumRule = pTxtNd->GetNumRule();
+/*N*/ const SwNodeNum* pNum = pTxtNd->GetNum();
+/*N*/
+/*N*/ if( !pNumRule ) // oder sollte OutlineNum an sein?
+/*N*/ {
+/*N*/ pNum = pTxtNd->GetOutlineNum();
+/*N*/ if( pNum )
+/*N*/ pNumRule = pTxtNd->GetDoc()->GetOutlineNumRule();
+/*N*/ }
+/*N*/ // hat ein "gueltige" Nummer ?
+/*N*/ if( pNumRule && pNum && MAXLEVEL > pNum->GetLevel() )
+/*N*/ {
+/*N*/ CONST SwNumFmt &rNumFmt = pNumRule->Get( pNum->GetLevel() );
+/*N*/ const sal_Bool bLeft = SVX_ADJUST_LEFT == rNumFmt.GetNumAdjust();
+/*N*/ const sal_Bool bCenter = SVX_ADJUST_CENTER == rNumFmt.GetNumAdjust();
+/*N*/ const KSHORT nMinDist = rNumFmt.GetCharTextDistance();
+/*N*/
+/*N*/ if( SVX_NUM_BITMAP == rNumFmt.GetNumberingType() )
+/*N*/ {
+/*?*/ pRet = new SwGrfNumPortion( (SwFrm*)GetTxtFrm(),rNumFmt.GetBrush(),
+/*?*/ rNumFmt.GetGraphicOrientation(), rNumFmt.GetGraphicSize(),
+/*?*/ bLeft, bCenter, nMinDist );
+/*?*/ long nTmpA = rInf.GetLast()->GetAscent();
+/*?*/ long nTmpD = rInf.GetLast()->Height() - nTmpA;
+/*?*/ if( !rInf.IsTest() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ ((SwGrfNumPortion*)pRet)->SetBase( nTmpA, nTmpD, nTmpA, nTmpD );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Der SwFont wird dynamisch angelegt und im CTOR uebergeben,
+/*N*/ // weil das CharFmt nur einen SV-Font zurueckliefert.
+/*N*/ // Im Dtor vom SwNumberPortion wird der SwFont deletet.
+/*N*/ SwFont *pNumFnt = 0;
+/*N*/ const SwAttrSet* pFmt = rNumFmt.GetCharFmt() ?
+/*N*/ &rNumFmt.GetCharFmt()->GetAttrSet() : NULL;
+/*N*/ if( SVX_NUM_CHAR_SPECIAL == rNumFmt.GetNumberingType() )
+/*N*/ {
+/*N*/ const Font *pFmtFnt = rNumFmt.GetBulletFont();
+/*N*/ pNumFnt = new SwFont( &rInf.GetCharAttr(), rInf.GetDoc() );
+/*N*/ if( pFmt )
+/*N*/ pNumFnt->SetDiffFnt( pFmt, rInf.GetDoc() );
+/*N*/ if ( pFmtFnt )
+/*N*/ {
+/*N*/ const BYTE nAct = pNumFnt->GetActual();
+/*N*/ pNumFnt->SetFamily( pFmtFnt->GetFamily(), nAct );
+/*N*/ pNumFnt->SetName( pFmtFnt->GetName(), nAct );
+/*N*/ pNumFnt->SetStyleName( pFmtFnt->GetStyleName(), nAct );
+/*N*/ pNumFnt->SetCharSet( pFmtFnt->GetCharSet(), nAct );
+/*N*/ pNumFnt->SetPitch( pFmtFnt->GetPitch(), nAct );
+/*N*/ }
+/*N*/ // we do not allow a vertical font
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ pNumFnt->SetVertical( pNumFnt->GetOrientation(),
+/*N*/ pFrm->IsVertical() );
+/*N*/ #else
+/*N*/ pNumFnt->SetVertical( 0 );
+/*N*/ #endif
+/*N*/
+/*N*/ pRet = new SwBulletPortion( rNumFmt.GetBulletChar(), pNumFnt, bLeft,
+/*N*/ bCenter, nMinDist );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ XubString aTxt( pNumRule->MakeNumString( *pNum ) );
+/*N*/
+/*N*/ // 7974: Nicht nur eine Optimierung...
+/*N*/ // Eine Numberportion ohne Text wird die Breite von 0
+/*N*/ // erhalten. Die nachfolgende Textportion wird im BreakLine
+/*N*/ // in das BreakCut laufen, obwohl rInf.GetLast()->GetFlyPortion()
+/*N*/ // vorliegt!
+/*N*/ if( aTxt.Len() )
+/*N*/ {
+/*N*/ pNumFnt = new SwFont( &rInf.GetCharAttr(), rInf.GetDoc() );
+/*N*/ if( pFmt )
+/*N*/ pNumFnt->SetDiffFnt( pFmt, rInf.GetDoc() );
+/*N*/ // Die SSize muss erhalten bleiben
+/*N*/ // pNumFnt->ChangeSize( rInf.GetFont()->GetSize() );
+/*N*/
+/*N*/ // we do not allow a vertical font
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ pNumFnt->SetVertical( pNumFnt->GetOrientation(), pFrm->IsVertical() );
+/*N*/ #else
+/*N*/ pNumFnt->SetVertical( 0 );
+/*N*/ #endif
+/*N*/
+/*N*/ pRet = new SwNumberPortion( aTxt, pNumFnt, bLeft, bCenter,
+/*N*/ nMinDist );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+/* -----------------26.06.2003 13:54-----------------
+
+ --------------------------------------------------*/
+void SwTxtFld::NotifyContentChange(SwFmtFld& rFmtFld)
+{
+ //if not in undo section notify the change
+ if(pMyTxtNd && pMyTxtNd->GetNodes().IsDocNodes())
+ pMyTxtNd->Modify(0, &rFmtFld);
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtfly.cxx b/binfilter/bf_sw/source/core/text/sw_txtfly.cxx
new file mode 100644
index 000000000000..22814df6e7eb
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtfly.cxx
@@ -0,0 +1,1900 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "viewsh.hxx"
+#include "rootfrm.hxx"
+#include "pam.hxx" // SwPosition
+#include "dcontact.hxx" // SwContact
+#include "dflyobj.hxx" // SdrObject
+#include "frmtool.hxx" // ::DrawGraphic
+#include <pormulti.hxx> // SwMultiPortion
+
+#ifdef VERT_DISTANCE
+#include <math.h>
+#endif
+
+
+#include <bf_svx/obj3d.hxx>
+
+#include <bf_svx/txtrange.hxx>
+
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <txtflcnt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtanchr.hxx>
+#include <fmtflcnt.hxx>
+
+
+
+
+#include <pagefrm.hxx>
+#include <pagedesc.hxx> // SwPageDesc
+#include <tgrditem.hxx>
+
+// #102344#
+#include <bf_svx/svdoedge.hxx>
+
+#include "itrform2.hxx" // SwTxtFormatter
+#include "porfly.hxx" // NewFlyCntPortion
+#include "porfld.hxx" // SwGrfNumPortion
+
+
+#include "flyfrms.hxx"
+#include "fmtcnct.hxx" // SwFmtChain
+
+#ifdef DBG_UTIL
+#include "viewopt.hxx" // SwViewOptions, nur zum Testen (Test2)
+#endif
+namespace binfilter {
+
+/*****************************************************************************
+ * Beschreibung:
+ * Die Klasse SwTxtFly soll die Universalschnittstelle zwischen der
+ * Formatierung/Textausgabe und den u.U. ueberlappenden freifliegenden
+ * Frames sein.
+ * Waehrend der Formatierung erkundigt sich der Formatierer beim SwTxtFly,
+ * ob ein bestimmter Bereich durch die Attribute eines ueberlappenden
+ * Frames vorliegt. Solche Bereiche werden in Form von Dummy-Portions
+ * abgebildet.
+ * Die gesamte Textausgabe und Retusche wird ebenfalls an ein SwTxtFly
+ * weitergeleitet. Dieser entscheidet, ob Textteile geclippt werden muessen
+ * und zerteilt z.B. die Bereiche bei einem DrawRect.
+ * Zu beachten ist, dass alle freifliegenden Frames in einem nach TopLeft
+ * sortiertem PtrArray an der Seite zu finden sind. Intern wird immer nur
+ * in dokumentglobalen Werten gerechnet. Die IN- und OUT-Parameter sind
+ * jedoch in den meisten Faellen an die Beduerfnisse des LineIters
+ * zugeschnitten, d.h. sie werden in frame- oder windowlokalen Koordinaten
+ * konvertiert.
+ * Wenn mehrere Frames mit Umlaufattributen in einer Zeile liegen,
+ * ergeben sich unterschiedliche Auswirkungen fuer den Textfluss:
+ *
+ * L/R P L R K
+ * P -P-P- -P-L -P R- -P K
+ * L -L P- -L L -L R- -L K
+ * R R-P- R-L R R- R K
+ * K K P- K L K R- K K
+ *
+ * (P=parallel, L=links, R=rechts, K=kein Umlauf)
+ *
+ * Das Verhalten so beschreiben:
+ * Jeder Rahmen kann Text verdraengen, wobei der Einfluss allerdings nur
+ * bis zum naechsten Rahmen reicht.
+ *****************************************************************************/
+
+/*****************************************************************************
+ *
+ * lcl_TheAnchor liefert den SwFrm, an dem das Objekt verankert ist.
+ *
+ *****************************************************************************/
+
+// OD 03.07.2003 #108784# - change return type from <pointer> to <reference>
+/*N*/ const SwFrm& lcl_TheAnchor( const SdrObject* pObj )
+/*N*/ {
+/*N*/ // OD 03.07.2003 #108784# - adjustments for support of drawing objects in
+/*N*/ // header/footer.
+/*N*/ const SwFrm* pRet = 0L;
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ pRet = static_cast<const SwVirtFlyDrawObj*>(pObj)->GetFlyFrm()->GetAnchor();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwDrawContact* pDrawContact =
+/*N*/ static_cast<SwDrawContact*>(GetUserCall( pObj ));
+/*N*/ if ( pObj->ISA(SwDrawVirtObj) )
+/*N*/ {
+/*N*/ const SwDrawVirtObj* pDrawVirtObj = static_cast<const SwDrawVirtObj*>(pObj);
+/*N*/ pRet = pDrawVirtObj->GetAnchorFrm();
+/*N*/
+/*N*/ // error handling, if no anchor frame is found.
+/*N*/ if ( !pRet )
+/*N*/ {
+/*N*/ // assert, if no anchor frame found at 'virtual' drawing object
+/*N*/ // and return anchor frame of 'master' drawing object.
+/*N*/ ASSERT( false, "<lcl_TheAnchor(..)> - virtual drawing object with no anchor frame!" );
+/*N*/ pRet = pDrawContact->GetAnchor();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pRet = pDrawContact->GetAnchor();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( pRet, "<lcl_TheAnchor(..)> - no anchor frame found!" );
+/*N*/
+/*N*/ return *pRet;
+/*N*/ }
+
+/*****************************************************************************
+ * lcl_MaxAscDescent liefert die max. Ascents und Descents in der Zeile ohne
+ * FlyPortions (abs. und seitengeb. Objekte), einmal mit und einmal ohne
+ * Beruecksichtigung der zeichengeb. Objekte.
+ * Diese Werte sind fuer das SetBase der zeichengebundenen Objekte wichtig,
+ * wenn diese an den Zeichen oder an der Zeile ausgerichtet werden sollen.
+ *****************************************************************************/
+
+/*N*/ void lcl_MaxAscDescent( SwLinePortion* pPos, long &rAscent, long &rDescent,
+/*N*/ long &rFlyAscent, long &rFlyDescent, SwLinePortion* pNot = NULL )
+/*N*/ {
+/*N*/ rAscent = 0;
+/*N*/ rDescent = 0;
+/*N*/ rFlyAscent = 0;
+/*N*/ rFlyDescent = 0;
+/*N*/
+/*N*/ if( !pPos->GetLen() && ( pPos->IsParaPortion() || pPos->IsLayPortion() ) )
+/*N*/ pPos = pPos->GetPortion();
+/*N*/
+/*N*/ while ( pPos )
+/*N*/ {
+/*N*/ if( !pPos->IsBreakPortion() && !pPos->IsFlyPortion() )
+/*N*/ {
+/*N*/ sal_Bool bFlyCmp = pPos->IsFlyCntPortion() ?
+/*N*/ ((SwFlyCntPortion*)pPos)->IsMax() : pPos != pNot;
+/*N*/ if( bFlyCmp )
+/*N*/ {
+/*N*/ rFlyAscent = Max( rFlyAscent, (long)pPos->GetAscent() );
+/*N*/ rFlyDescent = Max( rFlyDescent,
+/*N*/ (long)( pPos->Height() - pPos->GetAscent() ) );
+/*N*/ }
+/*N*/ if( !pPos->IsFlyCntPortion() && !pPos->IsGrfNumPortion() )
+/*N*/ {
+/*N*/ rAscent = Max( rAscent, (long)pPos->GetAscent() );
+/*N*/ rDescent = Max( rDescent,
+/*N*/ (long)( pPos->Height() - pPos->GetAscent() ) );
+/*N*/ }
+/*N*/ }
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ }
+
+/*N*/ void SwTxtFormatter::CalcUnclipped( SwTwips& rTop, SwTwips& rBottom )
+/*N*/ {
+/*N*/ ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(),
+/*N*/ "SwTxtFormatter::CalcUnclipped with unswapped frame" )
+/*N*/
+/*N*/ long nFlyAsc, nFlyDesc;
+/*N*/ lcl_MaxAscDescent( pCurr, rTop, rBottom, nFlyAsc, nFlyDesc );
+/*N*/ rTop = Y() + GetCurr()->GetAscent();
+/*N*/ rBottom = rTop + nFlyDesc;
+/*N*/ rTop -= nFlyAsc;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::UpdatePos() aktualisiert die Referenzpunkte der zeichengeb.
+ * Objekte, z. B. nach Adjustierung ( rechtsbuendig, Blocksatz etc. )
+ * ( hauptsaechlich Korrrektur der X-Position )
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurr, Point aStart,
+/*N*/ xub_StrLen nStartIdx, sal_Bool bAllWays ) const
+/*N*/ {
+/*N*/ ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(),
+/*N*/ "SwTxtFormatter::UpdatePos with unswapped frame" )
+/*N*/
+/*N*/ if( GetInfo().IsTest() )
+/*N*/ return;
+/*N*/ SwLinePortion *pFirst = pCurr->GetFirstPortion();
+/*N*/ SwLinePortion *pPos = pFirst;
+/*N*/ SwTxtPaintInfo aTmpInf( GetInfo() );
+/*N*/ aTmpInf.SetSpaceAdd( pCurr->GetpSpaceAdd() );
+/*N*/ aTmpInf.ResetSpaceIdx();
+/*N*/ aTmpInf.SetKanaComp( pCurr->GetpKanaComp() );
+/*N*/ aTmpInf.ResetKanaIdx();
+/*N*/
+/*N*/ // Die Groesse des Frames
+/*N*/ aTmpInf.SetIdx( nStartIdx );
+/*N*/ aTmpInf.SetPos( aStart );
+/*N*/
+/*N*/ long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
+/*N*/ lcl_MaxAscDescent( pPos, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
+/*N*/ KSHORT nTmpHeight = pCurr->GetRealHeight();
+/*N*/ KSHORT nAscent = pCurr->GetAscent() + nTmpHeight - pCurr->Height();
+/*N*/ sal_uInt8 nFlags = SETBASE_ULSPACE;
+/*N*/ if( GetMulti() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*N*/ {
+/*N*/ else
+/*N*/ aTmpInf.Y( aTmpInf.Y() + nAscent );
+/*N*/
+/*N*/ while( pPos )
+/*N*/ {
+/*N*/ // bislang ist mir nur ein Fall bekannt, wo die Positionsaenderung
+/*N*/ // (verursacht durch das Adjustment) fuer eine Portion wichtig
+/*N*/ // sein koennte: Bei FlyCntPortions muss ein SetRefPoint erfolgen.
+/*N*/ if( ( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
+/*N*/ && ( bAllWays || !IsQuick() ) )
+/*N*/ {
+/*N*/ lcl_MaxAscDescent( pFirst, nTmpAscent, nTmpDescent,
+/*N*/ nFlyAsc, nFlyDesc, pPos );
+/*N*/ if( pPos->IsGrfNumPortion() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ if( !nFlyAsc && !nFlyDesc )
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ Point aBase( aTmpInf.GetPos() );
+/*N*/ if ( GetInfo().GetTxtFrm()->IsVertical() )
+/*N*/ GetInfo().GetTxtFrm()->SwitchHorizontalToVertical( aBase );
+/*N*/
+/*N*/ ((SwFlyCntPortion*)pPos)->SetBase( *aTmpInf.GetTxtFrm(),
+/*N*/ aBase, nTmpAscent, nTmpDescent, nFlyAsc,
+/*N*/ nFlyDesc, nFlags );
+/*N*/ }
+/*N*/ }
+/*N*/ if( pPos->IsMultiPortion() && ((SwMultiPortion*)pPos)->HasFlyInCntnt() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*N*/ {
+/*N*/ pPos->Move( aTmpInf );
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::AlignFlyInCntBase()
+ * richtet die zeichengeb. Objekte in Y-Richtung ggf. neu aus.
+ *************************************************************************/
+
+/*N*/ void SwTxtFormatter::AlignFlyInCntBase( long nBaseLine ) const
+/*N*/ {
+/*N*/ ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(),
+/*N*/ "SwTxtFormatter::AlignFlyInCntBase with unswapped frame" )
+/*N*/
+/*N*/ if( GetInfo().IsTest() )
+/*N*/ return;
+/*N*/ SwLinePortion *pFirst = pCurr->GetFirstPortion();
+/*N*/ SwLinePortion *pPos = pFirst;
+/*N*/ sal_uInt8 nFlags = SETBASE_NOFLAG;
+/*N*/ if( GetMulti() && GetMulti()->HasRotation() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ nFlags |= SETBASE_ROTATE;
+/*N*/ }
+/*N*/
+/*N*/ long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
+/*N*/
+/*N*/ while( pPos )
+/*N*/ {
+/*N*/ if( pPos->IsFlyCntPortion() || pPos->IsGrfNumPortion() )
+/*N*/ {
+/*N*/ lcl_MaxAscDescent( pFirst, nTmpAscent, nTmpDescent,
+/*N*/ nFlyAsc, nFlyDesc, pPos );
+/*N*/ if( pPos->IsGrfNumPortion() )
+/*N*/ ((SwGrfNumPortion*)pPos)->SetBase( nTmpAscent, nTmpDescent,
+/*N*/ nFlyAsc, nFlyDesc );
+/*N*/ else
+/*N*/ {
+/*N*/ Point aBase;
+/*N*/ if ( GetInfo().GetTxtFrm()->IsVertical() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ nBaseLine = GetInfo().GetTxtFrm()->SwitchHorizontalToVertical( nBaseLine );
+/*N*/ }
+/*N*/ else
+/*N*/ aBase = Point( ((SwFlyCntPortion*)pPos)->GetRefPoint().X(), nBaseLine );
+/*N*/
+/*N*/ ((SwFlyCntPortion*)pPos)->SetBase( *GetInfo().GetTxtFrm(), aBase, nTmpAscent, nTmpDescent,
+/*N*/ nFlyAsc, nFlyDesc, nFlags );
+/*N*/ }
+/*N*/ }
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::ChkFlyUnderflow()
+ * This is called after the real height of the line has been calculated
+ * Therefore it is possible, that more flys from below intersect with the
+ * line, or that flys from above do not intersect with the line anymore
+ * We check this and return true if so, meaning that the line has to be
+ * formatted again
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
+/*N*/ {
+/*N*/ ASSERT( rInf.GetTxtFly()->IsOn(), "SwTxtFormatter::ChkFlyUnderflow: why?" );
+/*N*/ if( GetCurr() )
+/*N*/ {
+/*N*/ // Erst pruefen wir, ob ueberhaupt ein Fly mit der Zeile ueberlappt.
+/*N*/ // = GetLineHeight()
+/*N*/ const long nHeight = GetCurr()->GetRealHeight();
+/*N*/ SwRect aLine( GetLeftMargin(), Y(), rInf.RealWidth(), nHeight );
+/*N*/
+/*N*/ SwRect aLineVert( aLine );
+/*N*/ if ( pFrm->IsVertical() )
+/*?*/ pFrm->SwitchHorizontalToVertical( aLineVert );
+/*N*/ SwRect aInter( rInf.GetTxtFly()->GetFrm( aLineVert ) );
+/*N*/ if ( pFrm->IsVertical() )
+ //STRIP001 /*?*/ pFrm->SwitchVerticalToHorizontal( aInter );
+/*N*/
+/*N*/ if( !aInter.HasArea() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // Nun ueberpruefen wir jede Portion, die sich haette senken koennen,
+/*N*/ // ob sie mit dem Fly ueberlappt.
+/*N*/ const SwLinePortion *pPos = GetCurr()->GetFirstPortion();
+/*N*/ aLine.Pos().Y() = Y() + GetCurr()->GetRealHeight() - GetCurr()->Height();
+/*N*/ aLine.Height( GetCurr()->Height() );
+/*N*/
+/*N*/ while( pPos )
+/*N*/ {
+/*N*/ aLine.Width( pPos->Width() );
+/*N*/
+/*N*/ aLineVert = aLine;
+/*N*/ if ( pFrm->IsVertical() )
+/*?*/ pFrm->SwitchHorizontalToVertical( aLineVert );
+/*N*/ aInter = rInf.GetTxtFly()->GetFrm( aLineVert );
+/*N*/ if ( pFrm->IsVertical() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pFrm->SwitchVerticalToHorizontal( aInter );
+/*N*/
+/*N*/ // new flys from below?
+/*N*/ if( !pPos->IsFlyPortion() )
+/*N*/ {
+/*N*/ if( aInter.IsOver( aLine ) )
+/*N*/ {
+/*N*/ aInter._Intersection( aLine );
+/*N*/ if( aInter.HasArea() )
+/*N*/ {
+/*N*/ // to be evaluated during reformat of this line:
+/*N*/ // RealHeight including spacing
+/*N*/ rInf.SetLineHeight( KSHORT(nHeight) );
+/*N*/ // Height without extra spacing
+/*N*/ rInf.SetLineNettoHeight( KSHORT( pCurr->Height() ) );
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // the fly portion is not anylonger intersected by a fly
+/*N*/ if ( ! aInter.IsOver( aLine ) )
+/*N*/ {
+/*?*/ rInf.SetLineHeight( KSHORT(nHeight) );
+/*?*/ rInf.SetLineNettoHeight( KSHORT( pCurr->Height() ) );
+/*?*/ return sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aInter._Intersection( aLine );
+/*N*/
+/*N*/ // no area means a fly has become invalid because of
+/*N*/ // lowering the line => reformat the line
+/*N*/ // we also have to reformat the line, if the fly size
+/*N*/ // differs from the intersection intervals size
+/*N*/ if( ! aInter.HasArea() ||
+/*N*/ ((SwFlyPortion*)pPos)->GetFixWidth() != aInter.Width() )
+/*N*/ {
+/*N*/ rInf.SetLineHeight( KSHORT(nHeight) );
+/*N*/ rInf.SetLineNettoHeight( KSHORT( pCurr->Height() ) );
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ aLine.Left( aLine.Left() + pPos->Width() );
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::CalcFlyWidth()
+ * ermittelt das naechste Objekt, das in die restliche Zeile ragt und
+ * konstruiert die zugehoerige FlyPortion.
+ * Dazu wird SwTxtFly.GetFrm(..) benutzt.
+ *************************************************************************/
+
+// Durch Flys kann sich der rechte Rand verkuerzen.
+
+/*N*/ void SwTxtFormatter::CalcFlyWidth( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if( GetMulti() || rInf.GetFly() )
+/*N*/ return;
+/*N*/
+/*N*/ SwTxtFly *pTxtFly = rInf.GetTxtFly();
+/*N*/ if( !pTxtFly->IsOn() || rInf.IsIgnoreFly() )
+/*N*/ return;
+/*N*/
+/*N*/ register const SwLinePortion *pLast = rInf.GetLast();
+/*N*/
+/*N*/ long nAscent;
+/*N*/ long nTop = Y();
+/*N*/ long nHeight;
+/*N*/
+/*N*/ if( rInf.GetLineHeight() )
+/*N*/ {
+/*N*/ // real line height has already been calculated, we only have to
+/*N*/ // search for intersections in the lower part of the strip
+/*N*/ nAscent = pCurr->GetAscent();
+/*N*/ nHeight = rInf.GetLineNettoHeight();
+/*N*/ nTop += rInf.GetLineHeight() - nHeight;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nAscent = pLast->GetAscent();
+/*N*/ nHeight = pLast->Height();
+/*N*/
+/*N*/ // we make a first guess for the lines real height
+/*N*/ if ( ! pCurr->GetRealHeight() )
+/*N*/ CalcRealHeight();
+/*N*/
+/*N*/ if ( pCurr->GetRealHeight() > nHeight )
+/*N*/ nTop += pCurr->GetRealHeight() - nHeight;
+/*N*/ else
+/*N*/ // important for fixed space between lines
+/*N*/ nHeight = pCurr->GetRealHeight();
+/*N*/ }
+/*N*/
+/*N*/ const long nLeftMar = GetLeftMargin();
+/*N*/ const long nLeftMin = (rInf.X() || GetDropLeft()) ? nLeftMar : GetLeftMin();
+/*N*/
+/*N*/ SwRect aLine( rInf.X() + nLeftMin, nTop, rInf.RealWidth() - rInf.X()
+/*N*/ + nLeftMar - nLeftMin , nHeight );
+/*N*/
+/*N*/ SwRect aLineVert( aLine );
+/*N*/ if ( pFrm->IsRightToLeft() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pFrm->SwitchLTRtoRTL( aLineVert );
+/*N*/
+/*N*/ if ( pFrm->IsVertical() )
+/*N*/ pFrm->SwitchHorizontalToVertical( aLineVert );
+/*N*/ SwRect aInter( pTxtFly->GetFrm( aLineVert ) );
+/*N*/
+/*N*/ if ( pFrm->IsRightToLeft() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pFrm->SwitchRTLtoLTR( aInter );
+/*N*/
+/*N*/ if ( pFrm->IsVertical() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pFrm->SwitchVerticalToHorizontal( aInter );
+/*N*/
+/*N*/ if( aInter.IsOver( aLine ) )
+/*N*/ {
+/*N*/ aLine.Left( rInf.X() + nLeftMar );
+/*N*/ sal_Bool bForced = sal_False;
+/*N*/ if( aInter.Left() <= nLeftMin )
+/*N*/ {
+/*N*/ SwTwips nFrmLeft = GetTxtFrm()->Frm().Left();
+/*N*/ if( GetTxtFrm()->Prt().Left() < 0 )
+/*?*/ nFrmLeft += GetTxtFrm()->Prt().Left();
+/*N*/ if( aInter.Left() < nFrmLeft )
+/*N*/ aInter.Left( nFrmLeft );
+/*N*/ aInter.Width( aInter.Width() + nLeftMar - nFrmLeft );
+/*N*/ // Bei negativem Erstzeileneinzug setzen wir das Flag,
+/*N*/ // um anzuzeigen, dass der Einzug/Rand verschoben wurde
+/*N*/ // Dies muss beim DefaultTab an der Nullposition beruecksichtigt
+/*N*/ // werden.
+/*N*/ if( IsFirstTxtLine() && HasNegFirst() )
+/*N*/ bForced = sal_True;
+/*N*/ }
+/*N*/ aInter.Intersection( aLine );
+/*N*/ if( !aInter.HasArea() )
+/*N*/ return;
+/*N*/
+/*N*/ const sal_Bool bFullLine = aLine.Left() == aInter.Left() &&
+/*N*/ aLine.Right() == aInter.Right();
+/*N*/
+/*N*/ // Obwohl kein Text mehr da ist, muss eine weitere Zeile
+/*N*/ // formatiert werden, weil auch leere Zeilen einem Fly
+/*N*/ // ohne Umlauf ausweichen muessen.
+/*N*/ if( bFullLine && rInf.GetIdx() == rInf.GetTxt().Len() )
+/*N*/ {
+/*N*/ rInf.SetNewLine( sal_True );
+/*N*/ // 8221: Dummies erkennt man an Ascent == Height
+/*N*/ pCurr->SetDummy(sal_True);
+/*N*/ }
+/*N*/
+/*N*/ // aInter wird framelokal
+/*N*/ aInter.Pos().X() -= nLeftMar;
+/*N*/ SwFlyPortion *pFly = new SwFlyPortion( aInter );
+/*N*/ if( bForced )
+/*N*/ {
+/*N*/ pCurr->SetForcedLeftMargin( sal_True );
+/*N*/ rInf.ForcedLeftMargin( (USHORT)aInter.Width() );
+/*N*/ }
+/*N*/
+/*N*/ if( bFullLine )
+/*N*/ {
+/*N*/ // 8110: wir muessen um Einheiten von Zeilenhoehen anwachsen,
+/*N*/ // um nebeneinanderliegende Flys mit unterschiedlichen
+/*N*/ // Umlaufattributen angemessen zu umfliessen.
+/*N*/ // Die letzte ausweichende Zeile, sollte in der Hoehe angepasst
+/*N*/ // sein, damit nicht der Eindruck von "Rahmenabstaenden" aufkommt.
+/*N*/ // 8221: Wichtig ist, dass Ascent == Height ist, weil die FlyPortionWerte
+/*N*/ // im CalcLine in pCurr uebertragen werden und IsDummy() darauf
+/*N*/ // angewiesen ist.
+/*N*/ // Es gibt meines Wissens nur zwei Stellen, in denen DummyLines
+/*N*/ // entstehen koennen: hier und in MakeFlyDummies.
+/*N*/ // Ausgewertet wird IsDummy() in IsFirstTxtLine() und
+/*N*/ // beim Zeilenwandern und im Zusammenhang mit DropCaps.
+/*N*/ pFly->Height( KSHORT(aInter.Height()) );
+/*N*/
+/*N*/ // In nNextTop steckt jetzt die Unterkante des Rahmens, dem wir
+/*N*/ // ausweichen oder die Oberkante des naechsten Rahmens, den wir
+/*N*/ // beachten muessen. Wir koennen also jetzt getrost bis zu diesem
+/*N*/ // Wert anwachsen, so sparen wir einige Leerzeilen.
+/*N*/ SWRECTFN( pFrm )
+/*N*/ long nNextTop = pTxtFly->GetNextTop();
+/*N*/ if ( bVert )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nNextTop = pFrm->SwitchVerticalToHorizontal( nNextTop );
+/*N*/ if( nNextTop > aInter.Bottom() )
+/*N*/ {
+/*N*/ SwTwips nH = nNextTop - aInter.Top();
+/*N*/ if( nH < KSHRT_MAX )
+/*N*/ pFly->Height( KSHORT( nH ) );
+/*N*/ }
+/*N*/ if( nAscent < pFly->Height() )
+/*N*/ pFly->SetAscent( KSHORT(nAscent) );
+/*N*/ else
+/*N*/ pFly->SetAscent( pFly->Height() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( rInf.GetIdx() == rInf.GetTxt().Len() )
+/*N*/ {
+/*N*/ // Nicht nHeight nehmen, sonst haben wir einen Riesendescent
+/*N*/ pFly->Height( pLast->Height() );
+/*N*/ pFly->SetAscent( pLast->GetAscent() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pFly->Height( KSHORT(aInter.Height()) );
+/*N*/ if( nAscent < pFly->Height() )
+/*N*/ pFly->SetAscent( KSHORT(nAscent) );
+/*N*/ else
+/*N*/ pFly->SetAscent( pFly->Height() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ rInf.SetFly( pFly );
+/*N*/
+/*N*/ if( pFly->Fix() < rInf.Width() )
+/*N*/ rInf.Width( pFly->Fix() );
+/*N*/
+/*N*/ GETGRID( pFrm->FindPageFrm() )
+/*N*/ if ( pGrid )
+/*N*/ {
+/*?*/ const SwPageFrm* pPageFrm = pFrm->FindPageFrm();
+/*?*/ const SwLayoutFrm* pBody = pPageFrm->FindBodyCont();
+/*?*/
+/*?*/ SWRECTFN( pPageFrm )
+/*?*/
+/*?*/ const long nGridOrigin = pBody ?
+/*?*/ (pBody->*fnRect->fnGetPrtLeft)() :
+/*?*/ (pPageFrm->*fnRect->fnGetPrtLeft)();
+/*?*/
+/*?*/ const USHORT nGridWidth = pGrid->GetBaseHeight();
+/*?*/
+/*?*/ SwTwips nStartX = GetLeftMargin();
+/*?*/ if ( bVert )
+/*?*/ {
+/*?*/ Point aPoint( nStartX, 0 );
+/*?*/ pFrm->SwitchHorizontalToVertical( aPoint );
+/*?*/ nStartX = aPoint.Y();
+/*?*/ }
+/*?*/
+/*?*/ const SwTwips nOfst = nStartX - nGridOrigin;
+/*?*/ const SwTwips nTmpWidth = rInf.Width() + nOfst;
+/*?*/
+/*?*/ const ULONG i = nTmpWidth / nGridWidth + 1;
+/*?*/
+/*?*/ const long nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
+/*?*/ if ( nNewWidth > 0 )
+/*?*/ rInf.Width( (USHORT)nNewWidth );
+/*?*/ else
+/*?*/ rInf.Width( 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*****************************************************************************
+ * SwTxtFormatter::NewFlyCntPortion
+ * legt eine neue Portion fuer ein zeichengebundenes Objekt an.
+ *****************************************************************************/
+
+/*N*/ SwFlyCntPortion *SwTxtFormatter::NewFlyCntPortion( SwTxtFormatInfo &rInf,
+/*N*/ SwTxtAttr *pHint ) const
+/*N*/ {
+/*N*/ SwFlyCntPortion *pRet = 0;
+/*N*/ const SwFrm *pFrame = (SwFrm*)pFrm;
+/*N*/
+/*N*/ SwFlyInCntFrm *pFly;
+/*N*/ SwFrmFmt* pFrmFmt = ((SwTxtFlyCnt*)pHint)->GetFlyCnt().GetFrmFmt();
+/*N*/ if( RES_FLYFRMFMT == pFrmFmt->Which() )
+/*N*/ pFly = ((SwTxtFlyCnt*)pHint)->GetFlyFrm(pFrame);
+/*N*/ else
+/*N*/ pFly = NULL;
+/*N*/ // aBase bezeichnet die dokumentglobale Position,
+/*N*/ // ab der die neue Extraportion plaziert wird.
+/*N*/ // aBase.X() = Offset in der Zeile,
+/*N*/ // hinter der aktuellen Portion
+/*N*/ // aBase.Y() = LineIter.Y() + Ascent der aktuellen Portion
+/*N*/
+/*N*/ SwLinePortion *pPos = pCurr->GetFirstPortion();
+/*N*/
+/*N*/ long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
+/*N*/ lcl_MaxAscDescent( pPos, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
+/*N*/
+/*N*/ // Wenn der Ascent des Rahmens groesser als der Ascent der akt. Portion
+/*N*/ // ist, wird dieser bei der Base-Berechnung verwendet, sonst wuerde
+/*N*/ // der Rahmen zunaechst zu weit nach oben gesetzt, um dann doch wieder
+/*N*/ // nach unten zu rutschen und dabei ein Repaint in einem Bereich ausloesen,
+/*N*/ // indem er niemals wirklich war.
+/*N*/ KSHORT nAscent;
+/*N*/ if ( IsQuick() || !pFly || !pFly->GetValidPosFlag() ||
+/*N*/ ( GetInfo().GetTxtFrm()->IsVertical() ?
+/*N*/ ( ! pFly->GetRefPoint().X() ||
+/*N*/ ( nAscent = Abs( int( pFly->GetRelPos().X() ) ) ) ) :
+/*N*/ ( ! pFly->GetRefPoint().Y() ||
+/*N*/ ( nAscent = Abs( int( pFly->GetRelPos().Y() ) ) ) ) ) )
+/*N*/ nAscent = rInf.GetLast()->GetAscent();
+/*N*/ else if( nAscent > nFlyAsc )
+/*N*/ nFlyAsc = nAscent;
+/*N*/
+/*N*/ Point aBase( GetLeftMargin() + rInf.X(), Y() + nAscent );
+/*N*/ sal_uInt8 nMode = IsQuick() ? SETBASE_QUICK : 0;
+/*N*/ if( GetMulti() && GetMulti()->HasRotation() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ nMode |= SETBASE_ROTATE;
+/*N*/ }
+/*N*/
+/*N*/ Point aTmpBase( aBase );
+/*N*/ if ( GetInfo().GetTxtFrm()->IsVertical() )
+/*?*/ GetInfo().GetTxtFrm()->SwitchHorizontalToVertical( aTmpBase );
+/*N*/
+/*N*/ if( pFly )
+/*N*/ {
+/*N*/ pRet = new SwFlyCntPortion( *GetInfo().GetTxtFrm(), pFly, aTmpBase,
+/*N*/ nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode );
+/*N*/ // Wir muessen sicherstellen, dass unser Font wieder im OutputDevice
+/*N*/ // steht. Es koennte sein, dass der FlyInCnt frisch eingefuegt wurde,
+/*N*/ // dann hat GetFlyFrm dazu gefuehrt, dass er neu angelegt wird.
+/*N*/ // Dessen Frames werden sofort formatiert, die verstellen den Font
+/*N*/ // und schon haben wir den Salat (3322).
+/*N*/ rInf.SelectFont();
+/*N*/ if( pRet->GetAscent() > nAscent )
+/*N*/ {
+/*N*/ aBase.Y() = Y() + pRet->GetAscent();
+/*N*/ nMode |= SETBASE_ULSPACE;
+/*N*/ if( !rInf.IsTest() )
+/*N*/ aTmpBase = aBase;
+/*N*/ if ( GetInfo().GetTxtFrm()->IsVertical() )
+/*?*/ GetInfo().GetTxtFrm()->SwitchHorizontalToVertical( aTmpBase );
+/*N*/
+/*N*/ pRet->SetBase( *rInf.GetTxtFrm(), aTmpBase, nTmpAscent,
+/*N*/ nTmpDescent, nFlyAsc, nFlyDesc, nMode );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pRet = new SwFlyCntPortion( *rInf.GetTxtFrm(), (SwDrawContact*)pFrmFmt->FindContactObj(),
+/*N*/ aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode );
+/*N*/ }
+/*N*/ return pRet;
+/*N*/ }
+
+
+
+/*************************************************************************
+ * SwTxtFly::SwTxtFly()
+ *************************************************************************/
+
+/*N*/ SwTxtFly::SwTxtFly( const SwTxtFly& rTxtFly )
+/*N*/ {
+/*N*/ pPage = rTxtFly.pPage;
+/*N*/ pCurrFly = rTxtFly.pCurrFly;
+/*N*/ pCurrFrm = rTxtFly.pCurrFrm;
+/*N*/ pMaster = rTxtFly.pMaster;
+/*N*/ if( rTxtFly.pFlyList )
+/*N*/ {
+/*N*/ pFlyList = new SwFlyList( (BYTE)rTxtFly.pFlyList->Count(), 10 );
+/*N*/ pFlyList->Insert( rTxtFly.pFlyList, 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ pFlyList = NULL;
+/*N*/
+/*N*/ bOn = rTxtFly.bOn;
+/*N*/ bLeftSide = rTxtFly.bLeftSide;
+/*N*/ bTopRule = rTxtFly.bTopRule;
+/*N*/ }
+
+/*N*/ void SwTxtFly::CtorInit( const SwTxtFrm *pFrm )
+/*N*/ {
+/*N*/ mbIgnoreCurrentFrame = sal_False;
+/*N*/ mbIgnoreContour = sal_False;
+/*N*/ pPage = pFrm->FindPageFrm();
+/*N*/ const SwFlyFrm* pTmp = pFrm->FindFlyFrm();
+/*N*/ pCurrFly = pTmp ? pTmp->GetVirtDrawObj() : NULL;
+/*N*/ pCurrFrm = pFrm;
+/*N*/ pMaster = pCurrFrm->IsFollow() ? NULL : pCurrFrm;
+/*N*/ pFlyList = NULL;
+/*N*/ // Wenn wir nicht von einem Frame ueberlappt werden, oder wenn
+/*N*/ // es gar keine FlyCollection gibt, dann schaltet wir uns fuer immer ab.
+/*N*/ // Aber es koennte sein, dass waehrend der Formatierung eine Zeile
+/*N*/ // hinzukommt, die in einen Frame hineinragt. Deswegen keine Optimierung
+/*N*/ // per bOn = pSortedFlys && IsAnyFrm();
+/*N*/ bOn = pPage->GetSortedObjs() != 0;
+/*N*/ bTopRule = sal_True;
+/*N*/ bLeftSide = sal_False;
+/*N*/ nMinBottom = 0;
+/*N*/ nIndex = ULONG_MAX;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::_GetFrm()
+ *
+ * IN: dokumentglobal (rRect)
+ * OUT: framelokal (return-Wert)
+ * Diese Methode wird waehrend der Formatierung vom LineIter gerufen.
+ * 1. um die naechste FlyPortion vorzubereiten
+ * 2. um nach Aenderung der Zeilenhoehe neue Ueberlappungen festzustellen
+ *************************************************************************/
+
+/*N*/ SwRect SwTxtFly::_GetFrm( const SwRect &rRect, sal_Bool bTop ) const
+/*N*/ {
+/*N*/ SwRect aRet;
+/*N*/ if( ForEach( rRect, &aRet, sal_True ) )
+/*N*/ {
+/*N*/ SWRECTFN( pCurrFrm )
+/*N*/ if( bTop )
+/*N*/ (aRet.*fnRect->fnSetTop)( (rRect.*fnRect->fnGetTop)() );
+/*N*/
+/*N*/ // 8110: Bottom nicht immer anpassen.
+/*N*/ const SwTwips nRetBottom = (aRet.*fnRect->fnGetBottom)();
+/*N*/ const SwTwips nRectBottom = (rRect.*fnRect->fnGetBottom)();
+/*N*/ if ( (*fnRect->fnYDiff)( nRetBottom, nRectBottom ) > 0 ||
+/*N*/ (aRet.*fnRect->fnGetHeight)() < 0 )
+/*N*/ (aRet.*fnRect->fnSetBottom)( nRectBottom );
+/*N*/ }
+/*N*/ return aRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::IsAnyFrm()
+ *
+ * IN: dokumentglobal
+ * fuer die Printarea des aktuellen Frame
+ *
+ * dient zum Abschalten des SwTxtFly, wenn keine Objekte ueberlappen (Relax)
+ *
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFly::IsAnyFrm() const
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( pCurrFrm )
+/*N*/
+/*N*/ ASSERT( bOn, "IsAnyFrm: Why?" );
+/*N*/ SwRect aRect( pCurrFrm->Frm().Pos() + pCurrFrm->Prt().Pos(),
+/*N*/ pCurrFrm->Prt().SSize() );
+/*N*/
+/*N*/ const sal_Bool bRet = ForEach( aRect, NULL, sal_False );
+/*N*/ UNDO_SWAP( pCurrFrm )
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::IsAnyObj()
+ *
+ * IN: dokumentglobal
+ * OUT: sal_True Wenn ein Rahmen oder DrawObj beruecksichtigt werden muss
+ * Nur wenn IsAnyObj sal_False liefert, koennen Optimierungen benutzt werden
+ * wie Paint/FormatEmpty fuer leere Absaetze
+ * und auch das virtuelle Outputdevice.
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const
+/*N*/ {
+/*N*/ ASSERT ( bOn, "SwTxtFly::IsAnyObj: Who's knocking?" );
+/*N*/
+/*N*/ SwRect aRect( rRect );
+/*N*/ if ( aRect.IsEmpty() )
+/*N*/ aRect = SwRect( pCurrFrm->Frm().Pos() + pCurrFrm->Prt().Pos(),
+/*N*/ pCurrFrm->Prt().SSize() );
+/*N*/
+/*N*/ const SwSortDrawObjs *pSorted = pPage->GetSortedObjs();
+/*N*/ if( pSorted ) // Eigentlich ist durch bOn sichergestellt, dass es an der
+/*N*/ // Seite Objekte gibt, aber wer weiss, wer inzwischen etwas geloescht hat.
+/*N*/ {
+/*N*/ for ( MSHORT i = 0; i < pSorted->Count(); ++i )
+/*N*/ {
+/*N*/ const SdrObject *pObj = (*pSorted)[i];
+/*N*/
+/*N*/ const SwRect aBound( GetBoundRect( pObj ) );
+/*N*/
+/*N*/ // Optimierung
+/*N*/ if( pObj->GetBoundRect().Left() > aRect.Right() )
+/*N*/ continue;
+/*N*/
+/*N*/ if( pCurrFly != pObj && aBound.IsOver( aRect ) )
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+/*N*/ const SwCntntFrm* SwTxtFly::_GetMaster()
+/*N*/ {
+/*N*/ pMaster = pCurrFrm;
+/*N*/ while( pMaster->IsFollow() )
+/*N*/ pMaster = (SwCntntFrm*)pMaster->FindMaster();
+/*N*/ return pMaster;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::DrawTextOpaque()
+ *
+ * IN: dokumentglobal
+ * DrawTextOpaque() wird von DrawText() gerufen.
+ * Die Clipregions werden so gesetzt, dass nur die Teile ausgegeben werden,
+ * die nicht in den Bereichen von FlyFrms liegen, die undurchsichtig und
+ * ueber dem aktuellen Frame liegen.
+ * Die On-Optimierung uebernimmt DrawText()!
+ *************************************************************************/
+
+#define UINT32_MAX 0xFFFFFFFF
+
+
+/*************************************************************************
+ * SwTxtFly::DrawFlyRect()
+ *
+ * IN: windowlokal
+ * Zwei Feinheiten gilt es zu beachten:
+ * 1) DrawRect() oberhalb des ClipRects sind erlaubt !
+ * 2) FlyToRect() liefert groessere Werte als die Framedaten !
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFly::GetTop()
+ *
+ * GetTop() ueberprueft, ob pNew ueber pCurrFly liegt (Z-Order).
+ * Es gilt, dass die unten liegenden die obenliegenden beachten nicht
+ * umgekehrt !
+ * Returnwert: pNew, wenn pNew ueber pCurrFly liegt, ansonsten 0.
+ * wird nur von InitFlyList benutzt, um die in Frage kommenden Objekte
+ * einzusammeln.
+ *************************************************************************/
+
+/*M*/ sal_Bool SwTxtFly::GetTop( const SdrObject *pNew, const sal_Bool bInFtn,
+/*M*/ const sal_Bool bInFooterOrHeader )
+/*M*/ {
+/*M*/ if( pNew != pCurrFly )
+/*M*/ {
+/*N*/ // #102344# Ignore connectors which have one or more connections
+/*N*/ if(pNew && pNew->ISA(SdrEdgeObj))
+/*N*/ {
+/*N*/ if(((SdrEdgeObj*)pNew)->GetConnectedNode(TRUE)
+/*N*/ || ((SdrEdgeObj*)pNew)->GetConnectedNode(FALSE))
+/*N*/ {
+/*N*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*M*/ if( ( bInFtn || bInFooterOrHeader ) && bTopRule )
+/*M*/ {
+/*M*/ SwFrmFmt *pFmt = ((SwContact*)GetUserCall(pNew))->GetFmt();
+/*M*/ const SwFmtAnchor& rNewA = pFmt->GetAnchor();
+/*M*/
+/*M*/ if ( FLY_PAGE == rNewA.GetAnchorId() )
+/*M*/ {
+/*M*/ if ( bInFtn )
+/*M*/ return sal_False;
+/*M*/
+/*M*/ if ( bInFooterOrHeader )
+/*M*/ {
+/*M*/ SwFmtVertOrient aVert( pFmt->GetVertOrient() );
+/*M*/ BOOL bVertPrt = aVert.GetRelationOrient() == PRTAREA ||
+/*M*/ aVert.GetRelationOrient() == REL_PG_PRTAREA;
+/*M*/ if( bVertPrt )
+/*M*/ return sal_False;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ sal_Bool bEvade = !pCurrFly //Selbst nicht im Fly -> allen ausweichen.
+/*M*/ //Den Lowern ist auszuweichen.
+/*M*/ || Is_Lower_Of(((SwVirtFlyDrawObj*)pCurrFly)->GetFlyFrm(), pNew);
+/*M*/ if ( !bEvade )
+/*M*/ {
+/*M*/ if ( !bTopRule )
+/*M*/ bEvade = sal_True; // nur an der Paint-Ordnung interessiert
+/*M*/ else
+/*M*/ {
+/*M*/ // innerhalb von verketteten Flys wird nur Lowern ausgewichen
+/*M*/ const SwFmtChain &rChain = ((SwContact*)GetUserCall(pCurrFly))->GetFmt()->GetChain();
+/*M*/ if ( !rChain.GetPrev() && !rChain.GetNext() )
+/*M*/ {
+/*M*/ // Ausweichregel fuer Text:
+/*M*/ const SwFmtAnchor& rNewA =
+/*M*/ ((SwContact*)GetUserCall(pNew))->GetFmt()->GetAnchor();
+/*M*/ const SwFmtAnchor& rCurrA =
+/*M*/ ((SwContact*)GetUserCall(pCurrFly))->GetFmt()->GetAnchor();
+/*M*/ if( FLY_IN_CNTNT == rCurrA.GetAnchorId() )
+/*M*/ return sal_False; // Zeichengebundene weichen nur Lowern aus.
+/*M*/ if( FLY_PAGE == rNewA.GetAnchorId() )
+/*M*/ { //Chg: Seitengebundenen wird nur noch von anderen
+/*M*/ // seitengebundenen ausgewichen!
+/*M*/ if( FLY_PAGE == rCurrA.GetAnchorId() )
+/*M*/ bEvade = sal_True;
+/*M*/ else
+/*M*/ return sal_False;
+/*M*/ }
+/*M*/ else if( FLY_PAGE == rCurrA.GetAnchorId() )
+/*M*/ return sal_False; // Seitengebundene weichen nur seitengeb. aus
+/*M*/ else if( FLY_AT_FLY == rNewA.GetAnchorId() )
+/*M*/ bEvade = sal_True; // Nicht seitengeb. weichen Rahmengeb. aus
+/*M*/ else if( FLY_AT_FLY == rCurrA.GetAnchorId() )
+/*M*/ return sal_False; // Rahmengebundene weichen abs.geb. nicht aus
+/*M*/ else if( bInFooterOrHeader )
+/*M*/ return sal_False; // In header or footer no wrapping
+/*M*/ // if both bounded at paragraph
+/*M*/ else // Zwei Flies mit (auto-)absatzgebunder Verankerung ...
+/*M*/ // ... entscheiden nach der Reihenfolge ihrer Anker im Dok.
+/*M*/ bEvade = rNewA.GetCntntAnchor()->nNode.GetIndex() <=
+/*M*/ rCurrA.GetCntntAnchor()->nNode.GetIndex();
+/*M*/ }
+/*M*/ }
+/*M*/ // aber: es wird niemals einem hierarchisch untergeordnetem
+/*M*/ // ausgewichen und ausserdem braucht nur bei Ueberlappung
+/*M*/ // ausgewichen werden.
+/*M*/ bEvade &= ( pCurrFly->GetOrdNum() < pNew->GetOrdNum() );
+/*M*/ if( bEvade )
+/*M*/ {
+/*M*/ SwRect aTmp( GetBoundRect( pNew ) );
+/*M*/ if( !aTmp.IsOver( pCurrFly->GetBoundRect() ) )
+/*M*/ bEvade = sal_False;
+/*M*/ }
+/*M*/ }
+/*M*/ if ( bEvade )
+/*M*/ {
+/*M*/ const SwFmtAnchor& rNewA =
+/*M*/ ((SwContact*)GetUserCall(pNew))->GetFmt()->GetAnchor();
+/*M*/ ASSERT( FLY_IN_CNTNT != rNewA.GetAnchorId(), "Don't call GetTop with a FlyInCntFrm" );
+/*M*/ if( FLY_PAGE == rNewA.GetAnchorId() )
+/*M*/ return sal_True; // Seitengebundenen wird immer ausgewichen.
+/*M*/
+/*M*/ // Wenn absatzgebundene Flys in einem FlyCnt gefangen sind, so
+/*M*/ // endet deren Einflussbereich an den Grenzen des FlyCnt!
+/*M*/ // Wenn wir aber gerade den Text des FlyCnt formatieren, dann
+/*M*/ // muss er natuerlich dem absatzgebundenen Frm ausweichen!
+/*M*/ // pCurrFrm ist der Anker von pNew?
+/*N*/ const SwFrm* pTmp = &lcl_TheAnchor( pNew );
+/*M*/ if( pTmp == pCurrFrm )
+/*M*/ return sal_True;
+/*M*/ if( pTmp->IsTxtFrm() && ( pTmp->IsInFly() || pTmp->IsInFtn() ) )
+/*M*/ {
+/*M*/ Point aPos;
+/*M*/ if( pNew->IsWriterFlyFrame() )
+/*M*/ aPos = ( (SwVirtFlyDrawObj*)pNew )->GetFlyFrm()->Frm().Pos();
+/*M*/ else
+/*M*/ aPos = pNew->GetBoundRect().TopLeft();
+/*M*/ pTmp = GetVirtualUpper( pTmp, aPos );
+/*M*/ }
+/*M*/ if( pCurrFrm->GetNext() != pTmp &&
+/*M*/ IsFrmInSameKontext( pTmp, pCurrFrm ) )
+/*M*/ {
+/*M*/ if( FLY_AT_FLY == rNewA.GetAnchorId() ) // LAYER_IMPL
+/*M*/ return sal_True; // Rahmengebundenen ausweichen.
+/*M*/ // Den Index des anderen erhalten wir immer ueber das Ankerattr.
+/*M*/ ULONG nTmpIndex = rNewA.GetCntntAnchor()->nNode.GetIndex();
+/*M*/ // Jetzt wird noch ueberprueft, ob der aktuelle Absatz vor dem
+/*M*/ // Anker des verdraengenden Objekts im Text steht, dann wird
+/*M*/ // nicht ausgewichen.
+/*M*/ // Der Index wird moeglichst ueber einen SwFmtAnchor ermittelt,
+/*M*/ // da sonst recht teuer.
+/*M*/ if( ULONG_MAX == nIndex )
+/*M*/ nIndex = pCurrFrm->GetNode()->GetIndex();
+/*M*/
+/*M*/ if( nIndex >= nTmpIndex )
+/*M*/ return sal_True;
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ return 0;
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFly::InitFlyList()
+ *
+ * fuellt die FlyList mit den Objekten, denen ggf. ausgwichen werden muss
+ *
+ *************************************************************************/
+
+/*N*/ SwFlyList *SwTxtFly::InitFlyList()
+/*N*/ {
+/*N*/ ASSERT( pCurrFrm, "InitFlyList: No Frame, no FlyList" );
+/*N*/ ASSERT( !pFlyList, "InitFlyList: FlyList already initialized" );
+/*N*/
+/*N*/ SWAP_IF_SWAPPED( pCurrFrm )
+/*N*/
+/*N*/ const SwSortDrawObjs *pSorted = pPage->GetSortedObjs();
+/*N*/ const MSHORT nCount = pSorted ? pSorted->Count() : 0;
+/*N*/ bOn = sal_False;
+/*N*/ if( nCount )
+/*N*/ {
+/*N*/ pFlyList = new SwFlyList( 10, 10 );
+/*N*/
+/*N*/ SwRect aRect( pCurrFrm->Prt() );
+/*N*/ aRect += pCurrFrm->Frm().Pos();
+/*N*/ // Wir machen uns etwas kleiner als wir sind,
+/*N*/ // damit Ein-Twip-Ueberlappungen ignoriert werden. (#49532)
+/*N*/ SWRECTFN( pCurrFrm )
+/*N*/ const long nRight = (aRect.*fnRect->fnGetRight)() - 1;
+/*N*/ const long nLeft = (aRect.*fnRect->fnGetLeft)() + 1;
+/*N*/ const sal_Bool bFooter = pCurrFrm->IsInFtn();
+/*N*/ const sal_Bool bR2L = pCurrFrm->IsRightToLeft();
+/*N*/
+/*N*/ for( MSHORT i = 0; i < nCount; i++ )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pSorted)[ i ];
+/*N*/ const SwRect aBound( GetBoundRect( pO ) );
+/*N*/
+/*N*/ if( nRight < (aBound.*fnRect->fnGetLeft)() ||
+/*N*/ (*fnRect->fnYDiff)( (aRect.*fnRect->fnGetTop)(),
+/*N*/ (aBound.*fnRect->fnGetBottom)() ) > 0 ||
+/*N*/ nLeft > (aBound.*fnRect->fnGetRight)() )
+/*N*/ continue;
+/*N*/
+/*N*/ if( GetTop( pO, pCurrFrm->IsInFtn(),
+/*N*/ 0 != pCurrFrm->FindFooterOrHeader() ) )
+/*N*/ {
+/*N*/ // OD 11.03.2003 #107862# - adjust insert position:
+/*N*/ // overlapping objects should be sorted from left to right and
+/*N*/ // inside left to right sorting from top to bottom.
+/*N*/ // If objects on the same position are found, they are sorted
+/*N*/ // on its width.
+/*N*/ sal_uInt16 nPos = pFlyList->Count();
+/*N*/ while ( nPos )
+/*N*/ {
+/*N*/ SdrObject* pTmpObj = (*pFlyList)[ --nPos ];
+/*N*/ const SwRect aBoundRectOfTmpObj( GetBoundRect( pTmpObj ) );
+/*N*/ if ( ( bR2L &&
+/*N*/ ( (aBoundRectOfTmpObj.*fnRect->fnGetRight)() ==
+/*N*/ (aBound.*fnRect->fnGetRight)() ) ) ||
+/*N*/ ( !bR2L &&
+/*N*/ ( (aBoundRectOfTmpObj.*fnRect->fnGetLeft)() ==
+/*N*/ (aBound.*fnRect->fnGetLeft)() ) ) )
+/*N*/ {
+/*N*/ SwTwips nTopDiff =
+/*N*/ (*fnRect->fnYDiff)( (aBound.*fnRect->fnGetTop)(),
+/*N*/ (aBoundRectOfTmpObj.*fnRect->fnGetTop)() );
+/*N*/ if ( nTopDiff == 0 &&
+/*N*/ ( ( bR2L &&
+/*N*/ ( (aBound.*fnRect->fnGetLeft)() >
+/*N*/ (aBoundRectOfTmpObj.*fnRect->fnGetLeft)() ) ) ||
+/*N*/ ( !bR2L &&
+/*N*/ ( (aBound.*fnRect->fnGetRight)() <
+/*N*/ (aBoundRectOfTmpObj.*fnRect->fnGetRight)() ) ) ) )
+/*N*/ {
+/*N*/ ++nPos;
+/*N*/ break;
+/*N*/ }
+/*N*/ else if ( nTopDiff > 0 )
+/*N*/ {
+/*N*/ ++nPos;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( ( bR2L &&
+/*N*/ ( (aBoundRectOfTmpObj.*fnRect->fnGetRight)() >
+/*N*/ (aBound.*fnRect->fnGetRight)() ) ) ||
+/*N*/ ( !bR2L &&
+/*N*/ ( (aBoundRectOfTmpObj.*fnRect->fnGetLeft)() <
+/*N*/ (aBound.*fnRect->fnGetLeft)() ) ) )
+/*N*/ {
+/*N*/ ++nPos;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ pFlyList->C40_INSERT( SdrObject, pO, nPos );
+/*N*/
+/*N*/ SwContact *pContact = (SwContact*)GetUserCall(pO);
+/*N*/ const SwFmtSurround &rFlyFmt = pContact->GetFmt()->GetSurround();
+/*N*/ if( rFlyFmt.IsAnchorOnly() && &lcl_TheAnchor( pO ) == GetMaster() )
+/*N*/ {
+/*N*/ const SwFmtVertOrient &rTmpFmt = pContact->GetFmt()->GetVertOrient();
+/*N*/ if( VERT_BOTTOM != rTmpFmt.GetVertOrient() )
+/*N*/ nMinBottom = ( bVert && nMinBottom ) ?
+/*N*/ Min( nMinBottom, aBound.Left() ) :
+/*N*/ Max( nMinBottom, (aBound.*fnRect->fnGetBottom)() );
+/*N*/ }
+/*N*/
+/*N*/ bOn = sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ if( nMinBottom )
+/*N*/ {
+/*N*/ SwTwips nMax = (pCurrFrm->GetUpper()->*fnRect->fnGetPrtBottom)();
+/*N*/ if( (*fnRect->fnYDiff)( nMinBottom, nMax ) > 0 )
+/*N*/ nMinBottom = nMax;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pFlyList = new SwFlyList( 0, 10 );
+/*N*/
+/*N*/ UNDO_SWAP( pCurrFrm )
+/*N*/
+/*N*/ return pFlyList;
+/*N*/ }
+
+/*N*/ SwTwips SwTxtFly::CalcMinBottom() const
+/*N*/ {
+/*N*/ SwTwips nRet = 0;
+/*N*/ const SwDrawObjs *pDrawObj = GetMaster()->GetDrawObjs();
+/*N*/ const MSHORT nCount = pDrawObj ? pDrawObj->Count() : 0;
+/*N*/ if( nCount )
+/*N*/ {
+/*N*/ SwTwips nEndOfFrm = pCurrFrm->Frm().Bottom();
+/*N*/ for( MSHORT i = 0; i < nCount; i++ )
+/*N*/ {
+/*N*/ SdrObject *pO = (*pDrawObj)[ i ];
+/*N*/ SwContact *pContact = (SwContact*)GetUserCall(pO);
+/*N*/ const SwFmtSurround &rFlyFmt = pContact->GetFmt()->GetSurround();
+/*N*/ if( rFlyFmt.IsAnchorOnly() )
+/*N*/ {
+/*?*/ const SwFmtVertOrient &rTmpFmt = pContact->GetFmt()->GetVertOrient();
+/*?*/ if( VERT_BOTTOM != rTmpFmt.GetVertOrient() )
+/*?*/ {
+/*?*/ const SwRect aBound( GetBoundRect( pO ) );
+/*?*/ if( aBound.Top() < nEndOfFrm )
+/*?*/ nRet = Max( nRet, aBound.Bottom() );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ SwTwips nMax = pCurrFrm->GetUpper()->Frm().Top() +
+/*N*/ pCurrFrm->GetUpper()->Prt().Bottom();
+/*N*/ if( nRet > nMax )
+/*N*/ nRet = nMax;
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+ * Hier erfolgt die Berechnung der Kontur ...
+ * CalcBoundRect(..) und andere
+ *************************************************************************/
+
+/*************************************************************************
+ * class SwContourCache
+ *************************************************************************/
+
+/*N*/ SwContourCache::SwContourCache() :
+/*N*/ nObjCnt( 0 ), nPntCnt( 0 )
+/*N*/ {
+/*N*/ memset( (SdrObject**)pSdrObj, 0, sizeof(pSdrObj) );
+/*N*/ memset( pTextRanger, 0, sizeof(pTextRanger) );
+/*N*/ }
+/*N*/
+/*N*/ SwContourCache::~SwContourCache()
+/*N*/ {
+/*N*/ for( MSHORT i = 0; i < nObjCnt; delete pTextRanger[ i++ ] )
+/*N*/ ;
+/*N*/ }
+
+/*?*/ void SwContourCache::ClrObject( MSHORT nPos )
+/*?*/ {
+/*?*/ ASSERT( pTextRanger[ nPos ], "ClrObject: Allready cleared. Good Bye!" );
+/*?*/ nPntCnt -= pTextRanger[ nPos ]->GetPointCount();
+/*?*/ delete pTextRanger[ nPos ];
+/*?*/ --nObjCnt;
+/*?*/ memmove( (SdrObject**)pSdrObj + nPos, pSdrObj + nPos + 1,
+/*?*/ ( nObjCnt - nPos ) * sizeof( SdrObject* ) );
+/*?*/ memmove( pTextRanger + nPos, pTextRanger + nPos + 1,
+/*?*/ ( nObjCnt - nPos ) * sizeof( TextRanger* ) );
+/*?*/ }
+
+/*N*/ void ClrContourCache( const SdrObject *pObj )
+/*N*/ {
+/*N*/ if( pContourCache && pObj )
+/*N*/ for( MSHORT i = 0; i < pContourCache->GetCount(); ++i )
+/*N*/ if( pObj == pContourCache->GetObject( i ) )
+/*N*/ {
+/*?*/ pContourCache->ClrObject( i );
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+
+/*N*/ void ClrContourCache()
+/*N*/ {
+/*N*/ if( pContourCache )
+/*N*/ {
+/*N*/ for( MSHORT i = 0; i < pContourCache->GetCount();
+/*N*/ delete pContourCache->pTextRanger[ i++ ] )
+/*N*/ ;
+/*N*/ pContourCache->nObjCnt = 0;
+/*N*/ pContourCache->nPntCnt = 0;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwContourCache::CalcBoundRect
+ * berechnet das Rechteck, welches vom Objekt in der angegebenen Zeile
+ * ueberdeckt wird.
+ * Bei _nicht_ konturumflossenen Objekten ist dies einfach die Ueber-
+ * lappung von BoundRect (inkl. Abstand!) und Zeile,
+ * bei Konturumfluss wird das Polypolygon des Objekts abgeklappert
+ *************************************************************************/
+
+/*N*/ const SwRect SwContourCache::CalcBoundRect( const SdrObject* pObj,
+/*N*/ const SwRect &rLine, const SwTxtFrm* pFrm, const long nXPos,
+/*N*/ const sal_Bool bRight )
+/*N*/ {
+/*N*/ SWRECTFN( pFrm )
+/*N*/
+/*N*/ SwRect aRet;
+/*N*/ const SwFmt *pFmt =
+/*N*/ ((SwContact*)GetUserCall(pObj))->GetFmt();
+/*N*/ if( pFmt->GetSurround().IsContour() &&
+/*N*/ ( !pObj->IsWriterFlyFrame() ||
+/*N*/ ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->Lower() &&
+/*N*/ ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->Lower()->IsNoTxtFrm() ) )
+/*N*/ {
+/*N*/ aRet = GetBoundRect( pObj );
+/*N*/ if( aRet.IsOver( rLine ) )
+/*N*/ {
+/*N*/ if( !pContourCache )
+/*N*/ pContourCache = new SwContourCache;
+/*N*/
+/*N*/ aRet = pContourCache->ContourRect(
+/*N*/ pFmt, pObj, pFrm, rLine, nXPos, bRight );
+/*N*/ }
+/*N*/ else
+/*N*/ aRet.Width( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aRet = GetBoundRect( pObj );
+/*N*/ }
+/*N*/
+/*N*/ return aRet;
+/*N*/ }
+
+/*N*/ const SwRect SwContourCache::ContourRect( const SwFmt* pFmt,
+/*N*/ const SdrObject* pObj, const SwTxtFrm* pFrm, const SwRect &rLine,
+/*N*/ const long nXPos, const sal_Bool bRight )
+/*N*/ {
+/*N*/ SwRect aRet;
+/*N*/ MSHORT nPos = 0; // Suche im Cache ...
+/*N*/ while( nPos < GetCount() && pObj != pSdrObj[ nPos ] )
+/*N*/ ++nPos;
+/*N*/ if( GetCount() == nPos ) // nicht gefunden
+/*N*/ {
+/*N*/ if( nObjCnt == POLY_CNT )
+/*N*/ {
+/*?*/ nPntCnt -= pTextRanger[ --nObjCnt ]->GetPointCount();
+/*?*/ delete pTextRanger[ nObjCnt ];
+/*N*/ }
+/*N*/ XPolyPolygon aXPoly;
+/*N*/ XPolyPolygon *pXPoly = NULL;
+/*N*/ if ( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ // Vorsicht #37347: Das GetContour() fuehrt zum Laden der Grafik,
+/*N*/ // diese aendert dadurch ggf. ihre Groesse, ruft deshalb ein
+/*N*/ // ClrObject() auf.
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 PolyPolygon aPoly;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pObj->ISA( E3dObject ) )
+/*N*/ pObj->TakeXorPoly( aXPoly, sal_True );
+/*N*/ pXPoly = new XPolyPolygon();
+/*N*/ pObj->TakeContour( *pXPoly );
+/*N*/ }
+/*N*/ const SvxLRSpaceItem &rLRSpace = pFmt->GetLRSpace();
+/*N*/ const SvxULSpaceItem &rULSpace = pFmt->GetULSpace();
+/*N*/ memmove( pTextRanger + 1, pTextRanger, nObjCnt * sizeof( TextRanger* ) );
+/*N*/ memmove( (SdrObject**)pSdrObj + 1, pSdrObj, nObjCnt++ * sizeof( SdrObject* ) );
+/*N*/ pSdrObj[ 0 ] = pObj; // Wg. #37347 darf das Object erst nach dem
+/*N*/ // GetContour() eingetragen werden.
+/*N*/ pTextRanger[ 0 ] = new TextRanger( aXPoly, pXPoly, 20,
+/*N*/ (USHORT)rLRSpace.GetLeft(), (USHORT)rLRSpace.GetRight(),
+/*N*/ pFmt->GetSurround().IsOutside(), sal_False, pFrm->IsVertical() );
+/*N*/ pTextRanger[ 0 ]->SetUpper( rULSpace.GetUpper() );
+/*N*/ pTextRanger[ 0 ]->SetLower( rULSpace.GetLower() );
+/*N*/
+/*N*/ delete pXPoly;
+/*N*/ // UPPER_LOWER_TEST
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( pFmt->GetDoc()->GetRootFrm()->GetCurrShell() )
+/*N*/ {
+/*N*/ sal_Bool bT2 = pFmt->GetDoc()->GetRootFrm()->GetCurrShell()->GetViewOptions()->IsTest2();
+/*N*/ sal_Bool bT6 = pFmt->GetDoc()->GetRootFrm()->GetCurrShell()->GetViewOptions()->IsTest6();
+/*N*/ if( bT2 || bT6 )
+/*N*/ {
+/*?*/ if( bT2 )
+/*?*/ pTextRanger[ 0 ]->SetFlag7( sal_True );
+/*?*/ else
+/*?*/ pTextRanger[ 0 ]->SetFlag6( sal_True );
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ nPntCnt += pTextRanger[ 0 ]->GetPointCount();
+/*N*/ while( nPntCnt > POLY_MAX && nObjCnt > POLY_MIN )
+/*N*/ {
+/*?*/ nPntCnt -= pTextRanger[ --nObjCnt ]->GetPointCount();
+/*?*/ delete pTextRanger[ nObjCnt ];
+/*N*/ }
+/*N*/ }
+/*N*/ else if( nPos )
+/*N*/ {
+/*N*/ const SdrObject* pTmpObj = pSdrObj[ nPos ];
+/*N*/ TextRanger* pTmpRanger = pTextRanger[ nPos ];
+/*N*/ memmove( (SdrObject**)pSdrObj + 1, pSdrObj, nPos * sizeof( SdrObject* ) );
+/*N*/ memmove( pTextRanger + 1, pTextRanger, nPos * sizeof( TextRanger* ) );
+/*N*/ pSdrObj[ 0 ] = pTmpObj;
+/*N*/ pTextRanger[ 0 ] = pTmpRanger;
+/*N*/ }
+/*N*/ SWRECTFN( pFrm )
+/*N*/ long nTmpTop = (rLine.*fnRect->fnGetTop)();
+/*N*/ // fnGetBottom is top + height
+/*N*/ long nTmpBottom = (rLine.*fnRect->fnGetBottom)();
+/*N*/
+/*N*/ Range aRange( Min( nTmpTop, nTmpBottom ), Max( nTmpTop, nTmpBottom ) );
+/*N*/
+/*N*/ SvLongs *pTmp = pTextRanger[ 0 ]->GetTextRanges( aRange );
+/*N*/
+/*N*/ MSHORT nCount;
+/*N*/ if( 0 != ( nCount = pTmp->Count() ) )
+/*N*/ {
+/*N*/ MSHORT nIdx = 0;
+/*N*/ while( nIdx < nCount && (*pTmp)[ nIdx ] < nXPos )
+/*N*/ ++nIdx;
+/*N*/ sal_Bool bOdd = nIdx % 2 ? sal_True : sal_False;
+/*N*/ sal_Bool bSet = sal_True;
+/*N*/ if( bOdd )
+/*N*/ --nIdx; // innerhalb eines Intervalls
+/*N*/ else if( ! bRight && ( nIdx >= nCount || (*pTmp)[ nIdx ] != nXPos ) )
+/*N*/ {
+/*N*/ if( nIdx )
+/*N*/ nIdx -= 2; // ein Intervall nach links gehen
+/*N*/ else
+/*N*/ bSet = sal_False; // vor dem erstem Intervall
+/*N*/ }
+/*N*/
+/*N*/ if( bSet && nIdx < nCount )
+/*N*/ {
+/*N*/ (aRet.*fnRect->fnSetTopAndHeight)( (rLine.*fnRect->fnGetTop)(),
+/*N*/ (rLine.*fnRect->fnGetHeight)() );
+/*N*/ (aRet.*fnRect->fnSetLeft)( (*pTmp)[ nIdx ] );
+/*N*/ (aRet.*fnRect->fnSetRight)( (*pTmp)[ nIdx + 1 ] + 1 );
+/*N*/ }
+/*N*/ }
+/*N*/ return aRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwContourCache::ShowContour()
+ * zeichnet die PolyPolygone des Caches zu Debugzwecken.
+ *************************************************************************/
+#ifdef DBG_UTIL
+
+#endif
+
+/*************************************************************************
+ * SwTxtFly::ShowContour()
+ * zeichnet die PolyPolygone des Caches zu Debugzwecken.
+ *************************************************************************/
+#ifdef DBG_UTIL
+
+#endif
+
+/*************************************************************************
+ * SwTxtFly::ForEach()
+ *
+ * sucht nach dem ersten Objekt, welches mit dem Rechteck ueberlappt
+ *
+ *************************************************************************/
+
+/*M*/ sal_Bool SwTxtFly::ForEach( const SwRect &rRect, SwRect* pRect, sal_Bool bAvoid ) const
+/*M*/ {
+/*M*/ SWAP_IF_SWAPPED( pCurrFrm )
+/*M*/
+/*M*/ sal_Bool bRet = sal_False;
+/*M*/ MSHORT nCount;
+/*M*/ if( bOn && ( 0 != ( nCount = GetFlyList()->Count() ) ) )
+/*M*/ {
+/*M*/ for( MSHORT i = 0; i < nCount; ++i )
+/*M*/ {
+/*M*/ const SdrObject *pObj = (*pFlyList)[ i ];
+/*M*/
+/*M*/ SwRect aRect( GetBoundRect( pObj ) );
+/*M*/
+/*M*/ // Optimierung
+/*M*/ SWRECTFN( pCurrFrm )
+/*M*/ if( (aRect.*fnRect->fnGetLeft)() > (rRect.*fnRect->fnGetRight)() )
+/*M*/ break;
+/*M*/ if( pCurrFly != pObj && aRect.IsOver( rRect ) )
+/*M*/ {
+/*M*/ const SwFmt *pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
+/*M*/ const SwFmtSurround &rSur = pFmt->GetSurround();
+/*M*/ if( bAvoid )
+/*M*/ {
+/*M*/ // Wenn der Text drunter durchlaeuft, bleibt die
+/*M*/ // Formatierung unbeeinflusst. Im LineIter::DrawText()
+/*M*/ // muessen "nur" geschickt die ClippingRegions gesetzt werden ...
+/*M*/ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+/*M*/ if( ( SURROUND_THROUGHT == rSur.GetSurround() &&
+/*M*/ ( !rSur.IsAnchorOnly() ||
+/*N*/ GetMaster() == &lcl_TheAnchor( pObj ) ||
+/*N*/ ( FLY_AT_CNTNT != rAnchor.GetAnchorId() &&
+/*N*/ FLY_AUTO_CNTNT != rAnchor.GetAnchorId() ) ) )
+/*N*/ || aRect.Top() == WEIT_WECH )
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ if ( mbIgnoreCurrentFrame && pCurrFrm == &lcl_TheAnchor( pObj ) )
+/*N*/ continue;
+/*N*/
+/*N*/ if( pRect )
+/*N*/ {
+/*N*/ SwRect aFly = FlyToRect( pObj, rRect );
+/*N*/ if( aFly.IsEmpty() || !aFly.IsOver( rRect ) )
+/*N*/ continue;
+/*N*/ if( !bRet ||
+/*N*/ ( !pCurrFrm->IsRightToLeft() &&
+/*N*/ ( (aFly.*fnRect->fnGetLeft)() <
+/*N*/ (pRect->*fnRect->fnGetLeft)() ) ||
+/*N*/ ( pCurrFrm->IsRightToLeft() &&
+/*N*/ ( (aFly.*fnRect->fnGetRight)() >
+/*N*/ (pRect->*fnRect->fnGetRight)() ) ) ) )
+/*N*/ *pRect = aFly;
+/*N*/ if( rSur.IsContour() )
+/*N*/ {
+/*N*/ bRet = sal_True;
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ bRet = sal_True;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( pCurrFrm )
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::GetPos()
+ *
+ * liefert die Position im sorted Array zurueck
+ *************************************************************************/
+
+/*N*/ MSHORT SwTxtFly::GetPos( const SdrObject *pObj ) const
+/*N*/ {
+/*N*/ MSHORT nCount = GetFlyList()->Count();
+/*N*/ MSHORT nRet = 0;
+/*N*/ while( nRet < nCount && pObj != (*pFlyList)[ nRet ] )
+/*N*/ ++nRet;
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::CalcRightMargin()
+ *
+ * pObj ist das Object, der uns gerade ueberlappt.
+ * pCurrFrm ist der aktuelle Textframe, der ueberlappt wird.
+ * Der rechte Rand ist der rechte Rand oder
+ * er wird durch das naechste Object, welches in die Zeile ragt, bestimmt.
+ *************************************************************************/
+
+/*N*/ void SwTxtFly::CalcRightMargin( SwRect &rFly, MSHORT nFlyPos,
+/*N*/ const SwRect &rLine ) const
+/*N*/ {
+/*N*/ // Normalerweise ist der rechte Rand der rechte Rand der Printarea.
+/*N*/ ASSERT( ! pCurrFrm->IsVertical() || ! pCurrFrm->IsSwapped(),
+/*N*/ "SwTxtFly::CalcRightMargin with swapped frame" )
+/*N*/ SWRECTFN( pCurrFrm )
+/*N*/ SwTwips nRight = (pCurrFrm->Frm().*fnRect->fnGetLeft)() +
+/*N*/ (pCurrFrm->Prt().*fnRect->fnGetRight)() + 1;
+/*N*/ SwTwips nFlyRight = (rFly.*fnRect->fnGetRight)();
+/*N*/ SwRect aLine( rLine );
+/*N*/ (aLine.*fnRect->fnSetRight)( nRight );
+/*N*/ (aLine.*fnRect->fnSetLeft)( (rFly.*fnRect->fnGetLeft)() );
+/*N*/
+/*N*/ // Es koennte aber sein, dass in die gleiche Zeile noch ein anderes
+/*N*/ // Object hineinragt, welches _ueber_ uns liegt.
+/*N*/ // Wunder der Technik: Flys mit Durchlauf sind fuer die darunterliegenden
+/*N*/ // unsichtbar, das heisst, dass sie bei der Berechnung der Raender
+/*N*/ // anderer Flys ebenfalls nicht auffallen.
+/*N*/ // 3301: pNext->Frm().IsOver( rLine ) ist noetig
+/*N*/ _FlyCntnt eOrder;
+/*N*/
+/*N*/ sal_Bool bStop = sal_False;
+/*N*/ MSHORT nPos = 0;
+/*N*/
+/*N*/ while( nPos < pFlyList->Count() && !bStop )
+/*N*/ {
+/*N*/ if( nPos == nFlyPos )
+/*N*/ {
+/*N*/ ++nPos;
+/*N*/ continue;
+/*N*/ }
+/*N*/ const SdrObject *pNext = (*pFlyList)[ nPos++ ];
+/*N*/ if( pNext == pCurrFly )
+/*N*/ continue;
+/*N*/ eOrder = GetOrder( pNext );
+/*N*/ if( SURROUND_THROUGHT == eOrder )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwRect aTmp( SwContourCache::CalcBoundRect
+/*N*/ ( pNext, aLine, pCurrFrm, nFlyRight, sal_True ) );
+/*N*/ SwTwips nTmpRight = (aTmp.*fnRect->fnGetRight)();
+/*N*/
+/*N*/ // Optimierung:
+/*N*/ // In nNextTop wird notiert, an welcher Y-Positon mit Aenderung der
+/*N*/ // Rahmenverhaeltnisse gerechnet werden muss. Dies dient dazu, dass,
+/*N*/ // obwohl nur die Rahmen in der aktuellen Zeilenhoehe betrachtet werden,
+/*N*/ // bei Rahmen ohne Umlauf die Zeilenhoehe so erhoeht wird, dass mit einer
+/*N*/ // einzigen Zeile die Unterkante das Rahmens oder ggf. die Oberkante des
+/*N*/ // naechsten Rahmen erreicht wird.
+/*N*/ // Insbesondere bei HTML-Dokumenten kommen oft (Dummy-)Absaetze in einer
+/*N*/ // 2-Pt.-Schrift vor, bis diese einem groesseren Rahmen ausgewichen sind,
+/*N*/ // erforderte es frueher Unmengen von Leerzeilen.
+/*N*/ const long nTmpTop = (aTmp.*fnRect->fnGetTop)();
+/*N*/ if( (*fnRect->fnYDiff)( nTmpTop, (aLine.*fnRect->fnGetTop)() ) > 0 )
+/*N*/ {
+/*N*/ if( (*fnRect->fnYDiff)( nNextTop, nTmpTop ) > 0 )
+/*N*/ SetNextTop( nTmpTop ); // Die Oberkante des "naechsten" Rahmens
+/*N*/ }
+/*N*/ else if( ! (aTmp.*fnRect->fnGetWidth)() ) // Typisch fuer Objekte mit Konturumlauf
+/*N*/ { // Bei Objekten mit Konturumlauf, die vor der aktuellen Zeile beginnen
+/*N*/ // und hinter ihr enden, trotzdem aber nicht mit ihr ueberlappen,
+/*N*/ // muss die Optimierung ausgeschaltet werden, denn bereits in der
+/*N*/ // naechsten Zeile kann sich dies aendern.
+/*N*/ if( ! (aTmp.*fnRect->fnGetHeight)() ||
+/*N*/ (*fnRect->fnYDiff)( (aTmp.*fnRect->fnGetBottom)(),
+/*N*/ (aLine.*fnRect->fnGetTop)() ) > 0 )
+/*N*/ SetNextTop( 0 );
+/*N*/ }
+/*N*/ if( aTmp.IsOver( aLine ) && nTmpRight > nFlyRight )
+/*N*/ {
+/*N*/ nFlyRight = nTmpRight;
+/*N*/ switch( eOrder )
+/*N*/ {
+/*N*/ case SURROUND_RIGHT :
+/*N*/ case SURROUND_PARALLEL :
+/*N*/ {
+/*N*/ // der FlyFrm wird ueberstimmt.
+/*N*/ if( nRight > nFlyRight )
+/*N*/ nRight = nFlyRight;
+/*N*/ bStop = sal_True;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ (rFly.*fnRect->fnSetRight)( nRight );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::CalcLeftMargin()
+ *
+ * pFly ist der FlyFrm, der uns gerade ueberlappt.
+ * pCurrFrm ist der aktuelle Textframe, der ueberlappt wird.
+ * Der linke Rand ist der linke Rand der aktuellen PrintArea oder
+ * er wird durch den vorigen FlyFrm, der in die Zeile ragt, bestimmt.
+ *************************************************************************/
+
+/*N*/ void SwTxtFly::CalcLeftMargin( SwRect &rFly, MSHORT nFlyPos,
+/*N*/ const SwRect &rLine ) const
+/*N*/ {
+/*N*/ ASSERT( ! pCurrFrm->IsVertical() || ! pCurrFrm->IsSwapped(),
+/*N*/ "SwTxtFly::CalcLeftMargin with swapped frame" )
+/*N*/ SWRECTFN( pCurrFrm )
+/*N*/ SwTwips nLeft = (pCurrFrm->Frm().*fnRect->fnGetLeft)() +
+/*N*/ (pCurrFrm->Prt().*fnRect->fnGetLeft)();
+/*N*/ const SwTwips nFlyLeft = (rFly.*fnRect->fnGetLeft)();
+/*N*/
+/*N*/ if( nLeft > nFlyLeft )
+/*N*/ nLeft = rFly.Left();
+/*N*/
+/*N*/ SwRect aLine( rLine );
+/*N*/ (aLine.*fnRect->fnSetLeft)( nLeft );
+/*N*/
+/*N*/ // Es koennte aber sein, dass in die gleiche Zeile noch ein anderes
+/*N*/ // Object hineinragt, welches _ueber_ uns liegt.
+/*N*/ // Wunder der Technik: Flys mit Durchlauf sind fuer die darunterliegenden
+/*N*/ // unsichtbar, das heisst, dass sie bei der Berechnung der Raender
+/*N*/ // anderer Flys ebenfalls nicht auffallen.
+/*N*/ // 3301: pNext->Frm().IsOver( rLine ) ist noetig
+/*N*/
+/*N*/ MSHORT nMyPos = nFlyPos;
+/*N*/ while( ++nFlyPos < pFlyList->Count() )
+/*N*/ {
+/*N*/ const SdrObject *pNext = (*pFlyList)[ nFlyPos ];
+/*N*/ const SwRect aTmp( GetBoundRect( pNext ) );
+/*N*/ if( (aTmp.*fnRect->fnGetLeft)() >= nFlyLeft )
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ while( nFlyPos )
+/*N*/ {
+/*N*/ if( --nFlyPos == nMyPos )
+/*N*/ continue;
+/*N*/ const SdrObject *pNext = (*pFlyList)[ nFlyPos ];
+/*N*/ if( pNext == pCurrFly )
+/*N*/ continue;
+/*N*/ _FlyCntnt eOrder = GetOrder( pNext );
+/*N*/ if( SURROUND_THROUGHT == eOrder )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwRect aTmp( SwContourCache::CalcBoundRect
+/*N*/ ( pNext, aLine, pCurrFrm, nFlyLeft, sal_False ) );
+/*N*/
+/*N*/ if( (aTmp.*fnRect->fnGetLeft)() < nFlyLeft && aTmp.IsOver( aLine ) )
+/*N*/ {
+/*N*/ SwTwips nTmpRight = (aTmp.*fnRect->fnGetRight)();
+/*N*/ if( nLeft <= nTmpRight )
+/*N*/ nLeft = nTmpRight + 1;
+/*N*/
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ (rFly.*fnRect->fnSetLeft)( nLeft );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::FlyToRect()
+ *
+ * IN: dokumentglobal (rRect)
+ * OUT: dokumentglobal (return-Wert)
+ * Liefert zu einem SwFlyFrm das von ihm in Anspruch genommene Rechteck
+ * unter Beruecksichtigung der eingestellten Attribute fuer den Abstand
+ * zum Text zurueck.
+ *************************************************************************/
+
+/*N*/ SwRect SwTxtFly::FlyToRect( const SdrObject *pObj, const SwRect &rLine ) const
+/*N*/ {
+/*N*/ SWRECTFN( pCurrFrm )
+/*N*/
+/*N*/ const long nXPos = pCurrFrm->IsRightToLeft() ?
+/*N*/ rLine.Right() :
+/*N*/ (rLine.*fnRect->fnGetLeft)();
+/*N*/
+/*N*/ SwRect aFly = mbIgnoreContour ?
+/*N*/ GetBoundRect( pObj ) :
+/*N*/ SwContourCache::CalcBoundRect( pObj, rLine, pCurrFrm,
+/*N*/ nXPos, ! pCurrFrm->IsRightToLeft() );
+/*N*/
+/*N*/ if( !aFly.Width() )
+/*N*/ return aFly;
+/*N*/
+/*N*/ SetNextTop( (aFly.*fnRect->fnGetBottom)() ); // Damit die Zeile ggf. bis zur Unterkante
+/*N*/ // des Rahmens waechst.
+/*N*/ MSHORT nFlyPos = GetPos( pObj );
+/*N*/
+/*N*/ // Bei LEFT und RIGHT vergroessern wir das Rechteck.
+/*N*/ // Hier gibt es einige Probleme, wenn mehrere Frames zu sehen sind.
+/*N*/ // Zur Zeit wird nur der einfachste Fall angenommen:
+/*N*/ // LEFT bedeutet, dass der Text links vom Frame fliessen soll,
+/*N*/ // d.h. der Frame blaeht sich bis zum rechten Rand der Printarea
+/*N*/ // oder bis zum naechsten Frame auf.
+/*N*/ // Bei RIGHT ist es umgekehrt.
+/*N*/ // Ansonsten wird immer der eingestellte Abstand zwischen Text
+/*N*/ // und Frame aufaddiert.
+/*N*/ switch( GetOrder( pObj ) )
+/*N*/ {
+/*N*/ case SURROUND_LEFT :
+/*N*/ {
+/*N*/ CalcRightMargin( aFly, nFlyPos, rLine );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SURROUND_RIGHT :
+/*N*/ {
+/*N*/ CalcLeftMargin( aFly, nFlyPos, rLine );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SURROUND_NONE :
+/*N*/ {
+/*N*/ CalcRightMargin( aFly, nFlyPos, rLine );
+/*N*/ CalcLeftMargin( aFly, nFlyPos, rLine );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return aFly;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFly::CalcSmart()
+ *
+ * CalcSmart() liefert die Umlaufform zurueck.
+ *
+ * Auf beiden Seiten ist weniger als 2 cm Platz fuer den Text
+ * => kein Umlauf ( SURROUND_NONE )
+ * Auf genau einer Seite ist mehr als 2 cm Platz
+ * => Umlauf auf dieser Seite ( SURROUND_LEFT / SURROUND_RIGHT )
+ * Auf beiden Seiten ist mehr als 2 cm Platz, das Objekt ist breiter als 1,5 cm
+ * => Umlauf auf der breiteren Seite ( SURROUND_LEFT / SURROUND_RIGHT )
+ * Auf beiden Seiten ist mehr als 2 cm Platz, das Objekt ist schmaler als 1,5 cm
+ * => beidseitiger Umlauf ( SURROUND_PARALLEL )
+ *
+ *************************************************************************/
+
+// Umfluss nur auf Seiten mit mindestens 2 cm Platz fuer den Text
+#define TEXT_MIN 1134
+// Beidseitiger Umfluss bis zu einer Rahmenbreite von maximal 1,5 cm
+#define FRAME_MAX 850
+
+/*N*/ _FlyCntnt SwTxtFly::CalcSmart( const SdrObject *pObj ) const
+/*N*/ {
+/*N*/ _FlyCntnt eOrder;
+/*N*/
+/*N*/ // 11839: Nur die X-Positionen sind interessant, die Y-Positionen des
+/*N*/ // CurrentFrames koennen sich noch aendern (wachsen).
+/*N*/
+/*N*/ SWRECTFN( pCurrFrm )
+/*N*/ const long nCurrLeft = (pCurrFrm->*fnRect->fnGetPrtLeft)();
+/*N*/ const long nCurrRight = (pCurrFrm->*fnRect->fnGetPrtRight)();
+/*N*/ const SwRect aRect( GetBoundRect( pObj ) );
+/*N*/ long nFlyLeft = (aRect.*fnRect->fnGetLeft)();
+/*N*/ long nFlyRight = (aRect.*fnRect->fnGetRight)();
+/*N*/
+/*N*/ if ( nFlyRight < nCurrLeft || nFlyLeft > nCurrRight )
+/*N*/ eOrder = SURROUND_PARALLEL;
+/*N*/ else
+/*N*/ {
+/*N*/ #ifndef USED
+/*N*/ long nLeft = nFlyLeft - nCurrLeft;
+/*N*/ long nRight = nCurrRight - nFlyRight;
+/*N*/ if( nFlyRight - nFlyLeft > FRAME_MAX )
+/*N*/ {
+/*N*/ if( nLeft < nRight )
+/*N*/ nLeft = 0;
+/*N*/ else
+/*N*/ nRight = 0;
+/*N*/ }
+/*N*/ if( nLeft < TEXT_MIN )
+/*N*/ nLeft = 0;
+/*N*/ if( nRight < TEXT_MIN )
+/*N*/ nRight = 0;
+/*N*/ if( nLeft )
+/*N*/ eOrder = nRight ? SURROUND_PARALLEL : SURROUND_LEFT;
+/*N*/ else
+/*N*/ eOrder = nRight ? SURROUND_RIGHT: SURROUND_NONE;
+/*N*/ #else
+/*N*/ if ( nFlyRight > nCurrRight )
+/*N*/ nFlyRight = nCurrRight;
+/*N*/ if ( nFlyLeft < nCurrLeft )
+/*N*/ nFlyLeft = nCurrLeft;
+/*N*/ const long nCurrPart = ( nCurrRight - nCurrLeft )/3;
+/*N*/ const long nFlyWidth = nFlyRight - nFlyLeft;
+/*N*/
+/*N*/ if( nFlyWidth < nCurrPart )
+/*N*/ eOrder = SURROUND_PARALLEL;
+/*N*/ else
+/*N*/ {
+/*N*/ if( nFlyWidth > (nCurrPart * 2) )
+/*N*/ eOrder = SURROUND_NONE;
+/*N*/ else
+/*N*/ {
+/*N*/ const long nHalfCurr = ( nCurrRight + nCurrLeft ) / 2;
+/*N*/ const long nHalfFly = ( nFlyRight + nFlyLeft ) / 2 ;
+/*N*/ if ( nHalfFly == nHalfCurr )
+/*N*/ eOrder = SURROUND_COLUMN;
+/*N*/ else
+/*N*/ eOrder = nHalfFly < nHalfCurr ?
+/*N*/ SURROUND_RIGHT : SURROUND_LEFT;
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/
+/*N*/ return eOrder;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::GetOrder()
+ *************************************************************************/
+
+/*N*/ _FlyCntnt SwTxtFly::GetOrder( const SdrObject *pObj ) const
+/*N*/ {
+/*N*/ const SwFrmFmt *pFmt = ((SwContact*)GetUserCall(pObj))->GetFmt();
+/*N*/ const SwFmtSurround &rFlyFmt = pFmt->GetSurround();
+/*N*/ _FlyCntnt eOrder = rFlyFmt.GetSurround();
+/*N*/
+/*N*/ if( rFlyFmt.IsAnchorOnly() && &lcl_TheAnchor( pObj ) != GetMaster() )
+/*N*/ {
+/*?*/ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+/*?*/ if( FLY_AT_CNTNT == rAnchor.GetAnchorId() ||
+/*?*/ FLY_AUTO_CNTNT == rAnchor.GetAnchorId() )
+/*?*/ return SURROUND_NONE;
+/*N*/ }
+/*N*/
+/*N*/ // Beim Durchlauf und Nowrap wird smart ignoriert.
+/*N*/ if( SURROUND_THROUGHT == eOrder || SURROUND_NONE == eOrder )
+/*N*/ return eOrder;
+/*N*/
+/*N*/ // left is left and right is right
+/*N*/ if ( pCurrFrm->IsRightToLeft() )
+/*N*/ {
+/*?*/ if ( SURROUND_LEFT == eOrder )
+/*?*/ eOrder = SURROUND_RIGHT;
+/*?*/ else if ( SURROUND_RIGHT == eOrder )
+/*?*/ eOrder = SURROUND_LEFT;
+/*N*/ }
+/*N*/
+/*N*/ // "idealer Seitenumlauf":
+/*N*/ if( SURROUND_IDEAL == eOrder )
+/*N*/ eOrder = CalcSmart( pObj ); //Bei SMART wird die Order automatisch berechnet:
+/*N*/
+/*N*/ return eOrder;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFly::IsAnyFrm( SwRect )
+ *
+ * IN: dokumentglobal
+ *
+ * dient zum Abschalten des SwTxtFly, wenn keine Objekte ueberlappen (Relax)
+ *
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFly::IsAnyFrm( const SwRect &rLine ) const
+/*N*/ {
+/*N*/
+/*N*/ SWAP_IF_SWAPPED( pCurrFrm )
+/*N*/
+/*N*/ ASSERT( bOn, "IsAnyFrm: Why?" );
+/*N*/
+/*N*/ const sal_Bool bRet = ForEach( rLine, NULL, sal_False );
+/*N*/ UNDO_SWAP( pCurrFrm )
+/*N*/ return bRet;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtfrm.cxx b/binfilter/bf_sw/source/core/text/sw_txtfrm.cxx
new file mode 100644
index 000000000000..72d912a0e6ff
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtfrm.cxx
@@ -0,0 +1,2064 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_sfx2/printer.hxx>
+#include <bf_svx/lspcitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/pgrditem.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx> // GetDoc()
+#include <pagefrm.hxx> // InvalidateSpelling
+#include <viewsh.hxx> // ViewShell
+#include <paratr.hxx>
+#include <hints.hxx> // SwInsChr
+#include <viewopt.hxx>
+#include <dflyobj.hxx>
+#include <flyfrm.hxx>
+#include <tabfrm.hxx>
+#include <frmtool.hxx>
+#include <pagedesc.hxx> // SwPageDesc
+#include <tgrditem.hxx>
+#include <dbg_lay.hxx>
+#include <fmtfld.hxx>
+#include <fmtftn.hxx>
+#include <txtfld.hxx>
+#include <txtftn.hxx>
+#include <ftninfo.hxx>
+#include <fmtline.hxx>
+#include <sectfrm.hxx> // SwSectFrm
+#include <itrform2.hxx> // Iteratoren
+#include <widorp.hxx> // SwFrmBreak
+#include <txtcache.hxx>
+#include <fntcache.hxx> // GetLineSpace benutzt pLastFont
+#include <frmsh.hxx>
+#include <wrong.hxx> // SwWrongList
+#include <lineinfo.hxx>
+
+#if OSL_DEBUG_LEVEL > 1
+namespace binfilter {
+extern const sal_Char *GetPrepName( const enum PrepareHint ePrep );
+} //STRIP008
+#endif
+namespace binfilter {
+/*N*/ TYPEINIT1( SwTxtFrm, SwCntntFrm );
+
+// Switches width and height of the text frame
+/*N*/ void SwTxtFrm::SwapWidthAndHeight()
+/*N*/ {
+/*N*/ if ( ! bIsSwapped )
+/*N*/ {
+/*N*/ const long nPrtOfstX = Prt().Pos().X();
+/*N*/ Prt().Pos().X() = Prt().Pos().Y();
+/*N*/ Prt().Pos().Y() = Frm().Width() - ( nPrtOfstX + Prt().Width() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const long nPrtOfstY = Prt().Pos().Y();
+/*N*/ Prt().Pos().Y() = Prt().Pos().X();
+/*N*/ Prt().Pos().X() = Frm().Height() - ( nPrtOfstY + Prt().Height() );
+/*N*/ }
+/*N*/
+/*N*/ const long nFrmWidth = Frm().Width();
+/*N*/ Frm().Width( Frm().Height() );
+/*N*/ Frm().Height( nFrmWidth );
+/*N*/ const long nPrtWidth = Prt().Width();
+/*N*/ Prt().Width( Prt().Height() );
+/*N*/ Prt().Height( nPrtWidth );
+/*N*/
+/*N*/ bIsSwapped = ! bIsSwapped;
+/*N*/ }
+
+// Calculates the coordinates of a rectangle when switching from
+// horizontal to vertical layout.
+
+// Calculates the coordinates of a point when switching from
+// horizontal to vertical layout.
+
+// Calculates the a limit value when switching from
+// horizontal to vertical layout.
+
+// Calculates the coordinates of a rectangle when switching from
+// vertical to horizontal layout.
+/*N*/ void SwTxtFrm::SwitchVerticalToHorizontal( SwRect& rRect ) const
+/*N*/ {
+/*N*/ long nOfstX;
+/*N*/
+/*N*/ // calc offset inside frame
+/*N*/ if ( bIsSwapped )
+/*N*/ nOfstX = Frm().Left() + Frm().Height() - ( rRect.Left() + rRect.Width() );
+/*N*/ else
+/*N*/ nOfstX = Frm().Left() + Frm().Width() - ( rRect.Left() + rRect.Width() );
+/*N*/
+/*N*/ const long nOfstY = rRect.Top() - Frm().Top();
+/*N*/ const long nWidth = rRect.Height();
+/*N*/ const long nHeight = rRect.Width();
+/*N*/
+/*N*/ // calc rotated coords
+/*N*/ rRect.Left( Frm().Left() + nOfstY );
+/*N*/ rRect.Top( Frm().Top() + nOfstX );
+/*N*/ rRect.Width( nWidth );
+/*N*/ rRect.Height( nHeight );
+/*N*/ }
+
+// Calculates the coordinates of a point when switching from
+// vertical to horizontal layout.
+/*N*/ void SwTxtFrm::SwitchVerticalToHorizontal( Point& rPoint ) const
+/*N*/ {
+/*N*/ long nOfstX;
+/*N*/
+/*N*/ // calc offset inside frame
+/*N*/ if ( bIsSwapped )
+/*N*/ nOfstX = Frm().Left() + Frm().Height() - rPoint.X();
+/*N*/ else
+/*N*/ nOfstX = Frm().Left() + Frm().Width() - rPoint.X();
+/*N*/
+/*N*/ const long nOfstY = rPoint.Y() - Frm().Top();
+/*N*/
+/*N*/ // calc rotated coords
+/*N*/ rPoint.X() = Frm().Left() + nOfstY;
+/*N*/ rPoint.Y() = Frm().Top() + nOfstX;
+/*N*/ }
+/*N*/
+/*N*/ SwFrmSwapper::SwFrmSwapper( const SwTxtFrm* pTxtFrm, sal_Bool bSwapIfNotSwapped )
+/*N*/ : pFrm( pTxtFrm ), bUndo( sal_False )
+/*N*/ {
+/*N*/ if ( pFrm->IsVertical() &&
+/*N*/ ( ( bSwapIfNotSwapped && ! pFrm->IsSwapped() ) ||
+/*N*/ ( ! bSwapIfNotSwapped && pFrm->IsSwapped() ) ) )
+/*N*/ {
+/*?*/ bUndo = sal_True;
+/*?*/ ((SwTxtFrm*)pFrm)->SwapWidthAndHeight();
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwFrmSwapper::~SwFrmSwapper()
+/*N*/ {
+/*N*/ if ( bUndo )
+/*?*/ ((SwTxtFrm*)pFrm)->SwapWidthAndHeight();
+/*N*/ }
+
+#ifdef BIDI
+
+/*N*/ void SwTxtFrm::SwitchLTRtoRTL( Point& rPoint ) const
+/*N*/ {
+/*N*/ SWAP_IF_NOT_SWAPPED( this )
+/*N*/
+/*N*/ rPoint.X() = 2 * ( Frm().Left() + Prt().Left() ) + Prt().Width() - rPoint.X() - 1;
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/ }
+
+/*N*/ SwLayoutModeModifier::SwLayoutModeModifier( const OutputDevice& rOutp ) :
+/*N*/ rOut( rOutp ), nOldLayoutMode( rOutp.GetLayoutMode() )
+/*N*/ {
+/*N*/ }
+/*N*/
+/*N*/ SwLayoutModeModifier::~SwLayoutModeModifier()
+/*N*/ {
+/*N*/ ((OutputDevice&)rOut).SetLayoutMode( nOldLayoutMode );
+/*N*/ }
+
+
+/*N*/ void SwLayoutModeModifier::SetAuto()
+/*N*/ {
+/*N*/ const ULONG nNewLayoutMode = nOldLayoutMode & ~TEXT_LAYOUT_BIDI_STRONG;
+/*N*/ ((OutputDevice&)rOut).SetLayoutMode( nNewLayoutMode );
+/*N*/ }
+
+#endif
+
+/*************************************************************************
+ * SwTxtFrm::Init()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::Init()
+/*N*/ {
+/*N*/ ASSERT( !IsLocked(), "+SwTxtFrm::Init: this ist locked." );
+/*N*/ if( !IsLocked() )
+/*N*/ {
+/*N*/ ClearPara();
+/*N*/ ResetBlinkPor();
+/*N*/ //Die Flags direkt setzen um ResetPreps und damit ein unnuetzes GetPara
+/*N*/ //einzusparen.
+/*N*/ // Nicht bOrphan, bLocked oder bWait auf sal_False setzen !
+/*N*/ // bOrphan = bFlag7 = bFlag8 = sal_False;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|* SwTxtFrm::CTORen/DTOR
+|*************************************************************************/
+
+/*N*/ void SwTxtFrm::InitCtor()
+/*N*/ {
+/*N*/ nCacheIdx = MSHRT_MAX;
+/*N*/ nOfst = 0;
+/*N*/ nAllLines = 0;
+/*N*/ nThisLines = 0;
+/*N*/ mnFlyAnchorOfst = 0;
+/*N*/ mnFlyAnchorOfstNoWrap = 0;
+/*N*/
+/*N*/ nType = FRMC_TXT;
+/*N*/ bLocked = bFormatted = bWidow = bUndersized = bJustWidow =
+/*N*/ bEmpty = bInFtnConnect = bFtn = bRepaint = bBlinkPor =
+/*N*/ bFieldFollow = bHasAnimation = bIsSwapped = sal_False;
+ // OD 14.03.2003 #i11760#
+/*N*/ mbFollowFormatAllowed = sal_True;
+/*N*/ }
+
+
+/*N*/ SwTxtFrm::SwTxtFrm(SwTxtNode * const pNode)
+/*N*/ : SwCntntFrm(pNode)
+/*N*/ {
+/*N*/ InitCtor();
+/*N*/ }
+/*N*/
+/*N*/ const XubString& SwTxtFrm::GetTxt() const
+/*N*/ {
+/*N*/ return GetTxtNode()->GetTxt();
+/*N*/ }
+/*N*/
+/*N*/ void SwTxtFrm::ResetPreps()
+/*N*/ {
+/*N*/ if ( GetCacheIdx() != MSHRT_MAX )
+/*N*/ {
+/*N*/ SwParaPortion *pPara;
+/*N*/ if( 0 != (pPara = GetPara()) )
+/*N*/ pPara->ResetPreps();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::IsHiddenNow()
+ *************************************************************************/
+// liefert nur sal_True zurueck, wenn das Outputdevice ein Printer ist
+// und bHidden gesetzt ist.
+
+/*N*/ sal_Bool SwTxtFrm::IsHiddenNow() const
+/*N*/ {
+/*N*/ SwFrmSwapper aSwapper( this, sal_True );
+/*N*/
+/*N*/ if( !Frm().Width() && IsValid() && GetUpper()->IsValid() )
+/*N*/ //bei Stackueberlauf (StackHack) invalid!
+/*N*/ {
+/*N*/ ASSERT( Frm().Width(), "SwTxtFrm::IsHiddenNow: thin frame" );
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/
+/*N*/ if( !GetTxtNode()->IsVisible() )
+/*N*/ {
+/*N*/ const ViewShell *pVsh = GetShell();
+/*N*/ if ( !pVsh )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ return ! pVsh->GetWin() ||
+/*N*/ (!pVsh->GetViewOptions()->IsShowHiddenPara() &&
+/*N*/ !pVsh->GetViewOptions()->IsFldName());
+/*N*/ }
+/*N*/ else
+/*N*/ return sal_False;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFrm::HideHidden()
+ *************************************************************************/
+// Entfernt die Anhaengsel des Textfrms wenn dieser hidden ist
+
+/*N*/ void SwTxtFrm::HideHidden()
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFrm::FindBrk()
+ *
+ * Liefert die erste Trennmoeglichkeit in der aktuellen Zeile zurueck.
+ * Die Methode wird in SwTxtFrm::Format() benutzt, um festzustellen, ob
+ * die Vorgaengerzeile mitformatiert werden muss.
+ * nFound ist <= nEndLine.
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwTxtFrm::FindBrk( const XubString &rTxt,
+/*N*/ const xub_StrLen nStart, const xub_StrLen nEnd ) const
+/*N*/ {
+/*N*/ xub_StrLen nFound = nStart;
+/*N*/ const xub_StrLen nEndLine = Min( nEnd, rTxt.Len() );
+/*N*/
+/*N*/ // Wir ueberlesen erst alle Blanks am Anfang der Zeile (vgl. Bug 2235).
+/*N*/ while( nFound <= nEndLine && ' ' == rTxt.GetChar( nFound ) )
+/*N*/ ++nFound;
+/*N*/
+/*N*/ // Eine knifflige Sache mit den TxtAttr-Dummy-Zeichen (hier "$"):
+/*N*/ // "Dr.$Meyer" am Anfang der zweiten Zeile. Dahinter ein Blank eingegeben
+/*N*/ // und das Wort rutscht nicht in die erste Zeile, obwohl es ginge.
+/*N*/ // Aus diesem Grund nehmen wir das Dummy-Zeichen noch mit.
+/*N*/ while( nFound <= nEndLine && ' ' != rTxt.GetChar( nFound ) )
+/*N*/ ++nFound;
+/*N*/
+/*N*/ return nFound;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::IsIdxInside()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) const
+/*N*/ {
+/*N*/ if( GetOfst() > nPos + nLen ) // d.h., der Bereich liegt komplett vor uns.
+/*N*/ return sal_False;
+/*N*/
+/*N*/ if( !GetFollow() ) // der Bereich liegt nicht komplett vor uns,
+/*N*/ return sal_True; // nach uns kommt niemand mehr.
+/*N*/
+/*N*/ const xub_StrLen nMax = GetFollow()->GetOfst();
+/*N*/
+/*N*/ // der Bereich liegt nicht komplett hinter uns bzw.
+/*N*/ // unser Text ist geloescht worden.
+/*N*/ if( nMax > nPos || nMax > GetTxt().Len() )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ // changes made in the first line of a follow can modify the master
+/*N*/ const SwParaPortion* pPara = GetFollow()->GetPara();
+/*N*/ return pPara && ( nPos <= nMax + pPara->GetLen() );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::InvalidateRange()
+ *************************************************************************/
+/*N*/ inline void SwTxtFrm::InvalidateRange(const SwCharRange &aRange, const long nD)
+/*N*/ {
+/*N*/ if ( IsIdxInside( aRange.Start(), aRange.Len() ) )
+/*N*/ _InvalidateRange( aRange, nD );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::_InvalidateRange()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::_InvalidateRange( const SwCharRange &aRange, const long nD)
+/*N*/ {
+/*N*/ if ( !HasPara() )
+/*N*/ { InvalidateSize();
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ SetWidow( sal_False );
+/*N*/ SwParaPortion *pPara = GetPara();
+/*N*/
+/*N*/ sal_Bool bInv = sal_False;
+/*N*/ if( 0 != nD )
+/*N*/ {
+/*N*/ //Auf nDelta werden die Differenzen zwischen alter und
+/*N*/ //neuer Zeilenlaenge aufaddiert, deshalb ist es negativ,
+/*N*/ //wenn Zeichen eingefuegt wurden, positiv, wenn Zeichen
+/*N*/ //geloescht wurden.
+/*N*/ *(pPara->GetDelta()) += nD;
+/*N*/ bInv = sal_True;
+/*N*/ }
+/*N*/ SwCharRange &rReformat = *(pPara->GetReformat());
+/*N*/ if(aRange != rReformat) {
+/*N*/ if( STRING_LEN == rReformat.Len() )
+/*N*/ rReformat = aRange;
+/*N*/ else
+/*N*/ rReformat += aRange;
+/*N*/ bInv = sal_True;
+/*N*/ }
+/*N*/ if(bInv)
+/*N*/ {
+/*N*/ // 90365: nD is passed to a follow two times
+/*N*/ // if( GetFollow() )
+/*N*/ // ((SwTxtFrm*)GetFollow())->InvalidateRange( aRange, nD );
+/*N*/ InvalidateSize();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::CalcLineSpace()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::CalcLineSpace()
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),
+/*N*/ "SwTxtFrm::CalcLineSpace with swapped frame!" )
+/*N*/
+/*N*/ if( IsLocked() || !HasPara() )
+/*N*/ return;
+/*N*/
+/*N*/ SwParaPortion *pPara;
+/*N*/ if( GetDrawObjs() ||
+/*N*/ GetTxtNode()->GetSwAttrSet().GetLRSpace().IsAutoFirst() ||
+/*N*/ ( pPara = GetPara() )->IsFixLineHeight() )
+/*N*/ {
+/*?*/ Init();
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ Size aNewSize( Prt().SSize() );
+/*N*/
+/*N*/ SwTxtFormatInfo aInf( this );
+/*N*/ SwTxtFormatter aLine( this, &aInf );
+/*N*/ if( aLine.GetDropLines() )
+/*N*/ {
+/*N*/ Init();
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ aLine.Top();
+/*N*/ aLine.RecalcRealHeight();
+/*N*/
+/*N*/ aNewSize.Height() = (aLine.Y() - Frm().Top()) + aLine.GetLineHeight();
+/*N*/
+/*N*/ SwTwips nDelta = aNewSize.Height() - Prt().Height();
+/*N*/ // 4291: Unterlauf bei Flys
+/*N*/ if( aInf.GetTxtFly()->IsOn() )
+/*N*/ {
+/*N*/ SwRect aFrm( Frm() );
+/*N*/ if( nDelta < 0 )
+/*N*/ aFrm.Height( Prt().Height() );
+/*N*/ else
+/*N*/ aFrm.Height( aNewSize.Height() );
+/*N*/ if( aInf.GetTxtFly()->Relax( aFrm ) )
+/*N*/ {
+/*?*/ Init();
+/*?*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( nDelta )
+/*N*/ {
+/*N*/ SwTxtFrmBreak aBreak( this );
+/*N*/ if( GetFollow() || aBreak.IsBreakNow( aLine ) )
+/*N*/ {
+/*N*/ // Wenn es einen Follow() gibt, oder wenn wir an dieser
+/*N*/ // Stelle aufbrechen muessen, so wird neu formatiert.
+/*N*/ Init();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Alles nimmt seinen gewohnten Gang ...
+/*N*/ pPara->SetPrepAdjust();
+/*N*/ pPara->SetPrep();
+/*N*/ #ifdef USED
+/*N*/ if (nDelta > 0)
+/*N*/ Grow(nDelta,pHeight);
+/*N*/ else
+/*N*/ Shrink(-nDelta,pHeight);
+/*N*/ ASSERT( GetPara(), "+SwTxtFrm::CalcLineSpace: missing format information" );
+/*N*/ if( pPara )
+/*N*/ pPara->GetRepaint()->SSize( Prt().SSize() );
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+#define SET_WRONG( nPos, nCnt, fnFunc ) \
+{ \
+ if ( !IsFollow() ) \
+ { \
+ if( GetTxtNode()->GetWrong() ) \
+ GetTxtNode()->GetWrong()->fnFunc( nPos, nCnt ); \
+ else if ( ! GetTxtNode()->IsWrongDirty() ) \
+ { \
+ GetTxtNode()->SetWrong( new SwWrongList() ); \
+ GetTxtNode()->GetWrong()->SetInvalid( nPos, nPos + ( nCnt > 0 ? nCnt : 1 ) ); \
+ } \
+ GetNode()->SetWrongDirty( sal_True ); \
+ GetNode()->SetAutoCompleteWordDirty( sal_True ); \
+ } \
+ SwPageFrm *pPage = FindPageFrm(); \
+ if( pPage ) \
+ { \
+ pPage->InvalidateSpelling(); \
+ pPage->InvalidateAutoCompleteWords(); \
+ } \
+}
+
+#define SET_SCRIPT_INVAL( nPos )\
+{ \
+ if( GetPara() ) \
+ GetPara()->GetScriptInfo().SetInvalidity( nPos ); \
+}
+
+/*N*/ void lcl_ModifyOfst( SwTxtFrm* pFrm, xub_StrLen nPos, xub_StrLen nLen )
+/*N*/ {
+/*N*/ if( nLen < 0 )
+/*N*/ nPos -= nLen;
+/*N*/ while( pFrm && pFrm->GetOfst() <= nPos )
+/*N*/ pFrm = pFrm->GetFollow();
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ pFrm->ManipOfst( pFrm->GetOfst() + nLen );
+/*N*/ pFrm = pFrm->GetFollow();
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::Modify()
+ *************************************************************************/
+
+/*M*/ void SwTxtFrm::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew )
+/*M*/ {
+/*M*/ const MSHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*M*/
+/*M*/ //Wuensche die FrmAttribute betreffen werden von der Basisklasse
+/*M*/ //verarbeitet.
+/*M*/ if( IsInRange( aFrmFmtSetRange, nWhich ) || RES_FMT_CHG == nWhich )
+/*M*/ {
+/*M*/ SwCntntFrm::Modify( pOld, pNew );
+/*M*/ if( nWhich == RES_FMT_CHG && GetShell() )
+/*M*/ {
+/*M*/ // Collection hat sich geaendert
+/*M*/ Prepare( PREP_CLEAR );
+/*M*/ _InvalidatePrt();
+/*M*/ SET_WRONG( 0, STRING_LEN, Invalidate );
+/*N*/ SetDerivedR2L( sal_False );
+/*N*/ CheckDirChange();
+/*N*/ // OD 09.12.2002 #105576# - Force complete paint due to existing
+/*N*/ // indents.
+/*N*/ SetCompletePaint();
+/*M*/ InvalidateLineNum();
+/*M*/ }
+/*M*/ return;
+/*M*/ }
+/*M*/
+/*M*/ // Im gelockten Zustand werden keine Bestellungen angenommen.
+/*M*/ if( IsLocked() )
+/*M*/ return;
+/*M*/
+/*M*/ // Dies spart Stack, man muss nur aufpassen,
+/*M*/ // dass sie Variablen gesetzt werden.
+/*M*/ xub_StrLen nPos, nLen;
+/*M*/ sal_Bool bSetFldsDirty = sal_False;
+/*M*/ sal_Bool bRecalcFtnFlag = sal_False;
+/*M*/
+/*M*/ switch( nWhich )
+/*M*/ {
+/*M*/ case RES_LINENUMBER:
+/*M*/ {
+/*M*/ InvalidateLineNum();
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_INS_CHR:
+/*M*/ {
+/*M*/ nPos = ((SwInsChr*)pNew)->nPos;
+/*M*/ InvalidateRange( SwCharRange( nPos, 1 ), 1 );
+/*M*/ SET_WRONG( nPos, 1, Move )
+/*M*/ SET_SCRIPT_INVAL( nPos )
+/*M*/ bSetFldsDirty = sal_True;
+/*M*/ if( HasFollow() )
+/*M*/ lcl_ModifyOfst( this, nPos, 1 );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_INS_TXT:
+/*M*/ {
+/*M*/ nPos = ((SwInsTxt*)pNew)->nPos;
+/*M*/ nLen = ((SwInsTxt*)pNew)->nLen;
+/*M*/ if( IsIdxInside( nPos, nLen ) )
+/*M*/ {
+/*M*/ if( !nLen )
+/*M*/ {
+/*M*/ // 6969: Aktualisierung der NumPortions auch bei leeren Zeilen!
+/*M*/ if( nPos )
+/*M*/ InvalidateSize();
+/*M*/ else
+/*M*/ Prepare( PREP_CLEAR );
+/*M*/ }
+/*M*/ else
+/*M*/ _InvalidateRange( SwCharRange( nPos, nLen ), nLen );
+/*M*/ }
+/*M*/ SET_WRONG( nPos, nLen, Move )
+/*M*/ SET_SCRIPT_INVAL( nPos )
+/*M*/ bSetFldsDirty = sal_True;
+/*M*/ if( HasFollow() )
+/*M*/ lcl_ModifyOfst( this, nPos, nLen );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_DEL_CHR:
+/*M*/ {
+/*M*/ nPos = ((SwDelChr*)pNew)->nPos;
+/*M*/ InvalidateRange( SwCharRange( nPos, 1 ), -1 );
+/*M*/ SET_WRONG( nPos, -1, Move )
+/*M*/ SET_SCRIPT_INVAL( nPos )
+/*M*/ bSetFldsDirty = bRecalcFtnFlag = sal_True;
+/*M*/ if( HasFollow() )
+/*M*/ lcl_ModifyOfst( this, nPos, -1 );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_DEL_TXT:
+/*M*/ {
+/*M*/ nPos = ((SwDelTxt*)pNew)->nStart;
+/*M*/ nLen = ((SwDelTxt*)pNew)->nLen;
+/*M*/ long m = nLen;
+/*M*/ m *= -1;
+/*M*/ if( IsIdxInside( nPos, nLen ) )
+/*M*/ {
+/*M*/ if( !nLen )
+/*M*/ InvalidateSize();
+/*M*/ else
+/*M*/ InvalidateRange( SwCharRange( nPos, 1 ), m );
+/*M*/ }
+/*M*/ SET_WRONG( nPos, m, Move )
+/*M*/ SET_SCRIPT_INVAL( nPos )
+/*M*/ bSetFldsDirty = bRecalcFtnFlag = sal_True;
+/*M*/ if( HasFollow() )
+/*M*/ lcl_ModifyOfst( this, nPos, nLen );
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_UPDATE_ATTR:
+/*M*/ {
+/*M*/ nPos = ((SwUpdateAttr*)pNew)->nStart;
+/*M*/ nLen = ((SwUpdateAttr*)pNew)->nEnd - nPos;
+/*M*/ if( IsIdxInside( nPos, nLen ) )
+/*M*/ {
+/*M*/ // Es muss in jedem Fall neu formatiert werden,
+/*M*/ // auch wenn der invalidierte Bereich null ist.
+/*M*/ // Beispiel: leere Zeile, 14Pt einstellen !
+/*M*/ // if( !nLen ) nLen = 1;
+/*M*/
+/*M*/ // 6680: FtnNummern muessen formatiert werden.
+/*M*/ if( !nLen )
+/*M*/ nLen = 1;
+/*M*/
+/*M*/ _InvalidateRange( SwCharRange( nPos, nLen) );
+/*M*/ MSHORT nTmp = ((SwUpdateAttr*)pNew)->nWhichAttr;
+/*M*/
+/*M*/ if( ! nTmp || RES_TXTATR_CHARFMT == nTmp ||
+/*M*/ RES_FMT_CHG == nTmp || RES_ATTRSET_CHG == nTmp )
+/*M*/ {
+/*M*/ SET_WRONG( nPos, nPos + nLen, Invalidate )
+/*M*/ SET_SCRIPT_INVAL( nPos )
+/*M*/ }
+/*N*/ else if ( RES_CHRATR_LANGUAGE == nTmp ||
+/*N*/ RES_CHRATR_CJK_LANGUAGE == nTmp ||
+/*N*/ RES_CHRATR_CTL_LANGUAGE == nTmp )
+/*M*/ SET_WRONG( nPos, nPos + nLen, Invalidate )
+/*M*/ else if ( RES_CHRATR_FONT == nTmp || RES_CHRATR_CJK_FONT == nTmp ||
+/*M*/ RES_CHRATR_CTL_FONT == nTmp )
+/*M*/ SET_SCRIPT_INVAL( nPos )
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_OBJECTDYING:
+/*M*/ break;
+/*M*/
+/*M*/ case RES_PARATR_LINESPACING:
+/*M*/ {
+/*M*/ CalcLineSpace();
+/*M*/ InvalidateSize();
+/*M*/ _InvalidatePrt();
+/*M*/ if( IsInSct() && !GetPrev() )
+/*M*/ {
+/*M*/ SwSectionFrm *pSect = FindSctFrm();
+/*M*/ if( pSect->ContainsAny() == this )
+/*M*/ pSect->InvalidatePrt();
+/*M*/ }
+/*M*/ SwFrm* pNxt;
+/*M*/ if ( 0 != ( pNxt = GetIndNext() ) )
+/*M*/ {
+/*M*/ pNxt->_InvalidatePrt();
+/*M*/ if ( pNxt->IsLayoutFrm() )
+/*M*/ pNxt->InvalidatePage();
+/*M*/ }
+/*M*/ SetCompletePaint();
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_TXTATR_FIELD:
+/*M*/ {
+/*M*/ nPos = *((SwFmtFld*)pNew)->GetTxtFld()->GetStart();
+/*M*/ if( IsIdxInside( nPos, 1 ) )
+/*M*/ {
+/*M*/ if( pNew == pOld )
+/*M*/ {
+/*M*/ // Nur repainten
+/*M*/ // opt: invalidate aufs Window ?
+/*M*/ InvalidatePage();
+/*M*/ SetCompletePaint();
+/*M*/ }
+/*M*/ else
+/*M*/ _InvalidateRange( SwCharRange( nPos, 1 ) );
+/*M*/ }
+/*M*/ bSetFldsDirty = sal_True;
+/*M*/ }
+/*M*/ break;
+/*M*/ case RES_TXTATR_FTN :
+/*M*/ {
+/*M*/ nPos = *((SwFmtFtn*)pNew)->GetTxtFtn()->GetStart();
+/*M*/ if( IsInFtn() || IsIdxInside( nPos, 1 ) )
+/*M*/ Prepare( PREP_FTN, ((SwFmtFtn*)pNew)->GetTxtFtn() );
+/*M*/ break;
+/*M*/ }
+/*M*/
+/*M*/ case RES_ATTRSET_CHG:
+/*M*/ {
+/*M*/ InvalidateLineNum();
+/*M*/
+/*M*/ SwAttrSet& rNewSet = *((SwAttrSetChg*)pNew)->GetChgSet();
+/*M*/ const SfxPoolItem* pItem;
+/*M*/ int nClear = 0;
+/*M*/ MSHORT nCount = rNewSet.Count();
+/*M*/
+/*M*/ if( SFX_ITEM_SET == rNewSet.GetItemState( RES_TXTATR_FTN,
+/*M*/ sal_False, &pItem ))
+/*M*/ {
+/*M*/ nPos = *((SwFmtFtn*)pItem)->GetTxtFtn()->GetStart();
+/*M*/ if( IsIdxInside( nPos, 1 ) )
+/*M*/ Prepare( PREP_FTN, pNew );
+/*M*/ nClear = 0x01;
+/*M*/ --nCount;
+/*M*/ }
+/*M*/
+/*M*/ if( SFX_ITEM_SET == rNewSet.GetItemState( RES_TXTATR_FIELD,
+/*M*/ sal_False, &pItem ))
+/*M*/ {
+/*M*/ nPos = *((SwFmtFld*)pItem)->GetTxtFld()->GetStart();
+/*M*/ if( IsIdxInside( nPos, 1 ) )
+/*M*/ {
+/*M*/ const SfxPoolItem& rOldItem = ((SwAttrSetChg*)pOld)->
+/*M*/ GetChgSet()->Get( RES_TXTATR_FIELD );
+/*M*/ if( pItem == &rOldItem )
+/*M*/ {
+/*M*/ // Nur repainten
+/*M*/ // opt: invalidate aufs Window ?
+/*M*/ InvalidatePage();
+/*M*/ SetCompletePaint();
+/*M*/ }
+/*M*/ else
+/*M*/ _InvalidateRange( SwCharRange( nPos, 1 ) );
+/*M*/ }
+/*M*/ nClear |= 0x02;
+/*M*/ --nCount;
+/*M*/ }
+/*M*/ sal_Bool bLineSpace = SFX_ITEM_SET == rNewSet.GetItemState(
+/*M*/ RES_PARATR_LINESPACING, sal_False ),
+/*M*/ bRegister = SFX_ITEM_SET == rNewSet.GetItemState(
+/*M*/ RES_PARATR_REGISTER, sal_False );
+/*M*/ if ( bLineSpace || bRegister )
+/*M*/ {
+/*M*/ Prepare( bRegister ? PREP_REGISTER : PREP_ADJUST_FRM );
+/*M*/ CalcLineSpace();
+/*M*/ InvalidateSize();
+/*M*/ _InvalidatePrt();
+/*M*/ SwFrm* pNxt;
+/*M*/ if ( 0 == ( pNxt = GetIndNext() ) &&
+/*M*/ bLineSpace && IsInFtn() )
+/*M*/ pNxt = FindNext();
+/*M*/ if( pNxt )
+/*M*/ {
+/*M*/ pNxt->_InvalidatePrt();
+/*M*/ if ( pNxt->IsLayoutFrm() )
+/*M*/ {
+/*M*/ if( pNxt->IsSctFrm() )
+/*M*/ {
+/*M*/ SwFrm* pCnt = ((SwSectionFrm*)pNxt)->ContainsAny();
+/*M*/ if( pCnt )
+/*M*/ pCnt->_InvalidatePrt();
+/*M*/ }
+/*M*/ pNxt->InvalidatePage();
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ SetCompletePaint();
+/*M*/ nClear |= 0x04;
+/*M*/ if ( bLineSpace )
+/*M*/ {
+/*M*/ --nCount;
+/*M*/ if( IsInSct() && !GetPrev() )
+/*M*/ {
+/*M*/ SwSectionFrm *pSect = FindSctFrm();
+/*M*/ if( pSect->ContainsAny() == this )
+/*M*/ pSect->InvalidatePrt();
+/*M*/ }
+/*M*/ }
+/*M*/ if ( bRegister )
+/*M*/ --nCount;
+/*M*/ }
+/*M*/ if ( SFX_ITEM_SET == rNewSet.GetItemState( RES_PARATR_SPLIT,
+/*M*/ sal_False ))
+/*M*/ {
+/*M*/ if ( GetPrev() )
+/*M*/ CheckKeep();
+/*M*/ Prepare( PREP_CLEAR );
+/*M*/ InvalidateSize();
+/*M*/ nClear |= 0x08;
+/*M*/ --nCount;
+/*M*/ }
+/*M*/
+/*M*/ if( SFX_ITEM_SET == rNewSet.GetItemState( RES_BACKGROUND, sal_False)
+/*M*/ && !IsFollow() && GetDrawObjs() )
+/*M*/ {
+/*M*/ SwDrawObjs *pObjs = GetDrawObjs();
+/*M*/ for ( int i = 0; GetDrawObjs() && i < int(pObjs->Count()); ++i )
+/*M*/ {
+/*M*/ SdrObject *pO = (*pObjs)[MSHORT(i)];
+/*M*/ if ( pO->IsWriterFlyFrame() )
+/*M*/ {
+/*M*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*M*/ if( !pFly->IsFlyInCntFrm() )
+/*M*/ {
+/*M*/ const SvxBrushItem &rBack =
+/*M*/ pFly->GetAttrSet()->GetBackground();
+/*M*/ /// OD 20.08.2002 #99657# #GetTransChg#
+/*M*/ /// following condition determines, if the fly frame
+/*M*/ /// "inherites" the background color of text frame.
+/*M*/ /// This is the case, if fly frame background
+/*M*/ /// color is "no fill"/"auto fill" and if the fly frame
+/*M*/ /// has no background graphic.
+/*M*/ /// Thus, check complete fly frame background
+/*M*/ /// color and *not* only its transparency value
+/*M*/ if ( (rBack.GetColor() == COL_TRANSPARENT) &&
+/*M*/ ///if( rBack.GetColor().GetTransparency() &&
+/*M*/ rBack.GetGraphicPos() == GPOS_NONE )
+/*M*/ {
+/*M*/ pFly->SetCompletePaint();
+/*M*/ pFly->InvalidatePage();
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if ( SFX_ITEM_SET ==
+/*M*/ rNewSet.GetItemState( RES_TXTATR_CHARFMT, sal_False ) )
+/*M*/ {
+/*M*/ SET_WRONG( 0, STRING_LEN, Invalidate )
+/*M*/ SET_SCRIPT_INVAL( 0 )
+/*M*/ }
+/*M*/ else if ( SFX_ITEM_SET ==
+/*N*/ rNewSet.GetItemState( RES_CHRATR_LANGUAGE, sal_False ) ||
+/*N*/ SFX_ITEM_SET ==
+/*N*/ rNewSet.GetItemState( RES_CHRATR_CJK_LANGUAGE, sal_False ) ||
+/*N*/ SFX_ITEM_SET ==
+/*N*/ rNewSet.GetItemState( RES_CHRATR_CTL_LANGUAGE, sal_False ) )
+/*M*/ SET_WRONG( 0, STRING_LEN, Invalidate )
+/*M*/ else if ( SFX_ITEM_SET ==
+/*M*/ rNewSet.GetItemState( RES_CHRATR_FONT, sal_False ) ||
+/*M*/ SFX_ITEM_SET ==
+/*M*/ rNewSet.GetItemState( RES_CHRATR_CJK_FONT, sal_False ) ||
+/*M*/ SFX_ITEM_SET ==
+/*M*/ rNewSet.GetItemState( RES_CHRATR_CTL_FONT, sal_False ) )
+/*M*/ SET_SCRIPT_INVAL( 0 )
+/*M*/ else if ( SFX_ITEM_SET ==
+/*M*/ rNewSet.GetItemState( RES_FRAMEDIR, sal_False ) )
+/*M*/ {
+/*M*/ SetDerivedR2L( sal_False );
+/*M*/ CheckDirChange();
+/*N*/ // OD 09.12.2002 #105576# - Force complete paint due to existing
+/*N*/ // indents.
+/*N*/ SetCompletePaint();
+/*M*/ }
+/*M*/
+/*M*/
+/*M*/ if( nCount )
+/*M*/ {
+/*M*/ if( GetShell() )
+/*M*/ {
+/*M*/ Prepare( PREP_CLEAR );
+/*M*/ _InvalidatePrt();
+/*M*/ }
+/*M*/
+/*M*/ if( nClear )
+/*M*/ {
+/*M*/ SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
+/*M*/ SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
+/*M*/
+/*M*/ if( 0x01 & nClear )
+/*M*/ {
+/*M*/ aOldSet.ClearItem( RES_TXTATR_FTN );
+/*M*/ aNewSet.ClearItem( RES_TXTATR_FTN );
+/*M*/ }
+/*M*/ if( 0x02 & nClear )
+/*M*/ {
+/*M*/ aOldSet.ClearItem( RES_TXTATR_FIELD );
+/*M*/ aNewSet.ClearItem( RES_TXTATR_FIELD );
+/*M*/ }
+/*M*/ if ( 0x04 & nClear )
+/*M*/ {
+/*M*/ if ( bLineSpace )
+/*M*/ {
+/*M*/ aOldSet.ClearItem( RES_PARATR_LINESPACING );
+/*M*/ aNewSet.ClearItem( RES_PARATR_LINESPACING );
+/*M*/ }
+/*M*/ if ( bRegister )
+/*M*/ {
+/*M*/ aOldSet.ClearItem( RES_PARATR_REGISTER );
+/*M*/ aNewSet.ClearItem( RES_PARATR_REGISTER );
+/*M*/ }
+/*M*/ }
+/*M*/ if ( 0x08 & nClear )
+/*M*/ {
+/*M*/ aOldSet.ClearItem( RES_PARATR_SPLIT );
+/*M*/ aNewSet.ClearItem( RES_PARATR_SPLIT );
+/*M*/ }
+/*M*/ SwCntntFrm::Modify( &aOldSet, &aNewSet );
+/*M*/ }
+/*M*/ else
+/*M*/ SwCntntFrm::Modify( pOld, pNew );
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/
+/* Seit dem neuen Blocksatz muessen wir immer neu formatieren:
+ case RES_PARATR_ADJUST:
+ {
+ if( GetShell() )
+ {
+ Prepare( PREP_CLEAR );
+ }
+ break;
+ }
+*/
+/*M*/ // 6870: SwDocPosUpdate auswerten.
+/*M*/ case RES_DOCPOS_UPDATE:
+/*M*/ {
+/*M*/ if( pOld && pNew )
+/*M*/ {
+/*M*/ const SwDocPosUpdate *pDocPos = (const SwDocPosUpdate*)pOld;
+/*M*/ if( pDocPos->nDocPos <= aFrm.Top() )
+/*M*/ {
+/*M*/ const SwFmtFld *pFld = (const SwFmtFld *)pNew;
+/*M*/ InvalidateRange(
+/*M*/ SwCharRange( *pFld->GetTxtFld()->GetStart(), 1 ) );
+/*M*/ }
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/ case RES_PARATR_SPLIT:
+/*M*/ if ( GetPrev() )
+/*M*/ CheckKeep();
+/*M*/ Prepare( PREP_CLEAR );
+/*M*/ bSetFldsDirty = sal_True;
+/*M*/ break;
+/*M*/ case RES_FRAMEDIR :
+/*M*/ SetDerivedR2L( sal_False );
+/*M*/ CheckDirChange();
+/*M*/ break;
+/*M*/ default:
+/*M*/ {
+/*M*/ Prepare( PREP_CLEAR );
+/*M*/ _InvalidatePrt();
+/*M*/ if ( !nWhich )
+/*M*/ {
+/*M*/ //Wird z.B. bei HiddenPara mit 0 gerufen.
+/*M*/ SwFrm *pNxt;
+/*M*/ if ( 0 != (pNxt = FindNext()) )
+/*M*/ pNxt->InvalidatePrt();
+/*M*/ }
+/*M*/ }
+/*M*/ } // switch
+/*M*/
+/*M*/ if( bSetFldsDirty )
+/*M*/ GetNode()->GetDoc()->SetFieldsDirty( sal_True, GetNode(), 1 );
+/*M*/
+/*M*/ if ( bRecalcFtnFlag )
+/*M*/ CalcFtnFlag();
+/*M*/ }
+
+/*M*/ sal_Bool SwTxtFrm::GetInfo( SfxPoolItem &rHnt ) const
+/*M*/ {
+/*M*/ if ( RES_VIRTPAGENUM_INFO == rHnt.Which() && IsInDocBody() && ! IsFollow() )
+/*M*/ {
+/*M*/ SwVirtPageNumInfo &rInfo = (SwVirtPageNumInfo&)rHnt;
+/*M*/ const SwPageFrm *pPage = FindPageFrm();
+/*M*/ if ( pPage )
+/*M*/ {
+/*M*/ if ( pPage == rInfo.GetOrigPage() && !GetPrev() )
+/*M*/ {
+/*M*/ //Das sollte er sein (kann allenfalls temporaer anders sein,
+/*M*/ // sollte uns das beunruhigen?)
+/*M*/ rInfo.SetInfo( pPage, this );
+/*M*/ return sal_False;
+/*M*/ }
+/*M*/ if ( pPage->GetPhyPageNum() < rInfo.GetOrigPage()->GetPhyPageNum() &&
+/*M*/ (!rInfo.GetPage() || pPage->GetPhyPageNum() > rInfo.GetPage()->GetPhyPageNum()))
+/*M*/ {
+/*M*/ //Das koennte er sein.
+/*M*/ rInfo.SetInfo( pPage, this );
+/*M*/ }
+/*M*/ }
+/*M*/ }
+/*M*/ return sal_True;
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFrm::PrepWidows()
+ *************************************************************************/
+
+/*M*/ void SwTxtFrm::PrepWidows( const MSHORT nNeed, sal_Bool bNotify )
+/*M*/ {
+/*M*/ ASSERT(GetFollow() && nNeed, "+SwTxtFrm::Prepare: lost all friends");
+/*M*/
+/*M*/ SwParaPortion *pPara = GetPara();
+/*M*/ if ( !pPara )
+/*M*/ return;
+/*M*/ pPara->SetPrepWidows( sal_True );
+/*M*/
+/*M*/ // These two lines of code have been deleted for #102340#.
+/*M*/ // Obviously the widow control does not work if we have a
+/*M*/ // pMaster->pFollow->pFollow situation:
+/*M*/
+/*M*/ // returnen oder nicht ist hier die Frage.
+/*M*/ // Ohne IsLocked() ist 5156 gefaehrlich,
+/*M*/ // ohne IsFollow() werden die Orphans unterdrueckt: 6968.
+/*M*/ // Abfrage auf IsLocked erst hier, weil das Flag gesetzt werden soll.
+/*M*/ // if( IsLocked() && IsFollow() )
+/*M*/ // return;
+/*M*/
+/*M*/ MSHORT nHave = nNeed;
+/*M*/
+/*M*/ // Wir geben ein paar Zeilen ab und schrumpfen im CalcPreps()
+/*M*/ SWAP_IF_NOT_SWAPPED( this )
+/*M*/
+/*M*/ SwTxtSizeInfo aInf( this );
+/*M*/ SwTxtMargin aLine( this, &aInf );
+/*M*/ aLine.Bottom();
+/*M*/ xub_StrLen nTmpLen = aLine.GetCurr()->GetLen();
+/*M*/ while( nHave && aLine.PrevLine() )
+/*M*/ {
+/*M*/ if( nTmpLen )
+/*M*/ --nHave;
+/*M*/ nTmpLen = aLine.GetCurr()->GetLen();
+/*M*/ }
+/*M*/ // In dieser Ecke tummelten sich einige Bugs: 7513, 7606.
+/*M*/ // Wenn feststeht, dass Zeilen abgegeben werden koennen,
+/*M*/ // muss der Master darueber hinaus die Widow-Regel ueberpruefen.
+/*M*/ if( !nHave )
+/*M*/ {
+/*M*/ sal_Bool bSplit;
+/*M*/ if( !IsFollow() ) //Nur ein Master entscheidet ueber Orphans
+/*M*/ {
+/*M*/ const WidowsAndOrphans aWidOrp( this );
+/*M*/ bSplit = ( aLine.GetLineNr() >= aWidOrp.GetOrphansLines() &&
+/*M*/ aLine.GetLineNr() >= aLine.GetDropLines() );
+/*M*/ }
+/*M*/ else
+/*M*/ bSplit = sal_True;
+/*M*/
+/*M*/ if( bSplit )
+/*M*/ {
+/*M*/ GetFollow()->SetOfst( aLine.GetEnd() );
+/*M*/ aLine.TruncLines( sal_True );
+/*M*/ if( pPara->IsFollowField() )
+/*M*/ GetFollow()->SetFieldFollow( sal_True );
+/*M*/ }
+/*M*/ }
+/*M*/ if ( bNotify )
+/*M*/ {
+/*M*/ _InvalidateSize();
+/*M*/ InvalidatePage();
+/*M*/ }
+/*M*/
+/*M*/ UNDO_SWAP( this )
+/*M*/ }
+
+/*************************************************************************
+ * SwTxtFrm::Prepare
+ *************************************************************************/
+
+/*N*/ sal_Bool lcl_ErgoVadis( SwTxtFrm* pFrm, xub_StrLen &rPos, const PrepareHint ePrep )
+/*N*/ {
+/*N*/ const SwFtnInfo &rFtnInfo = pFrm->GetNode()->GetDoc()->GetFtnInfo();
+/*N*/ if( ePrep == PREP_ERGOSUM )
+/*N*/ {
+/*?*/ if( !rFtnInfo.aErgoSum.Len() )
+/*?*/ return sal_False;;
+/*?*/ rPos = pFrm->GetOfst();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !rFtnInfo.aQuoVadis.Len() )
+/*N*/ return sal_False;
+/*?*/ if( pFrm->HasFollow() )
+/*?*/ rPos = pFrm->GetFollow()->GetOfst();
+/*?*/ else
+/*?*/ rPos = pFrm->GetTxt().Len();
+/*?*/ if( rPos )
+/*?*/ --rPos; // unser letztes Zeichen
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+
+/*N*/ void SwTxtFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
+/*N*/ sal_Bool bNotify )
+/*N*/ {
+/*N*/ SwFrmSwapper aSwapper( this, sal_False );
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ const SwTwips nDbgY = Frm().Top();
+/*N*/ #endif
+/*N*/
+/*N*/ if ( IsEmpty() )
+/*N*/ {
+/*N*/ switch ( ePrep )
+/*N*/ {
+/*N*/ case PREP_BOSS_CHGD:
+/*N*/ SetInvalidVert( TRUE ); // Test
+/*N*/ case PREP_WIDOWS_ORPHANS:
+/*N*/ case PREP_WIDOWS:
+/*N*/ case PREP_FTN_GONE : return;
+/*N*/
+/*N*/ case PREP_POS_CHGD :
+/*N*/ {
+/*N*/ // Auch in (spaltigen) Bereichen ist ein InvalidateSize notwendig,
+/*N*/ // damit formatiert wird und ggf. das bUndersized gesetzt wird.
+/*N*/ if( IsInFly() || IsInSct() )
+/*N*/ {
+/*N*/ SwTwips nTmpBottom = GetUpper()->Frm().Top() +
+/*N*/ GetUpper()->Prt().Bottom();
+/*N*/ if( nTmpBottom < Frm().Bottom() )
+/*N*/ break;
+/*N*/ }
+/*N*/ // Gibt es ueberhaupt Flys auf der Seite ?
+/*N*/ SwTxtFly aTxtFly( this );
+/*N*/ if( aTxtFly.IsOn() )
+/*N*/ {
+/*N*/ // Ueberlappt irgendein Fly ?
+/*N*/ aTxtFly.Relax();
+/*N*/ if ( aTxtFly.IsOn() || IsUndersized() )
+/*N*/ break;
+/*N*/ }
+/*N*/ if( GetTxtNode()->GetSwAttrSet().GetRegister().GetValue())
+/*N*/ break;
+/*N*/
+/*N*/ GETGRID( FindPageFrm() )
+/*N*/ if ( pGrid && GetTxtNode()->GetSwAttrSet().GetParaGrid().GetValue() )
+/*N*/ break;
+/*N*/
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( !HasPara() && PREP_MUST_FIT != ePrep )
+/*N*/ {
+/*N*/ SetInvalidVert( TRUE ); // Test
+/*N*/ ASSERT( !IsLocked(), "SwTxtFrm::Prepare: three of a perfect pair" );
+/*N*/ if ( bNotify )
+/*N*/ InvalidateSize();
+/*N*/ else
+/*N*/ _InvalidateSize();
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ //Objekt mit Locking aus dem Cache holen.
+/*N*/ SwTxtLineAccess aAccess( this );
+/*N*/ SwParaPortion *pPara = aAccess.GetPara();
+/*N*/
+/*N*/ switch( ePrep )
+/*N*/ {
+/*?*/ case PREP_MOVEFTN : Frm().Height(0);
+/*?*/ Prt().Height(0);
+/*?*/ _InvalidatePrt();
+/*?*/ _InvalidateSize();
+/*N*/ // KEIN break
+/*N*/ case PREP_ADJUST_FRM : pPara->SetPrepAdjust( sal_True );
+/*N*/ if( IsFtnNumFrm() != pPara->IsFtnNum() ||
+/*N*/ IsUndersized() )
+/*N*/ {
+/*N*/ InvalidateRange( SwCharRange( 0, 1 ), 1);
+/*N*/ if( GetOfst() && !IsFollow() )
+/*?*/ _SetOfst( 0 );
+/*N*/ }
+/*N*/ break;
+/*?*/ case PREP_MUST_FIT : pPara->SetPrepMustFit( sal_True );
+/*N*/ /* no break here */
+/*N*/ case PREP_WIDOWS_ORPHANS : pPara->SetPrepAdjust( sal_True );
+/*N*/ break;
+/*N*/
+/*N*/ case PREP_WIDOWS :
+/*N*/ // MustFit ist staerker als alles anderes
+/*N*/ if( pPara->IsPrepMustFit() )
+/*N*/ return;
+/*N*/ // Siehe Kommentar in WidowsAndOrphans::FindOrphans und CalcPreps()
+/*N*/ PrepWidows( *(const MSHORT *)pVoid, bNotify );
+/*N*/ break;
+/*N*/
+/*N*/ case PREP_FTN :
+/*N*/ {
+/*N*/ SwTxtFtn *pFtn = (SwTxtFtn *)pVoid;
+/*N*/ if( IsInFtn() )
+/*N*/ {
+/*N*/ // Bin ich der erste TxtFrm einer Fussnote ?
+/*N*/ if( !GetPrev() )
+/*N*/ // Wir sind also ein TxtFrm der Fussnote, die
+/*N*/ // die Fussnotenzahl zur Anzeige bringen muss.
+/*N*/ // Oder den ErgoSum-Text...
+/*N*/ InvalidateRange( SwCharRange( 0, 1 ), 1);
+/*N*/
+/*N*/ if( !GetNext() )
+/*N*/ {
+/*N*/ // Wir sind der letzte Ftn, jetzt muessten die
+/*N*/ // QuoVadis-Texte geupdated werden.
+/*N*/ const SwFtnInfo &rFtnInfo = GetNode()->GetDoc()->GetFtnInfo();
+/*N*/ if( !pPara->UpdateQuoVadis( rFtnInfo.aQuoVadis ) )
+/*N*/ {
+/*N*/ xub_StrLen nPos = pPara->GetParLen();
+/*N*/ if( nPos )
+/*N*/ --nPos;
+/*N*/ InvalidateRange( SwCharRange( nPos, 1 ), 1);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Wir sind also der TxtFrm _mit_ der Fussnote
+/*N*/ const xub_StrLen nPos = *pFtn->GetStart();
+/*N*/ InvalidateRange( SwCharRange( nPos, 1 ), 1);
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ case PREP_BOSS_CHGD :
+/*N*/ {
+/*N*/ // Test
+/*N*/ {
+/*N*/ SetInvalidVert( FALSE );
+/*N*/ BOOL bOld = IsVertical();
+/*N*/ SetInvalidVert( TRUE );
+/*N*/ if( bOld != IsVertical() )
+/*?*/ InvalidateRange( SwCharRange( GetOfst(), STRING_LEN ) );
+/*N*/ }
+/*N*/
+/*N*/ if( HasFollow() )
+/*N*/ {
+/*N*/ xub_StrLen nNxtOfst = GetFollow()->GetOfst();
+/*N*/ if( nNxtOfst )
+/*N*/ --nNxtOfst;
+/*N*/ InvalidateRange( SwCharRange( nNxtOfst, 1 ), 1);
+/*N*/ }
+/*N*/ if( IsInFtn() )
+/*N*/ {
+/*N*/ xub_StrLen nPos;
+/*?*/ if( lcl_ErgoVadis( this, nPos, PREP_QUOVADIS ) )
+/*?*/ InvalidateRange( SwCharRange( nPos, 1 ), 0 );
+/*?*/ if( lcl_ErgoVadis( this, nPos, PREP_ERGOSUM ) )
+/*?*/ InvalidateRange( SwCharRange( nPos, 1 ), 0 );
+/*N*/ }
+/*N*/ // 4739: Wenn wir ein Seitennummernfeld besitzen, muessen wir
+/*N*/ // die Stellen invalidieren.
+/*N*/ SwpHints *pHints = GetTxtNode()->GetpSwpHints();
+/*N*/ if( pHints )
+/*N*/ {
+/*N*/ const MSHORT nSize = pHints->Count();
+/*N*/ const xub_StrLen nEnd = GetFollow() ?
+/*N*/ GetFollow()->GetOfst() : STRING_LEN;
+/*N*/ for( MSHORT i = 0; i < nSize; ++i )
+/*N*/ {
+/*N*/ const SwTxtAttr *pHt = (*pHints)[i];
+/*N*/ const xub_StrLen nStart = *pHt->GetStart();
+/*N*/ if( nStart >= GetOfst() )
+/*N*/ {
+/*N*/ if( nStart >= nEnd )
+/*N*/ i = nSize; // fuehrt das Ende herbei
+/*N*/ else
+/*N*/ {
+/*N*/ // 4029: wenn wir zurueckfliessen und eine Ftn besitzen, so
+/*N*/ // fliesst die Ftn in jedem Fall auch mit. Damit sie nicht im
+/*N*/ // Weg steht, schicken wir uns ein ADJUST_FRM.
+/*N*/ // pVoid != 0 bedeutet MoveBwd()
+/*N*/ const MSHORT nWhich = pHt->Which();
+/*N*/ if( RES_TXTATR_FIELD == nWhich ||
+/*N*/ (HasFtn() && pVoid && RES_TXTATR_FTN == nWhich))
+/*N*/ InvalidateRange( SwCharRange( nStart, 1 ), 1 );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // A new boss, a new chance for growing
+/*N*/ if( IsUndersized() )
+/*N*/ {
+/*?*/ _InvalidateSize();
+/*?*/ InvalidateRange( SwCharRange( GetOfst(), 1 ), 1);
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ case PREP_POS_CHGD :
+/*N*/ {
+/*N*/ if ( GetValidPrtAreaFlag() )
+/*N*/ {
+/*N*/ GETGRID( FindPageFrm() )
+/*N*/ if ( pGrid && GetTxtNode()->GetSwAttrSet().GetParaGrid().GetValue() )
+/*?*/ InvalidatePrt();
+/*N*/ }
+/*N*/
+/*N*/ // Falls wir mit niemandem ueberlappen:
+/*N*/ // Ueberlappte irgendein Fly _vor_ der Positionsaenderung ?
+/*N*/ sal_Bool bFormat = pPara->HasFly();
+/*N*/ if( !bFormat )
+/*N*/ {
+/*N*/ if( IsInFly() )
+/*N*/ {
+/*N*/ SwTwips nTmpBottom = GetUpper()->Frm().Top() +
+/*N*/ GetUpper()->Prt().Bottom();
+/*N*/ if( nTmpBottom < Frm().Bottom() )
+/*N*/ bFormat = sal_True;
+/*N*/ }
+/*N*/ if( !bFormat )
+/*N*/ {
+/*N*/ if ( GetDrawObjs() )
+/*N*/ {
+/*N*/ MSHORT nCnt = GetDrawObjs()->Count();
+/*N*/ for ( MSHORT i = 0; i < nCnt; ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = (*GetDrawObjs())[i];
+/*N*/ if ( pO->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm();
+/*N*/ if( pFly->IsAutoPos() )
+/*N*/ {
+/*?*/ bFormat = sal_True;
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( !bFormat )
+/*N*/ {
+/*N*/ // Gibt es ueberhaupt Flys auf der Seite ?
+/*N*/ SwTxtFly aTxtFly( this );
+/*N*/ if( aTxtFly.IsOn() )
+/*N*/ {
+/*N*/ // Ueberlappt irgendein Fly ?
+/*N*/ aTxtFly.Relax();
+/*N*/ bFormat = aTxtFly.IsOn() || IsUndersized();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bFormat )
+/*N*/ {
+/*N*/ if( !IsLocked() )
+/*N*/ {
+/*N*/ if( pPara->GetRepaint()->HasArea() )
+/*N*/ SetCompletePaint();
+/*N*/ Init();
+/*N*/ pPara = 0;
+/*N*/ _InvalidateSize();
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( GetTxtNode()->GetSwAttrSet().GetRegister().GetValue() )
+/*N*/ Prepare( PREP_REGISTER, 0, bNotify );
+/*N*/ // Durch Positionsverschiebungen mit Ftns muessen die
+/*N*/ // Frames neu adjustiert werden.
+/*N*/ else if( HasFtn() )
+/*N*/ {
+/*N*/ Prepare( PREP_ADJUST_FRM, 0, bNotify );
+/*N*/ _InvalidateSize();
+/*N*/ }
+/*N*/ else
+/*N*/ return; // damit kein SetPrep() erfolgt.
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ case PREP_REGISTER:
+/*N*/ if( GetTxtNode()->GetSwAttrSet().GetRegister().GetValue() )
+/*N*/ {
+/*N*/ pPara->SetPrepAdjust( sal_True );
+/*N*/ CalcLineSpace();
+/*N*/ InvalidateSize();
+/*N*/ _InvalidatePrt();
+/*N*/ SwFrm* pNxt;
+/*N*/ if ( 0 != ( pNxt = GetIndNext() ) )
+/*N*/ {
+/*N*/ pNxt->_InvalidatePrt();
+/*N*/ if ( pNxt->IsLayoutFrm() )
+/*N*/ pNxt->InvalidatePage();
+/*N*/ }
+/*N*/ SetCompletePaint();
+/*N*/ }
+/*N*/ break;
+/*?*/ case PREP_FTN_GONE :
+/*?*/ {
+/*?*/ // Wenn ein Follow uns ruft, weil eine Fussnote geloescht wird, muss unsere
+/*?*/ // letzte Zeile formatiert werden, damit ggf. die erste Zeile des Follows
+/*?*/ // hochrutschen kann, die extra auf die naechste Seite gerutscht war, um mit
+/*?*/ // der Fussnote zusammen zu sein, insbesondere bei spaltigen Bereichen.
+/*?*/ ASSERT( GetFollow(), "PREP_FTN_GONE darf nur vom Follow gerufen werden" );
+/*?*/ xub_StrLen nPos = GetFollow()->GetOfst();
+/*?*/ if( IsFollow() && GetOfst() == nPos ) // falls wir gar keine Textmasse besitzen,
+/*?*/ FindMaster()->Prepare( PREP_FTN_GONE ); // rufen wir das Prepare unseres Masters
+/*?*/ if( nPos )
+/*?*/ --nPos; // das Zeichen vor unserem Follow
+/*?*/ InvalidateRange( SwCharRange( nPos, 1 ), 0 );
+/*?*/ return;
+/*?*/ }
+/*N*/ case PREP_ERGOSUM:
+/*N*/ case PREP_QUOVADIS:
+/*N*/ {
+/*N*/ xub_StrLen nPos;
+/*N*/ if( lcl_ErgoVadis( this, nPos, ePrep ) )
+/*?*/ InvalidateRange( SwCharRange( nPos, 1 ), 0 );
+/*N*/ }
+/*N*/ break;
+/*N*/ case PREP_FLY_ATTR_CHG:
+/*N*/ {
+/*N*/ if( pVoid )
+/*N*/ {
+/*N*/ xub_StrLen nWhere = CalcFlyPos( (SwFrmFmt*)pVoid );
+/*N*/ ASSERT( STRING_LEN != nWhere, "Prepare: Why me?" );
+/*N*/ InvalidateRange( SwCharRange( nWhere, 1 ) );
+/*N*/ return;
+/*N*/ }
+/*N*/ // else ... Laufe in den Default-Switch
+/*N*/ }
+/*N*/ case PREP_CLEAR:
+/*N*/ default:
+/*N*/ {
+/*N*/ if( IsLocked() )
+/*N*/ {
+/*N*/ if( PREP_FLY_ARRIVE == ePrep || PREP_FLY_LEAVE == ePrep )
+/*N*/ {
+/*N*/ xub_StrLen nLen = ( GetFollow() ? GetFollow()->GetOfst() :
+/*N*/ STRING_LEN ) - GetOfst();
+/*N*/ InvalidateRange( SwCharRange( GetOfst(), nLen ), 0 );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pPara->GetRepaint()->HasArea() )
+/*N*/ SetCompletePaint();
+/*N*/ Init();
+/*N*/ pPara = 0;
+/*N*/ if( GetOfst() && !IsFollow() )
+/*?*/ _SetOfst( 0 );
+/*N*/ if ( bNotify )
+/*N*/ InvalidateSize();
+/*N*/ else
+/*N*/ _InvalidateSize();
+/*N*/ }
+/*N*/ return; // damit kein SetPrep() erfolgt.
+/*N*/ }
+/*N*/ }
+/*N*/ if( pPara )
+/*N*/ pPara->SetPrep( sal_True );
+/*N*/ }
+
+/* -----------------11.02.99 17:56-------------------
+ * Kleine Hilfsklasse mit folgender Funktion:
+ * Sie soll eine Probeformatierung vorbereiten.
+ * Der Frame wird in Groesse und Position angepasst, sein SwParaPortion zur Seite
+ * gestellt und eine neue erzeugt, dazu wird formatiert mit gesetztem bTestFormat.
+ * Im Dtor wird der TxtFrm wieder in seinen alten Zustand zurueckversetzt.
+ *
+ * --------------------------------------------------*/
+
+class SwTestFormat
+{
+ SwTxtFrm *pFrm;
+ SwParaPortion *pOldPara;
+ SwRect aOldFrm, aOldPrt;
+public:
+ SwTestFormat( SwTxtFrm* pTxtFrm, const SwFrm* pPrv, SwTwips nMaxHeight );
+ ~SwTestFormat();
+};
+
+/*N*/ SwTestFormat::SwTestFormat( SwTxtFrm* pTxtFrm, const SwFrm* pPre, SwTwips nMaxHeight )
+/*N*/ : pFrm( pTxtFrm )
+/*N*/ {
+/*N*/ aOldFrm = pFrm->Frm();
+/*N*/ aOldPrt = pFrm->Prt();
+/*N*/
+/*N*/ SWRECTFN( pFrm )
+/*N*/ SwTwips nLower = (pFrm->*fnRect->fnGetBottomMargin)();
+/*N*/
+/*N*/ pFrm->Frm() = pFrm->GetUpper()->Prt();
+/*N*/ pFrm->Frm() += pFrm->GetUpper()->Frm().Pos();
+/*N*/
+/*N*/ (pFrm->Frm().*fnRect->fnSetHeight)( nMaxHeight );
+/*N*/ if( pFrm->GetPrev() )
+/*N*/ (pFrm->Frm().*fnRect->fnSetPosY)(
+/*N*/ (pFrm->GetPrev()->Frm().*fnRect->fnGetBottom)() -
+/*N*/ ( bVert ? nMaxHeight + 1 : 0 ) );
+/*N*/
+/*N*/ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm );
+/*N*/ const SwBorderAttrs &rAttrs = *aAccess.Get();
+/*N*/ (pFrm->Prt().*fnRect->fnSetPosX)( rAttrs.CalcLeft( pFrm ) );
+/*N*/
+/*N*/ if( pPre )
+/*N*/ {
+/*N*/ SwTwips nUpper = pFrm->CalcUpperSpace( &rAttrs, pPre );
+/*N*/ (pFrm->Prt().*fnRect->fnSetPosY)( nUpper );
+/*N*/ }
+/*N*/ (pFrm->Prt().*fnRect->fnSetHeight)(
+/*N*/ Max( 0L , (pFrm->Frm().*fnRect->fnGetHeight)() -
+/*N*/ (pFrm->Prt().*fnRect->fnGetTop)() - nLower ) );
+/*N*/ (pFrm->Prt().*fnRect->fnSetWidth)(
+/*N*/ (pFrm->Frm().*fnRect->fnGetWidth)() -
+/*N*/ // OD 23.01.2003 #106895# - add 1st param to <SwBorderAttrs::CalcRight(..)>
+/*N*/ ( rAttrs.CalcLeft( pFrm ) + rAttrs.CalcRight( pFrm ) ) );
+/*N*/ pOldPara = pFrm->HasPara() ? pFrm->GetPara() : NULL;
+/*N*/ pFrm->SetPara( new SwParaPortion(), sal_False );
+/*N*/
+/*N*/ ASSERT( ! pFrm->IsSwapped(), "A frame is swapped before _Format" );
+/*N*/
+/*N*/ if ( pFrm->IsVertical() )
+/*?*/ pFrm->SwapWidthAndHeight();
+/*N*/
+/*N*/ SwTxtFormatInfo aInf( pFrm, sal_False, sal_True, sal_True );
+/*N*/ SwTxtFormatter aLine( pFrm, &aInf );
+/*N*/
+/*N*/ pFrm->_Format( aLine, aInf );
+/*N*/
+/*N*/ if ( pFrm->IsVertical() )
+/*?*/ pFrm->SwapWidthAndHeight();
+/*N*/
+/*N*/ ASSERT( ! pFrm->IsSwapped(), "A frame is swapped after _Format" );
+/*N*/ }
+
+/*N*/ SwTestFormat::~SwTestFormat()
+/*N*/ {
+/*N*/ pFrm->Frm() = aOldFrm;
+/*N*/ pFrm->Prt() = aOldPrt;
+/*N*/ pFrm->SetPara( pOldPara );
+/*N*/ }
+
+/*N*/ sal_Bool SwTxtFrm::TestFormat( const SwFrm* pPrv, SwTwips &rMaxHeight, sal_Bool &bSplit )
+/*N*/ {
+/*N*/ PROTOCOL_ENTER( this, PROT_TESTFORMAT, 0, 0 )
+/*N*/
+/*N*/ if( IsLocked() && GetUpper()->Prt().Width() <= 0 )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ SwTestFormat aSave( this, pPrv, rMaxHeight );
+/*N*/
+/*N*/ return SwTxtFrm::WouldFit( rMaxHeight, bSplit );
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFrm::WouldFit()
+ *************************************************************************/
+
+/* SwTxtFrm::WouldFit()
+ * sal_True: wenn ich aufspalten kann.
+ * Es soll und braucht nicht neu formatiert werden.
+ * Wir gehen davon aus, dass bereits formatiert wurde und dass
+ * die Formatierungsdaten noch aktuell sind.
+ * Wir gehen davon aus, dass die Framebreiten des evtl. Masters und
+ * Follows gleich sind. Deswegen wird kein FindBreak() mit FindOrphans()
+ * gerufen.
+ * Die benoetigte Hoehe wird von nMaxHeight abgezogen!
+ */
+
+/*N*/ sal_Bool SwTxtFrm::WouldFit( SwTwips &rMaxHeight, sal_Bool &bSplit )
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),
+/*N*/ "SwTxtFrm::WouldFit with swapped frame" );
+/*N*/ SWRECTFN( this );
+/*N*/
+/*N*/ if( IsLocked() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ //Kann gut sein, dass mir der IdleCollector mir die gecachten
+/*N*/ //Informationen entzogen hat.
+/*N*/ if( !IsEmpty() )
+/*N*/ GetFormatted();
+/*N*/
+/*N*/ if ( IsEmpty() )
+/*N*/ {
+/*N*/ bSplit = sal_False;
+/*N*/ SwTwips nHeight = bVert ? Prt().SSize().Width() : Prt().SSize().Height();
+/*N*/ if( rMaxHeight < nHeight )
+/*N*/ return sal_False;
+/*N*/ else
+/*N*/ {
+/*N*/ rMaxHeight -= nHeight;
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // In sehr unguenstigen Faellen kann GetPara immer noch 0 sein.
+/*N*/ // Dann returnen wir sal_True, um auf der neuen Seite noch einmal
+/*N*/ // anformatiert zu werden.
+/*N*/ ASSERT( HasPara() || IsHiddenNow(), "WouldFit: GetFormatted() and then !HasPara()" );
+/*N*/ if( !HasPara() || ( !(Frm().*fnRect->fnGetHeight)() && IsHiddenNow() ) )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ // Da das Orphan-Flag nur sehr fluechtig existiert, wird als zweite
+/*N*/ // Bedingung ueberprueft, ob die Rahmengroesse durch CalcPreps
+/*N*/ // auf riesengross gesetzt wird, um ein MoveFwd zu erzwingen.
+/*N*/ if( IsWidow() || ( bVert ?
+/*N*/ ( 0 == Frm().Left() ) :
+/*N*/ ( LONG_MAX - 20000 < Frm().Bottom() ) ) )
+/*N*/ {
+/*?*/ SetWidow(sal_False);
+/*?*/ if ( GetFollow() )
+/*?*/ {
+/*?*/ // Wenn wir hier durch eine Widow-Anforderung unseres Follows gelandet
+/*?*/ // sind, wird ueberprueft, ob es ueberhaupt einen Follow mit einer
+/*?*/ // echten Hoehe gibt, andernfalls (z.B. in neu angelegten SctFrms)
+/*?*/ // ignorieren wir das IsWidow() und pruefen doch noch, ob wir
+/*?*/ // genung Platz finden.
+/*?*/ if( ( ( ! bVert && LONG_MAX - 20000 >= Frm().Bottom() ) ||
+/*?*/ ( bVert && 0 < Frm().Left() ) ) &&
+/*?*/ ( GetFollow()->IsVertical() ?
+/*?*/ !GetFollow()->Frm().Width() :
+/*?*/ !GetFollow()->Frm().Height() ) )
+/*?*/ {
+/*?*/ SwTxtFrm* pFoll = GetFollow()->GetFollow();
+/*?*/ while( pFoll &&
+/*?*/ ( pFoll->IsVertical() ?
+/*?*/ !pFoll->Frm().Width() :
+/*?*/ !pFoll->Frm().Height() ) )
+/*?*/ pFoll = pFoll->GetFollow();
+/*?*/ if( pFoll )
+/*?*/ return sal_False;
+/*?*/ }
+/*?*/ else
+/*?*/ return sal_False;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ SWAP_IF_NOT_SWAPPED( this );
+/*N*/
+/*N*/ SwTxtSizeInfo aInf( this );
+/*N*/ SwTxtMargin aLine( this, &aInf );
+/*N*/
+/*N*/ WidowsAndOrphans aFrmBreak( this, rMaxHeight, bSplit );
+/*N*/
+/*N*/ register sal_Bool bRet = sal_True;
+/*N*/
+/*N*/ aLine.Bottom();
+/*N*/ // Ist Aufspalten ueberhaupt notwendig?
+/*N*/ if ( 0 != ( bSplit = !aFrmBreak.IsInside( aLine ) ) )
+/*N*/ bRet = !aFrmBreak.IsKeepAlways() && aFrmBreak.WouldFit( aLine, rMaxHeight );
+/*N*/ else
+/*N*/ {
+/*N*/ //Wir brauchen die Gesamthoehe inklusive der aktuellen Zeile
+/*N*/ aLine.Top();
+/*N*/ do
+/*N*/ {
+/*N*/ rMaxHeight -= aLine.GetLineHeight();
+/*N*/ } while ( aLine.Next() );
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFrm::GetParHeight()
+ *************************************************************************/
+
+/*N*/ KSHORT SwTxtFrm::GetParHeight() const
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),
+/*N*/ "SwTxtFrm::GetParHeight with swapped frame" )
+/*N*/
+/*N*/ if( !HasPara() )
+/*N*/ { // Fuer nichtleere Absaetze ist dies ein Sonderfall, da koennen wir
+/*N*/ // bei UnderSized ruhig nur 1 Twip mehr anfordern.
+/*N*/ KSHORT nRet = (KSHORT)Prt().SSize().Height();
+/*N*/ if( IsUndersized() )
+/*N*/ {
+/*N*/ if( IsEmpty() )
+/*N*/ nRet = (KSHORT)EmptyHeight();
+/*N*/ else
+/*N*/ ++nRet;
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+/*N*/
+/*N*/ SWAP_IF_NOT_SWAPPED( this )
+/*N*/
+/*N*/ SwTxtFrm *pThis = (SwTxtFrm*)this;
+/*N*/ SwTxtSizeInfo aInf( pThis );
+/*N*/ SwTxtIter aLine( pThis, &aInf );
+/*N*/ KSHORT nHeight = aLine.GetLineHeight();
+/*N*/ if( GetOfst() && !IsFollow() ) // Ist dieser Absatz gescrollt? Dann ist unsere
+/*?*/ nHeight += aLine.GetLineHeight(); // bisherige Hoehe mind. eine Zeilenhoehe zu gering
+/*N*/ while( aLine.Next() )
+/*N*/ nHeight += aLine.GetLineHeight();
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/
+/*N*/ return nHeight;
+/*N*/ }
+
+
+/*************************************************************************
+ * SwTxtFrm::GetFormatted()
+ *************************************************************************/
+
+// returnt this _immer_ im formatierten Zustand!
+/*N*/ SwTxtFrm *SwTxtFrm::GetFormatted()
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/
+/*N*/ //Kann gut sein, dass mir der IdleCollector mir die gecachten
+/*N*/ //Informationen entzogen hat. Calc() ruft unser Format.
+/*N*/ //Nicht bei leeren Absaetzen!
+/*N*/ if( !HasPara() && !(IsValid() && IsEmpty()) )
+/*N*/ {
+/*N*/ // Calc() muss gerufen werden, weil unsere Frameposition
+/*N*/ // nicht stimmen muss.
+/*N*/ const sal_Bool bFormat = GetValidSizeFlag();
+/*N*/ Calc();
+/*N*/ // Es kann durchaus sein, dass Calc() das Format()
+/*N*/ // nicht anstiess (weil wir einst vom Idle-Zerstoerer
+/*N*/ // aufgefordert wurden unsere Formatinformationen wegzuschmeissen).
+/*N*/ // 6995: Optimierung mit FormatQuick()
+/*N*/ if( bFormat && !FormatQuick() )
+/*N*/ Format();
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/
+/*N*/ return this;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::CalcFitToContent()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFrm::GetLineSpace()
+ *************************************************************************/
+
+/*N*/ KSHORT SwTxtFrm::GetLineSpace() const
+/*N*/ {
+/*N*/ KSHORT nRet = 0;
+/*N*/ long nTmp;
+/*N*/
+/*N*/ const SwAttrSet* pSet = GetAttrSet();
+/*N*/ const SvxLineSpacingItem &rSpace = pSet->GetLineSpacing();
+/*N*/
+/*N*/ switch( rSpace.GetInterLineSpaceRule() )
+/*N*/ {
+/*N*/ case SVX_INTER_LINE_SPACE_PROP:
+/*N*/ {
+/*N*/ ViewShell* pVsh = (ViewShell*)GetShell();
+/*N*/ if ( !pVsh )
+/*N*/ break;
+/*N*/ OutputDevice *pOut = pVsh->GetOut();
+/*N*/ if( !pVsh->GetDoc()->IsBrowseMode() ||
+/*N*/ pVsh->GetViewOptions()->IsPrtFormat() )
+/*N*/ {
+/*N*/ pOut = &GetTxtNode()->GetDoc()->GetRefDev();
+/*N*/ }
+/*N*/ SwFont aFont( pSet, GetTxtNode()->GetDoc() );
+/*N*/ // Wir muessen dafuer sorgen, dass am OutputDevice der Font
+/*N*/ // korrekt restauriert wird, sonst droht ein Last!=Owner.
+/*N*/ if ( pLastFont )
+/*N*/ {
+/*N*/ SwFntObj *pOldFont = pLastFont;
+/*N*/ pLastFont = NULL;
+/*N*/ aFont.SetFntChg( sal_True );
+/*N*/ aFont.ChgPhysFnt( pVsh, pOut );
+/*N*/ nRet = aFont.GetHeight( pVsh, pOut );
+/*N*/ pLastFont->Unlock();
+/*N*/ pLastFont = pOldFont;
+/*N*/ pLastFont->SetDevFont( pVsh, pOut );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ Font aOldFont = pOut->GetFont();
+/*?*/ aFont.SetFntChg( sal_True );
+/*?*/ aFont.ChgPhysFnt( pVsh, pOut );
+/*?*/ nRet = aFont.GetHeight( pVsh, pOut );
+/*?*/ pLastFont->Unlock();
+/*?*/ pLastFont = NULL;
+/*?*/ pOut->SetFont( aOldFont );
+/*N*/ }
+/*N*/ nTmp = nRet;
+/*N*/ nTmp *= rSpace.GetPropLineSpace();
+/*N*/ nTmp /= 100;
+/*N*/ nTmp -= nRet;
+/*N*/ if ( nTmp > 0 )
+/*N*/ nRet = (KSHORT)nTmp;
+/*N*/ else
+/*N*/ nRet = 0;
+/*N*/ }
+/*N*/ break;
+/*?*/ case SVX_INTER_LINE_SPACE_FIX:
+/*?*/ if ( rSpace.GetInterLineSpace() > 0 )
+/*?*/ nRet = (KSHORT)rSpace.GetInterLineSpace();
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::FirstLineHeight()
+ *************************************************************************/
+
+/*N*/ KSHORT SwTxtFrm::FirstLineHeight() const
+/*N*/ {
+/*N*/ if ( !HasPara() )
+/*N*/ {
+/*N*/ if( IsEmpty() && IsValid() )
+/*?*/ return IsVertical() ? (KSHORT)Prt().Width() : (KSHORT)Prt().Height();
+/*N*/ return KSHRT_MAX;
+/*N*/ }
+/*N*/ const SwParaPortion *pPara = GetPara();
+/*N*/ if ( !pPara )
+/*N*/ return KSHRT_MAX;
+/*N*/
+/*N*/ return pPara->Height();
+/*N*/ }
+
+
+/*N*/ void SwTxtFrm::ChgThisLines()
+/*N*/ {
+/*N*/ //not necassary to format here (GerFormatted etc.), because we have to come from there!
+/*N*/
+/*N*/ ULONG nNew = 0;
+/*N*/ const SwLineNumberInfo &rInf = GetNode()->GetDoc()->GetLineNumberInfo();
+/*N*/ if ( GetTxt().Len() && HasPara() )
+/*N*/ {
+/*N*/ SwTxtSizeInfo aInf( this );
+/*N*/ SwTxtMargin aLine( this, &aInf );
+/*N*/ if ( rInf.IsCountBlankLines() )
+/*N*/ {
+/*N*/ aLine.Bottom();
+/*N*/ nNew = (ULONG)aLine.GetLineNr();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*?*/ if( aLine.GetCurr()->HasCntnt() )
+/*?*/ ++nNew;
+/*N*/ } while ( aLine.NextLine() );
+/*N*/ }
+/*N*/ }
+/*N*/ else if ( rInf.IsCountBlankLines() )
+/*N*/ nNew = 1;
+/*N*/
+/*N*/ if ( nNew != nThisLines )
+/*N*/ {
+/*N*/ if ( !IsInTab() && GetAttrSet()->GetLineNumber().IsCount() )
+/*N*/ {
+/*N*/ nAllLines -= nThisLines;
+/*N*/ nThisLines = nNew;
+/*N*/ nAllLines += nThisLines;
+/*N*/ SwFrm *pNxt = GetNextCntntFrm();
+/*N*/ while( pNxt && pNxt->IsInTab() )
+/*N*/ {
+/*N*/ if( 0 != (pNxt = pNxt->FindTabFrm()) )
+/*N*/ pNxt = pNxt->FindNextCnt();
+/*N*/ }
+/*N*/ if( pNxt )
+/*N*/ pNxt->InvalidateLineNum();
+/*N*/
+/*N*/ //Extend repaint to the bottom.
+/*N*/ if ( HasPara() )
+/*N*/ {
+/*N*/ SwRepaint *pRepaint = GetPara()->GetRepaint();
+/*N*/ pRepaint->Bottom( Max( pRepaint->Bottom(),
+/*N*/ Frm().Top()+Prt().Bottom()));
+/*N*/ }
+/*N*/ }
+/*N*/ else //Paragraphs which are not counted should not manipulate the AllLines.
+/*N*/ nThisLines = nNew;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwTxtFrm::RecalcAllLines()
+/*N*/ {
+/*N*/ ValidateLineNum();
+/*N*/
+/*N*/ const SwAttrSet *pAttrSet = GetAttrSet();
+/*N*/
+/*N*/ if ( !IsInTab() )
+/*N*/ {
+/*N*/ const ULONG nOld = GetAllLines();
+/*N*/ const SwFmtLineNumber &rLineNum = pAttrSet->GetLineNumber();
+/*N*/ ULONG nNewNum;
+/*N*/
+/*N*/ if ( !IsFollow() && rLineNum.GetStartValue() && rLineNum.IsCount() )
+/*?*/ nNewNum = rLineNum.GetStartValue() - 1;
+/*N*/ //If it is a follow or not has not be considered if it is a restart at each page; the
+/*N*/ //restart should also take affekt at follows.
+/*N*/ else if ( pAttrSet->GetDoc()->GetLineNumberInfo().IsRestartEachPage() &&
+/*N*/ FindPageFrm()->FindFirstBodyCntnt() == this )
+/*N*/ {
+/*N*/ nNewNum = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwCntntFrm *pPrv = GetPrevCntntFrm();
+/*N*/ while ( pPrv &&
+/*N*/ (pPrv->IsInTab() || pPrv->IsInDocBody() != IsInDocBody()) )
+/*N*/ pPrv = pPrv->GetPrevCntntFrm();
+/*N*/
+/*N*/ nNewNum = pPrv ? ((SwTxtFrm*)pPrv)->GetAllLines() : 0;
+/*N*/ }
+/*N*/ if ( rLineNum.IsCount() )
+/*N*/ nNewNum += GetThisLines();
+/*N*/
+/*N*/ if ( nOld != nNewNum )
+/*N*/ {
+/*N*/ nAllLines = nNewNum;
+/*N*/ SwCntntFrm *pNxt = GetNextCntntFrm();
+/*N*/ while ( pNxt &&
+/*N*/ (pNxt->IsInTab() || pNxt->IsInDocBody() != IsInDocBody()) )
+/*N*/ pNxt = pNxt->GetNextCntntFrm();
+/*N*/ if ( pNxt )
+/*N*/ {
+/*N*/ if ( pNxt->GetUpper() != GetUpper() )
+/*N*/ pNxt->InvalidateLineNum();
+/*N*/ else
+/*N*/ pNxt->_InvalidateLineNum();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+/*************************************************************************
+ * SwTxtFrm::GetScriptInfo()
+ *************************************************************************/
+
+/*N*/ const SwScriptInfo* SwTxtFrm::GetScriptInfo() const
+/*N*/ {
+/*N*/ const SwParaPortion* pPara = GetPara();
+/*N*/ return pPara ? &pPara->GetScriptInfo() : 0;
+/*N*/ }
+
+/*************************************************************************
+ * lcl_CalcFlyBasePos()
+ * Helper function for SwTxtFrm::CalcBasePosForFly()
+ *************************************************************************/
+
+SwTwips lcl_CalcFlyBasePos( const SwTxtFrm& rFrm, SwRect aFlyRect,
+ SwTxtFly& rTxtFly )
+{
+ SWRECTFN( (&rFrm) )
+ SwTwips nRet = rFrm.IsRightToLeft() ?
+ (rFrm.Frm().*fnRect->fnGetRight)() :
+ (rFrm.Frm().*fnRect->fnGetLeft)();
+
+ do
+ {
+ SwRect aRect = rTxtFly.GetFrm( aFlyRect );
+ if ( 0 != (aRect.*fnRect->fnGetWidth)() )
+ {
+ if ( rFrm.IsRightToLeft() )
+ {
+ if ( (aRect.*fnRect->fnGetRight)() -
+ (aFlyRect.*fnRect->fnGetRight)() >= 0 )
+ {
+ (aFlyRect.*fnRect->fnSetRight)(
+ (aRect.*fnRect->fnGetLeft)() );
+ nRet = (aRect.*fnRect->fnGetLeft)();
+ }
+ else
+ break;
+ }
+ else
+ {
+ if ( (aFlyRect.*fnRect->fnGetLeft)() -
+ (aRect.*fnRect->fnGetLeft)() >= 0 )
+ {
+ (aFlyRect.*fnRect->fnSetLeft)(
+ (aRect.*fnRect->fnGetRight)() + 1 );
+ nRet = (aRect.*fnRect->fnGetRight)();
+ }
+ else
+ break;
+ }
+ }
+ else
+ break;
+ }
+ while ( sal_True );
+
+ return nRet;
+}
+
+/*************************************************************************
+ * SwTxtFrm::CalcBasePosForFly()
+ *************************************************************************/
+
+void SwTxtFrm::CalcBaseOfstForFly()
+{
+ ASSERT( !IsVertical() || !IsSwapped(),
+ "SwTxtFrm::CalcBasePosForFly with swapped frame!" )
+
+ const SwNode* pNode = GetTxtNode();
+ const SwDoc* pDoc = pNode->GetDoc();
+ if ( !pDoc->IsAddFlyOffsets() )
+ return;
+
+ SWRECTFN( this )
+
+ SwTwips nTop = 0;
+ SwTwips nLineHeight = 200;
+ SwRect aFlyRect( Frm().Pos() + Prt().Pos(), Prt().SSize() );
+
+ // Get first 'real' line
+ const SwLineLayout* pLay = GetPara();
+ while( pLay && pLay->IsDummy() )
+ {
+ nTop += pLay->Height();
+ pLay = pLay->GetNext();
+ }
+ if ( pLay )
+ nLineHeight = pLay->Height();
+
+ SwTwips nNewTop = (aFlyRect.*fnRect->fnGetTop)() +
+ ( bVert ? -nTop : nTop );
+ (aFlyRect.*fnRect->fnSetTopAndHeight)( nNewTop, nLineHeight );
+
+ SwTxtFly aTxtFly( this );
+ aTxtFly.SetIgnoreCurrentFrame( sal_True );
+ aTxtFly.SetIgnoreContour( sal_True );
+ SwTwips nRet1 = lcl_CalcFlyBasePos( *this, aFlyRect, aTxtFly );
+ aTxtFly.SetIgnoreCurrentFrame( sal_False );
+ SwTwips nRet2 = lcl_CalcFlyBasePos( *this, aFlyRect, aTxtFly );
+
+ // make values relative to frame start position
+ SwTwips nLeft = IsRightToLeft() ?
+ (Frm().*fnRect->fnGetRight)() :
+ (Frm().*fnRect->fnGetLeft)();
+
+ mnFlyAnchorOfst = nRet1 - nLeft;
+ mnFlyAnchorOfstNoWrap = nRet2 - nLeft;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtftn.cxx b/binfilter/bf_sw/source/core/text/sw_txtftn.cxx
new file mode 100644
index 000000000000..d786a44876e8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtftn.cxx
@@ -0,0 +1,1414 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "viewsh.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "pagefrm.hxx"
+
+#include <txtftn.hxx>
+#include <flyfrm.hxx>
+#include <fmtftn.hxx>
+#include <ftninfo.hxx>
+#include <charfmt.hxx>
+#include <dflyobj.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/charrotateitem.hxx>
+#include <com/sun/star/i18n/ScriptType.hdl>
+
+#include "txtcfg.hxx"
+#include "porftn.hxx"
+#include "porfly.hxx"
+#include "itrform2.hxx"
+#include "frmsh.hxx"
+#include "ftnfrm.hxx" // FindErgoSumFrm(), FindQuoVadisFrm(),
+#include "pagedesc.hxx"
+#include "sectfrm.hxx" // SwSectionFrm
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+extern BYTE WhichFont( xub_StrLen nIdx, const String* pTxt,
+ const SwScriptInfo* pSI );
+
+/*************************************************************************
+ * _IsFtnNumFrm()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::_IsFtnNumFrm() const
+/*N*/ {
+/*N*/ const SwFtnFrm* pFtn = FindFtnFrm()->GetMaster();
+/*N*/ while( pFtn && !pFtn->ContainsCntnt() )
+/*?*/ pFtn = pFtn->GetMaster();
+/*N*/ return !pFtn;
+/*N*/ }
+
+/*************************************************************************
+ * FindFtn()
+ *************************************************************************/
+
+// Sucht innerhalb einer Master-Follow-Kette den richtigen TxtFrm zum SwTxtFtn
+
+/*N*/ SwTxtFrm *SwTxtFrm::FindFtnRef( const SwTxtFtn *pFtn )
+/*N*/ {
+/*N*/ SwTxtFrm *pFrm = this;
+/*N*/ const sal_Bool bFwd = *pFtn->GetStart() >= GetOfst();
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ if( SwFtnBossFrm::FindFtn( pFrm, pFtn ) )
+/*N*/ return pFrm;
+/*N*/ pFrm = bFwd ? pFrm->GetFollow() :
+/*N*/ pFrm->IsFollow() ? pFrm->FindMaster() : 0;
+/*N*/ }
+/*N*/ return pFrm;
+/*N*/ }
+
+/*************************************************************************
+ * CalcFtnFlag()
+ *************************************************************************/
+
+/*N*/ #ifndef DBG_UTIL
+/*N*/ void SwTxtFrm::CalcFtnFlag()
+/*N*/ #else
+/*N*/ void SwTxtFrm::CalcFtnFlag( xub_StrLen nStop )//Fuer den Test von SplitFrm
+/*N*/ #endif
+/*N*/ {
+/*N*/ bFtn = sal_False;
+/*N*/
+/*N*/ const SwpHints *pHints = GetTxtNode()->GetpSwpHints();
+/*N*/ if( !pHints )
+/*N*/ return;
+/*N*/
+/*N*/ const MSHORT nSize = pHints->Count();
+/*N*/
+/*N*/ #ifndef DBG_UTIL
+/*N*/ const xub_StrLen nEnd = GetFollow() ? GetFollow()->GetOfst() : STRING_LEN;
+/*N*/ #else
+/*N*/ const xub_StrLen nEnd = nStop != STRING_LEN ? nStop
+/*N*/ : GetFollow() ? GetFollow()->GetOfst() : STRING_LEN;
+/*N*/ #endif
+/*N*/
+/*N*/ for( MSHORT i = 0; i < nSize; ++i )
+/*N*/ {
+/*N*/ const SwTxtAttr *pHt = (*pHints)[i];
+/*N*/ if ( pHt->Which() == RES_TXTATR_FTN )
+/*N*/ {
+/*N*/ const xub_StrLen nIdx = *pHt->GetStart();
+/*N*/ if ( nEnd < nIdx )
+/*N*/ break;
+/*N*/ if( GetOfst() <= nIdx )
+/*N*/ {
+/*N*/ bFtn = sal_True;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * CalcPrepFtnAdjust()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrm::CalcPrepFtnAdjust()
+/*N*/ {
+/*N*/ ASSERT( HasFtn(), "Wer ruft mich da?" );
+/*N*/ SwFtnBossFrm *pBoss = FindFtnBossFrm( sal_True );
+/*N*/ const SwFtnFrm *pFtn = pBoss->FindFirstFtn( this );
+/*N*/ if( pFtn && FTNPOS_CHAPTER != GetNode()->GetDoc()->GetFtnInfo().ePos &&
+/*N*/ ( !pBoss->GetUpper()->IsSctFrm() ||
+/*N*/ !((SwSectionFrm*)pBoss->GetUpper())->IsFtnAtEnd() ) )
+/*N*/ {
+/*N*/ const SwFtnContFrm *pCont = pBoss->FindFtnCont();
+/*N*/ sal_Bool bReArrange = sal_True;
+/*N*/
+/*N*/ SWRECTFN( this )
+/*N*/ if ( pCont && (*fnRect->fnYDiff)( (pCont->Frm().*fnRect->fnGetTop)(),
+/*N*/ (Frm().*fnRect->fnGetBottom)() ) > 0 )
+/*N*/ {
+/*N*/ pBoss->RearrangeFtns( (Frm().*fnRect->fnGetBottom)(), sal_False,
+/*N*/ pFtn->GetAttr() );
+/*N*/ ValidateBodyFrm();
+/*N*/ ValidateFrm();
+/*N*/ pFtn = pBoss->FindFirstFtn( this );
+/*N*/ }
+/*N*/ else
+/*N*/ bReArrange = sal_False;
+/*N*/ if( !pCont || !pFtn || bReArrange != (pFtn->FindFtnBossFrm() == pBoss) )
+/*N*/ {
+/*?*/ SwTxtFormatInfo aInf( this );
+/*?*/ SwTxtFormatter aLine( this, &aInf );
+/*?*/ aLine.TruncLines();
+/*?*/ SetPara( 0 ); //Wird ggf. geloescht!
+/*?*/ ResetPreps();
+/*?*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::GetFtnLine()
+ *************************************************************************/
+
+/*N*/ SwTwips SwTxtFrm::GetFtnLine( const SwTxtFtn *pFtn, sal_Bool bLocked ) const
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),
+/*N*/ "SwTxtFrm::GetFtnLine with swapped frame" )
+/*N*/
+/*N*/ SwTxtFrm *pThis = (SwTxtFrm*)this;
+/*N*/
+/*N*/ if( !HasPara() )
+/*N*/ {
+/*N*/ // Es sieht ein wenig gehackt aus, aber man riskiert einen Haufen
+/*N*/ // Aerger, wenn man versucht, per pThis->GetFormatted() doch
+/*N*/ // noch an den richtigen Wert heranzukommen. Durch das PREP_ADJUST
+/*N*/ // stellen wir sicher, dass wir noch einmal drankommen, dann aber
+/*N*/ // von der Ref aus!
+/*N*/ // Trotzdem wollen wir nichts unversucht lassen und geben die
+/*N*/ // Unterkante des Frames zurueck.
+/*?*/ if( !bLocked )
+/*?*/ pThis->Prepare( PREP_ADJUST_FRM );
+/*?*/ return IsVertical() ? Frm().Left() : Frm().Bottom();
+/*N*/ }
+/*N*/
+/*N*/ SWAP_IF_NOT_SWAPPED( this )
+/*N*/
+/*N*/ SwTxtInfo aInf( pThis );
+/*N*/ SwTxtIter aLine( pThis, &aInf );
+/*N*/ const xub_StrLen nPos = *pFtn->GetStart();
+/*N*/ aLine.CharToLine( nPos );
+/*N*/
+/*N*/ SwTwips nRet = aLine.Y() + SwTwips(aLine.GetLineHeight());
+/*N*/ if( IsVertical() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nRet = SwitchHorizontalToVertical( nRet );
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/
+/*N*/ return nRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::GetFtnRstHeight()
+ *************************************************************************/
+
+// Ermittelt die max. erreichbare Hoehe des TxtFrm im Ftn-Bereich.
+// Sie wird eingeschraenkt durch den unteren Rand der Zeile mit
+// der Ftn-Referenz.
+
+/*N*/ SwTwips SwTxtFrm::_GetFtnFrmHeight() const
+/*N*/ {
+/*N*/ ASSERT( !IsFollow() && IsInFtn(), "SwTxtFrm::SetFtnLine: moon walk" );
+/*N*/
+/*N*/ const SwFtnFrm *pFtnFrm = FindFtnFrm();
+/*N*/ const SwTxtFrm *pRef = (const SwTxtFrm *)pFtnFrm->GetRef();
+/*N*/ const SwFtnBossFrm *pBoss = FindFtnBossFrm();
+/*N*/ if( pBoss != pRef->FindFtnBossFrm( !pFtnFrm->GetAttr()->
+/*N*/ GetFtn().IsEndNote() ) )
+/*N*/ return 0;
+/*N*/
+/*N*/ SWAP_IF_SWAPPED( this )
+/*N*/
+/*N*/ SwTwips nHeight = pRef->IsInFtnConnect() ?
+/*N*/ 1 : pRef->GetFtnLine( pFtnFrm->GetAttr(), sal_False );
+/*N*/ if( nHeight )
+/*N*/ {
+/*N*/ // So komisch es aussehen mag: Die erste Ftn auf der Seite darf sich
+/*N*/ // nicht mit der Ftn-Referenz beruehren, wenn wir im Ftn-Bereich Text
+/*N*/ // eingeben.
+/*N*/ const SwFrm *pCont = pFtnFrm->GetUpper();
+/*N*/ //Hoehe innerhalb des Cont, die ich mir 'eh noch genehmigen darf.
+/*N*/ SWRECTFN( pCont )
+/*N*/ SwTwips nTmp = (*fnRect->fnYDiff)( (pCont->*fnRect->fnGetPrtBottom)(),
+/*N*/ (Frm().*fnRect->fnGetTop)() );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( nTmp < 0 )
+/*N*/ {
+/*?*/ sal_Bool bInvalidPos = sal_False;
+/*?*/ const SwLayoutFrm* pTmp = GetUpper();
+/*?*/ while( !bInvalidPos && pTmp )
+/*?*/ {
+/*?*/ bInvalidPos = !pTmp->GetValidPosFlag() ||
+/*?*/ !pTmp->Lower()->GetValidPosFlag();
+/*?*/ if( pTmp == pCont )
+/*?*/ break;
+/*?*/ pTmp = pTmp->GetUpper();
+/*?*/ }
+/*?*/ ASSERT( bInvalidPos, "Hanging below FtnCont" );
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ if ( (*fnRect->fnYDiff)( (pCont->Frm().*fnRect->fnGetTop)(), nHeight) > 0 )
+/*N*/ {
+/*N*/ //Wachstumspotential den Containers.
+/*N*/ if ( !pRef->IsInFtnConnect() )
+/*N*/ {
+/*N*/ SwSaveFtnHeight aSave( (SwFtnBossFrm*)pBoss, nHeight );
+/*N*/ nHeight = ((SwFtnContFrm*)pCont)->Grow( LONG_MAX PHEIGHT, sal_True );
+/*N*/ }
+/*N*/ else
+/*N*/ nHeight = ((SwFtnContFrm*)pCont)->Grow( LONG_MAX PHEIGHT, sal_True );
+/*N*/
+/*N*/ nHeight += nTmp;
+/*N*/ if( nHeight < 0 )
+/*N*/ nHeight = 0;
+/*N*/ }
+/*N*/ else
+/*?*/ { // The container has to shrink
+/*?*/ nTmp += (*fnRect->fnYDiff)( (pCont->Frm().*fnRect->fnGetTop)(), nHeight);
+/*?*/ if( nTmp > 0 )
+/*?*/ nHeight = nTmp;
+/*?*/ else
+/*?*/ nHeight = 0;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( this )
+/*N*/
+/*N*/ return nHeight;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::FindErgoSumFrm()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFrm::FindQuoVadisFrm()
+ *************************************************************************/
+
+/*N*/ SwTxtFrm *SwTxtFrm::FindQuoVadisFrm()
+/*N*/ {
+/*N*/ // Erstmal feststellen, ob wir in einem FtnFrm stehen:
+/*N*/ if( GetIndPrev() || !IsInFtn() )
+/*N*/ return 0;
+/*N*/
+/*N*/ // Zum Vorgaenger-FtnFrm
+/*N*/ SwFtnFrm *pFtnFrm = FindFtnFrm()->GetMaster();
+/*N*/ if( !pFtnFrm )
+/*N*/ return 0;
+/*N*/
+/*N*/ // Nun den letzten Cntnt:
+/*?*/ const SwCntntFrm *pCnt = pFtnFrm->ContainsCntnt();
+/*?*/ if( !pCnt )
+/*?*/ return NULL;
+/*?*/ const SwCntntFrm *pLast;
+/*?*/ do
+/*?*/ { pLast = pCnt;
+/*?*/ pCnt = pCnt->GetNextCntntFrm();
+/*?*/ } while( pCnt && pFtnFrm->IsAnLower( pCnt ) );
+/*?*/ return (SwTxtFrm*)pLast;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrm::SetErgoSumNum()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFrm::RemoveFtn()
+ *************************************************************************/
+
+/*N*/ void SwTxtFrm::RemoveFtn( const xub_StrLen nStart, const xub_StrLen nLen )
+/*N*/ {
+/*N*/ if ( !IsFtnAllowed() )
+/*N*/ return;
+/*N*/
+/*N*/ SwpHints *pHints = GetTxtNode()->GetpSwpHints();
+/*N*/ if( !pHints )
+/*N*/ return;
+/*N*/
+/*N*/ sal_Bool bRollBack = nLen != STRING_LEN;
+/*N*/ MSHORT nSize = pHints->Count();
+/*N*/ xub_StrLen nEnd;
+/*N*/ SwTxtFrm* pSource;
+/*N*/ if( bRollBack )
+/*N*/ {
+/*?*/ nEnd = nStart + nLen;
+/*?*/ pSource = GetFollow();
+/*?*/ if( !pSource )
+/*?*/ return;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nEnd = STRING_LEN;
+/*N*/ pSource = this;
+/*N*/ }
+/*N*/
+/*N*/ if( nSize )
+/*N*/ {
+/*N*/ SwPageFrm* pUpdate = NULL;
+/*N*/ sal_Bool bRemove = sal_False;
+/*N*/ SwFtnBossFrm *pFtnBoss = 0;
+/*N*/ SwFtnBossFrm *pEndBoss = 0;
+/*N*/ sal_Bool bFtnEndDoc
+/*N*/ = FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFtnInfo().ePos;
+/*N*/ for( MSHORT i = nSize; i; )
+/*N*/ {
+/*N*/ SwTxtAttr *pHt = pHints->GetHt(--i);
+/*N*/ if ( RES_TXTATR_FTN != pHt->Which() )
+/*N*/ continue;
+/*N*/
+/*N*/ const xub_StrLen nIdx = *pHt->GetStart();
+/*N*/ if( nStart > nIdx )
+/*N*/ break;
+/*N*/
+/*?*/ if( nEnd >= nIdx )
+/*?*/ {
+/*?*/ SwTxtFtn *pFtn = (SwTxtFtn*)pHt;
+/*?*/ sal_Bool bEndn = pFtn->GetFtn().IsEndNote();
+/*?*/
+/*?*/ if( bEndn )
+/*?*/ {
+/*?*/ if( !pEndBoss )
+/*?*/ pEndBoss = pSource->FindFtnBossFrm();
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ if( !pFtnBoss )
+/*?*/ {
+/*?*/ pFtnBoss = pSource->FindFtnBossFrm( sal_True );
+/*?*/ if( pFtnBoss->GetUpper()->IsSctFrm() )
+/*?*/ {
+/*?*/ SwSectionFrm* pSect = (SwSectionFrm*)
+/*?*/ pFtnBoss->GetUpper();
+/*?*/ if( pSect->IsFtnAtEnd() )
+/*?*/ bFtnEndDoc = sal_False;
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ // Wir loeschen nicht, sondern wollen die Ftn verschieben.
+/*?*/ // Drei Faelle koennen auftreten:
+/*?*/ // 1) Es gibt weder Follow noch PrevFollow
+/*?*/ // -> RemoveFtn() (vielleicht sogar ein ASSERT wert)
+/*?*/ // 2) nStart > GetOfst, ich habe einen Follow
+/*?*/ // -> Ftn wandert in den Follow
+/*?*/ // 3) nStart < GetOfst, ich bin ein Follow
+/*?*/ // -> Ftn wandert in den PrevFollow
+/*?*/ // beide muessen auf einer Seite/in einer Spalte stehen.
+/*?*/
+/*?*/ SwFtnFrm *pFtnFrm = bEndn ? pEndBoss->FindFtn( pSource, pFtn ) :
+/*?*/ pFtnBoss->FindFtn( pSource, pFtn );
+/*?*/
+/*?*/ if( pFtnFrm )
+/*?*/ {
+/*?*/ const sal_Bool bEndDoc = bEndn ? sal_True : bFtnEndDoc;
+/*?*/ if( bRollBack )
+/*?*/ {
+/*?*/ while ( pFtnFrm )
+/*?*/ {
+/*?*/ pFtnFrm->SetRef( this );
+/*?*/ pFtnFrm = pFtnFrm->GetFollow();
+/*?*/ SetFtn( sal_True );
+/*?*/ }
+/*?*/ }
+/*?*/ else if( GetFollow() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ {
+/*?*/ else
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( !bEndDoc || ( bEndn && pEndBoss->IsInSct() &&
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ if( pUpdate )
+/*?*/ pUpdate->UpdateFtnNum();
+/*N*/ // Wir bringen die Oszillation zum stehen:
+/*N*/ if( bRemove && !bFtnEndDoc && HasPara() )
+/*N*/ {
+/*?*/ ValidateBodyFrm();
+/*?*/ ValidateFrm();
+/*N*/ }
+/*N*/ }
+/*N*/ // Folgendes Problem: Aus dem FindBreak heraus wird das RemoveFtn aufgerufen,
+/*N*/ // weil die letzte Zeile an den Follow abgegeben werden soll. Der Offset
+/*N*/ // des Follows ist aber veraltet, er wird demnaechst gesetzt. CalcFntFlag ist
+/*N*/ // auf einen richtigen Follow-Offset angewiesen. Deshalb wird hier kurzfristig
+/*N*/ // der Follow-Offset manipuliert.
+/*N*/ xub_StrLen nOldOfst = STRING_LEN;
+/*N*/ if( HasFollow() && nStart > GetOfst() )
+/*N*/ {
+/*N*/ nOldOfst = GetFollow()->GetOfst();
+/*N*/ GetFollow()->ManipOfst( nStart + ( bRollBack ? nLen : 0 ) );
+/*N*/ }
+/*N*/ pSource->CalcFtnFlag();
+/*N*/ if( nOldOfst < STRING_LEN )
+/*N*/ GetFollow()->ManipOfst( nOldOfst );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::ConnectFtn()
+ *************************************************************************/
+// sal_False, wenn irgendetwas schief gegangen ist.
+// Es gibt eigentlich nur zwei Moeglichkeiten:
+// a) Die Ftn ist bereits vorhanden
+// => dann wird sie gemoved, wenn ein anderer pSrcFrm gefunden wurde
+// b) Die Ftn ist nicht vorhanden
+// => dann wird sie fuer uns angelegt.
+// Ob die Ftn schliesslich auf unserer Spalte/Seite landet oder nicht,
+// spielt in diesem Zusammenhang keine Rolle.
+// Optimierungen bei Endnoten.
+// Noch ein Problem: wenn die Deadline im Ftn-Bereich liegt, muss die
+// Ftn verschoben werden.
+
+/*N*/ void SwTxtFrm::ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine )
+/*N*/ {
+/*N*/ ASSERT( ! IsVertical() || ! IsSwapped(),
+/*N*/ "SwTxtFrm::ConnectFtn with swapped frame" );
+/*N*/
+/*N*/ bFtn = sal_True;
+/*N*/ bInFtnConnect = sal_True; //Bloss zuruecksetzen!
+/*N*/ sal_Bool bEnd = pFtn->GetFtn().IsEndNote();
+/*N*/
+/*N*/ // Wir brauchen immer einen Boss (Spalte/Seite)
+/*N*/ SwSectionFrm *pSect;
+/*N*/ SwCntntFrm *pCntnt = this;
+/*N*/ if( bEnd && IsInSct() )
+/*N*/ {
+/*?*/ pSect = FindSctFrm();
+/*?*/ if( pSect->IsEndnAtEnd() )
+/*?*/ pCntnt = pSect->FindLastCntnt( FINDMODE_ENDNOTE );
+/*?*/ if( !pCntnt )
+/*?*/ pCntnt = this;
+/*N*/ }
+/*N*/
+/*N*/ SwFtnBossFrm *pBoss = pCntnt->FindFtnBossFrm( !bEnd );
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ SwTwips nRstHeight = GetRstHeight();
+/*N*/ #endif
+/*N*/
+/*N*/ pSect = pBoss->FindSctFrm();
+/*N*/ sal_Bool bDocEnd = bEnd ? !( pSect && pSect->IsEndnAtEnd() ) :
+/*N*/ ( !( pSect && pSect->IsFtnAtEnd() ) &&
+/*N*/ FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFtnInfo().ePos );
+/*N*/ //Ftn kann beim Follow angemeldet sein.
+/*N*/ SwCntntFrm *pSrcFrm = FindFtnRef( pFtn );
+/*N*/
+/*N*/ if( bDocEnd )
+/*N*/ {
+/*?*/ if( pSect && pSrcFrm )
+/*?*/ {
+/*?*/ SwFtnFrm *pFtnFrm = pBoss->FindFtn( pSrcFrm, pFtn );
+/*?*/ if( pFtnFrm && pFtnFrm->IsInSct() )
+/*?*/ {
+/*?*/ pBoss->RemoveFtn( pSrcFrm, pFtn );
+/*?*/ pSrcFrm = 0;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ else if( bEnd && pSect )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFtnFrm *pFtnFrm = pSrcFrm ? pBoss->FindFtn( pSrcFrm, pFtn ) : NULL;
+/*N*/ }
+/*N*/
+/*N*/ if( bDocEnd || bEnd )
+/*N*/ {
+/*?*/ if( !pSrcFrm )
+/*?*/ pBoss->AppendFtn( this, pFtn );
+/*?*/ else if( pSrcFrm != this )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pBoss->ChangeFtnRef( pSrcFrm, pFtn, this );
+/*?*/ bInFtnConnect = sal_False;
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ SwSaveFtnHeight aHeight( pBoss, nDeadLine );
+/*N*/
+/*N*/ if( !pSrcFrm ) // Es wurde ueberhaupt keine Ftn gefunden.
+/*N*/ pBoss->AppendFtn( this, pFtn );
+/*N*/ else
+/*N*/ {
+/*N*/ SwFtnFrm *pFtnFrm = pBoss->FindFtn( pSrcFrm, pFtn );
+/*N*/ SwFtnBossFrm *pFtnBoss = pFtnFrm->FindFtnBossFrm();
+/*N*/
+/*N*/ sal_Bool bBrutal = sal_False;
+/*N*/
+/*N*/ if( pFtnBoss == pBoss ) // Ref und Ftn sind auf der selben Seite/Spalte.
+/*N*/ {
+/*N*/ SwFrm *pCont = pFtnFrm->GetUpper();
+/*N*/
+/*N*/ SWRECTFN ( pCont )
+/*N*/ long nDiff = (*fnRect->fnYDiff)( (pCont->Frm().*fnRect->fnGetTop)(),
+/*N*/ nDeadLine );
+/*N*/
+/*N*/ if( nDiff >= 0 )
+/*N*/ {
+/*N*/ //Wenn die Fussnote bei einem Follow angemeldet ist, so ist
+/*N*/ //es jetzt an der Zeit sie umzumelden.
+/*N*/ if ( pSrcFrm != this )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pBoss->ChangeFtnRef( pSrcFrm, pFtn, this );
+/*N*/ //Es steht Platz zur Verfuegung, also kann die Fussnote evtl.
+/*N*/ //wachsen.
+/*N*/ if ( pFtnFrm->GetFollow() && nDiff > 0 )
+/*N*/ {
+/*?*/ SwTwips nHeight = (pCont->Frm().*fnRect->fnGetHeight)();
+/*?*/ pBoss->RearrangeFtns( nDeadLine, sal_False, pFtn );
+/*?*/ ValidateBodyFrm();
+/*?*/ ValidateFrm();
+/*?*/ ViewShell *pSh = GetShell();
+/*?*/ if ( pSh && nHeight == (pCont->Frm().*fnRect->fnGetHeight)() )
+/*?*/ //Damit uns nix durch die Lappen geht.
+/*?*/ pSh->InvalidateWindows( pCont->Frm() );
+/*?*/ }
+/*?*/ bInFtnConnect = sal_False;
+/*?*/ return;
+/*N*/ }
+/*N*/ else
+/*N*/ bBrutal = sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Ref und Ftn sind nicht auf einer Seite, Move-Versuch ist noetig.
+/*N*/ SwFrm* pTmp = this;
+/*N*/ while( pTmp->GetNext() && pSrcFrm != pTmp )
+/*?*/ pTmp = pTmp->GetNext();
+/*N*/ if( pSrcFrm == pTmp )
+/*N*/ bBrutal = sal_True;
+/*N*/ else
+/*N*/ { // Wenn unser Boss in einem spaltigen Bereich sitzt, es aber auf
+/*N*/ // der Seite schon einen FtnContainer gibt, hilft nur die brutale
+/*N*/ // Methode
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ if( pSect && pSect->FindFtnBossFrm( !bEnd )->FindFtnCont() )
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Die brutale Loesung: Fussnote entfernen und appenden.
+/*N*/ // Es muss SetFtnDeadLine() gerufen werden, weil nach
+/*N*/ // RemoveFtn die nMaxFtnHeight evtl. besser auf unsere Wuensche
+/*N*/ // eingestellt werden kann.
+/*N*/ if( bBrutal )
+/*N*/ {
+/*N*/ pBoss->RemoveFtn( pSrcFrm, pFtn, sal_False );
+/*N*/ SwSaveFtnHeight *pHeight = bEnd ? NULL :
+/*N*/ new SwSaveFtnHeight( pBoss, nDeadLine );
+/*N*/ pBoss->AppendFtn( this, pFtn );
+/*N*/ delete pHeight;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // In spaltigen Bereichen, die noch nicht bis zum Seitenrand gehen,
+/*N*/ // ist kein RearrangeFtns sinnvoll, da der Fussnotencontainer noch
+/*N*/ // nicht kalkuliert worden ist.
+/*N*/ if( !pSect || !pSect->Growable() )
+/*N*/ {
+/*N*/ // Umgebung validieren, um Oszillationen zu verhindern.
+/*N*/ SwSaveFtnHeight aNochmal( pBoss, nDeadLine );
+/*N*/ ValidateBodyFrm();
+/*N*/ pBoss->RearrangeFtns( nDeadLine, sal_True );
+/*N*/ ValidateFrm();
+/*N*/ }
+/*N*/ else if( pSect->IsFtnAtEnd() )
+/*N*/ {
+/*?*/ ValidateBodyFrm();
+/*?*/ ValidateFrm();
+/*N*/ }
+/*N*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ // pFtnFrm kann sich durch Calc veraendert haben ...
+/*N*/ SwFtnFrm *pFtnFrm = pBoss->FindFtn( this, pFtn );
+/*N*/ if( pFtnFrm && pBoss != pFtnFrm->FindFtnBossFrm( !bEnd ) )
+/*N*/ {
+/*N*/ int bla = 5;
+/*N*/ }
+/*N*/ nRstHeight = GetRstHeight();
+/*N*/ #endif
+/*N*/ bInFtnConnect = sal_False;
+/*N*/ return;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewFtnPortion()
+ *************************************************************************/
+
+// Die Portion fuer die Ftn-Referenz im Text
+/*N*/ SwFtnPortion *SwTxtFormatter::NewFtnPortion( SwTxtFormatInfo &rInf,
+/*N*/ SwTxtAttr *pHint )
+/*N*/ {
+/*N*/ ASSERT( ! pFrm->IsVertical() || pFrm->IsSwapped(),
+/*N*/ "NewFtnPortion with unswapped frame" );
+/*N*/
+/*N*/ if( !pFrm->IsFtnAllowed() )
+/*N*/ return 0;
+/*N*/
+/*N*/ SwTxtFtn *pFtn = (SwTxtFtn*)pHint;
+/*N*/ SwFmtFtn& rFtn = (SwFmtFtn&)pFtn->GetFtn();
+/*N*/ SwDoc *pDoc = pFrm->GetNode()->GetDoc();
+/*N*/
+/*N*/ if( rInf.IsTest() )
+/*?*/ return new SwFtnPortion( rFtn.GetViewNumStr( *pDoc ), pFrm, pFtn );
+/*N*/
+/*N*/ SWAP_IF_SWAPPED( pFrm )
+/*N*/
+/*N*/ KSHORT nReal;
+/*N*/ {
+/*N*/ KSHORT nOldReal = pCurr->GetRealHeight();
+/*N*/ KSHORT nOldAscent = pCurr->GetAscent();
+/*N*/ KSHORT nOldHeight = pCurr->Height();
+/*N*/ ((SwTxtFormatter*)this)->CalcRealHeight();
+/*N*/ nReal = pCurr->GetRealHeight();
+/*N*/ if( nReal < nOldReal )
+/*N*/ nReal = nOldReal;
+/*N*/ pCurr->SetRealHeight( nOldReal );
+/*N*/ pCurr->Height( nOldHeight );
+/*N*/ pCurr->SetAscent( nOldAscent );
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nLower = Y() + nReal;
+/*N*/
+/*N*/ SWRECTFN( pFrm )
+/*N*/
+/*N*/ if( bVert )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nLower = pFrm->SwitchHorizontalToVertical( nLower );
+/*N*/
+/*N*/ SwTwips nAdd;
+/*N*/
+/*N*/ if( pFrm->IsInTab() && (!pFrm->IsInSct() || pFrm->FindSctFrm()->IsInTab()) )
+/*N*/ {
+/*?*/ SwFrm *pRow = pFrm;
+/*?*/ while( !pRow->IsRowFrm() || !pRow->GetUpper()->IsTabFrm() )
+/*?*/ pRow = pRow->GetUpper();
+/*?*/
+/*?*/ const SwTwips nMin = (pRow->Frm().*fnRect->fnGetBottom)();
+/*?*/
+/*?*/ if( ( ! bVert && nMin > nLower ) || ( bVert && nMin < nLower ) )
+/*?*/ nLower = nMin;
+/*?*/
+/*?*/ nAdd = (pRow->GetUpper()->*fnRect->fnGetBottomMargin)();
+/*N*/ }
+/*N*/ else
+/*N*/ nAdd = (pFrm->*fnRect->fnGetBottomMargin)();
+/*N*/
+/*N*/ if( nAdd > 0 )
+/*N*/ {
+/*N*/ if ( bVert )
+/*N*/ nLower -= nAdd;
+/*N*/ else
+/*N*/ nLower += nAdd;
+/*N*/ }
+/*N*/
+/*N*/ // #i10770#: If there are fly frames anchored at previous paragraphs,
+/*N*/ // the deadline should consider their lower borders.
+/*N*/ SwFrm* pStartFrm = pFrm->GetUpper()->GetLower();
+/*N*/ ASSERT( pStartFrm, "Upper has no lower" )
+/*N*/ SwTwips nFlyLower = bVert ? LONG_MAX : 0;
+/*N*/ while ( pStartFrm != pFrm )
+/*N*/ {
+/*N*/ ASSERT( pStartFrm, "Frame chain is broken" )
+/*N*/ if ( pStartFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ const SwDrawObjs &rObjs = *pStartFrm->GetDrawObjs();
+/*N*/ for ( USHORT i = 0; i < rObjs.Count(); ++i )
+/*N*/ {
+/*N*/ SdrObject *pO = rObjs[i];
+/*N*/ SwRect aRect( pO->GetBoundRect() );
+/*N*/
+/*N*/ if ( ! pO->IsWriterFlyFrame() ||
+/*N*/ ((SwVirtFlyDrawObj*)pO)->GetFlyFrm()->IsValid() )
+/*N*/ {
+/*N*/ const SwTwips nBottom = (aRect.*fnRect->fnGetBottom)();
+/*N*/ if ( (*fnRect->fnYDiff)( nBottom, nFlyLower ) > 0 )
+/*N*/ nFlyLower = nBottom;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pStartFrm = pStartFrm->GetNext();
+/*N*/ }
+/*N*/
+/*N*/ if ( bVert )
+/*N*/ nLower = Min( nLower, nFlyLower );
+/*N*/ else
+/*N*/ nLower = Max( nLower, nFlyLower );
+/*N*/
+/*N*/ //6995: Wir frischen nur auf. Das Connect tut fuer diesen Fall nix
+/*N*/ //Brauchbares, sondern wuerde stattdessen fuer diesen Fall meist die
+/*N*/ //Ftn wegwerfen und neu erzeugen.
+/*N*/
+/*N*/ if( !rInf.IsQuick() )
+/*N*/ pFrm->ConnectFtn( pFtn, nLower );
+/*N*/
+/*N*/ SwTxtFrm *pScrFrm = pFrm->FindFtnRef( pFtn );
+/*N*/ SwFtnBossFrm *pBoss = pFrm->FindFtnBossFrm( !rFtn.IsEndNote() );
+/*N*/ SwFtnFrm *pFtnFrm = NULL;
+/*N*/ if( pScrFrm )
+/*N*/ {
+/*N*/ pFtnFrm = pBoss->FindFtn( pScrFrm, pFtn );
+/*N*/ if( pFtnFrm && pFtnFrm->Lower() )
+/*N*/ {
+/*N*/ SwTxtFrm *pTxtFrm = NULL;
+/*N*/ if( pFtnFrm->Lower()->IsTxtFrm() )
+/*N*/ pTxtFrm = (SwTxtFrm*)pFtnFrm->Lower();
+/*N*/ else if( pFtnFrm->Lower()->IsSctFrm() )
+/*N*/ {
+/*?*/ SwFrm* pCntnt = ((SwSectionFrm*)pFtnFrm->Lower())->ContainsCntnt();
+/*?*/ if( pCntnt && pCntnt->IsTxtFrm() )
+/*?*/ pTxtFrm = (SwTxtFrm*)pCntnt;
+/*N*/ }
+/*N*/ if ( pTxtFrm && pTxtFrm->HasPara() )
+/*N*/ {
+/*N*/ SwParaPortion *pPara = pTxtFrm->GetPara();
+/*N*/ SwLinePortion *pTmp = pPara->GetPortion();
+/*N*/ while( pTmp )
+/*N*/ {
+/*N*/ if( pTmp->IsFtnNumPortion() )
+/*N*/ {
+/*N*/ SeekAndChg( rInf );
+/*N*/ if( ((SwFtnNumPortion*)pTmp)->DiffFont( rInf.GetFont() ) )
+/*N*/ pTxtFrm->Prepare(PREP_FTN);
+/*N*/ break;
+/*N*/ }
+/*?*/ pTmp = pTmp->GetPortion();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Wir erkundigen uns, ob durch unser Append irgendeine
+/*N*/ // Fussnote noch auf der Seite/Spalte steht. Wenn nicht verschwindet
+/*N*/ // auch unsere Zeile. Dies fuehrt zu folgendem erwuenschten
+/*N*/ // Verhalten: Ftn1 pass noch auf die Seite/Spalte, Ftn2 nicht mehr.
+/*N*/ // Also bleibt die Ftn2-Referenz auf der Seite/Spalte stehen. Die
+/*N*/ // Fussnote selbst folgt aber erst auf der naechsten Seite/Spalte.
+/*N*/ // Ausnahme: Wenn keine weitere Zeile auf diese Seite/Spalte passt,
+/*N*/ // so sollte die Ftn2-Referenz auch auf die naechste wandern.
+/*N*/ if( !rFtn.IsEndNote() )
+/*N*/ {
+/*N*/ SwSectionFrm *pSct = pBoss->FindSctFrm();
+/*N*/ sal_Bool bAtSctEnd = pSct && pSct->IsFtnAtEnd();
+/*N*/ if( FTNPOS_CHAPTER != pDoc->GetFtnInfo().ePos || bAtSctEnd )
+/*N*/ {
+/*N*/ SwFrm* pFtnCont = pBoss->FindFtnCont();
+/*N*/ // Wenn der Boss in einem Bereich liegt, kann es sich nur um eine
+/*N*/ // Spalte dieses Bereichs handeln. Wenn dies nicht die erste Spalte
+/*N*/ // ist, duerfen wir ausweichen
+/*N*/ if( !pFrm->IsInTab() && ( GetLineNr() > 1 || pFrm->GetPrev() ||
+/*N*/ ( !bAtSctEnd && pFrm->GetIndPrev() ) ||
+/*N*/ ( pSct && pBoss->GetPrev() ) ) )
+/*N*/ {
+/*N*/ if( !pFtnCont )
+/*N*/ {
+/*?*/ rInf.SetStop( sal_True );
+/*?*/ UNDO_SWAP( pFrm )
+/*?*/ return 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Es darf keine Fussnotencontainer in spaltigen Bereichen und
+/*N*/ // gleichzeitig auf der Seite/Seitenspalte geben
+/*N*/ if( pSct && !bAtSctEnd ) // liegt unser Container in einem (spaltigen) Bereich?
+/*N*/ {
+/*?*/ SwFtnBossFrm* pTmp = pBoss->FindSctFrm()->FindFtnBossFrm( sal_True );
+/*?*/ SwFtnContFrm* pFtnC = pTmp->FindFtnCont();
+/*?*/ if( pFtnC )
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFtnFrm* pTmp = (SwFtnFrm*)pFtnC->Lower();
+/*?*/ }
+/*N*/ }
+/*N*/ // Ist dies die letzte passende Zeile?
+/*N*/ SwTwips nTmpBot = Y() + nReal * 2;
+/*N*/
+/*N*/ if( bVert )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nTmpBot = pFrm->SwitchHorizontalToVertical( nTmpBot );
+/*N*/
+/*N*/ SWRECTFN( pFtnCont )
+/*N*/
+/*N*/ long nDiff = (*fnRect->fnYDiff)(
+/*N*/ (pFtnCont->Frm().*fnRect->fnGetTop)(),
+/*N*/ nTmpBot );
+/*N*/
+/*N*/ if( pScrFrm && nDiff < 0 )
+/*N*/ {
+/*?*/ if( pFtnFrm )
+/*?*/ {
+/*?*/ SwFtnBossFrm *pFtnBoss = pFtnFrm->FindFtnBossFrm();
+/*?*/ if( pFtnBoss != pBoss )
+/*?*/ {
+/*?*/ // Wir sind in der letzte Zeile und die Fussnote
+/*?*/ // ist auf eine andere Seite gewandert, dann wollen
+/*?*/ // wir mit ...
+/*?*/ rInf.SetStop( sal_True );
+/*?*/ UNDO_SWAP( pFrm )
+/*?*/ return 0;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // Endlich: FtnPortion anlegen und raus hier...
+/*N*/ SwFtnPortion *pRet = new SwFtnPortion( rFtn.GetViewNumStr( *pDoc ),
+/*N*/ pFrm, pFtn, nReal );
+/*N*/ rInf.SetFtnInside( sal_True );
+/*N*/
+/*N*/ UNDO_SWAP( pFrm )
+/*N*/
+/*N*/ return pRet;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewFtnNumPortion()
+ *************************************************************************/
+
+// Die Portion fuer die Ftn-Nummerierung im Ftn-Bereich
+
+/*N*/ SwNumberPortion *SwTxtFormatter::NewFtnNumPortion( SwTxtFormatInfo &rInf ) const
+/*N*/ {
+/*N*/ ASSERT( pFrm->IsInFtn() && !pFrm->GetIndPrev() && !rInf.IsFtnDone(),
+/*N*/ "This is the wrong place for a ftnnumber" );
+/*N*/ if( rInf.GetTxtStart() != nStart ||
+/*N*/ rInf.GetTxtStart() != rInf.GetIdx() )
+/*N*/ return 0;
+/*N*/
+/*N*/ const SwFtnFrm *pFtnFrm = pFrm->FindFtnFrm();
+/*N*/ const SwTxtFtn *pFtn = pFtnFrm->GetAttr();
+/*N*/
+/*N*/ // Aha, wir sind also im Fussnotenbereich
+/*N*/ SwFmtFtn& rFtn = (SwFmtFtn&)pFtn->GetFtn();
+/*N*/
+/*N*/ SwDoc *pDoc = pFrm->GetNode()->GetDoc();
+/*N*/ XubString aFtnTxt( rFtn.GetViewNumStr( *pDoc, sal_True ));
+/*N*/
+/*N*/ const SwEndNoteInfo* pInfo;
+/*N*/ if( rFtn.IsEndNote() )
+/*?*/ pInfo = &pDoc->GetEndNoteInfo();
+/*N*/ else
+/*N*/ pInfo = &pDoc->GetFtnInfo();
+/*N*/ const SwAttrSet& rSet = pInfo->GetCharFmt(*pDoc)->GetAttrSet();
+/*N*/
+/*N*/ const SwAttrSet* pParSet = &rInf.GetCharAttr();
+/*N*/ SwFont *pFnt = new SwFont( pParSet, rInf.GetDoc() );
+/*N*/ pFnt->SetDiffFnt(&rSet, rInf.GetDoc() );
+/*N*/ SwTxtFtn* pTxtFtn = rFtn.GetTxtFtn();
+/*N*/ if( pTxtFtn )
+/*N*/ {
+/*N*/ SwScriptInfo aScriptInfo;
+/*N*/ SwAttrIter aIter( (SwTxtNode&)pTxtFtn->GetTxtNode(), aScriptInfo );
+/*N*/ aIter.Seek( *pTxtFtn->GetStart() );
+/*N*/ // Achtung: Wenn die Kriterien, nach denen der FtnReferenz-Font
+/*N*/ // auf den FtnNumerierungsfont wirkt, geaendert werden, muss die
+/*N*/ // untenstehende Methode SwFtnNumPortion::DiffFont() angepasst
+/*N*/ // werden.
+/*N*/ if( aIter.GetFnt()->IsSymbol(rInf.GetVsh()) || aIter.GetFnt()->GetCharSet() !=
+/*N*/ pFnt->GetCharSet() )
+/*N*/ {
+/*N*/ const BYTE nAct = pFnt->GetActual();
+/*N*/ pFnt->SetName( aIter.GetFnt()->GetName(), nAct );
+/*N*/ pFnt->SetStyleName( aIter.GetFnt()->GetStyleName(), nAct );
+/*N*/ pFnt->SetFamily( aIter.GetFnt()->GetFamily(),nAct );
+/*N*/ pFnt->SetCharSet( aIter.GetFnt()->GetCharSet(), nAct );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*M*/ pFnt->SetVertical( pFnt->GetOrientation(), pFrm->IsVertical() );
+/*N*/ return new SwFtnNumPortion( aFtnTxt, pFnt );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewErgoSumPortion()
+ *************************************************************************/
+
+/*?*/ XubString lcl_GetPageNumber( const SwPageFrm* pPage )
+/*?*/ {
+/*?*/ ASSERT( pPage, "GetPageNumber: Homeless TxtFrm" );
+/*?*/ MSHORT nVirtNum = pPage->GetVirtPageNum();
+/*?*/ const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
+/*?*/ return rNum.GetNumStr( nVirtNum );
+/*?*/ }
+
+/*N*/ SwErgoSumPortion *SwTxtFormatter::NewErgoSumPortion( SwTxtFormatInfo &rInf ) const
+/*N*/ {
+/*N*/ // Wir koennen nicht davon ausgehen, dass wir ein Follow sind
+/*N*/ // 7983: GetIdx() nicht nStart
+/*N*/ if( !pFrm->IsInFtn() || pFrm->GetPrev() ||
+/*N*/ rInf.IsErgoDone() || rInf.GetIdx() != pFrm->GetOfst() ||
+/*N*/ pFrm->ImplFindFtnFrm()->GetAttr()->GetFtn().IsEndNote() )
+/*N*/ return 0;
+/*N*/
+/*N*/ // Aha, wir sind also im Fussnotenbereich
+/*N*/ const SwFtnInfo &rFtnInfo = pFrm->GetNode()->GetDoc()->GetFtnInfo();
+/*N*/ SwTxtFrm *pQuoFrm = pFrm->FindQuoVadisFrm();
+/*N*/ if( !pQuoFrm )
+/*N*/ return 0;
+/*?*/ const SwPageFrm* pPage = pFrm->FindPageFrm();
+/*?*/ const SwPageFrm* pQuoPage = pQuoFrm->FindPageFrm();
+/*?*/ if( pPage == pQuoFrm->FindPageFrm() )
+/*?*/ return 0; // Wenn der QuoVadis auf der selben (spaltigen) Seite steht
+ {DBG_BF_ASSERT(0, "STRIP");} return 0;//STRIP001 /*?*/ const XubString aPage = lcl_GetPageNumber( pPage );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::FormatQuoVadis()
+ *************************************************************************/
+
+/*M*/ xub_StrLen SwTxtFormatter::FormatQuoVadis( const xub_StrLen nOffset )
+/*M*/ {
+/*M*/ ASSERT( ! pFrm->IsVertical() || ! pFrm->IsSwapped(),
+/*M*/ "SwTxtFormatter::FormatQuoVadis with swapped frame" );
+/*M*/
+/*M*/ if( !pFrm->IsInFtn() || pFrm->ImplFindFtnFrm()->GetAttr()->GetFtn().IsEndNote() )
+/*M*/ return nOffset;
+/*M*/
+/*M*/ const SwFrm* pErgoFrm = pFrm->FindFtnFrm()->GetFollow();
+/*M*/ if( !pErgoFrm && pFrm->HasFollow() )
+/*M*/ pErgoFrm = pFrm->GetFollow();
+/*M*/ if( !pErgoFrm )
+/*M*/ return nOffset;
+/*M*/
+/*M*/ if( pErgoFrm == pFrm->GetNext() )
+/*M*/ {
+/*M*/ SwFrm *pCol = pFrm->FindColFrm();
+/*M*/ while( pCol && !pCol->GetNext() )
+/*M*/ pCol = pCol->GetUpper()->FindColFrm();
+/*M*/ if( pCol )
+/*M*/ return nOffset;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ const SwPageFrm* pPage = pFrm->FindPageFrm();
+/*M*/ const SwPageFrm* pErgoPage = pErgoFrm->FindPageFrm();
+/*M*/ if( pPage == pErgoFrm->FindPageFrm() )
+/*M*/ return nOffset; // Wenn der ErgoSum auf der selben Seite steht
+/*M*/ }
+/*M*/
+/*M*/ SwTxtFormatInfo &rInf = GetInfo();
+/*M*/ const SwFtnInfo &rFtnInfo = pFrm->GetNode()->GetDoc()->GetFtnInfo();
+/*M*/ if( !rFtnInfo.aQuoVadis.Len() )
+/*M*/ return nOffset;
+/*M*/
+/*M*/ // Ein Wort zu QuoVadis/ErgoSum:
+/*M*/ // Fuer diese Texte wird der am Absatz eingestellte Font verwendet.
+/*M*/ // Wir initialisieren uns also:
+/*M*/ // ResetFont();
+/*M*/ FeedInf( rInf );
+/*M*/ SeekStartAndChg( rInf, sal_True );
+/*M*/ if( GetRedln() && pCurr->HasRedline() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 GetRedln()->Seek( *pFnt, nOffset, 0 );
+/*M*/
+/*M*/ // Ein fieser Sonderfall: Flyfrms reichen in die Zeile und stehen
+/*M*/ // natuerlich da, wo wir unseren Quovadis Text reinsetzen wollen.
+/*M*/ // Erst mal sehen, ob es so schlimm ist:
+/*M*/ SwLinePortion *pPor = pCurr->GetFirstPortion();
+/*M*/ KSHORT nLastLeft = 0;
+/*M*/ while( pPor )
+/*M*/ {
+/*M*/ if ( pPor->IsFlyPortion() )
+/*M*/ nLastLeft = ( (SwFlyPortion*) pPor)->Fix() +
+/*M*/ ( (SwFlyPortion*) pPor)->Width();
+/*M*/ pPor = pPor->GetPortion();
+/*M*/ }
+/*M*/ // Das alte Spiel: wir wollen, dass die Zeile an einer bestimmten
+/*M*/ // Stelle umbricht, also beeinflussen wir die Width.
+/*M*/ // nLastLeft ist jetzt quasi der rechte Rand.
+/*M*/ const KSHORT nOldRealWidth = rInf.RealWidth();
+/*M*/ rInf.RealWidth( nOldRealWidth - nLastLeft );
+/*M*/
+/*?*/ XubString aErgo = lcl_GetPageNumber( pErgoFrm->FindPageFrm() );
+/*?*/ SwQuoVadisPortion *pQuo = new SwQuoVadisPortion(rFtnInfo.aQuoVadis, aErgo );
+/*M*/ pQuo->SetAscent( rInf.GetAscent() );
+/*M*/ pQuo->Height( rInf.GetTxtHeight() );
+/*M*/ pQuo->Format( rInf );
+/*M*/ USHORT nQuoWidth = pQuo->Width();
+/*M*/ SwLinePortion* pCurrPor = pQuo;
+/*M*/
+/*M*/ while ( rInf.GetRest() )
+/*M*/ {
+/*M*/ SwLinePortion* pFollow = rInf.GetRest();
+/*M*/ rInf.SetRest( 0 );
+/*M*/ pCurrPor->Move( rInf );
+/*M*/
+/*M*/ ASSERT( pFollow->IsQuoVadisPortion(),
+/*M*/ "Quo Vadis, rest of QuoVadisPortion" )
+/*M*/
+/*M*/ // format the rest and append it to the other QuoVadis parts
+/*M*/ pFollow->Format( rInf );
+/*M*/ nQuoWidth += pFollow->Width();
+/*M*/
+/*M*/ pCurrPor->Append( pFollow );
+/*M*/ pCurrPor = pFollow;
+/*M*/ }
+/*M*/
+/*M*/ nLastLeft = nOldRealWidth - nQuoWidth;
+/*M*/ Right( Right() - nQuoWidth );
+/*M*/
+/*M*/ SWAP_IF_NOT_SWAPPED( pFrm )
+/*M*/
+/*M*/ const xub_StrLen nRet = FormatLine( nStart );
+/*M*/
+/*M*/ UNDO_SWAP( pFrm )
+/*M*/
+/*M*/ Right( rInf.Left() + nOldRealWidth - 1 );
+/*M*/
+/*M*/ nLastLeft = nOldRealWidth - pCurr->Width();
+/*M*/ FeedInf( rInf );
+/*M*/ #ifdef USED
+/*M*/ ASSERT( nOldRealWidth == rInf.RealWidth() && nLastLeft >= pQuo->Width(),
+/*M*/ "SwTxtFormatter::FormatQuoVadis: crime doesn't pay" );
+/*M*/ #endif
+/*M*/
+/*M*/ // Es kann durchaus sein, dass am Ende eine Marginportion steht,
+/*M*/ // die beim erneuten Aufspannen nur Aerger bereiten wuerde.
+/*M*/ pPor = pCurr->FindLastPortion();
+/*M*/ SwGluePortion *pGlue = pPor->IsMarginPortion() ?
+/*M*/ (SwMarginPortion*) pPor : 0;
+/*M*/ if( pGlue )
+/*M*/ {
+/*M*/ pGlue->Height( 0 );
+/*M*/ pGlue->Width( 0 );
+/*M*/ pGlue->SetLen( 0 );
+/*M*/ pGlue->SetAscent( 0 );
+/*M*/ pGlue->SetPortion( NULL );
+/*M*/ pGlue->SetFixWidth(0);
+/*M*/ }
+/*M*/
+/*M*/ // Luxus: Wir sorgen durch das Aufspannen von Glues dafuer,
+/*M*/ // dass der QuoVadis-Text rechts erscheint:
+/*M*/ nLastLeft -= nQuoWidth;
+/*M*/ if( nLastLeft )
+/*M*/ {
+/*M*/ if( nLastLeft > pQuo->GetAscent() ) // Mindestabstand
+/*M*/ {
+/*M*/ switch( GetAdjust() )
+/*M*/ {
+/*M*/ case SVX_ADJUST_BLOCK:
+/*M*/ {
+/*M*/ if( !pCurr->GetLen() ||
+/*M*/ CH_BREAK != GetInfo().GetChar(nStart+pCurr->GetLen()-1))
+/*M*/ nLastLeft = pQuo->GetAscent();
+/*M*/ nQuoWidth += nLastLeft;
+/*M*/ break;
+/*M*/ }
+/*M*/ case SVX_ADJUST_RIGHT:
+/*M*/ {
+/*M*/ nLastLeft = pQuo->GetAscent();
+/*M*/ nQuoWidth += nLastLeft;
+/*M*/ break;
+/*M*/ }
+/*M*/ case SVX_ADJUST_CENTER:
+/*M*/ {
+/*M*/ nQuoWidth += pQuo->GetAscent();
+/*M*/ long nDiff = nLastLeft - nQuoWidth;
+/*M*/ if( nDiff < 0 )
+/*M*/ {
+/*M*/ nLastLeft = pQuo->GetAscent();
+/*M*/ nQuoWidth = -nDiff + nLastLeft;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ nQuoWidth = 0;
+/*M*/ nLastLeft = ( pQuo->GetAscent() + nDiff ) / 2;
+/*M*/ }
+/*M*/ break;
+/*M*/ }
+/*M*/ default:
+/*M*/ nQuoWidth += nLastLeft;
+/*M*/ }
+/*M*/ }
+/*M*/ else
+/*M*/ nQuoWidth += nLastLeft;
+/*M*/ if( nLastLeft )
+/*M*/ {
+/*M*/ pGlue = new SwGluePortion(0);
+/*M*/ pGlue->Width( nLastLeft );
+/*M*/ pPor->Append( pGlue );
+/*M*/ pPor = pPor->GetPortion();
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ // Jetzt aber: die QuoVadis-Portion wird angedockt:
+/*M*/ pCurrPor = pQuo;
+/*M*/ while ( pCurrPor )
+/*M*/ {
+/*M*/ // pPor->Append deletes the pPortoin pointer of pPor. Therefore
+/*M*/ // we have to keep a pointer to the next portion
+/*M*/ pQuo = (SwQuoVadisPortion*)pCurrPor->GetPortion();
+/*M*/ pPor->Append( pCurrPor );
+/*M*/ pPor = pPor->GetPortion();
+/*M*/ pCurrPor = pQuo;
+/*M*/ }
+/*M*/
+/*M*/ pCurr->Width( pCurr->Width() + KSHORT( nQuoWidth ) );
+/*M*/
+/*M*/ // Und noch einmal adjustieren wegen des Adjustment und nicht zu Letzt
+/*M*/ // wegen folgendem Sonderfall: In der Zeile hat der DummUser durchgaengig
+/*M*/ // einen kleineren Font eingestellt als der vom QuoVadis-Text ...
+/*M*/ CalcAdjustLine( pCurr );
+/*M*/
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*M*/ #endif
+/*M*/
+/*M*/ // Uff...
+/*M*/ return nRet;
+/*M*/ }
+
+
+/*************************************************************************
+ * SwTxtFormatter::MakeDummyLine()
+ *************************************************************************/
+
+// MakeDummyLine() erzeugt eine Line, die bis zum unteren Seitenrand
+// reicht. DummyLines bzw. DummyPortions sorgen dafuer, dass Oszillationen
+// zum stehen kommen, weil Rueckflussmoeglichkeiten genommen werden.
+// Sie werden bei absatzgebundenen Frames in Fussnoten und bei Ftn-
+// Oszillationen verwendet.
+
+
+/*************************************************************************
+ * SwFtnSave::SwFtnSave()
+ *************************************************************************/
+
+/*M*/ SwFtnSave::SwFtnSave( const SwTxtSizeInfo &rInf, const SwTxtFtn* pTxtFtn )
+/*M*/ : pInf( &((SwTxtSizeInfo&)rInf) )
+/*M*/ {
+/*M*/ if( pTxtFtn && rInf.GetTxtFrm() )
+/*M*/ {
+/*M*/ pFnt = ((SwTxtSizeInfo&)rInf).GetFont();
+/*M*/ pOld = new SwFont( *pFnt );
+/*M*/ pOld->GetTox() = pFnt->GetTox();
+/*M*/ pFnt->GetTox() = 0;
+/*M*/ SwFmtFtn& rFtn = (SwFmtFtn&)pTxtFtn->GetFtn();
+/*M*/ const SwDoc *pDoc = rInf.GetTxtFrm()->GetNode()->GetDoc();
+/*M*/
+/*M*/ // examine text and set script
+/*M*/ String aTmpStr( rFtn.GetViewNumStr( *pDoc ) );
+/*M*/ pFnt->SetActual( WhichFont( 0, &aTmpStr, 0 ) );
+/*M*/
+/*M*/ const SwEndNoteInfo* pInfo;
+/*M*/ if( rFtn.IsEndNote() )
+/*M*/ pInfo = &pDoc->GetEndNoteInfo();
+/*M*/ else
+/*M*/ pInfo = &pDoc->GetFtnInfo();
+/*M*/ const SwAttrSet& rSet = pInfo->GetAnchorCharFmt((SwDoc&)*pDoc)->GetAttrSet();
+/*M*/ pFnt->SetDiffFnt( &rSet, rInf.GetDoc() );
+/*M*/
+/*M*/ // we reduce footnote size, if we are inside a double line portion
+/*M*/ if ( ! pOld->GetEscapement() && 50 == pOld->GetPropr() )
+/*M*/ {
+/*M*/ Size aSize = pFnt->GetSize( pFnt->GetActual() );
+/*M*/ pFnt->SetSize( Size( (long)aSize.Width() / 2,
+/*M*/ (long)aSize.Height() / 2 ),
+/*M*/ pFnt->GetActual() );
+/*M*/ }
+/*M*/
+/*M*/ // set the correct rotation at the footnote font
+/*M*/ const SfxPoolItem* pItem;
+/*M*/ if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_ROTATE,
+/*M*/ sal_True, &pItem ))
+/*M*/ pFnt->SetVertical( ((SvxCharRotateItem*)pItem)->GetValue(),
+/*M*/ rInf.GetTxtFrm()->IsVertical() );
+/*M*/
+/*M*/ pFnt->ChgPhysFnt( pInf->GetVsh(), pInf->GetOut() );
+/*M*/
+/*M*/ if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BACKGROUND,
+/*M*/ sal_True, &pItem ))
+/*M*/ pFnt->SetBackColor( new Color( ((SvxBrushItem*)pItem)->GetColor() ) );
+/*M*/ }
+/*M*/ else
+/*M*/ pFnt = NULL;
+/*M*/ }
+
+/*************************************************************************
+ * SwFtnSave::~SwFtnSave()
+ *************************************************************************/
+
+/*N*/ SwFtnSave::~SwFtnSave()
+/*N*/ {
+/*N*/ if( pFnt )
+/*N*/ {
+/*N*/ // SwFont zurueckstellen
+/*N*/ *pFnt = *pOld;
+/*N*/ pFnt->GetTox() = pOld->GetTox();
+/*N*/ pFnt->ChgPhysFnt( pInf->GetVsh(), pInf->GetOut() );
+/*N*/ delete pOld;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwFtnPortion::SwFtnPortion()
+ *************************************************************************/
+
+/*N*/ SwFtnPortion::SwFtnPortion( const XubString &rExpand, SwTxtFrm *pFrm,
+/*N*/ SwTxtFtn *pFtn, KSHORT nReal )
+/*N*/ : SwFldPortion( rExpand, 0 ), pFrm(pFrm), pFtn(pFtn), nOrigHeight( nReal )
+/*N*/ {
+/*N*/ SetLen(1);
+/*N*/ SetWhichPor( POR_FTN );
+/*N*/ }
+
+/*************************************************************************
+ * SwFtnPortion::GetExpTxt()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwFtnPortion::GetExpTxt( const SwTxtSizeInfo &, XubString &rTxt ) const
+/*N*/ {
+/*N*/ rTxt = aExpand;
+/*N*/ return sal_True;
+/*N*/ }
+
+
+
+/*************************************************************************
+ * virtual SwFtnPortion::Format()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwFtnPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ SwFtnSave aFtnSave( rInf, pFtn );
+/*N*/ // the idx is manipulated in SwExpandPortion::Format
+/*N*/ // this flag indicates, that a footnote is allowed to trigger
+/*N*/ // an underflow during SwTxtGuess::Guess
+/*N*/ rInf.SetFakeLineStart( rInf.GetIdx() > rInf.GetLineStart() );
+/*N*/ sal_Bool bFull = SwFldPortion::Format( rInf );
+/*N*/ rInf.SetFakeLineStart( sal_False );
+/*N*/ SetAscent( rInf.GetAscent() );
+/*N*/ Height( rInf.GetTxtHeight() );
+/*N*/ rInf.SetFtnDone( !bFull );
+/*N*/ if( !bFull )
+/*N*/ rInf.SetParaFtn();
+/*N*/ return bFull;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwFtnPortion::Paint()
+ *************************************************************************/
+
+/*N*/ void SwFtnPortion::Paint( const SwTxtPaintInfo &rInf ) const
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 //STRIP001 SwFtnSave aFtnSave( rInf, pFtn );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwFtnPortion::GetTxtSize()
+ *************************************************************************/
+
+/*N*/ SwPosSize SwFtnPortion::GetTxtSize( const SwTxtSizeInfo &rInfo ) const
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); return NULL;//STRIP001 SwFtnSave aFtnSave( rInfo, pFtn );
+/*N*/ }
+
+/*************************************************************************
+ * class SwQuoVadisPortion
+ *************************************************************************/
+
+
+
+/*************************************************************************
+ * virtual SwQuoVadisPortion::Format()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwQuoVadisPortion::GetExpTxt()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwQuoVadisPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwQuoVadisPortion::Paint()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwErgoSumPortion
+ *************************************************************************/
+
+
+
+
+/*************************************************************************
+ * virtual SwErgoSumPortion::Format()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * sal_Bool SwFtnNumPortion::DiffFont()
+ * liefert sal_True, wenn der Font der FtnReferenz (pFont) eine Aenderung
+ * des Fonts der FtnNumerierung (pFnt) erforderlich macht.
+ * Die Bedingungen sind ein Spiegel dessen, was in NewFtnNumPortion steht
+ *************************************************************************/
+
+/*N*/ sal_Bool SwFtnNumPortion::DiffFont( SwFont* pFont )
+/*N*/ {
+/*N*/ if( pFnt->GetName() != pFont->GetName() ||
+/*N*/ pFnt->GetStyleName() != pFont->GetStyleName() ||
+/*N*/ pFnt->GetFamily() != pFont->GetFamily() ||
+/*N*/ pFont->GetCharSet() != pFnt->GetCharSet() )
+/*N*/ return sal_True;
+/*N*/ return sal_False;
+/*N*/ }
+
+/*************************************************************************
+ * SwParaPortion::SetErgoSumNum()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwParaPortion::UpdateQuoVadis()
+ *
+ * Wird im SwTxtFrm::Prepare() gerufen
+ *************************************************************************/
+
+/*N*/ sal_Bool SwParaPortion::UpdateQuoVadis( const XubString &rQuo )
+/*N*/ {
+/*N*/ SwLineLayout *pLay = this;
+/*N*/ while( pLay->GetNext() )
+/*N*/ {
+///*?*/ DBG_LOOP;
+/*?*/ pLay = pLay->GetNext();
+/*N*/ }
+/*N*/ SwLinePortion *pPor = pLay;
+/*N*/ SwQuoVadisPortion *pQuo = 0;
+/*N*/ while( pPor && !pQuo )
+/*N*/ {
+/*N*/ if ( pPor->IsQuoVadisPortion() )
+/*?*/ pQuo = (SwQuoVadisPortion*)pPor;
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/
+/*N*/ if( !pQuo )
+/*N*/ return sal_False;
+/*N*/
+ {DBG_BF_ASSERT(0, "STRIP");} return sal_False;//STRIP001 /*?*/ return pQuo->GetQuoTxt() == rQuo;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txthyph.cxx b/binfilter/bf_sw/source/core/text/sw_txthyph.cxx
new file mode 100644
index 000000000000..44b69b9525b9
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txthyph.cxx
@@ -0,0 +1,355 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+
+#include <viewopt.hxx> // SwViewOptions
+#include <porhyph.hxx> //
+#include <itrform2.hxx> //
+#include <guess.hxx> //
+namespace binfilter {
+
+#ifdef DBG_UTIL
+extern const sal_Char *GetLangName( const MSHORT nLang );
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::i18n;
+
+/*************************************************************************
+ * SwTxtFormatInfo::HyphWord()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFrm::Hyphenate
+ *
+ * Wir formatieren eine Zeile fuer die interaktive Trennung
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwTxtFormatter::Hyphenate
+ *
+ * Wir formatieren eine Zeile fuer die interaktive Trennung
+ *************************************************************************/
+// Wir koennen davon ausgehen, dass bereits formatiert wurde.
+// Fuer die CeBIT'93 gehen wir den einfachen, sicheren Weg:
+// Die Zeile wird einfach neu formatiert, der Hyphenator wird dann
+// so vorbereitet, wie ihn die UI erwartet.
+// Hier stehen natuerlich enorme Optimierungsmoeglichkeiten offen.
+
+
+
+/*************************************************************************
+ * SwTxtPortion::CreateHyphen()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtPortion::CreateHyphen( SwTxtFormatInfo &rInf, SwTxtGuess &rGuess )
+/*N*/ {
+/*N*/ ASSERT( !pPortion, "SwTxtPortion::Hyphenate: another portion, another planet..." );
+/*N*/ if( rInf.IsHyphForbud() ||
+/*N*/ pPortion || // robust
+/*N*/ // Mehrzeilige Felder duerfen nicht interaktiv getrennt werden.
+/*N*/ ( rInf.IsInterHyph() && InFldGrp() ) )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ Reference< XHyphenatedWord > xHyphWord = rGuess.HyphWord();
+/*N*/ SwHyphPortion *pHyphPor = NULL;
+/*N*/ xub_StrLen nPorEnd = 0;
+/*N*/ SwTxtSizeInfo aInf( rInf );
+/*N*/
+/*N*/ // first case: hyphenated word has alternative spelling
+/*N*/ if ( xHyphWord.is() && xHyphWord->isAlternativeSpelling() ) {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SvxAlternativeSpelling aAltSpell;
+/*N*/ } else {
+/*N*/ // second case: no alternative spelling
+/*N*/ SwHyphPortion aHyphPor;
+/*N*/ aHyphPor.SetLen( 1 );
+/*N*/
+/*N*/ static const void* pLastMagicNo = 0;
+/*N*/ static KSHORT aMiniCacheH = 0, aMiniCacheW = 0;
+/*N*/ const void* pTmpMagic;
+/*N*/ MSHORT nFntIdx;
+/*N*/ rInf.GetFont()->GetMagic( pTmpMagic, nFntIdx, rInf.GetFont()->GetActual() );
+/*N*/ if( !pLastMagicNo || pLastMagicNo != pTmpMagic ) {
+/*N*/ pLastMagicNo = pTmpMagic;
+/*N*/ (SwPosSize&)aHyphPor = aHyphPor.GetTxtSize( rInf );
+/*N*/ aMiniCacheH = aHyphPor.Height(), aMiniCacheW = aHyphPor.Width();
+/*N*/ } else {
+/*N*/ aHyphPor.Height( aMiniCacheH ), aHyphPor.Width( aMiniCacheW );
+/*N*/ }
+/*N*/ aHyphPor.SetLen( 0 );
+/*N*/ pHyphPor = new SwHyphPortion( aHyphPor );
+/*N*/
+/*N*/ pHyphPor->SetWhichPor( POR_HYPH );
+/*N*/
+/*N*/ // values required for this
+/*N*/ nPorEnd = xHyphWord->getHyphenPos() + 1 + rGuess.BreakStart()
+/*N*/ - rGuess.FieldDiff();
+/*N*/ }
+/*N*/
+/*N*/ // portion end must be in front of us
+/*N*/ // we do not put hyphens at start of line
+/*N*/ if ( nPorEnd > rInf.GetIdx() ||
+/*N*/ ( nPorEnd == rInf.GetIdx() && rInf.GetLineStart() != rInf.GetIdx() ) )
+/*N*/ {
+/*N*/ aInf.SetLen( nPorEnd - rInf.GetIdx() );
+/*N*/ pHyphPor->SetAscent( GetAscent() );
+/*N*/ SetLen( aInf.GetLen() );
+/*N*/ CalcTxtSize( aInf );
+/*N*/
+/*N*/ Insert( pHyphPor );
+/*N*/
+/*N*/ short nKern = rInf.GetFont()->CheckKerning();
+/*N*/ if( nKern )
+/*N*/ new SwKernPortion( *this, nKern );
+/*N*/
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/
+/*N*/ // last exit for the lost
+/*N*/ delete pHyphPor;
+/*N*/ BreakCut( rInf, rGuess );
+/*N*/ return sal_False;
+/*N*/ }
+
+
+/*************************************************************************
+ * virtual SwHyphPortion::GetExpTxt()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const
+/*N*/ {
+/*N*/ rTxt = '-';
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwHyphPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwHyphPortion::Format()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwHyphPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ register const SwLinePortion *pLast = rInf.GetLast();
+/*N*/ Height( pLast->Height() );
+/*N*/ SetAscent( pLast->GetAscent() );
+/*N*/ XubString aTxt;
+/*N*/
+/*N*/ if( !GetExpTxt( rInf, aTxt ) )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ PrtWidth( rInf.GetTxtSize( aTxt ).Width() );
+/*N*/ const sal_Bool bFull = rInf.Width() <= rInf.X() + PrtWidth();
+/*N*/ if( bFull && !rInf.IsUnderFlow() ) {
+/*?*/ Truncate();
+/*?*/ rInf.SetUnderFlow( this );
+/*N*/ }
+/*N*/
+/*N*/ return bFull;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwHyphStrPortion::GetExpTxt()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * virtual SwHyphStrPortion::HandlePortion()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwSoftHyphPortion
+ *************************************************************************/
+
+/*N*/ SwLinePortion *SwSoftHyphPortion::Compress() { return this; }
+
+/*N*/ SwSoftHyphPortion::SwSoftHyphPortion() :
+/*N*/ bExpand(sal_False), nViewWidth(0), nHyphWidth(0)
+/*N*/ {
+/*N*/ SetLen(1);
+/*N*/ SetWhichPor( POR_SOFTHYPH );
+/*N*/ }
+
+
+/* Faelle:
+ * 1) SoftHyph steht in der Zeile, ViewOpt aus.
+ * -> unsichtbar, Nachbarn unveraendert
+ * 2) SoftHyph steht in der Zeile, ViewOpt an.
+ * -> sichtbar, Nachbarn veraendert
+ * 3) SoftHyph steht am Zeilenende, ViewOpt aus/an.
+ * -> immer sichtbar, Nachbarn unveraendert
+ */
+
+
+/*************************************************************************
+ * virtual SwSoftHyphPortion::Format()
+ *************************************************************************/
+
+/* Die endgueltige Breite erhalten wir im FormatEOL().
+ * In der Underflow-Phase stellen wir fest, ob ueberhaupt ein
+ * alternatives Spelling vorliegt. Wenn ja ...
+ *
+ * Fall 1: "Au-to"
+ * 1) {Au}{-}{to}, {to} passt nicht mehr => Underflow
+ * 2) {-} ruft Hyphenate => keine Alternative
+ * 3) FormatEOL() und bFull = sal_True
+ *
+ * Fall 2: "Zuc-ker"
+ * 1) {Zuc}{-}{ker}, {ker} passt nicht mehr => Underflow
+ * 2) {-} ruft Hyphenate => Alternative!
+ * 3) Underflow() und bFull = sal_True
+ * 4) {Zuc} ruft Hyphenate => {Zuk}{-}{ker}
+ */
+
+/*N*/ sal_Bool SwSoftHyphPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ sal_Bool bFull = sal_True;
+/*N*/
+/*N*/ // special case for old german spelling
+/*N*/ if( rInf.IsUnderFlow() )
+/*N*/ {
+/*N*/ if( rInf.GetSoftHyphPos() )
+/*N*/ return sal_True;
+/*N*/
+/*N*/ const sal_Bool bHyph = rInf.ChgHyph( sal_True );
+/*N*/ if( rInf.IsHyphenate() )
+/*N*/ {
+/*N*/ rInf.SetSoftHyphPos( rInf.GetIdx() );
+/*N*/ Width(0);
+/*N*/ // if the soft hyphend word has an alternative spelling
+/*N*/ // when hyphenated (old german spelling), the soft hyphen
+/*N*/ // portion has to trigger an underflow
+/*N*/ SwTxtGuess aGuess;
+/*N*/ bFull = rInf.IsInterHyph() ||
+/*N*/ !aGuess.AlternativeSpelling( rInf, rInf.GetIdx() - 1 );
+/*N*/ }
+/*N*/ rInf.ChgHyph( bHyph );
+/*N*/
+/*N*/ if( bFull && !rInf.IsHyphForbud() )
+/*N*/ {
+/*N*/ rInf.SetSoftHyphPos(0);
+/*N*/ FormatEOL( rInf );
+/*N*/ if ( rInf.GetFly() )
+/*?*/ rInf.GetRoot()->SetMidHyph( sal_True );
+/*N*/ else
+/*N*/ rInf.GetRoot()->SetEndHyph( sal_True );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ rInf.SetSoftHyphPos( rInf.GetIdx() );
+/*?*/ Truncate();
+/*?*/ rInf.SetUnderFlow( this );
+/*N*/ }
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/
+/*N*/ rInf.SetSoftHyphPos(0);
+/*N*/ SetExpand( sal_True );
+/*N*/ bFull = SwHyphPortion::Format( rInf );
+/*N*/ SetExpand( sal_False );
+/*N*/ if( !bFull )
+/*N*/ {
+/*N*/ // default-maessig besitzen wir keine Breite, aber eine Hoehe
+/*N*/ nHyphWidth = Width();
+/*N*/ Width(0);
+/*N*/ }
+/*N*/ return bFull;
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwSoftHyphPortion::FormatEOL()
+ *************************************************************************/
+// Format end of Line
+
+/*N*/ void SwSoftHyphPortion::FormatEOL( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if( !IsExpand() )
+/*N*/ {
+/*N*/ SetExpand( sal_True );
+/*N*/ if( rInf.GetLast() == this )
+/*?*/ rInf.SetLast( FindPrevPortion( rInf.GetRoot() ) );
+/*N*/
+/*N*/ // 5964: alte Werte muessen wieder zurueckgesetzt werden.
+/*N*/ const KSHORT nOldX = rInf.X();
+/*N*/ const xub_StrLen nOldIdx = rInf.GetIdx();
+/*N*/ rInf.X( rInf.X() - PrtWidth() );
+/*N*/ rInf.SetIdx( rInf.GetIdx() - GetLen() );
+/*N*/ const sal_Bool bFull = SwHyphPortion::Format( rInf );
+/*N*/ nHyphWidth = Width();
+/*N*/
+/*N*/ // 6976: Eine truebe Sache: Wir werden erlaubterweise breiter,
+/*N*/ // aber gleich wird noch ein Fly verarbeitet, der eine korrekte
+/*N*/ // X-Position braucht.
+/*N*/ if( bFull || !rInf.GetFly() )
+/*N*/ rInf.X( nOldX );
+/*N*/ else
+/*?*/ rInf.X( nOldX + Width() );
+/*N*/ rInf.SetIdx( nOldIdx );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwSoftHyphPortion::GetExpTxt()
+ *
+ * Wir expandieren:
+ * - wenn die Sonderzeichen sichtbar sein sollen
+ * - wenn wir am Ende der Zeile stehen.
+ * - wenn wir vor einem (echten/emuliertem) Zeilenumbruch stehen
+ *************************************************************************/
+
+/*N*/ sal_Bool SwSoftHyphPortion::GetExpTxt( const SwTxtSizeInfo &rInf, XubString &rTxt ) const
+/*N*/ {
+/*N*/ if( IsExpand() || ( rInf.OnWin() && rInf.GetOpt().IsSoftHyph() ) ||
+/*N*/ ( GetPortion() && ( GetPortion()->InFixGrp() ||
+/*N*/ GetPortion()->IsDropPortion() || GetPortion()->IsLayPortion() ||
+/*N*/ GetPortion()->IsParaPortion() || GetPortion()->IsBreakPortion() ) ) )
+/*N*/ {
+/*N*/ return SwHyphPortion::GetExpTxt( rInf, rTxt );
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtinit.cxx b/binfilter/bf_sw/source/core/text/sw_txtinit.cxx
new file mode 100644
index 000000000000..71b0805ff0cd
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtinit.cxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "fntcache.hxx" // pFntCache ( SwFont/ScrFont-PrtFont Cache )
+#include "swfntcch.hxx" // pSwFontCache ( SwAttrSet/SwFont Cache )
+#include "txtfrm.hxx"
+#include "txtcache.hxx"
+#include "porrst.hxx"
+
+#include <horiornt.hxx>
+
+#include "pordrop.hxx"
+#include "txtfly.hxx" // SwContourCache
+#include "dbg_lay.hxx" // Layout Debug Fileausgabe
+namespace binfilter {
+
+/*N*/ SwCache *SwTxtFrm::pTxtCache = 0;
+/*N*/ long SwTxtFrm::nMinPrtLine = 0;
+/*N*/ SwContourCache *pContourCache = 0;
+
+#ifndef PROFILE
+// Code zum Initialisieren von Statics im eigenen Code-Segment
+#ifdef _MSC_VER
+#pragma code_seg( "SWSTATICS" )
+#endif
+#endif
+
+/*N*/ IMPL_FIXEDMEMPOOL_NEWDEL( SwTxtLine, 50, 50 )
+/*N*/ IMPL_FIXEDMEMPOOL_NEWDEL( SwParaPortion, 50, 50 ) //Absaetze
+/*N*/ IMPL_FIXEDMEMPOOL_NEWDEL( SwLineLayout, 150, 150 ) //Zeilen
+/*N*/ IMPL_FIXEDMEMPOOL_NEWDEL( SwHolePortion, 150, 150 ) //z.B. Blanks am Zeilenende
+/*N*/ IMPL_FIXEDMEMPOOL_NEWDEL( SwTxtPortion, 200, 100 ) //Attributwechsel
+
+#ifndef PROFILE
+#ifdef _MSC_VER
+#pragma code_seg()
+#endif
+#endif
+
+/*************************************************************************
+ * _TextInit(), _TextFinit()
+ *************************************************************************/
+
+// Werden _nur_ in init.cxx verwendet, dort stehen extern void _TextFinit()
+// und extern void _TextInit(...)
+
+/*N*/ void _TextInit()
+/*N*/ {
+/*N*/ pFntCache = new SwFntCache;
+/*N*/ pSwFontCache = new SwFontCache;
+/*N*/ pWaveCol = new Color( COL_GRAY );
+/*N*/
+/*N*/ //Pauschale groesse 250, plus 100 pro Shell
+/*N*/ SwCache *pTxtCache = new SwCache( 250, 100
+/*N*/ #ifdef DBG_UTIL
+/*N*/ , "static SwTxtFrm::pTxtCache"
+/*N*/ #endif
+/*N*/ );
+/*N*/ SwTxtFrm::SetTxtCache( pTxtCache );
+/*N*/ PROTOCOL_INIT
+/*N*/ }
+
+/*N*/ void _TextFinit()
+/*N*/ {
+/*N*/ PROTOCOL_STOP
+/*N*/ delete SwTxtFrm::GetTxtCache();
+/*N*/ delete pSwFontCache;
+/*N*/ delete pFntCache;
+/*N*/ delete pWaveCol;
+/*N*/ delete pContourCache;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txtio.cxx b/binfilter/bf_sw/source/core/text/sw_txtio.cxx
new file mode 100644
index 000000000000..5d24e1d03c97
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txtio.cxx
@@ -0,0 +1,1077 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "viewsh.hxx" // IsDbg()
+#include "viewopt.hxx" // IsDbg()
+
+#ifndef DBG_UTIL
+#error Wer fummelt denn an den makefiles?
+#endif
+
+#define CONSTCHAR( name, string ) static const sal_Char __FAR_DATA name[] = string
+
+#include <horiornt.hxx>
+
+#include "flyfrms.hxx"
+#include "inftxt.hxx"
+#include "porfly.hxx"
+#include "porftn.hxx"
+#include "porhyph.hxx"
+#include "porref.hxx"
+#include "porrst.hxx"
+#include "portab.hxx"
+#include "portox.hxx"
+#include "pordrop.hxx"
+#include "pormulti.hxx"
+#include "frmsh.hxx"
+
+// So kann man die Layoutstruktur ausgeben lassen
+// #define AMA_LAYOUT
+#ifdef AMA_LAYOUT
+#include <stdio.h>
+#include <stdlib.h> // getenv()
+namespace binfilter {
+
+
+/*N*/ void lcl_OutFollow( XubString &rTmp, const SwFrm* pFrm )
+/*N*/ {
+/*N*/ if( pFrm->IsFlowFrm() )
+/*N*/ {
+/*N*/ const SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( pFrm );
+/*N*/ if( pFlow->IsFollow() || pFlow->GetFollow() )
+/*N*/ {
+/*N*/ rTmp += "(";
+/*N*/ if( pFlow->IsFollow() )
+/*N*/ rTmp += ".";
+/*N*/ if( pFlow->GetFollow() )
+/*N*/ {
+/*N*/ MSHORT nFrmId = pFlow->GetFollow()->GetFrm()->GetFrmId();
+/*N*/ rTmp += nFrmId;
+/*N*/ }
+/*N*/ rTmp += ")";
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ void lcl_OutFrame( SvFileStream& rStr, const SwFrm* pFrm, ByteString& rSp, sal_Bool bNxt )
+/*N*/ {
+/*N*/ if( !pFrm )
+/*N*/ return;
+/*N*/ KSHORT nSpc = 0;
+/*N*/ MSHORT nFrmId = pFrm->GetFrmId();
+/*N*/ ByteString aTmp;
+/*N*/ if( pFrm->IsLayoutFrm() )
+/*N*/ {
+/*N*/ if( pFrm->IsRootFrm() )
+/*N*/ aTmp = "R";
+/*N*/ else if( pFrm->IsPageFrm() )
+/*N*/ aTmp = "P";
+/*N*/ else if( pFrm->IsBodyFrm() )
+/*N*/ aTmp = "B";
+/*N*/ else if( pFrm->IsColumnFrm() )
+/*N*/ aTmp = "C";
+/*N*/ else if( pFrm->IsTabFrm() )
+/*N*/ aTmp = "Tb";
+/*N*/ else if( pFrm->IsRowFrm() )
+/*N*/ aTmp = "Rw";
+/*N*/ else if( pFrm->IsCellFrm() )
+/*N*/ aTmp = "Ce";
+/*N*/ else if( pFrm->IsSctFrm() )
+/*N*/ aTmp = "S";
+/*N*/ else if( pFrm->IsFlyFrm() )
+/*N*/ {
+/*N*/ aTmp = "F";
+/*N*/ const SwFlyFrm *pFly = (SwFlyFrm*)pFrm;
+/*N*/ if( pFly->IsFlyInCntFrm() )
+/*N*/ aTmp += "in";
+/*N*/ else if( pFly->IsFlyAtCntFrm() )
+/*N*/ {
+/*N*/ aTmp += "a";
+/*N*/ if( pFly->IsAutoPos() )
+/*N*/ aTmp += "u";
+/*N*/ else
+/*N*/ aTmp += "t";
+/*N*/ }
+/*N*/ else
+/*N*/ aTmp += "l";
+/*N*/ }
+/*N*/ else if( pFrm->IsHeaderFrm() )
+/*N*/ aTmp = "H";
+/*N*/ else if( pFrm->IsFooterFrm() )
+/*N*/ aTmp = "Fz";
+/*N*/ else if( pFrm->IsFtnContFrm() )
+/*N*/ aTmp = "Fc";
+/*N*/ else if( pFrm->IsFtnFrm() )
+/*N*/ aTmp = "Fn";
+/*N*/ else
+/*N*/ aTmp = "?L?";
+/*N*/ aTmp += nFrmId;
+/*N*/ lcl_OutFollow( aTmp, pFrm );
+/*N*/ aTmp += " ";
+/*N*/ rStr << aTmp;
+/*N*/ nSpc = aTmp.Len();
+/*N*/ rSp.Expand( nSpc + rSp.Len() );
+/*N*/ lcl_OutFrame( rStr, ((SwLayoutFrm*)pFrm)->Lower(), rSp, sal_True );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( pFrm->IsTxtFrm() )
+/*N*/ aTmp = "T";
+/*N*/ else if( pFrm->IsNoTxtFrm() )
+/*N*/ aTmp = "N";
+/*N*/ else
+/*N*/ aTmp = "?C?";
+/*N*/ aTmp += nFrmId;
+/*N*/ lcl_OutFollow( aTmp, pFrm );
+/*N*/ aTmp += " ";
+/*N*/ rStr << aTmp;
+/*N*/ nSpc = aTmp.Len();
+/*N*/ rSp.Expand( nSpc + rSp.Len() );
+/*N*/ }
+/*N*/ if( pFrm->IsPageFrm() )
+/*N*/ {
+/*N*/ const SwPageFrm* pPg = (SwPageFrm*)pFrm;
+/*N*/ const SwSortDrawObjs *pSorted = pPg->GetSortedObjs();
+/*N*/ const MSHORT nCnt = pSorted ? pSorted->Count() : 0;
+/*N*/ if( nCnt )
+/*N*/ {
+/*N*/ for( MSHORT i=0; i < nCnt; ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pSorted)[ i ];
+/*N*/ if( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ lcl_OutFrame( rStr, pFly, rSp, sal_False );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aTmp = pObj->IsUnoObj() ? "UNO" : "Drw";
+/*N*/ rStr << aTmp;
+/*N*/ }
+/*N*/ if( i < nCnt - 1 )
+/*N*/ rStr << endl << rSp;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else if( pFrm->GetDrawObjs() )
+/*N*/ {
+/*N*/ MSHORT nCnt = pFrm->GetDrawObjs()->Count();
+/*N*/ if( nCnt )
+/*N*/ {
+/*N*/ for( MSHORT i=0; i < nCnt; ++i )
+/*N*/ {
+/*N*/ SdrObject *pObj = (*pFrm->GetDrawObjs())[ i ];
+/*N*/ if( pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
+/*N*/ lcl_OutFrame( rStr, pFly, rSp, sal_False );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aTmp = pObj->IsUnoObj() ? "UNO" : "Drw";
+/*N*/ rStr << aTmp;
+/*N*/ }
+/*N*/ if( i < nCnt - 1 )
+/*N*/ rStr << endl << rSp;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( nSpc )
+/*N*/ rSp.Erase( rSp.Len() - nSpc );
+/*N*/ if( bNxt && pFrm->GetNext() )
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ pFrm = pFrm->GetNext();
+/*N*/ rStr << endl << rSp;
+/*N*/ lcl_OutFrame( rStr, pFrm, rSp, sal_False );
+/*N*/ } while ( pFrm->GetNext() );
+/*N*/ }
+/*N*/ }
+
+/*N*/ #ifdef USED
+/*N*/ IsFtnContFrm()
+/*N*/ IsFtnFrm()
+/*N*/ #endif
+
+/*N*/ void LayOutPut( const SwFrm* pFrm )
+/*N*/ {
+/*N*/ #ifndef MAC
+/*N*/ static char *pOutName = 0;
+/*N*/ const sal_Bool bFirstOpen = pOutName ? sal_False : sal_True;
+/*N*/ if( bFirstOpen )
+/*N*/ {
+/*N*/ char *pPath = getenv( "TEMP" );
+/*N*/ char *pName = "layout.txt";
+/*N*/ if( !pPath )
+/*N*/ pOutName = pName;
+/*N*/ else
+/*N*/ {
+/*N*/ const int nLen = strlen(pPath);
+/*N*/ // fuer dieses new wird es kein delete geben.
+/*N*/ pOutName = new char[nLen + strlen(pName) + 3];
+/*N*/ if(nLen && (pPath[nLen-1] == '\\') || (pPath[nLen-1] == '/'))
+/*N*/ snprintf( pOutName, sizeof(pOutName), "%s%s", pPath, pName );
+/*N*/ else
+/*N*/ snprintf( pOutName, sizeof(pOutName), "%s/%s", pPath, pName );
+/*N*/ }
+/*N*/ }
+/*N*/ SvFileStream aStream( pOutName, (bFirstOpen
+/*N*/ ? STREAM_WRITE | STREAM_TRUNC
+/*N*/ : STREAM_WRITE ));
+/*N*/
+/*N*/ if( !aStream.GetError() )
+/*N*/ {
+/*N*/ if ( bFirstOpen )
+/*N*/ aStream << "Layout-Struktur";
+/*N*/ else
+/*N*/ aStream.Seek( STREAM_SEEK_TO_END );
+/*N*/ aStream << endl;
+/*N*/ aStream << "---------------------------------------------" << endl;
+/*N*/ XubString aSpace;
+/*N*/ lcl_OutFrame( aStream, pFrm, aSpace, sal_False );
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+} //namespace binfilter
+/*N*/ #endif
+namespace binfilter {//STRIP009
+/*N*/ SvStream &operator<<( SvStream &rOs, const SwpHints &rHints ) //$ ostream
+/*N*/ {
+/*N*/ rOs << " {HINTS:";
+/*N*/ #ifdef JP_NEWCORE
+/*N*/ for( MSHORT i = 0; i < rHints.GetSize(); ++i)
+/*N*/ {
+/*N*/ SwTxtHint *pHint = (SwTxtHint*) rHints[i];
+/*N*/
+/*N*/ if(0 != GetCharWidth(pHint))
+/*N*/ rOs << "CHARWIDTH" << ' '; // << GetCharWidth(pHint)->frCPI;
+/*N*/ else if(0 != GetColor(pHint))
+/*N*/ rOs << "COLOR" << ' ' ; // << GetColor(pHint)->aColor;
+/*N*/ else if(0 != GetCrossedOut(pHint))
+/*N*/ rOs << "CROSSEDOUT" << ' ' << (MSHORT)(GetCrossedOut(pHint)->nState);
+/*N*/ else if(0 != GetAttrFont(pHint))
+/*N*/ rOs << "ATTRFONT" << ' ' <<
+/*N*/ (const char *)(GetAttrFont(pHint)->sFamilyName) << ',' <<
+/*N*/ ((MSHORT) GetAttrFont(pHint)->eFamily);
+/*N*/ else if(0 != GetPosture(pHint))
+/*N*/ rOs << "POSTURE" << ' ' << GetPosture(pHint)->nPosture;
+/*N*/ else if(0 != GetFontSize(pHint))
+/*N*/ rOs << "FONTSIZE" << ' ' << GetFontSize(pHint)->nSize;
+/*N*/ else if(0 != GetUnderline(pHint))
+/*N*/ rOs << "UNDERLINE" << ' ' << (MSHORT)(GetUnderline(pHint)->nState);
+/*N*/ else if(0 != GetWeight(pHint))
+/*N*/ rOs << "WEIGHT" << ' ' << GetWeight(pHint)->nWeight;
+/*N*/ else if(0 != GetContour(pHint))
+/*N*/ rOs << "CONTOUR" << ' ' << GetContour(pHint)->nState;
+/*N*/ else if(0 != GetShadowed(pHint))
+/*N*/ rOs << "SHADOWED" << ' ' << GetShadowed(pHint)->nState;
+/*N*/ else if(0 != GetAutoKern(pHint))
+/*N*/ rOs << "AUTOKERN" << ' ' << GetAutoKern(pHint)->nState;
+/*N*/ else if(0 != GetWordLineMode(pHint))
+/*N*/ rOs << "WORDLINEMODE" << ' ' << GetWordLineMode(pHint)->nState;
+/*N*/ else
+/*N*/ rOs << pHint->Which();
+/*N*/
+/*N*/ rOs << ',' << pHint->GetStart()->GetIndex()
+/*N*/ << '-'
+/*N*/ << (pHint->GetEnd() ? pHint->GetEnd()->GetIndex() : STRING_LEN)
+/*N*/ << "\n";
+/*N*/ }
+/*N*/ #endif
+/*N*/ // JP_NEWCORE
+/*N*/
+/*N*/ rOs << '}';
+/*N*/ return rOs;
+/*N*/ }
+
+/*************************************************************************
+ * IsDbg()
+ *************************************************************************/
+
+/*N*/ sal_Bool IsDbg( const SwTxtFrm *pFrm )
+/*N*/ {
+/*N*/ if( pFrm && pFrm->GetShell() )
+/*N*/ return pFrm->GetShell()->GetViewOptions()->IsTest4();
+/*N*/ else
+/*N*/ return sal_False;
+/*N*/ }
+} //namespace binfilter
+
+/*N*/ #if OSL_DEBUG_LEVEL < 2
+namespace binfilter {//STRIP009
+/*N*/ static void Error()
+/*N*/ {
+/*N*/ // wegen PM und BCC
+/*N*/ sal_Bool bFalse = sal_False;
+/*N*/ ASSERT( bFalse, "txtio: No debug version" );
+/*N*/ }
+
+#define IMPL_OUTOP(class) \
+ SvStream &class::operator<<( SvStream &rOs ) const /*$ostream*/\
+ { \
+ Error(); \
+ return rOs; \
+ }
+
+/*N*/ IMPL_OUTOP( SwTxtPortion )
+/*N*/ IMPL_OUTOP( SwLinePortion )
+/*N*/ IMPL_OUTOP( SwBreakPortion )
+/*N*/ IMPL_OUTOP( SwGluePortion )
+/*N*/ IMPL_OUTOP( SwFldPortion )
+/*N*/ IMPL_OUTOP( SwHiddenPortion )
+/*N*/ IMPL_OUTOP( SwHyphPortion )
+/*N*/ IMPL_OUTOP( SwFixPortion )
+/*N*/ IMPL_OUTOP( SwFlyPortion )
+/*N*/ IMPL_OUTOP( SwFlyCntPortion )
+/*N*/ IMPL_OUTOP( SwMarginPortion )
+/*N*/ IMPL_OUTOP( SwNumberPortion )
+/*N*/ IMPL_OUTOP( SwBulletPortion )
+/*N*/ IMPL_OUTOP( SwGrfNumPortion )
+/*N*/ IMPL_OUTOP( SwLineLayout )
+/*N*/ IMPL_OUTOP( SwParaPortion )
+/*N*/ IMPL_OUTOP( SwFtnPortion )
+/*N*/ IMPL_OUTOP( SwFtnNumPortion )
+/*N*/ IMPL_OUTOP( SwHyphStrPortion )
+/*N*/ IMPL_OUTOP( SwExpandPortion )
+/*N*/ IMPL_OUTOP( SwBlankPortion )
+/*N*/ IMPL_OUTOP( SwToxPortion )
+/*N*/ IMPL_OUTOP( SwRefPortion )
+/*N*/ IMPL_OUTOP( SwIsoToxPortion )
+/*N*/ IMPL_OUTOP( SwIsoRefPortion )
+/*N*/ IMPL_OUTOP( SwSoftHyphPortion )
+/*N*/ IMPL_OUTOP( SwTabPortion )
+/*N*/ IMPL_OUTOP( SwTabLeftPortion )
+/*N*/ IMPL_OUTOP( SwTabRightPortion )
+/*N*/ IMPL_OUTOP( SwTabCenterPortion )
+/*N*/ IMPL_OUTOP( SwTabDecimalPortion )
+/*N*/ IMPL_OUTOP( SwPostItsPortion )
+/*N*/ IMPL_OUTOP( SwQuoVadisPortion )
+/*N*/ IMPL_OUTOP( SwErgoSumPortion )
+/*N*/ IMPL_OUTOP( SwHolePortion )
+/*N*/ IMPL_OUTOP( SwDropPortion )
+/*N*/ IMPL_OUTOP( SwKernPortion )
+/*N*/ IMPL_OUTOP( SwArrowPortion )
+/*N*/ IMPL_OUTOP( SwMultiPortion )
+
+/*N*/ const char *GetPortionName( const MSHORT nType )
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ const char *GetPrepName( const PrepareHint ePrep )
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+/*N*/ void SwLineLayout::DebugPortions( SvStream &rOs, const XubString &rTxt, //$ ostream
+/*N*/ const xub_StrLen nStart )
+/*N*/ {
+/*N*/ }
+
+/*N*/ const char *GetLangName( const MSHORT nLang )
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+} //namespace binfilter
+#else
+# include <limits.h>
+# include <stdlib.h>
+# include "swtypes.hxx" // ZTCCONST
+# include "swfont.hxx" // SwDropPortion
+namespace binfilter {//STRIP009
+/*N*/ CONSTCHAR( pClose, "} " );
+
+/*************************************************************************
+ * GetPortionName()
+ *************************************************************************/
+
+/*N*/ CONSTCHAR( pPOR_LIN, "LIN" );
+/*N*/ CONSTCHAR( pPOR_TXT, "TXT" );
+/*N*/ CONSTCHAR( pPOR_SHADOW, "SHADOW" );
+/*N*/ CONSTCHAR( pPOR_TAB, "TAB" );
+/*N*/ CONSTCHAR( pPOR_TABLEFT, "TABLEFT" );
+/*N*/ CONSTCHAR( pPOR_TABRIGHT, "TABRIGHT" );
+/*N*/ CONSTCHAR( pPOR_TABCENTER, "TABCENTER" );
+/*N*/ CONSTCHAR( pPOR_TABDECIMAL, "TABDECIMAL" );
+/*N*/ CONSTCHAR( pPOR_EXP, "EXP" );
+/*N*/ CONSTCHAR( pPOR_HYPH, "HYPH" );
+/*N*/ CONSTCHAR( pPOR_HYPHSTR, "HYPHSTR" );
+/*N*/ CONSTCHAR( pPOR_FLD, "FLD" );
+/*N*/ CONSTCHAR( pPOR_FIX, "FIX" );
+/*N*/ CONSTCHAR( pPOR_FLY, "FLY" );
+/*N*/ CONSTCHAR( pPOR_FLYCNT, "FLYCNT" );
+/*N*/ CONSTCHAR( pPOR_MARGIN, "MARGIN" );
+/*N*/ CONSTCHAR( pPOR_GLUE, "GLUE" );
+/*N*/ CONSTCHAR( pPOR_HOLE, "HOLE" );
+/*N*/ CONSTCHAR( pPOR_END, "END" );
+/*N*/ CONSTCHAR( pPOR_BRK, "BRK" );
+/*N*/ CONSTCHAR( pPOR_LAY, "LAY" );
+/*N*/ CONSTCHAR( pPOR_BLANK, "BLANK" );
+/*N*/ CONSTCHAR( pPOR_FTN, "FTN" );
+/*N*/ CONSTCHAR( pPOR_FTNNUM, "FTNNUM" );
+/*N*/ CONSTCHAR( pPOR_POSTITS, "POSTITS" );
+/*N*/ CONSTCHAR( pPOR_SOFTHYPH, "SOFTHYPH" );
+/*N*/ CONSTCHAR( pPOR_SOFTHYPHSTR, "SOFTHYPHSTR" );
+/*N*/ CONSTCHAR( pPOR_TOX, "TOX" );
+/*N*/ CONSTCHAR( pPOR_REF, "REF" );
+/*N*/
+/*N*/ CONSTCHAR( pPOR_ISOTOX, "ISOTOX" );
+/*N*/ CONSTCHAR( pPOR_ISOREF, "ISOREF" );
+/*N*/ CONSTCHAR( pPOR_HIDDEN, "Hidden" );
+/*N*/ CONSTCHAR( pPOR_QUOVADIS, "QuoVadis" );
+/*N*/ CONSTCHAR( pPOR_ERGOSUM, "ErgoSum" );
+/*N*/ CONSTCHAR( pPOR_NUMBER, "NUMBER" );
+/*N*/ CONSTCHAR( pPOR_BULLET, "BULLET" );
+/*N*/ CONSTCHAR( pPOR_UNKW, "UNKW" );
+/*N*/ CONSTCHAR( pPOR_PAR, "PAR" );
+
+/*N*/ const char *GetPortionName( const MSHORT nType )
+/*N*/ {
+/*N*/ #ifdef USED
+/*N*/ // Kurz und schmerzlos:
+/*N*/ const char *ppNameArr[PORTYPE_END] = {
+/*N*/ pPOR_LIN, pPOR_TXT, pPOR_HOLE, pPOR_SHADOW,
+/*N*/ pPOR_TAB, pPOR_TABLEFT, pPOR_TABRIGHT, pPOR_TABCENTER, pPOR_TABDECIMAL,
+/*N*/ pPOR_EXP, pPOR_HYPH, pPOR_HYPHSTR, pPOR_FLD,
+/*N*/ pPOR_FIX, pPOR_FLY, pPOR_FLYCNT, pPOR_MARGIN,
+/*N*/ pPOR_GLUE, pPOR_END, pPOR_BRK, pPOR_LAY,
+/*N*/ pPOR_BLANK, pPOR_FTN, pPOR_FTNNUM,
+/*N*/ pPOR_POSTITS, pPOR_SOFTHYPH, pPOR_SOFTHYPHSTR,
+/*N*/ pPOR_TOX, pPOR_REF, pPOR_ISOTOX, pPOR_ISOREF,
+/*N*/ pPOR_HIDDEN, pPOR_QUOVADIS, pPOR_ERGOSUM,
+/*N*/ pPOR_NUMBER, pPOR_BULLET, pPOR_UNKW, pPOR_PAR
+/*N*/ };
+/*N*/ ASSERT( eType < PORTYPE_END, "GetPortionName: bad type" );
+/*N*/ return( ppNameArr[eType] );
+/*N*/ #else
+/*N*/ return 0;
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ CONSTCHAR( pPREP_CLEAR, "CLEAR" );
+/*N*/ CONSTCHAR( pPREP_WIDOWS_ORPHANS, "WIDOWS_ORPHANS" );
+/*N*/ CONSTCHAR( pPREP_FIXSIZE_CHG, "FIXSIZE_CHG" );
+/*N*/ CONSTCHAR( pPREP_FOLLOW_FOLLOWS, "FOLLOW_FOLLOWS" );
+/*N*/ CONSTCHAR( pPREP_ADJUST_FRM, "ADJUST_FRM" );
+/*N*/ CONSTCHAR( pPREP_FREE_SPACE, "FREE_SPACE" );
+/*N*/ CONSTCHAR( pPREP_FLY_CHGD, "FLY_CHGD" );
+/*N*/ CONSTCHAR( pPREP_FLY_ATTR_CHG, "FLY_ATTR_CHG" );
+/*N*/ CONSTCHAR( pPREP_FLY_ARRIVE, "FLY_ARRIVE" );
+/*N*/ CONSTCHAR( pPREP_FLY_LEAVE, "FLY_LEAVE" );
+/*N*/ CONSTCHAR( pPREP_VIEWOPT, "VIEWOPT" );
+/*N*/ CONSTCHAR( pPREP_FTN, "FTN" );
+/*N*/ CONSTCHAR( pPREP_POS_CHGD, "POS" );
+/*N*/ CONSTCHAR( pPREP_UL_SPACE, "UL_SPACE" );
+/*N*/ CONSTCHAR( pPREP_MUST_FIT, "MUST_FIT" );
+/*N*/ CONSTCHAR( pPREP_WIDOWS, "ORPHANS" );
+/*N*/ CONSTCHAR( pPREP_QUOVADIS, "QUOVADIS" );
+/*N*/ CONSTCHAR( pPREP_PAGE, "PAGE" );
+
+/*N*/ const char *GetPrepName( const PrepareHint ePrep )
+/*N*/ {
+/*N*/ // Kurz und schmerzlos:
+/*N*/ const char *ppNameArr[PREP_END] =
+/*N*/ {
+/*N*/ pPREP_CLEAR, pPREP_WIDOWS_ORPHANS, pPREP_FIXSIZE_CHG,
+/*N*/ pPREP_FOLLOW_FOLLOWS, pPREP_ADJUST_FRM, pPREP_FREE_SPACE,
+/*N*/ pPREP_FLY_CHGD, pPREP_FLY_ATTR_CHG, pPREP_FLY_ARRIVE,
+/*N*/ pPREP_FLY_LEAVE, pPREP_VIEWOPT, pPREP_FTN, pPREP_POS_CHGD,
+/*N*/ pPREP_UL_SPACE, pPREP_MUST_FIT, pPREP_WIDOWS, pPREP_QUOVADIS,
+/*N*/ pPREP_PAGE
+/*N*/ };
+/*N*/ ASSERT( ePrep < PREP_END, "GetPrepName: unknown PrepareHint" );
+/*N*/ return( ppNameArr[ePrep] );
+/*N*/ }
+
+/*************************************************************************
+ * SwLineLayout::DebugPortions()
+ *
+ * DebugPortion() iteriert ueber alle Portions einer Zeile und deckt die
+ * internen Strukturen auf.
+ * Im Gegensatz zum Ausgabe-Operator werden auch die Textteile ausgegeben.
+ *************************************************************************/
+
+/*N*/ void SwLineLayout::DebugPortions( SvStream &rOs, const XubString &rTxt, //$ ostream
+/*N*/ const xub_StrLen nStart )
+/*N*/ {
+/*N*/ SwLinePortion *pPortion = GetPortion();
+/*N*/
+/*N*/ xub_StrLen nPos = 0;
+/*N*/ MSHORT nNr = 0;
+/*N*/ KSHORT nPrtWidth, nLastPrt;
+/*N*/ nPrtWidth = nLastPrt = 0;
+/*N*/
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << '\"' << endl;
+/*N*/
+/*N*/ while( pPortion )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ SwTxtPortion *pTxtPor = pPortion->InTxtGrp() ?
+/*N*/ (SwTxtPortion *)pPortion : NULL ;
+/*N*/ ++nNr;
+/*N*/ nLastPrt = nPrtWidth;
+/*N*/ nPrtWidth += pPortion->PrtWidth();
+/*N*/ rOs << "\tNr:" << nNr
+/*N*/ << " Pos:" << nPos
+/*N*/ << " Org:" << nLastPrt
+/*N*/ << endl;
+/*N*/
+/*N*/ rOs << "\t";
+/*N*/ pPortion->operator<<( rOs );
+/*N*/ rOs << endl;
+/*N*/ nPos += pPortion->GetLen();
+/*N*/ pPortion = pPortion->GetPortion();
+/*N*/ }
+/*N*/ }
+
+/*N*/ #ifdef USED
+/*N*/ CONSTCHAR( pRES_LNG_ALBANIAN, "ALBANIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_ARABIC, "ARABIC" );
+/*N*/ CONSTCHAR( pRES_LNG_AUS_ENGLISH, "AUS_ENGLISH" );
+/*N*/ CONSTCHAR( pRES_LNG_BAHASA, "BAHASA" );
+/*N*/ CONSTCHAR( pRES_LNG_BELGIAN_DUTCH, "BELGIAN_DUTCH" );
+/*N*/ CONSTCHAR( pRES_LNG_BELGIAN_FRENCH, "BELGIAN_FRENCH" );
+/*N*/ CONSTCHAR( pRES_LNG_BRAZIL_PORT, "BRAZIL_PORT" );
+/*N*/ CONSTCHAR( pRES_LNG_BULGARIAN, "BULGARIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_CANADA_FRENCH, "CANADA_FRENCH" );
+/*N*/ CONSTCHAR( pRES_LNG_CAST_SPANISH, "CAST_SPANISH" );
+/*N*/ CONSTCHAR( pRES_LNG_CATALAN, "CATALAN" );
+/*N*/ CONSTCHAR( pRES_LNG_CROATO_SERBIAN, "CROATO_SERBIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_CZECH, "CZECH" );
+/*N*/ CONSTCHAR( pRES_LNG_DANISH, "DANISH" );
+/*N*/ CONSTCHAR( pRES_LNG_DUTCH, "DUTCH" );
+/*N*/ CONSTCHAR( pRES_LNG_FINNISH, "FINNISH" );
+/*N*/ CONSTCHAR( pRES_LNG_FRENCH, "FRENCH" );
+/*N*/ CONSTCHAR( pRES_LNG_GERMAN, "GERMAN" );
+/*N*/ CONSTCHAR( pRES_LNG_GREEK, "GREEK" );
+/*N*/ CONSTCHAR( pRES_LNG_HEBREW, "HEBREW" );
+/*N*/ CONSTCHAR( pRES_LNG_HUNGARIAN, "HUNGARIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_ICELANDIC, "ICELANDIC" );
+/*N*/ CONSTCHAR( pRES_LNG_ITALIAN, "ITALIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_JAPANESE, "JAPANESE" );
+/*N*/ CONSTCHAR( pRES_LNG_KOREAN, "KOREAN" );
+/*N*/ CONSTCHAR( pRES_LNG_MEXICAN_SPANISH, "MEXICAN_SPANISH" );
+/*N*/ CONSTCHAR( pRES_LNG_NORWEG_BOKMAL, "NORWEG_BOKMAL" );
+/*N*/ CONSTCHAR( pRES_LNG_NORWEG_NYNORSK, "NORWEG_NYNORSK" );
+/*N*/ CONSTCHAR( pRES_LNG_POLISH, "POLISH" );
+/*N*/ CONSTCHAR( pRES_LNG_PORTUGUESE, "PORTUGUESE" );
+/*N*/ CONSTCHAR( pRES_LNG_RHAETO_ROMANIC, "RHAETO_ROMANIC" );
+/*N*/ CONSTCHAR( pRES_LNG_ROMANIAN, "ROMANIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_RUSSIAN, "RUSSIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_SERBO_CROATIAN, "SERBO_CROATIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_SIM_CHINESE, "SIM_CHINESE" );
+/*N*/ CONSTCHAR( pRES_LNG_SLOVAKIAN, "SLOVAKIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_SWEDISH, "SWEDISH" );
+/*N*/ CONSTCHAR( pRES_LNG_SWISS_FRENCH, "SWISS_FRENCH" );
+/*N*/ CONSTCHAR( pRES_LNG_SWISS_GERMAN, "SWISS_GERMAN" );
+/*N*/ CONSTCHAR( pRES_LNG_SWISS_ITALIAN, "SWISS_ITALIAN" );
+/*N*/ CONSTCHAR( pRES_LNG_THAI, "THAI" );
+/*N*/ CONSTCHAR( pRES_LNG_TRD_CHINESE, "TRD_CHINESE" );
+/*N*/ CONSTCHAR( pRES_LNG_TURKISH, "TURKISH" );
+/*N*/ CONSTCHAR( pRES_LNG_UK_ENGLISH, "UK_ENGLISH" );
+/*N*/ CONSTCHAR( pRES_LNG_URDU, "URDU" );
+/*N*/ CONSTCHAR( pRES_LNG_US_ENGLISH, "US_ENGLISH" );
+/*N*/ CONSTCHAR( pRES_LNG_NOLANGUAGE, "NOLANGUAGE" );
+/*N*/
+/*N*/ const char *GetLangName( const MSHORT nLang )
+/*N*/ {
+/*N*/ switch( nLang )
+/*N*/ {
+/*N*/ case 0x041c : return pRES_LNG_ALBANIAN;
+/*N*/ case 0x0401 : return pRES_LNG_ARABIC;
+/*N*/ case 0x0c09 : return pRES_LNG_AUS_ENGLISH;
+/*N*/ case 0x0421 : return pRES_LNG_BAHASA;
+/*N*/ case 0x0813 : return pRES_LNG_BELGIAN_DUTCH;
+/*N*/ case 0x080c : return pRES_LNG_BELGIAN_FRENCH;
+/*N*/ case 0x0416 : return pRES_LNG_BRAZIL_PORT;
+/*N*/ case 0x0402 : return pRES_LNG_BULGARIAN;
+/*N*/ case 0x0c0c : return pRES_LNG_CANADA_FRENCH;
+/*N*/ case 0x040a : return pRES_LNG_CAST_SPANISH;
+/*N*/ case 0x0403 : return pRES_LNG_CATALAN;
+/*N*/ case 0x041a : return pRES_LNG_CROATO_SERBIAN;
+/*N*/ case 0x0405 : return pRES_LNG_CZECH;
+/*N*/ case 0x0406 : return pRES_LNG_DANISH;
+/*N*/ case 0x0413 : return pRES_LNG_DUTCH;
+/*N*/ case 0x040b : return pRES_LNG_FINNISH;
+/*N*/ case 0x040c : return pRES_LNG_FRENCH;
+/*N*/ case 0x0407 : return pRES_LNG_GERMAN;
+/*N*/ case 0x0408 : return pRES_LNG_GREEK;
+/*N*/ case 0x040d : return pRES_LNG_HEBREW;
+/*N*/ case 0x040e : return pRES_LNG_HUNGARIAN;
+/*N*/ case 0x040f : return pRES_LNG_ICELANDIC;
+/*N*/ case 0x0410 : return pRES_LNG_ITALIAN;
+/*N*/ case 0x0411 : return pRES_LNG_JAPANESE;
+/*N*/ case 0x0412 : return pRES_LNG_KOREAN;
+/*N*/ case 0x080a : return pRES_LNG_MEXICAN_SPANISH;
+/*N*/ case 0x0414 : return pRES_LNG_NORWEG_BOKMAL;
+/*N*/ case 0x0814 : return pRES_LNG_NORWEG_NYNORSK;
+/*N*/ case 0x0415 : return pRES_LNG_POLISH;
+/*N*/ case 0x0816 : return pRES_LNG_PORTUGUESE;
+/*N*/ case 0x0417 : return pRES_LNG_RHAETO_ROMANIC;
+/*N*/ case 0x0418 : return pRES_LNG_ROMANIAN;
+/*N*/ case 0x0419 : return pRES_LNG_RUSSIAN;
+/*N*/ case 0x081a : return pRES_LNG_SERBO_CROATIAN;
+/*N*/ case 0x0804 : return pRES_LNG_SIM_CHINESE;
+/*N*/ case 0x041b : return pRES_LNG_SLOVAKIAN;
+/*N*/ case 0x041d : return pRES_LNG_SWEDISH;
+/*N*/ case 0x100c : return pRES_LNG_SWISS_FRENCH;
+/*N*/ case 0x0807 : return pRES_LNG_SWISS_GERMAN;
+/*N*/ case 0x0810 : return pRES_LNG_SWISS_ITALIAN;
+/*N*/ case 0x041e : return pRES_LNG_THAI;
+/*N*/ case 0x0404 : return pRES_LNG_TRD_CHINESE;
+/*N*/ case 0x041f : return pRES_LNG_TURKISH;
+/*N*/ case 0x0809 : return pRES_LNG_UK_ENGLISH;
+/*N*/ case 0x0420 : return pRES_LNG_URDU;
+/*N*/ case 0x0409 : return pRES_LNG_US_ENGLISH;
+/*N*/ default : return pRES_LNG_NOLANGUAGE;
+/*N*/ }
+/*N*/ }
+/*N*/ #else
+/*N*/
+/*N*/ const char *GetLangName( const MSHORT nLang )
+/*N*/ {
+/*N*/ return "???";
+/*N*/ }
+/*N*/ #endif
+/*N*/
+/*N*/ SvStream &SwLinePortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ rOs << " {";
+/*N*/ rOs << "L:" << nLineLength;
+/*N*/ rOs << " H:" << Height();
+/*N*/ rOs << " W:" << PrtWidth();
+/*N*/ rOs << " A:" << nAscent;
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwTxtPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {TXT:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwBreakPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {BREAK:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwKernPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {KERN:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwArrowPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {ARROW:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwMultiPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {MULTI:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwLineLayout::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {LINE:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ SwLinePortion *pPos = GetPortion();
+/*N*/ while( pPos )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ rOs << "\t";
+/*N*/ pPos->operator<<( rOs );
+/*N*/ pPos = pPos->GetPortion();
+/*N*/ }
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwGluePortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {GLUE:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << " F:" << GetFixWidth();
+/*N*/ rOs << " G:" << GetPrtGlue();
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwFixPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {FIX:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwGluePortion::operator<<( rOs );
+/*N*/ rOs << " Fix:" << nFix;
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwFlyPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {FLY:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwFixPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwMarginPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {MAR:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwGluePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwFlyCntPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {FLYCNT:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ if( bDraw )
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {DRAWINCNT" );
+/*N*/ rOs << pTxt;
+/*N*/ rOs << pClose;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {FRM:" );
+/*N*/ rOs << pTxt;
+/*N*/ rOs << " {FRM:" << GetFlyFrm()->Frm() << pClose;
+/*N*/ rOs << " {PRT:" << GetFlyFrm()->Prt() << pClose;
+/*N*/ rOs << pClose;
+/*N*/ }
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwExpandPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {EXP:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwFtnPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {FTN:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwExpandPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwFtnNumPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {FTNNUM:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwNumberPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwNumberPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {NUMBER:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwExpandPortion::operator<<( rOs );
+/*N*/ rOs << " Exp:\"" << '\"';
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwBulletPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {BULLET:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwNumberPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwGrfNumPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {GRFNUM:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwGrfNumPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwHiddenPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {Hidden:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwFldPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwToxPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {TOX:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwTxtPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwRefPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {Ref:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwTxtPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwIsoToxPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {ISOTOX:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwToxPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwIsoRefPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {ISOREF:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwRefPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwHyphPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {HYPH:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwExpandPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwHyphStrPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {HYPHSTR:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwExpandPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwSoftHyphPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {SOFTHYPH:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwHyphPortion::operator<<( rOs );
+/*N*/ rOs << (IsExpand() ? " on" : " off");
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwBlankPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {BLANK:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwExpandPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwFldPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {FLD:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ if( IsFollow() )
+/*N*/ rOs << " F!";
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwPostItsPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {POSTITS" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwTabPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {TAB" );
+/*N*/ rOs << pTxt;
+/*N*/ SwFixPortion::operator<<( rOs );
+/*N*/ rOs << " T:" << nTabPos;
+/*N*/ if( IsFilled() )
+/*N*/ rOs << " \"" << cFill << '\"';
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwTabLeftPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {TABLEFT" );
+/*N*/ rOs << pTxt;
+/*N*/ SwTabPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwTabRightPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {TABRIGHT" );
+/*N*/ rOs << pTxt;
+/*N*/ SwTabPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwTabCenterPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {TABCENTER" );
+/*N*/ rOs << pTxt;
+/*N*/ SwTabPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwTabDecimalPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {TABDECIMAL" );
+/*N*/ rOs << pTxt;
+/*N*/ SwTabPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwParaPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {PAR" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLineLayout::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwHolePortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {HOLE" );
+/*N*/ rOs << pTxt;
+/*N*/ SwLinePortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwQuoVadisPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {QUOVADIS" );
+/*N*/ rOs << pTxt;
+/*N*/ SwFldPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwErgoSumPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {ERGOSUM" );
+/*N*/ rOs << pTxt;
+/*N*/ SwFldPortion::operator<<( rOs );
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &operator<<( SvStream &rOs, const SwTxtSizeInfo &rInf ) //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {SIZEINFO:" );
+/*N*/ rOs << pTxt;
+/*N*/ rOs << ' ' << (rInf.OnWin() ? "WIN:" : "PRT:" );
+/*N*/ rOs << " Idx:" << rInf.GetIdx();
+/*N*/ rOs << " Len:" << rInf.GetLen();
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+/*N*/
+/*N*/ SvStream &SwDropPortion::operator<<( SvStream &rOs ) const //$ ostream
+/*N*/ {
+/*N*/ CONSTCHAR( pTxt, " {DROP:" );
+/*N*/ rOs << pTxt;
+/*N*/ SwTxtPortion::operator<<( rOs );
+/*N*/ if( pPart && nDropHeight )
+/*N*/ {
+/*N*/ rOs << " H:" << nDropHeight;
+/*N*/ rOs << " L:" << nLines;
+/*N*/ rOs <<" Fnt:" << pPart->GetFont().GetHeight();
+/*N*/ if( nX || nY )
+/*N*/ rOs << " [" << nX << '/' << nY << ']';
+/*N*/ }
+/*N*/ rOs << pClose;
+/*N*/ return rOs;
+/*N*/ }
+} //namespace binfilter
+/*N*/ #endif /* OSL_DEBUG_LEVEL */
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_txttab.cxx b/binfilter/bf_sw/source/core/text/sw_txttab.cxx
new file mode 100644
index 000000000000..fba2b5ab74d4
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_txttab.cxx
@@ -0,0 +1,418 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "hintids.hxx"
+
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/tstpitem.hxx>
+
+#include <frmatr.hxx>
+
+#include "txtcfg.hxx"
+#include "portab.hxx"
+#include "itrform2.hxx"
+namespace binfilter {
+
+
+/*************************************************************************
+ * SwLineInfo::GetTabStop()
+ *************************************************************************/
+
+/* Die Werte in SvxTabStop::nTabPos liegen immer relativ zum linken PrtRand
+ * vor. Tabs, die im Bereich des Erstzeileneinzugs liegen, sind also negativ.
+ * nLeft ist der linke PrtRand
+ * nRight ist der rechte PrtRand
+ * nLinePos die aktuelle Position.
+ * Es wird der erste Tabstop returnt, der groesser ist als nLinePos.
+ */
+
+
+
+/*N*/ const SvxTabStop *SwLineInfo::GetTabStop( const SwTwips nLinePos,
+/*N*/ const SwTwips nLeft, const SwTwips nRight ) const
+/*N*/ {
+/*N*/ // Mit den KSHORTs aufpassen, falls nLinePos < nLeft
+/*N*/ SwTwips nPos = nLinePos;
+/*N*/ nPos -= nLeft;
+/*N*/ for( MSHORT i = 0; i < pRuler->Count(); ++i )
+/*N*/ {
+/*N*/ const SvxTabStop &rTabStop = pRuler->operator[](i);
+/*N*/ if( rTabStop.GetTabPos() > SwTwips(nRight) )
+/*N*/ {
+/*N*/ if ( i )
+/*N*/ return 0;
+/*N*/ else
+/*N*/ return &rTabStop;
+/*N*/ }
+/*N*/ if( rTabStop.GetTabPos() > nPos )
+/*N*/ return &rTabStop;
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFormatter::NewTabPortion()
+ *************************************************************************/
+
+
+
+/*N*/ SwTabPortion *SwTxtFormatter::NewTabPortion( SwTxtFormatInfo &rInf ) const
+/*N*/ {
+/*N*/ SwTabPortion *pTabPor;
+/*N*/ SwTabPortion *pLastTab = rInf.GetLastTab();
+/*N*/ if( pLastTab && pLastTab->IsTabCntPortion() )
+/*N*/ if( pLastTab->PostFormat( rInf ) )
+/*N*/ return 0;
+/*N*/
+/*N*/ // Wir suchen den naechsten Tab. Wenn gerade ein rechts-Tab unterwegs
+/*N*/ // ist, so koennen wir uns nicht auf rInf.X() beziehen.
+/*N*/ KSHORT nTabPos = rInf.GetLastTab() ? rInf.GetLastTab()->GetTabPos() : 0;
+/*N*/ if( nTabPos < rInf.X() )
+/*N*/ nTabPos = rInf.X();
+/*N*/
+/*N*/ xub_Unicode cFill, cDec;
+/*N*/ SvxTabAdjust eAdj;
+/*N*/
+/*N*/ KSHORT nNewTabPos;
+/*N*/ {
+ /*
+ nPos ist der Offset in der Zeile.
+ Die Tabulatoren haben ihren 0-Punkt bei Frm().Left().
+ Die Zeilen beginnen ab Frm.Left() + Prt.Left().
+ In dieser Methode wird zwischen beiden Koordinatensystemen
+ konvertiert (vgl. rInf.GetTabPos).
+ */
+/*N*/ const SwTwips nTabLeft = pFrm->Frm().Left() +
+/*N*/ ( pFrm->IsRightToLeft() ?
+/*N*/ pFrm->GetAttrSet()->GetLRSpace().GetRight() :
+/*N*/ pFrm->GetAttrSet()->GetLRSpace().GetTxtLeft() );
+/*N*/
+/*N*/ const SwTwips nLinePos = GetLeftMargin();
+/*N*/ const SwTwips nLineTab = nLinePos + nTabPos;
+/*N*/ SwTwips nRight = Right();
+/*N*/
+/*N*/ if ( pFrm->IsVertical() )
+/*N*/ {
+/*N*/ Point aRightTop( nRight, pFrm->Frm().Top() );
+/*N*/ pFrm->SwitchHorizontalToVertical( aRightTop );
+/*N*/ nRight = aRightTop.Y();
+/*N*/ }
+/*N*/
+/*N*/ SwTwips nNextPos;
+/*N*/ const SvxTabStop* pTabStop =
+/*N*/ aLineInf.GetTabStop( nLineTab, nTabLeft, nRight );
+/*N*/ if( pTabStop )
+/*N*/ {
+/*N*/ cFill = ' ' != pTabStop->GetFill() ? pTabStop->GetFill() : 0;
+/*N*/ cDec = pTabStop->GetDecimal();
+/*N*/ eAdj = pTabStop->GetAdjustment();
+/*N*/ nNextPos = pTabStop->GetTabPos();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ KSHORT nDefTabDist = aLineInf.GetDefTabStop();
+/*N*/ if( KSHRT_MAX == nDefTabDist )
+/*N*/ {
+/*N*/ const SvxTabStopItem& rTab =
+/*N*/ (const SvxTabStopItem &)pFrm->GetAttrSet()->
+/*N*/ GetPool()->GetDefaultItem( RES_PARATR_TABSTOP );
+/*N*/ if( rTab.Count() )
+/*N*/ nDefTabDist = (KSHORT)rTab.GetStart()->GetTabPos();
+/*N*/ else
+/*N*/ nDefTabDist = SVX_TAB_DEFDIST;
+/*N*/ aLineInf.SetDefTabStop( nDefTabDist );
+/*N*/ }
+/*N*/ SwTwips nCount = nLineTab;
+/*N*/ nCount -= nTabLeft;
+/*N*/ // Bei negativen Werten rundet "/" auf, "%" liefert negative Reste,
+/*N*/ // bei positiven Werten rundet "/" ab, "%" liefert positvie Reste!
+/*N*/ KSHORT nPlus = nCount < 0 ? 0 : 1;
+/*N*/ nCount /= nDefTabDist;
+/*N*/ nNextPos = ( nCount + nPlus ) * nDefTabDist ;
+/*N*/ if( nNextPos + nTabLeft <= nLineTab + 50 )
+/*N*/ nNextPos += nDefTabDist;
+/*N*/ cFill = 0;
+/*N*/ eAdj = SVX_TAB_ADJUST_LEFT;
+/*N*/ }
+/*N*/ long nForced = 0;
+/*N*/ if( pCurr->HasForcedLeftMargin() )
+/*N*/ {
+/*?*/ SwLinePortion* pPor = pCurr->GetPortion();
+/*?*/ while( pPor && !pPor->IsFlyPortion() )
+/*?*/ pPor = pPor->GetPortion();
+/*?*/ if( pPor )
+/*?*/ nForced = pPor->Width();
+/*N*/ }
+/*N*/ if( nTabLeft + nForced > nLineTab && nNextPos > 0 )
+/*N*/ {
+/*N*/ eAdj = SVX_TAB_ADJUST_DEFAULT;
+/*N*/ cFill = 0;
+/*N*/ nNextPos = nForced;
+/*N*/ }
+/*N*/ nNextPos += nTabLeft;
+/*N*/ nNextPos -= nLinePos;
+/*N*/ ASSERT( nNextPos >= 0, "GetTabStop: Don't go back!" );
+/*N*/ nNewTabPos = KSHORT(nNextPos);
+/*N*/ }
+/*N*/
+/*N*/ switch( eAdj )
+/*N*/ {
+/*N*/ case SVX_TAB_ADJUST_RIGHT :
+/*N*/ {
+/*N*/ pTabPor = new SwTabRightPortion( nNewTabPos, cFill );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SVX_TAB_ADJUST_CENTER :
+/*N*/ {
+/*N*/ pTabPor = new SwTabCenterPortion( nNewTabPos, cFill );
+/*N*/ break;
+/*N*/ }
+/*N*/ case SVX_TAB_ADJUST_DECIMAL :
+/*N*/ {
+/*?*/ pTabPor = new SwTabDecimalPortion( nNewTabPos, cDec, cFill );
+/*?*/ break;
+/*N*/ }
+/*N*/ default:
+/*N*/ {
+/*N*/ ASSERT( SVX_TAB_ADJUST_LEFT == eAdj || SVX_TAB_ADJUST_DEFAULT == eAdj,
+/*N*/ "+SwTxtFormatter::NewTabPortion: unknown adjustment" );
+/*N*/ pTabPor = new SwTabLeftPortion( nNewTabPos, cFill );
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Vorhandensein von Tabulatoren anzeigen ... ist nicht mehr noetig
+/*N*/ // pCurr->SetTabulation();
+/*N*/ // Aus Sicherheitsgruenden lassen wir uns die Daten errechnen
+/*N*/ // pTabPor->Height( pLast->Height() );
+/*N*/ // pTabPor->SetAscent( pLast->GetAscent() );
+/*N*/ return pTabPor;
+/*N*/ }
+
+/*************************************************************************
+ * SwTabPortion::SwTabPortion()
+ *************************************************************************/
+
+// Die Basisklasse wird erstmal ohne alles initialisiert.
+
+
+/*N*/ SwTabPortion::SwTabPortion( const KSHORT nTabPos, const xub_Unicode cFill )
+/*N*/ : SwFixPortion( 0, 0 ), nTabPos(nTabPos), cFill(cFill)
+/*N*/ {
+/*N*/ nLineLength = 1;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( IsFilled() )
+/*N*/ {
+/*N*/ ASSERT( ' ' != cFill, "SwTabPortion::CTOR: blanks ?!" );
+/*N*/ }
+/*N*/ #endif
+/*N*/ SetWhichPor( POR_TAB );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwTabPortion::Format()
+ *************************************************************************/
+
+
+
+/*N*/ sal_Bool SwTabPortion::Format( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ SwTabPortion *pLastTab = rInf.GetLastTab();
+/*N*/ if( pLastTab == this )
+/*?*/ return PostFormat( rInf );
+/*N*/ if( pLastTab )
+/*?*/ pLastTab->PostFormat( rInf );
+/*N*/ return PreFormat( rInf );
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwTabPortion::FormatEOL()
+ *************************************************************************/
+
+
+
+/*N*/ void SwTabPortion::FormatEOL( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ if( rInf.GetLastTab() == this && !IsTabLeftPortion() )
+/*N*/ PostFormat( rInf );
+/*N*/ }
+
+/*************************************************************************
+ * SwTabPortion::PreFormat()
+ *************************************************************************/
+
+
+
+/*M*/ sal_Bool SwTabPortion::PreFormat( SwTxtFormatInfo &rInf )
+/*M*/ {
+/*M*/ ASSERT( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" );
+/*M*/
+/*M*/ // Hier lassen wir uns nieder...
+/*M*/ Fix( rInf.X() );
+/*M*/
+/*M*/ // Die Mindestbreite eines Tabs ist immer mindestens ein Blank
+/*M*/ {
+/*M*/ XubString aTmp( ' ' );
+/*M*/ SwTxtSizeInfo aInf( rInf, aTmp );
+/*M*/ PrtWidth( aInf.GetTxtSize().Width() );
+/*M*/ }
+/*M*/
+/*M*/ // 8532: CenterTabs, deren Blankbreite nicht mehr in die Zeile passt
+/*M*/ sal_Bool bFull = rInf.Width() <= rInf.X() + PrtWidth();
+/*M*/
+/*M*/ // #95477# Rotated tab stops get the width of one blank
+/*N*/ const USHORT nDir = rInf.GetFont()->GetOrientation( rInf.GetTxtFrm()->IsVertical() );
+/*M*/
+/*M*/ if( ! bFull && 0 == nDir )
+/*M*/ {
+/*M*/ const MSHORT nWhich = GetWhichPor();
+/*M*/ switch( nWhich )
+/*M*/ {
+/*M*/ case POR_TABRIGHT:
+/*M*/ case POR_TABDECIMAL:
+/*M*/ case POR_TABCENTER:
+/*M*/ {
+/*M*/ if( POR_TABDECIMAL == nWhich )
+/*M*/ rInf.SetTabDecimal(
+/*M*/ ((SwTabDecimalPortion*)this)->GetTabDecimal());
+/*M*/ rInf.SetLastTab( this );
+/*M*/ break;
+/*M*/ }
+/*M*/ case POR_TABLEFT:
+/*M*/ {
+/*M*/ PrtWidth( GetTabPos() - rInf.X() );
+/*M*/ bFull = rInf.Width() <= rInf.X() + PrtWidth();
+/*M*/ break;
+/*M*/ }
+/*M*/ default: ASSERT( !this, "SwTabPortion::PreFormat: unknown adjustment" );
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if( bFull )
+/*M*/ {
+/*M*/ // Wir muessen aufpassen, dass wir nicht endlos schleifen,
+/*M*/ // wenn die Breite kleiner ist, als ein Blank ...
+/*M*/ if( rInf.GetIdx() == rInf.GetLineStart() )
+/*M*/ {
+/*M*/ PrtWidth( rInf.Width() - rInf.X() );
+/*M*/ SetFixWidth( PrtWidth() );
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ Height( 0 );
+/*M*/ Width( 0 );
+/*M*/ SetLen( 0 );
+/*M*/ SetAscent( 0 );
+/*M*/ SetPortion( NULL ); //?????
+/*M*/ }
+/*M*/ return sal_True;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ // Ein Kunstgriff mit Effekt: Die neuen Tabportions verhalten sich nun
+/*M*/ // so, wie FlyFrms, die in der Zeile stehen - inklusive Adjustment !
+/*M*/ SetFixWidth( PrtWidth() );
+/*M*/ return sal_False;
+/*M*/ }
+/*M*/ }
+
+/*************************************************************************
+ * SwTabPortion::PostFormat()
+ *************************************************************************/
+
+
+
+/*N*/ sal_Bool SwTabPortion::PostFormat( SwTxtFormatInfo &rInf )
+/*N*/ {
+/*N*/ const KSHORT nRight = Min( GetTabPos(), rInf.Width() );
+/*N*/ const SwLinePortion *pPor = GetPortion();
+/*N*/ KSHORT nPorWidth = 0;
+/*N*/ while( pPor )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ nPorWidth += pPor->Width();
+/*N*/ pPor = pPor->GetPortion();
+/*N*/ }
+/*N*/
+/*N*/ const MSHORT nWhich = GetWhichPor();
+/*N*/ ASSERT( POR_TABLEFT != nWhich, "SwTabPortion::PostFormat: already formatted" );
+/*N*/ const KSHORT nDiffWidth = nRight - Fix();
+/*N*/
+/*N*/ if( POR_TABCENTER == nWhich )
+/*N*/ {
+/*N*/ // zentrierte Tabs bereiten Probleme:
+/*N*/ // Wir muessen den Anteil herausfinden, der noch auf die Zeile passt.
+/*N*/ KSHORT nNewWidth = nPorWidth /2;
+/*N*/ if( nNewWidth > rInf.Width() - nRight )
+/*?*/ nNewWidth = nPorWidth - (rInf.Width() - nRight);
+/*N*/ nPorWidth = nNewWidth;
+/*N*/ }
+/*N*/
+/*N*/ if( nDiffWidth > nPorWidth )
+/*N*/ {
+/*N*/ const KSHORT nOldWidth = GetFixWidth();
+/*N*/ const KSHORT nAdjDiff = nDiffWidth - nPorWidth;
+/*N*/ if( nAdjDiff > GetFixWidth() )
+/*N*/ PrtWidth( nAdjDiff );
+/*N*/ // Nicht erschrecken: wir muessen rInf weiterschieben.
+/*N*/ // Immerhin waren wir als Rechtstab bislang nur ein Blank breit.
+/*N*/ // Da wir uns jetzt aufgespannt haben, muss der Differenzbetrag
+/*N*/ // auf rInf.X() addiert werden !
+/*N*/ rInf.X( rInf.X() + PrtWidth() - nOldWidth );
+/*N*/ }
+/*N*/ SetFixWidth( PrtWidth() );
+/*N*/ // letzte Werte zuruecksetzen
+/*N*/ rInf.SetLastTab(0);
+/*N*/ if( POR_TABDECIMAL == nWhich )
+/*?*/ rInf.SetTabDecimal(0);
+/*N*/
+/*N*/ return rInf.Width() <= rInf.X();
+/*N*/ }
+
+/*************************************************************************
+ * virtual SwTabPortion::Paint()
+ *
+ * Ex: LineIter::DrawTab()
+ *************************************************************************/
+
+
+
+
+/*************************************************************************
+ * virtual SwTabPortion::HandlePortion()
+ *************************************************************************/
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_widorp.cxx b/binfilter/bf_sw/source/core/text/sw_widorp.cxx
new file mode 100644
index 000000000000..ef9e671688f2
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_widorp.cxx
@@ -0,0 +1,537 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include "ftnboss.hxx"
+#include "paratr.hxx"
+#ifdef DBG_UTIL
+#endif
+
+#include <bf_svx/orphitem.hxx>
+#include <bf_svx/widwitem.hxx>
+#include <bf_svx/keepitem.hxx>
+#include <bf_svx/spltitem.hxx>
+#include <frmatr.hxx>
+#include <txtftn.hxx>
+#include <fmtftn.hxx>
+
+#include "txtcfg.hxx"
+#include "widorp.hxx"
+#include "sectfrm.hxx" //SwSectionFrm
+#include "ftnfrm.hxx"
+namespace binfilter {
+
+#undef WIDOWTWIPS
+
+
+/*************************************************************************
+ * inline IsNastyFollow()
+ *************************************************************************/
+// Ein Follow, der auf der selben Seite steht, wie sein Master ist nasty.
+/*N*/ inline sal_Bool IsNastyFollow( const SwTxtFrm *pFrm )
+/*N*/ {
+/*N*/ ASSERT( !pFrm->IsFollow() || !pFrm->GetPrev() ||
+/*N*/ ((const SwTxtFrm*)pFrm->GetPrev())->GetFollow() == pFrm,
+/*N*/ "IsNastyFollow: Was ist denn hier los?" );
+/*N*/ return pFrm->IsFollow() && pFrm->GetPrev();
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrmBreak::SwTxtFrmBreak()
+ *************************************************************************/
+
+/*N*/ SwTxtFrmBreak::SwTxtFrmBreak( SwTxtFrm *pFrm, const SwTwips nRst )
+/*N*/ : pFrm(pFrm), nRstHeight(nRst)
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( pFrm )
+/*N*/ SWRECTFN( pFrm )
+/*N*/ nOrigin = (pFrm->*fnRect->fnGetPrtTop)();
+/*N*/ SwSectionFrm* pSct;
+/*N*/ bKeep = !pFrm->IsMoveable() || IsNastyFollow( pFrm ) ||
+/*N*/ ( pFrm->IsInSct() && (pSct=pFrm->FindSctFrm())->Lower()->IsColumnFrm()
+/*N*/ && !pSct->MoveAllowed( pFrm ) ) ||
+/*N*/ !pFrm->GetTxtNode()->GetSwAttrSet().GetSplit().GetValue() ||
+/*N*/ pFrm->GetTxtNode()->GetSwAttrSet().GetKeep().GetValue();
+/*N*/ bBreak = sal_False;
+/*N*/
+/*N*/ if( !nRstHeight && !pFrm->IsFollow() && pFrm->IsInFtn() && pFrm->HasPara() )
+/*N*/ {
+/*N*/ nRstHeight = pFrm->GetFtnFrmHeight();
+/*N*/ nRstHeight += (pFrm->Prt().*fnRect->fnGetHeight)() -
+/*N*/ (pFrm->Frm().*fnRect->fnGetHeight)();
+/*N*/ if( nRstHeight < 0 )
+/*N*/ nRstHeight = 0;
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( pFrm )
+/*N*/ }
+
+/* BP 18.6.93: Widows.
+ * Im Gegensatz zur ersten Implementierung werden die Widows nicht
+ * mehr vorausschauend berechnet, sondern erst beim Formatieren des
+ * gesplitteten Follows festgestellt. Im Master faellt die Widows-
+ * Berechnung also generell weg (nWidows wird manipuliert).
+ * Wenn der Follow feststellt, dass die Widowsregel zutrifft,
+ * verschickt er an seinen Vorgaenger ein Prepare.
+ * Ein besonderes Problem ergibt sich, wenn die Widows zuschlagen,
+ * aber im Master noch ein paar Zeilen zur Verfuegung stehen.
+ *
+ */
+
+/*************************************************************************
+ * SwTxtFrmBreak::IsInside()
+ *************************************************************************/
+
+/* BP(22.07.92): Berechnung von Witwen und Waisen.
+ * Die Methode liefert sal_True zurueck, wenn eine dieser Regelung zutrifft.
+ *
+ * Eine Schwierigkeit gibt es im Zusammenhang mit Widows und
+ * unterschiedlichen Formaten zwischen Master- und Folgeframes:
+ * Beispiel: Wenn die erste Spalte 3cm und die zweite 4cm breit ist
+ * und Widows auf sagen wir 3 gesetzt ist, so ist erst bei der Formatierung
+ * des Follows entscheidbar, ob die Widowsbedingung einhaltbar ist oder
+ * nicht. Leider ist davon abhaengig, ob der Absatz als Ganzes auf die
+ * naechste Seite rutscht.
+ */
+
+/*N*/ sal_Bool SwTxtFrmBreak::IsInside( SwTxtMargin &rLine ) const
+/*N*/ {
+/*N*/ register sal_Bool bFit = sal_False;
+/*N*/
+/*N*/ SWAP_IF_SWAPPED( pFrm )
+/*N*/ SWRECTFN( pFrm )
+/*N*/ // nOrigin is an absolut value, rLine referes to the swapped situation.
+/*N*/
+/*N*/ SwTwips nTmpY;
+/*N*/ if ( pFrm->IsVertical() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nTmpY = pFrm->SwitchHorizontalToVertical( rLine.Y() + rLine.GetLineHeight() );
+/*N*/ else
+/*N*/ nTmpY = rLine.Y() + rLine.GetLineHeight();
+/*N*/
+/*N*/ SwTwips nLineHeight = (*fnRect->fnYDiff)( nTmpY , nOrigin );
+/*N*/
+/*N*/ // 7455 und 6114: Raum fuer die Umrandung unten einkalkulieren.
+/*N*/ nLineHeight += (pFrm->*fnRect->fnGetBottomMargin)();
+/*N*/
+/*N*/
+/*N*/ if( nRstHeight )
+/*N*/ bFit = nRstHeight >= nLineHeight;
+/*N*/ else
+/*N*/ {
+/*N*/ // Der Frm besitzt eine Hoehe, mit der er auf die Seite passt.
+/*N*/ SwTwips nHeight =
+/*N*/ (*fnRect->fnYDiff)( (pFrm->GetUpper()->*fnRect->fnGetPrtBottom)(), nOrigin );
+/*N*/
+/*N*/ // Wenn sich alles innerhalb des bestehenden Frames abspielt,
+/*N*/ // ist das Ergebnis sal_True;
+/*N*/ bFit = nHeight >= nLineHeight;
+/*N*/ if( !bFit )
+/*N*/ {
+/*N*/ // Die LineHeight sprengt die aktuelle Frm-Hoehe.
+/*N*/ // Nun rufen wir ein Probe-Grow, um zu ermitteln, ob der
+/*N*/ // Frame um den gewuenschten Bereich wachsen wuerde.
+/*N*/ nHeight += pFrm->GrowTst( LONG_MAX );
+/*N*/
+/*N*/ // Das Grow() returnt die Hoehe, um die der Upper des TxtFrm
+/*N*/ // den TxtFrm wachsen lassen wuerde.
+/*N*/ // Der TxtFrm selbst darf wachsen wie er will.
+/*N*/ bFit = nHeight >= nLineHeight;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( pFrm );
+/*N*/
+/*N*/ return bFit;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFrmBreak::IsBreakNow()
+ *************************************************************************/
+
+/*N*/ sal_Bool SwTxtFrmBreak::IsBreakNow( SwTxtMargin &rLine )
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( pFrm )
+/*N*/
+/*N*/ // bKeep ist staerker als IsBreakNow()
+/*N*/ // Ist noch genug Platz ?
+/*N*/ if( bKeep || IsInside( rLine ) )
+/*N*/ bBreak = sal_False;
+/*N*/ else
+/*N*/ {
+ /* Diese Klasse geht davon aus, dass der SwTxtMargin von Top nach Bottom
+ * durchgearbeitet wird. Aus Performancegruenden wird in folgenden
+ * Faellen der Laden fuer das weitere Aufspalten dicht gemacht:
+ * Wenn eine einzige Zeile nicht mehr passt.
+ * Sonderfall: bei DummyPortions ist LineNr == 1, obwohl wir splitten
+ * wollen.
+ */
+/*N*/ // 6010: DropLines mit einbeziehen
+/*N*/
+/*N*/ sal_Bool bFirstLine = 1 == rLine.GetLineNr() && !rLine.GetPrev();
+/*N*/ bBreak = sal_True;
+/*N*/ if( ( bFirstLine && pFrm->GetIndPrev() )
+/*N*/ || ( rLine.GetLineNr() <= rLine.GetDropLines() ) )
+/*N*/ {
+/*N*/ bKeep = sal_True;
+/*N*/ bBreak = sal_False;
+/*N*/ }
+/*N*/ else if(bFirstLine && pFrm->IsInFtn() && !pFrm->FindFtnFrm()->GetPrev())
+/*N*/ {
+/*?*/ SwLayoutFrm* pTmp = pFrm->FindFtnBossFrm()->FindBodyCont();
+/*?*/ if( !pTmp || !pTmp->Lower() )
+/*?*/ bBreak = sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( pFrm )
+/*N*/
+/*N*/ return bBreak;
+/*N*/ }
+
+
+/*MA ehemals fuer COMPACT
+// WouldFit() liefert sal_True, wenn der Absatz ganz oder teilweise passen wuerde
+
+sal_Bool SwTxtFrmBreak::WouldFit( SwTxtMargin &rLine )
+{
+ rLine.Bottom();
+ if( IsInside( rLine ) )
+ return sal_True;
+
+ rLine.Top();
+ // Suche die erste Trennmoeglichkeit ...
+ while( !IsBreakNow( rLine ) )
+ {
+ DBG_LOOP;
+ if( !rLine.NextLine() )
+ return sal_False;
+ }
+ return sal_True;
+}
+*/
+
+/*************************************************************************
+ * WidowsAndOrphans::WidowsAndOrphans()
+ *************************************************************************/
+
+/*N*/ WidowsAndOrphans::WidowsAndOrphans( SwTxtFrm *pFrm, const SwTwips nRst,
+/*N*/ sal_Bool bChkKeep )
+/*N*/ : SwTxtFrmBreak( pFrm, nRst ), nOrphLines( 0 ), nWidLines( 0 )
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( pFrm )
+/*N*/ SWRECTFN( pFrm )
+/*N*/
+/*N*/ if( bKeep )
+/*N*/ {
+/*N*/ // 5652: bei Absaetzen, die zusammengehalten werden sollen und
+/*N*/ // groesser sind als die Seite wird bKeep aufgehoben.
+/*N*/ if( bChkKeep && !pFrm->GetPrev() && !pFrm->IsInFtn() &&
+/*N*/ pFrm->IsMoveable() &&
+/*N*/ ( !pFrm->IsInSct() || pFrm->FindSctFrm()->MoveAllowed(pFrm) ) )
+/*N*/ bKeep = sal_False;
+/*N*/ //Auch bei gesetztem Keep muessen Orphans beachtet werden,
+/*N*/ //z.B. bei verketteten Rahmen erhaelt ein Follow im letzten Rahmen ein Keep,
+/*N*/ //da er nicht (vorwaerts) Moveable ist,
+/*N*/ //er darf aber trotzdem vom Master Zeilen anfordern wg. der Orphanregel.
+/*N*/ if( pFrm->IsFollow() )
+/*N*/ nWidLines = pFrm->GetTxtNode()->GetSwAttrSet().GetWidows().GetValue();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const SwAttrSet& rSet = pFrm->GetTxtNode()->GetSwAttrSet();
+/*N*/ const SvxOrphansItem &rOrph = rSet.GetOrphans();
+/*N*/ if ( rOrph.GetValue() > 1 )
+/*N*/ nOrphLines = rOrph.GetValue();
+/*N*/ if ( pFrm->IsFollow() )
+/*N*/ nWidLines = rSet.GetWidows().GetValue();
+/*N*/
+/*N*/ }
+/*N*/ if( pFrm->IsInFtn() && !pFrm->GetIndPrev() &&
+/*N*/ ( bKeep || nWidLines || nOrphLines ) )
+/*N*/ {
+/*N*/ // Innerhalb von Fussnoten gibt es gute Gruende, das Keep-Attribut und
+/*N*/ // die Widows/Orphans abzuschalten.
+/*?*/ SwFtnFrm *pFtn = pFrm->FindFtnFrm();
+/*?*/ sal_Bool bFt = !pFtn->GetAttr()->GetFtn().IsEndNote();
+/*?*/ if( !pFtn->GetPrev() &&
+/*?*/ pFtn->FindFtnBossFrm( bFt ) != pFtn->GetRef()->FindFtnBossFrm( bFt )
+/*?*/ && ( !pFrm->IsInSct() || pFrm->FindSctFrm()->MoveAllowed(pFrm) ) )
+/*?*/ {
+/*?*/ bKeep = sal_False;
+/*?*/ nOrphLines = 0;
+/*?*/ nWidLines = 0;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ UNDO_SWAP( pFrm )
+/*N*/ }
+
+/*************************************************************************
+ * WidowsAndOrphans::FindBreak()
+ *************************************************************************/
+
+/* Die Find*-Methoden suchen nicht nur, sondern stellen den SwTxtMargin auf
+ * die Zeile ein, wo der Absatz gebrochen werden soll und kuerzen ihn dort.
+ * FindBreak()
+ */
+
+/*N*/ sal_Bool WidowsAndOrphans::FindBreak( SwTxtFrm *pFrame, SwTxtMargin &rLine,
+/*N*/ sal_Bool bHasToFit )
+/*N*/ {
+/*N*/ SWAP_IF_SWAPPED( pFrm )
+/*N*/
+/*N*/ sal_Bool bRet = sal_True;
+/*N*/ MSHORT nOldOrphans = nOrphLines;
+/*N*/ if( bHasToFit )
+/*N*/ nOrphLines = 0;
+/*N*/ rLine.Bottom();
+/*N*/ if( !IsBreakNow( rLine ) )
+/*N*/ bRet = sal_False;
+/*N*/ if( !FindWidows( pFrame, rLine ) )
+/*N*/ {
+/*N*/ sal_Bool bBack = sal_False;
+/*N*/ while( IsBreakNow( rLine ) )
+/*N*/ {
+/*N*/ if( rLine.PrevLine() )
+/*N*/ bBack = sal_True;
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/ // Eigentlich werden bei HasToFit Schusterjungen (Orphans) nicht
+/*N*/ // beruecksichtigt, wenn allerdings Dummy-Lines im Spiel sind und
+/*N*/ // die Orphansregel verletzt wird, machen wir mal eine Ausnahme:
+/*N*/ // Wir lassen einfach eine Dummyline zurueck und wandern mit dem Text
+/*N*/ // komplett auf die naechste Seite/Spalte.
+/*N*/ if( rLine.GetLineNr() <= nOldOrphans &&
+/*N*/ rLine.GetInfo().GetParaPortion()->IsDummy() &&
+/*N*/ ( ( bHasToFit && bRet ) || SwTxtFrmBreak::IsBreakNow( rLine ) ) )
+/*N*/ rLine.Top();
+/*N*/
+/*N*/ rLine.TruncLines( sal_True );
+/*N*/ bRet = bBack;
+/*N*/ }
+/*N*/ nOrphLines = nOldOrphans;
+/*N*/
+/*N*/ UNDO_SWAP( pFrm )
+/*N*/
+/*N*/ return bRet;
+/*N*/ }
+
+/*************************************************************************
+ * WidowsAndOrphans::FindWidows()
+ *************************************************************************/
+
+/* FindWidows positioniert den SwTxtMargin des Masters auf die umzubrechende
+ * Zeile, indem der Follow formatiert und untersucht wird.
+ * Liefert sal_True zurueck, wenn die Widows-Regelung in Kraft tritt,
+ * d.h. der Absatz _zusammengehalten_ werden soll !
+ */
+
+/*N*/ sal_Bool WidowsAndOrphans::FindWidows( SwTxtFrm *pFrm, SwTxtMargin &rLine )
+/*N*/ {
+/*N*/ ASSERT( ! pFrm->IsVertical() || ! pFrm->IsSwapped(),
+/*N*/ "WidowsAndOrphans::FindWidows with swapped frame" )
+/*N*/
+/*N*/ if( !nWidLines || !pFrm->IsFollow() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ rLine.Bottom();
+/*N*/
+/*N*/ // Wir koennen noch was abzwacken
+/*N*/ SwTxtFrm *pMaster = pFrm->FindMaster();
+/*N*/ ASSERT(pMaster, "+WidowsAndOrphans::FindWidows: Widows in a master?");
+/*N*/ if( !pMaster )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // 5156: Wenn die erste Zeile des Follows nicht passt, wird der Master
+/*N*/ // wohl voll mit Dummies sein. In diesem Fall waere ein PREP_WIDOWS fatal.
+/*N*/ if( pMaster->GetOfst() == pFrm->GetOfst() )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // Resthoehe des Masters
+/*N*/ SWRECTFN( pFrm )
+/*N*/
+/*N*/ const SwTwips nDocPrtTop = (pFrm->*fnRect->fnGetPrtTop)();
+/*N*/ SwTwips nOldHeight;
+/*N*/ SwTwips nTmpY = rLine.Y() + rLine.GetLineHeight();
+/*N*/
+/*N*/ if ( bVert )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ nTmpY = pFrm->SwitchHorizontalToVertical( nTmpY );
+/*N*/ }
+/*N*/ else
+/*N*/ nOldHeight = (pFrm->Prt().*fnRect->fnGetHeight)();
+/*N*/
+/*N*/ const SwTwips nChg = (*fnRect->fnYDiff)( nTmpY, nDocPrtTop + nOldHeight );
+/*N*/
+/*N*/ // Unterhalb der Widows-Schwelle...
+/*N*/ if( rLine.GetLineNr() >= nWidLines )
+/*N*/ {
+/*N*/ // 8575: Follow to Master I
+/*N*/ // Wenn der Follow *waechst*, so besteht fuer den Master die Chance,
+/*N*/ // Zeilen entgegenzunehmen, die er vor Kurzem gezwungen war an den
+/*N*/ // Follow abzugeben: Prepare(Need); diese Abfrage unterhalb von nChg!
+/*N*/ // (0W, 2O, 2M, 2F) + 1F = 3M, 2F
+/*N*/ if( rLine.GetLineNr() > nWidLines && pFrm->IsJustWidow() )
+/*N*/ {
+/*?*/ // Wenn der Master gelockt ist, so hat er vermutlich gerade erst
+/*?*/ // eine Zeile an uns abgegeben, diese geben nicht zurueck, nur
+/*?*/ // weil bei uns daraus mehrere geworden sind (z.B. durch Rahmen).
+/*?*/ if( !pMaster->IsLocked() && pMaster->GetUpper() )
+/*?*/ {
+/*?*/ const SwTwips nRstHeight = (pMaster->Frm().*fnRect->fnBottomDist)
+/*?*/ ( (pMaster->GetUpper()->*fnRect->fnGetPrtBottom)() );
+/*?*/ if ( nRstHeight >=
+/*?*/ SwTwips(rLine.GetInfo().GetParaPortion()->Height() ) )
+/*?*/ {
+/*?*/ pMaster->Prepare( PREP_ADJUST_FRM );
+/*?*/ pMaster->_InvalidateSize();
+/*?*/ pMaster->InvalidatePage();
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ pFrm->SetJustWidow( sal_False );
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+ // 8575: Follow to Master II
+ // Wenn der Follow *schrumpft*, so besteht fuer den Master die Chance,
+ // den kompletten Orphan zu inhalieren.
+ // (0W, 2O, 2M, 1F) - 1F = 3M, 0F -> PREP_ADJUST_FRM
+ // (0W, 2O, 3M, 2F) - 1F = 2M, 2F -> PREP_WIDOWS
+
+/*N*/ if( 0 > nChg && !pMaster->IsLocked() && pMaster->GetUpper() )
+/*N*/ {
+/*N*/ SwTwips nRstHeight = (pMaster->Frm().*fnRect->fnBottomDist)
+/*N*/ ( (pMaster->GetUpper()->*fnRect->fnGetPrtBottom)() );
+/*N*/ if( nRstHeight >= SwTwips(rLine.GetInfo().GetParaPortion()->Height() ) )
+/*N*/ {
+/*N*/ pMaster->Prepare( PREP_ADJUST_FRM );
+/*N*/ pMaster->_InvalidateSize();
+/*N*/ pMaster->InvalidatePage();
+/*N*/ pFrm->SetJustWidow( sal_False );
+/*N*/ return sal_False;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // Master to Follow
+/*N*/ // Wenn der Follow nach seiner Formatierung weniger Zeilen enthaelt
+/*N*/ // als Widows, so besteht noch die Chance, einige Zeilen des Masters
+/*N*/ // abzuzwacken. Wenn dadurch die Orphans-Regel des Masters in Kraft
+/*N*/ // tritt muss im CalcPrep() des Master-Frame der Frame so vergroessert
+/*N*/ // werden, dass er nicht mehr auf seine urspruengliche Seite passt.
+/*N*/ // Wenn er noch ein paar Zeilen entbehren kann, dann muss im CalcPrep()
+/*N*/ // ein Shrink() erfolgen, der Follow mit dem Widows rutscht dann auf
+/*N*/ // die Seite des Masters, haelt sich aber zusammen, so dass er (endlich)
+/*N*/ // auf die naechste Seite rutscht. - So die Theorie!
+/*N*/
+/*N*/
+/*N*/ // Wir fordern nur noch ein Zeile zur Zeit an, weil eine Zeile des Masters
+/*N*/ // bei uns durchaus mehrere Zeilen ergeben koennten.
+/*N*/ // Dafuer behaelt CalcFollow solange die Kontrolle, bis der Follow alle
+/*N*/ // notwendigen Zeilen bekommen hat.
+/*N*/ MSHORT nNeed = 1; // frueher: nWidLines - rLine.GetLineNr();
+/*N*/
+/*N*/ // Special case: Master cannot give lines to follow
+/*N*/ if ( ! pMaster->GetIndPrev() && pMaster->GetThisLines() <= nNeed )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ pMaster->Prepare( PREP_WIDOWS, (void*)&nNeed );
+/*N*/ return sal_True;
+/*N*/ }
+
+/*************************************************************************
+ * WidowsAndOrphans::WouldFit()
+ *************************************************************************/
+
+/*N*/ sal_Bool WidowsAndOrphans::WouldFit( SwTxtMargin &rLine, SwTwips &rMaxHeight )
+/*N*/ {
+/*N*/ // Here it does not matter, if pFrm is swapped or not.
+/*N*/ // IsInside() takes care for itself
+/*N*/
+/*N*/ // Wir erwarten, dass rLine auf der letzten Zeile steht!!
+/*N*/ ASSERT( !rLine.GetNext(), "WouldFit: aLine::Bottom missed!" );
+/*N*/ MSHORT nLineCnt = rLine.GetLineNr();
+/*N*/
+/*N*/ // Erstmal die Orphansregel und den Initialenwunsch erfuellen ...
+/*N*/ #ifndef USED
+/*N*/ const MSHORT nMinLines = Max( GetOrphansLines(), rLine.GetDropLines() );
+/*N*/ #else
+/*N*/ const MSHORT nMinLines = rLine.GetDropLines();
+/*N*/ #endif
+/*N*/ if ( nLineCnt < nMinLines )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ rLine.Top();
+/*N*/ SwTwips nLineSum = rLine.GetLineHeight();
+/*N*/
+/*N*/ while( nMinLines > rLine.GetLineNr() )
+/*N*/ {
+///*N*/ DBG_LOOP;
+/*N*/ if( !rLine.NextLine() )
+/*N*/ return sal_False;
+/*N*/ nLineSum += rLine.GetLineHeight();
+/*N*/ }
+/*N*/
+/*N*/ // Wenn wir jetzt schon nicht mehr passen ...
+/*N*/ if( !IsInside( rLine ) )
+/*N*/ return sal_False;
+/*N*/
+/*N*/ // Jetzt noch die Widows-Regel ueberpruefen
+/*N*/ if( !nWidLines && !pFrm->IsFollow() )
+/*N*/ {
+/*N*/ // I.A. brauchen Widows nur ueberprueft werden, wenn wir ein Follow
+/*N*/ // sind. Bei WouldFit muss aber auch fuer den Master die Regel ueber-
+/*N*/ // prueft werden, weil wir ja gerade erst die Trennstelle ermitteln.
+/*N*/ // Im Ctor von WidowsAndOrphans wurde nWidLines aber nur fuer Follows
+/*N*/ // aus dem AttrSet ermittelt, deshalb holen wir es hier nach:
+/*N*/ const SwAttrSet& rSet = pFrm->GetTxtNode()->GetSwAttrSet();
+/*N*/ nWidLines = rSet.GetWidows().GetValue();
+/*N*/ }
+/*N*/
+/*N*/ // Sind nach Orphans/Initialen noch genug Zeilen fuer die Widows uebrig?
+/*N*/ if( nLineCnt - nMinLines >= GetWidowsLines() )
+/*N*/ {
+/*N*/ if( rMaxHeight >= nLineSum )
+/*N*/ {
+/*N*/ rMaxHeight -= nLineSum;
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ }
+/*N*/ return sal_False;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/sw_wrong.cxx b/binfilter/bf_sw/source/core/text/sw_wrong.cxx
new file mode 100644
index 000000000000..0a81cb9d46ad
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/sw_wrong.cxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include "wrong.hxx"
+namespace binfilter {
+
+/*************************************************************************
+ * sal_Bool SwWrongList::InWrongWord() gibt den Anfang und die Laenge des Wortes
+ * zurueck, wenn es als falsch markiert ist.
+ *************************************************************************/
+
+/*************************************************************************
+ * sal_Bool SwWrongList::Check() liefert den ersten falschen Bereich
+ *************************************************************************/
+
+/*************************************************************************
+ * xub_StrLen SwWrongList::NextWrong() liefert die naechste Fehlerposition
+ *************************************************************************/
+
+
+/*************************************************************************
+ * xub_StrLen SwWrongList::LastWrong() liefert die letzte Fehlerposition
+ *************************************************************************/
+
+
+/*************************************************************************
+ * MSHORT SwWrongList::GetPos( xub_StrLen nValue )
+ * sucht die erste Position im Array, die groessergleich nValue ist,
+ * dies kann natuerlich auch hinter dem letzten Element sein!
+ *************************************************************************/
+
+
+/*************************************************************************
+ * void SwWrongList::Invalidate()
+ *************************************************************************/
+
+/*N*/ void SwWrongList::_Invalidate( xub_StrLen nBegin, xub_StrLen nEnd )
+/*N*/ {
+/*N*/ if ( nBegin < GetBeginInv() )
+/*N*/ nBeginInvalid = nBegin;
+/*N*/ if ( nEnd > GetEndInv() )
+/*N*/ nEndInvalid = nEnd;
+/*N*/ }
+
+/*************************************************************************
+ * SwWrongList::Move( xub_StrLen nPos, long nDiff )
+ * veraendert alle Positionen ab nPos um den angegebenen Wert,
+ * wird nach Einfuegen oder Loeschen von Buchstaben benoetigt.
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwWrongList::Clear()/( xub_StrLen nBegin, xub_StrLen nEnd )
+ * loescht das Array im angegebenen Bereich
+ *************************************************************************/
+
+
+
+/*************************************************************************
+ * SwWrongList::Fresh
+ *
+ * In this method the wrong list is updated, new wrong words are inserted,
+ * and by evaluating the postiztion of wrong words, we also know, which
+ * words are not wrong any longer and have to be removed.
+ * Note: Fresh has to be called at the end of the check of the invalid region,
+ * in order to find words, which are behind the last wrong word but not wrong
+ * any longer
+ *************************************************************************/
+
+/*N*/ sal_Bool SwWrongList::InvalidateWrong( )
+/*N*/ {
+/*N*/ if( Count() )
+/*N*/ {
+/*N*/ xub_StrLen nFirst = WRPOS( 0 );
+/*N*/ xub_StrLen nLast = WRPOS( Count() - 1 ) + WRLEN( Count() - 1 );
+/*N*/ Invalidate( nFirst, nLast );
+/*N*/ return sal_True;
+/*N*/ }
+/*N*/ else
+/*N*/ return sal_False;
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/txtcache.hxx b/binfilter/bf_sw/source/core/text/txtcache.hxx
new file mode 100644
index 000000000000..c31c7a63cf25
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/txtcache.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTCACHE_HXX
+#define _TXTCACHE_HXX
+
+#include <sal/types.h>
+
+#include <tools/mempool.hxx>
+#include "swcache.hxx"
+namespace binfilter {
+
+class SwParaPortion;
+class SwTxtFrm;
+
+class SwTxtLine : public SwCacheObj
+{
+ SwParaPortion *pLine;
+
+public:
+ DECL_FIXEDMEMPOOL_NEWDEL(SwTxtLine)
+
+ SwTxtLine( SwTxtFrm *pFrm, SwParaPortion *pNew = 0 );
+ virtual ~SwTxtLine();
+
+ inline SwParaPortion *GetPara() { return pLine; }
+ inline const SwParaPortion *GetPara() const { return pLine; }
+
+ inline void SetPara( SwParaPortion *pNew ) { pLine = pNew; }
+};
+
+
+class SwTxtLineAccess : public SwCacheAccess
+{
+
+protected:
+ virtual SwCacheObj *NewObj();
+
+public:
+ SwTxtLineAccess( const SwTxtFrm *pOwner );
+
+ SwParaPortion *GetPara();
+
+ inline SwTxtLine &GetTxtLine();
+
+ virtual sal_Bool IsAvailable() const;
+};
+
+
+inline SwTxtLine &SwTxtLineAccess::GetTxtLine()
+{
+ return *((SwTxtLine*)Get());
+}
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/txtcfg.hxx b/binfilter/bf_sw/source/core/text/txtcfg.hxx
new file mode 100644
index 000000000000..c98c876d4701
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/txtcfg.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TXTCFG_HXX
+#define _TXTCFG_HXX
+
+//#if OSL_DEBUG_LEVEL > 1
+//// auto strip #include "dbgloop.hxx" // DBG_LOOP
+//#else
+//#ifdef DBG_LOOP //kann per precompiled hereinkommen
+//#undef DBG_LOOP
+//#undef DBG_LOOP_RESET
+//#endif
+//#define DBG_LOOP
+//#define DBG_LOOP_RESET
+//#endif
+namespace binfilter {
+
+// Toleranzwert in der Formatierung und Textausgabe.
+#define SLOPPY_TWIPS 5
+
+#define CONSTCHAR( name, string ) static const sal_Char __FAR_DATA name[] = string
+
+// Allgemeines ...
+
+#ifndef CONST
+#define CONST const
+#endif
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/txtfly.hxx b/binfilter/bf_sw/source/core/text/txtfly.hxx
new file mode 100644
index 000000000000..8783fe4f410d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/txtfly.hxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTFLY_HXX
+#define _TXTFLY_HXX
+
+#include <bf_svtools/svarray.hxx>
+
+#include "swtypes.hxx"
+#include "swrect.hxx"
+class OutputDevice;
+class VirtualDevice;
+class PolyPolygon;
+class Color;
+namespace binfilter {
+
+
+class SwFont;
+class SwCntntFrm;
+class SwFlyFrm;
+class SwPageFrm;
+class SwTxtFly;
+class SdrObject;
+class SwWrongList;
+class SwTxtPaintInfo;
+class SwFmt;
+
+class TextRanger;
+
+
+// eine kleine Schweinerei, weil enums nicht forward-deklariert werden koennen.
+typedef MSHORT _FlyCntnt;
+
+SV_DECL_PTRARR( SwFlyList, SdrObject*, 10, 10 )
+
+/*************************************************************************
+ * class SwFlyIter
+ *************************************************************************/
+enum PAGESIDE { LEFT_SIDE, RIGHT_SIDE, DONTKNOW_SIDE };
+
+/*************************************************************************
+ * class SwContourCache
+ *************************************************************************/
+
+class SwDrawTextInfo;
+// Contour-Cache, globale Variable, in txtinit.cxx initialisiert/zerstoert
+// und in txtfly.cxx benutzt bei Konturumfluss
+class SwContourCache;
+extern SwContourCache *pContourCache;
+
+#ifdef VERTICAL_LAYOUT
+class SwTxtFrm;
+#endif
+
+#define POLY_CNT 20
+#define POLY_MIN 5
+#define POLY_MAX 4000
+
+class SwContourCache
+{
+ friend void ClrContourCache();
+ const SdrObject *pSdrObj[ POLY_CNT ];
+ TextRanger *pTextRanger[ POLY_CNT ];
+ long nPntCnt;
+ MSHORT nObjCnt;
+#ifdef VERTICAL_LAYOUT
+ const SwRect ContourRect( const SwFmt* pFmt, const SdrObject* pObj,
+ const SwTxtFrm* pFrm, const SwRect &rLine, const long nXPos,
+ const sal_Bool bRight );
+#else
+ const SwRect ContourRect( const SwFmt* pFmt, const SdrObject* pObj,
+ const SwRect &rLine, const long nXPos, const sal_Bool bRight );
+#endif
+
+public:
+ SwContourCache();
+ ~SwContourCache();
+ const SdrObject* GetObject( MSHORT nPos ){ return pSdrObj[ nPos ]; }
+ MSHORT GetCount() const { return nObjCnt; }
+ void ClrObject( MSHORT nPos );
+#ifdef VERTICAL_LAYOUT
+ static const SwRect CalcBoundRect( const SdrObject* pObj,
+ const SwRect &rLine, const SwTxtFrm* pFrm, const long nXPos,
+ const sal_Bool bRight );
+#else
+ static const SwRect CalcBoundRect( const SdrObject* pObj,
+ const SwRect &rLine, const long nXPos, const sal_Bool bRight );
+#endif
+#ifdef DBG_UTIL
+#endif
+};
+
+/*************************************************************************
+ * class SwTxtFly
+ *************************************************************************/
+
+class SwTxtFly
+{
+ const SwPageFrm *pPage;
+ const SdrObject *pCurrFly;
+
+#ifdef VERTICAL_LAYOUT
+ const SwTxtFrm *pCurrFrm;
+#else
+ const SwCntntFrm *pCurrFrm;
+#endif
+
+ const SwCntntFrm *pMaster;
+ SwFlyList *pFlyList;
+
+ long nMinBottom;
+ long nNextTop; // Hier wird die Oberkante des "naechsten" Rahmens gespeichert
+ ULONG nIndex;
+ sal_Bool bOn : 1;
+ sal_Bool bLeftSide : 1;
+ sal_Bool bTopRule: 1;
+ sal_Bool mbIgnoreCurrentFrame: 1;
+ sal_Bool mbIgnoreContour: 1;
+ SwRect _GetFrm( const SwRect &rPortion, sal_Bool bTop ) const;
+ SwFlyList* InitFlyList();
+ // iteriert ueber die Fly-Liste
+ sal_Bool ForEach( const SwRect &rRect, SwRect* pRect, sal_Bool bAvoid ) const;
+ _FlyCntnt CalcSmart( const SdrObject *pObj ) const;
+ // liefert die Order eines FlyFrms
+ _FlyCntnt GetOrder( const SdrObject *pObj ) const;
+ void CalcRightMargin( SwRect &rFly, MSHORT nPos, const SwRect &rLine ) const;
+ void CalcLeftMargin( SwRect &rFly, MSHORT nPos, const SwRect &rLine ) const;
+ MSHORT GetPos( const SdrObject *pObj ) const;
+ sal_Bool GetTop( const SdrObject *pNew, const sal_Bool bInFtn,
+ const sal_Bool bInFooterOrHeader );
+ SwTwips CalcMinBottom() const;
+ const SwCntntFrm* _GetMaster();
+
+public:
+ inline SwTxtFly() { mbIgnoreCurrentFrame = sal_False;
+ mbIgnoreCurrentFrame = sal_False;
+ pFlyList = 0; pMaster = 0; }
+ inline SwTxtFly( const SwTxtFrm *pFrm )
+ { CtorInit( pFrm ); }
+
+ SwTxtFly( const SwTxtFly& rTxtFly );
+ inline ~SwTxtFly() { delete pFlyList; }
+#ifdef VERTICAL_LAYOUT
+ void CtorInit( const SwTxtFrm *pFrm );
+#else
+ void CtorInit( const SwCntntFrm *pFrm );
+#endif
+ void SetTopRule(){ bTopRule = sal_False; }
+
+ SwFlyList* GetFlyList() const
+ { return pFlyList ? pFlyList : ((SwTxtFly*)this)->InitFlyList(); }
+ inline SwRect GetFrm( const SwRect &rPortion, sal_Bool bTop = sal_True ) const;
+ inline sal_Bool IsOn() const { return bOn; }
+ inline sal_Bool Relax( const SwRect &rRect );
+ inline sal_Bool Relax();
+ inline SwTwips GetMinBottom() const
+ { return pFlyList ? nMinBottom : CalcMinBottom(); }
+ inline const SwCntntFrm* GetMaster() const
+ { return pMaster ? pMaster : ((SwTxtFly*)this)->_GetMaster(); }
+ inline long GetNextTop() const { return nNextTop; }
+ // Diese temporaere Variable darf auch in const-Methoden manipuliert werden
+ inline void SetNextTop( long nNew ) const
+ { ((SwTxtFly*)this)->nNextTop = nNew; }
+
+ // Liefert zu einem SdrObject das von ihm _beanspruchte_ Rect
+ // (unter Beruecksichtigung der Order) zurueck.
+ SwRect FlyToRect( const SdrObject *pObj, const SwRect &rRect ) const;
+
+ // Die Drawmethoden stellen sicher, dass ueberlappende Frames
+ // (ausser bei transparenten Frames) nicht uebergepinselt werden.
+
+
+ // Liefert zurueck, ob die Zeile von einem Frame ueberlappt wird.
+ sal_Bool IsAnyFrm( const SwRect &rLine ) const;
+ sal_Bool IsAnyFrm() const;
+ //Das Rechteck kann leer sein, es gilt dann der Frm.
+ sal_Bool IsAnyObj( const SwRect& ) const;
+
+ void SetIgnoreCurrentFrame( sal_Bool bNew ) { mbIgnoreCurrentFrame = bNew; }
+ void SetIgnoreContour( sal_Bool bNew ) { mbIgnoreContour = bNew; }
+
+#ifdef DBG_UTIL
+#endif
+};
+
+// Wenn in das rRect (meist die aktuelle Zeile) kein freifliegender
+// Frame ragt, dann schalten wir uns ab.
+// rRect ist dokumentglobal !
+inline sal_Bool SwTxtFly::Relax( const SwRect &rRect )
+{
+ return 0 != (bOn = bOn && IsAnyFrm( rRect ));
+}
+
+inline sal_Bool SwTxtFly::Relax()
+{
+ return 0 != (bOn = bOn && IsAnyFrm());
+}
+
+inline SwRect SwTxtFly::GetFrm( const SwRect &rRect, sal_Bool bTop ) const
+{
+ return bOn ? _GetFrm( rRect, bTop ) : SwRect();
+}
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/txtpaint.hxx b/binfilter/bf_sw/source/core/text/txtpaint.hxx
new file mode 100644
index 000000000000..7c6c07503e29
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/txtpaint.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TXTPAINT_HXX
+#define _TXTPAINT_HXX
+
+#include <vcl/outdev.hxx>
+
+
+class SwRect; // SwSaveClip
+
+#ifdef VERTICAL_LAYOUT
+#endif
+namespace binfilter {
+
+/*************************************************************************
+ * class SwSaveClip
+ *************************************************************************/
+
+class SwSaveClip
+{
+ Region aClip;
+ const sal_Bool bOn;
+ sal_Bool bChg;
+protected:
+ OutputDevice *pOut;
+public:
+ inline SwSaveClip( OutputDevice *pOut );
+ inline ~SwSaveClip();
+ void Reset(){DBG_BF_ASSERT(0, "STRIP");} ;//STRIP001 void Reset();
+ inline sal_Bool IsOn() const { return bOn; }
+ inline sal_Bool IsChg() const { return bChg; }
+ inline sal_Bool IsOut() const { return 0 != pOut; }
+ inline OutputDevice *GetOut() { return pOut; }
+};
+
+inline SwSaveClip::SwSaveClip( OutputDevice *pOut ) :
+ pOut(pOut),
+ bOn( pOut && pOut->IsClipRegion() ),
+ bChg( sal_False )
+{}
+
+inline SwSaveClip::~SwSaveClip()
+{
+ Reset();
+}
+
+#ifdef DBG_UTIL
+
+/*************************************************************************
+ * class SwDbgOut
+ *************************************************************************/
+
+class SwDbgOut
+{
+protected:
+ OutputDevice *pOut;
+public:
+ inline SwDbgOut( OutputDevice *pOutDev, const sal_Bool bOn = sal_True );
+};
+
+/*************************************************************************
+ * class DbgPen
+ *************************************************************************/
+
+//class DbgPen : public SwDbgOut
+//{
+// Pen aPen;
+//public:
+// inline DbgPen( OutputDevice *pOutDev, const sal_Bool bOn = sal_True,
+// const ColorName eColor = COL_BLACK );
+// inline ~DbgPen();
+//};
+
+/*************************************************************************
+ * class DbgColor
+ *************************************************************************/
+
+class DbgColor
+{
+ Font *pFnt;
+ Color aColor;
+public:
+ inline DbgColor( Font *pFont, const sal_Bool bOn = sal_True,
+ const ColorData eColor = COL_BLUE );
+ inline ~DbgColor();
+};
+
+/*************************************************************************
+ * class DbgBrush
+ *************************************************************************/
+
+class DbgBackColor : public SwDbgOut
+{
+ Color aOldFillColor;
+public:
+ DbgBackColor( OutputDevice *pOut, const sal_Bool bOn = sal_True,
+ ColorData nColor = COL_YELLOW );
+ ~DbgBackColor();
+};
+
+/*************************************************************************
+ * class DbgRect
+ *************************************************************************/
+
+class DbgRect : public SwDbgOut
+{
+public:
+ DbgRect( OutputDevice *pOut, const Rectangle &rRect,
+ const sal_Bool bOn = sal_True,
+ ColorData eColor = COL_LIGHTBLUE );
+};
+
+/*************************************************************************
+ * Inline-Implementierung
+ *************************************************************************/
+
+inline SwDbgOut::SwDbgOut( OutputDevice *pOutDev, const sal_Bool bOn )
+ :pOut( bOn ? pOutDev : 0 )
+{ }
+
+//inline DbgPen::DbgPen( OutputDevice *pOutDev, const sal_Bool bOn,
+// const ColorName eColor )
+// : SwDbgOut( pOutDev, bOn)
+//{
+// if( pOut )
+// {
+// const Color aColor( eColor );
+// Pen aTmpPen( aColor );
+// aPen = pOut->GetPen( );
+// pOut->SetPen( aTmpPen );
+// }
+//}
+
+//inline DbgPen::~DbgPen()
+//{
+// if( pOut )
+// pOut->SetPen(aPen);
+//}
+
+inline DbgColor::DbgColor( Font *pFont, const sal_Bool bOn,
+ const ColorData eColor )
+ :pFnt( bOn ? pFont : 0 )
+{
+ if( pFnt )
+ {
+ aColor = pFnt->GetColor();
+ pFnt->SetColor( Color( eColor ) );
+ }
+}
+
+inline DbgColor::~DbgColor()
+{
+ if( pFnt )
+ pFnt->SetColor( aColor );
+}
+
+inline DbgBackColor::DbgBackColor( OutputDevice *pOutDev, const sal_Bool bOn,
+ ColorData eColor )
+ :SwDbgOut( pOutDev, bOn )
+{
+ if( pOut )
+ {
+ aOldFillColor = pOut->GetFillColor();
+ pOut->SetFillColor( Color(eColor) );
+ }
+}
+
+inline DbgBackColor::~DbgBackColor()
+{
+ if( pOut )
+ {
+ pOut->SetFillColor( aOldFillColor );
+ }
+}
+
+inline DbgRect::DbgRect( OutputDevice *pOutDev, const Rectangle &rRect,
+ const sal_Bool bOn,
+ ColorData eColor )
+ : SwDbgOut( pOutDev, bOn )
+{
+ if( pOut )
+ {
+ const Color aColor( eColor );
+ Color aLineColor = pOut->GetLineColor();
+ pOut->SetLineColor( aColor );
+ Color aFillColor = pOut->GetFillColor();
+ pOut->SetFillColor( Color(COL_TRANSPARENT) );
+ pOut->DrawRect( rRect );
+ pOut->SetLineColor( aLineColor );
+ pOut->SetFillColor( aFillColor );
+ }
+}
+
+#endif
+
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/text/widorp.hxx b/binfilter/bf_sw/source/core/text/widorp.hxx
new file mode 100644
index 000000000000..e8e2b66bc426
--- /dev/null
+++ b/binfilter/bf_sw/source/core/text/widorp.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _WIDORP_HXX
+#define _WIDORP_HXX
+
+class SwTxtFrm;
+
+#include "swtypes.hxx"
+#include "itrtxt.hxx"
+namespace binfilter {
+
+class SwTxtFrmBreak
+{
+private:
+ SwTwips nRstHeight;
+#ifdef VERTICAL_LAYOUT
+ SwTwips nOrigin;
+#else
+ const SwTwips nOrigin;
+#endif
+protected:
+ SwTxtFrm *pFrm;
+ sal_Bool bBreak;
+ sal_Bool bKeep;
+public:
+ SwTxtFrmBreak( SwTxtFrm *pFrm, const SwTwips nRst = 0 );
+ sal_Bool IsBreakNow( SwTxtMargin &rLine );
+
+ sal_Bool IsBroken() const { return bBreak; }
+ sal_Bool IsKeepAlways() const { return bKeep; }
+ void Keep() { bKeep = sal_True; }
+ void Break() { bKeep = sal_False; bBreak = sal_True; }
+
+ inline sal_Bool GetKeep() const { return bKeep; }
+ inline void SetKeep( const sal_Bool bNew ) { bKeep = bNew; }
+
+ sal_Bool IsInside( SwTxtMargin &rLine ) const;
+
+ // Um Sonderfaelle mit Ftn behandeln zu koennen.
+ // Mit SetRstHeight wird dem SwTxtFrmBreak die Resthoehe eingestellt,
+ // Um TruncLines() rufen zu koennen, ohne dass IsBreakNow() einen
+ // anderen Wert zurueckliefert.
+ // Es wird dabei davon ausgegangen, dass rLine auf der letzten Zeile
+ // steht, die nicht mehr passt.
+
+#ifdef VERTICAL_LAYOUT
+ void SetRstHeight( const SwTxtMargin &rLine )
+ {
+ if ( pFrm->IsVertical() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 nRstHeight = nOrigin - pFrm->SwitchHorizontalToVertical( rLine.Y() );
+ else
+ nRstHeight = rLine.Y() - nOrigin;
+ }
+#else
+ void SetRstHeight( const SwTxtMargin &rLine ) { nRstHeight = rLine.Y() - nOrigin; }
+#endif
+
+ SwTwips GetRstHeight() const { return nRstHeight; }
+};
+
+class WidowsAndOrphans : public SwTxtFrmBreak
+{
+private:
+ MSHORT nWidLines, nOrphLines;
+
+public:
+ WidowsAndOrphans( SwTxtFrm *pFrm, const SwTwips nRst = 0,
+ sal_Bool bCheckKeep = sal_True );
+ sal_Bool FindWidows( SwTxtFrm *pFrm, SwTxtMargin &rLine );
+ MSHORT GetWidowsLines() const
+ { return nWidLines; }
+ MSHORT GetOrphansLines() const
+ { return nOrphLines; }
+ void ClrOrphLines(){ nOrphLines = 0; }
+
+ sal_Bool FindBreak( SwTxtFrm *pFrm, SwTxtMargin &rLine, sal_Bool bHasToFit );
+ sal_Bool WouldFit( SwTxtMargin &rLine, SwTwips &rMaxHeight );
+ sal_Bool IsBreakNow( SwTxtMargin &rLine )
+ { return ( rLine.GetLineNr() > nOrphLines ) &&
+ SwTxtFrmBreak::IsBreakNow( rLine ); }
+};
+
+
+} //namespace binfilter
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/tox/makefile.mk b/binfilter/bf_sw/source/core/tox/makefile.mk
new file mode 100644
index 000000000000..7c8c278e6104
--- /dev/null
+++ b/binfilter/bf_sw/source/core/tox/makefile.mk
@@ -0,0 +1,73 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_tox
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+
+.IF "$(mydebug)" != ""
+CDEFS+=-Dmydebug
+.ENDIF
+
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:128
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_tox.cxx \
+ sw_toxhlp.cxx \
+ sw_txmsrt.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/sw_tox.obj \
+ $(SLO)$/sw_toxhlp.obj \
+ $(SLO)$/sw_txmsrt.obj
+
+EXCEPTIONSFILES= \
+ $(SLO)$/sw_toxhlp.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/tox/sw_tox.cxx b/binfilter/bf_sw/source/core/tox/sw_tox.cxx
new file mode 100644
index 000000000000..ac2f9e316f5c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/tox/sw_tox.cxx
@@ -0,0 +1,1102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <tools/resid.hxx>
+#include <txtatr.hxx>
+#include <ndtxt.hxx>
+#include <tox.hxx>
+#include <poolfmt.hrc>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <bf_svx/tstpitem.hxx>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+/*N*/ const sal_Char* SwForm::aFormEntry = "<E>";
+/*N*/ const sal_Char* SwForm::aFormTab = "<T>";
+/*N*/ const sal_Char* SwForm::aFormPageNums = "<#>";
+/*N*/ const sal_Char* SwForm::aFormLinkStt = "<LS>";
+/*N*/ const sal_Char* SwForm::aFormLinkEnd = "<LE>";
+/*N*/ const sal_Char* SwForm::aFormEntryNum = "<E#>";
+/*N*/ const sal_Char* SwForm::aFormEntryTxt = "<ET>";
+/*N*/ const sal_Char* SwForm::aFormChapterMark= "<C>";
+/*N*/ const sal_Char* SwForm::aFormText = "<X>";
+/*N*/ const sal_Char* SwForm::aFormAuth = "<A>";
+/*N*/ BYTE SwForm::nFormTabLen = 3;
+/*N*/ BYTE SwForm::nFormEntryLen = 3;
+/*N*/ BYTE SwForm::nFormPageNumsLen = 3;
+/*N*/ BYTE SwForm::nFormLinkSttLen = 4;
+/*N*/ BYTE SwForm::nFormLinkEndLen = 4;
+/*N*/ BYTE SwForm::nFormEntryNumLen = 4;
+/*N*/ BYTE SwForm::nFormEntryTxtLen = 4;
+/*N*/ BYTE SwForm::nFormChapterMarkLen = 3;
+/*N*/ BYTE SwForm::nFormTextLen = 3;
+/*N*/ BYTE SwForm::nFormAuthLen = 5;
+
+
+
+/*N*/ TYPEINIT2( SwTOXMark, SfxPoolItem, SwClient ); // fuers rtti
+
+/* -----------------23.09.99 14:09-------------------
+ includes plain text at a given position into
+ the appropriate token
+ --------------------------------------------------*/
+USHORT lcl_ConvertTextIntoPattern( String& rPattern,
+ xub_StrLen nStart, xub_StrLen nEnd )
+{
+ String sTmp; sTmp.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "<X ,,"));
+ sTmp += TOX_STYLE_DELIMITER;
+ sTmp += rPattern.Copy( nStart, nEnd - nStart);
+ rPattern.Erase( nStart, nEnd - nStart);
+ sTmp += TOX_STYLE_DELIMITER;
+ sTmp += '>';
+ rPattern.Insert(sTmp, nStart);
+ // return the offset of the new end position
+ return 8;
+}
+
+/* -----------------23.09.99 13:59-------------------
+
+ --------------------------------------------------*/
+struct PatternIni
+{
+ USHORT n1;
+ USHORT n2;
+ USHORT n3;
+ USHORT n4;
+ USHORT n5;
+};
+const PatternIni aPatternIni[] =
+{
+ {USHRT_MAX}, //Header - no pattern
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_ARTICLE,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_BOOK,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_BOOKLET,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_CONFERENCE,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_INBOOK,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_INCOLLECTION,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_INPROCEEDINGS,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_JOURNAL,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_MANUAL,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_MASTERSTHESIS,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_MISC,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_PHDTHESIS,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_PROCEEDINGS,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_TECHREPORT,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_UNPUBLISHED,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_EMAIL,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, AUTH_FIELD_URL, USHRT_MAX},//AUTH_TYPE_WWW,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_CUSTOM1,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_CUSTOM2,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_CUSTOM3,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_CUSTOM4,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_TYPE_CUSTOM5,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_YEAR,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_URL,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_CUSTOM1,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_CUSTOM2,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_CUSTOM3,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_CUSTOM4,
+ {AUTH_FIELD_AUTHOR, AUTH_FIELD_TITLE, AUTH_FIELD_YEAR, USHRT_MAX, USHRT_MAX}, //AUTH_FIELD_CUSTOM5,
+ {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}
+};
+/* -----------------23.09.99 13:58-------------------
+
+ --------------------------------------------------*/
+String lcl_GetAuthPattern(USHORT nTypeId)
+{
+ String sAuth; sAuth.AssignAscii( SwForm::aFormAuth );
+ sAuth.Insert(' ', 2);
+ //
+ PatternIni aIni = aPatternIni[nTypeId];
+
+ //TODO: create pattern for authorities
+ // create a level for each type of authorities
+ String sRet = sAuth;
+ String sTmp( String::CreateFromInt32( AUTH_FIELD_IDENTIFIER ));
+ if(sTmp.Len() < 2)
+ sTmp.Insert('0', 0);
+ sRet.Insert(sTmp, 2);
+ sRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ));
+ lcl_ConvertTextIntoPattern(sRet, sRet.Len() - 2, sRet.Len());
+ USHORT nVals[5];
+ nVals[0] = aIni.n1;
+ nVals[1] = aIni.n2;
+ nVals[2] = aIni.n3;
+ nVals[3] = aIni.n4;
+ nVals[4] = aIni.n5;
+
+ for(USHORT i = 0; i < 5 ; i++)
+ {
+ if(nVals[i] == USHRT_MAX)
+ break;
+ if(i > 0)
+ {
+ sRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ));
+ lcl_ConvertTextIntoPattern(sRet, sRet.Len() - 2, sRet.Len());
+ }
+ sRet += sAuth;
+ sTmp = String::CreateFromInt32( nVals[ i ] );
+ if(sTmp.Len() < 2)
+ sTmp.Insert('0', 0);
+ sRet.Insert(sTmp, sRet.Len() - 2);
+ }
+ return sRet;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis-Markierungen D/Ctor
+ --------------------------------------------------------------------*/
+
+
+ // Konstruktor fuers Default vom Attribut-Pool
+/*N*/ SwTOXMark::SwTOXMark()
+/*N*/ : SfxPoolItem( RES_TXTATR_TOXMARK ),
+/*N*/ SwClient( 0 ),
+/*N*/ pTxtAttr( 0 ),
+/*N*/ bAutoGenerated(FALSE),
+/*N*/ bMainEntry(FALSE)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwTOXMark::SwTOXMark( const SwTOXType* pTyp )
+/*N*/ : SfxPoolItem( RES_TXTATR_TOXMARK ),
+/*N*/ SwClient( (SwModify*)pTyp ),
+/*N*/ pTxtAttr( 0 ), nLevel( 0 ),
+/*N*/ bAutoGenerated(FALSE),
+/*N*/ bMainEntry(FALSE)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwTOXMark::SwTOXMark( const SwTOXMark& rCopy )
+/*N*/ : SfxPoolItem( RES_TXTATR_TOXMARK ),
+/*N*/ SwClient((SwModify*)rCopy.GetRegisteredIn()),
+/*N*/ pTxtAttr( 0 ), nLevel( rCopy.nLevel ),
+/*N*/ aPrimaryKey( rCopy.aPrimaryKey ), aSecondaryKey( rCopy.aSecondaryKey ),
+/*N*/ aTextReading( rCopy.aTextReading ),
+/*N*/ aPrimaryKeyReading( rCopy.aPrimaryKeyReading ),
+/*N*/ aSecondaryKeyReading( rCopy.aSecondaryKeyReading ),
+/*N*/ bAutoGenerated( rCopy.bAutoGenerated),
+/*N*/ bMainEntry(rCopy.bMainEntry)
+/*N*/ {
+/*N*/ // AlternativString kopieren
+/*N*/ aAltText = rCopy.aAltText;
+/*N*/ }
+
+
+/*N*/ SwTOXMark::~SwTOXMark()
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ int SwTOXMark::operator==( const SfxPoolItem& rAttr ) const
+/*N*/ {
+/*N*/ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+/*N*/ return GetRegisteredIn() == ((SwTOXMark&)rAttr).GetRegisteredIn();
+/*N*/ }
+
+
+/*N*/ SfxPoolItem* SwTOXMark::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwTOXMark( *this );
+/*N*/ }
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen von Verzeichnissen verwalten
+ --------------------------------------------------------------------*/
+
+/*N*/ SwTOXType::SwTOXType( TOXTypes eTyp, const String& rName )
+/*N*/ : SwModify(0),
+/*N*/ aName(rName),
+/*N*/ eType(eTyp)
+/*N*/ {
+/*N*/ }
+
+
+/*N*/ SwTOXType::SwTOXType(const SwTOXType& rCopy)
+/*N*/ : SwModify( (SwModify*)rCopy.GetRegisteredIn() ),
+/*N*/ aName(rCopy.aName),
+/*N*/ eType(rCopy.eType)
+/*N*/ {
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Formen bearbeiten
+ --------------------------------------------------------------------*/
+
+
+/*N*/ SwForm::SwForm( USHORT nTyp )
+/*N*/ : nType( nTyp ), nFormMaxLevel( SwForm::GetFormMaxLevel( nTyp )),
+/*N*/ // nFirstTabPos( lNumIndent ),
+/*N*/ bCommaSeparated(FALSE)
+/*N*/ {
+/*N*/ //bHasFirstTabPos =
+/*N*/ bGenerateTabPos = FALSE;
+/*N*/ bIsRelTabPos = TRUE;
+/*N*/
+/*N*/ // Inhaltsverzeichnis hat entsprechend Anzahl Headlines + Ueberschrift
+/*N*/ // Benutzer hat 10 Ebenen + Ueberschrift
+/*N*/ // Stichwort hat 3 Ebenen + Ueberschrift + Trenner
+/*N*/ // indexes of tables, objects illustrations and authorities consist of a heading and one level
+/*N*/
+/*N*/ USHORT nPoolId;
+/*N*/ switch( nType )
+/*N*/ {
+/*N*/ case TOX_INDEX: nPoolId = STR_POOLCOLL_TOX_IDXH; break;
+/*N*/ case TOX_USER: nPoolId = STR_POOLCOLL_TOX_USERH; break;
+/*N*/ case TOX_CONTENT: nPoolId = STR_POOLCOLL_TOX_CNTNTH; break;
+/*?*/ case TOX_ILLUSTRATIONS: nPoolId = STR_POOLCOLL_TOX_ILLUSH; break;
+/*?*/ case TOX_OBJECTS : nPoolId = STR_POOLCOLL_TOX_OBJECTH; break;
+/*?*/ case TOX_TABLES : nPoolId = STR_POOLCOLL_TOX_TABLESH; break;
+/*?*/ case TOX_AUTHORITIES : nPoolId = STR_POOLCOLL_TOX_AUTHORITIESH; break;
+/*?*/ default:
+/*?*/ ASSERT( !this, "ungueltiger TOXTyp");
+/*?*/ return ;
+/*N*/ }
+/*N*/
+/*N*/ String sStr;
+/*N*/ {
+/*N*/ ByteString sBStr;
+/*N*/ if( TOX_CONTENT == nType )
+/*N*/ ( sBStr = SwForm::aFormEntryNum ) += SwForm::aFormEntryTxt;
+/*N*/ else
+/*N*/ sBStr = SwForm::aFormEntry;
+/*N*/ if( TOX_AUTHORITIES != nType)
+/*N*/ {
+/*N*/ sBStr += SwForm::aFormTab;
+/*N*/ ByteString sTmp( RTL_CONSTASCII_STRINGPARAM( " ,65535,0," ));
+/*N*/ if(TOX_CONTENT == nType)
+/*N*/ {
+/*N*/ //the most right tab stop is "most_right_aligned"
+/*N*/ sTmp += ByteString::CreateFromInt32( SVX_TAB_ADJUST_END );
+/*N*/ //and has a dot as FillChar
+/*N*/ sTmp.Append( RTL_CONSTASCII_STRINGPARAM( ",." ));
+/*N*/ sBStr.Insert(sTmp, sBStr.Len() - 1);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ sTmp += ByteString::CreateFromInt32( SVX_TAB_ADJUST_LEFT );
+/*N*/ //and has a space as FillChar
+/*N*/ sTmp.Append( RTL_CONSTASCII_STRINGPARAM( ", " ));
+/*N*/ }
+/*N*/ sBStr.Insert( sTmp, sBStr.Len() - 1);
+/*N*/ sBStr += SwForm::aFormPageNums;
+/*N*/ }
+/*N*/ sStr.AppendAscii( sBStr.GetBuffer(), sBStr.Len() );
+/*N*/ }
+/*N*/
+/*N*/ SetTemplate( 0, SW_RESSTR( nPoolId++ ));
+/*N*/
+/*N*/ if(TOX_INDEX == nType)
+/*N*/ {
+/*N*/ for( USHORT i = 1; i < 5; ++i )
+/*N*/ {
+/*N*/ if(1 == i)
+/*N*/ {
+/*N*/ String sTmp; sTmp.AssignAscii( SwForm::aFormEntry );
+/*N*/ sTmp.Insert(' ', SwForm::nFormEntryLen - 1);
+/*N*/ SetPattern( i, sTmp );
+/*N*/ SetTemplate( i, SW_RESSTR( STR_POOLCOLL_TOX_IDXBREAK ));
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SetPattern( i, sStr );
+/*N*/ SetTemplate( i, SW_RESSTR( STR_POOLCOLL_TOX_IDX1 + i - 2 ));
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ for( USHORT i = 1; i < GetFormMax(); ++i, ++nPoolId ) // Nr 0 ist der Titel
+/*N*/ {
+/*N*/ if(TOX_AUTHORITIES == nType)
+/*?*/ SetPattern(i, lcl_GetAuthPattern(i));
+/*N*/ else
+/*N*/ SetPattern( i, sStr );
+/*N*/
+/*N*/ if( TOX_CONTENT == nType && 6 == i )
+/*N*/ nPoolId = STR_POOLCOLL_TOX_CNTNT6;
+/*N*/ else if( TOX_USER == nType && 6 == i )
+/*N*/ nPoolId = STR_POOLCOLL_TOX_USER6;
+/*N*/ else if( TOX_AUTHORITIES == nType )
+/*?*/ nPoolId = STR_POOLCOLL_TOX_AUTHORITIES1;
+/*N*/ SetTemplate( i, SW_RESSTR( nPoolId ) );
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ SwForm::SwForm(const SwForm& rForm)
+/*N*/ : nType( rForm.nType )
+/*N*/ {
+/*N*/ *this = rForm;
+/*N*/ }
+
+
+/*N*/ SwForm& SwForm::operator=(const SwForm& rForm)
+/*N*/ {
+/*N*/ nType = rForm.nType;
+/*N*/ nFormMaxLevel = rForm.nFormMaxLevel;
+/*N*/ // nFirstTabPos = rForm.nFirstTabPos;
+/*N*/ // bHasFirstTabPos = rForm.bHasFirstTabPos;
+/*N*/ bGenerateTabPos = rForm.bGenerateTabPos;
+/*N*/ bIsRelTabPos = rForm.bIsRelTabPos;
+/*N*/ bCommaSeparated = rForm.bCommaSeparated;
+/*N*/ for(USHORT i=0; i < nFormMaxLevel; ++i)
+/*N*/ {
+/*N*/ aPattern[i] = rForm.aPattern[i];
+/*N*/ aTemplate[i] = rForm.aTemplate[i];
+/*N*/ }
+/*N*/ return *this;
+/*N*/ }
+
+/*N*/ USHORT SwForm::GetFormMaxLevel( USHORT nType )
+/*N*/ {
+/*N*/ USHORT nRet = 0;
+/*N*/ switch( nType )
+/*N*/ {
+/*N*/ case TOX_INDEX: nRet = 5; break;
+/*N*/ case TOX_USER: nRet = MAXLEVEL+1; break;
+/*N*/ case TOX_CONTENT: nRet = MAXLEVEL+1; break;
+/*N*/ case TOX_ILLUSTRATIONS:
+/*N*/ case TOX_OBJECTS :
+/*?*/ case TOX_TABLES : nRet = 2; break;
+/*?*/ case TOX_AUTHORITIES : nRet = AUTH_TYPE_END + 1; break;
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+/* -----------------15.06.99 13:39-------------------
+ ::com::patibilty methods: Version 5.0 and 5.1 need
+ a value for the first tab stop
+ --------------------------------------------------*/
+/*N*/ USHORT lcl_GetPatternCount( const String& rPattern, const sal_Char* pToken )
+/*N*/ {
+/*N*/ USHORT nRet = 0;
+/*N*/ String aSearch; aSearch.AssignAscii( pToken );
+/*N*/ aSearch.Erase( aSearch.Len() - 1, 1 );
+/*N*/ xub_StrLen nFound = rPattern.Search( aSearch );
+/*N*/ while( STRING_NOTFOUND != nFound )
+/*N*/ if( STRING_NOTFOUND != ( nFound = rPattern.Search( '>', nFound ) ))
+/*N*/ {
+/*N*/ ++nRet;
+/*N*/ nFound = rPattern.Search( aSearch, nFound );
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ String lcl_GetPattern( const String& rPattern, const sal_Char* pToken )
+/*N*/ {
+/*N*/ String sRet;
+/*N*/ String aSearch; aSearch.AssignAscii( pToken );
+/*N*/ aSearch.Erase( aSearch.Len() - 1, 1 );
+/*N*/
+/*N*/ xub_StrLen nEnd, nFound = rPattern.Search( aSearch );
+/*N*/ if( STRING_NOTFOUND != nFound &&
+/*N*/ STRING_NOTFOUND != ( nEnd = rPattern.Search( '>', nFound )) )
+/*N*/ sRet = rPattern.Copy( nFound, nEnd - nFound + 1 );
+/*N*/ return sRet;
+/*N*/ }
+
+/*N*/ USHORT SwForm::GetFirstTabPos() const //{ return nFirstTabPos; }
+/*N*/ {
+/*N*/ DBG_WARNING("compatibility");
+/*N*/ String sFirstLevelPattern = aPattern[ 1 ];
+/*N*/ USHORT nRet = 0;
+/*N*/ if( 2 <= ::binfilter::lcl_GetPatternCount( sFirstLevelPattern, SwForm::aFormTab ))
+/*N*/ {
+/*N*/ //sTab is in the Form "<T ,,value>" where value is the tab position an may be empty
+/*N*/ String sTab = lcl_GetPattern( sFirstLevelPattern, SwForm::aFormTab );
+/*N*/ if( 3 <= sTab.GetTokenCount(',') )
+/*N*/ {
+/*N*/ sTab = sTab.GetToken( 2, ',');
+/*N*/ sTab.Erase( sTab.Len() - 1, 1 );
+/*N*/ nRet = sTab.ToInt32();
+/*N*/ }
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+void SwForm::SetFirstTabPos( USHORT n ) //{ nFirstTabPos = n; }
+{
+ // the tab stop token looks like: <T ,,1234,0,.> <T> <T ,,1234>
+ //for loading only: all levels get a first tab stop at the given position
+ String sVal( String::CreateFromInt32( n ));
+ String sTmp; sTmp.AssignAscii( SwForm::aFormTab );
+ sTmp.Insert(sVal, 2);
+
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ //if two tabstops then exchange
+ String& rPattern = aPattern[ i + 1];
+ if( 2 <= lcl_GetPatternCount( rPattern, SwForm::aFormTab ))
+ {
+ //change existing tab
+ xub_StrLen nStart = rPattern.SearchAscii( "<T" );
+ xub_StrLen nEnd = rPattern.Search( '>', nStart );
+ String sTmp( rPattern.Copy( nStart, nEnd - nStart + 1 ));
+ rPattern.Erase( nStart, nEnd - nStart + 1 );
+
+ // if TabAlign is set
+ String sTabAlign;
+ if(sTmp.GetTokenCount(',') >= 4)
+ {
+ sTabAlign = sTmp.GetToken(3, ',');
+ sTabAlign.Erase(sTabAlign.Len() - 1, 1);
+ }
+ String sTabFillChar;
+ if(sTmp.GetTokenCount(',') >= 5)
+ {
+ sTabFillChar = sTmp.GetToken(4, ',');
+ sTabFillChar.Erase(sTabAlign.Len() - 1, 1);
+ }
+ sTmp.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "<T ,," ));
+ sTmp += sVal;
+ if( sTabAlign.Len() )
+ {
+ sTmp += ',';
+ sTmp += sTabAlign;
+ }
+ if(sTabFillChar.Len())
+ {
+ sTmp += ',';
+ sTmp += sTabFillChar;
+ }
+ sTmp += '>';
+ rPattern.Insert( sTmp, nStart );
+ }
+ else
+ {
+ //insert new tab after the first token
+ xub_StrLen nIndex = rPattern.Search('>');
+ String sTmp;
+ sTmp.AssignAscii( SwForm::aFormTab );
+ sTmp.InsertAscii( " ,,", nFormTabLen - 1);
+ sTmp.Insert( sVal, nFormTabLen + 2 );
+ rPattern.Insert( sTmp, nIndex + 1 );
+ }
+ }
+}
+/* -----------------------------28.02.00 09:48--------------------------------
+ if the templates contain settings of the tab positions (<5.1) then
+ they must be imported into the pattern
+ ---------------------------------------------------------------------------*/
+/*N*/ BOOL lcl_FindTabToken( const String& rPattern, xub_StrLen nSearchFrom,
+/*N*/ xub_StrLen& rFoundStart, xub_StrLen& rFoundEnd)
+/*N*/ {
+/*N*/ // search for <T ...>
+/*N*/ // special handling of <TX ...>
+/*N*/
+/*N*/ BOOL bRet = FALSE;
+/*N*/ String sToFind; sToFind.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "<T" ));
+/*N*/ xub_StrLen nFoundPos = rPattern.Search( sToFind, nSearchFrom );
+/*N*/ while( STRING_NOTFOUND != nFoundPos )
+/*N*/ {
+/*N*/ if( rPattern.GetChar(nFoundPos +1) == 'X')
+/*N*/ {
+/*?*/ // handling of text tokens
+/*?*/ xub_StrLen nTempDelim = rPattern.Search(TOX_STYLE_DELIMITER, nFoundPos);
+/*?*/ xub_StrLen nTempEndSymbol = rPattern.Search(TOX_STYLE_DELIMITER, nFoundPos);
+/*?*/ if( nTempEndSymbol < nTempDelim && STRING_NOTFOUND != nTempDelim )
+/*?*/ {
+/*?*/ //text delimiter must! be in pairs
+/*?*/ nTempDelim = rPattern.Search(TOX_STYLE_DELIMITER, nTempDelim + 1);
+/*?*/ nTempEndSymbol = rPattern.Search(TOX_STYLE_DELIMITER, nTempDelim + 1);
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ nFoundPos = nTempDelim;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ //tab stop token found - find end position
+/*N*/ rFoundStart = nFoundPos;
+/*N*/ rFoundEnd = rPattern.Search('>', nFoundPos +1);
+/*N*/ bRet = TRUE;
+/*N*/ break;
+/*N*/ }
+/*?*/ nFoundPos = rPattern.Search( sToFind, nSearchFrom );
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+//-----------------------------------------------------------------------------
+/*N*/ void SwForm::AdjustTabStops(SwDoc& rDoc)
+/*N*/ {
+/*N*/ for(USHORT nLevel = 1; nLevel < GetFormMax(); nLevel++)
+/*N*/ {
+/*N*/ const String& sTemplateName = GetTemplate(nLevel);
+/*N*/
+/*N*/ SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( sTemplateName );
+/*N*/ if( !pColl )
+/*N*/ {
+/*N*/ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( sTemplateName, GET_POOLID_TXTCOLL );
+/*N*/ if( USHRT_MAX != nId )
+/*N*/ pColl = rDoc.GetTxtCollFromPool( nId );
+/*N*/ }
+/*N*/ if( pColl )
+/*N*/ {
+/*N*/ const SvxTabStopItem& rTabStops = pColl->GetTabStops( FALSE );
+/*N*/ USHORT nTabCount = rTabStops.Count();
+/*N*/ String sCurrentPattern = GetPattern(nLevel);
+/*N*/ xub_StrLen nLastTabFoundEndPos = 0;
+/*N*/ BOOL bChanged = FALSE;
+/*N*/ for(USHORT nTab = 0; nTab < nTabCount; nTab++)
+/*N*/ {
+/*N*/ bChanged = TRUE;
+/*N*/ const SvxTabStop& rTab = rTabStops[nTab];
+/*N*/ xub_StrLen nStart, nEnd;
+/*N*/ if( ::binfilter::lcl_FindTabToken( sCurrentPattern, nLastTabFoundEndPos,
+/*N*/ nStart, nEnd ))
+/*N*/ {
+/*N*/ sCurrentPattern.Erase( nStart, nEnd - nStart + 1 );
+/*N*/ // should look like: T ,,12345,2,_
+/*N*/ long nPosition = rTab.GetTabPos();
+/*N*/ USHORT eAlign = rTab.GetAdjustment();
+/*N*/ sal_Unicode cFillChar = rTab.GetFill();
+/*N*/ //create new token
+/*N*/ String sNewToken;
+/*N*/ sNewToken.AssignAscii( RTL_CONSTASCII_STRINGPARAM("<T ,,"));
+/*N*/ sNewToken += String::CreateFromInt32( nPosition );
+/*N*/ sNewToken += ',';
+/*N*/ //the last tab stop is converted into a 'most right' tab stop
+/*N*/ //this will work most of the time - not if a right tab stop
+/*N*/ //is define before the line end - but it cannot be detected
+/*N*/ if( nTab == nTabCount - 1 && eAlign == SVX_TAB_ADJUST_RIGHT)
+/*N*/ eAlign = SVX_TAB_ADJUST_END;
+/*N*/ sNewToken += String::CreateFromInt32( eAlign );
+/*N*/ sNewToken += ',';
+/*N*/ sNewToken += cFillChar;
+/*N*/ sNewToken += '>';
+/*N*/ sCurrentPattern.Insert(sNewToken, nStart);
+/*N*/ //set next search pos behind the changed token
+/*N*/ nLastTabFoundEndPos = nStart + sNewToken.Len();
+/*N*/ }
+/*N*/ else
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if(bChanged)
+/*N*/ SetPattern(nLevel, sCurrentPattern);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+//-----------------------------------------------------------------------------
+
+/*N*/ BOOL SwForm::IsFirstTabPosFlag() const //{ return bHasFirstTabPos; }
+/*N*/ {
+/*N*/ //rturn true if the first level contains two ore more tabstops
+/*N*/ return 2 <= lcl_GetPatternCount(aPattern[ 1 ], SwForm::aFormTab);
+/*N*/ }
+/* -----------------29.07.99 14:37-------------------
+
+ --------------------------------------------------*/
+/*N*/ String SwForm::ConvertPatternTo51(const String& rSource)
+/*N*/ {
+/*N*/ SwFormTokenEnumerator aEnum(rSource);
+/*N*/ String sRet;
+/*N*/ while(aEnum.HasNextToken())
+/*N*/ {
+/*N*/ SwFormToken aToken(aEnum.GetNextToken());
+/*N*/ switch(aToken.eTokenType)
+/*N*/ {
+/*N*/ case TOKEN_ENTRY_NO :
+/*N*/ sRet.AppendAscii( SwForm::aFormEntryNum );
+/*N*/ break;
+/*N*/ case TOKEN_ENTRY_TEXT :
+/*N*/ sRet.AppendAscii( SwForm::aFormEntryTxt );
+/*N*/ break;
+/*N*/ case TOKEN_ENTRY :
+/*N*/ sRet.AppendAscii( SwForm::aFormEntry );
+/*N*/ break;
+/*N*/ case TOKEN_TAB_STOP :
+/*N*/ sRet.AppendAscii( SwForm::aFormTab );
+/*N*/ break;
+/*N*/ case TOKEN_TEXT :
+/*?*/ sRet += aToken.sText;
+/*?*/ break;
+/*N*/ case TOKEN_PAGE_NUMS :
+/*N*/ sRet.AppendAscii( SwForm::aFormPageNums );
+/*N*/ break;
+/*N*/ case TOKEN_CHAPTER_INFO :
+/*N*/ // not available in 5.1
+/*N*/ break;
+/*N*/ case TOKEN_LINK_START :
+/*N*/ sRet.AppendAscii( SwForm::aFormLinkStt );
+/*N*/ break;
+/*N*/ case TOKEN_LINK_END :
+/*N*/ sRet.AppendAscii( SwForm::aFormLinkEnd );
+/*N*/ break;
+/*N*/ case TOKEN_AUTHORITY :
+/*N*/ // no conversion available
+/*?*/ sRet.AppendAscii( SwForm::aFormEntry );
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ return sRet;
+/*N*/ }
+/* -----------------29.07.99 14:37-------------------
+
+ --------------------------------------------------*/
+/*N*/ String SwForm::ConvertPatternFrom51(const String& rSource, TOXTypes eType)
+/*N*/ {
+/*N*/ String sRet( rSource );
+/*N*/ DBG_ASSERT(rSource.GetTokenCount('>') == rSource.GetTokenCount('<'),
+/*N*/ "count of '<' and '>' not identical");
+/*N*/ // simple task - convert tokens
+/*N*/ // <E> -> <E >
+/*N*/ // <E#> -> <E# >
+/*N*/ // <ET> -> <ET >
+/*N*/ // <#> -> <# >
+/*N*/ // <T> -> <T >
+/*N*/ // <LS> -> <LS >
+/*N*/ // <LE> -> <LE >
+/*N*/ for( xub_StrLen nFound = 0;
+/*N*/ STRING_NOTFOUND != ( nFound = sRet.Search( '>', nFound )); )
+/*N*/ {
+/*N*/ sRet.Insert( ' ', nFound );
+/*N*/ nFound += 2; // skip over the blank and '>'
+/*N*/ }
+/*N*/
+/*N*/ //more complicated: convert text between >TEXT< to <X \0xffTEXT\0xff>
+/*N*/ xub_StrLen nOpenStart = 0;
+/*N*/ xub_StrLen nCloseStart = 0;
+/*N*/ xub_StrLen nClosePos = sRet.Search('>', nCloseStart);
+/*N*/ xub_StrLen nOpenPos = sRet.Search('<', nOpenStart);
+/*N*/ if(nOpenPos != STRING_NOTFOUND && nOpenPos > 0)
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 USHORT nOffset = lcl_ConvertTextIntoPattern( sRet, 0, nOpenPos);
+/*N*/ }
+/*N*/ else
+/*N*/ nOpenStart = nClosePos;
+/*N*/ nOpenPos = sRet.Search('<', ++nOpenStart);
+/*N*/ while(nOpenPos != STRING_NOTFOUND)
+/*N*/ {
+/*N*/ if(nClosePos < nOpenPos - 1)
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 USHORT nOffset = lcl_ConvertTextIntoPattern(sRet, nClosePos + 1, nOpenPos);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ nCloseStart = nClosePos;
+/*N*/ nOpenStart = nOpenPos;
+/*N*/ }
+/*N*/ nClosePos = sRet.Search('>', ++nCloseStart);
+/*N*/ nOpenPos = sRet.Search('<', ++nOpenStart);
+/*N*/ }
+/*N*/ //is there any text at the end?
+/*N*/ if(nClosePos != STRING_NOTFOUND && nClosePos < sRet.Len() - 1)
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 lcl_ConvertTextIntoPattern(sRet, nClosePos + 1, sRet.Len());
+/*N*/ if(eType != TOX_INDEX)
+/*N*/ {
+/*N*/ // set most left tab stop to right alignment and FillChar == '.'
+/*N*/ String sTabSearch;
+/*N*/ sTabSearch.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "<T "));
+/*N*/ xub_StrLen nOldTabPos = sRet.Search(sTabSearch);
+/*N*/ if(STRING_NOTFOUND != nOldTabPos)
+/*N*/ {
+/*N*/ xub_StrLen nNewTabPos = nOldTabPos;
+/*N*/ do {
+/*N*/ nOldTabPos = nNewTabPos;
+/*N*/ nNewTabPos = sRet.Search(sTabSearch, nOldTabPos + 1);
+/*N*/ } while(STRING_NOTFOUND != nNewTabPos);
+/*N*/ sRet.InsertAscii( ",65535,0,5,.", nOldTabPos + 3 );
+/*N*/ }
+/*N*/ }
+/*N*/ return sRet;
+/*N*/ }
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor TOXBase
+ --------------------------------------------------------------------*/
+
+
+/*N*/ SwTOXBase::SwTOXBase(const SwTOXType* pTyp, const SwForm& rForm,
+/*N*/ USHORT nCreaType, const String& rTitle )
+/*N*/ : SwClient((SwModify*)pTyp),
+/*N*/ nCreateType(nCreaType),
+/*N*/ aTitle(rTitle),
+/*N*/ aForm(rForm),
+/*N*/ eCaptionDisplay(CAPTION_COMPLETE),
+/*N*/ eLanguage((LanguageType)::binfilter::GetAppLanguage()),
+/*N*/ bProtected( TRUE ),
+/*N*/ bFromChapter(FALSE),
+/*N*/ bFromObjectNames(FALSE),
+/*N*/ bLevelFromChapter(FALSE),
+/*N*/ nOLEOptions(0)
+/*N*/ {
+/*N*/ aData.nOptions = 0;
+/*N*/ }
+
+
+/*N*/ SwTOXBase::SwTOXBase( const SwTOXBase& rSource, SwDoc* pDoc )
+/*N*/ : SwClient( rSource.pRegisteredIn )
+/*N*/ {
+/*N*/ CopyTOXBase( pDoc, rSource );
+/*N*/ }
+
+/*N*/ SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource )
+/*N*/ {
+/*N*/ SwTOXType* pType = (SwTOXType*)rSource.GetTOXType();
+/*N*/ if( pDoc && USHRT_MAX == pDoc->GetTOXTypes().GetPos( pType ))
+/*N*/ {
+/*?*/ // type not in pDoc, so create it now
+/*?*/ const SwTOXTypes& rTypes = pDoc->GetTOXTypes();
+/*?*/ BOOL bFound = FALSE;
+/*?*/ for( USHORT n = rTypes.Count(); n; )
+/*?*/ {
+/*?*/ const SwTOXType* pCmp = rTypes[ --n ];
+/*?*/ if( pCmp->GetType() == pType->GetType() &&
+/*?*/ pCmp->GetTypeName() == pType->GetTypeName() )
+/*?*/ {
+/*?*/ pType = (SwTOXType*)pCmp;
+/*?*/ bFound = TRUE;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ if( !bFound )
+/*?*/ pType = (SwTOXType*)pDoc->InsertTOXType( *pType );
+/*N*/ }
+/*N*/ pType->Add( this );
+/*N*/
+/*N*/ nCreateType = rSource.nCreateType;
+/*N*/ aTitle = rSource.aTitle;
+/*N*/ aForm = rSource.aForm;
+/*N*/ bProtected = rSource.bProtected;
+/*N*/ bFromChapter = rSource.bFromChapter;
+/*N*/ bFromObjectNames = rSource.bFromObjectNames;
+/*N*/ sMainEntryCharStyle = rSource.sMainEntryCharStyle;
+/*N*/ sSequenceName = rSource.sSequenceName;
+/*N*/ eCaptionDisplay = rSource.eCaptionDisplay;
+/*N*/ nOLEOptions = rSource.nOLEOptions;
+/*N*/ eLanguage = rSource.eLanguage;
+/*N*/ sSortAlgorithm = rSource.sSortAlgorithm;
+/*N*/
+/*N*/ for( USHORT i = 0; i < MAXLEVEL; ++i )
+/*N*/ aStyleNames[i] = rSource.aStyleNames[i];
+/*N*/
+/*N*/ // its the same data type!
+/*N*/ aData.nOptions = rSource.aData.nOptions;
+/*N*/
+/*N*/ if( !pDoc || pDoc->IsCopyIsMove() )
+/*N*/ aName = rSource.GetTOXName();
+/*N*/ else
+/*?*/ aName = pDoc->GetUniqueTOXBaseName( *pType, &rSource.GetTOXName() );
+/*N*/
+/*N*/ return *this;
+/*N*/ }
+
+/* -----------------30.06.99 14:46-------------------
+ Check if any style names are set in the array
+ --------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnisspezifische Funktionen
+ --------------------------------------------------------------------*/
+
+/*N*/ SwTOXBase::~SwTOXBase()
+/*N*/ {
+/*N*/ // if( GetTOXType()->GetType() == TOX_USER )
+/*N*/ // delete aData.pTemplateName;
+/*N*/ }
+
+/* -----------------16.07.99 16:02-------------------
+
+ --------------------------------------------------*/
+/*N*/ SwFormTokenEnumerator::SwFormTokenEnumerator( const String& rPattern )
+/*N*/ : sPattern( rPattern ), nCurPatternPos( 0 ), nCurPatternLen( 0 )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ DBG_ASSERT( !sPattern.Len() ||
+/*N*/ (sPattern.GetChar(0) == '<' &&
+/*N*/ sPattern.GetChar(sPattern.Len() - 1) == '>'),
+/*N*/ "Pattern incorrect!" );
+/*N*/
+/*N*/
+/*N*/ // strip all characters included in TOX_STYLE_DELIMITER
+/*N*/ String sTmp( sPattern );
+/*N*/ xub_StrLen nFoundStt = sTmp.Search(TOX_STYLE_DELIMITER);
+/*N*/ while(nFoundStt != STRING_NOTFOUND)
+/*N*/ {
+/*?*/ xub_StrLen nFoundEnd = sTmp.Search(TOX_STYLE_DELIMITER, nFoundStt + 1);
+/*?*/ DBG_ASSERT(STRING_NOTFOUND != nFoundEnd, "Pattern incorrect");
+/*?*/ sTmp.Erase(nFoundStt, nFoundEnd - nFoundStt + 1);
+/*?*/ nFoundStt = sTmp.Search(TOX_STYLE_DELIMITER);
+/*N*/ }
+/*N*/ DBG_ASSERT( sTmp.GetTokenCount('<') == sTmp.GetTokenCount('>'),
+/*N*/ "Pattern incorrect!");
+/*N*/ #endif
+/*N*/ }
+
+/* -----------------29.06.99 11:55-------------------
+
+ --------------------------------------------------*/
+/*N*/ SwFormToken SwFormTokenEnumerator::GetNextToken()
+/*N*/ {
+/*N*/ xub_StrLen nTokenLen, nEnd;
+/*N*/ nCurPatternPos += nCurPatternLen;
+/*N*/ FormTokenType eTokenType = _SearchNextToken( nCurPatternPos, nEnd,
+/*N*/ &nTokenLen );
+/*N*/ nCurPatternLen = nEnd - nCurPatternPos;
+/*N*/ return BuildToken( eTokenType, nTokenLen );
+/*N*/ }
+
+
+/*N*/ SwFormToken SwFormTokenEnumerator::BuildToken( FormTokenType eTokenType,
+/*N*/ xub_StrLen nTokenLen ) const
+/*N*/ {
+/*N*/ String sToken( sPattern.Copy( nCurPatternPos, nCurPatternLen ));
+/*N*/
+/*N*/ // at this point sPattern contains the
+/*N*/ // character style name, the PoolId, tab stop position, tab stop alignment, chapter info format
+/*N*/ // the form is: CharStyleName, PoolId[, TabStopPosition|ChapterInfoFormat[, TabStopAlignment[, TabFillChar]]]
+/*N*/ // in text tokens the form differs from the others: CharStyleName, PoolId[,\0xffinserted text\0xff]
+/*N*/ SwFormToken eRet( eTokenType );
+/*N*/ String sAuthFieldEnum = sToken.Copy( 2, 2 );
+/*N*/ sToken = sToken.Copy( nTokenLen, sToken.Len() - nTokenLen - 1);
+/*N*/
+/*N*/ eRet.sCharStyleName = sToken.GetToken( 0, ',');
+/*N*/ String sTmp( sToken.GetToken( 1, ',' ));
+/*N*/ if( sTmp.Len() )
+/*N*/ eRet.nPoolId = sTmp.ToInt32();
+/*N*/
+/*N*/ switch( eTokenType )
+/*N*/ {
+/*N*/ case TOKEN_TEXT:
+/*?*/ {
+/*?*/ xub_StrLen nStartText = sToken.Search( TOX_STYLE_DELIMITER );
+/*?*/ if( STRING_NOTFOUND != nStartText )
+/*?*/ {
+/*?*/ xub_StrLen nEndText = sToken.Search( TOX_STYLE_DELIMITER,
+/*?*/ nStartText + 1);
+/*?*/ if( STRING_NOTFOUND != nEndText )
+/*?*/ {
+/*?*/ eRet.sText = sToken.Copy( nStartText + 1,
+/*?*/ nEndText - nStartText - 1);
+/*?*/ }
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*N*/
+/*N*/ case TOKEN_TAB_STOP:
+/*N*/ if( (sTmp = sToken.GetToken( 2, ',' ) ).Len() )
+/*N*/ eRet.nTabStopPosition = sTmp.ToInt32();
+/*N*/
+/*N*/ if( (sTmp = sToken.GetToken( 3, ',' ) ).Len() )
+/*N*/ eRet.eTabAlign = sTmp.ToInt32();
+/*N*/
+/*N*/ if( (sTmp = sToken.GetToken( 4, ',' ) ).Len() )
+/*N*/ eRet.cTabFillChar = sTmp.GetChar(0);
+/*N*/ break;
+/*N*/
+/*N*/ case TOKEN_CHAPTER_INFO:
+/*?*/ if( (sTmp = sToken.GetToken( 2, ',' ) ).Len() )
+/*?*/ eRet.nChapterFormat = sTmp.ToInt32(); //SwChapterFormat;
+/*?*/ break;
+/*N*/
+/*N*/ case TOKEN_AUTHORITY:
+/*?*/ eRet.nAuthorityField = sAuthFieldEnum.ToInt32();
+/*?*/ break;
+/*N*/ }
+/*N*/ return eRet;
+/*N*/ }
+
+/*N*/ FormTokenType SwFormTokenEnumerator::_SearchNextToken( xub_StrLen nStt,
+/*N*/ xub_StrLen& rEnd, xub_StrLen* pTokenLen ) const
+/*N*/ {
+/*N*/ //it's not so easy - it doesn't work if the text part contains a '>'
+/*N*/ //USHORT nTokenEnd = sPattern.Search('>');
+/*N*/ rEnd = sPattern.Search( '>', nStt );
+/*N*/ if( STRING_NOTFOUND == rEnd )
+/*N*/ {
+/*?*/ rEnd = sPattern.Len();
+/*?*/ return TOKEN_END;
+/*N*/ }
+/*N*/
+/*N*/ xub_StrLen nTextSeparatorFirst = sPattern.Search( TOX_STYLE_DELIMITER, nStt );
+/*N*/ if( STRING_NOTFOUND != nTextSeparatorFirst )
+/*N*/ {
+/*?*/ xub_StrLen nTextSeparatorSecond = sPattern.Search( TOX_STYLE_DELIMITER,
+/*?*/ nTextSeparatorFirst + 1 );
+/*?*/ if( STRING_NOTFOUND != nTextSeparatorSecond &&
+/*?*/ rEnd > nTextSeparatorFirst )
+/*?*/ rEnd = sPattern.Search( '>', nTextSeparatorSecond );
+/*N*/ }
+/*N*/
+/*N*/ ++rEnd;
+/*N*/ String sToken( sPattern.Copy( nStt, rEnd - nStt ) );
+/*N*/
+/*N*/ static struct
+/*N*/ {
+/*N*/ const sal_Char* pNm;
+/*N*/ USHORT nLen;
+/*N*/ USHORT nOffset;
+/*N*/ FormTokenType eToken;
+/*N*/ } __READONLY_DATA aTokenArr[] = {
+/*N*/ SwForm::aFormTab, SwForm::nFormEntryLen, 1, TOKEN_TAB_STOP,
+/*N*/ SwForm::aFormPageNums, SwForm::nFormPageNumsLen, 1, TOKEN_PAGE_NUMS,
+/*N*/ SwForm::aFormLinkStt, SwForm::nFormLinkSttLen, 1, TOKEN_LINK_START,
+/*N*/ SwForm::aFormLinkEnd, SwForm::nFormLinkEndLen, 1, TOKEN_LINK_END,
+/*N*/ SwForm::aFormEntryNum, SwForm::nFormEntryNumLen, 1, TOKEN_ENTRY_NO,
+/*N*/ SwForm::aFormEntryTxt, SwForm::nFormEntryTxtLen, 1, TOKEN_ENTRY_TEXT,
+/*N*/ SwForm::aFormChapterMark,SwForm::nFormChapterMarkLen,1,TOKEN_CHAPTER_INFO,
+/*N*/ SwForm::aFormText, SwForm::nFormTextLen, 1, TOKEN_TEXT,
+/*N*/ SwForm::aFormEntry, SwForm::nFormEntryLen, 1, TOKEN_ENTRY,
+/*N*/ SwForm::aFormAuth, SwForm::nFormAuthLen, 3, TOKEN_AUTHORITY,
+/*N*/ 0, 0, 0, TOKEN_END
+/*N*/ };
+/*N*/
+/*N*/ FormTokenType eTokenType = TOKEN_TEXT;
+/*N*/ xub_StrLen nTokenLen = 0;
+/*N*/ const sal_Char* pNm;
+/*N*/ for( int i = 0; 0 != ( pNm = aTokenArr[ i ].pNm ); ++i )
+/*N*/ if( COMPARE_EQUAL == sToken.CompareToAscii( pNm,
+/*N*/ aTokenArr[ i ].nLen - aTokenArr[ i ].nOffset ))
+/*N*/ {
+/*N*/ eTokenType = aTokenArr[ i ].eToken;
+/*N*/ nTokenLen = aTokenArr[ i ].nLen;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( pNm, "wrong token" );
+/*N*/ if( pTokenLen )
+/*N*/ *pTokenLen = nTokenLen;
+/*N*/ return eTokenType;
+/*N*/ }
+
+
+
+
+
+
+/*N*/ String SwFormToken::GetString() const
+/*N*/ {
+/*N*/ String sRet;
+/*N*/
+/*N*/ BOOL bAppend = TRUE;
+/*N*/ switch( eTokenType )
+/*N*/ {
+/*N*/ case TOKEN_ENTRY_NO:
+/*N*/ sRet.AssignAscii( SwForm::aFormEntryNum );
+/*N*/ break;
+/*N*/ case TOKEN_ENTRY_TEXT:
+/*N*/ sRet.AssignAscii( SwForm::aFormEntryTxt );
+/*N*/ break;
+/*N*/ case TOKEN_ENTRY:
+/*N*/ sRet.AssignAscii( SwForm::aFormEntry );
+/*N*/ break;
+/*N*/ case TOKEN_TAB_STOP:
+/*N*/ sRet.AssignAscii( SwForm::aFormTab );
+/*N*/ break;
+/*N*/ case TOKEN_TEXT:
+/*?*/ sRet.AssignAscii( SwForm::aFormText );
+/*?*/ break;
+/*N*/ case TOKEN_PAGE_NUMS:
+/*N*/ sRet.AssignAscii( SwForm::aFormPageNums );
+/*N*/ break;
+/*N*/ case TOKEN_CHAPTER_INFO:
+/*?*/ sRet.AssignAscii( SwForm::aFormChapterMark );
+/*?*/ break;
+/*N*/ case TOKEN_LINK_START:
+/*N*/ sRet.AssignAscii( SwForm::aFormLinkStt );
+/*N*/ break;
+/*N*/ case TOKEN_LINK_END:
+/*N*/ sRet.AssignAscii( SwForm::aFormLinkEnd );
+/*N*/ break;
+/*N*/ case TOKEN_AUTHORITY:
+/*N*/ {
+/*?*/ sRet.AssignAscii( SwForm::aFormAuth );
+/*?*/ String sTmp( String::CreateFromInt32( nAuthorityField ));
+/*?*/ if( sTmp.Len() < 2 )
+/*?*/ sTmp.Insert('0', 0);
+/*?*/ sRet.Insert( sTmp, 2 );
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ sRet.Erase( sRet.Len() - 1 );
+/*N*/ sRet += ' ';
+/*N*/ sRet += sCharStyleName;
+/*N*/ sRet += ',';
+/*N*/ sRet += String::CreateFromInt32( nPoolId );
+/*N*/ sRet += ',';
+/*N*/
+/*N*/ // TabStopPosition and TabAlign or ChapterInfoFormat
+/*N*/ if(TOKEN_TAB_STOP == eTokenType)
+/*N*/ {
+/*N*/ sRet += String::CreateFromInt32( nTabStopPosition );
+/*N*/ sRet += ',';
+/*N*/ sRet += String::CreateFromInt32( eTabAlign );
+/*N*/ sRet += ',';
+/*N*/ sRet += cTabFillChar;
+/*N*/ }
+/*N*/ else if(TOKEN_CHAPTER_INFO == eTokenType)
+/*N*/ {
+/*?*/ sRet += String::CreateFromInt32( nChapterFormat );
+/*N*/ }
+/*N*/ else if(TOKEN_TEXT == eTokenType)
+/*N*/ {
+/*?*/ //append Text if Len() > 0 only!
+/*?*/ if( sText.Len() )
+/*?*/ {
+/*?*/ sRet += TOX_STYLE_DELIMITER;
+/*?*/ String sTmp( sText );
+/*?*/ sTmp.EraseAllChars( TOX_STYLE_DELIMITER );
+/*?*/ sRet += sTmp;
+/*?*/ sRet += TOX_STYLE_DELIMITER;
+/*?*/ }
+/*?*/ else
+/*?*/ bAppend = FALSE;
+/*N*/ }
+/*N*/ if(bAppend)
+/*N*/ {
+/*N*/ sRet += '>';
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // don't append empty text tokens
+/*?*/ sRet.Erase();
+/*N*/ }
+/*N*/
+/*N*/ return sRet;
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/tox/sw_toxhlp.cxx b/binfilter/bf_sw/source/core/tox/sw_toxhlp.cxx
new file mode 100644
index 000000000000..2a5f00f42660
--- /dev/null
+++ b/binfilter/bf_sw/source/core/tox/sw_toxhlp.cxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
+#include <tools/string.hxx>
+#include <tools/debug.hxx>
+
+#include <toxwrap.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+namespace binfilter {
+
+ IndexEntrySupplierWrapper::IndexEntrySupplierWrapper()
+ {
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory > rxMSF =
+ ::legacy_binfilters::getLegacyProcessServiceFactory();
+
+ try {
+ STAR_REFERENCE( uno::XInterface ) xI =
+ rxMSF->createInstance( ::rtl::OUString::createFromAscii(
+ "com.sun.star.i18n.IndexEntrySupplier" ) );
+ if( xI.is() )
+ {
+ UNO_NMSPC::Any x = xI->queryInterface( ::getCppuType(
+ (const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedIndexEntrySupplier>*)0) );
+ x >>= xIES;
+ }
+ }
+ catch ( UNO_NMSPC::Exception& e )
+ {
+ #ifdef DBG_UTIL
+ ByteString aMsg( "IndexEntrySupplierWrapper: Exception caught\n" );
+ aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
+ DBG_ERRORFILE( aMsg.GetBuffer() );
+ #endif
+ }
+ }
+
+ IndexEntrySupplierWrapper::~IndexEntrySupplierWrapper()
+ {
+ }
+
+ STAR_NMSPC::uno::Sequence< ::rtl::OUString >
+ IndexEntrySupplierWrapper::GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLcl ) const
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > sRet;
+
+ try {
+ sRet = xIES->getAlgorithmList( rLcl );
+ }
+ catch ( UNO_NMSPC::Exception& e )
+ {
+ #ifdef DBG_UTIL
+ ByteString aMsg( "getAlgorithmList: Exception caught\n" );
+ aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
+ DBG_ERRORFILE( aMsg.GetBuffer() );
+ #endif
+ }
+ return sRet;
+ }
+
+ sal_Bool IndexEntrySupplierWrapper::LoadAlgorithm(
+ const STAR_NMSPC::lang::Locale& rLcl,
+ const String& sSortAlgorithm, long nOptions ) const
+ {
+ sal_Bool bRet = sal_False;
+ try {
+ bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions );
+ }
+ catch ( UNO_NMSPC::Exception& e )
+ {
+ #ifdef DBG_UTIL
+ ByteString aMsg( "loadAlgorithm: Exception caught\n" );
+ aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
+ DBG_ERRORFILE( aMsg.GetBuffer() );
+ #endif
+ }
+ return bRet;
+ }
+
+ sal_Int16 IndexEntrySupplierWrapper::CompareIndexEntry(
+ const String& rTxt1, const String& rTxtReading1,
+ const STAR_NMSPC::lang::Locale& rLocale1,
+ const String& rTxt2, const String& rTxtReading2,
+ const STAR_NMSPC::lang::Locale& rLocale2 ) const
+ {
+ sal_Int16 nRet = 0;
+ try {
+ nRet = xIES->compareIndexEntry( rTxt1, rTxtReading1, rLocale1,
+ rTxt2, rTxtReading2, rLocale2 );
+ }
+ catch ( UNO_NMSPC::Exception& e )
+ {
+ #ifdef DBG_UTIL
+ ByteString aMsg( "compareIndexEntry: Exception caught\n" );
+ aMsg += ByteString( String( e.Message ), RTL_TEXTENCODING_UTF8 );
+ DBG_ERRORFILE( aMsg.GetBuffer() );
+ #endif
+ }
+ return nRet;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/tox/sw_txmsrt.cxx b/binfilter/bf_sw/source/core/tox/sw_txmsrt.cxx
new file mode 100644
index 000000000000..660a206d513d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/tox/sw_txmsrt.cxx
@@ -0,0 +1,500 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <unotools/charclass.hxx>
+#include <com/sun/star/i18n/CollatorOptions.hpp>
+#include <bf_svx/unolingu.hxx>
+
+#include <txtfld.hxx>
+
+#include <horiornt.hxx>
+
+#include <cntfrm.hxx>
+#include <pam.hxx>
+#include <txttxmrk.hxx>
+#include <fmtfld.hxx>
+#include <txmsrt.hxx>
+#include <ndtxt.hxx>
+#include <expfld.hxx>
+#include <authfld.hxx>
+#include <toxwrap.hxx>
+
+#include <comcore.hrc>
+namespace binfilter {
+
+extern BOOL IsFrameBehind( const SwTxtNode& rMyNd, xub_StrLen nMySttPos,
+ const SwTxtNode& rBehindNd, xub_StrLen nSttPos );
+
+using namespace ::com::sun::star::uno;
+using namespace ::rtl;
+/*--------------------------------------------------------------------
+ Beschreibung: Strings initialisieren
+ --------------------------------------------------------------------*/
+
+
+SV_IMPL_VARARR( SwTOXSources, SwTOXSource )
+
+
+SwTOXInternational::SwTOXInternational( LanguageType nLang, USHORT nOpt,
+ const String& rSortAlgorithm ) :
+ eLang( nLang ),
+ sSortAlgorithm(rSortAlgorithm),
+ nOptions( nOpt )
+{
+ Init();
+}
+
+ SwTOXInternational::SwTOXInternational( const SwTOXInternational& rIntl ) :
+ eLang( rIntl.eLang ),
+ sSortAlgorithm(rIntl.sSortAlgorithm),
+ nOptions( rIntl.nOptions )
+ {
+ Init();
+ }
+
+ void SwTOXInternational::Init()
+ {
+ pIndexWrapper = new IndexEntrySupplierWrapper();
+
+ const ::com::sun::star::lang::Locale aLcl( SvxCreateLocale( eLang ) );
+ pIndexWrapper->SetLocale( aLcl );
+
+ if(!sSortAlgorithm.Len())
+ {
+ Sequence < OUString > aSeq( pIndexWrapper->GetAlgorithmList( aLcl ));
+ if(aSeq.getLength())
+ sSortAlgorithm = aSeq.getConstArray()[0];
+ }
+
+ if ( nOptions & TOI_CASE_SENSITIVE )
+ pIndexWrapper->LoadAlgorithm( aLcl, sSortAlgorithm, 0 );
+ else
+ pIndexWrapper->LoadAlgorithm( aLcl, sSortAlgorithm, SW_COLLATOR_IGNORES );
+
+ pCharClass = new CharClass( aLcl );
+
+ }
+
+ SwTOXInternational::~SwTOXInternational()
+ {
+ delete pCharClass;
+ delete pIndexWrapper;
+ }
+
+inline BOOL SwTOXInternational::IsNumeric( const String& rStr ) const
+{
+ return pCharClass->isNumeric( rStr );
+}
+
+sal_Int32 SwTOXInternational::Compare( const String& rTxt1, const String& rTxtReading1,
+ const ::com::sun::star::lang::Locale& rLocale1,
+ const String& rTxt2, const String& rTxtReading2,
+ const ::com::sun::star::lang::Locale& rLocale2 ) const
+{
+ return pIndexWrapper->CompareIndexEntry( rTxt1, rTxtReading1, rLocale1,
+ rTxt2, rTxtReading2, rLocale2 );
+}
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: SortierElement fuer Verzeichniseintraege
+ --------------------------------------------------------------------*/
+
+
+SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwCntntNode* pNd,
+ const SwTxtTOXMark* pMark,
+ const SwTOXInternational* pInter,
+ const ::com::sun::star::lang::Locale* pLocale )
+ : pTxtMark( pMark ), pTOXNd( 0 ), nPos( 0 ), nType( nTyp ),
+ pTOXIntl( pInter ), bValidTxt( FALSE ), nCntPos( 0 )
+{
+ if ( pLocale )
+ aLocale = *pLocale;
+
+ if( pNd )
+ {
+ xub_StrLen n = 0;
+ if( pTxtMark )
+ n = *pTxtMark->GetStart();
+ SwTOXSource aTmp( pNd, n,
+ pTxtMark ? pTxtMark->GetTOXMark().IsMainEntry() : FALSE );
+ aTOXSources.Insert( aTmp, aTOXSources.Count() );
+
+ nPos = pNd->GetIndex();
+
+ switch( nTyp )
+ {
+ case TOX_SORT_CONTENT:
+ case TOX_SORT_PARA:
+ case TOX_SORT_TABLE:
+ // falls sie in Sonderbereichen stehen, sollte man die
+ // Position im Body besorgen
+ if( nPos < pNd->GetNodes().GetEndOfExtras().GetIndex() )
+ {
+ // dann die "Anker" (Body) Position holen.
+ Point aPt;
+ const SwCntntFrm* pFrm = pNd->GetFrm( &aPt, 0, FALSE );
+ if( pFrm )
+ {
+ SwPosition aPos( *pNd );
+ const SwDoc& rDoc = *pNd->GetDoc();
+#ifdef DBG_UTIL
+ ASSERT( GetBodyTxtNode( rDoc, aPos, *pFrm ),
+ "wo steht der Absatz" );
+#else
+ GetBodyTxtNode( rDoc, aPos, *pFrm );
+#endif
+ nPos = aPos.nNode.GetIndex();
+ nCntPos = aPos.nContent.GetIndex();
+ }
+ }
+ else
+ nCntPos = n;
+ break;
+ }
+ }
+}
+
+
+String SwTOXSortTabBase::GetURL() const
+{
+ return aEmptyStr;
+}
+
+void SwTOXSortTabBase::FillText( SwTxtNode& rNd, const SwIndex& rInsPos,
+ USHORT ) const
+{
+ String sMyTxt;
+ String sMyTxtReading;
+
+ GetTxt( sMyTxt, sMyTxtReading );
+
+ rNd.Insert( sMyTxt, rInsPos );
+}
+
+BOOL SwTOXSortTabBase::operator==( const SwTOXSortTabBase& rCmp )
+{
+ BOOL bRet = nPos == rCmp.nPos && nCntPos == rCmp.nCntPos &&
+ (!aTOXSources[0].pNd || !rCmp.aTOXSources[0].pNd ||
+ aTOXSources[0].pNd == rCmp.aTOXSources[0].pNd );
+
+ if( TOX_SORT_CONTENT == nType )
+ {
+ bRet = bRet && pTxtMark && rCmp.pTxtMark &&
+ *pTxtMark->GetStart() == *rCmp.pTxtMark->GetStart();
+
+ if( bRet )
+ {
+ // beide Pointer vorhanden -> vergleiche Text
+ // beide Pointer nicht vorhanden -> vergleiche AlternativText
+ const xub_StrLen *pEnd = pTxtMark->GetEnd(),
+ *pEndCmp = rCmp.pTxtMark->GetEnd();
+
+ String sMyTxt;
+ String sMyTxtReading;
+ GetTxt( sMyTxt, sMyTxtReading );
+
+ String sOtherTxt;
+ String sOtherTxtReading;
+ rCmp.GetTxt( sOtherTxt, sOtherTxtReading );
+
+ bRet = ( ( pEnd && pEndCmp ) || ( !pEnd && !pEndCmp ) ) &&
+ pTOXIntl->IsEqual( sMyTxt, sMyTxtReading, GetLocale(),
+ sOtherTxt, sOtherTxtReading, rCmp.GetLocale() );
+ }
+ }
+ return bRet;
+}
+
+BOOL SwTOXSortTabBase::operator<( const SwTOXSortTabBase& rCmp )
+{
+ if( nPos < rCmp.nPos )
+ return TRUE;
+
+ if( nPos == rCmp.nPos )
+ {
+ if( nCntPos < rCmp.nCntPos )
+ return TRUE;
+
+ if( nCntPos == rCmp.nCntPos )
+ {
+ const SwNode* pFirst = aTOXSources[0].pNd;
+ const SwNode* pNext = rCmp.aTOXSources[0].pNd;
+
+ if( pFirst && pFirst == pNext )
+ {
+ if( TOX_SORT_CONTENT == nType && pTxtMark && rCmp.pTxtMark )
+ {
+ if( *pTxtMark->GetStart() < *rCmp.pTxtMark->GetStart() )
+ return TRUE;
+
+ if( *pTxtMark->GetStart() == *rCmp.pTxtMark->GetStart() )
+ {
+ const xub_StrLen *pEnd = pTxtMark->GetEnd(),
+ *pEndCmp = rCmp.pTxtMark->GetEnd();
+
+ String sMyTxt;
+ String sMyTxtReading;
+ GetTxt( sMyTxt, sMyTxtReading );
+
+ String sOtherTxt;
+ String sOtherTxtReading;
+ rCmp.GetTxt( sOtherTxt, sOtherTxtReading );
+
+ // beide Pointer vorhanden -> vergleiche Text
+ // beide Pointer nicht vorhanden -> vergleiche AlternativText
+ if( ( pEnd && pEndCmp ) || ( !pEnd && !pEndCmp ) )
+ pTOXIntl->IsEqual( sMyTxt, sMyTxtReading, GetLocale(),
+ sOtherTxt, sOtherTxtReading, rCmp.GetLocale() );
+
+ if( pEnd && !pEndCmp )
+ return TRUE;
+ }
+ }
+ }
+ else if( pFirst && pFirst->IsTxtNode() &&
+ pNext && pNext->IsTxtNode() )
+ return ::binfilter::IsFrameBehind( *(SwTxtNode*)pNext, nCntPos,
+ *(SwTxtNode*)pFirst, nCntPos );
+ }
+ }
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: sortierter Stichworteintrag
+ --------------------------------------------------------------------*/
+
+
+
+//
+// Stichworte vergleichen. Bezieht sich nur auf den Text
+//
+
+
+
+//
+// kleiner haengt nur vom Text ab
+
+
+//
+
+
+//
+// Das Stichwort selbst
+
+
+//
+
+
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schluessel und Trennzeichen
+ --------------------------------------------------------------------*/
+
+
+
+
+
+
+
+
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: sortierter Inhaltsverz. Eintrag
+ --------------------------------------------------------------------*/
+
+
+
+
+// Der Text des Inhalts
+//
+
+
+
+//
+// Die Ebene fuer Anzeige
+//
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis aus Absaetzen zusammengesammelt
+ --------------------------------------------------------------------*/
+
+// bei Sortierung von OLE/Grafiken aufpassen !!!
+// Die Position darf nicht die im Dokument,
+// sondern muss die vom "Henkel" sein !!
+
+
+
+
+
+
+
+
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabelle
+ --------------------------------------------------------------------*/
+
+
+
+
+
+
+
+/*-- 15.09.99 14:28:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+SwTOXAuthority::SwTOXAuthority( const SwCntntNode& rNd,
+ SwFmtFld& rField, const SwTOXInternational& rIntl ) :
+ SwTOXSortTabBase( TOX_SORT_AUTHORITY, &rNd, 0, &rIntl ),
+ m_rField(rField)
+{
+ if(rField.GetTxtFld())
+ nCntPos = *rField.GetTxtFld()->GetStart();
+}
+
+USHORT SwTOXAuthority::GetLevel() const
+{
+ String sText(((SwAuthorityField*)m_rField.GetFld())->
+ GetFieldText(AUTH_FIELD_AUTHORITY_TYPE));
+ USHORT nRet = 0;
+ if( pTOXIntl->IsNumeric( sText ) )
+ {
+ nRet = (USHORT)sText.ToInt32();
+ nRet++;
+ }
+ if(nRet >= AUTH_TYPE_END)
+ nRet = 0;
+ return nRet;
+ }
+/*-- 15.09.99 14:28:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTOXAuthority::_GetText( String& rTxt, String& rTxtReading )
+{
+ //
+ rTxt = m_rField.GetFld()->Expand();
+}
+
+/* -----------------21.09.99 12:50-------------------
+
+ --------------------------------------------------*/
+void SwTOXAuthority::FillText( SwTxtNode& rNd,
+ const SwIndex& rInsPos, USHORT nAuthField ) const
+{
+ SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetFld();
+ String sText;
+ if(AUTH_FIELD_IDENTIFIER == nAuthField)
+ {
+ sText = pField->Expand();
+ const SwAuthorityFieldType* pType = (const SwAuthorityFieldType*)pField->GetTyp();
+ sal_Unicode cChar = pType->GetPrefix();
+ if(cChar && cChar != ' ')
+ sText.Erase(0, 1);
+ cChar = pType->GetSuffix();
+ if(cChar && cChar != ' ')
+ sText.Erase(sText.Len() - 1, 1);
+ }
+ else if(AUTH_FIELD_AUTHORITY_TYPE == nAuthField)
+ {
+ USHORT nLevel = GetLevel();
+ if(nLevel)
+ sText = SwAuthorityFieldType::GetAuthTypeName((ToxAuthorityType) --nLevel);
+ }
+ else
+ sText = (pField->GetFieldText((ToxAuthorityField) nAuthField));
+ rNd.Insert( sText, rInsPos );
+}
+/* -----------------14.10.99 09:35-------------------
+
+ --------------------------------------------------*/
+BOOL SwTOXAuthority::operator==( const SwTOXSortTabBase& rCmp)
+{
+ return nType == rCmp.nType &&
+ ((SwAuthorityField*)m_rField.GetFld())->GetHandle() ==
+ ((SwAuthorityField*)((SwTOXAuthority&)rCmp).m_rField.GetFld())->GetHandle();
+}
+/* -----------------21.10.99 09:52-------------------
+
+ --------------------------------------------------*/
+BOOL SwTOXAuthority::operator<( const SwTOXSortTabBase& rBase)
+{
+ BOOL bRet = FALSE;
+ SwAuthorityField* pField = (SwAuthorityField*)m_rField.GetFld();
+ SwAuthorityFieldType* pType = (SwAuthorityFieldType*)
+ pField->GetTyp();
+ if(pType->IsSortByDocument())
+ bRet = SwTOXSortTabBase::operator<(rBase);
+ else
+ {
+ SwAuthorityField* pCmpField = (SwAuthorityField*)
+ ((SwTOXAuthority&)rBase).m_rField.GetFld();
+
+
+ for(USHORT i = 0; i < pType->GetSortKeyCount(); i++)
+ {
+ const SwTOXSortKey* pKey = pType->GetSortKey(i);
+ String sMyTxt = pField->GetFieldText(pKey->eField);
+ String sMyTxtReading;
+ String sOtherTxt = pCmpField->GetFieldText(pKey->eField);
+ String sOtherTxtReading;
+
+ sal_Int32 nComp = pTOXIntl->Compare( sMyTxt, sMyTxtReading, GetLocale(),
+ sOtherTxt, sOtherTxtReading, rBase.GetLocale() );
+
+ if( nComp )
+ {
+ bRet = (-1 == nComp) == pKey->bSortAscending;
+ break;
+ }
+ }
+ }
+ return bRet;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/makefile.mk b/binfilter/bf_sw/source/core/txtnode/makefile.mk
new file mode 100644
index 000000000000..954f3a742126
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/makefile.mk
@@ -0,0 +1,84 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_txtnode
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+.IF "$(GUI)"!="OS2"
+INCEXT=s:$/solar$/inc$/hm
+.ENDIF
+
+.IF "$(mydebug)" != ""
+CDEFS+=-Dmydebug
+.ENDIF
+
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/sw_atrfld.obj \
+ $(SLO)$/sw_atrflyin.obj \
+ $(SLO)$/sw_atrftn.obj \
+ $(SLO)$/sw_atrref.obj \
+ $(SLO)$/sw_atrtox.obj \
+ $(SLO)$/sw_fmtatr1.obj \
+ $(SLO)$/sw_fmtatr2.obj \
+ $(SLO)$/sw_fntcap.obj \
+ $(SLO)$/sw_fntcache.obj \
+ $(SLO)$/sw_swfntcch.obj \
+ $(SLO)$/sw_ndhints.obj \
+ $(SLO)$/sw_ndtxt.obj \
+ $(SLO)$/sw_swfont.obj \
+ $(SLO)$/sw_thints.obj \
+ $(SLO)$/sw_txatbase.obj \
+ $(SLO)$/sw_txtatr2.obj \
+ $(SLO)$/sw_txtedt.obj
+
+.IF "$(dbutil)" != ""
+OFILES+=$(SLO)$/sw_dbchratr.$(QBJX)
+.ENDIF
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_atrfld.cxx b/binfilter/bf_sw/source/core/txtnode/sw_atrfld.cxx
new file mode 100644
index 000000000000..e0f66961d7d3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_atrfld.cxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include "doc.hxx" // Update fuer UserFields
+
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include "reffld.hxx"
+#include "ddefld.hxx"
+#include "usrfld.hxx"
+#include "expfld.hxx"
+#include "ndtxt.hxx" // SwTxtNode
+#include "hints.hxx"
+namespace binfilter {
+
+/*N*/ TYPEINIT2( SwFmtFld, SfxPoolItem, SwClient )
+
+/****************************************************************************
+ *
+ * class SwFmtFld
+ *
+ ****************************************************************************/
+
+ // Konstruktor fuers Default vom Attribut-Pool
+/*N*/ SwFmtFld::SwFmtFld()
+/*N*/ : SfxPoolItem( RES_TXTATR_FIELD ),
+/*N*/ SwClient( 0 ),
+/*N*/ pField( 0 ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFmtFld::SwFmtFld( const SwField &rFld )
+/*N*/ : SfxPoolItem( RES_TXTATR_FIELD ),
+/*N*/ SwClient( rFld.GetTyp() ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ pField = rFld.Copy();
+/*N*/ }
+
+/*N*/ SwFmtFld::SwFmtFld( const SwFmtFld& rAttr )
+/*N*/ : SfxPoolItem( RES_TXTATR_FIELD ),
+/*N*/ SwClient( rAttr.GetFld()->GetTyp() ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ pField = rAttr.GetFld()->Copy();
+/*N*/ }
+
+/*N*/ SwFmtFld::~SwFmtFld()
+/*N*/ {
+/*N*/ SwFieldType* pType = pField ? pField->GetTyp() : 0;
+/*N*/
+/*N*/ if (pType && pType->Which() == RES_DBFLD)
+/*N*/ pType = 0; // DB-Feldtypen zerstoeren sich selbst
+/*N*/
+/*N*/ delete pField;
+/*N*/
+/*N*/ // bei einige FeldTypen muessen wir den FeldTypen noch loeschen
+/*N*/ if( pType && pType->IsLastDepend() )
+/*N*/ {
+/*N*/ BOOL bDel = FALSE;
+/*N*/ switch( pType->Which() )
+/*N*/ {
+/*N*/ case RES_USERFLD:
+/*N*/ bDel = ((SwUserFieldType*)pType)->IsDeleted();
+/*N*/ break;
+/*N*/
+/*N*/ case RES_SETEXPFLD:
+/*N*/ bDel = ((SwSetExpFieldType*)pType)->IsDeleted();
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DDEFLD:
+/*N*/ bDel = ((SwDDEFieldType*)pType)->IsDeleted();
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( bDel )
+/*N*/ {
+/*N*/ // vorm loeschen erstmal austragen
+/*?*/ pType->Remove( this );
+/*?*/ delete pType;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+int SwFmtFld::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_BF_ASSERT(0, "STRIP"); return 0; //STRIP001 ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+}
+
+/*N*/ SfxPoolItem* SwFmtFld::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwFmtFld( *this );
+/*N*/ }
+
+/*N*/ void SwFmtFld::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ if( !pTxtAttr )
+/*N*/ return;
+/*N*/
+/*N*/ SwTxtNode* pTxtNd = (SwTxtNode*)&pTxtAttr->GetTxtNode();
+/*N*/ ASSERT( pTxtNd, "wo ist denn mein Node?" );
+/*N*/ if( pNew )
+/*N*/ {
+/*N*/ switch( pNew->Which() )
+/*N*/ {
+/*?*/ case RES_TXTATR_FLDCHG:
+/*?*/ // "Farbe hat sich geaendert !"
+/*?*/ // this, this fuer "nur Painten"
+/*?*/ pTxtNd->Modify( this, this );
+/*?*/ return;
+/*?*/ case RES_REFMARKFLD_UPDATE:
+/*?*/ // GetReferenz-Felder aktualisieren
+/*?*/ if( RES_GETREFFLD == GetFld()->GetTyp()->Which() )
+/*?*/ ((SwGetRefField*)GetFld())->UpdateField();
+/*?*/ break;
+/*N*/ case RES_DOCPOS_UPDATE:
+/*N*/ // Je nach DocPos aktualisieren (SwTxtFrm::Modify())
+/*N*/ pTxtNd->Modify( pNew, this );
+/*N*/ return;
+/*N*/
+/*N*/ case RES_ATTRSET_CHG:
+/*N*/ case RES_FMT_CHG:
+/*?*/ pTxtNd->Modify( pOld, pNew );
+/*?*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ switch (GetFld()->GetTyp()->Which())
+/*N*/ {
+/*?*/ case RES_HIDDENPARAFLD:
+/*?*/ if( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() )
+/*?*/ break;
+/*?*/ case RES_DBSETNUMBERFLD:
+/*?*/ case RES_DBNUMSETFLD:
+/*?*/ case RES_DBNEXTSETFLD:
+/*?*/ case RES_DBNAMEFLD:
+/*?*/ pTxtNd->Modify( 0, pNew);
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ if( RES_USERFLD == GetFld()->GetTyp()->Which() )
+/*N*/ {
+/*?*/ SwUserFieldType* pType = (SwUserFieldType*)GetFld()->GetTyp();
+/*?*/ if(!pType->IsValid())
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwCalc aCalc( *pTxtNd->GetDoc() );
+/*?*/ }
+/*N*/ }
+/*N*/ pTxtAttr->Expand();
+/*N*/ }
+
+/*N*/ BOOL SwFmtFld::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ const SwTxtNode* pTxtNd;
+/*N*/ if( RES_AUTOFMT_DOCNODE != rInfo.Which() ||
+/*N*/ !pTxtAttr || 0 == ( pTxtNd = pTxtAttr->GetpTxtNode() ) ||
+/*N*/ &pTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = pTxtNd;
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/*N*/ BOOL SwFmtFld::IsFldInDoc() const
+/*N*/ {
+/*N*/ const SwTxtNode* pTxtNd;
+/*N*/ return pTxtAttr && 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
+/*N*/ pTxtNd->GetNodes().IsDocNodes();
+/*N*/ }
+
+
+/*************************************************************************
+|*
+|* SwTxtFld::SwTxtFld()
+|*
+|* Beschreibung Attribut fuer automatischen Text, Ctor
+|* Ersterstellung BP 30.04.92
+|* Letzte Aenderung JP 15.08.94
+|*
+*************************************************************************/
+
+/*N*/ SwTxtFld::SwTxtFld( const SwFmtFld& rAttr, xub_StrLen nStart )
+/*N*/ : SwTxtAttr( rAttr, nStart ),
+/*N*/ aExpand( rAttr.GetFld()->Expand() ),
+/*N*/ pMyTxtNd( 0 )
+/*N*/ {
+/*N*/ ((SwFmtFld&)rAttr).pTxtAttr = this;
+/*N*/ }
+
+/*N*/ SwTxtFld::~SwTxtFld( )
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwTxtFld::Expand()
+|*
+|* Beschreibung exandiert das Feld und tauscht den Text im Node
+|* Ersterstellung BP 30.04.92
+|* Letzte Aenderung JP 15.08.94
+|*
+*************************************************************************/
+
+/*N*/ void SwTxtFld::Expand()
+/*N*/ {
+/*N*/ // Wenn das expandierte Feld sich nicht veraendert hat, wird returnt
+/*N*/ ASSERT( pMyTxtNd, "wo ist denn mein Node?" );
+/*N*/
+/*N*/ const SwField* pFld = GetFld().GetFld();
+/*N*/ XubString aNewExpand( pFld->Expand() );
+/*N*/
+/*N*/ if( aNewExpand == aExpand )
+/*N*/ {
+/*N*/ // Bei Seitennummernfeldern
+/*N*/ const USHORT nWhich = pFld->GetTyp()->Which();
+/*N*/ if( RES_CHAPTERFLD != nWhich && RES_PAGENUMBERFLD != nWhich &&
+/*N*/ RES_REFPAGEGETFLD != nWhich &&
+/*N*/ ( RES_GETEXPFLD != nWhich ||
+/*N*/ ((SwGetExpField*)pFld)->IsInBodyTxt() ) )
+/*N*/ {
+/*N*/ // BP: das muesste man noch optimieren!
+/*N*/ //JP 12.06.97: stimmt, man sollte auf jedenfall eine Status-
+/*N*/ // aenderung an die Frames posten
+/*N*/ if( pMyTxtNd->CalcVisibleFlag() )
+/*?*/ pMyTxtNd->Modify( 0, 0 );
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ aExpand = aNewExpand;
+/*N*/
+/*N*/ // 0, this fuer Formatieren
+/*N*/ pMyTxtNd->Modify( 0, (SfxPoolItem*)&GetFld() );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFld::CopyFld()
+ *************************************************************************/
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_atrflyin.cxx b/binfilter/bf_sw/source/core/txtnode/sw_atrflyin.cxx
new file mode 100644
index 000000000000..791a7ed02bd7
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_atrflyin.cxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "cntfrm.hxx" // _GetFly
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "pam.hxx" // fuer SwTxtFlyCnt
+#include "ndtxt.hxx" // SwFlyFrmFmt
+#include "frmfmt.hxx" // SwFlyFrmFmt
+
+#include <fmtflcnt.hxx>
+#include <txtflcnt.hxx>
+#include <fmtanchr.hxx>
+#include "txtfrm.hxx"
+#include "flyfrms.hxx"
+namespace binfilter {
+
+/*N*/ SwFmtFlyCnt::SwFmtFlyCnt( SwFrmFmt *pFrmFmt )
+/*N*/ : SfxPoolItem( RES_TXTATR_FLYCNT ),
+/*N*/ pFmt( pFrmFmt ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ }
+
+int __EXPORT SwFmtFlyCnt::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_BF_ASSERT(0, "STRIP"); return 0; //STRIP001 ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+}
+
+/*N*/ SfxPoolItem* __EXPORT SwFmtFlyCnt::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwFmtFlyCnt( pFmt );
+/*N*/ }
+
+/*N*/ SwTxtFlyCnt::SwTxtFlyCnt( const SwFmtFlyCnt& rAttr, xub_StrLen nStart )
+/*N*/ : SwTxtAttr( rAttr, nStart )
+/*N*/ {
+/*N*/ ((SwFmtFlyCnt&)rAttr).pTxtAttr = this;
+/*N*/ }
+
+
+
+/*************************************************************************
+ * SwTxtFlyCnt::MakeTxtHint()
+ *
+ * An dieser Stelle soll einmal der Gesamtzusammenhang bei der Erzeugung
+ * eines neuen SwTxtFlyCnt erlaeutert werden.
+ * Das MakeTxtHint() wird z.B. im SwTxtNode::Copy() gerufen.
+ * Fuer die komplette Verdopplung sind folgende Schritte notwendig:
+ * 1) Duplizieren des pFmt incl. Inhalt, Attributen etc.
+ * 2) Setzen des Ankers
+ * 3) Benachrichtigung
+ * Da fuer die Bewaeltigung der Aufgaben nicht immer alle Informationen
+ * bereitstehen und darueber hinaus bestimmte Methoden erst zu einem
+ * spaeteren Zeitpunkt gerufen werden duerfen (weil nocht nicht alle
+ * Nodeinformationen vorliegen), verteilt sich der Ablauf.
+ * ad 1) MakeTxtHint() wird durch den Aufruf von SwDoc::CopyLayout()
+ * der das neue FlyFrmFmt erzeugt und mit dem duplizierten Inhalt des
+ * FlyFrm verbunden.
+ * ad 2) SetAnchor() wird von SwTxtNode::Insert() gerufen und sorgt fuer das
+ * setzen des Ankers (die SwPosition des Dummy-Zeichens wird dem FlyFrmFmt
+ * per SetAttr bekannt gegeben). Dies kann nicht im MakeTxtHint erledigt
+ * werden, da der Zielnode unbestimmt ist.
+ * ad 3) _GetFlyFrm() wird im Formatierungsprozess vom LineIter gerufen
+ * und sucht den FlyFrm zum Dummyzeichen des aktuellen CntntFrm. Wird keiner
+ * gefunden, so wird ein neuer FlyFrm angelegt.
+ * Kritisch an diesem Vorgehen ist, dass das pCntnt->AppendFly() eine
+ * sofortige Neuformatierung von pCntnt anstoesst. Die Rekursion kommt
+ * allerdings durch den Lockmechanismus in SwTxtFrm::Format() nicht
+ * zu stande.
+ * Attraktiv ist der Umstand, dass niemand ueber die vom Node abhaengigen
+ * CntntFrms iterieren braucht, um die FlyInCntFrm anzulegen. Dies geschieht
+ * bei der Arbeit.
+ *************************************************************************/
+
+/*N*/ void SwTxtFlyCnt::CopyFlyFmt( SwDoc* pDoc )
+/*N*/ {
+/*N*/ SwFrmFmt* pFmt = GetFlyCnt().GetFrmFmt();
+/*N*/ ASSERT( pFmt, "von welchem Format soll ich eine Kopie erzeugen?" )
+/*N*/ // Das FlyFrmFmt muss dupliziert werden.
+/*N*/ // In CopyLayoutFmt (siehe doclay.cxx) wird das FlyFrmFmt erzeugt
+/*N*/ // und der Inhalt dupliziert.
+/*N*/
+/*N*/ // fuers kopieren vom Attribut das Undo immer abschalten
+/*N*/ SwFmtAnchor aAnchor( pFmt->GetAnchor() );
+/*N*/ if( FLY_PAGE != aAnchor.GetAnchorId() &&
+/*N*/ pDoc != pFmt->GetDoc() ) // Unterschiedliche Docs?
+/*N*/ {
+/*N*/ // JP 03.06.96: dann sorge dafuer, das der koperierte Anker auf
+/*N*/ // gueltigen Content zeigt! Die Umsetzung auf die
+/*N*/ // richtige Position erfolgt spaeter.
+/*?*/ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), +2 );
+/*?*/ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
+/*?*/ if( !pCNd )
+/*?*/ pCNd = pDoc->GetNodes().GoNext( &aIdx );
+/*?*/
+/*?*/ SwPosition* pPos = (SwPosition*)aAnchor.GetCntntAnchor();
+/*?*/ pPos->nNode = aIdx;
+/*?*/ if( FLY_IN_CNTNT == aAnchor.GetAnchorId() )
+/*?*/ pPos->nContent.Assign( pCNd, 0 );
+/*?*/ else
+/*?*/ {
+/*?*/ pPos->nContent.Assign( 0, 0 );
+/*?*/ ASSERT( !this, "CopyFlyFmt: Was fuer ein Anker?" );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwFrmFmt* pNew = pDoc->CopyLayoutFmt( *pFmt, aAnchor, FALSE, FALSE );
+/*N*/ ((SwFmtFlyCnt&)GetFlyCnt()).SetFlyFmt( pNew );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFlyCnt::SetAnchor()
+ *
+ * SetAnchor() wird von SwTxtNode::Insert() gerufen und sorgt fuer das
+ * setzen des Ankers (die SwPosition des Dummy-Zeichens wird dem FlyFrmFmt
+ * per SetAttr bekannt gegeben). Dies kann nicht im MakeTxtHint erledigt
+ * werden, da der Zielnode unbestimmt ist.
+ * (siehe Kommentar in SwTxtFlyCnt::MakeTxtHint)
+ *************************************************************************/
+
+/*N*/ void SwTxtFlyCnt::SetAnchor( const SwTxtNode *pNode )
+/*N*/ {
+/*N*/ // Wir ermitteln den Index im Nodesarray zum Node
+/*N*/
+/*N*/ SwDoc* pDoc = (SwDoc*)pNode->GetDoc();
+/*N*/
+/*N*/ SwIndex aIdx( (SwTxtNode*)pNode, *GetStart() );
+/*N*/ SwPosition aPos( *pNode->StartOfSectionNode(), aIdx );
+/*N*/ SwFrmFmt* pFmt = GetFlyCnt().GetFrmFmt();
+/*N*/ SwFmtAnchor aAnchor( pFmt->GetAnchor() );
+/*N*/
+/*N*/ if( !aAnchor.GetCntntAnchor() ||
+/*N*/ !aAnchor.GetCntntAnchor()->nNode.GetNode().GetNodes().IsDocNodes() ||
+/*N*/ &aAnchor.GetCntntAnchor()->nNode.GetNode() != (SwNode*)pNode )
+/*N*/ aPos.nNode = *pNode;
+/*N*/ else
+/*N*/ aPos.nNode = aAnchor.GetCntntAnchor()->nNode;
+/*N*/
+/*N*/ aAnchor.SetType( FLY_IN_CNTNT ); // defaulten !!
+/*N*/ aAnchor.SetAnchor( &aPos );
+/*N*/
+/*N*/ // beim Ankerwechsel werden immer alle FlyFrms vom Attribut geloescht
+/*N*/ // JP 25.04.95: wird innerhalb des SplitNodes die Frames verschoben
+/*N*/ // koennen die Frames erhalten bleiben.
+/*N*/ if( ( !pNode->GetpSwpHints() || !pNode->GetpSwpHints()->IsInSplitNode() )
+/*N*/ && RES_DRAWFRMFMT != pFmt->Which() )
+/*N*/ pFmt->DelFrms();
+/*N*/
+/*N*/ // stehen wir noch im falschen Dokument ?
+/*N*/ if( pDoc != pFmt->GetDoc() )
+/*N*/ {
+/*?*/ SwFrmFmt* pNew = pDoc->CopyLayoutFmt( *pFmt, aAnchor, FALSE, FALSE );
+/*?*/
+/*?*/ pFmt->GetDoc()->DelLayoutFmt( pFmt );
+/*?*/ ((SwFmtFlyCnt&)GetFlyCnt()).SetFlyFmt( pNew );
+/*N*/ }
+/*N*/ else if( pNode->GetpSwpHints() &&
+/*N*/ pNode->GetpSwpHints()->IsInSplitNode() &&
+/*N*/ RES_DRAWFRMFMT != pFmt->Which() )
+/*N*/ {
+/*?*/ pFmt->LockModify();
+/*?*/ pFmt->SetAttr( aAnchor ); // nur den Anker neu setzen
+/*?*/ pFmt->UnlockModify();
+/*N*/ }
+/*N*/ else
+/*N*/ pFmt->SetAttr( aAnchor ); // nur den Anker neu setzen
+/*N*/
+/*N*/ // Am Node haengen u.a. abhaengige CntFrms.
+/*N*/ // Fuer jeden CntFrm wird ein SwFlyInCntFrm angelegt.
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtFlyCnt::_GetFlyFrm()
+ *
+ * _GetFlyFrm() wird im Formatierungsprozess vom LineIter gerufen
+ * und sucht den FlyFrm zum Dummyzeichen des aktuellen CntntFrm. Wird keiner
+ * gefunden, so wird ein neuer FlyFrm angelegt.
+ * (siehe Kommentar ind SwTxtFlyCnt::MakeTxtHint)
+ *************************************************************************/
+
+/*N*/ SwFlyInCntFrm *SwTxtFlyCnt::_GetFlyFrm( const SwFrm *pCurrFrm )
+/*N*/ {
+/*N*/ SwFrmFmt* pFrmFmt = GetFlyCnt().GetFrmFmt();
+/*N*/ if( RES_DRAWFRMFMT == pFrmFmt->Which() )
+/*N*/ {
+/*?*/ ASSERT( !this, "SwTxtFlyCnt::_GetFlyFrm: DrawInCnt-Baustelle!" );
+/*?*/ return NULL;
+/*N*/ }
+/*N*/
+/*N*/ SwClientIter aIter( *GetFlyCnt().pFmt );
+/*N*/ ASSERT( pCurrFrm->IsTxtFrm(), "SwTxtFlyCnt::_GetFlyFrm for TxtFrms only." );
+/*N*/
+/*N*/ if( aIter.GoStart() )
+/*N*/ {
+/*N*/ SwTxtFrm *pFirst = (SwTxtFrm*)pCurrFrm;
+/*N*/ while ( pFirst->IsFollow() )
+/*?*/ pFirst = pFirst->FindMaster();
+/*N*/ do
+/*N*/ { SwFrm * pFrm = PTR_CAST( SwFrm, aIter() );
+/*N*/ if ( pFrm )
+/*N*/ {
+/*N*/ SwTxtFrm *pTmp = pFirst;
+/*N*/ do
+/*N*/ { if( ( (SwFlyFrm*)pFrm )->GetAnchor() == (SwFrm*) pTmp )
+/*N*/ {
+/*N*/ if ( pTmp != pCurrFrm )
+/*N*/ {
+/*?*/ pTmp->RemoveFly( (SwFlyFrm*)pFrm );
+/*?*/ ((SwTxtFrm*)pCurrFrm)->AppendFly( (SwFlyFrm*)pFrm );
+/*N*/ }
+/*N*/ return (SwFlyInCntFrm*)pFrm;
+/*N*/ }
+/*?*/ pTmp = pTmp->GetFollow();
+/*N*/ } while ( pTmp );
+/*N*/ }
+/*N*/ } while( aIter++ );
+/*N*/ }
+/*N*/
+/*N*/ // Wir haben keinen passenden FlyFrm gefunden, deswegen wird ein
+/*N*/ // neuer angelegt.
+/*N*/ // Dabei wird eine sofortige Neuformatierung von pCurrFrm angestossen.
+/*N*/ // Die Rekursion wird durch den Lockmechanismus in SwTxtFrm::Format()
+/*N*/ // abgewuergt.
+/*N*/ SwFlyInCntFrm *pFly = new SwFlyInCntFrm( (SwFlyFrmFmt*)pFrmFmt, (SwFrm*)pCurrFrm );
+/*N*/ ((SwFrm*)pCurrFrm)->AppendFly( pFly );
+/*N*/ pFly->RegistFlys();
+/*N*/
+/*N*/ // 7922: Wir muessen dafuer sorgen, dass der Inhalt des FlyInCnt
+/*N*/ // nach seiner Konstruktion stramm durchformatiert wird.
+/*N*/ SwCntntFrm *pFrm = pFly->ContainsCntnt();
+/*N*/ while( pFrm )
+/*N*/ {
+/*N*/ pFrm->Calc();
+/*N*/ pFrm = pFrm->GetNextCntntFrm();
+/*N*/ }
+/*N*/
+/*N*/ return pFly;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_atrftn.cxx b/binfilter/bf_sw/source/core/txtnode/sw_atrftn.cxx
new file mode 100644
index 000000000000..0043556c3ba5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_atrftn.cxx
@@ -0,0 +1,443 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <cntfrm.hxx> // ASSERT in ~SwTxtFtn()
+#include <pagefrm.hxx> // RemoveFtn()
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <ftnidx.hxx>
+#include <ftninfo.hxx>
+#include <ndtxt.hxx>
+#include <poolfmt.hxx>
+#include <ftnfrm.hxx>
+#include <ndindex.hxx>
+#include <fmtftntx.hxx>
+#include <section.hxx>
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* class SwFmtFtn
+|*
+|* Beschreibung
+|* Ersterstellung JP 09.08.94
+|* Letzte Aenderung JP 08.08.94
+|*
+*************************************************************************/
+
+
+/*N*/ SwFmtFtn::SwFmtFtn( BOOL bEN )
+/*N*/ : SfxPoolItem( RES_TXTATR_FTN ),
+/*N*/ nNumber( 0 ),
+/*N*/ pTxtAttr( 0 ),
+/*N*/ bEndNote( bEN )
+/*N*/ {
+/*N*/ }
+
+
+int SwFmtFtn::operator==( const SfxPoolItem& rAttr ) const
+{
+ {DBG_BF_ASSERT(0, "STRIP");} return 0;//STRIP001 ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+}
+
+
+/*N*/ SfxPoolItem* SwFmtFtn::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ SwFmtFtn* pNew = new SwFmtFtn;
+/*N*/ pNew->aNumber = aNumber;
+/*N*/ pNew->nNumber = nNumber;
+/*N*/ pNew->bEndNote = bEndNote;
+/*N*/ return pNew;
+/*N*/ }
+
+void SwFmtFtn::SetEndNote( BOOL b )
+{
+ if ( b != bEndNote )
+ {
+ if ( GetTxtFtn() )
+ GetTxtFtn()->DelFrms();
+ bEndNote = b;
+ }
+}
+
+/*N*/ SwFmtFtn::~SwFmtFtn()
+/*N*/ {
+/*N*/ }
+
+
+
+ // returnt den anzuzeigenden String der Fuss-/Endnote
+/*N*/ XubString SwFmtFtn::GetViewNumStr( const SwDoc& rDoc, BOOL bInclStrings ) const
+/*N*/ {
+/*N*/ XubString sRet( GetNumStr() );
+/*N*/ if( !sRet.Len() )
+/*N*/ {
+/*N*/ // dann ist die Nummer von Interesse, also ueber die Info diese
+/*N*/ // besorgen.
+/*N*/ BOOL bMakeNum = TRUE;
+/*N*/ const SwSectionNode* pSectNd = pTxtAttr
+/*N*/ ? SwUpdFtnEndNtAtEnd::FindSectNdWithEndAttr( *pTxtAttr )
+/*N*/ : 0;
+/*N*/
+/*N*/ if( pSectNd )
+/*N*/ {
+/*N*/ const SwFmtFtnEndAtTxtEnd& rFtnEnd = (SwFmtFtnEndAtTxtEnd&)
+/*N*/ pSectNd->GetSection().GetFmt()->GetAttr(
+/*?*/ IsEndNote() ? RES_END_AT_TXTEND : RES_FTN_AT_TXTEND );
+/*N*/
+/*N*/ if( FTNEND_ATTXTEND_OWNNUMANDFMT == rFtnEnd.GetValue() )
+/*N*/ {
+/*?*/ bMakeNum = FALSE;
+/*?*/ sRet = rFtnEnd.GetSwNumType().GetNumStr( GetNumber() );
+/*?*/ if( bInclStrings )
+/*?*/ {
+/*?*/ sRet.Insert( rFtnEnd.GetPrefix(), 0 );
+/*?*/ sRet += rFtnEnd.GetSuffix();
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bMakeNum )
+/*N*/ {
+/*N*/ const SwEndNoteInfo* pInfo;
+/*N*/ if( IsEndNote() )
+/*?*/ pInfo = &rDoc.GetEndNoteInfo();
+/*N*/ else
+/*N*/ pInfo = &rDoc.GetFtnInfo();
+/*N*/ sRet = pInfo->aFmt.GetNumStr( GetNumber() );
+/*N*/ if( bInclStrings )
+/*N*/ {
+/*N*/ sRet.Insert( pInfo->GetPrefix(), 0 );
+/*N*/ sRet += pInfo->GetSuffix();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return sRet;
+/*N*/ }
+
+/*************************************************************************
+ * class SwTxt/FmtFnt
+ *************************************************************************/
+
+/*N*/ SwTxtFtn::SwTxtFtn( const SwFmtFtn& rAttr, xub_StrLen nStart )
+/*N*/ : SwTxtAttr( rAttr, nStart ),
+/*N*/ pMyTxtNd( 0 ),
+/*N*/ pStartNode( 0 ),
+/*N*/ nSeqNo( USHRT_MAX )
+/*N*/ {
+/*N*/ ((SwFmtFtn&)rAttr).pTxtAttr = this;
+/*N*/ }
+
+
+/*N*/ SwTxtFtn::~SwTxtFtn()
+/*N*/ {
+/*N*/ SetStartNode( 0 );
+/*N*/ }
+
+
+
+/*N*/ void SwTxtFtn::SetStartNode( const SwNodeIndex *pNewNode, BOOL bDelNode )
+/*N*/ {
+/*N*/ if( pNewNode )
+/*N*/ {
+/*N*/ if( !pStartNode )
+/*N*/ pStartNode = new SwNodeIndex( *pNewNode );
+/*N*/ else
+/*N*/ *pStartNode = *pNewNode;
+/*N*/ }
+/*N*/ else if( pStartNode )
+/*N*/ {
+/*N*/ // Zwei Dinge muessen erledigt werden:
+/*N*/ // 1) Die Fussnoten muessen bei ihren Seiten abgemeldet werden
+/*N*/ // 2) Die Fussnoten-Sektion in den Inserts muss geloescht werden.
+/*N*/ SwDoc* pDoc;
+/*N*/ if( pMyTxtNd )
+/*N*/ pDoc = pMyTxtNd->GetDoc();
+/*N*/ else
+/*N*/ {
+/*N*/ //JP 27.01.97: der sw3-Reader setzt einen StartNode aber das
+/*N*/ // Attribut ist noch nicht im TextNode verankert.
+/*N*/ // Wird es geloescht (z.B. bei Datei einfuegen mit
+/*N*/ // Ftn in einen Rahmen), muss auch der Inhalt
+/*N*/ // geloescht werden
+/*?*/ pDoc = pStartNode->GetNodes().GetDoc();
+/*N*/ }
+/*N*/
+/*N*/ // Wir duerfen die Fussnotennodes nicht loeschen
+/*N*/ // und brauchen die Fussnotenframes nicht loeschen, wenn
+/*N*/ // wir im ~SwDoc() stehen.
+/*N*/ if( !pDoc->IsInDtor() )
+/*N*/ {
+/*?*/ if( bDelNode )
+/*?*/ {
+/*?*/ // 1) Die Section fuer die Fussnote wird beseitigt
+/*?*/ // Es kann sein, dass die Inserts schon geloescht wurden.
+/*?*/ pDoc->DeleteSection( &pStartNode->GetNode() );
+/*?*/ }
+/*?*/ else
+/*?*/ // Werden die Nodes nicht geloescht mussen sie bei den Seiten
+/*?*/ // abmeldet (Frms loeschen) werden, denn sonst bleiben sie
+/*?*/ // stehen (Undo loescht sie nicht!)
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ DelFrms();
+/*N*/ }
+/*N*/ DELETEZ( pStartNode );
+/*N*/
+/*N*/ // loesche die Fussnote noch aus dem Array am Dokument
+/*N*/ for( USHORT n = 0; n < pDoc->GetFtnIdxs().Count(); ++n )
+/*?*/ if( this == pDoc->GetFtnIdxs()[n] )
+/*?*/ {
+/*?*/ pDoc->GetFtnIdxs().Remove( n );
+/*?*/ // gibt noch weitere Fussnoten
+/*?*/ if( !pDoc->IsInDtor() && n < pDoc->GetFtnIdxs().Count() )
+/*?*/ {
+/*?*/ SwNodeIndex aTmp( pDoc->GetFtnIdxs()[n]->GetTxtNode() );
+/*?*/ pDoc->GetFtnIdxs().UpdateFtn( aTmp );
+/*?*/ }
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ void SwTxtFtn::SetNumber( const USHORT nNewNum, const XubString* pStr )
+/*N*/ {
+/*N*/ SwFmtFtn& rFtn = (SwFmtFtn&)GetFtn();
+/*N*/ if( pStr && pStr->Len() )
+/*N*/ rFtn.aNumber = *pStr;
+/*N*/ else
+/*N*/ {
+/*N*/ rFtn.nNumber = nNewNum;
+/*N*/ rFtn.aNumber = aEmptyStr;
+/*N*/ }
+/*N*/
+/*N*/ ASSERT( pMyTxtNd, "wo ist mein TextNode?" );
+/*N*/ SwNodes &rNodes = pMyTxtNd->GetDoc()->GetNodes();
+/*N*/ pMyTxtNd->Modify( 0, &rFtn );
+/*N*/ if( pStartNode )
+/*N*/ {
+/*N*/ // Wir muessen ueber alle TxtNodes iterieren, wegen der
+/*N*/ // Fussnoten, die auf anderen Seiten stehen.
+/*N*/ SwNode* pNd;
+/*N*/ ULONG nSttIdx = pStartNode->GetIndex() + 1,
+/*N*/ nEndIdx = pStartNode->GetNode().EndOfSectionIndex();
+/*N*/ for( ; nSttIdx < nEndIdx; ++nSttIdx )
+/*N*/ {
+/*N*/ // Es koennen ja auch Grafiken in der Fussnote stehen ...
+/*N*/ if( ( pNd = rNodes[ nSttIdx ] )->IsTxtNode() )
+/*N*/ ((SwTxtNode*)pNd)->Modify( 0, &rFtn );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+// Die Fussnoten duplizieren
+
+
+ // lege eine neue leere TextSection fuer diese Fussnote an
+/*N*/ void SwTxtFtn::MakeNewTextSection( SwNodes& rNodes )
+/*N*/ {
+/*N*/ if( pStartNode )
+/*N*/ return;
+/*N*/
+/*N*/ // Nun verpassen wir dem TxtNode noch die Fussnotenvorlage.
+/*N*/ SwTxtFmtColl *pFmtColl;
+/*N*/ const SwEndNoteInfo* pInfo;
+/*N*/ USHORT nPoolId;
+/*N*/
+/*N*/ if( GetFtn().IsEndNote() )
+/*N*/ {
+/*?*/ pInfo = &rNodes.GetDoc()->GetEndNoteInfo();
+/*?*/ nPoolId = RES_POOLCOLL_ENDNOTE;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pInfo = &rNodes.GetDoc()->GetFtnInfo();
+/*N*/ nPoolId = RES_POOLCOLL_FOOTNOTE;
+/*N*/ }
+/*N*/
+/*N*/ if( 0 == (pFmtColl = pInfo->GetFtnTxtColl() ) )
+/*N*/ pFmtColl = rNodes.GetDoc()->GetTxtCollFromPool( nPoolId );
+/*N*/
+/*N*/ SwStartNode* pSttNd = rNodes.MakeTextSection( SwNodeIndex( rNodes.GetEndOfInserts() ),
+/*N*/ SwFootnoteStartNode, pFmtColl );
+/*N*/ pStartNode = new SwNodeIndex( *pSttNd );
+/*N*/ }
+
+
+ void SwTxtFtn::DelFrms()
+ {
+ // loesche die Ftn-Frames aus den Seiten
+ ASSERT( pMyTxtNd, "wo ist mein TextNode?" );
+ if( !pMyTxtNd )
+ return ;
+
+ BOOL bFrmFnd = FALSE;
+ {
+ SwClientIter aIter( *pMyTxtNd );
+ for( SwCntntFrm* pFnd = (SwCntntFrm*)aIter.First( TYPE( SwCntntFrm ));
+ pFnd; pFnd = (SwCntntFrm*)aIter.Next() )
+ {
+ SwPageFrm* pPage = pFnd->FindPageFrm();
+ if( pPage )
+ {
+ pPage->RemoveFtn( pFnd, this );
+ bFrmFnd = TRUE;
+ }
+ }
+ }
+ //JP 13.05.97: falls das Layout vorm loeschen der Fussnoten entfernt
+ // wird, sollte man das ueber die Fussnote selbst tun
+ if( !bFrmFnd && pStartNode )
+ {
+ SwNodeIndex aIdx( *pStartNode );
+ SwCntntNode* pCNd = pMyTxtNd->GetNodes().GoNext( &aIdx );
+ if( pCNd )
+ {
+ SwClientIter aIter( *pCNd );
+ for( SwCntntFrm* pFnd = (SwCntntFrm*)aIter.First( TYPE( SwCntntFrm ));
+ pFnd; pFnd = (SwCntntFrm*)aIter.Next() )
+ {
+ SwPageFrm* pPage = pFnd->FindPageFrm();
+
+ SwFrm *pFrm = pFnd->GetUpper();
+ while ( pFrm && !pFrm->IsFtnFrm() )
+ pFrm = pFrm->GetUpper();
+
+ SwFtnFrm *pFtn = (SwFtnFrm*)pFrm;
+ while ( pFtn && pFtn->GetMaster() )
+ pFtn = pFtn->GetMaster();
+ ASSERT( pFtn->GetAttr() == this, "Ftn mismatch error." );
+
+ while ( pFtn )
+ {
+ SwFtnFrm *pFoll = pFtn->GetFollow();
+ pFtn->Cut();
+ delete pFtn;
+ pFtn = pFoll;
+ }
+ pPage->UpdateFtnNum();
+ }
+ }
+ }
+ }
+
+
+/*N*/ USHORT SwTxtFtn::SetSeqRefNo()
+/*N*/ {
+/*N*/ if( !pMyTxtNd )
+/*N*/ return USHRT_MAX;
+/*N*/
+/*N*/ SwDoc* pDoc = pMyTxtNd->GetDoc();
+/*N*/ if( pDoc->IsInReading() )
+/*N*/ return USHRT_MAX;
+/*N*/
+/*N*/ USHORT n, nFtnCnt = pDoc->GetFtnIdxs().Count();
+/*N*/
+/*N*/ BYTE nTmp = 255 < nFtnCnt ? 255 : nFtnCnt;
+/*N*/ SvUShortsSort aArr( nTmp, nTmp );
+/*N*/
+/*N*/ // dann testmal, ob die Nummer schon vergeben ist oder ob eine neue
+/*N*/ // bestimmt werden muss.
+/*N*/ SwTxtFtn* pTxtFtn;
+/*N*/ for( n = 0; n < nFtnCnt; ++n )
+/*N*/ if( (pTxtFtn = pDoc->GetFtnIdxs()[ n ]) != this )
+/*?*/ aArr.Insert( pTxtFtn->nSeqNo );
+/*N*/
+/*N*/ // teste erstmal ob die Nummer schon vorhanden ist:
+/*N*/ if( USHRT_MAX != nSeqNo )
+/*N*/ {
+/*N*/ for( n = 0; n < aArr.Count(); ++n )
+/*?*/ if( aArr[ n ] > nSeqNo )
+/*?*/ return nSeqNo; // nicht vorhanden -> also benutzen
+/*?*/ else if( aArr[ n ] == nSeqNo )
+/*?*/ break; // schon vorhanden -> neue erzeugen
+/*N*/
+/*N*/ if( n == aArr.Count() )
+/*N*/ return nSeqNo; // nicht vorhanden -> also benutzen
+/*N*/ }
+/*N*/
+/*N*/ // alle Nummern entsprechend geflag, also bestimme die richtige Nummer
+/*N*/ for( n = 0; n < aArr.Count(); ++n )
+/*N*/ if( n != aArr[ n ] )
+/*N*/ break;
+/*N*/
+/*N*/ return nSeqNo = n;
+/*N*/ }
+
+/*N*/ void SwTxtFtn::SetUniqueSeqRefNo( SwDoc& rDoc )
+/*N*/ {
+/*N*/ USHORT n, nStt = 0, nFtnCnt = rDoc.GetFtnIdxs().Count();
+/*N*/
+/*N*/ BYTE nTmp = 255 < nFtnCnt ? 255 : nFtnCnt;
+/*N*/ SvUShortsSort aArr( nTmp, nTmp );
+/*N*/
+/*N*/ // dann alle Nummern zusammensammeln die schon existieren
+/*N*/ SwTxtFtn* pTxtFtn;
+/*N*/ for( n = 0; n < nFtnCnt; ++n )
+/*N*/ if( USHRT_MAX != (pTxtFtn = rDoc.GetFtnIdxs()[ n ])->nSeqNo )
+/*N*/ aArr.Insert( pTxtFtn->nSeqNo );
+/*N*/
+/*N*/
+/*N*/ for( n = 0; n < nFtnCnt; ++n )
+/*N*/ if( USHRT_MAX == (pTxtFtn = rDoc.GetFtnIdxs()[ n ])->nSeqNo )
+/*N*/ {
+/*N*/ for( ; nStt < aArr.Count(); ++nStt )
+/*?*/ if( nStt != aArr[ nStt ] )
+/*?*/ {
+/*?*/
+/*?*/ pTxtFtn->nSeqNo = nStt;
+/*?*/ break;
+/*?*/ }
+/*N*/
+/*N*/ if( USHRT_MAX == pTxtFtn->nSeqNo )
+/*N*/ break; // nichts mehr gefunden
+/*N*/ }
+/*N*/
+/*N*/ // alle Nummern schon vergeben, also mit nStt++ weitermachen
+/*N*/ for( ; n < nFtnCnt; ++n )
+/*N*/ if( USHRT_MAX == (pTxtFtn = rDoc.GetFtnIdxs()[ n ])->nSeqNo )
+/*N*/ pTxtFtn->nSeqNo = nStt++;
+/*N*/ }
+
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_atrref.cxx b/binfilter/bf_sw/source/core/txtnode/sw_atrref.cxx
new file mode 100644
index 000000000000..efb670407ae3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_atrref.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <txtrfmrk.hxx>
+#include <fmtrfmrk.hxx>
+namespace binfilter {
+
+
+/****************************************************************************
+ *
+ * class SwFmtRefMark
+ *
+ ****************************************************************************/
+
+/*N*/ SwFmtRefMark::~SwFmtRefMark( )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFmtRefMark::SwFmtRefMark( const XubString& rName )
+/*N*/ : SfxPoolItem( RES_TXTATR_REFMARK ),
+/*N*/ aRefName( rName ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFmtRefMark::SwFmtRefMark( const SwFmtRefMark& rAttr )
+/*N*/ : SfxPoolItem( RES_TXTATR_REFMARK ),
+/*N*/ aRefName( rAttr.aRefName ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ }
+
+int SwFmtRefMark::operator==( const SfxPoolItem& rAttr ) const
+{
+ {DBG_BF_ASSERT(0, "STRIP");} return 0;//STRIP001 ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+}
+
+/*N*/ SfxPoolItem* SwFmtRefMark::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwFmtRefMark( *this );
+/*N*/ }
+
+/*************************************************************************
+ * class SwTxtRefMark
+ *************************************************************************/
+
+// Attribut fuer Inhalts-/Positions-Referenzen im Text
+
+/*N*/ SwTxtRefMark::SwTxtRefMark( const SwFmtRefMark& rAttr,
+/*N*/ xub_StrLen nStart, xub_StrLen* pEnde )
+/*N*/ : SwTxtAttrEnd( rAttr, nStart, nStart ),
+/*N*/ pEnd( 0 ),
+/*N*/ pMyTxtNd( 0 )
+/*N*/ {
+/*N*/ ((SwFmtRefMark&)rAttr).pTxtAttr = this;
+/*N*/ if( pEnde )
+/*N*/ {
+/*N*/ nEnd = *pEnde;
+/*N*/ pEnd = &nEnd;
+/*N*/ }
+/*N*/ SetDontMergeAttr( TRUE );
+/*N*/ SetDontMoveAttr( TRUE );
+/*N*/ SetOverlapAllowedAttr( TRUE );
+/*N*/ }
+
+/*N*/ xub_StrLen* SwTxtRefMark::GetEnd()
+/*N*/ {
+/*N*/ return pEnd;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_atrtox.cxx b/binfilter/bf_sw/source/core/txtnode/sw_atrtox.cxx
new file mode 100644
index 000000000000..de3ed2a13511
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_atrtox.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <txttxmrk.hxx>
+#include <tox.hxx>
+namespace binfilter {
+
+/*N*/ SwTxtTOXMark::SwTxtTOXMark( const SwTOXMark& rAttr,
+/*N*/ xub_StrLen nStart, xub_StrLen* pEnde )
+/*N*/ : SwTxtAttrEnd( rAttr, nStart, nStart ),
+/*N*/ pEnd( 0 ),
+/*N*/ pMyTxtNd( 0 )
+/*N*/ {
+/*N*/ ((SwTOXMark&)rAttr).pTxtAttr = this;
+/*N*/ if( !rAttr.GetAlternativeText().Len() )
+/*N*/ {
+/*N*/ nEnd = *pEnde;
+/*N*/ pEnd = &nEnd;
+/*N*/ }
+/*N*/ SetDontMergeAttr( TRUE );
+/*N*/ SetDontMoveAttr( TRUE );
+/*N*/ SetOverlapAllowedAttr( TRUE );
+/*N*/ }
+
+/*N*/ SwTxtTOXMark::~SwTxtTOXMark()
+/*N*/ {
+/*N*/ }
+
+/*N*/ xub_StrLen* SwTxtTOXMark::GetEnd()
+/*N*/ {
+/*N*/ return pEnd;
+/*N*/ }
+
+/*N*/ void SwTxtTOXMark::CopyTOXMark( SwDoc* pDoc )
+/*N*/ {
+/*N*/ SwTOXMark& rTOX = (SwTOXMark&)GetTOXMark();
+/*N*/ TOXTypes eType = rTOX.GetTOXType()->GetType();
+/*N*/ USHORT nCount = pDoc->GetTOXTypeCount( eType );
+/*N*/ const SwTOXType* pType = 0;
+/*N*/ const XubString& rNm = rTOX.GetTOXType()->GetTypeName();
+/*N*/
+/*N*/ // kein entsprechender Verzeichnistyp vorhanden -> anlegen
+/*N*/ // sonst verwenden
+/*N*/ for(USHORT i=0; i < nCount; ++i)
+/*N*/ {
+/*N*/ const SwTOXType* pSrcType = pDoc->GetTOXType(eType, i);
+/*N*/ if(pSrcType->GetTypeName() == rNm )
+/*N*/ {
+/*N*/ pType = pSrcType;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ // kein entsprechender Typ vorhanden -> neu erzeugen
+/*N*/ //
+/*N*/ if(!pType)
+/*N*/ {
+/*N*/ pDoc->InsertTOXType( SwTOXType( eType, rNm ) );
+/*N*/ pType = pDoc->GetTOXType(eType, 0);
+/*N*/ }
+/*N*/ // Verzeichnistyp umhaengen
+/*N*/ //
+/*N*/ ((SwTOXType*)pType)->Add( &rTOX );
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_fmtatr1.cxx b/binfilter/bf_sw/source/core/txtnode/sw_fmtatr1.cxx
new file mode 100644
index 000000000000..e542813bf342
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_fmtatr1.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+#include <errhdl.hxx>
+#include <fmthbsh.hxx>
+namespace binfilter {
+
+
+/*************************************************************************
+|*
+|* class SwFmtHardBlank
+|*
+|* Beschreibung Dokument 1.20
+|* Ersterstellung JP 23.11.90
+|* Letzte Aenderung JP 20.02.91
+|*
+*************************************************************************/
+
+/*N*/ SwFmtHardBlank::SwFmtHardBlank( sal_Unicode cCh, BOOL bCheck )
+/*N*/ : SfxPoolItem( RES_TXTATR_HARDBLANK ),
+/*N*/ cChar( cCh )
+/*N*/ {
+/*N*/ ASSERT( !bCheck || (' ' != cCh && '-' != cCh),
+/*N*/ "Invalid character for the HardBlank attribute - "
+/*N*/ "must be a normal unicode character" );
+/*N*/ }
+
+
+
+/*************************************************************************
+|*
+|* class SwFmtSoftHyph
+|*
+|* Beschreibung Dokument 1.20
+|* Ersterstellung JP 23.11.90
+|* Letzte Aenderung JP 20.02.91
+|*
+*************************************************************************/
+
+/*N*/ SwFmtSoftHyph::SwFmtSoftHyph()
+/*N*/ : SfxPoolItem( RES_TXTATR_SOFTHYPH )
+/*N*/ {
+/*N*/ }
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_fmtatr2.cxx b/binfilter/bf_sw/source/core/txtnode/sw_fmtatr2.cxx
new file mode 100644
index 000000000000..5f8c188babfd
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_fmtatr2.cxx
@@ -0,0 +1,507 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "unomid.h"
+
+#include <bf_svtools/macitem.hxx>
+
+#include <fchrfmt.hxx>
+#include <fmtinfmt.hxx>
+#include <txtatr.hxx>
+#include <fmtruby.hxx>
+#include <charfmt.hxx>
+
+#include <horiornt.hxx>
+
+
+#include <cppuhelper/implbase4.hxx>
+
+#include <unoevent.hxx> // SwHyperlinkEventDescriptor
+#include <com/sun/star/text/RubyAdjust.hdl>
+
+#include <cmdid.h>
+#include <com/sun/star/uno/Any.h>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+/*************************************************************************
+|*
+|* class SwFmtCharFmt
+|* Beschreibung
+|* Ersterstellung JP 23.11.90
+|* Letzte Aenderung JP 09.08.94
+|*
+*************************************************************************/
+
+/*N*/ TYPEINIT1_AUTOFACTORY(SwFmtINetFmt, SfxPoolItem);
+
+/*N*/ SwFmtCharFmt::SwFmtCharFmt( SwCharFmt *pFmt )
+/*N*/ : SfxPoolItem( RES_TXTATR_CHARFMT ),
+/*N*/ SwClient(pFmt),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwFmtCharFmt::SwFmtCharFmt( const SwFmtCharFmt& rAttr )
+/*N*/ : SfxPoolItem( RES_TXTATR_CHARFMT ),
+/*N*/ SwClient( rAttr.GetCharFmt() ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwFmtCharFmt::~SwFmtCharFmt() {}
+
+
+
+/*N*/ int SwFmtCharFmt::operator==( const SfxPoolItem& rAttr ) const
+/*N*/ {
+/*N*/ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+/*N*/ return GetCharFmt() == ((SwFmtCharFmt&)rAttr).GetCharFmt();
+/*N*/ }
+
+
+
+/*N*/ SfxPoolItem* SwFmtCharFmt::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwFmtCharFmt( *this );
+/*N*/ }
+
+
+
+
+
+
+/*N*/ // weiterleiten an das TextAttribut
+/*N*/ BOOL SwFmtCharFmt::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ return pTxtAttr ? pTxtAttr->GetInfo( rInfo ) : FALSE;
+/*N*/ }
+/*N*/ bool SwFmtCharFmt::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+/*N*/ {
+/*N*/ String sCharFmtName;
+/*N*/ if(GetCharFmt())
+/*N*/ SwStyleNameMapper::FillProgName(GetCharFmt()->GetName(), sCharFmtName, GET_POOLID_CHRFMT, sal_True );
+/*N*/ rVal <<= OUString( sCharFmtName );
+/*N*/ return true;
+/*N*/ }
+
+/*************************************************************************
+|*
+|* class SwFmtINetFmt
+|* Beschreibung
+|* Ersterstellung AMA 02.08.96
+|* Letzte Aenderung AMA 02.08.96
+|*
+*************************************************************************/
+
+/*N*/ SwFmtINetFmt::SwFmtINetFmt()
+/*N*/ : SfxPoolItem( RES_TXTATR_INETFMT ),
+/*N*/ pTxtAttr( 0 ),
+/*N*/ pMacroTbl( 0 ),
+/*N*/ nINetId( 0 ),
+/*N*/ nVisitedId( 0 )
+/*N*/ {}
+
+/*N*/ SwFmtINetFmt::SwFmtINetFmt( const XubString& rURL, const XubString& rTarget )
+/*N*/ : SfxPoolItem( RES_TXTATR_INETFMT ),
+/*N*/ aURL( rURL ),
+/*N*/ aTargetFrame( rTarget ),
+/*N*/ pTxtAttr( 0 ),
+/*N*/ pMacroTbl( 0 ),
+/*N*/ nINetId( 0 ),
+/*N*/ nVisitedId( 0 )
+/*N*/ {
+/*N*/ }
+
+
+
+/*N*/ SwFmtINetFmt::SwFmtINetFmt( const SwFmtINetFmt& rAttr )
+/*N*/ : SfxPoolItem( RES_TXTATR_INETFMT ),
+/*N*/ aURL( rAttr.GetValue() ),
+/*N*/ aName( rAttr.aName ),
+/*N*/ aTargetFrame( rAttr.aTargetFrame ),
+/*N*/ aINetFmt( rAttr.aINetFmt ),
+/*N*/ aVisitedFmt( rAttr.aVisitedFmt ),
+/*N*/ pTxtAttr( 0 ),
+/*N*/ pMacroTbl( 0 ),
+/*N*/ nINetId( rAttr.nINetId ),
+/*N*/ nVisitedId( rAttr.nVisitedId )
+/*N*/ {
+/*N*/ if( rAttr.GetMacroTbl() )
+/*?*/ pMacroTbl = new SvxMacroTableDtor( *rAttr.GetMacroTbl() );
+/*N*/ }
+
+
+
+/*N*/ SwFmtINetFmt::~SwFmtINetFmt()
+/*N*/ {
+/*N*/ delete pMacroTbl;
+/*N*/ }
+
+
+
+/*N*/ int SwFmtINetFmt::operator==( const SfxPoolItem& rAttr ) const
+/*N*/ {
+/*N*/ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+/*N*/ BOOL bRet = SfxPoolItem::operator==( (SfxPoolItem&) rAttr )
+/*N*/ && aURL == ((SwFmtINetFmt&)rAttr).aURL
+/*N*/ && aName == ((SwFmtINetFmt&)rAttr).aName
+/*N*/ && aTargetFrame == ((SwFmtINetFmt&)rAttr).aTargetFrame
+/*N*/ && aINetFmt == ((SwFmtINetFmt&)rAttr).aINetFmt
+/*N*/ && aVisitedFmt == ((SwFmtINetFmt&)rAttr).aVisitedFmt
+/*N*/ && nINetId == ((SwFmtINetFmt&)rAttr).nINetId
+/*N*/ && nVisitedId == ((SwFmtINetFmt&)rAttr).nVisitedId;
+/*N*/
+/*N*/ if( !bRet )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ const SvxMacroTableDtor* pOther = ((SwFmtINetFmt&)rAttr).pMacroTbl;
+/*N*/ if( !pMacroTbl )
+/*N*/ return ( !pOther || !pOther->Count() );
+/*N*/ if( !pOther )
+/*?*/ return 0 == pMacroTbl->Count();
+/*?*/
+/*?*/ const SvxMacroTableDtor& rOwn = *pMacroTbl;
+/*?*/ const SvxMacroTableDtor& rOther = *pOther;
+/*?*/
+/*?*/ // Anzahl unterschiedlich => auf jeden Fall ungleich
+/*?*/ if( rOwn.Count() != rOther.Count() )
+/*?*/ return FALSE;
+/*?*/
+/*?*/ // einzeln vergleichen; wegen Performance ist die Reihenfolge wichtig
+/*?*/ for( USHORT nNo = 0; nNo < rOwn.Count(); ++nNo )
+/*?*/ {
+/*?*/ const SvxMacro *pOwnMac = rOwn.GetObject(nNo);
+/*?*/ const SvxMacro *pOtherMac = rOther.GetObject(nNo);
+/*?*/ if ( rOwn.GetKey(pOwnMac) != rOther.GetKey(pOtherMac) ||
+/*?*/ pOwnMac->GetLibName() != pOtherMac->GetLibName() ||
+/*?*/ pOwnMac->GetMacName() != pOtherMac->GetMacName() )
+/*?*/ return FALSE;
+/*?*/ }
+/*?*/ return TRUE;
+/*N*/ }
+
+
+
+/*N*/ SfxPoolItem* SwFmtINetFmt::Clone( SfxItemPool* ) const
+/*N*/ {
+/*N*/ return new SwFmtINetFmt( *this );
+/*N*/ }
+
+
+
+
+
+
+/*N #i27164#*/ void SwFmtINetFmt::SetMacro( USHORT nEvent, const SvxMacro& rMacro )
+/*N #i27164#*/ {
+/*N #i27164#*/ if( !pMacroTbl )
+/*N #i27164#*/ pMacroTbl = new SvxMacroTableDtor;
+/*N #i27164#*/
+/*N #i27164#*/ SvxMacro *pOldMacro;
+/*N #i27164#*/ if( 0 != ( pOldMacro = pMacroTbl->Get( nEvent )) )
+/*N #i27164#*/ {
+/*N #i27164#*/ delete pOldMacro;
+/*N #i27164#*/ pMacroTbl->Replace( nEvent, new SvxMacro( rMacro ) );
+/*N #i27164#*/ }
+/*N #i27164#*/ else
+/*N #i27164#*/ pMacroTbl->Insert( nEvent, new SvxMacro( rMacro ) );
+/*N #i27164#*/ }
+
+
+
+/*N*/ const SvxMacro* SwFmtINetFmt::GetMacro( USHORT nEvent ) const
+/*N*/ {
+/*N*/ const SvxMacro* pRet = 0;
+/*N*/ if( pMacroTbl && pMacroTbl->IsKeyValid( nEvent ) )
+/*?*/ pRet = pMacroTbl->Get( nEvent );
+/*N*/ return pRet;
+/*N*/ }
+
+
+
+/*N*/ bool SwFmtINetFmt::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
+/*N*/ {
+/*N*/ bool bRet = true;
+/*N*/ XubString sVal;
+/*N*/ nMemberId &= ~CONVERT_TWIPS;
+/*N*/ switch(nMemberId)
+/*N*/ {
+/*N*/ case MID_URL_URL:
+/*N*/ sVal = aURL;
+/*N*/ break;
+/*N*/ case MID_URL_TARGET:
+/*N*/ sVal = aTargetFrame;
+/*N*/ break;
+/*N*/ case MID_URL_HYPERLINKNAME:
+/*N*/ sVal = aName;
+/*N*/ break;
+/*N*/ case MID_URL_VISITED_FMT:
+/*N*/ sVal = aVisitedFmt;
+/*N*/ if( !sVal.Len() && nVisitedId != 0 )
+/*?*/ SwStyleNameMapper::FillUIName( nVisitedId, sVal );
+/*N*/ if( sVal.Len() )
+/*?*/ SwStyleNameMapper::FillProgName( sVal, sVal, GET_POOLID_CHRFMT, sal_True );
+/*N*/ break;
+/*N*/ case MID_URL_UNVISITED_FMT:
+/*N*/ sVal = aINetFmt;
+/*N*/ if( !sVal.Len() && nINetId != 0 )
+/*?*/ SwStyleNameMapper::FillUIName( nINetId, sVal );
+/*N*/ if( sVal.Len() )
+/*?*/ SwStyleNameMapper::FillProgName( sVal, sVal, GET_POOLID_CHRFMT, sal_True );
+/*N*/ break;
+/*N*/ case MID_URL_HYPERLINKEVENTS:
+/*N*/ {
+/*N*/ // create (and return) event descriptor
+/*N*/ SwHyperlinkEventDescriptor* pEvents =
+/*N*/ new SwHyperlinkEventDescriptor();
+/*N*/ pEvents->copyMacrosFromINetFmt(*this);
+/*N*/ uno::Reference<container::XNameReplace> xNameReplace(pEvents);
+/*N*/
+/*N*/ // all others return a string; so we just set rVal here and exit
+/*N*/ rVal <<= xNameReplace;
+/*N*/ return bRet;
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ bRet = false;
+/*N*/ }
+/*N*/ rVal <<= OUString(sVal);
+/*N*/ return bRet;
+/*N*/ }
+/*N*/ bool SwFmtINetFmt::PutValue( const uno::Any& rVal, BYTE nMemberId )
+/*N*/ {
+/*N*/ bool bRet = TRUE;
+/*N*/ nMemberId &= ~CONVERT_TWIPS;
+/*N*/
+/*N*/ // all properties except HyperlinkEvents are of type string, hence
+/*N*/ // we treat HyperlinkEvents specially
+/*N*/ if (MID_URL_HYPERLINKEVENTS == nMemberId)
+/*N*/ {
+/*?*/ uno::Reference<container::XNameReplace> xReplace;
+/*?*/ rVal >>= xReplace;
+/*?*/ if (xReplace.is())
+/*?*/ {
+/*?*/ // Create hyperlink event descriptor. Then copy events
+/*?*/ // from argument into descriptor. Then copy events from
+/*?*/ // the descriptor into the format.
+/*?*/ SwHyperlinkEventDescriptor* pEvents = new SwHyperlinkEventDescriptor();
+/*?*/ uno::Reference< ::com::sun::star::lang::XServiceInfo> xHold = pEvents;
+/*?*/ pEvents->copyMacrosFromNameReplace(xReplace);
+/*?*/ pEvents->copyMacrosIntoINetFmt(*this);
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // wrong type!
+/*?*/ bRet = false;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // all string properties:
+/*N*/ if(rVal.getValueType() != ::getCppuType((::rtl::OUString*)0))
+/*N*/ return false;
+/*N*/ XubString sVal = *(::rtl::OUString*)rVal.getValue();
+/*N*/ switch(nMemberId)
+/*N*/ {
+/*N*/ case MID_URL_URL:
+/*N*/ aURL = sVal;
+/*N*/ break;
+/*N*/ case MID_URL_TARGET:
+/*N*/ aTargetFrame = sVal;
+/*N*/ break;
+/*N*/ case MID_URL_HYPERLINKNAME:
+/*N*/ aName = sVal;
+/*N*/ break;
+/*?*/ case MID_URL_VISITED_FMT:
+/*?*/ {
+/*?*/ String aString;
+/*?*/ SwStyleNameMapper::FillUIName( sVal, aString, GET_POOLID_CHRFMT, sal_True );
+/*?*/ aVisitedFmt = OUString ( aString );
+/*?*/ nVisitedId = SwStyleNameMapper::GetPoolIdFromUIName( aVisitedFmt,
+/*?*/ GET_POOLID_CHRFMT );
+/*?*/ }
+/*?*/ break;
+/*?*/ case MID_URL_UNVISITED_FMT:
+/*?*/ {
+/*?*/ String aString;
+/*?*/ SwStyleNameMapper::FillUIName( sVal, aString, GET_POOLID_CHRFMT, sal_True );
+/*?*/ aINetFmt = OUString ( aString );
+/*?*/ nINetId = SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt, GET_POOLID_CHRFMT );
+/*?*/ }
+/*?*/ break;
+/*?*/ default:
+/*?*/ bRet = false;
+/*N*/ }
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+
+/*************************************************************************
+|* class SwFmtRuby
+*************************************************************************/
+
+/*N*/ SwFmtRuby::SwFmtRuby( const String& rRubyTxt )
+/*N*/ : SfxPoolItem( RES_TXTATR_CJK_RUBY ),
+/*N*/ sRubyTxt( rRubyTxt ),
+/*N*/ nCharFmtId( 0 ),
+/*N*/ nPosition( 0 ), nAdjustment( 0 ),
+/*N*/ pTxtAttr( 0 )
+/*N*/ {
+/*N*/ }
+
+/*?*/ SwFmtRuby::SwFmtRuby( const SwFmtRuby& rAttr )
+/*?*/ : SfxPoolItem( RES_TXTATR_CJK_RUBY ),
+/*?*/ sRubyTxt( rAttr.sRubyTxt ),
+/*?*/ sCharFmtName( rAttr.sCharFmtName ),
+/*?*/ nCharFmtId( rAttr.nCharFmtId),
+/*?*/ nPosition( rAttr.nPosition ), nAdjustment( rAttr.nAdjustment ),
+/*?*/ pTxtAttr( 0 )
+/*?*/ {
+/*?*/ }
+
+/*N*/ SwFmtRuby::~SwFmtRuby()
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFmtRuby& SwFmtRuby::operator=( const SwFmtRuby& rAttr )
+/*N*/ {
+/*N*/ sRubyTxt = rAttr.sRubyTxt;
+/*N*/ sCharFmtName = rAttr.sCharFmtName;
+/*N*/ nCharFmtId = rAttr.nCharFmtId;
+/*N*/ nPosition = rAttr.nPosition;
+/*N*/ nAdjustment = rAttr.nAdjustment;
+/*N*/ pTxtAttr = 0;
+/*N*/ return *this;
+/*N*/ }
+
+int SwFmtRuby::operator==( const SfxPoolItem& rAttr ) const
+{
+ ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
+ return sRubyTxt == ((SwFmtRuby&)rAttr).sRubyTxt &&
+ sCharFmtName == ((SwFmtRuby&)rAttr).sCharFmtName &&
+ nCharFmtId == ((SwFmtRuby&)rAttr).nCharFmtId &&
+ nPosition == ((SwFmtRuby&)rAttr).nPosition &&
+ nAdjustment == ((SwFmtRuby&)rAttr).nAdjustment;
+}
+
+SfxPoolItem* SwFmtRuby::Clone( SfxItemPool* ) const
+{
+ return new SwFmtRuby( *this );
+}
+
+bool SwFmtRuby::QueryValue( ::com::sun::star::uno::Any& rVal,
+ BYTE nMemberId ) const
+{
+ bool bRet = true;
+ nMemberId &= ~CONVERT_TWIPS;
+ switch( nMemberId )
+ {
+ case MID_RUBY_TEXT: rVal <<= (OUString)sRubyTxt; break;
+ case MID_RUBY_ADJUST: rVal <<= (sal_Int16)nAdjustment; break;
+ case MID_RUBY_CHARSTYLE:
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(sCharFmtName, aString, GET_POOLID_CHRFMT, sal_True );
+ rVal <<= OUString ( aString );
+ }
+ break;
+ case MID_RUBY_ABOVE:
+ {
+ sal_Bool bAbove = !nPosition;
+ rVal.setValue(&bAbove, ::getBooleanCppuType());
+ }
+ break;
+ default:
+ bRet = false;
+ }
+ return bRet;
+}
+/*N*/ bool SwFmtRuby::PutValue( const ::com::sun::star::uno::Any& rVal,
+/*N*/ BYTE nMemberId )
+/*N*/ {
+/*N*/ bool bRet = TRUE;
+/*N*/ nMemberId &= ~CONVERT_TWIPS;
+/*N*/ switch( nMemberId )
+/*N*/ {
+/*N*/ case MID_RUBY_TEXT:
+/*N*/ {
+/*N*/ OUString sTmp;
+/*N*/ bRet = rVal >>= sTmp;
+/*N*/ sRubyTxt = sTmp;
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_RUBY_ADJUST:
+/*N*/ {
+/*N*/ sal_Int16 nSet; rVal >>= nSet;
+/*N*/ if(nSet >= 0 && nSet <= ::com::sun::star::text::RubyAdjust_INDENT_BLOCK)
+/*N*/ nAdjustment = nSet;
+/*N*/ else
+/*N*/ bRet = sal_False;
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_RUBY_ABOVE:
+/*N*/ {
+/*N*/ const uno::Type& rType = ::getBooleanCppuType();
+/*N*/ if(rVal.hasValue() && rVal.getValueType() == rType)
+/*N*/ {
+/*N*/ sal_Bool bAbove = *(sal_Bool*)rVal.getValue();
+/*N*/ nPosition = bAbove ? 0 : 1;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case MID_RUBY_CHARSTYLE:
+/*N*/ {
+/*N*/ OUString sTmp;
+/*N*/ bRet = rVal >>= sTmp;
+/*N*/ if(bRet)
+/*N*/ sCharFmtName = SwStyleNameMapper::GetUIName(sTmp, GET_POOLID_CHRFMT );
+/*N*/ }
+/*N*/ break;
+/*N*/ default:
+/*N*/ bRet = false;
+/*N*/ }
+/*N*/ return bRet;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_fntcache.cxx b/binfilter/bf_sw/source/core/txtnode/sw_fntcache.cxx
new file mode 100644
index 000000000000..6412152ed523
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_fntcache.cxx
@@ -0,0 +1,785 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <vcl/metric.hxx>
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/i18n/CharacterIteratorMode.hdl>
+#include <com/sun/star/i18n/WordType.hdl>
+#include <breakit.hxx>
+#include <viewsh.hxx> // Bildschirmabgleich
+#include <viewopt.hxx> // Bildschirmabgleich abschalten, ViewOption
+#include <fntcache.hxx>
+
+#include <horiornt.hxx>
+
+#include <swfont.hxx> // CH_BLANK + CH_BULLET
+#include <txtfrm.hxx> // SwTxtFrm
+#include <pagefrm.hxx>
+#include <pagedesc.hxx> // SwPageDesc
+#include <tgrditem.hxx>
+
+// Enable this to use the helpclass SwRVPMark
+#if OSL_DEBUG_LEVEL > 1
+#endif
+namespace binfilter {
+
+// globale Variablen, werden in FntCache.Hxx bekanntgegeben
+// Der FontCache wird in TxtInit.Cxx _TXTINIT erzeugt und in _TXTEXIT geloescht
+SwFntCache *pFntCache = NULL;
+// Letzter Font, der durch ChgFntCache eingestellt wurde.
+SwFntObj *pLastFont = NULL;
+// Die "MagicNumber", die den Fonts zur Identifizierung verpasst wird
+BYTE* pMagicNo = NULL;
+
+Color *pWaveCol = 0;
+
+long SwFntObj::nPixWidth;
+MapMode* SwFntObj::pPixMap = NULL;
+OutputDevice* SwFntObj::pPixOut = NULL;
+
+extern USHORT UnMapDirection( USHORT nDir, const BOOL bVertFormat );
+
+#ifdef _RVP_MARK_HXX
+
+
+#endif
+
+/*************************************************************************
+|*
+|* SwFntCache::Flush()
+|*
+|* Ersterstellung AMA 16. Dez. 94
+|* Letzte Aenderung AMA 16. Dez. 94
+|*
+|*************************************************************************/
+
+/*N*/ void SwFntCache::Flush( )
+/*N*/ {
+/*N*/ if ( pLastFont )
+/*N*/ {
+/*N*/ pLastFont->Unlock();
+/*N*/ pLastFont = NULL;
+/*N*/ }
+/*N*/ SwCache::Flush( );
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFntObj::SwFntObj(), ~SwFntObj()
+|*
+|* Ersterstellung AMA 7. Nov. 94
+|* Letzte Aenderung AMA 7. Nov. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwFntObj::SwFntObj( const SwSubFont &rFont, const void *pOwner, ViewShell *pSh ) :
+/*N*/ SwCacheObj( (void*)pOwner ),
+/*N*/ aFont( rFont ),
+/*N*/ pScrFont( NULL ),
+/*N*/ pPrtFont( &aFont ),
+/*N*/ pPrinter( NULL ),
+/*N*/ nPropWidth( rFont.GetPropWidth() )
+/*N*/ {
+/*N*/ nZoom = pSh ? pSh->GetViewOptions()->GetZoom() : USHRT_MAX;
+/*N*/ nLeading = USHRT_MAX;
+/*N*/ nPrtAscent = USHRT_MAX;
+/*N*/ nPrtHeight = USHRT_MAX;
+/*N*/ bPaintBlank = ( UNDERLINE_NONE != aFont.GetUnderline()
+/*N*/ || STRIKEOUT_NONE != aFont.GetStrikeout() )
+/*N*/ && !aFont.IsWordLineMode();
+/*N*/ }
+
+/*N*/ SwFntObj::~SwFntObj()
+/*N*/ {
+/*N*/ if ( pScrFont != pPrtFont )
+/*N*/ delete pScrFont;
+/*N*/ if ( pPrtFont != &aFont )
+/*?*/ delete pPrtFont;
+/*N*/ }
+
+/*N*/ void SwFntObj::CreatePrtFont( const OutputDevice& rPrt )
+/*N*/ {
+/*N*/ if ( nPropWidth != 100 && pPrinter != &rPrt )
+/*N*/ {
+/*?*/ if( pScrFont != pPrtFont )
+/*?*/ delete pScrFont;
+/*?*/ if( pPrtFont != &aFont )
+/*?*/ delete pPrtFont;
+/*?*/
+/*?*/ const Font aOldFnt( rPrt.GetFont() );
+/*?*/ ((OutputDevice&)rPrt).SetFont( aFont );
+/*?*/ const FontMetric aWinMet( rPrt.GetFontMetric() );
+/*?*/ ((OutputDevice&)rPrt).SetFont( aOldFnt );
+/*?*/ long nWidth = ( aWinMet.GetSize().Width() * nPropWidth ) / 100;
+/*?*/
+/*?*/ if( !nWidth )
+/*?*/ ++nWidth;
+/*?*/ pPrtFont = new Font( aFont );
+/*?*/ pPrtFont->SetSize( Size( nWidth, aFont.GetSize().Height() ) );
+/*?*/ pScrFont = NULL;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ *
+ * USHORT SwFntObj::GetAscent( const OutputDevice *pOut )
+ *
+ * Ersterstellung AMA 7. Nov. 94
+ * Letzte Aenderung AMA 7. Nov. 94
+ *
+ * Beschreibung: liefern den Ascent des Fonts auf dem
+ * gewuenschten Outputdevice zurueck, ggf. muss der Bildschirmfont erst
+ * erzeugt werden.
+ *************************************************************************/
+
+/*N*/ USHORT SwFntObj::GetAscent( const ViewShell *pSh, const OutputDevice *pOut )
+/*N*/ {
+/*N*/ // Condition for output font / refdev font adjustment
+/*N*/ // 1. RefDef == OutDev (common printing, online layout)
+/*N*/ // 2. Prospect/PagePreview pringing
+/*N*/ // 3. PDF export from online layout
+/*N*/ const OutputDevice* pRefDev = pOut;
+/*N*/ if ( !pSh || ( pRefDev = &pSh->GetRefDev() ) == pOut ||
+/*N*/ ( OUTDEV_PRINTER == pRefDev->GetOutDevType() &&
+/*N*/ OUTDEV_PRINTER == pOut->GetOutDevType() ) ||
+/*N*/ OUTDEV_WINDOW == pRefDev->GetOutDevType() )
+/*N*/ {
+/*N*/ if ( nPrtAscent == USHRT_MAX ) // DruckerAscent noch nicht bekannt?
+/*N*/ {
+/*N*/ CreatePrtFont( *pOut );
+/*N*/ const Font aOldFnt( pRefDev->GetFont() );
+/*N*/ ((OutputDevice*)pRefDev)->SetFont( *pPrtFont );
+/*N*/ const FontMetric aOutMet( pRefDev->GetFontMetric() );
+/*N*/ nPrtAscent = (USHORT) aOutMet.GetAscent();
+/*N*/ ( (OutputDevice *)pRefDev )->SetFont( aOldFnt );
+/*N*/ }
+/*N*/ return nPrtAscent + nLeading;
+/*N*/ }
+/*N*/
+/*N*/ CreateScrFont( pSh, *pOut ); // eventuell Bildschirmanpassung durchfuehren
+/*N*/ return nScrAscent;
+/*N*/ }
+
+/*N*/ USHORT SwFntObj::GetHeight( const ViewShell *pSh, const OutputDevice *pOut )
+/*N*/ {
+/*N*/ // Condition for output font / refdev font adjustment
+/*N*/ // 1. RefDef == OutDev (common printing, online layout)
+/*N*/ // 2. Prospect/PagePreview pringing
+/*N*/ // 3. PDF export from online layout
+/*N*/ const OutputDevice* pRefDev = pOut;
+/*N*/ if ( ! pSh || ( pRefDev = &pSh->GetRefDev() ) == pOut ||
+/*N*/ ( OUTDEV_PRINTER == pRefDev->GetOutDevType() &&
+/*N*/ OUTDEV_PRINTER == pOut->GetOutDevType() ) ||
+/*N*/ OUTDEV_WINDOW == pRefDev->GetOutDevType() )
+/*N*/ {
+/*N*/ if ( nPrtHeight == USHRT_MAX ) // PrinterHeight noch nicht bekannt?
+/*N*/ {
+/*N*/ CreatePrtFont( *pOut );
+/*N*/ const Font aOldFnt( pRefDev->GetFont() );
+/*N*/ ((OutputDevice*)pRefDev)->SetFont( *pPrtFont );
+/*N*/ nPrtHeight = (USHORT)pRefDev->GetTextHeight();
+/*N*/ ((OutputDevice *)pRefDev)->SetFont( aOldFnt );
+/*N*/ }
+/*N*/ return nPrtHeight + nLeading;
+/*N*/ }
+/*N*/
+/*N*/ CreateScrFont( pSh, *pOut ); // eventuell Bildschirmanpassung durchfuehren
+/*N*/ if ( nScrHeight == USHRT_MAX ) // ScreenHeight noch nicht bekannt?
+/*N*/ {
+/*N*/ const Font aOldFnt( pOut->GetFont() );
+/*N*/ ((OutputDevice*)pOut)->SetFont( *pPrtFont );
+/*N*/ nScrHeight = (USHORT)pOut->GetTextHeight();
+/*N*/ ((OutputDevice*)pOut)->SetFont( aOldFnt );
+/*N*/ }
+/*N*/ return nScrHeight;
+/*N*/ }
+
+/*************************************************************************
+ *
+ * SwFntObj::CreateScrFont( const ViewShell *pSh, const OutputDevice& rOut )
+ *
+ * Ersterstellung AMA 7. Nov. 94
+ * Letzte Aenderung AMA 7. Nov. 94
+ *
+ * pOut is the output device, not the reference device
+ *
+ *************************************************************************/
+
+/*N*/ void SwFntObj::CreateScrFont( const ViewShell *pSh, const OutputDevice& rOut )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+
+/*N*/ void SwFntObj::GuessLeading( const ViewShell *pSh, const FontMetric& rMet )
+/*N*/ {
+/*N*/ // Wie waere es mit 50% des Descents (StarMath??):
+/*N*/ // nLeading = USHORT( aMet.GetDescent() / 2 );
+/*N*/
+/*N*/ #if defined(WNT) || defined(WIN) || defined(PM2)
+/*N*/ OutputDevice *pWin = ( pSh && pSh->GetWin() ) ? pSh->GetWin() :
+/*N*/ GetpApp()->GetDefaultDevice();
+/*N*/ if ( pWin )
+/*N*/ {
+/*N*/ MapMode aTmpMap( MAP_TWIP );
+/*N*/ MapMode aOldMap = pWin->GetMapMode( );
+/*N*/ pWin->SetMapMode( aTmpMap );
+/*N*/ const Font aOldFnt( pWin->GetFont() );
+/*N*/ pWin->SetFont( *pPrtFont );
+/*N*/ const FontMetric aWinMet( pWin->GetFontMetric() );
+/*N*/ const USHORT nWinHeight = USHORT( aWinMet.GetSize().Height() );
+/*N*/ if( pPrtFont->GetName().Search( aWinMet.GetName() ) < USHRT_MAX )
+/*N*/ {
+/*N*/ // Wenn das Leading auf dem Window auch 0 ist, dann
+/*N*/ // muss es auch so bleiben (vgl. StarMath!).
+/*N*/ long nTmpLeading = (long)aWinMet.GetIntLeading();
+/*N*/ // einen Versuch haben wir noch wg. 31003:
+/*N*/ if( nTmpLeading <= 0 )
+/*N*/ {
+/*N*/ pWin->SetFont( rMet );
+/*N*/ nTmpLeading = (long)pWin->GetFontMetric().GetIntLeading();
+/*N*/ if( nTmpLeading < 0 )
+/*N*/ nLeading = 0;
+/*N*/ else
+/*N*/ nLeading = USHORT(nTmpLeading);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ nLeading = USHORT(nTmpLeading);
+/*?*/ // Manta-Hack #50153#:
+/*?*/ // Wer beim Leading luegt, luegt moeglicherweise auch beim
+/*?*/ // Ascent/Descent, deshalb wird hier ggf. der Font ein wenig
+/*?*/ // tiefergelegt, ohne dabei seine Hoehe zu aendern.
+/*?*/ long nDiff = Min( rMet.GetDescent() - aWinMet.GetDescent(),
+/*?*/ aWinMet.GetAscent() - rMet.GetAscent() - nTmpLeading );
+/*?*/ if( nDiff > 0 )
+/*?*/ {
+/*?*/ ASSERT( nPrtAscent < USHRT_MAX, "GuessLeading: PrtAscent-Fault" );
+/*?*/ nPrtAscent += (USHORT)(( 2 * nDiff ) / 5);
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Wenn alle Stricke reissen, nehmen wir 15% der
+/*N*/ // Hoehe, ein von CL empirisch ermittelter Wert.
+/*?*/ nLeading = (nWinHeight * 15) / 100;
+/*N*/ }
+/*N*/ pWin->SetFont( aOldFnt );
+/*N*/ pWin->SetMapMode( aOldMap );
+/*N*/ }
+/*N*/ else
+/*N*/ #endif
+/*N*/ #ifdef MAC
+/*N*/ nLeading = (pPrtFont->GetSize().Height() * 15) / 100;
+/*N*/ #else
+/*N*/ nLeading = 0;
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+ *
+ * void SwFntObj::SetDeviceFont( const OutputDevice *pOut ),
+ *
+ * Ersterstellung AMA 7. Nov. 94
+ * Letzte Aenderung AMA 7. Nov. 94
+ *
+ * Beschreibung: stellt den Font am gewuenschten OutputDevice ein,
+ * am Bildschirm muss eventuell erst den Abgleich durchgefuehrt werden.
+ *
+ *************************************************************************/
+
+/*N*/ void SwFntObj::SetDevFont( const ViewShell *pSh, OutputDevice *pOut )
+/*N*/ {
+/*N*/ // Condition for output font / refdev font adjustment
+ // 1. RefDef == OutDev (common printing, online layout)
+ // 2. Prospect/PagePreview pringing
+ // 3. PDF export from online layout
+/*N*/ const OutputDevice* pRefDev = pOut;
+/*N*/ if ( pSh && ( pRefDev = &pSh->GetRefDev() ) != pOut &&
+/*N*/ ( OUTDEV_PRINTER != pRefDev->GetOutDevType() ||
+/*N*/ OUTDEV_PRINTER != pOut->GetOutDevType() ) &&
+/*N*/ OUTDEV_WINDOW != pRefDev->GetOutDevType() )
+/*N*/ {
+/*?*/ CreateScrFont( pSh, *pOut );
+/*?*/ if( !GetScrFont()->IsSameInstance( pOut->GetFont() ) )
+/*?*/ pOut->SetFont( *pScrFont );
+/*?*/ if( pPrinter && ( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) ) )
+/*?*/ pPrinter->SetFont( *pPrtFont );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ CreatePrtFont( *pOut );
+/*N*/ if( !pPrtFont->IsSameInstance( pOut->GetFont() ) )
+/*N*/ pOut->SetFont( *pPrtFont );
+/*N*/ if ( nLeading == USHRT_MAX )
+/*N*/ {
+/*N*/ FontMetric aMet( pOut->GetFontMetric() );
+/*N*/ bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet();
+/*N*/ long nTmpLead = (long)aMet.GetIntLeading();
+/*N*/ if ( nTmpLead < 5 )
+/*N*/ {
+/*N*/ GetAscent( pSh, pOut );
+/*N*/ GuessLeading( pSh, aMet );
+/*N*/ }
+/*N*/ else
+/*N*/ nLeading = 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+#define WRONG_SHOW_MIN 5
+#define WRONG_SHOW_SMALL 11
+#define WRONG_SHOW_MEDIUM 15
+
+/*************************************************************************
+ *
+ * void SwFntObj::DrawText( ... )
+ *
+ * Ersterstellung AMA 16. Dez. 94
+ * Letzte Aenderung AMA 16. Dez. 94
+ *
+ * Beschreibung: Textausgabe
+ * auf dem Bildschirm => DrawTextArray
+ * auf dem Drucker, !Kerning => DrawText
+ * auf dem Drucker + Kerning => DrawStretchText
+ *
+ *************************************************************************/
+
+
+/*N*/ sal_Bool lcl_IsMonoSpaceFont( const OutputDevice* pOut )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); return sal_False; //STRIP001
+/*N*/ }
+
+// ER 09.07.95 20:34
+// mit -Ox Optimierung stuerzt's unter win95 ab
+// JP 12.07.95: unter WNT auch (i386); Alpha ??
+// global optimization off
+#ifdef _MSC_VER
+#pragma optimize("g",off)
+#endif
+
+
+
+// Optimierung war fuer DrawText() ausgeschaltet
+#ifdef _MSC_VER
+#pragma optimize("",on)
+#endif
+
+
+/*************************************************************************
+ *
+ * Size SwFntObj::GetTextSize( const OutputDevice *pOut, const String &rTxt,
+ * const USHORT nIdx, const USHORT nLen, const short nKern = 0 );
+ *
+ * Ersterstellung AMA 16. Dez. 94
+ * Letzte Aenderung AMA 16. Dez. 94
+ *
+ * Beschreibung: ermittelt die TextSize (des Druckers)
+ *
+ *************************************************************************/
+
+/*N*/ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
+/*N*/ {
+/*N*/ Size aTxtSize;
+/*N*/ const xub_StrLen nLn = ( STRING_LEN != rInf.GetLen() ) ? rInf.GetLen() :
+/*N*/ rInf.GetText().Len();
+/*N*/
+/*N*/ // be sure to have the correct layout mode at the printer
+/*N*/ if ( pPrinter )
+/*N*/ {
+/*N*/ pPrinter->SetLayoutMode( rInf.GetpOut()->GetLayoutMode() );
+/*N*/ pPrinter->SetDigitLanguage( rInf.GetpOut()->GetDigitLanguage() );
+/*N*/ }
+/*N*/
+/*N*/ if ( rInf.GetFrm() && nLn && rInf.SnapToGrid() && rInf.GetFont() &&
+/*N*/ SW_CJK == rInf.GetFont()->GetActual() )
+/*N*/ {
+/*?*/ GETGRID( rInf.GetFrm()->FindPageFrm() )
+/*?*/ if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() )
+/*?*/ {
+/*?*/ const USHORT nGridWidth = pGrid->GetBaseHeight();
+/*?*/
+/*?*/ OutputDevice* pOutDev;
+/*?*/
+/*?*/ if ( pPrinter )
+/*?*/ {
+/*?*/ if( !pPrtFont->IsSameInstance( pPrinter->GetFont() ) )
+/*?*/ pPrinter->SetFont(*pPrtFont);
+/*?*/ pOutDev = pPrinter;
+/*?*/ }
+/*?*/ else
+/*?*/ pOutDev = rInf.GetpOut();
+/*?*/
+/*?*/ aTxtSize.Width() =
+/*?*/ pOutDev->GetTextWidth( rInf.GetText(), rInf.GetIdx(), nLn );
+/*?*/ aTxtSize.Height() = pOutDev->GetTextHeight() + nLeading;
+/*?*/
+/*?*/ long nWidthPerChar = aTxtSize.Width() / nLn;
+/*?*/
+/*?*/ const ULONG i = nWidthPerChar ?
+/*?*/ ( nWidthPerChar - 1 ) / nGridWidth + 1:
+/*?*/ 1;
+/*?*/
+/*?*/ aTxtSize.Width() = i * nGridWidth * nLn;
+/*?*/
+/*?*/ rInf.SetKanaDiff( 0 );
+/*?*/ return aTxtSize;
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ const BOOL bCompress = rInf.GetKanaComp() && nLn &&
+/*N*/ rInf.GetFont() &&
+/*N*/ SW_CJK == rInf.GetFont()->GetActual() &&
+/*N*/ rInf.GetScriptInfo() &&
+/*N*/ rInf.GetScriptInfo()->CountCompChg() &&
+/*N*/ lcl_IsMonoSpaceFont( rInf.GetpOut() );
+/*N*/
+/*N*/ ASSERT( !bCompress || ( rInf.GetScriptInfo() && rInf.GetScriptInfo()->
+/*N*/ CountCompChg()), "Compression without info" );
+/*N*/
+/*N*/ // This is the part used e.g., for cursor travelling
+/*N*/ // See condition for DrawText or DrawTextArray (bDirectPrint)
+/*N*/ if ( pPrinter && pPrinter != rInf.GetpOut() )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pPrtFont->IsSameInstance( rInf.GetpOut()->GetFont() ) )
+/*N*/ rInf.GetpOut()->SetFont( *pPrtFont );
+/*N*/ if( bCompress )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ aTxtSize.Width() = rInf.GetpOut()->GetTextWidth( rInf.GetText(),
+/*N*/ rInf.GetIdx(), nLn );
+/*N*/ rInf.SetKanaDiff( 0 );
+/*N*/ }
+/*N*/
+/*N*/ aTxtSize.Height() = rInf.GetpOut()->GetTextHeight();
+/*N*/ }
+/*N*/
+/*N*/ if ( rInf.GetKern() && nLn )
+/*N*/ aTxtSize.Width() += ( nLn - 1 ) * long( rInf.GetKern() );
+/*N*/
+/*N*/ aTxtSize.Height() += nLeading;
+/*N*/ return aTxtSize;
+/*N*/ }
+
+
+
+
+/*************************************************************************
+|*
+|* SwFntAccess::SwFntAccess()
+|*
+|* Ersterstellung AMA 9. Nov. 94
+|* Letzte Aenderung AMA 9. Nov. 94
+|*
+|*************************************************************************/
+
+/*N*/ SwFntAccess::SwFntAccess( const void* &rMagic,
+/*N*/ USHORT &rIndex, const void *pOwner, ViewShell *pSh,
+/*N*/ BOOL bCheck ) :
+/*N*/ SwCacheAccess( *pFntCache, rMagic, rIndex ),
+/*N*/ pShell( pSh )
+/*N*/ {
+/*N*/ // Der benutzte CTor von SwCacheAccess sucht anhand rMagic+rIndex im Cache
+/*N*/ if ( IsAvail() )
+/*N*/ {
+/*N*/ // Der schnellste Fall: ein bekannter Font ( rMagic ),
+/*N*/ // bei dem Drucker und Zoom nicht ueberprueft werden brauchen.
+/*N*/ if ( !bCheck )
+/*N*/ return;
+/*N*/
+/*N*/ // Hier ist zwar der Font bekannt, muss aber noch ueberprueft werden.
+/*N*/
+/*N*/ }
+/*N*/ else
+/*N*/ // Hier ist der Font nicht bekannt, muss also gesucht werden.
+/*N*/ bCheck = FALSE;
+/*N*/
+/*N*/
+/*N*/ {
+/*N*/ OutputDevice* pOut = 0;
+/*N*/ USHORT nZoom = USHRT_MAX;
+/*N*/
+/*N*/ // Get the reference device
+/*N*/ if ( pSh )
+/*N*/ {
+/*N*/ pOut = &pSh->GetRefDev();
+/*N*/ nZoom = pSh->GetViewOptions()->GetZoom();
+/*N*/ }
+/*N*/
+/*N*/ SwFntObj *pFntObj;
+/*N*/ if ( bCheck )
+/*N*/ {
+/*N*/ pFntObj = Get();
+/*N*/ if ( ( pFntObj->GetZoom( ) == nZoom ) &&
+/*N*/ ( pFntObj->pPrinter == pOut ) &&
+/*N*/ pFntObj->GetPropWidth() ==
+/*N*/ ((SwSubFont*)pOwner)->GetPropWidth() )
+/*N*/ return; // Die Ueberpruefung ergab: Drucker+Zoom okay.
+/*N*/ pFntObj->Unlock( ); // Vergiss dies Objekt, es wurde leider
+/*N*/ pObj = NULL; // eine Drucker/Zoomaenderung festgestellt.
+/*N*/ }
+/*N*/
+/*N*/ // Search by font comparison, quite expensive!
+/*N*/ // Look for same font and same printer
+/*N*/ pFntObj = pFntCache->First();
+/*N*/ while ( pFntObj && !( pFntObj->aFont == *(Font *)pOwner &&
+/*N*/ pFntObj->GetZoom() == nZoom &&
+/*N*/ pFntObj->GetPropWidth() ==
+/*N*/ ((SwSubFont*)pOwner)->GetPropWidth() &&
+/*N*/ ( !pFntObj->pPrinter || pFntObj->pPrinter == pOut ) ) )
+/*N*/ pFntObj = pFntCache->Next( pFntObj );
+/*N*/
+/*N*/ if( pFntObj && pFntObj->pPrinter != pOut )
+/*N*/ {
+/*N*/ // Wir haben zwar einen ohne Drucker gefunden, mal sehen, ob es
+/*N*/ // auch noch einen mit identischem Drucker gibt.
+/*N*/ SwFntObj *pTmpObj = pFntObj;
+/*N*/ while( pTmpObj && !( pTmpObj->aFont == *(Font *)pOwner &&
+/*N*/ pTmpObj->GetZoom()==nZoom && pTmpObj->pPrinter==pOut &&
+/*N*/ pTmpObj->GetPropWidth() ==
+/*N*/ ((SwSubFont*)pOwner)->GetPropWidth() ) )
+/*N*/ pTmpObj = pFntCache->Next( pTmpObj );
+/*N*/ if( pTmpObj )
+/*N*/ pFntObj = pTmpObj;
+/*N*/ }
+/*N*/
+/*N*/ if ( !pFntObj ) // Font has not been found, create one
+/*N*/ {
+/*N*/ // Das Objekt muss neu angelegt werden, deshalb muss der Owner ein
+/*N*/ // SwFont sein, spaeter wird als Owner die "MagicNumber" gehalten.
+/*N*/ SwCacheAccess::pOwner = pOwner;
+/*N*/ pFntObj = Get(); // hier wird via NewObj() angelegt und gelockt.
+/*N*/ ASSERT(pFntObj, "No Font, no Fun.");
+/*N*/ }
+/*N*/ else // Font has been found, so we lock it.
+/*N*/ {
+/*N*/ pFntObj->Lock();
+/*N*/ if( pFntObj->pPrinter != pOut ) // Falls bis dato kein Drucker bekannt
+/*N*/ {
+/*N*/ ASSERT( !pFntObj->pPrinter, "SwFntAccess: Printer Changed" );
+/*N*/ pFntObj->CreatePrtFont( *pOut );
+/*N*/ pFntObj->pPrinter = pOut;
+/*N*/ pFntObj->pScrFont = NULL;
+/*N*/ pFntObj->nLeading = USHRT_MAX;
+/*N*/ pFntObj->nPrtAscent = USHRT_MAX;
+/*N*/ pFntObj->nPrtHeight = USHRT_MAX;
+/*N*/ }
+/*N*/ pObj = pFntObj;
+/*N*/ }
+/*N*/
+/*N*/ // egal, ob neu oder gefunden, ab jetzt ist der Owner vom Objekt eine
+/*N*/ // MagicNumber und wird auch dem aufrufenden SwFont bekanntgegeben,
+/*N*/ // ebenso der Index fuer spaetere direkte Zugriffe
+/*N*/ rMagic = pFntObj->GetOwner();
+/*N*/ SwCacheAccess::pOwner = rMagic;
+/*N*/ rIndex = pFntObj->GetCachePos();
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwCacheObj *SwFntAccess::NewObj( )
+/*N*/ {
+/*N*/ // Ein neuer Font, eine neue "MagicNumber".
+/*N*/ return new SwFntObj( *(SwSubFont *)pOwner, ++pMagicNo, pShell );
+/*N*/ }
+
+/*N*/ extern xub_StrLen lcl_CalcCaseMap( const SwFont& rFnt,
+/*N*/ const XubString& rOrigString,
+/*N*/ xub_StrLen nOfst,
+/*N*/ xub_StrLen nLen,
+/*N*/ xub_StrLen nIdx );
+
+/*N*/ xub_StrLen SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
+/*N*/ {
+/*N*/ ChgFnt( rInf.GetShell(), rInf.GetpOut() );
+/*N*/
+/*N*/ const BOOL bCompress = rInf.GetKanaComp() && rInf.GetLen() &&
+/*N*/ SW_CJK == GetActual() &&
+/*N*/ rInf.GetScriptInfo() &&
+/*N*/ rInf.GetScriptInfo()->CountCompChg() &&
+/*N*/ lcl_IsMonoSpaceFont( rInf.GetpOut() );
+/*N*/
+/*N*/ ASSERT( !bCompress || ( rInf.GetScriptInfo() && rInf.GetScriptInfo()->
+/*N*/ CountCompChg()), "Compression without info" );
+/*N*/
+/*N*/ USHORT nTxtBreak = 0;
+/*N*/ long nKern = 0;
+/*N*/
+/*N*/ USHORT nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
+/*N*/ : rInf.GetLen() );
+/*N*/
+/*N*/ if ( rInf.GetFrm() && nLn && rInf.SnapToGrid() &&
+/*N*/ rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() )
+/*N*/ {
+/*?*/ GETGRID( rInf.GetFrm()->FindPageFrm() )
+/*?*/ if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() )
+/*?*/ {
+/*?*/ const USHORT nGridWidth = pGrid->GetBaseHeight();
+/*?*/
+/*?*/ sal_Int32* pKernArray = new sal_Int32[rInf.GetLen()];
+/*?*/ rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray,
+/*?*/ rInf.GetIdx(), rInf.GetLen() );
+/*?*/
+/*?*/ long nWidthPerChar = pKernArray[ rInf.GetLen() - 1 ] / rInf.GetLen();
+/*?*/
+/*?*/ const ULONG i = nWidthPerChar ?
+/*?*/ ( nWidthPerChar - 1 ) / nGridWidth + 1:
+/*?*/ 1;
+/*?*/
+/*?*/ nWidthPerChar = i * nGridWidth;
+/*?*/ long nCurrPos = nWidthPerChar;
+/*?*/
+/*?*/ while( nTxtBreak < rInf.GetLen() && nTextWidth >= nCurrPos )
+/*?*/ {
+/*?*/ nCurrPos += nWidthPerChar;
+/*?*/ ++nTxtBreak;
+/*?*/ }
+/*?*/
+/*?*/ delete[] pKernArray;
+/*?*/ return nTxtBreak + rInf.GetIdx();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( aSub[nActual].IsCapital() && nLn )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 nTxtBreak = GetCapitalBreak( rInf.GetShell(), rInf.GetpOut(),
+/*N*/ else
+/*N*/ {
+/*N*/ nKern = CheckKerning();
+/*N*/
+/*N*/ const XubString* pTmpText;
+/*N*/ XubString aTmpText;
+/*N*/ xub_StrLen nTmpIdx;
+/*N*/ xub_StrLen nTmpLen;
+/*N*/ bool bTextReplaced = false;
+/*N*/
+/*N*/ if ( !aSub[nActual].IsCaseMap() )
+/*N*/ {
+/*N*/ pTmpText = &rInf.GetText();
+/*N*/ nTmpIdx = rInf.GetIdx();
+/*N*/ nTmpLen = nLn;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const XubString aSnippet( rInf.GetText(), rInf.GetIdx(), nLn );
+/*N*/ aTmpText = aSub[nActual].CalcCaseMap( aSnippet );
+/*N*/ const bool bTitle = SVX_CASEMAP_TITEL == aSub[nActual].GetCaseMap() &&
+/*N*/ pBreakIt->xBreak.is();
+/*N*/
+/*N*/ // Uaaaaahhhh!!! In title case mode, we would get wrong results
+/*N*/ if ( bTitle && nLn )
+/*N*/ {
+/*N*/ // check if rInf.GetIdx() is begin of word
+/*N*/ if ( !pBreakIt->xBreak->isBeginWord(
+/*N*/ rInf.GetText(), rInf.GetIdx(),
+/*N*/ pBreakIt->GetLocale( aSub[nActual].GetLanguage() ),
+/*N*/ ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES ) )
+/*N*/ {
+/*N*/ // In this case, the beginning of aTmpText is wrong.
+/*N*/ XubString aSnippetTmp( aSnippet, 0, 1 );
+/*N*/ aSnippetTmp = aSub[nActual].CalcCaseMap( aSnippetTmp );
+/*N*/ aTmpText.Erase( 0, aSnippetTmp.Len() );
+/*N*/ aTmpText.Insert( aSnippet.GetChar( 0 ), 0 );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ pTmpText = &aTmpText;
+/*N*/ nTmpIdx = 0;
+/*N*/ nTmpLen = aTmpText.Len();
+/*N*/ bTextReplaced = true;
+/*N*/ }
+/*N*/
+/*N*/ if( rInf.GetHyphPos() )
+/*N*/ nTxtBreak = rInf.GetpOut()->GetTextBreak( *pTmpText, nTextWidth,
+/*N*/ '-', *rInf.GetHyphPos(),
+/*N*/ nTmpIdx, nTmpLen, nKern );
+/*N*/ else
+/*N*/ nTxtBreak = rInf.GetpOut()->GetTextBreak( *pTmpText, nTextWidth,
+/*N*/ nTmpIdx, nTmpLen, nKern );
+/*N*/
+/*N*/ if ( bTextReplaced && STRING_LEN != nTxtBreak )
+/*N*/ {
+/*N*/ if ( nTmpLen != nLn )
+/*N*/ nTxtBreak = lcl_CalcCaseMap( *this, rInf.GetText(),
+/*N*/ rInf.GetIdx(), nLn, nTxtBreak );
+/*N*/ else
+/*N*/ nTxtBreak += rInf.GetIdx();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( ! bCompress )
+/*N*/ return nTxtBreak;
+/*N*/
+/*N*/ nTxtBreak -= rInf.GetIdx();
+/*N*/
+/*N*/ if( nTxtBreak < nLn )
+/*N*/ {
+/*N*/ if( !nTxtBreak && nLn )
+/*N*/ nLn = 1;
+/*N*/ else if( nLn > 2 * nTxtBreak )
+/*N*/ nLn = 2 * nTxtBreak;
+/*N*/ sal_Int32 *pKernArray = new sal_Int32[ nLn ];
+/*N*/ rInf.GetOut().GetTextArray( rInf.GetText(), pKernArray,
+/*N*/ rInf.GetIdx(), nLn );
+/*N*/ if( rInf.GetScriptInfo()->Compress( pKernArray, rInf.GetIdx(), nLn,
+/*N*/ rInf.GetKanaComp(), (USHORT)GetHeight( nActual ) ) )
+/*N*/ {
+/*N*/ long nKernAdd = nKern;
+/*N*/ xub_StrLen nTmpBreak = nTxtBreak;
+/*N*/ if( nKern && nTxtBreak )
+/*N*/ nKern *= nTxtBreak - 1;
+/*N*/ while( nTxtBreak<nLn && nTextWidth >= pKernArray[nTxtBreak] +nKern )
+/*N*/ {
+/*N*/ nKern += nKernAdd;
+/*N*/ ++nTxtBreak;
+/*N*/ }
+/*N*/ if( rInf.GetHyphPos() )
+/*N*/ *rInf.GetHyphPos() += nTxtBreak - nTmpBreak; // It's not perfect
+/*N*/ }
+/*N*/ delete[] pKernArray;
+/*N*/ }
+/*N*/ nTxtBreak += rInf.GetIdx();
+/*N*/
+/*N*/ return nTxtBreak;
+/*N*/ }
+
+extern Color aGlobalRetoucheColor;
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_fntcap.cxx b/binfilter/bf_sw/source/core/txtnode/sw_fntcap.cxx
new file mode 100644
index 000000000000..7c95478fac76
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_fntcap.cxx
@@ -0,0 +1,550 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+
+#include <com/sun/star/i18n/CharType.hdl>
+#include <com/sun/star/i18n/WordType.hdl>
+
+#include <vcl/print.hxx>
+
+#include <fntcache.hxx>
+#include <swfont.hxx>
+#include <breakit.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star::i18n;
+
+
+#define KAPITAELCHENPROP 80
+/*************************************************************************
+ * class SwCapitalInfo
+ *
+ * The information encapsulated in SwCapitalInfo is required
+ * by the ::Do functions. They contain the information about
+ * the original string, whereas rDo.GetInf() contains information
+ * about the display string.
+ *************************************************************************/
+
+class SwCapitalInfo
+{
+public:
+ explicit SwCapitalInfo( const XubString& rOrigText ) :
+ rString( rOrigText ), nIdx( 0 ), nLen( 0 ) {};
+ const XubString& rString;
+ xub_StrLen nIdx;
+ xub_StrLen nLen;
+};
+
+/*************************************************************************
+ * xub_StrLen lcl_CalcCaseMap()
+ *
+ * rFnt: required for CalcCaseMap
+ * rOrigString: The original string
+ * nOfst: Position of the substring in rOrigString
+ * nLen: Length if the substring in rOrigString
+ * nIdx: Referes to a position in the display string and should be mapped
+ * to a position in rOrigString
+ *************************************************************************/
+
+xub_StrLen lcl_CalcCaseMap( const SwFont& rFnt,
+ const XubString& rOrigString,
+ xub_StrLen nOfst,
+ xub_StrLen nLen,
+ xub_StrLen nIdx )
+{
+ int j = 0;
+ const xub_StrLen nEnd = nOfst + nLen;
+ ASSERT( nEnd <= rOrigString.Len(), "lcl_CalcCaseMap: Wrong parameters" )
+
+ // special case for title case:
+ const bool bTitle = SVX_CASEMAP_TITEL == rFnt.GetCaseMap() &&
+ pBreakIt->xBreak.is();
+ for ( int i = nOfst; i < nEnd; ++i )
+ {
+ XubString aTmp( rOrigString, i, 1 );
+
+ if ( !bTitle ||
+ pBreakIt->xBreak->isBeginWord(
+ rOrigString, i,
+ pBreakIt->GetLocale( rFnt.GetLanguage() ),
+ WordType::ANYWORD_IGNOREWHITESPACES ) )
+ aTmp = rFnt.GetActualFont().CalcCaseMap( aTmp );
+
+ j += aTmp.Len();
+
+ if ( j > nIdx )
+ return i;
+ }
+
+ return nOfst + nLen;
+}
+
+/*************************************************************************
+ * class SwDoCapitals
+ *************************************************************************/
+
+class SwDoCapitals
+{
+protected:
+ SwDrawTextInfo &rInf;
+ SwCapitalInfo* pCapInf; // referes to additional information
+ // required by the ::Do function
+public:
+ SwDoCapitals ( SwDrawTextInfo &rInfo ) : rInf( rInfo ), pCapInf( 0 ) { }
+ virtual void Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont ) = 0;
+ virtual void Do() = 0;
+ inline OutputDevice *GetOut() { return rInf.GetpOut(); }
+ inline SwDrawTextInfo& GetInf() { return rInf; }
+ inline SwCapitalInfo* GetCapInf() const { return pCapInf; }
+ inline void SetCapInf( SwCapitalInfo& rNew ) { pCapInf = &rNew; }
+};
+
+/*************************************************************************
+ * class SwDoGetCapitalSize
+ *************************************************************************/
+
+class SwDoGetCapitalSize : public SwDoCapitals
+{
+protected:
+ Size aTxtSize;
+public:
+ SwDoGetCapitalSize( SwDrawTextInfo &rInfo ) : SwDoCapitals ( rInfo ) { }
+ virtual void Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont );
+ virtual void Do();
+ const Size &GetSize() const { return aTxtSize; }
+};
+
+/*N*/ void SwDoGetCapitalSize::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont )
+/*N*/ {
+/*N*/ aTxtSize.Height() = 0;
+/*N*/ aTxtSize.Width() = 0;
+/*N*/ }
+
+/*N*/ void SwDoGetCapitalSize::Do()
+/*N*/ {
+/*N*/ aTxtSize.Width() += rInf.GetSize().Width();
+/*N*/ if( rInf.GetUpper() )
+/*N*/ aTxtSize.Height() = rInf.GetSize().Height();
+/*N*/ }
+
+/*************************************************************************
+ * SwSubFont::GetCapitalSize()
+ *************************************************************************/
+
+/*N*/ Size SwSubFont::GetCapitalSize( SwDrawTextInfo& rInf )
+/*N*/ {
+/*N*/ // Start:
+/*N*/ short nOldKern = rInf.GetKern();
+/*N*/ rInf.SetKern( CheckKerning() );
+/*N*/ Point aPos;
+/*N*/ rInf.SetPos( aPos );
+/*N*/ rInf.SetSpace( 0 );
+/*N*/ rInf.SetDrawSpace( FALSE );
+/*N*/ SwDoGetCapitalSize aDo( rInf );
+/*N*/ DoOnCapitals( aDo );
+/*N*/ Size aTxtSize( aDo.GetSize() );
+/*N*/
+/*N*/ // End:
+/*N*/ if( !aTxtSize.Height() )
+/*N*/ {
+/*N*/ SV_STAT( nGetTextSize );
+/*N*/ aTxtSize.Height() = short ( rInf.GetpOut()->GetTextHeight() );
+/*N*/ }
+/*N*/ rInf.SetKern( nOldKern );
+/*N*/ return aTxtSize;
+/*N*/ }
+
+/*************************************************************************
+ * class SwDoGetCapitalBreak
+ *************************************************************************/
+
+class SwDoGetCapitalBreak : public SwDoCapitals
+{
+protected:
+ xub_StrLen *pExtraPos;
+ long nTxtWidth;
+ xub_StrLen nBreak;
+public:
+ SwDoGetCapitalBreak( SwDrawTextInfo &rInfo, long nWidth, xub_StrLen *pExtra)
+ : SwDoCapitals ( rInfo ), nTxtWidth( nWidth ),
+ nBreak( STRING_LEN ), pExtraPos( pExtra )
+ { }
+ xub_StrLen GetBreak() const { return nBreak; }
+};
+
+
+
+/*************************************************************************
+ * SwFont::GetCapitalBreak()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwDoDrawCapital
+ *************************************************************************/
+
+class SwDoDrawCapital : public SwDoCapitals
+{
+protected:
+ SwFntObj *pUpperFnt;
+ SwFntObj *pLowerFnt;
+public:
+ SwDoDrawCapital( SwDrawTextInfo &rInfo ) :
+ SwDoCapitals( rInfo )
+ { }
+};
+
+
+
+/*************************************************************************
+ * SwDoDrawCapital::DrawSpace()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwSubFont::DrawCapital()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwDoDrawCapital
+ *************************************************************************/
+
+class SwDoCapitalCrsrOfst : public SwDoCapitals
+{
+protected:
+ SwFntObj *pUpperFnt;
+ SwFntObj *pLowerFnt;
+ xub_StrLen nCrsr;
+ USHORT nOfst;
+public:
+ SwDoCapitalCrsrOfst( SwDrawTextInfo &rInfo, const USHORT nOfs ) :
+ SwDoCapitals( rInfo ), nOfst( nOfs ), nCrsr( 0 )
+ { }
+
+ void DrawSpace( const Point &rPos );
+ inline xub_StrLen GetCrsr(){ return nCrsr; }
+};
+
+
+
+/*************************************************************************
+ * SwSubFont::GetCapitalCrsrOfst()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * class SwDoDrawStretchCapital
+ *************************************************************************/
+
+class SwDoDrawStretchCapital : public SwDoDrawCapital
+{
+ const xub_StrLen nStrLen;
+ const USHORT nCapWidth;
+ const USHORT nOrgWidth;
+public:
+
+ SwDoDrawStretchCapital( SwDrawTextInfo &rInfo, const USHORT nCapWidth )
+ : SwDoDrawCapital( rInfo ),
+ nCapWidth( nCapWidth ),
+ nOrgWidth( rInfo.GetWidth() ),
+ nStrLen( rInfo.GetLen() )
+ { }
+};
+
+/*************************************************************************
+ * SwDoDrawStretchCapital
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwSubFont::DrawStretchCapital()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwSubFont::DoOnCapitals() const
+ *************************************************************************/
+
+// JP 22.8.2001 - global optimization off - Bug 91245 / 91223
+#ifdef _MSC_VER
+#pragma optimize("g",off)
+#endif
+
+/*N*/ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
+/*N*/ {
+/*N*/ ASSERT( pLastFont, "SwFont::DoOnCapitals: No LastFont?!" );
+/*N*/
+/*N*/ Size aPartSize;
+/*N*/ long nKana = 0;
+/*N*/ const XubString aTxt( CalcCaseMap( rDo.GetInf().GetText() ) );
+/*N*/ xub_StrLen nMaxPos = Min( USHORT(rDo.GetInf().GetText().Len()
+/*N*/ - rDo.GetInf().GetIdx()), rDo.GetInf().GetLen() );
+/*N*/ rDo.GetInf().SetLen( nMaxPos );
+/*N*/
+/*N*/ const XubString& rOldText = rDo.GetInf().GetText();
+/*N*/ rDo.GetInf().SetText( aTxt );
+/*N*/ rDo.GetInf().SetSize( aPartSize );
+/*N*/ xub_StrLen nPos = rDo.GetInf().GetIdx();
+/*N*/ xub_StrLen nOldPos = nPos;
+/*N*/ nMaxPos += nPos;
+/*N*/
+/*N*/ // #107816#
+/*N*/ // Look if the length of the original text and the ToUpper-converted
+/*N*/ // text is different. If yes, do special handling.
+/*N*/ XubString aNewText;
+/*N*/ SwCapitalInfo aCapInf( rOldText );
+/*N*/ sal_Bool bCaseMapLengthDiffers( aTxt.Len() != rOldText.Len() );
+/*N*/ if ( bCaseMapLengthDiffers )
+/*N*/ rDo.SetCapInf( aCapInf );
+/*N*/
+/*N*/ SwFntObj *pOldLast = pLastFont;
+/*N*/ SwFntAccess *pBigFontAccess = NULL;
+/*N*/ SwFntObj *pBigFont;
+/*N*/ SwFntAccess *pSpaceFontAccess = NULL;
+/*N*/ SwFntObj *pSpaceFont = NULL;
+/*N*/
+/*N*/ const void *pMagic2 = NULL;
+/*N*/ USHORT nIndex2 = 0;
+/*N*/ SwSubFont aFont( *this );
+/*N*/ Point aStartPos( rDo.GetInf().GetPos() );
+/*N*/
+/*N*/ const BOOL bUnderStriked = aFont.GetUnderline() != UNDERLINE_NONE
+/*N*/ || aFont.GetStrikeout() != STRIKEOUT_NONE;
+/*N*/ const BOOL bWordWise = bUnderStriked && aFont.IsWordLineMode() &&
+/*N*/ rDo.GetInf().GetDrawSpace();
+/*N*/ const short nKern = rDo.GetInf().GetKern();
+/*N*/
+/*N*/ if ( bUnderStriked )
+/*N*/ {
+/*N*/ if ( bWordWise )
+/*N*/ {
+/*?*/ aFont.SetWordLineMode( FALSE );
+/*?*/ pSpaceFontAccess = new SwFntAccess( pMagic2, nIndex2, &aFont,
+/*?*/ rDo.GetInf().GetShell() );
+/*?*/ pSpaceFont = pSpaceFontAccess->Get();
+/*N*/ }
+/*N*/ else
+/*N*/ pSpaceFont = pLastFont;
+/*N*/
+/*N*/ // Wir basteln uns einen Font fuer die Grossbuchstaben:
+/*N*/ aFont.SetUnderline( UNDERLINE_NONE );
+/*N*/ aFont.SetStrikeout( STRIKEOUT_NONE );
+/*N*/ pMagic2 = NULL;
+/*N*/ nIndex2 = 0;
+/*N*/ pBigFontAccess = new SwFntAccess( pMagic2, nIndex2, &aFont,
+/*N*/ rDo.GetInf().GetShell() );
+/*N*/ pBigFont = pBigFontAccess->Get();
+/*N*/ }
+/*N*/ else
+/*N*/ pBigFont = pLastFont;
+/*N*/
+/*N*/ // Hier entsteht der Kleinbuchstabenfont:
+/*N*/ aFont.SetProportion( BYTE( (aFont.GetPropr()*KAPITAELCHENPROP) / 100L) );
+/*N*/ pMagic2 = NULL;
+/*N*/ nIndex2 = 0;
+/*N*/ SwFntAccess *pSmallFontAccess = new SwFntAccess( pMagic2, nIndex2, &aFont,
+/*N*/ rDo.GetInf().GetShell() );
+/*N*/ SwFntObj *pSmallFont = pSmallFontAccess->Get();
+/*N*/
+/*N*/ rDo.Init( pBigFont, pSmallFont );
+/*N*/ OutputDevice* pOutSize = pSmallFont->GetPrt();
+/*N*/ if( !pOutSize )
+/*N*/ pOutSize = rDo.GetOut();
+/*N*/ OutputDevice* pOldOut = rDo.GetOut();
+/*N*/
+/*N*/ const LanguageType eLng = LANGUAGE_DONTKNOW == GetLanguage()
+/*N*/ ? LANGUAGE_SYSTEM : GetLanguage();
+/*N*/
+/*N*/ if( nPos < nMaxPos )
+/*N*/ {
+/*N*/ nPos = (xub_StrLen)pBreakIt->xBreak->endOfCharBlock( rOldText, nPos,
+/*N*/ pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
+/*N*/ if( nPos == STRING_LEN )
+/*N*/ nPos = nOldPos;
+/*N*/ else if( nPos > nMaxPos )
+/*N*/ nPos = nMaxPos;
+/*N*/ }
+/*N*/
+/*N*/ while( nOldPos < nMaxPos )
+/*N*/ {
+/*N*/
+/*N*/ // The lower ones...
+/*N*/ if( nOldPos != nPos )
+/*N*/ {
+/*N*/ SV_STAT( nGetTextSize );
+/*N*/ pLastFont = pSmallFont;
+/*N*/ pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() );
+/*N*/
+/*N*/ // #107816#, #i14820#
+/*N*/ if( bCaseMapLengthDiffers )
+/*N*/ {
+/*N*/ // Build an own 'changed' string for the given part of the
+/*N*/ // source string and use it. That new string may differ in length
+/*N*/ // from the source string.
+/*N*/ const XubString aSnippet( rOldText, nOldPos, nPos - nOldPos);
+/*N*/ aNewText = CalcCaseMap( aSnippet );
+/*N*/ aCapInf.nIdx = nOldPos;
+/*N*/ aCapInf.nLen = nPos - nOldPos;
+/*N*/ rDo.GetInf().SetIdx( 0 );
+/*N*/ rDo.GetInf().SetLen( aNewText.Len() );
+/*N*/ rDo.GetInf().SetText( aNewText );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rDo.GetInf().SetIdx( nOldPos );
+/*N*/ rDo.GetInf().SetLen( nPos - nOldPos );
+/*N*/ }
+/*N*/
+/*N*/ rDo.GetInf().SetUpper( FALSE );
+/*N*/ rDo.GetInf().SetOut( *pOutSize );
+/*N*/ aPartSize = pSmallFont->GetTextSize( rDo.GetInf() );
+/*N*/ nKana += rDo.GetInf().GetKanaDiff();
+/*N*/ rDo.GetInf().SetOut( *pOldOut );
+/*N*/ if( nKern && nPos < nMaxPos )
+/*?*/ aPartSize.Width() += nKern;
+/*N*/ rDo.Do();
+/*N*/ nOldPos = nPos;
+/*N*/ }
+/*N*/ nPos = (xub_StrLen)pBreakIt->xBreak->nextCharBlock( rOldText, nPos,
+/*N*/ pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
+/*N*/ if( nPos == STRING_LEN || nPos > nMaxPos )
+/*N*/ nPos = nMaxPos;
+/*N*/ ASSERT( nPos, "nextCharBlock not implemented?" );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( !nPos )
+/*N*/ nPos = nMaxPos;
+/*N*/ #endif
+/*N*/ // The upper ones...
+/*N*/ if( nOldPos != nPos )
+/*N*/ {
+/*N*/ do
+/*N*/ {
+/*N*/ rDo.GetInf().SetUpper( TRUE );
+/*N*/ pLastFont = pBigFont;
+/*N*/ pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() );
+/*N*/ xub_StrLen nTmp;
+/*N*/ if( bWordWise )
+/*N*/ {
+/*?*/ nTmp = nOldPos;
+/*?*/ while( nTmp < nPos && CH_BLANK == rOldText.GetChar( nTmp ) )
+/*?*/ ++nTmp;
+/*?*/ if( nOldPos < nTmp )
+/*?*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pLastFont = pSpaceFont;
+/*?*/ }
+/*?*/ while( nTmp < nPos && CH_BLANK != rOldText.GetChar( nTmp ) )
+/*?*/ ++nTmp;
+/*N*/ }
+/*N*/ else
+/*N*/ nTmp = nPos;
+/*N*/ if( nTmp > nOldPos )
+/*N*/ {
+/*N*/ // #107816#, #i14820#
+/*N*/ if( bCaseMapLengthDiffers )
+/*N*/ {
+/*N*/ // Build an own 'changed' string for the given part of the
+/*N*/ // source string and use it. That new string may differ in length
+/*N*/ // from the source string.
+/*N*/ const XubString aSnippet( rOldText, nOldPos, nTmp - nOldPos);
+/*N*/ aNewText = CalcCaseMap( aSnippet );
+/*N*/ aCapInf.nIdx = nOldPos;
+/*N*/ aCapInf.nLen = nTmp - nOldPos;
+/*N*/ rDo.GetInf().SetIdx( 0 );
+/*N*/ rDo.GetInf().SetLen( aNewText.Len() );
+/*N*/ rDo.GetInf().SetText( aNewText );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rDo.GetInf().SetIdx( nOldPos );
+/*N*/ rDo.GetInf().SetLen( nPos - nOldPos );
+/*N*/ }
+/*N*/
+/*N*/ rDo.GetInf().SetOut( *pOutSize );
+/*N*/ aPartSize = pBigFont->GetTextSize( rDo.GetInf() );
+/*N*/ nKana += rDo.GetInf().GetKanaDiff();
+/*N*/ rDo.GetInf().SetOut( *pOldOut );
+/*N*/ if( !bWordWise && rDo.GetInf().GetSpace() )
+/*?*/ for( xub_StrLen nI = nOldPos; nI < nPos; ++nI )
+/*?*/ if( CH_BLANK == rOldText.GetChar( nI ) )
+/*?*/ aPartSize.Width() += rDo.GetInf().GetSpace();
+/*N*/ if( nKern && nPos < nMaxPos )
+/*?*/ aPartSize.Width() += nKern;
+/*N*/ rDo.Do();
+/*N*/ nOldPos = nTmp;
+/*N*/ }
+/*N*/ } while( nOldPos != nPos );
+/*N*/ }
+/*N*/ nPos = (xub_StrLen)pBreakIt->xBreak->endOfCharBlock( rOldText, nPos,
+/*N*/ pBreakIt->GetLocale( eLng ), CharType::LOWERCASE_LETTER);
+/*N*/ if( nPos == STRING_LEN || nPos > nMaxPos )
+/*N*/ nPos = nMaxPos;
+/*N*/ ASSERT( nPos, "endOfCharBlock not implemented?" );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( !nPos )
+/*N*/ nPos = nMaxPos;
+/*N*/ #endif
+/*N*/ }
+/*N*/
+/*N*/ // Aufraeumen:
+/*N*/ if( pBigFont != pOldLast )
+/*N*/ delete pBigFontAccess;
+/*N*/
+/*N*/ if( bUnderStriked )
+/*N*/ {
+/*N*/ if( rDo.GetInf().GetDrawSpace() )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pLastFont = pSpaceFont;
+/*N*/ }
+/*N*/ if ( bWordWise )
+/*?*/ delete pSpaceFontAccess;
+/*N*/ }
+/*N*/ pLastFont = pOldLast;
+/*N*/ pLastFont->SetDevFont( rDo.GetInf().GetShell(), rDo.GetOut() );
+/*N*/
+/*N*/ delete pSmallFontAccess;
+/*N*/ rDo.GetInf().SetText( rOldText );
+/*N*/ rDo.GetInf().SetKanaDiff( nKana );
+/*N*/ }
+
+// JP 22.8.2001 - global optimization off - Bug 91245 / 91223
+#ifdef _MSC_VER
+#pragma optimize("g",on)
+#endif
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_ndhints.cxx b/binfilter/bf_sw/source/core/txtnode/sw_ndhints.cxx
new file mode 100644
index 000000000000..9ebfb8f2b7d3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_ndhints.cxx
@@ -0,0 +1,405 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "txatbase.hxx"
+#include "ndhints.hxx"
+namespace binfilter {
+
+/*N*/ _SV_IMPL_SORTAR_ALG( SwpHtStart, SwTxtAttr* )
+/*N*/ _SV_IMPL_SORTAR_ALG( SwpHtEnd, SwTxtAttr* )
+
+#ifdef NIE
+
+/*N*/ void DumpHints( const SwpHtStart &rHtStart,
+/*N*/ const SwpHtEnd &rHtEnd )
+/*N*/ {
+#ifdef DBG_UTIL
+ DBG_BF_ASSERT(0, "STRIP");//STRIP001 aDbstream << "DumpHints:" << endl;
+/*N*/ #endif
+/*N*/ }
+/*N*/ #else
+/*N*/ inline void DumpHints(const SwpHtStart &, const SwpHtEnd &) { }
+/*N*/ #endif
+
+/*************************************************************************
+ * inline IsEqual()
+ *************************************************************************/
+
+/*N*/ inline BOOL IsEqual( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
+/*N*/ {
+/*N*/ return (long)(&rHt1) == (long)(&rHt2);
+/*N*/ }
+
+/*************************************************************************
+ * IsLessStart()
+ *************************************************************************/
+
+// SV_IMPL_OP_PTRARR_SORT( SwpHtStart, SwTxtAttr* )
+// kein SV_IMPL_PTRARR_SORT( name,ArrElement )
+// unser SEEK_PTR_TO_OBJECT_NOTL( name,ArrElement )
+
+// Sortierreihenfolge: Start, Ende (umgekehrt!), Which-Wert (umgekehrt!),
+// als letztes die Adresse selbst
+
+/*N*/ BOOL lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
+/*N*/ {
+/*N*/ if ( *rHt1.GetStart() == *rHt2.GetStart() )
+/*N*/ {
+/*N*/ xub_StrLen nHt1 = *rHt1.GetAnyEnd();
+/*N*/ xub_StrLen nHt2 = *rHt2.GetAnyEnd();
+/*N*/ if ( nHt1 == nHt2 )
+/*N*/ {
+/*N*/ nHt1 = rHt1.Which();
+/*N*/ nHt2 = rHt2.Which();
+/*N*/ return nHt1 > nHt2 ||
+/*N*/ (nHt1 == nHt2 && (long)&rHt1 < (long)&rHt2);
+/*N*/ }
+/*N*/ else
+/*N*/ return ( nHt1 > nHt2 );
+/*N*/ }
+/*N*/ return ( *rHt1.GetStart() < *rHt2.GetStart() );
+/*N*/ }
+
+/*************************************************************************
+ * inline IsLessEnd()
+ *************************************************************************/
+
+// Zuerst nach Ende danach nach Ptr
+/*N*/ #ifdef HP9000
+/*N*/ BOOL lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
+/*N*/ #else
+/*N*/ inline BOOL lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
+/*N*/ #endif
+/*N*/ {
+/*N*/ xub_StrLen nHt1 = *rHt1.GetAnyEnd();
+/*N*/ xub_StrLen nHt2 = *rHt2.GetAnyEnd();
+/*N*/ if ( nHt1 == nHt2 )
+/*N*/ {
+/*N*/ if ( *rHt1.GetStart() == *rHt2.GetStart() )
+/*N*/ {
+/*N*/ nHt1 = rHt1.Which();
+/*N*/ nHt2 = rHt2.Which();
+/*N*/ return nHt1 < nHt2 ||
+/*N*/ (nHt1 == nHt2 && (long)&rHt1 > (long)&rHt2);
+/*N*/ }
+/*N*/ else
+/*N*/ return ( *rHt1.GetStart() > *rHt2.GetStart() );
+/*N*/ }
+/*N*/ return ( nHt1 < nHt2 );
+/*N*/ }
+
+/*************************************************************************
+ * SwpHtStart::Seek_Entry()
+ *************************************************************************/
+
+/*N*/ BOOL SwpHtStart::Seek_Entry( const SwTxtAttr *pElement, USHORT *pPos ) const
+/*N*/ {
+/*N*/ register USHORT nOben = Count(), nMitte, nUnten = 0;
+/*N*/ if( nOben > 0 )
+/*N*/ {
+/*N*/ nOben--;
+/*N*/ while( nUnten <= nOben )
+/*N*/ {
+/*N*/ nMitte = nUnten + ( nOben - nUnten ) / 2;
+/*N*/ const SwTxtAttr *pMitte = (*this)[nMitte];
+/*N*/ if( IsEqual( *pMitte, *pElement ) )
+/*N*/ {
+/*N*/ *pPos = nMitte;
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ if( lcl_IsLessStart( *pMitte, *pElement ) )
+/*N*/ nUnten = nMitte + 1;
+/*N*/ else
+/*N*/ if( nMitte == 0 )
+/*N*/ {
+/*N*/ *pPos = nUnten;
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ nOben = nMitte - 1;
+/*N*/ }
+/*N*/ }
+/*N*/ *pPos = nUnten;
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+ * SwpHtEnd::Seek_Entry()
+ *************************************************************************/
+
+/*N*/ BOOL SwpHtEnd::Seek_Entry( const SwTxtAttr *pElement, USHORT *pPos ) const
+/*N*/ {
+/*N*/ register USHORT nOben = Count(), nMitte, nUnten = 0;
+/*N*/ if( nOben > 0 )
+/*N*/ {
+/*N*/ nOben--;
+/*N*/ while( nUnten <= nOben )
+/*N*/ {
+/*N*/ nMitte = nUnten + ( nOben - nUnten ) / 2;
+/*N*/ const SwTxtAttr *pMitte = (*this)[nMitte];
+/*N*/ if( IsEqual( *pMitte, *pElement ) )
+/*N*/ {
+/*N*/ *pPos = nMitte;
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ else
+/*N*/ if( lcl_IsLessEnd( *pMitte, *pElement ) )
+/*N*/ nUnten = nMitte + 1;
+/*N*/ else
+/*N*/ if( nMitte == 0 )
+/*N*/ {
+/*N*/ *pPos = nUnten;
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ else
+/*N*/ nOben = nMitte - 1;
+/*N*/ }
+/*N*/ }
+/*N*/ *pPos = nUnten;
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+ * class SwpHintsArr
+ *************************************************************************/
+
+/*N*/ void SwpHintsArr::Insert( const SwTxtAttr *pHt )
+/*N*/ {
+/*N*/ Resort();
+/*N*/ #ifdef DBG_UTIL
+/*N*/ USHORT nPos;
+/*N*/ ASSERT(!SwpHtStart::Seek_Entry( pHt, &nPos ), "Insert: hint already in HtStart");
+/*N*/ ASSERT(!aHtEnd.Seek_Entry( pHt, &nPos ), "Insert: hint already in HtEnd");
+/*N*/ #endif
+/*N*/ SwpHtStart::Insert( pHt );
+/*N*/ aHtEnd.Insert( pHt );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #ifdef NIE
+/*N*/ (aDbstream << "Insert: " ).WriteNumber( long( pHt ) )<< endl;
+/*N*/ DumpHints( *this, aHtEnd );
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ void SwpHintsArr::DeleteAtPos( const USHORT nPos )
+/*N*/ {
+/*N*/ // Optimierung: nPos bezieht sich auf die Position im StartArray, also:
+/*N*/ const SwTxtAttr *pHt = SwpHtStart::operator[]( nPos );
+/*N*/ SwpHtStart::Remove( nPos );
+/*N*/
+/*N*/ Resort();
+/*N*/
+/*N*/ USHORT nEndPos;
+/*N*/ aHtEnd.Seek_Entry( pHt, &nEndPos );
+/*N*/ aHtEnd.Remove( nEndPos );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #ifdef NIE
+/*N*/ (aDbstream << "DeleteAtPos: " ).WriteNumber( long( pHt ) )<< endl;
+/*N*/ DumpHints( *this, aHtEnd );
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ }
+
+#ifdef DBG_UTIL
+
+/*************************************************************************
+ * SwpHintsArr::Check()
+ *************************************************************************/
+
+
+/*N*/ #define CHECK_ERR(cond, text) \
+/*N*/ if(!(cond)) \
+/*N*/ { \
+/*N*/ ASSERT(!this, text); \
+/*N*/ DumpHints(*(SwpHtStart*)this,aHtEnd); \
+/*N*/ const BOOL bErr = 0 == (cond); /* fuer den CV */ \
+/*N*/ return !((SwpHintsArr*)this)->Resort(); \
+/*N*/ }
+/*N*/
+/*N*/ BOOL SwpHintsArr::Check() const
+/*N*/ {
+/*N*/ // 1) gleiche Anzahl in beiden Arrays
+/*N*/ CHECK_ERR( Count() == aHtEnd.Count(), "HintsCheck: wrong sizes" );
+/*N*/ xub_StrLen nLastStart = 0;
+/*N*/ xub_StrLen nLastEnd = 0;
+/*N*/
+/*N*/ const SwTxtAttr *pLastStart = 0;
+/*N*/ const SwTxtAttr *pLastEnd = 0;
+/*N*/
+/*N*/ for( USHORT i = 0; i < Count(); ++i )
+/*N*/ {
+/*N*/ // --- Start-Kontrolle ---
+/*N*/
+/*N*/ // 2a) gueltiger Pointer? vgl. DELETEFF
+/*N*/ const SwTxtAttr *pHt = (*this)[i];
+/*N*/ CHECK_ERR( 0xFF != *(char*)pHt, "HintsCheck: start ptr was deleted" );
+/*N*/
+/*N*/ // 3a) Stimmt die Start-Sortierung?
+/*N*/ xub_StrLen nIdx = *pHt->GetStart();
+/*N*/ CHECK_ERR( nIdx >= nLastStart, "HintsCheck: starts are unsorted" );
+/*N*/
+/*N*/ // 4a) IsLessStart-Konsistenz
+/*N*/ if( pLastStart )
+/*N*/ CHECK_ERR( lcl_IsLessStart( *pLastStart, *pHt ), "HintsCheck: IsLastStart" );
+/*N*/
+/*N*/ nLastStart = nIdx;
+/*N*/ pLastStart = pHt;
+/*N*/
+/*N*/ // --- End-Kontrolle ---
+/*N*/
+/*N*/ // 2b) gueltiger Pointer? vgl. DELETEFF
+/*N*/ const SwTxtAttr *pHtEnd = aHtEnd[i];
+/*N*/ CHECK_ERR( 0xFF != *(char*)pHtEnd, "HintsCheck: end ptr was deleted" );
+/*N*/
+/*N*/ // 3b) Stimmt die End-Sortierung?
+/*N*/ nIdx = *pHtEnd->GetAnyEnd();
+/*N*/ CHECK_ERR( nIdx >= nLastEnd, "HintsCheck: ends are unsorted" );
+/*N*/ nLastEnd = nIdx;
+/*N*/
+/*N*/ // 4b) IsLessEnd-Konsistenz
+/*N*/ if( pLastEnd )
+/*N*/ CHECK_ERR( lcl_IsLessEnd( *pLastEnd, *pHtEnd ), "HintsCheck: IsLastEnd" );
+/*N*/
+/*N*/ nLastEnd = nIdx;
+/*N*/ pLastEnd = pHtEnd;
+/*N*/
+/*N*/ // --- Ueberkreuzungen ---
+/*N*/
+/*N*/ // 5) gleiche Pointer in beiden Arrays
+/*N*/ nIdx = GetStartOf( pHtEnd );
+/*N*/ CHECK_ERR( STRING_LEN != nIdx, "HintsCheck: no GetStartOf" );
+/*N*/
+/*N*/ // 6) gleiche Pointer in beiden Arrays
+/*N*/ nIdx = GetEndOf( pHt );
+/*N*/ CHECK_ERR( STRING_LEN != nIdx, "HintsCheck: no GetEndOf" );
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+
+#endif /* PRODUCT */
+
+/*************************************************************************
+ * SwpHintsArr::Resort()
+ *************************************************************************/
+
+// Resort() wird vor jedem Insert und Delete gerufen.
+// Wenn Textmasse geloescht wird, so werden die Indizes in
+// ndtxt.cxx angepasst. Leider erfolgt noch keine Neusortierung
+// auf gleichen Positionen.
+
+/*N*/ BOOL SwpHintsArr::Resort()
+/*N*/ {
+/*N*/ BOOL bResort = FALSE;
+/*N*/ const SwTxtAttr *pLast = 0;
+ USHORT i=0;
+/*N*/ for( i = 0; i < SwpHtStart::Count(); ++i )
+/*N*/ {
+/*N*/ const SwTxtAttr *pHt = (*this)[i];
+/*N*/ if( pLast && !lcl_IsLessStart( *pLast, *pHt ) )
+/*N*/ {
+/*N*/ #ifdef NIE
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // ASSERT( bResort, "!Resort/Start: correcting hints-array" );
+/*N*/ aDbstream << "Resort: Starts" << endl;
+/*N*/ DumpHints( *this, aHtEnd );
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ // Aufpassen: nicht die unsere SwpHintsArr-Methoden rufen,
+/*N*/ // weil dort ein Resort steht!
+/*N*/ // AMA: Bisher ( -> USED ) wurde ein Arrayinhalt [3,4,4,3] nur in
+/*N*/ // [3,4,3,4] sortiert, nicht in [3,3,4,4]
+/*N*/ #ifdef USED
+/*N*/ SwpHtStart::Delete( i - 1 );
+/*N*/ SwpHtStart::Insert( pLast );
+/*N*/ USHORT nPos;
+/*N*/ if( SwpHtStart::Seek_Entry( pLast, &nPos ) && nPos > i )
+/*N*/ --i;
+/*N*/ #else
+/*N*/ SwpHtStart::Remove( i );
+/*N*/ SwpHtStart::Insert( pHt );
+/*N*/ pHt = (*this)[i];
+/*N*/ if ( pHt != pLast )
+/*N*/ --i;
+/*N*/ #endif //!USED
+/*N*/ bResort = TRUE;
+/*N*/ }
+/*N*/ pLast = pHt;
+/*N*/ }
+/*N*/
+/*N*/ pLast = 0;
+/*N*/ for( i = 0; i < aHtEnd.Count(); ++i )
+/*N*/ {
+/*N*/ const SwTxtAttr *pHt = aHtEnd[i];
+/*N*/ if( pLast && !lcl_IsLessEnd( *pLast, *pHt ) )
+/*N*/ {
+/*N*/ #ifdef NIE
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // ASSERT( bResort, "!Resort/Ends: correcting hints-array" );
+/*N*/ aDbstream << "Resort: Ends" << endl;
+/*N*/ DumpHints( *this, aHtEnd );
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ // AMA: siehe oben
+/*N*/ #ifdef USED
+/*N*/ aHtEnd.Delete( i - 1 );
+/*N*/ aHtEnd.Insert( pLast );
+/*N*/ USHORT nPos;
+/*N*/ if( aHtEnd.Seek_Entry( pLast, &nPos ) && nPos > i )
+/*N*/ --i;
+/*N*/ #else
+/*N*/ aHtEnd.Remove( i );
+/*N*/ aHtEnd.Insert( pHt );
+/*N*/ pHt = aHtEnd[i]; // normalerweise == pLast
+/*N*/ // Wenn die Unordnung etwas groesser ist (24200),
+/*N*/ // muessen wir Position i erneut vergleichen.
+/*N*/ if ( pLast != pHt )
+/*N*/ --i;
+/*N*/ #endif //!USED
+/*N*/ bResort = TRUE;
+/*N*/ }
+/*N*/ pLast = pHt;
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ #ifdef NIE
+/*N*/ aDbstream << "Resorted:" << endl;
+/*N*/ DumpHints( *this, aHtEnd );
+/*N*/ #endif
+/*N*/ #endif
+/*N*/ return bResort;
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_ndtxt.cxx b/binfilter/bf_sw/source/core/txtnode/sw_ndtxt.cxx
new file mode 100644
index 000000000000..d98eff9d394b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_ndtxt.cxx
@@ -0,0 +1,2355 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svtools/urihelper.hxx>
+#include <bf_svtools/ctloptions.hxx>
+#include <swmodule.hxx>
+#include <tools/shl.hxx>
+
+#include <txtfld.hxx>
+#include <txtinet.hxx>
+#include <fmtinfmt.hxx>
+#include <fmthbsh.hxx>
+#include <fmtrfmrk.hxx>
+#include <txttxmrk.hxx>
+#include <fchrfmt.hxx>
+#include <txtftn.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtfld.hxx>
+#include <frmatr.hxx>
+#include <ftnidx.hxx>
+#include <ftninfo.hxx>
+#include <fmtftn.hxx>
+#include <charfmt.hxx>
+#include <ndtxt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <txtfrm.hxx>
+#include <ftnfrm.hxx>
+#include <rootfrm.hxx>
+#include <hints.hxx> // fuer SwFmtChg in ChgTxtColl
+#include <expfld.hxx> // fuer SwTblField
+#include <mvsave.hxx>
+#include <swcache.hxx>
+#include <wrong.hxx> // fuer die WrongList des OnlineSpellings
+#include <redline.hxx>
+#include <doctxm.hxx>
+#include <bookmrk.hxx>
+#include <breakit.hxx>
+#include <checkit.hxx>
+namespace binfilter {
+
+
+SV_DECL_PTRARR( TmpHints, SwTxtAttr*, 0, 4 )
+
+/*N*/ TYPEINIT1( SwTxtNode, SwCntntNode )
+
+SV_DECL_PTRARR(SwpHts,SwTxtAttr*,1,1)
+
+// Leider ist das SwpHints nicht ganz wasserdicht:
+// Jeder darf an den Hints rumfummeln, ohne die Sortierreihenfolge
+// und Verkettung sicherstellen zu muessen.
+#ifdef DBG_UTIL
+#define CHECK_SWPHINTS(pNd) { if( pNd->GetpSwpHints() && \
+ !pNd->GetDoc()->IsInReading() ) \
+ pNd->GetpSwpHints()->Check(); }
+#else
+#define CHECK_SWPHINTS(pNd)
+#endif
+
+/*N*/ SwTxtNode *SwNodes::MakeTxtNode( const SwNodeIndex & rWhere,
+/*N*/ SwTxtFmtColl *pColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ {
+/*N*/ ASSERT( pColl, "Collectionpointer ist 0." );
+/*N*/
+/*N*/ SwTxtNode *pNode = new SwTxtNode( rWhere, pColl, pAutoAttr );
+/*N*/
+/*N*/ SwNodeIndex aIdx( *pNode );
+/*N*/
+/*N*/ if( pColl && NO_NUMBERING != pColl->GetOutlineLevel() && IsDocNodes() )
+/*N*/ UpdateOutlineNode( *pNode, NO_NUMBERING, pColl->GetOutlineLevel() );
+/*N*/
+/*N*/ //Wenn es noch kein Layout gibt oder in einer versteckten Section
+/*N*/ // stehen, brauchen wir uns um das MakeFrms nicht bemuehen.
+/*N*/ const SwSectionNode* pSectNd;
+/*N*/ if( !GetDoc()->GetRootFrm() ||
+/*N*/ ( 0 != (pSectNd = pNode->FindSectionNode()) &&
+/*N*/ pSectNd->GetSection().IsHiddenFlag() ))
+/*N*/ return pNode;
+/*N*/
+/*N*/ SwNodeIndex aTmp( rWhere );
+/*N*/ do {
+/*N*/ // max. 2 Durchlaeufe:
+/*N*/ // 1. den Nachfolger nehmen
+/*N*/ // 2. den Vorgaenger
+/*N*/
+/*N*/ SwNode *pNd;
+/*N*/ switch( ( pNd = (*this)[aTmp] )->GetNodeType() )
+/*N*/ {
+/*?*/ case ND_TABLENODE:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 ((SwTableNode*)pNd)->MakeFrms( aIdx );
+/*?*/ return pNode;
+/*?*/
+/*?*/ case ND_SECTIONNODE:
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 if( ((SwSectionNode*)pNd)->GetSection().IsHidden() ||
+/*?*/ return pNode;
+/*N*/
+/*N*/ case ND_TEXTNODE:
+/*N*/ case ND_GRFNODE:
+/*N*/ case ND_OLENODE:
+/*N*/ ((SwCntntNode*)pNd)->MakeFrms( *pNode );
+/*N*/ return pNode;
+/*N*/
+/*N*/ case ND_ENDNODE:
+/*N*/ if( pNd->FindStartNode()->IsSectionNode() &&
+/*N*/ aTmp.GetIndex() < rWhere.GetIndex() )
+/*N*/ {
+/*?*/ if( pNd->FindStartNode()->GetSectionNode()->GetSection().IsHiddenFlag())
+/*?*/ {
+/*?*/ if( !GoPrevSection( &aTmp, TRUE, FALSE ) ||
+/*?*/ aTmp.GetNode().FindTableNode() !=
+/*?*/ pNode->FindTableNode() )
+/*?*/ return pNode; // schade, das wars
+/*?*/ }
+/*?*/ else
+/*?*/ aTmp = *pNd->FindStartNode();
+/*?*/ break;
+/*N*/ }
+/*N*/ else if( pNd->FindStartNode()->IsTableNode() &&
+/*N*/ aTmp.GetIndex() < rWhere.GetIndex() )
+/*N*/ {
+/*N*/ // wir stehen hinter einem TabellenNode
+/*?*/ aTmp = *pNd->FindStartNode();
+/*?*/ break;
+/*N*/ }
+/*N*/ // kein break !!!
+/*N*/ default:
+/*N*/ if( rWhere == aTmp )
+/*N*/ aTmp -= 2;
+/*N*/ else
+/*N*/ return pNode;
+/*N*/ break;
+/*N*/ }
+/*N*/ } while( TRUE );
+/*N*/ }
+
+
+
+// --------------------
+// SwTxtNode
+// --------------------
+
+/*N*/ SwTxtNode::SwTxtNode( const SwNodeIndex &rWhere,
+/*N*/ SwTxtFmtColl *pTxtColl,
+/*N*/ SwAttrSet* pAutoAttr )
+/*N*/ : SwCntntNode( rWhere, ND_TEXTNODE, pTxtColl ),
+/*N*/ pSwpHints( 0 ), pWrong( 0 ), pNdNum( 0 ), pNdOutl( 0 )
+/*N*/ {
+/*N*/ // soll eine Harte-Attributierung gesetzt werden?
+/*N*/ if( pAutoAttr )
+/*N*/ SwCntntNode::SetAttr( *pAutoAttr );
+/*N*/
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( GetNodes().IsDocNodes() &&
+/*N*/ SFX_ITEM_SET == GetSwAttrSet().GetItemState( RES_PARATR_NUMRULE,
+/*N*/ TRUE, &pItem ) && ((SwNumRuleItem*)pItem)->GetValue().Len() )
+/*N*/ {
+/*?*/ pNdNum = new SwNodeNum( 0 );
+/*?*/ SwNumRule* pRule = GetDoc()->FindNumRulePtr(
+/*?*/ ((SwNumRuleItem*)pItem)->GetValue() );
+/*?*/ if( pRule )
+/*?*/ pRule->SetInvalidRule( TRUE );
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwTxtNode::~SwTxtNode()
+/*N*/ {
+/*N*/ // delete loescht nur die Pointer, nicht die Arrayelemente!
+/*N*/ if( pSwpHints )
+/*N*/ {
+/*N*/ // damit Attribute die ihren Inhalt entfernen nicht doppelt
+/*N*/ // geloescht werden.
+/*N*/ SwpHints* pTmpHints = pSwpHints;
+/*N*/ pSwpHints = 0;
+/*N*/
+/*N*/ for( register USHORT j = pTmpHints->Count(); j; )
+/*N*/ // erst muss das Attribut aus dem Array entfernt werden,
+/*N*/ // denn sonst wuerde es sich selbst loeschen (Felder) !!!!
+/*N*/ DestroyAttr( pTmpHints->GetHt( --j ) );
+/*N*/
+/*N*/ delete pTmpHints;
+/*N*/ }
+/*N*/ delete pWrong;
+/*N*/ // Achtung. im Dtor von SwCntntNode kann DelFrms gerufen werden, wo
+/*N*/ // ggf. pWrong nochmal deletet wird, deshalb diese Zuweisung
+/*N*/ pWrong = NULL; // hier nicht wegoptimieren!
+/*N*/
+/*N*/ delete pNdNum, pNdNum = 0; // ggfs. wird in der BasisKlasse noch
+/*N*/ delete pNdOutl, pNdOutl = 0; // darauf zugegriffen??
+/*N*/ }
+
+/*N*/ SwCntntFrm *SwTxtNode::MakeFrm()
+/*N*/ {
+/*N*/ SwCntntFrm *pFrm = new SwTxtFrm(this);
+/*N*/ return pFrm;
+/*N*/ }
+
+/*N*/ xub_StrLen SwTxtNode::Len() const
+/*N*/ {
+/*N*/ return aText.Len();
+/*N*/ }
+
+/*---------------------------------------------------------------------------
+ * lcl_ChangeFtnRef
+ * After a split node, it's necessary to actualize the ref-pointer of the
+ * ftnfrms.
+ * --------------------------------------------------------------------------*/
+
+/*N*/ void lcl_ChangeFtnRef( SwTxtNode &rNode )
+/*N*/ {
+/*N*/ SwpHints *pSwpHints = rNode.GetpSwpHints();
+/*N*/ if( pSwpHints && rNode.GetDoc()->GetRootFrm() )
+/*N*/ {
+/*N*/ SwTxtAttr* pHt;
+/*N*/ SwCntntFrm* pFrm = NULL;
+/*N*/ // OD 07.11.2002 #104840# - local variable to remember first footnote
+/*N*/ // of node <rNode> in order to invalidate position of its first content.
+/*N*/ // Thus, in its <MakeAll()> it will checked its position relative to its reference.
+/*N*/ SwFtnFrm* pFirstFtnOfNode = 0;
+/*N*/ for( register USHORT j = pSwpHints->Count(); j; )
+/*N*/ {
+/*N*/ if( RES_TXTATR_FTN == (pHt = pSwpHints->GetHt(--j))->Which() )
+/*N*/ {
+/*N*/ if( !pFrm )
+/*N*/ {
+/*N*/ SwClientIter aNew( rNode );
+/*N*/ pFrm = (SwCntntFrm*)aNew.First( TYPE(SwCntntFrm) );
+/*N*/ //JP 11.07.00: the assert's shows incorrect an error when nodes are converted
+/*N*/ // to a table. Then no layout exist!
+/*N*/ // ASSERT( pFrm, "lcl_ChangeFtnRef: No TxtFrm" );
+/*N*/ // ASSERT( pFrm && !aNew.Next(),"lcl_ChangeFtnRef: Doublefault");
+/*N*/ if( !pFrm )
+/*N*/ return;
+/*N*/ }
+/*N*/ SwTxtFtn *pAttr = (SwTxtFtn*)pHt;
+/*N*/ ASSERT( pAttr->GetStartNode(), "FtnAtr ohne StartNode." );
+/*N*/ SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 );
+/*N*/ SwCntntNode *pNd = aIdx.GetNode().GetCntntNode();
+/*N*/ if ( !pNd )
+/*N*/ pNd = pFrm->GetAttrSet()->GetDoc()->
+/*N*/ GetNodes().GoNextSection( &aIdx, TRUE, FALSE );
+/*N*/ if ( !pNd )
+/*N*/ continue;
+/*N*/ SwClientIter aIter( *pNd );
+/*N*/ SwCntntFrm* pCntnt = (SwCntntFrm*)aIter.First(TYPE(SwCntntFrm));
+/*N*/ if( pCntnt )
+/*N*/ {
+/*N*/ ASSERT( pCntnt->FindRootFrm() == pFrm->FindRootFrm(),
+/*N*/ "lcl_ChangeFtnRef: Layout double?" );
+/*N*/ SwFtnFrm *pFtn = pCntnt->FindFtnFrm();
+/*N*/ if( pFtn && pFtn->GetAttr() == pAttr )
+/*N*/ {
+/*N*/ while( pFtn->GetMaster() )
+/*N*/ pFtn = pFtn->GetMaster();
+/*N*/ // OD 07.11.2002 #104840# - remember footnote frame
+/*N*/ pFirstFtnOfNode = pFtn;
+/*N*/ while ( pFtn )
+/*N*/ {
+/*N*/ pFtn->SetRef( pFrm );
+/*N*/ pFtn = pFtn->GetFollow();
+/*N*/ ((SwTxtFrm*)pFrm)->SetFtn( TRUE );
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ while( 0 != (pCntnt = (SwCntntFrm*)aIter.Next()) )
+/*N*/ {
+/*N*/ SwFtnFrm *pFtn = pCntnt->FindFtnFrm();
+/*N*/ ASSERT( !pFtn || pFtn->GetRef() == pFrm,
+/*N*/ "lcl_ChangeFtnRef: Who's that guy?" );
+/*N*/ }
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ } // end of for-loop on <SwpHints>
+/*N*/ // OD 08.11.2002 #104840# - invalidate
+/*N*/ if ( pFirstFtnOfNode )
+/*N*/ {
+/*N*/ SwCntntFrm* pCntnt = pFirstFtnOfNode->ContainsCntnt();
+/*N*/ if ( pCntnt )
+/*N*/ {
+/*N*/ pCntnt->_InvalidatePos();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ SwCntntNode *SwTxtNode::SplitNode( const SwPosition &rPos )
+/*N*/ {
+/*N*/ // lege den Node "vor" mir an
+/*N*/ register xub_StrLen nSplitPos = rPos.nContent.GetIndex(),
+/*N*/ nTxtLen = aText.Len();
+/*N*/ SwTxtNode* pNode = _MakeNewTxtNode( rPos.nNode, FALSE, nSplitPos==nTxtLen );
+/*N*/
+/*N*/ if( GetDepends() && aText.Len() && (nTxtLen / 2) < nSplitPos )
+/*N*/ {
+/*?*/ // JP 25.04.95: Optimierung fuer SplitNode:
+/*?*/ // Wird am Ende vom Node gesplittet, dann verschiebe die
+/*?*/ // Frames vom akt. auf den neuen und erzeuge fuer den akt.
+/*?*/ // neue. Dadurch entfaellt das neu aufbauen vom Layout.
+/*?*/
+/*?*/ LockModify(); // Benachrichtigungen abschalten
+/*?*/
+/*?*/ // werden FlyFrames mit verschoben, so muessen diese nicht ihre
+/*?*/ // Frames zerstoeren. Im SwTxtFly::SetAnchor wird es abgefragt!
+/*?*/ if( pSwpHints )
+/*?*/ {
+/*?*/ if( !pNode->pSwpHints )
+/*?*/ pNode->pSwpHints = new SwpHints;
+/*?*/ pNode->pSwpHints->bInSplitNode = TRUE;
+/*?*/ }
+/*?*/
+/*?*/ //Ersten Teil des Inhalts in den neuen Node uebertragen und
+/*?*/ //im alten Node loeschen.
+/*?*/ SwIndex aIdx( this );
+/*?*/ Cut( pNode, aIdx, nSplitPos );
+/*?*/
+/*?*/ if( GetWrong() )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pNode->SetWrong( GetWrong()->SplitList( nSplitPos ) );
+/*?*/
+/*?*/ SetWrongDirty( TRUE );
+/*?*/
+/*?*/ if( pNode->pSwpHints )
+/*?*/ {
+/*?*/ if ( pNode->pSwpHints->CanBeDeleted() )
+/*?*/ {
+/*?*/ delete pNode->pSwpHints;
+/*?*/ pNode->pSwpHints = 0;
+/*?*/ }
+/*?*/ else
+/*?*/ pNode->pSwpHints->bInSplitNode = FALSE;
+/*?*/
+/*?*/ // alle zeichengebundenen Rahmen, die im neuen Absatz laden
+/*?*/ // muessen aus den alten Frame entfernt werden:
+/*?*/ // JP 01.10.96: alle leeren und nicht zu expandierenden
+/*?*/ // Attribute loeschen
+/*?*/ if( pSwpHints )
+/*?*/ {
+/*?*/ SwTxtAttr* pHt;
+/*?*/ xub_StrLen* pEnd;
+/*?*/ for( register USHORT j = pSwpHints->Count(); j; )
+/*?*/ if( RES_TXTATR_FLYCNT ==
+/*?*/ ( pHt = pSwpHints->GetHt( --j ) )->Which() )
+/*?*/ pHt->GetFlyCnt().GetFrmFmt()->DelFrms();
+/*?*/ else if( pHt->DontExpand() && 0 != ( pEnd = pHt->GetEnd() )
+/*?*/ && *pHt->GetStart() == *pEnd )
+/*?*/ {
+/*?*/ // loeschen!
+/*?*/ pSwpHints->DeleteAtPos( j );
+/*?*/ DestroyAttr( pHt );
+/*?*/ }
+/*?*/ }
+/*?*/
+/*?*/ }
+/*?*/
+/*?*/ SwClientIter aIter( *this );
+/*?*/ SwClient* pLast = aIter.GoStart();
+/*?*/ if( pLast )
+/*?*/ do
+/*?*/ { SwCntntFrm *pFrm = PTR_CAST( SwCntntFrm, pLast );
+/*?*/ if ( pFrm )
+/*?*/ {
+/*?*/ pNode->Add( pFrm );
+/*?*/ if( pFrm->IsTxtFrm() && !pFrm->IsFollow() &&
+/*?*/ ((SwTxtFrm*)pFrm)->GetOfst() )
+/*?*/ ((SwTxtFrm*)pFrm)->SetOfst( 0 );
+/*?*/ }
+/*?*/ } while( 0 != ( pLast = aIter++ ));
+/*?*/
+/*?*/ if ( IsInCache() )
+/*?*/ {
+/*?*/ SwFrm::GetCache().Delete( this );
+/*?*/ SetInCache( FALSE );
+/*?*/ }
+/*?*/
+/*?*/ UnlockModify(); // Benachrichtigungen wieder freischalten
+/*?*/
+/*?*/ const SwRootFrm *pRootFrm;
+/*?*/ // If there is an accessible layout we must call modify even
+/*?*/ // with length zero, because we have to notify about the changed
+/*?*/ // text node.
+/*?*/ if( nTxtLen != nSplitPos
+/*?*/ #ifdef ACCESSIBLE_LAYOUT
+/*?*/ ||
+/*?*/ ( (pRootFrm = pNode->GetDoc()->GetRootFrm()) != 0 &&
+/*?*/ pRootFrm->IsAnyShellAccessible() )
+/*?*/ #endif
+/*?*/ )
+/*?*/
+/*?*/ {
+/*?*/ // dann sage den Frames noch, das am Ende etwas "geloescht" wurde
+/*?*/ if( 1 == nTxtLen - nSplitPos )
+/*?*/ {
+/*?*/ SwDelChr aHint( nSplitPos );
+/*?*/ pNode->SwModify::Modify( 0, &aHint );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ SwDelTxt aHint( nSplitPos, nTxtLen - nSplitPos );
+/*?*/ pNode->SwModify::Modify( 0, &aHint );
+/*?*/ }
+/*?*/ }
+/*?*/ if( pSwpHints )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ MoveTxtAttr_To_AttrSet();
+/*?*/ pNode->MakeFrms( *this ); // neue Frames anlegen.
+/*?*/ lcl_ChangeFtnRef( *this );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwWrongList *pList = GetWrong();
+/*N*/ pWrong = NULL;
+/*N*/
+/*N*/ SetWrongDirty( TRUE );
+/*N*/
+/*N*/ SwIndex aIdx( this );
+/*N*/ Cut( pNode, aIdx, rPos.nContent.GetIndex() );
+/*N*/
+/*N*/ // JP 01.10.96: alle leeren und nicht zu expandierenden
+/*N*/ // Attribute loeschen
+/*N*/ if( pSwpHints )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ SwTxtAttr* pHt;
+/*N*/ }
+/*N*/
+/*N*/ if( pList )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pNode->SetWrong( pList->SplitList( nSplitPos ) );
+/*N*/ }
+/*N*/
+/*N*/ if ( GetDepends() )
+/*N*/ MakeFrms( *pNode ); // neue Frames anlegen.
+/*N*/ lcl_ChangeFtnRef( *pNode );
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ //Hint fuer Pagedesc versenden. Das mueste eigntlich das Layout im
+/*N*/ //Paste der Frames selbst erledigen, aber das fuehrt dann wiederum
+/*N*/ //zu weiteren Folgefehlern, die mit Laufzeitkosten geloest werden
+/*N*/ //muesten. #56977# #55001# #56135#
+/*N*/ const SfxPoolItem *pItem;
+/*N*/ if( GetDepends() && SFX_ITEM_SET == pNode->GetSwAttrSet().
+/*N*/ GetItemState( RES_PAGEDESC, TRUE, &pItem ) )
+/*?*/ pNode->Modify( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
+/*N*/ }
+/*N*/ return pNode;
+/*N*/ }
+
+
+/*N*/ SwCntntNode *SwTxtNode::JoinNext()
+/*N*/ {
+/*N*/ SwNodes& rNds = GetNodes();
+/*N*/ SwNodeIndex aIdx( *this );
+/*N*/ if( SwCntntNode::CanJoinNext( &aIdx ) )
+/*N*/ {
+/*N*/ SwDoc* pDoc = rNds.GetDoc();
+/*N*/ SvULongs aBkmkArr( 15, 15 );
+/*N*/ _SaveCntntIdx( pDoc, aIdx.GetIndex(), USHRT_MAX, aBkmkArr, SAVEFLY );
+/*N*/ SwTxtNode *pTxtNode = aIdx.GetNode().GetTxtNode();
+/*N*/ xub_StrLen nOldLen = aText.Len();
+/*N*/ SwWrongList *pList = GetWrong();
+/*N*/ if( pList )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pList->JoinList( pTxtNode->GetWrong(), nOldLen );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pList = pTxtNode->GetWrong();
+/*N*/ if( pList )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP");//STRIP001 /*?*/ pList->Move( 0, nOldLen );
+/*N*/ }
+/*N*/ }
+/*N*/ { // wg. SwIndex
+/*N*/ pTxtNode->Cut( this, SwIndex(pTxtNode), pTxtNode->Len() );
+/*N*/ }
+/*N*/ // verschiebe noch alle Bookmarks/TOXMarks
+/*N*/ if( aBkmkArr.Count() )
+/*N*/ _RestoreCntntIdx( pDoc, aBkmkArr, GetIndex(), nOldLen );
+/*N*/
+/*N*/ if( pTxtNode->HasAnyIndex() )
+/*N*/ {
+/*N*/ // alle Crsr/StkCrsr/UnoCrsr aus dem Loeschbereich verschieben
+/*?*/ pDoc->CorrAbs( aIdx, SwPosition( *this ), nOldLen, TRUE );
+/*N*/ }
+/*N*/ rNds.Delete(aIdx);
+/*N*/ pWrong = pList;
+/*N*/ InvalidateNumRule();
+/*N*/ }
+/*N*/ else
+/*N*/ ASSERT( FALSE, "kein TxtNode." );
+/*N*/
+/*N*/ return this;
+/*N*/ }
+
+/*N*/ SwCntntNode *SwTxtNode::JoinPrev()
+/*N*/ {
+/*N*/ SwNodes& rNds = GetNodes();
+/*N*/ SwNodeIndex aIdx( *this );
+/*N*/ if( SwCntntNode::CanJoinPrev( &aIdx ) )
+/*N*/ {
+/*N*/ SwDoc* pDoc = rNds.GetDoc();
+/*N*/ SvULongs aBkmkArr( 15, 15 );
+/*N*/ _SaveCntntIdx( pDoc, aIdx.GetIndex(), USHRT_MAX, aBkmkArr, SAVEFLY );
+/*N*/ SwTxtNode *pTxtNode = aIdx.GetNode().GetTxtNode();
+/*N*/ xub_StrLen nLen = pTxtNode->Len();
+/*N*/ SwWrongList *pList = pTxtNode->GetWrong();
+/*N*/ if( pList )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pList->JoinList( GetWrong(), Len() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pList = GetWrong();
+/*N*/ if( pList )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ pList->Move( 0, nLen );
+/*N*/ }
+/*N*/ }
+/*N*/ { // wg. SwIndex
+/*N*/ pTxtNode->Cut( this, SwIndex( this ), SwIndex(pTxtNode), nLen );
+/*N*/ }
+/*N*/ // verschiebe noch alle Bookmarks/TOXMarks
+/*N*/ if( aBkmkArr.Count() )
+/*N*/ _RestoreCntntIdx( pDoc, aBkmkArr, GetIndex() );
+/*N*/
+/*N*/ if( pTxtNode->HasAnyIndex() )
+/*N*/ {
+/*N*/ // alle Crsr/StkCrsr/UnoCrsr aus dem Loeschbereich verschieben
+/*?*/ pDoc->CorrAbs( aIdx, SwPosition( *this ), nLen, TRUE );
+/*N*/ }
+/*N*/ rNds.Delete(aIdx);
+/*N*/ pWrong = pList;
+/*N*/ InvalidateNumRule();
+/*N*/ }
+/*N*/ else
+/*N*/ ASSERT( FALSE, "kein TxtNode." );
+/*N*/
+/*N*/ return this;
+/*N*/ }
+
+// erzeugt einen AttrSet mit Bereichen fuer Frame-/Para/Char-Attributen
+/*N*/ void SwTxtNode::NewAttrSet( SwAttrPool& rPool )
+/*N*/ {
+/*N*/ ASSERT( !pAttrSet, "AttrSet ist doch gesetzt" );
+/*N*/ pAttrSet = new SwAttrSet( rPool, aTxtNodeSetRange );
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ // pAttrSet->SetParent( &GetFmtColl()->GetAttrSet() );
+/*N*/ pAttrSet->SetParent( &GetAnyFmtColl().GetAttrSet() );
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ }
+
+
+// change the URL in the attribut - if it is a valid URL!
+/*N*/ void lcl_CheckURLChanged( const SwFmtINetFmt& rURLAttr, const String& rText,
+/*N*/ xub_StrLen nStt, xub_StrLen nEnd )
+/*N*/ {
+/*N*/ if( nStt < nEnd )
+/*N*/ {
+/*N*/ xub_StrLen nS = nStt, nE = nEnd;
+/*N*/ String sNew( FindFirstURLInText( rText, nS, nE,
+/*N*/ GetAppCharClass() ));
+/*N*/ if( sNew.Len() && nS == nStt && nE == nEnd )
+/*N*/ {
+/*N*/ // it is an valid URL, so set it to the URL Object
+/*N*/ ((SwFmtINetFmt&)rURLAttr).SetValue( rText.Copy( nS, nE - nS ));
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+// Ueberladen der virtuellen Update-Methode von SwIndexReg. Dadurch
+// benoetigen die Text-Attribute nur xub_StrLen statt SwIndizies!
+/*N*/ void SwTxtNode::Update( const SwIndex & aPos, xub_StrLen nLen,
+/*N*/ BOOL bNegativ )
+/*N*/ {
+/*N*/ SetAutoCompleteWordDirty( TRUE );
+/*N*/
+/*N*/ TmpHints* pCollector = NULL;
+/*N*/ if( pSwpHints )
+/*N*/ {
+/*N*/ xub_StrLen nPos = aPos.GetIndex();
+/*N*/ xub_StrLen* pIdx;
+/*N*/ SwTxtAttr* pHt;
+/*N*/ if( bNegativ )
+/*N*/ {
+/*N*/ xub_StrLen nMax = nPos + nLen;
+/*N*/ for( USHORT n = 0; n < pSwpHints->Count(); ++n )
+/*N*/ {
+/*N*/ BOOL bCheckURL = FALSE, bSttBefore = FALSE;
+/*N*/ pHt = pSwpHints->GetHt(n);
+/*N*/ pIdx = pHt->GetStart();
+/*N*/ if( *pIdx >= nPos )
+/*N*/ {
+/*N*/ if( *pIdx > nMax )
+/*N*/ *pIdx -= nLen;
+/*N*/ else
+/*N*/ {
+/*N*/ if( *pIdx < nMax )
+/*N*/ bCheckURL = TRUE;
+/*N*/ *pIdx = nPos;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bSttBefore = TRUE;
+/*N*/
+/*N*/ if( 0 == (pIdx = pHt->GetEnd()) )
+/*N*/ continue;
+/*N*/
+/*N*/ if( *pIdx >= nPos )
+/*N*/ {
+/*N*/ if( *pIdx > nMax )
+/*N*/ {
+/*N*/ *pIdx -= nLen;
+/*N*/ if( bSttBefore )
+/*N*/ bCheckURL = TRUE;
+/*N*/ }
+/*N*/ else if( *pIdx != nPos )
+/*N*/ {
+/*N*/ *pIdx = nPos;
+/*N*/ if( bSttBefore )
+/*N*/ bCheckURL = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bCheckURL && RES_TXTATR_INETFMT == pHt->Which() )
+/*N*/ {
+/*N*/ // reset the URL in the attribut - if it is a valid URL!
+/*N*/ lcl_CheckURLChanged( pHt->GetINetFmt(), aText,
+/*N*/ *pHt->GetStart(), *pHt->GetEnd() );
+/*N*/ }
+/*N*/
+/*N*/ //JP 01.10.96: fuers SplitNode sollte das Flag nicht geloescht werden!
+/*N*/ // pHt->SetDontExpand( FALSE );
+/*N*/ }
+/*N*/ // AMA: Durch das Loeschen koennen Attribute gleiche Start-
+/*N*/ // und/oder Endwerte erhalten, die vorher echt ungleich
+/*N*/ // waren. Dadurch kann die Sortierung durcheinander geraten,
+/*N*/ // die bei gleichen Start/Endwerten den Pointer selbst
+/*N*/ // vergleicht, also ClearDummies ...
+/*N*/ pSwpHints->ClearDummies( *this );
+/*N*/ if ( !pSwpHints->Merge( *this ) )
+/*N*/ ((SwpHintsArr*)pSwpHints)->Resort();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ xub_StrLen* pEnd;
+/*N*/ BOOL bNoExp = FALSE;
+/*N*/ BOOL bResort = FALSE;
+/*N*/ const USHORT coArrSz = RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN +
+/*N*/ ( RES_UNKNOWNATR_END - RES_UNKNOWNATR_BEGIN );
+/*N*/
+/*N*/ BOOL aDontExp[ coArrSz ];
+/*N*/ memset( &aDontExp, 0, coArrSz * sizeof(BOOL) );
+/*N*/
+/*N*/ for( USHORT n = 0; n < pSwpHints->Count(); ++n )
+/*N*/ {
+/*N*/ BOOL bCheckURL = FALSE;
+/*N*/ pHt = pSwpHints->GetHt(n);
+/*N*/ pIdx = pHt->GetStart();
+/*N*/ if( *pIdx >= nPos )
+/*N*/ {
+/*N*/ *pIdx += nLen;
+/*N*/ if( 0 != ( pEnd = pHt->GetEnd() ) )
+/*N*/ *pEnd += nLen;
+/*N*/ }
+/*N*/ else if( 0 != ( pEnd = pHt->GetEnd() ) && *pEnd >= nPos )
+/*N*/ {
+/*N*/ if( *pEnd > nPos || IsIgnoreDontExpand() )
+/*N*/ {
+/*N*/ bCheckURL = TRUE;
+/*N*/ *pEnd += nLen;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ USHORT nWhPos, nWhich = pHt->Which();
+/*N*/
+/*N*/ if( RES_CHRATR_BEGIN <= nWhich &&
+/*N*/ nWhich < RES_TXTATR_WITHEND_END )
+/*N*/ nWhPos = nWhich - RES_CHRATR_BEGIN;
+/*N*/ else if( RES_UNKNOWNATR_BEGIN <= nWhich &&
+/*N*/ nWhich < RES_UNKNOWNATR_END )
+/*?*/ nWhPos = nWhich - RES_UNKNOWNATR_BEGIN +
+/*?*/ ( RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN );
+/*N*/ else
+/*N*/ continue;
+/*N*/
+/*N*/ if( aDontExp[ nWhPos ] )
+/*N*/ continue;
+/*N*/
+/*N*/ if( pHt->DontExpand() )
+/*N*/ {
+/*?*/ pHt->SetDontExpand( FALSE );
+/*?*/ bResort = TRUE;
+/*?*/ if( pHt->IsCharFmtAttr() )
+/*?*/ {
+/*?*/ bNoExp = TRUE;
+/*?*/ aDontExp[ RES_TXTATR_CHARFMT -RES_CHRATR_BEGIN ]
+/*?*/ = TRUE;
+/*?*/ aDontExp[ RES_TXTATR_INETFMT -RES_CHRATR_BEGIN ]
+/*?*/ = TRUE;
+/*?*/ }
+/*?*/ else
+/*?*/ aDontExp[ nWhPos ] = TRUE;
+/*N*/ }
+/*N*/ else if( bNoExp )
+/*N*/ {
+/*?*/ if( !pCollector )
+/*?*/ pCollector = new TmpHints;
+/*?*/ USHORT nCollCnt = pCollector->Count();
+/*?*/ for( USHORT i = 0; i < nCollCnt; ++i )
+/*?*/ {
+/*?*/ SwTxtAttr *pTmp = (*pCollector)[ i ];
+/*?*/ if( nWhich == pTmp->Which() )
+/*?*/ {
+/*?*/ pCollector->Remove( i );
+/*?*/ delete pTmp;
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ SwTxtAttr *pTmp = MakeTxtAttr( pHt->GetAttr(),
+/*?*/ nPos, nPos + nLen );
+/*?*/ pCollector->C40_INSERT( SwTxtAttr, pTmp, pCollector->Count() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ *pEnd += nLen;
+/*N*/ bCheckURL = TRUE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( bCheckURL && RES_TXTATR_INETFMT == pHt->Which() )
+/*N*/ {
+/*N*/ // reset the URL in the attribut - if it is a valid URL!
+/*N*/ lcl_CheckURLChanged( pHt->GetINetFmt(), aText,
+/*N*/ *pHt->GetStart(), *pHt->GetEnd() );
+/*N*/ }
+/*N*/ }
+/*N*/ if( bResort )
+/*?*/ ((SwpHintsArr*)pSwpHints)->Resort();
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwIndexReg aTmpIdxReg;
+/*N*/ if( !bNegativ )
+/*N*/ {
+/*N*/ SwIndex* pIdx;
+/*N*/ const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+/*N*/ if( rTbl.Count() )
+/*?*/ for( USHORT i = 0; i < rTbl.Count(); ++i )
+/*?*/ {
+/*?*/ SwRedline* pRedl = rTbl[ i ];
+/*?*/ if( pRedl->HasMark() )
+/*?*/ {
+/*?*/ SwPosition* pEnd = pRedl->End();
+/*?*/ if( this == &pEnd->nNode.GetNode() &&
+/*?*/ *pRedl->GetPoint() != *pRedl->GetMark() &&
+/*?*/ aPos.GetIndex() ==
+/*?*/ (pIdx = &pEnd->nContent)->GetIndex() )
+/*?*/ pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
+/*?*/ }
+/*?*/ else if( this == &pRedl->GetPoint()->nNode.GetNode() &&
+/*?*/ aPos.GetIndex() == (pIdx = &pRedl->GetPoint()->
+/*?*/ nContent)->GetIndex() )
+/*?*/ {
+/*?*/ pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
+/*?*/ if( &pRedl->GetBound( TRUE ) == pRedl->GetPoint() )
+/*?*/ {
+/*?*/ pRedl->GetBound( FALSE ) = pRedl->GetBound( TRUE );
+/*?*/ pIdx = &pRedl->GetBound( FALSE ).nContent;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ pRedl->GetBound( TRUE ) = pRedl->GetBound( FALSE );
+/*?*/ pIdx = &pRedl->GetBound( TRUE ).nContent;
+/*?*/ }
+/*?*/ pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ const SwBookmarks& rBkmk = GetDoc()->GetBookmarks();
+/*N*/ if( rBkmk.Count() )
+/*N*/ for( USHORT i = 0; i < rBkmk.Count(); ++i )
+/*N*/ {
+/*N*/ SwBookmark* pBkmk = rBkmk[ i ];
+/*N*/ if( (this == &pBkmk->GetPos().nNode.GetNode() &&
+/*N*/ aPos.GetIndex() == (pIdx = (SwIndex*)&pBkmk->GetPos().
+/*N*/ nContent)->GetIndex() ) ||
+/*N*/ ( pBkmk->GetOtherPos() &&
+/*N*/ this == &pBkmk->GetOtherPos()->nNode.GetNode() &&
+/*N*/ aPos.GetIndex() == (pIdx = (SwIndex*)&pBkmk->
+/*N*/ GetOtherPos()->nContent)->GetIndex() ) )
+/*N*/ pIdx->Assign( &aTmpIdxReg, pIdx->GetIndex() );
+/*N*/ }
+/*N*/ }
+/*N*/ SwIndexReg::Update( aPos, nLen, bNegativ );
+/*N*/ if( pCollector )
+/*N*/ {
+/*?*/ USHORT nCount = pCollector->Count();
+/*?*/ for( USHORT i = 0; i < nCount; ++i )
+/*?*/ pSwpHints->Insert( (*pCollector)[ i ], *this, FALSE );
+/*?*/ delete pCollector;
+/*N*/ }
+/*N*/
+/*N*/ aTmpIdxReg.MoveTo( *this );
+/*N*/ }
+
+/*N*/ SwFmtColl* SwTxtNode::ChgFmtColl( SwFmtColl *pNewColl )
+/*N*/ {
+/*N*/ ASSERT( pNewColl,"ChgFmtColl: Collectionpointer ist 0." );
+/*N*/ ASSERT( HAS_BASE( SwTxtFmtColl, pNewColl ),
+/*N*/ "ChgFmtColl: ist kein Text-Collectionpointer." );
+/*N*/
+/*N*/ SwTxtFmtColl *pOldColl = GetTxtColl();
+/*N*/ if( pNewColl != pOldColl )
+/*N*/ SwCntntNode::ChgFmtColl( pNewColl );
+/*N*/ // nur wenn im normalen Nodes-Array
+/*N*/ if( GetNodes().IsDocNodes() )
+/*N*/ _ChgTxtCollUpdateNum( pOldColl, (SwTxtFmtColl*)pNewColl );
+/*N*/ return pOldColl;
+/*N*/ }
+
+/*N*/ void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl,
+/*N*/ const SwTxtFmtColl *pNewColl)
+/*N*/ {
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ ASSERT( pDoc, "Kein Doc?" );
+/*N*/ // erfrage die OutlineLevel und update gegebenenfalls das Nodes-Array,
+/*N*/ // falls sich die Level geaendert haben !
+/*N*/ const BYTE nOldLevel = pOldColl ? pOldColl->GetOutlineLevel():NO_NUMBERING;
+/*N*/ const BYTE nNewLevel = pNewColl ? pNewColl->GetOutlineLevel():NO_NUMBERING;
+/*N*/
+/*N*/ SwNodes& rNds = GetNodes();
+/*N*/ if( nOldLevel != nNewLevel )
+/*N*/ {
+/*N*/ delete pNdOutl, pNdOutl = 0;
+/*N*/ // Numerierung aufheben, falls sie aus der Vorlage kommt
+/*N*/ // und nicht nicht aus der neuen
+/*N*/ if( NO_NUMBERING != nNewLevel && pNdNum && ( !GetpSwAttrSet() ||
+/*N*/ SFX_ITEM_SET != GetpSwAttrSet()->GetItemState(
+/*N*/ RES_PARATR_NUMRULE, FALSE )) &&
+/*N*/ (!pNewColl || SFX_ITEM_SET != pNewColl->GetItemState(
+/*N*/ RES_PARATR_NUMRULE )) )
+/*N*/ delete pNdNum, pNdNum = 0;
+/*N*/ if( rNds.IsDocNodes() )
+/*N*/ rNds.UpdateOutlineNode( *this, nOldLevel, nNewLevel );
+/*N*/ }
+/*N*/
+/*N*/ // Update beim Level 0 noch die Fussnoten !!
+/*N*/ if( (!nNewLevel || !nOldLevel) && pDoc->GetFtnIdxs().Count() &&
+/*N*/ FTNNUM_CHAPTER == pDoc->GetFtnInfo().eNum &&
+/*N*/ rNds.IsDocNodes() )
+/*N*/ {
+/*?*/ SwNodeIndex aTmpIndex( rNds, GetIndex());
+/*?*/
+/*?*/ pDoc->GetFtnIdxs().UpdateFtn( aTmpIndex);
+/*N*/ }
+/*N*/
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ if( /*pOldColl != pNewColl && pNewColl && */
+/*N*/ RES_CONDTXTFMTCOLL == pNewColl->Which() )
+/*N*/ {
+/*N*/ // Erfrage die akt. Condition des TextNodes:
+/*N*/ ChkCondColl();
+/*N*/ }
+/*N*/ //FEATURE::CONDCOLL
+/*N*/ }
+
+// Wenn man sich genau am Ende einer Text- bzw. INetvorlage befindet,
+// bekommt diese das DontExpand-Flag verpasst
+
+
+
+// gebe das vorgegebene Attribut, welches an der TextPosition (rIdx)
+// gesetzt ist, zurueck. Gibt es keines, returne 0-Pointer.
+// (gesetzt heisst, je nach bExpand ?
+// Start < rIdx <= End
+// : Start <= rIdx < End )
+
+/*N*/ SwTxtAttr* SwTxtNode::GetTxtAttr( const SwIndex& rIdx, USHORT nWhichHt,
+/*N*/ BOOL bExpand ) const
+/*N*/ {
+/*N*/ const SwTxtAttr* pRet = 0;
+/*N*/ const SwTxtAttr* pHt = 0;
+/*N*/ const xub_StrLen *pEndIdx = 0;
+/*N*/ const xub_StrLen nIdx = rIdx.GetIndex();
+/*N*/ const USHORT nSize = pSwpHints ? pSwpHints->Count() : 0;
+/*N*/
+/*N*/ for( USHORT i = 0; i < nSize; ++i )
+/*N*/ {
+/*N*/ // ist der Attribut-Anfang schon groesser als der Idx ?
+/*N*/ if( nIdx < *((pHt = (*pSwpHints)[i])->GetStart()) )
+/*N*/ break; // beenden, kein gueltiges Attribut
+/*N*/
+/*N*/ // ist es das gewuenschte Attribut ?
+/*N*/ if( pHt->Which() != nWhichHt )
+/*N*/ continue; // nein, weiter
+/*N*/
+/*N*/ pEndIdx = pHt->GetEnd();
+/*N*/ // liegt innerhalb des Bereiches ??
+/*N*/ if( !pEndIdx )
+/*N*/ {
+/*N*/ if( *pHt->GetStart() == nIdx )
+/*N*/ {
+/*N*/ pRet = pHt;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( *pHt->GetStart() <= nIdx && nIdx <= *pEndIdx )
+/*N*/ {
+/*N*/ // Wenn bExpand gesetzt ist, wird das Verhalten bei Eingabe
+/*N*/ // simuliert, d.h. der Start wuede verschoben, das Ende expandiert,
+/*N*/ if( bExpand )
+/*N*/ {
+/*?*/ if( *pHt->GetStart() < nIdx )
+/*?*/ pRet = pHt;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( nIdx < *pEndIdx )
+/*N*/ pRet = pHt; // den am dichtesten liegenden
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return (SwTxtAttr*)pRet; // kein gueltiges Attribut gefunden !!
+/*N*/ }
+
+/*************************************************************************
+ * CopyHint()
+ *************************************************************************/
+
+
+/*N*/ void lcl_CopyHint( const USHORT nWhich, const SwTxtAttr *pHt,
+/*N*/ SwTxtAttr *pNewHt, SwDoc* pOtherDoc, SwTxtNode *pDest )
+/*N*/ {
+/*N*/ ASSERT( nWhich == pHt->Which(), "Falsche Hint-Id" );
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ // Wenn wir es mit einem Fussnoten-Attribut zu tun haben,
+/*N*/ // muessen wir natuerlich auch den Fussnotenbereich kopieren.
+/*N*/ case RES_TXTATR_FTN :
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ ((SwTxtFtn*)pHt)->CopyFtn( (SwTxtFtn*)pNewHt );
+/*?*/ break;
+/*N*/
+/*N*/ // Beim Kopieren von Feldern in andere Dokumente
+/*N*/ // muessen die Felder bei ihren neuen Feldtypen angemeldet werden.
+/*N*/
+/*N*/ // TabellenFormel muessen relativ kopiert werden.
+/*N*/ case RES_TXTATR_FIELD :
+/*N*/ {
+/*N*/ const SwFmtFld& rFld = pHt->GetFld();
+/*N*/ if( pOtherDoc )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ ((SwTxtFld*)pHt)->CopyFld( (SwTxtFld*)pNewHt );
+/*N*/
+/*N*/ // Tabellenformel ??
+/*N*/ if( RES_TABLEFLD == rFld.GetFld()->GetTyp()->Which()
+/*N*/ && ((SwTblField*)rFld.GetFld())->IsIntrnlName() )
+/*N*/ {
+/*N*/ // wandel die interne in eine externe Formel um
+/*?*/ const SwTableNode* pDstTblNd = ((SwTxtFld*)pHt)->
+/*?*/ GetTxtNode().FindTableNode();
+/*?*/ if( pDstTblNd )
+/*?*/ {
+/*?*/ SwTblField* pTblFld = (SwTblField*)
+/*?*/ pNewHt->GetFld().GetFld();
+/*?*/ pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() );
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_TOXMARK :
+/*N*/ if( pOtherDoc && pDest && pDest->GetpSwpHints()
+/*N*/ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+/*N*/ // Beim Kopieren von TOXMarks(Client) in andere Dokumente
+/*N*/ // muss der Verzeichnis (Modify) ausgetauscht werden
+/*N*/ ((SwTxtTOXMark*)pNewHt)->CopyTOXMark( pOtherDoc );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_CHARFMT :
+/*N*/ // Wenn wir es mit einer Zeichenvorlage zu tun haben,
+/*N*/ // muessen wir natuerlich auch die Formate kopieren.
+/*N*/ if( pDest && pDest->GetpSwpHints()
+/*N*/ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+/*N*/ {
+/*N*/ SwCharFmt* pFmt = (SwCharFmt*)pHt->GetCharFmt().GetCharFmt();
+/*N*/
+/*N*/ if( pFmt && pOtherDoc )
+/*?*/ pFmt = pOtherDoc->CopyCharFmt( *pFmt );
+/*N*/ ((SwFmtCharFmt&)pNewHt->GetCharFmt()).SetCharFmt( pFmt );
+/*N*/ }
+/*N*/ break;
+/*?*/ case RES_TXTATR_INETFMT :
+/*?*/ // Wenn wir es mit benutzerdefinierten INet-Zeichenvorlagen
+/*?*/ // zu tun haben, muessen wir natuerlich auch die Formate kopieren.
+/*?*/ if( pOtherDoc && pDest && pDest->GetpSwpHints()
+/*?*/ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+/*?*/ {
+/*?*/ const SwDoc* pDoc;
+/*?*/ if( 0!=( pDoc = ((SwTxtINetFmt*)pHt)->GetTxtNode().GetDoc() ) )
+/*?*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ const SwCharFmts* pCharFmts = pDoc->GetCharFmts();
+/*?*/ }
+/*?*/ }
+/*?*/ //JP 24.04.98: Bug 49753 - ein TextNode muss am Attribut
+/*?*/ // gesetzt sein, damit die Vorlagen erzeugt
+/*?*/ // werden koenne
+/*?*/ if( !((SwTxtINetFmt*)pNewHt)->GetpTxtNode() )
+/*?*/ ((SwTxtINetFmt*)pNewHt)->ChgTxtNode( pDest );
+/*?*/
+/*?*/ //JP 22.10.97: Bug 44875 - Verbindung zum Format herstellen
+/*?*/ ((SwTxtINetFmt*)pNewHt)->GetCharFmt();
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|* SwTxtNode::CopyAttr()
+|* Beschreibung kopiert Attribute an der Position nStart in pDest.
+|* BP 7.6.93: Es werden mit Absicht nur die Attribute _mit_ EndIdx
+|* kopiert! CopyAttr wird vornehmlich dann gerufen,
+|* wenn Attribute fuer einen Node mit leerem String
+|* gesetzt werden sollen.
+*************************************************************************/
+
+/*N*/ void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
+/*N*/ const xub_StrLen nOldPos )
+/*N*/ {
+/*N*/ if( pSwpHints ) // keine Attribute, keine Kekse
+/*N*/ {
+/*N*/ const xub_StrLen *pEndIdx = 0;
+/*N*/ const SwTxtAttr *pHt = 0;
+/*N*/ SwTxtAttr *pNewHt = 0;
+/*N*/ xub_StrLen nAttrStartIdx = 0;
+/*N*/ USHORT nWhich;
+/*N*/
+/*N*/ SwDoc* pOtherDoc = pDest->GetDoc();
+/*N*/ if( pOtherDoc == GetDoc() )
+/*N*/ pOtherDoc = 0;
+/*N*/
+/*N*/ for( USHORT i = 0; i < pSwpHints->Count(); i++ )
+/*N*/ {
+/*?*/ pHt = (*pSwpHints)[i];
+/*?*/ if( nTxtStartIdx < ( nAttrStartIdx = *pHt->GetStart() ) )
+/*?*/ break; // ueber das Textende, da nLen == 0
+/*?*/
+/*?*/ pEndIdx = pHt->GetEnd();
+/*?*/ if( pEndIdx )
+/*?*/ {
+/*?*/ if( ( *pEndIdx > nTxtStartIdx ||
+/*?*/ ( *pEndIdx == nTxtStartIdx &&
+/*?*/ nAttrStartIdx == nTxtStartIdx ) ) )
+/*?*/ {
+/*?*/ if( RES_TXTATR_REFMARK != ( nWhich = pHt->Which()) )
+/*?*/ {
+/*?*/ // Attribut liegt im Bereich, also kopieren
+/*?*/ if( 0 != ( pNewHt = pDest->Insert( pHt->GetAttr(),
+/*?*/ nOldPos, nOldPos ) ) )
+/*?*/ lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
+/*?*/ }
+/*?*/ else if( !pOtherDoc ? GetDoc()->IsCopyIsMove()
+/*?*/ : 0 == pOtherDoc->GetRefMark(
+/*?*/ pHt->GetRefMark().GetRefName() ) )
+/*?*/ pDest->Insert( pHt->GetAttr(), nOldPos, nOldPos );
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( this != pDest )
+/*N*/ {
+/*N*/ // Frames benachrichtigen, sonst verschwinden die Ftn-Nummern
+/*N*/ SwUpdateAttr aHint( nOldPos, nOldPos, 0 );
+/*N*/ pDest->Modify( 0, &aHint );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|* SwTxtNode::Copy()
+|* Beschreibung kopiert Zeichen und Attibute in pDest,
+|* wird angehaengt
+*************************************************************************/
+
+/*N*/ void SwTxtNode::Copy( SwTxtNode *pDest, const SwIndex &rStart, xub_StrLen nLen )
+/*N*/ {
+/*N*/ SwIndex aIdx( pDest, pDest->aText.Len() );
+/*N*/ Copy( pDest, aIdx, rStart, nLen );
+/*N*/ }
+
+/*N*/ void SwTxtNode::Copy( SwTxtNode *pDest, const SwIndex &rDestStart,
+/*N*/ const SwIndex &rStart, xub_StrLen nLen)
+/*N*/ {
+/*N*/ xub_StrLen nTxtStartIdx = rStart.GetIndex();
+/*N*/ xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken
+/*N*/
+/*N*/ if( !nLen )
+/*N*/ {
+/*N*/ // wurde keine Laenge angegeben, dann Kopiere die Attribute
+/*N*/ // an der Position rStart.
+/*N*/ CopyAttr( pDest, nTxtStartIdx, nDestStart );
+/*N*/
+/*N*/ // harte Absatz umspannende Attribute kopieren
+/*N*/ if( GetpSwAttrSet() )
+/*N*/ {
+/*N*/ // alle, oder nur die CharAttribute ?
+/*N*/ if( nDestStart || pDest->GetpSwAttrSet() ||
+/*N*/ nLen != pDest->GetTxt().Len() )
+/*N*/ {
+/*?*/ SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(),
+/*?*/ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+/*?*/ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+/*?*/ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+/*?*/ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+/*?*/ 0 );
+/*?*/ aCharSet.Put( *GetpSwAttrSet() );
+/*N*/ if( aCharSet.Count() )
+/*N*/ pDest->SetAttr( aCharSet, nDestStart, nDestStart );
+/*N*/ }
+/*N*/ else
+/*N*/ GetpSwAttrSet()->CopyToModify( *pDest );
+/*N*/ }
+/*N*/
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // 1. Text kopieren
+/*N*/ xub_StrLen i = pDest->aText.Len() - nDestStart;
+/*N*/ //JP 15.02.96: Bug 25537 - Attributbehandlung am Ende fehlt! Darum
+/*N*/ // ueber die InsertMethode den Text einfuegen und nicht
+/*N*/ // selbst direkt
+/*N*/ pDest->Insert( aText.Copy( nTxtStartIdx, nLen ), rDestStart,
+/*N*/ INS_EMPTYEXPAND );
+/*N*/
+/*N*/ // um reale Groesse Updaten !
+/*N*/ nLen = pDest->aText.Len() - nDestStart - i;
+/*N*/ if( !nLen ) // String nicht gewachsen ??
+/*N*/ return;
+/*N*/
+/*N*/ i = 0;
+/*N*/ const xub_StrLen *pEndIdx = 0;
+/*N*/ xub_StrLen nAttrStartIdx = 0;
+/*N*/ const SwTxtAttr *pHt = 0;
+/*N*/ SwTxtAttr *pNewHt = 0;
+/*N*/
+/*N*/ SwDoc* pOtherDoc = pDest->GetDoc();
+/*N*/ if( pOtherDoc == GetDoc() )
+/*N*/ pOtherDoc = 0;
+/*N*/
+/*N*/ // harte Absatz umspannende Attribute kopieren
+/*N*/ if( GetpSwAttrSet() )
+/*N*/ {
+/*N*/ // alle, oder nur die CharAttribute ?
+/*N*/ if( nDestStart || pDest->GetpSwAttrSet() ||
+/*N*/ nLen != pDest->GetTxt().Len() )
+/*N*/ {
+/*N*/ SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(),
+/*N*/ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+/*N*/ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+/*N*/ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+/*N*/ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+/*N*/ 0 );
+/*N*/ aCharSet.Put( *GetpSwAttrSet() );
+/*N*/ if( aCharSet.Count() )
+/*N*/ pDest->SetAttr( aCharSet, nDestStart, nDestStart + nLen );
+/*N*/ }
+/*N*/ else
+/*N*/ GetpSwAttrSet()->CopyToModify( *pDest );
+/*N*/ }
+/*N*/
+/*N*/
+/*N*/ const BOOL bUndoNodes = FALSE; // !pOtherDoc && GetDoc()->GetUndoNds() == &GetNodes();
+/*N*/
+/*N*/ // Ende erst jetzt holen, weil beim Kopieren in sich selbst der
+/*N*/ // Start-Index und alle Attribute vorher aktualisiert werden.
+/*N*/ nTxtStartIdx = rStart.GetIndex();
+/*N*/ xub_StrLen nEnd = nTxtStartIdx + nLen;
+/*N*/
+/*N*/ // 2. Attribute kopieren
+/*N*/ // durch das Attribute-Array, bis der Anfang des Geltungsbereiches
+/*N*/ // des Attributs hinter dem zu kopierenden Bereich liegt
+/*N*/ USHORT nWhich, nSize = pSwpHints ? pSwpHints->Count() : 0;
+/*N*/ xub_StrLen nAttrStt, nAttrEnd;
+/*N*/
+/*N*/ // wird in sich selbst kopiert, dann kann beim Einfuegen ein
+/*N*/ // Attribut geloescht werden. Darum erst ins Tmp-Array kopieren und
+/*N*/ // dann erst ins eigene uebertragen.
+/*N*/ SwpHts aArr( 5 );
+/*N*/
+/*N*/ // Del-Array fuer alle RefMarks ohne Ausdehnung
+/*N*/ SwpHts aRefMrkArr;
+/*N*/
+/*N*/ //Achtung: kann ungueltig sein!!
+/*N*/ while( ( i < nSize ) &&
+/*N*/ ((nAttrStartIdx = *(*pSwpHints)[i]->GetStart()) < nEnd) )
+/*N*/ {
+/*N*/ pHt = (*pSwpHints)[i];
+/*N*/ pNewHt = 0;
+/*N*/ pEndIdx = pHt->GetEnd();
+/*N*/ nWhich = pHt->Which();
+/*N*/
+/*N*/ // JP 26.04.94: REFMARK's werden nie kopiert. Hat das Refmark aber
+/*N*/ // keinen Bereich umspannt, so steht im Text ein 255
+/*N*/ // dieses muss entfernt werden. Trick: erst kopieren,
+/*N*/ // erkennen und sammeln, nach dem kopieren Loeschen.
+/*N*/ // Nimmt sein Zeichen mit ins Grab !!
+/*N*/ // JP 14.08.95: Duerfen RefMarks gemovt werden?
+/*N*/ int bCopyRefMark = RES_TXTATR_REFMARK == nWhich && ( bUndoNodes ||
+/*N*/ (!pOtherDoc ? GetDoc()->IsCopyIsMove()
+/*N*/ : 0 == pOtherDoc->GetRefMark(
+/*N*/ pHt->GetRefMark().GetRefName() )));
+/*N*/
+/*N*/ if( pEndIdx && RES_TXTATR_REFMARK == nWhich && !bCopyRefMark )
+/*N*/ {
+/*N*/ ++i;
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ if( nAttrStartIdx < nTxtStartIdx )
+/*N*/ {
+/*N*/ // Anfang liegt vor dem Bereich
+/*?*/ if( pEndIdx && ( nAttrEnd = *pEndIdx ) > nTxtStartIdx )
+/*?*/ {
+/*?*/ // Attribut mit einem Bereich
+/*?*/ // und das Ende des Attribut liegt im Bereich
+/*?*/ nAttrStt = nDestStart;
+/*?*/ nAttrEnd = nAttrEnd > nEnd
+/*?*/ ? rDestStart.GetIndex()
+/*?*/ : nDestStart + nAttrEnd - nTxtStartIdx;
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ ++i;
+/*?*/ continue;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // der Anfang liegt innerhalb des Bereiches
+/*N*/ nAttrStt = nDestStart + ( nAttrStartIdx - nTxtStartIdx );
+/*N*/ if( pEndIdx )
+/*N*/ nAttrEnd = *pEndIdx > nEnd
+/*N*/ ? rDestStart.GetIndex()
+/*N*/ : nDestStart + ( *pEndIdx - nTxtStartIdx );
+/*N*/ else
+/*N*/ nAttrEnd = nAttrStt;
+/*N*/ }
+/*N*/
+/*N*/ if( pDest == this )
+/*N*/ {
+/*N*/ // die Daten kopieren
+/*?*/ pNewHt = MakeTxtAttr( pHt->GetAttr(), nAttrStt, nAttrEnd );
+/*?*/
+/*?*/ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+/*?*/ //JP 23.04.95: erstmal so gesondert hier behandeln. Am Besten ist es
+/*?*/ // aber im CopyFtn wenn die pDestFtn keinen StartNode hat,
+/*?*/ // sich diesen dann anlegt.
+/*?*/ // Aber so kurz vor der BETA besser nicht anfassen.
+/*?*/ if( RES_TXTATR_FTN == nWhich )
+/*?*/ {
+/*?*/ SwTxtFtn* pFtn = (SwTxtFtn*)pNewHt;
+/*?*/ pFtn->ChgTxtNode( this );
+/*?*/ pFtn->MakeNewTextSection( GetNodes() );
+/*?*/ lcl_CopyHint( nWhich, pHt, pFtn, 0, 0 );
+/*?*/ pFtn->ChgTxtNode( 0 );
+/*?*/ }
+/*?*/ else
+/*?*/ //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+/*?*/ {
+/*?*/ lcl_CopyHint( nWhich, pHt, pNewHt, 0, pDest );
+/*?*/ }
+/*?*/ aArr.C40_INSERT( SwTxtAttr, pNewHt, aArr.Count() );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pNewHt = pDest->Insert( pHt->GetAttr(), nAttrStt,
+/*N*/ nAttrEnd, SETATTR_NOTXTATRCHR );
+/*N*/ if( pNewHt )
+/*N*/ lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
+/*N*/ else if( !pEndIdx )
+/*N*/ {
+/*N*/ // Attribut wurde nicht kopiert, hat seinen Inhalt mitgenommen!
+/*N*/ // Damit der rest aber korrekt kopiert werden kann, muss das
+/*N*/ // Zeichen wieder an der Position stehen. Darum hier ein
+/*N*/ // "Dummy-TextAttribut" einfuegen, wird am Ende wieder entfernt!
+/*?*/ pNewHt = pDest->Insert( SwFmtHardBlank( 0xB7 ), nAttrStt, 0
+/*?*/ /*???, INS_NOHINTEXPAND*/ );
+/*?*/ aRefMrkArr.C40_INSERT( SwTxtAttr, pNewHt, aRefMrkArr.Count() );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( RES_TXTATR_REFMARK == nWhich && !pEndIdx && !bCopyRefMark )
+/*N*/ {
+/*?*/ aRefMrkArr.C40_INSERT( SwTxtAttr, pNewHt, aRefMrkArr.Count() );
+/*N*/ }
+/*N*/
+/*N*/ ++i;
+/*N*/ }
+/*N*/
+/*N*/ // nur falls im Array Attribute stehen (kann nur beim Kopieren
+/*N*/ // sich selbst passieren!!)
+/*N*/ for( i = 0; i < aArr.Count(); ++i )
+/*?*/ Insert( aArr[ i ], SETATTR_NOTXTATRCHR );
+/*N*/
+/*N*/ if( pDest->GetpSwpHints() )
+/*N*/ for( i = 0; i < aRefMrkArr.Count(); ++i )
+/*N*/ {
+/*?*/ pNewHt = aRefMrkArr[i];
+/*?*/ if( pNewHt->GetEnd() )
+/*?*/ {
+/*?*/ pDest->GetpSwpHints()->Delete( pNewHt );
+/*?*/ pDest->DestroyAttr( pNewHt );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ const SwIndex aIdx( pDest, *pNewHt->GetStart() );
+/*?*/ pDest->Erase( aIdx, 1 );
+/*?*/ }
+/*N*/ }
+/*N*/
+/*N*/ CHECK_SWPHINTS(this);
+/*N*/ }
+
+
+/*
+ * Rudimentaeres Editieren, damit die SwDoc-Insert-Methoden
+ * funktionieren.
+ */
+
+/*M*/ SwTxtNode& SwTxtNode::Insert( const XubString &rStr,
+/*M*/ const SwIndex &rIdx, const USHORT nMode )
+/*M*/ {
+/*M*/ ASSERT( rIdx <= aText.Len(), "Array ueberindiziert." );
+/*M*/ ASSERT( (ULONG)aText.Len() + (ULONG)rStr.Len() <= STRING_LEN,
+/*M*/ "STRING_LEN ueberschritten." );
+/*M*/
+/*M*/ xub_StrLen aPos = rIdx.GetIndex();
+/*M*/ xub_StrLen nLen = aText.Len() - aPos;
+/*M*/
+/*M*/ // sequence input checking
+/*M*/ sal_Bool bInputChecked = sal_False;
+/*M*/
+/*M*/ // We check only buffers which contain less than MAX_SEQUENCE_CHECK_LEN
+/*M*/ // characters. This is for performance reasons, because a "copy and paste"
+/*M*/ // can give us a really big input string.
+/*N*/ SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
+/*N*/ if ( rCTLOptions.IsCTLFontEnabled() &&
+/*N*/ rCTLOptions.IsCTLSequenceChecking() && aPos &&
+/*M*/ rStr.Len() < MAX_SEQUENCE_CHECK_LEN && pBreakIt->xBreak.is() &&
+/*M*/ ::com::sun::star::i18n::ScriptType::COMPLEX ==
+/*M*/ pBreakIt->xBreak->getScriptType( rStr, 0 ) )
+/*M*/ {
+/*M*/ // generate new sequence input checker if not already done
+/*M*/ if ( ! pCheckIt )
+/*M*/ pCheckIt = new SwCheckIt;
+/*M*/
+/*M*/ if ( pCheckIt->xCheck.is() )
+/*M*/ {
+/*M*/ xub_StrLen nI = 0;
+/*M*/ xub_StrLen nTmpPos = aPos;
+/*M*/ xub_Unicode cChar;
+/*M*/
+/*M*/ while ( nI < rStr.Len() )
+/*M*/ {
+/*M*/ cChar = rStr.GetChar( nI++ );
+/*M*/ if ( pCheckIt->xCheck->checkInputSequence(
+/*M*/ aText, nTmpPos - 1, cChar,
+/*N*/ ::com::sun::star::i18n::InputSequenceCheckMode::BASIC ) )
+/*M*/ {
+/*M*/ // character can be inserted
+/*M*/ aText.Insert( cChar, nTmpPos++ );
+/*M*/ }
+/*M*/ }
+/*M*/ bInputChecked = sal_True;
+/*M*/ }
+/*M*/ }
+/*M*/
+/*M*/ if ( ! bInputChecked )
+/*M*/ aText.Insert( rStr, aPos );
+/*M*/
+/*M*/ nLen = aText.Len() - aPos - nLen;
+/*M*/ if( !nLen ) // String nicht gewachsen ??
+/*M*/ return *this;
+/*M*/ Update( rIdx, nLen ); // um reale Groesse Updaten !
+/*M*/
+/*M*/ // analog zu Insert(char) in txtedt.cxx:
+/*M*/ // 1) bei bHintExp leere Hints an rIdx.GetIndex suchen und aufspannen
+/*M*/ // 2) bei bHintExp == FALSE mitgezogene Feldattribute zuruecksetzen
+/*M*/
+/*M*/ register USHORT i;
+/*M*/
+/*M*/ if( pSwpHints )
+/*M*/ {
+/*M*/ for( i = 0; i < pSwpHints->Count() &&
+/*M*/ rIdx >= *(*pSwpHints)[i]->GetStart(); ++i )
+/*M*/ {
+/*M*/ SwTxtAttr *pHt = pSwpHints->GetHt( i );
+/*M*/ xub_StrLen* pEndIdx = pHt->GetEnd();
+/*M*/ if( !pEndIdx )
+/*M*/ continue;
+/*M*/
+/*M*/ if( rIdx == *pEndIdx )
+/*M*/ {
+/*M*/ if( nMode & INS_NOHINTEXPAND || pHt->DontExpand() )
+/*M*/ {
+/*M*/ // bei leeren Attributen auch Start veraendern
+/*M*/ if( rIdx == *pHt->GetStart() )
+/*M*/ *pHt->GetStart() -= nLen;
+/*M*/ *pEndIdx -= nLen;
+/*M*/ }
+/*M*/ // leere Hints an rIdx.GetIndex ?
+/*M*/ else if( nMode & INS_EMPTYEXPAND &&
+/*M*/ *pEndIdx == *pHt->GetStart() )
+/*M*/ {
+/*M*/ *pHt->GetStart() -= nLen;
+/*M*/
+/*M*/ // 8484: Symbol von 0-4, Roman von 4-6,
+/*M*/ // neuer Hint: Roman 4-4
+/*M*/
+/*M*/ // - while ... die Vorgaenger ueberpruefen:
+/*M*/ // wenn gleiches Ende und gleicher Which
+/*M*/ // => das Ende des gefundenen zuruecksetzen
+/*M*/ const USHORT nWhich = pHt->Which();
+/*M*/ SwTxtAttr *pFound;
+/*M*/ xub_StrLen *pFoundEnd;
+/*M*/ for( USHORT j = 0; j < i; ++j )
+/*M*/ if( 0 != (pFound = pSwpHints->GetHt( j )) &&
+/*M*/ nWhich == pFound->Which() &&
+/*M*/ 0 != ( pFoundEnd = pFound->GetEnd() ) &&
+/*M*/ rIdx == *pFoundEnd )
+/*M*/ {
+/*M*/ *pFoundEnd -= nLen;
+/*M*/ const USHORT nAktHtLen = pSwpHints->Count();
+/*M*/ pSwpHints->DeleteAtPos(j);
+/*M*/ Insert( pFound, SETATTR_NOHINTADJUST );
+/*M*/ // AMA: Sicher ist sicher, falls pFound weiter hinten
+/*M*/ // einsortiert wurde, koennte sonst die neue Position
+/*M*/ // j vergessen werden!
+/*M*/ if ( j ) --j;
+/*M*/ // falls Attribute zusammengefasst werden, steht
+/*M*/ // der "Index" ins Array falsch !
+/*M*/ i -= nAktHtLen - pSwpHints->Count();
+/*M*/ // Insert und Delete ?
+/*M*/ }
+/*M*/
+/*M*/ // ist unser Attribut ueberhaupt noch vorhanden ?
+/*M*/ if( pHt == pSwpHints->GetHt( i ) )
+/*M*/ {
+/*M*/ const USHORT nAktLen = pSwpHints->Count();
+/*M*/ pSwpHints->DeleteAtPos(i);
+/*M*/ Insert( pHt, SETATTR_NOHINTADJUST );
+/*M*/ if( nAktLen > pSwpHints->Count() && i )
+/*M*/ --i;
+/*M*/ }
+/*M*/ continue;
+/*M*/ }
+/*M*/ else
+/*M*/ continue;
+/*M*/ pSwpHints->DeleteAtPos(i);
+/*M*/ Insert( pHt, SETATTR_NOHINTADJUST );
+/*M*/ }
+/*M*/ if ( !(nMode & INS_NOHINTEXPAND) &&
+/*M*/ rIdx == nLen && *pHt->GetStart() == rIdx.GetIndex() &&
+/*M*/ !pHt->IsDontExpandStartAttr() )
+/*M*/ {
+/*M*/ // Kein Feld, am Absatzanfang, HintExpand
+/*M*/ pSwpHints->DeleteAtPos(i);
+/*M*/ *pHt->GetStart() -= nLen;
+/*M*/ Insert( pHt, SETATTR_NOHINTADJUST );
+/*M*/ }
+/*M*/ }
+/*M*/ if ( pSwpHints->CanBeDeleted() )
+/*M*/ DELETEZ( pSwpHints );
+/*M*/ }
+/*M*/
+/*M*/ if ( GetDepends() )
+/*M*/ {
+/*M*/ SwInsTxt aHint( aPos, nLen );
+/*M*/ SwModify::Modify( 0, &aHint );
+/*M*/ }
+/*M*/
+/*M*/ CHECK_SWPHINTS(this);
+/*M*/ return *this;
+/*M*/ }
+
+/*************************************************************************
+|*
+|* SwTxtNode::Cut()
+|*
+|* Beschreibung text.doc
+|* Ersterstellung VB 20.03.91
+|* Letzte Aenderung JP 11.08.94
+|*
+*************************************************************************/
+
+/*N*/ void SwTxtNode::Cut( SwTxtNode *pDest, const SwIndex &rStart, xub_StrLen nLen )
+/*N*/ {
+/*N*/ if(pDest)
+/*N*/ {
+/*N*/ SwIndex aDestStt( pDest, pDest->GetTxt().Len() );
+/*N*/ _Cut( pDest, aDestStt, rStart, nLen, FALSE );
+/*N*/ }
+/*N*/ else
+/*N*/ Erase( rStart, nLen );
+/*N*/ }
+
+
+/*N*/ void SwTxtNode::_Cut( SwTxtNode *pDest, const SwIndex& rDestStart,
+/*N*/ const SwIndex &rStart, xub_StrLen nLen, BOOL bUpdate )
+/*N*/ {
+/*N*/ if(!pDest)
+/*N*/ {
+/*?*/ Erase( rStart, nLen );
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // nicht im Dokument verschieben ?
+/*N*/ if( GetDoc() != pDest->GetDoc() )
+/*N*/ {
+/*?*/ Copy( pDest, rDestStart, rStart, nLen);
+/*?*/ Erase(rStart,nLen);
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ if( !nLen )
+/*N*/ {
+/*N*/ // wurde keine Laenge angegeben, dann Kopiere die Attribute
+/*N*/ // an der Position rStart.
+/*N*/ CopyAttr( pDest, rStart.GetIndex(), rDestStart.GetIndex() );
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ xub_StrLen nTxtStartIdx = rStart.GetIndex();
+/*N*/ xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken
+/*N*/ xub_StrLen nInitSize = pDest->aText.Len();
+/*N*/
+/*N*/ xub_StrLen *pEndIdx = 0;
+/*N*/ xub_StrLen nAttrStartIdx = 0;
+/*N*/ SwTxtAttr *pHt = 0;
+/*N*/ SwTxtAttr *pNewHt = 0;
+/*N*/
+/*N*/ // wird in sich selbst verschoben, muss es gesondert behandelt werden !!
+/*N*/ if( pDest == this )
+/*N*/ {
+/*?*/ aText.Insert( aText, nTxtStartIdx, nLen, nDestStart );
+/*?*/ aText.Erase( nTxtStartIdx + (nDestStart<nTxtStartIdx ? nLen : 0), nLen );
+/*?*/
+/*?*/ xub_StrLen nEnd = rStart.GetIndex() + nLen;
+/*?*/ USHORT n;
+/*?*/
+/*?*/ // dann suche mal alle Attribute zusammen, die im verschobenen
+/*?*/ // Bereich liegen. Diese werden in das extra Array verschoben,
+/*?*/ // damit sich die Indizies beim Updaten nicht veraendern !!!
+/*?*/ SwIndexReg aTmpRegArr;
+/*?*/ SwpHts aArr( 5 );
+/*?*/
+/*?*/ // 2. Attribute verschieben
+/*?*/ // durch das Attribute-Array, bis der Anfang des Geltungsbereiches
+/*?*/ // des Attributs hinter dem zu verschiebenden Bereich liegt
+/*?*/ USHORT nAttrCnt = 0, nWhich;
+/*?*/ while( pSwpHints && nAttrCnt < pSwpHints->Count() &&
+/*?*/ (nAttrStartIdx = *(pHt = pSwpHints->GetHt(nAttrCnt))->
+/*?*/ GetStart()) < nEnd )
+/*?*/ {
+/*?*/ pNewHt = 0;
+/*?*/ pEndIdx = pHt->GetEnd();
+/*?*/
+/*?*/ if(nAttrStartIdx < nTxtStartIdx)
+/*?*/ {
+/*?*/ // Anfang liegt vor dem Bereich
+/*?*/ if( RES_TXTATR_REFMARK != ( nWhich = pHt->Which() ) &&
+/*?*/ pEndIdx && *pEndIdx > nTxtStartIdx )
+/*?*/ {
+/*?*/ // Attribut mit einem Bereich
+/*?*/ // und das Ende des Attribut liegt im Bereich
+/*?*/ pNewHt = MakeTxtAttr( pHt->GetAttr(), 0,
+/*?*/ *pEndIdx > nEnd
+/*?*/ ? nLen
+/*?*/ : *pEndIdx - nTxtStartIdx );
+/*?*/ }
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // der Anfang liegt vollstaendig im Bereich
+/*?*/ if( !pEndIdx || *pEndIdx < nEnd )
+/*?*/ {
+/*?*/ // Attribut verschieben
+/*?*/ pSwpHints->Delete( pHt );
+/*?*/ // die Start/End Indicies neu setzen
+/*?*/ *pHt->GetStart() = nAttrStartIdx - nTxtStartIdx;
+/*?*/ if( pEndIdx )
+/*?*/ *pHt->GetEnd() = *pEndIdx - nTxtStartIdx;
+/*?*/ aArr.C40_INSERT( SwTxtAttr, pHt, aArr.Count() );
+/*?*/ continue; // while-Schleife weiter, ohne ++ !
+/*?*/ }
+/*?*/ // das Ende liegt dahinter
+/*?*/ else if( RES_TXTATR_REFMARK != ( nWhich = pHt->Which() ))
+/*?*/ {
+/*?*/ pNewHt = MakeTxtAttr( pHt->GetAttr(),
+/*?*/ nAttrStartIdx - nTxtStartIdx,
+/*?*/ !pEndIdx ? 0
+/*?*/ : ( *pEndIdx > nEnd
+/*?*/ ? nLen
+/*?*/ : *pEndIdx - nTxtStartIdx ));
+/*?*/ }
+/*?*/ }
+/*?*/ if( pNewHt )
+/*?*/ {
+/*?*/ // die Daten kopieren
+/*?*/ lcl_CopyHint( nWhich, pHt, pNewHt, 0, this );
+/*?*/ aArr.C40_INSERT( SwTxtAttr, pNewHt, aArr.Count() );
+/*?*/ }
+/*?*/ ++nAttrCnt;
+/*?*/ }
+/*?*/
+/*?*/ if( bUpdate )
+/*?*/ // Update aller Indizies
+/*?*/ Update( rDestStart, nLen );
+/*?*/ #ifdef CUTNOEXPAND
+/*?*/ else
+/*?*/ // wird am Ende eingefuegt, nur die Attribut-Indizies verschieben
+/*?*/ if( 0 < nLen && 0 < nInitSize && pSwpHints )
+/*?*/ {
+/*?*/ // siehe nach, ob an der Einfuegeposition das Ende eines
+/*?*/ // Attributes stand. Ist es kein Feld, muss es expandiert werden !!!
+/*?*/ for( n = 0; n < pSwpHints->Count(); n++ )
+/*?*/ {
+/*?*/ pHt = pSwpHints->GetHt(n);
+/*?*/ if( 0 != ( pEndIdx = pHt->GetEnd() ) &&
+/*?*/ *pEndIdx == nInitSize )
+/*?*/ *pEndIdx += nLen;
+/*?*/ }
+/*?*/ }
+/*?*/ #endif
+/*?*/ CHECK_SWPHINTS(this);
+/*?*/
+/*?*/ Update( rStart, nLen, TRUE );
+/*?*/
+/*?*/ CHECK_SWPHINTS(this);
+/*?*/
+/*?*/ // dann setze die kopierten/geloeschten Attribute in den Node
+/*?*/ if( nDestStart <= nTxtStartIdx )
+/*?*/ nTxtStartIdx += nLen;
+/*?*/ else
+/*?*/ nDestStart -= nLen;
+/*?*/
+/*?*/ for( n = 0; n < aArr.Count(); ++n )
+/*?*/ {
+/*?*/ pNewHt = aArr[n];
+/*?*/ *pNewHt->GetStart() = nDestStart + *pNewHt->GetStart();
+/*?*/ if( 0 != ( pEndIdx = pNewHt->GetEnd() ))
+/*?*/ *pEndIdx = nDestStart + *pEndIdx;
+/*?*/ Insert( pNewHt, SETATTR_NOTXTATRCHR );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ xub_StrLen i = nInitSize - nDestStart;
+/*N*/ pDest->aText.Insert( aText, nTxtStartIdx, nLen, nDestStart );
+/*N*/ aText.Erase( nTxtStartIdx, nLen );
+/*N*/ nLen = pDest->aText.Len() - nDestStart - i; // um reale Groesse Updaten !
+/*N*/ if( !nLen ) // String nicht gewachsen ??
+/*N*/ return;
+/*N*/
+/*N*/ i = 0;
+/*N*/
+/*N*/ if( bUpdate )
+/*N*/ // Update aller Indizies
+/*N*/ pDest->Update( rDestStart, nLen);
+/*N*/ #ifdef CUTNOEXPAND
+/*N*/ else
+/*N*/ // wird am Ende eingefuegt, nur die Attribut-Indizies verschieben
+/*N*/ if( 0 < nLen && 0 < nInitSize && pDest->pSwpHints )
+/*N*/ {
+/*N*/ // siehe nach, ob an der Einfuegeposition das Ende eines
+/*N*/ // Attributes stand. Ist es kein Feld, muss es expandiert werden !!!
+/*N*/ for( USHORT n = 0; n < pDest->pSwpHints->Count(); n++ )
+/*N*/ {
+/*N*/ pHt = pDest->pSwpHints->GetHt(n);
+/*N*/ if( 0 != ( pEndIdx = pHt->GetEnd() ) &&
+/*N*/ *pEndIdx == nInitSize )
+/*N*/ *pEndIdx += nLen;
+/*N*/ }
+/*N*/ }
+/*N*/ #endif
+/*N*/ CHECK_SWPHINTS(pDest);
+/*N*/
+/*N*/ USHORT nEnd = rStart.GetIndex() + nLen;
+/*N*/ SwDoc* pOtherDoc = pDest->GetDoc();
+/*N*/ if( pOtherDoc == GetDoc() )
+/*N*/ pOtherDoc = 0;
+/*N*/ const BOOL bUndoNodes = FALSE; // !pOtherDoc && GetDoc()->GetUndoNds() == &GetNodes();
+/*N*/
+/*N*/ // harte Absatz umspannende Attribute kopieren
+/*N*/ if( GetpSwAttrSet() )
+/*N*/ {
+/*N*/ // alle, oder nur die CharAttribute ?
+/*N*/ if( nInitSize || pDest->GetpSwAttrSet() ||
+/*N*/ nLen != pDest->GetTxt().Len() )
+/*N*/ {
+/*?*/ SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(),
+/*?*/ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+/*?*/ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+/*?*/ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+/*?*/ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+/*?*/ 0 );
+/*?*/ aCharSet.Put( *GetpSwAttrSet() );
+/*?*/ if( aCharSet.Count() )
+/*?*/ pDest->SetAttr( aCharSet, nDestStart, nDestStart + nLen );
+/*N*/ }
+/*N*/ else
+/*N*/ GetpSwAttrSet()->CopyToModify( *pDest );
+/*N*/ }
+/*N*/
+/*N*/ // 2. Attribute verschieben
+/*N*/ // durch das Attribute-Array, bis der Anfang des Geltungsbereiches
+/*N*/ // des Attributs hinter dem zu verschiebenden Bereich liegt
+/*N*/ USHORT nAttrCnt = 0, nWhich;
+/*N*/ while( pSwpHints && nAttrCnt < pSwpHints->Count() &&
+/*N*/ ( (nAttrStartIdx = *(pHt = pSwpHints->GetHt(nAttrCnt))->
+/*N*/ GetStart()) < nEnd ) )
+/*N*/ {
+/*N*/ pNewHt = 0;
+/*N*/ pEndIdx = pHt->GetEnd();
+/*N*/
+/*N*/ if(nAttrStartIdx < nTxtStartIdx)
+/*N*/ {
+/*N*/ // Anfang liegt vor dem Bereich
+/*?*/ if( ( RES_TXTATR_REFMARK != ( nWhich = pHt->Which() )
+/*?*/ || bUndoNodes ) && pEndIdx && *pEndIdx > nTxtStartIdx )
+/*?*/ {
+/*?*/ // Attribut mit einem Bereich
+/*?*/ // und das Ende des Attribut liegt im Bereich
+/*?*/ pNewHt = pDest->MakeTxtAttr( pHt->GetAttr(), nDestStart,
+/*?*/ nDestStart + (
+/*?*/ *pEndIdx > nEnd
+/*?*/ ? nLen
+/*?*/ : *pEndIdx - nTxtStartIdx ) );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // der Anfang liegt vollstaendig im Bereich
+/*N*/ nWhich = pHt->Which();
+/*N*/ if( !pEndIdx || *pEndIdx < nEnd ||
+/*N*/ ( !pOtherDoc && !bUndoNodes && RES_TXTATR_REFMARK
+/*N*/ == nWhich ) )
+/*N*/ {
+/*N*/ // Attribut verschieben
+/*N*/ pSwpHints->Delete( pHt );
+/*N*/ // die Start/End Indicies neu setzen
+/*N*/ *pHt->GetStart() =
+/*N*/ nDestStart + (nAttrStartIdx - nTxtStartIdx);
+/*N*/ if( pEndIdx )
+/*N*/ *pHt->GetEnd() = nDestStart + (
+/*N*/ *pEndIdx > nEnd
+/*N*/ ? nLen
+/*N*/ : *pEndIdx - nTxtStartIdx );
+/*N*/ pDest->Insert( pHt, SETATTR_NOTXTATRCHR | SETATTR_DONTREPLACE );
+/*N*/ continue; // while-Schleife weiter, ohne ++ !
+/*N*/ }
+/*N*/ // das Ende liegt dahinter
+/*N*/ else if( RES_TXTATR_REFMARK != nWhich || bUndoNodes )
+/*N*/ {
+/*N*/ pNewHt = MakeTxtAttr( pHt->GetAttr(),
+/*N*/ nDestStart + (nAttrStartIdx - nTxtStartIdx),
+/*N*/ !pEndIdx ? 0
+/*N*/ : nDestStart + ( *pEndIdx > nEnd
+/*N*/ ? nLen
+/*N*/ : *pEndIdx - nTxtStartIdx ));
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pNewHt )
+/*N*/ {
+/*N*/ if( pDest->Insert( pNewHt, SETATTR_NOTXTATRCHR | SETATTR_DONTREPLACE ))
+/*N*/ lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
+/*N*/ }
+/*N*/ ++nAttrCnt;
+/*N*/ }
+/*N*/ // sollten jetzt noch leere Attribute rumstehen, dann haben diese
+/*N*/ // eine hoehere Praezedenz. Also herausholen und das Array updaten.
+/*N*/ // Die dabei entstehenden leeren Hints werden von den gesicherten
+/*N*/ // "uebergeplaettet". (Bug: 6977)
+/*N*/ if( pSwpHints && nAttrCnt < pSwpHints->Count() )
+/*N*/ {
+/*?*/ SwpHts aArr( 5 );
+/*?*/ for( ; nAttrCnt < pSwpHints->Count() &&
+/*?*/ nEnd == *(pHt = pSwpHints->GetHt(nAttrCnt))->GetStart();
+/*?*/ ++nAttrCnt )
+/*?*/ {
+/*?*/ if( 0 != ( pEndIdx = pHt->GetEnd() ) && *pEndIdx == nEnd )
+/*?*/ {
+/*?*/ aArr.C40_INSERT( SwTxtAttr, pHt, aArr.Count() );
+/*?*/ pSwpHints->Delete( pHt );
+/*?*/ --nAttrCnt;
+/*?*/ }
+/*?*/ }
+/*?*/ Update( rStart, nLen, TRUE );
+/*?*/
+/*?*/ for( nAttrCnt = 0; nAttrCnt < aArr.Count(); ++nAttrCnt )
+/*?*/ {
+/*?*/ pHt = aArr[ nAttrCnt ];
+/*?*/ *pHt->GetStart() = *pHt->GetEnd() = rStart.GetIndex();
+/*?*/ Insert( pHt );
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ Update( rStart, nLen, TRUE );
+/*N*/
+/*N*/ CHECK_SWPHINTS(this);
+/*N*/ }
+/*N*/
+/*N*/ if( pSwpHints && pSwpHints->CanBeDeleted() )
+/*N*/ DELETEZ( pSwpHints );
+/*N*/
+/*N*/ // Frames benachrichtigen;
+/*N*/ SwInsTxt aInsHint( nDestStart, nLen );
+/*N*/ pDest->SwCntntNode::Modify( 0, &aInsHint );
+/*N*/ SwDelTxt aDelHint( nTxtStartIdx, nLen );
+/*N*/ SwCntntNode::Modify( 0, &aDelHint );
+/*N*/ }
+
+
+/*N*/ SwTxtNode& SwTxtNode::Erase(const SwIndex &rIdx, xub_StrLen nCount,
+/*N*/ const USHORT nMode )
+/*N*/ {
+/*N*/ ASSERT( rIdx <= aText.Len(), "Array ueberindiziert." );
+/*N*/
+/*N*/ const xub_StrLen nCnt = STRING_LEN == nCount
+/*N*/ ? aText.Len() - rIdx.GetIndex() : nCount;
+/*N*/ aText.Erase( rIdx.GetIndex(), nCnt );
+/*N*/
+ /* GCAttr(); alle leeren weggwerfen ist zu brutal.
+ * Es duerfen nur die wegggeworfen werden,
+ * die im Bereich liegen und nicht am Ende des Bereiches liegen
+ */
+/*N*/
+/*N*/ // Abfrage auf pSwpHints weil TextFelder und FlyFrames Text loeschen
+/*N*/ // (Rekursion)!!
+/*N*/ for( USHORT i = 0; pSwpHints && i < pSwpHints->Count(); ++i )
+/*N*/ {
+/*N*/ SwTxtAttr *pHt = pSwpHints->GetHt(i);
+/*N*/
+/*N*/ const xub_StrLen nHtStt = *pHt->GetStart();
+/*N*/
+/*N*/ if( nHtStt < rIdx.GetIndex() )
+/*N*/ continue;
+/*N*/
+/*N*/ // TextFelder und FlyFrames loeschen Text (Rekursion)!!
+/*N*/ const xub_StrLen nEndIdx = rIdx.GetIndex() + nCnt;
+/*N*/ if( nHtStt > nEndIdx )
+/*N*/ // die Hints sind nach Ende sortiert, also ist Start
+/*N*/ // vom Hint groesser als EndIdx dann Abbrechen
+/*N*/ break;
+/*N*/
+/*N*/ const xub_StrLen* pHtEndIdx = pHt->GetEnd();
+/*N*/ const USHORT nWhich = pHt->Which();
+/*N*/
+/*N*/ if( !pHtEndIdx )
+/*N*/ {
+/*N*/ // TxtHints ohne EndIndex werden natuerlich auch geloescht:
+/*N*/ if( RES_TXTATR_BEGIN <= nWhich && RES_TXTATR_END > nWhich &&
+/*N*/ nHtStt >= rIdx.GetIndex() && nHtStt < nEndIdx )
+/*N*/ {
+/*N*/ pSwpHints->DeleteAtPos(i);
+/*N*/ // Damit im Dtor der TxtAttr ohne End die CH_TXTATR nicht
+/*N*/ // geloescht werden...
+/*N*/ *(pHt->GetStart()) = USHRT_MAX;
+/*N*/ DestroyAttr( pHt );
+/*N*/ --i;
+/*N*/ }
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ if( *pHtEndIdx >= nEndIdx && !(
+/*N*/ !(INS_EMPTYEXPAND & nMode) && *pHtEndIdx == nEndIdx &&
+/*N*/ (nWhich == RES_TXTATR_TOXMARK || nWhich == RES_TXTATR_REFMARK)) )
+/*N*/ continue;
+/*N*/
+/*N*/ pSwpHints->DeleteAtPos(i);
+/*N*/ DestroyAttr( pHt );
+/*N*/ --i;
+/*N*/ }
+/*N*/
+/*N*/ if ( pSwpHints && pSwpHints->CanBeDeleted() )
+/*?*/ DELETEZ( pSwpHints );
+/*N*/
+/*N*/ Update( rIdx, nCnt, TRUE );
+/*N*/
+/*N*/ if( 1 == nCnt )
+/*N*/ {
+/*N*/ SwDelChr aHint( rIdx.GetIndex() );
+/*N*/ SwModify::Modify( 0, &aHint );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwDelTxt aHint( rIdx.GetIndex(), nCnt );
+/*N*/ SwModify::Modify( 0, &aHint );
+/*N*/ }
+/*N*/
+/*N*/ CHECK_SWPHINTS(this);
+/*N*/ return *this;
+/*N*/ }
+
+/***********************************************************************
+#* Class : SwTxtNode
+#* Methode : GCAttr
+#*
+#* Beschreibung
+#* text.doc
+#*
+#* Datum : MS 28.11.90
+#* Update : VB 24.07.91
+#***********************************************************************/
+
+
+/*N*/ const SwNodeNum* SwTxtNode::UpdateNum( const SwNodeNum& rNum )
+/*N*/ {
+/*N*/ if( NO_NUMBERING == rNum.GetLevel() ) // kein Nummerierung mehr ?
+/*N*/ {
+/*N*/ if( !pNdNum )
+/*N*/ return 0;
+/*N*/ delete pNdNum, pNdNum = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pNdNum )
+/*N*/ pNdNum = new SwNodeNum( rNum );
+/*N*/ else if( !( *pNdNum == rNum ))
+/*N*/ *pNdNum = rNum;
+/*N*/ }
+/*N*/ NumRuleChgd();
+/*N*/ return pNdNum;
+/*N*/ }
+
+/*N*/ const SwNumRule* SwTxtNode::GetNumRule() const
+/*N*/ {
+/*N*/ const SwNumRule* pRet = 0;
+/*N*/ const SfxPoolItem* pItem = GetNoCondAttr( RES_PARATR_NUMRULE, TRUE );
+/*N*/ if( pItem && ((SwNumRuleItem*)pItem)->GetValue().Len() )
+/*N*/ pRet = GetDoc()->FindNumRulePtr( ((SwNumRuleItem*)pItem)->GetValue() );
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ void SwTxtNode::NumRuleChgd()
+/*N*/ {
+/*N*/ #ifndef NUM_RELSPACE
+/*N*/
+/*N*/ // 6969: Aktualisierung der NumPortions auch bei leeren Zeilen!
+/*N*/ SwInsTxt aHint( 0, 0 );
+/*N*/ SwModify::Modify( 0, &aHint );
+/*N*/
+/*N*/ #else
+/*N*/
+/*N*/ if( IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ SetInSwFntCache( FALSE );
+/*N*/
+/*N*/ SvxLRSpaceItem& rLR = (SvxLRSpaceItem&)GetSwAttrSet().GetLRSpace();
+/*N*/ SwModify::Modify( &rLR, &rLR );
+/*N*/
+/*N*/ #endif
+/*N*/ }
+
+/*N*/ const SwNodeNum* SwTxtNode::UpdateOutlineNum( const SwNodeNum& rNum )
+/*N*/ {
+/*N*/ if( NO_NUMBERING == rNum.GetLevel() ) // kein Nummerierung mehr ?
+/*N*/ {
+/*N*/ if( !pNdOutl )
+/*N*/ return 0;
+/*N*/ delete pNdOutl, pNdOutl = 0;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ if( !pNdOutl )
+/*N*/ pNdOutl = new SwNodeNum( rNum );
+/*N*/ else if( !( *pNdOutl == rNum ))
+/*N*/ *pNdOutl = rNum;
+/*N*/ }
+/*N*/
+/*N*/ // 6969: Aktualisierung der NumPortions auch bei leeren Zeilen!
+/*N*/ NumRuleChgd();
+/*N*/ return pNdOutl;
+/*N*/ }
+
+/*N*/ SwTxtNode* SwTxtNode::_MakeNewTxtNode( const SwNodeIndex& rPos, BOOL bNext,
+/*N*/ BOOL bChgFollow )
+/*N*/ {
+/*N*/ /* hartes PageBreak/PageDesc/ColumnBreak aus AUTO-Set ignorieren */
+/*N*/ SwAttrSet* pNewAttrSet = 0;
+/*N*/ if( GetpSwAttrSet() )
+/*N*/ {
+/*N*/ pNewAttrSet = new SwAttrSet( *GetpSwAttrSet() );
+/*N*/ SwAttrSet* pTmpSet = GetpSwAttrSet();
+/*N*/
+/*N*/ if( bNext ) // der naechste erbt keine Breaks!
+/*N*/ pTmpSet = pNewAttrSet;
+/*N*/
+/*N*/ // PageBreaks/PageDesc/ColBreak rausschmeissen.
+/*N*/ BOOL bRemoveFromCache = 0 != pTmpSet->ClearItem( RES_PAGEDESC );
+/*N*/ if( SFX_ITEM_SET == pTmpSet->GetItemState( RES_BREAK, FALSE ) )
+/*N*/ {
+/*N*/ pTmpSet->ClearItem( RES_BREAK );
+/*N*/ bRemoveFromCache = TRUE;
+/*N*/ }
+/*N*/ if( !bNext && bRemoveFromCache && IsInCache() )
+/*N*/ {
+/*N*/ SwFrm::GetCache().Delete( this );
+/*N*/ SetInCache( FALSE );
+/*N*/ }
+/*N*/ }
+/*N*/ SwNodes& rNds = GetNodes();
+/*N*/
+/*N*/ SwTxtFmtColl* pColl = GetTxtColl();
+/*N*/
+/*N*/ SwTxtNode *pNode = new SwTxtNode( rPos, pColl, pNewAttrSet );
+/*N*/
+/*N*/ if( pNewAttrSet )
+/*N*/ delete pNewAttrSet;
+/*N*/
+/*N*/ const SwNumRule* pRule = GetNumRule();
+/*N*/ if( pRule && rNds.IsDocNodes() )
+/*N*/ {
+/*N*/ // ist am Node eine Nummerierung gesetzt und wird dieser vor dem
+/*N*/ // alten eingefuegt, so kopiere die Nummer
+/*N*/ if( !bNext && pNdNum && NO_NUMBERING != pNdNum->GetLevel() )
+/*N*/ {
+/*N*/ if( pNode->pNdNum )
+/*N*/ *pNode->pNdNum = *pNdNum;
+/*N*/ else
+/*N*/ pNode->pNdNum = new SwNodeNum( *pNdNum );
+/*N*/
+/*N*/ // SetValue immer auf default zurueck setzem
+/*N*/ pNdNum->SetSetValue( USHRT_MAX );
+/*N*/ if( pNdNum->IsStart() )
+/*N*/ {
+/*N*/ pNdNum->SetStart( FALSE );
+/*N*/ pNode->pNdNum->SetStart( TRUE );
+/*N*/ }
+/*N*/
+/*N*/ // Ein SplitNode erzeugt !!immer!! einen neuen Level, NO_NUM
+/*N*/ // kann nur ueber eine entsprechende Methode erzeugt werden !!
+/*N*/ if( NO_NUMLEVEL & pNdNum->GetLevel() )
+/*N*/ {
+/*N*/ pNdNum->SetLevel( pNdNum->GetLevel() & ~NO_NUMLEVEL );
+/*N*/ #ifndef NUM_RELSPACE
+/*N*/ SetNumLSpace( TRUE );
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ rNds.GetDoc()->UpdateNumRule( pRule->GetName(), pNode->GetIndex() );
+/*N*/ }
+/*N*/
+/*N*/ // jetzt kann es sein, das durch die Nummerierung dem neuen Node eine
+/*N*/ // Vorlage aus dem Pool zugewiesen wurde. Dann darf diese nicht
+/*N*/ // nochmal uebergeplaettet werden !!
+/*N*/ if( pColl != pNode->GetTxtColl() ||
+/*N*/ ( bChgFollow && pColl != GetTxtColl() ))
+/*N*/ return pNode; // mehr duerfte nicht gemacht werden oder ????
+/*N*/
+/*N*/ pNode->_ChgTxtCollUpdateNum( 0, pColl ); // fuer Nummerierung/Gliederung
+/*N*/ if( bNext || !bChgFollow )
+/*N*/ return pNode;
+/*N*/
+/*N*/ SwTxtFmtColl *pNextColl = &pColl->GetNextTxtFmtColl();
+/*N*/ ChgFmtColl( pNextColl );
+/*N*/
+/*N*/ return pNode;
+/*N*/ }
+
+/*N*/ SwCntntNode* SwTxtNode::AppendNode( const SwPosition & rPos )
+/*N*/ {
+/*N*/ // Position hinter dem eingefuegt wird
+/*N*/ SwNodeIndex aIdx( rPos.nNode, 1 );
+/*N*/ SwTxtNode* pNew = _MakeNewTxtNode( aIdx, TRUE );
+/*N*/ if( GetDepends() )
+/*N*/ MakeFrms( *pNew );
+/*N*/ return pNew;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtNode::GetTxtAttr
+ *
+ * Diese Methode liefert nur Textattribute auf der Position nIdx
+ * zurueck, die kein EndIdx besitzen und denselben Which besitzen.
+ * Ueblicherweise steht an dieser Position ein CH_TXTATR.
+ * Bei RES_TXTATR_END entfaellt die Pruefung auf den Which-Wert.
+ *************************************************************************/
+
+/*N*/ SwTxtAttr *SwTxtNode::GetTxtAttr( const xub_StrLen nIdx,
+/*N*/ const USHORT nWhichHt ) const
+/*N*/ {
+/*N*/ if( pSwpHints )
+/*N*/ {
+/*N*/ for( USHORT i = 0; i < pSwpHints->Count(); ++i )
+/*N*/ {
+/*N*/ SwTxtAttr *pPos = pSwpHints->GetHt(i);
+/*N*/ const xub_StrLen nStart = *pPos->GetStart();
+/*N*/ if( nIdx < nStart )
+/*N*/ return 0;
+/*N*/ if( nIdx == nStart && !pPos->GetEnd() )
+/*N*/ {
+/*N*/ if( RES_TXTATR_END == nWhichHt || nWhichHt == pPos->Which() )
+/*N*/ return pPos;
+/*N*/ else
+/*N*/ return 0;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ return 0;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtNode::GetExpandTxt
+ *************************************************************************/
+// Felder werden expandiert:
+
+/*N*/ XubString SwTxtNode::GetNumString() const
+/*N*/ {
+/*N*/ const SwNodeNum* pNum;
+/*N*/ const SwNumRule* pRule;
+/*N*/ if( (( 0 != ( pNum = GetNum() ) &&
+/*N*/ 0 != ( pRule = GetNumRule() )) ||
+/*N*/ ( 0 != ( pNum = GetOutlineNum() ) &&
+/*N*/ 0 != ( pRule = GetDoc()->GetOutlineNumRule() ) ) ) &&
+/*N*/ pNum->GetLevel() < MAXLEVEL &&
+/*N*/ pRule->Get( pNum->GetLevel() ).IsTxtFmt() )
+/*?*/ return pRule->MakeNumString( *pNum );
+/*N*/ return aEmptyStr;
+/*N*/ }
+
+/*N*/ long SwTxtNode::GetLeftMarginWithNum( BOOL bTxtLeft ) const
+/*N*/ {
+/*N*/ long nOffset;
+/*N*/ const SwNodeNum* pNum;
+/*N*/ const SwNumRule* pRule;
+/*N*/ if( (( 0 != ( pNum = GetNum() ) &&
+/*N*/ 0 != ( pRule = GetNumRule() )) ||
+/*N*/ ( 0 != ( pNum = GetOutlineNum() ) &&
+/*N*/ 0 != ( pRule = GetDoc()->GetOutlineNumRule() ) ) ) &&
+/*N*/ pNum->GetLevel() < NO_NUM )
+/*N*/ {
+/*N*/ const SwNumFmt& rFmt = pRule->Get( GetRealLevel( pNum->GetLevel() ) );
+/*N*/ nOffset = rFmt.GetAbsLSpace();
+/*N*/
+/*N*/ if( !bTxtLeft )
+/*N*/ {
+/*N*/ if( 0 > rFmt.GetFirstLineOffset() &&
+/*N*/ nOffset > -rFmt.GetFirstLineOffset() )
+/*N*/ nOffset += rFmt.GetFirstLineOffset();
+/*N*/ else
+/*N*/ nOffset = 0;
+/*N*/ }
+/*N*/
+/*N*/ if( pRule->IsAbsSpaces() )
+/*N*/ nOffset -= GetSwAttrSet().GetLRSpace().GetLeft();
+/*N*/ }
+/*N*/ else
+/*N*/ nOffset = 0;
+/*N*/ return nOffset;
+/*N*/ }
+
+/*N*/ BOOL SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const
+/*N*/ {
+/*N*/ const SwNodeNum* pNum;
+/*N*/ const SwNumRule* pRule;
+/*N*/ if( (( 0 != ( pNum = GetNum() ) &&
+/*N*/ 0 != ( pRule = GetNumRule() )) ||
+/*N*/ ( 0 != ( pNum = GetOutlineNum() ) &&
+/*N*/ 0 != ( pRule = GetDoc()->GetOutlineNumRule() ) ) ) &&
+/*N*/ pNum->GetLevel() < NO_NUM )
+/*N*/ {
+/*N*/ if( NO_NUMLEVEL & pNum->GetLevel() )
+/*N*/ rFLOffset = 0;
+/*N*/ else
+/*N*/ rFLOffset = pRule->Get( pNum->GetLevel() ).GetFirstLineOffset();
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ rFLOffset = GetSwAttrSet().GetLRSpace().GetTxtFirstLineOfst();
+/*N*/ return FALSE;
+/*N*/ }
+
+/*N*/ void SwTxtNode::Replace0xFF( XubString& rTxt, xub_StrLen& rTxtStt,
+/*N*/ xub_StrLen nEndPos, BOOL bExpandFlds ) const
+/*N*/ {
+/*N*/ if( GetpSwpHints() )
+/*N*/ {
+/*N*/ sal_Unicode cSrchChr = CH_TXTATR_BREAKWORD;
+/*N*/ for( int nSrchIter = 0; 2 > nSrchIter; ++nSrchIter,
+/*N*/ cSrchChr = CH_TXTATR_INWORD )
+/*N*/ {
+/*N*/ xub_StrLen nPos = rTxt.Search( cSrchChr );
+/*N*/ while( STRING_NOTFOUND != nPos && nPos < nEndPos )
+/*N*/ {
+/*N*/ const SwTxtAttr* pAttr = GetTxtAttr( rTxtStt + nPos );
+/*N*/ if( pAttr )
+/*N*/ {
+/*N*/ switch( pAttr->Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_FIELD:
+/*N*/ rTxt.Erase( nPos, 1 );
+/*N*/ if( bExpandFlds )
+/*N*/ {
+/*N*/ const XubString aExpand( ((SwTxtFld*)pAttr)->GetFld().
+/*N*/ GetFld()->Expand() );
+/*N*/ rTxt.Insert( aExpand, nPos );
+/*N*/ nPos += aExpand.Len();
+/*N*/ nEndPos += aExpand.Len();
+/*N*/ rTxtStt -= aExpand.Len();
+/*N*/ }
+/*N*/ ++rTxtStt;
+/*N*/ break;
+/*N*/ case RES_TXTATR_HARDBLANK:
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ rTxt.SetChar( nPos, ((SwTxtHardBlank*)pAttr)->GetChar() );
+/*?*/ break;
+/*N*/ case RES_TXTATR_FTN:
+/*N*/ rTxt.Erase( nPos, 1 );
+/*N*/ if( bExpandFlds )
+/*N*/ {
+/*N*/ const SwFmtFtn& rFtn = pAttr->GetFtn();
+/*N*/ XubString sExpand;
+/*N*/ if( rFtn.GetNumStr().Len() )
+/*N*/ sExpand = rFtn.GetNumStr();
+/*N*/ else if( rFtn.IsEndNote() )
+/*?*/ sExpand = GetDoc()->GetEndNoteInfo().aFmt.
+/*?*/ GetNumStr( rFtn.GetNumber() );
+/*N*/ else
+/*N*/ sExpand = GetDoc()->GetFtnInfo().aFmt.
+/*N*/ GetNumStr( rFtn.GetNumber() );
+/*N*/ rTxt.Insert( sExpand, nPos );
+/*N*/ nPos += sExpand.Len();
+/*N*/ nEndPos += sExpand.Len();
+/*N*/ rTxtStt -= sExpand.Len();
+/*N*/ }
+/*N*/ ++rTxtStt;
+/*N*/ break;
+/*N*/ default:
+/*N*/ rTxt.Erase( nPos, 1 );
+/*N*/ ++rTxtStt;
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ ++nPos, ++nEndPos;
+/*N*/ nPos = rTxt.Search( cSrchChr, nPos );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*N*/ XubString SwTxtNode::GetExpandTxt( const xub_StrLen nIdx, const xub_StrLen nLen,
+/*N*/ const BOOL bWithNum ) const
+/*N*/ {
+/*N*/ XubString aTxt( GetTxt().Copy( nIdx, nLen ) );
+/*N*/ xub_StrLen nTxtStt = nIdx;
+/*N*/ Replace0xFF( aTxt, nTxtStt, aTxt.Len(), TRUE );
+/*N*/
+/*N*/ if( bWithNum )
+/*?*/ aTxt.Insert( GetNumString(), 0 );
+/*N*/
+/*N*/ return aTxt;
+/*N*/ }
+
+
+
+
+/*************************************************************************
+ * SwTxtNode::GetExpandTxt
+ *************************************************************************/
+// Felder werden expandiert:
+
+/*N*/ void SwTxtNode::Replace( const SwIndex& rStart, xub_Unicode cCh )
+/*N*/ {
+/*N*/
+/*N*/ ASSERT( rStart.GetIndex() < aText.Len(), "ausserhalb des Strings" );
+/*N*/ SwTxtAttr* pHt;
+/*N*/ if( ( CH_TXTATR_BREAKWORD == aText.GetChar( rStart.GetIndex() ) ||
+/*N*/ CH_TXTATR_INWORD == aText.GetChar( rStart.GetIndex() )) &&
+/*N*/ 0 != ( pHt = GetTxtAttr( rStart.GetIndex() ) ))
+/*N*/ {
+/*?*/ Delete( pHt );
+/*?*/ aText.Insert( cCh, rStart.GetIndex() );
+/*N*/ }
+/*N*/ else
+/*N*/ aText.SetChar( rStart.GetIndex(), cCh );
+/*N*/
+/*N*/ SwDelTxt aDelHint( rStart.GetIndex(), 1 );
+/*N*/ SwModify::Modify( 0, &aDelHint );
+/*N*/
+/*N*/ SwInsTxt aHint( rStart.GetIndex(), 1 );
+/*N*/ SwModify::Modify( 0, &aHint );
+/*N*/ }
+
+
+
+/*N*/ void SwTxtNode::Modify( SfxPoolItem* pOldValue, SfxPoolItem* pNewValue )
+/*N*/ {
+/*N*/ // Bug 24616/24617:
+/*N*/ // Modify ueberladen, damit beim Loeschen von Vorlagen diese
+/*N*/ // wieder richtig verwaltet werden (Outline-Numerierung!!)
+/*N*/ // Bug25481:
+/*N*/ // bei Nodes im Undo nie _ChgTxtCollUpdateNum rufen.
+/*N*/ if( pOldValue && pNewValue && RES_FMT_CHG == pOldValue->Which() &&
+/*N*/ pRegisteredIn == ((SwFmtChg*)pNewValue)->pChangedFmt &&
+/*N*/ GetNodes().IsDocNodes() )
+/*N*/ _ChgTxtCollUpdateNum(
+/*N*/ (SwTxtFmtColl*)((SwFmtChg*)pOldValue)->pChangedFmt,
+/*N*/ (SwTxtFmtColl*)((SwFmtChg*)pNewValue)->pChangedFmt );
+/*N*/
+/*N*/ SwCntntNode::Modify( pOldValue, pNewValue );
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_swfntcch.cxx b/binfilter/bf_sw/source/core/txtnode/sw_swfntcch.cxx
new file mode 100644
index 000000000000..2a6a214e5c04
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_swfntcch.cxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <viewsh.hxx>
+#include "swfntcch.hxx"
+#include "fmtcol.hxx"
+namespace binfilter {
+
+// aus atrstck.cxx
+extern const BYTE StackPos[];
+
+// globale Variablen, werden in SwFntCch.Hxx bekanntgegeben
+// Der FontCache wird in TxtInit.Cxx _TXTINIT erzeugt und in _TXTEXIT geloescht
+SwFontCache *pSwFontCache = NULL;
+
+/*************************************************************************
+|*
+|* SwFontObj::SwFontObj(), ~SwFontObj()
+|*
+|* Ersterstellung AMA 25. Jun. 95
+|* Letzte Aenderung AMA 25. Jun. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwFontObj::SwFontObj( const void *pOwner, ViewShell *pSh ) :
+/*N*/ SwCacheObj( (void*)pOwner ),
+/*N*/ aSwFont( &((SwTxtFmtColl *)pOwner)->GetAttrSet(), pSh ? pSh->GetDoc() : 0 )
+/*N*/ {
+/*N*/ aSwFont.GoMagic( pSh, aSwFont.GetActual() );
+/*N*/ const SwAttrSet& rAttrSet = ((SwTxtFmtColl *)pOwner)->GetAttrSet();
+/*N*/ for (USHORT i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; i++)
+/*N*/ pDefaultArray[ StackPos[ i ] ] = &rAttrSet.Get( i, TRUE );
+/*N*/ }
+
+/*N*/ SwFontObj::~SwFontObj()
+/*N*/ {
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwFontAccess::SwFontAccess()
+|*
+|* Ersterstellung AMA 25. Jun. 95
+|* Letzte Aenderung AMA 25. Jun. 95
+|*
+|*************************************************************************/
+
+/*N*/ SwFontAccess::SwFontAccess( const void *pOwner, ViewShell *pSh ) :
+/*N*/ SwCacheAccess( *pSwFontCache, pOwner,
+/*N*/ (BOOL) ((SwTxtFmtColl*)pOwner)->IsInSwFntCache() ),
+/*N*/ pShell( pSh )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwFontObj *SwFontAccess::Get( )
+/*N*/ {
+/*N*/ return (SwFontObj *) SwCacheAccess::Get( );
+/*N*/ }
+
+/*N*/ SwCacheObj *SwFontAccess::NewObj( )
+/*N*/ {
+/*N*/ ((SwTxtFmtColl*)pOwner)->SetInSwFntCache( TRUE );
+/*N*/ return new SwFontObj( pOwner, pShell );
+/*N*/ }
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_swfont.cxx b/binfilter/bf_sw/source/core/txtnode/sw_swfont.cxx
new file mode 100644
index 000000000000..04df7333e3a6
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_swfont.cxx
@@ -0,0 +1,856 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <com/sun/star/i18n/ScriptType.hdl>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/wrlmitem.hxx>
+#include <bf_svx/blnkitem.hxx>
+#include <bf_svx/nhypitem.hxx>
+#include <bf_svx/kernitem.hxx>
+#include <bf_svx/cmapitem.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/escpitem.hxx>
+#include <bf_svx/akrnitem.hxx>
+#include <bf_svx/shdditem.hxx>
+#include <bf_svx/charreliefitem.hxx>
+#include <bf_svx/cntritem.hxx>
+#include <bf_svx/cscoitem.hxx>
+#include <bf_svx/crsditem.hxx>
+#include <bf_svx/udlnitem.hxx>
+#include <bf_svx/wghtitem.hxx>
+#include <bf_svx/postitem.hxx>
+#include <bf_svx/fhgtitem.hxx>
+#include <bf_svx/fontitem.hxx>
+#include <bf_svx/emphitem.hxx>
+#include <bf_svx/charscaleitem.hxx>
+#include <bf_svx/charrotateitem.hxx>
+#include <bf_svx/twolinesitem.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <vcl/window.hxx>
+
+#include <charatr.hxx>
+#include <viewsh.hxx> // Bildschirmabgleich
+#include <swfont.hxx>
+#include <fntcache.hxx> // FontCache
+namespace binfilter {
+
+#if defined(WIN) || defined(WNT) || defined(PM2)
+#define FNT_LEADING_HACK
+#endif
+
+#if defined(WIN) || defined(WNT)
+#define FNT_ATM_HACK
+#endif
+
+#ifdef DBG_UTIL
+// globale Variable
+SvStatistics aSvStat;
+#endif
+
+using namespace ::com::sun::star::i18n::ScriptType;
+
+/************************************************************************
+ * Hintergrundbrush setzen, z.B. bei Zeichenvorlagen
+ ***********************************************************************/
+
+/*N*/ void SwFont::SetBackColor( Color* pNewColor )
+/*N*/ {
+/*N*/ delete pBackColor;
+/*N*/ pBackColor = pNewColor;
+/*N*/ bFntChg = TRUE;
+/*N*/ aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
+/*N*/ }
+
+/************************************************************************
+ * Hintergrundbrush setzen,
+ * die alte Brush wird _nicht_ destruiert, sondern ist der Rueckgabewert.
+ ***********************************************************************/
+
+
+
+// maps directions for vertical layout
+/*N*/ USHORT MapDirection( USHORT nDir, const BOOL bVertFormat )
+/*N*/ {
+/*N*/ if ( bVertFormat )
+/*N*/ {
+/*N*/ switch ( nDir )
+/*N*/ {
+/*N*/ case 0 :
+/*N*/ nDir = 2700;
+/*N*/ break;
+/*N*/ case 900 :
+/*N*/ nDir = 0;
+/*N*/ break;
+/*N*/ case 2700 :
+/*N*/ nDir = 1800;
+/*N*/ break;
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ default :
+/*N*/ ASSERT( sal_False, "Unsupported direction" );
+/*N*/ break;
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ return nDir;
+/*N*/ }
+
+// maps the absolute direction set at the font to its logical conterpart
+// in the rotated environment
+/*N*/ USHORT UnMapDirection( USHORT nDir, const BOOL bVertFormat )
+/*N*/ {
+/*N*/ if ( bVertFormat )
+/*N*/ {
+/*?*/ switch ( nDir )
+/*?*/ {
+/*?*/ case 0 :
+/*?*/ nDir = 900;
+/*?*/ break;
+/*?*/ case 1800 :
+/*?*/ nDir = 2700;
+/*?*/ break;
+/*?*/ case 2700 :
+/*?*/ nDir = 0;
+/*?*/ break;
+/*?*/ #if OSL_DEBUG_LEVEL > 1
+/*?*/ default :
+/*?*/ ASSERT( sal_False, "Unsupported direction" );
+/*?*/ break;
+/*?*/ #endif
+/*?*/ }
+/*N*/ }
+/*N*/ return nDir;
+/*N*/ }
+
+/*N*/ USHORT SwFont::GetOrientation( const BOOL bVertFormat ) const
+/*N*/ {
+/*N*/ return UnMapDirection( aSub[nActual].GetOrientation(), bVertFormat );
+/*N*/ }
+
+/*N*/ void SwFont::SetVertical( USHORT nDir, const BOOL bVertFormat )
+/*N*/ {
+/*N*/ // map direction if frame has vertical layout
+/*N*/ nDir = MapDirection( nDir, bVertFormat );
+/*N*/
+/*N*/ if( nDir != aSub[0].GetOrientation() )
+/*N*/ {
+/*N*/ bFntChg = TRUE;
+/*N*/ aSub[0].SetVertical( nDir, bVertFormat );
+/*N*/ aSub[1].SetVertical( nDir, bVertFormat || nDir > 1000 );
+/*N*/ aSub[2].SetVertical( nDir, bVertFormat );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ Escapement:
+ frEsc: Fraction, Grad des Escapements
+ Esc = resultierendes Escapement
+ A1 = Original-Ascent (nOrgAscent)
+ A2 = verkleinerter Ascent (nEscAscent)
+ Ax = resultierender Ascent (GetAscent())
+ H1 = Original-Hoehe (nOrgHeight)
+ H2 = verkleinerter Hoehe (nEscHeight)
+ Hx = resultierender Hoehe (GetHeight())
+ Bx = resultierende Baseline fuer die Textausgabe (CalcPos())
+ (Vorsicht: Y - A1!)
+
+ Escapement:
+ Esc = H1 * frEsc;
+
+ Hochstellung:
+ Ax = A2 + Esc;
+ Hx = H2 + Esc;
+ Bx = A1 - Esc;
+
+ Tiefstellung:
+ Ax = A1;
+ Hx = A1 + Esc + (H2 - A2);
+ Bx = A1 + Esc;
+
+*************************************************************************/
+
+/*************************************************************************
+ * SwSubFont::CalcEscAscent( const USHORT nOldAscent )
+ *************************************************************************/
+
+// nEsc ist der Prozentwert
+/*N*/ USHORT SwSubFont::CalcEscAscent( const USHORT nOldAscent ) const
+/*N*/ {
+/*N*/ if( DFLT_ESC_AUTO_SUPER != GetEscapement() &&
+/*N*/ DFLT_ESC_AUTO_SUB != GetEscapement() )
+/*N*/ {
+/*N*/ const long nAscent = nOldAscent +
+/*N*/ ( (long) nOrgHeight * GetEscapement() ) / 100L;
+/*N*/ if ( nAscent>0 )
+/*N*/ return ( Max( USHORT (nAscent), nOrgAscent ));
+/*N*/ }
+/*N*/ return nOrgAscent;
+/*N*/ }
+
+/*************************************************************************
+ * SwFont::SetDiffFnt()
+ *************************************************************************/
+
+/*N*/ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, const SwDoc *pDoc )
+/*N*/ {
+/*N*/ delete pBackColor;
+/*N*/ pBackColor = NULL;
+/*N*/
+/*N*/
+/*N*/ if( pAttrSet )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_FONT,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*N*/ const SvxFontItem *pFont = (const SvxFontItem *)pItem;
+/*N*/ aSub[SW_LATIN].SetFamily( pFont->GetFamily() );
+/*N*/ aSub[SW_LATIN].Font::SetName( pFont->GetFamilyName() );
+/*N*/ aSub[SW_LATIN].Font::SetStyleName( pFont->GetStyleName() );
+/*N*/ aSub[SW_LATIN].Font::SetPitch( pFont->GetPitch() );
+/*N*/ aSub[SW_LATIN].Font::SetCharSet( pFont->GetCharSet() );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_FONTSIZE,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*N*/ const SvxFontHeightItem *pHeight = (const SvxFontHeightItem *)pItem;
+/*N*/ aSub[SW_LATIN].SvxFont::SetPropr( 100 );
+/*N*/ aSub[SW_LATIN].aSize = aSub[SW_LATIN].Font::GetSize();
+/*N*/ Size aTmpSize = aSub[SW_LATIN].aSize;
+/*N*/ aTmpSize.Height() = pHeight->GetHeight();
+/*N*/ aSub[SW_LATIN].SetSize( aTmpSize );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_POSTURE,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_LATIN].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_WEIGHT,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_LATIN].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_LANGUAGE,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_LATIN].SetLanguage( ((SvxLanguageItem*)pItem)->GetLanguage() );
+/*N*/
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONT,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*?*/ const SvxFontItem *pFont = (const SvxFontItem *)pItem;
+/*?*/ aSub[SW_CJK].SetFamily( pFont->GetFamily() );
+/*?*/ aSub[SW_CJK].Font::SetName( pFont->GetFamilyName() );
+/*?*/ aSub[SW_CJK].Font::SetStyleName( pFont->GetStyleName() );
+/*?*/ aSub[SW_CJK].Font::SetPitch( pFont->GetPitch() );
+/*?*/ aSub[SW_CJK].Font::SetCharSet( pFont->GetCharSet() );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONTSIZE,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*?*/ const SvxFontHeightItem *pHeight = (const SvxFontHeightItem *)pItem;
+/*?*/ aSub[SW_CJK].SvxFont::SetPropr( 100 );
+/*?*/ aSub[SW_CJK].aSize = aSub[SW_CJK].Font::GetSize();
+/*?*/ Size aTmpSize = aSub[SW_CJK].aSize;
+/*?*/ aTmpSize.Height() = pHeight->GetHeight();
+/*?*/ aSub[SW_CJK].SetSize( aTmpSize );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_POSTURE,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_CJK].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_WEIGHT,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_CJK].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CJK_LANGUAGE,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*?*/ LanguageType eNewLang = ((SvxLanguageItem*)pItem)->GetLanguage();
+/*?*/ aSub[SW_CJK].SetLanguage( eNewLang );
+/*?*/ aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
+/*?*/ aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
+/*?*/ aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
+/*N*/ }
+/*N*/
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONT,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*?*/ const SvxFontItem *pFont = (const SvxFontItem *)pItem;
+/*?*/ aSub[SW_CTL].SetFamily( pFont->GetFamily() );
+/*?*/ aSub[SW_CTL].Font::SetName( pFont->GetFamilyName() );
+/*?*/ aSub[SW_CTL].Font::SetStyleName( pFont->GetStyleName() );
+/*?*/ aSub[SW_CTL].Font::SetPitch( pFont->GetPitch() );
+/*?*/ aSub[SW_CTL].Font::SetCharSet( pFont->GetCharSet() );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONTSIZE,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*?*/ const SvxFontHeightItem *pHeight = (const SvxFontHeightItem *)pItem;
+/*?*/ aSub[SW_CTL].SvxFont::SetPropr( 100 );
+/*?*/ aSub[SW_CTL].aSize = aSub[SW_CTL].Font::GetSize();
+/*?*/ Size aTmpSize = aSub[SW_CTL].aSize;
+/*?*/ aTmpSize.Height() = pHeight->GetHeight();
+/*?*/ aSub[SW_CTL].SetSize( aTmpSize );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_POSTURE,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_CTL].Font::SetItalic( ((SvxPostureItem*)pItem)->GetPosture() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_WEIGHT,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_CTL].Font::SetWeight( ((SvxWeightItem*)pItem)->GetWeight() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CTL_LANGUAGE,
+/*N*/ TRUE, &pItem ))
+/*?*/ aSub[SW_CTL].SetLanguage( ((SvxLanguageItem*)pItem)->GetLanguage() );
+/*N*/
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_UNDERLINE,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*N*/ SetUnderline( ((SvxUnderlineItem*)pItem)->GetUnderline() );
+/*N*/ SetUnderColor( ((SvxUnderlineItem*)pItem)->GetColor() );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CROSSEDOUT,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetStrikeout( ((SvxCrossedOutItem*)pItem)->GetStrikeout() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_COLOR,
+/*N*/ TRUE, &pItem ))
+/*N*/ SetColor( ((SvxColorItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_EMPHASIS_MARK,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetEmphasisMark( ((SvxEmphasisMarkItem*)pItem)->GetEmphasisMark() );
+/*N*/
+/*N*/ SetTransparent( TRUE );
+/*N*/ SetAlign( ALIGN_BASELINE );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CONTOUR,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetOutline( ((SvxContourItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetShadow( ((SvxShadowedItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_RELIEF,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetRelief( (FontRelief)((SvxCharReliefItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_SHADOWED,
+/*N*/ TRUE, &pItem ))
+/*N*/ SetPropWidth(((SvxShadowedItem*)pItem)->GetValue() ? 50 : 100 );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_AUTOKERN,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*?*/ if( ((SvxAutoKernItem*)pItem)->GetValue() )
+/*?*/ SetAutoKern( ( !pDoc || !pDoc->IsKernAsianPunctuation() ) ?
+/*?*/ KERNING_FONTSPECIFIC : KERNING_ASIAN );
+/*?*/ else
+/*?*/ SetAutoKern( 0 );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_WORDLINEMODE,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetWordLineMode( ((SvxWordLineModeItem*)pItem)->GetValue() );
+/*N*/
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_ESCAPEMENT,
+/*N*/ TRUE, &pItem ))
+/*N*/ {
+/*N*/ const SvxEscapementItem *pEsc = (const SvxEscapementItem *)pItem;
+/*N*/ SetEscapement( pEsc->GetEsc() );
+/*N*/ if( aSub[SW_LATIN].IsEsc() )
+/*N*/ SetProportion( pEsc->GetProp() );
+/*N*/ }
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_CASEMAP,
+/*N*/ TRUE, &pItem ))
+/*N*/ SetCaseMap( ((SvxCaseMapItem*)pItem)->GetCaseMap() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_KERNING,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetFixKerning( ((SvxKerningItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_NOHYPHEN,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetNoHyph( ((SvxNoHyphenItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BLINK,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetBlink( ((SvxBlinkItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_ROTATE,
+/*N*/ TRUE, &pItem ))
+/*?*/ SetVertical( ((SvxCharRotateItem*)pItem)->GetValue() );
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND,
+/*N*/ TRUE, &pItem ))
+/*N*/ pBackColor = new Color( ((SvxBrushItem*)pItem)->GetColor() );
+/*N*/ else
+/*N*/ pBackColor = NULL;
+/*N*/ const SfxPoolItem* pTwoLinesItem = 0;
+/*N*/ if( SFX_ITEM_SET ==
+/*N*/ pAttrSet->GetItemState( RES_CHRATR_TWO_LINES, TRUE, &pTwoLinesItem ))
+/*?*/ if ( ((SvxTwoLinesItem*)pTwoLinesItem)->GetValue() )
+/*?*/ SetVertical( 0 );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*?*/ Invalidate();
+/*?*/ bNoHyph = FALSE;
+/*?*/ bBlink = FALSE;
+/*N*/ }
+/*N*/ bPaintBlank = FALSE;
+/*N*/ bPaintWrong = FALSE;
+/*N*/ ASSERT( aSub[SW_LATIN].IsTransparent(), "SwFont: Transparent revolution" );
+/*N*/ }
+
+/*************************************************************************
+ * class SwFont
+ *************************************************************************/
+
+/*N*/ SwFont::SwFont( const SwFont &rFont )
+/*N*/ {
+/*N*/ aSub[SW_LATIN] = rFont.aSub[SW_LATIN];
+/*N*/ aSub[SW_CJK] = rFont.aSub[SW_CJK];
+/*N*/ aSub[SW_CTL] = rFont.aSub[SW_CTL];
+/*N*/ nActual = rFont.nActual;
+/*N*/ pBackColor = rFont.pBackColor ? new Color( *rFont.pBackColor ) : NULL;
+/*N*/ aUnderColor = rFont.GetUnderColor();
+/*N*/ nToxCnt = nRefCnt = 0;
+/*N*/ bFntChg = rFont.bFntChg;
+/*N*/ bOrgChg = rFont.bOrgChg;
+/*N*/ bPaintBlank = rFont.bPaintBlank;
+/*N*/ bPaintWrong = FALSE;
+/*N*/ bURL = rFont.bURL;
+/*N*/ bGreyWave = rFont.bGreyWave;
+/*N*/ bNoColReplace = rFont.bNoColReplace;
+/*N*/ bNoHyph = rFont.bNoHyph;
+/*N*/ bBlink = rFont.bBlink;
+/*N*/ }
+
+/*N*/ SwFont::SwFont( const SwAttrSet* pAttrSet, const SwDoc *pDoc )
+/*N*/ {
+/*N*/ nActual = SW_LATIN;
+/*N*/ nToxCnt = nRefCnt = 0;
+/*N*/ bPaintBlank = FALSE;
+/*N*/ bPaintWrong = FALSE;
+/*N*/ bURL = FALSE;
+/*N*/ bGreyWave = FALSE;
+/*N*/ bNoColReplace = FALSE;
+/*N*/ bNoHyph = pAttrSet->GetNoHyphenHere().GetValue();
+/*N*/ bBlink = pAttrSet->GetBlink().GetValue();
+/*N*/ {
+/*N*/ const SvxFontItem& rFont = pAttrSet->GetFont();
+/*N*/ aSub[SW_LATIN].SetFamily( rFont.GetFamily() );
+/*N*/ aSub[SW_LATIN].SetName( rFont.GetFamilyName() );
+/*N*/ aSub[SW_LATIN].SetStyleName( rFont.GetStyleName() );
+/*N*/ aSub[SW_LATIN].SetPitch( rFont.GetPitch() );
+/*N*/ aSub[SW_LATIN].SetCharSet( rFont.GetCharSet() );
+/*N*/ aSub[SW_LATIN].SvxFont::SetPropr( 100 ); // 100% der FontSize
+/*N*/ Size aTmpSize = aSub[SW_LATIN].aSize;
+/*N*/ aTmpSize.Height() = pAttrSet->GetSize().GetHeight();
+/*N*/ aSub[SW_LATIN].SetSize( aTmpSize );
+/*N*/ aSub[SW_LATIN].SetItalic( pAttrSet->GetPosture().GetPosture() );
+/*N*/ aSub[SW_LATIN].SetWeight( pAttrSet->GetWeight().GetWeight() );
+/*N*/ aSub[SW_LATIN].SetLanguage( pAttrSet->GetLanguage().GetLanguage() );
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ const SvxFontItem& rFont = pAttrSet->GetCJKFont();
+/*N*/ aSub[SW_CJK].SetFamily( rFont.GetFamily() );
+/*N*/ aSub[SW_CJK].SetName( rFont.GetFamilyName() );
+/*N*/ aSub[SW_CJK].SetStyleName( rFont.GetStyleName() );
+/*N*/ aSub[SW_CJK].SetPitch( rFont.GetPitch() );
+/*N*/ aSub[SW_CJK].SetCharSet( rFont.GetCharSet() );
+/*N*/ aSub[SW_CJK].SvxFont::SetPropr( 100 ); // 100% der FontSize
+/*N*/ Size aTmpSize = aSub[SW_CJK].aSize;
+/*N*/ aTmpSize.Height() = pAttrSet->GetCJKSize().GetHeight();
+/*N*/ aSub[SW_CJK].SetSize( aTmpSize );
+/*N*/ aSub[SW_CJK].SetItalic( pAttrSet->GetCJKPosture().GetPosture() );
+/*N*/ aSub[SW_CJK].SetWeight( pAttrSet->GetCJKWeight().GetWeight() );
+/*N*/ LanguageType eNewLang = pAttrSet->GetCJKLanguage().GetLanguage();
+/*N*/ aSub[SW_CJK].SetLanguage( eNewLang );
+/*N*/ aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
+/*N*/ aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
+/*N*/ aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
+/*N*/ }
+/*N*/
+/*N*/ {
+/*N*/ const SvxFontItem& rFont = pAttrSet->GetCTLFont();
+/*N*/ aSub[SW_CTL].SetFamily( rFont.GetFamily() );
+/*N*/ aSub[SW_CTL].SetName( rFont.GetFamilyName() );
+/*N*/ aSub[SW_CTL].SetStyleName( rFont.GetStyleName() );
+/*N*/ aSub[SW_CTL].SetPitch( rFont.GetPitch() );
+/*N*/ aSub[SW_CTL].SetCharSet( rFont.GetCharSet() );
+/*N*/ aSub[SW_CTL].SvxFont::SetPropr( 100 ); // 100% der FontSize
+/*N*/ Size aTmpSize = aSub[SW_CTL].aSize;
+/*N*/ aTmpSize.Height() = pAttrSet->GetCTLSize().GetHeight();
+/*N*/ aSub[SW_CTL].SetSize( aTmpSize );
+/*N*/ aSub[SW_CTL].SetItalic( pAttrSet->GetCTLPosture().GetPosture() );
+/*N*/ aSub[SW_CTL].SetWeight( pAttrSet->GetCTLWeight().GetWeight() );
+/*N*/ aSub[SW_CTL].SetLanguage( pAttrSet->GetCTLLanguage().GetLanguage() );
+/*N*/ }
+/*N*/
+/*N*/ SetUnderline( pAttrSet->GetUnderline().GetUnderline() );
+/*N*/ SetUnderColor( pAttrSet->GetUnderline().GetColor() );
+/*N*/ SetEmphasisMark( pAttrSet->GetEmphasisMark().GetEmphasisMark() );
+/*N*/ SetStrikeout( pAttrSet->GetCrossedOut().GetStrikeout() );
+/*N*/ SetColor( pAttrSet->GetColor().GetValue() );
+/*N*/ SetTransparent( TRUE );
+/*N*/ SetAlign( ALIGN_BASELINE );
+/*N*/ SetOutline( pAttrSet->GetContour().GetValue() );
+/*N*/ SetShadow( pAttrSet->GetShadowed().GetValue() );
+/*M*/ SetPropWidth( pAttrSet->GetCharScaleW().GetValue() );
+/*N*/ SetRelief( (FontRelief)pAttrSet->GetCharRelief().GetValue() );
+/*N*/ if( pAttrSet->GetAutoKern().GetValue() )
+/*?*/ SetAutoKern( ( !pDoc || !pDoc->IsKernAsianPunctuation() ) ?
+/*?*/ KERNING_FONTSPECIFIC : KERNING_ASIAN );
+/*N*/ else
+/*N*/ SetAutoKern( 0 );
+/*N*/ SetWordLineMode( pAttrSet->GetWordLineMode().GetValue() );
+/*N*/ const SvxEscapementItem &rEsc = pAttrSet->GetEscapement();
+/*N*/ SetEscapement( rEsc.GetEsc() );
+/*N*/ if( aSub[SW_LATIN].IsEsc() )
+/*?*/ SetProportion( rEsc.GetProp() );
+/*N*/ SetCaseMap( pAttrSet->GetCaseMap().GetCaseMap() );
+/*N*/ SetFixKerning( pAttrSet->GetKerning().GetValue() );
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( SFX_ITEM_SET == pAttrSet->GetItemState( RES_CHRATR_BACKGROUND,
+/*N*/ TRUE, &pItem ))
+/*N*/ pBackColor = new Color( ((SvxBrushItem*)pItem)->GetColor() );
+/*N*/ else
+/*N*/ pBackColor = NULL;
+/*N*/ const SvxTwoLinesItem& rTwoLinesItem = pAttrSet->Get2Lines();
+/*N*/ if ( ! rTwoLinesItem.GetValue() )
+/*N*/ SetVertical( pAttrSet->GetCharRotate().GetValue() );
+/*N*/ else
+/*?*/ SetVertical( 0 );
+/*N*/ }
+
+/*N*/ SwSubFont& SwSubFont::operator=( const SwSubFont &rFont )
+/*N*/ {
+/*N*/ SvxFont::operator=( rFont );
+/*N*/ pMagic = rFont.pMagic;
+/*N*/ nFntIndex = rFont.nFntIndex;
+/*N*/ nOrgHeight = rFont.nOrgHeight;
+/*N*/ nOrgAscent = rFont.nOrgAscent;
+/*N*/ nPropWidth = rFont.nPropWidth;
+/*N*/ aSize = rFont.aSize;
+/*N*/ return *this;
+/*N*/ }
+
+/*N*/ SwFont& SwFont::operator=( const SwFont &rFont )
+/*N*/ {
+/*N*/ aSub[SW_LATIN] = rFont.aSub[SW_LATIN];
+/*N*/ aSub[SW_CJK] = rFont.aSub[SW_CJK];
+/*N*/ aSub[SW_CTL] = rFont.aSub[SW_CTL];
+/*N*/ nActual = rFont.nActual;
+/*N*/ delete pBackColor;
+/*N*/ pBackColor = rFont.pBackColor ? new Color( *rFont.pBackColor ) : NULL;
+/*N*/ aUnderColor = rFont.GetUnderColor();
+/*N*/ nToxCnt = nRefCnt = 0;
+/*N*/ bFntChg = rFont.bFntChg;
+/*N*/ bOrgChg = rFont.bOrgChg;
+/*N*/ bPaintBlank = rFont.bPaintBlank;
+/*N*/ bPaintWrong = FALSE;
+/*N*/ bURL = rFont.bURL;
+/*N*/ bGreyWave = rFont.bGreyWave;
+/*N*/ bNoColReplace = rFont.bNoColReplace;
+/*N*/ bNoHyph = rFont.bNoHyph;
+/*N*/ bBlink = rFont.bBlink;
+/*N*/ return *this;
+/*N*/ }
+
+/*************************************************************************
+ * SwFont::GoMagic()
+ *************************************************************************/
+
+/*N*/ void SwFont::GoMagic( ViewShell *pSh, BYTE nWhich )
+/*N*/ {
+/*N*/ SwFntAccess aFntAccess( aSub[nWhich].pMagic, aSub[nWhich].nFntIndex,
+/*N*/ &aSub[nWhich], pSh, TRUE );
+/*N*/ }
+
+/*************************************************************************
+ * SwSubFont::IsSymbol()
+ *************************************************************************/
+
+/*N*/ BOOL SwSubFont::IsSymbol( ViewShell *pSh )
+/*N*/ {
+/*N*/ SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh, FALSE );
+/*N*/ return aFntAccess.Get()->IsSymbol();
+/*N*/ }
+
+/*************************************************************************
+ * SwSubFont::ChgFnt()
+ *************************************************************************/
+
+/*N*/ BOOL SwSubFont::ChgFnt( ViewShell *pSh, OutputDevice *pOut )
+/*N*/ {
+/*N*/ if ( pLastFont )
+/*N*/ pLastFont->Unlock();
+/*N*/ SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh, TRUE );
+/*N*/ SV_STAT( nChangeFont );
+/*N*/
+/*N*/ pLastFont = aFntAccess.Get();
+/*N*/
+/*N*/ pLastFont->SetDevFont( pSh, pOut );
+/*N*/
+/*N*/ pLastFont->Lock();
+/*N*/ return UNDERLINE_NONE != GetUnderline() || STRIKEOUT_NONE != GetStrikeout();
+/*N*/ }
+
+/*************************************************************************
+ * SwFont::ChgPhysFnt()
+ *************************************************************************/
+
+/*N*/ void SwFont::ChgPhysFnt( ViewShell *pSh, OutputDevice *pOut )
+/*N*/ {
+/*N*/ ASSERT( pOut, "SwFont:;ChgPhysFnt, not OutDev." );
+/*N*/
+/*N*/ if( bOrgChg && aSub[nActual].IsEsc() )
+/*N*/ {
+/*N*/ const BYTE nOldProp = aSub[nActual].GetPropr();
+/*N*/ SetProportion( 100 );
+/*N*/ ChgFnt( pSh, pOut );
+/*N*/ SwFntAccess aFntAccess( aSub[nActual].pMagic, aSub[nActual].nFntIndex,
+/*N*/ &aSub[nActual], pSh );
+/*N*/ aSub[nActual].nOrgHeight = aFntAccess.Get()->GetHeight( pSh, pOut );
+/*N*/ aSub[nActual].nOrgAscent = aFntAccess.Get()->GetAscent( pSh, pOut );
+/*N*/ SetProportion( nOldProp );
+/*N*/ bOrgChg = FALSE;
+/*N*/ }
+/*N*/
+/*N*/ if( bFntChg )
+/*N*/ {
+/*N*/ ChgFnt( pSh, pOut );
+/*N*/ bFntChg = bOrgChg;
+/*N*/ }
+/*N*/ if( pOut->GetTextLineColor() != aUnderColor )
+/*?*/ pOut->SetTextLineColor( aUnderColor );
+/*N*/ }
+
+/*************************************************************************
+ * SwFont::CalcEscHeight()
+ * Height = MaxAscent + MaxDescent
+ * MaxAscent = Max (T1_ascent, T2_ascent + (Esc * T1_height) );
+ * MaxDescent = Max (T1_height-T1_ascent,
+ * T2_height-T2_ascent - (Esc * T1_height)
+ *************************************************************************/
+
+/*N*/ USHORT SwSubFont::CalcEscHeight( const USHORT nOldHeight,
+/*N*/ const USHORT nOldAscent ) const
+/*N*/ {
+/*N*/ if( DFLT_ESC_AUTO_SUPER != GetEscapement() &&
+/*N*/ DFLT_ESC_AUTO_SUB != GetEscapement() )
+/*N*/ {
+/*N*/ long nDescent = nOldHeight - nOldAscent -
+/*N*/ ( (long) nOrgHeight * GetEscapement() ) / 100L;
+/*N*/ const USHORT nDesc = ( nDescent>0 ) ? Max ( USHORT(nDescent),
+/*N*/ USHORT(nOrgHeight - nOrgAscent) ) : nOrgHeight - nOrgAscent;
+/*N*/ return ( nDesc + CalcEscAscent( nOldAscent ) );
+/*N*/ }
+/*N*/ return nOrgHeight;
+/*N*/ }
+
+/*N*/ short SwSubFont::_CheckKerning( )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static short nTst = 6;
+/*N*/ short nKernx = - short( Font::GetSize().Height() / nTst );
+/*N*/ #else
+/*N*/ short nKernx = - short( Font::GetSize().Height() / 6 );
+/*N*/ #endif
+/*N*/ if ( nKernx < GetFixKerning() )
+/*N*/ return GetFixKerning();
+/*N*/ return nKernx;
+/*N*/ }
+
+/*************************************************************************
+ * SwSubFont::GetAscent()
+ *************************************************************************/
+
+/*N*/ USHORT SwSubFont::GetAscent( ViewShell *pSh, const OutputDevice *pOut )
+/*N*/ {
+/*N*/ register USHORT nAscent;
+/*N*/ SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh );
+/*N*/ nAscent = aFntAccess.Get()->GetAscent( pSh, pOut );
+/*N*/ if( GetEscapement() )
+/*N*/ nAscent = CalcEscAscent( nAscent );
+/*N*/ return nAscent;
+/*N*/ }
+
+/*************************************************************************
+ * SwSubFont::GetHeight()
+ *************************************************************************/
+
+/*N*/ USHORT SwSubFont::GetHeight( ViewShell *pSh, const OutputDevice *pOut )
+/*N*/ {
+/*N*/ SV_STAT( nGetTextSize );
+/*N*/ SwFntAccess aFntAccess( pMagic, nFntIndex, this, pSh );
+/*N*/ const USHORT nHeight = aFntAccess.Get()->GetHeight( pSh, pOut );
+/*N*/ if ( GetEscapement() )
+/*N*/ {
+/*N*/ const USHORT nAscent = aFntAccess.Get()->GetAscent( pSh, pOut );
+/*N*/ return CalcEscHeight( nHeight, nAscent ); // + nLeading;
+/*N*/ }
+/*N*/ return nHeight; // + nLeading;
+/*N*/ }
+
+/*************************************************************************
+ * SwSubFont::_GetTxtSize()
+ *************************************************************************/
+/*N*/ Size SwSubFont::_GetTxtSize( SwDrawTextInfo& rInf )
+/*N*/ {
+/*N*/ // Robust: Eigentlich sollte der Font bereits eingestellt sein, aber
+/*N*/ // sicher ist sicher ...
+/*N*/ if ( !pLastFont || pLastFont->GetOwner()!=pMagic ||
+/*N*/ !IsSameInstance( rInf.GetpOut()->GetFont() ) )
+/*N*/ ChgFnt( rInf.GetShell(), rInf.GetpOut() );
+/*N*/
+/*N*/ Size aTxtSize;
+/*N*/ xub_StrLen nLn = ( rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
+/*N*/ : rInf.GetLen() );
+/*N*/ rInf.SetLen( nLn );
+/*N*/ if( IsCapital() && nLn )
+/*N*/ aTxtSize = GetCapitalSize( rInf );
+/*N*/ else
+/*N*/ {
+/*N*/ SV_STAT( nGetTextSize );
+/*N*/ short nOldKern = rInf.GetKern();
+/*N*/ const XubString &rOldTxt = rInf.GetText();
+/*N*/ rInf.SetKern( CheckKerning() );
+/*N*/ if ( !IsCaseMap() )
+/*N*/ aTxtSize = pLastFont->GetTextSize( rInf );
+/*N*/ else
+/*N*/ {
+/*N*/ String aTmp = CalcCaseMap( rInf.GetText() );
+/*N*/ const XubString &rOldStr = rInf.GetText();
+/*N*/ sal_Bool bCaseMapLengthDiffers(aTmp.Len() != rOldStr.Len());
+/*N*/
+/*N*/ if(bCaseMapLengthDiffers && rInf.GetLen())
+/*N*/ {
+/*N*/ // #108203#
+/*N*/ // If the length of the original string and the CaseMapped one
+/*N*/ // are different, it is necessary to handle the given text part as
+/*N*/ // a single snippet since itÄs size may differ, too.
+/*N*/ xub_StrLen nOldIdx(rInf.GetIdx());
+/*N*/ xub_StrLen nOldLen(rInf.GetLen());
+/*N*/ const XubString aSnippet(rOldStr, nOldIdx, nOldLen);
+/*N*/ XubString aNewText(CalcCaseMap(aSnippet));
+/*N*/
+/*N*/ rInf.SetText( aNewText );
+/*N*/ rInf.SetIdx( 0 );
+/*N*/ rInf.SetLen( aNewText.Len() );
+/*N*/
+/*N*/ aTxtSize = pLastFont->GetTextSize( rInf );
+/*N*/
+/*N*/ rInf.SetIdx( nOldIdx );
+/*N*/ rInf.SetLen( nOldLen );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ rInf.SetText( aTmp );
+/*N*/ aTxtSize = pLastFont->GetTextSize( rInf );
+/*N*/ }
+/*N*/
+/*N*/ rInf.SetText( rOldStr );
+/*N*/ }
+/*N*/ rInf.SetKern( nOldKern );
+/*N*/ rInf.SetText( rOldTxt );
+/*N*/ // 15142: Ein Wort laenger als eine Zeile, beim Zeilenumbruch
+/*N*/ // hochgestellt, muss seine effektive Hoehe melden.
+/*N*/ if( GetEscapement() )
+/*N*/ {
+/*N*/ const USHORT nAscent = pLastFont->GetAscent( rInf.GetShell(),
+/*N*/ rInf.GetpOut() );
+/*N*/ aTxtSize.Height() =
+/*N*/ (long)CalcEscHeight( (USHORT)aTxtSize.Height(), nAscent);
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ return aTxtSize;
+/*N*/ }
+
+/*************************************************************************
+ * SwFont::GetTxtBreak()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwFont::GetTxtBreak()
+ *************************************************************************/
+
+
+/*************************************************************************
+ * SwSubFont::_DrawText()
+ *************************************************************************/
+
+
+
+/*************************************************************************
+ * SwSubFont::_GetCrsrOfst()
+ *************************************************************************/
+
+/*N*/ xub_StrLen SwSubFont::_GetCrsrOfst( SwDrawTextInfo& rInf )
+/*N*/ {
+/*N*/ if ( !pLastFont || pLastFont->GetOwner()!=pMagic )
+/*?*/ ChgFnt( rInf.GetShell(), rInf.GetpOut() );
+/*N*/
+/*N*/ xub_StrLen nLn = rInf.GetLen() == STRING_LEN ? rInf.GetText().Len()
+/*N*/ : rInf.GetLen();
+/*N*/ rInf.SetLen( nLn );
+/*N*/ xub_StrLen nCrsr = 0;
+/*N*/ if( IsCapital() && nLn )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ nCrsr = GetCapitalCrsrOfst( rInf );
+/*N*/ else
+/*N*/ {
+/*N*/ const XubString &rOldTxt = rInf.GetText();
+/*N*/ short nOldKern = rInf.GetKern();
+/*N*/ rInf.SetKern( CheckKerning() );
+/*N*/ SV_STAT( nGetTextSize );
+/*N*/ if ( !IsCaseMap() )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP"); }//STRIP001 nCrsr = pLastFont->GetCrsrOfst( rInf );
+/*N*/ else
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+/*N*/ rInf.SetKern( nOldKern );
+/*N*/ rInf.SetText( rOldTxt );
+/*N*/ }
+/*N*/ return nCrsr;
+/*N*/ }
+
+/*************************************************************************
+ * SwSubFont::CalcEsc()
+ *************************************************************************/
+
+
+// used during painting of small capitals
+
+/*************************************************************************
+ * SwUnderlineFont::~SwUnderlineFont
+ *
+ * Used for the "continuous underline" feature.
+ *************************************************************************/
+
+
+
+//Helper for filters to find true lineheight of a font
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_thints.cxx b/binfilter/bf_sw/source/core/txtnode/sw_thints.cxx
new file mode 100644
index 000000000000..c2d2c1b78f52
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_thints.cxx
@@ -0,0 +1,2006 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svtools/whiter.hxx>
+#include <bf_svtools/itemiter.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/emphitem.hxx>
+
+#include <txtinet.hxx>
+#include <txtflcnt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfld.hxx>
+#include <fmtinfmt.hxx>
+#include <txtatr.hxx>
+#include <fchrfmt.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtftn.hxx>
+#include <txttxmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <txtftn.hxx>
+#include <txtfld.hxx>
+#include <charfmt.hxx>
+#include <frmfmt.hxx>
+#include <ftnidx.hxx>
+#include <breakit.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pam.hxx>
+#include <ndtxt.hxx>
+#include <hints.hxx> // fuer SwFmtChg
+#include <ddefld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <usrfld.hxx>
+#include <poolfmt.hxx>
+// OD 26.06.2003 #108784#
+#include <dcontact.hxx>
+
+#include <algorithm>
+namespace binfilter {
+
+#ifdef DBG_UTIL
+#define CHECK Check();
+#else
+#define CHECK
+#endif
+
+using namespace ::com::sun::star::i18n;
+
+/*************************************************************************
+ * SwTxtNode::MakeTxtAttr()
+ *************************************************************************/
+
+ // lege ein neues TextAttribut an und fuege es SwpHints-Array ein
+/*N*/ SwTxtAttr* SwTxtNode::MakeTxtAttr( const SfxPoolItem& rAttr,
+/*N*/ xub_StrLen nStt, xub_StrLen nEnd, BOOL bPool )
+/*N*/ {
+/*N*/ // das neue Attribut im Pool anlegen
+/*N*/ const SfxPoolItem& rNew = bPool ? GetDoc()->GetAttrPool().Put( rAttr ) :
+/*N*/ rAttr;
+/*N*/
+/*N*/ SwTxtAttr* pNew = 0;
+/*N*/ switch( rNew.Which() )
+/*N*/ {
+/*N*/ case RES_CHRATR_CASEMAP:
+/*N*/ case RES_CHRATR_COLOR:
+/*N*/ case RES_CHRATR_CHARSETCOLOR:
+/*N*/ case RES_CHRATR_CONTOUR:
+/*N*/ case RES_CHRATR_CROSSEDOUT:
+/*N*/ case RES_CHRATR_ESCAPEMENT:
+/*N*/ case RES_CHRATR_KERNING:
+/*N*/ case RES_CHRATR_SHADOWED:
+/*N*/ case RES_CHRATR_AUTOKERN:
+/*N*/ case RES_CHRATR_WORDLINEMODE:
+/*N*/ case RES_CHRATR_UNDERLINE:
+/*N*/ case RES_CHRATR_FONT:
+/*N*/ case RES_CHRATR_CTL_FONT:
+/*N*/ case RES_CHRATR_CJK_FONT:
+/*N*/ case RES_CHRATR_FONTSIZE:
+/*N*/ case RES_CHRATR_CTL_FONTSIZE:
+/*N*/ case RES_CHRATR_CJK_FONTSIZE:
+/*N*/ case RES_CHRATR_LANGUAGE:
+/*N*/ case RES_CHRATR_CTL_LANGUAGE:
+/*N*/ case RES_CHRATR_CJK_LANGUAGE:
+/*N*/ case RES_CHRATR_POSTURE:
+/*N*/ case RES_CHRATR_CTL_POSTURE:
+/*N*/ case RES_CHRATR_CJK_POSTURE:
+/*N*/ case RES_CHRATR_WEIGHT:
+/*N*/ case RES_CHRATR_CTL_WEIGHT:
+/*N*/ case RES_CHRATR_CJK_WEIGHT:
+/*N*/ case RES_CHRATR_EMPHASIS_MARK:
+/*N*/ case RES_CHRATR_NOHYPHEN:
+/*N*/ case RES_CHRATR_BLINK:
+/*N*/ case RES_CHRATR_BACKGROUND:
+/*N*/ case RES_CHRATR_ROTATE:
+/*N*/ case RES_CHRATR_SCALEW:
+/*N*/ case RES_CHRATR_RELIEF:
+/*N*/ pNew = new SwTxtAttrEnd( rNew, nStt, nEnd );
+/*N*/ break;
+/*N*/ case RES_TXTATR_CHARFMT:
+/*N*/ {
+/*N*/ SwFmtCharFmt &rFmtCharFmt = (SwFmtCharFmt&) rNew;
+/*N*/ if( !rFmtCharFmt.GetCharFmt() )
+/*?*/ rFmtCharFmt.SetCharFmt( GetDoc()->GetDfltCharFmt() );
+/*N*/
+/*N*/ pNew = new SwTxtCharFmt( rFmtCharFmt, nStt, nEnd );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_TXTATR_INETFMT:
+/*N*/ pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd );
+/*N*/ break;
+/*N*/ case RES_TXTATR_FIELD:
+/*N*/ pNew = new SwTxtFld( (SwFmtFld&)rNew, nStt );
+/*N*/ break;
+/*N*/ case RES_TXTATR_FLYCNT:
+/*N*/ {
+/*N*/ // erst hier wird das Frame-Format kopiert (mit Inhalt) !!
+/*N*/ pNew = new SwTxtFlyCnt( (SwFmtFlyCnt&)rNew, nStt );
+/*N*/ // Kopie von einem Text-Attribut
+/*N*/ if( ((SwFmtFlyCnt&)rAttr).GetTxtFlyCnt() )
+/*N*/ // dann muss das Format Kopiert werden
+/*N*/ ((SwTxtFlyCnt*)pNew)->CopyFlyFmt( GetDoc() );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_TXTATR_FTN:
+/*N*/ pNew = new SwTxtFtn( (SwFmtFtn&)rNew, nStt );
+/*N*/ // ggfs. SeqNo kopieren
+/*N*/ if( ((SwFmtFtn&)rAttr).GetTxtFtn() )
+/*?*/ ((SwTxtFtn*)pNew)->SetSeqNo( ((SwFmtFtn&)rAttr).GetTxtFtn()->GetSeqRefNo() );
+/*N*/ break;
+/*?*/ case RES_TXTATR_HARDBLANK:
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pNew = new SwTxtHardBlank( (SwFmtHardBlank&)rNew, nStt );
+/*?*/ break;
+/*?*/ case RES_CHRATR_TWO_LINES:
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pNew = new SwTxt2Lines( (SvxTwoLinesItem&)rNew, nStt, nEnd );
+/*?*/ break;
+/*N*/ case RES_TXTATR_REFMARK:
+/*N*/ pNew = nStt == nEnd
+/*N*/ ? new SwTxtRefMark( (SwFmtRefMark&)rNew, nStt )
+/*N*/ : new SwTxtRefMark( (SwFmtRefMark&)rNew, nStt, &nEnd );
+/*N*/ break;
+/*N*/ case RES_TXTATR_TOXMARK:
+/*N*/ pNew = new SwTxtTOXMark( (SwTOXMark&)rNew, nStt, &nEnd );
+/*N*/ break;
+/*N*/ case RES_UNKNOWNATR_CONTAINER:
+/*?*/ case RES_TXTATR_UNKNOWN_CONTAINER:
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ pNew = new SwTxtXMLAttrContainer( (SvXMLAttrContainerItem&)rNew,
+/*?*/ break;
+/*N*/ case RES_TXTATR_CJK_RUBY:
+/*N*/ pNew = new SwTxtRuby( (SwFmtRuby&)rNew, nStt, nEnd );
+/*N*/ break;
+/*N*/ }
+/*N*/ ASSERT( pNew, "was fuer ein TextAttribut soll hier angelegt werden?" );
+/*N*/ return pNew;
+/*N*/ }
+
+// loesche das Text-Attribut (muss beim Pool abgemeldet werden!)
+/*N*/ void SwTxtNode::DestroyAttr( SwTxtAttr* pAttr )
+/*N*/ {
+/*N*/ if( pAttr )
+/*N*/ {
+/*N*/ // einige Sachen muessen vorm Loeschen der "Format-Attribute" erfolgen
+/*N*/ SwDoc* pDoc = GetDoc();
+/*N*/ USHORT nDelMsg = 0;
+/*N*/ switch( pAttr->Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_FLYCNT:
+/*N*/ {
+/*N*/ // siehe auch die Anmerkung "Loeschen von Formaten
+/*N*/ // zeichengebundener Frames" in fesh.cxx, SwFEShell::DelFmt()
+/*N*/ SwFrmFmt* pFmt = pAttr->GetFlyCnt().GetFrmFmt();
+/*N*/ if( pFmt ) // vom Undo auf 0 gesetzt ??
+/*N*/ pDoc->DelLayoutFmt( (SwFlyFrmFmt*)pFmt );
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_FTN:
+/*N*/ ((SwTxtFtn*)pAttr)->SetStartNode( 0 );
+/*N*/ nDelMsg = RES_FOOTNOTE_DELETED;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_FIELD:
+/*N*/ if( !pDoc->IsInDtor() )
+/*N*/ {
+/*N*/ // Wenn wir ein HiddenParaField sind, dann muessen wir
+/*N*/ // ggf. fuer eine Neuberechnung des Visible-Flags sorgen.
+/*N*/ const SwField* pFld = pAttr->GetFld().GetFld();
+/*N*/
+/*N*/ //JP 06-08-95: DDE-Felder bilden eine Ausnahme
+/*N*/ ASSERT( RES_DDEFLD == pFld->GetTyp()->Which() ||
+/*N*/ this == ((SwTxtFld*)pAttr)->GetpTxtNode(),
+/*N*/ "Wo steht denn dieses Feld?" )
+/*N*/
+/*N*/ // bestimmte Felder mussen am Doc das Calculations-Flag updaten
+/*N*/ switch( pFld->GetTyp()->Which() )
+/*N*/ {
+/*?*/ case RES_HIDDENPARAFLD:
+/*?*/ SetCalcVisible();
+/*?*/ // kein break !
+/*?*/ case RES_DBSETNUMBERFLD:
+/*?*/ case RES_GETEXPFLD:
+/*?*/ case RES_DBFLD:
+/*?*/ case RES_SETEXPFLD:
+/*?*/ case RES_HIDDENTXTFLD:
+/*?*/ case RES_DBNUMSETFLD:
+/*?*/ case RES_DBNEXTSETFLD:
+/*?*/ if( !pDoc->IsNewFldLst() && GetNodes().IsDocNodes() )
+/*?*/ pDoc->InsDelFldInFldLst( FALSE, *(SwTxtFld*)pAttr );
+/*?*/ break;
+/*?*/ case RES_DDEFLD:
+/*?*/ if( GetNodes().IsDocNodes() &&
+/*?*/ ((SwTxtFld*)pAttr)->GetpTxtNode() )
+/*?*/ ((SwDDEFieldType*)pFld->GetTyp())->DecRefCnt();
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ nDelMsg = RES_FIELD_DELETED;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_TOXMARK:
+/*N*/ nDelMsg = RES_TOXMARK_DELETED;
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_REFMARK:
+/*N*/ nDelMsg = RES_REFMARK_DELETED;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( nDelMsg && !pDoc->IsInDtor() && GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ SwPtrMsgPoolItem aMsgHint( nDelMsg, (void*)&pAttr->GetAttr() );
+/*N*/ pDoc->GetUnoCallBack()->Modify( &aMsgHint, &aMsgHint );
+/*N*/ }
+/*N*/
+/*N*/ pAttr->RemoveFromPool( pDoc->GetAttrPool() );
+/*N*/ delete pAttr;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtNode::Insert()
+ *************************************************************************/
+
+// lege ein neues TextAttribut an und fuege es ins SwpHints-Array ein
+/*N*/ SwTxtAttr* SwTxtNode::Insert( const SfxPoolItem& rAttr,
+/*N*/ xub_StrLen nStt, xub_StrLen nEnd, USHORT nMode )
+/*N*/ {
+/*N*/ SwTxtAttr* pNew = MakeTxtAttr( rAttr, nStt, nEnd );
+/*N*/ return (pNew && Insert( pNew, nMode )) ? pNew : 0;
+/*N*/ }
+
+// uebernehme den Pointer auf das Text-Attribut
+
+/*N*/ BOOL SwTxtNode::Insert( SwTxtAttr *pAttr, USHORT nMode )
+/*N*/ {
+/*N*/ BOOL bHiddenPara = FALSE;
+/*N*/
+/*N*/ ASSERT( *pAttr->GetStart() <= Len(), "StartIdx hinter Len!" );
+/*N*/
+/*N*/ if( !pAttr->GetEnd() )
+/*N*/ {
+/*N*/ USHORT nInsMode = nMode;
+/*N*/ switch( pAttr->Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_FLYCNT:
+/*N*/ {
+/*N*/ SwTxtFlyCnt *pFly = (SwTxtFlyCnt *)pAttr;
+/*N*/ SwFrmFmt* pFmt = pAttr->GetFlyCnt().GetFrmFmt();
+/*N*/ if( !(SETATTR_NOTXTATRCHR & nInsMode) )
+/*N*/ {
+/*N*/ // Wir muessen zuerst einfuegen, da in SetAnchor()
+/*N*/ // dem FlyFrm GetStart() uebermittelt wird.
+/*N*/ //JP 11.05.98: falls das Anker-Attribut schon richtig
+/*N*/ // gesetzt ist, dann korrigiere dieses nach dem Einfuegen
+/*N*/ // des Zeichens. Sonst muesste das immer ausserhalb
+/*N*/ // erfolgen (Fehleranfaellig !)
+/*N*/ const SwFmtAnchor* pAnchor = 0;
+/*N*/ pFmt->GetItemState( RES_ANCHOR, FALSE,
+/*N*/ (const SfxPoolItem**)&pAnchor );
+/*N*/
+/*N*/ SwIndex aIdx( this, *pAttr->GetStart() );
+/*N*/ Insert( GetCharOfTxtAttr(*pAttr), aIdx );
+/*N*/ nInsMode |= SETATTR_NOTXTATRCHR;
+/*N*/
+/*N*/ if( pAnchor && FLY_IN_CNTNT == pAnchor->GetAnchorId() &&
+/*N*/ pAnchor->GetCntntAnchor() &&
+/*N*/ pAnchor->GetCntntAnchor()->nNode == *this &&
+/*N*/ pAnchor->GetCntntAnchor()->nContent == aIdx )
+/*N*/ ((SwIndex&)pAnchor->GetCntntAnchor()->nContent)--;
+/*N*/ }
+/*N*/ pFly->SetAnchor( this );
+/*N*/
+/*N*/ // Format-Pointer kann sich im SetAnchor geaendert haben!
+/*N*/ // (Kopieren in andere Docs!)
+/*N*/ pFmt = pAttr->GetFlyCnt().GetFrmFmt();
+/*N*/ SwDoc *pDoc = pFmt->GetDoc();
+/*N*/
+/*N*/ // OD 26.06.2003 #108784# - allow drawing objects in header/footer.
+/*N*/ // But don't allow control objects in header/footer
+/*N*/ if( RES_DRAWFRMFMT == pFmt->Which() &&
+/*N*/ pDoc->IsInHeaderFooter( pFmt->GetAnchor().GetCntntAnchor()->nNode ) )
+/*N*/ {
+/*N*/ SwDrawContact* pDrawContact =
+/*N*/ static_cast<SwDrawContact*>(pFmt->FindContactObj());
+/*N*/ if ( pDrawContact &&
+/*N*/ pDrawContact->GetMaster() &&
+/*N*/ ::binfilter::CheckControlLayer( pDrawContact->GetMaster() ) )
+/*N*/ {
+/*N*/ // das soll nicht meoglich sein; hier verhindern
+/*N*/ // Der Dtor des TxtHints loescht nicht das Zeichen.
+/*N*/ // Wenn ein CH_TXTATR_.. vorliegt, dann muss man
+/*N*/ // dieses explizit loeschen
+/*?*/ if( SETATTR_NOTXTATRCHR & nInsMode )
+/*?*/ {
+/*?*/ // loesche das Zeichen aus dem String !
+/*?*/ ASSERT( ( CH_TXTATR_BREAKWORD ==
+/*?*/ aText.GetChar(*pAttr->GetStart() ) ||
+/*?*/ CH_TXTATR_INWORD ==
+/*?*/ aText.GetChar(*pAttr->GetStart())),
+/*?*/ "where is my attribu character" );
+/*?*/ aText.Erase( *pAttr->GetStart(), 1 );
+/*?*/ // Indizies Updaten
+/*?*/ SwIndex aTmpIdx( this, *pAttr->GetStart() );
+/*?*/ Update( aTmpIdx, 1, TRUE );
+/*?*/ }
+/*?*/ DestroyAttr( pAttr );
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ case RES_TXTATR_FTN :
+/*N*/ {
+/*N*/ // Fussnoten, man kommt an alles irgendwie heran.
+/*N*/ // CntntNode erzeugen und in die Inserts-Section stellen
+/*N*/ SwDoc *pDoc = GetDoc();
+/*N*/ SwNodes &rNodes = pDoc->GetNodes();
+/*N*/
+/*N*/ // FussNote in nicht Content-/Redline-Bereich einfuegen ??
+/*N*/ if( StartOfSectionIndex() < rNodes.GetEndOfAutotext().GetIndex() )
+/*N*/ {
+/*N*/ // das soll nicht meoglich sein; hier verhindern
+/*N*/ // Der Dtor des TxtHints loescht nicht das Zeichen.
+/*N*/ // Wenn ein CH_TXTATR_.. vorliegt, dann muss man
+/*N*/ // dieses explizit loeschen
+/*?*/ if( SETATTR_NOTXTATRCHR & nInsMode )
+/*?*/ {
+/*?*/ // loesche das Zeichen aus dem String !
+/*?*/ ASSERT( ( CH_TXTATR_BREAKWORD ==
+/*?*/ aText.GetChar(*pAttr->GetStart() ) ||
+/*?*/ CH_TXTATR_INWORD ==
+/*?*/ aText.GetChar(*pAttr->GetStart())),
+/*?*/ "where is my attribu character" );
+/*?*/ aText.Erase( *pAttr->GetStart(), 1 );
+/*?*/ // Indizies Updaten
+/*?*/ SwIndex aTmpIdx( this, *pAttr->GetStart() );
+/*?*/ Update( aTmpIdx, 1, TRUE );
+/*?*/ }
+/*?*/ DestroyAttr( pAttr );
+/*?*/ return FALSE;
+/*N*/ }
+/*N*/
+/*N*/ // wird eine neue Fussnote eingefuegt ??
+/*N*/ BOOL bNewFtn = 0 == ((SwTxtFtn*)pAttr)->GetStartNode();
+/*N*/ if( bNewFtn )
+/*N*/ ((SwTxtFtn*)pAttr)->MakeNewTextSection( GetNodes() );
+/*N*/ else if ( !GetpSwpHints() || !GetpSwpHints()->IsInSplitNode() )
+/*N*/ {
+/*N*/ // loesche alle Frames der Section, auf die der StartNode zeigt
+/*N*/ ULONG nSttIdx =
+/*N*/ ((SwTxtFtn*)pAttr)->GetStartNode()->GetIndex();
+/*N*/ ULONG nEndIdx = rNodes[ nSttIdx++ ]->EndOfSectionIndex();
+/*N*/ SwCntntNode* pCNd;
+/*N*/ for( ; nSttIdx < nEndIdx; ++nSttIdx )
+/*N*/ if( 0 != ( pCNd = rNodes[ nSttIdx ]->GetCntntNode() ))
+/*N*/ pCNd->DelFrms();
+/*N*/ }
+/*N*/
+/*N*/ if( !(SETATTR_NOTXTATRCHR & nInsMode) )
+/*N*/ {
+/*N*/ // Wir muessen zuerst einfuegen, da sonst gleiche Indizes
+/*N*/ // entstehen koennen und das Attribut im _SortArr_ am
+/*N*/ // Dokument nicht eingetrage wird.
+/*N*/ SwIndex aNdIdx( this, *pAttr->GetStart() );
+/*N*/ Insert( GetCharOfTxtAttr(*pAttr), aNdIdx );
+/*N*/ nInsMode |= SETATTR_NOTXTATRCHR;
+/*N*/ }
+/*N*/
+/*N*/ // Wir tragen uns am FtnIdx-Array des Docs ein ...
+/*N*/ SwTxtFtn* pTxtFtn = 0;
+/*N*/ if( !bNewFtn )
+/*N*/ {
+/*N*/ // eine alte Ftn wird umgehaengt (z.B. SplitNode)
+/*N*/ for( USHORT n = 0; n < pDoc->GetFtnIdxs().Count(); ++n )
+/*?*/ if( pAttr == pDoc->GetFtnIdxs()[n] )
+/*?*/ {
+/*?*/ // neuen Index zuweisen, dafuer aus dem SortArray
+/*?*/ // loeschen und neu eintragen
+/*?*/ pTxtFtn = pDoc->GetFtnIdxs()[n];
+/*?*/ pDoc->GetFtnIdxs().Remove( n );
+/*?*/ break;
+/*?*/ }
+/*N*/ // wenn ueber Undo der StartNode gesetzt wurde, kann
+/*N*/ // der Index noch gar nicht in der Verwaltung stehen !!
+/*N*/ }
+/*N*/ if( !pTxtFtn )
+/*N*/ pTxtFtn = (SwTxtFtn*)pAttr;
+/*N*/
+/*N*/ // fuers Update der Nummern und zum Sortieren
+/*N*/ // muss der Node gesetzt sein.
+/*N*/ ((SwTxtFtn*)pAttr)->ChgTxtNode( this );
+/*N*/
+/*N*/ // FussNote im Redline-Bereich NICHT ins FtnArray einfuegen!
+/*N*/ if( StartOfSectionIndex() > rNodes.GetEndOfRedlines().GetIndex() )
+/*N*/ {
+/*N*/ #ifdef DBG_UTIL
+/*N*/ const BOOL bSuccess =
+/*N*/ #endif
+/*N*/ pDoc->GetFtnIdxs().Insert( pTxtFtn );
+/*N*/ #ifdef DBG_UTIL
+/*N*/ ASSERT( bSuccess, "FtnIdx nicht eingetragen." );
+/*N*/ #endif
+/*N*/ }
+/*N*/ SwNodeIndex aTmpIndex( *this );
+/*N*/ pDoc->GetFtnIdxs().UpdateFtn( aTmpIndex);
+/*N*/ ((SwTxtFtn*)pAttr)->SetSeqRefNo();
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_FIELD:
+/*N*/ {
+/*N*/ // fuer HiddenParaFields Benachrichtigungsmechanismus
+/*N*/ // anwerfen
+/*N*/ if( RES_HIDDENPARAFLD ==
+/*N*/ pAttr->GetFld().GetFld()->GetTyp()->Which() )
+/*N*/ bHiddenPara = TRUE;
+/*N*/ }
+/*N*/ break;
+/*N*/
+/*N*/ }
+/*N*/ // Fuer SwTxtHints ohne Endindex werden CH_TXTATR_..
+/*N*/ // eingefuegt, aStart muss danach um einen zurueckgesetzt werden.
+/*N*/ // Wenn wir im SwTxtNode::Copy stehen, so wurde das Zeichen bereits
+/*N*/ // mitkopiert. In solchem Fall ist SETATTR_NOTXTATRCHR angegeben worden.
+/*N*/ if( !(SETATTR_NOTXTATRCHR & nInsMode) )
+/*N*/ {
+/*N*/ SwIndex aIdx( this, *pAttr->GetStart() );
+/*N*/ Insert( GetCharOfTxtAttr(*pAttr), aIdx );
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ ASSERT( *pAttr->GetEnd() <= Len(), "EndIdx hinter Len!" );
+/*N*/ }
+/*N*/
+/*N*/ if ( !pSwpHints )
+/*N*/ pSwpHints = new SwpHints();
+/*N*/
+/*N*/ // 4263: AttrInsert durch TextInsert => kein Adjust
+/*N*/ pSwpHints->Insert( pAttr, *this, nMode );
+/*N*/
+/*N*/ // 47375: In pSwpHints->Insert wird u.a. Merge gerufen und das Hints-Array
+/*N*/ // von ueberfluessigen Hints befreit, dies kann u.U. sogar der frisch
+/*N*/ // eingefuegte Hint pAttr sein, der dann zerstoert wird!!
+/*N*/ if( USHRT_MAX == pSwpHints->GetPos( pAttr ) )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ if(bHiddenPara)
+/*N*/ SetCalcVisible();
+/*N*/ return TRUE;
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtNode::Delete()
+ *************************************************************************/
+
+/*N*/ void SwTxtNode::Delete( SwTxtAttr *pAttr, BOOL bThisOnly )
+/*N*/ {
+/*N*/ if ( !pSwpHints )
+/*N*/ return;
+/*N*/ if( bThisOnly )
+/*N*/ {
+/*?*/ xub_StrLen* pEndIdx = pAttr->GetEnd();
+/*?*/ if( !pEndIdx )
+/*?*/ {
+/*?*/ // hat es kein Ende kann es nur das sein, was hier steht!
+/*?*/ // Unbedingt Copy-konstruieren!
+/*?*/ const SwIndex aIdx( this, *pAttr->GetStart() );
+/*?*/ Erase( aIdx, 1 );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ // den MsgHint jetzt fuettern, weil gleich sind
+/*?*/ // Start und End weg.
+/*?*/ SwUpdateAttr aHint( *pAttr->GetStart(), *pEndIdx, pAttr->Which() );
+/*?*/ pSwpHints->Delete( pAttr );
+/*?*/ pAttr->RemoveFromPool( GetDoc()->GetAttrPool() );
+/*?*/ delete pAttr;
+/*?*/ SwModify::Modify( 0, &aHint ); // die Frames benachrichtigen
+/*?*/
+/*?*/ if( pSwpHints && pSwpHints->CanBeDeleted() )
+/*?*/ DELETEZ( pSwpHints );
+/*?*/ }
+/*?*/
+/*?*/ return;
+/*N*/ }
+/*N*/ Delete( pAttr->Which(), *pAttr->GetStart(), *pAttr->GetAnyEnd() );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtNode::Delete()
+ *************************************************************************/
+
+/*N*/ void SwTxtNode::Delete( USHORT nTxtWhich, xub_StrLen nStart, xub_StrLen nEnd )
+/*N*/ {
+/*N*/ if ( !pSwpHints )
+/*N*/ return;
+/*N*/
+/*N*/ const xub_StrLen *pEndIdx;
+/*N*/ const xub_StrLen *pSttIdx;
+/*N*/ SwTxtAttr* pTxtHt;
+/*N*/
+/*N*/ for( USHORT nPos = 0; pSwpHints && nPos < pSwpHints->Count(); nPos++ )
+/*N*/ {
+/*N*/ pTxtHt = pSwpHints->GetHt( nPos );
+/*N*/ const USHORT nWhich = pTxtHt->Which();
+/*N*/ if( nWhich == nTxtWhich &&
+/*N*/ *( pSttIdx = pTxtHt->GetStart()) == nStart )
+/*N*/ {
+/*N*/ pEndIdx = pTxtHt->GetEnd();
+/*N*/
+/*N*/ // Text-Attribute sind voellig dynamisch, so dass diese nur
+/*N*/ // mit ihrer Start-Position verglichen werden.
+/*N*/ if( !pEndIdx )
+/*N*/ {
+/*N*/ // Unbedingt Copy-konstruieren!
+/*?*/ const SwIndex aIdx( this, *pSttIdx );
+/*?*/ Erase( aIdx, 1 );
+/*?*/ break;
+/*N*/ }
+/*N*/ else if( *pEndIdx == nEnd )
+/*N*/ {
+/*N*/ // den MsgHint jetzt fuettern, weil gleich sind
+/*N*/ // Start und End weg.
+/*N*/ // Das CalcVisibleFlag bei HiddenParaFields entfaellt,
+/*N*/ // da dies das Feld im Dtor selbst erledigt.
+/*N*/ SwUpdateAttr aHint( *pSttIdx, *pEndIdx, nTxtWhich );
+/*N*/ pSwpHints->DeleteAtPos( nPos ); // gefunden, loeschen,
+/*N*/ pTxtHt->RemoveFromPool( GetDoc()->GetAttrPool() );
+/*N*/ delete pTxtHt;
+/*N*/ SwModify::Modify( 0, &aHint ); // die Frames benachrichtigen
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( pSwpHints && pSwpHints->CanBeDeleted() )
+/*N*/ DELETEZ( pSwpHints );
+/*N*/ }
+
+/*************************************************************************
+ * SwTxtNode::DelSoftHyph()
+ *************************************************************************/
+
+// setze diese Attribute am TextNode. Wird der gesamte Bereich umspannt,
+// dann setze sie nur im AutoAttrSet (SwCntntNode:: SetAttr)
+/*N*/ BOOL SwTxtNode::SetAttr( const SfxItemSet& rSet, xub_StrLen nStt,
+/*N*/ xub_StrLen nEnd, USHORT nMode )
+/*N*/ {
+/*N*/ if( !rSet.Count() )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ // teil die Sets auf (fuer Selektion in Nodes)
+/*N*/ const SfxItemSet* pSet = &rSet;
+/*N*/ SfxItemSet aTxtSet( *rSet.GetPool(), RES_TXTATR_BEGIN, RES_TXTATR_END-1 );
+/*N*/
+/*N*/ // gesamter Bereich
+/*N*/ if( !nStt && nEnd == aText.Len() && !(nMode & SETATTR_NOFORMATATTR ) )
+/*N*/ {
+/*N*/ // sind am Node schon Zeichenvorlagen gesetzt, muss man diese Attribute
+/*N*/ // (rSet) immer als TextAttribute setzen, damit sie angezeigt werden.
+/*N*/ int bHasCharFmts = FALSE;
+/*N*/ if( pSwpHints )
+/*N*/ for( USHORT n = 0; n < pSwpHints->Count(); ++n )
+/*N*/ if( (*pSwpHints)[ n ]->IsCharFmtAttr() )
+/*N*/ {
+/*N*/ bHasCharFmts = TRUE;
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( !bHasCharFmts )
+/*N*/ {
+/*N*/ aTxtSet.Put( rSet );
+/*N*/ if( aTxtSet.Count() != rSet.Count() )
+/*N*/ {
+/*N*/ BOOL bRet = SwCntntNode::SetAttr( rSet );
+/*N*/ if( !aTxtSet.Count() )
+/*N*/ return bRet;
+/*N*/ }
+/*N*/ pSet = &aTxtSet;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if ( !pSwpHints )
+/*N*/ pSwpHints = new SwpHints();
+/*N*/
+/*N*/ USHORT nWhich, nCount = 0;
+/*N*/ SwTxtAttr* pNew;
+/*N*/ SfxItemIter aIter( *pSet );
+/*N*/ const SfxPoolItem* pItem = aIter.GetCurItem();
+/*N*/ do {
+/*N*/ if( pItem && (SfxPoolItem*)-1 != pItem &&
+/*N*/ (( RES_CHRATR_BEGIN <= ( nWhich = pItem->Which()) &&
+/*N*/ RES_CHRATR_END > nWhich ) ||
+/*N*/ ( RES_TXTATR_BEGIN <= nWhich && RES_TXTATR_END > nWhich ) ||
+/*N*/ ( RES_UNKNOWNATR_BEGIN <= nWhich && RES_UNKNOWNATR_END > nWhich )) )
+/*N*/ {
+/*N*/ if( RES_TXTATR_CHARFMT == pItem->Which() &&
+/*N*/ GetDoc()->GetDfltCharFmt()==((SwFmtCharFmt*)pItem)->GetCharFmt())
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ SwIndex aIndex( this, nStt );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ pNew = MakeTxtAttr( *pItem, nStt, nEnd );
+/*N*/ if( pNew )
+/*N*/ {
+/*N*/ // Attribut ohne Ende, aber Bereich markiert ?
+/*N*/ if( nEnd != nStt && !pNew->GetEnd() )
+/*N*/ {
+/*?*/ ASSERT( !this, "Attribut ohne Ende aber Bereich vorgegeben" );
+/*?*/ DestroyAttr( pNew ); // nicht einfuegen
+/*N*/ }
+/*N*/ else if( Insert( pNew, nMode ))
+/*N*/ ++nCount;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( aIter.IsAtEnd() )
+/*N*/ break;
+/*?*/ pItem = aIter.NextItem();
+/*N*/ } while( TRUE );
+/*N*/
+/*N*/ if( pSwpHints && pSwpHints->CanBeDeleted() )
+/*?*/ DELETEZ( pSwpHints );
+/*N*/
+/*N*/ return nCount ? TRUE : FALSE;
+/*N*/ }
+
+/*N*/ BOOL lcl_Included( const USHORT nWhich, const SwTxtAttr *pAttr )
+/*N*/ {
+/*N*/ #if OSL_DEBUG_LEVEL > 1
+/*N*/ static long nTest = 0;
+/*N*/ ++nTest;
+/*N*/ #endif
+/*N*/ BOOL bRet;
+/*N*/ SwCharFmt* pFmt = RES_TXTATR_INETFMT == pAttr->Which() ?
+/*N*/ ((SwTxtINetFmt*)pAttr)->GetCharFmt() :
+/*N*/ pAttr->GetCharFmt().GetCharFmt();
+/*N*/ if( pFmt )
+/*N*/ bRet = SFX_ITEM_SET == pFmt->GetAttrSet().GetItemState( nWhich, TRUE );
+/*N*/ else
+/*N*/ bRet = FALSE;
+/*N*/ return bRet;
+/*N*/ }
+
+/*N*/ void lcl_MergeAttr( SfxItemSet& rSet, const SfxPoolItem& rAttr )
+/*N*/ {
+/*N*/ rSet.Put( rAttr );
+/*N*/ }
+
+/*N*/ void lcl_MergeAttr_ExpandChrFmt( SfxItemSet& rSet, const SfxPoolItem& rAttr )
+/*N*/ {
+/*N*/ if( RES_TXTATR_CHARFMT == rAttr.Which() ||
+/*N*/ RES_TXTATR_INETFMT == rAttr.Which() )
+/*N*/ {
+/*N*/ // aus der Vorlage die Attribute holen:
+/*N*/ SwCharFmt* pFmt = RES_TXTATR_INETFMT == rAttr.Which() ?
+/*N*/ ((SwFmtINetFmt&)rAttr).GetTxtINetFmt()->GetCharFmt() :
+/*N*/ ((SwFmtCharFmt&)rAttr).GetCharFmt();
+/*N*/ if( pFmt )
+/*N*/ {
+/*N*/ const SfxItemSet& rCFSet = pFmt->GetAttrSet();
+/*N*/ SfxWhichIter aIter( rCFSet );
+/*N*/ register USHORT nWhich = aIter.FirstWhich();
+/*N*/ while( nWhich )
+/*N*/ {
+/*N*/ if( ( nWhich < RES_CHRATR_END ) &&
+/*N*/ ( SFX_ITEM_SET == rCFSet.GetItemState( nWhich, TRUE ) ) )
+/*N*/ rSet.Put( rCFSet.Get( nWhich ) );
+/*N*/ nWhich = aIter.NextWhich();
+/*N*/ }
+/*N*/ #if 0
+/*N*/ SfxItemSet aTmpSet( *rSet.GetPool(), rSet.GetRanges() );
+/*N*/ aTmpSet.Set( pFmt->GetAttrSet(), TRUE );
+ /*
+ ????? JP 31.01.95 ???? wie jetzt ???
+ rSet.MergeValues( aTmpSet );
+
+ // jetzt alle zusammen "mergen"
+ rSet.Differentiate( aTmpSet );
+ */
+/*N*/ rSet.Put( aTmpSet );
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // aufnehmen als MergeWert (falls noch nicht gesetzt neu setzen!)
+/*N*/ #if 0
+ /* wenn mehrere Attribute ueberlappen werden diese gemergt !!
+ z.B
+ 1234567890123456789
+ |------------| Font1
+ |------| Font2
+ ^ ^
+ |--| Abfragebereich: -> uneindeutig
+ */
+/*N*/ else if( SFX_ITEM_DEFAULT == rSet.GetItemState( rAttr.Which(), FALSE ))
+/*N*/ rSet.Put( rAttr );
+/*N*/ else
+/*N*/ rSet.MergeValue( rAttr );
+/*N*/ #else
+ /* wenn mehrere Attribute ueberlappen gewinnt der letze !!
+ z.B
+ 1234567890123456789
+ |------------| Font1
+ |------| Font2
+ ^ ^
+ |--| Abfragebereich: -> Gueltig ist Font2
+ */
+/*N*/ rSet.Put( rAttr );
+/*N*/ #endif
+/*N*/ }
+
+// erfrage die Attribute vom TextNode ueber den Bereich
+/*N*/ BOOL SwTxtNode::GetAttr( SfxItemSet& rSet, xub_StrLen nStart, xub_StrLen nEnd,
+/*N*/ BOOL bOnlyTxtAttr, BOOL bGetFromChrFmt ) const
+/*N*/ {
+/*N*/ if( pSwpHints )
+/*N*/ {
+ /* stelle erstmal fest, welche Text-Attribut in dem Bereich gueltig
+ * sind. Dabei gibt es folgende Faelle:
+ * UnEindeutig wenn: (wenn != Format-Attribut)
+ * - das Attribut liegt vollstaendig im Bereich
+ * - das Attributende liegt im Bereich
+ * - der Attributanfang liegt im Bereich:
+ * Eindeutig (im Set mergen):
+ * - das Attrib umfasst den Bereich
+ * nichts tun:
+ * das Attribut liegt ausserhalb des Bereiches
+ */
+/*N*/
+/*N*/ void (*fnMergeAttr)( SfxItemSet&, const SfxPoolItem& )
+/*N*/ = bGetFromChrFmt ? &lcl_MergeAttr_ExpandChrFmt
+/*N*/ : &lcl_MergeAttr;
+/*N*/
+/*N*/ // dann besorge mal die Auto-(Fmt)Attribute
+/*N*/ SfxItemSet aFmtSet( *rSet.GetPool(), rSet.GetRanges() );
+/*N*/ if( !bOnlyTxtAttr )
+/*N*/ SwCntntNode::GetAttr( aFmtSet );
+/*N*/
+/*N*/ const USHORT nSize = pSwpHints->Count();
+/*N*/ register USHORT n;
+/*N*/ register xub_StrLen nAttrStart;
+/*N*/ register const xub_StrLen* pAttrEnd;
+/*N*/
+/*N*/ if( nStart == nEnd ) // kein Bereich:
+/*N*/ {
+/*N*/ for( n = 0; n < nSize; ++n ) //
+/*N*/ {
+/*N*/ const SwTxtAttr* pHt = (*pSwpHints)[n];
+/*N*/ nAttrStart = *pHt->GetStart();
+/*N*/ if( nAttrStart > nEnd ) // ueber den Bereich hinaus
+/*N*/ break;
+/*N*/
+/*N*/ if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende
+/*N*/ continue;
+/*N*/
+/*N*/ if( ( nAttrStart < nStart &&
+/*N*/ ( pHt->DontExpand() ? nStart < *pAttrEnd
+/*N*/ : nStart <= *pAttrEnd )) ||
+/*N*/ ( nStart == nAttrStart &&
+/*N*/ ( nAttrStart == *pAttrEnd || !nStart )))
+/*N*/ (*fnMergeAttr)( rSet, pHt->GetAttr() );
+/*N*/ }
+/*N*/ }
+/*N*/ else // es ist ein Bereich definiert
+/*N*/ {
+/*N*/ SwTxtAttr** aAttrArr = 0;
+/*N*/ const USHORT coArrSz = RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN +
+/*N*/ ( RES_UNKNOWNATR_END -
+/*N*/ RES_UNKNOWNATR_BEGIN );
+/*N*/
+/*N*/ for( n = 0; n < nSize; ++n )
+/*N*/ {
+/*N*/ const SwTxtAttr* pHt = (*pSwpHints)[n];
+/*N*/ nAttrStart = *pHt->GetStart();
+/*N*/ if( nAttrStart > nEnd ) // ueber den Bereich hinaus
+/*N*/ break;
+/*N*/
+/*N*/ if( 0 == ( pAttrEnd = pHt->GetEnd() )) // nie Attribute ohne Ende
+/*N*/ continue;
+/*N*/
+/*N*/ BOOL bChkInvalid = FALSE;
+/*N*/ if( nAttrStart <= nStart ) // vor oder genau Start
+/*N*/ {
+/*N*/ if( *pAttrEnd <= nStart ) // liegt davor
+/*N*/ continue;
+/*N*/
+/*N*/ if( nEnd <= *pAttrEnd ) // hinter oder genau Ende
+/*N*/ (*fnMergeAttr)( aFmtSet, pHt->GetAttr() );
+/*N*/ else
+/*N*/ // else if( pHt->GetAttr() != aFmtSet.Get( pHt->Which() ) )
+/*N*/ // uneindeutig
+/*N*/ bChkInvalid = TRUE;
+/*N*/ }
+/*N*/ else if( nAttrStart < nEnd // reicht in den Bereich
+/*N*/ )// && pHt->GetAttr() != aFmtSet.Get( pHt->Which() ) )
+/*N*/ bChkInvalid = TRUE;
+/*N*/
+/*N*/ if( bChkInvalid )
+/*N*/ {
+/*?*/ // uneindeutig ?
+/*?*/ if( !aAttrArr )
+/*?*/ {
+/*?*/ aAttrArr = new SwTxtAttr* [ coArrSz ];
+/*?*/ memset( aAttrArr, 0, sizeof( SwTxtAttr* ) * coArrSz );
+/*?*/ }
+/*?*/
+/*?*/ const SwTxtAttr** ppPrev;
+/*?*/ if( RES_CHRATR_BEGIN <= pHt->Which() &&
+/*?*/ pHt->Which() < RES_TXTATR_WITHEND_END )
+/*?*/ ppPrev = (const SwTxtAttr**)&aAttrArr[
+/*?*/ pHt->Which() - RES_CHRATR_BEGIN ];
+/*?*/ else if( RES_UNKNOWNATR_BEGIN <= pHt->Which() &&
+/*?*/ pHt->Which() < RES_UNKNOWNATR_END )
+/*?*/ ppPrev = (const SwTxtAttr**)&aAttrArr[
+/*?*/ pHt->Which() - RES_UNKNOWNATR_BEGIN
+/*?*/ + ( RES_TXTATR_WITHEND_END -
+/*?*/ RES_CHRATR_BEGIN ) ];
+/*?*/ else
+/*?*/ ppPrev = 0;
+/*?*/
+/*?*/ if( !*ppPrev )
+/*?*/ {
+/*?*/ if( nAttrStart > nStart )
+/*?*/ {
+/*?*/ rSet.InvalidateItem( pHt->Which() );
+/*?*/ *ppPrev = (SwTxtAttr*)-1;
+/*?*/ }
+/*?*/ else
+/*?*/ *ppPrev = pHt;
+/*?*/ }
+/*?*/ else if( (SwTxtAttr*)-1 != *ppPrev )
+/*?*/ {
+/*?*/ if( *(*ppPrev)->GetEnd() == nAttrStart &&
+/*?*/ (*ppPrev)->GetAttr() == pHt->GetAttr() )
+/*?*/ *ppPrev = pHt;
+/*?*/ else
+/*?*/ {
+/*?*/ rSet.InvalidateItem( pHt->Which() );
+/*?*/ *ppPrev = (SwTxtAttr*)-1;
+/*?*/ }
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( aAttrArr )
+/*N*/ {
+/*?*/ const SwTxtAttr* pAttr;
+/*?*/ for( n = 0; n < coArrSz; ++n )
+/*?*/ if( 0 != ( pAttr = aAttrArr[ n ] ) &&
+/*?*/ (SwTxtAttr*)-1 != pAttr )
+/*?*/ {
+/*?*/ USHORT nWh;
+/*?*/ if( n < (RES_TXTATR_WITHEND_END -
+/*?*/ RES_CHRATR_BEGIN ))
+/*?*/ nWh = n + RES_CHRATR_BEGIN;
+/*?*/ else
+/*?*/ nWh = n - ( RES_TXTATR_WITHEND_END -
+/*?*/ RES_CHRATR_BEGIN ) +
+/*?*/ RES_UNKNOWNATR_BEGIN;
+/*?*/
+/*?*/ if( nEnd <= *pAttr->GetEnd() ) // hinter oder genau Ende
+/*?*/ {
+/*?*/ if( pAttr->GetAttr() != aFmtSet.Get( nWh ) )
+/*?*/ (*fnMergeAttr)( rSet, pAttr->GetAttr() );
+/*?*/ }
+/*?*/ else
+/*?*/ // uneindeutig
+/*?*/ rSet.InvalidateItem( nWh );
+/*?*/ }
+/*?*/ delete [] aAttrArr;
+/*N*/ }
+/*N*/ }
+/*N*/ if( aFmtSet.Count() )
+/*N*/ {
+/*N*/ // aus dem Format-Set alle entfernen, die im TextSet auch gesetzt sind
+/*N*/ aFmtSet.Differentiate( rSet );
+/*N*/ // jetzt alle zusammen "mergen"
+/*N*/ rSet.Put( aFmtSet );
+/*N*/ }
+/*N*/ }
+/*N*/ else if( !bOnlyTxtAttr )
+/*N*/ // dann besorge mal die Auto-(Fmt)Attribute
+/*N*/ SwCntntNode::GetAttr( rSet );
+/*N*/
+/*N*/ return rSet.Count() ? TRUE : FALSE;
+/*N*/ }
+
+/*N*/ void SwTxtNode::FmtToTxtAttr( SwTxtNode* pNd )
+/*N*/ {
+/*N*/ SfxItemSet aThisSet( GetDoc()->GetAttrPool(), aCharFmtSetRange );
+/*N*/ if( GetpSwAttrSet() && GetpSwAttrSet()->Count() )
+/*?*/ aThisSet.Put( *GetpSwAttrSet() );
+/*N*/
+/*N*/ if ( !pSwpHints )
+/*N*/ pSwpHints = new SwpHints();
+/*N*/
+/*N*/ if( pNd == this )
+/*N*/ {
+/*?*/ if( aThisSet.Count() )
+/*?*/ {
+/*?*/ SfxItemIter aIter( aThisSet );
+/*?*/ const SfxPoolItem* pItem = aIter.GetCurItem();
+/*?*/ while( TRUE )
+/*?*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ if( lcl_IsNewAttrInSet( *pSwpHints, *pItem, GetTxt().Len() ) )
+/*?*/ }
+/*?*/ }
+/*N*/
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SfxItemSet aNdSet( pNd->GetDoc()->GetAttrPool(), aCharFmtSetRange );
+/*N*/ if( pNd->GetpSwAttrSet() && pNd->GetpSwAttrSet()->Count() )
+/*?*/ aNdSet.Put( *pNd->GetpSwAttrSet() );
+/*N*/
+/*N*/ if ( !pNd->pSwpHints )
+/*N*/ pNd->pSwpHints = new SwpHints();
+/*N*/
+/*N*/ if( aThisSet.Count() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SfxItemIter aIter( aThisSet );
+/*N*/ }
+/*N*/
+/*N*/ if( aNdSet.Count() )
+/*N*/ {
+/*?*/ SfxItemIter aIter( aNdSet );
+/*?*/ const SfxPoolItem* pItem = aIter.GetCurItem();
+/*?*/ while( TRUE )
+/*?*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ if( lcl_IsNewAttrInSet( *pNd->pSwpHints, *pItem, pNd->GetTxt().Len() ) )
+/*?*/ }
+/*?*/
+/*?*/ SwFmtChg aTmp1( pNd->GetFmtColl() );
+/*?*/ pNd->SwModify::Modify( &aTmp1, &aTmp1 );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pNd->pSwpHints->CanBeDeleted() )
+/*N*/ DELETEZ( pNd->pSwpHints );
+/*N*/ }
+
+/*************************************************************************
+ * SwpHints::CalcFlags()
+ *************************************************************************/
+
+/*N*/ void SwpHints::CalcFlags()
+/*N*/ {
+/*N*/ bDDEFlds = bFtn = FALSE;
+/*N*/ const USHORT nSize = Count();
+/*N*/ const SwTxtAttr* pAttr;
+/*N*/ for( USHORT nPos = 0; nPos < nSize; ++nPos )
+/*N*/ switch( ( pAttr = (*this)[ nPos ])->Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_FTN:
+/*N*/ bFtn = TRUE;
+/*N*/ if( bDDEFlds )
+/*N*/ return;
+/*N*/ break;
+/*N*/ case RES_TXTATR_FIELD:
+/*N*/ {
+/*N*/ const SwField* pFld = pAttr->GetFld().GetFld();
+/*N*/ if( RES_DDEFLD == pFld->GetTyp()->Which() )
+/*N*/ {
+/*N*/ bDDEFlds = TRUE;
+/*N*/ if( bFtn )
+/*N*/ return;
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwpHints::CalcVisibleFlag()
+ *************************************************************************/
+
+/*N*/ BOOL SwpHints::CalcVisibleFlag()
+/*N*/ {
+/*N*/ BOOL bOldVis = bVis;
+/*N*/ bCalcVis = FALSE;
+/*N*/ BOOL bNewVis = TRUE;
+/*N*/ const USHORT nSize = Count();
+/*N*/ const SwTxtAttr *pTxtHt;
+/*N*/
+/*N*/ for( USHORT nPos = 0; nPos < nSize; ++nPos )
+/*N*/ {
+/*N*/ pTxtHt = (*this)[ nPos ];
+/*N*/ const USHORT nWhich = pTxtHt->Which();
+/*N*/
+/*N*/ if( RES_TXTATR_FIELD == nWhich )
+/*N*/ {
+/*N*/ const SwFmtFld& rFld = pTxtHt->GetFld();
+/*N*/ if( RES_HIDDENPARAFLD == rFld.GetFld()->GetTyp()->Which())
+/*N*/ {
+/*N*/ if( !((SwHiddenParaField*)rFld.GetFld())->IsHidden() )
+/*N*/ {
+/*N*/ SetVisible(TRUE);
+/*N*/ return !bOldVis;
+/*N*/ }
+/*N*/ else
+/*N*/ bNewVis = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ SetVisible( bNewVis );
+/*N*/ return bOldVis != bNewVis;
+/*N*/ }
+
+/*************************************************************************
+ * SwpHints::Resort()
+ *************************************************************************/
+
+// Ein Hint hat seinen Anfangswert geaendert.
+// Hat sich dadurch die Sortierreihenfolge
+// geaendert, so wird solange umsortiert, bis
+// sie wieder stimmt.
+
+/*N*/ BOOL SwpHints::Resort( const USHORT nPos )
+/*N*/ {
+/*N*/ const SwTxtAttr *pTmp;
+/*N*/
+/*N*/ if ( ( nPos+1 < Count() &&
+/*N*/ *(*this)[nPos]->GetStart() > *(*this)[nPos+1]->GetStart() ) ||
+/*N*/ ( nPos > 0 &&
+/*N*/ *(*this)[nPos]->GetStart() < *(*this)[nPos-1]->GetStart() ) )
+/*N*/ {
+/*?*/ pTmp = (*this)[nPos];
+/*?*/ DeleteAtPos( nPos );
+/*?*/ SwpHintsArr::Insert( pTmp );
+/*?*/ // Wenn tatsaechlich umsortiert wurde, muss die
+/*?*/ // Position i nochmal bearbeitet werden.
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+ * SwpHints::ClearDummies()
+ *************************************************************************/
+
+/*
+ * ClearDummies: Hints, die genau den gleichen Bereich umfassen wie
+ * ein nachfolgender mit gleichem Attribut oder eine nachfolgende Zeichen-
+ * vorlage, muessen entfernt werden.
+ * Solche Hints entstehen, wenn sie urspruenglich einen groesseren, den
+ * Nachfolger umfassenden Bereich hatten, die Aussenanteile aber durch
+ * SwTxtNode::RstAttr oder SwTxtNode::Update geloescht wurden.
+ */
+
+/*N*/ void SwpHints::ClearDummies( SwTxtNode &rNode )
+/*N*/ {
+/*N*/ USHORT i = 0;
+/*N*/ while ( i < Count() )
+/*N*/ {
+/*N*/ SwTxtAttr *pHt = GetHt( i++ );
+/*N*/ const USHORT nWhich = pHt->Which();
+/*N*/ const xub_StrLen *pEnd = pHt->GetEnd();
+/*N*/ if ( pEnd && !pHt->IsOverlapAllowedAttr() && !pHt->IsCharFmtAttr() )
+/*N*/ for( USHORT j = i; j < Count(); ++j )
+/*N*/ {
+/*N*/ SwTxtAttr *pOther = GetHt(j);
+/*N*/ if ( *pOther->GetStart() > *pHt->GetStart() )
+/*N*/ break;
+/*N*/
+/*N*/ if( pOther->Which() == nWhich || pOther->IsCharFmtAttr() )
+/*N*/ {
+/*N*/ //JP 03.10.95: nicht zusammenfassen, zu kompliziert
+/*N*/ // fuer WIN95-Compiler!!
+/*?*/ if( *pEnd == *pOther->GetEnd() &&
+/*?*/ ( pOther->Which() == nWhich ||
+/*?*/ lcl_Included( nWhich, pOther ) ) )
+/*?*/ {
+/*?*/ rNode.DestroyAttr( Cut( --i ) );
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+ * SwpHints::Merge( )
+ *************************************************************************/
+
+/*
+ * Merge: Gleichartigen, gleichwertige Hints, die aneinandergrenzen,
+ * koennen verschmolzen werden, wenn an ihrer gemeinsamen Kante nicht ein
+ * gleichartiges Attribut endet oder beginnt, welches einen von der beiden
+ * Kandidaten umfasst, auch Zeichenvorlage duerfen nicht ueberlappt werden.
+ */
+/*-----------------5.9.2001 09:26-------------------
+ * And here a smarter version of good old Merge(..)
+ * If a SwTxtAttr is given, only the merging between this attribute and the
+ * neighbours are checked. This saves time, if no attribute is given (in more
+ * complex situations), the whole attribute array is checked as before.
+ * --------------------------------------------------*/
+
+/*N*/ BOOL SwpHints::Merge( SwTxtNode &rNode, SwTxtAttr* pAttr )
+/*N*/ {
+/*N*/ USHORT i;
+/*N*/ BOOL bMerged = FALSE;
+/*N*/ if( pAttr && USHRT_MAX != ( i = GetPos( pAttr ) ) )
+/*N*/ {
+/*N*/ const xub_StrLen *pEnd = pAttr->GetEnd();
+/*N*/ if ( pEnd && !pAttr->IsDontMergeAttr() )
+/*N*/ {
+/*N*/ USHORT j = i;
+/*N*/ const USHORT nWhich = pAttr->Which();
+/*N*/ const USHORT nStart = *pAttr->GetStart();
+/*N*/ const USHORT nEnd = *pEnd;
+/*N*/ SwTxtAttr *pPrev;
+/*N*/ SwTxtAttr *pNext;
+/*N*/ USHORT nEndIdx = aHtEnd.C40_GETPOS( SwTxtAttr, pAttr );
+/*N*/ ASSERT( USHRT_MAX != nEndIdx, "Missing end index" );
+/*N*/ if( nEndIdx )
+/*N*/ {
+/*N*/ // If there's a attribute with same start and which-id,
+/*N*/ // it's not possible to merge with a previous attribute.
+/*N*/ pPrev = pAttr;
+/*N*/ while( j )
+/*N*/ {
+/*N*/ SwTxtAttr *pOther = GetHt(--j);
+/*N*/ if ( *pOther->GetStart() < nStart )
+/*N*/ break;
+/*N*/ if( pOther->Which() == nWhich || pOther->IsCharFmtAttr()
+/*N*/ || pAttr->IsCharFmtAttr() )
+/*N*/ {
+/*N*/ pPrev = NULL;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pPrev = NULL;
+/*N*/ if( i + 1 < Count() )
+/*N*/ {
+/*N*/ // If there's a attribute with same end and which-id,
+/*N*/ // it's not possible to merge with a following attribute.
+/*N*/ j = nEndIdx + 1;
+/*N*/ pNext = pAttr;
+/*N*/ while( j < Count() )
+/*N*/ {
+/*N*/ SwTxtAttr *pOther = GetEnd( j++ );
+/*N*/ if( !pOther->GetEnd() )
+/*N*/ continue;
+/*N*/ if( *pOther->GetEnd() > nEnd )
+/*N*/ break;
+/*N*/ if( pOther->Which() == nWhich || pOther->IsCharFmtAttr()
+/*N*/ || pAttr->IsCharFmtAttr() )
+/*N*/ {
+/*N*/ pNext = NULL;
+/*N*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ pNext = NULL;
+/*N*/ if( pPrev )
+/*N*/ {
+/*N*/ pPrev = NULL;
+/*N*/ j = nEndIdx;
+/*N*/ do
+/*N*/ {
+/*N*/ // Looking for a previous attribute with the same which-id
+/*N*/ // which ends exact at the start of the given attribute
+/*N*/ SwTxtAttr *pOther = GetEnd( --j );
+/*N*/ pEnd = pOther->GetEnd();
+/*N*/ if( !pEnd || *pEnd > nStart )
+/*N*/ continue;
+/*N*/ if( *pEnd < nStart )
+/*N*/ break;
+/*N*/ if( pOther->Which() == nWhich )
+/*N*/ {
+/*N*/ if( pOther->GetAttr() == pAttr->GetAttr() )
+/*N*/ {
+/*N*/ bMerged = TRUE;
+/*N*/ pPrev = pOther;
+/*N*/ }
+/*N*/ else
+/*N*/ pPrev = NULL;
+/*N*/ break;
+/*N*/ }
+/*N*/ if( pOther->IsCharFmtAttr() || pAttr->IsCharFmtAttr() )
+/*N*/ {
+/*N*/ pPrev = NULL;
+/*N*/ break;
+/*N*/ }
+/*N*/ } while ( j );
+/*N*/ }
+/*N*/ if( pNext )
+/*N*/ {
+/*N*/ j = i + 1;
+/*N*/ pNext = NULL;
+/*N*/ while( j < Count() )
+/*N*/ {
+/*N*/ // Looking for a following attribute with the same which-id
+/*N*/ // which starts at the end of the given attribute
+/*N*/ SwTxtAttr *pOther = GetStart( j++ );
+/*N*/ pEnd = pOther->GetEnd();
+/*N*/ if( !pEnd || *pOther->GetStart() < nEnd )
+/*N*/ continue;
+/*N*/ if( *pOther->GetStart() > nEnd )
+/*N*/ break;
+/*N*/ if( pOther->Which() == nWhich )
+/*N*/ {
+/*N*/ if( pOther->GetAttr() == pAttr->GetAttr() )
+/*N*/ {
+/*N*/ bMerged = TRUE;
+/*N*/ pNext = pOther;
+/*N*/ }
+/*N*/ else
+/*N*/ pNext = NULL;
+/*N*/ break;
+/*N*/ }
+/*?*/ if( pOther->IsCharFmtAttr() || pAttr->IsCharFmtAttr() )
+/*?*/ {
+/*?*/ pNext = NULL;
+/*?*/ break;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( bMerged )
+/*N*/ {
+/*N*/ if( pNext )
+/*N*/ {
+/*N*/ if ( pPrev == pNext )
+/*N*/ pPrev = NULL;
+/*N*/
+/*?*/ *pAttr->GetEnd() = *pNext->GetEnd();
+/*?*/ pAttr->SetDontExpand( FALSE );
+/*?*/ rNode.DestroyAttr( Cut( j - 1 ) );
+/*N*/ }
+/*N*/ if( pPrev )
+/*N*/ {
+/*N*/ *pPrev->GetEnd() = *pAttr->GetEnd();
+/*N*/ pPrev->SetDontExpand( FALSE );
+/*N*/ rNode.DestroyAttr( Cut( i ) );
+/*N*/ }
+/*N*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ i = 0;
+/*N*/ while ( i < Count() )
+/*N*/ {
+/*N*/ SwTxtAttr *pHt = GetHt( i++ );
+/*N*/ const xub_StrLen *pEnd = pHt->GetEnd();
+/*N*/ if ( pEnd && !pHt->IsDontMergeAttr() )
+/*N*/ {
+/*N*/ const USHORT nWhich = pHt->Which();
+/*N*/ for ( USHORT j = i; j < Count(); j++ )
+/*N*/ {
+/*N*/ SwTxtAttr *pOther = GetHt(j);
+/*N*/ if ( *pOther->GetStart() > *pEnd )
+/*N*/ break; // keine beruehrenden Attribute mehr vorhanden
+/*N*/
+/*N*/ if( *pOther->GetStart() == *pEnd &&
+/*N*/ ( pOther->Which() == nWhich ||
+/*N*/ pOther->IsCharFmtAttr() ||
+/*N*/ ( pHt->IsCharFmtAttr() && !pHt->IsDontMergeAttr() )))
+/*N*/ {
+/*?*/ // Beruehrendes Attribut gefunden mit gleichem Typ bzw.
+/*?*/ // Zeichenvorlage.
+/*?*/ // Bei Attribut mit anderem Wert bzw. Zeichenvorlage
+/*?*/ // ist keine Verschmelzung mehr moeglich
+/*?*/ if( pOther->Which() == nWhich &&
+/*?*/ pOther->GetAttr() == pHt->GetAttr() )
+/*?*/ {
+/*?*/ // Unser Partner pOther erfuellt alle Voraussetzungen,
+/*?*/ // jetzt muessen wir uns selbst noch ueberpruefen, ob wir
+/*?*/ // nicht von einem gleichartigen Attribut oder einer
+/*?*/ // Zeichenvorlage umfasst werden, die das gleiche Ende
+/*?*/ // wie wir selbst haben.
+/*?*/ BOOL bMerge = TRUE;
+/*?*/ for ( USHORT k = 0; k+1 < i; k++ )
+/*?*/ {
+/*?*/ SwTxtAttr *pAnOther = GetHt(k);
+/*?*/ if( ( pAnOther->Which() == nWhich ||
+/*?*/ pAnOther->IsCharFmtAttr() ||
+/*?*/ pHt->IsCharFmtAttr() )
+/*?*/ && pAnOther->GetEnd()
+/*?*/ && *pAnOther->GetEnd() == *pEnd )
+/*?*/ {
+/*?*/ bMerge = FALSE; // kein Verschmelzen von i+j
+/*?*/ break;
+/*?*/ }
+/*?*/ }
+/*?*/ if ( bMerge )
+/*?*/ {
+/*?*/ *pHt->GetEnd() = *pOther->GetEnd();
+/*?*/ pHt->SetDontExpand( FALSE );
+/*?*/ rNode.DestroyAttr( Cut( j ) );
+/*?*/ --i;
+/*?*/ bMerged = TRUE;
+/*?*/ }
+/*?*/ }
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( bMerged )
+/*?*/ ClearDummies( rNode );
+/*N*/ return bMerged;
+/*N*/ }
+
+/*************************************************************************
+ * SwpHints::Forget( ... )
+ *************************************************************************/
+
+/*
+ * Forget: Hints, die genau den gleichen Bereich umfassen wie
+ * ein nachfolgender mit gleichem Attribut oder eine nachfolgende Zeichen-
+ * vorlage, duerfen nicht eingefuegt werden.
+ * Solche Hints koennen entstehen, wenn durch SwTxtNode::RstAttr
+ * ein Attribut in zwei Teile zerlegt wird und der zweite Teil einen
+ * identischen Bereich mit einem inneren Attribut bekaeme.
+ */
+
+/*************************************************************************
+ * SwpHints::Insert()
+ *************************************************************************/
+
+/*
+ * Insert: Der neue Hint wird immer eingefuegt. Wenn dabei ein
+ * ueberlappender oder gleicher Hintbereich mit gleichem Attribut
+ * und Wert gefunden, wird der neue Hint entsprechend veraendert
+ * und der alte herausgenommen (und zerstoert:
+ * SwpHints::Destroy()).
+ */
+
+/*N*/ void SwpHints::Insert( SwTxtAttr *pHint, SwTxtNode &rNode, USHORT nMode )
+/*N*/ {
+/*N*/ // Irgendwann ist immer Schluss
+/*N*/ if( USHRT_MAX == Count() )
+/*N*/ return;
+/*N*/
+/*N*/ // Felder bilden eine Ausnahme:
+/*N*/ // 1) Sie koennen nie ueberlappen
+/*N*/ // 2) Wenn zwei Felder genau aneinander liegen,
+/*N*/ // sollen sie nicht zu einem verschmolzen werden.
+/*N*/ // Wir koennen also auf die while-Schleife verzichten
+/*N*/
+/*N*/ xub_StrLen *pHtEnd = pHint->GetEnd();
+/*N*/ USHORT nWhich = pHint->Which();
+/*N*/
+/*N*/ switch( nWhich )
+/*N*/ {
+/*N*/ case RES_TXTATR_CHARFMT:
+/*N*/ ((SwTxtCharFmt*)pHint)->ChgTxtNode( &rNode );
+/*N*/ break;
+/*N*/ case RES_TXTATR_INETFMT:
+/*N*/ {
+/*N*/ ((SwTxtINetFmt*)pHint)->ChgTxtNode( &rNode );
+/*N*/ SwCharFmt* pFmt = rNode.GetDoc()->GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL );
+/*N*/ pFmt->Add( (SwTxtINetFmt*)pHint );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_TXTATR_FIELD:
+/*N*/ {
+/*N*/ BOOL bDelFirst = 0 != ((SwTxtFld*)pHint)->GetpTxtNode();
+/*N*/ ((SwTxtFld*)pHint)->ChgTxtNode( &rNode );
+/*N*/ SwDoc* pDoc = rNode.GetDoc();
+/*N*/ const SwField* pFld = ((SwTxtFld*)pHint)->GetFld().GetFld();
+/*N*/
+/*N*/ if( !pDoc->IsNewFldLst() )
+/*N*/ {
+/*N*/ // was fuer ein Feld ist es denn ??
+/*N*/ // bestimmte Felder mussen am Doc das Calculations-Flag updaten
+/*N*/ switch( pFld->GetTyp()->Which() )
+/*N*/ {
+/*N*/ case RES_DBFLD:
+/*N*/ case RES_SETEXPFLD:
+/*N*/ case RES_HIDDENPARAFLD:
+/*N*/ case RES_HIDDENTXTFLD:
+/*N*/ case RES_DBNUMSETFLD:
+/*N*/ case RES_DBNEXTSETFLD:
+/*N*/ {
+/*N*/ if( bDelFirst )
+/*?*/ pDoc->InsDelFldInFldLst( FALSE, *(SwTxtFld*)pHint );
+/*N*/ if( rNode.GetNodes().IsDocNodes() )
+/*N*/ pDoc->InsDelFldInFldLst( TRUE, *(SwTxtFld*)pHint );
+/*N*/ }
+/*N*/ break;
+/*?*/ case RES_DDEFLD:
+/*?*/ if( rNode.GetNodes().IsDocNodes() )
+/*?*/ ((SwDDEFieldType*)pFld->GetTyp())->IncRefCnt();
+/*?*/ break;
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ // gehts ins normale Nodes-Array?
+/*N*/ if( rNode.GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ BOOL bInsFldType = FALSE;
+/*N*/ switch( pFld->GetTyp()->Which() )
+/*N*/ {
+/*N*/ case RES_SETEXPFLD:
+/*N*/ bInsFldType = ((SwSetExpFieldType*)pFld->GetTyp())->IsDeleted();
+/*N*/ if( GSE_SEQ & ((SwSetExpFieldType*)pFld->GetTyp())->GetType() )
+/*N*/ {
+/*N*/ // bevor die ReferenzNummer gesetzt wird, sollte
+/*N*/ // das Feld am richtigen FeldTypen haengen!
+/*N*/ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)
+/*N*/ pDoc->InsertFldType( *pFld->GetTyp() );
+/*N*/ if( pFldType != pFld->GetTyp() )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwFmtFld* pFmtFld = (SwFmtFld*)&((SwTxtFld*)pHint)
+/*N*/ }
+/*N*/ pFldType->SetSeqRefNo( *(SwSetExpField*)pFld );
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_USERFLD:
+/*N*/ bInsFldType = ((SwUserFieldType*)pFld->GetTyp())->IsDeleted();
+/*N*/ break;
+/*N*/
+/*N*/ case RES_DDEFLD:
+/*N*/ if( pDoc->IsNewFldLst() )
+/*N*/ ((SwDDEFieldType*)pFld->GetTyp())->IncRefCnt();
+/*N*/ bInsFldType = ((SwDDEFieldType*)pFld->GetTyp())->IsDeleted();
+/*N*/ break;
+/*N*/ }
+/*N*/ if( bInsFldType )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 pDoc->InsDeletedFldType( *pFld->GetTyp() );
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_TXTATR_FTN :
+/*N*/ ((SwTxtFtn*)pHint)->ChgTxtNode( &rNode );
+/*N*/ break;
+/*N*/ case RES_TXTATR_REFMARK:
+/*N*/ ((SwTxtRefMark*)pHint)->ChgTxtNode( &rNode );
+/*N*/ if( rNode.GetNodes().IsDocNodes() )
+/*N*/ {
+/*N*/ //search for a refernce with the same name
+/*N*/ SwTxtAttr* pHt;
+ // redefinition of *pHtEnd shadows declaration at top of method
+ // usage within if stmt does NOT match usage above, also used again below switch/case...
+/*N*/ xub_StrLen *pHtEnd, *pHintEnd;
+/*N*/ for( USHORT n = 0, nEnd = Count(); n < nEnd; ++n )
+/*N*/ if( RES_TXTATR_REFMARK == (pHt = GetHt( n ))->Which() &&
+/*N*/ pHint->GetAttr() == pHt->GetAttr() &&
+/*N*/ 0 != ( pHtEnd = pHt->GetEnd() ) &&
+/*N*/ 0 != ( pHintEnd = pHint->GetEnd() ) )
+/*N*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 SwComparePosition eCmp = ::ComparePosition(
+/*N*/ }
+/*N*/ }
+/*N*/ break;
+/*N*/ case RES_TXTATR_TOXMARK:
+/*N*/ ((SwTxtTOXMark*)pHint)->ChgTxtNode( &rNode );
+/*N*/ break;
+/*N*/
+/*N*/ case RES_TXTATR_CJK_RUBY:
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ ((SwTxtRuby*)pHint)->ChgTxtNode( &rNode );
+/*N*/ }
+/*N*/ break;
+/*N*/ }
+/*N*/
+/*N*/ if( SETATTR_DONTEXPAND & nMode )
+/*N*/ pHint->SetDontExpand( TRUE );
+/*N*/
+/*N*/ // SwTxtAttrs ohne Ende werden sonderbehandelt:
+/*N*/ // Sie werden natuerlich in das Array insertet, aber sie werden nicht
+/*N*/ // in die pPrev/Next/On/Off-Verkettung aufgenommen.
+/*N*/ // Der Formatierer erkennt diese TxtHints an dem CH_TXTATR_.. im Text !
+/*N*/ xub_StrLen nHtStart = *pHint->GetStart();
+/*N*/ if( !pHtEnd )
+/*N*/ {
+/*N*/ SwpHintsArr::Insert( pHint );
+/*N*/ CalcFlags();
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( !rNode.GetDoc()->IsInReading() )
+/*N*/ CHECK;
+/*N*/ #endif
+/*N*/ // ... und die Abhaengigen benachrichtigen
+/*N*/ if ( rNode.GetDepends() )
+/*N*/ {
+/*N*/ SwUpdateAttr aHint( nHtStart, nHtStart, nWhich );
+/*N*/ rNode.Modify( 0, &aHint );
+/*N*/ }
+/*N*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // ----------------------------------------------------------------
+/*N*/ // Ab hier gibt es nur noch pHint mit einem EndIdx !!!
+/*N*/
+/*N*/ SwTxtAttr *pMerge = pHint; // For a smarter Merge-function
+/*N*/
+/*N*/ BOOL bResort = FALSE;
+/*N*/
+/*N*/ if( *pHtEnd < nHtStart )
+/*N*/ {
+/*?*/ ASSERT( *pHtEnd >= nHtStart,
+/*?*/ "+SwpHints::Insert: invalid hint, end < start" );
+/*?*/
+/*?*/ // Wir drehen den Quatsch einfach um:
+/*?*/ *pHint->GetStart() = *pHtEnd;
+/*?*/ *pHtEnd = nHtStart;
+/*?*/ nHtStart = *pHint->GetStart();
+/*N*/ }
+/*N*/
+/*N*/ // AMA: Damit wir endlich mit ueberlappenden Hints fertig werden ...
+/*N*/ // das neue Verfahren:
+/*N*/
+/*N*/ if( !(SETATTR_NOHINTADJUST & nMode) && !pHint->IsOverlapAllowedAttr() )
+/*N*/ {
+/*N*/ const SfxPoolItem* pParaItem;
+/*N*/ xub_StrLen nMaxEnd = *pHtEnd;
+/*N*/ xub_StrLen nHtEnd = *pHtEnd;
+/*N*/ BOOL bParaAttr = rNode.GetpSwAttrSet() &&
+/*N*/ ( SFX_ITEM_SET == rNode.GetpSwAttrSet()->GetItemState( nWhich,
+/*N*/ FALSE, &pParaItem ) ) && ( pParaItem == &pHint->GetAttr() );
+/*N*/ BOOL bReplace = !( SETATTR_DONTREPLACE & nMode );
+/*N*/ ::binfilter::SwpHtStart_SAR *pTmpHints = 0;
+/*N*/
+/*N*/ USHORT i;
+/*N*/ // Wir wollen zwar von nHtStart bis nMaxEnd, muessen aber ggf.
+/*N*/ // stueckeln (Attribute duerfen keine Zeichenvorlagen ueberlappen).
+/*N*/ // Das erste Stueck wird also von nHtStart bis zum ersten Start/Ende
+/*N*/ // einer Zeichenvorlage gehen usw. bis nHtEnd = nMaxEnd erreicht ist.
+/*N*/ do {
+/*N*/ BOOL bINet = nWhich == RES_TXTATR_INETFMT;
+/*N*/ BOOL bForgetAttr = bParaAttr;
+/*N*/ // Muessen wir uns aufspalten?
+/*N*/ if ( !bINet && !pHint->IsDontMergeAttr() )
+/*N*/ {
+/*N*/ // Ab der zweiten Runde muessen wir zunaechst einen neuen
+/*N*/ // Hint erzeugen.
+/*N*/ if ( nHtEnd != nMaxEnd )
+/*N*/ {
+/*?*/ pMerge = NULL; // No way to use the smarter Merge()
+/*?*/ pHint = rNode.MakeTxtAttr( bParaAttr ? *pParaItem :
+/*?*/ pHint->GetAttr(),
+/*?*/ nHtStart, nMaxEnd );
+/*?*/ nHtEnd = *pHint->GetEnd();
+/*N*/ }
+/*N*/
+/*N*/ for ( i = 0; i < Count(); i++)
+/*N*/ {
+/*N*/ SwTxtAttr *pOther = GetHt(i);
+/*N*/ // Wir suchen nach Zeichenvorlagen, die uns schneiden
+/*N*/ // oder in uns liegen
+/*N*/ BOOL bOtherFmt = pOther->IsCharFmtAttr();
+/*N*/ if( bOtherFmt ||
+/*N*/ ( RES_TXTATR_CHARFMT == nWhich && pOther->GetEnd() ) )
+/*N*/ {
+/*N*/ if( bForgetAttr && bOtherFmt &&
+/*N*/ *pOther->GetStart() <= nHtStart &&
+/*N*/ *pOther->GetEnd() >= nHtStart )
+/*N*/ bForgetAttr = FALSE;
+ /* Die Flags bCheckInclude und bOtherFmt sollen die
+ * Anzahl der Aufrufe von lcl_Include minimieren, da
+ * dieses wg. IsVisitedURL() teuer ist. */
+/*N*/ BOOL bCheckInclude = FALSE;
+/*N*/ if( *pOther->GetStart() > nHtStart
+/*N*/ && *pOther->GetStart() < nHtEnd
+/*N*/ && ( bReplace || *pOther->GetEnd() > nHtEnd ) )
+/*N*/ {
+/*?*/ if( !bOtherFmt )
+/*?*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ bOtherFmt = !lcl_Included( pOther->Which(),
+/*?*/ }
+/*?*/ if( bOtherFmt )
+/*?*/ nHtEnd = *pOther->GetStart();
+/*N*/ }
+/*N*/ if( *pOther->GetEnd() > nHtStart
+/*N*/ && *pOther->GetEnd() < nHtEnd
+/*N*/ && ( bReplace || *pOther->GetStart() < nHtStart ) )
+/*N*/ {
+/*?*/ if( bOtherFmt || ( !bCheckInclude &&
+/*?*/ !lcl_Included( pOther->Which(), pHint ) ) )
+/*?*/ nHtEnd = *pOther->GetEnd();
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ *pHint->GetEnd() = nHtEnd;
+/*N*/ }
+/*N*/
+/*N*/ i = 0;
+/*N*/ while(i < Count())
+/*N*/ {
+/*N*/ SwTxtAttr *pOther = GetHt(i);
+/*N*/ const USHORT nOtherWhich = pOther->Which();
+/*N*/ BOOL bCheckInclude = pHint->IsCharFmtAttr() &&
+/*N*/ pOther->IsCharFmtAttr() &&
+/*N*/ nWhich != nOtherWhich;
+/*N*/
+/*N*/ BOOL bOtherCharFmt = RES_TXTATR_CHARFMT == nOtherWhich;
+/*N*/ if( nOtherWhich == nWhich || bCheckInclude )
+/*N*/ {
+/*N*/ if(0 == pOther->GetEnd())
+/*N*/ {
+/*?*/ if( *pOther->GetStart() == nHtStart &&
+/*?*/ nOtherWhich == nWhich &&
+/*?*/ pOther->GetAttr() == pHint->GetAttr() )
+/*?*/ {
+/*?*/ // Gibts schon, alten raus.
+/*?*/ rNode.DestroyAttr( Cut(i) );
+/*?*/ }
+/*?*/ else
+/*?*/ ++i;
+/*?*/ continue;
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ // Attribute mit Anfang und Ende.
+/*N*/ const Range aHintRg( nHtStart, nHtEnd );
+/*N*/ const Range aOtherRg( *pOther->GetStart(),
+/*N*/ *pOther->GetEnd() );
+/*N*/
+/*N*/ if( aOtherRg.IsInside( aHintRg.Min() ) ||
+/*N*/ aHintRg.IsInside( aOtherRg.Min() ) )
+/*N*/ {
+/*N*/ // aBig umspannt beide Ranges
+/*N*/ const Range aBig(
+/*N*/ Min( aHintRg.Min(), aOtherRg.Min()),
+/*N*/ Max( aHintRg.Max(), aOtherRg.Max()));
+/*N*/
+/*N*/ // Gleiches Attribut
+/*N*/ // oder Zeichenvorlage:
+/*N*/ // Bereiche duerfen nicht ueberlappen.
+/*N*/
+/*N*/ // Zuerst wurde geprueft, ob sich der neue mit dem
+/*N*/ // alten ueberschneidet, danach gibt es nur noch
+/*N*/ // drei Faelle zu beachten:
+/*N*/ // 1) der neue umschliesst den alten
+/*N*/ // 2) der neue ueberlappt den alten hinten
+/*N*/ // 3) der neue ueberlappt den alten vorne
+/*N*/
+/*N*/ BOOL bNoINet = RES_TXTATR_INETFMT != nOtherWhich ||
+/*N*/ nWhich == nOtherWhich;
+/*N*/
+/*N*/ // 1) der neue umschliesst den alten
+/*N*/ if( aBig == aHintRg )
+/*N*/ {
+/*N*/ BOOL bTmpReplace = bReplace ||
+/*N*/ ( aHintRg == aOtherRg &&
+/*N*/ nWhich == nOtherWhich &&
+/*N*/ !pHint->IsCharFmtAttr() );
+/*N*/ if( bNoINet && bTmpReplace &&
+/*N*/ ( !bOtherCharFmt || nWhich == nOtherWhich ) )
+/*N*/ {
+/*N*/ if( !bCheckInclude ||
+/*N*/ lcl_Included( nOtherWhich, pHint ) )
+/*N*/ {
+/*N*/ rNode.DestroyAttr( Cut(i) );
+/*N*/ }
+/*N*/ else
+/*N*/ ++i;
+/*N*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ else if( !bReplace && aBig == aOtherRg )
+/*?*/ bForgetAttr = FALSE;
+/*N*/ // 2) der neue ueberlappt hinten
+/*N*/ else if( aBig.Max() == aHintRg.Max() )
+/*N*/ {
+/*N*/ if( bNoINet &&
+/*N*/ ( !bOtherCharFmt || RES_TXTATR_CHARFMT != nWhich ) &&
+/*N*/ ( bReplace || aHintRg.Max() != aOtherRg.Max() ) )
+/*N*/ {
+/*N*/ if( ( bCheckInclude &&
+/*N*/ lcl_Included( nOtherWhich, pHint ) ) ||
+/*N*/ ( !bCheckInclude && !bOtherCharFmt ) )
+/*N*/ {
+/*N*/ if( nMaxEnd == nHtStart )
+/*N*/ bForgetAttr = FALSE;
+/*N*/ *pOther->GetEnd() = nHtStart;
+/*N*/ bResort = TRUE;
+/*N*/ // ChainDelEnd( pOther );
+/*N*/ // ChainEnds( pOther );
+/*N*/ }
+/*N*/ else if( bINet &&
+/*N*/ aHintRg.Max() != aOtherRg.Max() &&
+/*N*/ aHintRg.Min() < aOtherRg.Max() )
+/*N*/ {
+/*N*/ // Wenn ein INetFmt eingefuegt wird, muss
+/*N*/ // sich ein anderes Attribut ggf. aufspal-
+/*N*/ // ten. Es wird beiseite gestellt und in
+/*N*/ // einem spaeteren Durchgang eingefuegt.
+/*N*/ // Beim Einfuegen spaltet es sich selbst.
+/*?*/ if( !pTmpHints )
+/*?*/ pTmpHints = new ::binfilter::SwpHtStart_SAR();
+/*?*/ pTmpHints->C40_INSERT( SwTxtAttr, pOther,
+/*?*/ pTmpHints->Count() );
+/*?*/ Cut( i );
+/*?*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ // 3) der neue ueberlappt vorne
+/*N*/ else if( aBig.Min() == aHintRg.Min() )
+/*N*/ {
+/*N*/ if( bNoINet &&
+/*N*/ ( RES_TXTATR_CHARFMT != nOtherWhich ||
+/*N*/ RES_TXTATR_CHARFMT != nWhich ) &&
+/*N*/ ( bReplace || aHintRg.Min() != aOtherRg.Min() ) )
+/*N*/ {
+/*N*/ if( ( bCheckInclude &&
+/*N*/ lcl_Included( nOtherWhich, pHint ) ) ||
+/*N*/ ( !bCheckInclude && !bOtherCharFmt ) )
+/*N*/ {
+/*N*/
+/*N*/ *pOther->GetStart() = nHtEnd;
+/*N*/
+/*N*/ // ChainDelStart( pOther );
+/*N*/ // ChainStarts( pOther );
+/*N*/
+/*N*/ const BOOL bOk = Resort(i);
+/*N*/ if( bOk )
+/*N*/ continue;
+/*N*/ }
+/*N*/ else if( bINet &&
+/*N*/ aHintRg.Min() != aOtherRg.Min() &&
+/*N*/ aHintRg.Max() > aOtherRg.Min() )
+/*N*/ {
+/*?*/ // Wenn ein INetFmt eingefuegt wird, muss
+/*?*/ // sich ein anderes Attribut ggf. aufspal-
+/*?*/ // ten. Es wird beiseite gestellt und in
+/*?*/ // einem spaeteren Durchgang eingefuegt.
+/*?*/ // Beim Einfuegen spaltet es sich selbst.
+/*?*/ if( !pTmpHints )
+/*?*/ pTmpHints = new ::binfilter::SwpHtStart_SAR();
+/*?*/ pTmpHints->C40_INSERT( SwTxtAttr, pOther,
+/*?*/ pTmpHints->Count() );
+/*?*/ Cut( i );
+/*?*/ continue;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bForgetAttr = FALSE;
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ ++i;
+/*N*/ }
+/*N*/
+/*N*/ ClearDummies( rNode );
+/*N*/ // Nur wenn wir nicht sowieso schon durch die Absatzattribute
+/*N*/ // gueltig sind, werden wir eingefuegt ...
+/*N*/ if( bForgetAttr )
+/*N*/ {
+/*?*/ rNode.DestroyAttr( pHint );
+/*?*/ pMerge = NULL; // No smart Merge()
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwpHintsArr::Insert( pHint );
+/*N*/ bResort = FALSE;
+/*N*/ }
+/*N*/ // InsertChain( pHint );
+/*N*/
+/*N*/ // ... und die Abhaengigen benachrichtigen
+/*N*/ if ( rNode.GetDepends() )
+/*N*/ {
+/*N*/ SwUpdateAttr aHint( nHtStart, nHtEnd, nWhich );
+/*N*/ rNode.Modify( 0, &aHint );
+/*N*/ }
+/*N*/ // Falls es noch 'ne Runde gibt:
+/*N*/ nHtStart = nHtEnd;
+/*N*/ if( nMaxEnd > nHtEnd )
+/*N*/ continue;
+/*N*/ if( !pTmpHints )
+/*N*/ break;
+/*?*/ pMerge = NULL; // No smart Merge()
+/*?*/ pHint = pTmpHints->GetObject(0);
+/*?*/ nWhich = pHint->Which();
+/*?*/ nHtStart = *pHint->GetStart();
+/*?*/ nHtEnd = *pHint->GetEnd();
+/*?*/ nMaxEnd = nHtEnd;
+/*?*/ bParaAttr = FALSE;
+/*?*/ pTmpHints->Remove(0);
+/*?*/ if( !pTmpHints->Count() )
+/*?*/ {
+/*?*/ delete pTmpHints;
+/*?*/ pTmpHints = NULL;
+/*?*/ }
+/*N*/ } while ( TRUE );
+/*N*/
+/*N*/ if( bResort )
+/*?*/ SwpHintsArr::Resort();
+/*N*/
+/*N*/ // Jetzt wollen wir mal gucken, ob wir das SwpHintsArray nicht
+/*N*/ // etwas vereinfachen koennen ...
+/*N*/ Merge( rNode, pMerge );
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwpHintsArr::Insert( pHint );
+/*N*/ // InsertChain( pHint );
+/*N*/
+/*N*/ // ... und die Abhaengigen benachrichtigen
+/*N*/ if ( rNode.GetDepends() )
+/*N*/ {
+/*N*/ SwUpdateAttr aHint( nHtStart,
+/*N*/ nHtStart == *pHtEnd ? *pHtEnd + 1 : *pHtEnd, nWhich );
+/*N*/ rNode.Modify( 0, &aHint );
+/*N*/ }
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if( !rNode.GetDoc()->IsInReading() )
+/*N*/ CHECK;
+/*N*/ #endif
+/*N*/ }
+
+/*************************************************************************
+ * SwpHints::DeleteAtPos()
+ *************************************************************************/
+
+/*N*/ void SwpHints::DeleteAtPos( const USHORT nPos )
+/*N*/ {
+/*N*/ SwTxtAttr *pHint = GetHt(nPos);
+/*N*/ // ChainDelete( pHint );
+/*N*/ SwpHintsArr::DeleteAtPos( nPos );
+/*N*/
+/*N*/ if( RES_TXTATR_FIELD == pHint->Which() )
+/*N*/ {
+/*N*/ SwFieldType* pFldTyp = ((SwTxtFld*)pHint)->GetFld().GetFld()->GetTyp();
+/*N*/ if( RES_DDEFLD == pFldTyp->Which() )
+/*N*/ {
+/*?*/ const SwTxtNode* pNd = ((SwTxtFld*)pHint)->GetpTxtNode();
+/*?*/ if( pNd && pNd->GetNodes().IsDocNodes() )
+/*?*/ ((SwDDEFieldType*)pFldTyp)->DecRefCnt();
+/*?*/ ((SwTxtFld*)pHint)->ChgTxtNode( 0 );
+/*N*/ }
+/*N*/ else if( !bVis && RES_HIDDENPARAFLD == pFldTyp->Which() )
+/*N*/ bCalcVis = TRUE;
+/*N*/ }
+/*N*/ CalcFlags();
+/*N*/ CHECK;
+/*N*/ }
+
+// Ist der Hint schon bekannt, dann suche die Position und loesche ihn.
+// Ist er nicht im Array, so gibt es ein ASSERT !!
+
+/*N*/ void SwpHints::Delete( SwTxtAttr* pTxtHt )
+/*N*/ {
+/*N*/ // Attr 2.0: SwpHintsArr::Delete( pTxtHt );
+/*N*/ const USHORT nPos = GetStartOf( pTxtHt );
+/*N*/ ASSERT( USHRT_MAX != nPos, "Attribut nicht im Attribut-Array!" );
+/*N*/ if( USHRT_MAX != nPos )
+/*N*/ DeleteAtPos( nPos );
+/*N*/ }
+
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ USHORT SwTxtNode::GetLang( const xub_StrLen nBegin, const xub_StrLen nLen,
+/*N*/ USHORT nScript ) const
+/*N*/ #else
+/*N*/ USHORT SwTxtNode::GetLang( const xub_StrLen nBegin, const xub_StrLen nLen) const
+/*N*/ #endif
+/*N*/ {
+/*N*/ USHORT nWhichId = RES_CHRATR_LANGUAGE;
+/*N*/ USHORT nRet = LANGUAGE_DONTKNOW;
+/*N*/ if( pSwpHints )
+/*N*/ {
+/*N*/ #ifdef VERTICAL_LAYOUT
+/*N*/ if ( ! nScript )
+/*N*/ nScript = pBreakIt->GetRealScriptOfText( aText, nBegin );
+/*N*/
+/*N*/ nWhichId = GetWhichOfScript( nWhichId, nScript );
+/*N*/ #else
+/*N*/ nWhichId = GetWhichOfScript( nWhichId,
+/*N*/ pBreakIt->GetRealScriptOfText( aText, nBegin ));
+/*N*/ #endif
+/*N*/
+/*N*/ xub_StrLen nEnd = nBegin + nLen;
+/*N*/ for( USHORT i = 0, nSize = pSwpHints->Count(); i < nSize; ++i )
+/*N*/ {
+/*N*/ // ist der Attribut-Anfang schon groesser als der Idx ?
+/*N*/ const SwTxtAttr *pHt = pSwpHints->operator[](i);
+/*N*/ xub_StrLen nAttrStart = *pHt->GetStart();
+/*N*/ if( nEnd < nAttrStart )
+/*N*/ break;
+/*N*/
+/*N*/ const USHORT nWhich = pHt->Which();
+/*N*/
+/*N*/ if( ( pHt->IsCharFmtAttr() && lcl_Included( nWhichId, pHt ) )
+/*N*/ || nWhichId == nWhich )
+/*N*/ {
+/*N*/ const xub_StrLen *pEndIdx = pHt->GetEnd();
+/*N*/ // Ueberlappt das Attribut den Bereich?
+/*N*/
+/*N*/ if( pEndIdx &&
+/*N*/ nLen ? ( nAttrStart < nEnd && nBegin < *pEndIdx )
+/*N*/ : (( nAttrStart < nBegin &&
+/*N*/ ( pHt->DontExpand() ? nBegin < *pEndIdx
+/*N*/ : nBegin <= *pEndIdx )) ||
+/*N*/ ( nBegin == nAttrStart &&
+/*N*/ ( nAttrStart == *pEndIdx || !nBegin ))) )
+/*N*/ {
+/*N*/ const SfxPoolItem* pItem;
+/*N*/ if( RES_TXTATR_CHARFMT == nWhich )
+/*N*/ pItem = &pHt->GetCharFmt().GetCharFmt()->GetAttr( nWhichId );
+/*N*/ else if( RES_TXTATR_INETFMT == nWhich )
+/*?*/ pItem = &((SwTxtINetFmt*)pHt)->GetCharFmt()->GetAttr( nWhichId );
+/*N*/ else
+/*N*/ pItem = &pHt->GetAttr();
+/*N*/
+/*N*/ USHORT nLng = ((SvxLanguageItem*)pItem)->GetLanguage();
+/*N*/
+/*N*/ // Umfasst das Attribut den Bereich komplett?
+/*N*/ if( nAttrStart <= nBegin && nEnd <= *pEndIdx )
+/*N*/ nRet = nLng;
+/*N*/ else if( LANGUAGE_DONTKNOW == nRet )
+/*N*/ nRet = nLng; // partielle Ueberlappung, der 1. gewinnt
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if( LANGUAGE_DONTKNOW == nRet )
+/*N*/ {
+/*N*/ if( !pSwpHints )
+/*N*/ nWhichId = GetWhichOfScript( RES_CHRATR_LANGUAGE,
+/*N*/ pBreakIt->GetRealScriptOfText( aText, nBegin ));
+/*N*/
+/*N*/ nRet = ((SvxLanguageItem&)GetSwAttrSet().Get( nWhichId )).GetLanguage();
+/*N*/ if( LANGUAGE_DONTKNOW == nRet )
+/*N*/ nRet = GetAppLanguage();
+/*N*/ }
+/*N*/ return nRet;
+/*N*/ }
+
+/*N*/ sal_Unicode GetCharOfTxtAttr( const SwTxtAttr& rAttr )
+/*N*/ {
+/*N*/ sal_Unicode cRet = CH_TXTATR_BREAKWORD;
+/*N*/ switch ( rAttr.Which() )
+/*N*/ {
+/*N*/ case RES_TXTATR_REFMARK:
+/*N*/ case RES_TXTATR_TOXMARK:
+/*N*/
+/*N*/ // case RES_TXTATR_FIELD: ??????
+/*N*/ // case RES_TXTATR_FLYCNT, // 29
+/*N*/
+/*N*/ case RES_TXTATR_FTN:
+/*N*/ cRet = CH_TXTATR_INWORD;
+/*N*/ break;
+/*N*/
+/*N*/ // depends on the character ??
+/*N*/ // case RES_TXTATR_HARDBLANK:
+/*N*/ // cRet = CH_TXTATR_INWORD;
+/*N*/ // break;
+/*N*/ }
+/*N*/ return cRet;
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_txatbase.cxx b/binfilter/bf_sw/source/core/txtnode/sw_txatbase.cxx
new file mode 100644
index 000000000000..04477fa64732
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_txatbase.cxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svtools/itempool.hxx>
+#include <txatbase.hxx>
+namespace binfilter {
+
+/*N*/ SwTxtAttr::SwTxtAttr( const SfxPoolItem& rAttr, xub_StrLen nStt )
+/*N*/ : pAttr( &rAttr ), nStart( nStt )
+/*N*/ {
+/*N*/ bDontExpand = bLockExpandFlag = bDontMergeAttr = bDontMoveAttr =
+/*N*/ bCharFmtAttr = bOverlapAllowedAttr = bPriorityAttr =
+/*N*/ bDontExpandStart = FALSE;
+/*N*/ }
+
+/*N*/ SwTxtAttr::~SwTxtAttr( )
+/*N*/ {
+/*N*/ }
+
+/*N*/ xub_StrLen* SwTxtAttr::GetEnd()
+/*N*/ {
+/*N*/ return 0;
+/*N*/ }
+
+ // RemoveFromPool muss immer vorm DTOR Aufruf erfolgen!!
+ // Meldet sein Attribut beim Pool ab
+/*N*/ void SwTxtAttr::RemoveFromPool( SfxItemPool& rPool )
+/*N*/ {
+/*N*/ rPool.Remove( GetAttr() );
+/*N*/ pAttr = 0;
+/*N*/ }
+
+
+/*N*/ SwTxtAttrEnd::SwTxtAttrEnd( const SfxPoolItem& rAttr, xub_StrLen nS,
+/*N*/ xub_StrLen nE )
+/*N*/ : SwTxtAttr( rAttr, nS ), nEnd( nE )
+/*N*/ {
+/*N*/ }
+
+/*N*/ xub_StrLen* SwTxtAttrEnd::GetEnd()
+/*N*/ {
+/*N*/ return &nEnd;
+/*N*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_txtatr2.cxx b/binfilter/bf_sw/source/core/txtnode/sw_txtatr2.cxx
new file mode 100644
index 000000000000..89f5f1abfc7a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_txtatr2.cxx
@@ -0,0 +1,218 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+#include <txtinet.hxx>
+#include <txtatr.hxx>
+#include <fchrfmt.hxx>
+#include <fmtinfmt.hxx>
+#include <charfmt.hxx>
+#include <ndtxt.hxx> // SwCharFmt, SwTxtNode
+#include <hints.hxx> // SwCharFmt, SwUpdateAttr
+#include <poolfmt.hxx> // RES_POOLCHR_INET_...
+
+#include <horiornt.hxx>
+
+#include <doc.hxx> // SwDoc
+namespace binfilter {
+
+
+/*************************************************************************
+ * class SwTxtHardBlank
+ *************************************************************************/
+
+
+
+/*************************************************************************
+ * class SwTxtCharFmt
+ *************************************************************************/
+
+/*N*/ SwTxtCharFmt::SwTxtCharFmt( const SwFmtCharFmt& rAttr,
+/*N*/ xub_StrLen nStartIn, xub_StrLen nEndIn )
+/*N*/ : SwTxtAttrEnd( rAttr, nStartIn, nEndIn ),
+/*N*/ pMyTxtNd( 0 )
+/*N*/ {
+/*N*/ ((SwFmtCharFmt&)rAttr).pTxtAttr = this;
+/*N*/ SetCharFmtAttr( TRUE );
+/*N*/ }
+
+/*N*/ SwTxtCharFmt::~SwTxtCharFmt( )
+/*N*/ {
+/*N*/ }
+
+/*N*/ void SwTxtCharFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( (nWhich<RES_CHRATR_BEGIN || nWhich>RES_CHRATR_END)
+/*N*/ && (nWhich!=RES_OBJECTDYING)
+/*N*/ && (nWhich!=RES_ATTRSET_CHG)
+/*N*/ && (nWhich!=RES_FMT_CHG) )
+/*N*/ ASSERT(!this, "SwTxtCharFmt::Modify(): unbekanntes Modify!");
+/*N*/ #endif
+/*N*/
+/*N*/ if( pMyTxtNd )
+/*N*/ {
+/*N*/ SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
+/*N*/ pMyTxtNd->SwCntntNode::Modify( &aUpdateAttr, &aUpdateAttr );
+/*N*/ }
+/*N*/ }
+
+ // erfrage vom Modify Informationen
+/*N*/ BOOL SwTxtCharFmt::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ if( RES_AUTOFMT_DOCNODE != rInfo.Which() || !pMyTxtNd ||
+/*N*/ &pMyTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = pMyTxtNd;
+/*N*/ return FALSE;
+/*N*/ }
+
+/*************************************************************************
+ * class SwTxtINetFmt
+ *************************************************************************/
+
+/*N*/ SwTxtINetFmt::SwTxtINetFmt( const SwFmtINetFmt& rAttr,
+/*N*/ xub_StrLen nStartIn, xub_StrLen nEndIn )
+/*N*/ : SwTxtAttrEnd( rAttr, nStartIn, nEndIn ),
+/*N*/ SwClient( 0 ),
+/*N*/ pMyTxtNd( 0 )
+/*N*/ {
+/*N*/ bValidVis = FALSE;
+/*N*/ ((SwFmtINetFmt&)rAttr).pTxtAttr = this;
+/*N*/ SetCharFmtAttr( TRUE );
+/*N*/ }
+
+/*N*/ SwTxtINetFmt::~SwTxtINetFmt( )
+/*N*/ {
+/*N*/ }
+
+/*N*/ SwCharFmt* SwTxtINetFmt::GetCharFmt()
+/*N*/ {
+/*N*/ const SwFmtINetFmt& rFmt = SwTxtAttrEnd::GetINetFmt();
+/*N*/ SwCharFmt* pRet = NULL;
+/*N*/
+/*N*/ if( rFmt.GetValue().Len() )
+/*N*/ {
+/*N*/ const SwDoc* pDoc = GetTxtNode().GetDoc();
+/*N*/ if( !IsValidVis() )
+/*N*/ {
+/*N*/ SetVisited( pDoc->IsVisitedURL( rFmt.GetValue() ) );
+/*N*/ SetValidVis( TRUE );
+/*N*/ }
+/*N*/ USHORT nId;
+/*N*/ const String& rStr = IsVisited() ? rFmt.GetVisitedFmt()
+/*N*/ : rFmt.GetINetFmt();
+/*N*/ if( rStr.Len() )
+/*N*/ nId = IsVisited() ? rFmt.GetVisitedFmtId() : rFmt.GetINetFmtId();
+/*N*/ else
+/*N*/ nId = IsVisited() ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL;
+/*N*/
+/*N*/ // JP 10.02.2000, Bug 72806: dont modify the doc for getting the
+/*N*/ // correct charstyle.
+/*N*/ BOOL bResetMod = !pDoc->IsModified();
+/*N*/ Link aOle2Lnk;
+/*N*/ if( bResetMod )
+/*N*/ {
+/*N*/ aOle2Lnk = pDoc->GetOle2Link();
+/*N*/ ((SwDoc*)pDoc)->SetOle2Link( Link() );
+/*N*/ }
+/*N*/
+/*N*/ pRet = IsPoolUserFmt( nId )
+/*N*/ ? ((SwDoc*)pDoc)->FindCharFmtByName( rStr )
+/*N*/ : ((SwDoc*)pDoc)->GetCharFmtFromPool( nId );
+/*N*/
+/*N*/ if( bResetMod )
+/*N*/ {
+/*N*/ ((SwDoc*)pDoc)->ResetModified();
+/*N*/ ((SwDoc*)pDoc)->SetOle2Link( aOle2Lnk );
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ if( pRet )
+/*N*/ pRet->Add( this );
+/*N*/ else if( GetRegisteredIn() )
+/*N*/ pRegisteredIn->Remove( this );
+/*N*/
+/*N*/ return pRet;
+/*N*/ }
+
+/*N*/ void SwTxtINetFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+/*N*/ {
+/*N*/ USHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
+/*N*/ #ifdef DBG_UTIL
+/*N*/ if ( (nWhich<RES_CHRATR_BEGIN || nWhich>RES_CHRATR_END)
+/*N*/ && (nWhich!=RES_OBJECTDYING)
+/*N*/ && (nWhich!=RES_ATTRSET_CHG)
+/*N*/ && (nWhich!=RES_FMT_CHG) )
+/*N*/ ASSERT(!this, "SwTxtCharFmt::Modify(): unbekanntes Modify!");
+/*N*/ #endif
+/*N*/
+/*N*/ if( pMyTxtNd )
+/*N*/ {
+/*N*/ SwUpdateAttr aUpdateAttr( *GetStart(), *GetEnd(), nWhich );
+/*N*/ pMyTxtNd->SwCntntNode::Modify( &aUpdateAttr, &aUpdateAttr );
+/*N*/ }
+/*N*/ }
+
+ // erfrage vom Modify Informationen
+/*N*/ BOOL SwTxtINetFmt::GetInfo( SfxPoolItem& rInfo ) const
+/*N*/ {
+/*N*/ if( RES_AUTOFMT_DOCNODE != rInfo.Which() || !pMyTxtNd ||
+/*N*/ &pMyTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
+/*N*/ return TRUE;
+/*N*/
+/*N*/ ((SwAutoFmtGetDocNode&)rInfo).pCntntNode = pMyTxtNd;
+/*N*/ return FALSE;
+/*N*/ }
+
+
+// ATT_XNLCONTAINERITEM ******************************
+
+
+
+
+// ******************************
+
+
+
+
+
+
+// ******************************
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/txtnode/sw_txtedt.cxx b/binfilter/bf_sw/source/core/txtnode/sw_txtedt.cxx
new file mode 100644
index 000000000000..cf73888ca8ba
--- /dev/null
+++ b/binfilter/bf_sw/source/core/txtnode/sw_txtedt.cxx
@@ -0,0 +1,396 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+// So kann man die Linguistik-Statistik ( (Tmp-Path)\swlingu.stk ) aktivieren:
+//#define LINGU_STATISTIK
+#ifdef LINGU_STATISTIK
+ #include <stdio.h> // in SwLinguStatistik::DTOR
+ #include <stdlib.h> // getenv()
+ #include <time.h> // clock()
+#endif
+
+#include <hintids.hxx>
+
+#include <vcl/svapp.hxx>
+#include <bf_svx/langitem.hxx>
+#include <bf_svx/scripttypeitem.hxx>
+#include <com/sun/star/i18n/WordType.hdl>
+#include <com/sun/star/i18n/ScriptType.hdl>
+
+#include <acmplwrd.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx> // GetDoc()
+#include <txatbase.hxx>
+#include <hints.hxx>
+#include <ndtxt.hxx>
+#include <txtfrm.hxx>
+#include <wrong.hxx>
+#include <breakit.hxx>
+#include <drawfont.hxx> // SwDrawTextInfo
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+
+#define C2U(cChar) ::rtl::OUString::createFromAscii(cChar)
+
+// Wir ersparen uns in Hyphenate ein GetFrm()
+// Achtung: in edlingu.cxx stehen die Variablen!
+extern const SwTxtNode *pLinguNode;
+extern SwTxtFrm *pLinguFrm;
+
+bool lcl_IsSkippableWhiteSpace( xub_Unicode cCh )
+{
+ return 0x3000 == cCh ||
+ ' ' == cCh ||
+ '\t' == cCh ||
+ 0x0a == cCh;
+}
+
+/*
+ * Ein Zeichen wurde eingefuegt.
+ */
+
+/*N*/ SwTxtNode& SwTxtNode::Insert( xub_Unicode c, const SwIndex &rIdx )
+/*N*/ {
+/*N*/ xub_StrLen nOrigLen = aText.Len();
+/*N*/
+/*N*/ ASSERT( rIdx <= nOrigLen, "Array ueberindiziert." );
+/*N*/ ASSERT( nOrigLen < STRING_LEN, "USHRT_MAX ueberschritten." );
+/*N*/
+/*N*/ if( nOrigLen == aText.Insert( c, rIdx.GetIndex() ).Len() )
+/*N*/ return *this;
+/*N*/
+/*N*/ Update(rIdx,1);
+/*N*/
+/*N*/ // leere Hints und Feldattribute an rIdx.GetIndex suchen
+/*N*/ if( pSwpHints )
+/*N*/ {
+/*N*/ USHORT* pEndIdx;
+/*N*/ for( USHORT i=0; i < pSwpHints->Count() &&
+/*N*/ rIdx >= *(*pSwpHints)[i]->GetStart(); ++i)
+/*N*/ {
+/*N*/ SwTxtAttr *pHt = pSwpHints->GetHt(i);
+/*N*/ if( 0 != ( pEndIdx = pHt->GetEnd()) )
+/*N*/ {
+/*N*/ // leere Hints an rIdx.GetIndex ?
+/*N*/ BOOL bEmpty = *pEndIdx == *pHt->GetStart()
+/*N*/ && rIdx == *pHt->GetStart();
+/*N*/
+/*N*/ if( bEmpty )
+/*N*/ {
+/*N*/ pSwpHints->DeleteAtPos(i);
+/*N*/ if( bEmpty )
+/*N*/ *pHt->GetStart() -= 1;
+/*N*/ else
+/*N*/ *pEndIdx -= 1;
+/*N*/ Insert(pHt);
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ if ( pSwpHints->CanBeDeleted() )
+/*N*/ DELETEZ( pSwpHints );
+/*N*/ }
+/*N*/ // den Frames Bescheid sagen
+/*N*/ SwInsChr aHint( rIdx.GetIndex()-1 );
+/*N*/ SwModify::Modify( 0, &aHint );
+/*N*/ return *this;
+/*N*/ }
+
+
+/*
+ * void SwTxtNode::RstAttr(const SwIndex &rIdx, USHORT nLen)
+ *
+ * loescht alle Attribute ab der Position rIdx ueber eine Laenge
+ * von nLen.
+ */
+
+/* 5 Faelle:
+ * 1) Das Attribut liegt vollstaendig im Bereich:
+ * -> loeschen
+ * 2) Das Attributende liegt im Bereich:
+ * -> Loeschen, mit neuem Ende einfuegen
+ * 3) Der Attributanfang liegt im Bereich:
+ * -> Loeschen, mit neuem Anfang einfuegen
+ * 4) Das Attrib umfasst den Bereich:
+ * Aufsplitten, d.h.
+ * -> Loeschen, mit alten Anfang und Anfang des Bereiches einfuegen
+ * -> Neues Attribut mit Ende des Bereiches und altem Ende einfuegen
+ * 5) Das Attribut liegt ausserhalb des Bereiches
+ * -> nichts tun.
+ */
+
+
+
+/*M*/ void SwTxtNode::RstAttr(const SwIndex &rIdx, xub_StrLen nLen, USHORT nWhich,
+/*M*/ const SfxItemSet* pSet, BOOL bInclRefToxMark )
+/*M*/ {
+/*M*/ // Attribute?
+/*M*/ if ( !GetpSwpHints() )
+/*M*/ return;
+/*M*/
+/*M*/ USHORT i = 0;
+/*M*/ xub_StrLen nStart = rIdx.GetIndex();
+/*M*/ xub_StrLen nEnd = nStart + nLen;
+/*M*/ xub_StrLen *pAttrEnd;
+/*M*/ xub_StrLen nAttrStart;
+/*M*/ SwTxtAttr *pHt;
+/*M*/
+/*M*/ BOOL bChanged = FALSE;
+/*M*/
+/*M*/ // nMin und nMax werden invers auf das Maximum bzw. Minimum gesetzt.
+/*M*/ xub_StrLen nMin = aText.Len();
+/*M*/ xub_StrLen nMax = nStart;
+/*M*/
+/*M*/ const BOOL bNoLen = !nMin;
+/*M*/
+/*M*/ // We have to remember the "new" attributes, which have
+/*M*/ // been introduced by splitting surrounding attributes (case 4).
+/*M*/ // They may not be forgotten inside the "Forget" function
+/*M*/ std::vector< const SwTxtAttr* > aNewAttributes;
+/*M*/
+/*M*/ // durch das Attribute-Array, bis der Anfang des Geltungsbereiches
+/*M*/ // des Attributs hinter dem Bereich liegt
+/*M*/ while( (i < pSwpHints->Count()) &&
+/*M*/ ((( nAttrStart = *(*pSwpHints)[i]->GetStart()) < nEnd )
+/*M*/ || nLen==0) )
+/*M*/ {
+/*M*/ pHt = pSwpHints->GetHt(i);
+/*M*/
+/*M*/ // Attribute ohne Ende bleiben drin!
+/*M*/ if ( 0 == (pAttrEnd=pHt->GetEnd()) )
+/*M*/ {
+/*M*/ i++;
+/*M*/ continue;
+/*M*/ }
+/*M*/
+/*M*/ // loesche alle TextAttribute die als Attribut im Set vorhanden sind
+/*M*/ if( pSet ? SFX_ITEM_SET != pSet->GetItemState( pHt->Which(), FALSE )
+/*M*/ : ( nWhich ? nWhich != pHt->Which()
+/*M*/ : (!bInclRefToxMark &&
+/*M*/ ( RES_TXTATR_REFMARK == pHt->Which() ||
+/*M*/ RES_TXTATR_TOXMARK == pHt->Which() ))))
+/*M*/ {
+/*M*/ // Es sollen nur Attribute mit nWhich beachtet werden
+/*M*/ i++;
+/*M*/ continue;
+/*M*/ }
+/*M*/
+/*M*/
+/*M*/ if( nStart <= nAttrStart ) // Faelle: 1,3,5
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ else // Faelle: 2,4,5
+/*M*/ if( *pAttrEnd > nStart ) // Faelle: 2,4
+/*M*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*M*/ }
+/*M*/ ++i;
+/*M*/ }
+/*M*/
+/*M*/ if ( pSwpHints && pSwpHints->CanBeDeleted() )
+/*M*/ DELETEZ( pSwpHints );
+/*M*/ if(bChanged)
+/*M*/ {
+/*M*/ if ( pSwpHints )
+/*M*/ {
+/*M*/ pSwpHints->ClearDummies( *this );
+/*M*/ ((SwpHintsArr*)pSwpHints)->Resort();
+/*M*/ pSwpHints->Merge( *this );
+/*M*/ }
+/*M*/ //TxtFrm's reagieren auf aHint, andere auf aNew
+/*M*/ SwUpdateAttr aHint( nMin, nMax, 0 );
+/*M*/ SwModify::Modify( 0, &aHint );
+/*M*/ SwFmtChg aNew( GetFmtColl() );
+/*M*/ SwModify::Modify( 0, &aNew );
+/*M*/ }
+/*M*/ }
+
+
+
+/*************************************************************************
+ * SwTxtNode::GetCurWord()
+ *
+ * Aktuelles Wort zurueckliefern:
+ * Wir suchen immer von links nach rechts, es wird also das Wort
+ * vor nPos gesucht. Es sei denn, wir befinden uns am Anfang des
+ * Absatzes, dann wird das erste Wort zurueckgeliefert.
+ * Wenn dieses erste Wort nur aus Whitespaces besteht, returnen wir
+ * einen leeren String.
+ *************************************************************************/
+
+
+
+
+
+/*M*/ void SwTxtNode::SetWrong( SwWrongList *pNew )
+/*M*/ {
+/*M*/ delete pWrong;
+/*M*/ pWrong = pNew;
+/*M*/ }
+
+/*M*/ SwScanner::SwScanner( const SwTxtNode& rNd, const SwWrongList* pWrng,
+/*M*/ USHORT nType, xub_StrLen nStart, xub_StrLen nEnde,
+/*M*/ BOOL bRev, BOOL bOS )
+/*M*/ : rNode( rNd ), pWrong( pWrng ), nWordType( nType ), nLen( 0 ),
+/*M*/ bReverse( bRev ), bStart( TRUE ), bIsOnlineSpell( bOS )
+/*M*/ {
+/*M*/ ASSERT( rNd.GetTxt().Len(), "SwScanner: EmptyString" );
+/*M*/ if( bReverse )
+/*M*/ {
+/*M*/ nBegin = nEnde;
+/*M*/ nEndPos = nStart;
+/*M*/ }
+/*M*/ else
+/*M*/ {
+/*M*/ nBegin = nStart;
+/*M*/ nEndPos = nEnde;
+/*M*/ }
+/*M*/
+/*M*/ aCurrLang = rNd.GetLang( nBegin );
+/*M*/ }
+
+
+/*N*/ BOOL SwScanner::NextWord()
+/*N*/ {
+/*N*/ ASSERT( ! bReverse,
+/*N*/ "SwScanner::NextWord() currently not implemented for reverse mode" )
+/*N*/
+/*N*/ nBegin += nLen;
+/*N*/
+/*N*/ // first we have to skip some whitespace characters
+/*N*/ const XubString& rText = rNode.GetTxt();
+/*N*/ Boundary aBound;
+/*N*/
+/*N*/ while ( true )
+/*N*/ {
+/*N*/
+/*N*/ while ( nBegin < rText.Len() &&
+/*N*/ lcl_IsSkippableWhiteSpace( rText.GetChar( nBegin ) ) )
+/*N*/ ++nBegin;
+/*N*/
+/*N*/ if ( nBegin >= rText.Len() || nBegin >= nEndPos )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ // get next language in order to find next or previous word
+/*N*/ const USHORT nNextScript =
+/*N*/ pBreakIt->xBreak->getScriptType( rText, nBegin );
+/*N*/ if ( nNextScript != GetI18NScriptTypeOfLanguage( aCurrLang ) )
+/*N*/ {
+/*N*/ LanguageType aNextLang = rNode.GetLang( nBegin, nNextScript );
+/*N*/ aCurrLang = aNextLang;
+/*N*/ }
+/*N*/
+/*N*/ // get the word boundaries
+/*N*/ aBound = pBreakIt->xBreak->getWordBoundary( rText, nBegin,
+/*N*/ pBreakIt->GetLocale( aCurrLang ), nWordType, sal_True );
+/*N*/
+/*N*/ //no word boundaries could be found
+/*N*/ if(aBound.endPos == aBound.startPos)
+/*N*/ return FALSE;
+/*N*/
+/*N*/ if( nBegin == aBound.endPos )
+/*N*/ ++nBegin;
+/*N*/ else
+/*N*/ break;
+/*N*/
+/*N*/ } // end while( true )
+
+/*N*/
+/*N*/ // we have to differenciate between these cases:
+/*N*/ if ( aBound.startPos <= nBegin )
+/*N*/ {
+/*N*/ ASSERT( aBound.endPos >= nBegin, "Unexpected aBound result" )
+/*N*/
+/*N*/ // restrict boundaries to script boundaries and nEndPos
+/*N*/ const USHORT nCurrScript =
+/*N*/ pBreakIt->xBreak->getScriptType( rText, nBegin );
+/*N*/
+/*N*/ XubString aTmpWord = rText.Copy( nBegin, aBound.endPos - nBegin );
+/*N*/ const sal_Int32 nScriptEnd = nBegin +
+/*N*/ pBreakIt->xBreak->endOfScript( aTmpWord, 0, nCurrScript );
+/*N*/ const sal_Int32 nEnd = Min( aBound.endPos, nScriptEnd );
+/*N*/
+/*N*/ // restrict word start to last script change position
+/*N*/ sal_Int32 nScriptBegin = 0;
+/*N*/ if ( aBound.startPos < nBegin )
+/*N*/ {
+/*N*/ // search from nBegin backwards until the next script change
+/*N*/ aTmpWord = rText.Copy( aBound.startPos, nBegin - aBound.startPos + 1 );
+/*N*/ nScriptBegin = aBound.startPos +
+/*N*/ pBreakIt->xBreak->beginOfScript( aTmpWord, nBegin - aBound.startPos,
+/*N*/ nCurrScript );
+/*N*/ }
+/*N*/
+/*N*/ nBegin = (xub_StrLen)Max( aBound.startPos, nScriptBegin );
+/*N*/ nLen = (xub_StrLen)(nEnd - nBegin);
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ const USHORT nCurrScript =
+/*N*/ pBreakIt->xBreak->getScriptType( rText, aBound.startPos );
+/*N*/ XubString aTmpWord = rText.Copy( aBound.startPos, aBound.endPos - aBound.startPos );
+/*N*/ const sal_Int32 nScriptEnd = aBound.startPos +
+/*N*/ pBreakIt->xBreak->endOfScript( aTmpWord, 0, nCurrScript );
+/*N*/ const sal_Int32 nEnd = Min( aBound.endPos, nScriptEnd );
+/*N*/ nBegin = (xub_StrLen)aBound.startPos;
+/*N*/ nLen = (xub_StrLen)(nEnd - nBegin);
+/*N*/ }
+/*N*/
+/*N*/ if( ! nLen )
+/*N*/ return FALSE;
+/*N*/
+/*N*/ aWord = rText.Copy( nBegin, nLen );
+/*N*/
+/*N*/ return TRUE;
+/*N*/ }
+
+#ifdef LINGU_STATISTIK
+
+// globale Variable
+SwLinguStatistik aSwLinguStat;
+
+
+
+#endif
+
+// change text to Upper/Lower/Hiragana/Katagana/...
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/makefile.mk b/binfilter/bf_sw/source/core/unocore/makefile.mk
new file mode 100644
index 000000000000..5db2327a4d7e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/makefile.mk
@@ -0,0 +1,125 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_unocore
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:512
+.ENDIF
+
+
+
+# --- Files --------------------------------------------------------
+EXCEPTIONSFILES= \
+ $(SLO)$/sw_swunohelper.obj\
+ $(SLO)$/sw_SwXTextDefaults.obj\
+ $(SLO)$/sw_unobkm.obj\
+ $(SLO)$/sw_unoevent.obj\
+ $(SLO)$/sw_unocrsrhelper.obj\
+ $(SLO)$/sw_unoevtlstnr.obj\
+ $(SLO)$/sw_unoftn.obj\
+ $(SLO)$/sw_unorefmk.obj\
+ $(SLO)$/sw_unosect.obj\
+ $(SLO)$/sw_unosett.obj\
+ $(SLO)$/sw_unocoll.obj\
+ $(SLO)$/sw_unodraw.obj\
+ $(SLO)$/sw_unofield.obj\
+ $(SLO)$/sw_unoframe.obj\
+ $(SLO)$/sw_unoidx.obj\
+ $(SLO)$/sw_unoobj.obj\
+ $(SLO)$/sw_unoobj2.obj\
+ $(SLO)$/sw_unoparagraph.obj\
+ $(SLO)$/sw_unoport.obj\
+ $(SLO)$/sw_unoredline.obj\
+ $(SLO)$/sw_unoredlines.obj\
+ $(SLO)$/sw_unosrch.obj\
+ $(SLO)$/sw_unostyle.obj\
+ $(SLO)$/sw_unotbl.obj \
+ $(SLO)$/sw_TextCursorHelper.obj \
+ $(SLO)$/sw_unotext.obj
+
+.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI"
+EXCEPTIONSNOOPTFILES =$(SLO)$/sw_unoportenum.obj
+.ELSE
+EXCEPTIONSFILES +=$(SLO)$/sw_unoportenum.obj
+.ENDIF
+
+
+SLOFILES = \
+ $(SLO)$/sw_swunohelper.obj\
+ $(SLO)$/sw_SwXTextDefaults.obj\
+ $(SLO)$/sw_unoportenum.obj\
+ $(SLO)$/sw_unobkm.obj\
+ $(SLO)$/sw_unoevent.obj\
+ $(SLO)$/sw_unocrsrhelper.obj\
+ $(SLO)$/sw_unoevtlstnr.obj\
+ $(SLO)$/sw_unoftn.obj\
+ $(SLO)$/sw_unorefmk.obj\
+ $(SLO)$/sw_unosect.obj\
+ $(SLO)$/sw_unosett.obj\
+ $(SLO)$/sw_unocoll.obj\
+ $(SLO)$/sw_unodraw.obj\
+ $(SLO)$/sw_unofield.obj\
+ $(SLO)$/sw_unoframe.obj\
+ $(SLO)$/sw_unoidx.obj\
+ $(SLO)$/sw_unoobj.obj\
+ $(SLO)$/sw_unoobj2.obj\
+ $(SLO)$/sw_unoparagraph.obj\
+ $(SLO)$/sw_unoport.obj\
+ $(SLO)$/sw_unoredline.obj\
+ $(SLO)$/sw_unoredlines.obj\
+ $(SLO)$/sw_unosrch.obj\
+ $(SLO)$/sw_unostyle.obj\
+ $(SLO)$/sw_unotbl.obj \
+ $(SLO)$/sw_TextCursorHelper.obj \
+ $(SLO)$/sw_unotext.obj\
+ $(SLO)$/sw_unoclbck.obj\
+ $(SLO)$/sw_unomap.obj\
+ $(SLO)$/sw_unoprnms.obj
+
+
+
+# --- Targets -------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/unocore/sw_SwXTextDefaults.cxx b/binfilter/bf_sw/source/core/unocore/sw_SwXTextDefaults.cxx
new file mode 100644
index 000000000000..14e802870607
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_SwXTextDefaults.cxx
@@ -0,0 +1,301 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <horiornt.hxx>
+
+#include <SwXTextDefaults.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <fchrfmt.hxx>
+#include <charfmt.hxx>
+#include <docstyle.hxx>
+#include <docsh.hxx>
+#include <unomap.hxx>
+#include <unomid.h>
+#include <paratr.hxx>
+#include <unoprnms.hxx>
+#include <hintids.hxx>
+namespace binfilter {
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+using rtl::OUString;
+
+// declarations
+void lcl_setPageDesc(SwDoc*, const uno::Any&, SfxItemSet& ); // from unoobj.cxx
+
+#define C2U(cChar) OUString::createFromAscii(cChar)
+
+
+SwXTextDefaults::SwXTextDefaults ( SwDoc * pNewDoc )
+: pDoc (pNewDoc)
+, aPropSet (aSwMapProvider.GetPropertyMap ( PROPERTY_MAP_TEXT_DEFAULT ) )
+{
+}
+
+
+SwXTextDefaults::~SwXTextDefaults ()
+{
+}
+
+
+Reference< XPropertySetInfo > SAL_CALL SwXTextDefaults::getPropertySetInfo( )
+ throw(RuntimeException)
+{
+ static uno::Reference < XPropertySetInfo > xRef = aPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+
+void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if (!pDoc)
+ throw RuntimeException();
+ const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ const SfxPoolItem& rItem = pDoc->GetDefault(pMap->nWID);
+ if (RES_PAGEDESC == pMap->nWID && MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId)
+ {
+ SfxItemSet aSet( pDoc->GetAttrPool(), RES_PAGEDESC, RES_PAGEDESC );
+ aSet.Put(rItem);
+ lcl_setPageDesc( pDoc, aValue, aSet );
+ pDoc->SetDefault(aSet.Get(RES_PAGEDESC));
+ }
+ else if ((RES_PARATR_DROP == pMap->nWID && MID_DROPCAP_CHAR_STYLE_NAME == pMap->nMemberId) ||
+ (RES_TXTATR_CHARFMT == pMap->nWID))
+ {
+ OUString uStyle;
+ if(aValue >>= uStyle)
+ {
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, GET_POOLID_CHRFMT, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
+ SwFmtDrop* pDrop = 0;
+ SwFmtCharFmt *pCharFmt = 0;
+ if(pStyle)
+ {
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pStyle );
+ if (RES_PARATR_DROP == pMap->nWID)
+ {
+ pDrop = (SwFmtDrop*)rItem.Clone(); // because rItem ist const...
+ pDrop->SetCharFmt(aStyle.GetCharFmt());
+ pDoc->SetDefault(*pDrop);
+ }
+ else // RES_TXTATR_CHARFMT == pMap->nWID
+ {
+ pCharFmt = (SwFmtCharFmt*)rItem.Clone(); // because rItem ist const...
+ pCharFmt->SetCharFmt(aStyle.GetCharFmt());
+ pDoc->SetDefault(*pCharFmt);
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+ delete pDrop;
+ delete pCharFmt;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ SfxPoolItem * pNewItem = rItem.Clone();
+ pNewItem->PutValue( aValue, pMap->nMemberId);
+ pDoc->SetDefault(*pNewItem);
+ delete pNewItem;
+ }
+}
+
+
+Any SAL_CALL SwXTextDefaults::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if (!pDoc)
+ throw RuntimeException();
+ const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ Any aRet;
+ const SfxPoolItem& rItem = pDoc->GetDefault(pMap->nWID);
+ rItem.QueryValue( aRet, pMap->nMemberId );
+ return aRet;
+}
+
+
+void SAL_CALL SwXTextDefaults::addPropertyChangeListener( const OUString& rPropertyName, const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+void SAL_CALL SwXTextDefaults::removePropertyChangeListener( const OUString& rPropertyName, const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+void SAL_CALL SwXTextDefaults::addVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+void SAL_CALL SwXTextDefaults::removeVetoableChangeListener( const OUString& rPropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING ( "not implemented" );
+}
+
+
+// XPropertyState
+PropertyState SAL_CALL SwXTextDefaults::getPropertyState( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ PropertyState eRet = PropertyState_DIRECT_VALUE;
+ if (!pDoc)
+ throw RuntimeException();
+ const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ const SfxPoolItem& rItem = pDoc->GetDefault(pMap->nWID);
+ if (IsStaticDefaultItem ( &rItem ) )
+ eRet = PropertyState_DEFAULT_VALUE;
+ return eRet;
+}
+
+
+Sequence< PropertyState > SAL_CALL SwXTextDefaults::getPropertyStates( const Sequence< OUString >& rPropertyNames )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ const sal_Int32 nCount = rPropertyNames.getLength();
+ const OUString * pNames = rPropertyNames.getConstArray();
+ Sequence < PropertyState > aRet ( nCount );
+ PropertyState *pState = aRet.getArray();
+
+ for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++)
+ pState[nIndex] = getPropertyState( pNames[nIndex] );
+
+ return aRet;
+}
+
+
+void SAL_CALL SwXTextDefaults::setPropertyToDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ if (!pDoc)
+ throw RuntimeException();
+ const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SfxItemPool rSet (pDoc->GetAttrPool());
+ rSet.ResetPoolDefaultItem ( pMap->nWID );
+}
+
+
+Any SAL_CALL SwXTextDefaults::getPropertyDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ if (!pDoc)
+ throw RuntimeException();
+ const SfxItemPropertyMap *pMap = SfxItemPropertyMap::GetByName( aPropSet.getPropertyMap(), rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ Any aRet;
+ SfxItemPool rSet (pDoc->GetAttrPool());
+ const SfxPoolItem *pItem = rSet.GetPoolDefaultItem ( pMap->nWID );
+ pItem->QueryValue( aRet, pMap->nMemberId );
+ return aRet;
+}
+
+
+rtl::OUString SAL_CALL SwXTextDefaults::getImplementationName( )
+ throw (RuntimeException)
+{
+ return C2U("SwXTextDefaults");
+}
+
+
+sal_Bool SAL_CALL SwXTextDefaults::supportsService( const ::rtl::OUString& rServiceName )
+ throw (RuntimeException)
+{
+ return rServiceName == C2U("com.sun.star.text.Defaults") ||
+ rServiceName == C2U("com.sun.star.style.CharacterProperties") ||
+ rServiceName == C2U("com.sun.star.style.CharacterPropertiesAsian") ||
+ rServiceName == C2U("com.sun.star.style.CharacterPropertiesComplex") ||
+ rServiceName == C2U("com.sun.star.style.ParagraphProperties") ||
+ rServiceName == C2U("com.sun.star.style.ParagraphPropertiesAsian") ||
+ rServiceName == C2U("com.sun.star.style.ParagraphPropertiesComplex");
+}
+
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SwXTextDefaults::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+ uno::Sequence< OUString > aRet(7);
+ OUString* pArr = aRet.getArray();
+ *pArr++ = C2U("com.sun.star.text.Defaults");
+ *pArr++ = C2U("com.sun.star.style.CharacterProperties");
+ *pArr++ = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ *pArr++ = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ *pArr++ = C2U("com.sun.star.style.ParagraphProperties");
+ *pArr++ = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ *pArr++ = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ return aRet;
+}
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_TextCursorHelper.cxx b/binfilter/bf_sw/source/core/unocore/sw_TextCursorHelper.cxx
new file mode 100644
index 000000000000..e9a737ef5e05
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_TextCursorHelper.cxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "TextCursorHelper.hxx"
+
+#include <errhdl.hxx>
+
+#include "unoobj.hxx"
+namespace binfilter {
+
+using namespace ::com::sun::star;
+
+const uno::Sequence< sal_Int8 > & OTextCursorHelper::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+//XUnoTunnel
+sal_Int64 SAL_CALL OTextCursorHelper::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_swunohelper.cxx b/binfilter/bf_sw/source/core/unocore/sw_swunohelper.cxx
new file mode 100644
index 000000000000..3e5efbb9b2c3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_swunohelper.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVSTDARR_STRINGS
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/ucb/XContentIdentifier.hpp>
+#include <com/sun/star/ucb/XContentProvider.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/TransferInfo.hpp>
+#include <com/sun/star/ucb/NameClash.hdl>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/types.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/datetime.hxx>
+#include <tools/debug.hxx>
+#include <ucbhelper/contentidentifier.hxx>
+#include <ucbhelper/contentbroker.hxx>
+#include <ucbhelper/content.hxx>
+#include <bf_svtools/svstdarr.hxx>
+
+#include <swunohelper.hxx>
+#include <swunodef.hxx>
+#include <errhdl.hxx>
+#include <legacysmgr/legacy_binfilters_smgr.hxx> //STRIP002
+namespace binfilter {
+namespace SWUnoHelper {
+
+sal_Int32 GetEnumAsInt32( const UNO_NMSPC::Any& rVal )
+{
+ sal_Int32 eVal;
+ try
+ {
+ eVal = comphelper::getEnumAsINT32( rVal );
+ }
+ catch( UNO_NMSPC::Exception & )
+ {
+ eVal = 0;
+ ASSERT( FALSE, "can't get EnumAsInt32" );
+ }
+ return eVal;
+}
+
+
+// methods for UCB actions
+BOOL UCB_DeleteFile( const String& rURL )
+{
+ BOOL bRemoved;
+ try
+ {
+ ucbhelper::Content aTempContent( rURL,
+ STAR_REFERENCE( ucb::XCommandEnvironment )());
+ aTempContent.executeCommand(
+ ::rtl::OUString::createFromAscii( "delete" ),
+ UNO_NMSPC::makeAny( sal_Bool( sal_True ) ) );
+ bRemoved = TRUE;
+ }
+ catch( UNO_NMSPC::Exception& )
+ {
+ bRemoved = FALSE;
+ ASSERT( FALSE, "Exeception from executeCommand( delete )" );
+ }
+ return bRemoved;
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unobkm.cxx b/binfilter/bf_sw/source/core/unocore/sw_unobkm.cxx
new file mode 100644
index 000000000000..98d174d448c3
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unobkm.cxx
@@ -0,0 +1,321 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <bookmrk.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::rtl;
+
+/******************************************************************
+ * SwXBookmark
+ ******************************************************************/
+TYPEINIT1(SwXBookmark, SwClient)
+
+const uno::Sequence< sal_Int8 > & SwXBookmark::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXBookmark::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+SwXBookmark::SwXBookmark(SwBookmark* pBkm, SwDoc* pDc) :
+ pDoc(pDc),
+ bIsDescriptor(0 == pBkm),
+ aLstnrCntnr( (text::XTextContent*)this)
+{
+ if(pBkm)
+ pBkm->Add(this);
+}
+
+SwXBookmark::~SwXBookmark()
+{
+}
+
+void SwXBookmark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ if(!bIsDescriptor)
+ throw uno::RuntimeException();
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwDoc* pDc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ?
+ (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDc)
+ {
+ pDoc = pDc;
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ UnoActionContext aCont(pDoc);
+ SwBookmark* pBkm = 0;
+ {
+ if(!m_aName.Len())
+ m_aName = C2S("Bookmark");
+ if( USHRT_MAX != pDoc->FindBookmark(m_aName) )
+ pDoc->MakeUniqueBookmarkName( m_aName );
+ KeyCode aCode;
+ pBkm = pDoc->MakeBookmark( aPam, aCode,
+ m_aName, aEmptyStr, BOOKMARK);
+ pBkm->Add(this);
+ bIsDescriptor = sal_False;
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+}
+
+void SwXBookmark::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+
+uno::Reference< text::XTextRange > SwXBookmark::getAnchor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< text::XTextRange > aRet;
+ SwBookmark* pBkm = GetBookmark();
+
+ if(pBkm)
+ {
+ const SwPosition& rPos = pBkm->GetPos();
+ const SwPosition* pMarkPos = pBkm->GetOtherPos();
+
+ aRet = SwXTextRange::CreateTextRangeFromPosition(pDoc, rPos, pMarkPos);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXBookmark::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwBookmark* pBkm = GetBookmark();
+ if(pBkm)
+ GetDoc()->DelBookmark(getName());
+ else
+ throw uno::RuntimeException();
+}
+
+void SwXBookmark::addEventListener(const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+
+void SwXBookmark::removeEventListener(const uno::Reference< lang::XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+
+OUString SwXBookmark::getName(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwBookmark* pBkm = GetBookmark();
+ OUString sRet;
+ if(pBkm)
+ sRet = pBkm->GetName();
+ else if(bIsDescriptor)
+ sRet = m_aName;
+ else
+ throw uno::RuntimeException();
+ return sRet;
+}
+
+void SwXBookmark::setName(const OUString& rName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwBookmark* pBkm = GetBookmark();
+ String sBkName(rName);
+ String sOldName = getName();
+ if(sOldName != sBkName && pBkm && USHRT_MAX == pDoc->FindBookmark(sBkName))
+ {
+ KeyCode aCode;
+ String sShortName;
+ SwPaM aPam(pBkm->GetPos());
+ if(pBkm->GetOtherPos())
+ {
+ aPam.SetMark();
+ *aPam.GetMark() = *pBkm->GetOtherPos();
+ }
+
+ SwBookmark* pMark = pDoc->MakeBookmark(aPam, aCode,
+ sBkName, sShortName, BOOKMARK);
+ pMark->Add(this);
+ GetDoc()->DelBookmark( sOldName );
+
+ }
+ else if(bIsDescriptor)
+ m_aName = sBkName;
+ else
+ throw uno::RuntimeException();
+}
+
+OUString SwXBookmark::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXBookmark");
+}
+
+sal_Bool SwXBookmark::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return !rServiceName.compareToAscii("com.sun.star.text.Bookmark") ||
+ !rServiceName.compareToAscii("com.sun.star.document.LinkTarget") ||
+ !rServiceName.compareToAscii("com.sun.star.text.TextContent");
+;
+}
+
+uno::Sequence< OUString > SwXBookmark::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(3);
+ OUString* pArr = aRet.getArray();
+ pArr[0] = C2U("com.sun.star.text.Bookmark");
+ pArr[1] = C2U("com.sun.star.document.LinkTarget");
+ pArr[2] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+void SwXBookmark::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetBookmark())
+ {
+ pDoc = 0;
+ aLstnrCntnr.Disposing();
+ }
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXBookmark::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef;
+ if(!aRef.is())
+ {
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_BOOKMARK);
+ uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo(pMap);
+ // extend PropertySetInfo!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ aRef = new SfxExtItemPropertySetInfo(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS),
+ aPropSeq );
+ }
+ return aRef;
+}
+
+void SwXBookmark::setPropertyValue(const OUString& PropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ throw IllegalArgumentException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + PropertyName, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ //hier gibt es nichts zu setzen
+}
+
+uno::Any SwXBookmark::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ uno::Any aRet;
+ if(!SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName))
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_NAME)))
+ aRet <<= getName();
+ }
+ return aRet;
+}
+
+void SwXBookmark::addPropertyChangeListener(const OUString& PropertyName,
+ const uno::Reference< beans::XPropertyChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+
+void SwXBookmark::removePropertyChangeListener(const OUString& PropertyName,
+ const uno::Reference< beans::XPropertyChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+
+void SwXBookmark::addVetoableChangeListener(const OUString& PropertyName,
+ const uno::Reference< beans::XVetoableChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+
+void SwXBookmark::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoclbck.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoclbck.cxx
new file mode 100644
index 000000000000..f568d7630172
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoclbck.cxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <errhdl.hxx>
+
+#include <unoidx.hxx>
+#include <unoclbck.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+namespace binfilter {
+
+SwUnoCallBack::SwUnoCallBack(SwModify *pToRegisterIn) :
+ SwModify(pToRegisterIn)
+{
+}
+
+SwUnoCallBack::~SwUnoCallBack()
+{
+}
+
+SwXReferenceMark* SwUnoCallBack::GetRefMark(const SwFmtRefMark& rMark)
+{
+ SwClientIter aIter( *this );
+ SwXReferenceMark* pxRefMark = (SwXReferenceMark*)aIter.First( TYPE( SwXReferenceMark ));
+ while(pxRefMark)
+ {
+ SwDoc* pDoc = pxRefMark->GetDoc();
+ if(pDoc)
+ {
+ const SwFmtRefMark* pFmt = pDoc->GetRefMark(pxRefMark->GetMarkName());
+ if(pFmt == &rMark)
+ return pxRefMark;
+ }
+ pxRefMark = (SwXReferenceMark*)aIter.Next( );
+ }
+ return 0;
+}
+
+SwXFootnote* SwUnoCallBack::GetFootnote(const SwFmtFtn& rMark)
+{
+ SwClientIter aIter( *this );
+ SwXFootnote* pxFootnote = (SwXFootnote*)aIter.First( TYPE( SwXFootnote ));
+ while(pxFootnote)
+ {
+ SwDoc* pDoc = pxFootnote->GetDoc();
+ if(pDoc)
+ {
+ const SwFmtFtn* pFtn = pxFootnote->FindFmt();
+ if(pFtn == &rMark)
+ return pxFootnote;
+ }
+ pxFootnote = (SwXFootnote*)aIter.Next( );
+ }
+ return 0;
+}
+
+SwXDocumentIndexMark* SwUnoCallBack::GetTOXMark(const SwTOXMark& rMark)
+{
+ SwClientIter aIter( *this );
+ SwXDocumentIndexMark* pxIndexMark = (SwXDocumentIndexMark*)aIter.First( TYPE( SwXDocumentIndexMark ));
+ while(pxIndexMark)
+ {
+ const SwTOXMark* pMark = pxIndexMark->GetTOXMark();
+ if(pMark == &rMark)
+ return pxIndexMark;
+
+ pxIndexMark = (SwXDocumentIndexMark*)aIter.Next( );
+ }
+ return 0;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unocoll.cxx b/binfilter/bf_sw/source/core/unocore/sw_unocoll.cxx
new file mode 100644
index 000000000000..eaa6c012345b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unocoll.cxx
@@ -0,0 +1,1575 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <hintids.hxx>
+#include <bf_svx/svxids.hrc>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+
+#include <errhdl.hxx>
+
+#include <fmtcol.hxx>
+#include <poolfmt.hxx>
+#include <unocoll.hxx>
+#include <unosett.hxx>
+#include <unoclbck.hxx>
+#include <fmtanchr.hxx>
+#include <ndtxt.hxx>
+#include <section.hxx>
+#include <bookmrk.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <com/sun/star/text/XTextTableCursor.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <bf_svtools/PasswordHelper.hxx>
+#include <bf_svtools/unoimap.hxx>
+#include <bf_svtools/unoevent.hxx>
+#include <frmfmt.hxx>
+#include <unotbl.hxx>
+#include <unostyle.hxx>
+#include <unofield.hxx>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <vcl/svapp.hxx>
+#include <authfld.hxx>
+#include <SwXTextDefaults.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+using rtl::OUString;
+
+const char* __FAR_DATA aProvNames[] =
+ {
+ "com.sun.star.text.TextTable", //SW_SERVICE_TYPE_TEXTTABLE
+ "com.sun.star.text.TextFrame", //SW_SERVICE_TYPE_TEXTFRAME
+ "com.sun.star.text.GraphicObject", //SW_SERVICE_TYPE_GRAPHIC
+ "com.sun.star.text.TextEmbeddedObject", //SW_SERVICE_TYPE_OLE
+ "com.sun.star.text.Bookmark", //SW_SERVICE_TYPE_BOOKMARK
+ "com.sun.star.text.Footnote", //SW_SERVICE_TYPE_FOOTNOTE
+ "com.sun.star.text.Endnote", //SW_SERVICE_TYPE_ENDNOTE
+ "com.sun.star.text.DocumentIndexMark", //SW_SERVICE_TYPE_INDEXMARK
+ "com.sun.star.text.DocumentIndex", //SW_SERVICE_TYPE_INDEX
+ "com.sun.star.text.ReferenceMark", //SW_SERVICE_REFERENCE_MARK
+ "com.sun.star.style.CharacterStyle", //SW_SERVICE_STYLE_CHARACTER_STYLE
+ "com.sun.star.style.ParagraphStyle", //SW_SERVICE_STYLE_PARAGRAPH_STYLE
+ "com.sun.star.style.FrameStyle", //SW_SERVICE_STYLE_FRAME_STYLE
+ "com.sun.star.style.PageStyle", //SW_SERVICE_STYLE_PAGE_STYLE
+ "com.sun.star.style.NumberingStyle", //SW_SERVICE_STYLE_NUMBERING_STYLE
+ "com.sun.star.text.ContentIndexMark",//SW_SERVICE_CONTENT_INDEX_MARK
+ "com.sun.star.text.ContentIndex", //SW_SERVICE_CONTENT_INDEX
+ "com.sun.star.text.UserIndexMark", //SW_SERVICE_USER_INDEX_MARK
+ "com.sun.star.text.UserIndex", //SW_SERVICE_USER_INDEX
+ "com.sun.star.text.TextSection",//SW_SERVICE_TEXT_SECTION
+ "com.sun.star.text.TextField.DateTime", //SW_SERVICE_FIELD_DATETIME
+ "com.sun.star.text.TextField.User", //SW_SERVICE_FIELDTYPE_USER
+ "com.sun.star.text.TextField.SetExpression", //SW_SERVICE_FIELDTYPE_SET_EXP
+ "com.sun.star.text.TextField.GetExpression", //SW_SERVICE_FIELDTYPE_GET_EXP
+ "com.sun.star.text.TextField.FileName", //SW_SERVICE_FIELDTYPE_FILE_NAME
+ "com.sun.star.text.TextField.PageNumber", //SW_SERVICE_FIELDTYPE_PAGE_NUM
+ "com.sun.star.text.TextField.Author", //SW_SERVICE_FIELDTYPE_AUTHOR
+ "com.sun.star.text.TextField.Chapter", //SW_SERVICE_FIELDTYPE_CHAPTER
+ "", //SW_SERVICE_FIELDTYPE_DUMMY_0
+ "com.sun.star.text.TextField.GetReference", //SW_SERVICE_FIELDTYPE_GET_REFERENCE
+ "com.sun.star.text.TextField.ConditionalText", //SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT
+ "com.sun.star.text.TextField.Annotation", //SW_SERVICE_FIELDTYPE_ANNOTATION
+ "com.sun.star.text.TextField.Input", //SW_SERVICE_FIELDTYPE_INPUT
+ "com.sun.star.text.TextField.Macro", //SW_SERVICE_FIELDTYPE_MACRO
+ "com.sun.star.text.TextField.DDE", //SW_SERVICE_FIELDTYPE_DDE
+ "com.sun.star.text.TextField.HiddenParagraph", //SW_SERVICE_FIELDTYPE_HIDDEN_PARA
+ "",//com.sun.star.text.TextField.DocumentInfo", //SW_SERVICE_FIELDTYPE_DOC_INFO
+ "com.sun.star.text.TextField.TemplateName", //SW_SERVICE_FIELDTYPE_TEMPLATE_NAME
+ "com.sun.star.text.TextField.ExtendedUser", //SW_SERVICE_FIELDTYPE_USER_EXT
+ "com.sun.star.text.TextField.ReferencePageSet", //SW_SERVICE_FIELDTYPE_REF_PAGE_SET
+ "com.sun.star.text.TextField.ReferencePageGet", //SW_SERVICE_FIELDTYPE_REF_PAGE_GET
+ "com.sun.star.text.TextField.JumpEdit", //SW_SERVICE_FIELDTYPE_JUMP_EDIT
+ "com.sun.star.text.TextField.Script", //SW_SERVICE_FIELDTYPE_SCRIPT
+ "com.sun.star.text.TextField.DatabaseNextSet", //SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET
+ "com.sun.star.text.TextField.DatabaseNumberOfSet",//SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET
+ "com.sun.star.text.TextField.DatabaseSetNumber", //SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM
+ "com.sun.star.text.TextField.Database", //SW_SERVICE_FIELDTYPE_DATABASE
+ "com.sun.star.text.TextField.DatabaseName", //SW_SERVICE_FIELDTYPE_DATABASE_NAME
+ "com.sun.star.text.TextField.TableFormula",//SW_SERVICE_FIELDTYPE_TABLE_FORMULA
+ "com.sun.star.text.TextField.PageCount", //SW_SERVICE_FIELDTYPE_PAGE_COUNT
+ "com.sun.star.text.TextField.ParagraphCount", //SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT
+ "com.sun.star.text.TextField.WordCount", //SW_SERVICE_FIELDTYPE_WORD_COUNT
+ "com.sun.star.text.TextField.CharacterCount", //SW_SERVICE_FIELDTYPE_CHARACTER_COUNT
+ "com.sun.star.text.TextField.TableCount", //SW_SERVICE_FIELDTYPE_TABLE_COUNT
+ "com.sun.star.text.TextField.GraphicObjectCount",//SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT
+ "com.sun.star.text.TextField.EmbeddedObjectCount", //SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT
+ "com.sun.star.text.TextField.DocInfo.ChangeAuthor", //SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR
+ "com.sun.star.text.TextField.DocInfo.ChangeDateTime", //SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME
+ "com.sun.star.text.TextField.DocInfo.EditTime", //SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME
+ "com.sun.star.text.TextField.DocInfo.Description", //SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION
+ "com.sun.star.text.TextField.DocInfo.CreateAuthor", //SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR
+ "com.sun.star.text.TextField.DocInfo.CreateDateTime",//SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME
+ "com.sun.star.text.TextField.DocInfo.Info0", //SW_SERVICE_FIELDTYPE_DOCINFO_INFO_0
+ "com.sun.star.text.TextField.DocInfo.Info1", //SW_SERVICE_FIELDTYPE_DOCINFO_INFO_1
+ "com.sun.star.text.TextField.DocInfo.Info2", //SW_SERVICE_FIELDTYPE_DOCINFO_INFO_2
+ "com.sun.star.text.TextField.DocInfo.Info3", //SW_SERVICE_FIELDTYPE_DOCINFO_INFO_3
+ "com.sun.star.text.TextField.DocInfo.PrintAuthor", //SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR
+ "com.sun.star.text.TextField.DocInfo.PrintDateTime", //SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME
+ "com.sun.star.text.TextField.DocInfo.KeyWords", //SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS
+ "com.sun.star.text.TextField.DocInfo.Subject", //SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT
+ "com.sun.star.text.TextField.DocInfo.Title", //SW_SERVICE_FIELDTYPE_DOCINFO_TITLE
+ "com.sun.star.text.TextField.DocInfo.Revision", //SW_SERVICE_FIELDTYPE_DOCINFO_REVISION
+ "com.sun.star.text.TextField.Bibliography",//SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY
+ "com.sun.star.text.TextField.CombinedCharacters",//SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS
+ "com.sun.star.text.TextField.DropDown",//SW_SERVICE_FIELDTYPE_DROPDOWN
+ "",//SW_SERVICE_FIELDTYPE_DUMMY_4
+ "",//SW_SERVICE_FIELDTYPE_DUMMY_5
+ "",//SW_SERVICE_FIELDTYPE_DUMMY_6
+ "",//SW_SERVICE_FIELDTYPE_DUMMY_7
+ "",//SW_SERVICE_FIELDTYPE_DUMMY_8
+ "com.sun.star.text.FieldMaster.User",//SW_SERVICE_FIELDMASTER_USER
+ "com.sun.star.text.FieldMaster.DDE",//SW_SERVICE_FIELDMASTER_DDE
+ "com.sun.star.text.FieldMaster.SetExpression",//SW_SERVICE_FIELDMASTER_SET_EXP
+ "com.sun.star.text.FieldMaster.Database",//SW_SERVICE_FIELDMASTER_DATABASE
+ "com.sun.star.text.FieldMaster.Bibliography",//SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY
+ "",//SW_SERVICE_FIELDMASTER_DUMMY2
+ "",//SW_SERVICE_FIELDMASTER_DUMMY3
+ "",//SW_SERVICE_FIELDMASTER_DUMMY4
+ "",//SW_SERVICE_FIELDMASTER_DUMMY5
+ "com.sun.star.text.IllustrationsIndex",//SW_SERVICE_INDEX_ILLUSTRATIONS
+ "com.sun.star.text.ObjectIndex",//SW_SERVICE_INDEX_OBJECTS
+ "com.sun.star.text.TableIndex",//SW_SERVICE_INDEX_TABLES
+ "com.sun.star.text.Bibliography",//SW_SERVICE_INDEX_BIBLIOGRAPHY
+ "com.sun.star.text.Paragraph",//SW_SERVICE_PARAGRAPH
+ "com.sun.star.text.TextField.InputUser", //SW_SERVICE_FIELDTYPE_INPUT_USER
+ "com.sun.star.text.TextField.HiddenText", //SW_SERVICE_FIELDTYPE_HIDDEN_TEXT
+ "com.sun.star.style.ConditionalParagraphStyle", //SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE
+ "com.sun.star.text.NumberingRules", //SW_SERVICE_NUMBERING_RULES
+ "com.sun.star.text.TextColumns", //SW_SERVICE_TEXT_COLUMNS,
+ "com.sun.star.text.IndexHeaderSection", //SW_SERVICE_INDEX_HEADER_SECTION
+ "com.sun.star.text.Defaults", //SW_SERVICE_DEFAULTS
+ "com.sun.star.image.ImageMapRectangleObject", //SW_SERVICE_IMAP_RECTANGLE
+ "com.sun.star.image.ImageMapCircleObject", //SW_SERVICE_IMAP_CIRCLE
+ "com.sun.star.image.ImageMapPolygonObject" //SW_SERVICE_IMAP_POLYGON
+ };
+
+const SvEventDescription* lcl_GetSupportedMacroItems()
+{
+ static const SvEventDescription aMacroDescriptionsImpl[] =
+ {
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+ };
+
+ return aMacroDescriptionsImpl;
+}
+
+/******************************************************************
+ * SwXServiceProvider
+ ******************************************************************/
+OUString SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
+{
+ SolarMutexGuard aGuard;
+ OUString sRet;
+ if(nObjectType <= SW_SERVICE_LAST)
+ sRet = C2U(aProvNames[nObjectType]);
+ return sRet;
+}
+
+uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
+{
+ uno::Sequence<OUString> aRet(SW_SERVICE_LAST + 1);
+ OUString* pArray = aRet.getArray();
+ sal_uInt16 n = 0;
+ for(sal_uInt16 i = 0; i <= SW_SERVICE_LAST; i++)
+ {
+ String sProv(C2U(aProvNames[i]));
+ if(sProv.Len())
+ {
+ pArray[n] = sProv;
+ n++;
+ }
+ }
+ aRet.realloc(n);
+ return aRet;
+
+}
+
+sal_uInt16 SwXServiceProvider::GetProviderType(const OUString& rServiceName)
+{
+ for(sal_uInt16 i = 0; i <= SW_SERVICE_LAST; i++ )
+ {
+ if( COMPARE_EQUAL == rServiceName.compareToAscii(aProvNames[i]))
+ return i;
+ }
+ return SW_SERVICE_INVALID;
+}
+
+uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 nObjectType, SwDoc* pDoc)
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< uno::XInterface > xRet;
+ switch(nObjectType)
+ {
+ case SW_SERVICE_TYPE_TEXTTABLE:
+ {
+ SwXTextTable* pTextTable = new SwXTextTable();
+ xRet = (cppu::OWeakObject*)pTextTable;
+ }
+ break;
+ case SW_SERVICE_TYPE_TEXTFRAME:
+ {
+ SwXTextFrame* pTextFrame = new SwXTextFrame( pDoc );
+ xRet = (cppu::OWeakObject*)(SwXFrame*)pTextFrame;
+ }
+ break;
+ case SW_SERVICE_TYPE_GRAPHIC :
+ {
+ SwXTextGraphicObject* pGraphic = new SwXTextGraphicObject( pDoc );
+ xRet = (cppu::OWeakObject*)(SwXFrame*)pGraphic;
+
+ }
+ break;
+ case SW_SERVICE_TYPE_OLE :
+ {
+ SwXTextEmbeddedObject* pOle = new SwXTextEmbeddedObject( pDoc );
+ xRet = (cppu::OWeakObject*)(SwXFrame*)pOle;
+ }
+ break;
+ case SW_SERVICE_TYPE_BOOKMARK :
+ {
+ SwXBookmark* pBookmark = new SwXBookmark;
+ xRet = (cppu::OWeakObject*)pBookmark;
+ }
+ break;
+ case SW_SERVICE_TYPE_FOOTNOTE :
+ xRet = (cppu::OWeakObject*)new SwXFootnote(sal_False);
+ break;
+ case SW_SERVICE_TYPE_ENDNOTE :
+ xRet = (cppu::OWeakObject*)new SwXFootnote(sal_True);
+ break;
+ case SW_SERVICE_CONTENT_INDEX_MARK :
+ case SW_SERVICE_USER_INDEX_MARK :
+ case SW_SERVICE_TYPE_INDEXMARK:
+ {
+ TOXTypes eType = TOX_INDEX;
+ if(SW_SERVICE_CONTENT_INDEX_MARK== nObjectType)
+ eType = TOX_CONTENT;
+ else if(SW_SERVICE_USER_INDEX_MARK == nObjectType)
+ eType = TOX_USER;
+ xRet = (cppu::OWeakObject*)new SwXDocumentIndexMark(eType);
+ }
+ break;
+ case SW_SERVICE_CONTENT_INDEX :
+ case SW_SERVICE_USER_INDEX :
+ case SW_SERVICE_TYPE_INDEX :
+ case SW_SERVICE_INDEX_ILLUSTRATIONS:
+ case SW_SERVICE_INDEX_OBJECTS :
+ case SW_SERVICE_INDEX_TABLES:
+ case SW_SERVICE_INDEX_BIBLIOGRAPHY :
+ {
+ TOXTypes eType = TOX_INDEX;
+ if(SW_SERVICE_CONTENT_INDEX == nObjectType)
+ eType = TOX_CONTENT;
+ else if(SW_SERVICE_USER_INDEX == nObjectType)
+ eType = TOX_USER;
+ else if(SW_SERVICE_INDEX_ILLUSTRATIONS == nObjectType)
+ {
+ eType = TOX_ILLUSTRATIONS;
+ }
+ else if(SW_SERVICE_INDEX_OBJECTS == nObjectType)
+ {
+ eType = TOX_OBJECTS;
+ }
+ else if(SW_SERVICE_INDEX_BIBLIOGRAPHY == nObjectType)
+ {
+ eType = TOX_AUTHORITIES;
+ }
+ else if(SW_SERVICE_INDEX_TABLES == nObjectType)
+ {
+ eType = TOX_TABLES;
+ }
+ xRet = (cppu::OWeakObject*)new SwXDocumentIndex(eType, *pDoc);
+ }
+ break;
+ case SW_SERVICE_INDEX_HEADER_SECTION :
+ case SW_SERVICE_TEXT_SECTION :
+ xRet = (cppu::OWeakObject*)new SwXTextSection( 0, SW_SERVICE_INDEX_HEADER_SECTION == nObjectType);
+
+ break;
+ case SW_SERVICE_REFERENCE_MARK :
+ xRet = (cppu::OWeakObject*)new SwXReferenceMark(0, 0);
+ break;
+ case SW_SERVICE_STYLE_CHARACTER_STYLE:
+ case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
+ case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
+ case SW_SERVICE_STYLE_FRAME_STYLE:
+ case SW_SERVICE_STYLE_PAGE_STYLE:
+ case SW_SERVICE_STYLE_NUMBERING_STYLE:
+ {
+ SfxStyleFamily eFamily = SFX_STYLE_FAMILY_CHAR;
+ switch(nObjectType)
+ {
+ case SW_SERVICE_STYLE_PARAGRAPH_STYLE:
+ case SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE:
+ eFamily = SFX_STYLE_FAMILY_PARA;
+ break;
+ case SW_SERVICE_STYLE_FRAME_STYLE:
+ eFamily = SFX_STYLE_FAMILY_FRAME;
+ break;
+ case SW_SERVICE_STYLE_PAGE_STYLE:
+ eFamily = SFX_STYLE_FAMILY_PAGE;
+ break;
+ case SW_SERVICE_STYLE_NUMBERING_STYLE:
+ eFamily = SFX_STYLE_FAMILY_PSEUDO;
+ break;
+ }
+ SwXStyle* pNewStyle = SFX_STYLE_FAMILY_PAGE == eFamily ?
+ new SwXPageStyle(pDoc->GetDocShell()) :
+ eFamily == SFX_STYLE_FAMILY_FRAME ?
+ new SwXFrameStyle ( pDoc ):
+ new SwXStyle( pDoc, eFamily, nObjectType == SW_SERVICE_STYLE_CONDITIONAL_PARAGRAPH_STYLE);
+ xRet = (cppu::OWeakObject*)pNewStyle;
+ }
+ break;
+// SW_SERVICE_DUMMY_5
+// SW_SERVICE_DUMMY_6
+// SW_SERVICE_DUMMY_7
+// SW_SERVICE_DUMMY_8
+// SW_SERVICE_DUMMY_9
+ case SW_SERVICE_FIELDTYPE_DATETIME:
+ case SW_SERVICE_FIELDTYPE_USER:
+ case SW_SERVICE_FIELDTYPE_SET_EXP:
+ case SW_SERVICE_FIELDTYPE_GET_EXP:
+ case SW_SERVICE_FIELDTYPE_FILE_NAME:
+ case SW_SERVICE_FIELDTYPE_PAGE_NUM:
+ case SW_SERVICE_FIELDTYPE_AUTHOR:
+ case SW_SERVICE_FIELDTYPE_CHAPTER:
+ case SW_SERVICE_FIELDTYPE_GET_REFERENCE:
+ case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
+ case SW_SERVICE_FIELDTYPE_ANNOTATION:
+ case SW_SERVICE_FIELDTYPE_INPUT:
+ case SW_SERVICE_FIELDTYPE_MACRO:
+ case SW_SERVICE_FIELDTYPE_DDE:
+ case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
+ case SW_SERVICE_FIELDTYPE_DOC_INFO:
+ case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
+ case SW_SERVICE_FIELDTYPE_USER_EXT:
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_SET:
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_GET:
+ case SW_SERVICE_FIELDTYPE_JUMP_EDIT:
+ case SW_SERVICE_FIELDTYPE_SCRIPT:
+ case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET:
+ case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET:
+ case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM:
+ case SW_SERVICE_FIELDTYPE_DATABASE:
+ case SW_SERVICE_FIELDTYPE_DATABASE_NAME:
+ case SW_SERVICE_FIELDTYPE_PAGE_COUNT :
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT :
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT :
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT :
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT :
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT :
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_0 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_1 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_2 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_3 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION :
+ case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY:
+ case SW_SERVICE_FIELDTYPE_INPUT_USER :
+ case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT :
+ case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS :
+ case SW_SERVICE_FIELDTYPE_DROPDOWN :
+ case SW_SERVICE_FIELDTYPE_TABLE_FORMULA:
+ xRet = (cppu::OWeakObject*)new SwXTextField(nObjectType);
+ break;
+ case SW_SERVICE_FIELDMASTER_USER:
+ case SW_SERVICE_FIELDMASTER_DDE:
+ case SW_SERVICE_FIELDMASTER_SET_EXP :
+ case SW_SERVICE_FIELDMASTER_DATABASE:
+ {
+ sal_uInt16 nResId = USHRT_MAX;
+ switch(nObjectType)
+ {
+ case SW_SERVICE_FIELDMASTER_USER: nResId = RES_USERFLD; break;
+ case SW_SERVICE_FIELDMASTER_DDE: nResId = RES_DDEFLD; break;
+ case SW_SERVICE_FIELDMASTER_SET_EXP : nResId = RES_SETEXPFLD; break;
+ case SW_SERVICE_FIELDMASTER_DATABASE: nResId = RES_DBFLD; break;
+ }
+ xRet = (cppu::OWeakObject*)new SwXFieldMaster(pDoc, nResId);
+ }
+ break;
+ case SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY:
+ {
+ SwFieldType* pType = pDoc->GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(!pType)
+ {
+ SwAuthorityFieldType aType(pDoc);
+ pType = pDoc->InsertFldType(aType);
+ }
+ else
+ {
+ SwClientIter aIter( *pType );
+ SwXFieldMaster* pMaster = (SwXFieldMaster*)aIter.First( TYPE( SwXFieldMaster ));
+ if(pMaster)
+ xRet = (cppu::OWeakObject*)pMaster;
+ }
+ if(!xRet.is())
+ xRet = (cppu::OWeakObject*)new SwXFieldMaster(*pType, pDoc);
+ }
+ break;
+ case SW_SERVICE_PARAGRAPH :
+ xRet = (cppu::OWeakObject*)new SwXParagraph();
+ break;
+ case SW_SERVICE_NUMBERING_RULES :
+ xRet = (cppu::OWeakObject*)new SwXNumberingRules(*pDoc);
+ break;
+ case SW_SERVICE_TEXT_COLUMNS :
+ xRet = (cppu::OWeakObject*)new SwXTextColumns(0);
+ break;
+ case SW_SERVICE_DEFAULTS:
+ xRet = (cppu::OWeakObject*)new SwXTextDefaults( pDoc );
+ break;
+ case SW_SERVICE_IMAP_RECTANGLE :
+ xRet = SvUnoImageMapRectangleObject_createInstance( lcl_GetSupportedMacroItems() );
+ break;
+ case SW_SERVICE_IMAP_CIRCLE :
+ xRet = SvUnoImageMapCircleObject_createInstance( lcl_GetSupportedMacroItems() );
+ break;
+ case SW_SERVICE_IMAP_POLYGON :
+ xRet = SvUnoImageMapPolygonObject_createInstance( lcl_GetSupportedMacroItems() );
+ break;
+ default:
+ throw uno::RuntimeException();
+ }
+ return xRet;
+}
+
+/******************************************************************
+ * SwXTextTables
+ ******************************************************************/
+SwXTextTables::SwXTextTables(SwDoc* pDc) :
+ SwUnoCollection(pDc)
+{
+}
+
+SwXTextTables::~SwXTextTables()
+{
+}
+
+sal_Int32 SwXTextTables::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nRet = 0;
+ if(IsValid())
+ nRet = GetDoc()->GetTblFrmFmtCount(sal_True);
+ return nRet;
+}
+
+uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ if(0 <= nIndex && GetDoc()->GetTblFrmFmtCount(sal_True) > nIndex)
+ {
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt( nIndex, sal_True);
+ uno::Reference< XTextTable > xTbl = SwXTextTables::GetObject(rFmt);
+ aRet.setValue( &xTbl,
+ ::getCppuType((uno::Reference< XTextTable>*)0));
+ }
+ else
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Any SwXTextTables::getByName(const OUString& rItemName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
+ uno::Reference< XTextTable > xTbl;
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ String aName(rItemName);
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
+ if(aName == rFmt.GetName())
+ {
+ xTbl = SwXTextTables::GetObject(rFmt);
+ aRet.setValue(&xTbl,
+ ::getCppuType(( uno::Reference< XTextTable >*)0));
+ break;
+ }
+ }
+ if(!xTbl.is())
+ throw NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Sequence< OUString > SwXTextTables::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
+ uno::Sequence<OUString> aSeq(nCount);
+ if(nCount)
+ {
+ OUString* pArray = aSeq.getArray();
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
+
+ pArray[i] = OUString(rFmt.GetName());
+ }
+ }
+ return aSeq;
+}
+
+sal_Bool SwXTextTables::hasByName(const OUString& rName)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet= sal_False;
+ if(IsValid())
+ {
+ sal_uInt16 nCount = GetDoc()->GetTblFrmFmtCount(sal_True);
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ String aName(rName);
+ SwFrmFmt& rFmt = GetDoc()->GetTblFrmFmt(i, sal_True);
+ if(aName == rFmt.GetName())
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+
+uno::Type SAL_CALL
+ SwXTextTables::getElementType( )
+ throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextTable>*)0);
+}
+
+sal_Bool SwXTextTables::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return 0 != GetDoc()->GetTblFrmFmtCount(sal_True);
+}
+
+OUString SwXTextTables::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextTables");
+}
+
+sal_Bool SwXTextTables::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return rServiceName == C2U("com.sun.star.text.TextTables");
+}
+
+uno::Sequence< OUString > SwXTextTables::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArr = aRet.getArray();
+ pArr[0] = C2U("com.sun.star.text.TextTables");
+ return aRet;
+}
+
+XTextTable* SwXTextTables::GetObject( SwFrmFmt& rFmt )
+{
+ SolarMutexGuard aGuard;
+ SwXTextTable* pTbl = (SwXTextTable*)SwClientIter( rFmt ).
+ First( TYPE( SwXTextTable ));
+ if( !pTbl )
+ pTbl = new SwXTextTable(rFmt);
+ return pTbl ;
+}
+
+/******************************************************************
+ * SwXFrames
+ ******************************************************************/
+OUString SwXFrames::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFrames");
+}
+
+BOOL SwXFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextFrames") == rServiceName;
+}
+
+Sequence< OUString > SwXFrames::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFrames");
+ return aRet;
+}
+
+SwXFrames::SwXFrames(SwDoc* pDoc, FlyCntType eSet) :
+ SwUnoCollection(pDoc),
+ eType(eSet)
+{
+}
+
+SwXFrames::~SwXFrames()
+{
+}
+
+sal_Int32 SwXFrames::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_uInt16 nRet = 0;
+ if(IsValid())
+ nRet = GetDoc()->GetFlyCount(eType);
+ else
+ throw uno::RuntimeException();
+ return nRet;
+}
+
+uno::Any SwXFrames::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ sal_uInt16 nCount = GetDoc()->GetFlyCount(eType);
+ if( 0 <= nIndex && nIndex < USHRT_MAX && nCount > nIndex)
+ {
+ SwFrmFmt* pFmt = GetDoc()->GetFlyNum((sal_uInt16) nIndex, eType);
+ SwXFrame* pFrm = SwXFrames::GetObject(*pFmt, eType);
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ {
+ uno::Reference< XTextFrame > xRef = (SwXTextFrame*)pFrm;
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextFrame>*)0));
+ }
+ break;
+ case FLYCNTTYPE_GRF:
+ {
+ Reference< XTextContent > xRef = (SwXTextGraphicObject*)pFrm;
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ break;
+ case FLYCNTTYPE_OLE:
+ {
+ Reference< XEmbeddedObjectSupplier > xRef = (SwXTextEmbeddedObject*)pFrm;
+ aRet.setValue(&xRef, ::getCppuType((Reference<XEmbeddedObjectSupplier>*)0));
+ }
+ break;
+ }
+ }
+ else
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Any SwXFrames::getByName(const OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwXFrame* pFrm = 0;
+ if(IsValid())
+ {
+ sal_uInt16 nCount = GetDoc()->GetFlyCount(eType);
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ String aName(rName);
+ SwFrmFmt* pFmt = GetDoc()->GetFlyNum(i, eType);
+ if(aName == pFmt->GetName() )
+ {
+ pFrm = SwXFrames::GetObject(*pFmt, eType);
+ break;
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ if(!pFrm)
+ throw NoSuchElementException();
+ uno::Any aRet;
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ {
+ uno::Reference< XTextFrame > xRef = (SwXTextFrame*)pFrm;
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextFrame>*)0));
+ }
+ break;
+ case FLYCNTTYPE_GRF:
+ {
+ uno::Reference< XTextContent > xRef = (SwXTextGraphicObject*)pFrm;
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ break;
+ case FLYCNTTYPE_OLE:
+ {
+ Reference< XEmbeddedObjectSupplier > xRef = (SwXTextEmbeddedObject*)pFrm;
+ aRet.setValue(&xRef, ::getCppuType((Reference<XEmbeddedObjectSupplier>*)0));
+ }
+ break;
+ }
+ return aRet;
+}
+
+uno::Sequence< OUString > SwXFrames::getElementNames(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_uInt16 nCount = IsValid() ? GetDoc()->GetFlyCount(eType) : 0;
+ uno::Sequence<OUString> aSeq(nCount);
+ if(nCount)
+ {
+ OUString* pArray = aSeq.getArray();
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwFrmFmt* pFmt = GetDoc()->GetFlyNum(i, eType);
+ pArray[i] = pFmt->GetName();
+ }
+ }
+ return aSeq;
+}
+
+sal_Bool SwXFrames::hasByName(const OUString& rName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+
+ BYTE nNodeType = ND_TEXTNODE;
+ switch( eType )
+ {
+ case FLYCNTTYPE_GRF: nNodeType = ND_GRFNODE; break;
+ case FLYCNTTYPE_OLE: nNodeType = ND_OLENODE; break;
+ }
+
+ return 0 != GetDoc()->FindFlyByName( rName, nNodeType );
+}
+
+uno::Type SAL_CALL SwXFrames::getElementType() throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Type aRet;
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ aRet = ::getCppuType((uno::Reference<XTextFrame>*)0);
+
+ break;
+ case FLYCNTTYPE_GRF:
+ aRet = ::getCppuType((uno::Reference<XTextContent>*)0);
+
+ break;
+ case FLYCNTTYPE_OLE:
+ aRet = ::getCppuType((uno::Reference<XEmbeddedObjectSupplier>*)0);
+ break;
+ }
+ return aRet;
+}
+
+sal_Bool SwXFrames::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_uInt16 nRet = 0;
+ if(IsValid())
+ nRet = GetDoc()->GetFlyCount(eType);
+ else
+ throw uno::RuntimeException();
+ return nRet != 0;
+}
+
+SwXFrame* SwXFrames::GetObject( SwFrmFmt& rFmt, FlyCntType eType )
+{
+ SwXFrame* pFrm = (SwXFrame*)SwClientIter( rFmt ).
+ First( TYPE( SwXFrame ));
+ if( !pFrm )
+ {
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ pFrm = new SwXTextFrame(rFmt);
+ break;
+ case FLYCNTTYPE_GRF:
+ pFrm = new SwXTextGraphicObject(rFmt);
+ break;
+ case FLYCNTTYPE_OLE:
+ pFrm = new SwXTextEmbeddedObject(rFmt);
+ break;
+ }
+ }
+ return pFrm;
+}
+
+/******************************************************************
+ * SwXTextFrames
+ ******************************************************************/
+OUString SwXTextFrames::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextFrames");
+}
+
+BOOL SwXTextFrames::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextFrames") == rServiceName;
+}
+
+Sequence< OUString > SwXTextFrames::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFrames");
+ return aRet;
+}
+
+SwXTextFrames::SwXTextFrames(SwDoc* pDoc) :
+ SwXFrames(pDoc, FLYCNTTYPE_FRM)
+{
+}
+
+SwXTextFrames::~SwXTextFrames()
+{
+}
+
+/******************************************************************
+ * SwXTextGraphicObjects
+ ******************************************************************/
+OUString SwXTextGraphicObjects::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextGraphicObjects");
+}
+
+BOOL SwXTextGraphicObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextGraphicObjects") == rServiceName;
+}
+
+Sequence< OUString > SwXTextGraphicObjects::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextGraphicObjects");
+ return aRet;
+}
+
+SwXTextGraphicObjects::SwXTextGraphicObjects(SwDoc* pDoc) :
+ SwXFrames(pDoc, FLYCNTTYPE_GRF)
+{
+}
+
+SwXTextGraphicObjects::~SwXTextGraphicObjects()
+{
+}
+
+/******************************************************************
+ * SwXTextEmbeddedObjects
+ ******************************************************************/
+OUString SwXTextEmbeddedObjects::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextEmbeddedObjects");
+}
+
+BOOL SwXTextEmbeddedObjects::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextEmbeddedObjects") == rServiceName;
+}
+
+Sequence< OUString > SwXTextEmbeddedObjects::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextEmbeddedObjects");
+ return aRet;
+}
+
+SwXTextEmbeddedObjects::SwXTextEmbeddedObjects(SwDoc* pDoc) :
+ SwXFrames(pDoc, FLYCNTTYPE_OLE)
+{
+}
+
+SwXTextEmbeddedObjects::~SwXTextEmbeddedObjects()
+{
+}
+
+/******************************************************************
+ * SwXTextSections
+ ******************************************************************/
+#define PASSWORD_STD_TIMEOUT 1000
+
+OUString SwXTextSections::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextSections");
+}
+
+BOOL SwXTextSections::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextSections") == rServiceName;
+}
+
+Sequence< OUString > SwXTextSections::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextSections");
+ return aRet;
+}
+
+SwXTextSections::SwXTextSections(SwDoc* pDoc) :
+ SwUnoCollection(pDoc)
+{
+}
+
+SwXTextSections::~SwXTextSections()
+{
+}
+
+sal_Int32 SwXTextSections::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
+ sal_uInt16 nCount = rSectFmts.Count();
+ for(sal_uInt16 i = nCount; i; i--)
+ {
+ if( !rSectFmts[i - 1]->IsInNodesArr())
+ nCount--;
+ }
+ return nCount;
+}
+
+uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+
+ const SwSectionFmts& rSectFmts = GetDoc()->GetSections();
+ sal_uInt16 nCount = rSectFmts.Count();
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ if( !rSectFmts[i]->IsInNodesArr())
+ nIndex ++;
+ else if(nIndex == i)
+ break;
+ if(nIndex == i)
+ break;
+ }
+ if(nIndex >= 0 && nIndex < rFmts.Count())
+ {
+ SwSectionFmt* pFmt = rFmts[(sal_uInt16)nIndex];
+ uno::Reference< XTextSection > xSect = GetObject(*pFmt);
+ aRet.setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0));
+ }
+ else
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Any SwXTextSections::getByName(const OUString& Name)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ String aName(Name);
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ uno::Reference< XTextSection > xSect;
+ for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
+ {
+ SwSectionFmt* pFmt = rFmts[i];
+ if(pFmt->IsInNodesArr() && aName == pFmt->GetSection()->GetName())
+ {
+ xSect = GetObject(*pFmt);
+ aRet.setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0));
+ break;
+ }
+ }
+ if(!xSect.is())
+ throw NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Sequence< OUString > SwXTextSections::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_uInt16 nCount = GetDoc()->GetSections().Count();
+ SwSectionFmts& rSectFmts = GetDoc()->GetSections();
+ for(sal_uInt16 i = nCount; i; i--)
+ {
+ if( !rSectFmts[i - 1]->IsInNodesArr())
+ nCount--;
+ }
+
+ uno::Sequence<OUString> aSeq(nCount);
+ if(nCount)
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ OUString* pArray = aSeq.getArray();
+ sal_uInt16 nIndex = 0;
+ for( sal_uInt16 i = 0; i < nCount; i++, nIndex++)
+ {
+ const SwSectionFmt* pFmt = rFmts[nIndex];
+ while(!pFmt->IsInNodesArr())
+ {
+ pFmt = rFmts[++nIndex];
+ }
+ pArray[i] = pFmt->GetSection()->GetName();
+ }
+ }
+ return aSeq;
+}
+
+sal_Bool SwXTextSections::hasByName(const OUString& Name)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ String aName(Name);
+ if(IsValid())
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for(sal_uInt16 i = 0; i < rFmts.Count(); i++)
+ {
+ const SwSectionFmt* pFmt = rFmts[i];
+ if(aName == pFmt->GetSection()->GetName())
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ else
+ {
+ //Sonderbehandlung der dbg_ - Methoden
+ if( COMPARE_EQUAL != aName.CompareToAscii("dbg_", 4))
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+
+uno::Type SAL_CALL SwXTextSections::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextSection>*)0);
+}
+
+sal_Bool SwXTextSections::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_uInt16 nCount = 0;
+ if(IsValid())
+ {
+ SwSectionFmts& rFmts = GetDoc()->GetSections();
+ nCount = rFmts.Count();
+ }
+ else
+ throw uno::RuntimeException();
+ return nCount > 0;
+}
+
+XTextSection* SwXTextSections::GetObject( SwSectionFmt& rFmt )
+{
+ SwXTextSection* pSect = (SwXTextSection*)SwClientIter( rFmt ).
+ First( TYPE( SwXTextSection ));
+ if( !pSect )
+ pSect = new SwXTextSection(&rFmt);
+ return pSect;
+}
+
+/******************************************************************
+ * SwXBookmarks
+ ******************************************************************/
+OUString SwXBookmarks::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXBookmarks");
+}
+
+BOOL SwXBookmarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.Bookmarks") == rServiceName;
+}
+
+Sequence< OUString > SwXBookmarks::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.Bookmarks");
+ return aRet;
+}
+
+SwXBookmarks::SwXBookmarks(SwDoc* pDoc) :
+ SwUnoCollection(pDoc)
+{
+}
+
+SwXBookmarks::~SwXBookmarks()
+{
+}
+
+sal_Int32 SwXBookmarks::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetBookmarkCnt(sal_True);
+}
+
+uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ if(0 <= nIndex && GetDoc()->GetBookmarkCnt(sal_True) > nIndex)
+ {
+ SwBookmark& rBkm = GetDoc()->GetBookmark((sal_uInt16) nIndex, sal_True);
+ uno::Reference< XTextContent > xRef = GetObject(rBkm, GetDoc());
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ else
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Any SwXBookmarks::getByName(const ::rtl::OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ String aName(rName);
+ sal_uInt16 nCount = GetDoc()->GetBookmarkCnt(sal_True);
+ uno::Reference< XTextContent > xRef;
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwBookmark& rBkMk = GetDoc()->GetBookmark( i, sal_True );
+ if(rBkMk.GetName() == aName)
+ {
+ xRef = SwXBookmarks::GetObject(rBkMk, GetDoc());
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ break;
+ }
+ }
+ if(!xRef.is())
+ throw NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Sequence< OUString > SwXBookmarks::getElementNames(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_uInt16 nCount = GetDoc()->GetBookmarkCnt(sal_True);
+ uno::Sequence<OUString> aSeq(nCount);
+ if(nCount)
+ {
+ OUString* pArray = aSeq.getArray();
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwBookmark& rBkMk = GetDoc()->GetBookmark( i, sal_True );
+ pArray[i] = rBkMk.GetName();
+ }
+ }
+ return aSeq;
+}
+
+sal_Bool SwXBookmarks::hasByName(const OUString& rName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ if(IsValid())
+ {
+ String aName(rName);
+ sal_uInt16 nCount = GetDoc()->GetBookmarkCnt(sal_True);
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwBookmark& rBkMk = GetDoc()->GetBookmark( i, sal_True );
+ if(rBkMk.GetName() == aName)
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+
+uno::Type SAL_CALL SwXBookmarks::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextContent>*)0);
+}
+
+sal_Bool SwXBookmarks::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetBookmarkCnt(sal_True) != 0;
+}
+
+SwXBookmark* SwXBookmarks::GetObject( SwBookmark& rBkm, SwDoc* pDoc )
+{
+ SwXBookmark* pBkm = (SwXBookmark*)SwClientIter( rBkm ).
+ First( TYPE( SwXBookmark ));
+ if( !pBkm )
+ pBkm = new SwXBookmark(&rBkm, pDoc);
+ return pBkm;
+}
+
+/******************************************************************
+ * SwXFootnotes
+ ******************************************************************/
+OUString SwXFootnotes::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFootnotes");
+}
+
+BOOL SwXFootnotes::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.Footnotes") == rServiceName;
+}
+
+Sequence< OUString > SwXFootnotes::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.Footnotes");
+ return aRet;
+}
+
+SwXFootnotes::SwXFootnotes(sal_Bool bEnd, SwDoc* pDoc) :
+ SwUnoCollection(pDoc),
+ bEndnote(bEnd)
+{
+}
+
+SwXFootnotes::~SwXFootnotes()
+{
+}
+
+sal_Int32 SwXFootnotes::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ sal_Int32 nCount = 0;
+ sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count();
+ SwTxtFtn* pTxtFtn;
+ for( n = 0; n < nFtnCnt; ++n )
+ {
+ pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ if ( rFtn.IsEndNote() != bEndnote )
+ continue;
+ nCount++;
+ }
+ return nCount;
+}
+
+uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ sal_uInt32 nCount = 0;
+ if(IsValid())
+ {
+ sal_uInt16 n, nFtnCnt = GetDoc()->GetFtnIdxs().Count();
+ SwTxtFtn* pTxtFtn;
+ uno::Reference< XFootnote > xRef;
+ for( n = 0; n < nFtnCnt; ++n )
+ {
+ pTxtFtn = GetDoc()->GetFtnIdxs()[ n ];
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ if( rFtn.IsEndNote() != bEndnote )
+ continue;
+
+ if(nCount == nIndex)
+ {
+ xRef = new SwXFootnote(GetDoc(), rFtn);
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XFootnote>*)0));
+ break;
+ }
+ nCount++;
+ }
+ if(!xRef.is())
+ throw IndexOutOfBoundsException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Type SAL_CALL SwXFootnotes::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XFootnote>*)0);
+}
+
+sal_Bool SwXFootnotes::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetFtnIdxs().Count() > 0;
+}
+
+Reference<XFootnote> SwXFootnotes::GetObject( SwDoc& rDoc, const SwFmtFtn& rFmt )
+{
+ Reference<XTextContent> xContent = ((SwUnoCallBack*)rDoc.GetUnoCallBack())->
+ GetFootnote(rFmt);
+ if(!xContent.is())
+ xContent = new SwXFootnote(&rDoc, rFmt);
+ Reference<XFootnote> xRet(xContent, UNO_QUERY);
+ return xRet;
+}
+
+/******************************************************************
+ * SwXReferenceMarks
+ ******************************************************************/
+OUString SwXReferenceMarks::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXReferenceMarks");
+}
+
+BOOL SwXReferenceMarks::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.ReferenceMarks") == rServiceName;
+}
+
+Sequence< OUString > SwXReferenceMarks::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.ReferenceMarks");
+ return aRet;
+}
+
+SwXReferenceMarks::SwXReferenceMarks(SwDoc* pDoc) :
+ SwUnoCollection(pDoc)
+{
+}
+
+SwXReferenceMarks::~SwXReferenceMarks()
+{
+}
+
+sal_Int32 SwXReferenceMarks::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return GetDoc()->GetRefMarks();
+}
+
+uno::Any SwXReferenceMarks::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ uno::Reference< XTextContent > xRef;
+ if( nIndex < USHRT_MAX)
+ {
+ const SwFmtRefMark* pMark = GetDoc()->GetRefMark( (sal_uInt16) nIndex );
+ if(pMark)
+ {
+ xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ }
+ if(!xRef.is())
+ throw IndexOutOfBoundsException();
+ return aRet;
+}
+
+uno::Any SwXReferenceMarks::getByName(const OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ const SwFmtRefMark* pMark = GetDoc()->GetRefMark(rName);
+ if(pMark)
+ {
+ uno::Reference< XTextContent > xRef = SwXReferenceMarks::GetObject( GetDoc(), pMark );
+ aRet.setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ }
+ else
+ throw NoSuchElementException();
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+uno::Sequence< OUString > SwXReferenceMarks::getElementNames(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Sequence<OUString> aRet;
+ if(IsValid())
+ {
+ SvStringsDtor aStrings;
+ sal_uInt16 nCount = GetDoc()->GetRefMarks( &aStrings );
+ aRet.realloc(nCount);
+ OUString* pNames = aRet.getArray();
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ pNames[i] = *aStrings.GetObject(i);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+sal_Bool SwXReferenceMarks::hasByName(const OUString& rName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return 0 != GetDoc()->GetRefMark( rName);
+}
+
+uno::Type SAL_CALL SwXReferenceMarks::getElementType() throw(uno::RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextContent>*)0);
+}
+
+sal_Bool SwXReferenceMarks::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return 0 != GetDoc()->GetRefMarks();
+}
+
+SwXReferenceMark* SwXReferenceMarks::GetObject( SwDoc* pDoc, const SwFmtRefMark* pMark )
+{
+ SolarMutexGuard aGuard;
+ SwClientIter aIter( *pDoc->GetUnoCallBack() );
+ SwXReferenceMark* pxMark = (SwXReferenceMark*)aIter.First( TYPE( SwXReferenceMark ));
+ while(pxMark)
+ {
+ if(pxMark->GetMark() == pMark)
+ break;
+ pxMark = (SwXReferenceMark*)aIter.Next();
+ }
+ if( !pxMark )
+ pxMark = new SwXReferenceMark(pDoc, pMark);
+ return pxMark;
+}
+
+/*-----------------11.03.98 11:18-------------------
+ Gueltigkeitspruefung
+--------------------------------------------------*/
+void SwUnoCollection::Invalidate()
+{
+ bObjectValid = sal_False;
+ pDoc = 0;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unocrsrhelper.cxx b/binfilter/bf_sw/source/core/unocore/sw_unocrsrhelper.cxx
new file mode 100644
index 000000000000..2f431f26f107
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unocrsrhelper.cxx
@@ -0,0 +1,758 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <cmdid.h>
+
+#include <horiornt.hxx>
+#include <errhdl.hxx>
+
+#include <unocrsrhelper.hxx>
+#include <viscrs.hxx>
+#include <unoobj.hxx>
+#include <unostyle.hxx>
+#include <unomap.hxx>
+#include <unomid.h>
+#include <unoidx.hxx>
+#include <unofield.hxx>
+#include <unotbl.hxx>
+#include <unosett.hxx>
+#include <unocoll.hxx>
+#include <unoframe.hxx>
+#include <fmtftn.hxx>
+#include <fmtpdsc.hxx>
+#include <charfmt.hxx>
+#include <pagedesc.hxx>
+#include <docstyle.hxx>
+#include <ndtxt.hxx>
+#include <txtrfmrk.hxx>
+#include <fmtfld.hxx>
+#include <docsh.hxx>
+#include <section.hxx>
+#include <shellio.hxx>
+#include <edimp.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <bf_svtools/eitem.hxx>
+#include <bf_svtools/eitem.hxx>
+#include <tools/urlobj.hxx>
+#include <docary.hxx>
+#include <swtable.hxx>
+#include <tox.hxx>
+#include <doc.hxx>
+#include <fchrfmt.hxx>
+#include <bf_svx/flstitem.hxx>
+#include <vcl/metric.hxx>
+#include <bf_svtools/ctrltool.hxx>
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#include <bf_svtools/svstdarr.hxx>
+#include <bf_sfx2/docfilt.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <bf_sfx2/fcontnr.hxx>
+
+#include <bf_svtools/stritem.hxx>
+
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <SwStyleNameMapper.hxx>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+using rtl::OUString;
+
+
+namespace SwUnoCursorHelper
+{
+/* -----------------16.09.98 12:27-------------------
+ * Lesen spezieller Properties am Cursor
+ * --------------------------------------------------*/
+sal_Bool getCrsrPropertyValue(const SfxItemPropertyMap* pMap
+ , SwPaM& rPam
+ , Any *pAny
+ , PropertyState& eState
+ , const SwTxtNode* pNode )
+{
+ PropertyState eNewState = PropertyState_DIRECT_VALUE;
+// PropertyState_DEFAULT_VALUE
+// PropertyState_AMBIGUOUS_VALUE
+ sal_Bool bDone = sal_True;
+ switch(pMap->nWID)
+ {
+ case FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL:
+ if( pAny )
+ {
+ SwFmtColl* pFmt = 0;
+ if(pNode)
+ pFmt = pNode->GetFmtColl();
+ else
+ pFmt = SwXTextCursor::GetCurTxtFmtColl(rPam, FALSE);
+ sal_Int8 nRet = -1;
+ if(pFmt && ((SwTxtFmtColl*)pFmt)->GetOutlineLevel() != NO_NUMBERING)
+ nRet = ((SwTxtFmtColl*)pFmt)->GetOutlineLevel();
+ *pAny <<= nRet;
+ }
+ break;
+ case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
+ case FN_UNO_PARA_STYLE :
+ {
+ SwFmtColl* pFmt = 0;
+ if(pNode)
+ pFmt = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == pMap->nWID
+ ? pNode->GetFmtColl() : &pNode->GetAnyFmtColl();
+ else
+ pFmt = SwXTextCursor::GetCurTxtFmtColl(rPam, FN_UNO_PARA_CONDITIONAL_STYLE_NAME == pMap->nWID);
+ if(pFmt)
+ {
+ if( pAny )
+ {
+ String sVal;
+ SwStyleNameMapper::FillProgName(pFmt->GetName(), sVal, GET_POOLID_TXTCOLL, sal_True );
+ *pAny <<= OUString(sVal);
+ }
+ }
+ else
+ eNewState = PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ case FN_UNO_PAGE_STYLE :
+ {
+ String sVal;
+ GetCurPageStyle(rPam, sVal);
+ if( pAny )
+ *pAny <<= OUString(sVal);
+ if(!sVal.Len())
+ eNewState = PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ case FN_UNO_NUM_START_VALUE :
+ if( pAny )
+ {
+ sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
+ *pAny <<= nValue;
+ }
+ break;
+ case FN_UNO_NUM_LEVEL :
+ case FN_UNO_IS_NUMBER :
+ case FN_NUMBER_NEWSTART:
+ {
+ const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
+ const SwNumRule* pRule = pTxtNd->GetNumRule();
+ // hier wird Multiselektion nicht beruecksichtigt
+ if( pRule && pTxtNd->GetNum() )
+ {
+ if( pAny )
+ {
+ if(pMap->nWID == FN_UNO_NUM_LEVEL)
+ *pAny <<= (sal_Int16)(pTxtNd->GetNum()->GetLevel()&~NO_NUMLEVEL);
+ else if(pMap->nWID == FN_UNO_IS_NUMBER)
+ {
+ BOOL bIsNumber = 0 == (pTxtNd->GetNum()->GetLevel() & NO_NUMLEVEL);
+ pAny->setValue(&bIsNumber, ::getBooleanCppuType());
+ }
+ else /*if(pMap->nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
+ {
+ BOOL bIsRestart = pTxtNd->GetNum()->IsStart();
+ pAny->setValue(&bIsRestart, ::getBooleanCppuType());
+ }
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ //PROPERTY_MAYBEVOID!
+ }
+ break;
+ case FN_UNO_NUM_RULES :
+ if( pAny )
+ getNumberingProperty(rPam, eNewState, pAny);
+ else
+ {
+ if( !rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() ) )
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_DOCUMENT_INDEX_MARK:
+ {
+ SwTxtAttr* pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ rPam.GetPoint()->nContent, RES_TXTATR_TOXMARK);
+ if(pTxtAttr)
+ {
+ if( pAny )
+ {
+ const SwTOXMark& rMark = pTxtAttr->GetTOXMark();
+ Reference< XDocumentIndexMark > xRef = SwXDocumentIndexMark::GetObject(
+ (SwTOXType*)rMark.GetTOXType(), &rMark, rPam.GetDoc());
+ pAny->setValue(&xRef, ::getCppuType((Reference<XDocumentIndex>*)0));
+ }
+ }
+ else
+ //auch hier - nicht zu unterscheiden
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_DOCUMENT_INDEX:
+ {
+ const SwTOXBase* pBase = rPam.GetDoc()->GetCurTOX(
+ *rPam.Start() );
+ if( pBase )
+ {
+ if( pAny )
+ {
+ Reference< XDocumentIndex > aRef =
+ SwXDocumentIndexes::GetObject((SwTOXBaseSection*)pBase);
+ pAny->setValue(&aRef, ::getCppuType((Reference<XDocumentIndex>*)0));
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_TEXT_FIELD:
+ {
+ const SwPosition *pPos = rPam.Start();
+ const SwTxtNode *pTxtNd =
+ rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTxtNode();
+ SwTxtAttr* pTxtAttr =
+ pTxtNd ? pTxtNd->GetTxtAttr(pPos->nContent, RES_TXTATR_FIELD)
+ : 0;
+ if(pTxtAttr)
+ {
+ if( pAny )
+ {
+ const SwFmtFld& rFld = pTxtAttr->GetFld();
+ SwClientIter aIter(*rFld.GetFld()->GetTyp());
+ SwXTextField* pFld = 0;
+ SwXTextField* pTemp = (SwXTextField*)aIter.First(TYPE(SwXTextField));
+ while(pTemp && !pFld)
+ {
+ if(pTemp->GetFldFmt() == &rFld)
+ pFld = pTemp;
+ pTemp = (SwXTextField*)aIter.Next();
+ }
+ if(!pFld)
+ pFld = new SwXTextField( rFld, rPam.GetDoc());
+ Reference< XTextField > xRet = pFld;
+ pAny->setValue(&xRet, ::getCppuType((Reference<XTextField>*)0));
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+/* laesst sich nicht feststellen
+* case FN_UNO_BOOKMARK:
+ {
+ if()
+ {
+ Reference< XBookmark > xBkm = SwXBookmarks::GetObject(rBkm);
+ rAny.set(&xBkm, ::getCppuType((const XBookmark*)0)());
+ }
+ }
+ break;*/
+ case FN_UNO_TEXT_TABLE:
+ case FN_UNO_CELL:
+ {
+ SwStartNode* pSttNode = rPam.GetNode()->FindStartNode();
+ SwStartNodeType eType = pSttNode->GetStartNodeType();
+ if(SwTableBoxStartNode == eType)
+ {
+ if( pAny )
+ {
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
+ SwTable& rTable = ((SwTableNode*)pSttNode)->GetTable();
+ if(FN_UNO_TEXT_TABLE == pMap->nWID)
+ {
+ Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFmt);
+ pAny->setValue(&xTable, ::getCppuType((Reference<XTextTable>*)0));
+ }
+ else
+ {
+ SwTableBox* pBox = pSttNode->GetTblBox();
+ Reference< XCell > xCell = SwXCell::CreateXCell(pTableFmt, pBox);
+ pAny->setValue(&xCell, ::getCppuType((Reference<XCell>*)0));
+ }
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_TEXT_FRAME:
+ {
+ SwStartNode* pSttNode = rPam.GetNode()->FindStartNode();
+ SwStartNodeType eType = pSttNode->GetStartNodeType();
+
+ SwFrmFmt* pFmt;
+ if(eType == SwFlyStartNode && 0 != (pFmt = pSttNode->GetFlyFmt()))
+ {
+ if( pAny )
+ {
+ Reference< XTextFrame > xFrm = (SwXTextFrame*) SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM);
+ pAny->setValue(&xFrm, ::getCppuType((Reference<XTextFrame>*)0));
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_TEXT_SECTION:
+ {
+ SwSection* pSect = rPam.GetDoc()->GetCurrSection(*rPam.GetPoint());
+ if(pSect)
+ {
+ if( pAny )
+ {
+ Reference< XTextSection > xSect = SwXTextSections::GetObject( *pSect->GetFmt() );
+ pAny->setValue(&xSect, ::getCppuType((Reference<XTextSection>*)0) );
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_ENDNOTE:
+ case FN_UNO_FOOTNOTE:
+ {
+ SwTxtAttr* pTxtAttr = rPam.GetNode()->GetTxtNode()->
+ GetTxtAttr(rPam.GetPoint()->nContent, RES_TXTATR_FTN);
+ if(pTxtAttr)
+ {
+ const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
+ if(rFtn.IsEndNote() == (FN_UNO_ENDNOTE == pMap->nWID))
+ {
+ if( pAny )
+ {
+ Reference< XFootnote > xFoot = new SwXFootnote(rPam.GetDoc(), rFtn);
+ pAny->setValue(&xFoot, ::getCppuType((Reference<XFootnote>*)0));
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_REFERENCE_MARK:
+ {
+ SwTxtAttr* pTxtAttr = rPam.GetNode()->GetTxtNode()->
+ GetTxtAttr(rPam.GetPoint()->nContent, RES_TXTATR_REFMARK);
+ if(pTxtAttr)
+ {
+ if( pAny )
+ {
+ const SwFmtRefMark& rRef = pTxtAttr->GetRefMark();
+ Reference< XTextContent > xRef = SwXReferenceMarks::GetObject( rPam.GetDoc(), &rRef );
+ pAny->setValue(&xRef, ::getCppuType((Reference<XTextContent>*)0));
+ }
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case FN_UNO_CHARFMT_SEQUENCE:
+ {
+
+ SwTxtNode* pTxtNode;
+ if((pTxtNode = (SwTxtNode*)rPam.GetNode( TRUE )) == rPam.GetNode(FALSE) &&
+ pTxtNode->GetpSwpHints())
+ {
+ USHORT nPaMStart = rPam.GetPoint()->nContent.GetIndex();
+ USHORT nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
+ if(nPaMStart > nPaMEnd)
+ {
+ USHORT nTmp = nPaMStart;
+ nPaMStart = nPaMEnd;
+ nPaMEnd = nTmp;
+ }
+ Sequence< ::rtl::OUString> aCharStyles;
+ USHORT nCharStylesFound = 0;
+ SwpHints* pHints = pTxtNode->GetpSwpHints();
+ for(USHORT nAttr = 0; nAttr < pHints->GetStartCount(); nAttr++ )
+ {
+ SwTxtAttr* pAttr = pHints->GetStart( nAttr );
+ if(pAttr->Which() != RES_TXTATR_CHARFMT)
+ continue;
+ USHORT nAttrStart = *pAttr->GetStart();
+ USHORT nAttrEnd = *pAttr->GetEnd();
+ //check if the attribute touches the selection
+ if(nAttrEnd > nPaMStart && nAttrStart < nPaMEnd && nAttrEnd > nPaMStart)
+ {
+ //check for overlapping
+ if(nAttrStart > nPaMStart ||
+ nAttrEnd < nPaMEnd)
+ {
+ aCharStyles.realloc(0);
+ eNewState = PropertyState_AMBIGUOUS_VALUE;
+ break;
+ }
+ else
+ {
+ //now the attribute should start before or at the selection
+ //and it should end at the end of the selection or behind
+ DBG_ASSERT(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
+ "attribute overlaps or is outside");
+ //now the name of the style has to be added to the sequence
+ aCharStyles.realloc(aCharStyles.getLength() + 1);
+ DBG_ASSERT(pAttr->GetCharFmt().GetCharFmt(), "no character format set");
+ aCharStyles.getArray()[aCharStyles.getLength() - 1] =
+ SwStyleNameMapper::GetProgName(
+ pAttr->GetCharFmt().GetCharFmt()->GetName(), GET_POOLID_CHRFMT);
+ }
+ }
+
+ }
+ if(aCharStyles.getLength())
+ eNewState = PropertyState_DIRECT_VALUE;
+ if(pAny)
+ (*pAny) <<= aCharStyles;
+ }
+ else
+ eNewState = PropertyState_DEFAULT_VALUE;
+ }
+ break;
+ case RES_TXTATR_CHARFMT:
+ // kein break hier!
+ default: bDone = sal_False;
+ }
+ if( bDone )
+ eState = eNewState;
+ return bDone;
+};
+/* -----------------30.06.98 10:30-------------------
+ *
+ * --------------------------------------------------*/
+sal_Int16 IsNodeNumStart(SwPaM& rPam, PropertyState& eState)
+{
+ const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
+ if( pTxtNd && pTxtNd->GetNum() && pTxtNd->GetNumRule() )
+ {
+ eState = PropertyState_DIRECT_VALUE;
+ sal_uInt16 nTmp = pTxtNd->GetNum()->GetSetValue();
+ return USHRT_MAX == nTmp ? -1 : (sal_Int16)nTmp;
+ }
+ eState = PropertyState_DEFAULT_VALUE;
+ return -1;
+}
+
+/* -----------------25.05.98 11:41-------------------
+ *
+ * --------------------------------------------------*/
+void setNumberingProperty(const Any& rValue, SwPaM& rPam)
+{
+ Reference<XIndexReplace> xIndexReplace;
+ if(rValue >>= xIndexReplace)
+ {
+ SwXNumberingRules* pSwNum = 0;
+
+ Reference<XUnoTunnel> xNumTunnel(xIndexReplace, UNO_QUERY);
+ if(xNumTunnel.is())
+ {
+ pSwNum = (SwXNumberingRules*)
+ xNumTunnel->getSomething( SwXNumberingRules::getUnoTunnelId() );
+ }
+
+ if(pSwNum)
+ {
+ if(pSwNum->GetNumRule())
+ {
+ SwDoc* pDoc = rPam.GetDoc();
+ SwNumRule aRule(*pSwNum->GetNumRule());
+ const String* pNewCharStyles = pSwNum->GetNewCharStyleNames();
+ const String* pBulletFontNames = pSwNum->GetBulletFontNames();
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ {
+ SwNumFmt aFmt(aRule.Get( i ));
+ if( pNewCharStyles[i].Len() &&
+ pNewCharStyles[i] != SwXNumberingRules::GetInvalidStyle() &&
+ (!aFmt.GetCharFmt() || pNewCharStyles[i] != aFmt.GetCharFmt()->GetName()))
+ {
+ if(!pNewCharStyles[i].Len())
+ aFmt.SetCharFmt(0);
+ else
+ {
+
+ // CharStyle besorgen und an der chaos::Rule setzen
+ sal_uInt16 nChCount = pDoc->GetCharFmts()->Count();
+ SwCharFmt* pCharFmt = 0;
+ for(sal_uInt16 i = 0; i< nChCount; i++)
+ {
+ SwCharFmt& rChFmt = *((*(pDoc->GetCharFmts()))[i]);;
+ if(rChFmt.GetName() == pNewCharStyles[i])
+ {
+ pCharFmt = &rChFmt;
+ break;
+ }
+ }
+
+ if(!pCharFmt)
+ {
+ SfxStyleSheetBasePool* pPool = pDoc->GetDocShell()->GetStyleSheetPool();
+ SfxStyleSheetBase* pBase;
+ pBase = pPool->Find(pNewCharStyles[i], SFX_STYLE_FAMILY_CHAR);
+ // soll das wirklich erzeugt werden?
+ if(!pBase)
+ pBase = &pPool->Make(pNewCharStyles[i], SFX_STYLE_FAMILY_PAGE);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+ }
+ if(pCharFmt)
+ aFmt.SetCharFmt(pCharFmt);
+ }
+ }
+ //jetzt nochmal fuer Fonts
+ if(pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() &&
+ ((pBulletFontNames[i].Len() && !aFmt.GetBulletFont()) ||
+ pBulletFontNames[i].Len() &&
+ aFmt.GetBulletFont()->GetName() != pBulletFontNames[i] ))
+ {
+ const SvxFontListItem* pFontListItem =
+ (const SvxFontListItem* )pDoc->GetDocShell()
+ ->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFontListItem->GetFontList();
+
+ FontInfo aInfo = pList->Get(
+ pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
+ Font aFont(aInfo);
+ aFmt.SetBulletFont(&aFont);
+ }
+ aRule.Set( i, aFmt );
+ }
+ UnoActionContext aAction(pDoc);
+
+ if( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
+ {
+ SwPamRanges aRangeArr( rPam );
+ SwPaM aPam( *rPam.GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule );
+ }
+ else
+ pDoc->SetNumRule( rPam, aRule );
+
+
+ }
+ else if(pSwNum->GetCreatedNumRuleName().Len())
+ {
+ SwDoc* pDoc = rPam.GetDoc();
+ UnoActionContext aAction(pDoc);
+ SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
+ if(!pRule)
+ throw RuntimeException();
+ pDoc->SetNumRule( rPam, *pRule );
+ }
+ }
+ }
+ else if(rValue.getValueType() == ::getVoidCppuType())
+ {
+ rPam.GetDoc()->DelNumRules(rPam);
+ }
+}
+
+
+/* -----------------25.05.98 11:40-------------------
+ *
+ * --------------------------------------------------*/
+void getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
+{
+ const SwNumRule* pNumRule = rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() );
+ if(pNumRule)
+ {
+ Reference< XIndexReplace > xNum = new SwXNumberingRules(*pNumRule);
+ if ( pAny )
+ pAny->setValue(&xNum, ::getCppuType((const Reference<XIndexReplace>*)0));
+ eState = PropertyState_DIRECT_VALUE;
+ }
+ else
+ eState = PropertyState_DEFAULT_VALUE;
+}
+/* -----------------04.07.98 15:15-------------------
+ *
+ * --------------------------------------------------*/
+void GetCurPageStyle(SwPaM& rPaM, String &rString)
+{
+ const SwPageFrm* pPage = rPaM.GetCntntNode()->GetFrm()->FindPageFrm();
+ if(pPage)
+ SwStyleNameMapper::FillProgName( pPage->GetPageDesc()->GetName(), rString, GET_POOLID_PAGEDESC, sal_True );
+}
+/* -----------------30.03.99 10:52-------------------
+ * spezielle Properties am Cursor zuruecksetzen
+ * --------------------------------------------------*/
+void resetCrsrPropertyValue(const SfxItemPropertyMap* pMap, SwPaM& rPam)
+{
+ SwDoc* pDoc = rPam.GetDoc();
+ switch(pMap->nWID)
+ {
+ case FN_UNO_PARA_STYLE :
+// lcl_SetTxtFmtColl(aValue, pUnoCrsr);
+ break;
+ case FN_UNO_PAGE_STYLE :
+ break;
+ case FN_UNO_NUM_START_VALUE :
+ {
+ UnoActionContext aAction(pDoc);
+
+ if( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
+ {
+ SwPamRanges aRangeArr( rPam );
+ SwPaM aPam( *rPam.GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
+ }
+ else
+ pDoc->SetNodeNumStart( *rPam.GetPoint(), 0 );
+ }
+
+ break;
+ case FN_UNO_NUM_LEVEL :
+ break;
+ case FN_UNO_NUM_RULES:
+// lcl_setNumberingProperty(aValue, pUnoCrsr);
+ break;
+ case FN_UNO_CHARFMT_SEQUENCE:
+ {
+ SvUShortsSort aWhichIds;
+ aWhichIds.Insert(RES_TXTATR_CHARFMT);
+ pDoc->ResetAttr(rPam, sal_True, &aWhichIds);
+ }
+ break;
+ }
+}
+/* -----------------21.07.98 11:36-------------------
+ *
+ * --------------------------------------------------*/
+void InsertFile(SwUnoCrsr* pUnoCrsr,
+ const String& rFileName,
+ const String& rFilterName,
+ const String& rFilterOption,
+ const String& rPassword)
+{
+ SfxMedium* pMed = 0;
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ SwDocShell* pDocSh = pDoc->GetDocShell();
+ if(!pDocSh || !rFileName.Len())
+ return;
+
+ SfxObjectFactory& rFact = pDocSh->GetFactory();
+ const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter( rFilterName );
+ if ( !pFilter )
+ {
+ pMed = new SfxMedium(rFileName, STREAM_READ, sal_True, 0, 0 );
+ SfxFilterMatcher aMatcher( rFact.GetFilterContainer() );
+ ErrCode nErr = aMatcher.GuessFilter( *pMed, &pFilter, sal_False );
+ if ( nErr || !pFilter)
+ DELETEZ(pMed);
+ else
+ pMed->SetFilter( pFilter );
+ }
+ else
+ {
+ pMed = new SfxMedium(rFileName, STREAM_READ, sal_True,
+ pFilter, 0);
+ if(rFilterOption.Len())
+ {
+ SfxItemSet* pSet = pMed->GetItemSet();
+ SfxStringItem aOptionItem(SID_FILE_FILTEROPTIONS, rFilterOption);
+ pSet->Put(aOptionItem);
+ }
+ }
+
+ if( !pMed )
+ return;
+
+ SfxObjectShellRef aRef( pDocSh );
+
+ pDocSh->RegisterTransfer( *pMed );
+ pMed->DownLoad(); // ggfs. den DownLoad anstossen
+ if( aRef.Is() && 1 < aRef->GetRefCount() ) // noch gueltige Ref?
+ {
+ SwReader* pRdr;
+ SfxItemSet* pSet = pMed->GetItemSet();
+ pSet->Put(SfxBoolItem(FN_API_CALL, sal_True));
+ if(rPassword.Len())
+ pSet->Put(SfxStringItem(SID_PASSWORD, rPassword));
+ Reader *pRead = pDocSh->StartConvertFrom( *pMed, &pRdr, 0, pUnoCrsr);
+ if( pRead )
+ {
+ String sTmpBaseURL( ::binfilter::StaticBaseUrl::GetBaseURL() );
+ ::binfilter::StaticBaseUrl::SetBaseURL( pMed->GetName() );
+
+ UnoActionContext aContext(pDoc);
+
+ if(pUnoCrsr->HasMark())
+ pDoc->DeleteAndJoin(*pUnoCrsr);
+
+ SwNodeIndex aSave( pUnoCrsr->GetPoint()->nNode, -1 );
+ xub_StrLen nCntnt = pUnoCrsr->GetPoint()->nContent.GetIndex();
+
+ sal_uInt32 nErrno = pRdr->Read( *pRead ); // und Dokument einfuegen
+
+ if(!nErrno)
+ {
+ aSave++;
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetMark()->nNode = aSave;
+
+ SwCntntNode* pCntNode = aSave.GetNode().GetCntntNode();
+ if( !pCntNode )
+ nCntnt = 0;
+ pUnoCrsr->GetMark()->nContent.Assign( pCntNode, nCntnt );
+ }
+
+ delete pRdr;
+
+ ::binfilter::StaticBaseUrl::SetBaseURL( sTmpBaseURL );
+
+ // ggfs. alle Verzeichnisse updaten:
+/* if( pWrtShell->IsUpdateTOX() )
+ {
+ SfxRequest aReq( *this, FN_UPDATE_TOX );
+ Execute( aReq );
+ pWrtShell->SetUpdateTOX( sal_False ); // wieder zurueck setzen
+ }*/
+
+ }
+ }
+ delete pMed;
+}
+
+}//namespace SwUnoCursorHelper
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unodraw.cxx b/binfilter/bf_sw/source/core/unocore/sw_unodraw.cxx
new file mode 100644
index 000000000000..d1edfcc67818
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unodraw.cxx
@@ -0,0 +1,1668 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+
+#include <unomid.h>
+#include <unodraw.hxx>
+#include <unocoll.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoframe.hxx>
+#include <unoprnms.hxx>
+#include <bf_svx/unoprnms.hxx>
+#include <unoobj.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <unomap.hxx>
+#include <unoport.hxx>
+#include <unocrsr.hxx>
+#include <dflyobj.hxx>
+#include <ndtxt.hxx>
+#include <bf_svx/svdview.hxx>
+#include <bf_svx/unoshape.hxx>
+#include <dcontact.hxx>
+#include <bf_svx/fmglob.hxx>
+#include <fmtornt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtsrnd.hxx>
+#include <rootfrm.hxx>
+
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <crstate.hxx>
+#include <osl/mutex.hxx>
+#include <comphelper/extract.hxx>
+#include <comphelper/stl_types.hxx>
+#include <bf_svx/scene3d.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <bf_sfx2/sfxuno.hxx>
+namespace binfilter {
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::drawing;
+
+using rtl::OUString;
+
+DECLARE_STL_USTRINGACCESS_MAP( Sequence< sal_Int8 > *, SwShapeImplementationIdMap );
+
+static SwShapeImplementationIdMap aImplementationIdMap;
+
+class SwShapeDescriptor_Impl
+{
+ SwFmtHoriOrient* pHOrient;
+ SwFmtVertOrient* pVOrient;
+ SwFmtAnchor* pAnchor;
+ SwFmtSurround* pSurround;
+ SvxULSpaceItem* pULSpace;
+ SvxLRSpaceItem* pLRSpace;
+ sal_Bool bOpaque;
+ uno::Reference< XTextRange > xTextRange;
+
+public:
+ SwShapeDescriptor_Impl() :
+ pHOrient(0),
+ pVOrient(0),
+ pAnchor(0),
+ pSurround(0),
+ pULSpace(0),
+ pLRSpace(0),
+ bOpaque(sal_False)
+ {}
+
+ ~SwShapeDescriptor_Impl()
+ {
+ delete pHOrient;
+ delete pVOrient;
+ delete pAnchor;
+ delete pSurround;
+ delete pULSpace;
+ delete pLRSpace;
+ }
+ SwFmtAnchor* GetAnchor(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pAnchor)
+ pAnchor = new SwFmtAnchor(FLY_IN_CNTNT);
+ return pAnchor;
+ }
+ SwFmtHoriOrient* GetHOrient(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pHOrient)
+ pHOrient = new SwFmtHoriOrient();
+ return pHOrient;
+ }
+ SwFmtVertOrient* GetVOrient(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pVOrient)
+ pVOrient = new SwFmtVertOrient(0, VERT_TOP);
+ return pVOrient;
+ }
+
+ SwFmtSurround* GetSurround(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pSurround)
+ pSurround = new SwFmtSurround();
+ return pSurround;
+ }
+ SvxLRSpaceItem* GetLRSpace(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pLRSpace)
+ pLRSpace = new SvxLRSpaceItem();
+ return pLRSpace;
+ }
+ SvxULSpaceItem* GetULSpace(sal_Bool bCreate = sal_False)
+ {
+ if(bCreate && !pULSpace)
+ pULSpace = new SvxULSpaceItem();
+ return pULSpace;
+ }
+ uno::Reference< XTextRange > & GetTextRange()
+ {
+ return xTextRange;
+ }
+ sal_Bool IsOpaque()
+ {
+ return bOpaque;
+ }
+ const sal_Bool& GetOpaque()
+ {
+ return bOpaque;
+ }
+ void RemoveHOrient(){DELETEZ(pHOrient);}
+ void RemoveVOrient(){DELETEZ(pVOrient);}
+ void RemoveAnchor(){DELETEZ(pAnchor);}
+ void RemoveSurround(){DELETEZ(pSurround);}
+ void RemoveULSpace(){DELETEZ(pULSpace);}
+ void RemoveLRSpace(){DELETEZ(pLRSpace);}
+ void SetOpaque(sal_Bool bSet){bOpaque = bSet;}
+};
+
+/****************************************************************************
+ class SwFmDrawPage
+****************************************************************************/
+SwFmDrawPage::SwFmDrawPage( SdrPage* pPage ) :
+ SvxFmDrawPage( pPage ), pPageView(0)
+{
+}
+
+SwFmDrawPage::~SwFmDrawPage() throw ()
+{
+ RemovePageView();
+}
+
+const SdrMarkList& SwFmDrawPage::PreGroup(const uno::Reference< drawing::XShapes > & xShapes)
+{
+ _SelectObjectsInView( xShapes, GetPageView() );
+ const SdrMarkList& rMarkList = pView->GetMarkList();
+ return rMarkList;
+}
+
+void SwFmDrawPage::PreUnGroup(const uno::Reference< drawing::XShapeGroup > xShapeGroup)
+{
+ uno::Reference< drawing::XShape > xShape(xShapeGroup, UNO_QUERY);
+ _SelectObjectInView( xShape, GetPageView() );
+}
+
+SdrPageView* SwFmDrawPage::GetPageView()
+{
+ if(!pPageView)
+ pPageView = pView->ShowPage( pPage, Point() );
+ return pPageView;
+}
+
+void SwFmDrawPage::RemovePageView()
+{
+ if(pPageView && pView)
+ pView->HidePage( pPageView );
+ pPageView = 0;
+}
+
+uno::Reference< uno::XInterface > SwFmDrawPage::GetInterface( SdrObject* pObj )
+{
+ uno::Reference< XInterface > xShape;
+ if( pObj )
+ {
+ SwFrmFmt* pFmt = ::binfilter::FindFrmFmt( pObj );
+ SwXShape* pxShape = (SwXShape*)SwClientIter( *pFmt ).
+ First( TYPE( SwXShape ));
+ if(pxShape)
+ {
+ xShape = *(cppu::OWeakObject*)pxShape;
+ }
+ else
+ xShape = pObj->getUnoShape();
+ }
+ return xShape;
+}
+
+SdrObject* SwFmDrawPage::_CreateSdrObject( const uno::Reference< drawing::XShape > & xShape ) throw ()
+{
+ //TODO: stimmt das so - kann die Methode weg?
+ return SvxFmDrawPage::_CreateSdrObject( xShape );
+}
+
+uno::Reference< drawing::XShape > SwFmDrawPage::_CreateShape( SdrObject *pObj ) const throw ()
+{
+ uno::Reference< drawing::XShape > xRet;
+ if(pObj->IsWriterFlyFrame() || pObj->GetObjInventor() == SWGInventor)
+ {
+ SwFlyDrawContact* pFlyContact = (SwFlyDrawContact*)pObj->GetUserCall();
+ if(pFlyContact)
+ {
+ FlyCntType eType;
+ SwFrmFmt* pFlyFmt = pFlyContact->GetFmt();
+ SwDoc* pDoc = pFlyFmt->GetDoc();
+ const SwNodeIndex* pIdx;
+ if( RES_FLYFRMFMT == pFlyFmt->Which()
+ && 0 != ( pIdx = pFlyFmt->GetCntnt().GetCntntIdx() )
+ && pIdx->GetNodes().IsDocNodes()
+ )
+ {
+ const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
+ if(!pNd->IsNoTxtNode())
+ eType = FLYCNTTYPE_FRM;
+ else if( pNd->IsGrfNode() )
+ eType = FLYCNTTYPE_GRF;
+ else if( pNd->IsOLENode() )
+ eType = FLYCNTTYPE_OLE;
+ }
+ else
+ throw RuntimeException();
+ xRet = SwXFrames::GetObject( *pFlyFmt, eType );
+ }
+ }
+ else
+ {
+ // own block - temporary object has to be destroyed before the delegator is set
+ {
+ xRet = SvxFmDrawPage::_CreateShape( pObj );
+ }
+ uno::Reference< XUnoTunnel > xShapeTunnel(xRet, uno::UNO_QUERY);
+ //don't create an SwXShape if it already exists
+ SwXShape* pShape = 0;
+ if(xShapeTunnel.is())
+ pShape = (SwXShape*)xShapeTunnel->getSomething(SwXShape::getUnoTunnelId());
+ if(!pShape)
+ {
+ xShapeTunnel = 0;
+ uno::Reference< uno::XInterface > xCreate(xRet, uno::UNO_QUERY);
+ xRet = 0;
+ Reference< XPropertySet > xPrSet;
+ if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || ( PTR_CAST(E3dScene,pObj ) != NULL ) ) )
+ xPrSet = new SwXGroupShape( xCreate );
+ else
+ xPrSet = new SwXShape( xCreate );
+ xRet = uno::Reference< drawing::XShape >(xPrSet, uno::UNO_QUERY);
+ }
+ }
+ return xRet;
+}
+
+/****************************************************************************
+ class SwXDrawPage
+****************************************************************************/
+OUString SwXDrawPage::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXDrawPage");
+}
+
+BOOL SwXDrawPage::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.drawing.GenericDrawPage") == rServiceName;
+}
+
+Sequence< OUString > SwXDrawPage::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.drawing.GenericDrawPage");
+ return aRet;
+}
+
+SwXDrawPage::SwXDrawPage(SwDoc* pDc) :
+ pDoc(pDc),
+ pDrawPage(0)
+{
+}
+
+SwXDrawPage::~SwXDrawPage()
+{
+ if(xPageAgg.is())
+ {
+ uno::Reference< uno::XInterface > xInt;
+ xPageAgg->setDelegator(xInt);
+ }
+}
+
+Any SwXDrawPage::queryInterface( const Type& aType ) throw(RuntimeException)
+{
+ Any aRet = SwXDrawPageBaseClass::queryInterface(aType);
+ if(!aRet.hasValue())
+ {
+ aRet = GetSvxPage()->queryAggregation(aType);
+ }
+ return aRet;
+}
+
+Sequence< Type > SwXDrawPage::getTypes( ) throw(RuntimeException)
+{
+ Sequence< uno::Type > aPageTypes = SwXDrawPageBaseClass::getTypes();
+ Sequence< uno::Type > aSvxTypes = GetSvxPage()->getTypes();
+
+ long nIndex = aPageTypes.getLength();
+ aPageTypes.realloc(aPageTypes.getLength() + aSvxTypes.getLength() + 1);
+
+ uno::Type* pPageTypes = aPageTypes.getArray();
+ const uno::Type* pSvxTypes = aSvxTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos < aSvxTypes.getLength(); nPos++)
+ {
+ pPageTypes[nIndex++] = pSvxTypes[nPos];
+ }
+ pPageTypes[nIndex] = ::getCppuType((Reference< ::com::sun::star::form::XFormsSupplier>*)0);
+ return aPageTypes;
+}
+
+sal_Int32 SwXDrawPage::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(!pDoc->GetDrawModel())
+ return 0;
+ else
+ {
+ ((SwXDrawPage*)this)->GetSvxPage();
+ return pDrawPage->getCount();
+ }
+}
+
+uno::Any SwXDrawPage::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(!pDoc->GetDrawModel())
+ {
+ throw IndexOutOfBoundsException();
+ }
+ else
+ {
+ ((SwXDrawPage*)this)->GetSvxPage();
+ return pDrawPage->getByIndex( nIndex);
+ }
+ return uno::Any();
+}
+
+uno::Type SwXDrawPage::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<drawing::XShape>*)0);
+}
+
+sal_Bool SwXDrawPage::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(!pDoc->GetDrawModel())
+ return sal_False;
+ else
+ return ((SwXDrawPage*)this)->GetSvxPage()->hasElements();
+}
+
+void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw uno::RuntimeException();
+ uno::Reference< XUnoTunnel > xShapeTunnel(xShape, uno::UNO_QUERY);
+ SwXShape* pShape = 0;
+ SvxShape* pSvxShape = 0;
+ if(xShapeTunnel.is())
+ {
+ pShape = (SwXShape*)xShapeTunnel->getSomething(SwXShape::getUnoTunnelId());
+ pSvxShape = (SvxShape*)xShapeTunnel->getSomething(SvxShape::getUnoTunnelId());
+ }
+
+ if(!pShape || pShape->GetRegisteredIn() || !pShape->m_bDescriptor )
+ {
+ RuntimeException aExcept;
+ if(pShape)
+ aExcept.Message = C2U("object already inserted");
+ else
+ aExcept.Message = C2U("illegal object");
+ throw aExcept;
+ }
+ GetSvxPage()->add(xShape);
+
+ uno::Reference< uno::XAggregation > xAgg = pShape->GetAggregationInterface();
+
+ DBG_ASSERT(pSvxShape, "warum gibt es hier kein SvxShape?");
+ //diese Position ist auf jeden Fall in 1/100 mm
+ awt::Point aMM100Pos(pSvxShape->getPosition());
+
+ //jetzt noch die Properties aus dem SwShapeDescriptor_Impl auswerten
+ SwShapeDescriptor_Impl* pDesc = pShape->GetDescImpl();
+
+ SfxItemSet aSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN,
+ RES_FRMATR_END-1 );
+ SwFmtAnchor aAnchor( FLY_IN_CNTNT );
+ sal_Bool bOpaque = sal_False;
+ if( pDesc )
+ {
+ if(pDesc->GetSurround())
+ aSet.Put( *pDesc->GetSurround());
+ //die Items sind schon in Twip gesetzt
+ if(pDesc->GetLRSpace())
+ {
+ aSet.Put(*pDesc->GetLRSpace());
+ }
+ if(pDesc->GetULSpace())
+ {
+ aSet.Put(*pDesc->GetULSpace());
+ }
+ if(pDesc->GetAnchor())
+ aAnchor = *pDesc->GetAnchor();
+
+ if(pDesc->GetHOrient())
+ {
+ if(pDesc->GetHOrient()->GetHoriOrient() == HORI_NONE)
+ aMM100Pos.X = TWIP_TO_MM100(pDesc->GetHOrient()->GetPos());
+ aSet.Put( *pDesc->GetHOrient() );
+ }
+ if(pDesc->GetVOrient())
+ {
+ if(pDesc->GetVOrient()->GetVertOrient() == VERT_NONE)
+ aMM100Pos.Y = TWIP_TO_MM100(pDesc->GetVOrient()->GetPos());
+ aSet.Put( *pDesc->GetVOrient() );
+ }
+
+ if(pDesc->GetSurround())
+ aSet.Put( *pDesc->GetSurround());
+ bOpaque = pDesc->IsOpaque();
+ }
+
+ pSvxShape->setPosition(aMM100Pos);
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ // set layer of new drawing object to corresponding invisible layer.
+ if(FmFormInventor != pObj->GetObjInventor())
+ pObj->SetLayer( bOpaque ? pDoc->GetInvisibleHeavenId() : pDoc->GetInvisibleHellId() );
+ else
+ pObj->SetLayer(pDoc->GetInvisibleControlsId());
+
+ SwPaM* pPam = new SwPaM(pDoc->GetNodes().GetEndOfContent());
+ SwUnoInternalPaM* pInternalPam = 0;
+ uno::Reference< XTextRange > xRg;
+ if( pDesc && (xRg = pDesc->GetTextRange()).is() )
+ {
+ pInternalPam = new SwUnoInternalPaM(*pDoc);
+ if(SwXTextRange::XTextRangeToSwPaM(*pInternalPam, xRg))
+ {
+ if(FLY_AT_FLY == aAnchor.GetAnchorId() &&
+ !pInternalPam->GetNode()->FindFlyStartNode())
+ aAnchor.SetType(FLY_IN_CNTNT);
+ else if(FLY_PAGE == aAnchor.GetAnchorId())
+ aAnchor.SetAnchor(pInternalPam->Start());
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ else if( aAnchor.GetAnchorId() != FLY_PAGE && pDoc->GetRootFrm() )
+ {
+ SwCrsrMoveState aState( MV_SETONLYTEXT );
+ Point aTmp(MM100_TO_TWIP(aMM100Pos.X), MM100_TO_TWIP(aMM100Pos.Y));
+ pDoc->GetRootFrm()->GetCrsrOfst( pPam->GetPoint(), aTmp, &aState );
+ aAnchor.SetAnchor( pPam->GetPoint() );
+
+ aSet.Put( SwFmtVertOrient( 0, VERT_TOP ) );
+ }
+ else
+ {
+ aAnchor.SetType(FLY_PAGE);
+ awt::Size aDescSize(xShape->getSize());
+
+ Point aTmp(MM100_TO_TWIP(aMM100Pos.X), MM100_TO_TWIP(aMM100Pos.Y));
+ Rectangle aRect( aTmp, Size(MM100_TO_TWIP(aDescSize.Width),
+ MM100_TO_TWIP(aDescSize.Height)));
+ pObj->SetLogicRect( aRect );
+ aSet.Put( SwFmtHoriOrient( aTmp.X(), HORI_NONE, FRAME ) );
+ aSet.Put( SwFmtVertOrient( aTmp.Y(), VERT_NONE, FRAME ) );
+ }
+ aSet.Put(aAnchor);
+ SwPaM* pTemp = pInternalPam;
+ if ( !pTemp )
+ pTemp = pPam;
+ UnoActionContext aAction(pDoc);
+ pDoc->Insert( *pTemp, *pObj, &aSet );
+ SwFrmFmt* pFmt = ::binfilter::FindFrmFmt( pObj );
+ if(pFmt)
+ pFmt->Add(pShape);
+ pShape->m_bDescriptor = sal_False;
+
+ delete pPam;
+ delete pInternalPam;
+}
+
+void SwXDrawPage::remove(const uno::Reference< drawing::XShape > & xShape) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw uno::RuntimeException();
+ Reference<lang::XComponent> xComp(xShape, UNO_QUERY);
+ xComp->dispose();
+}
+
+uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference< drawing::XShapes > & xShapes) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc || !xShapes.is())
+ throw uno::RuntimeException();
+ uno::Reference< drawing::XShapeGroup > xRet;
+ if(xPageAgg.is())
+ {
+
+ SwFmDrawPage* pPage = GetSvxPage();
+ if(pPage)//kann das auch Null sein?
+ {
+ //markieren und MarkList zurueckgeben
+ const SdrMarkList& rMarkList = pPage->PreGroup(xShapes);
+ if ( rMarkList.GetMarkCount() > 1 )
+ {
+ sal_Bool bFlyInCnt = sal_False;
+ for ( sal_uInt16 i = 0; !bFlyInCnt && i < rMarkList.GetMarkCount(); ++i )
+ {
+ const SdrObject *pObj = rMarkList.GetMark( i )->GetObj();
+ if ( FLY_IN_CNTNT == ::binfilter::FindFrmFmt( (SdrObject*)pObj )->GetAnchor().GetAnchorId() )
+ bFlyInCnt = sal_True;
+ }
+ if( bFlyInCnt )
+ throw uno::RuntimeException();
+ if( !bFlyInCnt )
+ {
+ UnoActionContext aContext(pDoc);
+
+ SwDrawContact* pContact = pDoc->GroupSelection( *pPage->GetDrawView() );
+ pDoc->ChgAnchor( pPage->GetDrawView()->GetMarkList(), FLY_AT_CNTNT/*int eAnchorId*/,
+ sal_True, sal_False );
+
+ pPage->GetDrawView()->UnmarkAll();
+ if(pContact)
+ {
+ uno::Reference< uno::XInterface > xInt = pPage->GetInterface( pContact->GetMaster() );
+ xRet = uno::Reference< drawing::XShapeGroup >(xInt, UNO_QUERY);
+ }
+ }
+ }
+ pPage->RemovePageView();
+ }
+ }
+ return xRet;
+}
+
+void SwXDrawPage::ungroup(const uno::Reference< drawing::XShapeGroup > & xShapeGroup) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw uno::RuntimeException();
+ if(xPageAgg.is())
+ {
+ SwFmDrawPage* pPage = GetSvxPage();
+ if(pPage)//kann das auch Null sein?
+ {
+ pPage->PreUnGroup(xShapeGroup);
+ UnoActionContext aContext(pDoc);
+
+ pDoc->UnGroupSelection( *pPage->GetDrawView() );
+ pDoc->ChgAnchor( pPage->GetDrawView()->GetMarkList(), FLY_AT_CNTNT/*int eAnchorId*/,
+ sal_True, sal_False );
+ }
+ pPage->RemovePageView();
+ }
+}
+
+SwFmDrawPage* SwXDrawPage::GetSvxPage()
+{
+ if(!xPageAgg.is() && pDoc)
+ {
+ SolarMutexGuard aGuard;
+ SdrModel* pModel = pDoc->MakeDrawModel();
+ SdrPage* pPage = pModel->GetPage( 0 );
+
+ {
+ // waehrend des queryInterface braucht man ein Ref auf das
+ // Objekt, sonst wird es geloescht.
+ pDrawPage = new SwFmDrawPage(pPage);
+ uno::Reference< drawing::XDrawPage > xPage = pDrawPage;
+ uno::Any aAgg = xPage->queryInterface(::getCppuType((uno::Reference< uno::XAggregation >*)0));
+ if(aAgg.getValueType() == ::getCppuType((uno::Reference< uno::XAggregation >*)0))
+ xPageAgg = *(uno::Reference< uno::XAggregation >*)aAgg.getValue();
+ }
+ if( xPageAgg.is() )
+ xPageAgg->setDelegator( (cppu::OWeakObject*)this );
+ }
+ return pDrawPage;
+}
+
+/****************************************************************************
+ SwXShape
+****************************************************************************/
+TYPEINIT1(SwXShape, SwClient);
+
+const uno::Sequence< sal_Int8 > & SwXShape::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXShape::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rTunnelType = ::getCppuType((uno::Reference<XUnoTunnel>*)0 );
+ uno::Any aAgg = xShapeAgg->queryAggregation( rTunnelType );
+ if(aAgg.getValueType() == rTunnelType)
+ {
+ uno::Reference<XUnoTunnel> xAggTunnel =
+ *(uno::Reference<XUnoTunnel>*)aAgg.getValue();
+ if(xAggTunnel.is())
+ return xAggTunnel->getSomething(rId);
+ }
+ }
+ return 0;
+}
+
+SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_SHAPE)),
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_SHAPE)),
+ pImpl(new SwShapeDescriptor_Impl),
+ pImplementationId(0),
+ m_bDescriptor(sal_True)
+{
+ if(xShape.is()) // default Ctor
+ {
+ const uno::Type& rAggType = ::getCppuType((const uno::Reference< uno::XAggregation >*)0);
+ //aAgg contains a reference of the SvxShape!
+ {
+ uno::Any aAgg = xShape->queryInterface(rAggType);
+ if(aAgg.getValueType() == rAggType)
+ xShapeAgg = *(uno::Reference< uno::XAggregation >*)aAgg.getValue();
+ }
+ xShape = 0;
+ m_refCount++;
+ if( xShapeAgg.is() )
+ xShapeAgg->setDelegator( (cppu::OWeakObject*)this );
+ m_refCount--;
+
+ uno::Reference< XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
+ SvxShape* pShape = 0;
+ if(xShapeTunnel.is())
+ pShape = (SvxShape*)xShapeTunnel->getSomething(SvxShape::getUnoTunnelId());
+
+ SdrObject* pObj = pShape ? pShape->GetSdrObject() : 0;
+ if(pObj)
+ {
+ SwFrmFmt* pFmt = ::binfilter::FindFrmFmt( pObj );
+ if(pFmt)
+ pFmt->Add(this);
+ }
+ }
+}
+
+SwXShape::~SwXShape()
+{
+ if (xShapeAgg.is())
+ {
+ uno::Reference< uno::XInterface > xRef;
+ xShapeAgg->setDelegator(xRef);
+ }
+ delete pImpl;
+}
+
+Any SwXShape::queryInterface( const uno::Type& aType ) throw(RuntimeException)
+{
+ Any aRet = SwXShapeBaseClass::queryInterface(aType);
+ if(!aRet.hasValue() && xShapeAgg.is())
+ aRet = xShapeAgg->queryAggregation(aType);
+ return aRet;
+}
+
+Sequence< Type > SwXShape::getTypes( ) throw(RuntimeException)
+{
+ Sequence< uno::Type > aRet = SwXShapeBaseClass::getTypes();
+ if(xShapeAgg.is())
+ {
+ Any aProv = xShapeAgg->queryAggregation(::getCppuType((Reference< XTypeProvider >*)0));
+ if(aProv.hasValue())
+ {
+ Reference< XTypeProvider > xAggProv;
+ aProv >>= xAggProv;
+ Sequence< uno::Type > aAggTypes = xAggProv->getTypes();
+ const uno::Type* pAggTypes = aAggTypes.getConstArray();
+ long nIndex = aRet.getLength();
+
+ aRet.realloc(nIndex + aAggTypes.getLength());
+ uno::Type* pBaseTypes = aRet.getArray();
+
+ for(long i = 0; i < aAggTypes.getLength(); i++)
+ pBaseTypes[nIndex++] = pAggTypes[i];
+ }
+ }
+ return aRet;
+}
+
+Sequence< sal_Int8 > SwXShape::getImplementationId( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ // do we need to compute the implementation id for this instance?
+ if( !pImplementationId && xShapeAgg.is())
+ {
+ Reference< XShape > xAggShape;
+ xShapeAgg->queryAggregation( ::getCppuType((Reference< XShape >*)0) ) >>= xAggShape;
+
+ if( xAggShape.is() )
+ {
+ const OUString aShapeType( xAggShape->getShapeType() );
+ // did we already compute an implementation id for the agregated shape type?
+ SwShapeImplementationIdMap::iterator aIter( aImplementationIdMap.find(aShapeType ) );
+ if( aIter == aImplementationIdMap.end() )
+ {
+ // we need to create a new implementation id for this
+ // note: this memory is not free'd until application exists
+ // but since we have a fixed set of shapetypes and the
+ // memory will be reused this is ok.
+ pImplementationId = new uno::Sequence< sal_Int8 >( 16 );
+ rtl_createUuid( (sal_uInt8 *) pImplementationId->getArray(), 0, sal_True );
+ aImplementationIdMap[ aShapeType ] = pImplementationId;
+ }
+ else
+ {
+ // use the already computed implementation id
+ pImplementationId = (*aIter).second;
+ }
+ }
+ }
+ if( NULL == pImplementationId )
+ {
+ DBG_ERROR( "Could not create an implementation id for a SwXShape!" );
+ return Sequence< sal_Int8 > ();
+ }
+ else
+ {
+ return *pImplementationId;
+ }
+}
+
+uno::Reference< XPropertySetInfo > SwXShape::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XPropertySetInfo > aRet;
+ if(xShapeAgg.is())
+ {
+ const uno::Type& rPropSetType = ::getCppuType((const uno::Reference< XPropertySet >*)0);
+ uno::Any aPSet = xShapeAgg->queryAggregation( rPropSetType );
+ if(aPSet.getValueType() == rPropSetType && aPSet.getValue())
+ {
+ uno::Reference< XPropertySet > xPrSet = *(uno::Reference< XPropertySet >*)aPSet.getValue();
+ uno::Reference< XPropertySetInfo > xInfo = xPrSet->getPropertySetInfo();
+ // PropertySetInfo verlaengern!
+ const uno::Sequence<Property> aPropSeq = xInfo->getProperties();
+ aRet = new SfxExtItemPropertySetInfo( _pMap, aPropSeq );
+ }
+ }
+ if(!aRet.is())
+ aRet = new SfxItemPropertySetInfo( _pMap );
+ return aRet;
+}
+
+void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(xShapeAgg.is())
+ {
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ //mit Layout kann der Anker umgesetzt werden, ohne dass sich die Position aendert
+ if(pFmt)
+ {
+ SwAttrSet aSet(pFmt->GetAttrSet());
+ SwDoc* pDoc = pFmt->GetDoc();
+ if(RES_ANCHOR == pMap->nWID && MID_ANCHOR_ANCHORFRAME == pMap->nMemberId)
+ {
+ sal_Bool bDone = sal_True;
+ Reference<XTextFrame> xFrame;
+ if(aValue >>= xFrame)
+ {
+ Reference<XUnoTunnel> xTunnel(xFrame, UNO_QUERY);
+ SwXFrame* pFrame = xTunnel.is() ?
+ (SwXFrame*)xTunnel->getSomething(SwXFrame::getUnoTunnelId()) : 0;
+ if(pFrame && pFrame->GetFrmFmt() &&
+ pFrame->GetFrmFmt()->GetDoc() == pDoc)
+ {
+ UnoActionContext aCtx(pDoc);
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
+ aSet.SetParent(&pFmt->GetAttrSet());
+ SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(pMap->nWID);
+ SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx());
+ aAnchor.SetAnchor(&aPos);
+ aAnchor.SetType(FLY_AT_FLY);
+ aSet.Put(aAnchor);
+ pFmt->SetAttr(aSet);
+ bDone = sal_True;
+ }
+ }
+ if(!bDone)
+ throw IllegalArgumentException();
+ }
+ else if(RES_OPAQUE == pMap->nWID)
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ DBG_ASSERT(pSvxShape, "No SvxShape found!");
+ if(pSvxShape)
+ {
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ // set layer of new drawing object to corresponding invisible layer.
+ bool bIsVisible = pDoc->IsVisibleLayerId( pObj->GetLayer() );
+ if(FmFormInventor != pObj->GetObjInventor())
+ {
+ pObj->SetLayer( *(sal_Bool*)aValue.getValue()
+ ? ( bIsVisible ? pDoc->GetHeavenId() : pDoc->GetInvisibleHeavenId() )
+ : ( bIsVisible ? pDoc->GetHellId() : pDoc->GetInvisibleHellId() ));
+ }
+ else
+ {
+ pObj->SetLayer( bIsVisible ? pDoc->GetControlsId() : pDoc->GetInvisibleControlsId());
+ }
+
+ }
+
+ }
+ else if( pDoc->GetRootFrm() )
+ {
+ UnoActionContext aCtx(pDoc);
+ if(RES_ANCHOR == pMap->nWID && MID_ANCHOR_ANCHORTYPE == pMap->nMemberId)
+ {
+ SdrObject* pObj = pFmt->FindSdrObject();
+ SdrMarkList aList;
+ SdrMark aMark(pObj);
+ aList.InsertEntry(aMark);
+ sal_Int32 nAnchor;
+ cppu::enum2int( nAnchor, aValue );
+ pDoc->ChgAnchor( aList, nAnchor,
+ sal_False, sal_True );
+ }
+ else
+ {
+ aPropSet.setPropertyValue(*pMap, aValue, aSet);
+ pFmt->SetAttr(aSet);
+ }
+ }
+ else
+ {
+ aPropSet.setPropertyValue(*pMap, aValue, aSet);
+ pFmt->SetAttr(aSet);
+ }
+ }
+ else
+ {
+ SfxPoolItem* pItem = 0;
+ switch(pMap->nWID)
+ {
+ case RES_ANCHOR:
+ pItem = pImpl->GetAnchor(sal_True);
+ break;
+ case RES_HORI_ORIENT:
+ pItem = pImpl->GetHOrient(sal_True);
+ break;
+ case RES_VERT_ORIENT:
+ pItem = pImpl->GetVOrient(sal_True);
+ break;
+ case RES_LR_SPACE:
+ pItem = pImpl->GetLRSpace(sal_True);
+ break;
+ case RES_UL_SPACE:
+ pItem = pImpl->GetULSpace(sal_True);
+ break;
+ case RES_SURROUND:
+ pItem = pImpl->GetSurround(sal_True);
+ break;
+ case FN_TEXT_RANGE:
+ {
+ const uno::Type rTextRangeType = ::getCppuType((uno::Reference< XTextRange>*)0);
+ if(aValue.getValueType() == rTextRangeType)
+ {
+ uno::Reference< XTextRange > & rRange = pImpl->GetTextRange();
+ rRange = *(uno::Reference< XTextRange > *)aValue.getValue();
+ }
+ }
+ break;
+ case RES_OPAQUE :
+ pImpl->SetOpaque(*(sal_Bool*)aValue.getValue());
+ break;
+ }
+ if(pItem)
+ ((SfxPoolItem*)pItem)->PutValue(aValue, pMap->nMemberId);
+ }
+ }
+ else
+ {
+ uno::Reference< XPropertySet > xPrSet;
+ const uno::Type& rPSetType = ::getCppuType((const uno::Reference< XPropertySet >*)0);
+ uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
+ if(aPSet.getValueType() != rPSetType || !aPSet.getValue())
+ throw uno::RuntimeException();
+ xPrSet = *(uno::Reference< XPropertySet >*)aPSet.getValue();
+ if( pFmt && pFmt->GetDoc()->GetRootFrm() )
+ {
+ UnoActionContext aCtx(pFmt->GetDoc());
+ xPrSet->setPropertyValue(rPropertyName, aValue);
+ }
+ else
+ xPrSet->setPropertyValue(rPropertyName, aValue);
+ }
+ }
+}
+
+uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(xShapeAgg.is())
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if(pFmt)
+ {
+ if(RES_OPAQUE == pMap->nWID)
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ DBG_ASSERT(pSvxShape, "No SvxShape found!");
+ if(pSvxShape)
+ {
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ // consider invisible layers
+ sal_Bool bOpaque =
+ ( pObj->GetLayer() != pFmt->GetDoc()->GetHellId() &&
+ pObj->GetLayer() != pFmt->GetDoc()->GetInvisibleHellId() );
+ aRet.setValue(&bOpaque, ::getBooleanCppuType());
+ }
+ }
+ else if(FN_ANCHOR_POSITION == pMap->nWID)
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ DBG_ASSERT(pSvxShape, "No SvxShape found!");
+ if(pSvxShape)
+ {
+ SdrObject* pObj = pSvxShape->GetSdrObject();
+ Point aPt = pObj->GetAnchorPos();
+ awt::Point aPoint( TWIP_TO_MM100( aPt.X() ),
+ TWIP_TO_MM100( aPt.Y() ) );
+ aRet.setValue(&aPoint, ::getCppuType( (::com::sun::star::awt::Point*)0 ));
+ }
+ }
+ else
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ aRet = aPropSet.getPropertyValue(*pMap, rSet);
+ }
+ }
+ else
+ {
+ SfxPoolItem* pItem = 0;
+ switch(pMap->nWID)
+ {
+ case RES_ANCHOR:
+ pItem = pImpl->GetAnchor();
+ break;
+ case RES_HORI_ORIENT:
+ pItem = pImpl->GetHOrient();
+ break;
+ case RES_VERT_ORIENT:
+ pItem = pImpl->GetVOrient();
+ break;
+ case RES_LR_SPACE:
+ pItem = pImpl->GetLRSpace();
+ break;
+ case RES_UL_SPACE:
+ pItem = pImpl->GetULSpace();
+ break;
+ case RES_SURROUND:
+ pItem = pImpl->GetSurround();
+ break;
+ case FN_TEXT_RANGE :
+ aRet.setValue(&pImpl->GetTextRange(), ::getCppuType((Reference<XTextRange>*)0));
+ break;
+ case RES_OPAQUE :
+ aRet.setValue(&pImpl->GetOpaque(), ::getBooleanCppuType());
+ break;
+ case FN_ANCHOR_POSITION :
+ awt::Point aPoint;
+ aRet.setValue(&aPoint, ::getCppuType( (::com::sun::star::awt::Point*)0 ));
+ break;
+ }
+ if(pItem)
+ pItem->QueryValue(aRet, pMap->nMemberId);
+ }
+ }
+ else
+ {
+ uno::Reference< XPropertySet > xPrSet;
+ const uno::Type& rPSetType = ::getCppuType((const uno::Reference< XPropertySet >*)0);
+ uno::Any aPSet = xShapeAgg->queryAggregation(rPSetType);
+ if(aPSet.getValueType() != rPSetType || !aPSet.getValue())
+ throw uno::RuntimeException();
+ xPrSet = *(uno::Reference< XPropertySet >*)aPSet.getValue();
+ aRet = xPrSet->getPropertyValue(rPropertyName);
+ }
+ }
+ return aRet;
+}
+
+PropertyState SwXShape::getPropertyState( const OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< OUString > aNames(1);
+ OUString* pStrings = aNames.getArray();
+ pStrings[0] = rPropertyName;
+ Sequence< PropertyState > aStates = getPropertyStates(aNames);
+ return aStates.getConstArray()[0];
+}
+
+Sequence< PropertyState > SwXShape::getPropertyStates(
+ const Sequence< OUString >& aPropertyNames )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ Sequence< PropertyState > aRet(aPropertyNames.getLength());
+ if(xShapeAgg.is())
+ {
+ SvxShape* pSvxShape = GetSvxShape();
+ sal_Bool bGroupMember = sal_False;
+ sal_Bool bFormControl = sal_False;
+ SdrObject* pObject = pSvxShape->GetSdrObject();
+ if(pObject)
+ {
+ bGroupMember = pObject->GetUpGroup() != 0;
+ bFormControl = pObject->GetObjInventor() == FmFormInventor;
+ }
+ const OUString* pNames = aPropertyNames.getConstArray();
+ PropertyState* pRet = aRet.getArray();
+ Reference< XPropertyState > xShapePrState;
+ for(sal_Int32 nProperty = 0; nProperty < aPropertyNames.getLength(); nProperty++)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, pNames[nProperty]);
+ if(pMap)
+ {
+ if(RES_OPAQUE == pMap->nWID)
+ pRet[nProperty] = bFormControl ?
+ PropertyState_DEFAULT_VALUE : PropertyState_DIRECT_VALUE;
+ else if(FN_ANCHOR_POSITION == pMap->nWID)
+ pRet[nProperty] = PropertyState_DIRECT_VALUE;
+ else if(FN_TEXT_RANGE == pMap->nWID)
+ pRet[nProperty] = PropertyState_DIRECT_VALUE;
+ else if(bGroupMember)
+ pRet[nProperty] = PropertyState_DEFAULT_VALUE;
+ else if(pFmt)
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ SfxItemState eItemState = rSet.GetItemState(pMap->nWID, FALSE);
+
+ //vertical orientation should only be
+ //exported if the anchor type is FLY_AUTO_CNTNT
+ if(RES_VERT_ORIENT == pMap->nWID && SFX_ITEM_SET == eItemState)
+ {
+ const SwFmtAnchor& rAnchor = rSet.GetAnchor();
+ if(rAnchor.GetAnchorId() != FLY_IN_CNTNT)
+ {
+ eItemState = SFX_ITEM_DEFAULT;
+ }
+ }
+ if(SFX_ITEM_SET == eItemState)
+ pRet[nProperty] = PropertyState_DIRECT_VALUE;
+ else if(SFX_ITEM_DEFAULT == eItemState)
+ pRet[nProperty] = PropertyState_DEFAULT_VALUE;
+ else
+ pRet[nProperty] = PropertyState_AMBIGUOUS_VALUE;
+ }
+ else
+ {
+ SfxPoolItem* pItem = 0;
+ switch(pMap->nWID)
+ {
+ case RES_ANCHOR:
+ pItem = pImpl->GetAnchor();
+ break;
+ case RES_HORI_ORIENT:
+ pItem = pImpl->GetHOrient();
+ break;
+ case RES_VERT_ORIENT:
+ pItem = pImpl->GetVOrient();
+ break;
+ case RES_LR_SPACE:
+ pItem = pImpl->GetLRSpace();
+ break;
+ case RES_UL_SPACE:
+ pItem = pImpl->GetULSpace();
+ break;
+ case RES_SURROUND:
+ pItem = pImpl->GetSurround();
+ break;
+ }
+ if(pItem)
+ pRet[nProperty] = PropertyState_DIRECT_VALUE;
+ else
+ pRet[nProperty] = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ else
+ {
+ if(!xShapePrState.is())
+ {
+ const uno::Type& rPStateType = ::getCppuType((Reference< XPropertyState >*)0);
+ uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
+ if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ throw uno::RuntimeException();
+ xShapePrState = *(Reference< XPropertyState >*)aPState.getValue();
+ }
+ pRet[nProperty] = xShapePrState->getPropertyState(pNames[nProperty]);
+ }
+ }
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+
+void SwXShape::setPropertyToDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(xShapeAgg.is())
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if(pFmt)
+ {
+ const SfxItemSet& rSet = pFmt->GetAttrSet();
+ SfxItemSet aSet(pFmt->GetDoc()->GetAttrPool(), pMap->nWID, pMap->nWID);
+ aSet.SetParent(&rSet);
+ aSet.ClearItem(pMap->nWID);
+ pFmt->GetDoc()->SetAttr(aSet, *pFmt);
+ }
+ else
+ {
+ switch(pMap->nWID)
+ {
+ case RES_ANCHOR: pImpl->RemoveAnchor(); break;
+ case RES_HORI_ORIENT: pImpl->RemoveHOrient(); break;
+ case RES_VERT_ORIENT: pImpl->RemoveVOrient(); break;
+ case RES_LR_SPACE: pImpl->RemoveLRSpace(); break;
+ case RES_UL_SPACE: pImpl->RemoveULSpace(); break;
+ case RES_SURROUND: pImpl->RemoveSurround();break;
+ case RES_OPAQUE : pImpl->SetOpaque(sal_False); break;
+ case FN_TEXT_RANGE :
+ break;
+ }
+ }
+ }
+ else
+ {
+ const uno::Type& rPStateType = ::getCppuType((Reference< XPropertyState >*)0);
+ uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
+ if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ throw uno::RuntimeException();
+ Reference< XPropertyState > xShapePrState = *(Reference< XPropertyState >*)aPState.getValue();
+ xShapePrState->setPropertyToDefault( rPropertyName );
+ }
+ }
+ else
+ throw RuntimeException();
+}
+
+Any SwXShape::getPropertyDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ Any aRet;
+ if(xShapeAgg.is())
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if(pMap->nWID < RES_FRMATR_END && pFmt)
+ {
+ const SfxPoolItem& rDefItem =
+ pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pMap->nWID);
+ rDefItem.QueryValue(aRet, pMap->nMemberId);
+ }
+ else
+ throw RuntimeException();
+ }
+ else
+ {
+ const uno::Type& rPStateType = ::getCppuType((Reference< XPropertyState >*)0);
+ uno::Any aPState = xShapeAgg->queryAggregation(rPStateType);
+ if(aPState.getValueType() != rPStateType || !aPState.getValue())
+ throw uno::RuntimeException();
+ Reference< XPropertyState > xShapePrState = *(Reference< XPropertyState >*)aPState.getValue();
+ xShapePrState->getPropertyDefault( rPropertyName );
+ }
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+
+void SwXShape::addPropertyChangeListener(const OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXShape::removePropertyChangeListener(
+ const OUString& PropertyName,
+ const Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXShape::addVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXShape::removeVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXShape::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+void SwXShape::attach(const Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ // get access to SwDoc
+ // (see also SwXTextRange::XTextRangeToSwPaM)
+ SwDoc* pDoc = 0;
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ if(xRangeTunnel.is())
+ {
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ SwXTextPortion* pPortion = 0;
+ SwXText* pText = 0;
+
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pText = (SwXText*)xRangeTunnel->getSomething(
+ SwXText::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ pPortion = (SwXTextPortion*)xRangeTunnel->getSomething(
+ SwXTextPortion::getUnoTunnelId());
+
+ if (pRange)
+ pDoc = pRange->GetDoc();
+ else if (!pDoc && pText)
+ pDoc = pText->GetDoc();
+ else if (!pDoc && pCursor)
+ pDoc = pCursor->GetDoc();
+ else if ( !pDoc && pPortion && pPortion->GetCrsr() )
+ pDoc = pPortion->GetCrsr()->GetDoc();
+
+ }
+
+ if(!pDoc)
+ throw uno::RuntimeException();
+ SwDocShell *pDocSh = pDoc->GetDocShell();
+ if (pDocSh)
+ {
+ uno::Reference< frame::XModel > xModel;
+ xModel = pDocSh->GetModel();
+ uno::Reference< drawing::XDrawPageSupplier > xDPS(xModel, UNO_QUERY);
+ if (xDPS.is())
+ {
+ uno::Reference< drawing::XDrawPage > xDP( xDPS->getDrawPage() );
+ if (xDP.is())
+ {
+ Any aPos; aPos <<= xTextRange;
+ setPropertyValue(S2U("TextRange"), aPos);
+ Reference< drawing::XShape > xTemp( (cppu::OWeakObject*) this, UNO_QUERY );
+ xDP->add( xTemp );
+ }
+ }
+ }
+}
+
+Reference< XTextRange > SwXShape::getAnchor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Reference< XTextRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ // return an anchor for non-page bound frames
+ // and for page bound frames that have a page no == NULL and a content position
+ if( rAnchor.GetAnchorId() != FLY_PAGE ||
+ (rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
+ {
+ const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
+ aRef = SwXTextRange::CreateTextRangeFromPosition(pFmt->GetDoc(), rPos, 0);
+ }
+ }
+ else
+ aRef = pImpl->GetTextRange();
+ return aRef;
+}
+
+void SwXShape::dispose(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ // determine correct <SdrObject>
+ SdrObject* pObj = pFmt->FindSdrObject();
+ // safety assertion: <pObj> must be the same as <pFmt->FindSdrObject()>,
+ // if <pObj> isn't a 'virtual' drawing object.
+ ASSERT( !pObj->ISA(SwDrawVirtObj) || pObj == pFmt->FindSdrObject(),
+ "<SwXShape::dispose(..) - different 'master' drawing objects!!" );
+ // perform delete of draw frame format *not* for 'virtual' drawing objects.
+ if(pObj && pObj->IsInserted())
+ {
+ if( pFmt->GetAnchor().GetAnchorId() == FLY_IN_CNTNT )
+ {
+ const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
+ SwTxtNode *pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ const xub_StrLen nIdx = rPos.nContent.GetIndex();
+ pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ }
+ else
+ pFmt->GetDoc()->DelLayoutFmt( pFmt );
+ }
+ }
+ if(xShapeAgg.is())
+ {
+ uno::Any aAgg(xShapeAgg->queryAggregation( ::getCppuType((Reference<XComponent>*)0)));
+ Reference<XComponent> xComp;
+ aAgg >>= xComp;
+ if(xComp.is())
+ xComp->dispose();
+ }
+}
+
+void SwXShape::addEventListener(const Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ Reference< XUnoTunnel > xShapeTunnel(xShapeAgg, UNO_QUERY);
+ SvxShape* pSvxShape = GetSvxShape();
+ if(pSvxShape)
+ pSvxShape->addEventListener(aListener);
+}
+
+void SwXShape::removeEventListener(const Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ SvxShape* pSvxShape = GetSvxShape();
+ if(pSvxShape)
+ pSvxShape->removeEventListener(aListener);
+}
+
+OUString SwXShape::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXShape");
+}
+
+sal_Bool SwXShape::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ if(COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.drawing.Shape"))
+ bRet = sal_True;
+ else if(xShapeAgg.is())
+ {
+ Reference< XUnoTunnel > xShapeTunnel(xShapeAgg, UNO_QUERY);
+ SvxShape* pSvxShape = GetSvxShape();
+ bRet = pSvxShape->supportsService(rServiceName);
+ }
+ return bRet;
+}
+
+Sequence< OUString > SwXShape::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aSeq;
+ if(xShapeAgg.is())
+ {
+ Reference< XUnoTunnel > xShapeTunnel(xShapeAgg, UNO_QUERY);
+ SvxShape* pSvxShape = GetSvxShape();
+ if(pSvxShape)
+ aSeq = pSvxShape->getSupportedServiceNames();
+ }
+ else
+ {
+ aSeq.realloc(1);
+ aSeq.getArray()[0] = C2U("com.sun.star.drawing.Shape");
+ }
+ return aSeq;
+}
+
+SvxShape* SwXShape::GetSvxShape()
+{
+ SvxShape* pSvxShape = 0;
+ if(xShapeAgg.is())
+ {
+ Reference< XUnoTunnel > xShapeTunnel(xShapeAgg, UNO_QUERY);
+ if(xShapeTunnel.is())
+ pSvxShape = (SvxShape*)xShapeTunnel->getSomething(SvxShape::getUnoTunnelId());
+ }
+ return pSvxShape;
+}
+
+/****************************************************************************
+ SwXGroupShape
+****************************************************************************/
+SwXGroupShape::SwXGroupShape(Reference< XInterface > & xShape) :
+ SwXShape(xShape)
+{
+#ifdef DBG_UTIL
+ Reference<XShapes> xShapes(xShapeAgg, UNO_QUERY);
+ DBG_ASSERT(xShapes.is(), "no SvxShape found or shape is not a group shape");
+#endif
+}
+
+SwXGroupShape::~SwXGroupShape()
+{
+}
+
+Any SwXGroupShape::queryInterface( const uno::Type& rType ) throw(RuntimeException)
+{
+ Any aRet;
+ if(rType == ::getCppuType((Reference<XShapes>*)0))
+ aRet <<= Reference<XShapes>(this);
+ else
+ aRet = SwXShape::queryInterface(rType);
+ return aRet;
+}
+
+void SwXGroupShape::acquire( ) throw()
+{
+ SwXShape::acquire();
+}
+
+void SwXGroupShape::release( ) throw()
+{
+ SwXShape::release();
+}
+
+void SwXGroupShape::add( const Reference< XShape >& xShape ) throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SvxShape* pSvxShape = GetSvxShape();
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pSvxShape && pFmt)
+ {
+ sal_Bool bOk = FALSE;
+ Reference<XShapes> xShapes;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((Reference<XShapes>*)0 );
+ Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xShapes;
+ }
+ if(xShapes.is())
+ xShapes->add(xShape);
+ else
+ throw RuntimeException();
+
+ Reference<XUnoTunnel> xTunnel(xShape, UNO_QUERY);
+ SwXShape* pSwShape = 0;
+ if(xShape.is())
+ pSwShape = (SwXShape*)xTunnel->getSomething(SwXShape::getUnoTunnelId());
+ if(pSwShape && pSwShape->m_bDescriptor)
+ {
+ SvxShape* pAddShape = (SvxShape*)xTunnel->getSomething(SvxShape::getUnoTunnelId());
+ if(pAddShape)
+ {
+ SdrObject* pObj = pAddShape->GetSdrObject();
+ if(pObj)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ // set layer of new drawing object to corresponding invisible layer.
+ if( FmFormInventor != pObj->GetObjInventor())
+ {
+ pObj->SetLayer( pSwShape->pImpl->GetOpaque()
+ ? pDoc->GetInvisibleHeavenId()
+ : pDoc->GetInvisibleHellId() );
+ }
+ else
+ {
+ pObj->SetLayer(pDoc->GetInvisibleControlsId());
+ }
+ }
+ }
+ pSwShape->m_bDescriptor = sal_False;
+ //add the group member to the format of the group
+ SwFrmFmt* pFmt = ::binfilter::FindFrmFmt( pSvxShape->GetSdrObject() );
+ if(pFmt)
+ pFmt->Add(pSwShape);
+ }
+ }
+ else
+ throw RuntimeException();
+}
+
+void SwXGroupShape::remove( const Reference< XShape >& xShape ) throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bOk = FALSE;
+ Reference<XShapes> xShapes;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((Reference<XShapes>*)0 );
+ Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xShapes;
+ }
+ if(!xShapes.is())
+ throw RuntimeException();
+ xShapes->remove(xShape);
+}
+
+sal_Int32 SwXGroupShape::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nRet = 0;
+ Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((Reference<XIndexAccess>*)0 );
+ Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw RuntimeException();
+ return xAcc->getCount();
+}
+
+Any SwXGroupShape::getByIndex(sal_Int32 nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((Reference<XIndexAccess>*)0 );
+ Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw RuntimeException();
+ return xAcc->getByIndex(nIndex);
+}
+
+uno::Type SwXGroupShape::getElementType( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((Reference<XIndexAccess>*)0 );
+ Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw RuntimeException();
+ return xAcc->getElementType();
+}
+
+sal_Bool SwXGroupShape::hasElements( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Reference<XIndexAccess> xAcc;
+ if( xShapeAgg.is() )
+ {
+ const uno::Type& rType = ::getCppuType((Reference<XIndexAccess>*)0 );
+ Any aAgg = xShapeAgg->queryAggregation( rType );
+ aAgg >>= xAcc;
+ }
+ if(!xAcc.is())
+ throw RuntimeException();
+ return xAcc->hasElements();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoevent.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoevent.cxx
new file mode 100644
index 000000000000..5a62e8e9be76
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoevent.cxx
@@ -0,0 +1,468 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+// HINTIDs must be on top; it is required for the macitem.hxx header
+#include "hintids.hxx"
+
+#include "unoevent.hxx"
+
+#include <errhdl.hxx>
+
+#include "unoframe.hxx"
+
+#include "unostyle.hxx"
+
+#include "swevent.hxx"
+
+#include "docstyle.hxx"
+
+#include <bf_sfx2/sfx.hrc>
+
+#include <bf_svx/svxids.hrc>
+
+#include "fmtinfmt.hxx"
+
+#include <bf_svtools/macitem.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+using ::com::sun::star::container::NoSuchElementException;
+using ::com::sun::star::container::XNameReplace;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::beans::PropertyValue;
+using ::cppu::WeakImplHelper2;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+const sal_Char sAPI_ServiceName[] = "com.sun.star.container.XNameReplace";
+const sal_Char sAPI_SwFrameEventDescriptor[] = "SwFrameEventDescriptor";
+const sal_Char sAPI_SwFrameStyleEventDescriptor[] =
+ "SwFrameStyleEventDescriptor";
+const sal_Char sAPI_SwDetachedEventDescriptor[] = "SwDetachedEventDescriptor";
+const sal_Char sAPI_SwHyperlinkEventDescriptor[] =
+ "SwHyperlinkEventDescriptor";
+const sal_Char sAPI_SwAutoTextEventDescriptor[] =
+ "SwAutoTextEventDescriptor";
+
+
+// //
+// // tables of all known events handled by this class
+// //
+
+// // careful: keep aKnownEventIDs and aKnownEventNames in sync!
+
+// const USHORT aKnownEventIDs[] =
+// {
+// SW_EVENT_OBJECT_SELECT,
+// SW_EVENT_START_INS_GLOSSARY,
+// SW_EVENT_END_INS_GLOSSARY,
+// SW_EVENT_MAIL_MERGE,
+// SW_EVENT_FRM_KEYINPUT_ALPHA,
+// SW_EVENT_FRM_KEYINPUT_NOALPHA,
+// SW_EVENT_FRM_RESIZE,
+// SW_EVENT_FRM_MOVE,
+// SW_EVENT_PAGE_COUNT,
+// SFX_EVENT_MOUSEOVER_OBJECT,
+// SFX_EVENT_MOUSECLICK_OBJECT,
+// SFX_EVENT_MOUSEOUT_OBJECT,
+// SFX_EVENT_OPENDOC,
+// SFX_EVENT_CLOSEDOC,
+// SFX_EVENT_STARTAPP,
+// SFX_EVENT_CLOSEAPP,
+// SFX_EVENT_CREATEDOC,
+// SFX_EVENT_SAVEDOC,
+// SFX_EVENT_SAVEASDOC,
+// SFX_EVENT_ACTIVATEDOC,
+// SFX_EVENT_DEACTIVATEDOC,
+// SFX_EVENT_PRINTDOC,
+// SFX_EVENT_ONERROR,
+// SFX_EVENT_LOADFINISHED,
+// SFX_EVENT_SAVEFINISHED,
+// SFX_EVENT_MODIFYCHANGED,
+// SFX_EVENT_PREPARECLOSEDOC,
+// SFX_EVENT_NEWMESSAGE,
+// SFX_EVENT_TOGGLEFULLSCREENMODE,
+// SFX_EVENT_SAVEDOCDONE,
+// SFX_EVENT_SAVEASDOCDONE,
+// SVX_EVENT_IMAGE_LOAD,
+// SVX_EVENT_IMAGE_ABORT,
+// SVX_EVENT_IMAGE_ERROR,
+// 0
+// };
+
+// const sal_Char* aKnownEventNames[] =
+// {
+// "OnSelect", // SW_EVENT_OBJECT_SELECT
+// "OnInsertStart", // SW_EVENT_START_INS_GLOSSARY
+// "OnInsertDone", // SW_EVENT_END_INS_GLOSSARY
+// "OnMailMerge", // SW_EVENT_MAIL_MERGE
+// "OnAlphaCharInput", // SW_EVENT_FRM_KEYINPUT_ALPHA
+// "OnNonAlphaCharInput", // SW_EVENT_FRM_KEYINPUT_NOALPHA
+// "OnResize", // SW_EVENT_FRM_RESIZE
+// "OnMove", // SW_EVENT_FRM_MOVE
+// "PageCountChange", // SW_EVENT_PAGE_COUNT
+// "OnMouseOver", // SFX_EVENT_MOUSEOVER_OBJECT
+// "OnClick", // SFX_EVENT_MOUSECLICK_OBJECT
+// "OnMouseOut", // SFX_EVENT_MOUSEOUT_OBJECT
+// "OnLoad", // SFX_EVENT_OPENDOC,
+// "OnUnload", // SFX_EVENT_CLOSEDOC,
+// "OnStartApp", // SFX_EVENT_STARTAPP,
+// "OnCloseApp", // SFX_EVENT_CLOSEAPP,
+// "OnNew", // SFX_EVENT_CREATEDOC,
+// "OnSave", // SFX_EVENT_SAVEDOC,
+// "OnSaveAs", // SFX_EVENT_SAVEASDOC,
+// "OnFocus", // SFX_EVENT_ACTIVATEDOC,
+// "OnUnfocus", // SFX_EVENT_DEACTIVATEDOC,
+// "OnPrint", // SFX_EVENT_PRINTDOC,
+// "OnError", // SFX_EVENT_ONERROR,
+// "OnLoadFinished", // SFX_EVENT_LOADFINISHED,
+// "OnSaveFinished", // SFX_EVENT_SAVEFINISHED,
+// "OnModifyChanged", // SFX_EVENT_MODIFYCHANGED,
+// "OnPrepareUnload", // SFX_EVENT_PREPARECLOSEDOC,
+// "OnNewMail", // SFX_EVENT_NEWMESSAGE,
+// "OnToggleFullscreen", // SFX_EVENT_TOGGLEFULLSCREENMODE,
+// "OnSaveDone", // SFX_EVENT_SAVEDOCDONE,
+// "OnSaveAsDone", // SFX_EVENT_SAVEASDOCDONE,
+// "OnLoadError", // SVX_EVENT_IMAGE_LOAD,
+// "OnLoadCancel", // SVX_EVENT_IMAGE_ABORT,
+// "OnLoadDone", // SVX_EVENT_IMAGE_ERROR,
+
+// NULL
+// };
+
+
+//
+// tables of allowed events for specific objects
+//
+
+const struct SvEventDescription aGraphicEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { SVX_EVENT_IMAGE_LOAD, "OnLoadDone" },
+ { SVX_EVENT_IMAGE_ABORT, "OnLoadCancel" },
+ { SVX_EVENT_IMAGE_ERROR, "OnLoadError" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aFrameEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SW_EVENT_FRM_KEYINPUT_ALPHA, "OnAlphaCharInput" },
+ { SW_EVENT_FRM_KEYINPUT_NOALPHA, "OnNonAlphaCharInput" },
+ { SW_EVENT_FRM_RESIZE, "OnResize" },
+ { SW_EVENT_FRM_MOVE, "OnMove" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aOLEEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aHyperlinkEvents[] =
+{
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aAutotextEvents[] =
+{
+ { SW_EVENT_START_INS_GLOSSARY, "OnInsertStart" },
+ { SW_EVENT_END_INS_GLOSSARY, "OnInsertDone" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aFrameStyleEvents[] =
+{
+ { SW_EVENT_OBJECT_SELECT, "OnSelect" },
+ { SW_EVENT_FRM_KEYINPUT_ALPHA, "OnAlphaCharInput" },
+ { SW_EVENT_FRM_KEYINPUT_NOALPHA, "OnNonAlphaCharInput" },
+ { SW_EVENT_FRM_RESIZE, "OnResize" },
+ { SW_EVENT_FRM_MOVE, "OnMove" },
+ { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" },
+ { SFX_EVENT_MOUSECLICK_OBJECT, "OnClick" },
+ { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" },
+ { SVX_EVENT_IMAGE_LOAD, "OnLoadDone" },
+ { SVX_EVENT_IMAGE_ABORT, "OnLoadCancel" },
+ { SVX_EVENT_IMAGE_ERROR, "OnLoadError" },
+ { 0, NULL }
+};
+
+const struct SvEventDescription aDocumentEvents[] =
+{
+ { SFX_EVENT_STARTAPP, "OnStartApp" },
+ { SFX_EVENT_CLOSEAPP, "OnCloseApp" },
+ { SFX_EVENT_CREATEDOC, "OnNew" },
+ { SFX_EVENT_OPENDOC, "OnLoad" },
+ { SFX_EVENT_SAVEDOC, "OnSave" },
+ { SFX_EVENT_SAVEASDOC, "OnSaveAs" },
+// ??? cf. SAVEDOCDONE, SAVEASDOCDONE
+ { SFX_EVENT_SAVEFINISHED, "OnSaveFinished" },
+ { SFX_EVENT_CLOSEDOC, "OnUnload" },
+ { SFX_EVENT_ACTIVATEDOC, "OnFocus" },
+ { SFX_EVENT_DEACTIVATEDOC, "OnUnfocus" },
+ { SFX_EVENT_ONERROR, "OnError" },
+ { SFX_EVENT_NEWMESSAGE, "OnNewMail" },
+ { SFX_EVENT_PRINTDOC, "OnPrint" },
+ { SW_EVENT_MAIL_MERGE, "OnMailMerge" },
+ { SW_EVENT_PAGE_COUNT, "PageCountChange" },
+// SFX_EVENT_LOADFINISHED,
+// SFX_EVENT_MODIFYCHANGED,
+// SFX_EVENT_PREPARECLOSEDOC,
+// SFX_EVENT_TOGGLEFULLSCREENMODE,
+// SFX_EVENT_SAVEDOCDONE,
+// SFX_EVENT_SAVEASDOCDONE,
+
+ { 0, NULL }
+};
+
+
+
+
+
+//
+// SwHyperlinkEventDescriptor
+//
+
+SwHyperlinkEventDescriptor::SwHyperlinkEventDescriptor() :
+ SvDetachedEventDescriptor(aHyperlinkEvents),
+ sImplName(RTL_CONSTASCII_USTRINGPARAM(sAPI_SwHyperlinkEventDescriptor))
+{
+}
+
+SwHyperlinkEventDescriptor::~SwHyperlinkEventDescriptor()
+{
+}
+
+OUString SwHyperlinkEventDescriptor::getImplementationName(void)
+ throw( RuntimeException )
+{
+ return sImplName;
+}
+
+void SwHyperlinkEventDescriptor::copyMacrosFromINetFmt(
+ const SwFmtINetFmt& aFmt)
+{
+ for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
+ {
+ USHORT nEvent = mpSupportedMacroItems[i].mnEvent;
+ const SvxMacro* aMacro = aFmt.GetMacro(nEvent);
+ if (NULL != aMacro)
+ replaceByName(nEvent, *aMacro);
+ }
+}
+
+void SwHyperlinkEventDescriptor::copyMacrosIntoINetFmt(
+ SwFmtINetFmt& aFmt)
+{
+ for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
+ {
+ USHORT nEvent = mpSupportedMacroItems[i].mnEvent;
+ if (hasByName(nEvent))
+ {
+ SvxMacro aMacro(sEmpty, sEmpty);
+ getByName(aMacro, nEvent);
+ aFmt.SetMacro(nEvent, aMacro);
+ }
+ }
+}
+
+
+void SwHyperlinkEventDescriptor::copyMacrosFromNameReplace(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XNameReplace> & xReplace)
+{
+ // iterate over all names (all names that *we* support)
+ Sequence<OUString> aNames = getElementNames();
+ sal_Int32 nCount = aNames.getLength();
+ for(sal_Int32 i = 0; i < nCount; i++)
+ {
+ // copy element for that name
+ const OUString& rName = aNames[i];
+ if (xReplace->hasByName(rName))
+ {
+ SvBaseEventDescriptor::replaceByName(rName,
+ xReplace->getByName(rName));
+ }
+ }
+}
+
+
+//
+// SwFrameEventDescriptor
+//
+
+// use double cast in superclass constructor to avoid ambigous cast
+SwFrameEventDescriptor::SwFrameEventDescriptor(
+ SwXTextFrame& rFrameRef ) :
+ SvEventDescriptor((text::XTextFrame&)rFrameRef, aFrameEvents),
+ sSwFrameEventDescriptor(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_SwFrameEventDescriptor)),
+ rFrame(rFrameRef)
+{
+}
+
+SwFrameEventDescriptor::SwFrameEventDescriptor(
+ SwXTextGraphicObject& rGraphicRef ) :
+ SvEventDescriptor((text::XTextContent&)rGraphicRef, aGraphicEvents),
+ rFrame((SwXFrame&)rGraphicRef)
+{
+}
+
+SwFrameEventDescriptor::SwFrameEventDescriptor(
+ SwXTextEmbeddedObject& rObjectRef ) :
+ SvEventDescriptor((text::XTextContent&)rObjectRef, aOLEEvents),
+ rFrame((SwXFrame&)rObjectRef)
+{
+}
+
+SwFrameEventDescriptor::~SwFrameEventDescriptor()
+{
+}
+
+void SwFrameEventDescriptor::setMacroItem(const SvxMacroItem& rItem)
+{
+ rFrame.GetFrmFmt()->SetAttr(rItem);
+}
+
+const SvxMacroItem& SwFrameEventDescriptor::getMacroItem()
+{
+ return (const SvxMacroItem&)rFrame.GetFrmFmt()->GetAttr(RES_FRMMACRO);
+}
+
+sal_uInt16 SwFrameEventDescriptor::getMacroItemWhich() const
+{
+ return RES_FRMMACRO;
+}
+
+OUString SwFrameEventDescriptor::getImplementationName()
+ throw( RuntimeException )
+{
+ return sSwFrameEventDescriptor;
+}
+
+
+//
+// SwFrameStyleEventDescriptor
+//
+
+SwFrameStyleEventDescriptor::SwFrameStyleEventDescriptor(
+ SwXFrameStyle& rStyleRef ) :
+ SvEventDescriptor((document::XEventsSupplier&)rStyleRef,
+ aFrameStyleEvents),
+ sSwFrameStyleEventDescriptor(RTL_CONSTASCII_USTRINGPARAM(
+ sAPI_SwFrameStyleEventDescriptor)),
+ rStyle(rStyleRef)
+{
+}
+
+SwFrameStyleEventDescriptor::~SwFrameStyleEventDescriptor()
+{
+}
+
+void SwFrameStyleEventDescriptor::setMacroItem(const SvxMacroItem& rItem)
+{
+ // As I was told, for some entirely unobvious reason getting an
+ // item from a style has to look as follows:
+ SfxStyleSheetBasePool* pBasePool = rStyle.GetBasePool();
+ if (pBasePool)
+ {
+ SfxStyleSheetBase* pBase = pBasePool->Find(rStyle.GetStyleName());
+ if (pBase)
+ {
+ SwDocStyleSheet aStyle(*(SwDocStyleSheet*)pBase);
+ SfxItemSet& rStyleSet = aStyle.GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), RES_FRMMACRO, RES_FRMMACRO);
+ aSet.Put(rItem);
+ aStyle.SetItemSet(aSet);
+ }
+ }
+}
+
+static const SvxMacroItem aEmptyMacroItem(RES_FRMMACRO);
+
+const SvxMacroItem& SwFrameStyleEventDescriptor::getMacroItem()
+{
+ // As I was told, for some entirely unobvious reason getting an
+ // item from a style has to look as follows:
+ SfxStyleSheetBasePool* pBasePool = rStyle.GetBasePool();
+ if (pBasePool)
+ {
+ SfxStyleSheetBase* pBase = pBasePool->Find(rStyle.GetStyleName());
+ if (pBase)
+ {
+ SwDocStyleSheet aStyle(*(SwDocStyleSheet*)pBase);
+ return (const SvxMacroItem&)aStyle.GetItemSet().Get(RES_FRMMACRO);
+ }
+ else
+ return aEmptyMacroItem;
+ }
+ else
+ return aEmptyMacroItem;
+}
+
+OUString SwFrameStyleEventDescriptor::getImplementationName()
+ throw( RuntimeException )
+{
+ return sSwFrameStyleEventDescriptor;
+}
+
+sal_uInt16 SwFrameStyleEventDescriptor::getMacroItemWhich() const
+{
+ return RES_FRMMACRO;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoevtlstnr.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoevtlstnr.cxx
new file mode 100644
index 000000000000..99c6eb5bb541
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoevtlstnr.cxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <unoevtlstnr.hxx>
+#include <tools/debug.hxx>
+
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+/* -----------------22.04.99 11:24-------------------
+ *
+ * --------------------------------------------------*/
+SV_IMPL_PTRARR(SwEvtLstnrArray, XEventListenerPtr);
+
+/*-- 22.04.99 11:24:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwEventListenerContainer::SwEventListenerContainer( uno::XInterface* pxParent) :
+ pListenerArr(0),
+ pxParent(pxParent)
+{
+}
+/*-- 22.04.99 11:24:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwEventListenerContainer::~SwEventListenerContainer()
+{
+ if(pListenerArr && pListenerArr->Count())
+ {
+ pListenerArr->DeleteAndDestroy(0, pListenerArr->Count());
+ }
+ delete pListenerArr;
+}
+/*-- 22.04.99 11:24:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwEventListenerContainer::AddListener(const uno::Reference< lang::XEventListener > & rxListener)
+{
+ if(!pListenerArr)
+ pListenerArr = new SwEvtLstnrArray;
+ uno::Reference< lang::XEventListener > * pInsert = new uno::Reference< lang::XEventListener > ;
+ *pInsert = rxListener;
+ pListenerArr->Insert(pInsert, pListenerArr->Count());
+}
+/*-- 22.04.99 11:25:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwEventListenerContainer::RemoveListener(const uno::Reference< lang::XEventListener > & rxListener)
+{
+ if(!pListenerArr)
+ return sal_False;
+ else
+ {
+ lang::XEventListener* pLeft = rxListener.get();
+ for(sal_uInt16 i = 0; i < pListenerArr->Count(); i++)
+ {
+ XEventListenerPtr pElem = pListenerArr->GetObject(i);
+ lang::XEventListener* pRight = pElem->get();
+ if(pLeft == pRight)
+ {
+ pListenerArr->Remove(i);
+ delete pElem;
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+/*-- 22.04.99 11:25:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwEventListenerContainer::Disposing()
+{
+ if(!pListenerArr)
+ return;
+
+ lang::EventObject aObj(pxParent);
+ for(sal_uInt16 i = 0; i < pListenerArr->Count(); i++)
+ {
+ XEventListenerPtr pElem = pListenerArr->GetObject(i);
+ (*pElem)->disposing(aObj);
+ }
+ pListenerArr->DeleteAndDestroy(0, pListenerArr->Count());
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unofield.cxx b/binfilter/bf_sw/source/core/unocore/sw_unofield.cxx
new file mode 100644
index 000000000000..2656d20fc903
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unofield.cxx
@@ -0,0 +1,2718 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <hints.hxx>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unocoll.hxx>
+#include <bf_svtools/itemprop.hxx>
+#include <bf_svx/linkmgr.hxx>
+#include <docstat.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTimeRange.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/beans/XVetoableChangeListener.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+//undef to prevent error (from bf_sfx2/docfile.cxx)
+#undef SEQUENCE
+#include <com/sun/star/text/SetVariableType.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/PageNumberType.hpp>
+#include <unofield.hxx>
+#include <unocrsr.hxx>
+#include <fldbas.hxx>
+#include <authfld.hxx>
+#include <flddat.hxx>
+#include <dbfld.hxx>
+#include <usrfld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <chpfld.hxx>
+#include <flddropdown.hxx>
+#include <poolfmt.hxx>
+#include <poolfmt.hrc>
+#include <pagedesc.hxx>
+#include <docary.hxx>
+#include <reffld.hxx>
+#include <ddefld.hxx>
+#include <tools/datetime.hxx>
+#define _SVSTDARR_STRINGS
+#include <bf_svtools/svstdarr.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <swunohelper.hxx>
+#include <unofldmid.h>
+namespace binfilter {
+String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr ); //STRIP008
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+using rtl::OUString;
+
+#define COM_TEXT_FLDMASTER "com.sun.star.text.FieldMaster."
+
+static const sal_uInt16 aDocInfoSubTypeFromService[] =
+{
+ DI_CHANGE|DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_AUTHOR
+ DI_CHANGE|DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_CHANGE_DATE_TIME
+ DI_EDIT|DI_SUB_TIME, //PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME
+ DI_COMMENT, //PROPERTY_MAP_FLDTYP_DOCINFO_DESCRIPTION
+ DI_CREATE|DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_AUTHOR
+ DI_CREATE|DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_CREATE_DATE_TIME
+ DI_INFO1, //PROPERTY_MAP_FLDTYP_DOCINFO_INFO_0
+ DI_INFO2, //PROPERTY_MAP_FLDTYP_DOCINFO_INFO_1
+ DI_INFO3, //PROPERTY_MAP_FLDTYP_DOCINFO_INFO_2
+ DI_INFO4, //PROPERTY_MAP_FLDTYP_DOCINFO_INFO_3
+ DI_PRINT|DI_SUB_AUTHOR, //PROPERTY_MAP_FLDTYP_DOCINFO_PRINT_AUTHOR
+ DI_PRINT|DI_SUB_DATE, //PROPERTY_MAP_FLDTYP_DOCINFO_PRINT_DATE_TIME
+ DI_KEYS, //PROPERTY_MAP_FLDTYP_DOCINFO_KEY_WORDS
+ DI_THEMA, //PROPERTY_MAP_FLDTYP_DOCINFO_SUBJECT
+ DI_TITEL, //PROPERTY_MAP_FLDTYP_DOCINFO_TITLE
+ DI_DOCNO //PROPERTY_MAP_FLDTYP_DOCINFO_REVISION
+};
+struct ServiceIdResId
+{
+ USHORT nResId;
+ USHORT nServiceId;
+};
+static const ServiceIdResId aServiceToRes[] =
+{
+ {RES_DATETIMEFLD, SW_SERVICE_FIELDTYPE_DATETIME },
+ {RES_USERFLD, SW_SERVICE_FIELDTYPE_USER },
+ {RES_SETEXPFLD, SW_SERVICE_FIELDTYPE_SET_EXP } ,
+ {RES_GETEXPFLD, SW_SERVICE_FIELDTYPE_GET_EXP } ,
+ {RES_FILENAMEFLD, SW_SERVICE_FIELDTYPE_FILE_NAME },
+ {RES_PAGENUMBERFLD, SW_SERVICE_FIELDTYPE_PAGE_NUM } ,
+ {RES_AUTHORFLD, SW_SERVICE_FIELDTYPE_AUTHOR } ,
+ {RES_CHAPTERFLD, SW_SERVICE_FIELDTYPE_CHAPTER },
+ {RES_GETREFFLD, SW_SERVICE_FIELDTYPE_GET_REFERENCE } ,
+ {RES_HIDDENTXTFLD, SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT },
+ {RES_POSTITFLD, SW_SERVICE_FIELDTYPE_ANNOTATION } ,
+ {RES_INPUTFLD, SW_SERVICE_FIELDTYPE_INPUT },
+ {RES_MACROFLD, SW_SERVICE_FIELDTYPE_MACRO },
+ {RES_DDEFLD, SW_SERVICE_FIELDTYPE_DDE },
+ {RES_HIDDENPARAFLD, SW_SERVICE_FIELDTYPE_HIDDEN_PARA } ,
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOC_INFO },
+ {RES_TEMPLNAMEFLD, SW_SERVICE_FIELDTYPE_TEMPLATE_NAME },
+ {RES_EXTUSERFLD, SW_SERVICE_FIELDTYPE_USER_EXT },
+ {RES_REFPAGESETFLD, SW_SERVICE_FIELDTYPE_REF_PAGE_SET } ,
+ {RES_REFPAGEGETFLD, SW_SERVICE_FIELDTYPE_REF_PAGE_GET } ,
+ {RES_JUMPEDITFLD, SW_SERVICE_FIELDTYPE_JUMP_EDIT },
+ {RES_SCRIPTFLD, SW_SERVICE_FIELDTYPE_SCRIPT } ,
+ {RES_DBNEXTSETFLD, SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET },
+ {RES_DBNUMSETFLD, SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET },
+ {RES_DBSETNUMBERFLD, SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM } ,
+ {RES_DBFLD, SW_SERVICE_FIELDTYPE_DATABASE } ,
+ {RES_DBNAMEFLD, SW_SERVICE_FIELDTYPE_DATABASE_NAME },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_PAGE_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_WORD_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_CHARACTER_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_TABLE_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT },
+ {RES_DOCSTATFLD, SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME},
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME},
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_INFO_0 },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_INFO_1 },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_INFO_2 },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_INFO_3 },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT },
+ {RES_DOCINFOFLD, SW_SERVICE_FIELDTYPE_DOCINFO_TITLE },
+ {RES_INPUTFLD, SW_SERVICE_FIELDTYPE_INPUT_USER },
+ {RES_HIDDENTXTFLD, SW_SERVICE_FIELDTYPE_HIDDEN_TEXT },
+ {RES_AUTHORITY, SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY },
+ {RES_COMBINED_CHARS, SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS },
+ {RES_DROPDOWN, SW_SERVICE_FIELDTYPE_DROPDOWN },
+ {RES_TABLEFLD, SW_SERVICE_FIELDTYPE_TABLE_FORMULA },
+ {USHRT_MAX, USHRT_MAX }
+};
+//-----------------------------------------------------------------
+sal_uInt16 lcl_ServiceIdToResId(sal_uInt16 nServiceId)
+{
+ const ServiceIdResId* pMap;
+ for( pMap = aServiceToRes;
+ USHRT_MAX != pMap->nServiceId && nServiceId != pMap->nServiceId;
+ ++pMap )
+ ;
+#ifdef DBG_UTIL
+ if( USHRT_MAX == pMap->nServiceId )
+ DBG_ERROR("service id not found");
+#endif
+ return pMap->nResId;
+}
+//-----------------------------------------------------------------
+sal_uInt16 lcl_GetServiceForField( const SwField& rFld )
+{
+ sal_uInt16 nWhich = rFld.Which(), nSrvId = USHRT_MAX;
+ //special handling for some fields
+ switch( nWhich )
+ {
+ case RES_INPUTFLD:
+ if( INP_USR == (rFld.GetSubType() & 0x00ff) )
+ nSrvId = SW_SERVICE_FIELDTYPE_INPUT_USER;
+ break;
+
+ case RES_DOCINFOFLD:
+ {
+ USHORT nSubType = rFld.GetSubType();
+ switch( (nSubType & 0xff))
+ {
+ case DI_CHANGE:
+ nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
+ ? SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR
+ : SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME;
+ break;
+ case DI_CREATE:
+ nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
+ ? SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR
+ : SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME;
+ break;
+ case DI_PRINT:
+ nSrvId = ((nSubType&0x300) == DI_SUB_AUTHOR)
+ ? SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR
+ : SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME;
+ break;
+ case DI_EDIT: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME;break;
+ case DI_COMMENT:nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION;break;
+ case DI_INFO1: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_INFO_0; break;
+ case DI_INFO2: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_INFO_1; break;
+ case DI_INFO3: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_INFO_2; break;
+ case DI_INFO4: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_INFO_3; break;
+ case DI_KEYS: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS;break;
+ case DI_THEMA: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT; break;
+ case DI_TITEL: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_TITLE; break;
+ case DI_DOCNO: nSrvId = SW_SERVICE_FIELDTYPE_DOCINFO_REVISION; break;
+ }
+ }
+ break;
+
+ case RES_HIDDENTXTFLD:
+ nSrvId = TYP_CONDTXTFLD == rFld.GetSubType()
+ ? SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT
+ : SW_SERVICE_FIELDTYPE_HIDDEN_TEXT;
+ break;
+
+ case RES_DOCSTATFLD:
+ {
+ switch( rFld.GetSubType() )
+ {
+ case DS_PAGE: nSrvId = SW_SERVICE_FIELDTYPE_PAGE_COUNT; break;
+ case DS_PARA: nSrvId = SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT; break;
+ case DS_WORD: nSrvId = SW_SERVICE_FIELDTYPE_WORD_COUNT ; break;
+ case DS_CHAR: nSrvId = SW_SERVICE_FIELDTYPE_CHARACTER_COUNT; break;
+ case DS_TBL: nSrvId = SW_SERVICE_FIELDTYPE_TABLE_COUNT ; break;
+ case DS_GRF: nSrvId = SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT; break;
+ case DS_OLE: nSrvId = SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT; break;
+ }
+ }
+ break;
+ }
+ if( USHRT_MAX == nSrvId )
+ {
+ for( const ServiceIdResId* pMap = aServiceToRes;
+ USHRT_MAX != pMap->nResId; ++pMap )
+ if( nWhich == pMap->nResId )
+ {
+ nSrvId = pMap->nServiceId;
+ break;
+ }
+ }
+#ifdef DBG_UTIL
+ if( USHRT_MAX == nSrvId )
+ DBG_ERROR("resid not found");
+#endif
+ return nSrvId;
+}
+
+sal_uInt16 lcl_GetPropMapIdForFieldType( USHORT nWhich )
+{
+ sal_uInt16 nId;
+ switch( nWhich )
+ {
+ case RES_USERFLD: nId = PROPERTY_MAP_FLDMSTR_USER; break;
+ case RES_DBFLD: nId = PROPERTY_MAP_FLDMSTR_DATABASE; break;
+ case RES_SETEXPFLD: nId = PROPERTY_MAP_FLDMSTR_SET_EXP; break;
+ case RES_DDEFLD: nId = PROPERTY_MAP_FLDMSTR_DDE; break;
+ case RES_AUTHORITY: nId = PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY; break;
+ default: nId = PROPERTY_MAP_FLDMSTR_DUMMY0;
+ }
+ return nId;
+}
+
+
+BYTE GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp )
+{
+ USHORT nId = lcl_GetPropMapIdForFieldType( rTyp.Which() );
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap( nId );
+ if( !pMap )
+ nId = USHRT_MAX;
+ else
+ {
+ nId = USHRT_MAX; // in case of property not found
+ for( ; pMap->pName; ++pMap )
+ if( rProperty.equalsAsciiL( pMap->pName, pMap->nNameLen ) )
+ {
+ nId = pMap->nWID;
+ break;
+ }
+ }
+ return (BYTE)nId;
+}
+
+USHORT lcl_GetPropertyMapOfService( USHORT nServiceId )
+{
+ USHORT nRet;
+ switch ( nServiceId)
+ {
+ case SW_SERVICE_FIELDTYPE_DATETIME: nRet = PROPERTY_MAP_FLDTYP_DATETIME; break;
+ case SW_SERVICE_FIELDTYPE_USER: nRet = PROPERTY_MAP_FLDTYP_USER; break;
+ case SW_SERVICE_FIELDTYPE_SET_EXP: nRet = PROPERTY_MAP_FLDTYP_SET_EXP; break;
+ case SW_SERVICE_FIELDTYPE_GET_EXP: nRet = PROPERTY_MAP_FLDTYP_GET_EXP; break;
+ case SW_SERVICE_FIELDTYPE_FILE_NAME: nRet = PROPERTY_MAP_FLDTYP_FILE_NAME; break;
+ case SW_SERVICE_FIELDTYPE_PAGE_NUM: nRet = PROPERTY_MAP_FLDTYP_PAGE_NUM; break;
+ case SW_SERVICE_FIELDTYPE_AUTHOR: nRet = PROPERTY_MAP_FLDTYP_AUTHOR; break;
+ case SW_SERVICE_FIELDTYPE_CHAPTER: nRet = PROPERTY_MAP_FLDTYP_CHAPTER; break;
+ case SW_SERVICE_FIELDTYPE_GET_REFERENCE: nRet = PROPERTY_MAP_FLDTYP_GET_REFERENCE; break;
+ case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT: nRet = PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT; break;
+ case SW_SERVICE_FIELDTYPE_ANNOTATION: nRet = PROPERTY_MAP_FLDTYP_ANNOTATION; break;
+ case SW_SERVICE_FIELDTYPE_INPUT_USER:
+ case SW_SERVICE_FIELDTYPE_INPUT: nRet = PROPERTY_MAP_FLDTYP_INPUT; break;
+ case SW_SERVICE_FIELDTYPE_MACRO: nRet = PROPERTY_MAP_FLDTYP_MACRO; break;
+ case SW_SERVICE_FIELDTYPE_DDE: nRet = PROPERTY_MAP_FLDTYP_DDE; break;
+ case SW_SERVICE_FIELDTYPE_HIDDEN_PARA: nRet = PROPERTY_MAP_FLDTYP_HIDDEN_PARA; break;
+ case SW_SERVICE_FIELDTYPE_DOC_INFO: nRet = PROPERTY_MAP_FLDTYP_DOC_INFO; break;
+ case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME: nRet = PROPERTY_MAP_FLDTYP_TEMPLATE_NAME; break;
+ case SW_SERVICE_FIELDTYPE_USER_EXT: nRet = PROPERTY_MAP_FLDTYP_USER_EXT; break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_SET: nRet = PROPERTY_MAP_FLDTYP_REF_PAGE_SET; break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_GET: nRet = PROPERTY_MAP_FLDTYP_REF_PAGE_GET; break;
+ case SW_SERVICE_FIELDTYPE_JUMP_EDIT: nRet = PROPERTY_MAP_FLDTYP_JUMP_EDIT; break;
+ case SW_SERVICE_FIELDTYPE_SCRIPT: nRet = PROPERTY_MAP_FLDTYP_SCRIPT; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET: nRet = PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET: nRet = PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM: nRet = PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE: nRet = PROPERTY_MAP_FLDTYP_DATABASE; break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NAME: nRet = PROPERTY_MAP_FLDTYP_DATABASE_NAME; break;
+ case SW_SERVICE_FIELDTYPE_TABLE_FORMULA: nRet = PROPERTY_MAP_FLDTYP_TABLE_FORMULA; break;
+ case SW_SERVICE_FIELDTYPE_PAGE_COUNT:
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT:
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT:
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT:
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT:
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT:
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT: nRet = PROPERTY_MAP_FLDTYP_DOCSTAT; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_0:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_1:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_2:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_3:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT:
+ case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_MISC; break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION: nRet = PROPERTY_MAP_FLDTYP_DOCINFO_REVISION; break;
+ case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY: nRet = PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY; break;
+ case SW_SERVICE_FIELDTYPE_DUMMY_0:
+ case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS: nRet = PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS; break;
+ case SW_SERVICE_FIELDTYPE_DROPDOWN: nRet = PROPERTY_MAP_FLDTYP_DROPDOWN; break;
+ case SW_SERVICE_FIELDTYPE_DUMMY_4:
+ case SW_SERVICE_FIELDTYPE_DUMMY_5:
+ case SW_SERVICE_FIELDTYPE_DUMMY_6:
+ case SW_SERVICE_FIELDTYPE_DUMMY_7:
+ case SW_SERVICE_FIELDTYPE_DUMMY_8: nRet = PROPERTY_MAP_FLDTYP_DUMMY_0; break;
+ case SW_SERVICE_FIELDMASTER_USER: nRet = PROPERTY_MAP_FLDMSTR_USER; break;
+ case SW_SERVICE_FIELDMASTER_DDE: nRet = PROPERTY_MAP_FLDMSTR_DDE; break;
+ case SW_SERVICE_FIELDMASTER_SET_EXP: nRet = PROPERTY_MAP_FLDMSTR_SET_EXP; break;
+ case SW_SERVICE_FIELDMASTER_DATABASE: nRet = PROPERTY_MAP_FLDMSTR_DATABASE; break;
+ case SW_SERVICE_FIELDMASTER_BIBLIOGRAPHY: nRet = PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY; break;
+ case SW_SERVICE_FIELDMASTER_DUMMY2:
+ case SW_SERVICE_FIELDMASTER_DUMMY3:
+ case SW_SERVICE_FIELDMASTER_DUMMY4:
+ case SW_SERVICE_FIELDMASTER_DUMMY5: nRet = PROPERTY_MAP_FLDMSTR_DUMMY0; break;
+ case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT: nRet = PROPERTY_MAP_FLDTYP_HIDDEN_TEXT; break;
+ default:
+ DBG_ERROR( "wrong service id" );
+ nRet = USHRT_MAX;
+ }
+ return nRet;
+}
+
+/******************************************************************
+ * SwXFieldMaster
+ ******************************************************************/
+TYPEINIT1(SwXFieldMaster, SwClient);
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SwXFieldMaster::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXFieldMaster::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldMaster::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFieldMaster");
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFieldMaster::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ if(rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextFieldMaster")))
+ bRet = sal_True;
+ else
+ {
+ const sal_Char* pEntry;
+ switch( nResTypeId )
+ {
+ case RES_USERFLD: pEntry = "User"; break;
+ case RES_DBFLD: pEntry = "Database"; break;
+ case RES_SETEXPFLD: pEntry = "SetExpression"; break;
+ case RES_DDEFLD: pEntry = "DDE"; break;
+ case RES_AUTHORITY: pEntry = "Bibliography"; break;
+ default: pEntry = 0;
+ }
+ if( pEntry )
+ {
+ ByteString aTmp( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.fieldmaster."));
+ aTmp.Append( pEntry );
+ bRet = rServiceName.equalsAsciiL(aTmp.GetBuffer(), aTmp.Len());
+ }
+ }
+ return bRet;
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXFieldMaster::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFieldMaster");
+
+ const sal_Char* pEntry1;
+ switch( nResTypeId )
+ {
+ case RES_USERFLD: pEntry1 = "User"; break;
+ case RES_DBFLD: pEntry1 = "Database"; break;
+ case RES_SETEXPFLD: pEntry1 = "SetExpression"; break;
+ case RES_DDEFLD: pEntry1 = "DDE"; break;
+ case RES_AUTHORITY: pEntry1 = "Bibliography"; break;
+ default: pEntry1 = 0;
+ }
+ if( pEntry1 )
+ {
+ String s;
+ s.AppendAscii( "com.sun.star.text.fieldmaster." ).AppendAscii( pEntry1 );
+ pArray[1] = s;
+ }
+ return aRet;
+}
+/*-- 14.12.98 11:08:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldMaster::SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId) :
+ m_pDoc(pDoc),
+ aLstnrCntnr( (XPropertySet*)this),
+ nResTypeId(nResId),
+ m_bIsDescriptor(sal_True),
+ fParam1(0.),
+ bParam1(FALSE),
+ nParam1(-1),
+ nParam2(0)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/*-- 14.12.98 11:08:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldMaster::SwXFieldMaster(SwFieldType& rType, SwDoc* pDoc) :
+ SwClient(&rType),
+ aLstnrCntnr( (XPropertySet*)this),
+ m_pDoc(pDoc),
+ nResTypeId(rType.Which()),
+ m_bIsDescriptor(sal_False),
+ fParam1(0.),
+ nParam1(-1),
+ bParam1(FALSE)
+{
+
+}
+/*-- 14.12.98 11:08:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldMaster::~SwXFieldMaster()
+{
+
+}
+/*-- 14.12.98 11:08:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XPropertySetInfo > SwXFieldMaster::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XPropertySetInfo > aRef = new SfxItemPropertySetInfo(
+ aSwMapProvider.GetPropertyMap(
+ lcl_GetPropMapIdForFieldType( nResTypeId ) ));
+ return aRef;
+}
+/*-- 14.12.98 11:08:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::setPropertyValue( const OUString& rPropertyName,
+ const uno::Any& rValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwFieldType* pType = GetFldType(sal_True);
+ if(pType)
+ {
+ sal_Bool bSetValue = sal_True;
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_SUB_TYPE)))
+ {
+ const SvStringsDtor& rExtraArr = SwStyleNameMapper::GetExtraUINameArray();
+ String sTypeName = pType->GetName();
+ static sal_uInt16 nIds[] =
+ {
+ RES_POOLCOLL_LABEL_DRAWING - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_ABB - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_TABLE - RES_POOLCOLL_EXTRA_BEGIN,
+ RES_POOLCOLL_LABEL_FRAME- RES_POOLCOLL_EXTRA_BEGIN,
+ 0
+ };
+ for(const sal_uInt16 * pIds = nIds; *pIds; ++pIds)
+ {
+ if(sTypeName == *rExtraArr[ *pIds ] )
+ {
+ bSetValue = sal_False;
+ break;
+ }
+ }
+ }
+ if( bSetValue )
+ {
+ BYTE nMId = GetFieldTypeMId( rPropertyName, *pType );
+ if( UCHAR_MAX != nMId )
+ pType->PutValue( rValue, nMId );
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+ else if(!pType && m_pDoc &&
+ ( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME))) )
+ {
+ OUString uTmp;
+ rValue >>= uTmp;
+ String sTypeName(uTmp);
+ SwFieldType* pType = m_pDoc->GetFldType(nResTypeId, sTypeName);
+
+ String sTable(SW_RES(STR_POOLCOLL_LABEL_TABLE));
+ String sDrawing(SW_RES(STR_POOLCOLL_LABEL_DRAWING));
+ String sFrame(SW_RES(STR_POOLCOLL_LABEL_FRAME));
+ String sIllustration(SW_RES(STR_POOLCOLL_LABEL_ABB));
+
+ if(pType ||
+ (RES_SETEXPFLD == nResTypeId &&
+ ( sTypeName == sTable || sTypeName == sDrawing ||
+ sTypeName == sFrame || sTypeName == sIllustration )))
+ {
+ throw IllegalArgumentException();
+ }
+ else
+ {
+ switch(nResTypeId)
+ {
+ case RES_USERFLD :
+ {
+ SwUserFieldType aType(m_pDoc, sTypeName);
+ pType = m_pDoc->InsertFldType(aType);
+ ((SwUserFieldType*)pType)->SetContent(sParam1);
+ ((SwUserFieldType*)pType)->SetValue(fParam1);
+ ((SwUserFieldType*)pType)->SetType(bParam1 ? GSE_EXPR : GSE_STRING);
+ }
+ break;
+ case RES_DDEFLD :
+ {
+ SwDDEFieldType aType(sTypeName, sParam1,
+ bParam1 ? ::binfilter::LINKUPDATE_ALWAYS : ::binfilter::LINKUPDATE_ONCALL);
+ pType = m_pDoc->InsertFldType(aType);
+ }
+ break;
+ case RES_SETEXPFLD :
+ {
+ SwSetExpFieldType aType(m_pDoc, sTypeName);
+ if(sParam1.Len())
+ aType.SetDelimiter( sParam1.GetChar(0));
+ if(nParam1 > -1 && nParam1 < MAXLEVEL)
+ aType.SetOutlineLvl(nParam1);
+ pType = m_pDoc->InsertFldType(aType);
+ }
+ break;
+ }
+ if(pType)
+ {
+ pType->Add(this);
+ m_bIsDescriptor = sal_False;
+ }
+ else
+ throw uno::RuntimeException();
+ }
+
+ DBG_ASSERT(pType, "kein FieldType gefunden!" );
+ }
+ else
+ {
+ switch( nResTypeId )
+ {
+ case RES_USERFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CONTENT)))
+ ::binfilter::GetString( rValue, sParam1 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_VALUE )))
+ {
+ if(rValue.getValueType() != ::getCppuType((const double*)0))
+ throw IllegalArgumentException();
+ fParam1 = *(double*)rValue.getValue();
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_EXPRESSION )))
+ {
+ if(rValue.getValueType() != ::getBooleanCppuType())
+ throw IllegalArgumentException();
+ bParam1 = *(sal_Bool*)rValue.getValue();
+ }
+ break;
+ case RES_DBFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)))
+ ::binfilter::GetString( rValue, sParam1 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_TABLE_NAME)))
+ ::binfilter::GetString( rValue, sParam2 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COLUMN_NAME)))
+ ::binfilter::GetString( rValue, sParam3 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)))
+ rValue >>= nParam2;
+
+ if(sParam1.Len() && sParam2.Len() && sParam3.Len())
+ GetFldType();
+ break;
+ case RES_SETEXPFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_SEPARATOR)))
+ ::binfilter::GetString( rValue, sParam1 );
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAPTER_NUMBERING_LEVEL)))
+ rValue >>= nParam1;
+ break;
+ case RES_DDEFLD:
+ {
+ USHORT nPart = rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_TYPE)) ? 0 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_FILE)) ? 1 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_ELEMENT)) ? 2 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC_UPDATE)) ? 3 : USHRT_MAX;
+ if(nPart < 3 )
+ {
+ String sTmp;
+ if(!sParam1.Len())
+ (sParam1 = ::binfilter::cTokenSeperator)
+ += ::binfilter::cTokenSeperator;
+
+ sParam1.SetToken( nPart, ::binfilter::cTokenSeperator,
+ ::binfilter::GetString( rValue, sTmp ));
+ }
+ else if(3 == nPart)
+ bParam1 = *(sal_Bool*)rValue.getValue();
+ }
+ break;
+ default:
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+}
+/* -----------------------------30.03.01 14:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwFieldType* SwXFieldMaster::GetFldType(sal_Bool bDontCreate) const
+{
+ if(!bDontCreate && RES_DBFLD == nResTypeId && m_bIsDescriptor && m_pDoc)
+ {
+ SwDBData aData;
+ aData.sDataSource = sParam1;
+ aData.sCommand = sParam2;
+ aData.nCommandType = nParam2;
+ SwDBFieldType aType(m_pDoc, sParam3, aData);
+ SwFieldType* pType = m_pDoc->InsertFldType(aType);
+ SwXFieldMaster* pThis = ((SwXFieldMaster*)this);
+ pType->Add(pThis);
+ pThis->m_bIsDescriptor = sal_False;
+ }
+ if(m_bIsDescriptor)
+ return 0;
+ else
+ return (SwFieldType*)GetRegisteredIn();
+}
+
+/*-- 14.12.98 11:08:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+typedef SwFmtFld* SwFmtFldPtr;
+SV_DECL_PTRARR(SwDependentFields, SwFmtFldPtr, 5, 5)
+SV_IMPL_PTRARR(SwDependentFields, SwFmtFldPtr)
+
+uno::Any SwXFieldMaster::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwFieldType* pType = GetFldType(sal_True);
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_INSTANCE_NAME)) )
+ {
+ String sName;
+ if(pType)
+ SwXTextFieldMasters::getInstanceName(*pType, sName);
+ aRet <<= OUString(sName);
+ }
+ else if(pType)
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME) ))
+ {
+ aRet <<= SwXFieldMaster::GetProgrammaticName(*pType, *GetDoc());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEPENDENT_TEXT_FIELDS)) )
+ {
+ //fill all text fields into a sequence
+ SwClientIter aIter( *pType );
+ SwDependentFields aFldArr;
+ SwFmtFldPtr pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+ while(pFld)
+ {
+ if(pFld->IsFldInDoc())
+ aFldArr.Insert(pFld, aFldArr.Count());
+ pFld = (SwFmtFld*)aIter.Next();
+ }
+ Sequence<Reference <XDependentTextField> > aRetSeq(aFldArr.Count());
+ Reference<XDependentTextField>* pRetSeq = aRetSeq.getArray();
+ SwXTextField* pInsert = 0;
+ for(int i = 0; i < aFldArr.Count(); i++)
+ {
+ pFld = aFldArr.GetObject(i);
+ SwXTextField* pTemp = (SwXTextField*)aIter.First(TYPE(SwXTextField));
+ while(pTemp)
+ {
+ if(pTemp->GetFldFmt() == pFld)
+ {
+ pInsert = pTemp;
+ break;
+ }
+ pTemp = (SwXTextField*)aIter.Next();
+ }
+ if(!pInsert)
+ pInsert = new SwXTextField( *pFld, GetDoc());
+ pRetSeq[i] = Reference<XDependentTextField>(pInsert);
+ pInsert = 0;
+ }
+ aRet <<= aRetSeq;
+ }
+ else if(pType)
+ {
+ //TODO: Properties fuer die uebrigen Feldtypen einbauen
+ BYTE nMId = GetFieldTypeMId( rPropertyName, *pType );
+ if( UCHAR_MAX != nMId )
+ pType->QueryValue( aRet, nMId );
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)) )
+ aRet <<= nParam2;
+ }
+ }
+ else
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COMMAND_TYPE)) )
+ aRet <<= nParam2;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEPENDENT_TEXT_FIELDS)) )
+ {
+ Sequence<Reference <XDependentTextField> > aRetSeq(0);
+ aRet <<= aRetSeq;
+ }
+ else
+ {
+ const String* pStr = 0;
+ String sStr;
+ switch ( nResTypeId )
+ {
+ case RES_USERFLD:
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CONTENT)) )
+ pStr = &sParam1;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_VALUE )))
+ aRet <<= fParam1;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_EXPRESSION )))
+ aRet.setValue(&bParam1, ::getBooleanCppuType());
+ break;
+ case RES_DBFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)))
+ pStr = &sParam1;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_TABLE_NAME)))
+ pStr = &sParam2;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COLUMN_NAME)))
+ pStr = &sParam3;
+ break;
+ case RES_SETEXPFLD:
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NUMBERING_SEPARATOR)))
+ pStr = &sParam1;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAPTER_NUMBERING_LEVEL)))
+ aRet <<= nParam1;
+ break;
+ case RES_DDEFLD:
+ {
+ USHORT nPart = rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_TYPE)) ? 0 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_FILE)) ? 1 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DDE_COMMAND_ELEMENT)) ? 2 :
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC_UPDATE)) ? 3 : USHRT_MAX;
+ if(nPart < 3 )
+ pStr = &(sStr = sParam1.GetToken(nPart, ::binfilter::cTokenSeperator));
+ else if(3 == nPart)
+ aRet.setValue(&bParam1, ::getBooleanCppuType());
+ }
+ break;
+ default:
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+
+ if( pStr )
+ aRet <<= OUString( *pStr );
+ }
+ }
+ return aRet;
+}
+/*-- 14.12.98 11:08:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:08:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:08:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:08:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/*-- 25.02.99 11:01:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFieldType* pFldType = GetFldType(sal_True);
+ if(pFldType)
+ {
+ sal_uInt16 nTypeIdx = USHRT_MAX;
+ const SwFldTypes* pTypes = GetDoc()->GetFldTypes();
+ for( sal_uInt16 i = 0; i < pTypes->Count(); i++ )
+ {
+ if((*pTypes)[i] == pFldType)
+ nTypeIdx = i;
+ }
+
+ // zuerst alle Felder loeschen
+ SwClientIter aIter( *pFldType );
+ SwFmtFld* pFld = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+ while(pFld)
+ {
+ // Feld im Undo?
+ SwTxtFld *pTxtFld = pFld->GetTxtFld();
+ if(pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() )
+ {
+ SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode();
+ SwPaM aPam(rTxtNode, *pTxtFld->GetStart());
+ aPam.SetMark();
+ aPam.Move();
+ GetDoc()->DeleteAndJoin(aPam);
+ }
+ pFld = (SwFmtFld*)aIter.Next();
+ }
+ // dann den FieldType loeschen
+ GetDoc()->RemoveFldType(nTypeIdx);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 25.02.99 11:02:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::addEventListener(const uno::Reference< XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 25.02.99 11:02:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::removeEventListener(const uno::Reference< XEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+
+/*-- 14.12.98 11:08:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFieldMaster::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ aLstnrCntnr.Disposing();
+ m_pDoc = 0;
+ }
+}
+/* -----------------------------06.11.00 09:44--------------------------------
+
+const Programmatic2UIName_Impl* lcl_GetFieldNameTable()
+{
+ static BOOL bInitialized = FALSE;
+ static Programmatic2UIName_Impl aFieldNames[5];
+ if(!bInitialized)
+ {
+ bInitialized = TRUE;
+ int nName = 0;
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_ABB ));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_ABB));
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_TABLE ));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_TABLE));
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_FRAME));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_FRAME));
+ aFieldNames[nName].sUIName = String (SW_RES(STR_POOLCOLL_LABEL_DRAWING ));
+ aFieldNames[nName++].sProgrammaticName = String (SW_RES(STR_POCO_PRGM_LABEL_DRAWING));
+ }
+ return &aFieldNames[0];
+}
+ ---------------------------------------------------------------------------*/
+/* -----------------------------06.11.00 10:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc)
+{
+ OUString sRet(rType.GetName());
+ if(RES_SETEXPFLD == rType.Which())
+ {
+ const SwFldTypes* pTypes = rDoc.GetFldTypes();
+ for( sal_uInt16 i = 0; i <= INIT_FLDTYPES; i++ )
+ {
+ if((*pTypes)[i] == &rType)
+ {
+ sRet = SwStyleNameMapper::GetProgName ( sRet, GET_POOLID_TXTCOLL );
+ break;
+ }
+ }
+ }
+ return sRet;
+}
+/* -----------------------------06.11.00 14:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldMaster::LocalizeFormula(
+ const SwSetExpField& rFld,
+ const OUString& rFormula,
+ sal_Bool bQuery)
+{
+ const OUString sTypeName(rFld.GetTyp()->GetName());
+ OUString sProgName = SwStyleNameMapper::GetProgName(sTypeName, GET_POOLID_TXTCOLL );
+ if(sProgName != sTypeName)
+ {
+ OUString sSource = bQuery ? sTypeName : sProgName;
+ OUString sDest = bQuery ? sProgName : sTypeName;
+ if(!rFormula.compareTo(sSource, sSource.getLength()))
+ {
+ OUString sTmpFormula = sDest;
+ sTmpFormula += rFormula.copy(sSource.getLength());
+ return sTmpFormula;
+ }
+ }
+ return rFormula;
+}
+/******************************************************************
+ *
+ ******************************************************************/
+struct SwFieldProperties_Impl
+{
+ String sPar1;
+ String sPar2;
+ String sPar3;
+ String sPar4;
+ Date aDate;
+ double fDouble;
+ Sequence<PropertyValue> aPropSeq;
+ Sequence<OUString> aStrings;
+ util::DateTime* pDateTime;
+
+ sal_Int32 nSubType;
+ sal_Int32 nFormat;
+ sal_uInt16 nUSHORT1;
+ sal_uInt16 nUSHORT2;
+ sal_Int16 nSHORT1;
+ sal_Int8 nByte1;
+ sal_Bool bFormatIsDefault;
+ sal_Bool bBool1;
+ sal_Bool bBool2;
+ sal_Bool bBool3;
+ sal_Bool bBool4;
+
+ SwFieldProperties_Impl():
+ nSubType(0),
+ nFormat(0),
+ nUSHORT1(0),
+ nUSHORT2(0),
+ nSHORT1(0),
+ nByte1(0),
+ fDouble(0.),
+ bBool1(sal_False),
+ bBool2(sal_False),
+ bBool3(sal_False),
+ bBool4(sal_True), //Automatic language
+ bFormatIsDefault(sal_True),
+ pDateTime(0)
+ {}
+ ~SwFieldProperties_Impl()
+ {delete pDateTime;}
+
+};
+
+TYPEINIT1(SwXTextField, SwClient);
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const ::com::sun::star::uno::Sequence< sal_Int8 > & SwXTextField::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextField::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/*-- 14.12.98 11:37:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+SwXTextField::SwXTextField(sal_uInt16 nServiceId) :
+ pFmtFld(0),
+ aLstnrCntnr( (XTextContent*)this),
+ m_pDoc(0),
+ m_nServiceId(nServiceId),
+ m_bIsDescriptor(nServiceId != USHRT_MAX),
+ m_pProps(new SwFieldProperties_Impl),
+ m_bCallUpdate(sal_False)
+{
+ //Set visible as default!
+ if(SW_SERVICE_FIELDTYPE_SET_EXP == nServiceId ||
+ SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM == nServiceId ||
+ SW_SERVICE_FIELDTYPE_DATABASE == nServiceId ||
+ SW_SERVICE_FIELDTYPE_DATABASE_NAME == nServiceId )
+ m_pProps->bBool2 = sal_True;
+ else if(SW_SERVICE_FIELDTYPE_TABLE_FORMULA == nServiceId)
+ m_pProps->bBool1 = sal_True;
+
+}
+/*-- 14.12.98 11:37:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextField::SwXTextField(const SwFmtFld& rFmt, SwDoc* pDc) :
+ pFmtFld(&rFmt),
+ aLstnrCntnr( (XTextContent*)this),
+ m_pDoc(pDc),
+ m_nServiceId( lcl_GetServiceForField( *pFmtFld->GetFld() ) ),
+ m_bIsDescriptor(sal_False),
+ m_pProps(0),
+ m_bCallUpdate(sal_False)
+{
+ pDc->GetUnoCallBack()->Add(this);
+}
+/*-- 14.12.98 11:37:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextField::~SwXTextField()
+{
+ delete m_pProps;
+}
+/*-- 14.12.98 11:37:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::attachTextFieldMaster(const uno::Reference< XPropertySet > & xFieldMaster)
+ throw( IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!m_bIsDescriptor)
+ throw uno::RuntimeException();
+ uno::Reference< XUnoTunnel > xMasterTunnel(xFieldMaster, uno::UNO_QUERY);
+ if (!xMasterTunnel.is())
+ throw IllegalArgumentException();
+ SwXFieldMaster* pMaster = (SwXFieldMaster*)xMasterTunnel->getSomething(
+ SwXFieldMaster::getUnoTunnelId());
+
+ SwFieldType* pFieldType = pMaster ? pMaster->GetFldType() : 0;
+ if(pFieldType && pFieldType->Which() == lcl_ServiceIdToResId(m_nServiceId))
+ {
+ m_sTypeName = pFieldType->GetName();
+ }
+ else
+ throw IllegalArgumentException();
+
+}
+/*-- 14.12.98 11:37:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XPropertySet > SwXTextField::getTextFieldMaster(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ SwFieldType* pType = pFmtFld->GetFld()->GetTyp();
+ SwXFieldMaster* pMaster = (SwXFieldMaster*)
+ SwClientIter(*pType).First(TYPE(SwXFieldMaster));
+ if(!pMaster)
+ pMaster = new SwXFieldMaster(*pType, GetDoc());
+
+ return pMaster;
+}
+/*-- 14.12.98 11:37:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextField::getPresentation(sal_Bool bShowCommand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ OUString sRet;
+ const SwField* pField = GetField();
+ if(pField)
+ sRet = pField->GetCntnt(bShowCommand);
+ else
+ throw uno::RuntimeException();
+ return sRet;
+}
+/* -----------------18.02.99 13:39-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextField::attachToRange(
+ const uno::Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!m_bIsDescriptor)
+ throw uno::RuntimeException();
+ uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ //wurde ein FieldMaster attached, dann ist das Dokument schon festgelegt!
+ if(pDoc && (!m_pDoc || m_pDoc == pDoc))
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ SwField* pFld = 0;
+ switch(m_nServiceId)
+ {
+ case SW_SERVICE_FIELDTYPE_ANNOTATION:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_POSTITFLD);
+ pFld = new SwPostItField((SwPostItFieldType*)pFldType,
+ m_pProps->sPar1, m_pProps->sPar2,
+ m_pProps->aDate);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_SCRIPT:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_SCRIPTFLD);
+ pFld = new SwScriptField((SwScriptFieldType*)pFldType,
+ m_pProps->sPar1, m_pProps->sPar2,
+ m_pProps->bBool1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATETIME:
+ {
+ sal_uInt16 nSub = 0;
+ if(m_pProps->bBool1)
+ nSub |= FIXEDFLD;
+ if(m_pProps->bBool2)
+ nSub |= DATEFLD;
+ else
+ nSub |= TIMEFLD;
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DATETIMEFLD);
+ pFld = new SwDateTimeField((SwDateTimeFieldType*)pFldType,
+ nSub, m_pProps->nFormat);
+ if(m_pProps->fDouble > 0.)
+ ((SwDateTimeField*)pFld)->SetValue( m_pProps->fDouble );
+ if(m_pProps->pDateTime)
+ {
+ Any aVal; aVal <<= *m_pProps->pDateTime;
+ pFld->PutValue( aVal, FIELD_PROP_DATE_TIME );
+ }
+ ((SwDateTimeField*)pFld)->SetOffset(m_pProps->nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_FILE_NAME:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_FILENAMEFLD);
+ sal_Int32 nFormat = m_pProps->nFormat;
+ if(m_pProps->bBool2)
+ nFormat |= FF_FIXED;
+ pFld = new SwFileNameField((SwFileNameFieldType*)pFldType, nFormat);
+ if(m_pProps->sPar3.Len())
+ ((SwFileNameField*)pFld)->SetExpansion(m_pProps->sPar3);
+ Any aFormat(&m_pProps->nFormat, ::getCppuType(&m_pProps->nFormat));
+ pFld->PutValue( aFormat, FIELD_PROP_FORMAT );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_TEMPLATE_NAME:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_TEMPLNAMEFLD);
+ pFld = new SwTemplNameField((SwTemplNameFieldType*)pFldType,
+ m_pProps->nFormat);
+ Any aFormat(&m_pProps->nFormat, ::getCppuType(&m_pProps->nFormat));
+ pFld->PutValue(aFormat, FIELD_PROP_FORMAT);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_CHAPTER:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_CHAPTERFLD);
+ pFld = new SwChapterField((SwChapterFieldType*)pFldType, m_pProps->nUSHORT1);
+ ((SwChapterField*)pFld)->SetLevel(m_pProps->nByte1);
+ Any aVal; aVal <<= (sal_Int16)m_pProps->nUSHORT1;
+ pFld->PutValue(aVal, FIELD_PROP_USHORT1 );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_AUTHOR:
+ {
+ long nFormat = m_pProps->bBool1 ? AF_NAME : AF_SHORTCUT;
+ if(m_pProps->bBool2)
+ nFormat |= AF_FIXED;
+
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_AUTHORFLD);
+ pFld = new SwAuthorField((SwAuthorFieldType*)pFldType, nFormat);
+ ((SwAuthorField*)pFld)->SetExpansion(m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_CONDITIONED_TEXT:
+ case SW_SERVICE_FIELDTYPE_HIDDEN_TEXT:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENTXTFLD);
+ pFld = new SwHiddenTxtField(((SwHiddenTxtFieldType*)pFldType),
+ m_pProps->sPar1,
+ m_pProps->sPar2, m_pProps->sPar3,
+ SW_SERVICE_FIELDTYPE_HIDDEN_TEXT == m_nServiceId ?
+ TYP_HIDDENTXTFLD :
+ TYP_CONDTXTFLD);
+ ((SwHiddenTxtField*)pFld)->SetValue(m_pProps->bBool1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_HIDDEN_PARA:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_HIDDENPARAFLD);
+ pFld = new SwHiddenParaField((SwHiddenParaFieldType*)pFldType,
+ m_pProps->sPar1);
+ ((SwHiddenParaField*)pFld)->SetHidden(m_pProps->bBool1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_GET_REFERENCE:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_GETREFFLD);
+ pFld = new SwGetRefField((SwGetRefFieldType*)pFldType,
+ m_pProps->sPar1,
+ 0,
+ 0,
+ 0);
+ if(m_pProps->sPar3.Len())
+ ((SwGetRefField*)pFld)->SetExpand(m_pProps->sPar3);
+ Any aVal; aVal <<=(sal_Int16)m_pProps->nUSHORT1;
+ pFld->PutValue(aVal, FIELD_PROP_USHORT1 );
+ aVal <<=(sal_Int16)m_pProps->nUSHORT2;
+ pFld->PutValue(aVal, FIELD_PROP_USHORT2 );
+ aVal <<=(sal_Int16)m_pProps->nSHORT1;
+ pFld->PutValue(aVal, FIELD_PROP_SHORT1 );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_JUMP_EDIT:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_JUMPEDITFLD);
+ pFld = new SwJumpEditField((SwJumpEditFieldType*)pFldType,
+ m_pProps->nUSHORT1, m_pProps->sPar2, m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_DESCRIPTION :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_0 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_1 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_2 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_INFO_3 :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_AUTHOR :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_KEY_WORDS :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_SUBJECT :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_TITLE :
+ case SW_SERVICE_FIELDTYPE_DOCINFO_REVISION :
+ case SW_SERVICE_FIELDTYPE_DOC_INFO:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DOCINFOFLD);
+ sal_uInt16 nSubType = aDocInfoSubTypeFromService[
+ m_nServiceId - SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_AUTHOR];
+ if( SW_SERVICE_FIELDTYPE_DOCINFO_CHANGE_DATE_TIME == m_nServiceId ||
+ SW_SERVICE_FIELDTYPE_DOCINFO_CREATE_DATE_TIME == m_nServiceId ||
+ SW_SERVICE_FIELDTYPE_DOCINFO_PRINT_DATE_TIME == m_nServiceId ||
+ SW_SERVICE_FIELDTYPE_DOCINFO_EDIT_TIME == m_nServiceId )
+ {
+ if(m_pProps->bBool2) //IsDate
+ {
+ nSubType &= 0xf0ff;
+ nSubType |= DI_SUB_DATE;
+ }
+ else
+ {
+ nSubType &= 0xf0ff;
+ nSubType |= DI_SUB_TIME;
+ }
+ }
+ if(m_pProps->bBool1)
+ nSubType |= DI_SUB_FIXED;
+ pFld = new SwDocInfoField((SwDocInfoFieldType*)pFldType, nSubType, m_pProps->nFormat);
+ if(m_pProps->sPar3.Len())
+ ((SwDocInfoField*)pFld)->SetExpansion(m_pProps->sPar3);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_USER_EXT:
+ {
+ sal_Int32 nFormat = 0;
+ if(m_pProps->bBool1)
+ nFormat = AF_FIXED;
+
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_EXTUSERFLD);
+ pFld = new SwExtUserField((SwExtUserFieldType*)pFldType, m_pProps->nUSHORT1, nFormat);
+ ((SwExtUserField*)pFld)->SetExpansion(m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_USER:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_USERFLD, m_sTypeName);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ USHORT nUserSubType = m_pProps->bBool1 ? SUB_INVISIBLE : 0;
+ if(m_pProps->bBool2)
+ nUserSubType |= SUB_CMD;
+ if(m_pProps->bFormatIsDefault &&
+ GSE_STRING == ((SwUserFieldType*)pFldType)->GetType())
+ m_pProps->nFormat = -1;
+ pFld = new SwUserField((SwUserFieldType*)pFldType,
+ nUserSubType,
+ m_pProps->nFormat);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_SET:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_REFPAGESETFLD);
+ pFld = new SwRefPageSetField( (SwRefPageSetFieldType*)pFldType,
+ m_pProps->nUSHORT1,
+ m_pProps->bBool1 );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_REF_PAGE_GET:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_REFPAGEGETFLD);
+ pFld = new SwRefPageGetField( (SwRefPageGetFieldType*)pFldType,
+ m_pProps->nUSHORT1 );
+ ((SwRefPageGetField*)pFld)->SetText(m_pProps->sPar1);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_PAGE_NUM:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_PAGENUMBERFLD);
+ pFld = new SwPageNumberField((SwPageNumberFieldType*)pFldType,
+ PG_RANDOM,
+ m_pProps->nFormat,
+ m_pProps->nUSHORT1);
+ ((SwPageNumberField*)pFld)->SetUserString(m_pProps->sPar1);
+ Any aVal; aVal <<= m_pProps->nSubType;
+ pFld->PutValue( aVal, FIELD_PROP_SUBTYPE );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DDE:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_DDEFLD, m_sTypeName);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ pFld = new SwDDEField( (SwDDEFieldType*)pFldType );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NAME:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DBNAMEFLD);
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ pFld = new SwDBNameField((SwDBNameFieldType*)pFldType, aData);
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~SUB_INVISIBLE;
+ else
+ nSubType |= SUB_INVISIBLE;
+ pFld->SetSubType(nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NEXT_SET:
+ {
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DBNEXTSETFLD);
+ pFld = new SwDBNextSetField((SwDBNextSetFieldType*)pFldType,
+ m_pProps->sPar3, aEmptyStr,
+ aData);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_NUM_SET:
+ {
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ pFld = new SwDBNumSetField( (SwDBNumSetFieldType*)
+ pDoc->GetSysFldType(RES_DBNUMSETFLD),
+ m_pProps->sPar3,
+ String::CreateFromInt32(m_pProps->nFormat),
+ aData );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE_SET_NUM:
+ {
+ SwDBData aData;
+ aData.sDataSource = m_pProps->sPar1;
+ aData.sCommand = m_pProps->sPar2;
+ aData.nCommandType = m_pProps->nSHORT1;
+ pFld = new SwDBSetNumberField((SwDBSetNumberFieldType*)
+ pDoc->GetSysFldType(RES_DBSETNUMBERFLD),
+ aData,
+ m_pProps->nUSHORT1);
+ ((SwDBSetNumberField*)pFld)->SetSetNumber(m_pProps->nFormat);
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~SUB_INVISIBLE;
+ else
+ nSubType |= SUB_INVISIBLE;
+ pFld->SetSubType(nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_DATABASE:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_DBFLD, m_sTypeName);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ pFld = new SwDBField((SwDBFieldType*)pFldType, m_pProps->nFormat);
+ ((SwDBField*)pFld)->InitContent(m_pProps->sPar1);
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~SUB_INVISIBLE;
+ else
+ nSubType |= SUB_INVISIBLE;
+ pFld->SetSubType(nSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_SET_EXP:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_SETEXPFLD, m_sTypeName);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ //#93192# detect the field type's sub type and set an appropriate number format
+ if(m_pProps->bFormatIsDefault &&
+ GSE_STRING == ((SwSetExpFieldType*)pFldType)->GetType())
+ m_pProps->nFormat = -1;
+ pFld = new SwSetExpField((SwSetExpFieldType*)pFldType,
+ m_pProps->sPar2,
+ m_pProps->nFormat);
+
+ sal_uInt16 nSubType = pFld->GetSubType();
+ if(m_pProps->bBool2)
+ nSubType &= ~SUB_INVISIBLE;
+ else
+ nSubType |= SUB_INVISIBLE;
+ if(m_pProps->bBool3)
+ nSubType |= SUB_CMD;
+ else
+ nSubType &= ~SUB_CMD;
+ pFld->SetSubType(nSubType);
+ ((SwSetExpField*)pFld)->SetSeqNumber( m_pProps->nUSHORT1 );
+ ((SwSetExpField*)pFld)->SetInputFlag(m_pProps->bBool1);
+ ((SwSetExpField*)pFld)->SetPromptText(m_pProps->sPar3);
+ if(m_pProps->sPar4.Len())
+ ((SwSetExpField*)pFld)->ChgExpStr(m_pProps->sPar4);
+
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_GET_EXP:
+ {
+ sal_uInt16 nSubType;
+ switch(m_pProps->nSubType)
+ {
+ case SetVariableType::STRING: nSubType = GSE_STRING; break;
+ case SetVariableType::VAR: nSubType = GSE_EXPR; break;
+ case SetVariableType::SEQUENCE: nSubType = GSE_SEQ; break;
+ case SetVariableType::FORMULA: nSubType = GSE_FORMULA; break;
+ default:
+ DBG_ERROR("wrong value");
+ nSubType = GSE_EXPR;
+ }
+ if(m_pProps->bBool2)
+ nSubType |= SUB_CMD;
+ else
+ nSubType &= ~SUB_CMD;
+ pFld = new SwGetExpField((SwGetExpFieldType*)
+ pDoc->GetSysFldType(RES_GETEXPFLD),
+ m_pProps->sPar1, nSubType, m_pProps->nFormat);
+ //TODO: SubType auswerten!
+ if(m_pProps->sPar4.Len())
+ ((SwGetExpField*)pFld)->ChgExpStr(m_pProps->sPar4);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_INPUT_USER:
+ case SW_SERVICE_FIELDTYPE_INPUT:
+ {
+ SwFieldType* pFldType = pDoc->GetFldType(RES_INPUTFLD, m_sTypeName);
+ if(!pFldType)
+ throw uno::RuntimeException();
+ USHORT nInpSubType = SW_SERVICE_FIELDTYPE_INPUT_USER == m_nServiceId ? INP_USR : INP_TXT;
+ pFld = new SwInputField((SwInputFieldType*)pFldType,
+ m_pProps->sPar1, m_pProps->sPar2, nInpSubType);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_MACRO:
+ {
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_MACROFLD);
+ String aName;
+ SwMacroField::CreateMacroString(
+ aName, m_pProps->sPar1, m_pProps->sPar3 );
+ pFld = new SwMacroField((SwMacroFieldType*)pFldType, aName,
+ m_pProps->sPar2);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_PAGE_COUNT :
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT :
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT :
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT :
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT :
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT :
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT :
+ {
+ sal_uInt16 nSubType = DS_PAGE;
+ switch(m_nServiceId)
+ {
+// case SW_SERVICE_FIELDTYPE_PAGE_COUNT : break;
+ case SW_SERVICE_FIELDTYPE_PARAGRAPH_COUNT : nSubType = DS_PARA;break;
+ case SW_SERVICE_FIELDTYPE_WORD_COUNT : nSubType = DS_WORD;break;
+ case SW_SERVICE_FIELDTYPE_CHARACTER_COUNT : nSubType = DS_CHAR;break;
+ case SW_SERVICE_FIELDTYPE_TABLE_COUNT : nSubType = DS_TBL;break;
+ case SW_SERVICE_FIELDTYPE_GRAPHIC_OBJECT_COUNT : nSubType = DS_GRF;break;
+ case SW_SERVICE_FIELDTYPE_EMBEDDED_OBJECT_COUNT : nSubType = DS_OLE;break;
+ }
+ SwFieldType* pFldType = pDoc->GetSysFldType(RES_DOCSTATFLD);
+ pFld = new SwDocStatField((SwDocStatFieldType*)pFldType, nSubType, m_pProps->nUSHORT2);
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_BIBLIOGRAPHY:
+ pFld = new SwAuthorityField( (SwAuthorityFieldType*)
+ pDoc->InsertFldType(SwAuthorityFieldType(pDoc)),
+ aEmptyStr );
+ if(m_pProps->aPropSeq.getLength())
+ {
+ Any aVal; aVal <<= m_pProps->aPropSeq;
+ pFld->PutValue( aVal, FIELD_PROP_PROP_SEQ );
+ }
+ break;
+ case SW_SERVICE_FIELDTYPE_COMBINED_CHARACTERS:
+ // create field
+ pFld = new SwCombinedCharField( (SwCombinedCharFieldType*)
+ pDoc->GetSysFldType(RES_COMBINED_CHARS),
+ m_pProps->sPar1);
+ break;
+ case SW_SERVICE_FIELDTYPE_DROPDOWN:
+ pFld = new SwDropDownField
+ ((SwDropDownFieldType *)
+ pDoc->GetSysFldType(RES_DROPDOWN));
+
+ ((SwDropDownField *) pFld)->SetItems(m_pProps->aStrings);
+ ((SwDropDownField *) pFld)->SetSelectedItem(m_pProps->sPar1);
+ ((SwDropDownField *) pFld)->SetName(m_pProps->sPar2);
+ break;
+
+ case SW_SERVICE_FIELDTYPE_TABLE_FORMULA :
+ {
+
+ // create field
+ USHORT nType = GSE_FORMULA;
+ if(m_pProps->bBool1)
+ {
+ nType |= SUB_CMD;
+ if(m_pProps->bFormatIsDefault)
+ m_pProps->nFormat = -1;
+ }
+ pFld = new SwTblField( (SwTblFieldType*)
+ pDoc->GetSysFldType(RES_TABLEFLD),
+ m_pProps->sPar2,
+ nType,
+ m_pProps->nFormat);
+ ((SwTblField*)pFld)->ChgExpStr(m_pProps->sPar1);
+ }
+ break;
+ default: DBG_ERROR("was ist das fuer ein Typ?");
+ }
+ if(pFld)
+ {
+ pFld->SetAutomaticLanguage(!m_pProps->bBool4);
+ SwFmtFld aFmt( *pFld );
+
+ UnoActionContext aCont(pDoc);
+ SwTxtAttr* pTxtAttr = 0;
+ if(aPam.HasMark())
+ pDoc->DeleteAndJoin(aPam);
+ pDoc->Insert(aPam, aFmt);
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FIELD);
+
+ // was passiert mit dem Update der Felder ? (siehe fldmgr.cxx)
+ if(pTxtAttr)
+ {
+ const SwFmtFld& rFld = pTxtAttr->GetFld();
+ pFmtFld = &rFld;
+ }
+ }
+ delete pFld;
+
+ m_pDoc = pDoc;
+ m_pDoc->GetUnoCallBack()->Add(this);
+ m_bIsDescriptor = sal_False;
+ DELETEZ(m_pProps);
+ if(m_bCallUpdate)
+ update();
+ }
+ else
+ throw IllegalArgumentException();
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::attach(const uno::Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextField::getAnchor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > aRef;
+ SwField* pField = (SwField*)GetField();
+ if(pField)
+ {
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ if(!pTxtFld)
+ throw uno::RuntimeException();
+ const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+
+ SwPaM aPam(rTxtNode, *pTxtFld->GetStart() + 1, rTxtNode, *pTxtFld->GetStart());
+
+ aRef = SwXTextRange::CreateTextRangeFromPosition(m_pDoc,
+ *aPam.GetPoint(), aPam.GetMark());
+ }
+ return aRef;
+
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwField* pField = (SwField*)GetField();
+ if(pField)
+ {
+ UnoActionContext aContext(GetDoc());
+ const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
+ SwTxtNode& rTxtNode = (SwTxtNode&)*pTxtFld->GetpTxtNode();
+ SwPaM aPam(rTxtNode, *pTxtFld->GetStart());
+ aPam.SetMark();
+ aPam.Move();
+ GetDoc()->DeleteAndJoin(aPam);
+ }
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::addEventListener(const uno::Reference< XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 14.12.98 11:37:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::removeEventListener(const uno::Reference< XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/*-- 14.12.98 11:37:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XPropertySetInfo > SwXTextField::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ //kein static
+ uno::Reference< XPropertySetInfo > aRef;
+ if(m_nServiceId != USHRT_MAX)
+ {
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(
+ lcl_GetPropertyMapOfService( m_nServiceId ));
+ uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo(pMap);
+ // extend PropertySetInfo!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ aRef = new SfxExtItemPropertySetInfo(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS),
+ aPropSeq );
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 14.12.98 11:37:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::Any& rValue)
+ throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwField* pField = (SwField*)GetField();
+ const SfxItemPropertyMap* _pMap = aSwMapProvider.GetPropertyMap(
+ lcl_GetPropertyMapOfService( m_nServiceId));
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(_pMap, rPropertyName);
+
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(pField)
+ {
+ // Sonderbehandlung Serienbrieffeld
+ sal_uInt16 nWhich = pField->Which();
+ if( RES_DBFLD == nWhich &&
+ (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_BASE_NAME)) ||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_TABLE_NAME))||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DATA_COLUMN_NAME))))
+ {
+ // hier muss ein neuer Feldtyp angelegt werden und
+ // das Feld an den neuen Typ umgehaengt werden
+ DBG_WARNING("not implemented");
+ }
+ else
+ pField->PutValue( rValue, pMap->nWID );
+ }
+ else if(m_pProps)
+ {
+ String* pStr = 0;
+ BOOL* pBool = 0;
+ switch(pMap->nWID)
+ {
+ case FIELD_PROP_PAR1:
+ pStr = &m_pProps->sPar1;
+ break;
+ case FIELD_PROP_PAR2:
+ pStr = &m_pProps->sPar2;
+ break;
+ case FIELD_PROP_PAR3:
+ pStr = &m_pProps->sPar3;
+ break;
+ case FIELD_PROP_PAR4:
+ pStr = &m_pProps->sPar4;
+ break;
+ case FIELD_PROP_FORMAT:
+ rValue >>= m_pProps->nFormat;
+ m_pProps->bFormatIsDefault = sal_False;
+ break;
+ case FIELD_PROP_SUBTYPE:
+ m_pProps->nSubType = SWUnoHelper::GetEnumAsInt32( rValue );
+ break;
+ case FIELD_PROP_BYTE1 :
+ rValue >>= m_pProps->nByte1;
+ break;
+ case FIELD_PROP_BOOL1 :
+ pBool = &m_pProps->bBool1;
+ break;
+ case FIELD_PROP_BOOL2 :
+ pBool = &m_pProps->bBool2;
+ break;
+ case FIELD_PROP_BOOL3 :
+ pBool = &m_pProps->bBool3;
+ break;
+ case FIELD_PROP_BOOL4:
+ pBool = &m_pProps->bBool4;
+ break;
+ case FIELD_PROP_DATE :
+ {
+ if(rValue.getValueType() != ::getCppuType((const util::Date*)0))
+ throw IllegalArgumentException();
+
+ util::Date aTemp = *(const util::Date*)rValue.getValue();
+ m_pProps->aDate = Date(aTemp.Day, aTemp.Month, aTemp.Year);
+ }
+ break;
+ case FIELD_PROP_USHORT1:
+ case FIELD_PROP_USHORT2:
+ {
+ sal_Int16 nVal;
+ rValue >>= nVal;
+ if( FIELD_PROP_USHORT1 == pMap->nWID)
+ m_pProps->nUSHORT1 = nVal;
+ else
+ m_pProps->nUSHORT2 = nVal;
+ }
+ break;
+ case FIELD_PROP_SHORT1:
+ rValue >>= m_pProps->nSHORT1;
+ break;
+ case FIELD_PROP_DOUBLE:
+ if(rValue.getValueType() != ::getCppuType((const double*)0))
+ throw IllegalArgumentException();
+ m_pProps->fDouble = *(double*)rValue.getValue();
+ break;
+
+ case FIELD_PROP_DATE_TIME :
+ if(!m_pProps->pDateTime)
+ m_pProps->pDateTime = new util::DateTime;
+ rValue >>= (*m_pProps->pDateTime);
+ break;
+ case FIELD_PROP_PROP_SEQ:
+ rValue >>= m_pProps->aPropSeq;
+ break;
+ case FIELD_PROP_STRINGS:
+ rValue >>= m_pProps->aStrings;
+ break;
+ }
+ if( pStr )
+ ::binfilter::GetString( rValue, *pStr );
+ else if( pBool )
+ {
+ if( rValue.getValueType() == getCppuBooleanType() )
+ *pBool = *(sal_Bool*)rValue.getValue();
+ else
+ throw IllegalArgumentException();
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 14.12.98 11:37:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextField::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ const SwField* pField = GetField();
+ const SfxItemPropertyMap* _pMap = aSwMapProvider.GetPropertyMap(
+ lcl_GetPropertyMapOfService( m_nServiceId));
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(_pMap, rPropertyName);
+ if(!pMap )
+ {
+ _pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS);
+ pMap = SfxItemPropertyMap::GetByName(_pMap, rPropertyName);
+ }
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch( pMap->nWID )
+ {
+ case FN_UNO_TEXT_WRAP:
+ aRet <<= WrapTextMode_NONE;
+ break;
+ case FN_UNO_ANCHOR_TYPE:
+ aRet <<= TextContentAnchorType_AS_CHARACTER;
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ {
+ uno::Sequence<TextContentAnchorType> aTypes(1);
+ TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = TextContentAnchorType_AS_CHARACTER;
+ aRet.setValue(&aTypes, ::getCppuType((uno::Sequence<TextContentAnchorType>*)0));
+ }
+ break;
+
+ default:
+ if( pField )
+ pField->QueryValue( aRet, pMap->nWID );
+ else if( m_pProps )
+ {
+ switch(pMap->nWID)
+ {
+ case FIELD_PROP_PAR1:
+ aRet <<= OUString(m_pProps->sPar1);
+ break;
+ case FIELD_PROP_PAR2:
+ aRet <<= OUString(m_pProps->sPar2);
+ break;
+ case FIELD_PROP_PAR3:
+ aRet <<= OUString(m_pProps->sPar3);
+ break;
+ case FIELD_PROP_PAR4:
+ aRet <<= OUString(m_pProps->sPar4);
+ break;
+ case FIELD_PROP_FORMAT:
+ aRet <<= m_pProps->nFormat;
+ break;
+ case FIELD_PROP_SUBTYPE:
+ aRet <<= m_pProps->nSubType;
+ break;
+ case FIELD_PROP_BYTE1 :
+ aRet <<= m_pProps->nByte1;
+ break;
+ case FIELD_PROP_BOOL1 :
+ aRet.setValue(&m_pProps->bBool1, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_BOOL2 :
+ aRet.setValue(&m_pProps->bBool2, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_BOOL3 :
+ aRet.setValue(&m_pProps->bBool3, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_BOOL4 :
+ aRet.setValue(&m_pProps->bBool4, ::getCppuBooleanType());
+ break;
+ case FIELD_PROP_DATE :
+ aRet.setValue(&m_pProps->aDate, ::getCppuType((const util::Date*)0));
+ break;
+ case FIELD_PROP_USHORT1:
+ aRet <<= (sal_Int16)m_pProps->nUSHORT1;
+ break;
+ case FIELD_PROP_USHORT2:
+ aRet <<= (sal_Int16)m_pProps->nUSHORT2;
+ break;
+ case FIELD_PROP_SHORT1:
+ aRet <<= m_pProps->nSHORT1;
+ break;
+ case FIELD_PROP_DOUBLE:
+ aRet <<= m_pProps->fDouble;
+ break;
+ case FIELD_PROP_DATE_TIME :
+ if(m_pProps->pDateTime)
+ aRet <<= (*m_pProps->pDateTime);
+ break;
+ case FIELD_PROP_PROP_SEQ:
+ aRet <<= m_pProps->aPropSeq;
+ break;
+ case FIELD_PROP_STRINGS:
+ aRet <<= m_pProps->aStrings;
+ break;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ }
+ return aRet;
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 11:37:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextField::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/* -----------------------------23.03.01 13:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextField::update( ) throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ const SwField* pFld = GetField();
+ if(pFld)
+ {
+ switch(pFld->Which())
+ {
+ case RES_DATETIMEFLD:
+ ((SwDateTimeField*)pFld)->SetDateTime( ::DateTime() );
+ break;
+
+ case RES_EXTUSERFLD:
+ {
+ SwExtUserField* pExtUserFld = (SwExtUserField*)pFld;
+ pExtUserFld->SetExpansion( ((SwExtUserFieldType*)pFld->GetTyp())->Expand(
+ pExtUserFld->GetSubType(),
+ pExtUserFld->GetFormat() ) );
+ }
+ break;
+
+ case RES_AUTHORFLD:
+ {
+ SwAuthorField* pAuthorFld = (SwAuthorField*)pFld;
+ pAuthorFld->SetExpansion( ((SwAuthorFieldType*)pFld->GetTyp())->Expand(
+ pAuthorFld->GetFormat() ) );
+ }
+ break;
+
+ case RES_FILENAMEFLD:
+ {
+ SwFileNameField* pFileNameFld = (SwFileNameField*)pFld;
+ pFileNameFld->SetExpansion( ((SwFileNameFieldType*)pFld->GetTyp())->Expand(
+ pFileNameFld->GetFormat() ) );
+ }
+ break;
+
+ case RES_DOCINFOFLD:
+ {
+ SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFld;
+ pDocInfFld->SetExpansion( ((SwDocInfoFieldType*)pFld->GetTyp())->Expand(
+ pDocInfFld->GetSubType(),
+ pDocInfFld->GetFormat(),
+ pDocInfFld->GetLanguage() ) );
+ }
+ break;
+ }
+ }
+ else
+ m_bCallUpdate = sal_True;
+}
+/* -----------------19.03.99 14:11-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextField::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextField");
+}
+/* -----------------19.03.99 14:11-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextField::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ OUString sServiceName = SwXServiceProvider::GetProviderName(m_nServiceId);
+ return sServiceName == rServiceName ||
+ rServiceName.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextContent"));
+}
+/* -----------------19.03.99 14:11-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextField::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ OUString sServiceName = SwXServiceProvider::GetProviderName(m_nServiceId);
+ pArray[0] = sServiceName;
+ pArray[1] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+void SwXTextField::Invalidate()
+{
+ if (GetRegisteredIn())
+ {
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ aLstnrCntnr.Disposing();
+ pFmtFld = 0;
+ m_pDoc = 0;
+ }
+}
+
+/* -----------------14.12.98 12:00-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextField::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ Invalidate();
+ break;
+ case RES_FIELD_DELETED:
+ if( (void*)pFmtFld == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+ }
+}
+/*-- 14.12.98 11:37:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwField* SwXTextField::GetField() const
+{
+ if(GetRegisteredIn() && pFmtFld)
+ return pFmtFld->GetFld();
+ return 0;
+}
+/******************************************************************
+ *
+ ******************************************************************/
+/******************************************************************
+ * SwXTextFieldMasters
+ ******************************************************************/
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextFieldMasters::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextFieldMasters");
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextFieldMasters::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.TextFieldMasters" ));
+}
+/* -----------------------------06.04.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextFieldMasters::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFieldMasters");
+ return aRet;
+}
+/*-- 21.12.98 10:37:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldMasters::SwXTextFieldMasters(SwDoc* pDoc) :
+ SwUnoCollection(pDoc)
+{
+}
+/*-- 21.12.98 10:37:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldMasters::~SwXTextFieldMasters()
+{
+
+}
+/*-- 21.12.98 10:37:33---------------------------------------------------
+ Iteration ueber nicht-Standard Feldtypen
+ USER/SETEXP/DDE/DATABASE
+ Der Name ist demnach:
+ "com.sun.star.text.FieldMaster.User" + <Feltypname>
+ "com.sun.star.text.FieldMaster.DDE" + <Feltypname>
+ "com.sun.star.text.FieldMaster.SetExpression" + <Feltypname>
+ "com.sun.star.text.FieldMaster.DataBase" + <Feltypname>
+
+ Falls wir grosszuegig werden wollen, dann koennte man com.sun.star.text
+ auch optional weglassen
+ -----------------------------------------------------------------------*/
+
+sal_uInt16 lcl_GetIdByName( String& rName, String& rTypeName )
+{
+ if( rName.EqualsAscii( COM_TEXT_FLDMASTER, 0,
+ RTL_CONSTASCII_LENGTH(COM_TEXT_FLDMASTER )) )
+ rName.Erase(0, 30);
+
+ sal_uInt16 nResId = USHRT_MAX;
+ xub_StrLen nFound = 0;
+ rTypeName = rName.GetToken( 0, '.', nFound );
+ if(rTypeName.EqualsAscii("User"))
+ nResId = RES_USERFLD;
+ else if(rTypeName.EqualsAscii("DDE"))
+ nResId = RES_DDEFLD;
+ else if(rTypeName.EqualsAscii("SetExpression"))
+ {
+ nResId = RES_SETEXPFLD;
+
+ String sFldTypName( rName.GetToken( 1, '.' ));
+ String sUIName( SwStyleNameMapper::GetSpecialExtraUIName( sFldTypName ) );
+
+ if( sUIName != sFldTypName )
+ rName.SetToken( 1, '.', sUIName );
+ }
+ else if(rTypeName.EqualsAscii("DataBase"))
+ {
+ rName.Erase( 0, RTL_CONSTASCII_LENGTH( "DataBase." ));
+ USHORT nDotCount = rName.GetTokenCount('.');
+ if( 2 <= nDotCount )
+ {
+ rName.SearchAndReplace('.', DB_DELIM);
+ rName.SetChar( rName.SearchBackward( '.' ), DB_DELIM );
+ rName.InsertAscii( "DataBase.", 0 );
+ nResId = RES_DBFLD;
+ }
+ }
+ else if( rTypeName.EqualsAscii("Bibliography"))
+ nResId = RES_AUTHORITY;
+ return nResId;
+}
+
+//-----------------------------------------------------------------------------
+uno::Any SwXTextFieldMasters::getByName(const OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ String sName(rName), sTypeName;
+ sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
+ if( USHRT_MAX == nResId )
+ throw NoSuchElementException();
+
+ sName.Erase(0, sTypeName.Len()+1);
+ SwFieldType* pType = GetDoc()->GetFldType(nResId, sName);
+ if(!pType)
+ throw NoSuchElementException();
+ SwXFieldMaster* pMaster = (SwXFieldMaster*)
+ SwClientIter(*pType).First(TYPE(SwXFieldMaster));
+ if(!pMaster)
+ pMaster = new SwXFieldMaster(*pType, GetDoc());
+ uno::Reference< XPropertySet > aRef = pMaster;
+ uno::Any aRet(&aRef, ::getCppuType((const uno::Reference<XPropertySet>*)0));
+ return aRet;
+}
+/*-- 06.03.2001 11:29:34,5-------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldMasters::getInstanceName(
+ const SwFieldType& rFldType, String& rName)
+{
+ sal_Bool bRet = sal_True;
+ switch( rFldType.Which() )
+ {
+ case RES_USERFLD:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "User."));
+ rName += rFldType.GetName();
+ break;
+ case RES_DDEFLD:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "DDE."));
+ rName += rFldType.GetName();
+ break;
+
+ case RES_SETEXPFLD:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "SetExpression."));
+ rName += String( SwStyleNameMapper::GetSpecialExtraProgName( rFldType.GetName() ) );
+ break;
+
+ case RES_DBFLD:
+ {
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "DataBase."));
+ String sDBName(rFldType.GetName());
+ sDBName.SearchAndReplaceAll(DB_DELIM, '.');
+ rName += sDBName;
+ }
+ break;
+
+ case RES_AUTHORITY:
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( COM_TEXT_FLDMASTER ));
+ rName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "Bibliography"));
+ break;
+
+ default:
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+
+/*-- 21.12.98 10:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
+ sal_uInt16 nCount = pFldTypes->Count();
+
+ SvStrings aFldNames;
+ String* pString = new String();
+ sal_uInt16 i=0;
+ for( i = 0; i < nCount; i++)
+ {
+ SwFieldType& rFldType = *((*pFldTypes)[i]);
+
+ if (SwXTextFieldMasters::getInstanceName(rFldType, *pString))
+ {
+ aFldNames.Insert(pString, aFldNames.Count());
+ pString = new String();
+ }
+ }
+ delete pString;
+
+ uno::Sequence< OUString > aSeq(aFldNames.Count());
+ OUString* pArray = aSeq.getArray();
+ for(i = 0; i < aFldNames.Count();i++)
+ {
+ pArray[i] = *aFldNames.GetObject(i);
+ }
+ aFldNames.DeleteAndDestroy(0, aFldNames.Count());
+
+ return aSeq;
+
+}
+/*-- 21.12.98 10:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ throw uno::RuntimeException();
+
+ String sName(rName), sTypeName;
+ sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName );
+ sal_Bool bRet = sal_False;
+ if( USHRT_MAX != nResId )
+ {
+ sName.Erase(0, sTypeName.Len()+1);
+ bRet = USHRT_MAX != nResId && 0 != GetDoc()->GetFldType(nResId, sName);
+ }
+ return bRet;
+}
+/*-- 21.12.98 10:37:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXTextFieldMasters::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<XPropertySet>*)0);
+
+}
+/*-- 21.12.98 10:37:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldMasters::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return sal_True;
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------06.04.00 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextFieldTypes::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextFieldTypes");
+}
+/* -----------------------------06.04.00 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextFieldTypes::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.TextFields" ));
+}
+/* -----------------------------06.04.00 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextFieldTypes::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextFields");
+ return aRet;
+}
+/*-- 21.12.98 10:35:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldTypes::SwXTextFieldTypes(SwDoc* pDoc) :
+ SwUnoCollection (pDoc),
+ aRefreshCont ( static_cast< XEnumerationAccess * >(this) )
+{
+}
+/*-- 21.12.98 10:35:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextFieldTypes::~SwXTextFieldTypes()
+{
+}
+/*-- 11.07.02 14:25:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextFieldTypes::Invalidate()
+{
+ SwUnoCollection::Invalidate();
+ aRefreshCont.Disposing();
+}
+/*-- 21.12.98 10:35:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XEnumeration > SwXTextFieldTypes::createEnumeration(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ return new SwXFieldEnumeration(GetDoc());
+}
+
+/*-- 21.12.98 10:35:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXTextFieldTypes::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<XDependentTextField>*)0);
+}
+/*-- 21.12.98 10:35:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextFieldTypes::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ //es gibt sie immer
+ return sal_True;
+}
+/* -----------------24.02.99 16:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextFieldTypes::refresh(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ UnoActionContext aContext(GetDoc());
+ SwDocStat aDocStat;
+ GetDoc()->UpdateDocStat(aDocStat);
+ GetDoc()->UpdateFlds(0, sal_False);
+
+ // call refresh listeners
+ aRefreshCont.Refreshed();
+}
+/* -----------------24.02.99 16:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextFieldTypes::addRefreshListener(const uno::Reference< util::XRefreshListener > & l)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if ( !IsValid() )
+ throw RuntimeException();
+ aRefreshCont.AddListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l ));
+}
+/* -----------------24.02.99 16:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextFieldTypes::removeRefreshListener(const uno::Reference< util::XRefreshListener > & l)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if ( !IsValid() || !aRefreshCont.RemoveListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l ) ) )
+ throw RuntimeException();
+}
+/******************************************************************
+ * SwXFieldEnumeration
+ ******************************************************************/
+/* -----------------------------06.04.00 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFieldEnumeration::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFieldEnumeration");
+}
+/* -----------------------------06.04.00 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFieldEnumeration::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.FieldEnumeration" ));
+}
+/* -----------------------------06.04.00 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXFieldEnumeration::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.FieldEnumeration");
+ return aRet;
+}
+/* -----------------21.12.98 14:57-------------------
+ *
+ * --------------------------------------------------*/
+SwXFieldEnumeration::SwXFieldEnumeration(SwDoc* pDc) :
+ pDoc(pDc),
+ nNextIndex(0)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+
+ // build sequence
+ sal_Int32 nSize = 32;
+ aItems.realloc( nSize );
+ uno::Reference< XTextField > *pItems = aItems.getArray();
+ sal_Int32 nFillPos = 0;
+ //
+ const SwFldTypes* pFldTypes = pDoc->GetFldTypes();
+ sal_uInt16 nCount = pFldTypes->Count();
+ for(sal_uInt16 nType = 0; nType < nCount; ++nType)
+ {
+ const SwFieldType *pCurType = pFldTypes->GetObject(nType);
+
+ SwClientIter aIter( *(SwFieldType*)pCurType );
+ const SwFmtFld* pCurFldFmt = (SwFmtFld*)aIter.First( TYPE( SwFmtFld ));
+ while (pCurFldFmt)
+ {
+ const SwTxtFld *pTxtFld = pCurFldFmt->GetTxtFld();
+ // skip fields that are currently not in the document
+ // e.g. fields in undo or redo array
+ BOOL bSkip = !pTxtFld ||
+ !pTxtFld->GetpTxtNode()->GetNodes().IsDocNodes();
+ if (!bSkip)
+ pItems[ nFillPos++ ] = new SwXTextField(*pCurFldFmt, pDoc);
+ pCurFldFmt = (SwFmtFld*)aIter.Next();
+
+ // enlarge sequence if necessary
+ if (aItems.getLength() == nFillPos)
+ {
+ aItems.realloc( 2 * aItems.getLength() );
+ pItems = aItems.getArray();
+ }
+ }
+ }
+ // resize sequence to actual used size
+ aItems.realloc( nFillPos );
+}
+/*-- 21.12.98 14:57:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFieldEnumeration::~SwXFieldEnumeration()
+{
+
+}
+/*-- 21.12.98 14:57:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXFieldEnumeration::hasMoreElements(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return nNextIndex < aItems.getLength();
+}
+/*-- 21.12.98 14:57:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXFieldEnumeration::nextElement(void)
+ throw( NoSuchElementException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ if (!(nNextIndex < aItems.getLength()))
+ throw NoSuchElementException();
+
+#if OSL_DEBUG_LEVEL > 1
+ uno::Reference< XTextField > *pItems = aItems.getArray();
+#endif
+ uno::Reference< XTextField > &rxFld = aItems.getArray()[ nNextIndex++ ];
+ uno::Any aRet(&rxFld, ::getCppuType((const uno::Reference<XTextField>*)0));
+ rxFld = 0; // free memory for item that is not longer used
+ return aRet;
+}
+/* -----------------21.12.98 15:08-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFieldEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ pDoc = 0;
+}
+
+
+String& GetString( const ::com::sun::star::uno::Any& rAny, String& rStr )
+{
+ OUString aStr;
+ rAny >>= aStr;
+ rStr = String( aStr );
+ return rStr;
+}
+
+} //namespace binfilter
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoframe.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoframe.cxx
new file mode 100644
index 000000000000..92f043608fde
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoframe.cxx
@@ -0,0 +1,2836 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+
+#include <hints.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docsh.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndindex.hxx>
+#include <pam.hxx>
+#include <ndnotxt.hxx>
+#include <bf_svx/unomid.hxx>
+#include <unocrsr.hxx>
+#include <docstyle.hxx>
+#include <dcontact.hxx>
+#include <fmtcnct.hxx>
+#include <ndole.hxx>
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unoevent.hxx>
+#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/XTextColumns.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
+#include <tools/poly.hxx>
+#include <unomid.h>
+#include <unostyle.hxx>
+#include <bf_svx/svdmodel.hxx>
+#include <bf_svx/svdpage.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/protitem.hxx>
+#include <fmtornt.hxx>
+#include <fmturl.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/opaqitem.hxx>
+#include <bf_svx/prntitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtfsize.hxx>
+#include <grfatr.hxx>
+#include <unoframe.hxx>
+#include <fmtanchr.hxx>
+#include <fmtclds.hxx>
+#include <frmatr.hxx>
+#include <ndtxt.hxx>
+#include <ndgrf.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <bf_svx/svdobj.hxx>
+#include <rtl/uuid.h>
+#include <SwStyleNameMapper.hxx>
+#include <bf_xmloff/xmlcnitm.hxx>
+#include <poolfmt.hxx>
+#include <pagedesc.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <tools/urlobj.hxx>
+#include <bf_svx/frmdiritem.hxx>
+
+#include <bf_so3/outplace.hxx>
+#include <bf_sfx2/sfxuno.hxx>
+namespace binfilter {
+
+// from fefly1.cxx
+extern sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet );
+
+// from fefly1.cxx
+extern sal_Bool lcl_ChkAndSetNewAnchor( const SwFlyFrm& rFly, SfxItemSet& rSet );
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::drawing;
+
+using rtl::OUString;
+
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::style::XStyleFamiliesSupplier;
+
+const sal_Char __FAR_DATA sPackageProtocol[] = "vnd.sun.star.Package:";
+const sal_Char __FAR_DATA sGraphicObjectProtocol[] = "vnd.sun.star.GraphicObject:";
+
+/****************************************************************************
+ Rahmenbeschreibung
+****************************************************************************/
+DECLARE_TABLE(SwFrameAnyTable_Impl, uno::Any*)
+class BaseFrameProperties_Impl
+{
+ const SfxItemPropertyMap* _pMap;
+ SwFrameAnyTable_Impl aAnyTbl;
+
+public:
+
+ BaseFrameProperties_Impl ( const SfxItemPropertyMap* pMap ) :
+ _pMap(pMap) {}
+ ~BaseFrameProperties_Impl();
+
+ void SetProperty(USHORT nWID, BYTE nMemberId, uno::Any aVal);
+ sal_Bool GetProperty(USHORT nWID, BYTE nMemberId, uno::Any*& pAny );
+ void GetProperty(const OUString &rPropertyName, const Reference < XPropertySet > &rxPropertySet, uno::Any& rAny );
+
+ const SfxItemPropertyMap* GetMap() const {return _pMap;}
+ sal_Bool FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet &rFromSet, sal_Bool& rSizeFound);
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound) = 0;
+
+};
+
+BaseFrameProperties_Impl::~BaseFrameProperties_Impl()
+{
+ uno::Any* pVal = aAnyTbl.First();
+ while(pVal)
+ {
+ delete pVal;
+ pVal = aAnyTbl.Next();
+ }
+}
+
+void BaseFrameProperties_Impl::SetProperty(USHORT nWID, BYTE nMemberId, uno::Any aVal)
+{
+ ULONG nKey = (nWID << 16) + nMemberId;
+ Any* pCurAny = aAnyTbl.Get(nKey);
+ if(!pCurAny)
+ {
+ pCurAny = new uno::Any;
+ aAnyTbl.Insert(nKey, pCurAny);
+ }
+ *pCurAny = aVal;
+}
+
+sal_Bool BaseFrameProperties_Impl::GetProperty(USHORT nWID, BYTE nMemberId, uno::Any*& pAny)
+{
+ ULONG nKey = (nWID << 16) + nMemberId;
+ Any *pCurAny = aAnyTbl.Get(nKey);
+ pAny = pCurAny;
+ return pCurAny != 0;
+}
+void BaseFrameProperties_Impl::GetProperty( const OUString &rPropertyName, const Reference < XPropertySet > &rxPropertySet, uno::Any & rAny )
+{
+ rAny = rxPropertySet->getPropertyValue( rPropertyName );
+}
+
+sal_Bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxItemSet& rFromSet, sal_Bool& rSizeFound)
+{
+ sal_Bool bRet = sal_True;
+ //Anker kommt auf jeden Fall in den Set
+ SwFmtAnchor aAnchor ( static_cast < const SwFmtAnchor & > ( rFromSet.Get ( RES_ANCHOR ) ) );
+ {
+ uno::Any* pAnchorPgNo;
+ if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo))
+ bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM);
+ uno::Any* pAnchorType;
+ if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType))
+ bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE);
+ }
+ rToSet.Put(aAnchor);
+ {
+ uno::Any* pCol = 0;
+ GetProperty(RES_BACKGROUND, MID_BACK_COLOR, pCol );
+ uno::Any* pRGBCol = 0;
+ GetProperty(RES_BACKGROUND, MID_BACK_COLOR_R_G_B, pRGBCol );
+ uno::Any* pColTrans = 0;
+ GetProperty(RES_BACKGROUND, MID_BACK_COLOR_TRANSPARENCY, pColTrans);
+ uno::Any* pTrans = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENT, pTrans );
+ uno::Any* pGrLoc = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_POSITION, pGrLoc );
+ uno::Any* pGrURL = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_URL, pGrURL );
+ uno::Any* pGrFilter = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_FILTER, pGrFilter );
+ uno::Any* pGrTranparency = 0;
+ GetProperty(RES_BACKGROUND, MID_GRAPHIC_TRANSPARENCY, pGrTranparency );
+
+ if(pCol || pTrans || pGrURL || pGrFilter || pGrLoc ||
+ pGrTranparency || pColTrans || pRGBCol)
+ {
+ SvxBrushItem aBrush ( static_cast < const SvxBrushItem & > ( rFromSet.Get ( RES_BACKGROUND ) ) );
+ if(pCol )
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR );
+ if(pColTrans)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY);
+ if(pRGBCol)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B);
+ if(pTrans)
+ {
+ // don't overwrite transparency with a non-transparence flag
+ if(!pColTrans || Any2Bool( *pTrans ))
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT);
+ }
+ if(pGrURL)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrURL, MID_GRAPHIC_URL);
+ if(pGrFilter)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
+ if(pGrLoc)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
+ if(pGrTranparency)
+ bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY);
+
+ rToSet.Put(aBrush);
+ }
+ }
+ {
+ uno::Any* pCont = 0;
+ GetProperty(RES_PROTECT, MID_PROTECT_CONTENT, pCont );
+ uno::Any* pPos = 0;
+ GetProperty(RES_PROTECT,MID_PROTECT_POSITION, pPos );
+ uno::Any* pName = 0;
+ GetProperty(RES_PROTECT, MID_PROTECT_SIZE, pName );
+ if(pCont||pPos||pName)
+ {
+ SvxProtectItem aProt ( static_cast < const SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) );
+ if(pCont)
+ bRet &= ((SfxPoolItem&)aProt).PutValue(*pCont, MID_PROTECT_CONTENT);
+ if(pPos )
+ bRet &= ((SfxPoolItem&)aProt).PutValue(*pPos, MID_PROTECT_POSITION);
+ if(pName)
+ bRet &= ((SfxPoolItem&)aProt).PutValue(*pName, MID_PROTECT_SIZE);
+ rToSet.Put(aProt);
+ }
+ }
+ {
+ uno::Any* pHori = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, pHori );
+ uno::Any* pHoriP = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_POSITION|CONVERT_TWIPS, pHoriP );
+ uno::Any* pHoriR = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_RELATION, pHoriR );
+ uno::Any* pPageT = 0;
+ GetProperty(RES_HORI_ORIENT, MID_HORIORIENT_PAGETOGGLE, pPageT);
+ if(pHori||pHoriP||pHoriR||pPageT)
+ {
+ SwFmtHoriOrient aOrient ( static_cast < const SwFmtHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) );
+ if(pHori )
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT);
+ if(pHoriP)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS);
+ if(pHoriR)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION);
+ if(pPageT)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE);
+ rToSet.Put(aOrient);
+ }
+ }
+
+ {
+ uno::Any* pVert = 0;
+ GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, pVert);
+ uno::Any* pVertP = 0;
+ GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_POSITION|CONVERT_TWIPS, pVertP );
+ uno::Any* pVertR = 0;
+ GetProperty(RES_VERT_ORIENT, MID_VERTORIENT_RELATION, pVertR );
+ if(pVert||pVertP||pVertR)
+ {
+ SwFmtVertOrient aOrient ( static_cast < const SwFmtVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) );
+ if(pVert )
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT);
+ if(pVertP)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS);
+ if(pVertR)
+ bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION);
+ rToSet.Put(aOrient);
+ }
+ }
+ {
+ uno::Any* pURL = 0;
+ GetProperty(RES_URL, MID_URL_URL, pURL );
+ uno::Any* pTarget = 0;
+ GetProperty(RES_URL, MID_URL_TARGET, pTarget );
+ uno::Any* pHyLNm = 0;
+ GetProperty(RES_URL, MID_URL_HYPERLINKNAME, pHyLNm );
+ uno::Any* pHySMp = 0;
+ GetProperty(RES_URL, MID_URL_SERVERMAP, pHySMp );
+ if(pURL||pTarget||pHyLNm||pHySMp)
+ {
+ SwFmtURL aURL ( static_cast < const SwFmtURL & > ( rFromSet.Get ( RES_URL ) ) );
+ if(pURL)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pURL, MID_URL_URL);
+ if(pTarget)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pTarget, MID_URL_TARGET);
+ if(pHyLNm)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME );
+ if(pHySMp)
+ bRet &= ((SfxPoolItem&)aURL).PutValue(*pHySMp, MID_URL_SERVERMAP);
+ rToSet.Put(aURL);
+ }
+ }
+ uno::Any* pL = 0;
+ GetProperty(RES_LR_SPACE, MID_L_MARGIN|CONVERT_TWIPS, pL );
+ uno::Any* pR = 0;
+ GetProperty(RES_LR_SPACE, MID_R_MARGIN|CONVERT_TWIPS, pR );
+ if(pL||pR)
+ {
+ SvxLRSpaceItem aLR ( static_cast < const SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) );
+ if(pL)
+ bRet &= ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
+ if(pR)
+ bRet &= ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
+ rToSet.Put(aLR);
+ }
+ uno::Any* pT = 0;
+ GetProperty(RES_UL_SPACE, MID_UP_MARGIN|CONVERT_TWIPS, pT );
+ uno::Any* pB = 0;
+ GetProperty(RES_UL_SPACE, MID_LO_MARGIN|CONVERT_TWIPS, pB );
+ if(pT||pB)
+ {
+ SvxULSpaceItem aTB ( static_cast < const SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) );
+ if(pT)
+ bRet &= ((SfxPoolItem&)aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS);
+ if(pB)
+ bRet &= ((SfxPoolItem&)aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS);
+ rToSet.Put(aTB);
+ }
+ uno::Any* pOp;
+ if(GetProperty(RES_OPAQUE, 0, pOp))
+ {
+ SvxOpaqueItem aOp ( static_cast < const SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) );
+ bRet &= ((SfxPoolItem&)aOp).PutValue(*pOp, 0);
+ rToSet.Put(aOp);
+ }
+ uno::Any* pPrt;
+ if(GetProperty(RES_PRINT, 0, pPrt))
+ {
+ SvxPrintItem aPrt ( static_cast < const SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) );
+ bRet &= ((SfxPoolItem&)aPrt).PutValue(*pPrt, 0);
+ rToSet.Put(aPrt);
+ }
+ uno::Any* pSh;
+ if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh))
+ {
+ SvxShadowItem aSh ( static_cast < const SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) );
+ bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS);
+ rToSet.Put(aSh);
+ }
+ uno::Any* pSur = 0;
+ GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur);
+ uno::Any* pSurAnch = 0;
+ GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch);
+ if(pSur || pSurAnch)
+ {
+ SwFmtSurround aSrnd ( static_cast < const SwFmtSurround & > ( rFromSet.Get ( RES_SURROUND ) ) );
+ if(pSur)
+ bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE );
+ if(pSurAnch)
+ bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY);
+ rToSet.Put(aSrnd);
+ }
+ uno::Any* pLeft = 0;
+ GetProperty(RES_BOX, LEFT_BORDER |CONVERT_TWIPS, pLeft );
+ uno::Any* pRight = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER , pRight );
+ uno::Any* pTop = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER , pTop );
+ uno::Any* pBottom = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER, pBottom);
+ uno::Any* pDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|BORDER_DISTANCE, pDistance);
+ uno::Any* pLeftDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|LEFT_BORDER_DISTANCE, pLeftDistance);
+ uno::Any* pRightDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE, pRightDistance);
+ uno::Any* pTopDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|TOP_BORDER_DISTANCE, pTopDistance);
+ uno::Any* pBottomDistance = 0;
+ GetProperty(RES_BOX, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE, pBottomDistance);
+ if( pLeft || pRight || pTop || pBottom || pDistance ||
+ pLeftDistance || pRightDistance || pTopDistance || pBottomDistance )
+ {
+ SvxBoxItem aBox ( static_cast < const SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) );
+ if( pLeft )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER );
+ if( pRight )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER );
+ if( pTop )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER);
+ if( pBottom )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER);
+ if( pDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE);
+ if( pLeftDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE);
+ if( pRightDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE);
+ if( pTopDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE);
+ if( pBottomDistance )
+ bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE);
+ rToSet.Put(aBox);
+ }
+ {
+ uno::Any* pRelH = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_HEIGHT, pRelH);
+ uno::Any* pRelW = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_REL_WIDTH, pRelW);
+ uno::Any* pSyncWidth = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT, pSyncWidth);
+ uno::Any* pSyncHeight = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH, pSyncHeight);
+ uno::Any* pWidth = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS, pWidth);
+ uno::Any* pHeight = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS, pHeight);
+ uno::Any* pSize = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE|CONVERT_TWIPS, pSize);
+ uno::Any* pSizeType = 0;
+ GetProperty(RES_FRM_SIZE, MID_FRMSIZE_SIZE_TYPE, pSizeType);
+ if( pWidth || pHeight ||pRelH || pRelW || pSize ||pSizeType ||
+ pSyncWidth || pSyncHeight )
+ {
+ rSizeFound = sal_True;
+ SwFmtFrmSize aFrmSz ( static_cast < const SwFmtFrmSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) );
+ if(pWidth)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
+ if(pHeight)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS);
+ if(pRelH )
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT);
+ if(pRelW )
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH);
+ if(pSyncWidth)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT);
+ if(pSyncHeight)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH);
+ if(pSize)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
+ if(pSizeType)
+ bRet &= ((SfxPoolItem&)aFrmSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE);
+ if(!aFrmSz.GetWidth())
+ aFrmSz.SetWidth(MINFLY);
+ if(!aFrmSz.GetHeight())
+ aFrmSz.SetHeight(MINFLY);
+ rToSet.Put(aFrmSz);
+ }
+ else
+ {
+ rSizeFound = sal_False;
+ SwFmtFrmSize aFrmSz;
+ awt::Size aSize;
+ aSize.Width = 2 * MM50;
+ aSize.Height = 2 * MM50;
+ uno::Any aSizeVal;
+ aSizeVal <<= aSize;
+ ((SfxPoolItem&)aFrmSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS);
+ rToSet.Put(aFrmSz);
+ }
+ }
+ uno::Any* pFrameDirection = 0;
+ GetProperty(RES_FRAMEDIR, 0, pFrameDirection);
+ if(pFrameDirection)
+ {
+ SvxFrameDirectionItem aAttr(FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR);
+ aAttr.PutValue(*pFrameDirection, 0);
+ rToSet.Put(aAttr);
+ }
+ uno::Any* pUnknown = 0;
+ GetProperty(RES_UNKNOWNATR_CONTAINER, 0, pUnknown);
+ if(pUnknown)
+ {
+ SvXMLAttrContainerItem aAttr(RES_UNKNOWNATR_CONTAINER);
+ aAttr.PutValue(*pUnknown, 0);
+ rToSet.Put(aAttr);
+ }
+
+ return bRet;
+}
+
+class SwFrameProperties_Impl : public BaseFrameProperties_Impl
+{
+protected:
+ SwFrameProperties_Impl(const SfxItemPropertyMap* pMap) :
+ BaseFrameProperties_Impl(pMap){}
+public:
+ SwFrameProperties_Impl();
+ ~SwFrameProperties_Impl(){}
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
+};
+
+SwFrameProperties_Impl::SwFrameProperties_Impl():
+ BaseFrameProperties_Impl(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME) )
+{
+}
+
+inline void lcl_FillCol ( SfxItemSet &rToSet, const SfxItemSet &rFromSet, Any *pAny)
+{
+ if ( pAny )
+ {
+ SwFmtCol aCol ( static_cast < const SwFmtCol & > ( rFromSet.Get ( RES_COL ) ) );
+ ((SfxPoolItem&)aCol).PutValue( *pAny, MID_COLUMNS);
+ rToSet.Put(aCol);
+ }
+}
+sal_Bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItemSet&, sal_Bool& rSizeFound)
+{
+ //Properties fuer alle Frames
+ uno::Any *pStyleName;
+ SwDocStyleSheet* pStyle = NULL;
+ sal_Bool bRet;
+
+ if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
+ {
+ OUString sStyle;
+ *pStyleName >>= sStyle;
+ pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
+ SFX_STYLE_FAMILY_FRAME);
+ }
+
+ uno::Any* pColumns = NULL;
+ GetProperty (RES_COL, MID_COLUMNS, pColumns);
+ if ( pStyle )
+ {
+ SwDocStyleSheet aStyle (*pStyle);
+ const SfxItemSet *pItemSet = &aStyle.GetItemSet();
+ bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
+ lcl_FillCol ( rSet, *pItemSet, pColumns );
+ }
+ else
+ {
+ const SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet();
+ bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound );
+ lcl_FillCol ( rSet, *pItemSet, pColumns );
+ }
+ uno::Any* pEdit;
+ if(GetProperty(RES_EDIT_IN_READONLY, 0, pEdit))
+ {
+ SfxBoolItem aBool(RES_EDIT_IN_READONLY);
+ ((SfxPoolItem&)aBool).PutValue(*pEdit, 0);
+ rSet.Put(aBool);
+ }
+ return bRet;
+}
+
+/****************************************************************************
+ Grafik-Descriptor
+****************************************************************************/
+class SwGraphicProperties_Impl : public BaseFrameProperties_Impl
+{
+public:
+ SwGraphicProperties_Impl();
+ ~SwGraphicProperties_Impl(){}
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
+};
+
+SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
+ BaseFrameProperties_Impl(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC) )
+{
+}
+
+inline void lcl_FillMirror ( SfxItemSet &rToSet, const SfxItemSet &rFromSet, Any *pHEvenMirror, Any *pHOddMirror, Any *pVMirror, sal_Bool &rRet )
+{
+ if(pHEvenMirror || pHOddMirror || pVMirror )
+ {
+ SwMirrorGrf aMirror ( static_cast < const SwMirrorGrf& > ( rFromSet.Get ( RES_FRM_SIZE ) ) );
+ if(pHEvenMirror)
+ rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES);
+ if(pHOddMirror)
+ rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES);
+ if(pVMirror)
+ rRet &= ((SfxPoolItem&)aMirror).PutValue(*pVMirror, MID_MIRROR_VERT);
+ rToSet.Put(aMirror);
+ }
+}
+
+sal_Bool SwGraphicProperties_Impl::AnyToItemSet(
+ SwDoc* pDoc,
+ SfxItemSet& rFrmSet,
+ SfxItemSet& rGrSet,
+ sal_Bool& rSizeFound)
+{
+ //Properties fuer alle Frames
+ sal_Bool bRet;
+ uno::Any *pStyleName;
+ SwDocStyleSheet* pStyle = NULL;
+
+ if ( GetProperty ( FN_UNO_FRAME_STYLE_NAME, 0, pStyleName ) )
+ {
+ OUString sStyle;
+ *pStyleName >>= sStyle;
+ pStyle = (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle,
+ SFX_STYLE_FAMILY_FRAME);
+ }
+
+ uno::Any* pHEvenMirror = 0;
+ uno::Any* pHOddMirror = 0;
+ uno::Any* pVMirror = 0;
+ GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_EVEN_PAGES, pHEvenMirror);
+ GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_HORZ_ODD_PAGES, pHOddMirror);
+ GetProperty(RES_GRFATR_MIRRORGRF, MID_MIRROR_VERT, pVMirror);
+
+ if ( pStyle )
+ {
+ SwDocStyleSheet aStyle (*pStyle);
+ const SfxItemSet *pItemSet = &aStyle.GetItemSet();
+ bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
+ lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
+ }
+ else
+ {
+ const SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet();
+ bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound);
+ lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet );
+ }
+
+
+ static const USHORT nIDs[] =
+ {
+ RES_GRFATR_CROPGRF,
+ RES_GRFATR_ROTATION,
+ RES_GRFATR_LUMINANCE,
+ RES_GRFATR_CONTRAST,
+ RES_GRFATR_CHANNELR,
+ RES_GRFATR_CHANNELG,
+ RES_GRFATR_CHANNELB,
+ RES_GRFATR_GAMMA,
+ RES_GRFATR_INVERT,
+ RES_GRFATR_TRANSPARENCY,
+ RES_GRFATR_DRAWMODE,
+ 0
+ };
+ uno::Any* pAny;
+ for(sal_Int16 nIndex = 0; nIDs[nIndex]; nIndex++)
+ {
+ BYTE nMId = RES_GRFATR_CROPGRF == nIDs[nIndex] ? CONVERT_TWIPS : 0;
+ if(GetProperty(nIDs[nIndex], nMId, pAny ))
+ {
+ SfxPoolItem* pItem = ::binfilter::GetDfltAttr( nIDs[nIndex] )->Clone();
+ bRet &= pItem->PutValue(*pAny, nMId );
+ rGrSet.Put(*pItem);
+ delete pItem;
+ }
+ }
+
+ return bRet;
+}
+
+class SwOLEProperties_Impl : public SwFrameProperties_Impl
+{
+public:
+ SwOLEProperties_Impl() :
+ SwFrameProperties_Impl(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT) ){}
+ ~SwOLEProperties_Impl(){}
+
+ virtual sal_Bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound);
+};
+
+sal_Bool SwOLEProperties_Impl::AnyToItemSet(
+ SwDoc* pDoc, SfxItemSet& rFrmSet, SfxItemSet& rSet, sal_Bool& rSizeFound)
+{
+ uno::Any* pCLSID;
+ if(!GetProperty(FN_UNO_CLSID, 0, pCLSID))
+ return FALSE;
+ SwFrameProperties_Impl::AnyToItemSet( pDoc, rFrmSet, rSet, rSizeFound);
+ //
+ return TRUE;
+}
+
+/******************************************************************
+ * SwXFrame
+ ******************************************************************/
+const uno::Sequence< sal_Int8 > & SwXFrame::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+TYPEINIT1(SwXFrame, SwClient);
+
+OUString SwXFrame::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFrame");
+}
+
+BOOL SwXFrame::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return !rServiceName.compareToAscii("com.sun.star.text.BaseFrame")||
+ !rServiceName.compareToAscii("com.sun.star.text.TextContent") ||
+ !rServiceName.compareToAscii("com.sun.star.document.LinkTarget");
+}
+
+Sequence< OUString > SwXFrame::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(3);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.BaseFrame");
+ pArray[1] = C2U("com.sun.star.text.TextContent");
+ pArray[2] = C2U("com.sun.star.document.LinkTarget");
+ return aRet;
+}
+/*-- 14.01.99 11:31:52---------------------------------------------------
+ Dieser CTor legt den Frame als Descriptor an
+ -----------------------------------------------------------------------*/
+SwXFrame::SwXFrame(FlyCntType eSet, const SfxItemPropertyMap* pMap, SwDoc *pDoc ) :
+ aLstnrCntnr( (container::XNamed*)this),
+ eType(eSet),
+ aPropSet(pMap),
+ _pMap(pMap),
+ bIsDescriptor(sal_True),
+ mpDoc ( pDoc )
+{
+ // Register ourselves as a listener to the document (via the page descriptor)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ // get the property set for the default style data
+ // First get the model
+ Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
+ // Ask the model for it's family supplier interface
+ Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel, UNO_QUERY );
+ // Get the style families
+ Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
+ // Get the Frame family (and keep it for later)
+ Any aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "FrameStyles" ) ) );
+ aAny >>= mxStyleFamily;
+ // In the derived class, we'll ask mxStyleFamily for the relevant default style
+ // mxStyleFamily is initialised in the SwXFrame constructor
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ {
+ Any aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Frame" ) ) );
+ aAny >>= mxStyleData;
+ pProps = new SwFrameProperties_Impl( );
+ }
+ break;
+ case FLYCNTTYPE_GRF:
+ {
+ Any aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Graphics" ) ) );
+ aAny >>= mxStyleData;
+ pProps = new SwGraphicProperties_Impl( );
+ }
+ break;
+ case FLYCNTTYPE_OLE:
+ {
+ Any aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "OLE" ) ) );
+ aAny >>= mxStyleData;
+ pProps = 0;
+ pProps = new SwOLEProperties_Impl( );
+ }
+ break;
+ }
+}
+
+SwXFrame::SwXFrame(SwFrmFmt& rFrmFmt, FlyCntType eSet, const SfxItemPropertyMap* pMap) :
+ eType(eSet),
+ SwClient( &rFrmFmt ),
+ aLstnrCntnr( (container::XNamed*)this),
+ aPropSet(pMap),
+ _pMap(pMap),
+ bIsDescriptor(sal_False),
+ pProps(0)
+{
+}
+
+SwXFrame::~SwXFrame()
+{
+ delete pProps;
+}
+
+OUString SwXFrame::getName(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String sRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ sRet = pFmt->GetName();
+ else if(bIsDescriptor)
+ sRet = sName;
+ else
+ throw RuntimeException();
+ return sRet;
+}
+
+void SwXFrame::setName(const OUString& rName) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ String sTmpName(rName);
+ if(pFmt)
+ {
+ pFmt->GetDoc()->SetFlyName((SwFlyFrmFmt&)*pFmt, sTmpName);
+ if(pFmt->GetName() != sTmpName)
+ {
+ throw RuntimeException();
+ }
+ }
+ else if(bIsDescriptor)
+ sName = sTmpName;
+ else
+ throw RuntimeException();
+}
+
+uno::Reference< XPropertySetInfo > SwXFrame::getPropertySetInfo(void) throw( RuntimeException )
+{
+ uno::Reference< XPropertySetInfo > xRef;
+ static uno::Reference< XPropertySetInfo > xFrmRef;
+ static uno::Reference< XPropertySetInfo > xGrfRef;
+ static uno::Reference< XPropertySetInfo > xOLERef;
+ switch(eType)
+ {
+ case FLYCNTTYPE_FRM:
+ if( !xFrmRef.is() )
+ xFrmRef = aPropSet.getPropertySetInfo();
+ xRef = xFrmRef;
+ break;
+ case FLYCNTTYPE_GRF:
+ if( !xGrfRef.is() )
+ xGrfRef = aPropSet.getPropertySetInfo();
+ xRef = xGrfRef;
+ break;
+ case FLYCNTTYPE_OLE:
+ if( !xOLERef.is() )
+ xOLERef = aPropSet.getPropertySetInfo();
+ xRef = xOLERef;
+ break;
+ }
+ return xRef;
+}
+
+SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt )
+{
+ SdrObject* pObject = pFmt->FindSdrObject();
+ if( !pObject )
+ {
+ SwDoc *pDoc = pFmt->GetDoc();
+ SdrModel *pDrawModel = pDoc->MakeDrawModel();
+ SwFlyDrawContact* pContactObject
+ = new SwFlyDrawContact( pFmt, pDrawModel );
+ pObject = pContactObject->GetMaster();
+
+ const SwFmtSurround& rSurround = pFmt->GetSurround();
+ pObject->SetLayer(
+ ( SURROUND_THROUGHT == rSurround.GetSurround() &&
+ !pFmt->GetOpaque().GetValue() ) ? pDoc->GetHellId()
+ : pDoc->GetHeavenId() );
+
+ pDrawModel->GetPage(0)->InsertObject( pObject );
+ }
+
+ return pObject;
+}
+
+SwFrmFmt *lcl_GetFrmFmt( const uno::Any& rValue, SwDoc *pDoc )
+{
+ SwFrmFmt *pRet = 0;
+ SwDocShell* pDocSh = pDoc->GetDocShell();
+ if(pDocSh)
+ {
+ OUString uTemp;
+ rValue >>= uTemp;
+ String sStyle;
+ SwStyleNameMapper::FillUIName(String (uTemp), sStyle, GET_POOLID_FRMFMT, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle,
+ SFX_STYLE_FAMILY_FRAME);
+ if(pStyle)
+ pRet = pStyle->GetFrmFmt();
+ }
+
+ return pRet;
+}
+
+void SwXFrame::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException, lang::IllegalArgumentException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName);
+
+ if (!pCur)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(pFmt)
+ {
+ sal_Bool bNextFrame = sal_False;
+ if ( pCur->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwDoc* pDoc = pFmt->GetDoc();
+ if( eType == FLYCNTTYPE_GRF &&
+ (pCur->nWID >= RES_GRFATR_BEGIN &&
+ pCur->nWID < RES_GRFATR_END)||
+ pCur->nWID == FN_PARAM_COUNTOUR_PP ||
+ pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
+ pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR ||
+ FN_UNO_ALTERNATIVE_TEXT == pCur->nWID)
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ if(FN_UNO_ALTERNATIVE_TEXT == pCur->nWID )
+ {
+ OUString uTemp;
+ aValue >>= uTemp;
+ pNoTxt->SetAlternateText(uTemp);
+ }
+ else if(pCur->nWID == FN_PARAM_COUNTOUR_PP)
+ {
+ PointSequenceSequence aParam;
+ if(!aValue.hasValue())
+ pNoTxt->SetContour(0);
+ else if(aValue >>= aParam)
+ {
+ PolyPolygon aPoly((USHORT)aParam.getLength());
+ for(sal_Int32 i = 0; i < aParam.getLength(); i++)
+ {
+ const PointSequence* pPointSeq = aParam.getConstArray();
+ sal_Int32 nPoints = pPointSeq[i].getLength();
+ const awt::Point* pPoints = pPointSeq[i].getConstArray();
+ Polygon aSet( (USHORT)nPoints );
+ for(sal_Int32 j = 0; j < nPoints; j++)
+ {
+ Point aPoint(pPoints[j].X, pPoints[j].Y);
+ aSet.SetPoint(aPoint, (USHORT)j);
+ }
+ // Close polygon if it isn't closed already.
+ aSet.Optimize( POLY_OPTIMIZE_CLOSE );
+ aPoly.Insert( aSet );
+ }
+ pNoTxt->SetContourAPI( &aPoly );
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ else if(pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
+ {
+ pNoTxt->SetAutomaticContour( *(sal_Bool *)aValue.getValue() );
+ }
+ else if(pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR )
+ {
+ // The IsPixelContour property can only be set if there
+ // is no contour, or if the contour has been set by the
+ // API itself (or in other words, if the contour isn't
+ // used already).
+ if( !pNoTxt->_HasContour() ||
+ !pNoTxt->IsContourMapModeValid() )
+ pNoTxt->SetPixelContour( *(sal_Bool *)aValue.getValue() );
+ else
+ throw IllegalArgumentException();
+ }
+ else
+ {
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ aPropSet.setPropertyValue(*pCur, aValue, aSet);
+ pNoTxt->SetAttr(aSet);
+ }
+ }
+ }
+ else if(FN_UNO_FRAME_STYLE_NAME == pCur->nWID)
+ {
+ SwFrmFmt *pFrmFmt = lcl_GetFrmFmt( aValue, pFmt->GetDoc() );
+ if( pFrmFmt )
+ {
+ UnoActionContext aAction(pFmt->GetDoc());
+
+ // see SwFEShell::SetFrmFmt( SwFrmFmt *pNewFmt, sal_Bool bKeepOrient, Point* pDocPos )
+ SwFlyFrm *pFly = 0;
+ const SwFrmFmt* pFmtXX = pFmt;
+ if (PTR_CAST(SwFlyFrmFmt, pFmtXX))
+ pFly = ((SwFlyFrmFmt*)pFmtXX)->GetFrm();
+ SfxItemSet* pSet = 0;
+ if (pFly)
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pFrmFmt->GetItemState( RES_ANCHOR, sal_False, &pItem ))
+ {
+ pSet = new SfxItemSet( pDoc->GetAttrPool(), aFrmFmtSetRange );
+ pSet->Put( *pItem );
+ if( !::binfilter::lcl_ChkAndSetNewAnchor( *pFly, *pSet ))
+ delete pSet, pSet = 0;
+ }
+ }
+
+ pFmt->GetDoc()->SetFrmFmtToFly( *pFmt, *pFrmFmt, pSet, FALSE );
+ delete pSet;
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ else if( FN_UNO_GRAPHIC_U_R_L == pCur->nWID ||
+ FN_UNO_GRAPHIC_FILTER == pCur->nWID)
+ {
+ String sGrfName, sFltName;
+ BfGraphicObject* pGrfObj = 0;
+ pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, &sFltName );
+ OUString uTemp;
+ aValue >>= uTemp;
+ String sTmp(uTemp);
+ UnoActionContext aAction(pFmt->GetDoc());
+ if(FN_UNO_GRAPHIC_U_R_L == pCur->nWID)
+ {
+ if( sTmp.EqualsAscii( sPackageProtocol,
+ 0, sizeof( sPackageProtocol )-1 ) )
+ {
+ pGrfObj = new BfGraphicObject;
+ pGrfObj->SetUserData( sTmp );
+ pGrfObj->SetSwapState();
+ sGrfName.Erase();
+ }
+ else if( sTmp.EqualsAscii( sGraphicObjectProtocol,
+ 0, sizeof(sGraphicObjectProtocol)-1 ) )
+ {
+ ByteString sId( sTmp.Copy(sizeof(sGraphicObjectProtocol)-1),
+ RTL_TEXTENCODING_ASCII_US );
+ pGrfObj = new BfGraphicObject( sId );
+ sGrfName.Erase();
+ }
+ else
+ {
+ sGrfName = sTmp;
+ }
+ }
+ else
+ {
+ sFltName = sTmp;
+ }
+
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if(!pGrfNode)
+ {
+ delete pGrfObj;
+ throw RuntimeException();
+ }
+ SwPaM aGrfPaM(*pGrfNode);
+ pFmt->GetDoc()->ReRead( aGrfPaM, sGrfName, sFltName, 0,
+ pGrfObj );
+ }
+ delete pGrfObj;
+ }
+ else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
+ || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
+ {
+ OUString uTemp;
+ aValue >>= uTemp;
+ String sChainName(uTemp);
+ if(!sChainName.Len())
+ {
+ if(bNextFrame)
+ pDoc->Unchain(*pFmt);
+ else
+ {
+ SwFmtChain aChain( pFmt->GetChain() );
+ SwFrmFmt *pPrev = aChain.GetPrev();
+ if(pPrev)
+ pDoc->Unchain(*pPrev);
+ }
+ }
+ else
+ {
+ sal_uInt16 nCount = pDoc->GetFlyCount(FLYCNTTYPE_FRM);
+
+ SwFrmFmt* pChain = 0;
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwFrmFmt* pFmt = pDoc->GetFlyNum(i, FLYCNTTYPE_FRM);
+ if(sChainName == pFmt->GetName() )
+ {
+ pChain = pFmt;
+ break;
+ }
+ }
+ if(pChain)
+ {
+ SwFrmFmt* pSource = bNextFrame ? pFmt : pChain;
+ SwFrmFmt* pDest = bNextFrame ? pChain: pFmt;
+ pDoc->Chain(*pSource, *pDest);
+ }
+ }
+ }
+ else if(FN_UNO_Z_ORDER == pCur->nWID)
+ {
+ sal_Int32 nZOrder = - 1;
+ aValue >>= nZOrder;
+ if( nZOrder >= 0)
+ {
+ SdrObject* pObject =
+ GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt );
+ SdrModel *pDrawModel = pDoc->GetDrawModel();
+ pDrawModel->GetPage(0)->
+ SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
+ }
+ }
+ else if(RES_ANCHOR == pCur->nWID && MID_ANCHOR_ANCHORFRAME == pCur->nMemberId)
+ {
+ sal_Bool bDone = sal_True;
+ Reference<XTextFrame> xFrame;
+ if(aValue >>= xFrame)
+ {
+ Reference<XUnoTunnel> xTunnel(xFrame, UNO_QUERY);
+ SwXFrame* pFrame = xTunnel.is() ?
+ (SwXFrame*)xTunnel->getSomething(SwXFrame::getUnoTunnelId()) : 0;
+ if(pFrame && this != pFrame && pFrame->GetFrmFmt() && pFrame->GetFrmFmt()->GetDoc() == pDoc)
+ {
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
+ aSet.SetParent(&pFmt->GetAttrSet());
+ SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(pCur->nWID);
+
+
+ SwPosition aPos(*pFrame->GetFrmFmt()->GetCntnt().GetCntntIdx());
+ aAnchor.SetAnchor(&aPos);
+ aAnchor.SetType(FLY_AT_FLY);
+ aSet.Put(aAnchor);
+ pDoc->SetFlyFrmAttr( *pFmt, aSet );
+ bDone = sal_True;
+ }
+ }
+ if(!bDone)
+ throw IllegalArgumentException();
+ }
+ else
+ {
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
+
+ aSet.SetParent(&pFmt->GetAttrSet());
+ aPropSet.setPropertyValue(*pCur, aValue, aSet);
+ if(RES_ANCHOR == pCur->nWID && MID_ANCHOR_ANCHORTYPE == pCur->nMemberId)
+ {
+ SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(pCur->nWID);
+ if(aAnchor.GetAnchorId() == FLY_AT_FLY)
+ {
+ const SwPosition* pPosition = aAnchor.GetCntntAnchor();
+ SwFrmFmt* pFmt = pPosition ? pPosition->nNode.GetNode().GetFlyFmt() : 0;
+ if(!pFmt || pFmt->Which() == RES_DRAWFRMFMT)
+ {
+ lang::IllegalArgumentException aExcept;
+ aExcept.Message = C2U("Anchor to frame: no frame found");
+ throw aExcept;
+ }
+ else
+ {
+ SwPosition aPos = *pPosition;
+ aPos.nNode = *pFmt->GetCntnt().GetCntntIdx();
+ aAnchor.SetAnchor(&aPos);
+ aSet.Put(aAnchor);
+ }
+ }
+ else if(aAnchor.GetAnchorId() != FLY_PAGE && !aAnchor.GetCntntAnchor())
+ {
+ SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
+ SwPaM aPam(rNode);
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ aAnchor.SetAnchor( aPam.Start() );
+ aSet.Put(aAnchor);
+ }
+
+ // see SwFEShell::SetFlyFrmAttr( SfxItemSet& rSet )
+ SwFlyFrm *pFly = 0;
+ if (PTR_CAST(SwFlyFrmFmt, pFmt))
+ pFly = ((SwFlyFrmFmt*)pFmt)->GetFrm();
+ if (pFly)
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, sal_False, &pItem ))
+ {
+ aSet.Put( *pItem );
+ ::binfilter::lcl_ChkAndSetNewAnchor( *pFly, aSet );
+ }
+ }
+
+ pFmt->GetDoc()->SetFlyFrmAttr( *pFmt, aSet );
+ }
+ else if(FN_UNO_CLSID == pCur->nWID)
+ {
+ throw lang::IllegalArgumentException();
+ }
+ else
+ pFmt->SetAttr(aSet);
+ }
+ }
+ else if(IsDescriptor())
+ {
+ pProps->SetProperty(pCur->nWID, pCur->nMemberId, aValue);
+ if( FN_UNO_FRAME_STYLE_NAME == pCur->nWID )
+ {
+ OUString sStyleName;
+ aValue >>= sStyleName;
+ try
+ {
+ Any aAny = mxStyleFamily->getByName ( sStyleName );
+ aAny >>= mxStyleData;
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+ catch ( WrappedTargetException& )
+ {
+ }
+ catch ( RuntimeException& )
+ {
+ }
+ }
+ }
+ else
+ throw RuntimeException();
+}
+
+uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aAny;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName);
+ if (!pCur)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(FN_UNO_ANCHOR_TYPES == pCur->nWID)
+ {
+ uno::Sequence<TextContentAnchorType> aTypes(5);
+ TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = TextContentAnchorType_AT_PARAGRAPH;
+ pArray[1] = TextContentAnchorType_AS_CHARACTER;
+ pArray[2] = TextContentAnchorType_AT_PAGE;
+ pArray[3] = TextContentAnchorType_AT_FRAME;
+ pArray[4] = TextContentAnchorType_AT_CHARACTER;
+ aAny.setValue(&aTypes, ::getCppuType((uno::Sequence<TextContentAnchorType>*)0));
+ }
+ else if(pFmt)
+ {
+ if( ((eType == FLYCNTTYPE_GRF) || (eType == FLYCNTTYPE_OLE)) &&
+ pCur &&
+ ((pCur->nWID >= RES_GRFATR_BEGIN &&
+ pCur->nWID < RES_GRFATR_END )||
+ pCur->nWID == FN_PARAM_COUNTOUR_PP ||
+ pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR ||
+ pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR ))
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ if(pCur->nWID == FN_PARAM_COUNTOUR_PP)
+ {
+ PolyPolygon aContour;
+ if( pNoTxt->GetContourAPI( aContour ) )
+ {
+ PointSequenceSequence aPtSeq(aContour.Count());
+ PointSequence* pPSeq = aPtSeq.getArray();
+ for(USHORT i = 0; i < aContour.Count(); i++)
+ {
+ const Polygon& rPoly = aContour.GetObject(i);
+ pPSeq[i].realloc(rPoly.GetSize());
+ awt::Point* pPoints = pPSeq[i].getArray();
+ for(USHORT j = 0; j < rPoly.GetSize(); j++)
+ {
+ const Point& rPoint = rPoly.GetPoint(j);
+ pPoints[j].X = rPoint.X();
+ pPoints[j].Y = rPoint.Y();
+ }
+ }
+ aAny <<= aPtSeq;
+ }
+ }
+ else if(pCur->nWID == FN_UNO_IS_AUTOMATIC_CONTOUR )
+ {
+ BOOL bValue = pNoTxt->HasAutomaticContour();
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ }
+ else if(pCur->nWID == FN_UNO_IS_PIXEL_CONTOUR )
+ {
+ BOOL bValue = pNoTxt->IsPixelContour();
+ aAny.setValue( &bValue, ::getBooleanCppuType() );
+ }
+ else
+ {
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ aAny = aPropSet.getPropertyValue(*pCur, aSet);
+ }
+ }
+ }
+ else if( FN_UNO_GRAPHIC_U_R_L == pCur->nWID)
+ {
+ String sGrfName;
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if(!pGrfNode)
+ throw RuntimeException();
+ if( pGrfNode->IsGrfLink() )
+ {
+ pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, &sGrfName, 0 );
+ }
+ else
+ {
+ String sPrefix( RTL_CONSTASCII_STRINGPARAM(sGraphicObjectProtocol) );
+ String sId( pGrfNode->GetGrfObj().GetUniqueID(),
+ RTL_TEXTENCODING_ASCII_US );
+ (sGrfName = sPrefix) += sId;
+ }
+ }
+ aAny <<= OUString(sGrfName);
+ }
+ else if( FN_UNO_GRAPHIC_FILTER == pCur->nWID )
+ {
+ String sFltName;
+ pFmt->GetDoc()->GetGrfNms( *(SwFlyFrmFmt*)pFmt, 0, &sFltName );
+ aAny <<= OUString(sFltName);
+ }
+ else if(FN_UNO_FRAME_STYLE_NAME == pCur->nWID)
+ {
+ aAny <<= OUString(SwStyleNameMapper::GetProgName(pFmt->DerivedFrom()->GetName(), GET_POOLID_FRMFMT ) );
+ }
+ else if(eType == FLYCNTTYPE_GRF &&
+ (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ACTUAL_SIZE)) ||
+ FN_UNO_ALTERNATIVE_TEXT == pCur->nWID))
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ if(FN_UNO_ALTERNATIVE_TEXT == pCur->nWID)
+ aAny <<= OUString(pNoTxt->GetAlternateText());
+ else
+ {
+ Size aActSize = ((SwGrfNode*)pNoTxt)->GetTwipSize();
+ awt::Size aTmp;
+ aTmp.Width = TWIP_TO_MM100(aActSize.Width());
+ aTmp.Height = TWIP_TO_MM100(aActSize.Height());
+ aAny.setValue(&aTmp, ::getCppuType((const awt::Size*)0));
+ }
+ }
+ }
+ else if(FN_PARAM_LINK_DISPLAY_NAME == pCur->nWID)
+ {
+ aAny <<= OUString(pFmt->GetName());
+ }
+ else if(FN_UNO_Z_ORDER == pCur->nWID)
+ {
+ const SdrObject* pObj = pFmt->FindRealSdrObject();
+ if( pObj )
+ {
+ aAny <<= (sal_Int32)pObj->GetOrdNum();
+ }
+ }
+ else if(FN_UNO_CLSID == pCur->nWID || FN_UNO_MODEL == pCur->nWID||
+ FN_UNO_COMPONENT == pCur->nWID)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
+ ->GetIndex() + 1 ]->GetOLENode();
+ SvInPlaceObjectRef xIP( pOleNode->GetOLEObj().GetOleRef() );
+ OUString aHexCLSID;
+ if(xIP.Is())
+ {
+ SvOutPlaceObjectRef xOut(xIP);
+ SvGlobalName aClassName = xOut.Is() ? xOut->GetObjectCLSID() : xIP->GetClassName();
+ aHexCLSID = aClassName.GetHexName();
+ if(FN_UNO_CLSID != pCur->nWID)
+ {
+ SfxInPlaceObjectRef xIPO( xIP );
+ SfxObjectShell* pShell = xIPO.Is() ? xIPO->GetObjectShell() : 0;
+ //in both cases the XModel is returned for internal components
+ //external components provide their XComponent for
+ //the "Component" property, only
+ if( pShell )
+ aAny <<= pShell->GetModel();
+ else if(xOut.Is() && FN_UNO_COMPONENT == pCur->nWID)
+ aAny <<= xOut->GetUnoComponent();
+ }
+ }
+ if(FN_UNO_CLSID == pCur->nWID)
+ aAny <<= aHexCLSID;
+ }
+ else
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ aAny = aPropSet.getPropertyValue(*pCur, rSet);
+ }
+ }
+ else if(IsDescriptor())
+ {
+ if ( ! mpDoc )
+ throw RuntimeException();
+ uno::Any* pAny = 0;
+ if( !pProps->GetProperty( pCur->nWID, pCur->nMemberId, pAny ) )
+ pProps->GetProperty( rPropertyName, mxStyleData, aAny );
+ else if ( pAny )
+ aAny = *pAny;
+ }
+ else
+ throw RuntimeException();
+ return aAny;
+}
+
+void SwXFrame::addPropertyChangeListener(const OUString& PropertyName,
+ const uno::Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXFrame::removePropertyChangeListener(const OUString& PropertyName,
+ const uno::Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXFrame::addVetoableChangeListener(const OUString& PropertyName,
+ const uno::Reference< XVetoableChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXFrame::removeVetoableChangeListener(
+ const OUString& PropertyName, const uno::Reference< XVetoableChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+PropertyState SwXFrame::getPropertyState( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< OUString > aPropertyNames(1);
+ OUString* pNames = aPropertyNames.getArray();
+ pNames[0] = rPropertyName;
+ Sequence< PropertyState > aStates = getPropertyStates(aPropertyNames);
+ return aStates.getConstArray()[0];
+}
+
+Sequence< PropertyState > SwXFrame::getPropertyStates(
+ const Sequence< OUString >& aPropertyNames )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< PropertyState > aStates(aPropertyNames.getLength());
+ PropertyState* pStates = aStates.getArray();
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const OUString* pNames = aPropertyNames.getConstArray();
+ const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
+ for(int i = 0; i < aPropertyNames.getLength(); i++)
+ {
+ const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, pNames[i]);
+ if (!pCur)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(pCur->nWID == FN_UNO_ANCHOR_TYPES||
+ pCur->nWID == FN_PARAM_LINK_DISPLAY_NAME||
+ FN_UNO_FRAME_STYLE_NAME == pCur->nWID||
+ FN_UNO_GRAPHIC_U_R_L == pCur->nWID||
+ FN_UNO_GRAPHIC_FILTER == pCur->nWID||
+ FN_UNO_ACTUAL_SIZE == pCur->nWID||
+ FN_UNO_ALTERNATIVE_TEXT == pCur->nWID)
+ pStates[i] = PropertyState_DIRECT_VALUE;
+ else
+ {
+ if(eType == FLYCNTTYPE_GRF &&
+ pCur &&
+ (pCur->nWID >= RES_GRFATR_BEGIN &&
+ pCur->nWID <= RES_GRFATR_END))
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ aSet.GetItemState(pCur->nWID);
+ if(SFX_ITEM_SET == aSet.GetItemState( pCur->nWID, FALSE ))
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ if(SFX_ITEM_SET == rFmtSet.GetItemState( pCur->nWID, FALSE ))
+ pStates[i] = beans::PropertyState_DIRECT_VALUE;
+ else
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ }
+ }
+ }
+ }
+ else if(IsDescriptor())
+ {
+ for(int i = 0; i < aPropertyNames.getLength(); i++)
+ pStates[i] = PropertyState_DIRECT_VALUE;
+ }
+ else
+ throw RuntimeException();
+ return aStates;
+}
+
+void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SwAttrSet& rFmtSet = pFmt->GetAttrSet();
+ const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName);
+ if (!pCur)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pCur->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ BOOL bNextFrame;
+ if( pCur->nWID &&
+ pCur->nWID != FN_UNO_ANCHOR_TYPES &&
+ pCur->nWID != FN_PARAM_LINK_DISPLAY_NAME)
+ {
+ if( eType == FLYCNTTYPE_GRF &&
+ (FN_UNO_ALTERNATIVE_TEXT == pCur->nWID||
+ (pCur->nWID >= RES_GRFATR_BEGIN &&
+ pCur->nWID < RES_GRFATR_END)))
+ {
+ const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
+ if(pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwNoTxtNode* pNoTxt = aIdx.GetNode().GetNoTxtNode();
+ if(FN_UNO_ALTERNATIVE_TEXT == pCur->nWID)
+ pNoTxt->SetAlternateText(aEmptyStr);
+ else
+ {
+ SfxItemSet aSet(pNoTxt->GetSwAttrSet());
+ aSet.ClearItem(pCur->nWID);
+ pNoTxt->SetAttr(aSet);
+ }
+ }
+ }
+ else
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1 );
+ aSet.SetParent(&pFmt->GetAttrSet());
+ aSet.ClearItem(pCur->nWID);
+ if(!rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)))
+ pFmt->SetAttr(aSet);
+ }
+ }
+ else if(0 != (bNextFrame = (rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_NEXT_NAME))))
+ || rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_CHAIN_PREV_NAME)))
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ if(bNextFrame)
+ pDoc->Unchain(*pFmt);
+ else
+ {
+ SwFmtChain aChain( pFmt->GetChain() );
+ SwFrmFmt *pPrev = aChain.GetPrev();
+ if(pPrev)
+ pDoc->Unchain(*pPrev);
+ }
+ }
+ }
+ else if(!IsDescriptor())
+ throw RuntimeException();
+}
+
+Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SfxItemPropertyMap* pCur = SfxItemPropertyMap::GetByName(_pMap, rPropertyName);
+ if(pCur)
+ {
+ if ( pCur->nWID < RES_FRMATR_END )
+ {
+ const SfxPoolItem& rDefItem =
+ pFmt->GetDoc()->GetAttrPool().GetDefaultItem(pCur->nWID);
+ rDefItem.QueryValue(aRet, pCur->nMemberId);
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else if(!IsDescriptor())
+ throw RuntimeException();
+ return aRet;
+}
+
+void SwXFrame::addEventListener(const uno::Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+
+void SwXFrame::removeEventListener(const uno::Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw RuntimeException();
+}
+
+void SwXFrame::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+ mpDoc = 0;
+ aLstnrCntnr.Disposing();
+ }
+}
+
+void SwXFrame::dispose(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SdrObject* pObj = pFmt->FindSdrObject();
+ if( pObj && pObj->IsInserted() )
+ {
+ if( pFmt->GetAnchor().GetAnchorId() == FLY_IN_CNTNT )
+ {
+ const SwPosition &rPos = *(pFmt->GetAnchor().GetCntntAnchor());
+ SwTxtNode *pTxtNode = rPos.nNode.GetNode().GetTxtNode();
+ const xub_StrLen nIdx = rPos.nContent.GetIndex();
+ pTxtNode->Delete( RES_TXTATR_FLYCNT, nIdx, nIdx );
+ }
+ else
+ pFmt->GetDoc()->DelLayoutFmt(pFmt);
+ }
+ }
+}
+
+uno::Reference< XTextRange > SwXFrame::getAnchor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ // return an anchor for non-page bound frames
+ // and for page bound frames that have a page no == NULL and a content position
+ if( rAnchor.GetAnchorId() != FLY_PAGE ||
+ (rAnchor.GetCntntAnchor() && !rAnchor.GetPageNum()))
+ {
+ const SwPosition &rPos = *(rAnchor.GetCntntAnchor());
+ aRef = SwXTextRange::CreateTextRangeFromPosition(pFmt->GetDoc(), rPos, 0);
+ }
+ }
+ else
+ throw RuntimeException();
+ return aRef;
+}
+
+void SwXFrame::ResetDescriptor()
+{
+ bIsDescriptor = sal_False;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+ DELETEZ(pProps);
+}
+
+void SwXFrame::attachToRange(const uno::Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ if(!IsDescriptor())
+ throw RuntimeException();
+ uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDoc)
+ {
+ SwUnoInternalPaM aIntPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aIntPam, xTextRange);
+
+ SwNode& rNode = pDoc->GetNodes().GetEndOfContent();
+ SwPaM aPam(rNode);
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ static sal_uInt16 __READONLY_DATA aFrmAttrRange[] =
+ {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0
+ };
+ static sal_uInt16 __READONLY_DATA aGrAttrRange[] =
+ {
+ RES_GRFATR_BEGIN, RES_GRFATR_END-1,
+ 0
+ };
+ SfxItemSet aGrSet(pDoc->GetAttrPool(), aGrAttrRange );
+
+ SfxItemSet aFrmSet(pDoc->GetAttrPool(), aFrmAttrRange );
+ //jetzt muessen die passenden Items in den Set
+ sal_Bool bSizeFound;
+ if(!pProps->AnyToItemSet( pDoc, aFrmSet, aGrSet, bSizeFound))
+ throw IllegalArgumentException();
+ //der TextRange wird einzeln behandelt
+ *aPam.GetPoint() = *aIntPam.GetPoint();
+ if(aIntPam.HasMark())
+ {
+ aPam.SetMark();
+ *aPam.GetMark() = *aIntPam.GetMark();
+ }
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == aFrmSet.GetItemState(RES_ANCHOR, sal_False, &pItem) )
+ {
+ if( FLY_AT_FLY ==((const SwFmtAnchor*)pItem)->GetAnchorId() &&
+ !aPam.GetNode()->FindFlyStartNode())
+ {
+ //rahmengebunden geht nur dort, wo ein Rahmen ist!
+ SwFmtAnchor aAnchor(FLY_AT_CNTNT);
+ aFrmSet.Put(aAnchor);
+ }
+ else if( FLY_PAGE ==((const SwFmtAnchor*)pItem)->GetAnchorId() &&
+ 0 == ((const SwFmtAnchor*)pItem)->GetPageNum() )
+ {
+ SwFmtAnchor aAnchor( *((const SwFmtAnchor*)pItem) );
+ aAnchor.SetAnchor( aPam.GetPoint() );
+ aFrmSet.Put(aAnchor);
+ }
+ }
+
+ uno::Any* pStyle;
+ SwFrmFmt *pParentFrmFmt = 0;
+ if(pProps->GetProperty(FN_UNO_FRAME_STYLE_NAME, 0, pStyle))
+ pParentFrmFmt = lcl_GetFrmFmt( *pStyle, pDoc );
+
+ SwFlyFrmFmt* pFmt = 0;
+ if( eType == FLYCNTTYPE_FRM)
+ {
+ UnoActionContext aCont(pDoc);
+ pFmt = pDoc->MakeFlySection( FLY_AT_CNTNT, aPam.GetPoint(),
+ &aFrmSet, pParentFrmFmt );
+ if(pFmt)
+ {
+ pFmt->Add(this);
+ if(sName.Len())
+ pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
+ }
+ //den SwXText wecken
+ ((SwXTextFrame*)this)->SetDoc( bIsDescriptor ? mpDoc : GetFrmFmt()->GetDoc() );
+ }
+ else if( eType == FLYCNTTYPE_GRF)
+ {
+ UnoActionContext aCont(pDoc);
+ uno::Any* pGraphicURL;
+ String sGraphicURL;
+ BfGraphicObject* pGrfObj = 0;
+ if(pProps->GetProperty(FN_UNO_GRAPHIC_U_R_L, 0, pGraphicURL))
+ {
+ OUString uTemp;
+ (*pGraphicURL) >>= uTemp;
+ sGraphicURL = String(uTemp);
+ if( sGraphicURL.EqualsAscii( sPackageProtocol,
+ 0, sizeof( sPackageProtocol )-1 ) )
+ {
+ pGrfObj = new BfGraphicObject;
+ pGrfObj->SetUserData( sGraphicURL );
+ pGrfObj->SetSwapState();
+ sGraphicURL.Erase();
+ }
+ else if( sGraphicURL.EqualsAscii( sGraphicObjectProtocol,
+ 0, sizeof(sGraphicObjectProtocol)-1 ) )
+ {
+ ByteString sId( sGraphicURL.Copy( sizeof(sGraphicObjectProtocol)-1 ),
+ RTL_TEXTENCODING_ASCII_US );
+ pGrfObj = new BfGraphicObject( sId );
+ sGraphicURL.Erase();
+ }
+ }
+
+ String sFltName;
+ uno::Any* pFilter;
+ if(pProps->GetProperty(FN_UNO_GRAPHIC_FILTER, 0, pFilter))
+ {
+ OUString uTemp;
+ (*pFilter) >>= uTemp;
+ sFltName = String(uTemp);
+ }
+
+ pFmt =
+ pGrfObj ? pDoc->Insert( aPam, *pGrfObj, &aFrmSet, &aGrSet,
+ pParentFrmFmt )
+ : pDoc->Insert( aPam, sGraphicURL, sFltName, 0,
+ &aFrmSet, &aGrSet, pParentFrmFmt );
+ delete pGrfObj;
+ if(pFmt)
+ {
+ SwGrfNode *pGrfNd = pDoc->GetNodes()[ pFmt->GetCntnt().GetCntntIdx()
+ ->GetIndex()+1 ]->GetGrfNode();
+ pGrfNd->SetChgTwipSize( !bSizeFound );
+ pFmt->Add(this);
+ if(sName.Len())
+ pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
+
+ }
+ uno::Any* pSurroundContour;
+ if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurroundContour))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SURROUND_CONTOUR)), *pSurroundContour);
+ uno::Any* pContourOutside;
+ if(pProps->GetProperty(RES_SURROUND, MID_SURROUND_CONTOUROUTSIDE, pContourOutside))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_OUTSIDE)), *pContourOutside);
+ uno::Any* pContourPoly;
+ if(pProps->GetProperty(FN_PARAM_COUNTOUR_PP, 0, pContourPoly))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_CONTOUR_POLY_POLYGON)), *pContourPoly);
+ uno::Any* pPixelContour;
+ if(pProps->GetProperty(FN_UNO_IS_PIXEL_CONTOUR, 0, pPixelContour))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_PIXEL_CONTOUR)), *pPixelContour);
+ uno::Any* pAutoContour;
+ if(pProps->GetProperty(FN_UNO_IS_AUTOMATIC_CONTOUR, 0, pAutoContour))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_AUTOMATIC_CONTOUR)), *pAutoContour);
+ uno::Any* pAltText;
+ if(pProps->GetProperty(FN_UNO_ALTERNATIVE_TEXT, 0, pAltText))
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ALTERNATIVE_TEXT)), *pAltText);
+ }
+ else
+ {
+ uno::Any* pCLSID;
+ if(!pProps->GetProperty(FN_UNO_CLSID, 0, pCLSID))
+ throw RuntimeException();
+ OUString aCLSID;
+ SvGlobalName aClassName;
+ SvInPlaceObjectRef xIPObj;
+ if( (*pCLSID) >>= aCLSID )
+ {
+ sal_Bool bInternal = sal_True;
+ if( !aClassName.MakeId( aCLSID ) )
+ {
+ IllegalArgumentException aExcept;
+ aExcept.Message = OUString::createFromAscii("CLSID invalid");
+ throw aExcept;
+ }
+ const SotFactory* pFact = SvFactory::Find( aClassName );
+ if ( pFact )
+ {
+ SvStorageRef aStor = new SvStorage( aEmptyStr );
+ xIPObj = &((SvFactory*)SvInPlaceObject::ClassFactory())->CreateAndInit( aClassName, aStor );
+ }
+ else
+ {
+ SvStorageRef aStor = new SvStorage( FALSE, aEmptyStr );
+ String aFileName;
+ BOOL bOk;
+ xIPObj = SvOutPlaceObject::InsertObject( NULL, &aStor, bOk, aClassName, aFileName );
+ }
+ }
+ if ( xIPObj.Is() )
+ {
+ if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xIPObj->GetMiscStatus() && pDoc->GetPrt() )
+ xIPObj->OnDocumentPrinterChanged( pDoc->GetPrt() );
+
+ UnoActionContext aAction(pDoc);
+ ULONG lDummy;
+ String aDummy;
+ // determine source CLSID
+ xIPObj->SvPseudoObject::FillClass( &aClassName, &lDummy, &aDummy, &aDummy, &aDummy);
+
+ if(!bSizeFound)
+ {
+ //The Size should be suggested by the OLE server if not manually set
+ MapMode aRefMap( xIPObj->GetMapUnit() );
+ Size aSz( xIPObj->GetVisArea().GetSize() );
+ if ( !aSz.Width() || !aSz.Height() )
+ {
+ aSz.Width() = aSz.Height() = 5000;
+ aSz = OutputDevice::LogicToLogic
+ ( aSz, MapMode( MAP_100TH_MM ), aRefMap );
+ }
+ MapMode aMyMap( MAP_TWIP );
+ aSz = OutputDevice::LogicToLogic( aSz, aRefMap, aMyMap );
+ SwFmtFrmSize aFrmSz;
+ aFrmSz.SetSize(aSz);
+ aFrmSet.Put(aFrmSz);
+ }
+ SwFlyFrmFmt* pFmt = 0;
+
+ pFmt = pDoc->Insert(aPam, &xIPObj, &aFrmSet );
+ ASSERT( pFmt, "Doc->Insert(notxt) failed." );
+
+ pFmt->Add(this);
+ if(sName.Len())
+ pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt, sName);
+ }
+ }
+
+ if( pFmt && pDoc->GetDrawModel() )
+ GetOrCreateSdrObject( pFmt );
+ uno::Any* pOrder;
+ if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) )
+ setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_Z_ORDER)), *pOrder);
+ }
+ else
+ throw IllegalArgumentException();
+ //setzt das Flag zurueck und loescht den Descriptor-Pointer
+ ResetDescriptor();
+}
+
+void SwXFrame::attach(const uno::Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ SwFrmFmt* pFmt;
+ if(IsDescriptor())
+ attachToRange(xTextRange);
+ else if(0 != (pFmt = GetFrmFmt()))
+ {
+ Reference<XUnoTunnel> xRangeTunnel( xTextRange, UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwUnoInternalPaM aIntPam(*pDoc);
+ if(SwXTextRange::XTextRangeToSwPaM(aIntPam, xTextRange))
+ {
+ SfxItemSet aSet( pDoc->GetAttrPool(),
+ RES_ANCHOR, RES_ANCHOR );
+ aSet.SetParent(&pFmt->GetAttrSet());
+ SwFmtAnchor aAnchor = (const SwFmtAnchor&)aSet.Get(RES_ANCHOR);
+ aAnchor.SetAnchor( aIntPam.Start() );
+ aSet.Put(aAnchor);
+ pDoc->SetFlyFrmAttr( *pFmt, aSet );
+ }
+ else
+ throw IllegalArgumentException();
+ }
+}
+
+awt::Point SwXFrame::getPosition(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("position cannot be determined with this method");
+ throw aRuntime;
+ return awt::Point();
+}
+
+void SwXFrame::setPosition(const awt::Point& aPosition) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("position cannot be changed with this method");
+ throw aRuntime;
+}
+
+awt::Size SwXFrame::getSize(void) throw( RuntimeException )
+{
+ uno::Any aVal = getPropertyValue(C2U("Size"));
+ awt::Size* pRet = (awt::Size*)aVal.getValue();
+ return *pRet;
+}
+
+void SwXFrame::setSize(const awt::Size& aSize)
+ throw( PropertyVetoException, RuntimeException )
+{
+ uno::Any aVal(&aSize, ::getCppuType((const awt::Size*)0));
+ setPropertyValue(C2U("Size"), aVal);
+}
+
+OUString SwXFrame::getShapeType(void) throw( RuntimeException )
+{
+ return C2U("FrameShape");
+}
+
+/******************************************************************
+ * SwXTextFrame
+ ******************************************************************/
+SwXTextFrame::SwXTextFrame( SwDoc *pDoc ) :
+ SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME), pDoc ),
+ SwXText(0, CURSOR_FRAME)
+{
+}
+
+SwXTextFrame::SwXTextFrame(SwFrmFmt& rFmt) :
+ SwXFrame(rFmt, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)),
+ SwXText(rFmt.GetDoc(), CURSOR_FRAME)
+{
+}
+
+SwXTextFrame::~SwXTextFrame()
+{
+}
+
+void SAL_CALL SwXTextFrame::acquire( )throw()
+{
+ SwXFrame::acquire();
+}
+
+void SAL_CALL SwXTextFrame::release( )throw()
+{
+ SwXFrame::release();
+}
+
+uno::Any SAL_CALL SwXTextFrame::queryInterface( const uno::Type& aType )
+ throw (RuntimeException)
+{
+ uno::Any aRet = SwXFrame::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXText::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXTextFrameBaseClass::queryInterface(aType);
+ return aRet;
+}
+
+uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL SwXTextFrame::getTypes( ) throw(RuntimeException)
+{
+ uno::Sequence< uno::Type > aTextFrameTypes = SwXTextFrameBaseClass::getTypes();
+ uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
+ uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+
+ long nIndex = aTextFrameTypes.getLength();
+ aTextFrameTypes.realloc(
+ aTextFrameTypes.getLength() +
+ aFrameTypes.getLength() +
+ aTextTypes.getLength());
+
+ uno::Type* pTextFrameTypes = aTextFrameTypes.getArray();
+ const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
+ pTextFrameTypes[nIndex++] = pFrameTypes[nPos];
+
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ for(nPos = 0; nPos <aTextTypes.getLength(); nPos++)
+ pTextFrameTypes[nIndex++] = pTextTypes[nPos];
+
+ return aTextFrameTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwXTextFrame::getImplementationId( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+uno::Reference< XText > SwXTextFrame::getText(void) throw( RuntimeException )
+{
+ return this;
+}
+
+const SwStartNode *SwXTextFrame::GetStartNode() const
+{
+ const SwStartNode *pSttNd = 0;
+
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SwFmtCntnt& rFlyCntnt = pFmt->GetCntnt();
+ if( rFlyCntnt.GetCntntIdx() )
+ pSttNd = rFlyCntnt.GetCntntIdx()->GetNode().GetStartNode();
+ }
+
+ return pSttNd;
+}
+
+uno::Reference< XTextCursor > SwXTextFrame::createCursor() throw ( ::com::sun::star::uno::RuntimeException)
+{
+ return createTextCursor();
+}
+
+uno::Reference< XTextCursor > SwXTextFrame::createTextCursor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ //save current start node to be able to check if there is content after the table -
+ //otherwise the cursor would be in the body text!
+ const SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
+ const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(SwFlyStartNode);
+
+ SwPaM aPam(rNode);
+ aPam.Move(fnMoveForward, fnGoNode);
+ SwTableNode* pTblNode = aPam.GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while( pTblNode )
+ {
+ aPam.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if(pCont)
+ aPam.GetPoint()->nContent.Assign(pCont, 0);
+
+ const SwStartNode* pNewStartNode =
+ aPam.GetNode()->FindSttNodeByType(SwFlyStartNode);
+ if(!pNewStartNode || pNewStartNode != pOwnStartNode)
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = S2U("no text available");
+ throw aExcept;
+ }
+
+ SwXTextCursor* pXCrsr = new SwXTextCursor(this, *aPam.GetPoint(), CURSOR_FRAME, pFmt->GetDoc());
+ aRef = (XWordCursor*)pXCrsr;
+ SwUnoCrsr* pUnoCrsr = pXCrsr->GetCrsr();
+ }
+ else
+ throw RuntimeException();
+ return aRef;
+}
+
+uno::Reference< XTextCursor > SwXTextFrame::createTextCursorByRange(const uno::Reference< XTextRange > & aTextPosition) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ SwUnoInternalPaM aPam(*GetDoc());
+ if(pFmt && SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ {
+ SwNode& rNode = pFmt->GetCntnt().GetCntntIdx()->GetNode();
+#if OSL_DEBUG_LEVEL > 1
+ const SwStartNode* p1 = aPam.GetNode()->FindFlyStartNode();
+ const SwStartNode* p2 = rNode.FindFlyStartNode();
+#endif
+ if(aPam.GetNode()->FindFlyStartNode() == rNode.FindFlyStartNode())
+ aRef = (XWordCursor*)new SwXTextCursor(this ,
+ *aPam.GetPoint(), CURSOR_FRAME, pFmt->GetDoc(), aPam.GetMark());
+ }
+ else
+ throw RuntimeException();
+ return aRef;
+}
+
+uno::Reference< container::XEnumeration > SwXTextFrame::createEnumeration(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< container::XEnumeration > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ uno::XInterface* pRet = 0;
+ if(pFmt)
+ {
+ SwPosition aPos(pFmt->GetCntnt().GetCntntIdx()->GetNode());
+ SwUnoCrsr* pUnoCrsr = GetDoc()->CreateUnoCrsr(aPos, sal_False);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ aRef = new SwXParagraphEnumeration(this, pUnoCrsr, CURSOR_FRAME);
+ }
+ return aRef;
+}
+
+uno::Type SwXTextFrame::getElementType(void) throw( RuntimeException )
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+
+sal_Bool SwXTextFrame::hasElements(void) throw( RuntimeException )
+{
+ return sal_True;
+}
+
+void SwXTextFrame::attach(const uno::Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ SwXFrame::attach(xTextRange);
+}
+
+uno::Reference< XTextRange > SwXTextFrame::getAnchor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return SwXFrame::getAnchor();
+}
+
+void SwXTextFrame::dispose(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwXFrame::dispose();
+}
+
+void SwXTextFrame::addEventListener(const uno::Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ SwXFrame::addEventListener(aListener);
+}
+
+void SwXTextFrame::removeEventListener(const uno::Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ SwXFrame::removeEventListener(aListener);
+}
+
+OUString SwXTextFrame::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextFrame");
+}
+
+sal_Bool SwXTextFrame::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.Text")||
+ COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextFrame")||
+ SwXFrame::supportsService(rServiceName);
+}
+
+uno::Sequence< OUString > SwXTextFrame::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
+ aRet.realloc(aRet.getLength() + 2);
+ OUString* pArray = aRet.getArray();
+ pArray[aRet.getLength() - 2] = C2U("com.sun.star.text.TextFrame");
+ pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.Text");
+ return aRet;
+}
+
+void * SAL_CALL SwXTextFrame::operator new( size_t t) throw()
+{
+ return SwXTextFrameBaseClass::operator new( t);
+}
+
+void SAL_CALL SwXTextFrame::operator delete( void * p) throw()
+{
+ SwXTextFrameBaseClass::operator delete(p);
+}
+
+uno::Reference<container::XNameReplace > SAL_CALL SwXTextFrame::getEvents()
+ throw(RuntimeException)
+{
+ return new SwFrameEventDescriptor( *this );
+}
+
+sal_Int64 SAL_CALL SwXTextFrame::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ sal_Int64 nRet = SwXFrame::getSomething( rId );
+ if( !nRet )
+ nRet = SwXText::getSomething( rId );
+
+ return nRet;
+}
+
+uno::Any SwXTextFrame::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE))||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
+ {
+ //redline can only be returned if it's a living object
+ if(!IsDescriptor())
+ aRet = SwXText::getPropertyValue(rPropertyName);
+ }
+ else
+ aRet = SwXFrame::getPropertyValue(rPropertyName);
+ return aRet;
+}
+
+/******************************************************************
+ * SwXTextGraphicObject
+ ******************************************************************/
+SwXTextGraphicObject::SwXTextGraphicObject( SwDoc *pDoc ) :
+ SwXFrame(FLYCNTTYPE_GRF, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC), pDoc)
+{
+}
+
+SwXTextGraphicObject::SwXTextGraphicObject(SwFrmFmt& rFmt) :
+ SwXFrame(rFmt, FLYCNTTYPE_GRF, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC))
+{
+}
+
+SwXTextGraphicObject::~SwXTextGraphicObject()
+{
+}
+
+void SAL_CALL SwXTextGraphicObject::acquire( )throw()
+{
+ SwXFrame::acquire();
+}
+
+void SAL_CALL SwXTextGraphicObject::release( )throw()
+{
+ SwXFrame::release();
+}
+
+uno::Any SAL_CALL SwXTextGraphicObject::queryInterface( const uno::Type& aType )
+ throw(RuntimeException)
+{
+ uno::Any aRet = SwXFrame::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXTextGraphicObjectBaseClass::queryInterface(aType);
+ return aRet;
+}
+
+uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
+ SwXTextGraphicObject::getTypes( ) throw(RuntimeException)
+{
+ uno::Sequence< uno::Type > aGraphicTypes = SwXTextGraphicObjectBaseClass::getTypes();
+ uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
+
+ long nIndex = aGraphicTypes.getLength();
+ aGraphicTypes.realloc(
+ aGraphicTypes.getLength() +
+ aFrameTypes.getLength());
+
+ uno::Type* pGraphicTypes = aGraphicTypes.getArray();
+ const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
+ pGraphicTypes[nIndex++] = pFrameTypes[nPos];
+
+ return aGraphicTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwXTextGraphicObject::getImplementationId( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+void SwXTextGraphicObject::attach(const uno::Reference< XTextRange > & xTextRange) throw( IllegalArgumentException, RuntimeException )
+{
+ SwXFrame::attach(xTextRange);
+}
+
+uno::Reference< XTextRange > SwXTextGraphicObject::getAnchor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return SwXFrame::getAnchor();
+}
+
+void SwXTextGraphicObject::dispose(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwXFrame::dispose();
+}
+
+void SwXTextGraphicObject::addEventListener(const uno::Reference< XEventListener > & aListener)
+ throw( RuntimeException )
+{
+ SwXFrame::addEventListener(aListener);
+}
+
+void SwXTextGraphicObject::removeEventListener(const uno::Reference< XEventListener > & aListener)
+ throw( RuntimeException )
+{
+ SwXFrame::removeEventListener(aListener);
+}
+
+OUString SwXTextGraphicObject::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextGraphicObject");
+}
+
+sal_Bool SwXTextGraphicObject::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextGraphicObject") ||
+ SwXFrame::supportsService(rServiceName);
+}
+
+uno::Sequence< OUString > SwXTextGraphicObject::getSupportedServiceNames(void)
+ throw( RuntimeException )
+{
+ uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
+ aRet.realloc(aRet.getLength() + 1);
+ OUString* pArray = aRet.getArray();
+ pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextGraphicObject");
+ return aRet;
+}
+
+void * SAL_CALL SwXTextGraphicObject::operator new( size_t t) throw()
+{
+ return SwXTextGraphicObjectBaseClass::operator new(t);
+}
+
+void SAL_CALL SwXTextGraphicObject::operator delete( void * p) throw()
+{
+ SwXTextGraphicObjectBaseClass::operator delete(p);
+}
+
+uno::Reference<container::XNameReplace> SAL_CALL
+ SwXTextGraphicObject::getEvents()
+ throw(RuntimeException)
+{
+ return new SwFrameEventDescriptor( *this );
+}
+
+/******************************************************************
+ * SwXTextEmbeddedObject
+ ******************************************************************/
+SwXTextEmbeddedObject::SwXTextEmbeddedObject( SwDoc *pDoc ) :
+ SwXFrame(FLYCNTTYPE_OLE, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT), pDoc)
+{
+}
+
+SwXTextEmbeddedObject::SwXTextEmbeddedObject(SwFrmFmt& rFmt) :
+ SwXFrame(rFmt, FLYCNTTYPE_OLE, aSwMapProvider.GetPropertyMap(PROPERTY_MAP_EMBEDDED_OBJECT))
+{
+}
+
+SwXTextEmbeddedObject::~SwXTextEmbeddedObject()
+{
+}
+
+void SAL_CALL SwXTextEmbeddedObject::acquire()throw()
+{
+ SwXFrame::acquire();
+}
+
+void SAL_CALL SwXTextEmbeddedObject::release()throw()
+{
+ SwXFrame::release();
+}
+
+uno::Any SAL_CALL SwXTextEmbeddedObject::queryInterface( const uno::Type& aType )
+ throw( RuntimeException)
+{
+ uno::Any aRet = SwXFrame::queryInterface(aType);;
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXTextEmbeddedObjectBaseClass::queryInterface(aType);
+ return aRet;
+}
+
+uno::Sequence< uno::Type > SAL_CALL SwXTextEmbeddedObject::getTypes( ) throw(RuntimeException)
+{
+ uno::Sequence< uno::Type > aTextEmbeddedTypes = SwXTextEmbeddedObjectBaseClass::getTypes();
+ uno::Sequence< uno::Type > aFrameTypes = SwXFrame::getTypes();
+
+ long nIndex = aTextEmbeddedTypes.getLength();
+ aTextEmbeddedTypes.realloc(
+ aTextEmbeddedTypes.getLength() +
+ aFrameTypes.getLength());
+
+ uno::Type* pTextEmbeddedTypes = aTextEmbeddedTypes.getArray();
+
+ const uno::Type* pFrameTypes = aFrameTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos <aFrameTypes.getLength(); nPos++)
+ pTextEmbeddedTypes[nIndex++] = pFrameTypes[nPos];
+
+ return aTextEmbeddedTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwXTextEmbeddedObject::getImplementationId( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+void SwXTextEmbeddedObject::attach(const uno::Reference< XTextRange > & xTextRange) throw( IllegalArgumentException, RuntimeException )
+{
+ SwXFrame::attach(xTextRange);
+}
+
+uno::Reference< XTextRange > SwXTextEmbeddedObject::getAnchor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return SwXFrame::getAnchor();
+}
+
+void SwXTextEmbeddedObject::dispose(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwXFrame::dispose();
+}
+
+void SwXTextEmbeddedObject::addEventListener(const uno::Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ SwXFrame::addEventListener(aListener);
+}
+
+void SwXTextEmbeddedObject::removeEventListener(const uno::Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ SwXFrame::removeEventListener(aListener);
+}
+
+static uno::Reference< util::XModifyListener > xSwXOLEListener;
+
+uno::Reference< XComponent > SwXTextEmbeddedObject::getEmbeddedObject(void) throw( RuntimeException )
+{
+ uno::Reference< XComponent > xRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
+ DBG_ASSERT( pCnt->GetCntntIdx() &&
+ pDoc->GetNodes()[ pCnt->GetCntntIdx()->
+ GetIndex() + 1 ]->GetOLENode(), "kein OLE-Node?");
+
+ SwOLENode* pOleNode = pDoc->GetNodes()[ pCnt->GetCntntIdx()
+ ->GetIndex() + 1 ]->GetOLENode();
+ SvInPlaceObjectRef xIP( pOleNode->GetOLEObj().GetOleRef() );
+ if (xIP.Is())
+ {
+ SfxInPlaceObjectRef xSfxObj( xIP );
+ if(xSfxObj.Is())
+ {
+ SfxObjectShell* pObjSh = xSfxObj->GetObjectShell();
+ if( pObjSh )
+ {
+ uno::Reference< frame::XModel > xModel = pObjSh->GetBaseModel();
+ xRet = uno::Reference< XComponent >(xModel, uno::UNO_QUERY);
+
+ uno::Reference< util::XModifyBroadcaster > xBrdcst(xModel, uno::UNO_QUERY);
+ if( xBrdcst.is() )
+ {
+ SwXOLEListener* pSwOLEListener = (SwXOLEListener*)
+ xSwXOLEListener.get();
+ if( !pSwOLEListener )
+ xSwXOLEListener = pSwOLEListener = new SwXOLEListener;
+ if( pSwOLEListener->AddOLEFmt( *pFmt ) )
+ xBrdcst->addModifyListener( xSwXOLEListener );
+ }
+ }
+ }
+ else
+ {
+ SvOutPlaceObjectRef xOut( pOleNode->GetOLEObj().GetOleRef() );
+ if ( xOut.Is() )
+ xRet = xOut->GetUnoComponent();
+ }
+ }
+ }
+ return xRet;
+}
+
+OUString SwXTextEmbeddedObject::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextEmbeddedObject");
+}
+
+sal_Bool SwXTextEmbeddedObject::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextEmbeddedObject")||
+ SwXFrame::supportsService(rServiceName);
+}
+
+uno::Sequence< OUString > SwXTextEmbeddedObject::getSupportedServiceNames(void)
+ throw( RuntimeException )
+{
+ uno::Sequence < OUString > aRet = SwXFrame::getSupportedServiceNames();
+ aRet.realloc(aRet.getLength() + 1);
+ OUString* pArray = aRet.getArray();
+ pArray[aRet.getLength() - 1] = C2U("com.sun.star.text.TextEmbeddedObject");
+ return aRet;
+}
+
+void * SAL_CALL SwXTextEmbeddedObject::operator new( size_t t) throw()
+{
+ return SwXTextEmbeddedObjectBaseClass::operator new(t);
+}
+
+void SAL_CALL SwXTextEmbeddedObject::operator delete( void * p) throw()
+{
+ SwXTextEmbeddedObjectBaseClass::operator delete(p);
+}
+
+uno::Reference<container::XNameReplace> SAL_CALL
+ SwXTextEmbeddedObject::getEvents()
+ throw(RuntimeException)
+{
+ return new SwFrameEventDescriptor( *this );
+}
+
+/******************************************************************
+ * SwXOLEListener
+ ******************************************************************/
+void SwXOLEListener::modified( const EventObject& rEvent )
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ SwOLENode* pNd;
+ sal_uInt16 nFndPos = FindEntry( rEvent, &pNd );
+ if( USHRT_MAX != nFndPos && ( !pNd->GetOLEObj().IsOleRef() ||
+ !pNd->GetOLEObj().GetOleRef()->GetProtocol().IsInPlaceActive() ))
+ {
+ // if the OLE-Node is UI-Active do nothing
+ pNd->SetOLESizeInvalid( sal_True );
+ pNd->GetDoc()->SetOLEObjModified();
+ }
+}
+
+void SwXOLEListener::disposing( const EventObject& rEvent )
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ uno::Reference< util::XModifyListener > xListener( this );
+
+ SwOLENode* pNd;
+ sal_uInt16 nFndPos = FindEntry( rEvent, &pNd );
+ if( USHRT_MAX != nFndPos )
+ {
+ SwDepend* pDepend = (SwDepend*)aFmts[ nFndPos ];
+ aFmts.Remove( nFndPos, 1 );
+
+ uno::Reference< frame::XModel > xModel( rEvent.Source, uno::UNO_QUERY );
+ uno::Reference< util::XModifyBroadcaster > xBrdcst(xModel, uno::UNO_QUERY);
+
+ if( xBrdcst.is() )
+ xBrdcst->removeModifyListener( xListener );
+
+ delete pDepend;
+ if( !aFmts.Count() )
+ {
+ // we are the last?
+ // then can we delete us
+ xSwXOLEListener = 0;
+ }
+ }
+}
+
+sal_Bool SwXOLEListener::AddOLEFmt( SwFrmFmt& rFmt )
+{
+ for( sal_uInt16 n = 0, nCnt = aFmts.Count(); n < nCnt; ++n )
+ if( &rFmt == ((SwDepend*)aFmts[ n ])->GetRegisteredIn() )
+ return sal_False; // is in the array
+
+ SwDepend* pNew = new SwDepend( this, &rFmt );
+ aFmts.Insert( pNew, aFmts.Count() );
+ return sal_True;
+}
+
+void SwXOLEListener::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew )
+{
+ const SwClient* pClient = 0;
+
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ pClient = (SwClient*)((SwPtrMsgPoolItem *)pOld)->pObject;
+ break;
+
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ {
+ pClient = ((SwFmtChg*)pNew)->pChangedFmt;
+ }
+ break;
+ }
+
+ if( pClient )
+ {
+ uno::Reference< util::XModifyListener > xListener( this );
+
+ SwDepend* pDepend;
+ for( sal_uInt16 n = 0, nCnt = aFmts.Count(); n < nCnt; ++n )
+ {
+ if( pClient == (pDepend = (SwDepend*)aFmts[ n ])->GetRegisteredIn() )
+ {
+ aFmts.Remove( n, 1 );
+
+ uno::Reference<frame::XModel> xModel = GetModel( *(SwFmt*)pClient );
+ if( xModel.is() )
+ {
+ uno::Reference< util::XModifyBroadcaster > xBrdcst(xModel, uno::UNO_QUERY);
+ if( xBrdcst.is() )
+ xBrdcst->removeModifyListener( xListener );
+ }
+
+ delete pDepend;
+ if( !aFmts.Count() )
+ {
+ // we are the last?
+ // then can we delete us
+ xSwXOLEListener = 0;
+ }
+ break;
+ }
+ }
+ }
+}
+
+uno::Reference< frame::XModel > SwXOLEListener::GetModel( const SwFmt& rFmt, SwOLENode** ppNd ) const
+{
+ SfxObjectShell* pObjSh = GetObjShell( rFmt, ppNd );
+ return pObjSh ? pObjSh->GetBaseModel() : (uno::Reference< frame::XModel >)0;
+}
+
+SfxObjectShell* SwXOLEListener::GetObjShell( const SwFmt& rFmt,
+ SwOLENode** ppNd ) const
+{
+ SfxObjectShell* pShell = 0;
+ const SwFmtCntnt& rCnt = rFmt.GetCntnt();
+ if( rCnt.GetCntntIdx() )
+ {
+ SwNodeIndex aIdx( *rCnt.GetCntntIdx(), 1 );
+ SwOLENode* pOleNode = aIdx.GetNode().GetOLENode();
+ if( pOleNode && pOleNode->GetOLEObj().IsOleRef() )
+ {
+ SfxInPlaceObjectRef xIP( pOleNode->GetOLEObj().GetOleRef() );
+ if( xIP.Is() )
+ pShell = xIP->GetObjectShell();
+ }
+ if( ppNd )
+ *ppNd = pOleNode;
+ }
+ return pShell;
+}
+
+sal_uInt16 SwXOLEListener::FindEntry( const EventObject& rEvent,SwOLENode** ppNd)
+{
+ sal_uInt16 nRet = USHRT_MAX;
+ uno::Reference< frame::XModel > xSrch( rEvent.Source, uno::UNO_QUERY );
+
+ for( sal_uInt16 n = 0, nCnt = aFmts.Count(); n < nCnt; ++n )
+ {
+ SwDepend* pDepend = (SwDepend*)aFmts[ n ];
+ SwFrmFmt* pFmt = (SwFrmFmt*)pDepend->GetRegisteredIn();
+ if( !pFmt )
+ {
+ ASSERT( pFmt, "wo ist das Format geblieben?" );
+ aFmts.Remove( n, 1 );
+ delete pDepend;
+ --n;
+ --nCnt;
+ }
+ else
+ {
+ uno::Reference< frame::XModel > xFmt( GetModel( *pFmt, ppNd ), uno::UNO_QUERY);
+ if( xFmt == xSrch )
+ {
+ nRet = n;
+ break;
+ }
+ }
+ }
+ return nRet;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoftn.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoftn.cxx
new file mode 100644
index 000000000000..47b1afc5d8bb
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoftn.cxx
@@ -0,0 +1,589 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <rtl/uuid.h>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ftnidx.hxx>
+#include <fmtftn.hxx>
+#include <txtftn.hxx>
+#include <ndtxt.hxx>
+#include <unocrsr.hxx>
+#include <hints.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXFootnote::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXFootnote::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return SwXText::getSomething( rId );
+}
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXFootnote::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFootnote");
+}
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXFootnote::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return !rServiceName.compareToAscii("com.sun.star.text.Footnote") ||
+ !rServiceName.compareToAscii("com.sun.star.text.TextContent") ||
+ !rServiceName.compareToAscii("com.sun.star.text.Text") ||
+ (m_bIsEndnote && !rServiceName.compareToAscii("com.sun.star.text.Endnote"));
+;
+}
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXFootnote::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(m_bIsEndnote ? 4 : 3);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.Footnote");
+ pArray[1] = C2U("com.sun.star.text.TextContent");
+ pArray[2] = C2U("com.sun.star.text.Text");
+ if(m_bIsEndnote)
+ pArray[3] = C2U("com.sun.star.text.Endnote");
+ return aRet;
+}
+/*-- 10.12.98 15:31:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TYPEINIT1(SwXFootnote, SwClient);
+
+SwXFootnote::SwXFootnote(sal_Bool bEndnote) :
+ aLstnrCntnr( (text::XTextContent*)this),
+ SwXText(0, CURSOR_FOOTNOTE),
+ pFmtFtn(0),
+ m_bIsDescriptor(sal_True),
+ m_bIsEndnote(bEndnote)
+{
+
+}
+/*-- 10.12.98 15:31:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnote::SwXFootnote(SwDoc* pDoc, const SwFmtFtn& rFmt) :
+ SwXText(pDoc, CURSOR_FOOTNOTE),
+ aLstnrCntnr( (text::XTextContent*)this),
+ pFmtFtn(&rFmt),
+ m_bIsDescriptor(sal_False),
+ m_bIsEndnote(rFmt.IsEndNote())
+{
+ GetDoc()->GetUnoCallBack()->Add(this);
+}
+/*-- 10.12.98 15:31:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFootnote::~SwXFootnote()
+{
+
+}
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL SwXFootnote::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aFtnTypes = SwXFootnoteBaseClass::getTypes();
+ uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+
+ long nIndex = aFtnTypes.getLength();
+ aFtnTypes.realloc( aFtnTypes.getLength() + aTextTypes.getLength());
+
+ uno::Type* pFtnTypes = aFtnTypes.getArray();
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ for(long nPos = 0; nPos < aTextTypes.getLength(); nPos++)
+ pFtnTypes[nIndex++] = pTextTypes[nPos];
+
+ return aFtnTypes;
+}
+
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SAL_CALL SwXFootnote::getImplementationId( ) throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* -----------------------------21.03.00 15:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXFootnote::queryInterface( const uno::Type& aType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = SwXFootnoteBaseClass::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType() )
+ aRet = SwXText::queryInterface(aType);
+ return aRet;
+}
+
+/*-- 10.12.98 15:31:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXFootnote::getLabel(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String sRet;
+ const SwFmtFtn* pFmt = SwXFootnote::FindFmt();
+ if(pFmt)
+ sRet = pFmt->GetNumStr();
+ else if(m_bIsDescriptor)
+ return m_sLabel;
+ else
+ throw uno::RuntimeException();
+ return sRet;
+}
+/*-- 10.12.98 15:31:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::setLabel(const OUString& aLabel) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ const SwFmtFtn* pFmt = FindFmt();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ DBG_ASSERT(pTxtFtn, "kein TextNode?");
+ SwTxtNode& rTxtNode = (SwTxtNode&)pTxtFtn->GetTxtNode();
+
+ SwPaM aPam(rTxtNode, *pTxtFtn->GetStart());
+ GetDoc()->SetCurFtn(aPam, aLabel, pFmt->GetNumber(), pFmt->IsEndNote());
+ }
+ else if(m_bIsDescriptor)
+ m_sLabel = String(aLabel);
+ else
+ throw uno::RuntimeException();
+
+}
+/* -----------------18.02.99 13:32-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFootnote::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ if(!m_bIsDescriptor)
+ throw uno::RuntimeException();
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDoc)
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+
+ UnoActionContext aCont(pDoc);
+ SwTxtAttr* pTxtAttr = 0;
+ pDoc->DeleteAndJoin(aPam);
+ aPam.DeleteMark();
+ SwFmtFtn aFootNote(m_bIsEndnote);
+ if(m_sLabel.Len())
+ aFootNote.SetNumStr(m_sLabel);
+ SfxItemSet aSet(pDoc->GetAttrPool(), RES_TXTATR_FTN, RES_TXTATR_FTN, 0L);
+ aSet.Put(aFootNote);
+ SwXTextCursor::SetCrsrAttr(aPam, aSet, 0);
+
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_FTN );
+
+ if(pTxtAttr)
+ {
+ const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
+ pFmtFtn = &rFtn;
+ pDoc->GetUnoCallBack()->Add(this);
+ //force creation of sequence id - is used for references
+ if(pDoc->IsInReading())
+ ((SwTxtFtn*)pTxtAttr)->SetSeqNo(pDoc->GetFtnIdxs().Count());
+ else
+ ((SwTxtFtn*)pTxtAttr)->SetSeqRefNo();
+ }
+ m_bIsDescriptor = sal_False;
+ SetDoc(pDoc);
+ }
+ else
+ throw lang::IllegalArgumentException();
+}
+/*-- 10.12.98 15:31:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+/*-- 10.12.98 15:31:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXFootnote::getAnchor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< text::XTextRange > aRef;
+ const SwFmtFtn* pFmt = FindFmt();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ SwPosition aPos( pTxtFtn->GetTxtNode() );
+ aRef = SwXTextRange::CreateTextRangeFromPosition((SwDoc*)GetDoc(), aPos, 0);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 10.12.98 15:31:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ const SwFmtFtn* pFmt = FindFmt();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ DBG_ASSERT(pTxtFtn, "kein TextNode?");
+ SwTxtNode& rTxtNode = (SwTxtNode&)pTxtFtn->GetTxtNode();
+ xub_StrLen nPos = *pTxtFtn->GetStart();
+ SwPaM aPam(rTxtNode, nPos, rTxtNode, nPos+1 );
+ GetDoc()->DeleteAndJoin( aPam );
+ }
+ else
+ throw uno::RuntimeException();
+
+}
+/*-- 10.12.98 15:31:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 10.12.98 15:31:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/* -----------------06.05.99 15:31-------------------
+ *
+ * --------------------------------------------------*/
+const SwStartNode *SwXFootnote::GetStartNode() const
+{
+ const SwStartNode *pSttNd = 0;
+ const SwFmtFtn* pFmt = FindFmt();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ if( pTxtFtn )
+ pSttNd = pTxtFtn->GetStartNode()->GetNode().GetStartNode();
+ }
+ return pSttNd;
+}
+
+uno::Reference< text::XTextCursor > SwXFootnote::createCursor() throw ( ::com::sun::star::uno::RuntimeException)
+{
+ return createTextCursor();
+}
+/*-- 10.12.98 15:31:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXFootnote::createTextCursor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< text::XTextCursor > aRef;
+ const SwFmtFtn* pFmt = FindFmt();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ SwPosition aPos( *pTxtFtn->GetStartNode() );
+ SwXTextCursor* pXCrsr = new SwXTextCursor(this, aPos, CURSOR_FOOTNOTE, GetDoc());
+ aRef = (text::XWordCursor*)pXCrsr;
+ SwUnoCrsr* pUnoCrsr = pXCrsr->GetCrsr();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 10.12.98 15:31:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXFootnote::createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & aTextPosition)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ const SwFmtFtn* pFmt = FindFmt();
+ uno::Reference< text::XTextCursor > aRef;
+ SwUnoInternalPaM aPam(*GetDoc());
+ if(pFmt && SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+
+ // skip section nodes to find 'true' start node
+ const SwNode* pStart = aPam.GetNode()->FindFootnoteStartNode();
+ while( pStart->IsSectionNode() )
+ pStart = pStart->FindStartNode();
+
+ if( pStart == &pTxtFtn->GetStartNode()->GetNode())
+ aRef = (text::XWordCursor*)new SwXTextCursor(this , *aPam.GetPoint(), CURSOR_FOOTNOTE, GetDoc(), aPam.GetMark());
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 13.06.00 14:28:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XEnumeration > SwXFootnote::createEnumeration() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< container::XEnumeration > aRef;
+ uno::XInterface* pRet = 0;
+ const SwFmtFtn* pFmt = FindFmt();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ SwPosition aPos( *pTxtFtn->GetStartNode() );
+ SwXTextCursor* pXCrsr = new SwXTextCursor(this, aPos, CURSOR_FOOTNOTE, GetDoc());
+ SwUnoCrsr* pUnoCrsr = pXCrsr->GetCrsr();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+ aRef = new SwXParagraphEnumeration(this, pUnoCrsr, CURSOR_FOOTNOTE);
+ }
+ return aRef;
+}
+/*-- 13.06.00 14:28:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Type SwXFootnote::getElementType( ) throw(RuntimeException)
+{
+ return ::getCppuType((Reference<XTextRange>*)0);
+}
+/*-- 13.06.00 14:28:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXFootnote::hasElements( ) throw(RuntimeException)
+{
+ return sal_True;
+}
+/* -----------------------------07.01.00 12:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXFootnote::Invalidate()
+{
+ if(GetRegisteredIn())
+ {
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ pFmtFtn = 0;
+ aLstnrCntnr.Disposing();
+ SetDoc(0);
+ }
+}
+/* -----------------18.01.99 09:12-------------------
+ *
+ * --------------------------------------------------*/
+void SwXFootnote::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ Invalidate();
+ break;
+ case RES_FOOTNOTE_DELETED:
+ if( (void*)pFmtFtn == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+ }
+}
+/*-- 11.09.00 13:12:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXFootnote::getPropertySetInfo( )
+ throw(RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef =
+ new SfxItemPropertySetInfo(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_FOOTNOTE));
+ return xRef;
+}
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::setPropertyValue( const ::rtl::OUString&,
+ const Any& )
+ throw(UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ //no values to be set
+ throw IllegalArgumentException();
+}
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXFootnote::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Any aRet;
+ if(!SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName))
+ {
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE))||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
+ {
+ //redline can only be returned if it's a living object
+ if(!m_bIsDescriptor)
+ aRet = SwXText::getPropertyValue(rPropertyName);
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_REFERENCE_ID)))
+ {
+ const SwFmtFtn* pFmt = FindFmt();
+ if(pFmt)
+ {
+ const SwTxtFtn* pTxtFtn = pFmt->GetTxtFtn();
+ DBG_ASSERT(pTxtFtn, "no TextNode?");
+ aRet <<= (sal_Int16)pTxtFtn->GetSeqRefNo();
+ }
+ }
+ else
+ {
+ UnknownPropertyException aExcept;
+ aExcept.Message = rPropertyName;
+ throw aExcept;
+ }
+ }
+ return aRet;
+}
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::addPropertyChangeListener( const OUString& aPropertyName,
+ const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::removePropertyChangeListener( const OUString& aPropertyName,
+ const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 11.09.00 13:12:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::addVetoableChangeListener( const OUString& PropertyName,
+ const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 11.09.00 13:12:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFootnote::removeVetoableChangeListener( const OUString& PropertyName,
+ const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoidx.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoidx.cxx
new file mode 100644
index 000000000000..aa0e427dccb5
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoidx.cxx
@@ -0,0 +1,2726 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <tools/debug.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <bf_svx/unolingu.hxx>
+#include <com/sun/star/text/ChapterFormat.hpp>
+#include <com/sun/star/text/ReferenceFieldPart.hpp>
+#include <com/sun/star/text/BibliographyDataField.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+
+#include <cmdid.h>
+#include <swtypes.hxx>
+#include <shellres.hxx>
+#include <viewsh.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <poolfmt.hxx>
+#include <poolfmt.hrc>
+#include <pagedesc.hxx>
+#include <unomap.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <doctxm.hxx>
+#include <txttxmrk.hxx>
+#include <unocrsr.hxx>
+#include <unostyle.hxx>
+#include <ndtxt.hxx>
+#include <unoidx.hxx>
+#include <docsh.hxx>
+#include <chpfld.hxx>
+#include <hints.hxx>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+
+using rtl::OUString;
+
+//-----------------------------------------------------------------------------
+String lcl_AnyToString(uno::Any rVal) throw(IllegalArgumentException)
+{
+ OUString sRet;
+ if(!(rVal >>= sRet))
+ throw IllegalArgumentException();
+ return sRet;
+}
+//-----------------------------------------------------------------------------
+sal_Int16 lcl_AnyToInt16(uno::Any rVal) throw(IllegalArgumentException)
+{
+ sal_Int16 nRet;
+ if(!(rVal >>= nRet))
+ throw IllegalArgumentException();
+ return nRet;
+}
+//-----------------------------------------------------------------------------
+sal_Bool lcl_AnyToBool(uno::Any rVal) throw(IllegalArgumentException)
+{
+ sal_Bool bRet;
+ if(!(rVal >>= bRet))
+ throw IllegalArgumentException();
+ return bRet;
+}
+/******************************************************************************
+ *
+ ******************************************************************************/
+SwTOXMark* lcl_GetMark(SwTOXType* pType, const SwTOXMark* pOwnMark)
+{
+ SwClientIter aIter(*pType);
+ SwTOXMark* pMark = (SwTOXMark*)aIter.First(TYPE(SwTOXMark));
+ while( pMark )
+ {
+ if(pMark == pOwnMark)
+ return pMark;
+ else
+ pMark = (SwTOXMark*)aIter.Next();
+ }
+ return 0;
+}
+//-----------------------------------------------------------------------------
+void lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName)
+{
+ sal_uInt16 nUserCount = pDoc->GetTOXTypeCount( TOX_USER );
+ const SwTOXType* pNewType = 0;
+ for(sal_uInt16 nUser = 0; nUser < nUserCount; nUser++)
+ {
+ const SwTOXType* pType = pDoc->GetTOXType( TOX_USER, nUser );
+ if(pType->GetTypeName().Equals((String)rNewName))
+ {
+ pNewType = pType;
+ break;
+ }
+ }
+ if(!pNewType)
+ {
+ SwTOXType aNewType(TOX_USER, rNewName);
+ pNewType = pDoc->InsertTOXType( aNewType );
+ }
+ //has to be non-const-casted
+ ((SwTOXType*)pNewType)->Add(&rTOXBase);
+}
+//-----------------------------------------------------------------------------
+static const char cUserDefined[] = "User-Defined";
+static const char cUserSuffix[] = " (user)";
+#define USER_LEN 12
+#define USER_AND_SUFFIXLEN 19
+
+void lcl_ConvertTOUNameToProgrammaticName(OUString& rTmp)
+{
+ ShellResource* pShellRes = ViewShell::GetShellRes();
+
+ if(rTmp.equals(pShellRes->aTOXUserName))
+ rTmp = OUString(C2U(cUserDefined));
+ //if the version is not English but the alternative index's name is "User-Defined"
+ //a " (user)" is appended
+ else if(rTmp.equalsAscii(cUserDefined))
+ rTmp += C2U(cUserSuffix);
+}
+//-----------------------------------------------------------------------------
+void lcl_ConvertTOUNameToUserName(OUString& rTmp)
+{
+ ShellResource* pShellRes = ViewShell::GetShellRes();
+ if(rTmp.equalsAscii(cUserDefined))
+ {
+ rTmp = pShellRes->aTOXUserName;
+ }
+ else if(!pShellRes->aTOXUserName.EqualsAscii(cUserDefined) &&
+ USER_AND_SUFFIXLEN == rTmp.getLength())
+ {
+ String sToChange(rTmp);
+ //make sure that in non-English versions the " (user)" suffix is removed
+ if(!sToChange.SearchAscii(cUserDefined) && USER_LEN == sToChange.SearchAscii(cUserSuffix))
+ rTmp = C2U(cUserDefined);
+ }
+}
+
+/******************************************************************
+ * SwXDocumentIndex
+ ******************************************************************/
+/* -----------------20.06.98 11:06-------------------
+ *
+ * --------------------------------------------------*/
+class SwDocIdxProperties_Impl
+{
+ SwTOXBase* pTOXBase;
+ OUString sUserTOXTypeName;
+public:
+ SwTOXBase& GetTOXBase() {return *pTOXBase;}
+ SwDocIdxProperties_Impl(const SwTOXType* pType);
+ ~SwDocIdxProperties_Impl(){delete pTOXBase;}
+
+ const OUString& GetTypeName()const {return sUserTOXTypeName;}
+ void SetTypeName(const OUString& rSet) {sUserTOXTypeName = rSet;}
+};
+/* -----------------20.06.98 11:41-------------------
+ *
+ * --------------------------------------------------*/
+SwDocIdxProperties_Impl::SwDocIdxProperties_Impl(const SwTOXType* pType)
+{
+ SwForm aForm(pType->GetType());
+ pTOXBase = new SwTOXBase(pType, aForm,
+ TOX_MARK, pType->GetTypeName());
+ if(pType->GetType() == TOX_CONTENT || pType->GetType() == TOX_USER)
+ pTOXBase->SetLevel(MAXLEVEL);
+ sUserTOXTypeName = pType->GetTypeName();
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXDocumentIndex::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXDocumentIndex::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/* -----------------------------06.04.00 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXDocumentIndex::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXDocumentIndex");
+}
+/* -----------------------------06.04.00 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXDocumentIndex::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.BaseIndex") == rServiceName ||
+ ( TOX_INDEX == eTOXType && C2U("com.sun.star.text.DocumentIndex") == rServiceName) ||
+ ( TOX_CONTENT == eTOXType && C2U("com.sun.star.text.ContentIndex") == rServiceName) ||
+ ( TOX_USER == eTOXType && C2U("com.sun.star.text.UserDefinedIndex") == rServiceName) ||
+ ( TOX_ILLUSTRATIONS == eTOXType && C2U("com.sun.star.text.IllustrationIndex") == rServiceName) ||
+ ( TOX_TABLES == eTOXType && C2U("com.sun.star.text.TableIndex") == rServiceName) ||
+ ( TOX_OBJECTS == eTOXType && C2U("com.sun.star.text.ObjectIndex") == rServiceName) ||
+ ( TOX_AUTHORITIES == eTOXType && C2U("com.sun.star.text.Bibliography") == rServiceName);
+}
+/* -----------------------------06.04.00 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXDocumentIndex::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.BaseIndex");
+ switch( eTOXType )
+ {
+ case TOX_INDEX: pArray[1] = C2U("com.sun.star.text.DocumentIndex");break;
+ case TOX_CONTENT: pArray[1] = C2U("com.sun.star.text.ContentIndex");break;
+ case TOX_TABLES: pArray[1] = C2U("com.sun.star.text.TableIndex");break;
+ case TOX_ILLUSTRATIONS: pArray[1] = C2U("com.sun.star.text.IllustrationIndex");break;
+ case TOX_OBJECTS: pArray[1] = C2U("com.sun.star.text.ObjectIndex");break;
+ case TOX_AUTHORITIES : pArray[1] = C2U("com.sun.star.text.Bibliography");break;
+ //case TOX_USER:
+ default:
+ pArray[1] = C2U("com.sun.star.text.UserDefinedIndex");
+ }
+ return aRet;
+}
+/*-- 14.12.98 09:35:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+TYPEINIT1(SwXDocumentIndex, SwClient)
+SwXDocumentIndex::SwXDocumentIndex(const SwTOXBaseSection* pB, SwDoc* pDc) :
+ m_pDoc(pDc),
+ aLstnrCntnr( (text::XTextContent*)this),
+ pBase(pB),
+ pProps(0),
+ _pMap(0),
+ pStyleAccess(0),
+ pTokenAccess(0),
+ bIsDescriptor(sal_False),
+ eTOXType(TOX_USER)
+{
+ if(pBase && m_pDoc)
+ {
+ pBase->GetFmt()->Add(this);
+ sal_uInt16 PropertyId;
+ eTOXType = pBase->SwTOXBase::GetType();
+ switch( eTOXType )
+ {
+ case TOX_INDEX: PropertyId = PROPERTY_MAP_INDEX_IDX; break;
+ case TOX_CONTENT: PropertyId = PROPERTY_MAP_INDEX_CNTNT; break;
+ case TOX_TABLES: PropertyId = PROPERTY_MAP_INDEX_TABLES; break;
+ case TOX_ILLUSTRATIONS: PropertyId = PROPERTY_MAP_INDEX_ILLUSTRATIONS; break;
+ case TOX_OBJECTS: PropertyId = PROPERTY_MAP_INDEX_OBJECTS; break;
+ case TOX_AUTHORITIES : PropertyId = PROPERTY_MAP_BIBLIOGRAPHY; break;
+ //case TOX_USER:
+ default:
+ PropertyId = PROPERTY_MAP_INDEX_USER;
+ }
+ _pMap = aSwMapProvider.GetPropertyMap(PropertyId);
+ }
+}
+/* -----------------15.01.99 14:59-------------------
+ *
+ * --------------------------------------------------*/
+SwXDocumentIndex::SwXDocumentIndex(TOXTypes eType, SwDoc& rDoc) :
+ m_pDoc(0),
+ aLstnrCntnr( (text::XTextContent*)this),
+ pBase(0),
+ pProps(new SwDocIdxProperties_Impl(rDoc.GetTOXType(eType, 0))),
+ pStyleAccess(0),
+ pTokenAccess(0),
+ bIsDescriptor(sal_True),
+ eTOXType(eType)
+{
+ sal_uInt16 PropertyId;
+ switch(eType)
+ {
+ case TOX_INDEX: PropertyId = PROPERTY_MAP_INDEX_IDX; break;
+ case TOX_CONTENT: PropertyId = PROPERTY_MAP_INDEX_CNTNT; break;
+ case TOX_TABLES: PropertyId = PROPERTY_MAP_INDEX_TABLES; break;
+ case TOX_ILLUSTRATIONS: PropertyId = PROPERTY_MAP_INDEX_ILLUSTRATIONS; break;
+ case TOX_OBJECTS: PropertyId = PROPERTY_MAP_INDEX_OBJECTS; break;
+ case TOX_AUTHORITIES : PropertyId = PROPERTY_MAP_BIBLIOGRAPHY; break;
+ //case TOX_USER:
+ default:
+ PropertyId = PROPERTY_MAP_INDEX_USER;
+ }
+ _pMap = aSwMapProvider.GetPropertyMap(PropertyId);
+}
+
+/*-- 14.12.98 09:35:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndex::~SwXDocumentIndex()
+{
+ delete pProps;
+}
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXDocumentIndex::getServiceName(void) throw( RuntimeException )
+{
+ USHORT nObjectType = SW_SERVICE_TYPE_INDEX;
+ switch(eTOXType)
+ {
+// case TOX_INDEX: break;
+ case TOX_USER: nObjectType = SW_SERVICE_USER_INDEX;break;
+ case TOX_CONTENT: nObjectType = SW_SERVICE_CONTENT_INDEX;break;
+ case TOX_ILLUSTRATIONS: nObjectType = SW_SERVICE_INDEX_ILLUSTRATIONS;break;
+ case TOX_OBJECTS: nObjectType = SW_SERVICE_INDEX_OBJECTS;break;
+ case TOX_TABLES: nObjectType = SW_SERVICE_INDEX_TABLES;break;
+ case TOX_AUTHORITIES: nObjectType = SW_SERVICE_INDEX_BIBLIOGRAPHY;break;
+ }
+ return SwXServiceProvider::GetProviderName(nObjectType);
+}
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::update(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwTOXBase* pTOXBase = (SwTOXBaseSection*)GetFmt()->GetSection();
+ if(!pTOXBase)
+ throw RuntimeException();
+ ((SwTOXBaseSection*)pTOXBase)->Update();
+ // Seitennummern eintragen
+ ((SwTOXBaseSection*)pTOXBase)->UpdatePageNum();
+}
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXDocumentIndex::getPropertySetInfo(void) throw( RuntimeException )
+{
+ Reference< XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap );
+ return aRef;
+}
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwTOXBase* pTOXBase;
+ if(GetFmt())
+ pTOXBase = (SwTOXBaseSection*)GetFmt()->GetSection();
+ else if(bIsDescriptor)
+ pTOXBase = &pProps->GetTOXBase();
+ if(pTOXBase)
+ {
+ sal_uInt16 nCreate = pTOXBase->GetCreateType();
+ sal_uInt16 nTOIOptions = 0;
+ sal_uInt16 nOLEOptions = pTOXBase->GetOLEOptions();
+ TOXTypes eTxBaseType = pTOXBase->GetTOXType()->GetType();
+ if( eTxBaseType == TOX_INDEX )
+ nTOIOptions = pTOXBase->GetOptions();
+ SwForm aForm(pTOXBase->GetTOXForm());
+ sal_Bool bForm = sal_False;
+ SfxItemSet* pAttrSet = 0;
+ switch(pMap->nWID)
+ {
+ case WID_IDX_TITLE :
+ {
+ OUString sNewName;
+ aValue >>= sNewName;
+ pTOXBase->SetTitle(sNewName);
+ }
+ break;
+ case WID_IDX_NAME:
+ {
+ OUString sNewName;
+ aValue >>= sNewName;
+ pTOXBase->SetTOXName(sNewName);
+ }
+ break;
+ case WID_USER_IDX_NAME:
+ {
+ OUString sNewName;
+ aValue >>= sNewName;
+ lcl_ConvertTOUNameToUserName(sNewName);
+ DBG_ASSERT(TOX_USER == eTxBaseType, "tox type name can only be changed for user indexes");
+ if(GetFmt())
+ {
+ OUString sTmp = pTOXBase->GetTOXType()->GetTypeName();
+ if(sTmp != sNewName)
+ {
+ lcl_ReAssignTOXType(GetFmt()->GetDoc(), *pTOXBase, sNewName);
+ }
+ }
+ else
+ pProps->SetTypeName(sNewName);
+ }
+ break;
+ case WID_IDX_LOCALE:
+ {
+ lang::Locale aLocale;
+ if(aValue>>= aLocale)
+ pTOXBase->SetLanguage(SvxLocaleToLanguage(aLocale));
+ else
+ throw IllegalArgumentException();
+ }
+ break;
+ case WID_IDX_SORT_ALGORITHM:
+ {
+ OUString sTmp;
+ if(aValue >>= sTmp)
+ pTOXBase->SetSortAlgorithm(sTmp);
+ else
+ throw IllegalArgumentException();
+ }
+ break;
+ case WID_LEVEL :
+ pTOXBase->SetLevel(lcl_AnyToInt16(aValue));
+ break;
+ case WID_CREATE_FROM_MARKS :
+ nCreate = lcl_AnyToBool(aValue) ? nCreate | TOX_MARK: nCreate & ~TOX_MARK;
+ break;
+ case WID_CREATE_FROM_OUTLINE :
+ nCreate = lcl_AnyToBool(aValue) ? nCreate | TOX_OUTLINELEVEL: nCreate & ~TOX_OUTLINELEVEL;
+ break;
+// case WID_PARAGRAPH_STYLE_NAMES :DBG_ERROR("not implemented")
+// break;
+ case WID_CREATE_FROM_CHAPTER :
+ pTOXBase->SetFromChapter(lcl_AnyToBool(aValue));
+ break;
+ case WID_CREATE_FROM_LABELS :
+ pTOXBase->SetFromObjectNames(! lcl_AnyToBool(aValue));
+ break;
+ case WID_PROTECTED :
+ {
+ sal_Bool bSet = lcl_AnyToBool(aValue);
+ pTOXBase->SetProtected(bSet);
+ if(GetFmt())
+ ((SwTOXBaseSection*)pTOXBase)->SetProtect(bSet);
+ }
+ break;
+ case WID_USE_ALPHABETICAL_SEPARATORS:
+ nTOIOptions = lcl_AnyToBool(aValue) ?
+ nTOIOptions | TOI_ALPHA_DELIMITTER : nTOIOptions & ~TOI_ALPHA_DELIMITTER;
+ break;
+ case WID_USE_KEY_AS_ENTRY :
+ nTOIOptions = lcl_AnyToBool(aValue) ?
+ nTOIOptions | TOI_KEY_AS_ENTRY : nTOIOptions & ~TOI_KEY_AS_ENTRY;
+ break;
+ case WID_USE_COMBINED_ENTRIES :
+ nTOIOptions = lcl_AnyToBool(aValue) ?
+ nTOIOptions | TOI_SAME_ENTRY : nTOIOptions & ~TOI_SAME_ENTRY;
+ break;
+ case WID_IS_CASE_SENSITIVE :
+ nTOIOptions = lcl_AnyToBool(aValue) ?
+ nTOIOptions | TOI_CASE_SENSITIVE : nTOIOptions & ~TOI_CASE_SENSITIVE;
+ break;
+ case WID_USE_P_P :
+ nTOIOptions = lcl_AnyToBool(aValue) ?
+ nTOIOptions | TOI_FF : nTOIOptions & ~TOI_FF;
+ break;
+ case WID_USE_DASH :
+ nTOIOptions = lcl_AnyToBool(aValue) ?
+ nTOIOptions | TOI_DASH : nTOIOptions & ~TOI_DASH;
+ break;
+ case WID_USE_UPPER_CASE :
+ nTOIOptions = lcl_AnyToBool(aValue) ?
+ nTOIOptions | TOI_INITIAL_CAPS : nTOIOptions & ~TOI_INITIAL_CAPS;
+ break;
+ case WID_IS_COMMA_SEPARATED :
+ bForm = sal_True;
+ aForm.SetCommaSeparated(lcl_AnyToBool(aValue));
+ break;
+ case WID_LABEL_CATEGORY :
+ {
+ // convert file-format/API/external programmatic english name
+ // to internal UI name before usage
+ String aName( SwStyleNameMapper::GetSpecialExtraUIName(
+ lcl_AnyToString(aValue) ) );
+ pTOXBase->SetSequenceName( aName );
+ }
+ break;
+ case WID_LABEL_DISPLAY_TYPE :
+ {
+ sal_Int16 nVal = lcl_AnyToInt16(aValue);
+ sal_uInt16 nSet = CAPTION_COMPLETE;
+ switch (nVal)
+ {
+ case text::ReferenceFieldPart::TEXT: nSet = CAPTION_COMPLETE;
+ break;
+ case text::ReferenceFieldPart::CATEGORY_AND_NUMBER : nSet = CAPTION_NUMBER;
+ break;
+ case text::ReferenceFieldPart::ONLY_CAPTION : nSet = CAPTION_TEXT;
+ break;
+ default:
+ throw IllegalArgumentException();
+ }
+ pTOXBase->SetCaptionDisplay((SwCaptionDisplay)nSet);
+ }
+ break;
+ case WID_USE_LEVEL_FROM_SOURCE :
+ pTOXBase->SetLevelFromChapter(lcl_AnyToBool(aValue));
+ break;
+// case WID_RECALC_TAB_STOPS :DBG_ERROR("not implemented")
+// lcl_AnyToBool(aValue) ?
+// break;
+ break;
+ case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME :
+ {
+ String aString;
+ SwStyleNameMapper::FillUIName(lcl_AnyToString(aValue), aString, GET_POOLID_CHRFMT, sal_True);
+ pTOXBase->SetMainEntryCharStyle( aString );
+ }
+ break;
+ case WID_CREATE_FROM_TABLES :
+ nCreate = lcl_AnyToBool(aValue) ? nCreate | TOX_TABLE : nCreate & ~TOX_TABLE;
+ break;
+ case WID_CREATE_FROM_TEXT_FRAMES :
+ nCreate = lcl_AnyToBool(aValue) ? nCreate | TOX_FRAME : nCreate & ~TOX_FRAME;
+ break;
+ case WID_CREATE_FROM_GRAPHIC_OBJECTS :
+ nCreate = lcl_AnyToBool(aValue) ? nCreate | TOX_GRAPHIC : nCreate & ~TOX_GRAPHIC;
+ break;
+ case WID_CREATE_FROM_EMBEDDED_OBJECTS :
+ if(lcl_AnyToBool(aValue))
+ nCreate |= TOX_OLE;
+ else
+ nCreate &= ~TOX_OLE;
+ break;
+ case WID_CREATE_FROM_STAR_MATH:
+ nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | TOO_MATH : nOLEOptions & ~TOO_MATH;
+ break;
+ case WID_CREATE_FROM_STAR_CHART :
+ nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | TOO_CHART : nOLEOptions & ~TOO_CHART;
+ break;
+ case WID_CREATE_FROM_STAR_CALC :
+ nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | TOO_CALC : nOLEOptions & ~TOO_CALC;
+ break;
+ case WID_CREATE_FROM_STAR_DRAW :
+ nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | TOO_DRAW_IMPRESS : nOLEOptions & ~TOO_DRAW_IMPRESS;
+ break;
+ case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
+ nOLEOptions = lcl_AnyToBool(aValue) ? nOLEOptions | TOO_OTHER : nOLEOptions & ~TOO_OTHER;
+ break;
+ case WID_PARA_HEAD :
+ {
+ String aString;
+ SwStyleNameMapper::FillUIName( lcl_AnyToString(aValue), aString, GET_POOLID_TXTCOLL, sal_True);
+ bForm = sal_True;
+ //Header steht an Pos 0
+ aForm.SetTemplate( 0, aString );
+ }
+ break;
+ case WID_IS_RELATIVE_TABSTOPS:
+ bForm = sal_True;
+ aForm.SetRelTabPos(lcl_AnyToBool(aValue));
+ break;
+ case WID_PARA_SEP :
+ {
+ String aString;
+ bForm = sal_True;
+ SwStyleNameMapper::FillUIName( lcl_AnyToString(aValue), aString, GET_POOLID_TXTCOLL, sal_True);
+ aForm.SetTemplate( 1, aString );
+ }
+ break;
+ case WID_CREATE_FROM_PARAGRAPH_STYLES:
+ nCreate = lcl_AnyToBool(aValue) ?
+ (nCreate | TOX_TEMPLATE) : (nCreate & ~TOX_TEMPLATE);
+ break;
+
+ case WID_PARA_LEV1 :
+ case WID_PARA_LEV2 :
+ case WID_PARA_LEV3 :
+ case WID_PARA_LEV4 :
+ case WID_PARA_LEV5 :
+ case WID_PARA_LEV6 :
+ case WID_PARA_LEV7 :
+ case WID_PARA_LEV8 :
+ case WID_PARA_LEV9 :
+ case WID_PARA_LEV10 :
+ {
+ bForm = sal_True;
+ // im sdbcx::Index beginnt Lebel 1 bei Pos 2 sonst bei Pos 1
+ sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
+ String aString;
+ SwStyleNameMapper::FillUIName( lcl_AnyToString(aValue), aString, GET_POOLID_TXTCOLL, sal_True);
+ aForm.SetTemplate(nLPos + pMap->nWID - WID_PARA_LEV1, aString );
+ }
+ break;
+ default:
+ //this is for items only
+ if(WID_PRIMARY_KEY > pMap->nWID)
+ {
+ SfxItemPropertySet aPropSet(_pMap);
+ const SwAttrSet& rSet = m_pDoc->GetTOXBaseAttrSet(*pTOXBase);
+ pAttrSet = new SfxItemSet(rSet);
+ aPropSet.setPropertyValue(*pMap, aValue, *pAttrSet);
+
+ const SwSectionFmts& rSects = m_pDoc->GetSections();
+ const SwSectionFmt* pOwnFmt = GetFmt();
+ for(sal_uInt16 i = 0; i < rSects.Count(); i++)
+ {
+ const SwSectionFmt* pTmpFmt = rSects[ i ];
+ if(pTmpFmt == pOwnFmt)
+ {
+ m_pDoc->ChgSection( i, *(SwTOXBaseSection*)pTOXBase, pAttrSet );
+ break;
+ }
+ }
+ }
+ }
+ pTOXBase->SetCreate(nCreate);
+ pTOXBase->SetOLEOptions(nOLEOptions);
+ if(pTOXBase->GetTOXType()->GetType() == TOX_INDEX)
+ pTOXBase->SetOptions(nTOIOptions);
+ if(bForm)
+ pTOXBase->SetTOXForm(aForm);
+ delete pAttrSet;
+ }
+ else
+ throw RuntimeException();
+
+}
+/*-- 14.12.98 09:35:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SwTOXBase* pTOXBase;
+ if(GetFmt())
+ pTOXBase = (SwTOXBaseSection*)GetFmt()->GetSection();
+ else if(bIsDescriptor)
+ pTOXBase = &pProps->GetTOXBase();
+ if(pTOXBase)
+ {
+ sal_uInt16 nCreate = pTOXBase->GetCreateType();
+ sal_uInt16 nTOIOptions = 0;
+ sal_uInt16 nOLEOptions = pTOXBase->GetOLEOptions();
+ if(pTOXBase->GetTOXType()->GetType() == TOX_INDEX)
+ nTOIOptions = pTOXBase->GetOptions();
+ const SwForm& rForm = pTOXBase->GetTOXForm();
+ sal_Bool bBOOL = sal_True;
+ sal_Bool bRet = sal_False;
+ switch(pMap->nWID)
+ {
+ case WID_IDX_CONTENT_SECTION:
+ case WID_IDX_HEADER_SECTION :
+ bBOOL = sal_False;
+ if(WID_IDX_CONTENT_SECTION == pMap->nWID)
+ {
+ Reference <XTextSection> xContentSect = SwXTextSections::GetObject( *GetFmt() );
+ aRet <<= xContentSect;
+ }
+ else
+ {
+ SwSections aSectArr;
+ GetFmt()->GetChildSections( aSectArr, SORTSECT_NOT, FALSE);
+ for(USHORT i = 0; i < aSectArr.Count(); i++)
+ {
+ SwSection* pSect = aSectArr[i];
+ if(pSect->GetType() == TOX_HEADER_SECTION)
+ {
+ Reference <XTextSection> xHeaderSect = SwXTextSections::GetObject( *pSect->GetFmt() );
+ aRet <<= xHeaderSect;
+ break;
+ }
+ }
+ }
+ break;
+ case WID_IDX_TITLE :
+ {
+ bBOOL = sal_False;
+ OUString uRet(pTOXBase->GetTitle());
+ aRet <<= uRet;
+ break;
+ }
+ case WID_IDX_NAME:
+ bBOOL = sal_False;
+ aRet <<= OUString(pTOXBase->GetTOXName());
+ break;
+ case WID_USER_IDX_NAME:
+ {
+ bBOOL = sal_False;
+ OUString sTmp;
+ if(!IsDescriptor())
+ sTmp = pTOXBase->GetTOXType()->GetTypeName();
+ else
+ sTmp = pProps->GetTypeName();
+ //I18N
+ lcl_ConvertTOUNameToProgrammaticName(sTmp);
+ aRet <<= sTmp;
+ }
+ break;
+ case WID_IDX_LOCALE:
+ bBOOL = sal_False;
+ aRet <<= SvxCreateLocale(pTOXBase->GetLanguage());
+ break;
+ case WID_IDX_SORT_ALGORITHM:
+ bBOOL = sal_False;
+ aRet <<= OUString(pTOXBase->GetSortAlgorithm());
+ break;
+ case WID_LEVEL :
+ bBOOL = sal_False;
+ aRet <<= (sal_Int16)pTOXBase->GetLevel();
+ break;
+ case WID_CREATE_FROM_MARKS :
+ bRet = 0 != (nCreate & TOX_MARK);
+ break;
+ case WID_CREATE_FROM_OUTLINE :
+ bRet = 0 != (nCreate & TOX_OUTLINELEVEL);
+ break;
+ case WID_CREATE_FROM_CHAPTER :
+ bRet = pTOXBase->IsFromChapter();
+ break;
+ case WID_CREATE_FROM_LABELS :
+ bRet = ! pTOXBase->IsFromObjectNames();
+ break;
+ case WID_PROTECTED :
+ bRet = pTOXBase->IsProtected();
+ break;
+ case WID_USE_ALPHABETICAL_SEPARATORS:
+ bRet = 0 != (nTOIOptions & TOI_ALPHA_DELIMITTER);
+ break;
+ case WID_USE_KEY_AS_ENTRY :
+ bRet = 0 != (nTOIOptions & TOI_KEY_AS_ENTRY);
+ break;
+ case WID_USE_COMBINED_ENTRIES :
+ bRet = 0 != (nTOIOptions & TOI_SAME_ENTRY);
+ break;
+ case WID_IS_CASE_SENSITIVE :
+ bRet = 0 != (nTOIOptions & TOI_CASE_SENSITIVE);
+ break;
+ case WID_USE_P_P:
+ bRet = 0 != (nTOIOptions & TOI_FF);
+ break;
+ case WID_USE_DASH :
+ bRet = 0 != (nTOIOptions & TOI_DASH);
+ break;
+ case WID_USE_UPPER_CASE :
+ bRet = 0 != (nTOIOptions & TOI_INITIAL_CAPS);
+ break;
+ case WID_IS_COMMA_SEPARATED :
+ bRet = rForm.IsCommaSeparated();
+ break;
+ case WID_LABEL_CATEGORY :
+ {
+ // convert internal UI name to
+ // file-format/API/external programmatic english name
+ // before usage
+ String aName( SwStyleNameMapper::GetSpecialExtraProgName(
+ pTOXBase->GetSequenceName() ) );
+ aRet <<= OUString( aName );
+ bBOOL = sal_False;
+ }
+ break;
+ case WID_LABEL_DISPLAY_TYPE :
+ {
+ bBOOL = sal_False;
+ sal_Int16 nSet = text::ReferenceFieldPart::TEXT;
+ switch (pTOXBase->GetCaptionDisplay())
+ {
+ case CAPTION_COMPLETE: nSet = text::ReferenceFieldPart::TEXT;break;
+ case CAPTION_NUMBER : nSet = text::ReferenceFieldPart::CATEGORY_AND_NUMBER; break;
+ case CAPTION_TEXT : nSet = text::ReferenceFieldPart::ONLY_CAPTION; break;
+ }
+ aRet <<= nSet;
+ }
+ break;
+ case WID_USE_LEVEL_FROM_SOURCE :
+ bRet = pTOXBase->IsLevelFromChapter();
+ break;
+ case WID_LEVEL_FORMAT :
+ {
+ Reference< container::XIndexReplace > xTokenAcc =
+ ((SwXDocumentIndex*)this)->GetTokenAccess();
+ if(!xTokenAcc.is())
+ xTokenAcc = new SwXIndexTokenAccess_Impl(*
+ (SwXDocumentIndex*)this);
+ aRet.setValue(&xTokenAcc, ::getCppuType((const Reference<container::XIndexReplace>*)0));
+ bBOOL = sal_False;
+ }
+ break;
+ case WID_LEVEL_PARAGRAPH_STYLES :
+ {
+ Reference< container::XIndexReplace > xStyleAcc =
+ ((SwXDocumentIndex*)this)->GetStyleAccess();
+ if(!xStyleAcc.is())
+ xStyleAcc = new SwXIndexStyleAccess_Impl(*
+ (SwXDocumentIndex*)this);
+ aRet.setValue(&xStyleAcc, ::getCppuType((const Reference<container::XIndexReplace>*)0));
+ bBOOL = sal_False;
+ }
+ break;
+// case WID_RECALC_TAB_STOPS :
+// tab stops are alway recalculated
+// break;
+ //case WID_??? :
+ break;
+ case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME :
+ {
+ bBOOL = sal_False;
+ String aString;
+ SwStyleNameMapper::FillProgName(
+ pTOXBase->GetMainEntryCharStyle(),
+ aString,
+ GET_POOLID_CHRFMT,
+ sal_True);
+ aRet <<= OUString( aString );
+ }
+ break;
+ case WID_CREATE_FROM_TABLES :
+ bRet = 0 != (nCreate & TOX_TABLE);
+ break;
+ case WID_CREATE_FROM_TEXT_FRAMES :
+ bRet = 0 != (nCreate & TOX_FRAME);
+ break;
+ case WID_CREATE_FROM_GRAPHIC_OBJECTS :
+ bRet = 0 != (nCreate & TOX_GRAPHIC);
+ break;
+ case WID_CREATE_FROM_EMBEDDED_OBJECTS :
+ bRet = 0 != (nCreate & TOX_OLE);
+ break;
+ case WID_CREATE_FROM_STAR_MATH:
+ bRet = 0 != (nOLEOptions & TOO_MATH);
+ break;
+ case WID_CREATE_FROM_STAR_CHART :
+ bRet = 0 != (nOLEOptions & TOO_CHART);
+ break;
+ case WID_CREATE_FROM_STAR_CALC :
+ bRet = 0 != (nOLEOptions & TOO_CALC);
+ break;
+ case WID_CREATE_FROM_STAR_DRAW :
+ bRet = 0 != (nOLEOptions & TOO_DRAW_IMPRESS);
+ break;
+ case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
+ bRet = 0 != (nOLEOptions & TOO_OTHER);
+ break;
+ case WID_CREATE_FROM_PARAGRAPH_STYLES:
+ bRet = 0 != (nCreate & TOX_TEMPLATE);
+ break;
+ case WID_PARA_HEAD :
+ {
+ //Header steht an Pos 0
+ String aString;
+ SwStyleNameMapper::FillProgName(rForm.GetTemplate( 0 ), aString,
+ GET_POOLID_TXTCOLL, sal_True );
+ aRet <<= OUString( aString );
+ bBOOL = sal_False;
+ }
+ break;
+ case WID_PARA_SEP :
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(
+ rForm.GetTemplate( 1 ),
+ aString,
+ GET_POOLID_TXTCOLL,
+ sal_True);
+ aRet <<= OUString( aString );
+ bBOOL = sal_False;
+ }
+ break;
+ case WID_PARA_LEV1 :
+ case WID_PARA_LEV2 :
+ case WID_PARA_LEV3 :
+ case WID_PARA_LEV4 :
+ case WID_PARA_LEV5 :
+ case WID_PARA_LEV6 :
+ case WID_PARA_LEV7 :
+ case WID_PARA_LEV8 :
+ case WID_PARA_LEV9 :
+ case WID_PARA_LEV10 :
+ {
+ // im sdbcx::Index beginnt Lebel 1 bei Pos 2 sonst bei Pos 1
+ sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
+ String aString;
+ SwStyleNameMapper::FillProgName(
+ rForm.GetTemplate(nLPos + pMap->nWID - WID_PARA_LEV1),
+ aString,
+ GET_POOLID_TXTCOLL,
+ sal_True);
+ aRet <<= OUString( aString );
+ bBOOL = sal_False;
+ }
+ break;
+ case WID_IS_RELATIVE_TABSTOPS:
+ bRet = rForm.IsRelTabPos();
+ break;
+ case WID_INDEX_MARKS:
+ {
+ SwTOXMarks aMarks;
+ const SwTOXType* pType = pTOXBase->GetTOXType();
+ SwClientIter aIter(*(SwTOXType*)pType);
+ SwTOXMark* pMark = (SwTOXMark*)aIter.First(TYPE(SwTOXMark));
+ while( pMark )
+ {
+ if(pMark->GetTxtTOXMark())
+ aMarks.C40_INSERT(SwTOXMark, pMark, aMarks.Count());
+ pMark = (SwTOXMark*)aIter.Next();
+ }
+ Sequence< Reference < XDocumentIndexMark > > aXMarks(aMarks.Count());
+ Reference<XDocumentIndexMark>* pxMarks = aXMarks.getArray();
+ for(USHORT i = 0; i < aMarks.Count(); i++)
+ {
+ SwTOXMark* pMark = aMarks.GetObject(i);
+ pxMarks[i] = SwXDocumentIndexMark::GetObject((SwTOXType*)pType, pMark, m_pDoc);
+ }
+ aRet.setValue(&aXMarks, ::getCppuType((Sequence< Reference< XDocumentIndexMark > >*)0));
+ bBOOL = sal_False;
+ }
+ break;
+ default:
+ //this is for items only
+ bBOOL = sal_False;
+ if(WID_PRIMARY_KEY > pMap->nWID)
+ {
+ SfxItemPropertySet aPropSet(_pMap);
+ const SwAttrSet& rSet = m_pDoc->GetTOXBaseAttrSet(*pTOXBase);
+ aRet = aPropSet.getPropertyValue(*pMap, rSet);
+ }
+ }
+ if(bBOOL)
+ aRet.setValue(&bRet, ::getCppuBooleanType());
+ }
+ return aRet;
+}
+/*-- 14.12.98 09:35:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::addPropertyChangeListener(const OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 09:35:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::removePropertyChangeListener(const OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 09:35:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::addVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 09:35:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::removeVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 09:35:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ BOOL bRemove = FALSE;
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ bRemove = (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject;
+ break;
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ bRemove = ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR();
+ break;
+ }
+ if( bRemove )
+ {
+ ((SwModify*)GetRegisteredIn())->Remove( this );
+ aLstnrCntnr.Disposing();
+ }
+}
+/* -----------------18.02.99 13:39-------------------
+ *
+ * --------------------------------------------------*/
+void SwXDocumentIndex::attachToRange(const Reference< text::XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ if(!bIsDescriptor)
+ throw RuntimeException();
+ Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDoc )
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+
+ const SwTOXBase* pOld = pDoc->GetCurTOX( *aPam.Start() );
+ if(!pOld)
+ {
+ UnoActionContext aAction(pDoc);
+ if(aPam.HasMark())
+ pDoc->DeleteAndJoin(aPam);
+
+ SwTOXBase& rTOXBase = pProps->GetTOXBase();
+ const SwTOXType* pTOXType = rTOXBase.GetTOXType();
+ if(TOX_USER == pTOXType->GetType() && !pProps->GetTypeName().equals(pTOXType->GetTypeName()))
+ {
+ lcl_ReAssignTOXType(pDoc, rTOXBase, pProps->GetTypeName());
+ }
+ //TODO: apply Section attributes (columns and background)
+ const SwTOXBaseSection* pTOX = pDoc->InsertTableOf(
+ *aPam.GetPoint(), rTOXBase, 0, sal_False );
+
+ pDoc->SetTOXBaseName( *pTOX, pProps->GetTOXBase().GetTOXName() );
+
+ // Seitennummern eintragen
+ pBase = (const SwTOXBaseSection*)pTOX;
+ pBase->GetFmt()->Add(this);
+ ((SwTOXBaseSection*)pTOX)->UpdatePageNum();
+ }
+ else
+ throw IllegalArgumentException();
+
+ DELETEZ(pProps);
+ m_pDoc = pDoc;
+ bIsDescriptor = sal_False;
+ }
+}
+/*-- 15.01.99 14:23:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::attach(const Reference< text::XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+/*-- 15.01.99 14:23:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< text::XTextRange > SwXDocumentIndex::getAnchor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Reference< text::XTextRange > xRet;
+ if(GetRegisteredIn())
+ {
+ SwSectionFmt* pSectFmt = GetFmt();
+ const SwNodeIndex* pIdx;
+ if( 0 != ( pIdx = pSectFmt->GetCntnt().GetCntntIdx() ) &&
+ pIdx->GetNode().GetNodes().IsDocNodes() )
+ {
+ SwPaM aPaM(*pIdx);
+ aPaM.Move( fnMoveForward, fnGoCntnt );
+ aPaM.SetMark();
+ aPaM.GetPoint()->nNode = *pIdx->GetNode().EndOfSectionNode();
+ aPaM.Move( fnMoveBackward, fnGoCntnt );
+ xRet = SwXTextRange::CreateTextRangeFromPosition(pSectFmt->GetDoc(),
+ *aPaM.GetMark(), aPaM.GetPoint());
+ }
+ }
+ else
+ throw RuntimeException();
+ return xRet;
+}
+/*-- 15.01.99 15:46:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_RemoveChildSections(SwSectionFmt& rParentFmt)
+{
+ SwSections aTmpArr;
+ SwDoc* pDoc = rParentFmt.GetDoc();
+ sal_uInt16 nCnt = rParentFmt.GetChildSections(aTmpArr,SORTSECT_POS);
+ if( nCnt )
+ {
+ for( sal_uInt16 n = 0; n < nCnt; ++n )
+ if( aTmpArr[n]->GetFmt()->IsInNodesArr() )
+ {
+ SwSectionFmt* pFmt = aTmpArr[n]->GetFmt();
+ lcl_RemoveChildSections(*pFmt);
+ pDoc->DelSectionFmt( pFmt );
+ }
+ }
+}
+void SwXDocumentIndex::dispose(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(GetRegisteredIn())
+ {
+ SwSectionFmt* pSectFmt = GetFmt();
+ pSectFmt->GetDoc()->DeleteTOX( *(SwTOXBaseSection*)pSectFmt->GetSection(), sal_True);
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 15.01.99 15:46:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::addEventListener(const Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 15.01.99 15:46:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndex::removeEventListener(const Reference< XEventListener > & aListener) throw( RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw RuntimeException();
+}
+/* -----------------30.07.99 11:28-------------------
+
+ --------------------------------------------------*/
+OUString SwXDocumentIndex::getName(void) throw( RuntimeException )
+{
+ SwSectionFmt* pSectionFmt = GetFmt();
+ OUString uRet;
+ if(bIsDescriptor)
+ {
+ uRet = OUString(pProps->GetTOXBase().GetTOXName());
+ }
+ else if(pSectionFmt)
+ {
+ uRet = OUString(pSectionFmt->GetSection()->GetName());
+ }
+ else
+ throw RuntimeException();
+ return uRet;
+}
+/* -----------------30.07.99 11:28-------------------
+
+ --------------------------------------------------*/
+void SwXDocumentIndex::setName(const OUString& rName) throw( RuntimeException )
+{
+ SwSectionFmt* pSectionFmt = GetFmt();
+ String sNewName(rName);
+ sal_Bool bExcept = sal_False;
+ if(!sNewName.Len())
+ bExcept = sal_True;
+ if(bIsDescriptor)
+ {
+ pProps->GetTOXBase().SetTOXName(sNewName);
+ }
+ else if(!pSectionFmt ||
+ !pSectionFmt->GetDoc()->SetTOXBaseName(
+ *(SwTOXBaseSection*)pSectionFmt->GetSection(), sNewName))
+ bExcept = sal_True;
+
+ if(bExcept)
+ throw RuntimeException();
+}
+
+/******************************************************************
+ * SwXDocumentIndexMark
+ ******************************************************************/
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXDocumentIndexMark::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXDocumentIndexMark::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+TYPEINIT1(SwXDocumentIndexMark, SwClient)
+const sal_Char cBaseMark[] = "com.sun.star.text.BaseIndexMark";
+const sal_Char cContentMark[] = "com.sun.star.text.ContentIndexMark";
+const sal_Char cIdxMark[] = "com.sun.star.text.DocumentIndexMark";
+const sal_Char cIdxMarkAsian[] = "com.sun.star.text.DocumentIndexMarkAsian";
+const sal_Char cUserMark[] = "com.sun.star.text.UserIndexMark";
+const sal_Char cTextContent[] = "com.sun.star.text.TextContent";
+/* -----------------------------06.04.00 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXDocumentIndexMark::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXDocumentIndexMark");
+}
+/* -----------------------------06.04.00 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXDocumentIndexMark::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return !rServiceName.compareToAscii(cBaseMark)||
+ !rServiceName.compareToAscii(cTextContent) ||
+ (eType == TOX_USER && !rServiceName.compareToAscii(cUserMark)) ||
+ (eType == TOX_CONTENT && !rServiceName.compareToAscii(cContentMark)) ||
+ (eType == TOX_INDEX && !rServiceName.compareToAscii(cIdxMark)) ||
+ (eType == TOX_INDEX && !rServiceName.compareToAscii(cIdxMarkAsian));
+}
+/* -----------------------------06.04.00 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXDocumentIndexMark::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ INT32 nCnt = (eType == TOX_INDEX) ? 4 : 3;
+ Sequence< OUString > aRet(nCnt);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U(cBaseMark);
+ pArray[1] = C2U(cTextContent);
+ switch(eType)
+ {
+ case TOX_USER:
+ pArray[2] = C2U(cUserMark);
+ break;
+ case TOX_CONTENT:
+ pArray[2] = C2U(cContentMark);
+ break;
+ case TOX_INDEX:
+ pArray[2] = C2U(cIdxMark);
+ pArray[3] = C2U(cIdxMarkAsian);
+ break;
+ }
+ return aRet;
+}
+/*-- 14.12.98 10:25:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexMark::SwXDocumentIndexMark(TOXTypes eToxType) :
+ aTypeDepend(this, 0),
+ m_pDoc(0),
+ aLstnrCntnr( (text::XTextContent*)this),
+ m_pTOXMark(0),
+ nLevel(0),
+ eType(eToxType),
+ bMainEntry(sal_False),
+ bIsDescriptor(sal_True)
+{
+ InitMap(eToxType);
+}
+/*-- 14.12.98 10:25:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexMark::SwXDocumentIndexMark(const SwTOXType* pType,
+ const SwTOXMark* pMark,
+ SwDoc* pDc) :
+ aTypeDepend(this, (SwTOXType*)pType),
+ aLstnrCntnr( (text::XTextContent*)this),
+ m_pDoc(pDc),
+ m_pTOXMark(pMark),
+ nLevel(0),
+ eType(pType->GetType()),
+ bIsDescriptor(sal_False),
+ bMainEntry(sal_False)
+{
+ m_pDoc->GetUnoCallBack()->Add(this);
+ InitMap(eType);
+}
+/*-- 14.12.98 10:25:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexMark::~SwXDocumentIndexMark()
+{
+
+}
+/* -----------------21.04.99 09:36-------------------
+ *
+ * --------------------------------------------------*/
+void SwXDocumentIndexMark::InitMap(TOXTypes eToxType)
+{
+ sal_uInt16 nMapId = PROPERTY_MAP_USER_MARK; //case TOX_USER:
+ switch( eToxType )
+ {
+ case TOX_INDEX:
+ nMapId = PROPERTY_MAP_INDEX_MARK ;
+ break;
+ case TOX_CONTENT:
+ nMapId = PROPERTY_MAP_CNTIDX_MARK;
+ break;
+ //case TOX_USER:
+ }
+ _pMap = aSwMapProvider.GetPropertyMap(nMapId);
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXDocumentIndexMark::getMarkEntry(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
+ OUString sRet;
+ if(pType)
+ {
+ SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark());
+ SwTOXMark aMark(*pCurMark);
+ sRet = OUString(aMark.GetAlternativeText());
+ }
+ else if(bIsDescriptor)
+ sRet = sAltText;
+ else
+ throw RuntimeException();
+ return sRet;
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
+ if(pType)
+ {
+ SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark());
+ SwTOXMark aMark(*pCurMark);
+ aMark.SetAlternativeText(rIndexEntry);
+ SwTxtTOXMark* pTxtMark = pCurMark->GetTxtTOXMark();
+ SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
+ aPam.SetMark();
+ if(pTxtMark->GetEnd())
+ {
+ aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ }
+ else
+ aPam.GetPoint()->nContent++;
+
+ //die alte Marke loeschen
+ m_pDoc->Delete(pCurMark);
+ m_pTOXMark = pCurMark = 0;
+
+ SwTxtAttr* pTxtAttr = 0;
+ sal_Bool bInsAtPos = aMark.IsAlternativeText();
+ const SwPosition *pStt = aPam.Start(),
+ *pEnd = aPam.End();
+ if( bInsAtPos )
+ {
+ SwPaM aTmp( *pStt );
+ m_pDoc->Insert( aTmp, aMark, 0 );
+ pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
+ pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK);
+ }
+ else if( *pEnd != *pStt )
+ {
+ m_pDoc->Insert( aPam, aMark, SETATTR_DONTEXPAND );
+ pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
+ pStt->nContent, RES_TXTATR_TOXMARK);
+ }
+ //und sonst - Marke geloescht?
+ if(pTxtAttr)
+ m_pTOXMark = &pTxtAttr->GetTOXMark();
+ }
+ else if(bIsDescriptor)
+ {
+ sAltText = rIndexEntry;
+ }
+ else
+ throw RuntimeException();
+}
+/* -----------------18.02.99 13:40-------------------
+ *
+ * --------------------------------------------------*/
+void SwXDocumentIndexMark::attachToRange(const Reference< text::XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!bIsDescriptor)
+ throw RuntimeException();
+
+ Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+
+ if(pDoc )
+ {
+ const SwTOXType* pTOXType = 0;
+ switch(eType)
+ {
+ case TOX_INDEX:
+ case TOX_CONTENT:
+ pTOXType = pDoc->GetTOXType( eType, 0 );
+ break;
+ case TOX_USER:
+ {
+ if(!sUserIndexName.Len())
+ pTOXType = pDoc->GetTOXType( eType, 0 );
+ else
+ {
+ sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType);
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SwTOXType* pTemp = pDoc->GetTOXType( eType, i );
+ if(sUserIndexName == pTemp->GetTypeName())
+ {
+ pTOXType = pTemp;
+ break;
+ }
+ }
+ if(!pTOXType)
+ {
+ SwTOXType aUserType(TOX_USER, sUserIndexName);
+ pTOXType = pDoc->InsertTOXType(aUserType);
+ }
+ }
+ }
+ break;
+ }
+ if(!pTOXType)
+ throw IllegalArgumentException();
+ pDoc->GetUnoCallBack()->Add(this);
+ ((SwTOXType*)pTOXType)->Add(&aTypeDepend);
+
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ SwTOXMark aMark (pTOXType);
+ if(sAltText.Len())
+ aMark.SetAlternativeText(sAltText);
+ switch(eType)
+ {
+ case TOX_INDEX:
+ if(sPrimaryKey.Len())
+ aMark.SetPrimaryKey(sPrimaryKey);
+ if(sSecondaryKey.Len())
+ aMark.SetSecondaryKey(sSecondaryKey);
+ if(sTextReading.Len())
+ aMark.SetTextReading(sTextReading);
+ if(sPrimaryKeyReading.Len())
+ aMark.SetPrimaryKeyReading(sPrimaryKeyReading);
+ if(sSecondaryKeyReading.Len())
+ aMark.SetSecondaryKeyReading(sSecondaryKeyReading);
+ aMark.SetMainEntry(bMainEntry);
+ break;
+ case TOX_USER:
+ case TOX_CONTENT:
+ if(USHRT_MAX != nLevel)
+ aMark.SetLevel(nLevel);
+ break;
+ }
+ UnoActionContext aAction(pDoc);
+ sal_Bool bMark = *aPam.GetPoint() != *aPam.GetMark();
+ // Marks ohne Alternativtext ohne selektierten Text koennen nicht eingefuegt werden,
+ // deshalb hier ein Leerzeichen - ob das die ideale Loesung ist?
+ if(!bMark && !aMark.GetAlternativeText().Len())
+ aMark.SetAlternativeText( String(' ') );
+ pDoc->Insert(aPam, aMark, SETATTR_DONTEXPAND);
+ if( bMark && *aPam.GetPoint() > *aPam.GetMark())
+ aPam.Exchange();
+
+ SwTxtAttr* pTxtAttr = 0;
+ if( bMark )
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ aPam.GetPoint()->nContent, RES_TXTATR_TOXMARK );
+ else
+ pTxtAttr = aPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ aPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
+
+ if(pTxtAttr)
+ {
+ m_pTOXMark = &pTxtAttr->GetTOXMark();
+ m_pDoc = pDoc;
+ bIsDescriptor = sal_False;
+ }
+ else
+ throw RuntimeException();
+ }
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::attach(const Reference< text::XTextRange > & xTextRange)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< text::XTextRange > SwXDocumentIndexMark::getAnchor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Reference< text::XTextRange > aRet;
+ SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
+ if(pType)
+ {
+ SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark());
+ if(pCurMark && pCurMark->GetTxtTOXMark())
+ {
+ SwTxtTOXMark* pTxtMark = pCurMark->GetTxtTOXMark();
+ SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
+ aPam.SetMark();
+ if(pTxtMark->GetEnd())
+ {
+ aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ }
+ else
+ aPam.GetPoint()->nContent++;
+ Reference< frame::XModel > xModel = m_pDoc->GetDocShell()->GetBaseModel();
+ Reference< text::XTextDocument > xTDoc(xModel, uno::UNO_QUERY);
+ aRet = new SwXTextRange(aPam, xTDoc->getText());
+ }
+ }
+ if(!aRet.is())
+ throw RuntimeException();
+ return aRet;
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::dispose(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
+ if(pType)
+ {
+ SwTOXMark* pTMark = lcl_GetMark(pType, GetTOXMark());
+ m_pDoc->Delete(pTMark);
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 14.12.98 10:25:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::addEventListener(const Reference< XEventListener > & aListener)
+ throw( RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::removeEventListener(const Reference< XEventListener > & aListener)
+ throw( RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw RuntimeException();
+}
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXDocumentIndexMark::getPropertySetInfo(void)
+ throw( RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfos[3];
+ int nPos = 0;
+ switch(eType)
+ {
+ case TOX_INDEX: nPos = 0; break;
+ case TOX_CONTENT: nPos = 1; break;
+ case TOX_USER: nPos = 2; break;
+ }
+ if(!xInfos[nPos].is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo(_pMap);
+ // extend PropertySetInfo!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ xInfos[nPos] = new SfxExtItemPropertySetInfo(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS),
+ aPropSeq );
+ }
+ return xInfos[nPos];
+}
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if(pType)
+ {
+ SwDoc* pLocalDoc = m_pDoc;
+ SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark());
+ if(pCurMark)
+ {
+ SwTOXMark aMark(*pCurMark);
+ switch(pMap->nWID)
+ {
+ case WID_ALT_TEXT:
+ aMark.SetAlternativeText(lcl_AnyToString(aValue));
+ break;
+ case WID_LEVEL:
+ aMark.SetLevel(Min( (sal_Int8) MAXLEVEL,
+ (sal_Int8)lcl_AnyToInt16(aValue)));
+ break;
+ case WID_PRIMARY_KEY :
+ aMark.SetPrimaryKey(lcl_AnyToString(aValue));
+ break;
+ case WID_SECONDARY_KEY:
+ aMark.SetSecondaryKey(lcl_AnyToString(aValue));
+ break;
+ case WID_MAIN_ENTRY:
+ aMark.SetMainEntry(lcl_AnyToBool(aValue));
+ break;
+ case WID_TEXT_READING:
+ aMark.SetTextReading(lcl_AnyToString(aValue));
+ break;
+ case WID_PRIMARY_KEY_READING:
+ aMark.SetPrimaryKeyReading(lcl_AnyToString(aValue));
+ break;
+ case WID_SECONDARY_KEY_READING:
+ aMark.SetSecondaryKeyReading(lcl_AnyToString(aValue));
+ break;
+ }
+
+ SwTxtTOXMark* pTxtMark = pCurMark->GetTxtTOXMark();
+ SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
+ aPam.SetMark();
+ if(pTxtMark->GetEnd())
+ {
+ aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
+ }
+ else
+ aPam.GetPoint()->nContent++;
+
+ //die alte Marke loeschen
+ pLocalDoc->Delete(pCurMark);
+ m_pTOXMark = pCurMark = 0;
+
+ sal_Bool bInsAtPos = aMark.IsAlternativeText();
+ const SwPosition *pStt = aPam.Start(),
+ *pEnd = aPam.End();
+
+ SwTxtAttr* pTxtAttr = 0;
+ if( bInsAtPos )
+ {
+ SwPaM aTmp( *pStt );
+ pLocalDoc->Insert( aTmp, aMark, 0 );
+ pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
+ pStt->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
+ }
+ else if( *pEnd != *pStt )
+ {
+ pLocalDoc->Insert( aPam, aMark, SETATTR_DONTEXPAND );
+ pTxtAttr = pStt->nNode.GetNode().GetTxtNode()->GetTxtAttr(
+ pStt->nContent, RES_TXTATR_TOXMARK );
+ }
+ m_pDoc = pLocalDoc;
+ //und sonst - Marke geloescht?
+
+ if(pTxtAttr)
+ {
+ m_pTOXMark = &pTxtAttr->GetTOXMark();
+ m_pDoc->GetUnoCallBack()->Add(this);
+ pType->Add(&aTypeDepend);
+ }
+ }
+ }
+ else if(bIsDescriptor)
+ {
+ switch(pMap->nWID)
+ {
+ case WID_ALT_TEXT:
+ sAltText = lcl_AnyToString(aValue);
+ break;
+ case WID_LEVEL:
+ {
+ sal_uInt16 nVal = lcl_AnyToInt16(aValue);
+ if(nVal >= 0 && nVal < MAXLEVEL)
+ nLevel = nVal;
+ else
+ throw IllegalArgumentException();
+ }
+ break;
+ case WID_PRIMARY_KEY :
+ sPrimaryKey = lcl_AnyToString(aValue);
+ break;
+ case WID_SECONDARY_KEY:
+ sSecondaryKey = lcl_AnyToString(aValue);
+ break;
+ case WID_TEXT_READING:
+ sTextReading = lcl_AnyToString(aValue);
+ break;
+ case WID_PRIMARY_KEY_READING:
+ sPrimaryKeyReading = lcl_AnyToString(aValue);
+ break;
+ case WID_SECONDARY_KEY_READING:
+ sSecondaryKeyReading = lcl_AnyToString(aValue);
+ break;
+ case WID_USER_IDX_NAME :
+ {
+ OUString sTmp(lcl_AnyToString(aValue));
+ lcl_ConvertTOUNameToUserName(sTmp);
+ sUserIndexName = sTmp;
+ }
+ break;
+ case WID_MAIN_ENTRY:
+ bMainEntry = lcl_AnyToBool(aValue);
+ break;
+ }
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXDocumentIndexMark::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwTOXType* pType = ((SwXDocumentIndexMark*)this)->GetTOXType();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if(SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName, pMap->nWID))
+ return aRet;
+ if(pType)
+ {
+ SwTOXMark* pCurMark = lcl_GetMark(pType, GetTOXMark());
+ if(pCurMark)
+ {
+ switch(pMap->nWID)
+ {
+ case WID_ALT_TEXT:
+ aRet <<= OUString(pCurMark->GetAlternativeText());
+ break;
+ case WID_LEVEL:
+ aRet <<= (sal_Int16)pCurMark->GetLevel();
+ break;
+ case WID_PRIMARY_KEY :
+ aRet <<= OUString(pCurMark->GetPrimaryKey());
+ break;
+ case WID_SECONDARY_KEY:
+ aRet <<= OUString(pCurMark->GetSecondaryKey());
+ break;
+ case WID_TEXT_READING:
+ aRet <<= OUString(pCurMark->GetTextReading());
+ break;
+ case WID_PRIMARY_KEY_READING:
+ aRet <<= OUString(pCurMark->GetPrimaryKeyReading());
+ break;
+ case WID_SECONDARY_KEY_READING:
+ aRet <<= OUString(pCurMark->GetSecondaryKeyReading());
+ break;
+ case WID_USER_IDX_NAME :
+ {
+ OUString sTmp(pType->GetTypeName());
+ lcl_ConvertTOUNameToProgrammaticName(sTmp);
+ aRet <<= sTmp;
+ }
+ break;
+ case WID_MAIN_ENTRY:
+ {
+ sal_Bool bTemp = pCurMark->IsMainEntry();
+ aRet.setValue(&bTemp, ::getBooleanCppuType());
+ }
+ break;
+ }
+ }
+ }
+ else if(bIsDescriptor)
+ {
+ switch(pMap->nWID)
+ {
+ case WID_ALT_TEXT:
+ aRet <<= OUString(sAltText);
+ break;
+ case WID_LEVEL:
+ aRet <<= (sal_Int16)nLevel;
+ break;
+ case WID_PRIMARY_KEY :
+ aRet <<= OUString(sPrimaryKey);
+ break;
+ case WID_SECONDARY_KEY:
+ aRet <<= OUString(sSecondaryKey);
+ break;
+ case WID_TEXT_READING:
+ aRet <<= OUString(sTextReading);
+ break;
+ case WID_PRIMARY_KEY_READING:
+ aRet <<= OUString(sPrimaryKeyReading);
+ break;
+ case WID_SECONDARY_KEY_READING:
+ aRet <<= OUString(sSecondaryKeyReading);
+ break;
+ case WID_USER_IDX_NAME :
+ aRet <<= OUString(sUserIndexName);
+ break;
+ case WID_MAIN_ENTRY:
+ {
+ aRet.setValue(&bMainEntry, ::getBooleanCppuType());
+ }
+ break;
+ }
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::addPropertyChangeListener(const OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 10:25:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::removePropertyChangeListener(const OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 10:25:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::addVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 10:25:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::removeVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 10:25:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexMark* SwXDocumentIndexMark::GetObject(SwTOXType* pType,
+ const SwTOXMark* pMark, SwDoc* pDoc)
+{
+ SwClientIter aIter(*pType);
+ SwXDocumentIndexMark* pxMark = (SwXDocumentIndexMark*)
+ aIter.First(TYPE(SwXDocumentIndexMark));
+ while( pxMark )
+ {
+ if(pxMark->GetTOXMark() == pMark)
+ return pxMark;
+ pxMark = (SwXDocumentIndexMark*)aIter.Next();
+ }
+ return new SwXDocumentIndexMark(pType, pMark, pDoc);
+}
+/*-- 14.12.98 10:25:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDocumentIndexMark::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ Invalidate();
+ break;
+ case RES_TOXMARK_DELETED:
+ if( (void*)m_pTOXMark == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+ }
+}
+/* -----------------------------16.10.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXDocumentIndexMark::Invalidate()
+{
+ if(GetRegisteredIn())
+ {
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ if(aTypeDepend.GetRegisteredIn())
+ ((SwModify*)aTypeDepend.GetRegisteredIn())->Remove(&aTypeDepend);
+ aLstnrCntnr.Disposing();
+ m_pTOXMark = 0;
+ m_pDoc = 0;
+ }
+}
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXDocumentIndexes::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXDocumentIndexes");
+}
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXDocumentIndexes::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.DocumentIndexes") == rServiceName;
+}
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXDocumentIndexes::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.DocumentIndexes");
+ return aRet;
+}
+/*-- 05.05.99 13:14:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexes::SwXDocumentIndexes(SwDoc* pDoc) :
+ SwUnoCollection(pDoc)
+{
+}
+/*-- 05.05.99 13:15:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDocumentIndexes::~SwXDocumentIndexes()
+{
+}
+/*-- 05.05.99 13:15:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXDocumentIndexes::getCount(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw RuntimeException();
+
+ sal_uInt32 nRet = 0;
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() )
+ ++nRet;
+ }
+ return nRet;
+}
+/*-- 05.05.99 13:15:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXDocumentIndexes::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw RuntimeException();
+
+ uno::Any aRet;
+ sal_uInt32 nIdx = 0;
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0, nCnt = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() &&
+ nIdx++ == nIndex )
+ {
+ Reference< text::XDocumentIndex > xTmp = new SwXDocumentIndex(
+ (SwTOXBaseSection*)pSect, GetDoc() );
+ aRet.setValue(&xTmp, ::getCppuType((Reference<text::XDocumentIndex>*)0));
+ return aRet;
+ }
+ }
+
+ throw IndexOutOfBoundsException();
+ return aRet;
+}
+
+/*-- 31.01.00 10:12:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXDocumentIndexes::getByName(const OUString& rName)
+ throw( container::NoSuchElementException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw RuntimeException();
+
+ uno::Any aRet;
+ sal_uInt32 nIdx = 0;
+
+ String sToFind(rName);
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0, nCnt = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() &&
+ ((SwTOXBaseSection*)pSect)->GetTOXName() == sToFind)
+ {
+ Reference< text::XDocumentIndex > xTmp = new SwXDocumentIndex(
+ (SwTOXBaseSection*)pSect, GetDoc() );
+ aRet.setValue(&xTmp, ::getCppuType((Reference<text::XDocumentIndex>*)0));
+ return aRet;
+ }
+ }
+ throw container::NoSuchElementException();
+ return aRet;
+}
+/*-- 31.01.00 10:12:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXDocumentIndexes::getElementNames(void)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw RuntimeException();
+
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ sal_Int32 nCount = 0;
+ sal_uInt16 n;
+ for( n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode() )
+ ++nCount;
+ }
+
+ uno::Sequence< OUString > aRet(nCount);
+ OUString* pArray = aRet.getArray();
+ sal_uInt16 nCnt;
+ for( n = 0, nCnt = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode())
+ {
+ pArray[nCnt++] = OUString(((SwTOXBaseSection*)pSect)->GetTOXName());
+ }
+ }
+ return aRet;
+}
+/*-- 31.01.00 10:12:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXDocumentIndexes::hasByName(const OUString& rName)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw RuntimeException();
+
+ String sToFind(rName);
+ const SwSectionFmts& rFmts = GetDoc()->GetSections();
+ for( sal_uInt16 n = 0, nCnt = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSection* pSect = rFmts[ n ]->GetSection();
+ if( TOX_CONTENT_SECTION == pSect->GetType() &&
+ pSect->GetFmt()->GetSectionNode())
+ {
+ if(((SwTOXBaseSection*)pSect)->GetTOXName() == sToFind)
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+/*-- 05.05.99 13:15:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXDocumentIndexes::getElementType(void) throw( RuntimeException )
+{
+ return ::getCppuType((Reference< text::XDocumentIndex> *)0);
+}
+/*-- 05.05.99 13:15:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXDocumentIndexes::hasElements(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw RuntimeException();
+ return 0 != getCount();
+}
+
+SwXDocumentIndex* SwXDocumentIndexes::GetObject(const SwTOXBaseSection* pTOX)
+{
+ SwSectionFmt* pFmt = pTOX->GetFmt();
+ SwClientIter aIter(*pFmt);
+ SwXDocumentIndex* pxIdx = (SwXDocumentIndex*)aIter.First(TYPE(SwXDocumentIndex));
+ if(pxIdx)
+ return pxIdx;
+ else
+ return new SwXDocumentIndex(pTOX, pFmt->GetDoc());
+}
+
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXIndexStyleAccess_Impl::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXIndexStyleAccess_Impl");
+}
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXIndexStyleAccess_Impl::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.DocumentIndexParagraphStyles") == rServiceName;
+}
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXIndexStyleAccess_Impl::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.DocumentIndexParagraphStyles");
+ return aRet;
+}
+/*-- 13.09.99 16:52:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXIndexStyleAccess_Impl::SwXIndexStyleAccess_Impl(SwXDocumentIndex& rParentIdx) :
+ rParent(rParentIdx),
+ xParent(&rParentIdx)
+{
+ SolarMutexGuard aGuard;
+ rParent.SetStyleAccess(this);
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXIndexStyleAccess_Impl::~SwXIndexStyleAccess_Impl()
+{
+ SolarMutexGuard aGuard;
+ rParent.SetStyleAccess(0);
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXIndexStyleAccess_Impl::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
+ throw( IllegalArgumentException, IndexOutOfBoundsException,
+ WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ const sal_Bool bDescriptor = rParent.IsDescriptor();
+ SwSectionFmt* pSectFmt = rParent.GetFmt();
+ if(!pSectFmt && !bDescriptor)
+ throw RuntimeException();
+ if(nIndex < 0 || nIndex > MAXLEVEL)
+ throw IndexOutOfBoundsException();
+ SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
+ (SwTOXBaseSection*)pSectFmt->GetSection();
+
+ uno::Sequence<OUString> aSeq;
+ if(!(rElement >>= aSeq))
+ throw IllegalArgumentException();
+
+ sal_uInt16 nStyles = aSeq.getLength();
+ const OUString* pStyles = aSeq.getConstArray();
+ String sSetStyles;
+ String aString;
+ for(sal_uInt16 i = 0; i < nStyles; i++)
+ {
+ if(i)
+ sSetStyles += TOX_STYLE_DELIMITER;
+ SwStyleNameMapper::FillUIName(pStyles[i], aString, GET_POOLID_TXTCOLL, sal_True);
+ sSetStyles += aString;
+ }
+ pTOXBase->SetStyleNames(sSetStyles, (sal_uInt16) nIndex);
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXIndexStyleAccess_Impl::getCount(void) throw( RuntimeException )
+{
+ return MAXLEVEL;
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXIndexStyleAccess_Impl::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException,
+ RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ const sal_Bool bDescriptor = rParent.IsDescriptor();
+ SwSectionFmt* pSectFmt = rParent.GetFmt();
+ if(!pSectFmt && !bDescriptor)
+ throw RuntimeException();
+ if(nIndex < 0 || nIndex > MAXLEVEL)
+ throw IndexOutOfBoundsException();
+ SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
+ (SwTOXBaseSection*)pSectFmt->GetSection();
+
+ const String& rStyles = pTOXBase->GetStyleNames((sal_uInt16) nIndex);
+ sal_uInt16 nStyles = rStyles.GetTokenCount(TOX_STYLE_DELIMITER);
+ uno::Sequence<OUString> aStyles(nStyles);
+ OUString* pStyles = aStyles.getArray();
+ String aString;
+ for(sal_uInt16 i = 0; i < nStyles; i++)
+ {
+ SwStyleNameMapper::FillProgName(
+ rStyles.GetToken(i, TOX_STYLE_DELIMITER),
+ aString,
+ GET_POOLID_TXTCOLL,
+ sal_True);
+ pStyles[i] = OUString( aString );
+ }
+ uno::Any aRet(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
+ return aRet;
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXIndexStyleAccess_Impl::getElementType(void)
+ throw( RuntimeException )
+{
+ return ::getCppuType((uno::Sequence<OUString>*)0);
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXIndexStyleAccess_Impl::hasElements(void) throw( RuntimeException )
+{
+ return sal_True;
+}
+
+/* -----------------13.09.99 16:51-------------------
+
+ --------------------------------------------------*/
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXIndexTokenAccess_Impl::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXIndexTokenAccess_Impl");
+}
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXIndexTokenAccess_Impl::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.DocumentIndexLevelFormat") == rServiceName;
+}
+/* -----------------------------06.04.00 15:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXIndexTokenAccess_Impl::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.DocumentIndexLevelFormat");
+ return aRet;
+}
+/*-- 13.09.99 16:52:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXIndexTokenAccess_Impl::SwXIndexTokenAccess_Impl(SwXDocumentIndex& rParentIdx) :
+ rParent(rParentIdx),
+ xParent(&rParentIdx),
+ nCount(SwForm::GetFormMaxLevel(rParent.GetTOXType()))
+{
+ SolarMutexGuard aGuard;
+ rParent.SetTokenAccess(this);
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXIndexTokenAccess_Impl::~SwXIndexTokenAccess_Impl()
+{
+ SolarMutexGuard aGuard;
+ rParent.SetTokenAccess(0);
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXIndexTokenAccess_Impl::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
+ throw( IllegalArgumentException, IndexOutOfBoundsException,
+ WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ const sal_Bool bDescriptor = rParent.IsDescriptor();
+ SwSectionFmt* pSectFmt = rParent.GetFmt();
+ if(!pSectFmt && !bDescriptor)
+ throw RuntimeException();
+
+ SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
+ (SwTOXBaseSection*)pSectFmt->GetSection();
+ if(nIndex < 0 ||
+ (nIndex > pTOXBase->GetTOXForm().GetFormMax()))
+ throw IndexOutOfBoundsException();
+
+ uno::Sequence<PropertyValues> aSeq;
+ if(!(rElement >>= aSeq))
+ throw IllegalArgumentException();
+
+ String sPattern;
+ sal_uInt16 nTokens = aSeq.getLength();
+ const PropertyValues* pTokens = aSeq.getConstArray();
+ for(sal_uInt16 i = 0; i < nTokens; i++)
+ {
+ const PropertyValue* pProperties = pTokens[i].getConstArray();
+ sal_uInt16 nProperties = pTokens[i].getLength();
+ //create an invalid token
+ SwFormToken aToken(TOKEN_END);
+ for(sal_uInt16 j = 0; j < nProperties; j++)
+ {
+ if( COMPARE_EQUAL == pProperties[j].Name.compareToAscii("TokenType"))
+ {
+ const String sTokenType =
+ lcl_AnyToString(pProperties[j].Value);
+ if(sTokenType.EqualsAscii("TokenEntryNumber"))
+ aToken.eTokenType = TOKEN_ENTRY_NO;
+ else if(sTokenType.EqualsAscii("TokenEntryText" ))
+ aToken.eTokenType = TOKEN_ENTRY_TEXT;
+ else if(sTokenType.EqualsAscii("TokenTabStop" ))
+ aToken.eTokenType = TOKEN_TAB_STOP;
+ else if(sTokenType.EqualsAscii("TokenText" ))
+ aToken.eTokenType = TOKEN_TEXT;
+ else if(sTokenType.EqualsAscii("TokenPageNumber"))
+ aToken.eTokenType = TOKEN_PAGE_NUMS;
+ else if(sTokenType.EqualsAscii("TokenChapterInfo" ))
+ aToken.eTokenType = TOKEN_CHAPTER_INFO;
+ else if(sTokenType.EqualsAscii("TokenHyperlinkStart" ))
+ aToken.eTokenType = TOKEN_LINK_START;
+ else if(sTokenType.EqualsAscii("TokenHyperlinkEnd"))
+ aToken.eTokenType = TOKEN_LINK_END;
+ else if(sTokenType.EqualsAscii("TokenBibliographyDataField" ))
+ aToken.eTokenType = TOKEN_AUTHORITY;
+ }
+ else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("CharacterStyleName" ) ))
+ {
+ String sCharStyleName;
+ SwStyleNameMapper::FillUIName(
+ lcl_AnyToString(pProperties[j].Value),
+ sCharStyleName,
+ GET_POOLID_CHRFMT,
+ sal_True);
+ aToken.sCharStyleName = sCharStyleName;
+ aToken.nPoolId = SwStyleNameMapper::GetPoolIdFromUIName (
+ sCharStyleName, GET_POOLID_CHRFMT );
+ }
+ else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabStopRightAligned") ))
+ {
+ sal_Bool bRight = lcl_AnyToBool(pProperties[j].Value);
+ aToken.eTabAlign = bRight ?
+ SVX_TAB_ADJUST_END : SVX_TAB_ADJUST_LEFT;
+ }
+ else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabStopPosition" )))
+ {
+ sal_Int32 nPosition;
+ if(pProperties[j].Value.getValueType() != ::getCppuType((sal_Int32*)0))
+ throw IllegalArgumentException();
+ pProperties[j].Value >>= nPosition;
+ nPosition = MM100_TO_TWIP(nPosition);
+ if(nPosition < 0)
+ throw IllegalArgumentException();
+ aToken.nTabStopPosition = nPosition;
+ }
+ else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("TabStopFillCharacter" )))
+ {
+ const String sFillChar =
+ lcl_AnyToString(pProperties[j].Value);
+ if(sFillChar.Len() > 1)
+ throw IllegalArgumentException();
+ aToken.cTabFillChar = sFillChar.Len() ?
+ sFillChar.GetChar(0) : ' ';
+ }
+ else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Text" )))
+ {
+ const String sText =
+ lcl_AnyToString(pProperties[j].Value);
+ aToken.sText = sText;
+ }
+ else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ChapterFormat" )))
+ {
+ sal_Int16 nFormat = lcl_AnyToInt16(pProperties[j].Value);
+ switch(nFormat)
+ {
+ case text::ChapterFormat::NUMBER: nFormat = CF_NUMBER;
+ break;
+ case text::ChapterFormat::NAME: nFormat = CF_TITLE;
+ break;
+ case text::ChapterFormat::NAME_NUMBER: nFormat = CF_NUM_TITLE;
+ break;
+ case text::ChapterFormat::NO_PREFIX_SUFFIX:nFormat = CF_NUMBER_NOPREPST;
+ break;
+ case text::ChapterFormat::DIGIT: nFormat = CF_NUM_NOPREPST_TITLE;
+ break;
+ default:
+ throw IllegalArgumentException();
+ }
+ aToken.nChapterFormat = nFormat;
+ }
+ else if( pProperties[j].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BibliographyDataField")))
+ {
+ sal_Int16 nType; pProperties[j].Value >>= nType;
+ if(nType < 0 || nType > BibliographyDataField::ISBN)
+ {
+ IllegalArgumentException aExcept;
+ aExcept.Message = C2U("BibliographyDataField - wrong value");
+ aExcept.ArgumentPosition = j;
+ throw aExcept;
+ }
+ aToken.nAuthorityField = nType;
+ }
+
+ }
+ //exception if wrong TokenType
+ if(TOKEN_END <= aToken.eTokenType )
+ throw IllegalArgumentException();
+ // set TokenType from TOKEN_ENTRY_TEXT to TOKEN_ENTRY if it is
+ // not a content index
+ if(TOKEN_ENTRY_TEXT == aToken.eTokenType &&
+ TOX_CONTENT != pTOXBase->GetType())
+ aToken.eTokenType = TOKEN_ENTRY;
+ sPattern += aToken.GetString();
+ }
+ SwForm aForm(pTOXBase->GetTOXForm());
+ aForm.SetPattern((sal_uInt16) nIndex, sPattern);
+ pTOXBase->SetTOXForm(aForm);
+}
+/*-- 13.09.99 16:52:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXIndexTokenAccess_Impl::getCount(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ const sal_Bool bDescriptor = rParent.IsDescriptor();
+ SwSectionFmt* pSectFmt = rParent.GetFmt();
+ if(!pSectFmt && !bDescriptor)
+ throw RuntimeException();
+ sal_Int32 nRet = bDescriptor ?
+ nCount :
+ ((SwTOXBaseSection*)pSectFmt->GetSection())->
+ GetTOXForm().GetFormMax();
+ return nRet;
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXIndexTokenAccess_Impl::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException,
+ RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ const sal_Bool bDescriptor = rParent.IsDescriptor();
+ SwSectionFmt* pSectFmt = rParent.GetFmt();
+ if(!pSectFmt && !bDescriptor)
+ throw RuntimeException();
+ SwTOXBase* pTOXBase = bDescriptor ? &rParent.GetProperties_Impl()->GetTOXBase() :
+ (SwTOXBaseSection*)pSectFmt->GetSection();
+ if(nIndex < 0 ||
+ (nIndex > pTOXBase->GetTOXForm().GetFormMax()))
+ throw IndexOutOfBoundsException();
+
+ SwFormTokenEnumerator aEnumerator(pTOXBase->GetTOXForm().
+ GetPattern((sal_uInt16) nIndex));
+ sal_uInt16 nTokenCount = 0;
+ uno::Sequence< PropertyValues > aRetSeq;
+ String aString;
+ while(aEnumerator.HasNextToken())
+ {
+ nTokenCount++;
+ aRetSeq.realloc(nTokenCount);
+ PropertyValues* pTokenProps = aRetSeq.getArray();
+ SwFormToken aToken = aEnumerator.GetNextToken();
+
+ Sequence< PropertyValue >& rCurTokenSeq = pTokenProps[nTokenCount-1];
+ SwStyleNameMapper::FillProgName(
+ aToken.sCharStyleName,
+ aString,
+ GET_POOLID_CHRFMT,
+ sal_True );
+ const OUString aProgCharStyle( aString );
+ switch(aToken.eTokenType)
+ {
+ case TOKEN_ENTRY_NO :
+ {
+ rCurTokenSeq.realloc( 2 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenEntryNumber");
+// pArr[0].Value <<= C2U("TokenEntryNumber");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+ }
+ break;
+ case TOKEN_ENTRY : // no difference between Entry and Entry Text
+ case TOKEN_ENTRY_TEXT :
+ {
+ rCurTokenSeq.realloc( 2 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenEntryText");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+ }
+ break;
+ case TOKEN_TAB_STOP :
+ {
+ rCurTokenSeq.realloc(4);
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenTabStop");
+
+
+ if(SVX_TAB_ADJUST_END == aToken.eTabAlign)
+ {
+ pArr[1].Name = C2U("TabStopRightAligned");
+ BOOL bTemp = sal_True;
+ pArr[1].Value.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ else
+ {
+ pArr[1].Name = C2U("TabStopPosition");
+ sal_Int32 nPos = (TWIP_TO_MM100(aToken.nTabStopPosition));
+ if(nPos < 0)
+ nPos = 0;
+ pArr[1].Value <<= (sal_Int32)nPos;
+ }
+ pArr[2].Name = C2U("TabStopFillCharacter");
+ pArr[2].Value <<= OUString(aToken.cTabFillChar);
+ pArr[3].Name = C2U("CharacterStyleName");
+ pArr[3].Value <<= aProgCharStyle;
+ }
+ break;
+ case TOKEN_TEXT :
+ {
+ rCurTokenSeq.realloc( 3 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenText");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+
+ pArr[2].Name = C2U("Text");
+ pArr[2].Value <<= OUString(aToken.sText);
+ }
+ break;
+ case TOKEN_PAGE_NUMS :
+ {
+ rCurTokenSeq.realloc( 2 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenPageNumber");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+ }
+ break;
+ case TOKEN_CHAPTER_INFO :
+ {
+ rCurTokenSeq.realloc( 3 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenChapterInfo");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+
+ pArr[2].Name = C2U("ChapterFormat");
+ sal_Int16 nVal = text::ChapterFormat::NUMBER;
+ switch(aToken.nChapterFormat)
+ {
+ case CF_NUMBER: nVal = text::ChapterFormat::NUMBER; break;
+ case CF_TITLE: nVal = text::ChapterFormat::NAME; break;
+ case CF_NUM_TITLE: nVal = text::ChapterFormat::NAME_NUMBER; break;
+ case CF_NUMBER_NOPREPST: nVal = text::ChapterFormat::NO_PREFIX_SUFFIX; break;
+ case CF_NUM_NOPREPST_TITLE: nVal = text::ChapterFormat::DIGIT; break;
+ }
+ pArr[2].Value <<= (sal_Int16)nVal;
+ }
+ break;
+ case TOKEN_LINK_START :
+ {
+ rCurTokenSeq.realloc( 1 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenHyperlinkStart");
+ }
+ break;
+ case TOKEN_LINK_END :
+ {
+ rCurTokenSeq.realloc( 1 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenHyperlinkEnd");
+ }
+ break;
+ case TOKEN_AUTHORITY :
+ rCurTokenSeq.realloc( 3 );
+ PropertyValue* pArr = rCurTokenSeq.getArray();
+
+ pArr[0].Name = C2U("TokenType");
+ pArr[0].Value <<= OUString::createFromAscii("TokenBibliographyDataField");
+
+ pArr[1].Name = C2U("CharacterStyleName");
+ pArr[1].Value <<= aProgCharStyle;
+
+ pArr[2].Name = C2U("BibliographyDataField");
+ pArr[2].Value <<= sal_Int16(aToken.nAuthorityField);
+ break;
+ }
+ }
+
+ uno::Any aRet(&aRetSeq, ::getCppuType((uno::Sequence< PropertyValues >*)0));
+
+ return aRet;
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXIndexTokenAccess_Impl::getElementType(void)
+ throw( RuntimeException )
+{
+ return ::getCppuType((uno::Sequence< PropertyValues >*)0);
+}
+/*-- 13.09.99 16:52:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXIndexTokenAccess_Impl::hasElements(void) throw( RuntimeException )
+{
+ return sal_True;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unomap.cxx b/binfilter/bf_sw/source/core/unocore/sw_unomap.cxx
new file mode 100644
index 000000000000..0d0fd718d84b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unomap.cxx
@@ -0,0 +1,2339 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <bf_svx/svxids.hrc>
+#include <comphelper/TypeGeneration.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unomid.h>
+#include <cmdid.h>
+#include <unofldmid.h>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::rtl;
+using namespace ::comphelper;
+
+#define SW_PROP_NMID(id) ((const char*)id), 0
+
+#ifndef MID_TXT_LMARGIN
+#define MID_TXT_LMARGIN 11
+#endif
+
+/******************************************************************************
+ UI-Maps
+******************************************************************************/
+
+SwUnoPropertyMapProvider aSwMapProvider;
+
+/* -----------------24.06.98 18:12-------------------
+ *
+ * --------------------------------------------------*/
+SwUnoPropertyMapProvider::SwUnoPropertyMapProvider()
+{
+ for( sal_uInt16 i = 0; i < PROPERTY_MAP_END; i++ )
+ {
+ aMapArr[i] = 0;
+ }
+}
+/* -----------------19.02.99 08:31-------------------
+ *
+ * --------------------------------------------------*/
+SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
+{
+ delete pCharStyleMap;
+ delete pParaStyleMap;
+ delete pFrameStyleMap;
+ delete pPageStyleMap;
+ delete pNumStyleMap;
+}
+/* -----------------19.02.99 08:31-------------------
+ *
+ * --------------------------------------------------*/
+SfxItemPropertySet& SwUnoPropertyMapProvider::GetPropertySet(sal_Int8 nPropSetId)
+{
+ SfxItemPropertySet** ppMap = 0;
+ sal_uInt16 nPropertyId;
+ switch(nPropSetId)
+ {
+ case PROPERTY_SET_CHAR_STYLE:
+ ppMap = &pCharStyleMap;
+ nPropertyId = PROPERTY_MAP_CHAR_STYLE;
+ break;
+ case PROPERTY_SET_PARA_STYLE:
+ ppMap = &pParaStyleMap;
+ nPropertyId = PROPERTY_MAP_PARA_STYLE;
+ break;
+ case PROPERTY_SET_FRAME_STYLE:
+ ppMap = &pFrameStyleMap;
+ nPropertyId = PROPERTY_MAP_FRAME_STYLE;
+ break;
+ case PROPERTY_SET_PAGE_STYLE:
+ ppMap = &pPageStyleMap;
+ nPropertyId = PROPERTY_MAP_PAGE_STYLE;
+ break;
+ case PROPERTY_SET_NUM_STYLE:
+ ppMap = &pNumStyleMap;
+ nPropertyId = PROPERTY_MAP_NUM_STYLE;
+ break;
+ }
+
+ SfxItemPropertySet* pRet;
+ if( ppMap )
+ {
+ if( !*ppMap )
+ *ppMap = new SwItemPropertySet( GetPropertyMap( nPropertyId ));
+ pRet = *ppMap;
+ }
+ else
+ pRet = 0;
+ return *pRet;
+}
+/* -----------------25.06.98 07:19-------------------
+ *
+ * --------------------------------------------------*/
+EXTERN_C
+#ifdef WNT
+int _cdecl
+#else
+int
+#endif
+lcl_CompareMap(const void* pSmaller, const void* pBigger )
+{
+ int nDiff = strcmp( ((const SfxItemPropertyMap*)pSmaller)->pName,
+ ((const SfxItemPropertyMap*)pBigger)->pName );
+ return nDiff;
+
+}
+/* -----------------24.06.98 18:12-------------------
+ *
+ * --------------------------------------------------*/
+void SwUnoPropertyMapProvider::Sort( sal_uInt16 nId )
+{
+ SfxItemPropertyMap* p = aMapArr[nId];
+ sal_uInt16 i = 0;
+ for( ; p->pName; ++p, ++i )
+ {
+ // set the name
+ const SwPropNameLen& rPropNm = GetPropName( (USHORT)(long)p->pName );
+ p->pName = rPropNm.pName;
+ p->nNameLen = rPropNm.nNameLen;
+ // get the cppu type from the comphelper
+ comphelper::CppuTypes nTyp = static_cast< comphelper::CppuTypes >(
+ (long) p->pType);
+ GenerateCppuType( nTyp, p->pType );
+ DBG_ASSERT( nTyp != (sal_uInt16) (long) p->pType, "unknown type" );
+ }
+ qsort( aMapArr[nId], i, sizeof(SfxItemPropertyMap), lcl_CompareMap );
+}
+
+
+#define _STANDARD_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT), RES_CHRATR_WEIGHT , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_WEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_POSTURE), RES_CHRATR_POSTURE , CPPU_E2T(CPPUTYPE_FONTSLANT), PropertyAttribute::MAYBEVOID, MID_POSTURE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE), RES_CHRATR_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE) , PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+
+#define _CJK_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT_ASIAN), RES_CHRATR_CJK_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT_ASIAN), RES_CHRATR_CJK_WEIGHT , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_WEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_POSTURE_ASIAN), RES_CHRATR_CJK_POSTURE , CPPU_E2T(CPPUTYPE_FONTSLANT), PropertyAttribute::MAYBEVOID, MID_POSTURE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE_ASIAN), RES_CHRATR_CJK_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE) , PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+
+#define _CTL_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT_COMPLEX), RES_CHRATR_CTL_WEIGHT , CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::MAYBEVOID, MID_WEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_POSTURE_COMPLEX), RES_CHRATR_CTL_POSTURE , CPPU_E2T(CPPUTYPE_FONTSLANT), PropertyAttribute::MAYBEVOID, MID_POSTURE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE_COMPLEX), RES_CHRATR_CTL_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE) , PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+
+#define _REDLINE_NODE_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_START_REDLINE), FN_UNO_REDLINE_NODE_START , CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0xff }, \
+ { SW_PROP_NMID(UNO_NAME_END_REDLINE), FN_UNO_REDLINE_NODE_END , CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0xff },
+
+#define _REDLINE_PROPERTIES \
+ {SW_PROP_NMID(UNO_NAME_REDLINE_AUTHOR), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_DATE_TIME), 0, CPPU_E2T(CPPUTYPE_DATETIME), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_COMMENT), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_TYPE), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_SUCCESSOR_DATA), 0, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_IDENTIFIER), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_IS_IN_HEADER_FOOTER), 0, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_REDLINE_TEXT), 0, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+ {SW_PROP_NMID(UNO_NAME_MERGE_LAST_PARA), 0, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+
+/* -----------------24.06.98 18:12-------------------
+ *
+ * --------------------------------------------------*/
+#define COMMON_CRSR_PARA_PROPERTIES_FN_ONLY \
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLE_NAME), FN_UNO_PARA_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_NAME), FN_UNO_PAGE_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_IS_NUMBER), FN_UNO_IS_NUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_LEVEL), FN_UNO_NUM_LEVEL, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), FN_UNO_NUM_RULES, CPPU_E2T(CPPUTYPE_REFIDXREPL), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_START_VALUE), FN_UNO_NUM_START_VALUE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX), FN_UNO_DOCUMENT_INDEX, CPPU_E2T(CPPUTYPE_REFDOCINDEX), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_TABLE), FN_UNO_TEXT_TABLE, CPPU_E2T(CPPUTYPE_REFTXTTABLE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_CELL), FN_UNO_CELL, CPPU_E2T(CPPUTYPE_REFCELL), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_FRAME), FN_UNO_TEXT_FRAME, CPPU_E2T(CPPUTYPE_REFTEXTFRAME), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_CHAPTER_NUMBERING_LEVEL), FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL,CPPU_E2T(CPPUTYPE_INT8), PropertyAttribute::READONLY, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_CONDITIONAL_STYLE_NAME), FN_UNO_PARA_CONDITIONAL_STYLE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_NUMBERING_RESTART), FN_NUMBER_NEWSTART, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 },
+
+#define COMMON_HYPERLINK_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_U_R_L), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_URL}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_TARGET), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_TARGET}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_NAME), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_HYPERLINKNAME }, \
+ { SW_PROP_NMID(UNO_NAME_UNVISITED_CHAR_STYLE_NAME), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_UNVISITED_FMT }, \
+ { SW_PROP_NMID(UNO_NAME_VISITED_CHAR_STYLE_NAME), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_URL_VISITED_FMT },
+
+#define COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HYPHENATION), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_IS_HYPHEN }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_LEAD }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_TRAIL }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS}, \
+ { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_CROSSED_OUT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_ESC }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PropertyAttribute::MAYBEVOID, MID_ESC_HEIGHT}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_AUTO_ESC }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_UNDERLINE}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UL_COLOR}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_UL_HASCOLOR}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_URL }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_FILTER }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_POSITION}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_FIRST_AUTO}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT|CONVERT_TWIPS}, \
+ _STANDARD_FONT_PROPERTIES \
+ _CJK_FONT_PROPERTIES \
+ _CTL_FONT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_FORMAT), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_DROPCAPFMT) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_FORMAT|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_WHOLE_WORD), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_WHOLE_WORD }, \
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_CHAR_STYLE_NAME), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_OUSTRING) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_CHAR_STYLE_NAME }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_SPLIT), RES_PARATR_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_WIDOWS), RES_PARATR_WIDOWS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_ORPHANS), RES_PARATR_ORPHANS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_DESC_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGEDESCNAME }, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGENUMOFFSET}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_EXPAND_SINGLE_WORD), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_EXPAND_SINGLE }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LAST_LINE_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_LAST_LINE_ADJUST}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_COUNT), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_COUNT }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_START_VALUE), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_STARTVALUE}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER,CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UP_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT }, \
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_STYLE_NAME), RES_PARATR_NUMRULE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, LEFT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, RIGHT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, TOP_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), PropertyAttribute::MAYBEVOID, BOTTOM_BORDER|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_USER_DEFINED_ATTRIBUTES), RES_TXTATR_UNKNOWN_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_TWOLINES}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_START_BRACKET}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_END_BRACKET}, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_EMPHASIS},\
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HANGING_PUNCTUATION), RES_PARATR_HANGINGPUNCTUATION, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CHARACTER_DISTANCE), RES_PARATR_SCRIPTSPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_FORBIDDEN_RULES), RES_PARATR_FORBIDDEN_RULES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_VERT_ALIGNMENT), RES_PARATR_VERTALIGN,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_ROTATE }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_FITTOLINE }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_TEXT), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_RUBY_TEXT }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_ADJUST), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RUBY_ADJUST }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_CHAR_STYLE_NAME), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_RUBY_CHARSTYLE }, \
+ { SW_PROP_NMID(UNO_NAME_RUBY_IS_ABOVE), RES_TXTATR_CJK_RUBY, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_RUBY_ABOVE }, \
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RELIEF }, \
+ { SW_PROP_NMID(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CONNECT_BORDER), RES_PARATR_CONNECT_BORDER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0}, \
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },\
+
+
+#define TABSTOPS_MAP_ENTRY { SW_PROP_NMID(UNO_NAME_TABSTOPS), RES_PARATR_TABSTOP, CPPU_E2T(CPPUTYPE_SEQTABSTOP), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},
+
+#define COMMON_CRSR_PARA_PROPERTIES \
+ COMMON_CRSR_PARA_PROPERTIES_FN_ONLY \
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN \
+ COMMON_HYPERLINK_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAMES), FN_UNO_CHARFMT_SEQUENCE, CPPU_E2T(CPPUTYPE_OUSTRINGS), PropertyAttribute::MAYBEVOID, 0},
+
+
+#define COMMON_CRSR_PARA_PROPERTIES_2 \
+ COMMON_CRSR_PARA_PROPERTIES_FN_ONLY \
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN
+
+#define COMPLETE_TEXT_CURSOR_MAP\
+ COMMON_CRSR_PARA_PROPERTIES\
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARK), FN_UNO_DOCUMENT_INDEX_MARK, CPPU_E2T(CPPUTYPE_REFDOCIDXMRK), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_TEXT_FIELD), FN_UNO_TEXT_FIELD, CPPU_E2T(CPPUTYPE_REFTXTFIELD), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_REFERENCE_MARK), FN_UNO_REFERENCE_MARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID ,0 },\
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE), FN_UNO_FOOTNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE), FN_UNO_ENDNOTE, CPPU_E2T(CPPUTYPE_REFFOOTNOTE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },\
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_EVENTS), RES_TXTATR_INETFMT, CPPU_E2T(CPPUTYPE_REFNMREPLACE), PropertyAttribute::MAYBEVOID, MID_URL_HYPERLINKEVENTS},\
+ TABSTOPS_MAP_ENTRY
+
+
+
+#define _BASE_INDEX_PROPERTIES_\
+ { SW_PROP_NMID(UNO_NAME_TITLE), WID_IDX_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_NAME), WID_IDX_NAME, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_CONTENT_SECTION), WID_IDX_CONTENT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION) , PropertyAttribute::READONLY, 0},\
+ { SW_PROP_NMID(UNO_NAME_HEADER_SECTION), WID_IDX_HEADER_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION) , PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},\
+
+#define ANCHOR_TYPES_PROPERTY { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPES), FN_UNO_ANCHOR_TYPES, CPPU_E2T(CPPUTYPE_SEQANCHORTYPE),PropertyAttribute::READONLY, 0xff},
+
+#define COMMON_FRAME_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM }, \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE}, \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_FRAME), RES_ANCHOR, CPPU_E2T(CPPUTYPE_REFTEXTFRAME), PropertyAttribute::MAYBEVOID, MID_ANCHOR_ANCHORFRAME}, \
+ ANCHOR_TYPES_PROPERTY\
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR }, \
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_R_G_B), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR_R_G_B}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_BACK_COLOR_TRANSPARENCY}, \
+ { SW_PROP_NMID(UNO_NAME_CONTENT_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_CONTENT }, \
+ { SW_PROP_NMID(UNO_NAME_FRAME_STYLE_NAME), FN_UNO_FRAME_STYLE_NAME,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL }, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER }, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENCY}, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_ORIENT }, \
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_POSITION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_HORIORIENT_POSITION|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_RELATION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_RELATION }, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_U_R_L), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_URL}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_TARGET), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_TARGET}, \
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_NAME), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_HYPERLINKNAME }, \
+ { SW_PROP_NMID(UNO_NAME_OPAQUE), RES_OPAQUE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_PAGE_TOGGLE), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_HORIORIENT_PAGETOGGLE }, \
+ { SW_PROP_NMID(UNO_NAME_POSITION_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_POSITION}, \
+ { SW_PROP_NMID(UNO_NAME_PRINT), RES_PRINT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0}, \
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT }, \
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH }, \
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_IMAGE_MAP), RES_URL, CPPU_E2T(CPPUTYPE_REFIDXCNTNR), PROPERTY_NONE, MID_URL_CLIENTMAP}, \
+ { SW_PROP_NMID(UNO_NAME_SERVER_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_SERVERMAP }, \
+ { SW_PROP_NMID(UNO_NAME_SIZE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PROPERTY_NONE, MID_FRMSIZE_SIZE|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_SIZE_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_SIZE }, \
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_WIDTH_TO_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT }, \
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_HEIGHT_TO_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH }, \
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE }, \
+ { SW_PROP_NMID(UNO_NAME_SURROUND), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE }, \
+ { SW_PROP_NMID(UNO_NAME_SURROUND_ANCHORONLY), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_ANCHORONLY }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT }, \
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT }, \
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_POSITION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_VERTORIENT_POSITION|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_RELATION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_RELATION }, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS }, \
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff}, \
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },\
+ { SW_PROP_NMID(UNO_NAME_Z_ORDER), FN_UNO_Z_ORDER, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+
+
+
+#define COMMON_TEXT_CONTENT_PROPERTIES \
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), FN_UNO_ANCHOR_TYPE, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PropertyAttribute::READONLY, MID_ANCHOR_ANCHORTYPE},\
+ ANCHOR_TYPES_PROPERTY\
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), FN_UNO_TEXT_WRAP, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PropertyAttribute::READONLY, MID_SURROUND_SURROUNDTYPE },
+
+
+#define _PROP_DIFF_FONTHEIGHT \
+ { SW_PROP_NMID(UNO_NAME_CHAR_PROP_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PROPERTY_NONE , MID_FONTHEIGHT_PROP},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_DIFF_HEIGHT), RES_CHRATR_FONTSIZE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_FONTHEIGHT_DIFF|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_PROP_HEIGHT_ASIAN), RES_CHRATR_CJK_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PROPERTY_NONE , MID_FONTHEIGHT_PROP},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_DIFF_HEIGHT_ASIAN), RES_CHRATR_CJK_FONTSIZE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_FONTHEIGHT_DIFF|CONVERT_TWIPS},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_PROP_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE , CPPU_E2T(CPPUTYPE_FLOAT), PROPERTY_NONE , MID_FONTHEIGHT_PROP},\
+ { SW_PROP_NMID(UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX), RES_CHRATR_CTL_FONTSIZE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_FONTHEIGHT_DIFF|CONVERT_TWIPS},
+
+
+
+const SfxItemPropertyMap* SwUnoPropertyMapProvider::GetPropertyMap(sal_uInt16 nPropertyId)
+{
+ DBG_ASSERT(nPropertyId < PROPERTY_MAP_END, "Id ?" );
+ if( !aMapArr[ nPropertyId ] )
+ {
+ switch(nPropertyId)
+ {
+ case PROPERTY_MAP_TEXT_CURSOR:
+ {
+ static SfxItemPropertyMap aCharAndParaMap_Impl[] =
+ {
+ COMPLETE_TEXT_CURSOR_MAP
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aCharAndParaMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_PARAGRAPH:
+ {
+ static SfxItemPropertyMap aParagraphMap_Impl[] =
+ {
+ COMMON_CRSR_PARA_PROPERTIES_2
+ TABSTOPS_MAP_ENTRY
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aParagraphMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_CHAR_STYLE :
+ {
+ static SfxItemPropertyMap aCharStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ESC },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PROPERTY_NONE, MID_ESC_HEIGHT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ _STANDARD_FONT_PROPERTIES
+ _CJK_FONT_PROPERTIES
+ _CTL_FONT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_UNDERLINE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_UL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TWOLINES},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_START_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_END_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_EMPHASIS},
+ _PROP_DIFF_FONTHEIGHT
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ROTATE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FITTOLINE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF },
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aCharStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_PARA_STYLE :
+ {
+ static SfxItemPropertyMap aParaStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PAGE_DESC_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGEDESCNAME },
+ { SW_PROP_NMID(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGENUMOFFSET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ESC },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PROPERTY_NONE, MID_ESC_HEIGHT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ _STANDARD_FONT_PROPERTIES
+ _CJK_FONT_PROPERTIES
+ _CTL_FONT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_UNDERLINE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_UL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_TXT_LMARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN_RELATIVE), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_L_REL_MARGIN},
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN_RELATIVE), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_R_REL_MARGIN},
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FIRST_AUTO},
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FIRST_LINE_INDENT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT_RELATIVE), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FIRST_LINE_REL_INDENT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_FORMAT), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_DROPCAPFMT) , PROPERTY_NONE, MID_DROPCAP_FORMAT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_WHOLE_WORD), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_DROPCAP_WHOLE_WORD },
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_CHAR_STYLE_NAME), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_OUSTRING) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_CHAR_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_PARA_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_SPLIT), RES_PARATR_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_WIDOWS), RES_PARATR_WIDOWS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_ORPHANS), RES_PARATR_ORPHANS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_EXPAND_SINGLE_WORD), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_EXPAND_SINGLE },
+ { SW_PROP_NMID(UNO_NAME_PARA_LAST_LINE_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_LAST_LINE_ADJUST},
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_COUNT), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_LINENUMBER_COUNT },
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_START_VALUE), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_LINENUMBER_STARTVALUE},
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE),PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_PARA_ADJUST},
+ { SW_PROP_NMID(UNO_NAME_PARA_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN_RELATIVE), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_UP_REL_MARGIN},
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN_RELATIVE), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_LO_REL_MARGIN},
+ TABSTOPS_MAP_ENTRY
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HYPHENATION), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_IS_HYPHEN },
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_LEAD },
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_TRAIL },
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS},
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_STYLE_NAME), RES_PARATR_NUMRULE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_TWOLINES},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_START_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, MID_END_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_EMPHASIS},
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HANGING_PUNCTUATION), RES_PARATR_HANGINGPUNCTUATION, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CHARACTER_DISTANCE), RES_PARATR_SCRIPTSPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_FORBIDDEN_RULES), RES_PARATR_FORBIDDEN_RULES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_VERT_ALIGNMENT), RES_PARATR_VERTALIGN, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ROTATE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FITTOLINE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_RELIEF },
+
+ _PROP_DIFF_FONTHEIGHT
+ { SW_PROP_NMID(UNO_NAME_FOLLOW_STYLE), FN_UNO_FOLLOW_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_AUTO_UPDATE), FN_UNO_IS_AUTO_UPDATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CATEGORY), FN_UNO_CATEGORY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CONNECT_BORDER), RES_PARATR_CONNECT_BORDER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aParaStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_FRAME_STYLE:
+ {
+ static SfxItemPropertyMap aFrameStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_ANCHOR_PAGENUM },
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE, MID_ANCHOR_ANCHORTYPE},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_R_G_B), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR_R_G_B}, \
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR_TRANSPARENCY), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE ,MID_BACK_COLOR_TRANSPARENCY}, \
+ // { SW_PROP_NMID(UNO_NAME_CHAIN_NEXT_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_NEXTNAME},
+ // { SW_PROP_NMID(UNO_NAME_CHAIN_PREV_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_CHAIN_PREVNAME},
+ /*not impl*/ { SW_PROP_NMID(UNO_NAME_CLIENT_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_CLIENTMAP },
+ { SW_PROP_NMID(UNO_NAME_CONTENT_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_CONTENT },
+ { SW_PROP_NMID(UNO_NAME_EDIT_IN_READONLY), RES_EDIT_IN_READONLY, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_POSITION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_HORIORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_RELATION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_U_R_L), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_URL},
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_TARGET), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_TARGET},
+ { SW_PROP_NMID(UNO_NAME_HYPER_LINK_NAME), RES_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_URL_HYPERLINKNAME },
+ { SW_PROP_NMID(UNO_NAME_OPAQUE), RES_OPAQUE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PAGE_TOGGLE), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_HORIORIENT_PAGETOGGLE },
+ { SW_PROP_NMID(UNO_NAME_POSITION_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_POSITION},
+ { SW_PROP_NMID(UNO_NAME_PRINT), RES_PRINT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH },
+ { SW_PROP_NMID(UNO_NAME_SIZE_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_SIZE_TYPE },
+ { SW_PROP_NMID(UNO_NAME_SIZE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PROPERTY_NONE, MID_FRMSIZE_SIZE|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_WIDTH_TO_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_IS_SYNC_HEIGHT_TO_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH },
+ // { SW_PROP_NMID(UNO_NAME_WIDTH), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_WIDTH },
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_SERVER_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_SERVERMAP },
+ { SW_PROP_NMID(UNO_NAME_SIZE_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_PROTECT_SIZE },
+ //Surround bleibt, weil es mit der 5.1 ausgeliefert wurde, obwohl es mit text::WrapTextMode identisch ist
+ { SW_PROP_NMID(UNO_NAME_SURROUND), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_ANCHORONLY), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_ANCHORONLY },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE },
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_POSITION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_VERTORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_RELATION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_AUTO_UPDATE), FN_UNO_IS_AUTO_UPDATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aFrameStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_PAGE_STYLE :
+ {
+ static SfxItemPropertyMap aPageStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ // { SW_PROP_NMID(UNO_NAME_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+
+ { SW_PROP_NMID(UNO_NAME_HEADER_BACK_COLOR), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ // { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC), FN_UNO_HEADER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_URL), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_FILTER), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_HEADER_GRAPHIC_LOCATION), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_MARGIN), FN_UNO_HEADER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_MARGIN), FN_UNO_HEADER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_BACK_TRANSPARENT), FN_UNO_HEADER_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_LEFT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_RIGHT_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_TOP_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_BOTTOM_BORDER_DISTANCE), FN_UNO_HEADER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_SHADOW_FORMAT), FN_UNO_HEADER_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_BODY_DISTANCE), FN_UNO_HEADER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_LO_MARGIN|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_IS_DYNAMIC_HEIGHT), FN_UNO_HEADER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_HEADER_IS_SHARED), FN_UNO_HEADER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_HEADER_HEIGHT), FN_UNO_HEADER_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HEADER_IS_ON), FN_UNO_HEADER_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_HEADER_DYNAMIC_SPACING), FN_UNO_HEADER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_COLOR), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ // { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC), FN_UNO_FOOTER_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_URL), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_FILTER), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_GRAPHIC_LOCATION), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_MARGIN), FN_UNO_FOOTER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_MARGIN), FN_UNO_FOOTER_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BACK_TRANSPARENT), FN_UNO_FOOTER_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_LEFT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_RIGHT_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TOP_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BOTTOM_BORDER_DISTANCE), FN_UNO_FOOTER_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_SHADOW_FORMAT), FN_UNO_FOOTER_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_BODY_DISTANCE), FN_UNO_FOOTER_BODY_DISTANCE,CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_UP_MARGIN|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_IS_DYNAMIC_HEIGHT), FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_IS_SHARED), FN_UNO_FOOTER_SHARE_CONTENT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_HEIGHT), FN_UNO_FOOTER_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_SIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_IS_ON), FN_UNO_FOOTER_ON, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTER_DYNAMIC_SPACING), FN_UNO_FOOTER_EAT_SPACING, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+
+
+ { SW_PROP_NMID(UNO_NAME_IS_LANDSCAPE), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_PAGE_ORIENTATION },
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_PAGE_NUMTYPE },
+ { SW_PROP_NMID(UNO_NAME_PAGE_STYLE_LAYOUT), SID_ATTR_PAGE, CPPU_E2T(CPPUTYPE_PAGESTYLELAY), PROPERTY_NONE ,MID_PAGE_LAYOUT },
+ { SW_PROP_NMID(UNO_NAME_PRINTER_PAPER_TRAY), RES_PAPER_BIN, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+// { SW_PROP_NMID(UNO_NAME_REGISTER_MODE_ACTIVE), SID_SWREGISTER_MODE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_REGISTER_PARAGRAPH_STYLE), SID_SWREGISTER_COLLECTION, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_SIZE), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PROPERTY_NONE, MID_SIZE_SIZE|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_WIDTH), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_SIZE_WIDTH|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), SID_ATTR_PAGE_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_SIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HEADER_TEXT), FN_UNO_HEADER, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_HEADER_TEXT_LEFT), FN_UNO_HEADER_LEFT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_HEADER_TEXT_RIGHT), FN_UNO_HEADER_RIGHT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TEXT), FN_UNO_FOOTER, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TEXT_LEFT), FN_UNO_FOOTER_LEFT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTER_TEXT_RIGHT), FN_UNO_FOOTER_RIGHT, CPPU_E2T(CPPUTYPE_REFTEXT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOLLOW_STYLE), FN_UNO_FOLLOW_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_HEIGHT), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_FTN_HEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_WEIGHT), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_LINE_WEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_COLOR), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_COLOR},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_RELATIVE_WIDTH), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE , MID_LINE_RELWIDTH },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_ADJUST), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_LINE_ADJUST },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_TEXT_DISTANCE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_TEXT_DIST |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_LINE_DISTANCE), FN_PARAM_FTN_INFO, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_LINE_FOOTNOTE_DIST|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ // writing grid
+ { SW_PROP_NMID(UNO_NAME_GRID_COLOR), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_COLOR},
+ { SW_PROP_NMID(UNO_NAME_GRID_LINES), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_GRID_LINES},
+ { SW_PROP_NMID(UNO_NAME_GRID_BASE_HEIGHT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_BASEHEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_GRID_RUBY_HEIGHT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_GRID_RUBYHEIGHT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_GRID_MODE), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, MID_GRID_TYPE},
+ { SW_PROP_NMID(UNO_NAME_GRID_RUBY_BELOW), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_RUBY_BELOW},
+ { SW_PROP_NMID(UNO_NAME_GRID_PRINT), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_PRINT},
+ { SW_PROP_NMID(UNO_NAME_GRID_DISPLAY), RES_TEXTGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_GRID_DISPLAY},
+
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aPageStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_NUM_STYLE :
+ {
+ static SfxItemPropertyMap aNumStyleMap [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), FN_UNO_NUM_RULES, CPPU_E2T(CPPUTYPE_REFIDXREPL), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aNumStyleMap;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE :
+ {
+ static SfxItemPropertyMap aTablePropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BREAK_TYPE), RES_BREAK, CPPU_E2T(CPPUTYPE_BREAK), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_HORIORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SPLIT), RES_LAYOUT_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PAGEDESC_PAGENUMOFFSET},
+ { SW_PROP_NMID(UNO_NAME_PAGE_DESC_NAME), RES_PAGEDESC, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0xff},
+ { SW_PROP_NMID(UNO_NAME_RELATIVE_WIDTH), FN_TABLE_RELATIVE_WIDTH,CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0xff },
+ { SW_PROP_NMID(UNO_NAME_REPEAT_HEADLINE), FN_TABLE_HEADLINE_REPEAT,CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0xff},
+ { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_WIDTH), FN_TABLE_WIDTH, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, 0xff},
+ { SW_PROP_NMID(UNO_NAME_IS_WIDTH_RELATIVE), FN_TABLE_IS_RELATIVE_WIDTH, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0xff},
+ { SW_PROP_NMID(UNO_NAME_CHART_ROW_AS_LABEL), FN_UNO_RANGE_ROW_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CHART_COLUMN_AS_LABEL), FN_UNO_RANGE_COL_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TABLE_BORDER), FN_UNO_TABLE_BORDER, CPPU_E2T(CPPUTYPE_TABLEBORDER), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_SEPARATORS), FN_UNO_TABLE_COLUMN_SEPARATORS, CPPU_E2T(CPPUTYPE_TBLCOLSEP), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_RELATIVE_SUM), FN_UNO_TABLE_COLUMN_RELATIVE_SUM, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::READONLY, 0 },
+ COMMON_TEXT_CONTENT_PROPERTIES
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0,0}
+ };
+
+ aMapArr[nPropertyId] = aTablePropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TABLE_CELL :
+ {
+ static SfxItemPropertyMap aCellMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE , MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_TEXT_SECTION), FN_UNO_TEXT_SECTION, CPPU_E2T(CPPUTYPE_REFTEXTSECTION), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), RES_PROTECT, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, MID_PROTECT_CONTENT},
+ { SW_PROP_NMID(UNO_NAME_CELL_NAME), FN_UNO_CELL_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY,0},
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_VERTORIENT_ORIENT },
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aCellMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TABLE_RANGE:
+ {
+ static SfxItemPropertyMap aRangePropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLE_NAME), FN_UNO_PARA_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHART_ROW_AS_LABEL), FN_UNO_RANGE_ROW_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHART_COLUMN_AS_LABEL), FN_UNO_RANGE_COL_LABEL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT },
+
+ // most of the properties from paragraph style...
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_ESC },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PropertyAttribute::MAYBEVOID, MID_ESC_HEIGHT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ _STANDARD_FONT_PROPERTIES
+ _CJK_FONT_PROPERTIES
+ _CTL_FONT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_UNDERLINE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_UL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_FIRST_AUTO},
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_FORMAT), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_DROPCAPFMT) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_FORMAT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_WHOLE_WORD), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_WHOLE_WORD },
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_CHAR_STYLE_NAME), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_OUSTRING) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_CHAR_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_PARA_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_SPLIT), RES_PARATR_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_WIDOWS), RES_PARATR_WIDOWS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_ORPHANS), RES_PARATR_ORPHANS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_EXPAND_SINGLE_WORD), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_EXPAND_SINGLE },
+ { SW_PROP_NMID(UNO_NAME_PARA_LAST_LINE_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_LAST_LINE_ADJUST},
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_COUNT), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_COUNT },
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_START_VALUE), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_STARTVALUE},
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE),PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST},
+ { SW_PROP_NMID(UNO_NAME_PARA_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS},
+ TABSTOPS_MAP_ENTRY
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, LEFT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, TOP_BORDER |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER), RES_BOX, CPPU_E2T(CPPUTYPE_BORDERLINE), 0, BOTTOM_BORDER|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_LEFT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, LEFT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_RIGHT_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, RIGHT_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_TOP_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, TOP_BORDER_DISTANCE |CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_BORDER_DISTANCE), RES_BOX, CPPU_E2T(CPPUTYPE_INT32), 0, BOTTOM_BORDER_DISTANCE|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HYPHENATION), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_IS_HYPHEN },
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_LEADING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_LEAD },
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_TRAILING_CHARS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MIN_TRAIL },
+ { SW_PROP_NMID(UNO_NAME_PARA_HYPHENATION_MAX_HYPHENS), RES_PARATR_HYPHENZONE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_HYPHEN_MAX_HYPHENS},
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_STYLE_NAME), RES_PARATR_NUMRULE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_TWOLINES},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_START_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_END_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_EMPHASIS},
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_HANGING_PUNCTUATION), RES_PARATR_HANGINGPUNCTUATION, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_CHARACTER_DISTANCE), RES_PARATR_SCRIPTSPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_FORBIDDEN_RULES), RES_PARATR_FORBIDDEN_RULES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_VERT_ALIGNMENT), RES_PARATR_VERTALIGN, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID , 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_ROTATE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ROTATION_IS_FIT_TO_LINE), RES_CHRATR_ROTATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_FITTOLINE },
+ { SW_PROP_NMID(UNO_NAME_CHAR_SCALE_WIDTH), RES_CHRATR_SCALEW, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RELIEF },
+
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), FN_UNO_NUM_RULES, CPPU_E2T(CPPUTYPE_REFIDXREPL), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS}, \
+
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aRangePropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_SECTION:
+ {
+ static SfxItemPropertyMap aSectionPropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_CONDITION), WID_SECT_CONDITION, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DDE_COMMAND_FILE), WID_SECT_DDE_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DDE_COMMAND_TYPE), WID_SECT_DDE_FILE, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DDE_COMMAND_ELEMENT), WID_SECT_DDE_ELEMENT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_UPDATE), WID_SECT_DDE_AUTOUPDATE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILE_LINK), WID_SECT_LINK , CPPU_E2T(CPPUTYPE_SECTFILELNK), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_VISIBLE), WID_SECT_VISIBLE , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_SECT_PROTECTED, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LINK_REGION), WID_SECT_REGION , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_IS_COLLECT_AT_TEXT_END), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_COLLECT },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_IS_RESTART_NUMBERING), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_RESTART_NUM },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_RESTART_NUMBERING_AT), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_NUM_START_AT},
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_IS_OWN_NUMBERING), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_OWN_NUM },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_NUMBERING_TYPE), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_NUM_TYPE },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_NUMBERING_PREFIX), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_PREFIX },
+ { SW_PROP_NMID(UNO_NAME_FOOTNOTE_NUMBERING_SUFFIX), RES_FTN_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_SUFFIX },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_IS_COLLECT_AT_TEXT_END), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_COLLECT },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_IS_RESTART_NUMBERING), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_RESTART_NUM },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_RESTART_NUMBERING_AT), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE , MID_NUM_START_AT },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_IS_OWN_NUMBERING), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , MID_OWN_NUM },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_NUMBERING_TYPE), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE ,MID_NUM_TYPE },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_NUMBERING_PREFIX), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_PREFIX },
+ { SW_PROP_NMID(UNO_NAME_ENDNOTE_NUMBERING_SUFFIX), RES_END_AT_TXTEND, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, MID_SUFFIX },
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX), WID_SECT_DOCUMENT_INDEX, CPPU_E2T(CPPUTYPE_REFDOCINDEX), PropertyAttribute::READONLY | PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_GLOBAL_DOCUMENT_SECTION), WID_SECT_IS_GLOBAL_DOC_SECTION, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0 },
+ { SW_PROP_NMID(UNO_NAME_PROTECTION_KEY), WID_SECT_PASSWORD, CPPU_E2T(CPPUTYPE_SEQINT8), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_DONT_BALANCE_TEXT_COLUMNS), RES_COLUMNBALANCE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ COMMON_TEXT_CONTENT_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_IS_CURRENTLY_VISIBLE), WID_SECT_CURRENTLY_VISIBLE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ /* -> #109700# */
+ { SW_PROP_NMID(UNO_NAME_SECT_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_L_MARGIN|CONVERT_TWIPS}, \
+ { SW_PROP_NMID(UNO_NAME_SECT_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS}, \
+ /* <- #1097001# */
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aSectionPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_SEARCH:
+ {
+ static SfxItemPropertyMap aSearchPropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_SEARCH_ALL), WID_SEARCH_ALL, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_BACKWARDS), WID_BACKWARDS, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_CASE_SENSITIVE), WID_CASE_SENSITIVE, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_SEARCH_IN_SELECTION), WID_IN_SELECTION, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_REGULAR_EXPRESSION), WID_REGULAR_EXPRESSION, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY), WID_SIMILARITY, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_ADD), WID_SIMILARITY_ADD, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_EXCHANGE), WID_SIMILARITY_EXCHANGE,CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_RELAX), WID_SIMILARITY_RELAX, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_SIMILARITY_REMOVE), WID_SIMILARITY_REMOVE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_STYLES), WID_STYLES, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SEARCH_WORDS), WID_WORDS, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aSearchPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_FRAME:
+ {
+ static SfxItemPropertyMap aFramePropertyMap_Impl[] =
+ {
+ COMMON_FRAME_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAIN_NEXT_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_CHAIN_NEXTNAME},
+ { SW_PROP_NMID(UNO_NAME_CHAIN_PREV_NAME), RES_CHAIN, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_CHAIN_PREVNAME},
+ /*not impl*/ { SW_PROP_NMID(UNO_NAME_CLIENT_MAP), RES_URL, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_URL_CLIENTMAP },
+ { SW_PROP_NMID(UNO_NAME_EDIT_IN_READONLY), RES_EDIT_IN_READONLY, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_GRAPHIC), RES_BACKGROUND, &, PROPERTY_NONE, MID_GRAPHIC
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ //next elements are part of the service description
+ { SW_PROP_NMID(UNO_NAME_FRAME_HEIGHT_ABSOLUTE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FRAME_HEIGHT_PERCENT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_FRMSIZE_REL_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_FRMSIZE_IS_AUTO_HEIGHT },
+ { SW_PROP_NMID(UNO_NAME_FRAME_WIDTH_ABSOLUTE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_FRMSIZE_WIDTH|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_FRAME_WIDTH_PERCENT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, MID_FRMSIZE_REL_WIDTH },
+ { SW_PROP_NMID(UNO_NAME_SIZE_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_SIZE_TYPE },
+ { SW_PROP_NMID(UNO_NAME_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 },
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aFramePropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_GRAPHIC:
+ {
+ static SfxItemPropertyMap aGraphicPropertyMap_Impl[] =
+ {
+ COMMON_FRAME_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_CROP), RES_GRFATR_CROPGRF, CPPU_E2T(CPPUTYPE_GRFCROP), PROPERTY_NONE, CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HORI_MIRRORED_ON_EVEN_PAGES), RES_GRFATR_MIRRORGRF, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_MIRROR_HORZ_EVEN_PAGES },
+ { SW_PROP_NMID(UNO_NAME_HORI_MIRRORED_ON_ODD_PAGES), RES_GRFATR_MIRRORGRF, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_MIRROR_HORZ_ODD_PAGES },
+ { SW_PROP_NMID(UNO_NAME_VERT_MIRRORED), RES_GRFATR_MIRRORGRF, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_MIRROR_VERT },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_U_R_L, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER, CPPU_E2T(CPPUTYPE_OUSTRING), 0, 0 },
+ { SW_PROP_NMID(UNO_NAME_ACTUAL_SIZE), FN_UNO_ACTUAL_SIZE, CPPU_E2T(CPPUTYPE_AWTSIZE), PropertyAttribute::READONLY, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_POLY_POLYGON), FN_PARAM_COUNTOUR_PP, CPPU_E2T(CPPUTYPE_PNTSEQSEQ), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PIXEL_CONTOUR), FN_UNO_IS_PIXEL_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_CONTOUR), FN_UNO_IS_AUTOMATIC_CONTOUR , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_ROTATION), RES_GRFATR_ROTATION, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_LUMINANCE), RES_GRFATR_LUMINANCE, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_CONTRAST), RES_GRFATR_CONTRAST, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_RED), RES_GRFATR_CHANNELR, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_GREEN), RES_GRFATR_CHANNELG, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_ADJUST_BLUE), RES_GRFATR_CHANNELB, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_GAMMA), RES_GRFATR_GAMMA, CPPU_E2T(CPPUTYPE_DOUBLE), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_IS_INVERTED), RES_GRFATR_INVERT, CPPU_E2T(CPPUTYPE_BOOLEAN), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_TRANSPARENCY), RES_GRFATR_TRANSPARENCY, CPPU_E2T(CPPUTYPE_INT16), 0, 0},
+ { SW_PROP_NMID(UNO_NAME_GRAPHIC_COLOR_MODE), RES_GRFATR_DRAWMODE, CPPU_E2T(CPPUTYPE_COLORMODE), 0, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aGraphicPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_EMBEDDED_OBJECT:
+ {
+ static SfxItemPropertyMap aEmbeddedPropertyMap_Impl[] =
+ {
+ COMMON_FRAME_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE},
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_POLY_POLYGON), FN_PARAM_COUNTOUR_PP, CPPU_E2T(CPPUTYPE_PNTSEQSEQ), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_PIXEL_CONTOUR), FN_UNO_IS_PIXEL_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_CONTOUR), FN_UNO_IS_AUTOMATIC_CONTOUR , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_CLSID), FN_UNO_CLSID, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_MODEL), FN_UNO_MODEL, CPPU_E2T(CPPUTYPE_REFMODEL), PropertyAttribute::READONLY|PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, CPPU_E2T(CPPUTYPE_REFCOMPONENT), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aEmbeddedPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_SHAPE:
+ {
+ static SfxItemPropertyMap aShapeMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_PAGE_NO), RES_ANCHOR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_ANCHOR_PAGENUM },
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_TYPE), RES_ANCHOR, CPPU_E2T(CPPUTYPE_TXTCNTANCHOR), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_ANCHOR_ANCHORTYPE},
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_FRAME), RES_ANCHOR, CPPU_E2T(CPPUTYPE_REFTEXTFRAME), PropertyAttribute::MAYBEVOID, MID_ANCHOR_ANCHORFRAME},
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_HORIORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_POSITION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_HORIORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_HORI_ORIENT_RELATION), RES_HORI_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_HORIORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_L_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_SURROUND), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_TEXT_WRAP), RES_SURROUND, CPPU_E2T(CPPUTYPE_WRAPTXTMODE), PROPERTY_NONE, MID_SURROUND_SURROUNDTYPE },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_ANCHORONLY), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE|PropertyAttribute::MAYBEVOID, MID_SURROUND_ANCHORONLY },
+ { SW_PROP_NMID(UNO_NAME_SURROUND_CONTOUR), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUR },
+ { SW_PROP_NMID(UNO_NAME_CONTOUR_OUTSIDE), RES_SURROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, MID_SURROUND_CONTOUROUTSIDE },
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_VERTORIENT_ORIENT },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_POSITION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_VERTORIENT_POSITION|CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_VERT_ORIENT_RELATION), RES_VERT_ORIENT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE|PropertyAttribute::MAYBEVOID ,MID_VERTORIENT_RELATION },
+ { SW_PROP_NMID(UNO_NAME_TEXT_RANGE), FN_TEXT_RANGE, CPPU_E2T(CPPUTYPE_REFTXTRANGE), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_OPAQUE), RES_OPAQUE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_ANCHOR_POSITION), FN_ANCHOR_POSITION, CPPU_E2T(CPPUTYPE_AWTPOINT), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aShapeMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_MARK:
+ {
+ static SfxItemPropertyMap aIdxMarkMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PRIMARY_KEY), WID_PRIMARY_KEY, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SECONDARY_KEY), WID_SECONDARY_KEY, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_READING), WID_TEXT_READING, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PRIMARY_KEY_READING), WID_PRIMARY_KEY_READING, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SECONDARY_KEY_READING), WID_SECONDARY_KEY_READING, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_MAIN_ENTRY), WID_MAIN_ENTRY, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aIdxMarkMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_CNTIDX_MARK:
+ {
+ static SfxItemPropertyMap aCntntMarkMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aCntntMarkMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_USER_MARK:
+ {
+ static SfxItemPropertyMap aUserMarkMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), WID_ALT_TEXT, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL ), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_INDEX_NAME), WID_USER_IDX_NAME, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aUserMarkMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_IDX:
+ {
+ static SfxItemPropertyMap aTOXIndexMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_ALPHABETICAL_SEPARATORS), WID_USE_ALPHABETICAL_SEPARATORS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_KEY_AS_ENTRY), WID_USE_KEY_AS_ENTRY , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_COMBINED_ENTRIES), WID_USE_COMBINED_ENTRIES , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_CASE_SENSITIVE), WID_IS_CASE_SENSITIVE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_P_P), WID_USE_P_P , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_DASH), WID_USE_DASH , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_UPPER_CASE), WID_USE_UPPER_CASE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_??? ), WID_??? , &_getReflection , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_MAIN_ENTRY_CHARACTER_STYLE_NAME), WID_MAIN_ENTRY_CHARACTER_STYLE_NAME , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLESEPARATOR), WID_PARA_SEP, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL2), WID_PARA_LEV2, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL3), WID_PARA_LEV3, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_COMMA_SEPARATED), WID_IS_COMMA_SEPARATED, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,0 },
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARKS), WID_INDEX_MARKS, CPPU_E2T(CPPUTYPE_DOCIDXMRK), PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LOCALE), WID_IDX_LOCALE, CPPU_E2T(CPPUTYPE_LOCALE), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), WID_IDX_SORT_ALGORITHM, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},\
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTOXIndexMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_CNTNT:
+ {
+ static SfxItemPropertyMap aTOXContentMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_LEVEL), WID_LEVEL , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_MARKS), WID_CREATE_FROM_MARKS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_OUTLINE), WID_CREATE_FROM_OUTLINE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_PARAGRAPH_STYLE_NAMES), WID_PARAGRAPH_STYLE_NAMES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_PARAGRAPH_STYLES), WID_LEVEL_PARAGRAPH_STYLES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LEVEL_PARAGRAPH_STYLES), WID_CREATE_FROM_PARAGRAPH_STYLES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_RECALC_TAB_STOPS), WID_RECALC_TAB_STOPS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_??? ), WID_??? , &_getReflection , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL2), WID_PARA_LEV2, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL3), WID_PARA_LEV3, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL4), WID_PARA_LEV4, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL5), WID_PARA_LEV5, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL6), WID_PARA_LEV6, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL7), WID_PARA_LEV7, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL8), WID_PARA_LEV8, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL9), WID_PARA_LEV9, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL10), WID_PARA_LEV10, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARKS), WID_INDEX_MARKS, CPPU_E2T(CPPUTYPE_DOCIDXMRK), PropertyAttribute::READONLY ,0 },
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTOXContentMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_USER:
+ {
+ static SfxItemPropertyMap aTOXUserMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_MARKS), WID_CREATE_FROM_MARKS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ // { SW_PROP_NMID(UNO_NAME_PARAGRAPH_STYLE_NAMES), WID_PARAGRAPH_STYLE_NAMES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_LEVEL_FROM_SOURCE), WID_USE_LEVEL_FROM_SOURCE , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_PARAGRAPH_STYLES), WID_LEVEL_PARAGRAPH_STYLES , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PropertyAttribute::READONLY,0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LEVEL_PARAGRAPH_STYLES), WID_CREATE_FROM_PARAGRAPH_STYLES, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_TABLES), WID_CREATE_FROM_TABLES , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_TEXT_FRAMES), WID_CREATE_FROM_TEXT_FRAMES , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS), WID_CREATE_FROM_GRAPHIC_OBJECTS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS), WID_CREATE_FROM_EMBEDDED_OBJECTS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL2), WID_PARA_LEV2, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL3), WID_PARA_LEV3, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL4), WID_PARA_LEV4, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL5), WID_PARA_LEV5, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL6), WID_PARA_LEV6, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL7), WID_PARA_LEV7, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL8), WID_PARA_LEV8, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL9), WID_PARA_LEV9, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL10), WID_PARA_LEV10, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_INDEX_MARKS), WID_INDEX_MARKS, CPPU_E2T(CPPUTYPE_DOCIDXMRK), PropertyAttribute::READONLY ,0 },
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_INDEX_NAME), WID_USER_IDX_NAME, CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTOXUserMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_TABLES:
+ {
+ static SfxItemPropertyMap aTOXTablesMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LABELS), WID_CREATE_FROM_LABELS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_CATEGORY), WID_LABEL_CATEGORY , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_DISPLAY_TYPE), WID_LABEL_DISPLAY_TYPE , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTOXTablesMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_OBJECTS:
+ {
+ static SfxItemPropertyMap aTOXObjectsMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_ALPHABETICAL_SEPARATORS), WID_USE_ALPHABETICAL_SEPARATORS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_MATH), WID_CREATE_FROM_STAR_MATH , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_CHART), WID_CREATE_FROM_STAR_CHART , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_CALC), WID_CREATE_FROM_STAR_CALC , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_STAR_DRAW), WID_CREATE_FROM_STAR_DRAW , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS), WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTOXObjectsMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_INDEX_ILLUSTRATIONS:
+ {
+ static SfxItemPropertyMap aTOXIllustrationsMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_CHAPTER), WID_CREATE_FROM_CHAPTER , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CREATE_FROM_LABELS), WID_CREATE_FROM_LABELS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_USE_ALPHABETICAL_SEPARATORS), WID_USE_ALPHABETICAL_SEPARATORS , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_CATEGORY), WID_LABEL_CATEGORY , CPPU_E2T(CPPUTYPE_OUSTRING) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LABEL_DISPLAY_TYPE), WID_LABEL_DISPLAY_TYPE , CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_IS_RELATIVE_TABSTOPS), WID_IS_RELATIVE_TABSTOPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTOXIllustrationsMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE_ROW:
+ {
+ static SfxItemPropertyMap aTableRowPropertyMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_TABLE_COLUMN_SEPARATORS), FN_UNO_TABLE_COLUMN_SEPARATORS, CPPU_E2T(CPPUTYPE_TBLCOLSEP), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_HEIGHT), FN_UNO_ROW_HEIGHT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,CONVERT_TWIPS },
+ { SW_PROP_NMID(UNO_NAME_IS_AUTO_HEIGHT), FN_UNO_ROW_AUTO_HEIGHT, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE , 0 },
+ { SW_PROP_NMID(UNO_NAME_SIZE_TYPE), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT16) , PROPERTY_NONE, MID_FRMSIZE_SIZE_TYPE },
+ // { SW_PROP_NMID(UNO_NAME_HEIGHT), RES_FRM_SIZE, CPPU_E2T(CPPUTYPE_INT32) , PROPERTY_NONE, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS },
+ // { SW_PROP_NMID(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, CPPU_E2T(CPPUTYPE_SHADOWFMT), PROPERTY_NONE, CONVERT_TWIPS},
+ {0,0,0,0,0}
+ };
+
+ aMapArr[nPropertyId] = (SfxItemPropertyMap*)aTableRowPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_TABLE_CURSOR:
+ {
+ // das PropertySet entspricht dem Range ohne Chart-Properties
+ static SfxItemPropertyMap aTableCursorPropertyMap_Impl [] =
+ {
+ { SW_PROP_NMID(UNO_NAME_CHAR_AUTO_KERNING), RES_CHRATR_AUTOKERN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_ESC },
+ { SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT_HEIGHT), RES_CHRATR_ESCAPEMENT, CPPU_E2T(CPPUTYPE_INT8) , PropertyAttribute::MAYBEVOID, MID_ESC_HEIGHT},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FLASH), RES_CHRATR_BLINK , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ _STANDARD_FONT_PROPERTIES
+ _CJK_FONT_PROPERTIES
+ _CTL_FONT_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_UNDERLINE},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UL_COLOR},
+ { SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_HAS_COLOR), RES_CHRATR_UNDERLINE , CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_UL_HASCOLOR},
+ { SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_PARA_IS_AUTO_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_FIRST_AUTO},
+ { SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_KERNING), RES_CHRATR_KERNING , CPPU_E2T(CPPUTYPE_INT16) , PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_NO_HYPHENATION), RES_CHRATR_NOHYPHEN , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_FORMAT), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_DROPCAPFMT) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_FORMAT },
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_WHOLE_WORD), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_WHOLE_WORD },
+ { SW_PROP_NMID(UNO_NAME_DROP_CAP_CHAR_STYLE_NAME), RES_PARATR_DROP, CPPU_E2T(CPPUTYPE_OUSTRING) , PropertyAttribute::MAYBEVOID, MID_DROPCAP_CHAR_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_PARA_KEEP_TOGETHER), RES_KEEP, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_SPLIT), RES_PARATR_SPLIT, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_WIDOWS), RES_PARATR_WIDOWS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_ORPHANS), RES_PARATR_ORPHANS, CPPU_E2T(CPPUTYPE_INT8),PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), RES_BOXATR_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,0 },
+ { SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST},
+ { SW_PROP_NMID(UNO_NAME_PARA_EXPAND_SINGLE_WORD), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, MID_EXPAND_SINGLE },
+ { SW_PROP_NMID(UNO_NAME_PARA_LAST_LINE_ADJUST), RES_PARATR_ADJUST, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_LAST_LINE_ADJUST},
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_COUNT), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_COUNT },
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_NUMBER_START_VALUE), RES_LINENUMBER, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID ,MID_LINENUMBER_STARTVALUE},
+ { SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE),PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_REGISTER_MODE_ACTIVE), RES_PARATR_REGISTER, CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ TABSTOPS_MAP_ENTRY
+ { SW_PROP_NMID(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_CHAR_BACK_TRANSPARENT), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_PARA_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_PARA_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), FN_UNO_TABLE_CELL_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::MAYBEVOID ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,CPPU_E2T(CPPUTYPE_BOOLEAN) , PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLE_NAME), FN_UNO_PARA_STYLE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, MID_TWOLINES},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_START_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_SUFFIX), RES_CHRATR_TWO_LINES, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_END_BRACKET},
+ { SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_EMPHASIS},
+ { SW_PROP_NMID(UNO_NAME_CHAR_RELIEF), RES_CHRATR_RELIEF, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_RELIEF },
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTableCursorPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_BOOKMARK:
+ {
+ static SfxItemPropertyMap aBookmarkPropertyMap_Impl [] =
+ {
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), FN_PARAM_LINK_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aBookmarkPropertyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_PARAGRAPH_EXTENSIONS:
+ {
+ static SfxItemPropertyMap aParagraphExtensionsMap_Impl[] =
+ {
+ COMMON_TEXT_CONTENT_PROPERTIES
+ {0,0,0,0,0}
+ };
+
+ aMapArr[nPropertyId] = aParagraphExtensionsMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_BIBLIOGRAPHY :
+ {
+ static SfxItemPropertyMap aBibliographyMap_Impl[] =
+ {
+ _BASE_INDEX_PROPERTIES_
+ { SW_PROP_NMID(UNO_NAME_IS_PROTECTED), WID_PROTECTED , CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_TEXT_COLUMNS), RES_COL, CPPU_E2T(CPPUTYPE_REFTEXTCOL), PROPERTY_NONE, MID_COLUMNS},
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_URL), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_FILTER), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NMID(UNO_NAME_BACK_GRAPHIC_LOCATION), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_GRAPHICLOC), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NMID(UNO_NAME_BACK_COLOR), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE ,MID_BACK_COLOR },
+ { SW_PROP_NMID(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLEHEADING), WID_PARA_HEAD, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_PARA_STYLELEVEL1), WID_PARA_LEV1, CPPU_E2T(CPPUTYPE_OUSTRING) , 0, 0},
+ { SW_PROP_NMID(UNO_NAME_LEVEL_FORMAT), WID_LEVEL_FORMAT , CPPU_E2T(CPPUTYPE_REFIDXREPL) , PROPERTY_NONE,0},
+ { SW_PROP_NMID(UNO_NAME_LOCALE), WID_IDX_LOCALE, CPPU_E2T(CPPUTYPE_LOCALE), PROPERTY_NONE, 0},\
+ { SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), WID_IDX_SORT_ALGORITHM, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},\
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aBibliographyMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_DOCUMENT:
+ {
+ static SfxItemPropertyMap aDocMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_BASIC_LIBRARIES), WID_DOC_BASIC_LIBRARIES, CPPU_E2T(CPPUTYPE_REFLIBCONTAINER), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH), RES_CHRATR_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_ASIAN), RES_CHRATR_CJK_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_STYLE_NAME_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, MID_FONT_STYLE_NAME },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_FAMILY_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_CHAR_SET_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_CHAR_SET },
+ { SW_PROP_NMID(UNO_NAME_CHAR_FONT_PITCH_COMPLEX), RES_CHRATR_CTL_FONT, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, MID_FONT_PITCH },
+ { SW_PROP_NMID(UNO_NAME_CHAR_LOCALE), RES_CHRATR_LANGUAGE , CPPU_E2T(CPPUTYPE_LOCALE), PropertyAttribute::MAYBEVOID, MID_LANG_LOCALE },
+ { SW_PROP_NMID(UNO_NAME_CHARACTER_COUNT), WID_DOC_CHAR_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L), WID_DOC_AUTO_MARK_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_PARAGRAPH_COUNT), WID_DOC_PARA_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_RECORD_CHANGES), WID_DOC_CHANGES_RECORD, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SHOW_CHANGES), WID_DOC_CHANGES_SHOW, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_WORD_COUNT), WID_DOC_WORD_COUNT, CPPU_E2T(CPPUTYPE_INT32), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_WORD_SEPARATOR), WID_DOC_WORD_SEPARATOR, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_HIDE_FIELD_TIPS), WID_DOC_HIDE_TIPS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_REDLINE_DISPLAY_TYPE), WID_DOC_REDLINE_DISPLAY, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_REDLINE_PROTECTION_KEY), WID_DOC_CHANGES_PASSWORD, CPPU_E2T(CPPUTYPE_SEQINT8), PROPERTY_NONE, 0 },
+ { SW_PROP_NMID(UNO_NAME_FORBIDDEN_CHARACTERS), WID_DOC_FORBIDDEN_CHARS, CPPU_E2T(CPPUTYPE_REFFORBCHARS), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_TWO_DIGIT_YEAR), WID_DOC_TWO_DIGIT_YEAR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_AUTOMATIC_CONTROL_FOCUS), WID_DOC_AUTOMATIC_CONTROL_FOCUS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_APPLY_FORM_DESIGN_MODE), WID_DOC_APPLY_FORM_DESIGN_MODE, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_LINK_TARGET:
+ {
+ static SfxItemPropertyMap aLinkTargetMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_BITMAP), 0, CPPU_E2T(CPPUTYPE_REFBITMAP), PropertyAttribute::READONLY, 0xff},
+ { SW_PROP_NMID(UNO_LINK_DISPLAY_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0xff},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aLinkTargetMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_AUTO_TEXT_GROUP :
+ {
+ static SfxItemPropertyMap aAutoTextGroupMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_FILE_PATH), WID_GROUP_PATH, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, PropertyAttribute::READONLY},
+ { SW_PROP_NMID(UNO_NAME_TITLE), WID_GROUP_TITLE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aAutoTextGroupMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXTPORTION_EXTENSIONS:
+ {
+ static SfxItemPropertyMap aTextPortionExtensionMap_Impl[] =
+ {
+ COMPLETE_TEXT_CURSOR_MAP
+ {SW_PROP_NMID(UNO_NAME_BOOKMARK), FN_UNO_BOOKMARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ {SW_PROP_NMID(UNO_NAME_CONTROL_CHARACTER), FN_UNO_CONTROL_CHARACTER, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, MID_HYPHEN_MIN_LEAD },
+ {SW_PROP_NMID(UNO_NAME_IS_COLLAPSED), FN_UNO_IS_COLLAPSED, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ {SW_PROP_NMID(UNO_NAME_IS_START), FN_UNO_IS_START, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ //_REDLINE_PROPERTIES
+ {SW_PROP_NMID(UNO_NAME_TEXT_PORTION_TYPE), FN_UNO_TEXT_PORTION_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTextPortionExtensionMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_FOOTNOTE:
+ {
+ static SfxItemPropertyMap aFootnoteMap_Impl[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_REFERENCE_ID), 0, CPPU_E2T(CPPUTYPE_INT16),PropertyAttribute::READONLY|PropertyAttribute::MAYBEVOID, 0},
+ COMMON_TEXT_CONTENT_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aFootnoteMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_COLUMS :
+ {
+ static SfxItemPropertyMap aTextColumns_Impl[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC), WID_TXTCOL_IS_AUTOMATIC, CPPU_E2T(CPPUTYPE_BOOLEAN),PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_AUTOMATIC_DISTANCE), WID_TXTCOL_AUTO_DISTANCE, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_WIDTH), WID_TXTCOL_LINE_WIDTH, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_COLOR), WID_TXTCOL_LINE_COLOR, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_RELATIVE_HEIGHT), WID_TXTCOL_LINE_REL_HGT, CPPU_E2T(CPPUTYPE_INT32),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_VERTIVAL_ALIGNMENT), WID_TXTCOL_LINE_ALIGN, CPPU_E2T(CPPUTYPE_VERTALIGN),PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEPARATOR_LINE_IS_ON), WID_TXTCOL_LINE_IS_ON, CPPU_E2T(CPPUTYPE_BOOLEAN),PROPERTY_NONE, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTextColumns_Impl;
+ }
+ break;
+ case PROPERTY_MAP_REDLINE :
+ {
+ static SfxItemPropertyMap aRedlineMap_Impl[] =
+ {
+ _REDLINE_PROPERTIES
+ _REDLINE_NODE_PROPERTIES
+ {SW_PROP_NMID(UNO_NAME_REDLINE_START), 0, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_REDLINE_END), 0, CPPU_E2T(CPPUTYPE_REFINTERFACE), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aRedlineMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_TEXT_DEFAULT :
+ {
+ static SfxItemPropertyMap aTextDefaultMap_Impl[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_TAB_STOP_DISTANCE), RES_PARATR_TABSTOP, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_STD_TAB | CONVERT_TWIPS},
+ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN
+ COMMON_HYPERLINK_PROPERTIES
+ { SW_PROP_NMID(UNO_NAME_CHAR_STYLE_NAME), RES_TXTATR_CHARFMT, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0}, \
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTextDefaultMap_Impl;
+ for( SfxItemPropertyMap * pMap = aTextDefaultMap_Impl;
+ pMap->pName; ++pMap )
+ {
+ // UNO_NAME_PAGE_DESC_NAME should keep its MAYBEVOID flag
+ if (!(RES_PAGEDESC == pMap->nWID && MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId))
+ pMap->nFlags &= ~PropertyAttribute::MAYBEVOID;
+ }
+ }
+ break;
+ case PROPERTY_MAP_REDLINE_PORTION :
+ {
+ static SfxItemPropertyMap aRedlinePortionMap_Impl[] =
+ {
+ COMPLETE_TEXT_CURSOR_MAP
+ {SW_PROP_NMID(UNO_NAME_BOOKMARK), FN_UNO_BOOKMARK, CPPU_E2T(CPPUTYPE_REFTEXTCNTNT), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY ,0 },
+ {SW_PROP_NMID(UNO_NAME_CONTROL_CHARACTER), FN_UNO_CONTROL_CHARACTER, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, MID_HYPHEN_MIN_LEAD },
+ {SW_PROP_NMID(UNO_NAME_IS_COLLAPSED), FN_UNO_IS_COLLAPSED, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ {SW_PROP_NMID(UNO_NAME_IS_START), FN_UNO_IS_START, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, 0 },
+ _REDLINE_PROPERTIES
+ {SW_PROP_NMID(UNO_NAME_TEXT_PORTION_TYPE), FN_UNO_TEXT_PORTION_TYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aRedlinePortionMap_Impl;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATETIME:
+ {
+ static SfxItemPropertyMap aDateTimeFieldPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_ADJUST), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DATE_TIME, CPPU_E2T(CPPUTYPE_DATETIME), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_IS_DATE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDateTimeFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_USER :
+ {
+ static SfxItemPropertyMap aUserFieldPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+
+ aMapArr[nPropertyId] = aUserFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_SET_EXP :
+ {
+ static SfxItemPropertyMap aSetExpFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_INPUT), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL3, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ //TODO: UNO_NAME_VARIABLE_NAME gibt es das wirklich?
+ {SW_PROP_NMID(UNO_NAME_SEQUENCE_VALUE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_VARIABLE_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aSetExpFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_GET_EXP :
+ {
+ static SfxItemPropertyMap aGetExpFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_VARIABLE_SUBTYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aGetExpFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_FILE_NAME:
+ {
+ static SfxItemPropertyMap aFileNameFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_FILE_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aFileNameFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_PAGE_NUM :
+ {
+ static SfxItemPropertyMap aPageNumFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_OFFSET), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_PAGENUMTYPE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_USERTEXT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aPageNumFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_AUTHOR :
+ {
+ static SfxItemPropertyMap aAuthorFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_FULL_NAME),FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aAuthorFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_CHAPTER :
+ {
+ static SfxItemPropertyMap aChapterFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CHAPTER_FORMAT),FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_LEVEL ),FIELD_PROP_BYTE1, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aChapterFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_GET_REFERENCE :
+ {
+ static SfxItemPropertyMap aGetRefFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_REFERENCE_FIELD_PART),FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_REFERENCE_FIELD_SOURCE),FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SEQUENCE_NUMBER), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SOURCE_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aGetRefFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_CONDITIONED_TEXT :
+ {
+ static SfxItemPropertyMap aConditionedTxtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_FALSE_CONTENT), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_CONDITION_TRUE) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_TRUE_CONTENT) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aConditionedTxtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_HIDDEN_TEXT :
+ {
+ static SfxItemPropertyMap aHiddenTxtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_HIDDEN) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aHiddenTxtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_ANNOTATION :
+ {
+ static SfxItemPropertyMap aAnnotationFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE), FIELD_PROP_DATE, CPPU_E2T(CPPUTYPE_DATE), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aAnnotationFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_INPUT:
+ {
+ static SfxItemPropertyMap aInputFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aInputFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_MACRO :
+ {
+ static SfxItemPropertyMap aMacroFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_MACRO_NAME),FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_MACRO_LIBRARY),FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING),PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aMacroFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DDE :
+ {
+ static SfxItemPropertyMap aDDEFieldPropMap [] =
+ {
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDDEFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DROPDOWN :
+ {
+ static SfxItemPropertyMap aDropDownMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_ITEMS), FIELD_PROP_STRINGS, CPPU_E2T(CPPUTYPE_OUSTRINGS), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SELITEM), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDropDownMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_HIDDEN_PARA :
+ {
+ static SfxItemPropertyMap aHiddenParaFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION),FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_HIDDEN) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aHiddenParaFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOC_INFO :
+ {
+ static SfxItemPropertyMap aDocInfoFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INFO_FORMAT), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INFO_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocInfoFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_TEMPLATE_NAME :
+ {
+ static SfxItemPropertyMap aTmplNameFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_FILE_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTmplNameFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_USER_EXT :
+ {
+ static SfxItemPropertyMap aUsrExtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_USER_DATA_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId]= aUsrExtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_REF_PAGE_SET :
+ {
+ static SfxItemPropertyMap aRefPgSetFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_OFFSET), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_ON), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aRefPgSetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_REF_PAGE_GET :
+ {
+ static SfxItemPropertyMap aRefPgGetFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aRefPgGetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_JUMP_EDIT :
+ {
+ static SfxItemPropertyMap aJumpEdtFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_HINT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_PLACEHOLDER), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_PLACEHOLDER_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aJumpEdtFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_SCRIPT :
+ {
+ static SfxItemPropertyMap aScriptFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SCRIPT_TYPE), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_URL_CONTENT), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aScriptFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NEXT_SET :
+ {
+ static SfxItemPropertyMap aDBNextSetFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION) , FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDBNextSetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NUM_SET :
+ {
+ static SfxItemPropertyMap aDBNumSetFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONDITION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME ), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SET_NUMBER ), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDBNumSetFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_SET_NUM :
+ {
+ static SfxItemPropertyMap aDBSetNumFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SET_NUMBER ), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDBSetNumFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE :
+ {
+ static SfxItemPropertyMap aDBFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_DATA_BASE_FORMAT),FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDBFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DATABASE_NAME :
+ {
+ static SfxItemPropertyMap aDBNameFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_VISIBLE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDBNameFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCSTAT:
+ {
+ static SfxItemPropertyMap aDocstatFieldPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_TYPE), FIELD_PROP_USHORT2, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ // {UNO_NAME_STATISTIC_TYPE_ID,FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocstatFieldPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_AUTHOR:
+ {
+ static SfxItemPropertyMap aDocInfoAuthorPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_AUTHOR), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocInfoAuthorPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_DATE_TIME:
+ {
+ static SfxItemPropertyMap aDocInfoDateTimePropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_DATE), FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT),FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocInfoDateTimePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_EDIT_TIME :
+ {
+ static SfxItemPropertyMap aDocInfoEditTimePropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATE_TIME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT),FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED_LANGUAGE), FIELD_PROP_BOOL4, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocInfoEditTimePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_MISC:
+ {
+ static SfxItemPropertyMap aDocInfoStringContentPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocInfoStringContentPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DOCINFO_REVISION :
+ {
+ static SfxItemPropertyMap aDocInfoRevisionPropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_REVISION), FIELD_PROP_USHORT1, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_FIXED), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN) , PROPERTY_NONE,0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDocInfoRevisionPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_COMBINED_CHARACTERS:
+ {
+ static SfxItemPropertyMap aCombinedCharactersPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aCombinedCharactersPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_TABLE_FORMULA:
+ {
+ static SfxItemPropertyMap aTableFormulaPropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CURRENT_PRESENTATION), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SHOW_FORMULA), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBER_FORMAT), FIELD_PROP_FORMAT, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTableFormulaPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_DUMMY_0:
+ {
+ static SfxItemPropertyMap aEmptyPropMap [] =
+ {
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aEmptyPropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_USER :
+ {
+ static SfxItemPropertyMap aUserFieldTypePropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_EXPRESSION), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0},
+ {SW_PROP_NMID(UNO_NAME_VALUE), FIELD_PROP_DOUBLE, CPPU_E2T(CPPUTYPE_DOUBLE), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_CONTENT), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aUserFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DDE :
+ {
+ static SfxItemPropertyMap aDDEFieldTypePropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_ELEMENT ), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_FILE ), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DDE_COMMAND_TYPE ), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_AUTOMATIC_UPDATE), FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDDEFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_SET_EXP :
+ {
+ static SfxItemPropertyMap aSetExpFieldTypePropMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_CHAPTER_NUMBERING_LEVEL),FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT8), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_NUMBERING_SEPARATOR), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SUB_TYPE), FIELD_PROP_SUBTYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aSetExpFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DATABASE :
+ {
+ static SfxItemPropertyMap aDBFieldTypePropMap [] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DATA_BASE_NAME ), FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COMMAND_TYPE), FIELD_PROP_SHORT1, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_TABLE_NAME ), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DATA_COLUMN_NAME ), FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aDBFieldTypePropMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_DUMMY0 :
+ {
+ static SfxItemPropertyMap aStandardFieldMasterMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_DEPENDENT_TEXT_FIELDS), 0, CPPU_E2T(CPPUTYPE_SEQDEPTXTFLD), PropertyAttribute::READONLY, 0},
+ {SW_PROP_NMID(UNO_NAME_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), 0, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aStandardFieldMasterMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDTYP_BIBLIOGRAPHY:
+ {
+ static SfxItemPropertyMap aBibliographyFieldMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_FIELDS ) , FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_PROPERTYVALUE),PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aBibliographyFieldMap;
+ }
+ break;
+ case PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY:
+ {
+ static SfxItemPropertyMap aBibliographyFieldMasterMap[] =
+ {
+ {SW_PROP_NMID(UNO_NAME_BRACKET_BEFORE ) , FIELD_PROP_PAR1, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_BRACKET_AFTER ) , FIELD_PROP_PAR2, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_NUMBER_ENTRIES ) , FIELD_PROP_BOOL1, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_IS_SORT_BY_POSITION) , FIELD_PROP_BOOL2, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_LOCALE), FIELD_PROP_LOCALE, CPPU_E2T(CPPUTYPE_LOCALE) , PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SORT_ALGORITHM), FIELD_PROP_PAR3, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_SORT_KEYS ) , FIELD_PROP_PROP_SEQ, CPPU_E2T(CPPUTYPE_PROPERTYVALUES), PROPERTY_NONE, 0},
+ {SW_PROP_NMID(UNO_NAME_INSTANCE_NAME), FIELD_PROP_PAR4, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aBibliographyFieldMasterMap;
+ }
+ break;
+ case PROPERTY_MAP_TEXT :
+ {
+ static SfxItemPropertyMap aTextMap[] =
+ {
+ _REDLINE_NODE_PROPERTIES
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aTextMap;
+ }
+ break;
+ case PROPERTY_MAP_MAILMERGE :
+ {
+ static SfxItemPropertyMap aMailMergeMap[] =
+ {
+ { SW_PROP_NMID(UNO_NAME_SELECTION), WID_SELECTION, CPPU_E2T(CPPUTYPE_SEQANY), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_RESULT_SET), WID_RESULT_SET, CPPU_E2T(CPPUTYPE_REFRESULTSET), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_CONNECTION), WID_CONNECTION, CPPU_E2T(CPPUTYPE_REFCONNECTION), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_MODEL), WID_MODEL, CPPU_E2T(CPPUTYPE_REFMODEL), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_DATA_SOURCE_NAME), WID_DATA_SOURCE_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DAD_COMMAND), WID_DATA_COMMAND, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILTER), WID_FILTER, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DOCUMENT_URL), WID_DOCUMENT_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_OUTPUT_URL), WID_OUTPUT_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_DAD_COMMAND_TYPE), WID_DATA_COMMAND_TYPE, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_OUTPUT_TYPE), WID_OUTPUT_TYPE, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_ESCAPE_PROCESSING), WID_ESCAPE_PROCESSING, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_SINGLE_PRINT_JOBS), WID_SINGLE_PRINT_JOBS, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILE_NAME_FROM_COLUMN), WID_FILE_NAME_FROM_COLUMN, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+ { SW_PROP_NMID(UNO_NAME_FILE_NAME_PREFIX), WID_FILE_NAME_PREFIX, CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ aMapArr[nPropertyId] = aMailMergeMap;
+ }
+ break;
+
+ default:
+ DBG_ERROR( "unexpected property map ID" );
+ }
+ Sort(nPropertyId);
+ }
+ return aMapArr[nPropertyId];
+}
+/* -----------------04.07.98 11:42-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwItemPropertySet::FillItem(SfxItemSet& rSet, sal_uInt16 nWhich, sal_Bool bGetProperty) const
+{
+ sal_Bool bRet = sal_False;
+/* if(nWhich == SID_ATTR_PAGE_PAPERBIN)
+ {
+ rSet.Put(SvxPaperBinItem(SID_ATTR_PAGE_PAPERBIN, 0));
+ bRet = sal_True;
+ }*/
+ return bRet;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoobj.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoobj.cxx
new file mode 100644
index 000000000000..5c9fbee04afa
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoobj.cxx
@@ -0,0 +1,2193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+
+#include <rtl/ustrbuf.hxx>
+#include <swtypes.hxx>
+#include <hintids.hxx>
+#include <cmdid.h>
+#include <hints.hxx>
+#include <bookmrk.hxx>
+#include <frmfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx>
+#include <ndnotxt.hxx>
+#include <unocrsrhelper.hxx>
+#include <unocrsr.hxx>
+#include <rootfrm.hxx>
+#include <flyfrm.hxx>
+#include <ftnidx.hxx>
+#include <bf_so3/linkmgr.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <tools/urlobj.hxx>
+#include <pam.hxx>
+#include <tools/cachestr.hxx>
+#include <shellio.hxx>
+#include <swerror.h>
+#include <swtblfmt.hxx>
+#include <fmtruby.hxx>
+#include <fmthbsh.hxx>
+#include <docsh.hxx>
+#include <bf_svtools/style.hxx>
+#include <docstyle.hxx>
+#include <charfmt.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hrc>
+#include <poolfmt.hxx>
+#include <viscrs.hxx>
+#include <edimp.hxx>
+#include <fchrfmt.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <doctxm.hxx>
+#include <tox.hxx>
+#include <bf_sfx2/docfilt.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <bf_sfx2/fcontnr.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <unoclbck.hxx>
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unomid.h>
+#include <unosett.hxx>
+#include <unoprnms.hxx>
+#include <unotbl.hxx>
+#include <unodraw.hxx>
+#include <unocoll.hxx>
+#include <unostyle.hxx>
+#include <unofield.hxx>
+#include <fmtanchr.hxx>
+#include <bf_svx/flstitem.hxx>
+#include <bf_svtools/ctrltool.hxx>
+#include <bf_svtools/eitem.hxx>
+#include <flypos.hxx>
+#include <txtftn.hxx>
+#include <section.hxx>
+#include <fmtftn.hxx>
+
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <fmthdft.hxx>
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtflcnt.hxx>
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#include <bf_svtools/svstdarr.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svtools/stritem.hxx>
+#include <fmtclds.hxx>
+#include <rtl/uuid.h>
+#include <dcontact.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <crsskip.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <memory>
+#include <osl/endian.h>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::drawing;
+using std::auto_ptr;
+using namespace ::rtl;
+
+//collectn.cxx
+//BOOL lcl_IsNumeric(const String&);
+/****************************************************************************
+ static methods
+****************************************************************************/
+::com::sun::star::uno::Sequence< sal_Int8 > CreateUnoTunnelId()
+{
+ static osl::Mutex aCreateMutex;
+ osl::Guard<osl::Mutex> aGuard( aCreateMutex );
+ uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ return aSeq;
+}
+/****************************************************************************
+ Hilfsklassen
+****************************************************************************/
+
+SwParaSelection::SwParaSelection(SwUnoCrsr* pCrsr) :
+ pUnoCrsr(pCrsr)
+{
+ if(pUnoCrsr->HasMark())
+ pUnoCrsr->DeleteMark();
+ // steht er schon am Anfang?
+ if(pUnoCrsr->GetPoint()->nContent != 0)
+ pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
+ // oder gleichzeitig am Ende?
+ if(pUnoCrsr->GetPoint()->nContent != pUnoCrsr->GetCntntNode()->Len())
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
+ }
+}
+
+SwParaSelection::~SwParaSelection()
+{
+ if(pUnoCrsr->GetPoint()->nContent != 0)
+ {
+ pUnoCrsr->DeleteMark();
+ pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
+ }
+}
+/* -----------------13.05.98 12:15-------------------
+ *
+ * --------------------------------------------------*/
+SwUnoInternalPaM::SwUnoInternalPaM(SwDoc& rDoc) :
+ SwPaM(rDoc.GetNodes())
+{
+}
+SwUnoInternalPaM::~SwUnoInternalPaM()
+{
+ while( GetNext() != this)
+ {
+ delete GetNext();
+ }
+}
+
+SwUnoInternalPaM& SwUnoInternalPaM::operator=(const SwPaM& rPaM)
+{
+ const SwPaM* pTmp = &rPaM;
+ *GetPoint() = *rPaM.GetPoint();
+ if(rPaM.HasMark())
+ {
+ SetMark();
+ *GetMark() = *rPaM.GetMark();
+ }
+ else
+ DeleteMark();
+ while(&rPaM != (pTmp = (const SwPaM*)pTmp->GetNext()))
+ {
+ if(pTmp->HasMark())
+ new SwPaM(*pTmp->GetMark(), *pTmp->GetPoint(), this);
+ else
+ new SwPaM(*pTmp->GetPoint(), this);
+ }
+ return *this;
+}
+/****************************************************************************
+ ActionContext
+****************************************************************************/
+UnoActionContext::UnoActionContext(SwDoc* pDc) :
+ pDoc(pDc)
+{
+ SwRootFrm* pRootFrm = pDoc->GetRootFrm();
+ if(pRootFrm)
+ pRootFrm->StartAllAction();
+}
+/*-----------------04.03.98 11:56-------------------
+
+--------------------------------------------------*/
+UnoActionContext::~UnoActionContext()
+{
+ //das Doc kann hier schon entfernt worden sein
+ if(pDoc)
+ {
+ SwRootFrm* pRootFrm = pDoc->GetRootFrm();
+ if(pRootFrm)
+ pRootFrm->EndAllAction();
+ }
+}
+
+/****************************************************************************
+ ActionRemoveContext
+****************************************************************************/
+UnoActionRemoveContext::UnoActionRemoveContext(SwDoc* pDc) :
+ pDoc(pDc)
+{
+ SwRootFrm* pRootFrm = pDoc->GetRootFrm();
+ if(pRootFrm)
+ pRootFrm->UnoRemoveAllActions();
+}
+/* -----------------07.07.98 12:05-------------------
+ *
+ * --------------------------------------------------*/
+UnoActionRemoveContext::~UnoActionRemoveContext()
+{
+ SwRootFrm* pRootFrm = pDoc->GetRootFrm();
+ if(pRootFrm)
+ pRootFrm->UnoRestoreAllActions();
+
+}
+
+/*-----------------09.03.98 08:29-------------------
+
+--------------------------------------------------*/
+void SwXTextCursor::SelectPam(SwPaM& rCrsr, sal_Bool bExpand)
+{
+ if(bExpand)
+ {
+ if(!rCrsr.HasMark())
+ rCrsr.SetMark();
+ }
+ else if(rCrsr.HasMark())
+ rCrsr.DeleteMark();
+
+}
+/* -----------------20.05.98 14:59-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextCursor::getTextFromPam(SwPaM& aCrsr, OUString& rBuffer)
+{
+ if(!aCrsr.HasMark())
+ return;
+ SvCacheStream aStream( 20480 );
+#ifdef OSL_BIGENDIAN
+ aStream.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+#else
+ aStream.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+#endif
+ WriterRef xWrt;
+ SwIoSystem::GetWriter( C2S(FILTER_TEXT_DLG), xWrt );
+ if( xWrt.Is() )
+ {
+ SwWriter aWriter( aStream, aCrsr );
+ xWrt->bASCII_NoLastLineEnd = sal_True;
+ SwAsciiOptions aOpt = xWrt->GetAsciiOptions();
+ aOpt.SetCharSet( RTL_TEXTENCODING_UNICODE );
+ xWrt->SetAsciiOptions( aOpt );
+ xWrt->bUCS2_WithStartChar = FALSE;
+
+ long lLen;
+ if( !IsError( aWriter.Write( xWrt ) ) &&
+ STRING_MAXLEN > (( lLen = aStream.GetSize() )
+ / sizeof( sal_Unicode )) + 1 )
+ {
+ aStream << (sal_Unicode)'\0';
+
+ String sBuf;
+ const sal_Unicode *p = (sal_Unicode*)aStream.GetBuffer();
+ if( p )
+ sBuf = p;
+ else
+ {
+ long lUniLen = (lLen / sizeof( sal_Unicode ));
+ sal_Unicode* pStrBuf = sBuf.AllocBuffer( xub_StrLen(
+ lUniLen + 1));
+ aStream.Seek( 0 );
+ aStream.ResetError();
+ aStream.Read( pStrBuf, lLen );
+ pStrBuf[ lUniLen ] = '\0';
+ }
+ rBuffer = OUString( sBuf );
+ }
+ }
+}
+
+/* -----------------06.07.98 07:33-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_setCharStyle(SwDoc* pDoc, const uno::Any aValue, SfxItemSet& rSet)
+ throw (lang::IllegalArgumentException)
+{
+ SwDocShell* pDocSh = pDoc->GetDocShell();
+ if(pDocSh)
+ {
+ OUString uStyle;
+ aValue >>= uStyle;
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, GET_POOLID_CHRFMT, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
+ if(pStyle)
+ {
+ SwFmtCharFmt aFmt(pStyle->GetCharFmt());
+ rSet.Put(aFmt);
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ }
+};
+/* -----------------30.06.98 08:46-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_SetTxtFmtColl(const uno::Any& rAny, SwPaM& rPaM)
+ throw (lang::IllegalArgumentException)
+{
+ SwDoc* pDoc = rPaM.GetDoc();
+ SwDocShell* pDocSh = pDoc->GetDocShell();
+ if(!pDocSh)
+ return;
+ OUString uStyle;
+ rAny >>= uStyle;
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, GET_POOLID_TXTCOLL, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDocSh->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_PARA);
+ if(pStyle)
+ {
+ SwTxtFmtColl *pLocal = pStyle->GetCollection();
+ UnoActionContext aAction(pDoc);
+ FOREACHUNOPAM_START(&rPaM)
+ pDoc->SetTxtFmtColl(*PUNOPAM, pLocal);
+ FOREACHUNOPAM_END()
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+}
+/* -----------------06.07.98 07:38-------------------
+ *
+ * --------------------------------------------------*/
+ void lcl_setPageDesc(SwDoc* pDoc, const uno::Any& aValue, SfxItemSet& rSet)
+ {
+ if(aValue.getValueType() != ::getCppuType((const OUString*)0))
+ return;
+ SwFmtPageDesc *pNewDesc = 0 ;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
+ {
+ pNewDesc = new SwFmtPageDesc(*((SwFmtPageDesc*)pItem));
+ }
+ if(!pNewDesc)
+ pNewDesc = new SwFmtPageDesc();
+ OUString uDescName;
+ aValue >>= uDescName;
+ String sDescName;
+ SwStyleNameMapper::FillUIName(uDescName, sDescName, GET_POOLID_PAGEDESC, sal_True );
+ if(!pNewDesc->GetPageDesc() || pNewDesc->GetPageDesc()->GetName() != sDescName)
+ {
+ sal_uInt16 nCount = pDoc->GetPageDescCnt();
+ sal_Bool bPut = sal_False;
+ if(sDescName.Len())
+ {
+ SwPageDesc* pPageDesc = ::binfilter::GetPageDescByName_Impl(*pDoc, sDescName);
+ if(pPageDesc)
+ {
+ pPageDesc->Add( pNewDesc );
+ bPut = sal_True;
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+ if(!bPut)
+ {
+ rSet.ClearItem(RES_BREAK);
+ rSet.Put(SwFmtPageDesc());
+ }
+ else
+ rSet.Put(*pNewDesc);
+ }
+ delete pNewDesc;
+}
+/* -----------------30.06.98 10:29-------------------
+ *
+ * --------------------------------------------------*/
+void lcl_SetNodeNumStart( SwPaM& rCrsr, uno::Any aValue )
+{
+ sal_Int16 nTmp;
+ aValue >>= nTmp;
+ sal_uInt16 nStt = (nTmp < 0 ? USHRT_MAX : (sal_uInt16)nTmp);
+ SwDoc* pDoc = rCrsr.GetDoc();
+ UnoActionContext aAction(pDoc);
+
+ if( rCrsr.GetNext() != &rCrsr ) // Mehrfachselektion ?
+ {
+ SwPamRanges aRangeArr( rCrsr );
+ SwPaM aPam( *rCrsr.GetPoint() );
+ for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
+ pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt );
+ }
+ else
+ pDoc->SetNodeNumStart( *rCrsr.GetPoint(), nStt );
+}
+
+/* -----------------17.09.98 09:44-------------------
+ *
+ * --------------------------------------------------*/
+class SwTextCursorItemSet_Impl
+{
+ SwDoc *pDoc;
+ SfxItemSet* pItemSet;
+ sal_uInt16 nWhich;
+ sal_Bool bGotAttrs;
+
+public:
+ SwTextCursorItemSet_Impl( SwDoc *pD, sal_uInt16 nW ) :
+ pDoc( pD ), nWhich( nW ), pItemSet(0), bGotAttrs( sal_False ) {}
+ ~SwTextCursorItemSet_Impl()
+ {delete pItemSet;}
+
+ SfxItemSet& GetItemSet( SwPaM *pPaM=0 )
+ {
+ if( !pItemSet )
+ pItemSet = new SfxItemSet( pDoc->GetAttrPool(), nWhich, nWhich );
+ if( pPaM && !bGotAttrs )
+ {
+ SwXTextCursor::GetCrsrAttr( *pPaM, *pItemSet );
+ bGotAttrs = sal_True;
+ }
+ return *pItemSet;
+ }
+
+ SfxItemSet *GetItemSetPtr() { return pItemSet; }
+};
+
+sal_Bool lcl_setCrsrPropertyValue(const SfxItemPropertyMap* pMap,
+ SwPaM& rPam,
+ SwTextCursorItemSet_Impl& rSet,
+ const uno::Any& aValue ) throw (lang::IllegalArgumentException)
+{
+ sal_Bool bRet = sal_True;
+ if(0 ==(pMap->nFlags&PropertyAttribute::MAYBEVOID) &&
+ aValue.getValueType() == ::getCppuVoidType())
+ bRet = sal_False;
+ else
+ {
+ switch(pMap->nWID)
+ {
+ case RES_TXTATR_CHARFMT:
+ lcl_setCharStyle(rPam.GetDoc(), aValue, rSet.GetItemSet() );
+ break;
+ case FN_UNO_CHARFMT_SEQUENCE:
+ {
+ Sequence<OUString> aCharStyles;
+ if(aValue >>= aCharStyles)
+ {
+ for(sal_Int32 nStyle = 0; nStyle < aCharStyles.getLength(); nStyle++)
+ {
+ Any aStyle;
+ aStyle <<= aCharStyles.getConstArray()[nStyle];
+ //create a local set and apply each format directly
+ SfxItemSet aSet(rPam.GetDoc()->GetAttrPool(), RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT );
+ lcl_setCharStyle(rPam.GetDoc(), aStyle, aSet );
+ //the first style should replace the current attributes, all other have to be added
+ SwXTextCursor::SetCrsrAttr(rPam, aSet, nStyle ? CRSR_ATTR_MODE_DONTREPLACE : 0);
+ }
+ }
+ else
+ bRet = sal_False;
+ }
+ break;
+ case FN_UNO_PARA_STYLE :
+ lcl_SetTxtFmtColl(aValue, rPam);
+ break;
+ case FN_UNO_PAGE_STYLE :
+ break;
+ case FN_UNO_NUM_START_VALUE :
+ lcl_SetNodeNumStart( rPam, aValue );
+ break;
+ case FN_UNO_NUM_LEVEL :
+ case FN_UNO_IS_NUMBER :
+ {
+ SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
+ const SwNumRule* pRule = pTxtNd->GetNumRule();
+ // hier wird Multiselektion nicht beruecksichtigt
+ if( pRule && pTxtNd->GetNum() )
+ {
+ if( FN_UNO_NUM_LEVEL == pMap->nWID)
+ {
+ sal_Int16 nLevel;
+ aValue >>= nLevel;
+ sal_Int16 nOldLevel = pTxtNd->GetNum()->GetLevel() & ~NO_NUMLEVEL;
+ if(nLevel < MAXLEVEL && nOldLevel != nLevel)
+ {
+ UnoActionContext aAction(rPam.GetDoc());
+ sal_Bool bDown = nLevel > nOldLevel;
+ sal_Int8 nMove = (sal_Int8)(bDown ? nLevel - nOldLevel : nOldLevel - nLevel);
+ while( nMove-- )
+ {
+ rPam.GetDoc()->NumUpDown( rPam, bDown );
+ }
+ }
+ }
+ else
+ {
+ BOOL bIsNumber = *(sal_Bool*) aValue.getValue();
+ SwNodeNum aNum = *pTxtNd->GetNum();
+ sal_Int16 nOldLevel = aNum.GetLevel() & ~NO_NUMLEVEL;
+ if(!bIsNumber)
+ nOldLevel |= NO_NUMLEVEL;
+ aNum.SetLevel(nOldLevel);
+ pTxtNd->UpdateNum( aNum );
+
+ }
+ }
+ //PROPERTY_MAYBEVOID!
+ }
+ break;
+ case FN_NUMBER_NEWSTART :
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ rPam.GetDoc()->SetNumRuleStart(*rPam.GetPoint(), bVal);
+ }
+ break;
+ case FN_UNO_NUM_RULES:
+ SwUnoCursorHelper::setNumberingProperty(aValue, rPam);
+ break;
+ case RES_PARATR_DROP:
+ {
+ if( MID_DROPCAP_CHAR_STYLE_NAME == pMap->nMemberId)
+ {
+ OUString uStyle;
+ if(aValue >>= uStyle)
+ {
+ SfxItemSet& rItemSet = rSet.GetItemSet( &rPam );
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, GET_POOLID_CHRFMT, sal_True );
+ SwDoc* pDoc = rPam.GetDoc();
+ //default character style mustn't be set as default format
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
+ SwFmtDrop* pDrop = 0;
+ if(pStyle &&
+ ((SwDocStyleSheet*)pStyle)->GetCharFmt() != pDoc->GetDfltCharFmt())
+ {
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rItemSet.GetItemState( RES_PARATR_DROP, sal_True, &pItem ) )
+ pDrop = new SwFmtDrop(*((SwFmtDrop*)pItem));
+ if(!pDrop)
+ pDrop = new SwFmtDrop();
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pStyle );
+ pDrop->SetCharFmt(aStyle.GetCharFmt());
+ }
+ else
+ throw lang::IllegalArgumentException();
+ rItemSet.Put(*pDrop);
+ delete pDrop;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else
+ bRet = sal_False;
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ if(MID_RUBY_CHARSTYLE == pMap->nMemberId )
+ {
+ OUString sTmp;
+ if(aValue >>= sTmp)
+ {
+ SfxItemSet& rItemSet = rSet.GetItemSet( &rPam );
+ SwFmtRuby* pRuby = 0;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rItemSet.GetItemState( RES_TXTATR_CJK_RUBY, sal_True, &pItem ) )
+ pRuby = new SwFmtRuby(*((SwFmtRuby*)pItem));
+ if(!pRuby)
+ pRuby = new SwFmtRuby(aEmptyStr);
+ String sStyle;
+ SwStyleNameMapper::FillUIName(sTmp, sStyle, GET_POOLID_CHRFMT, sal_True );
+ pRuby->SetCharFmtName( sStyle );
+ pRuby->SetCharFmtId( 0 );
+ if(sStyle.Len() > 0)
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sStyle, GET_POOLID_CHRFMT );
+ pRuby->SetCharFmtId(nId);
+ }
+ rItemSet.Put(*pRuby);
+ delete pRuby;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ bRet = sal_True;
+ }
+ else
+ bRet = sal_False;
+ break;
+ case RES_PAGEDESC :
+ if(MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId )
+ {
+ SfxItemSet& rItemSet = rSet.GetItemSet( &rPam );
+ lcl_setPageDesc(rPam.GetDoc(), aValue, rItemSet);
+ break;
+ }
+ //hier kein break
+ default: bRet = sal_False;
+ }
+ }
+return bRet;
+}
+
+/* -----------------30.06.98 08:39-------------------
+ *
+ * --------------------------------------------------*/
+SwFmtColl* SwXTextCursor::GetCurTxtFmtColl(SwPaM& rPam, BOOL bConditional)
+{
+ static const sal_uInt16 nMaxLookup = 1000;
+ SwFmtColl *pFmt = 0;
+
+ sal_Bool bError = sal_False;
+ FOREACHUNOPAM_START(&rPam)
+
+ sal_uInt32 nSttNd = PUNOPAM->GetMark()->nNode.GetIndex(),
+ nEndNd = PUNOPAM->GetPoint()->nNode.GetIndex();
+ xub_StrLen nSttCnt = PUNOPAM->GetMark()->nContent.GetIndex(),
+ nEndCnt = PUNOPAM->GetPoint()->nContent.GetIndex();
+
+ if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
+ {
+ sal_uInt32 nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
+ nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (sal_uInt16)nTmp;
+ }
+
+ if( nEndNd - nSttNd >= nMaxLookup )
+ {
+ pFmt = 0;
+ break;
+ }
+
+ const SwNodes& rNds = rPam.GetDoc()->GetNodes();
+ for( ULONG n = nSttNd; n <= nEndNd; ++n )
+ {
+ const SwTxtNode* pNd = rNds[ n ]->GetTxtNode();
+ if( pNd )
+ {
+ SwFmtColl* pNdFmt = bConditional ? pNd->GetFmtColl()
+ : &pNd->GetAnyFmtColl();
+ if( !pFmt )
+ pFmt = pNdFmt;
+ else if( pFmt != pNdFmt )
+ {
+ bError = sal_True;
+ break;
+ }
+ }
+ }
+ if(bError)
+ break;
+ FOREACHUNOPAM_END()
+ return bError ? 0 : pFmt;
+}
+
+/* -----------------26.06.98 16:20-------------------
+ * Hilfsfunktion fuer PageDesc
+ * --------------------------------------------------*/
+ SwPageDesc* GetPageDescByName_Impl(SwDoc& rDoc, const String& rName)
+ {
+ SwPageDesc* pRet = 0;
+ sal_uInt16 nDCount = rDoc.GetPageDescCnt();
+ sal_uInt16 i=0;
+ for( i = 0; i < nDCount; i++ )
+ {
+ SwPageDesc* pDsc = &rDoc._GetPageDesc( i );
+ if(pDsc->GetName() == rName)
+ {
+ pRet = pDsc;
+ break;
+ }
+ }
+ if(!pRet)
+ {
+ for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_ENDNOTE; ++i)
+ {
+ const String aFmtName(SW_RES(i));
+ if(aFmtName == rName)
+ {
+ pRet = rDoc.GetPageDescFromPool( RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN );
+ break;
+ }
+ }
+ }
+
+ return pRet;
+ }
+/******************************************************************************
+ ******************************************************************************
+ ******************************************************************************
+ * Taskforce ONE51
+ ******************************************************************************/
+
+/******************************************************************
+ * SwXTextCursor
+ ******************************************************************/
+/*-- 09.12.98 14:19:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextCursor::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextCursor");
+}
+/*-- 09.12.98 14:19:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwXTextCursor::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return sServiceName.EqualsAscii("com.sun.star.text.TextCursor") ||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterProperties")||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesAsian")||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesComplex")||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphProperties") ||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesComplex") ||
+ sServiceName.EqualsAscii("com.sun.star.text.TextSortable");
+}
+/*-- 09.12.98 14:19:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXTextCursor::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(8);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextCursor");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ pArray[7] = C2U("com.sun.star.text.TextSortable");
+ return aRet;
+}
+/*-- 09.12.98 14:19:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextCursor::SwXTextCursor(uno::Reference< XText > xParent, const SwPosition& rPos,
+ CursorType eSet, SwDoc* pDoc, const SwPosition* pMark) :
+ aLstnrCntnr(( util::XSortable*)this),
+ xParentText(xParent),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)),
+ pLastSortOptions(0),
+ eType(eSet)
+{
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(rPos, sal_False);
+ if(pMark)
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *pMark;
+ }
+ pUnoCrsr->Add(this);
+}
+/* -----------------04.03.99 09:02-------------------
+ *
+ * --------------------------------------------------*/
+SwXTextCursor::SwXTextCursor(uno::Reference< XText > xParent,
+ SwUnoCrsr* pSourceCrsr, CursorType eSet) :
+ aLstnrCntnr( (util::XSortable*)this),
+ xParentText(xParent),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)),
+ pLastSortOptions(0),
+ eType(eSet)
+{
+ SwUnoCrsr* pUnoCrsr = pSourceCrsr->GetDoc()->CreateUnoCrsr(*pSourceCrsr->GetPoint(), sal_False);
+ if(pSourceCrsr->HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *pSourceCrsr->GetMark();
+ }
+ pUnoCrsr->Add(this);
+}
+
+/*-- 09.12.98 14:19:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextCursor::~SwXTextCursor()
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ delete pUnoCrsr;
+ delete pLastSortOptions;
+}
+/*-- 09.12.98 14:19:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::DeleteAndInsert(const String& rText)
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ // Start/EndAction
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ UnoActionContext aAction(pDoc);
+ xub_StrLen nTxtLen = rText.Len();
+ SwCursor *_pStartCrsr = pUnoCrsr;
+ do
+ {
+ if(_pStartCrsr->HasMark())
+ {
+ pDoc->DeleteAndJoin(*_pStartCrsr);
+ }
+ if(nTxtLen)
+ {
+ //OPT: GetSystemCharSet
+ if( !pDoc->Insert(*_pStartCrsr, rText) )
+ {
+ ASSERT( sal_False, "Doc->Insert(Str) failed." )
+ }
+ SwXTextCursor::SelectPam(*pUnoCrsr, sal_True);
+ _pStartCrsr->Left(rText.Len(), CRSR_SKIP_CHARS);
+ }
+ } while( (_pStartCrsr=(SwCursor*)_pStartCrsr->GetNext()) != pUnoCrsr );
+ }
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextCursor::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextCursor::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return OTextCursorHelper::getSomething(rId);
+}
+
+/*-- 09.12.98 14:18:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::collapseToStart(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ if(pUnoCrsr->HasMark())
+ {
+ if(*pUnoCrsr->GetPoint() > *pUnoCrsr->GetMark())
+ pUnoCrsr->Exchange();
+ pUnoCrsr->DeleteMark();
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+/*-- 09.12.98 14:18:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::collapseToEnd(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ if(pUnoCrsr->HasMark())
+ {
+ if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
+ pUnoCrsr->Exchange();
+ pUnoCrsr->DeleteMark();
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+/*-- 09.12.98 14:18:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::isCollapsed(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_True;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr && pUnoCrsr->GetMark())
+ {
+ bRet = (*pUnoCrsr->GetPoint() == *pUnoCrsr->GetMark());
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::goLeft(sal_Int16 nCount, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = pUnoCrsr->Left( nCount, CRSR_SKIP_CHARS);
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::goRight(sal_Int16 nCount, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = pUnoCrsr->Right(nCount, CRSR_SKIP_CHARS);
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::gotoStart(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ if(eType == CURSOR_BODY)
+ {
+ pUnoCrsr->Move( fnMoveBackward, fnGoDoc );
+ //check, that the cursor is not in a table
+ SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while( pTblNode )
+ {
+ pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if(pCont)
+ pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
+ const SwStartNode* pTmp = pUnoCrsr->GetNode()->FindStartNode();
+ if(pTmp->IsSectionNode())
+ {
+ SwSectionNode* pSectionStartNode = (SwSectionNode*)pTmp;
+ if(pSectionStartNode->GetSection().IsHiddenFlag())
+ {
+ pCont = GetDoc()->GetNodes().GoNextSection(
+ &pUnoCrsr->GetPoint()->nNode, sal_True, sal_False);
+ if(pCont)
+ pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
+ }
+ }
+ }
+ else if(eType == CURSOR_FRAME ||
+ eType == CURSOR_TBLTEXT ||
+ eType == CURSOR_HEADER ||
+ eType == CURSOR_FOOTER ||
+ eType == CURSOR_FOOTNOTE||
+ eType == CURSOR_REDLINE)
+ {
+ pUnoCrsr->MoveSection( fnSectionCurr, fnSectionStart);
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+/*-- 09.12.98 14:18:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ if(eType == CURSOR_BODY)
+ pUnoCrsr->Move( fnMoveForward, fnGoDoc );
+ else if(eType == CURSOR_FRAME ||
+ eType == CURSOR_TBLTEXT ||
+ eType == CURSOR_HEADER ||
+ eType == CURSOR_FOOTER ||
+ eType == CURSOR_FOOTNOTE||
+ eType == CURSOR_REDLINE)
+ {
+ pUnoCrsr->MoveSection( fnSectionCurr, fnSectionEnd);
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+/* -----------------05.03.99 07:27-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextCursor::gotoRange(const uno::Reference< XTextRange > & xRange, sal_Bool bExpand )
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pOwnCursor = GetCrsr();
+ if(!pOwnCursor || !xRange.is())
+ {
+ throw uno::RuntimeException();
+ }
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwStartNodeType eSearchNodeType = SwNormalStartNode;
+ switch(eType)
+ {
+ case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
+ case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
+ case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
+ case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
+ case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ //case CURSOR_INVALID:
+ //case CURSOR_BODY:
+ }
+ const SwStartNode* pOwnStartNode = pOwnCursor->GetNode()->
+ FindSttNodeByType(eSearchNodeType);
+
+ const SwNode* pSrcNode = 0;
+ if(pCursor && pCursor->GetPaM())
+ {
+ pSrcNode = pCursor->GetPaM()->GetNode();
+ }
+ else if(pRange && pRange->GetBookmark())
+ {
+ SwBookmark* pBkm = pRange->GetBookmark();
+ pSrcNode = &pBkm->GetPos().nNode.GetNode();
+ }
+ const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : 0;
+
+ //SectionNodes ueberspringen
+ while(pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->FindStartNode();
+ }
+ while(pOwnStartNode && pOwnStartNode->IsSectionNode())
+ {
+ pOwnStartNode = pOwnStartNode->FindStartNode();
+ }
+ if(pOwnStartNode != pTmp)
+ {
+ throw uno::RuntimeException();
+ }
+
+ //jetzt muss die Selektion erweitert werden
+ if(bExpand)
+ {
+ // der Cursor soll alles einschliessen, was bisher von ihm und dem uebergebenen
+ // Range eingeschlossen wurde
+ SwPosition aOwnLeft(*pOwnCursor->GetPoint());
+ SwPosition aOwnRight(pOwnCursor->HasMark() ? *pOwnCursor->GetMark() : aOwnLeft);
+ if(aOwnRight < aOwnLeft)
+ {
+ SwPosition aTmp = aOwnLeft;
+ aOwnLeft = aOwnRight;
+ aOwnRight = aTmp;
+ }
+ SwPosition* pParamLeft;
+ SwPosition* pParamRight;
+ if(pCursor)
+ {
+ const SwPaM* pTmp = pCursor->GetPaM();
+ pParamLeft = new SwPosition(*pTmp->GetPoint());
+ pParamRight = new SwPosition(pTmp->HasMark() ? *pTmp->GetMark() : *pParamLeft);
+ }
+ else
+ {
+ SwBookmark* pBkm = pRange->GetBookmark();
+ pParamLeft = new SwPosition(pBkm->GetPos());
+ pParamRight = new SwPosition(pBkm->GetOtherPos() ? *pBkm->GetOtherPos() : *pParamLeft);
+ }
+ if(*pParamRight < *pParamLeft)
+ {
+ SwPosition* pTmp = pParamLeft;
+ pParamLeft = pParamRight;
+ pParamRight = pTmp;
+ }
+ // jetzt sind vier SwPositions da, zwei davon werden gebraucht, also welche?
+ if(aOwnRight < *pParamRight)
+ *pOwnCursor->GetPoint() = aOwnRight;
+ else
+ *pOwnCursor->GetPoint() = *pParamRight;
+ pOwnCursor->SetMark();
+ if(aOwnLeft < *pParamLeft)
+ *pOwnCursor->GetMark() = *pParamLeft;
+ else
+ *pOwnCursor->GetMark() = aOwnLeft;
+ delete pParamLeft;
+ delete pParamRight;
+ }
+ else
+ {
+ //der Cursor soll dem uebergebenen Range entsprechen
+ if(pCursor)
+ {
+ const SwPaM* pTmp = pCursor->GetPaM();
+ *pOwnCursor->GetPoint() = *pTmp->GetPoint();
+ if(pTmp->HasMark())
+ {
+ pOwnCursor->SetMark();
+ *pOwnCursor->GetMark() = *pTmp->GetMark();
+ }
+ else
+ pOwnCursor->DeleteMark();
+ }
+ else
+ {
+ SwBookmark* pBkm = pRange->GetBookmark();
+ *pOwnCursor->GetPoint() = pBkm->GetPos();
+ if(pBkm->GetOtherPos())
+ {
+ pOwnCursor->SetMark();
+ *pOwnCursor->GetMark() = *pBkm->GetOtherPos();
+ }
+ else
+ pOwnCursor->DeleteMark();
+ }
+ }
+}
+
+/*-- 09.12.98 14:18:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::isStartOfWord(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ bRet = pUnoCrsr->IsStartWord();
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::isEndOfWord(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ bRet = pUnoCrsr->IsEndWord();
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoNextWord(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ //Probleme gibt's noch mit einem Absatzanfang, an dem kein Wort beginnt.
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ //Absatzende?
+ if(pUnoCrsr->GetCntntNode() &&
+ pUnoCrsr->GetPoint()->nContent == pUnoCrsr->GetCntntNode()->Len())
+ bRet = pUnoCrsr->Right(1, CRSR_SKIP_CHARS);
+ else
+ {
+ bRet = pUnoCrsr->GoNextWord();
+ //if there is no next word within the current paragraph try to go to the start of the next paragraph
+ if(!bRet)
+ bRet = pUnoCrsr->MovePara(fnParaNext, fnParaStart);
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoPreviousWord(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ // hier machen Leerzeichen am Absatzanfang Probleme
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ //Absatzanfang ?
+ if(pUnoCrsr->GetPoint()->nContent == 0)
+ bRet = pUnoCrsr->Left(1, CRSR_SKIP_CHARS);
+ else
+ {
+ bRet = pUnoCrsr->GoPrevWord();
+ if(pUnoCrsr->GetPoint()->nContent == 0)
+ pUnoCrsr->Left(1, CRSR_SKIP_CHARS);
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoEndOfWord(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ if(!pUnoCrsr->IsEndWord())
+ {
+ bRet = pUnoCrsr->GoEndWord();
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoStartOfWord(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ sal_Bool bRet = FALSE;
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ if(!pUnoCrsr->IsStartWord())
+ {
+ bRet = pUnoCrsr->GoStartWord();
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ return bRet;
+}
+/*-- 09.12.98 14:18:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::isStartOfSentence(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ // start of paragraph?
+ bRet = pUnoCrsr->GetPoint()->nContent == 0;
+ // with mark ->no sentence start
+ if(!bRet && !pUnoCrsr->HasMark())
+ {
+ SwCursor aCrsr(*pUnoCrsr->GetPoint());
+ aCrsr.Right(1, CRSR_SKIP_CHARS);
+ if(aCrsr.GoSentence(SwCursor::START_SENT) &&
+ aCrsr.GetPoint()->nContent == pUnoCrsr->GetPoint()->nContent)
+ bRet = sal_True;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::isEndOfSentence(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ //start of paragraph?
+ bRet = pUnoCrsr->GetCntntNode() &&
+ pUnoCrsr->GetPoint()->nContent == pUnoCrsr->GetCntntNode()->Len();
+ // with mark->no sentence end
+ if(!bRet && !pUnoCrsr->HasMark())
+ {
+ SwCursor aCrsr(*pUnoCrsr->GetPoint());
+ aCrsr.Left( 1, CRSR_SKIP_CHARS);
+ if(aCrsr.GoSentence(SwCursor::END_SENT) && aCrsr.GetPoint()->nContent == pUnoCrsr->GetPoint()->nContent)
+ bRet = sal_True;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoNextSentence(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ BOOL bWasEOS = isEndOfSentence();
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = pUnoCrsr->GoSentence(SwCursor::NEXT_SENT);
+ if(!bRet)
+ bRet = pUnoCrsr->MovePara(fnParaNext, fnParaStart);
+
+ // if at the end of the sentence (i.e. at the space after the '.')
+ // advance to next word in order for GoSentence to work properly
+ // next time and have isStartOfSentence return true after this call
+ if (!pUnoCrsr->IsStartWord())
+ {
+ BOOL bNextWord = pUnoCrsr->GoNextWord();
+ if (bWasEOS && !bNextWord)
+ bRet = sal_False;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoPreviousSentence(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = pUnoCrsr->GoSentence(SwCursor::PREV_SENT);
+ if(!bRet)
+ {
+ if(0 != (bRet = pUnoCrsr->MovePara(fnParaPrev, fnParaStart)))
+ {
+ pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
+ //at the end of a paragraph move to the sentence end again
+ //
+ pUnoCrsr->GoSentence(SwCursor::PREV_SENT);
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/* -----------------15.10.99 08:24-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoStartOfSentence(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ // if we're at the para start then we wont move
+ // but bRet is also true if GoSentence failed but
+ // the start of the sentence is reached
+ bRet = SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr)
+ || pUnoCrsr->GoSentence(SwCursor::START_SENT) ||
+ SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr);
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/* -----------------15.10.99 08:24-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoEndOfSentence(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ // bRet is true if GoSentence() succeeded or if the
+ // MovePara() succeeded while the end of the para is
+ // not reached already
+ sal_Bool bAlreadyParaEnd = SwUnoCursorHelper::IsEndOfPara(*pUnoCrsr);
+ bRet = !bAlreadyParaEnd &&
+ (pUnoCrsr->GoSentence(SwCursor::END_SENT) ||
+ pUnoCrsr->MovePara(fnParaCurr, fnParaEnd));
+
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+
+/*-- 09.12.98 14:18:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::isStartOfParagraph(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ bRet = SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr);
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::isEndOfParagraph(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ bRet = SwUnoCursorHelper::IsEndOfPara(*pUnoCrsr);
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoStartOfParagraph(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr )
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr);
+ if(!bRet)
+ bRet = pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoEndOfParagraph(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = SwUnoCursorHelper::IsEndOfPara(*pUnoCrsr);
+ if(!bRet)
+ bRet = pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoNextParagraph(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = pUnoCrsr->MovePara(fnParaNext, fnParaStart);
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::gotoPreviousParagraph(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SelectPam(*pUnoCrsr, Expand);
+ bRet = pUnoCrsr->MovePara(fnParaPrev, fnParaStart);
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XText > SwXTextCursor::getText(void) throw( uno::RuntimeException )
+{
+ return xParentText;
+}
+/*-- 09.12.98 14:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextCursor::getStart(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextCursor*)this)->GetCrsr();
+ if( pUnoCrsr)
+ {
+ SwPaM aPam(*pUnoCrsr->Start());
+ uno::Reference< XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 09.12.98 14:18:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextCursor::getEnd(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextCursor*)this)->GetCrsr();
+ if( pUnoCrsr)
+ {
+ SwPaM aPam(*pUnoCrsr->End());
+ uno::Reference< XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 09.12.98 14:18:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextCursor::getString(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ OUString aTxt;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextCursor*)this)->GetCrsr();
+ if( pUnoCrsr)
+ {
+/* if( pUnoCrsr->GetPoint()->nNode.GetIndex() ==
+ pUnoCrsr->GetMark()->nNode.GetIndex() )
+ {
+ SwTxtNode* pTxtNd = pUnoCrsr->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ {
+ sal_uInt16 nStt = pUnoCrsr->Start()->nContent.GetIndex();
+ aTxt = pTxtNd->GetExpandTxt( nStt,
+ pUnoCrsr->End()->nContent.GetIndex() - nStt );
+ }
+ }
+ else
+*/ {
+ //Text ueber mehrere Absaetze
+ SwXTextCursor::getTextFromPam(*pUnoCrsr, aTxt);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aTxt;
+}
+/*-- 09.12.98 14:18:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ DeleteAndInsert(aString);
+}
+/* -----------------------------03.05.00 12:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Any SwXTextCursor::GetPropertyValue(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ Any aAny;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ rPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ PropertyState eTemp;
+ BOOL bDone = SwUnoCursorHelper::getCrsrPropertyValue( pMap, rPaM, &aAny, eTemp );
+ if(!bDone)
+ {
+ SfxItemSet aSet(rPaM.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_PARATR_NUMRULE,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_FILL_ORDER, RES_FRMATR_END -1,
+ 0L);
+ SwXTextCursor::GetCrsrAttr(rPaM, aSet);
+
+ aAny = rPropSet.getPropertyValue(*pMap, aSet);
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+
+ return aAny;
+}
+/* -----------------------------03.05.00 12:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextCursor::SetPropertyValue(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet, const OUString& rPropertyName,
+ const Any& aValue, const SfxItemPropertyMap* _pMap, USHORT nAttrMode)
+ throw (UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ Any aAny;
+
+ SwDoc* pDoc = rPaM.GetDoc();
+ const SfxItemPropertyMap* pMap = _pMap ? _pMap : SfxItemPropertyMap::GetByName(
+ rPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+ SwTextCursorItemSet_Impl aSet(pDoc, pMap->nWID );
+ if(!lcl_setCrsrPropertyValue( pMap, rPaM, aSet, aValue ))
+ rPropSet.setPropertyValue(*pMap, aValue, aSet.GetItemSet( &rPaM ) );
+ if( aSet.GetItemSetPtr() )
+ SwXTextCursor::SetCrsrAttr(rPaM, aSet.GetItemSet(), nAttrMode );
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+}
+/* -----------------------------03.05.00 13:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< PropertyState > SwXTextCursor::GetPropertyStates(
+ SwPaM& rPaM, SfxItemPropertySet& rPropSet,
+ const Sequence< OUString >& PropertyNames,
+ SwGetPropertyStatesCaller eCaller )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ const OUString* pNames = PropertyNames.getConstArray();
+ Sequence< PropertyState > aRet ( PropertyNames.getLength() );
+ PropertyState* pStates = aRet.getArray();
+
+ SfxItemSet *pSet = 0, *pSetParent = 0;
+ const SfxItemPropertyMap* pSaveMap, *pMap = rPropSet.getPropertyMap();
+ for( INT32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd; i++ )
+ {
+ pSaveMap = pMap;
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i] );
+ if(!pMap)
+ {
+ if(pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) ||
+ pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ pMap = pSaveMap;
+ continue;
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) );
+ }
+ if (eCaller == SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION &&
+ pMap->nWID < FN_UNO_RANGE_BEGIN &&
+ pMap->nWID > FN_UNO_RANGE_END &&
+ pMap->nWID < RES_CHRATR_BEGIN &&
+ pMap->nWID > RES_TXTATR_END )
+ pStates[i] = beans::PropertyState_DEFAULT_VALUE;
+ else
+ {
+ if ( pMap->nWID >= FN_UNO_RANGE_BEGIN &&
+ pMap->nWID <= FN_UNO_RANGE_END )
+ SwUnoCursorHelper::getCrsrPropertyValue(pMap, rPaM, 0, pStates[i] );
+ else
+ {
+ if( !pSet )
+ {
+ switch ( eCaller )
+ {
+ case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION:
+ pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_TXTATR_END );
+ break;
+ case SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY:
+ pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ pMap->nWID, pMap->nWID );
+ break;
+ default:
+ pSet = new SfxItemSet( rPaM.GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_PARATR_NUMRULE,
+ RES_FILL_ORDER, RES_FRMATR_END -1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ 0L );
+ }
+ SwXTextCursor::GetCrsrAttr( rPaM, *pSet, FALSE );
+ }
+
+ if( pSet->Count() )
+ pStates[i] = rPropSet.getPropertyState( *pMap,*pSet );
+ else
+ pStates[i] = PropertyState_DEFAULT_VALUE;
+
+ //try again to find out if a value has been inherited
+ if( beans::PropertyState_DIRECT_VALUE == pStates[i] )
+ {
+ if( !pSetParent )
+ {
+ pSetParent = pSet->Clone( FALSE );
+ SwXTextCursor::GetCrsrAttr( rPaM, *pSetParent, sal_True );
+ }
+
+ if( (pSetParent)->Count() )
+ pStates[i] = rPropSet.getPropertyState( *pMap, *pSetParent );
+ else
+ pStates[i] = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ }
+ pMap++;
+ }
+ delete pSet;
+ delete pSetParent;
+ return aRet;
+}
+/* -----------------------------03.05.00 13:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+PropertyState SwXTextCursor::GetPropertyState(
+ SwPaM& rPaM, SfxItemPropertySet& rPropSet, const OUString& rPropertyName)
+ throw(UnknownPropertyException, RuntimeException)
+{
+ Sequence < OUString > aStrings ( 1 );
+ aStrings[0] = rPropertyName;
+ Sequence < PropertyState > aSeq = GetPropertyStates( rPaM, rPropSet, aStrings, SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY );
+ return aSeq[0];
+}
+/* -----------------------------03.05.00 13:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_SelectParaAndReset ( SwPaM &rPaM, SwDoc* pDoc, const SvUShortsSort* pWhichIds = 0 )
+{
+ // if we are reseting paragraph attributes, we need to select the full paragraph first
+ SwPosition aStart = *rPaM.Start();
+ SwPosition aEnd = *rPaM.End();
+ auto_ptr < SwUnoCrsr > pTemp ( pDoc->CreateUnoCrsr(aStart, FALSE) );
+ if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
+ pTemp->MovePara(fnParaCurr, fnParaStart);
+ pTemp->SetMark();
+ *pTemp->GetPoint() = aEnd;
+ SwXTextCursor::SelectPam(*pTemp, sal_True);
+ if(!SwUnoCursorHelper::IsEndOfPara(*pTemp))
+ pTemp->MovePara(fnParaCurr, fnParaEnd);
+ pDoc->ResetAttr(*pTemp, sal_True, pWhichIds);
+}
+void SwXTextCursor::SetPropertyToDefault(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwDoc* pDoc = rPaM.GetDoc();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ rPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+ if(pMap->nWID < RES_FRMATR_END)
+ {
+ SvUShortsSort aWhichIds;
+ aWhichIds.Insert(pMap->nWID);
+ if(pMap->nWID < RES_PARATR_BEGIN)
+ pDoc->ResetAttr(rPaM, sal_True, &aWhichIds);
+ else
+ lcl_SelectParaAndReset ( rPaM, pDoc, &aWhichIds );
+ }
+ else
+ SwUnoCursorHelper::resetCrsrPropertyValue(pMap, rPaM);
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+}
+/* -----------------------------03.05.00 13:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Any SwXTextCursor::GetPropertyDefault(
+ SwPaM& rPaM, const SfxItemPropertySet& rPropSet,
+ const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ Any aRet;
+ SwDoc* pDoc = rPaM.GetDoc();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ rPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ if(pMap->nWID < RES_FRMATR_END)
+ {
+ const SfxPoolItem& rDefItem = pDoc->GetAttrPool().GetDefaultItem(pMap->nWID);
+ rDefItem.QueryValue(aRet, pMap->nMemberId);
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( 0 ) );
+ return aRet;
+}
+/*-- 09.12.98 14:18:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextCursor::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef;
+ if(!xRef.is())
+ {
+ static SfxItemPropertyMap aCrsrExtMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT), FN_SKIP_HIDDEN_TEXT, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT), FN_SKIP_PROTECTED_TEXT, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ uno::Reference< beans::XPropertySetInfo > xInfo = aPropSet.getPropertySetInfo();
+ // PropertySetInfo verlaengern!
+ const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
+ xRef = new SfxExtItemPropertySetInfo(
+ aCrsrExtMap_Impl,
+ aPropSeq );
+ }
+ return xRef;
+}
+/*-- 09.12.98 14:18:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Any aAny;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)))
+ {
+ sal_Bool bSet = *(sal_Bool*)aValue.getValue();
+ pUnoCrsr->SetSkipOverHiddenSections(bSet);
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ sal_Bool bSet = *(sal_Bool*)aValue.getValue();
+ pUnoCrsr->SetSkipOverProtectSections(bSet);
+ }
+ else
+ SetPropertyValue(*pUnoCrsr, aPropSet, rPropertyName, aValue);
+ }
+ else
+ throw uno::RuntimeException();
+
+}
+/*-- 09.12.98 14:18:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXTextCursor::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aAny;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)))
+ {
+ BOOL bSet = pUnoCrsr->IsSkipOverHiddenSections();
+ aAny.setValue(&bSet, ::getBooleanCppuType());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ BOOL bSet = pUnoCrsr->IsSkipOverProtectSections();
+ aAny.setValue(&bSet, ::getBooleanCppuType());
+ }
+ else
+ aAny = GetPropertyValue(*pUnoCrsr, aPropSet, rPropertyName);
+ }
+ else
+ throw uno::RuntimeException();
+ return aAny;
+
+}
+/*-- 09.12.98 14:18:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 09.12.98 14:18:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 09.12.98 14:18:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 09.12.98 14:18:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 05.03.99 11:36:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SwXTextCursor::getPropertyState(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ eRet = GetPropertyState(*pUnoCrsr, aPropSet, rPropertyName);
+ }
+ else
+ throw RuntimeException();
+ return eRet;
+}
+/*-- 05.03.99 11:36:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SwXTextCursor::getPropertyStates(
+ const uno::Sequence< OUString >& PropertyNames)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(!pUnoCrsr)
+ throw RuntimeException();
+ return GetPropertyStates(*pUnoCrsr, aPropSet, PropertyNames);
+}
+/*-- 05.03.99 11:36:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::setPropertyToDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ setPropertiesToDefault ( aSequence );
+}
+/*-- 05.03.99 11:36:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextCursor::getPropertyDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ const Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ return getPropertyDefaults ( aSequence ).getConstArray()[0];
+}
+
+void SAL_CALL SwXTextCursor::setAllPropertiesToDefault()
+ throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ lcl_SelectParaAndReset ( *pUnoCrsr, pUnoCrsr->GetDoc());
+ else
+ throw uno::RuntimeException();
+}
+void SAL_CALL SwXTextCursor::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames )
+ throw (UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nCount = aPropertyNames.getLength();
+ if ( nCount )
+ {
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap(), *pSaveMap;
+ const OUString * pNames = aPropertyNames.getConstArray();
+ SvUShortsSort aWhichIds, aParaWhichIds;
+ for ( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ pSaveMap = pMap;
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i]);
+ if(!pMap)
+ {
+ if(pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) ||
+ pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ pMap = pSaveMap;
+ continue;
+ }
+ else
+ throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) );
+ }
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) );
+
+ if( pMap->nWID < RES_FRMATR_END)
+ {
+ if(pMap->nWID < RES_PARATR_BEGIN)
+ aWhichIds.Insert(pMap->nWID);
+ else
+ aParaWhichIds.Insert (pMap->nWID);
+ }
+ else if ( pMap->nWID == FN_UNO_NUM_START_VALUE )
+ SwUnoCursorHelper::resetCrsrPropertyValue(pMap, *pUnoCrsr);
+ }
+
+ if ( aParaWhichIds.Count() )
+ lcl_SelectParaAndReset ( *pUnoCrsr, pDoc, &aParaWhichIds );
+ if (aWhichIds.Count() )
+ pDoc->ResetAttr(*pUnoCrsr, sal_True, &aWhichIds);
+ }
+ else
+ throw uno::RuntimeException();
+ }
+}
+Sequence< Any > SAL_CALL SwXTextCursor::getPropertyDefaults( const Sequence< OUString >& aPropertyNames )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nCount = aPropertyNames.getLength();
+ Sequence < Any > aRet ( nCount );
+ if ( nCount )
+ {
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if (pUnoCrsr)
+ {
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ const SfxItemPropertyMap *pSaveMap, *pMap = aPropSet.getPropertyMap();
+ const OUString *pNames = aPropertyNames.getConstArray();
+ Any *pAny = aRet.getArray();
+ for ( sal_Int32 i = 0; i < nCount; i++)
+ {
+ pSaveMap = pMap;
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i]);
+ if(!pMap)
+ {
+ if(pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT)) ||
+ pNames[i].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT)))
+ {
+ pMap = pSaveMap;
+ continue;
+ }
+ else
+ throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( 0 ) );
+ }
+ if(pMap->nWID < RES_FRMATR_END)
+ {
+ const SfxPoolItem& rDefItem = pDoc->GetAttrPool().GetDefaultItem(pMap->nWID);
+ rDefItem.QueryValue(pAny[i], pMap->nMemberId);
+ }
+ }
+ }
+ else
+ throw UnknownPropertyException();
+ }
+ return aRet;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoobj2.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoobj2.cxx
new file mode 100644
index 000000000000..71bed5d974f8
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoobj2.cxx
@@ -0,0 +1,2465 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <rtl/ustrbuf.hxx>
+#include <swtypes.hxx>
+#include <hintids.hxx>
+#include <cmdid.h>
+#include <hints.hxx>
+#include <bookmrk.hxx>
+#include <frmfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+
+#include <errhdl.hxx>
+
+#include <ndtxt.hxx>
+#include <ndnotxt.hxx>
+#include <unocrsr.hxx>
+#include <rootfrm.hxx>
+#include <flyfrm.hxx>
+#include <ftnidx.hxx>
+#include <bf_so3/linkmgr.hxx>
+#include <docary.hxx>
+#include <paratr.hxx>
+#include <tools/urlobj.hxx>
+#include <pam.hxx>
+#include <tools/cachestr.hxx>
+#include <shellio.hxx>
+#include <swerror.h>
+#include <swtblfmt.hxx>
+#include <fmthbsh.hxx>
+#include <docsh.hxx>
+#include <bf_svtools/style.hxx>
+#include <docstyle.hxx>
+#include <charfmt.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hrc>
+#include <poolfmt.hxx>
+#include <viscrs.hxx>
+#include <edimp.hxx>
+#include <fchrfmt.hxx>
+#include <cntfrm.hxx>
+#include <pagefrm.hxx>
+#include <doctxm.hxx>
+#include <tox.hxx>
+#include <bf_sfx2/docfilt.hxx>
+#include <bf_sfx2/docfile.hxx>
+#include <bf_sfx2/fcontnr.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <unoclbck.hxx>
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unoport.hxx>
+#include <unomid.h>
+#include <unocrsrhelper.hxx>
+#include <unosett.hxx>
+#include <unoprnms.hxx>
+#include <unotbl.hxx>
+#include <unodraw.hxx>
+#include <unocoll.hxx>
+#include <unostyle.hxx>
+#include <unofield.hxx>
+#include <fmtanchr.hxx>
+#include <bf_svx/flstitem.hxx>
+#include <bf_svx/unolingu.hxx>
+#include <bf_svtools/ctrltool.hxx>
+#include <bf_svtools/eitem.hxx>
+#include <flypos.hxx>
+#include <txtftn.hxx>
+#include <section.hxx>
+#include <fmtftn.hxx>
+
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <unotools/collatorwrapper.hxx>
+#include <com/sun/star/table/TableSortField.hpp>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <fmthdft.hxx>
+#include <osl/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtflcnt.hxx>
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_XUB_STRLEN
+#include <bf_svtools/svstdarr.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svtools/stritem.hxx>
+#include <fmtclds.hxx>
+#include <rtl/uuid.h>
+#include <dcontact.hxx>
+#include <flyfrm.hxx>
+#include <cntfrm.hxx>
+#include <dflyobj.hxx>
+#include <crsskip.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::drawing;
+
+
+using rtl::OUString;
+
+//collectn.cxx
+//BOOL lcl_IsNumeric(const String&);
+
+void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
+ SwDependArr& rFrameArr, BOOL bSort )
+{
+ // bSortFlag says: TRUE - search AutoContent Flys,
+ // else search AtContent Flys
+
+ // alle Rahmen, Grafiken und OLEs suchen, die an diesem Absatz
+ // gebunden sind
+ SvXub_StrLens aSortArr( 8, 8 );
+ SwDoc* pDoc = rIdx.GetNode().GetDoc();
+
+ USHORT nChkType = bSort ? FLY_AUTO_CNTNT : FLY_AT_CNTNT;
+ const SwCntntFrm* pCFrm;
+ const SwCntntNode* pCNd;
+ if( pDoc->GetRootFrm() &&
+ 0 != (pCNd = rIdx.GetNode().GetCntntNode()) &&
+ 0 != (pCFrm = pCNd->GetFrm()) )
+ {
+ const SwDrawObjs *pObjs = pCFrm->GetDrawObjs();
+ if( pObjs )
+ for( USHORT i = 0; i < pObjs->Count(); ++i )
+ {
+ const SdrObject *pO = (*pObjs)[ i ];
+ const SwFlyFrm *pFly;
+ SwFrmFmt* pFmt;
+
+ if( pO->IsWriterFlyFrame()
+ ? ( (pFly = ((SwVirtFlyDrawObj*)pO)->GetFlyFrm())
+ ->IsFlyAtCntFrm() &&
+ (bSort ? pFly->IsAutoPos() : !pFly->IsAutoPos() ) &&
+ 0 != ( pFmt = (SwFrmFmt*)pFly->GetFmt()) )
+ : ( 0 != (pFmt=((SwDrawContact*)GetUserCall(pO))->GetFmt())
+ && pFmt->GetAnchor().GetAnchorId() == nChkType )
+ )
+ {
+ //jetzt einen SwDepend anlegen und in das Array einfuegen
+ SwDepend* pNewDepend = new SwDepend( &rClnt, pFmt );
+
+ USHORT nInsPos = rFrameArr.Count();
+ if( bSort )
+ {
+ xub_StrLen nInsertIndex = pFmt->GetAnchor().
+ GetCntntAnchor()->nContent.GetIndex();
+
+ USHORT nEnd = nInsPos;
+ for( nInsPos = 0; nInsPos < nEnd; ++nInsPos )
+ if( aSortArr[ nInsPos ] > nInsertIndex )
+ break;
+ aSortArr.Insert( nInsertIndex, nInsPos );
+ }
+ rFrameArr.C40_INSERT( SwDepend, pNewDepend, nInsPos );
+ }
+ }
+ }
+ else
+ {
+ const SwSpzFrmFmts& rFmts = *pDoc->GetSpzFrmFmts();
+ USHORT nSize = rFmts.Count();
+ for ( USHORT i = 0; i < nSize; i++)
+ {
+ const SwFrmFmt* pFmt = rFmts[ i ];
+ const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+ const SwPosition* pAnchorPos;
+ if( rAnchor.GetAnchorId() == nChkType &&
+ 0 != (pAnchorPos = rAnchor.GetCntntAnchor()) &&
+ pAnchorPos->nNode == rIdx )
+ {
+ //jetzt einen SwDepend anlegen und in das Array einfuegen
+ SwDepend* pNewDepend = new SwDepend( &rClnt, (SwFrmFmt*)pFmt);
+ USHORT nInsPos = rFrameArr.Count();
+ if( bSort )
+ {
+ xub_StrLen nInsertIndex = pAnchorPos->nContent.GetIndex();
+
+ USHORT nEnd = nInsPos;
+ for( nInsPos = 0; nInsPos < nEnd; ++nInsPos )
+ if( aSortArr[ nInsPos ] > nInsertIndex )
+ break;
+ aSortArr.Insert( nInsertIndex, nInsPos );
+ }
+ rFrameArr.C40_INSERT( SwDepend, pNewDepend, nInsPos );
+ }
+ }
+ }
+}
+
+
+/*-- 09.12.98 14:18:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::insertDocumentFromURL(const OUString& rURL,
+ const uno::Sequence< beans::PropertyValue >& aOptions)
+ throw( lang::IllegalArgumentException, io::IOException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ String sFilterName;
+ String sFilterOption;
+ String sPassword;
+ OUString uFilterName(C2U(SW_PROP_NAME_STR(UNO_NAME_FILTER_NAME)));
+ OUString uFilterOption(C2U(SW_PROP_NAME_STR(UNO_NAME_FILTER_OPTION)));
+ OUString uPassword(C2U(SW_PROP_NAME_STR(UNO_NAME_PASSWORD)));
+ sal_Bool bIllegalArgument = sal_False;
+
+ for ( int n = 0; n < aOptions.getLength(); ++n )
+ {
+ // get Property-Value from options
+ const beans::PropertyValue &rProp = aOptions.getConstArray()[n];
+ uno::Any aValue( rProp.Value );
+
+ // FilterName-Property?
+ if ( rProp.Name == uFilterName )
+ {
+ if ( rProp.Value.getValueType() == ::getCppuType((const OUString*)0))
+ {
+ OUString uFilterName;
+ rProp.Value >>= uFilterName;
+ sFilterName = String(uFilterName);
+ }
+ else if ( rProp.Value.getValueType() != ::getVoidCppuType() )
+ bIllegalArgument = sal_True;
+ }
+ else if( rProp.Name == uFilterOption )
+ {
+ if ( rProp.Value.getValueType() == ::getCppuType((const OUString*)0))
+ {
+ OUString uFilterOption;
+ rProp.Value >>= uFilterOption;
+ sFilterOption = String(uFilterOption) ;
+ }
+ else if ( rProp.Value.getValueType() != ::getVoidCppuType() )
+
+ bIllegalArgument = sal_True;
+ }
+ else if( rProp.Name == uPassword )
+ {
+ if ( rProp.Value.getValueType() == ::getCppuType((const OUString*)0))
+ {
+ OUString uPassword;
+ rProp.Value >>= uPassword;
+ sPassword = String(uPassword );
+ }
+ else if ( rProp.Value.getValueType() != ::getVoidCppuType() )
+ bIllegalArgument = sal_True;
+ }
+ else if(rProp.Value.getValueType() != ::getVoidCppuType())
+ bIllegalArgument = sal_True;
+ }
+ if(bIllegalArgument)
+ throw lang::IllegalArgumentException();
+ SwUnoCursorHelper::InsertFile(pUnoCrsr, rURL, sFilterName, sFilterOption, sPassword);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/* -----------------------------15.12.00 14:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXTextCursor::createSortDescriptor(sal_Bool bFromTable)
+{
+ uno::Sequence< beans::PropertyValue > aRet(5);
+ beans::PropertyValue* pArray = aRet.getArray();
+
+ uno::Any aVal;
+ sal_Bool bFalse = sal_False;
+ sal_Bool bTrue = sal_True;
+ aVal.setValue( &bFromTable, ::getCppuBooleanType());
+ pArray[0] = beans::PropertyValue(C2U("IsSortInTable"), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+
+ String sSpace(String::CreateFromAscii(" "));
+ sal_Unicode uSpace = sSpace.GetChar(0);
+
+ aVal <<= uSpace;
+ pArray[1] = beans::PropertyValue(C2U("Delimiter"), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+
+ aVal.setValue( &bTrue, ::getCppuBooleanType());
+ pArray[2] = beans::PropertyValue(C2U("IsSortColumns"), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+
+ aVal <<= (INT32)3;
+ pArray[3] = beans::PropertyValue(C2U("MaxSortFieldsCount"), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+
+ uno::Sequence< table::TableSortField > aFields(3);
+ table::TableSortField* pFields = aFields.getArray();
+
+ Locale aLang( SvxCreateLocale( LANGUAGE_SYSTEM ) );
+ // get collator algorithm to be used for the locale
+ Sequence < OUString > aSeq( GetAppCollator().listCollatorAlgorithms( aLang ) );
+ INT32 nLen = aSeq.getLength();
+ DBG_ASSERT( nLen > 0, "list of collator algorithms is empty!");
+ OUString aCollAlg;
+ if (nLen > 0)
+ aCollAlg = aSeq.getConstArray()[0];
+
+#if OSL_DEBUG_LEVEL > 1
+ const OUString *pTxt = aSeq.getConstArray();
+#endif
+
+ pFields[0].Field = 1;
+ pFields[0].IsAscending = sal_True;
+ pFields[0].IsCaseSensitive = sal_False;
+ pFields[0].FieldType = table::TableSortFieldType_ALPHANUMERIC;
+ pFields[0].CollatorLocale = aLang;
+ pFields[0].CollatorAlgorithm = aCollAlg;
+
+ pFields[1].Field = 1;
+ pFields[1].IsAscending = sal_True;
+ pFields[1].IsCaseSensitive = sal_False;
+ pFields[1].FieldType = table::TableSortFieldType_ALPHANUMERIC;
+ pFields[1].CollatorLocale = aLang;
+ pFields[1].CollatorAlgorithm = aCollAlg;
+
+ pFields[2].Field = 1;
+ pFields[2].IsAscending = sal_True;
+ pFields[2].IsCaseSensitive = sal_False;
+ pFields[2].FieldType = table::TableSortFieldType_ALPHANUMERIC;
+ pFields[2].CollatorLocale = aLang;
+ pFields[2].CollatorAlgorithm = aCollAlg;
+
+ aVal <<= aFields;
+ pArray[4] = beans::PropertyValue(C2U("SortFields"), -1, aVal, beans::PropertyState_DIRECT_VALUE);
+
+ return aRet;
+}
+
+/*-- 09.12.98 14:18:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXTextCursor::createSortDescriptor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return SwXTextCursor::createSortDescriptor(sal_False);
+}
+/* -----------------------------15.12.00 14:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::convertSortProperties(
+ const uno::Sequence< beans::PropertyValue >& rDescriptor, SwSortOptions& rSortOpt)
+{
+ sal_Bool bRet = sal_True;
+ const beans::PropertyValue* pProperties = rDescriptor.getConstArray();
+
+ rSortOpt.bTable = sal_False;
+ rSortOpt.cDeli = ' ';
+ rSortOpt.eDirection = SRT_COLUMNS; //!! UI text may be contrary though !!
+
+ rSortOpt.aKeys;
+ SwSortKey* pKey1 = new SwSortKey;
+ pKey1->nColumnId = USHRT_MAX;
+ pKey1->bIsNumeric = TRUE;
+ pKey1->eSortOrder = SRT_ASCENDING;
+
+ SwSortKey* pKey2 = new SwSortKey;
+ pKey2->nColumnId = USHRT_MAX;
+ pKey2->bIsNumeric = TRUE;
+ pKey2->eSortOrder = SRT_ASCENDING;
+
+ SwSortKey* pKey3 = new SwSortKey;
+ pKey3->nColumnId = USHRT_MAX;
+ pKey3->bIsNumeric = TRUE;
+ pKey3->eSortOrder = SRT_ASCENDING;
+ SwSortKey* aKeys[3] = {pKey1, pKey2, pKey3};
+
+ sal_Bool bOldSortdescriptor(sal_False);
+ sal_Bool bNewSortdescriptor(sal_False);
+
+ for( int n = 0; n < rDescriptor.getLength(); ++n )
+ {
+ uno::Any aValue( pProperties[n].Value );
+// String sPropName = pProperties[n].Name;
+ const OUString& rPropName = pProperties[n].Name;
+
+ // old and new sortdescriptor
+ if( COMPARE_EQUAL == rPropName.compareToAscii("IsSortInTable"))
+ {
+ if ( aValue.getValueType() == ::getBooleanCppuType() )
+ rSortOpt.bTable = *(sal_Bool*)aValue.getValue();
+ else
+ bRet = sal_False;
+ }
+ else if(COMPARE_EQUAL == rPropName.compareToAscii("Delimiter"))
+ {
+ sal_Unicode uChar;
+ if( aValue >>= uChar )
+ rSortOpt.cDeli = uChar;
+ else
+ bRet = sal_False;
+ }
+ // old sortdescriptor
+ else if(COMPARE_EQUAL == rPropName.compareToAscii("SortColumns"))
+ {
+ bOldSortdescriptor = sal_True;
+ if ( aValue.getValueType() == ::getBooleanCppuType() )
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ rSortOpt.eDirection = bTemp ? SRT_COLUMNS : SRT_ROWS;
+ }
+ else
+ bRet = sal_False;
+ }
+ else if(COMPARE_EQUAL == rPropName.compareToAscii("IsCaseSensitive"))
+ {
+ bOldSortdescriptor = sal_True;
+ if ( aValue.getValueType() == ::getBooleanCppuType() )
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ rSortOpt.bIgnoreCase = !bTemp;
+ }
+ else
+ bRet = sal_False;
+ }
+ else if(COMPARE_EQUAL == rPropName.compareToAscii("CollatorLocale"))
+ {
+ bOldSortdescriptor = sal_True;
+ Locale aLocale;
+ if (aValue >>= aLocale)
+ rSortOpt.nLanguage = SvxLocaleToLanguage( aLocale );
+ else
+ bRet = sal_False;
+ }
+ else if(COMPARE_EQUAL == rPropName.compareToAscii("CollatorAlgorithm", 17) &&
+ rPropName.getLength() == 18 &&
+ (rPropName.getStr()[17] >= '0' && rPropName.getStr()[17] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[17];
+ nIndex -= '0';
+ OUString aTxt;
+ if ((aValue >>= aTxt) && nIndex < 3)
+ aKeys[nIndex]->sSortType = aTxt;
+ else
+ bRet = sal_False;
+ }
+ else if(COMPARE_EQUAL == rPropName.compareToAscii("SortRowOrColumnNo", 17) &&
+ rPropName.getLength() == 18 &&
+ (rPropName.getStr()[17] >= '0' && rPropName.getStr()[17] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[17];
+ nIndex -= '0';
+ sal_Int16 nCol = -1;
+ if( aValue.getValueType() == ::getCppuType((const sal_Int16*)0) && nIndex < 3)
+ aValue >>= nCol;
+ if( nCol >= 0 )
+ aKeys[nIndex]->nColumnId = nCol;
+ else
+ bRet = sal_False;
+ }
+ else if(0 == rPropName.indexOf(C2U("IsSortNumeric")) &&
+ rPropName.getLength() == 14 &&
+ (rPropName.getStr()[13] >= '0' && rPropName.getStr()[13] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[13];
+ nIndex = nIndex - '0';
+ if ( aValue.getValueType() == ::getBooleanCppuType() && nIndex < 3 )
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ aKeys[nIndex]->bIsNumeric = bTemp;
+ }
+ else
+ bRet = sal_False;
+ }
+ else if(0 == rPropName.indexOf(C2U("IsSortAscending")) &&
+ rPropName.getLength() == 16 &&
+ (rPropName.getStr()[15] >= '0' && rPropName.getStr()[15] <= '9'))
+ {
+ bOldSortdescriptor = sal_True;
+ sal_uInt16 nIndex = rPropName.getStr()[15];
+ nIndex -= '0';
+ if ( aValue.getValueType() == ::getBooleanCppuType() && nIndex < 3 )
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ aKeys[nIndex]->eSortOrder = bTemp ? SRT_ASCENDING : SRT_DESCENDING;
+ }
+ else
+ bRet = sal_False;
+ }
+ // new sortdescriptor
+ else if(COMPARE_EQUAL == rPropName.compareToAscii("IsSortColumns"))
+ {
+ bNewSortdescriptor = sal_True;
+ if ( aValue.getValueType() == ::getBooleanCppuType() )
+ {
+ sal_Bool bTemp = *(sal_Bool*)aValue.getValue();
+ rSortOpt.eDirection = bTemp ? SRT_COLUMNS : SRT_ROWS;
+ }
+ else
+ bRet = sal_False;
+ }
+ else if (COMPARE_EQUAL == rPropName.compareToAscii("SortFields"))
+ {
+ bNewSortdescriptor = sal_True;
+ uno::Sequence < table::TableSortField > aFields;
+ if ( aValue >>= aFields )
+ {
+ sal_Int32 nCount(aFields.getLength());
+ if (nCount <= 3)
+ {
+ table::TableSortField* pFields = aFields.getArray();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ rSortOpt.bIgnoreCase = !pFields[i].IsCaseSensitive;
+ rSortOpt.nLanguage = SvxLocaleToLanguage( pFields[i].CollatorLocale );
+ aKeys[i]->sSortType = pFields[i].CollatorAlgorithm;
+ aKeys[i]->nColumnId = pFields[i].Field;
+ aKeys[i]->bIsNumeric = (pFields[i].FieldType == table::TableSortFieldType_NUMERIC);
+ aKeys[i]->eSortOrder = pFields[i].IsAscending ? SRT_ASCENDING : SRT_DESCENDING;
+ }
+ }
+ else
+ bRet = sal_False;
+ }
+ else
+ bRet = sal_False;
+ }
+ }
+
+ if (bNewSortdescriptor && bOldSortdescriptor)
+ {
+ DBG_ERROR("someone tried to set the old deprecated and the new sortdescriptor");
+ bRet = sal_False;
+ }
+
+ if(pKey1->nColumnId != USHRT_MAX)
+ rSortOpt.aKeys.C40_INSERT(SwSortKey, pKey1, rSortOpt.aKeys.Count());
+ if(pKey2->nColumnId != USHRT_MAX)
+ rSortOpt.aKeys.C40_INSERT(SwSortKey, pKey2, rSortOpt.aKeys.Count());
+ if(pKey3->nColumnId != USHRT_MAX)
+ rSortOpt.aKeys.C40_INSERT(SwSortKey, pKey3, rSortOpt.aKeys.Count());
+
+ return bRet && rSortOpt.aKeys.Count() > 0;
+}
+/*-- 09.12.98 14:19:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwSortOptions aSortOpt;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+
+ if(pUnoCrsr)
+ {
+ if(pUnoCrsr->HasMark())
+ {
+ if(!SwXTextCursor::convertSortProperties(rDescriptor, aSortOpt))
+ throw uno::RuntimeException();
+ UnoActionContext aContext( pUnoCrsr->GetDoc() );
+
+ SwPosition* pStart = pUnoCrsr->Start();
+ SwPosition* pEnd = pUnoCrsr->End();
+
+ SwNodeIndex aPrevIdx( pStart->nNode, -1 );
+ ULONG nOffset = pEnd->nNode.GetIndex() - pStart->nNode.GetIndex();
+ xub_StrLen nCntStt = pStart->nContent.GetIndex();
+
+ pUnoCrsr->GetDoc()->SortText(*pUnoCrsr, aSortOpt);
+
+ // Selektion wieder setzen
+ pUnoCrsr->DeleteMark();
+ pUnoCrsr->GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
+ SwCntntNode* pCNd = pUnoCrsr->GetCntntNode();
+ xub_StrLen nLen = pCNd->Len();
+ if( nLen > nCntStt )
+ nLen = nCntStt;
+ pUnoCrsr->GetPoint()->nContent.Assign(pCNd, nLen );
+ pUnoCrsr->SetMark();
+
+ pUnoCrsr->GetPoint()->nNode += nOffset;
+ pCNd = pUnoCrsr->GetCntntNode();
+ pUnoCrsr->GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 10.12.98 11:52:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void ClientModify(SwClient* pClient, SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)pClient->GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ ((SwModify*)pClient->GetRegisteredIn())->Remove(pClient);
+ break;
+
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == pClient->GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ ((SwModify*)pClient->GetRegisteredIn())->Remove(pClient);
+ break;
+ }
+}
+
+/* -----------------------------03.04.00 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XEnumeration > SAL_CALL SwXTextCursor::createContentEnumeration(const OUString& rServiceName) throw( RuntimeException )
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if( !pUnoCrsr || 0 != rServiceName.compareToAscii("com.sun.star.text.TextContent") )
+ throw RuntimeException();
+
+ Reference< XEnumeration > xRet = new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_TEXTRANGE);
+ return xRet;
+}
+/* -----------------------------07.03.01 14:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XEnumeration > SwXTextCursor::createEnumeration(void) throw( RuntimeException )
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if( !pUnoCrsr )
+ throw RuntimeException();
+ Reference<XUnoTunnel> xTunnel(xParentText, UNO_QUERY);
+ SwXText* pParentText = 0;
+ if(xTunnel.is())
+ {
+ pParentText = (SwXText*)xTunnel->getSomething(SwXText::getUnoTunnelId());
+ }
+ DBG_ASSERT(pParentText, "parent is not a SwXText");
+
+ SwUnoCrsr* pNewCrsr = pUnoCrsr->GetDoc()->CreateUnoCrsr(*pUnoCrsr->GetPoint());
+ if(pUnoCrsr->HasMark())
+ {
+ pNewCrsr->SetMark();
+ *pNewCrsr->GetMark() = *pUnoCrsr->GetMark();
+ }
+ CursorType eSetType = eType == CURSOR_TBLTEXT ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
+ Reference< XEnumeration > xRet = new SwXParagraphEnumeration(pParentText, *pNewCrsr, eSetType);
+
+ return xRet;
+}
+/* -----------------------------07.03.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Type SwXTextCursor::getElementType(void) throw( RuntimeException )
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+/* -----------------------------07.03.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXTextCursor::hasElements(void) throw( RuntimeException )
+{
+ return sal_True;
+}
+/* -----------------------------03.04.00 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SAL_CALL SwXTextCursor::getAvailableServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString::createFromAscii("com.sun.star.text.TextContent");
+ return aRet;
+}
+/*-- 09.12.98 14:19:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+IMPL_STATIC_LINK( SwXTextCursor, RemoveCursor_Impl,
+ Reference<XInterface>*, pArg )
+{
+ ASSERT( pThis != NULL, "no reference?" );
+ ASSERT( pArg != NULL, "no reference?" );
+
+ SwUnoCrsr* pCursor = pThis->GetCrsr();
+ if( pCursor != NULL )
+ {
+ pCursor->Remove( pThis );
+ delete pCursor;
+ }
+ delete pArg;
+
+ return 0;
+}
+
+void SwXTextCursor::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+
+ // if the cursor leaves its designated section, it becomes invalid
+ if( ( pOld != NULL ) && ( pOld->Which() == RES_UNOCURSOR_LEAVES_SECTION ) )
+ {
+ // create reference to this object to prevent deletion before
+ // the STATIC_LINK is executed. The link will delete the
+ // reference.
+ Reference<XInterface>* pRef =
+ new Reference<XInterface>( static_cast<XServiceInfo*>( this ) );
+ Application::PostUserEvent(
+ STATIC_LINK( this, SwXTextCursor, RemoveCursor_Impl ), pRef );
+ }
+
+ if(!GetRegisteredIn())
+ aLstnrCntnr.Disposing();
+
+}
+/*-- 09.12.98 14:19:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwPaM* SwXTextCursor::GetPaM() const
+{
+ return GetCrsr() ? GetCrsr() : 0;
+}
+// -----------------------------------------------------------------------------
+SwPaM* SwXTextCursor::GetPaM()
+{
+ return GetCrsr() ? GetCrsr() : 0;
+}
+
+/*-- 09.12.98 14:19:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwDoc* SwXTextCursor::GetDoc()const
+{
+ return GetCrsr() ? GetCrsr()->GetDoc() : 0;
+}
+/* -----------------22.07.99 13:52-------------------
+
+ --------------------------------------------------*/
+SwDoc* SwXTextCursor::GetDoc()
+{
+ return GetCrsr() ? GetCrsr()->GetDoc() : 0;
+}
+
+/*-- 09.12.98 14:19:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::SetCrsrAttr(SwPaM& rPam, const SfxItemSet& rSet, USHORT nAttrMode)
+{
+ sal_uInt16 nFlags = SETATTR_APICALL;
+ if(nAttrMode & CRSR_ATTR_MODE_DONTREPLACE)
+ nFlags |= SETATTR_DONTREPLACE;
+ SwDoc* pDoc = rPam.GetDoc();
+ //StartEndAction
+ UnoActionContext aAction(pDoc);
+ SwPaM* pCrsr = &rPam;
+ if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn
+ {
+ SwPaM *_pStartCrsr = &rPam;
+ do
+ {
+ if( _pStartCrsr->HasMark() && ( (CRSR_ATTR_MODE_TABLE & nAttrMode) ||
+ *_pStartCrsr->GetPoint() != *_pStartCrsr->GetMark() ))
+ pDoc->Insert(*_pStartCrsr, rSet, nFlags );
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rPam );
+
+ }
+ else
+ {
+// if( !HasSelection() )
+// UpdateAttr();
+ pDoc->Insert( *pCrsr, rSet, nFlags );
+ }
+}
+/*-- 09.12.98 14:19:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextCursor::GetCrsrAttr(SwPaM& rPam, SfxItemSet& rSet, BOOL bCurrentAttrOnly)
+{
+ static const sal_uInt16 nMaxLookup = 1000;
+ SfxItemSet aSet( *rSet.GetPool(), rSet.GetRanges() );
+ SfxItemSet *pSet = &rSet;
+ SwPaM *_pStartCrsr = &rPam;
+ do
+ {
+ sal_uInt32 nSttNd = _pStartCrsr->GetMark()->nNode.GetIndex(),
+ nEndNd = _pStartCrsr->GetPoint()->nNode.GetIndex();
+ xub_StrLen nSttCnt = _pStartCrsr->GetMark()->nContent.GetIndex(),
+ nEndCnt = _pStartCrsr->GetPoint()->nContent.GetIndex();
+
+ if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt ))
+ {
+ sal_uInt32 nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp;
+ nTmp = nSttCnt; nSttCnt = nEndCnt; nEndCnt = (sal_uInt16)nTmp;
+ }
+
+ if( nEndNd - nSttNd >= nMaxLookup )
+ {
+ rSet.ClearItem();
+ rSet.InvalidateAllItems();
+ return;// uno::Any();
+ }
+
+ // beim 1.Node traegt der Node die Werte in den GetSet ein (Initial)
+ // alle weiteren Nodes werden zum GetSet zu gemergt
+ for( ULONG n = nSttNd; n <= nEndNd; ++n )
+ {
+ SwNode* pNd = rPam.GetDoc()->GetNodes()[ n ];
+ switch( pNd->GetNodeType() )
+ {
+ case ND_TEXTNODE:
+ {
+ xub_StrLen nStt = n == nSttNd ? nSttCnt : 0,
+ nEnd = n == nEndNd ? nEndCnt
+ : ((SwTxtNode*)pNd)->GetTxt().Len();
+ ((SwTxtNode*)pNd)->GetAttr( *pSet, nStt, nEnd, bCurrentAttrOnly, !bCurrentAttrOnly );
+ }
+ break;
+ case ND_GRFNODE:
+ case ND_OLENODE:
+ ((SwCntntNode*)pNd)->GetAttr( *pSet );
+ break;
+
+ default:
+ pNd = 0;
+ }
+
+ if( pNd )
+ {
+ if( pSet != &rSet )
+ rSet.MergeValues( aSet );
+
+ if( aSet.Count() )
+ aSet.ClearItem();
+
+ }
+ pSet = &aSet;
+ }
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rPam );
+}
+/******************************************************************
+ * SwXParagraphEnumeration
+ ******************************************************************/
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXParagraphEnumeration::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXParagraphEnumeration");
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXParagraphEnumeration::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.ParagraphEnumeration") == rServiceName;
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXParagraphEnumeration::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.ParagraphEnumeration");
+ return aRet;
+}
+/*-- 10.12.98 11:52:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraphEnumeration::SwXParagraphEnumeration(SwXText* pParent,
+ SwPosition& rPos,
+ CursorType eType) :
+ xParentText(pParent),
+ bFirstParagraph(sal_True),
+ eCursorType(eType),
+ nEndIndex(rPos.nNode.GetIndex()),
+ nFirstParaStart(-1),
+ nLastParaEnd(-1)
+{
+ SwUnoCrsr* pUnoCrsr = pParent->GetDoc()->CreateUnoCrsr(rPos, sal_False);
+ pUnoCrsr->Add(this);
+}
+
+/*-- 10.12.98 11:52:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraphEnumeration::SwXParagraphEnumeration(SwXText* pParent,
+ SwUnoCrsr* pCrsr,
+ CursorType eType) :
+ SwClient(pCrsr),
+ xParentText(pParent),
+ bFirstParagraph(sal_True),
+ eCursorType(eType),
+ nEndIndex(pCrsr->End()->nNode.GetIndex()),
+ nFirstParaStart(-1),
+ nLastParaEnd(-1)
+{
+ if(CURSOR_SELECTION == eCursorType || CURSOR_SELECTION_IN_TABLE == eCursorType)
+ {
+ if(*pCrsr->GetPoint() > *pCrsr->GetMark())
+ pCrsr->Exchange();
+ nFirstParaStart = pCrsr->GetPoint()->nContent.GetIndex();
+ nLastParaEnd = pCrsr->GetMark()->nContent.GetIndex();
+ if(pCrsr->HasMark())
+ pCrsr->DeleteMark();
+ }
+}
+/*-- 10.12.98 11:52:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraphEnumeration::~SwXParagraphEnumeration()
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ delete pUnoCrsr;
+
+}
+/*-- 10.12.98 11:52:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXParagraphEnumeration::hasMoreElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ if(bFirstParagraph)
+ bRet = sal_True;
+ else
+ {
+ SwPosition* pStart = pUnoCrsr->Start();
+ SwUnoCrsr* pNewCrsr = pUnoCrsr->GetDoc()->CreateUnoCrsr(*pStart, sal_False);
+ //man soll hier auch in Tabellen landen duerfen
+ if(CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType)
+ pNewCrsr->SetRemainInSection( sal_False );
+
+ //was mache ich, wenn ich schon in einer Tabelle stehe?
+ SwTableNode* pTblNode = pNewCrsr->GetNode()->FindTableNode();
+ if((CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType) && pTblNode)
+ {
+ pNewCrsr->GetPoint()->nNode = pTblNode->EndOfSectionIndex();
+ bRet = pNewCrsr->Move(fnMoveForward, fnGoNode);
+ }
+ else
+ bRet = pNewCrsr->MovePara(fnParaNext, fnParaStart);
+ if((CURSOR_SELECTION == eCursorType || CURSOR_SELECTION_IN_TABLE == eCursorType)
+ && nEndIndex < pNewCrsr->Start()->nNode.GetIndex())
+ bRet = FALSE;
+ delete pNewCrsr;
+ }
+ }
+ return bRet;
+}
+/*-- 10.12.98 11:52:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXParagraphEnumeration::nextElement(void)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextContent > aRef;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ XText* pText = xParentText.get();
+ sal_Bool bInTable = sal_False;
+ if(!bFirstParagraph)
+ {
+ //man soll hier auch in Tabellen landen duerfen
+ if(CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType)
+ {
+ pUnoCrsr->SetRemainInSection( sal_False );
+ //was mache ich, wenn ich schon in einer Tabelle stehe?
+ SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ if(pTblNode)
+ {
+ // wir haben es mit einer Tabelle zu tun - also ans Ende
+ pUnoCrsr->GetPoint()->nNode = pTblNode->EndOfSectionIndex();
+ if(!pUnoCrsr->Move(fnMoveForward, fnGoNode))
+ {
+ throw container::NoSuchElementException();
+ }
+ else
+ bInTable = sal_True;
+
+ }
+ }
+ }
+
+ if( bFirstParagraph || bInTable || pUnoCrsr->MovePara(fnParaNext, fnParaStart))
+ {
+ SwPosition* pStart = pUnoCrsr->Start();
+ sal_Int32 nFirstContent = bFirstParagraph ? nFirstParaStart : -1;
+ sal_Int32 nLastContent = nEndIndex == pStart->nNode.GetIndex() ? nLastParaEnd : -1;
+ bFirstParagraph = sal_False;
+ //steht man nun in einer Tabelle, oder in einem einfachen Absatz?
+
+ SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ if(CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType && pTblNode)
+ {
+ // wir haben es mit einer Tabelle zu tun
+ SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
+ XTextTable* pTable = SwXTextTables::GetObject( *pTableFmt );
+ aRef = (XTextContent*)(SwXTextTable*)pTable;
+ }
+ else
+ {
+ SwUnoCrsr* pNewCrsr = pUnoCrsr->GetDoc()->CreateUnoCrsr(*pStart, sal_False);
+ aRef = (XTextContent*)new SwXParagraph((SwXText*)pText, pNewCrsr, nFirstContent, nLastContent);
+ }
+ }
+ else
+ throw container::NoSuchElementException();
+
+ }
+ else
+ throw uno::RuntimeException();
+
+ uno::Any aRet(&aRef, ::getCppuType((uno::Reference<XTextContent>*)0));
+ return aRet;
+}
+void SwXParagraphEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+/******************************************************************
+ * SwXTextRange
+ ******************************************************************/
+TYPEINIT1(SwXTextRange, SwClient);
+
+/* -----------------10.12.98 13:19-------------------
+ *
+ * --------------------------------------------------*/
+/*uno::Reference< uno::XInterface > SwXTextRange_NewInstance_Impl()
+{
+ return *new SwXTextRange();
+};
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextRange::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ //XUnoTunnel
+sal_Int64 SAL_CALL SwXTextRange::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/* -----------------------------06.04.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextRange::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextRange");
+}
+/* -----------------------------06.04.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextRange::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return sServiceName.EqualsAscii("com.sun.star.text.TextRange") ||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterProperties")||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesAsian")||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesComplex")||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphProperties") ||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesComplex");
+}
+/* -----------------------------06.04.00 16:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextRange::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(7);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextRange");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ return aRet;
+}
+
+/*-- 10.12.98 12:54:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRange::SwXTextRange(SwPaM& rPam, const uno::Reference< XText > & rxParent) :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)),
+ xParentText(rxParent),
+ aObjectDepend(this, 0),
+ pDoc(rPam.GetDoc()),
+ pBox(0),
+ pBoxStartNode(0),
+ eRangePosition(RANGE_IN_TEXT)
+{
+ //Bookmark an der anlegen
+ _CreateNewBookmark(rPam);
+}
+/*-- 10.12.98 12:54:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRange::SwXTextRange(SwFrmFmt& rFmt, SwPaM& rPam) :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)),
+ aObjectDepend(this, &rFmt),
+ pDoc(rPam.GetDoc()),
+ pBox(0),
+ pBoxStartNode(0),
+ eRangePosition(RANGE_IN_FRAME)
+{
+ //Bookmark an der anlegen
+ _CreateNewBookmark(rPam);
+}
+/*-- 10.12.98 12:54:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt, SwTableBox& rTblBox, SwPaM& rPam) :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)),
+ pDoc(rPam.GetDoc()),
+ aObjectDepend(this, &rTblFmt),
+ pBox(&rTblBox),
+ pBoxStartNode(0),
+ eRangePosition(RANGE_IN_CELL)
+{
+ //Bookmark an der anlegen
+ _CreateNewBookmark(rPam);
+}
+/* -----------------------------09.08.00 16:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt, const SwStartNode& rStartNode, SwPaM& rPam) :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)),
+ pDoc(rPam.GetDoc()),
+ aObjectDepend(this, &rTblFmt),
+ pBox(0),
+ pBoxStartNode(&rStartNode),
+ eRangePosition(RANGE_IN_CELL)
+{
+ //Bookmark an der anlegen
+ _CreateNewBookmark(rPam);
+}
+/* -----------------19.02.99 11:39-------------------
+ *
+ * --------------------------------------------------*/
+SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt) :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR)),
+ aObjectDepend(this, &rTblFmt),
+ pDoc(rTblFmt.GetDoc()),
+ pBox(0),
+ pBoxStartNode(0),
+ eRangePosition(RANGE_IS_TABLE)
+{
+}
+
+/*-- 10.12.98 12:54:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRange::~SwXTextRange()
+{
+ if(GetBookmark())
+ pDoc->DelBookmark( GetBookmark()->GetName() );
+}
+/*-- 10.12.98 12:54:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextRange::_CreateNewBookmark(SwPaM& rPam)
+{
+ static sal_Int32 nBookmark = 0;
+ String sBookmarkName;
+
+ SwBookmark* pBkm = GetBookmark();
+ if(pBkm)
+ {
+ // If a bookmark exists already its name can be resused
+ sBookmarkName = pBkm->GetName();
+ pDoc->DelBookmark( sBookmarkName );
+ }
+ else
+ {
+ // Otherwise we have to create a new name. This is not done
+ // using SwDoc::MakeUniqueBookmarkName, because this method
+ // starts counting bookmarks beginning with 1. That's required
+ // for real bookmarks, but very slow in thsi case there lots
+ // of bookmarks requiere any unique name only.
+ String sPrefix(C2S("SwXTextPosition"));
+ const SwBookmarks& rBookmarks = pDoc->GetBookmarks();
+ sal_uInt16 nBookmarks = rBookmarks.Count(), i;
+ do
+ {
+ nBookmark++;
+ if( nBookmark < 1 ) // on overwflow restart with 1
+ nBookmark = 1;
+
+ sBookmarkName = sPrefix;
+ sBookmarkName += String::CreateFromInt32( nBookmark );
+ for( i = 0; i < nBookmarks; i++ )
+ if( rBookmarks[i]->GetName().Equals( sBookmarkName ) )
+ break;
+ }
+ while( i < nBookmarks );
+ }
+
+ KeyCode aCode;
+ String sShortName;
+ SwBookmark* pMark = pDoc->MakeBookmark(rPam, aCode,
+ sBookmarkName, sShortName, UNO_BOOKMARK);
+ pMark->Add(this);
+}
+/*-- 10.12.98 12:54:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextRange::DeleteAndInsert(const String& rText) throw( uno::RuntimeException )
+{
+ SwBookmark* pBkm = GetBookmark();
+ if(pBkm )
+ {
+ const SwPosition& rPoint = pBkm->GetPos();
+ const SwPosition* pMark = pBkm->GetOtherPos();
+ SwCursor aNewCrsr( rPoint);
+ SwDoc* pDoc = aNewCrsr.GetDoc();
+ if(pMark)
+ {
+ aNewCrsr.SetMark();
+ *aNewCrsr.GetMark() = *pMark;
+ }
+
+ UnoActionContext aAction(aNewCrsr.GetDoc());
+ if(aNewCrsr.HasMark())
+ pDoc->DeleteAndJoin(aNewCrsr);
+
+ if(rText.Len())
+ {
+ if( !pDoc->Insert(aNewCrsr, rText) )
+ {
+ ASSERT( sal_False, "Doc->Insert(Str) failed." )
+ }
+ SwXTextCursor::SelectPam(aNewCrsr, sal_True);
+ aNewCrsr.Left(rText.Len(), CRSR_SKIP_CHARS);
+ }
+ _CreateNewBookmark(aNewCrsr);
+ }
+
+}
+
+/*-- 10.12.98 12:54:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XText > SwXTextRange::getText(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!xParentText.is())
+ {
+ if(eRangePosition == RANGE_IN_FRAME &&
+ aObjectDepend.GetRegisteredIn())
+ {
+ SwFrmFmt* pFrmFmt = (SwFrmFmt*)aObjectDepend.GetRegisteredIn();
+ SwXTextFrame* pxFrm = (SwXTextFrame*)SwClientIter( *pFrmFmt ).
+ First( TYPE( SwXTextFrame ));
+ if(pxFrm)
+ ((SwXTextRange*)this)->xParentText = pxFrm;
+ else
+ ((SwXTextRange*)this)->xParentText = new SwXTextFrame(*pFrmFmt);
+ ((SwModify*)aObjectDepend.GetRegisteredIn())->
+ Remove(&((SwXTextRange*)this)->aObjectDepend);
+
+ }
+ else if(eRangePosition == RANGE_IN_CELL &&
+ aObjectDepend.GetRegisteredIn())
+ {
+ const SwStartNode* pSttNd = pBoxStartNode ? pBoxStartNode : pBox->GetSttNd();
+ const SwTableNode* pTblNode = pSttNd->FindTableNode();
+ const SwFrmFmt* pTableFmt = pTblNode->GetTable().GetFrmFmt();
+ ((SwXTextRange*)this)->xParentText =
+ pBox ? SwXCell::CreateXCell((SwFrmFmt*)pTableFmt, pBox)
+ : new SwXCell( (SwFrmFmt*)pTableFmt, *pBoxStartNode );
+ ((SwModify*)aObjectDepend.GetRegisteredIn())->
+ Remove(&((SwXTextRange*)this)->aObjectDepend);
+ }
+ else if(eRangePosition == RANGE_IS_TABLE &&
+ aObjectDepend.GetRegisteredIn() )
+ {
+ SwFrmFmt* pTblFmt = (SwFrmFmt*)aObjectDepend.GetRegisteredIn();
+ SwDoc* pDoc = pTblFmt->GetDoc();
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+ SwPosition aPosition( *pTblNode );
+ Reference< XTextRange > xRange = SwXTextRange::CreateTextRangeFromPosition(pDoc,
+ aPosition, 0);
+ xParentText = xRange->getText();
+ }
+ else
+ {
+ // jetzt noch alle Faelle finden, die nicht abgedeckt sind
+ // (Body, Kopf-/Fusszeilen, Fussnotentext )
+ DBG_WARNING("not implemented");
+ }
+ }
+ return xParentText;
+}
+/*-- 10.12.98 12:54:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextRange::getStart(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwBookmark* pBkm = GetBookmark();
+ if(!xParentText.is())
+ getText();
+ if(pBkm)
+ {
+ SwPaM aPam(pBkm->GetPos());
+ xRet = new SwXTextRange(aPam, xParentText);
+ }
+ else if(eRangePosition == RANGE_IS_TABLE)
+ {
+ //start und ende sind mit this identisch, wenn es eine Tabelle ist
+ xRet = this;
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 10.12.98 12:54:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextRange::getEnd(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwBookmark* pBkm = GetBookmark();
+ if(!xParentText.is())
+ getText();
+ if(pBkm)
+ {
+ SwPaM aPam(pBkm->GetOtherPos()? *pBkm->GetOtherPos() : pBkm->GetPos());
+ xRet = new SwXTextRange(aPam, xParentText);
+ }
+ else if(eRangePosition == RANGE_IS_TABLE)
+ {
+ //start und ende sind mit this identisch, wenn es eine Tabelle ist
+ xRet = this;
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 10.12.98 12:54:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextRange::getString(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwBookmark* pBkm = GetBookmark();
+ OUString sRet;
+ //fuer Tabellen gibt es keine Bookmark, also auch keinen Text
+ //evtl. koennte man hier die Tabelle als ASCII exportieren?
+ if(pBkm && pBkm->GetOtherPos())
+ {
+ const SwPosition& rPoint = pBkm->GetPos();
+ const SwPosition* pMark = pBkm->GetOtherPos();
+ SwPaM aCrsr(*pMark, rPoint);
+/* if( rPoint.nNode.GetIndex() ==
+ pMark->nNode.GetIndex() )
+ {
+ SwTxtNode* pTxtNd = aCrsr.GetNode()->GetTxtNode();
+ if( pTxtNd )
+ {
+ sal_uInt16 nStt = aCrsr.Start()->nContent.GetIndex();
+ sRet = pTxtNd->GetExpandTxt( nStt,
+ aCrsr.End()->nContent.GetIndex() - nStt );
+ }
+ }
+ else
+*/ {
+ SwXTextCursor::getTextFromPam(aCrsr, sRet);
+ }
+ }
+ return sRet;
+}
+/*-- 10.12.98 12:54:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextRange::setString(const OUString& aString)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(RANGE_IS_TABLE == eRangePosition)
+ {
+ //setString in Tabellen kann nicht erlaubt werden
+ throw uno::RuntimeException();
+ }
+ else
+ DeleteAndInsert(aString);
+}
+/*-- 10.12.98 12:54:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextRange::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ sal_Bool bAlreadyRegisterred = 0 != GetRegisteredIn();
+ ClientModify(this, pOld, pNew);
+ if(aObjectDepend.GetRegisteredIn())
+ {
+ ClientModify(&aObjectDepend, pOld, pNew);
+ // if the depend was removed then the range must be removed too
+ if(!aObjectDepend.GetRegisteredIn() && GetRegisteredIn())
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ // or if the range has been removed but the depend ist still
+ // connected then the depend must be removed
+ else if(bAlreadyRegisterred && !GetRegisteredIn() &&
+ aObjectDepend.GetRegisteredIn())
+ ((SwModify*)aObjectDepend.GetRegisteredIn())->Remove(&aObjectDepend);
+ }
+}
+/*-- 10.12.98 12:54:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextRange::GetPositions(SwPaM& rToFill) const
+{
+ sal_Bool bRet = sal_False;
+ SwBookmark* pBkm = GetBookmark();
+ if(pBkm)
+ {
+ *rToFill.GetPoint() = pBkm->GetPos();
+ if(pBkm->GetOtherPos())
+ {
+ rToFill.SetMark();
+ *rToFill.GetMark() = *pBkm->GetOtherPos();
+ }
+ else
+ rToFill.DeleteMark();
+ bRet = sal_True;
+ }
+ return bRet;
+}
+/*-- 10.12.98 12:54:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextRange::XTextRangeToSwPaM( SwUnoInternalPaM& rToFill,
+ const uno::Reference< XTextRange > & xTextRange)
+{
+ sal_Bool bRet = sal_False;
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ SwXTextPortion* pPortion = 0;
+ SwXText* pText = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ pPortion = (SwXTextPortion*)xRangeTunnel->getSomething(
+ SwXTextPortion::getUnoTunnelId());
+ pText = (SwXText*)xRangeTunnel->getSomething(
+ SwXText::getUnoTunnelId());
+ }
+
+ //if it's a text cursor then create a temporary cursor there and re-use the pCursor variable
+ Reference< XTextCursor > xTextCursor;
+ if(pText)
+ {
+ xTextCursor = pText->createCursor();
+ xTextCursor->gotoEnd(sal_True);
+ Reference<XUnoTunnel> xCrsrTunnel( xTextCursor, UNO_QUERY);
+ pCursor = (OTextCursorHelper*)xCrsrTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+ if(pRange && pRange->GetDoc() == rToFill.GetDoc())
+ {
+ bRet = pRange->GetPositions(rToFill);
+ }
+ else
+ {
+ SwDoc* pDoc = pCursor ? pCursor->GetDoc() : NULL;
+ if ( !pDoc )
+ pDoc = pPortion ? pPortion->GetCrsr()->GetDoc() : NULL;
+ const SwPaM* pUnoCrsr = pCursor ? pCursor->GetPaM() : pPortion ? pPortion->GetCrsr() : 0;
+ if(pUnoCrsr && pDoc == rToFill.GetDoc())
+ {
+ DBG_ASSERT((SwPaM*)pUnoCrsr->GetNext() == pUnoCrsr, "was machen wir mit Ringen?" );
+ bRet = sal_True;
+ *rToFill.GetPoint() = *pUnoCrsr->GetPoint();
+ if(pUnoCrsr->HasMark())
+ {
+ rToFill.SetMark();
+ *rToFill.GetMark() = *pUnoCrsr->GetMark();
+ }
+ else
+ rToFill.DeleteMark();
+ }
+ }
+ return bRet;
+}
+/* -----------------24.02.99 14:18-------------------
+ * Der StartNode muss in einem existierenden Header/Footen liegen
+ * --------------------------------------------------*/
+sal_Bool lcl_IsStartNodeInFormat(sal_Bool bHeader, SwStartNode* pSttNode,
+ const SwFrmFmt* pFrmFmt, SwFrmFmt*& rpFormat)
+{
+ sal_Bool bRet = sal_False;
+ const SfxItemSet& rSet = pFrmFmt->GetAttrSet();
+ const SfxPoolItem* pItem;
+ SwFrmFmt* pHeadFootFmt;
+ if(SFX_ITEM_SET == rSet.GetItemState(bHeader ? RES_HEADER : RES_FOOTER, sal_True, &pItem) &&
+ 0 != (pHeadFootFmt = bHeader ?
+ ((SwFmtHeader*)pItem)->GetHeaderFmt() :
+ ((SwFmtFooter*)pItem)->GetFooterFmt()))
+ {
+ const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
+ const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
+ const SwStartNode* pCurSttNode = rNode.FindSttNodeByType(
+ bHeader ? SwHeaderStartNode : SwFooterStartNode);
+ if(pCurSttNode && pCurSttNode == pSttNode)
+ {
+ bRet = sal_True;
+ rpFormat = pHeadFootFmt;
+ }
+ }
+ return bRet;
+}
+/* -----------------03.11.98 15:58-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextRange::CreateTextRangeFromPosition(SwDoc* pDoc,
+ const SwPosition& rPos, const SwPosition* pMark)
+{
+ uno::Reference< XTextRange > aRet;
+ SwUnoCrsr* pNewCrsr = pDoc->CreateUnoCrsr(rPos, sal_False);
+ if(pMark)
+ {
+ pNewCrsr->SetMark();
+ *pNewCrsr->GetMark() = *pMark;
+ }
+ uno::Reference< XText > xParentText;
+ //jetzt besorgen wir uns mal den Parent:
+ SwStartNode* pSttNode = rPos.nNode.GetNode().FindStartNode();
+ while(pSttNode && pSttNode->IsSectionNode())
+ {
+ pSttNode = pSttNode->FindStartNode();
+ }
+ SwStartNodeType eType = pSttNode->GetStartNodeType();
+ switch(eType)
+ {
+ case SwTableBoxStartNode:
+ {
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
+ SwTableBox* pBox = pSttNode->GetTblBox();
+
+ if( pBox )
+ aRet = new SwXTextRange(*pTableFmt, *pBox, *pNewCrsr);
+ else
+ aRet = new SwXTextRange(*pTableFmt, *pSttNode, *pNewCrsr);
+ }
+ break;
+ case SwFlyStartNode:
+ {
+ SwFrmFmt* pFmt;
+ if(0 != (pFmt = pSttNode->GetFlyFmt()))
+ {
+ aRet = new SwXTextRange(*pFmt, *pNewCrsr);
+
+ }
+ }
+ break;
+ case SwHeaderStartNode:
+ case SwFooterStartNode:
+ {
+ sal_Bool bHeader = SwHeaderStartNode == eType;
+ sal_uInt16 nPDescCount = pDoc->GetPageDescCnt();
+ for(sal_uInt16 i = 0; i < nPDescCount; i++)
+ {
+ const SwPageDesc& rDesc = pDoc->GetPageDesc( i );
+ const SwFrmFmt* pFrmFmtMaster = &rDesc.GetMaster();
+ const SwFrmFmt* pFrmFmtLeft = &rDesc.GetLeft();
+
+ SwFrmFmt* pHeadFootFmt = 0;
+ if(!lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtMaster, pHeadFootFmt))
+ lcl_IsStartNodeInFormat(bHeader, pSttNode, pFrmFmtLeft, pHeadFootFmt);
+
+ if(pHeadFootFmt)
+ {
+ SwXHeadFootText* pxHdFt = (SwXHeadFootText*)SwClientIter( *pHeadFootFmt ).
+ First( TYPE( SwXHeadFootText ));
+ xParentText = pxHdFt;
+ if(!pxHdFt)
+ xParentText = new SwXHeadFootText(*pHeadFootFmt, bHeader);
+ break;
+ }
+ }
+ }
+ break;
+ case SwFootnoteStartNode:
+ {
+ sal_uInt16 n, nFtnCnt = pDoc->GetFtnIdxs().Count();
+ SwTxtFtn* pTxtFtn;
+ uno::Reference< XFootnote > xRef;
+ for( n = 0; n < nFtnCnt; ++n )
+ {
+ pTxtFtn = pDoc->GetFtnIdxs()[ n ];
+ const SwFmtFtn& rFtn = pTxtFtn->GetFtn();
+ const SwTxtFtn* pTxtFtn = rFtn.GetTxtFtn();
+#if OSL_DEBUG_LEVEL > 1
+ const SwStartNode* pTmpSttNode = pTxtFtn->GetStartNode()->GetNode().
+ FindSttNodeByType(SwFootnoteStartNode);
+#endif
+
+ if(pSttNode == pTxtFtn->GetStartNode()->GetNode().
+ FindSttNodeByType(SwFootnoteStartNode))
+ {
+ xParentText = ((SwUnoCallBack*)pDoc->GetUnoCallBack())->
+ GetFootnote(rFtn);
+ if(!xParentText.is())
+ xParentText = new SwXFootnote(pDoc, rFtn);
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ {
+ // dann ist es der Body-Text
+ uno::Reference<frame::XModel> xModel = pDoc->GetDocShell()->GetBaseModel();
+ uno::Reference< XTextDocument > xDoc(
+ xModel, uno::UNO_QUERY);
+ xParentText = xDoc->getText();
+ }
+ }
+ if(!aRet.is())
+ aRet = new SwXTextRange(*pNewCrsr, xParentText);
+ delete pNewCrsr;
+ return aRet;
+}
+/*Reference< XTextRange > SwXTextRange::createTextRangeFromPaM(
+ SwPaM& rPaM, Reference<XText> xParentText)
+{
+ Reference< XTextRange > xRet;
+ // in welcher Umgebung steht denn der PaM?
+ SwStartNode* pSttNode = rPaM.GetNode()->FindStartNode();
+ SwStartNodeType eType = pSttNode->GetStartNodeType();
+ uno::Reference< XText > xCurParentRef;
+ switch(eType)
+ {
+ case SwTableBoxStartNode:
+ {
+ SwTableBox* pBox = pSttNode->GetTblBox();
+ xRet = new SwXTextRange(*pBox->GetFrmFmt(), *pBox, rPaM);
+ }
+ break;
+ case SwFlyStartNode:
+ {
+ SwFrmFmt* pFlyFmt = pSttNode->GetFlyFmt();
+ SwXTextFrame* pxFrm = (SwXTextFrame*)SwClientIter( *pFlyFmt ).
+ First( TYPE( SwXTextFrame ));
+ if(pxFrm)
+ xCurParentRef = pxFrm;
+ else
+ xRet = new SwXTextRange(*pFlyFmt, rPaM);
+ }
+ break;
+ case SwFootnoteStartNode:
+ {
+ const SwFtnIdxs& rIdxs = rPaM.GetDoc()->GetFtnIdxs();
+ sal_uInt16 n, nFtnCnt = rIdxs.Count();
+ for( n = 0; n < nFtnCnt; ++n )
+ {
+ const SwTxtFtn* pFtn = rIdxs[ n ];
+
+ const SwStartNode* pTemp = 0;
+ const SwNode& rNode = pFtn->GetStartNode()->GetNode();
+ if(rNode.GetNodeType() == ND_STARTNODE)
+ pTemp = (const SwStartNode*)&rNode;
+ if(pSttNode == pTemp)
+ {
+ const SwFmtFtn& rFtn = pFtn->GetFtn();
+ //TODO: schon existierendes Fussnotenobjekt wiederfinden!
+ xCurParentRef = new SwXFootnote(rPaM.GetDoc(), rFtn);
+ break;
+ }
+ }
+ }
+ break;
+ case SwHeaderStartNode:
+ case SwFooterStartNode:
+ {
+ //PageStyle besorgen, HeaderText anlegen/erfragen,
+ //und dann SwXTextPosition damit anlegen
+ String sPageStyleName = SwUnoCursorHelper::GetCurPageStyle(rPaM);
+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupp(
+ rPaM.GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+
+ uno::Reference< container::XNameAccess > xStyles = xStyleSupp->getStyleFamilies();
+ uno::Any aStyleFamily = xStyles->getByName(C2U("PageStyles"));
+
+ uno::Reference< container::XNameContainer > xFamily =
+ *(uno::Reference< container::XNameContainer > *)aStyleFamily.getValue();
+ uno::Any aStyle = xFamily->getByName(sPageStyleName);
+ uno::Reference< style::XStyle > xStyle = *(uno::Reference< style::XStyle > *)aStyle.getValue();
+
+ uno::Reference< beans::XPropertySet > xPropSet(xStyle, uno::UNO_QUERY);
+ uno::Any aLayout = xPropSet->getPropertyValue(C2U(UNO_NAME_PAGE_STYLE_LAYOUT));
+
+ style::PageStyleLayout eLayout = *(style::PageStyleLayout*)aLayout.getValue();
+ uno::Any aShare = xPropSet->getPropertyValue(C2U(UNO_NAME_HEADER_IS_SHARED));
+ sal_Bool bShare;
+ aShare >>= bShare;
+ sal_Bool bLeft = sal_False;
+ sal_Bool bRight = sal_False;
+ //jetzt evtl. noch zw. linker/rechter Kopf-/Fusszeile unterscheiden
+ if(!bShare && eLayout == style::PageStyleLayout_MIRRORED)
+ {
+ uno::Reference<lang::XUnoTunnel> xTunnel(xStyle, uno::UNO_QUERY);
+ SwXPageStyle* pStyle = (SwXPageStyle*)
+ xTunnel->getSomething( SwXPageStyle::getUnoTunnelId());
+
+ DBG_ASSERT(pStyle, "Was ist das fuer ein style::XStyle?");
+ bLeft = pSttNode == pStyle->GetStartNode(eType == SwHeaderStartNode, sal_True);
+ bRight = !bLeft;
+ }
+ uno::Any aParent;
+ sal_Bool bFooter = eType == SwFooterStartNode;
+ if(eLayout == style::PageStyleLayout_LEFT || bLeft)
+ aParent = xPropSet->getPropertyValue(C2U(bFooter ? UNO_NAME_FOOTER_TEXT_LEFT : UNO_NAME_HEADER_TEXT_LEFT));
+ else if(eLayout == style::PageStyleLayout_RIGHT)
+ aParent = xPropSet->getPropertyValue(C2U(bFooter ? UNO_NAME_FOOTER_TEXT_RIGHT : UNO_NAME_HEADER_TEXT_RIGHT));
+ else
+ aParent = xPropSet->getPropertyValue(C2U(bFooter ? UNO_NAME_FOOTER_TEXT : UNO_NAME_HEADER_TEXT));
+
+ if(aParent.getValueType() != ::getVoidCppuType())
+ {
+ uno::Reference< XText > xText = *(uno::Reference< XText > *)aParent.getValue();
+ xCurParentRef = xText;
+ }
+ }
+
+
+ break;
+// case SwNormalStartNode:
+ default:
+ {
+ if(!xParentText.is())
+ {
+ uno::Reference< XTextDocument > xDoc(
+ rPaM.GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+ xParentText = xDoc->getText();
+ }
+ xCurParentRef = xParentText;
+ }
+ }
+ if(xCurParentRef.is() && !xRet.is())
+ xRet = new SwXTextRange(rPaM, xCurParentRef);
+ DBG_ASSERT(xRet.is(), "SwXTextRange not created");
+ return xRet;
+}*/
+
+/* -----------------------------03.04.00 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XEnumeration > SAL_CALL SwXTextRange::createContentEnumeration(
+ const OUString& rServiceName)
+ throw( RuntimeException )
+{
+ SwBookmark* pBkm = GetBookmark();
+ if( !pBkm || COMPARE_EQUAL != rServiceName.compareToAscii("com.sun.star.text.TextContent") )
+ throw RuntimeException();
+
+ const SwPosition& rPoint = pBkm->GetPos();
+ const SwPosition* pMark = pBkm->GetOtherPos();
+ SwUnoCrsr* pNewCrsr = pDoc->CreateUnoCrsr(rPoint, FALSE);
+ if(pMark && *pMark != rPoint)
+ {
+ pNewCrsr->SetMark();
+ *pNewCrsr->GetMark() = *pMark;
+ }
+ Reference< XEnumeration > xRet = new SwXParaFrameEnumeration(*pNewCrsr, PARAFRAME_PORTION_TEXTRANGE);
+ delete pNewCrsr;
+ return xRet;
+}
+/* -----------------------------07.03.01 14:55--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XEnumeration > SwXTextRange::createEnumeration(void) throw( RuntimeException )
+{
+ SwBookmark* pBkm = GetBookmark();
+ if( !pBkm )
+ throw RuntimeException();
+ const SwPosition& rPoint = pBkm->GetPos();
+ const SwPosition* pMark = pBkm->GetOtherPos();
+ SwUnoCrsr* pNewCrsr = pDoc->CreateUnoCrsr(rPoint, FALSE);
+ if(pMark && *pMark != rPoint)
+ {
+ pNewCrsr->SetMark();
+ *pNewCrsr->GetMark() = *pMark;
+ }
+ Reference<XUnoTunnel> xTunnel(xParentText, UNO_QUERY);
+ SwXText* pParentText = 0;
+ if(xTunnel.is())
+ {
+ pParentText = (SwXText*)xTunnel->getSomething(SwXText::getUnoTunnelId());
+ }
+ DBG_ASSERT(pParentText, "parent is not a SwXText");
+ CursorType eSetType = RANGE_IN_CELL == eRangePosition ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
+ Reference< XEnumeration > xRet = new SwXParagraphEnumeration(pParentText, *pNewCrsr, eSetType);
+ return xRet;
+}
+/* -----------------------------07.03.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Type SwXTextRange::getElementType(void) throw( RuntimeException )
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+/* -----------------------------07.03.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXTextRange::hasElements(void) throw( RuntimeException )
+{
+ return sal_True;
+}
+/* -----------------------------03.04.00 09:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SAL_CALL SwXTextRange::getAvailableServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = OUString::createFromAscii("com.sun.star.text.TextContent");
+ return aRet;
+}
+/*-- 03.05.00 12:41:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SAL_CALL SwXTextRange::getPropertySetInfo( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Reference< XPropertySetInfo > xRef =
+ aPropSet.getPropertySetInfo();
+ return xRef;
+}
+/*-- 03.05.00 12:41:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextRange::setPropertyValue(
+ const OUString& rPropertyName, const Any& rValue )
+ throw(UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc() || !GetBookmark())
+ throw RuntimeException();
+ SwPaM aPaM(GetDoc()->GetNodes());
+ SwXTextRange::GetPositions(aPaM);
+ SwXTextCursor::SetPropertyValue(aPaM, aPropSet, rPropertyName, rValue);
+}
+/*-- 03.05.00 12:41:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SAL_CALL SwXTextRange::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc() || !GetBookmark())
+ throw RuntimeException();
+ SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes());
+ SwXTextRange::GetPositions(aPaM);
+ return SwXTextCursor::GetPropertyValue(aPaM, aPropSet, rPropertyName);
+}
+/*-- 03.05.00 12:41:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextRange::addPropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 03.05.00 12:41:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextRange::removePropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 03.05.00 12:41:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextRange::addVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 03.05.00 12:41:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextRange::removeVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 03.05.00 12:41:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+PropertyState SAL_CALL SwXTextRange::getPropertyState( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc() || !GetBookmark())
+ throw RuntimeException();
+ SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes());
+ SwXTextRange::GetPositions(aPaM);
+ return SwXTextCursor::GetPropertyState(aPaM, aPropSet, rPropertyName);
+}
+/*-- 03.05.00 12:41:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< PropertyState > SAL_CALL SwXTextRange::getPropertyStates(
+ const Sequence< OUString >& rPropertyName ) throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc() || !GetBookmark())
+ throw RuntimeException();
+ SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes());
+ SwXTextRange::GetPositions(aPaM);
+ return SwXTextCursor::GetPropertyStates(aPaM, aPropSet, rPropertyName);
+}
+/*-- 03.05.00 12:41:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextRange::setPropertyToDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc() || !GetBookmark())
+ throw RuntimeException();
+ SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes());
+ SwXTextRange::GetPositions(aPaM);
+ SwXTextCursor::SetPropertyToDefault(aPaM, aPropSet, rPropertyName);
+}
+/*-- 03.05.00 12:41:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SAL_CALL SwXTextRange::getPropertyDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc() || !GetBookmark())
+ throw RuntimeException();
+ SwPaM aPaM(((SwDoc*)GetDoc())->GetNodes());
+ SwXTextRange::GetPositions(aPaM);
+ return SwXTextCursor::GetPropertyDefault(aPaM, aPropSet, rPropertyName);
+}
+
+/******************************************************************
+ * SwXTextRanges
+ ******************************************************************/
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextRanges::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextRanges::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/****************************************************************************
+ * Text positions
+ * Bis zum ersten Zugriff auf eine TextPosition wird ein SwCursor gehalten,
+ * danach wird ein Array mit uno::Reference< XTextPosition > angelegt
+ *
+****************************************************************************/
+SV_IMPL_PTRARR(XTextRangeArr, XTextRangeRefPtr);
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextRanges::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextRanges");
+}
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextRanges::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextRanges") == rServiceName;
+}
+/* -----------------------------06.04.00 16:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextRanges::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextRanges");
+ return aRet;
+}
+/*-- 10.12.98 13:57:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRanges::SwXTextRanges() :
+ pRangeArr(0)
+{
+
+}
+/*-- 10.12.98 13:57:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRanges::SwXTextRanges(SwPaM* pCrsr) :
+ pRangeArr(0)
+{
+ SwUnoCrsr* pUnoCrsr = pCrsr->GetDoc()->CreateUnoCrsr(*pCrsr->GetPoint());
+ if(pCrsr->HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *pCrsr->GetMark();
+ }
+ if(pCrsr->GetNext() != pCrsr)
+ {
+ SwPaM *_pStartCrsr = (SwPaM *)pCrsr->GetNext();
+ do
+ {
+ //neuen PaM erzeugen
+ SwPaM* pPaM = _pStartCrsr->HasMark() ?
+ new SwPaM(*_pStartCrsr->GetMark(), *_pStartCrsr->GetPoint()) :
+ new SwPaM(*_pStartCrsr->GetPoint());
+ //und in den Ring einfuegen
+ pPaM->MoveTo(pUnoCrsr);
+
+ } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != pCrsr );
+ }
+
+ pUnoCrsr->Add(this);
+}
+/*-- 10.12.98 13:57:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextRanges::~SwXTextRanges()
+{
+ SwUnoCrsr* pCrsr = GetCrsr();
+ delete pCrsr;
+ if(pRangeArr)
+ {
+ pRangeArr->DeleteAndDestroy(0, pRangeArr->Count());
+ delete pRangeArr;
+ }
+}
+/*-- 10.12.98 13:57:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXTextRanges::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nRet = 0;
+ SwUnoCrsr* pCrsr = GetCrsr();
+ if(pCrsr)
+ {
+ FOREACHUNOPAM_START(pCrsr)
+ nRet++;
+ FOREACHUNOPAM_END()
+ }
+ else if(pRangeArr)
+ nRet = pRangeArr->Count();
+ return nRet;
+}
+/*-- 10.12.98 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextRanges::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > aRef;
+ XTextRangeArr* pArr = ((SwXTextRanges*)this)->GetRangesArray();
+ if(pArr && pArr->Count() > nIndex)
+ {
+ XTextRangeRefPtr pRef = pArr->GetObject( USHORT( nIndex ));
+ aRef = *pRef;
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+ uno::Any aRet(&aRef, ::getCppuType((uno::Reference<XTextRange>*)0));
+ return aRet;
+}
+/*-- 10.12.98 13:57:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXTextRanges::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+/*-- 10.12.98 13:57:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextRanges::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return getCount() > 0;
+}
+/* -----------------10.12.98 14:25-------------------
+ *
+ * --------------------------------------------------*/
+XTextRangeArr* SwXTextRanges::GetRangesArray()
+{
+ SwUnoCrsr* pCrsr = GetCrsr();
+ if(!pRangeArr && pCrsr)
+ {
+ pRangeArr = new XTextRangeArr();
+ FOREACHUNOPAM_START(pCrsr)
+
+ Reference< XTextRange >* pPtr =
+ new Reference<XTextRange>( SwXTextRange::CreateTextRangeFromPosition(PUNOPAM->GetDoc(),
+ *PUNOPAM->GetPoint(), PUNOPAM->GetMark()));
+// new Reference<XTextRange>( SwXTextRange::createTextRangeFromPaM(*PUNOPAM, xParentText));
+ if(pPtr->is())
+ pRangeArr->Insert(pPtr, pRangeArr->Count());
+ FOREACHUNOPAM_END()
+ pCrsr->Remove( this );
+ }
+ return pRangeArr;
+}
+/*-- 10.12.98 13:57:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextRanges::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+/* -----------------11.12.98 10:07-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextCursor::SetString(SwCursor& rCrsr, const OUString& rString)
+{
+ // Start/EndAction
+ SwDoc* pDoc = rCrsr.GetDoc();
+ UnoActionContext aAction(pDoc);
+ String aText(rString);
+ xub_StrLen nTxtLen = aText.Len();
+ if(rCrsr.HasMark())
+ pDoc->DeleteAndJoin(rCrsr);
+ if(nTxtLen)
+ {
+ //OPT: GetSystemCharSet
+ if( !pDoc->Insert(rCrsr, aText) )
+ {
+ ASSERT( sal_False, "Doc->Insert(Str) failed." )
+ }
+ SwXTextCursor::SelectPam(rCrsr, sal_True);
+ rCrsr.Left(nTxtLen, CRSR_SKIP_CHARS);
+ }
+}
+/******************************************************************
+ * SwXParaFrameEnumeration
+ ******************************************************************/
+SV_IMPL_PTRARR(SwDependArr, SwDepend*);
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXParaFrameEnumeration::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXParaFrameEnumeration");
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXParaFrameEnumeration::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.util.ContentEnumeration") == rServiceName;
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXParaFrameEnumeration::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.util.ContentEnumeration");
+ return aRet;
+}
+/*-- 23.03.99 13:22:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParaFrameEnumeration::SwXParaFrameEnumeration(const SwUnoCrsr& rUnoCrsr,
+ sal_uInt8 nParaFrameMode,
+ SwFrmFmt* pFmt)
+{
+ SwDoc* pDoc = rUnoCrsr.GetDoc();
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(*rUnoCrsr.GetPoint(), sal_False);
+ if(rUnoCrsr.HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *rUnoCrsr.GetMark();
+ }
+ pUnoCrsr->Add(this);
+
+ if(PARAFRAME_PORTION_PARAGRAPH == nParaFrameMode)
+ ::binfilter::CollectFrameAtNode( *this, rUnoCrsr.GetPoint()->nNode,
+ aFrameArr, FALSE );
+ else if(pFmt)
+ {
+ //jetzt einen SwDepend anlegen und in das Array einfuegen
+ SwDepend* pNewDepend = new SwDepend(this, pFmt);
+ aFrameArr.C40_INSERT(SwDepend, pNewDepend, aFrameArr.Count());
+ }
+ else if((PARAFRAME_PORTION_CHAR == nParaFrameMode) ||
+ (PARAFRAME_PORTION_TEXTRANGE == nParaFrameMode))
+ {
+ if(PARAFRAME_PORTION_TEXTRANGE == nParaFrameMode)
+ {
+ SwPosFlyFrms aFlyFrms;
+ //get all frames that are bound at paragraph or at character
+ pDoc->GetAllFlyFmts(aFlyFrms, pUnoCrsr);//, bDraw);
+ for(USHORT i = 0; i < aFlyFrms.Count(); i++)
+ {
+ SwPosFlyFrm* pPosFly = aFlyFrms[i];
+ SwFrmFmt* pFrmFmt = (SwFrmFmt*)&pPosFly->GetFmt();
+ //jetzt einen SwDepend anlegen und in das Array einfuegen
+ SwDepend* pNewDepend = new SwDepend(this, pFrmFmt);
+ aFrameArr.C40_INSERT(SwDepend, pNewDepend, aFrameArr.Count());
+ }
+ //created from any text range
+ if(pUnoCrsr->HasMark())
+ {
+ if(pUnoCrsr->Start() != pUnoCrsr->GetPoint())
+ pUnoCrsr->Exchange();
+ do
+ {
+ FillFrame(*pUnoCrsr);
+ pUnoCrsr->Right(1, CRSR_SKIP_CHARS);
+ }
+ while(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark());
+ }
+ }
+ FillFrame(*pUnoCrsr);
+ }
+}
+/*-- 23.03.99 13:22:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParaFrameEnumeration::~SwXParaFrameEnumeration()
+{
+ aFrameArr.DeleteAndDestroy(0, aFrameArr.Count());
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ delete pUnoCrsr;
+}
+/* -----------------------------03.04.00 10:15--------------------------------
+ Description: Search for a FLYCNT text attribute at the cursor point
+ and fill the frame into the array
+ ---------------------------------------------------------------------------*/
+void SwXParaFrameEnumeration::FillFrame(SwUnoCrsr& rUnoCrsr)
+{
+ // search for objects at the cursor - anchored at/as char
+ SwTxtAttr* pTxtAttr = rUnoCrsr.GetNode()->GetTxtNode()->GetTxtAttr(
+ rUnoCrsr.GetPoint()->nContent, RES_TXTATR_FLYCNT);
+ if(pTxtAttr)
+ {
+ const SwFmtFlyCnt& rFlyCnt = pTxtAttr->GetFlyCnt();
+ SwFrmFmt* pFrmFmt = rFlyCnt.GetFrmFmt();
+ //jetzt einen SwDepend anlegen und in das Array einfuegen
+ SwDepend* pNewDepend = new SwDepend(this, pFrmFmt);
+ aFrameArr.C40_INSERT(SwDepend, pNewDepend, aFrameArr.Count());
+ }
+}
+/*-- 23.03.99 13:22:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXParaFrameEnumeration::hasMoreElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetCrsr())
+ throw uno::RuntimeException();
+ return xNextObject.is() ? sal_True : CreateNextObject();
+}
+/*-- 23.03.99 13:22:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXParaFrameEnumeration::nextElement(void)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetCrsr())
+ throw uno::RuntimeException();
+ if(!xNextObject.is() && aFrameArr.Count())
+ {
+ CreateNextObject();
+ }
+ if(!xNextObject.is())
+ throw container::NoSuchElementException();
+ uno::Any aRet(&xNextObject, ::getCppuType((uno::Reference<XTextContent>*)0));
+ xNextObject = 0;
+ return aRet;
+}
+/* -----------------23.03.99 13:38-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXParaFrameEnumeration::CreateNextObject()
+{
+ if(!aFrameArr.Count())
+ return sal_False;
+ SwDepend* pDepend = aFrameArr.GetObject(0);
+ aFrameArr.Remove(0);
+ SwFrmFmt* pFormat = (SwFrmFmt*)pDepend->GetRegisteredIn();
+ delete pDepend;
+ // the format should be valid her otherwise the client
+ // would have been removed in ::Modify
+ // check for a shape first
+ SwClientIter aIter(*pFormat);
+ SwDrawContact* pContact = (SwDrawContact*)
+ aIter.First(TYPE(SwDrawContact));
+ if(pContact)
+ {
+ SdrObject* pSdr = pContact->GetMaster();
+ if(pSdr)
+ {
+ xNextObject = uno::Reference< XTextContent >(pSdr->getUnoShape(), uno::UNO_QUERY);
+ }
+ }
+ else
+ {
+ const SwNodeIndex* pIdx = pFormat->GetCntnt().GetCntntIdx();
+ DBG_ASSERT(pIdx, "where is the index?");
+ const SwNode* pNd = GetCrsr()->GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
+
+ FlyCntType eType;
+ if(!pNd->IsNoTxtNode())
+ eType = FLYCNTTYPE_FRM;
+ else if(pNd->IsGrfNode())
+ eType = FLYCNTTYPE_GRF;
+ else
+ eType = FLYCNTTYPE_OLE;
+
+ uno::Reference< container::XNamed > xFrame = SwXFrames::GetObject(*pFormat, eType);
+ xNextObject = uno::Reference< XTextContent >(xFrame, uno::UNO_QUERY);
+ }
+
+ return xNextObject.is();
+}
+
+/*-- 23.03.99 13:22:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParaFrameEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ break;
+
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ break;
+ }
+ if(!GetRegisteredIn())
+ {
+ aFrameArr.DeleteAndDestroy(0, aFrameArr.Count());
+ xNextObject = 0;
+ }
+ else
+ {
+ //dann war es vielleicht ein Frame am Absatz?
+ for(sal_uInt16 i = aFrameArr.Count(); i; i--)
+ {
+ SwDepend* pDepend = aFrameArr.GetObject(i-1);
+ if(!pDepend->GetRegisteredIn())
+ {
+ delete pDepend;
+ aFrameArr.Remove(i-1);
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2(SwXTextCursor,SwXTextCursor_Base,OTextCursorHelper)
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoparagraph.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoparagraph.cxx
new file mode 100644
index 000000000000..945d0fb27641
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoparagraph.cxx
@@ -0,0 +1,838 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <cmdid.h>
+#include <unomid.h>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+#include <unoprnms.hxx>
+#include <unocrsrhelper.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTSSORT
+#include <bf_svtools/svstdarr.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+//using namespace ::com::sun::star::drawing;
+
+
+using rtl::OUString;
+
+/******************************************************************
+ * SwXParagraph
+ ******************************************************************/
+/* -----------------------------11.07.00 12:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXParagraph* SwXParagraph::GetImplementation(Reference< XInterface> xRef )
+{
+ uno::Reference<lang::XUnoTunnel> xParaTunnel( xRef, uno::UNO_QUERY);
+ if(xParaTunnel.is())
+ return (SwXParagraph*)xParaTunnel->getSomething(SwXParagraph::getUnoTunnelId());
+ return 0;
+}
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXParagraph::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXParagraph::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/* -----------------------------06.04.00 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXParagraph::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXParagraph");
+}
+/* -----------------------------06.04.00 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXParagraph::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return sServiceName.EqualsAscii("com.sun.star.text.TextContent") ||
+ sServiceName.EqualsAscii("com.sun.star.text.Paragraph") ||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterProperties")||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesAsian")||
+ sServiceName.EqualsAscii("com.sun.star.style.CharacterPropertiesComplex")||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphProperties") ||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
+ sServiceName.EqualsAscii("com.sun.star.style.ParagraphPropertiesComplex");
+}
+/* -----------------------------06.04.00 16:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXParagraph::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(8);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.Paragraph");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ pArray[7] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+/*-- 11.12.98 08:12:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraph::SwXParagraph() :
+ aLstnrCntnr( (XTextRange*)this),
+ xParentText(0),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH)),
+ m_bIsDescriptor(TRUE),
+ nSelectionStartPos(-1),
+ nSelectionEndPos(-1)
+{
+}
+
+/*-- 11.12.98 08:12:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraph::SwXParagraph(SwXText* pParent, SwUnoCrsr* pCrsr, sal_Int32 nSelStart, sal_Int32 nSelEnd) :
+ SwClient(pCrsr),
+ xParentText(pParent),
+ aLstnrCntnr( (XTextRange*)this),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH)),
+ m_bIsDescriptor(FALSE),
+ nSelectionStartPos(nSelStart),
+ nSelectionEndPos(nSelEnd)
+{
+}
+/*-- 11.12.98 08:12:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXParagraph::~SwXParagraph()
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ delete pUnoCrsr;
+}
+/* -----------------------------11.07.00 14:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXParagraph::attachToText(SwXText* pParent, SwUnoCrsr* pCrsr)
+{
+ DBG_ASSERT(m_bIsDescriptor, "Paragraph is not a descriptor");
+ if(m_bIsDescriptor)
+ {
+ m_bIsDescriptor = FALSE;
+ pCrsr->Add(this);
+ xParentText = pParent;
+ if(m_sText.getLength())
+ {
+ try { setString(m_sText); }
+ catch(...){}
+ m_sText = OUString();
+ }
+ }
+}
+/*-- 11.12.98 08:12:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXParagraph::getPropertySetInfo(void)
+ throw( RuntimeException )
+{
+ static Reference< XPropertySetInfo > xRef = aPropSet.getPropertySetInfo();
+ return xRef;
+}
+/*-- 11.12.98 08:12:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::setPropertyValue(const OUString& rPropertyName, const Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Sequence<OUString> aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ Sequence<Any> aValues(1);
+ aValues.getArray()[0] = aValue;
+ setPropertyValues(aPropertyNames, aValues);
+}
+/*-- 11.12.98 08:12:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXParagraph::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Sequence<OUString> aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ Sequence< Any > aRet = getPropertyValues(aPropertyNames );
+ return aRet.getConstArray()[0];
+}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXParagraph::setPropertyValues(
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& aValues )
+ throw(PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ const Any* pValues = aValues.getConstArray();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ OUString sTmp;
+ SwParaSelection aParaSel(pUnoCrsr);
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwXTextCursor::SetPropertyValue(*pUnoCrsr, aPropSet,
+ sTmp, pValues[nProp], pMap);
+ pMap++;
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Any > SwXParagraph::getPropertyValues(
+ const Sequence< OUString >& rPropertyNames )
+ throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< Any > aValues(rPropertyNames.getLength());
+ SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ Any* pValues = aValues.getArray();
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ SwNode& rTxtNode = pUnoCrsr->GetPoint()->nNode.GetNode();
+ SwAttrSet& rAttrSet = ((SwTxtNode&)rTxtNode).GetSwAttrSet();
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]);
+ if(pMap)
+ {
+ if(!SwXParagraph::getDefaultTextContentValue(
+ pValues[nProp], pPropertyNames[nProp], pMap->nWID))
+ {
+ BOOL bDone = FALSE;
+ PropertyState eTemp;
+ bDone = SwUnoCursorHelper::getCrsrPropertyValue(
+ pMap, *pUnoCrsr, &(pValues[nProp]), eTemp, rTxtNode.GetTxtNode() );
+ if(!bDone)
+ pValues[nProp] = aPropSet.getPropertyValue(*pMap, rAttrSet);
+ }
+ ++pMap;
+ }
+ else
+ throw RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+ else
+ throw RuntimeException();
+ return aValues;
+}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXParagraph::addPropertiesChangeListener(
+ const Sequence< OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXParagraph::removePropertiesChangeListener(
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{}
+/* -----------------------------02.04.01 11:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXParagraph::firePropertiesChangeEvent(
+ const Sequence< OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{}
+/* -----------------------------12.09.00 11:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXParagraph::getDefaultTextContentValue(Any& rAny, const OUString& rPropertyName, USHORT nWID)
+{
+ if(!nWID)
+ {
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)))
+ nWID = FN_UNO_ANCHOR_TYPE;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPES)))
+ nWID = FN_UNO_ANCHOR_TYPES;
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_TEXT_WRAP)))
+ nWID = FN_UNO_TEXT_WRAP;
+ else
+ return FALSE;
+ }
+
+ switch(nWID)
+ {
+ case FN_UNO_TEXT_WRAP: rAny <<= WrapTextMode_NONE; break;
+ case FN_UNO_ANCHOR_TYPE: rAny <<= TextContentAnchorType_AT_PARAGRAPH; break;
+ case FN_UNO_ANCHOR_TYPES:
+ { Sequence<TextContentAnchorType> aTypes(1);
+ TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = TextContentAnchorType_AT_PARAGRAPH;
+ rAny.setValue(&aTypes, ::getCppuType((uno::Sequence<TextContentAnchorType>*)0));
+ }
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+/*-- 11.12.98 08:12:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::addPropertyChangeListener(
+ const OUString& PropertyName,
+ const uno::Reference< beans::XPropertyChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 08:12:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 08:12:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 08:12:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+//-----------------------------------------------------------------------------
+beans::PropertyState lcl_SwXParagraph_getPropertyState(
+ SwUnoCrsr& rUnoCrsr,
+ const SwAttrSet** ppSet,
+ const SfxItemPropertyMap& rMap,
+ sal_Bool &rAttrSetFetched )
+ throw( beans::UnknownPropertyException)
+{
+ beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
+
+ if(!(*ppSet) && !rAttrSetFetched )
+ {
+ SwNode& rTxtNode = rUnoCrsr.GetPoint()->nNode.GetNode();
+ (*ppSet) = ((SwTxtNode&)rTxtNode).GetpSwAttrSet();
+ rAttrSetFetched = sal_True;
+ }
+ switch( rMap.nWID )
+ {
+ case FN_UNO_NUM_RULES:
+ //wenn eine Numerierung gesetzt ist, dann hier herausreichen, sonst nichts tun
+ SwUnoCursorHelper::getNumberingProperty( rUnoCrsr, eRet, NULL );
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ break;
+ case RES_ANCHOR:
+ if ( MID_SURROUND_SURROUNDTYPE != rMap.nMemberId )
+ goto lcl_SwXParagraph_getPropertyStateDEFAULT;
+ break;
+ case RES_SURROUND:
+ if ( MID_ANCHOR_ANCHORTYPE != rMap.nMemberId )
+ goto lcl_SwXParagraph_getPropertyStateDEFAULT;
+ break;
+ case FN_UNO_PARA_STYLE:
+ case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
+ {
+ SwFmtColl* pFmt = SwXTextCursor::GetCurTxtFmtColl(
+ rUnoCrsr, rMap.nWID == FN_UNO_PARA_CONDITIONAL_STYLE_NAME);
+ eRet = pFmt ? beans::PropertyState_DIRECT_VALUE
+ : beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ case FN_UNO_PAGE_STYLE:
+ {
+ String sVal;
+ SwUnoCursorHelper::GetCurPageStyle( rUnoCrsr, sVal );
+ eRet = sVal.Len() ? beans::PropertyState_DIRECT_VALUE
+ : beans::PropertyState_AMBIGUOUS_VALUE;
+ }
+ break;
+ lcl_SwXParagraph_getPropertyStateDEFAULT:
+ default:
+ if((*ppSet) && SFX_ITEM_SET == (*ppSet)->GetItemState(rMap.nWID, FALSE))
+ eRet = beans::PropertyState_DIRECT_VALUE;
+ break;
+ }
+ return eRet;
+}
+
+/*-- 05.03.99 11:37:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SwXParagraph::getPropertyState(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
+ SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
+ if( pUnoCrsr )
+ {
+ const SwAttrSet* pSet = 0;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName );
+ if(!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ sal_Bool bDummy = sal_False;
+ eRet = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet, *pMap,
+ bDummy );
+ }
+ else
+ throw uno::RuntimeException();
+ return eRet;
+}
+/*-- 05.03.99 11:37:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+uno::Sequence< beans::PropertyState > SwXParagraph::getPropertyStates(
+ const uno::Sequence< OUString >& PropertyNames)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ const OUString* pNames = PropertyNames.getConstArray();
+ uno::Sequence< beans::PropertyState > aRet(PropertyNames.getLength());
+ beans::PropertyState* pStates = aRet.getArray();
+
+ SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ if( pUnoCrsr )
+ {
+ const SwAttrSet* pSet = 0;
+ sal_Bool bAttrSetFetched = sal_False;
+ for(sal_Int32 i = 0, nEnd = PropertyNames.getLength(); i < nEnd; i++,++pStates,++pMap,++pNames )
+ {
+ pMap = SfxItemPropertyMap::GetByName( pMap, *pNames );
+ if(!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + *pNames, static_cast < cppu::OWeakObject * > ( this ) );
+ if (bAttrSetFetched && !pSet &&
+ pMap->nWID >= RES_CHRATR_BEGIN &&
+ pMap->nWID <= RES_UNKNOWNATR_END )
+ *pStates = beans::PropertyState_DEFAULT_VALUE;
+ else
+ *pStates = lcl_SwXParagraph_getPropertyState( *pUnoCrsr, &pSet,*pMap, bAttrSetFetched );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+
+ return aRet;
+}
+/*-- 05.03.99 11:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPE)) ||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_ANCHOR_TYPES)) ||
+ rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_TEXT_WRAP)))
+ return;
+
+ // Absatz selektieren
+ SwParaSelection aParaSel(pUnoCrsr);
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only:" ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(pMap->nWID < RES_FRMATR_END)
+ {
+ SvUShortsSort aWhichIds;
+ aWhichIds.Insert(pMap->nWID);
+ if(pMap->nWID < RES_PARATR_BEGIN)
+ pUnoCrsr->GetDoc()->ResetAttr(*pUnoCrsr, sal_True, &aWhichIds);
+ else
+ {
+ //fuer Absatzattribute muss die Selektion jeweils auf
+ //Absatzgrenzen erweitert werden
+ SwPosition aStart = *pUnoCrsr->Start();
+ SwPosition aEnd = *pUnoCrsr->End();
+ SwUnoCrsr* pTemp = pUnoCrsr->GetDoc()->CreateUnoCrsr(aStart, sal_False);
+ if(!SwUnoCursorHelper::IsStartOfPara(*pTemp))
+ {
+ pTemp->MovePara(fnParaCurr, fnParaStart);
+ }
+ pTemp->SetMark();
+ *pTemp->GetPoint() = aEnd;
+ //pTemp->Exchange();
+ SwXTextCursor::SelectPam(*pTemp, sal_True);
+ if(!SwUnoCursorHelper::IsEndOfPara(*pTemp))
+ {
+ pTemp->MovePara(fnParaCurr, fnParaEnd);
+ }
+ pTemp->GetDoc()->ResetAttr(*pTemp, sal_True, &aWhichIds);
+ delete pTemp;
+ }
+ }
+ else
+ SwUnoCursorHelper::resetCrsrPropertyValue(pMap, *pUnoCrsr);
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 05.03.99 11:37:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXParagraph::getPropertyDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ uno::Any aRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ if(SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName))
+ return aRet;
+
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ if(pMap->nWID < RES_FRMATR_END)
+ {
+ const SfxPoolItem& rDefItem =
+ pUnoCrsr->GetDoc()->GetAttrPool().GetDefaultItem(pMap->nWID);
+ rDefItem.QueryValue(aRet, pMap->nMemberId);
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+
+ return aRet;
+}
+/*-- 11.12.98 08:12:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::attach(const uno::Reference< XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ // SwXParagraph will only created in order to be inserteb by
+ // 'insertTextContentBefore' or 'insertTextContentAfter' therefore
+ // they cannot be attached
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 08:12:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXParagraph::getAnchor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > aRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ // Absatz selektieren
+ SwParaSelection aSelection(pUnoCrsr);
+ aRet = new SwXTextRange(*pUnoCrsr, xParentText);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 08:12:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = ((SwXParagraph*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ // Absatz selektieren
+ {
+ SwParaSelection aSelection(pUnoCrsr);
+ pUnoCrsr->GetDoc()->DelFullPara(*pUnoCrsr);
+ }
+ aLstnrCntnr.Disposing();
+ delete pUnoCrsr;
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 08:12:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 11.12.98 08:12:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 08:12:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXParagraph::createEnumeration(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< container::XEnumeration > aRef;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ aRef = new SwXTextPortionEnumeration(*pUnoCrsr, xParentText, nSelectionStartPos, nSelectionEndPos);
+ else
+ throw uno::RuntimeException();
+ return aRef;
+
+}
+/*-- 11.12.98 08:12:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXParagraph::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+/*-- 11.12.98 08:12:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXParagraph::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(((SwXParagraph*)this)->GetCrsr())
+ return sal_True;
+ else
+ return sal_False;
+}
+/*-- 11.12.98 08:12:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XText > SwXParagraph::getText(void) throw( uno::RuntimeException )
+{
+ return xParentText;
+}
+/*-- 11.12.98 08:12:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXParagraph::getStart(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if( pUnoCrsr)
+ {
+ SwPaM aPam(*pUnoCrsr->Start());
+ uno::Reference< XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 11.12.98 08:12:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXParagraph::getEnd(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if( pUnoCrsr)
+ {
+ SwPaM aPam(*pUnoCrsr->End());
+ uno::Reference< XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 11.12.98 08:12:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXParagraph::getString(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ OUString aRet;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if( pUnoCrsr)
+ {
+ SwParaSelection aSelection(pUnoCrsr);
+ SwXTextCursor::getTextFromPam(*pUnoCrsr, aRet);
+ }
+ else if(IsDescriptor())
+ aRet = m_sText;
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 08:12:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+
+ if(pUnoCrsr)
+ {
+ if(!SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr))
+ pUnoCrsr->MovePara(fnParaCurr, fnParaStart);
+ SwXTextCursor::SelectPam(*pUnoCrsr, sal_True);
+ if(pUnoCrsr->GetNode()->GetTxtNode()->GetTxt().Len())
+ pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
+ SwXTextCursor::SetString(*pUnoCrsr, aString);
+ SwXTextCursor::SelectPam(*pUnoCrsr, sal_False);
+ }
+ else if(IsDescriptor())
+ m_sText = aString;
+ else
+ throw uno::RuntimeException();
+
+}
+/* -----------------23.03.99 12:49-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXParagraph::createContentEnumeration(const OUString& rServiceName)
+ throw( uno::RuntimeException )
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if( !pUnoCrsr || COMPARE_EQUAL != rServiceName.compareToAscii("com.sun.star.text.TextContent") )
+ throw uno::RuntimeException();
+
+ uno::Reference< container::XEnumeration > xRet = new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_PARAGRAPH);
+ return xRet;
+}
+/* -----------------23.03.99 12:49-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXParagraph::getAvailableServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+/*-- 11.12.98 08:12:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXParagraph::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ aLstnrCntnr.Disposing();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoport.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoport.cxx
new file mode 100644
index 000000000000..99e343600779
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoport.cxx
@@ -0,0 +1,900 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <cmdid.h>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <errhdl.hxx>
+
+#include <unocrsrhelper.hxx>
+#include <unoport.hxx>
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unoprnms.hxx>
+#include <unocrsr.hxx>
+#include <unomid.h>
+#include <txtatr.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <fmtflcnt.hxx>
+#include <fmtfld.hxx>
+#include <frmfmt.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+
+
+/******************************************************************
+ * SwXTextPortion
+ ******************************************************************/
+
+/*-- 11.12.98 09:56:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwFmtFld* SwXTextPortion::GetFldFmt(sal_Bool bInit)
+{
+ SwFmtFld* pRet = 0;
+ // initial wird es immer gesucht, danach nur noch, wenn es bereits existierte
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr && (bInit || pFmtFld))
+ {
+ SwTxtNode *pNode = pUnoCrsr->GetPoint()->nNode.GetNode().GetTxtNode();
+ SwTxtFld *pTxtFld = 0;
+ if( pNode )
+ pTxtFld = pNode->GetTxtFld( pUnoCrsr->Start()->nContent );
+ if(pTxtFld)
+ pFmtFld = pRet = (SwFmtFld*)&pTxtFld->GetFld();
+ }
+ return pRet;
+}
+/*-- 11.12.98 09:56:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr,
+ uno::Reference< XText > & rParent,
+ SwTextPortionType eType) :
+ aPropSet(aSwMapProvider.GetPropertyMap(
+ (PORTION_REDLINE_START == eType ||
+ PORTION_REDLINE_END == eType) ?
+ PROPERTY_MAP_REDLINE_PORTION : PROPERTY_MAP_TEXTPORTION_EXTENSIONS)),
+ aLstnrCntnr( (XTextRange*)this),
+ pFmtFld(0),
+ xParentText(rParent),
+ ePortionType(eType),
+ pFrameFmt(0),
+ aFrameDepend(this, 0),
+ bIsCollapsed(FALSE),
+ nControlChar(0),
+ pRubyText(0),
+ pRubyStyle(0),
+ pRubyAdjust(0),
+ pRubyIsAbove(0)
+{
+ SwUnoCrsr* pUnoCrsr = pPortionCrsr->GetDoc()->CreateUnoCrsr(*pPortionCrsr->GetPoint());
+ if(pPortionCrsr->HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *pPortionCrsr->GetMark();
+ }
+ pUnoCrsr->Add(this);
+ // erst nach ->Add()
+ if(ePortionType == PORTION_FIELD)
+ GetFldFmt(sal_True);
+// else if(ePortionType == PORTION_FRAME)
+// ...;
+}
+/* -----------------24.03.99 16:30-------------------
+ *
+ * --------------------------------------------------*/
+SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XText > & rParent,
+ SwFrmFmt& rFmt ) :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXTPORTION_EXTENSIONS)),
+ aLstnrCntnr( (XTextRange*)this),
+ pFrameFmt(&rFmt),
+ xParentText(rParent),
+ ePortionType(PORTION_FRAME),
+ pFmtFld(0),
+ aFrameDepend(this, &rFmt),
+ bIsCollapsed(FALSE),
+ nControlChar(0),
+ pRubyText(0),
+ pRubyStyle(0),
+ pRubyAdjust(0),
+ pRubyIsAbove(0)
+{
+ SwUnoCrsr* pUnoCrsr = pPortionCrsr->GetDoc()->CreateUnoCrsr(*pPortionCrsr->GetPoint());
+ if(pPortionCrsr->HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *pPortionCrsr->GetMark();
+ }
+ pUnoCrsr->Add(this);
+}
+
+/*-- 11.12.98 09:56:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortion::~SwXTextPortion()
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ delete pUnoCrsr;
+ delete pRubyText;
+ delete pRubyStyle;
+ delete pRubyAdjust;
+ delete pRubyIsAbove;
+}
+/*-- 11.12.98 09:56:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XText > SwXTextPortion::getText(void) throw( uno::RuntimeException )
+{
+ return xParentText;
+}
+/*-- 11.12.98 09:56:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextPortion::getStart(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwPaM aPam(*pUnoCrsr->Start());
+ uno::Reference< XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextPortion::getEnd(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > xRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwPaM aPam(*pUnoCrsr->End());
+ uno::Reference< XText > xParent = getText();
+ xRet = new SwXTextRange(aPam, xParent);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextPortion::getString(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String aTxt;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ //TextPortions liegen immer innerhalb eines Absatzes
+ SwTxtNode* pTxtNd = pUnoCrsr->GetNode()->GetTxtNode();
+ if( pTxtNd )
+ {
+ xub_StrLen nStt = pUnoCrsr->Start()->nContent.GetIndex();
+ aTxt = pTxtNd->GetExpandTxt( nStt,
+ pUnoCrsr->End()->nContent.GetIndex() - nStt );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aTxt;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ SwXTextCursor::SetString(*pUnoCrsr, aString);
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextPortion::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ //! PropertySetInfo for text portion extensions
+ static uno::Reference< beans::XPropertySetInfo >
+ xTxtPorExtRef = SfxItemPropertySet( aSwMapProvider.GetPropertyMap(
+ PROPERTY_MAP_TEXTPORTION_EXTENSIONS) ).getPropertySetInfo();
+ //! PropertySetInfo for redline portions
+ static uno::Reference< beans::XPropertySetInfo >
+ xRedlPorRef = SfxItemPropertySet( aSwMapProvider.GetPropertyMap(
+ PROPERTY_MAP_REDLINE_PORTION) ).getPropertySetInfo();
+
+ return (PORTION_REDLINE_START == ePortionType ||
+ PORTION_REDLINE_END == ePortionType) ? xRedlPorRef : xTxtPorExtRef;
+}
+/*-- 11.12.98 09:56:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SetPropertyValue(*pUnoCrsr, aPropSet, rPropertyName, aValue);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+void SwXTextPortion::GetPropertyValues( const OUString *pPropertyNames,
+ uno::Any *pValues,
+ sal_Int32 nLength )
+{
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ SfxItemSet *pSet = 0;
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]);
+ if(pMap)
+ {
+ switch(pMap->nWID)
+ {
+ case FN_UNO_TEXT_PORTION_TYPE:
+ {
+ const char* pRet;
+ switch (ePortionType)
+ {
+ case PORTION_TEXT: pRet = "Text";break;
+ case PORTION_FIELD: pRet = "TextField";break;
+ case PORTION_FRAME: pRet = "Frame";break;
+ case PORTION_FOOTNOTE: pRet = "Footnote";break;
+ case PORTION_CONTROL_CHAR: pRet = "ControlCharacter";break;
+ case PORTION_REFMARK_START:
+ case PORTION_REFMARK_END: pRet = SW_PROP_NAME_STR(UNO_NAME_REFERENCE_MARK);break;
+ case PORTION_TOXMARK_START:
+ case PORTION_TOXMARK_END: pRet = SW_PROP_NAME_STR(UNO_NAME_DOCUMENT_INDEX_MARK);break;
+ case PORTION_BOOKMARK_START :
+ case PORTION_BOOKMARK_END : pRet = SW_PROP_NAME_STR(UNO_NAME_BOOKMARK);break;
+ case PORTION_REDLINE_START:
+ case PORTION_REDLINE_END: pRet = "Redline";break;
+ case PORTION_RUBY_START:
+ case PORTION_RUBY_END: pRet = "Ruby";break;
+ default:
+ pRet = 0;
+ }
+
+ OUString sRet;
+ if( pRet )
+ sRet = C2U( pRet );
+ pValues[nProp] <<= sRet;
+ }
+ break;
+ case FN_UNO_CONTROL_CHARACTER:
+ {
+ if(PORTION_CONTROL_CHAR == ePortionType)
+ pValues[nProp] <<= (sal_Int16) nControlChar;
+ }
+ break;
+ case FN_UNO_DOCUMENT_INDEX_MARK:
+ pValues[nProp] <<= xTOXMark;
+ break;
+ case FN_UNO_REFERENCE_MARK:
+ pValues[nProp] <<= xRefMark;
+ break;
+ case FN_UNO_BOOKMARK:
+ pValues[nProp] <<= xBookmark;
+ break;
+ case FN_UNO_FOOTNOTE:
+ pValues[nProp] <<= xFootnote;
+ break;
+ case FN_UNO_IS_COLLAPSED:
+ {
+ BOOL bStart = TRUE, bPut = TRUE;
+ switch (ePortionType)
+ {
+ case PORTION_REFMARK_START:
+ case PORTION_BOOKMARK_START :
+ case PORTION_TOXMARK_START:
+ case PORTION_REFMARK_END:
+ case PORTION_TOXMARK_END:
+ case PORTION_BOOKMARK_END :
+ case PORTION_REDLINE_START :
+ case PORTION_REDLINE_END :
+ case PORTION_RUBY_START:
+ case PORTION_RUBY_END:
+ pValues[nProp].setValue(&bIsCollapsed, ::getBooleanCppuType());
+ break;
+ default:
+ bPut = FALSE;
+ }
+ }
+ break;
+ case FN_UNO_IS_START:
+ {
+ BOOL bStart = TRUE, bPut = TRUE;
+ switch (ePortionType)
+ {
+ case PORTION_REFMARK_START:
+ case PORTION_BOOKMARK_START:
+ case PORTION_TOXMARK_START:
+ case PORTION_REDLINE_START:
+ case PORTION_RUBY_START:
+ break;
+
+ case PORTION_REFMARK_END:
+ case PORTION_TOXMARK_END:
+ case PORTION_BOOKMARK_END:
+ case PORTION_REDLINE_END:
+ case PORTION_RUBY_END:
+ bStart = FALSE;
+ break;
+ default:
+ bPut = FALSE;
+ }
+ if(bPut)
+ pValues[nProp].setValue(&bStart, ::getBooleanCppuType());
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ {
+ Any* pToSet = 0;
+ switch(pMap->nMemberId)
+ {
+ case MID_RUBY_TEXT : pToSet = pRubyText; break;
+ case MID_RUBY_ADJUST : pToSet = pRubyAdjust; break;
+ case MID_RUBY_CHARSTYLE:pToSet = pRubyStyle; break;
+ case MID_RUBY_ABOVE : pToSet = pRubyIsAbove; break;
+ }
+ if(pToSet)
+ pValues[nProp] = *pToSet;
+ }
+ break;
+ default:
+ PropertyState eTemp;
+ BOOL bDone = SwUnoCursorHelper::getCrsrPropertyValue(
+ pMap, *pUnoCrsr, &(pValues[nProp]), eTemp );
+ if(!bDone)
+ {
+ if(!pSet)
+ {
+ pSet = new SfxItemSet(pUnoCrsr->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_PARATR_NUMRULE,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_FILL_ORDER, RES_FRMATR_END -1,
+ 0L);
+ SwXTextCursor::GetCrsrAttr(*pUnoCrsr, *pSet);
+ }
+ pValues[nProp] = aPropSet.getPropertyValue(*pMap, *pSet);
+ }
+ }
+ pMap++;
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ delete pSet;
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Any SwXTextPortion::getPropertyValue(
+ const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Any aAny;
+ GetPropertyValues( &rPropertyName, &aAny, 1 );
+ return aAny;
+}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextPortion::setPropertyValues(
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& aValues )
+ throw(PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ const Any* pValues = aValues.getConstArray();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ OUString sTmp;
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName(pMap, pPropertyNames[nProp]);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwXTextCursor::SetPropertyValue( *pUnoCrsr, aPropSet, sTmp, pValues[nProp], pMap);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Any > SwXTextPortion::getPropertyValues(
+ const Sequence< OUString >& rPropertyNames )
+ throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< Any > aValues(rPropertyNames.getLength());
+
+ GetPropertyValues( rPropertyNames.getConstArray(),
+ aValues.getArray(),
+ rPropertyNames.getLength() );
+ return aValues;
+}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextPortion::addPropertiesChangeListener(
+ const Sequence< OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextPortion::removePropertiesChangeListener(
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{}
+/* -----------------------------02.04.01 11:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextPortion::firePropertiesChangeEvent(
+ const Sequence< OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::addPropertyChangeListener(
+ const OUString& PropertyName,
+ const Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 09:56:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 11.12.98 09:56:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 08.03.99 09:41:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ if(GetTextPortionType() == PORTION_RUBY_START &&
+ !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
+ eRet = beans::PropertyState_DIRECT_VALUE;
+ else
+ eRet = SwXTextCursor::GetPropertyState(*pUnoCrsr, aPropSet, rPropertyName);
+ }
+ else
+ throw RuntimeException();
+ return eRet;
+}
+/*-- 08.03.99 09:41:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates(
+ const uno::Sequence< OUString >& rPropertyNames)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(!pUnoCrsr)
+ throw RuntimeException();
+ Sequence< PropertyState > aRet = SwXTextCursor::GetPropertyStates(*pUnoCrsr, aPropSet, rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION);
+
+ if(GetTextPortionType() == PORTION_RUBY_START)
+ {
+ const OUString* pNames = rPropertyNames.getConstArray();
+ PropertyState* pStates = aRet.getArray();
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength();nProp++)
+ {
+ if(!pNames[nProp].compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
+ pStates[nProp] = beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ return aRet;
+}
+/*-- 08.03.99 09:41:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwXTextCursor::SetPropertyToDefault(*pUnoCrsr, aPropSet, rPropertyName);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 08.03.99 09:41:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ uno::Any aRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ aRet = SwXTextCursor::GetPropertyDefault(*pUnoCrsr, aPropSet, rPropertyName);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 09:56:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextPortion::getPresentation(sal_Bool bShowCommand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ String sRet;
+ SwFmtFld* pFmt = 0;
+ if(pUnoCrsr && 0 != (pFmt = GetFldFmt()))
+ {
+ const SwField* pField = pFmt->GetFld();
+ DBG_ERROR("bShowCommand auswerten!");
+ sRet = pField->Expand();
+ }
+ return sRet;
+}
+/*-- 11.12.98 09:56:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::attach(const uno::Reference< XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ // SwXTextPortion cannot be created at the factory therefore
+ // they cannot be attached
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 09:57:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXTextPortion::getAnchor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextRange > aRet;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ aRet = new SwXTextRange(*pUnoCrsr, xParentText);
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 11.12.98 09:57:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = ((SwXTextPortion*)this)->GetCrsr();
+ if(pUnoCrsr)
+ {
+ setString(aEmptyStr);
+ pUnoCrsr->Remove(this);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 11.12.98 09:57:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 11.12.98 09:57:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/* -----------------24.03.99 13:30-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXTextPortion::createContentEnumeration(const OUString& aServiceName)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+ uno::Reference< container::XEnumeration > xRet = new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_CHAR, pFrameFmt);
+ return xRet;
+
+}
+/* -----------------------------04.07.01 08:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextPortion::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------04.07.01 08:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/* -----------------24.03.99 13:30-------------------
+ *
+ * --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+/* -----------------25.03.99 10:30-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextPortion::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextPortion");
+}
+/* -----------------25.03.99 10:30-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+
+ sal_Bool bRet = sal_False;
+ if(!rServiceName.compareToAscii("com.sun.star.text.TextPortion") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex"))
+ bRet = sal_True;
+ else if(COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextField"))
+ bRet = 0 != GetFldFmt();
+ else
+ {
+ SwFrmFmt* pCurFrmFmt = pFrameFmt;
+ if(!pCurFrmFmt && !pUnoCrsr->HasMark() && pUnoCrsr->GetCntntNode()->Len())
+ {
+ // hier die zeichengebundenen am Cursor suchen - hier kann es nur einen geben
+ SwTxtAttr* pTxtAttr = pUnoCrsr->GetNode()->GetTxtNode()->GetTxtAttr(
+ pUnoCrsr->GetPoint()->nContent, RES_TXTATR_FLYCNT);
+ DBG_ASSERT(pTxtAttr, "Hier muss doch ein Fly-Attribut zu finden sein!");
+ if(pTxtAttr)
+ {
+ const SwFmtFlyCnt& rFlyCnt = pTxtAttr->GetFlyCnt();
+ pCurFrmFmt = rFlyCnt.GetFrmFmt();
+ }
+ }
+ if(pCurFrmFmt)
+ {
+ const SwNodeIndex* pIdx = pCurFrmFmt->GetCntnt().GetCntntIdx();
+ const SwNode* pNd = GetCrsr()->GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
+
+ if((!pNd->IsNoTxtNode() && COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextFrame"))||
+ (pNd->IsGrfNode() && COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextGraphicObject")) ||
+ (pNd->IsOLENode() && COMPARE_EQUAL == rServiceName.compareToAscii("com.sun.star.text.TextEmbeddedObject")))
+ bRet = sal_True;
+ }
+ }
+ return bRet;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+ sal_Bool bField = 0 != GetFldFmt();
+ sal_uInt16 nCount = bField ? 8 : 7;
+ uno::Sequence< OUString > aRet(nCount);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextPortion");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ if(bField)
+ pArray[7] = C2U("com.sun.star.text.TextField");
+ else
+ {
+ SwFrmFmt* pCurFrmFmt = pFrameFmt;
+ if(!pCurFrmFmt && !pUnoCrsr->HasMark())
+ {
+ // hier die zeichengebundenen am Cursor suchen - hier kann es nur einen geben
+ SwTxtAttr* pTxtAttr = pUnoCrsr->GetNode()->GetTxtNode()->GetTxtAttr(
+ pUnoCrsr->GetPoint()->nContent, RES_TXTATR_FLYCNT);
+ // if any - it could also be an empty paragraph
+ if(pTxtAttr)
+ {
+ const SwFmtFlyCnt& rFlyCnt = pTxtAttr->GetFlyCnt();
+ pCurFrmFmt = rFlyCnt.GetFrmFmt();
+ }
+ }
+ if(pCurFrmFmt)
+ {
+ aRet.realloc(8);
+ pArray = aRet.getArray();
+ const SwNodeIndex* pIdx = pCurFrmFmt->GetCntnt().GetCntntIdx();
+ const SwNode* pNd = GetCrsr()->GetDoc()->GetNodes()[ pIdx->GetIndex() + 1 ];
+ if(!pNd->IsNoTxtNode())
+ pArray[7] = C2U("com.sun.star.text.TextFrame");
+ else if(pNd->IsGrfNode())
+ pArray[7] = C2U("com.sun.star.text.TextGraphicObject");
+ else
+ pArray[7] = C2U("com.sun.star.text.TextEmbeddedObject");
+ }
+ }
+ return aRet;
+}
+/*-- 11.12.98 09:57:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortion::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!aFrameDepend.GetRegisteredIn())
+ pFrameFmt = 0;
+}
+/* -----------------------------19.02.01 10:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXRubyPortion::SwXRubyPortion(const SwUnoCrsr* pPortionCrsr,
+ SwTxtRuby& rAttr,
+ Reference< XText > & rParent,
+ sal_Bool bEnd ) :
+ SwXTextPortion(pPortionCrsr, rParent, bEnd ? PORTION_RUBY_END : PORTION_RUBY_START )
+{
+ if(!bEnd)
+ {
+ const SfxPoolItem& rItem = rAttr.GetAttr();
+ pRubyText = new Any;
+ pRubyStyle = new Any;
+ pRubyAdjust = new Any;
+ pRubyIsAbove = new Any;
+ rItem.QueryValue(*pRubyText, MID_RUBY_TEXT);
+ rItem.QueryValue(*pRubyStyle, MID_RUBY_CHARSTYLE);
+ rItem.QueryValue(*pRubyAdjust, MID_RUBY_ADJUST);
+ rItem.QueryValue(*pRubyIsAbove, MID_RUBY_ABOVE);
+ }
+}
+/* -----------------------------19.02.01 10:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXRubyPortion::~SwXRubyPortion()
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoportenum.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoportenum.cxx
new file mode 100644
index 000000000000..b96c4943c923
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoportenum.cxx
@@ -0,0 +1,923 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bookmrk.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <txatbase.hxx>
+#include <ndhints.hxx>
+#include <ndtxt.hxx>
+#include <unocrsr.hxx>
+#include <docary.hxx>
+#include <fmthbsh.hxx>
+#include <tox.hxx>
+#include <unoclbck.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unoredline.hxx>
+#include <fmtanchr.hxx>
+#include <unoidx.hxx>
+#include <redline.hxx>
+#include <crsskip.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+
+using rtl::OUString;
+
+/******************************************************************
+ * SwXTextPortionEnumeration
+ ******************************************************************/
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextPortionEnumeration::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextPortionEnumeration");
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextPortionEnumeration::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextPortionEnumeration") == rServiceName;
+}
+/* -----------------------------06.04.00 16:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextPortionEnumeration::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextPortionEnumeration");
+ return aRet;
+}
+/*-- 27.01.99 10:44:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortionEnumeration::SwXTextPortionEnumeration(
+ SwPaM& rParaCrsr,
+ uno::Reference< XText > xParentText,
+ sal_Int32 nStart,
+ sal_Int32 nEnd
+ ) :
+ xParent(xParentText),
+ bAtEnd(sal_False),
+ bFirstPortion(sal_True),
+ nStartPos(nStart),
+ nEndPos(nEnd)
+{
+ SwUnoCrsr* pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), sal_False);
+ pUnoCrsr->Add(this);
+
+ DBG_ASSERT(nEnd == -1 || (nStart <= nEnd &&
+ nEnd <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->GetTxt().Len()),
+ "start or end value invalid!");
+ //alle Rahmen, Grafiken und OLEs suchen, die an diesem Absatz
+ // AM ZEICHEN gebunden sind
+ ::binfilter::CollectFrameAtNode( *this, pUnoCrsr->GetPoint()->nNode,
+ aFrameArr, TRUE );
+ CreatePortions();
+}
+/*-- 27.01.99 10:44:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextPortionEnumeration::~SwXTextPortionEnumeration()
+{
+ for(sal_uInt16 nFrame = aFrameArr.Count(); nFrame; )
+ delete aFrameArr.GetObject( --nFrame );
+ aFrameArr.Remove(0, aFrameArr.Count());
+
+ if( aPortionArr.Count() )
+ aPortionArr.DeleteAndDestroy(0, aPortionArr.Count() );
+
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ delete pUnoCrsr;
+}
+/*-- 27.01.99 10:44:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextPortionEnumeration::hasMoreElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return aPortionArr.Count() > 0;
+}
+/*-- 27.01.99 10:44:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextPortionEnumeration::nextElement(void)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!aPortionArr.Count())
+ throw container::NoSuchElementException();
+ XTextRangeRefPtr pPortion = aPortionArr.GetObject(0);
+ Any aRet(pPortion, ::getCppuType((uno::Reference<XTextRange>*)0));
+ aPortionArr.Remove(0);
+ delete pPortion;
+ return aRet;
+}
+/* -----------------------------31.08.00 14:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_InsertRefMarkPortion(
+ XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText>& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+{
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ SwFmtRefMark& rRefMark = ((SwFmtRefMark&)pAttr->GetAttr());
+ Reference<XTextContent> xContent = ((SwUnoCallBack*)pDoc->GetUnoCallBack())->GetRefMark(rRefMark);
+ if(!xContent.is())
+ xContent = new SwXReferenceMark(pDoc, &rRefMark);
+
+ SwXTextPortion* pPortion;
+ if(!bEnd)
+ {
+ rArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_REFMARK_START)),
+ rArr.Count());
+ pPortion->SetRefMark(xContent);
+ pPortion->SetCollapsed(pAttr->GetEnd() ? FALSE : TRUE);
+ }
+ else
+ {
+ rArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_REFMARK_END)),
+ rArr.Count());
+ pPortion->SetRefMark(xContent);
+ }
+}
+//-----------------------------------------------------------------------------
+void lcl_InsertRubyPortion( XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr,
+ Reference<XText>& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+{
+ SwXRubyPortion* pPortion;
+ rArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXRubyPortion(*pUnoCrsr, *(SwTxtRuby*)pAttr, rParent,
+ bEnd)),
+ rArr.Count());
+ pPortion->SetCollapsed(pAttr->GetEnd() ? FALSE : TRUE);
+}
+//-----------------------------------------------------------------------------
+void lcl_InsertTOXMarkPortion(
+ XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText>& rParent, SwTxtAttr* pAttr, BOOL bEnd)
+{
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ SwTOXMark& rTOXMark = ((SwTOXMark&)pAttr->GetAttr());
+
+ Reference<XTextContent> xContent =
+ ((SwUnoCallBack*)pDoc->GetUnoCallBack())->GetTOXMark(rTOXMark);
+ if(!xContent.is())
+ xContent = new SwXDocumentIndexMark(rTOXMark.GetTOXType(), &rTOXMark, pDoc);
+
+ SwXTextPortion* pPortion;
+ if(!bEnd)
+ {
+ rArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_TOXMARK_START)),
+ rArr.Count());
+ pPortion->SetTOXMark(xContent);
+ pPortion->SetCollapsed(pAttr->GetEnd() ? FALSE : TRUE);
+ }
+ if(bEnd)
+ {
+ rArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_TOXMARK_END)),
+ rArr.Count());
+ pPortion->SetTOXMark(xContent);
+ }
+}
+//-----------------------------------------------------------------------------
+#define BKM_TYPE_START 0
+#define BKM_TYPE_END 1
+#define BKM_TYPE_START_END 2
+struct SwXBookmarkPortion_Impl
+{
+ SwXBookmark* pBookmark;
+ Reference<XTextContent> xBookmark;
+ BYTE nBkmType;
+ ULONG nIndex;
+
+ SwXBookmarkPortion_Impl( SwXBookmark* pXMark, BYTE nType, ULONG nIdx) :
+ pBookmark(pXMark),
+ xBookmark(pXMark),
+ nBkmType(nType),
+ nIndex(nIdx){}
+
+ // compare by nIndex
+ BOOL operator < (const SwXBookmarkPortion_Impl &rCmp) const;
+ BOOL operator ==(const SwXBookmarkPortion_Impl &rCmp) const;
+
+};
+BOOL SwXBookmarkPortion_Impl::operator ==(const SwXBookmarkPortion_Impl &rCmp) const
+{
+ return nIndex == rCmp.nIndex &&
+ pBookmark == rCmp.pBookmark &&
+ nBkmType == rCmp.nBkmType;
+}
+
+BOOL SwXBookmarkPortion_Impl::operator < (const SwXBookmarkPortion_Impl &rCmp) const
+{
+ return nIndex < rCmp.nIndex;
+}
+
+typedef SwXBookmarkPortion_Impl* SwXBookmarkPortion_ImplPtr;
+SV_DECL_PTRARR_SORT(SwXBookmarkPortionArr, SwXBookmarkPortion_ImplPtr, 0, 2)
+SV_IMPL_OP_PTRARR_SORT(SwXBookmarkPortionArr, SwXBookmarkPortion_ImplPtr)
+//-----------------------------------------------------------------------------
+void lcl_ExportBookmark(
+ SwXBookmarkPortionArr& rBkmArr, ULONG nIndex,
+ SwUnoCrsr* pUnoCrsr, Reference<XText> & rParent, XTextRangeArr& rPortionArr)
+{
+ SwXBookmarkPortion_ImplPtr pPtr;
+ while(rBkmArr.Count() && nIndex == (pPtr = rBkmArr.GetObject(0))->nIndex)
+ {
+ SwXTextPortion* pPortion;
+ if(BKM_TYPE_START == pPtr->nBkmType || BKM_TYPE_START_END == pPtr->nBkmType)
+ {
+ rPortionArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_BOOKMARK_START)),
+ rPortionArr.Count());
+ pPortion->SetBookmark(pPtr->xBookmark);
+ pPortion->SetCollapsed(BKM_TYPE_START_END == pPtr->nBkmType ? TRUE : FALSE);
+
+ }
+ if(BKM_TYPE_END == pPtr->nBkmType)
+ {
+ rPortionArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_BOOKMARK_END)),
+ rPortionArr.Count());
+ pPortion->SetBookmark(pPtr->xBookmark);
+ }
+ rBkmArr.Remove((USHORT)0);
+ delete pPtr;
+ }
+}
+/* -----------------------------18.12.00 14:51--------------------------------
+
+ ---------------------------------------------------------------------------*/
+//-----------------------------------------------------------------------------
+#define REDLINE_PORTION_START_REMOVE 0//removed redlines are visible
+#define REDLINE_PORTION_END_REMOVE 1//removed redlines are visible
+#define REDLINE_PORTION_REMOVE 2//removed redlines are NOT visible
+#define REDLINE_PORTION_INSERT_START 3
+#define REDLINE_PORTION_INSERT_END 4
+
+struct SwXRedlinePortion_Impl
+{
+ const SwRedline* pRedline;
+ sal_Bool bStart;
+
+ SwXRedlinePortion_Impl(const SwRedline* pRed, sal_Bool bIsStart) :
+ pRedline(pRed),
+ bStart(bIsStart)
+ {}
+
+ USHORT GetIndexPos()
+ {
+ const SwPosition* pOwnPos = bStart ?
+ pRedline->Start() : pRedline->End();
+ return pOwnPos->nContent.GetIndex();
+ }
+ // compare by Position
+ BOOL operator < (const SwXRedlinePortion_Impl &rCmp) const
+ { const SwPosition* pOwnPos = bStart ?
+ pRedline->Start() : pRedline->End();
+ const SwPosition* pCmpPos = rCmp.bStart ?
+ rCmp.pRedline->Start() : rCmp.pRedline->End();
+ return *pOwnPos <= *pCmpPos;
+ }
+
+ BOOL operator ==(const SwXRedlinePortion_Impl &rCmp) const
+ {return pRedline == rCmp.pRedline &&
+ bStart == rCmp.bStart;}
+};
+typedef SwXRedlinePortion_Impl* SwXRedlinePortion_ImplPtr;
+SV_DECL_PTRARR_SORT(SwXRedlinePortionArr, SwXRedlinePortion_ImplPtr, 0, 2)
+SV_IMPL_OP_PTRARR_SORT(SwXRedlinePortionArr, SwXRedlinePortion_ImplPtr)
+
+//-----------------------------------------------------------------------------
+Reference<XTextRange> lcl_ExportHints(SwpHints* pHints,
+ XTextRangeArr& rPortionArr,
+ SwUnoCrsr* pUnoCrsr,
+ Reference<XText> & rParent,
+ const xub_StrLen nCurrentIndex,
+ SwTextPortionType& ePortionType,
+ const xub_StrLen& nFirstFrameIndex,
+ SwXBookmarkPortionArr& aBkmArr,
+ SwXRedlinePortionArr& aRedArr,
+ sal_Int32 nEndPos )
+{
+ Reference<XTextRange> xRef;
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ sal_Bool bAttrFound = sal_False;
+ //search for special text attributes - first some ends
+ sal_uInt16 nEndIndex = 0;
+ sal_uInt16 nNextEnd = 0;
+ while(nEndIndex < pHints->GetEndCount() &&
+ (!pHints->GetEnd(nEndIndex)->GetEnd() ||
+ nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetEnd()))))
+ {
+ if(pHints->GetEnd(nEndIndex)->GetEnd())
+ {
+ SwTxtAttr* pAttr = pHints->GetEnd(nEndIndex);
+ USHORT nAttrWhich = pAttr->Which();
+ if(nNextEnd == nCurrentIndex &&
+ ( RES_TXTATR_TOXMARK == nAttrWhich ||
+ RES_TXTATR_REFMARK == nAttrWhich ||
+ RES_TXTATR_CJK_RUBY == nAttrWhich))
+ {
+ switch( nAttrWhich )
+ {
+ case RES_TXTATR_TOXMARK:
+ lcl_InsertTOXMarkPortion(
+ rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
+ ePortionType = PORTION_TEXT;
+ break;
+ case RES_TXTATR_REFMARK:
+ lcl_InsertRefMarkPortion(
+ rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
+ ePortionType = PORTION_TEXT;
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ lcl_InsertRubyPortion(
+ rPortionArr, pUnoCrsr, rParent, pAttr, TRUE);
+ ePortionType = PORTION_TEXT;
+ break;
+ }
+ }
+ }
+ nEndIndex++;
+ }
+ //then som starts
+ sal_uInt16 nStartIndex = 0;
+ sal_uInt16 nNextStart = 0;
+ while(nStartIndex < pHints->GetStartCount() &&
+ nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart())))
+ {
+ SwTxtAttr* pAttr = pHints->GetStart(nStartIndex);
+ USHORT nAttrWhich = pAttr->Which();
+ if(nNextStart == nCurrentIndex &&
+ (!pAttr->GetEnd() ||
+ RES_TXTATR_TOXMARK == nAttrWhich ||
+ RES_TXTATR_REFMARK == nAttrWhich||
+ RES_TXTATR_CJK_RUBY == nAttrWhich))
+ {
+ switch( nAttrWhich )
+ {
+ case RES_TXTATR_FIELD:
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS);
+ bAttrFound = sal_True;
+ ePortionType = PORTION_FIELD;
+ break;
+ case RES_TXTATR_FLYCNT :
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS);
+ pUnoCrsr->Exchange();
+ bAttrFound = sal_True;
+ ePortionType = PORTION_FRAME;
+ break;
+ case RES_TXTATR_FTN :
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS);
+ SwXTextPortion* pPortion;
+ xRef = pPortion = new SwXTextPortion(pUnoCrsr, rParent, PORTION_FOOTNOTE);
+ Reference<XTextContent> xContent =
+ Reference<XTextContent>(
+ SwXFootnotes::GetObject(*pDoc, pAttr->SwTxtAttr::GetFtn()),
+ UNO_QUERY);
+ pPortion->SetFootnote(xContent);
+ bAttrFound = sal_True;
+ ePortionType = PORTION_TEXT;
+ }
+ break;
+ case RES_TXTATR_SOFTHYPH :
+ {
+ SwXTextPortion* pPortion;
+ rPortionArr.Insert(
+ new Reference< XTextRange >(
+ pPortion = new SwXTextPortion(
+ pUnoCrsr, rParent, PORTION_CONTROL_CHAR)),
+ rPortionArr.Count());
+ pPortion->SetControlChar(3);
+ ePortionType = PORTION_TEXT;
+ }
+ break;
+ case RES_TXTATR_HARDBLANK:
+ {
+ ePortionType = PORTION_CONTROL_CHAR;
+ SwXTextPortion* pPortion;
+ rPortionArr.Insert(
+ new Reference< XTextRange >(
+ pPortion = new SwXTextPortion(
+ pUnoCrsr, rParent, PORTION_CONTROL_CHAR)),
+ rPortionArr.Count());
+ const SwFmtHardBlank& rFmt = pAttr->GetHardBlank();
+ if(rFmt.GetChar() == '-')
+ pPortion->SetControlChar(2);//HARD_HYPHEN
+ else
+ pPortion->SetControlChar(4);//HARD_SPACE
+ ePortionType = PORTION_TEXT;
+ }
+ break;
+ case RES_TXTATR_TOXMARK:
+ lcl_InsertTOXMarkPortion(
+ rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
+ ePortionType = PORTION_TEXT;
+ break;
+ case RES_TXTATR_REFMARK:
+ if(!pAttr->GetEnd())
+ {
+ pUnoCrsr->Right(1,CRSR_SKIP_CHARS);
+ bAttrFound = sal_True;
+ }
+ lcl_InsertRefMarkPortion(
+ rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
+ ePortionType = PORTION_TEXT;
+ if(!pAttr->GetEnd())
+ {
+ if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
+ pUnoCrsr->Exchange();
+ pUnoCrsr->DeleteMark();
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ if(pAttr->GetEnd())
+ {
+ lcl_InsertRubyPortion(
+ rPortionArr, pUnoCrsr, rParent, pAttr, FALSE);
+ ePortionType = PORTION_TEXT;
+ }
+ break;
+ default:
+ DBG_ERROR("was fuer ein Attribut?");
+ }
+
+ }
+ nStartIndex++;
+ }
+
+ if(!bAttrFound)
+ {
+ // search for attribute changes behind the current cursor position
+ // break up at frames, bookmarks, redlines
+
+ nStartIndex = 0;
+ nNextStart = 0;
+ while(nStartIndex < pHints->GetStartCount() &&
+ nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart())))
+ nStartIndex++;
+
+ sal_uInt16 nEndIndex = 0;
+ sal_uInt16 nNextEnd = 0;
+ while(nEndIndex < pHints->GetEndCount() &&
+ nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetAnyEnd())))
+ nEndIndex++;
+ //nMovePos legt die neue EndPosition fest
+ sal_uInt16 nMovePos = nNextStart > nCurrentIndex && nNextStart < nNextEnd ? nNextStart : nNextEnd;
+ if (nMovePos <= nCurrentIndex)
+ nMovePos = pUnoCrsr->GetCntntNode()->Len();
+
+ if(nEndPos > 0 && nMovePos > nEndPos)
+ nMovePos = (USHORT)nEndPos;
+
+ if(aBkmArr.Count() && aBkmArr.GetObject(0)->nIndex < nMovePos)
+ {
+ DBG_ASSERT(aBkmArr.GetObject(0)->nIndex > nCurrentIndex,
+ "forgotten bookmark(s)");
+ nMovePos = aBkmArr.GetObject(0)->nIndex;
+ }
+ // break up portions for redlines
+ if (aRedArr.Count() && aRedArr.GetObject(0)->GetIndexPos() < nMovePos)
+ {
+ nMovePos = aRedArr.GetObject(0)->GetIndexPos();
+ }
+ // break up if the destination is behind a frame
+ if(nFirstFrameIndex != STRING_MAXLEN && nMovePos > nFirstFrameIndex)
+ nMovePos = nFirstFrameIndex;
+
+ if(nMovePos > nCurrentIndex)
+// pUnoCrsr->Right(nMovePos - nCurrentIndex);
+ pUnoCrsr->GetPoint()->nContent = nMovePos;
+ else
+ {
+ // ensure proper exit: move to paragraph end
+ // (this should not be necessary any more; we assert it only
+ // happens when the above would move to the end of the
+ // paragraph anyway)
+ DBG_ASSERT(nMovePos == pUnoCrsr->GetCntntNode()->Len()||
+ (nEndPos > 0 && nMovePos == nEndPos),
+ "may only happen at paragraph end");
+ pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
+ }
+ }
+ return xRef;
+}
+//-----------------------------------------------------------------------------
+void lcl_FillBookmarkArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXBookmarkPortionArr& rBkmArr )
+{
+ const SwBookmarks& rMarks = rDoc.GetBookmarks();
+ sal_uInt16 nArrLen = rMarks.Count();
+ if ( nArrLen > 0 )
+ {
+ const SwNodeIndex nOwnNode = rUnoCrsr.GetPoint()->nNode;
+ //search for all bookmarks that start or end in this paragraph
+ for( sal_uInt16 n = 0; n < nArrLen; ++n )
+ {
+ SwBookmark* pMark = rMarks.GetObject( n );
+ if( !pMark->IsBookMark() )
+ continue;
+
+ const SwPosition& rPos1 = pMark->GetPos();
+ const SwPosition* pPos2 = pMark->GetOtherPos();
+ BOOL bBackward = pPos2 ? rPos1 > *pPos2: FALSE;
+ if(rPos1.nNode == nOwnNode)
+ {
+ BYTE nType = bBackward ? BKM_TYPE_END : BKM_TYPE_START;
+ if(!pPos2)
+ {
+ nType = BKM_TYPE_START_END;
+ }
+ SwXBookmarkPortion_ImplPtr pBkmPtr = new SwXBookmarkPortion_Impl(
+ SwXBookmarks::GetObject( *pMark, &rDoc ), nType, rPos1.nContent.GetIndex() );
+
+ rBkmArr.Insert(pBkmPtr);
+
+ }
+ if(pPos2 && pPos2->nNode == nOwnNode)
+ {
+ BYTE nType = bBackward ? BKM_TYPE_START : BKM_TYPE_END;
+ SwXBookmarkPortion_ImplPtr pBkmPtr = new SwXBookmarkPortion_Impl(
+ SwXBookmarks::GetObject( *pMark, &rDoc ), nType, pPos2->nContent.GetIndex() );
+ rBkmArr.Insert(pBkmPtr);
+ }
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+void lcl_FillRedlineArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXRedlinePortionArr& rRedArr )
+{
+ const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl();
+ USHORT nRedTblCount = rRedTbl.Count();
+
+ if ( nRedTblCount > 0 )
+ {
+ const SwPosition* pStart = rUnoCrsr.GetPoint();
+ const SwNodeIndex nOwnNode = pStart->nNode;
+ SwRedlineMode eRedMode = rDoc.GetRedlineMode();
+
+ for(USHORT nRed = 0; nRed < nRedTblCount; nRed++)
+ {
+ const SwRedline* pRedline = rRedTbl[nRed];
+ const SwPosition* pRedStart = pRedline->Start();
+ const SwNodeIndex nRedNode = pRedStart->nNode;
+ SwRedlineType nType = pRedline->GetType();
+ if(nOwnNode == nRedNode)
+ {
+ SwXRedlinePortion_ImplPtr pToInsert = new SwXRedlinePortion_Impl(pRedline, TRUE);
+ rRedArr.Insert(pToInsert);
+ }
+ if(pRedline->HasMark() && pRedline->End()->nNode == nOwnNode)
+ {
+ SwXRedlinePortion_ImplPtr pToInsert = new SwXRedlinePortion_Impl(pRedline, FALSE);
+ rRedArr.Insert(pToInsert);
+ }
+ }
+ }
+}
+/* -----------------------------19.12.00 12:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_ExportRedline(
+ SwXRedlinePortionArr& rRedlineArr, ULONG nIndex,
+ SwUnoCrsr* pUnoCrsr, Reference<XText> & rParent, XTextRangeArr& rPortionArr)
+{
+ SwXRedlinePortion_ImplPtr pPtr;
+ while(rRedlineArr.Count() && 0 != (pPtr = rRedlineArr.GetObject(0)) &&
+ ((pPtr->bStart && (nIndex == pPtr->pRedline->Start()->nContent.GetIndex()))||
+ (!pPtr->bStart && (nIndex == pPtr->pRedline->End()->nContent.GetIndex()))))
+ {
+ SwXTextPortion* pPortion;
+ rPortionArr.Insert(
+ new Reference< XTextRange >(pPortion = new SwXRedlinePortion(
+ pPtr->pRedline, *pUnoCrsr, rParent,
+ pPtr->bStart)),
+ rPortionArr.Count());
+ rRedlineArr.Remove((USHORT)0);
+ delete pPtr;
+ }
+}
+/* -----------------------------19.12.00 13:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_ExportBkmAndRedline(
+ SwXBookmarkPortionArr& rBkmArr,
+ SwXRedlinePortionArr& rRedlineArr, ULONG nIndex,
+ SwUnoCrsr* pUnoCrsr, Reference<XText> & rParent, XTextRangeArr& rPortionArr)
+{
+ if (rBkmArr.Count())
+ lcl_ExportBookmark(rBkmArr, nIndex, pUnoCrsr, rParent, rPortionArr);
+
+ if (rRedlineArr.Count())
+ lcl_ExportRedline(rRedlineArr, nIndex, pUnoCrsr, rParent, rPortionArr);
+}
+//-----------------------------------------------------------------------------
+sal_Int32 lcl_GetNextIndex(SwXBookmarkPortionArr& rBkmArr, SwXRedlinePortionArr& rRedlineArr)
+{
+ sal_Int32 nRet = -1;
+ if(rBkmArr.Count())
+ {
+ SwXBookmarkPortion_ImplPtr pPtr = rBkmArr.GetObject(0);
+ nRet = pPtr->nIndex;
+ }
+ if(rRedlineArr.Count())
+ {
+ SwXRedlinePortion_ImplPtr pPtr = rRedlineArr.GetObject(0);
+ USHORT nTmp = pPtr->GetIndexPos();
+ if(nRet < 0 || nTmp < nRet)
+ nRet = nTmp;
+ }
+ return nRet;
+};
+//-----------------------------------------------------------------------------
+void SwXTextPortionEnumeration::CreatePortions()
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ // set the start if a selection should be exported
+ if(nStartPos > 0 && pUnoCrsr->Start()->nContent.GetIndex() != nStartPos)
+ {
+ if(pUnoCrsr->HasMark())
+ pUnoCrsr->DeleteMark();
+ DBG_ASSERT(pUnoCrsr->Start()->nNode.GetNode().GetTxtNode() &&
+ nStartPos <= pUnoCrsr->Start()->nNode.GetNode().GetTxtNode()->GetTxt().Len(),
+ "Incorrect start position" );
+ pUnoCrsr->Right((xub_StrLen)nStartPos,CRSR_SKIP_CHARS);
+ }
+ if(pUnoCrsr /*&& !bAtEnd*/)
+ {
+ SwXBookmarkPortionArr aBkmArr;
+ SwXRedlinePortionArr aRedArr;
+
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ lcl_FillRedlineArray(*pDoc, *pUnoCrsr, aRedArr);
+ lcl_FillBookmarkArray(*pDoc, *pUnoCrsr, aBkmArr );
+#if OSL_DEBUG_LEVEL > 1
+ for(long i_debug = 0; i_debug <aBkmArr.Count(); i_debug++)
+ {
+ SwXBookmarkPortion_ImplPtr pPtr = aBkmArr.GetObject(i_debug);
+ }
+
+#endif
+ while(!bAtEnd)
+ {
+ if(pUnoCrsr->HasMark())
+ {
+ if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
+ pUnoCrsr->Exchange();
+ pUnoCrsr->DeleteMark();
+ }
+ SwNode* pNode = pUnoCrsr->GetNode();
+ SwCntntNode *pCNd = pNode->GetCntntNode();
+ if(!bFirstPortion && pCNd &&
+ pUnoCrsr->GetPoint()->nContent == pCNd->Len())
+ {
+ //hier sollte man nie ankommen!
+ bAtEnd = sal_True;
+ }
+ else
+ {
+ if(ND_TEXTNODE == pNode->GetNodeType())
+ {
+ SwTxtNode* pTxtNode = (SwTxtNode*)pNode;
+ SwpHints* pHints = pTxtNode->GetpSwpHints();
+ SwTextPortionType ePortionType = PORTION_TEXT;
+ xub_StrLen nCurrentIndex = pUnoCrsr->GetPoint()->nContent.GetIndex();
+ xub_StrLen nFirstFrameIndex = STRING_MAXLEN;
+ uno::Reference< XTextRange > xRef;
+ if(!pCNd->Len())
+ {
+ lcl_ExportBkmAndRedline(aBkmArr, aRedArr, 0, pUnoCrsr, xParent, aPortionArr);
+ // the paragraph is empty
+ xRef = new SwXTextPortion(pUnoCrsr, xParent, ePortionType);
+ // are there any frames?
+ while(aFrameArr.Count())
+ {
+ SwDepend* pCurDepend = aFrameArr.GetObject(0);
+ if(pCurDepend->GetRegisteredIn())
+ {
+ //the previously created portion has to be inserted here
+ aPortionArr.Insert(new Reference<XTextRange>(xRef), aPortionArr.Count());
+ xRef = new SwXTextPortion(pUnoCrsr, xParent,
+ *(SwFrmFmt*)pCurDepend->GetRegisteredIn());
+ }
+ delete pCurDepend;
+ aFrameArr.Remove(0);
+ }
+ }
+ else
+ {
+ //falls schon Rahmen entsorgt wurden, dann raus hier
+ for(sal_uInt16 nFrame = aFrameArr.Count(); nFrame; nFrame--)
+ {
+ SwDepend* pCurDepend = aFrameArr.GetObject(nFrame - 1);
+ if(!pCurDepend->GetRegisteredIn())
+ {
+ delete pCurDepend;
+ aFrameArr.Remove(nFrame - 1);
+ }
+ }
+
+ //zunaechst den ersten Frame im aFrameArr finden (bezogen auf die Position im Absatz)
+ SwDepend* pFirstFrameDepend = 0;
+ //Eintraege im aFrameArr sind sortiert!
+ if(aFrameArr.Count())
+ {
+ SwDepend* pCurDepend = aFrameArr.GetObject(0);
+ SwFrmFmt* pFormat = (SwFrmFmt*)pCurDepend->GetRegisteredIn();
+ const SwFmtAnchor& rAnchor = pFormat->GetAnchor();
+ const SwPosition* pAnchorPos = rAnchor.GetCntntAnchor();
+ pFirstFrameDepend = pCurDepend;
+ nFirstFrameIndex = pAnchorPos->nContent.GetIndex();
+ if(nEndPos > 0 && nFirstFrameIndex >= nEndPos)
+ nFirstFrameIndex = USHRT_MAX;
+ }
+
+ SwXTextCursor::SelectPam(*pUnoCrsr, sal_True);
+
+ //ist hier schon ein Rahmen faellig?
+ if(nCurrentIndex == nFirstFrameIndex)
+ {
+ xRef = new SwXTextPortion(pUnoCrsr, xParent,
+ *(SwFrmFmt*)pFirstFrameDepend->GetRegisteredIn());
+ SwDepend* pCurDepend = aFrameArr.GetObject(0);
+ delete pCurDepend;
+ aFrameArr.Remove(0);
+ }
+ }
+ if(!xRef.is())
+ {
+ lcl_ExportBkmAndRedline(aBkmArr, aRedArr, nCurrentIndex, pUnoCrsr, xParent, aPortionArr);
+ if(pHints)
+ {
+ xRef = lcl_ExportHints(pHints,
+ aPortionArr,
+ pUnoCrsr,
+ xParent,
+ nCurrentIndex,
+ ePortionType,
+ nFirstFrameIndex,
+ aBkmArr,
+ aRedArr,
+ nEndPos);
+
+ }
+ else if(USHRT_MAX != nFirstFrameIndex)
+ {
+ pUnoCrsr->Right(nFirstFrameIndex - nCurrentIndex,CRSR_SKIP_CHARS);
+ }
+ else
+ {
+ sal_Int32 nNextIndex = lcl_GetNextIndex(aBkmArr, aRedArr);
+ if(nEndPos > 0 && (nNextIndex > nEndPos || nNextIndex < 0))
+ {
+ nNextIndex = nEndPos;
+ bAtEnd = sal_True;
+ }
+ if(nNextIndex < 0)
+ sal_Bool bMove = pUnoCrsr->MovePara(fnParaCurr, fnParaEnd);
+ else
+ {
+ DBG_ASSERT(nNextIndex > nCurrentIndex, "wrong move index");
+ pUnoCrsr->Right(nNextIndex - nCurrentIndex,CRSR_SKIP_CHARS);
+ }
+ }
+ }
+ if(!xRef.is() && pUnoCrsr->HasMark() )
+ xRef = new SwXTextPortion(pUnoCrsr, xParent, ePortionType);
+ if(xRef.is())
+ aPortionArr.Insert(new Reference<XTextRange>(xRef), aPortionArr.Count());
+ }
+ else
+ {
+ DBG_ERROR("kein TextNode - was nun?");
+ }
+ }
+ if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
+ pUnoCrsr->Exchange();
+
+ // Absatzende ?
+ pNode = pUnoCrsr->GetNode();
+ pCNd = pNode->GetCntntNode();
+ sal_Int32 nLocalEnd = nEndPos > 0 ? nEndPos : pCNd->Len();
+ if( pCNd && pUnoCrsr->GetPoint()->nContent == (xub_StrLen)nLocalEnd)
+ {
+ bAtEnd = sal_True;
+ lcl_ExportBkmAndRedline(aBkmArr, aRedArr, nLocalEnd,
+ pUnoCrsr, xParent, aPortionArr);
+ if(ND_TEXTNODE == pNode->GetNodeType())
+ {
+ SwTxtNode* pTxtNode = (SwTxtNode*)pNode;
+ SwpHints* pHints = pTxtNode->GetpSwpHints();
+ if(pHints)
+ {
+ SwTextPortionType ePortionType = PORTION_TEXT;
+ Reference<XTextRange> xRef = lcl_ExportHints(pHints,
+ aPortionArr,
+ pUnoCrsr,
+ xParent,
+ nLocalEnd,
+ ePortionType,
+ STRING_MAXLEN,
+ aBkmArr,
+ aRedArr,
+ nEndPos);
+ if(xRef.is())
+ aPortionArr.Insert(new Reference<XTextRange>(xRef), aPortionArr.Count());
+ }
+ }
+ while(aFrameArr.Count())
+ {
+ SwDepend* pCurDepend = aFrameArr.GetObject(0);
+ if(pCurDepend->GetRegisteredIn())
+ {
+ Reference<XTextRange> xRef = new SwXTextPortion(pUnoCrsr, xParent,
+ *(SwFrmFmt*)pCurDepend->GetRegisteredIn());
+ aPortionArr.Insert(new Reference<XTextRange>(xRef), aPortionArr.Count());
+ }
+ delete pCurDepend;
+ aFrameArr.Remove(0);
+ }
+
+ }
+ }
+ }
+}
+/*-- 27.01.99 10:44:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextPortionEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoprnms.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoprnms.cxx
new file mode 100644
index 000000000000..84dd685d099d
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoprnms.cxx
@@ -0,0 +1,721 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svtools/itemprop.hxx>
+
+#include <unoprnms.hxx>
+namespace binfilter {
+
+
+//#define MAP_CHAR_LEN(cchar) cchar, sizeof(cchar) - 1
+
+const SwPropNameTab aPropNameTab = {
+
+/* 0001 FOLLOW_STYLE */ {MAP_CHAR_LEN("FollowStyle")},
+/* 0002 IS_PHYSICAL */ {MAP_CHAR_LEN("IsPhysical")},
+/* 0003 IS_AUTO_UPDATE */ {MAP_CHAR_LEN("IsAutoUpdate")},
+/* 0004 DISPLAY_NAME */ {MAP_CHAR_LEN("DisplayName")},
+/* 0005 PARA_GRAPHIC_URL */ {MAP_CHAR_LEN("ParaBackGraphicURL")},
+/* 0006 PARA_GRAPHIC_FILTER */ {MAP_CHAR_LEN("ParaBackGraphicFilter")},
+/* 0007 HEADER_GRAPHIC_URL */ {MAP_CHAR_LEN("HeaderBackGraphicURL")},
+/* 0008 HEADER_GRAPHIC_FILTER */ {MAP_CHAR_LEN("HeaderBackGraphicFilter")},
+/* 0009 FOOTER_GRAPHIC_URL */ {MAP_CHAR_LEN("FooterBackGraphicURL")},
+/* 0010 FOOTER_GRAPHIC_FILTER */ {MAP_CHAR_LEN("FooterBackGraphicFilter")},
+/* 0011 BACK_GRAPHIC_URL */ {MAP_CHAR_LEN("BackGraphicURL")},
+/* 0012 BACK_GRAPHIC_FILTER */ {MAP_CHAR_LEN("BackGraphicFilter")},
+/* 0013 BACK_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("BackGraphicLocation")},
+/* 0014 BACK_GRAPHIC_BITMAP */ {MAP_CHAR_LEN("BackGraphicBitmap")},
+/* 0015 GRAPHIC_URL */ {MAP_CHAR_LEN("GraphicURL")},
+/* 0016 GRAPHIC_FILTER */ {MAP_CHAR_LEN("GraphicFilter")},
+/* 0017 GRAPHIC_LOCATION */ {MAP_CHAR_LEN("GraphicLocation")},
+/* 0018 GRAPHIC_SIZE */ {MAP_CHAR_LEN("GraphicSize")},
+/* 0019 GRAPHIC_BITMAP */ {MAP_CHAR_LEN("GraphicBitmap")},
+/* 0020 BULLET_FONT */ {MAP_CHAR_LEN("BulletFont")},
+/* 0021 PARA_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("ParaBackGraphicLocation")},
+/* 0022 HEADER_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("HeaderBackGraphicLocation")},
+/* 0023 FOOTER_GRAPHIC_LOCATION */ {MAP_CHAR_LEN("FooterBackGraphicLocation")},
+/* 0024 PARA_LEFT_PARA_MARGIN */ {MAP_CHAR_LEN("ParaLeftParaMargin")},
+/* 0025 PARA_RIGHT_PARA_MARGIN */ {MAP_CHAR_LEN("ParaRightParaMargin")},
+/* 0026 PARA_LEFT_MARGIN */ {MAP_CHAR_LEN("ParaLeftMargin")},
+/* 0027 PARA_RIGHT_MARGIN */ {MAP_CHAR_LEN("ParaRightMargin")},
+/* 0028 PARA_LEFT_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaLeftMarginRelative")},
+/* 0029 PARA_RIGHT_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaRightMarginRelative")},
+/* 0030 PARA_IS_AUTO_FIRST_LINE_INDENT */ {MAP_CHAR_LEN("ParaIsAutoFirstLineIndent")},
+/* 0031 PARA_FIRST_LINE_INDENT */ {MAP_CHAR_LEN("ParaFirstLineIndent")},
+/* 0032 PARA_FIRST_LINE_INDENT_RELATIVE */ {MAP_CHAR_LEN("ParaFirstLineIndentRelative")},
+/* 0033 PARA_IS_HYPHENATION */ {MAP_CHAR_LEN("ParaIsHyphenation")},
+/* 0034 PARA_HYPHENATION_MAX_LEADING_CHARS */ {MAP_CHAR_LEN("ParaHyphenationMaxLeadingChars")},
+/* 0035 PARA_HYPHENATION_MAX_TRAILING_CHARS */ {MAP_CHAR_LEN("ParaHyphenationMaxTrailingChars")},
+/* 0036 PARA_HYPHENATION_MAX_HYPHENS */ {MAP_CHAR_LEN("ParaHyphenationMaxHyphens")},
+/* 0037 LEFT_MARGIN */ {MAP_CHAR_LEN("LeftMargin")},
+/* 0038 RIGHT_MARGIN */ {MAP_CHAR_LEN("RightMargin")},
+/* 0039 HEADER_LEFT_MARGIN */ {MAP_CHAR_LEN("HeaderLeftMargin")},
+/* 0040 HEADER_RIGHT_MARGIN */ {MAP_CHAR_LEN("HeaderRightMargin")},
+/* 0041 FOOTER_LEFT_MARGIN */ {MAP_CHAR_LEN("FooterLeftMargin")},
+/* 0042 FOOTER_RIGHT_MARGIN */ {MAP_CHAR_LEN("FooterRightMargin")},
+/* 0043 TEXT_RANGE */ {MAP_CHAR_LEN("TextRange")},
+/* 0044 NAME */ {MAP_CHAR_LEN("Name")},
+/* 0045 NUMBERING_ALIGNMENT */ {MAP_CHAR_LEN("NumberingAlignment")},
+/* 0046 BULLET_FONT_NAME */ {MAP_CHAR_LEN("BulletFontName")},
+/* 0047 BULLET_ID */ {MAP_CHAR_LEN("BulletId")},
+/* 0048 CHAR_STYLE_NAME */ {MAP_CHAR_LEN("CharStyleName")},
+/* 0049 ANCHOR_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("AnchorCharStyleName")},
+/* 0050 SUFFIX */ {MAP_CHAR_LEN("Suffix")},
+/* 0051 PREFIX */ {MAP_CHAR_LEN("Prefix")},
+/* 0052 PARENT_NUMBERING */ {MAP_CHAR_LEN("ParentNumbering")},
+/* 0053 START_WITH */ {MAP_CHAR_LEN("StartWith")},
+/* 0054 CHAR_FONT_NAME */ {MAP_CHAR_LEN("CharFontName")},
+/* 0055 CHAR_FONT_STYLE_NAME */ {MAP_CHAR_LEN("CharFontStyleName")},
+/* 0056 CHAR_FONT_FAMILY */ {MAP_CHAR_LEN("CharFontFamily")},
+/* 0057 CHAR_FONT_CHAR_SET */ {MAP_CHAR_LEN("CharFontCharSet")},
+/* 0058 CHAR_FONT_PITCH */ {MAP_CHAR_LEN("CharFontPitch")},
+/* 0059 CHAR_POSTURE */ {MAP_CHAR_LEN("CharPosture")},
+/* 0060 CHAR_WEIGHT */ {MAP_CHAR_LEN("CharWeight")},
+/* 0061 CHAR_HEIGHT */ {MAP_CHAR_LEN("CharHeight")},
+/* 0062 CHAR_LOCALE */ {MAP_CHAR_LEN("CharLocale")},
+/* 0063 CHAR_FONT_NAME_ASIAN */ {MAP_CHAR_LEN("CharFontNameAsian")},
+/* 0064 CHAR_FONT_STYLE_NAME_ASIAN */ {MAP_CHAR_LEN("CharFontStyleNameAsian")},
+/* 0065 CHAR_FONT_FAMILY_ASIAN */ {MAP_CHAR_LEN("CharFontFamilyAsian")},
+/* 0066 CHAR_FONT_CHAR_SET_ASIAN */ {MAP_CHAR_LEN("CharFontCharSetAsian")},
+/* 0067 CHAR_FONT_PITCH_ASIAN */ {MAP_CHAR_LEN("CharFontPitchAsian")},
+/* 0068 CHAR_POSTURE_ASIAN */ {MAP_CHAR_LEN("CharPostureAsian")},
+/* 0069 CHAR_WEIGHT_ASIAN */ {MAP_CHAR_LEN("CharWeightAsian")},
+/* 0070 CHAR_HEIGHT_ASIAN */ {MAP_CHAR_LEN("CharHeightAsian")},
+/* 0071 CHAR_LOCALE_ASIAN */ {MAP_CHAR_LEN("CharLocaleAsian")},
+/* 0072 CHAR_FONT_NAME_COMPLEX */ {MAP_CHAR_LEN("CharFontNameComplex")},
+/* 0073 CHAR_FONT_STYLE_NAME_COMPLEX */ {MAP_CHAR_LEN("CharFontStyleNameComplex")},
+/* 0074 CHAR_FONT_FAMILY_COMPLEX */ {MAP_CHAR_LEN("CharFontFamilyComplex")},
+/* 0075 CHAR_FONT_CHAR_SET_COMPLEX */ {MAP_CHAR_LEN("CharFontCharSetComplex")},
+/* 0076 CHAR_FONT_PITCH_COMPLEX */ {MAP_CHAR_LEN("CharFontPitchComplex")},
+/* 0077 CHAR_POSTURE_COMPLEX */ {MAP_CHAR_LEN("CharPostureComplex")},
+/* 0078 CHAR_WEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharWeightComplex")},
+/* 0079 CHAR_HEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharHeightComplex")},
+/* 0080 CHAR_LOCALE_COMPLEX */ {MAP_CHAR_LEN("CharLocaleComplex")},
+/* 0081 CHAR_AUTO_KERNING */ {MAP_CHAR_LEN("CharAutoKerning")},
+/* 0082 CHAR_UNDERLINE */ {MAP_CHAR_LEN("CharUnderline")},
+/* 0083 CHAR_UNDERLINE_COLOR */ {MAP_CHAR_LEN("CharUnderlineColor")},
+/* 0084 CHAR_UNDERLINE_HAS_COLOR */ {MAP_CHAR_LEN("CharUnderlineHasColor")},
+/* 0085 CHAR_ESCAPEMENT */ {MAP_CHAR_LEN("CharEscapement")},
+/* 0086 CHAR_CASE_MAP */ {MAP_CHAR_LEN("CharCaseMap")},
+/* 0087 CHAR_SHADOWED */ {MAP_CHAR_LEN("CharShadowed")},
+/* 0088 CHAR_STRIKEOUT */ {MAP_CHAR_LEN("CharStrikeout")},
+/* 0089 CHAR_CROSSED_OUT */ {MAP_CHAR_LEN("CharCrossedOut")},
+/* 0090 CHAR_NO_HYPHENATION */ {MAP_CHAR_LEN("CharNoHyphenation")},
+/* 0091 CHAR_AUTO_ESCAPEMENT */ {MAP_CHAR_LEN("CharAutoEscapement")},
+/* 0092 CHAR_PROP_HEIGHT */ {MAP_CHAR_LEN("CharPropHeight")},
+/* 0093 CHAR_DIFF_HEIGHT */ {MAP_CHAR_LEN("CharDiffHeight")},
+/* 0094 CHAR_PROP_HEIGHT_ASIAN */ {MAP_CHAR_LEN("CharPropHeightAsian")},
+/* 0095 CHAR_DIFF_HEIGHT_ASIAN */ {MAP_CHAR_LEN("CharDiffHeightAsian")},
+/* 0096 CHAR_PROP_HEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharPropHeightComplex")},
+/* 0097 CHAR_DIFF_HEIGHT_COMPLEX */ {MAP_CHAR_LEN("CharDiffHeightComplex")},
+/* 0098 CHAR_ESCAPEMENT_HEIGHT */ {MAP_CHAR_LEN("CharEscapementHeight")},
+/* 0099 CHAR_COLOR */ {MAP_CHAR_LEN("CharColor")},
+
+/* 0100 CHAR_FLASH */ {MAP_CHAR_LEN("CharFlash")},
+/* 0101 CHAR_KERNING */ {MAP_CHAR_LEN("CharKerning")},
+/* 0102 CHAR_BACK_COLOR */ {MAP_CHAR_LEN("CharBackColor")},
+/* 0103 CHAR_BACK_TRANSPARENT */ {MAP_CHAR_LEN("CharBackTransparent")},
+/* 0104 CHAR_COMBINE_IS_ON */ {MAP_CHAR_LEN("CharCombineIsOn")},
+/* 0105 CHAR_COMBINE_PREFIX */ {MAP_CHAR_LEN("CharCombinePrefix")},
+/* 0106 CHAR_COMBINE_SUFFIX */ {MAP_CHAR_LEN("CharCombineSuffix")},
+/* 0107 CHAR_EMPHASIS */ {MAP_CHAR_LEN("CharEmphasis")},
+/* 0108 PARA_LINE_SPACING */ {MAP_CHAR_LEN("ParaLineSpacing")},
+/* 0109 PARA_TOP_MARGIN */ {MAP_CHAR_LEN("ParaTopMargin")},
+/* 0110 PARA_BOTTOM_MARGIN */ {MAP_CHAR_LEN("ParaBottomMargin")},
+/* 0111 PARA_TOP_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaTopMarginRelative")},
+/* 0112 PARA_BOTTOM_MARGIN_RELATIVE */ {MAP_CHAR_LEN("ParaBottomMarginRelative")},
+/* 0113 PARA_EXPAND_SINGLE_WORD */ {MAP_CHAR_LEN("ParaExpandSingleWord")},
+/* 0114 END_NOTICE */ {MAP_CHAR_LEN("EndNotice")},
+/* 0115 EMBEDDED_OBJECTS */ {MAP_CHAR_LEN("EmbeddedObjects")},
+/* 0116 ALPHABETICAL_SEPARATORS */ {MAP_CHAR_LEN("AlphabeticalSeparators")},
+/* 0117 BACKGROUND_COLOR */ {MAP_CHAR_LEN("BackgroundColor")},
+/* 0118 BEGIN_NOTICE */ {MAP_CHAR_LEN("BeginNotice")},
+/* 0119 CASE_SENSITIVE */ {MAP_CHAR_LEN("CaseSensitive")},
+/* 0120 FRAME_STYLE_NAME */ {MAP_CHAR_LEN("FrameStyleName")},
+/* 0121 NUMBERING_STYLE_NAME */ {MAP_CHAR_LEN("NumberingStyleName")},
+/* 0122 NUMBERING_LEVEL */ {MAP_CHAR_LEN("NumberingLevel")},
+/* 0123 NUMBERING_START_VALUE */ {MAP_CHAR_LEN("NumberingStartValue")},
+/* 0124 NUMBERING_IS_NUMBER */ {MAP_CHAR_LEN("NumberingIsNumber")},
+/* 0125 COMBINE_ENTRIES */ {MAP_CHAR_LEN("CombineEntries")},
+/* 0126 COUNT_LINES_IN_FRAMES */ {MAP_CHAR_LEN("CountLinesInFrames")},
+/* 0127 DDE_COMMAND_TYPE */ {MAP_CHAR_LEN("DDECommandType")},
+/* 0128 DDE_COMMAND_FILE */ {MAP_CHAR_LEN("DDECommandFile")},
+/* 0129 DDE_COMMAND_ELEMENT */ {MAP_CHAR_LEN("DDECommandElement")},
+/* 0130 IS_AUTOMATIC_UPDATE */ {MAP_CHAR_LEN("IsAutomaticUpdate")},
+/* 0131 DEFAULT_TABSTOP_DISTANCE */ {MAP_CHAR_LEN("DefaultTabstopDistance")},
+/* 0132 DISTANCE */ {MAP_CHAR_LEN("Distance")},
+/* 0133 DROP_CAP_FORMAT */ {MAP_CHAR_LEN("DropCapFormat")},
+/* 0134 DROP_CAP_WHOLE_WORD */ {MAP_CHAR_LEN("DropCapWholeWord")},
+/* 0135 DROP_CAP_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("DropCapCharStyleName")},
+/* 0136 FILE_LINK */ {MAP_CHAR_LEN("FileLink")},
+/* 0137 GRAPHIC */ {MAP_CHAR_LEN("Graphic")},
+/* 0138 GRAPHICS */ {MAP_CHAR_LEN("Graphics")},
+/* 0139 IS_PROTECTED */ {MAP_CHAR_LEN("IsProtected")},
+/* 0140 KEY_AS_ENTRY */ {MAP_CHAR_LEN("KeyAsEntry")},
+/* 0141 PARA_KEEP_TOGETHER */ {MAP_CHAR_LEN("ParaKeepTogether")},
+/* 0142 KEEP_TOGETHER */ {MAP_CHAR_LEN("KeepTogether")},
+/* 0143 IS_LANDSCAPE */ {MAP_CHAR_LEN("IsLandscape")},
+/* 0144 SEPARATOR_TEXT */ {MAP_CHAR_LEN("SeparatorText")},
+/* 0145 MARKS */ {MAP_CHAR_LEN("Marks")},
+/* 0146 NUMBER_POSITION */ {MAP_CHAR_LEN("NumberPosition")},
+/* 0147 OUTLINES */ {MAP_CHAR_LEN("Outlines")},
+/* 0148 PAGE_STYLE_NAME */ {MAP_CHAR_LEN("PageStyleName")},
+/* 0149 PAGE_STYLE_LAYOUT */ {MAP_CHAR_LEN("PageStyleLayout")},
+/* 0150 PARA_STYLES */ {MAP_CHAR_LEN("ParaStyles")},
+/* 0151 PARA_ADJUST */ {MAP_CHAR_LEN("ParaAdjust")},
+/* 0152 PARA_REGISTER_MODE_ACTIVE */ {MAP_CHAR_LEN("ParaRegisterModeActive")},
+/* 0153 PARA_STYLE_NAME */ {MAP_CHAR_LEN("ParaStyleName")},
+/* 0154 PARA_LAST_LINE_ADJUST */ {MAP_CHAR_LEN("ParaLastLineAdjust")},
+/* 0155 PARA_LINE_NUMBER_COUNT */ {MAP_CHAR_LEN("ParaLineNumberCount")},
+/* 0156 PARA_LINE_NUMBER_START_VALUE */ {MAP_CHAR_LEN("ParaLineNumberStartValue")},
+/* 0157 BACK_COLOR */ {MAP_CHAR_LEN("BackColor")},
+/* 0158 PARA_BACK_COLOR */ {MAP_CHAR_LEN("ParaBackColor")},
+/* 0159 PARA_WIDOWS */ {MAP_CHAR_LEN("ParaWidows")},
+/* 0160 PARA_ORPHANS */ {MAP_CHAR_LEN("ParaOrphans")},
+/* 0161 PARA_BACK_TRANSPARENT */ {MAP_CHAR_LEN("ParaBackTransparent")},
+/* 0162 POSITION_END_OF_DOC */ {MAP_CHAR_LEN("PositionEndOfDoc")},
+/* 0163 POSITION_PROTECTED */ {MAP_CHAR_LEN("PositionProtected")},
+/* 0164 ALTERNATIVE_TEXT */ {MAP_CHAR_LEN("AlternativeText")},
+/* 0165 PRIMARY_KEY */ {MAP_CHAR_LEN("PrimaryKey")},
+/* 0166 PRINT_TABLES */ {MAP_CHAR_LEN("PrintTables")},
+/* 0167 PRINT_GRAPHICS */ {MAP_CHAR_LEN("PrintGraphics")},
+/* 0168 PRINT_REVERSED */ {MAP_CHAR_LEN("PrintReversed")},
+/* 0169 PRINT_PROSPECT */ {MAP_CHAR_LEN("PrintProspect")},
+/* 0170 PRINT_CONTROLS */ {MAP_CHAR_LEN("PrintControls")},
+/* 0171 PRINT_DRAWINGS */ {MAP_CHAR_LEN("PrintDrawings")},
+/* 0172 PRINT_RIGHT_PAGES */ {MAP_CHAR_LEN("PrintRightPages")},
+/* 0173 PRINT_LEFT_PAGES */ {MAP_CHAR_LEN("PrintLeftPages")},
+/* 0174 PRINT_BLACK_FONTS */ {MAP_CHAR_LEN("PrintBlackFonts")},
+/* 0175 PRINTER_PAPER_TRAY */ {MAP_CHAR_LEN("PrinterPaperTray")},
+/* 0176 PRINT_PAGE_BACKGROUND */ {MAP_CHAR_LEN("PrintPageBackground")},
+/* 0177 PRINT_ANNOTATION_MODE */ {MAP_CHAR_LEN("PrintAnnotationMode")},
+/* 0178 PRINT_FAX_NAME */ {MAP_CHAR_LEN("PrintFaxName")},
+/* 0179 PRINT_PAPER_FROM_SETUP */ {MAP_CHAR_LEN("PrintPaperFromSetup")},
+/* 0180 REGISTER_MODE_ACTIVE */ {MAP_CHAR_LEN("RegisterModeActive")},
+/* 0181 RELATIVE_WIDTH */ {MAP_CHAR_LEN("RelativeWidth")},
+/* 0182 RELATIVE_HEIGHT */ {MAP_CHAR_LEN("RelativeHeight")},
+/* 0183 REPEAT_HEADLINE */ {MAP_CHAR_LEN("RepeatHeadline")},
+/* 0184 SEARCH_STYLES */ {MAP_CHAR_LEN("SearchStyles")},
+/* 0185 SEARCH_BACKWARDS */ {MAP_CHAR_LEN("SearchBackwards")},
+/* 0186 SEARCH_SIMILARITY */ {MAP_CHAR_LEN("SearchSimilarity")},
+/* 0187 SEARCH_IN_SELECTION */ {MAP_CHAR_LEN("SearchInSelection")},
+/* 0188 SEARCH_CASE_SENSITIVE */ {MAP_CHAR_LEN("SearchCaseSensitive")},
+/* 0189 SEARCH_SIMILARITY_ADD */ {MAP_CHAR_LEN("SearchSimilarityAdd")},
+/* 0190 SEARCH_SIMILARITY_RELAX */ {MAP_CHAR_LEN("SearchSimilarityRelax")},
+/* 0191 SEARCH_SIMILARITY_REMOVE */ {MAP_CHAR_LEN("SearchSimilarityRemove")},
+/* 0192 SEARCH_REGULAR_EXPRESSION */ {MAP_CHAR_LEN("SearchRegularExpression")},
+/* 0193 SEARCH_SIMILARITY_EXCHANGE */ {MAP_CHAR_LEN("SearchSimilarityExchange")},
+/* 0194 SECONDARY_KEY */ {MAP_CHAR_LEN("SecondaryKey")},
+/* 0195 SEPARATOR_INTERVAL */ {MAP_CHAR_LEN("SeparatorInterval")},
+/* 0196 SHOW_BREAKS */ {MAP_CHAR_LEN("ShowBreaks")},
+/* 0197 SHOW_SPACES */ {MAP_CHAR_LEN("ShowSpaces")},
+/* 0198 SHOW_TABLES */ {MAP_CHAR_LEN("ShowTables")},
+/* 0199 SHOW_GRAPHICS */ {MAP_CHAR_LEN("ShowGraphics")},
+
+/* 0200 SHOW_DRAWINGS */ {MAP_CHAR_LEN("ShowDrawings")},
+/* 0201 SHOW_TABSTOPS */ {MAP_CHAR_LEN("ShowTabstops")},
+/* 0202 SHOW_VERT_RULER */ {MAP_CHAR_LEN("ShowVertRuler")},
+/* 0203 SHOW_PARA_BREAKS */ {MAP_CHAR_LEN("ShowParaBreaks")},
+/* 0204 SHOW_HIDDEN_TEXT */ {MAP_CHAR_LEN("ShowHiddenText")},
+/* 0205 SHOW_ANNOTATIONS */ {MAP_CHAR_LEN("ShowAnnotations")},
+/* 0206 SHOW_SOFT_HYPHENS */ {MAP_CHAR_LEN("ShowSoftHyphens")},
+/* 0207 SHOW_VERT_SCROLL_BAR */ {MAP_CHAR_LEN("ShowVertScrollBar")},
+/* 0208 SHOW_HORI_SCROLL_BAR */ {MAP_CHAR_LEN("ShowHoriScrollBar")},
+/* 0209 SHOW_FIELD_COMMANDS */ {MAP_CHAR_LEN("ShowFieldCommands")},
+/* 0210 SHOW_TEXT_BOUNDARIES */ {MAP_CHAR_LEN("ShowTextBoundaries")},
+/* 0211 SHOW_PROTECTED_SPACES */ {MAP_CHAR_LEN("ShowProtectedSpaces")},
+/* 0212 SHOW_TABLE_BOUNDARIES */ {MAP_CHAR_LEN("ShowTableBoundaries")},
+/* 0213 SHOW_HIDDEN_PARAGRAPHS */ {MAP_CHAR_LEN("ShowHiddenParagraphs")},
+/* 0214 SHOW_INDEX_MARK_BACKGROUND */ {MAP_CHAR_LEN("ShowIndexMarkBackground")},
+/* 0215 SHOW_FOOTNOTE_BACKGROUND */ {MAP_CHAR_LEN("ShowFootnoteBackground")},
+/* 0216 SHOW_TEXT_FIELD_BACKGROUND */ {MAP_CHAR_LEN("ShowTextFieldBackground")},
+/* 0217 IS_SYNC_WIDTH_TO_HEIGHT */ {MAP_CHAR_LEN("IsSyncWidthToHeight")},
+/* 0218 IS_SYNC_HEIGHT_TO_WIDTH */ {MAP_CHAR_LEN("IsSyncHeightToWidth")},
+/* 0219 SIZE_PROTECTED */ {MAP_CHAR_LEN("SizeProtected")},
+/* 0220 SMOOTH_SCROLLING */ {MAP_CHAR_LEN("SmoothScrolling")},
+/* 0221 SOLID_MARK_HANDLES */ {MAP_CHAR_LEN("SolidMarkHandles")},
+/* 0222 TABLES */ {MAP_CHAR_LEN("Tables")},
+/* 0223 TEXT_FRAMES */ {MAP_CHAR_LEN("TextFrames")},
+/* 0224 TEXT_COLUMNS */ {MAP_CHAR_LEN("TextColumns")},
+/* 0225 BACK_TRANSPARENT */ {MAP_CHAR_LEN("BackTransparent")},
+/* 0226 USE_PP */ {MAP_CHAR_LEN("UsePP")},
+/* 0227 USER_METRIC */ {MAP_CHAR_LEN("UserMetric")},
+/* 0228 ANCHOR_TYPE */ {MAP_CHAR_LEN("AnchorType")},
+/* 0229 ANCHOR_TYPES */ {MAP_CHAR_LEN("AnchorTypes")},
+/* 0230 ANCHOR_PAGE_NO */ {MAP_CHAR_LEN("AnchorPageNo")},
+/* 0231 ANCHOR_FRAME */ {MAP_CHAR_LEN("AnchorFrame")},
+/* 0232 AUTHOR */ {MAP_CHAR_LEN("Author")},
+/* 0233 BREAK_TYPE */ {MAP_CHAR_LEN("BreakType")},
+/* 0234 CHAIN_NEXT_NAME */ {MAP_CHAR_LEN("ChainNextName")},
+/* 0235 CHAIN_PREV_NAME */ {MAP_CHAR_LEN("ChainPrevName")},
+/* 0236 CHAPTER_FORMAT */ {MAP_CHAR_LEN("ChapterFormat")},
+/* 0237 CLIENT_MAP */ {MAP_CHAR_LEN("ClientMap")},
+/* 0238 CONDITION */ {MAP_CHAR_LEN("Condition")},
+/* 0239 CONTENT */ {MAP_CHAR_LEN("Content")},
+/* 0240 CHAR_CONTOURED */ {MAP_CHAR_LEN("CharContoured")},
+/* 0241 CONTOUR_OUTSIDE */ {MAP_CHAR_LEN("ContourOutside")},
+/* 0242 CONTENT_PROTECTED */ {MAP_CHAR_LEN("ContentProtected")},
+/* 0243 COUNT_EMPTY_LINES */ {MAP_CHAR_LEN("CountEmptyLines")},
+/* 0244 RESTART_AT_EACH_PAGE */ {MAP_CHAR_LEN("RestartAtEachPage")},
+/* 0245 DATA_BASE_NAME */ {MAP_CHAR_LEN("DataBaseName")},
+/* 0246 DATA_TABLE_NAME */ {MAP_CHAR_LEN("DataTableName")},
+/* 0247 DATA_COMMAND_TYPE */ {MAP_CHAR_LEN("DataCommandType")},
+/* 0248 DATA_COLUMN_NAME */ {MAP_CHAR_LEN("DataColumnName")},
+/* 0249 IS_DATA_BASE_FORMAT */ {MAP_CHAR_LEN("DataBaseFormat")},
+/* 0250 DATE */ {MAP_CHAR_LEN("Date")},
+/* 0251 IS_DATE */ {MAP_CHAR_LEN("IsDate")},
+/* 0252 EDIT_IN_READONLY */ {MAP_CHAR_LEN("EditInReadonly")},
+/* 0253 FALSE_CONTENT */ {MAP_CHAR_LEN("FalseContent")},
+/* 0254 FILE_FORMAT */ {MAP_CHAR_LEN("FileFormat")},
+/* 0255 IS_FIXED */ {MAP_CHAR_LEN("IsFixed")},
+/* 0256 FOOTNOTE_COUNTING */ {MAP_CHAR_LEN("FootnoteCounting")},
+/* 0257 FORMULA */ {MAP_CHAR_LEN("Formula")},
+/* 0258 FRAME_NAME */ {MAP_CHAR_LEN("FrameName")},
+/* 0259 GRAPHIC_NAME */ {MAP_CHAR_LEN("GraphicName")},
+/* 0260 FULL_NAME */ {MAP_CHAR_LEN("FullName")},
+/* 0261 HEIGHT */ {MAP_CHAR_LEN("Height")},
+/* 0262 IS_AUTO_HEIGHT */ {MAP_CHAR_LEN("IsAutoHeight")},
+/* 0263 SIZE_TYPE */ {MAP_CHAR_LEN("SizeType")},
+/* 0264 HINT */ {MAP_CHAR_LEN("Hint")},
+/* 0265 HORI_ORIENT */ {MAP_CHAR_LEN("HoriOrient")},
+/* 0266 HORI_MIRRORED_ON_EVEN_PAGES */ {MAP_CHAR_LEN("HoriMirroredOnEvenPages")},
+/* 0267 HORI_MIRRORED_ON_ODD_PAGES */ {MAP_CHAR_LEN("HoriMirroredOnOddPages")},
+/* 0268 HORI_ORIENT_RELATION */ {MAP_CHAR_LEN("HoriOrientRelation")},
+/* 0269 HORI_ORIENT_POSITION */ {MAP_CHAR_LEN("HoriOrientPosition")},
+/* 0270 HYPER_LINK_U_R_L */ {MAP_CHAR_LEN("HyperLinkURL")},
+/* 0271 HYPER_LINK_TARGET */ {MAP_CHAR_LEN("HyperLinkTarget")},
+/* 0272 HYPER_LINK_NAME */ {MAP_CHAR_LEN("HyperLinkName")},
+/* 0273 HYPER_LINK_EVENTS */ {MAP_CHAR_LEN("HyperLinkEvents")},
+/* 0274 INFO_TYPE */ {MAP_CHAR_LEN("InfoType")},
+/* 0275 INFO_FORMAT */ {MAP_CHAR_LEN("InfoFormat")},
+/* 0276 IS_INPUT */ {MAP_CHAR_LEN("Input")},
+/* 0277 LEVEL */ {MAP_CHAR_LEN("Level")},
+/* 0278 INTERVAL */ {MAP_CHAR_LEN("Interval")},
+/* 0279 LINK_REGION */ {MAP_CHAR_LEN("LinkRegion")},
+/* 0280 MACRO_NAME */ {MAP_CHAR_LEN("MacroName")},
+/* 0281 SPLIT */ {MAP_CHAR_LEN("Split")},
+/* 0282 PARA_SPLIT */ {MAP_CHAR_LEN("ParaSplit")},
+/* 0283 NUMBER_FORMAT */ {MAP_CHAR_LEN("NumberFormat")},
+/* 0284 NUMBERING_TYPE */ {MAP_CHAR_LEN("NumberingType")},
+/* 0285 NUMBERING_RULES */ {MAP_CHAR_LEN("NumberingRules")},
+/* 0286 OFFSET */ {MAP_CHAR_LEN("Offset")},
+/* 0287 ON */ {MAP_CHAR_LEN("On")},
+/* 0288 OPAQUE */ {MAP_CHAR_LEN("Opaque")},
+/* 0289 PAGE_TOGGLE */ {MAP_CHAR_LEN("PageToggle")},
+/* 0290 PAGE_DESC_NAME */ {MAP_CHAR_LEN("PageDescName")},
+/* 0291 PAGE_NUMBER_OFFSET */ {MAP_CHAR_LEN("PageNumberOffset")},
+/* 0292 PLACEHOLDER */ {MAP_CHAR_LEN("PlaceHolder")},
+/* 0293 PLACEHOLDER_TYPE */ {MAP_CHAR_LEN("PlaceHolderType")},
+/* 0294 PRINT */ {MAP_CHAR_LEN("Print")},
+/* 0295 REFERENCE_FIELD_PART */ {MAP_CHAR_LEN("ReferenceFieldPart")},
+/* 0296 REFERENCE_FIELD_SOURCE */ {MAP_CHAR_LEN("ReferenceFieldSource")},
+/* 0297 REGISTER_PARAGRAPH_STYLE */ {MAP_CHAR_LEN("RegisterParagraphStyle")},
+/* 0298 SCRIPT_TYPE */ {MAP_CHAR_LEN("ScriptType")},
+/* 0299 SEARCH_ALL */ {MAP_CHAR_LEN("SearchAll")},
+
+/* 0300 SEARCH_WORDS */ {MAP_CHAR_LEN("SearchWords")},
+/* 0301 SEQUENCE_VALUE */ {MAP_CHAR_LEN("SequenceValue")},
+/* 0302 SERVER_MAP */ {MAP_CHAR_LEN("ServerMap")},
+/* 0303 IMAGE_MAP */ {MAP_CHAR_LEN("ImageMap")},
+/* 0304 SET_NUMBER */ {MAP_CHAR_LEN("SetNumber")},
+/* 0305 SHADOW_FORMAT */ {MAP_CHAR_LEN("ShadowFormat")},
+/* 0306 SHOW_HORI_RULER */ {MAP_CHAR_LEN("ShowHoriRuler")},
+/* 0307 SIZE */ {MAP_CHAR_LEN("Size")},
+/* 0308 ACTUAL_SIZE */ {MAP_CHAR_LEN("ActualSize")},
+/* 0309 SOURCE_NAME */ {MAP_CHAR_LEN("SourceName")},
+/* 0310 START_AT */ {MAP_CHAR_LEN("StartAt")},
+/* 0311 STATISTIC_TYPE_ID */ {MAP_CHAR_LEN("StatisticTypeId")},
+/* 0312 SUB_TYPE */ {MAP_CHAR_LEN("SubType")},
+/* 0313 SURROUND */ {MAP_CHAR_LEN("Surround")},
+/* 0314 IS_EXPRESSION */ {MAP_CHAR_LEN("IsExpression")},
+/* 0315 IS_SHOW_FORMULA */ {MAP_CHAR_LEN("IsShowFormula")},
+/* 0316 TEXT_WRAP */ {MAP_CHAR_LEN("TextWrap")},
+/* 0317 SURROUND_CONTOUR */ {MAP_CHAR_LEN("SurroundContour")},
+/* 0318 SURROUND_ANCHORONLY */ {MAP_CHAR_LEN("SurroundAnchorOnly")},
+/* 0319 TABLE_NAME */ {MAP_CHAR_LEN("TableName")},
+/* 0320 TABSTOPS */ {MAP_CHAR_LEN("ParaTabStops")},
+/* 0321 TITLE */ {MAP_CHAR_LEN("Title")},
+/* 0322 TOP_MARGIN */ {MAP_CHAR_LEN("TopMargin")},
+/* 0323 BOTTOM_MARGIN */ {MAP_CHAR_LEN("BottomMargin")},
+/* 0324 TRUE_CONTENT */ {MAP_CHAR_LEN("TrueContent")},
+/* 0325 URL_CONTENT */ {MAP_CHAR_LEN("URLContent")},
+/* 0326 USERTEXT */ {MAP_CHAR_LEN("UserText")},
+/* 0327 USER_DATA_TYPE */ {MAP_CHAR_LEN("UserDataType")},
+/* 0328 VALUE */ {MAP_CHAR_LEN("Value")},
+/* 0329 VARIABLE_NAME */ {MAP_CHAR_LEN("VariableName")},
+/* 0330 VARIABLE_SUBTYPE */ {MAP_CHAR_LEN("VariableSubtype")},
+/* 0331 VERT_ORIENT */ {MAP_CHAR_LEN("VertOrient")},
+/* 0332 VERT_MIRRORED */ {MAP_CHAR_LEN("VertMirrored")},
+/* 0333 VERT_ORIENT_POSITION */ {MAP_CHAR_LEN("VertOrientPosition")},
+/* 0334 VERT_ORIENT_RELATION */ {MAP_CHAR_LEN("VertOrientRelation")},
+/* 0335 IS_VISIBLE */ {MAP_CHAR_LEN("IsVisible")},
+/* 0336 WIDTH */ {MAP_CHAR_LEN("Width")},
+/* 0337 CHAR_WORD_MODE */ {MAP_CHAR_LEN("CharWordMode")},
+/* 0338 GRAPHIC_CROP */ {MAP_CHAR_LEN("GraphicCrop")},
+/* 0339 CHARACTER_FORMAT_NONE */ {MAP_CHAR_LEN("CharacterFormatNone")},
+/* 0340 TEXT_POSITION */ {MAP_CHAR_LEN("TextPosition")},
+/* 0341 DOCUMENT_INDEX_MARK */ {MAP_CHAR_LEN("DocumentIndexMark")},
+/* 0342 DOCUMENT_INDEX */ {MAP_CHAR_LEN("DocumentIndex")},
+/* 0343 IS_GLOBAL_DOCUMENT_SECTION */ {MAP_CHAR_LEN("IsGlobalDocumentSection")},
+/* 0344 TEXT_FIELD */ {MAP_CHAR_LEN("TextField")},
+/* 0345 BOOKMARK */ {MAP_CHAR_LEN("Bookmark")},
+/* 0346 TEXT_TABLE */ {MAP_CHAR_LEN("TextTable")},
+/* 0347 CELL */ {MAP_CHAR_LEN("Cell")},
+/* 0348 TEXT_FRAME */ {MAP_CHAR_LEN("TextFrame")},
+/* 0349 REFERENCE_MARK */ {MAP_CHAR_LEN("ReferenceMark")},
+/* 0350 TEXT_SECTION */ {MAP_CHAR_LEN("TextSection")},
+/* 0351 FOOTNOTE */ {MAP_CHAR_LEN("Footnote")},
+/* 0352 ENDNOTE */ {MAP_CHAR_LEN("Endnote")},
+/* 0353 CHART_ROW_AS_LABEL */ {MAP_CHAR_LEN("ChartRowAsLabel")},
+/* 0354 CHART_COLUMN_AS_LABEL */ {MAP_CHAR_LEN("ChartColumnAsLabel")},
+/* 0355 TABLE_COLUMS */ {MAP_CHAR_LEN("TableColumns")},
+/* 0356 LEFT_BORDER */ {MAP_CHAR_LEN("LeftBorder")},
+/* 0357 RIGHT_BORDER */ {MAP_CHAR_LEN("RightBorder")},
+/* 0358 TOP_BORDER */ {MAP_CHAR_LEN("TopBorder")},
+/* 0359 BOTTOM_BORDER */ {MAP_CHAR_LEN("BottomBorder")},
+/* 0360 BORDER_DISTANCE */ {MAP_CHAR_LEN("BorderDistance")},
+/* 0361 LEFT_BORDER_DISTANCE */ {MAP_CHAR_LEN("LeftBorderDistance")},
+/* 0362 RIGHT_BORDER_DISTANCE */ {MAP_CHAR_LEN("RightBorderDistance")},
+/* 0363 TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("TopBorderDistance")},
+/* 0364 BOTTOM_BORDER_DISTANCE */ {MAP_CHAR_LEN("BottomBorderDistance")},
+/* 0365 TABLE_BORDER */ {MAP_CHAR_LEN("TableBorder")},
+/* 0366 TABLE_COLUMN_SEPARATORS */ {MAP_CHAR_LEN("TableColumnSeparators")},
+/* 0367 TABLE_COLUMN_RELATIVE_SUM */ {MAP_CHAR_LEN("TableColumnRelativeSum")},
+/* 0368 HEADER_TEXT */ {MAP_CHAR_LEN("HeaderText")},
+/* 0369 HEADER_TEXT_LEFT */ {MAP_CHAR_LEN("HeaderTextLeft")},
+/* 0370 HEADER_TEXT_RIGHT */ {MAP_CHAR_LEN("HeaderTextRight")},
+/* 0371 FOOTER_TEXT */ {MAP_CHAR_LEN("FooterText")},
+/* 0372 FOOTER_TEXT_LEFT */ {MAP_CHAR_LEN("FooterTextLeft")},
+/* 0373 FOOTER_TEXT_RIGHT */ {MAP_CHAR_LEN("FooterTextRight")},
+/* 0374 HEADER_BACK_COLOR */ {MAP_CHAR_LEN("HeaderBackColor")},
+/* 0375 HEADER_GRAPHIC */ {MAP_CHAR_LEN("HeaderBackGraphic")},
+/* 0376 HEADER_BACK_TRANSPARENT */ {MAP_CHAR_LEN("HeaderBackTransparent")},
+/* 0377 HEADER_LEFT_BORDER */ {MAP_CHAR_LEN("HeaderLeftBorder")},
+/* 0378 HEADER_RIGHT_BORDER */ {MAP_CHAR_LEN("HeaderRightBorder")},
+/* 0379 HEADER_TOP_BORDER */ {MAP_CHAR_LEN("HeaderTopBorder")},
+/* 0380 HEADER_BOTTOM_BORDER */ {MAP_CHAR_LEN("HeaderBottomBorder")},
+/* 0381 HEADER_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderBorderDistance")},
+/* 0382 HEADER_SHADOW_FORMAT */ {MAP_CHAR_LEN("HeaderShadowFormat")},
+/* 0383 HEADER_BODY_DISTANCE */ {MAP_CHAR_LEN("HeaderBodyDistance")},
+/* 0384 HEADER_IS_DYNAMIC_HEIGHT */ {MAP_CHAR_LEN("HeaderIsDynamicHeight")},
+/* 0385 HEADER_IS_SHARED */ {MAP_CHAR_LEN("HeaderIsShared")},
+/* 0386 HEADER_HEIGHT */ {MAP_CHAR_LEN("HeaderHeight")},
+/* 0387 HEADER_IS_ON */ {MAP_CHAR_LEN("HeaderIsOn")},
+/* 0388 FOOTER_BACK_COLOR */ {MAP_CHAR_LEN("FooterBackColor")},
+/* 0389 FOOTER_GRAPHIC */ {MAP_CHAR_LEN("FooterBackGraphic")},
+/* 0390 FOOTER_BACK_TRANSPARENT */ {MAP_CHAR_LEN("FooterBackTransparent")},
+/* 0391 FOOTER_LEFT_BORDER */ {MAP_CHAR_LEN("FooterLeftBorder")},
+/* 0392 FOOTER_RIGHT_BORDER */ {MAP_CHAR_LEN("FooterRightBorder")},
+/* 0393 FOOTER_TOP_BORDER */ {MAP_CHAR_LEN("FooterTopBorder")},
+/* 0394 FOOTER_BOTTOM_BORDER */ {MAP_CHAR_LEN("FooterBottomBorder")},
+/* 0395 FOOTER_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterBorderDistance")},
+/* 0396 FOOTER_SHADOW_FORMAT */ {MAP_CHAR_LEN("FooterShadowFormat")},
+/* 0397 FOOTER_BODY_DISTANCE */ {MAP_CHAR_LEN("FooterBodyDistance")},
+/* 0398 FOOTER_IS_DYNAMIC_HEIGHT */ {MAP_CHAR_LEN("FooterIsDynamicHeight")},
+/* 0399 FOOTER_IS_SHARED */ {MAP_CHAR_LEN("FooterIsShared")},
+
+/* 0400 FOOTER_HEIGHT */ {MAP_CHAR_LEN("FooterHeight")},
+/* 0401 FOOTER_IS_ON */ {MAP_CHAR_LEN("FooterIsOn")},
+/* 0402 OVERWRITE_STYLES */ {MAP_CHAR_LEN("OverwriteStyles")},
+/* 0403 LOAD_NUMBERING_STYLES */ {MAP_CHAR_LEN("LoadNumberingStyles")},
+/* 0404 LOAD_PAGE_STYLES */ {MAP_CHAR_LEN("LoadPageStyles")},
+/* 0405 LOAD_FRAME_STYLES */ {MAP_CHAR_LEN("LoadFrameStyles")},
+/* 0406 LOAD_TEXT_STYLES */ {MAP_CHAR_LEN("LoadTextStyles")},
+/* 0407 FILE_NAME */ {MAP_CHAR_LEN("FileName")},
+/* 0408 FILTER_NAME */ {MAP_CHAR_LEN("FilterName")},
+/* 0409 FILTER_OPTION */ {MAP_CHAR_LEN("FilterOption")},
+/* 0410 PASSWORD */ {MAP_CHAR_LEN("Password")},
+/* 0411 COPY_COUNT */ {MAP_CHAR_LEN("CopyCount")},
+/* 0412 COLLATE */ {MAP_CHAR_LEN("Collate")},
+/* 0413 SORT */ {MAP_CHAR_LEN("Sort")},
+/* 0414 PAGES */ {MAP_CHAR_LEN("Pages")},
+/* 0415 FIRST_LINE_OFFSET */ {MAP_CHAR_LEN("FirstLineOffset")},
+/* 0416 SYMBOL_TEXT_DISTANCE */ {MAP_CHAR_LEN("SymbolTextDistance")},
+/* 0417 USER_INDEX_NAME */ {MAP_CHAR_LEN("UserIndexName")},
+/* 0418 REVISION */ {MAP_CHAR_LEN("Revision")},
+/* 0419 UNVISITED_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("UnvisitedCharStyleName")},
+/* 0420 VISITED_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("VisitedCharStyleName")},
+/* 0421 PARAGRAPH_COUNT */ {MAP_CHAR_LEN("ParagraphCount")},
+/* 0422 WORD_COUNT */ {MAP_CHAR_LEN("WordCount")},
+/* 0423 WORD_SEPARATOR */ {MAP_CHAR_LEN("WordSeparator")},
+/* 0424 CHARACTER_COUNT */ {MAP_CHAR_LEN("CharacterCount")},
+/* 0425 ZOOM_VALUE */ {MAP_CHAR_LEN("ZoomValue")},
+/* 0426 ZOOM_TYPE */ {MAP_CHAR_LEN("ZoomType")},
+/* 0427 CREATE_FROM_MARKS */ {MAP_CHAR_LEN("CreateFromMarks")},
+/* 0428 CREATE_FROM_OUTLINE */ {MAP_CHAR_LEN("CreateFromOutline")},
+/* 0429 PARAGRAPH_STYLE_NAMES */ {MAP_CHAR_LEN("ParagraphStyleNames")},
+/* 0430 CREATE_FROM_CHAPTER */ {MAP_CHAR_LEN("CreateFromChapter")},
+/* 0431 CREATE_FROM_LABELS */ {MAP_CHAR_LEN("CreateFromLabels")},
+/* 0432 USE_ALPHABETICAL_SEPARATORS */ {MAP_CHAR_LEN("UseAlphabeticalSeparators")},
+/* 0433 USE_KEY_AS_ENTRY */ {MAP_CHAR_LEN("UseKeyAsEntry")},
+/* 0434 USE_COMBINED_ENTRIES */ {MAP_CHAR_LEN("UseCombinedEntries")},
+/* 0435 IS_CASE_SENSITIVE */ {MAP_CHAR_LEN("IsCaseSensitive")},
+/* 0436 USE_P_P */ {MAP_CHAR_LEN("UsePP")},
+/* 0437 USE_DASH */ {MAP_CHAR_LEN("UseDash")},
+/* 0438 USE_UPPER_CASE */ {MAP_CHAR_LEN("UseUpperCase")},
+/* 0439 LABEL_CATEGORY */ {MAP_CHAR_LEN("LabelCategory")},
+/* 0440 LABEL_DISPLAY_TYPE */ {MAP_CHAR_LEN("LabelDisplayType")},
+/* 0441 USE_LEVEL_FROM_SOURCE */ {MAP_CHAR_LEN("UseLevelFromSource")},
+/* 0442 LEVEL_FORMAT */ {MAP_CHAR_LEN("LevelFormat")},
+/* 0443 LEVEL_PARAGRAPH_STYLES */ {MAP_CHAR_LEN("LevelParagraphStyles")},
+/* 0444 RECALC_TAB_STOPS */ {MAP_CHAR_LEN("RecalcTabStops")},
+/* 0445 MAIN_ENTRY_CHARACTER_STYLE_NAME */ {MAP_CHAR_LEN("MainEntryCharacterStyleName")},
+/* 0446 CREATE_FROM_TABLES */ {MAP_CHAR_LEN("CreateFromTables")},
+/* 0447 CREATE_FROM_TEXT_FRAMES */ {MAP_CHAR_LEN("CreateFromTextFrames")},
+/* 0448 CREATE_FROM_GRAPHIC_OBJECTS */ {MAP_CHAR_LEN("CreateFromGraphicObjects")},
+/* 0449 CREATE_FROM_EMBEDDED_OBJECTS */ {MAP_CHAR_LEN("CreateFromEmbeddedObjects")},
+/* 0450 CREATE_FROM_STAR_MATH */ {MAP_CHAR_LEN("CreateFromStarMath")},
+/* 0451 CREATE_FROM_STAR_CHART */ {MAP_CHAR_LEN("CreateFromStarChart")},
+/* 0452 CREATE_FROM_STAR_CALC */ {MAP_CHAR_LEN("CreateFromStarCalc")},
+/* 0453 CREATE_FROM_STAR_DRAW */ {MAP_CHAR_LEN("CreateFromStarDraw")},
+/* 0454 CREATE_FROM_OTHER_EMBEDDED_OBJECTS */ {MAP_CHAR_LEN("CreateFromOtherEmbeddedObjects")},
+/* 0455 INDEX_AUTO_MARK_FILE_U_R_L */ {MAP_CHAR_LEN("IndexAutoMarkFileURL")},
+/* 0456 IS_COMMA_SEPARATED */ {MAP_CHAR_LEN("IsCommaSeparated")},
+/* 0457 IS_RELATIVE_TABSTOPS */ {MAP_CHAR_LEN("IsRelativeTabstops")},
+/* 0458 CREATE_FROM_LEVEL_PARAGRAPH_STYLES */ {MAP_CHAR_LEN("CreateFromLevelParagraphStyles")},
+/* 0459 SHOW_CHANGES */ {MAP_CHAR_LEN("ShowChanges")},
+/* 0460 RECORD_CHANGES */ {MAP_CHAR_LEN("RecordChanges")},
+/* 0461 DISPLAY_NAME */ {MAP_CHAR_LEN("LinkDisplayName")},
+/* 0462 DISPLAY_BITMAP */ {MAP_CHAR_LEN("LinkDisplayBitmap")},
+/* 0463 HEADING_STYLE_NAME */ {MAP_CHAR_LEN("HeadingStyleName")},
+/* 0464 SHOW_ONLINE_LAYOUT */ {MAP_CHAR_LEN("ShowOnlineLayout")},
+/* 0465 USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("UserDefinedAttributes")},
+/* 0466 TEXT_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("TextUserDefinedAttributes")},
+/* 0467 FILE_PATH */ {MAP_CHAR_LEN("FilePath")},
+/* 0468 PARA_CHAPTER_NUMBERING_LEVEL */ {MAP_CHAR_LEN("ParaChapterNumberingLevel")},
+/* 0469 PARA_CONDITIONAL_STYLE_NAME */ {MAP_CHAR_LEN("ParaConditionalStyleName")},
+/* 0470 CHAPTER_NUMBERING_LEVEL */ {MAP_CHAR_LEN("ChapterNumberingLevel")},
+/* 0471 NUMBERING_SEPARATOR */ {MAP_CHAR_LEN("NumberingSeparator")},
+/* 0472 IS_CONTINUOUS_NUMBERING */ {MAP_CHAR_LEN("IsContinuousNumbering")},
+/* 0473 IS_AUTOMATIC */ {MAP_CHAR_LEN("IsAutomatic")},
+/* 0474 IS_ABSOLUTE_MARGINS */ {MAP_CHAR_LEN("IsAbsoluteMargins")},
+/* 0475 CATEGORY */ {MAP_CHAR_LEN("Category")},
+/* 0476 DEPENDENT_TEXT_FIELDS */ {MAP_CHAR_LEN("DependentTextFields")},
+/* 0477 CURRENT_PRESENTATION */ {MAP_CHAR_LEN("CurrentPresentation")},
+/* 0478 ADJUST */ {MAP_CHAR_LEN("Adjust")},
+/* 0479 INSTANCE_NAME */ {MAP_CHAR_LEN("InstanceName")},
+/* 0480 TEXT_PORTION_TYPE */ {MAP_CHAR_LEN("TextPortionType")},
+/* 0481 CONTROL_CHARACTER */ {MAP_CHAR_LEN("ControlCharacter")},
+/* 0482 IS_COLLAPSED */ {MAP_CHAR_LEN("IsCollapsed")},
+/* 0483 IS_START */ {MAP_CHAR_LEN("IsStart")},
+/* 0484 SEQUENCE_NUMBER */ {MAP_CHAR_LEN("SequenceNumber")},
+/* 0485 REFERENCE_ID */ {MAP_CHAR_LEN("ReferenceId")},
+/* 0486 HEADER_LEFT_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderLeftBorderDistance")},
+/* 0487 HEADER_RIGHT_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderRightBorderDistance")},
+/* 0488 HEADER_TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("HeaderTopBorderDistance")},
+/* 0489 HEADER_BOTTOM_BORDER_DISTANCE */{MAP_CHAR_LEN("HeaderBottomBorderDistance")},
+/* 0490 FOOTER_LEFT_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterLeftBorderDistance")},
+/* 0491 FOOTER_RIGHT_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterRightBorderDistance")},
+/* 0492 FOOTER_TOP_BORDER_DISTANCE */ {MAP_CHAR_LEN("FooterTopBorderDistance")},
+/* 0493 FOOTER_BOTTOM_BORDER_DISTANCE */{MAP_CHAR_LEN("FooterBottomBorderDistance")},
+/* 0494 PARA_IS_NUMBERING_RESTART */ {MAP_CHAR_LEN("ParaIsNumberingRestart")},
+/* 0495 HIDE_FIELD_TIPS */ {MAP_CHAR_LEN("HideFieldTips")},
+/* 0496 HEADER_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("HeaderUserDefinedAttributes")},
+/* 0497 FOOTER_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("FooterUserDefinedAttributes")},
+/* 0498 PARA_SHADOW_FORMAT */ {MAP_CHAR_LEN("ParaShadowFormat")},
+/* 0499 CONTOUR_POLY_POLYGON */ {MAP_CHAR_LEN("ContourPolyPolygon")},
+
+/* 0500 IS_PIXEL_CONTOUR */ {MAP_CHAR_LEN("IsPixelContour")},
+/* 0501 IS_AUTOMATIC_CONTOUR */ {MAP_CHAR_LEN("IsAutomaticContour")},
+/* 0502 SEPARATOR_LINE_WIDTH */ {MAP_CHAR_LEN("SeparatorLineWidth")},
+/* 0503 SEPARATOR_LINE_COLOR */ {MAP_CHAR_LEN("SeparatorLineColor")},
+/* 0504 SEPARATOR_LINE_RELATIVE_HEIGHT */ {MAP_CHAR_LEN("SeparatorLineRelativeHeight")},
+/* 0505 SEPARATOR_LINE_VERTIVAL_ALIGNMENT */{MAP_CHAR_LEN("SeparatorLineVerticalAlignment")},
+/* 0506 SEPARATOR_LINE_IS_ON */ {MAP_CHAR_LEN("SeparatorLineIsOn")},
+/* 0507 IS_SKIP_HIDDEN_TEXT */ {MAP_CHAR_LEN("IsSkipHiddenText")},
+/* 0508 IS_SKIP_PROTECTED_TEXT */ {MAP_CHAR_LEN("IsSkipProtectedText")},
+/* 0509 DOCUMENT_INDEX_MARKS */ {MAP_CHAR_LEN("DocumentIndexMarks")},
+/* 0510 FOOTNOTE_IS_COLLECT_AT_TEXT_END */ {MAP_CHAR_LEN("FootnoteIsCollectAtTextEnd")},
+/* 0511 FOOTNOTE_IS_RESTART_NUMBERING */ {MAP_CHAR_LEN("FootnoteIsRestartNumbering")},
+/* 0512 FOOTNOTE_RESTART_NUMBERING_AT */{MAP_CHAR_LEN("FootnoteRestartNumberingAt")},
+/* 0513 FOOTNOTE_IS_OWN_NUMBERING */ {MAP_CHAR_LEN("FootnoteIsOwnNumbering")},
+/* 0514 FOOTNOTE_NUMBERING_TYPE */ {MAP_CHAR_LEN("FootnoteNumberingType")},
+/* 0515 FOOTNOTE_NUMBERING_PREFIX */ {MAP_CHAR_LEN("FootnoteNumberingPrefix")},
+/* 0516 FOOTNOTE_NUMBERING_SUFFIX */ {MAP_CHAR_LEN("FootnoteNumberingSuffix")},
+/* 0517 ENDNOTE_IS_COLLECT_AT_TEXT_END */ {MAP_CHAR_LEN("EndnoteIsCollectAtTextEnd")},
+/* 0518 ENDNOTE_IS_RESTART_NUMBERING */ {MAP_CHAR_LEN("EndnoteIsRestartNumbering")},
+/* 0519 ENDNOTE_RESTART_NUMBERING_AT */ {MAP_CHAR_LEN("EndnoteRestartNumberingAt")},
+/* 0520 ENDNOTE_IS_OWN_NUMBERING */ {MAP_CHAR_LEN("EndnoteIsOwnNumbering")},
+/* 0521 ENDNOTE_NUMBERING_TYPE */ {MAP_CHAR_LEN("EndnoteNumberingType")},
+/* 0522 ENDNOTE_NUMBERING_PREFIX */ {MAP_CHAR_LEN("EndnoteNumberingPrefix")},
+/* 0523 ENDNOTE_NUMBERING_SUFFIX */ {MAP_CHAR_LEN("EndnoteNumberingSuffix")},
+/* 0524 BRACKET_BEFORE */ {MAP_CHAR_LEN("BracketBefore")},
+/* 0525 BRACKET_AFTER */ {MAP_CHAR_LEN("BracketAfter")},
+/* 0526 IS_NUMBER_ENTRIES */ {MAP_CHAR_LEN("IsNumberEntries")},
+/* 0527 IS_SORT_BY_POSITION */ {MAP_CHAR_LEN("IsSortByPosition")},
+/* 0528 SORT_KEYS */ {MAP_CHAR_LEN("SortKeys")},
+/* 0529 IS_SORT_ASCENDING */ {MAP_CHAR_LEN("IsSortAscending")},
+/* 0530 SORT_KEY */ {MAP_CHAR_LEN("SortKey")},
+/* 0531 FIELDS */ {MAP_CHAR_LEN("Fields")},
+/* 0532 DATE_TIME_VALUE */ {MAP_CHAR_LEN("DateTimeValue")},
+/* 0533 IS_ON */ {MAP_CHAR_LEN("IsOn")},
+/* 0534 Z_ORDER */ {MAP_CHAR_LEN("ZOrder")},
+/* 0535 CONTENT_SECTION */ {MAP_CHAR_LEN("ContentSection")},
+/* 0536 HEADER_SECTION */ {MAP_CHAR_LEN("HeaderSection")},
+/* 0537 PARA_IS_HANGING_PUNCTUATION */ {MAP_CHAR_LEN("ParaIsHangingPunctuation")},
+/* 0538 PARA_IS_CHARACTER_DISTANCE */ {MAP_CHAR_LEN("ParaIsCharacterDistance")},
+/* 0539 PARA_IS_FORBIDDEN_RULES */ {MAP_CHAR_LEN("ParaIsForbiddenRules")},
+/* 0540 PARA_VERT_ALIGNMENT */ {MAP_CHAR_LEN("ParaVertAlignment")},
+/* 0541 IS_MAIN_ENTRY */ {MAP_CHAR_LEN("IsMainEntry")},
+/* 0542 GRAPHIC_ROTATION */ {MAP_CHAR_LEN("GraphicRotation")},
+/* 0543 ADJUST_LUMINANCE */ {MAP_CHAR_LEN("AdjustLuminance")},
+/* 0544 ADJUST_CONTRAST */ {MAP_CHAR_LEN("AdjustContrast")},
+/* 0545 ADJUST_RED */ {MAP_CHAR_LEN("AdjustRed")},
+/* 0546 ADJUST_GREEN */ {MAP_CHAR_LEN("AdjustGreen")},
+/* 0547 ADJUST_BLUE */ {MAP_CHAR_LEN("AdjustBlue")},
+/* 0548 GAMMA */ {MAP_CHAR_LEN("Gamma")},
+/* 0549 GRAPHIC_IS_INVERTED */ {MAP_CHAR_LEN("GraphicIsInverted")},
+/* 0550 TRANSPARENCY */ {MAP_CHAR_LEN("Transparency")},
+/* 0551 GRAPHIC_COLOR_MODE */ {MAP_CHAR_LEN("GraphicColorMode")},
+/* 0552 REDLINE_AUTHOR */ {MAP_CHAR_LEN("RedlineAuthor")},
+/* 0553 REDLINE_DATE_TIME */ {MAP_CHAR_LEN("RedlineDateTime")},
+/* 0554 REDLINE_COMMENT */ {MAP_CHAR_LEN("RedlineComment")},
+/* 0555 REDLINE_TYPE */ {MAP_CHAR_LEN("RedlineType")},
+/* 0556 REDLINE_SUCCESSOR_DATA */ {MAP_CHAR_LEN("RedlineSuccessorData")},
+/* 0557 REDLINE_IDENTIFIER */ {MAP_CHAR_LEN("RedlineIdentifier")},
+/* 0558 IS_IN_HEADER_FOOTER */ {MAP_CHAR_LEN("IsInHeaderFooter")},
+/* 0559 START_REDLINE */ {MAP_CHAR_LEN("StartRedline")},
+/* 0560 END_REDLINE */ {MAP_CHAR_LEN("EndRedline")},
+/* 0561 REDLINE_START */ {MAP_CHAR_LEN("RedlineStart")},
+/* 0562 REDLINE_END */ {MAP_CHAR_LEN("RedlineEnd")},
+/* 0563 REDLINE_TEXT */ {MAP_CHAR_LEN("RedlineText")},
+/* 0564 REDLINE_DISPLAY_TYPE */ {MAP_CHAR_LEN("RedlineDisplayType")},
+/* 0565 FORBIDDEN_CHARACTERS */ {MAP_CHAR_LEN("ForbiddenCharacters")},
+/* 0566 RUBY_BASE_TEXT */ {MAP_CHAR_LEN("RubyBaseText")},
+/* 0567 RUBY_TEXT */ {MAP_CHAR_LEN("RubyText")},
+/* 0568 RUBY_ADJUST */ {MAP_CHAR_LEN("RubyAdjust")},
+/* 0569 RUBY_CHAR_STYLE_NAME */ {MAP_CHAR_LEN("RubyCharStyleName")},
+/* 0570 RUBY_IS_ABOVE */ {MAP_CHAR_LEN("RubyIsAbove")},
+/* 0571 FOOTNOTE_HEIGHT */ {MAP_CHAR_LEN("FootnoteHeight")},
+/* 0572 FOOTNOTE_LINE_WEIGHT */ {MAP_CHAR_LEN("FootnoteLineWeight")},
+/* 0573 FOOTNOTE_LINE_COLOR */ {MAP_CHAR_LEN("FootnoteLineColor")},
+/* 0574 FOOTNOTE_LINE_RELATIVE_WIDTH */ {MAP_CHAR_LEN("FootnoteLineRelativeWidth")},
+/* 0575 FOOTNOTE_LINE_ADJUST */ {MAP_CHAR_LEN("FootnoteLineAdjust")},
+/* 0576 FOOTNOTE_LINE_TEXT_DISTANCE */ {MAP_CHAR_LEN("FootnoteLineTextDistance")},
+/* 0577 FOOTNOTE_LINE_DISTANCE */ {MAP_CHAR_LEN("FootnoteLineDistance")},
+/* 0578 CHAR_ROTATION */ {MAP_CHAR_LEN("CharRotation")},
+/* 0579 CHAR_ROTATION_IS_FIT_TO_LINE */ {MAP_CHAR_LEN("CharRotationIsFitToLine")},
+/* 0580 CHAR_SCALE_WIDTH */ {MAP_CHAR_LEN("CharScaleWidth")},
+/* 0581 TAB_STOP_DISTANCE */ {MAP_CHAR_LEN("TabStopDistance")},
+/* 0582 IS_WIDTH_RELATIVE */ {MAP_CHAR_LEN("IsWidthRelative")},
+/* 0583 CHAR_RELIEF */ {MAP_CHAR_LEN("CharRelief")},
+/* 0584 IS_HIDDEN */ {MAP_CHAR_LEN("IsHidden")},
+/* 0585 IS_CONDITION_TRUE */ {MAP_CHAR_LEN("IsConditionTrue")},
+/* 0586 TWO_DIGIT_YEAR */ {MAP_CHAR_LEN("TwoDigitYear")},
+/* 0587 PROTECTION_KEY */ {MAP_CHAR_LEN("ProtectionKey")},
+/* 0588 REDLINE_PROTECTION_KEY */ {MAP_CHAR_LEN("RedlineProtectionKey")},
+/* 0589 AUTOMATIC_DISTANCE */ {MAP_CHAR_LEN("AutomaticDistance")},
+/* 0590 AUTOMATIC_CONTROL_FOCUS */ {MAP_CHAR_LEN("AutomaticControlFocus")},
+/* 0591 APPLY_FORM_DESIGN_MODE */ {MAP_CHAR_LEN("ApplyFormDesignMode")},
+/* 0592 LOCALE */ {MAP_CHAR_LEN("Locale")},
+/* 0593 SORT_ALGORITHM */ {MAP_CHAR_LEN("SortAlgorithm")},
+/* 0594 FRAME_HEIGHT_ABSOLUTE */ {MAP_CHAR_LEN("FrameHeightAbsolute")},
+/* 0596 FRAME_HEIGHT_PERCENT */ {MAP_CHAR_LEN("FrameHeightPercent")},
+/* 0597 FRAME_ISAUTOMATIC_HEIGHT */ {MAP_CHAR_LEN("FrameIsAutomaticHeight")},
+/* 0598 FRAME_WIDTH_ABSOLUTE */ {MAP_CHAR_LEN("FrameWidthAbsolute")},
+/* 0599 FRAME_WIDTH_PERCENT */ {MAP_CHAR_LEN("FrameWidthPercent")},
+/* 0600 PARA_STYLEHEADING */ {MAP_CHAR_LEN("ParaStyleHeading")},
+/* 0601 PARA_STYLELEVEL1 */ {MAP_CHAR_LEN("ParaStyleLevel1")},
+/* 0602 PARA_STYLELEVEL10 */ {MAP_CHAR_LEN("ParaStyleLevel10")},
+/* 0603 PARA_STYLELEVEL2 */ {MAP_CHAR_LEN("ParaStyleLevel2")},
+/* 0604 PARA_STYLELEVEL3 */ {MAP_CHAR_LEN("ParaStyleLevel3")},
+/* 0605 PARA_STYLELEVEL4 */ {MAP_CHAR_LEN("ParaStyleLevel4")},
+/* 0606 PARA_STYLELEVEL5 */ {MAP_CHAR_LEN("ParaStyleLevel5")},
+/* 0607 PARA_STYLELEVEL6 */ {MAP_CHAR_LEN("ParaStyleLevel6")},
+/* 0608 PARA_STYLELEVEL7 */ {MAP_CHAR_LEN("ParaStyleLevel7")},
+/* 0609 PARA_STYLELEVEL8 */ {MAP_CHAR_LEN("ParaStyleLevel8")},
+/* 0610 PARA_STYLELEVEL9 */ {MAP_CHAR_LEN("ParaStyleLevel9")},
+/* 0611 PARA_STYLESEPARATOR */ {MAP_CHAR_LEN("ParaStyleSeparator")},
+/* 0612 MACRO_LIBRARY */ {MAP_CHAR_LEN("MacroLibrary")},
+/* 0613 CELL_NAME */ {MAP_CHAR_LEN("CellName")},
+/* 0614 PARA_USER_DEFINED_ATTRIBUTES */ {MAP_CHAR_LEN("ParaUserDefinedAttributes")},
+/* 0615 UNO_NAME_MERGE_LAST_PARA */ {MAP_CHAR_LEN("MergeLastPara")},
+/* 0616 UNO_NAME_WRITING_MODE */ {MAP_CHAR_LEN("WritingMode")},
+/* 0617 UNO_NAME_GRID_COLOR */ {MAP_CHAR_LEN("GridColor")},
+/* 0618 UNO_NAME_GRID_LINES */ {MAP_CHAR_LEN("GridLines")},
+/* 0619 UNO_NAME_GRID_BASE_HEIGHT */ {MAP_CHAR_LEN("GridBaseHeight")},
+/* 0620 UNO_NAME_GRID_RUBY_HEIGHT */ {MAP_CHAR_LEN("GridRubyHeight")},
+/* 0621 UNO_NAME_GRID_MODE */ {MAP_CHAR_LEN("GridMode")},
+/* 0622 UNO_NAME_GRID_RUBY_BELOW */ {MAP_CHAR_LEN("RubyBelow")},
+/* 0623 UNO_NAME_GRID_PRINT */ {MAP_CHAR_LEN("GridPrint")},
+/* 0624 UNO_NAME_GRID_DISPLAY */ {MAP_CHAR_LEN("GridDisplay")},
+/* 0625 UNO_NAME_SNAP_TO_GRID */ {MAP_CHAR_LEN("SnapToGrid")},
+/* 0626 UNO_NAME_DONT_BALANCE_TEXT_COLUMNS */{MAP_CHAR_LEN("DontBalanceTextColumns")},
+/* 0627 UNO_NAME_IS_CURRENTLY_VISIBLE */{MAP_CHAR_LEN("IsCurrentlyVisible")},
+/* 0628 UNO_NAME_ANCHOR_POSITION */ {MAP_CHAR_LEN("AnchorPosition")},
+/* 0629 UNO_NAME_TEXT_READING */ {MAP_CHAR_LEN("TextReading")},
+/* 0630 UNO_NAME_PRIMARY_KEY_READING */ {MAP_CHAR_LEN("PrimaryKeyReading")},
+/* 0631 UNO_NAME_SECONDARY_KEY_READING */ {MAP_CHAR_LEN("SecondaryKeyReading")},
+/* 0632 UNO_NAME_BACK_GRAPHIC_TRANSPARENCY*/ {MAP_CHAR_LEN("BackGraphicTransparency")},
+/* 0633 UNO_NAME_BACK_COLOR_R_G_B */ {MAP_CHAR_LEN("BackColorRGB")},
+/* 0634 UNO_NAME_BACK_COLOR_TRANSPARENCY */ {MAP_CHAR_LEN("BackColorTransparency")},
+/* 0635 UNO_NAME_HEADER_DYNAMIC_SPACING */ {MAP_CHAR_LEN("HeaderDynamicSpacing")},
+/* 0636 UNO_NAME_FOOTER_DYNAMIC_SPACING */ {MAP_CHAR_LEN("FooterDynamicSpacing")},
+/* 0637 UNO_NAME_BASIC_LIBRARIES */ {MAP_CHAR_LEN("BasicLibraries")},
+/* 0638 UNO_NAME_IS_FIXED_LANGUAGE */ {MAP_CHAR_LEN("IsFixedLanguage")},
+/* 0639 UNO_NAME_SELECTION */ {MAP_CHAR_LEN("Selection")},
+/* 0640 UNO_NAME_RESULT_SET */ {MAP_CHAR_LEN("ResultSet")},
+/* 0641 UNO_NAME_CONNECTION */ {MAP_CHAR_LEN("ActiveConnection")},
+/* 0642 UNO_NAME_MODEL */ {MAP_CHAR_LEN("Model")},
+/* 0643 UNO_NAME_DATA_SOURCE_NAME */ {MAP_CHAR_LEN("DataSourceName")},
+/* 0644 UNO_NAME_DATA_COMMAND */ {MAP_CHAR_LEN("DataCommand")},
+/* 0645 UNO_NAME_FILTER */ {MAP_CHAR_LEN("Filter")},
+/* 0646 UNO_NAME_DOCUMENT_URL */ {MAP_CHAR_LEN("DocumentURL")},
+/* 0647 UNO_NAME_OUTPUT_URL */ {MAP_CHAR_LEN("OutputURL")},
+/* 0648 UNO_NAME_OUTPUT_TYPE */ {MAP_CHAR_LEN("OutputType")},
+/* 0649 UNO_NAME_ESCAPE_PROCESSING */ {MAP_CHAR_LEN("EscapeProcessing")},
+/* 0650 UNO_NAME_SINGLE_PRINT_JOBS */ {MAP_CHAR_LEN("SinglePrintJobs")},
+/* 0651 UNO_NAME_FILE_NAME_FROM_COLUMN */ {MAP_CHAR_LEN("FileNameFromColumn")},
+/* 0652 UNO_NAME_FILE_NAME_PREFIX */ {MAP_CHAR_LEN("FileNamePrefix")},
+/* 0653 UNO_NAME_CHAR_STYLE_NAMES */ {MAP_CHAR_LEN("CharStyleNames")},
+/* 0654 UNO_NAME_DAD_COMMAND */ {MAP_CHAR_LEN("Command")},
+/* 0655 UNO_NAME_DAD_COMMAND_TYPE */ {MAP_CHAR_LEN("CommandType")},
+/* 0655 UNO_NAME_CLSID*/ {MAP_CHAR_LEN("CLSID")},
+/* 0657 UNO_NAME_COMPONENT*/ {MAP_CHAR_LEN("Component")},
+/* 0658 UNO_NAME_SECT_LEFT_MARGIN*/ {MAP_CHAR_LEN("SectionLeftMargin")},
+/* 0659 UNO_NAME_SECT_RIGHT_MARGIN*/ {MAP_CHAR_LEN("SectionRightMargin")},
+/* 0660 UNO_NAME_PARA_IS_CONNECT_BORDER */{MAP_CHAR_LEN("ParaIsConnectBorder")},
+/* 0661 UNO_NAME_ITEMS*/ {MAP_CHAR_LEN("Items")},
+/* 0662 UNO_NAME_SELITEM*/ {MAP_CHAR_LEN("SelectedItem")}
+};
+
+#ifdef DBG_UTIL
+const SwPropNameLen& GetPropName( USHORT nId )
+{
+ DBG_ASSERT( SW_PROPNAME_BEGIN <= nId && nId < SW_PROPNAME_END,
+ "GetPropName(): Wrong index" );
+ return aPropNameTab[ nId - SW_PROPNAME_BEGIN];
+}
+#endif
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoredline.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoredline.cxx
new file mode 100644
index 000000000000..61c6d473669a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoredline.cxx
@@ -0,0 +1,694 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <pagedesc.hxx>
+#include "poolfmt.hxx"
+#include <redline.hxx>
+#include <section.hxx>
+#include <unoprnms.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unocoll.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+#include <unoobj.hxx>
+#include <unoredline.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <rtl/uuid.h>
+
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+SwXRedlineText::SwXRedlineText(SwDoc* pDoc, SwNodeIndex aIndex) :
+ SwXText(pDoc, CURSOR_REDLINE),
+ aNodeIndex(aIndex)
+{
+}
+
+const SwStartNode* SwXRedlineText::GetStartNode() const
+{
+ return aNodeIndex.GetNode().GetStartNode();
+}
+
+Any SwXRedlineText::queryInterface( const Type& rType )
+ throw(RuntimeException)
+{
+ Any aRet;
+
+ if (::getCppuType((Reference<XEnumerationAccess> *)0) == rType)
+ {
+ Reference<XEnumerationAccess> aAccess = this;
+ aRet <<= aAccess;
+ }
+ else
+ {
+ // delegate to SwXText and OWeakObject
+ aRet = SwXText::queryInterface(rType);
+ if(!aRet.hasValue())
+ {
+ aRet = OWeakObject::queryInterface(rType);
+ }
+ }
+
+ return aRet;
+}
+
+Sequence<Type> SwXRedlineText::getTypes()
+ throw(RuntimeException)
+{
+ // SwXText::getTypes()
+ uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
+
+ // add XEnumerationAccess
+ sal_Int32 nLength = aTypes.getLength();
+ aTypes.realloc(nLength + 1);
+ aTypes[nLength] = ::getCppuType((Reference<XEnumerationAccess> *)0);
+
+ return aTypes;
+}
+
+Sequence<sal_Int8> SwXRedlineText::getImplementationId()
+ throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+Reference<XTextCursor> SwXRedlineText::createTextCursor(void)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ SwPosition aPos(aNodeIndex);
+ SwXTextCursor* pCrsr = new SwXTextCursor(this, aPos, CURSOR_REDLINE,
+ GetDoc());
+ SwUnoCrsr* pUnoCursor = pCrsr->GetCrsr();
+ pUnoCursor->Move(fnMoveForward, fnGoNode);
+
+ // #101929# prevent a newly created text cursor from running inside a table
+ // because table cells have their own XText.
+ // Patterned after SwXTextFrame::createTextCursor(void).
+
+ // skip all tables at the beginning
+ SwTableNode* pTableNode = pUnoCursor->GetNode()->FindTableNode();
+ SwCntntNode* pContentNode = NULL;
+ while( pTableNode != NULL )
+ {
+ pUnoCursor->GetPoint()->nNode = *(pTableNode->EndOfSectionNode());
+ pContentNode = GetDoc()->GetNodes().GoNext(&pUnoCursor->GetPoint()->nNode);
+ pTableNode = pContentNode->FindTableNode();
+ }
+ if( pContentNode != NULL )
+ pUnoCursor->GetPoint()->nContent.Assign( pContentNode, 0 );
+ if( pUnoCursor->GetNode()->FindSttNodeByType( SwNormalStartNode ) !=
+ GetStartNode() )
+ {
+ // We have gone too far and have left our own redline. This means that
+ // no content node outside of a table could be found, and therefore we
+ // except.
+ uno::RuntimeException aExcept;
+ aExcept.Message = OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "No content node found that is inside this change section "
+ "but outside of a table" ) );
+ throw aExcept;
+ }
+
+ return (XWordCursor*)pCrsr;
+}
+
+Reference<XTextCursor> SwXRedlineText::createTextCursorByRange(
+ const Reference<XTextRange> & aTextRange)
+ throw( RuntimeException )
+{
+ Reference<XTextCursor> xCursor = createTextCursor();
+ xCursor->gotoRange(aTextRange->getStart(), sal_False);
+ xCursor->gotoRange(aTextRange->getEnd(), sal_True);
+ return xCursor;
+}
+
+Reference<XEnumeration> SwXRedlineText::createEnumeration(void)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwPaM aPam(aNodeIndex);
+ aPam.Move(fnMoveForward, fnGoNode);
+ return new SwXParagraphEnumeration(this, *aPam.Start(), CURSOR_REDLINE);
+}
+
+uno::Type SwXRedlineText::getElementType( ) throw(RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+
+sal_Bool SwXRedlineText::hasElements( ) throw(RuntimeException)
+{
+ return sal_True; // we always have a content index
+}
+
+SwXRedlinePortion::SwXRedlinePortion( const SwRedline* pRed,
+ const SwUnoCrsr* pPortionCrsr,
+ Reference< XText > xParent, BOOL bStart) :
+ SwXTextPortion(pPortionCrsr, xParent, bStart ? PORTION_REDLINE_START : PORTION_REDLINE_END),
+ pRedline(pRed)
+{
+ SetCollapsed(!pRedline->HasMark());
+}
+
+SwXRedlinePortion::~SwXRedlinePortion()
+{
+}
+
+util::DateTime lcl_DateTimeToUno(const DateTime& rDT)
+{
+ util::DateTime aRetDT;
+ aRetDT.Year = rDT.GetYear();
+ aRetDT.Month= rDT.GetMonth();
+ aRetDT.Day = rDT.GetDay();
+ aRetDT.Hours = rDT.GetHour();
+ aRetDT.Minutes = rDT.GetMin();
+ aRetDT.Seconds = rDT.GetSec();
+ aRetDT.HundredthSeconds = rDT.Get100Sec();
+ return aRetDT;
+}
+
+OUString lcl_RedlineTypeToOUString(SwRedlineType eType)
+{
+ OUString sRet;
+ switch(eType & REDLINE_NO_FLAG_MASK)
+ {
+ case REDLINE_INSERT: sRet = C2U("Insert"); break;
+ case REDLINE_DELETE: sRet = C2U("Delete"); break;
+ case REDLINE_FORMAT: sRet = C2U("Format"); break;
+ case REDLINE_TABLE: sRet = C2U("TextTable"); break;
+ case REDLINE_FMTCOLL:sRet = C2U("Style"); break;
+ }
+ return sRet;
+}
+
+Sequence<PropertyValue> lcl_GetSuccessorProperties(const SwRedline& rRedline)
+{
+ Sequence<PropertyValue> aValues(4);
+
+ const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
+ if(pNext)
+ {
+ PropertyValue* pValues = aValues.getArray();
+ pValues[0].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_AUTHOR));
+ // GetAuthorString(n) walks the SwRedlineData* chain;
+ // here we always need element 1
+ pValues[0].Value <<= OUString(rRedline.GetAuthorString(1));
+ pValues[1].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_DATE_TIME));
+ pValues[1].Value <<= lcl_DateTimeToUno(pNext->GetTimeStamp());
+ pValues[2].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_COMMENT));
+ pValues[2].Value <<= OUString(pNext->GetComment());
+ pValues[3].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TYPE));
+ pValues[3].Value <<= lcl_RedlineTypeToOUString(pNext->GetType());
+ }
+ return aValues;
+}
+
+Any SwXRedlinePortion::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Validate();
+ Any aRet;
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TEXT)))
+ {
+ SwNodeIndex* pNodeIdx = pRedline->GetContentIdx();
+ if(pNodeIdx )
+ {
+ if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
+ {
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ Reference<XText> xRet = new SwXRedlineText(pUnoCrsr->GetDoc(), *pNodeIdx);
+ aRet <<= xRet;
+ }
+ else
+ DBG_ASSERT(0, "Empty section in redline portion! (end node immediately follows start node)");
+ }
+ }
+ else
+ {
+ aRet = GetPropertyValue( rPropertyName, *pRedline);
+ if(!aRet.hasValue() &&
+ ! rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
+ aRet = SwXTextPortion::getPropertyValue(rPropertyName);
+ }
+ return aRet;
+}
+
+void SwXRedlinePortion::Validate() throw( RuntimeException )
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(!pUnoCrsr)
+ throw uno::RuntimeException();
+ //search for the redline
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
+ sal_Bool bFound = FALSE;
+ for(USHORT nRed = 0; nRed < rRedTbl.Count() && !bFound; nRed++)
+ bFound = pRedline == rRedTbl[nRed];
+ if(!bFound)
+ throw RuntimeException();
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwXRedlinePortion::getImplementationId( ) throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+Any SwXRedlinePortion::GetPropertyValue( const OUString& rPropertyName, const SwRedline& rRedline ) throw()
+{
+ Any aRet;
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_AUTHOR)))
+ aRet <<= OUString(rRedline.GetAuthorString());
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_DATE_TIME)))
+ {
+ aRet <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_COMMENT)))
+ aRet <<= OUString(rRedline.GetComment());
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TYPE)))
+ {
+ aRet <<= lcl_RedlineTypeToOUString(rRedline.GetType());
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
+ {
+ if(rRedline.GetRedlineData().Next())
+ aRet <<= lcl_GetSuccessorProperties(rRedline);
+ }
+ else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_IDENTIFIER)))
+ {
+ OUStringBuffer sBuf;
+ sBuf.append((sal_Int64)&rRedline);
+ aRet <<= sBuf.makeStringAndClear();
+ }
+ else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_IS_IN_HEADER_FOOTER)))
+ {
+ sal_Bool bRet =
+ rRedline.GetDoc()->IsInHeaderFooter( rRedline.GetPoint()->nNode );
+ aRet.setValue(&bRet, ::getBooleanCppuType());
+ }
+ else if (rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_MERGE_LAST_PARA)))
+ {
+ sal_Bool bRet = !rRedline.IsDelLastPara();
+ aRet.setValue( &bRet, ::getBooleanCppuType() );
+ }
+ return aRet;
+}
+
+Sequence< PropertyValue > SwXRedlinePortion::CreateRedlineProperties(
+ const SwRedline& rRedline, sal_Bool bIsStart ) throw()
+{
+ Sequence< PropertyValue > aRet(11);
+ const SwRedlineData* pNext = rRedline.GetRedlineData().Next();
+ PropertyValue* pRet = aRet.getArray();
+
+ OUStringBuffer sRedlineIdBuf;
+ sRedlineIdBuf.append((sal_Int64)&rRedline);
+
+ sal_Int32 nPropIdx = 0;
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_AUTHOR));
+ pRet[nPropIdx++].Value <<= OUString(rRedline.GetAuthorString());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_DATE_TIME));
+ pRet[nPropIdx++].Value <<= lcl_DateTimeToUno(rRedline.GetTimeStamp());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_COMMENT));
+ pRet[nPropIdx++].Value <<= OUString(rRedline.GetComment());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TYPE));
+ pRet[nPropIdx++].Value <<= lcl_RedlineTypeToOUString(rRedline.GetType());
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_IDENTIFIER));
+ pRet[nPropIdx++].Value <<= sRedlineIdBuf.makeStringAndClear();
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_IS_COLLAPSED));
+ sal_Bool bTmp = !rRedline.HasMark();
+ pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
+
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_IS_START));
+ pRet[nPropIdx++].Value.setValue(&bIsStart, ::getBooleanCppuType()) ;
+
+ bTmp = !rRedline.IsDelLastPara();
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_MERGE_LAST_PARA));
+ pRet[nPropIdx++].Value.setValue(&bTmp, ::getBooleanCppuType()) ;
+
+ SwNodeIndex* pNodeIdx = rRedline.GetContentIdx();
+ if(pNodeIdx )
+ {
+ if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
+ {
+ Reference<XText> xRet = new SwXRedlineText(rRedline.GetDoc(), *pNodeIdx);
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_TEXT));
+ pRet[nPropIdx++].Value <<= xRet;
+ }
+ else
+ DBG_ASSERT(0, "Empty section in redline portion! (end node immediately follows start node)");
+ }
+ if(pNext)
+ {
+ pRet[nPropIdx].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_REDLINE_SUCCESSOR_DATA));
+ pRet[nPropIdx++].Value <<= lcl_GetSuccessorProperties(rRedline);
+ }
+ aRet.realloc(nPropIdx);
+ return aRet;
+}
+
+TYPEINIT1(SwXRedline, SwClient);
+SwXRedline::SwXRedline(SwRedline& rRedline, SwDoc& rDoc) :
+ pDoc(&rDoc),
+ SwXText(&rDoc, CURSOR_REDLINE),
+ pRedline(&rRedline)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+
+SwXRedline::~SwXRedline()
+{
+}
+
+Reference< XPropertySetInfo > SwXRedline::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef =
+ SfxItemPropertySet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_REDLINE)).getPropertySetInfo();
+ return xRef;
+}
+
+void SwXRedline::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw RuntimeException();
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_AUTHOR)))
+ {
+ DBG_ERROR("currently not available");
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_DATE_TIME)))
+ {
+ DBG_ERROR("currently not available");
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_COMMENT)))
+ {
+ OUString sTmp; aValue >>= sTmp;
+ pRedline->SetComment(sTmp);
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TYPE)))
+ {
+ DBG_ERROR("currently not available");
+ OUString sTmp; aValue >>= sTmp;
+ if(!sTmp.getLength())
+ throw IllegalArgumentException();
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_SUCCESSOR_DATA)))
+ {
+ DBG_ERROR("currently not available");
+ }
+ else
+ {
+ throw IllegalArgumentException();
+ }
+}
+
+Any SwXRedline::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw RuntimeException();
+ Any aRet;
+ BOOL bStart = rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_START));
+ if(bStart ||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_END)))
+ {
+ Reference<XInterface> xRet;
+ SwNode* pNode = pRedline->GetNode();
+ if(!bStart && pRedline->HasMark())
+ pNode = pRedline->GetNode(FALSE);
+ switch(pNode->GetNodeType())
+ {
+ case ND_SECTIONNODE:
+ {
+ SwSectionNode* pSectNode = pNode->GetSectionNode();
+ DBG_ASSERT(pSectNode, "No section node!");
+ xRet = SwXTextSections::GetObject( *pSectNode->GetSection().GetFmt() );
+ }
+ break;
+ case ND_TABLENODE :
+ {
+ SwTableNode* pTblNode = pNode->GetTableNode();
+ DBG_ASSERT(pTblNode, "No table node!");
+ SwTable& rTbl = pTblNode->GetTable();
+ SwFrmFmt* pTblFmt = rTbl.GetFrmFmt();
+ xRet = SwXTextTables::GetObject( *pTblFmt );
+ }
+ break;
+ case ND_TEXTNODE :
+ {
+ SwPosition* pPoint = 0;
+ if(bStart || !pRedline->HasMark())
+ pPoint = pRedline->GetPoint();
+ else
+ pPoint = pRedline->GetMark();
+ SwPaM aTmp(*pPoint);
+ Reference<XText> xTmpParent;
+ Reference<XTextRange>xRange =
+ SwXTextRange::CreateTextRangeFromPosition( pDoc, *pPoint, 0 );
+ xRet = xRange.get();
+ }
+ break;
+ default:
+ DBG_ERROR("illegal node type");
+ }
+ aRet <<= xRet;
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_REDLINE_TEXT)))
+ {
+ SwNodeIndex* pNodeIdx = pRedline->GetContentIdx();
+ if( pNodeIdx )
+ {
+ if ( 1 < ( pNodeIdx->GetNode().EndOfSectionIndex() - pNodeIdx->GetNode().GetIndex() ) )
+ {
+ Reference<XText> xRet = new SwXRedlineText(pDoc, *pNodeIdx);
+ aRet <<= xRet;
+ }
+ else
+ DBG_ASSERT(0, "Empty section in redline portion! (end node immediately follows start node)");
+ }
+ }
+ else
+ aRet = SwXRedlinePortion::GetPropertyValue(rPropertyName, *pRedline);
+ return aRet;
+}
+
+void SwXRedline::addPropertyChangeListener(
+ const OUString& aPropertyName,
+ const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXRedline::removePropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXRedline::addVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXRedline::removeVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXRedline::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ pDoc = 0;
+ pRedline = 0;
+ }
+}
+
+Reference< XEnumeration > SwXRedline::createEnumeration(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Reference< XEnumeration > xRet;
+ if(!pDoc)
+ throw RuntimeException();
+
+ SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
+ if(pNodeIndex)
+ {
+ SwPaM aPam(*pNodeIndex);
+ aPam.Move(fnMoveForward, fnGoNode);
+ xRet = new SwXParagraphEnumeration(this, *aPam.Start(), CURSOR_REDLINE);
+ }
+ return xRet;
+}
+
+uno::Type SwXRedline::getElementType( ) throw(RuntimeException)
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+
+sal_Bool SwXRedline::hasElements( ) throw(RuntimeException)
+{
+ if(!pDoc)
+ throw RuntimeException();
+ return 0 != pRedline->GetContentIdx();
+}
+
+Reference< XTextCursor > SwXRedline::createTextCursor(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!pDoc)
+ throw RuntimeException();
+
+ uno::Reference< XTextCursor > xRet;
+ SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
+ if(pNodeIndex)
+ {
+ SwPosition aPos(*pNodeIndex);
+ SwXTextCursor* pCrsr = new SwXTextCursor(this, aPos, CURSOR_REDLINE, pDoc);
+ SwUnoCrsr* pUnoCrsr = pCrsr->GetCrsr();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+
+ //steht hier eine Tabelle?
+ SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while( pTblNode )
+ {
+ pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if(pCont)
+ pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
+ xRet = (XWordCursor*)pCrsr;
+ }
+ else
+ {
+ throw RuntimeException();
+ }
+ return xRet;
+}
+
+Reference< XTextCursor > SwXRedline::createTextCursorByRange(
+ const Reference< XTextRange > & aTextPosition)
+ throw( RuntimeException )
+{
+ throw RuntimeException();
+ return Reference< XTextCursor > ();
+}
+
+Any SwXRedline::queryInterface( const uno::Type& rType )
+ throw(RuntimeException)
+{
+ Any aRet = SwXText::queryInterface(rType);
+ if(!aRet.hasValue())
+ {
+ aRet = SwXRedlineBaseClass::queryInterface(rType);
+ }
+ return aRet;
+}
+
+Sequence<Type> SwXRedline::getTypes()
+ throw(RuntimeException)
+{
+ uno::Sequence<uno::Type> aTypes = SwXText::getTypes();
+ uno::Sequence<uno::Type> aBaseTypes = SwXRedlineBaseClass::getTypes();
+ const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
+ sal_Int32 nCurType = aTypes.getLength();
+ aTypes.realloc(aTypes.getLength() + aBaseTypes.getLength());
+ uno::Type* pTypes = aTypes.getArray();
+ for(sal_Int32 nType = 0; nType < aBaseTypes.getLength(); nType++)
+ pTypes[nCurType++] = pBaseTypes[nType];
+ return aTypes;
+}
+
+Sequence<sal_Int8> SwXRedline::getImplementationId()
+ throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unoredlines.cxx b/binfilter/bf_sw/source/core/unocore/sw_unoredlines.cxx
new file mode 100644
index 000000000000..5c7ed0203c21
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unoredlines.cxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include "calbck.hxx"
+
+#include <unoredlines.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoredline.hxx>
+#include <tools/debug.hxx>
+#include <pagedesc.hxx>
+#include "poolfmt.hxx"
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <redline.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+
+/*-- 11.01.01 15:28:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlines::SwXRedlines(SwDoc* pDoc) :
+ SwUnoCollection(pDoc)
+{
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlines::~SwXRedlines()
+{
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXRedlines::getCount( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ return rRedTbl.Count();
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXRedlines::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ Any aRet;
+ if(rRedTbl.Count() > nIndex && nIndex >= 0)
+ {
+ Reference <XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl.GetObject((USHORT)nIndex), *GetDoc() );
+ aRet <<= xRet;
+ }
+ else
+ throw IndexOutOfBoundsException();
+ return aRet;
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XEnumeration > SwXRedlines::createEnumeration(void)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ return Reference< XEnumeration >(new SwXRedlineEnumeration(*GetDoc()));
+}
+/*-- 11.01.01 15:28:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Type SwXRedlines::getElementType( ) throw(RuntimeException)
+{
+ return ::getCppuType((Reference<XPropertySet>*)0);
+}
+/*-- 11.01.01 15:28:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXRedlines::hasElements( ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ return rRedTbl.Count() > 0;
+}
+/*-- 11.01.01 15:28:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXRedlines::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXRedlines");
+}
+/*-- 11.01.01 15:28:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwXRedlines::supportsService(const ::rtl::OUString& ServiceName)
+ throw( RuntimeException )
+{
+ DBG_ERROR("not implemented");
+ return FALSE;
+}
+/*-- 11.01.01 15:28:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXRedlines::getSupportedServiceNames(void)
+ throw( RuntimeException )
+{
+ DBG_ERROR("not implemented");
+ return Sequence< OUString >();
+}
+/*-- 11.01.01 15:28:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+XPropertySet* SwXRedlines::GetObject( SwRedline& rRedline, SwDoc& rDoc )
+{
+ SwPageDesc* pStdDesc = rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD);
+ SwClientIter aIter(*pStdDesc);
+ SwXRedline* pxRedline = (SwXRedline*)aIter.First( TYPE( SwXRedline ));
+ while(pxRedline)
+ {
+ if(pxRedline->GetRedline() == &rRedline)
+ break;
+ pxRedline = (SwXRedline*)aIter.Next();
+ }
+ if( !pxRedline )
+ pxRedline = new SwXRedline(rRedline, rDoc);
+ return pxRedline;
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlineEnumeration::SwXRedlineEnumeration(SwDoc& rDoc) :
+ pDoc(&rDoc),
+ nCurrentIndex(0)
+{
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXRedlineEnumeration::~SwXRedlineEnumeration()
+{
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwXRedlineEnumeration::hasMoreElements(void) throw( RuntimeException )
+{
+ if(!pDoc)
+ throw RuntimeException();
+ return pDoc->GetRedlineTbl().Count() > nCurrentIndex;
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXRedlineEnumeration::nextElement(void)
+ throw( NoSuchElementException, WrappedTargetException, RuntimeException )
+{
+ if(!pDoc)
+ throw RuntimeException();
+ const SwRedlineTbl& rRedTbl = pDoc->GetRedlineTbl();
+ if(!(rRedTbl.Count() > nCurrentIndex))
+ throw NoSuchElementException();
+ Reference <XPropertySet> xRet = SwXRedlines::GetObject( *rRedTbl.GetObject(nCurrentIndex++), *pDoc );
+ Any aRet;
+ aRet <<= xRet;
+ return aRet;
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+rtl::OUString SwXRedlineEnumeration::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXRedlineEnumeration");
+}
+/*-- 12.01.01 15:06:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwXRedlineEnumeration::supportsService(const ::rtl::OUString& ServiceName) throw( RuntimeException )
+{
+ return FALSE;
+}
+/*-- 12.01.01 15:06:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXRedlineEnumeration::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ return Sequence< OUString >();
+}
+/*-- 12.01.01 15:06:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXRedlineEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ pDoc = 0;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unorefmk.cxx b/binfilter/bf_sw/source/core/unocore/sw_unorefmk.cxx
new file mode 100644
index 000000000000..341b50fd7e7a
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unorefmk.cxx
@@ -0,0 +1,381 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <ndtxt.hxx>
+#include <fmtrfmrk.hxx>
+#include <txtrfmrk.hxx>
+#include <hints.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+
+/******************************************************************
+ * SwXReferenceMark
+ ******************************************************************/
+const uno::Sequence< sal_Int8 > & SwXReferenceMark::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXReferenceMark::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+OUString SwXReferenceMark::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXReferenceMark");
+}
+
+BOOL SwXReferenceMark::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return !rServiceName.compareToAscii("com.sun.star.text.ReferenceMark")||
+ !rServiceName.compareToAscii("com.sun.star.text.TextContent");
+}
+
+Sequence< OUString > SwXReferenceMark::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.ReferenceMark");
+ pArray[1] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+TYPEINIT1(SwXReferenceMark, SwClient);
+
+SwXReferenceMark::SwXReferenceMark(SwDoc* pDc, const SwFmtRefMark* pRefMark) :
+ aLstnrCntnr( (text::XTextContent*)this),
+ pDoc(pDc),
+ pMark(pRefMark),
+ m_bIsDescriptor(0 == pRefMark)
+{
+ if(pRefMark)
+ sMarkName = pRefMark->GetRefName();
+ if(pDoc)
+ pDoc->GetUnoCallBack()->Add(this);
+}
+
+SwXReferenceMark::~SwXReferenceMark()
+{
+}
+
+void SwXReferenceMark::InsertRefMark(SwPaM& rPam, SwDoc* pDoc)
+{
+ UnoActionContext aCont(pDoc);
+ SwTxtAttr* pTxtAttr = 0;
+ SwFmtRefMark aRefMark(sMarkName);
+ SfxItemSet aSet(pDoc->GetAttrPool(), RES_TXTATR_REFMARK, RES_TXTATR_REFMARK, 0L);
+ aSet.Put(aRefMark);
+ sal_Bool bMark = *rPam.GetPoint() != *rPam.GetMark();
+ SwXTextCursor::SetCrsrAttr(rPam, aSet, 0);
+
+ if( bMark && *rPam.GetPoint() > *rPam.GetMark())
+ rPam.Exchange();
+
+ if( bMark )
+ pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ rPam.GetPoint()->nContent, RES_TXTATR_REFMARK );
+ else
+ pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttr(
+ rPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_REFMARK );
+
+ if(pTxtAttr)
+ pMark = &pTxtAttr->GetRefMark();
+
+ pDoc->GetUnoCallBack()->Add(this);
+}
+
+void SwXReferenceMark::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ if(!m_bIsDescriptor)
+ throw uno::RuntimeException();
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+ SwDoc* pDocument = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDocument)
+ {
+ SwUnoInternalPaM aPam(*pDocument);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ InsertRefMark(aPam, pDocument);
+ m_bIsDescriptor = sal_False;
+ pDoc = pDocument;
+ pDoc->GetUnoCallBack()->Add(this);
+ }
+ else
+ throw lang::IllegalArgumentException();
+}
+
+void SwXReferenceMark::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+
+uno::Reference< text::XTextRange > SwXReferenceMark::getAnchor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< text::XTextRange > xRet;
+ if(IsValid())
+ {
+ const SwFmtRefMark* pNewMark = pDoc->GetRefMark(sMarkName);
+ if(pNewMark && pNewMark == pMark)
+ {
+ const SwTxtRefMark* pTxtMark = pMark->GetTxtRefMark();
+ if(pTxtMark &&
+ &pTxtMark->GetTxtNode().GetNodes() == &pDoc->GetNodes())
+ {
+ SwTxtNode& rTxtNode = (SwTxtNode&)pTxtMark->GetTxtNode();
+ SwPaM* pPam = pTxtMark->GetEnd() ?
+ new SwPaM( rTxtNode, *pTxtMark->GetEnd(),
+ rTxtNode, *pTxtMark->GetStart()) :
+ new SwPaM( rTxtNode, *pTxtMark->GetStart());
+
+
+ xRet = SwXTextRange::CreateTextRangeFromPosition(pDoc,
+ *pPam->Start(), pPam->End());
+ delete pPam;
+ }
+ }
+ }
+ return xRet;
+}
+
+void SwXReferenceMark::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(IsValid())
+ {
+ const SwFmtRefMark* pNewMark = pDoc->GetRefMark(sMarkName);
+ if(pNewMark && pNewMark == pMark)
+ {
+ const SwTxtRefMark* pTxtMark = pMark->GetTxtRefMark();
+ if(pTxtMark &&
+ &pTxtMark->GetTxtNode().GetNodes() == &pDoc->GetNodes())
+ {
+ SwTxtNode& rTxtNode = (SwTxtNode&)pTxtMark->GetTxtNode();
+ xub_StrLen nStt = *pTxtMark->GetStart(),
+ nEnd = pTxtMark->GetEnd() ? *pTxtMark->GetEnd()
+ : nStt + 1;
+
+ SwPaM aPam( rTxtNode, nStt, rTxtNode, nEnd );
+ pDoc->DeleteAndJoin( aPam );
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+void SwXReferenceMark::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+
+void SwXReferenceMark::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+
+OUString SwXReferenceMark::getName(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid() || !pDoc->GetRefMark(sMarkName))
+ {
+ throw uno::RuntimeException();
+ }
+ return sMarkName;
+}
+
+void SwXReferenceMark::setName(const OUString& Name_) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(m_bIsDescriptor)
+ sMarkName = String(Name_);
+ else
+ {
+ String sNewName(Name_);
+ if(!IsValid() || !pDoc->GetRefMark(sMarkName) || pDoc->GetRefMark(sNewName))
+ {
+ throw uno::RuntimeException();
+ }
+ const SwFmtRefMark* pCurMark = pDoc->GetRefMark(sMarkName);
+ if(sNewName != sMarkName && pCurMark && pCurMark == pMark)
+ {
+ SwDoc* pTempDoc = pDoc;
+ UnoActionContext aCont(pTempDoc);
+ const SwTxtRefMark* pTxtMark = pMark->GetTxtRefMark();
+ if(pTxtMark &&
+ &pTxtMark->GetTxtNode().GetNodes() == &pTempDoc->GetNodes())
+ {
+ SwTxtNode& rTxtNode = (SwTxtNode&)pTxtMark->GetTxtNode();
+ xub_StrLen nStt = *pTxtMark->GetStart(),
+ nEnd = pTxtMark->GetEnd() ? *pTxtMark->GetEnd()
+ : nStt + 1;
+
+ SwPaM aPam( rTxtNode, nStt, rTxtNode, nEnd );
+ pDoc->DeleteAndJoin( aPam );
+
+ sMarkName = sNewName;
+ //create a new one
+ InsertRefMark( aPam, pTempDoc );
+ pDoc = pTempDoc;
+ }
+ }
+ }
+}
+
+void SwXReferenceMark::Invalidate()
+{
+ if(GetRegisteredIn())
+ {
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ aLstnrCntnr.Disposing();
+ pDoc = 0;
+ pMark = 0;
+ }
+}
+
+void SwXReferenceMark::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ switch( pOld ? pOld->Which() : 0 )
+ {
+ case RES_REMOVE_UNO_OBJECT:
+ case RES_OBJECTDYING:
+ if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+ case RES_FMT_CHG:
+ // wurden wir an das neue umgehaengt und wird das alte geloscht?
+ if( ((SwFmtChg*)pNew)->pChangedFmt == GetRegisteredIn() &&
+ ((SwFmtChg*)pOld)->pChangedFmt->IsFmtInDTOR() )
+ Invalidate();
+ break;
+ case RES_REFMARK_DELETED:
+ if( (void*)pMark == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ Invalidate();
+ break;
+ }
+}
+
+Reference< XPropertySetInfo > SwXReferenceMark::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef =
+ SfxItemPropertySet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARAGRAPH_EXTENSIONS)).
+ getPropertySetInfo();
+ return xRef;
+}
+
+void SwXReferenceMark::setPropertyValue(
+ const OUString& aPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ throw IllegalArgumentException();
+}
+
+Any SwXReferenceMark::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ Any aRet;
+ if(!SwXParagraph::getDefaultTextContentValue(aRet, rPropertyName))
+ throw UnknownPropertyException();
+ return aRet;
+}
+
+void SwXReferenceMark::addPropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXReferenceMark::removePropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXReferenceMark::addVetoableChangeListener( const OUString& PropertyName,
+ const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXReferenceMark::removeVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unosect.cxx b/binfilter/bf_sw/source/core/unocore/sw_unosect.cxx
new file mode 100644
index 000000000000..969756930a28
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unosect.cxx
@@ -0,0 +1,1433 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/text/SectionFileLink.hpp>
+
+#include <cmdid.h>
+#include <hintids.hxx>
+#include <bf_svtools/urihelper.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/xmlcnitm.hxx>
+#include <bf_so3/linkmgr.hxx>
+#include <bf_so3/lnkbase.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtclds.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unoredline.hxx>
+#include <redline.hxx>
+#include <unomap.hxx>
+#include <unocrsr.hxx>
+#include <section.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <hints.hxx>
+#include <tox.hxx>
+#include <unoidx.hxx>
+#include <doctxm.hxx>
+#include <fmtftntx.hxx>
+#include <fmtclbl.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <bf_svx/frmdiritem.hxx>
+/* #109700# */
+#include <bf_svx/lrspitem.hxx>
+#include "bf_so3/staticbaseurl.hxx"
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+
+/******************************************************************
+ *
+ ******************************************************************/
+TYPEINIT1(SwXTextSection, SwClient);
+struct SwTextSectionProperties_Impl
+{
+
+ String sCondition;
+ String sLinkFileName;
+ String sSectionFilter;
+ String sSectionRegion;
+ uno::Sequence<sal_Int8> aPassword;
+
+ SwFmtCol* pColItem;
+ SvxBrushItem* pBrushItem;
+ SwFmtFtnAtTxtEnd* pFtnItem;
+ SwFmtEndAtTxtEnd* pEndItem;
+ SvXMLAttrContainerItem *pXMLAttr;
+ SwFmtNoBalancedColumns *pNoBalanceItem;
+ SvxFrameDirectionItem *pFrameDirItem;
+ SvxLRSpaceItem *pLRSpaceItem; // #109700#
+ sal_Bool bDDE;
+ sal_Bool bHidden;
+ sal_Bool bCondHidden;
+ sal_Bool bProtect;
+ sal_Bool bUpdateType;
+
+ SwTextSectionProperties_Impl() :
+ bDDE(0),
+ bHidden(0),
+ bProtect(0),
+ bCondHidden(0),
+ pColItem(0),
+ pBrushItem(0),
+ pFtnItem(0),
+ pEndItem(0),
+ pXMLAttr(0),
+ pNoBalanceItem(0),
+ pFrameDirItem(0),
+ pLRSpaceItem(0), // #109700#
+ bUpdateType(sal_True){}
+
+ ~SwTextSectionProperties_Impl()
+ {
+ delete pColItem;
+ delete pBrushItem;
+ delete pFtnItem;
+ delete pEndItem;
+ delete pXMLAttr;
+ delete pNoBalanceItem;
+ delete pFrameDirItem;
+ delete pLRSpaceItem; // #109700#
+ }
+};
+/* -----------------------------11.07.00 12:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXTextSection* SwXTextSection::GetImplementation(Reference< XInterface> xRef )
+{
+ uno::Reference<lang::XUnoTunnel> xTunnel( xRef, uno::UNO_QUERY);
+ if(xTunnel.is())
+ return (SwXTextSection*)xTunnel->getSomething(SwXTextSection::getUnoTunnelId());
+ return 0;
+}
+
+/* -----------------------------13.03.00 12:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextSection::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextSection::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/*-- 10.12.98 14:47:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSection::SwXTextSection(SwSectionFmt* pFmt, BOOL bIndexHeader) :
+ SwClient(pFmt),
+ aLstnrCntnr( (text::XTextContent*)this),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_SECTION)),
+// _pMap(aSwMapProvider.getPropertyMap(PROPERTY_MAP_SECTION)),
+ m_bIsDescriptor(pFmt == 0),
+ m_bIndexHeader(bIndexHeader),
+ pProps(pFmt ? 0 : new SwTextSectionProperties_Impl())
+{
+
+}
+/*-- 10.12.98 14:47:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSection::~SwXTextSection()
+{
+ delete pProps;
+}
+/*-- 10.12.98 14:47:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextSection > SwXTextSection::getParentSection(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< text::XTextSection > aRef;
+ SwSectionFmt* pSectFmt = GetFmt();
+ if(pSectFmt)
+ {
+ SwSectionFmt* pParentFmt = pSectFmt->GetParent();
+ if(pParentFmt)
+ {
+ SwXTextSection* pxSect = (SwXTextSection*)SwClientIter(*pParentFmt).
+ First(TYPE(SwXTextSection));
+ if(pxSect)
+ aRef = pxSect;
+ else
+ aRef = new SwXTextSection(pParentFmt);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 10.12.98 14:47:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Reference< text::XTextSection > > SwXTextSection::getChildSections(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Sequence<uno::Reference< text::XTextSection > > aSeq;
+ SwSectionFmt* pSectFmt = GetFmt();
+ if(pSectFmt)
+ {
+ SwSections aChildren;
+ pSectFmt->GetChildSections(aChildren, SORTSECT_NOT, sal_False);
+ aSeq.realloc(aChildren.Count());
+ uno::Reference< text::XTextSection > * pArray = aSeq.getArray();
+ for(sal_uInt16 i = 0; i < aChildren.Count(); i++)
+ {
+ SwSectionFmt* pChild = aChildren.GetObject(i)->GetFmt();
+ SwXTextSection* pxSect = (SwXTextSection*)SwClientIter(*pChild).
+ First(TYPE(SwXTextSection));
+ if(pxSect)
+ pArray[i] = pxSect;
+ else
+ pArray[i] = new SwXTextSection(pChild);
+ }
+ }
+ return aSeq;
+
+}
+/* -----------------18.02.99 13:31-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextSection::attachToRange(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ if(!m_bIsDescriptor)
+ throw uno::RuntimeException();
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDoc)
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ UnoActionContext aCont(pDoc);
+
+ sal_Bool bRet = sal_False;
+
+ SwSection* pRet = 0;
+ if(!m_sName.Len())
+ m_sName = C2S("TextSection");
+ SectionType eType = pProps->bDDE ? DDE_LINK_SECTION :
+ pProps->sLinkFileName.Len() || pProps->sSectionRegion.Len() ? FILE_LINK_SECTION :
+ CONTENT_SECTION;
+ // index header section?
+ if(m_bIndexHeader)
+ {
+ // caller wants an index header section, but will only
+ // give him one if a) we are inside an index, and b) said
+ // index doesn't yet have a header section.
+ const SwTOXBase* pBase = aPam.GetDoc()->GetCurTOX(
+ *aPam.Start() );
+
+ // are we inside an index?
+ if (pBase)
+ {
+ // get all child sections
+ SwSections aSectionsArr;
+ ((SwTOXBaseSection*)pBase)->GetFmt()->
+ GetChildSections(aSectionsArr);
+
+ // and search for current header section
+ sal_uInt16 nCount = aSectionsArr.Count();
+ sal_Bool bHeaderPresent = sal_False;
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ bHeaderPresent |=
+ (aSectionsArr[i]->GetType() == TOX_HEADER_SECTION);
+ }
+ if (! bHeaderPresent)
+ {
+ eType = TOX_HEADER_SECTION;
+ }
+ }
+ }
+
+ SwSection aSect(eType, pDoc->GetUniqueSectionName(&m_sName));
+ aSect.SetCondition(pProps->sCondition);
+ String sLinkName(pProps->sLinkFileName);
+ sLinkName += ::binfilter::cTokenSeperator;
+ sLinkName += pProps->sSectionFilter;
+ sLinkName += ::binfilter::cTokenSeperator;
+ sLinkName += pProps->sSectionRegion;
+ aSect.SetLinkFileName(sLinkName);
+
+ aSect.SetHidden(pProps->bHidden);
+ aSect.SetProtect(pProps->bProtect);
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_COL, RES_COL,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FTN_AT_TXTEND, RES_FRAMEDIR,
+ RES_LR_SPACE, RES_LR_SPACE, // #109700#
+ RES_UNKNOWNATR_CONTAINER,RES_UNKNOWNATR_CONTAINER,
+ 0);
+ if(pProps->pBrushItem)
+ aSet.Put(*pProps->pBrushItem);
+ if(pProps->pColItem)
+ aSet.Put(*pProps->pColItem);
+ if(pProps->pFtnItem)
+ aSet.Put(*pProps->pFtnItem);
+ if(pProps->pEndItem)
+ aSet.Put(*pProps->pEndItem);
+ if(pProps->pXMLAttr)
+ aSet.Put(*pProps->pXMLAttr);
+ if(pProps->pNoBalanceItem)
+ aSet.Put(*pProps->pNoBalanceItem);
+ if(pProps->pFrameDirItem)
+ aSet.Put(*pProps->pFrameDirItem);
+ /* #109700# */
+ if(pProps->pLRSpaceItem)
+ aSet.Put(*pProps->pLRSpaceItem);
+
+ // section password
+ if (pProps->aPassword.getLength() > 0)
+ aSect.SetPasswd(pProps->aPassword);
+
+ pRet = pDoc->Insert( aPam, aSect, aSet.Count() ? &aSet : 0 );
+ pRet->GetFmt()->Add(this);
+
+ // #97450# XML import must hide sections depending on their old
+ // condition status
+ if( pProps->sCondition.Len() != 0 )
+ pRet->SetCondHidden(pProps->bCondHidden);
+
+ // set update type if DDE link (and connect, if necessary)
+ if (pProps->bDDE)
+ {
+ if (! pRet->IsConnected())
+ {
+ pRet->CreateLink(CREATE_CONNECT);
+ }
+ pRet->SetUpdateType(pProps->bUpdateType ? ::binfilter::LINKUPDATE_ALWAYS :
+ ::binfilter::LINKUPDATE_ONCALL);
+ }
+
+ DELETEZ(pProps);
+ m_bIsDescriptor = sal_False;
+ }
+ else
+ throw lang::IllegalArgumentException();
+}
+/*-- 10.12.98 14:47:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+
+/*-- 10.12.98 14:47:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextSection::getAnchor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< text::XTextRange > xRet;
+ SwSectionFmt* pSectFmt = GetFmt();
+ if(pSectFmt)
+ {
+ const SwSection* pSect;
+ const SwNodeIndex* pIdx;
+ if( 0 != ( pSect = pSectFmt->GetSection() ) &&
+ 0 != ( pIdx = pSectFmt->GetCntnt().GetCntntIdx() ) &&
+ pIdx->GetNode().GetNodes().IsDocNodes() )
+ {
+ SwPaM aPaM(*pIdx);
+ aPaM.Move( fnMoveForward, fnGoCntnt );
+
+ const SwEndNode* pEndNode = pIdx->GetNode().EndOfSectionNode();
+ SwPaM aEnd(*pEndNode);
+ aEnd.Move( fnMoveBackward, fnGoCntnt );
+ xRet = SwXTextRange::CreateTextRangeFromPosition(pSectFmt->GetDoc(),
+ *aPaM.Start(), aEnd.Start());
+ }
+ }
+ return xRet;
+}
+/*-- 10.12.98 14:47:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwSectionFmt* pSectFmt = GetFmt();
+ if(pSectFmt)
+ pSectFmt->GetDoc()->DelSectionFmt( pSectFmt );
+ else
+ throw uno::RuntimeException();
+}
+/*-- 10.12.98 14:47:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+/*-- 10.12.98 14:47:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+/*-- 10.12.98 14:47:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXTextSection::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = aPropSet.getPropertySetInfo();
+ return aRef;
+}
+/* -----------------------------12.02.01 10:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct SwSectItemSet_Impl
+{
+
+ SfxItemSet* pItemSet;
+ SwSectItemSet_Impl() :
+ pItemSet(0){}
+ ~SwSectItemSet_Impl()
+ {delete pItemSet;}
+};
+/* -----------------------------12.02.01 10:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextSection::setPropertyValues(
+ const Sequence< ::rtl::OUString >& rPropertyNames,
+ const Sequence< Any >& rValues )
+ throw(PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwSectionFmt* pFmt = GetFmt();
+ if(rPropertyNames.getLength() != rValues.getLength())
+ throw IllegalArgumentException();
+ if(pFmt || m_bIsDescriptor)
+ {
+ SwSection aSection(CONTENT_SECTION, aEmptyStr);
+ SwSection* pSect = pFmt ? pFmt->GetSection() : 0;
+ if(pFmt)
+ aSection = *pSect;
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+ SwSectItemSet_Impl aItemSet;
+
+ sal_Bool bLinkModeChanged = sal_False;
+ sal_Bool bLinkMode;
+ for(sal_Int16 nProperty = 0; nProperty < rPropertyNames.getLength(); nProperty++)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), pPropertyNames[nProperty]);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) );
+ switch(pMap->nWID)
+ {
+ case WID_SECT_CONDITION:
+ {
+ OUString uTmp;
+ pValues[nProperty] >>= uTmp;
+ if(m_bIsDescriptor)
+ pProps->sCondition = String(uTmp);
+ else
+ aSection.SetCondition(uTmp);
+ }
+ break;
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ {
+ OUString uTmp;
+ pValues[nProperty] >>= uTmp;
+ String sTmp(uTmp);
+ if(m_bIsDescriptor)
+ {
+ if(!pProps->bDDE)
+ {
+ pProps->sLinkFileName = ::binfilter::cTokenSeperator;
+ pProps->sLinkFileName += ::binfilter::cTokenSeperator;
+ pProps->bDDE = sal_True;
+ }
+ pProps->sLinkFileName.SetToken(pMap->nWID - WID_SECT_DDE_TYPE,::binfilter::cTokenSeperator,sTmp);
+ }
+ else
+ {
+ String sLinkFileName(aSection.GetLinkFileName());
+ if(aSection.GetType() != DDE_LINK_SECTION)
+ {
+ sLinkFileName = ::binfilter::cTokenSeperator;
+ sLinkFileName += ::binfilter::cTokenSeperator;
+ aSection.SetType(DDE_LINK_SECTION);
+ }
+ sLinkFileName.SetToken(pMap->nWID - WID_SECT_DDE_TYPE,::binfilter::cTokenSeperator, sTmp);
+ aSection.SetLinkFileName(sLinkFileName);
+ }
+ }
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ {
+ sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
+ if(m_bIsDescriptor)
+ {
+ pProps->bUpdateType = bVal;
+ }
+ else
+ {
+ bLinkModeChanged = sal_True;
+ bLinkMode = bVal;
+ }
+ }
+ break;
+ case WID_SECT_LINK :
+ {
+ text::SectionFileLink aLink;
+ if(pValues[nProperty] >>= aLink)
+ {
+ if(m_bIsDescriptor)
+ {
+ pProps->bDDE = sal_False;
+ pProps->sLinkFileName = String(aLink.FileURL);
+ pProps->sSectionFilter = String(aLink.FilterName);
+ }
+ else
+ {
+ if(aSection.GetType() != FILE_LINK_SECTION &&
+ aLink.FileURL.getLength())
+ aSection.SetType(FILE_LINK_SECTION);
+ String sFileName;
+ if(aLink.FileURL.getLength())
+ sFileName += ::binfilter::StaticBaseUrl::SmartRelToAbs( aLink.FileURL);
+ sFileName += ::binfilter::cTokenSeperator;
+ sFileName += String(aLink.FilterName);
+ sFileName += ::binfilter::cTokenSeperator;
+ sFileName += aSection.GetLinkFileName().GetToken( 2, ::binfilter::cTokenSeperator );
+ aSection.SetLinkFileName(sFileName);
+ if(sFileName.Len() < 3)
+ aSection.SetType(CONTENT_SECTION);
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ case WID_SECT_REGION :
+ {
+ OUString uTmp;
+ pValues[nProperty] >>= uTmp;
+ String sLink(uTmp);
+ if(m_bIsDescriptor)
+ {
+ pProps->bDDE = sal_False;
+ pProps->sSectionRegion = sLink;
+ }
+ else
+ {
+ if(aSection.GetType() != FILE_LINK_SECTION &&
+ sLink.Len())
+ aSection.SetType(FILE_LINK_SECTION);
+ String sSectLink(aSection.GetLinkFileName());
+ while( 3 < sSectLink.GetTokenCount( ::binfilter::cTokenSeperator ))
+ {
+ sSectLink += ::binfilter::cTokenSeperator;
+ }
+ sSectLink.SetToken(2, ::binfilter::cTokenSeperator, sLink);
+ aSection.SetLinkFileName(sSectLink);
+ if(sSectLink.Len() < 3)
+ aSection.SetType(CONTENT_SECTION);
+ }
+ }
+ break;
+ case WID_SECT_VISIBLE :
+ {
+ sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
+ if(m_bIsDescriptor)
+ pProps->bHidden = !bVal;
+ else
+ aSection.SetHidden(!bVal);
+ }
+ break;
+ case WID_SECT_CURRENTLY_VISIBLE:
+ {
+ sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
+ if(m_bIsDescriptor)
+ pProps->bCondHidden = !bVal;
+ else
+ if( aSection.GetCondition().Len() != 0 )
+ aSection.SetCondHidden(!bVal);
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ sal_Bool bVal = *(sal_Bool*)pValues[nProperty].getValue();
+ if(m_bIsDescriptor)
+ pProps->bProtect = bVal;
+ else
+ aSection.SetProtect(bVal);
+ }
+ break;
+ case WID_SECT_PASSWORD:
+ {
+ uno::Sequence<sal_Int8> aSeq;
+ pValues[nProperty] >>= aSeq;
+ if (m_bIsDescriptor)
+ pProps->aPassword = aSeq;
+ else
+ aSection.SetPasswd(aSeq);
+ }
+ break;
+ default:
+ if(pFmt)
+ {
+ const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet();
+ aItemSet.pItemSet = new SfxItemSet(*rOldAttrSet.GetPool(),
+ pMap->nWID, pMap->nWID, 0);
+ aItemSet.pItemSet->Put(rOldAttrSet);
+ aPropSet.setPropertyValue(*pMap, pValues[nProperty], *aItemSet.pItemSet);
+ }
+ else
+ {
+ SfxPoolItem* pPutItem = 0;
+ if(RES_COL == pMap->nWID)
+ {
+ if(!pProps->pColItem)
+ pProps->pColItem = new SwFmtCol;
+ pPutItem = pProps->pColItem;
+ }
+ else if(RES_BACKGROUND == pMap->nWID)
+ {
+ if(!pProps->pBrushItem)
+ pProps->pBrushItem = new SvxBrushItem;
+ pPutItem = pProps->pBrushItem;
+ }
+ else if(RES_FTN_AT_TXTEND == pMap->nWID)
+ {
+ if(!pProps->pFtnItem)
+ pProps->pFtnItem = new SwFmtFtnAtTxtEnd;
+ pPutItem = pProps->pFtnItem;
+ }
+ else if(RES_END_AT_TXTEND == pMap->nWID)
+ {
+ if(!pProps->pEndItem)
+ pProps->pEndItem = new SwFmtEndAtTxtEnd;
+ pPutItem = pProps->pEndItem;
+ }
+ else if(RES_UNKNOWNATR_CONTAINER== pMap->nWID)
+ {
+ if(!pProps->pXMLAttr)
+ pProps->pXMLAttr= new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER );
+ pPutItem = pProps->pXMLAttr;
+ }
+ else if(RES_COLUMNBALANCE== pMap->nWID)
+ {
+ if(!pProps->pNoBalanceItem)
+ pProps->pNoBalanceItem= new SwFmtNoBalancedColumns( RES_COLUMNBALANCE );
+ pPutItem = pProps->pNoBalanceItem;
+ }
+ else if(RES_FRAMEDIR == pMap->nWID)
+ {
+ if(!pProps->pFrameDirItem)
+ pProps->pFrameDirItem = new SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
+ pPutItem = pProps->pFrameDirItem;
+ }
+ else if(RES_LR_SPACE == pMap->nWID)
+ {
+ // #109700#
+ if(!pProps->pLRSpaceItem)
+ pProps->pLRSpaceItem = new SvxLRSpaceItem( RES_LR_SPACE );
+ pPutItem = pProps->pLRSpaceItem;
+ }
+ if(pPutItem)
+ pPutItem->PutValue(pValues[nProperty], pMap->nMemberId);
+ }
+
+ }
+ }
+ else
+ throw RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) );
+
+ }
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwSectionFmts& rFmts = pDoc->GetSections();
+ UnoActionContext aContext(pDoc);
+ for( sal_uInt16 i = 0; i < rFmts.Count(); i++ )
+ {
+ if(rFmts[i]->GetSection()->GetName() == pSect->GetName())
+ {
+ // always prevent update of an existing link in the section
+ pDoc->ChgSection( i, aSection, aItemSet.pItemSet, sal_True );
+ // <--
+
+ {
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pDoc );
+ }
+
+ SwSection* pSect = pFmt->GetSection();
+ if( bLinkModeChanged && pSect->GetType() == DDE_LINK_SECTION)
+ {
+ // set update type; needs an established link
+ if(!pSect->IsConnected())
+ {
+ pSect->CreateLink(CREATE_CONNECT);
+ }
+ pSect->SetUpdateType(bLinkMode ? ::binfilter::LINKUPDATE_ALWAYS
+ : ::binfilter::LINKUPDATE_ONCALL);
+ }
+ // section found and processed: break from loop
+ break;
+ }
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+
+}
+/*-- 10.12.98 14:47:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Sequence< ::rtl::OUString > aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ Sequence< Any > aValues(1);
+ aValues.getArray()[0] = aValue;
+ setPropertyValues(aPropertyNames, aValues);
+}
+/* -----------------------------12.02.01 10:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Any > SwXTextSection::getPropertyValues(
+ const Sequence< ::rtl::OUString >& rPropertyNames )
+ throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< Any > aRet(rPropertyNames.getLength());
+ Any* pRet = aRet.getArray();
+ SwSectionFmt* pFmt = GetFmt();
+ if(pFmt||m_bIsDescriptor)
+ {
+ SwSection* pSect = pFmt ? pFmt->GetSection() : 0;
+ const OUString* pPropertyNames = rPropertyNames.getConstArray();
+ for(sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength(); nProperty++)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), pPropertyNames[nProperty]);
+ if(pMap)
+ {
+ switch(pMap->nWID)
+ {
+ case WID_SECT_CONDITION:
+ {
+ OUString uTmp(
+ m_bIsDescriptor ? pProps->sCondition : pSect->GetCondition());
+ pRet[nProperty] <<= uTmp;
+ }
+ break;
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ {
+ String sRet;
+ if(m_bIsDescriptor)
+ {
+ if(pProps->bDDE)
+ sRet = pProps->sLinkFileName;
+ }
+ else if( DDE_LINK_SECTION == pSect->GetType() )
+ {
+ sRet = pSect->GetLinkFileName();
+ }
+ sRet = sRet.GetToken(pMap->nWID - WID_SECT_DDE_TYPE, ::binfilter::cTokenSeperator);
+ pRet[nProperty] <<= OUString(sRet);
+ }
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ {
+ // GetUpdateType() returns .._ALWAYS or .._ONCALL
+ if ( pSect->IsLinkType() && pSect->IsConnected() )
+ {
+ sal_Bool bTemp =
+ (pSect->GetUpdateType() == ::binfilter::LINKUPDATE_ALWAYS);
+ pRet[nProperty].setValue( &bTemp, ::getCppuBooleanType());
+ }
+ }
+ break;
+ case WID_SECT_LINK :
+ {
+ text::SectionFileLink aLink;
+ if(m_bIsDescriptor)
+ {
+ if(!pProps->bDDE)
+ {
+ aLink.FileURL = pProps->sLinkFileName;
+ aLink.FilterName = pProps->sSectionFilter;
+ }
+ }
+ else if( FILE_LINK_SECTION == pSect->GetType() )
+ {
+ String sRet( pSect->GetLinkFileName() );
+ aLink.FileURL = sRet.GetToken(0, ::binfilter::cTokenSeperator );
+ aLink.FilterName = sRet.GetToken(1, ::binfilter::cTokenSeperator );
+ }
+ pRet[nProperty].setValue(&aLink, ::getCppuType((text::SectionFileLink*)0));
+ }
+ break;
+ case WID_SECT_REGION :
+ {
+ String sRet;
+ if(m_bIsDescriptor)
+ {
+ sRet = pProps->sSectionRegion;
+ }
+ else if( FILE_LINK_SECTION == pSect->GetType() )
+ sRet = pSect->GetLinkFileName().GetToken(2, ::binfilter::cTokenSeperator);
+ pRet[nProperty] <<= OUString(sRet);
+ }
+ break;
+ case WID_SECT_VISIBLE :
+ {
+ sal_Bool bTemp = m_bIsDescriptor ? !pProps->bHidden : !pSect->IsHidden();
+ pRet[nProperty].setValue( &bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_SECT_CURRENTLY_VISIBLE:
+ {
+ sal_Bool bTmp = m_bIsDescriptor ? !pProps->bCondHidden : !pSect->IsCondHidden();
+ pRet[nProperty].setValue( &bTmp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ sal_Bool bTemp = m_bIsDescriptor ? pProps->bProtect : pSect->IsProtect();
+ pRet[nProperty].setValue( &bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_PARAM_LINK_DISPLAY_NAME:
+ {
+ if(pFmt)
+ pRet[nProperty] <<= OUString(pFmt->GetSection()->GetName());
+ }
+ break;
+ case WID_SECT_DOCUMENT_INDEX:
+ {
+ // search enclosing index
+ SwSection* pEnclosingSection = pSect;
+ while ( (pEnclosingSection != NULL) &&
+ (TOX_CONTENT_SECTION !=
+ pEnclosingSection->GetType()) )
+ {
+ pEnclosingSection = pEnclosingSection->GetParent();
+ }
+ if (pEnclosingSection)
+ {
+ // convert section to TOXBase and get SwXDocumentIndex
+ SwTOXBaseSection* pTOXBaseSect =
+ PTR_CAST(SwTOXBaseSection, pEnclosingSection);
+ Reference<XDocumentIndex> xIndex =
+ SwXDocumentIndexes::GetObject(pTOXBaseSect);
+ pRet[nProperty] <<= xIndex;
+ }
+ // else: no enclosing index found -> empty return value
+ }
+ break;
+ case WID_SECT_IS_GLOBAL_DOC_SECTION:
+ {
+ sal_Bool bRet = (NULL == pFmt) ? sal_False :
+ (NULL != pFmt->GetGlobalDocSection());
+ pRet[nProperty].setValue( &bRet, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ SwXParagraph::getDefaultTextContentValue(pRet[nProperty], OUString(), pMap->nWID);
+ break;
+ case FN_UNO_REDLINE_NODE_START:
+ case FN_UNO_REDLINE_NODE_END:
+ {
+ SwNode* pSectNode = pFmt->GetSectionNode();
+ if(FN_UNO_REDLINE_NODE_END == pMap->nWID)
+ pSectNode = pSectNode->EndOfSectionNode();
+ const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl();
+ for(USHORT nRed = 0; nRed < rRedTbl.Count(); nRed++)
+ {
+ const SwRedline* pRedline = rRedTbl[nRed];
+ const SwNode* pRedPointNode = pRedline->GetNode(TRUE);
+ const SwNode* pRedMarkNode = pRedline->GetNode(FALSE);
+ if(pRedPointNode == pSectNode || pRedMarkNode == pSectNode)
+ {
+ const SwNode* pStartOfRedline = SwNodeIndex(*pRedPointNode) <= SwNodeIndex(*pRedMarkNode) ?
+ pRedPointNode : pRedMarkNode;
+ BOOL bIsStart = pStartOfRedline == pSectNode;
+ pRet[nProperty] <<= SwXRedlinePortion::CreateRedlineProperties(*pRedline, bIsStart);
+ break;
+ }
+ }
+ }
+ break;
+ case WID_SECT_PASSWORD:
+ {
+ pRet[nProperty] <<= m_bIsDescriptor ? pProps->aPassword : pSect->GetPasswd();
+ }
+ break;
+ default:
+ if(pFmt)
+ pRet[nProperty] = aPropSet.getPropertyValue(*pMap, pFmt->GetAttrSet());
+ else
+ {
+ const SfxPoolItem* pQueryItem = 0;
+ if(RES_COL == pMap->nWID)
+ {
+ if(!pProps->pColItem)
+ pProps->pColItem = new SwFmtCol;
+ pQueryItem = pProps->pColItem;
+ }
+ else if(RES_BACKGROUND == pMap->nWID)
+ {
+ if(!pProps->pBrushItem)
+ pProps->pBrushItem = new SvxBrushItem;
+ pQueryItem = pProps->pBrushItem;
+ }
+ else if(RES_FTN_AT_TXTEND == pMap->nWID)
+ {
+ if(!pProps->pFtnItem)
+ pProps->pFtnItem = new SwFmtFtnAtTxtEnd;
+ pQueryItem = pProps->pFtnItem;
+ }
+ else if(RES_END_AT_TXTEND == pMap->nWID)
+ {
+ if(!pProps->pEndItem)
+ pProps->pEndItem = new SwFmtEndAtTxtEnd;
+ pQueryItem = pProps->pEndItem;
+ }
+ else if(RES_UNKNOWNATR_CONTAINER== pMap->nWID)
+ {
+ if(!pProps->pXMLAttr)
+ pProps->pXMLAttr= new SvXMLAttrContainerItem ;
+ pQueryItem = pProps->pXMLAttr;
+ }
+ else if(RES_COLUMNBALANCE== pMap->nWID)
+ {
+ if(!pProps->pNoBalanceItem)
+ pProps->pNoBalanceItem= new SwFmtNoBalancedColumns;
+ pQueryItem = pProps->pNoBalanceItem;
+ }
+ else if(RES_FRAMEDIR == pMap->nWID)
+ {
+ if(!pProps->pFrameDirItem)
+ pProps->pFrameDirItem = new SvxFrameDirectionItem;
+ pQueryItem = pProps->pFrameDirItem;
+ }
+ /* -> #109700# */
+ else if(RES_LR_SPACE == pMap->nWID)
+ {
+ if(!pProps->pLRSpaceItem)
+ pProps->pLRSpaceItem = new SvxLRSpaceItem;
+ pQueryItem = pProps->pLRSpaceItem;
+ }
+ /* <- #109700# */
+ if(pQueryItem)
+ pQueryItem->QueryValue(pRet[nProperty], pMap->nMemberId);
+ }
+ }
+ }
+ else
+ throw RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProperty], static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 10.12.98 14:47:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextSection::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Sequence< ::rtl::OUString > aPropertyNames(1);
+ aPropertyNames.getArray()[0] = rPropertyName;
+ return getPropertyValues(aPropertyNames).getConstArray()[0];
+}
+/* -----------------------------12.02.01 10:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextSection::addPropertiesChangeListener(
+ const Sequence< ::rtl::OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener ) throw(RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+/* -----------------------------12.02.01 10:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextSection::removePropertiesChangeListener(
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+/* -----------------------------12.02.01 10:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextSection::firePropertiesChangeEvent(
+ const Sequence< ::rtl::OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 10.12.98 14:47:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 10.12.98 14:47:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 10.12.98 14:47:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 10.12.98 14:47:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/*-- 08.11.00 10:47:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+PropertyState SwXTextSection::getPropertyState( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< OUString > aNames(1);
+ aNames.getArray()[0] = rPropertyName;
+ return getPropertyStates(aNames).getConstArray()[0];
+}
+/*-- 08.11.00 10:47:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< PropertyState > SwXTextSection::getPropertyStates(
+ const Sequence< OUString >& rPropertyNames )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ Sequence< PropertyState > aStates(rPropertyNames.getLength());
+ SwSectionFmt* pFmt = GetFmt();
+ if(pFmt||m_bIsDescriptor)
+ {
+ PropertyState* pStates = aStates.getArray();
+ const OUString* pNames = rPropertyNames.getConstArray();
+ for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
+ {
+ pStates[i] = PropertyState_DEFAULT_VALUE;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), pNames[i]);
+ if(!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
+ switch(pMap->nWID)
+ {
+ case WID_SECT_CONDITION:
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ case WID_SECT_DDE_AUTOUPDATE:
+ case WID_SECT_LINK :
+ case WID_SECT_REGION :
+ case WID_SECT_VISIBLE :
+ case WID_SECT_PROTECTED:
+ case FN_PARAM_LINK_DISPLAY_NAME:
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ pStates[i] = PropertyState_DIRECT_VALUE;
+ break;
+ default:
+ if(pFmt)
+ pStates[i] = aPropSet.getPropertyState(pNames[i], pFmt->GetAttrSet());
+ else
+ {
+ const SfxPoolItem* pQueryItem = 0;
+ if(RES_COL == pMap->nWID)
+ {
+ if(!pProps->pColItem)
+ pStates[i] = PropertyState_DEFAULT_VALUE;
+ else
+ pStates[i] = PropertyState_DIRECT_VALUE;
+ }
+ else //if(RES_BACKGROUND == pMap->nWID)
+ {
+ if(!pProps->pBrushItem)
+ pStates[i] = PropertyState_DEFAULT_VALUE;
+ else
+ pStates[i] = PropertyState_DIRECT_VALUE;
+ }
+ }
+ }
+ }
+ }
+ else
+ throw RuntimeException();
+ return aStates;
+}
+/*-- 08.11.00 10:47:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::setPropertyToDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwSectionFmt* pFmt = GetFmt();
+ if(pFmt||m_bIsDescriptor)
+ {
+ SwSection aSection(CONTENT_SECTION, aEmptyStr);
+ SwSection* pSect = pFmt ? pFmt->GetSection() : 0;
+ if(pFmt)
+ aSection = *pSect;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ if(!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SfxItemSet* pNewAttrSet = 0;
+ switch(pMap->nWID)
+ {
+ case WID_SECT_CONDITION:
+ {
+ if(m_bIsDescriptor)
+ pProps->sCondition = aEmptyStr;
+ else
+ aSection.SetCondition(aEmptyStr);
+ }
+ break;
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ case WID_SECT_LINK :
+ case WID_SECT_REGION :
+ aSection.SetType(CONTENT_SECTION);
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ aSection.SetUpdateType(::binfilter::LINKUPDATE_ALWAYS);
+ break;
+ case WID_SECT_VISIBLE :
+ {
+ if(m_bIsDescriptor)
+ pProps->bHidden = FALSE;
+ else
+ aSection.SetHidden(FALSE);
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ if(m_bIsDescriptor)
+ pProps->bProtect = FALSE;
+ else
+ aSection.SetProtect(FALSE);
+ }
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ break;
+ default:
+ if(pMap->nWID <= SFX_WHICH_MAX)
+ {
+ if(pFmt)
+ {
+ const SfxItemSet& rOldAttrSet = pFmt->GetAttrSet();
+ pNewAttrSet = new SfxItemSet(*rOldAttrSet.GetPool(),
+ pMap->nWID, pMap->nWID, 0);
+ pNewAttrSet->ClearItem(pMap->nWID);
+ }
+ else
+ {
+ if(RES_COL == pMap->nWID)
+ DELETEZ(pProps->pColItem);
+ else if(RES_BACKGROUND == pMap->nWID)
+ DELETEZ(pProps->pBrushItem);
+ }
+ }
+ }
+ if(pFmt)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwSectionFmts& rFmts = pDoc->GetSections();
+ UnoActionContext aContext(pDoc);
+ for( sal_uInt16 i = 0; i < rFmts.Count(); i++ )
+ {
+ if(rFmts[i]->GetSection()->GetName() == pSect->GetName())
+ {
+ // always prevent update of an existing link in the section
+ pDoc->ChgSection( i, aSection, pNewAttrSet, sal_True );
+ // <--
+
+ {
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pDoc );
+ }
+
+ break;
+ }
+ }
+ delete pNewAttrSet;
+ }
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 08.11.00 10:47:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXTextSection::getPropertyDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwSectionFmt* pFmt = GetFmt();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch(pMap->nWID)
+ {
+ case WID_SECT_CONDITION:
+ case WID_SECT_DDE_TYPE :
+ case WID_SECT_DDE_FILE :
+ case WID_SECT_DDE_ELEMENT :
+ case WID_SECT_REGION :
+ case FN_PARAM_LINK_DISPLAY_NAME:
+ aRet <<= OUString();
+ break;
+ case WID_SECT_LINK :
+ aRet <<= SectionFileLink();
+ break;
+ case WID_SECT_DDE_AUTOUPDATE:
+ case WID_SECT_VISIBLE :
+ {
+ sal_Bool bTemp = TRUE;
+ aRet.setValue( &bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_SECT_PROTECTED:
+ {
+ sal_Bool bTemp = FALSE;
+ aRet.setValue( &bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ SwXParagraph::getDefaultTextContentValue(aRet, OUString(), pMap->nWID);
+ break;
+ default:
+ if(pFmt && pMap->nWID <= SFX_WHICH_MAX)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SfxPoolItem& rDefItem =
+ pDoc->GetAttrPool().GetDefaultItem(pMap->nWID);
+ rDefItem.QueryValue(aRet, pMap->nMemberId);
+ }
+ }
+ return aRet;
+}
+/*-- 10.12.98 14:47:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextSection::getName(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String sRet;
+ const SwSectionFmt* pFmt = GetFmt();
+ if(pFmt)
+ sRet = pFmt->GetSection()->GetName();
+ else if(m_bIsDescriptor)
+ sRet = m_sName;
+ else
+ throw uno::RuntimeException();
+ return sRet;
+}
+/*-- 10.12.98 14:47:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::setName(const OUString& rName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwSectionFmt* pFmt = GetFmt();
+ if(pFmt)
+ {
+ SwSection aSection(CONTENT_SECTION, aEmptyStr);
+ SwSection* pSect = pFmt->GetSection();
+ aSection = *pSect;
+ String sNewName(rName);
+ aSection.SetName(sNewName);
+
+ const SwSectionFmts& rFmts = pFmt->GetDoc()->GetSections();
+ sal_uInt16 nApplyPos = USHRT_MAX;
+ for( sal_uInt16 i = 0; i < rFmts.Count(); i++ )
+ {
+ if(rFmts[i]->GetSection() == pSect)
+ nApplyPos = i;
+ else if(sNewName == rFmts[i]->GetSection()->GetName())
+ throw uno::RuntimeException();
+ }
+ if(nApplyPos != USHRT_MAX)
+ {
+ {
+ UnoActionContext aContext(pFmt->GetDoc());
+ pFmt->GetDoc()->ChgSection( nApplyPos, aSection);
+ }
+ {
+ // temporarily remove actions to allow cursor update
+ UnoActionRemoveContext aRemoveContext( pFmt->GetDoc() );
+ }
+ }
+ }
+ else if(m_bIsDescriptor)
+ m_sName = String(rName);
+ else
+ throw uno::RuntimeException();
+}
+/* -----------------02.11.99 11:30-------------------
+
+ --------------------------------------------------*/
+OUString SwXTextSection::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextSection");
+}
+/* -----------------02.11.99 11:30-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextSection::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return !rServiceName.compareToAscii("com.sun.star.text.TextSection") ||
+ !rServiceName.compareToAscii("com.sun.star.document.LinkTarget") ||
+ !rServiceName.compareToAscii("com.sun.star.text.TextContent");
+}
+/* -----------------02.11.99 11:30-------------------
+
+ --------------------------------------------------*/
+uno::Sequence< OUString > SwXTextSection::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(3);
+ OUString* pArr = aRet.getArray();
+ pArr[0] = C2U("com.sun.star.text.TextSection");
+ pArr[1] = C2U("com.sun.star.document.LinkTarget");
+ pArr[2] = C2U("com.sun.star.text.TextContent");
+ return aRet;
+}
+
+/*-- 10.12.98 14:42:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSection::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ if(pOld && pOld->Which() == RES_REMOVE_UNO_OBJECT &&
+ (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ else
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ aLstnrCntnr.Disposing();
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unosett.cxx b/binfilter/bf_sw/source/core/unocore/sw_unosett.cxx
new file mode 100644
index 000000000000..b8e06a97cc20
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unosett.cxx
@@ -0,0 +1,2414 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <hintids.hxx>
+#include "poolfmt.hrc"
+#include "poolfmt.hxx"
+
+#include <errhdl.hxx>
+
+#include <fmtcol.hxx>
+
+#include <unomap.hxx>
+
+#include <cppuhelper/implbase4.hxx>
+
+#include <unostyle.hxx>
+#include <unosett.hxx>
+#include <unoprnms.hxx>
+#include <bf_svtools/itemprop.hxx>
+#include <ftninfo.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+#include <lineinfo.hxx>
+#include <docsh.hxx>
+#include <docary.hxx>
+#include <docstyle.hxx>
+#include <fmtclds.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <com/sun/star/text/XFootnotesSettingsSupplier.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSettingsSupplier.hpp>
+#include <com/sun/star/text/FootnoteNumbering.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/style/LineNumberPosition.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <unoobj.hxx>
+#include <vcl/font.hxx>
+#include <bf_svx/flstitem.hxx>
+#include <vcl/metric.hxx>
+#include <bf_svtools/ctrltool.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <bf_svx/unofdesc.hxx>
+#include <bf_svx/unomid.hxx>
+#include <vcl/graph.hxx>
+#include <rtl/string.hxx>
+#include <fmtornt.hxx>
+#include <unomid.h>
+#include <SwStyleNameMapper.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
+
+using rtl::OUString;
+
+struct PropValData
+{
+ uno::Any aVal;
+ OUString sPropName;
+ PropValData(void* pVal, const char* cPropName, uno::Type aType ) :
+ aVal(pVal, aType),
+ sPropName(OUString::createFromAscii(cPropName))
+ {}
+ PropValData(const uno::Any& rVal, const OUString& rPropName) :
+ aVal(rVal),
+ sPropName(rPropName)
+ {}
+};
+
+typedef PropValData* PropValDataPtr;
+SV_DECL_PTRARR(PropValDataArr, PropValDataPtr, 5, 5 )
+SV_IMPL_PTRARR(PropValDataArr, PropValDataPtr)
+
+
+#define WID_PREFIX 0
+#define WID_SUFFIX 1
+#define WID_NUMBERING_TYPE 2
+#define WID_START_AT 3
+#define WID_FOOTNOTE_COUNTING 4
+#define WID_PARAGRAPH_STYLE 5
+#define WID_PAGE_STYLE 6
+#define WID_CHARACTER_STYLE 7
+#define WID_POSITION_END_OF_DOC 8
+#define WID_END_NOTICE 9
+#define WID_BEGIN_NOTICE 10
+#define WID_ANCHOR_CHARACTER_STYLE 11
+
+const SfxItemPropertyMap* GetFootnoteMap()
+{
+ static SfxItemPropertyMap aFootnoteMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_BEGIN_NOTICE), WID_BEGIN_NOTICE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_END_NOTICE), WID_END_NOTICE , &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_FOOTNOTE_COUNTING), WID_FOOTNOTE_COUNTING, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_POSITION_END_OF_DOC), WID_POSITION_END_OF_DOC,&::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ return aFootnoteMap_Impl;
+}
+const SfxItemPropertyMap* GetEndnoteMap()
+{
+ static SfxItemPropertyMap aEndnoteMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_ANCHOR_CHAR_STYLE_NAME),WID_ANCHOR_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), WID_PAGE_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PARA_STYLE_NAME), WID_PARAGRAPH_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PREFIX), WID_PREFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_START_AT), WID_START_AT , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SUFFIX), WID_SUFFIX, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ return aEndnoteMap_Impl;
+}
+const SfxItemPropertyMap* GetNumberingRulesMap()
+{
+ static SfxItemPropertyMap aNumberingRulesMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS), WID_IS_ABS_MARGINS, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC), WID_IS_AUTOMATIC, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING), WID_CONTINUOUS, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NAME), WID_RULE_NAME , &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
+ {0,0,0,0}
+ };
+ return aNumberingRulesMap_Impl;
+}
+#define WID_NUM_ON 0
+#define WID_SEPARATOR_INTERVAL 1
+#define WID_NUMBERING_TYPE 2
+#define WID_NUMBER_POSITION 3
+#define WID_DISTANCE 4
+#define WID_INTERVAL 5
+#define WID_SEPARATOR_TEXT 6
+//#define WID_CHARACTER_STYLE 7
+#define WID_COUNT_EMPTY_LINES 8
+#define WID_COUNT_LINES_IN_FRAMES 9
+#define WID_RESTART_AT_EACH_PAGE 10
+
+const SfxItemPropertyMap* GetLineNumberingMap()
+{
+ static SfxItemPropertyMap aLineNumberingMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME), WID_CHARACTER_STYLE, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_COUNT_EMPTY_LINES), WID_COUNT_EMPTY_LINES , &::getBooleanCppuType(),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_COUNT_LINES_IN_FRAMES), WID_COUNT_LINES_IN_FRAMES, &::getBooleanCppuType(),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_DISTANCE ), WID_DISTANCE , &::getCppuType((const sal_Int32*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_IS_ON), WID_NUM_ON, &::getBooleanCppuType() , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_INTERVAL ), WID_INTERVAL , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SEPARATOR_TEXT ), WID_SEPARATOR_TEXT, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBER_POSITION), WID_NUMBER_POSITION, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_NUMBERING_TYPE), WID_NUMBERING_TYPE , &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_RESTART_AT_EACH_PAGE), WID_RESTART_AT_EACH_PAGE, &::getBooleanCppuType() , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SEPARATOR_INTERVAL), WID_SEPARATOR_INTERVAL, &::getCppuType((const sal_Int16*)0),PROPERTY_NONE, 0},
+ {0,0,0,0}
+ };
+ return aLineNumberingMap_Impl;
+}
+
+SwCharFmt* lcl_getCharFmt(SwDoc* pDoc, const uno::Any& aValue)
+{
+ SwCharFmt* pRet = 0;
+ String sStandard(SW_RES(STR_POOLCOLL_STANDARD));
+ OUString uTmp;
+ aValue >>= uTmp;
+ String sCharFmt;
+ SwStyleNameMapper::FillUIName(uTmp, sCharFmt, GET_POOLID_CHRFMT, sal_True);
+ if(sStandard != sCharFmt)
+ {
+ pRet = pDoc->FindCharFmtByName( sCharFmt );
+ }
+ if(!pRet)
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, GET_POOLID_CHRFMT);
+ if(USHRT_MAX != nId)
+ pRet = pDoc->GetCharFmtFromPool( nId );
+ }
+ return pRet;
+}
+
+SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue)
+{
+ OUString uTmp;
+ aValue >>= uTmp;
+ String sParaStyle;
+ SwStyleNameMapper::FillUIName(uTmp, sParaStyle, GET_POOLID_TXTCOLL, sal_True );
+ SwTxtFmtColl* pRet = pDoc->FindTxtFmtCollByName( sParaStyle );
+ if( !pRet )
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, GET_POOLID_TXTCOLL );
+ if( USHRT_MAX != nId )
+ pRet = pDoc->GetTxtCollFromPool( nId );
+ }
+ return pRet;
+}
+
+SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue)
+{
+ SwPageDesc* pRet = 0;
+ sal_uInt16 nCount = pDoc->GetPageDescCnt();
+ OUString uTmp;
+ aValue >>= uTmp;
+ String sPageDesc;
+ SwStyleNameMapper::FillUIName(uTmp, sPageDesc, GET_POOLID_PAGEDESC, sal_True );
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SwPageDesc& rDesc = pDoc->GetPageDesc( i );
+ if(rDesc.GetName() == sPageDesc)
+ {
+ pRet = (SwPageDesc*)&rDesc;
+ break;
+ }
+ }
+ if(!pRet)
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, GET_POOLID_PAGEDESC);
+ if(USHRT_MAX != nId)
+ pRet = pDoc->GetPageDescFromPool( nId );
+ }
+ return pRet;
+}
+
+// Numerierung
+const unsigned short aSvxToUnoAdjust[] =
+{
+ HoriOrientation::LEFT, //3
+ HoriOrientation::RIGHT, //1
+ USHRT_MAX,
+ HoriOrientation::CENTER, //2
+ USHRT_MAX,
+ USHRT_MAX
+};
+
+const unsigned short aUnoToSvxAdjust[] =
+{
+ USHRT_MAX,
+ SVX_ADJUST_RIGHT, // 1
+ SVX_ADJUST_CENTER, // 3
+ SVX_ADJUST_LEFT, // 0
+ USHRT_MAX,
+ USHRT_MAX
+};
+
+/******************************************************************
+ * SwXFootnoteProperties
+ ******************************************************************/
+OUString SwXFootnoteProperties::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXFootnoteProperties");
+}
+
+BOOL SwXFootnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.FootnoteSettings") == rServiceName;
+}
+
+Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.FootnoteSettings");
+ return aRet;
+}
+
+SwXFootnoteProperties::SwXFootnoteProperties(SwDoc* pDc) :
+ pDoc(pDc),
+ _pMap(GetFootnoteMap())
+{
+}
+
+SwXFootnoteProperties::~SwXFootnoteProperties()
+{
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXFootnoteProperties::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap );
+ return aRef;
+}
+
+void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(pDoc)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SwFtnInfo aFtnInfo(pDoc->GetFtnInfo());
+ switch(pMap->nWID)
+ {
+ case WID_PREFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.SetPrefix(uTmp);
+ }
+ break;
+ case WID_SUFFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.SetSuffix(uTmp);
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ INT16 nTmp;
+ aValue >>= nTmp;
+ if(nTmp >= 0 &&
+ (nTmp <= SVX_NUM_ARABIC ||
+ nTmp > SVX_NUM_BITMAP))
+ aFtnInfo.aFmt.SetNumberingType(nTmp);
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ case WID_START_AT:
+ {
+ INT16 nTmp;
+ aValue >>= nTmp;
+ aFtnInfo.nFtnOffset = nTmp;
+ }
+ break;
+ case WID_FOOTNOTE_COUNTING :
+ {
+ sal_uInt16 nRet = 0;
+ INT16 nTmp;
+ aValue >>= nTmp;
+ switch(nTmp)
+ {
+ case FootnoteNumbering::PER_PAGE:
+ aFtnInfo.eNum = FTNNUM_PAGE;
+ break;
+ case FootnoteNumbering::PER_CHAPTER:
+ aFtnInfo.eNum = FTNNUM_CHAPTER;
+ break;
+ case FootnoteNumbering::PER_DOCUMENT:
+ aFtnInfo.eNum = FTNNUM_DOC;
+ break;
+ }
+ }
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
+ if(pColl)
+ aFtnInfo.SetFtnTxtColl(*pColl);
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
+ if(pDesc)
+ aFtnInfo.ChgPageDesc( pDesc );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE :
+ {
+ SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
+ if(pFmt)
+ {
+ if(pMap->nWID == WID_ANCHOR_CHARACTER_STYLE)
+ aFtnInfo.SetAnchorCharFmt(pFmt);
+ else
+ aFtnInfo.SetCharFmt(pFmt);
+ }
+ }
+ break;
+ case WID_POSITION_END_OF_DOC:
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aFtnInfo.ePos = bVal ? FTNPOS_CHAPTER : FTNPOS_PAGE;
+ }
+ break;
+ case WID_END_NOTICE :
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.aQuoVadis = String(uTmp);
+ }
+ break;
+ case WID_BEGIN_NOTICE :
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aFtnInfo.aErgoSum = String(uTmp);
+ }
+ break;
+ }
+ pDoc->SetFtnInfo(aFtnInfo);
+ }
+ else
+ throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(pDoc)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
+ switch(pMap->nWID)
+ {
+ case WID_PREFIX:
+ {
+ aRet <<= OUString(rFtnInfo.GetPrefix());
+ }
+ break;
+ case WID_SUFFIX:
+ {
+ aRet <<= OUString(rFtnInfo.GetSuffix());
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ aRet <<= rFtnInfo.aFmt.GetNumberingType();
+ }
+ break;
+ case WID_START_AT:
+ aRet <<= (sal_Int16)rFtnInfo.nFtnOffset;
+ break;
+ case WID_FOOTNOTE_COUNTING :
+ {
+ sal_Int16 nRet = 0;
+ switch(rFtnInfo.eNum)
+ {
+ case FTNNUM_PAGE:
+ nRet = FootnoteNumbering::PER_PAGE;
+ break;
+ case FTNNUM_CHAPTER:
+ nRet = FootnoteNumbering::PER_CHAPTER;
+ break;
+ case FTNNUM_DOC:
+ nRet = FootnoteNumbering::PER_DOCUMENT;
+ break;
+ }
+ aRet <<= nRet;
+ }
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = rFtnInfo.GetFtnTxtColl();
+ String aString;
+ if(pColl)
+ aString = String ( pColl->GetName() );
+ SwStyleNameMapper::FillProgName(aString, aString, GET_POOLID_TXTCOLL, sal_True);
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ String aString;
+ if( rFtnInfo.GetPageDescDep()->GetRegisteredIn() )
+ {
+ SwStyleNameMapper::FillProgName(
+ rFtnInfo.GetPageDesc( *pDoc )->GetName(),
+ aString,
+ GET_POOLID_PAGEDESC,
+ sal_True);
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE:
+ {
+ String aString;
+ const SwCharFmt* pCharFmt = 0;
+ if( pMap->nWID == WID_ANCHOR_CHARACTER_STYLE )
+ {
+ if( rFtnInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rFtnInfo.GetAnchorCharFmt(*pDoc);
+ }
+ else
+ {
+ if( rFtnInfo.GetCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rFtnInfo.GetCharFmt(*pDoc);
+ }
+ if( pCharFmt )
+ {
+ SwStyleNameMapper::FillProgName(
+ pCharFmt->GetName(),
+ aString,
+ GET_POOLID_CHRFMT,
+ sal_True);
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_POSITION_END_OF_DOC:
+ {
+ sal_Bool bTemp = FTNPOS_CHAPTER == rFtnInfo.ePos;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_END_NOTICE :
+ aRet <<= OUString(rFtnInfo.aQuoVadis);
+ break;
+ case WID_BEGIN_NOTICE :
+ aRet <<= OUString(rFtnInfo.aErgoSum);
+ break;
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXFootnoteProperties::addPropertyChangeListener(
+ const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXFootnoteProperties::removePropertyChangeListener(
+ const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXFootnoteProperties::addVetoableChangeListener(
+ const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXFootnoteProperties::removeVetoableChangeListener(
+ const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/******************************************************************
+ * SwXEndnoteProperties
+ ******************************************************************/
+OUString SwXEndnoteProperties::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXEndnoteProperties");
+}
+
+BOOL SwXEndnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.FootnoteSettings") == rServiceName;
+}
+
+Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.FootnoteSettings");
+ return aRet;
+}
+
+SwXEndnoteProperties::SwXEndnoteProperties(SwDoc* pDc) :
+ pDoc(pDc),
+ _pMap(GetEndnoteMap())
+{
+}
+
+SwXEndnoteProperties::~SwXEndnoteProperties()
+{
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXEndnoteProperties::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap );
+ return aRef;
+}
+
+void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(pDoc)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SwEndNoteInfo aEndInfo(pDoc->GetEndNoteInfo());
+ switch(pMap->nWID)
+ {
+ case WID_PREFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aEndInfo.SetPrefix(uTmp);
+ }
+ break;
+ case WID_SUFFIX:
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aEndInfo.SetSuffix(uTmp);
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ INT16 nTmp;
+ aValue >>= nTmp;
+ aEndInfo.aFmt.SetNumberingType(nTmp);
+ }
+ break;
+ case WID_START_AT:
+ {
+ INT16 nTmp;
+ aValue >>= nTmp;
+ aEndInfo.nFtnOffset = nTmp;
+ }
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = lcl_GetParaStyle(pDoc, aValue);
+ if(pColl)
+ aEndInfo.SetFtnTxtColl(*pColl);
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ SwPageDesc* pDesc = lcl_GetPageDesc(pDoc, aValue);
+ if(pDesc)
+ aEndInfo.ChgPageDesc( pDesc );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE :
+ {
+ SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
+ if(pFmt)
+ {
+ if(pMap->nWID == WID_ANCHOR_CHARACTER_STYLE)
+ aEndInfo.SetAnchorCharFmt(pFmt);
+ else
+ aEndInfo.SetCharFmt(pFmt);
+ }
+ }
+ break;
+ }
+ pDoc->SetEndNoteInfo(aEndInfo);
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+}
+
+uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(pDoc)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
+ switch(pMap->nWID)
+ {
+ case WID_PREFIX:
+ aRet <<= OUString(rEndInfo.GetPrefix());
+ break;
+ case WID_SUFFIX:
+ aRet <<= OUString(rEndInfo.GetSuffix());
+ break;
+ case WID_NUMBERING_TYPE :
+ aRet <<= rEndInfo.aFmt.GetNumberingType();
+ break;
+ case WID_START_AT:
+ aRet <<= (sal_Int16)rEndInfo.nFtnOffset;
+ break;
+ case WID_PARAGRAPH_STYLE :
+ {
+ SwTxtFmtColl* pColl = rEndInfo.GetFtnTxtColl();
+ String aString;
+ if(pColl)
+ aString = pColl->GetName();
+ SwStyleNameMapper::FillProgName(
+ aString,
+ aString,
+ GET_POOLID_TXTCOLL,
+ sal_True);
+ aRet <<= OUString ( aString );
+
+ }
+ break;
+ case WID_PAGE_STYLE :
+ {
+ String aString;
+ if( rEndInfo.GetPageDescDep()->GetRegisteredIn() )
+ {
+ SwStyleNameMapper::FillProgName(
+ rEndInfo.GetPageDesc( *pDoc )->GetName(),
+ aString,
+ GET_POOLID_PAGEDESC,
+ sal_True );
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_ANCHOR_CHARACTER_STYLE:
+ case WID_CHARACTER_STYLE:
+ {
+ String aString;
+ const SwCharFmt* pCharFmt = 0;
+ if( pMap->nWID == WID_ANCHOR_CHARACTER_STYLE )
+ {
+ if( rEndInfo.GetAnchorCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rEndInfo.GetAnchorCharFmt(*pDoc);
+ }
+ else
+ {
+ if( rEndInfo.GetCharFmtDep()->GetRegisteredIn() )
+ pCharFmt = rEndInfo.GetCharFmt(*pDoc);
+ }
+ if( pCharFmt )
+ {
+ SwStyleNameMapper::FillProgName(
+ pCharFmt->GetName(),
+ aString,
+ GET_POOLID_CHRFMT,
+ sal_True );
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ return aRet;
+}
+
+void SwXEndnoteProperties::addPropertyChangeListener(
+ const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXEndnoteProperties::removePropertyChangeListener(const OUString& PropertyName,
+ const uno:: Reference< beans::XPropertyChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXEndnoteProperties::addVetoableChangeListener(const OUString& PropertyName,
+ const uno:: Reference< beans::XVetoableChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXEndnoteProperties::removeVetoableChangeListener(const OUString& PropertyName, const uno:: Reference< beans::XVetoableChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/******************************************************************
+ * SwXLineNumberingProperties
+ ******************************************************************/
+OUString SwXLineNumberingProperties::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXLineNumberingProperties");
+}
+
+BOOL SwXLineNumberingProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.LineNumberingProperties") == rServiceName;
+}
+
+Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.LineNumberingProperties");
+ return aRet;
+}
+
+SwXLineNumberingProperties::SwXLineNumberingProperties(SwDoc* pDc) :
+ pDoc(pDc),
+ _pMap(GetLineNumberingMap())
+{
+}
+
+SwXLineNumberingProperties::~SwXLineNumberingProperties()
+{
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXLineNumberingProperties::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap );
+ return aRef;
+}
+
+void SwXLineNumberingProperties::setPropertyValue(
+ const OUString& rPropertyName, const Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(pDoc)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ SwLineNumberInfo aInfo(pDoc->GetLineNumberInfo());
+ switch(pMap->nWID)
+ {
+ case WID_NUM_ON:
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetPaintLineNumbers(bVal);
+ }
+ break;
+ case WID_CHARACTER_STYLE :
+ {
+ SwCharFmt* pFmt = lcl_getCharFmt(pDoc, aValue);
+ if(pFmt)
+ aInfo.SetCharFmt(pFmt);
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ {
+ SvxNumberType aNumType(aInfo.GetNumType());
+ INT16 nTmp;
+ aValue >>= nTmp;
+ aNumType.SetNumberingType(nTmp);
+ aInfo.SetNumType(aNumType);
+ }
+ break;
+ case WID_NUMBER_POSITION :
+ {
+ INT16 nTmp;
+ aValue >>= nTmp;
+ switch(nTmp)
+ {
+ case style::LineNumberPosition::LEFT:
+ aInfo.SetPos(LINENUMBER_POS_LEFT); ;
+ break;
+ case style::LineNumberPosition::RIGHT :
+ aInfo.SetPos(LINENUMBER_POS_RIGHT); ;
+ break;
+ case style::LineNumberPosition::INSIDE:
+ aInfo.SetPos(LINENUMBER_POS_INSIDE); ;
+ break;
+ case style::LineNumberPosition::OUTSIDE:
+ aInfo.SetPos(LINENUMBER_POS_OUTSIDE);
+ break;
+ }
+ }
+ break;
+ case WID_DISTANCE :
+ {
+ INT32 nVal;
+ aValue >>= nVal;
+ aInfo.SetPosFromLeft(Min(static_cast<sal_Int32>(MM100_TO_TWIP(nVal)), sal_Int32(0xffff)));
+ }
+ break;
+ case WID_INTERVAL :
+ {
+ INT16 nTmp;
+ aValue >>= nTmp;
+ aInfo.SetCountBy(nTmp);
+ }
+ break;
+ case WID_SEPARATOR_TEXT :
+ {
+ OUString uTmp;
+ aValue >>= uTmp;
+ aInfo.SetDivider(uTmp);
+ }
+ break;
+ case WID_SEPARATOR_INTERVAL:
+ {
+ INT16 nTmp;
+ aValue >>= nTmp;
+ aInfo.SetDividerCountBy(nTmp);
+ }
+ break;
+ case WID_COUNT_EMPTY_LINES :
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetCountBlankLines(bVal);
+ }
+ break;
+ case WID_COUNT_LINES_IN_FRAMES :
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetCountInFlys(bVal);
+ }
+ break;
+ case WID_RESTART_AT_EACH_PAGE :
+ {
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ aInfo.SetRestartEachPage(bVal);
+ }
+ break;
+ }
+ pDoc->SetLineNumberInfo(aInfo);
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Any aRet;
+ if(pDoc)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ const SwLineNumberInfo& rInfo = pDoc->GetLineNumberInfo();
+ switch(pMap->nWID)
+ {
+ case WID_NUM_ON:
+ {
+ sal_Bool bTemp = rInfo.IsPaintLineNumbers();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_CHARACTER_STYLE :
+ {
+ String aString;
+ // return empty string if no char format is set
+ // otherwise it would be created here
+ if(rInfo.GetRegisteredIn())
+ {
+ SwStyleNameMapper::FillProgName(
+ rInfo.GetCharFmt(*pDoc)->GetName(),
+ aString,
+ GET_POOLID_CHRFMT,
+ sal_True);
+ }
+ aRet <<= OUString ( aString );
+ }
+ break;
+ case WID_NUMBERING_TYPE :
+ aRet <<= rInfo.GetNumType().GetNumberingType();
+ break;
+ case WID_NUMBER_POSITION :
+ {
+ sal_Int16 nRet = 0;
+ switch(rInfo.GetPos())
+ {
+ case LINENUMBER_POS_LEFT:
+ nRet = style::LineNumberPosition::LEFT;
+ break;
+ case LINENUMBER_POS_RIGHT :
+ nRet = style::LineNumberPosition::RIGHT ;
+ break;
+ case LINENUMBER_POS_INSIDE:
+ nRet = style::LineNumberPosition::INSIDE ;
+ break;
+ case LINENUMBER_POS_OUTSIDE :
+ nRet = style::LineNumberPosition::OUTSIDE ;
+ break;
+ }
+ aRet <<= nRet;
+ }
+ break;
+ case WID_DISTANCE :
+ {
+ sal_uInt32 nPos = rInfo.GetPosFromLeft();
+ if(USHRT_MAX == nPos)
+ nPos = 0;
+ aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100(nPos));
+ }
+ break;
+ case WID_INTERVAL :
+ aRet <<= (sal_Int16)rInfo.GetCountBy();
+ break;
+ case WID_SEPARATOR_TEXT :
+ aRet <<= OUString(rInfo.GetDivider());
+ break;
+ case WID_SEPARATOR_INTERVAL:
+ aRet <<= (sal_Int16)rInfo.GetDividerCountBy();
+ break;
+ case WID_COUNT_EMPTY_LINES :
+ {
+ sal_Bool bTemp = rInfo.IsCountBlankLines();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_COUNT_LINES_IN_FRAMES :
+ {
+ sal_Bool bTemp = rInfo.IsCountInFlys();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case WID_RESTART_AT_EACH_PAGE :
+ {
+ sal_Bool bTemp = rInfo.IsRestartEachPage();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXLineNumberingProperties::addPropertyChangeListener(const OUString& PropertyName, const uno:: Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+
+void SwXLineNumberingProperties::removePropertyChangeListener(const OUString& PropertyName, const uno:: Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+
+void SwXLineNumberingProperties::addVetoableChangeListener(const OUString& PropertyName, const uno:: Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+
+void SwXLineNumberingProperties::removeVetoableChangeListener(const OUString& PropertyName, const uno:: Reference< beans::XVetoableChangeListener > & aListener)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+DBG_WARNING("not implemented");
+}
+
+/******************************************************************
+ * SwXNumberingRules
+ ******************************************************************/
+String SwXNumberingRules::sInvalidStyle(String::CreateFromAscii("__XXX___invalid"));
+
+const String& SwXNumberingRules::GetInvalidStyle()
+{
+ return sInvalidStyle;
+}
+
+const uno::Sequence< sal_Int8 > & SwXNumberingRules::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+// return implementation specific data
+sal_Int64 SwXNumberingRules::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+OUString SwXNumberingRules::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXNumberingRules");
+}
+
+BOOL SwXNumberingRules::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.NumberingRules") == rServiceName;
+}
+
+Sequence< OUString > SwXNumberingRules::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.NumberingRules");
+ return aRet;
+}
+
+SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule) :
+ pNumRule(new SwNumRule(rRule)),
+ bOwnNumRuleCreated(TRUE),
+ pDoc(0),
+ pDocShell(0),
+ _pMap(GetNumberingRulesMap())
+{
+ //erstmal das Doc organisieren; es haengt an den gesetzten Zeichenvorlagen - wenn
+ // keine gesetzt sind, muss es auch ohne gehen
+ sal_uInt16 i=0;
+ for( i = 0; i < MAXLEVEL; i++)
+ {
+ SwNumFmt rFmt(pNumRule->Get(i));
+ SwCharFmt* pCharFmt = rFmt.GetCharFmt();
+ if(pCharFmt)
+ {
+ pDoc = pCharFmt->GetDoc();
+ break;
+ }
+ }
+ if(pDoc)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ for(i = 0; i < MAXLEVEL; i++)
+ {
+ sNewCharStyleNames[i] = SwXNumberingRules::GetInvalidStyle();
+ sNewBulletFontNames[i] = SwXNumberingRules::GetInvalidStyle();
+ }
+}
+
+SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) :
+ pDoc(0),
+ pNumRule(0),
+ pDocShell(&rDocSh),
+ bOwnNumRuleCreated(FALSE),
+ _pMap(GetNumberingRulesMap())
+{
+ pDocShell->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+}
+
+SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) :
+ pDoc(&rDoc),
+ pNumRule(0),
+ pDocShell(0),
+ bOwnNumRuleCreated(FALSE),
+ _pMap(GetNumberingRulesMap())
+{
+ rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ sCreatedNumRuleName = rDoc.GetUniqueNumRuleName();
+ sal_uInt16 nIndex = rDoc.MakeNumRule( sCreatedNumRuleName, 0 );
+}
+
+SwXNumberingRules::~SwXNumberingRules()
+{
+ if(pDoc && sCreatedNumRuleName.Len())
+ pDoc->DelNumRule( sCreatedNumRuleName );
+ if( pNumRule && bOwnNumRuleCreated )
+ delete pNumRule;
+}
+
+void SwXNumberingRules::replaceByIndex(sal_Int32 nIndex, const uno::Any& rElement)
+ throw( lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(rElement.getValueType().getTypeClass() != uno::TypeClass_SEQUENCE)
+ throw lang::IllegalArgumentException();
+ const uno::Sequence<beans::PropertyValue>& rProperties =
+ *(const uno::Sequence<beans::PropertyValue>*)rElement.getValue();
+ SwNumRule* pRule = 0;
+ if(pNumRule)
+ SwXNumberingRules::setNumberingRuleByIndex( *pNumRule,
+ rProperties, nIndex);
+ else if(pDocShell)
+ {
+ const SwNumRule* pNumRule = pDocShell->GetDoc()->GetOutlineNumRule();
+ SwNumRule aNumRule(*pNumRule);
+ SwXNumberingRules::setNumberingRuleByIndex( aNumRule,
+ rProperties, nIndex);
+ //hier noch die Zeichenformate bei Bedarf setzen
+ const SwCharFmts* pFmts = pDocShell->GetDoc()->GetCharFmts();
+ sal_uInt16 nChCount = pFmts->Count();
+ for(sal_uInt16 i = 0; i < MAXLEVEL;i++)
+ {
+ SwNumFmt aFmt(aNumRule.Get( i ));
+ if(sNewCharStyleNames[i].Len() &&
+ !sNewCharStyleNames[i].EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE)) &&
+ (!aFmt.GetCharFmt() ||
+ aFmt.GetCharFmt()->GetName()!= sNewCharStyleNames[i] ))
+ {
+ SwCharFmt* pCharFmt = 0;
+ for(sal_uInt16 j = 0; j< nChCount; j++)
+ {
+ SwCharFmt* pTmp = (*pFmts)[j];
+ if(pTmp->GetName() == sNewCharStyleNames[i])
+ {
+ pCharFmt = pTmp;
+ break;
+ }
+ }
+ if(!pCharFmt)
+ {
+ SfxStyleSheetBase* pBase;
+ pBase = pDocShell->GetStyleSheetPool()->Find(sNewCharStyleNames[i],
+ SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pDocShell->GetStyleSheetPool()->Make(sNewCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+
+ }
+ aFmt.SetCharFmt( pCharFmt );
+ aNumRule.Set( i, aFmt );
+ }
+ }
+ pDocShell->GetDoc()->SetOutlineNumRule( aNumRule );
+ }
+ else if(!pNumRule && pDoc && sCreatedNumRuleName.Len() &&
+ 0 != (pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName )))
+ {
+ SwXNumberingRules::setNumberingRuleByIndex( *pRule,
+ rProperties, nIndex);
+ sal_uInt16 nPos = pDoc->FindNumRule( sCreatedNumRuleName );
+ pDoc->UpdateNumRule( sCreatedNumRuleName, nPos );
+ }
+ else
+ throw uno::RuntimeException();
+
+}
+
+sal_Int32 SwXNumberingRules::getCount(void) throw( uno::RuntimeException )
+{
+ return MAXLEVEL;
+}
+
+uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aVal;
+ if(MAXLEVEL <= nIndex)
+ throw lang::IndexOutOfBoundsException();
+ const SwNumRule* pRule = pNumRule;
+ if(!pRule && pDoc && sCreatedNumRuleName.Len())
+ pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName );
+ if(pRule)
+ {
+ uno::Sequence<beans::PropertyValue> aRet = getNumberingRuleByIndex(
+ *pRule, nIndex);
+ aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
+
+ }
+ else if(pDocShell)
+ {
+ uno::Sequence<beans::PropertyValue> aRet = getNumberingRuleByIndex(
+ *pDocShell->GetDoc()->GetOutlineNumRule(), nIndex);
+ aVal.setValue(&aRet, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
+ }
+ else
+ throw uno::RuntimeException();
+ return aVal;
+}
+
+uno::Type SwXNumberingRules::getElementType(void)
+ throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Sequence<beans::PropertyValue>*)0);
+}
+
+sal_Bool SwXNumberingRules::hasElements(void) throw( uno::RuntimeException )
+{
+ return sal_True;
+}
+
+uno::Sequence<beans::PropertyValue> SwXNumberingRules::getNumberingRuleByIndex(
+ const SwNumRule& rNumRule, sal_Int32 nIndex) const
+{
+ SolarMutexGuard aGuard;
+ const SwNumFmt& rFmt = rNumRule.Get( (sal_uInt16)nIndex );
+
+ sal_Bool bChapterNum = pDocShell != 0;
+
+ PropValDataArr aPropertyValues;
+ //fill all properties into the array
+
+ //adjust
+ SvxAdjust eAdj = rFmt.GetNumAdjust();
+ sal_Int16 nINT16 = aSvxToUnoAdjust[(sal_uInt16)eAdj];
+ PropValData* pData = new PropValData((void*)&nINT16, "Adjust", ::getCppuType((const sal_Int16*)0) );
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //parentnumbering
+ nINT16 = rFmt.GetIncludeUpperLevels();
+ pData = new PropValData((void*)&nINT16, "ParentNumbering", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //prefix
+ OUString aUString = rFmt.GetPrefix();
+ pData = new PropValData((void*)&aUString, "Prefix", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //suffix
+ aUString = rFmt.GetSuffix();
+ pData = new PropValData((void*)&aUString, "Suffix", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //char style name
+ SwCharFmt* pCharFmt = rFmt.GetCharFmt();
+ String CharStyleName;
+ if(pCharFmt)
+ CharStyleName = pCharFmt->GetName();
+ //egal ob ein Style vorhanden ist oder nicht ueberschreibt der Array-Eintrag diesen String
+ if(sNewCharStyleNames[(sal_uInt16)nIndex].Len() &&
+ SwXNumberingRules::sInvalidStyle != sNewCharStyleNames[(sal_uInt16)nIndex])
+ CharStyleName = sNewCharStyleNames[(sal_uInt16)nIndex];
+
+ String aString;
+ SwStyleNameMapper::FillProgName( CharStyleName, aString, GET_POOLID_CHRFMT, sal_True );
+ aUString = aString;
+ pData = new PropValData((void*)&aUString, "CharStyleName", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //startvalue
+ nINT16 = rFmt.GetStart();
+ pData = new PropValData((void*)&nINT16, "StartWith", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //leftmargin
+ sal_Int32 nINT32 = TWIP_TO_MM100(rFmt.GetAbsLSpace());
+ pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //chartextoffset
+ nINT32 = TWIP_TO_MM100(rFmt.GetCharTextDistance());
+ pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //firstlineoffset
+ nINT32 = TWIP_TO_MM100(rFmt.GetFirstLineOffset());
+ pData = new PropValData((void*)&nINT32, SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), ::getCppuType((const sal_Int32*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ nINT16 = rFmt.GetNumberingType();
+ pData = new PropValData((void*)&nINT16, "NumberingType", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ if(!bChapterNum)
+ {
+ if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
+ {
+ //BulletId
+ nINT16 = rFmt.GetBulletChar();
+ pData = new PropValData((void*)&nINT16, "BulletId", ::getCppuType((const sal_Int16*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ const Font* pFont = rFmt.GetBulletFont();
+
+ //BulletChar
+ aUString = OUString(rFmt.GetBulletChar());
+ pData = new PropValData((void*)&aUString, "BulletChar", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //BulletFontName
+ String sBulletFontName;
+ if(pFont)
+ sBulletFontName = pFont->GetStyleName();
+ aUString = sBulletFontName;
+ pData = new PropValData((void*)&aUString, "BulletFontName", ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //BulletFont
+ if(pFont)
+ {
+ awt::FontDescriptor aDesc;
+ SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc );
+ pData = new PropValData((void*)&aDesc, SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), ::getCppuType((const awt::FontDescriptor*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ }
+ if(SVX_NUM_BITMAP == rFmt.GetNumberingType())
+ {
+ //GraphicURL
+ const SvxBrushItem* pBrush = rFmt.GetBrush();
+ if(pBrush)
+ {
+ Any aAny;
+ pBrush->QueryValue( aAny, MID_GRAPHIC_URL );
+ aAny >>= aUString;
+ }
+ else
+ aUString = aEmptyStr;
+ pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ //graphicbitmap
+ const Graphic* pGraphic = 0;
+ if(pBrush )
+ pGraphic = pBrush->GetGraphic();
+ if(pGraphic)
+ {
+ uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
+ pData = new PropValData((void*)&xBmp, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP),
+ ::getCppuType((const uno::Reference<awt::XBitmap>*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ Size aSize = rFmt.GetGraphicSize();
+ aSize.Width() = TWIP_TO_MM100( aSize.Width() );
+ aSize.Height() = TWIP_TO_MM100( aSize.Height() );
+ pData = new PropValData((void*)&aSize, SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), ::getCppuType((const awt::Size*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+
+ const SwFmtVertOrient* pOrient = rFmt.GetGraphicOrientation();
+ if(pOrient)
+ {
+ pData = new PropValData((void*)0, SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), ::getCppuType((const sal_Int16*)0));
+ ((const SfxPoolItem*)pOrient)->QueryValue(pData->aVal, MID_VERTORIENT_ORIENT);
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ }
+
+ }
+ else
+ {
+ //Vorlagenname
+ String sValue(SW_RES(STR_POOLCOLL_HEADLINE1 + nIndex));
+ const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
+ const sal_uInt16 nCount = pColls->Count();
+ for(sal_uInt16 i = 0; i < nCount;++i)
+ {
+ SwTxtFmtColl &rTxtColl = *pColls->operator[](i);
+ if(rTxtColl.IsDefault())
+ continue;
+
+ sal_Int8 nOutLevel = rTxtColl.GetOutlineLevel();
+ if(nOutLevel == nIndex)
+ {
+ sValue = rTxtColl.GetName();
+ }
+ }
+ String aString;
+ SwStyleNameMapper::FillProgName(sValue, aString, GET_POOLID_TXTCOLL, sal_True);
+ aUString = aString;
+
+ pData = new PropValData((void*)&aUString, SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME), ::getCppuType((const OUString*)0));
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+
+ uno::Sequence<beans::PropertyValue> aSeq(aPropertyValues.Count());
+ beans::PropertyValue* pArray = aSeq.getArray();
+
+ for(sal_uInt16 i = 0; i < aPropertyValues.Count(); i++)
+ {
+ PropValDataPtr pData = aPropertyValues.GetObject(i);
+ pArray[i].Value = pData->aVal;
+ pArray[i].Name = pData->sPropName;
+ pArray[i].Handle = -1;
+ }
+ aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count());
+ return aSeq;
+}
+
+PropValData* lcl_FindProperty(const char* cName, PropValDataArr& rPropertyValues)
+{
+ OUString sCmp = C2U(cName);
+ for(sal_uInt16 i = 0; i < rPropertyValues.Count(); i++)
+ {
+ PropValData* pTemp = rPropertyValues.GetObject(i);
+ if(sCmp == pTemp->sPropName)
+ return pTemp;
+ }
+ return 0;
+}
+
+void SwXNumberingRules::setNumberingRuleByIndex(
+ SwNumRule& rNumRule,
+ const uno::Sequence<beans::PropertyValue>& rProperties, sal_Int32 nIndex)
+ throw( uno::RuntimeException, lang::IllegalArgumentException )
+{
+ SolarMutexGuard aGuard;
+ // the order of the names is important!
+ static const char* aNumPropertyNames[] =
+ {
+ "Adjust", //0
+ "ParentNumbering", //1
+ "Prefix", //2
+ "Suffix", //3
+ "CharStyleName", //4
+ "StartWith", //5
+ SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN), //6
+ SW_PROP_NAME_STR(UNO_NAME_SYMBOL_TEXT_DISTANCE), //7
+ SW_PROP_NAME_STR(UNO_NAME_FIRST_LINE_OFFSET), //8
+ "NumberingType", //9
+ "BulletId", //10
+ SW_PROP_NAME_STR(UNO_NAME_BULLET_FONT), //11
+ "BulletFontName", //12
+ "BulletChar", //13
+ SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_URL), //14
+ SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_BITMAP), //15
+ SW_PROP_NAME_STR(UNO_NAME_GRAPHIC_SIZE), //16
+ SW_PROP_NAME_STR(UNO_NAME_VERT_ORIENT), //17
+ SW_PROP_NAME_STR(UNO_NAME_HEADING_STYLE_NAME) //18
+ };
+ const sal_uInt16 nPropNameCount = 19;
+ const sal_uInt16 nNotInChapter = 10;
+
+
+ SwNumFmt aFmt(rNumRule.Get( (sal_uInt16)nIndex ));
+ const beans::PropertyValue* pPropArray = rProperties.getConstArray();
+ PropValDataArr aPropertyValues;
+ sal_Bool bExcept = sal_False;
+ for(int i = 0; i < rProperties.getLength() && !bExcept; i++)
+ {
+ const beans::PropertyValue& rProp = pPropArray[i];
+ bExcept = sal_True;
+ for(sal_uInt16 j = 0; j < (pDocShell ? nPropNameCount : nPropNameCount - 1); j++)
+ {
+ //some values not in chapter numbering
+ if(pDocShell && j == nNotInChapter)
+ j = nPropNameCount - 1;
+ if(COMPARE_EQUAL == rProp.Name.compareToAscii(aNumPropertyNames[j]))
+ {
+ bExcept = sal_False;
+ break;
+ }
+ }
+ if(bExcept &&
+ (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletRelSize")) ||
+ rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("BulletColor")) ) )
+
+ bExcept = sal_False;
+ PropValData* pData = new PropValData(rProp.Value, rProp.Name );
+ aPropertyValues.Insert(pData, aPropertyValues.Count());
+ }
+ sal_Bool bWrongArg = sal_False;
+ if(!bExcept)
+ {
+ SvxBrushItem* pSetBrush = 0;
+ Size* pSetSize = 0;
+ SwFmtVertOrient* pSetVOrient = 0;
+ BOOL bCharStyleNameSet = FALSE;
+
+ for(sal_uInt16 i = 0; i < nPropNameCount && !bExcept && !bWrongArg; i++)
+ {
+ PropValData* pData = lcl_FindProperty(aNumPropertyNames[i], aPropertyValues);
+ if(!pData)
+ continue;
+ switch(i)
+ {
+ case 0: //"Adjust"
+ {
+ sal_Int16 nValue;
+ pData->aVal >>= nValue;
+ if(nValue > 0 &&
+ nValue <= HoriOrientation::LEFT &&
+ USHRT_MAX != aUnoToSvxAdjust[nValue])
+ {
+ aFmt.SetNumAdjust((SvxAdjust)aUnoToSvxAdjust[nValue]);
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 1: //"ParentNumbering",
+ {
+ sal_Int16 nSet;
+ pData->aVal >>= nSet;
+ if(nSet >= 0 && MAXLEVEL >= nSet)
+ aFmt.SetIncludeUpperLevels(nSet);
+ }
+ break;
+ case 2: //"Prefix",
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ aFmt.SetPrefix(uTmp);
+ }
+ break;
+ case 3: //"Suffix",
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ aFmt.SetSuffix(uTmp);
+ }
+ break;
+ case 4: //"CharStyleName",
+ {
+ bCharStyleNameSet = TRUE;
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ String sCharFmtName;
+ SwStyleNameMapper::FillUIName( uTmp, sCharFmtName, GET_POOLID_CHRFMT, sal_True );
+ SwCharFmt* pCharFmt = 0;
+ if(sCharFmtName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_CHARACTER_FORMAT_NONE)))
+ {
+ sNewCharStyleNames[(sal_uInt16)nIndex] = SwXNumberingRules::GetInvalidStyle();
+ aFmt.SetCharFmt(0);
+ }
+ else if(pDocShell || pDoc)
+ {
+ SwDoc* pLocalDoc = pDoc ? pDoc : pDocShell->GetDoc();
+ const SwCharFmts* pFmts = pLocalDoc->GetCharFmts();
+ sal_uInt16 nChCount = pFmts->Count();
+
+ SwCharFmt* pCharFmt = 0;
+ if(sCharFmtName.Len())
+ {
+ for(sal_uInt16 j = 0; j< nChCount; j++)
+ {
+ SwCharFmt* pTmp = (*pFmts)[j];
+ if(pTmp->GetName() == sCharFmtName)
+ {
+ pCharFmt = pTmp;
+ break;
+ }
+ }
+ if(!pCharFmt)
+ {
+
+ SfxStyleSheetBase* pBase;
+ SfxStyleSheetBasePool* pPool = pLocalDoc->GetDocShell()->GetStyleSheetPool();
+ pBase = ((SfxStyleSheetBasePool*)pPool)->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+ }
+ }
+ aFmt.SetCharFmt( pCharFmt );
+ sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
+ }
+ else
+ sNewCharStyleNames[(sal_uInt16)nIndex] = sCharFmtName;
+ }
+ break;
+ case 5: //"StartWith",
+ {
+ INT16 nVal;
+ pData->aVal >>= nVal;
+ aFmt.SetStart(nVal);
+ }
+ break;
+ case 6: //UNO_NAME_LEFT_MARGIN,
+ {
+ sal_Int32 nValue;
+ pData->aVal >>= nValue;
+ if(nValue >= 0)
+ aFmt.SetAbsLSpace((sal_uInt16) MM100_TO_TWIP(nValue));
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 7: //UNO_NAME_SYMBOL_TEXT_DISTANCE,
+ {
+ sal_Int32 nValue;
+ pData->aVal >>= nValue;
+ if(nValue >= 0)
+ aFmt.SetCharTextDistance((sal_uInt16) MM100_TO_TWIP(nValue));
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 8: //UNO_NAME_FIRST_LINE_OFFSET,
+ {
+ sal_Int32 nValue;
+ pData->aVal >>= nValue;
+ if(nValue <= 0)
+ {
+ nValue = MM100_TO_TWIP(nValue);
+ if(-nValue > aFmt.GetAbsLSpace())
+ aFmt.SetAbsLSpace(-nValue);
+ aFmt.SetFirstLineOffset((short)nValue);
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 9: //"NumberingType"
+ {
+ sal_Int16 nSet;
+ pData->aVal >>= nSet;
+ if(nSet >= 0)
+ aFmt.SetNumberingType(nSet);
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 10: //"BulletId",
+ {
+ sal_Int16 nSet;
+ pData->aVal >>= nSet;
+ if(nSet < 0xff)
+ aFmt.SetBulletChar(nSet);
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 11: //UNO_NAME_BULLET_FONT,
+ {
+ awt::FontDescriptor* pDesc = (awt::FontDescriptor*)pData->aVal.getValue();
+ if(pDesc)
+ {
+ Font aFont;
+ SvxUnoFontDescriptor::ConvertToFont( *pDesc, aFont );
+ aFmt.SetBulletFont(&aFont);
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 12: //"BulletFontName",
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ String sBulletFontName(uTmp);
+ sNewBulletFontNames[(sal_uInt16)nIndex] = sBulletFontName;
+ }
+ break;
+ case 13: //"BulletChar",
+ {
+ OUString aChar;
+ pData->aVal >>= aChar;
+ if(aChar.getLength() == 1)
+ {
+ aFmt.SetBulletChar(aChar.toChar());
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 14: //UNO_NAME_GRAPHIC_URL,
+ {
+ OUString sBrushURL;
+ pData->aVal >>= sBrushURL;
+ if(!pSetBrush)
+ {
+ const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
+ if(pOrigBrush)
+ {
+ pSetBrush = new SvxBrushItem(*pOrigBrush);
+ }
+ else
+ pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA);
+ }
+ pSetBrush->PutValue( pData->aVal, MID_GRAPHIC_URL );
+ }
+ break;
+ case 15: //UNO_NAME_GRAPHIC_BITMAP,
+ {
+ uno::Reference< awt::XBitmap >* pBitmap = (uno::Reference< awt::XBitmap > *)pData->aVal.getValue();
+ if(pBitmap)
+ {
+ if(!pSetBrush)
+ {
+ const SvxBrushItem* pOrigBrush = aFmt.GetBrush();
+ if(pOrigBrush)
+ {
+ pSetBrush = new SvxBrushItem(*pOrigBrush);
+ }
+ else
+ pSetBrush = new SvxBrushItem(aEmptyStr, aEmptyStr, GPOS_AREA);
+ }
+
+ BitmapEx aBmp = VCLUnoHelper::GetBitmap( *pBitmap );
+ Graphic aNewGr(aBmp);
+ pSetBrush->SetGraphic( aNewGr );
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 16: //UNO_NAME_GRAPHIC_SIZE,
+ {
+ if(!pSetSize)
+ pSetSize = new Size;
+ if(pData->aVal.getValueType() == ::getCppuType((awt::Size*)0))
+ {
+ awt::Size* pSize = (awt::Size*)pData->aVal.getValue();
+ pSize->Width = MM100_TO_TWIP(pSize->Width);
+ pSize->Height = MM100_TO_TWIP(pSize->Height);
+ pSetSize->Width() = pSize->Width;
+ pSetSize->Height() = pSize->Height;
+ }
+ else
+ bWrongArg = sal_True;
+ }
+ break;
+ case 17: //VertOrient
+ {
+ if(!pSetVOrient)
+ {
+ if(aFmt.GetGraphicOrientation())
+ pSetVOrient = (SwFmtVertOrient*)aFmt.GetGraphicOrientation()->Clone();
+ else
+ pSetVOrient = new SwFmtVertOrient;
+ }
+ ((SfxPoolItem*)pSetVOrient)->PutValue(pData->aVal, MID_VERTORIENT_ORIENT);
+ }
+ break;
+ case 18: //"HeadingStyleName"
+ {
+ OUString uTmp;
+ pData->aVal >>= uTmp;
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(uTmp, sStyleName, GET_POOLID_TXTCOLL, sal_True );
+ const SwTxtFmtColls* pColls = pDocShell->GetDoc()->GetTxtFmtColls();
+ const sal_uInt16 nCount = pColls->Count();
+ for(sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ SwTxtFmtColl &rTxtColl = *pColls->operator[](i);
+ if(rTxtColl.IsDefault())
+ continue;
+ if(rTxtColl.GetOutlineLevel() == nIndex &&
+ rTxtColl.GetName() != sStyleName)
+ rTxtColl.SetOutlineLevel(NO_NUMBERING);
+ else if(rTxtColl.GetName() == sStyleName)
+ rTxtColl.SetOutlineLevel(sal_Int8(nIndex));
+ }
+ }
+ break;
+ case 19: // BulletRelSize - unsupported - only available in Impress
+ break;
+ }
+ }
+ if(!bExcept && !bWrongArg && (pSetBrush || pSetSize || pSetVOrient))
+ {
+ if(!pSetBrush && aFmt.GetBrush())
+ pSetBrush = new SvxBrushItem(*aFmt.GetBrush());
+
+ if(pSetBrush)
+ {
+ if(!pSetVOrient && aFmt.GetGraphicOrientation())
+ pSetVOrient = new SwFmtVertOrient(*aFmt.GetGraphicOrientation());
+
+ if(!pSetSize)
+ {
+ pSetSize = new Size(aFmt.GetGraphicSize());
+ if(!pSetSize->Width() || !pSetSize->Height())
+ {
+ const Graphic* pGraphic = pSetBrush->GetGraphic();
+ if(pGraphic)
+ *pSetSize = ::binfilter::GetGraphicSizeTwip(*pGraphic, 0);
+ }
+ }
+ SvxFrameVertOrient eOrient = pSetVOrient ?
+ (SvxFrameVertOrient)pSetVOrient->GetVertOrient() : SVX_VERT_NONE;
+ aFmt.SetGraphicBrush( pSetBrush, pSetSize, SVX_VERT_NONE == eOrient ? 0 : &eOrient );
+ }
+ }
+ if((!bCharStyleNameSet || !sNewCharStyleNames[(sal_uInt16)nIndex].Len()) &&
+ aFmt.GetNumberingType() == NumberingType::BITMAP && !aFmt.GetCharFmt()
+ && SwXNumberingRules::GetInvalidStyle() != sNewCharStyleNames[(sal_uInt16)nIndex])
+ {
+ SwStyleNameMapper::FillProgName ( RES_POOLCHR_BUL_LEVEL, sNewCharStyleNames[(sal_uInt16)nIndex] );
+ }
+ delete pSetBrush;
+ delete pSetSize;
+ delete pSetVOrient;
+ }
+ aPropertyValues.DeleteAndDestroy(0, aPropertyValues.Count());
+
+ if(bWrongArg)
+ throw lang::IllegalArgumentException();
+ else if(bExcept)
+ throw uno::RuntimeException();
+ rNumRule.Set( (sal_uInt16)nIndex, aFmt );
+
+}
+
+Reference< XPropertySetInfo > SwXNumberingRules::getPropertySetInfo()
+ throw(RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap );
+ return aRef;
+}
+
+void SwXNumberingRules::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
+ throw(UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ Any aRet;
+ SwNumRule* pDocRule = 0;
+ SwNumRule* pCreatedRule = 0;
+ if(!pNumRule)
+ {
+ if(!pNumRule && pDocShell)
+ {
+ pDocRule = new SwNumRule(*pDocShell->GetDoc()->GetOutlineNumRule());
+ }
+ else if(pDoc && sCreatedNumRuleName.Len())
+ {
+ pCreatedRule = pDoc->FindNumRulePtr( sCreatedNumRuleName);
+ }
+
+ }
+ if(!pNumRule && !pDocRule && !pCreatedRule)
+ throw RuntimeException();
+
+
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC)))
+ {
+ BOOL bVal = *(sal_Bool*)rValue.getValue();
+ if(!pCreatedRule)
+ pDocRule ? pDocRule->SetAutoRule(bVal) : pNumRule->SetAutoRule(bVal);
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING)))
+ {
+ BOOL bVal = *(sal_Bool*)rValue.getValue();
+ pDocRule ? pDocRule->SetContinusNum(bVal) :
+ pCreatedRule ? pCreatedRule->SetContinusNum(bVal) : pNumRule->SetContinusNum(bVal);
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME)))
+ {
+ delete pDocRule;
+ throw IllegalArgumentException();
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS)))
+ {
+ BOOL bVal = *(sal_Bool*)rValue.getValue();
+ pDocRule ? pDocRule->SetAbsSpaces(bVal) :
+ pCreatedRule ? pCreatedRule->SetAbsSpaces(bVal) : pNumRule->SetAbsSpaces(bVal);
+ }
+ else
+ throw UnknownPropertyException();
+ if(pDocRule)
+ {
+ pDocShell->GetDoc()->SetOutlineNumRule(*pDocRule);
+ delete pDocRule;
+ }
+ else if(pCreatedRule)
+ {
+ sal_uInt16 nPos = pDoc->FindNumRule( sCreatedNumRuleName );
+ pDoc->UpdateNumRule( sCreatedNumRuleName, nPos );
+ }
+}
+
+Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ Any aRet;
+ const SwNumRule* pRule = pNumRule;
+ SwNumRule* pCreatedRule = 0;
+ if(!pRule && pDocShell)
+ pRule = pDocShell->GetDoc()->GetOutlineNumRule();
+ else if(pDoc && sCreatedNumRuleName.Len())
+ pRule = pDoc->FindNumRulePtr( sCreatedNumRuleName );
+ if(!pRule)
+ throw RuntimeException();
+
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_AUTOMATIC)))
+ {
+ BOOL bVal = pRule->IsAutoRule();
+ aRet.setValue(&bVal, ::getBooleanCppuType());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_CONTINUOUS_NUMBERING)))
+ {
+ BOOL bVal = pRule->IsContinusNum();
+ aRet.setValue(&bVal, ::getBooleanCppuType());
+ }
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_NAME)))
+ aRet <<= OUString(pRule->GetName());
+ else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_ABSOLUTE_MARGINS)))
+ {
+ BOOL bVal = pRule->IsAbsSpaces();
+ aRet.setValue(&bVal, ::getBooleanCppuType());
+ }
+ else
+ throw UnknownPropertyException();
+ return aRet;
+}
+
+void SwXNumberingRules::addPropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXNumberingRules::removePropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXNumberingRules::addVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXNumberingRules::removeVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+OUString SwXNumberingRules::getName() throw( RuntimeException )
+{
+ String aString;
+ if(pNumRule)
+ {
+ SwStyleNameMapper::FillProgName(pNumRule->GetName(), aString, GET_POOLID_NUMRULE, sal_True );
+ return OUString ( aString );
+ }
+ else
+ return sCreatedNumRuleName;
+}
+
+void SwXNumberingRules::setName(const OUString& Name_) throw( RuntimeException )
+{
+ RuntimeException aExcept;
+ aExcept.Message = C2U("readonly");
+ throw aExcept;
+}
+
+void SwXNumberingRules::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ if(bOwnNumRuleCreated)
+ delete pNumRule;
+ pNumRule = 0;
+ pDoc = 0;
+ }
+}
+
+/******************************************************************
+ * SwXChapterNumbering
+ ******************************************************************/
+OUString SwXChapterNumbering::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXChapterNumbering");
+}
+
+BOOL SwXChapterNumbering::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return sServiceName.EqualsAscii("com.sun.star.text.ChapterNumbering") ||
+ sServiceName.EqualsAscii("com.sun.star.text.NumberingRules");
+}
+
+Sequence< OUString > SwXChapterNumbering::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.ChapterNumbering");
+ pArray[1] = C2U("com.sun.star.text.NumberingRules");
+ return aRet;
+}
+
+SwXChapterNumbering::SwXChapterNumbering(SwDocShell& rDocSh) :
+ SwXNumberingRules(rDocSh)
+{
+}
+
+SwXChapterNumbering::~SwXChapterNumbering()
+{
+}
+
+/******************************************************************
+ * SwXTextColumns
+ ******************************************************************/
+OUString SwXTextColumns::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextColumns");
+}
+
+BOOL SwXTextColumns::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextColumns") == rServiceName;
+}
+
+Sequence< OUString > SwXTextColumns::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextColumns");
+ return aRet;
+}
+
+SwXTextColumns::SwXTextColumns(sal_uInt16 nColCount) :
+ nReference(0),
+ nSepLineWidth(0),
+ nSepLineColor(0), //black
+ nSepLineHeightRelative(100),//full height
+ nSepLineVertAlign(style::VerticalAlignment_MIDDLE),
+ bSepLineIsOn(sal_False),
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_COLUMS)),
+ bIsAutomaticWidth(sal_True),
+ nAutoDistance(0)
+{
+ if(nColCount)
+ setColumnCount(nColCount);
+}
+
+SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) :
+ aTextColumns(rFmtCol.GetNumCols()),
+ nReference(0),
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_COLUMS)),
+ bIsAutomaticWidth(rFmtCol.IsOrtho())
+{
+ USHORT nItemGutterWidth = rFmtCol.GetGutterWidth();
+ nAutoDistance = bIsAutomaticWidth ?
+ USHRT_MAX == nItemGutterWidth ? DEF_GUTTER_WIDTH : (sal_Int32)nItemGutterWidth
+ : 0;
+ nAutoDistance = TWIP_TO_MM100(nAutoDistance);
+
+ TextColumn* pColumns = aTextColumns.getArray();
+ const SwColumns& rCols = rFmtCol.GetColumns();
+ for(sal_uInt16 i = 0; i < aTextColumns.getLength(); i++)
+ {
+ SwColumn* pCol = rCols[i];
+
+ pColumns[i].Width = pCol->GetWishWidth();
+ nReference += pColumns[i].Width;
+ pColumns[i].LeftMargin = TWIP_TO_MM100(pCol->GetLeft ());
+ pColumns[i].RightMargin = TWIP_TO_MM100(pCol->GetRight());
+ }
+ if(!aTextColumns.getLength())
+ nReference = USHRT_MAX;
+
+ nSepLineWidth = rFmtCol.GetLineWidth();
+ nSepLineColor = rFmtCol.GetLineColor().GetColor();
+ nSepLineHeightRelative = rFmtCol.GetLineHeight();
+ bSepLineIsOn = rFmtCol.GetLineAdj() != COLADJ_NONE;
+ switch(rFmtCol.GetLineAdj())
+ {
+ case COLADJ_TOP: nSepLineVertAlign = style::VerticalAlignment_TOP; break;
+ case COLADJ_BOTTOM: nSepLineVertAlign = style::VerticalAlignment_BOTTOM; break;
+ case COLADJ_CENTER:
+ case COLADJ_NONE: nSepLineVertAlign = style::VerticalAlignment_MIDDLE;
+ }
+}
+
+SwXTextColumns::~SwXTextColumns()
+{
+}
+
+sal_Int32 SwXTextColumns::getReferenceValue(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return nReference;
+}
+
+sal_Int16 SwXTextColumns::getColumnCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return aTextColumns.getLength();
+}
+
+void SwXTextColumns::setColumnCount(sal_Int16 nColumns) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(nColumns <= 0)
+ throw uno::RuntimeException();
+ bIsAutomaticWidth = sal_True;
+ aTextColumns.realloc(nColumns);
+ TextColumn* pCols = aTextColumns.getArray();
+ nReference = USHRT_MAX;
+ sal_uInt16 nWidth = nReference / nColumns;
+ sal_uInt16 nDiff = nReference - nWidth * nColumns;
+ sal_Int32 nDist = nAutoDistance / 2;
+ for(sal_Int16 i = 0; i < nColumns; i++)
+ {
+ pCols[i].Width = nWidth;
+ pCols[i].LeftMargin = i == 0 ? 0 : nDist;
+ pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
+ }
+ pCols[nColumns - 1].Width += nDiff;
+}
+
+uno::Sequence< TextColumn > SwXTextColumns::getColumns(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return aTextColumns;
+}
+
+void SwXTextColumns::setColumns(const uno::Sequence< TextColumn >& rColumns)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_uInt16 nReferenceTemp = 0;
+ const TextColumn* prCols = rColumns.getConstArray();
+ for(long i = 0; i < rColumns.getLength(); i++)
+ {
+ //wenn die Breite Null ist, oder die Raender breiter als die Spalte werden -> exception
+ if(!prCols[i].Width ||
+ prCols[i].LeftMargin + prCols[i].RightMargin >= prCols[i].Width)
+ throw uno::RuntimeException();
+ nReferenceTemp += prCols[i].Width;
+ }
+ bIsAutomaticWidth = sal_False;
+ nReference = !nReferenceTemp ? USHRT_MAX : nReferenceTemp;
+ aTextColumns = rColumns;
+}
+
+Reference< XPropertySetInfo > SwXTextColumns::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef = new SfxItemPropertySetInfo( _pMap );
+ return aRef;
+}
+
+void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+{
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch(pMap->nWID)
+ {
+ case WID_TXTCOL_LINE_WIDTH:
+ {
+ sal_Int32 nTmp; aValue >>= nTmp;
+ if(nTmp < 0)
+ throw IllegalArgumentException();
+ nSepLineWidth = MM100_TO_TWIP(nTmp);
+ }
+ break;
+ case WID_TXTCOL_LINE_COLOR:
+ aValue >>= nSepLineColor;
+ break;
+ case WID_TXTCOL_LINE_REL_HGT:
+ {
+ sal_Int8 nTmp; aValue >>= nTmp;
+ if(nTmp < 0)
+ throw IllegalArgumentException();
+ nSepLineHeightRelative = nTmp;
+ }
+ break;
+ case WID_TXTCOL_LINE_ALIGN:
+ {
+ style::VerticalAlignment eAlign;
+ if(!(aValue >>= eAlign) )
+ {
+ sal_Int8 nTmp;
+ if (! ( aValue >>= nTmp ) )
+ throw IllegalArgumentException();
+ else
+ nSepLineVertAlign = static_cast < style::VerticalAlignment > ( nTmp );
+ }
+ else
+ nSepLineVertAlign = eAlign;
+ }
+ break;
+ case WID_TXTCOL_LINE_IS_ON:
+ bSepLineIsOn = *(sal_Bool*)aValue.getValue();
+ break;
+ case WID_TXTCOL_AUTO_DISTANCE:
+ {
+ sal_Int32 nTmp;
+ aValue >>= nTmp;
+ if(nTmp < 0 || nTmp >= nReference)
+ throw IllegalArgumentException();
+ nAutoDistance = nTmp;
+ sal_Int32 nColumns = aTextColumns.getLength();
+ TextColumn* pCols = aTextColumns.getArray();
+ sal_Int32 nDist = nAutoDistance / 2;
+ for(sal_Int32 i = 0; i < nColumns; i++)
+ {
+ pCols[i].LeftMargin = i == 0 ? 0 : nDist;
+ pCols[i].RightMargin = i == nColumns - 1 ? 0 : nDist;
+ }
+ }
+ break;
+ }
+}
+
+Any SwXTextColumns::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ Any aRet;
+ switch(pMap->nWID)
+ {
+ case WID_TXTCOL_LINE_WIDTH:
+ aRet <<= static_cast < sal_Int32 >(TWIP_TO_MM100(nSepLineWidth));
+ break;
+ case WID_TXTCOL_LINE_COLOR:
+ aRet <<= nSepLineColor;
+ break;
+ case WID_TXTCOL_LINE_REL_HGT:
+ aRet <<= nSepLineHeightRelative;
+ break;
+ case WID_TXTCOL_LINE_ALIGN:
+ aRet <<= (style::VerticalAlignment)nSepLineVertAlign;
+ break;
+ case WID_TXTCOL_LINE_IS_ON:
+ aRet.setValue(&bSepLineIsOn, ::getBooleanCppuType());
+ break;
+ case WID_TXTCOL_IS_AUTOMATIC :
+ aRet.setValue(&bIsAutomaticWidth, ::getBooleanCppuType());
+ break;
+ case WID_TXTCOL_AUTO_DISTANCE:
+ aRet <<= nAutoDistance;
+ break;
+ }
+ return aRet;
+}
+
+void SwXTextColumns::addPropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXTextColumns::removePropertyChangeListener(
+ const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXTextColumns::addVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+void SwXTextColumns::removeVetoableChangeListener(
+ const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+
+const uno::Sequence< sal_Int8 > & SwXTextColumns::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXTextColumns::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unosrch.cxx b/binfilter/bf_sw/source/core/unocore/sw_unosrch.cxx
new file mode 100644
index 000000000000..b7617c2d384e
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unosrch.cxx
@@ -0,0 +1,778 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <hints.hxx>
+#include <unosrch.hxx>
+#include <unomap.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+/******************************************************************************
+ *
+ ******************************************************************************/
+
+/* -----------------23.06.99 12:19-------------------
+
+ --------------------------------------------------*/
+class SwSearchProperties_Impl
+{
+ PropertyValue** pValueArr; //
+ sal_uInt16 nArrLen;
+public:
+ SwSearchProperties_Impl();
+ ~SwSearchProperties_Impl();
+
+ void SetProperties(const Sequence< PropertyValue >& aSearchAttribs)
+ throw( UnknownPropertyException, lang::IllegalArgumentException, RuntimeException );
+ const Sequence< PropertyValue > GetProperties() const;
+
+ void FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const;
+ sal_Bool HasAttributes() const;
+};
+/* -----------------23.06.99 13:08-------------------
+
+ --------------------------------------------------*/
+SwSearchProperties_Impl::SwSearchProperties_Impl() :
+ nArrLen(0)
+{
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR);
+ while(pMap->nWID)
+ {
+ if(pMap->nWID < RES_FRMATR_END)
+ nArrLen++;
+ pMap++;
+ }
+ pValueArr = new PropertyValue*[nArrLen];
+ *pValueArr = new PropertyValue[nArrLen];
+ for(sal_uInt16 i = 0; i < nArrLen; i++)
+ pValueArr[i] = 0;
+}
+/* -----------------23.06.99 13:08-------------------
+
+ --------------------------------------------------*/
+SwSearchProperties_Impl::~SwSearchProperties_Impl()
+{
+ for(sal_uInt16 i = 0; i < nArrLen; i++)
+ delete pValueArr[i];
+ delete[] pValueArr;
+}
+/* -----------------23.06.99 13:09-------------------
+
+ --------------------------------------------------*/
+void SwSearchProperties_Impl::SetProperties(const Sequence< PropertyValue >& aSearchAttribs)
+ throw( UnknownPropertyException, lang::IllegalArgumentException, RuntimeException )
+{
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR);
+ long nLen = aSearchAttribs.getLength();
+ const PropertyValue* pProps = aSearchAttribs.getConstArray();
+ //delete all existing values
+ long i=0;
+ for( i = 0; i < nArrLen; i++)
+ {
+ delete pValueArr[i];
+ pValueArr[i] = 0;
+ }
+
+ for(i = 0; i < nLen; i++)
+ {
+ String sPropertyName(pProps[i].Name);
+ sal_uInt16 nIndex = 0;
+ const SfxItemPropertyMap* pTempMap = pMap;
+ while(pTempMap->nWID && !sPropertyName.EqualsAscii(pTempMap->pName))
+ {
+ pTempMap++;
+ nIndex++;
+ }
+ if(!pTempMap->nWID)
+ throw UnknownPropertyException();
+ pValueArr[nIndex] = new PropertyValue(pProps[i]);
+ }
+}
+/* -----------------23.06.99 13:08-------------------
+
+ --------------------------------------------------*/
+const Sequence< PropertyValue > SwSearchProperties_Impl::GetProperties() const
+{
+ sal_uInt16 nPropCount = 0;
+ sal_uInt16 i=0;
+ for(i = 0; i < nArrLen; i++)
+ if(pValueArr[i])
+ nPropCount++;
+
+ Sequence< PropertyValue > aRet(nPropCount);
+ PropertyValue* pProps = aRet.getArray();
+ nPropCount = 0;
+ for(i = 0; i < nArrLen; i++)
+ {
+ if(pValueArr[i])
+ {
+ pProps[nPropCount] = *(pValueArr[i]);
+ }
+ nPropCount++;
+ }
+ return aRet;
+}
+/* -----------------23.06.99 13:06-------------------
+
+ --------------------------------------------------*/
+void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSearch) const
+{
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR);
+ //
+
+ SfxPoolItem* pBoxItem = 0,
+ *pBreakItem = 0,
+ *pAutoKernItem = 0,
+ *pWLineItem = 0,
+ *pTabItem = 0,
+ *pSplitItem = 0,
+ *pRegItem = 0,
+ *pLineSpaceItem = 0,
+ *pLineNumItem = 0,
+ *pKeepItem = 0,
+ *pLRItem = 0,
+ *pULItem = 0,
+ *pBackItem = 0,
+ *pAdjItem = 0,
+ *pDescItem = 0,
+ *pInetItem = 0,
+ *pDropItem = 0,
+ *pWeightItem = 0,
+ *pULineItem = 0,
+ *pCharFmtItem = 0,
+ *pShadItem = 0,
+ *pPostItem = 0,
+ *pNHyphItem = 0,
+ *pLangItem = 0,
+ *pKernItem = 0,
+ *pFontSizeItem = 0,
+ *pFontItem = 0,
+ *pBlinkItem = 0,
+ *pEscItem = 0,
+ *pCrossedOutItem = 0,
+ *pContourItem = 0,
+ *pCharColorItem = 0,
+ *pCasemapItem = 0,
+ *pBrushItem = 0;
+
+ for(sal_uInt16 i = 0; i < nArrLen; i++)
+ {
+ if(pValueArr[i])
+ {
+ const SfxItemPropertyMap* pTempMap = pMap + i;
+ SfxPoolItem* pTempItem = 0;
+ switch(pTempMap->nWID)
+ {
+ case RES_BOX:
+ if(!pBoxItem)
+ pBoxItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pBoxItem;
+ break;
+ case RES_BREAK:
+ if(!pBreakItem)
+ pBreakItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pBreakItem;
+ break;
+ case RES_CHRATR_AUTOKERN:
+ if(!pAutoKernItem)
+ pAutoKernItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pAutoKernItem;
+ break;
+ case RES_CHRATR_BACKGROUND:
+ if(!pBrushItem)
+ pBrushItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pBrushItem;
+ break;
+ case RES_CHRATR_CASEMAP:
+ if(!pCasemapItem)
+ pCasemapItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pCasemapItem;
+ break;
+ case RES_CHRATR_COLOR:
+ if(!pCharColorItem)
+ pCharColorItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pCharColorItem;
+ break;
+ case RES_CHRATR_CONTOUR:
+ if(!pContourItem)
+ pContourItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pContourItem;
+ break;
+ case RES_CHRATR_CROSSEDOUT:
+ if(!pCrossedOutItem)
+ pCrossedOutItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pCrossedOutItem;
+ break;
+ case RES_CHRATR_ESCAPEMENT:
+ if(!pEscItem)
+ pEscItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pEscItem;
+ break;
+ case RES_CHRATR_BLINK:
+ if(!pBlinkItem)
+ pBlinkItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pBlinkItem;
+ break;
+ case RES_CHRATR_FONT:
+ if(!pFontItem)
+ pFontItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pFontItem;
+ break;
+ case RES_CHRATR_FONTSIZE:
+ if(!pFontSizeItem)
+ pFontSizeItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pFontSizeItem;
+ break;
+ case RES_CHRATR_KERNING:
+ if(!pKernItem)
+ pKernItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pKernItem;
+ break;
+ case RES_CHRATR_LANGUAGE:
+ if(!pLangItem)
+ pLangItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pLangItem;
+ break;
+ case RES_CHRATR_NOHYPHEN:
+ if(!pNHyphItem)
+ pNHyphItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pNHyphItem;
+ break;
+ case RES_CHRATR_POSTURE:
+ if(!pPostItem)
+ pPostItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pPostItem;
+ break;
+ case RES_CHRATR_SHADOWED:
+ if(!pShadItem)
+ pShadItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pShadItem;
+ break;
+ case RES_TXTATR_CHARFMT:
+ if(!pCharFmtItem)
+ pCharFmtItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pCharFmtItem;
+ break;
+ case RES_CHRATR_UNDERLINE:
+ if(!pULineItem)
+ pULineItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pULineItem;
+ break;
+ case RES_CHRATR_WEIGHT:
+ if(!pWeightItem)
+ pWeightItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pWeightItem;
+ break;
+ case RES_PARATR_DROP:
+ if(!pDropItem)
+ pDropItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pDropItem;
+ break;
+ case RES_TXTATR_INETFMT:
+ if(!pInetItem)
+ pInetItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pInetItem;
+ break;
+ case RES_PAGEDESC:
+ if(!pDescItem)
+ pDescItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pDescItem;
+ break;
+ case RES_PARATR_ADJUST:
+ if(!pAdjItem)
+ pAdjItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pAdjItem;
+ break;
+ case RES_BACKGROUND:
+ if(!pBackItem)
+ pBackItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pBackItem;
+ break;
+ case RES_UL_SPACE:
+ if(!pULItem)
+ pULItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pULItem;
+ break;
+ case RES_LR_SPACE:
+ if(!pLRItem)
+ pLRItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pLRItem;
+ break;
+ case RES_KEEP:
+ if(!pKeepItem)
+ pKeepItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pKeepItem;
+ break;
+ case RES_LINENUMBER:
+ if(!pLineNumItem)
+ pLineNumItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pLineNumItem;
+ break;
+ case RES_PARATR_LINESPACING:
+ if(!pLineSpaceItem)
+ pLineSpaceItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pLineSpaceItem;
+ break;
+ case RES_PARATR_REGISTER:
+ if(!pRegItem)
+ pRegItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pRegItem;
+ break;
+ case RES_PARATR_SPLIT:
+ if(!pSplitItem)
+ pSplitItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pSplitItem;
+ break;
+ case RES_PARATR_TABSTOP:
+ if(!pTabItem)
+ pTabItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pTabItem;
+ break;
+ case RES_CHRATR_WORDLINEMODE:
+ if(!pWLineItem)
+ pWLineItem = rSet.GetPool()->GetDefaultItem(pTempMap->nWID).Clone();
+ pTempItem = pWLineItem;
+ break;
+ }
+ if(pTempItem)
+ {
+ if(bIsValueSearch)
+ {
+ pTempItem->PutValue(pValueArr[i]->Value, pTempMap->nMemberId);
+ rSet.Put(*pTempItem);
+ }
+ else
+ rSet.InvalidateItem( pTempItem->Which() );
+ }
+ }
+ }
+ delete pBoxItem;
+ delete pBreakItem;
+ delete pBreakItem ;
+ delete pAutoKernItem ;
+ delete pWLineItem;
+ delete pTabItem;
+ delete pSplitItem;
+ delete pRegItem;
+ delete pLineSpaceItem ;
+ delete pLineNumItem ;
+ delete pKeepItem;
+ delete pLRItem ;
+ delete pULItem ;
+ delete pBackItem;
+ delete pAdjItem;
+ delete pDescItem;
+ delete pInetItem;
+ delete pDropItem;
+ delete pWeightItem;
+ delete pULineItem;
+ delete pCharFmtItem ;
+ delete pShadItem;
+ delete pPostItem;
+ delete pNHyphItem;
+ delete pLangItem;
+ delete pKernItem;
+ delete pFontSizeItem ;
+ delete pFontItem;
+ delete pBlinkItem;
+ delete pEscItem;
+ delete pCrossedOutItem;
+ delete pContourItem ;
+ delete pCharColorItem;
+ delete pCasemapItem ;
+ delete pBrushItem ;
+}
+/* -----------------23.06.99 14:18-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwSearchProperties_Impl::HasAttributes() const
+{
+ for(sal_uInt16 i = 0; i < nArrLen; i++)
+ if(pValueArr[i])
+ return sal_True;
+ return sal_False;
+}
+
+/*-- 14.12.98 13:07:10 ---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSearch::SwXTextSearch() :
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_SEARCH)),
+ pSearchProperties( new SwSearchProperties_Impl),
+ pReplaceProperties( new SwSearchProperties_Impl),
+ bIsValueSearch(sal_True),
+ bAll(sal_False),
+ bWord(sal_False),
+ bBack(sal_False),
+ bExpr(sal_False),
+ bCase(sal_False),
+ bStyles(sal_False),
+ bSimilarity(sal_False),
+ bLevRelax(sal_False),
+ nLevExchange(2),
+ nLevAdd(2),
+ nLevRemove(2)
+{
+}
+/*-- 14.12.98 13:07:12 ---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextSearch::~SwXTextSearch()
+{
+ delete pSearchProperties;
+ delete pReplaceProperties;
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const Sequence< sal_Int8 > & SwXTextSearch::getUnoTunnelId()
+{
+ static Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextSearch::getSomething( const Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextSearch::getSearchString(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return sSearchText;
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setSearchString(const OUString& rString)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sSearchText = String(rString);
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextSearch::getReplaceString(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return sReplaceText;
+}
+/*-- 14.12.98 13:07:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setReplaceString(const OUString& rReplaceString) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sReplaceText = String(rReplaceString);
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXTextSearch::getPropertySetInfo(void) throw( RuntimeException )
+{
+ static Reference< XPropertySetInfo > aRef = new SfxItemPropertySetInfo(_pMap);
+ return aRef;
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setPropertyValue(const OUString& rPropertyName, const Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ sal_Bool bVal = FALSE;
+ if(aValue.getValueType() == ::getBooleanCppuType())
+ bVal = *(sal_Bool*)aValue.getValue();
+ switch(pMap->nWID)
+ {
+ case WID_SEARCH_ALL : bAll = bVal; break;
+ case WID_WORDS: bWord = bVal; break;
+ case WID_BACKWARDS : bBack = bVal; break;
+ case WID_REGULAR_EXPRESSION : bExpr = bVal; break;
+ case WID_CASE_SENSITIVE : bCase = bVal; break;
+ //case WID_IN_SELECTION : bInSel = bVal; break;
+ case WID_STYLES : bStyles = bVal; break;
+ case WID_SIMILARITY : bSimilarity = bVal; break;
+ case WID_SIMILARITY_RELAX: bLevRelax = bVal; break;
+ case WID_SIMILARITY_EXCHANGE: aValue >>= nLevExchange; break;
+ case WID_SIMILARITY_ADD: aValue >>= nLevAdd; break;
+ case WID_SIMILARITY_REMOVE : aValue >>= nLevRemove;break;
+ break;
+ };
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXTextSearch::getPropertyValue(const OUString& rPropertyName) throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Any aRet;
+
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ sal_Bool bSet = sal_False;
+ sal_Int16 nSet = 0;
+ if(pMap)
+ {
+ switch(pMap->nWID)
+ {
+ case WID_SEARCH_ALL : bSet = bAll; goto SET_BOOL;
+ case WID_WORDS: bSet = bWord; goto SET_BOOL;
+ case WID_BACKWARDS : bSet = bBack; goto SET_BOOL;
+ case WID_REGULAR_EXPRESSION : bSet = bExpr; goto SET_BOOL;
+ case WID_CASE_SENSITIVE : bSet = bCase; goto SET_BOOL;
+ //case WID_IN_SELECTION : bSet = bInSel; goto SET_BOOL;
+ case WID_STYLES : bSet = bStyles; goto SET_BOOL;
+ case WID_SIMILARITY : bSet = bSimilarity; goto SET_BOOL;
+ case WID_SIMILARITY_RELAX: bSet = bLevRelax;
+SET_BOOL:
+ aRet.setValue(&bSet, ::getBooleanCppuType());
+ break;
+ case WID_SIMILARITY_EXCHANGE: nSet = nLevExchange; goto SET_UINT16;
+ case WID_SIMILARITY_ADD: nSet = nLevAdd; goto SET_UINT16;
+ case WID_SIMILARITY_REMOVE : nSet = nLevRemove;
+SET_UINT16:
+ aRet <<= nSet;
+ break;
+ };
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ return aRet;
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::addPropertyChangeListener(const OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::removePropertyChangeListener(const OUString& PropertyName, const Reference< XPropertyChangeListener > & aListener) throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::addVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::removeVetoableChangeListener(const OUString& PropertyName, const Reference< XVetoableChangeListener > & aListener) throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 14.12.98 13:07:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextSearch::getValueSearch(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return bIsValueSearch;
+}
+/*-- 14.12.98 13:07:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setValueSearch(sal_Bool ValueSearch_) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ bIsValueSearch = ValueSearch_;
+}
+/*-- 14.12.98 13:07:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< PropertyValue > SwXTextSearch::getSearchAttributes(void) throw( RuntimeException )
+{
+ return pSearchProperties->GetProperties();
+}
+/*-- 14.12.98 13:07:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setSearchAttributes(const Sequence< PropertyValue >& rSearchAttribs)
+ throw( UnknownPropertyException, lang::IllegalArgumentException, RuntimeException )
+{
+ pSearchProperties->SetProperties(rSearchAttribs);
+}
+/*-- 14.12.98 13:07:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< PropertyValue > SwXTextSearch::getReplaceAttributes(void)
+ throw( RuntimeException )
+{
+ return pReplaceProperties->GetProperties();
+}
+/*-- 14.12.98 13:07:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextSearch::setReplaceAttributes(const Sequence< PropertyValue >& rReplaceAttribs)
+ throw( UnknownPropertyException, lang::IllegalArgumentException, RuntimeException )
+{
+ pReplaceProperties->SetProperties(rReplaceAttribs);
+}
+/* -----------------23.06.99 14:13-------------------
+
+ --------------------------------------------------*/
+void SwXTextSearch::FillSearchItemSet(SfxItemSet& rSet) const
+{
+ pSearchProperties->FillItemSet(rSet, bIsValueSearch);
+}
+/* -----------------23.06.99 14:14-------------------
+
+ --------------------------------------------------*/
+void SwXTextSearch::FillReplaceItemSet(SfxItemSet& rSet) const
+{
+ pReplaceProperties->FillItemSet(rSet, bIsValueSearch);
+}
+/* -----------------23.06.99 14:17-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextSearch::HasSearchAttributes() const
+{
+ return pSearchProperties->HasAttributes();
+}
+/* -----------------23.06.99 14:17-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwXTextSearch::HasReplaceAttributes() const
+{
+ return pReplaceProperties->HasAttributes();
+}
+/* -----------------------------19.04.00 14:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextSearch::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextSearch");
+}
+/* -----------------------------19.04.00 14:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextSearch::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.util.SearchDescriptor") == rServiceName ||
+ C2U("com.sun.star.util.ReplaceDescriptor") == rServiceName;
+}
+/* -----------------------------19.04.00 14:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextSearch::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.util.SearchDescriptor");
+ pArray[1] = C2U("com.sun.star.util.ReplaceDescriptor");
+ return aRet;
+}
+
+void SwXTextSearch::FillSearchOptions( SearchOptions& rSearchOpt ) const
+{
+ if( bSimilarity )
+ {
+ rSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE;
+ rSearchOpt.changedChars = nLevExchange;
+ rSearchOpt.deletedChars = nLevRemove;
+ rSearchOpt.insertedChars = nLevAdd;
+ if( bLevRelax )
+ rSearchOpt.searchFlag |= SearchFlags::LEV_RELAXED;
+ }
+ else if( bExpr )
+ rSearchOpt.algorithmType = SearchAlgorithms_REGEXP;
+ else
+ rSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE;
+
+ rSearchOpt.Locale = CreateLocale( GetAppLanguage() );
+ rSearchOpt.searchString = sSearchText;
+ rSearchOpt.replaceString = sReplaceText;
+
+ if( !bCase )
+ rSearchOpt.transliterateFlags |= TransliterationModules_IGNORE_CASE;
+ if( bWord )
+ rSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY;
+
+// bInSel: 1; // wie geht das?
+// TODO: pSearch->bStyles!
+// inSelection??
+// aSrchParam.SetSrchInSelection(TypeConversion::toBOOL(aVal));
+}
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unostyle.cxx b/binfilter/bf_sw/source/core/unocore/sw_unostyle.cxx
new file mode 100644
index 000000000000..f2dcbc592b6c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unostyle.cxx
@@ -0,0 +1,3333 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <hintids.hxx>
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <bf_svtools/smplhint.hxx>
+#include <bf_svtools/ctrltool.hxx>
+#include <bf_svtools/style.hxx>
+#include <bf_so3/svstor.hxx>
+
+#ifndef _SVX_PAGEITEM_HXX //autogen
+#define ITEMID_SETITEM
+#include <bf_svx/pageitem.hxx>
+#endif
+#ifndef _SVX_SIZEITEM_HXX //autogen
+#define ITEMID_SIZE SID_ATTR_PAGE_SIZE
+#include <bf_svx/sizeitem.hxx>
+#endif
+#include <bf_svx/ulspitem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/boxitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <bf_svx/brshitem.hxx>
+#include <bf_svx/flstitem.hxx>
+#include <bf_svx/svxids.hrc>
+#include <bf_svx/paperinf.hxx>
+#include <pagedesc.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docary.hxx>
+#include <charfmt.hxx>
+#include <cmdid.h>
+
+#include <cppuhelper/implbase4.hxx>
+
+#include <unostyle.hxx>
+#include <unomap.hxx>
+#include <unosett.hxx>
+#include <docsh.hxx>
+#include <swstyle.h>
+#include <paratr.hxx>
+#include <unomid.h>
+#include <unoprnms.hxx>
+#include <shellio.hxx>
+#include <docstyle.hxx>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <fmthdft.hxx>
+#include <fmtpdsc.hxx>
+#include <tools/urlobj.hxx>
+#include <poolfmt.hrc>
+#include <poolfmt.hxx>
+#include "unoevent.hxx"
+#include <fmtruby.hxx>
+#include <com/sun/star/style/ParagraphStyleCategory.hpp>
+#include <SwStyleNameMapper.hxx>
+#include <bf_sfx2/printer.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <GetMetricVal.hxx>
+#include <fmtfsize.hxx>
+#define STYLE_FAMILY_COUNT 5 // we have 5 style families
+#define TYPE_BOOL 0
+#define TYPE_SIZE 1
+#define TYPE_BRUSH 2
+#define TYPE_ULSPACE 3
+#define TYPE_SHADOW 4
+#define TYPE_LRSPACE 5
+#define TYPE_BOX 6
+namespace binfilter {
+
+const unsigned short aStyleByIndex[] =
+{
+ SFX_STYLE_FAMILY_CHAR,
+ SFX_STYLE_FAMILY_PARA,
+ SFX_STYLE_FAMILY_PAGE ,
+ SFX_STYLE_FAMILY_FRAME ,
+ SFX_STYLE_FAMILY_PSEUDO
+};
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::container;
+using ::com::sun::star::frame::XModel;
+
+using rtl::OUString;
+/******************************************************************************
+ *
+ ******************************************************************************/
+//convert FN_... to RES_ in header and footer itemset
+sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId)
+{
+ sal_uInt16 nRes = USHRT_MAX;
+ switch(nFNId)
+ {
+ case FN_UNO_FOOTER_ON:
+ case FN_UNO_HEADER_ON:
+ break;
+ case FN_UNO_FOOTER_BACKGROUND:
+ case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND;
+ break;
+ case FN_UNO_FOOTER_BOX:
+ case FN_UNO_HEADER_BOX: nRes = RES_BOX;
+ break;
+ case FN_UNO_FOOTER_LR_SPACE:
+ case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;
+ break;
+ case FN_UNO_FOOTER_SHADOW:
+ case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;
+ break;
+ case FN_UNO_FOOTER_BODY_DISTANCE:
+ case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;
+ break;
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
+ break;
+ case FN_UNO_FOOTER_SHARE_CONTENT:
+ case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED;
+ break;
+ case FN_UNO_FOOTER_HEIGHT:
+ case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;
+ break;
+ case FN_UNO_FOOTER_EAT_SPACING:
+ case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;
+ break;
+ }
+ return nRes;
+
+}
+
+SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum ( SfxStyleFamily eFamily )
+{
+ switch ( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ return GET_POOLID_CHRFMT;
+ case SFX_STYLE_FAMILY_PARA:
+ return GET_POOLID_TXTCOLL;
+ case SFX_STYLE_FAMILY_FRAME:
+ return GET_POOLID_FRMFMT;
+ case SFX_STYLE_FAMILY_PAGE:
+ return GET_POOLID_PAGEDESC;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ return GET_POOLID_NUMRULE;
+ default:
+ DBG_ASSERT(sal_False, "someone asking for all styles in unostyle.cxx!" );
+ return GET_POOLID_CHRFMT;
+ }
+}
+
+/******************************************************************
+ * SwXStyleFamilies
+ ******************************************************************/
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXStyleFamilies::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXStyleFamilies");
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXStyleFamilies::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.style.StyleFamilies") == rServiceName;
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXStyleFamilies::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.style.StyleFamilies");
+ return aRet;
+}
+/*-- 16.12.98 15:13:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamilies::SwXStyleFamilies(SwDocShell& rDocShell) :
+ SwUnoCollection(rDocShell.GetDoc()),
+ pxCharStyles(0),
+ pxParaStyles(0),
+ pxFrameStyles(0),
+ pxPageStyles(0),
+ pxNumberingStyles(0),
+ pDocShell(&rDocShell)
+{
+
+}
+/*-- 16.12.98 15:13:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamilies::~SwXStyleFamilies()
+{
+ delete pxCharStyles;
+ delete pxParaStyles;
+ delete pxFrameStyles;
+ delete pxPageStyles;
+ delete pxNumberingStyles;
+}
+/*-- 21.12.98 12:05:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SAL_CALL SwXStyleFamilies::getByName(const OUString& Name)
+ throw(
+ container::NoSuchElementException,
+ lang::WrappedTargetException,
+ RuntimeException )
+{
+ SolarMutexGuard aGuard;
+// der Index kommt aus const unsigned short aStyleByIndex[] =
+ Any aRet;
+ if(!IsValid())
+ throw RuntimeException();
+ if(Name.compareToAscii("CharacterStyles") == 0 )
+ aRet = getByIndex(0);
+ else if(Name.compareToAscii("ParagraphStyles") == 0)
+ aRet = getByIndex(1);
+ else if(Name.compareToAscii("FrameStyles") == 0 )
+ aRet = getByIndex(3);
+ else if(Name.compareToAscii("PageStyles") == 0 )
+ aRet = getByIndex(2);
+ else if(Name.compareToAscii("NumberingStyles") == 0 )
+ aRet = getByIndex(4);
+ else
+ throw container::NoSuchElementException();
+ return aRet;
+}
+/*-- 21.12.98 12:05:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXStyleFamilies::getElementNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aNames(STYLE_FAMILY_COUNT);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = C2U("CharacterStyles");
+ pNames[1] = C2U("ParagraphStyles");
+ pNames[2] = C2U("FrameStyles");
+ pNames[3] = C2U("PageStyles");
+ pNames[4] = C2U("NumberingStyles");
+ return aNames;
+}
+/*-- 21.12.98 12:05:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamilies::hasByName(const OUString& Name) throw( RuntimeException )
+{
+ if( Name.compareToAscii("CharacterStyles") == 0 ||
+ Name.compareToAscii("ParagraphStyles") == 0 ||
+ Name.compareToAscii("FrameStyles") == 0 ||
+ Name.compareToAscii("PageStyles") == 0 ||
+ Name.compareToAscii("NumberingStyles") == 0 )
+ return sal_True;
+ else
+ return sal_False;
+}
+/*-- 16.12.98 15:13:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXStyleFamilies::getCount(void) throw( RuntimeException )
+{
+ return STYLE_FAMILY_COUNT;
+}
+/*-- 16.12.98 15:13:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXStyleFamilies::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Any aRet;
+ if(nIndex >= STYLE_FAMILY_COUNT)
+ throw lang::IndexOutOfBoundsException();
+ if(IsValid())
+ {
+ Reference< container::XNameContainer > aRef;
+ sal_uInt16 nType = aStyleByIndex[nIndex];
+ switch( nType )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ if(!pxCharStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxCharStyles = new Reference< container::XNameContainer > ();
+ *pxCharStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxCharStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ if(!pxParaStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxParaStyles = new Reference< container::XNameContainer > ();
+ *pxParaStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxParaStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ if(!pxPageStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxPageStyles = new Reference< container::XNameContainer > ();
+ *pxPageStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxPageStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ if(!pxFrameStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxFrameStyles = new Reference< container::XNameContainer > ();
+ *pxFrameStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxFrameStyles;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ if(!pxNumberingStyles)
+ {
+ ((SwXStyleFamilies*)this)->pxNumberingStyles = new Reference< container::XNameContainer > ();
+ *pxNumberingStyles = new SwXStyleFamily(pDocShell, nType);
+ }
+ aRef = *pxNumberingStyles;
+ }
+ break;
+ }
+ aRet.setValue(&aRef, ::getCppuType((const Reference<container::XNameContainer>*)0));
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+/*-- 16.12.98 15:13:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Type SwXStyleFamilies::getElementType(void)
+ throw( RuntimeException )
+{
+ return ::getCppuType((const Reference<container::XNameContainer>*)0);
+
+}
+/*-- 16.12.98 15:13:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamilies::hasElements(void) throw( RuntimeException )
+{
+ return sal_True;
+}
+/*-- 16.12.98 15:13:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamilies::loadStylesFromURL(const OUString& rURL,
+ const Sequence< PropertyValue >& aOptions)
+ throw( io::IOException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bLoadStyleText = sal_True;
+ sal_Bool LoadStyleFrame = sal_True;
+ sal_Bool bLoadStylePage = sal_True;
+ sal_Bool bLoadStyleOverwrite = sal_True;
+ sal_Bool bLoadStyleNumbering = sal_True;
+ sal_Bool bLoadStyleFrame = sal_True;
+ if(IsValid() && rURL.getLength())
+ {
+ const Any* pVal;
+ int nCount = aOptions.getLength();
+ const PropertyValue* pArray = aOptions.getConstArray();
+ for(int i = 0; i < nCount; i++)
+ if( ( pVal = &pArray[i].Value)->getValueType() ==
+ ::getBooleanCppuType() )
+ {
+ String sName = pArray[i].Name;
+ sal_Bool bVal = *(sal_Bool*)pVal->getValue();
+ if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_OVERWRITE_STYLES )))
+ bLoadStyleOverwrite = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_NUMBERING_STYLES )))
+ bLoadStyleNumbering = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_PAGE_STYLES )))
+ bLoadStylePage = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_FRAME_STYLES )))
+ bLoadStyleFrame = bVal;
+ else if( sName.EqualsAscii(SW_PROP_NAME_STR(UNO_NAME_LOAD_TEXT_STYLES )))
+ bLoadStyleText = bVal;
+ }
+
+ SwgReaderOption aOpt;
+ aOpt.SetFrmFmts( bLoadStyleFrame );
+ aOpt.SetTxtFmts( bLoadStyleText );
+ aOpt.SetPageDescs( bLoadStylePage );
+ aOpt.SetNumRules( bLoadStyleNumbering );
+ aOpt.SetMerge( !bLoadStyleOverwrite );
+
+ ULONG nErr = pDocShell->LoadStylesFromFile( rURL, aOpt, TRUE );
+ if( nErr )
+ throw io::IOException();
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 16.12.98 15:13:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< PropertyValue > SwXStyleFamilies::getStyleLoaderOptions(void)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Sequence< PropertyValue > aSeq(5);
+ PropertyValue* pArray = aSeq.getArray();
+ Any aVal;
+ sal_Bool bTemp = sal_True;
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[0] = PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_TEXT_STYLES)), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[1] = PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_FRAME_STYLES)), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[2] = PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_PAGE_STYLES)), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[3] = PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LOAD_NUMBERING_STYLES)), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[4] = PropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_OVERWRITE_STYLES)), -1, aVal, PropertyState_DIRECT_VALUE);
+ return aSeq;
+}
+
+/******************************************************************
+ * SwXStyleFamily
+ ******************************************************************/
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXStyleFamily::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXStyleFamily");
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXStyleFamily::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.style.StyleFamily") == rServiceName;
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXStyleFamily::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.style.StyleFamily");
+ return aRet;
+}
+/*-- 16.12.98 16:03:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamily::SwXStyleFamily(SwDocShell* pDocSh, sal_uInt16 nFamily) :
+ pBasePool(pDocSh->GetStyleSheetPool()),
+ pDocShell(pDocSh),
+ eFamily((SfxStyleFamily)nFamily)
+{
+/* switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_CHAR_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARA_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PAGE_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_FRAME_STYLE);
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ _pPropMap = aSwMapProvider.GetPropertyMap(PROPERTY_MAP_NUM_STYLE);
+ break;
+ }*/
+ StartListening(*pBasePool);
+}
+/*-- 16.12.98 16:03:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyleFamily::~SwXStyleFamily()
+{
+
+}
+sal_Int32 lcl_GetCountOrName ( const SwDoc &rDoc, SfxStyleFamily eFamily, String *pString, sal_uInt16 nIndex = USHRT_MAX )
+{
+ sal_Int32 nCount = 0;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ sal_uInt16 nBaseCount = RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
+ RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN;
+ nIndex -= nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetCharFmts()->Count();
+ for( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
+ if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
+ continue;
+ if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ // the default character format needs to be set to "Default!"
+ if(rDoc.GetDfltCharFmt() == pFmt)
+ SwStyleNameMapper::FillUIName(
+ RES_POOLCOLL_STANDARD, *pString );
+ else
+ *pString = pFmt->GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ sal_uInt16 nBaseCount = RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
+ RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN;
+ nIndex -= nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetTxtFmtColls()->Count();
+ for ( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ SwTxtFmtColl * pColl = (*rDoc.GetTxtFmtColls())[i];
+ if ( pColl->IsDefault() )
+ continue;
+ if ( IsPoolUserFmt ( pColl->GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = pColl->GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ sal_uInt16 nBaseCount = RES_POOLFRM_END - RES_POOLFRM_BEGIN;
+ nIndex -= nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetFrmFmts()->Count();
+ for( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
+ if(pFmt->IsDefault() || pFmt->IsAuto())
+ continue;
+ if ( IsPoolUserFmt ( pFmt->GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = pFmt->GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ sal_uInt16 nBaseCount = RES_POOLPAGE_END - RES_POOLPAGE_BEGIN;
+ nIndex -= nBaseCount;
+ const sal_uInt16 nArrLen = rDoc.GetPageDescCnt();
+ for(sal_uInt16 i = 0; i < nArrLen; ++i)
+ {
+ const SwPageDesc& rDesc = rDoc.GetPageDesc(i);
+
+ /*if(rDesc.IsDefault() || rDesc.IsAuto())
+ continue;*/
+ if ( IsPoolUserFmt ( rDesc.GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = rDesc.GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ sal_uInt16 nBaseCount = RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN;
+ nIndex -= nBaseCount;
+ const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
+ for(USHORT i = 0; i < rNumTbl.Count(); ++i)
+ {
+ const SwNumRule& rRule = *rNumTbl[ i ];
+ if( rRule.IsAutoRule() )
+ continue;
+ if ( IsPoolUserFmt ( rRule.GetPoolFmtId() ) )
+ {
+ if ( nIndex == nCount )
+ {
+ *pString = rRule.GetName();
+ break;
+ }
+ nCount++;
+ }
+ }
+ nCount += nBaseCount;
+ }
+ break;
+ }
+ return nCount;
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXStyleFamily::getCount(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, NULL );
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXStyleFamily::getByIndex(sal_Int32 nTempIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Any aRet;
+ if ( nTempIndex >= 0 && nTempIndex < USHRT_MAX )
+ {
+ sal_uInt16 nIndex = static_cast < sal_uInt16 > ( nTempIndex );
+ if(pBasePool)
+ {
+ String sStyleName;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ if ( nIndex < ( RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCHR_NORMAL_BEGIN + nIndex, sStyleName );
+ else if ( nIndex < ( RES_POOLCHR_HTML_END - RES_POOLCHR_HTML_BEGIN +
+ RES_POOLCHR_NORMAL_END - RES_POOLCHR_NORMAL_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCHR_HTML_BEGIN
+ - RES_POOLCHR_NORMAL_END + RES_POOLCHR_NORMAL_BEGIN
+ + nIndex, sStyleName );
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ if ( nIndex < ( RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCOLL_TEXT_BEGIN + nIndex, sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex, sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex, sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCOLL_REGISTER_BEGIN
+ - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex, sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCOLL_DOC_BEGIN
+ - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
+ - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex, sStyleName );
+ else if ( nIndex < ( RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN +
+ RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN +
+ RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN +
+ RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN +
+ RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN +
+ RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN ) )
+ SwStyleNameMapper::FillUIName ( RES_POOLCOLL_HTML_BEGIN
+ - RES_POOLCOLL_DOC_END + RES_POOLCOLL_DOC_BEGIN
+ - RES_POOLCOLL_REGISTER_END + RES_POOLCOLL_REGISTER_BEGIN
+ - RES_POOLCOLL_EXTRA_END + RES_POOLCOLL_EXTRA_BEGIN
+ - RES_POOLCOLL_LISTS_END + RES_POOLCOLL_LISTS_BEGIN
+ - RES_POOLCOLL_TEXT_END + RES_POOLCOLL_TEXT_BEGIN
+ + nIndex, sStyleName );
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ if ( nIndex < ( RES_POOLFRM_END - RES_POOLFRM_BEGIN ) )
+ {
+ SwStyleNameMapper::FillUIName ( RES_POOLFRM_BEGIN + nIndex, sStyleName );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ if ( nIndex < ( RES_POOLPAGE_END - RES_POOLPAGE_BEGIN ) )
+ {
+ SwStyleNameMapper::FillUIName ( RES_POOLPAGE_BEGIN + nIndex, sStyleName );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ if ( nIndex < ( RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN ) )
+ {
+ SwStyleNameMapper::FillUIName ( RES_POOLNUMRULE_BEGIN + nIndex, sStyleName );
+ }
+ }
+ break;
+ }
+ if ( !sStyleName.Len() )
+ lcl_GetCountOrName ( *pDocShell->GetDoc(), eFamily, &sStyleName, nIndex );
+
+ if ( sStyleName.Len() )
+ {
+ SfxStyleSheetBase* pBase = pBasePool->Find( sStyleName, eFamily );
+ if(pBase)
+ {
+ Reference< style::XStyle > xStyle = _FindStyle(sStyleName);
+ if(!xStyle.is())
+ {
+ xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
+ new SwXPageStyle(*pBasePool, pDocShell, eFamily, sStyleName) :
+ eFamily == SFX_STYLE_FAMILY_FRAME ?
+ new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
+ new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), sStyleName);
+ }
+ aRet.setValue(&xStyle, ::getCppuType((Reference<style::XStyle>*)0));
+ }
+ else
+ throw container::NoSuchElementException();
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+ }
+ else
+ throw RuntimeException();
+ }
+ else
+ throw lang::IndexOutOfBoundsException();
+
+ return aRet;
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXStyleFamily::getByName(const OUString& rName)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Any aRet;
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ {
+ Reference< style::XStyle > xStyle = _FindStyle(sStyleName);
+ if(!xStyle.is())
+ {
+ xStyle = eFamily == SFX_STYLE_FAMILY_PAGE ?
+ new SwXPageStyle(*pBasePool, pDocShell, eFamily, sStyleName) :
+ eFamily == SFX_STYLE_FAMILY_FRAME ?
+ new SwXFrameStyle(*pBasePool, pDocShell->GetDoc(), pBase->GetName()):
+ new SwXStyle(*pBasePool, eFamily, pDocShell->GetDoc(), sStyleName);
+ }
+ aRet.setValue(&xStyle, ::getCppuType((Reference<style::XStyle>*)0));
+ }
+ else
+ throw container::NoSuchElementException();
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Sequence< OUString > aRet;
+ if(pBasePool)
+ {
+ SfxStyleSheetIterator* pIterator = pBasePool->CreateIterator(eFamily, 0xffff);
+ sal_uInt16 nCount = pIterator->Count();
+ aRet.realloc(nCount);
+ OUString* pArray = aRet.getArray();
+ String aString;
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ SwStyleNameMapper::FillProgName((*pIterator)[i]->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ pArray[i] = OUString ( aString );
+ }
+ delete pIterator;
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+/*-- 16.12.98 16:03:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamily::hasByName(const OUString& rName) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ if(pBasePool)
+ {
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ bRet = 0 != pBase;
+ }
+ else
+ throw RuntimeException();
+ return bRet;
+
+}
+/*-- 16.12.98 16:03:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Type SwXStyleFamily::getElementType(void) throw( RuntimeException )
+{
+ return ::getCppuType((const Reference<style::XStyle>*)0);
+
+}
+/*-- 16.12.98 16:03:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyleFamily::hasElements(void) throw( RuntimeException )
+{
+ if(!pBasePool)
+ throw RuntimeException();
+ return sal_True;
+}
+/*-- 16.12.98 16:03:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::insertByName(const OUString& rName, const Any& rElement)
+ throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(pBasePool)
+ {
+ String sStyleName;
+ SwStyleNameMapper::FillUIName(rName, sStyleName, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ SfxStyleSheetBase* pUINameBase = pBasePool->Find( sStyleName );
+ if(pBase || pUINameBase)
+ throw container::ElementExistException();
+ else
+ {
+ if(rElement.getValueType().getTypeClass() ==
+ TypeClass_INTERFACE)
+ {
+ Reference< XInterface > * pxRef =
+ (Reference< XInterface > *)rElement.getValue();
+
+ Reference<lang::XUnoTunnel> xStyleTunnel( *pxRef, UNO_QUERY);
+
+ SwXStyle* pNewStyle = 0;
+ if(xStyleTunnel.is())
+ {
+ pNewStyle = (SwXStyle*)xStyleTunnel->getSomething(
+ SwXStyle::getUnoTunnelId());
+ }
+ if(!pNewStyle || !pNewStyle->IsDescriptor() ||
+ pNewStyle->GetFamily() != eFamily)
+ throw lang::IllegalArgumentException();
+ if(pNewStyle)
+ {
+ sal_uInt16 nMask = 0xffff;
+ if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional())
+ nMask &= ~SWSTYLEBIT_CONDCOLL;
+ SfxStyleSheetBase& rNewBase = pBasePool->Make(sStyleName, eFamily, nMask);
+ pNewStyle->SetDoc(pDocShell->GetDoc(), pBasePool);
+ pNewStyle->SetStyleName(sStyleName);
+ String sParentStyleName(pNewStyle->GetParentStyleName());
+ if(sParentStyleName.Len())
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pParentBase = pBasePool->Find(sParentStyleName);
+ if(pParentBase && pParentBase->GetFamily() == eFamily &&
+ &pParentBase->GetPool() == pBasePool)
+ pBasePool->SetParent( eFamily, sStyleName, sParentStyleName );
+
+ }
+ //so, jetzt sollten noch die Properties des Descriptors angewandt werden
+ pNewStyle->ApplyDescriptorProperties();
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::replaceByName(const OUString& rName, const Any& rElement)
+ throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(rName);
+ //Ersetzung geht nur fuer benutzerdefinierte Styles
+ if(!pBase)
+ throw container::NoSuchElementException();
+ if(!pBase->IsUserDefined())
+ throw lang::IllegalArgumentException();
+ //if theres an object available to this style then it must be invalidated
+ Reference< style::XStyle > xStyle = _FindStyle(pBase->GetName());
+ if(xStyle.is())
+ {
+ Reference<XUnoTunnel> xTunnel( xStyle, UNO_QUERY);
+ if(xTunnel.is())
+ {
+ SwXStyle* pStyle = (SwXStyle*)xTunnel->getSomething(
+ SwXStyle::getUnoTunnelId());
+ pStyle->Invalidate();
+ }
+ }
+
+ pBasePool->Erase(pBase);
+ insertByName(rName, rElement);
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::removeByName(const OUString& rName) throw( container::NoSuchElementException, lang::WrappedTargetException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ String aString;
+ SwStyleNameMapper::FillUIName(rName, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+
+ SfxStyleSheetBase* pBase = pBasePool->Find( aString );
+ if(pBase)
+ pBasePool->Erase(pBase);
+ else
+ throw container::NoSuchElementException();
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyleFamily::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ SfxSimpleHint *pHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if( pHint && ( pHint->GetId() & SFX_HINT_DYING ) )
+ {
+ pBasePool = 0;
+ pDocShell = 0;
+ EndListening(rBC);
+ }
+}
+/*-- 16.12.98 16:03:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyle* SwXStyleFamily::_FindStyle(const String& rStyleName)const
+{
+ sal_uInt16 nLCount = pBasePool->GetListenerCount();
+ SfxListener* pListener = 0;
+ for( sal_uInt16 i = 0; i < nLCount; i++)
+ {
+ pListener = pBasePool->GetListener( i );
+ if(PTR_CAST(SwXStyle, pListener) && ((SwXStyle*)pListener)->GetFamily() == eFamily && ((SwXStyle*)pListener)->GetStyleName() == rStyleName)
+ {
+ return (SwXStyle*)pListener;
+ }
+ }
+ return 0;
+}
+/******************************************************************
+ *
+ ******************************************************************/
+class SwStyleProperties_Impl
+{
+ const SfxItemPropertyMap* _pMap;
+ Any** pAnyArr;
+ sal_uInt16 nArrLen;
+
+public:
+ SwStyleProperties_Impl(const SfxItemPropertyMap* _pMap);
+ ~SwStyleProperties_Impl();
+
+ sal_Bool SetProperty(const String& rName, Any aVal);
+ sal_Bool GetProperty(const String& rName, Any*& rpAny);
+ sal_Bool ClearProperty( const OUString& rPropertyName );
+ void ClearAllProperties( );
+ void GetProperty(const OUString &rPropertyName, const Reference < XPropertySet > &rxPropertySet, uno::Any& rAny );
+
+
+ const SfxItemPropertyMap* GetPropertyMap() const {return _pMap;}
+};
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+SwStyleProperties_Impl::SwStyleProperties_Impl(const SfxItemPropertyMap* pMap) :
+ _pMap(pMap),
+ nArrLen(0)
+{
+ const SfxItemPropertyMap* pTmp = _pMap;
+ while(pTmp[nArrLen].nWID)
+ nArrLen++;
+ pAnyArr = new Any* [nArrLen];
+ for ( sal_uInt16 i =0 ; i < nArrLen; i++ )
+ pAnyArr[i] = 0;
+}
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+SwStyleProperties_Impl::~SwStyleProperties_Impl()
+{
+ for ( sal_uInt16 i =0 ; i < nArrLen; i++ )
+ delete pAnyArr[i];
+ delete[] pAnyArr;
+}
+
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+sal_Bool SwStyleProperties_Impl::SetProperty(const String& rName, Any aVal)
+{
+ sal_uInt16 nPos = 0;
+ const SfxItemPropertyMap* pTemp = _pMap;
+ while( pTemp->pName )
+ {
+ if(rName.EqualsAscii(pTemp->pName))
+ break;
+ ++nPos;
+ ++pTemp;
+ }
+ if(nPos < nArrLen)
+ {
+ delete pAnyArr[nPos];
+ pAnyArr[nPos] = new Any ( aVal );
+ }
+ return nPos < nArrLen;
+}
+
+sal_Bool SwStyleProperties_Impl::ClearProperty( const OUString& rName )
+{
+ sal_uInt16 nPos = 0;
+ const SfxItemPropertyMap* pTemp = _pMap;
+ while( pTemp->pName )
+ {
+ if( rName.equalsAsciiL ( pTemp->pName, pTemp->nNameLen ) )
+ break;
+ ++nPos;
+ ++pTemp;
+ }
+ if( nPos < nArrLen )
+ {
+ delete pAnyArr[nPos];
+ pAnyArr[ nPos ] = 0;
+ }
+ return nPos < nArrLen;
+}
+void SwStyleProperties_Impl::ClearAllProperties( )
+{
+ for ( sal_uInt16 i = 0; i < nArrLen; i++ )
+ {
+ delete pAnyArr[i];
+ pAnyArr[ i ] = 0;
+ }
+}
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+sal_Bool SwStyleProperties_Impl::GetProperty(const String& rName, Any*& rpAny )
+{
+ sal_uInt16 nPos = 0;
+ const SfxItemPropertyMap* pTemp = _pMap;
+ while( pTemp->pName )
+ {
+ if(rName.EqualsAscii(pTemp->pName))
+ break;
+ ++nPos;
+ ++pTemp;
+ }
+ if(nPos < nArrLen)
+ rpAny = pAnyArr[nPos];
+ return nPos < nArrLen;
+}
+
+void SwStyleProperties_Impl::GetProperty( const OUString &rPropertyName, const Reference < XPropertySet > &rxPropertySet, uno::Any & rAny )
+{
+ rAny = rxPropertySet->getPropertyValue( rPropertyName );
+}
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const Sequence< sal_Int8 > & SwXStyle::getUnoTunnelId()
+{
+ static Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXStyle::getSomething( const Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+TYPEINIT1(SwXStyle, SfxListener);
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXStyle::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXStyle");
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXStyle::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ BOOL bRet = C2U("com.sun.star.style.Style") == rServiceName;
+ if(!bRet && SFX_STYLE_FAMILY_CHAR == eFamily)
+ bRet = !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties")||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian")||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex");
+ if(!bRet && SFX_STYLE_FAMILY_PARA == eFamily)
+ bRet = (C2U("com.sun.star.style.ParagraphStyle") == rServiceName)||
+ (C2U("com.sun.star.style.ParagraphProperties") == rServiceName) ||
+ (C2U("com.sun.star.style.ParagraphPropertiesAsian") == rServiceName) ||
+ (C2U("com.sun.star.style.ParagraphPropertiesComplex") == rServiceName);
+ if(!bRet && SFX_STYLE_FAMILY_PAGE == eFamily)
+ bRet = (C2U("com.sun.star.style.PageProperties") == rServiceName);
+
+ return bRet;
+}
+/* -----------------------------06.04.00 11:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXStyle::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ long nCount = 1;
+ if(SFX_STYLE_FAMILY_PARA == eFamily)
+ {
+ nCount = 5;
+ if(bIsConditional)
+ nCount++;
+ }
+ else if(SFX_STYLE_FAMILY_CHAR == eFamily)
+ nCount = 4;
+ else if(SFX_STYLE_FAMILY_PAGE == eFamily)
+ nCount = 2;
+ Sequence< OUString > aRet(nCount);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.style.Style");
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ pArray[1] = C2U("com.sun.star.style.PageProperties");
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ pArray[1] = C2U("com.sun.star.style.ParagraphStyle");
+ pArray[2] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[3] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[4] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ if(bIsConditional)
+ pArray[5] = C2U("com.sun.star.style.ConditionalParagraphStyle");
+ break;
+ }
+ return aRet;
+}
+/*-- 17.12.98 08:26:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyle::SwXStyle( SwDoc *pDoc, SfxStyleFamily eFam, BOOL bConditional) :
+ m_pDoc( pDoc ),
+ bIsDescriptor(sal_True),
+ bIsConditional(bConditional),
+ eFamily(eFam),
+ pBasePool(0)
+{
+ // Register ourselves as a listener to the document (via the page descriptor)
+ pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this);
+ // get the property set for the default style data
+ // First get the model
+ Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel();
+ // Ask the model for it's family supplier interface
+ Reference < XStyleFamiliesSupplier > xFamilySupplier ( xModel, UNO_QUERY );
+ // Get the style families
+ Reference < XNameAccess > xFamilies = xFamilySupplier->getStyleFamilies();
+
+ Any aAny;
+ sal_uInt16 nMapId;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ nMapId = PROPERTY_MAP_CHAR_STYLE;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ nMapId = PROPERTY_MAP_PARA_STYLE;
+ aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ParagraphStyles" ) ) );
+ // Get the Frame family (and keep it for later)
+ aAny >>= mxStyleFamily;
+ aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Standard" ) ) );
+ aAny >>= mxStyleData;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ nMapId = PROPERTY_MAP_PAGE_STYLE;
+ aAny = xFamilies->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "PageStyles" ) ) );
+ // Get the Frame family (and keep it for later)
+ aAny >>= mxStyleFamily;
+ aAny = mxStyleFamily->getByName ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Standard" ) ) );
+ aAny >>= mxStyleData;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ nMapId = PROPERTY_MAP_FRAME_STYLE;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ nMapId = PROPERTY_MAP_NUM_STYLE;
+ }
+ break;
+ }
+ pPropImpl = new SwStyleProperties_Impl(aSwMapProvider.GetPropertyMap(nMapId));
+}
+
+
+SwXStyle::SwXStyle(SfxStyleSheetBasePool& rPool, SfxStyleFamily eFam,
+ SwDoc* pDoc, const String& rStyleName) :
+ sStyleName(rStyleName),
+ pBasePool(&rPool),
+ eFamily(eFam),
+ m_pDoc(pDoc),
+ bIsDescriptor(sal_False),
+ bIsConditional(sal_False),
+ pPropImpl(0)
+{
+ StartListening(rPool);
+ if(eFam == SFX_STYLE_FAMILY_PARA)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(pBase)
+ {
+ const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sStyleName, GET_POOLID_TXTCOLL);
+ if(nId != USHRT_MAX)
+ ::binfilter::IsConditionalByPoolId( nId );
+ else
+ bIsConditional = RES_CONDTXTFMTCOLL == ((SwDocStyleSheet*)pBase)->GetCollection()->Which();
+ }
+ }
+}
+/*-- 17.12.98 08:26:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXStyle::~SwXStyle()
+{
+ if(pBasePool)
+ EndListening(*pBasePool);
+ delete pPropImpl;
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ m_pDoc = 0;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+ }
+}
+OUString SwXStyle::getName(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String aString;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(!pBase)
+ throw RuntimeException();
+ SwStyleNameMapper::FillProgName(pBase->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
+ }
+ else
+ aString = sStyleName;
+ return OUString (aString);
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setName(const OUString& rName) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+ sal_Bool bExcept = sal_True;
+ if(pBase && pBase->IsUserDefined())
+ {
+ SwDocStyleSheet aTmp( *(SwDocStyleSheet*)pBase );
+ bExcept = !aTmp.SetName(rName);
+ if(!bExcept)
+ sStyleName = String(rName);
+ }
+ if(bExcept)
+ throw RuntimeException();
+ }
+ else
+ sStyleName = String(rName);
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyle::isUserDefined(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ //if it is not found it must be non user defined
+ if(pBase)
+ bRet = pBase->IsUserDefined();
+ }
+ else
+ throw RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 08:26:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXStyle::isInUse(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_USED);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ bRet = pBase->IsUsed();
+ }
+ else
+ throw RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 08:26:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXStyle::getParentStyle(void) throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String aString;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ aString = pBase->GetParent();
+ }
+ else if(bIsDescriptor)
+ aString = sParentStyleName;
+ else
+ throw RuntimeException();
+ SwStyleNameMapper::FillProgName(aString, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ return OUString ( aString );
+}
+/*-- 17.12.98 08:26:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setParentStyle(const OUString& rParentStyle)
+ throw( container::NoSuchElementException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String sParentStyle;
+ SwStyleNameMapper::FillUIName(rParentStyle, sParentStyle, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True );
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ BOOL bExcept = FALSE;
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ if(pBase)
+ {
+ SwDocStyleSheet aBase(*(SwDocStyleSheet*)pBase);
+ if(aBase.GetParent() != sParentStyle)
+ {
+ bExcept = !aBase.SetParent(sParentStyle);
+ }
+ }
+ else
+ bExcept = TRUE;
+ if(bExcept)
+ throw RuntimeException();
+ }
+ else if(bIsDescriptor)
+ {
+ sParentStyleName = String(sParentStyle);
+ try
+ {
+ Any aAny = mxStyleFamily->getByName ( sParentStyle );
+ aAny >>= mxStyleData;
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ }
+ catch ( WrappedTargetException& )
+ {
+ }
+ catch ( RuntimeException& )
+ {
+ }
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 17.12.98 08:26:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXStyle::getPropertySetInfo(void)
+ throw( RuntimeException )
+{
+ Reference< XPropertySetInfo > xRet;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ static Reference< XPropertySetInfo > xCharRef;
+ if(!xCharRef.is())
+ {
+ SfxItemPropertySet aPropSet(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_CHAR_STYLE));
+ xCharRef = aPropSet.getPropertySetInfo();
+ }
+ xRet = xCharRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ static Reference< XPropertySetInfo > xParaRef;
+ if(!xParaRef.is())
+ {
+ SfxItemPropertySet aPropSet(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PARA_STYLE));
+ xParaRef = aPropSet.getPropertySetInfo();
+ }
+ xRet = xParaRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ static Reference< XPropertySetInfo > xPageRef;
+ if(!xPageRef.is())
+ {
+ SfxItemPropertySet aPropSet(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_PAGE_STYLE) );
+ xPageRef = aPropSet.getPropertySetInfo();
+ }
+ xRet = xPageRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ static Reference< XPropertySetInfo > xFrameRef;
+ if(!xFrameRef.is())
+ {
+ SfxItemPropertySet aPropSet(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_FRAME_STYLE));
+ xFrameRef = aPropSet.getPropertySetInfo();
+ }
+ xRet = xFrameRef;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ static Reference< XPropertySetInfo > xNumRef;
+ if(!xNumRef.is())
+ {
+ SfxItemPropertySet aPropSet(
+ aSwMapProvider.GetPropertyMap(PROPERTY_MAP_NUM_STYLE));
+ xNumRef = aPropSet.getPropertySetInfo();
+ }
+ xRet = xNumRef;
+ }
+ break;
+ }
+ return xRet;
+}
+/* -----------------23.04.99 13:28-------------------
+ *
+ * --------------------------------------------------*/
+void SwXStyle::ApplyDescriptorProperties()
+{
+ bIsDescriptor = sal_False;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+
+ const SfxItemPropertyMap* pTemp = pPropImpl->GetPropertyMap();
+ while(pTemp->nWID)
+ {
+ Any* pAny;
+ String sPropName(C2S(pTemp->pName));
+ OUString sUPropName(sPropName);
+ pPropImpl->GetProperty(sPropName, pAny);
+ if(pAny)
+ setPropertyValue(sUPropName, *pAny);
+ pTemp++;
+ }
+}
+
+/*-- 18.04.01 13:07:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct SwStyleBase_Impl
+{
+ SwDoc& rDoc;
+
+ const SwPageDesc* pOldPageDesc;
+
+ SwDocStyleSheet* pNewBase;
+ SfxItemSet* pItemSet;
+
+ const String& rStyleName;
+ sal_uInt16 nPDescPos;
+
+ SwStyleBase_Impl(SwDoc& rSwDoc, const String& rName) :
+ rDoc(rSwDoc),
+ rStyleName(rName),
+ pNewBase(0),
+ pItemSet(0),
+ pOldPageDesc(0),
+ nPDescPos(0xffff)
+ {}
+ ~SwStyleBase_Impl(){delete pNewBase; delete pItemSet; }
+
+ sal_Bool HasItemSet() {return 0 != pNewBase;}
+ SfxItemSet& GetItemSet()
+ {
+ DBG_ASSERT(pNewBase, "no SwDocStyleSheet available");
+ if(!pItemSet)
+ pItemSet = new SfxItemSet(pNewBase->GetItemSet());
+ return *pItemSet;
+ }
+
+ const SwPageDesc& GetOldPageDesc();
+};
+/* -----------------------------25.04.01 12:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc()
+{
+ if(!pOldPageDesc)
+ {
+ sal_uInt16 i;
+ sal_uInt16 nPDescCount = rDoc.GetPageDescCnt();
+ for(i = 0; i < nPDescCount; i++)
+ {
+ const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
+ if(rDesc.GetName() == rStyleName)
+ {
+ pOldPageDesc = & rDesc;
+ nPDescPos = i;
+ break;
+ }
+ }
+ if(!pOldPageDesc)
+ {
+ for(i = RC_POOLPAGEDESC_BEGIN; i <= STR_POOLPAGE_ENDNOTE; ++i)
+ {
+ const String aFmtName(SW_RES(i));
+ if(aFmtName == rStyleName)
+ {
+ pOldPageDesc = rDoc.GetPageDescFromPool( RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN );
+ break;
+ }
+ }
+ for(i = 0; i < nPDescCount + 1; i++)
+ {
+ const SwPageDesc& rDesc = rDoc.GetPageDesc( i );
+ if(rDesc.GetName() == rStyleName)
+ {
+ nPDescPos = i;
+ break;
+ }
+ }
+ }
+ }
+ return *pOldPageDesc;
+}
+
+/* -----------------------------19.04.01 09:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_SetStyleProperty(const SfxItemPropertyMap* pMap,
+ SfxItemPropertySet& rPropSet,
+ const Any& rValue,
+ SwStyleBase_Impl& rBase,
+ SfxStyleSheetBasePool* pBasePool,
+ SwDoc* pDoc,
+ SfxStyleFamily eFamily)
+ throw(PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+
+{
+ switch(pMap->nWID)
+ {
+ case RES_PAPER_BIN:
+ {
+ SfxPrinter *pPrinter = pDoc->GetPrt();
+ OUString sTmp;
+ sal_uInt16 nBin = USHRT_MAX;
+ if ( !( rValue >>= sTmp ) )
+ throw IllegalArgumentException();
+ if ( sTmp.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "[From printer settings]" ) ) )
+ nBin = USHRT_MAX-1;
+ else if ( pPrinter )
+ {
+ for (sal_uInt16 i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; i++ )
+ {
+ if (sTmp == OUString ( pPrinter->GetPaperBinName ( i ) ) )
+ {
+ nBin = i;
+ break;
+ }
+ }
+ }
+ if ( nBin == USHRT_MAX )
+ throw IllegalArgumentException();
+ else
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), pMap->nWID, pMap->nWID);
+ aSet.SetParent(&rStyleSet);
+ rPropSet.setPropertyValue(*pMap, makeAny ( static_cast < sal_Int8 > ( nBin == USHRT_MAX-1 ? -1 : nBin ) ), aSet);
+ rStyleSet.Put(aSet);
+ }
+ }
+ break;
+ case FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem:
+ {
+ if(rValue.getValueType() == ::getCppuType((Reference< container::XIndexReplace>*)0) )
+ {
+ Reference< container::XIndexReplace > * pxRulesRef =
+ (Reference< container::XIndexReplace > *)rValue.getValue();
+
+ Reference<lang::XUnoTunnel> xNumberTunnel( *pxRulesRef, UNO_QUERY);
+
+ SwXNumberingRules* pSwXRules = 0;
+ if(xNumberTunnel.is())
+ {
+ pSwXRules = (SwXNumberingRules*)
+ xNumberTunnel->getSomething(
+ SwXNumberingRules::getUnoTunnelId());
+ }
+ if(pSwXRules)
+ {
+ const String* pCharStyleNames = pSwXRules->GetNewCharStyleNames();
+ const String* pBulletFontNames = pSwXRules->GetBulletFontNames();
+
+ SwNumRule aSetRule(*pSwXRules->GetNumRule());
+ const SwCharFmts* pFmts = pDoc->GetCharFmts();
+ sal_uInt16 nChCount = pFmts->Count();
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ {
+
+ const SwNumFmt* pFmt = aSetRule.GetNumFmt( i );
+ if(pFmt)
+ {
+ SwNumFmt aFmt(*pFmt);
+ if(
+ pCharStyleNames[i] != SwXNumberingRules::GetInvalidStyle() &&
+ ((pCharStyleNames[i].Len() && !pFmt->GetCharFmt()) ||
+ pCharStyleNames[i].Len() &&
+ pFmt->GetCharFmt()->GetName() != pCharStyleNames[i] ))
+ {
+
+ SwCharFmt* pCharFmt = 0;
+ if(pCharStyleNames[i].Len())
+ {
+ for(sal_uInt16 j = 0; j< nChCount; j++)
+ {
+ SwCharFmt* pTmp = (*pFmts)[j];
+ if(pTmp->GetName() == pCharStyleNames[i])
+ {
+ pCharFmt = pTmp;
+ break;
+ }
+ }
+ if(!pCharFmt)
+ {
+
+ SfxStyleSheetBase* pBase;
+ pBase = ((SfxStyleSheetBasePool*)pBasePool)->Find(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pBasePool->Make(pCharStyleNames[i], SFX_STYLE_FAMILY_CHAR);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+
+ }
+
+ aFmt.SetCharFmt( pCharFmt );
+ }
+ }
+ //jetzt nochmal fuer Fonts
+ if(pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() &&
+ ((pBulletFontNames[i].Len() && !pFmt->GetBulletFont()) ||
+ pBulletFontNames[i].Len() &&
+ pFmt->GetBulletFont()->GetName() != pBulletFontNames[i] ))
+ {
+ const SvxFontListItem* pFontListItem =
+ (const SvxFontListItem* )pDoc->GetDocShell()
+ ->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFontListItem->GetFontList();
+ FontInfo aInfo = pList->Get(
+ pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
+ Font aFont(aInfo);
+ aFmt.SetBulletFont(&aFont);
+ }
+ aSetRule.Set( i, &aFmt );
+ }
+ }
+ rBase.pNewBase->SetNumRule(aSetRule);
+ }
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ case FN_UNO_FOLLOW_STYLE:
+ {
+ OUString sTmp;
+ rValue >>= sTmp;
+ String aString;
+ SwStyleNameMapper::FillUIName(sTmp, aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True ) ;
+ rBase.pNewBase->SetFollow( aString );
+ }
+ break;
+ case RES_PAGEDESC :
+ if( MID_PAGEDESC_PAGEDESCNAME != pMap->nMemberId)
+ goto put_itemset;
+ {
+ // Sonderbehandlung RES_PAGEDESC
+ if(rValue.getValueType() != ::getCppuType((const OUString*)0))
+ throw lang::IllegalArgumentException();
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+
+ SwFmtPageDesc* pNewDesc = 0;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
+ {
+ pNewDesc = new SwFmtPageDesc(*((SwFmtPageDesc*)pItem));
+ }
+ if(!pNewDesc)
+ pNewDesc = new SwFmtPageDesc();
+ OUString uDescName;
+ rValue >>= uDescName;
+ String sDescName;
+ SwStyleNameMapper::FillUIName(uDescName, sDescName, GET_POOLID_PAGEDESC, sal_True );
+ if(!pNewDesc->GetPageDesc() || pNewDesc->GetPageDesc()->GetName() != sDescName)
+ {
+ sal_uInt16 nCount = pDoc->GetPageDescCnt();
+ sal_Bool bPut = sal_False;
+ if(sDescName.Len())
+ {
+ SwPageDesc* pPageDesc = ::binfilter::GetPageDescByName_Impl(*pDoc, sDescName);
+ if(pPageDesc)
+ {
+ pPageDesc->Add( pNewDesc );
+ bPut = sal_True;
+ }
+ else
+ {
+ throw lang::IllegalArgumentException();
+ }
+ }
+ if(!bPut)
+ {
+ rStyleSet.ClearItem(RES_BREAK);
+ rStyleSet.Put(SwFmtPageDesc());
+ }
+ else
+ rStyleSet.Put(*pNewDesc);
+ }
+ delete pNewDesc;
+ }
+ break;
+ case FN_UNO_IS_AUTO_UPDATE:
+ {
+ BOOL bAuto = *(sal_Bool*)rValue.getValue();
+ if(SFX_STYLE_FAMILY_PARA == eFamily)
+ rBase.pNewBase->GetCollection()->SetAutoUpdateFmt(bAuto);
+ else if(SFX_STYLE_FAMILY_FRAME == eFamily)
+ rBase.pNewBase->GetFrmFmt()->SetAutoUpdateFmt(bAuto);
+ }
+ break;
+ case FN_UNO_CATEGORY:
+ {
+ if(!rBase.pNewBase->IsUserDefined())
+ throw lang::IllegalArgumentException();
+ short nSet;
+ rValue >>= nSet;
+
+ sal_uInt16 nId;
+ switch( nSet )
+ {
+ case ParagraphStyleCategory::TEXT:
+ nId = SWSTYLEBIT_TEXT;
+ break;
+ case ParagraphStyleCategory::CHAPTER:
+ nId = SWSTYLEBIT_CHAPTER;
+ break;
+ case ParagraphStyleCategory::LIST:
+ nId = SWSTYLEBIT_LIST;
+ break;
+ case ParagraphStyleCategory::INDEX:
+ nId = SWSTYLEBIT_IDX;
+ break;
+ case ParagraphStyleCategory::EXTRA:
+ nId = SWSTYLEBIT_EXTRA;
+ break;
+ case ParagraphStyleCategory::HTML:
+ nId = SWSTYLEBIT_HTML;
+ break;
+ default: throw lang::IllegalArgumentException();
+ }
+ rBase.pNewBase->SetMask( nId|SFXSTYLEBIT_USERDEF );
+ }
+ break;
+ case SID_SWREGISTER_COLLECTION:
+ {
+ OUString sName;
+ rValue >>= sName;
+ SwRegisterItem aReg( sName.getLength() != 0);
+ aReg.SetWhich(SID_SWREGISTER_MODE);
+ rBase.GetItemSet().Put(aReg);
+ String aString;
+ SwStyleNameMapper::FillUIName(sName, aString, GET_POOLID_TXTCOLL, sal_True);
+
+ rBase.GetItemSet().Put(SfxStringItem(SID_SWREGISTER_COLLECTION, aString ) );
+ }
+ break;
+ case RES_TXTATR_CJK_RUBY:
+ if(MID_RUBY_CHARSTYLE == pMap->nMemberId )
+ {
+ OUString sTmp;
+ if(rValue >>= sTmp)
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SwFmtRuby* pRuby = 0;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_TXTATR_CJK_RUBY, sal_True, &pItem ) )
+ pRuby = new SwFmtRuby(*((SwFmtRuby*)pItem));
+ if(!pRuby)
+ pRuby = new SwFmtRuby(aEmptyStr);
+ String sStyle;
+ SwStyleNameMapper::FillUIName(sTmp, sStyle, GET_POOLID_CHRFMT, sal_True );
+ pRuby->SetCharFmtName( sTmp );
+ pRuby->SetCharFmtId( 0 );
+ if(sTmp.getLength())
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sTmp, GET_POOLID_CHRFMT );
+ pRuby->SetCharFmtId(nId);
+ }
+ rStyleSet.Put(*pRuby);
+ delete pRuby;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ }
+ goto put_itemset;
+ break;
+ case RES_PARATR_DROP:
+ {
+ if( MID_DROPCAP_CHAR_STYLE_NAME == pMap->nMemberId)
+ {
+ if(rValue.getValueType() == ::getCppuType((const OUString*)0))
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+
+ SwFmtDrop* pDrop = 0;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rStyleSet.GetItemState( RES_PARATR_DROP, sal_True, &pItem ) )
+ pDrop = new SwFmtDrop(*((SwFmtDrop*)pItem));
+ if(!pDrop)
+ pDrop = new SwFmtDrop();
+ OUString uStyle;
+ rValue >>= uStyle;
+ String sStyle;
+ SwStyleNameMapper::FillUIName(uStyle, sStyle, GET_POOLID_CHRFMT, sal_True );
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)pDoc->GetDocShell()->GetStyleSheetPool()->Find(sStyle, SFX_STYLE_FAMILY_CHAR);
+ if(pStyle)
+ pDrop->SetCharFmt(pStyle->GetCharFmt());
+ else
+ throw lang::IllegalArgumentException();
+ rStyleSet.Put(*pDrop);
+ delete pDrop;
+ }
+ else
+ throw lang::IllegalArgumentException();
+ break;
+ }
+ }
+ //no break!
+ default:
+put_itemset:
+ {
+ SfxItemSet& rStyleSet = rBase.GetItemSet();
+ SfxItemSet aSet(*rStyleSet.GetPool(), pMap->nWID, pMap->nWID);
+ aSet.SetParent(&rStyleSet);
+ rPropSet.setPropertyValue(*pMap, rValue, aSet);
+ rStyleSet.Put(aSet);
+ }
+ }
+}
+/* -----------------------------18.04.01 13:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXStyle::setPropertyValues(
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rValues )
+ throw(PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if ( !m_pDoc )
+ throw RuntimeException();
+ sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA: nPropSetId = PROPERTY_SET_PARA_STYLE ; break;
+ case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_SET_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE: nPropSetId = PROPERTY_SET_PAGE_STYLE ;break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break;
+ }
+ SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+
+ if(rPropertyNames.getLength() != rValues.getLength())
+ throw IllegalArgumentException();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+
+ SwStyleBase_Impl aBaseImpl(*m_pDoc, sStyleName);
+ if(pBasePool)
+ {
+ sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ pBasePool->SetSearchMask(eFamily, nSaveMask );
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(pBase)
+ aBaseImpl.pNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
+ else
+ throw RuntimeException();
+ }
+
+ for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]);
+
+ if(!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if(aBaseImpl.pNewBase)
+ {
+ lcl_SetStyleProperty(pMap, aPropSet, pValues[nProp], aBaseImpl,
+ pBasePool, m_pDoc, eFamily);
+ }
+ else if(bIsDescriptor)
+ {
+ if(!pPropImpl->SetProperty(pNames[nProp], pValues[nProp]))
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw RuntimeException();
+ }
+ if(aBaseImpl.HasItemSet())
+ aBaseImpl.pNewBase->SetItemSet(aBaseImpl.GetItemSet());
+}
+
+Any lcl_GetStyleProperty(const SfxItemPropertyMap* pMap,
+ SfxItemPropertySet& rPropSet,
+ SwStyleBase_Impl& rBase,
+ SfxStyleSheetBase* pBase,
+ SfxStyleFamily eFamily,
+ SwDoc *pDoc) throw(RuntimeException)
+{
+ Any aRet;
+ if(FN_UNO_IS_PHYSICAL == pMap->nWID)
+ {
+ BOOL bPhys = pBase != 0;
+ if(pBase)
+ {
+ bPhys = ((SwDocStyleSheet*)pBase)->IsPhysical();
+ // The standard character format is not existing physically
+ if( bPhys && SFX_STYLE_FAMILY_CHAR == eFamily &&
+ ((SwDocStyleSheet*)pBase)->GetCharFmt() &&
+ ((SwDocStyleSheet*)pBase)->GetCharFmt()->IsDefault() )
+ bPhys = FALSE;
+ }
+ aRet.setValue(&bPhys, ::getBooleanCppuType());
+ }
+ else if(pBase)
+ {
+ if(!rBase.pNewBase)
+ rBase.pNewBase = new SwDocStyleSheet( *(SwDocStyleSheet*)pBase );
+ switch(pMap->nWID)
+ {
+ case RES_PAPER_BIN:
+ {
+ SfxItemSet& rSet = rBase.GetItemSet();
+ aRet = rPropSet.getPropertyValue(*pMap, rSet);
+ sal_Int8 nBin;
+ aRet >>= nBin;
+ if ( nBin == -1 )
+ aRet <<= OUString ( RTL_CONSTASCII_USTRINGPARAM ( "[From printer settings]" ) );
+ else
+ {
+ SfxPrinter *pPrinter = pDoc->GetPrt();
+ OUString sTmp;
+ if (pPrinter )
+ sTmp = pPrinter->GetPaperBinName ( nBin );
+ aRet <<= sTmp;
+ }
+ }
+ break;
+ case FN_UNO_NUM_RULES: //Sonderbehandlung fuer das SvxNumRuleItem:
+ {
+ const SwNumRule* pRule = rBase.pNewBase->GetNumRule();
+ DBG_ASSERT(pRule, "Wo ist die NumRule?");
+ Reference< container::XIndexReplace > xRules = new SwXNumberingRules(*pRule);
+ aRet.setValue(&xRules, ::getCppuType((Reference<container::XIndexReplace>*)0));
+ }
+ break;
+ case FN_UNO_FOLLOW_STYLE:
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(rBase.pNewBase->GetFollow(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), sal_True);
+ aRet <<= OUString( aString );
+ }
+ break;
+ case RES_PAGEDESC :
+ if( MID_PAGEDESC_PAGEDESCNAME != pMap->nMemberId)
+ goto query_itemset;
+ {
+ // Sonderbehandlung RES_PAGEDESC
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rBase.GetItemSet().GetItemState( RES_PAGEDESC, sal_True, &pItem ) )
+ {
+ const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
+ if(pDesc)
+ {
+ String aString;
+ SwStyleNameMapper::FillProgName(pDesc->GetName(), aString, GET_POOLID_PAGEDESC, sal_True );
+ aRet <<= OUString( aString );
+ }
+ }
+ }
+ break;
+ case FN_UNO_IS_AUTO_UPDATE:
+ {
+ BOOL bAuto = FALSE;
+ if(SFX_STYLE_FAMILY_PARA == eFamily)
+ bAuto = rBase.pNewBase->GetCollection()->IsAutoUpdateFmt();
+ else if(SFX_STYLE_FAMILY_FRAME == eFamily)
+ bAuto = rBase.pNewBase->GetFrmFmt()->IsAutoUpdateFmt();
+ aRet.setValue(&bAuto, ::getBooleanCppuType());
+ }
+ break;
+ case FN_UNO_DISPLAY_NAME:
+ {
+ OUString sName(rBase.pNewBase->GetName());
+ aRet <<= sName;
+ }
+ break;
+ case FN_UNO_CATEGORY:
+ {
+ sal_uInt16 nPoolId = rBase.pNewBase->GetCollection()->GetPoolFmtId();
+ short nRet = -1;
+ switch ( COLL_GET_RANGE_BITS & nPoolId )
+ {
+ case COLL_TEXT_BITS:
+ nRet = ParagraphStyleCategory::TEXT;
+ break;
+ case COLL_DOC_BITS:
+ nRet = ParagraphStyleCategory::CHAPTER;
+ break;
+ case COLL_LISTS_BITS:
+ nRet = ParagraphStyleCategory::LIST;
+ break;
+ case COLL_REGISTER_BITS:
+ nRet = ParagraphStyleCategory::INDEX;
+ break;
+ case COLL_EXTRA_BITS:
+ nRet = ParagraphStyleCategory::EXTRA;
+ break;
+ case COLL_HTML_BITS:
+ nRet = ParagraphStyleCategory::HTML;
+ break;
+ }
+ aRet <<= nRet;
+ }
+ break;
+ case SID_SWREGISTER_COLLECTION:
+ {
+ const SwPageDesc *pPageDesc = rBase.pNewBase->GetPageDesc();
+ const SwTxtFmtColl* pCol = 0;
+ String aString;
+ if( pPageDesc )
+ pCol = pPageDesc->GetRegisterFmtColl();
+ if( pCol )
+ SwStyleNameMapper::FillProgName(
+ pCol->GetName(), aString, GET_POOLID_TXTCOLL, sal_True );
+ aRet <<= OUString ( aString );
+ }
+ break;
+ default:
+query_itemset:
+ {
+ SfxItemSet& rSet = rBase.GetItemSet();
+ aRet = rPropSet.getPropertyValue(*pMap, rSet);
+ }
+ }
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+/* -----------------------------19.04.01 09:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Any > SwXStyle::getPropertyValues(
+ const Sequence< OUString >& rPropertyNames ) throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if ( !m_pDoc )
+ throw RuntimeException();
+ sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA: nPropSetId = PROPERTY_SET_PARA_STYLE ; break;
+ case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_SET_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE: nPropSetId = PROPERTY_SET_PAGE_STYLE ;break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break;
+ }
+ SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ const OUString* pNames = rPropertyNames.getConstArray();
+ Sequence< Any > aRet(rPropertyNames.getLength());
+ Any* pRet = aRet.getArray();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ SwStyleBase_Impl aBase(*m_pDoc, sStyleName);
+ SfxStyleSheetBase* pBase = 0;
+ for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]);
+ if(!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if(pBasePool)
+ {
+ if(!pBase)
+ {
+ sal_uInt16 nSaveMask = pBasePool->GetSearchMask();
+ pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL );
+ pBase = pBasePool->Find(sStyleName);
+ pBasePool->SetSearchMask(eFamily, nSaveMask );
+ }
+ pRet[nProp] = lcl_GetStyleProperty(pMap, aPropSet, aBase, pBase, eFamily, GetDoc() );
+ }
+ else if(bIsDescriptor)
+ {
+ Any *pAny = 0;
+ pPropImpl->GetProperty ( pNames[nProp], pAny );
+ if( !pAny )
+ {
+ sal_Bool bExcept = sal_False;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_PSEUDO:
+ bExcept = sal_True;
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ case SFX_STYLE_FAMILY_PAGE:
+ pPropImpl->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] );
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ if (pMap->nWID >= POOLATTR_BEGIN && pMap->nWID < RES_UNKNOWNATR_END )
+ {
+ SwFmt * pFmt;
+ if ( eFamily == SFX_STYLE_FAMILY_CHAR )
+ pFmt = m_pDoc->GetDfltCharFmt();
+ else
+ pFmt = m_pDoc->GetDfltFrmFmt();
+ const SwAttrPool * pPool = pFmt->GetAttrSet().GetPool();
+ const SfxPoolItem & rItem = pPool->GetDefaultItem ( pMap->nWID );
+ rItem.QueryValue ( pRet[nProp], pMap->nMemberId );
+ }
+ else
+ bExcept = sal_True;
+ }
+ break;
+ }
+ if (bExcept )
+ {
+ RuntimeException aExcept;
+ aExcept.Message = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "No default value for: " ) ) + pNames[nProp];
+ throw aExcept;
+ }
+ }
+ else
+ pRet [ nProp ] = *pAny;
+ }
+ else
+ throw RuntimeException();
+ }
+ return aRet;
+}
+/*-- 18.04.01 13:07:29---------------------------------------------------
+ -----------------------------------------------------------------------*/
+void SwXStyle::addPropertiesChangeListener(
+ const Sequence< OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{
+}
+/*-- 18.04.01 13:07:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::removePropertiesChangeListener(
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{
+}
+/*-- 18.04.01 13:07:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::firePropertiesChangeEvent(
+ const Sequence< OUString >& aPropertyNames,
+ const Reference< XPropertiesChangeListener >& xListener )
+ throw(RuntimeException)
+{
+}
+/*-- 17.12.98 08:26:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setPropertyValue(const OUString& rPropertyName, const Any& rValue)
+ throw( UnknownPropertyException,
+ PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException,
+ RuntimeException)
+{
+ const Sequence<OUString> aProperties(&rPropertyName, 1);
+ const Sequence<Any> aValues(&rValue, 1);
+ setPropertyValues(aProperties, aValues);
+}
+/*-- 17.12.98 08:26:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXStyle::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ const Sequence<OUString> aProperties(&rPropertyName, 1);
+ return getPropertyValues(aProperties).getConstArray()[0];
+
+}
+/*-- 17.12.98 08:26:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::addPropertyChangeListener(const OUString& PropertyName,
+ const Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 17.12.98 08:26:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::removePropertyChangeListener(const OUString& PropertyName,
+ const Reference< XPropertyChangeListener > & aListener)
+ throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 17.12.98 08:26:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::addVetoableChangeListener(const OUString& PropertyName,
+ const Reference< XVetoableChangeListener > & aListener)
+ throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 17.12.98 08:26:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::removeVetoableChangeListener(const OUString& PropertyName,
+ const Reference< XVetoableChangeListener > & aListener)
+ throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+/*-- 08.03.99 10:50:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+PropertyState SwXStyle::getPropertyState(const OUString& rPropertyName)
+ throw( UnknownPropertyException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+
+ Sequence< OUString > aNames(1);
+ OUString* pNames = aNames.getArray();
+ pNames[0] = rPropertyName;
+ Sequence< PropertyState > aStates = getPropertyStates(aNames);
+ return aStates.getConstArray()[0];
+}
+/*-- 08.03.99 10:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< PropertyState > SwXStyle::getPropertyStates(
+ const Sequence< OUString >& rPropertyNames)
+ throw( UnknownPropertyException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ Sequence< PropertyState > aRet(rPropertyNames.getLength());
+ PropertyState* pStates = aRet.getArray();
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily );
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style?" );
+
+ if(pBase)
+ {
+ const OUString* pNames = rPropertyNames.getConstArray();
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
+ sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA: nPropSetId = PROPERTY_SET_PARA_STYLE ; break;
+ case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_SET_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE: nPropSetId = PROPERTY_SET_PAGE_STYLE; break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break;
+ }
+
+ SfxItemSet aSet = aStyle.GetItemSet();
+ SfxItemPropertySet& rStylePropSet = aSwMapProvider.GetPropertySet(nPropSetId);
+ for(sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
+ {
+ const String& rPropName = pNames[i];
+ const SfxItemPropertyMap* pMap =
+ SfxItemPropertyMap::GetByName(
+ rStylePropSet.getPropertyMap(), rPropName);
+ if(!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ if( FN_UNO_NUM_RULES == pMap->nWID ||
+ FN_UNO_FOLLOW_STYLE == pMap->nWID )
+ {
+ pStates[i] = PropertyState_DIRECT_VALUE;
+ }
+ else if(SFX_STYLE_FAMILY_PAGE == eFamily &&
+ (rPropName.EqualsAscii("Header", 0, 6)
+ || rPropName.EqualsAscii("Footer", 0, 6)))
+ {
+ sal_uInt16 nResId = lcl_ConvertFNToRES(pMap->nWID);
+ BOOL bFooter = rPropName.EqualsAscii("Footer", 0, 6);
+ const SvxSetItem* pSetItem;
+ if(SFX_ITEM_SET == aSet.GetItemState(
+ bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ sal_False, (const SfxPoolItem**)&pSetItem))
+ {
+ const SfxItemSet& rSet = pSetItem->GetItemSet();
+ SfxItemState eState = rSet.GetItemState(nResId, sal_False);
+ if(SFX_ITEM_SET == eState)
+ pStates[i] = PropertyState_DIRECT_VALUE;
+ else
+ pStates[i] = PropertyState_DEFAULT_VALUE;
+ }
+ else
+ pStates[i] = PropertyState_AMBIGUOUS_VALUE;
+ }
+ else
+ {
+ pStates[i] = rStylePropSet.getPropertyState(*pMap, aSet);
+ if( SFX_STYLE_FAMILY_PAGE == eFamily &&
+ SID_ATTR_PAGE_SIZE == pMap->nWID &&
+ PropertyState_DIRECT_VALUE == pStates[i] )
+ {
+ const SvxSizeItem& rSize =
+ static_cast < const SvxSizeItem& >(
+ aSet.Get(SID_ATTR_PAGE_SIZE) );
+ sal_uInt8 nMemberId = pMap->nMemberId & 0x7f;
+ if( ( LONG_MAX == rSize.GetSize().Width() &&
+ (MID_SIZE_WIDTH == nMemberId ||
+ MID_SIZE_SIZE == nMemberId ) ) ||
+ ( LONG_MAX == rSize.GetSize().Height() &&
+ MID_SIZE_HEIGHT == nMemberId ) )
+ {
+ pStates[i] = PropertyState_DEFAULT_VALUE;
+ }
+ }
+ }
+ }
+ }
+ else
+ throw RuntimeException();
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+/*-- 08.03.99 10:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXStyle::setPropertyToDefault(const OUString& rPropertyName)
+ throw( UnknownPropertyException, RuntimeException )
+{
+ const Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ setPropertiesToDefault ( aSequence );
+}
+
+void SAL_CALL SwXStyle::setPropertiesToDefault( const Sequence< OUString >& aPropertyNames )
+ throw (UnknownPropertyException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwFmt *pTargetFmt = 0;
+
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "Where is the style?");
+
+ if(pBase)
+ {
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR: pTargetFmt = aStyle.GetCharFmt(); break;
+ case SFX_STYLE_FAMILY_PARA: pTargetFmt = aStyle.GetCollection(); break;
+ case SFX_STYLE_FAMILY_FRAME: pTargetFmt = aStyle.GetFrmFmt(); break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ sal_uInt16 nPgDscPos = USHRT_MAX;
+ SwPageDesc *pDesc = m_pDoc->FindPageDescByName( aStyle.GetPageDesc()->GetName(), &nPgDscPos );
+ if( pDesc )
+ pTargetFmt = &pDesc->GetMaster();
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+ }
+ }
+ }
+ sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA: nPropSetId = PROPERTY_SET_PARA_STYLE ; break;
+ case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_SET_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE: nPropSetId = PROPERTY_SET_PAGE_STYLE ;break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break;
+ }
+
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(nPropSetId);
+ const OUString* pNames = aPropertyNames.getConstArray();
+
+ if ( pTargetFmt )
+ {
+ for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
+ {
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp] );
+ if( !pMap )
+ throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is unknown: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nWID == FN_UNO_FOLLOW_STYLE || pMap->nWID == FN_UNO_NUM_RULES )
+ throw RuntimeException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Cannot reset: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY )
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ pTargetFmt->ResetAttr ( pMap->nWID );
+ }
+ }
+ else if ( bIsDescriptor )
+ {
+ for( sal_Int32 nProp = 0, nEnd = aPropertyNames.getLength(); nProp < nEnd; nProp++ )
+ pPropImpl->ClearProperty ( pNames[ nProp ] );
+ }
+}
+
+void SAL_CALL SwXStyle::setAllPropertiesToDefault( )
+ throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "where is the style, you fiend!?");
+
+ if(pBase)
+ {
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
+
+ SwFmt *pTargetFmt = 0;
+ SwPageDesc *pTargetDesc = 0;
+ sal_uInt16 nPgDscPos = USHRT_MAX;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ pTargetFmt = aStyle.GetCharFmt();
+ break;
+ case SFX_STYLE_FAMILY_PARA :
+ pTargetFmt = aStyle.GetCollection();
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ pTargetFmt = aStyle.GetFrmFmt();
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ SwPageDesc *pDesc = m_pDoc->FindPageDescByName( aStyle.GetPageDesc()->GetName(), &nPgDscPos );
+ if( pDesc )
+ {
+ pTargetFmt = &pDesc->GetMaster();
+ pDesc->SetUseOn ( PD_ALL );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+ }
+ if( pTargetFmt )
+ {
+ if( USHRT_MAX != nPgDscPos )
+ {
+ SwPageDesc& rPageDesc = m_pDoc->_GetPageDesc(nPgDscPos);
+ rPageDesc.ResetAllMasterAttr();
+
+ SvxLRSpaceItem aLR;
+ sal_Int32 nSize = GetMetricVal ( CM_1) * 2;
+ aLR.SetLeft ( nSize );
+ aLR.SetLeft ( nSize );
+ SvxULSpaceItem aUL;
+ aUL.SetUpper ( static_cast < sal_uInt16 > ( nSize ) );
+ aUL.SetLower ( static_cast < sal_uInt16 > ( nSize ) );
+ pTargetFmt->SetAttr ( aLR );
+ pTargetFmt->SetAttr ( aUL );
+
+ SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
+ SwFmtFrmSize aFrmSz( ATT_FIX_SIZE );
+ if( RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId() )
+ {
+ if( m_pDoc->GetPrt() )
+ {
+ const Size aPhysSize( SvxPaperInfo::GetPaperSize(
+ static_cast<Printer*>( m_pDoc->GetPrt() )) );
+ aFrmSz.SetSize( aPhysSize );
+ }
+ else
+ {
+ aFrmSz.SetWidth( LONG_MAX );
+ aFrmSz.SetHeight( LONG_MAX );
+ }
+
+ }
+ else
+ {
+ aFrmSz = pStdPgDsc->GetMaster().GetFrmSize();
+ }
+ if( pStdPgDsc->GetLandscape() )
+ {
+ SwTwips nTmp = aFrmSz.GetHeight();
+ aFrmSz.SetHeight( aFrmSz.GetWidth() );
+ aFrmSz.SetWidth( nTmp );
+ }
+ pTargetFmt->SetAttr( aFrmSz );
+ }
+ else
+ pTargetFmt->ResetAllAttr();
+
+ if( USHRT_MAX != nPgDscPos )
+ m_pDoc->ChgPageDesc( nPgDscPos, m_pDoc->GetPageDesc(nPgDscPos) );
+ }
+
+ }
+ else
+ throw RuntimeException();
+ }
+ else if ( bIsDescriptor )
+ pPropImpl->ClearAllProperties();
+ else
+ throw RuntimeException();
+}
+
+Sequence< Any > SAL_CALL SwXStyle::getPropertyDefaults( const Sequence< OUString >& aPropertyNames )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nCount = aPropertyNames.getLength();
+ Sequence < Any > aRet ( nCount );
+ if ( nCount )
+ {
+ if( pBasePool)
+ {
+ pBasePool->SetSearchMask(eFamily);
+ SfxStyleSheetBase* pBase = pBasePool->Find(sStyleName);
+ DBG_ASSERT(pBase, "Doesn't seem to be a style!");
+
+ if(pBase)
+ {
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
+ sal_Int8 nPropSetId = PROPERTY_SET_CHAR_STYLE;
+ switch(eFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA: nPropSetId = PROPERTY_SET_PARA_STYLE ; break;
+ case SFX_STYLE_FAMILY_FRAME: nPropSetId = PROPERTY_SET_FRAME_STYLE ;break;
+ case SFX_STYLE_FAMILY_PAGE: nPropSetId = PROPERTY_SET_PAGE_STYLE ;break;
+ case SFX_STYLE_FAMILY_PSEUDO: nPropSetId = PROPERTY_SET_NUM_STYLE ;break;
+ }
+
+ const SfxItemSet &rSet = aStyle.GetItemSet(), *pParentSet = rSet.GetParent();
+ const SfxItemPropertyMap* pMap = aSwMapProvider.GetPropertyMap(nPropSetId);
+ const OUString *pNames = aPropertyNames.getConstArray();
+ Any *pRet = aRet.getArray();
+ for ( sal_Int32 i = 0 ; i < nCount; i++)
+ {
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[i]);
+
+ if ( !pMap )
+ throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if( pParentSet )
+ pRet[i] = aSwMapProvider.GetPropertySet(nPropSetId).getPropertyValue(pNames[i], *pParentSet);
+ else if( pMap->nWID != rSet.GetPool()->GetSlotId(pMap->nWID) )
+ {
+ const SfxPoolItem& rItem = rSet.GetPool()->GetDefaultItem(pMap->nWID);
+ rItem.QueryValue(pRet[i], pMap->nMemberId);
+ }
+ }
+ }
+ else
+ throw RuntimeException();
+ }
+ else
+ throw RuntimeException();
+ }
+ return aRet;
+}
+/*-- 08.03.99 10:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXStyle::getPropertyDefault(const OUString& rPropertyName)
+ throw( UnknownPropertyException, lang::WrappedTargetException, RuntimeException )
+{
+ const Sequence < OUString > aSequence ( &rPropertyName, 1 );
+ return getPropertyDefaults ( aSequence ).getConstArray()[0];
+}
+/* -----------------21.01.99 13:08-------------------
+ *
+ * --------------------------------------------------*/
+void SwXStyle::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ SfxSimpleHint *pHint = PTR_CAST( SfxSimpleHint, &rHint );
+ if( pHint )
+ {
+ if(( pHint->GetId() & SFX_HINT_DYING ) || ( pHint->GetId() & SFX_STYLESHEET_ERASED))
+ {
+ pBasePool = 0;
+ EndListening(rBC);
+ }
+ else if( pHint->GetId() &(SFX_STYLESHEET_CHANGED|SFX_STYLESHEET_ERASED) )
+ {
+ ((SfxStyleSheetPool&)rBC).SetSearchMask(eFamily);
+ SfxStyleSheetBase* pOwnBase = ((SfxStyleSheetPool&)rBC).Find(sStyleName);
+ if(!pOwnBase)
+ {
+ EndListening(rBC);
+ Invalidate();
+ }
+ }
+ }
+}
+/* -----------------------------15.08.00 11:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXStyle::Invalidate()
+{
+ sStyleName.Erase();
+ pBasePool = 0;
+ m_pDoc = 0;
+ mxStyleData.clear();
+ mxStyleFamily.clear();
+}
+
+
+/******************************************************************
+ * SwXPageStyle
+ ******************************************************************/
+/*-- 17.12.98 08:43:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXPageStyle::SwXPageStyle(SfxStyleSheetBasePool& rPool,
+ SwDocShell* pDocSh, SfxStyleFamily eFam,
+ const String& rStyleName)://, const SfxItemPropertyMap* _pMap) :
+ SwXStyle(rPool, eFam, pDocSh->GetDoc(), rStyleName),//, _pMap),
+ pDocShell(pDocSh)
+{
+
+}
+/* -----------------23.08.99 15:52-------------------
+
+ --------------------------------------------------*/
+SwXPageStyle::SwXPageStyle(SwDocShell* pDocSh) :
+ SwXStyle(pDocSh->GetDoc(), SFX_STYLE_FAMILY_PAGE),
+ pDocShell(pDocSh)
+{
+}
+
+/*-- 17.12.98 08:43:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXPageStyle::~SwXPageStyle()
+{
+
+}
+/* -----------------------------18.04.01 13:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXPageStyle::setPropertyValues(
+ const Sequence< OUString >& rPropertyNames,
+ const Sequence< Any >& rValues )
+ throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ throw RuntimeException();
+ SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(PROPERTY_SET_PAGE_STYLE);
+
+ if(rPropertyNames.getLength() != rValues.getLength())
+ throw IllegalArgumentException();
+
+ const OUString* pNames = rPropertyNames.getConstArray();
+ const Any* pValues = rValues.getConstArray();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ SwStyleBase_Impl aBaseImpl(*GetDoc(), GetStyleName());
+ if(GetBasePool())
+ {
+ sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
+ GetBasePool()->SetSearchMask(GetFamily());
+ SfxStyleSheetBase* pBase = GetBasePool()->Find(GetStyleName());
+ GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
+ DBG_ASSERT(pBase, "where is the style?" );
+ if(pBase)
+ aBaseImpl.pNewBase = new SwDocStyleSheet(*(SwDocStyleSheet*)pBase);
+ else
+ throw RuntimeException();
+ }
+
+ for(sal_Int16 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(GetBasePool())
+ {
+ switch(pMap->nWID)
+ {
+ case FN_UNO_HEADER_ON:
+ case FN_UNO_HEADER_BACKGROUND:
+ case FN_UNO_HEADER_BOX:
+ case FN_UNO_HEADER_LR_SPACE:
+ case FN_UNO_HEADER_SHADOW:
+ case FN_UNO_HEADER_BODY_DISTANCE:
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_HEADER_SHARE_CONTENT:
+ case FN_UNO_HEADER_HEIGHT:
+ case FN_UNO_HEADER_EAT_SPACING:
+
+ case FN_UNO_FOOTER_ON:
+ case FN_UNO_FOOTER_BACKGROUND:
+ case FN_UNO_FOOTER_BOX:
+ case FN_UNO_FOOTER_LR_SPACE:
+ case FN_UNO_FOOTER_SHADOW:
+ case FN_UNO_FOOTER_BODY_DISTANCE:
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_FOOTER_SHARE_CONTENT:
+ case FN_UNO_FOOTER_HEIGHT:
+ case FN_UNO_FOOTER_EAT_SPACING:
+ {
+ sal_Bool bSetItem = sal_False;
+ sal_Bool bFooter = sal_False;
+ sal_uInt16 nItemType = TYPE_BOOL;
+ sal_uInt16 nRes = 0;
+ switch(pMap->nWID)
+ {
+ case FN_UNO_FOOTER_ON: bFooter = sal_True;
+ //kein break;
+ case FN_UNO_HEADER_ON: nRes = SID_ATTR_PAGE_ON;
+ break;
+ case FN_UNO_FOOTER_BACKGROUND: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND; nItemType = TYPE_BRUSH;
+ break;
+ case FN_UNO_FOOTER_BOX: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BOX: nRes = RES_BOX; nItemType = TYPE_BOX;
+ break;
+ case FN_UNO_FOOTER_LR_SPACE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;nItemType = TYPE_LRSPACE;
+ break;
+ case FN_UNO_FOOTER_SHADOW: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;nItemType = TYPE_SHADOW;
+ break;
+ case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;nItemType = TYPE_ULSPACE;
+ break;
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
+ break;
+ case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED;
+ break;
+ case FN_UNO_FOOTER_HEIGHT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;nItemType = TYPE_SIZE;
+ break;
+ case FN_UNO_FOOTER_EAT_SPACING: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;nItemType = TYPE_SIZE;
+ break;
+ }
+ const SvxSetItem* pSetItem;
+ if(SFX_ITEM_SET == aBaseImpl.GetItemSet().GetItemState(
+ bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ sal_False, (const SfxPoolItem**)&pSetItem))
+ {
+ SvxSetItem* pNewSetItem = (SvxSetItem*)pSetItem->Clone();
+ SfxItemSet& rSetSet = pNewSetItem->GetItemSet();
+ const SfxPoolItem* pItem = 0;
+ SfxPoolItem* pNewItem = 0;
+ SfxItemState eState = rSetSet.GetItemState(nRes, sal_True, &pItem);
+ if(!pItem && nRes != rSetSet.GetPool()->GetSlotId(nRes))
+ pItem = &rSetSet.GetPool()->GetDefaultItem(nRes);
+ if(pItem)
+ {
+ pNewItem = pItem->Clone();
+ }
+ else
+ {
+ switch(nItemType)
+ {
+ case TYPE_BOOL: pNewItem = new SfxBoolItem(nRes); break;
+ case TYPE_SIZE: pNewItem = new SvxSizeItem(nRes); break;
+ case TYPE_BRUSH: pNewItem = new SvxBrushItem(nRes); break;
+ case TYPE_ULSPACE: pNewItem = new SvxULSpaceItem(nRes); break;
+ case TYPE_SHADOW : pNewItem = new SvxShadowItem(nRes); break;
+ case TYPE_LRSPACE: pNewItem = new SvxLRSpaceItem(nRes); break;
+ case TYPE_BOX: pNewItem = new SvxBoxItem(nRes); break;
+ }
+ }
+ bSetItem = pNewItem->PutValue(pValues[nProp], pMap->nMemberId);
+ rSetSet.Put(*pNewItem);
+ aBaseImpl.GetItemSet().Put(*pNewSetItem);
+ delete pNewItem;
+ delete pNewSetItem;
+ }
+ else if(SID_ATTR_PAGE_ON == nRes )
+ {
+ sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();
+ if(bVal)
+ {
+ SfxItemSet aTempSet(*aBaseImpl.GetItemSet().GetPool(),
+ RES_BACKGROUND, RES_SHADOW,
+ RES_LR_SPACE, RES_UL_SPACE,
+ nRes, nRes,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_PAGE_DYNAMIC, SID_ATTR_PAGE_DYNAMIC,
+ SID_ATTR_PAGE_SHARED, SID_ATTR_PAGE_SHARED,
+ 0 );
+ aTempSet.Put(SfxBoolItem(nRes, sal_True));
+ aTempSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(MM50, MM50)));
+ aTempSet.Put(SvxLRSpaceItem(RES_LR_SPACE));
+ aTempSet.Put(SvxULSpaceItem(RES_UL_SPACE));
+ aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_SHARED, sal_True));
+ aTempSet.Put(SfxBoolItem(SID_ATTR_PAGE_DYNAMIC, sal_True));
+
+ SvxSetItem aNewSetItem( bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ aTempSet);
+ aBaseImpl.GetItemSet().Put(aNewSetItem);
+ }
+ }
+ }
+ break;
+ case FN_UNO_HEADER :
+ case FN_UNO_HEADER_LEFT :
+ case FN_UNO_HEADER_RIGHT :
+ case FN_UNO_FOOTER :
+ case FN_UNO_FOOTER_LEFT :
+ case FN_UNO_FOOTER_RIGHT :
+ throw lang::IllegalArgumentException();
+ break;
+ case FN_PARAM_FTN_INFO :
+ {
+ const SfxPoolItem& rItem = aBaseImpl.GetItemSet().Get(FN_PARAM_FTN_INFO);
+ SfxPoolItem* pNewFtnItem = rItem.Clone();
+ sal_Bool bPut = pNewFtnItem->PutValue(pValues[nProp], pMap->nMemberId);
+ aBaseImpl.GetItemSet().Put(*pNewFtnItem);
+ delete pNewFtnItem;
+ if(!bPut)
+ throw IllegalArgumentException();
+ }
+ break;
+ default:
+ lcl_SetStyleProperty(pMap, aPropSet, pValues[nProp], aBaseImpl,
+ GetBasePool(), GetDoc(), GetFamily());
+ }
+ }
+ else if(IsDescriptor())
+ {
+ if(!GetPropImpl()->SetProperty(pNames[nProp], pValues[nProp]))
+ throw lang::IllegalArgumentException();
+ }
+ else
+ throw RuntimeException();
+ }
+ if(aBaseImpl.HasItemSet())
+ aBaseImpl.pNewBase->SetItemSet(aBaseImpl.GetItemSet());
+}
+/* -----------------------------18.04.01 13:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Any > SwXPageStyle::getPropertyValues(
+ const Sequence< OUString >& rPropertyNames )
+ throw(RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ throw RuntimeException();
+
+ sal_Int32 nLength = rPropertyNames.getLength();
+ SfxItemPropertySet& aPropSet = aSwMapProvider.GetPropertySet(PROPERTY_SET_PAGE_STYLE);
+ const OUString* pNames = rPropertyNames.getConstArray();
+ Sequence< Any > aRet ( nLength );
+
+ Any* pRet = aRet.getArray();
+ const SfxItemPropertyMap* pMap = aPropSet.getPropertyMap();
+ SwStyleBase_Impl aBase(*GetDoc(), GetStyleName());
+ SfxStyleSheetBase* pBase = 0;
+ for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
+ {
+ pMap = SfxItemPropertyMap::GetByName( pMap, pNames[nProp]);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(GetBasePool())
+ {
+ if(!pBase)
+ {
+ sal_uInt16 nSaveMask = GetBasePool()->GetSearchMask();
+ GetBasePool()->SetSearchMask(GetFamily(), SFXSTYLEBIT_ALL );
+ pBase = GetBasePool()->Find(GetStyleName());
+ GetBasePool()->SetSearchMask(GetFamily(), nSaveMask );
+ }
+ sal_uInt16 nRes;
+ sal_Bool bHeader = sal_False, bAll = sal_False, bLeft = sal_False, bRight = sal_False;
+ switch(pMap->nWID)
+ {
+ case FN_UNO_HEADER_ON:
+ case FN_UNO_HEADER_BACKGROUND:
+ case FN_UNO_HEADER_BOX:
+ case FN_UNO_HEADER_LR_SPACE:
+ case FN_UNO_HEADER_SHADOW:
+ case FN_UNO_HEADER_BODY_DISTANCE:
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_HEADER_SHARE_CONTENT:
+ case FN_UNO_HEADER_HEIGHT:
+ case FN_UNO_HEADER_EAT_SPACING:
+
+ case FN_UNO_FOOTER_ON:
+ case FN_UNO_FOOTER_BACKGROUND:
+ case FN_UNO_FOOTER_BOX:
+ case FN_UNO_FOOTER_LR_SPACE:
+ case FN_UNO_FOOTER_SHADOW:
+ case FN_UNO_FOOTER_BODY_DISTANCE:
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE:
+ case FN_UNO_FOOTER_SHARE_CONTENT:
+ case FN_UNO_FOOTER_HEIGHT:
+ case FN_UNO_FOOTER_EAT_SPACING:
+ {
+ SfxStyleSheetBasePool* pBasePool = ((SwXPageStyle*)this)->GetBasePool();
+ pBasePool->SetSearchMask(GetFamily());
+ SfxStyleSheetBase* pBase = pBasePool->Find(GetStyleName());
+ if(pBase)
+ {
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
+ const SfxItemSet& rSet = aStyle.GetItemSet();
+ sal_Bool bFooter = sal_False;
+ sal_uInt16 nRes = 0;
+ switch(pMap->nWID)
+ {
+ case FN_UNO_FOOTER_ON:
+ bFooter = sal_True;
+ // kein break!
+ case FN_UNO_HEADER_ON:
+ {
+ //falls das SetItem nicht da ist, dann ist der Wert sal_False
+ BOOL bRet = sal_False;
+ pRet[nProp].setValue(&bRet, ::getCppuBooleanType());
+ nRes = SID_ATTR_PAGE_ON;
+ }
+ break;
+ case FN_UNO_FOOTER_BACKGROUND: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BACKGROUND: nRes = RES_BACKGROUND;
+ break;
+ case FN_UNO_FOOTER_BOX: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BOX: nRes = RES_BOX;
+ break;
+ case FN_UNO_FOOTER_LR_SPACE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_LR_SPACE: nRes = RES_LR_SPACE;
+ break;
+ case FN_UNO_FOOTER_SHADOW: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHADOW: nRes = RES_SHADOW;
+ break;
+ case FN_UNO_FOOTER_BODY_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_BODY_DISTANCE: nRes = RES_UL_SPACE;
+ break;
+ case FN_UNO_FOOTER_IS_DYNAMIC_DISTANCE: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_IS_DYNAMIC_DISTANCE: nRes = SID_ATTR_PAGE_DYNAMIC;
+ break;
+ case FN_UNO_FOOTER_SHARE_CONTENT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_SHARE_CONTENT: nRes = SID_ATTR_PAGE_SHARED;
+ break;
+ case FN_UNO_FOOTER_HEIGHT: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_HEIGHT: nRes = SID_ATTR_PAGE_SIZE;
+ break;
+ case FN_UNO_FOOTER_EAT_SPACING: bFooter = sal_True;
+ // kein break;
+ case FN_UNO_HEADER_EAT_SPACING: nRes = RES_HEADER_FOOTER_EAT_SPACING;
+ break;
+ }
+ const SvxSetItem* pSetItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(
+ bFooter ? SID_ATTR_PAGE_FOOTERSET : SID_ATTR_PAGE_HEADERSET,
+ sal_False, (const SfxPoolItem**)&pSetItem))
+ {
+ const SfxItemSet& rSet = pSetItem->GetItemSet();
+ const SfxPoolItem* pItem = 0;
+ SfxItemState eState = rSet.GetItemState(nRes, sal_True, &pItem);
+ if(!pItem && nRes != rSet.GetPool()->GetSlotId(nRes))
+ pItem = &rSet.GetPool()->GetDefaultItem(nRes);
+ if(pItem)
+ pItem->QueryValue(pRet[nProp], pMap->nMemberId);
+ }
+ }
+ }
+ break;
+ case FN_UNO_HEADER :
+ bAll = sal_True; goto Header;
+ case FN_UNO_HEADER_LEFT :
+ bLeft = sal_True; goto Header;
+ case FN_UNO_HEADER_RIGHT :
+ bRight = sal_True; goto Header;
+Header:
+ bHeader = sal_True;
+ nRes = RES_HEADER; goto MakeObject;
+ case FN_UNO_FOOTER :
+ bAll = sal_True; goto Footer;
+ case FN_UNO_FOOTER_LEFT :
+ bLeft = sal_True; goto Footer;
+ case FN_UNO_FOOTER_RIGHT :
+ bRight = sal_True;
+Footer:
+ nRes = RES_FOOTER;
+MakeObject:
+ {
+ const SwPageDesc& rDesc = aBase.GetOldPageDesc();
+ const SwFrmFmt* pFrmFmt = 0;
+ sal_Bool bShare = bHeader && rDesc.IsHeaderShared()||
+ !bHeader && rDesc.IsFooterShared();
+ // TextLeft returns the left content if there is one,
+ // Text and TextRight return the master content.
+ // TextRight does the same as Text and is for
+ // comptability only.
+ if( bLeft && !bShare )
+ pFrmFmt = &rDesc.GetLeft();
+ else
+ pFrmFmt = &rDesc.GetMaster();
+ if(pFrmFmt)
+ {
+ const SfxItemSet& rSet = pFrmFmt->GetAttrSet();
+ const SfxPoolItem* pItem;
+ SwFrmFmt* pHeadFootFmt;
+ if(SFX_ITEM_SET == rSet.GetItemState(nRes, sal_True, &pItem) &&
+ 0 != (pHeadFootFmt = bHeader ?
+ ((SwFmtHeader*)pItem)->GetHeaderFmt() :
+ ((SwFmtFooter*)pItem)->GetFooterFmt()))
+ {
+ // gibt es schon ein Objekt dafuer?
+ SwXHeadFootText* pxHdFt = (SwXHeadFootText*)SwClientIter( *pHeadFootFmt ).
+ First( TYPE( SwXHeadFootText ));
+ Reference< text::XText > xRet = pxHdFt;
+ if(!pxHdFt)
+ xRet = new SwXHeadFootText(*pHeadFootFmt, bHeader);
+ pRet[nProp].setValue(&xRet, ::getCppuType((Reference<text::XText>*)0));
+ }
+ }
+ break;
+ }
+ break;
+ case FN_PARAM_FTN_INFO :
+ {
+ SwDocStyleSheet aStyle( *(SwDocStyleSheet*)pBase );
+ const SfxItemSet& rSet = aStyle.GetItemSet();
+ const SfxPoolItem& rItem = rSet.Get(FN_PARAM_FTN_INFO);
+ rItem.QueryValue(pRet[nProp], pMap->nMemberId);
+ }
+ break;
+ default:
+ pRet[nProp] = lcl_GetStyleProperty(pMap, aPropSet, aBase, pBase, GetFamily(), GetDoc() );
+ }
+ }
+ else if(IsDescriptor())
+ {
+ Any* pAny = 0;
+ GetPropImpl()->GetProperty(pNames[nProp], pAny);
+ if ( !pAny )
+ GetPropImpl()->GetProperty ( pNames[nProp], mxStyleData, pRet[ nProp ] );
+ else
+ pRet[nProp] = *pAny;
+ }
+ else
+ throw RuntimeException();
+ }
+ return aRet;
+}
+/*-- 17.12.98 08:43:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXPageStyle::getPropertyValue(const OUString& rPropertyName) throw(
+ UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ const Sequence<OUString> aProperties(&rPropertyName, 1);
+ return getPropertyValues(aProperties).getConstArray()[0];
+}
+/*-- 17.12.98 08:43:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXPageStyle::setPropertyValue(const OUString& rPropertyName, const Any& rValue)
+ throw( UnknownPropertyException,
+ PropertyVetoException,
+ lang::IllegalArgumentException,
+ lang::WrappedTargetException,
+ RuntimeException)
+{
+ const Sequence<OUString> aProperties(&rPropertyName, 1);
+ const Sequence<Any> aValues(&rValue, 1);
+ setPropertyValues(aProperties, aValues);
+}
+
+SwXFrameStyle::SwXFrameStyle ( SwDoc *pDoc )
+: SwXStyle ( pDoc, SFX_STYLE_FAMILY_FRAME, FALSE)
+{
+}
+/* -----------------------------15.12.00 15:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXFrameStyle::~SwXFrameStyle()
+{
+}
+/* -----------------------------15.12.00 14:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< uno::Type > SwXFrameStyle::getTypes( ) throw(RuntimeException)
+{
+ Sequence< uno::Type > aTypes = SwXStyle::getTypes();
+ sal_Int32 nLen = aTypes.getLength();
+ aTypes.realloc(nLen + 1);
+ aTypes.getArray()[nLen] = ::getCppuType((Reference<XEventsSupplier>*)0);
+ return aTypes;
+}
+/* -----------------------------15.12.00 14:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Any SwXFrameStyle::queryInterface( const uno::Type& rType ) throw(RuntimeException)
+{
+ Any aRet;
+ if(rType == ::getCppuType((Reference<XEventsSupplier>*)0))
+ aRet <<= Reference<XEventsSupplier>(this);
+ else
+ aRet = SwXStyle::queryInterface(rType);
+ return aRet;
+}
+/* -----------------------------15.12.00 14:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XNameReplace > SwXFrameStyle::getEvents( ) throw(RuntimeException)
+{
+ return new SwFrameStyleEventDescriptor( *this );
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unotbl.cxx b/binfilter/bf_sw/source/core/unocore/sw_unotbl.cxx
new file mode 100644
index 000000000000..5f9b419a6d37
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unotbl.cxx
@@ -0,0 +1,4464 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define ITEMID_BOXINFO SID_ATTR_BORDER_INNER
+
+#include <float.h> // for DBL_MIN
+
+#include <swtypes.hxx>
+#include <cmdid.h>
+
+#include <errhdl.hxx>
+
+#include <unotbl.hxx>
+#include <unostyle.hxx>
+#include <section.hxx>
+
+#include <unocrsr.hxx>
+#include <unomid.h>
+#include <bf_svx/unomid.hxx>
+#include <hints.hxx>
+#include <swtblfmt.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <shellres.hxx>
+#include <docary.hxx>
+#include <ndole.hxx>
+#include <bf_so3/ipobj.hxx>
+
+#include <frame.hxx>
+#include <vcl/svapp.hxx>
+#include <fmtfsize.hxx>
+#include <tblafmt.hxx>
+#include <tabcol.hxx>
+#include <cellatr.hxx>
+#include <fmtpdsc.hxx>
+#include <pagedesc.hxx>
+#include <bf_svx/boxitem.hxx>
+#define _SVSTDARR_STRINGS
+#include <bf_svtools/svstdarr.hxx>
+#include <viewsh.hxx>
+#include <tabfrm.hxx>
+#include <redline.hxx>
+#include <unomap.hxx>
+#include <unoredline.hxx>
+#include <bf_sch/schdll.hxx>
+#include <bf_sch/memchrt.hxx>
+#include <unoprnms.hxx>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/style/BreakType.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/XChartDataChangeEventListener.hpp>
+#include <com/sun/star/chart/ChartDataChangeEvent.hpp>
+#include <unotbl.hxx>
+#include <unoobj.hxx>
+#include <bf_svx/brkitem.hxx>
+#include <bf_svx/shaditem.hxx>
+#include <bf_svx/lrspitem.hxx>
+#include <bf_svx/ulspitem.hxx>
+#include <fmtornt.hxx>
+#include <bf_svx/keepitem.hxx>
+#include <fmtlsplt.hxx>
+#include <osl/mutex.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <frmatr.hxx>
+#include <crsskip.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::table;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::chart;
+
+using rtl::OUString;
+
+BOOL lcl_IsNumeric(const String& rStr)
+{
+ DBG_BF_ASSERT(0, "STRIP");
+ for(xub_StrLen i = 0; i < rStr.Len(); i++)
+ {
+ sal_Unicode c = rStr.GetChar(i);
+ if((c < '0') || (c > '9'))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+//aus unoobj.cxx
+extern void lcl_SetTxtFmtColl(const uno::Any& rAny, SwPaM& rPaM) throw (IllegalArgumentException);
+extern void lcl_setCharStyle(SwDoc* pDoc, const uno::Any aValue, SfxItemSet& rSet) throw (lang::IllegalArgumentException);
+
+#define UNO_TABLE_COLUMN_SUM 10000
+
+table::BorderLine lcl_SvxLineToLine(const SvxBorderLine* pLine)
+{
+ table::BorderLine aLine;
+ if(pLine)
+ {
+ aLine.Color = pLine->GetColor().GetColor() ;
+ aLine.InnerLineWidth = TWIP_TO_MM100( pLine->GetInWidth() );
+ aLine.OuterLineWidth = TWIP_TO_MM100( pLine->GetOutWidth() );
+ aLine.LineDistance = TWIP_TO_MM100( pLine->GetDistance() );
+ }
+ else
+ aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0;
+ return aLine;
+}
+
+sal_Bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine)
+{
+ rSvxLine.SetColor( Color(rLine.Color));
+ rSvxLine.SetInWidth( MM100_TO_TWIP( rLine.InnerLineWidth ) );
+ rSvxLine.SetOutWidth(MM100_TO_TWIP( rLine.OuterLineWidth ) );
+ rSvxLine.SetDistance(MM100_TO_TWIP( rLine.LineDistance ) );
+ sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0;
+ return bRet;
+}
+
+void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap, const uno::Any& aValue)
+ throw (IllegalArgumentException)
+{
+ //Sonderbehandlung fuer "Nicht-Items"
+ switch(pMap->nWID)
+ {
+ case FN_TABLE_HEADLINE_REPEAT:
+
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ {
+ UnoActionContext aAction(pFmt->GetDoc());
+ sal_Bool bVal = *(sal_Bool*)aValue.getValue();
+ pFmt->GetDoc()->SetHeadlineRepeat( *pTable, bVal);
+ }
+ }
+ break;
+ case FN_TABLE_IS_RELATIVE_WIDTH:
+ case FN_TABLE_WIDTH:
+ case FN_TABLE_RELATIVE_WIDTH:
+ {
+ sal_Int32 nWidth;
+ SwFmtFrmSize aSz( pFmt->GetFrmSize() );
+ if(FN_TABLE_WIDTH == pMap->nWID)
+ {
+ aValue >>= nWidth;
+ aSz.SetWidthPercent(0);
+ aSz.SetWidth ( MM100_TO_TWIP ( nWidth ) );
+ }
+ else if(FN_TABLE_RELATIVE_WIDTH == pMap->nWID)
+ {
+ sal_Int16 nSet;
+ aValue >>= nSet;
+ if(nSet && nSet <=100)
+ aSz.SetWidthPercent( (BYTE)nSet );
+ }
+ else if(FN_TABLE_IS_RELATIVE_WIDTH == pMap->nWID)
+ {
+ sal_Bool bPercent = *(sal_Bool*)aValue.getValue();
+ if(!bPercent)
+ aSz.SetWidthPercent(0);
+ else
+ {
+ IllegalArgumentException aExcept;
+ aExcept.Message = C2U("relative width cannot be switched on with this property");
+ throw aExcept;
+ }
+ }
+ pFmt->GetDoc()->SetAttr(aSz, *pFmt);
+ }
+ break;
+ case RES_PAGEDESC:
+ {
+ OUString uTemp;
+ aValue >>= uTemp;
+ String sPageStyle = uTemp;
+ const SwPageDesc* pDesc = 0;
+ if(sPageStyle.Len())
+ {
+ SwStyleNameMapper::FillUIName(sPageStyle, sPageStyle, GET_POOLID_PAGEDESC, sal_True );
+ pDesc = ::binfilter::GetPageDescByName_Impl(*pFmt->GetDoc(), sPageStyle);
+ }
+ SwFmtPageDesc aDesc( pDesc );
+ pFmt->GetDoc()->SetAttr(aDesc, *pFmt);
+ }
+ break;
+ default:
+ throw IllegalArgumentException();
+ }
+}
+
+uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertyMap* pMap )
+{
+ uno::Any aRet;
+ switch(pMap->nWID)
+ {
+ case FN_TABLE_HEADLINE_REPEAT:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ BOOL bTemp = pTable->IsHeadlineRepeat();
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_TABLE_WIDTH:
+ case FN_TABLE_IS_RELATIVE_WIDTH:
+ case FN_TABLE_RELATIVE_WIDTH:
+ {
+ const SwFmtFrmSize& rSz = pFmt->GetFrmSize();
+ if(FN_TABLE_WIDTH == pMap->nWID)
+ rSz.QueryValue(aRet, MID_FRMSIZE_WIDTH|CONVERT_TWIPS);
+ else if(FN_TABLE_RELATIVE_WIDTH == pMap->nWID)
+ rSz.QueryValue(aRet, MID_FRMSIZE_REL_WIDTH);
+ else
+ {
+ BOOL bTemp = 0 != rSz.GetWidthPercent();
+ aRet.setValue(&bTemp, ::getBooleanCppuType());
+ }
+ }
+ break;
+ case RES_PAGEDESC:
+ {
+ const SfxItemSet& rSet = pFmt->GetAttrSet();
+ const SfxPoolItem* pItem;
+ String sPDesc;
+ if(SFX_ITEM_SET == rSet.GetItemState(RES_PAGEDESC, sal_False, &pItem))
+ {
+ const SwPageDesc* pDsc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
+ if(pDsc)
+ {
+ sPDesc = SwStyleNameMapper::GetProgName(pDsc->GetName(), GET_POOLID_PAGEDESC );
+ }
+ }
+ aRet <<= OUString(sPDesc);
+ }
+ break;
+ case RES_ANCHOR :
+ aRet <<= TextContentAnchorType_AT_PARAGRAPH;
+ break;
+ case FN_UNO_ANCHOR_TYPES :
+ {
+ uno::Sequence<TextContentAnchorType> aTypes(1);
+ TextContentAnchorType* pArray = aTypes.getArray();
+ pArray[0] = TextContentAnchorType_AT_PARAGRAPH;
+ aRet <<= aTypes;
+ }
+ break;
+ case FN_UNO_WRAP :
+ {
+ aRet <<= WrapTextMode_NONE;
+ }
+ break;
+ case FN_PARAM_LINK_DISPLAY_NAME :
+ aRet <<= OUString(pFmt->GetName());
+ break;
+ case FN_UNO_REDLINE_NODE_START:
+ case FN_UNO_REDLINE_NODE_END:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwNode* pTblNode = pTable->GetTableNode();
+ if(FN_UNO_REDLINE_NODE_END == pMap->nWID)
+ pTblNode = pTblNode->EndOfSectionNode();
+ const SwRedlineTbl& rRedTbl = pFmt->GetDoc()->GetRedlineTbl();
+ for(USHORT nRed = 0; nRed < rRedTbl.Count(); nRed++)
+ {
+ const SwRedline* pRedline = rRedTbl[nRed];
+ const SwNode* pRedPointNode = pRedline->GetNode(TRUE);
+ const SwNode* pRedMarkNode = pRedline->GetNode(FALSE);
+ if(pRedPointNode == pTblNode || pRedMarkNode == pTblNode)
+ {
+ const SwNode* pStartOfRedline = SwNodeIndex(*pRedPointNode) <= SwNodeIndex(*pRedMarkNode) ?
+ pRedPointNode : pRedMarkNode;
+ BOOL bIsStart = pStartOfRedline == pTblNode;
+ aRet <<= SwXRedlinePortion::CreateRedlineProperties(*pRedline, bIsStart);
+ break;
+ }
+ }
+ }
+ break;
+ }
+ return aRet;
+}
+
+String lcl_GetCellName(sal_Int16 nColumn, sal_Int16 nRow)
+{
+ String sCellName;
+ sal_uInt16 nDiv = nColumn;
+ sal_uInt16 nMod = 0;
+ sal_Bool bFirst = sal_True;
+ while( 0 != (nDiv -= nMod) || bFirst )
+ {
+ nMod = nDiv % 52;
+ sal_uInt16 nMod2 = nDiv % 26;
+ char cCol = nMod < 26 ? 'A' : 'a';
+ cCol += nMod2;
+ sCellName.Insert(cCol, 0);
+ bFirst = sal_False;
+ }
+ sCellName += String::CreateFromInt32(++nRow);
+ return sCellName;
+}
+
+void lcl_GetRowCol(const String& rCellName, sal_uInt16& rRow, sal_uInt16& rCol)
+{
+ //make parts out of the cell name
+ // examples: B5, Aa34, Cf97 ...
+ xub_StrLen nLen = rCellName.Len();
+ xub_StrLen nFirstPart = 1;
+ while(nFirstPart < nLen && !lcl_IsNumeric(String(rCellName.GetChar(nFirstPart))))
+ {
+ nFirstPart ++;
+ }
+ String sRow(rCellName.Copy(nFirstPart,nLen - nFirstPart));
+ String sCol(rCellName.Copy(0, nFirstPart));
+ rRow = (sal_uInt16)sRow.ToInt32();
+ rRow -= 1;
+
+ rCol = 0;
+ nLen = sCol.Len();
+ if(!nLen)
+ {
+ rRow = -1;
+ rCol = -1;
+ }
+ else
+ {
+ sal_uInt16 nBase = 1;
+ do
+ {
+ sal_Unicode cChar = sCol.GetChar(nLen-1);
+
+ if( cChar <= 'Z' )
+ rCol += nBase * ((cChar - 'A') + (nBase > 1 ? 1 : 0));
+ else
+ rCol += nBase * ((cChar - 'a') + (nBase > 1 ? 1 : 0));
+
+ sCol.Erase(nLen -1, 1);
+ nLen = sCol.Len();
+ nBase *= 50;
+ }
+ while(nLen);
+ }
+}
+
+SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int16 nColumn, sal_Int16 nRow)
+{
+ SwXCell* pXCell = 0;
+ String sCellName = lcl_GetCellName(nColumn, nRow);
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ if(pBox)
+ {
+ pXCell = SwXCell::CreateXCell(pFmt, pBox, &sCellName, pTable );
+ }
+ return pXCell;
+}
+
+void lcl_InspectLines(SwTableLines& rLines, SvStrings& rAllNames)
+{
+ for( sal_uInt16 i = 0; i < rLines.Count(); i++ )
+ {
+ SwTableLine* pLine = rLines[i];
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ for(sal_uInt16 j = 0; j < rBoxes.Count(); j++)
+ {
+ SwTableBox* pBox = rBoxes[j];
+ if(pBox->GetName().Len())
+ rAllNames.Insert(new String(pBox->GetName()), rAllNames.Count());
+ SwTableLines& rBoxLines = pBox->GetTabLines();
+ if(rBoxLines.Count())
+ {
+ lcl_InspectLines(rBoxLines, rAllNames);
+ }
+ }
+ }
+}
+
+void lcl_FormatTable(SwFrmFmt* pTblFmt)
+{
+ SwClientIter aIter( *pTblFmt );
+ for( SwClient* pC = aIter.First( TYPE( SwFrm ));
+ pC; pC = aIter.Next() )
+ {
+ if( ((SwFrm*)pC)->IsTabFrm() )
+ {
+ if(((SwFrm*)pC)->IsValid())
+ ((SwFrm*)pC)->InvalidatePos();
+ ((SwTabFrm*)pC)->SetONECalcLowers();
+ ((SwTabFrm*)pC)->Calc();
+ }
+ }
+}
+
+void lcl_CrsrSelect(SwPaM* pCrsr, sal_Bool bExpand)
+{
+ if(bExpand)
+ {
+ if(!pCrsr->HasMark())
+ pCrsr->SetMark();
+ }
+ else if(pCrsr->HasMark())
+ pCrsr->DeleteMark();
+
+}
+
+void lcl_GetTblSeparators(uno::Any& rRet, SwTable* pTable, SwTableBox* pBox, sal_Bool bRow)
+{
+ SwTabCols aCols;
+ aCols.SetLeftMin ( 0 );
+ aCols.SetLeft ( 0 );
+ aCols.SetRight ( UNO_TABLE_COLUMN_SUM );
+ aCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
+
+ pTable->GetTabCols( aCols, pBox, sal_False, bRow );
+
+ sal_uInt16 nSepCount = aCols.Count();
+ uno::Sequence< TableColumnSeparator> aColSeq(nSepCount);
+ TableColumnSeparator* pArray = aColSeq.getArray();
+ sal_Bool bError = sal_False;
+ for(sal_uInt16 i = 0; i < nSepCount; i++)
+ {
+ pArray[i].Position = aCols[i];
+ pArray[i].IsVisible = !aCols.IsHidden(i);
+ if(!bRow && !pArray[i].IsVisible)
+ {
+ bError = sal_True;
+ break;
+ }
+ }
+ if(!bError)
+ rRet.setValue(&aColSeq, ::getCppuType((uno::Sequence< TableColumnSeparator>*)0));
+
+}
+
+void lcl_SetTblSeparators(const uno::Any& rVal, SwTable* pTable, SwTableBox* pBox, sal_Bool bRow, SwDoc* pDoc)
+{
+ SwTabCols aOldCols;
+
+ aOldCols.SetLeftMin ( 0 );
+ aOldCols.SetLeft ( 0 );
+ aOldCols.SetRight ( UNO_TABLE_COLUMN_SUM );
+ aOldCols.SetRightMax( UNO_TABLE_COLUMN_SUM );
+
+ pTable->GetTabCols( aOldCols, pBox, sal_False, bRow );
+ sal_uInt16 nOldCount = aOldCols.Count();
+
+ const uno::Sequence< TableColumnSeparator>* pSepSeq =
+ (uno::Sequence< TableColumnSeparator>*) rVal.getValue();
+ if(pSepSeq && pSepSeq->getLength() == nOldCount)
+ {
+ SwTabCols aCols(aOldCols);
+ sal_Bool bError = sal_False;
+ const TableColumnSeparator* pArray = pSepSeq->getConstArray();
+ sal_Int32 nLastValue = 0;
+ sal_Int32 nTblWidth = aCols.GetRight() - aCols.GetLeft();
+ for(sal_uInt16 i = 0; i < nOldCount; i++)
+ {
+ aCols[i] = pArray[i].Position;
+ if(pArray[i].IsVisible == aCols.IsHidden(i) ||
+ !bRow && aCols.IsHidden(i) ||
+ long(aCols[i] - long(nLastValue)) < 0 ||
+ UNO_TABLE_COLUMN_SUM < aCols[i] )
+ {
+ bError = sal_True;
+ break;
+ }
+ nLastValue = aCols[i];
+ }
+ if(!bError)
+ {
+ pDoc->SetTabCols(*pTable, aCols, aOldCols, pBox, bRow );
+ }
+ }
+}
+
+inline ::rtl::OUString lcl_getString( SwXCell &rCell )
+{
+ // getString is a member function of the base class...
+ return rCell.getString();
+}
+/* -----------------30.04.02 08:00-------------------
+ * non UNO function call to set string in SwXCell
+ * --------------------------------------------------*/
+void lcl_setString( SwXCell &rCell, const ::rtl::OUString &rTxt )
+{
+ if(rCell.IsValid())
+ {
+ SwFrmFmt* pBoxFmt = rCell.pBox->ClaimFrmFmt();
+ pBoxFmt->LockModify();
+ pBoxFmt->ResetAttr( RES_BOXATR_FORMULA );
+ pBoxFmt->ResetAttr( RES_BOXATR_VALUE );
+ pBoxFmt->SetAttr( SwTblBoxNumFormat(NUMBERFORMAT_TEXT) );
+ pBoxFmt->UnlockModify();
+ }
+ rCell.SwXText::setString(rTxt);
+}
+/* -----------------30.04.02 08:00-------------------
+ * non UNO function call to get value from SwXCell
+ * --------------------------------------------------*/
+double lcl_getValue( SwXCell &rCell )
+{
+ double fRet = 0.0;
+ if(rCell.IsValid())
+ {
+ fRet = rCell.pBox->GetFrmFmt()->GetTblBoxValue().GetValue();
+ }
+ return fRet;
+}
+/* -----------------30.04.02 08:00-------------------
+ * non UNO function call to set value in SwXCell
+ * --------------------------------------------------*/
+void lcl_setValue( SwXCell &rCell, double nVal )
+{
+ if(rCell.IsValid())
+ {
+ // Der Text mu� zunaechst (vielleicht) geloescht werden
+ sal_uInt32 nNdPos = rCell.pBox->IsValidNumTxtNd( sal_True );
+ if(USHRT_MAX == nNdPos)
+ lcl_setString( rCell, OUString() );
+ SwDoc* pDoc = rCell.GetDoc();
+ UnoActionContext aAction(pDoc);
+ SwFrmFmt* pBoxFmt = rCell.pBox->ClaimFrmFmt();
+ SfxItemSet aSet(pDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_VALUE);
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
+ || pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue()))
+ {
+ aSet.Put(SwTblBoxNumFormat(0));
+ }
+
+ SwTblBoxValue aVal(nVal);
+ aSet.Put(aVal);
+ pDoc->SetTblBoxFormulaAttrs( *rCell.pBox, aSet );
+ //Tabelle aktualisieren
+ SwTableFmlUpdate aTblUpdate( SwTable::FindTable( rCell.GetFrmFmt() ));
+ pDoc->UpdateTblFlds( &aTblUpdate );
+ }
+}
+
+const SfxItemPropertyMap* GetTableDescPropertyMap()
+{
+ static SfxItemPropertyMap aTableDescPropertyMap_Impl[] =
+ {
+ { SW_PROP_NAME(UNO_NAME_BACK_COLOR ) , RES_BACKGROUND, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE,MID_BACK_COLOR },
+ { SW_PROP_NAME(UNO_NAME_BREAK_TYPE), RES_BREAK, &::getCppuType((const style::BreakType*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_GRAPHIC_URL ), RES_BACKGROUND, &::getCppuType((const OUString*)0), PROPERTY_NONE ,MID_GRAPHIC_URL },
+ { SW_PROP_NAME(UNO_NAME_GRAPHIC_FILTER ), RES_BACKGROUND, &::getCppuType((const OUString*)0), PROPERTY_NONE ,MID_GRAPHIC_FILTER },
+ { SW_PROP_NAME(UNO_NAME_GRAPHIC_LOCATION) , RES_BACKGROUND, &::getCppuType((const style::GraphicLocation*)0), PROPERTY_NONE ,MID_GRAPHIC_POSITION},
+ { SW_PROP_NAME(UNO_NAME_LEFT_MARGIN), RES_LR_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_L_MARGIN},
+ { SW_PROP_NAME(UNO_NAME_RIGHT_MARGIN), RES_LR_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_R_MARGIN},
+ { SW_PROP_NAME(UNO_NAME_HORI_ORIENT ), RES_HORI_ORIENT, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE ,MID_HORIORIENT_ORIENT },
+ { SW_PROP_NAME(UNO_NAME_KEEP_TOGETHER), RES_KEEP, &::getBooleanCppuType() , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SPLIT ), RES_LAYOUT_SPLIT, &::getBooleanCppuType() , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_PAGE_NUMBER_OFFSET), RES_PAGEDESC, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, MID_PAGEDESC_PAGENUMOFFSET},
+ { SW_PROP_NAME(UNO_NAME_PAGE_STYLE_NAME), 0, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_RELATIVE_WIDTH), FN_TABLE_RELATIVE_WIDTH,&::getCppuType((const sal_Int16*)0) , PROPERTY_NONE, 0 },
+ { SW_PROP_NAME(UNO_NAME_REPEAT_HEADLINE) , FN_TABLE_HEADLINE_REPEAT,&::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_SHADOW_FORMAT), RES_SHADOW, &::getCppuType((const table::ShadowFormat*)0), PROPERTY_NONE, CONVERT_TWIPS},
+ { SW_PROP_NAME(UNO_NAME_IS_WIDTH_RELATIVE), FN_TABLE_IS_RELATIVE_WIDTH, &::getBooleanCppuType() , PROPERTY_NONE, 0 },
+ { SW_PROP_NAME(UNO_NAME_TABLE_NAME), 0, &::getCppuType((const OUString*)0), PROPERTY_NONE, 0 },
+ { SW_PROP_NAME(UNO_NAME_TOP_MARGIN), RES_UL_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_UP_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NAME(UNO_NAME_BOTTOM_MARGIN), RES_UL_SPACE, &::getCppuType((const sal_Int32*)0), PROPERTY_NONE, MID_LO_MARGIN|CONVERT_TWIPS},
+ { SW_PROP_NAME(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, &::getBooleanCppuType(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
+ { SW_PROP_NAME(UNO_NAME_WIDTH), FN_TABLE_WIDTH, &::getCppuType((const sal_Int32*)0) , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_CHART_ROW_AS_LABEL), FN_UNO_RANGE_ROW_LABEL, &::getBooleanCppuType(), PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_CHART_COLUMN_AS_LABEL), FN_UNO_RANGE_COL_LABEL, &::getBooleanCppuType() , PROPERTY_NONE, 0},
+ { SW_PROP_NAME(UNO_NAME_TABLE_BORDER), FN_UNO_TABLE_BORDER, &::getCppuType((const table::TableBorder*)0), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS },
+ {0,0}
+ };
+ #define TABLE_PROP_COUNT 24
+ return aTableDescPropertyMap_Impl;
+}
+
+/******************************************************************
+ * SwXCell
+ ******************************************************************/
+TYPEINIT1(SwXCell, SwClient);
+
+SwXCell::SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBx, sal_uInt16 nPos ) :
+ SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT),
+ pBox(pBx),
+ pStartNode(0),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_CELL)),
+ SwClient(pTblFmt),
+ nFndPos(nPos)
+{
+}
+
+SwXCell::SwXCell(SwFrmFmt* pTblFmt, const SwStartNode& rStartNode) :
+ SwXText(pTblFmt->GetDoc(), CURSOR_TBLTEXT),
+ pBox(0),
+ pStartNode(&rStartNode),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_CELL)),
+ SwClient(pTblFmt),
+ nFndPos(USHRT_MAX)
+{
+}
+
+SwXCell::~SwXCell()
+{
+
+}
+
+const uno::Sequence< sal_Int8 > & SwXCell::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ else
+ return SwXText::getSomething(rId);
+}
+
+Sequence< uno::Type > SAL_CALL SwXCell::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static Sequence< uno::Type > aRetTypes;
+ if(!aRetTypes.getLength())
+ {
+ aRetTypes = SwXCellBaseClass::getTypes();
+ uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+
+ long nIndex = aRetTypes.getLength();
+ aRetTypes.realloc(
+ aRetTypes.getLength() +
+ aTextTypes.getLength());
+
+ uno::Type* pRetTypes = aRetTypes.getArray();
+
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ for(long nPos = 0; nPos <aTextTypes.getLength(); nPos++)
+ pRetTypes[nIndex++] = pTextTypes[nPos];
+ }
+ return aRetTypes;
+}
+
+Sequence< sal_Int8 > SAL_CALL SwXCell::getImplementationId( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+void SAL_CALL SwXCell::acquire( ) throw()
+{
+ SwXCellBaseClass::acquire();
+}
+
+void SAL_CALL SwXCell::release( ) throw()
+{
+ SwXCellBaseClass::release();
+}
+
+uno::Any SAL_CALL SwXCell::queryInterface( const uno::Type& aType )
+ throw (RuntimeException)
+{
+ uno::Any aRet = SwXCellBaseClass::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXText::queryInterface(aType);
+ return aRet;
+}
+
+const SwStartNode *SwXCell::GetStartNode() const
+{
+ const SwStartNode *pSttNd = 0;
+
+ if( pStartNode || ((SwXCell *)this)->IsValid() )
+ pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
+
+ return pSttNd;
+}
+
+uno::Reference< XTextCursor > SwXCell::createCursor() throw ( ::com::sun::star::uno::RuntimeException)
+{
+ return createTextCursor();
+}
+
+sal_Bool SwXCell::IsValid()
+{
+ SwFrmFmt* pTblFmt = pBox ? GetFrmFmt() : 0;
+ if(!pTblFmt)
+ pBox = 0;
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ const SwTableBox* pFoundBox ;
+ pFoundBox = FindBox(pTable, pBox);
+ if(!pFoundBox)
+ pBox = 0;
+ }
+ return 0 != pBox;
+}
+
+OUString SwXCell::getFormula(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ OUString sRet;
+ if(IsValid())
+ {
+ SwTblBoxFormula aFormula( pBox->GetFrmFmt()->GetTblBoxFormula() );
+ SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ aFormula.PtrToBoxNm( pTable );
+ sRet = aFormula.GetFormula();
+ }
+ return sRet;
+}
+
+void SwXCell::setFormula(const OUString& rFormula) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(IsValid())
+ {
+ // Der Text mu� zunaechst (vielleicht) geloescht werden
+ sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( sal_True );
+ if(USHRT_MAX == nNdPos)
+ setString(OUString());
+ String sFml(rFormula);
+ if( sFml.EraseLeadingChars().Len() && '=' == sFml.GetChar( 0 ) )
+ sFml.Erase( 0, 1 );
+ SwTblBoxFormula aFml( sFml );
+ SwDoc* pDoc = GetDoc();
+ UnoActionContext aAction(pDoc);
+ SfxItemSet aSet(pDoc->GetAttrPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMULA);
+ const SfxPoolItem* pItem;
+ SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ if(SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
+ || pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue()))
+ {
+ aSet.Put(SwTblBoxNumFormat(0));
+ }
+ aSet.Put(aFml);
+ GetDoc()->SetTblBoxFormulaAttrs( *pBox, aSet );
+ //Tabelle aktualisieren
+ SwTableFmlUpdate aTblUpdate( SwTable::FindTable( GetFrmFmt() ));
+ pDoc->UpdateTblFlds( &aTblUpdate );
+ }
+}
+
+double SwXCell::getValue(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return lcl_getValue( *this );
+}
+
+void SwXCell::setValue(double rValue) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ lcl_setValue( *this, rValue );
+}
+
+table::CellContentType SwXCell::getType(void) throw( uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+ return (table::CellContentType)0;
+}
+
+void SwXCell::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ lcl_setString( *this, aString );
+}
+
+sal_Int32 SwXCell::getError(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ OUString sContent = getString();
+ return sContent.equals(ViewShell::GetShellRes()->aCalc_Error);
+}
+
+uno::Reference< XTextCursor > SwXCell::createTextCursor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > aRef;
+ if(pStartNode || IsValid())
+ {
+ const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ SwXTextCursor* pCrsr = new SwXTextCursor(this, aPos, CURSOR_TBLTEXT, GetDoc());
+ SwUnoCrsr* pUnoCrsr = pCrsr->GetCrsr();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+ aRef = (XWordCursor*)pCrsr;
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+
+uno::Reference< XTextCursor > SwXCell::createTextCursorByRange(const uno::Reference< XTextRange > & xTextPosition)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > aRef;
+ SwUnoInternalPaM aPam(*GetDoc());
+ if((pStartNode || IsValid()) && SwXTextRange::XTextRangeToSwPaM(aPam, xTextPosition))
+ {
+ const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
+ //skip sections
+ SwStartNode* p1 = aPam.GetNode()->FindStartNode();
+ while(p1->IsSectionNode())
+ p1 = p1->FindStartNode();
+
+ if( p1 == pSttNd )
+ aRef = (XWordCursor*)new SwXTextCursor(this , *aPam.GetPoint(), CURSOR_TBLTEXT, GetDoc(), aPam.GetMark());
+ }
+ else
+ throw uno::RuntimeException();
+ return aRef;
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXCell::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue) throw( beans::UnknownPropertyException, beans::PropertyVetoException, IllegalArgumentException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(IsValid())
+ {
+ SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt();
+ SwAttrSet aSet(pBoxFmt->GetAttrSet());
+ aPropSet.setPropertyValue(rPropertyName, aValue, aSet);
+ pBoxFmt->GetDoc()->SetAttr(aSet, *pBoxFmt);
+ }
+}
+
+uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ if(IsValid())
+ {
+ if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_TEXT_SECTION)))
+ {
+ SwFrmFmt* pTblFmt = GetFrmFmt();
+ SwDoc* pDoc = pTblFmt->GetDoc();
+ SwTable* pTable = SwTable::FindTable( pTblFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+ SwSectionNode* pSectionNode = pTblNode->FindSectionNode();
+ if(pSectionNode)
+ {
+ const SwSection& rSect = pSectionNode->GetSection();
+ Reference< XTextSection > xSect =
+ SwXTextSections::GetObject( *rSect.GetFmt() );
+ aRet <<= xSect;
+ }
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_CELL_NAME)))
+ {
+ aRet <<= OUString ( pBox->GetName() );
+ }
+ else if(rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_START_REDLINE))||
+ rPropertyName.equalsAsciiL(SW_PROP_NAME(UNO_NAME_END_REDLINE)))
+ {
+ //redline can only be returned if it's a living object
+ aRet = SwXText::getPropertyValue(rPropertyName);
+ }
+ else
+ {
+ const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
+ const SwAttrSet& rSet = pBoxFmt->GetAttrSet();
+ aRet = aPropSet.getPropertyValue(rPropertyName, rSet);
+ }
+ }
+ return aRet;
+}
+
+void SwXCell::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXCell::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXCell::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXCell::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+uno::Reference< container::XEnumeration > SwXCell::createEnumeration(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< container::XEnumeration > aRef;
+ if(IsValid())
+ {
+ const SwStartNode* pSttNd = pBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ SwUnoCrsr* pUnoCrsr = GetDoc()->CreateUnoCrsr(aPos, sal_False);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ aRef = new SwXParagraphEnumeration(this, pUnoCrsr, CURSOR_TBLTEXT);
+ }
+ return aRef;
+}
+
+uno::Type SAL_CALL SwXCell::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<XTextRange>*)0);
+
+}
+
+sal_Bool SwXCell::hasElements(void) throw( uno::RuntimeException )
+{
+ return sal_True;
+}
+
+void SwXCell::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+SwXCell* SwXCell::CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, const String* pCellName, SwTable *pTable )
+{
+ SwXCell* pRet = 0;
+ if(pTblFmt && pBox)
+ {
+ if( !pTable )
+ pTable = SwTable::FindTable( pTblFmt );
+ sal_uInt16 nPos = USHRT_MAX;
+ SwTableBox* pFoundBox =
+ pTable->GetTabSortBoxes().Seek_Entry( pBox, &nPos ) ? pBox : NULL;
+
+ //wenn es die Box gibt, dann wird auch eine Zelle zurueckgegeben
+ if(pFoundBox)
+ {
+ SwClientIter aIter( *pTblFmt );
+ SwXCell* pXCell = (SwXCell*)aIter.
+ First( TYPE( SwXCell ));
+ while( pXCell )
+ {
+ // gibt es eine passende Zelle bereits?
+ if(pXCell->GetTblBox() == pBox)
+ break;
+ pXCell = (SwXCell*)aIter.Next();
+ }
+ //sonst anlegen
+ if(!pXCell)
+ pXCell = new SwXCell(pTblFmt, pBox, nPos );
+ pRet = pXCell;
+ }
+ }
+ return pRet;
+}
+/* -----------------12.06.98 07:37-------------------
+ * exitstiert die Box in der angegebenen Tabelle?
+ * --------------------------------------------------*/
+SwTableBox* SwXCell::FindBox(SwTable* pTable, SwTableBox* pBox)
+{
+ // check if nFndPos happens to point to the right table box
+ if( nFndPos < pTable->GetTabSortBoxes().Count() &&
+ pBox == pTable->GetTabSortBoxes()[ nFndPos ] )
+ return pBox;
+
+ // if not, seek the entry (and return, if successful)
+ if( pTable->GetTabSortBoxes().Seek_Entry( pBox, &nFndPos ))
+ return pBox;
+
+ // box not found: reset nFndPos pointer
+ nFndPos = USHRT_MAX;
+ return 0;
+}
+
+OUString SwXCell::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXCell");
+}
+
+BOOL SwXCell::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return sServiceName.EqualsAscii("com.sun.star.text.CellProperties");
+}
+
+Sequence< OUString > SwXCell::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.CellProperties");
+ return aRet;
+}
+
+/******************************************************************
+ * SwXTextTableRow
+ ******************************************************************/
+OUString SwXTextTableRow::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextTableRow");
+}
+
+BOOL SwXTextTableRow::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextTableRow") == rServiceName;
+}
+
+Sequence< OUString > SwXTextTableRow::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextTableRow");
+ return aRet;
+}
+TYPEINIT1(SwXTextTableRow, SwClient);
+
+SwXTextTableRow::SwXTextTableRow(SwFrmFmt* pFmt, SwTableLine* pLn) :
+ SwClient(pFmt),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE_ROW)),
+ pLine(pLn)
+{
+
+}
+
+SwXTextTableRow::~SwXTextTableRow()
+{
+
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXTextTableRow::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException, IllegalArgumentException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine);
+ if(pLn)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ SwDoc* pDoc = pFmt->GetDoc();
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch(pMap->nWID)
+ {
+ case FN_UNO_ROW_HEIGHT:
+ case FN_UNO_ROW_AUTO_HEIGHT:
+ {
+ SwFmtFrmSize aFrmSize(pLn->GetFrmFmt()->GetFrmSize());
+ if(FN_UNO_ROW_AUTO_HEIGHT== pMap->nWID)
+ {
+ sal_Bool bSet = *(sal_Bool*)aValue.getValue();
+ aFrmSize.SetSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
+ }
+ else
+ {
+ sal_Int32 nHeight;
+ aValue >>= nHeight;
+ Size aSz(aFrmSize.GetSize());
+ aSz.Height() = MM100_TO_TWIP(nHeight);
+ aFrmSize.SetSize(aSz);
+ }
+ pDoc->SetAttr(aFrmSize, *pLn->ClaimFrmFmt());
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ lcl_SetTblSeparators(aValue, pTable, pLine->GetTabBoxes()[0], sal_True, pDoc);
+ }
+ break;
+ default:
+ {
+ SwFrmFmt* pLnFmt = pLn->ClaimFrmFmt();
+ SwAttrSet aSet(pLnFmt->GetAttrSet());
+ aPropSet.setPropertyValue(*pMap, aValue, aSet);
+ pDoc->SetAttr(aSet, *pLnFmt);
+ }
+ }
+ }
+ }
+}
+
+uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, pLine);
+ if(pLn)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ switch(pMap->nWID)
+ {
+ case FN_UNO_ROW_HEIGHT:
+ case FN_UNO_ROW_AUTO_HEIGHT:
+ {
+ const SwFmtFrmSize& rSize = pLn->GetFrmFmt()->GetFrmSize();
+ if(FN_UNO_ROW_AUTO_HEIGHT== pMap->nWID)
+ {
+ BOOL bTmp = ATT_VAR_SIZE == rSize.GetSizeType();
+ aRet.setValue(&bTmp, ::getCppuBooleanType());
+ }
+ else
+ aRet <<= (sal_Int32)(TWIP_TO_MM100(rSize.GetSize().Height()));
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ lcl_GetTblSeparators(aRet, pTable, pLine->GetTabBoxes()[0], sal_True);
+ }
+ break;
+ default:
+ {
+ const SwAttrSet& rSet = pLn->GetFrmFmt()->GetAttrSet();
+ aRet = aPropSet.getPropertyValue(*pMap, rSet);
+ }
+ }
+ }
+ }
+ return aRet;
+}
+
+void SwXTextTableRow::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableRow::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableRow::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableRow::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableRow::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine* pLine)
+{
+ SwTableLine* pRet = 0;
+ SwTableLines &rLines = pTable->GetTabLines();
+ for(sal_uInt16 i = 0; i < rLines.Count(); i++)
+ if(rLines.GetObject(i) == pLine)
+ {
+ pRet = pLine;
+ break;
+ }
+ return pRet;
+}
+
+/******************************************************************
+ * SwXTextTableCursor
+ ******************************************************************/
+OUString SwXTextTableCursor::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextTableCursor");
+}
+
+BOOL SwXTextTableCursor::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TextTableCursor") == rServiceName;
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(SwXTextTableCursor,SwXTextTableCursor_Base,OTextCursorHelper)
+const SwPaM* SwXTextTableCursor::GetPaM() const { return GetCrsr(); }
+SwPaM* SwXTextTableCursor::GetPaM() { return GetCrsr(); }
+const SwDoc* SwXTextTableCursor::GetDoc() const { return GetFrmFmt()->GetDoc(); }
+SwDoc* SwXTextTableCursor::GetDoc() { return GetFrmFmt()->GetDoc(); }
+const SwUnoCrsr* SwXTextTableCursor::GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
+SwUnoCrsr* SwXTextTableCursor::GetCrsr() { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); }
+
+Sequence< OUString > SwXTextTableCursor::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextTableCursor");
+ return aRet;
+}
+
+SwXTextTableCursor::SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox) :
+ SwClient(pFmt),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE_CURSOR)),
+ aCrsrDepend(this, 0)
+{
+ SwDoc* pDoc = pFmt->GetDoc();
+ const SwStartNode* pSttNd = pBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->Add(&aCrsrDepend);
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ pTblCrsr->MakeBoxSels();
+}
+
+SwXTextTableCursor::~SwXTextTableCursor()
+{
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ delete pUnoCrsr;
+}
+
+OUString SwXTextTableCursor::getRangeName(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ OUString aRet;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ pTblCrsr->MakeBoxSels();
+ const SwStartNode* pStart = pTblCrsr->GetPoint()->nNode.GetNode().FindTableBoxStartNode();
+ const SwTable* pTable = SwTable::FindTable( GetFrmFmt() );
+ const SwTableBox* pBox = pTable->GetTblBox( pStart->GetIndex());
+ String sRet = pBox->GetName();
+
+ if(pTblCrsr->HasMark())
+ {
+ pStart = pTblCrsr->GetMark()->nNode.GetNode().FindTableBoxStartNode();
+ const SwTableBox* pEBox = pTable->GetTblBox( pStart->GetIndex());
+ if(pEBox != pBox)
+ {
+ sRet += ':';
+ sRet += pEBox->GetName();
+ }
+ }
+ aRet = sRet;
+ }
+ return aRet;
+}
+
+sal_Bool SwXTextTableCursor::gotoCellByName(const OUString& CellName, sal_Bool Expand)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ String sCellName(CellName);
+ bRet = pTblCrsr->GotoTblBox(sCellName);
+ }
+ return bRet;
+}
+
+sal_Bool SwXTextTableCursor::goLeft(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->Left( Count,CRSR_SKIP_CHARS);
+ }
+ return bRet;
+}
+
+sal_Bool SwXTextTableCursor::goRight(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->Right( Count, CRSR_SKIP_CHARS);
+ }
+ return bRet;
+}
+
+sal_Bool SwXTextTableCursor::goUp(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->UpDown(sal_True, Count);
+ }
+ return bRet;
+}
+
+sal_Bool SwXTextTableCursor::goDown(sal_Int16 Count, sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ bRet = pTblCrsr->UpDown(sal_False, Count);
+ }
+ return bRet;
+}
+
+void SwXTextTableCursor::gotoStart(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ pTblCrsr->MoveTable(fnTableCurr, fnTableStart);
+ }
+}
+
+void SwXTextTableCursor::gotoEnd(sal_Bool Expand) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ lcl_CrsrSelect( pTblCrsr, Expand );
+ pTblCrsr->MoveTable(fnTableCurr, fnTableEnd);
+ }
+}
+
+sal_Bool SwXTextTableCursor::mergeRange(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ pTblCrsr->MakeBoxSels();
+
+ {
+ UnoActionContext aContext(pUnoCrsr->GetDoc());
+ bRet = TBLMERGE_OK == pTblCrsr->GetDoc()->MergeTbl(*pTblCrsr);
+ if(bRet)
+ {
+ USHORT nCount = pTblCrsr->GetBoxesCount();
+ while(nCount--)
+ pTblCrsr->DeleteBox(nCount);
+ }
+ }
+ pTblCrsr->MakeBoxSels();
+ }
+ return bRet;
+}
+
+sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if (Count <= 0)
+ throw RuntimeException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Illegal first argument: needs to be > 0" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ sal_Bool bRet = sal_False;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ pTblCrsr->MakeBoxSels();
+ {
+ UnoActionContext aContext(pUnoCrsr->GetDoc());
+ bRet = pTblCrsr->GetDoc()->SplitTbl( pTblCrsr->GetBoxes(), !Horizontal, Count );
+ }
+ pTblCrsr->MakeBoxSels();
+ }
+ return bRet;
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXTextTableCursor::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException,
+ uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwStartNode* pSttNode = pUnoCrsr->GetNode()->FindStartNode();
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ pTblCrsr->MakeBoxSels();
+ SwDoc* pDoc = pUnoCrsr->GetDoc();
+ switch(pMap->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush;
+ pDoc->GetBoxBackground( *pUnoCrsr, aBrush );
+ aBrush.PutValue(aValue, pMap->nMemberId);
+ pDoc->SetBoxAttr( *pUnoCrsr, aBrush );
+
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ {
+ SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
+ aNumberFormat.PutValue(aValue, 0);
+ pDoc->SetBoxAttr( *pUnoCrsr, aNumberFormat);
+ }
+ break;
+ case FN_UNO_PARA_STYLE:
+ lcl_SetTxtFmtColl(aValue, *pUnoCrsr);
+ break;
+ default:
+ {
+ SfxItemSet rSet(pDoc->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END -1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0L);
+ SwXTextCursor::GetCrsrAttr(pTblCrsr->GetSelRing(), rSet);
+ aPropSet.setPropertyValue(*pMap, aValue, rSet);
+ SwXTextCursor::SetCrsrAttr(pTblCrsr->GetSelRing(), rSet, CRSR_ATTR_MODE_TABLE);
+ }
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+}
+
+uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwUnoCrsr* pUnoCrsr = GetCrsr();
+ if(pUnoCrsr)
+ {
+ SwStartNode* pSttNode = pUnoCrsr->GetNode()->FindStartNode();
+ const SwTableNode* pTblNode = pSttNode->FindTableNode();
+ lcl_FormatTable((SwFrmFmt*)pTblNode->GetTable().GetFrmFmt());
+ SwUnoTableCrsr* pTblCrsr = *pUnoCrsr;
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ aPropSet.getPropertyMap(), rPropertyName);
+ if(pMap)
+ {
+ pTblCrsr->MakeBoxSels();
+ switch(pMap->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush;
+ if(pTblCrsr->GetDoc()->GetBoxBackground( *pUnoCrsr, aBrush ))
+ aBrush.QueryValue(aRet, pMap->nMemberId);
+
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ //GetAttr fuer Tabellenselektion am Doc fehlt noch
+ DBG_WARNING("not implemented");
+ break;
+ case FN_UNO_PARA_STYLE:
+ {
+ SwFmtColl* pFmt = SwXTextCursor::GetCurTxtFmtColl(*pUnoCrsr, FALSE);
+ OUString sRet;
+ if(pFmt)
+ sRet = pFmt->GetName();
+ aRet <<= sRet;
+ }
+ break;
+ default:
+ {
+ SfxItemSet aSet(pTblCrsr->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END -1,
+ RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
+ 0L);
+ // erstmal die Attribute des Cursors
+ SwXTextCursor::GetCrsrAttr(pTblCrsr->GetSelRing(), aSet);
+ aRet = aPropSet.getPropertyValue(*pMap, aSet);
+ }
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ return aRet;
+}
+
+void SwXTextTableCursor::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableCursor::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableCursor::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableCursor::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTableCursor::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+/******************************************************************
+ * SwXTextTable
+ ******************************************************************/
+/****************************************************************************
+ Tabellenbeschreibung
+****************************************************************************/
+class SwTableProperties_Impl
+{
+ const SfxItemPropertyMap* _pMap;
+ uno::Any* pAnyArr[TABLE_PROP_COUNT];
+ sal_uInt16 nArrLen;
+
+public:
+ SwTableProperties_Impl(const SfxItemPropertyMap* pMap);
+ ~SwTableProperties_Impl();
+
+ sal_Bool SetProperty(const char* pName , uno::Any aVal);
+ sal_Bool GetProperty(const char* pName, uno::Any*& rpAny);
+
+ sal_Bool SetProperty(USHORT nId , uno::Any aVal)
+ { return SetProperty(SW_PROP_NAME_STR( nId ), aVal); }
+ sal_Bool GetProperty(USHORT nId, uno::Any*& rpAny)
+ { return GetProperty(SW_PROP_NAME_STR( nId ), rpAny); }
+
+ const SfxItemPropertyMap* GetMap() const {return _pMap;}
+ void ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc);
+};
+
+SwTableProperties_Impl::SwTableProperties_Impl(const SfxItemPropertyMap* pMap) :
+ _pMap(pMap),
+ nArrLen(TABLE_PROP_COUNT)
+{
+ const SfxItemPropertyMap* pTemp = _pMap;
+ for(sal_uInt16 i = 0; i < nArrLen; i++)
+ pAnyArr[i] = 0;
+
+}
+
+SwTableProperties_Impl::~SwTableProperties_Impl()
+{
+ for(sal_uInt16 i = 0; i < nArrLen; i++)
+ delete pAnyArr[i];
+}
+
+sal_Bool SwTableProperties_Impl::SetProperty(const char* pName, uno::Any aVal)
+{
+ sal_uInt16 nPos = 0;
+ const SfxItemPropertyMap* pTemp = _pMap;
+ String aName(C2S( pName ));
+ while( pTemp->pName )
+ {
+ if( aName.EqualsAscii(pTemp->pName))
+ break;
+ ++nPos;
+ ++pTemp;
+ }
+ if(nPos < nArrLen)
+ {
+ delete pAnyArr[nPos];
+ pAnyArr[nPos] = new uno::Any(aVal);
+ }
+ return nPos < nArrLen;
+}
+
+sal_Bool SwTableProperties_Impl::GetProperty(const char* pName, uno::Any*& rpAny )
+{
+ sal_uInt16 nPos = 0;
+ const SfxItemPropertyMap* pTemp = _pMap;
+ String aName(C2S(pName));
+ while( pTemp->pName )
+ {
+ if(aName.EqualsAscii(pTemp->pName))
+ break;
+ ++nPos;
+ ++pTemp;
+ }
+ if(nPos < nArrLen)
+ rpAny = pAnyArr[nPos];
+ return rpAny && nPos < nArrLen;
+}
+
+void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc)
+{
+ SfxItemSet aSet(rDoc.GetAttrPool(),
+ RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FRM_SIZE, RES_UL_SPACE,
+ RES_HORI_ORIENT, RES_HORI_ORIENT,
+ RES_BREAK, RES_BREAK,
+ RES_KEEP, RES_KEEP,
+ RES_SHADOW, RES_SHADOW,
+ RES_PAGEDESC, RES_PAGEDESC,
+ 0
+ );
+ uno::Any* pRepHead;
+ const SwFrmFmt &rFrmFmt = *rTbl.GetFrmFmt();
+ if(GetProperty(UNO_NAME_REPEAT_HEADLINE, pRepHead ))
+ {
+ sal_Bool bVal = *(sal_Bool*)pRepHead->getValue();
+ ((SwTable&)rTbl).SetHeadlineRepeat(bVal);
+ }
+
+ uno::Any* pBackColor = 0;
+ GetProperty(UNO_NAME_BACK_COLOR, pBackColor );
+ uno::Any* pBackTrans = 0;
+ GetProperty(UNO_NAME_BACK_TRANSPARENT, pBackTrans );
+ uno::Any* pGrLoc = 0;
+ GetProperty(UNO_NAME_GRAPHIC_LOCATION, pGrLoc );
+ uno::Any* pGrURL = 0;
+ GetProperty(UNO_NAME_GRAPHIC_URL, pGrURL );
+ uno::Any* pGrFilter = 0;
+ GetProperty(UNO_NAME_GRAPHIC_FILTER, pGrFilter );
+
+ if(pBackColor||pBackTrans||pGrURL||pGrFilter||pGrLoc)
+ {
+ SvxBrushItem aBrush ( rFrmFmt.GetBackground() );
+ if(pBackColor)
+ aBrush.PutValue(*pBackColor, MID_BACK_COLOR);
+ if(pBackTrans)
+ aBrush.PutValue(*pBackTrans, MID_GRAPHIC_TRANSPARENT);
+ if(pGrURL)
+ aBrush.PutValue(*pGrURL, MID_GRAPHIC_URL);
+ if(pGrFilter)
+ aBrush.PutValue(*pGrFilter, MID_GRAPHIC_FILTER);
+ if(pGrLoc)
+ aBrush.PutValue(*pGrLoc, MID_GRAPHIC_POSITION);
+ aSet.Put(aBrush);
+ }
+
+ sal_Bool bPutBreak = sal_True;
+ uno::Any* pPage;
+ if(GetProperty(UNO_NAME_PAGE_STYLE_NAME, pPage))
+ {
+ OUString uTmp;
+ (*pPage) >>= uTmp;
+ String sPageStyle = uTmp;
+ const SwPageDesc* pDesc = 0;
+ if(sPageStyle.Len())
+ {
+ SwStyleNameMapper::FillUIName(sPageStyle, sPageStyle, GET_POOLID_PAGEDESC, sal_True );
+ const SwPageDesc* pDesc = ::binfilter::GetPageDescByName_Impl(rDoc, sPageStyle);
+ if(pDesc)
+ {
+ SwFmtPageDesc aDesc( pDesc );
+ uno::Any* pPgNo;
+ if(GetProperty(UNO_NAME_PAGE_NUMBER_OFFSET, pPgNo ))
+ {
+ INT16 nTmp;
+ (*pPgNo) >>= nTmp;
+ aDesc.SetNumOffset( nTmp );
+ }
+ aSet.Put(aDesc);
+ bPutBreak = sal_False;
+ }
+
+ }
+ }
+ uno::Any* pBreak;
+ if(bPutBreak && GetProperty(UNO_NAME_BREAK_TYPE, pBreak))
+ {
+ SvxFmtBreakItem aBreak ( rFrmFmt.GetBreak() );
+ aBreak.PutValue(*pBreak, 0);
+ aSet.Put(aBreak);
+ }
+ uno::Any* pShadow;
+ if(GetProperty(UNO_NAME_SHADOW_FORMAT, pShadow))
+ {
+ SvxShadowItem aShd ( rFrmFmt.GetShadow() );
+ aShd.PutValue(*pShadow, CONVERT_TWIPS);
+ aSet.Put(aShd);
+ }
+ uno::Any* pKeep;
+ if(GetProperty(UNO_NAME_KEEP_TOGETHER, pKeep))
+ {
+ SvxFmtKeepItem aKeep( rFrmFmt.GetKeep() );
+ aKeep.PutValue(*pKeep, 0);
+ aSet.Put(aKeep);
+ }
+
+ sal_Bool bFullAlign = sal_True;
+ uno::Any* pHOrient;
+ if(GetProperty(UNO_NAME_HORI_ORIENT, pHOrient))
+ {
+ SwFmtHoriOrient aOrient ( rFrmFmt.GetHoriOrient() );
+ ((SfxPoolItem&)aOrient).PutValue(*pHOrient, MID_HORIORIENT_ORIENT|CONVERT_TWIPS);
+ bFullAlign = (aOrient.GetHoriOrient() == HORI_FULL);
+ aSet.Put(aOrient);
+ }
+
+
+ uno::Any* pSzRel = 0;
+ GetProperty(UNO_NAME_IS_WIDTH_RELATIVE, pSzRel );
+ uno::Any* pRelWidth = 0;
+ GetProperty(UNO_NAME_RELATIVE_WIDTH, pRelWidth);
+ uno::Any* pWidth = 0;
+ GetProperty(UNO_NAME_WIDTH, pWidth );
+
+ sal_Bool bPutSize = pWidth != 0;
+ SwFmtFrmSize aSz( ATT_VAR_SIZE);
+ if(pWidth)
+ {
+ ((SfxPoolItem&)aSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH);
+ bPutSize = sal_True;
+ }
+ sal_Bool bTemp = pSzRel ? *(sal_Bool*)pSzRel->getValue() : FALSE;
+ if(pSzRel && bTemp && pRelWidth)
+ {
+ ((SfxPoolItem&)aSz).PutValue(*pRelWidth, MID_FRMSIZE_REL_WIDTH|CONVERT_TWIPS);
+ bPutSize = sal_True;
+ }
+ if(bPutSize)
+ {
+ if(!aSz.GetWidth())
+ aSz.SetWidth(MINLAY);
+ aSet.Put(aSz);
+ }
+ uno::Any* pL = 0;
+ GetProperty(UNO_NAME_LEFT_MARGIN, pL);
+ uno::Any* pR = 0;
+ GetProperty(UNO_NAME_RIGHT_MARGIN, pR);
+ if(pL||pR)
+ {
+ SvxLRSpaceItem aLR ( rFrmFmt.GetLRSpace() );
+ if(pL)
+ ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS);
+ if(pR)
+ ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS);
+ aSet.Put(aLR);
+ }
+ uno::Any* pU = 0;
+ GetProperty(UNO_NAME_TOP_MARGIN, pU);
+ uno::Any* pLo = 0;
+ GetProperty(UNO_NAME_BOTTOM_MARGIN, pLo);
+ if(pU||pLo)
+ {
+ SvxULSpaceItem aUL ( rFrmFmt.GetULSpace() );
+ if(pU)
+ ((SfxPoolItem&)aUL).PutValue(*pU, MID_UP_MARGIN|CONVERT_TWIPS);
+ if(pLo)
+ ((SfxPoolItem&)aUL).PutValue(*pLo, MID_LO_MARGIN|CONVERT_TWIPS);
+ aSet.Put(aUL);
+ }
+ uno::Any* pSplit;
+ if(GetProperty(UNO_NAME_SPLIT, pSplit ))
+ {
+ sal_Bool bTemp = *(sal_Bool*)pSplit->getValue();
+ SwFmtLayoutSplit aSp(bTemp);
+ aSet.Put(aSp);
+ }
+
+ //TODO: folgende Propertiers noch impl.
+// FN_UNO_RANGE_ROW_LABEL
+// FN_UNO_RANGE_COL_LABEL
+// FN_UNO_TABLE_BORDER
+
+ if(aSet.Count())
+ {
+ rDoc.SetAttr( aSet, *rTbl.GetFrmFmt() );
+ }
+}
+
+SwXTextTable* SwXTextTable::GetImplementation(Reference< XInterface> xRef )
+{
+ uno::Reference<lang::XUnoTunnel> xTunnel( xRef, uno::UNO_QUERY);
+ if(xTunnel.is())
+ return (SwXTextTable*)xTunnel->getSomething(SwXTextTable::getUnoTunnelId());
+ return 0;
+}
+
+const uno::Sequence< sal_Int8 > & SwXTextTable::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXTextTable::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+TYPEINIT1(SwXTextTable, SwClient)
+
+SwXTextTable::SwXTextTable() :
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)),
+ aLstnrCntnr( (XTextTable*)this),
+ aChartLstnrCntnr( (XTextTable*)this),
+ bFirstRowAsLabel(sal_False),
+ bFirstColumnAsLabel(sal_False),
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)),
+ bIsDescriptor(sal_True),
+ nRows(2),
+ nColumns(2),
+ pTableProps(new SwTableProperties_Impl(GetTableDescPropertyMap()))
+{
+
+}
+
+SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt) :
+ SwClient( &rFrmFmt ),
+ aLstnrCntnr( (XTextTable*)this),
+ aChartLstnrCntnr( (XTextTable*)this),
+ bFirstRowAsLabel(sal_False),
+ bFirstColumnAsLabel(sal_False),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)),
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_TABLE)),
+ bIsDescriptor(sal_False),
+ nRows(0),
+ nColumns(0),
+ pTableProps(0)
+{
+
+}
+
+SwXTextTable::~SwXTextTable()
+{
+ delete pTableProps;
+}
+
+void SwXTextTable::initialize(sal_Int32 nR, sal_Int32 nC) throw( uno::RuntimeException )
+{
+ if(!bIsDescriptor || nR <= 0 || nC <= 0 || nR >= USHRT_MAX || nC >= USHRT_MAX )
+ throw uno::RuntimeException();
+ else
+ {
+ nRows = (sal_uInt16)nR;
+ nColumns = (sal_uInt16)nC;
+ }
+}
+
+uno::Reference< table::XTableRows > SwXTextTable::getRows(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XTableRows > xRet;
+ if (SwFrmFmt* pFmt = GetFrmFmt())
+ {
+ SwXTableRows* pRows = (SwXTableRows*)SwClientIter(*pFmt).
+ First(TYPE(SwXTableRows));
+ if (!pRows)
+ pRows = new SwXTableRows(*pFmt);
+ xRet = pRows;
+ }
+ if (!xRet.is())
+ throw uno::RuntimeException();
+ return xRet;
+}
+
+uno::Reference< table::XTableColumns > SwXTextTable::getColumns(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XTableColumns > xRet;
+ if (SwFrmFmt* pFmt = GetFrmFmt())
+ {
+ SwXTableColumns* pCols = (SwXTableColumns*)SwClientIter(*pFmt).
+ First(TYPE(SwXTableColumns));
+ if (!pCols)
+ pCols = new SwXTableColumns(*pFmt);
+ xRet = pCols;
+ }
+ if (!xRet.is())
+ throw uno::RuntimeException();
+ return xRet;
+}
+
+uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& CellName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XCell > xRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ String sCellName(CellName);
+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ if(pBox)
+ {
+ xRet = SwXCell::CreateXCell(pFmt, pBox, &sCellName);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+
+uno::Sequence< OUString > SwXTextTable::getCellNames(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ // gibts an der Tabelle und an allen Boxen
+ SwTableLines& rTblLines = pTable->GetTabLines();
+ SvStrings aAllNames;
+ lcl_InspectLines(rTblLines, aAllNames);
+ uno::Sequence< OUString > aRet(aAllNames.Count());
+ OUString* pArray = aRet.getArray();
+ for(sal_uInt16 i = aAllNames.Count(); i; i--)
+ {
+ String* pObject = aAllNames.GetObject(i-1);
+ pArray[i - 1] = *pObject;
+ aAllNames.Remove(i - 1);
+ delete pObject;
+ }
+ return aRet;
+ }
+ return uno::Sequence< OUString >();
+}
+
+uno::Reference< XTextTableCursor > SwXTextTable::createCursorByCellName(const OUString& CellName)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextTableCursor > xRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ String sCellName(CellName);
+ SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ if(pBox)
+ {
+ xRet = new SwXTextTableCursor(pFmt, pBox);
+ }
+ }
+ if(!xRet.is())
+ throw uno::RuntimeException();
+ return xRet;
+}
+
+void SwXTextTable::attachToRange(const uno::Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, uno::RuntimeException )
+{
+ // attachToRange must only be called once
+ if(!bIsDescriptor) /* already attached ? */
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "SwXTextTable: already attached to range." ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+ SwDoc* pDoc = pRange ? (SwDoc*)pRange->GetDoc() : pCursor ? (SwDoc*)pCursor->GetDoc() : 0;
+ if(pDoc && nRows && nColumns)
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ //das muss jetzt sal_True liefern
+ SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange);
+ //keine Tabellen in Tabellen!
+ if(!aPam.GetNode()->FindTableNode())
+ {
+ UnoActionContext aCont( pDoc );
+
+ const SwTable *pTable = 0;
+ if( 0 != aPam.Start()->nContent.GetIndex() )
+ {
+ pDoc->SplitNode(*aPam.Start() );
+ }
+ //TODO: wenn es der letzte Absatz ist, dann muss noch ein Absatz angehaengt werden!
+ if( aPam.HasMark() )
+ {
+ pDoc->DeleteAndJoin(aPam);
+ aPam.DeleteMark();
+ }
+ pTable = pDoc->InsertTable(
+ *aPam.GetPoint(),
+ nRows,
+ nColumns,
+ HORI_FULL,
+ HEADLINE|DEFAULT_BORDER|SPLIT_LAYOUT);
+ if(pTable)
+ {
+ // hier muessen die Properties des Descriptors ausgewertet werden
+ pTableProps->ApplyTblAttr(*pTable, *pDoc);
+ SwFrmFmt* pTblFmt = pTable->GetFrmFmt();
+ SwClientIter aIter( *pTblFmt );
+ for( SwClient* pC = aIter.First( TYPE( SwFrm ));
+ pC; pC = aIter.Next() )
+ {
+ if( ((SwFrm*)pC)->IsTabFrm() )
+ {
+ if(((SwFrm*)pC)->IsValid())
+ ((SwFrm*)pC)->InvalidatePos();
+ ((SwTabFrm*)pC)->SetONECalcLowers();
+ ((SwTabFrm*)pC)->Calc();
+ }
+ }
+
+ pTblFmt->Add(this);
+ if(m_sTableName.Len())
+ {
+ sal_uInt16 nIndex = 1;
+ const String sTmpName(m_sTableName);
+ String sTmpNameIndex(sTmpName);
+ while(pDoc->FindTblFmtByName( sTmpNameIndex, sal_True ) && nIndex < USHRT_MAX)
+ {
+ sTmpNameIndex = sTmpName;
+ sTmpNameIndex += nIndex++;
+ }
+ pDoc->SetTableName( *pTblFmt, sTmpNameIndex);
+ }
+
+ uno::Any* pName;
+ if(pTableProps->GetProperty(UNO_NAME_TABLE_NAME, pName))
+ {
+ OUString sTmp;
+ (*pName) >>= sTmp;
+ setName(sTmp);
+ }
+ bIsDescriptor = sal_False;
+ DELETEZ(pTableProps);
+ }
+ }
+ else
+ {
+ IllegalArgumentException aExcept;
+ aExcept.Message = C2U("tables cannot be inserted into tables");
+ throw aExcept;
+ }
+ }
+ else
+ throw IllegalArgumentException();
+}
+
+void SwXTextTable::attach(const uno::Reference< XTextRange > & xTextRange)
+ throw( IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ attachToRange( xTextRange );
+}
+
+uno::Reference< XTextRange > SwXTextTable::getAnchor(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(!pFmt)
+ throw uno::RuntimeException();
+ uno::Reference< XTextRange > xRet = new SwXTextRange(*pFmt);
+ return xRet;
+}
+
+void SwXTextTable::dispose(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableSortBoxes& rBoxes = pTable->GetTabSortBoxes();
+ SwSelBoxes aSelBoxes;
+ aSelBoxes.Insert(rBoxes.GetData(), rBoxes.Count());
+ pFmt->GetDoc()->DeleteRowCol(aSelBoxes);
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+void SwXTextTable::addEventListener(const uno::Reference< XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aLstnrCntnr.AddListener(aListener);
+}
+
+void SwXTextTable::removeEventListener(const uno::Reference< XEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aLstnrCntnr.RemoveListener(aListener))
+ throw uno::RuntimeException();
+}
+
+uno::Reference< table::XCell > SwXTextTable::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XCell > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ // Sheet interessiert nicht
+ if(nColumn >= 0 && nRow >= 0 && nColumn < USHRT_MAX && nRow < USHRT_MAX && pFmt)
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt,
+ (sal_uInt16)nColumn, (sal_uInt16)nRow);
+ if(pXCell)
+ aRef = pXCell;
+ }
+ if(!aRef.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRef;
+
+}
+
+uno::Reference< table::XCellRange > SwXTextTable::GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
+ const String& rTLName, const String& rBRName,
+ SwRangeDescriptor& rDesc)
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XCellRange > aRef;
+ String sTLName(rTLName);
+ String sBRName(rBRName);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ const SwTableBox* pBRBox = pTable->GetTblBox( sBRName );
+ if(pBRBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ pCrsr->MakeBoxSels();
+ // pUnoCrsr wird uebergeben und nicht geloescht
+ SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, rDesc);
+ aRef = pCellRange;
+ }
+ else
+ delete pUnoCrsr;
+ }
+ return aRef;
+}
+
+uno::Reference< table::XCellRange > SwXTextTable::getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop,
+ sal_Int32 nRight, sal_Int32 nBottom)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XCellRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt && nRight < USHRT_MAX && nBottom < USHRT_MAX &&
+ nLeft <= nRight && nTop <= nBottom &&
+ nLeft >= 0 && nRight >= 0 && nTop >= 0 && nBottom >= 0 )
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwRangeDescriptor aDesc;
+ aDesc.nTop = (sal_uInt16)nTop;
+ aDesc.nBottom = (sal_uInt16)nBottom;
+ aDesc.nLeft = (sal_uInt16)nLeft;
+ aDesc.nRight = (sal_uInt16)nRight;
+ String sTLName = lcl_GetCellName(aDesc.nLeft, aDesc.nTop);
+ String sBRName = lcl_GetCellName(aDesc.nRight, aDesc.nBottom);
+ aRef = GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
+ }
+ }
+ if(!aRef.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRef;
+}
+
+uno::Reference< table::XCellRange > SwXTextTable::getCellRangeByName(const OUString& aRange)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XCellRange > aRef;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sRange(aRange);
+ String sTLName(sRange.GetToken(0, ':'));
+ String sBRName(sRange.GetToken(1, ':'));
+ if(!sTLName.Len() || !sBRName.Len())
+ throw uno::RuntimeException();
+ SwRangeDescriptor aDesc;
+ aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1;
+ lcl_GetRowCol(sTLName, aDesc.nTop, aDesc.nLeft);
+ lcl_GetRowCol(sBRName, aDesc.nBottom, aDesc.nRight);
+ aRef = GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
+ }
+ }
+ if(!aRef.is())
+ throw uno::RuntimeException();
+ return aRef;
+}
+
+uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray()
+ throw (uno::RuntimeException)
+{
+ // see SwXTextTable::getData(...) also
+
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
+ if(pFmt)
+ {
+ uno::Sequence< uno::Any > * pRowArray = aRowSeq.getArray();
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< uno::Any > aColSeq(nColCount);
+ uno::Any * pColArray = aColSeq.getArray();
+ Reference< XCell > xCellRef;
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt, nCol, nRow);
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( sal_True );
+ if(USHRT_MAX == nNdPos)
+ pColArray[nCol] <<= lcl_getString(*pXCell);
+ else
+ pColArray[nCol] <<= lcl_getValue(*pXCell);
+ }
+ }
+ pRowArray[nRow] = aColSeq;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRowSeq;
+}
+
+void SAL_CALL SwXTextTable::setDataArray(
+ const uno::Sequence< uno::Sequence< uno::Any > >& rArray )
+ throw (uno::RuntimeException)
+{
+ // see SwXTextTable::setData(...) also
+
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = nRows;
+ sal_Int16 nColCount = nColumns;
+
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(pTable->IsTblComplex())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+
+ if(rArray.getLength() != nRowCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Sequence< Any >* pRowArray = rArray.getConstArray();
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< Any >& rColSeq = pRowArray[nRow];
+ if(rColSeq.getLength() != nColCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const Any * pColArray = rColSeq.getConstArray();
+ Reference< XCell > xCellRef;
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt, nCol, nRow);
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ const uno::Any &rAny = pColArray[nCol];
+ if (TypeClass_STRING == rAny.getValueTypeClass())
+ lcl_setString( *pXCell, *(::rtl::OUString *) rAny.getValue() );
+ else
+ {
+ double d;
+ if( !(rAny >>= d) )
+ throw uno::RuntimeException();
+ lcl_setValue( *pXCell, d );
+ }
+ }
+ }
+ }
+ }
+}
+
+uno::Sequence< uno::Sequence< double > > SwXTextTable::getData(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ uno::Sequence< uno::Sequence< double > > aRowSeq(bFirstRowAsLabel ? nRowCount - 1 : nRowCount);
+ if(pFmt)
+ {
+ uno::Sequence< double >* pArray = aRowSeq.getArray();
+
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< double > aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
+ double* pColArray = aColSeq.getArray();
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ pColArray[nCol - nColStart] = xCell->getValue();
+ }
+ pArray[nRow - nRowStart] = aColSeq;
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRowSeq;
+}
+
+void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ sal_Bool bChanged = sal_False;
+
+ if(!nRowCount || !nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt )
+ {
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ if(rData.getLength() < nRowCount - nRowStart)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Sequence< double >* pRowArray = rData.getConstArray();
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ if(rColSeq.getLength() < nColCount - nColStart)
+ {
+ throw uno::RuntimeException();
+ }
+ const double * pColArray = rColSeq.getConstArray();
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ xCell->setValue(pColArray[nCol - nColStart]);
+ bChanged=sal_True;
+ }
+ }
+ if ( bChanged )
+ aChartLstnrCntnr.ChartDataChanged();
+ }
+}
+
+uno::Sequence< OUString > SwXTextTable::getRowDescriptions(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ //exception ...
+ break;
+ }
+ Reference< XText > xText(xCell, UNO_QUERY);
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXTextTable::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount || rRowDesc.getLength() < (bFirstRowAsLabel ? nRowCount - 1 : nRowCount))
+ {
+ throw uno::RuntimeException();
+ return;
+ }
+ const OUString* pArray = rRowDesc.getConstArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ break;
+ }
+ uno::Reference< XText > xText(xCell, UNO_QUERY);
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wohin mit den Labels?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Sequence< OUString > SwXTextTable::getColumnDescriptions(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nColCount = getColumnCount();
+ if(!nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstRowAsLabel ? nColCount - 1 : nColCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstRowAsLabel)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ uno::Reference< XText > xText(xCell, UNO_QUERY);
+
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXTextTable::setColumnDescriptions(const uno::Sequence< OUString >& rColumnDesc) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nColCount = getColumnCount();
+ if(!nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const OUString* pArray = rColumnDesc.getConstArray();
+ if(bFirstRowAsLabel && rColumnDesc.getLength() >= nColCount - bFirstColumnAsLabel ? 1 : 0)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ break;
+ }
+ uno::Reference< XText > xText(xCell, UNO_QUERY);
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+void SwXTextTable::addChartDataChangeEventListener(
+ const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aChartLstnrCntnr.AddListener(aListener.get());
+}
+
+void SwXTextTable::removeChartDataChangeEventListener(
+ const uno::Reference< chart::XChartDataChangeEventListener > & aListener)
+ throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
+ throw uno::RuntimeException();
+}
+
+sal_Bool SwXTextTable::isNotANumber(double nNumber) throw( uno::RuntimeException )
+{
+ // We use DBL_MIN because starcalc does (which uses it because chart
+ // wants it that way!)
+ return ( nNumber == DBL_MIN );
+}
+
+double SwXTextTable::getNotANumber(void) throw( uno::RuntimeException )
+{
+ // We use DBL_MIN because starcalc does (which uses it because chart
+ // wants it that way!)
+ return DBL_MIN;
+}
+
+uno::Sequence< beans::PropertyValue > SwXTextTable::createSortDescriptor(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return SwXTextCursor::createSortDescriptor(sal_False);
+}
+
+void SwXTextTable::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwSortOptions aSortOpt;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt &&
+ SwXTextCursor::convertSortProperties(rDescriptor, aSortOpt))
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwSelBoxes aBoxes;
+ const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
+ for( sal_uInt16 n = 0; n < rTBoxes.Count(); ++n )
+ {
+ SwTableBox* pBox = rTBoxes[ n ];
+ aBoxes.Insert( pBox );
+ }
+ UnoActionContext aContext( pFmt->GetDoc() );
+ pFmt->GetDoc()->SortTbl(aBoxes, aSortOpt);
+ }
+}
+
+void SwXTextTable::autoFormat(const OUString& aName) throw( IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXTextTable::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(!aValue.hasValue())
+ throw IllegalArgumentException();
+ if(pFmt)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(0xFF == pMap->nMemberId)
+ {
+ lcl_SetSpecialProperty(pFmt, pMap, aValue);
+ }
+ else
+ {
+ switch(pMap->nWID)
+ {
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstRowAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstRowAsLabel = bTmp;
+ }
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstColumnAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstColumnAsLabel = bTmp;
+ }
+ }
+ break;
+ case FN_UNO_TABLE_BORDER:
+ {
+ const table::TableBorder* pBorder =
+ (const table::TableBorder* )aValue.getValue();
+ if(aValue.getValueType() == ::getCppuType((const table::TableBorder* )0)
+ && pBorder)
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwClientIter aIter( *pFmt );
+ //Tabellen ohne Layout (unsichtbare Header/Footer )
+ if(0 != aIter.First( TYPE( SwFrm )))
+ {
+ lcl_FormatTable(pFmt);
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLines &rLines = pTable->GetTabLines();
+
+
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pDoc);
+ SwTableBox* pTLBox = rLines[0]->GetTabBoxes()[0];
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+
+ SwTableLine* pLastLine = rLines[rLines.Count() - 1];
+ SwTableBoxes &rBoxes = pLastLine->GetTabBoxes();
+ const SwTableBox* pBRBox = rBoxes[rBoxes.Count() -1];
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ pCrsr->MakeBoxSels();
+
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+
+ SvxBoxItem aBox;
+ SvxBoxInfoItem aBoxInfo;
+ SvxBorderLine aLine;
+
+ sal_Bool bSet = lcl_LineToSvxLine(pBorder->TopLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_TOP);
+ aBoxInfo.SetValid(VALID_TOP, pBorder->IsTopLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->BottomLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM);
+ aBoxInfo.SetValid(VALID_BOTTOM, pBorder->IsBottomLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->LeftLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT);
+ aBoxInfo.SetValid(VALID_LEFT, pBorder->IsLeftLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->RightLine, aLine);
+ aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT);
+ aBoxInfo.SetValid(VALID_RIGHT, pBorder->IsRightLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->HorizontalLine, aLine);
+ aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_HORI);
+ aBoxInfo.SetValid(VALID_HORI, pBorder->IsHorizontalLineValid);
+
+ bSet = lcl_LineToSvxLine(pBorder->VerticalLine, aLine);
+ aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_VERT);
+ aBoxInfo.SetValid(VALID_VERT, pBorder->IsVerticalLineValid);
+
+ aBox.SetDistance((sal_uInt16)MM100_TO_TWIP(pBorder->Distance));
+ aBoxInfo.SetValid(VALID_DISTANCE, pBorder->IsDistanceValid);
+
+ aSet.Put(aBox);
+ aSet.Put(aBoxInfo);
+
+ pDoc->SetTabBorders(*pCrsr, aSet);
+ delete pUnoCrsr;
+ }
+ }
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ UnoActionContext(pFmt->GetDoc());
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ lcl_SetTblSeparators(aValue, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False, pFmt->GetDoc());
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:/*_readonly_*/ break;
+ default:
+ {
+ SwAttrSet aSet(pFmt->GetAttrSet());
+ aPropSet.setPropertyValue(*pMap, aValue, aSet);
+ pFmt->GetDoc()->SetAttr(aSet, *pFmt);
+ }
+ }
+ }
+ }
+ else if(bIsDescriptor)
+ {
+ String aPropertyName(rPropertyName);
+ if(!pTableProps->SetProperty(
+ ByteString( aPropertyName, RTL_TEXTENCODING_ASCII_US).GetBuffer(),
+ aValue))
+ throw IllegalArgumentException();
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if (!pMap)
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if(0xFF == pMap->nMemberId)
+ {
+ aRet = lcl_GetSpecialProperty(pFmt, pMap );
+ }
+ else
+ {
+ switch(pMap->nWID)
+ {
+ case FN_UNO_ANCHOR_TYPES:
+ case FN_UNO_TEXT_WRAP:
+ case FN_UNO_ANCHOR_TYPE:
+ SwXParagraph::getDefaultTextContentValue(aRet, OUString(), pMap->nWID);
+ break;
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTemp = bFirstRowAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTemp = bFirstColumnAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_TABLE_BORDER:
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwClientIter aIter( *pFmt );
+ //Tabellen ohne Layout (unsichtbare Header/Footer )
+ if(0 != aIter.First( TYPE( SwFrm )))
+ {
+ lcl_FormatTable(pFmt);
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableLines &rLines = pTable->GetTabLines();
+
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pDoc);
+ SwTableBox* pTLBox = rLines[0]->GetTabBoxes()[0];
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pDoc->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+
+ SwTableLine* pLastLine = rLines[rLines.Count() - 1];
+ SwTableBoxes &rBoxes = pLastLine->GetTabBoxes();
+ const SwTableBox* pBRBox = rBoxes[rBoxes.Count() -1];
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ pCrsr->MakeBoxSels();
+
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+ aSet.Put(SvxBoxInfoItem());
+ pDoc->GetTabBorders(*pCrsr, aSet);
+ const SvxBoxInfoItem& rBoxInfoItem = (const SvxBoxInfoItem&)aSet.Get(SID_ATTR_BORDER_INNER);
+ const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX);
+
+ table::TableBorder aTableBorder;
+ aTableBorder.TopLine = lcl_SvxLineToLine(rBox.GetTop());
+ aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(VALID_TOP);
+ aTableBorder.BottomLine = lcl_SvxLineToLine(rBox.GetBottom());
+ aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(VALID_BOTTOM);
+ aTableBorder.LeftLine = lcl_SvxLineToLine(rBox.GetLeft());
+ aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(VALID_LEFT);
+ aTableBorder.RightLine = lcl_SvxLineToLine(rBox.GetRight());
+ aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(VALID_RIGHT );
+ aTableBorder.HorizontalLine = lcl_SvxLineToLine(rBoxInfoItem.GetHori());
+ aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI);
+ aTableBorder.VerticalLine = lcl_SvxLineToLine(rBoxInfoItem.GetVert());
+ aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT);
+ aTableBorder.Distance = TWIP_TO_MM100( rBox.GetDistance() );
+ aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE);
+ aRet.setValue(&aTableBorder, ::getCppuType((const table::TableBorder*)0));
+ delete pUnoCrsr;
+ }
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_SEPARATORS:
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ lcl_GetTblSeparators(aRet, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False);
+ }
+ break;
+ case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:
+ aRet <<= (INT16) UNO_TABLE_COLUMN_SUM;
+ break;
+ case RES_ANCHOR:
+ //AnchorType ist readonly und maybevoid und wird nicht geliefert
+ break;
+ case FN_UNO_TEXT_SECTION:
+ {
+ SwDoc* pDoc = pFmt->GetDoc();
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+ SwSectionNode* pSectionNode = pTblNode->FindSectionNode();
+ if(pSectionNode)
+ {
+ const SwSection& rSect = pSectionNode->GetSection();
+ Reference< XTextSection > xSect =
+ SwXTextSections::GetObject( *rSect.GetFmt() );
+ aRet <<= xSect;
+ }
+ }
+ break;
+ default:
+ {
+ const SwAttrSet& rSet = pFmt->GetAttrSet();
+ aRet = aPropSet.getPropertyValue(*pMap, rSet);
+ }
+ }
+ }
+ }
+ else if(bIsDescriptor)
+ {
+ uno::Any* pAny = 0;
+ String aPropertyName(rPropertyName);
+ if(!pTableProps->GetProperty(ByteString(aPropertyName, RTL_TEXTENCODING_ASCII_US).GetBuffer(),
+ pAny))
+ throw IllegalArgumentException();
+ else if(pAny)
+ aRet = *pAny;
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXTextTable::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTable::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTable::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXTextTable::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+OUString SwXTextTable::getName(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String sRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(!pFmt && !bIsDescriptor)
+ throw uno::RuntimeException();
+ if(pFmt)
+ {
+ sRet = pFmt->GetName();
+ }
+ else
+ sRet = m_sTableName;
+ return sRet;
+}
+
+void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ String sNewTblName(rName);
+ if(!pFmt && !bIsDescriptor ||
+ !sNewTblName.Len() ||
+ STRING_NOTFOUND != sNewTblName.Search('.') ||
+ STRING_NOTFOUND != sNewTblName.Search(' ') )
+ throw uno::RuntimeException();
+
+ if(pFmt)
+ {
+ const String aOldName( pFmt->GetName() );
+ sal_Bool bNameFound = sal_False;
+ SwFrmFmt* pTmpFmt;
+ const SwFrmFmts* pTbl = pFmt->GetDoc()->GetTblFrmFmts();
+ for( sal_uInt16 i = pTbl->Count(); i; )
+ if( !( pTmpFmt = (*pTbl)[ --i ] )->IsDefault() &&
+ pTmpFmt->GetName() == sNewTblName &&
+ pFmt->GetDoc()->IsUsed( *pTmpFmt ))
+ {
+ bNameFound = sal_True;
+ break;
+ }
+
+ if(bNameFound)
+ {
+ throw uno::RuntimeException();
+ }
+ pFmt->SetName( sNewTblName );
+
+
+ SwStartNode *pStNd;
+ SwNodeIndex aIdx( *pFmt->GetDoc()->GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 );
+ while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+ {
+ aIdx++;
+ SwNode *pNd = pFmt->GetDoc()->GetNodes()[aIdx];
+ if ( pNd->IsOLENode() &&
+ aOldName == ((SwOLENode*)pNd)->GetChartTblName() )
+ {
+ ((SwOLENode*)pNd)->SetChartTblName( sNewTblName );
+
+ SwOLEObj& rOObj = ((SwOLENode*)pNd)->GetOLEObj();
+ SchMemChart *pData = SchDLL::GetChartData( rOObj.GetOleRef() );
+ if ( pData )
+ {
+ if ( aOldName == pData->GetMainTitle() )
+ {
+ pData->SetMainTitle( sNewTblName );
+//Window??
+ SchDLL::Update( rOObj.GetOleRef(), pData, 0/*GetWin()*/ );
+ }
+ SwFrm *pFrm;
+ SwClientIter aIter( *((SwOLENode*)pNd) );
+ for( pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) ); pFrm;
+ pFrm = (SwFrm*)aIter.Next() )
+ {
+//InvalidateWindows?
+// if ( pFrm->Frm().HasArea() )
+// ((ViewShell*)this)->InvalidateWindows( pFrm->Frm() );
+ }
+ }
+ }
+ aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 );
+ }
+ pFmt->GetDoc()->SetModified();
+ }
+ else
+ m_sTableName = sNewTblName;
+}
+
+sal_uInt16 SwXTextTable::getRowCount(void)
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nRet = 0;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ nRet = pTable->GetTabLines().Count();
+ }
+ }
+ return nRet;
+}
+
+sal_uInt16 SwXTextTable::getColumnCount(void)
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ sal_Int16 nRet = 0;
+ if(pFmt)
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ nRet = pLine->GetTabBoxes().Count();
+ }
+ }
+ return nRet;
+}
+
+void SwXTextTable::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ if(pOld && pOld->Which() == RES_REMOVE_UNO_OBJECT &&
+ (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
+ ((SwModify*)GetRegisteredIn())->Remove(this);
+ else
+ ClientModify(this, pOld, pNew);
+ if(!GetRegisteredIn())
+ {
+ aLstnrCntnr.Disposing();
+ aChartLstnrCntnr.Disposing();
+ }
+ else
+ aChartLstnrCntnr.ChartDataChanged();
+}
+
+OUString SAL_CALL SwXTextTable::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXTextTable");
+}
+
+sal_Bool SwXTextTable::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ String sServiceName(rServiceName);
+ return (sServiceName.EqualsAscii("com.sun.star.document.LinkTarget") ||
+ sServiceName.EqualsAscii("com.sun.star.text.TextTable") ||
+ sServiceName.EqualsAscii("com.sun.star.text.TextContent") ||
+ sServiceName.EqualsAscii("com.sun.star.text.TextSortable"));
+}
+
+uno::Sequence< OUString > SwXTextTable::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(4);
+ OUString* pArr = aRet.getArray();
+ pArr[0] = C2U("com.sun.star.document.LinkTarget");
+ pArr[1] = C2U("com.sun.star.text.TextTable");
+ pArr[2] = C2U("com.sun.star.text.TextContent");
+ pArr[2] = C2U("com.sun.star.text.TextSortable");
+ return aRet;
+}
+
+const uno::Sequence< sal_Int8 > & SwXCellRange::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+
+sal_Int64 SAL_CALL SwXCellRange::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+TYPEINIT1(SwXCellRange, SwClient);
+
+OUString SwXCellRange::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXCellRange");
+}
+
+BOOL SwXCellRange::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.text.CellRange" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.CharacterProperties" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.CharacterPropertiesAsian" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.CharacterPropertiesComplex") ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.ParagraphProperties" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.ParagraphPropertiesAsian" ) ) ||
+ rServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.style.ParagraphPropertiesComplex" ) );
+}
+
+Sequence< OUString > SwXCellRange::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(7);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.CellRange");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ return aRet;
+}
+
+SwXCellRange::SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt,
+ SwRangeDescriptor& rDesc) :
+ SwClient(&rFrmFmt),
+ aChartLstnrCntnr((cppu::OWeakObject*)this),
+ aCursorDepend(this, pCrsr),
+ aRgDesc(rDesc),
+ pTblCrsr(pCrsr),
+ aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_RANGE)),
+ bFirstRowAsLabel(sal_False),
+ bFirstColumnAsLabel(sal_False),
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_RANGE))
+{
+
+}
+
+SwXCellRange::~SwXCellRange()
+{
+ delete pTblCrsr;
+}
+
+uno::Reference< table::XCell > SwXCellRange::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XCell > aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ if(nColumn >= 0 && nRow >= 0 &&
+ getColumnCount() > nColumn && getRowCount() > nRow )
+ {
+ SwXCell* pXCell = lcl_CreateXCell(pFmt,
+ sal_Int16(aRgDesc.nLeft + nColumn), sal_Int16(aRgDesc.nTop + nRow));
+ if(pXCell)
+ aRet = pXCell;
+ }
+ }
+ if(!aRet.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRet;
+}
+
+uno::Reference< table::XCellRange > SwXCellRange::getCellRangeByPosition(
+ sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom)
+ throw( uno::RuntimeException, lang::IndexOutOfBoundsException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< table::XCellRange > aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt && getColumnCount() > nRight && getRowCount() > nBottom &&
+ nLeft <= nRight && nTop <= nBottom
+ && nLeft >= 0 && nRight >= 0 && nTop >= 0 && nBottom >= 0 )
+ {
+ SwTable* pTable = SwTable::FindTable( pFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwRangeDescriptor aNewDesc;
+ aNewDesc.nTop = nTop + aRgDesc.nTop;
+ aNewDesc.nBottom = nBottom + aRgDesc.nTop;
+ aNewDesc.nLeft = nLeft + aRgDesc.nLeft;
+ aNewDesc.nRight = nRight + aRgDesc.nLeft;
+ String sTLName = lcl_GetCellName(aNewDesc.nLeft, aNewDesc.nTop);
+ String sBRName = lcl_GetCellName(aNewDesc.nRight, aNewDesc.nBottom);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ // hier muessen die Actions aufgehoben
+ UnoActionRemoveContext aRemoveContext(pFmt->GetDoc());
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ const SwTableBox* pBRBox = pTable->GetTblBox( sBRName );
+ if(pBRBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ pCrsr->MakeBoxSels();
+ // pUnoCrsr wird uebergeben und nicht geloescht
+ SwXCellRange* pCellRange = new SwXCellRange(pUnoCrsr, *pFmt, aNewDesc);
+ aRet = pCellRange;
+ }
+ else
+ delete pUnoCrsr;
+ }
+ }
+ }
+ if(!aRet.is())
+ throw lang::IndexOutOfBoundsException();
+ return aRet;
+
+}
+
+Reference< XCellRange > SwXCellRange::getCellRangeByName(const OUString& rRange)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ String sRange(rRange);
+ String sTLName(sRange.GetToken(0, ':'));
+ String sBRName(sRange.GetToken(1, ':'));
+ if(!sTLName.Len() || !sBRName.Len())
+ throw uno::RuntimeException();
+ SwRangeDescriptor aDesc;
+ aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1;
+ lcl_GetRowCol(sTLName, aDesc.nTop, aDesc.nLeft);
+ lcl_GetRowCol(sBRName, aDesc.nBottom, aDesc.nRight);
+ return getCellRangeByPosition(aDesc.nLeft - aRgDesc.nLeft, aDesc.nTop - aRgDesc.nTop,
+ aDesc.nRight - aRgDesc.nLeft, aDesc.nBottom - aRgDesc.nTop);
+}
+
+uno::Reference< beans::XPropertySetInfo > SwXCellRange::getPropertySetInfo(void) throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRef = aPropSet.getPropertySetInfo();
+ return xRef;
+}
+
+void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
+ const uno::Any& aValue) throw( beans::UnknownPropertyException,
+ beans::PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ if ( pMap->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwDoc* pDoc = pTblCrsr->GetDoc();
+ {
+ // remove actions to enable box selection
+ UnoActionRemoveContext aRemoveContext(pDoc);
+ }
+ SwUnoTableCrsr* pCrsr = *pTblCrsr;
+ pCrsr->MakeBoxSels();
+ switch(pMap->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush;
+ pDoc->GetBoxBackground( *pTblCrsr, aBrush );
+ ((SfxPoolItem&)aBrush).PutValue(aValue, pMap->nMemberId);
+ pDoc->SetBoxAttr( *pTblCrsr, aBrush );
+
+ }
+ break;
+ case RES_BOX :
+ {
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+ SvxBoxInfoItem aBoxInfo;
+ aBoxInfo.SetValid(0xff, FALSE);
+ BYTE nValid = 0;
+ switch(pMap->nMemberId & ~CONVERT_TWIPS)
+ {
+ case LEFT_BORDER : nValid = VALID_LEFT; break;
+ case RIGHT_BORDER: nValid = VALID_RIGHT; break;
+ case TOP_BORDER : nValid = VALID_TOP; break;
+ case BOTTOM_BORDER: nValid = VALID_BOTTOM; break;
+ case LEFT_BORDER_DISTANCE :
+ case RIGHT_BORDER_DISTANCE:
+ case TOP_BORDER_DISTANCE :
+ case BOTTOM_BORDER_DISTANCE:
+ nValid = VALID_DISTANCE;
+ break;
+ }
+ aBoxInfo.SetValid(nValid, TRUE);
+
+
+ aSet.Put(aBoxInfo);
+ pDoc->GetTabBorders(*pCrsr, aSet);
+
+ aSet.Put(aBoxInfo);
+ SvxBoxItem aBoxItem((const SvxBoxItem&)aSet.Get(RES_BOX));
+ ((SfxPoolItem&)aBoxItem).PutValue(aValue, pMap->nMemberId);
+ aSet.Put(aBoxItem);
+ pDoc->SetTabBorders( *pTblCrsr, aSet );
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ {
+ SwUnoTableCrsr* pCrsr = *pTblCrsr;
+ SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT);
+ ((SfxPoolItem&)aNumberFormat).PutValue(aValue, 0);
+ pDoc->SetBoxAttr( *pCrsr, aNumberFormat);
+ }
+ break;
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstRowAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstRowAsLabel = bTmp;
+ }
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
+ if(bFirstColumnAsLabel != bTmp)
+ {
+ aChartLstnrCntnr.ChartDataChanged();
+ bFirstColumnAsLabel = bTmp;
+ }
+ }
+ break;
+ default:
+ {
+ SfxItemSet rSet(pDoc->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END -1,
+ 0L);
+ SwCursor& rSelCrsr = pCrsr->GetSelRing();
+ SwXTextCursor::GetCrsrAttr(rSelCrsr, rSet);
+ SwXTextCursor::SetPropertyValue(
+ rSelCrsr, aPropSet, rPropertyName,
+ aValue, pMap, CRSR_ATTR_MODE_TABLE);
+ }
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+}
+
+uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ if(pMap)
+ {
+ switch(pMap->nWID )
+ {
+ case FN_UNO_TABLE_CELL_BACKGROUND:
+ {
+ SvxBrushItem aBrush;
+ if(pTblCrsr->GetDoc()->GetBoxBackground( *pTblCrsr, aBrush ))
+ aBrush.QueryValue(aRet, pMap->nMemberId);
+
+ }
+ break;
+ case RES_BOX :
+ {
+ SwDoc* pDoc = pTblCrsr->GetDoc();
+ SfxItemSet aSet(pDoc->GetAttrPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+ aSet.Put(SvxBoxInfoItem());
+ pDoc->GetTabBorders(*pTblCrsr, aSet);
+ const SvxBoxItem& rBoxItem = ((const SvxBoxItem&)aSet.Get(RES_BOX));
+ rBoxItem.QueryValue(aRet, pMap->nMemberId);
+ }
+ break;
+ case RES_BOXATR_FORMAT:
+ //GetAttr fuer Tabellenselektion am Doc fehlt noch
+ DBG_WARNING("not implemented");
+ break;
+ case FN_UNO_PARA_STYLE:
+ {
+ SwFmtColl* pFmt = SwXTextCursor::GetCurTxtFmtColl(*pTblCrsr, FALSE);
+ OUString sRet;
+ if(pFmt)
+ sRet = pFmt->GetName();
+ aRet <<= sRet;
+ }
+ break;
+ case FN_UNO_RANGE_ROW_LABEL:
+ {
+ sal_Bool bTemp = bFirstRowAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ case FN_UNO_RANGE_COL_LABEL:
+ {
+ sal_Bool bTemp = bFirstColumnAsLabel;
+ aRet.setValue(&bTemp, ::getCppuBooleanType());
+ }
+ break;
+ default:
+ {
+ SfxItemSet aSet(pTblCrsr->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_FRMATR_END -1,
+ 0L);
+ // erstmal die Attribute des Cursors
+ SwUnoTableCrsr* pCrsr = *pTblCrsr;
+ SwXTextCursor::GetCrsrAttr(pCrsr->GetSelRing(), aSet);
+ aRet = aPropSet.getPropertyValue(*pMap, aSet);
+ }
+ }
+ }
+ else
+ throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ return aRet;
+}
+
+void SwXCellRange::addPropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXCellRange::removePropertyChangeListener(const OUString& PropertyName, const uno::Reference< beans::XPropertyChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXCellRange::addVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+void SwXCellRange::removeVetoableChangeListener(const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener > & aListener) throw( beans::UnknownPropertyException, WrappedTargetException, uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+
+uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
+ throw (uno::RuntimeException)
+{
+ // see SwXCellRange::getData also
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ uno::Sequence< uno::Any >* pRowArray = aRowSeq.getArray();
+ Reference< XCell > xCellRef;
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< uno::Any > aColSeq(nColCount);
+ uno::Any * pColArray = aColSeq.getArray();
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell * pXCell = lcl_CreateXCell(pFmt,
+ sal_Int16(aRgDesc.nLeft + nCol),
+ sal_Int16(aRgDesc.nTop + nRow));
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ sal_uInt32 nNdPos = pBox->IsValidNumTxtNd( sal_True );
+ if(USHRT_MAX == nNdPos)
+ pColArray[nCol] <<= lcl_getString(*pXCell);
+ else
+ pColArray[nCol] <<= lcl_getValue(*pXCell);
+ }
+ }
+ pRowArray[nRow] = aColSeq;
+ }
+ }
+ return aRowSeq;
+}
+
+void SAL_CALL SwXCellRange::setDataArray(
+ const uno::Sequence< uno::Sequence< uno::Any > >& rArray )
+ throw (uno::RuntimeException)
+{
+ // see SwXCellRange::setData also
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt )
+ {
+ if(rArray.getLength() != nRowCount)
+ {
+ throw uno::RuntimeException();
+ return;
+ }
+ const uno::Sequence< uno::Any >* pRowArray = rArray.getConstArray();
+ for(sal_uInt16 nRow = 0; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< uno::Any >& rColSeq = pRowArray[nRow];
+ if(rColSeq.getLength() != nColCount)
+ {
+ throw uno::RuntimeException();
+ }
+ const uno::Any * pColArray = rColSeq.getConstArray();
+ Reference< XCell > xCellRef;
+ for(sal_uInt16 nCol = 0; nCol < nColCount; nCol++)
+ {
+ SwXCell * pXCell = lcl_CreateXCell(pFmt,
+ sal_Int16(aRgDesc.nLeft + nCol),
+ sal_Int16(aRgDesc.nTop + nRow));
+ //! keep (additional) reference to object to prevent implicit destruction
+ //! in following UNO calls (when object will get referenced)
+ xCellRef = pXCell;
+ SwTableBox * pBox = pXCell ? pXCell->GetTblBox() : 0;
+ if(!pBox)
+ {
+ throw uno::RuntimeException();
+ }
+ else
+ {
+ const uno::Any &rAny = pColArray[nCol];
+ if (TypeClass_STRING == rAny.getValueTypeClass())
+ lcl_setString( *pXCell, *(::rtl::OUString *) rAny.getValue() );
+ else
+ {
+ double d;
+ if( !(rAny >>= d) )
+ throw uno::RuntimeException();
+ lcl_setValue( *pXCell, d );
+ }
+ }
+ }
+ }
+ }
+}
+
+uno::Sequence< uno::Sequence< double > > SwXCellRange::getData(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< uno::Sequence< double > > aRowSeq(bFirstRowAsLabel ? nRowCount - 1 : nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ uno::Sequence< double >* pRowArray = aRowSeq.getArray();
+
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ uno::Sequence< double > aColSeq(bFirstColumnAsLabel ? nColCount - 1 : nColCount);
+ double * pArray = aColSeq.getArray();
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw RuntimeException();
+ }
+ pArray[nCol - nColStart] = xCell->getValue();
+ }
+ pRowArray[nRow - nRowStart] = aColSeq;
+ }
+ }
+ return aRowSeq;
+}
+
+void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ sal_Int16 nColCount = getColumnCount();
+ if(!nRowCount || !nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt )
+ {
+ sal_uInt16 nRowStart = bFirstRowAsLabel ? 1 : 0;
+ if(rData.getLength() < nRowCount - nRowStart)
+ {
+ throw uno::RuntimeException();
+ return;
+ }
+ const uno::Sequence< double >* pRowArray = rData.getConstArray();
+ for(sal_uInt16 nRow = nRowStart; nRow < nRowCount; nRow++)
+ {
+ const uno::Sequence< double >& rColSeq = pRowArray[nRow - nRowStart];
+ sal_uInt16 nColStart = bFirstColumnAsLabel ? 1 : 0;
+ if(rColSeq.getLength() < nColCount - nColStart)
+ {
+ throw uno::RuntimeException();
+ }
+ const double * pColArray = rColSeq.getConstArray();
+ for(sal_uInt16 nCol = nColStart; nCol < nColCount; nCol++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(nCol, nRow);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ }
+ xCell->setValue(pColArray[nCol - nColStart]);
+ }
+ }
+ }
+}
+
+uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ break;
+ }
+ uno::Reference< XText > xText(xCell, UNO_QUERY);
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ sal_Int16 nRowCount = getRowCount();
+ if(!nRowCount || rRowDesc.getLength() < bFirstRowAsLabel ? nRowCount - 1 : nRowCount)
+ {
+ throw uno::RuntimeException();
+ return;
+ }
+ const OUString* pArray = rRowDesc.getConstArray();
+ if(bFirstColumnAsLabel)
+ {
+ sal_uInt16 nStart = bFirstRowAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nRowCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(0, i);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ break;
+ }
+ uno::Reference< XText > xText(xCell, UNO_QUERY);
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wohin mit den Labels?");
+ }
+ }
+}
+
+uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nColCount = getColumnCount();
+ if(!nColCount)
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("Table too complex");
+ throw aRuntime;
+ }
+ uno::Sequence< OUString > aRet(bFirstRowAsLabel ? nColCount - 1 : nColCount);
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ OUString* pArray = aRet.getArray();
+ if(bFirstRowAsLabel)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ break;
+ }
+ uno::Reference< XText > xText(xCell, UNO_QUERY);
+ pArray[i - nStart] = xText->getString();
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& ColumnDesc)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int16 nColCount = getColumnCount();
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt)
+ {
+ const OUString* pArray = ColumnDesc.getConstArray();
+ if(bFirstRowAsLabel && ColumnDesc.getLength() >= nColCount - bFirstColumnAsLabel ? 1 : 0)
+ {
+ sal_uInt16 nStart = bFirstColumnAsLabel ? 1 : 0;
+ for(sal_uInt16 i = nStart; i < nColCount; i++)
+ {
+ uno::Reference< table::XCell > xCell = getCellByPosition(i, 0);
+ if(!xCell.is())
+ {
+ throw uno::RuntimeException();
+ break;
+ }
+ uno::Reference< XText > xText(xCell, UNO_QUERY);
+
+ xText->setString(pArray[i - nStart]);
+ }
+ }
+ else
+ {
+ DBG_ERROR("Wo kommen die Labels her?");
+ }
+ }
+}
+
+void SwXCellRange::addChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn())
+ throw uno::RuntimeException();
+ aChartLstnrCntnr.AddListener(aListener.get());
+}
+
+void SwXCellRange::removeChartDataChangeEventListener(const uno::Reference< chart::XChartDataChangeEventListener > & aListener) throw( uno::RuntimeException )
+{
+ if(!GetRegisteredIn() || !aChartLstnrCntnr.RemoveListener(aListener.get()))
+ throw uno::RuntimeException();
+}
+
+sal_Bool SwXCellRange::isNotANumber(double nNumber) throw( uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+ return sal_False;
+
+}
+
+double SwXCellRange::getNotANumber(void) throw( uno::RuntimeException )
+{
+ DBG_WARNING("not implemented");
+ return 0.;
+}
+
+uno::Sequence< beans::PropertyValue > SwXCellRange::createSortDescriptor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ return SwXTextCursor::createSortDescriptor(sal_False);
+}
+
+void SAL_CALL SwXCellRange::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwSortOptions aSortOpt;
+ SwFrmFmt* pFmt = GetFrmFmt();
+ if(pFmt &&
+ SwXTextCursor::convertSortProperties(rDescriptor, aSortOpt))
+ {
+ SwUnoTableCrsr* pTableCrsr = *pTblCrsr;
+ pTableCrsr->MakeBoxSels();
+ UnoActionContext aContext( pFmt->GetDoc() );
+ pFmt->GetDoc()->SortTbl(pTableCrsr->GetBoxes(), aSortOpt);
+ }
+}
+
+sal_uInt16 SwXCellRange::getColumnCount(void)
+{
+ return aRgDesc.nRight - aRgDesc.nLeft + 1;
+}
+
+sal_uInt16 SwXCellRange::getRowCount(void)
+{
+ return aRgDesc.nBottom - aRgDesc.nTop + 1;
+}
+
+void SwXCellRange::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew );
+ if(!GetRegisteredIn() || !aCursorDepend.GetRegisteredIn())
+ {
+ pTblCrsr = 0;
+ aChartLstnrCntnr.Disposing();
+ }
+ else
+ aChartLstnrCntnr.ChartDataChanged();
+}
+
+/******************************************************************
+ * SwXTableRows
+ ******************************************************************/
+OUString SwXTableRows::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTableRows");
+}
+
+BOOL SwXTableRows::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TableRows") == rServiceName;
+}
+
+Sequence< OUString > SwXTableRows::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TableRows");
+ return aRet;
+}
+TYPEINIT1(SwXTableRows, SwClient);
+
+SwXTableRows::SwXTableRows(SwFrmFmt& rFrmFmt) :
+ SwClient(&rFrmFmt)
+{
+}
+
+SwXTableRows::~SwXTableRows()
+{
+}
+
+sal_Int32 SwXTableRows::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nRet = 0;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ nRet = pTable->GetTabLines().Count();
+ }
+ return nRet;
+}
+
+uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Any aRet;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt || nIndex < 0 )
+ throw IndexOutOfBoundsException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(pTable->GetTabLines().Count() > nIndex)
+ {
+ SwTableLine* pLine = pTable->GetTabLines().GetObject((sal_uInt16)nIndex);
+ SwClientIter aIter( *pFrmFmt );
+ SwXTextTableRow* pXRow = (SwXTextTableRow*)aIter.
+ First( TYPE( SwXTextTableRow ));
+ while( pXRow )
+ {
+ // gibt es eine passende Zelle bereits?
+ if(pXRow->GetTblRow() == pLine)
+ break;
+ pXRow = (SwXTextTableRow*)aIter.Next();
+ }
+ //sonst anlegen
+ if(!pXRow)
+ pXRow = new SwXTextTableRow(pFrmFmt, pLine);
+ uno::Reference< beans::XPropertySet > xRet =
+ (beans::XPropertySet*)pXRow;
+ aRet.setValue(&xRet, ::getCppuType((const uno::Reference<beans::XPropertySet>*)0));
+ }
+ else
+ throw IndexOutOfBoundsException();
+ }
+ return aRet;
+}
+
+uno::Type SAL_CALL SwXTableRows::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<beans::XPropertySet>*)0);
+}
+
+sal_Bool SwXTableRows::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ //es gibt keine Tabelle ohne Zeilen
+ return sal_True;
+}
+
+void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt || nIndex < 0 || nCount <= 0)
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sTLName = lcl_GetCellName(0, (sal_Int16)nIndex);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ sal_Bool bAppend = sal_False;
+ if(!pTLBox)
+ {
+ bAppend = sal_True;
+ // am Ende anfuegen, dazu muss der Cursor in die letzte Zeile!
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(rLines.Count() -1);
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ pTLBox = rBoxes.GetObject(0);
+ }
+ if(pTLBox)
+ {
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+
+ {
+ // remove actions
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+
+ pFrmFmt->GetDoc()->InsertRow(*pUnoCrsr, (sal_uInt16)nCount, bAppend);
+ delete pUnoCrsr;
+ }
+ }
+ }
+}
+
+void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt || nIndex < 0 || nCount <=0 )
+ throw uno::RuntimeException();
+ else
+ {
+ BOOL bSuccess = FALSE;
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sTLName = lcl_GetCellName(0, (sal_Int16)nIndex);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ String sBLName = lcl_GetCellName(0, (sal_Int16)nIndex + nCount - 1);
+ const SwTableBox* pBLBox = pTable->GetTblBox( sBLName );
+ if(pBLBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pBLBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ pCrsr->MakeBoxSels();
+ { // Die Klammer ist wichtig
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ pFrmFmt->GetDoc()->DeleteRow(*pUnoCrsr);
+ delete pUnoCrsr;
+ bSuccess = TRUE;
+ }
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ }
+ }
+ }
+ if(!bSuccess)
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = C2U("Illegal arguments");
+ throw aExcept;
+ }
+ }
+}
+
+void SwXTableRows::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+/******************************************************************
+ * SwXTableColumns
+ ******************************************************************/
+OUString SwXTableColumns::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTableColumns");
+}
+
+BOOL SwXTableColumns::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.TableColumns") == rServiceName;
+}
+
+Sequence< OUString > SwXTableColumns::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TableColumns");
+ return aRet;
+}
+TYPEINIT1(SwXTableColumns, SwClient);
+
+SwXTableColumns::SwXTableColumns(SwFrmFmt& rFrmFmt) :
+ SwClient(&rFrmFmt)
+{
+}
+
+SwXTableColumns::~SwXTableColumns()
+{
+}
+
+sal_Int32 SwXTableColumns::getCount(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ sal_Int32 nRet = 0;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ nRet = pLine->GetTabBoxes().Count();
+ }
+ }
+ return nRet;
+}
+
+uno::Any SwXTableColumns::getByIndex(sal_Int32 nIndex)
+ throw( IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< uno::XInterface > xRet;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ else
+ {
+ USHORT nCount = 0;
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ nCount = pLine->GetTabBoxes().Count();
+ }
+ if(nCount <= nIndex || nIndex < 0)
+ throw IndexOutOfBoundsException();
+ xRet = *new cppu::OWeakObject();
+ }
+ return uno::Any(&xRet, ::getCppuType((const uno::Reference<uno::XInterface>*)0));
+}
+
+uno::Type SAL_CALL SwXTableColumns::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Reference<uno::XInterface>*)0);
+}
+
+sal_Bool SwXTableColumns::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt)
+ throw uno::RuntimeException();
+ return sal_True;
+}
+
+void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt|| nIndex < 0 || nCount <=0 )
+ throw uno::RuntimeException();
+ else
+ {
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sTLName = lcl_GetCellName((sal_Int16)nIndex, 0);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ sal_Bool bAppend = sal_False;
+ if(!pTLBox)
+ {
+ bAppend = sal_True;
+ // am Ende anfuegen, dazu muss der Cursor in die letzte Spalte!
+ SwTableLines& rLines = pTable->GetTabLines();
+ SwTableLine* pLine = rLines.GetObject(0);
+ SwTableBoxes& rBoxes = pLine->GetTabBoxes();
+ pTLBox = rBoxes.GetObject(rBoxes.Count() - 1);
+ }
+ if(pTLBox)
+ {
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+
+ {
+ // remove actions
+ UnoActionRemoveContext aRemoveContext(pUnoCrsr->GetDoc());
+ }
+
+ pFrmFmt->GetDoc()->InsertCol(*pUnoCrsr, (sal_uInt16)nCount, bAppend);
+ delete pUnoCrsr;
+ }
+ }
+ }
+}
+
+void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ SwFrmFmt* pFrmFmt = GetFrmFmt();
+ if(!pFrmFmt|| nIndex < 0 || nCount <=0 )
+ throw uno::RuntimeException();
+ else
+ {
+ BOOL bSuccess = FALSE;
+ SwTable* pTable = SwTable::FindTable( pFrmFmt );
+ if(!pTable->IsTblComplex())
+ {
+ String sTLName = lcl_GetCellName((sal_Int16)nIndex, 0);
+ const SwTableBox* pTLBox = pTable->GetTblBox( sTLName );
+ if(pTLBox)
+ {
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ const SwStartNode* pSttNd = pTLBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ // Cursor in die obere linke Zelle des Ranges setzen
+ SwUnoCrsr* pUnoCrsr = pFrmFmt->GetDoc()->CreateUnoCrsr(aPos, sal_True);
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ pUnoCrsr->SetRemainInSection( sal_False );
+ String sTRName = lcl_GetCellName((sal_Int16)nIndex + nCount - 1, 0);
+ const SwTableBox* pTRBox = pTable->GetTblBox( sTRName );
+ if(pTRBox)
+ {
+ pUnoCrsr->SetMark();
+ pUnoCrsr->GetPoint()->nNode = *pTRBox->GetSttNd();
+ pUnoCrsr->Move( fnMoveForward, fnGoNode );
+ SwUnoTableCrsr* pCrsr = *pUnoCrsr;
+ pCrsr->MakeBoxSels();
+ { // Die Klammer ist wichtig
+ UnoActionContext aAction(pFrmFmt->GetDoc());
+ pFrmFmt->GetDoc()->DeleteCol(*pUnoCrsr);
+ delete pUnoCrsr;
+ bSuccess = TRUE;
+ }
+ {
+ // hier muessen die Actions aufgehoben werden
+ UnoActionRemoveContext aRemoveContext(pFrmFmt->GetDoc());
+ }
+ }
+ }
+ }
+ if(!bSuccess)
+ {
+ uno::RuntimeException aExcept;
+ aExcept.Message = C2U("Illegal arguments");
+ throw aExcept;
+ }
+ }
+}
+
+void SwXTableColumns::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify(this, pOld, pNew);
+}
+
+void SwChartEventListenerContainer::ChartDataChanged()
+{
+ if(pListenerArr)
+ {
+ //TODO: find appropriate settings of the Event
+ lang::EventObject aObj(pxParent);
+ chart::ChartDataChangeEvent aEvent;
+ aEvent.Type = chart::ChartDataChangeType_ALL;
+ aEvent.StartColumn = 0;
+ aEvent.EndColumn = 1;
+ aEvent.StartRow = 0;
+ aEvent.EndRow = 1;
+
+ for(sal_uInt16 i = 0; i < pListenerArr->Count(); i++)
+ {
+ XEventListenerPtr pElem = pListenerArr->GetObject(i);
+ try
+ {
+ XEventListenerPtr pElem = pListenerArr->GetObject(i);
+ Reference<XEventListener> xEventListener = *pElem;
+ Reference<XChartDataChangeEventListener> XChartEventListener = (XChartDataChangeEventListener*)(*pElem).get();
+ XChartEventListener->chartDataChanged( aEvent );
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/unocore/sw_unotext.cxx b/binfilter/bf_sw/source/core/unocore/sw_unotext.cxx
new file mode 100644
index 000000000000..2fd0c6053409
--- /dev/null
+++ b/binfilter/bf_sw/source/core/unocore/sw_unotext.cxx
@@ -0,0 +1,1768 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+
+#include <cmdid.h>
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <rtl/uuid.h>
+
+#include <errhdl.hxx>
+
+#include <unoobj.hxx>
+#include <unoport.hxx>
+#include <unotbl.hxx>
+#include <unoidx.hxx>
+#include <unoframe.hxx>
+#include <unofield.hxx>
+#include <unodraw.hxx>
+#include <unoredline.hxx>
+#include <unomap.hxx>
+#include <docsh.hxx>
+#include <docary.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <redline.hxx>
+#include <section.hxx>
+#include <unocrsr.hxx>
+#include <bookmrk.hxx>
+#include <fmthbsh.hxx>
+#include <crsskip.hxx>
+#include <bf_sfx2/sfxuno.hxx>
+namespace binfilter {
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+using rtl::OUString;
+
+const sal_Char cInvalidObject[] = "this object is invalid";
+/******************************************************************
+ * SwXText
+ ******************************************************************/
+/*-- 09.12.98 12:44:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+const SwStartNode *SwXText::GetStartNode() const
+{
+ return GetDoc()->GetNodes().GetEndOfContent().StartOfSectionNode();
+}
+
+uno::Reference< XTextCursor > SwXText::createCursor() throw ( ::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference< XTextCursor > xRet;
+ OUString sRet;
+ if(IsValid())
+ {
+ SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
+ SwPosition aPos(rNode);
+ xRet = (XWordCursor*)new SwXTextCursor(this, aPos, GetTextType(), GetDoc());
+ xRet->gotoStart(sal_False);
+ }
+ return xRet;
+}
+/* -----------------------------15.03.2002 12:39------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXText::SwXText(SwDoc* pDc, CursorType eType) :
+ pDoc(pDc),
+ bObjectValid(0 != pDc),
+ eCrsrType(eType),
+ _pMap(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT))
+{
+}
+/*-- 09.12.98 12:43:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXText::~SwXText()
+{
+}
+/*-- 09.12.98 12:43:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXText::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
+{
+ const uno::Type& rXTextType = ::getCppuType((uno::Reference< XText >*)0);
+ const uno::Type& rXTextRangeCompareType = ::getCppuType((uno::Reference< XTextRangeCompare >*)0);
+ const uno::Type& rXSimpleTextType = ::getCppuType((const uno::Reference< XSimpleText >*)0);
+ const uno::Type& rXTextRangeType = ::getCppuType((uno::Reference< XTextRange >*)0);
+ const uno::Type& rXTypeProviderType = ::getCppuType((uno::Reference< lang::XTypeProvider >*)0);
+ const uno::Type& rXTextContentInsert = ::getCppuType((uno::Reference< XRelativeTextContentInsert >*)0);
+ const uno::Type& rXTextContentRemove = ::getCppuType((uno::Reference< XRelativeTextContentRemove >*)0);
+ const uno::Type& rXPropertySet = ::getCppuType((uno::Reference<XPropertySet>*)0);
+ const uno::Type& rXUnoTunnel = ::getCppuType((uno::Reference< XUnoTunnel >*)0);
+
+ uno::Any aRet;
+ if(rType == rXTextType)
+ {
+ uno::Reference< XText > xRet = this;
+ aRet.setValue(&xRet, rXTextType);
+ }
+ else if(rType == rXSimpleTextType)
+ {
+ uno::Reference< XSimpleText > xRet = this;
+ aRet.setValue(&xRet, rXSimpleTextType);
+ }
+ else if(rType == rXTextRangeType)
+ {
+ uno::Reference< XTextRange > xRet = this;
+ aRet.setValue(&xRet, rXTextRangeType);
+ }
+ else if(rType == rXTextRangeCompareType)
+ {
+ uno::Reference< XTextRangeCompare > xRet = this;
+ aRet.setValue(&xRet, rXTextRangeCompareType);
+ }
+ else if(rType == rXTypeProviderType)
+ {
+ uno::Reference< lang::XTypeProvider > xRet = this;
+ aRet.setValue(&xRet, rXTypeProviderType);
+ }
+ else if(rType == rXTextContentInsert)
+ {
+ uno::Reference< XRelativeTextContentInsert > xRet = this;
+ aRet.setValue(&xRet, rXTextContentInsert);
+ }
+ else if(rType == rXTextContentRemove)
+ {
+ uno::Reference< XRelativeTextContentRemove > xRet = this;
+ aRet.setValue(&xRet, rXTextContentRemove);
+ }
+ else if(rType == rXPropertySet)
+ {
+ uno::Reference< XPropertySet > xRet = this;
+ aRet.setValue(&xRet, rXPropertySet);
+ }
+ else if(rType == rXUnoTunnel )
+ {
+ uno::Reference< XUnoTunnel > xRet = this;
+ aRet.setValue(&xRet, rXUnoTunnel);
+ }
+ return aRet;
+}
+/* -----------------------------15.03.00 17:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SAL_CALL SwXText::getTypes() throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aRet(6);
+ uno::Type* pTypes = aRet.getArray();
+ pTypes[0] = ::getCppuType((uno::Reference< XText >*)0);
+ pTypes[1] = ::getCppuType((uno::Reference< XTextRangeCompare >*)0);
+ pTypes[2] = ::getCppuType((uno::Reference< XRelativeTextContentInsert >*)0);
+ pTypes[3] = ::getCppuType((uno::Reference< XRelativeTextContentRemove >*)0);
+ pTypes[4] = ::getCppuType((uno::Reference< XUnoTunnel >*)0);
+ pTypes[5] = ::getCppuType((uno::Reference< XPropertySet >*)0);
+
+ return aRet;
+}
+
+/*-- 09.12.98 12:43:14---------------------------------------------------
+ Gehoert der Range in den Text ? - dann einfuegen
+ -----------------------------------------------------------------------*/
+void SwXText::insertString(const uno::Reference< XTextRange > & xTextRange,
+ const OUString& aString, sal_Bool bAbsorb)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(GetDoc() && xTextRange.is())
+ {
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ if(pRange && pRange->GetDoc() == GetDoc() ||
+ pCursor && pCursor->GetDoc() == GetDoc())
+ {
+ const SwStartNode* pOwnStartNode = GetStartNode();
+ if(pCursor)
+ {
+ const SwStartNode* pTmp = pCursor->GetPaM()->GetNode()->FindStartNode();
+ while(pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->FindStartNode();
+ }
+ if( !pOwnStartNode || pOwnStartNode != pTmp)
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ else //dann pRange
+ {
+ SwBookmark* pBkm = pRange->GetBookmark();
+ const SwStartNode* pTmp = pBkm->GetPos().nNode.GetNode().FindStartNode();
+ while( pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->FindStartNode();
+ }
+ if( !pOwnStartNode || pOwnStartNode != pTmp)
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ if(bAbsorb)
+ {
+ xTextRange->setString(aString);
+ }
+ else
+ {
+ //hier wird ein PaM angelegt, der vor dem Parameter-PaM liegt, damit der
+ //Text davor eingefuegt wird
+ UnoActionContext aContext(GetDoc());
+ const SwPosition* pPos = pCursor ? pCursor->GetPaM()->Start() : &pRange->GetBookmark()->GetPos();
+ SwPaM aInsertPam(*pPos);
+ if(!GetDoc()->Insert(aInsertPam, aString ))
+ DBG_ERROR("Text wurde nicht eingefuegt");
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException();
+ }
+}
+/*-- 09.12.98 12:43:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::insertControlCharacter(const uno::Reference< XTextRange > & xTextRange,
+ sal_Int16 nControlCharacter, sal_Bool bAbsorb)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(GetDoc() && xTextRange.is())
+ {
+ SwUnoInternalPaM aPam(*GetDoc());
+ if(SwXTextRange::XTextRangeToSwPaM(aPam, xTextRange))
+ {
+ //Steuerzeichen einfuegen
+ SwPaM aTmp(*aPam.Start());
+ if(bAbsorb && aPam.HasMark())
+ pDoc->DeleteAndJoin(aPam);
+
+ sal_Unicode cIns = 0;
+ switch( nControlCharacter )
+ {
+ case ControlCharacter::PARAGRAPH_BREAK :
+ // eine Tabellen Zelle wird jetzt zu einer normalen Textzelle!
+ pDoc->ClearBoxNumAttrs( aTmp.GetPoint()->nNode );
+ pDoc->SplitNode( *aTmp.GetPoint(), sal_False );
+ break;
+ case ControlCharacter::APPEND_PARAGRAPH:
+ {
+ pDoc->ClearBoxNumAttrs( aTmp.GetPoint()->nNode );
+ pDoc->AppendTxtNode( *aTmp.GetPoint() );
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+ if(pRange)
+ {
+ pRange->_CreateNewBookmark(aTmp);
+ }
+ else if(pCursor)
+ {
+ SwPaM* pCrsr = pCursor->GetPaM();
+ *pCrsr->GetPoint() = *aTmp.GetPoint();
+ pCrsr->DeleteMark();
+ }
+ }
+ break;
+ case ControlCharacter::LINE_BREAK: cIns = 10; break;
+ case ControlCharacter::SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
+ case ControlCharacter::HARD_HYPHEN: cIns = CHAR_HARDHYPHEN; break;
+ case ControlCharacter::HARD_SPACE: cIns = CHAR_HARDBLANK; break;
+ }
+ if( cIns )
+ pDoc->Insert( aTmp, cIns );
+
+ if(bAbsorb)
+ {
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ SwCursor aCrsr(*aTmp.GetPoint());
+ SwXTextCursor::SelectPam(aCrsr, sal_True);
+ aCrsr.Left(1, CRSR_SKIP_CHARS);
+ //hier muss der uebergebene PaM umgesetzt werden:
+ if(pRange)
+ pRange->_CreateNewBookmark(aCrsr);
+ else
+ {
+ SwPaM* pUnoCrsr = pCursor->GetPaM();
+ *pUnoCrsr->GetPoint() = *aCrsr.GetPoint();
+ if(aCrsr.HasMark())
+ {
+ pUnoCrsr->SetMark();
+ *pUnoCrsr->GetMark() = *aCrsr.GetMark();
+ }
+ else
+ pUnoCrsr->DeleteMark();
+ }
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 09.12.98 12:43:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+void SwXText::insertTextContent(const uno::Reference< XTextRange > & xRange,
+ const uno::Reference< XTextContent > & xContent, sal_Bool bAbsorb)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ // erstmal testen, ob der Range an der richtigen Stelle ist und dann
+ // am Sw-Content attachToRange aufrufen
+ if(!GetDoc())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ if(xRange.is() && xContent.is())
+ {
+ SwUnoInternalPaM aPam(*GetDoc());
+ if(SwXTextRange::XTextRangeToSwPaM(aPam, xRange))
+ {
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ SwXTextPortion* pPortion = 0;
+ SwXText* pText = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = (SwXTextRange*)xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor = (OTextCursorHelper*)xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ pPortion = (SwXTextPortion*)xRangeTunnel->getSomething(
+ SwXTextPortion::getUnoTunnelId());
+ pText = (SwXText*)xRangeTunnel->getSomething(
+ SwXText::getUnoTunnelId());
+ }
+
+
+ uno::Reference< XTextCursor > xOwnCursor = createCursor();
+ uno::Reference<lang::XUnoTunnel> xOwnTunnel( xOwnCursor, uno::UNO_QUERY);
+ OTextCursorHelper* pOwnCursor = (OTextCursorHelper*)xOwnTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+
+ const SwStartNode* pOwnStartNode = GetStartNode();
+ SwStartNodeType eSearchNodeType = SwNormalStartNode;
+ switch(eCrsrType)
+ {
+ case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
+ case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
+ case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
+ case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
+ case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ //case CURSOR_INVALID:
+ //case CURSOR_BODY:
+ }
+
+ const SwNode* pSrcNode = 0;
+ if(pCursor && pCursor->GetPaM())
+ {
+ pSrcNode = pCursor->GetPaM()->GetNode();
+ }
+ else if (pRange && pRange->GetBookmark())
+ {
+ SwBookmark* pBkm = pRange->GetBookmark();
+ pSrcNode = &pBkm->GetPos().nNode.GetNode();
+ }
+ else if (pPortion && pPortion->GetCrsr())
+ {
+ pSrcNode = pPortion->GetCrsr()->GetNode();
+ }
+ else if (pText)
+ {
+ Reference<XTextCursor> xTextCursor = pText->createCursor();
+ xTextCursor->gotoEnd(sal_True);
+ Reference<XUnoTunnel> xCrsrTunnel( xTextCursor, UNO_QUERY );
+ pCursor = (OTextCursorHelper*)xCrsrTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId() );
+ pSrcNode = pCursor->GetPaM()->GetNode();
+ }
+ else
+ throw lang::IllegalArgumentException();
+
+ const SwStartNode* pTmp = pSrcNode->FindSttNodeByType(eSearchNodeType);
+
+ //SectionNodes ueberspringen
+ while(pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->FindStartNode();
+ }
+ //if the document starts with a section
+ while(pOwnStartNode->IsSectionNode())
+ {
+ pOwnStartNode = pOwnStartNode->FindStartNode();
+ }
+ //this checks if (this) and xRange are in the same XText interface
+ if(pOwnStartNode != pTmp)
+ {
+ RuntimeException aRunException;
+ aRunException.Message = C2U("text interface and cursor not related");
+ throw aRunException;
+ }
+ // Sonderbehandlung fuer Contents, die den Range nicht ersetzen, sonder darueber gelegt werden
+ // Bookmarks, IndexEntry
+ sal_Bool bAttribute = sal_False;
+ uno::Reference<lang::XUnoTunnel> xContentTunnel( xContent, uno::UNO_QUERY);
+ if(!xContentTunnel.is())
+ {
+ IllegalArgumentException aArgException;
+ aArgException.Message = C2U("text content doesn't support ::com::sun::star::lang::XUnoTunnel");
+ throw aArgException;
+ }
+ SwXDocumentIndexMark* pDocumentIndexMark =
+ (SwXDocumentIndexMark*)xContentTunnel->getSomething(
+ SwXDocumentIndexMark::getUnoTunnelId());
+
+
+ SwXTextSection* pSection = (SwXTextSection*)xContentTunnel->getSomething(
+ SwXTextSection::getUnoTunnelId());
+
+ SwXBookmark* pBookmark = (SwXBookmark*)xContentTunnel->getSomething(
+ SwXBookmark::getUnoTunnelId());
+
+
+ SwXReferenceMark* pReferenceMark = (SwXReferenceMark*)
+ xContentTunnel->getSomething(
+ SwXReferenceMark::getUnoTunnelId());
+
+ bAttribute = pBookmark || pDocumentIndexMark || pSection || pReferenceMark;
+
+ if(bAbsorb && !bAttribute)
+ {
+ xRange->setString(aEmptyStr);
+ }
+ //hier wird tatsaechlich eingefuegt
+ uno::Reference< XTextRange > xTempRange;
+ if(bAttribute && bAbsorb)
+ xTempRange = xRange;
+ else
+ xTempRange = xRange->getStart();
+ SwXTextTable* pTable = (SwXTextTable*)
+ xContentTunnel->getSomething(
+ SwXTextTable::getUnoTunnelId());
+
+ if(pTable)
+ pTable->attachToRange(xTempRange);
+ else
+ {
+ if(pBookmark)
+ pBookmark ->attachToRange(xTempRange);
+ else
+ {
+ if(pSection)
+ pSection ->attachToRange(xTempRange);
+ else
+ {
+ SwXFootnote* pFootnote = (SwXFootnote*)
+ xContentTunnel->getSomething(
+ SwXFootnote::getUnoTunnelId());
+
+ if(pFootnote)
+ pFootnote->attachToRange(xTempRange);
+ else
+ {
+ if(pReferenceMark)
+ pReferenceMark->attachToRange(xTempRange);
+ else
+ {
+ SwXFrame* pFrame = (SwXFrame*)
+ xContentTunnel->getSomething(
+ SwXFrame::getUnoTunnelId());
+
+ if(pFrame)
+ pFrame->attachToRange(xTempRange);
+ else
+ {
+ SwXDocumentIndex* pDocumentIndex = (SwXDocumentIndex*)
+ xContentTunnel->getSomething(
+ SwXDocumentIndex::getUnoTunnelId());
+
+ if(pDocumentIndex)
+ pDocumentIndex->attachToRange(xTempRange);
+ else
+ {
+ if(pDocumentIndexMark)
+ pDocumentIndexMark->attachToRange(xTempRange);
+ else
+ {
+ SwXTextField* pTextField = (SwXTextField*)
+ xContentTunnel->getSomething(
+ SwXTextField::getUnoTunnelId());
+
+ if(pTextField)
+ pTextField->attachToRange(xTempRange);
+ else
+ {
+ uno::Reference<beans::XPropertySet> xShapeProperties(xContent, uno::UNO_QUERY);
+ SwXShape* pShape = 0;
+ if(xShapeProperties.is())
+ pShape = (SwXShape*)xContentTunnel->getSomething(
+ SwXShape::getUnoTunnelId());
+ if(pShape)
+ {
+ uno::Any aPos(&xRange,
+ ::getCppuType((uno::Reference<XTextRange>*)0));
+ pShape->setPropertyValue(C2U("TextRange"), aPos);
+
+ uno::Reference<frame::XModel> xModel =
+ pDoc->GetDocShell()->GetBaseModel();
+ uno::Reference<drawing::XDrawPageSupplier> xPageSupp(
+ xModel, uno::UNO_QUERY);
+
+ uno::Reference<drawing::XDrawPage> xPage = xPageSupp->getDrawPage();
+
+ uno::Reference<drawing::XShape> xShape((cppu::OWeakObject*)pShape,
+ uno::UNO_QUERY);
+ //nuer die XShapes haengen an der Sw-Drawpage
+ uno::Reference<drawing::XShapes> xShps(xPage, uno::UNO_QUERY);
+ xShps->add(xShape);
+ }
+ else
+ {
+ IllegalArgumentException aArgException;
+ aArgException.Message = C2U("unknown text content");
+ throw aArgException;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ IllegalArgumentException aIllegal;
+ aIllegal.Message = C2U("first parameter invalid");
+ throw aIllegal;
+ }
+ }
+ else
+ {
+ IllegalArgumentException aIllegal;
+ if(!xRange.is())
+ aIllegal.Message = C2U("first parameter invalid;");
+ if(!xContent.is())
+ aIllegal.Message += C2U("second parameter invalid");
+ throw aIllegal;
+ }
+
+}
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXText::insertTextContentBefore(
+ const Reference< XTextContent>& xNewContent,
+ const Reference< XTextContent>& xSuccessor)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ SwXParagraph* pPara = SwXParagraph::GetImplementation(xNewContent);
+ if(!pPara || !pPara->IsDescriptor() || !xSuccessor.is())
+ throw IllegalArgumentException();
+
+ sal_Bool bRet = FALSE;
+ SwXTextSection* pXSection = SwXTextSection::GetImplementation( xSuccessor );
+ SwXTextTable* pXTable = SwXTextTable::GetImplementation(xSuccessor );
+ SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
+ SwUnoCrsr* pUnoCrsr = 0;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable* pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+
+ SwNodeIndex aTblIdx( *pTblNode, -1 );
+ SwPosition aBefore(aTblIdx);
+ bRet = GetDoc()->AppendTxtNode( aBefore );
+ pUnoCrsr = GetDoc()->CreateUnoCrsr( aBefore, FALSE);
+ }
+ else if(pXSection &&
+ pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt* pSectFmt = pXSection->GetFmt();
+ SwSectionNode* pSectNode = pSectFmt->GetSectionNode();
+
+ SwNodeIndex aSectIdx( *pSectNode, -1 );
+ SwPosition aBefore(aSectIdx);
+ bRet = GetDoc()->AppendTxtNode( aBefore );
+ pUnoCrsr = GetDoc()->CreateUnoCrsr( aBefore, FALSE);
+ }
+ if(!bRet)
+ throw IllegalArgumentException();
+ else
+ {
+ pPara->attachToText(this, pUnoCrsr);
+ }
+
+}
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXText::insertTextContentAfter(
+ const Reference< XTextContent>& xNewContent,
+ const Reference< XTextContent>& xPredecessor)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ throw RuntimeException();
+ SwXParagraph* pPara = SwXParagraph::GetImplementation(xNewContent);
+ if(!pPara || !pPara->IsDescriptor() || !xPredecessor.is())
+ throw IllegalArgumentException();
+
+ SwUnoCrsr* pUnoCrsr = 0;
+ SwXTextSection* pXSection = SwXTextSection::GetImplementation( xPredecessor );
+ SwXTextTable* pXTable = SwXTextTable::GetImplementation(xPredecessor );
+ SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
+ sal_Bool bRet = FALSE;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable* pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+
+ SwEndNode* pTableEnd = pTblNode->EndOfSectionNode();
+ SwPosition aTableEnd(*pTableEnd);
+ bRet = GetDoc()->AppendTxtNode( aTableEnd );
+ pUnoCrsr = GetDoc()->CreateUnoCrsr( aTableEnd, FALSE);
+ }
+ else if(pXSection &&
+ pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt* pSectFmt = pXSection->GetFmt();
+ SwSectionNode* pSectNode = pSectFmt->GetSectionNode();
+ SwEndNode* pEnd = pSectNode->EndOfSectionNode();
+ SwPosition aEnd(*pEnd);
+ bRet = GetDoc()->AppendTxtNode( aEnd );
+ pUnoCrsr = GetDoc()->CreateUnoCrsr( aEnd, FALSE);
+ }
+ if(!bRet)
+ throw IllegalArgumentException();
+ else
+ {
+ pPara->attachToText(this, pUnoCrsr);
+ }
+}
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXText::removeTextContentBefore(
+ const Reference< XTextContent>& xSuccessor)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ sal_Bool bRet = FALSE;
+ SwXTextSection* pXSection = SwXTextSection::GetImplementation( xSuccessor );
+ SwXTextTable* pXTable = SwXTextTable::GetImplementation( xSuccessor );
+ SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable* pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+
+ SwNodeIndex aTblIdx( *pTblNode, -1 );
+ if(aTblIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aBefore(aTblIdx);
+ bRet = GetDoc()->DelFullPara( aBefore );
+ }
+ }
+ else if(pXSection &&
+ pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt* pSectFmt = pXSection->GetFmt();
+ SwSectionNode* pSectNode = pSectFmt->GetSectionNode();
+
+ SwNodeIndex aSectIdx( *pSectNode, -1 );
+ if(aSectIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aBefore(aSectIdx);
+ bRet = GetDoc()->DelFullPara( aBefore );
+ }
+ }
+ if(!bRet)
+ throw IllegalArgumentException();
+}
+/* -----------------------------10.07.00 15:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXText::removeTextContentAfter(const Reference< XTextContent>& xPredecessor)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!GetDoc())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ sal_Bool bRet = FALSE;
+ SwXTextSection* pXSection = SwXTextSection::GetImplementation( xPredecessor );
+ SwXTextTable* pXTable = SwXTextTable::GetImplementation(xPredecessor );
+ SwFrmFmt* pTableFmt = pXTable ? pXTable->GetFrmFmt() : 0;
+ if(pTableFmt && pTableFmt->GetDoc() == GetDoc())
+ {
+ SwTable* pTable = SwTable::FindTable( pTableFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode();
+ SwEndNode* pTableEnd = pTblNode->EndOfSectionNode();
+
+ SwNodeIndex aTblIdx( *pTableEnd, 1 );
+ if(aTblIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aPaM(aTblIdx);
+ bRet = GetDoc()->DelFullPara( aPaM );
+ }
+ }
+ else if(pXSection &&
+ pXSection->GetFmt() &&
+ pXSection->GetFmt()->GetDoc() == GetDoc())
+ {
+ SwSectionFmt* pSectFmt = pXSection->GetFmt();
+ SwSectionNode* pSectNode = pSectFmt->GetSectionNode();
+ SwEndNode* pEnd = pSectNode->EndOfSectionNode();
+ SwNodeIndex aSectIdx( *pEnd, 1 );
+ if(aSectIdx.GetNode().IsTxtNode())
+ {
+ SwPaM aAfter(aSectIdx);
+ bRet = GetDoc()->DelFullPara( aAfter );
+ }
+ }
+ if(!bRet)
+ throw IllegalArgumentException();
+}
+/*-- 09.12.98 12:43:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::removeTextContent(const uno::Reference< XTextContent > & xContent)
+ throw( container::NoSuchElementException, uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(!xContent.is())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U("first parameter invalid");
+ throw aRuntime;
+ }
+ else
+ xContent->dispose();
+}
+/*-- 09.12.98 12:43:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XText > SwXText::getText(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XText > xRet = (SwXText*)this;
+ return xRet;
+
+}
+/*-- 09.12.98 12:43:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXText::getStart(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > xRef = createCursor();
+ if(!xRef.is())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ xRef->gotoStart(sal_False);
+ uno::Reference< XTextRange > xRet(xRef, uno::UNO_QUERY);
+ return xRet;
+}
+/*-- 09.12.98 12:43:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextRange > SwXText::getEnd(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > xRef = createCursor();
+ if(!xRef.is())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ else
+ xRef->gotoEnd(sal_False);
+ uno::Reference< XTextRange > xRet(xRef, uno::UNO_QUERY);;
+
+ return xRet;
+}
+/*-- 09.12.98 12:43:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXText::getString(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > xRet = createCursor();
+ if(!xRet.is())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ else
+ {
+ xRet->gotoEnd(sal_True);
+ }
+ return xRet->getString();
+}
+/*-- 09.12.98 12:43:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ const SwStartNode* pStartNode = GetStartNode();
+ if(!pStartNode)
+ throw uno::RuntimeException();
+
+ //insert an empty paragraph at the start and at the end to ensure that
+ //all tables and sections can be removed by the selecting XTextCursor
+ {
+ SwPosition aStartPos(*pStartNode);
+ const SwEndNode* pEnd = pStartNode->EndOfSectionNode();
+ SwNodeIndex aEndIdx(*pEnd);
+ aEndIdx--;
+ //the inserting of nodes should only be done if really necessary
+ //to prevent #97924# (removes paragraph attributes when setting the text
+ //e.g. of a table cell
+ BOOL bInsertNodes = FALSE;
+ SwNodeIndex aStartIdx(*pStartNode);
+ do
+ {
+ aStartIdx++;
+ SwNode& rCurrentNode = aStartIdx.GetNode();
+ if(rCurrentNode.GetNodeType() == ND_SECTIONNODE
+ ||rCurrentNode.GetNodeType() == ND_TABLENODE)
+ {
+ bInsertNodes = TRUE;
+ break;
+ }
+ }
+ while(aStartIdx < aEndIdx);
+ if(bInsertNodes)
+ {
+ GetDoc()->AppendTxtNode( aStartPos );
+ SwPosition aEndPos(aEndIdx.GetNode());
+ SwPaM aPam(aEndPos);
+ GetDoc()->AppendTxtNode( *aPam.Start() );
+ }
+ }
+
+ uno::Reference< XTextCursor > xRet = createCursor();
+ if(!xRet.is())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ else
+ {
+ xRet->gotoEnd(sal_True);
+ }
+ xRet->setString(aString);
+}
+/* -----------------------------28.03.00 11:12--------------------------------
+ Description: Checks if pRange/pCursor are member of the same text interface.
+ Only one of the pointers has to be set!
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXText::CheckForOwnMember(
+ const SwXTextRange* pRange,
+ const OTextCursorHelper* pCursor)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ DBG_ASSERT((!pRange || !pCursor) && (pRange || pCursor), "only one pointer will be checked" );
+ Reference<XTextCursor> xOwnCursor = createCursor();
+
+ uno::Reference<lang::XUnoTunnel> xTunnel( xOwnCursor, uno::UNO_QUERY);
+ OTextCursorHelper* pOwnCursor = 0;
+ if(xTunnel.is())
+ {
+ pOwnCursor = (OTextCursorHelper*)xTunnel->getSomething(OTextCursorHelper::getUnoTunnelId());
+ }
+ DBG_ASSERT(pOwnCursor, "OTextCursorHelper::getUnoTunnelId() ??? ");
+ const SwStartNode* pOwnStartNode = pOwnCursor->GetPaM()->GetNode()->FindStartNode();
+ SwStartNodeType eSearchNodeType = SwNormalStartNode;
+ switch(eCrsrType)
+ {
+ case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
+ case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
+ case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
+ case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
+ case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ //case CURSOR_INVALID:
+ //case CURSOR_BODY:
+ }
+
+ const SwNode* pSrcNode;
+ if(pCursor)
+ {
+ pSrcNode = pCursor->GetPaM()->GetNode();
+ }
+ else //dann pRange
+ {
+ SwBookmark* pBkm = pRange->GetBookmark();
+ pSrcNode = &pBkm->GetPos().nNode.GetNode();
+ }
+ const SwStartNode* pTmp = pSrcNode->FindSttNodeByType(eSearchNodeType);
+
+ //SectionNodes ueberspringen
+ while(pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->FindStartNode();
+ }
+ //if the document starts with a section
+ while(pOwnStartNode->IsSectionNode())
+ {
+ pOwnStartNode = pOwnStartNode->FindStartNode();
+ }
+ //this checks if (this) and xRange are in the same XText interface
+ return(pOwnStartNode == pTmp);
+}
+
+/* -----------------------------28.03.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int16 SwXText::ComparePositions(
+ const Reference<XTextRange>& xPos1,
+ const Reference<XTextRange>& xPos2)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ sal_Int16 nCompare;
+ SwUnoInternalPaM aPam1(*GetDoc());
+ SwUnoInternalPaM aPam2(*GetDoc());
+
+ BOOL bExcept = FALSE;
+ if(SwXTextRange::XTextRangeToSwPaM(aPam1, xPos1) &&
+ SwXTextRange::XTextRangeToSwPaM(aPam2, xPos2))
+ {
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel1( xPos1, UNO_QUERY);
+ SwXTextRange* pRange1 = 0;
+ OTextCursorHelper* pCursor1 = 0;
+ if(xRangeTunnel1.is())
+ {
+ pRange1 = (SwXTextRange*)xRangeTunnel1->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor1 = (OTextCursorHelper*)xRangeTunnel1->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel2( xPos2, UNO_QUERY);
+ SwXTextRange* pRange2 = 0;
+ OTextCursorHelper* pCursor2 = 0;
+ if(xRangeTunnel2.is())
+ {
+ pRange2 = (SwXTextRange*)xRangeTunnel2->getSomething(
+ SwXTextRange::getUnoTunnelId());
+ pCursor2 = (OTextCursorHelper*)xRangeTunnel2->getSomething(
+ OTextCursorHelper::getUnoTunnelId());
+ }
+
+ if((pRange1||pCursor1) && (pRange2||pCursor2))
+ {
+ if(CheckForOwnMember(pRange1, pCursor1)
+ && CheckForOwnMember( pRange2, pCursor2))
+ {
+ const SwPosition *pStart1 = 0;
+ const SwPosition *pStart2 = 0;
+
+ if(pRange1)
+ pStart1 = pRange1->GetBookmark() ? &pRange1->GetBookmark()->GetPos() : 0;
+ else
+ pStart1 = pCursor1->GetPaM() ? pCursor1->GetPaM()->Start() : 0;
+
+ if(pRange2)
+ pStart2 = pRange2->GetBookmark() ? &pRange2->GetBookmark()->GetPos() : 0;
+ else
+ pStart2 = pCursor2->GetPaM() ? pCursor2->GetPaM()->Start() : 0;
+
+ if(pStart1 && pStart2)
+ {
+ if(*pStart1 < *pStart2)
+ nCompare = 1;
+ else if(*pStart1 > *pStart2)
+ nCompare = -1;
+ else
+ {
+ DBG_ASSERT(*pStart1 == *pStart2, "SwPositions should be equal here");
+ nCompare = 0;
+ }
+ }
+ else
+ bExcept = TRUE;
+ }
+ else
+ bExcept = TRUE;
+ }
+ else
+ bExcept = TRUE;
+ }
+ else
+ bExcept = TRUE;
+ if(bExcept)
+ throw IllegalArgumentException();
+
+ return nCompare;
+}
+
+/*-- 28.03.00 10:37:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SwXText::compareRegionStarts(
+ const Reference<XTextRange>& xR1,
+ const Reference<XTextRange>& xR2)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!xR1.is() || !xR2.is())
+ throw IllegalArgumentException();
+ Reference<XTextRange> xStart1 = xR1->getStart();
+ Reference<XTextRange> xStart2 = xR2->getStart();
+
+ return ComparePositions(xStart1, xStart2);
+}
+/*-- 28.03.00 10:37:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SwXText::compareRegionEnds(
+ const Reference<XTextRange>& xR1,
+ const Reference<XTextRange>& xR2)
+ throw(IllegalArgumentException, RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!xR1.is() || !xR2.is())
+ throw IllegalArgumentException();
+ Reference<XTextRange> xEnd1 = xR1->getEnd();
+ Reference<XTextRange> xEnd2 = xR2->getEnd();
+
+ return ComparePositions(xEnd1, xEnd2);
+}
+
+/*-- 15.03.2002 12:30:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXText::getPropertySetInfo( )
+ throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo =
+ new SfxItemPropertySetInfo(_pMap);
+ return xInfo;
+}
+/*-- 15.03.2002 12:30:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ throw lang::IllegalArgumentException();
+}
+/*-- 15.03.2002 12:30:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXText::getPropertyValue(
+ const ::rtl::OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if(!IsValid())
+ throw uno::RuntimeException();
+ const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName(
+ _pMap, rPropertyName);
+ uno::Any aRet;
+ if(pMap)
+ {
+ switch(pMap->nWID)
+ {
+// no code necessary - the redline is always located at the end node
+// case FN_UNO_REDLINE_NODE_START:
+// break;
+ case FN_UNO_REDLINE_NODE_END:
+ {
+ const SwRedlineTbl& rRedTbl = GetDoc()->GetRedlineTbl();
+ USHORT nRedTblCount = rRedTbl.Count();
+ if ( nRedTblCount > 0 )
+ {
+ const SwStartNode* pStartNode = GetStartNode();
+ ULONG nOwnIndex = pStartNode->EndOfSectionIndex();
+ for(USHORT nRed = 0; nRed < nRedTblCount; nRed++)
+ {
+ const SwRedline* pRedline = rRedTbl[nRed];
+ const SwPosition* pRedStart = pRedline->Start();
+ const SwNodeIndex nRedNode = pRedStart->nNode;
+ if(nOwnIndex == nRedNode.GetIndex())
+ {
+ aRet <<= SwXRedlinePortion::CreateRedlineProperties(*pRedline, TRUE);
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ UnknownPropertyException aExcept;
+ aExcept.Message = C2U("Unknown property: ");
+ aExcept.Message += rPropertyName;
+ throw aExcept;
+ }
+ return aRet;
+
+}
+/*-- 15.03.2002 12:30:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::addPropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const uno::Reference< beans::XPropertyChangeListener >& xListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ throw uno::RuntimeException();
+}
+/*-- 15.03.2002 12:30:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::removePropertyChangeListener(
+ const ::rtl::OUString& aPropertyName,
+ const uno::Reference< beans::XPropertyChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ throw uno::RuntimeException();
+}
+/*-- 15.03.2002 12:30:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::addVetoableChangeListener(
+ const ::rtl::OUString& PropertyName,
+ const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ throw uno::RuntimeException();
+}
+/*-- 15.03.2002 12:30:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXText::removeVetoableChangeListener(
+ const ::rtl::OUString& PropertyName,
+ const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ throw uno::RuntimeException();
+}
+
+/* -----------------------------08.01.01 09:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXText::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::binfilter::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------08.01.01 09:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SwXText::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return (sal_Int64)this;
+ }
+ return 0;
+}
+
+/******************************************************************
+ * SwXBodyText
+ ******************************************************************/
+SwXBodyText::SwXBodyText(SwDoc* pDoc) :
+ SwXText(pDoc, CURSOR_BODY)
+{
+}
+
+/*-- 10.12.98 11:17:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXBodyText::~SwXBodyText()
+{
+
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXBodyText::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXBodyText");
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXBodyText::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.Text") == rServiceName;
+}
+/* -----------------------------06.04.00 16:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXBodyText::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.Text");
+ return aRet;
+}
+/*-- 10.12.98 11:17:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXBodyText::queryAggregation(
+ const uno::Type& rType )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aRet;
+ const uno::Type& rXEnumerationAccessType = ::getCppuType((uno::Reference< container::XEnumerationAccess >*)0);
+ const uno::Type& rXElementAccessType = ::getCppuType((uno::Reference< container::XElementAccess >*)0);
+ const uno::Type& rXServiceInfoType = ::getCppuType((uno::Reference< lang::XServiceInfo >*)0);
+
+ if(rType == rXEnumerationAccessType)
+ {
+ Reference<container::XEnumerationAccess> xRet = this;
+ aRet.setValue(&xRet, rXEnumerationAccessType);
+ }
+ else if(rType == rXElementAccessType)
+ {
+ Reference<container::XElementAccess> xRet = this;
+ aRet.setValue(&xRet, rXElementAccessType);
+ }
+ else if(rType == rXServiceInfoType)
+ {
+ Reference<lang::XServiceInfo> xRet = this;
+ aRet.setValue(&xRet, rXServiceInfoType);
+ }
+ else
+ {
+ aRet = SwXText::queryInterface( rType );
+ }
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = OWeakAggObject::queryAggregation( rType );
+ return aRet;
+}
+
+/*-- 10.12.98 11:17:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Type > SwXBodyText::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aTypes = SwXBodyTextBaseClass::getTypes();
+ uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+ long nIndex = aTypes.getLength();
+ aTypes.realloc(aTypes.getLength() + aTextTypes.getLength());
+ uno::Type* pTypes = aTypes.getArray();
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ for(int i = 0; i < aTextTypes.getLength(); i++)
+ pTypes[nIndex++] = pTextTypes[i];
+ return aTypes;
+}
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SwXBodyText::getImplementationId( ) throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/*-- 10.12.98 11:17:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SAL_CALL
+ SwXBodyText::queryInterface( const uno::Type& rType )
+ throw(uno::RuntimeException)
+{
+ uno::Any aRet = SwXText::queryInterface( rType );
+ if(aRet.getValueType() == ::getCppuVoidType())
+ aRet = SwXBodyTextBaseClass::queryInterface( rType );
+ return aRet;
+}
+/* -----------------------------05.01.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< XTextCursor > SwXBodyText::CreateTextCursor(sal_Bool bIgnoreTables)
+{
+ uno::Reference< XTextCursor > xRet;
+ if(IsValid())
+ {
+ SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
+ //erstmal sicherstellen, dass wir nicht in einer Tabelle stehen
+ SwPaM aPam(rNode);
+ aPam.Move( fnMoveBackward, fnGoDoc );
+ if(!bIgnoreTables)
+ {
+ SwTableNode* pTblNode = aPam.GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while( pTblNode )
+ {
+ aPam.GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&aPam.GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if(pCont)
+ aPam.GetPoint()->nContent.Assign(pCont, 0);
+ }
+ xRet = (XWordCursor*)new SwXTextCursor(this, *aPam.GetPoint(), CURSOR_BODY, GetDoc());
+ }
+ return xRet;
+}
+/*-- 10.12.98 11:17:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextCursor > SwXBodyText::createTextCursor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > aRef = CreateTextCursor(sal_False);
+ if(!aRef.is())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ return aRef;
+}
+/*-- 10.12.98 11:17:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextCursor > SwXBodyText::createTextCursorByRange(
+ const uno::Reference< XTextRange > & aTextPosition) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > aRef;
+ if(!IsValid())
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ SwUnoInternalPaM aPam(*GetDoc());
+ if(SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ {
+ SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
+
+ SwStartNode* p1 = aPam.GetNode()->FindStartNode();
+ //document starts with a section?
+ while(p1->IsSectionNode())
+ {
+ p1 = p1->FindStartNode();
+ }
+ SwStartNode* p2 = rNode.FindStartNode();
+
+ if(p1 == p2)
+ aRef = (XWordCursor*)new SwXTextCursor(this , *aPam.GetPoint(), CURSOR_BODY, GetDoc(), aPam.GetMark());
+ }
+ if(!aRef.is())
+ throw uno::RuntimeException();
+ return aRef;
+}
+/*-- 10.12.98 11:17:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXBodyText::createEnumeration(void)
+ throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< container::XEnumeration > aRef;
+ if(IsValid())
+ {
+ SwNode& rNode = GetDoc()->GetNodes().GetEndOfContent();
+ SwPosition aPos(rNode);
+ SwUnoCrsr* pUnoCrsr = GetDoc()->CreateUnoCrsr(aPos, sal_False);
+ pUnoCrsr->Move( fnMoveBackward, fnGoDoc );
+ aRef = new SwXParagraphEnumeration(this, pUnoCrsr, CURSOR_BODY);
+ }
+ else
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ return aRef;
+
+}
+/* -----------------18.12.98 13:36-------------------
+ *
+ * --------------------------------------------------*/
+uno::Type SwXBodyText::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+/* -----------------18.12.98 13:36-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXBodyText::hasElements(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ if(IsValid())
+ return sal_True;
+ else
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ return sal_False;
+}
+/******************************************************************
+ * SwXHeadFootText
+ ******************************************************************/
+TYPEINIT1(SwXHeadFootText, SwClient);
+/* -----------------------------06.04.00 16:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXHeadFootText::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXHeadFootText");
+}
+/* -----------------------------06.04.00 16:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXHeadFootText::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.Text") == rServiceName;
+}
+/* -----------------------------06.04.00 16:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXHeadFootText::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.Text");
+ return aRet;
+}
+/*-- 11.12.98 10:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXHeadFootText::SwXHeadFootText(SwFrmFmt& rHeadFootFmt, BOOL bHeader) :
+ SwXText(rHeadFootFmt.GetDoc(), bHeader ? CURSOR_HEADER : CURSOR_FOOTER),
+ SwClient(&rHeadFootFmt),
+ bIsHeader(bHeader)
+{
+
+}
+/*-- 11.12.98 10:14:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXHeadFootText::~SwXHeadFootText()
+{
+
+}
+/*-- 11.12.98 10:14:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwStartNode *SwXHeadFootText::GetStartNode() const
+{
+ const SwStartNode *pSttNd = 0;
+ SwFrmFmt* pHeadFootFmt = GetFmt();
+ if(pHeadFootFmt)
+ {
+ const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
+ if( rFlyCntnt.GetCntntIdx() )
+ pSttNd = rFlyCntnt.GetCntntIdx()->GetNode().GetStartNode();
+ }
+ return pSttNd;
+}
+
+uno::Reference< XTextCursor > SwXHeadFootText::createCursor() throw(uno::RuntimeException)
+{
+ return createTextCursor();
+}
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< ::com::sun::star::uno::Type > SwXHeadFootText::getTypes( ) throw(uno::RuntimeException)
+{
+ uno::Sequence< uno::Type > aHFTypes = SwXHeadFootTextBaseClass::getTypes();
+ uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes();
+
+ long nIndex = aHFTypes.getLength();
+ aHFTypes.realloc(
+ aHFTypes.getLength() +
+ aTextTypes.getLength());
+
+ uno::Type* pHFTypes = aHFTypes.getArray();
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ for(long nPos = 0; nPos < aTextTypes.getLength(); nPos++)
+ pHFTypes[nIndex++] = pTextTypes[nPos];
+
+ return aHFTypes;
+}
+
+/* -----------------------------21.03.00 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< sal_Int8 > SwXHeadFootText::getImplementationId( ) throw(uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* -----------------------------21.03.00 15:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SwXHeadFootText::queryInterface( const uno::Type& aType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = SwXHeadFootTextBaseClass::queryInterface(aType);
+ if(aRet.getValueType() == ::getCppuVoidType() )
+ aRet = SwXText::queryInterface(aType);
+ return aRet;
+}
+
+/*-- 11.12.98 10:14:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextCursor > SwXHeadFootText::createTextCursor(void) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > xRet;
+ SwFrmFmt* pHeadFootFmt = GetFmt();
+ if(pHeadFootFmt)
+ {
+ const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
+ const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
+ SwPosition aPos(rNode);
+ SwXTextCursor* pCrsr = new SwXTextCursor(this, aPos, bIsHeader ? CURSOR_HEADER : CURSOR_FOOTER, GetDoc());
+ SwUnoCrsr* pUnoCrsr = pCrsr->GetCrsr();
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+
+ //save current start node to be able to check if there is content after the table -
+ //otherwise the cursor would be in the body text!
+
+ const SwStartNode* pOwnStartNode = rNode.FindSttNodeByType(
+ bIsHeader ? SwHeaderStartNode : SwFooterStartNode);
+ //steht hier eine Tabelle?
+ SwTableNode* pTblNode = pUnoCrsr->GetNode()->FindTableNode();
+ SwCntntNode* pCont = 0;
+ while( pTblNode )
+ {
+ pUnoCrsr->GetPoint()->nNode = *pTblNode->EndOfSectionNode();
+ pCont = GetDoc()->GetNodes().GoNext(&pUnoCrsr->GetPoint()->nNode);
+ pTblNode = pCont->FindTableNode();
+ }
+ if(pCont)
+ pUnoCrsr->GetPoint()->nContent.Assign(pCont, 0);
+ const SwStartNode* pNewStartNode = pUnoCrsr->GetNode()->FindSttNodeByType(
+ bIsHeader ? SwHeaderStartNode : SwFooterStartNode);
+ if(!pNewStartNode || pNewStartNode != pOwnStartNode)
+ {
+ pCrsr = NULL;
+ uno::RuntimeException aExcept;
+ aExcept.Message = S2U("no text available");
+ throw aExcept;
+ }
+ xRet = (XWordCursor*)pCrsr;
+ }
+ else
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+ return xRet;
+}
+/*-- 11.12.98 10:14:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XTextCursor > SwXHeadFootText::createTextCursorByRange(
+ const uno::Reference< XTextRange > & aTextPosition) throw( uno::RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< XTextCursor > xRet;
+ SwFrmFmt* pHeadFootFmt = GetFmt();
+ SwUnoInternalPaM aPam(*GetDoc());
+ if(pHeadFootFmt && SwXTextRange::XTextRangeToSwPaM(aPam, aTextPosition))
+ {
+ SwNode& rNode = pHeadFootFmt->GetCntnt().GetCntntIdx()->GetNode();
+ SwPosition aPos(rNode);
+ SwPaM aHFPam(aPos);
+ aHFPam.Move(fnMoveForward, fnGoNode);
+ SwStartNode* pOwnStartNode = aHFPam.GetNode()->FindSttNodeByType(
+ bIsHeader ? SwHeaderStartNode : SwFooterStartNode);
+ SwStartNode* p1 = aPam.GetNode()->FindSttNodeByType(
+ bIsHeader ? SwHeaderStartNode : SwFooterStartNode);
+ if(p1 == pOwnStartNode)
+ xRet = (XWordCursor*)new SwXTextCursor(this, *aPam.GetPoint(),
+ bIsHeader ? CURSOR_HEADER : CURSOR_FOOTER, GetDoc(), aPam.GetMark());
+ }
+ return xRet;
+}
+/* -----------------19.03.99 15:44-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< container::XEnumeration > SwXHeadFootText::createEnumeration(void)
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ uno::Reference< container::XEnumeration > aRef;
+ //wenn this ungueltig ist, dann kommt die uno::Exception aus createTextCursor()
+ SwFrmFmt* pHeadFootFmt = GetFmt();
+ if(pHeadFootFmt)
+ {
+ const SwFmtCntnt& rFlyCntnt = pHeadFootFmt->GetCntnt();
+ const SwNode& rNode = rFlyCntnt.GetCntntIdx()->GetNode();
+ SwPosition aPos(rNode);
+ SwUnoCrsr* pUnoCrsr = GetDoc()->CreateUnoCrsr(aPos, sal_False);
+ pUnoCrsr->Move(fnMoveForward, fnGoNode);
+ aRef = new SwXParagraphEnumeration(this, pUnoCrsr, bIsHeader ? CURSOR_HEADER : CURSOR_FOOTER);
+ }
+ else
+ {
+ RuntimeException aRuntime;
+ aRuntime.Message = C2U(cInvalidObject);
+ throw aRuntime;
+ }
+
+ return aRef;
+}
+/* -----------------19.03.99 15:50-------------------
+ *
+ * --------------------------------------------------*/
+uno::Type SwXHeadFootText::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Reference<XTextRange>*)0);
+}
+/* -----------------19.03.99 15:50-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXHeadFootText::hasElements(void) throw( uno::RuntimeException )
+{
+ return sal_True;
+}
+
+/*-- 11.12.98 10:14:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXHeadFootText::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew)
+{
+ ClientModify( this, pOld, pNew);
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/view/makefile.mk b/binfilter/bf_sw/source/core/view/makefile.mk
new file mode 100644
index 000000000000..d0325576d92b
--- /dev/null
+++ b/binfilter/bf_sw/source/core/view/makefile.mk
@@ -0,0 +1,72 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+
+PRJ=..$/..$/..$/..
+BFPRJ=..$/..$/..
+
+PRJNAME=binfilter
+TARGET=sw_view
+
+NO_HIDS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/bf_sw$/sw.mk
+INC+= -I$(PRJ)$/inc$/bf_sw
+
+.IF "$(GUI)$(COM)" == "WINMSC"
+LIBFLAGS=/NOI /NOE /PAGE:128
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ sw_scrrect.cxx \
+ sw_vdraw.cxx \
+ sw_viewimp.cxx \
+ sw_viewsh.cxx \
+ sw_vnew.cxx \
+ sw_vprint.cxx
+
+
+
+SLOFILES = \
+ $(SLO)$/sw_scrrect.obj \
+ $(SLO)$/sw_vdraw.obj \
+ $(SLO)$/sw_viewimp.obj \
+ $(SLO)$/sw_viewsh.obj \
+ $(SLO)$/sw_vnew.obj \
+ $(SLO)$/sw_vprint.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/binfilter/bf_sw/source/core/view/sw_scrrect.cxx b/binfilter/bf_sw/source/core/view/sw_scrrect.cxx
new file mode 100644
index 000000000000..30a9acbae30c
--- /dev/null
+++ b/binfilter/bf_sw/source/core/view/sw_scrrect.cxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <viewimp.hxx>
+// OD 18.02.2003 #107562# - <SwAlignRect> for <ViewShell::Scroll()>
+
+#include <horiornt.hxx>
+
+#include "crsrsh.hxx"
+#include "pagefrm.hxx"
+// OD 12.11.2002 #96272# - include declaration for <SetMappingForVirtDev>
+namespace binfilter {
+
+
+/*****************************************************************************
+|*
+|* ViewShell::AddScrollRect()
+|*
+|* Creation MA 07. Mar. 94
+|* Last change AMA 20. July 00
+|*
+|* Description
+|* ViewShell::AddScrollRect(..) passes a registration from a scrolling frame or
+|* rectangle to all ViewShells and SwViewImps respectively.
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::AddScrollRect( const SwFrm *pFrm, const SwRect &rRect,
+/*N*/ long nOfs )
+/*N*/ {
+/*N*/ ASSERT( pFrm, "Where is my friend, the frame?" );
+/*N*/ BOOL bScrollOn = TRUE;
+/*N*/
+/*N*/ #ifdef NOSCROLL
+/*N*/ //Auch im Product per speziellem Compilat abschaltbar.
+/*N*/ bScrollOn = FALSE;
+/*N*/ #endif
+/*N*/
+/*N*/ if( bScrollOn && Imp()->IsScroll() && nOfs <= SHRT_MAX && nOfs >= SHRT_MIN )
+/*N*/ {
+/*N*/ ViewShell *pSh = this;
+/*N*/ do
+/*N*/ {
+/*N*/ pSh->Imp()->AddScrollRect( pFrm, rRect, nOfs );
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/ } while ( pSh != this );
+/*N*/ }
+/*N*/ else
+/*N*/ AddPaintRect( rRect );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::Scroll()
+|*
+|* Ersterstellung MA 07. Mar. 94
+|* Last change AMA 21. July 00
+|*
+|* Description
+|* ViewShell::Scroll() scrolls all rectangles in the pScrollRects-list and
+|* transfers the critical lines by calling SwViewImp::MoveScrollArea(..).
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::Scroll()
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::SetNoNextScroll()
+|*
+|* Ersterstellung MA 08. Mar. 94
+|* Letzte Aenderung MA 08. Mar. 94
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::SetNoNextScroll()
+/*N*/ {
+/*N*/ ViewShell *pSh = this;
+/*N*/ do
+/*N*/ { pSh->Imp()->ResetNextScroll();
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != this );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::AddScrollRect()
+|*
+|* Ersterstellung MA 07. Mar. 94
+|* Last change AMA 21. July 00
+|*
+|* Adds a scrollable rectangle and his critical lines to the list.
+|*
+******************************************************************************/
+
+/*N*/ void SwViewImp::AddScrollRect( const SwFrm *pFrm, const SwRect &rRect,
+/*N*/ long nOffs )
+/*N*/ {
+/*N*/ ASSERT( nOffs != 0, "Scrollen ohne Ofst." );
+/*N*/ SwRect aRect( rRect );
+/*N*/ BOOL bVert = pFrm->IsVertical();
+/*N*/ if( bVert )
+/*?*/ aRect.Pos().X() += nOffs;
+/*N*/ else
+/*N*/ aRect.Pos().Y() -= nOffs;
+/*N*/ if( aRect.IsOver( pSh->VisArea() ) )
+/*N*/ {
+ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 /*?*/ ASSERT( pSh->GetWin(), "Scrolling without outputdevice" );
+/*N*/ }
+/*N*/ else
+/*N*/ AddPaintRect( rRect );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::MoveScrollArea()
+|*
+|* Creation AMA 10. July 00
+|* Last change AMA 21. July 00
+|*
+|* Transfers the areas after scrolling to the scrolled list, but only those
+|* parts with critical lines.
+|*
+******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* SwViewImp::FlushScrolledArea()
+|*
+|* Creation AMA 10. July 00
+|* Last change AMA 21. July 00
+|*
+|* Flushes the scrolled critical lines, that is transfer them to AddPaintRect()
+|* and remove them from the list.
+|*
+******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* SwViewImp::_FlushScrolledArea(..)
+|*
+|* Creation AMA 10. July 00
+|* Last change AMA 21. July 00
+|*
+|* The critical lines, which overlaps with the given rectangle, will be united
+|* with the rectangle and removed from the list.
+|*
+******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* SwViewImp::RefreshScrolledHdl(..)
+|*
+|* Creation MA 06. Oct. 94
+|* Last change AMA 21. July 00
+|*
+|* Every timerstop one of the critical lines will be painted.
+|*
+******************************************************************************/
+
+/*N*/ IMPL_LINK( SwViewImp, RefreshScrolledHdl, Timer *, EMPTYARG )
+/*N*/ {
+ {DBG_BF_ASSERT(0, "STRIP");} return 0;//STRIP001 DBG_PROFSTART( RefreshTimer );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::_ScrolledRect(..)
+|*
+|* Creation AMA 20. July 00
+|* Last change AMA 21. July 00
+|*
+|* handles the problem of scrolled criticals lines, when they are a part of
+|* a scrolling area again. In this case, their rectangle has to move to the
+|* right position.
+|*
+******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* SwViewImp::_RefreshScrolledArea()
+|*
+******************************************************************************/
+
+//Berechnen der Hoehe fuer das virtuelle Device, Breite und maximaler
+//Speicherbedarf sind vorgegeben.
+#define MAXKB 180L
+
+
+
+/******************************************************************************
+|*
+|* SwViewImp::RefreshScrolledArea()
+|*
+|* Ersterstellung MA 06. Oct. 94
+|* Letzte Aenderung MA 19. Apr. 95
+|*
+******************************************************************************/
+
+
+
+
+
+
+/******************************************************************************
+|*
+|* SwScrollAreas::Insert(..)
+|*
+******************************************************************************/
+
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/view/sw_vdraw.cxx b/binfilter/bf_sw/source/core/view/sw_vdraw.cxx
new file mode 100644
index 000000000000..92d868030215
--- /dev/null
+++ b/binfilter/bf_sw/source/core/view/sw_vdraw.cxx
@@ -0,0 +1,252 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <bf_svx/svdpage.hxx>
+
+#include <bf_svx/svdpagv.hxx>
+
+#include <fmtanchr.hxx>
+#include <frmfmt.hxx>
+
+/// OD 29.08.2002 #102450#
+/// include <bf_svx/svdoutl.hxx>
+
+#ifdef DBG_UTIL
+#endif
+
+#include <horiornt.hxx>
+
+#include "fesh.hxx"
+#include "doc.hxx"
+#include "viewimp.hxx"
+#include "dcontact.hxx"
+#include "dview.hxx"
+#include "flyfrm.hxx"
+namespace binfilter {
+
+
+/*************************************************************************
+|*
+|* SwSaveHdl
+|*
+|* Ersterstellung MA 14. Feb. 95
+|* Letzte Aenderung MA 02. Jun. 98
+|*
+|*************************************************************************/
+
+
+
+
+/*************************************************************************
+|*
+|* SwViewImp::StartAction(), EndAction()
+|*
+|* Ersterstellung MA 14. Feb. 95
+|* Letzte Aenderung MA 14. Sep. 98
+|*
+|*************************************************************************/
+
+
+/*N*/ void SwViewImp::StartAction()
+/*N*/ {
+/*N*/ if ( HasDrawView() )
+/*N*/ {
+/*N*/ SET_CURR_SHELL( GetShell() );
+/*N*/ if ( pSh->ISA(SwFEShell) )
+/*N*/ ((SwFEShell*)pSh)->HideChainMarker(); //Kann sich geaendert haben
+/*N*/ bResetXorVisibility = GetDrawView()->IsShownXorVisible( GetShell()->GetOut());
+/*N*/ GetDrawView()->HideShownXor( GetShell()->GetOut() );
+/*N*/ }
+/*N*/ }
+
+
+
+/*N*/ void SwViewImp::EndAction()
+/*N*/ {
+/*N*/ if ( HasDrawView() )
+/*N*/ {
+/*N*/ SET_CURR_SHELL( GetShell() );
+/*N*/ if ( bResetXorVisibility )
+/*?*/ GetDrawView()->ShowShownXor( GetShell()->GetOut() );
+/*N*/ if ( pSh->ISA(SwFEShell) )
+/*N*/ ((SwFEShell*)pSh)->SetChainMarker(); //Kann sich geaendert haben
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* SwViewImp::LockPaint(), UnlockPaint()
+|*
+|* Ersterstellung MA 11. Jun. 96
+|* Letzte Aenderung MA 11. Jun. 96
+|*
+|*************************************************************************/
+
+
+
+
+
+
+
+/*************************************************************************
+|*
+|* SwViewImp::PaintLayer(), PaintDispatcher()
+|*
+|* Ersterstellung MA 20. Dec. 94
+|* Letzte Aenderung AMA 04. Jun. 98
+|*
+|*************************************************************************/
+// OD 29.08.2002 #102450#
+// add 3rd paramter <const Color* pPageBackgrdColor> for setting this
+// color as the background color at the outliner of the draw view.
+// OD 09.12.2002 #103045# - add 4th parameter for the horizontal text direction
+// of the page in order to set the default horizontal text direction at the
+// outliner of the draw view for painting layers <hell> and <heaven>.
+// OD 25.06.2003 #108784# - correct type of 1st parameter
+
+
+
+/*************************************************************************
+|*
+|* SwViewImp::PaintFlyChilds()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 02. Aug. 95
+|*
+|*************************************************************************/
+
+
+
+/*************************************************************************
+|*
+|* SwViewImp::IsDragPossible()
+|*
+|* Ersterstellung MA 19. Jan. 93
+|* Letzte Aenderung MA 16. Jan. 95
+|*
+|*************************************************************************/
+
+
+
+#define WIEDUWILLST 400
+
+
+/*************************************************************************
+|*
+|* SwViewImp::NotifySizeChg()
+|*
+|* Ersterstellung MA 23. Jun. 93
+|* Letzte Aenderung MA 05. Oct. 98
+|*
+|*************************************************************************/
+
+/*N*/ void SwViewImp::NotifySizeChg( const Size &rNewSz )
+/*N*/ {
+/*N*/ if ( !HasDrawView() )
+/*N*/ return;
+/*N*/
+/*N*/ if ( GetPageView() )
+/*N*/ GetPageView()->GetPage()->SetSize( rNewSz );
+/*N*/
+/*N*/ //Begrenzung des Arbeitsbereiches.
+/*N*/ Rectangle aRect( Point( DOCUMENTBORDER, DOCUMENTBORDER ), rNewSz );
+/*N*/ const Rectangle &rOldWork = GetDrawView()->GetWorkArea();
+/*N*/ BOOL bCheckDrawObjs = FALSE;
+/*N*/ if ( aRect != rOldWork )
+/*N*/ {
+/*N*/ if ( rOldWork.Bottom() > aRect.Bottom() || rOldWork.Right() > aRect.Right())
+/*N*/ bCheckDrawObjs = TRUE;
+/*N*/ GetDrawView()->SetWorkArea( aRect );
+/*N*/ }
+/*N*/ if ( !bCheckDrawObjs )
+/*N*/ return;
+/*N*/
+/*N*/ ASSERT( pSh->GetDoc()->GetDrawModel(), "NotifySizeChg without DrawModel" );
+/*N*/ SdrPage* pPage = pSh->GetDoc()->GetDrawModel()->GetPage( 0 );
+/*N*/ const ULONG nObjs = pPage->GetObjCount();
+/*N*/ for( ULONG nObj = 0; nObj < nObjs; ++nObj )
+/*N*/ {
+/*N*/ SdrObject *pObj = pPage->GetObj( nObj );
+/*N*/ if( !pObj->IsWriterFlyFrame() )
+/*N*/ {
+/*N*/ //Teilfix(26793): Objekte, die in Rahmen verankert sind, brauchen
+/*N*/ //nicht angepasst werden.
+/*N*/ const SwContact *pCont = (SwContact*)GetUserCall(pObj);
+/*N*/ //JP - 16.3.00 Bug 73920: this function might be called by the
+/*N*/ // InsertDocument, when a PageDesc-Attribute is
+/*N*/ // set on a node. Then the SdrObject must not have
+/*N*/ // an UserCall.
+/*N*/ if( !pCont || !pCont->ISA(SwDrawContact) )
+/*N*/ continue;
+/*N*/
+/*N*/ const SwFrm *pAnchor = ((SwDrawContact*)pCont)->GetAnchor();
+/*N*/ if ( !pAnchor || pAnchor->IsInFly() || !pAnchor->IsValid() ||
+/*N*/ !pAnchor->GetUpper() || !pAnchor->FindPageFrm() ||
+/*N*/ FLY_IN_CNTNT == pCont->GetFmt()->GetAnchor().GetAnchorId() )
+/*N*/ continue;
+/*N*/
+/*N*/ // OD 19.06.2003 #108784# - no move for drawing objects in header/footer
+/*N*/ if ( pAnchor->FindFooterOrHeader() )
+/*N*/ {
+/*N*/ continue;
+/*N*/ }
+/*N*/
+/*N*/ const Rectangle aBound( pObj->GetBoundRect() );
+/*N*/ if ( !aRect.IsInside( aBound ) )
+/*N*/ {
+/*N*/ Size aSz;
+/*N*/ if ( aBound.Left() > aRect.Right() )
+/*N*/ aSz.Width() = (aRect.Right() - aBound.Left()) - MINFLY;
+/*N*/ if ( aBound.Top() > aRect.Bottom() )
+/*?*/ aSz.Height() = (aRect.Bottom() - aBound.Top()) - MINFLY;
+/*N*/ if ( aSz.Width() || aSz.Height() )
+/*N*/ pObj->Move( aSz );
+/*N*/
+/*N*/ //Notanker: Grosse Objekte nicht nach oben verschwinden lassen.
+/*N*/ aSz.Width() = aSz.Height() = 0;
+/*N*/ if ( aBound.Bottom() < aRect.Top() )
+/*N*/ aSz.Width() = (aBound.Bottom() - aRect.Top()) - MINFLY;
+/*N*/ if ( aBound.Right() < aRect.Left() )
+/*N*/ aSz.Height() = (aBound.Right() - aRect.Left()) - MINFLY;
+/*N*/ if ( aSz.Width() || aSz.Height() )
+/*N*/ pObj->Move( aSz );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/view/sw_viewimp.cxx b/binfilter/bf_sw/source/core/view/sw_viewimp.cxx
new file mode 100644
index 000000000000..aeb6eff46d12
--- /dev/null
+++ b/binfilter/bf_sw/source/core/view/sw_viewimp.cxx
@@ -0,0 +1,283 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include "scrrect.hxx"
+
+#include <horiornt.hxx>
+
+#include "doc.hxx"
+#include "crsrsh.hxx"
+#include "rootfrm.hxx"
+#include "pagefrm.hxx"
+#include "viewimp.hxx"
+#include "viewopt.hxx"
+#include "layact.hxx"
+#include "swregion.hxx"
+#include "dview.hxx"
+#include <bf_svx/svdpage.hxx>
+#ifdef ACCESSIBLE_LAYOUT
+#endif
+
+// OD 12.12.2002 #103492#
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* SwViewImp::Init()
+|*
+|* Ersterstellung MA 25. Jul. 94
+|* Letzte Aenderung MA 03. Nov. 95
+|*
+|*************************************************************************/
+
+/*N*/ void SwViewImp::Init( const SwViewOption *pNewOpt )
+/*N*/ {
+ DBG_ERROR("Strip!");
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::~SwViewImp()
+|*
+|* Ersterstellung MA 25. Jul. 94
+|* Letzte Aenderung MA 16. Dec. 94
+|*
+******************************************************************************/
+
+/*N*/ SwViewImp::~SwViewImp()
+/*N*/ {
+#if 0
+/*N*/
+/*N*/ // OD 12.12.2002 #103492#
+/*N*/
+/*N*/ //JP 29.03.96: nach ShowPage muss auch HidePage gemacht werden!!!
+/*N*/ if( pDrawView )
+/*N*/ pDrawView->HidePage( pSdrPageView );
+/*N*/
+/*N*/ delete pDrawView;
+/*N*/
+/*N*/ DelRegions();
+/*N*/ delete pScrolledArea;
+/*N*/
+/*N*/ ASSERT( !pLayAct, "Have action for the rest of your life." );
+/*N*/ ASSERT( !pIdleAct,"Be idle for the rest of your life." );
+#endif
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::DelRegions()
+|*
+|* Ersterstellung MA 14. Apr. 94
+|* Letzte Aenderung MA 14. Apr. 94
+|*
+******************************************************************************/
+
+/*N*/ void SwViewImp::DelRegions()
+/*N*/ {
+/*N*/ DELETEZ(pRegion);
+/*N*/ DELETEZ(pScrollRects);
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::AddPaintRect()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 27. Jul. 94
+|*
+******************************************************************************/
+
+/*N*/ BOOL SwViewImp::AddPaintRect( const SwRect &rRect )
+/*N*/ {
+/*N*/ if ( rRect.IsOver( pSh->VisArea() ) )
+/*N*/ {
+/*?*/ if ( !pRegion )
+/*?*/ pRegion = new SwRegionRects( pSh->VisArea() );
+/*?*/ (*pRegion) -= rRect;
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/******************************************************************************
+|*
+|* ViewImp::CheckWaitCrsr()
+|*
+|* Ersterstellung MA 10. Aug. 94
+|* Letzte Aenderung MA 10. Aug. 94
+|*
+******************************************************************************/
+
+/*N*/ void SwViewImp::CheckWaitCrsr()
+/*N*/ {
+/*N*/ if ( pLayAct )
+/*N*/ pLayAct->CheckWaitCrsr();
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewImp::IsCalcLayoutProgress()
+|*
+|* Ersterstellung MA 12. Aug. 94
+|* Letzte Aenderung MA 12. Aug. 94
+|*
+******************************************************************************/
+
+/*N*/ BOOL SwViewImp::IsCalcLayoutProgress() const
+/*N*/ {
+/*N*/ if ( pLayAct )
+/*N*/ return pLayAct->IsCalcLayout();
+/*N*/ return FALSE;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewImp::IsUpdateExpFlds()
+|*
+|* Ersterstellung MA 28. Mar. 96
+|* Letzte Aenderung MA 28. Mar. 96
+|*
+******************************************************************************/
+
+/*N*/ BOOL SwViewImp::IsUpdateExpFlds()
+/*N*/ {
+/*N*/ if ( pLayAct && pLayAct->IsCalcLayout() )
+/*N*/ {
+/*?*/ pLayAct->SetUpdateExpFlds();
+/*?*/ return TRUE;
+/*N*/ }
+/*N*/ return FALSE;
+/*N*/ }
+
+
+/******************************************************************************
+|*
+|* SwViewImp::SetFirstVisPage(), ImplGetFirstVisPage();
+|*
+|* Ersterstellung MA 21. Sep. 93
+|* Letzte Aenderung MA 08. Mar. 94
+|*
+******************************************************************************/
+
+/*N*/ void SwViewImp::SetFirstVisPage()
+/*N*/ {
+/*N*/ if ( pSh->bDocSizeChgd && pSh->VisArea().Top() > pSh->GetLayout()->Frm().Height() )
+/*N*/ {
+/*N*/ //Wir stecken in einer Action und die VisArea sitzt wegen
+/*N*/ //Loeschoperationen hinter der erste sichtbaren Seite.
+/*N*/ //Damit nicht zu heftig Formatiert wird, liefern wir die letzte Seite
+/*N*/ //zurueck.
+/*?*/ pFirstVisPage = (SwPageFrm*)pSh->GetLayout()->Lower();
+/*?*/ while ( pFirstVisPage && pFirstVisPage->GetNext() )
+/*?*/ pFirstVisPage = (SwPageFrm*)pFirstVisPage->GetNext();
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ SwPageFrm *pPage = (SwPageFrm*)pSh->GetLayout()->Lower();
+/*N*/ while ( pPage && !pPage->Frm().IsOver( pSh->VisArea() ) )
+/*N*/ pPage = (SwPageFrm*)pPage->GetNext();
+/*N*/ pFirstVisPage = pPage ? pPage : (SwPageFrm*)pSh->GetLayout()->Lower();
+/*N*/ }
+/*N*/ bFirstPageInvalid = FALSE;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::MakeDrawView();
+|*
+|* Ersterstellung AMA 01. Nov. 95
+|* Letzte Aenderung AMA 01. Nov. 95
+|*
+******************************************************************************/
+
+/*N*/ void SwViewImp::MakeDrawView()
+/*N*/ {
+#if 0
+/*N*/ if( !GetShell()->GetDoc()->GetDrawModel() )
+/*?*/ GetShell()->GetDoc()->_MakeDrawModel();
+/*N*/ else
+/*N*/ {
+/*N*/ if ( !pDrawView )
+/*N*/ {
+/*N*/ pDrawView = new SwDrawView( *this,
+/*N*/ GetShell()->GetDoc()->GetDrawModel(),
+/*N*/ GetShell()->GetWin() ?
+/*N*/ GetShell()->GetWin() :
+/*N*/ (OutputDevice*)GetShell()->GetDoc()->GetPrt() );
+/*N*/ }
+/*N*/ GetDrawView()->SetActiveLayer( XubString::CreateFromAscii(
+/*N*/ RTL_CONSTASCII_STRINGPARAM( "Heaven" ) ) );
+/*N*/ Init( GetShell()->GetViewOptions() );
+/*N*/ }
+#endif
+/*N*/ }
+
+/******************************************************************************
+|*
+|* SwViewImp::GetRetoucheColor()
+|*
+|* Ersterstellung MA 24. Jun. 98
+|* Letzte Aenderung MA 24. Jun. 98
+|*
+******************************************************************************/
+
+
+/** create page preview layout
+
+ OD 12.12.2002 #103492#
+
+ @author OD
+*/
+
+
+/*N*/ void SwViewImp::DisposeAccessible( const SwFrm *pFrm,
+/*N*/ const SdrObject *pObj,
+/*N*/ sal_Bool bRecursive )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*N*/ void SwViewImp::MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj,
+/*N*/ const SwRect& rOldFrm )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+/*N*/ void SwViewImp::InvalidateAccessibleFrmContent( const SwFrm *pFrm )
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ }
+
+// OD 15.01.2003 #103492# - method signature change due to new page preview functionality
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/view/sw_viewsh.cxx b/binfilter/bf_sw/source/core/view/sw_viewsh.cxx
new file mode 100644
index 000000000000..7be3f5e31c48
--- /dev/null
+++ b/binfilter/bf_sw/source/core/view/sw_viewsh.cxx
@@ -0,0 +1,624 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#define _SVX_PARAITEM_HXX
+#define _SVX_TEXTITEM_HXX
+
+#include <bf_sfx2/progress.hxx>
+#include <swwait.hxx>
+
+#include <horiornt.hxx>
+
+#include <fesh.hxx>
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <pagefrm.hxx>
+#include <viewimp.hxx>
+#include <frmtool.hxx>
+#include <viewopt.hxx>
+#include <dview.hxx>
+#include <swregion.hxx>
+#include <hints.hxx>
+#include <txtfrm.hxx>
+#include <layact.hxx>
+#include <mdiexp.hxx>
+#include <fntcache.hxx>
+#include <docsh.hxx>
+#include <pagedesc.hxx>
+#include <accessibilityoptions.hxx>
+#include <statstr.hrc>
+#include <shellres.hxx>
+namespace binfilter {
+
+BOOL ViewShell::bLstAct = FALSE;
+ShellResource *ViewShell::pShellRes = 0;
+Window *ViewShell::pCareWindow = 0;
+
+FASTBOOL bInSizeNotify = FALSE;
+
+/*N*/ DBG_NAME(LayoutIdle)
+
+/*N*/ TYPEINIT0(ViewShell);
+
+/******************************************************************************
+|*
+|* ViewShell::ImplEndAction()
+|*
+|* Letzte Aenderung MA 04. Sep. 96
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::ImplEndAction( const BOOL bIdleEnd )
+/*N*/ {
+/*N*/ //Fuer den Drucker gibt es hier nichts zu tun.
+/*N*/ if ( !GetWin() || IsPreView() )
+/*N*/ {
+/*?*/ bPaintWorks = TRUE;
+/*?*/ UISizeNotify();
+/*?*/ return;
+/*N*/ }
+/*N*/
+/*N*/ // #94195# remember when the handles need refresh at end of method
+/*N*/ sal_Bool bRefreshMarker(sal_False);
+/*N*/
+/*N*/ bInEndAction = TRUE;
+/*N*/
+/*N*/ //Laeuft hiermit das EndAction der Letzten Shell im Ring?
+/*N*/ ViewShell::bLstAct = TRUE;
+/*N*/ ViewShell *pSh = (ViewShell*)this->GetNext();
+/*N*/ while ( pSh != this )
+/*?*/ { if ( pSh->ActionPend() )
+/*?*/ { ViewShell::bLstAct = FALSE;
+/*?*/ pSh = this;
+/*?*/ }
+/*?*/ else
+/*?*/ pSh = (ViewShell*)pSh->GetNext();
+/*?*/ }
+/*N*/
+/*N*/ SET_CURR_SHELL( this );
+/*N*/ if ( Imp()->HasDrawView() && !Imp()->GetDrawView()->IsMarkHdlHidden() )
+/*?*/ Imp()->StartAction();
+/*N*/
+/*N*/ if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() )
+/*N*/ Imp()->DelRegions();
+/*N*/
+/*N*/ const FASTBOOL bExtraData = ::binfilter::IsExtraData( GetDoc() );
+/*N*/
+/*N*/ if ( !bIdleEnd )
+/*N*/ {
+/*N*/ if ( Imp()->IsNextScroll() && !bExtraData )
+/*N*/ Imp()->SetScroll();
+/*N*/ else
+/*N*/ {
+/*N*/ if ( bExtraData )
+/*?*/ Imp()->bScroll = FALSE;
+/*N*/ Imp()->SetNextScroll();
+/*N*/ Imp()->ResetScroll();
+/*N*/ }
+/*N*/ SwLayAction aAction( GetLayout(), Imp() );
+/*N*/ aAction.SetComplete( FALSE );
+/*N*/ if ( nLockPaint )
+/*?*/ aAction.SetPaint( FALSE );
+/*N*/ aAction.SetInputType( INPUT_KEYBOARD );
+/*N*/ aAction.Action();
+/*N*/ Imp()->SetScroll();
+/*N*/ }
+/*N*/
+/*N*/ //Wenn wir selbst keine Paints erzeugen, so warten wir auf das Paint
+/*N*/ //vom System. Dann ist das Clipping korrekt gesetzt; Beispiel: verschieben
+/*N*/ //eines DrawObjektes.
+/*N*/ if ( Imp()->GetRegion() || Imp()->GetScrollRects() ||
+/*N*/ aInvalidRect.HasArea() || bExtraData )
+/*N*/ {
+/*?*/ if ( !nLockPaint )
+/*?*/ {
+/*?*/ FASTBOOL bPaintsFromSystem = aInvalidRect.HasArea();
+/*?*/ GetWin()->Update();
+/*?*/ if ( aInvalidRect.HasArea() )
+/*?*/ {
+/*?*/ if ( bPaintsFromSystem )
+/*?*/ Imp()->AddPaintRect( aInvalidRect );
+/*?*/
+/*?*/ // AW 22.09.99: tell DrawView that drawing order will be rearranged
+/*?*/ // to give it a chance to react with proper IAO updates
+/*?*/ if (HasDrawView())
+/*?*/ {
+/*?*/ DBG_BF_ASSERT(0, "STRIP"); //STRIP001 GetDrawView()->ForceInvalidateMarkHandles();
+/*?*/ }
+/*?*/
+/*?*/ ResetInvalidRect();
+/*?*/ bPaintsFromSystem = TRUE;
+/*?*/ }
+/*?*/ bPaintWorks = TRUE;
+/*?*/
+/*?*/ SwRegionRects *pRegion = Imp()->GetRegion();
+/*?*/
+/*?*/ //JP 27.11.97: wer die Selection hided, muss sie aber auch
+/*?*/ // wieder Showen. Sonst gibt es Paintfehler!
+/*?*/ // z.B.: addional Mode, Seite vertikal hab zu sehen, in der
+/*?*/ // Mitte eine Selektion und mit einem anderen Cursor an linken
+/*?*/ // rechten Rand springen. Ohne ShowCrsr verschwindet die
+/*?*/ // Selektion
+/*?*/ BOOL bShowCrsr = (pRegion || Imp()->GetScrollRects()) &&
+/*?*/ IsA( TYPE(SwCrsrShell) );
+/*?*/ if( bShowCrsr )
+/*?*/ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 ((SwCrsrShell*)this)->HideCrsrs();
+/*?*/
+/*?*/ Scroll();
+/*?*/ if ( bPaintsFromSystem && Imp()->pScrolledArea )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ Imp()->FlushScrolledArea();
+/*?*/
+/*?*/ if ( pRegion )
+ {DBG_BF_ASSERT(0, "STRIP");} //STRIP001 /*?*/ {
+/*?*/ if( bShowCrsr )
+/*?*/ ((SwCrsrShell*)this)->ShowCrsrs( TRUE );
+/*?*/ }
+/*?*/ else
+/*?*/ {
+/*?*/ Imp()->DelRegions();
+/*?*/ bPaintWorks = TRUE;
+/*?*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ bPaintWorks = TRUE;
+/*N*/
+/*N*/ bInEndAction = FALSE;
+/*N*/ ViewShell::bLstAct = FALSE;
+/*N*/ Imp()->EndAction();
+/*N*/
+/*N*/
+/*N*/ //Damit sich die automatischen Scrollbars auch richtig anordnen k”nnen
+/*N*/ //muessen wir die Aktion hier kuenstlich beenden (EndAction loesst ein
+/*N*/ //Notify aus, und das muss Start-/EndAction rufen um die Scrollbars
+/*N*/ //klarzubekommen.
+/*N*/ --nStartAction;
+/*N*/ UISizeNotify();
+/*N*/ ++nStartAction;
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // No Scroll starts the timer to repair the scrolled area automatically
+/*N*/ if( GetViewOptions()->IsTest8() )
+/*N*/ #endif
+/*?*/ if ( Imp()->IsScrolled() )
+/*?*/ Imp()->RestartScrollTimer();
+/*N*/
+/*N*/ // #94195# refresh handles when they were hard removed for display change
+/*N*/ if(bRefreshMarker && HasDrawView())
+/*N*/ {
+/*?*/ GetDrawView()->AdjustMarkHdl(FALSE);
+/*N*/ }
+/*N*/
+/*N*/ #ifdef ACCESSIBLE_LAYOUT
+/*N*/ #endif
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::ImplStartAction()
+|*
+|* Ersterstellung MA 25. Jul. 94
+|* Letzte Aenderung MA 25. Jul. 94
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::ImplStartAction()
+/*N*/ {
+/*N*/ bPaintWorks = FALSE;
+/*N*/ Imp()->StartAction();
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::AddPaintRect()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 09. Feb. 97
+|*
+******************************************************************************/
+
+/*N*/ BOOL ViewShell::AddPaintRect( const SwRect & rRect )
+/*N*/ {
+/*N*/ BOOL bRet = FALSE;
+/*N*/ ViewShell *pSh = this;
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pSh->IsPreView() && pSh->GetWin() )
+/*N*/ // pSh->GetWin()->Invalidate();
+/*?*/ DBG_BF_ASSERT(0, "STRIP");//::binfilter::RepaintPagePreview( pSh, rRect );
+/*N*/ else
+/*N*/ bRet |= pSh->Imp()->AddPaintRect( rRect );
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != this );
+/*N*/ return bRet;
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::InvalidateWindows()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 09. Feb. 97
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::InvalidateWindows( const SwRect &rRect )
+/*N*/ {
+/*N*/ if ( !Imp()->IsCalcLayoutProgress() )
+/*N*/ {
+/*N*/ ViewShell *pSh = this;
+/*N*/ do
+/*N*/ {
+/*N*/ if ( pSh->GetWin() )
+/*N*/ {
+/*N*/ if ( pSh->IsPreView() )
+/*N*/ // pSh->GetWin()->Invalidate();
+/*?*/ DBG_BF_ASSERT(0, "STRIP");//::binfilter::RepaintPagePreview( pSh, rRect );
+/*N*/ else if ( pSh->VisArea().IsOver( rRect ) )
+/*N*/ pSh->GetWin()->Invalidate( rRect.SVRect() );
+/*N*/ }
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != this );
+/*N*/ }
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::MakeVisible()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung AMA 10. Okt. 95
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::MakeVisible( const SwRect &rRect )
+/*N*/ {
+/*N*/ if ( !VisArea().IsInside( rRect ) || /*IsScrollMDI( this, rRect ) ||*/ GetCareWin(*this) )
+/*N*/ {
+/*N*/ if ( !IsViewLocked() )
+/*N*/ {
+/*N*/ if( pWin )
+/*N*/ {
+/*N*/ const SwFrm* pRoot = GetDoc()->GetRootFrm();
+/*N*/ int nLoopCnt = 3;
+/*N*/ long nOldH;
+/*N*/ do{
+/*N*/ nOldH = pRoot->Frm().Height();
+/*N*/ StartAction();
+/*N*/ DBG_BF_ASSERT(0, "STRIP");//ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX );
+/*N*/ EndAction();
+/*N*/ } while( nOldH != pRoot->Frm().Height() && nLoopCnt-- );
+/*N*/ }
+/*N*/ #ifdef DBG_UTIL
+/*N*/ else
+/*N*/ {
+/*N*/ //MA: 04. Nov. 94, braucht doch keiner oder??
+/*N*/ ASSERT( !this, "MakeVisible fuer Drucker wird doch gebraucht?" );
+/*N*/ }
+/*N*/
+/*N*/ #endif
+/*N*/ }
+/*N*/ }
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::CareChildWindow()
+|*
+|* Ersterstellung AMA 10. Okt. 95
+|* Letzte Aenderung AMA 10. Okt. 95
+|*
+******************************************************************************/
+
+
+/******************************************************************************
+|*
+|* ViewShell::GetPagePos()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 04. Aug. 93
+|*
+******************************************************************************/
+
+
+/*************************************************************************
+|*
+|* ViewShell::LayoutIdle()
+|*
+|* Ersterstellung MA 26. May. 92
+|* Letzte Aenderung OG 19. Mar. 96
+|*
+*************************************************************************/
+
+/*N*/ void ViewShell::LayoutIdle()
+/*N*/ {
+/*N*/ #ifdef TCOVER
+/*N*/ //fuer TCV-Version: Ende der Startphase des Programmes
+/*N*/ TCovCall::Idle();
+/*N*/ #endif
+/*N*/ if( !pOpt->IsIdle() || !GetWin() ||
+/*N*/ ( Imp()->HasDrawView() && Imp()->GetDrawView()->IsDragObj() ) )
+/*N*/ return;
+/*N*/
+/*N*/ //Kein Idle wenn gerade gedruckt wird.
+/*N*/ ViewShell *pSh = this;
+/*N*/ do
+/*N*/ { if ( !pSh->GetWin() )
+/*N*/ return;
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != this );
+/*N*/
+/*N*/ SET_CURR_SHELL( this );
+/*N*/
+/*N*/ #ifdef DBG_UTIL
+/*N*/ // Wenn Test5 gedrueckt ist, wird der IdleFormatierer abgeknipst.
+/*N*/ if( pOpt->IsTest5() )
+/*N*/ return;
+/*N*/ #endif
+/*N*/
+/*N*/ {
+/*N*/ DBG_PROFSTART( LayoutIdle );
+/*N*/
+/*N*/ //Cache vorbereiten und restaurieren, damit er nicht versaut wird.
+/*N*/ SwSaveSetLRUOfst aSave( *SwTxtFrm::GetTxtCache(),
+/*N*/ SwTxtFrm::GetTxtCache()->GetCurMax() - 50 );
+/*N*/ SwLayIdle aIdle( GetLayout(), Imp() );
+/*N*/ DBG_PROFSTOP( LayoutIdle );
+/*N*/ }
+/*N*/ }
+
+// Absatzabstaende koennen wahlweise addiert oder maximiert werden
+
+
+/******************************************************************************
+|*
+|* ViewShell::Reformat
+|*
+|* Ersterstellung BP ???
+|* Letzte Aenderung MA 13. Feb. 98
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::Reformat()
+/*N*/ {
+/*N*/ // Wir gehen auf Nummer sicher:
+/*N*/ // Wir muessen die alten Fontinformationen wegschmeissen,
+/*N*/ // wenn die Druckeraufloesung oder der Zoomfaktor sich aendert.
+/*N*/ // Init() und Reformat() sind die sichersten Stellen.
+/*N*/ #ifdef FNTMET
+/*N*/ aFntMetList.Flush();
+/*N*/ #else
+/*N*/ pFntCache->Flush( );
+/*N*/ #endif
+/*N*/
+/*N*/ if( GetLayout()->IsCallbackActionEnabled() )
+/*N*/ {
+/*N*/
+/*N*/ StartAction();
+/*N*/ GetLayout()->InvalidateAllCntnt();
+/*N*/ EndAction();
+/*N*/ }
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::CalcLayout()
+|* Vollstaendige Formatierung von Layout und Inhalt.
+|*
+|* Ersterstellung MA 31. Jan. 94
+|* Letzte Aenderung MA 08. Oct. 96
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::CalcLayout()
+/*N*/ {
+/*N*/ SET_CURR_SHELL( this );
+/*N*/
+/*N*/ //Cache vorbereiten und restaurieren, damit er nicht versaut wird.
+/*N*/ SwSaveSetLRUOfst aSaveLRU( *SwTxtFrm::GetTxtCache(),
+/*N*/ SwTxtFrm::GetTxtCache()->GetCurMax() - 50 );
+/*N*/
+/*N*/ //Progress einschalten wenn noch keiner Lauft.
+/*N*/ const BOOL bEndProgress = SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) == 0;
+/*N*/ if ( bEndProgress )
+/*N*/ {
+/*N*/ USHORT nEndPage = GetLayout()->GetPageNum();
+/*N*/ nEndPage += nEndPage * 10 / 100;
+/*N*/ ::binfilter::StartProgress( STR_STATSTR_REFORMAT, 0, nEndPage, GetDoc()->GetDocShell() );
+/*N*/ }
+/*N*/
+/*N*/ SwLayAction aAction( GetLayout(), Imp() );
+/*N*/ aAction.SetPaint( FALSE );
+/*N*/ aAction.SetStatBar( TRUE );
+/*N*/ aAction.SetCalcLayout( TRUE );
+/*N*/ aAction.SetReschedule( TRUE );
+/*N*/ GetDoc()->LockExpFlds();
+/*N*/ aAction.Action();
+/*N*/ GetDoc()->UnlockExpFlds();
+/*N*/
+/*N*/ //Das SetNewFldLst() am Doc wurde unterbunden und muss nachgeholt
+/*N*/ //werden (siehe flowfrm.cxx, txtfld.cxx)
+/*N*/ if ( aAction.IsExpFlds() )
+/*N*/ {
+/*N*/ aAction.Reset();
+/*N*/ aAction.SetPaint( FALSE );
+/*N*/ aAction.SetStatBar( TRUE );
+/*N*/ aAction.SetReschedule( TRUE );
+/*N*/
+/*N*/ SwDocPosUpdate aMsgHnt( 0 );
+/*N*/ GetDoc()->UpdatePageFlds( &aMsgHnt );
+/*N*/ GetDoc()->UpdateExpFlds();
+/*N*/
+/*N*/ aAction.Action();
+/*N*/ }
+/*N*/
+/*N*/ if ( VisArea().HasArea() )
+/*N*/ InvalidateWindows( VisArea() );
+/*N*/ if ( bEndProgress )
+/*N*/ ::binfilter::EndProgress( GetDoc()->GetDocShell() );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::SetFirstVisPageInvalid()
+|*
+|* Ersterstellung MA 19. May. 94
+|* Letzte Aenderung MA 19. May. 94
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::SetFirstVisPageInvalid()
+/*N*/ {
+/*N*/ ViewShell *pSh = this;
+/*N*/ do
+/*N*/ { pSh->Imp()->SetFirstVisPageInvalid();
+/*N*/ pSh = (ViewShell*)pSh->GetNext();
+/*N*/
+/*N*/ } while ( pSh != this );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::SizeChgNotify()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 17. Sep. 96
+|*
+******************************************************************************/
+
+/*N*/ void ViewShell::SizeChgNotify(const Size &rSize)
+/*N*/ {
+/*N*/ if ( !pWin )
+/*N*/ bDocSizeChgd = TRUE;
+/*N*/ else if( ActionPend() || Imp()->IsCalcLayoutProgress() || bPaintInProgress )
+/*N*/ {
+/*N*/ bDocSizeChgd = TRUE;
+/*N*/
+/*N*/ if ( !Imp()->IsCalcLayoutProgress() && ISA( SwCrsrShell ) )
+/*N*/ {
+/*N*/ const SwFrm *pCnt = ((SwCrsrShell*)this)->GetCurrFrm( FALSE );
+/*N*/ const SwPageFrm *pPage;
+/*N*/ if ( pCnt && 0 != (pPage = pCnt->FindPageFrm()) )
+/*N*/ {
+/*N*/ USHORT nVirtNum = pPage->GetVirtPageNum();
+/*N*/ const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
+/*N*/ String sDisplay = rNum.GetNumStr( nVirtNum );
+/*N*/ DBG_BF_ASSERT(0, "STRIP");//PageNumNotify( this, pCnt->GetPhyPageNum(), nVirtNum, sDisplay );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ else
+/*N*/ {
+/*N*/ bDocSizeChgd = FALSE;
+/*N*/ DBG_BF_ASSERT(0, "STRIP");//::binfilter::SizeNotify( this, GetLayout()->Frm().SSize() );
+/*N*/ }
+/*N*/ }
+
+/*************************************************************************
+|*
+|* ViewShell::GetLayout()
+|*
+|* Ersterstellung OK 26. May. 92
+|* Letzte Aenderung MA 16. Sep. 93
+|*
+*************************************************************************/
+
+/*N*/ SwRootFrm *ViewShell::GetLayout() const
+/*N*/ {
+/*N*/ return GetDoc()->GetRootFrm();
+/*N*/ }
+/*N*/
+/*N*/ SfxPrinter* ViewShell::GetPrt( BOOL bCreate ) const
+/*N*/ {
+/*N*/ return GetDoc()->GetPrt( bCreate );
+/*N*/ }
+
+
+/*N*/ OutputDevice& ViewShell::GetRefDev() const
+/*N*/ {
+/*N*/ OutputDevice* pTmpOut = 0;
+/*N*/ if ( GetWin() && IsBrowseMode() &&
+/*N*/ ! GetViewOptions()->IsPrtFormat() )
+/*N*/ pTmpOut = GetWin();
+/*N*/ else if ( 0 != mpTmpRef )
+/*N*/ pTmpOut = mpTmpRef;
+/*N*/ else
+/*N*/ pTmpOut = &GetDoc()->GetRefDev();
+/*N*/
+/*N*/ return *pTmpOut;
+/*N*/ }
+
+/*N*/ void ViewShell::DrawSelChanged(SdrView*)
+/*N*/ {
+/*N*/ }
+
+
+/******************************************************************************
+|*
+|* ViewShell::UISizeNotify()
+|*
+|* Ersterstellung MA 14. Jan. 97
+|* Letzte Aenderung MA 14. Jan. 97
+|*
+******************************************************************************/
+
+
+/*N*/ void ViewShell::UISizeNotify()
+/*N*/ {
+/*N*/ if ( bDocSizeChgd )
+/*N*/ {
+/*N*/ bDocSizeChgd = FALSE;
+/*N*/ FASTBOOL bOld = bInSizeNotify;
+/*N*/ bInSizeNotify = TRUE;
+/*N*/ DBG_BF_ASSERT(0, "STRIP");//::binfilter::SizeNotify( this, GetLayout()->Frm().SSize() );
+/*N*/ bInSizeNotify = bOld;
+/*N*/ }
+/*N*/ }
+
+
+/*N*/ BOOL ViewShell::IsBrowseMode() const
+/*N*/ {
+/*N*/ return GetDoc()->IsBrowseMode();
+/*N*/ }
+
+ShellResource* ViewShell::GetShellRes()
+{
+ if ( !pShellRes )
+ pShellRes = new ShellResource();
+ return pShellRes;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/view/sw_vnew.cxx b/binfilter/bf_sw/source/core/view/sw_vnew.cxx
new file mode 100644
index 000000000000..48faef292375
--- /dev/null
+++ b/binfilter/bf_sw/source/core/view/sw_vnew.cxx
@@ -0,0 +1,224 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifdef _MSC_VER
+#pragma hdrstop
+#endif
+
+#include <rtl/logfile.hxx>
+
+#include <horiornt.hxx>
+
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <viewsh.hxx>
+#include <rootfrm.hxx>
+#include <viewimp.hxx>
+#include <viewopt.hxx>
+#include <txtfrm.hxx> // Zugriff auf TxtCache
+#include <notxtfrm.hxx>
+#include <fntcache.hxx>
+#include <docufld.hxx>
+#include <ptqueue.hxx>
+#include <dview.hxx> // SdrView
+#include <ndgrf.hxx>
+#include <ndindex.hxx>
+#include <accessibilityoptions.hxx>
+namespace binfilter {
+
+/*************************************************************************
+|*
+|* ViewShell::Init()
+|*
+|* Letzte Aenderung MA 14. Jun. 96
+|*
+|*************************************************************************/
+
+/*N*/ void ViewShell::Init( const SwViewOption *pNewOpt )
+/*N*/ {
+/*N*/ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "ViewShell::Init" );
+/*N*/
+/*N*/ bDocSizeChgd = FALSE;
+/*N*/
+/*N*/ // Wir gehen auf Nummer sicher:
+/*N*/ // Wir muessen die alten Fontinformationen wegschmeissen,
+/*N*/ // wenn die Druckeraufloesung oder der Zoomfaktor sich aendert.
+/*N*/ // Init() und Reformat() sind die sichersten Stellen.
+/*N*/ pFntCache->Flush( );
+/*N*/
+/*N*/ // ViewOptions werden dynamisch angelegt
+/*N*/ if( !pOpt )
+/*N*/ {
+/*N*/ pOpt = new SwViewOption;
+/*N*/
+/*N*/ // Ein ApplyViewOptions braucht nicht gerufen zu werden
+/*N*/ if( pNewOpt )
+/*N*/ {
+/*N*/ *pOpt = *pNewOpt;
+/*N*/ // Der Zoomfaktor muss eingestellt werden, weil in der CTOR-
+/*N*/ // phase aus Performancegruenden kein ApplyViewOptions gerufen wird.
+/*N*/ if( GetWin() && 100 != pOpt->GetZoom() )
+/*N*/ {
+/*N*/ MapMode aMode( pWin->GetMapMode() );
+/*N*/ const Fraction aNewFactor( pOpt->GetZoom(), 100 );
+/*N*/ aMode.SetScaleX( aNewFactor );
+/*N*/ aMode.SetScaleY( aNewFactor );
+/*N*/ pWin->SetMapMode( aMode );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/
+/*N*/ SwDocShell* pDShell = pDoc->GetDocShell();
+/*N*/ pDoc->SetHTMLMode( 0 != ::binfilter::GetHtmlMode( pDShell ) );
+/*N*/
+/*N*/ // JP 02.02.99: Bug 61335 - Readonly-Flag an den ViewOptions setzen,
+/*N*/ // bevor das Layout angelegt wird. Ansonsten muesste man
+/*N*/ // nochmals durchformatieren!!
+/*N*/ if( pDShell && pDShell->IsReadOnly() )
+/*N*/ pOpt->SetReadonly( TRUE );
+/*N*/
+/*N*/ RTL_LOGFILE_CONTEXT_TRACE( aLog, "View::Init - before InitPrt" );
+
+ // Setup the printer. This has to be done even if we use the virtual
+ // device for formatting, because the default page format is obtained
+ // from the printer
+/*N*/ if( GetPrt( ! pDoc->IsBrowseMode() ) )
+/*N*/ InitPrt( GetPrt() );
+/*N*/
+/*N*/ RTL_LOGFILE_CONTEXT_TRACE( aLog, "View::Init - after InitPrt" );
+/*N*/
+/*N*/ if( GetWin() )
+/*N*/ {
+/*N*/ pOpt->Init( GetWin() );
+/*N*/ GetWin()->SetFillColor();
+/*N*/ GetWin()->SetBackground();
+/*N*/ GetWin()->SetLineColor();
+/*N*/ }
+/*N*/
+/*N*/ //Layout erzeugen wenn es noch nicht vorhanden ist.
+/*N*/ SwRootFrm* pRoot = GetDoc()->GetRootFrm();
+/*N*/ if( !pRoot )
+/*N*/ GetDoc()->SetRootFrm( pRoot = new SwRootFrm( pDoc->GetDfltFrmFmt(), this ) );
+/*N*/
+/*N*/ SizeChgNotify( pRoot->Frm().SSize() );
+/*N*/ }
+
+/******************************************************************************
+|*
+|* ViewShell::~ViewShell()
+|*
+|* Ersterstellung MA ??
+|* Letzte Aenderung MA 10. May. 95
+|*
+******************************************************************************/
+
+/*N*/ ViewShell::~ViewShell()
+/*N*/ {
+/*N*/ {
+/*N*/ SET_CURR_SHELL( this );
+/*N*/ bPaintWorks = FALSE;
+/*N*/
+/*N*/ //Die Animierten Grafiken abschalten!
+/*N*/ if( pDoc )
+/*N*/ {
+/*N*/ SwNodes& rNds = pDoc->GetNodes();
+/*N*/ SwGrfNode *pGNd;
+/*N*/
+/*N*/ SwStartNode *pStNd;
+/*N*/ SwNodeIndex aIdx( *rNds.GetEndOfAutotext().StartOfSectionNode(), 1 );
+/*N*/ while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
+/*N*/ {
+/*N*/ aIdx++;
+/*N*/ if ( 0 != ( pGNd = aIdx.GetNode().GetGrfNode() ) )
+/*N*/ {
+/*N*/ if( pGNd->IsAnimated() )
+/*N*/ {
+/*N*/ SwClientIter aIter( *pGNd );
+/*N*/ for( SwFrm* pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) );
+/*N*/ pFrm; pFrm = (SwFrm*)aIter.Next() )
+/*N*/ {
+/*N*/ ASSERT( pFrm->IsNoTxtFrm(), "GraphicNode with Text?" );
+/*N*/ ((SwNoTxtFrm*)pFrm)->StopAnimation( pOut );
+/*N*/ }
+/*N*/ }
+/*N*/ }
+/*N*/ aIdx.Assign( *pStNd->EndOfSectionNode(), +1 );
+/*N*/ }
+/*N*/
+/*N*/ GetDoc()->StopNumRuleAnimations( pOut );
+/*N*/ }
+/*N*/
+/*N*/ delete pImp; //Erst loeschen, damit die LayoutViews vernichtet werden.
+/*N*/ pImp = 0; // Set to zero, because ~SwFrm relies on it.
+/*N*/
+/*N*/ if ( pDoc )
+/*N*/ {
+/*N*/ if( !pDoc->RemoveLink() )
+/*?*/ delete pDoc, pDoc = 0;
+/*N*/ else
+/*N*/ pDoc->GetRootFrm()->ResetNewLayout();
+/*N*/ }
+/*N*/
+/*N*/ delete pOpt;
+/*N*/
+/*N*/ //Format-Cache zurueckschrauben.
+/*N*/ if ( SwTxtFrm::GetTxtCache()->GetCurMax() > 250 )
+/*N*/ SwTxtFrm::GetTxtCache()->DecreaseMax( 100 );
+/*N*/
+/*N*/ //Ggf. aus der PaintQueue entfernen lassen
+/*N*/ SwPaintQueue::Remove( this );
+/*N*/
+/*N*/ ASSERT( !nStartAction, "EndAction() pending." );
+/*N*/ }
+/*N*/
+/*N*/ if ( pDoc )
+/*N*/ GetLayout()->DeRegisterShell( this );
+/*N*/
+/*N*/ delete mpTmpRef;
+/*N*/ delete pAccOptions;
+/*N*/ }
+
+/*N*/ BOOL ViewShell::HasDrawView() const
+/*N*/ {
+/*N*/ return Imp()->HasDrawView();
+/*N*/ }
+
+/*N*/ void ViewShell::MakeDrawView()
+/*N*/ {
+/*N*/ Imp()->MakeDrawView( );
+/*N*/ }
+
+/*N*/ SdrView* ViewShell::GetDrawView()
+/*N*/ {
+/*N*/ return Imp()->GetDrawView();
+/*N*/ }
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_sw/source/core/view/sw_vprint.cxx b/binfilter/bf_sw/source/core/view/sw_vprint.cxx
new file mode 100644
index 000000000000..fc6b87d8df07
--- /dev/null
+++ b/binfilter/bf_sw/source/core/view/sw_vprint.cxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include <hintids.hxx>
+
+#include <horiornt.hxx>
+
+#include <fesh.hxx>
+#include <viewimp.hxx> // Imp->SetFirstVisPageInvalid()
+#include <statstr.hrc> // -- " --
+#include <ptqueue.hxx>
+
+#include <bf_sfx2/printer.hxx>
+
+namespace binfilter {
+
+#define JOBSET_ERR_DEFAULT 0
+#define JOBSET_ERR_ERROR 1
+#define JOBSET_ERR_ISSTARTET 2
+
+//--------------------------------------------------------------------
+//Klasse zum Puffern von Paints
+class SwQueuedPaint
+{
+public:
+ SwQueuedPaint *pNext;
+ ViewShell *pSh;
+ SwRect aRect;
+
+ SwQueuedPaint( ViewShell *pNew, const SwRect &rRect ) :
+ pNext( 0 ),
+ pSh( pNew ),
+ aRect( rRect )
+ {}
+};
+
+SwQueuedPaint *SwPaintQueue::pQueue = 0;
+
+/*N*/ void SwPaintQueue::Remove( ViewShell *pSh )
+/*N*/ {
+/*N*/ SwQueuedPaint *pPt;
+/*N*/ if ( 0 != (pPt = pQueue) )
+/*N*/ {
+/*?*/ SwQueuedPaint *pPrev = 0;
+/*?*/ while ( pPt && pPt->pSh != pSh )
+/*?*/ {
+/*?*/ pPrev = pPt;
+/*?*/ pPt = pPt->pNext;
+/*?*/ }
+/*?*/ if ( pPt )
+/*?*/ {
+/*?*/ if ( pPrev )
+/*?*/ pPrev->pNext = pPt->pNext;
+/*?*/ else if ( pPt == pQueue )
+/*?*/ pQueue = 0;
+/*?*/ delete pPt;
+/*?*/ }
+/*N*/ }
+/*N*/ }
+
+/*M*/ void ViewShell::InitPrt( SfxPrinter *pPrt, OutputDevice *pPDFOut )
+/*M*/ {
+/*M*/ //Fuer den Printer merken wir uns einen negativen Offset, der
+/*M*/ //genau dem Offset de OutputSize entspricht. Das ist notwendig,
+/*M*/ //weil unser Ursprung der linken ober Ecke der physikalischen
+/*M*/ //Seite ist, die Ausgaben (SV) aber den Outputoffset als Urstprung
+/*M*/ //betrachten.
+/*M*/ OutputDevice *pTmpDev = pPDFOut ? pPDFOut : (OutputDevice *) pPrt;
+/*M*/ if ( pTmpDev )
+/*M*/ {
+/*M*/ aPrtOffst = pPrt ? pPrt->GetPageOffset() : Point();
+/*M*/
+/*M*/ aPrtOffst += pTmpDev->GetMapMode().GetOrigin();
+/*M*/ MapMode aMapMode( pTmpDev->GetMapMode() );
+/*M*/ aMapMode.SetMapUnit( MAP_TWIP );
+/*M*/ pTmpDev->SetMapMode( aMapMode );
+/*M*/ pTmpDev->SetLineColor();
+/*M*/ pTmpDev->SetFillColor();
+/*M*/ }
+/*M*/ else
+/*M*/ aPrtOffst.X() = aPrtOffst.Y() = 0;
+/*M*/
+/*M*/ if ( !pWin )
+/*M*/ pOut = pTmpDev; //Oder was sonst?
+/*M*/ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */